From 08fb6b6e2d13be7b24bbf993bdc99c56e16ca3c5 Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 16 Aug 2017 15:44:01 +0200 Subject: realrcptto: extract username from dovecot-rda calls --- realrcptto.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/realrcptto.c b/realrcptto.c index b419847..866bd57 100644 --- a/realrcptto.c +++ b/realrcptto.c @@ -201,9 +201,28 @@ int depth; case '#': case '.': case '/': - case '|': case '+': break; + case '|': + ++i; + char *u, *u2; + if ((u = strstr(cmds.s + i, "dovecot-rda ")) != NULL + && (u = strstr(u + strlen("dovecot-rda "), "-a")) != NULL) + { + u += strlen("-a"); + while (*u && (*u == ' ' || *u == '"')) + ++u; + u2 = u; + while (*u2 && *u2 != ' ' && *u2 != '"') + ++u2; + if (u != u2) + { + *u2 = '\0'; + count++; + username = u; + } + } + break; case '&': ++i; default: -- cgit v1.2.3