svn commit: samba r7566 - in branches/SAMBA_4_0/source/libcli/util: .

tridge at samba.org tridge at samba.org
Tue Jun 14 03:52:28 GMT 2005


Author: tridge
Date: 2005-06-14 03:52:27 +0000 (Tue, 14 Jun 2005)
New Revision: 7566

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7566

Log:
added support for LDAPString types in the asn.1 library


Modified:
   branches/SAMBA_4_0/source/libcli/util/asn1.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/util/asn1.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/util/asn1.c	2005-06-14 03:51:49 UTC (rev 7565)
+++ branches/SAMBA_4_0/source/libcli/util/asn1.c	2005-06-14 03:52:27 UTC (rev 7566)
@@ -214,11 +214,18 @@
 	return !data->has_error;
 }
 
+/* write a LDAP string */
+BOOL asn1_write_LDAPString(struct asn1_data *data, const char *s)
+{
+	asn1_write(data, s, strlen(s));
+	return !data->has_error;
+}
+
 /* write a general string */
 BOOL asn1_write_GeneralString(struct asn1_data *data, const char *s)
 {
 	asn1_push_tag(data, ASN1_GENERAL_STRING);
-	asn1_write(data, s, strlen(s));
+	asn1_write_LDAPString(data, s);
 	asn1_pop_tag(data);
 	return !data->has_error;
 }
@@ -477,11 +484,10 @@
 	return True;
 }
 
-/* read a GeneralString from a ASN1 buffer */
-BOOL asn1_read_GeneralString(struct asn1_data *data, char **s)
+/* read a LDAPString from a ASN1 buffer */
+BOOL asn1_read_LDAPString(struct asn1_data *data, char **s)
 {
 	int len;
-	if (!asn1_start_tag(data, ASN1_GENERAL_STRING)) return False;
 	len = asn1_tag_remaining(data);
 	if (len < 0) {
 		data->has_error = True;
@@ -494,10 +500,19 @@
 	}
 	asn1_read(data, *s, len);
 	(*s)[len] = 0;
-	asn1_end_tag(data);
 	return !data->has_error;
 }
 
+
+/* read a GeneralString from a ASN1 buffer */
+BOOL asn1_read_GeneralString(struct asn1_data *data, char **s)
+{
+	if (!asn1_start_tag(data, ASN1_GENERAL_STRING)) return False;
+	if (!asn1_read_LDAPString(data, s)) return False;
+	return asn1_end_tag(data);
+}
+
+
 /* read a octet string blob */
 BOOL asn1_read_OctetString(struct asn1_data *data, DATA_BLOB *blob)
 {



More information about the samba-cvs mailing list