]> granicus.if.org Git - curl/commitdiff
nss: search slash in forward direction in dup_nickname()
authorKamil Dudka <kdudka@redhat.com>
Thu, 4 Feb 2016 09:44:52 +0000 (10:44 +0100)
committerKamil Dudka <kdudka@redhat.com>
Wed, 10 Feb 2016 17:58:49 +0000 (18:58 +0100)
It is wasteful to search it backwards if we look for _any_ slash.

lib/vtls/nss.c

index 2fc3f433a273c1ff4fe536cf3e7c40eeead18885..3922d9c90ccff3fa31a3b6c7c6727505eb01ba70 100644 (file)
@@ -328,8 +328,8 @@ static char* dup_nickname(struct SessionHandle *data, enum dupstring cert_kind)
     /* no such file exists, use the string as nickname */
     return strdup(str);
 
-  /* search the last slash; we require at least one slash in a file name */
-  n = strrchr(str, '/');
+  /* search the first slash; we require at least one slash in a file name */
+  n = strchr(str, '/');
   if(!n) {
     infof(data, "warning: certificate file name \"%s\" handled as nickname; "
           "please use \"./%s\" to force file name\n", str, str);
@@ -928,12 +928,6 @@ static SECStatus check_issuer_cert(PRFileDesc *sock,
   SECStatus res=SECSuccess;
   void *proto_win = NULL;
 
-  /*
-    PRArenaPool   *tmpArena = NULL;
-    CERTAuthKeyID *authorityKeyID = NULL;
-    SECITEM       *caname = NULL;
-  */
-
   cert = SSL_PeerCertificate(sock);
   cert_issuer = CERT_FindCertIssuer(cert, PR_Now(), certUsageObjectSigner);