]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Borrow liblber code to get abandon processing to work
authorOndřej Kuzník <ondra@mistotebe.net>
Tue, 13 Jun 2017 18:44:03 +0000 (19:44 +0100)
committerOndřej Kuzník <okuznik@symas.com>
Tue, 17 Nov 2020 17:55:46 +0000 (17:55 +0000)
servers/lloadd/operation.c

index 609ed27ddff1e6ab5f16e624a36e725e39e18de4..939c623b252022d9798e181ccd137ed08b93bbe7 100644 (file)
@@ -539,14 +539,23 @@ int
 request_abandon( Connection *c, Operation *op )
 {
     Operation *request, needle = { .o_client_connid = c->c_connid };
-    ber_tag_t tag;
     int rc = LDAP_SUCCESS;
 
-    tag = ber_get_int( op->o_ber, &needle.o_client_msgid );
-    if ( tag != LDAP_REQ_ABANDON ) {
-        /* How would that happen if we already got the tag for the op? */
-        assert(0);
-        goto done;
+    /* parse two's complement integer */
+    if ( !BER_BVISEMPTY( &op->o_request ) ) {
+        unsigned char *buf = (unsigned char *)op->o_request.bv_val;
+        ber_len_t i;
+        ber_int_t netnum = buf[0] & 0xff;
+
+        /* sign extend */
+        netnum = ( netnum ^ 0x80 ) - 0x80;
+
+        /* shift in the bytes */
+        for ( i = 1; i < op->o_request.bv_len; i++ ) {
+            netnum = ( netnum << 8 ) | buf[i];
+        }
+
+        needle.o_client_msgid = netnum;
     }
 
     request = tavl_find( c->c_ops, &needle, operation_client_cmp );