* 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.
This commit is contained in:
parent
7034a913fd
commit
ee4e367ea8
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
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>
|
2008-09-05 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* configure.in: Check if AUDIT_ADD_USER, AUDIT_DEL_USER,
|
* configure.in: Check if AUDIT_ADD_USER, AUDIT_DEL_USER,
|
||||||
|
@ -57,6 +57,8 @@
|
|||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "commonio.h"
|
#include "commonio.h"
|
||||||
|
|
||||||
|
extern char *Prog;
|
||||||
|
|
||||||
/* addgrps.c */
|
/* addgrps.c */
|
||||||
extern int add_groups (const char *);
|
extern int add_groups (const char *);
|
||||||
extern void add_cons_grps (void);
|
extern void add_cons_grps (void);
|
||||||
|
@ -110,7 +110,8 @@ int find_new_gid (bool sys_group, gid_t *gid, gid_t const *preferred_gid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (group_id == gid_max) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,8 @@ int find_new_uid (bool sys_user, uid_t *uid, uid_t const *preferred_uid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (user_id == uid_max) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
static char *Prog;
|
char *Prog;
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
dflg = false, /* set last password change date */
|
dflg = false, /* set last password change date */
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables.
|
* Global variables.
|
||||||
*/
|
*/
|
||||||
static char *Prog;
|
char *Prog;
|
||||||
static char fullnm[BUFSIZ];
|
static char fullnm[BUFSIZ];
|
||||||
static char roomno[BUFSIZ];
|
static char roomno[BUFSIZ];
|
||||||
static char workph[BUFSIZ];
|
static char workph[BUFSIZ];
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
static char *Prog;
|
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;
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
static char *Prog;
|
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;
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
static char *Prog; /* Program name */
|
char *Prog; /* Program name */
|
||||||
static bool amroot; /* Real UID is root */
|
static bool amroot; /* Real UID is root */
|
||||||
static char loginsh[BUFSIZ]; /* Name of new login shell */
|
static char loginsh[BUFSIZ]; /* Name of new login shell */
|
||||||
/* command line options */
|
/* command line options */
|
||||||
|
@ -40,6 +40,10 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
|
||||||
|
/* Global variables */
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static RETSIGTYPE catch_signals (int);
|
static RETSIGTYPE catch_signals (int);
|
||||||
static void usage (void);
|
static void usage (void);
|
||||||
@ -70,9 +74,9 @@ static void usage (void)
|
|||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
|
|
||||||
struct spwd *spwd;
|
struct spwd *spwd;
|
||||||
char *Prog = Basename (argv[0]);
|
|
||||||
|
Prog = Basename (argv[0]);
|
||||||
|
|
||||||
sanitize_env ();
|
sanitize_env ();
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
/* The name of this command, as it is invoked */
|
/* The name of this command, as it is invoked */
|
||||||
static char *Prog;
|
char *Prog;
|
||||||
|
|
||||||
#ifdef SHADOWGRP
|
#ifdef SHADOWGRP
|
||||||
/* Indicate if shadow groups are enabled on the system
|
/* Indicate if shadow groups are enabled on the system
|
||||||
|
@ -68,13 +68,13 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
static char *group_name;
|
static char *group_name;
|
||||||
static gid_t group_id;
|
static gid_t group_id;
|
||||||
static char *group_passwd;
|
static char *group_passwd;
|
||||||
static char *empty_list = NULL;
|
static char *empty_list = NULL;
|
||||||
|
|
||||||
static char *Prog;
|
|
||||||
|
|
||||||
static bool oflg = false; /* permit non-unique group ID to be specified with -g */
|
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 gflg = false; /* ID value for the new group */
|
||||||
static bool fflg = false; /* if group already exists, do nothing and exit(0) */
|
static bool fflg = false; /* if group already exists, do nothing and exit(0) */
|
||||||
|
@ -53,8 +53,9 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
static char *group_name;
|
static char *group_name;
|
||||||
static char *Prog;
|
|
||||||
static gid_t group_id = -1;
|
static gid_t group_id = -1;
|
||||||
|
|
||||||
#ifdef SHADOWGRP
|
#ifdef SHADOWGRP
|
||||||
|
@ -64,13 +64,14 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
static char *adduser = NULL;
|
static char *adduser = NULL;
|
||||||
static char *deluser = NULL;
|
static char *deluser = NULL;
|
||||||
static char *thisgroup = NULL;
|
static char *thisgroup = NULL;
|
||||||
static bool purge = false;
|
static bool purge = false;
|
||||||
static bool list = false;
|
static bool list = false;
|
||||||
static int exclusive = 0;
|
static int exclusive = 0;
|
||||||
static char *Prog;
|
|
||||||
static bool gr_locked = false;
|
static bool gr_locked = false;
|
||||||
#ifdef SHADOWGRP
|
#ifdef SHADOWGRP
|
||||||
/* Indicate if shadow groups are enabled on the system
|
/* Indicate if shadow groups are enabled on the system
|
||||||
|
@ -66,6 +66,8 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
#ifdef SHADOWGRP
|
#ifdef SHADOWGRP
|
||||||
static bool is_shadow_grp;
|
static bool is_shadow_grp;
|
||||||
static bool sgr_locked = false;
|
static bool sgr_locked = false;
|
||||||
@ -78,8 +80,6 @@ static char *group_passwd;
|
|||||||
static gid_t group_id;
|
static gid_t group_id;
|
||||||
static gid_t group_newid;
|
static gid_t group_newid;
|
||||||
|
|
||||||
static char *Prog;
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
oflg = false, /* permit non-unique group ID to be specified with -g */
|
oflg = false, /* permit non-unique group ID to be specified with -g */
|
||||||
gflg = false, /* new ID value for the group */
|
gflg = false, /* new ID value for the group */
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
static char *Prog;
|
char *Prog;
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static void print_groups (const char *member);
|
static void print_groups (const char *member);
|
||||||
|
@ -64,7 +64,8 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
static char *Prog;
|
char *Prog;
|
||||||
|
|
||||||
static const char *grp_file = GROUP_FILE;
|
static const char *grp_file = GROUP_FILE;
|
||||||
static bool use_system_grp_file = true;
|
static bool use_system_grp_file = true;
|
||||||
|
|
||||||
|
@ -53,9 +53,10 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
static bool gr_locked = false;
|
static bool gr_locked = false;
|
||||||
static bool sgr_locked = false;
|
static bool sgr_locked = false;
|
||||||
static char *Prog;
|
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static void fail_exit (int status);
|
static void fail_exit (int status);
|
||||||
|
@ -54,9 +54,10 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
static bool gr_locked = false;
|
static bool gr_locked = false;
|
||||||
static bool sgr_locked = false;
|
static bool sgr_locked = false;
|
||||||
static char *Prog;
|
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static void fail_exit (int status);
|
static void fail_exit (int status);
|
||||||
|
@ -105,8 +105,8 @@ static bool preauth_flag = false;
|
|||||||
/*
|
/*
|
||||||
* Global variables.
|
* Global variables.
|
||||||
*/
|
*/
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
static char *Prog;
|
|
||||||
static bool amroot;
|
static bool amroot;
|
||||||
static int timeout;
|
static int timeout;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
static char *Prog;
|
char *Prog;
|
||||||
|
|
||||||
#ifndef DEFAULT_HUP_MESG
|
#ifndef DEFAULT_HUP_MESG
|
||||||
#define DEFAULT_HUP_MESG _("login time exceeded\n\n")
|
#define DEFAULT_HUP_MESG _("login time exceeded\n\n")
|
||||||
|
@ -45,6 +45,8 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
extern char **newenvp;
|
extern char **newenvp;
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -53,7 +55,6 @@ static int ngroups;
|
|||||||
static GETGROUPS_T *grouplist;
|
static GETGROUPS_T *grouplist;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *Prog;
|
|
||||||
static bool is_newgrp;
|
static bool is_newgrp;
|
||||||
|
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
|
@ -65,7 +65,8 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
static char *Prog;
|
char *Prog;
|
||||||
|
|
||||||
static bool cflg = false;
|
static bool cflg = false;
|
||||||
static bool rflg = false; /* create a system account */
|
static bool rflg = false; /* create a system account */
|
||||||
static bool sflg = false;
|
static bool sflg = false;
|
||||||
|
@ -68,9 +68,10 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
char *Prog; /* Program name */
|
||||||
|
|
||||||
static char *name; /* The name of user whose password is being changed */
|
static char *name; /* The name of user whose password is being changed */
|
||||||
static char *myname; /* The current user's name */
|
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 amroot; /* The caller's real UID was 0 */
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -63,8 +63,8 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
static char *Prog;
|
|
||||||
static const char *pwd_file = PASSWD_FILE;
|
static const char *pwd_file = PASSWD_FILE;
|
||||||
static bool use_system_pw_file = true;
|
static bool use_system_pw_file = true;
|
||||||
static const char *spw_file = SHADOW_FILE;
|
static const char *spw_file = SHADOW_FILE;
|
||||||
|
@ -83,7 +83,8 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
static char *Prog;
|
char *Prog;
|
||||||
|
|
||||||
static bool spw_locked = false;
|
static bool spw_locked = false;
|
||||||
static bool pw_locked = false;
|
static bool pw_locked = false;
|
||||||
|
|
||||||
|
@ -47,7 +47,8 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
static char *Prog;
|
char *Prog;
|
||||||
|
|
||||||
static bool spw_locked = false;
|
static bool spw_locked = false;
|
||||||
static bool pw_locked = false;
|
static bool pw_locked = false;
|
||||||
|
|
||||||
|
3
src/su.c
3
src/su.c
@ -75,6 +75,8 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
/* not needed by sulog.c anymore */
|
/* not needed by sulog.c anymore */
|
||||||
static char name[BUFSIZ];
|
static char name[BUFSIZ];
|
||||||
static char oldname[BUFSIZ];
|
static char oldname[BUFSIZ];
|
||||||
@ -87,7 +89,6 @@ static pam_handle_t *pamh = NULL;
|
|||||||
static bool caught = false;
|
static bool caught = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *Prog;
|
|
||||||
extern struct passwd pwent;
|
extern struct passwd pwent;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -79,6 +79,8 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These defaults are used if there is no defaults file.
|
* These defaults are used if there is no defaults file.
|
||||||
*/
|
*/
|
||||||
@ -119,8 +121,6 @@ static char **user_groups; /* NULL-terminated list */
|
|||||||
static long sys_ngroups;
|
static long sys_ngroups;
|
||||||
static bool do_grp_update = false; /* group files need to be updated */
|
static bool do_grp_update = false; /* group files need to be updated */
|
||||||
|
|
||||||
static char *Prog;
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
bflg = false, /* new default root of home directory */
|
bflg = false, /* new default root of home directory */
|
||||||
cflg = false, /* comment (GECOS) field for new account */
|
cflg = false, /* comment (GECOS) field for new account */
|
||||||
|
@ -68,11 +68,16 @@
|
|||||||
#define E_USER_BUSY 8 /* user currently logged in */
|
#define E_USER_BUSY 8 /* user currently logged in */
|
||||||
#define E_GRP_UPDATE 10 /* can't update group file */
|
#define E_GRP_UPDATE 10 /* can't update group file */
|
||||||
#define E_HOMEDIR 12 /* can't remove home directory */
|
#define E_HOMEDIR 12 /* can't remove home directory */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Global variables
|
||||||
|
*/
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
static char *user_name;
|
static char *user_name;
|
||||||
static uid_t user_id;
|
static uid_t user_id;
|
||||||
static char *user_home;
|
static char *user_home;
|
||||||
|
|
||||||
static char *Prog;
|
|
||||||
static bool fflg = false;
|
static bool fflg = false;
|
||||||
static bool rflg = false;
|
static bool rflg = false;
|
||||||
|
|
||||||
|
@ -82,6 +82,8 @@
|
|||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
char *Prog;
|
||||||
|
|
||||||
static char *user_name;
|
static char *user_name;
|
||||||
static char *user_newname;
|
static char *user_newname;
|
||||||
static char *user_pass;
|
static char *user_pass;
|
||||||
@ -102,8 +104,6 @@ static long user_newinactive;
|
|||||||
static long sys_ngroups;
|
static long sys_ngroups;
|
||||||
static char **user_groups; /* NULL-terminated list */
|
static char **user_groups; /* NULL-terminated list */
|
||||||
|
|
||||||
static char *Prog;
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
aflg = false, /* append to existing secondary group set */
|
aflg = false, /* append to existing secondary group set */
|
||||||
cflg = false, /* new comment (GECOS) field */
|
cflg = false, /* new comment (GECOS) field */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user