[dovecot-cvs] dovecot/src/auth auth-digest-md5.c,1.15,1.16 auth-interface.h,1.4,1.5 auth-plain.c,1.7,1.8 auth.c,1.6,1.7 auth.h,1.4,1.5 common.h,1.2,1.3 cookie.c,1.5,1.6 cookie.h,1.3,1.4 login-connection.c,1.10,1.11 login-connection.h,1.1.1.1,1.2 main.c,1.11,1.12 Message-Id: <20030105130954.3B70C2382C@danu.procontrol.fi>

cras at procontrol.fi cras at procontrol.fi
Sun Jan 5 15:09:54 EET 2003


Update of /home/cvs/dovecot/src/auth
In directory danu:/tmp/cvs-serv25916/src/auth

Modified Files:
	auth-digest-md5.c auth-interface.h auth-plain.c auth.c auth.h 
	common.h cookie.c cookie.h login-connection.c 
	login-connection.h main.c master.c userinfo-pam.c 
	userinfo-passwd-file.c userinfo-passwd.c userinfo-passwd.h 
	userinfo-shadow.c userinfo-vpopmail.c userinfo.c userinfo.h 
Log Message:
Naming style changes, finally got tired of most of the typedefs. Also the
previous enum -> macro change reverted so that we don't use the highest bit
anymore, that's incompatible with old indexes so they will be rebuilt.



Index: auth-digest-md5.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/auth-digest-md5.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- auth-digest-md5.c	3 Jan 2003 05:36:20 -0000	1.15
+++ auth-digest-md5.c	5 Jan 2003 13:09:51 -0000	1.16
@@ -21,23 +21,23 @@
 /* Linear whitespace */
 #define IS_LWS(c) ((c) == ' ' || (c) == '\t')
 
-typedef enum {
+enum qop_option {
 	QOP_AUTH	= 0x01,	/* authenticate */
 	QOP_AUTH_INT	= 0x02, /* + integrity protection, not supported yet */
 	QOP_AUTH_CONF	= 0x04, /* + encryption, not supported yet */
 
 	QOP_COUNT	= 3
-} QopOption;
+};
 
 static char *qop_names[] = { "auth", "auth-int", "auth-conf" };
 
-typedef struct {
-	Pool pool;
+struct auth_data {
+	pool_t pool;
 	unsigned int authenticated:1;
 
 	/* requested: */
 	char *nonce;
-	QopOption qop;
+	enum qop_option qop;
 
 	/* received: */
 	char *realm; /* may be NULL */
@@ -52,13 +52,13 @@
 
 	/* final reply: */
 	char *rspauth;
-        AuthCookieReplyData cookie_reply;
-} AuthData;
+        struct auth_cookie_reply_data cookie_reply;
+};
 
-static const char *get_digest_challenge(AuthData *auth)
+static const char *get_digest_challenge(struct auth_data *auth)
 {
-	String *qoplist, *realms;
-	Buffer *buf;
+	string_t *qoplist, *realms;
+	buffer_t *buf;
 	const char *const *tmp;
 	unsigned char nonce[16];
 	int i;
@@ -109,9 +109,9 @@
 			   NULL);
 }
 
-static int verify_auth(AuthData *auth)
+static int verify_auth(struct auth_data *auth)
 {
-	MD5Context ctx;
+	struct md5_context ctx;
 	unsigned char digest[16];
 	const char *a1_hex, *a2_hex, *response_hex;
 	int i;
@@ -170,8 +170,10 @@
 			md5_update(&ctx, auth->digest_uri,
 				   strlen(auth->digest_uri));
 		}
-		if (auth->qop == QOP_AUTH_INT || auth->qop == QOP_AUTH_CONF)
-			md5_update(&ctx, ":00000000000000000000000000000000", 33);
+		if (auth->qop == QOP_AUTH_INT || auth->qop == QOP_AUTH_CONF) {
+			md5_update(&ctx, ":00000000000000000000000000000000",
+				   33);
+		}
 		md5_final(&ctx, digest);
 		a2_hex = binary_to_hex(digest, 16);
 
@@ -286,7 +288,7 @@
 	return ret;
 }
 
