*/
void cleanup_unlock_shadow (MAYBE_UNUSED void *arg)
{
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (log_get_logfd(),
_("%s: failed to unlock %s\n"),
log_get_progname(), spw_dbname ());
* Unlock both files.
*/
- return (pw_unlock (true) && spw_unlock ())? 0 : -1;
+ return (pw_unlock (true) && spw_unlock (true))? 0 : -1;
}
#else
extern int ISO_C_forbids_an_empty_translation_unit;
return retval;
}
-int spw_unlock (void)
+int spw_unlock (bool process_selinux)
{
#ifdef WITH_TCB
int retval = 0;
if (!getdef_bool ("USE_TCB")) {
#endif /* WITH_TCB */
- return commonio_unlock (&shadow_db, true);
+ return commonio_unlock (&shadow_db, process_selinux);
#ifdef WITH_TCB
}
if (shadowtcb_drop_priv () == SHADOWTCB_FAILURE) {
extern int spw_open (int mode);
extern int spw_remove (const char *name);
extern int spw_rewind (void);
-extern int spw_unlock (void);
+extern int spw_unlock (bool process_selinux);
extern int spw_update (const struct spwd *sp);
extern int spw_sort (void);
fail_exit (int code)
{
if (spw_locked) {
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
fail_exit (E_NOPERM);
}
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
}
if (spw_locked) {
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ()));
fail_exit (1);
}
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
static void fail_exit (int code)
{
if (spw_locked) {
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ()));
fail_exit (EXIT_FAILURE);
}
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr,
_("%s: failed to unlock %s\n"),
Prog, spw_dbname ());
}
if (spw_locked) {
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
(void) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
/* Try to update the password in /etc/passwd instead. */
(void) spw_close (true);
update_noshadow ();
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
(void) fprintf (stderr,
_("%s: failed to unlock %s\n"),
Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ()));
fail_exit (E_FAILURE);
}
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
(void) fprintf (stderr,
_("%s: failed to unlock %s\n"),
Prog, spw_dbname ());
static void fail_exit (int code)
{
if (spw_locked) {
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
if (use_system_spw_file) {
SYSLOG ((LOG_ERR, "failed to unlock %s",
* Don't be anti-social - unlock the files when you're done.
*/
if (spw_locked) {
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr,
_("%s: failed to unlock %s\n"),
Prog, spw_dbname ());
_("%s: cannot open %s\n"),
Prog, spw_dbname ());
*errors = true;
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr,
_("%s: failed to unlock %s\n"),
Prog, spw_dbname ());
} else {
spw_opened = false;
}
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr,
_("%s: failed to unlock %s\n"),
Prog, spw_dbname ());
}
if (spw_locked) {
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
/* continue */
}
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
static void fail_exit (int status)
{
if (spw_locked) {
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
fail_exit (3);
}
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
SYSLOG((LOG_ERR, "failed to remove %s", prefix_user_home));
}
- if (spw_locked && spw_unlock() == 0) {
+ if (spw_locked && spw_unlock(true) == 0) {
fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname());
SYSLOG((LOG_ERR, "failed to unlock %s", spw_dbname()));
/* continue */
}
#endif /* ENABLE_SUBIDS */
if (is_shadow_pwd) {
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
#ifdef WITH_AUDIT
SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ()));
fail_exit (E_PW_UPDATE);
}
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
}
}
if (spw_locked) {
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
}
#endif
if (spw_locked) {
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
}
if (is_shadow_pwd) {
- if (spw_unlock () == 0) {
+ if (spw_unlock (true) == 0) {
fprintf (stderr,
_("%s: failed to unlock %s\n"),
Prog, spw_dbname ());