diff --git a/Changes b/Changes index 34c7a89b9..612f424c8 100644 --- a/Changes +++ b/Changes @@ -20,7 +20,7 @@ * */ -[ Unreal3.2 ] +[ Unreal3.2-Selene ] - Fixed a _serious_ bug in SERVER command, reported by Valen, Forrester, M0rpheus, JK, and Hiten. - Fixed /botserv problem @@ -59,6 +59,23 @@ - Added TODO in top of s_conf2.c - Fixed a bug reported by S7 that affected chg* and set* as well as sdesc - Started work on the except parser +- Made except parser use a specialized _configflag_except instead of wasting + a byte. +- Changed version to "Unreal3.2-Selene" (Selene = female character in a + comic mag i found at my grandmas :P) +- Finished _conf_vhost +- Made _conf_listen understand listen {} +- Finished _conf_link +- Added some _conf_link validity and added ->class option (forgot it) +- Made ircd.c use the newconf with me.* setup. Uses the first and the best + as listener +- Finished _conf_ban (try and attack us now idiots!) +- Made "No response from", use GLOBOPS instead of GNOTICE. + Fixes TODO Bugfixes Thu Dec 14 2000 Priority 10 added by Stskeeps +- Fixed telnet close server thing, fixes Wed 20 Dec 2000 priority 9, + added by codemastr +- Fixed /whois shows what channels +S are in. + Closes stskeeps/Dec30-2000-10-Bugfixes ======= - Fixed a STATS_ONLYOPER bug - Fixed a ircd.tune bug (the file may not write if it didn't exist) - Fixed a serious bug reported by Kanzen_Griever diff --git a/TODO b/TODO index e4c42b690..028970989 100644 --- a/TODO +++ b/TODO @@ -3,8 +3,20 @@ TODO for Unreal Next: Write in entries in this form: ============================== -* nick - date - priority - [ title ]: +* nick - date - priority - [ title ] Flag: description + +Flags: + CLOSED + = Bug/Idea fixed/implemented. Bug/Idea is up for deletion + OPEN + = Bug/Idea up for fixing + IN-REPAIR + = Bug/Idea In Progress/Repair by + NO-PRODUCE + = Bug/Idea is not able to be (re)produced + POSTPONED + = Bug/Idea is scheduled for another release/time If you think that a priority should be higher, make it++ @@ -13,31 +25,32 @@ If you think that a priority should be higher, make it++ TODO : ---- -* stskeeps - Tue Dec 12 2000 - 1 - [ IPv6 ]: +* stskeeps - Tue Dec 12 2000 - 1 - [ IPv6 ] OPEN: Add IPv6 compatiblity (requested by many people). Must allow :'s in hostnames, will kill backwards compatiblity when IPv6 is enabled -* stskeeps - Tue Dec 12 2000 - 1 - [ Code ] : +* stskeeps - Tue Dec 12 2000 - 1 - [ Code ] OPEN: Split up code, and make the placement of functions more logic -* codemastr - Tue Dec 12 2000 - 4 - [ Zip_Links ]: +* codemastr - Tue Dec 12 2000 - 4 - [ Zip_Links ] OPEN: Actually add this since it was planned for 3.0 -* codemastr - Tue Dec 12 2000 - 5 - [ Dynconf Recode ]: +* codemastr - Tue Dec 12 2000 - 5 - [ Dynconf Recode ] IN-REPAIR stskeeps: Dynconf has a bunch of bugs that can be resolved with a recode + We are doing this with the newconf :) -stskeeps * codemastr - Tue Dec 12 2000 - 8 - [ +I Fixes ]: +I still has some bugs that may cause desync and show users that the +I user is actually on the channel. -* stskeeps - Tue Dec 12 2000 - 1 - [ Bugfixes/Hash ]: +* stskeeps - Tue Dec 12 2000 - 1 - [ Bugfixes/Hash ] CLOSED stskeeps: Check for possible hash bug with del_from_client_table or something People still complain about crashes We might have fixed this with recent SERVER passwd fix and other passwd fixes -* stskeeps - Wed Dec 13 2000 - 10 - [ Bugfixes ]: +* stskeeps - Wed Dec 13 2000 - 10 - [ Bugfixes ] NO-PRODUCE: [[r00t3d](~lok70@168.213.226.rox-62220)] The other one, is lets say you are on server (a), and you set +p to your channel. All the users on Server (b,c, etc..) when they do a /list can see the +p channel in the @@ -76,7 +89,8 @@ me InTe[_:#roxnet> -oxygen.phrozen.org- *** Global -- from Irc.LinuxFreakz.Net: No response from dumper.roxnet.org[130.240.202.121], closing link - Users can see that using +g ??? + Users can see that using +g ??? + FIXED: Sat Dec 30 2000 by stskeeps * stskeeps - Fri Dec 14 2000 - 1 - [ SSL ] Challenge/Response kind of thing. @@ -113,7 +127,8 @@ InTe[_:#roxnet> -oxygen.phrozen.org- *** Global -- from Irc.LinuxFreakz.Net: * stskeeps - Sun 17 Dec 2000 - 1 - [ General ] P:ip:W:*:port - UnrealHTTPD! + UnrealHTTPD! + Sat 30 Dec 2000 - stskeeps - *cough* listen::option http ;) * codemastr - Wed 20 Dec 2000 - 3 - [ General ] @@ -127,7 +142,9 @@ InTe[_:#roxnet> -oxygen.phrozen.org- *** Global -- from Irc.LinuxFreakz.Net: connect to a server, /oper, then run telnet and link a server. Close the telnet but do NOT send a SQUIT, the server displays no notice to opers that the server split. - Stskeeps> +j? but yes, there's a bug there + Stskeeps> +j? but yes, there's a bug there + + FIXED Sat 30 Dec 2000 by Stskeeps * stskeeps - Sat Dec 23 2000 - 10 - [ Bugfixes ] There's some kind of bug that shows people being on same channel @@ -135,5 +152,12 @@ InTe[_:#roxnet> -oxygen.phrozen.org- *** Global -- from Irc.LinuxFreakz.Net: [ Stskeeps ] [@ChanServ ] [@Fresh-Prin] [ Fresh-Prin] [@Fresh-Prin] Same person +* codemastr - Tue Dec 26 2000 - 6 - [ Bugfixes ] + (too lazy to type it out) + http://sourceforge.net/bugs/?func=detailbug&bug_id=126645&group_id=1968 + That fix will work except it needs to be modified so it checks remote + before denying because of not being oper +* stskeeps - Sun Dec 30 2000 - 10 - [ Bugfixes ] + /whois shows what channels +S are in * codemastr - Tue Jan 03 2001 - 1 - [ Idea ] Add /kill logging option suggested by Cerb diff --git a/include/h.h b/include/h.h index 7e578f014..59ce5dac6 100644 --- a/include/h.h +++ b/include/h.h @@ -43,6 +43,26 @@ extern TS TSoffset; /* Prototype added to force errors -- Barubary */ extern TS check_pings(TS now, int check_kills); extern TS TS2ts(char *s); +/* newconf */ +/* + * Configuration linked lists +*/ +extern ConfigItem_me *conf_me; +extern ConfigItem_class *conf_class; +extern ConfigItem_admin *conf_admin; +extern ConfigItem_drpass *conf_drpass; +extern ConfigItem_ulines *conf_ulines; +extern ConfigItem_tld *conf_tld; +extern ConfigItem_oper *conf_oper; +extern ConfigItem_listen *conf_listen; +extern ConfigItem_allow *conf_allow; +extern ConfigItem_except *conf_except; +extern ConfigItem_vhost *conf_vhost; +extern ConfigItem_link *conf_link; + +ConfigItem_class *Find_class(char *name); +ConfigItem_oper *Find_oper(char *name); +ConfigItem_listen *Find_listen(char *ipmask, int port); /* Remmed out for win32 compatibility.. as stated of 467leaf win32 port.. */ diff --git a/include/struct.h b/include/struct.h index 1bbc900b8..f9f353ac3 100644 --- a/include/struct.h +++ b/include/struct.h @@ -68,7 +68,9 @@ typedef struct ConfItem aConfItem; /* New Config Stuff */ typedef struct _configentry ConfigEntry; typedef struct _configfile ConfigFile; -typedef struct _configflag ConfigFlag; +typedef struct _configflag ConfigFlag; +typedef struct _configflag_except ConfigFlag_except; +typedef struct _configflag_ban ConfigFlag_ban; typedef struct _configitem ConfigItem; typedef struct _configitem_me ConfigItem_me; typedef struct _configitem_admin ConfigItem_admin; @@ -82,7 +84,9 @@ typedef struct _configitem_listen ConfigItem_listen; typedef struct _configitem_allow ConfigItem_allow; typedef struct _configitem_vhost ConfigItem_vhost; typedef struct _configitem_except ConfigItem_except; - +typedef struct _configitem_link ConfigItem_link; +typedef struct _configitem_ban ConfigItem_ban; + typedef struct Notify aNotify; typedef struct Client aClient; typedef struct Channel aChannel; @@ -892,11 +896,6 @@ struct Client { */ /* Config flags */ -#define CNF_ME 0x000001 -#define CNF_ADMIN 0x000002 -#define CNF_CLASS 0x000004 -#define CNF_ALLOW 0x000008 -#define CNF_OPER 0x000010 struct _configfile { @@ -928,6 +927,26 @@ struct _configflag { unsigned temporary : 1; }; + +/* configflag specialized for except socks/ban -Stskeeps */ + +struct _configflag_except +{ + unsigned temporary : 1; + unsigned type : 1; +}; + +struct _configflag_ban +{ + unsigned temporary : 1; + unsigned type : 4; +}; + +#define CONF_BAN_NICK 1 +#define CONF_BAN_IP 2 +#define CONF_BAN_SERVER 3 +#define CONF_BAN_USER 4 +#define CONF_BAN_REALNAME 5 struct _configitem { ConfigFlag flag; @@ -1033,12 +1052,38 @@ struct _configitem_vhost { char *password; char *virthost; }; + +struct _configitem_link { + ConfigFlag flag; + ConfigItem *prev; + ConfigItem *next; + char *servername; + char *username; + char *hostname; + char *bindip; + short port; + char *hubmask; + char *leafmask; + unsigned char leafdepth; + char *connpwd; + char *recvpwd; + ConfigItem_class *class; + short options; +}; + struct _configitem_except { ConfigFlag flag; ConfigItem *prev; ConfigItem *next; - unsigned type :1; char *mask; +}; + +struct _configitem_ban { + ConfigFlag_ban flag; + ConfigItem *prev; + ConfigItem *next; + char *mask; + char *reason; }; diff --git a/include/version.h b/include/version.h index 159db0e05..09cbcd754 100644 --- a/include/version.h +++ b/include/version.h @@ -25,13 +25,13 @@ /**/ #define COMPILEINFO DEBUGMODESET DEBUGSET /* - * Version Unreal3.1-Silverheart+sf2 + * Version Unreal3.2-Selene */ -#define UnrealProtocol 2302 +#define UnrealProtocol 2303 #define PATCH1 "3" -#define PATCH2 ".1" -#define PATCH3 ".1" -#define PATCH4 "-Darkshades" +#define PATCH2 ".2" +#define PATCH3 "-Selene" +#define PATCH4 "[DEVEL]" #define PATCH5 "" #define PATCH6 "" #define PATCH7 "" diff --git a/src/ircd.c b/src/ircd.c index 9c7a93831..636634ae3 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -617,7 +617,7 @@ extern TS check_pings(TS currenttime, int check_kills) ("No response from %s, closing link", get_client_name(cptr, FALSE)); sendto_serv_butone(&me, - ":%s GNOTICE :No response from %s, closing link", + ":%s GLOBOPS :No response from %s, closing link", me.name, get_client_name(cptr, FALSE)); } @@ -1082,17 +1082,16 @@ int InitwIRCD(argc, argv) #endif exit(-1); } - if (1) - { - aConfItem *aconf; - - if ((aconf = find_me()) && portarg <= 0 && aconf->port > 0) - portnum = aconf->port; - Debug((DEBUG_ERROR, "Port = %d", portnum)); - if (inetport(&me, aconf->passwd, portnum)) - exit(1); - } - else if (inetport(&me, "*", 0)) + /* Put in our info */ + strncpyzt(me.info, conf_me->info, sizeof(me.info); + strncpyzt(me.name, conf_me->name, sizeof(me.name); + + /* We accept the first listen record */ + portnum = conf_listen->port; + me.ip.S_ADDR = *conf_listen->ip != '*' ? inet_addr(conf_listen->ip) : INADDR_ANY; + + Debug((DEBUG_ERROR, "Port = %d", portnum)); + if (inetport(&me, conf_listen->ip, portnum)) exit(1); botmotd = (aMotd *) read_botmotd(BPATH); rules = (aMotd *) read_rules(RPATH); @@ -1108,12 +1107,13 @@ int InitwIRCD(argc, argv) me.confs = NULL; me.next = NULL; me.user = NULL; - me.from = &me; + me.from = &me; #ifdef SOCKSPORT me.socksfd = -1; #endif me_hash = find_or_add(me.name); - me.serv->up = me_hash; + me.serv->up = me_hash; + me.serv->numeric = conf_me->numeric; add_server_to_table(&me); me.lasttime = me.since = me.firsttime = TStime(); (void)add_to_client_hash_table(me.name, &me); diff --git a/src/s_bsd.c b/src/s_bsd.c index edb687d70..9f2d5d30b 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -223,6 +223,43 @@ void report_error(text, cptr) #endif return; } + +void report_baderror(text, cptr) + char *text; + aClient *cptr; +{ +#ifndef _WIN32 + int errtmp = errno; /* debug may change 'errno' */ +#else + int errtmp = WSAGetLastError(); /* debug may change 'errno' */ +#endif + char *host; + int err, len = sizeof(err); + + host = (cptr) ? get_client_name(cptr, FALSE) : ""; + +/* fprintf(stderr, text, host, strerror(errtmp)); + fputc('\n', stderr); */ + Debug((DEBUG_ERROR, text, host, strerror(errtmp))); + + /* + * Get the *real* error from the socket (well try to anyway..). + * This may only work when SO_DEBUG is enabled but its worth the + * gamble anyway. + */ +#ifdef SO_ERROR + if (cptr && !IsMe(cptr) && cptr->fd >= 0) + if (!getsockopt(cptr->fd, SOL_SOCKET, SO_ERROR, + (OPT_TYPE *)&err, &len)) + if (err) + errtmp = err; +#endif + sendto_umode(UMODE_OPER, text, host, strerror(errtmp)); +#ifdef USE_SYSLOG + syslog(LOG_WARNING, text, host, strerror(errtmp)); +#endif + return; +} /* * inetport @@ -2225,7 +2262,7 @@ int read_message(delay, listp) me.name, get_client_name(cptr, FALSE)); } else - report_error("Lost connection to %s:%s", cptr); + report_baderror("Lost connection to %s:%s", cptr); } if (length != FLUSH_BUFFER) (void)exit_client(cptr, cptr, &me, diff --git a/src/s_conf2.c b/src/s_conf2.c index 2e8d4cc43..1f429af82 100644 --- a/src/s_conf2.c +++ b/src/s_conf2.c @@ -44,20 +44,16 @@ /* * TODO: - * - link {} parser - * - ban [realname, server, nick, ip, user] {} parser - * - except [socks, ban] {} parser added (somewhat) - * - vhost {} parser * - allow channel {} (chrestrict) * - deny channel {} (chrestrict) * - deny version {} (V:lines) * - deny dcc {} (dccdeny) * - set {} lines (unrealircd.conf, network files) * - allow {} connfreq (Y:lines) - * - listen {} must work * - converter */ - +#define ircdupstr(x,y) if (x) MyFree(x); x = strdup(y) +#define ircstrdup ircdupstr typedef struct _confcommand ConfigCommand; struct _confcommand { @@ -76,33 +72,39 @@ struct _conf_operflag /* * Top-level configuration commands -Stskeeps */ -int _conf_admin (ConfigFile *conf, ConfigEntry *ce); -int _conf_me (ConfigFile *conf, ConfigEntry *ce); -int _conf_oper (ConfigFile *conf, ConfigEntry *ce); -int _conf_class (ConfigFile *conf, ConfigEntry *ce); +int _conf_admin (ConfigFile *conf, ConfigEntry *ce); +int _conf_me (ConfigFile *conf, ConfigEntry *ce); +int _conf_oper (ConfigFile *conf, ConfigEntry *ce); +int _conf_class (ConfigFile *conf, ConfigEntry *ce); int _conf_drpass (ConfigFile *conf, ConfigEntry *ce); int _conf_ulines (ConfigFile *conf, ConfigEntry *ce); int _conf_include (ConfigFile *conf, ConfigEntry *ce); -int _conf_tld (ConfigFile *conf, ConfigEntry *ce); +int _conf_tld (ConfigFile *conf, ConfigEntry *ce); int _conf_listen (ConfigFile *conf, ConfigEntry *ce); -int _conf_allow (ConfigFile *conf, ConfigEntry *ce); +int _conf_allow (ConfigFile *conf, ConfigEntry *ce); int _conf_except (ConfigFile *conf, ConfigEntry *ce); - +int _conf_vhost (ConfigFile *conf, ConfigEntry *ce); +int _conf_link (ConfigFile *conf, ConfigEntry *ce); +int _conf_ban (ConfigFile *conf, ConfigEntry *ce); + extern int conf_debuglevel; -static ConfigCommand _ConfigCommands[] = { - { "admin", _conf_admin }, - { "me", _conf_me }, - { "oper", _conf_oper }, - { "class", _conf_class }, +static ConfigCommand _ConfigCommands[] = { + { "admin", _conf_admin }, + { "me", _conf_me }, + { "oper", _conf_oper }, + { "class", _conf_class }, { "drpass", _conf_drpass }, { "ulines", _conf_ulines }, { "include", _conf_include }, - { "tld", _conf_tld }, + { "tld", _conf_tld }, { "listen", _conf_listen }, - { "allow", _conf_allow }, - { "except", _conf_except }, - { NULL, NULL } + { "allow", _conf_allow }, + { "except", _conf_except }, + { "vhost", _conf_vhost }, + { "link", _conf_link }, + { "ban", _conf_ban }, + { NULL, NULL } }; static OperFlag _OperFlags[] = { @@ -148,7 +150,13 @@ static OperFlag _ListenerFlags[] = { { LISTENER_SSL, "ssl"}, { 0L, NULL }, }; - + +static OperFlag _LinkFlags[] = { + { 0x0001, "autoconnect" }, + { 0x0002, "ssl" }, + { 0x0004, "zip" } +}; + /* * Some prototypes */ @@ -160,12 +168,6 @@ static ConfigFile *config_parse(char *filename, char *confdata); static void config_entry_free(ConfigEntry *ceptr); int ConfigParse(ConfigFile *cfptr); -/* Lookup prototypes, to be moved to some .h */ -ConfigItem_class *Find_class(char *name); -ConfigItem_oper *Find_oper(char *name); -ConfigItem_listen *Find_listen(char *ipmask, int port); - - /* * Configuration linked lists */ @@ -179,7 +181,9 @@ ConfigItem_oper *conf_oper = NULL; ConfigItem_listen *conf_listen = NULL; ConfigItem_allow *conf_allow = NULL; ConfigItem_except *conf_except = NULL; - +ConfigItem_vhost *conf_vhost = NULL; +ConfigItem_link *conf_link = NULL; +ConfigItem_ban *conf_ban = NULL; /* * MyMalloc with the only difference that it clears the memory too * -Stskeeps @@ -263,7 +267,7 @@ static void config_status(char *format, ...) va_end(ap); if ((ptr = strchr(buffer, '\n')) != NULL) *ptr = '\0'; - fprintf(stderr, "%s\n", buffer); + fprintf(stderr, "* %s\n", buffer); } /* This is the internal parser, made by Chris Behrens & Fred Jacobs */ static ConfigFile *config_parse(char *filename, char *confdata) @@ -742,7 +746,7 @@ int _conf_admin(ConfigFile *conf, ConfigEntry *ce) continue; } ca = MyMallocEx(sizeof(ConfigItem_admin)); - ca->line = strdup(cep->ce_varname); + ircstrdup(ca->line, cep->ce_varname); add_ConfigItem((ConfigItem *)ca, (ConfigItem **) &conf_admin); } } @@ -765,7 +769,7 @@ int _conf_ulines(ConfigFile *conf, ConfigEntry *ce) continue; } ca = MyMallocEx(sizeof(ConfigItem_ulines)); - ca->servername = strdup(cep->ce_varname); + ircstrdup(ca->servername, cep->ce_varname); add_ConfigItem((ConfigItem *)ca, (ConfigItem **) &conf_ulines); } } @@ -789,7 +793,7 @@ int _conf_class(ConfigFile *conf, ConfigEntry *ce) if (!(class = Find_class(ce->ce_vardata))) { class = (ConfigItem_class *) MyMallocEx(sizeof(ConfigItem_class)); - class->name = strdup(ce->ce_vardata); + ircstrdup(class->name, ce->ce_vardata); isnew = 1; } else @@ -884,7 +888,7 @@ int _conf_me(ConfigFile *conf, ConfigEntry *ce) { if (conf_me->name) MyFree(conf_me->name); - conf_me->name = strdup(cep->ce_vardata); + ircstrdup(conf_me->name, cep->ce_vardata); if (!strchr(conf_me->name, '.')) { config_error("%s:%i: illegal me::name, missing .", @@ -985,7 +989,7 @@ int _conf_oper(ConfigFile *conf, ConfigEntry *ce) } else if (!strcmp(cep->ce_varname, "password")) { - oper->password = strdup(cep->ce_vardata); + ircstrdup(oper->password, cep->ce_vardata); if (!(*oper->password)) { config_error("%s:%i: illegal password, please write something", @@ -1055,7 +1059,7 @@ int _conf_oper(ConfigFile *conf, ConfigEntry *ce) if (!strcmp(cepp->ce_varname, "userhost")) { from = (ConfigItem_oper_from *)MyMallocEx(sizeof(ConfigItem_oper_from)); - from->name = strdup(cepp->ce_vardata); + ircstrdup(from->name, cepp->ce_vardata); add_ConfigItem((ConfigItem *) from, (ConfigItem **)&oper->from); } else @@ -1111,6 +1115,7 @@ int _conf_drpass(ConfigFile *conf, ConfigEntry *ce) if (conf_drpass->restart) MyFree(conf_drpass->restart); conf_drpass->restart = strdup(cep->ce_vardata); + ircstrdup(conf_drpass->restart, cep->ce_vardata); } else if (!strcmp(cep->ce_varname, "die")) { @@ -1190,21 +1195,30 @@ int _conf_listen(ConfigFile *conf, ConfigEntry *ce) } strcpy(copy, ce->ce_vardata); - ip = strtok(copy, ":"); - if (!ip) - { - config_error("%s:%i: listen: illegal ip:port mask", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); - return -1; - } - if (strchr(ip, '*') && strcmp(ip, "*")) - { - config_error("%s:%i: listen: illegal ip, (mask, and not '*')", - ce->ce_fileptr->cf_filename, ce->ce_varlinenum); - return -1; + /* Seriously cheap hack to make listen work -Stskeeps */ + if (!strcmp(copy, my_itoa(atoi(copy))) + { + ip = "*"; + port = copy; + } + else + { + ip = strtok(copy, ":"); + if (!ip) + { + config_error("%s:%i: listen: illegal ip:port mask", + ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + return -1; + } + if (strchr(ip, '*') && strcmp(ip, "*")) + { + config_error("%s:%i: listen: illegal ip, (mask, and not '*')", + ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + return -1; - } - port = strtok(NULL, ":"); + } + port = strtok(NULL, ":"); + } if (!port) { config_error("%s:%i: listen: missing port in mask", @@ -1302,7 +1316,6 @@ int _conf_allow(ConfigFile *conf, ConfigEntry *ce) allow = (ConfigItem_allow *) MyMallocEx(sizeof(ConfigItem_allow)); isnew = 1; - for (cep = ce->ce_entries; cep; cep = cep->ce_next) { if (!cep->ce_varname) @@ -1355,6 +1368,59 @@ int _conf_allow(ConfigFile *conf, ConfigEntry *ce) if (isnew) add_ConfigItem((ConfigItem *) allow, (ConfigItem **) &conf_allow); } + +/* + * vhost {} block parser +*/ +int _conf_vhost(ConfigFile *conf, ConfigEntry *ce) +{ + ConfigEntry *cep; + ConfigItem_vhost *vhost; + unsigned char isnew = 0; + + vhost = (ConfigItem_vhost *) MyMallocEx(sizeof(ConfigItem_vhost)); + isnew = 1; + for (cep = ce->ce_entries; cep; cep = cep->ce_next) + { + if (!cep->ce_varname) + { + config_error("%s:%i: vhost item without variable name", + cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + continue; + } + if (!cep->ce_vardata) + { + config_error("%s:%i: vhost item without parameter", + cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + continue; + } + if (!strcmp(cep->ce_varname, "vhost")) + { + vhost->virthost = strdup(cep->ce_vardata); + } else + if (!strcmp(cep->ce_varname, "userhost")) + { + vhost->userhost = strdup(cep->ce_vardata); + } else + if (!strcmp(cep->ce_varname, "login")) + { + vhost->login = strdup(cep->ce_vardata); + } else + if (!strcmp(cep->ce_varname, "password")) + { + vhost->password = strdup(cep->ce_vardata); + } else + else + { + config_error("%s:%i: unknown directive vhost::%s", + cep->ce_fileptr->cf_filename, cep->ce_varlinenum, + cep->ce_varname); + continue; + } + } + if (isnew) + add_ConfigItem((ConfigItem *) vhost, (ConfigItem **) &conf_vhost); +} int _conf_except(ConfigFile *conf, ConfigEntry *ce) { @@ -1385,7 +1451,7 @@ int _conf_except(ConfigFile *conf, ConfigEntry *ce) cep->ce_varname); } } - ca->type = 1; + ca->flag.type = 1; add_ConfigItem((ConfigItem *)ca, (ConfigItem **) &conf_except); } else if (!strcmp(ce->ce_vardata, "socks")) { @@ -1401,7 +1467,7 @@ int _conf_except(ConfigFile *conf, ConfigEntry *ce) cep->ce_varname); } } - ca->type = 0; + ca->flag.type = 0; add_ConfigItem((ConfigItem *)ca, (ConfigItem **) &conf_except); } @@ -1411,6 +1477,201 @@ int _conf_except(ConfigFile *conf, ConfigEntry *ce) ce->ce_vardata); } } + +int _conf_ban(ConfigFile *conf, ConfigEntry *ce) +{ + + ConfigEntry *cep; + ConfigItem_ban *ca; + unsigned char isnew = 0; + + ca = (ConfigItem_ban *) MyMallocEx(sizeof(ConfigItem_ban)); + isnew = 1; + + if (!ce->ce_vardata) + { + config_error("%s:%i: ban without type", + ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + return -1; + } + if (!strcmp(ce->ce_vardata, "nick")) + ca->flag.type = CONF_BAN_NICK; + else if (!strcmp(ce->ce_vardata, "ip")) + ca->flag.type = CONF_BAN_IP; + else if (!strcmp(ce->ce_vardata, "server")) + ca->flag.type = CONF_BAN_SERVER; + else if (!strcmp(ce->ce_vardata, "user")) + ca->flag.type = CONF_BAN_USER; + else if (!strcmp(ce->ce_vardata, "realname")) + ca->flag.type = CONF_BAN_REALNAME; + else + { + MyFree(ca); + config_error("%s:%i: unknown ban type %s", + ce->ce_fileptr->cf_filename, ce->ce_varlinenum, + ce->ce_vardata); + return -1; + } + + for (cep = ce->ce_entries; cep; cep = cep->ce_next) + { + if (!cep->ce_vardata) + { + config_error("%s:%i: ban %s::%s without parameter", + cep->ce_fileptr->cf_filename, + cep->ce_varlinenum, ce->ce_vardata, cep->ce_varname); + continue; + } + if (!strcmp(cep->ce_varname, "mask")) { + ca->mask = strdup(cep->ce_vardata); + } else + if (!strcmp(cep->ce_varname, "reason")) { + ca->reason = strdup(cep->ce_vardata); + } + else { + config_error("%s:%i: unknown directive ban %s::%s", + cep->ce_fileptr->cf_filename, cep->ce_varlinenum, + ce->ce_vardata, cep->ce_varname); + } + } + add_ConfigItem((ConfigItem *)ca, (ConfigItem **) &conf_ban); +} + +int _conf_link(ConfigFile *conf, ConfigEntry *ce) +{ + ConfigEntry *cep; + ConfigEntry *cepp; + ConfigItem_link *link = NULL; + OperFlag *ofp; + unsigned char isnew = 0; + + if (!ce->ce_vardata) + { + config_error("%s:%i: link without servername", + ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + return -1; + } + + if (!strchr(ce->ce_vardata, '.')) + { + config_error("%s:%i: link: bogus server name", + ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + return -1; + } + + link = (ConfigItem_link *) MyMallocEx(sizeof(ConfigItem_link)); + link->servername = strdup(ce->ce_vardata); + isnew = 1; + + + for (cep = ce->ce_entries; cep; cep = cep->ce_next) + { + if (!cep->ce_varname) + { + config_error("%s:%i: link item without variable name", + cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + continue; + } + if (!cep->ce_vardata && !cep->ce_entries) + { + config_error("%s:%i: link::%s without parameter", + cep->ce_fileptr->cf_filename, + cep->ce_varlinenum, + cep->ce_varname); + continue; + } + if (!strcmp(cep->ce_varname, "options")) + { + for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + { + if (!cepp->ce_varname) + { + config_error("%s:%i: link::flag item without variable name", + cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum); + continue; + } + for (ofp = _LinkFlags; ofp->name; ofp++) + { + if (!strcmp(ofp->name, cepp->ce_varname)) + { + if (!(link->options & ofp->flag)) + link->options |= ofp->flag; + break; + } + } + if (!ofp->name) + { + config_error("%s:%i: unknown link option '%s'", + cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum, + cepp->ce_varname); + continue; + } + } + } else + if (!strcmp(cep->ce_varname, "username")) + { + link->username = strdup(cep->ce_vardata); + } else + if (!strcmp(cep->ce_varname, "hostname")) + { + link->hostname = strdup(cep->ce_vardata); + } else + if (!strcmp(cep->ce_varname, "bind-ip")) + { + link->bindip = strdup(cep->ce_vardata); + } else + if (!strcmp(cep->ce_varname, "port")) + { + link->port = atol(cep->ce_vardata); + if ((link->port < 0) || (link->port > 65535)) + { + config_error("%s:%i: link: illegal port (must be 0..65536)", + ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + } + } else + if (!strcmp(cep->ce_varname, "hub")) + { + link->hubmask = strdup(cep->ce_vardata); + } else + if (!strcmp(cep->ce_varname, "leaf")) + { + link->leafmask = strdup(cep->ce_vardata); + } else + if (!strcmp(cep->ce_varname, "leafdepth")) + { + link->leafdepth = atol(cep->ce_vardata); + } else + if (!strcmp(cep->ce_varname, "password-connect")) + { + link->connpwd = strdup(cep->ce_vardata); + } else + if (!strcmp(cep->ce_varname, "password-recieve")) + { + link->recvpwd = strdup(cep->ce_vardata); + } else + if (!strcmp(cep->ce_varname, "class")) + { + link->class = Find_class(cep->ce_vardata); + if (!link->class) + { + config_error("%s:%i: illegal link::class, unknown class '%s'", + cep->ce_fileptr->cf_filename, + cep->ce_varlinenum, + cep->ce_vardata); + } + } else + { + config_error("%s:%i: unknown directive link::%s", + cep->ce_fileptr->cf_filename, cep->ce_varlinenum, + cep->ce_varname); + continue; + } + + } + if (isnew) + add_ConfigItem((ConfigItem *)link, (ConfigItem **)&conf_link); +} + /* * Report functions diff --git a/unrealircd.conf b/unrealircd.conf index 2bd8974bc..7978a42cb 100644 --- a/unrealircd.conf +++ b/unrealircd.conf @@ -1,5 +1,3 @@ - - /* * UnrealIRCd Config File - Example for irc.fyremoon.net */ @@ -72,15 +70,16 @@ link irc.hs-bremen.de hostname 194.94.24.40; bind-ip *; port 7151; - hub *; - + hub *; // - We don't want this on right now - // leaf *; - password { - connect "tdx6667"; - recieve "tdx6667"; - }; - flags { + // leaf *; + // leaf-depth 2; + password-connect "tdx6667"; + password-recieve "tdx6667"; + /* for later: class-connect, class-recieve */ + class servers; + // rsa-auth "path.to.public.key"; + options { autoconnect; ssl; zip; @@ -136,6 +135,63 @@ except ban { except socks { mask 216.73.27.177; }; + +/* Old vhost.conf */ +vhost { + vhost i.hate.microsefrs.com; + userhost *@*.image.dk; + login stskeeps; + password techie; +}; // include "klines.conf"; +// Network configuration +set { + network-name "ROXnet"; + default-server "irc.roxnet.org"; + services-name "services.roxnet.org"; + stats-name "stats.roxnet.org"; + help-channel "#ROXnet"; + hiddenhost-prefix "rox"; + prefix_quit "no"; + /* on-oper host */ + hosts { + local "locop.roxnet.org"; + global "ircop.roxnet.org"; + coadmin "coadmin.roxnet.org"; + admin "admin.roxnet.org"; + servicesadmin "csops.roxnet.org"; + techadmin "techadmin.roxnet.org"; + netadmin "netadmin.roxnet.org"; + host-on-oper-up "no"; + }; +}; + +/* Server specific configuration */ + +set { + kline-address "stskeeps@roxnet.org"; + modes-on-connect "+xwG"; + oper-auto-join "#opers"; + dns { + nameserver 127.0.0.1; + timeout 2s; + retries 2s; + }; + options { + enable-opermotd; + enable-chatops; + hide-ulines; + webtv-support; + identd-check; + }; + + socks { + ban-message "Insecure SOCKS server"; + quit-message "Insecure SOCKS server"; + ban-time "4d"; + }; + maxchannelsperuser 10; + +}; \ No newline at end of file