X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=daemon.c;h=b129b83e4026490c1e6e77861cd6f03a5007d01e;hb=fffe694d607ea683b5d08ee99a46d9b06cb74006;hp=5335d212c32a82b10483b10866f361f5c5a5bc85;hpb=2d5b459107cf07bbb307cfb196c2007c497a6dd2;p=git.git diff --git a/daemon.c b/daemon.c index 5335d212c..b129b83e4 100644 --- a/daemon.c +++ b/daemon.c @@ -1,20 +1,14 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "pkt-line.h" #include "cache.h" +#include "pkt-line.h" #include "exec_cmd.h" #include "interpolate.h" +#include + +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 256 +#endif + static int log_syslog; static int verbose; static int reuseaddr; @@ -446,6 +440,8 @@ void fill_in_extra_table_entries(struct interp *itable) * Replace literal host with lowercase-ized hostname. */ hp = interp_table[INTERP_SLOT_HOST].value; + if (!hp) + return; for ( ; *hp; hp++) *hp = tolower(*hp); @@ -540,8 +536,10 @@ static int execute(struct sockaddr *addr) loginfo("Extended attributes (%d bytes) exist <%.*s>", (int) pktlen - len, (int) pktlen - len, line + len + 1); - if (len && line[len-1] == '\n') + if (len && line[len-1] == '\n') { line[--len] = 0; + pktlen--; + } /* * Initialize the path interpolation table for this connection. @@ -830,7 +828,7 @@ static int socksetup(char *listen_addr, int listen_port, int **socklist_p) #else /* NO_IPV6 */ -static int socksetup(char *lisen_addr, int listen_port, int **socklist_p) +static int socksetup(char *listen_addr, int listen_port, int **socklist_p) { struct sockaddr_in sin; int sockfd;