-static int auth_handle_response(AuthData *auth, char *key, char *value,
+static int auth_handle_response(struct auth_data *auth, char *key, char *value,
 				const char **error)
 {
 	int i;
@@ -449,7 +451,7 @@
 	return TRUE;
 }
 
-static int parse_digest_response(AuthData *auth, const char *data,
+static int parse_digest_response(struct auth_data *auth, const char *data,
 				 size_t size, const char **error)
 {
 	char *copy, *key, *value;
@@ -516,13 +518,14 @@
 	return !failed;
 }
 
-static void auth_digest_md5_continue(CookieData *cookie,
-				     AuthContinuedRequestData *request,
-				     const unsigned char *data,
-				     AuthCallback callback, void *context)
+static void
+auth_digest_md5_continue(struct cookie_data *cookie,
+			 struct auth_continued_request_data *request,
+			 const unsigned char *data,
+			 AuthCallback callback, void *context)
 {
-	AuthData *auth = cookie->context;
-	AuthReplyData reply;
+	struct auth_data *auth = cookie->context;
+	struct auth_reply_data reply;
 	const char *error;
 
 	/* initialize reply */
@@ -557,40 +560,41 @@
 	cookie_remove(cookie->cookie);
 }
 
-static int auth_digest_md5_fill_reply(CookieData *cookie,
-				      AuthCookieReplyData *reply)
+static int auth_digest_md5_fill_reply(struct cookie_data *cookie,
+				      struct auth_cookie_reply_data *reply)
 {
-	AuthData *auth = cookie->context;
+	struct auth_data *auth = cookie->context;
 
 	if (!auth->authenticated)
 		return FALSE;
 
-	memcpy(reply, &auth->cookie_reply, sizeof(AuthCookieReplyData));
+	memcpy(reply, &auth->cookie_reply,
+	       sizeof(struct auth_cookie_reply_data));
 	return TRUE;
 }
 
-static void auth_digest_md5_free(CookieData *cookie)
+static void auth_digest_md5_free(struct cookie_data *cookie)
 {
-	pool_unref(((AuthData *) cookie->context)->pool);
+	pool_unref(((struct auth_data *) cookie->context)->pool);
 }
 
 static void auth_digest_md5_init(unsigned int login_pid,
-				 AuthInitRequestData *request,
+				 struct auth_init_request_data *request,
 				 AuthCallback callback, void *context)
 {
-	CookieData *cookie;
-	AuthReplyData reply;
-	AuthData *auth;
-	Pool pool;
+	struct cookie_data *cookie;
+	struct auth_reply_data reply;
+	struct auth_data *auth;
+	pool_t pool;
 	const char *challenge;
 
 	pool = pool_alloconly_create("Digest-MD5", 2048);
-	auth = p_new(pool, AuthData, 1);
+	auth = p_new(pool, struct auth_data, 1);
 	auth->pool = pool;
 
 	auth->qop = QOP_AUTH;
 
-	cookie = p_new(pool, CookieData, 1);
+	cookie = p_new(pool, struct cookie_data, 1);
 	cookie->login_pid = login_pid;
 	cookie->auth_fill_reply = auth_digest_md5_fill_reply;
 	cookie->auth_continue = auth_digest_md5_continue;
@@ -615,7 +619,7 @@
 	t_pop();
 }
 
-AuthModule auth_digest_md5 = {
+struct auth_module auth_digest_md5 = {
 	AUTH_METHOD_DIGEST_MD5,
 	auth_digest_md5_init
 };

Index: auth-interface.h
===================================================================
RCS file: /home/cvs/dovecot/src/auth/auth-interface.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- auth-interface.h	19 Dec 2002 23:56:23 -0000	1.4
+++ auth-interface.h	5 Jan 2003 13:09:51 -0000	1.5
@@ -11,76 +11,76 @@
 #define AUTH_MAX_HOME_LEN		256
 #define AUTH_MAX_MAIL_LEN		256
 
-typedef enum {
+enum auth_request_type {
 	AUTH_REQUEST_NONE, /* must not be requested */
 	AUTH_REQUEST_INIT,
         AUTH_REQUEST_CONTINUE
-} AuthRequestType;
+};
 
-typedef enum {
+enum auth_result {
 	AUTH_RESULT_INTERNAL_FAILURE, /* never sent by imap-auth */
 
 	AUTH_RESULT_CONTINUE,
 	AUTH_RESULT_SUCCESS,
 	AUTH_RESULT_FAILURE
-} AuthResult;
+};
 
-typedef enum {
+enum auth_method {
 	AUTH_METHOD_PLAIN	= 0x01,
 	AUTH_METHOD_DIGEST_MD5	= 0x02,
 
 	AUTH_METHODS_COUNT	= 2
-} AuthMethod;
+};
 
 /* Initialization reply, sent after client is connected */
-typedef struct {
+struct auth_init_data {
 	unsigned int auth_process; /* unique auth process identifier */
-	AuthMethod auth_methods; /* valid authentication methods */
-} AuthInitData;
+	enum auth_method auth_methods; /* valid authentication methods */
+};
 
 /* Initialization handshake from client. */
-typedef struct {
+struct client_auth_init_data {
 	unsigned int pid; /* unique identifier for client process */
-} ClientAuthInitData;
+};
 
 /* New authentication request */
-typedef struct {
-	AuthRequestType type; /* AUTH_REQUEST_INIT */
+struct auth_init_request_data {
+	enum auth_request_type type; /* AUTH_REQUEST_INIT */
 
-	AuthMethod method;
+	enum auth_method method;
 	unsigned int id; /* AuthReplyData.id will contain this value */
-} AuthInitRequestData;
+};
 
 /* Continued authentication request */
-typedef struct {
-	AuthRequestType type; /* AUTH_REQUEST_CONTINUE */
+struct auth_continued_request_data {
+	enum auth_request_type type; /* AUTH_REQUEST_CONTINUE */
 
 	unsigned char cookie[AUTH_COOKIE_SIZE];
 	unsigned int id; /* AuthReplyData.id will contain this value */
 
 	size_t data_size;
 	/* unsigned char data[]; */
-} AuthContinuedRequestData;
+};
 
 /* Reply to authentication */
-typedef struct {
+struct auth_reply_data {
 	unsigned int id;
 	unsigned char cookie[AUTH_COOKIE_SIZE];
-	AuthResult result;
+	enum auth_result result;
 
 	size_t data_size;
 	/* unsigned char data[]; */
-} AuthReplyData;
+};
 
 /* Request data associated to cookie */
-typedef struct {
+struct auth_cookie_request_data {
 	unsigned int id;
 	unsigned int login_pid;
 	unsigned char cookie[AUTH_COOKIE_SIZE];
-} AuthCookieRequestData;
+};
 
 /* Reply to cookie request */
-typedef struct {
+struct auth_cookie_reply_data {
 	unsigned int id;
 	int success; /* FALSE if cookie wasn't found */
 
@@ -93,6 +93,6 @@
 	char mail[AUTH_MAX_MAIL_LEN];
 
 	int chroot; /* chroot to home directory */
-} AuthCookieReplyData;
+};
 
 #endif

Index: auth-plain.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/auth-plain.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- auth-plain.c	19 Dec 2002 23:56:23 -0000	1.7
+++ auth-plain.c	5 Jan 2003 13:09:51 -0000	1.8
@@ -6,13 +6,13 @@
 #include "cookie.h"
 #include "userinfo.h"
 
-static void auth_plain_continue(CookieData *cookie,
-				AuthContinuedRequestData *request,
+static void auth_plain_continue(struct cookie_data *cookie,
+				struct auth_continued_request_data *request,
 				const unsigned char *data,
 				AuthCallback callback, void *context)
 {
-	AuthCookieReplyData *cookie_reply = cookie->context;
-	AuthReplyData reply;
+	struct auth_cookie_reply_data *cookie_reply = cookie->context;
+	struct auth_reply_data reply;
 	const char *user;
 	char *pass;
 	size_t i, count, len;
@@ -62,37 +62,38 @@
 	}
 }
 
-static int auth_plain_fill_reply(CookieData *cookie, AuthCookieReplyData *reply)
+static int auth_plain_fill_reply(struct cookie_data *cookie,
+				 struct auth_cookie_reply_data *reply)
 {
-	AuthCookieReplyData *cookie_reply;
+	struct auth_cookie_reply_data *cookie_reply;
 
 	cookie_reply = cookie->context;
 	if (!cookie_reply->success)
 		return FALSE;
 
-	memcpy(reply, cookie_reply, sizeof(AuthCookieReplyData));
+	memcpy(reply, cookie_reply, sizeof(struct auth_cookie_reply_data));
 	return TRUE;
 }
 
-static void auth_plain_free(CookieData *cookie)
+static void auth_plain_free(struct cookie_data *cookie)
 {
 	i_free(cookie->context);
 	i_free(cookie);
 }
 
 static void auth_plain_init(unsigned int login_pid,
-			    AuthInitRequestData *request,
+			    struct auth_init_request_data *request,
 			    AuthCallback callback, void *context)
 {
-	CookieData *cookie;
-	AuthReplyData reply;
+	struct cookie_data *cookie;
+	struct auth_reply_data reply;
 
-	cookie = i_new(CookieData, 1);
+	cookie = i_new(struct cookie_data, 1);
 	cookie->login_pid = login_pid;
 	cookie->auth_fill_reply = auth_plain_fill_reply;
 	cookie->auth_continue = auth_plain_continue;
 	cookie->free = auth_plain_free;
-	cookie->context = i_new(AuthCookieReplyData, 1);
+	cookie->context = i_new(struct auth_cookie_reply_data, 1);
 
 	cookie_add(cookie);
 
@@ -105,7 +106,7 @@
 	callback(&reply, NULL, context);
 }
 
-AuthModule auth_plain = {
+struct auth_module auth_plain = {
 	AUTH_METHOD_PLAIN,
 	auth_plain_init
 };

Index: auth.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/auth.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- auth.c	22 Dec 2002 08:18:29 -0000	1.6
+++ auth.c	5 Jan 2003 13:09:51 -0000	1.7
@@ -6,38 +6,36 @@
 
 #include <stdlib.h>
 
-typedef struct _AuthModuleList AuthModuleList;
-
-struct _AuthModuleList {
-	AuthModuleList *next;
+struct auth_module_list {
+	struct auth_module_list *next;
 
-	AuthModule module;
+	struct auth_module module;
 };
 
-AuthMethod auth_methods;
+enum auth_method auth_methods;
 const char *const *auth_realms;
 
-static AuthModuleList *auth_modules;
-static AuthReplyData failure_reply;
+static struct auth_module_list *auth_modules;
+static struct auth_reply_data failure_reply;
 
-void auth_register_module(AuthModule *module)
+void auth_register_module(struct auth_module *module)
 {
-	AuthModuleList *list;
+	struct auth_module_list *list;
 
 	i_assert((auth_methods & module->method) == 0);
 
 	auth_methods |= module->method;
 
-	list = i_new(AuthModuleList, 1);
-	memcpy(&list->module, module, sizeof(AuthModule));
+	list = i_new(struct auth_module_list, 1);
+	memcpy(&list->module, module, sizeof(struct auth_module));
 
 	list->next = auth_modules;
 	auth_modules = list;
 }
 
-void auth_unregister_module(AuthModule *module)
+void auth_unregister_module(struct auth_module *module)
 {
-	AuthModuleList **pos, *list;
+	struct auth_module_list **pos, *list;
 
 	if ((auth_methods & module->method) == 0)
 		return; /* not registered */
@@ -55,10 +53,10 @@
 }
 
 void auth_init_request(unsigned int login_pid,
-		       AuthInitRequestData *request,
+		       struct auth_init_request_data *request,
 		       AuthCallback callback, void *context)
 {
-	AuthModuleList *list;
+	struct auth_module_list *list;
 
 	if ((auth_methods & request->method) == 0) {
 		/* unsupported method */
@@ -81,11 +79,11 @@
 }
 
 void auth_continue_request(unsigned int login_pid,
-			   AuthContinuedRequestData *request,
+			   struct auth_continued_request_data *request,
 			   const unsigned char *data,
 			   AuthCallback callback, void *context)
 {
-	CookieData *cookie_data;
+	struct cookie_data *cookie_data;
 
 	cookie_data = cookie_lookup(request->cookie);
 	if (cookie_data == NULL) {
@@ -100,8 +98,8 @@
 	}
 }
 
-extern AuthModule auth_plain;
-extern AuthModule auth_digest_md5;
+extern struct auth_module auth_plain;
+extern struct auth_module auth_digest_md5;
 
 void auth_init(void)
 {

Index: auth.h
===================================================================
RCS file: /home/cvs/dovecot/src/auth/auth.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- auth.h	22 Dec 2002 08:18:29 -0000	1.4
+++ auth.h	5 Jan 2003 13:09:51 -0000	1.5
@@ -3,28 +3,28 @@
 
 #include "auth-interface.h"
 
-typedef void (*AuthCallback) (AuthReplyData *reply, const unsigned char *data,
-			      void *context);
+typedef void (*AuthCallback)(struct auth_reply_data *reply,
+			     const unsigned char *data, void *context);
 
-typedef struct {
-	AuthMethod method;
+struct auth_module {
+	enum auth_method method;
 
 	void (*init)(unsigned int login_pid,
-		     AuthInitRequestData *request,
+		     struct auth_init_request_data *request,
 		     AuthCallback callback, void *context);
-} AuthModule;
+};
 
-extern AuthMethod auth_methods;
+extern enum auth_method auth_methods;
 extern const char *const *auth_realms;
 
-void auth_register_module(AuthModule *module);
-void auth_unregister_module(AuthModule *module);
+void auth_register_module(struct auth_module *module);
+void auth_unregister_module(struct auth_module *module);
 
 void auth_init_request(unsigned int login_pid,
-		       AuthInitRequestData *request,
+		       struct auth_init_request_data *request,
 		       AuthCallback callback, void *context);
 void auth_continue_request(unsigned int login_pid,
-			   AuthContinuedRequestData *request,
+			   struct auth_continued_request_data *request,
 			   const unsigned char *data,
 			   AuthCallback callback, void *context);
 

Index: common.h
===================================================================
RCS file: /home/cvs/dovecot/src/auth/common.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- common.h	25 Nov 2002 13:19:55 -0000	1.2
+++ common.h	5 Jan 2003 13:09:51 -0000	1.3
@@ -7,6 +7,6 @@
 #define MASTER_SOCKET_FD 0
 #define LOGIN_LISTEN_FD 3
 
-extern IOLoop ioloop;
+extern struct ioloop *ioloop;
 
 #endif

Index: cookie.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/cookie.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cookie.c	19 Dec 2002 23:56:23 -0000	1.5
+++ cookie.c	5 Jan 2003 13:09:51 -0000	1.6
@@ -12,19 +12,17 @@
 /* 30 seconds should be more than enough */
 #define COOKIE_TIMEOUT 30
 
-typedef struct _CookieList CookieList;
-
-struct _CookieList {
-	CookieList *next;
+struct cookie_list {
+	struct cookie_list *next;
 	time_t created;
 
-	CookieData *data;
+	struct cookie_data *data;
 };
 
-static HashTable *cookies;
-static CookieList *oldest_cookie, **next_cookie;
+static struct hash_table *cookies;
+static struct cookie_list *oldest_cookie, **next_cookie;
 
-static Timeout to;
+static struct timeout *to;
 
 /* a char* hash function from ASU -- from glib */
 static unsigned int cookie_hash(const void *p)
@@ -57,16 +55,16 @@
 	return 0;
 }
 
-void cookie_add(CookieData *data)
+void cookie_add(struct cookie_data *data)
 {
-	CookieList *list;
+	struct cookie_list *list;
 
 	do {
 		random_fill(data->cookie, AUTH_COOKIE_SIZE);
 	} while (hash_lookup(cookies, data->cookie));
 
 	/* add to linked list */
-	list = i_new(CookieList, 1);
+	list = i_new(struct cookie_list, 1);
 	list->created = ioloop_time;
 	list->data = data;
 
@@ -80,7 +78,7 @@
 static void cookie_destroy(unsigned char cookie[AUTH_COOKIE_SIZE],
 			   int free_data)
 {
-	CookieList **pos, *list;
+	struct cookie_list **pos, *list;
 
 	hash_remove(cookies, cookie);
 
@@ -103,7 +101,7 @@
 	i_free(list);
 }
 
-CookieData *cookie_lookup(unsigned char cookie[AUTH_COOKIE_SIZE])
+struct cookie_data *cookie_lookup(unsigned char cookie[AUTH_COOKIE_SIZE])
 {
 	return hash_lookup(cookies, cookie);
 }
@@ -113,10 +111,11 @@
 	cookie_destroy(cookie, TRUE);
 }
 
-CookieData *cookie_lookup_and_remove(unsigned int login_pid,
-				     unsigned char cookie[AUTH_COOKIE_SIZE])
+struct cookie_data *
+cookie_lookup_and_remove(unsigned int login_pid,
+			 unsigned char cookie[AUTH_COOKIE_SIZE])
 {
-	CookieData *data;
+	struct cookie_data *data;
 
 	data = hash_lookup(cookies, cookie);
 	if (data != NULL) {
@@ -130,7 +129,7 @@
 
 void cookies_remove_login_pid(unsigned int login_pid)
 {
-	CookieList *list, *next;
+	struct cookie_list *list, *next;
 
 	/* FIXME: slow */
 	for (list = oldest_cookie; list != NULL; list = next) {
@@ -142,7 +141,7 @@
 }
 
 static void cookie_timeout(void *context __attr_unused__,
-			   Timeout timeout __attr_unused__)
+			   struct timeout *timeout __attr_unused__)
 {
 	time_t remove_time;
 

Index: cookie.h
===================================================================
RCS file: /home/cvs/dovecot/src/auth/cookie.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cookie.h	19 Dec 2002 23:56:23 -0000	1.3
+++ cookie.h	5 Jan 2003 13:09:51 -0000	1.4
@@ -3,23 +3,22 @@
 
 #include "auth-interface.h"
 
-typedef struct _CookieData CookieData;
-
-struct _CookieData {
+struct cookie_data {
 	unsigned int login_pid;
 	unsigned char cookie[AUTH_COOKIE_SIZE];
 
 	/* continue authentication */
-	void (*auth_continue)(CookieData *cookie,
-			      AuthContinuedRequestData *request,
+	void (*auth_continue)(struct cookie_data *cookie,
+			      struct auth_continued_request_data *request,
 			      const unsigned char *data,
 			      AuthCallback callback, void *context);
 
 	/* fills reply from cookie, returns TRUE if successful */
-	int (*auth_fill_reply)(CookieData *cookie, AuthCookieReplyData *reply);
+	int (*auth_fill_reply)(struct cookie_data *cookie,
+			       struct auth_cookie_reply_data *reply);
 
 	/* Free all data related to cookie */
-	void (*free)(CookieData *cookie);
+	void (*free)(struct cookie_data *cookie);
 
 	void *context;
 };
@@ -27,14 +26,15 @@
 typedef void (*CookieFreeFunc)(void *data);
 
 /* data->cookie is filled */
-void cookie_add(CookieData *data);
+void cookie_add(struct cookie_data *data);
 /* Looks up the cookie */
-CookieData *cookie_lookup(unsigned char cookie[AUTH_COOKIE_SIZE]);
+struct cookie_data *cookie_lookup(unsigned char cookie[AUTH_COOKIE_SIZE]);
 /* Removes and frees the cookie */
 void cookie_remove(unsigned char cookie[AUTH_COOKIE_SIZE]);
 /* Looks up the cookie and removes it, you have to free the returned data. */
-CookieData *cookie_lookup_and_remove(unsigned int login_pid,
-				     unsigned char cookie[AUTH_COOKIE_SIZE]);
+struct cookie_data *
+cookie_lookup_and_remove(unsigned int login_pid,
+			 unsigned char cookie[AUTH_COOKIE_SIZE]);
 
 /* Remove all cookies created by a login process. */
 void cookies_remove_login_pid(unsigned int login_pid);

Index: login-connection.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/login-connection.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- login-connection.c	19 Dec 2002 23:56:23 -0000	1.10
+++ login-connection.c	5 Jan 2003 13:09:51 -0000	1.11
@@ -13,33 +13,34 @@
 #include <syslog.h>
 
 #define MAX_INBUF_SIZE \
-	(sizeof(AuthContinuedRequestData) + AUTH_MAX_REQUEST_DATA_SIZE)
+	(sizeof(struct auth_continued_request_data) + \
+	 AUTH_MAX_REQUEST_DATA_SIZE)
 #define MAX_OUTBUF_SIZE \
-	(10 * (sizeof(AuthReplyData) + AUTH_MAX_REPLY_DATA_SIZE))
+	(10 * (sizeof(struct auth_reply_data) + AUTH_MAX_REPLY_DATA_SIZE))
 
-struct _LoginConnection {
-	LoginConnection *next;
+struct login_connection {
+	struct login_connection *next;
 
 	int fd;
-	IO io;
-	IStream *input;
-	OStream *output;
+	struct io *io;
+	struct istream *input;
+	struct ostream *output;
 
 	unsigned int pid;
-	AuthRequestType type;
+	enum auth_request_type type;
 };
 
-static AuthInitData auth_init_data;
-static LoginConnection *connections;
+static struct auth_init_data auth_init_data;
+static struct login_connection *connections;
 
-static void request_callback(AuthReplyData *reply, const unsigned char *data,
-			     void *context)
+static void request_callback(struct auth_reply_data *reply,
+			     const unsigned char *data, void *context)
 {
-	LoginConnection *conn = context;
+	struct login_connection *conn = context;
 
 	i_assert(reply->data_size <= AUTH_MAX_REPLY_DATA_SIZE);
 
-	if (o_stream_send(conn->output, reply, sizeof(AuthReplyData)) < 0)
+	if (o_stream_send(conn->output, reply, sizeof(*reply)) < 0)
 		login_connection_destroy(conn);
 	else if (reply->data_size > 0) {
 		if (o_stream_send(conn->output, data, reply->data_size) < 0)
@@ -47,9 +48,9 @@
 	}
 }
 
-static LoginConnection *login_find_pid(unsigned int pid)
+static struct login_connection *login_find_pid(unsigned int pid)
 {
-	LoginConnection *conn;
+	struct login_connection *conn;
 
 	for (conn = connections; conn != NULL; conn = conn->next) {
 		if (conn->pid == pid)
@@ -59,14 +60,14 @@
 	return NULL;
 }
 
-static void login_input_handshake(LoginConnection *conn)
+static void login_input_handshake(struct login_connection *conn)
 {
-        ClientAuthInitData rec;
+        struct client_auth_init_data rec;
         unsigned char *data;
 	size_t size;
 
 	data = i_stream_get_modifyable_data(conn->input, &size);
-	if (size < sizeof(ClientAuthInitData))
+	if (size < sizeof(struct client_auth_init_data))
 		return;
 
 	/* Don't just cast because of alignment issues. */
@@ -86,24 +87,24 @@
 	}
 }
 
-static void login_input_request(LoginConnection *conn)
+static void login_input_request(struct login_connection *conn)
 {
         unsigned char *data;
 	size_t size;
 
 	data = i_stream_get_modifyable_data(conn->input, &size);
-	if (size < sizeof(AuthRequestType))
+	if (size < sizeof(enum auth_request_type))
 		return;
 
 	/* note that we can't directly cast the received data pointer into
 	   structures, as it may not be aligned properly. */
 	if (conn->type == AUTH_REQUEST_NONE) {
 		/* get the request type */
-		memcpy(&conn->type, data, sizeof(AuthRequestType));
+		memcpy(&conn->type, data, sizeof(enum auth_request_type));
 	}
 
 	if (conn->type == AUTH_REQUEST_INIT) {
-		AuthInitRequestData request;
+		struct auth_init_request_data request;
 
 		if (size < sizeof(request))
 			return;
@@ -115,7 +116,7 @@
 		auth_init_request(conn->pid, &request, request_callback, conn);
 		conn->type = AUTH_REQUEST_NONE;
 	} else if (conn->type == AUTH_REQUEST_CONTINUE) {
-                AuthContinuedRequestData request;
+                struct auth_continued_request_data request;
 
 		if (size < sizeof(request))
 			return;
@@ -143,9 +144,9 @@
 }
 
 static void login_input(void *context, int fd __attr_unused__,
-			IO io __attr_unused__)
+			struct io *io __attr_unused__)
 {
-	LoginConnection *conn  = context;
+	struct login_connection *conn  = context;
 
 	switch (i_stream_read(conn->input)) {
 	case 0:
@@ -168,11 +169,11 @@
 		login_input_request(conn);
 }
 
-LoginConnection *login_connection_create(int fd)
+struct login_connection *login_connection_create(int fd)
 {
-	LoginConnection *conn;
+	struct login_connection *conn;
 
-	conn = i_new(LoginConnection, 1);
+	conn = i_new(struct login_connection, 1);
 
 	conn->fd = fd;
 	conn->input = i_stream_create_file(fd, default_pool, MAX_INBUF_SIZE,
@@ -194,9 +195,9 @@
 	return conn;
 }
 
-void login_connection_destroy(LoginConnection *conn)
+void login_connection_destroy(struct login_connection *conn)
 {
-	LoginConnection **pos;
+	struct login_connection **pos;
 
 	for (pos = &connections; *pos != NULL; pos = &(*pos)->next) {
 		if (*pos == conn) {
@@ -232,7 +233,7 @@
 
 void login_connections_deinit(void)
 {
-	LoginConnection *next;
+	struct login_connection *next;
 
 	while (connections != NULL) {
 		next = connections->next;

Index: login-connection.h
===================================================================
RCS file: /home/cvs/dovecot/src/auth/login-connection.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- login-connection.h	9 Aug 2002 09:16:15 -0000	1.1.1.1
+++ login-connection.h	5 Jan 2003 13:09:51 -0000	1.2
@@ -1,10 +1,8 @@
 #ifndef __LOGIN_CONNECTION_H
 #define __LOGIN_CONNECTION_H
 
-typedef struct _LoginConnection LoginConnection;
-
-LoginConnection *login_connection_create(int fd);
-void login_connection_destroy(LoginConnection *conn);
+struct login_connection *login_connection_create(int fd);
+void login_connection_destroy(struct login_connection *conn);
 
 void login_connections_init(void);
 void login_connections_deinit(void);

Index: main.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/main.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- main.c	20 Dec 2002 01:47:11 -0000	1.11
+++ main.c	5 Jan 2003 13:09:51 -0000	1.12
@@ -16,8 +16,8 @@
 #include <stdlib.h>
 #include <syslog.h>
 
-IOLoop ioloop;
-static IO io_listen;
+struct ioloop *ioloop;
+static struct io *io_listen;
 
 static void sig_quit(int signo __attr_unused__)
 {
@@ -25,7 +25,7 @@
 }
 
 static void auth_accept(void *context __attr_unused__, int listen_fd,
-			IO io __attr_unused__)
+			struct io *io __attr_unused__)
 {
 	int fd;
 

Index: master.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/master.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- master.c	19 Dec 2002 23:56:23 -0000	1.8
+++ master.c	5 Jan 2003 13:09:51 -0000	1.9
@@ -7,21 +7,21 @@
 #include "cookie.h"
 #include "master.h"
 
-#define MAX_OUTBUF_SIZE (10 * sizeof(AuthCookieReplyData))
+#define MAX_OUTBUF_SIZE (10 * sizeof(struct auth_cookie_reply_data))
 
-static AuthCookieReplyData failure_reply;
+static struct auth_cookie_reply_data failure_reply;
 
-static OStream *output;
-static IO io_master;
+static struct ostream *output;
+static struct io *io_master;
 
 static unsigned int master_pos;
-static char master_buf[sizeof(AuthCookieRequestData)];
+static char master_buf[sizeof(struct auth_cookie_request_data)];
 
-static void master_handle_request(AuthCookieRequestData *request,
+static void master_handle_request(struct auth_cookie_request_data *request,
 				  int fd __attr_unused__)
 {
-	CookieData *cookie;
-        AuthCookieReplyData *reply, temp_reply;
+	struct cookie_data *cookie;
+        struct auth_cookie_reply_data *reply, temp_reply;
 
 	cookie = cookie_lookup_and_remove(request->login_pid, request->cookie);
 	if (cookie == NULL)
@@ -35,7 +35,7 @@
 	}
 
 	reply->id = request->id;
-	switch (o_stream_send(output, reply, sizeof(AuthCookieReplyData))) {
+	switch (o_stream_send(output, reply, sizeof(*reply))) {
 	case -2:
 		i_fatal("Master transmit buffer full, aborting");
 	case -1:
@@ -46,7 +46,7 @@
 }
 
 static void master_input(void *context __attr_unused__, int fd,
-			 IO io __attr_unused__)
+			 struct io *io __attr_unused__)
 {
 	int ret;
 
@@ -63,7 +63,8 @@
 		return;
 
 	/* reply is now read */
-	master_handle_request((AuthCookieRequestData *) master_buf, fd);
+	master_handle_request((struct auth_cookie_request_data *) master_buf,
+			      fd);
 	master_pos = 0;
 }
 

Index: userinfo-pam.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userinfo-pam.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- userinfo-pam.c	19 Dec 2002 01:04:02 -0000	1.11
+++ userinfo-pam.c	5 Jan 2003 13:09:51 -0000	1.12
@@ -50,10 +50,10 @@
 #  define USERPASS_USER_FIXED		3
 #endif
 
-typedef struct {
+struct pam_userpass {
 	const char *user;
 	const char *pass;
-} pam_userpass_t;
+};
 
 static char *service_name;
 
@@ -61,7 +61,7 @@
 	struct pam_response **resp, void *appdata_ptr)
 {
 	/* @UNSAFE */
-	pam_userpass_t *userpass = (pam_userpass_t *)appdata_ptr;
+	struct pam_userpass *userpass = (struct pam_userpass *) appdata_ptr;
 #ifdef AUTH_PAM_USERPASS
 	pamc_bp_t prompt;
 	const char *input;
@@ -172,10 +172,10 @@
 }
 
 static int pam_verify_plain(const char *user, const char *password,
-			    AuthCookieReplyData *reply)
+			    struct auth_cookie_reply_data *reply)
 {
 	pam_handle_t *pamh;
-	pam_userpass_t userpass;
+	struct pam_userpass userpass;
 	struct pam_conv conv;
 	struct passwd *pw;
 	int status, status2;
@@ -219,7 +219,7 @@
 	i_free(service_name);
 }
 
-UserInfoModule userinfo_pam = {
+struct user_info_module userinfo_pam = {
 	pam_init,
 	pam_deinit,
 

Index: userinfo-passwd-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userinfo-passwd-file.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- userinfo-passwd-file.c	5 Jan 2003 09:23:13 -0000	1.21
+++ userinfo-passwd-file.c	5 Jan 2003 13:09:51 -0000	1.22
@@ -18,23 +18,23 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 
-typedef struct {
-	Pool pool;
+struct passwd_file {
+	pool_t pool;
 
 	char *path;
 	time_t stamp;
 	int fd;
 
-	HashTable *users;
-} PasswdFile;
+	struct hash_table *users;
+};
 
-typedef enum {
+enum password_type {
 	PASSWORD_DES,
 	PASSWORD_MD5,
 	PASSWORD_DIGEST_MD5
-} PasswordType;
+};
 
-typedef struct {
+struct passwd_user {
 	char *user_realm; /* user:realm */
 	const char *realm; /* NULL or points to user_realm */
 	char *password;
@@ -44,15 +44,16 @@
 	uid_t uid;
 	gid_t gid;
 
-	PasswordType password_type;
+	enum password_type password_type;
 	unsigned int chroot:1;
-} PasswdUser;
+};
 
-static PasswdFile *passwd_file;
+static struct passwd_file *passwd_file;
 
 static void passwd_file_sync(void);
 
-static int get_reply_data(PasswdUser *pu, AuthCookieReplyData *reply)
+static int get_reply_data(struct passwd_user *pu,
+			  struct auth_cookie_reply_data *reply)
 {
 	const char *user;
 	struct passwd *pw;
@@ -104,9 +105,9 @@
 }
 
 static int passwd_file_verify_plain(const char *user, const char *password,
-				    AuthCookieReplyData *reply)
+				    struct auth_cookie_reply_data *reply)
 {
-	PasswdUser *pu;
+	struct passwd_user *pu;
 	const char *const *tmp;
 	unsigned char digest[16];
 	const char *str;
@@ -162,11 +163,11 @@
 
 static int passwd_file_lookup_digest_md5(const char *user, const char *realm,
 					 unsigned char digest[16],
-					 AuthCookieReplyData *reply)
+					 struct auth_cookie_reply_data *reply)
 {
 	const char *id;
-	PasswdUser *pu;
-	Buffer *buf;
+	struct passwd_user *pu;
+	buffer_t *buf;
 
 	passwd_file_sync();
 
@@ -189,11 +190,11 @@
 	return get_reply_data(pu, reply);
 }
 
-static void passwd_file_add(PasswdFile *pw, const char *username,
+static void 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, realm, mail, chroot */
-	PasswdUser *pu;
+	struct passwd_user *pu;
 	const char *p;
 
 	if (strlen(username) >= AUTH_MAX_USER_LEN) {
@@ -202,7 +203,7 @@
 		return;
 	}
 
-	pu = p_new(pw->pool, PasswdUser, 1);
+	pu = p_new(pw->pool, struct passwd_user, 1);
 
 	p = strchr(pass, '[');
 	if (p == NULL) {
@@ -309,9 +310,9 @@
 	hash_insert(pw->users, pu->user_realm, pu);
 }
 
-static void passwd_file_parse_file(PasswdFile *pw)
+static void passwd_file_parse_file(struct passwd_file *pw)
 {
-	IStream *input;
+	struct istream *input;
 	const char *const *args;
 	const char *line;
 
@@ -338,10 +339,10 @@
 	i_stream_unref(input);
 }
 
-static PasswdFile *passwd_file_parse(const char *path)
+static struct passwd_file *passwd_file_parse(const char *path)
 {
-	PasswdFile *pw;
-	Pool pool;
+	struct passwd_file *pw;
+	pool_t pool;
 	struct stat st;
 	int fd;
 
@@ -353,8 +354,8 @@
 	if (fstat(fd, &st) != 0)
 		i_fatal("fstat() failed for passwd-file %s: %m", path);
 
-	pool = pool_alloconly_create("PasswdFile", 10240);
-	pw = p_new(pool, PasswdFile, 1);
+	pool = pool_alloconly_create("passwd_file", 10240);
+	pw = p_new(pool, struct passwd_file, 1);
 	pw->pool = pool;
 	pw->path = p_strdup(pool, path);
 	pw->stamp = st.st_mtime;
@@ -365,7 +366,7 @@
 	return pw;
 }
 
-static void passwd_file_free(PasswdFile *pw)
+static void passwd_file_free(struct passwd_file *pw)
 {
 	pool_unref(pw->pool);
 }
@@ -395,7 +396,7 @@
 	}
 }
 
-UserInfoModule userinfo_passwd_file = {
+struct user_info_module userinfo_passwd_file = {
 	passwd_file_init,
 	passwd_file_deinit,
 

Index: userinfo-passwd.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userinfo-passwd.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- userinfo-passwd.c	22 Dec 2002 20:17:48 -0000	1.11
+++ userinfo-passwd.c	5 Jan 2003 13:09:51 -0000	1.12
@@ -10,7 +10,8 @@
 
 #include "userinfo-passwd.h"
 
-void passwd_fill_cookie_reply(struct passwd *pw, AuthCookieReplyData *reply)
+void passwd_fill_cookie_reply(struct passwd *pw,
+			      struct auth_cookie_reply_data *reply)
 {
 	reply->uid = pw->pw_uid;
 	reply->gid = pw->pw_gid;
@@ -30,7 +31,7 @@
 #include "mycrypt.h"
 
 static int passwd_verify_plain(const char *user, const char *password,
-			       AuthCookieReplyData *reply)
+			       struct auth_cookie_reply_data *reply)
 {
 	struct passwd *pw;
 	int result;
@@ -58,7 +59,7 @@
 	endpwent();
 }
 
-UserInfoModule userinfo_passwd = {
+struct user_info_module userinfo_passwd = {
 	NULL,
 	passwd_deinit,
 

Index: userinfo-passwd.h
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userinfo-passwd.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- userinfo-passwd.h	18 Dec 2002 10:40:43 -0000	1.5
+++ userinfo-passwd.h	5 Jan 2003 13:09:51 -0000	1.6
@@ -10,6 +10,7 @@
 #define IS_VALID_PASSWD(pass) \
 	((pass)[0] != '\0' && (pass)[0] != '*' && (pass)[0] != '!')
 
-void passwd_fill_cookie_reply(struct passwd *pw, AuthCookieReplyData *reply);
+void passwd_fill_cookie_reply(struct passwd *pw,
+			      struct auth_cookie_reply_data *reply);
 
 #endif

Index: userinfo-shadow.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userinfo-shadow.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- userinfo-shadow.c	18 Dec 2002 15:15:41 -0000	1.8
+++ userinfo-shadow.c	5 Jan 2003 13:09:51 -0000	1.9
@@ -16,7 +16,7 @@
 #include <shadow.h>
 
 static int shadow_verify_plain(const char *user, const char *password,
-			       AuthCookieReplyData *reply)
+			       struct auth_cookie_reply_data *reply)
 {
 	struct passwd *pw;
 	struct spwd *spw;
@@ -50,7 +50,7 @@
         endspent();
 }
 
-UserInfoModule userinfo_shadow = {
+struct user_info_module userinfo_shadow = {
 	NULL,
 	shadow_deinit,
 

Index: userinfo-vpopmail.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userinfo-vpopmail.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- userinfo-vpopmail.c	19 Dec 2002 01:02:34 -0000	1.11
+++ userinfo-vpopmail.c	5 Jan 2003 13:09:51 -0000	1.12
@@ -108,7 +108,7 @@
 	vclose();
 }
 
-UserInfoModule userinfo_vpopmail = {
+struct user_info_module userinfo_vpopmail = {
 	NULL,
 	vpopmail_deinit,
 

Index: userinfo.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userinfo.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- userinfo.c	20 Sep 2002 11:27:18 -0000	1.2
+++ userinfo.c	5 Jan 2003 13:09:51 -0000	1.3
@@ -5,7 +5,7 @@
 
 #include <stdlib.h>
 
-UserInfoModule *userinfo;
+struct user_info_module *userinfo;
 
 void userinfo_init(void)
 {

Index: userinfo.h
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userinfo.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- userinfo.h	20 Sep 2002 11:27:18 -0000	1.3
+++ userinfo.h	5 Jan 2003 13:09:51 -0000	1.4
@@ -3,7 +3,7 @@
 
 #include "auth-interface.h"
 
-typedef struct {
+struct user_info_module {
 	void (*init)(const char *args);
 	void (*deinit)(void);
 
@@ -11,7 +11,7 @@
 	   information. reply should have been initialized (zeroed) before
 	   calling this function. */
 	int (*verify_plain)(const char *user, const char *password,
-			    AuthCookieReplyData *reply);
+			    struct auth_cookie_reply_data *reply);
 
 	/* Digest-MD5 specific password lookup. The digest is filled with
 	   the MD5 password which consists of a MD5 sum of
@@ -19,16 +19,16 @@
 	   in UTF-8, otherwise ISO-8859-1. Returns TRUE if user was found. */
 	int (*lookup_digest_md5)(const char *user, const char *realm,
 				 unsigned char digest[16],
-				 AuthCookieReplyData *reply);
-} UserInfoModule;
+				 struct auth_cookie_reply_data *reply);
+};
 
-extern UserInfoModule *userinfo;
+extern struct user_info_module *userinfo;
 
-extern UserInfoModule userinfo_passwd;
-extern UserInfoModule userinfo_shadow;
-extern UserInfoModule userinfo_pam;
-extern UserInfoModule userinfo_passwd_file;
-extern UserInfoModule userinfo_vpopmail;
+extern struct user_info_module userinfo_passwd;
+extern struct user_info_module userinfo_shadow;
+extern struct user_info_module userinfo_pam;
+extern struct user_info_module userinfo_passwd_file;
+extern struct user_info_module userinfo_vpopmail;
 
 void userinfo_init(void);
 void userinfo_deinit(void);




More information about the dovecot-cvs mailing list