Blame SOURCES/sudo-1.8.23-nowaitopt.patch

02d491
diff -up sudo-1.8.23/plugins/sudoers/def_data.c.nowaitopt sudo-1.8.23/plugins/sudoers/def_data.c
02d491
--- sudo-1.8.23/plugins/sudoers/def_data.c.nowaitopt	2018-06-18 09:36:34.249307795 +0200
02d491
+++ sudo-1.8.23/plugins/sudoers/def_data.c	2018-06-18 09:43:12.122986032 +0200
02d491
@@ -498,6 +498,10 @@ struct sudo_defs_types sudo_defs_table[]
02d491
 	N_("Don't pre-resolve all group names"),
02d491
 	NULL,
02d491
     }, {
02d491
+	"cmnd_no_wait", T_FLAG,
02d491
+	N_("Don't fork and wait for the command to finish, just exec it"),
02d491
+	NULL,
02d491
+    }, {
02d491
 	NULL, 0, NULL
02d491
     }
02d491
 };
02d491
diff -up sudo-1.8.23/plugins/sudoers/def_data.h.nowaitopt sudo-1.8.23/plugins/sudoers/def_data.h
02d491
--- sudo-1.8.23/plugins/sudoers/def_data.h.nowaitopt	2018-06-18 09:36:34.250307792 +0200
02d491
+++ sudo-1.8.23/plugins/sudoers/def_data.h	2018-06-18 09:43:44.541878327 +0200
02d491
@@ -228,6 +228,8 @@
02d491
 #define def_case_insensitive_group (sudo_defs_table[I_CASE_INSENSITIVE_GROUP].sd_un.flag)
02d491
 #define I_LEGACY_GROUP_PROCESSING 114
02d491
 #define def_legacy_group_processing (sudo_defs_table[I_LEGACY_GROUP_PROCESSING].sd_un.flag)
02d491
+#define I_CMND_NO_WAIT          115
02d491
+#define def_cmnd_no_wait        (sudo_defs_table[I_CMND_NO_WAIT].sd_un.flag)
02d491
 
02d491
 enum def_tuple {
02d491
 	never,
02d491
diff -up sudo-1.8.23/plugins/sudoers/def_data.in.nowaitopt sudo-1.8.23/plugins/sudoers/def_data.in
02d491
--- sudo-1.8.23/plugins/sudoers/def_data.in.nowaitopt	2018-06-18 09:36:34.250307792 +0200
02d491
+++ sudo-1.8.23/plugins/sudoers/def_data.in	2018-06-18 09:45:00.076627403 +0200
02d491
@@ -360,3 +360,6 @@ case_insensitive_group
02d491
 legacy_group_processing
02d491
 	T_FLAG
02d491
 	"Don't pre-resolve all group names"
02d491
+cmnd_no_wait
02d491
+	T_FLAG
02d491
+	"Don't fork and wait for the command to finish, just exec it"
02d491
diff -up sudo-1.8.23/plugins/sudoers/policy.c.nowaitopt sudo-1.8.23/plugins/sudoers/policy.c
02d491
diff -up sudo-1.8.23/plugins/sudoers/sudoers.c.nowaitopt sudo-1.8.23/plugins/sudoers/sudoers.c
02d491
--- sudo-1.8.23/plugins/sudoers/sudoers.c.nowaitopt	2018-06-18 11:31:51.883751328 +0200
02d491
+++ sudo-1.8.23/plugins/sudoers/sudoers.c	2018-06-18 11:31:03.670899166 +0200
02d491
@@ -213,6 +213,20 @@ sudoers_policy_init(void *info, char * c
02d491
         def_match_group_by_gid = false;
02d491
 	def_legacy_group_processing = false;
02d491
     }
02d491
+
02d491
+    /*
02d491
+     * Emulate cmnd_no_wait option by disabling PAM session, PTY allocation
02d491
+     * and I/O logging. This will cause sudo to execute the given command
02d491
+     * directly instead of forking a separate process for it.
02d491
+     */
02d491
+    if (def_cmnd_no_wait) {
02d491
+        def_pam_setcred = false;
02d491
+        def_pam_session = false;
02d491
+        def_use_pty = false;
02d491
+        def_log_input = false;
02d491
+        def_log_output = false;
02d491
+    }
02d491
+
02d491
 cleanup:
02d491
     if (!restore_perms())
02d491
 	ret = -1;