summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2004-09-01 14:49:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:29 -0500
commit3e454a5891b73c9b021406bdb662127e1a3180dc (patch)
tree5034912de533454ce95534f1d95ad63250e7c7ae /source4/libcli
parent4a17f26292a92c07af99ab1a160f81d853c704d2 (diff)
downloadsamba-3e454a5891b73c9b021406bdb662127e1a3180dc.tar.gz
samba-3e454a5891b73c9b021406bdb662127e1a3180dc.tar.bz2
samba-3e454a5891b73c9b021406bdb662127e1a3180dc.zip
r2173: Fix asn1 BOOLEANs. Thanks to Love Hornquist-Astrand.
Volker (This used to be commit 53f58c053b643c8b45d2f9394faf8cfdd5005f6d)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/ldap/ldap.c8
-rw-r--r--source4/libcli/util/asn1.c13
2 files changed, 6 insertions, 15 deletions
diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c
index 7e60e48293..b7ae58f7f5 100644
--- a/source4/libcli/ldap/ldap.c
+++ b/source4/libcli/ldap/ldap.c
@@ -426,7 +426,7 @@ BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result)
asn1_write_enumerated(&data, r->deref);
asn1_write_Integer(&data, r->sizelimit);
asn1_write_Integer(&data, r->timelimit);
- asn1_write_BOOLEAN2(&data, r->attributesonly);
+ asn1_write_BOOLEAN(&data, r->attributesonly);
{
TALLOC_CTX *mem_ctx = talloc_init("ldap_parse_tree");
@@ -565,7 +565,7 @@ BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result)
ASN1_APPLICATION(LDAP_TAG_ModifyDNRequest));
asn1_write_OctetString(&data, r->dn, strlen(r->dn));
asn1_write_OctetString(&data, r->newrdn, strlen(r->newrdn));
- asn1_write_BOOLEAN2(&data, r->deleteolddn);
+ asn1_write_BOOLEAN(&data, r->deleteolddn);
if (r->newsuperior != NULL) {
asn1_push_tag(&data, ASN1_CONTEXT_SIMPLE(0));
asn1_write(&data, r->newsuperior,
@@ -893,7 +893,7 @@ BOOL ldap_decode(ASN1_DATA *data, struct ldap_message *msg)
asn1_read_enumerated(data, (int *)&(r->deref));
asn1_read_Integer(data, &r->sizelimit);
asn1_read_Integer(data, &r->timelimit);
- asn1_read_BOOLEAN2(data, &r->attributesonly);
+ asn1_read_BOOLEAN(data, &r->attributesonly);
/* Maybe create a TALLOC_CTX for the filter? This can waste
* quite a bit of memory recursing down. */
@@ -1039,7 +1039,7 @@ BOOL ldap_decode(ASN1_DATA *data, struct ldap_message *msg)
ASN1_APPLICATION(LDAP_TAG_ModifyDNRequest));
asn1_read_OctetString_talloc(msg->mem_ctx, data, &r->dn);
asn1_read_OctetString_talloc(msg->mem_ctx, data, &r->newrdn);
- asn1_read_BOOLEAN2(data, &r->deleteolddn);
+ asn1_read_BOOLEAN(data, &r->deleteolddn);
r->newsuperior = NULL;
if (asn1_tag_remaining(data) > 0) {
int len;
diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c
index 7e313bcd4a..b5db9b157e 100644
--- a/source4/libcli/util/asn1.c
+++ b/source4/libcli/util/asn1.c
@@ -221,22 +221,13 @@ BOOL asn1_write_ContextSimple(ASN1_DATA *data, uint8_t num, DATA_BLOB *blob)
/* write a BOOLEAN */
BOOL asn1_write_BOOLEAN(ASN1_DATA *data, BOOL v)
{
- asn1_write_uint8(data, ASN1_BOOLEAN);
- asn1_write_uint8(data, v);
- return !data->has_error;
-}
-
-/* write a BOOLEAN - hmm, I suspect this one is the correct one, and the
- above boolean is bogus. Need to check */
-BOOL asn1_write_BOOLEAN2(ASN1_DATA *data, BOOL v)
-{
asn1_push_tag(data, ASN1_BOOLEAN);
- asn1_write_uint8(data, v);
+ asn1_write_uint8(data, v ? 0xFF : 0);
asn1_pop_tag(data);
return !data->has_error;
}
-BOOL asn1_read_BOOLEAN2(ASN1_DATA *data, BOOL *v)
+BOOL asn1_read_BOOLEAN(ASN1_DATA *data, BOOL *v)
{
asn1_start_tag(data, ASN1_BOOLEAN);
asn1_read_uint8(data, (uint8 *)v);