592250e
Accept nss certificate name in the form of tokenname:certnickname
592250e
592250e
Author: Rich Megginson <rmeggins@redhat.com>
592250e
Upstream ITS: #7360
592250e
592250e
diff --git a/libraries/libldap/tls_m.c b/libraries/libldap/tls_m.c
592250e
index 5022efb..7377bb1 100644
592250e
--- a/libraries/libldap/tls_m.c
592250e
+++ b/libraries/libldap/tls_m.c
592250e
@@ -2102,6 +2102,22 @@ tlsm_ctx_init( struct ldapoptions *lo, struct ldaptls *lt, int is_server )
592250e
 	return 0;
592250e
 }
592250e
 
592250e
+/* returns true if the given string looks like 
592250e
+   "tokenname" ":" "certnickname"
592250e
+   This is true if there is a ':' colon character
592250e
+   in the string and the colon is not the first
592250e
+   or the last character in the string
592250e
+*/
592250e
+static int
592250e
+tlsm_is_tokenname_certnick( const char *certfile )
592250e
+{
592250e
+	if ( certfile ) {
592250e
+		const char *ptr = PL_strchr( certfile, ':' );
592250e
+		return ptr && (ptr != certfile) && (*(ptr+1));
592250e
+	}
592250e
+	return 0;
592250e
+}
592250e
+
592250e
 static int
592250e
 tlsm_deferred_ctx_init( void *arg )
592250e
 {
592250e
@@ -2268,7 +2284,10 @@ tlsm_deferred_ctx_init( void *arg )
592250e
 		} else {
592250e
 			char *tmp_certname;
592250e
 
592250e
-			if (ctx->tc_certdb_slot) {
592250e
+			if (tlsm_is_tokenname_certnick(lt->lt_certfile)) {
592250e
+				/* assume already in form tokenname:certnickname */
592250e
+				tmp_certname = PL_strdup(lt->lt_certfile);
592250e
+			} else if (ctx->tc_certdb_slot) {
592250e
 				tmp_certname = PR_smprintf(TLSM_CERTDB_DESC_FMT ":%s", ctx->tc_unique, lt->lt_certfile);
592250e
 			} else {
592250e
 				tmp_certname = PR_smprintf("%s", lt->lt_certfile);
592250e
-- 
592250e
1.7.11.4
592250e