From d4a0eddc13ab6b1e578dc9bf534394643acb1f64 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Thu, 1 Sep 2011 23:12:48 -0400 Subject: [PATCH 128/150] - handle PEM encoded files where the PEM item is preceded by other data --- src/plugins/preauth/pkinit/pkinit_crypto_nss.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_nss.c b/src/plugins/preauth/pkinit/pkinit_crypto_nss.c index 291ac29..3cde173 100644 --- a/src/plugins/preauth/pkinit/pkinit_crypto_nss.c +++ b/src/plugins/preauth/pkinit/pkinit_crypto_nss.c @@ -1075,7 +1075,11 @@ secitem_from_file(PLArenaPool *pool, const char *filename, SECItem *item, encoded = (const char *) tmp.data; if ((secitem_from_file_type == secitem_from_file_decode) && (tmp.len > 11) && - (strncmp(encoded, "-----BEGIN ", 11) == 0)) { + ((strncmp(encoded, "-----BEGIN ", 11) == 0) || + ((encoded = strstr(tmp.data, "\n-----BEGIN")) != NULL))) { + if (encoded[0] == '\n') { + encoded++; + } /* find the beginning of the next line */ p = encoded; p += strcspn(p, "\r\n"); -- 1.7.6.4