/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include"secutil.h"
/* * NOTE: The contents of this file are NOT used by the client. * (They are part of the security library as a whole, but they are * NOT USED BY THE CLIENT.) Do not change things on behalf of the * client (like localizing strings), or add things that are only * for the client (put them elsewhere).
*/
for (;;) { /* Prompt for password */ if (isTTY) {
fprintf(output, "%s", prompt);
fflush(output);
echoOff(infd);
}
if (QUIET_FGETS(phrase, sizeof(phrase), input) == NULL) { return NULL;
}
if (isTTY) {
fprintf(output, "\n");
echoOn(infd);
}
/* stomp on newline */
phrase[PORT_Strlen(phrase) - 1] = 0;
/* Validate password */ if (!(*ok)(phrase)) { /* Not weird enough */ if (!isTTY) return NULL;
fprintf(output, "Password must be at least 8 characters long with one or more\n");
fprintf(output, "non-alphabetic characters\n"); continue;
} return (char *)PORT_Strdup(phrase);
}
}
PRBool
SEC_CheckPassword(char *cp)
{ int len; char *end;
len = PORT_Strlen(cp); if (len < 8) { return PR_FALSE;
}
end = cp + len; while (cp < end) { unsignedchar ch = *cp++; if (!((ch >= 'A') && (ch <= 'Z')) &&
!((ch >= 'a') && (ch <= 'z'))) { /* pass phrase has at least one non alphabetic in it */ return PR_TRUE;
}
} return PR_FALSE;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.