2011-01-08 15:42:39 -05:00
|
|
|
/*
|
2019-04-29 07:21:51 -06:00
|
|
|
* SPDX-License-Identifier: ISC
|
|
|
|
*
|
2023-05-09 14:01:41 -06:00
|
|
|
* Copyright (c) 2011-2013, 2015-2016, 2020-2023
|
|
|
|
* Todd C. Miller <Todd.Miller@sudo.ws>
|
2011-01-08 15:42:39 -05:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2015-05-21 11:13:20 -06:00
|
|
|
#ifndef SUDOERS_TOKE_H
|
|
|
|
#define SUDOERS_TOKE_H
|
2011-01-08 15:42:39 -05:00
|
|
|
|
2020-08-06 21:16:35 -06:00
|
|
|
struct sudolinebuf {
|
|
|
|
char *buf; /* line buffer */
|
|
|
|
size_t size; /* size of buffer */
|
|
|
|
size_t len; /* used length */
|
|
|
|
size_t off; /* consumed length */
|
2020-08-07 14:13:25 -06:00
|
|
|
size_t toke_start; /* starting column of current token */
|
|
|
|
size_t toke_end; /* ending column of current token */
|
2020-08-06 21:16:35 -06:00
|
|
|
};
|
2023-05-09 14:01:41 -06:00
|
|
|
|
2022-02-11 12:01:31 -07:00
|
|
|
extern const char *sudoers_errstr;
|
2020-08-06 21:16:35 -06:00
|
|
|
extern struct sudolinebuf sudolinebuf;
|
2023-05-09 14:01:41 -06:00
|
|
|
extern int sudolineno;
|
|
|
|
extern char *sudoers_search_path;
|
2020-08-06 21:16:35 -06:00
|
|
|
|
2023-09-09 14:06:11 -06:00
|
|
|
struct sudoers_parser_config;
|
2023-07-07 15:07:04 -06:00
|
|
|
bool append(const char *, int);
|
|
|
|
bool fill_args(const char *, int, bool);
|
|
|
|
bool fill_cmnd(const char *, int);
|
|
|
|
bool fill(const char *, int);
|
2023-05-09 14:01:41 -06:00
|
|
|
void init_lexer(void);
|
2011-12-02 11:27:33 -05:00
|
|
|
bool ipv6_valid(const char *s);
|
2020-05-20 13:10:53 -06:00
|
|
|
int sudoers_trace_print(const char *);
|
2022-09-07 07:48:31 -06:00
|
|
|
void sudoerserrorf(const char *, ...) sudo_printf0like(1, 2);
|
2012-09-14 16:19:25 -04:00
|
|
|
void sudoerserror(const char *);
|
2023-09-09 14:06:11 -06:00
|
|
|
bool push_include(const char *, const char *, struct sudoers_parser_config *);
|
|
|
|
bool push_includedir(const char *, const char *, struct sudoers_parser_config *);
|
2011-01-08 15:42:39 -05:00
|
|
|
|
2011-03-21 12:39:06 -04:00
|
|
|
#ifndef FLEX_SCANNER
|
|
|
|
extern int (*trace_print)(const char *msg);
|
|
|
|
#endif
|
|
|
|
|
2011-10-22 14:40:21 -04:00
|
|
|
#define LEXTRACE(msg) do { \
|
|
|
|
if (trace_print != NULL) \
|
|
|
|
(*trace_print)(msg); \
|
2011-03-21 12:39:06 -04:00
|
|
|
} while (0);
|
|
|
|
|
2015-05-21 11:13:20 -06:00
|
|
|
#endif /* SUDOERS_TOKE_H */
|