Loading src/blogi.cpp +13 −3 Changes for src/blogi.cpp: 13 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -2996,10 +2996,19 @@ void logFiles(const char *path,int fd){ if(pfd<0) return; struct passwd *pwd=getpwnam("blogi"); struct passwd pwd_storage; char buffer[1024]; struct passwd *result = nullptr; const char *username = "blogi"; if(getpwnam_r(username, &pwd_storage, buffer, sizeof(buffer), &result)!=0 || result==NULL){ libhttppp::HTTPException exp; exp[libhttppp::HTTPException::Critical] << "can'T change user !"; throw exp; } if(pwd!=nullptr) fchown(pfd,pwd->pw_uid,pwd->pw_gid); fchown(pfd,pwd_storage->pw_uid,pwd_storage->pw_gid); dup2(pfd, fd); close(pfd); Loading Loading @@ -3093,7 +3102,8 @@ int main(int argc, char* argv[]) { if(debug==0){ // Running as root: set up logfiles, optionally daemonize, and // let HttpConD drop privileges to the blogi user afterwards. //ensureConfigGroupWritable(config); ensureConfigGroupWritable(config); logFiles("/var/log/blogi/access.log",STDOUT_FILENO); logFiles("/var/log/blogi/error.log",STDERR_FILENO); Loading Loading
src/blogi.cpp +13 −3 Changes for src/blogi.cpp: 13 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -2996,10 +2996,19 @@ void logFiles(const char *path,int fd){ if(pfd<0) return; struct passwd *pwd=getpwnam("blogi"); struct passwd pwd_storage; char buffer[1024]; struct passwd *result = nullptr; const char *username = "blogi"; if(getpwnam_r(username, &pwd_storage, buffer, sizeof(buffer), &result)!=0 || result==NULL){ libhttppp::HTTPException exp; exp[libhttppp::HTTPException::Critical] << "can'T change user !"; throw exp; } if(pwd!=nullptr) fchown(pfd,pwd->pw_uid,pwd->pw_gid); fchown(pfd,pwd_storage->pw_uid,pwd_storage->pw_gid); dup2(pfd, fd); close(pfd); Loading Loading @@ -3093,7 +3102,8 @@ int main(int argc, char* argv[]) { if(debug==0){ // Running as root: set up logfiles, optionally daemonize, and // let HttpConD drop privileges to the blogi user afterwards. //ensureConfigGroupWritable(config); ensureConfigGroupWritable(config); logFiles("/var/log/blogi/access.log",STDOUT_FILENO); logFiles("/var/log/blogi/error.log",STDERR_FILENO); Loading