summaryrefslogtreecommitdiff
path: root/source4/libcli/util
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-11-10 00:28:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:45:59 -0500
commit65baaafc34b2befac50541c5aef86e5d906d2797 (patch)
tree14196ae03ef9ba1be8e9d35ec3f067ead5e5b2e6 /source4/libcli/util
parent5d5b462bbb672c1897d24717af42cdd49ee49519 (diff)
downloadsamba-65baaafc34b2befac50541c5aef86e5d906d2797.tar.gz
samba-65baaafc34b2befac50541c5aef86e5d906d2797.tar.bz2
samba-65baaafc34b2befac50541c5aef86e5d906d2797.zip
r11620: switch the ldap client code over to using the generic packet code
(This used to be commit 1d29ad2a27d89454e5e3c4a3cf05cc5edde0208c)
Diffstat (limited to 'source4/libcli/util')
-rw-r--r--source4/libcli/util/asn1.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c
index 6ca2221b1a..0dceb1bba6 100644
--- a/source4/libcli/util/asn1.c
+++ b/source4/libcli/util/asn1.c
@@ -607,3 +607,30 @@ BOOL asn1_write_enumerated(struct asn1_data *data, uint8_t v)
asn1_pop_tag(data);
return !data->has_error;
}
+
+/*
+ check if a ASN.1 blob is a full tag
+*/
+NTSTATUS asn1_full_tag(DATA_BLOB blob, uint8_t tag, size_t *packet_size)
+{
+ struct asn1_data asn1;
+ int size;
+
+ ZERO_STRUCT(asn1);
+ asn1.data = blob.data;
+ asn1.length = blob.length;
+ asn1_start_tag(&asn1, tag);
+ if (asn1.has_error) {
+ talloc_free(asn1.nesting);
+ return STATUS_MORE_ENTRIES;
+ }
+ size = asn1_tag_remaining(&asn1) + asn1.ofs;
+ talloc_free(asn1.nesting);
+
+ if (size > blob.length) {
+ return STATUS_MORE_ENTRIES;
+ }
+
+ *packet_size = size;
+ return NT_STATUS_OK;
+}