Skip to content

Commit

Permalink
Small fix for older application that use -1 as PKI_DATA_FORMAT instea…
Browse files Browse the repository at this point in the history
…d of PKI_DATA_FORMAT_UNKNOWN when loading X509 objects without specifying the type.
  • Loading branch information
Massimiliano Pala committed Jun 3, 2022
1 parent 877b49c commit a8099c5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
8 changes: 8 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -20107,3 +20107,11 @@ echo "
and then 'make install' for installation.
"

# echo "OSSL=${openssl_cflags}"
# echo "COMP=${composite_cflags}"
# echo "LDAP=${ldap_cflags}"
# echo "KMF=${kmf_cflags}"
# echo "XML2=${xml2_cflags}"
# echo "MYSQL=${mysql_cflags}"
# echo "PGSQL=${pg_cflags}"

8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1818,3 +1818,11 @@ echo "
and then 'make install' for installation.
"

# echo "OSSL=${openssl_cflags}"
# echo "COMP=${composite_cflags}"
# echo "LDAP=${ldap_cflags}"
# echo "KMF=${kmf_cflags}"
# echo "XML2=${xml2_cflags}"
# echo "MYSQL=${mysql_cflags}"
# echo "PGSQL=${pg_cflags}"

16 changes: 14 additions & 2 deletions src/pki_x509_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,21 @@ PKI_X509_STACK *PKI_X509_STACK_get_mem ( PKI_MEM *mem, PKI_DATATYPE type,
// unknown datatype (PKI_DATATYPE_UNKNOW)
for (i = PKI_DATA_FORMAT_START; i < PKI_DATA_FORMAT_END; i++) {

// Fix for older applications using -1 as format
if (format == 4294967295) {
PKI_log_err("Wrong DATA format used in application (-1),"
"please replace with PKI_DATA_FORMAT_UNKNOWN (%d)",
PKI_DATA_FORMAT_UNKNOWN);
}

// A Format was selected, so we skip the others
if (format != PKI_DATA_FORMAT_UNKNOWN && format != i)
continue;
if (format != 4294967295 &&
format != PKI_DATA_FORMAT_UNKNOWN &&
format != i) {

// We cannot process the type, skipping.
continue;
}

if ((x_obj->value = __get_data_callback(mem, cb, i, cred)) != NULL) {

Expand Down

0 comments on commit a8099c5

Please sign in to comment.