[dovecot-cvs] dovecot/src/auth auth-master-connection.c, 1.42.2.3, 1.42.2.4 auth-master-connection.h, 1.13, 1.13.2.1 auth-request-handler.c, 1.12.2.8, 1.12.2.9 auth.c, 1.31, 1.31.2.1 db-ldap.h, 1.20.2.8, 1.20.2.9 main.c, 1.56.2.1, 1.56.2.2 userdb-ldap.c, 1.40.2.4, 1.40.2.5
tss at dovecot.org
tss at dovecot.org
Fri Jan 19 15:19:33 UTC 2007
- Previous message: [dovecot-cvs] dovecot/src/auth db-ldap.c, 1.60, 1.61 passdb-ldap.c, 1.56, 1.57
- Next message: [dovecot-cvs] dovecot/src/auth auth-master-connection.c, 1.46, 1.47 auth-master-connection.h, 1.13, 1.14 auth-request-handler.c, 1.22, 1.23 auth.c, 1.32, 1.33 db-ldap.h, 1.28, 1.29 main.c, 1.58, 1.59 userdb-ldap.c, 1.44, 1.45
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv27371
Modified Files:
Tag: branch_1_0
auth-master-connection.c auth-master-connection.h
auth-request-handler.c auth.c db-ldap.h main.c userdb-ldap.c
Log Message:
Several fixes to handling deinitialization without crashing.
Index: auth-master-connection.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-master-connection.c,v
retrieving revision 1.42.2.3
retrieving revision 1.42.2.4
diff -u -d -r1.42.2.3 -r1.42.2.4
--- auth-master-connection.c 9 Dec 2006 15:11:33 -0000 1.42.2.3
+++ auth-master-connection.c 19 Jan 2007 15:19:29 -0000 1.42.2.4
@@ -233,6 +233,7 @@
conn = i_new(struct auth_master_connection, 1);
conn->listener = listener;
+ conn->refcount = 1;
conn->fd = fd;
conn->input = i_stream_create_file(fd, default_pool,
MAX_INBUF_SIZE, FALSE);
@@ -271,14 +272,15 @@
conn->destroyed = TRUE;
if (conn->input != NULL)
- i_stream_destroy(&conn->input);
+ i_stream_close(conn->input);
if (conn->output != NULL)
- o_stream_destroy(&conn->output);
+ o_stream_close(conn->output);
if (conn->io != NULL)
io_remove(&conn->io);
if (conn->fd != -1) {
if (close(conn->fd) < 0)
i_error("close(): %m");
+ conn->fd = -1;
}
conns = array_get(&conn->listener->masters, &count);
@@ -290,6 +292,31 @@
}
if (!standalone && auth_master_listeners_masters_left() == 0)
io_loop_stop(ioloop);
-
+
+ auth_master_connection_unref(&conn);
+}
+
+void auth_master_connection_ref(struct auth_master_connection *conn)
+{
+ i_assert(conn->refcount > 0);
+
+ conn->refcount++;
+}
+
+void auth_master_connection_unref(struct auth_master_connection **_conn)
+{
+ struct auth_master_connection *conn = *_conn;
+
+ *_conn = NULL;
+ i_assert(conn->refcount > 0);
+
+ if (--conn->refcount > 0)
+ return;
+
+ if (conn->input != NULL)
+ i_stream_unref(&conn->input);
+ if (conn->output != NULL)
+ o_stream_unref(&conn->output);
+
i_free(conn);
}
Index: auth-master-connection.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-master-connection.h,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -d -r1.13 -r1.13.2.1
--- auth-master-connection.h 14 Jan 2006 18:47:20 -0000 1.13
+++ auth-master-connection.h 19 Jan 2007 15:19:29 -0000 1.13.2.1
@@ -3,6 +3,7 @@
struct auth_master_connection {
struct auth_master_listener *listener;
+ int refcount;
int fd;
struct istream *input;
@@ -17,6 +18,9 @@
auth_master_connection_create(struct auth_master_listener *listener, int fd);
void auth_master_connection_destroy(struct auth_master_connection **conn);
+void auth_master_connection_ref(struct auth_master_connection *conn);
+void auth_master_connection_unref(struct auth_master_connection **conn);
+
void auth_master_connection_send_handshake(struct auth_master_connection *conn);
void auth_master_connections_send_handshake(void);
Index: auth-request-handler.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-request-handler.c,v
retrieving revision 1.12.2.8
retrieving revision 1.12.2.9
diff -u -d -r1.12.2.8 -r1.12.2.9
--- auth-request-handler.c 16 Jan 2007 13:18:21 -0000 1.12.2.8
+++ auth-request-handler.c 19 Jan 2007 15:19:29 -0000 1.12.2.9
@@ -8,6 +8,7 @@
#include "str.h"
#include "str-sanitize.h"
#include "auth-request.h"
+#include "auth-master-connection.h"
#include "auth-request-handler.h"
#include <stdlib.h>
@@ -426,6 +427,7 @@
}
handler->master_callback(str_c(str), request->master);
+ auth_master_connection_unref(&request->master);
auth_request_unref(&request);
auth_request_handler_unref(&handler);
}
@@ -468,7 +470,9 @@
request->context = handler;
request->master = master;
- /* handler is referenced until userdb_callback is called. */
+ /* master and handler are referenced until userdb_callback i
+ s called. */
+ auth_master_connection_ref(master);
handler->refcount++;
auth_request_lookup_user(request, userdb_callback);
}
@@ -504,6 +508,7 @@
void auth_request_handler_deinit(void)
{
+ auth_request_handler_flush_failures();
buffer_free(auth_failures_buf);
timeout_remove(&to_auth_failures);
}
Index: auth.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth.c,v
retrieving revision 1.31
retrieving revision 1.31.2.1
diff -u -d -r1.31 -r1.31.2.1
--- auth.c 12 Apr 2006 14:36:58 -0000 1.31
+++ auth.c 19 Jan 2007 15:19:29 -0000 1.31.2.1
@@ -266,7 +266,6 @@
*_auth = NULL;
- passdb_cache_deinit();
for (passdb = auth->masterdbs; passdb != NULL; passdb = passdb->next)
passdb_deinit(passdb);
for (passdb = auth->passdbs; passdb != NULL; passdb = passdb->next)
@@ -274,5 +273,8 @@
for (userdb = auth->userdbs; userdb != NULL; userdb = userdb->next)
userdb_deinit(userdb);
+ auth_request_handler_deinit();
+ passdb_cache_deinit();
+
pool_unref(auth->pool);
}
Index: db-ldap.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/db-ldap.h,v
retrieving revision 1.20.2.8
retrieving revision 1.20.2.9
diff -u -d -r1.20.2.8 -r1.20.2.9
--- db-ldap.h 7 Nov 2006 16:16:08 -0000 1.20.2.8
+++ db-ldap.h 19 Jan 2007 15:19:29 -0000 1.20.2.9
@@ -66,6 +66,7 @@
unsigned int connected:1;
unsigned int connecting:1;
+ unsigned int binding:1;
unsigned int retrying:1; /* just reconnected, resending requests */
unsigned int last_auth_bind:1;
};
Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/main.c,v
retrieving revision 1.56.2.1
retrieving revision 1.56.2.2
diff -u -d -r1.56.2.1 -r1.56.2.2
--- main.c 10 Aug 2006 18:46:18 -0000 1.56.2.1
+++ main.c 19 Jan 2007 15:19:29 -0000 1.56.2.2
@@ -283,7 +283,6 @@
auth_worker_server_deinit();
auth_master_listeners_deinit();
- auth_request_handler_deinit();
auth_deinit(&auth);
mech_deinit();
Index: userdb-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/userdb-ldap.c,v
retrieving revision 1.40.2.4
retrieving revision 1.40.2.5
diff -u -d -r1.40.2.4 -r1.40.2.5
--- userdb-ldap.c 16 Jan 2007 13:23:26 -0000 1.40.2.4
+++ userdb-ldap.c 19 Jan 2007 15:19:29 -0000 1.40.2.5
@@ -142,12 +142,14 @@
enum userdb_result result = USERDB_RESULT_INTERNAL_FAILURE;
int ret;
- ret = ldap_result2error(conn->ld, res, 0);
- if (ret != LDAP_SUCCESS) {
- auth_request_log_error(auth_request, "ldap",
- "ldap_search() failed: %s", ldap_err2string(ret));
- urequest->userdb_callback(result, NULL, auth_request);
- return;
+ if (res != NULL) {
+ ret = ldap_result2error(conn->ld, res, 0);
+ if (ret != LDAP_SUCCESS) {
+ auth_request_log_error(auth_request, "ldap",
+ "ldap_search() failed: %s", ldap_err2string(ret));
+ urequest->userdb_callback(result, NULL, auth_request);
+ return;
+ }
}
entry = res == NULL ? NULL : ldap_first_entry(conn->ld, res);
- Previous message: [dovecot-cvs] dovecot/src/auth db-ldap.c, 1.60, 1.61 passdb-ldap.c, 1.56, 1.57
- Next message: [dovecot-cvs] dovecot/src/auth auth-master-connection.c, 1.46, 1.47 auth-master-connection.h, 1.13, 1.14 auth-request-handler.c, 1.22, 1.23 auth.c, 1.32, 1.33 db-ldap.h, 1.28, 1.29 main.c, 1.58, 1.59 userdb-ldap.c, 1.44, 1.45
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list