"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mkpasswd.c" between
whois_5.4.3.tar.xz and whois_5.5.0.tar.xz

About: whois is an improved whois client (searching in a RFC-3912 database)

mkpasswd.c  (whois_5.4.3.tar.xz):mkpasswd.c  (whois_5.5.0.tar.xz)
/* /*
* Copyright (C) 2001-2018 Marco d'Itri <md@linux.it>. * Copyright (C) 2001-2019 Marco d'Itri <md@linux.it>.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
skipping to change at line 101 skipping to change at line 101
static const struct crypt_method methods[] = { static const struct crypt_method methods[] = {
/* method prefix minlen, maxlen rounds description */ /* method prefix minlen, maxlen rounds description */
#ifdef CRYPT_GENSALT_IMPLEMENTS_DEFAULT_PREFIX #ifdef CRYPT_GENSALT_IMPLEMENTS_DEFAULT_PREFIX
{ "auto", NULL, 0, 0, 0, NULL }, { "auto", NULL, 0, 0, 0, NULL },
#endif #endif
/* compatibility aliases for mkpasswd versions < 5.4.0 */ /* compatibility aliases for mkpasswd versions < 5.4.0 */
{ "des", "", 2, 2, 0, NULL }, { "des", "", 2, 2, 0, NULL },
{ "md5", "$1$", 8, 8, 0, NULL }, { "md5", "$1$", 8, 8, 0, NULL },
#if defined XCRYPT_VERSION_NUM #if defined XCRYPT_VERSION_NUM
{ "yescrypt", "$y$", 0, 0, 0, "Yescrypt" }, { "yescrypt", "$y$", 0, 0, 0, "Yescrypt" },
#if XCRYPT_VERSION_NUM >= ((4 << 16) | 4)
{ "gost-yescrypt", "$gy$", 0, 0, 0, "GOST Yescrypt" },
#endif
{ "scrypt", "$7$", 0, 0, 0, "scrypt" }, { "scrypt", "$7$", 0, 0, 0, "scrypt" },
#endif #endif
#ifdef HAVE_BCRYPT_OBSOLETE #ifdef HAVE_BCRYPT_OBSOLETE
/* http://marc.info/?l=openbsd-misc&m=139320023202696 */ /* http://marc.info/?l=openbsd-misc&m=139320023202696 */
{ "bf", "$2a$", 22, 22, 2, "bcrypt" }, { "bf", "$2a$", 22, 22, 2, "bcrypt" },
#endif #endif
#ifdef HAVE_BCRYPT #ifdef HAVE_BCRYPT
{ "bcrypt", "$2b$", 22, 22, 2, "bcrypt" }, { "bcrypt", "$2b$", 22, 22, 2, "bcrypt" },
{ "bcrypt-a", "$2a$", 22, 22, 2, "bcrypt (obsolete $2a$ version )" }, { "bcrypt-a", "$2a$", 22, 22, 2, "bcrypt (obsolete $2a$ version )" },
#endif #endif
#if defined HAVE_SHA_CRYPT #if defined HAVE_SHA_CRYPT
/* http://people.redhat.com/drepper/SHA-crypt.txt */ /* http://people.redhat.com/drepper/SHA-crypt.txt */
{ "sha512crypt", "$6$", 8, 16, 1, "SHA-512" }, { "sha512crypt", "$6$", 8, 16, 1, "SHA-512" },
{ "sha256crypt", "$5$", 8, 16, 1, "SHA-256" }, { "sha256crypt", "$5$", 8, 16, 1, "SHA-256" },
/* compatibility aliases for mkpasswd versions < 5.4.0 */ /* compatibility aliases for mkpasswd versions < 5.4.0 */
{ "sha-256", "$5$", 8, 16, 1, NULL }, { "sha-256", "$5$", 8, 16, 1, NULL },
{ "sha-512", "$6$", 8, 16, 1, NULL }, { "sha-512", "$6$", 8, 16, 1, NULL },
#endif #endif
#if (defined __SVR4 && defined __sun) || defined XCRYPT_VERSION_NUM #if (defined __SVR4 && defined __sun) || defined XCRYPT_VERSION_NUM
/* http://www.crypticide.com/dropsafe/article/1389 */
/*
* Actually the maximum salt length is arbitrary, but Solaris by default
* always uses 8 characters:
* http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/ \
* usr/src/lib/crypt_modules/sunmd5/sunmd5.c#crypt_gensalt_impl
*/
{ "sunmd5", "$md5$", 8, 8, 1, "SunMD5" }, { "sunmd5", "$md5$", 8, 8, 1, "SunMD5" },
#endif #endif
{ "md5crypt", "$1$", 8, 8, 0, "MD5" }, { "md5crypt", "$1$", 8, 8, 0, "MD5" },
#ifdef HAVE_BSDICRYPT #ifdef HAVE_BSDICRYPT
{ "bsdicrypt", "_", 0, 0, 0, { "bsdicrypt", "_", 0, 0, 0,
N_("BSDI extended DES-based crypt(3)") }, N_("BSDI extended DES-based crypt(3)") },
#endif #endif
{ "descrypt", "", 2, 2, 0, { "descrypt", "", 2, 2, 0,
N_("standard 56 bit DES-based crypt(3)") }, N_("standard 56 bit DES-based crypt(3)") },
#if defined FreeBSD || defined XCRYPT_VERSION_NUM #if defined FreeBSD || defined XCRYPT_VERSION_NUM
{ "nt", "$3$", 0, 0, 0, "NT-Hash" }, { "nt", "$3$", 0, 0, 0, "NT-Hash" },
#endif #endif
/* http://www.crypticide.com/dropsafe/article/1389 */
/*
* Actually the maximum salt length is arbitrary, but Solaris by default
* always uses 8 characters:
* http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/ \
* usr/src/lib/crypt_modules/sunmd5/sunmd5.c#crypt_gensalt_impl
*/
{ NULL, NULL, 0, 0, 0, NULL } { NULL, NULL, 0, 0, 0, NULL }
}; };
void generate_salt(char *const buf, const unsigned int len); void generate_salt(char *const buf, const unsigned int len);
void *get_random_bytes(const unsigned int len); void *get_random_bytes(const unsigned int len);
void NORETURN display_help(int error); void NORETURN display_help(int error);
void display_version(void); void display_version(void);
void display_methods(void); void display_methods(void);
char *read_line(FILE *fp); char *read_line(FILE *fp);
skipping to change at line 494 skipping to change at line 497
buf[i] = '\0'; buf[i] = '\0';
} }
#endif /* RANDOM_DEVICE || HAVE_ARC4RANDOM_BUF || HAVE_GETENTROPY*/ #endif /* RANDOM_DEVICE || HAVE_ARC4RANDOM_BUF || HAVE_GETENTROPY*/
void NORETURN display_help(int error) void NORETURN display_help(int error)
{ {
fprintf((EXIT_SUCCESS == error) ? stdout : stderr, fprintf((EXIT_SUCCESS == error) ? stdout : stderr,
_("Usage: mkpasswd [OPTIONS]... [PASSWORD [SALT]]\n" _("Usage: mkpasswd [OPTIONS]... [PASSWORD [SALT]]\n"
"Crypts the PASSWORD using crypt(3).\n\n")); "Crypts the PASSWORD using crypt(3).\n\n"));
fprintf(stderr, _( fprintf((EXIT_SUCCESS == error) ? stdout : stderr, _(
" -m, --method=TYPE select method TYPE\n" " -m, --method=TYPE select method TYPE\n"
" -5 like --method=md5\n" " -5 like --method=md5\n"
" -S, --salt=SALT use the specified SALT\n" " -S, --salt=SALT use the specified SALT\n"
));
fprintf((EXIT_SUCCESS == error) ? stdout : stderr, _(
" -R, --rounds=NUMBER use the specified NUMBER of rounds\n" " -R, --rounds=NUMBER use the specified NUMBER of rounds\n"
" -P, --password-fd=NUM read the password from file descriptor NUM\n" " -P, --password-fd=NUM read the password from file descriptor NUM\n"
" instead of /dev/tty\n" " instead of /dev/tty\n"
" -s, --stdin like --password-fd=0\n" " -s, --stdin like --password-fd=0\n"
));
fprintf((EXIT_SUCCESS == error) ? stdout : stderr, _(
" -h, --help display this help and exit\n" " -h, --help display this help and exit\n"
" -V, --version output version information and exit\n" " -V, --version output version information and exit\n"
"\n" "\n"
"If PASSWORD is missing then it is asked interactively.\n" "If PASSWORD is missing then it is asked interactively.\n"
"If no SALT is specified, a random one is generated.\n" "If no SALT is specified, a random one is generated.\n"
"If TYPE is 'help', available methods are printed.\n" "If TYPE is 'help', available methods are printed.\n"
"\n" "\n"
"Report bugs to %s.\n"), "<md+whois@linux.it>"); "Report bugs to %s.\n"), "<md+whois@linux.it>");
exit(error); exit(error);
} }
void display_version(void) void display_version(void)
{ {
printf("mkpasswd %s\n\n", VERSION); printf("mkpasswd %s\n\n", VERSION);
puts("Copyright (C) 2001-2018 Marco d'Itri\n" puts("Copyright (C) 2001-2019 Marco d'Itri\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."); "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");
} }
void display_methods(void) void display_methods(void)
{ {
unsigned int i; unsigned int i;
printf(_("Available methods:\n")); printf(_("Available methods:\n"));
for (i = 0; methods[i].method != NULL; i++) for (i = 0; methods[i].method != NULL; i++)
 End of changes. 8 change blocks. 
10 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)