1993-11-27 23:42:49 +00:00
|
|
|
/*
|
2016-01-04 10:35:18 -07:00
|
|
|
* Copyright (c) 1993-1996, 1998-2005, 2007-2016
|
2007-06-23 23:58:54 +00:00
|
|
|
* Todd C. Miller <Todd.Miller@courtesan.com>
|
1993-11-27 23:42:49 +00:00
|
|
|
*
|
2004-02-13 21:36:43 +00:00
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
1999-07-31 16:19:50 +00:00
|
|
|
*
|
2004-02-13 21:36:43 +00:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
1993-03-02 23:28:50 +00:00
|
|
|
*
|
2003-04-16 00:42:10 +00:00
|
|
|
* 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.
|
1993-03-02 23:28:50 +00:00
|
|
|
*/
|
|
|
|
|
2015-05-21 11:13:20 -06:00
|
|
|
#ifndef SUDOERS_SUDOERS_H
|
|
|
|
#define SUDOERS_SUDOERS_H
|
1994-05-25 01:25:40 +00:00
|
|
|
|
2004-06-01 01:22:27 +00:00
|
|
|
#include <limits.h>
|
2011-12-02 11:27:33 -05:00
|
|
|
#ifdef HAVE_STDBOOL_H
|
|
|
|
# include <stdbool.h>
|
|
|
|
#else
|
|
|
|
# include "compat/stdbool.h"
|
|
|
|
#endif /* HAVE_STDBOOL_H */
|
2010-09-07 18:28:22 -04:00
|
|
|
|
2014-02-11 09:40:59 -07:00
|
|
|
#define DEFAULT_TEXT_DOMAIN "sudoers"
|
2014-07-22 14:25:16 -06:00
|
|
|
#include "sudo_gettext.h" /* must be included before sudo_compat.h */
|
2014-02-11 09:40:59 -07:00
|
|
|
|
2010-09-07 18:28:22 -04:00
|
|
|
#include <pathnames.h>
|
2014-07-22 14:25:16 -06:00
|
|
|
#include "sudo_compat.h"
|
2014-07-21 14:40:18 -06:00
|
|
|
#include "sudo_fatal.h"
|
2014-07-21 14:37:27 -06:00
|
|
|
#include "sudo_queue.h"
|
1999-09-08 08:06:28 +00:00
|
|
|
#include "defaults.h"
|
1999-07-22 12:56:28 +00:00
|
|
|
#include "logging.h"
|
2007-12-28 16:20:45 +00:00
|
|
|
#include "sudo_nss.h"
|
2010-03-14 19:58:47 -04:00
|
|
|
#include "sudo_plugin.h"
|
2014-10-22 13:20:32 -06:00
|
|
|
#include "sudo_conf.h"
|
2013-12-12 18:29:07 -07:00
|
|
|
#include "sudo_util.h"
|
2014-10-22 13:30:52 -06:00
|
|
|
#include "sudoers_debug.h"
|
1994-01-27 19:07:34 +00:00
|
|
|
|
2011-07-20 11:58:45 -04:00
|
|
|
/*
|
|
|
|
* Password db and supplementary group IDs with associated group names.
|
|
|
|
*/
|
|
|
|
struct group_list {
|
|
|
|
char **groups;
|
|
|
|
GETGROUPS_T *gids;
|
|
|
|
int ngroups;
|
|
|
|
int ngids;
|
|
|
|
};
|
|
|
|
|
1995-03-24 03:32:53 +00:00
|
|
|
/*
|
1999-07-22 12:56:28 +00:00
|
|
|
* Info pertaining to the invoking user.
|
1995-03-24 03:32:53 +00:00
|
|
|
*/
|
1999-07-22 12:56:28 +00:00
|
|
|
struct sudo_user {
|
|
|
|
struct passwd *pw;
|
2000-12-30 03:29:47 +00:00
|
|
|
struct passwd *_runas_pw;
|
2007-11-21 20:12:00 +00:00
|
|
|
struct group *_runas_gr;
|
2004-08-24 18:01:14 +00:00
|
|
|
struct stat *cmnd_stat;
|
2010-03-14 19:58:47 -04:00
|
|
|
char *name;
|
2000-12-30 03:29:47 +00:00
|
|
|
char *path;
|
1999-07-22 12:56:28 +00:00
|
|
|
char *tty;
|
2007-09-13 23:05:34 +00:00
|
|
|
char *ttypath;
|
1999-07-22 12:56:28 +00:00
|
|
|
char *host;
|
|
|
|
char *shost;
|
2013-08-14 13:49:14 -06:00
|
|
|
char *runhost;
|
|
|
|
char *srunhost;
|
1999-07-22 12:56:28 +00:00
|
|
|
char *prompt;
|
1996-08-09 22:06:40 +00:00
|
|
|
char *cmnd;
|
1999-07-22 12:56:28 +00:00
|
|
|
char *cmnd_args;
|
2004-08-24 18:01:14 +00:00
|
|
|
char *cmnd_base;
|
|
|
|
char *cmnd_safe;
|
2000-03-07 04:29:46 +00:00
|
|
|
char *class_name;
|
2007-07-15 19:44:46 +00:00
|
|
|
char *krb5_ccname;
|
2011-07-20 11:58:45 -04:00
|
|
|
struct group_list *group_list;
|
2010-04-26 17:14:11 -04:00
|
|
|
char * const * env_vars;
|
2008-02-09 14:30:07 +00:00
|
|
|
#ifdef HAVE_SELINUX
|
|
|
|
char *role;
|
|
|
|
char *type;
|
2012-07-26 13:49:21 -04:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_PRIV_SET
|
|
|
|
char *privs;
|
|
|
|
char *limitprivs;
|
2008-02-09 14:30:07 +00:00
|
|
|
#endif
|
2012-10-24 16:32:43 -04:00
|
|
|
const char *cwd;
|
2012-10-25 16:58:31 -04:00
|
|
|
char *iolog_file;
|
2012-06-27 16:50:56 -04:00
|
|
|
GETGROUPS_T *gids;
|
2016-01-04 10:35:18 -07:00
|
|
|
int execfd;
|
2012-06-27 16:50:56 -04:00
|
|
|
int ngids;
|
2011-07-01 14:13:47 -04:00
|
|
|
int closefrom;
|
|
|
|
int lines;
|
|
|
|
int cols;
|
2012-08-02 14:37:32 -04:00
|
|
|
int flags;
|
2013-02-14 15:52:27 -05:00
|
|
|
int max_groups;
|
2013-03-28 15:40:32 -04:00
|
|
|
mode_t umask;
|
2011-07-20 11:58:45 -04:00
|
|
|
uid_t uid;
|
|
|
|
uid_t gid;
|
2013-02-08 10:43:14 -05:00
|
|
|
pid_t sid;
|
1996-08-17 17:22:02 +00:00
|
|
|
};
|
|
|
|
|
2012-08-02 14:37:32 -04:00
|
|
|
/*
|
|
|
|
* sudo_user flag values
|
|
|
|
*/
|
|
|
|
#define RUNAS_USER_SPECIFIED 0x01
|
|
|
|
#define RUNAS_GROUP_SPECIFIED 0x02
|
|
|
|
|
1994-02-27 22:18:51 +00:00
|
|
|
/*
|
1999-08-19 16:30:09 +00:00
|
|
|
* Return values for sudoers_lookup(), also used as arguments for log_auth()
|
|
|
|
* Note: cannot use '0' as a value here.
|
1998-10-18 23:10:18 +00:00
|
|
|
*/
|
2015-06-04 20:42:42 -06:00
|
|
|
#define VALIDATE_ERROR 0x001
|
|
|
|
#define VALIDATE_SUCCESS 0x002
|
|
|
|
#define VALIDATE_FAILURE 0x004
|
2003-12-30 22:31:30 +00:00
|
|
|
#define FLAG_CHECK_USER 0x010
|
2004-11-19 23:00:28 +00:00
|
|
|
#define FLAG_NO_USER 0x020
|
|
|
|
#define FLAG_NO_HOST 0x040
|
|
|
|
#define FLAG_NO_CHECK 0x080
|
2012-07-10 12:42:33 -04:00
|
|
|
#define FLAG_NON_INTERACTIVE 0x100
|
|
|
|
#define FLAG_BAD_PASSWORD 0x200
|
|
|
|
#define FLAG_AUTH_ERROR 0x400
|
1993-03-02 23:28:50 +00:00
|
|
|
|
1998-11-08 20:56:52 +00:00
|
|
|
/*
|
2014-03-26 14:03:04 -06:00
|
|
|
* find_path()/set_cmnd() return values
|
1998-11-08 20:56:52 +00:00
|
|
|
*/
|
2014-03-26 14:15:15 -06:00
|
|
|
#define FOUND 0
|
|
|
|
#define NOT_FOUND 1
|
2010-03-14 19:58:47 -04:00
|
|
|
#define NOT_FOUND_DOT 2
|
2014-03-26 14:15:15 -06:00
|
|
|
#define NOT_FOUND_ERROR 3
|
2015-06-18 09:51:36 -06:00
|
|
|
#define NOT_FOUND_PATH 4
|
1993-03-02 23:28:50 +00:00
|
|
|
|
1995-04-09 21:35:00 +00:00
|
|
|
/*
|
2004-11-24 21:31:51 +00:00
|
|
|
* Various modes sudo can be in (based on arguments) in hex
|
1995-04-09 21:35:00 +00:00
|
|
|
*/
|
2008-03-27 23:01:04 +00:00
|
|
|
#define MODE_RUN 0x00000001
|
|
|
|
#define MODE_EDIT 0x00000002
|
|
|
|
#define MODE_VALIDATE 0x00000004
|
|
|
|
#define MODE_INVALIDATE 0x00000008
|
|
|
|
#define MODE_KILL 0x00000010
|
|
|
|
#define MODE_VERSION 0x00000020
|
|
|
|
#define MODE_HELP 0x00000040
|
|
|
|
#define MODE_LIST 0x00000080
|
|
|
|
#define MODE_CHECK 0x00000100
|
2014-04-07 05:34:56 -06:00
|
|
|
#define MODE_ERROR 0x00000200
|
2008-03-27 23:01:04 +00:00
|
|
|
#define MODE_MASK 0x0000ffff
|
|
|
|
|
|
|
|
/* Mode flags */
|
2011-03-10 15:11:49 -05:00
|
|
|
#define MODE_BACKGROUND 0x00010000 /* XXX - unused */
|
2011-03-11 15:02:13 -05:00
|
|
|
#define MODE_SHELL 0x00020000
|
2008-03-27 23:01:04 +00:00
|
|
|
#define MODE_LOGIN_SHELL 0x00040000
|
|
|
|
#define MODE_IMPLIED_SHELL 0x00080000
|
|
|
|
#define MODE_RESET_HOME 0x00100000
|
|
|
|
#define MODE_PRESERVE_GROUPS 0x00200000
|
|
|
|
#define MODE_PRESERVE_ENV 0x00400000
|
|
|
|
#define MODE_NONINTERACTIVE 0x00800000
|
2010-03-15 19:41:15 -04:00
|
|
|
#define MODE_IGNORE_TICKET 0x01000000
|
1994-08-05 00:24:07 +00:00
|
|
|
|
1995-04-09 21:35:00 +00:00
|
|
|
/*
|
|
|
|
* Used with set_perms()
|
|
|
|
*/
|
2010-04-10 10:34:37 -04:00
|
|
|
#define PERM_INITIAL 0x00
|
|
|
|
#define PERM_ROOT 0x01
|
|
|
|
#define PERM_USER 0x02
|
|
|
|
#define PERM_FULL_USER 0x03
|
|
|
|
#define PERM_SUDOERS 0x04
|
|
|
|
#define PERM_RUNAS 0x05
|
2010-04-22 17:40:01 -04:00
|
|
|
#define PERM_TIMESTAMP 0x06
|
1994-11-08 01:39:43 +00:00
|
|
|
|
1995-11-24 02:27:27 +00:00
|
|
|
/*
|
1999-07-22 12:56:28 +00:00
|
|
|
* Shortcuts for sudo_user contents.
|
1999-02-07 00:43:24 +00:00
|
|
|
*/
|
2010-03-14 19:58:47 -04:00
|
|
|
#define user_name (sudo_user.name)
|
|
|
|
#define user_uid (sudo_user.uid)
|
|
|
|
#define user_gid (sudo_user.gid)
|
2013-02-08 10:43:14 -05:00
|
|
|
#define user_sid (sudo_user.sid)
|
2013-03-28 15:40:32 -04:00
|
|
|
#define user_umask (sudo_user.umask)
|
1999-07-22 12:56:28 +00:00
|
|
|
#define user_passwd (sudo_user.pw->pw_passwd)
|
|
|
|
#define user_dir (sudo_user.pw->pw_dir)
|
2012-06-27 16:50:56 -04:00
|
|
|
#define user_gids (sudo_user.gids)
|
|
|
|
#define user_ngids (sudo_user.ngids)
|
2011-07-20 11:58:45 -04:00
|
|
|
#define user_group_list (sudo_user.group_list)
|
1999-07-22 12:56:28 +00:00
|
|
|
#define user_tty (sudo_user.tty)
|
2007-09-13 23:05:34 +00:00
|
|
|
#define user_ttypath (sudo_user.ttypath)
|
1999-07-22 12:56:28 +00:00
|
|
|
#define user_cwd (sudo_user.cwd)
|
|
|
|
#define user_cmnd (sudo_user.cmnd)
|
|
|
|
#define user_args (sudo_user.cmnd_args)
|
2004-08-24 18:01:14 +00:00
|
|
|
#define user_base (sudo_user.cmnd_base)
|
|
|
|
#define user_stat (sudo_user.cmnd_stat)
|
2000-12-30 03:29:47 +00:00
|
|
|
#define user_path (sudo_user.path)
|
1999-07-22 12:56:28 +00:00
|
|
|
#define user_prompt (sudo_user.prompt)
|
|
|
|
#define user_host (sudo_user.host)
|
|
|
|
#define user_shost (sudo_user.shost)
|
2013-08-14 13:49:14 -06:00
|
|
|
#define user_runhost (sudo_user.runhost)
|
|
|
|
#define user_srunhost (sudo_user.srunhost)
|
2007-07-15 19:44:46 +00:00
|
|
|
#define user_ccname (sudo_user.krb5_ccname)
|
1999-07-22 12:56:28 +00:00
|
|
|
#define safe_cmnd (sudo_user.cmnd_safe)
|
2016-01-04 10:35:18 -07:00
|
|
|
#define cmnd_fd (sudo_user.execfd)
|
2000-03-07 04:29:46 +00:00
|
|
|
#define login_class (sudo_user.class_name)
|
2000-12-30 03:29:47 +00:00
|
|
|
#define runas_pw (sudo_user._runas_pw)
|
2007-11-21 20:12:00 +00:00
|
|
|
#define runas_gr (sudo_user._runas_gr)
|
2008-02-09 14:30:07 +00:00
|
|
|
#define user_role (sudo_user.role)
|
|
|
|
#define user_type (sudo_user.type)
|
2010-05-24 15:40:36 -04:00
|
|
|
#define user_closefrom (sudo_user.closefrom)
|
2012-07-26 13:49:21 -04:00
|
|
|
#define runas_privs (sudo_user.privs)
|
|
|
|
#define runas_limitprivs (sudo_user.limitprivs)
|
1999-02-07 00:43:24 +00:00
|
|
|
|
2010-07-02 11:11:25 -04:00
|
|
|
#ifdef __TANDEM
|
2012-11-12 15:20:10 -05:00
|
|
|
# define ROOT_UID 65535
|
2010-07-02 11:11:25 -04:00
|
|
|
#else
|
2012-11-12 15:20:10 -05:00
|
|
|
# define ROOT_UID 0
|
2010-07-02 11:11:25 -04:00
|
|
|
#endif
|
2012-11-12 15:20:10 -05:00
|
|
|
#define ROOT_GID 0
|
2010-07-02 11:11:25 -04:00
|
|
|
|
2014-06-26 15:51:15 -06:00
|
|
|
struct sudo_lbuf;
|
2004-11-25 17:20:57 +00:00
|
|
|
struct passwd;
|
2010-06-16 17:10:04 -04:00
|
|
|
struct stat;
|
|
|
|
struct timeval;
|
2004-11-25 17:20:57 +00:00
|
|
|
|
1994-05-28 19:13:44 +00:00
|
|
|
/*
|
1996-06-20 04:41:55 +00:00
|
|
|
* Function prototypes
|
1994-05-28 19:13:44 +00:00
|
|
|
*/
|
2012-09-14 16:19:25 -04:00
|
|
|
#define YY_DECL int sudoerslex(void)
|
1994-05-28 19:13:44 +00:00
|
|
|
|
2010-04-22 17:40:01 -04:00
|
|
|
/* goodpath.c */
|
2015-06-18 09:51:36 -06:00
|
|
|
bool sudo_goodpath(const char *path, struct stat *sbp);
|
2010-04-22 17:40:01 -04:00
|
|
|
|
|
|
|
/* findpath.c */
|
2015-06-18 09:51:36 -06:00
|
|
|
int find_path(const char *infile, char **outfile, struct stat *sbp,
|
|
|
|
const char *path, int ignore_dot, char * const *whitelist);
|
2010-04-22 17:40:01 -04:00
|
|
|
|
|
|
|
/* check.c */
|
2012-10-23 14:27:52 -04:00
|
|
|
int check_user(int validate, int mode);
|
2011-12-02 11:27:33 -05:00
|
|
|
bool user_is_exempt(void);
|
2013-03-25 11:19:56 -04:00
|
|
|
|
|
|
|
/* prompt.c */
|
2014-03-19 16:55:37 -06:00
|
|
|
char *expand_prompt(const char *old_prompt, const char *auth_user);
|
2010-04-22 17:40:01 -04:00
|
|
|
|
2012-10-23 14:16:57 -04:00
|
|
|
/* timestamp.c */
|
2015-09-07 06:06:08 -06:00
|
|
|
int timestamp_remove(bool unlinkit);
|
2012-10-23 14:16:57 -04:00
|
|
|
|
2010-04-22 17:40:01 -04:00
|
|
|
/* sudo_auth.c */
|
2013-02-24 05:54:57 -05:00
|
|
|
bool sudo_auth_needs_end_session(void);
|
2015-09-07 06:06:08 -06:00
|
|
|
int verify_user(struct passwd *pw, char *prompt, int validated, struct sudo_conv_callback *callback);
|
2012-03-15 09:18:36 -04:00
|
|
|
int sudo_auth_begin_session(struct passwd *pw, char **user_env[]);
|
|
|
|
int sudo_auth_end_session(struct passwd *pw);
|
2011-09-27 13:18:46 -04:00
|
|
|
int sudo_auth_init(struct passwd *pw);
|
|
|
|
int sudo_auth_cleanup(struct passwd *pw);
|
2010-04-22 17:40:01 -04:00
|
|
|
|
|
|
|
/* set_perms.c */
|
2014-04-10 16:11:47 -06:00
|
|
|
bool rewind_perms(void);
|
|
|
|
bool set_perms(int);
|
|
|
|
bool restore_perms(void);
|
2010-04-22 17:40:01 -04:00
|
|
|
int pam_prep_user(struct passwd *);
|
|
|
|
|
|
|
|
/* gram.y */
|
2012-09-14 16:19:25 -04:00
|
|
|
int sudoersparse(void);
|
2013-12-16 14:18:42 -07:00
|
|
|
extern char *login_style;
|
|
|
|
extern const char *errorfile;
|
|
|
|
extern int errorlineno;
|
|
|
|
extern bool parse_error;
|
|
|
|
extern bool sudoers_warnings;
|
2010-04-22 17:40:01 -04:00
|
|
|
|
|
|
|
/* toke.l */
|
|
|
|
YY_DECL;
|
2013-12-16 14:18:42 -07:00
|
|
|
extern FILE *sudoersin;
|
2012-02-29 15:50:48 -05:00
|
|
|
extern const char *sudoers_file;
|
2013-12-16 14:18:42 -07:00
|
|
|
extern char *sudoers;
|
2012-02-29 15:50:48 -05:00
|
|
|
extern mode_t sudoers_mode;
|
|
|
|
extern uid_t sudoers_uid;
|
|
|
|
extern gid_t sudoers_gid;
|
2013-12-16 14:18:42 -07:00
|
|
|
extern int sudolineno;
|
|
|
|
extern int last_token;
|
2010-04-22 17:40:01 -04:00
|
|
|
|
|
|
|
/* defaults.c */
|
2010-03-17 19:56:27 -04:00
|
|
|
void dump_defaults(void);
|
|
|
|
void dump_auth_methods(void);
|
2010-04-22 17:40:01 -04:00
|
|
|
|
|
|
|
/* getspwuid.c */
|
2010-03-17 19:56:27 -04:00
|
|
|
char *sudo_getepw(const struct passwd *);
|
2010-04-22 17:40:01 -04:00
|
|
|
|
|
|
|
/* sudo_nss.c */
|
2015-06-26 10:33:28 -06:00
|
|
|
int display_privs(struct sudo_nss_list *, struct passwd *);
|
|
|
|
int display_cmnd(struct sudo_nss_list *, struct passwd *);
|
2010-04-22 17:40:01 -04:00
|
|
|
|
|
|
|
/* pwutil.c */
|
2012-06-13 16:21:45 -04:00
|
|
|
__dso_public struct group *sudo_getgrgid(gid_t);
|
|
|
|
__dso_public struct group *sudo_getgrnam(const char *);
|
|
|
|
__dso_public void sudo_gr_addref(struct group *);
|
|
|
|
__dso_public void sudo_gr_delref(struct group *);
|
2013-12-05 14:34:56 -07:00
|
|
|
bool user_in_group(const struct passwd *, const char *);
|
2012-06-13 16:21:45 -04:00
|
|
|
struct group *sudo_fakegrnam(const char *);
|
2013-12-05 14:34:56 -07:00
|
|
|
struct group_list *sudo_get_grlist(const struct passwd *pw);
|
2012-06-13 16:21:45 -04:00
|
|
|
struct passwd *sudo_fakepwnam(const char *, gid_t);
|
2013-04-19 14:48:23 -04:00
|
|
|
struct passwd *sudo_mkpwent(const char *user, uid_t uid, gid_t gid, const char *home, const char *shell);
|
2012-06-13 16:21:45 -04:00
|
|
|
struct passwd *sudo_getpwnam(const char *);
|
|
|
|
struct passwd *sudo_getpwuid(uid_t);
|
2010-03-17 19:56:27 -04:00
|
|
|
void sudo_endgrent(void);
|
|
|
|
void sudo_endpwent(void);
|
|
|
|
void sudo_endspent(void);
|
2012-06-13 16:21:45 -04:00
|
|
|
void sudo_grlist_addref(struct group_list *);
|
|
|
|
void sudo_grlist_delref(struct group_list *);
|
|
|
|
void sudo_pw_addref(struct passwd *);
|
|
|
|
void sudo_pw_delref(struct passwd *);
|
2014-03-26 16:44:29 -06:00
|
|
|
int sudo_set_grlist(struct passwd *pw, char * const *groups, char * const *gids);
|
2015-05-27 09:51:54 -06:00
|
|
|
int sudo_setgrent(void);
|
|
|
|
int sudo_setpwent(void);
|
2012-06-13 16:21:45 -04:00
|
|
|
void sudo_setspent(void);
|
2010-04-22 17:40:01 -04:00
|
|
|
|
|
|
|
/* timestr.c */
|
|
|
|
char *get_timestr(time_t, int);
|
1994-08-05 00:24:07 +00:00
|
|
|
|
2014-02-03 05:45:27 -07:00
|
|
|
/* boottime.c */
|
2015-03-02 13:58:50 -07:00
|
|
|
bool get_boottime(struct timespec *);
|
2014-02-03 05:45:27 -07:00
|
|
|
|
2010-03-27 20:19:40 -04:00
|
|
|
/* iolog.c */
|
2014-04-04 15:30:12 -06:00
|
|
|
bool io_nextid(char *iolog_dir, char *iolog_dir_fallback, char sessid[7]);
|
|
|
|
bool io_set_max_sessid(const char *sessid);
|
2010-03-27 20:19:40 -04:00
|
|
|
|
2010-12-27 12:18:32 -05:00
|
|
|
/* iolog_path.c */
|
2010-12-31 09:55:40 -05:00
|
|
|
char *expand_iolog_path(const char *prefix, const char *dir, const char *file,
|
2012-10-25 16:58:31 -04:00
|
|
|
char **slashp);
|
2010-12-27 12:18:32 -05:00
|
|
|
|
2010-04-17 13:26:03 -04:00
|
|
|
/* env.c */
|
|
|
|
char **env_get(void);
|
2014-04-30 16:57:12 -06:00
|
|
|
bool env_merge(char * const envp[]);
|
2015-03-16 20:19:24 -06:00
|
|
|
bool env_swap_old(void);
|
2015-06-17 06:49:59 -06:00
|
|
|
bool env_init(char * const envp[]);
|
|
|
|
bool init_envtables(void);
|
2014-04-30 16:57:12 -06:00
|
|
|
bool insert_env_vars(char * const envp[]);
|
|
|
|
bool read_env_file(const char *, int);
|
|
|
|
bool rebuild_env(void);
|
|
|
|
bool validate_env_vars(char * const envp[]);
|
2012-03-07 16:35:42 -05:00
|
|
|
int sudo_setenv(const char *var, const char *val, int overwrite);
|
|
|
|
int sudo_unsetenv(const char *var);
|
|
|
|
char *sudo_getenv(const char *name);
|
|
|
|
int sudoers_hook_getenv(const char *name, char **value, void *closure);
|
|
|
|
int sudoers_hook_putenv(char *string, void *closure);
|
|
|
|
int sudoers_hook_setenv(const char *name, const char *value, int overwrite, void *closure);
|
|
|
|
int sudoers_hook_unsetenv(const char *name, void *closure);
|
2010-04-17 13:26:03 -04:00
|
|
|
|
2010-04-22 17:40:01 -04:00
|
|
|
/* sudoers.c */
|
2011-12-02 11:27:33 -05:00
|
|
|
FILE *open_sudoers(const char *, bool, bool *);
|
2012-10-25 16:58:31 -04:00
|
|
|
int sudoers_policy_init(void *info, char * const envp[]);
|
|
|
|
int sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[], void *closure);
|
2012-11-25 09:34:40 -05:00
|
|
|
void sudoers_cleanup(void);
|
2015-05-21 11:26:44 -06:00
|
|
|
extern struct sudo_user sudo_user;
|
|
|
|
extern struct passwd *list_pw;
|
|
|
|
extern int long_list;
|
|
|
|
extern int sudo_mode;
|
|
|
|
extern uid_t timestamp_uid;
|
|
|
|
extern sudo_conv_t sudo_conv;
|
|
|
|
extern sudo_printf_t sudo_printf;
|
2012-10-25 16:58:31 -04:00
|
|
|
|
2014-10-22 13:23:05 -06:00
|
|
|
/* sudoers_debug.c */
|
2015-06-17 06:49:59 -06:00
|
|
|
bool sudoers_debug_parse_flags(struct sudo_conf_debug_file_list *debug_files, const char *entry);
|
2014-10-27 16:06:20 -06:00
|
|
|
void sudoers_debug_register(const char *plugin_path, struct sudo_conf_debug_file_list *debug_files);
|
|
|
|
void sudoers_debug_deregister(void);
|
2014-10-22 13:23:05 -06:00
|
|
|
|
2012-10-25 16:58:31 -04:00
|
|
|
/* policy.c */
|
|
|
|
int sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group);
|
|
|
|
int sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask, char *iolog_path, void *v);
|
2013-04-25 14:49:02 -04:00
|
|
|
extern const char *path_ldap_conf;
|
|
|
|
extern const char *path_ldap_secret;
|
2010-04-22 17:40:01 -04:00
|
|
|
|
2010-07-02 11:11:25 -04:00
|
|
|
/* group_plugin.c */
|
|
|
|
int group_plugin_load(char *plugin_info);
|
|
|
|
void group_plugin_unload(void);
|
|
|
|
int group_plugin_query(const char *user, const char *group,
|
|
|
|
const struct passwd *pwd);
|
2015-12-18 14:05:02 -07:00
|
|
|
extern const char *path_plugin_dir;
|
2010-07-02 11:11:25 -04:00
|
|
|
|
2015-06-18 09:51:36 -06:00
|
|
|
/* editor.c */
|
|
|
|
char *resolve_editor(const char *ed, size_t edlen, int nfiles, char **files,
|
|
|
|
int *argc_out, char ***argv_out, char * const *whitelist);
|
|
|
|
|
2016-01-28 14:53:48 -07:00
|
|
|
/* gc.c */
|
|
|
|
enum sudoers_gc_types {
|
|
|
|
GC_UNKNOWN,
|
|
|
|
GC_VECTOR,
|
|
|
|
GC_PTR
|
|
|
|
};
|
|
|
|
bool sudoers_gc_add(enum sudoers_gc_types type, void *ptr);
|
|
|
|
bool sudoers_gc_remove(enum sudoers_gc_types type, void *ptr);
|
|
|
|
void sudoers_gc_init(void);
|
|
|
|
|
2015-05-21 11:13:20 -06:00
|
|
|
#endif /* SUDOERS_SUDOERS_H */
|