Blame SOURCES/sudo-1.8.23-nowaitopt.patch

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