diff options
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); |