1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-12 04:23:49 +03:00

r12917: fix decoding of ldap controls

some more work on timeouts
This commit is contained in:
Simo Sorce
2006-01-13 22:48:08 +00:00
committed by Gerald (Jerry) Carter
parent e70ca698ce
commit a7e2fe3cb3
3 changed files with 26 additions and 2 deletions

View File

@@ -223,6 +223,19 @@ static NTSTATUS ldapsrv_decode(void *private, DATA_BLOB blob)
return ldapsrv_decode_plain(conn, 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
*/
@@ -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);
}
/*