File: 0003-Fix-syslog-prefix.patch

package info (click to toggle)
cyrus-imapd 3.10.2-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 59,108 kB
  • sloc: ansic: 284,386; perl: 137,327; javascript: 9,659; sh: 5,730; yacc: 2,565; makefile: 2,188; cpp: 2,147; lex: 662; xml: 621; awk: 303; python: 272; asm: 262
file content (64 lines) | stat: -rw-r--r-- 1,932 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Description: Fix syslog prefix
 Make sure all programs log (to syslog) with "cyrus/<program>" as the
 log prefix.
Author: Sven Mueller <debian@incase.de>
Forwarded: https://github.com/cyrusimap/cyrus-imapd/pull/3279
Rewieved-By: Xavier Guimard <yadd@debian.org>
Last-Update: 2020-02-10

--- a/imap/global.c
+++ b/imap/global.c
@@ -159,6 +159,9 @@
     return SYSLOG_FACILITY;
 }
 
+/* syslog prefix tag */
+static char syslog_prefix[20];
+
 struct cyrus_module {
     void (*done)(void *rock);
     void *rock;
@@ -235,7 +238,9 @@
         openlog(ident_buf, syslog_opts, SYSLOG_FACILITY);
     }
     else {
-        openlog(config_ident, syslog_opts, SYSLOG_FACILITY);
+	strncpy(syslog_prefix, "cyrus/", sizeof(syslog_prefix));
+	strncat(syslog_prefix, config_ident, sizeof(syslog_prefix) - 7);
+        openlog(syslog_prefix, syslog_opts, SYSLOG_FACILITY);
     }
 
     /* Load configuration file.  This will set config_dir when it finds it */
--- a/ptclient/ptexpire.c
+++ b/ptclient/ptexpire.c
@@ -108,7 +108,7 @@
     const char *fname;
     char *alt_config = NULL, *tofree = NULL;
 
-    openlog("ptexpire", LOG_PID, SYSLOG_FACILITY);
+    openlog("cyrus/ptexpire", LOG_PID, SYSLOG_FACILITY);
 
     /* keep this in alphabetical order */
     static const char short_options[] = "C:E:";
--- a/ptclient/test.c
+++ b/ptclient/test.c
@@ -58,7 +58,7 @@
     cacheid=cache;
   } else
     cacheid=NULL;
-  openlog("pttest", LOG_PID, SYSLOG_FACILITY);
+  openlog("cyrus/pttest", LOG_PID, SYSLOG_FACILITY);
 
   if (!auth_setid(argv[1],cacheid))
     printf ("Auth_memberof(%s,%s) is %d\n", argv[1], argv[2],
--- a/ptclient/test2.c
+++ b/ptclient/test2.c
@@ -45,7 +45,7 @@
 
 int main(void) {
   char cacheid[16]="4224423";
-  openlog("testr", LOG_PID, SYSLOG_FACILITY);
+  openlog("cyrus/testr", LOG_PID, SYSLOG_FACILITY);
 
   if (!auth_setid("cg2v@club.cc.cmu.edu",cacheid))
     printf ("Auth_memberof(cg2v,cg2v:me) is %d\n",