Blame SOURCES/sudo-1.8.23-nowaitopt.patch

3379fe
diff -up ./plugins/sudoers/def_data.c.nowait ./plugins/sudoers/def_data.c
3379fe
--- ./plugins/sudoers/def_data.c.nowait	2019-10-30 13:43:48.376168944 +0100
3379fe
+++ ./plugins/sudoers/def_data.c	2019-10-30 13:43:48.378168973 +0100
3379fe
@@ -510,6 +510,10 @@ struct sudo_defs_types sudo_defs_table[]
0eb21d
 	N_("Don't pre-resolve all group names"),
0eb21d
 	NULL,
0eb21d
     }, {
0eb21d
+	"cmnd_no_wait", T_FLAG,
0eb21d
+	N_("Don't fork and wait for the command to finish, just exec it"),
0eb21d
+	NULL,
0eb21d
+    }, {
0eb21d
 	NULL, 0, NULL
0eb21d
     }
0eb21d
 };
3379fe
diff -up ./plugins/sudoers/def_data.h.nowait ./plugins/sudoers/def_data.h
3379fe
--- ./plugins/sudoers/def_data.h.nowait	2019-10-30 13:43:48.378168973 +0100
3379fe
+++ ./plugins/sudoers/def_data.h	2019-10-30 13:45:38.425770365 +0100
3379fe
@@ -234,6 +234,8 @@
3379fe
 #define def_log_denied          (sudo_defs_table[I_LOG_DENIED].sd_un.flag)
3379fe
 #define I_LEGACY_GROUP_PROCESSING 117
0eb21d
 #define def_legacy_group_processing (sudo_defs_table[I_LEGACY_GROUP_PROCESSING].sd_un.flag)
3379fe
+#define I_CMND_NO_WAIT          118
0eb21d
+#define def_cmnd_no_wait        (sudo_defs_table[I_CMND_NO_WAIT].sd_un.flag)
0eb21d
 
0eb21d
 enum def_tuple {
0eb21d
 	never,
3379fe
diff -up ./plugins/sudoers/def_data.in.nowait ./plugins/sudoers/def_data.in
3379fe
--- ./plugins/sudoers/def_data.in.nowait	2019-10-30 13:43:48.376168944 +0100
3379fe
+++ ./plugins/sudoers/def_data.in	2019-10-30 13:43:48.379168987 +0100
3379fe
@@ -369,3 +369,6 @@ log_denied
0eb21d
 legacy_group_processing
0eb21d
 	T_FLAG
0eb21d
 	"Don't pre-resolve all group names"
0eb21d
+cmnd_no_wait
0eb21d
+	T_FLAG
0eb21d
+	"Don't fork and wait for the command to finish, just exec it"
3379fe
diff -up ./plugins/sudoers/sudoers.c.nowait ./plugins/sudoers/sudoers.c
3379fe
--- ./plugins/sudoers/sudoers.c.nowait	2019-10-30 13:43:48.376168944 +0100
3379fe
+++ ./plugins/sudoers/sudoers.c	2019-10-30 13:43:48.379168987 +0100
3379fe
@@ -225,6 +225,20 @@ sudoers_policy_init(void *info, char * c
0eb21d
         def_match_group_by_gid = false;
0eb21d
 	def_legacy_group_processing = false;
0eb21d
     }
0eb21d
+
0eb21d
+    /*
0eb21d
+     * Emulate cmnd_no_wait option by disabling PAM session, PTY allocation
0eb21d
+     * and I/O logging. This will cause sudo to execute the given command
0eb21d
+     * directly instead of forking a separate process for it.
0eb21d
+     */
0eb21d
+    if (def_cmnd_no_wait) {
0eb21d
+        def_pam_setcred = false;
0eb21d
+        def_pam_session = false;
0eb21d
+        def_use_pty = false;
0eb21d
+        def_log_input = false;
0eb21d
+        def_log_output = false;
0eb21d
+    }
0eb21d
+
0eb21d
 cleanup:
0eb21d
     if (!restore_perms())
0eb21d
 	ret = -1;