[dovecot-cvs] dovecot/src/auth db-passwd-file.c,1.25.2.4,1.25.2.5

tss at dovecot.org tss at dovecot.org
Sun Mar 11 23:03:15 EET 2007


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

Modified Files:
      Tag: branch_1_0
	db-passwd-file.c 
Log Message:
If passwd-file wasn't found, don't crash.



Index: db-passwd-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/db-passwd-file.c,v
retrieving revision 1.25.2.4
retrieving revision 1.25.2.5
diff -u -d -r1.25.2.4 -r1.25.2.5
--- db-passwd-file.c	10 Mar 2007 13:24:11 -0000	1.25.2.4
+++ db-passwd-file.c	11 Mar 2007 21:03:12 -0000	1.25.2.5
@@ -242,7 +242,8 @@
 		if (errno != ENOENT)
 			i_error("passwd-file %s: stat() failed: %m", pw->path);
 
-		passwd_file_free(pw);
+		if (pw->db->default_file != pw)
+			passwd_file_free(pw);
 		return FALSE;
 	}
 
@@ -389,7 +390,7 @@
 {
 	struct passwd_file *pw;
 	struct passwd_user *pu;
-	const char *username;
+	const char *username, *path;
 
 	if (!db->vars)
 		pw = db->default_file;
@@ -412,13 +413,16 @@
 		t_pop();
 	}
 
+	t_push();
+	path = t_strdup(pw->path);
 	if (!passwd_file_sync(pw)) {
+		/* pw may be freed now */
 		auth_request_log_info(request, "passwd-file",
-				      "no passwd file: %s", pw->path);
+				      "no passwd file: %s", path);
+		t_pop();
 		return NULL;
 	}
 
-	t_push();
 	username = !db->domain_var ? request->user :
 		t_strcut(request->user, '@');
 



More information about the dovecot-cvs mailing list