summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-09-22 10:42:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:00 -0500
commit566c38c820a273c8ce25f16c35346a68561d50fa (patch)
tree17669e978d67cd4d56c3c8caf56780ec79525cef /source4/libcli
parent211d3cff2f6d5669af71699c74e6d40c4206249a (diff)
downloadsamba-566c38c820a273c8ce25f16c35346a68561d50fa.tar.gz
samba-566c38c820a273c8ce25f16c35346a68561d50fa.tar.bz2
samba-566c38c820a273c8ce25f16c35346a68561d50fa.zip
r2508: - implemented ldap_decode() for UnbindRequest and ExtendedRequest
- fail when we got a wrong tag in ldap_decode() metze (This used to be commit e942f414c5f9130c7ac9996612caaefd29f5eeca)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/ldap/ldap.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c
index 72e8f605dc..5d233bcdca 100644
--- a/source4/libcli/ldap/ldap.c
+++ b/source4/libcli/ldap/ldap.c
@@ -879,8 +879,10 @@ BOOL ldap_decode(ASN1_DATA *data, struct ldap_message *msg)
break;
}
- case ASN1_APPLICATION(LDAP_TAG_UnbindRequest): {
+ case ASN1_APPLICATION_SIMPLE(LDAP_TAG_UnbindRequest): {
msg->type = LDAP_TAG_UnbindRequest;
+ asn1_start_tag(data, ASN1_APPLICATION_SIMPLE(LDAP_TAG_UnbindRequest));
+ asn1_end_tag(data);
break;
}
@@ -1087,8 +1089,29 @@ BOOL ldap_decode(ASN1_DATA *data, struct ldap_message *msg)
}
case ASN1_APPLICATION(LDAP_TAG_ExtendedRequest): {
-/* struct ldap_ExtendedRequest *r = &msg->r.ExtendedRequest; */
+ struct ldap_ExtendedRequest *r = &msg->r.ExtendedRequest;
+ DATA_BLOB tmp_blob = data_blob(NULL, 0);
+
msg->type = LDAP_TAG_ExtendedRequest;
+ asn1_start_tag(data,ASN1_APPLICATION(LDAP_TAG_ExtendedRequest));
+ if (!asn1_read_ContextSimple(data, 0, &tmp_blob)) {
+ return False;
+ }
+ r->oid = blob2string_talloc(msg->mem_ctx, tmp_blob);
+ data_blob_free(&tmp_blob);
+ if (!r->oid) {
+ return False;
+ }
+
+ if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(1))) {
+ asn1_read_ContextSimple(data, 1, &tmp_blob);
+ r->value = data_blob_talloc(msg->mem_ctx, tmp_blob.data, tmp_blob.length);
+ data_blob_free(&tmp_blob);
+ } else {
+ r->value = data_blob(NULL, 0);
+ }
+
+ asn1_end_tag(data);
break;
}
@@ -1105,7 +1128,8 @@ BOOL ldap_decode(ASN1_DATA *data, struct ldap_message *msg)
r->value.length = 0;
break;
}
-
+ default:
+ return False;
}
asn1_end_tag(data);