From b8cdda35e57303fa67e96165e8eb37a19e22171b Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Thu, 14 Jul 2011 13:06:56 +0200 Subject: [PATCH whois 3/7] crypt_gensalt might change the prefix It's undocumented behavior but be prepared for it. --- mkpasswd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/mkpasswd.c b/mkpasswd.c index 59c7a58..8bdc7f3 100644 --- a/mkpasswd.c +++ b/mkpasswd.c @@ -331,7 +331,9 @@ int main(int argc, char *argv[]) fprintf(stderr, "crypt failed.\n"); exit(2); } - if (!strneq(result, salt_prefix, strlen(salt_prefix))) { + /* yes, using strlen(salt_prefix) on salt. It's not + * documented whether crypt_gensalt may change the prefix */ + if (!strneq(result, salt, strlen(salt_prefix))) { fprintf(stderr, _("Method not supported by crypt(3).\n")); exit(2); } -- 1.7.3.4