+2008-09-06 Nicolas François <nicolas.francois@centraliens.net>
+
+ * src/newgrp.c, src/userdel.c, src/grpck.c, src/gpasswd.c,
+ src/newusers.c, src/pwconv.c, src/chpasswd.c, src/logoutd.c,
+ src/chfn.c, src/groupmems.c, src/usermod.c, src/pwunconv.c,
+ src/expiry.c, src/groupdel.c, src/chgpasswd.c, src/useradd.c,
+ src/su.c, src/groupmod.c, src/passwd.c, src/pwck.c,
+ src/groupadd.c, src/chage.c, src/login.c, src/grpconv.c,
+ src/groups.c, src/grpunconv.c, src/chsh.c: Prog is now global (not
+ static to the file) so that it can be used by the helper functions
+ of libmisc.
+ * lib/prototypes.h: Added extern char *Prog.
+ * libmisc/find_new_gid.c, libmisc/find_new_uid.c: Indicate the
+ program name with the warning.
+
2008-09-05 Nicolas François <nicolas.francois@centraliens.net>
* configure.in: Check if AUDIT_ADD_USER, AUDIT_DEL_USER,
#include "defines.h"
#include "commonio.h"
+extern char *Prog;
+
/* addgrps.c */
extern int add_groups (const char *);
extern void add_cons_grps (void);
}
}
if (group_id == gid_max) {
- fputs (_("Can't get unique GID (no more available GIDs)\n"), stderr);
+ fprintf (stderr, _("%s: Can't get unique GID (no more available GIDs)\n"), Prog);
+ SYSLOG ((LOG_WARN, "no more available GID on the system"));
return -1;
}
}
}
}
if (user_id == uid_max) {
- fputs (_("Can't get unique UID (no more available UIDs)\n"), stderr);
+ fprintf (stderr, _("Prog: Can't get unique UID (no more available UIDs)\n"), Prog);
+ SYSLOG ((LOG_WARN, "no more available UID on the system"));
return -1;
}
}
/*
* Global variables
*/
-static char *Prog;
+char *Prog;
static bool
dflg = false, /* set last password change date */
/*
* Global variables.
*/
-static char *Prog;
+char *Prog;
static char fullnm[BUFSIZ];
static char roomno[BUFSIZ];
static char workph[BUFSIZ];
/*
* Global variables
*/
-static char *Prog;
+char *Prog;
static bool cflg = false;
static bool eflg = false;
static bool md5flg = false;
/*
* Global variables
*/
-static char *Prog;
+char *Prog;
static bool cflg = false;
static bool eflg = false;
static bool md5flg = false;
/*
* Global variables
*/
-static char *Prog; /* Program name */
+char *Prog; /* Program name */
static bool amroot; /* Real UID is root */
static char loginsh[BUFSIZ]; /* Name of new login shell */
/* command line options */
#include <sys/types.h>
#include "defines.h"
#include "prototypes.h"
+
+/* Global variables */
+char *Prog;
+
/* local function prototypes */
static RETSIGTYPE catch_signals (int);
static void usage (void);
int main (int argc, char **argv)
{
struct passwd *pwd;
-
struct spwd *spwd;
- char *Prog = Basename (argv[0]);
+
+ Prog = Basename (argv[0]);
sanitize_env ();
* Global variables
*/
/* The name of this command, as it is invoked */
-static char *Prog;
+char *Prog;
#ifdef SHADOWGRP
/* Indicate if shadow groups are enabled on the system
/*
* Global variables
*/
+char *Prog;
+
static char *group_name;
static gid_t group_id;
static char *group_passwd;
static char *empty_list = NULL;
-static char *Prog;
-
static bool oflg = false; /* permit non-unique group ID to be specified with -g */
static bool gflg = false; /* ID value for the new group */
static bool fflg = false; /* if group already exists, do nothing and exit(0) */
/*
* Global variables
*/
+char *Prog;
+
static char *group_name;
-static char *Prog;
static gid_t group_id = -1;
#ifdef SHADOWGRP
/*
* Global variables
*/
+char *Prog;
+
static char *adduser = NULL;
static char *deluser = NULL;
static char *thisgroup = NULL;
static bool purge = false;
static bool list = false;
static int exclusive = 0;
-static char *Prog;
static bool gr_locked = false;
#ifdef SHADOWGRP
/* Indicate if shadow groups are enabled on the system
/*
* Global variables
*/
+char *Prog;
+
#ifdef SHADOWGRP
static bool is_shadow_grp;
static bool sgr_locked = false;
static gid_t group_id;
static gid_t group_newid;
-static char *Prog;
-
static bool
oflg = false, /* permit non-unique group ID to be specified with -g */
gflg = false, /* new ID value for the group */
/*
* Global variables
*/
-static char *Prog;
+char *Prog;
/* local function prototypes */
static void print_groups (const char *member);
/*
* Global variables
*/
-static char *Prog;
+char *Prog;
+
static const char *grp_file = GROUP_FILE;
static bool use_system_grp_file = true;
/*
* Global variables
*/
+char *Prog;
+
static bool gr_locked = false;
static bool sgr_locked = false;
-static char *Prog;
/* local function prototypes */
static void fail_exit (int status);
/*
* Global variables
*/
+char *Prog;
+
static bool gr_locked = false;
static bool sgr_locked = false;
-static char *Prog;
/* local function prototypes */
static void fail_exit (int status);
/*
* Global variables.
*/
+char *Prog;
-static char *Prog;
static bool amroot;
static int timeout;
/*
* Global variables
*/
-static char *Prog;
+char *Prog;
#ifndef DEFAULT_HUP_MESG
#define DEFAULT_HUP_MESG _("login time exceeded\n\n")
/*
* Global variables
*/
+char *Prog;
+
extern char **newenvp;
extern char **environ;
static GETGROUPS_T *grouplist;
#endif
-static char *Prog;
static bool is_newgrp;
#ifdef WITH_AUDIT
/*
* Global variables
*/
-static char *Prog;
+char *Prog;
+
static bool cflg = false;
static bool rflg = false; /* create a system account */
static bool sflg = false;
/*
* Global variables
*/
+char *Prog; /* Program name */
+
static char *name; /* The name of user whose password is being changed */
static char *myname; /* The current user's name */
-static char *Prog; /* Program name */
static bool amroot; /* The caller's real UID was 0 */
static bool
/*
* Global variables
*/
+char *Prog;
-static char *Prog;
static const char *pwd_file = PASSWD_FILE;
static bool use_system_pw_file = true;
static const char *spw_file = SHADOW_FILE;
/*
* Global variables
*/
-static char *Prog;
+char *Prog;
+
static bool spw_locked = false;
static bool pw_locked = false;
/*
* Global variables
*/
-static char *Prog;
+char *Prog;
+
static bool spw_locked = false;
static bool pw_locked = false;
/*
* Global variables
*/
+char *Prog;
+
/* not needed by sulog.c anymore */
static char name[BUFSIZ];
static char oldname[BUFSIZ];
static bool caught = false;
#endif
-static char *Prog;
extern struct passwd pwent;
/*
/*
* Global variables
*/
+char *Prog;
+
/*
* These defaults are used if there is no defaults file.
*/
static long sys_ngroups;
static bool do_grp_update = false; /* group files need to be updated */
-static char *Prog;
-
static bool
bflg = false, /* new default root of home directory */
cflg = false, /* comment (GECOS) field for new account */
#define E_USER_BUSY 8 /* user currently logged in */
#define E_GRP_UPDATE 10 /* can't update group file */
#define E_HOMEDIR 12 /* can't remove home directory */
+
+/*
+ * Global variables
+ */
+char *Prog;
+
static char *user_name;
static uid_t user_id;
static char *user_home;
-static char *Prog;
static bool fflg = false;
static bool rflg = false;
/*
* Global variables
*/
+char *Prog;
+
static char *user_name;
static char *user_newname;
static char *user_pass;
static long sys_ngroups;
static char **user_groups; /* NULL-terminated list */
-static char *Prog;
-
static bool
aflg = false, /* append to existing secondary group set */
cflg = false, /* new comment (GECOS) field */