* src/chpasswd.c: Make sure the SHA related variables is not
compiled when disabled at configuration time. * src/chgpasswd.c: Make sure the SHA related variables is not compiled when disabled at configuration time. * src/chgpasswd.c: Fix the test for getlong() failure.
This commit is contained in:
parent
e3e64317e8
commit
f98b47eb55
@ -3,6 +3,11 @@
|
|||||||
* src/newusers.c: Make sure the SHA related variables are not
|
* src/newusers.c: Make sure the SHA related variables are not
|
||||||
compiled when disabled at configuration time.
|
compiled when disabled at configuration time.
|
||||||
* src/newusers.c: Added FIXME
|
* src/newusers.c: Added FIXME
|
||||||
|
* src/chpasswd.c: Make sure the SHA related variables is not
|
||||||
|
compiled when disabled at configuration time.
|
||||||
|
* src/chgpasswd.c: Make sure the SHA related variables is not
|
||||||
|
compiled when disabled at configuration time.
|
||||||
|
* src/chgpasswd.c: Fix the test for getlong() failure.
|
||||||
|
|
||||||
2009-03-13 Nicolas François <nicolas.francois@centraliens.net>
|
2009-03-13 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 2006 , Tomasz Kłoczko
|
* Copyright (c) 2006 , Tomasz Kłoczko
|
||||||
* Copyright (c) 2006 , Jonas Meurer
|
* Copyright (c) 2006 , Jonas Meurer
|
||||||
* Copyright (c) 2007 - 2008, Nicolas François
|
* Copyright (c) 2007 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -59,10 +59,14 @@ char *Prog;
|
|||||||
static bool cflg = false;
|
static bool cflg = false;
|
||||||
static bool eflg = false;
|
static bool eflg = false;
|
||||||
static bool md5flg = false;
|
static bool md5flg = false;
|
||||||
|
#ifdef USE_SHA_CRYPT
|
||||||
static bool sflg = false;
|
static bool sflg = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *crypt_method = NULL;
|
static const char *crypt_method = NULL;
|
||||||
|
#ifdef USE_SHA_CRYPT
|
||||||
static long sha_rounds = 5000;
|
static long sha_rounds = 5000;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SHADOWGRP
|
#ifdef SHADOWGRP
|
||||||
static bool is_shadow_grp;
|
static bool is_shadow_grp;
|
||||||
@ -176,7 +180,7 @@ static void process_flags (int argc, char **argv)
|
|||||||
#ifdef USE_SHA_CRYPT
|
#ifdef USE_SHA_CRYPT
|
||||||
case 's':
|
case 's':
|
||||||
sflg = true;
|
sflg = true;
|
||||||
if (getlong(optarg, &sha_rounds) != 0) {
|
if (getlong(optarg, &sha_rounds) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: invalid numeric argument '%s'\n"),
|
_("%s: invalid numeric argument '%s'\n"),
|
||||||
Prog, optarg);
|
Prog, optarg);
|
||||||
@ -204,12 +208,14 @@ static void process_flags (int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
static void check_flags (void)
|
static void check_flags (void)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_SHA_CRYPT
|
||||||
if (sflg && !cflg) {
|
if (sflg && !cflg) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: %s flag is only allowed with the %s flag\n"),
|
_("%s: %s flag is only allowed with the %s flag\n"),
|
||||||
Prog, "-s", "-c");
|
Prog, "-s", "-c");
|
||||||
usage ();
|
usage ();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((eflg && (md5flg || cflg)) ||
|
if ((eflg && (md5flg || cflg)) ||
|
||||||
(md5flg && cflg)) {
|
(md5flg && cflg)) {
|
||||||
@ -443,9 +449,11 @@ int main (int argc, char **argv)
|
|||||||
if (md5flg) {
|
if (md5flg) {
|
||||||
crypt_method = "MD5";
|
crypt_method = "MD5";
|
||||||
} else if (crypt_method != NULL) {
|
} else if (crypt_method != NULL) {
|
||||||
|
#ifdef USE_SHA_CRYPT
|
||||||
if (sflg) {
|
if (sflg) {
|
||||||
arg = &sha_rounds;
|
arg = &sha_rounds;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
crypt_method = NULL;
|
crypt_method = NULL;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
|
||||||
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
* Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
||||||
* Copyright (c) 2000 - 2006, Tomasz Kłoczko
|
* Copyright (c) 2000 - 2006, Tomasz Kłoczko
|
||||||
* Copyright (c) 2007 - 2008, Nicolas François
|
* Copyright (c) 2007 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -57,10 +57,14 @@ char *Prog;
|
|||||||
static bool cflg = false;
|
static bool cflg = false;
|
||||||
static bool eflg = false;
|
static bool eflg = false;
|
||||||
static bool md5flg = false;
|
static bool md5flg = false;
|
||||||
|
#ifdef USE_SHA_CRYPT
|
||||||
static bool sflg = false;
|
static bool sflg = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *crypt_method = NULL;
|
static const char *crypt_method = NULL;
|
||||||
|
#ifdef USE_SHA_CRYPT
|
||||||
static long sha_rounds = 5000;
|
static long sha_rounds = 5000;
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool is_shadow_pwd;
|
static bool is_shadow_pwd;
|
||||||
static bool pw_locked = false;
|
static bool pw_locked = false;
|
||||||
@ -198,12 +202,14 @@ static void process_flags (int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
static void check_flags (void)
|
static void check_flags (void)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_SHA_CRYPT
|
||||||
if (sflg && !cflg) {
|
if (sflg && !cflg) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: %s flag is only allowed with the %s flag\n"),
|
_("%s: %s flag is only allowed with the %s flag\n"),
|
||||||
Prog, "-s", "-c");
|
Prog, "-s", "-c");
|
||||||
usage ();
|
usage ();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((eflg && (md5flg || cflg)) ||
|
if ((eflg && (md5flg || cflg)) ||
|
||||||
(md5flg && cflg)) {
|
(md5flg && cflg)) {
|
||||||
@ -434,9 +440,11 @@ int main (int argc, char **argv)
|
|||||||
if (md5flg) {
|
if (md5flg) {
|
||||||
crypt_method = "MD5";
|
crypt_method = "MD5";
|
||||||
} else if (crypt_method != NULL) {
|
} else if (crypt_method != NULL) {
|
||||||
|
#ifdef USE_SHA_CRYPT
|
||||||
if (sflg) {
|
if (sflg) {
|
||||||
arg = &sha_rounds;
|
arg = &sha_rounds;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
crypt_method = NULL;
|
crypt_method = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user