*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
if(( ! argv[i][n + 1] ) && ( i + 1 < argc ))
{
/* Ok, next character is a blank */
if(( ! argv[i][n + 1] ) && ( i + 1 < argc ))
{
/* Ok, next character is a blank */
printf( "%s: invalid option \"-%c\"!\n", PACKAGE_NAME, argv[i][n] );
printf( "Try \"%s --help\" for more information.\n", PACKAGE_NAME );
exit( 1 );
printf( "%s: invalid option \"-%c\"!\n", PACKAGE_NAME, argv[i][n] );
printf( "Try \"%s --help\" for more information.\n", PACKAGE_NAME );
exit( 1 );
NGIRCd_DebugLevel[0] = '\0';
#ifdef DEBUG
if( NGIRCd_Debug ) strcpy( NGIRCd_DebugLevel, "1" );
NGIRCd_DebugLevel[0] = '\0';
#ifdef DEBUG
if( NGIRCd_Debug ) strcpy( NGIRCd_DebugLevel, "1" );
- /* Protokoll- und Server-Identifikation erzeugen. Die vom ngIRCd
- * beim PASS-Befehl verwendete Syntax sowie die erweiterten Flags
- * sind in doc/Protocol.txt beschrieben. */
+ /*
+ * create protocol and server identification.
+ * The syntax used by ngIRCd in PASS commands and the extended flags
+ * are described in doc/Protocol.txt
+ */
#ifdef IRCPLUS
snprintf( NGIRCd_ProtoID, sizeof NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE_NAME, PACKAGE_VERSION, IRCPLUSFLAGS );
#ifdef ZLIB
#ifdef IRCPLUS
snprintf( NGIRCd_ProtoID, sizeof NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE_NAME, PACKAGE_VERSION, IRCPLUSFLAGS );
#ifdef ZLIB
if( Conn_InitListeners( ) < 1 )
{
Log( LOG_ALERT, "Server isn't listening on a single port!" );
if( Conn_InitListeners( ) < 1 )
{
Log( LOG_ALERT, "Server isn't listening on a single port!" );
#ifdef TCPWRAP
if( NGIRCd_VersionAddition[0] )
strlcat( NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition );
#ifdef TCPWRAP
if( NGIRCd_VersionAddition[0] )
strlcat( NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition );
memset( &saction, 0, sizeof( saction ));
saction.sa_handler = Signal_Handler;
#ifdef SA_RESTART
memset( &saction, 0, sizeof( saction ));
saction.sa_handler = Signal_Handler;
#ifdef SA_RESTART
sigaction(SIGINT, &saction, NULL);
sigaction(SIGQUIT, &saction, NULL);
sigaction(SIGTERM, &saction, NULL);
sigaction(SIGHUP, &saction, NULL);
sigaction(SIGCHLD, &saction, NULL);
sigaction(SIGINT, &saction, NULL);
sigaction(SIGQUIT, &saction, NULL);
sigaction(SIGTERM, &saction, NULL);
sigaction(SIGHUP, &saction, NULL);
sigaction(SIGCHLD, &saction, NULL);
saction.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &saction, NULL);
#else
saction.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &saction, NULL);
#else
signal(SIGINT, Signal_Handler);
signal(SIGQUIT, Signal_Handler);
signal(SIGTERM, Signal_Handler);
signal(SIGHUP, Signal_Handler);
signal(SIGCHLD, Signal_Handler);
signal(SIGINT, Signal_Handler);
signal(SIGQUIT, Signal_Handler);
signal(SIGTERM, Signal_Handler);
signal(SIGHUP, Signal_Handler);
signal(SIGCHLD, Signal_Handler);
signal(SIGPIPE, SIG_IGN);
#endif
} /* Initialize_Signal_Handler */
signal(SIGPIPE, SIG_IGN);
#endif
} /* Initialize_Signal_Handler */
- /* Child-Prozess wurde beendet. Zombies vermeiden: */
- while( waitpid( -1, NULL, WNOHANG ) > 0);
+ /* child-process exited, avoid zombies */
+ while (waitpid( -1, NULL, WNOHANG) > 0)
+ ;
puts( "Homepage: <http://ngircd.barton.de/>\n" );
puts( "This is free software; see the source for copying conditions. There is NO" );
puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
puts( "Homepage: <http://ngircd.barton.de/>\n" );
puts( "This is free software; see the source for copying conditions. There is NO" );
puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
puts( " -s, --sniffer enable network sniffer and display all IRC traffic" );
#endif
puts( " -t, --configtest read, validate and display configuration; then exit" );
puts( " -s, --sniffer enable network sniffer and display all IRC traffic" );
#endif
puts( " -t, --configtest read, validate and display configuration; then exit" );
- puts( " --version output version information and exit" );
- puts( " --help display this help and exit" );
+ puts( " -V, --version output version information and exit" );
+ puts( " -h, --help display this help and exit" );
+#ifdef __CYGWIN__
+ /* Cygwin kludge.
+ * It can return EINVAL instead of EPERM
+ * so, if we are already unprivileged,
+ * use id of current user.
+ */
+ if (geteuid() && getuid()) {
+ *uid = getuid();
+ *gid = getgid();
+ return true;
+ }
+#endif
+
if( Conf_Chroot[0] ) {
if( chdir( Conf_Chroot ) != 0 ) {
Log( LOG_ERR, "Can't chdir() in ChrootDir (%s): %s", Conf_Chroot, strerror( errno ));
if( Conf_Chroot[0] ) {
if( chdir( Conf_Chroot ) != 0 ) {
Log( LOG_ERR, "Can't chdir() in ChrootDir (%s): %s", Conf_Chroot, strerror( errno ));
- Log( LOG_INFO, "Running as user %s(%ld), group %s(%ld), with PID %ld.",
- pwd ? pwd->pw_name : "unknown", Conf_UID,
- grp ? grp->gr_name : "unknown", Conf_GID, pid);
+ Log(LOG_INFO, "Running as user %s(%ld), group %s(%ld), with PID %ld.",
+ pwd ? pwd->pw_name : "unknown", (long)Conf_UID,
+ grp ? grp->gr_name : "unknown", (long)Conf_GID, (long)pid);
- if ( chrooted ) {
- Log( LOG_INFO, "Running chrooted, chrootdir \"%s\".", Conf_Chroot );
+ if (chrooted) {
+ Log(LOG_INFO, "Running with root directory \"%s\".",
+ Conf_Chroot );
/* Change working directory to home directory of the user
* we are running as (only when running in daemon mode and not in chroot) */
/* Change working directory to home directory of the user
* we are running as (only when running in daemon mode and not in chroot) */