diff options
-rw-r--r-- | sbin/isakmpd/x509.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sbin/isakmpd/x509.c b/sbin/isakmpd/x509.c index 89149eb4a7a..7be9a639734 100644 --- a/sbin/isakmpd/x509.c +++ b/sbin/isakmpd/x509.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509.c,v 1.57 2001/06/07 07:35:15 angelos Exp $ */ +/* $OpenBSD: x509.c,v 1.58 2001/06/22 16:21:43 provos Exp $ */ /* $EOM: x509.c,v 1.54 2001/01/16 18:42:16 ho Exp $ */ /* @@ -685,6 +685,22 @@ x509_read_from_dir (X509_STORE *ctx, char *name, int hash) while ((file = readdir (dir)) != NULL) { + strncpy (fullname + off, file->d_name, size); + fullname[off + size] = 0; + + if (file->d_type != DT_UNKNOWN) + { + if (file->d_type != DT_REG && file->d_type != DT_LNK) + continue; + } + else + { + struct stat sb; + + if (stat(fullname, &sb) == -1 || !(sb.st_mode & S_IFREG)) + continue; + } + if (file->d_type != DT_REG && file->d_type != DT_LNK) continue; @@ -698,9 +714,6 @@ x509_read_from_dir (X509_STORE *ctx, char *name, int hash) continue; } - strncpy (fullname + off, file->d_name, size); - fullname[off + size] = 0; - if (LC (BIO_read_filename, (certh, fullname)) == -1) { LC (BIO_free, (certh)); |