s4:ldap_server: make sure we only have one tstream_read_pdu_blob_send() on a connection
authorStefan Metzmacher <metze@samba.org>
Thu, 23 Jul 2015 10:06:11 +0000 (12:06 +0200)
committerGarming Sam <garming@samba.org>
Wed, 17 Feb 2016 02:43:23 +0000 (03:43 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/ldap_server/ldap_server.c
source4/ldap_server/ldap_server.h

index 3afbcdbf2012bfe5e7f88a404eb67a16534437f5..02c3c952920bc94a0051d52e5007bc83b1c7c23b 100644 (file)
@@ -65,6 +65,7 @@ static void ldapsrv_terminate_connection(struct ldapsrv_connection *conn,
        conn->limits.endtime = timeval_current_ofs(0, 500);
 
        tevent_queue_stop(conn->sockets.send_queue);
+       TALLOC_FREE(conn->sockets.read_req);
        if (conn->active_call) {
                tevent_req_cancel(conn->active_call);
                conn->active_call = NULL;
@@ -412,6 +413,10 @@ static bool ldapsrv_call_read_next(struct ldapsrv_connection *conn)
                        timeval_current_ofs(conn->limits.conn_idle_time, 0);
        }
 
+       if (conn->sockets.read_req != NULL) {
+               return true;
+       }
+
        /*
         * The minimun size of a LDAP pdu is 7 bytes
         *
@@ -455,6 +460,7 @@ static bool ldapsrv_call_read_next(struct ldapsrv_connection *conn)
                               conn->connection->event.ctx,
                               conn->limits.endtime);
        tevent_req_set_callback(subreq, ldapsrv_call_read_done, conn);
+       conn->sockets.read_req = subreq;
        return true;
 }
 
@@ -470,6 +476,8 @@ static void ldapsrv_call_read_done(struct tevent_req *subreq)
        struct asn1_data *asn1;
        DATA_BLOB blob;
 
+       conn->sockets.read_req = NULL;
+
        call = talloc_zero(conn, struct ldapsrv_call);
        if (!call) {
                ldapsrv_terminate_connection(conn, "no memory");
index 6f8b433a1cdabbbcef74b9538f452fe65b17796a..bfd95c05c1832f09232f55321ecc907f26203735 100644 (file)
@@ -34,6 +34,7 @@ struct ldapsrv_connection {
 
        struct {
                struct tevent_queue *send_queue;
+               struct tevent_req *read_req;
                struct tstream_context *raw;
                struct tstream_context *tls;
                struct tstream_context *sasl;