95 free(pid_file_path); |
95 free(pid_file_path); |
96 |
96 |
97 // set global vars |
97 // set global vars |
98 conf_global_vars_s *vars = conf_getglobals(); |
98 conf_global_vars_s *vars = conf_getglobals(); |
99 |
99 |
|
100 uid_t ws_uid = geteuid(); |
100 setpwent(); |
101 setpwent(); |
|
102 char *pwbuf = malloc(DEF_PWBUF); |
|
103 vars->Vuserpw = malloc(sizeof(struct passwd)); |
|
104 if(cfg->user.ptr) { |
|
105 if(!util_getpwnam(cfg->user.ptr, vars->Vuserpw, pwbuf, DEF_PWBUF)) { |
|
106 log_ereport( |
|
107 LOG_MISCONFIG, |
|
108 "user %s does not exist!", |
|
109 cfg->user.ptr); |
|
110 free(vars->Vuserpw); |
|
111 vars->Vuserpw = NULL; |
|
112 } |
|
113 } else { |
|
114 if(!util_getpwuid(ws_uid, vars->Vuserpw, pwbuf, DEF_PWBUF)) { |
|
115 log_ereport(LOG_FAILURE, "webserver_init: cannot get passwd data"); |
|
116 free(vars->Vuserpw); |
|
117 vars->Vuserpw = NULL; |
|
118 } |
|
119 } |
|
120 free(pwbuf); |
|
121 if(!vars->Vuserpw) { |
|
122 log_ereport(LOG_WARN, "globalvars->Vuserpw is null"); |
|
123 } |
|
124 |
101 if(cfg->user.ptr) { |
125 if(cfg->user.ptr) { |
102 char *pwbuf = malloc(DEF_PWBUF); |
126 char *pwbuf = malloc(DEF_PWBUF); |
103 vars->Vuserpw = malloc(sizeof(struct passwd)); |
127 vars->Vuserpw = malloc(sizeof(struct passwd)); |
104 // open user database |
128 // open user database |
105 //setpwent(); |
129 //setpwent(); |