NT still buggy with password files, this seems to fix it
git-svn-id: svn://10.0.0.236/trunk@79348 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
813748876f
commit
fee15c70c4
@ -238,6 +238,7 @@ SECU_FilePasswd(PK11SlotInfo *slot, PRBool retry, void *arg)
|
||||
PRFileDesc *fd;
|
||||
PRInt32 nb;
|
||||
char *pwFile = arg;
|
||||
int i;
|
||||
|
||||
if (!pwFile)
|
||||
return 0;
|
||||
@ -256,16 +257,14 @@ SECU_FilePasswd(PK11SlotInfo *slot, PRBool retry, void *arg)
|
||||
|
||||
PR_Close(fd);
|
||||
/* handle the Windows EOL case */
|
||||
if ((nb > 2) && (phrase[nb-2] == '\r') ) nb--;
|
||||
if (phrase[nb-1] == '\n') {
|
||||
if ( nb > 2 && phrase[nb-2] == '\r' ) nb--;
|
||||
phrase[nb-1] = '\0';
|
||||
if (nb == 0) {
|
||||
fprintf(stderr,"password file contains no data\n");
|
||||
return NULL;
|
||||
} else {
|
||||
return (char*) PORT_Strdup((char*)phrase);
|
||||
}
|
||||
i = 0;
|
||||
while (phrase[i] != '\r' && phrase[i] != '\n' && i < nb) i++;
|
||||
phrase[i] = '\0';
|
||||
if (nb == 0) {
|
||||
fprintf(stderr,"password file contains no data\n");
|
||||
return NULL;
|
||||
} else {
|
||||
return (char*) PORT_Strdup((char*)phrase);
|
||||
}
|
||||
return (char*) PORT_Strdup((char*)phrase);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user