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