Log the session ID, if there is one. Currently logs ID=XXXXXX, perhaps

should be SESSIONID or SESSID.
This commit is contained in:
Todd C. Miller
2009-08-30 15:18:50 +00:00
parent 5181d496c4
commit 6184eb9461
4 changed files with 18 additions and 4 deletions

View File

@@ -658,6 +658,7 @@ get_timestr()
#define LL_GROUP_STR "GROUP="
#define LL_ENV_STR "ENV="
#define LL_CMND_STR "COMMAND="
#define LL_ID_STR "ID="
/*
* Allocate and fill in a new logline.
@@ -687,6 +688,8 @@ new_logline(message, serrno)
len += sizeof(LL_USER_STR) + 2 + strlen(runas_pw->pw_name);
if (runas_gr != NULL)
len += sizeof(LL_GROUP_STR) + 2 + strlen(runas_gr->gr_name);
if (sudo_user.sessid[0] != '\0')
len += sizeof(LL_ID_STR) + 2 + strlen(sudo_user.sessid);
if (sudo_user.env_vars != NULL) {
size_t evlen = 0;
struct list_member *cur;
@@ -740,6 +743,12 @@ new_logline(message, serrno)
strlcat(line, " ; ", len) >= len)
goto toobig;
}
if (sudo_user.sessid[0] != '\0') {
if (strlcat(line, LL_ID_STR, len) >= len ||
strlcat(line, sudo_user.sessid, len) >= len ||
strlcat(line, " ; ", len) >= len)
goto toobig;
}
if (evstr != NULL) {
if (strlcat(line, LL_ENV_STR, len) >= len ||
strlcat(line, evstr, len) >= len ||