From b6a347373a6c933a457ed588e3ce9c6b5178d8ba Mon Sep 17 00:00:00 2001 From: epochqwert Date: Sat, 4 Jul 2015 08:39:28 -0500 Subject: don't remember except for greed.sh --- src/libexec/httpd.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/libexec') diff --git a/src/libexec/httpd.c b/src/libexec/httpd.c index d6e99ba..2840ce2 100644 --- a/src/libexec/httpd.c +++ b/src/libexec/httpd.c @@ -72,16 +72,14 @@ int main(int argc,char *argv[]) { if(getpeername(0,(struct sockaddr *)&sa6,&sl) == -1) syslog(LOG_WARNING,"getpeername: %m"); + getnameinfo((struct sockaddr *)&sa6,sl,h,sizeof(h),p,sizeof(p),NI_NUMERICHOST|NI_NUMERICSERV); - if((pwd=getpwuid(getuid()))) { - setenv("USER",pwd->pw_name,1); - } - if(gethostname(h,NI_MAXHOST) != -1) { - setenv("HOST",h,1); - } setenv("REMOTE_ADDR",h,1); setenv("REMOTE_PORT",p,1); + if((pwd=getpwuid(getuid()))) setenv("USER",pwd->pw_name,1); + if(gethostname(h,NI_MAXHOST) != -1) setenv("HOST",h,1); + if(getsockname(0,(struct sockaddr *)&sa6,&sl) == -1) syslog(LOG_WARNING,"getsockname: %m"); getnameinfo((struct sockaddr *)&sa6,sl,h,sizeof(h),p,sizeof(p),NI_NUMERICHOST|NI_NUMERICSERV); -- cgit v1.2.3