When running a login shell with a login_class specified, use

LOGIN_SETENV instead of rolling our own login.conf setenv support
since FreeBSD's login.conf has more than just setenv capabilities.
This requires us to swap the plugin-provided envp for the global
environ before calling setusercontext() and then stash the resulting
environ pointer back into the command details, which is kind of a
hack.
This commit is contained in:
Todd C. Miller
2011-12-08 17:17:25 -05:00
parent 27616d1f3e
commit a24d86b32c
10 changed files with 27 additions and 260 deletions

View File

@@ -197,7 +197,6 @@ struct lbuf;
struct passwd;
struct stat;
struct timeval;
struct login_cap;
/*
* Function prototypes
@@ -306,7 +305,6 @@ void init_envtables(void);
void insert_env_vars(char * const envp[]);
void read_env_file(const char *, int);
void rebuild_env(void);
void sudo_setenv(const char *var, const char *val, int dupcheck);
void validate_env_vars(char * const envp[]);
/* fmt_string.c */
@@ -330,9 +328,6 @@ int group_plugin_query(const char *user, const char *group,
/* setgroups.c */
int sudo_setgroups(int ngids, const GETGROUPS_T *gids);
/* login_cap.c */
int sudo_login_setenv(struct login_cap *lc, const struct passwd *pwd);
#ifndef _SUDO_MAIN
extern struct sudo_user sudo_user;
extern struct passwd *list_pw;