]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-auth: add real_[remote|local]_[ip|port] to auth_user_info
authorMarkus Valentin <markus.valentin@open-xchange.com>
Thu, 13 Jun 2019 18:45:55 +0000 (20:45 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 10 Sep 2019 07:01:41 +0000 (10:01 +0300)
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.

src/lib-auth/auth-master.c
src/lib-auth/auth-master.h

index ac437129601cd847b9eda838d4909d24c21f4353..33aea72a9c13a1fe19788288f7e1439e204cf71e 100644 (file)
@@ -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");
 }
index 47ad70e3c4f28e19abd689bb849c2196738f9680..f7f4f4e2119171d74980129072924d1957930397 100644 (file)
@@ -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;
 };