]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
src/vipw.c: add SELinux control flag in unlock
authorIker Pedrosa <ipedrosa@redhat.com>
Fri, 25 Apr 2025 14:06:57 +0000 (16:06 +0200)
committerIker Pedrosa <ipedrosa@redhat.com>
Tue, 7 Oct 2025 09:04:39 +0000 (11:04 +0200)
All unlock functions require the SELinux control flag, thus add it as an
argument.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
src/vipw.c

index fb12364f32f59548fc510d1b6eda21423cc69c12..a888fddfdf6a81943ff814f27338af582fefc3a8 100644 (file)
@@ -62,7 +62,7 @@ static const char *Prog;
 static const char *filename, *fileeditname;
 static bool filelocked = false;
 static bool createedit = false;
-static int (*unlock) (void);
+static int (*unlock) (bool);
 static bool quiet = false;
 #ifdef WITH_TCB
 static const char *user = NULL;
@@ -74,7 +74,7 @@ static bool tcb_mode = false;
 static void usage (int status);
 static int create_backup_file (FILE *, const char *, struct stat *);
 static void vipwexit (const char *msg, int syserr, int ret);
-static void vipwedit (const char *, int (*)(void), int (*)(void));
+static void vipwedit (const char *, int (*)(void), int (*)(bool));
 
 /*
  * usage - display usage message and exit
@@ -164,7 +164,7 @@ static void vipwexit (const char *msg, int syserr, int ret)
                }
        }
        if (filelocked) {
-               if ((*unlock) () == 0) {
+               if ((*unlock) (true) == 0) {
                        fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, fileeditname);
                        SYSLOG ((LOG_ERR, "failed to unlock %s", fileeditname));
                        /* continue */
@@ -194,7 +194,7 @@ static void vipwexit (const char *msg, int syserr, int ret)
  *
  */
 static void
-vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
+vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool))
 {
        int          status;
        char         *to_rename;
@@ -466,7 +466,7 @@ vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
        }
 #endif                         /* WITH_TCB */
 
-       if ((*file_unlock) () == 0) {
+       if ((*file_unlock) (true) == 0) {
                fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, fileeditname);
                SYSLOG ((LOG_ERR, "failed to unlock %s", fileeditname));
                /* continue */