static struct search_node_list search_expr = STAILQ_HEAD_INITIALIZER(search_expr);
+static int sudoreplay_debug_instance = SUDO_DEBUG_INSTANCE_INITIALIZER;
+
static int timing_idx_adj;
static double speed_factor = 1.0;
char *cp, *ep, path[PATH_MAX];
struct log_info *li;
double max_wait = 0;
- debug_decl(main, SUDO_DEBUG_MAIN, SUDO_DEBUG_INSTANCE_DEFAULT)
+ debug_decl(main, SUDO_DEBUG_MAIN, sudoreplay_debug_instance)
#if defined(SUDO_DEVEL) && defined(__OpenBSD__)
{
/* Read sudo.conf. */
sudo_conf_read(NULL);
+ /* Set debug instance to use (if configured). */
+ sudoreplay_debug_instance = sudo_debug_get_instance(getprogname());
+
while ((ch = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) {
switch (ch) {
case 'd':
char buf[LINE_MAX];
sigaction_t sa;
int idx;
- debug_decl(replay_session, SUDO_DEBUG_UTIL, SUDO_DEBUG_INSTANCE_DEFAULT)
+ debug_decl(replay_session, SUDO_DEBUG_UTIL, sudoreplay_debug_instance)
/* Restore tty settings if interupted. */
fflush(stdout);
static int
open_io_fd(char *path, int len, struct io_log_file *iol)
{
- debug_decl(open_io_fd, SUDO_DEBUG_UTIL, SUDO_DEBUG_INSTANCE_DEFAULT)
+ debug_decl(open_io_fd, SUDO_DEBUG_UTIL, sudoreplay_debug_instance)
if (!iol->enabled)
debug_return_int(0);
ssize_t nwritten;
size_t count, remainder;
unsigned int i;
- debug_decl(write_output, SUDO_DEBUG_UTIL, SUDO_DEBUG_INSTANCE_DEFAULT)
+ debug_decl(write_output, SUDO_DEBUG_UTIL, sudoreplay_debug_instance)
nwritten = writev(STDOUT_FILENO, wc->iov, wc->iovcnt);
switch (nwritten) {
bool or = false, not = false;
struct search_node *sn;
char type, **av;
- debug_decl(parse_expr, SUDO_DEBUG_UTIL, SUDO_DEBUG_INSTANCE_DEFAULT)
+ debug_decl(parse_expr, SUDO_DEBUG_UTIL, sudoreplay_debug_instance)
for (av = argv; *av != NULL; av++) {
switch (av[0][0]) {
struct search_node *sn;
bool res, matched = last_match;
int rc;
- debug_decl(match_expr, SUDO_DEBUG_UTIL, SUDO_DEBUG_INSTANCE_DEFAULT)
+ debug_decl(match_expr, SUDO_DEBUG_UTIL, sudoreplay_debug_instance)
STAILQ_FOREACH(sn, head, entries) {
switch (sn->type) {
const char *errstr;
size_t bufsize = 0, cwdsize = 0, cmdsize = 0;
struct log_info *li = NULL;
- debug_decl(parse_logfile, SUDO_DEBUG_UTIL, SUDO_DEBUG_INSTANCE_DEFAULT)
+ debug_decl(parse_logfile, SUDO_DEBUG_UTIL, sudoreplay_debug_instance)
fp = fopen(logfile, "r");
if (fp == NULL) {
const char *timestr;
struct log_info *li;
int rval = -1;
- debug_decl(list_session, SUDO_DEBUG_UTIL, SUDO_DEBUG_INSTANCE_DEFAULT)
+ debug_decl(list_session, SUDO_DEBUG_UTIL, sudoreplay_debug_instance)
if ((li = parse_logfile(logfile)) == NULL)
goto done;
#else
const bool checked_type = false;
#endif
- debug_decl(find_sessions, SUDO_DEBUG_UTIL, SUDO_DEBUG_INSTANCE_DEFAULT)
+ debug_decl(find_sessions, SUDO_DEBUG_UTIL, sudoreplay_debug_instance)
d = opendir(dir);
if (d == NULL)
const char *tty)
{
REGEX_T rebuf, *re = NULL;
- debug_decl(list_sessions, SUDO_DEBUG_UTIL, SUDO_DEBUG_INSTANCE_DEFAULT)
+ debug_decl(list_sessions, SUDO_DEBUG_UTIL, sudoreplay_debug_instance)
/* Parse search expression if present */
parse_expr(&search_expr, argv, false);
struct timeval tv, *timeout = NULL;
static bool paused = 0;
char ch;
- debug_decl(check_input, SUDO_DEBUG_UTIL, SUDO_DEBUG_INSTANCE_DEFAULT)
+ debug_decl(check_input, SUDO_DEBUG_UTIL, sudoreplay_debug_instance)
if (ISSET(what, SUDO_EV_READ)) {
switch (read(fd, &ch, 1)) {
long l;
double d, fract = 0;
char *cp, *ep;
- debug_decl(parse_timing, SUDO_DEBUG_UTIL, SUDO_DEBUG_INSTANCE_DEFAULT)
+ debug_decl(parse_timing, SUDO_DEBUG_UTIL, sudoreplay_debug_instance)
/* Parse index */
ul = strtoul(buf, &ep, 10);
__dso_public int main(int argc, char *argv[], char *envp[]);
+int sudo_debug_instance = SUDO_DEBUG_INSTANCE_INITIALIZER;
+
static int sesh_sudoedit(int argc, char *argv[]);
/*
main(int argc, char *argv[], char *envp[])
{
int ret;
- debug_decl(main, SUDO_DEBUG_MAIN, sudo_debug_instance, SUDO_DEBUG_INSTANCE_DEFAULT)
+ debug_decl(main, SUDO_DEBUG_MAIN, sudo_debug_instance)
initprogname(argc > 0 ? argv[0] : "sesh");
/* Read sudo.conf. */
sudo_conf_read(NULL);
+ /* Set debug instance to use (if configured). */
+ sudo_debug_instance = sudo_debug_get_instance(getprogname());
+
if (strcmp(argv[1], "-e") == 0) {
ret = sesh_sudoedit(argc, argv);
} else {
struct stat sb;
struct timeval times[2];
char buf[BUFSIZ];
- debug_decl(sesh_sudoedit, SUDO_DEBUG_MAIN)
+ debug_decl(sesh_sudoedit, SUDO_DEBUG_EDIT, sudo_debug_instance)
if (argc < 3)
debug_return_int(SESH_ERR_FAILURE);