Skip to content

Commit

Permalink
doveadm who: Fixed listing LMTP sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed May 10, 2016
1 parent 1c3f119 commit 9233125
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/doveadm/doveadm-who.c
Expand Up @@ -59,19 +59,24 @@ static int who_parse_line(const char *line, struct who_line *line_r)

memset(line_r, 0, sizeof(*line_r));

/* ident = service/ip/username (imap, pop3)
or service/username (lmtp) */
p = strchr(ident, '/');
if (p == NULL)
return -1;
if (str_to_pid(pid_str, &line_r->pid) < 0)
return -1;
line_r->service = t_strdup_until(ident, p++);
line_r->username = strchr(p, '/');
if (line_r->username == NULL)
return -1;
if (line_r->username == NULL) {
/* no IP */
line_r->username = p;
} else {
ip_str = t_strdup_until(p, line_r->username++);
(void)net_addr2ip(ip_str, &line_r->ip);
}
if (str_to_uint(refcount_str, &line_r->refcount) < 0)
return -1;
ip_str = t_strdup_until(p, line_r->username++);
(void)net_addr2ip(ip_str, &line_r->ip);
return 0;
}

Expand Down

0 comments on commit 9233125

Please sign in to comment.