-/* $OpenBSD: extern.h,v 1.99 2021/12/22 09:35:14 claudio Exp $ */
+/* $OpenBSD: extern.h,v 1.100 2021/12/29 11:37:57 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
* and parsed.
*/
struct entity {
- enum rtype type; /* type of entity (not RTYPE_EOF) */
+ TAILQ_ENTRY(entity) entries;
char *file; /* local path to file */
- int has_data; /* whether data blob is specified */
unsigned char *data; /* optional data blob */
size_t datasz; /* length of optional data blob */
int talid; /* tal identifier */
- TAILQ_ENTRY(entity) entries;
+ enum rtype type; /* type of entity (not RTYPE_EOF) */
};
TAILQ_HEAD(entityq, entity);
-/* $OpenBSD: main.c,v 1.169 2021/12/22 09:35:14 claudio Exp $ */
+/* $OpenBSD: main.c,v 1.170 2021/12/29 11:37:57 claudio Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
io_read_buf(b, &ent->type, sizeof(ent->type));
io_read_buf(b, &ent->talid, sizeof(ent->talid));
io_read_str(b, &ent->file);
- io_read_buf(b, &ent->has_data, sizeof(ent->has_data));
- if (ent->has_data)
- io_read_buf_alloc(b, (void **)&ent->data, &ent->datasz);
+ io_read_buf_alloc(b, (void **)&ent->data, &ent->datasz);
}
/*
io_simple_buffer(b, &ent->type, sizeof(ent->type));
io_simple_buffer(b, &ent->talid, sizeof(ent->talid));
io_str_buffer(b, ent->file);
- io_simple_buffer(b, &ent->has_data, sizeof(int));
- if (ent->has_data)
- io_buf_buffer(b, ent->data, ent->datasz);
+ io_buf_buffer(b, ent->data, ent->datasz);
io_close_buffer(&procq, b);
}
p->type = type;
p->talid = talid;
p->file = file;
- p->has_data = data != NULL;
- if (p->has_data) {
- p->data = data;
- p->datasz = datasz;
- }
+ p->data = data;
+ p->datasz = (data != NULL) ? datasz : 0;
entity_queue++;
-/* $OpenBSD: parser.c,v 1.28 2021/11/04 18:26:48 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.29 2021/12/29 11:37:57 claudio Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
STACK_OF(X509) *chain;
STACK_OF(X509_CRL) *crls;
- assert(!entp->has_data);
+ assert(entp->data == NULL);
/* Extract certificate data and X509. */
struct cert *cert;
X509 *x509;
- assert(entp->has_data);
+ assert(entp->data != NULL);
/* Extract certificate data and X509. */
tal_free(tal);
break;
case RTYPE_CER:
- if (entp->has_data)
+ if (entp->data != NULL)
cert = proc_parser_root_cert(entp, f, flen);
else
cert = proc_parser_cert(entp, f, flen);