Blame SOURCES/sudo-1.8.23-nowaitopt.patch

0eb21d
diff -up sudo-1.8.23/plugins/sudoers/def_data.c.nowaitopt sudo-1.8.23/plugins/sudoers/def_data.c
0eb21d
--- sudo-1.8.23/plugins/sudoers/def_data.c.nowaitopt	2018-06-18 09:36:34.249307795 +0200
0eb21d
+++ sudo-1.8.23/plugins/sudoers/def_data.c	2018-06-18 09:43:12.122986032 +0200
0eb21d
@@ -498,6 +498,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
 };
0eb21d
diff -up sudo-1.8.23/plugins/sudoers/def_data.h.nowaitopt sudo-1.8.23/plugins/sudoers/def_data.h
0eb21d
--- sudo-1.8.23/plugins/sudoers/def_data.h.nowaitopt	2018-06-18 09:36:34.250307792 +0200
0eb21d
+++ sudo-1.8.23/plugins/sudoers/def_data.h	2018-06-18 09:43:44.541878327 +0200
0eb21d
@@ -228,6 +228,8 @@
0eb21d
 #define def_case_insensitive_group (sudo_defs_table[I_CASE_INSENSITIVE_GROUP].sd_un.flag)
0eb21d
 #define I_LEGACY_GROUP_PROCESSING 114
0eb21d
 #define def_legacy_group_processing (sudo_defs_table[I_LEGACY_GROUP_PROCESSING].sd_un.flag)
0eb21d
+#define I_CMND_NO_WAIT          115
0eb21d
+#define def_cmnd_no_wait        (sudo_defs_table[I_CMND_NO_WAIT].sd_un.flag)
0eb21d
 
0eb21d
 enum def_tuple {
0eb21d
 	never,
0eb21d
diff -up sudo-1.8.23/plugins/sudoers/def_data.in.nowaitopt sudo-1.8.23/plugins/sudoers/def_data.in
0eb21d
--- sudo-1.8.23/plugins/sudoers/def_data.in.nowaitopt	2018-06-18 09:36:34.250307792 +0200
0eb21d
+++ sudo-1.8.23/plugins/sudoers/def_data.in	2018-06-18 09:45:00.076627403 +0200
0eb21d
@@ -360,3 +360,6 @@ case_insensitive_group
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"
0eb21d
diff -up sudo-1.8.23/plugins/sudoers/policy.c.nowaitopt sudo-1.8.23/plugins/sudoers/policy.c
0eb21d
diff -up sudo-1.8.23/plugins/sudoers/sudoers.c.nowaitopt sudo-1.8.23/plugins/sudoers/sudoers.c
0eb21d
--- sudo-1.8.23/plugins/sudoers/sudoers.c.nowaitopt	2018-06-18 11:31:51.883751328 +0200
0eb21d
+++ sudo-1.8.23/plugins/sudoers/sudoers.c	2018-06-18 11:31:03.670899166 +0200
0eb21d
@@ -213,6 +213,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;