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
*/
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);
}
/*
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) {