svn commit: samba r2337 - in trunk/source: lib libsmb utils

vlendec at samba.org vlendec at samba.org
Tue Sep 14 12:40:57 GMT 2004


Author: vlendec
Date: 2004-09-14 12:40:57 +0000 (Tue, 14 Sep 2004)
New Revision: 2337

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/trunk/source&rev=2337&nolog=1

Log:
Some more ldap stuff. Metze, this needs merging to 4.

Volker

Modified:
   trunk/source/lib/smb_ldap.c
   trunk/source/libsmb/asn1.c
   trunk/source/utils/net_ads.c


Changeset:
Modified: trunk/source/lib/smb_ldap.c
===================================================================
--- trunk/source/lib/smb_ldap.c	2004-09-14 12:19:59 UTC (rev 2336)
+++ trunk/source/lib/smb_ldap.c	2004-09-14 12:40:57 UTC (rev 2337)
@@ -998,7 +998,7 @@
 		struct ldap_AbandonRequest *r = &msg->r.AbandonRequest;
 		asn1_push_tag(&data,
 			      ASN1_APPLICATION_SIMPLE(LDAP_TAG_AbandonRequest));
-		asn1_write_Integer(&data, r->messageid);
+		asn1_write_implicit_Integer(&data, r->messageid);
 		asn1_pop_tag(&data);
 		break;
 	}

Modified: trunk/source/libsmb/asn1.c
===================================================================
--- trunk/source/libsmb/asn1.c	2004-09-14 12:19:59 UTC (rev 2336)
+++ trunk/source/libsmb/asn1.c	2004-09-14 12:40:57 UTC (rev 2337)
@@ -110,13 +110,14 @@
 /* "i" is the one's complement representation, as is the normal result of an
  * implicit signed->unsigned conversion */
 
-static void push_int_bigendian(ASN1_DATA *data, unsigned int i, BOOL negative)
+static BOOL push_int_bigendian(ASN1_DATA *data, unsigned int i, BOOL negative)
 {
 	uint8 lowest = i & 0xFF;
 
 	i = i >> 8;
 	if (i != 0)
-		push_int_bigendian(data, i, negative);
+		if (!push_int_bigendian(data, i, negative))
+			return False;
 
 	if (data->nesting->start+1 == data->ofs) {
 
@@ -126,40 +127,51 @@
 		if (negative) {
 			/* Don't write leading 0xff's */
 			if (lowest == 0xFF)
-				return;
+				return True;
 
 			if ((lowest & 0x80) == 0) {
 				/* The only exception for a leading 0xff is if
 				 * the highest bit is 0, which would indicate
 				 * a positive value */
-				asn1_write_uint8(data, 0xff);
+				if (!asn1_write_uint8(data, 0xff))
+					return False;
 			}
 		} else {
 			if (lowest & 0x80) {
 				/* The highest bit of a positive integer is 1,
 				 * this would indicate a negative number. Push
 				 * a 0 to indicate a positive one */
-				asn1_write_uint8(data, 0);
+				if (!asn1_write_uint8(data, 0))
+					return False;
 			}
 		}
 	}
 
-	asn1_write_uint8(data, lowest);
+	return asn1_write_uint8(data, lowest);
 }
 
-/* write an integer */
-BOOL asn1_write_Integer(ASN1_DATA *data, int i)
+/* write an Integer without the tag framing. Needed for example for the LDAP
+ * Abandon Operation */
+
+BOOL asn1_write_implicit_Integer(ASN1_DATA *data, int i)
 {
-	if (!asn1_push_tag(data, ASN1_INTEGER)) return False;
 	if (i == -1) {
 		/* -1 is special as it consists of all-0xff bytes. In
                     push_int_bigendian this is the only case that is not
                     properly handled, as all 0xff bytes would be handled as
                     leading ones to be ignored. */
-		asn1_write_uint8(data, 0xff);
+		return asn1_write_uint8(data, 0xff);
 	} else {
-		push_int_bigendian(data, i, i<0);
+		return push_int_bigendian(data, i, i<0);
 	}
+}
+
+
+/* write an integer */
+BOOL asn1_write_Integer(ASN1_DATA *data, int i)
+{
+	if (!asn1_push_tag(data, ASN1_INTEGER)) return False;
+	if (!asn1_write_implicit_Integer(data, i)) return False;
 	return asn1_pop_tag(data);
 }
 

Modified: trunk/source/utils/net_ads.c
===================================================================
--- trunk/source/utils/net_ads.c	2004-09-14 12:19:59 UTC (rev 2336)
+++ trunk/source/utils/net_ads.c	2004-09-14 12:40:57 UTC (rev 2337)
@@ -1423,7 +1423,7 @@
 #endif
 
 	msg->type = LDAP_TAG_AbandonRequest;
-	msg->messageid = 12345;
+	msg->r.AbandonRequest.messageid = 5000;
 
 	if (!ldap_send_msg(conn, msg, NULL)) {
 		d_printf("Could not send abandon msg\n");



More information about the samba-cvs mailing list