mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-02 15:25:58 +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:
@@ -71,7 +71,7 @@ static sigset_t ttyblock;
|
|||||||
static struct timeval last_time;
|
static struct timeval last_time;
|
||||||
static union script_fd io_outfile, io_timfile;
|
static union script_fd io_outfile, io_timfile;
|
||||||
|
|
||||||
static void
|
void
|
||||||
io_nextid(void)
|
io_nextid(void)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
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,
|
* Build a path containing the session id split into two-digit subdirs,
|
||||||
* so ID 000001 becomes /var/log/sudo-session/00/00/01.
|
* so ID 000001 becomes /var/log/sudo-session/00/00/01.
|
||||||
*/
|
*/
|
||||||
io_nextid();
|
|
||||||
len = build_idpath(pathbuf, sizeof(pathbuf));
|
len = build_idpath(pathbuf, sizeof(pathbuf));
|
||||||
if (len == -1)
|
if (len == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
@@ -497,6 +497,8 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
|
|||||||
validate_env_vars(sudo_user.env_vars);
|
validate_env_vars(sudo_user.env_vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (def_transcript && (sudo_mode & (MODE_RUN | MODE_EDIT)))
|
||||||
|
io_nextid();
|
||||||
log_allowed(validated);
|
log_allowed(validated);
|
||||||
if (ISSET(sudo_mode, MODE_CHECK))
|
if (ISSET(sudo_mode, MODE_CHECK))
|
||||||
rval = display_cmnd(snl, list_pw ? list_pw : sudo_user.pw);
|
rval = display_cmnd(snl, list_pw ? list_pw : sudo_user.pw);
|
||||||
|
@@ -295,6 +295,7 @@ int sudoers_io_open(unsigned int version, sudo_conv_t conversation,
|
|||||||
void sudoers_io_close(int exit_status, int error);
|
void sudoers_io_close(int exit_status, int error);
|
||||||
int sudoers_io_version(int verbose);
|
int sudoers_io_version(int verbose);
|
||||||
int sudoers_io_log_output(const char *buf, unsigned int len);
|
int sudoers_io_log_output(const char *buf, unsigned int len);
|
||||||
|
void io_nextid(void);
|
||||||
|
|
||||||
/* env.c */
|
/* env.c */
|
||||||
char **env_get(void);
|
char **env_get(void);
|
||||||
|
Reference in New Issue
Block a user