lib: Use asn1_set_error()
authorVolker Lendecke <vl@samba.org>
Mon, 4 Jan 2016 20:51:07 +0000 (21:51 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 5 Jan 2016 23:54:18 +0000 (00:54 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libcli/auth/spnego_parse.c
source3/libsmb/clispnego.c
source4/auth/gensec/gensec_krb5.c

index ba67273db30dd24bed280a25c152027d03fed052..54181893043c176ff1bbb9ce7fa691028de2ad4b 100644 (file)
@@ -37,7 +37,7 @@ static bool read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
                uint8_t context;
 
                if (!asn1_peek_uint8(asn1, &context)) {
-                       asn1->has_error = true;
+                       asn1_set_error(asn1);
                        break;
                }
 
@@ -51,7 +51,7 @@ static bool read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
 
                        mechTypes = talloc(mem_ctx, const char *);
                        if (mechTypes == NULL) {
-                               asn1->has_error = true;
+                               asn1_set_error(asn1);
                                return false;
                        }
                        for (i = 0; !asn1_has_error(asn1) &&
@@ -63,7 +63,7 @@ static bool read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
                                                   const char *, i+2);
                                if (p == NULL) {
                                        talloc_free(mechTypes);
-                                       asn1->has_error = true;
+                                       asn1_set_error(asn1);
                                        return false;
                                }
                                mechTypes = p;
@@ -97,7 +97,7 @@ static bool read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
                        uint8_t type_peek;
                        if (!asn1_start_tag(asn1, ASN1_CONTEXT(3))) return false;
                        if (!asn1_peek_uint8(asn1, &type_peek)) {
-                               asn1->has_error = true;
+                               asn1_set_error(asn1);
                                break;
                        }
                        if (type_peek == ASN1_OCTET_STRING) {
@@ -119,7 +119,7 @@ static bool read_negTokenInit(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
                        break;
                }
                default:
-                       asn1->has_error = true;
+                       asn1_set_error(asn1);
                        break;
                }
        }
@@ -205,7 +205,7 @@ static bool read_negTokenTarg(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
                uint8_t context;
                char *oid;
                if (!asn1_peek_uint8(asn1, &context)) {
-                       asn1->has_error = true;
+                       asn1_set_error(asn1);
                        break;
                }
 
@@ -234,7 +234,7 @@ static bool read_negTokenTarg(struct asn1_data *asn1, TALLOC_CTX *mem_ctx,
                        if (!asn1_end_tag(asn1)) return false;
                        break;
                default:
-                       asn1->has_error = true;
+                       asn1_set_error(asn1);
                        break;
                }
        }
@@ -302,7 +302,7 @@ ssize_t spnego_read_data(TALLOC_CTX *mem_ctx, DATA_BLOB data, struct spnego_data
        if (!asn1_load(asn1, data)) goto err;
 
        if (!asn1_peek_uint8(asn1, &context)) {
-               asn1->has_error = true;
+               asn1_set_error(asn1);
        } else {
                switch (context) {
                case ASN1_APPLICATION(0):
@@ -319,7 +319,7 @@ ssize_t spnego_read_data(TALLOC_CTX *mem_ctx, DATA_BLOB data, struct spnego_data
                        }
                        break;
                default:
-                       asn1->has_error = true;
+                       asn1_set_error(asn1);
                        break;
                }
        }
@@ -353,7 +353,7 @@ ssize_t spnego_write_data(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct spnego_da
                write_negTokenTarg(asn1, &spnego->negTokenTarg);
                break;
        default:
-               asn1->has_error = true;
+               asn1_set_error(asn1);
                break;
        }
 
index cebe529fba117d28b8f2ee12a62a87cd877c1b43..61ccdae03ef93ccaaf2a551633cddd6830349780 100644 (file)
@@ -431,7 +431,7 @@ bool spnego_parse_auth_response(TALLOC_CTX *ctx,
                        if (!asn1_end_tag(data)) goto err;
                }
        } else if (negResult == SPNEGO_ACCEPT_INCOMPLETE) {
-               data->has_error = 1;
+               asn1_set_error(data);
                goto err;
        }
 
index a10963775a9a6e2df5cb3fcaa34654ef69c7e2cd..7f512caab258faed05e5c4a46df4236c41e5c2a2 100644 (file)
@@ -454,7 +454,7 @@ static bool gensec_gssapi_parse_krb5_wrap(TALLOC_CTX *mem_ctx, const DATA_BLOB *
        data_remaining = asn1_tag_remaining(data);
 
        if (data_remaining < 3) {
-               data->has_error = true;
+               asn1_set_error(data);
        } else {
                if (!asn1_read(data, tok_id, 2)) goto err;
                data_remaining -= 2;