Blame SOURCES/sudo-1.8.23-nowaitopt.patch

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