From 63ce8bafa5bad20bf5cbb62be6fffc7842af18dc Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 6 Dec 2017 16:06:49 +0100 Subject: realrcptto: stop resolving after dovecot-rda has been found --- realrcptto.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'realrcptto.c') diff --git a/realrcptto.c b/realrcptto.c index e18a21f..34661c7 100644 --- a/realrcptto.c +++ b/realrcptto.c @@ -193,7 +193,7 @@ int depth; { stralloc cmds = {0}; char *username = NULL; - int fd, i, j, k, count; + int fd, i, j, k, count, found_rda = 0; if (depth >= MAXRECURSION) return 0; if (!stralloc_ready(&cmds,0)) die_nomem(); @@ -226,9 +226,9 @@ int depth; ++i; char *u, *u2; if ((u = strstr(cmds.s + i, "dovecot-rda ")) != NULL - && (u = strstr(u + strlen("dovecot-rda "), "-a")) != NULL) + && (u = strstr(u + str_len("dovecot-rda "), "-a")) != NULL) { - u += strlen("-a"); + u += str_len("-a"); while (*u && (*u == ' ' || *u == '"')) ++u; u2 = u; @@ -239,6 +239,7 @@ int depth; *u2 = '\0'; count++; username = u; + found_rda = 1; } } break; @@ -253,7 +254,14 @@ int depth; } } - if (count == 1 && username) + /* found a single dovecot-rda line. stop lookup */ + if (count == 1 && username && found_rda) + { + env_put2("DTUSER", username); + return 1; + } + /* found alias/system username. resolve again */ + else if (count == 1 && username) realrcptto(username, ++depth); return 1; -- cgit v1.2.3