osmtpd_link_auth() should split the string "status|user", but the code thought it was "user|status". After the split, the pointer is at the username, making the status check a comparison between a username and pass/fail, so it doesn't work.
Signed-off-by: Yifeng Li <to...@tomli.me> --- opensmtpd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/opensmtpd.c b/opensmtpd.c index 4d551f0..f0bd4ae 100644 --- a/opensmtpd.c +++ b/opensmtpd.c @@ -1428,16 +1428,17 @@ osmtpd_link_tls(struct osmtpd_callback *cb, struct osmtpd_ctx *ctx, static void osmtpd_link_auth(struct osmtpd_callback *cb, struct osmtpd_ctx *ctx, - char *username, char *linedup) + char *status, char *linedup) { void (*f)(struct osmtpd_ctx *, const char *, enum osmtpd_auth_status); - char *status; + char *username; enum osmtpd_auth_status s; - if ((status = strrchr(username, '|')) == NULL) + if ((username = strrchr(status, '|')) == NULL) osmtpd_errx(1, "Invalid auth received: %s", linedup); - status[0] = '\0'; - status++; + username[0] = '\0'; + username++; + if (strcmp(status, "pass") == 0) s = OSMTPD_AUTH_PASS; else if (strcmp(status, "fail") == 0) -- 2.46.1