# HG changeset patch # User Timo Sirainen # Date 1140442171 -7200 # Node ID 357175e274b40c605a6cd9df0be9ba1dfb4d9500 # Parent faf83f3e19b59c8ff0d8932fd4608b73d0dcbb8c Pass LOCAL_IP, REMOTE_IP, SERVICE and MASTER_USER in environment to checkpassword. diff -r faf83f3e19b5 -r 357175e274b4 src/auth/passdb-checkpassword.c --- 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);