diff options
| author | manuel <manuel@mausz.at> | 2017-12-06 16:06:49 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2017-12-06 16:06:49 +0100 |
| commit | 63ce8bafa5bad20bf5cbb62be6fffc7842af18dc (patch) | |
| tree | f4d69c387aa964636977d9fc061a4f44faa23368 | |
| parent | 2100adc9e664fc786fa9fa01ed50c278b47eb415 (diff) | |
| download | qmail-63ce8bafa5bad20bf5cbb62be6fffc7842af18dc.tar.gz qmail-63ce8bafa5bad20bf5cbb62be6fffc7842af18dc.tar.bz2 qmail-63ce8bafa5bad20bf5cbb62be6fffc7842af18dc.zip | |
realrcptto: stop resolving after dovecot-rda has been found
| -rw-r--r-- | realrcptto.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/realrcptto.c b/realrcptto.c index e18a21f..34661c7 100644 --- a/realrcptto.c +++ b/realrcptto.c | |||
| @@ -193,7 +193,7 @@ int depth; | |||
| 193 | { | 193 | { |
| 194 | stralloc cmds = {0}; | 194 | stralloc cmds = {0}; |
| 195 | char *username = NULL; | 195 | char *username = NULL; |
| 196 | int fd, i, j, k, count; | 196 | int fd, i, j, k, count, found_rda = 0; |
| 197 | 197 | ||
| 198 | if (depth >= MAXRECURSION) return 0; | 198 | if (depth >= MAXRECURSION) return 0; |
| 199 | if (!stralloc_ready(&cmds,0)) die_nomem(); | 199 | if (!stralloc_ready(&cmds,0)) die_nomem(); |
| @@ -226,9 +226,9 @@ int depth; | |||
| 226 | ++i; | 226 | ++i; |
| 227 | char *u, *u2; | 227 | char *u, *u2; |
| 228 | if ((u = strstr(cmds.s + i, "dovecot-rda ")) != NULL | 228 | if ((u = strstr(cmds.s + i, "dovecot-rda ")) != NULL |
| 229 | && (u = strstr(u + strlen("dovecot-rda "), "-a")) != NULL) | 229 | && (u = strstr(u + str_len("dovecot-rda "), "-a")) != NULL) |
| 230 | { | 230 | { |
| 231 | u += strlen("-a"); | 231 | u += str_len("-a"); |
| 232 | while (*u && (*u == ' ' || *u == '"')) | 232 | while (*u && (*u == ' ' || *u == '"')) |
| 233 | ++u; | 233 | ++u; |
| 234 | u2 = u; | 234 | u2 = u; |
| @@ -239,6 +239,7 @@ int depth; | |||
| 239 | *u2 = '\0'; | 239 | *u2 = '\0'; |
| 240 | count++; | 240 | count++; |
| 241 | username = u; | 241 | username = u; |
| 242 | found_rda = 1; | ||
| 242 | } | 243 | } |
| 243 | } | 244 | } |
| 244 | break; | 245 | break; |
| @@ -253,7 +254,14 @@ int depth; | |||
| 253 | } | 254 | } |
| 254 | } | 255 | } |
| 255 | 256 | ||
| 256 | if (count == 1 && username) | 257 | /* found a single dovecot-rda line. stop lookup */ |
| 258 | if (count == 1 && username && found_rda) | ||
| 259 | { | ||
| 260 | env_put2("DTUSER", username); | ||
| 261 | return 1; | ||
| 262 | } | ||
| 263 | /* found alias/system username. resolve again */ | ||
| 264 | else if (count == 1 && username) | ||
| 257 | realrcptto(username, ++depth); | 265 | realrcptto(username, ++depth); |
| 258 | 266 | ||
| 259 | return 1; | 267 | return 1; |
