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