From a0ab1f7afda62964d480af9dc26e60a38d1350e0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 30 Jan 2005 07:22:16 +0000 Subject: r5107: moved the horrible ldap socket code, and the even worse asn1-tied-to-blocking-sockets code into the ldap client and torture suite, and out of the generic libs, so nobody else is tempted to use it for any new code. (This used to be commit 39d1ced21baeca40d1fca62ba65243ca8f15757e) --- source4/libcli/util/asn1.c | 61 ---------------------------------------------- 1 file changed, 61 deletions(-) (limited to 'source4/libcli/util/asn1.c') diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c index 550450fea7..1124cc1701 100644 --- a/source4/libcli/util/asn1.c +++ b/source4/libcli/util/asn1.c @@ -379,67 +379,6 @@ BOOL asn1_start_tag(struct asn1_data *data, uint8_t tag) return !data->has_error; } -static BOOL read_one_uint8(int sock, uint8_t *result, struct asn1_data *data, - const struct timeval *endtime) -{ - if (read_data_until(sock, result, 1, endtime) != 1) - return False; - - return asn1_write(data, result, 1); -} - -/* Read a complete ASN sequence (ie LDAP result) from a socket */ -BOOL asn1_read_sequence_until(int sock, struct asn1_data *data, - const struct timeval *endtime) -{ - uint8_t b; - size_t len; - char *buf; - - ZERO_STRUCTP(data); - - if (!read_one_uint8(sock, &b, data, endtime)) - return False; - - if (b != 0x30) { - data->has_error = True; - return False; - } - - if (!read_one_uint8(sock, &b, data, endtime)) - return False; - - if (b & 0x80) { - int n = b & 0x7f; - if (!read_one_uint8(sock, &b, data, endtime)) - return False; - len = b; - while (n > 1) { - if (!read_one_uint8(sock, &b, data, endtime)) - return False; - len = (len<<8) | b; - n--; - } - } else { - len = b; - } - - buf = talloc_size(NULL, len); - if (buf == NULL) - return False; - - if (read_data_until(sock, buf, len, endtime) != len) - return False; - - if (!asn1_write(data, buf, len)) - return False; - - talloc_free(buf); - - data->ofs = 0; - - return True; -} /* Get the length to be expected in buf */ BOOL asn1_object_length(uint8_t *buf, size_t buf_length, -- cgit