Move asn1_blob() to lib/util/asn1.c
authorVolker Lendecke <vl@samba.org>
Fri, 19 Jun 2009 15:39:13 +0000 (17:39 +0200)
committerVolker Lendecke <vl@samba.org>
Sat, 20 Jun 2009 16:54:07 +0000 (18:54 +0200)
lib/util/asn1.c
lib/util/asn1.h
source3/lib/tldap.c

index aadaf8643a04d31376ca5f7013fedca881fdb23e..08c4060fd1078a9156cd6d609cbc20e4ca57126f 100644 (file)
@@ -763,6 +763,22 @@ bool asn1_write_enumerated(struct asn1_data *data, uint8_t v)
        return !data->has_error;
 }
 
+/*
+  Get us the data just written without copying
+*/
+bool asn1_blob(const struct asn1_data *asn1, DATA_BLOB *blob)
+{
+       if (asn1->has_error) {
+               return false;
+       }
+       if (asn1->nesting != NULL) {
+               return false;
+       }
+       blob->data = asn1->data;
+       blob->length = asn1->length;
+       return true;
+}
+
 /*
   check if a ASN.1 blob is a full tag
 */
index 0f41ae33e57a5dcaf3441e36c1126eab890d9d39..b46494b2ea663aeff841c587dab7791690ae1e5c 100644 (file)
@@ -93,6 +93,7 @@ bool asn1_read_Integer(struct asn1_data *data, int *i);
 bool asn1_read_enumerated(struct asn1_data *data, int *v);
 bool asn1_check_enumerated(struct asn1_data *data, int v);
 bool asn1_write_enumerated(struct asn1_data *data, uint8_t v);
+bool asn1_blob(const struct asn1_data *asn1, DATA_BLOB *blob);
 NTSTATUS asn1_full_tag(DATA_BLOB blob, uint8_t tag, size_t *packet_size);
 
 #endif /* _ASN_1_H */
index 7a36310ee409d69d6e5337c34c863d9179ba259a..4d2cd86f750cb1fe6c98f09e5b3804f2f7551f37 100644 (file)
@@ -318,19 +318,6 @@ static ssize_t read_ldap_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
        return talloc_get_size(*pbuf);
 }
 
-static bool asn1_blob(const struct asn1_data *asn1, DATA_BLOB *blob)
-{
-       if (asn1->has_error) {
-               return false;
-       }
-       if (asn1->nesting != NULL) {
-               return false;
-       }
-       blob->data = asn1->data;
-       blob->length = asn1->length;
-       return true;
-}
-
 static void asn1_load_nocopy(struct asn1_data *data, uint8_t *buf, size_t len)
 {
        ZERO_STRUCTP(data);