2011-01-08 15:42:39 -05:00
|
|
|
/*
|
2019-04-29 07:21:51 -06:00
|
|
|
* SPDX-License-Identifier: ISC
|
|
|
|
*
|
2020-08-06 21:16:35 -06:00
|
|
|
* Copyright (c) 2011-2013, 2015-2016, 2020 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
|
|
|
};
|
2021-02-08 13:43:49 -07:00
|
|
|
extern char *sudoers_errstr;
|
2020-08-06 21:16:35 -06:00
|
|
|
extern struct sudolinebuf sudolinebuf;
|
|
|
|
|
2015-11-22 09:22:38 -07:00
|
|
|
bool append(const char *, size_t);
|
|
|
|
bool fill_args(const char *, size_t, int);
|
|
|
|
bool fill_cmnd(const char *, size_t);
|
2021-02-03 12:57:04 -07:00
|
|
|
bool fill(const char *, size_t);
|
2011-12-02 11:27:33 -05:00
|
|
|
bool ipv6_valid(const char *s);
|
2022-02-10 18:26:24 -07:00
|
|
|
bool regex_valid(const char *pattern, char **errstr);
|
2020-05-20 13:10:53 -06:00
|
|
|
int sudoers_trace_print(const char *);
|
2020-11-14 06:17:41 -07:00
|
|
|
void sudoerserrorf(const char *, ...) __printf0like(1, 2);
|
2012-09-14 16:19:25 -04:00
|
|
|
void sudoerserror(const char *);
|
2020-05-20 13:10:53 -06:00
|
|
|
bool push_include(const char *, bool);
|
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 */
|