[dovecot-cvs] dovecot/src/auth passdb-pam.c,1.49,1.50

tss at dovecot.org tss at dovecot.org
Sat Mar 10 16:14:50 EET 2007


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv1876/src/auth

Modified Files:
	passdb-pam.c 
Log Message:
PAM service name supports variables now.



Index: passdb-pam.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-pam.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- passdb-pam.c	10 Mar 2007 13:24:15 -0000	1.49
+++ passdb-pam.c	10 Mar 2007 14:14:48 -0000	1.50
@@ -15,6 +15,8 @@
 #include "buffer.h"
 #include "ioloop.h"
 #include "hash.h"
+#include "str.h"
+#include "var-expand.h"
 #include "network.h"
 #include "passdb.h"
 #include "mycrypt.h"
@@ -424,12 +426,16 @@
         struct pam_passdb_module *module = (struct pam_passdb_module *)_module;
         struct pam_auth_request *pam_auth_request;
 	enum passdb_result result;
+	string_t *expanded_service;
 	const char *service;
 	int fd[2];
 	pid_t pid;
 
-	service = module->service_name != NULL ?
-		module->service_name : request->service;
+	expanded_service = t_str_new(64);
+	var_expand(expanded_service, module->service_name,
+		   auth_request_get_var_expand_table(request, NULL));
+	service = str_c(expanded_service);
+
 	auth_request_log_debug(request, "pam", "lookup service=%s", service);
 
 	if (worker) {
@@ -505,7 +511,8 @@
 		} else if (strcmp(t_args[i], "blocking=yes") == 0) {
 			module->module.blocking = TRUE;
 		} else if (strcmp(t_args[i], "*") == 0) {
-			module->service_name = NULL;
+			/* for backwards compatibility */
+			module->service_name = "%s";
 		} else if (t_args[i+1] == NULL) {
 			if (*t_args[i] != '\0') {
 				module->service_name =



More information about the dovecot-cvs mailing list