[dovecot-cvs] dovecot-lda/src deliver.c,1.28,1.29

cras at dovecot.org cras at dovecot.org
Sat Oct 15 00:26:20 EEST 2005


Update of /var/lib/cvs/dovecot-lda/src
In directory talvi:/tmp/cvs-serv3003

Modified Files:
	deliver.c 
Log Message:
Make sure that userdb returns a home directory. Fail if not.



Index: deliver.c
===================================================================
RCS file: /var/lib/cvs/dovecot-lda/src/deliver.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- deliver.c	7 Oct 2005 09:34:43 -0000	1.28
+++ deliver.c	14 Oct 2005 21:26:18 -0000	1.29
@@ -159,6 +159,7 @@
 static void auth_parse_input(const char *args)
 {
 	const char *const *tmp, *key, *value;
+	int home_found = FALSE;
 
 	for (tmp = t_strsplit(args, "\t"); *tmp != NULL; tmp++) {
 		if (strncmp(*tmp, "uid=", 4) == 0) {
@@ -170,6 +171,9 @@
 		} else if (strncmp(*tmp, "chroot=", 7) == 0) {
 			env_put(t_strconcat("RESTRICT_CHROOT=",
 					    *tmp + 7, NULL));
+		} else if (strncmp(*tmp, "home=", 5) == 0) {
+			home_found = TRUE;
+			env_put(t_strconcat("HOME=", *tmp + 5, NULL));
 		} else {
 			key = t_str_ucase(t_strcut(*tmp, '='));
 			value = strchr(*tmp, '=');
@@ -178,6 +182,13 @@
 		}
 	}
 
+	if (!home_found) {
+		/* we must have a home directory */
+		i_error("userdb didn't return a home directory");
+		return_value = EX_TEMPFAIL;
+		return;
+	}
+
 	restrict_access_by_env(TRUE);
 	return_value = EX_OK;
 }



More information about the dovecot-cvs mailing list