From: David Levine Date: Fri, 3 May 2013 01:36:21 +0000 (-0500) Subject: Fixed failure reported by Valdis of post to retrieve login and X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/b9763fdd7e96e7ac8bdb1ba6cc70d3e92868590c?ds=inline;hp=-c Fixed failure reported by Valdis of post to retrieve login and password with legacy credentials. --- b9763fdd7e96e7ac8bdb1ba6cc70d3e92868590c diff --git a/mts/smtp/smtp.c b/mts/smtp/smtp.c index 98c20d83..7177e5d5 100644 --- a/mts/smtp/smtp.c +++ b/mts/smtp/smtp.c @@ -854,7 +854,7 @@ sm_auth_sasl(char *user, int saslssf, char *mechlist, char *inhost) strncpy(host, inhost, sizeof(host) - 1); } - nmh_get_credentials (host, user, 1, &creds); + nmh_get_credentials (host, user, 0, &creds); /* It's OK to copy the creds pointers here. The callbacks that use them will only be called before this function returns. */ diff --git a/sbr/credentials.c b/sbr/credentials.c index 9d4e41c2..2b9e843e 100644 --- a/sbr/credentials.c +++ b/sbr/credentials.c @@ -48,14 +48,11 @@ nmh_get_credentials (char *host, char *user, int sasl, nmh_creds_t creds) { creds->host = host; if (cred_style == NULL || ! strcmp (cred_style, "legacy")) { - /* This is what inc.c and msgchk.c used to contain. */ - if (user == NULL) { - creds->user = getusername (); - } if (sasl) { + /* This is what inc.c and msgchk.c used to contain. */ + /* Only inc.c and msgchk.c do this. smtp.c doesn't. */ + creds->user = user == NULL ? getusername () : user; creds->password = getusername (); - } else { - ruserpass (host, &creds->user, &creds->password); } } else if (! strncasecmp (cred_style, "file:", 5)) { /* @@ -67,8 +64,11 @@ nmh_get_credentials (char *host, char *user, int sasl, nmh_creds_t creds) { * credentials file didn't have a "default" token) */ creds->user = user; - ruserpass (host, &creds->user, &creds->password); + } else { + admonish (NULL, "unknown credentials style %s", cred_style); + return NOTOK; } + ruserpass (host, &creds->user, &creds->password); return OK; }