On Mon, Feb 26, 2007 at 10:04:24AM +0100, Marc Haber wrote:
> I have committed the attached patch and have pointed upstream here.
Stupid me forgot the attachment.
Greetings
Marc
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835
#! /bin/sh /usr/share/dpatch/dpatch-run
## 50-Fix-NULL-getlogin.dpatch by <Mike O'Connor <[EMAIL PROTECTED]>>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad trunk~/snoopy.c trunk/snoopy.c
--- trunk~/snoopy.c 2007-02-26 09:58:14.000000000 +0100
+++ trunk/snoopy.c 2007-02-26 09:59:30.000000000 +0100
@@ -26,6 +26,7 @@
#include <dlfcn.h>
#include <syslog.h>
#include "snoopy.h"
+#include "string.h"
#define min(a,b) a<b?a:b
@@ -41,6 +42,7 @@
static char *logstring=NULL;
static int argc, size=0;
register int i, spos=0;
+ static char login[256];
#if INTEGRITY_CHECK
static char **argv_copy;
static int *t_size;
@@ -96,9 +98,12 @@
free(*(argv_copy+i));
#endif
- syslog(LOG_INFO, "[%s, uid:%d sid:%d]: %s", getlogin(), getuid(),
getsid(0), logstring);
- free(logstring);
+ if( getlogin_r(login, 255) ) {
+ strcpy(login,"unknown");
+ }
+ syslog(LOG_INFO, "[%s, uid:%d sid:%d]: %s", login, getuid(), getsid(0),
logstring);
+ free(logstring);
}
int execve(const char *filename, char **argv, char **envp) {