2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-02 07:15:27 +00:00

If running a command or sudoedit in transcript mode, call io_nextid()

before log_allowed() so the session id is logged.
This commit is contained in:
Todd C. Miller
2010-05-24 14:30:54 -04:00
parent 79cb53c62c
commit 60e0e496ef
3 changed files with 4 additions and 2 deletions

View File

@@ -71,7 +71,7 @@ static sigset_t ttyblock;
static struct timeval last_time;
static union script_fd io_outfile, io_timfile;
static void
void
io_nextid(void)
{
struct stat sb;
@@ -197,7 +197,6 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
* Build a path containing the session id split into two-digit subdirs,
* so ID 000001 becomes /var/log/sudo-session/00/00/01.
*/
io_nextid();
len = build_idpath(pathbuf, sizeof(pathbuf));
if (len == -1)
return -1;

View File

@@ -497,6 +497,8 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
validate_env_vars(sudo_user.env_vars);
}
if (def_transcript && (sudo_mode & (MODE_RUN | MODE_EDIT)))
io_nextid();
log_allowed(validated);
if (ISSET(sudo_mode, MODE_CHECK))
rval = display_cmnd(snl, list_pw ? list_pw : sudo_user.pw);

View File

@@ -295,6 +295,7 @@ int sudoers_io_open(unsigned int version, sudo_conv_t conversation,
void sudoers_io_close(int exit_status, int error);
int sudoers_io_version(int verbose);
int sudoers_io_log_output(const char *buf, unsigned int len);
void io_nextid(void);
/* env.c */
char **env_get(void);