char *debugmode = ""; /* -"- -"- -"- */
char *sbrk0; /* initial sbrk(0) */
static int dorehash = 0;
-static char *dpath = DPATH;
+static char *dpath = NULL;
time_t nextconnect = 1; /* time for next try_connections call */
time_t nextping = 1; /* same as above for check_pings() */
(void) setuid ((uid_t) uid);
bootopt |= BOOT_OPER;
break;
-#ifdef CMDLINE_CONFIG
case 'f':
(void) setuid ((uid_t) uid);
configfile = p;
break;
-#endif /* CMDLINE_CONFIG */
case 'h':
strncpyzt (me.name, p, sizeof (me.name));
break;
}
}
-#ifndef CHROOT
- if (chdir (dpath)) {
+ /* If -d was given, chdir there; otherwise stay in cwd */
+ if (dpath && dpath[0] && chdir (dpath)) {
perror ("chdir");
exit (-1);
}
-#endif
#if !defined(IRC_UID)
if ((uid != euid) && !euid) {
exit (-1);
}
if (!(bootopt & BOOT_INETD)) {
-/* static char star[] = "*"; Compiler says this is unused */
aConfItem *aconf;
- if ((aconf = find_me ()) && portarg <= 0 && aconf->port > 0)
- portnum = aconf->port;
+ aconf = find_me ();
+ if (aconf) {
+ if (portarg <= 0 && aconf->port > 0)
+ portnum = aconf->port;
+ } else {
+ /* No me{} block — use defaults */
+ if (portarg <= 0)
+ portnum = 6667;
+ }
Debug ((DEBUG_ERROR, "Port = %d", portnum));
- if (inetport (&me, aconf->passwd, portnum))
+ if (inetport (&me, aconf ? aconf->passwd : "*", portnum))
exit (1);
+
+ /* If no allow{} blocks exist, add a default allow-all */
+ {
+ aConfItem *tmp;
+ int has_allow = 0;
+ for (tmp = conf; tmp; tmp = tmp->next)
+ if (tmp->status & CONF_CLIENT) { has_allow = 1; break; }
+ if (!has_allow) {
+ aConfItem *defallow = make_conf ();
+ defallow->status = CONF_CLIENT;
+ DupString (defallow->host, "*@*");
+ DupString (defallow->passwd, "");
+ DupString (defallow->name, "*@*");
+ Class (defallow) = find_class (0);
+ defallow->next = conf;
+ conf = defallow;
+ }
+ }
}
else if (inetport (&me, "*", 0))
exit (1);
is_hub = 0;
Debug ((DEBUG_DEBUG, "initconf(): ircd.conf = %s", configfile));
- if ((fd = openconf ()) == -1)
- return -1;
+ if ((fd = openconf ()) == -1) {
+ (void) fprintf (stderr,
+ "WARNING: No configuration file found (%s)\n"
+ " Running with defaults (listening on *:6667)\n",
+ configfile);
+ return 0;
+ }
filebuf = conf_read_file (fd);
(void) close (fd);
{RPL_MAPMORE, ":%s%-*s --> *more*"},
/* 616 */
{RPL_POLICY,
- ":Welcome to the Serenity-IRC network \2%s\2! Using Serenity-IRC constitutes agreement with our Acceptable Use Policy. You may view our policy at http://www.serenity-irc.net/aup"},
+ ":Welcome to the %s network \2%s\2! Using %s constitutes agreement with our Acceptable Use Policy. You may view our policy at %s"},
/* 617 */
{ERR_HTCTOOFAST,
":You are sending too fast. Please wait %i seconds before sending new commands."},
(void) m_lusers (sptr, sptr, 1, parv);
update_load ();
(void) m_motd (sptr, sptr, 1, parv);
- sendto_one (sptr, rpl_str (RPL_POLICY), me.name, parv[0], parv[0]);
+ if (cfg_network_aup[0])
+ sendto_one (sptr, rpl_str (RPL_POLICY), me.name, parv[0],
+ cfg_network_name, parv[0], cfg_network_name,
+ cfg_network_aup);
/*
* Now send a numeric to the user telling them what, if
* anything, happened.
return f'# Unrecognized G-line option: {host}'
elif linetype == 'F' or linetype == 'f':
- # F:minutes
+ # F:minutes (zline time)
if host:
- return f'general {{\n time {host};\n}};'
+ return f'limits {{\n zlinetime {host};\n}};'
return ''
elif linetype == 'S' or linetype == 's':
print()
print(block)
+ # Emit default network/limits/general blocks for settings that
+ # were formerly compile-time defines. The admin should review
+ # and adjust these values for their network.
+ print()
+ print('# Network identity and services (formerly compile-time defines).')
+ print('# Review and adjust these for your network.')
+ print('network {')
+ print(' network Serenity-IRC.Net;')
+ print(' adminchan #help;')
+ print(' randomserv irc.serenity-irc.net;')
+ print(' website "http://www.serenity-irc.net";')
+ print(' aup "http://www.serenity-irc.net/aup/";')
+ print(' kline_address kline@serenity-irc.net;')
+ print(' services_name Services.Serenity-IRC.Net;')
+ print(' chanserv ChanServ;')
+ print(' nickserv NickServ;')
+ print(' memoserv MemoServ;')
+ print(' operserv OperServ;')
+ print(' webserv WebServ;')
+ print(' ircop_host IRCop.Serenity-IRC.Net;')
+ print(' admin_host Admin.Serenity-IRC.Net;')
+ print(' locop_host Local.Serenity-IRC.Net;')
+ print(' sadmin_host ServOp.Serenity-IRC.Net;')
+ print(' sroot_host SRA.Serenity-IRC.Net;')
+ print(' netadmin_host NetAdmin.Serenity-IRC.Net;')
+ print(' mask_prefix Serene;')
+ print(' x_prefix Serene;')
+ print('};')
+ print()
+ print('# Tuning limits (formerly compile-time defines).')
+ print('limits {')
+ print(' maxchannels 10;')
+ print(' nickdelay 30;')
+ print(' targetdelay 120;')
+ print(' clientflood 6000;')
+ print(' maxsendq 3000000;')
+ print(' bufferpool 27000000;')
+ print(' listenqueue 5;')
+ print(' htctime 5;')
+ print(' htctrigger 15;')
+ print(' clonelimit 3;')
+ print(' cloneperiod 15;')
+ print(' clonedelay 300;')
+ print(' zlinetime 1;')
+ print('};')
+ print()
+ print('# Feature toggles (formerly compile-time defines).')
+ print('general {')
+ print(' # hub yes;')
+ print(' throttle yes;')
+ print(' seeuserstats yes;')
+ print(' crypt_oper_password yes;')
+ print(' crypt_iline_password yes;')
+ print('};')
+
if __name__ == '__main__':
main()