diff options
Diffstat (limited to 'plugins/sudoers/toke.l')
-rw-r--r-- | plugins/sudoers/toke.l | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/sudoers/toke.l b/plugins/sudoers/toke.l index c843162d3..2f062ff12 100644 --- a/plugins/sudoers/toke.l +++ b/plugins/sudoers/toke.l @@ -1367,8 +1367,9 @@ sudoers_trace_print(const char *msg) sudo_lbuf_append(&trace_lbuf, "%s", msg); if (strchr(msg, '\n') != NULL) { + /* We already parsed the newline so sudolineno is off by one. */ sudo_debug_printf2(NULL, NULL, 0, SUDOERS_DEBUG_PARSER|SUDO_DEBUG_DEBUG, - "%s:%d: %s", sudoers, sudolineno, trace_lbuf.buf); + "sudoerslex: %s:%d: %s", sudoers, sudolineno - 1, trace_lbuf.buf); trace_lbuf.len = 0; } return 0; @@ -1386,6 +1387,7 @@ sudoers_input(char *buf, yy_size_t max_size) { char *cp; size_t avail = sudolinebuf.len - sudolinebuf.off; + debug_decl(sudoers_input, SUDOERS_DEBUG_PARSER); /* Refill line buffer if needed. */ if (avail == 0) { @@ -1430,6 +1432,9 @@ sudoers_eof: sudolinebuf.buf[avail] = '\0'; } + sudo_debug_printf(SUDO_DEBUG_DEBUG, "%s:%d: %.*s", sudoers, sudolineno, + (int)(avail -1), sudolinebuf.buf); + sudolinebuf.len = avail; sudolinebuf.off = 0; sudolinebuf.toke_start = sudolinebuf.toke_end = 0; @@ -1440,5 +1445,5 @@ sudoers_eof: memcpy(buf, sudolinebuf.buf + sudolinebuf.off, avail); sudolinebuf.off += avail; - return avail; + debug_return_size_t(avail); } |