dovecot-2.2-pigeonhole: lib-sieve: Changed sieve_script_binary_g...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Tue Jan 7 19:57:58 EET 2014


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/a70f5f097033
changeset: 1842:a70f5f097033
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Tue Jan 07 18:57:38 2014 +0100
description:
lib-sieve: Changed sieve_script_binary_get_directory() to sieve_script_binary_get_prefix().
This function now returns the binary prefix (file path until '.svbin) rather than just the path of the directory where the binary would be stored.

diffstat:

 src/lib-sieve/sieve-script-file.c    |  16 +++++++++++-----
 src/lib-sieve/sieve-script-private.h |   3 ++-
 src/lib-sieve/sieve-script.c         |   8 ++++----
 src/lib-sieve/sieve-script.h         |   2 +-
 4 files changed, 18 insertions(+), 11 deletions(-)

diffs (119 lines):

diff -r 3115b97ad1c1 -r a70f5f097033 src/lib-sieve/sieve-script-file.c
--- a/src/lib-sieve/sieve-script-file.c	Tue Jan 07 18:54:57 2014 +0100
+++ b/src/lib-sieve/sieve-script-file.c	Tue Jan 07 18:57:38 2014 +0100
@@ -122,7 +122,7 @@
 	struct sieve_error_handler *ehandler = _script->ehandler;
 	pool_t pool = _script->pool;
 	const char *name = _script->name;
-	const char *filename, *dirpath, *basename, *binpath;
+	const char *filename, *dirpath, *basename, *binpath, *binprefix;
 	struct stat st;
 	struct stat lnk_st;
 	bool success = TRUE;
@@ -220,10 +220,15 @@
 			if ( _script->bin_dir != NULL ) {
 				binpath = sieve_binfile_from_name(name);
 				binpath = t_strconcat(_script->bin_dir, "/", binpath, NULL);
+				binprefix = t_strconcat(_script->bin_dir, "/", name, NULL);
 			} else {
 				binpath = sieve_binfile_from_name(basename);
-				if ( *dirpath != '\0' )
+				if ( *dirpath != '\0' ) {
 					binpath = t_strconcat(dirpath, "/", binpath, NULL);
+					binprefix = t_strconcat(dirpath, "/", basename, NULL);
+				} else {
+					binprefix = basename;
+				}
 			}
 
 			script->st = st;
@@ -232,6 +237,7 @@
 			script->filename = p_strdup(pool, filename);
 			script->dirpath = p_strdup(pool, dirpath);
 			script->binpath = p_strdup(pool, binpath);
+			script->binprefix = p_strdup(pool, binprefix);
 
 			if ( script->script.name == NULL ||
 				strcmp(script->script.name, basename) == 0 )
@@ -354,12 +360,12 @@
 		script->st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO), error_r);
 }
 
-static const char *sieve_file_script_binary_get_directory
+static const char *sieve_file_script_binary_get_prefix
 (struct sieve_script *_script)
 {
 	struct sieve_file_script *script = (struct sieve_file_script *)_script;
 	
-	return script->	dirpath;
+	return script->	binprefix;
 }
 
 const struct sieve_script sieve_file_script = {
@@ -376,7 +382,7 @@
 		NULL,
 		sieve_file_script_binary_load,
 		sieve_file_script_binary_save,
-		sieve_file_script_binary_get_directory,
+		sieve_file_script_binary_get_prefix,
 
 		sieve_file_script_get_size,
 
diff -r 3115b97ad1c1 -r a70f5f097033 src/lib-sieve/sieve-script-private.h
--- a/src/lib-sieve/sieve-script-private.h	Tue Jan 07 18:54:57 2014 +0100
+++ b/src/lib-sieve/sieve-script-private.h	Tue Jan 07 18:57:38 2014 +0100
@@ -32,7 +32,7 @@
 	int (*binary_save)
 		(struct sieve_script *script, struct sieve_binary *sbin,
 			bool update, enum sieve_error *error_r);
-	const char *(*binary_get_directory)
+	const char *(*binary_get_prefix)
 		(struct sieve_script *script);
 
 	int (*get_size)
@@ -88,6 +88,7 @@
 	const char *dirpath;
 	const char *filename;
 	const char *binpath;
+	const char *binprefix;
 
 	int fd;
 };
diff -r 3115b97ad1c1 -r a70f5f097033 src/lib-sieve/sieve-script.c
--- a/src/lib-sieve/sieve-script.c	Tue Jan 07 18:54:57 2014 +0100
+++ b/src/lib-sieve/sieve-script.c	Tue Jan 07 18:57:38 2014 +0100
@@ -542,18 +542,18 @@
 	return script->v.binary_save(script, sbin, update, error_r);
 }
 
-const char *sieve_script_binary_get_directory
+const char *sieve_script_binary_get_prefix
 (struct sieve_script *script)
 {
 	if ( script->bin_dir != NULL &&
 		sieve_script_setup_bindir(script, 0700) >= 0 ) {
-		return script->bin_dir;
+		return t_strconcat(script->bin_dir, "/", script->name, NULL);
 	}
 
-	if ( script->v.binary_get_directory == NULL )
+	if ( script->v.binary_get_prefix == NULL )
 		return NULL;
 
-	return script->v.binary_get_directory(script);
+	return script->v.binary_get_prefix(script);
 }
 
 int sieve_script_setup_bindir
diff -r 3115b97ad1c1 -r a70f5f097033 src/lib-sieve/sieve-script.h
--- a/src/lib-sieve/sieve-script.h	Tue Jan 07 18:54:57 2014 +0100
+++ b/src/lib-sieve/sieve-script.h	Tue Jan 07 18:57:38 2014 +0100
@@ -68,7 +68,7 @@
 	(struct sieve_script *script, struct sieve_binary *sbin, bool update,
 		enum sieve_error *error_r);
 
-const char *sieve_script_binary_get_directory
+const char *sieve_script_binary_get_prefix
 	(struct sieve_script *script);
 
 /*


More information about the dovecot-cvs mailing list