dovecot-2.2: lib-storage: Don't crash when trying to detect publ...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 26 18:01:29 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/6b9db780b47d
changeset: 15120:6b9db780b47d
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 31 16:17:23 2012 +0300
description:
lib-storage: Don't crash when trying to detect public namespace's mail_location.
Public namespaces have no owner.

diffstat:

 src/lib-storage/index/dbox-multi/mdbox-storage.c  |  3 ++-
 src/lib-storage/index/dbox-single/sdbox-storage.c |  3 ++-
 src/lib-storage/index/maildir/maildir-storage.c   |  3 ++-
 src/lib-storage/index/mbox/mbox-storage.c         |  3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r 67235781cc08 -r 6b9db780b47d src/lib-storage/index/dbox-multi/mdbox-storage.c
--- a/src/lib-storage/index/dbox-multi/mdbox-storage.c	Thu Aug 30 21:56:43 2012 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-storage.c	Fri Aug 31 16:17:23 2012 +0300
@@ -87,7 +87,8 @@
 	bool debug = ns->mail_set->mail_debug;
 	const char *home, *path;
 
-	if (mail_user_get_home(ns->owner, &home) > 0) {
+	if (ns->owner != NULL &&
+	    mail_user_get_home(ns->owner, &home) > 0) {
 		path = t_strconcat(home, "/mdbox", NULL);
 		if (access(path, R_OK|W_OK|X_OK) == 0) {
 			if (debug)
diff -r 67235781cc08 -r 6b9db780b47d src/lib-storage/index/dbox-single/sdbox-storage.c
--- a/src/lib-storage/index/dbox-single/sdbox-storage.c	Thu Aug 30 21:56:43 2012 +0300
+++ b/src/lib-storage/index/dbox-single/sdbox-storage.c	Fri Aug 31 16:17:23 2012 +0300
@@ -34,7 +34,8 @@
 	bool debug = ns->mail_set->mail_debug;
 	const char *home, *path;
 
-	if (mail_user_get_home(ns->owner, &home) > 0) {
+	if (ns->owner != NULL &&
+	    mail_user_get_home(ns->owner, &home) > 0) {
 		path = t_strconcat(home, "/sdbox", NULL);
 		if (access(path, R_OK|W_OK|X_OK) == 0) {
 			if (debug)
diff -r 67235781cc08 -r 6b9db780b47d src/lib-storage/index/maildir/maildir-storage.c
--- a/src/lib-storage/index/maildir/maildir-storage.c	Thu Aug 30 21:56:43 2012 +0300
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Fri Aug 31 16:17:23 2012 +0300
@@ -97,7 +97,8 @@
 
 	/* we'll need to figure out the maildir location ourself.
 	   It's ~/Maildir unless we are chrooted. */
-	if (mail_user_get_home(ns->owner, &home) > 0) {
+	if (ns->owner != NULL &&
+	    mail_user_get_home(ns->owner, &home) > 0) {
 		path = t_strconcat(home, "/Maildir", NULL);
 		if (access(path, R_OK|W_OK|X_OK) == 0) {
 			if (debug)
diff -r 67235781cc08 -r 6b9db780b47d src/lib-storage/index/mbox/mbox-storage.c
--- a/src/lib-storage/index/mbox/mbox-storage.c	Thu Aug 30 21:56:43 2012 +0300
+++ b/src/lib-storage/index/mbox/mbox-storage.c	Fri Aug 31 16:17:23 2012 +0300
@@ -246,7 +246,8 @@
 	bool debug = ns->mail_set->mail_debug;
 	const char *home, *path;
 
-	if (mail_user_get_home(ns->owner, &home) <= 0) {
+	if (ns->owner != NULL &&
+	    mail_user_get_home(ns->owner, &home) <= 0) {
 		if (debug)
 			i_debug("maildir: Home directory not set");
 		home = "";


More information about the dovecot-cvs mailing list