return commonio_next (&passwd_db);
}
-int pw_close (void)
+int pw_close (bool process_selinux)
{
- return commonio_close (&passwd_db, true);
+ return commonio_close (&passwd_db, process_selinux);
}
int pw_unlock (void)
#include <sys/types.h>
#include <pwd.h>
+#include <stdbool.h>
-extern int pw_close (void);
+extern int pw_close (bool process_selinux);
extern /*@observer@*/ /*@null@*/const struct passwd *pw_locate (const char *name);
extern /*@observer@*/ /*@null@*/const struct passwd *pw_locate_uid (uid_t uid);
extern int pw_lock (void);
* Close the password file. If any entries were modified, the file
* will be re-written.
*/
- if (pw_close () == 0) {
+ if (pw_close (true) == 0) {
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
fail_exit (E_NOPERM);
/*
* Changes have all been made, so commit them and unlock the file.
*/
- if (pw_close () == 0) {
+ if (pw_close (true) == 0) {
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
fail_exit (E_NOPERM);
spw_locked = false;
}
- if (pw_close () == 0) {
+ if (pw_close (true) == 0) {
fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, pw_dbname ());
/*
* Changes have all been made, so commit them and unlock the file.
*/
- if (pw_close () == 0) {
+ if (pw_close (true) == 0) {
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
fail_exit (1);
#endif /* SHADOWGRP */
if (gflg) {
- if (pw_close () == 0) {
+ if (pw_close (true) == 0) {
fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, pw_dbname ());
*/
static void close_files (void)
{
- if (pw_close () == 0) {
+ if (pw_close (true) == 0) {
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
fail_exit (EXIT_FAILURE);
Prog, pw_dbname (), npw->pw_name);
fail_exit (E_FAILURE);
}
- if (pw_close () == 0) {
+ if (pw_close (true) == 0) {
(void) fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, pw_dbname ());
* changes to the files.
*/
if (changed) {
- if (pw_close () == 0) {
+ if (pw_close (true) == 0) {
fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ()));
fail_exit (E_FAILURE);
}
- if (pw_close () == 0) {
+ if (pw_close (true) == 0) {
fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, pw_dbname ());
(void) spw_close (); /* was only open O_RDONLY */
- if (pw_close () == 0) {
+ if (pw_close (true) == 0) {
fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, pw_dbname ());
*/
static void close_files (void)
{
- if (pw_close () == 0) {
+ if (pw_close (true) == 0) {
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
fail_exit (E_PW_UPDATE);
*/
static void close_files (void)
{
- if (pw_close () == 0) {
+ if (pw_close (true) == 0) {
fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
fail_exit (E_PW_UPDATE);
pw_open(O_RDONLY);
pwd = pw_locate (user_name); /* we care only about local users */
if (NULL == pwd) {
- pw_close();
+ pw_close(true);
fprintf (stderr, _("%s: user '%s' does not exist\n"),
Prog, user_name);
#ifdef WITH_AUDIT
} else {
user_home = xstrdup(pwd->pw_dir);
}
- pw_close();
+ pw_close(true);
}
#ifdef WITH_TCB
if (shadowtcb_set_user (user_name) == SHADOWTCB_FAILURE) {
*/
static void close_files (void)
{
- if (pw_close () == 0) {
+ if (pw_close (true) == 0) {
fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, pw_dbname ());