changeset 4031:357175e274b4 HEAD

Pass LOCAL_IP, REMOTE_IP, SERVICE and MASTER_USER in environment to checkpassword.
author Timo Sirainen <timo.sirainen@movial.fi>
date Mon, 20 Feb 2006 15:29:31 +0200
parents faf83f3e19b5
children 7140f09b464f
files src/auth/passdb-checkpassword.c
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/passdb-checkpassword.c	Mon Feb 20 15:14:58 2006 +0200
+++ b/src/auth/passdb-checkpassword.c	Mon Feb 20 15:29:31 2006 +0200
@@ -8,6 +8,7 @@
 #include "str.h"
 #include "ioloop.h"
 #include "hash.h"
+#include "env-util.h"
 #include "passdb.h"
 #include "safe-memset.h"
 
@@ -191,6 +192,25 @@
 				  module->checkpassword_reply_path, NULL);
 		args = t_strsplit(cmd, " ");
 
+		/* Besides passing the standard username and password in a
+		   pipe, also pass some other possibly interesting information
+		   via environment. */
+		env_put(t_strconcat("SERVICE=", request->service, NULL));
+		if (request->local_ip.family != 0) {
+			env_put(t_strconcat("LOCAL_IP=",
+					    net_ip2addr(&request->local_ip),
+					    NULL));
+		}
+		if (request->remote_ip.family != 0) {
+			env_put(t_strconcat("REMOTE_IP=",
+					    net_ip2addr(&request->remote_ip),
+					    NULL));
+		}
+		if (request->master_user != NULL) {
+			env_put(t_strconcat("MASTER_USER=",
+					    request->master_user, NULL));
+		}
+
 		auth_request_log_debug(request, "checkpassword",
 				       "Executed: %s", cmd);