[dovecot-cvs] dovecot/src/auth auth-client-connection.c, 1.31, 1.32 auth-request.c, 1.5, 1.6 auth-request.h, 1.5, 1.6 mech-anonymous.c, 1.11, 1.12 mech-apop.c, 1.12, 1.13 mech-cram-md5.c, 1.19, 1.20 mech-digest-md5.c, 1.33, 1.34 mech-login.c, 1.10, 1.11 mech-ntlm.c, 1.16, 1.17 mech-plain.c, 1.28, 1.29 mech-rpa.c, 1.15, 1.16 mech.h, 1.33, 1.34

cras at dovecot.org cras at dovecot.org
Sat Jan 8 23:37:35 EET 2005


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv24249

Modified Files:
	auth-client-connection.c auth-request.c auth-request.h 
	mech-anonymous.c mech-apop.c mech-cram-md5.c mech-digest-md5.c 
	mech-login.c mech-ntlm.c mech-plain.c mech-rpa.c mech.h 
Log Message:
Another try with API cleanup.



Index: auth-client-connection.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-client-connection.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- auth-client-connection.c	8 Jan 2005 21:22:52 -0000	1.31
+++ auth-client-connection.c	8 Jan 2005 21:37:32 -0000	1.32
@@ -226,14 +226,7 @@
 		return FALSE;
 	}
 
-	request = mech->auth_new(auth_callback);
-	if (request == NULL)
-		return TRUE;
-
-	request->auth = conn->auth;
-	request->mech = mech;
-	request->created = ioloop_time;
-
+	request = auth_request_new(conn->auth, mech, auth_callback);
 	hash_insert(conn->auth_requests, POINTER_CAST(id), request);
 
 	request->conn = conn;

Index: auth-request.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-request.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- auth-request.c	8 Jan 2005 21:22:52 -0000	1.5
+++ auth-request.c	8 Jan 2005 21:37:32 -0000	1.6
@@ -23,6 +23,22 @@
 static buffer_t *auth_failures_buf;
 static struct timeout *to_auth_failures;
 
+struct auth_request *
+auth_request_new(struct auth *auth, struct mech_module *mech,
+		 mech_callback_t *callback)
+{
+	struct auth_request *request;
+
+	request = mech->auth_new();
+
+	request->refcount = 1;
+	request->auth = auth;
+	request->mech = mech;
+	request->callback = callback;
+	request->created = ioloop_time;
+	return request;
+}
+
 void auth_request_destroy(struct auth_request *request)
 {
 	i_assert(request->refcount > 0);

Index: auth-request.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-request.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- auth-request.h	8 Jan 2005 21:22:52 -0000	1.5
+++ auth-request.h	8 Jan 2005 21:37:32 -0000	1.6
@@ -41,8 +41,9 @@
 void auth_request_fail(struct auth_request *request);
 void auth_request_internal_failure(struct auth_request *request);
 
-struct auth_request *auth_request_new(struct auth *auth,
-				      struct mech_module *mech);
+struct auth_request *
+auth_request_new(struct auth *auth, struct mech_module *mech,
+		 mech_callback_t *callback);
 void auth_request_destroy(struct auth_request *request);
 void auth_request_ref(struct auth_request *request);
 int auth_request_unref(struct auth_request *request);

Index: mech-anonymous.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-anonymous.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mech-anonymous.c	8 Jan 2005 21:22:52 -0000	1.11
+++ mech-anonymous.c	8 Jan 2005 21:37:32 -0000	1.12
@@ -41,16 +41,14 @@
 	pool_unref(request->pool);
 }
 
-static struct auth_request *mech_anonymous_auth_new(mech_callback_t *callback)
+static struct auth_request *mech_anonymous_auth_new(void)
 {
         struct auth_request *request;
 	pool_t pool;
 
 	pool = pool_alloconly_create("anonymous_auth_request", 256);
 	request = p_new(pool, struct auth_request, 1);
-	request->refcount = 1;
 	request->pool = pool;
-	request->callback = callback;
 	return request;
 }
 

Index: mech-apop.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-apop.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- mech-apop.c	8 Jan 2005 21:22:52 -0000	1.12
+++ mech-apop.c	8 Jan 2005 21:37:32 -0000	1.13
@@ -138,7 +138,7 @@
 	pool_unref(request->pool);
 }
 
-static struct auth_request *mech_apop_auth_new(mech_callback_t *callback)
+static struct auth_request *mech_apop_auth_new(void)
 {
 	struct apop_auth_request *request;
 	pool_t pool;
@@ -147,9 +147,7 @@
 	request = p_new(pool, struct apop_auth_request, 1);
 	request->pool = pool;
 
-	request->auth_request.refcount = 1;
 	request->auth_request.pool = pool;
-	request->auth_request.callback = callback;
 	return &request->auth_request;
 }
 

Index: mech-cram-md5.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-cram-md5.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mech-cram-md5.c	8 Jan 2005 21:22:52 -0000	1.19
+++ mech-cram-md5.c	8 Jan 2005 21:37:32 -0000	1.20
@@ -173,7 +173,7 @@
 	pool_unref(request->pool);
 }
 
