changeset 8768:91e880ae387a HEAD

Authentication: system_user userdb extra field renamed to system_groups_user.
author Timo Sirainen <tss@iki.fi>
date Sat, 21 Feb 2009 18:22:11 -0500
parents e82e0a6b9399
children cc8d4d06ef9f
files src/auth/auth-request.c src/auth/userdb-nss.c src/auth/userdb-passwd.c src/master/mail-process.c
diffstat 4 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-request.c	Sat Feb 21 17:46:35 2009 -0500
+++ b/src/auth/auth-request.c	Sat Feb 21 18:22:11 2009 -0500
@@ -1168,6 +1168,9 @@
 	} else if (strcmp(name, "userdb_import") == 0) {
 		auth_stream_reply_import(request->userdb_reply, value);
 		return;
+	} else if (strcmp(name, "system_user") == 0) {
+		/* FIXME: the system_user is for backwards compatibility */
+		name = "system_groups_user";
 	}
 
 	auth_stream_reply_add(request->userdb_reply, name, value);
--- a/src/auth/userdb-nss.c	Sat Feb 21 17:46:35 2009 -0500
+++ b/src/auth/userdb-nss.c	Sat Feb 21 18:22:11 2009 -0500
@@ -72,7 +72,8 @@
 	auth_request_set_field(auth_request, "user", pw.pw_name, NULL);
 
 	auth_request_init_userdb_reply(auth_request);
-	auth_request_set_userdb_field(auth_request, "system_user", pw.pw_name);
+	auth_request_set_userdb_field(auth_request, "system_groups_user",
+				      pw.pw_name);
 	auth_request_set_userdb_field(auth_request, "uid", dec2str(pw.pw_uid));
 	auth_request_set_userdb_field(auth_request, "gid", dec2str(pw.pw_gid));
 	auth_request_set_userdb_field(auth_request, "home", pw.pw_dir);
--- a/src/auth/userdb-passwd.c	Sat Feb 21 17:46:35 2009 -0500
+++ b/src/auth/userdb-passwd.c	Sat Feb 21 18:22:11 2009 -0500
@@ -38,9 +38,12 @@
 	auth_request_init_userdb_reply(auth_request);
 	userdb_static_template_export(module->tmpl, auth_request);
 
-	if (!userdb_static_template_isset(module->tmpl, "system_user")) {
+	/* FIXME: the system_user is for backwards compatibility */
+	if (!userdb_static_template_isset(module->tmpl, "system_groups_user") &&
+	    !userdb_static_template_isset(module->tmpl, "system_user")) {
 		auth_request_set_userdb_field(auth_request,
-					      "system_user", pw->pw_name);
+					      "system_groups_user",
+					      pw->pw_name);
 	}
 	if (!userdb_static_template_isset(module->tmpl, "uid")) {
 		auth_request_set_userdb_field(auth_request,
--- a/src/master/mail-process.c	Sat Feb 21 17:46:35 2009 -0500
+++ b/src/master/mail-process.c	Sat Feb 21 18:22:11 2009 -0500
@@ -551,7 +551,7 @@
 {
 	const struct var_expand_table *var_expand_table;
 	const char *p, *addr, *mail, *chroot_dir, *home_dir, *full_home_dir;
-	const char *system_user, *master_user;
+	const char *system_groups_user, *master_user;
 	struct mail_process_group *process_group;
 	char title[1024];
 	struct log_io *log;
@@ -574,7 +574,8 @@
 	}
 
 	t_array_init(&extra_args, 16);
-	mail = home_dir = chroot_dir = system_user = ""; master_user = NULL;
+	mail = home_dir = chroot_dir = system_groups_user = "";
+	master_user = NULL;
 	uid = (uid_t)-1; gid = (gid_t)-1; nice_value = 0;
 	home_given = FALSE;
 	for (; *args != NULL; args++) {
@@ -587,8 +588,8 @@
 			chroot_dir = *args + 7;
 		else if (strncmp(*args, "nice=", 5) == 0)
 			nice_value = atoi(*args + 5);
-		else if (strncmp(*args, "system_user=", 12) == 0)
-			system_user = *args + 12;
+		else if (strncmp(*args, "system_groups_user=", 12) == 0)
+			system_groups_user = *args + 12;
 		else if (strncmp(*args, "uid=", 4) == 0) {
 			if (uid != (uid_t)-1) {
 				i_error("uid specified multiple times for %s",
@@ -768,7 +769,8 @@
 
 	/* setup environment - set the most important environment first
 	   (paranoia about filling up environment without noticing) */
-	restrict_access_set_env(system_user, uid, gid, set->mail_priv_gid_t,
+	restrict_access_set_env(system_groups_user, uid, gid,
+				set->mail_priv_gid_t,
 				dump_capability ? "" : chroot_dir,
 				set->first_valid_gid, set->last_valid_gid,
 				set->mail_access_groups);