summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2016-01-02 18:11:00 +0100
committerJeremy Allison <jra@samba.org>2016-01-06 00:54:18 +0100
commit57a0bc9a9f3a02f809153dc19537110c4c796338 (patch)
treed27daaadb9bd80d575d6355c783ad1ed1ebb06db /libcli
parentfa207fe9d17d27060e5e2989c19980103fd4778d (diff)
downloadsamba-57a0bc9a9f3a02f809153dc19537110c4c796338.tar.gz
lib: Use asn1_has_error()
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'libcli')
-rw-r--r--libcli/auth/spnego_parse.c20
-rw-r--r--libcli/ldap/ldap_message.c18
2 files changed, 21 insertions, 17 deletions
diff --git a/libcli/auth/spnego_parse.c b/libcli/auth/spnego_parse.c
index d4c5bdcfa5c..ba67273db30 100644
--- a/libcli/auth/spnego_parse.c
+++ b/libcli/auth/spnego_parse.c
@@ -32,7 +32,7 @@ static bool read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
if (!asn1_start_tag(asn1, ASN1_CONTEXT(0))) return false;
if (!asn1_start_tag(asn1, ASN1_SEQUENCE(0))) return false;
- while (!asn1->has_error && 0 < asn1_tag_remaining(asn1)) {
+ while (!asn1_has_error(asn1) && 0 < asn1_tag_remaining(asn1)) {
int i;
uint8_t context;
@@ -54,7 +54,7 @@ static bool read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
asn1->has_error = true;
return false;
}
- for (i = 0; !asn1->has_error &&
+ for (i = 0; !asn1_has_error(asn1) &&
0 < asn1_tag_remaining(asn1); i++) {
char *oid;
const char **p;
@@ -127,7 +127,7 @@ static bool read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
if (!asn1_end_tag(asn1)) return false;
if (!asn1_end_tag(asn1)) return false;
- return !asn1->has_error;
+ return !asn1_has_error(asn1);
}
static bool write_negTokenInit(struct asn1_data *asn1, struct spnego_negTokenInit *token)
@@ -190,7 +190,7 @@ static bool write_negTokenInit(struct asn1_data *asn1, struct spnego_negTokenIni
if (!asn1_pop_tag(asn1)) return false;
if (!asn1_pop_tag(asn1)) return false;
- return !asn1->has_error;
+ return !asn1_has_error(asn1);
}
static bool read_negTokenTarg(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
@@ -201,7 +201,7 @@ static bool read_negTokenTarg(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
if (!asn1_start_tag(asn1, ASN1_CONTEXT(1))) return false;
if (!asn1_start_tag(asn1, ASN1_SEQUENCE(0))) return false;
- while (!asn1->has_error && 0 < asn1_tag_remaining(asn1)) {
+ while (!asn1_has_error(asn1) && 0 < asn1_tag_remaining(asn1)) {
uint8_t context;
char *oid;
if (!asn1_peek_uint8(asn1, &context)) {
@@ -242,7 +242,7 @@ static bool read_negTokenTarg(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
if (!asn1_end_tag(asn1)) return false;
if (!asn1_end_tag(asn1)) return false;
- return !asn1->has_error;
+ return !asn1_has_error(asn1);
}
static bool write_negTokenTarg(struct asn1_data *asn1, struct spnego_negTokenTarg *token)
@@ -279,7 +279,7 @@ static bool write_negTokenTarg(struct asn1_data *asn1, struct spnego_negTokenTar
if (!asn1_pop_tag(asn1)) return false;
if (!asn1_pop_tag(asn1)) return false;
- return !asn1->has_error;
+ return !asn1_has_error(asn1);
}
ssize_t spnego_read_data(TALLOC_CTX *mem_ctx, DATA_BLOB data, struct spnego_data *token)
@@ -324,7 +324,7 @@ ssize_t spnego_read_data(TALLOC_CTX *mem_ctx, DATA_BLOB data, struct spnego_data
}
}
- if (!asn1->has_error) ret = asn1->ofs;
+ if (!asn1_has_error(asn1)) ret = asn1->ofs;
err:
@@ -357,7 +357,7 @@ ssize_t spnego_write_data(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct spnego_da
break;
}
- if (!asn1->has_error) {
+ if (!asn1_has_error(asn1)) {
*blob = data_blob_talloc(mem_ctx, asn1->data, asn1->length);
ret = asn1->ofs;
}
@@ -423,7 +423,7 @@ bool spnego_write_mech_types(TALLOC_CTX *mem_ctx,
if (!asn1_pop_tag(asn1)) goto err;
}
- if (asn1->has_error) {
+ if (asn1_has_error(asn1)) {
goto err;
}
diff --git a/libcli/ldap/ldap_message.c b/libcli/ldap/ldap_message.c
index 491f96053cb..f4b49ca31c9 100644
--- a/libcli/ldap/ldap_message.c
+++ b/libcli/ldap/ldap_message.c
@@ -322,7 +322,7 @@ static bool ldap_push_filter(struct asn1_data *data, struct ldb_parse_tree *tree
if (!asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(7))) return false;
if (!asn1_write_LDAPString(data, tree->u.present.attr)) return false;
if (!asn1_pop_tag(data)) return false;
- return !data->has_error;
+ return !asn1_has_error(data);
case LDB_OP_APPROX:
/* approx test */
@@ -366,7 +366,7 @@ static bool ldap_push_filter(struct asn1_data *data, struct ldb_parse_tree *tree
default:
return false;
}
- return !data->has_error;
+ return !asn1_has_error(data);
}
static bool ldap_encode_response(struct asn1_data *data, struct ldap_Result *result)
@@ -845,7 +845,8 @@ static struct ldb_parse_tree *ldap_decode_filter_tree(TALLOC_CTX *mem_ctx,
if (!asn1_read_OctetString_talloc(mem_ctx, data, &attrib)) goto failed;
if (!asn1_read_OctetString(data, mem_ctx, &value)) goto failed;
if (!asn1_end_tag(data)) goto failed;
- if ((data->has_error) || (attrib == NULL) || (value.data == NULL)) {
+ if (asn1_has_error(data) || (attrib == NULL) ||
+ (value.data == NULL)) {
goto failed;
}
@@ -960,7 +961,8 @@ static struct ldb_parse_tree *ldap_decode_filter_tree(TALLOC_CTX *mem_ctx,
if (!asn1_read_OctetString_talloc(mem_ctx, data, &attrib)) goto failed;
if (!asn1_read_OctetString(data, mem_ctx, &value)) goto failed;
if (!asn1_end_tag(data)) goto failed;
- if ((data->has_error) || (attrib == NULL) || (value.data == NULL)) {
+ if (asn1_has_error(data) || (attrib == NULL) ||
+ (value.data == NULL)) {
goto failed;
}
@@ -979,7 +981,8 @@ static struct ldb_parse_tree *ldap_decode_filter_tree(TALLOC_CTX *mem_ctx,
if (!asn1_read_OctetString_talloc(mem_ctx, data, &attrib)) goto failed;
if (!asn1_read_OctetString(data, mem_ctx, &value)) goto failed;
if (!asn1_end_tag(data)) goto failed;
- if ((data->has_error) || (attrib == NULL) || (value.data == NULL)) {
+ if (asn1_has_error(data) || (attrib == NULL) ||
+ (value.data == NULL)) {
goto failed;
}
@@ -1017,7 +1020,8 @@ static struct ldb_parse_tree *ldap_decode_filter_tree(TALLOC_CTX *mem_ctx,
if (!asn1_read_OctetString_talloc(mem_ctx, data, &attrib)) goto failed;
if (!asn1_read_OctetString(data, mem_ctx, &value)) goto failed;
if (!asn1_end_tag(data)) goto failed;
- if ((data->has_error) || (attrib == NULL) || (value.data == NULL)) {
+ if (asn1_has_error(data) || (attrib == NULL) ||
+ (value.data == NULL)) {
goto failed;
}
@@ -1618,7 +1622,7 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data,
}
if (!asn1_end_tag(data)) goto prot_err;
- if ((data->has_error) || (data->nesting != NULL)) {
+ if (asn1_has_error(data) || (data->nesting != NULL)) {
return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);
}
return NT_STATUS_OK;