[dovecot-cvs] dovecot-sieve/src cmusieve-plugin.c,1.1.1.1,1.2

tss at dovecot.org tss at dovecot.org
Fri Oct 13 13:45:43 UTC 2006


Update of /var/lib/cvs/dovecot-sieve/src
In directory talvi:/tmp/cvs-serv11058

Modified Files:
	cmusieve-plugin.c 
Log Message:
If debug is enabled, log the sieve path. Also log an error if home dir isn't
given and no specific sieve script path is given.



Index: cmusieve-plugin.c
===================================================================
RCS file: /var/lib/cvs/dovecot-sieve/src/cmusieve-plugin.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- cmusieve-plugin.c	11 Jun 2006 11:03:53 -0000	1.1.1.1
+++ cmusieve-plugin.c	13 Oct 2006 12:45:38 -0000	1.2
@@ -15,9 +15,11 @@
 
 static const char *get_sieve_path(void)
 {
-	const char *script_path;
+	const char *script_path, *home;
 	struct stat st;
 
+	home = getenv("HOME");
+
 	/* userdb may specify Sieve path */
 	script_path = getenv("SIEVE");
 	if (script_path != NULL) {
@@ -32,6 +34,14 @@
 						  script_path, NULL);
 		}
 	} else {
+		if (home == NULL) {
+			/* we must have a home directory */
+			i_error("userdb(%s) didn't return a home directory or "
+				"sieve script location, can't find it",
+				getenv("USER"));
+			return NULL;
+		}
+
 		script_path = home_expand(SIEVE_SCRIPT_PATH);
 	}
 
@@ -56,6 +66,9 @@
 	if (script_path == NULL)
 		return 0;
 
+	if (getenv("DEBUG") != NULL)
+		i_info("cmusieve: Using sieve path: %s", script_path);
+
 	return cmu_sieve_run(storage, mail, script_path, username, mailbox);
 }
 



More information about the dovecot-cvs mailing list