mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Device.Security fix bugs
This commit is contained in:
parent
fb34bcd008
commit
073d2693f4
2 changed files with 7 additions and 10 deletions
|
|
@ -173,7 +173,7 @@ static void get_certificate_paths(void)
|
|||
continue;
|
||||
if (cidx >= MAX_CERT)
|
||||
break;
|
||||
if(!file_exists(cert) && is_regular_file(cert))
|
||||
if(!file_exists(cert) || !is_regular_file(cert))
|
||||
continue;
|
||||
strncpy(certifcates_paths[cidx], cert, 256);
|
||||
cidx++;
|
||||
|
|
@ -186,7 +186,7 @@ static void get_certificate_paths(void)
|
|||
continue;
|
||||
if (cidx >= MAX_CERT)
|
||||
break;
|
||||
if(!file_exists(cert) && is_regular_file(cert))
|
||||
if(!file_exists(cert) || !is_regular_file(cert))
|
||||
continue;
|
||||
strncpy(certifcates_paths[cidx], cert, 256);
|
||||
cidx++;
|
||||
|
|
@ -199,7 +199,7 @@ static void get_certificate_paths(void)
|
|||
continue;
|
||||
if (cidx >= MAX_CERT)
|
||||
break;
|
||||
if(!file_exists(cert) && is_regular_file(cert))
|
||||
if(!file_exists(cert) || !is_regular_file(cert))
|
||||
continue;
|
||||
strncpy(certifcates_paths[cidx], cert, 256);
|
||||
cidx++;
|
||||
|
|
@ -214,9 +214,7 @@ static int browseSecurityCertificateInst(struct dmctx *dmctx, DMNODE *parent_nod
|
|||
struct certificate_profile certificateprofile = {};
|
||||
|
||||
check_create_dmmap_package("dmmap_security");
|
||||
|
||||
get_certificate_paths();
|
||||
|
||||
int i;
|
||||
for (i=0; i < MAX_CERT; i++) {
|
||||
if(!strlen(certifcates_paths[i]))
|
||||
|
|
@ -224,6 +222,8 @@ static int browseSecurityCertificateInst(struct dmctx *dmctx, DMNODE *parent_nod
|
|||
#ifdef LOPENSSL
|
||||
FILE *fp = NULL;
|
||||
fp = fopen(certifcates_paths[i], "r");
|
||||
if (fp == NULL)
|
||||
continue;
|
||||
X509 *cert = PEM_read_X509(fp, NULL, NULL, NULL);
|
||||
if (!cert) {
|
||||
fclose(fp);
|
||||
|
|
@ -245,7 +245,6 @@ static int browseSecurityCertificateInst(struct dmctx *dmctx, DMNODE *parent_nod
|
|||
#elif LMBEDTLS
|
||||
mbedtls_x509_crt cacert;
|
||||
mbedtls_x509_crt_init( &cacert );
|
||||
|
||||
int ret = mbedtls_x509_crt_parse_file( &cacert, certifcates_paths[i]);
|
||||
if (ret < 0)
|
||||
continue;
|
||||
|
|
@ -273,7 +272,6 @@ static int get_Security_CertificateNumberOfEntries(char *refparam, struct dmctx
|
|||
#if defined(LOPENSSL) || defined(LMBEDTLS)
|
||||
|
||||
get_certificate_paths();
|
||||
|
||||
int i;
|
||||
for (i=0; i < MAX_CERT; i++) {
|
||||
if(!strlen(certifcates_paths[i]))
|
||||
|
|
@ -281,6 +279,8 @@ static int get_Security_CertificateNumberOfEntries(char *refparam, struct dmctx
|
|||
#ifdef LOPENSSL
|
||||
FILE *fp = NULL;
|
||||
fp = fopen(certifcates_paths[i], "r");
|
||||
if (fp == NULL)
|
||||
continue;
|
||||
X509 *cert = PEM_read_X509(fp, NULL, NULL, NULL);
|
||||
if (!cert) {
|
||||
fclose(fp);
|
||||
|
|
|
|||
|
|
@ -2012,9 +2012,6 @@ int is_regular_file(const char *path)
|
|||
if (path == NULL || strlen(path) == 0)
|
||||
return 0;
|
||||
|
||||
if (access(path, F_OK) != 0)
|
||||
return 1;
|
||||
|
||||
struct stat path_stat;
|
||||
stat(path, &path_stat);
|
||||
return S_ISREG(path_stat.st_mode);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue