Blame SOURCES/sudo-1.8.23-nowaitopt.patch

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