diff --git a/src/sbbs3/sbbscon.c b/src/sbbs3/sbbscon.c index 3e7227ef01e6dd9161cfaef394e2c85d1aa9d09a..aaad154e73088600789c4afa3a924b0b981cdca9 100644 --- a/src/sbbs3/sbbscon.c +++ b/src/sbbs3/sbbscon.c @@ -394,6 +394,7 @@ int main(int argc, char** argv) { int i; char ch; + char str[256]; char* arg; char* ctrl_dir; BOOL quit=FALSE; @@ -588,26 +589,6 @@ int main(int argc, char** argv) } } -#ifdef __unix__ - - if(getuid()) /* are we running as a normal user? */ - fprintf(stderr, - "*** Started as non-root user. Cannot bind() to ports below 1024.\n"); - - else if(!new_uid_name) /* check the user arg, if we have uid 0 */ - fprintf(stderr, - "*** No user account specified and started as root. HAZARDOUS!\n"); - - else if (!do_setuid()) - /* actually try to change the uid of this process */ - fprintf(stderr, - "*** Setting new uid failed! (Does the user exist?)\n"); - - else - printf("*** Successfully changed to user %s.\n", new_uid_name); - -#endif - _beginthread((void(*)(void*))bbs_thread,0,&bbs_startup); _beginthread((void(*)(void*))ftp_server,0,&ftp_startup); _beginthread((void(*)(void*))mail_server,0,&mail_startup); @@ -621,6 +602,21 @@ int main(int argc, char** argv) signal(SIGABRT, _sighandler_quit); signal(SIGTERM, _sighandler_quit); + if(getuid()) /* are we running as a normal user? */ + lputs("*** Started as non-root user. Cannot bind() to ports below 1024.\n"); + + else if(!new_uid_name) /* check the user arg, if we have uid 0 */ + lputs("*** No user account specified and started as root. HAZARDOUS!\n"); + + else if (!do_setuid()) + /* actually try to change the uid of this process */ + lputs("*** Setting new uid failed! (Does the user exist?)\n"); + + else { + sprintf(str,"*** Successfully changed to user %s.\n", new_uid_name); + lputs(str); + } + if(!isatty(fileno(stdin))) /* redirected */ select(0,NULL,NULL,NULL,NULL); /* so wait here until signaled */ else /* interactive */