Blame SOURCES/openldap-nss-ignore-certdb-type-prefix.patch

767ab2
MozNSS: ignore certdb database type prefix when checking existence of the directory
767ab2
767ab2
If the certdb is specified including the database type prefix (e.g.
767ab2
sql:, dbm:), the prefix has to be ignored when checking the
767ab2
certificate directory existence.
767ab2
767ab2
Author: Jan Vcelak <jvcelak@redhat.com>
767ab2
Upstream ITS: #7388
767ab2
Resolves: #857373
767ab2
767ab2
---
767ab2
 libraries/libldap/tls_m.c | 11 ++++++++++-
767ab2
 1 file changed, 10 insertions(+), 1 deletion(-)
767ab2
767ab2
diff --git a/libraries/libldap/tls_m.c b/libraries/libldap/tls_m.c
767ab2
index 49a3f8f..5ee21a2 100644
767ab2
--- a/libraries/libldap/tls_m.c
767ab2
+++ b/libraries/libldap/tls_m.c
767ab2
@@ -1633,6 +1633,7 @@ tlsm_get_certdb_prefix( const char *certdir, char **realcertdir, char **prefix )
767ab2
 {
767ab2
 	char sep = PR_GetDirectorySeparator();
767ab2
 	char *ptr = NULL;
767ab2
+	char *chkpath = NULL;
767ab2
 	struct PRFileInfo prfi;
767ab2
 	PRStatus prc;
767ab2
 
767ab2
@@ -1643,8 +1644,16 @@ tlsm_get_certdb_prefix( const char *certdir, char **realcertdir, char **prefix )
767ab2
 		return;
767ab2
 	}
767ab2
 
767ab2
-	prc = PR_GetFileInfo( certdir, &prfi );
767ab2
+	/* ignore database type prefix (e.g. sql:, dbm:) if provided */
767ab2
+	chkpath = strchr( certdir, ':' );
767ab2
+	if ( chkpath != NULL ) {
767ab2
+		chkpath += 1;
767ab2
+	} else {
767ab2
+		chkpath = certdir;
767ab2
+	}
767ab2
+
767ab2
 	/* if certdir exists (file or directory) then it cannot specify a prefix */
767ab2
+	prc = PR_GetFileInfo( chkpath, &prfi );
767ab2
 	if ( prc == PR_SUCCESS ) {
767ab2
 		return;
767ab2
 	}
767ab2
-- 
767ab2
1.7.11.7
767ab2