Break sudoers transcript feature up into log_input and log_output.

This commit is contained in:
Todd C. Miller
2010-05-30 10:31:38 -04:00
parent 1a217bcc22
commit 2dd29bf64d
18 changed files with 515 additions and 444 deletions

View File

@@ -110,7 +110,7 @@ union io_fd {
};
/*
* Info present in the transcript log file
* Info present in the I/O log file
*/
struct log_info {
char *cwd;
@@ -161,7 +161,7 @@ struct search_node {
static struct search_node *node_stack[32];
static int stack_top;
static const char *session_dir = _PATH_SUDO_TRANSCRIPT;
static const char *session_dir = _PATH_SUDO_IO_LOGDIR;
static union io_fd io_fds[IOFD_MAX];
static const char *io_fnames[IOFD_MAX] = {
@@ -642,7 +642,11 @@ list_session_dir(char *pathbuf, REGEX_T *re, const char *user, const char *tty)
pathbuf[plen + 0] = '/';
pathbuf[plen + 1] = dp->d_name[0];
pathbuf[plen + 2] = dp->d_name[1];
pathbuf[plen + 3] = '\0';
pathbuf[plen + 3] = '/';
pathbuf[plen + 4] = 'l';
pathbuf[plen + 5] = 'o';
pathbuf[plen + 6] = 'g';
pathbuf[plen + 7] = '\0';
fp = fopen(pathbuf, "r");
if (fp == NULL) {
warning("unable to open %s", pathbuf);
@@ -744,6 +748,10 @@ list_sessions(int argc, char **argv, const char *pattern, const char *user,
#endif /* HAVE_REGCOMP */
sdlen = strlcpy(pathbuf, session_dir, sizeof(pathbuf));
if (sdlen + sizeof("/00/00/00/log") >= sizeof(pathbuf)) {
errno = ENAMETOOLONG;
error(1, "%s/00/00/00/log", session_dir);
}
/*
* Three levels of directory, e.g. 00/00/00 .. ZZ/ZZ/ZZ