diff options
author | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-03-20 13:01:02 -0600 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-03-20 13:01:02 -0600 |
commit | e49a2f0ca2f00f8672813b8b7f6846c1bb1dc0f9 (patch) | |
tree | 41def126e28f06181dc8fcfcb94829525fa2f054 /plugins | |
parent | f3266d3e1810a7662e225575ca6648928f8b2ce1 (diff) | |
download | sudo-e49a2f0ca2f00f8672813b8b7f6846c1bb1dc0f9.tar.gz |
Split push_include() into push_include() and push_includedir().
This moves the "isdir" function argument to the internal version.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/sudoers/gram.c | 4 | ||||
-rw-r--r-- | plugins/sudoers/gram.y | 4 | ||||
-rw-r--r-- | plugins/sudoers/toke.c | 16 | ||||
-rw-r--r-- | plugins/sudoers/toke.h | 3 | ||||
-rw-r--r-- | plugins/sudoers/toke.l | 16 |
5 files changed, 34 insertions, 9 deletions
diff --git a/plugins/sudoers/gram.c b/plugins/sudoers/gram.c index 04f4f6983..13a79cc86 100644 --- a/plugins/sudoers/gram.c +++ b/plugins/sudoers/gram.c @@ -1675,7 +1675,7 @@ yyreduce: case 8: /* entry: include */ #line 218 "gram.y" { - const bool success = push_include((yyvsp[0].string), false); + const bool success = push_include((yyvsp[0].string)); parser_leak_remove(LEAK_PTR, (yyvsp[0].string)); free((yyvsp[0].string)); if (!success && !sudoers_recovery) @@ -1687,7 +1687,7 @@ yyreduce: case 9: /* entry: includedir */ #line 225 "gram.y" { - const bool success = push_include((yyvsp[0].string), true); + const bool success = push_includedir((yyvsp[0].string)); parser_leak_remove(LEAK_PTR, (yyvsp[0].string)); free((yyvsp[0].string)); if (!success && !sudoers_recovery) diff --git a/plugins/sudoers/gram.y b/plugins/sudoers/gram.y index da7960440..66c7ccad5 100644 --- a/plugins/sudoers/gram.y +++ b/plugins/sudoers/gram.y @@ -216,14 +216,14 @@ entry : '\n' { yyerrok; } | include { - const bool success = push_include($1, false); + const bool success = push_include($1); parser_leak_remove(LEAK_PTR, $1); free($1); if (!success && !sudoers_recovery) YYERROR; } | includedir { - const bool success = push_include($1, true); + const bool success = push_includedir($1); parser_leak_remove(LEAK_PTR, $1); free($1); if (!success && !sudoers_recovery) diff --git a/plugins/sudoers/toke.c b/plugins/sudoers/toke.c index aa909ca29..700579302 100644 --- a/plugins/sudoers/toke.c +++ b/plugins/sudoers/toke.c @@ -5744,8 +5744,8 @@ oflow: * A missing or insecure include dir is simply ignored. * Returns false on error, else true. */ -bool -push_include(const char *opath, bool isdir) +static bool +push_include_int(const char *opath, bool isdir) { struct path_list *pl; char *path; @@ -5851,6 +5851,18 @@ push_include(const char *opath, bool isdir) debug_return_bool(true); } +bool +push_include(const char *opath) +{ + return push_include_int(opath, false); +} + +bool +push_includedir(const char *opath) +{ + return push_include_int(opath, true); +} + /* * Restore the previous sudoers file and buffer, or, in the case * of an includedir, switch to the next file in the dir. diff --git a/plugins/sudoers/toke.h b/plugins/sudoers/toke.h index 2b9f111b2..a15715956 100644 --- a/plugins/sudoers/toke.h +++ b/plugins/sudoers/toke.h @@ -38,7 +38,8 @@ bool ipv6_valid(const char *s); int sudoers_trace_print(const char *); void sudoerserrorf(const char *, ...) sudo_printf0like(1, 2); void sudoerserror(const char *); -bool push_include(const char *, bool); +bool push_include(const char *); +bool push_includedir(const char *); #ifndef FLEX_SCANNER extern int (*trace_print)(const char *msg); diff --git a/plugins/sudoers/toke.l b/plugins/sudoers/toke.l index 9e9231672..91f00eebc 100644 --- a/plugins/sudoers/toke.l +++ b/plugins/sudoers/toke.l @@ -1197,8 +1197,8 @@ oflow: * A missing or insecure include dir is simply ignored. * Returns false on error, else true. */ -bool -push_include(const char *opath, bool isdir) +static bool +push_include_int(const char *opath, bool isdir) { struct path_list *pl; char *path; @@ -1304,6 +1304,18 @@ push_include(const char *opath, bool isdir) debug_return_bool(true); } +bool +push_include(const char *opath) +{ + return push_include_int(opath, false); +} + +bool +push_includedir(const char *opath) +{ + return push_include_int(opath, true); +} + /* * Restore the previous sudoers file and buffer, or, in the case * of an includedir, switch to the next file in the dir. |