upas/smtp: use current login id in absence of -u option (as per man page)
This commit is contained in:
parent
259a31e59b
commit
8fd222c157
1 changed files with 4 additions and 6 deletions
|
@ -203,6 +203,8 @@ main(int argc, char **argv)
|
||||||
domain = domainname_read();
|
domain = domainname_read();
|
||||||
if(host == 0)
|
if(host == 0)
|
||||||
host = sysname_read();
|
host = sysname_read();
|
||||||
|
if(user == nil)
|
||||||
|
user = getuser();
|
||||||
strcpy(hostdomain, domainify(host, domain));
|
strcpy(hostdomain, domainify(host, domain));
|
||||||
strcpy(hellodomain, domainify(sysname_read(), domain));
|
strcpy(hellodomain, domainify(sysname_read(), domain));
|
||||||
|
|
||||||
|
@ -464,9 +466,7 @@ smtpcram(DS *ds)
|
||||||
l = dec64((uchar*)ch, sizeof ch, p, strlen(p));
|
l = dec64((uchar*)ch, sizeof ch, p, strlen(p));
|
||||||
ch[l] = 0;
|
ch[l] = 0;
|
||||||
n = auth_respond(ch, l, usr, sizeof usr, rbuf, sizeof rbuf, auth_getkey,
|
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 user=%q":
|
|
||||||
"proto=cram role=client server=%q",
|
|
||||||
ds->host, user);
|
ds->host, user);
|
||||||
if(n == -1)
|
if(n == -1)
|
||||||
return "cannot find SMTP password";
|
return "cannot find SMTP password";
|
||||||
|
@ -495,9 +495,7 @@ doauth(char *methods)
|
||||||
if(strstr(methods, "CRAM-MD5"))
|
if(strstr(methods, "CRAM-MD5"))
|
||||||
return smtpcram(&ds);
|
return smtpcram(&ds);
|
||||||
p = auth_getuserpasswd(nil,
|
p = auth_getuserpasswd(nil,
|
||||||
user!=nil?
|
"proto=pass service=smtp server=%q user=%q",
|
||||||
"proto=pass service=smtp server=%q user=%q":
|
|
||||||
"proto=pass service=smtp server=%q",
|
|
||||||
ds.host, user);
|
ds.host, user);
|
||||||
if (p == nil) {
|
if (p == nil) {
|
||||||
syslog(0, "smtp.fail", "failed to get userpasswd: %r");
|
syslog(0, "smtp.fail", "failed to get userpasswd: %r");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue