dovecot-2.2: Marked functions parameters that are allowed to be ...

dovecot at dovecot.org dovecot at dovecot.org
Sun Jun 24 00:53:11 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/c93ca5e46a8a
changeset: 14629:c93ca5e46a8a
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Jun 24 00:52:57 2012 +0300
description:
Marked functions parameters that are allowed to be NULL. Some APIs were also changed.
The non-obvious APIs where NULL parameter was changed to "" are
master_service_init() and auth_master_user_list_init().

These checks can currently be enabled only on a patched clang:
http://llvm.org/bugs/show_bug.cgi?id=6786

diffstat:

 src/anvil/main.c                                       |   5 +-
 src/auth/auth-master-connection.c                      |   4 +-
 src/auth/auth-master-connection.h                      |   2 +-
 src/auth/auth-request-handler.c                        |   5 +-
 src/auth/auth-request.c                                |   8 +-
 src/auth/auth-request.h                                |   9 +-
 src/auth/auth-settings.h                               |   3 +-
 src/auth/auth-stream.h                                 |   2 +-
 src/auth/auth-worker-server.c                          |   2 +-
 src/auth/auth.c                                        |  31 +++++---
 src/auth/auth.h                                        |   1 +
 src/auth/db-checkpassword.h                            |   2 +-
 src/auth/db-ldap.c                                     |   4 +-
 src/auth/db-ldap.h                                     |   2 +-
 src/auth/db-passwd-file.c                              |   5 +-
 src/auth/main.c                                        |   6 +-
 src/auth/mech-anonymous.c                              |   2 +-
 src/auth/mech-apop.c                                   |   2 +-
 src/auth/mech-cram-md5.c                               |   2 +-
 src/auth/mech-ntlm.c                                   |   4 +-
 src/auth/mech-otp-skey-common.c                        |   2 +-
 src/auth/mech-plain-common.c                           |   2 +-
 src/auth/mech-rpa.c                                    |   2 +-
 src/auth/mech-winbind.c                                |   2 +-
 src/auth/mech.c                                        |   2 +-
 src/auth/password-scheme-otp.c                         |   6 +-
 src/auth/password-scheme.h                             |   5 +-
 src/auth/userdb-passwd.c                               |   3 +-
 src/auth/userdb-static.c                               |   2 +-
 src/auth/userdb.h                                      |   6 +-
 src/config/config-parser-private.h                     |   2 +-
 src/config/config-request.h                            |   5 +-
 src/config/doveconf.c                                  |   4 +-
 src/config/main.c                                      |   2 +-
 src/dict/main.c                                        |   2 +-
 src/director/director-connection.c                     |   2 +-
 src/director/director-test.c                           |   4 +-
 src/director/director.h                                |  13 ++-
 src/dns/dns-client.c                                   |   3 +-
 src/doveadm/doveadm-director.c                         |   4 +-
 src/doveadm/doveadm-log.c                              |   3 +-
 src/doveadm/doveadm-mail-fetch.c                       |   8 +-
 src/doveadm/doveadm-mail-iter.h                        |   2 +-
 src/doveadm/doveadm-mail-mailbox-status.c              |   7 +-
 src/doveadm/dsync/doveadm-dsync.c                      |  10 +-
 src/doveadm/dsync/dsync-brain.c                        |   2 +-
 src/doveadm/dsync/dsync-mailbox-import.c               |   5 +-
 src/doveadm/dsync/dsync-slave-io.c                     |   4 +-
 src/doveadm/main.c                                     |   2 +-
 src/imap-login/client.c                                |   2 +-
 src/imap-login/client.h                                |   2 +-
 src/imap/cmd-append.c                                  |   2 +-
 src/imap/cmd-expunge.c                                 |   5 +-
 src/imap/imap-client.h                                 |   2 +-
 src/imap/imap-commands-util.h                          |   3 +-
 src/imap/imap-expunge.h                                |   3 +-
 src/imap/imap-fetch-body.c                             |  20 +++--
 src/imap/imap-fetch.h                                  |   3 +-
 src/imap/imap-search.h                                 |   2 +-
 src/imap/imap-sync.c                                   |   2 +-
 src/indexer/indexer.c                                  |   2 +-
 src/indexer/master-connection.c                        |   2 +-
 src/ipc/client.c                                       |   3 +-
 src/ipc/main.c                                         |   2 +-
 src/lib-auth/auth-client-request.c                     |   9 +-
 src/lib-auth/auth-client.h                             |   5 +-
 src/lib-auth/auth-master.c                             |   2 +-
 src/lib-auth/auth-master.h                             |   2 +-
 src/lib-dict/dict.h                                    |   2 +-
 src/lib-dns/dns-lookup.h                               |   2 +-
 src/lib-imap-client/imapc-connection.h                 |   5 +-
 src/lib-imap-storage/imap-msgpart.c                    |   3 +-
 src/lib-imap/imap-base-subject.c                       |  12 +--
 src/lib-imap/imap-parser.c                             |   2 +-
 src/lib-imap/imap-parser.h                             |   4 +-
 src/lib-imap/imap-url.c                                |   3 +-
 src/lib-imap/imap-util.h                               |   2 +-
 src/lib-index/mail-cache-lookup.c                      |   3 +-
 src/lib-index/mail-cache-transaction.c                 |   7 +-
 src/lib-index/mail-index-alloc-cache.c                 |   3 +-
 src/lib-index/mail-index-alloc-cache.h                 |   2 +-
 src/lib-index/mail-index-map-hdr.c                     |   4 +-
 src/lib-index/mail-index-map.c                         |   9 +-
 src/lib-index/mail-index-util.h                        |   2 +-
 src/lib-index/mail-index-view.c                        |  38 ++++-------
 src/lib-index/mail-index.c                             |   4 +-
 src/lib-index/mail-index.h                             |   8 +-
 src/lib-lda/mail-deliver.h                             |   2 +-
 src/lib-lda/smtp-client.h                              |   2 +-
 src/lib-mail/istream-binary-converter.c                |   2 +-
 src/lib-mail/istream-dot.c                             |   8 +-
 src/lib-mail/istream-header-filter.h                   |   3 +-
 src/lib-mail/message-header-parser.h                   |   5 +-
 src/lib-mail/message-parser.h                          |   4 +-
 src/lib-mail/message-part-serialize.c                  |   2 +-
 src/lib-mail/message-search.h                          |   3 +-
 src/lib-mail/message-size.c                            |  17 ++--
 src/lib-mail/message-size.h                            |   4 +-
 src/lib-mail/rfc822-parser.h                           |   2 +-
 src/lib-mail/test-istream-header-filter.c              |   8 +-
 src/lib-master/anvil-client.h                          |   2 +-
 src/lib-master/ipc-client.h                            |   3 +-
 src/lib-master/ipc-server.c                            |   2 +-
 src/lib-master/master-service-settings-cache.h         |   2 +-
 src/lib-master/master-service-settings.h               |   2 +-
 src/lib-master/master-service.c                        |   6 +-
 src/lib-master/master-service.h                        |   3 +-
 src/lib-master/mountpoint-list.c                       |  12 ++-
 src/lib-ntlm/ntlm-encrypt.c                            |   4 +-
 src/lib-ntlm/ntlm-encrypt.h                            |   3 +-
 src/lib-otp/otp-parse.c                                |   8 +-
 src/lib-settings/settings-parser.c                     |  40 ++++++-----
 src/lib-settings/settings.h                            |   3 +-
 src/lib-sql/driver-mysql.c                             |   2 +-
 src/lib-sql/driver-pgsql.c                             |   4 +-
 src/lib-sql/driver-sqlpool.c                           |   7 +-
 src/lib-sql/sql-api.c                                  |   2 +-
 src/lib-storage/index/dbox-common/dbox-file-fix.c      |   3 +-
 src/lib-storage/index/dbox-common/dbox-save.h          |   2 +-
 src/lib-storage/index/dbox-common/dbox-storage.c       |   9 +-
 src/lib-storage/index/dbox-common/dbox-sync-rebuild.c  |   3 +-
 src/lib-storage/index/dbox-multi/mdbox-map.c           |   6 +-
 src/lib-storage/index/dbox-multi/mdbox-storage.c       |   9 +-
 src/lib-storage/index/dbox-multi/mdbox-storage.h       |   2 +-
 src/lib-storage/index/dbox-multi/mdbox-sync.c          |   6 +-
 src/lib-storage/index/dbox-single/sdbox-storage.c      |   7 +-
 src/lib-storage/index/imapc/imapc-mail.c               |   2 +-
 src/lib-storage/index/index-mail-headers.c             |   4 +-
 src/lib-storage/index/index-mail.c                     |   7 +-
 src/lib-storage/index/index-mail.h                     |  10 +-
 src/lib-storage/index/index-search.c                   |  10 +-
 src/lib-storage/index/index-sort.c                     |  12 ++-
 src/lib-storage/index/index-storage.h                  |   3 +-
 src/lib-storage/index/index-sync-changes.h             |   3 +-
 src/lib-storage/index/maildir/maildir-filename-flags.c |  19 ++++-
 src/lib-storage/index/maildir/maildir-filename-flags.h |   7 +-
 src/lib-storage/index/maildir/maildir-mail.c           |  12 +-
 src/lib-storage/index/maildir/maildir-save.c           |  13 ++-
 src/lib-storage/index/maildir/maildir-storage.c        |  21 ++----
 src/lib-storage/index/maildir/maildir-storage.h        |   2 +-
 src/lib-storage/index/maildir/maildir-sync-index.c     |   4 +-
 src/lib-storage/index/maildir/maildir-sync.c           |   5 +-
 src/lib-storage/index/maildir/maildir-sync.h           |   3 +-
 src/lib-storage/index/maildir/maildir-uidlist.c        |  20 +++++-
 src/lib-storage/index/maildir/maildir-uidlist.h        |   4 +-
 src/lib-storage/index/maildir/maildir-util.c           |   6 +-
 src/lib-storage/index/mbox/mbox-file.c                 |   2 +-
 src/lib-storage/index/mbox/mbox-lock.c                 |  11 +-
 src/lib-storage/index/mbox/mbox-mail.c                 |   3 +-
 src/lib-storage/index/mbox/mbox-storage.c              |   7 +-
 src/lib-storage/index/mbox/mbox-sync-parse.c           |   4 +-
 src/lib-storage/index/mbox/mbox-sync.c                 |  13 ++-
 src/lib-storage/index/raw/raw-storage.c                |   4 +-
 src/lib-storage/index/shared/shared-storage.c          |   2 +-
 src/lib-storage/list/mailbox-list-delete.c             |   5 +-
 src/lib-storage/list/mailbox-list-fs-iter.c            |  12 +-
 src/lib-storage/list/mailbox-list-fs.c                 |   8 +-
 src/lib-storage/list/mailbox-list-index-status.c       |   2 +-
 src/lib-storage/list/mailbox-list-index.c              |   2 +-
 src/lib-storage/list/mailbox-list-maildir.c            |  12 +--
 src/lib-storage/mail-namespace.h                       |   2 +-
 src/lib-storage/mail-search.h                          |   5 +-
 src/lib-storage/mail-storage-service.c                 |   2 +-
 src/lib-storage/mail-storage-service.h                 |   7 +-
 src/lib-storage/mail-storage.c                         |  11 ++-
 src/lib-storage/mail-storage.h                         |  27 ++++---
 src/lib-storage/mail-thread.h                          |   2 +-
 src/lib-storage/mail.c                                 |   4 -
 src/lib-storage/mailbox-get.c                          |   2 +-
 src/lib-storage/mailbox-list-private.h                 |   6 +-
 src/lib-storage/mailbox-list.c                         |  61 ++++++++++++-----
 src/lib-storage/mailbox-list.h                         |  11 ++-
 src/lib-storage/mailbox-tree.c                         |   7 +-
 src/lib-storage/mailbox-tree.h                         |   2 +-
 src/lib-test/test-common.h                             |   3 +-
 src/lib/base64.h                                       |   2 +-
 src/lib/buffer.h                                       |   5 +-
 src/lib/child-wait.h                                   |   2 +-
 src/lib/eacces-error.h                                 |   3 +-
 src/lib/failures.c                                     |  18 +---
 src/lib/file-dotlock.c                                 |   2 +-
 src/lib/hash.c                                         |   6 +-
 src/lib/hash.h                                         |   3 +-
 src/lib/hash2.h                                        |   2 +-
 src/lib/ioloop-notify-fd.h                             |   5 +-
 src/lib/ioloop.c                                       |   2 +-
 src/lib/ioloop.h                                       |  14 ++-
 src/lib/iso8601-date.c                                 |  18 ++--
 src/lib/istream-base64-encoder.c                       |   6 +-
 src/lib/istream-chain.c                                |  14 +++-
 src/lib/istream-chain.h                                |   6 +-
 src/lib/istream-crlf.c                                 |   4 +-
 src/lib/istream-private.h                              |   3 +-
 src/lib/istream-seekable.h                             |   2 +-
 src/lib/istream.c                                      |   3 +-
 src/lib/istream.h                                      |   3 +-
 src/lib/lib-signals.c                                  |   3 +-
 src/lib/lib-signals.h                                  |   6 +-
 src/lib/macros.h                                       |   5 +
 src/lib/mkdir-parents.c                                |   4 +-
 src/lib/module-dir.h                                   |   8 +-
 src/lib/network.c                                      |  12 +-
 src/lib/network.h                                      |  15 ++-
 src/lib/ostream-private.h                              |   3 +-
 src/lib/ostream.c                                      |   4 +-
 src/lib/ostream.h                                      |   2 +-
 src/lib/restrict-access.h                              |   4 +-
 src/lib/safe-mkstemp.c                                 |   2 +-
 src/lib/strfuncs.c                                     |   2 +
 src/lib/strfuncs.h                                     |   2 +
 src/lib/test-iso8601-date.c                            |   4 +-
 src/lib/uri-util.c                                     |   2 +-
 src/lib/uri-util.h                                     |   2 +-
 src/lib/var-expand.h                                   |   2 +-
 src/lmtp/client.h                                      |   2 +-
 src/lmtp/lmtp-proxy.h                                  |   3 +-
 src/log/main.c                                         |   2 +-
 src/login-common/client-common-auth.c                  |   2 +-
 src/login-common/login-proxy.c                         |   5 +-
 src/login-common/login-settings.h                      |   2 +-
 src/login-common/sasl-server.c                         |  10 +-
 src/login-common/ssl-proxy-openssl.c                   |   2 +-
 src/master/common.h                                    |   3 +-
 src/plugins/acl/acl-backend-vfile-acllist.c            |  12 +-
 src/plugins/acl/acl-plugin.h                           |   2 +-
 src/plugins/fts-lucene/fts-backend-lucene.c            |   4 +-
 src/plugins/fts-lucene/lucene-wrapper.h                |   7 +-
 src/plugins/fts-solr/solr-connection.c                 |   4 +-
 src/plugins/fts-squat/squat-trie.h                     |   3 +-
 src/plugins/fts/fts-storage.c                          |   3 +-
 src/plugins/quota/quota-dirsize.c                      |   4 +-
 src/plugins/quota/quota-fs.c                           |   3 +-
 src/plugins/quota/quota-maildir.c                      |   3 +-
 src/plugins/quota/quota.c                              |   5 +-
 src/pop3/pop3-client.h                                 |   2 +-
 src/replication/aggregator/aggregator.c                |   3 +-
 src/replication/replicator/replicator.c                |   7 +-
 src/ssl-params/main.c                                  |   3 +-
 src/stats/mail-domain.h                                |   2 +-
 src/stats/mail-ip.h                                    |   3 +-
 src/stats/mail-session.h                               |   2 +-
 src/stats/mail-user.h                                  |   2 +-
 src/stats/main.c                                       |   2 +-
 243 files changed, 738 insertions(+), 599 deletions(-)

diffs (truncated from 4953 to 300 lines):

diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/anvil/main.c
--- a/src/anvil/main.c	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/anvil/main.c	Sun Jun 24 00:52:57 2012 +0300
@@ -29,7 +29,8 @@
 	anvil_connection_create(conn->fd, master, conn->fifo);
 }
 
-static void log_fdpass_input(void *context ATTR_UNUSED)
+static void ATTR_NULL(1)
+log_fdpass_input(void *context ATTR_UNUSED)
 {
 	int fd;
 	char c;
@@ -57,7 +58,7 @@
 	const char *error;
 
 	master_service = master_service_init("anvil", service_flags,
-					     &argc, &argv, NULL);
+					     &argc, &argv, "");
 	if (master_getopt(master_service) > 0)
 		return FATAL_DEFAULT;
 	if (master_service_settings_read_simple(master_service,
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/auth-master-connection.c
--- a/src/auth/auth-master-connection.c	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/auth-master-connection.c	Sun Jun 24 00:52:57 2012 +0300
@@ -383,14 +383,14 @@
 			return FALSE;
 		auth_request_log_info(auth_request, "passdb", "%s", error);
 		pass_callback(PASSDB_RESULT_USER_UNKNOWN,
-			      NULL, 0, auth_request);
+			      &uchar_nul, 0, auth_request);
 	} else if (conn->userdb_restricted_uid != 0) {
 		/* no permissions to do this lookup */
 		auth_request_log_error(auth_request, "passdb",
 			"Auth client doesn't have permissions to do "
 			"a PASS lookup: %s", auth_restricted_reason(conn));
 		pass_callback(PASSDB_RESULT_INTERNAL_FAILURE,
-			      NULL, 0, auth_request);
+			      &uchar_nul, 0, auth_request);
 	} else {
 		auth_request_set_state(auth_request,
 				       AUTH_REQUEST_STATE_MECH_CONTINUE);
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/auth-master-connection.h
--- a/src/auth/auth-master-connection.h	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/auth-master-connection.h	Sun Jun 24 00:52:57 2012 +0300
@@ -28,7 +28,7 @@
 struct auth_master_connection *
 auth_master_connection_create(struct auth *auth, int fd,
 			      const char *path, const struct stat *socket_st,
-			      bool userdb_only);
+			      bool userdb_only) ATTR_NULL(4);
 void auth_master_connection_destroy(struct auth_master_connection **conn);
 
 void auth_master_connection_ref(struct auth_master_connection *conn);
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/auth-request-handler.c
--- a/src/auth/auth-request-handler.c	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/auth-request-handler.c	Sun Jun 24 00:52:57 2012 +0300
@@ -37,7 +37,7 @@
 static struct aqueue *auth_failures;
 static struct timeout *to_auth_failures;
 
-static void auth_failure_timeout(void *context);
+static void auth_failure_timeout(void *context) ATTR_NULL(1);
 
 #undef auth_request_handler_create
 struct auth_request_handler *
@@ -762,7 +762,8 @@
 
 		i_assert(auth_request->state == AUTH_REQUEST_STATE_FINISHED);
 		auth_request_handler_reply(auth_request,
-					   AUTH_CLIENT_RESULT_FAILURE, NULL, 0);
+					   AUTH_CLIENT_RESULT_FAILURE,
+					   &uchar_nul, 0);
 		auth_request_unref(&auth_request);
 	}
 }
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/auth-request.c
--- a/src/auth/auth-request.c	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/auth-request.c	Sun Jun 24 00:52:57 2012 +0300
@@ -141,8 +141,7 @@
 
 	auth_request_set_state(request, AUTH_REQUEST_STATE_FINISHED);
 	auth_request_refresh_last_access(request);
-	auth_request_handler_reply(request, AUTH_CLIENT_RESULT_FAILURE,
-				   NULL, 0);
+	auth_request_handler_reply(request, AUTH_CLIENT_RESULT_FAILURE, "", 0);
 }
 
 void auth_request_internal_failure(struct auth_request *request)
@@ -325,7 +324,7 @@
 	i_assert(request->state == AUTH_REQUEST_STATE_MECH_CONTINUE);
 
 	if (request->successful) {
-		auth_request_success(request, NULL, 0);
+		auth_request_success(request, "", 0);
 		return;
 	}
 
@@ -790,7 +789,8 @@
 		auth_request_log_debug(request, "password",
 			"passdb doesn't support credential lookups");
 		auth_request_lookup_credentials_callback(
-			PASSDB_RESULT_SCHEME_NOT_AVAILABLE, NULL, 0, request);
+					PASSDB_RESULT_SCHEME_NOT_AVAILABLE,
+					&uchar_nul, 0, request);
 	} else if (passdb->blocking) {
 		passdb_blocking_lookup_credentials(request);
 	} else {
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/auth-request.h
--- a/src/auth/auth-request.h	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/auth-request.h	Sun Jun 24 00:52:57 2012 +0300
@@ -175,13 +175,13 @@
 
 void auth_request_set_field(struct auth_request *request,
 			    const char *name, const char *value,
-			    const char *default_scheme);
+			    const char *default_scheme) ATTR_NULL(4);
 void auth_request_set_field_keyvalue(struct auth_request *request,
 				     const char *field,
-				     const char *default_scheme);
+				     const char *default_scheme) ATTR_NULL(3);
 void auth_request_set_fields(struct auth_request *request,
 			     const char *const *fields,
-			     const char *default_scheme);
+			     const char *default_scheme) ATTR_NULL(3);
 
 void auth_request_init_userdb_reply(struct auth_request *request);
 void auth_request_set_userdb_field(struct auth_request *request,
@@ -203,7 +203,8 @@
 
 const struct var_expand_table *
 auth_request_get_var_expand_table(const struct auth_request *auth_request,
-				  auth_request_escape_func_t *escape_func);
+				  auth_request_escape_func_t *escape_func)
+	ATTR_NULL(2);
 const char *auth_request_str_escape(const char *string,
 				    const struct auth_request *request);
 
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/auth-settings.h
--- a/src/auth/auth-settings.h	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/auth-settings.h	Sun Jun 24 00:52:57 2012 +0300
@@ -67,6 +67,7 @@
 
 struct auth_settings *
 auth_settings_read(const char *service, pool_t pool,
-		   struct master_service_settings_output *output_r);
+		   struct master_service_settings_output *output_r)
+	ATTR_NULL(1);
 
 #endif
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/auth-stream.h
--- a/src/auth/auth-stream.h	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/auth-stream.h	Sun Jun 24 00:52:57 2012 +0300
@@ -5,7 +5,7 @@
 
 struct auth_stream_reply *auth_stream_reply_init(pool_t pool);
 void auth_stream_reply_add(struct auth_stream_reply *reply,
-			   const char *key, const char *value);
+			   const char *key, const char *value) ATTR_NULL(2, 3);
 void auth_stream_reply_reset(struct auth_stream_reply *reply);
 void auth_stream_reply_remove(struct auth_stream_reply *reply, const char *key);
 
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/auth-worker-server.c
--- a/src/auth/auth-worker-server.c	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/auth-worker-server.c	Sun Jun 24 00:52:57 2012 +0300
@@ -57,7 +57,7 @@
 
 static void worker_input(struct auth_worker_connection *conn);
 static void auth_worker_destroy(struct auth_worker_connection **conn,
-				const char *reason, bool restart);
+				const char *reason, bool restart) ATTR_NULL(2);
 
 static void auth_worker_idle_timeout(struct auth_worker_connection *conn)
 {
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/auth.c
--- a/src/auth/auth.c	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/auth.c	Sun Jun 24 00:52:57 2012 +0300
@@ -137,7 +137,7 @@
 	}
 }
 
-static struct auth *
+static struct auth * ATTR_NULL(2)
 auth_preinit(const struct auth_settings *set, const char *service, pool_t pool,
 	     const struct mechanisms_register *reg)
 {
@@ -229,18 +229,25 @@
 	unsigned int i, count;
 
 	a = array_get(&auths, &count);
-	if (name != NULL) {
-		for (i = 1; i < count; i++) {
-			if (strcmp(a[i]->service, name) == 0)
-				return a[i];
-		}
-		/* not found. maybe we can instead find a !service */
-		for (i = 1; i < count; i++) {
-			if (a[i]->service[0] == '!' &&
-			    strcmp(a[i]->service + 1, name) != 0)
-				return a[i];
-		}
+	for (i = 1; i < count; i++) {
+		if (strcmp(a[i]->service, name) == 0)
+			return a[i];
 	}
+	/* not found. maybe we can instead find a !service */
+	for (i = 1; i < count; i++) {
+		if (a[i]->service[0] == '!' &&
+		    strcmp(a[i]->service + 1, name) != 0)
+			return a[i];
+	}
+	return a[0];
+}
+
+struct auth *auth_default_service(void)
+{
+	struct auth *const *a;
+	unsigned int count;
+
+	a = array_get(&auths, &count);
 	return a[0];
 }
 
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/auth.h
--- a/src/auth/auth.h	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/auth.h	Sun Jun 24 00:52:57 2012 +0300
@@ -33,6 +33,7 @@
 extern struct auth_penalty *auth_penalty;
 
 struct auth *auth_find_service(const char *name);
+struct auth *auth_default_service(void);
 
 void auths_preinit(const struct auth_settings *set, pool_t pool,
 		   const struct mechanisms_register *reg,
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/db-checkpassword.h
--- a/src/auth/db-checkpassword.h	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/db-checkpassword.h	Sun Jun 24 00:52:57 2012 +0300
@@ -24,6 +24,6 @@
 			   struct auth_request *request,
 			   const char *auth_password,
 			   db_checkpassword_callback_t *callback,
-			   void (*request_callback)());
+			   void (*request_callback)()) ATTR_NULL(3);
 
 #endif
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/db-ldap.c
--- a/src/auth/db-ldap.c	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/db-ldap.c	Sun Jun 24 00:52:57 2012 +0300
@@ -753,7 +753,7 @@
 	net_set_nonblock(conn->fd, TRUE);
 }
 
-static void
+static void ATTR_NULL(1)
 db_ldap_set_opt(struct ldap_connection *conn, int opt, const void *value,
 		const char *optname, const char *value_str)
 {
@@ -766,7 +766,7 @@
 	}
 }
 
-static void
+static void ATTR_NULL(1)
 db_ldap_set_opt_str(struct ldap_connection *conn, int opt, const char *value,
 		    const char *optname)
 {
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/db-ldap.h
--- a/src/auth/db-ldap.h	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/db-ldap.h	Sun Jun 24 00:52:57 2012 +0300
@@ -167,7 +167,7 @@
 
 void db_ldap_set_attrs(struct ldap_connection *conn, const char *attrlist,
 		       char ***attr_names_r, ARRAY_TYPE(ldap_field) *attr_map,
-		       const char *skip_attr);
+		       const char *skip_attr) ATTR_NULL(5);
 
 struct ldap_connection *db_ldap_init(const char *config_path, bool userdb);
 void db_ldap_unref(struct ldap_connection **conn);
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/db-passwd-file.c
--- a/src/auth/db-passwd-file.c	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/db-passwd-file.c	Sun Jun 24 00:52:57 2012 +0300
@@ -25,8 +25,9 @@
 
 static struct db_passwd_file *passwd_files;
 
-static void passwd_file_add(struct passwd_file *pw, const char *username,
-			    const char *pass, const char *const *args)
+static void ATTR_NULL(3)
+passwd_file_add(struct passwd_file *pw, const char *username,
+		const char *pass, const char *const *args)
 {
 	/* args = uid, gid, user info, home dir, shell, extra_fields */
 	struct passwd_user *pu;
diff -r e0cc3fb5dc64 -r c93ca5e46a8a src/auth/main.c
--- a/src/auth/main.c	Fri Jun 22 21:59:01 2012 +0300
+++ b/src/auth/main.c	Sun Jun 24 00:52:57 2012 +0300
@@ -227,7 +227,7 @@
 
 	/* set proctitles before init()s, since they may set them to error */
 	auth_refresh_proctitle();


More information about the dovecot-cvs mailing list