[openbnc-cvs] openbnc/src openbnc.c,1.4,1.5
Status: Beta
Brought to you by:
andrereis
From: Mateusz K. <sh...@us...> - 2004-07-06 09:37:35
|
Update of /cvsroot/openbnc/openbnc/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27372/openbnc/src Modified Files: openbnc.c Log Message: - Add get_current_dir_name(); to banner - "Advenced" -> "Advanced" - Add UID and GID to banner - Checking if UID = 0 then exit ( it may be unsecure to run it as root ) Index: openbnc.c =================================================================== RCS file: /cvsroot/openbnc/openbnc/src/openbnc.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- openbnc.c 5 Jul 2004 19:13:24 -0000 1.4 +++ openbnc.c 6 Jul 2004 09:37:27 -0000 1.5 @@ -180,7 +180,7 @@ fflush(stdout); */ - printf("OpenIRC Advenced IRC Bouncer\n"); + printf("OpenIRC Advanced IRC Bouncer\n"); printf("Copyright (C) 2004 The OpenBNC Development Team\n"); printf("Based on psyBNC, by 'the most psychoid'.\n"); @@ -198,6 +198,12 @@ char *bversion; FILE *pidfile,*conffile; int i; + + if ( getuid() == 0 ) { + printf("Don't run OpenBNC as root!\n"); + exit(127); + } + if(argc==2) { strmncpy(configfile,argv[1],sizeof(configfile)); @@ -228,10 +234,10 @@ } printbanner(); // printf(lngtxt(991),configfile); - printf("> Reading config file : %s\n",configfile); + printf("> Reading config file : %s/%s\n",get_current_dir_name(),configfile); // printf(lngtxt(992),langname); // ap_snprintf(logfile,sizeof(logfile),lngtxt(993)); - printf("> Logging set to : %s",logfile); + printf("> Logging set to : %s/%s",get_current_dir_name(),logfile); rc = getini(lngtxt(994),lngtxt(995),INIFILE); if (rc != 0) { printf(lngtxt(996)); @@ -318,7 +324,7 @@ pcontext; if (pid) { // bversion=buildversion(); - printf("%s v%s is running (PID=%i)\n",APPNAME,APPVER,pid); + printf("%s v%s is running (PID=%i, UID=%i, GID=%i)\n",APPNAME,APPVER,pid,getuid(),getgid()); log(LOG_INFO,-1,lngtxt(1008),bversion,pid); fprintf( pidfile,"%d\n",pid); fclose(pidfile); |