Kill __P in sudoers

This commit is contained in:
Todd C. Miller
2010-03-17 19:56:27 -04:00
parent 5a2a2d193f
commit d5ae4c7d87
35 changed files with 454 additions and 470 deletions

View File

@@ -133,7 +133,7 @@ alias_add(name, type, members)
*/
void
alias_apply(func, cookie)
int (*func) __P((void *, void *));
int (*func)(void *, void *);
void *cookie;
{
rbapply(aliases, func, cookie, inorder);

View File

@@ -64,7 +64,7 @@
#include "sudoers.h"
#include "sudo_auth.h"
static int check_dce_status __P((error_status_t, char *));
static int check_dce_status(error_status_t, char *);
int
dce_verify(pw, plain_pw, auth)

View File

@@ -61,7 +61,7 @@
#endif
#ifndef HAVE_KRB5_VERIFY_USER
static int verify_krb_v5_tgt __P((krb5_context, krb5_creds *, char *));
static int verify_krb_v5_tgt(krb5_context, krb5_creds *, char *);
#endif
static struct _sudo_krb5_data {
krb5_context sudo_context;

View File

@@ -72,8 +72,8 @@
# define PAM_CONST
#endif
static int converse __P((int, PAM_CONST struct pam_message **,
struct pam_response **, void *));
static int converse(int, PAM_CONST struct pam_message **,
struct pam_response **, void *);
static char *def_prompt = "Password:";
static int gotintr;

View File

@@ -49,7 +49,7 @@
#include "sudoers.h"
#include "sudo_auth.h"
static int sudo_collect __P((int, int, uchar_t *, int, prompt_t *));
static int sudo_collect(int, int, uchar_t *, int, prompt_t *);
static char *def_prompt;

View File

@@ -28,10 +28,10 @@ typedef struct sudo_auth {
short status; /* status from verify routine */
char *name; /* name of the method as a string */
void *data; /* method-specific data pointer */
int (*init) __P((struct passwd *pw, char **prompt, struct sudo_auth *auth));
int (*setup) __P((struct passwd *pw, char **prompt, struct sudo_auth *auth));
int (*verify) __P((struct passwd *pw, char *p, struct sudo_auth *auth));
int (*cleanup) __P((struct passwd *pw, struct sudo_auth *auth));
int (*init)(struct passwd *pw, char **prompt, struct sudo_auth *auth);
int (*setup)(struct passwd *pw, char **prompt, struct sudo_auth *auth);
int (*verify)(struct passwd *pw, char *p, struct sudo_auth *auth);
int (*cleanup)(struct passwd *pw, struct sudo_auth *auth);
} sudo_auth;
/* Values for sudo_auth.flags. */
@@ -52,38 +52,38 @@ char *auth_getpass(const char *prompt, int timeout, int type);
extern sudo_conv_t sudo_conv;
/* Prototypes for standalone methods */
int fwtk_init __P((struct passwd *pw, char **prompt, sudo_auth *auth));
int fwtk_verify __P((struct passwd *pw, char *prompt, sudo_auth *auth));
int fwtk_cleanup __P((struct passwd *pw, sudo_auth *auth));
int pam_init __P((struct passwd *pw, char **prompt, sudo_auth *auth));
int pam_verify __P((struct passwd *pw, char *prompt, sudo_auth *auth));
int pam_cleanup __P((struct passwd *pw, sudo_auth *auth));
int sia_setup __P((struct passwd *pw, char **prompt, sudo_auth *auth));
int sia_verify __P((struct passwd *pw, char *prompt, sudo_auth *auth));
int sia_cleanup __P((struct passwd *pw, sudo_auth *auth));
int aixauth_verify __P((struct passwd *pw, char *pass, sudo_auth *auth));
int aixauth_cleanup __P((struct passwd *pw, sudo_auth *auth));
int bsdauth_init __P((struct passwd *pw, char **prompt, sudo_auth *auth));
int bsdauth_verify __P((struct passwd *pw, char *prompt, sudo_auth *auth));
int bsdauth_cleanup __P((struct passwd *pw, sudo_auth *auth));
int fwtk_init(struct passwd *pw, char **prompt, sudo_auth *auth);
int fwtk_verify(struct passwd *pw, char *prompt, sudo_auth *auth);
int fwtk_cleanup(struct passwd *pw, sudo_auth *auth);
int pam_init(struct passwd *pw, char **prompt, sudo_auth *auth);
int pam_verify(struct passwd *pw, char *prompt, sudo_auth *auth);
int pam_cleanup(struct passwd *pw, sudo_auth *auth);
int sia_setup(struct passwd *pw, char **prompt, sudo_auth *auth);
int sia_verify(struct passwd *pw, char *prompt, sudo_auth *auth);
int sia_cleanup(struct passwd *pw, sudo_auth *auth);
int aixauth_verify(struct passwd *pw, char *pass, sudo_auth *auth);
int aixauth_cleanup(struct passwd *pw, sudo_auth *auth);
int bsdauth_init(struct passwd *pw, char **prompt, sudo_auth *auth);
int bsdauth_verify(struct passwd *pw, char *prompt, sudo_auth *auth);
int bsdauth_cleanup(struct passwd *pw, sudo_auth *auth);
/* Prototypes for normal methods */
int passwd_init __P((struct passwd *pw, char **prompt, sudo_auth *auth));
int passwd_verify __P((struct passwd *pw, char *pass, sudo_auth *auth));
int secureware_init __P((struct passwd *pw, char **prompt, sudo_auth *auth));
int secureware_verify __P((struct passwd *pw, char *pass, sudo_auth *auth));
int rfc1938_setup __P((struct passwd *pw, char **prompt, sudo_auth *auth));
int rfc1938_verify __P((struct passwd *pw, char *pass, sudo_auth *auth));
int afs_verify __P((struct passwd *pw, char *pass, sudo_auth *auth));
int dce_verify __P((struct passwd *pw, char *pass, sudo_auth *auth));
int kerb4_init __P((struct passwd *pw, char **prompt, sudo_auth *auth));
int kerb4_verify __P((struct passwd *pw, char *pass, sudo_auth *auth));
int kerb5_init __P((struct passwd *pw, char **prompt, sudo_auth *auth));
int kerb5_verify __P((struct passwd *pw, char *pass, sudo_auth *auth));
int kerb5_cleanup __P((struct passwd *pw, sudo_auth *auth));
int securid_init __P((struct passwd *pw, char **prompt, sudo_auth *auth));
int securid_setup __P((struct passwd *pw, char **prompt, sudo_auth *auth));
int securid_verify __P((struct passwd *pw, char *pass, sudo_auth *auth));
int passwd_init(struct passwd *pw, char **prompt, sudo_auth *auth);
int passwd_verify(struct passwd *pw, char *pass, sudo_auth *auth);
int secureware_init(struct passwd *pw, char **prompt, sudo_auth *auth);
int secureware_verify(struct passwd *pw, char *pass, sudo_auth *auth);
int rfc1938_setup(struct passwd *pw, char **prompt, sudo_auth *auth);
int rfc1938_verify(struct passwd *pw, char *pass, sudo_auth *auth);
int afs_verify(struct passwd *pw, char *pass, sudo_auth *auth);
int dce_verify(struct passwd *pw, char *pass, sudo_auth *auth);
int kerb4_init(struct passwd *pw, char **prompt, sudo_auth *auth);
int kerb4_verify(struct passwd *pw, char *pass, sudo_auth *auth);
int kerb5_init(struct passwd *pw, char **prompt, sudo_auth *auth);
int kerb5_verify(struct passwd *pw, char *pass, sudo_auth *auth);
int kerb5_cleanup(struct passwd *pw, sudo_auth *auth);
int securid_init(struct passwd *pw, char **prompt, sudo_auth *auth);
int securid_setup(struct passwd *pw, char **prompt, sudo_auth *auth);
int securid_verify(struct passwd *pw, char *pass, sudo_auth *auth);
/* Fields: need_root, name, init, setup, verify, cleanup */
#define AUTH_ENTRY(r, n, i, s, v, c) \

View File

@@ -69,11 +69,11 @@
#define TS_MAKE_DIRS 1
#define TS_REMOVE 2
static int build_timestamp __P((char **, char **));
static int timestamp_status __P((char *, char *, char *, int));
static char *expand_prompt __P((char *, char *, char *));
static void lecture __P((int));
static void update_timestamp __P((char *, char *));
static int build_timestamp(char **, char **);
static int timestamp_status(char *, char *, char *, int);
static char *expand_prompt(char *, char *, char *);
static void lecture(int);
static void update_timestamp(char *, char *);
extern sudo_conv_t sudo_conv;

View File

@@ -92,18 +92,18 @@ static struct strmap priorities[] = {
/*
* Local prototypes.
*/
static int store_int __P((char *, struct sudo_defs_types *, int));
static int store_list __P((char *, struct sudo_defs_types *, int));
static int store_mode __P((char *, struct sudo_defs_types *, int));
static int store_str __P((char *, struct sudo_defs_types *, int));
static int store_syslogfac __P((char *, struct sudo_defs_types *, int));
static int store_syslogpri __P((char *, struct sudo_defs_types *, int));
static int store_tuple __P((char *, struct sudo_defs_types *, int));
static int store_uint __P((char *, struct sudo_defs_types *, int));
static int store_float __P((char *, struct sudo_defs_types *, int));
static void list_op __P((char *, size_t, struct sudo_defs_types *, enum list_ops));
static const char *logfac2str __P((int));
static const char *logpri2str __P((int));
static int store_int(char *, struct sudo_defs_types *, int);
static int store_list(char *, struct sudo_defs_types *, int);
static int store_mode(char *, struct sudo_defs_types *, int);
static int store_str(char *, struct sudo_defs_types *, int);
static int store_syslogfac(char *, struct sudo_defs_types *, int);
static int store_syslogpri(char *, struct sudo_defs_types *, int);
static int store_tuple(char *, struct sudo_defs_types *, int);
static int store_uint(char *, struct sudo_defs_types *, int);
static int store_float(char *, struct sudo_defs_types *, int);
static void list_op(char *, size_t, struct sudo_defs_types *, enum list_ops);
static const char *logfac2str(int);
static const char *logpri2str(int);
/*
* Table describing compile-time and run-time options.

View File

@@ -48,7 +48,7 @@ struct sudo_defs_types {
int type;
char *desc;
struct def_values *values;
int (*callback) __P((char *));
int (*callback)(char *);
union {
int flag;
int ival;
@@ -105,11 +105,11 @@ struct sudo_defs_types {
/*
* Prototypes
*/
void dump_default __P((void));
int set_default __P((char *, char *, int));
void init_defaults __P((void));
int update_defaults __P((int));
void list_options __P((void));
void dump_default(void);
void init_defaults(void);
void list_options(void);
int set_default(char *, char *, int);
int update_defaults(int);
extern struct sudo_defs_types sudo_defs_table[];

View File

@@ -98,9 +98,8 @@ struct environment {
/*
* Prototypes
*/
void rebuild_env __P((int, int));
static void sudo_setenv __P((const char *, const char *, int));
static void sudo_putenv __P((char *, int, int));
static void sudo_setenv(const char *, const char *, int);
static void sudo_putenv(char *, int, int);
extern char **environ; /* global environment */

View File

@@ -1,11 +1,3 @@
#ifndef lint
/*static char yysccsid[] = "from: @(#)yaccpar 1.9 (Berkeley) 02/21/93";*/
static char yyrcsid[]
#if __GNUC__ >= 2
__attribute__ ((unused))
#endif /* __GNUC__ >= 2 */
= "$OpenBSD: skeleton.c,v 1.29 2008/07/08 15:06:50 otto Exp $";
#endif
#include <stdlib.h>
#include <string.h>
#define YYBYACC 1
@@ -118,11 +110,11 @@ static MERIDIAN yyMeridian;
static time_t yyRelMonth;
static time_t yyRelSeconds;
static int yyerror __P((char *s));
static int yylex __P((void));
static int yyparse __P((void));
static int yyerror(char *s);
static int yylex(void);
static int yyparse(void);
#line 106 "getdate.y"
#line 108 "getdate.y"
#ifndef YYSTYPE_DEFINED
#define YYSTYPE_DEFINED
typedef union {
@@ -130,7 +122,7 @@ typedef union {
enum _MERIDIAN Meridian;
} YYSTYPE;
#endif /* YYSTYPE_DEFINED */
#line 132 "y.tab.c"
#line 126 "y.tab.c"
#define tAGO 257
#define tDAY 258
#define tDAYZONE 259
@@ -398,7 +390,7 @@ short *yyss;
short *yysslim;
YYSTYPE *yyvs;
int yystacksize;
#line 325 "getdate.y"
#line 327 "getdate.y"
/* Month and day table. */
static TABLE const MonthDayTable[] = {
@@ -1040,7 +1032,7 @@ main(ac, av)
/* NOTREACHED */
}
#endif /* defined(TEST) */
#line 990 "y.tab.c"
#line 984 "y.tab.c"
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
#if defined(__cplusplus) || defined(__STDC__)
static int yygrowstack(void)
@@ -1246,37 +1238,37 @@ yyreduce:
switch (yyn)
{
case 3:
#line 124 "getdate.y"
#line 126 "getdate.y"
{
yyHaveTime++;
}
break;
case 4:
#line 127 "getdate.y"
#line 129 "getdate.y"
{
yyHaveZone++;
}
break;
case 5:
#line 130 "getdate.y"
#line 132 "getdate.y"
{
yyHaveDate++;
}
break;
case 6:
#line 133 "getdate.y"
#line 135 "getdate.y"
{
yyHaveDay++;
}
break;
case 7:
#line 136 "getdate.y"
#line 138 "getdate.y"
{
yyHaveRel++;
}
break;
case 9:
#line 142 "getdate.y"
#line 144 "getdate.y"
{
yyHour = yyvsp[-1].Number;
yyMinutes = 0;
@@ -1285,7 +1277,7 @@ case 9:
}
break;
case 10:
#line 148 "getdate.y"
#line 150 "getdate.y"
{
yyHour = yyvsp[-3].Number;
yyMinutes = yyvsp[-1].Number;
@@ -1294,7 +1286,7 @@ case 10:
}
break;
case 11:
#line 154 "getdate.y"
#line 156 "getdate.y"
{
yyHour = yyvsp[-3].Number;
yyMinutes = yyvsp[-1].Number;
@@ -1304,7 +1296,7 @@ case 11:
}
break;
case 12:
#line 161 "getdate.y"
#line 163 "getdate.y"
{
yyHour = yyvsp[-5].Number;
yyMinutes = yyvsp[-3].Number;
@@ -1313,7 +1305,7 @@ case 12:
}
break;
case 13:
#line 167 "getdate.y"
#line 169 "getdate.y"
{
yyHour = yyvsp[-5].Number;
yyMinutes = yyvsp[-3].Number;
@@ -1324,56 +1316,56 @@ case 13:
}
break;
case 14:
#line 177 "getdate.y"
#line 179 "getdate.y"
{
yyTimezone = yyvsp[0].Number;
yyDSTmode = DSToff;
}
break;
case 15:
#line 181 "getdate.y"
#line 183 "getdate.y"
{
yyTimezone = yyvsp[0].Number;
yyDSTmode = DSTon;
}
break;
case 16:
#line 186 "getdate.y"
#line 188 "getdate.y"
{
yyTimezone = yyvsp[-1].Number;
yyDSTmode = DSTon;
}
break;
case 17:
#line 192 "getdate.y"
#line 194 "getdate.y"
{
yyDayOrdinal = 1;
yyDayNumber = yyvsp[0].Number;
}
break;
case 18:
#line 196 "getdate.y"
#line 198 "getdate.y"
{
yyDayOrdinal = 1;
yyDayNumber = yyvsp[-1].Number;
}
break;
case 19:
#line 200 "getdate.y"
#line 202 "getdate.y"
{
yyDayOrdinal = yyvsp[-1].Number;
yyDayNumber = yyvsp[0].Number;
}
break;
case 20:
#line 206 "getdate.y"
#line 208 "getdate.y"
{
yyMonth = yyvsp[-2].Number;
yyDay = yyvsp[0].Number;
}
break;
case 21:
#line 210 "getdate.y"
#line 212 "getdate.y"
{
if (yyvsp[-4].Number >= 100) {
yyYear = yyvsp[-4].Number;
@@ -1387,7 +1379,7 @@ case 21:
}
break;
case 22:
#line 221 "getdate.y"
#line 223 "getdate.y"
{
/* ISO 8601 format. yyyy-mm-dd. */
yyYear = yyvsp[-2].Number;
@@ -1396,7 +1388,7 @@ case 22:
}
break;
case 23:
#line 227 "getdate.y"
#line 229 "getdate.y"
{
/* e.g. 17-JUN-1992. */
yyDay = yyvsp[-2].Number;
@@ -1405,14 +1397,14 @@ case 23:
}
break;
case 24:
#line 233 "getdate.y"
#line 235 "getdate.y"
{
yyMonth = yyvsp[-1].Number;
yyDay = yyvsp[0].Number;
}
break;
case 25:
#line 237 "getdate.y"
#line 239 "getdate.y"
{
yyMonth = yyvsp[-3].Number;
yyDay = yyvsp[-2].Number;
@@ -1420,14 +1412,14 @@ case 25:
}
break;
case 26:
#line 242 "getdate.y"
#line 244 "getdate.y"
{
yyMonth = yyvsp[0].Number;
yyDay = yyvsp[-1].Number;
}
break;
case 27:
#line 246 "getdate.y"
#line 248 "getdate.y"
{
yyMonth = yyvsp[-1].Number;
yyDay = yyvsp[-2].Number;
@@ -1435,68 +1427,68 @@ case 27:
}
break;
case 28:
#line 253 "getdate.y"
#line 255 "getdate.y"
{
yyRelSeconds = -yyRelSeconds;
yyRelMonth = -yyRelMonth;
}
break;
case 30:
#line 260 "getdate.y"
#line 262 "getdate.y"
{
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L;
}
break;
case 31:
#line 263 "getdate.y"
#line 265 "getdate.y"
{
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L;
}
break;
case 32:
#line 266 "getdate.y"
#line 268 "getdate.y"
{
yyRelSeconds += yyvsp[0].Number * 60L;
}
break;
case 33:
#line 269 "getdate.y"
#line 271 "getdate.y"
{
yyRelSeconds += yyvsp[-1].Number;
}
break;
case 34:
#line 272 "getdate.y"
#line 274 "getdate.y"
{
yyRelSeconds += yyvsp[-1].Number;
}
break;
case 35:
#line 275 "getdate.y"
#line 277 "getdate.y"
{
yyRelSeconds++;
}
break;
case 36:
#line 278 "getdate.y"
#line 280 "getdate.y"
{
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
}
break;
case 37:
#line 281 "getdate.y"
#line 283 "getdate.y"
{
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
}
break;
case 38:
#line 284 "getdate.y"
#line 286 "getdate.y"
{
yyRelMonth += yyvsp[0].Number;
}
break;
case 39:
#line 289 "getdate.y"
#line 291 "getdate.y"
{
if (yyHaveTime && yyHaveDate && !yyHaveRel)
yyYear = yyvsp[0].Number;
@@ -1524,18 +1516,18 @@ case 39:
}
break;
case 40:
#line 316 "getdate.y"
#line 318 "getdate.y"
{
yyval.Meridian = MER24;
}
break;
case 41:
#line 319 "getdate.y"
#line 321 "getdate.y"
{
yyval.Meridian = yyvsp[0].Meridian;
}
break;
#line 1485 "y.tab.c"
#line 1479 "y.tab.c"
}
yyssp -= yym;
yystate = *yyssp;

View File

@@ -99,9 +99,9 @@ static MERIDIAN yyMeridian;
static time_t yyRelMonth;
static time_t yyRelSeconds;
static int yyerror __P((char *s));
static int yylex __P((void));
static int yyparse __P((void));
static int yyerror(char *s);
static int yylex(void);
static int yyparse(void);
%}

View File

@@ -94,11 +94,11 @@ struct userspec_list userspecs;
/*
* Local protoypes
*/
static void add_defaults __P((int, struct member *, struct defaults *));
static void add_userspec __P((struct member *, struct privilege *));
static struct defaults *new_default __P((char *, char *, int));
static struct member *new_member __P((char *, int));
void yyerror __P((const char *));
static void add_defaults(int, struct member *, struct defaults *);
static void add_userspec(struct member *, struct privilege *);
static struct defaults *new_default(char *, char *, int);
static struct member *new_member(char *, int);
void yyerror(const char *);
void
yyerror(s)

View File

@@ -83,11 +83,11 @@ struct userspec_list userspecs;
/*
* Local protoypes
*/
static void add_defaults __P((int, struct member *, struct defaults *));
static void add_userspec __P((struct member *, struct privilege *));
static struct defaults *new_default __P((char *, char *, int));
static struct member *new_member __P((char *, int));
void yyerror __P((const char *));
static void add_defaults(int, struct member *, struct defaults *);
static void add_userspec(struct member *, struct privilege *);
static struct defaults *new_default(char *, char *, int);
static struct member *new_member(char *, int);
void yyerror(const char *);
void
yyerror(s)

View File

@@ -44,8 +44,8 @@ struct interface {
/*
* Prototypes for external functions.
*/
void load_interfaces __P((void));
void dump_interfaces __P((void));
void load_interfaces(void);
void dump_interfaces(void);
/*
* Definitions for external variables.

View File

@@ -58,12 +58,12 @@
#include "sudoers.h"
static void do_syslog __P((int, char *));
static void do_logfile __P((char *));
static void send_mail __P((const char *fmt, ...));
static int should_mail __P((int));
static void mysyslog __P((int, const char *, ...));
static char *new_logline __P((const char *, int));
static void do_syslog(int, char *);
static void do_logfile(char *);
static void send_mail(const char *fmt, ...);
static int should_mail(int);
static void mysyslog(int, const char *, ...);
static char *new_logline(const char *, int);
extern sigjmp_buf error_jmp;

View File

@@ -47,12 +47,11 @@
# define MAXSYSLOGLEN 960
#endif
void audit_success __P((char **));
void audit_failure __P((char **, char const * const, ...));
void log_allowed __P((int));
void log_denial __P((int, int));
void log_error __P((int flags, const char *fmt, ...))
__printflike(2, 3);
RETSIGTYPE reapchild __P((int));
void audit_success(char **);
void audit_failure(char **, char const * const, ...);
void log_allowed(int);
void log_denial(int, int);
void log_error(int flags, const char *fmt, ...) __printflike(2, 3);
RETSIGTYPE reapchild(int);
#endif /* _LOGGING_H */

View File

@@ -95,10 +95,10 @@
static struct member_list empty;
static int command_matches_dir __P((char *, size_t));
static int command_matches_glob __P((char *, char *));
static int command_matches_fnmatch __P((char *, char *));
static int command_matches_normal __P((char *, char *));
static int command_matches_dir(char *, size_t);
static int command_matches_glob(char *, char *);
static int command_matches_fnmatch(char *, char *);
static int command_matches_normal(char *, char *);
/*
* Returns TRUE if string 's' contains meta characters.

View File

@@ -20,29 +20,27 @@ struct childinfo;
struct listhead;
struct syscallhandler;
static int check_execv __P((int, pid_t, u_int16_t,
struct str_msg_ask *, int *, int *));
static int check_execve __P((int, pid_t, u_int16_t,
struct str_msg_ask *, int *, int *));
static void log_exec __P((int));
static int decode_args __P((int, pid_t, struct str_msg_ask *));
static int set_policy __P((int, struct childinfo *));
static int switch_emulation __P((int, struct str_message *));
static int systrace_open __P((void));
static ssize_t systrace_read __P((int, pid_t, void *, void *, size_t));
static int check_execv(int, pid_t, u_int16_t, struct str_msg_ask *, int *, int *);
static int check_execve(int, pid_t, u_int16_t, struct str_msg_ask *, int *, int *);
static void log_exec(int);
static int decode_args(int, pid_t, struct str_msg_ask *);
static int set_policy(int, struct childinfo *);
static int switch_emulation(int, struct str_message *);
static int systrace_open(void);
static ssize_t systrace_read(int, pid_t, void *, void *, size_t);
#ifdef STRIOCINJECT
static ssize_t systrace_write __P((int, pid_t, void *, void *, size_t));
static int update_env __P((int, pid_t, u_int16_t, struct str_msg_ask *));
static ssize_t systrace_write(int, pid_t, void *, void *, size_t);
static int update_env(int, pid_t, u_int16_t, struct str_msg_ask *);
#endif
static struct syscallhandler *find_handler __P((pid_t, int));
static ssize_t read_string __P((int, pid_t, void *, char *, size_t));
static struct childinfo *find_child __P((pid_t));
static void catchsig __P((int));
static void detachall __P((int));
static void killall __P((int));
static void new_child __P((pid_t, pid_t));
static void rm_child __P((pid_t));
static void update_child __P((pid_t, uid_t));
static struct syscallhandler *find_handler(pid_t, int);
static ssize_t read_string(int, pid_t, void *, char *, size_t);
static struct childinfo *find_child(pid_t);
static void catchsig(int);
static void detachall(int);
static void killall(int);
static void new_child(pid_t, pid_t);
static void rm_child(pid_t);
static void update_child(pid_t, uid_t);
static struct listhead children; /* list of children being traced */
@@ -61,10 +59,8 @@ struct childinfo {
};
struct syscallhandler {
int (*checker)
__P((int, pid_t, u_int16_t, struct str_msg_ask *, int *, int *));
void (*logger)
__P((int));
int (*checker)(int, pid_t, u_int16_t, struct str_msg_ask *, int *, int *);
void (*logger)(int);
};
/*

View File

@@ -76,8 +76,8 @@ extern int errorlineno, parse_error;
/*
* Local prototypes.
*/
static void print_member __P((struct lbuf *, char *, int, int, int));
static int display_bound_defaults __P((int, struct lbuf *));
static void print_member(struct lbuf *, char *, int, int, int);
static int display_bound_defaults(int, struct lbuf *);
int
sudo_file_open(nss)

View File

@@ -164,27 +164,27 @@ extern unsigned int alias_seqno;
/*
* Prototypes
*/
char *alias_add __P((char *, int, struct member *));
int addr_matches __P((char *));
int cmnd_matches __P((struct member *));
int cmndlist_matches __P((struct member_list *));
int command_matches __P((char *, char *));
int hostlist_matches __P((struct member_list *));
int hostname_matches __P((char *, char *, char *));
int netgr_matches __P((char *, char *, char *, char *));
int no_aliases __P((void));
int runaslist_matches __P((struct member_list *, struct member_list *));
int userlist_matches __P((struct passwd *, struct member_list *));
int usergr_matches __P((char *, char *, struct passwd *));
int userpw_matches __P((char *, char *, struct passwd *));
int group_matches __P((char *, struct group *));
struct alias *alias_find __P((char *, int));
struct alias *alias_remove __P((char *, int));
void alias_free __P((void *));
void alias_apply __P((int (*)(void *, void *), void *));
void init_aliases __P((void));
void init_lexer __P((void));
void init_parser __P((char *, int));
int alias_compare __P((const void *, const void *));
char *alias_add(char *, int, struct member *);
int addr_matches(char *);
int cmnd_matches(struct member *);
int cmndlist_matches(struct member_list *);
int command_matches(char *, char *);
int hostlist_matches(struct member_list *);
int hostname_matches(char *, char *, char *);
int netgr_matches(char *, char *, char *, char *);
int no_aliases(void);
int runaslist_matches(struct member_list *, struct member_list *);
int userlist_matches(struct passwd *, struct member_list *);
int usergr_matches(char *, char *, struct passwd *);
int userpw_matches(char *, char *, struct passwd *);
int group_matches(char *, struct group *);
struct alias *alias_find(char *, int);
struct alias *alias_remove(char *, int);
void alias_free(void *);
void alias_apply(int (*)(void *, void *), void *);
void init_aliases(void);
void init_lexer(void);
void init_parser(char *, int);
int alias_compare(const void *, const void *);
#endif /* _SUDO_PARSE_H */

View File

@@ -58,10 +58,10 @@
static struct rbtree *pwcache_byuid, *pwcache_byname;
static struct rbtree *grcache_bygid, *grcache_byname;
static int cmp_pwuid __P((const void *, const void *));
static int cmp_pwnam __P((const void *, const void *));
static int cmp_grgid __P((const void *, const void *));
static int cmp_grnam __P((const void *, const void *));
static int cmp_pwuid(const void *, const void *);
static int cmp_pwnam(const void *, const void *);
static int cmp_grgid(const void *, const void *);
static int cmp_grnam(const void *, const void *);
/*
* Compare by uid.
@@ -315,7 +315,7 @@ sudo_fakegrnam(group)
}
void
sudo_setpwent()
sudo_setpwent(void)
{
setpwent();
sudo_setspent();
@@ -326,10 +326,10 @@ sudo_setpwent()
}
#ifdef PURIFY
static void pw_free __P((void *));
static void pw_free(void *);
void
sudo_freepwcache()
sudo_freepwcache(void)
{
if (pwcache_byuid != NULL) {
rbdestroy(pwcache_byuid, pw_free);
@@ -356,7 +356,7 @@ pw_free(v)
#endif /* PURIFY */
void
sudo_endpwent()
sudo_endpwent(void)
{
endpwent();
sudo_endspent();
@@ -513,7 +513,7 @@ sudo_getgrnam(name)
}
void
sudo_setgrent()
sudo_setgrent(void)
{
setgrent();
if (grcache_bygid == NULL)
@@ -524,7 +524,7 @@ sudo_setgrent()
#ifdef PURIFY
void
sudo_freegrcache()
sudo_freegrcache(void)
{
if (grcache_bygid != NULL) {
rbdestroy(grcache_bygid, free);
@@ -538,7 +538,7 @@ sudo_freegrcache()
#endif /* PURIFY */
void
sudo_endgrent()
sudo_endgrent(void)
{
endgrent();
#ifdef PURIFY

View File

@@ -57,11 +57,10 @@
#include "sudoers.h"
#include "redblack.h"
static void rbrepair __P((struct rbtree *, struct rbnode *));
static void rotate_left __P((struct rbtree *, struct rbnode *));
static void rotate_right __P((struct rbtree *, struct rbnode *));
static void _rbdestroy __P((struct rbtree *, struct rbnode *,
void (*)(void *)));
static void rbrepair(struct rbtree *, struct rbnode *);
static void rotate_left(struct rbtree *, struct rbnode *);
static void rotate_right(struct rbtree *, struct rbnode *);
static void _rbdestroy(struct rbtree *, struct rbnode *, void (*)(void *));
/*
* Red-Black tree, see http://en.wikipedia.org/wiki/Red-black_tree
@@ -87,7 +86,7 @@ static void _rbdestroy __P((struct rbtree *, struct rbnode *,
*/
struct rbtree *
rbcreate(compar)
int (*compar)__P((const void *, const void*));
int (*compar)(const void *, const void*);
{
struct rbtree *tree;
@@ -287,7 +286,7 @@ int
rbapply_node(tree, node, func, cookie, order)
struct rbtree *tree;
struct rbnode *node;
int (*func)__P((void *, void *));
int (*func)(void *, void *);
void *cookie;
enum rbtraversal order;
{
@@ -341,7 +340,7 @@ static void
_rbdestroy(tree, node, destroy)
struct rbtree *tree;
struct rbnode *node;
void (*destroy)__P((void *));
void (*destroy)(void *);
{
if (node != rbnil(tree)) {
_rbdestroy(tree, node->left, destroy);
@@ -359,7 +358,7 @@ _rbdestroy(tree, node, destroy)
void
rbdestroy(tree, destroy)
struct rbtree *tree;
void (*destroy)__P((void *));
void (*destroy)(void *);
{
_rbdestroy(tree, rbfirst(tree), destroy);
efree(tree);

View File

@@ -35,7 +35,7 @@ struct rbnode {
};
struct rbtree {
int (*compar) __P((const void *, const void *));
int (*compar)(const void *, const void *);
struct rbnode root;
struct rbnode nil;
};
@@ -46,13 +46,12 @@ struct rbtree {
#define rbroot(t) (&(t)->root)
#define rbnil(t) (&(t)->nil)
void *rbdelete __P((struct rbtree *, struct rbnode *));
int rbapply_node __P((struct rbtree *, struct rbnode *,
int (*)(void *, void *), void *,
enum rbtraversal));
struct rbnode *rbfind __P((struct rbtree *, void *));
struct rbnode *rbinsert __P((struct rbtree *, void *));
struct rbtree *rbcreate __P((int (*)(const void *, const void *)));
void rbdestroy __P((struct rbtree *, void (*)(void *)));
void *rbdelete(struct rbtree *, struct rbnode *);
int rbapply_node(struct rbtree *, struct rbnode *,
int (*)(void *, void *), void *, enum rbtraversal);
struct rbnode *rbfind(struct rbtree *, void *);
struct rbnode *rbinsert(struct rbtree *, void *);
struct rbtree *rbcreate(int (*)(const void *, const void *));
void rbdestroy(struct rbtree *, void (*)(void *));
#endif /* _SUDO_REDBLACK_H */

View File

@@ -60,9 +60,9 @@
/*
* Prototypes
*/
static void runas_setup __P((void));
static void runas_setgroups __P((void));
static void restore_groups __P((void));
static void runas_setup(void);
static void runas_setgroups(void);
static void restore_groups(void);
static int current_perm = -1;

View File

@@ -20,15 +20,15 @@ struct passwd;
struct sudo_nss {
struct sudo_nss *prev;
struct sudo_nss *next;
int (*open) __P((struct sudo_nss *nss));
int (*close) __P((struct sudo_nss *nss));
int (*parse) __P((struct sudo_nss *nss));
int (*setdefs) __P((struct sudo_nss *nss));
int (*lookup) __P((struct sudo_nss *nss, int, int));
int (*display_cmnd) __P((struct sudo_nss *nss, struct passwd *));
int (*display_defaults) __P((struct sudo_nss *nss, struct passwd *, struct lbuf *));
int (*display_bound_defaults) __P((struct sudo_nss *nss, struct passwd *, struct lbuf *));
int (*display_privs) __P((struct sudo_nss *nss, struct passwd *, struct lbuf *));
int (*open)(struct sudo_nss *nss);
int (*close)(struct sudo_nss *nss);
int (*parse)(struct sudo_nss *nss);
int (*setdefs)(struct sudo_nss *nss);
int (*lookup)(struct sudo_nss *nss, int, int);
int (*display_cmnd)(struct sudo_nss *nss, struct passwd *);
int (*display_defaults)(struct sudo_nss *nss, struct passwd *, struct lbuf *);
int (*display_bound_defaults)(struct sudo_nss *nss, struct passwd *, struct lbuf *);
int (*display_privs)(struct sudo_nss *nss, struct passwd *, struct lbuf *);
void *handle;
short ret_if_found;
short ret_if_notfound;
@@ -36,4 +36,4 @@ struct sudo_nss {
TQ_DECLARE(sudo_nss)
struct sudo_nss_list *sudo_read_nss __P((void));
struct sudo_nss_list *sudo_read_nss(void);

View File

@@ -112,21 +112,21 @@
/*
* Prototypes
*/
static void init_vars __P((char * const *));
static int set_cmnd __P((int));
static void set_loginclass __P((struct passwd *));
static void set_project __P((struct passwd *));
static void set_runasgr __P((char *));
static void set_runaspw __P((char *));
static void init_vars(char * const *);
static int set_cmnd(int);
static void set_loginclass(struct passwd *);
static void set_project(struct passwd *);
static void set_runasgr(char *);
static void set_runaspw(char *);
static int sudoers_policy_version(int verbose);
static struct passwd *get_authpw __P((void));
static struct passwd *get_authpw(void);
static int deserialize_info(char * const settings[], char * const user_info[]);
extern int sudo_edit __P((int, char **, char **));
extern int rebuild_env __P((int, int));
extern int env_init __P((char * const envp[]));
void validate_env_vars __P((struct list_member *));
void insert_env_vars __P((struct list_member *));
extern int sudo_edit(int, char **, char **);
extern int rebuild_env(int, int);
extern int env_init(char * const envp[]);
void validate_env_vars(struct list_member *);
void insert_env_vars(struct list_member *);
/* XXX */
char *fmt_string(const char *, const char *);

View File

@@ -208,90 +208,90 @@ struct passwd;
/*
* Function prototypes
*/
#define YY_DECL int yylex __P((void))
#define YY_DECL int yylex(void)
char *sudo_goodpath __P((const char *, struct stat *));
int find_path __P((char *, char **, struct stat *, char *));
int tty_present __P((void));
int check_user __P((int, int));
int verify_user __P((struct passwd *, char *));
char *sudo_goodpath(const char *, struct stat *);
int find_path(char *, char **, struct stat *, char *);
int tty_present(void);
int check_user(int, int);
int verify_user(struct passwd *, char *);
#ifdef HAVE_LDAP
int sudo_ldap_open __P((struct sudo_nss *));
int sudo_ldap_close __P((struct sudo_nss *));
int sudo_ldap_setdefs __P((struct sudo_nss *));
int sudo_ldap_lookup __P((struct sudo_nss *, int, int));
int sudo_ldap_parse __P((struct sudo_nss *));
int sudo_ldap_display_cmnd __P((struct sudo_nss *, struct passwd *));
int sudo_ldap_display_defaults __P((struct sudo_nss *, struct passwd *, struct lbuf *));
int sudo_ldap_display_bound_defaults __P((struct sudo_nss *, struct passwd *, struct lbuf *));
int sudo_ldap_display_privs __P((struct sudo_nss *, struct passwd *, struct lbuf *));
int sudo_ldap_open(struct sudo_nss *);
int sudo_ldap_close(struct sudo_nss *);
int sudo_ldap_setdefs(struct sudo_nss *);
int sudo_ldap_lookup(struct sudo_nss *, int, int);
int sudo_ldap_parse(struct sudo_nss *);
int sudo_ldap_display_cmnd(struct sudo_nss *, struct passwd *);
int sudo_ldap_display_defaults(struct sudo_nss *, struct passwd *, struct lbuf *);
int sudo_ldap_display_bound_defaults(struct sudo_nss *, struct passwd *, struct lbuf *);
int sudo_ldap_display_privs(struct sudo_nss *, struct passwd *, struct lbuf *);
#endif
int sudo_file_open __P((struct sudo_nss *));
int sudo_file_close __P((struct sudo_nss *));
int sudo_file_setdefs __P((struct sudo_nss *));
int sudo_file_lookup __P((struct sudo_nss *, int, int));
int sudo_file_parse __P((struct sudo_nss *));
int sudo_file_display_cmnd __P((struct sudo_nss *, struct passwd *));
int sudo_file_display_defaults __P((struct sudo_nss *, struct passwd *, struct lbuf *));
int sudo_file_display_bound_defaults __P((struct sudo_nss *, struct passwd *, struct lbuf *));
int sudo_file_display_privs __P((struct sudo_nss *, struct passwd *, struct lbuf *));
int set_perms __P((int));
void remove_timestamp __P((int));
int check_secureware __P((char *));
void sia_attempt_auth __P((void));
void pam_attempt_auth __P((void));
int yyparse __P((void));
void pass_warn __P((void));
void dump_defaults __P((void));
void dump_auth_methods __P((void));
void init_envtables __P((void));
void read_env_file __P((const char *, int));
int lock_file __P((int, int));
int touch __P((int, char *, struct timespec *));
int user_is_exempt __P((void));
void set_fqdn __P((void));
char *sudo_getepw __P((const struct passwd *));
int pam_prep_user __P((struct passwd *));
void zero_bytes __P((volatile void *, size_t));
int gettime __P((struct timespec *));
FILE *open_sudoers __P((const char *, int, int *));
void display_privs __P((struct sudo_nss_list *, struct passwd *));
int display_cmnd __P((struct sudo_nss_list *, struct passwd *));
int get_ttycols __P((void));
char *sudo_parseln __P((FILE *));
void sudo_setgrent __P((void));
void sudo_endgrent __P((void));
void sudo_setpwent __P((void));
void sudo_endpwent __P((void));
void sudo_setspent __P((void));
void sudo_endspent __P((void));
void cleanup __P((int));
struct passwd *sudo_getpwnam __P((const char *));
struct passwd *sudo_fakepwnam __P((const char *, gid_t));
struct passwd *sudo_getpwuid __P((uid_t));
struct group *sudo_getgrnam __P((const char *));
struct group *sudo_fakegrnam __P((const char *));
struct group *sudo_getgrgid __P((gid_t));
int sudo_file_open(struct sudo_nss *);
int sudo_file_close(struct sudo_nss *);
int sudo_file_setdefs(struct sudo_nss *);
int sudo_file_lookup(struct sudo_nss *, int, int);
int sudo_file_parse(struct sudo_nss *);
int sudo_file_display_cmnd(struct sudo_nss *, struct passwd *);
int sudo_file_display_defaults(struct sudo_nss *, struct passwd *, struct lbuf *);
int sudo_file_display_bound_defaults(struct sudo_nss *, struct passwd *, struct lbuf *);
int sudo_file_display_privs(struct sudo_nss *, struct passwd *, struct lbuf *);
int set_perms(int);
void remove_timestamp(int);
int check_secureware(char *);
void sia_attempt_auth(void);
void pam_attempt_auth(void);
int yyparse(void);
void pass_warn(void);
void dump_defaults(void);
void dump_auth_methods(void);
void init_envtables(void);
void read_env_file(const char *, int);
int lock_file(int, int);
int touch(int, char *, struct timespec *);
int user_is_exempt(void);
void set_fqdn(void);
char *sudo_getepw(const struct passwd *);
int pam_prep_user(struct passwd *);
void zero_bytes(volatile void *, size_t);
int gettime(struct timespec *);
FILE *open_sudoers(const char *, int, int *);
void display_privs(struct sudo_nss_list *, struct passwd *);
int display_cmnd(struct sudo_nss_list *, struct passwd *);
int get_ttycols(void);
char *sudo_parseln(FILE *);
void sudo_setgrent(void);
void sudo_endgrent(void);
void sudo_setpwent(void);
void sudo_endpwent(void);
void sudo_setspent(void);
void sudo_endspent(void);
void cleanup(int);
struct passwd *sudo_getpwnam(const char *);
struct passwd *sudo_fakepwnam(const char *, gid_t);
struct passwd *sudo_getpwuid(uid_t);
struct group *sudo_getgrnam(const char *);
struct group *sudo_fakegrnam(const char *);
struct group *sudo_getgrgid(gid_t);
#ifdef HAVE_SELINUX
void selinux_exec __P((char *, char *, char **));
void selinux_execv __P((char *, char **));
void selinux_prefork __P((char *, char *, int));
void selinux_exec(char *, char *, char **);
void selinux_execv(char *, char **);
void selinux_prefork(char *, char *, int);
#endif
#ifdef HAVE_GETUSERATTR
void aix_setlimits __P((char *));
void aix_setlimits(char *);
#endif
int script_duplow __P((int));
int script_execv __P((char *, char **));
void script_nextid __P((void));
void script_setup __P((void));
int term_cbreak __P((int));
int term_copy __P((int, int, int));
int term_noecho __P((int));
int term_raw __P((int, int, int));
int term_restore __P((int, int));
char *get_timestr __P((time_t, int));
time_t get_boottime __P((void));
int user_in_group __P((struct passwd *, const char *));
int script_duplow(int);
int script_execv(char *, char **);
void script_nextid(void);
void script_setup(void);
int term_cbreak(int);
int term_copy(int, int, int);
int term_noecho(int);
int term_raw(int, int, int);
int term_restore(int, int);
char *get_timestr(time_t, int);
time_t get_boottime(void);
int user_in_group(struct passwd *, const char *);
YY_DECL;
/* atobool.c */

View File

@@ -148,18 +148,18 @@ struct search_node {
static struct search_node *node_stack[32];
static int stack_top;
extern time_t get_date __P((char *));
extern char *get_timestr __P((time_t, int));
extern int term_raw __P((int, int, int));
extern int term_restore __P((int, int));
extern void zero_bytes __P((volatile void *, size_t));
void cleanup __P((int));
extern time_t get_date(char *);
extern char *get_timestr(time_t, int);
extern int term_raw(int, int, int);
extern int term_restore(int, int);
extern void zero_bytes(volatile void *, size_t);
void cleanup(int);
static int list_sessions __P((int, char **, const char *, const char *, const char *));
static int parse_expr __P((struct search_node **, char **));
static void check_input __P((int, double *));
static void delay __P((double));
static void usage __P((void));
static int list_sessions(int, char **, const char *, const char *, const char *);
static int parse_expr(struct search_node **, char **);
static void check_input(int, double *);
static void delay(double);
static void usage(void);
#ifdef HAVE_REGCOMP
# define REGEX_T regex_t

View File

@@ -92,27 +92,27 @@ extern char *malloc_options;
extern int yydebug;
#endif
int print_alias __P((void *, void *));
void dump_sudoers __P((void));
void print_defaults __P((void));
void print_privilege __P((struct privilege *));
void print_userspecs __P((void));
void usage __P((void)) __attribute__((__noreturn__));
void set_runasgr __P((char *));
void set_runaspw __P((char *));
int print_alias(void *, void *);
void dump_sudoers(void);
void print_defaults(void);
void print_privilege(struct privilege *);
void print_userspecs(void);
void usage(void) __attribute__((__noreturn__));
void set_runasgr(char *);
void set_runaspw(char *);
extern void setgrfile __P((const char *));
extern void setgrent __P((void));
extern void endgrent __P((void));
extern struct group *getgrent __P((void));
extern struct group *getgrnam __P((const char *));
extern struct group *getgrgid __P((gid_t));
extern void setpwfile __P((const char *));
extern void setpwent __P((void));
extern void endpwent __P((void));
extern struct passwd *getpwent __P((void));
extern struct passwd *getpwnam __P((const char *));
extern struct passwd *getpwuid __P((uid_t));
extern void setgrfile(const char *);
extern void setgrent(void);
extern void endgrent(void);
extern struct group *getgrent(void);
extern struct group *getgrnam(const char *);
extern struct group *getgrgid(gid_t);
extern void setpwfile(const char *);
extern void setpwent(void);
extern void endpwent(void);
extern struct passwd *getpwent(void);
extern struct passwd *getpwnam(const char *);
extern struct passwd *getpwuid(uid_t);
int
main(argc, argv)

View File

@@ -30,7 +30,7 @@
#include "compat.h"
char *get_timestr __P((time_t, int));
char *get_timestr(time_t, int);
/*
* Return an ascii string with the current date + time

View File

@@ -3,7 +3,7 @@
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
* $Header$
* $Header: /home/cvs/openbsd/src/usr.bin/lex/flex.skl,v 1.10 2007/01/26 14:38:19 tsi Exp $
*/
#define FLEX_SCANNER
@@ -1424,15 +1424,15 @@ static int sawspace = 0;
static int arg_len = 0;
static int arg_size = 0;
static int append __P((char *, int));
static int _fill __P((char *, int, int));
static int fill_cmnd __P((char *, int));
static int fill_args __P((char *, int, int));
static int _push_include __P((char *, int));
static int pop_include __P((void));
static int ipv6_valid __P((const char *s));
static char *parse_include __P((char *));
extern void yyerror __P((const char *));
static int append(char *, int);
static int _fill(char *, int, int);
static int fill_cmnd(char *, int);
static int fill_args(char *, int, int);
static int _push_include(char *, int);
static int pop_include(void);
static int ipv6_valid(const char *s);
static char *parse_include(char *);
extern void yyerror(const char *);
#define fill(a, b) _fill(a, b, 0)
@@ -1458,7 +1458,7 @@ extern void yyerror __P((const char *));
#define INSTR 5
#line 1466 "lex.yy.c"
#line 1462 "lex.yy.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -1612,9 +1612,9 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
#line 132 "toke.l"
#line 128 "toke.l"
#line 1622 "lex.yy.c"
#line 1618 "lex.yy.c"
if ( yy_init )
{
@@ -1700,12 +1700,12 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
#line 133 "toke.l"
#line 129 "toke.l"
BEGIN STARTDEFS;
YY_BREAK
case 2:
YY_RULE_SETUP
#line 135 "toke.l"
#line 131 "toke.l"
{
BEGIN INDEFS;
LEXTRACE("DEFVAR ");
@@ -1717,7 +1717,7 @@ YY_RULE_SETUP
case 3:
YY_RULE_SETUP
#line 144 "toke.l"
#line 140 "toke.l"
{
BEGIN STARTDEFS;
LEXTRACE(", ");
@@ -1726,7 +1726,7 @@ YY_RULE_SETUP
YY_BREAK
case 4:
YY_RULE_SETUP
#line 150 "toke.l"
#line 146 "toke.l"
{
LEXTRACE("= ");
return('=');
@@ -1734,7 +1734,7 @@ YY_RULE_SETUP
YY_BREAK
case 5:
YY_RULE_SETUP
#line 155 "toke.l"
#line 151 "toke.l"
{
LEXTRACE("+= ");
return('+');
@@ -1742,7 +1742,7 @@ YY_RULE_SETUP
YY_BREAK
case 6:
YY_RULE_SETUP
#line 160 "toke.l"
#line 156 "toke.l"
{
LEXTRACE("-= ");
return('-');
@@ -1750,7 +1750,7 @@ YY_RULE_SETUP
YY_BREAK
case 7:
YY_RULE_SETUP
#line 165 "toke.l"
#line 161 "toke.l"
{
LEXTRACE("BEGINSTR ");
yylval.string = NULL;
@@ -1759,7 +1759,7 @@ YY_RULE_SETUP
YY_BREAK
case 8:
YY_RULE_SETUP
#line 171 "toke.l"
#line 167 "toke.l"
{
LEXTRACE("WORD(2) ");
if (!fill(yytext, yyleng))
@@ -1771,7 +1771,7 @@ YY_RULE_SETUP
case 9:
YY_RULE_SETUP
#line 180 "toke.l"
#line 176 "toke.l"
{
/* Line continuation char followed by newline. */
++sudolineno;
@@ -1780,7 +1780,7 @@ YY_RULE_SETUP
YY_BREAK
case 10:
YY_RULE_SETUP
#line 186 "toke.l"
#line 182 "toke.l"
{
LEXTRACE("ENDSTR ");
BEGIN INDEFS;
@@ -1789,7 +1789,7 @@ YY_RULE_SETUP
YY_BREAK
case 11:
YY_RULE_SETUP
#line 192 "toke.l"
#line 188 "toke.l"
{
LEXTRACE("BACKSLASH ");
if (!append(yytext, yyleng))
@@ -1798,7 +1798,7 @@ YY_RULE_SETUP
YY_BREAK
case 12:
YY_RULE_SETUP
#line 198 "toke.l"
#line 194 "toke.l"
{
LEXTRACE("STRBODY ");
if (!append(yytext, yyleng))
@@ -1809,7 +1809,7 @@ YY_RULE_SETUP
case 13:
YY_RULE_SETUP
#line 206 "toke.l"
#line 202 "toke.l"
{
/* quoted fnmatch glob char, pass verbatim */
LEXTRACE("QUOTEDCHAR ");
@@ -1820,7 +1820,7 @@ YY_RULE_SETUP
YY_BREAK
case 14:
YY_RULE_SETUP
#line 214 "toke.l"
#line 210 "toke.l"
{
/* quoted sudoers special char, strip backslash */
LEXTRACE("QUOTEDCHAR ");
@@ -1831,7 +1831,7 @@ YY_RULE_SETUP
YY_BREAK
case 15:
YY_RULE_SETUP
#line 222 "toke.l"
#line 218 "toke.l"
{
BEGIN INITIAL;
yyless(0);
@@ -1840,7 +1840,7 @@ YY_RULE_SETUP
YY_BREAK
case 16:
YY_RULE_SETUP
#line 228 "toke.l"
#line 224 "toke.l"
{
LEXTRACE("ARG ");
if (!fill_args(yytext, yyleng, sawspace))
@@ -1851,7 +1851,7 @@ YY_RULE_SETUP
case 17:
YY_RULE_SETUP
#line 236 "toke.l"
#line 232 "toke.l"
{
char *path;
@@ -1867,7 +1867,7 @@ YY_RULE_SETUP
YY_BREAK
case 18:
YY_RULE_SETUP
#line 249 "toke.l"
#line 245 "toke.l"
{
char *path;
@@ -1886,7 +1886,7 @@ YY_RULE_SETUP
YY_BREAK
case 19:
YY_RULE_SETUP
#line 265 "toke.l"
#line 261 "toke.l"
{
int n;
for (n = 0; isblank((unsigned char)yytext[n]); n++)
@@ -1918,7 +1918,7 @@ YY_RULE_SETUP
YY_BREAK
case 20:
YY_RULE_SETUP
#line 294 "toke.l"
#line 290 "toke.l"
{
int n;
for (n = 0; isblank((unsigned char)yytext[n]); n++)
@@ -1941,7 +1941,7 @@ YY_RULE_SETUP
YY_BREAK
case 21:
YY_RULE_SETUP
#line 314 "toke.l"
#line 310 "toke.l"
{
/* cmnd does not require passwd for this user */
LEXTRACE("NOPASSWD ");
@@ -1950,7 +1950,7 @@ YY_RULE_SETUP
YY_BREAK
case 22:
YY_RULE_SETUP
#line 320 "toke.l"
#line 316 "toke.l"
{
/* cmnd requires passwd for this user */
LEXTRACE("PASSWD ");
@@ -1959,7 +1959,7 @@ YY_RULE_SETUP
YY_BREAK
case 23:
YY_RULE_SETUP
#line 326 "toke.l"
#line 322 "toke.l"
{
LEXTRACE("NOEXEC ");
return(NOEXEC);
@@ -1967,7 +1967,7 @@ YY_RULE_SETUP
YY_BREAK
case 24:
YY_RULE_SETUP
#line 331 "toke.l"
#line 327 "toke.l"
{
LEXTRACE("EXEC ");
return(EXEC);
@@ -1975,7 +1975,7 @@ YY_RULE_SETUP
YY_BREAK
case 25:
YY_RULE_SETUP
#line 336 "toke.l"
#line 332 "toke.l"
{
LEXTRACE("SETENV ");
return(SETENV);
@@ -1983,7 +1983,7 @@ YY_RULE_SETUP
YY_BREAK
case 26:
YY_RULE_SETUP
#line 341 "toke.l"
#line 337 "toke.l"
{
LEXTRACE("NOSETENV ");
return(NOSETENV);
@@ -1991,7 +1991,7 @@ YY_RULE_SETUP
YY_BREAK
case 27:
YY_RULE_SETUP
#line 346 "toke.l"
#line 342 "toke.l"
{
/* netgroup */
if (!fill(yytext, yyleng))
@@ -2002,7 +2002,7 @@ YY_RULE_SETUP
YY_BREAK
case 28:
YY_RULE_SETUP
#line 354 "toke.l"
#line 350 "toke.l"
{
/* UN*X group */
if (!fill(yytext, yyleng))
@@ -2013,7 +2013,7 @@ YY_RULE_SETUP
YY_BREAK
case 29:
YY_RULE_SETUP
#line 362 "toke.l"
#line 358 "toke.l"
{
if (!fill(yytext, yyleng))
yyterminate();
@@ -2023,7 +2023,7 @@ YY_RULE_SETUP
YY_BREAK
case 30:
YY_RULE_SETUP
#line 369 "toke.l"
#line 365 "toke.l"
{
if (!fill(yytext, yyleng))
yyterminate();
@@ -2033,7 +2033,7 @@ YY_RULE_SETUP
YY_BREAK
case 31:
YY_RULE_SETUP
#line 376 "toke.l"
#line 372 "toke.l"
{
if (!ipv6_valid(yytext)) {
LEXTRACE("ERROR ");
@@ -2047,7 +2047,7 @@ YY_RULE_SETUP
YY_BREAK
case 32:
YY_RULE_SETUP
#line 387 "toke.l"
#line 383 "toke.l"
{
if (!ipv6_valid(yytext)) {
LEXTRACE("ERROR ");
@@ -2061,7 +2061,7 @@ YY_RULE_SETUP
YY_BREAK
case 33:
YY_RULE_SETUP
#line 398 "toke.l"
#line 394 "toke.l"
{
if (strcmp(yytext, "ALL") == 0) {
LEXTRACE("ALL ");
@@ -2086,7 +2086,7 @@ YY_RULE_SETUP
YY_BREAK
case 34:
YY_RULE_SETUP
#line 420 "toke.l"
#line 416 "toke.l"
{
/* no command args allowed for Defaults!/path */
if (!fill_cmnd(yytext, yyleng))
@@ -2097,7 +2097,7 @@ YY_RULE_SETUP
YY_BREAK
case 35:
YY_RULE_SETUP
#line 428 "toke.l"
#line 424 "toke.l"
{
BEGIN GOTCMND;
LEXTRACE("COMMAND ");
@@ -2107,7 +2107,7 @@ YY_RULE_SETUP
YY_BREAK
case 36:
YY_RULE_SETUP
#line 435 "toke.l"
#line 431 "toke.l"
{
/* directories can't have args... */
if (yytext[yyleng - 1] == '/') {
@@ -2125,7 +2125,7 @@ YY_RULE_SETUP
YY_BREAK
case 37:
YY_RULE_SETUP
#line 450 "toke.l"
#line 446 "toke.l"
{
/* a quoted user/group name */
if (!fill(yytext + 1, yyleng - 2))
@@ -2145,7 +2145,7 @@ YY_RULE_SETUP
YY_BREAK
case 38:
YY_RULE_SETUP
#line 467 "toke.l"
#line 463 "toke.l"
{
/* a word */
if (!fill(yytext, yyleng))
@@ -2156,7 +2156,7 @@ YY_RULE_SETUP
YY_BREAK
case 39:
YY_RULE_SETUP
#line 475 "toke.l"
#line 471 "toke.l"
{
LEXTRACE("( ");
return ('(');
@@ -2164,7 +2164,7 @@ YY_RULE_SETUP
YY_BREAK
case 40:
YY_RULE_SETUP
#line 480 "toke.l"
#line 476 "toke.l"
{
LEXTRACE(") ");
return(')');
@@ -2172,7 +2172,7 @@ YY_RULE_SETUP
YY_BREAK
case 41:
YY_RULE_SETUP
#line 485 "toke.l"
#line 481 "toke.l"
{
LEXTRACE(", ");
return(',');
@@ -2180,7 +2180,7 @@ YY_RULE_SETUP
YY_BREAK
case 42:
YY_RULE_SETUP
#line 490 "toke.l"
#line 486 "toke.l"
{
LEXTRACE("= ");
return('=');
@@ -2188,7 +2188,7 @@ YY_RULE_SETUP
YY_BREAK
case 43:
YY_RULE_SETUP
#line 495 "toke.l"
#line 491 "toke.l"
{
LEXTRACE(": ");
return(':');
@@ -2196,7 +2196,7 @@ YY_RULE_SETUP
YY_BREAK
case 44:
YY_RULE_SETUP
#line 500 "toke.l"
#line 496 "toke.l"
{
if (yyleng % 2 == 1)
return('!'); /* return '!' */
@@ -2204,7 +2204,7 @@ YY_RULE_SETUP
YY_BREAK
case 45:
YY_RULE_SETUP
#line 505 "toke.l"
#line 501 "toke.l"
{
BEGIN INITIAL;
++sudolineno;
@@ -2214,14 +2214,14 @@ YY_RULE_SETUP
YY_BREAK
case 46:
YY_RULE_SETUP
#line 512 "toke.l"
#line 508 "toke.l"
{ /* throw away space/tabs */
sawspace = TRUE; /* but remember for fill_args */
}
YY_BREAK
case 47:
YY_RULE_SETUP
#line 516 "toke.l"
#line 512 "toke.l"
{
sawspace = TRUE; /* remember for fill_args */
++sudolineno;
@@ -2230,7 +2230,7 @@ YY_RULE_SETUP
YY_BREAK
case 48:
YY_RULE_SETUP
#line 522 "toke.l"
#line 518 "toke.l"
{
BEGIN INITIAL;
++sudolineno;
@@ -2240,7 +2240,7 @@ YY_RULE_SETUP
YY_BREAK
case 49:
YY_RULE_SETUP
#line 529 "toke.l"
#line 525 "toke.l"
{
LEXTRACE("ERROR ");
return(ERROR);
@@ -2252,7 +2252,7 @@ case YY_STATE_EOF(GOTCMND):
case YY_STATE_EOF(STARTDEFS):
case YY_STATE_EOF(INDEFS):
case YY_STATE_EOF(INSTR):
#line 534 "toke.l"
#line 530 "toke.l"
{
if (YY_START != INITIAL) {
BEGIN INITIAL;
@@ -2265,10 +2265,10 @@ case YY_STATE_EOF(INSTR):
YY_BREAK
case 50:
YY_RULE_SETUP
#line 544 "toke.l"
#line 540 "toke.l"
ECHO;
YY_BREAK
#line 2276 "lex.yy.c"
#line 2272 "lex.yy.c"
case YY_END_OF_BUFFER:
{
@@ -3157,7 +3157,7 @@ int main()
return 0;
}
#endif
#line 544 "toke.l"
#line 540 "toke.l"
static unsigned char
hexchar(s)
@@ -3461,7 +3461,7 @@ init_lexer()
efree(pl);
}
efree(istack[idepth].path);
if (!istack[idepth].keepopen)
if (idepth && !istack[idepth].keepopen)
fclose(istack[idepth].bs->yy_input_file);
yy_delete_buffer(istack[idepth].bs);
}
@@ -3486,7 +3486,7 @@ _push_include(path, isdir)
}
istacksize += SUDOERS_STACK_INCREMENT;
istack = (struct include_stack *) realloc(istack,
sizeof(istack) * istacksize);
sizeof(*istack) * istacksize);
if (istack == NULL) {
yyerror("unable to allocate memory");
return(FALSE);

View File

@@ -67,7 +67,7 @@
# endif
#endif
#include <ctype.h>
#include "sudo.h"
#include "sudoers.h"
#include "parse.h"
#include <gram.h>
@@ -79,15 +79,15 @@ static int sawspace = 0;
static int arg_len = 0;
static int arg_size = 0;
static int append __P((char *, int));
static int _fill __P((char *, int, int));
static int fill_cmnd __P((char *, int));
static int fill_args __P((char *, int, int));
static int _push_include __P((char *, int));
static int pop_include __P((void));
static int ipv6_valid __P((const char *s));
static char *parse_include __P((char *));
extern void yyerror __P((const char *));
static int append(char *, int);
static int _fill(char *, int, int);
static int fill_cmnd(char *, int);
static int fill_args(char *, int, int);
static int _push_include(char *, int);
static int pop_include(void);
static int ipv6_valid(const char *s);
static char *parse_include(char *);
extern void yyerror(const char *);
#define fill(a, b) _fill(a, b, 0)

View File

@@ -64,19 +64,19 @@ static FILE *grf;
static const char *grfile = "/etc/group";
static int gr_stayopen;
void setgrfile __P((const char *));
void setgrent __P((void));
void endgrent __P((void));
struct group *getgrent __P((void));
struct group *getgrnam __P((const char *));
struct group *getgrgid __P((gid_t));
void setgrfile(const char *);
void setgrent(void);
void endgrent(void);
struct group *getgrent(void);
struct group *getgrnam(const char *);
struct group *getgrgid(gid_t);
void setpwfile __P((const char *));
void setpwent __P((void));
void endpwent __P((void));
struct passwd *getpwent __P((void));
struct passwd *getpwnam __P((const char *));
struct passwd *getpwuid __P((uid_t));
void setpwfile(const char *);
void setpwent(void);
void endpwent(void);
struct passwd *getpwent(void);
struct passwd *getpwnam(const char *);
struct passwd *getpwuid(uid_t);
void
setpwfile(file)

View File

@@ -99,24 +99,24 @@ struct sudoersfile {
/*
* Function prototypes
*/
static RETSIGTYPE quit __P((int));
static char *get_args __P((char *));
static char *get_editor __P((char **));
static void get_hostname __P((void));
static char whatnow __P((void));
static int check_aliases __P((int, int));
static int check_syntax __P((char *, int, int));
static int edit_sudoers __P((struct sudoersfile *, char *, char *, int));
static int install_sudoers __P((struct sudoersfile *, int));
static int print_unused __P((void *, void *));
static int reparse_sudoers __P((char *, char *, int, int));
static int run_command __P((char *, char **));
static void print_undefined __P((char *name, int, int, int));
static void setup_signals __P((void));
static void usage __P((void)) __attribute__((__noreturn__));
static RETSIGTYPE quit(int);
static char *get_args(char *);
static char *get_editor(char **);
static void get_hostname(void);
static char whatnow(void);
static int check_aliases(int, int);
static int check_syntax(char *, int, int);
static int edit_sudoers(struct sudoersfile *, char *, char *, int);
static int install_sudoers(struct sudoersfile *, int);
static int print_unused(void *, void *);
static int reparse_sudoers(char *, char *, int, int);
static int run_command(char *, char **);
static void print_undefined(char *name, int, int, int);
static void setup_signals(void);
static void usage(void) __attribute__((__noreturn__));
extern void yyerror __P((const char *));
extern void yyrestart __P((FILE *));
extern void yyerror(const char *);
extern void yyrestart(FILE *);
/*
* External globals exported by the parser