projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Only CA certificates can be self-issued
[openssl.git]
/
apps
/
rehash.c
diff --git
a/apps/rehash.c
b/apps/rehash.c
index 2b6167f1de76da44e7557505c6e5900227c0724c..de7217cb1003ff20cf208c78e518b278e3880a68 100644
(file)
--- a/
apps/rehash.c
+++ b/
apps/rehash.c
@@
-126,9
+126,10
@@
static int add_entry(enum Type type, unsigned int hash, const char *filename,
for (ep = bp->first_entry; ep; ep = ep->next) {
if (digest && memcmp(digest, ep->digest, evpmdsize) == 0) {
BIO_printf(bio_err,
for (ep = bp->first_entry; ep; ep = ep->next) {
if (digest && memcmp(digest, ep->digest, evpmdsize) == 0) {
BIO_printf(bio_err,
- "%s: skipping duplicate %s in %s\n", opt_getprog(),
+ "%s: warning: skipping duplicate %s in %s\n",
+ opt_getprog(),
type == TYPE_CERT ? "certificate" : "CRL", filename);
type == TYPE_CERT ? "certificate" : "CRL", filename);
- return
1
;
+ return
0
;
}
if (strcmp(filename, ep->filename) == 0) {
found = ep;
}
if (strcmp(filename, ep->filename) == 0) {
found = ep;
@@
-140,7
+141,7
@@
static int add_entry(enum Type type, unsigned int hash, const char *filename,
if (ep == NULL) {
if (bp->num_needed >= MAX_COLLISIONS) {
BIO_printf(bio_err,
if (ep == NULL) {
if (bp->num_needed >= MAX_COLLISIONS) {
BIO_printf(bio_err,
- "%s: hash table overflow for %s\n",
+ "%s:
error:
hash table overflow for %s\n",
opt_getprog(), filename);
return 1;
}
opt_getprog(), filename);
return 1;
}
@@
-231,7
+232,7
@@
static int do_file(const char *filename, const char *fullpath, enum Hash h)
/* Does it have X.509 data in it? */
if ((b = BIO_new_file(fullpath, "r")) == NULL) {
/* Does it have X.509 data in it? */
if ((b = BIO_new_file(fullpath, "r")) == NULL) {
- BIO_printf(bio_err, "%s: skipping %s, cannot open file\n",
+ BIO_printf(bio_err, "%s:
error:
skipping %s, cannot open file\n",
opt_getprog(), filename);
errs++;
goto end;
opt_getprog(), filename);
errs++;
goto end;
@@
-243,7
+244,7
@@
static int do_file(const char *filename, const char *fullpath, enum Hash h)
if (sk_X509_INFO_num(inf) != 1) {
BIO_printf(bio_err,
if (sk_X509_INFO_num(inf) != 1) {
BIO_printf(bio_err,
- "%s: skipping %s,"
+ "%s:
warning:
skipping %s,"
"it does not contain exactly one certificate or CRL\n",
opt_getprog(), filename);
/* This is not an error. */
"it does not contain exactly one certificate or CRL\n",
opt_getprog(), filename);
/* This is not an error. */
@@
-307,7
+308,7
@@
static int do_dir(const char *dirname, enum Hash h)
size_t i;
const char *pathsep;
const char *filename;
size_t i;
const char *pathsep;
const char *filename;
- char *buf, *copy;
+ char *buf, *copy
= NULL
;
STACK_OF(OPENSSL_STRING) *files = NULL;
if (app_access(dirname, W_OK) < 0) {
STACK_OF(OPENSSL_STRING) *files = NULL;
if (app_access(dirname, W_OK) < 0) {
@@
-324,13
+325,16
@@
static int do_dir(const char *dirname, enum Hash h)
if ((files = sk_OPENSSL_STRING_new_null()) == NULL) {
BIO_printf(bio_err, "Skipping %s, out of memory\n", dirname);
if ((files = sk_OPENSSL_STRING_new_null()) == NULL) {
BIO_printf(bio_err, "Skipping %s, out of memory\n", dirname);
- exit(1);
+ errs = 1;
+ goto err;
}
while ((filename = OPENSSL_DIR_read(&d, dirname)) != NULL) {
}
while ((filename = OPENSSL_DIR_read(&d, dirname)) != NULL) {
- if ((copy = strdup(filename)) == NULL
+ if ((copy =
OPENSSL_
strdup(filename)) == NULL
|| sk_OPENSSL_STRING_push(files, copy) == 0) {
|| sk_OPENSSL_STRING_push(files, copy) == 0) {
+ OPENSSL_free(copy);
BIO_puts(bio_err, "out of memory\n");
BIO_puts(bio_err, "out of memory\n");
- exit(1);
+ errs = 1;
+ goto err;
}
}
OPENSSL_DIR_end(&d);
}
}
OPENSSL_DIR_end(&d);
@@
-348,7
+352,6
@@
static int do_dir(const char *dirname, enum Hash h)
continue;
errs += do_file(filename, buf, h);
}
continue;
errs += do_file(filename, buf, h);
}
- sk_OPENSSL_STRING_pop_free(files, str_free);
for (i = 0; i < OSSL_NELEM(hash_table); i++) {
for (bp = hash_table[i]; bp; bp = nextbp) {
for (i = 0; i < OSSL_NELEM(hash_table); i++) {
for (bp = hash_table[i]; bp; bp = nextbp) {
@@
-416,6
+419,8
@@
static int do_dir(const char *dirname, enum Hash h)
hash_table[i] = NULL;
}
hash_table[i] = NULL;
}
+ err:
+ sk_OPENSSL_STRING_pop_free(files, str_free);
OPENSSL_free(buf);
return errs;
}
OPENSSL_free(buf);
return errs;
}