aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleydson Soares <gsoares@gmail.com>2015-06-04 09:11:06 -0300
committerRuss Cox <rsc@swtch.com>2015-06-29 02:25:42 +0000
commit71de840f054e52a8a077b2333edc1f4243480359 (patch)
tree217b3bd4ef181ee14b1a1bb12f52c150ac910a3e
parent3f1c876e14e7eb45c1e17e1f3f4a28d98ff9b35f (diff)
downloadplan9port-71de840f054e52a8a077b2333edc1f4243480359.tar.gz
plan9port-71de840f054e52a8a077b2333edc1f4243480359.tar.bz2
plan9port-71de840f054e52a8a077b2333edc1f4243480359.zip
upas/nfs: search for stunnele3 in $PATH
Do not hardcode stunnel directory path, just make sure that is installed in user '$PATH'. it is required for 'mailfs -t' TLS support, so printout an error string if it was not found. Tested with latest stunnel version 5.17 on OpenBSD and macosx. % mailfs -t imap.gmail.com ; echo $? 0 Change-Id: Icbd507c7efa81ef2aa7aed37bec5f639b37526cb Reviewed-on: https://plan9port-review.googlesource.com/1280 Reviewed-by: Russ Cox <rsc@swtch.com>
-rw-r--r--src/cmd/upas/nfs/imap.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/cmd/upas/nfs/imap.c b/src/cmd/upas/nfs/imap.c
index b36f40bb..1936c115 100644
--- a/src/cmd/upas/nfs/imap.c
+++ b/src/cmd/upas/nfs/imap.c
@@ -779,6 +779,7 @@ imapdial(char *server, int mode)
int p[2];
int fd[3];
char *tmp;
+ char *fpath;
switch(mode){
default:
@@ -797,10 +798,12 @@ imapdial(char *server, int mode)
fd[2] = dup(2, -1);
#ifdef PLAN9PORT
tmp = esmprint("%s:993", server);
- if(threadspawnl(fd, "/usr/sbin/stunnel3", "stunnel3", "-c", "-r", tmp, nil) < 0
- && threadspawnl(fd, "/usr/bin/stunnel3", "stunnel3", "-c", "-r", tmp, nil) < 0
- && threadspawnl(fd, "/usr/sbin/stunnel", "stunnel", "-c", "-r", tmp, nil) < 0
- && threadspawnl(fd, "/usr/bin/stunnel", "stunnel", "-c", "-r", tmp, nil) < 0){
+ fpath = searchpath("stunnel3");
+ if (!fpath) {
+ werrstr("stunnel not found. it is required for tls support.");
+ return -1;
+ }
+ if(threadspawnl(fd, fpath, "stunnel", "-c", "-r", tmp, nil) < 0) {
#else
tmp = esmprint("tcp!%s!993", server);
if(threadspawnl(fd, "/bin/tlsclient", "tlsclient", tmp, nil) < 0){