1 /* 2 * SPDX-License-Identifier: ISC 3 * 4 * Copyright (c) 2011-2013, 2015-2016, 2020 Todd C. Miller <Todd.Miller@sudo.ws> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #ifndef SUDOERS_TOKE_H 20 #define SUDOERS_TOKE_H 21 22 struct sudolinebuf { 23 char *buf; /* line buffer */ 24 size_t size; /* size of buffer */ 25 size_t len; /* used length */ 26 size_t off; /* consumed length */ 27 size_t toke_start; /* starting column of current token */ 28 size_t toke_end; /* ending column of current token */ 29 }; 30 extern char *sudoers_errstr; 31 extern struct sudolinebuf sudolinebuf; 32 33 bool append(const char *, size_t); 34 bool fill_args(const char *, size_t, int); 35 bool fill_cmnd(const char *, size_t); 36 bool fill(const char *, size_t); 37 bool ipv6_valid(const char *s); 38 int sudoers_trace_print(const char *); 39 void sudoerserrorf(const char *, ...) __printf0like(1, 2); 40 void sudoerserror(const char *); 41 bool push_include(const char *, bool); 42 43 #ifndef FLEX_SCANNER 44 extern int (*trace_print)(const char *msg); 45 #endif 46 47 #define LEXTRACE(msg) do { \ 48 if (trace_print != NULL) \ 49 (*trace_print)(msg); \ 50 } while (0); 51 52 #endif /* SUDOERS_TOKE_H */ 53