Index: distrib/sets/lists/tests/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/tests/mi,v
retrieving revision 1.821
diff -r1.821 mi
4210a4211,4214
> ./usr/tests/usr.bin/pwhash tests-usr.bin-tests compattestfile,atf
> ./usr/tests/usr.bin/pwhash/Atffile tests-usr.bin-tests compattestfile,atf
> ./usr/tests/usr.bin/pwhash/Kyuafile tests-usr.bin-tests compattestfile,atf,kyua
> ./usr/tests/usr.bin/pwhash/t_pwhash tests-usr.bin-tests compattestfile,atf
Index: etc/mtree/NetBSD.dist.tests
===================================================================
RCS file: /cvsroot/src/etc/mtree/NetBSD.dist.tests,v
retrieving revision 1.158
diff -r1.158 NetBSD.dist.tests
418a419
> ./usr/tests/usr.bin/pwhash
Index: lib/libcrypt/crypt.c
===================================================================
RCS file: /cvsroot/src/lib/libcrypt/crypt.c,v
retrieving revision 1.34
diff -r1.34 crypt.c
46a47
> #include <string.h> /* for strcmp */
500a502,543
> * We extract the scheme from setting str to allow for
> * full scheme name comparison
> * Updated to reflect alc suggestion(s)
> *
> * retuns boolean 0 on failure, 1 on success,
> */
> static int
> nondes_scheme_substr(const char * setting,char * scheme, unsigned int len)
> {
> const char * start;
> const char * sep;
>
> /* initialize head pointer */
> start = setting;
>
> /* clear out scheme buffer regardless of result */
> memset(scheme, 0, len);
>
> /* make sure we are working on non-des scheme string */
> if (*start != _PASSWORD_NONDES) {
> return 0;
> }
>
> /* increment passed initial _PASSWORD_NONDES */
> start++;
>
> if ((sep = memchr(start, _PASSWORD_NONDES,len-1)) == NULL) {
> return 0;
> }
>
> /* if empty string, we are done */
> if (sep == start) {
> return 1;
> }
>
> /* copy scheme substr to buffer */
> memcpy(scheme, start, (size_t)(sep - start));
>
> return 1;
> }
>
> /*
507a551
> char scheme[12];
509a554
> int r;
516,517c561,570
< switch (setting[1]) {
< case '2':
---
> r = nondes_scheme_substr(
> setting, scheme, sizeof(scheme));
>
> /* return NULL if we are unable to extract substring */
> if (!r) {
> return NULL;
> }
>
> /* $2a$ found in bcrypt.c:encode_salt */
> if (strcmp(scheme, "2a") == 0) {
519c572,573
< case 's':
---
> } else if (strcmp(scheme, "sha1") == 0) {
> /* $sha1$ found in crypt.h:SHA1_MAGIC */
521,522c575,576
< case '1':
< default:
---
> } else if (strcmp(scheme, "1") == 0) {
> /* $1$ found in pw_gensalt.c:__gensalt_md5 */
523a578,580
> } else {
> /* invalid scheme, including empty string */
> return NULL;
525a583
> /* End non-DES handling */
Index: tests/usr.bin/Makefile
===================================================================
RCS file: /cvsroot/src/tests/usr.bin/Makefile,v
retrieving revision 1.27
diff -r1.27 Makefile
11c11
< pkill pr printf rump_server shmif_dumpbus sdiff \
---
> pkill pr printf pwhash rump_server shmif_dumpbus sdiff \