git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-daemon

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 19, 2007, 22:23 UTC
Message-ID
<7vbq9pnac2.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<598D5675D34BE349929AF5EDE9B03E27017BCC42@az33exm24.fsl.freescale.net>
"Medve Emilian" <Emilian.Medve@freescale.com> writes:
> It seems that something changed since maint/v.1.5.3.6 such that on
> master and next git-daemon doesn't seem to be working anymore in inetd
> mode. Can somebody please confirm this?
Sorry, I cannot quite parse.  Do you mean:
	master and next used to work.  Recently 'maint' was
	merged to them after v1.5.3.6 was cut.  master and next
	does not work anymore after that.
Or do you mean:
	maint (specifically at v1.5.3.6) works, but master and
	next contain more changes on top of them, and they do
	not work.

In either case, the only change to the daemon code between v1.5.3.5 and master is this one:

commit c67359be45be74e1056d6293c6bb09ee6d00a54a
Author: Gerrit Pape <pape@smarden.org>
Date:   Mon Nov 5 09:16:22 2007 +0000
    git-daemon: fix remote port number in log entry
    
    The port number in struct sockaddr_in needs to be converted from network
    byte order to host byte order (on some architectures).
    
    Signed-off-by: Gerrit Pape <pape@smarden.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 daemon.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemon.c b/daemon.c
index 660e155..b8df980 100644
--- a/daemon.c
+++ b/daemon.c
@@ -540,7 +540,7 @@ static int execute(struct sockaddr *addr)
 		if (addr->sa_family == AF_INET) {
 			struct sockaddr_in *sin_addr = (void *) addr;
 			inet_ntop(addr->sa_family, &sin_addr->sin_addr, addrbuf, sizeof(addrbuf));
-			port = sin_addr->sin_port;
+			port = ntohs(sin_addr->sin_port);
 #ifndef NO_IPV6
 		} else if (addr && addr->sa_family == AF_INET6) {
 			struct sockaddr_in6 *sin6_addr = (void *) addr;
@@ -550,7 +550,7 @@ static int execute(struct sockaddr *addr)
 			inet_ntop(AF_INET6, &sin6_addr->sin6_addr, buf, sizeof(addrbuf) - 1);
 			strcat(buf, "]");
 
-			port = sin6_addr->sin6_port;
+			port = ntohs(sin6_addr->sin6_port);
 #endif
 		}
 		loginfo("Connection from %s:%d", addrbuf, port);

I do not see anything wrong in it.  The "port" variable is very
local to this function and is used only for that loginfo() call
at the end of the context.  So I am quite puzzled.

We have another irrelevant style change that is full of things
like this, but I do not think that makes any behaviour
difference either.

@@ -406,7 +406,8 @@ static struct daemon_service daemon_service[] = {
 	{ "receive-pack", "receivepack", receive_pack, 0, 1 },
 };
 
-static void enable_service(const char *name, int ena) {
+static void enable_service(const char *name, int ena)
+{
 	int i;
 	for (i = 0; i < ARRAY_SIZE(daemon_service); i++) {
 		if (!strcmp(daemon_service[i].name, name)) {
Previous: Medve EmilianNext: Medve Emilian
Message 2 of 7 in “git-daemon”
  1. Medve EmilianNov 19, 2007
  2. Junio C HamanoNov 19, 2007
  3. Medve EmilianNov 19, 2007
  4. Jeff KingNov 20, 2007
  5. Medve EmilianNov 20, 2007
  6. Jeff KingNov 20, 2007
  7. Medve EmilianNov 20, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.