Move sudoedit_nfiles into struct sudoers_context.
This commit is contained in:
@@ -57,7 +57,6 @@ sudo_printf_t sudo_printf;
|
||||
struct sudo_plugin_event * (*plugin_event_alloc)(void);
|
||||
static const char *path_sudoers = _PATH_SUDOERS;
|
||||
static bool session_opened;
|
||||
int sudoedit_nfiles;
|
||||
|
||||
extern sudo_dso_public struct policy_plugin sudoers_policy;
|
||||
|
||||
@@ -183,7 +182,7 @@ sudoers_policy_deserialize_info(struct sudoers_context *ctx, void *v,
|
||||
/* Parse command line settings. */
|
||||
ctx->settings.flags = 0;
|
||||
ctx->user.closefrom = -1;
|
||||
sudoedit_nfiles = 0;
|
||||
ctx->sudoedit_nfiles = 0;
|
||||
ctx->mode = 0;
|
||||
for (cur = info->settings; *cur != NULL; cur++) {
|
||||
if (MATCHES(*cur, "closefrom=")) {
|
||||
@@ -724,9 +723,9 @@ sudoers_policy_store_result(struct sudoers_context *ctx, bool accepted,
|
||||
if (ISSET(ctx->mode, MODE_EDIT)) {
|
||||
if ((command_info[info_len++] = strdup("sudoedit=true")) == NULL)
|
||||
goto oom;
|
||||
if (sudoedit_nfiles > 0) {
|
||||
if (ctx->sudoedit_nfiles > 0) {
|
||||
if (asprintf(&command_info[info_len++], "sudoedit_nfiles=%d",
|
||||
sudoedit_nfiles) == -1)
|
||||
ctx->sudoedit_nfiles) == -1)
|
||||
goto oom;
|
||||
}
|
||||
if (!def_sudoedit_checkdir) {
|
||||
|
@@ -766,9 +766,9 @@ sudoers_check_cmnd(int argc, char * const argv[], char *env_add[],
|
||||
char **edit_argv;
|
||||
int edit_argc;
|
||||
|
||||
sudoedit_nfiles = sudoers_ctx.runas.argc - 1;
|
||||
sudoers_ctx.sudoedit_nfiles = sudoers_ctx.runas.argc - 1;
|
||||
free(sudoers_ctx.runas.cmnd);
|
||||
sudoers_ctx.runas.cmnd = find_editor(sudoedit_nfiles,
|
||||
sudoers_ctx.runas.cmnd = find_editor(sudoers_ctx.sudoedit_nfiles,
|
||||
sudoers_ctx.runas.argv + 1, &edit_argc, &edit_argv, NULL, &env_editor);
|
||||
if (sudoers_ctx.runas.cmnd == NULL) {
|
||||
switch (errno) {
|
||||
|
@@ -193,6 +193,7 @@ struct sudoers_context {
|
||||
struct sudoers_plugin_settings settings;
|
||||
struct sudoers_user_context user;
|
||||
struct sudoers_runas_context runas;
|
||||
int sudoedit_nfiles;
|
||||
unsigned int mode;
|
||||
};
|
||||
|
||||
@@ -434,7 +435,6 @@ void sudoers_cleanup(void);
|
||||
bool sudoers_override_umask(void);
|
||||
const struct sudoers_context *sudoers_get_context(void);
|
||||
bool sudoers_set_mode(unsigned int flags, unsigned int mask);
|
||||
extern int sudoedit_nfiles;
|
||||
extern sudo_conv_t sudo_conv;
|
||||
extern sudo_printf_t sudo_printf;
|
||||
extern struct sudo_plugin_event * (*plugin_event_alloc)(void);
|
||||
|
Reference in New Issue
Block a user