1 |
jpp |
1.1 |
diff -up sudo-1.8.6p3/plugins/sudoers/logging.c.logsudouser sudo-1.8.6p3/plugins/sudoers/logging.c |
2 |
|
|
--- sudo-1.8.6p3/plugins/sudoers/logging.c.logsudouser 2013-08-12 23:04:33.664124186 +0200 |
3 |
|
|
+++ sudo-1.8.6p3/plugins/sudoers/logging.c 2013-08-12 23:03:40.795895164 +0200 |
4 |
|
|
@@ -146,7 +146,7 @@ do_syslog(int pri, char *msg) |
5 |
|
|
* Log the full line, breaking into multiple syslog(3) calls if necessary |
6 |
|
|
*/ |
7 |
|
|
fmt = _(FMT_FIRST); |
8 |
|
|
- maxlen = MAXSYSLOGLEN - (strlen(fmt) - 5 + strlen(user_name)); |
9 |
|
|
+ maxlen = MAXSYSLOGLEN - (strlen(fmt) - 5 + strlen(sudo_user_name)); |
10 |
|
|
for (p = msg; *p != '\0'; ) { |
11 |
|
|
len = strlen(p); |
12 |
|
|
if (len > maxlen) { |
13 |
|
|
@@ -162,7 +162,7 @@ do_syslog(int pri, char *msg) |
14 |
|
|
save = *tmp; |
15 |
|
|
*tmp = '\0'; |
16 |
|
|
|
17 |
|
|
- mysyslog(pri, fmt, user_name, p); |
18 |
|
|
+ mysyslog(pri, fmt, sudo_user_name, p); |
19 |
|
|
|
20 |
|
|
*tmp = save; /* restore saved character */ |
21 |
|
|
|
22 |
|
|
@@ -170,11 +170,11 @@ do_syslog(int pri, char *msg) |
23 |
|
|
for (p = tmp; *p == ' '; p++) |
24 |
|
|
; |
25 |
|
|
} else { |
26 |
|
|
- mysyslog(pri, fmt, user_name, p); |
27 |
|
|
+ mysyslog(pri, fmt, sudo_user_name, p); |
28 |
|
|
p += len; |
29 |
|
|
} |
30 |
|
|
fmt = _(FMT_CONTD); |
31 |
|
|
- maxlen = MAXSYSLOGLEN - (strlen(fmt) - 5 + strlen(user_name)); |
32 |
|
|
+ maxlen = MAXSYSLOGLEN - (strlen(fmt) - 5 + strlen(sudo_user_name)); |
33 |
|
|
} |
34 |
|
|
|
35 |
|
|
#ifdef HAVE_SETLOCALE |
36 |
|
|
@@ -216,17 +216,17 @@ do_logfile(char *msg) |
37 |
|
|
/* Don't pretty-print long log file lines (hard to grep) */ |
38 |
|
|
if (def_log_host) |
39 |
|
|
(void) fprintf(fp, "%s : %s : HOST=%s : %s\n", |
40 |
|
|
- get_timestr(now, def_log_year), user_name, user_shost, msg); |
41 |
|
|
+ get_timestr(now, def_log_year), sudo_user_name, user_shost, msg); |
42 |
|
|
else |
43 |
|
|
(void) fprintf(fp, "%s : %s : %s\n", |
44 |
|
|
- get_timestr(now, def_log_year), user_name, msg); |
45 |
|
|
+ get_timestr(now, def_log_year), sudo_user_name, msg); |
46 |
|
|
} else { |
47 |
|
|
if (def_log_host) |
48 |
|
|
len = easprintf(&full_line, "%s : %s : HOST=%s : %s", |
49 |
|
|
- get_timestr(now, def_log_year), user_name, user_shost, msg); |
50 |
|
|
+ get_timestr(now, def_log_year), sudo_user_name, user_shost, msg); |
51 |
|
|
else |
52 |
|
|
len = easprintf(&full_line, "%s : %s : %s", |
53 |
|
|
- get_timestr(now, def_log_year), user_name, msg); |
54 |
|
|
+ get_timestr(now, def_log_year), sudo_user_name, msg); |
55 |
|
|
|
56 |
|
|
/* |
57 |
|
|
* Print out full_line with word wrap around def_loglinelen chars. |
58 |
|
|
@@ -689,7 +689,7 @@ send_mail(const char *fmt, ...) |
59 |
|
|
#endif /* HAVE_NL_LANGINFO */ |
60 |
|
|
|
61 |
|
|
(void) fprintf(mail, "\n\n%s : %s : %s : ", user_host, |
62 |
|
|
- get_timestr(time(NULL), def_log_year), user_name); |
63 |
|
|
+ get_timestr(time(NULL), def_log_year), sudo_user_name); |
64 |
|
|
va_start(ap, fmt); |
65 |
|
|
(void) vfprintf(mail, fmt, ap); |
66 |
|
|
va_end(ap); |
67 |
|
|
diff -up sudo-1.8.6p3/plugins/sudoers/sudoers.h.logsudouser sudo-1.8.6p3/plugins/sudoers/sudoers.h |
68 |
|
|
--- sudo-1.8.6p3/plugins/sudoers/sudoers.h.logsudouser 2013-08-12 23:04:42.955164613 +0200 |
69 |
|
|
+++ sudo-1.8.6p3/plugins/sudoers/sudoers.h 2013-08-12 23:05:17.216314120 +0200 |
70 |
|
|
@@ -168,6 +168,7 @@ struct sudo_user { |
71 |
|
|
/* |
72 |
|
|
* Shortcuts for sudo_user contents. |
73 |
|
|
*/ |
74 |
|
|
+#define sudo_user_name (sudo_user.pw->pw_name) |
75 |
|
|
#define user_name (sudo_user.name) |
76 |
|
|
#define user_uid (sudo_user.uid) |
77 |
|
|
#define user_gid (sudo_user.gid) |