* src/chpasswd.c: Add annotations to indicate that usage() does
not return. * src/chpasswd.c: Reindent. * src/chpasswd.c: Remove dead code. No need to set crypt_method to NULL when it is already NULL. sflg is only set if crypt_method is not NULL.
This commit is contained in:
parent
2be8650d2c
commit
7e8aa5429a
@ -1,3 +1,12 @@
|
|||||||
|
2011-07-23 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* src/chpasswd.c: Add annotations to indicate that usage() does
|
||||||
|
not return.
|
||||||
|
* src/chpasswd.c: Reindent.
|
||||||
|
* src/chpasswd.c: Remove dead code. No need to set crypt_method
|
||||||
|
to NULL when it is already NULL. sflg is only set if crypt_method
|
||||||
|
is not NULL.
|
||||||
|
|
||||||
2011-07-23 Nicolas François <nicolas.francois@centraliens.net>
|
2011-07-23 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* src/lastlog.c: Add annotations to indicate that usage() does not
|
* src/lastlog.c: Add annotations to indicate that usage() does not
|
||||||
|
@ -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 - 2009, Nicolas François
|
* Copyright (c) 2007 - 2011, 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
|
||||||
@ -72,7 +72,7 @@ static bool spw_locked = false;
|
|||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static void fail_exit (int code);
|
static void fail_exit (int code);
|
||||||
static void usage (int status);
|
static /*@noreturn@*/void usage (int status);
|
||||||
static void process_flags (int argc, char **argv);
|
static void process_flags (int argc, char **argv);
|
||||||
static void check_flags (void);
|
static void check_flags (void);
|
||||||
static void check_perms (void);
|
static void check_perms (void);
|
||||||
@ -106,7 +106,7 @@ static void fail_exit (int code)
|
|||||||
/*
|
/*
|
||||||
* usage - display usage message and exit
|
* usage - display usage message and exit
|
||||||
*/
|
*/
|
||||||
static void usage (int status)
|
static /*@noreturn@*/void usage (int status)
|
||||||
{
|
{
|
||||||
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
|
||||||
(void) fprintf (usageout,
|
(void) fprintf (usageout,
|
||||||
@ -167,7 +167,7 @@ static void process_flags (int argc, char **argv)
|
|||||||
switch (c) {
|
switch (c) {
|
||||||
case 'h':
|
case 'h':
|
||||||
usage (E_SUCCESS);
|
usage (E_SUCCESS);
|
||||||
break;
|
/*@notreached@*/break;
|
||||||
case 'c':
|
case 'c':
|
||||||
cflg = true;
|
cflg = true;
|
||||||
crypt_method = optarg;
|
crypt_method = optarg;
|
||||||
@ -191,7 +191,7 @@ static void process_flags (int argc, char **argv)
|
|||||||
#endif /* USE_SHA_CRYPT */
|
#endif /* USE_SHA_CRYPT */
|
||||||
default:
|
default:
|
||||||
usage (E_USAGE);
|
usage (E_USAGE);
|
||||||
break;
|
/*@notreached@*/break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,15 +476,12 @@ int main (int argc, char **argv)
|
|||||||
void *arg = NULL;
|
void *arg = NULL;
|
||||||
if (md5flg) {
|
if (md5flg) {
|
||||||
crypt_method = "MD5";
|
crypt_method = "MD5";
|
||||||
} else if (crypt_method != NULL) {
|
}
|
||||||
#ifdef USE_SHA_CRYPT
|
#ifdef USE_SHA_CRYPT
|
||||||
if (sflg) {
|
if (sflg) {
|
||||||
arg = &sha_rounds;
|
arg = &sha_rounds;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
|
||||||
crypt_method = NULL;
|
|
||||||
}
|
|
||||||
cp = pw_encrypt (newpwd,
|
cp = pw_encrypt (newpwd,
|
||||||
crypt_make_salt(crypt_method, arg));
|
crypt_make_salt(crypt_method, arg));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user