Date: Sun, 19 Dec 2010 21:20:12 GMT From: Marcin Cieslak <saper@saper.info> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/138855: [patch] if the hostname is empty, opiepasswd(1) creates a seed too short Message-ID: <201012192120.oBJLKC4A096377@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/138855; it has been noted by GNATS. From: Marcin Cieslak <saper@saper.info> To: bug-followup@FreeBSD.org Cc: deeptech71@gmail.com Subject: Re: bin/138855: [patch] if the hostname is empty, opiepasswd(1) creates a seed too short Date: Sun, 19 Dec 2010 21:14:36 +0000 This patch: Index: newseed.c =================================================================== --- newseed.c (revision 212217) +++ newseed.c (working copy) @@ -81,6 +81,10 @@ utsname.nodename[1] = 'e'; } utsname.nodename[2] = 0; + if (!isalnum(utsname.nodename[0]) + utsname.nodename[0] = 'k'; + if (!isalnum(utsname.nodename[1]) + utsname.nodename[1] = 'f'; if (snprintf(seed, OPIE_SEED_MAX+1, "%s%04d", utsname.nodename, (rand() % 9999) + 1) >= OPIE_SEED_MAX+1) should fix seed generation also for one-letter hostnames (the generated seed for hostname "x" was "x." and the opiepasswd failed as well because of the isalnum() check in writerec.c. //Marcin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012192120.oBJLKC4A096377>