summaryrefslogtreecommitdiff
path: root/src/libexec
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexec')
-rw-r--r--src/libexec/httpd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libexec/httpd.c b/src/libexec/httpd.c
index 5fc4825..d6e99ba 100644
--- a/src/libexec/httpd.c
+++ b/src/libexec/httpd.c
@@ -9,6 +9,7 @@
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
+#include <pwd.h>
#define VHOST_ROOT "/var/www/vhosts"
#define SITES_ROOT "/var/www/sites"
@@ -60,6 +61,7 @@ int main(int argc,char *argv[]) {
char *page;
char *version;
char *get_param;
+ struct passwd *pwd;
char line[getpagesize()];
fgets(line,sizeof(line)-1,stdin);
struct sockaddr_in6 sa6;
@@ -71,6 +73,12 @@ 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);