From 6286ce1d16e11619efb8d5855b14dd296f355f9c Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 2 Nov 2020 05:39:06 -0700 Subject: [PATCH] Store column number for aliases, defaults and userspecs too. This is used to provided the column number along with the line number in error messages. For aliases we store the column of the alias name, not the value since that is what visudo generally needs. --- plugins/sudoers/alias.c | 5 +- plugins/sudoers/cvtsudoers_ldif.c | 4 +- plugins/sudoers/defaults.c | 78 +- plugins/sudoers/defaults.h | 4 +- plugins/sudoers/gram.c | 913 +++++++++--------- plugins/sudoers/gram.h | 2 +- plugins/sudoers/gram.y | 36 +- plugins/sudoers/parse.c | 4 +- plugins/sudoers/parse.h | 11 +- .../sudoers/regress/sudoers/test18.toke.ok | 4 +- plugins/sudoers/regress/sudoers/test2.ldif.ok | 18 +- plugins/sudoers/regress/sudoers/test3.ldif.ok | 8 +- plugins/sudoers/regress/sudoers/test6.ldif.ok | 8 +- plugins/sudoers/regress/visudo/test2.err.ok | 2 +- plugins/sudoers/regress/visudo/test3.err.ok | 4 +- plugins/sudoers/visudo.c | 36 +- 16 files changed, 602 insertions(+), 535 deletions(-) diff --git a/plugins/sudoers/alias.c b/plugins/sudoers/alias.c index 77db5ec1d..1033a0253 100644 --- a/plugins/sudoers/alias.c +++ b/plugins/sudoers/alias.c @@ -114,7 +114,7 @@ alias_put(struct alias *a) */ const char * alias_add(struct sudoers_parse_tree *parse_tree, char *name, int type, - char *file, int lineno, struct member *members) + char *file, int line, int column, struct member *members) { static char errbuf[512]; struct alias *a; @@ -136,7 +136,8 @@ alias_add(struct sudoers_parse_tree *parse_tree, char *name, int type, a->type = type; /* a->used = false; */ a->file = rcstr_addref(file); - a->lineno = lineno; + a->line = line; + a->column = column; HLTQ_TO_TAILQ(&a->members, members, entries); switch (rbinsert(parse_tree->aliases, a, NULL)) { case 1: diff --git a/plugins/sudoers/cvtsudoers_ldif.c b/plugins/sudoers/cvtsudoers_ldif.c index c9261843a..0dd840912 100644 --- a/plugins/sudoers/cvtsudoers_ldif.c +++ b/plugins/sudoers/cvtsudoers_ldif.c @@ -180,8 +180,8 @@ print_global_defaults_ldif(FILE *fp, struct sudoers_parse_tree *parse_tree, lbuf.len = 0; sudo_lbuf_append(&lbuf, "# "); sudoers_format_default_line(&lbuf, parse_tree, opt, false, true); - fprintf(fp, "# Unable to translate %s:%d\n%s\n", - opt->file, opt->lineno, lbuf.buf); + fprintf(fp, "# Unable to translate %s:%d:%d:\n%s\n", + opt->file, opt->line, opt->column, lbuf.buf); } } sudo_lbuf_destroy(&lbuf); diff --git a/plugins/sudoers/defaults.c b/plugins/sudoers/defaults.c index 4b8f28e85..bd4e8d940 100644 --- a/plugins/sudoers/defaults.c +++ b/plugins/sudoers/defaults.c @@ -68,7 +68,7 @@ static bool store_tuple(const char *str, union sudo_defs_val *sd_un, struct def_ static bool store_uint(const char *str, union sudo_defs_val *sd_un); static bool store_timespec(const char *str, union sudo_defs_val *sd_un); static bool list_op(const char *str, size_t, union sudo_defs_val *sd_un, enum list_ops op); -static bool valid_path(struct sudo_defs_types *def, const char *val, const char *file, int lineno, bool quiet); +static bool valid_path(struct sudo_defs_types *def, const char *val, const char *file, int line, int column, bool quiet); /* * Table describing compile-time and run-time options. @@ -171,7 +171,7 @@ dump_defaults(void) * On success, returns the matching index or -1 on failure. */ static int -find_default(const char *name, const char *file, int lineno, bool quiet) +find_default(const char *name, const char *file, int line, int column, bool quiet) { int i; debug_decl(find_default, SUDOERS_DEBUG_DEFAULTS); @@ -181,9 +181,9 @@ find_default(const char *name, const char *file, int lineno, bool quiet) debug_return_int(i); } if (!quiet && !def_ignore_unknown_defaults) { - if (lineno > 0) { - sudo_warnx(U_("%s:%d: unknown defaults entry \"%s\""), - file, lineno, name); + if (line > 0) { + sudo_warnx(U_("%s:%d:%d: unknown defaults entry \"%s\""), + file, line, column + 1, name); } else { sudo_warnx(U_("%s: unknown defaults entry \"%s\""), file, name); @@ -201,13 +201,13 @@ find_default(const char *name, const char *file, int lineno, bool quiet) */ static bool parse_default_entry(struct sudo_defs_types *def, const char *val, int op, - const char *file, int lineno, bool quiet) + const char *file, int line, int column, bool quiet) { int rc; debug_decl(parse_default_entry, SUDOERS_DEBUG_DEFAULTS); - sudo_debug_printf(SUDO_DEBUG_INFO, "%s: %s:%d: %s=%s op=%d", - __func__, file, lineno, def->name, val ? val : "", op); + sudo_debug_printf(SUDO_DEBUG_INFO, "%s: %s:%d:%d: %s=%s op=%d", + __func__, file, line, column, def->name, val ? val : "", op); /* * If no value specified, the boolean flag must be set for non-flags. @@ -230,9 +230,9 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op, default: if (!ISSET(def->type, T_BOOL) || op != false) { if (!quiet) { - if (lineno > 0) { - sudo_warnx(U_("%s:%d: no value specified for \"%s\""), - file, lineno, def->name); + if (line > 0) { + sudo_warnx(U_("%s:%d:%d: no value specified for \"%s\""), + file, line, column, def->name); } else { sudo_warnx(U_("%s: no value specified for \"%s\""), file, def->name); @@ -252,7 +252,7 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op, break; case T_STR: if (val != NULL && ISSET(def->type, T_PATH|T_CHPATH)) { - if (!valid_path(def, val, file, lineno, quiet)) { + if (!valid_path(def, val, file, line, column, quiet)) { rc = -1; break; } @@ -271,9 +271,9 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op, case T_FLAG: if (val != NULL) { if (!quiet) { - if (lineno > 0) { - sudo_warnx(U_("%s:%d: option \"%s\" does not take a value"), - file, lineno, def->name); + if (line > 0) { + sudo_warnx(U_("%s:%d:%d: option \"%s\" does not take a value"), + file, line, column, def->name); } else { sudo_warnx(U_("%s: option \"%s\" does not take a value"), file, def->name); @@ -299,9 +299,9 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op, break; default: if (!quiet) { - if (lineno > 0) { - sudo_warnx(U_("%s:%d: invalid Defaults type 0x%x for option \"%s\""), - file, lineno, def->type, def->name); + if (line > 0) { + sudo_warnx(U_("%s:%d:%d: invalid Defaults type 0x%x for option \"%s\""), + file, line, column, def->type, def->name); } else { sudo_warnx(U_("%s: invalid Defaults type 0x%x for option \"%s\""), file, def->type, def->name); @@ -312,9 +312,9 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op, } if (rc == false) { if (!quiet) { - if (lineno > 0) { - sudo_warnx(U_("%s:%d: value \"%s\" is invalid for option \"%s\""), - file, lineno, val, def->name); + if (line > 0) { + sudo_warnx(U_("%s:%d:%d: value \"%s\" is invalid for option \"%s\""), + file, line, column, val, def->name); } else { sudo_warnx(U_("%s: value \"%s\" is invalid for option \"%s\""), file, val, def->name); @@ -354,7 +354,7 @@ run_callback(struct sudo_defs_types *def) */ bool set_default(const char *var, const char *val, int op, const char *file, - int lineno, bool quiet) + int line, int column, bool quiet) { int idx; debug_decl(set_default, SUDOERS_DEBUG_DEFAULTS); @@ -362,11 +362,11 @@ set_default(const char *var, const char *val, int op, const char *file, sudo_debug_printf(SUDO_DEBUG_INFO|SUDO_DEBUG_LINENO, "%s: setting Defaults %s -> %s", __func__, var, val ? val : "false"); - idx = find_default(var, file, lineno, quiet); + idx = find_default(var, file, line, column, quiet); if (idx != -1) { /* Set parsed value in sudo_defs_table and run callback (if any). */ struct sudo_defs_types *def = &sudo_defs_table[idx]; - if (parse_default_entry(def, val, op, file, lineno, quiet)) + if (parse_default_entry(def, val, op, file, line, column, quiet)) debug_return_bool(run_callback(def)); } debug_return_bool(false); @@ -378,16 +378,16 @@ set_default(const char *var, const char *val, int op, const char *file, */ bool set_early_default(const char *var, const char *val, int op, const char *file, - int lineno, bool quiet, struct early_default *early) + int line, int column, bool quiet, struct early_default *early) { int idx; debug_decl(set_early_default, SUDOERS_DEBUG_DEFAULTS); - idx = find_default(var, file, lineno, quiet); + idx = find_default(var, file, line, column, quiet); if (idx != -1) { /* Set parsed value in sudo_defs_table but defer callback (if any). */ struct sudo_defs_types *def = &sudo_defs_table[idx]; - if (parse_default_entry(def, val, op, file, lineno, quiet)) { + if (parse_default_entry(def, val, op, file, line, column, quiet)) { early->run_callback = true; debug_return_bool(true); } @@ -732,8 +732,8 @@ update_defaults(struct sudoers_parse_tree *parse_tree, continue; /* Copy the value to sudo_defs_table and mark as early. */ - if (!set_early_default(d->var, d->val, d->op, d->file, d->lineno, - quiet, early)) + if (!set_early_default(d->var, d->val, d->op, d->file, d->line, + d->column, quiet, early)) ret = false; } /* Run callbacks for early defaults (if any) */ @@ -754,7 +754,7 @@ update_defaults(struct sudoers_parse_tree *parse_tree, continue; /* Copy the value to sudo_defs_table and run callback (if any) */ - if (!set_default(d->var, d->val, d->op, d->file, d->lineno, quiet)) + if (!set_default(d->var, d->val, d->op, d->file, d->line, d->column, quiet)) ret = false; } @@ -773,12 +773,12 @@ check_defaults(struct sudoers_parse_tree *parse_tree, bool quiet) debug_decl(check_defaults, SUDOERS_DEBUG_DEFAULTS); TAILQ_FOREACH(d, &parse_tree->defaults, entries) { - idx = find_default(d->var, d->file, d->lineno, quiet); + idx = find_default(d->var, d->file, d->line, d->column, quiet); if (idx != -1) { struct sudo_defs_types def = sudo_defs_table[idx]; memset(&def.sd_un, 0, sizeof(def.sd_un)); if (parse_default_entry(&def, d->val, d->op, d->file, - d->lineno, quiet)) { + d->line, d->column, quiet)) { free_defs_val(def.type, &def.sd_un); continue; } @@ -1017,7 +1017,7 @@ store_timeout(const char *str, union sudo_defs_val *sd_un) static bool valid_path(struct sudo_defs_types *def, const char *val, - const char *file, int lineno, bool quiet) + const char *file, int line, int column, bool quiet) { bool ret = true; debug_decl(valid_path, SUDOERS_DEBUG_DEFAULTS); @@ -1025,10 +1025,10 @@ valid_path(struct sudo_defs_types *def, const char *val, if (ISSET(def->type, T_CHPATH)) { if (val[0] != '/' && val[0] != '~' && (val[0] != '*' || val[1] != '\0')) { if (!quiet) { - if (lineno > 0) { + if (line > 0) { sudo_warnx( - U_("%s:%d: values for \"%s\" must start with a '/', '~', or '*'"), - file, lineno, def->name); + U_("%s:%d:%d: values for \"%s\" must start with a '/', '~', or '*'"), + file, line, column, def->name); } else { sudo_warnx( U_("%s: values for \"%s\" must start with a '/', '~', or '*'"), @@ -1040,10 +1040,10 @@ valid_path(struct sudo_defs_types *def, const char *val, } else { if (val[0] != '/') { if (!quiet) { - if (lineno > 0) { + if (line > 0) { sudo_warnx( - U_("%s:%d: values for \"%s\" must start with a '/'"), - file, lineno, def->name); + U_("%s:%d:%d: values for \"%s\" must start with a '/'"), + file, line, column, def->name); } else { sudo_warnx( U_("%s: values for \"%s\" must start with a '/'"), diff --git a/plugins/sudoers/defaults.h b/plugins/sudoers/defaults.h index 5ff411817..cf83963ef 100644 --- a/plugins/sudoers/defaults.h +++ b/plugins/sudoers/defaults.h @@ -133,8 +133,8 @@ void dump_default(void); bool init_defaults(void); struct early_default *is_early_default(const char *name); bool run_early_defaults(void); -bool set_early_default(const char *var, const char *val, int op, const char *file, int lineno, bool quiet, struct early_default *early); -bool set_default(const char *var, const char *val, int op, const char *file, int lineno, bool quiet); +bool set_early_default(const char *var, const char *val, int op, const char *file, int line, int column, bool quiet, struct early_default *early); +bool set_default(const char *var, const char *val, int op, const char *file, int line, int column, bool quiet); bool update_defaults(struct sudoers_parse_tree *parse_tree, struct defaults_list *defs, int what, bool quiet); bool check_defaults(struct sudoers_parse_tree *parse_tree, bool quiet); diff --git a/plugins/sudoers/gram.c b/plugins/sudoers/gram.c index 7a74451eb..2e6ecd877 100644 --- a/plugins/sudoers/gram.c +++ b/plugins/sudoers/gram.c @@ -137,6 +137,8 @@ bool parse_error = false; int errorlineno = -1; char *errorfile = NULL; +static int alias_line, alias_column; + struct sudoers_parse_tree parsed_policy = { TAILQ_HEAD_INITIALIZER(parsed_policy.userspecs), TAILQ_HEAD_INITIALIZER(parsed_policy.defaults), @@ -156,7 +158,7 @@ static struct member *new_member(char *, int); static struct sudo_command *new_command(char *, char *); static struct command_digest *new_digest(int, char *); -#line 154 "gram.c" /* yacc.c:337 */ +#line 156 "gram.c" /* yacc.c:337 */ # ifndef YY_NULLPTR # if defined __cplusplus # if 201103L <= __cplusplus @@ -303,7 +305,7 @@ extern int sudoersdebug; union YYSTYPE { -#line 77 "gram.y" /* yacc.c:352 */ +#line 79 "gram.y" /* yacc.c:352 */ struct cmndspec *cmndspec; struct defaults *defaults; @@ -317,7 +319,7 @@ union YYSTYPE char *string; int tok; -#line 315 "gram.c" /* yacc.c:352 */ +#line 317 "gram.c" /* yacc.c:352 */ }; typedef union YYSTYPE YYSTYPE; @@ -565,16 +567,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 88 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 319 +#define YYLAST 320 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 62 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 50 +#define YYNNTS 54 /* YYNRULES -- Number of rules. */ -#define YYNRULES 145 +#define YYNRULES 149 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 244 +#define YYNSTATES 248 #define YYUNDEFTOK 2 #define YYMAXUTOK 307 @@ -625,21 +627,21 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 185, 185, 188, 191, 192, 195, 198, 201, 208, - 215, 221, 224, 227, 230, 233, 237, 241, 245, 249, - 255, 258, 264, 267, 273, 274, 280, 287, 294, 301, - 308, 317, 318, 322, 328, 342, 346, 352, 359, 366, - 373, 380, 389, 390, 449, 504, 511, 518, 525, 534, - 535, 541, 544, 565, 569, 575, 587, 599, 604, 608, - 613, 618, 623, 627, 632, 635, 640, 655, 664, 673, - 682, 699, 700, 701, 702, 703, 704, 705, 706, 707, - 708, 711, 717, 720, 724, 728, 736, 744, 755, 761, - 767, 773, 781, 784, 787, 790, 793, 796, 799, 802, - 805, 808, 811, 814, 817, 820, 823, 828, 835, 842, - 858, 859, 862, 871, 874, 875, 881, 882, 885, 894, - 897, 898, 904, 905, 908, 917, 920, 921, 924, 933, - 936, 937, 943, 947, 953, 960, 967, 974, 981, 990, - 991, 997, 1001, 1007, 1014, 1021 + 0, 187, 187, 190, 193, 194, 197, 200, 203, 210, + 217, 223, 226, 229, 232, 235, 239, 243, 247, 251, + 257, 260, 266, 269, 275, 276, 282, 289, 296, 303, + 310, 319, 320, 324, 330, 344, 348, 354, 361, 368, + 375, 382, 391, 392, 451, 506, 513, 520, 527, 536, + 537, 543, 546, 567, 571, 577, 589, 601, 606, 610, + 615, 620, 625, 629, 634, 637, 642, 657, 666, 675, + 684, 701, 702, 703, 704, 705, 706, 707, 708, 709, + 710, 713, 719, 722, 726, 730, 738, 746, 757, 763, + 769, 775, 783, 786, 789, 792, 795, 798, 801, 804, + 807, 810, 813, 816, 819, 822, 825, 830, 837, 844, + 860, 861, 864, 864, 876, 879, 880, 886, 887, 890, + 890, 902, 905, 906, 912, 913, 916, 916, 928, 931, + 932, 935, 935, 947, 950, 951, 957, 961, 967, 974, + 981, 988, 995, 1004, 1005, 1011, 1015, 1021, 1028, 1035 }; #endif @@ -665,9 +667,10 @@ static const char *const yytname[] = "timeoutspec", "notbeforespec", "notafterspec", "rolespec", "typespec", "privsspec", "limitprivsspec", "runasspec", "runaslist", "reserved_word", "reserved_alias", "options", "cmndtag", "cmnd", "hostaliases", - "hostalias", "hostlist", "cmndaliases", "cmndalias", "cmndlist", - "runasaliases", "runasalias", "useraliases", "useralias", "userlist", - "opuser", "user", "grouplist", "opgroup", "group", YY_NULLPTR + "hostalias", "$@1", "hostlist", "cmndaliases", "cmndalias", "$@2", + "cmndlist", "runasaliases", "runasalias", "$@3", "useraliases", + "useralias", "$@4", "userlist", "opuser", "user", "grouplist", "opgroup", + "group", YY_NULLPTR }; #endif @@ -686,10 +689,10 @@ static const yytype_uint16 yytoknum[] = }; # endif -#define YYPACT_NINF -112 +#define YYPACT_NINF -114 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-112))) + (!!((Yystate) == (-114))) #define YYTABLE_NINF -4 @@ -700,31 +703,31 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - 160, -37, -112, -112, -112, -112, 6, 9, 35, 222, - 236, 236, 7, -112, 37, 48, 77, 102, 175, -112, - 44, 202, -112, -112, -112, 10, -112, -112, -112, 8, - 11, 124, 43, 69, -112, -112, -112, -112, -112, -112, - 131, -112, -112, 15, 31, 31, -112, -112, -112, 75, - 57, 99, 106, 149, -112, 73, -112, -112, -112, 33, - 72, -112, -112, -112, -112, -112, -112, -112, -112, -112, - -112, -112, 159, 0, -112, 163, 174, 104, -112, 194, - 201, 154, -112, 213, 217, 185, -112, -112, -112, -112, - 236, 196, -112, 45, 153, -112, 212, -112, 249, 250, - 251, -112, 35, -112, -112, 222, 79, 142, 182, -112, - 253, 254, 255, 256, -1, -112, 7, 207, 222, 222, - 37, -112, 7, 7, 48, -112, 236, 236, 77, -112, - 236, 236, 102, -112, -112, 138, -112, 218, -112, -112, - -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, - -112, -112, -112, -112, -112, 228, 228, -112, 230, 230, - -112, 231, 231, -112, 231, 231, -112, -112, -112, 216, - 232, -112, -112, 42, 242, 109, 218, 229, -112, -112, - -112, 176, 233, -112, -112, -112, 42, -112, 235, 237, - 252, 257, 258, 259, 260, 261, 262, -112, -112, -112, - -112, -112, -112, -112, -112, -112, 3, -112, 42, 233, - 265, 278, 279, 280, 282, 283, 284, 285, 292, -112, - -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, - -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, - -112, -112, -112, -112 + 178, -11, -114, -114, -114, -114, 27, 44, 9, 240, + 148, 148, 6, -114, 31, 40, 112, 121, 193, -114, + 75, 220, -114, -114, -114, 95, -114, -114, -114, 10, + 11, 16, 73, 32, -114, -114, -114, -114, -114, -114, + 255, -114, -114, 8, 12, 12, -114, -114, -114, 106, + 63, 70, 74, 89, -114, 66, -114, -114, -114, 34, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, 107, 77, -114, -114, 120, 83, -114, -114, + 143, 87, -114, -114, 158, 92, -114, -114, -114, -114, + 148, 105, -114, 145, 88, -114, 102, -114, 189, 190, + 197, -114, 9, -114, -114, 240, 91, 101, 104, -114, + 198, 206, 207, 212, 209, -114, 6, 170, 169, 240, + 31, -114, 188, 6, 40, -114, 192, 148, 112, -114, + 201, 148, 121, -114, -114, 36, -114, 202, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, 240, 211, -114, 6, 218, + -114, 148, 219, -114, 148, 219, -114, -114, -114, 234, + 224, -114, -114, 211, 218, 219, 219, 99, 196, -21, + 202, 241, -114, -114, -114, 109, 236, -114, -114, -114, + 99, -114, 210, 213, 235, 238, 239, 243, 244, 245, + 246, -114, -114, -114, -114, -114, -114, -114, -114, -114, + 1, -114, 99, 236, 269, 270, 276, 277, 279, 289, + 290, 291, 292, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -732,51 +735,53 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 0, 134, 136, 137, 138, 0, 0, 0, 0, - 0, 0, 0, 135, 0, 0, 0, 0, 0, 6, - 0, 0, 4, 8, 9, 0, 130, 132, 7, 0, + 0, 0, 138, 140, 141, 142, 0, 0, 0, 0, + 0, 0, 0, 139, 0, 0, 0, 0, 0, 6, + 0, 0, 4, 8, 9, 0, 134, 136, 7, 0, 0, 26, 0, 0, 24, 37, 40, 39, 41, 38, - 0, 114, 35, 0, 0, 0, 109, 108, 107, 0, - 0, 0, 0, 0, 49, 0, 120, 51, 53, 0, - 0, 71, 72, 73, 78, 77, 79, 80, 74, 75, - 76, 81, 0, 0, 110, 0, 0, 0, 116, 0, - 0, 0, 126, 0, 0, 0, 122, 133, 1, 5, + 0, 115, 35, 0, 0, 0, 109, 108, 107, 0, + 0, 0, 0, 0, 49, 0, 122, 51, 53, 0, + 112, 71, 72, 73, 78, 77, 79, 80, 74, 75, + 76, 81, 0, 0, 110, 119, 0, 0, 117, 131, + 0, 0, 129, 126, 0, 0, 124, 137, 1, 5, 0, 0, 31, 0, 0, 20, 0, 22, 0, 0, 0, 27, 0, 15, 36, 0, 0, 0, 0, 54, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 12, 0, 0, 0, 13, 0, 0, 0, 11, - 0, 0, 0, 14, 131, 0, 10, 64, 21, 23, - 28, 29, 30, 25, 115, 18, 16, 17, 45, 46, - 47, 48, 50, 121, 19, 112, 113, 111, 118, 119, - 117, 128, 129, 127, 124, 125, 123, 33, 32, 66, - 34, 42, 82, 70, 0, 67, 64, 92, 143, 145, - 144, 0, 69, 139, 141, 65, 0, 43, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 83, 84, 87, - 85, 86, 88, 89, 90, 91, 0, 142, 0, 68, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 105, - 106, 103, 104, 44, 140, 56, 55, 61, 60, 62, - 63, 57, 58, 59 + 0, 0, 0, 14, 135, 0, 10, 64, 21, 23, + 28, 29, 30, 25, 116, 18, 16, 17, 45, 46, + 47, 48, 50, 123, 19, 0, 114, 111, 0, 121, + 118, 0, 133, 130, 0, 128, 125, 33, 32, 66, + 34, 42, 82, 113, 120, 132, 127, 70, 0, 67, + 64, 92, 147, 149, 148, 0, 69, 143, 145, 65, + 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 83, 84, 87, 85, 86, 88, 89, 90, 91, + 0, 146, 0, 68, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 105, 106, 103, 104, 44, 144, 56, + 55, 61, 60, 62, 63, 57, 58, 59 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -112, -112, -112, 281, -112, -112, 145, 203, -112, 168, - 199, 266, -112, 132, 193, -112, -111, 263, -112, -112, - -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, - -13, -112, -112, 264, -112, 189, 4, -112, 186, 127, - -112, 179, -112, 184, -10, 224, 297, 130, 111, 136 + -114, -114, -114, 281, -114, -114, 160, 203, -114, 168, + 199, 266, -114, 127, 194, -114, -113, 254, -114, -114, + -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, + -9, -114, -114, 261, -114, 191, -114, -7, -114, 195, + -114, -108, -114, 180, -114, -114, 185, -114, -10, 225, + 296, 126, 108, 132 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 20, 21, 22, 23, 24, 33, 34, 91, 92, - 41, 42, 170, 171, 54, 55, 56, 57, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 172, 174, 71, - 72, 177, 206, 58, 73, 74, 93, 77, 78, 59, - 85, 86, 81, 82, 25, 26, 27, 182, 183, 184 + 41, 42, 170, 171, 54, 55, 56, 57, 201, 202, + 203, 204, 205, 206, 207, 208, 209, 172, 178, 71, + 72, 181, 210, 58, 73, 74, 118, 93, 77, 78, + 122, 59, 85, 86, 130, 81, 82, 126, 25, 26, + 27, 186, 187, 188 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -784,74 +789,76 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 44, 45, 76, 80, 84, 153, 46, 47, 28, 94, - 46, 47, 96, 43, 35, 29, 36, 37, 30, 38, - 31, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 48, 31, 120, 31, 48, - 31, 60, 39, 49, 88, 121, 178, 49, 101, 90, - 40, 179, 75, 95, 105, 32, 97, 50, 51, 52, - 53, 50, 51, 52, 53, 50, 51, 52, 53, 61, - 90, 32, 116, 32, 180, 32, 46, 47, 46, 47, - 61, 79, 181, 137, 105, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 110, 233, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 48, 83, 48, 102, 61, - 118, 76, 114, 49, 103, 80, 161, 162, 102, 84, - 164, 165, 155, 156, 145, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 61, 35, 111, 36, 37, 167, - 38, 124, 35, 112, 36, 37, 186, 38, 90, 125, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 175, - -2, 1, 98, 39, 2, 99, 100, 3, 4, 5, - 39, 6, 7, 8, 9, 10, 11, 12, 40, 2, - 178, 102, 3, 4, 5, 179, 113, 146, 106, 107, - 108, 128, 13, 14, 15, 16, 17, 119, 138, 129, - 18, 122, -3, 1, 117, 19, 2, 13, 180, 3, - 4, 5, 123, 6, 7, 8, 9, 10, 11, 12, - 2, 102, 132, 3, 4, 5, 35, 147, 36, 37, - 133, 38, 126, 135, 13, 14, 15, 16, 17, 127, - 2, 136, 18, 3, 4, 5, 102, 19, 13, 158, - 159, 130, 154, 173, 39, 131, 18, 139, 140, 141, - 142, 169, 40, 148, 149, 150, 151, 105, 13, 116, - 90, 176, 208, 210, 235, 211, 18, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 185, 236, 237, 238, - 212, 239, 240, 241, 242, 213, 214, 215, 216, 217, - 218, 243, 89, 168, 144, 143, 104, 152, 187, 157, - 160, 166, 163, 109, 134, 87, 209, 207, 115, 234 + 44, 45, 43, 153, 46, 47, 76, 80, 84, 46, + 47, 94, 96, 31, 31, 159, 190, 31, 90, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 48, 28, 60, 29, 167, 48, 31, + 35, 49, 36, 37, 75, 38, 49, 105, 32, 32, + 174, 90, 32, 30, 98, 95, 97, 99, 100, 50, + 51, 52, 53, 61, 50, 51, 52, 53, 39, 46, + 47, 102, 61, 116, 32, 88, 40, 103, 101, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 237, 48, 35, + 110, 36, 37, 182, 38, 114, 49, 111, 183, 46, + 47, 112, 156, 182, 120, 76, 79, 162, 183, 80, + 124, 165, 121, 84, 128, 83, 113, 39, 125, 132, + 102, 184, 129, 138, 90, 40, 145, 133, 48, 185, + 102, 184, 135, 102, 61, 119, 146, 139, 173, 147, + 136, 175, 2, 61, 176, 3, 4, 5, 123, 179, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 62, + 63, 64, 65, 66, 67, 68, 69, 70, -2, 1, + 13, 127, 2, 137, 105, 3, 4, 5, 18, 6, + 7, 8, 9, 10, 11, 12, 131, 2, 140, 141, + 3, 4, 5, 106, 107, 108, 142, 155, 148, 102, + 13, 14, 15, 16, 17, 154, 149, 150, 18, 117, + -3, 1, 151, 19, 2, 13, 158, 3, 4, 5, + 161, 6, 7, 8, 9, 10, 11, 12, 2, 164, + 189, 3, 4, 5, 35, 169, 36, 37, 214, 38, + 105, 215, 13, 14, 15, 16, 17, 116, 90, 35, + 18, 36, 37, 180, 38, 19, 13, 50, 51, 52, + 53, 177, 39, 216, 18, 212, 217, 218, 239, 240, + 40, 219, 220, 221, 222, 241, 242, 39, 243, 192, + 193, 194, 195, 196, 197, 198, 199, 200, 244, 245, + 246, 247, 89, 168, 144, 143, 104, 191, 152, 115, + 109, 157, 166, 163, 87, 134, 213, 211, 0, 160, + 238 }; -static const yytype_uint8 yycheck[] = +static const yytype_int16 yycheck[] = { - 10, 11, 15, 16, 17, 116, 3, 4, 45, 1, - 3, 4, 1, 9, 4, 9, 6, 7, 9, 9, - 5, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 5, 37, 5, 32, - 5, 4, 32, 40, 0, 45, 4, 40, 5, 39, - 40, 9, 4, 45, 39, 40, 45, 58, 59, 60, - 61, 58, 59, 60, 61, 58, 59, 60, 61, 32, - 39, 40, 39, 40, 32, 40, 3, 4, 3, 4, - 32, 4, 40, 38, 39, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 37, 206, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 32, 4, 32, 39, 32, - 38, 124, 39, 40, 45, 128, 126, 127, 39, 132, - 130, 131, 118, 119, 45, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 32, 4, 37, 6, 7, 1, - 9, 37, 4, 37, 6, 7, 37, 9, 39, 45, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 169, - 0, 1, 38, 32, 4, 41, 42, 7, 8, 9, - 32, 11, 12, 13, 14, 15, 16, 17, 40, 4, - 4, 39, 7, 8, 9, 9, 37, 45, 43, 44, - 45, 37, 32, 33, 34, 35, 36, 38, 45, 45, - 40, 38, 0, 1, 59, 45, 4, 32, 32, 7, - 8, 9, 38, 11, 12, 13, 14, 15, 16, 17, - 4, 39, 37, 7, 8, 9, 4, 45, 6, 7, - 45, 9, 38, 37, 32, 33, 34, 35, 36, 38, - 4, 45, 40, 7, 8, 9, 39, 45, 32, 122, - 123, 38, 45, 37, 32, 38, 40, 45, 9, 9, - 9, 43, 40, 10, 10, 10, 10, 39, 32, 39, - 39, 39, 39, 38, 9, 38, 40, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 44, 9, 9, 9, - 38, 9, 9, 9, 9, 38, 38, 38, 38, 38, - 38, 9, 21, 135, 105, 102, 40, 114, 176, 120, - 124, 132, 128, 49, 90, 18, 186, 181, 55, 208 + 10, 11, 9, 116, 3, 4, 15, 16, 17, 3, + 4, 1, 1, 5, 5, 123, 37, 5, 39, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 45, 4, 9, 1, 32, 5, + 4, 40, 6, 7, 4, 9, 40, 39, 40, 40, + 158, 39, 40, 9, 38, 45, 45, 41, 42, 58, + 59, 60, 61, 32, 58, 59, 60, 61, 32, 3, + 4, 39, 32, 39, 40, 0, 40, 45, 5, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 210, 32, 4, + 37, 6, 7, 4, 9, 39, 40, 37, 9, 3, + 4, 37, 119, 4, 37, 124, 4, 127, 9, 128, + 37, 131, 45, 132, 37, 4, 37, 32, 45, 37, + 39, 32, 45, 45, 39, 40, 45, 45, 32, 40, + 39, 32, 37, 39, 32, 38, 45, 45, 155, 45, + 45, 161, 4, 32, 164, 7, 8, 9, 38, 169, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 0, 1, + 32, 38, 4, 38, 39, 7, 8, 9, 40, 11, + 12, 13, 14, 15, 16, 17, 38, 4, 9, 9, + 7, 8, 9, 43, 44, 45, 9, 38, 10, 39, + 32, 33, 34, 35, 36, 45, 10, 10, 40, 59, + 0, 1, 10, 45, 4, 32, 38, 7, 8, 9, + 38, 11, 12, 13, 14, 15, 16, 17, 4, 38, + 44, 7, 8, 9, 4, 43, 6, 7, 38, 9, + 39, 38, 32, 33, 34, 35, 36, 39, 39, 4, + 40, 6, 7, 39, 9, 45, 32, 58, 59, 60, + 61, 37, 32, 38, 40, 39, 38, 38, 9, 9, + 40, 38, 38, 38, 38, 9, 9, 32, 9, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 9, 9, + 9, 9, 21, 135, 105, 102, 40, 180, 114, 55, + 49, 120, 132, 128, 18, 90, 190, 185, -1, 124, + 212 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -860,29 +867,29 @@ static const yytype_uint8 yystos[] = { 0, 1, 4, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 32, 33, 34, 35, 36, 40, 45, - 63, 64, 65, 66, 67, 106, 107, 108, 45, 9, + 63, 64, 65, 66, 67, 110, 111, 112, 45, 9, 9, 5, 40, 68, 69, 4, 6, 7, 9, 32, - 40, 72, 73, 98, 106, 106, 3, 4, 32, 40, - 58, 59, 60, 61, 76, 77, 78, 79, 95, 101, + 40, 72, 73, 99, 110, 110, 3, 4, 32, 40, + 58, 59, 60, 61, 76, 77, 78, 79, 95, 103, 4, 32, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 91, 92, 96, 97, 4, 92, 99, 100, 4, - 92, 104, 105, 4, 92, 102, 103, 108, 0, 65, - 39, 70, 71, 98, 1, 45, 1, 45, 38, 41, + 56, 91, 92, 96, 97, 4, 92, 100, 101, 4, + 92, 107, 108, 4, 92, 104, 105, 112, 0, 65, + 39, 70, 71, 99, 1, 45, 1, 45, 38, 41, 42, 5, 39, 45, 73, 39, 68, 68, 68, 95, - 37, 37, 37, 37, 39, 79, 39, 68, 38, 38, - 37, 45, 38, 38, 37, 45, 38, 38, 37, 45, - 38, 38, 37, 45, 107, 37, 45, 38, 45, 45, + 37, 37, 37, 37, 39, 79, 39, 68, 98, 38, + 37, 45, 102, 38, 37, 45, 109, 38, 37, 45, + 106, 38, 37, 45, 111, 37, 45, 38, 45, 45, 9, 9, 9, 69, 72, 45, 45, 45, 10, 10, - 10, 10, 76, 78, 45, 98, 98, 97, 101, 101, - 100, 106, 106, 105, 106, 106, 103, 1, 71, 43, - 74, 75, 89, 37, 90, 106, 39, 93, 4, 9, - 32, 40, 109, 110, 111, 44, 37, 75, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 94, 111, 39, 109, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 78, 110, 9, 9, 9, 9, 9, - 9, 9, 9, 9 + 10, 10, 76, 78, 45, 38, 99, 97, 38, 103, + 101, 38, 110, 108, 38, 110, 105, 1, 71, 43, + 74, 75, 89, 99, 103, 110, 110, 37, 90, 110, + 39, 93, 4, 9, 32, 40, 113, 114, 115, 44, + 37, 75, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 94, 115, 39, 113, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 78, 114, 9, + 9, 9, 9, 9, 9, 9, 9, 9 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ @@ -899,10 +906,10 @@ static const yytype_uint8 yyr1[] = 91, 92, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 95, 95, 95, - 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, - 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, - 106, 106, 107, 107, 108, 108, 108, 108, 108, 109, - 109, 110, 110, 111, 111, 111 + 96, 96, 98, 97, 97, 99, 99, 100, 100, 102, + 101, 101, 103, 103, 104, 104, 106, 105, 105, 107, + 107, 109, 108, 108, 110, 110, 111, 111, 112, 112, + 112, 112, 112, 113, 113, 114, 114, 115, 115, 115 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ @@ -919,10 +926,10 @@ static const yytype_uint8 yyr2[] = 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, - 1, 3, 3, 3, 1, 3, 1, 3, 3, 3, - 1, 3, 1, 3, 3, 3, 1, 3, 3, 3, - 1, 3, 1, 2, 1, 1, 1, 1, 1, 1, - 3, 1, 2, 1, 1, 1 + 1, 3, 0, 4, 3, 1, 3, 1, 3, 0, + 4, 3, 1, 3, 1, 3, 0, 4, 3, 1, + 3, 0, 4, 3, 1, 3, 1, 2, 1, 1, + 1, 1, 1, 1, 3, 1, 2, 1, 1, 1 }; @@ -1608,31 +1615,31 @@ yyreduce: switch (yyn) { case 2: -#line 185 "gram.y" /* yacc.c:1652 */ +#line 187 "gram.y" /* yacc.c:1652 */ { ; /* empty file */ } -#line 1610 "gram.c" /* yacc.c:1652 */ +#line 1617 "gram.c" /* yacc.c:1652 */ break; case 6: -#line 195 "gram.y" /* yacc.c:1652 */ +#line 197 "gram.y" /* yacc.c:1652 */ { ; /* blank line */ } -#line 1618 "gram.c" /* yacc.c:1652 */ +#line 1625 "gram.c" /* yacc.c:1652 */ break; case 7: -#line 198 "gram.y" /* yacc.c:1652 */ +#line 200 "gram.y" /* yacc.c:1652 */ { yyerrok; } -#line 1626 "gram.c" /* yacc.c:1652 */ +#line 1633 "gram.c" /* yacc.c:1652 */ break; case 8: -#line 201 "gram.y" /* yacc.c:1652 */ +#line 203 "gram.y" /* yacc.c:1652 */ { if (!push_include((yyvsp[0].string), false)) { free((yyvsp[0].string)); @@ -1640,11 +1647,11 @@ yyreduce: } free((yyvsp[0].string)); } -#line 1638 "gram.c" /* yacc.c:1652 */ +#line 1645 "gram.c" /* yacc.c:1652 */ break; case 9: -#line 208 "gram.y" /* yacc.c:1652 */ +#line 210 "gram.y" /* yacc.c:1652 */ { if (!push_include((yyvsp[0].string), true)) { free((yyvsp[0].string)); @@ -1652,142 +1659,142 @@ yyreduce: } free((yyvsp[0].string)); } -#line 1650 "gram.c" /* yacc.c:1652 */ +#line 1657 "gram.c" /* yacc.c:1652 */ break; case 10: -#line 215 "gram.y" /* yacc.c:1652 */ +#line 217 "gram.y" /* yacc.c:1652 */ { if (!add_userspec((yyvsp[-2].member), (yyvsp[-1].privilege))) { sudoerserror(N_("unable to allocate memory")); YYERROR; } } -#line 1661 "gram.c" /* yacc.c:1652 */ +#line 1668 "gram.c" /* yacc.c:1652 */ break; case 11: -#line 221 "gram.y" /* yacc.c:1652 */ +#line 223 "gram.y" /* yacc.c:1652 */ { ; } -#line 1669 "gram.c" /* yacc.c:1652 */ +#line 1676 "gram.c" /* yacc.c:1652 */ break; case 12: -#line 224 "gram.y" /* yacc.c:1652 */ +#line 226 "gram.y" /* yacc.c:1652 */ { ; } -#line 1677 "gram.c" /* yacc.c:1652 */ +#line 1684 "gram.c" /* yacc.c:1652 */ break; case 13: -#line 227 "gram.y" /* yacc.c:1652 */ +#line 229 "gram.y" /* yacc.c:1652 */ { ; } -#line 1685 "gram.c" /* yacc.c:1652 */ +#line 1692 "gram.c" /* yacc.c:1652 */ break; case 14: -#line 230 "gram.y" /* yacc.c:1652 */ +#line 232 "gram.y" /* yacc.c:1652 */ { ; } -#line 1693 "gram.c" /* yacc.c:1652 */ +#line 1700 "gram.c" /* yacc.c:1652 */ break; case 15: -#line 233 "gram.y" /* yacc.c:1652 */ +#line 235 "gram.y" /* yacc.c:1652 */ { if (!add_defaults(DEFAULTS, NULL, (yyvsp[-1].defaults))) YYERROR; } -#line 1702 "gram.c" /* yacc.c:1652 */ +#line 1709 "gram.c" /* yacc.c:1652 */ break; case 16: -#line 237 "gram.y" /* yacc.c:1652 */ +#line 239 "gram.y" /* yacc.c:1652 */ { if (!add_defaults(DEFAULTS_USER, (yyvsp[-2].member), (yyvsp[-1].defaults))) YYERROR; } -#line 1711 "gram.c" /* yacc.c:1652 */ +#line 1718 "gram.c" /* yacc.c:1652 */ break; case 17: -#line 241 "gram.y" /* yacc.c:1652 */ +#line 243 "gram.y" /* yacc.c:1652 */ { if (!add_defaults(DEFAULTS_RUNAS, (yyvsp[-2].member), (yyvsp[-1].defaults))) YYERROR; } -#line 1720 "gram.c" /* yacc.c:1652 */ +#line 1727 "gram.c" /* yacc.c:1652 */ break; case 18: -#line 245 "gram.y" /* yacc.c:1652 */ +#line 247 "gram.y" /* yacc.c:1652 */ { if (!add_defaults(DEFAULTS_HOST, (yyvsp[-2].member), (yyvsp[-1].defaults))) YYERROR; } -#line 1729 "gram.c" /* yacc.c:1652 */ +#line 1736 "gram.c" /* yacc.c:1652 */ break; case 19: -#line 249 "gram.y" /* yacc.c:1652 */ +#line 251 "gram.y" /* yacc.c:1652 */ { if (!add_defaults(DEFAULTS_CMND, (yyvsp[-2].member), (yyvsp[-1].defaults))) YYERROR; } -#line 1738 "gram.c" /* yacc.c:1652 */ +#line 1745 "gram.c" /* yacc.c:1652 */ break; case 20: -#line 255 "gram.y" /* yacc.c:1652 */ +#line 257 "gram.y" /* yacc.c:1652 */ { (yyval.string) = (yyvsp[-1].string); } -#line 1746 "gram.c" /* yacc.c:1652 */ +#line 1753 "gram.c" /* yacc.c:1652 */ break; case 21: -#line 258 "gram.y" /* yacc.c:1652 */ +#line 260 "gram.y" /* yacc.c:1652 */ { yyerrok; (yyval.string) = (yyvsp[-2].string); } -#line 1755 "gram.c" /* yacc.c:1652 */ +#line 1762 "gram.c" /* yacc.c:1652 */ break; case 22: -#line 264 "gram.y" /* yacc.c:1652 */ +#line 266 "gram.y" /* yacc.c:1652 */ { (yyval.string) = (yyvsp[-1].string); } -#line 1763 "gram.c" /* yacc.c:1652 */ +#line 1770 "gram.c" /* yacc.c:1652 */ break; case 23: -#line 267 "gram.y" /* yacc.c:1652 */ +#line 269 "gram.y" /* yacc.c:1652 */ { yyerrok; (yyval.string) = (yyvsp[-2].string); } -#line 1772 "gram.c" /* yacc.c:1652 */ +#line 1779 "gram.c" /* yacc.c:1652 */ break; case 25: -#line 274 "gram.y" /* yacc.c:1652 */ +#line 276 "gram.y" /* yacc.c:1652 */ { HLTQ_CONCAT((yyvsp[-2].defaults), (yyvsp[0].defaults), entries); (yyval.defaults) = (yyvsp[-2].defaults); } -#line 1781 "gram.c" /* yacc.c:1652 */ +#line 1788 "gram.c" /* yacc.c:1652 */ break; case 26: -#line 280 "gram.y" /* yacc.c:1652 */ +#line 282 "gram.y" /* yacc.c:1652 */ { (yyval.defaults) = new_default((yyvsp[0].string), NULL, true); if ((yyval.defaults) == NULL) { @@ -1795,11 +1802,11 @@ yyreduce: YYERROR; } } -#line 1793 "gram.c" /* yacc.c:1652 */ +#line 1800 "gram.c" /* yacc.c:1652 */ break; case 27: -#line 287 "gram.y" /* yacc.c:1652 */ +#line 289 "gram.y" /* yacc.c:1652 */ { (yyval.defaults) = new_default((yyvsp[0].string), NULL, false); if ((yyval.defaults) == NULL) { @@ -1807,11 +1814,11 @@ yyreduce: YYERROR; } } -#line 1805 "gram.c" /* yacc.c:1652 */ +#line 1812 "gram.c" /* yacc.c:1652 */ break; case 28: -#line 294 "gram.y" /* yacc.c:1652 */ +#line 296 "gram.y" /* yacc.c:1652 */ { (yyval.defaults) = new_default((yyvsp[-2].string), (yyvsp[0].string), true); if ((yyval.defaults) == NULL) { @@ -1819,11 +1826,11 @@ yyreduce: YYERROR; } } -#line 1817 "gram.c" /* yacc.c:1652 */ +#line 1824 "gram.c" /* yacc.c:1652 */ break; case 29: -#line 301 "gram.y" /* yacc.c:1652 */ +#line 303 "gram.y" /* yacc.c:1652 */ { (yyval.defaults) = new_default((yyvsp[-2].string), (yyvsp[0].string), '+'); if ((yyval.defaults) == NULL) { @@ -1831,11 +1838,11 @@ yyreduce: YYERROR; } } -#line 1829 "gram.c" /* yacc.c:1652 */ +#line 1836 "gram.c" /* yacc.c:1652 */ break; case 30: -#line 308 "gram.y" /* yacc.c:1652 */ +#line 310 "gram.y" /* yacc.c:1652 */ { (yyval.defaults) = new_default((yyvsp[-2].string), (yyvsp[0].string), '-'); if ((yyval.defaults) == NULL) { @@ -1843,29 +1850,29 @@ yyreduce: YYERROR; } } -#line 1841 "gram.c" /* yacc.c:1652 */ +#line 1848 "gram.c" /* yacc.c:1652 */ break; case 32: -#line 318 "gram.y" /* yacc.c:1652 */ +#line 320 "gram.y" /* yacc.c:1652 */ { HLTQ_CONCAT((yyvsp[-2].privilege), (yyvsp[0].privilege), entries); (yyval.privilege) = (yyvsp[-2].privilege); } -#line 1850 "gram.c" /* yacc.c:1652 */ +#line 1857 "gram.c" /* yacc.c:1652 */ break; case 33: -#line 322 "gram.y" /* yacc.c:1652 */ +#line 324 "gram.y" /* yacc.c:1652 */ { yyerrok; (yyval.privilege) = (yyvsp[-2].privilege); } -#line 1859 "gram.c" /* yacc.c:1652 */ +#line 1866 "gram.c" /* yacc.c:1652 */ break; case 34: -#line 328 "gram.y" /* yacc.c:1652 */ +#line 330 "gram.y" /* yacc.c:1652 */ { struct privilege *p = calloc(1, sizeof(*p)); if (p == NULL) { @@ -1878,29 +1885,29 @@ yyreduce: HLTQ_INIT(p, entries); (yyval.privilege) = p; } -#line 1876 "gram.c" /* yacc.c:1652 */ +#line 1883 "gram.c" /* yacc.c:1652 */ break; case 35: -#line 342 "gram.y" /* yacc.c:1652 */ +#line 344 "gram.y" /* yacc.c:1652 */ { (yyval.member) = (yyvsp[0].member); (yyval.member)->negated = false; } -#line 1885 "gram.c" /* yacc.c:1652 */ +#line 1892 "gram.c" /* yacc.c:1652 */ break; case 36: -#line 346 "gram.y" /* yacc.c:1652 */ +#line 348 "gram.y" /* yacc.c:1652 */ { (yyval.member) = (yyvsp[0].member); (yyval.member)->negated = true; } -#line 1894 "gram.c" /* yacc.c:1652 */ +#line 1901 "gram.c" /* yacc.c:1652 */ break; case 37: -#line 352 "gram.y" /* yacc.c:1652 */ +#line 354 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member((yyvsp[0].string), ALIAS); if ((yyval.member) == NULL) { @@ -1908,11 +1915,11 @@ yyreduce: YYERROR; } } -#line 1906 "gram.c" /* yacc.c:1652 */ +#line 1913 "gram.c" /* yacc.c:1652 */ break; case 38: -#line 359 "gram.y" /* yacc.c:1652 */ +#line 361 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member(NULL, ALL); if ((yyval.member) == NULL) { @@ -1920,11 +1927,11 @@ yyreduce: YYERROR; } } -#line 1918 "gram.c" /* yacc.c:1652 */ +#line 1925 "gram.c" /* yacc.c:1652 */ break; case 39: -#line 366 "gram.y" /* yacc.c:1652 */ +#line 368 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member((yyvsp[0].string), NETGROUP); if ((yyval.member) == NULL) { @@ -1932,11 +1939,11 @@ yyreduce: YYERROR; } } -#line 1930 "gram.c" /* yacc.c:1652 */ +#line 1937 "gram.c" /* yacc.c:1652 */ break; case 40: -#line 373 "gram.y" /* yacc.c:1652 */ +#line 375 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member((yyvsp[0].string), NTWKADDR); if ((yyval.member) == NULL) { @@ -1944,11 +1951,11 @@ yyreduce: YYERROR; } } -#line 1942 "gram.c" /* yacc.c:1652 */ +#line 1949 "gram.c" /* yacc.c:1652 */ break; case 41: -#line 380 "gram.y" /* yacc.c:1652 */ +#line 382 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member((yyvsp[0].string), WORD); if ((yyval.member) == NULL) { @@ -1956,11 +1963,11 @@ yyreduce: YYERROR; } } -#line 1954 "gram.c" /* yacc.c:1652 */ +#line 1961 "gram.c" /* yacc.c:1652 */ break; case 43: -#line 390 "gram.y" /* yacc.c:1652 */ +#line 392 "gram.y" /* yacc.c:1652 */ { struct cmndspec *prev; prev = HLTQ_LAST((yyvsp[-2].cmndspec), cmndspec, entries); @@ -2018,11 +2025,11 @@ yyreduce: } (yyval.cmndspec) = (yyvsp[-2].cmndspec); } -#line 2016 "gram.c" /* yacc.c:1652 */ +#line 2023 "gram.c" /* yacc.c:1652 */ break; case 44: -#line 449 "gram.y" /* yacc.c:1652 */ +#line 451 "gram.y" /* yacc.c:1652 */ { struct cmndspec *cs = calloc(1, sizeof(*cs)); if (cs == NULL) { @@ -2076,11 +2083,11 @@ yyreduce: cs->tags.setenv = IMPLIED; (yyval.cmndspec) = cs; } -#line 2074 "gram.c" /* yacc.c:1652 */ +#line 2081 "gram.c" /* yacc.c:1652 */ break; case 45: -#line 504 "gram.y" /* yacc.c:1652 */ +#line 506 "gram.y" /* yacc.c:1652 */ { (yyval.digest) = new_digest(SUDO_DIGEST_SHA224, (yyvsp[0].string)); if ((yyval.digest) == NULL) { @@ -2088,11 +2095,11 @@ yyreduce: YYERROR; } } -#line 2086 "gram.c" /* yacc.c:1652 */ +#line 2093 "gram.c" /* yacc.c:1652 */ break; case 46: -#line 511 "gram.y" /* yacc.c:1652 */ +#line 513 "gram.y" /* yacc.c:1652 */ { (yyval.digest) = new_digest(SUDO_DIGEST_SHA256, (yyvsp[0].string)); if ((yyval.digest) == NULL) { @@ -2100,11 +2107,11 @@ yyreduce: YYERROR; } } -#line 2098 "gram.c" /* yacc.c:1652 */ +#line 2105 "gram.c" /* yacc.c:1652 */ break; case 47: -#line 518 "gram.y" /* yacc.c:1652 */ +#line 520 "gram.y" /* yacc.c:1652 */ { (yyval.digest) = new_digest(SUDO_DIGEST_SHA384, (yyvsp[0].string)); if ((yyval.digest) == NULL) { @@ -2112,11 +2119,11 @@ yyreduce: YYERROR; } } -#line 2110 "gram.c" /* yacc.c:1652 */ +#line 2117 "gram.c" /* yacc.c:1652 */ break; case 48: -#line 525 "gram.y" /* yacc.c:1652 */ +#line 527 "gram.y" /* yacc.c:1652 */ { (yyval.digest) = new_digest(SUDO_DIGEST_SHA512, (yyvsp[0].string)); if ((yyval.digest) == NULL) { @@ -2124,28 +2131,28 @@ yyreduce: YYERROR; } } -#line 2122 "gram.c" /* yacc.c:1652 */ +#line 2129 "gram.c" /* yacc.c:1652 */ break; case 50: -#line 535 "gram.y" /* yacc.c:1652 */ +#line 537 "gram.y" /* yacc.c:1652 */ { HLTQ_CONCAT((yyvsp[-2].digest), (yyvsp[0].digest), entries); (yyval.digest) = (yyvsp[-2].digest); } -#line 2131 "gram.c" /* yacc.c:1652 */ +#line 2138 "gram.c" /* yacc.c:1652 */ break; case 51: -#line 541 "gram.y" /* yacc.c:1652 */ +#line 543 "gram.y" /* yacc.c:1652 */ { (yyval.member) = (yyvsp[0].member); } -#line 2139 "gram.c" /* yacc.c:1652 */ +#line 2146 "gram.c" /* yacc.c:1652 */ break; case 52: -#line 544 "gram.y" /* yacc.c:1652 */ +#line 546 "gram.y" /* yacc.c:1652 */ { struct sudo_command *c = (struct sudo_command *) (yyvsp[0].member)->name; @@ -2165,29 +2172,29 @@ yyreduce: HLTQ_TO_TAILQ(&c->digests, (yyvsp[-1].digest), entries); (yyval.member) = (yyvsp[0].member); } -#line 2163 "gram.c" /* yacc.c:1652 */ +#line 2170 "gram.c" /* yacc.c:1652 */ break; case 53: -#line 565 "gram.y" /* yacc.c:1652 */ +#line 567 "gram.y" /* yacc.c:1652 */ { (yyval.member) = (yyvsp[0].member); (yyval.member)->negated = false; } -#line 2172 "gram.c" /* yacc.c:1652 */ +#line 2179 "gram.c" /* yacc.c:1652 */ break; case 54: -#line 569 "gram.y" /* yacc.c:1652 */ +#line 571 "gram.y" /* yacc.c:1652 */ { (yyval.member) = (yyvsp[0].member); (yyval.member)->negated = true; } -#line 2181 "gram.c" /* yacc.c:1652 */ +#line 2188 "gram.c" /* yacc.c:1652 */ break; case 55: -#line 575 "gram.y" /* yacc.c:1652 */ +#line 577 "gram.y" /* yacc.c:1652 */ { if ((yyvsp[0].string)[0] != '/' && (yyvsp[0].string)[0] != '~') { if (strcmp((yyvsp[0].string), "*") != 0) { @@ -2198,11 +2205,11 @@ yyreduce: } (yyval.string) = (yyvsp[0].string); } -#line 2196 "gram.c" /* yacc.c:1652 */ +#line 2203 "gram.c" /* yacc.c:1652 */ break; case 56: -#line 587 "gram.y" /* yacc.c:1652 */ +#line 589 "gram.y" /* yacc.c:1652 */ { if ((yyvsp[0].string)[0] != '/' && (yyvsp[0].string)[0] != '~') { if (strcmp((yyvsp[0].string), "*") != 0) { @@ -2213,83 +2220,83 @@ yyreduce: } (yyval.string) = (yyvsp[0].string); } -#line 2211 "gram.c" /* yacc.c:1652 */ +#line 2218 "gram.c" /* yacc.c:1652 */ break; case 57: -#line 599 "gram.y" /* yacc.c:1652 */ +#line 601 "gram.y" /* yacc.c:1652 */ { (yyval.string) = (yyvsp[0].string); } -#line 2219 "gram.c" /* yacc.c:1652 */ +#line 2226 "gram.c" /* yacc.c:1652 */ break; case 58: -#line 604 "gram.y" /* yacc.c:1652 */ +#line 606 "gram.y" /* yacc.c:1652 */ { (yyval.string) = (yyvsp[0].string); } -#line 2227 "gram.c" /* yacc.c:1652 */ +#line 2234 "gram.c" /* yacc.c:1652 */ break; case 59: -#line 608 "gram.y" /* yacc.c:1652 */ +#line 610 "gram.y" /* yacc.c:1652 */ { (yyval.string) = (yyvsp[0].string); } -#line 2235 "gram.c" /* yacc.c:1652 */ +#line 2242 "gram.c" /* yacc.c:1652 */ break; case 60: -#line 613 "gram.y" /* yacc.c:1652 */ +#line 615 "gram.y" /* yacc.c:1652 */ { (yyval.string) = (yyvsp[0].string); } -#line 2243 "gram.c" /* yacc.c:1652 */ +#line 2250 "gram.c" /* yacc.c:1652 */ break; case 61: -#line 618 "gram.y" /* yacc.c:1652 */ +#line 620 "gram.y" /* yacc.c:1652 */ { (yyval.string) = (yyvsp[0].string); } -#line 2251 "gram.c" /* yacc.c:1652 */ +#line 2258 "gram.c" /* yacc.c:1652 */ break; case 62: -#line 623 "gram.y" /* yacc.c:1652 */ +#line 625 "gram.y" /* yacc.c:1652 */ { (yyval.string) = (yyvsp[0].string); } -#line 2259 "gram.c" /* yacc.c:1652 */ +#line 2266 "gram.c" /* yacc.c:1652 */ break; case 63: -#line 627 "gram.y" /* yacc.c:1652 */ +#line 629 "gram.y" /* yacc.c:1652 */ { (yyval.string) = (yyvsp[0].string); } -#line 2267 "gram.c" /* yacc.c:1652 */ +#line 2274 "gram.c" /* yacc.c:1652 */ break; case 64: -#line 632 "gram.y" /* yacc.c:1652 */ +#line 634 "gram.y" /* yacc.c:1652 */ { (yyval.runas) = NULL; } -#line 2275 "gram.c" /* yacc.c:1652 */ +#line 2282 "gram.c" /* yacc.c:1652 */ break; case 65: -#line 635 "gram.y" /* yacc.c:1652 */ +#line 637 "gram.y" /* yacc.c:1652 */ { (yyval.runas) = (yyvsp[-1].runas); } -#line 2283 "gram.c" /* yacc.c:1652 */ +#line 2290 "gram.c" /* yacc.c:1652 */ break; case 66: -#line 640 "gram.y" /* yacc.c:1652 */ +#line 642 "gram.y" /* yacc.c:1652 */ { (yyval.runas) = calloc(1, sizeof(struct runascontainer)); if ((yyval.runas) != NULL) { @@ -2305,11 +2312,11 @@ yyreduce: YYERROR; } } -#line 2303 "gram.c" /* yacc.c:1652 */ +#line 2310 "gram.c" /* yacc.c:1652 */ break; case 67: -#line 655 "gram.y" /* yacc.c:1652 */ +#line 657 "gram.y" /* yacc.c:1652 */ { (yyval.runas) = calloc(1, sizeof(struct runascontainer)); if ((yyval.runas) == NULL) { @@ -2319,11 +2326,11 @@ yyreduce: (yyval.runas)->runasusers = (yyvsp[0].member); /* $$->runasgroups = NULL; */ } -#line 2317 "gram.c" /* yacc.c:1652 */ +#line 2324 "gram.c" /* yacc.c:1652 */ break; case 68: -#line 664 "gram.y" /* yacc.c:1652 */ +#line 666 "gram.y" /* yacc.c:1652 */ { (yyval.runas) = calloc(1, sizeof(struct runascontainer)); if ((yyval.runas) == NULL) { @@ -2333,11 +2340,11 @@ yyreduce: (yyval.runas)->runasusers = (yyvsp[-2].member); (yyval.runas)->runasgroups = (yyvsp[0].member); } -#line 2331 "gram.c" /* yacc.c:1652 */ +#line 2338 "gram.c" /* yacc.c:1652 */ break; case 69: -#line 673 "gram.y" /* yacc.c:1652 */ +#line 675 "gram.y" /* yacc.c:1652 */ { (yyval.runas) = calloc(1, sizeof(struct runascontainer)); if ((yyval.runas) == NULL) { @@ -2347,11 +2354,11 @@ yyreduce: /* $$->runasusers = NULL; */ (yyval.runas)->runasgroups = (yyvsp[0].member); } -#line 2345 "gram.c" /* yacc.c:1652 */ +#line 2352 "gram.c" /* yacc.c:1652 */ break; case 70: -#line 682 "gram.y" /* yacc.c:1652 */ +#line 684 "gram.y" /* yacc.c:1652 */ { (yyval.runas) = calloc(1, sizeof(struct runascontainer)); if ((yyval.runas) != NULL) { @@ -2367,46 +2374,46 @@ yyreduce: YYERROR; } } -#line 2365 "gram.c" /* yacc.c:1652 */ +#line 2372 "gram.c" /* yacc.c:1652 */ break; case 81: -#line 711 "gram.y" /* yacc.c:1652 */ +#line 713 "gram.y" /* yacc.c:1652 */ { sudoerserror(N_("syntax error, reserved word used as an alias name")); YYERROR; } -#line 2374 "gram.c" /* yacc.c:1652 */ +#line 2381 "gram.c" /* yacc.c:1652 */ break; case 82: -#line 717 "gram.y" /* yacc.c:1652 */ +#line 719 "gram.y" /* yacc.c:1652 */ { init_options(&(yyval.options)); } -#line 2382 "gram.c" /* yacc.c:1652 */ +#line 2389 "gram.c" /* yacc.c:1652 */ break; case 83: -#line 720 "gram.y" /* yacc.c:1652 */ +#line 722 "gram.y" /* yacc.c:1652 */ { free((yyval.options).runcwd); (yyval.options).runcwd = (yyvsp[0].string); } -#line 2391 "gram.c" /* yacc.c:1652 */ +#line 2398 "gram.c" /* yacc.c:1652 */ break; case 84: -#line 724 "gram.y" /* yacc.c:1652 */ +#line 726 "gram.y" /* yacc.c:1652 */ { free((yyval.options).runchroot); (yyval.options).runchroot = (yyvsp[0].string); } -#line 2400 "gram.c" /* yacc.c:1652 */ +#line 2407 "gram.c" /* yacc.c:1652 */ break; case 85: -#line 728 "gram.y" /* yacc.c:1652 */ +#line 730 "gram.y" /* yacc.c:1652 */ { (yyval.options).notbefore = parse_gentime((yyvsp[0].string)); free((yyvsp[0].string)); @@ -2415,11 +2422,11 @@ yyreduce: YYERROR; } } -#line 2413 "gram.c" /* yacc.c:1652 */ +#line 2420 "gram.c" /* yacc.c:1652 */ break; case 86: -#line 736 "gram.y" /* yacc.c:1652 */ +#line 738 "gram.y" /* yacc.c:1652 */ { (yyval.options).notafter = parse_gentime((yyvsp[0].string)); free((yyvsp[0].string)); @@ -2428,11 +2435,11 @@ yyreduce: YYERROR; } } -#line 2426 "gram.c" /* yacc.c:1652 */ +#line 2433 "gram.c" /* yacc.c:1652 */ break; case 87: -#line 744 "gram.y" /* yacc.c:1652 */ +#line 746 "gram.y" /* yacc.c:1652 */ { (yyval.options).timeout = parse_timeout((yyvsp[0].string)); free((yyvsp[0].string)); @@ -2444,175 +2451,175 @@ yyreduce: YYERROR; } } -#line 2442 "gram.c" /* yacc.c:1652 */ +#line 2449 "gram.c" /* yacc.c:1652 */ break; case 88: -#line 755 "gram.y" /* yacc.c:1652 */ +#line 757 "gram.y" /* yacc.c:1652 */ { #ifdef HAVE_SELINUX free((yyval.options).role); (yyval.options).role = (yyvsp[0].string); #endif } -#line 2453 "gram.c" /* yacc.c:1652 */ +#line 2460 "gram.c" /* yacc.c:1652 */ break; case 89: -#line 761 "gram.y" /* yacc.c:1652 */ +#line 763 "gram.y" /* yacc.c:1652 */ { #ifdef HAVE_SELINUX free((yyval.options).type); (yyval.options).type = (yyvsp[0].string); #endif } -#line 2464 "gram.c" /* yacc.c:1652 */ +#line 2471 "gram.c" /* yacc.c:1652 */ break; case 90: -#line 767 "gram.y" /* yacc.c:1652 */ +#line 769 "gram.y" /* yacc.c:1652 */ { #ifdef HAVE_PRIV_SET free((yyval.options).privs); (yyval.options).privs = (yyvsp[0].string); #endif } -#line 2475 "gram.c" /* yacc.c:1652 */ +#line 2482 "gram.c" /* yacc.c:1652 */ break; case 91: -#line 773 "gram.y" /* yacc.c:1652 */ +#line 775 "gram.y" /* yacc.c:1652 */ { #ifdef HAVE_PRIV_SET free((yyval.options).limitprivs); (yyval.options).limitprivs = (yyvsp[0].string); #endif } -#line 2486 "gram.c" /* yacc.c:1652 */ +#line 2493 "gram.c" /* yacc.c:1652 */ break; case 92: -#line 781 "gram.y" /* yacc.c:1652 */ +#line 783 "gram.y" /* yacc.c:1652 */ { TAGS_INIT((yyval.tag)); } -#line 2494 "gram.c" /* yacc.c:1652 */ +#line 2501 "gram.c" /* yacc.c:1652 */ break; case 93: -#line 784 "gram.y" /* yacc.c:1652 */ +#line 786 "gram.y" /* yacc.c:1652 */ { (yyval.tag).nopasswd = true; } -#line 2502 "gram.c" /* yacc.c:1652 */ +#line 2509 "gram.c" /* yacc.c:1652 */ break; case 94: -#line 787 "gram.y" /* yacc.c:1652 */ +#line 789 "gram.y" /* yacc.c:1652 */ { (yyval.tag).nopasswd = false; } -#line 2510 "gram.c" /* yacc.c:1652 */ +#line 2517 "gram.c" /* yacc.c:1652 */ break; case 95: -#line 790 "gram.y" /* yacc.c:1652 */ +#line 792 "gram.y" /* yacc.c:1652 */ { (yyval.tag).noexec = true; } -#line 2518 "gram.c" /* yacc.c:1652 */ +#line 2525 "gram.c" /* yacc.c:1652 */ break; case 96: -#line 793 "gram.y" /* yacc.c:1652 */ +#line 795 "gram.y" /* yacc.c:1652 */ { (yyval.tag).noexec = false; } -#line 2526 "gram.c" /* yacc.c:1652 */ +#line 2533 "gram.c" /* yacc.c:1652 */ break; case 97: -#line 796 "gram.y" /* yacc.c:1652 */ +#line 798 "gram.y" /* yacc.c:1652 */ { (yyval.tag).setenv = true; } -#line 2534 "gram.c" /* yacc.c:1652 */ +#line 2541 "gram.c" /* yacc.c:1652 */ break; case 98: -#line 799 "gram.y" /* yacc.c:1652 */ +#line 801 "gram.y" /* yacc.c:1652 */ { (yyval.tag).setenv = false; } -#line 2542 "gram.c" /* yacc.c:1652 */ +#line 2549 "gram.c" /* yacc.c:1652 */ break; case 99: -#line 802 "gram.y" /* yacc.c:1652 */ +#line 804 "gram.y" /* yacc.c:1652 */ { (yyval.tag).log_input = true; } -#line 2550 "gram.c" /* yacc.c:1652 */ +#line 2557 "gram.c" /* yacc.c:1652 */ break; case 100: -#line 805 "gram.y" /* yacc.c:1652 */ +#line 807 "gram.y" /* yacc.c:1652 */ { (yyval.tag).log_input = false; } -#line 2558 "gram.c" /* yacc.c:1652 */ +#line 2565 "gram.c" /* yacc.c:1652 */ break; case 101: -#line 808 "gram.y" /* yacc.c:1652 */ +#line 810 "gram.y" /* yacc.c:1652 */ { (yyval.tag).log_output = true; } -#line 2566 "gram.c" /* yacc.c:1652 */ +#line 2573 "gram.c" /* yacc.c:1652 */ break; case 102: -#line 811 "gram.y" /* yacc.c:1652 */ +#line 813 "gram.y" /* yacc.c:1652 */ { (yyval.tag).log_output = false; } -#line 2574 "gram.c" /* yacc.c:1652 */ +#line 2581 "gram.c" /* yacc.c:1652 */ break; case 103: -#line 814 "gram.y" /* yacc.c:1652 */ +#line 816 "gram.y" /* yacc.c:1652 */ { (yyval.tag).follow = true; } -#line 2582 "gram.c" /* yacc.c:1652 */ +#line 2589 "gram.c" /* yacc.c:1652 */ break; case 104: -#line 817 "gram.y" /* yacc.c:1652 */ +#line 819 "gram.y" /* yacc.c:1652 */ { (yyval.tag).follow = false; } -#line 2590 "gram.c" /* yacc.c:1652 */ +#line 2597 "gram.c" /* yacc.c:1652 */ break; case 105: -#line 820 "gram.y" /* yacc.c:1652 */ +#line 822 "gram.y" /* yacc.c:1652 */ { (yyval.tag).send_mail = true; } -#line 2598 "gram.c" /* yacc.c:1652 */ +#line 2605 "gram.c" /* yacc.c:1652 */ break; case 106: -#line 823 "gram.y" /* yacc.c:1652 */ +#line 825 "gram.y" /* yacc.c:1652 */ { (yyval.tag).send_mail = false; } -#line 2606 "gram.c" /* yacc.c:1652 */ +#line 2613 "gram.c" /* yacc.c:1652 */ break; case 107: -#line 828 "gram.y" /* yacc.c:1652 */ +#line 830 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member(NULL, ALL); if ((yyval.member) == NULL) { @@ -2620,11 +2627,11 @@ yyreduce: YYERROR; } } -#line 2618 "gram.c" /* yacc.c:1652 */ +#line 2625 "gram.c" /* yacc.c:1652 */ break; case 108: -#line 835 "gram.y" /* yacc.c:1652 */ +#line 837 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member((yyvsp[0].string), ALIAS); if ((yyval.member) == NULL) { @@ -2632,11 +2639,11 @@ yyreduce: YYERROR; } } -#line 2630 "gram.c" /* yacc.c:1652 */ +#line 2637 "gram.c" /* yacc.c:1652 */ break; case 109: -#line 842 "gram.y" /* yacc.c:1652 */ +#line 844 "gram.y" /* yacc.c:1652 */ { struct sudo_command *c; @@ -2651,112 +2658,148 @@ yyreduce: YYERROR; } } -#line 2649 "gram.c" /* yacc.c:1652 */ +#line 2656 "gram.c" /* yacc.c:1652 */ break; case 112: -#line 862 "gram.y" /* yacc.c:1652 */ +#line 864 "gram.y" /* yacc.c:1652 */ + { + alias_line = this_lineno; + alias_column = sudolinebuf.toke_start + 1; + } +#line 2665 "gram.c" /* yacc.c:1652 */ + break; + + case 113: +#line 867 "gram.y" /* yacc.c:1652 */ { const char *s; - s = alias_add(&parsed_policy, (yyvsp[-2].string), HOSTALIAS, - sudoers, this_lineno, (yyvsp[0].member)); + s = alias_add(&parsed_policy, (yyvsp[-3].string), HOSTALIAS, + sudoers, alias_line, alias_column, (yyvsp[0].member)); if (s != NULL) { sudoerserror(s); YYERROR; } } -#line 2663 "gram.c" /* yacc.c:1652 */ +#line 2679 "gram.c" /* yacc.c:1652 */ break; - case 115: -#line 875 "gram.y" /* yacc.c:1652 */ + case 116: +#line 880 "gram.y" /* yacc.c:1652 */ { HLTQ_CONCAT((yyvsp[-2].member), (yyvsp[0].member), entries); (yyval.member) = (yyvsp[-2].member); } -#line 2672 "gram.c" /* yacc.c:1652 */ +#line 2688 "gram.c" /* yacc.c:1652 */ break; - case 118: -#line 885 "gram.y" /* yacc.c:1652 */ + case 119: +#line 890 "gram.y" /* yacc.c:1652 */ + { + alias_line = this_lineno; + alias_column = sudolinebuf.toke_start + 1; + } +#line 2697 "gram.c" /* yacc.c:1652 */ + break; + + case 120: +#line 893 "gram.y" /* yacc.c:1652 */ { const char *s; - s = alias_add(&parsed_policy, (yyvsp[-2].string), CMNDALIAS, - sudoers, this_lineno, (yyvsp[0].member)); + s = alias_add(&parsed_policy, (yyvsp[-3].string), CMNDALIAS, + sudoers, alias_line, alias_column, (yyvsp[0].member)); if (s != NULL) { sudoerserror(s); YYERROR; } } -#line 2686 "gram.c" /* yacc.c:1652 */ +#line 2711 "gram.c" /* yacc.c:1652 */ break; - case 121: -#line 898 "gram.y" /* yacc.c:1652 */ + case 123: +#line 906 "gram.y" /* yacc.c:1652 */ { HLTQ_CONCAT((yyvsp[-2].member), (yyvsp[0].member), entries); (yyval.member) = (yyvsp[-2].member); } -#line 2695 "gram.c" /* yacc.c:1652 */ +#line 2720 "gram.c" /* yacc.c:1652 */ break; - case 124: -#line 908 "gram.y" /* yacc.c:1652 */ + case 126: +#line 916 "gram.y" /* yacc.c:1652 */ + { + alias_line = this_lineno; + alias_column = sudolinebuf.toke_start + 1; + } +#line 2729 "gram.c" /* yacc.c:1652 */ + break; + + case 127: +#line 919 "gram.y" /* yacc.c:1652 */ { const char *s; - s = alias_add(&parsed_policy, (yyvsp[-2].string), RUNASALIAS, - sudoers, this_lineno, (yyvsp[0].member)); + s = alias_add(&parsed_policy, (yyvsp[-3].string), RUNASALIAS, + sudoers, alias_line, alias_column, (yyvsp[0].member)); if (s != NULL) { sudoerserror(s); YYERROR; } } -#line 2709 "gram.c" /* yacc.c:1652 */ - break; - - case 128: -#line 924 "gram.y" /* yacc.c:1652 */ - { - const char *s; - s = alias_add(&parsed_policy, (yyvsp[-2].string), USERALIAS, - sudoers, this_lineno, (yyvsp[0].member)); - if (s != NULL) { - sudoerserror(s); - YYERROR; - } - } -#line 2723 "gram.c" /* yacc.c:1652 */ +#line 2743 "gram.c" /* yacc.c:1652 */ break; case 131: -#line 937 "gram.y" /* yacc.c:1652 */ +#line 935 "gram.y" /* yacc.c:1652 */ + { + alias_line = this_lineno; + alias_column = sudolinebuf.toke_start + 1; + } +#line 2752 "gram.c" /* yacc.c:1652 */ + break; + + case 132: +#line 938 "gram.y" /* yacc.c:1652 */ + { + const char *s; + s = alias_add(&parsed_policy, (yyvsp[-3].string), USERALIAS, + sudoers, alias_line, alias_column, (yyvsp[0].member)); + if (s != NULL) { + sudoerserror(s); + YYERROR; + } + } +#line 2766 "gram.c" /* yacc.c:1652 */ + break; + + case 135: +#line 951 "gram.y" /* yacc.c:1652 */ { HLTQ_CONCAT((yyvsp[-2].member), (yyvsp[0].member), entries); (yyval.member) = (yyvsp[-2].member); } -#line 2732 "gram.c" /* yacc.c:1652 */ +#line 2775 "gram.c" /* yacc.c:1652 */ break; - case 132: -#line 943 "gram.y" /* yacc.c:1652 */ + case 136: +#line 957 "gram.y" /* yacc.c:1652 */ { (yyval.member) = (yyvsp[0].member); (yyval.member)->negated = false; } -#line 2741 "gram.c" /* yacc.c:1652 */ +#line 2784 "gram.c" /* yacc.c:1652 */ break; - case 133: -#line 947 "gram.y" /* yacc.c:1652 */ + case 137: +#line 961 "gram.y" /* yacc.c:1652 */ { (yyval.member) = (yyvsp[0].member); (yyval.member)->negated = true; } -#line 2750 "gram.c" /* yacc.c:1652 */ +#line 2793 "gram.c" /* yacc.c:1652 */ break; - case 134: -#line 953 "gram.y" /* yacc.c:1652 */ + case 138: +#line 967 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member((yyvsp[0].string), ALIAS); if ((yyval.member) == NULL) { @@ -2764,11 +2807,11 @@ yyreduce: YYERROR; } } -#line 2762 "gram.c" /* yacc.c:1652 */ +#line 2805 "gram.c" /* yacc.c:1652 */ break; - case 135: -#line 960 "gram.y" /* yacc.c:1652 */ + case 139: +#line 974 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member(NULL, ALL); if ((yyval.member) == NULL) { @@ -2776,11 +2819,11 @@ yyreduce: YYERROR; } } -#line 2774 "gram.c" /* yacc.c:1652 */ +#line 2817 "gram.c" /* yacc.c:1652 */ break; - case 136: -#line 967 "gram.y" /* yacc.c:1652 */ + case 140: +#line 981 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member((yyvsp[0].string), NETGROUP); if ((yyval.member) == NULL) { @@ -2788,11 +2831,11 @@ yyreduce: YYERROR; } } -#line 2786 "gram.c" /* yacc.c:1652 */ +#line 2829 "gram.c" /* yacc.c:1652 */ break; - case 137: -#line 974 "gram.y" /* yacc.c:1652 */ + case 141: +#line 988 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member((yyvsp[0].string), USERGROUP); if ((yyval.member) == NULL) { @@ -2800,11 +2843,11 @@ yyreduce: YYERROR; } } -#line 2798 "gram.c" /* yacc.c:1652 */ +#line 2841 "gram.c" /* yacc.c:1652 */ break; - case 138: -#line 981 "gram.y" /* yacc.c:1652 */ + case 142: +#line 995 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member((yyvsp[0].string), WORD); if ((yyval.member) == NULL) { @@ -2812,38 +2855,38 @@ yyreduce: YYERROR; } } -#line 2810 "gram.c" /* yacc.c:1652 */ +#line 2853 "gram.c" /* yacc.c:1652 */ break; - case 140: -#line 991 "gram.y" /* yacc.c:1652 */ + case 144: +#line 1005 "gram.y" /* yacc.c:1652 */ { HLTQ_CONCAT((yyvsp[-2].member), (yyvsp[0].member), entries); (yyval.member) = (yyvsp[-2].member); } -#line 2819 "gram.c" /* yacc.c:1652 */ +#line 2862 "gram.c" /* yacc.c:1652 */ break; - case 141: -#line 997 "gram.y" /* yacc.c:1652 */ + case 145: +#line 1011 "gram.y" /* yacc.c:1652 */ { (yyval.member) = (yyvsp[0].member); (yyval.member)->negated = false; } -#line 2828 "gram.c" /* yacc.c:1652 */ +#line 2871 "gram.c" /* yacc.c:1652 */ break; - case 142: -#line 1001 "gram.y" /* yacc.c:1652 */ + case 146: +#line 1015 "gram.y" /* yacc.c:1652 */ { (yyval.member) = (yyvsp[0].member); (yyval.member)->negated = true; } -#line 2837 "gram.c" /* yacc.c:1652 */ +#line 2880 "gram.c" /* yacc.c:1652 */ break; - case 143: -#line 1007 "gram.y" /* yacc.c:1652 */ + case 147: +#line 1021 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member((yyvsp[0].string), ALIAS); if ((yyval.member) == NULL) { @@ -2851,11 +2894,11 @@ yyreduce: YYERROR; } } -#line 2849 "gram.c" /* yacc.c:1652 */ +#line 2892 "gram.c" /* yacc.c:1652 */ break; - case 144: -#line 1014 "gram.y" /* yacc.c:1652 */ + case 148: +#line 1028 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member(NULL, ALL); if ((yyval.member) == NULL) { @@ -2863,11 +2906,11 @@ yyreduce: YYERROR; } } -#line 2861 "gram.c" /* yacc.c:1652 */ +#line 2904 "gram.c" /* yacc.c:1652 */ break; - case 145: -#line 1021 "gram.y" /* yacc.c:1652 */ + case 149: +#line 1035 "gram.y" /* yacc.c:1652 */ { (yyval.member) = new_member((yyvsp[0].string), WORD); if ((yyval.member) == NULL) { @@ -2875,11 +2918,11 @@ yyreduce: YYERROR; } } -#line 2873 "gram.c" /* yacc.c:1652 */ +#line 2916 "gram.c" /* yacc.c:1652 */ break; -#line 2877 "gram.c" /* yacc.c:1652 */ +#line 2920 "gram.c" /* yacc.c:1652 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -3110,7 +3153,7 @@ yyreturn: #endif return yyresult; } -#line 1029 "gram.y" /* yacc.c:1918 */ +#line 1043 "gram.y" /* yacc.c:1918 */ void sudoerserror(const char *s) @@ -3180,7 +3223,8 @@ new_default(char *var, char *val, short op) /* d->type = 0; */ d->op = op; /* d->binding = NULL */ - d->lineno = this_lineno; + d->line = this_lineno; + d->column = sudolinebuf.toke_start + 1; d->file = rcstr_addref(sudoers); HLTQ_INIT(d, entries); @@ -3307,7 +3351,8 @@ add_userspec(struct member *members, struct privilege *privs) "unable to allocate memory"); debug_return_bool(false); } - u->lineno = this_lineno; + u->line = this_lineno; + u->column = sudolinebuf.toke_start + 1; u->file = rcstr_addref(sudoers); HLTQ_TO_TAILQ(&u->users, members, entries); HLTQ_TO_TAILQ(&u->privileges, privs, entries); diff --git a/plugins/sudoers/gram.h b/plugins/sudoers/gram.h index debe7340d..c189b71a5 100644 --- a/plugins/sudoers/gram.h +++ b/plugins/sudoers/gram.h @@ -158,7 +158,7 @@ extern int sudoersdebug; union YYSTYPE { -#line 77 "gram.y" /* yacc.c:1921 */ +#line 79 "gram.y" /* yacc.c:1921 */ struct cmndspec *cmndspec; struct defaults *defaults; diff --git a/plugins/sudoers/gram.y b/plugins/sudoers/gram.y index 0d4f8be93..584cf60d3 100644 --- a/plugins/sudoers/gram.y +++ b/plugins/sudoers/gram.y @@ -54,6 +54,8 @@ bool parse_error = false; int errorlineno = -1; char *errorfile = NULL; +static int alias_line, alias_column; + struct sudoers_parse_tree parsed_policy = { TAILQ_HEAD_INITIALIZER(parsed_policy.userspecs), TAILQ_HEAD_INITIALIZER(parsed_policy.defaults), @@ -859,10 +861,13 @@ hostaliases : hostalias | hostaliases ':' hostalias ; -hostalias : ALIAS '=' hostlist { +hostalias : ALIAS { + alias_line = this_lineno; + alias_column = sudolinebuf.toke_start + 1; + } '=' hostlist { const char *s; s = alias_add(&parsed_policy, $1, HOSTALIAS, - sudoers, this_lineno, $3); + sudoers, alias_line, alias_column, $4); if (s != NULL) { sudoerserror(s); YYERROR; @@ -882,10 +887,13 @@ cmndaliases : cmndalias | cmndaliases ':' cmndalias ; -cmndalias : ALIAS '=' cmndlist { +cmndalias : ALIAS { + alias_line = this_lineno; + alias_column = sudolinebuf.toke_start + 1; + } '=' cmndlist { const char *s; s = alias_add(&parsed_policy, $1, CMNDALIAS, - sudoers, this_lineno, $3); + sudoers, alias_line, alias_column, $4); if (s != NULL) { sudoerserror(s); YYERROR; @@ -905,10 +913,13 @@ runasaliases : runasalias | runasaliases ':' runasalias ; -runasalias : ALIAS '=' userlist { +runasalias : ALIAS { + alias_line = this_lineno; + alias_column = sudolinebuf.toke_start + 1; + } '=' userlist { const char *s; s = alias_add(&parsed_policy, $1, RUNASALIAS, - sudoers, this_lineno, $3); + sudoers, alias_line, alias_column, $4); if (s != NULL) { sudoerserror(s); YYERROR; @@ -921,10 +932,13 @@ useraliases : useralias | useraliases ':' useralias ; -useralias : ALIAS '=' userlist { +useralias : ALIAS { + alias_line = this_lineno; + alias_column = sudolinebuf.toke_start + 1; + } '=' userlist { const char *s; s = alias_add(&parsed_policy, $1, USERALIAS, - sudoers, this_lineno, $3); + sudoers, alias_line, alias_column, $4); if (s != NULL) { sudoerserror(s); YYERROR; @@ -1095,7 +1109,8 @@ new_default(char *var, char *val, short op) /* d->type = 0; */ d->op = op; /* d->binding = NULL */ - d->lineno = this_lineno; + d->line = this_lineno; + d->column = sudolinebuf.toke_start + 1; d->file = rcstr_addref(sudoers); HLTQ_INIT(d, entries); @@ -1222,7 +1237,8 @@ add_userspec(struct member *members, struct privilege *privs) "unable to allocate memory"); debug_return_bool(false); } - u->lineno = this_lineno; + u->line = this_lineno; + u->column = sudolinebuf.toke_start + 1; u->file = rcstr_addref(sudoers); HLTQ_TO_TAILQ(&u->users, members, entries); HLTQ_TO_TAILQ(&u->privileges, privs, entries); diff --git a/plugins/sudoers/parse.c b/plugins/sudoers/parse.c index dcb0be4a6..8236cde82 100644 --- a/plugins/sudoers/parse.c +++ b/plugins/sudoers/parse.c @@ -165,8 +165,8 @@ sudoers_lookup_check(struct sudo_nss *nss, struct passwd *pw, *matching_cs = cs; *defs = &priv->defaults; sudo_debug_printf(SUDO_DEBUG_DEBUG|SUDO_DEBUG_LINENO, - "userspec matched @ %s:%d: %s", - us->file ? us->file : "???", us->lineno, + "userspec matched @ %s:%d:%d: %s", + us->file ? us->file : "???", us->line, us->column, cmnd_match ? "allowed" : "denied"); debug_return_int(cmnd_match); } diff --git a/plugins/sudoers/parse.h b/plugins/sudoers/parse.h index 31e143bc7..171b2cd40 100644 --- a/plugins/sudoers/parse.h +++ b/plugins/sudoers/parse.h @@ -176,7 +176,8 @@ struct userspec { struct member_list users; /* list of users */ struct privilege_list privileges; /* list of privileges */ struct comment_list comments; /* optional comments */ - int lineno; /* line number in sudoers */ + int line; /* line number in sudoers */ + int column; /* column number in sudoers */ char *file; /* name of sudoers file */ }; @@ -252,7 +253,8 @@ struct alias { char *name; /* alias name */ unsigned short type; /* {USER,HOST,RUNAS,CMND}ALIAS */ short used; /* "used" flag for cycle detection */ - int lineno; /* line number of alias entry */ + int line; /* line number of alias entry */ + int column; /* column number of alias entry */ char *file; /* file the alias entry was in */ struct member_list members; /* list of alias members */ }; @@ -269,7 +271,8 @@ struct defaults { short type; /* DEFAULTS{,_USER,_RUNAS,_HOST} */ char op; /* true, false, '+', '-' */ char error; /* parse error flag */ - int lineno; /* line number of Defaults entry */ + int line; /* line number of Defaults entry */ + int column; /* column number of Defaults entry */ }; /* @@ -295,7 +298,7 @@ struct cmnd_info { struct rbtree *alloc_aliases(void); void free_aliases(struct rbtree *aliases); bool no_aliases(struct sudoers_parse_tree *parse_tree); -const char *alias_add(struct sudoers_parse_tree *parse_tree, char *name, int type, char *file, int lineno, struct member *members); +const char *alias_add(struct sudoers_parse_tree *parse_tree, char *name, int type, char *file, int line, int column, struct member *members); const char *alias_type_to_string(int alias_type); struct alias *alias_get(struct sudoers_parse_tree *parse_tree, const char *name, int type); struct alias *alias_remove(struct sudoers_parse_tree *parse_tree, char *name, int type); diff --git a/plugins/sudoers/regress/sudoers/test18.toke.ok b/plugins/sudoers/regress/sudoers/test18.toke.ok index 56bbdef14..78e9ba6fa 100644 --- a/plugins/sudoers/regress/sudoers/test18.toke.ok +++ b/plugins/sudoers/regress/sudoers/test18.toke.ok @@ -6,5 +6,5 @@ WORD(6) ALL = CMND_TIMEOUT = WORD(6) <*> COMMAND WORD(6) ALL = CMND_TIMEOUT = WORD(6) <*> COMMAND WORD(6) ALL = CMND_TIMEOUT = WORD(6) <*> COMMAND WORD(6) ALL = CMND_TIMEOUT = WORD(6) <*> COMMAND -testsudoers: sudoers:2: value "2d8h10m59ss" is invalid for option "command_timeout" -testsudoers: sudoers:3: value "15f" is invalid for option "command_timeout" +testsudoers: sudoers:2:26: value "2d8h10m59ss" is invalid for option "command_timeout" +testsudoers: sudoers:3:31: value "15f" is invalid for option "command_timeout" diff --git a/plugins/sudoers/regress/sudoers/test2.ldif.ok b/plugins/sudoers/regress/sudoers/test2.ldif.ok index a9e7df921..48ba6551c 100644 --- a/plugins/sudoers/regress/sudoers/test2.ldif.ok +++ b/plugins/sudoers/regress/sudoers/test2.ldif.ok @@ -1,28 +1,28 @@ -# Unable to translate stdin:26 +# Unable to translate stdin:26:29: # Defaults@somehost set_home -# Unable to translate stdin:27 +# Unable to translate stdin:27:29: # Defaults@quoted\" set_home -# Unable to translate stdin:30 +# Unable to translate stdin:30:24: # Defaults:you set_home -# Unable to translate stdin:31 +# Unable to translate stdin:31:25: # Defaults:us\" set_home -# Unable to translate stdin:32 +# Unable to translate stdin:32:26: # Defaults:%them set_home -# Unable to translate stdin:33 +# Unable to translate stdin:33:36: # Defaults:"%: non UNIX 0 c" set_home -# Unable to translate stdin:34 +# Unable to translate stdin:34:25: # Defaults:+net set_home -# Unable to translate stdin:37 +# Unable to translate stdin:37:28: # Defaults>someone set_home -# Unable to translate stdin:38 +# Unable to translate stdin:38:29: # Defaults>"some one" set_home dn: cn=foo,ou=SUDOers,dc=sudo,dc=ws diff --git a/plugins/sudoers/regress/sudoers/test3.ldif.ok b/plugins/sudoers/regress/sudoers/test3.ldif.ok index 0aa54be86..783cde591 100644 --- a/plugins/sudoers/regress/sudoers/test3.ldif.ok +++ b/plugins/sudoers/regress/sudoers/test3.ldif.ok @@ -1,12 +1,12 @@ -# Unable to translate stdin:3 +# Unable to translate stdin:3:23: # Defaults:foo, bar env_reset -# Unable to translate stdin:4 +# Unable to translate stdin:4:27: # Defaults:foo, bar env_reset -# Unable to translate stdin:5 +# Unable to translate stdin:5:29: # Defaults:foo, " bar" env_reset -# Unable to translate stdin:6 +# Unable to translate stdin:6:28: # Defaults:foo, bar env_reset diff --git a/plugins/sudoers/regress/sudoers/test6.ldif.ok b/plugins/sudoers/regress/sudoers/test6.ldif.ok index c4e11e4ff..046b3340a 100644 --- a/plugins/sudoers/regress/sudoers/test6.ldif.ok +++ b/plugins/sudoers/regress/sudoers/test6.ldif.ok @@ -1,13 +1,13 @@ -# Unable to translate stdin:2 +# Unable to translate stdin:2:23: # Defaults:#123 set_home -# Unable to translate stdin:3 +# Unable to translate stdin:3:23: # Defaults>#123 set_home -# Unable to translate stdin:4 +# Unable to translate stdin:4:25: # Defaults:#123 set_home -# Unable to translate stdin:5 +# Unable to translate stdin:5:25: # Defaults>#123 set_home dn: cn=\#0,ou=SUDOers,dc=sudo,dc=ws diff --git a/plugins/sudoers/regress/visudo/test2.err.ok b/plugins/sudoers/regress/visudo/test2.err.ok index d101a103c..e6a275df1 100644 --- a/plugins/sudoers/regress/visudo/test2.err.ok +++ b/plugins/sudoers/regress/visudo/test2.err.ok @@ -1 +1 @@ -Error: stdin:1: cycle in User_Alias "FOO" +Error: stdin:1:12: cycle in User_Alias "FOO" diff --git a/plugins/sudoers/regress/visudo/test3.err.ok b/plugins/sudoers/regress/visudo/test3.err.ok index af3a983d3..38fe9b85a 100644 --- a/plugins/sudoers/regress/visudo/test3.err.ok +++ b/plugins/sudoers/regress/visudo/test3.err.ok @@ -1,2 +1,2 @@ -Warning: stdin:1: unused User_Alias "A" -Warning: stdin:2: unused User_Alias "B" +Warning: stdin:1:12: unused User_Alias "A" +Warning: stdin:2:12: unused User_Alias "B" diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index 93fc1cff1..e09297bb9 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -564,7 +564,7 @@ check_defaults_and_aliases(bool strict, bool quiet) if (d->error) { /* Defaults parse error, set errorfile/errorlineno. */ errorfile = rcstr_addref(d->file); - errorlineno = d->lineno; + errorlineno = d->line; break; } } @@ -1067,7 +1067,8 @@ open_sudoers(const char *path, bool doedit, bool *keepopen) } static int -check_alias(char *name, int type, char *file, int lineno, bool strict, bool quiet) +check_alias(char *name, int type, char *file, int line, int column, + bool strict, bool quiet) { struct member *m; struct alias *a; @@ -1079,26 +1080,27 @@ check_alias(char *name, int type, char *file, int lineno, bool strict, bool quie TAILQ_FOREACH(m, &a->members, entries) { if (m->type != ALIAS) continue; - errors += check_alias(m->name, type, a->file, a->lineno, strict, quiet); + errors += check_alias(m->name, type, a->file, a->line, a->column, + strict, quiet); } alias_put(a); } else { if (!quiet) { if (errno == ELOOP) { fprintf(stderr, strict ? - U_("Error: %s:%d: cycle in %s \"%s\"") : - U_("Warning: %s:%d: cycle in %s \"%s\""), - file, lineno, alias_type_to_string(type), name); + U_("Error: %s:%d:%d: cycle in %s \"%s\"") : + U_("Warning: %s:%d:%d: cycle in %s \"%s\""), + file, line, column, alias_type_to_string(type), name); } else { fprintf(stderr, strict ? - U_("Error: %s:%d: %s \"%s\" referenced but not defined") : - U_("Warning: %s:%d: %s \"%s\" referenced but not defined"), - file, lineno, alias_type_to_string(type), name); + U_("Error: %s:%d:%d: %s \"%s\" referenced but not defined") : + U_("Warning: %s:%d:%d: %s \"%s\" referenced but not defined"), + file, line, column, alias_type_to_string(type), name); } fputc('\n', stderr); if (strict && errorfile == NULL) { errorfile = rcstr_addref(file); - errorlineno = lineno; + errorlineno = line; } } errors++; @@ -1133,14 +1135,14 @@ check_aliases(bool strict, bool quiet) TAILQ_FOREACH(m, &us->users, entries) { if (m->type == ALIAS) { errors += check_alias(m->name, USERALIAS, - us->file, us->lineno, strict, quiet); + us->file, us->line, us->column, strict, quiet); } } TAILQ_FOREACH(priv, &us->privileges, entries) { TAILQ_FOREACH(m, &priv->hostlist, entries) { if (m->type == ALIAS) { errors += check_alias(m->name, HOSTALIAS, - us->file, us->lineno, strict, quiet); + us->file, us->line, us->column, strict, quiet); } } TAILQ_FOREACH(cs, &priv->cmndlist, entries) { @@ -1148,7 +1150,7 @@ check_aliases(bool strict, bool quiet) TAILQ_FOREACH(m, cs->runasuserlist, entries) { if (m->type == ALIAS) { errors += check_alias(m->name, RUNASALIAS, - us->file, us->lineno, strict, quiet); + us->file, us->line, us->column, strict, quiet); } } } @@ -1156,13 +1158,13 @@ check_aliases(bool strict, bool quiet) TAILQ_FOREACH(m, cs->runasgrouplist, entries) { if (m->type == ALIAS) { errors += check_alias(m->name, RUNASALIAS, - us->file, us->lineno, strict, quiet); + us->file, us->line, us->column, strict, quiet); } } } if ((m = cs->cmnd)->type == ALIAS) { errors += check_alias(m->name, CMNDALIAS, - us->file, us->lineno, strict, quiet); + us->file, us->line, us->column, strict, quiet); } } } @@ -1183,8 +1185,8 @@ check_aliases(bool strict, bool quiet) static int print_unused(struct sudoers_parse_tree *parse_tree, struct alias *a, void *v) { - fprintf(stderr, U_("Warning: %s:%d: unused %s \"%s\""), - a->file, a->lineno, alias_type_to_string(a->type), a->name); + fprintf(stderr, U_("Warning: %s:%d:%d: unused %s \"%s\""), + a->file, a->line, a->column, alias_type_to_string(a->type), a->name); fputc('\n', stderr); return 0; }