[dovecot-cvs] dovecot/src/master auth-process.c, 1.95, 1.96 login-process.c, 1.74, 1.75 mail-process.c, 1.98, 1.99 main.c, 1.83, 1.84 master-settings.c, 1.127, 1.128

cras at dovecot.org cras at dovecot.org
Fri Jun 16 21:13:45 EEST 2006


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv2969

Modified Files:
	auth-process.c login-process.c mail-process.c main.c 
	master-settings.c 
Log Message:
Settings parser nowadays returns "" instead of NULL when it reads an empty
value from config file (due to some good reason I unfortunately didn't write
to commit message and can't remember anymore). Fixed a lot of existing
checks which checked for empty strings with NULL instead of "" checks.



Index: auth-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/auth-process.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- auth-process.c	12 Apr 2006 14:37:05 -0000	1.95
+++ auth-process.c	16 Jun 2006 18:13:43 -0000	1.96
@@ -296,7 +296,8 @@
 	group->process_count++;
 
 	path = t_strdup_printf("%s/auth-worker.%s",
-			       group->set->chroot != NULL ? group->set->chroot :
+			       *group->set->chroot != '\0' ?
+			       group->set->chroot :
 			       group->set->parent->defaults->base_dir,
 			       dec2str(pid));
 	p->worker_listen_fd =
@@ -341,7 +342,7 @@
 	p->group->process_count--;
 
 	path = t_strdup_printf("%s/auth-worker.%s",
-			       p->group->set->chroot != NULL ?
+			       *p->group->set->chroot != '\0' ?
 			       p->group->set->chroot :
 			       p->group->set->parent->defaults->base_dir,
 			       dec2str(p->pid));
@@ -368,15 +369,15 @@
 static void
 socket_settings_env_put(const char *env_base, struct socket_settings *set)
 {
-	if (set->path == NULL)
+	if (*set->path == '\0')
 		return;
 
 	env_put(t_strdup_printf("%s=%s", env_base, set->path));
 	if (set->mode != 0)
 		env_put(t_strdup_printf("%s_MODE=%o", env_base, set->mode));
-	if (set->user != NULL)
+	if (*set->user != '\0')
 		env_put(t_strdup_printf("%s_USER=%s", env_base, set->user));
-	if (set->group != NULL)
+	if (*set->group != '\0')
 		env_put(t_strdup_printf("%s_GROUP=%s", env_base, set->group));
 }
 
@@ -467,7 +468,7 @@
 		env_put("SSL_REQUIRE_CLIENT_CERT=1");
 	if (set->ssl_username_from_cert)
 		env_put("SSL_USERNAME_FROM_CERT=1");
-	if (set->krb5_keytab != NULL) {
+	if (*set->krb5_keytab != '\0') {
 		/* Environment used by Kerberos 5 library directly */
 		env_put(t_strconcat("KRB5_KTNAME=", set->krb5_keytab, NULL));
 	}
@@ -554,7 +555,7 @@
         auth_set_environment(group->set);
 
 	env_put(t_strdup_printf("AUTH_WORKER_PATH=%s/auth-worker.%s",
-				group->set->chroot != NULL ? "" :
+				*group->set->chroot != '\0' ? "" :
 				group->set->parent->defaults->base_dir,
 				dec2str(getpid())));
 	env_put(t_strdup_printf("AUTH_WORKER_MAX_COUNT=%u",

Index: login-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/login-process.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- login-process.c	16 Jun 2006 09:42:02 -0000	1.74
+++ login-process.c	16 Jun 2006 18:13:43 -0000	1.75
@@ -408,12 +408,12 @@
 	env_put("DOVECOT_MASTER=1");
 
 	if (!set->ssl_disable) {
-		const char *ssl_key_password = NULL;
+		const char *ssl_key_password;
 
-		ssl_key_password = set->ssl_key_password != NULL ?
+		ssl_key_password = *set->ssl_key_password != '\0' ?
 			set->ssl_key_password : ssl_manual_key_password;
 
-		if (set->ssl_ca_file != NULL) {
+		if (*set->ssl_ca_file != '\0') {
 			env_put(t_strconcat("SSL_CA_FILE=",
 					    set->ssl_ca_file, NULL));
 		}
@@ -424,7 +424,7 @@
 		env_put(t_strconcat("SSL_KEY_PASSWORD=",
 				    ssl_key_password, NULL));
 		env_put("SSL_PARAM_FILE="SSL_PARAMETERS_FILENAME);
-		if (set->ssl_cipher_list != NULL) {
+		if (*set->ssl_cipher_list != '\0') {
 			env_put(t_strconcat("SSL_CIPHER_LIST=",
 					    set->ssl_cipher_list, NULL));
 		}

Index: mail-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/mail-process.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- mail-process.c	12 Jun 2006 12:46:15 -0000	1.98
+++ mail-process.c	16 Jun 2006 18:13:43 -0000	1.99
@@ -66,7 +66,7 @@
 	if (*dir == '\0')
 		return FALSE;
 
-	if (set->valid_chroot_dirs == NULL)
+	if (*set->valid_chroot_dirs == '\0')
 		return FALSE;
 
 	chroot_dirs = t_strsplit(set->valid_chroot_dirs, ":");
@@ -281,7 +281,7 @@
 	/* user given environment - may be malicious. virtual_user comes from
 	   auth process, but don't trust that too much either. Some auth
 	   mechanism might allow leaving extra data there. */
-	if ((mail == NULL || *mail == '\0') && set->default_mail_env != NULL)
+	if ((mail == NULL || *mail == '\0') && *set->default_mail_env != '\0')
 		mail = expand_mail_env(set->default_mail_env, var_expand_table);
 	env_put(t_strconcat("MAIL=", mail, NULL));
 
@@ -452,7 +452,7 @@
 			return FALSE;
 	}
 
-	if (*chroot_dir == '\0' && set->mail_chroot != NULL)
+	if (*chroot_dir == '\0' && *set->mail_chroot != '\0')
 		chroot_dir = set->mail_chroot;
 
 	if (*chroot_dir != '\0' && !validate_chroot(set, chroot_dir)) {

Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/main.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- main.c	16 Jun 2006 10:11:08 -0000	1.83
+++ main.c	16 Jun 2006 18:13:43 -0000	1.84
@@ -111,7 +111,7 @@
 {
 	int facility;
 
-	if (set->log_path == NULL) {
+	if (*set->log_path == '\0') {
 		if (!syslog_facility_find(set->syslog_facility, &facility))
 			facility = LOG_MAIL;
 
@@ -121,7 +121,7 @@
 		i_set_failure_file(set->log_path, "dovecot");
 	}
 
-	if (set->info_log_path != NULL)
+	if (*set->info_log_path != '\0')
 		i_set_info_file(set->info_log_path);
 
 	i_set_failure_timestamp_format(set->log_timestamp);
@@ -466,11 +466,11 @@
 
 static bool have_stderr_set(struct settings *set)
 {
-	if (set->log_path != NULL &&
+	if (*set->log_path != '\0' &&
 	    strcmp(set->log_path, "/dev/stderr") == 0)
 		return TRUE;
 
-	if (set->info_log_path != NULL &&
+	if (*set->info_log_path != '\0' &&
 	    strcmp(set->info_log_path, "/dev/stderr") == 0)
 		return TRUE;
 

Index: master-settings.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/master-settings.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- master-settings.c	8 Jun 2006 18:52:40 -0000	1.127
+++ master-settings.c	16 Jun 2006 18:13:43 -0000	1.128
@@ -260,8 +260,8 @@
 
 	/* common */
 	MEMBER(base_dir) PKG_RUNDIR,
-	MEMBER(log_path) NULL,
-	MEMBER(info_log_path) NULL,
+	MEMBER(log_path) "",
+	MEMBER(info_log_path) "",
 	MEMBER(log_timestamp) DEFAULT_FAILURE_STAMP_FORMAT,
 	MEMBER(syslog_facility) "mail",
 
@@ -271,12 +271,12 @@
 	MEMBER(ssl_listen) "",
 
 	MEMBER(ssl_disable) FALSE,
-	MEMBER(ssl_ca_file) NULL,
+	MEMBER(ssl_ca_file) "",
 	MEMBER(ssl_cert_file) SSLDIR"/certs/dovecot.pem",
 	MEMBER(ssl_key_file) SSLDIR"/private/dovecot.pem",
-	MEMBER(ssl_key_password) NULL,
+	MEMBER(ssl_key_password) "",
 	MEMBER(ssl_parameters_regenerate) 168,
-	MEMBER(ssl_cipher_list) NULL,
+	MEMBER(ssl_cipher_list) "",
 	MEMBER(ssl_verify_client_cert) FALSE,
 	MEMBER(disable_plaintext_auth) TRUE,
 	MEMBER(verbose_ssl) FALSE,
@@ -301,8 +301,8 @@
 	MEMBER(login_max_logging_users) 256,
 
 	/* mail */
-	MEMBER(valid_chroot_dirs) NULL,
-	MEMBER(mail_chroot) NULL,
+	MEMBER(valid_chroot_dirs) "",
+	MEMBER(mail_chroot) "",
 	MEMBER(max_mail_processes) 1024,
 	MEMBER(verbose_proctitle) FALSE,
 
@@ -310,9 +310,9 @@
 	MEMBER(last_valid_uid) 0,
 	MEMBER(first_valid_gid) 1,
 	MEMBER(last_valid_gid) 0,
-	MEMBER(mail_extra_groups) NULL,
+	MEMBER(mail_extra_groups) "",
 
-	MEMBER(default_mail_env) NULL,
+	MEMBER(default_mail_env) "",
 	MEMBER(mail_cache_fields) "flags",
 	MEMBER(mail_never_cache_fields) "imap.envelope",
 	MEMBER(mail_cache_min_mail_count) 0,
@@ -361,8 +361,8 @@
 	MEMBER(pop3_enable_last) FALSE,
 	MEMBER(pop3_reuse_xuidl) FALSE,
 	MEMBER(pop3_lock_session) FALSE,
-	MEMBER(pop3_uidl_format) NULL,
-	MEMBER(pop3_client_workarounds) NULL,
+	MEMBER(pop3_uidl_format) "",
+	MEMBER(pop3_client_workarounds) "",
 	MEMBER(pop3_logout_format) "top=%t/%p, retr=%r/%b, del=%d/%m, size=%s",
 
 	/* .. */
@@ -376,19 +376,19 @@
 
 	MEMBER(name) NULL,
 	MEMBER(mechanisms) "plain",
-	MEMBER(realms) NULL,
-	MEMBER(default_realm) NULL,
+	MEMBER(realms) "",
+	MEMBER(default_realm) "",
 	MEMBER(cache_size) 0,
 	MEMBER(cache_ttl) 3600,
 	MEMBER(executable) PKG_LIBEXECDIR"/dovecot-auth",
 	MEMBER(user) "root",
-	MEMBER(chroot) NULL,
+	MEMBER(chroot) "",
 	MEMBER(username_chars) "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@",
 	MEMBER(username_translation) "",
 	MEMBER(username_format) "",
-	MEMBER(master_user_separator) NULL,
+	MEMBER(master_user_separator) "",
 	MEMBER(anonymous_username) "anonymous",
-	MEMBER(krb5_keytab) NULL,
+	MEMBER(krb5_keytab) "",
 
 	MEMBER(verbose) FALSE,
 	MEMBER(debug) FALSE,
@@ -408,6 +408,26 @@
 	MEMBER(sockets) NULL
 };
 
+struct socket_settings default_socket_settings = {
+	MEMBER(path) "",
+	MEMBER(mode) 0,
+	MEMBER(user) "",
+	MEMBER(group) ""
+};
+
+struct namespace_settings default_namespace_settings = {
+	MEMBER(parent) NULL,
+	MEMBER(next) NULL,
+	MEMBER(type) NULL,
+
+	MEMBER(separator) "",
+	MEMBER(prefix) "",
+	MEMBER(location) "",
+
+	MEMBER(inbox) FALSE,
+	MEMBER(hidden) FALSE
+};
+
 static pool_t settings_pool, settings2_pool;
 struct server_settings *settings_root = NULL;
 
@@ -466,7 +486,7 @@
 	}
 
 	fix_base_path(auth->parent->defaults, &auth->chroot);
-	if (auth->chroot != NULL && access(auth->chroot, X_OK) < 0) {
+	if (*auth->chroot != '\0' && access(auth->chroot, X_OK) < 0) {
 		i_error("Can't access auth chroot directory %s: %m",
 			auth->chroot);
 		return FALSE;
@@ -701,7 +721,7 @@
 	}
 #endif
 
-	if (set->log_path != NULL && access(set->log_path, W_OK) < 0) {
+	if (*set->log_path != '\0' && access(set->log_path, W_OK) < 0) {
 		dir = get_directory(set->log_path);
 		if (access(dir, W_OK) < 0) {
 			i_error("Can't write to log directory %s: %m", dir);
@@ -709,7 +729,7 @@
 		}
 	}
 
-	if (set->info_log_path != NULL &&
+	if (*set->info_log_path != '\0' &&
 	    access(set->info_log_path, W_OK) < 0) {
 		dir = get_directory(set->info_log_path);
 		if (access(dir, W_OK) < 0) {
@@ -726,7 +746,7 @@
 
 #ifdef HAVE_SSL
 	if (!set->ssl_disable) {
-		if (set->ssl_ca_file != NULL &&
+		if (*set->ssl_ca_file != '\0' &&
 		    access(set->ssl_ca_file, R_OK) < 0) {
 			i_fatal("Can't use SSL CA file %s: %m",
 				set->ssl_ca_file);
@@ -912,6 +932,8 @@
 
 	as->parent = auth;
 	as->type = str_lcase(p_strdup(settings_pool, type));
+	as->master = default_socket_settings;
+	as->client = default_socket_settings;
 
 	as_p = &auth->sockets;
 	while (*as_p != NULL)
@@ -947,6 +969,7 @@
 	struct namespace_settings *ns, **ns_p;
 
 	ns = p_new(settings_pool, struct namespace_settings, 1);
+	*ns = default_namespace_settings;
 
 	ns->parent = server;
 	ns->type = str_lcase(p_strdup(settings_pool, type));
@@ -1282,8 +1305,8 @@
 
 	prev = NULL;
 	for (server = ctx.root; server != NULL; server = server->next) {
-		if ((server->imap->protocols == NULL ||
-		     server->pop3->protocols == NULL) && !nochecks) {
+		if ((*server->imap->protocols == '\0' ||
+		     *server->pop3->protocols == '\0') && !nochecks) {
 			i_error("No protocols given in configuration file");
 			return FALSE;
 		}



More information about the dovecot-cvs mailing list