From: Markus Valentin Date: Thu, 13 Jun 2019 18:45:55 +0000 (+0200) Subject: lib-auth: add real_[remote|local]_[ip|port] to auth_user_info X-Git-Tag: 2.3.8~218 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fd430e5300de6fe7b27d0fc049e274f40b8b386f;p=thirdparty%2Fdovecot%2Fcore.git lib-auth: add real_[remote|local]_[ip|port] to auth_user_info This allows the auth_user_info_export function to export all the real_ variables, if available, to the auth request thereby enableing real_ variables for lib-auth. --- diff --git a/src/lib-auth/auth-master.c b/src/lib-auth/auth-master.c index ac43712960..33aea72a9c 100644 --- a/src/lib-auth/auth-master.c +++ b/src/lib-auth/auth-master.c @@ -540,6 +540,18 @@ auth_user_info_export(string_t *str, const struct auth_user_info *info) str_printfa(str, "\trip=%s", net_ip2addr(&info->remote_ip)); if (info->remote_port != 0) str_printfa(str, "\trport=%d", info->remote_port); + if (info->real_remote_ip.family != 0 && + !net_ip_compare(&info->real_remote_ip, &info->remote_ip)) + str_printfa(str, "\treal_rip=%s", net_ip2addr(&info->real_remote_ip)); + if (info->real_local_ip.family != 0 && + !net_ip_compare(&info->real_local_ip, &info->local_ip)) + str_printfa(str, "\treal_lip=%s", net_ip2addr(&info->real_local_ip)); + if (info->real_local_port != 0 && + info->real_local_port != info->local_port) + str_printfa(str, "\treal_lport=%d", info->real_local_port); + if (info->real_remote_port != 0 && + info->real_remote_port != info->remote_port) + str_printfa(str, "\treal_rport=%d", info->real_remote_port); if (info->debug) str_append(str, "\tdebug"); } diff --git a/src/lib-auth/auth-master.h b/src/lib-auth/auth-master.h index 47ad70e3c4..f7f4f4e211 100644 --- a/src/lib-auth/auth-master.h +++ b/src/lib-auth/auth-master.h @@ -12,8 +12,8 @@ enum auth_master_flags { struct auth_user_info { const char *service; - struct ip_addr local_ip, remote_ip; - in_port_t local_port, remote_port; + struct ip_addr local_ip, remote_ip, real_local_ip, real_remote_ip; + in_port_t local_port, remote_port, real_local_port, real_remote_port; bool debug; };