--- embedaddon/sudo/src/sudo.h 2012/05/29 12:26:49 1.1.1.2 +++ embedaddon/sudo/src/sudo.h 2013/10/14 07:56:35 1.1.1.5 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1993-1996, 1998-2005, 2007-2012 + * Copyright (c) 1993-1996, 1998-2005, 2007-2013 * Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any @@ -17,8 +17,6 @@ * Sponsored in part by the Defense Advanced Research Projects * Agency (DARPA) and Air Force Research Laboratory, Air Force * Materiel Command, USAF, under agreement number F39502-99-1-0512. - * - * $Sudo: sudo.h,v 1.290 2009/12/12 16:12:26 millert Exp $ */ #ifndef _SUDO_SUDO_H @@ -34,17 +32,21 @@ #include "missing.h" #include "alloc.h" -#include "error.h" +#include "fatal.h" #include "fileops.h" #include "list.h" #include "sudo_conf.h" #include "sudo_debug.h" #include "gettext.h" +#ifdef HAVE_PRIV_SET +# include +#endif + #ifdef __TANDEM -# define ROOT_UID 65535 +# define ROOT_UID 65535 #else -# define ROOT_UID 0 +# define ROOT_UID 0 #endif /* @@ -74,14 +76,6 @@ #define MODE_LONG_LIST 0x01000000 /* - * We used to use the system definition of PASS_MAX or _PASSWD_LEN, - * but that caused problems with various alternate authentication - * methods. So, we just define our own and assume that it is >= the - * system max. - */ -#define SUDO_PASS_MAX 256 - -/* * Flags for tgetpass() */ #define TGP_NOECHO 0x00 /* turn echo off reading pw (default) */ @@ -126,6 +120,7 @@ struct user_details { #define CD_RBAC_ENABLED 0x0800 #define CD_USE_PTY 0x1000 #define CD_SET_UTMP 0x2000 +#define CD_EXEC_BG 0x4000 struct command_details { uid_t uid; @@ -149,6 +144,10 @@ struct command_details { const char *utmp_user; char **argv; char **envp; +#ifdef HAVE_PRIV_SET + priv_set_t *privs; + priv_set_t *limitprivs; +#endif }; /* Status passed between parent and child via socketpair */ @@ -157,26 +156,23 @@ struct command_status { #define CMD_ERRNO 1 #define CMD_WSTATUS 2 #define CMD_SIGNO 3 +#define CMD_PID 4 int type; int val; }; struct timeval; -/* For error() and errorx() (XXX - needed?) */ +/* For fatal() and fatalx() (XXX - needed?) */ void cleanup(int); /* tgetpass.c */ char *tgetpass(const char *, int, int); int tty_present(void); -/* zero_bytes.c */ -void zero_bytes(volatile void *, size_t); - /* exec.c */ +int pipe_nonblock(int fds[2]); int sudo_execute(struct command_details *details, struct command_status *cstat); -void save_signals(void); -void restore_signals(void); /* term.c */ int term_cbreak(int); @@ -191,6 +187,9 @@ char *fmt_string(const char *var, const char *value); /* atobool.c */ bool atobool(const char *str); +/* atoid.c */ +id_t atoid(const char *str, const char *sep, char **endp, const char **errstr); + /* parse_args.c */ int parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp, char ***env_addp); @@ -206,7 +205,8 @@ void get_ttysize(int *rowp, int *colp); bool exec_setup(struct command_details *details, const char *ptyname, int ptyfd); int policy_init_session(struct command_details *details); int run_command(struct command_details *details); -extern const char *list_user, *runas_user, *runas_group; +int os_init_common(int argc, char *argv[], char *envp[]); +extern const char *list_user; extern struct user_details user_details; /* sudo_edit.c */ @@ -215,6 +215,9 @@ int sudo_edit(struct command_details *details); /* parse_args.c */ void usage(int); +/* openbsd.c */ +int os_init_openbsd(int argc, char *argv[], char *envp[]); + /* selinux.c */ int selinux_restore_tty(void); int selinux_setup(const char *role, const char *type, const char *ttyn, @@ -222,6 +225,10 @@ int selinux_setup(const char *role, const char *type, void selinux_execve(const char *path, char *const argv[], char *const envp[], int noexec); +/* solaris.c */ +void set_project(struct passwd *); +int os_init_solaris(int argc, char *argv[], char *envp[]); + /* aix.c */ void aix_prep_user(char *user, const char *tty); void aix_restoreauthdb(void); @@ -237,6 +244,9 @@ int process_hooks_setenv(const char *name, const char int process_hooks_putenv(char *string); int process_hooks_unsetenv(const char *name); +/* env_hooks.c */ +char *getenv_unhooked(const char *name); + /* interfaces.c */ int get_net_ifs(char **addrinfo); @@ -245,5 +255,16 @@ int sudo_setgroups(int ngids, const GETGROUPS_T *gids) /* ttyname.c */ char *get_process_ttyname(void); + +/* signal.c */ +struct sigaction; +extern int signal_pipe[2]; +int sudo_sigaction(int signo, struct sigaction *sa, struct sigaction *osa); +void init_signals(void); +void restore_signals(void); +void save_signals(void); + +/* gidlist.c */ +int parse_gid_list(const char *gidstr, const gid_t *basegid, GETGROUPS_T **gidsp); #endif /* _SUDO_SUDO_H */