-static struct auth_request *mech_cram_md5_auth_new(mech_callback_t *callback)
+static struct auth_request *mech_cram_md5_auth_new(void)
 {
 	struct cram_auth_request *request;
 	pool_t pool;
@@ -182,9 +182,7 @@
 	request = p_new(pool, struct cram_auth_request, 1);
 	request->pool = pool;
 
-	request->auth_request.refcount = 1;
 	request->auth_request.pool = pool;
-	request->auth_request.callback = callback;
 	return &request->auth_request;
 }
 

Index: mech-digest-md5.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-digest-md5.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- mech-digest-md5.c	8 Jan 2005 21:22:52 -0000	1.33
+++ mech-digest-md5.c	8 Jan 2005 21:37:32 -0000	1.34
@@ -599,8 +599,7 @@
 	pool_unref(request->pool);
 }
 
-static struct auth_request *
-mech_digest_md5_auth_new(mech_callback_t *callback)
+static struct auth_request *mech_digest_md5_auth_new(void)
 {
 	struct digest_auth_request *request;
 	pool_t pool;
@@ -610,9 +609,7 @@
 	request->pool = pool;
 	request->qop = QOP_AUTH;
 
-	request->auth_request.refcount = 1;
 	request->auth_request.pool = pool;
-	request->auth_request.callback = callback;
 	return &request->auth_request;
 }
 

Index: mech-login.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-login.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mech-login.c	8 Jan 2005 21:22:52 -0000	1.10
+++ mech-login.c	8 Jan 2005 21:37:32 -0000	1.11
@@ -71,16 +71,14 @@
 	pool_unref(request->pool);
 }
 
-static struct auth_request *mech_login_auth_new(mech_callback_t *callback)
+static struct auth_request *mech_login_auth_new(void)
 {
 	struct auth_request *request;
 	pool_t pool;
 
 	pool = pool_alloconly_create("login_auth_request", 256);
 	request = p_new(pool, struct auth_request, 1);
-	request->refcount = 1;
 	request->pool = pool;
-	request->callback = callback;
 	return request;
 }
 

Index: mech-ntlm.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-ntlm.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- mech-ntlm.c	8 Jan 2005 21:22:52 -0000	1.16
+++ mech-ntlm.c	8 Jan 2005 21:37:32 -0000	1.17
@@ -260,7 +260,7 @@
 	pool_unref(request->pool);
 }
 
-static struct auth_request *mech_ntlm_auth_new(mech_callback_t *callback)
+static struct auth_request *mech_ntlm_auth_new(void)
 {
 	struct ntlm_auth_request *request;
 	pool_t pool;
@@ -269,9 +269,7 @@
 	request = p_new(pool, struct ntlm_auth_request, 1);
 	request->pool = pool;
 
-	request->auth_request.refcount = 1;
 	request->auth_request.pool = pool;
-	request->auth_request.callback = callback;
 	return &request->auth_request;
 }
 

Index: mech-plain.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-plain.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- mech-plain.c	8 Jan 2005 21:22:52 -0000	1.28
+++ mech-plain.c	8 Jan 2005 21:37:32 -0000	1.29
@@ -86,16 +86,14 @@
 	pool_unref(request->pool);
 }
 
-static struct auth_request *mech_plain_auth_new(mech_callback_t *callback)
+static struct auth_request *mech_plain_auth_new(void)
 {
         struct auth_request *request;
 	pool_t pool;
 
 	pool = pool_alloconly_create("plain_auth_request", 256);
 	request = p_new(pool, struct auth_request, 1);
-	request->refcount = 1;
 	request->pool = pool;
-        request->callback = callback;
 	return request;
 }
 

Index: mech-rpa.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech-rpa.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- mech-rpa.c	8 Jan 2005 21:22:52 -0000	1.15
+++ mech-rpa.c	8 Jan 2005 21:37:32 -0000	1.16
@@ -549,7 +549,7 @@
 	pool_unref(auth_request->pool);
 }
 
-static struct auth_request *mech_rpa_auth_new(mech_callback_t *callback)
+static struct auth_request *mech_rpa_auth_new(void)
 {
 	struct rpa_auth_request *request;
 	pool_t pool;
@@ -559,9 +559,7 @@
 	request->pool = pool;
 	request->phase = 0;
 
-	request->auth_request.refcount = 1;
 	request->auth_request.pool = pool;
-	request->auth_request.callback = callback;
 	return &request->auth_request;
 }
 

Index: mech.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- mech.h	8 Jan 2005 21:22:52 -0000	1.33
+++ mech.h	8 Jan 2005 21:37:32 -0000	1.34
@@ -24,7 +24,7 @@
 	unsigned int passdb_need_plain:1;
 	unsigned int passdb_need_credentials:1;
 
-	struct auth_request *(*auth_new)(mech_callback_t *callback);
+	struct auth_request *(*auth_new)(void);
 	void (*auth_initial)(struct auth_request *request,
 			     const unsigned char *data, size_t data_size);
 	void (*auth_continue)(struct auth_request *request,



More information about the dovecot-cvs mailing list