[svn-upgrade] Integrating new upstream version, shadow (4.0.12)
This commit is contained in:
19
src/chage.c
19
src/chage.c
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: chage.c,v 1.49 2005/07/11 16:12:38 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: chage.c,v 1.55 2005/08/09 17:20:02 kloczek Exp $")
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
@@ -48,6 +48,7 @@ RCSID (PKG_VER "$Id: chage.c,v 1.49 2005/07/11 16:12:38 kloczek Exp $")
|
||||
#include <selinux/selinux.h>
|
||||
#include <selinux/av_permissions.h>
|
||||
#endif
|
||||
#include "exitcodes.h"
|
||||
#include "prototypes.h"
|
||||
#include "defines.h"
|
||||
#include "pwio.h"
|
||||
@@ -77,14 +78,6 @@ static long expdays;
|
||||
|
||||
#define EPOCH "1969-12-31"
|
||||
|
||||
|
||||
/*
|
||||
* exit status values
|
||||
*/
|
||||
#define E_SUCCESS 0 /* success */
|
||||
#define E_NOPERM 1 /* permission denied */
|
||||
#define E_USAGE 2 /* invalid command syntax */
|
||||
|
||||
/* local function prototypes */
|
||||
static void usage (void);
|
||||
static void date_to_str (char *, size_t, time_t);
|
||||
@@ -258,7 +251,7 @@ static void list_fields (void)
|
||||
|
||||
printf (_("Password expires\t\t\t\t\t: "));
|
||||
if (lastday <= 0 || maxdays >= 10000 * (DAY / SCALE)
|
||||
|| maxdays <= 0) {
|
||||
|| maxdays < 0) {
|
||||
printf (_("never\n"));
|
||||
} else {
|
||||
expires = changed + maxdays * SCALE;
|
||||
@@ -273,8 +266,8 @@ static void list_fields (void)
|
||||
*/
|
||||
|
||||
printf (_("Password inactive\t\t\t\t\t: "));
|
||||
if (lastday <= 0 || inactdays <= 0 ||
|
||||
maxdays >= 10000 * (DAY / SCALE) || maxdays <= 0) {
|
||||
if (lastday <= 0 || inactdays < 0 ||
|
||||
maxdays >= 10000 * (DAY / SCALE) || maxdays < 0) {
|
||||
printf (_("never\n"));
|
||||
} else {
|
||||
expires = changed + (maxdays + inactdays) * SCALE;
|
||||
@@ -287,7 +280,7 @@ static void list_fields (void)
|
||||
*/
|
||||
|
||||
printf (_("Account expires\t\t\t\t\t\t: "));
|
||||
if (expdays <= 0) {
|
||||
if (expdays < 0) {
|
||||
printf (_("never\n"));
|
||||
} else {
|
||||
expires = expdays * SCALE;
|
||||
|
55
src/chfn.c
55
src/chfn.c
@@ -30,28 +30,29 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: chfn.c,v 1.29 2005/07/07 15:32:50 kloczek Exp $")
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
RCSID (PKG_VER "$Id: chfn.c,v 1.31 2005/08/02 13:39:43 kloczek Exp $")
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include "prototypes.h"
|
||||
#include "defines.h"
|
||||
#include <pwd.h>
|
||||
#include "pwio.h"
|
||||
#include "getdef.h"
|
||||
#include "pwauth.h"
|
||||
#include "nscd.h"
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SHADOW_H
|
||||
#include <shadow.h>
|
||||
#endif
|
||||
#ifdef USE_PAM
|
||||
#include "pam_defs.h"
|
||||
#endif
|
||||
#ifdef WITH_SELINUX
|
||||
#include <selinux/selinux.h>
|
||||
#include <selinux/av_permissions.h>
|
||||
#endif
|
||||
#include "defines.h"
|
||||
#include "exitcodes.h"
|
||||
#include "getdef.h"
|
||||
#include "nscd.h"
|
||||
#ifdef USE_PAM
|
||||
#include "pam_defs.h"
|
||||
#endif
|
||||
#include "prototypes.h"
|
||||
#include "pwauth.h"
|
||||
#include "pwio.h"
|
||||
/*
|
||||
* Global variables.
|
||||
*/
|
||||
@@ -88,7 +89,7 @@ static void usage (void)
|
||||
fprintf (stderr,
|
||||
_("Usage: %s [-f full_name] [-r room_no] "
|
||||
"[-w work_ph] [-h home_ph]\n"), Prog);
|
||||
exit (1);
|
||||
exit (E_USAGE);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,17 +147,17 @@ static void new_fields (void)
|
||||
if (may_change_field ('r'))
|
||||
change_field (roomno, sizeof roomno, _("Room Number"));
|
||||
else
|
||||
printf ("\t%s: %s\n", _("Room Number"), roomno);
|
||||
printf (_("\tRoom Number: %s\n"), roomno);
|
||||
|
||||
if (may_change_field ('w'))
|
||||
change_field (workph, sizeof workph, _("Work Phone"));
|
||||
else
|
||||
printf ("\t%s: %s\n", _("Work Phone"), workph);
|
||||
printf (_("\tWork Phone: %s\n"), workph);
|
||||
|
||||
if (may_change_field ('h'))
|
||||
change_field (homeph, sizeof homeph, _("Home Phone"));
|
||||
else
|
||||
printf ("\t%s: %s\n", _("Home Phone"), homeph);
|
||||
printf (_("\tHome Phone: %s\n"), homeph);
|
||||
|
||||
if (amroot)
|
||||
change_field (slop, sizeof slop, _("Other"));
|
||||
@@ -266,7 +267,7 @@ int main (int argc, char **argv)
|
||||
if (!may_change_field ('f')) {
|
||||
fprintf (stderr,
|
||||
_("%s: Permission denied.\n"), Prog);
|
||||
exit (1);
|
||||
exit (E_NOPERM);
|
||||
}
|
||||
fflg++;
|
||||
STRFCPY (fullnm, optarg);
|
||||
@@ -275,7 +276,7 @@ int main (int argc, char **argv)
|
||||
if (!may_change_field ('h')) {
|
||||
fprintf (stderr,
|
||||
_("%s: Permission denied.\n"), Prog);
|
||||
exit (1);
|
||||
exit (E_NOPERM);
|
||||
}
|
||||
hflg++;
|
||||
STRFCPY (homeph, optarg);
|
||||
@@ -284,7 +285,7 @@ int main (int argc, char **argv)
|
||||
if (!may_change_field ('r')) {
|
||||
fprintf (stderr,
|
||||
_("%s: Permission denied.\n"), Prog);
|
||||
exit (1);
|
||||
exit (E_NOPERM);
|
||||
}
|
||||
rflg++;
|
||||
STRFCPY (roomno, optarg);
|
||||
@@ -293,7 +294,7 @@ int main (int argc, char **argv)
|
||||
if (!amroot) {
|
||||
fprintf (stderr,
|
||||
_("%s: Permission denied.\n"), Prog);
|
||||
exit (1);
|
||||
exit (E_NOPERM);
|
||||
}
|
||||
oflg++;
|
||||
STRFCPY (slop, optarg);
|
||||
@@ -302,7 +303,7 @@ int main (int argc, char **argv)
|
||||
if (!may_change_field ('w')) {
|
||||
fprintf (stderr,
|
||||
_("%s: Permission denied.\n"), Prog);
|
||||
exit (1);
|
||||
exit (E_NOPERM);
|
||||
}
|
||||
wflg++;
|
||||
STRFCPY (workph, optarg);
|
||||
@@ -323,7 +324,7 @@ int main (int argc, char **argv)
|
||||
if (!pw) {
|
||||
fprintf (stderr, _("%s: unknown user %s\n"), Prog,
|
||||
user);
|
||||
exit (1);
|
||||
exit (E_NOPERM);
|
||||
}
|
||||
} else {
|
||||
pw = get_my_pwent ();
|
||||
@@ -332,7 +333,7 @@ int main (int argc, char **argv)
|
||||
_
|
||||
("%s: Cannot determine your user name.\n"),
|
||||
Prog);
|
||||
exit (1);
|
||||
exit (E_NOPERM);
|
||||
}
|
||||
user = xstrdup (pw->pw_name);
|
||||
}
|
||||
@@ -369,7 +370,7 @@ int main (int argc, char **argv)
|
||||
if (!amroot && pw->pw_uid != getuid ()) {
|
||||
fprintf (stderr, _("%s: Permission denied.\n"), Prog);
|
||||
closelog ();
|
||||
exit (1);
|
||||
exit (E_NOPERM);
|
||||
}
|
||||
#ifdef WITH_SELINUX
|
||||
/*
|
||||
@@ -381,7 +382,7 @@ int main (int argc, char **argv)
|
||||
&& (checkPasswdAccess (PASSWD__CHFN) != 0)) {
|
||||
fprintf (stderr, _("%s: Permission denied.\n"), Prog);
|
||||
closelog ();
|
||||
exit (1);
|
||||
exit (E_NOPERM);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -585,5 +586,5 @@ int main (int argc, char **argv)
|
||||
nscd_flush_cache ("passwd");
|
||||
|
||||
closelog ();
|
||||
exit (0);
|
||||
exit (E_SUCCESS);
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: chpasswd.c,v 1.26 2005/05/25 19:31:51 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: chpasswd.c,v 1.29 2005/08/11 16:23:34 kloczek Exp $")
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
#include <pwd.h>
|
||||
@@ -39,7 +39,6 @@ RCSID (PKG_VER "$Id: chpasswd.c,v 1.26 2005/05/25 19:31:51 kloczek Exp $")
|
||||
#ifdef USE_PAM
|
||||
#include <security/pam_appl.h>
|
||||
#include <security/pam_misc.h>
|
||||
#include <pwd.h>
|
||||
#endif /* USE_PAM */
|
||||
#include "prototypes.h"
|
||||
#include "defines.h"
|
||||
|
37
src/chsh.c
37
src/chsh.c
@@ -30,28 +30,29 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: chsh.c,v 1.29 2005/04/06 04:26:06 kloczek Exp $")
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
RCSID (PKG_VER "$Id: chsh.c,v 1.30 2005/07/24 15:22:45 kloczek Exp $")
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include "prototypes.h"
|
||||
#include "defines.h"
|
||||
#include <pwd.h>
|
||||
#include "pwio.h"
|
||||
#include "getdef.h"
|
||||
#include "pwauth.h"
|
||||
#include "nscd.h"
|
||||
#ifdef HAVE_SHADOW_H
|
||||
#include <shadow.h>
|
||||
#endif
|
||||
#ifdef USE_PAM
|
||||
#include "pam_defs.h"
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef WITH_SELINUX
|
||||
#include <selinux/selinux.h>
|
||||
#include <selinux/av_permissions.h>
|
||||
#endif
|
||||
#ifdef HAVE_SHADOW_H
|
||||
#include <shadow.h>
|
||||
#endif
|
||||
#include "defines.h"
|
||||
#include "exitcodes.h"
|
||||
#include "getdef.h"
|
||||
#include "nscd.h"
|
||||
#include "prototypes.h"
|
||||
#include "pwauth.h"
|
||||
#include "pwio.h"
|
||||
#ifdef USE_PAM
|
||||
#include "pam_defs.h"
|
||||
#endif
|
||||
#ifndef SHELLS_FILE
|
||||
#define SHELLS_FILE "/etc/shells"
|
||||
#endif
|
||||
@@ -74,7 +75,7 @@ static int restricted_shell (const char *);
|
||||
static void usage (void)
|
||||
{
|
||||
fprintf (stderr, _("Usage: %s [-s shell] [name]\n"), Prog);
|
||||
exit (1);
|
||||
exit (E_USAGE);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -399,5 +400,5 @@ int main (int argc, char **argv)
|
||||
nscd_flush_cache ("passwd");
|
||||
|
||||
closelog ();
|
||||
exit (0);
|
||||
exit (E_SUCCESS);
|
||||
}
|
||||
|
@@ -30,16 +30,18 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: faillog.c,v 1.23 2005/05/25 19:31:51 kloczek Exp $")
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <pwd.h>
|
||||
#include <time.h>
|
||||
RCSID (PKG_VER "$Id: faillog.c,v 1.24 2005/08/03 17:40:59 kloczek Exp $")
|
||||
#include <getopt.h>
|
||||
#include "prototypes.h"
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include "defines.h"
|
||||
#include "exitcodes.h"
|
||||
#include "faillog.h"
|
||||
#include "prototypes.h"
|
||||
/* global variables */
|
||||
static FILE *fail; /* failure file stream */
|
||||
static uid_t user; /* one single user, specified on command line */
|
||||
static int days; /* number of days to consider for print command */
|
||||
@@ -68,7 +70,7 @@ static void usage (void)
|
||||
" -u, --user LOGIN display faillog record or maintains failure counters\n"
|
||||
" and limits (if used with -r, -m or -l options) only\n"
|
||||
" for user with LOGIN\n"));
|
||||
exit (1);
|
||||
exit (E_USAGE);
|
||||
}
|
||||
|
||||
static void print_one (const struct faillog *fl, uid_t uid)
|
||||
@@ -372,5 +374,6 @@ int main (int argc, char **argv)
|
||||
if (!anyflag && (aflg || tflg || uflg))
|
||||
print ();
|
||||
fclose (fail);
|
||||
return 0;
|
||||
|
||||
exit (E_SUCCESS);
|
||||
}
|
||||
|
@@ -30,20 +30,22 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: gpasswd.c,v 1.26 2005/07/07 15:11:48 kloczek Exp $")
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
RCSID (PKG_VER "$Id: gpasswd.c,v 1.28 2005/08/09 15:27:51 kloczek Exp $")
|
||||
#include <errno.h>
|
||||
#include "prototypes.h"
|
||||
#include <fcntl.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include "defines.h"
|
||||
#include "exitcodes.h"
|
||||
#include "groupio.h"
|
||||
#include "prototypes.h"
|
||||
#ifdef SHADOWGRP
|
||||
#include "sgroupio.h"
|
||||
#endif
|
||||
/* global variables */
|
||||
static char *Prog;
|
||||
|
||||
#ifdef SHADOWGRP
|
||||
@@ -77,7 +79,7 @@ static void usage (void)
|
||||
#else
|
||||
fprintf (stderr, _(" %s [-M user,...] group\n"), Prog);
|
||||
#endif
|
||||
exit (1);
|
||||
exit (E_USAGE);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -612,6 +614,8 @@ int main (int argc, char **argv)
|
||||
fprintf (stderr, _("%s: can't unlock file\n"), Prog);
|
||||
exit (1);
|
||||
}
|
||||
exit (0);
|
||||
/* NOT REACHED */
|
||||
|
||||
nscd_flush_cache ("group");
|
||||
|
||||
exit (E_SUCCESS);
|
||||
}
|
||||
|
173
src/groupadd.c
173
src/groupadd.c
@@ -30,9 +30,10 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: groupadd.c,v 1.37 2005/07/18 13:17:45 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: groupadd.c,v 1.41 2005/08/11 13:45:41 kloczek Exp $")
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <grp.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
@@ -94,7 +95,16 @@ static void fail_exit (int);
|
||||
|
||||
static void usage (void)
|
||||
{
|
||||
fprintf (stderr, _("Usage: groupadd [-g gid [-o]] [-f] group\n"));
|
||||
fprintf (stderr, _("Usage: groupadd [options] group\n"
|
||||
"\n"
|
||||
"Options:\n"
|
||||
" -f, --force force exit with success status if the specified\n"
|
||||
" group already exists\n"
|
||||
" -g, --gid GID use GID for the new group\n"
|
||||
" -h, --help display this help message and exit\n"
|
||||
" -K, --key KEY=VALUE overrides /etc/login.defs defaults\n"
|
||||
" -o, --non-unique allow create group with duplicate\n"
|
||||
" (non-unique) GID\n"));
|
||||
exit (E_USAGE);
|
||||
}
|
||||
|
||||
@@ -282,80 +292,6 @@ static void check_new_name (void)
|
||||
exit (E_BAD_ARG);
|
||||
}
|
||||
|
||||
/*
|
||||
* process_flags - perform command line argument setting
|
||||
*
|
||||
* process_flags() interprets the command line arguments and sets the
|
||||
* values that the user will be created with accordingly. The values
|
||||
* are checked for sanity.
|
||||
*/
|
||||
|
||||
static void process_flags (int argc, char **argv)
|
||||
{
|
||||
char *cp;
|
||||
int arg;
|
||||
|
||||
while ((arg = getopt (argc, argv, "fg:K:o")) != EOF) {
|
||||
switch (arg) {
|
||||
case 'f':
|
||||
/*
|
||||
* "force" - do nothing, just exit(0), if the
|
||||
* specified group already exists. With -g, if
|
||||
* specified gid already exists, choose another
|
||||
* (unique) gid (turn off -g). Based on the RedHat's
|
||||
* patch from shadow-utils-970616-9.
|
||||
*/
|
||||
fflg++;
|
||||
break;
|
||||
case 'g':
|
||||
gflg++;
|
||||
if (!isdigit (optarg[0]))
|
||||
usage ();
|
||||
|
||||
group_id = strtoul (optarg, &cp, 10);
|
||||
if (*cp != '\0') {
|
||||
fprintf (stderr,
|
||||
_("%s: invalid group %s\n"), Prog,
|
||||
optarg);
|
||||
fail_exit (E_BAD_ARG);
|
||||
}
|
||||
break;
|
||||
case 'K':
|
||||
/*
|
||||
* override login.defs defaults (-K name=value)
|
||||
* example: -K GID_MIN=100 -K GID_MAX=499
|
||||
* note: -K GID_MIN=10,GID_MAX=499 doesn't work yet
|
||||
*/
|
||||
cp = strchr (optarg, '=');
|
||||
if (!cp) {
|
||||
fprintf (stderr,
|
||||
_("%s: -K requires KEY=VALUE\n"),
|
||||
Prog);
|
||||
exit (E_BAD_ARG);
|
||||
}
|
||||
/* terminate name, point to value */
|
||||
*cp++ = '\0';
|
||||
if (putdef_str (optarg, cp) < 0)
|
||||
exit (E_BAD_ARG);
|
||||
break;
|
||||
case 'o':
|
||||
oflg++;
|
||||
break;
|
||||
default:
|
||||
usage ();
|
||||
}
|
||||
}
|
||||
|
||||
if (oflg && !gflg)
|
||||
usage ();
|
||||
|
||||
if (optind != argc - 1)
|
||||
usage ();
|
||||
|
||||
group_name = argv[argc - 1];
|
||||
check_new_name ();
|
||||
}
|
||||
|
||||
/*
|
||||
* close_files - close all of the files that were opened
|
||||
*
|
||||
@@ -456,7 +392,88 @@ int main (int argc, char **argv)
|
||||
|
||||
OPENLOG ("groupadd");
|
||||
|
||||
process_flags (argc, argv);
|
||||
{
|
||||
/*
|
||||
* Parse the command line options.
|
||||
*/
|
||||
char *cp;
|
||||
int option_index = 0;
|
||||
int c;
|
||||
static struct option long_options[] = {
|
||||
{"force", no_argument, NULL, 'f'},
|
||||
{"gid", required_argument, NULL, 'g'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"key", required_argument, NULL, 'K'},
|
||||
{"non-unique", required_argument, NULL, 'o'},
|
||||
{NULL, 0, NULL, '\0'}
|
||||
};
|
||||
|
||||
while ((c =
|
||||
getopt_long (argc, argv, "fg:hK:o", long_options,
|
||||
&option_index)) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
/*
|
||||
* "force" - do nothing, just exit(0), if the
|
||||
* specified group already exists. With -g, if
|
||||
* specified gid already exists, choose another
|
||||
* (unique) gid (turn off -g). Based on the RedHat's
|
||||
* patch from shadow-utils-970616-9.
|
||||
*/
|
||||
fflg++;
|
||||
break;
|
||||
case 'g':
|
||||
gflg++;
|
||||
if (!isdigit (optarg[0]))
|
||||
usage ();
|
||||
|
||||
group_id = strtoul (optarg, &cp, 10);
|
||||
if (*cp != '\0') {
|
||||
fprintf (stderr,
|
||||
_("%s: invalid group %s\n"),
|
||||
Prog, optarg);
|
||||
fail_exit (E_BAD_ARG);
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
usage ();
|
||||
break;
|
||||
case 'K':
|
||||
/*
|
||||
* override login.defs defaults (-K name=value)
|
||||
* example: -K GID_MIN=100 -K GID_MAX=499
|
||||
* note: -K GID_MIN=10,GID_MAX=499 doesn't work yet
|
||||
*/
|
||||
cp = strchr (optarg, '=');
|
||||
if (!cp) {
|
||||
fprintf (stderr,
|
||||
_
|
||||
("%s: -K requires KEY=VALUE\n"),
|
||||
Prog);
|
||||
exit (E_BAD_ARG);
|
||||
}
|
||||
/* terminate name, point to value */
|
||||
*cp++ = '\0';
|
||||
if (putdef_str (optarg, cp) < 0)
|
||||
exit (E_BAD_ARG);
|
||||
break;
|
||||
case 'o':
|
||||
oflg++;
|
||||
break;
|
||||
default:
|
||||
usage ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (oflg && !gflg)
|
||||
usage ();
|
||||
|
||||
if (optind != argc - 1)
|
||||
usage ();
|
||||
|
||||
group_name = argv[argc - 1];
|
||||
check_new_name ();
|
||||
|
||||
#ifdef USE_PAM
|
||||
retval = PAM_SUCCESS;
|
||||
@@ -488,8 +505,6 @@ int main (int argc, char **argv)
|
||||
fprintf (stderr, _("%s: PAM authentication failed\n"), Prog);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
OPENLOG ("groupadd");
|
||||
#endif /* USE_PAM */
|
||||
|
||||
#ifdef SHADOWGRP
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: groupdel.c,v 1.21 2005/05/25 19:31:51 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: groupdel.c,v 1.23 2005/08/11 16:23:34 kloczek Exp $")
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <grp.h>
|
||||
@@ -40,7 +40,6 @@ RCSID (PKG_VER "$Id: groupdel.c,v 1.21 2005/05/25 19:31:51 kloczek Exp $")
|
||||
#ifdef USE_PAM
|
||||
#include <security/pam_appl.h>
|
||||
#include <security/pam_misc.h>
|
||||
#include <pwd.h>
|
||||
#endif /* USE_PAM */
|
||||
#include "nscd.h"
|
||||
#include "prototypes.h"
|
||||
@@ -244,6 +243,8 @@ int main (int argc, char **argv)
|
||||
|
||||
group_name = argv[1];
|
||||
|
||||
OPENLOG ("groupdel");
|
||||
|
||||
#ifdef USE_PAM
|
||||
retval = PAM_SUCCESS;
|
||||
|
||||
@@ -276,8 +277,6 @@ int main (int argc, char **argv)
|
||||
}
|
||||
#endif /* USE_PAM */
|
||||
|
||||
OPENLOG ("groupdel");
|
||||
|
||||
#ifdef SHADOWGRP
|
||||
is_shadow_grp = sgr_file_present ();
|
||||
#endif
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: groupmod.c,v 1.29 2005/07/07 15:11:48 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: groupmod.c,v 1.30 2005/08/02 17:49:17 kloczek Exp $")
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <grp.h>
|
||||
@@ -426,6 +426,8 @@ int main (int argc, char **argv)
|
||||
|
||||
process_flags (argc, argv);
|
||||
|
||||
OPENLOG ("groupmod");
|
||||
|
||||
#ifdef USE_PAM
|
||||
retval = PAM_SUCCESS;
|
||||
|
||||
@@ -458,8 +460,6 @@ int main (int argc, char **argv)
|
||||
}
|
||||
#endif /* USE_PAM */
|
||||
|
||||
OPENLOG ("groupmod");
|
||||
|
||||
#ifdef SHADOWGRP
|
||||
is_shadow_grp = sgr_file_present ();
|
||||
#endif
|
||||
|
12
src/grpck.c
12
src/grpck.c
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: grpck.c,v 1.23 2005/04/06 04:26:06 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: grpck.c,v 1.25 2005/08/09 15:27:51 kloczek Exp $")
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <grp.h>
|
||||
@@ -104,7 +104,7 @@ static int yes_or_no (void)
|
||||
*/
|
||||
|
||||
if (read_only) {
|
||||
puts (_("No"));
|
||||
printf (_("No\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ int main (int argc, char **argv)
|
||||
* another and ask them to delete it.
|
||||
*/
|
||||
|
||||
puts (_("duplicate group entry\n"));
|
||||
printf (_("duplicate group entry\n"));
|
||||
printf (_("delete line `%s'? "), gre->line);
|
||||
errors++;
|
||||
|
||||
@@ -512,7 +512,7 @@ int main (int argc, char **argv)
|
||||
* another and ask them to delete it.
|
||||
*/
|
||||
|
||||
puts (_("duplicate shadow group entry\n"));
|
||||
printf (_("duplicate shadow group entry\n"));
|
||||
printf (_("delete line `%s'? "), sge->line);
|
||||
errors++;
|
||||
|
||||
@@ -529,7 +529,7 @@ int main (int argc, char **argv)
|
||||
*/
|
||||
|
||||
if (!gr_locate (sgr->sg_name)) {
|
||||
puts (_("no matching group file entry\n"));
|
||||
printf (_("no matching group file entry\n"));
|
||||
printf (_("delete line `%s'? "), sge->line);
|
||||
errors++;
|
||||
if (yes_or_no ())
|
||||
@@ -631,6 +631,8 @@ int main (int argc, char **argv)
|
||||
#endif
|
||||
(void) gr_unlock ();
|
||||
|
||||
nscd_flush_cache ("group");
|
||||
|
||||
/*
|
||||
* Tell the user what we did and exit.
|
||||
*/
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#include "sgroupio.h"
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: grpconv.c,v 1.16 2005/03/31 05:14:54 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: grpconv.c,v 1.17 2005/08/09 15:27:51 kloczek Exp $")
|
||||
|
||||
static int group_locked = 0;
|
||||
static int gshadow_locked = 0;
|
||||
@@ -154,6 +154,9 @@ int main (int argc, char **argv)
|
||||
}
|
||||
sgr_unlock ();
|
||||
gr_unlock ();
|
||||
|
||||
nscd_flush_cache ("group");
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else /* !SHADOWGRP */
|
||||
|
@@ -11,7 +11,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: grpunconv.c,v 1.14 2005/03/31 05:14:54 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: grpunconv.c,v 1.15 2005/08/09 15:27:51 kloczek Exp $")
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -111,6 +111,9 @@ int main (int argc, char **argv)
|
||||
|
||||
sgr_unlock ();
|
||||
gr_unlock ();
|
||||
|
||||
nscd_flush_cache ("group");
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else /* !SHADOWGRP */
|
||||
|
47
src/login.c
47
src/login.c
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: login.c,v 1.66 2005/07/07 15:32:50 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: login.c,v 1.67 2005/08/11 11:26:11 kloczek Exp $")
|
||||
#include "prototypes.h"
|
||||
#include "defines.h"
|
||||
#include <sys/stat.h>
|
||||
@@ -964,36 +964,27 @@ int main (int argc, char **argv)
|
||||
/*
|
||||
* We must fork before setuid() because we need to call
|
||||
* pam_close_session() as root.
|
||||
*
|
||||
* Note: not true in other (non-Linux) PAM implementations, where
|
||||
* the parent process of login (init, telnetd, ...) is responsible
|
||||
* for calling pam_close_session(). This avoids an extra process for
|
||||
* each login. Maybe we should do this on Linux too? We let the
|
||||
* admin configure whether they need to keep login around to close
|
||||
* sessions.
|
||||
*/
|
||||
if (getdef_bool ("CLOSE_SESSIONS")) {
|
||||
signal (SIGINT, SIG_IGN);
|
||||
child = fork ();
|
||||
if (child < 0) {
|
||||
/* error in fork() */
|
||||
fprintf (stderr,
|
||||
"login: failure forking: %s",
|
||||
strerror (errno));
|
||||
PAM_END;
|
||||
exit (0);
|
||||
} else if (child) {
|
||||
/*
|
||||
* parent - wait for child to finish, then cleanup
|
||||
* session
|
||||
*/
|
||||
wait (NULL);
|
||||
PAM_END;
|
||||
exit (0);
|
||||
}
|
||||
/* child */
|
||||
signal (SIGINT, SIG_IGN);
|
||||
child = fork ();
|
||||
if (child < 0) {
|
||||
/* error in fork() */
|
||||
fprintf (stderr, "login: failure forking: %s",
|
||||
strerror (errno));
|
||||
PAM_END;
|
||||
exit (0);
|
||||
} else if (child) {
|
||||
/*
|
||||
* parent - wait for child to finish, then cleanup
|
||||
* session
|
||||
*/
|
||||
wait (NULL);
|
||||
PAM_END;
|
||||
exit (0);
|
||||
}
|
||||
/* child */
|
||||
#endif
|
||||
|
||||
/* We call set_groups() above because this clobbers pam_groups.so */
|
||||
#ifndef USE_PAM
|
||||
if (setup_uid_gid (&pwent, is_console))
|
||||
|
99
src/newgrp.c
99
src/newgrp.c
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: newgrp.c,v 1.34 2005/07/08 17:58:55 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: newgrp.c,v 1.35 2005/08/11 11:26:11 kloczek Exp $")
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <grp.h>
|
||||
@@ -440,58 +440,55 @@ int main (int argc, char **argv)
|
||||
"user `%s' (login `%s' on %s) switched to group `%s'",
|
||||
name, loginname, tty, group));
|
||||
#ifdef USE_PAM
|
||||
if (getdef_bool ("CLOSE_SESSIONS")) {
|
||||
/*
|
||||
* We want to fork and exec the new shell in the child, leaving the
|
||||
* parent waiting to log the session close.
|
||||
*
|
||||
* The parent must ignore signals generated from the console
|
||||
* (SIGINT, SIGQUIT, SIGHUP) which might make the parent terminate
|
||||
* before its child. When bash is exec'ed as the subshell, it
|
||||
* generates a new process group id for itself, and consequently
|
||||
* only SIGHUP, which is sent to all process groups in the session,
|
||||
* can reach the parent. However, since arbitrary programs can be
|
||||
* specified as login shells, there is no such guarantee in general.
|
||||
* For the same reason, we must also ignore stop signals generated
|
||||
* from the console (SIGTSTP, SIGTTIN, and SIGTTOU) in order to
|
||||
* avoid any possibility of the parent being stopped when it
|
||||
* receives SIGCHLD from the terminating subshell. -- JWP
|
||||
*/
|
||||
pid_t child, pid;
|
||||
/*
|
||||
* We want to fork and exec the new shell in the child, leaving the
|
||||
* parent waiting to log the session close.
|
||||
*
|
||||
* The parent must ignore signals generated from the console
|
||||
* (SIGINT, SIGQUIT, SIGHUP) which might make the parent terminate
|
||||
* before its child. When bash is exec'ed as the subshell, it
|
||||
* generates a new process group id for itself, and consequently
|
||||
* only SIGHUP, which is sent to all process groups in the session,
|
||||
* can reach the parent. However, since arbitrary programs can be
|
||||
* specified as login shells, there is no such guarantee in general.
|
||||
* For the same reason, we must also ignore stop signals generated
|
||||
* from the console (SIGTSTP, SIGTTIN, and SIGTTOU) in order to
|
||||
* avoid any possibility of the parent being stopped when it
|
||||
* receives SIGCHLD from the terminating subshell. -- JWP
|
||||
*/
|
||||
pid_t child, pid;
|
||||
|
||||
signal (SIGINT, SIG_IGN);
|
||||
signal (SIGQUIT, SIG_IGN);
|
||||
signal (SIGHUP, SIG_IGN);
|
||||
signal (SIGTSTP, SIG_IGN);
|
||||
signal (SIGTTIN, SIG_IGN);
|
||||
signal (SIGTTOU, SIG_IGN);
|
||||
child = fork ();
|
||||
if (child < 0) {
|
||||
/* error in fork() */
|
||||
fprintf (stderr, "%s: failure forking: %s",
|
||||
is_newgrp ? "newgrp" : "sg",
|
||||
strerror (errno));
|
||||
exit (1);
|
||||
} else if (child) {
|
||||
/* parent - wait for child to finish, then log session close */
|
||||
do {
|
||||
pid = waitpid (child, NULL, 0);
|
||||
} while (pid != child);
|
||||
SYSLOG ((LOG_INFO,
|
||||
"user `%s' (login `%s' on %s) returned to group `%s'",
|
||||
name, loginname, tty,
|
||||
getgrgid (gid)->gr_name));
|
||||
closelog ();
|
||||
exit (0);
|
||||
}
|
||||
/* child - restore signals to their default state */
|
||||
signal (SIGINT, SIG_DFL);
|
||||
signal (SIGQUIT, SIG_DFL);
|
||||
signal (SIGHUP, SIG_DFL);
|
||||
signal (SIGTSTP, SIG_DFL);
|
||||
signal (SIGTTIN, SIG_DFL);
|
||||
signal (SIGTTOU, SIG_DFL);
|
||||
signal (SIGINT, SIG_IGN);
|
||||
signal (SIGQUIT, SIG_IGN);
|
||||
signal (SIGHUP, SIG_IGN);
|
||||
signal (SIGTSTP, SIG_IGN);
|
||||
signal (SIGTTIN, SIG_IGN);
|
||||
signal (SIGTTOU, SIG_IGN);
|
||||
child = fork ();
|
||||
if (child < 0) {
|
||||
/* error in fork() */
|
||||
fprintf (stderr, "%s: failure forking: %s",
|
||||
is_newgrp ? "newgrp" : "sg", strerror (errno));
|
||||
exit (1);
|
||||
} else if (child) {
|
||||
/* parent - wait for child to finish, then log session close */
|
||||
do {
|
||||
pid = waitpid (child, NULL, 0);
|
||||
} while (pid != child);
|
||||
SYSLOG ((LOG_INFO,
|
||||
"user `%s' (login `%s' on %s) returned to group `%s'",
|
||||
name, loginname, tty,
|
||||
getgrgid (gid)->gr_name));
|
||||
closelog ();
|
||||
exit (0);
|
||||
}
|
||||
/* child - restore signals to their default state */
|
||||
signal (SIGINT, SIG_DFL);
|
||||
signal (SIGQUIT, SIG_DFL);
|
||||
signal (SIGHUP, SIG_DFL);
|
||||
signal (SIGTSTP, SIG_DFL);
|
||||
signal (SIGTTIN, SIG_DFL);
|
||||
signal (SIGTTOU, SIG_DFL);
|
||||
#endif /* USE_PAM */
|
||||
}
|
||||
#endif /* USE_SYSLOG */
|
||||
|
@@ -36,7 +36,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: newusers.c,v 1.23 2005/05/25 19:31:51 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: newusers.c,v 1.26 2005/08/11 16:23:34 kloczek Exp $")
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "prototypes.h"
|
||||
@@ -48,7 +48,6 @@ RCSID (PKG_VER "$Id: newusers.c,v 1.23 2005/05/25 19:31:51 kloczek Exp $")
|
||||
#ifdef USE_PAM
|
||||
#include <security/pam_appl.h>
|
||||
#include <security/pam_misc.h>
|
||||
#include <pwd.h>
|
||||
#endif /* USE_PAM */
|
||||
static char *Prog;
|
||||
|
||||
@@ -553,6 +552,10 @@ int main (int argc, char **argv)
|
||||
(void) pw_unlock ();
|
||||
exit (1);
|
||||
}
|
||||
|
||||
nscd_flush_cache ("passwd");
|
||||
nscd_flush_cache ("group");
|
||||
|
||||
(void) gr_unlock ();
|
||||
if (is_shadow)
|
||||
spw_unlock ();
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: passwd.c,v 1.41 2005/07/07 15:32:50 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: passwd.c,v 1.44 2005/08/03 16:00:46 kloczek Exp $")
|
||||
#include "prototypes.h"
|
||||
#include "defines.h"
|
||||
#include <sys/types.h>
|
||||
@@ -913,12 +913,14 @@ int main (int argc, char **argv)
|
||||
|
||||
nscd_flush_cache ("passwd");
|
||||
nscd_flush_cache ("group");
|
||||
nscd_flush_cache ("shadow");
|
||||
|
||||
SYSLOG ((LOG_INFO, "password for `%s' changed by `%s'", name, myname));
|
||||
closelog ();
|
||||
if (!qflg)
|
||||
printf (_("Password changed.\n"));
|
||||
if (!eflg)
|
||||
printf (_("Password changed.\n"));
|
||||
else
|
||||
printf (_("Password set to expire.\n"));
|
||||
exit (E_SUCCESS);
|
||||
/* NOT REACHED */
|
||||
}
|
||||
|
14
src/pwck.c
14
src/pwck.c
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: pwck.c,v 1.27 2005/05/25 18:20:25 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: pwck.c,v 1.29 2005/08/09 15:27:02 kloczek Exp $")
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <grp.h>
|
||||
@@ -97,7 +97,7 @@ static int yes_or_no (void)
|
||||
*/
|
||||
|
||||
if (read_only) {
|
||||
puts (_("No"));
|
||||
printf (_("No\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ int main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
OPENLOG ("pwsk");
|
||||
OPENLOG ("pwck");
|
||||
|
||||
/*
|
||||
* Parse the command line arguments
|
||||
@@ -329,7 +329,7 @@ int main (int argc, char **argv)
|
||||
* another and ask them to delete it.
|
||||
*/
|
||||
|
||||
puts (_("duplicate password entry\n"));
|
||||
printf (_("duplicate password entry\n"));
|
||||
printf (_("delete line `%s'? "), pfe->line);
|
||||
errors++;
|
||||
|
||||
@@ -488,7 +488,7 @@ int main (int argc, char **argv)
|
||||
* another and ask them to delete it.
|
||||
*/
|
||||
|
||||
puts (_("duplicate shadow password entry\n"));
|
||||
printf (_("duplicate shadow password entry\n"));
|
||||
printf (_("delete line `%s'? "), spe->line);
|
||||
errors++;
|
||||
|
||||
@@ -512,7 +512,7 @@ int main (int argc, char **argv)
|
||||
* /etc/passwd entry and ask them to delete it.
|
||||
*/
|
||||
|
||||
puts (_("no matching password file entry\n"));
|
||||
printf (_("no matching password file entry\n"));
|
||||
printf (_("delete line `%s'? "), spe->line);
|
||||
errors++;
|
||||
|
||||
@@ -569,6 +569,8 @@ int main (int argc, char **argv)
|
||||
spw_unlock ();
|
||||
(void) pw_unlock ();
|
||||
|
||||
nscd_flush_cache ("passwd");
|
||||
|
||||
/*
|
||||
* Tell the user what we did and exit.
|
||||
*/
|
||||
|
@@ -29,7 +29,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: pwconv.c,v 1.17 2005/05/25 18:20:25 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: pwconv.c,v 1.18 2005/08/09 15:27:02 kloczek Exp $")
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -176,5 +176,8 @@ int main (int argc, char **argv)
|
||||
chmod (PASSWD_FILE "-", 0600); /* /etc/passwd- (backup file) */
|
||||
spw_unlock ();
|
||||
pw_unlock ();
|
||||
|
||||
nscd_flush_cache ("passwd");
|
||||
|
||||
exit (E_SUCCESS);
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: pwunconv.c,v 1.17 2005/05/25 18:20:25 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: pwunconv.c,v 1.18 2005/08/03 16:00:46 kloczek Exp $")
|
||||
#include "defines.h"
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
@@ -147,7 +147,6 @@ int main (int argc, char **argv)
|
||||
pw_unlock ();
|
||||
|
||||
nscd_flush_cache ("passwd");
|
||||
nscd_flush_cache ("shadow");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
8
src/su.c
8
src/su.c
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: su.c,v 1.39 2005/07/18 10:14:39 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: su.c,v 1.41 2005/08/04 19:13:43 kloczek Exp $")
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
@@ -584,10 +584,9 @@ int main (int argc, char **argv)
|
||||
#endif /* !USE_PAM */
|
||||
|
||||
signal (SIGINT, SIG_DFL);
|
||||
#ifndef USE_PAM
|
||||
cp = getdef_str ((pwent.pw_uid == 0) ? "ENV_SUPATH" : "ENV_PATH");
|
||||
signal (SIGQUIT, SIG_DFL);
|
||||
|
||||
/* XXX very similar code duplicated in libmisc/setupenv.c */
|
||||
cp = getdef_str ((pwent.pw_uid == 0) ? "ENV_SUPATH" : "ENV_PATH");
|
||||
if (!cp) {
|
||||
addenv ("PATH=/bin:/usr/bin", NULL);
|
||||
} else if (strchr (cp, '=')) {
|
||||
@@ -597,7 +596,6 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
environ = newenvp; /* make new environment active */
|
||||
#endif /* !USE_PAM */
|
||||
|
||||
if (getenv ("IFS")) /* don't export user IFS ... */
|
||||
addenv ("IFS= \t\n", NULL); /* ... instead, set a safe IFS */
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: useradd.c,v 1.67 2005/07/11 11:58:00 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: useradd.c,v 1.75 2005/08/11 16:23:34 kloczek Exp $")
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@@ -41,7 +41,6 @@ RCSID (PKG_VER "$Id: useradd.c,v 1.67 2005/07/11 11:58:00 kloczek Exp $")
|
||||
#ifdef USE_PAM
|
||||
#include <security/pam_appl.h>
|
||||
#include <security/pam_misc.h>
|
||||
#include <pwd.h>
|
||||
#endif /* USE_PAM */
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -343,7 +342,7 @@ static void get_defaults (void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Create by default user mail spoll or not ?
|
||||
* Create by default user mail spool or not ?
|
||||
*/
|
||||
else if (MATCH (buf, CREATE_MAIL_SPOOL)) {
|
||||
if (*cp == '\0')
|
||||
@@ -634,7 +633,7 @@ static void usage (void)
|
||||
fprintf (stderr, _("Usage: useradd [options] LOGIN\n"
|
||||
"\n"
|
||||
"Options:\n"
|
||||
" -b, --base-dir BASE_DIR base directory for the the new user account\n"
|
||||
" -b, --base-dir BASE_DIR base directory for the new user account\n"
|
||||
" home directory\n"
|
||||
" -c, --comment COMMENT set the GECOS field for the new user account\n"
|
||||
" -d, --home-dir HOME_DIR home directory for the new user account\n"
|
||||
@@ -1563,7 +1562,7 @@ int main (int argc, char **argv)
|
||||
* - open the files,
|
||||
* - create the user entries,
|
||||
* - create the home directory,
|
||||
* - create user mail spoll,
|
||||
* - create user mail spool,
|
||||
* - flush nscd caches for passwd and group services,
|
||||
* - then close and update the files.
|
||||
*/
|
||||
@@ -1574,7 +1573,14 @@ int main (int argc, char **argv)
|
||||
|
||||
if (mflg) {
|
||||
create_home ();
|
||||
copy_tree (def_template, user_home, user_id, user_gid);
|
||||
if (home_added)
|
||||
copy_tree (def_template, user_home, user_id, user_gid);
|
||||
else
|
||||
fprintf (stderr,
|
||||
_
|
||||
("%s: warning: the home directory already exists.\n"
|
||||
"Not copying any file from skel directory into it.\n"), Prog);
|
||||
|
||||
} else if (getdef_str ("CREATE_HOME")) {
|
||||
/*
|
||||
* RedHat added the CREATE_HOME option in login.defs in their
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: userdel.c,v 1.41 2005/06/20 10:17:09 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: userdel.c,v 1.45 2005/08/11 16:23:34 kloczek Exp $")
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
@@ -41,7 +41,6 @@ RCSID (PKG_VER "$Id: userdel.c,v 1.41 2005/06/20 10:17:09 kloczek Exp $")
|
||||
#ifdef USE_PAM
|
||||
#include <security/pam_appl.h>
|
||||
#include <security/pam_misc.h>
|
||||
#include <pwd.h>
|
||||
#endif /* USE_PAM */
|
||||
#include "prototypes.h"
|
||||
#include "defines.h"
|
||||
@@ -541,6 +540,8 @@ int main (int argc, char **argv)
|
||||
if (optind + 1 != argc)
|
||||
usage ();
|
||||
|
||||
OPENLOG ("userdel");
|
||||
|
||||
#ifdef USE_PAM
|
||||
retval = PAM_SUCCESS;
|
||||
pampw = getpwuid (getuid ());
|
||||
@@ -569,8 +570,6 @@ int main (int argc, char **argv)
|
||||
}
|
||||
#endif /* USE_PAM */
|
||||
|
||||
OPENLOG ("userdel");
|
||||
|
||||
is_shadow_pwd = spw_file_present ();
|
||||
#ifdef SHADOWGRP
|
||||
is_shadow_grp = sgr_file_present ();
|
||||
@@ -622,7 +621,6 @@ int main (int argc, char **argv)
|
||||
|
||||
nscd_flush_cache ("passwd");
|
||||
nscd_flush_cache ("group");
|
||||
nscd_flush_cache ("shadow");
|
||||
|
||||
if (rflg)
|
||||
remove_mailbox ();
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: usermod.c,v 1.47 2005/07/07 15:11:48 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: usermod.c,v 1.51 2005/08/11 16:23:34 kloczek Exp $")
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
@@ -43,7 +43,6 @@ RCSID (PKG_VER "$Id: usermod.c,v 1.47 2005/07/07 15:11:48 kloczek Exp $")
|
||||
#ifdef USE_PAM
|
||||
#include <security/pam_appl.h>
|
||||
#include <security/pam_misc.h>
|
||||
#include <pwd.h>
|
||||
#endif /* USE_PAM */
|
||||
#include "prototypes.h"
|
||||
#include "defines.h"
|
||||
@@ -389,6 +388,8 @@ static void new_spent (struct spwd *spent)
|
||||
spent->sp_expire = user_expire;
|
||||
}
|
||||
spent->sp_pwdp = new_pw_passwd (spent->sp_pwdp, spent->sp_namp);
|
||||
if (pflg)
|
||||
spent->sp_lstchg = time ((time_t *) 0) / SCALE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -736,8 +737,7 @@ static void process_flags (int argc, char **argv)
|
||||
user_inactive = spwd->sp_inact;
|
||||
}
|
||||
|
||||
while ((arg =
|
||||
getopt (argc, argv, "ac:d:e:f:g:G:l:Lmop:s:u:U")) != EOF) {
|
||||
while ((arg = getopt (argc, argv, "ac:d:e:f:g:G:l:Lmop:s:u:U")) != EOF) {
|
||||
switch (arg) {
|
||||
case 'a':
|
||||
aflg++;
|
||||
|
@@ -23,7 +23,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "rcsid.h"
|
||||
RCSID (PKG_VER "$Id: vipw.c,v 1.12 2005/07/07 15:32:50 kloczek Exp $")
|
||||
RCSID (PKG_VER "$Id: vipw.c,v 1.14 2005/08/03 16:00:46 kloczek Exp $")
|
||||
#include "defines.h"
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -255,6 +255,6 @@ int main (int argc, char **argv)
|
||||
|
||||
nscd_flush_cache ("passwd");
|
||||
nscd_flush_cache ("group");
|
||||
nscd_flush_cache ("shadow");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user