summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Musolino <alex@musolino.id.au>2018-07-08 12:18:06 +0930
committerAlex Musolino <alex@musolino.id.au>2018-07-08 12:18:06 +0930
commit8fd222c1575da1fdebc6906799476c953c8f6cf5 (patch)
tree97ac428b3e179340f0c5c31d444bfe4093c09f84
parent259a31e59baf7a3e29b7d62d59822b9114b3f805 (diff)
downloadplan9front-8fd222c1575da1fdebc6906799476c953c8f6cf5.tar.xz
upas/smtp: use current login id in absence of -u option (as per man page)
-rw-r--r--sys/src/cmd/upas/smtp/smtp.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/src/cmd/upas/smtp/smtp.c b/sys/src/cmd/upas/smtp/smtp.c
index 4fb437992..579751255 100644
--- a/sys/src/cmd/upas/smtp/smtp.c
+++ b/sys/src/cmd/upas/smtp/smtp.c
@@ -203,6 +203,8 @@ main(int argc, char **argv)
domain = domainname_read();
if(host == 0)
host = sysname_read();
+ if(user == nil)
+ user = getuser();
strcpy(hostdomain, domainify(host, domain));
strcpy(hellodomain, domainify(sysname_read(), domain));
@@ -464,9 +466,7 @@ smtpcram(DS *ds)
l = dec64((uchar*)ch, sizeof ch, p, strlen(p));
ch[l] = 0;
n = auth_respond(ch, l, usr, sizeof usr, rbuf, sizeof rbuf, auth_getkey,
- user!=nil?
- "proto=cram role=client server=%q user=%q":
- "proto=cram role=client server=%q",
+ "proto=cram role=client server=%q user=%q",
ds->host, user);
if(n == -1)
return "cannot find SMTP password";
@@ -495,9 +495,7 @@ doauth(char *methods)
if(strstr(methods, "CRAM-MD5"))
return smtpcram(&ds);
p = auth_getuserpasswd(nil,
- user!=nil?
- "proto=pass service=smtp server=%q user=%q":
- "proto=pass service=smtp server=%q",
+ "proto=pass service=smtp server=%q user=%q",
ds.host, user);
if (p == nil) {
syslog(0, "smtp.fail", "failed to get userpasswd: %r");