8f2528
diff -up openssh-5.9p1/Makefile.in.wIm openssh-5.9p1/Makefile.in
8f2528
--- openssh-5.9p1/Makefile.in.wIm	2011-08-05 22:15:18.000000000 +0200
8f2528
+++ openssh-5.9p1/Makefile.in	2011-09-12 16:24:18.643674014 +0200
8f2528
@@ -66,7 +66,7 @@ LIBSSH_OBJS=acss.o authfd.o authfile.o b
8f2528
 	cipher-bf1.o cipher-ctr.o cipher-3des1.o cleanup.o \
8f2528
 	compat.o compress.o crc32.o deattack.o fatal.o hostfile.o \
8f2528
 	log.o match.o md-sha256.o moduli.o nchan.o packet.o \
8f2528
-	readpass.o rsa.o ttymodes.o xmalloc.o addrmatch.o \
8f2528
+	readpass.o rsa.o ttymodes.o whereIam.o xmalloc.o addrmatch.o \
8f2528
 	atomicio.o key.o dispatch.o kex.o mac.o uidswap.o uuencode.o misc.o \
8f2528
 	monitor_fdpass.o rijndael.o ssh-dss.o ssh-ecdsa.o ssh-rsa.o dh.o \
8f2528
 	kexdh.o kexgex.o kexdhc.o kexgexc.o bufec.o kexecdh.o kexecdhc.o \
8f2528
diff -up openssh-5.9p1/log.h.wIm openssh-5.9p1/log.h
8f2528
--- openssh-5.9p1/log.h.wIm	2011-06-20 06:42:23.000000000 +0200
8f2528
+++ openssh-5.9p1/log.h	2011-09-12 16:34:52.984674326 +0200
8f2528
@@ -65,6 +65,8 @@ void     verbose(const char *, ...) __at
8f2528
 void     debug(const char *, ...) __attribute__((format(printf, 1, 2)));
8f2528
 void     debug2(const char *, ...) __attribute__((format(printf, 1, 2)));
8f2528
 void     debug3(const char *, ...) __attribute__((format(printf, 1, 2)));
8f2528
+void	 _debug_wIm_body(const char *, int, const char *, const char *, int);
8f2528
+#define	debug_wIm(a,b) _debug_wIm_body(a,b,__func__,__FILE__,__LINE__)
8f2528
 
8f2528
 
8f2528
 void	 set_log_handler(log_handler_fn *, void *);
8f2528
diff -up openssh-5.9p1/sshd.c.wIm openssh-5.9p1/sshd.c
8f2528
--- openssh-5.9p1/sshd.c.wIm	2011-06-23 11:45:51.000000000 +0200
8f2528
+++ openssh-5.9p1/sshd.c	2011-09-12 16:38:35.787816490 +0200
8f2528
@@ -140,6 +140,9 @@ int deny_severity;
8f2528
 
8f2528
 extern char *__progname;
8f2528
 
8f2528
+/* trace of fork processes */
8f2528
+extern int whereIam;
8f2528
+
8f2528
 /* Server configuration options. */
8f2528
 ServerOptions options;
8f2528
 
8f2528
@@ -666,6 +669,7 @@ privsep_preauth(Authctxt *authctxt)
8f2528
 		return 1;
8f2528
 	} else {
8f2528
 		/* child */
8f2528
+		whereIam = 1;
8f2528
 		close(pmonitor->m_sendfd);
8f2528
 		close(pmonitor->m_log_recvfd);
8f2528
 
8f2528
@@ -715,6 +719,7 @@ privsep_postauth(Authctxt *authctxt)
8f2528
 
8f2528
 	/* child */
8f2528
 
8f2528
+	whereIam = 2;
8f2528
 	close(pmonitor->m_sendfd);
8f2528
 	pmonitor->m_sendfd = -1;
8f2528
 
8f2528
@@ -1325,6 +1330,8 @@ main(int ac, char **av)
8f2528
 	Key *key;
8f2528
 	Authctxt *authctxt;
8f2528
 
8f2528
+	whereIam = 0;
8f2528
+
8f2528
 #ifdef HAVE_SECUREWARE
8f2528
 	(void)set_auth_parameters(ac, av);
8f2528
 #endif
8f2528
diff -up openssh-5.9p1/whereIam.c.wIm openssh-5.9p1/whereIam.c
8f2528
--- openssh-5.9p1/whereIam.c.wIm	2011-09-12 16:24:18.722674167 +0200
8f2528
+++ openssh-5.9p1/whereIam.c	2011-09-12 16:24:18.724674418 +0200
8f2528
@@ -0,0 +1,12 @@
8f2528
+
8f2528
+int whereIam = -1;
8f2528
+
8f2528
+void _debug_wIm_body(const char *txt, int val, const char *func, const char *file, int line)
8f2528
+{
8f2528
+	if (txt)
8f2528
+		debug("%s=%d, %s(%s:%d) wIm = %d, uid=%d, euid=%d", txt, val, func, file, line, whereIam, getuid(), geteuid());
8f2528
+	else
8f2528
+		debug("%s(%s:%d) wIm = %d, uid=%d, euid=%d", func, file, line, whereIam, getuid(), geteuid());
8f2528
+}
8f2528
+
8f2528
+