* NEWS, src/groupmems.c: Added syslog support.
* src/groupmems.c: members() renamed display_members() to avoid name clash with its members argument. * src/groupmems.c: Report failure to unlock to syslog. * src/groupmems.c: Harmonize error messages. * src/groupmems.c: Report failures to write the new group file to syslog (gr_close() failure). * src/groupmems.c: Don't use fail_exit for non-failure exit.
This commit is contained in:
parent
e069125a2c
commit
e3e99974f8
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2008-08-07 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* NEWS, src/groupmems.c: Added syslog support.
|
||||
* src/groupmems.c: members() renamed display_members() to
|
||||
avoid name clash with its members argument.
|
||||
* src/groupmems.c: Report failure to unlock to syslog.
|
||||
* src/groupmems.c: Harmonize error messages.
|
||||
* src/groupmems.c: Report failures to write the new group file to
|
||||
syslog (gr_close() failure).
|
||||
* src/groupmems.c: Don't use fail_exit for non-failure exit.
|
||||
|
||||
2008-08-07 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* src/chsh.c: Added fail_exit().
|
||||
|
1
NEWS
1
NEWS
@ -16,6 +16,7 @@ shadow-4.1.2.1 -> shadow-4.1.3 UNRELEASED
|
||||
* Everybody is allowed to list the users of a group.
|
||||
* /etc/group is open readonly when one just wants to list the users of a
|
||||
group.
|
||||
* Added syslog support.
|
||||
|
||||
shadow-4.1.2 -> shadow-4.1.2.1 26-06-2008
|
||||
|
||||
|
@ -71,7 +71,7 @@ static char *Prog;
|
||||
static bool group_locked = false;
|
||||
|
||||
static char *whoami (void);
|
||||
static void members (char **members);
|
||||
static void display_members (char **members);
|
||||
static void usage (void);
|
||||
static void process_flags (int argc, char **argv);
|
||||
static void check_perms (void);
|
||||
@ -94,7 +94,7 @@ static char *whoami (void)
|
||||
}
|
||||
}
|
||||
|
||||
static void members (char **members)
|
||||
static void display_members (char **members)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -208,14 +208,16 @@ static void fail_exit (int code)
|
||||
if (group_locked) {
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: unable to unlock group file\n"),
|
||||
Prog);
|
||||
_("%s: cannot unlock %s\n"),
|
||||
Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
/* continue */
|
||||
}
|
||||
}
|
||||
exit (code);
|
||||
}
|
||||
|
||||
void main (int argc, char **argv)
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
char *name;
|
||||
struct group *grp;
|
||||
@ -225,6 +227,8 @@ void main (int argc, char **argv)
|
||||
*/
|
||||
Prog = Basename (argv[0]);
|
||||
|
||||
OPENLOG ("groupmems");
|
||||
|
||||
(void) setlocale (LC_ALL, "");
|
||||
(void) bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
(void) textdomain (PACKAGE);
|
||||
@ -250,27 +254,28 @@ void main (int argc, char **argv)
|
||||
|
||||
if (gr_lock () == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: unable to lock group file\n"), Prog);
|
||||
_("%s: cannot lock %s\n"),
|
||||
Prog, gr_dbname ());
|
||||
fail_exit (EXIT_GROUP_FILE);
|
||||
}
|
||||
group_locked = true;
|
||||
}
|
||||
|
||||
if (gr_open (list ? O_RDONLY : O_RDWR) == 0) {
|
||||
fprintf (stderr, _("%s: unable to open group file\n"), Prog);
|
||||
fprintf (stderr, _("%s: cannot open %s\n"), Prog, gr_dbname ());
|
||||
fail_exit (EXIT_GROUP_FILE);
|
||||
}
|
||||
|
||||
grp = (struct group *) gr_locate (name);
|
||||
|
||||
if (NULL == grp) {
|
||||
fprintf (stderr, _("%s: '%s' not found in /etc/group\n"),
|
||||
Prog, name);
|
||||
fprintf (stderr, _("%s: group '%s' does not exist in %s\n"),
|
||||
Prog, name, gr_dbname ());
|
||||
fail_exit (EXIT_INVALID_GROUP);
|
||||
}
|
||||
|
||||
if (list) {
|
||||
members (grp->gr_mem);
|
||||
display_members (grp->gr_mem);
|
||||
} else if (NULL != adduser) {
|
||||
if (is_on_list (grp->gr_mem, adduser)) {
|
||||
fprintf (stderr,
|
||||
@ -295,10 +300,16 @@ void main (int argc, char **argv)
|
||||
}
|
||||
|
||||
if (gr_close () == 0) {
|
||||
fprintf (stderr, _("%s: unable to close group file\n"), Prog);
|
||||
fprintf (stderr, _("%s: failure while writing %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failure while writing %s", gr_dbname ()));
|
||||
fail_exit (EXIT_GROUP_FILE);
|
||||
}
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: cannot unlock %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
/* continue */
|
||||
}
|
||||
|
||||
fail_exit (EXIT_SUCCESS);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user