diff options
author | epochqwert <epoch@hacking.allowed.org> | 2015-07-04 08:39:28 -0500 |
---|---|---|
committer | epochqwert <epoch@hacking.allowed.org> | 2015-07-04 08:39:28 -0500 |
commit | b6a347373a6c933a457ed588e3ce9c6b5178d8ba (patch) | |
tree | 5a78389e7a3c10c8bd93da7fe807ab1b6644e6fd /src/libexec | |
parent | 75f05369650cc05002b9c131a8453714dcf14dde (diff) | |
download | misc-b6a347373a6c933a457ed588e3ce9c6b5178d8ba.tar.gz misc-b6a347373a6c933a457ed588e3ce9c6b5178d8ba.zip |
don't remember except for greed.sh
Diffstat (limited to 'src/libexec')
-rw-r--r-- | src/libexec/httpd.c | 10 |
1 files changed, 4 insertions, 6 deletions
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); |