Thread (4 messages) flat view 4 messages, 2 authors, 2016-06-15

Re: [PATCH v4 11/15] daemon: report connection from root-process

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:49:47

Possibly related (same subject, not in this thread)

Erik Faye-Lund [off-list ref] writes:
quoted hunk
Report incoming connections from the process that
accept() the connection instead of the handling
process.

This enables "Connection from"-reporting on
Windows, where getpeername(0, ...) consistently
fails.

Signed-off-by: Erik Faye-Lund <redacted>
---
 daemon.c |   72 ++++++++++++++++++++++++++++++-------------------------------
 1 files changed, 35 insertions(+), 37 deletions(-)
diff --git a/daemon.c b/daemon.c
index 8a44fb9..1574f75 100644
--- a/daemon.c
+++ b/daemon.c
@@ -516,38 +516,11 @@ static void parse_host_arg(char *extra_args, int buflen)
 }
 
 
-static int execute(struct sockaddr *addr)
+static int execute(void)
 {
-...
-		}
-		loginfo("Connection from %s:%d", addrbuf, port);
-		setenv("REMOTE_ADDR", addrbuf, 1);
...
+	else {
+		loginfo("[%"PRIuMAX"] Connection from %s:%d",
+		    (uintmax_t)cld.pid, addrstr, port);
 		add_child(&cld, addr, addrlen);
Hmm, loginfo() calls logreport() and adds the process information as
necessary to the output.  Wouldn't this patch give the pid information
twice?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help