Add source files/patches.

This commit is contained in:
Jason Tibbitts 2017-05-25 10:33:34 -05:00
parent c70cf04055
commit b9bfd810a7
3 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,17 @@
/* This is used to build an LD_PRELOAD library to redirect syslog calls. */
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
void openlog(const char *ident, int option, int facility) { return; }
void closelog(void) { return; }
void syslog(int priority, const char *format, ...) {
va_list va;
va_start(va, format);
vfprintf(stderr, format, va);
va_end(va);
}

View File

@ -0,0 +1,21 @@
diff --git a/Cassandane/Util/Log.pm b/Cassandane/Util/Log.pm
index 9cd93d5..8d3b3c1 100644
--- a/Cassandane/Util/Log.pm
+++ b/Cassandane/Util/Log.pm
@@ -52,16 +52,12 @@ our @EXPORT = qw(
my $verbose = 0;
-openlog('cassandane', '', LOG_LOCAL6)
- or die "Cannot openlog";
-
sub xlog
{
my ($pkg, $file, $line) = caller;
$pkg =~ s/^Cassandane:://;
my $msg = "=====> " . $pkg . "[" . $line . "] " . join(' ', @_);
print STDERR "$msg\n";
- syslog(LOG_ERR, "$msg");
}
sub set_verbose

29
patch-neuter-become-cyrus Normal file
View File

@ -0,0 +1,29 @@
diff --git a/lib/util.c b/lib/util.c
index 62ad7bd..37f0463 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -605,7 +605,7 @@ EXPORTED int become_cyrus(int is_master)
p = getpwnam(cyrus);
if (p == NULL) {
syslog(LOG_ERR, "no entry in /etc/passwd for user %s", cyrus);
- return -1;
+ return 0;
}
/* Save these in case initgroups does a getpw*() */
@@ -625,13 +625,13 @@ EXPORTED int become_cyrus(int is_master)
if (initgroups(cyrus, newgid)) {
syslog(LOG_ERR, "unable to initialize groups for user %s: %s",
cyrus, strerror(errno));
- return -1;
+ return 0;
}
if (setgid(newgid)) {
syslog(LOG_ERR, "unable to set group id to %d for user %s: %s",
newgid, cyrus, strerror(errno));
- return -1;
+ return 0;
}
result = cap_setuid(newuid, is_master);