[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-list.c,1.5,1.6 mbox-save.c,1.27,1.28 mbox-storage.c,1.21,1.22

cras at procontrol.fi cras at procontrol.fi
Thu Dec 19 03:53:21 EET 2002


Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory danu:/tmp/cvs-serv17272/lib-storage/index/mbox

Modified Files:
	mbox-list.c mbox-save.c mbox-storage.c 
Log Message:
Limit the mailbox path. A few cleanups.



Index: mbox-list.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-list.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mbox-list.c	19 Dec 2002 01:02:35 -0000	1.5
+++ mbox-list.c	19 Dec 2002 01:53:19 -0000	1.6
@@ -98,7 +98,7 @@
 			break;
 		}
 
-		if (stat(fullpath, &st) != 0) {
+		if (stat(fullpath, &st) < 0) {
 			if (errno == ENOENT)
 				continue; /* just deleted, ignore */
 

Index: mbox-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- mbox-save.c	19 Dec 2002 01:02:35 -0000	1.27
+++ mbox-save.c	19 Dec 2002 01:53:19 -0000	1.28
@@ -91,7 +91,7 @@
 			name = my_hostname;
 		}
 
-		strocpy(my_hostdomain, name, 256);
+		strocpy(my_hostdomain, name, sizeof(my_hostdomain));
 	}
 
 	sender = t_strconcat(storage->user, "@", my_hostdomain, NULL);

Index: mbox-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- mbox-storage.c	19 Dec 2002 01:02:35 -0000	1.21
+++ mbox-storage.c	19 Dec 2002 01:53:19 -0000	1.22
@@ -107,12 +107,10 @@
 
 static int mbox_is_valid_name(MailStorage *storage, const char *name)
 {
-	if (name[0] == '\0' || name[0] == storage->hierarchy_sep ||
-	    name[strlen(name)-1] == storage->hierarchy_sep ||
-	    strchr(name, '*') != NULL || strchr(name, '%') != NULL)
-		return FALSE;
-
-	return mbox_is_valid_mask(name);
+	return name[0] != '\0' && name[0] != storage->hierarchy_sep &&
+		name[strlen(name)-1] != storage->hierarchy_sep &&
+		strchr(name, '*') == NULL && strchr(name, '%') == NULL &&
+		mbox_is_valid_mask(name);
 }
 
 static const char *mbox_get_index_dir(const char *mbox_path)
@@ -121,7 +119,7 @@
 
 	p = strrchr(mbox_path, '/');
 	if (p == NULL)
-		return t_strconcat(".imap/", mbox_path);
+		return t_strconcat(".imap/", mbox_path, NULL);
 	else {
 		rootpath = t_strdup_until(mbox_path, p);
 		return t_strconcat(rootpath, "/.imap/", p+1, NULL);




More information about the dovecot-cvs mailing list