bin/138855: [patch] if the hostname is empty, opiepasswd(1)
creates a seed too short
Marcin Cieslak
saper at saper.info
Sun Dec 19 21:20:13 UTC 2010
The following reply was made to PR bin/138855; it has been noted by GNATS.
From: Marcin Cieslak <saper at saper.info>
To: bug-followup at FreeBSD.org
Cc: deeptech71 at 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
More information about the freebsd-bugs
mailing list