diff options
author | Simo Sorce <idra@samba.org> | 2006-01-13 22:48:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:51:02 -0500 |
commit | eed0a95128714b93b9ff484780e5d74fc301be6d (patch) | |
tree | 5b31b495ac32ed7a3933d8d3689b50890dcf7f3e | |
parent | c582cb23f784546dd47cd0847f1a6d7269bd9bd6 (diff) | |
download | samba-eed0a95128714b93b9ff484780e5d74fc301be6d.tar.gz samba-eed0a95128714b93b9ff484780e5d74fc301be6d.tar.bz2 samba-eed0a95128714b93b9ff484780e5d74fc301be6d.zip |
r12917: fix decoding of ldap controls
some more work on timeouts
(This used to be commit a7e2fe3cb33be2effff7eb764047567f2da3cd55)
-rw-r--r-- | source4/ldap_server/ldap_server.c | 25 | ||||
-rw-r--r-- | source4/ldap_server/ldap_server.h | 1 | ||||
-rw-r--r-- | source4/libcli/ldap/ldap.c | 2 |
3 files changed, 26 insertions, 2 deletions
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c index 4272cea678..a9a4b06645 100644 --- a/source4/ldap_server/ldap_server.c +++ b/source4/ldap_server/ldap_server.c @@ -224,6 +224,19 @@ static NTSTATUS ldapsrv_decode(void *private, DATA_BLOB blob) } /* + Idle timeout handler +*/ +static void ldapsrv_conn_idle_timeout(struct event_context *ev, + struct timed_event *te, + struct timeval t, + void *private) +{ + struct ldapsrv_connection *conn = talloc_get_type(private, struct ldapsrv_connection); + + ldapsrv_terminate_connection(conn, "Timeout. No requests after bind"); +} + +/* called when a LDAP socket becomes readable */ static void ldapsrv_recv(struct stream_connection *c, uint16_t flags) @@ -231,12 +244,22 @@ static void ldapsrv_recv(struct stream_connection *c, uint16_t flags) struct ldapsrv_connection *conn = talloc_get_type(c->private, struct ldapsrv_connection); - if (conn->limits.ite) { + if (conn->limits.ite) { /* clean initial timeout if any */ talloc_free(conn->limits.ite); conn->limits.ite = NULL; } + if (conn->limits.te) { /* clean idle timeout if any */ + talloc_free(conn->limits.te); + conn->limits.te = NULL; + } + packet_recv(conn->packet); + + /* set idle timeout */ + conn->limits.te = event_add_timed(c->event.ctx, conn, + timeval_current_ofs(conn->limits.conn_idle_time, 0), + ldapsrv_conn_idle_timeout, conn); } /* diff --git a/source4/ldap_server/ldap_server.h b/source4/ldap_server/ldap_server.h index 1341b22948..f71c703088 100644 --- a/source4/ldap_server/ldap_server.h +++ b/source4/ldap_server/ldap_server.h @@ -42,6 +42,7 @@ struct ldapsrv_connection { int search_timeout; struct timed_event *ite; + struct timed_event *te; } limits; }; diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c index d021fc3bd6..b281f62ed0 100644 --- a/source4/libcli/ldap/ldap.c +++ b/source4/libcli/ldap/ldap.c @@ -1264,7 +1264,7 @@ BOOL ldap_decode(struct asn1_data *data, struct ldap_message *msg) asn1_start_tag(data, ASN1_CONTEXT(0)); for (i=0; asn1_peek_tag(data, ASN1_SEQUENCE(0)); i++) { - asn1_start_tag(data, ASN1_SEQUENCE(0)); + /* asn1_start_tag(data, ASN1_SEQUENCE(0)); */ ctrl = talloc_realloc(msg, ctrl, struct ldap_Control *, i+2); if (!ctrl) { |