summaryrefslogtreecommitdiff
path: root/source3/torture
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-10-22 19:23:49 +0200
committerGünther Deschner <gd@samba.org>2008-10-22 21:37:36 +0200
commitc0cf457c85a1fb89d72c2088c103a51af9341de4 (patch)
treee54cf0bd51946a8aec1ea2b718488726ae331abb /source3/torture
parent527d79747642cf83c89a8931e4fe86df1fec454b (diff)
downloadsamba-c0cf457c85a1fb89d72c2088c103a51af9341de4.tar.gz
samba-c0cf457c85a1fb89d72c2088c103a51af9341de4.tar.bz2
samba-c0cf457c85a1fb89d72c2088c103a51af9341de4.zip
s3-asn1: make all of s3 asn1 code do a proper asn1_init() first.
Guenther
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/t_asn1.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/source3/torture/t_asn1.c b/source3/torture/t_asn1.c
index 5862742bc1..0ccd97b6d5 100644
--- a/source3/torture/t_asn1.c
+++ b/source3/torture/t_asn1.c
@@ -31,22 +31,26 @@ int main(void)
bool ok = True;
for (i=0; tests[i].data != NULL; i++) {
- ASN1_DATA data;
+ ASN1_DATA *data;
DATA_BLOB blob;
- ZERO_STRUCT(data);
- asn1_write_Integer(&data, values[i]);
+ data = asn1_init(talloc_tos());
+ if (!data) {
+ return -1;
+ }
+
+ asn1_write_Integer(data, values[i]);
- if ((data.length != tests[i].length) ||
- (memcmp(data.data, tests[i].data, data.length) != 0)) {
+ if ((data->length != tests[i].length) ||
+ (memcmp(data>data, tests[i].data, data->length) != 0)) {
printf("Test for %d failed\n", values[i]);
ok = False;
}
- blob.data = data.data;
- blob.length = data.length;
- asn1_load(&data, blob);
- if (!asn1_read_Integer(&data, &val)) {
+ blob.data = data->data;
+ blob.length = data->length;
+ asn1_load(data, blob);
+ if (!asn1_read_Integer(data, &val)) {
printf("Could not read our own Integer for %d\n",
values[i]);
ok = False;