diff --git a/ChangeLog b/ChangeLog index 9275757..fe60887 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,4 +23,7 @@ Symbols are: (F) - Moved AnonOps Mode char to +A (F) - Only allow channel admins to set +A (anonops) (F) - Channel Mode +O (opers only) -(HP) - Added Patch to fix hardcoded timeouts in s_serv.c \ No newline at end of file +(HP) - Added Patch to fix hardcoded timeouts in s_serv.c +(HP) - Big arse rc2 patch for Hybrid. Sigh. Found a cute bug in hybrid that would allow it to accept any password for /oper though! +(F) - Removed all ifdef HALFOP ANONOP VCHAN defines, as these will be standard in NeoIRCd +(F) - Removed all OANDVcode as its not going to be used at all diff --git a/include/channel.h b/include/channel.h index a0c24bf..15db64e 100644 --- a/include/channel.h +++ b/include/channel.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: channel.h,v 1.3 2002/08/14 16:52:02 fishwaldo Exp $ + * $Id: channel.h,v 1.4 2002/08/16 12:05:36 fishwaldo Exp $ */ #ifndef INCLUDED_channel_h @@ -68,24 +68,14 @@ struct Channel #endif dlink_list chanadmins; /* list of Channel Admins */ dlink_list chanops; /* lists of chanops etc. */ -#ifdef REQUIRE_OANDV - dlink_list chanops_voiced; /* UGH I'm sorry */ -#endif -#ifdef HALFOPS dlink_list halfops; -#endif dlink_list voiced; dlink_list peons; /* non ops, just members */ dlink_list deopped; /* users deopped on sjoin */ dlink_list locchanadmins; /* local versions of the above */ dlink_list locchanops; /* local versions of the above */ -#ifdef REQUIRE_OANDV - dlink_list locchanops_voiced; /* UGH I'm sorry */ -#endif -#ifdef HALFOPS dlink_list lochalfops; -#endif dlink_list locvoiced; dlink_list locpeons; /* ... */ @@ -117,9 +107,7 @@ extern int can_join(struct Client *source_p, struct Channel *chptr, extern int is_chan_op (struct Channel *chptr,struct Client *who); extern int is_chan_admin (struct Channel *chptr, struct Client *who); extern int is_any_op (struct Channel *chptr,struct Client *who); -#ifdef HALFOPS extern int is_half_op (struct Channel *chptr,struct Client *who); -#endif extern int is_voiced (struct Channel *chptr,struct Client *who); extern dlink_node *find_user_link (dlink_list *, struct Client *); diff --git a/include/channel_mode.h b/include/channel_mode.h index 9521011..10cd2da 100644 --- a/include/channel_mode.h +++ b/include/channel_mode.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: channel_mode.h,v 1.3 2002/08/14 16:52:02 fishwaldo Exp $ + * $Id: channel_mode.h,v 1.4 2002/08/16 12:05:36 fishwaldo Exp $ */ @@ -49,9 +49,7 @@ extern void set_channel_mode(struct Client *, struct Client *, struct Channel *, int, char **, char *); -#ifdef ANONOPS extern void sync_channel_oplists(struct Channel *, int); -#endif extern void set_channel_mode_flags( char flags_ptr[4][2], struct Channel *chptr, @@ -124,20 +122,22 @@ extern void unset_chcap_usage_counts(struct Client *serv_p); struct ChModeChange { - char letter; - char *arg, *id; - int caps, nocaps, mems; - struct Client *client; + char letter; + char *arg; + char *id; + int dir; + int caps; + int nocaps; + int mems; + struct Client *client; }; -#ifdef HALFOPS struct ChModeBounce { char letter; char *arg, *id; int dir; }; -#endif struct ChCapCombo { diff --git a/include/numeric.h b/include/numeric.h index 1b64e40..2503ccc 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: numeric.h,v 1.2 2002/08/13 14:45:10 fishwaldo Exp $ + * $Id: numeric.h,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $ */ #ifndef INCLUDED_numeric_h @@ -43,12 +43,23 @@ extern const char* form_str(int); #define RPL_CREATED 003 #define RPL_MYINFO 004 #define RPL_ISUPPORT 005 + /* RPL_BOUNCE IRCnet extension */ +/* RPL_MAP 6 unreal */ +/* RPL_MAPEND 7 unreal */ +/* RPL_SNOMASK 8 Undernet extension */ +/* RPL_STATMEMTOT 9 Undernet extension */ +/* RPL_STATMEM 10 Undernet extension */ + #define RPL_REDIR 10 #define RPL_MAP 15 /* Undernet extension */ #define RPL_MAPMORE 16 /* Undernet extension */ #define RPL_MAPEND 17 /* Undernet extension */ #define RPL_YOURID 20 +/* RPL_YOURID 42 IRCnet extension */ +/* RPL_ATTEMPTINGJUNC 50 aircd extension */ +/* RPL_ATTEMPTINGREROUTE 51 aircd extension */ + /* * Numeric replies from server commands. * These are currently in the range 200-399. @@ -63,10 +74,15 @@ extern const char* form_str(int); #define RPL_TRACENEWTYPE 208 #define RPL_TRACECLASS 209 +/* RPL_STATS 210 aircd extension, used instead of having + multiple stats numerics */ +/* RPL_TRACERECONNECT 210 IRCnet extension */ + #define RPL_STATSLINKINFO 211 #define RPL_STATSCOMMANDS 212 #define RPL_STATSCLINE 213 #define RPL_STATSNLINE 214 +/* RPL_STATSOLDNLINE 214 unreal */ #define RPL_STATSILINE 215 #define RPL_STATSKLINE 216 #define RPL_STATSQLINE 217 @@ -77,16 +93,36 @@ extern const char* form_str(int); * I'm going to steal 220 for now *sigh* * -Dianora */ + #define RPL_STATSPLINE 220 #define RPL_UMODEIS 221 +/* RPL_SQLINE_NICK 222 Numerics List: Dalnet */ +/* RPL_STATSELINE 223 dalnet */ +/* RPL_STATSGLINE 223 unreal */ +/* RPL_STATSFLINE 224 Hybrid extension,Dalnet */ +/* RPL_STATSTLINE 224 unreal */ +/* RPL_STATSDLINE 225 Hybrid extension */ +/* RPL_STATSZLINE 225 Dalnet + RPL_STATSELINE 225 unreal + RPL_STATSCOUNT 226 Dalnet + RPL_STATSNLINE 226 unreal + RPL_STATSGLINE 227 Dalnet + RPL_STATSVLINE 227 unreal */ + #define RPL_STATSFLINE 224 #define RPL_STATSDLINE 225 #define RPL_STATSALINE 226 +/* RPL_RULES 232 unreal */ + #define RPL_SERVLIST 234 #define RPL_SERVLISTEND 235 +/* RPL_STATSIAUTH 239 IRCnet extension */ +/* RPL_STATSVLINE 240 IRCnet extension */ +/* RPL_STATSXLINE 240 austnet */ + #define RPL_STATSLLINE 241 #define RPL_STATSUPTIME 242 #define RPL_STATSOLINE 243 @@ -97,6 +133,7 @@ extern const char* form_str(int); #define RPL_STATSULINE 248 #define RPL_STATSDEBUG 249 #define RPL_STATSCONN 250 +/* RPL_STATSDLINE 250 Numerics List: IRCnet */ #define RPL_LUSERCLIENT 251 #define RPL_LUSEROP 252 #define RPL_LUSERUNKNOWN 253 @@ -111,6 +148,14 @@ extern const char* form_str(int); #define RPL_ENDOFTRACE 262 #define RPL_LOAD2HI 263 +/* RPL_TRYAGAIN 263 Numerics List: IRCnet */ +/* RPL_LOAD2HI 263 Dalnet */ +/* RPL_CURRENT_LOCAL 265 aircd/efnet/hybrid/dalnet*/ +/* RPL_CURRENT_GLOBAL 266 aircd/efnet/hybrid/dalnet */ +/* RPL_START_NETSTAT 267 aircd */ +/* RPL_NETSTAT 268 aircd */ +/* RPL_END_NETSTAT 269 aircd */ + #define RPL_LOCALUSERS 265 #define RPL_GLOBALUSERS 266 @@ -121,6 +166,32 @@ extern const char* form_str(int); #define RPL_ACCEPTLIST 281 #define RPL_ENDOFACCEPT 282 +/* RPL_GLIST 280 Undernet extension */ +/* RPL_ENDOFGLIST 281 Undernet extension */ +/* RPL_JUPELIST 282 Undernet extension - jupe -Kev */ +/* RPL_ENDOFJUPELIST 283 Undernet extension - jupe -Kev */ +/* RPL_FEATURE 284 Undernet extension - features */ +/* RPL_CHANINFO_HANDLE 285 aircd */ +/* RPL_CHANINFO_USERS 286 aircd */ +/* RPL_CHANINFO_CHOPS 287 aircd */ +/* RPL_CHANINFO_VOICES 288 aircd */ +/* RPL_CHANINFO_AWAY 289 aircd */ +/* RPL_CHANINFO_OPERS 290 aircd */ +/* RPL_HELPHDR 290 Numeric List: Dalnet */ +/* RPL_CHANINFO_BANNED 291 aircd */ +/* RPL_HELPOP 291 Numeric List: Dalnet */ +/* RPL_CHANINFO_BANS 292 aircd */ +/* RPL_HELPTLR 292 Numeric List: Dalnet */ +/* RPL_CHANINFO_INVITE 293 aircd */ +/* RPL_HELPHLP 293 Numeric List: Dalnet */ +/* RPL_CHANINFO_INVITES 294 aircd */ +/* RPL_HELPFWD 294 Numeric List: Dalnet */ +/* RPL_CHANINFO_KICK 295 aircd */ +/* RPL_HELPIGN 295 Numeric List: Dalnet */ +/* RPL_CHANINFO_KICKS 296 aircd */ + +/* RPL_END_CHANINFO 299 aircd */ + /* numeric_replies */ #define RPL_NONE 300 @@ -130,6 +201,19 @@ extern const char* form_str(int); #define RPL_TEXT 304 #define RPL_UNAWAY 305 #define RPL_NOWAWAY 306 +#define RPL_USERIP 307 /* Undernet extension */ +/* RPL_WHOISREGNICK 307 Numeric List: Dalnet */ +/* RPL_SUSERHOST 307 austnet */ +/* RPL_NOTIFYACTION 308 aircd */ +/* RPL_WHOISADMIN 308 Numeric List: Dalnet */ +/* RPL_RULESSTART 308 unreal */ +/* RPL_NICKTRACE 309 aircd */ +/* RPL_WHOISSADMIN 309 Numeric List: Dalnet */ +/* RPL_ENDOFRULES 309 unreal */ +/* RPL_WHOISHELPER 309 austnet */ +/* RPL_WHOISSVCMSG 310 Dalnet */ +/* RPL_WHOISHELPOP 310 unreal */ +/* RPL_WHOISSERVICE 310 austnet */ #define RPL_WHOISADMIN 308 @@ -146,23 +230,33 @@ extern const char* form_str(int); #define RPL_ENDOFWHOIS 318 #define RPL_WHOISCHANNELS 319 - +/* RPL_WHOIS_HIDDEN 320 Anothernet +h, ick! */ +/* RPL_WHOISSPECIAL 320 unreal */ #define RPL_LISTSTART 321 #define RPL_LIST 322 #define RPL_LISTEND 323 #define RPL_CHANNELMODEIS 324 - +/* RPL_CHANNELPASSIS 325 IRCnet extension */ +/* RPL_UNIQOPIS 325 IRCnet extension */ +/* RPL_NOCHANPASS 326 IRCnet extension */ +/* RPL_CHPASSUNKNOWN 327 IRCnet extension */ +/* RPL_CHANNEL_URL 328 dalnet, anothernet */ #define RPL_CREATIONTIME 329 - +/* RPL_WHOWAS_TIME 330 ? */ #define RPL_NOTOPIC 331 #define RPL_TOPIC 332 #define RPL_TOPICWHOTIME 333 - +/* RPL_COMMANDSYNTAX 334 Dalnet */ +/* RPL_LISTSYNTAX 334 unreal */ +/* RPL_CHANPASSOK 338 IRCnet extension (?)*/ +/* RPL_WHOISACTUALLY 338 Undernet extension, dalnet */ +/* RPL_BADCHANPASS 339 IRCnet extension (?)*/ +/* RPL_USERIP 340 (old) Undernet extension */ #define RPL_INVITING 341 -#define RPL_SUMMONING 342 +/* RPL_SUMMONING 342 removed from RFC1459 */ #define RPL_INVITELIST 346 -#define RPL_ENDOFINVITELIST 347 +#define RPL_ENDOFINVITELIST 347 /* IRCnet, Undernet extension */ #define RPL_EXCEPTLIST 348 #define RPL_ENDOFEXCEPTLIST 349 @@ -190,12 +284,24 @@ extern const char* form_str(int); #define RPL_MOTDSTART 375 #define RPL_ENDOFMOTD 376 +/* RPL_KICKEXPIRED 377 aircd */ +/* RPL_SPAM 377 austnet */ +/* RPL_BANEXPIRED 378 aircd */ +/* RPL_KICKLINKED 379 aircd */ +/* RPL_BANLINKED 380 aircd */ + #define RPL_YOUREOPER 381 #define RPL_REHASHING 382 +/* RPL_YOURSERVICE 383 Numeric List: various */ #define RPL_MYPORTIS 384 #define RPL_NOTOPERANYMORE 385 #define RPL_RSACHALLENGE 386 +/* RPL_QLIST 386 unreal */ +/* RPL_ENDOFQLIST 387 unreal */ +/* RPL_ALIST 388 unreal */ +/* RPL_ENDOFALIST 389 unreal */ + #define RPL_TIME 391 #define RPL_USERSSTART 392 #define RPL_USERS 393 @@ -219,19 +325,29 @@ extern const char* form_str(int); #define ERR_NOTEXTTOSEND 412 #define ERR_NOTOPLEVEL 413 #define ERR_WILDTOPLEVEL 414 - +/* ERR_BADMASK 415 IRCnet extension */ #define ERR_UNKNOWNCOMMAND 421 #define ERR_NOMOTD 422 #define ERR_NOADMININFO 423 #define ERR_FILEERROR 424 +/* ERR_TOOMANYAWAY 429 Dalnet */ + #define ERR_NONICKNAMEGIVEN 431 #define ERR_ERRONEUSNICKNAME 432 #define ERR_NICKNAMEINUSE 433 + +/* ERR_SERVICENAMEINUSE 434 ? */ +/* ERR_NORULES 434 unreal */ +/* ERR_SERVICECONFUSED 435 ? */ +/* ERR_BANONCHAN 435 dalnet */ + #define ERR_NICKCOLLISION 436 #define ERR_UNAVAILRESOURCE 437 #define ERR_NICKTOOFAST 438 /* We did it first Undernet! ;) db */ +/* ERR_SERVICESDOWN 440 Dalnet,unreal */ + #define ERR_USERNOTINCHANNEL 441 #define ERR_NOTONCHANNEL 442 #define ERR_USERONCHANNEL 443 @@ -241,6 +357,14 @@ extern const char* form_str(int); #define ERR_NOTREGISTERED 451 +/* ERR_IDCOLLISION 452 IRCnet extension ? */ +/* ERR_NICKLOST 453 IRCnet extension ? */ + +/* ERR_HOSTILENAME 455 unreal */ + +/* ERR_NOHIDING 459 unreal */ +/* ERR_NOTFORHALFOPS 460 unreal */ + #define ERR_ACCEPTFULL 456 #define ERR_ACCEPTEXIST 457 #define ERR_ACCEPTNOT 458 @@ -252,7 +376,10 @@ extern const char* form_str(int); #define ERR_YOUREBANNEDCREEP 465 #define ERR_YOUWILLBEBANNED 466 #define ERR_KEYSET 467 - +/* ERR_ONLYSERVERSCANCHANGE 468 Dalnet,unreal */ +/* ERR_LINKSET 469 unreal */ +/* ERR_LINKCHANNEL 470 unreal */ +/* ERR_KICKEDFROMCHAN 470 aircd */ #define ERR_CHANNELISFULL 471 #define ERR_UNKNOWNMODE 472 #define ERR_INVITEONLYCHAN 473 @@ -262,19 +389,32 @@ extern const char* form_str(int); #define ERR_MODELESS 477 /* ircu numeric -db */ #define ERR_BANLISTFULL 478 /* I stole the numeric from ircu -db */ #define ERR_BADCHANNAME 479 - +/* ERR_LINKFAIL 479 unreal */ +/* ERR_CANNOTKNOCK 480 unreal */ +/* ERR_NOULINE 480 austnet */ #define ERR_NOPRIVILEGES 481 #define ERR_CHANOPRIVSNEEDED 482 #define ERR_CANTKILLSERVER 483 #define ERR_RESTRICTED 484 #define ERR_BANNEDNICK 485 - +/* ERR_DESYNC 484 Dalnet,PTlink */ +/* ERR_ATTACKDENY 484 unreal */ +/* ERR_RESTRICTED 484 IRCnet extension */ +/* ERR_UNIQOPRIVSNEEDED 485 IRCnet extension */ +/* ERR_KILLDENY 485 unreal */ +/* ERR_CANTKICKADMIN 485 PTlink */ +/* ERR_HTMDISABLED 486 unreal */ +/* ERR_CHANTOORECENT 487 IRCnet extension (?) */ +/* ERR_TSLESSCHAN 488 IRCnet extension (?) */ +/* ERR_VOICENEEDED 489 Undernet extension */ #define ERR_NOOPERHOST 491 +/* ERR_NOSERVICEHOST 492 IRCnet extension */ #define ERR_UMODEUNKNOWNFLAG 501 #define ERR_USERSDONTMATCH 502 #define ERR_GHOSTEDCLIENT 503 +/* ERR_VWORLDWARN 503 austnet */ #define ERR_USERNOTONSERV 504 @@ -285,15 +425,52 @@ extern const char* form_str(int); #define ERR_VCHANDISABLED 506 #define ERR_ALREADYONVCHAN 507 +/* ERR_NOTIFYFULL 512 aircd */ +/* ERR_TOOMANYWATCH 512 Numeric List: Dalnet */ +/* ERR_NEEDPONG 512 Numeric List: Dalnet */ + #define ERR_WRONGPONG 513 +/* ERR_TOOMANYDCC 514 dalnet */ +/* ERR_NOINVITE 518 unreal */ +#define ERR_LONGMASK 518 /* Undernet extension -Kev */ +/* ERR_ADMONLY 519 unreal */ +/* ERR_TOOMANYUSERS 519 Undernet extension -Kev */ +/* ERR_OPERONLY 520 unreal */ +/* ERR_MASKTOOWIDE 520 Undernet extension -Kev */ +/* ERR_WHOTRUNC 520 austnet */ +/* ERR_LASTERROR 521 Undernet extension -Kev */ +/* ERR_LISTSYNTAX 521 dalnet */ +/* ERR_WHOSYNTAX 522 dalnet */ +/* ERR_WHOLIMEXCEED 523 dalnet */ #define ERR_HELPNOTFOUND 524 +/* RPL_LOGON 600 dalnet,unreal + RPL_LOGOFF 601 dalnet,unreal + RPL_WATCHOFF 602 dalnet,unreal + RPL_WATCHSTAT 603 dalnet,unreal + RPL_NOWON 604 dalnet,unreal + RPL_NOWOFF 605 dalnet,unreal + RPL_WATCHLIST 606 dalnet,unreal + RPL_ENDOFWATCHLIST 607 dalnet,unreal -#define RPL_WHOISSERVICES 613 -#define RPL_WHOISMODES 615 + RPL_MAPMORE 610 unreal +*/ +#define RPL_WHOISSERVICES 613 +#define RPL_WHOISMODES 615 +/* + RPL_MAPMORE 615 PTlink + + RPL_DCCSTATUS 617 dalnet + RPL_DCCLIST 618 dalnet + RPL_ENDOFDCCLIST 619 dalnet + RPL_DCCINFO 620 dalnet + + RPL_DUMPING 640 unreal + RPL_DUMPRPL 641 unreal + RPL_EODUMP 642 unreal +*/ #define RPL_WHOISREALHOST 670 - #define RPL_MODLIST 702 #define RPL_ENDOFMODLIST 703 diff --git a/include/packet.h b/include/packet.h index 7fc4c10..c12235b 100644 --- a/include/packet.h +++ b/include/packet.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: packet.h,v 1.2 2002/08/13 14:45:10 fishwaldo Exp $ + * $Id: packet.h,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $ */ #ifndef INCLUDED_packet_h @@ -44,7 +44,7 @@ * without being so heavily penalised they excess flood. */ #define MAX_FLOOD 5 -#define MAX_FLOOD_BURST MAX_FLOOD * 6 +#define MAX_FLOOD_BURST MAX_FLOOD * 8 extern PF read_ctrl_packet; extern PF read_packet; diff --git a/include/s_conf.h b/include/s_conf.h index 0d402d4..aea1d6b 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: s_conf.h,v 1.2 2002/08/13 14:45:10 fishwaldo Exp $ + * $Id: s_conf.h,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $ */ #ifndef INCLUDED_s_conf_h @@ -240,12 +240,6 @@ struct config_file_entry struct config_channel_entry { - int use_anonops; - int use_except; - int use_halfops; - int use_invex; - int use_knock; - int use_vchans; int knock_delay; int knock_delay_channel; int vchans_oper_only; diff --git a/include/serno.h b/include/serno.h index 4467681..48835b7 100644 --- a/include/serno.h +++ b/include/serno.h @@ -1 +1 @@ -#define SERIALNUM "20020716_1" +#define SERIALNUM "20020816_0" diff --git a/include/supported.h b/include/supported.h index 45de99f..2d3aa63 100644 --- a/include/supported.h +++ b/include/supported.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: supported.h,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $ + * $Id: supported.h,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $ */ #ifndef INCLUDED_supported_h @@ -29,8 +29,13 @@ #include "channel.h" #include "ircd_defs.h" +#ifndef USE_ASCII_CASEMAP +#define CASEMAP "rfc1459" +#else +#define CASEMAP "ascii" +#endif + #define FEATURES "WALLCHOPS"\ - "%s%s%s%s" \ " MODES=%i" \ " MAXCHANNELS=%i" \ " MAXBANS=%i" \ @@ -39,11 +44,7 @@ " TOPICLEN=%i" \ " KICKLEN=%i" -#define FEATURESVALUES ConfigChannel.use_knock ? " KNOCK" : "", \ - ConfigChannel.use_vchans ? " VCHANS" : "", \ - ConfigChannel.use_except ? " EXCEPTS" : "", \ - ConfigChannel.use_invex ? " INVEX" : "", \ - MAXMODEPARAMS,ConfigChannel.max_chans_per_user, \ +#define FEATURESVALUES MAXMODEPARAMS,ConfigChannel.max_chans_per_user, \ ConfigChannel.max_bans, \ ConfigFileEntry.max_targets,NICKLEN-1,TOPICLEN,TOPICLEN @@ -51,13 +52,12 @@ " PREFIX=%s" \ " CHANMODES=%s" \ " NETWORK=%s" \ - " CHARSET=rfc1459" \ - " CASEMAPPING=rfc1459" \ + " CASEMAPPING=%s" \ " CALLERID" #define FEATURES2VALUES ConfigServerHide.disable_local_channels ? "#" : "#&", \ - "(ohv)@%+", "beI,k,l,imnpsta", \ - ServerInfo.network_name + "(aohv)*@%+", "beI,k,l,imnpsta", \ + ServerInfo.network_name, CASEMAP /* * - from mirc's versions.txt diff --git a/modules/core/m_kick.c b/modules/core/m_kick.c index 933a5be..ba76873 100644 --- a/modules/core/m_kick.c +++ b/modules/core/m_kick.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_kick.c,v 1.2 2002/08/14 06:01:55 fishwaldo Exp $ + * $Id: m_kick.c,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $ */ #include "stdinc.h" @@ -37,6 +37,7 @@ #include "modules.h" #include "parse.h" #include "hash.h" +#include "packet.h" static void m_kick(struct Client*, struct Client*, int, char**); @@ -59,7 +60,7 @@ _moddeinit(void) mod_del_cmd(&kick_msgtab); } -const char *_version = "$Revision: 1.2 $"; +const char *_version = "$Revision: 1.3 $"; #endif /* ** m_kick @@ -92,15 +93,21 @@ static void m_kick(struct Client *client_p, return; } + if(MyClient(source_p) && !IsFloodDone(source_p)) + flood_endgrace(source_p); + comment = (BadPtr(parv[3])) ? parv[2] : parv[3]; if (strlen(comment) > (size_t) TOPICLEN) comment[TOPICLEN] = '\0'; *buf = '\0'; - if( (p = strchr(parv[1],',')) ) - *p = '\0'; - name = parv[1]; + while (*name == ',') + name++; + if((p = strchr(name,',')) != NULL) + *p = '\0'; + if (!*name) + return; chptr = hash_find_channel(name); if (!chptr) @@ -165,10 +172,13 @@ static void m_kick(struct Client *client_p, */ } - if( (p = strchr(parv[2],',')) ) + user = parv[2]; + while (*user == ',') + user++; + if((p = strchr(user,',')) != NULL) *p = '\0'; - - user = parv[2]; /* strtoken(&p2, parv[2], ","); */ + if (!*user) + return; if (!(who = find_chasing(source_p, user, &chasing))) { @@ -177,15 +187,17 @@ static void m_kick(struct Client *client_p, if (IsMember(who, chptr)) { - /* half ops cannot kick full chanops */ -#ifdef HALFOPS - if (is_half_op(chptr,source_p) && is_any_op(chptr,who)) + /* half ops cannot kick other halfops on private channels */ + if (is_half_op(chptr,source_p)) + { + if (((chptr->mode.mode & MODE_PRIVATE) && is_any_op(chptr, who)) || + is_chan_op(chptr, who)) { sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), me.name, parv[0], name); return; } -#endif + } /* jdc * - In the case of a server kicking a user (i.e. CLEARCHAN), * the kick should show up as coming from the server which did @@ -198,7 +210,6 @@ static void m_kick(struct Client *client_p, sendto_channel_local(ALL_MEMBERS, chptr, ":%s KICK %s %s :%s", source_p->name, name, who->name, comment); } -#ifdef ANONOPS else if(chptr->mode.mode & MODE_HIDEOPS) { /* jdc -- Non-chanops get kicked from me.name, not @@ -218,7 +229,6 @@ static void m_kick(struct Client *client_p, who->name, comment); } else -#endif { sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s KICK %s %s :%s", diff --git a/modules/core/m_kill.c b/modules/core/m_kill.c index 325f733..d61e8bc 100644 --- a/modules/core/m_kill.c +++ b/modules/core/m_kill.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_kill.c,v 1.2 2002/08/14 06:01:55 fishwaldo Exp $ + * $Id: m_kill.c,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $ */ #include "stdinc.h" @@ -64,7 +64,7 @@ _moddeinit(void) mod_del_cmd(&kill_msgtab); } -const char *_version = "$Revision: 1.2 $"; +const char *_version = "$Revision: 1.3 $"; #endif /* ** mo_kill @@ -83,9 +83,9 @@ static void mo_kill(struct Client *client_p, struct Client *source_p, user = parv[1]; reason = parv[2]; /* Either defined or NULL (parc >= 2!!) */ - if (!IsOperGlobalKill(source_p)) + if (!IsOperK(source_p)) { - sendto_one(source_p,":%s NOTICE %s :You need global_kill = yes;",me.name,parv[0]); + sendto_one(source_p,":%s NOTICE %s :You need kline = yes;",me.name,parv[0]); return; } @@ -258,11 +258,15 @@ static void ms_kill(struct Client *client_p, struct Client *source_p, /* Be warned, this message must be From %s, or it confuses clients * so dont change it to From: or the case or anything! -- fl -- db */ + /* path must contain at least 2 !'s, or bitchx falsely declares it + * local --fl + */ if (IsOper(source_p)) /* send it normally */ { sendto_realops_flags(FLAGS_ALL, L_ALL, - "Received KILL message for %s. From %s Path: %s %s", - target_p->name, parv[0], source_p->user->server, reason); + "Received KILL message for %s. From %s Path: %s!%s!%s!%s %s", + target_p->name, parv[0], source_p->user->server, + source_p->host, source_p->username, source_p->name, reason); } else { diff --git a/modules/core/m_mode.c b/modules/core/m_mode.c index fc973c3..4f5e7fe 100644 --- a/modules/core/m_mode.c +++ b/modules/core/m_mode.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_mode.c,v 1.1 2002/08/14 05:47:41 fishwaldo Exp $ + * $Id: m_mode.c,v 1.2 2002/08/16 12:05:36 fishwaldo Exp $ */ #include "stdinc.h" @@ -63,7 +63,7 @@ _moddeinit(void) } -const char *_version = "$Revision: 1.1 $"; +const char *_version = "$Revision: 1.2 $"; #endif /* * m_mode - MODE command handler @@ -211,7 +211,12 @@ static void m_mode(struct Client *client_p, struct Client *source_p, { /* Finish the flood grace period... */ if(MyClient(source_p) && !IsFloodDone(source_p)) - flood_endgrace(source_p); + { + if((parc == n) && (parv[n-1][0] == 'b') && (parv[n-1][1] == '\0')) + ; + else + flood_endgrace(source_p); + } set_channel_mode(client_p, source_p, chptr, parc - n, parv + n, root->chname); diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index f4dcce3..ddecd5a 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_nick.c,v 1.4 2002/08/14 06:32:53 fishwaldo Exp $ + * $Id: m_nick.c,v 1.5 2002/08/16 12:05:36 fishwaldo Exp $ */ #include "stdinc.h" @@ -97,7 +97,7 @@ _moddeinit(void) mod_del_cmd(&client_msgtab); } -const char *_version = "$Revision: 1.4 $"; +const char *_version = "$Revision: 1.5 $"; #endif /* @@ -326,8 +326,26 @@ static void ms_nick(struct Client *client_p, struct Client *source_p, } /* parc == 3 on nickchange, parc == 9 on new nick */ - if((parc != 3) && (parc != 9)) + if((IsClient(source_p) && (parc != 3)) || (IsServer(source_p) && (parc != 9))) + { + char tbuf[BUFSIZE] = { 0 }; + int j; + + for(j = 0; j < parc; j++) + { + strcat(tbuf, parv[j]); + strcat(tbuf, " "); + } + + sendto_realops_flags(FLAGS_ALL, L_ALL, + "Dropping server %s due to (invalid) command 'NICK' " + "with only %d arguments. (Buf: '%s')", + client_p->name, parc, tbuf); + ilog(L_CRIT, "Insufficient parameters (%d) for command 'NICK' from %s. Buf: %s", + parc, client_p->name, tbuf); + exit_client(client_p, client_p, client_p, "Not enough arguments to server command."); return; + } /* fix the length of the nick */ strlcpy(nick, parv[1], NICKLEN); diff --git a/modules/core/m_server.c b/modules/core/m_server.c index bfdb87d..b2f555b 100644 --- a/modules/core/m_server.c +++ b/modules/core/m_server.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_server.c,v 1.2 2002/08/14 06:29:46 fishwaldo Exp $ + * $Id: m_server.c,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $ */ #include "stdinc.h" @@ -51,7 +51,7 @@ static void ms_server(struct Client*, struct Client*, int, char **); static int set_server_gecos(struct Client *, char *); struct Message server_msgtab = { - "SERVER", 0, 0, 3, 0, MFLG_SLOW | MFLG_UNREG, 0, + "SERVER", 0, 0, 4, 0, MFLG_SLOW | MFLG_UNREG, 0, {mr_server, m_registered, ms_server, m_registered} }; @@ -67,7 +67,7 @@ _moddeinit(void) { mod_del_cmd(&server_msgtab); } -const char *_version = "$Revision: 1.2 $"; +const char *_version = "$Revision: 1.3 $"; #endif int bogus_host(char *host); diff --git a/modules/core/m_sjoin.c b/modules/core/m_sjoin.c index 1c70912..072c47f 100644 --- a/modules/core/m_sjoin.c +++ b/modules/core/m_sjoin.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_sjoin.c,v 1.2 2002/08/14 06:01:55 fishwaldo Exp $ + * $Id: m_sjoin.c,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $ */ #include "stdinc.h" @@ -63,7 +63,7 @@ _moddeinit(void) mod_del_cmd(&sjoin_msgtab); } -const char *_version = "$Revision: 1.2 $"; +const char *_version = "$Revision: 1.3 $"; #endif /* * ms_sjoin @@ -122,18 +122,14 @@ static void ms_sjoin(struct Client *client_p, int hide_or_not; int i; dlink_node *m; -#ifdef HALFOPS static char sjbuf_hops[BUFSIZE]; /* buffer with halfops as % */ register char *hops; -#endif #ifdef VCHANS int vc_ts = 0; #endif *buf = '\0'; -#ifdef HALFOPS *sjbuf_hops = '\0'; -#endif *sjbuf_nhops = '\0'; if (IsClient(source_p) || parc < 5) @@ -178,12 +174,9 @@ static void ms_sjoin(struct Client *client_p, case 't': mode.mode |= MODE_TOPICLIMIT; break; -#ifdef ANONOPS case 'a': - if(ConfigChannel.use_anonops) - mode.mode |= MODE_HIDEOPS; + mode.mode |= MODE_HIDEOPS; break; -#endif case 'k': strlcpy(mode.key, parv[4 + args], KEYLEN); args++; @@ -207,7 +200,7 @@ static void ms_sjoin(struct Client *client_p, /* vchans are encoded as "##mainchanname_timestamp" */ #ifdef VCHANS - if ( (parv[2][1] == '#') && (ConfigChannel.use_vchans) ) + if (parv[2][1] == '#') { char *subp; @@ -336,14 +329,11 @@ static void ms_sjoin(struct Client *client_p, strcpy(mode.key, oldmode->key); } -#ifdef ANONOPS if (mode.mode & MODE_HIDEOPS) hide_or_not = ONLY_CHANOPS_HALFOPS; else -#endif hide_or_not = ALL_MEMBERS; -#ifdef ANONOPS if ((MODE_HIDEOPS & mode.mode) && !(MODE_HIDEOPS & oldmode->mode)) sync_channel_oplists(chptr, MODE_DEL); @@ -351,7 +341,6 @@ static void ms_sjoin(struct Client *client_p, if (keep_our_modes) if (!(MODE_HIDEOPS & mode.mode) && (MODE_HIDEOPS & oldmode->mode)) sync_channel_oplists(chptr, MODE_ADD); -#endif set_final_mode(&mode,oldmode); chptr->mode = mode; @@ -414,9 +403,7 @@ static void ms_sjoin(struct Client *client_p, *mbuf++ = '+'; -#ifdef HALFOPS hops = sjbuf_hops; -#endif nhops = sjbuf_nhops; s = parv[args+4]; @@ -448,9 +435,7 @@ static void ms_sjoin(struct Client *client_p, fl |= MODE_CHANOP; if (keep_new_modes) { -#ifdef HALFOPS *hops++ = *s; -#endif *nhops++ = *s; num_prefix++; } @@ -462,9 +447,7 @@ static void ms_sjoin(struct Client *client_p, fl |= MODE_VOICE; if (keep_new_modes) { -#ifdef HALFOPS *hops++ = *s; -#endif *nhops++ = *s; num_prefix++; } @@ -473,16 +456,10 @@ static void ms_sjoin(struct Client *client_p, } else if (*s == '%') { -#ifdef HALFOPS fl |= MODE_HALFOP; -#else - fl |= MODE_CHANOP; -#endif if (keep_new_modes) { -#ifdef HALFOPS *hops++ = *s; -#endif *nhops++ = '@'; num_prefix++; } @@ -501,10 +478,8 @@ static void ms_sjoin(struct Client *client_p, sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, s); -#ifdef HALFOPS hops -= num_prefix; *hops = '\0'; -#endif nhops -= num_prefix; *nhops = '\0'; @@ -513,10 +488,8 @@ static void ms_sjoin(struct Client *client_p, } /* copy the nick to the two buffers */ -#ifdef HALFOPS hops += ircsprintf(hops, "%s ", s); assert((hops - sjbuf_hops) < sizeof(sjbuf_hops)); -#endif nhops += ircsprintf(nhops, "%s ", s); assert((nhops-sjbuf_nhops) < sizeof(sjbuf_nhops)); @@ -629,13 +602,11 @@ static void ms_sjoin(struct Client *client_p, *mbuf++ = 'v'; para[pargs++] = s; } -#ifdef HALFOPS else if (fl & MODE_HALFOP) { *mbuf++ = 'h'; para[pargs++] = s; } -#endif if (pargs >= MAXMODEPARAMS) { @@ -707,11 +678,9 @@ nextnick: if (!parv[4+args][0]) return; -#ifdef HALFOPS if (IsCapable(target_p, CAP_HOPS)) sendto_one(target_p, "%s%s", buf, sjbuf_hops); else -#endif sendto_one(target_p, "%s%s", buf, sjbuf_nhops); } } @@ -737,9 +706,7 @@ struct mode_letter flags[] = { { MODE_MODERATED, 'm' }, { MODE_INVITEONLY, 'i' }, { MODE_PRIVATE, 'p' }, -#ifdef ANONOPS { MODE_HIDEOPS, 'a' }, -#endif { 0, 0 } }; @@ -847,20 +814,9 @@ static void remove_our_modes( int hide_or_not, dlinkMoveList(&chptr->locchanops, &chptr->locpeons); dlinkMoveList(&chptr->locvoiced, &chptr->locpeons); -#ifdef REQUIRE_OANDV - remove_a_mode(hide_or_not, chptr, top_chptr, source_p, - &chptr->chanops_voiced, 'o'); - remove_a_mode(hide_or_not, chptr, top_chptr, source_p, - &chptr->chanops_voiced, 'v'); - dlinkMoveList(&chptr->chanops_voiced, &chptr->peons); - dlinkMoveList(&chptr->locchanops_voiced, &chptr->locpeons); -#endif - -#ifdef HALFOPS remove_a_mode(hide_or_not, chptr, top_chptr, source_p, &chptr->halfops, 'h'); dlinkMoveList(&chptr->halfops, &chptr->peons); dlinkMoveList(&chptr->lochalfops, &chptr->locpeons); -#endif } diff --git a/modules/m_cjoin.c b/modules/m_cjoin.c index b7339b5..128ef98 100644 --- a/modules/m_cjoin.c +++ b/modules/m_cjoin.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_cjoin.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $ + * $Id: m_cjoin.c,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $ */ #include "stdinc.h" @@ -69,7 +69,7 @@ _moddeinit(void) #endif } -const char *_version = "$Revision: 1.2 $"; +const char *_version = "$Revision: 1.3 $"; #endif /* STATIC_MODULES */ #ifdef VCHANS @@ -97,13 +97,6 @@ static void m_cjoin(struct Client *client_p, return; } - if(ConfigChannel.use_vchans == 0) - { - sendto_one(source_p, form_str(ERR_VCHANDISABLED), - me.name, parv[0]); - return; - } - if (ConfigChannel.vchans_oper_only && !IsOper(source_p)) { sendto_one(source_p, form_str(ERR_NOPRIVILEGES), diff --git a/modules/m_info.c b/modules/m_info.c index 629525b..1e76094 100644 --- a/modules/m_info.c +++ b/modules/m_info.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_info.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $ + * $Id: m_info.c,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $ */ #include "stdinc.h" @@ -69,7 +69,7 @@ _moddeinit(void) hook_del_event("doing_info"); mod_del_cmd(&info_msgtab); } -const char *_version = "$Revision: 1.2 $"; +const char *_version = "$Revision: 1.3 $"; #endif /* @@ -396,42 +396,6 @@ static struct InfoStruct info_table[] = &ConfigChannel.quiet_on_ban, "Banned users may not send text to a channel" }, - { - "use_anonops", - OUTPUT_BOOLEAN_YN, - &ConfigChannel.use_anonops, - "Enable chanmode +a (anonymous ops)", - }, - { - "use_except", - OUTPUT_BOOLEAN_YN, - &ConfigChannel.use_except, - "Enable chanmode +e (ban exceptions)", - }, - { - "use_halfops", - OUTPUT_BOOLEAN_YN, - &ConfigChannel.use_halfops, - "Enable chanmode +h (halfops)", - }, - { - "use_invex", - OUTPUT_BOOLEAN_YN, - &ConfigChannel.use_invex, - "Enable chanmode +I (invite exceptions)", - }, - { - "use_knock", - OUTPUT_BOOLEAN_YN, - &ConfigChannel.use_knock, - "Enable /KNOCK", - }, - { - "use_vchans", - OUTPUT_BOOLEAN_YN, - &ConfigChannel.use_vchans, - "Enabled vchans", - }, { "vchans_oper_only", OUTPUT_BOOLEAN_YN, diff --git a/modules/m_join.c b/modules/m_join.c index 3517ebd..ad74fd3 100644 --- a/modules/m_join.c +++ b/modules/m_join.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_join.c,v 1.3 2002/08/14 16:52:02 fishwaldo Exp $ + * $Id: m_join.c,v 1.4 2002/08/16 12:05:36 fishwaldo Exp $ */ #include "stdinc.h" @@ -65,7 +65,7 @@ _moddeinit(void) { mod_del_cmd(&join_msgtab); } -const char *_version = "$Revision: 1.3 $"; +const char *_version = "$Revision: 1.4 $"; #endif static void do_join_0(struct Client *client_p, struct Client *source_p); @@ -188,7 +188,10 @@ m_join(struct Client *client_p, /* look for the channel */ if((chptr = hash_find_channel(name)) != NULL) { - if(splitmode && (*name != '&') && ConfigChannel.no_join_on_split) + if(IsMember(source_p, chptr)) + return; + if(splitmode && !IsOper(source_p) && (*name != '&') && + ConfigChannel.no_join_on_split) { sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE), me.name, source_p->name, name); @@ -222,7 +225,7 @@ m_join(struct Client *client_p, } else { - if(splitmode && (*name != '&') && + if(splitmode && !IsOper(source_p) && (*name != '&') && (ConfigChannel.no_create_on_split || ConfigChannel.no_join_on_split)) { sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE), @@ -259,18 +262,13 @@ m_join(struct Client *client_p, if(flags == 0) /* if channel doesn't exist, don't penalize */ successful_join_count++; - if(!chptr) /* If I already have a chptr, no point doing this */ + if(chptr == NULL) /* If I already have a chptr, no point doing this */ { chptr = get_or_create_channel(source_p, name, NULL); root_chptr = chptr; } - if(chptr) - { - if (IsMember(source_p, chptr)) /* already a member, ignore this */ - continue; - } - else + if(chptr == NULL) { sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE), me.name, parv[0], name); diff --git a/modules/m_knock.c b/modules/m_knock.c index 15efb04..8e23767 100644 --- a/modules/m_knock.c +++ b/modules/m_knock.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_knock.c,v 1.2 2002/08/13 14:45:11 fishwaldo Exp $ + * $Id: m_knock.c,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $ */ #include "stdinc.h" @@ -81,7 +81,7 @@ _moddeinit(void) mod_del_cmd(&knockll_msgtab); } -const char *_version = "$Revision: 1.2 $"; +const char *_version = "$Revision: 1.3 $"; #endif /* m_knock @@ -109,13 +109,6 @@ static void m_knock(struct Client *client_p, { char *sockhost = NULL; - if((ConfigChannel.use_knock == 0) && MyClient(source_p)) - { - sendto_one(source_p, form_str(ERR_KNOCKDISABLED), - me.name, source_p->name); - return; - } - /* a remote KNOCKLL request, check we're capable of handling it.. */ if(!MyConnect(source_p)) { @@ -411,7 +404,6 @@ static void send_knock(struct Client *client_p, struct Client *source_p, if(source_p->user != NULL) { - if(ConfigChannel.use_knock) sendto_channel_local(ONLY_CHANOPS_HALFOPS, chptr, form_str(RPL_KNOCK), @@ -481,7 +473,7 @@ static int check_banned_knock(struct Channel *chptr, struct Client *who, actualBan = NULL; } - if ((actualBan != NULL) && ConfigChannel.use_except) + if (actualBan != NULL) { for (except = chptr->exceptlist.head; except; except = except->next) { diff --git a/modules/m_version.c b/modules/m_version.c index a6eb55f..1dac84f 100644 --- a/modules/m_version.c +++ b/modules/m_version.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_version.c,v 1.2 2002/08/13 14:45:12 fishwaldo Exp $ + * $Id: m_version.c,v 1.3 2002/08/16 12:05:36 fishwaldo Exp $ */ #include @@ -59,7 +59,7 @@ _moddeinit(void) mod_del_cmd(&version_msgtab); } -const char *_version = "$Revision: 1.2 $"; +const char *_version = "$Revision: 1.3 $"; #endif /* * m_version - VERSION command handler @@ -154,9 +154,6 @@ static char* confopts(struct Client *source_p) *p++ = 'D'; #endif - if(ConfigChannel.use_except) - *p++ = 'e'; - if (ConfigFileEntry.glines) *p++ = 'g'; *p++ = 'G'; @@ -168,11 +165,6 @@ static char* confopts(struct Client *source_p) *p++ = 'H'; } - if(ConfigChannel.use_invex) - *p++ = 'I'; - - if(ConfigChannel.use_knock) - *p++ = 'K'; *p++ = 'M'; diff --git a/modules/m_who.c b/modules/m_who.c index 128db92..d468ac9 100644 --- a/modules/m_who.c +++ b/modules/m_who.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_who.c,v 1.3 2002/08/14 16:52:02 fishwaldo Exp $ + * $Id: m_who.c,v 1.4 2002/08/16 12:05:36 fishwaldo Exp $ */ #include "stdinc.h" #include "tools.h" @@ -61,7 +61,7 @@ _moddeinit(void) { mod_del_cmd(&who_msgtab); } -const char *_version = "$Revision: 1.3 $"; +const char *_version = "$Revision: 1.4 $"; #endif static void do_who_on_channel(struct Client *source_p, struct Channel *chptr, char *real_name, @@ -69,12 +69,7 @@ static void do_who_on_channel(struct Client *source_p, static void do_who_list(struct Client *source_p, struct Channel *chptr, dlink_list *peons_list, dlink_list *chanops_list, -#ifdef REQUIRE_OANDV - dlink_list *chanops_voiced_list, -#endif -#ifdef HALFOPS dlink_list *halfops_list, -#endif dlink_list *chanadmins_list, dlink_list *voiced_list, char *chanop_flag, @@ -251,10 +246,8 @@ static void m_who(struct Client *client_p, if (is_chan_op(chptr,target_p)) do_who(source_p, target_p, chname, flags[0]); -#ifdef HALFOPS else if(is_half_op(chptr,target_p)) do_who(source_p, target_p, chname, flags[1]); -#endif else if(is_voiced(chptr,target_p)) do_who(source_p, target_p, chname, flags[2]); else if(is_chan_admin(chptr, target_p)) @@ -354,12 +347,7 @@ static void who_global(struct Client *source_p,char *mask, int server_oper) { chptr = lp->data; who_common_channel(source_p,chptr->chanops,mask,server_oper,&maxmatches); -#ifdef REQUIRE_OANDV - who_common_channel(source_p,chptr->chanops_voiced,mask,server_oper,&maxmatches); -#endif -#ifdef HALFOPS who_common_channel(source_p,chptr->halfops,mask,server_oper,&maxmatches); -#endif who_common_channel(source_p,chptr->voiced,mask,server_oper,&maxmatches); who_common_channel(source_p,chptr->peons,mask,server_oper,&maxmatches); } @@ -423,12 +411,7 @@ static void do_who_on_channel(struct Client *source_p, do_who_list(source_p, chptr, &chptr->peons, &chptr->chanops, -#ifdef REQUIRE_OANDV - &chptr->chanops_voiced, -#endif -#ifdef HALFOPS &chptr->halfops, -#endif &chptr->chanadmins, &chptr->voiced, flags[0], @@ -442,12 +425,7 @@ static void do_who_on_channel(struct Client *source_p, static void do_who_list(struct Client *source_p, struct Channel *chptr, dlink_list *peons_list, dlink_list *chanops_list, -#ifdef REQUIRE_OANDV - dlink_list *chanops_voiced_list, -#endif -#ifdef HALFOPS dlink_list *halfops_list, -#endif dlink_list *chanadmins_list, dlink_list *voiced_list, char *chanop_flag, @@ -458,28 +436,17 @@ static void do_who_list(struct Client *source_p, struct Channel *chptr, { struct Client *target_p; -#ifdef ANONOPS dlink_node *chanops_ptr; dlink_node *peons_ptr; dlink_node *voiced_ptr; -#ifdef REQUIRE_OANDV - dlink_node *chanops_voiced_ptr; -#endif -#ifdef HALFOPS dlink_node *halfops_ptr; -#endif dlink_node *chanadmins_ptr; int done=0; peons_ptr = peons_list->head; chanops_ptr = chanops_list->head; voiced_ptr = voiced_list->head; -#ifdef HALFOPS halfops_ptr = halfops_list->head; -#endif -#ifdef REQUIRE_OANDV - chanops_voiced_ptr = chanops_voiced_list->head; -#endif chanadmins_ptr = chanadmins_list->head; while (done != NUMLISTS) @@ -518,7 +485,6 @@ ilog(1, "chanadmin1 %s", admins_flag); else done++; -#ifdef HALFOPS if(halfops_ptr != NULL) { target_p = halfops_ptr->data; @@ -529,9 +495,6 @@ ilog(1, "chanadmin1 %s", admins_flag); } else done++; -#else - done++; -#endif if(voiced_ptr != NULL) { @@ -550,65 +513,8 @@ ilog(1, "chanadmin1 %s", admins_flag); else done++; -#ifdef REQUIRE_OANDV - if(chanops_voiced_ptr != NULL) - { - target_p = chanops_voiced_ptr->data; - - if(member || !IsInvisible(target_p)) - do_who(source_p, target_p, chname, chanop_flag); - chanops_voiced_ptr = chanops_voiced_ptr->next; - } - else - done++; -#endif } -#else /* ANONOPS */ - dlink_node *ptr; - - for(ptr = peons_list->head; ptr; ptr = ptr->next) - { - target_p = ptr->data; - - if(member || !IsInvisible(target_p)) - do_who(source_p, target_p, chname, ""); - } - - for(ptr = voiced_list->head; ptr; ptr = ptr->next) - { - target_p = ptr->data; - - if(member || !IsInvisible(target_p)) - do_who(source_p, target_p, chname, voiced_flag); - } - -#ifdef REQUIRE_OANDV - for(ptr = chanops_voiced_list->head; ptr; ptr = ptr->next) - { - target_p = ptr->data; - - if(member || !IsInvisible(target_p)) - do_who(source_p, target_p, chname, chanop_flag); - } -#endif - for(ptr = chanadmins_list->head; ptr; ptr = ptr->next) - { - target_p = ptr->data; -ilog(1, "doadmin %s", admins_flag); - if(member || !IsInvisible(target_p)) - do_who(source_p, target_p, chname, admins_flag); - } - - for(ptr = chanops_list->head; ptr; ptr = ptr->next) - { - target_p = ptr->data; - - if(member || !IsInvisible(target_p)) - do_who(source_p, target_p, chname, chanop_flag); - } -#endif } - /* * do_who * @@ -630,7 +536,6 @@ static void do_who(struct Client *source_p, target_p->user->away ? 'G' : 'H', IsOper(target_p) ? "*" : "", op_flags ); -#ifdef ANONOPS if(ConfigServerHide.hide_servers) { sendto_one(source_p, form_str(RPL_WHOREPLY), me.name, source_p->name, @@ -641,7 +546,6 @@ static void do_who(struct Client *source_p, status, 0, target_p->info); } else -#endif { sendto_one(source_p, form_str(RPL_WHOREPLY), me.name, source_p->name, (chname) ? (chname) : "*", diff --git a/src/balloc.c b/src/balloc.c index 39edc6a..db06fd9 100644 --- a/src/balloc.c +++ b/src/balloc.c @@ -25,7 +25,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: balloc.c,v 1.2 2002/08/13 14:45:12 fishwaldo Exp $ + * $Id: balloc.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ /* @@ -370,7 +370,7 @@ BlockHeapAlloc(BlockHeap * bh) assert(bh != NULL); if (bh == NULL) { - return(NULL); + outofmemory(); } if (bh->freeElems == 0) @@ -405,7 +405,7 @@ BlockHeapAlloc(BlockHeap * bh) } } assert(0 == 1); - return(NULL); /* If you get here, something bad happened ! */ + outofmemory(); } diff --git a/src/channel.c b/src/channel.c index 8d9e999..76c6116 100644 --- a/src/channel.c +++ b/src/channel.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: channel.c,v 1.3 2002/08/14 16:52:02 fishwaldo Exp $ + * $Id: channel.c,v 1.4 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -125,13 +125,11 @@ add_user_to_channel(struct Channel *chptr, struct Client *who, int flags) dlinkAdd(who, lptr, &chptr->locchanops); break; -#ifdef HALFOPS case MODE_HALFOP: dlinkAdd(who, ptr, &chptr->halfops); if (MyClient(who)) dlinkAdd(who, lptr, &chptr->lochalfops); break; -#endif case MODE_VOICE: dlinkAdd(who, ptr, &chptr->voiced); @@ -139,19 +137,11 @@ add_user_to_channel(struct Channel *chptr, struct Client *who, int flags) dlinkAdd(who, lptr, &chptr->locvoiced); break; -#ifdef REQUIRE_OANDV - case MODE_CHANOP|MODE_VOICE: - dlinkAdd(who, ptr, &chptr->chanops_voiced); - if (MyClient(who)) - dlinkAdd(who, lptr, &chptr->locchanops_voiced); - break; -#else case MODE_CHANOP|MODE_VOICE: dlinkAdd(who, ptr, &chptr->chanops); if (MyClient(who)) dlinkAdd(who, lptr, &chptr->locchanops); break; -#endif case MODE_ADMIN: dlinkAdd(who, ptr, &chptr->chanadmins); if (MyClient(who)) @@ -204,16 +194,10 @@ remove_user_from_channel(struct Channel *chptr, struct Client *who) dlinkDelete(ptr, &chptr->peons); else if ((ptr = find_user_link(&chptr->chanops, who))) dlinkDelete(ptr, &chptr->chanops); -#ifdef REQUIRE_OANDV - else if ((ptr = find_user_link(&chptr->chanops_voiced, who))) - dlinkDelete(ptr, &chptr->chanops_voiced); -#endif else if ((ptr = find_user_link(&chptr->voiced, who))) dlinkDelete(ptr, &chptr->voiced); -#ifdef HALFOPS else if ((ptr = find_user_link(&chptr->halfops, who))) dlinkDelete(ptr, &chptr->halfops); -#endif else if ((ptr = find_user_link(&chptr->chanadmins, who))) dlinkDelete(ptr, &chptr->chanadmins); else { @@ -236,14 +220,8 @@ remove_user_from_channel(struct Channel *chptr, struct Client *who) dlinkDelete(ptr, &chptr->locchanops); else if ((ptr = find_user_link(&chptr->locvoiced, who))) dlinkDelete(ptr, &chptr->locvoiced); -#ifdef HALFOPS else if ((ptr = find_user_link(&chptr->lochalfops, who))) dlinkDelete(ptr, &chptr->lochalfops); -#endif -#ifdef REQUIRE_OANDV - else if ((ptr = find_user_link(&chptr->locchanops_voiced, who))) - dlinkDelete(ptr, &chptr->locchanops_voiced); -#endif else if ((ptr = find_user_link(&chptr->locchanadmins, who))) dlinkDelete(ptr, &chptr->locchanadmins); else @@ -365,21 +343,8 @@ send_channel_modes(struct Client *client_p, struct Channel *chptr) send_members(client_p, modebuf, parabuf, chptr, &chptr->chanops, "@"); -#ifdef REQUIRE_OANDV - send_members(client_p, modebuf, parabuf, chptr, &chptr->chanops_voiced, "@+"); -#endif -#ifdef HALFOPS - if (IsCapable(client_p, CAP_HOPS)) - { - send_members(client_p, modebuf, parabuf, chptr, &chptr->halfops, "%"); - } - else - { - /* Ok, halfops can still generate a kick, they'll just looked opped */ - send_members(client_p, modebuf, parabuf, chptr, &chptr->halfops, "@"); - } -#endif + send_members(client_p, modebuf, parabuf, chptr, &chptr->halfops, "%"); send_members(client_p, modebuf, parabuf, chptr, &chptr->chanadmins, "*"); send_members(client_p, modebuf, parabuf, chptr, &chptr->voiced, "+"); send_members(client_p, modebuf, parabuf, chptr, &chptr->peons, ""); @@ -653,25 +618,15 @@ destroy_channel(struct Channel *chptr) */ delete_members(chptr, &chptr->chanadmins); delete_members(chptr, &chptr->chanops); -#ifdef REQUIRE_OANDV - delete_members(chptr, &chptr->chanops_voiced); -#endif delete_members(chptr, &chptr->voiced); delete_members(chptr, &chptr->peons); -#ifdef HALFOPS delete_members(chptr, &chptr->halfops); -#endif delete_members(chptr, &chptr->locchanadmins); delete_members(chptr, &chptr->locchanops); -#ifdef REQUIRE_OANDV - delete_members(chptr, &chptr->locchanops_voiced); -#endif delete_members(chptr, &chptr->locvoiced); delete_members(chptr, &chptr->locpeons); -#ifdef HALFOPS delete_members(chptr, &chptr->lochalfops); -#endif while ((ptr = chptr->invites.head)) del_invite(chptr, ptr->data); @@ -775,7 +730,6 @@ void channel_member_names(struct Client *source_p, struct Channel *chptr, char *name_of_channel, int show_eon) -#ifdef ANONOPS { int mlen; int sublists_done = 0; @@ -802,18 +756,10 @@ channel_member_names(struct Client *source_p, t = lbuf + cur_len; set_channel_mode_flags(show_flags, chptr, source_p); members_ptr[0] = chptr->chanops.head; -#ifdef HALFOPS members_ptr[1] = chptr->halfops.head; -#else - members_ptr[1] = NULL; -#endif members_ptr[2] = chptr->voiced.head; members_ptr[3] = chptr->peons.head; -#ifdef REQUIRE_OANDV - members_ptr[4] = chptr->chanops_voiced.head; -#else members_ptr[4] = NULL; -#endif members_ptr[5] = chptr->chanadmins.head; is_member = IsMember(source_p, chptr); @@ -841,9 +787,6 @@ channel_member_names(struct Client *source_p, reply_to_send = YES; if (who == source_p && is_voiced(chptr, who) -#ifdef REQUIRE_OANDV - && !is_chan_op(chptr, who) -#endif && chptr->mode.mode & MODE_HIDEOPS) ircsprintf(t, "+%s ", who->name); else @@ -876,88 +819,6 @@ channel_member_names(struct Client *source_p, sendto_one(source_p, form_str(RPL_ENDOFNAMES), me.name, source_p->name, name_of_channel); } -#else -{ - struct Client *target_p; - dlink_node *ptr_list[NUMLISTS]; - dlink_node *ptr; - char ptr_flags[NUMLISTS][2]; - char lbuf[BUFSIZE]; - char *t; - int mlen; - int tlen; - int cur_len; - int reply_to_send = NO; - int is_member; - int i; - - if(ShowChannel(source_p, chptr)) - { - ptr_list[0] = chptr->chanops.head; -#ifdef HALFOPS - ptr_list[1] = chptr->halfops.head; -#else - ptr_list[1] = NULL; -#endif - ptr_list[2] = chptr->voiced.head; - ptr_list[3] = chptr->peons.head; -#ifdef REQUIRE_OANDV - ptr_list[4] = chptr->chanops_voiced.head; -#else - ptr_list[4] = NULL; -#endif - ptr_list[5] = chptr->chanadmins.head; - - set_channel_mode_flags(ptr_flags, chptr, source_p); - - is_member = IsMember(source_p, chptr); - - ircsprintf(lbuf, form_str(RPL_NAMREPLY), - me.name, source_p->name, channel_pub_or_secret(chptr)); - - mlen = strlen(lbuf); - - ircsprintf(lbuf + mlen, " %s :", name_of_channel); - cur_len = mlen = strlen(lbuf); - - t = lbuf + cur_len; - - for(i = 0; i < NUMLISTS; i++) - { - for(ptr = ptr_list[i]; ptr; ptr = ptr->next) - { - target_p = ptr->data; - - if(IsInvisible(target_p) && !is_member) - continue; - - reply_to_send = YES; - - ircsprintf(t, "%s%s ", ptr_flags[i], target_p->name); - - tlen = strlen(t); - cur_len += tlen; - t += tlen; - - if ((cur_len + NICKLEN) > (BUFSIZE - 3)) - { - sendto_one(source_p, "%s", lbuf); - reply_to_send = NO; - cur_len = mlen; - t = lbuf + mlen; - } - } - } - - if(reply_to_send) - sendto_one(source_p, "%s", lbuf); - } - - if(show_eon) - sendto_one(source_p, form_str(RPL_ENDOFNAMES), me.name, - source_p->name, name_of_channel); -} -#endif /* ANONOPS */ /* @@ -1063,16 +924,10 @@ channel_chanop_or_voice(struct Channel *chptr, struct Client *target_p) { if (find_user_link(&chptr->chanops, target_p)) return ("@"); -#ifdef HALFOPS else if (find_user_link(&chptr->halfops, target_p)) return ("%"); -#endif else if (find_user_link(&chptr->voiced, target_p)) return ("+"); -#ifdef REQUIRE_OANDV - else if (find_user_link(&chptr->chanops_voiced, target_p)) - return ("@+"); -#endif else if (find_user_link(&chptr->chanadmins, target_p)) return ("*"); return (""); @@ -1141,7 +996,7 @@ check_banned(struct Channel *chptr, struct Client *who, char *s, char *s2, char actualBan = NULL; } - if ((actualBan != NULL) && ConfigChannel.use_except) + if (actualBan != NULL) { for (except = chptr->exceptlist.head; except; except = except->next) { @@ -1195,8 +1050,6 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key) break; if (!lp) { - if (!ConfigChannel.use_invex) - return (ERR_INVITEONLYCHAN); for (ptr = chptr->invexlist.head; ptr; ptr = ptr->next) { invex = ptr->data; @@ -1221,8 +1074,6 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key) } if (!lp) { - if (!ConfigChannel.use_invex) - return (ERR_NOPRIVILEGES); for (ptr = chptr->invexlist.head; ptr; ptr = ptr->next) { invex = ptr->data; @@ -1256,10 +1107,6 @@ is_chan_op(struct Channel *chptr, struct Client *who) { if (find_user_link(&chptr->chanops, who) != NULL) return 1; -#ifdef REQUIRE_OANDV - if (find_user_link(&chptr->chanops_voiced, who) != NULL) - return 1; -#endif } return 0; } @@ -1299,16 +1146,10 @@ is_any_op(struct Channel *chptr, struct Client *who) { if (find_user_link(&chptr->chanops, who) != NULL) return 1; -#ifdef HALFOPS if (find_user_link(&chptr->halfops, who) != NULL) return 1; -#endif if (find_user_link(&chptr->chanadmins, who) != NULL) return 1; -#ifdef REQUIRE_OANDV - if (find_user_link(&chptr->chanops_voiced, who) != NULL) - return 1; -#endif } return 0; } @@ -1321,7 +1162,6 @@ is_any_op(struct Channel *chptr, struct Client *who) * output - yes if anyop no if not * side effects - */ -#ifdef HALFOPS int is_half_op(struct Channel *chptr, struct Client *who) { @@ -1333,7 +1173,6 @@ is_half_op(struct Channel *chptr, struct Client *who) return 0; } -#endif /* * is_voiced @@ -1350,10 +1189,6 @@ is_voiced(struct Channel *chptr, struct Client *who) { if (find_user_link(&chptr->voiced, who) != NULL) return 1; -#ifdef REQUIRE_OANDV - if (find_user_link(&chptr->chanops_voiced, who) != NULL) - return 1; -#endif } return 0; } diff --git a/src/channel_mode.c b/src/channel_mode.c index bbddc6b..b3fa500 100644 --- a/src/channel_mode.c +++ b/src/channel_mode.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: channel_mode.c,v 1.3 2002/08/14 16:52:02 fishwaldo Exp $ + * $Id: channel_mode.c,v 1.4 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -51,10 +51,8 @@ static int add_id(struct Client *, struct Channel *, char *, int); static int del_id(struct Channel *, char *, int); -#ifdef HALFOPS static void send_oplist(const char *, struct Client *, dlink_list *, char *, int); -#endif static int change_channel_membership(struct Channel *chptr, dlink_list *to_list, @@ -92,11 +90,9 @@ static void chm_admin(struct Client *, struct Client *, struct Channel *, int, int *, char **, int *, int, int, char, void *, const char *chnamd); -#ifdef HALFOPS static void chm_halfop(struct Client *, struct Client *, struct Channel *, int, int *, char **, int *, int, int, char, void *, const char *chname); -#endif static void chm_voice(struct Client *, struct Client *, struct Channel *, int, int *, char **, int *, int, int, char, void *, @@ -114,11 +110,9 @@ static void chm_invex(struct Client *, struct Client *, struct Channel *, int, int *, char **, int *, int, int, char, void *, const char *chname); -#ifdef ANONOPS static void chm_hideops(struct Client *, struct Client *, struct Channel *, int, int *, char **, int *, int, int, char, void *, const char *chname); -#endif static void send_cap_mode_changes(struct Client *, struct Client *, struct Channel *, int, int); @@ -139,20 +133,13 @@ static char modebuf[MODEBUFLEN], parabuf[MODEBUFLEN]; static char mask_buf[BUFSIZE]; static int mask_pos; -static struct ChModeChange mode_changes_plus[BUFSIZE]; -static struct ChModeChange mode_changes_minus[BUFSIZE]; +static struct ChModeChange mode_changes[BUFSIZE]; +static int mode_count; -#ifdef HALFOPS static struct ChModeBounce mode_bounces[BUFSIZE]; -#endif - -static int mode_count_plus, mode_count_minus; -#ifdef HALFOPS static int bounce_count; -#endif -#ifdef ANONOPS + static int hideops_changed; -#endif static int mode_limit; @@ -215,7 +202,7 @@ add_id(struct Client *client_p, struct Channel *chptr, char *banid, int type) { sendto_one(client_p, form_str(ERR_BANLISTFULL), me.name, client_p->name, chptr->chname, banid); - return -1; + return 0; } } @@ -236,14 +223,14 @@ add_id(struct Client *client_p, struct Channel *chptr, char *banid, int type) default: sendto_realops_flags(FLAGS_ALL, L_ALL, "add_id() called with unknown ban type %d!", type); - return -1; + return 0; } for (ban = list->head; ban; ban = ban->next) { actualBan = ban->data; if (match(actualBan->banstr, banid)) - return -1; + return 0; } ban = make_dlink_node(); @@ -270,7 +257,7 @@ add_id(struct Client *client_p, struct Channel *chptr, char *banid, int type) dlinkAdd(actualBan, ban, list); chptr->num_mask++; - return 0; + return 1; } /* @@ -290,7 +277,7 @@ del_id(struct Channel *chptr, char *banid, int type) struct Ban *banptr; if (!banid) - return -1; + return 0; switch (type) { @@ -306,7 +293,7 @@ del_id(struct Channel *chptr, char *banid, int type) default: sendto_realops_flags(FLAGS_ALL, L_ALL, "del_id() called with unknown ban type %d!", type); - return -1; + return 0; } for (ban = list->head; ban; ban = ban->next) @@ -328,10 +315,10 @@ del_id(struct Channel *chptr, char *banid, int type) dlinkDelete(ban, list); free_dlink_node(ban); - return 0; + return 1; } } - return -1; + return 0; } /* @@ -373,7 +360,6 @@ change_channel_membership(struct Channel *chptr, dlinkAdd(who, ptr, loc_to_list); } } -#ifdef HALFOPS else if ((ptr = find_user_link(&chptr->lochalfops, who))) { if (loc_to_list != &chptr->lochalfops) @@ -382,7 +368,6 @@ change_channel_membership(struct Channel *chptr, dlinkAdd(who, ptr, loc_to_list); } } -#endif else if ((ptr = find_user_link(&chptr->locchanops, who))) { if (loc_to_list != &chptr->locchanops) @@ -391,16 +376,6 @@ change_channel_membership(struct Channel *chptr, dlinkAdd(who, ptr, loc_to_list); } } -#ifdef REQUIRE_OANDV - else if ((ptr = find_user_link(&chptr->locchanops_voiced, who))) - { - if (loc_to_list != &chptr->locchanops_voiced) - { - dlinkDelete(ptr, &chptr->locchanops_voiced); - dlinkAdd(who, ptr, loc_to_list); - } - } -#endif else if ((ptr = find_user_link(&chptr->locchanadmins, who))) { if (loc_to_list != &chptr->locchanadmins) @@ -429,7 +404,6 @@ change_channel_membership(struct Channel *chptr, dlinkAdd(who, ptr, to_list); } } -#ifdef HALFOPS else if ((ptr = find_user_link(&chptr->halfops, who))) { if (to_list != &chptr->halfops) @@ -438,7 +412,6 @@ change_channel_membership(struct Channel *chptr, dlinkAdd(who, ptr, to_list); } } -#endif else if ((ptr = find_user_link(&chptr->chanops, who))) { if (to_list != &chptr->chanops) @@ -447,15 +420,6 @@ change_channel_membership(struct Channel *chptr, dlinkAdd(who, ptr, to_list); } } -#ifdef REQUIRE_OANDV - else if ((ptr = find_user_link(&chptr->chanops_voiced, who))) - { - if (to_list != &chptr->chanops_voiced) - { - dlinkDelete(ptr, &chptr->chanops_voiced); - dlinkAdd(who, ptr, to_list); - } - } else if ((ptr = find_user_link(&chptr->chanadmins, who))) { if (to_list != &chptr->chanadmins) @@ -464,7 +428,6 @@ change_channel_membership(struct Channel *chptr, dlinkAdd(who, ptr, to_list); } } -#endif else ok = 0; @@ -509,10 +472,8 @@ channel_modes(struct Channel *chptr, struct Client *client_p, *mbuf++ = 'n'; if (chptr->mode.mode & MODE_OPERSONLY) *mbuf++ = 'O'; -#ifdef ANONOPS if (chptr->mode.mode & MODE_HIDEOPS) *mbuf++ = 'A'; -#endif if (chptr->mode.limit) { *mbuf++ = 'l'; @@ -568,29 +529,43 @@ pretty_mask(char *mask) { at = t; *t++ = '\0'; - host = t; + if (*t != '\0') + host = t; if ((t = strchr(mask, '!')) != NULL) { ex = t; *t++ = '\0'; - user = t; - nick = mask; + if (*t != '\0') + user = t; + if (*mask != '\0') + nick = mask; } else - user = mask; + { + if (*mask != '\0') + user = mask; + } } else if ((t = strchr(mask, '!')) != NULL) { ex = t; *t++ = '\0'; - nick = mask; - user = t; + if (*mask != '\0') + nick = mask; + if (*t != '\0') + user = t; } else if (strchr(mask, '.') != NULL && strchr(mask, ':') != NULL) - host = mask; + { + if (*mask != '\0') + host = mask; + } else - nick = mask; + { + if (*mask != '\0') + nick = mask; + } /* truncate values to max lengths */ if (strlen(nick) > NICKLEN - 1) @@ -808,7 +783,6 @@ chm_simple(struct Client *client_p, struct Client *source_p, const char *chname) { long mode_type; - int i; mode_type = (long)d; @@ -827,7 +801,6 @@ chm_simple(struct Client *client_p, struct Client *source_p, *errors |= SM_ERR_NOOPS; return; } - /* don't allow /* setting + */ @@ -835,22 +808,13 @@ chm_simple(struct Client *client_p, struct Client *source_p, { chptr->mode.mode |= mode_type; - for (i = 0; i < mode_count_minus; i++) - { - if (mode_changes_minus[i].letter == c) - { - /* + and - make 0, so return... */ - mode_changes_minus[i].letter = 0; - return; - } - } - - mode_changes_plus[mode_count_plus].letter = c; - mode_changes_plus[mode_count_plus].caps = 0; - mode_changes_plus[mode_count_plus].nocaps = 0; - mode_changes_plus[mode_count_plus].id = NULL; - mode_changes_plus[mode_count_plus].mems = ALL_MEMBERS; - mode_changes_plus[mode_count_plus++].arg = NULL; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_ADD; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count].mems = ALL_MEMBERS; + mode_changes[mode_count++].arg = NULL; } else if ((dir == MODE_DEL) && (chptr->mode.mode & mode_type)) { @@ -858,45 +822,24 @@ chm_simple(struct Client *client_p, struct Client *source_p, chptr->mode.mode &= ~mode_type; - for (i = 0; i < mode_count_plus; i++) - if (mode_changes_plus[i].letter == c) - { - /* - and + make 0, so return... */ - mode_changes_plus[i].letter = 0; - return; - } - - mode_changes_minus[mode_count_minus].letter = c; - mode_changes_minus[mode_count_minus].caps = 0; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ALL_MEMBERS; - mode_changes_minus[mode_count_minus].id = NULL; - mode_changes_minus[mode_count_minus++].arg = NULL; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ALL_MEMBERS; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count++].arg = NULL; } } /* anonops slightly changed with NeoIRCd. We only allow channel admins to set or remove it. */ -#ifdef ANONOPS static void chm_hideops(struct Client *client_p, struct Client *source_p, struct Channel *chptr, int parc, int *parn, char **parv, int *errors, int alev, int dir, char c, void *d, const char *chname) { - int i; - - /* if we dont support it, dont send it anywhere. well only - * have the capab if we support it, so we should never get - * here for a remote server if we dont support it.. - */ - if(!ConfigChannel.use_anonops) { - if (*errors & SM_ERR_UNKNOWN) - return; - *errors |= SM_ERR_UNKNOWN; - sendto_one(source_p, form_str(ERR_UNKNOWNMODE), me.name, source_p->name, c); - return; - } if (alev < CHACCESS_ADMIN) { if (!(*errors & SM_ERR_NOOPS)) @@ -906,50 +849,31 @@ chm_hideops(struct Client *client_p, struct Client *source_p, return; } - if (dir == MODE_ADD) + if (dir == MODE_ADD && !(chptr->mode.mode & MODE_HIDEOPS)) { - for (i = 0; i < mode_count_minus; i++) - if (mode_changes_minus[i].letter == c) - { - mode_changes_minus[i].letter = 0; - hideops_changed = 0; - return; - } + chptr->mode.mode |= MODE_HIDEOPS; - if (!(chptr->mode.mode & MODE_HIDEOPS)) - { - mode_changes_plus[mode_count_plus].letter = c; - mode_changes_plus[mode_count_plus].caps = CAP_AOPS; - mode_changes_plus[mode_count_plus].nocaps = 0; - mode_changes_plus[mode_count_plus].id = NULL; - mode_changes_plus[mode_count_plus].mems = ALL_MEMBERS; - mode_changes_plus[mode_count_plus++].arg = NULL; - hideops_changed = 1; - } + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_ADD; + mode_changes[mode_count].caps = CAP_AOPS; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count].mems = ALL_MEMBERS; + mode_changes[mode_count++].arg = NULL; } - else if (dir == MODE_DEL) + else if (dir == MODE_DEL && (chptr->mode.mode & MODE_HIDEOPS)) { - for (i = 0; i < mode_count_plus; i++) - if (mode_changes_plus[i].letter == c) - { - mode_changes_plus[i].letter = 0; - hideops_changed = 0; - return; - } + chptr->mode.mode &= ~MODE_HIDEOPS; - if ((chptr->mode.mode & MODE_HIDEOPS)) - { - mode_changes_minus[mode_count_minus].letter = c; - mode_changes_minus[mode_count_minus].caps = CAP_AOPS; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].id = NULL; - mode_changes_minus[mode_count_minus].mems = ALL_MEMBERS; - mode_changes_minus[mode_count_minus++].arg = NULL; - hideops_changed = -1; - } + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = CAP_AOPS; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count].mems = ALL_MEMBERS; + mode_changes[mode_count++].arg = NULL; } } -#endif static void chm_ban(struct Client *client_p, struct Client *source_p, @@ -957,7 +881,6 @@ chm_ban(struct Client *client_p, struct Client *source_p, char **parv, int *errors, int alev, int dir, char c, void *d, const char *chname) { - int i; char *mask; char *raw_mask; dlink_node *ptr; @@ -969,7 +892,6 @@ chm_ban(struct Client *client_p, struct Client *source_p, return; *errors |= SM_ERR_RPL_B; -#ifdef ANONOPS if ((chptr->mode.mode & MODE_HIDEOPS) && (alev < CHACCESS_HALFOP)) for (ptr = chptr->banlist.head; ptr; ptr = ptr->next) { @@ -979,7 +901,6 @@ chm_ban(struct Client *client_p, struct Client *source_p, banptr->banstr, me.name, banptr->when); } else -#endif for (ptr = chptr->banlist.head; ptr; ptr = ptr->next) { banptr = ptr->data; @@ -1019,31 +940,25 @@ chm_ban(struct Client *client_p, struct Client *source_p, */ /* if we're adding a NEW id */ - if ((dir == MODE_ADD) && (add_id(source_p, chptr, mask, CHFL_BAN) == 0)) + if (dir == MODE_ADD) { - for (i = 0; i < mode_count_minus; i++) - { - if (mode_changes_minus[i].letter == c && - !irccmp(mode_changes_minus[i].arg, mask)) - { - mode_changes_minus[i].letter = 0; - return; - } - } + if((add_id(source_p, chptr, mask, CHFL_BAN) == 0) && MyClient(source_p)) + return; - mode_changes_plus[mode_count_plus].letter = c; - mode_changes_plus[mode_count_plus].caps = 0; - mode_changes_plus[mode_count_plus].nocaps = 0; - mode_changes_plus[mode_count_plus].mems = ALL_MEMBERS; - mode_changes_plus[mode_count_plus].id = NULL; - mode_changes_plus[mode_count_plus++].arg = mask; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_ADD; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ALL_MEMBERS; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count++].arg = mask; } else if (dir == MODE_DEL) { if (del_id(chptr, mask, CHFL_BAN) != 0) { /* mask isn't a valid ban, check raw_mask */ - if (del_id(chptr, raw_mask, CHFL_BAN) != 0) + if((del_id(chptr, raw_mask, CHFL_BAN) != 0) && MyClient(source_p)) { /* nope */ return; @@ -1051,22 +966,13 @@ chm_ban(struct Client *client_p, struct Client *source_p, mask = raw_mask; } - for (i = 0; i < mode_count_plus; i++) - { - if (mode_changes_plus[i].letter == c && - !irccmp(mode_changes_plus[i].arg, mask)) - { - mode_changes_plus[i].letter = 0; - return; - } - } - - mode_changes_minus[mode_count_minus].letter = c; - mode_changes_minus[mode_count_minus].caps = 0; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ALL_MEMBERS; - mode_changes_minus[mode_count_minus].id = NULL; - mode_changes_minus[mode_count_minus++].arg = mask; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ALL_MEMBERS; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count++].arg = mask; } } @@ -1076,25 +982,10 @@ chm_except(struct Client *client_p, struct Client *source_p, char **parv, int *errors, int alev, int dir, char c, void *d, const char *chname) { - int i; dlink_node *ptr; struct Ban *banptr; char *mask, *raw_mask; - if(!ConfigChannel.use_except && MyClient(source_p)) - { - if ((*errors & SM_ERR_RPL_E) != 0) - return; - - *errors |= SM_ERR_RPL_E; - - if(dir == MODE_QUERY || parc <= *parn) - sendto_one(client_p, form_str(RPL_ENDOFEXCEPTLIST), - me.name, source_p->name, chname); - - return; - } - if (alev < CHACCESS_HALFOP) { if (!(*errors & SM_ERR_NOOPS)) @@ -1132,36 +1023,25 @@ chm_except(struct Client *client_p, struct Client *source_p, mask = pretty_mask(raw_mask); /* If we're adding a NEW id */ - if ((dir == MODE_ADD) && add_id(source_p, chptr, mask, CHFL_EXCEPTION) == 0) + if (dir == MODE_ADD) { - for (i = 0; i < mode_count_minus; i++) - { - if (mode_changes_minus[i].letter == c && - !irccmp(mode_changes_minus[i].arg, mask)) - { - mode_changes_minus[i].letter = 0; - return; - } - } + if((add_id(source_p, chptr, mask, CHFL_EXCEPTION) == 0) && MyClient(source_p)) + return; - mode_changes_plus[mode_count_plus].letter = c; - mode_changes_plus[mode_count_plus].caps = CAP_EX; - mode_changes_plus[mode_count_plus].nocaps = 0; - - if(ConfigChannel.use_except) - mode_changes_plus[mode_count_plus].mems = ONLY_CHANOPS_HALFOPS; - else - mode_changes_plus[mode_count_plus].mems = ONLY_SERVERS; - - mode_changes_plus[mode_count_plus].id = NULL; - mode_changes_plus[mode_count_plus++].arg = mask; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_ADD; + mode_changes[mode_count].caps = CAP_EX; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count++].arg = mask; } else if (dir == MODE_DEL) { if (del_id(chptr, mask, CHFL_EXCEPTION) != 0) { /* mask isn't a valid ban, check raw_mask */ - if (del_id(chptr, raw_mask, CHFL_EXCEPTION) != 0) + if((del_id(chptr, raw_mask, CHFL_EXCEPTION) != 0) && MyClient(source_p)) { /* nope */ return; @@ -1169,22 +1049,13 @@ chm_except(struct Client *client_p, struct Client *source_p, mask = raw_mask; } - for (i = 0; i < mode_count_plus; i++) - { - if (mode_changes_plus[i].letter == c && - !irccmp(mode_changes_plus[i].arg, mask)) - { - mode_changes_plus[i].letter = 0; - return; - } - } - - mode_changes_minus[mode_count_minus].letter = c; - mode_changes_minus[mode_count_minus].caps = CAP_EX; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_minus[mode_count_minus].id = NULL; - mode_changes_minus[mode_count_minus++].arg = mask; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = CAP_EX; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count++].arg = mask; } } @@ -1194,26 +1065,10 @@ chm_invex(struct Client *client_p, struct Client *source_p, char **parv, int *errors, int alev, int dir, char c, void *d, const char *chname) { - int i; char *mask, *raw_mask; dlink_node *ptr; struct Ban *banptr; - /* if its our client setting a +I, drop it. */ - if(!ConfigChannel.use_invex && MyClient(source_p)) - { - if((*errors & SM_ERR_RPL_I) != 0) - return; - - *errors |= SM_ERR_RPL_I; - - if(dir == MODE_QUERY || parc <= *parn) - sendto_one(source_p, form_str(RPL_ENDOFINVITELIST), - me.name, source_p->name, chname); - - return; - } - if (alev < CHACCESS_HALFOP) { if (!(*errors & SM_ERR_NOOPS)) @@ -1250,43 +1105,25 @@ chm_invex(struct Client *client_p, struct Client *source_p, else mask = pretty_mask(raw_mask); - /* will cause a desync, cant be done */ -#if 0 - if (strlen(mask) > NICKLEN+USERLEN+HOSTLEN) - return; -#endif - - if ((dir == MODE_ADD) && add_id(source_p, chptr, mask, CHFL_INVEX) == 0) + if(dir == MODE_ADD) { - for (i = 0; i < mode_count_minus; i++) - { - if (mode_changes_minus[i].letter == c && - !irccmp(mode_changes_minus[i].arg, mask)) - { - /* It cancels out, just return... */ - mode_changes_minus[i].letter = 0; - return; - } - } + if((add_id(source_p, chptr, mask, CHFL_INVEX) == 0) && MyClient(source_p)) + return; - mode_changes_plus[mode_count_plus].letter = c; - mode_changes_plus[mode_count_plus].caps = CAP_IE; - mode_changes_plus[mode_count_plus].nocaps = 0; - - if(ConfigChannel.use_invex) - mode_changes_plus[mode_count_plus].mems = ONLY_CHANOPS_HALFOPS; - else - mode_changes_plus[mode_count_plus].mems = ONLY_SERVERS; - - mode_changes_plus[mode_count_plus].id = NULL; - mode_changes_plus[mode_count_plus++].arg = mask; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_ADD; + mode_changes[mode_count].caps = CAP_IE; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count++].arg = mask; } else if (dir == MODE_DEL) { if (del_id(chptr, mask, CHFL_INVEX) != 0) { /* mask isn't a valid ban, check raw_mask */ - if (del_id(chptr, raw_mask, CHFL_INVEX) != 0) + if((del_id(chptr, raw_mask, CHFL_INVEX) != 0) && MyClient(source_p)) { /* nope */ return; @@ -1294,28 +1131,13 @@ chm_invex(struct Client *client_p, struct Client *source_p, mask = raw_mask; } - for (i = 0; i < mode_count_plus; i++) - { - if (mode_changes_plus[i].letter == c && - !irccmp(mode_changes_plus[i].arg, mask)) - { - /* It cancels out, so just return... */ - mode_changes_plus[i].letter = 0; - return; - } - } - - mode_changes_minus[mode_count_minus].letter = c; - mode_changes_minus[mode_count_minus].caps = CAP_IE; - mode_changes_minus[mode_count_minus].nocaps = 0; - - if(ConfigChannel.use_invex) - mode_changes_minus[mode_count_minus].mems = ONLY_CHANOPS_HALFOPS; - else - mode_changes_minus[mode_count_minus].mems = ONLY_SERVERS; - - mode_changes_minus[mode_count_minus].id = NULL; - mode_changes_minus[mode_count_minus++].arg = mask; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = CAP_IE; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count++].arg = mask; } } @@ -1326,6 +1148,7 @@ chm_admin(struct Client *client_p, struct Client *source_p, const char *chname) { int i, wasnt_voiced = 0, t_voice, t_op, t_hop, t_admin; + int wasnt_oped = 0, wasnt_hoped = 0; char *opnick; struct Client *targ_p; @@ -1347,12 +1170,8 @@ chm_admin(struct Client *client_p, struct Client *source_p, opnick = parv[(*parn)++]; - if ((targ_p = find_client(opnick)) == NULL) + if ((targ_p = find_chasing(source_p, opnick, NULL)) == NULL) { - if (!(*errors & SM_ERR_NOTONCHANNEL)) - sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, - source_p->name, opnick); - *errors |= SM_ERR_NOTONCHANNEL; return; } @@ -1371,84 +1190,89 @@ chm_admin(struct Client *client_p, struct Client *source_p, ((dir == MODE_DEL) && !t_hop)) return; - - /* Cancel out all other mode changes... */ - for (i = 0; i < mode_count_plus; i++) - if ((mode_changes_plus[i].letter == 'v' || mode_changes_plus[i].letter == 'o' || - mode_changes_plus[i].letter == 'h') - && mode_changes_plus[i].client == targ_p) + for (i = 0; i < mode_count; i++) + if (mode_changes[i].dir == MODE_ADD && + (mode_changes[i].letter == 'o' + || mode_changes[i].letter == 'h' + || mode_changes[i].letter == 'v' + ) + && mode_changes[i].client == targ_p) { - if (mode_changes_plus[i].letter == 'a') + if (mode_changes[i].letter == 'a') { - mode_changes_plus[i].letter = 0; + mode_changes[i].letter = 0; return; } - mode_changes_plus[i].letter = 0; - wasnt_voiced = 1; + else if (mode_changes[i].letter == 'h') + wasnt_hoped = 1; + else if (mode_changes[i].letter == 'v') + wasnt_voiced = 1; + else if (mode_changes[i].letter == 'o') + wasnt_oped = 1; + + mode_changes[i].letter = 0; } if (dir == MODE_ADD) { - for (i = 0; i < mode_count_minus; i++) - if (mode_changes_minus[i].letter == 'a' - && mode_changes_minus[i].client == targ_p) - { - mode_changes_minus[i].letter = 0; - return; - } if (!wasnt_voiced && t_voice) { - mode_changes_minus[mode_count_minus].letter = 'v'; - mode_changes_minus[mode_count_minus].caps = 0; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_minus[mode_count_minus].id = targ_p->user->id; - mode_changes_minus[mode_count_minus].arg = targ_p->name; - mode_changes_minus[mode_count_minus++].client = targ_p; + mode_changes[mode_count].letter = 'v'; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; } - if (!wasnt_voiced && t_op) + if (!wasnt_hoped && t_hop) { - mode_changes_minus[mode_count_minus].letter = 'o'; - mode_changes_minus[mode_count_minus].caps = 0; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_minus[mode_count_minus].id = targ_p->user->id; - mode_changes_minus[mode_count_minus].arg = targ_p->name; - mode_changes_minus[mode_count_minus++].client = targ_p; + mode_changes[mode_count].letter = 'h'; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = CAP_HOPS; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; } - if (!wasnt_voiced && t_hop) + if (!wasnt_oped && t_op) { - mode_changes_minus[mode_count_minus].letter = 'v'; - mode_changes_minus[mode_count_minus].caps = 0; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_minus[mode_count_minus].id = targ_p->user->id; - mode_changes_minus[mode_count_minus].arg = targ_p->name; - mode_changes_minus[mode_count_minus++].client = targ_p; - } + mode_changes[mode_count].letter = 'o'; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; + } - mode_changes_plus[mode_count_plus].letter = c; - mode_changes_plus[mode_count_plus].caps = CAP_HOPS; - mode_changes_plus[mode_count_plus].nocaps = 0; - mode_changes_plus[mode_count_plus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_plus[mode_count_plus].id = targ_p->user->id; - mode_changes_plus[mode_count_plus].arg = targ_p->name; - mode_changes_plus[mode_count_plus++].client = targ_p; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_ADD; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; } - else - { /* MODE_DEL */ - mode_changes_minus[mode_count_minus].letter = 'a'; - mode_changes_minus[mode_count_minus].caps = CAP_HOPS; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_minus[mode_count_minus].id = targ_p->user->id; - mode_changes_minus[mode_count_minus].arg = targ_p->name; - mode_changes_minus[mode_count_minus++].client = targ_p; - + else + { + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; } } + static void chm_op(struct Client *client_p, struct Client *source_p, struct Channel *chptr, int parc, int *parn, @@ -1471,9 +1295,7 @@ chm_op(struct Client *client_p, struct Client *source_p, int wasnt_voiced = 0, t_op, t_hop, t_voice, t_admin; char *opnick; struct Client *targ_p; -#ifdef HALFOPS int wasnt_hopped = 0; -#endif if (alev < ((chptr->mode.mode & MODE_PRIVATE) ? @@ -1503,12 +1325,8 @@ chm_op(struct Client *client_p, struct Client *source_p, opnick = parv[(*parn)++]; - if ((targ_p = find_client(opnick)) == NULL) + if ((targ_p = find_chasing(source_p, opnick, NULL)) == NULL) { - if (!(*errors & SM_ERR_NOTONCHANNEL)) - sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, - source_p->name, opnick); - *errors |= SM_ERR_NOTONCHANNEL; return; } @@ -1525,9 +1343,7 @@ chm_op(struct Client *client_p, struct Client *source_p, if (((dir == MODE_ADD) && t_op) || ((dir == MODE_DEL) && !t_op -#ifdef HALFOPS && !t_hop -#endif )) return; @@ -1536,77 +1352,63 @@ chm_op(struct Client *client_p, struct Client *source_p, /* Cancel mode changes... */ - for (i = 0; i < mode_count_plus; i++) - if ((mode_changes_plus[i].letter == 'o' -#ifdef HALFOPS - || mode_changes_plus[i].letter == 'h' -#endif -#ifndef REQUIRE_OANDV - || mode_changes_plus[i].letter == 'v' -#endif + for (i = 0; i < mode_count; i++) + if (mode_changes[i].dir == MODE_ADD && + (mode_changes[i].letter == 'o' + || mode_changes[i].letter == 'h' + || mode_changes[i].letter == 'v' ) - && mode_changes_plus[i].client == targ_p) + && mode_changes[i].client == targ_p) { - if (mode_changes_plus[i].letter == 'o') + if (mode_changes[i].letter == 'o') { - mode_changes_plus[i].letter = 0; + mode_changes[i].letter = 0; return; } -#ifdef HALFOPS - else if (mode_changes_plus[i].letter == 'h') + else if (mode_changes[i].letter == 'h') wasnt_hopped = 1; -#endif - else if (mode_changes_plus[i].letter == 'v') + else if (mode_changes[i].letter == 'v') wasnt_voiced = 1; - mode_changes_plus[i].letter = 0; + mode_changes[i].letter = 0; } if (dir == MODE_ADD) { - for (i = 0; i < mode_count_minus; i++) - if (mode_changes_minus[i].letter == 'o' - && mode_changes_minus[i].client == targ_p) - { - mode_changes_minus[i].letter = 0; /* clear the mode */ - return; - } -#ifndef REQUIRE_OANDV if (!wasnt_voiced && t_voice) { - mode_changes_minus[mode_count_minus].letter = 'v'; - mode_changes_minus[mode_count_minus].caps = 0; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_minus[mode_count_minus].id = targ_p->user->id; - mode_changes_minus[mode_count_minus].arg = targ_p->name; - mode_changes_minus[mode_count_minus++].client = targ_p; + mode_changes[mode_count].letter = 'v'; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; } -#endif -#ifdef HALFOPS if (!wasnt_hopped && t_hop) { - mode_changes_minus[mode_count_minus].letter = 'h'; - mode_changes_minus[mode_count_minus].caps = CAP_HOPS; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_minus[mode_count_minus].id = targ_p->user->id; - mode_changes_minus[mode_count_minus].arg = targ_p->name; - mode_changes_minus[mode_count_minus++].client = targ_p; + mode_changes[mode_count].letter = 'h'; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = CAP_HOPS; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; } -#endif - mode_changes_plus[mode_count_plus].letter = c; - mode_changes_plus[mode_count_plus].caps = 0; - mode_changes_plus[mode_count_plus].nocaps = 0; - mode_changes_plus[mode_count_plus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_plus[mode_count_plus].id = targ_p->user->id; - mode_changes_plus[mode_count_plus].arg = targ_p->name; - mode_changes_plus[mode_count_plus++].client = targ_p; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_ADD; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; } else { -#ifdef HALFOPS /* Converting -o to -h... */ if (t_hop) { @@ -1623,40 +1425,41 @@ chm_op(struct Client *client_p, struct Client *source_p, /* check if this just canceled out an earlier mode we cleared */ if (!wasnt_hopped) { - mode_changes_minus[mode_count_minus].letter = 'h'; - mode_changes_minus[mode_count_minus].caps = CAP_HOPS; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_minus[mode_count_minus].id = NULL; - mode_changes_minus[mode_count_minus].arg = targ_p->name; - mode_changes_minus[mode_count_minus++].client = targ_p; + mode_changes[mode_count].letter = 'h'; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = CAP_HOPS; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; #ifdef BOUNCE_BAD_HOPS - mode_changes_minus[mode_count_minus].letter = 'o'; - mode_changes_minus[mode_count_minus].caps = 0; - mode_changes_minus[mode_count_minus].nocaps = CAP_HOPS; - mode_changes_minus[mode_count_minus].mems = ONLY_SERVERS; - mode_changes_minus[mode_count_minus].id = NULL; - mode_changes_minus[mode_count_minus].arg = targ_p->name; - mode_changes_minus[mode_count_minus++].client = targ_p; + mode_changes[mode_count].letter = 'o'; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = CAP_HOPS; + mode_changes[mode_count].mems = ONLY_SERVERS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; #endif } } else -#endif { - mode_changes_minus[mode_count_minus].letter = c; - mode_changes_minus[mode_count_minus].caps = 0; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_minus[mode_count_minus].id = NULL; - mode_changes_minus[mode_count_minus].arg = targ_p->name; - mode_changes_minus[mode_count_minus++].client = targ_p; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; } } } -#ifdef HALFOPS static void chm_halfop(struct Client *client_p, struct Client *source_p, struct Channel *chptr, int parc, int *parn, @@ -1667,13 +1470,6 @@ chm_halfop(struct Client *client_p, struct Client *source_p, char *opnick; struct Client *targ_p; - /* halfops have been disabled.. disallow local users to set, - * remote is taken care of via BOUNCE_BAD_HOPS, and we shouldnt - * get halfops because we unset CAP_HOPS anyway.. - */ - if(!ConfigChannel.use_halfops && MyClient(source_p)) - return; - /* *sigh* - dont allow halfops to set +/-h, they could fully control a * channel if there were no ops - it doesnt solve anything.. MODE_PRIVATE * when used with MODE_SECRET is paranoid - cant use +p @@ -1706,12 +1502,8 @@ chm_halfop(struct Client *client_p, struct Client *source_p, opnick = parv[(*parn)++]; - if ((targ_p = find_client(opnick)) == NULL) + if ((targ_p = find_chasing(source_p, opnick, NULL)) == NULL) { - if (!(*errors & SM_ERR_NOTONCHANNEL)) - sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, - source_p->name, opnick); - *errors |= SM_ERR_NOTONCHANNEL; return; } @@ -1751,81 +1543,78 @@ chm_halfop(struct Client *client_p, struct Client *source_p, #endif /* Cancel out all other mode changes... */ - for (i = 0; i < mode_count_plus; i++) - if ((mode_changes_plus[i].letter == 'v' || - mode_changes_plus[i].letter == 'h') - && mode_changes_plus[i].client == targ_p) + for (i = 0; i < mode_count; i++) + if (mode_changes[i].dir == MODE_ADD && + (mode_changes[i].letter == 'v' || + mode_changes[i].letter == 'h') + && mode_changes[i].client == targ_p) { - if (mode_changes_plus[i].letter == 'h') + if (mode_changes[i].letter == 'h') { - mode_changes_plus[i].letter = 0; + mode_changes[i].letter = 0; return; } - mode_changes_plus[i].letter = 0; + mode_changes[i].letter = 0; wasnt_voiced = 1; } if (dir == MODE_ADD) { - for (i = 0; i < mode_count_minus; i++) - if (mode_changes_minus[i].letter == 'h' - && mode_changes_minus[i].client == targ_p) - { - mode_changes_minus[i].letter = 0; - return; - } - if (!wasnt_voiced && t_voice) { - mode_changes_minus[mode_count_minus].letter = 'v'; - mode_changes_minus[mode_count_minus].caps = 0; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_minus[mode_count_minus].id = targ_p->user->id; - mode_changes_minus[mode_count_minus].arg = targ_p->name; - mode_changes_minus[mode_count_minus++].client = targ_p; + mode_changes[mode_count].letter = 'v'; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; } - mode_changes_plus[mode_count_plus].letter = c; - mode_changes_plus[mode_count_plus].caps = CAP_HOPS; - mode_changes_plus[mode_count_plus].nocaps = 0; - mode_changes_plus[mode_count_plus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_plus[mode_count_plus].id = targ_p->user->id; - mode_changes_plus[mode_count_plus].arg = targ_p->name; - mode_changes_plus[mode_count_plus++].client = targ_p; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_ADD; + mode_changes[mode_count].caps = CAP_HOPS; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; #ifdef BOUNCE_BAD_HOPS - mode_changes_plus[mode_count_plus].letter = 'o'; - mode_changes_plus[mode_count_plus].caps = 0; - mode_changes_plus[mode_count_plus].nocaps = CAP_HOPS; - mode_changes_plus[mode_count_plus].mems = ONLY_SERVERS; - mode_changes_plus[mode_count_plus].id = targ_p->user->id; - mode_changes_plus[mode_count_plus].arg = targ_p->name; - mode_changes_plus[mode_count_plus++].client = targ_p; + mode_changes[mode_count].letter = 'o'; + mode_changes[mode_count].dir = MODE_ADD; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = CAP_HOPS; + mode_changes[mode_count].mems = ONLY_SERVERS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; #endif } else { /* MODE_DEL */ - mode_changes_minus[mode_count_minus].letter = 'h'; - mode_changes_minus[mode_count_minus].caps = CAP_HOPS; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_minus[mode_count_minus].id = targ_p->user->id; - mode_changes_minus[mode_count_minus].arg = targ_p->name; - mode_changes_minus[mode_count_minus++].client = targ_p; + mode_changes[mode_count].letter = 'h'; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = CAP_HOPS; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; #ifdef BOUNCE_BAD_HOPS - mode_changes_minus[mode_count_minus].letter = 'o'; - mode_changes_minus[mode_count_minus].caps = 0; - mode_changes_minus[mode_count_minus].nocaps = CAP_HOPS; - mode_changes_minus[mode_count_minus].mems = ONLY_SERVERS; - mode_changes_minus[mode_count_minus].id = targ_p->user->id; - mode_changes_minus[mode_count_minus].arg = targ_p->name; - mode_changes_minus[mode_count_minus++].client = targ_p; + mode_changes[mode_count].letter = 'o'; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = CAP_HOPS; + mode_changes[mode_count].mems = ONLY_SERVERS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; #endif } } -#endif static void chm_voice(struct Client *client_p, struct Client *source_p, @@ -1851,12 +1640,8 @@ chm_voice(struct Client *client_p, struct Client *source_p, opnick = parv[(*parn)++]; - if ((targ_p = find_client(opnick)) == NULL) + if ((targ_p = find_chasing(source_p, opnick, NULL)) == NULL) { - if (!(*errors & SM_ERR_NOTONCHANNEL)) - sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, - source_p->name, opnick); - *errors |= SM_ERR_NOTONCHANNEL; return; } @@ -1875,50 +1660,43 @@ chm_voice(struct Client *client_p, struct Client *source_p, return; if ( -#ifndef REQUIRE_OANDV t_op || -#endif -#ifdef HALFOPS t_hop || -#endif (dir == MODE_ADD && t_voice) || (dir == MODE_DEL && !t_voice)) return; if (dir == MODE_ADD) { - for (i = 0; i < mode_count_minus; i++) - if (mode_changes_minus[i].letter == 'v' - && mode_changes_minus[i].client == targ_p) - { - mode_changes_minus[i].letter = 0; - return; - } - - mode_changes_plus[mode_count_plus].letter = c; - mode_changes_plus[mode_count_plus].caps = 0; - mode_changes_plus[mode_count_plus].nocaps = 0; - mode_changes_plus[mode_count_plus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_plus[mode_count_plus].id = targ_p->user->id; - mode_changes_plus[mode_count_plus].arg = targ_p->name; - mode_changes_plus[mode_count_plus++].client = targ_p; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_ADD; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; } - else { - for (i = 0; i < mode_count_plus; i++) - if (mode_changes_plus[i].letter == 'v' - && mode_changes_plus[i].client == targ_p) + else + { + for (i = 0; i < mode_count; i++) + { + if (mode_changes[i].dir == MODE_ADD && mode_changes[i].letter == 'v' + && mode_changes[i].client == targ_p) { - mode_changes_plus[i].letter = 0; + mode_changes[i].letter = 0; return; } + } - mode_changes_minus[mode_count_minus].letter = 'v'; - mode_changes_minus[mode_count_minus].caps = 0; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ONLY_CHANOPS_HALFOPS; - mode_changes_minus[mode_count_minus].id = targ_p->user->id; - mode_changes_minus[mode_count_minus].arg = targ_p->name; - mode_changes_minus[mode_count_minus++].client = targ_p; + mode_changes[mode_count].letter = 'v'; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ONLY_CHANOPS_HALFOPS; + mode_changes[mode_count].id = targ_p->user->id; + mode_changes[mode_count].arg = targ_p->name; + mode_changes[mode_count++].client = targ_p; } } @@ -1952,20 +1730,20 @@ chm_limit(struct Client *client_p, struct Client *source_p, ircsprintf(lstr, "%d", limit); - for (i = 0; i < mode_count_minus; i++) - if (mode_changes_minus[i].letter == c) - mode_changes_minus[i].letter = 0; + /* if somebody sets MODE #channel +ll 1 2, accept latter --fl */ + for (i = 0; i < mode_count; i++) + { + if (mode_changes[i].letter == c && mode_changes[i].dir == MODE_ADD) + mode_changes[i].letter = 0; + } - for (i = 0; i < mode_count_plus; i++) - if (mode_changes_plus[i].letter == c) - mode_changes_plus[i].letter = 0; - - mode_changes_plus[mode_count_plus].letter = c; - mode_changes_plus[mode_count_plus].caps = 0; - mode_changes_plus[mode_count_plus].nocaps = 0; - mode_changes_plus[mode_count_plus].mems = ALL_MEMBERS; - mode_changes_plus[mode_count_plus].id = NULL; - mode_changes_plus[mode_count_plus++].arg = lstr; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_ADD; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ALL_MEMBERS; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count++].arg = lstr; chptr->mode.limit = limit; } @@ -1976,21 +1754,13 @@ chm_limit(struct Client *client_p, struct Client *source_p, chptr->mode.limit = 0; - for (i = 0; i < mode_count_plus; i++) - { - if (mode_changes_plus[i].letter == c) - { - mode_changes_plus[i].letter = 0; - return; - } - } - - mode_changes_minus[mode_count_minus].letter = c; - mode_changes_minus[mode_count_minus].caps = 0; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ALL_MEMBERS; - mode_changes_minus[mode_count_minus].id = NULL; - mode_changes_minus[mode_count_minus++].arg = NULL; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ALL_MEMBERS; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count++].arg = NULL; } } @@ -2027,24 +1797,20 @@ chm_key(struct Client *client_p, struct Client *source_p, assert(key[0] != ' '); strlcpy(chptr->mode.key, key, KEYLEN); - for (i = 0; i < mode_count_minus; i++) + /* if somebody does MODE #channel +kk a b, accept latter --fl */ + for (i = 0; i < mode_count; i++) { - if (mode_changes_minus[i].letter == c) - mode_changes_minus[i].letter = 0; + if (mode_changes[i].letter == c && mode_changes[i].dir == MODE_ADD) + mode_changes[i].letter = 0; } - for (i = 0; i < mode_count_plus; i++) - { - if (mode_changes_plus[i].letter == c) - mode_changes_plus[i].letter = 0; - } - - mode_changes_plus[mode_count_plus].letter = c; - mode_changes_plus[mode_count_plus].caps = 0; - mode_changes_plus[mode_count_plus].nocaps = 0; - mode_changes_plus[mode_count_plus].mems = ALL_MEMBERS; - mode_changes_plus[mode_count_plus].id = NULL; - mode_changes_plus[mode_count_plus++].arg = chptr->mode.key; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_ADD; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ALL_MEMBERS; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count++].arg = chptr->mode.key; } else if (dir == MODE_DEL) { @@ -2053,18 +1819,13 @@ chm_key(struct Client *client_p, struct Client *source_p, *chptr->mode.key = 0; - for (i = 0; i < mode_count_plus; i++) - { - if (mode_changes_plus[i].letter == c) - mode_changes_plus[i].letter = 0; - } - - mode_changes_minus[mode_count_minus].letter = c; - mode_changes_minus[mode_count_minus].caps = 0; - mode_changes_minus[mode_count_minus].nocaps = 0; - mode_changes_minus[mode_count_minus].mems = ALL_MEMBERS; - mode_changes_minus[mode_count_minus].id = NULL; - mode_changes_minus[mode_count_minus++].arg = "*"; + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ALL_MEMBERS; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count++].arg = "*"; } } @@ -2119,11 +1880,7 @@ static struct ChannelMode ModeTable[255] = {chm_except, NULL}, /* e */ {chm_nosuch, NULL}, /* f */ {chm_nosuch, NULL}, /* g */ -#ifdef HALFOPS {chm_halfop, NULL}, /* h */ -#else - {chm_nosuch, NULL}, /* h */ -#endif {chm_simple, (void *) MODE_INVITEONLY}, /* i */ {chm_nosuch, NULL}, /* j */ {chm_key, NULL}, /* k */ @@ -2166,10 +1923,8 @@ get_channel_access(struct Client *source_p, struct Channel *chptr) if (is_chan_op(chptr, source_p)) return CHACCESS_CHANOP; -#ifdef HALFOPS if (is_half_op(chptr, source_p)) return CHACCESS_HALFOP; -#endif return CHACCESS_PEON; } @@ -2199,11 +1954,14 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p, { int i, mbl, pbl, nc, mc; char *arg; + int dir; mc = 0; nc = 0; pbl = 0; parabuf[0] = 0; + dir = MODE_QUERY; + if ((cap & CAP_UID) && source_p->user && (source_p->user->id[0] == '.')) mbl = ircsprintf(modebuf, ":%s MODE %s ", source_p->user->id, @@ -2212,29 +1970,24 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p, mbl = ircsprintf(modebuf, ":%s MODE %s ", source_p->name, chptr->chname); - if (mode_count_minus > 0) - { - modebuf[mbl++] = '-'; - modebuf[mbl] = 0; - } - /* loop the list of - modes we have */ - for (i = 0; i < mode_count_minus; i++) + for (i = 0; i < mode_count; i++) { /* if they dont support the cap we need, or they do support a cap they * cant have, then dont add it to the modebuf.. that way they wont see * the mode */ - if ((mode_changes_minus[i].letter == 0) || - ((cap & mode_changes_minus[i].caps) != mode_changes_minus[i].caps) - || ((nocap & mode_changes_minus[i].nocaps) - != mode_changes_minus[i].nocaps)) + if ((mode_changes[i].letter == 0) || + ((cap & mode_changes[i].caps) != mode_changes[i].caps) + || ((nocap & mode_changes[i].nocaps) != mode_changes[i].nocaps)) continue; + arg = ""; - if ((cap & CAP_UID) && mode_changes_minus[i].id) - arg = mode_changes_minus[i].id; + if ((cap & CAP_UID) && mode_changes[i].id) + arg = mode_changes[i].id; if (!*arg) - arg = mode_changes_minus[i].arg; + arg = mode_changes[i].arg; + /* if we're creeping past the buf size, we need to send it and make * another line for the other modes * XXX - this could give away server topology with uids being @@ -2250,18 +2003,26 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p, LL_ICHAN | LL_ICLIENT, "%s %s", modebuf, parabuf); nc = 0; mc = 0; + if ((cap & CAP_UID) && source_p->user && (source_p->user->id[0] == '.')) - mbl = ircsprintf(modebuf, ":%s MODE %s -", source_p->user->id, + mbl = ircsprintf(modebuf, ":%s MODE %s ", source_p->user->id, chptr->chname); else - mbl = ircsprintf(modebuf, ":%s MODE %s -", source_p->name, + mbl = ircsprintf(modebuf, ":%s MODE %s ", source_p->name, chptr->chname); + pbl = 0; parabuf[0] = 0; } - modebuf[mbl++] = mode_changes_minus[i].letter; + if(dir != mode_changes[i].dir) + { + modebuf[mbl++] = (mode_changes[i].dir == MODE_ADD) ? '+' : '-'; + dir = mode_changes[i].dir; + } + + modebuf[mbl++] = mode_changes[i].letter; modebuf[mbl] = 0; nc++; @@ -2274,71 +2035,8 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p, } } - if (mode_count_plus > 0) - { - if (mbl > 0 && modebuf[mbl - 1] == '-') - modebuf[mbl - 1] = '+'; - else - modebuf[mbl++] = '+'; - - modebuf[mbl] = 0; - } - - /* loop the + modes */ - for (i = 0; i < mode_count_plus; i++) - { - /* same as above, check they support needed capabs, and dont have - * capabs we dont want.. - */ - if (mode_changes_plus[i].letter == 0 || - (cap & mode_changes_plus[i].caps) != mode_changes_plus[i].caps - || ((nocap & mode_changes_plus[i].nocaps) != - mode_changes_plus[i].nocaps)) - continue; - - arg = mode_changes_plus[i].arg; - if ((cap & CAP_UID) && mode_changes_plus[i].id != NULL) - arg = mode_changes_plus[i].id; - - if ((arg != NULL) && ((mc == MAXMODEPARAMS) || - ((strlen(arg) + mbl + pbl + 2) > BUFSIZE))) - { - if (mbl && modebuf[mbl - 1] == '+') - modebuf[mbl - 1] = '\0'; - - if (nc != 0) - sendto_server(client_p, source_p, chptr, cap, nocap, - LL_ICLIENT, "%s %s", modebuf, parabuf); - nc = 0; - mc = 0; - if ((cap & CAP_UID) && source_p->user && - (source_p->user->id[0] == '.')) - mbl = ircsprintf(modebuf, ":%s MODE %s +", source_p->user->id, - chptr->chname); - else - mbl = ircsprintf(modebuf, ":%s MODE %s +", source_p->name, - chptr->chname); - pbl = 0; - parabuf[0] = 0; - } - - modebuf[mbl++] = mode_changes_plus[i].letter; - modebuf[mbl] = 0; - nc++; - - if (mode_changes_plus[i].arg != NULL) - { - pbl = strlcat(parabuf, mode_changes_plus[i].arg, MODEBUFLEN); - parabuf[pbl++] = ' '; - parabuf[pbl] = '\0'; - mc++; - } - } - if (pbl && parabuf[pbl - 1] == ' ') parabuf[pbl - 1] = 0; - if (mbl && modebuf[mbl - 1] == '+') - modebuf[mbl - 1] = 0; if (nc != 0) sendto_server(client_p, source_p, chptr, cap, nocap, @@ -2361,26 +2059,18 @@ send_mode_changes(struct Client *client_p, struct Client *source_p, { int pbl, mbl, nc, mc; int i, st; -#ifdef HALFOPS int dir = MODE_QUERY; -#endif /* bail out if we have nothing to do... */ - if (!(mode_count_plus || mode_count_minus -#ifdef HALFOPS + if (!(mode_count || bounce_count -#endif )) return; /* Send all mode changes to the chanops/halfops, and even peons if * we are not +a... */ -#ifdef ANONOPS st = (chptr->mode.mode & MODE_HIDEOPS) ? ONLY_CHANOPS_HALFOPS : ALL_MEMBERS; -#else - st = ALL_MEMBERS; -#endif if (IsServer(source_p)) mbl = ircsprintf(modebuf, ":%s MODE %s ", me.name, chname); @@ -2393,21 +2083,16 @@ send_mode_changes(struct Client *client_p, struct Client *source_p, nc = 0; mc = 0; - if (mode_count_minus > 0) + for (i = 0; i < mode_count; i++) { - modebuf[mbl++] = '-'; - modebuf[mbl] = '\0'; - } - - for (i = 0; i < mode_count_minus; i++) - { - if (mode_changes_minus[i].letter == 0 || - mode_changes_minus[i].mems == NON_CHANOPS || - mode_changes_minus[i].mems == ONLY_SERVERS) + if (mode_changes[i].letter == 0 || + mode_changes[i].mems == NON_CHANOPS || + mode_changes[i].mems == ONLY_SERVERS) continue; - if (mode_changes_minus[i].arg != NULL && + + if (mode_changes[i].arg != NULL && ((mc == MAXMODEPARAMS) || - ((strlen(mode_changes_minus[i].arg) + mbl + pbl + 2) > BUFSIZE))) + ((strlen(mode_changes[i].arg) + mbl + pbl + 2) > BUFSIZE))) { if (mbl && modebuf[mbl - 1] == '-') modebuf[mbl - 1] = '\0'; @@ -2428,65 +2113,20 @@ send_mode_changes(struct Client *client_p, struct Client *source_p, parabuf[0] = '\0'; } - modebuf[mbl++] = mode_changes_minus[i].letter; + if(dir != mode_changes[i].dir) + { + modebuf[mbl++] = (mode_changes[i].dir == MODE_ADD) ? '+' : '-'; + dir = mode_changes[i].dir; + } + + modebuf[mbl++] = mode_changes[i].letter; modebuf[mbl] = '\0'; nc++; - if (mode_changes_minus[i].arg != NULL) + if (mode_changes[i].arg != NULL) { mc++; - pbl = strlen(strcat(parabuf, mode_changes_minus[i].arg)); - parabuf[pbl++] = ' '; - parabuf[pbl] = '\0'; - } - } - - if (mode_count_plus > 0) - { - if (mbl > 0 && modebuf[mbl - 1] == '-') - modebuf[mbl - 1] = '+'; - else - modebuf[mbl++] = '+'; - modebuf[mbl] = '\0'; - } - - for (i = 0; i < mode_count_plus; i++) - { - if (mode_changes_plus[i].letter == 0 || - mode_changes_plus[i].mems == NON_CHANOPS || - mode_changes_plus[i].mems == ONLY_SERVERS) - continue; - if (mode_changes_plus[i].arg != NULL && - ((mc == MAXMODEPARAMS) || - ((strlen(mode_changes_plus[i].arg) + mbl + pbl + 2) > BUFSIZE))) - { - if (mbl && modebuf[mbl - 1] == '+') - modebuf[mbl - 1] = '\0'; - - if (nc != 0) - sendto_channel_local(st, chptr, "%s %s", modebuf, parabuf); - - nc = 0; - mc = 0; - - if (IsServer(source_p)) - mbl = ircsprintf(modebuf, ":%s MODE %s +", me.name, chname); - else - mbl = ircsprintf(modebuf, ":%s!%s@%s MODE %s +", source_p->name, - source_p->username, source_p->vhost, chname); - - pbl = 0; - parabuf[0] = '\0'; - } - - modebuf[mbl++] = mode_changes_plus[i].letter; - modebuf[mbl] = '\0'; - nc++; - - if (mode_changes_plus[i].arg != NULL) - { - mc++; - pbl = strlen(strcat(parabuf, mode_changes_plus[i].arg)); + pbl = strlen(strcat(parabuf, mode_changes[i].arg)); parabuf[pbl++] = ' '; parabuf[pbl] = '\0'; } @@ -2494,8 +2134,6 @@ send_mode_changes(struct Client *client_p, struct Client *source_p, if (pbl && parabuf[pbl - 1] == ' ') parabuf[pbl - 1] = 0; - if (mbl && modebuf[mbl - 1] == '+') - modebuf[mbl - 1] = 0; if (nc != 0) sendto_channel_local(st, chptr, "%s %s", modebuf, parabuf); @@ -2503,39 +2141,33 @@ send_mode_changes(struct Client *client_p, struct Client *source_p, nc = 0; mc = 0; -#ifdef ANONOPS /* If peons were missed out above, send to them now... */ if (chptr->mode.mode & MODE_HIDEOPS) { st = NON_CHANOPS; + dir = MODE_QUERY; mbl = ircsprintf(modebuf, ":%s MODE %s ", me.name, chname); pbl = 0; parabuf[0] = '\0'; - if (mode_count_minus > 0) + for (i = 0; i < mode_count; i++) { - modebuf[mbl++] = '-'; - modebuf[mbl] = '\0'; - } - - for (i = 0; i < mode_count_minus; i++) - { - if (mode_changes_minus[i].letter == 0 || - mode_changes_minus[i].mems == ONLY_SERVERS) + if (mode_changes[i].letter == 0 || + mode_changes[i].mems == ONLY_SERVERS) continue; - if (mode_changes_minus[i].mems != ALL_MEMBERS) + + if (mode_changes[i].mems != ALL_MEMBERS) { - if (mode_changes_minus[i].letter == 'v' && - MyConnect(mode_changes_minus[i].client) && - !is_any_op(chptr, mode_changes_minus[i].client)) - sendto_one(mode_changes_minus[i].client, ":%s MODE %s -v %s", - me.name, chname, mode_changes_minus[i].arg); + if (mode_changes[i].letter == 'v' && + MyConnect(mode_changes[i].client) && + !is_any_op(chptr, mode_changes[i].client)) + sendto_one(mode_changes[i].client, ":%s MODE %s -v %s", + me.name, chname, mode_changes[i].arg); continue; } - if (mode_changes_minus[i].arg != NULL && - ((mc == MAXMODEPARAMS) || - ((strlen(mode_changes_minus[i].arg) + mbl + pbl + 2) > BUFSIZE))) + if (mode_changes[i].arg != NULL && ((mc == MAXMODEPARAMS) || + ((strlen(mode_changes[i].arg) + mbl + pbl + 2) > BUFSIZE))) { if (mbl && modebuf[mbl - 1] == '-') modebuf[mbl - 1] = '\0'; @@ -2546,74 +2178,25 @@ send_mode_changes(struct Client *client_p, struct Client *source_p, nc = 0; mc = 0; - mbl = ircsprintf(modebuf, ":%s MODE %s -", me.name, chname); + mbl = ircsprintf(modebuf, ":%s MODE %s ", me.name, chname); pbl = 0; parabuf[0] = '\0'; } - modebuf[mbl++] = mode_changes_minus[i].letter; + if(dir != mode_changes[i].dir) + { + modebuf[mbl++] = (mode_changes[i].dir == MODE_ADD) ? '+' : '-'; + dir = mode_changes[i].dir; + } + + modebuf[mbl++] = mode_changes[i].letter; modebuf[mbl] = '\0'; nc++; - if (mode_changes_minus[i].arg != NULL) + if (mode_changes[i].arg != NULL) { mc++; - pbl = strlen(strcat(parabuf, mode_changes_minus[i].arg)); - parabuf[pbl++] = ' '; - parabuf[pbl] = '\0'; - } - } - - if (mode_count_plus > 0) - { - if (mbl > 0 && modebuf[mbl - 1] == '-') - modebuf[mbl - 1] = '+'; - else - modebuf[mbl++] = '+'; - - modebuf[mbl] = '\0'; - } - - for (i = 0; i < mode_count_plus; i++) - { - if (mode_changes_plus[i].letter == 0 || - mode_changes_plus[i].mems == ONLY_SERVERS) - continue; - if (mode_changes_plus[i].mems != ALL_MEMBERS) - { - if (mode_changes_plus[i].letter == 'v' && - MyConnect(mode_changes_plus[i].client) && - !is_any_op(chptr, mode_changes_plus[i].client)) - sendto_one(mode_changes_plus[i].client, ":%s MODE %s +v %s", - me.name, chname, mode_changes_plus[i].arg); - continue; - } - - if (mode_changes_plus[i].arg != NULL && - ((mc == MAXMODEPARAMS) || - ((strlen(mode_changes_plus[i].arg) + mbl + pbl + 2) > BUFSIZE))) - { - if (mbl && modebuf[mbl - 1] == '+') - modebuf[mbl - 1] = '\0'; - - if (nc != 0) - sendto_channel_local(st, chptr, "%s %s", modebuf, parabuf); - - nc = 0; - mc = 0; - mbl = ircsprintf(modebuf, ":%s MODE %s +", me.name, chname); - pbl = 0; - parabuf[0] = '\0'; - } - - modebuf[mbl++] = mode_changes_plus[i].letter; - modebuf[mbl] = '\0'; - nc++; - - if (mode_changes_plus[i].arg != NULL) - { - mc++; - pbl = strlen(strcat(parabuf, mode_changes_plus[i].arg)); + pbl = strlen(strcat(parabuf, mode_changes[i].arg)); parabuf[pbl++] = ' '; parabuf[pbl] = '\0'; } @@ -2627,9 +2210,7 @@ send_mode_changes(struct Client *client_p, struct Client *source_p, if (nc != 0) sendto_channel_local(st, chptr, "%s %s", modebuf, parabuf); } -#endif -#ifdef HALFOPS /* Bounce modes to client_p */ nc = 0; if (bounce_count) @@ -2683,7 +2264,6 @@ send_mode_changes(struct Client *client_p, struct Client *source_p, if (nc != 0) sendto_one(client_p, "%s %s", modebuf, parabuf); -#endif /* Now send to servers... */ for (i = 0; i < NCHCAP_COMBOS; i++) @@ -2715,14 +2295,9 @@ set_channel_mode(struct Client *client_p, struct Client *source_p, int table_position; mask_pos = 0; - mode_count_plus = 0; - mode_count_minus = 0; -#ifdef HALFOPS + mode_count = 0; bounce_count = 0; -#endif -#ifdef ANONOPS - hideops_changed = 0; -#endif + hideops_changed = (chptr->mode.mode & MODE_HIDEOPS); mode_limit = 0; alevel = get_channel_access(source_p, chptr); @@ -2771,48 +2346,32 @@ void set_channel_mode_flags(char flags_ptr[NUMLISTS][2], struct Channel *chptr, struct Client *source_p) { -#ifdef ANONOPS if (chptr->mode.mode & MODE_HIDEOPS && !is_any_op(chptr, source_p)) { flags_ptr[0][0] = '\0'; flags_ptr[1][0] = '\0'; flags_ptr[2][0] = '\0'; flags_ptr[3][0] = '\0'; -#ifdef REQUIRE_OANDV flags_ptr[4][0] = '\0'; flags_ptr[5][0] = '\0'; -#else - flags_ptr[4][0] = '\0'; -#endif } else -#endif { flags_ptr[0][0] = '@'; -#ifdef HALFOPS flags_ptr[1][0] = '%'; -#else - flags_ptr[1][0] = '\0'; -#endif flags_ptr[2][0] = '+'; flags_ptr[3][0] = '\0'; -#ifdef REQUIRE_OANDV - flags_ptr[4][0] = '@'; -#endif + flags_ptr[4][0] = '\0'; flags_ptr[5][0] = '*'; flags_ptr[0][1] = '\0'; flags_ptr[1][1] = '\0'; flags_ptr[2][1] = '\0'; -#ifdef REQUIRE_OANDV - flags_ptr[4][1] = '\0'; -#endif flags_ptr[5][1] = '\0'; } } -#ifdef ANONOPS /* * sync_oplists * @@ -2827,16 +2386,8 @@ sync_oplists(struct Channel *chptr, struct Client *target_p, int dir, const char *name) { send_oplist(name, target_p, &chptr->chanops, "o", dir); -#ifdef REQUIRE_OANDV - send_oplist(name, target_p, &chptr->chanops_voiced, "o", dir); -#endif -#ifdef HALFOPS send_oplist(name, target_p, &chptr->halfops, "h", dir); -#endif send_oplist(name, target_p, &chptr->voiced, "v", dir); -#ifdef REQUIRE_OANDV - send_oplist(name, target_p, &chptr->chanops_voiced, "v", dir); -#endif send_oplist(name, target_p, &chptr->chanadmins, "a", dir); } @@ -2904,7 +2455,6 @@ sync_channel_oplists(struct Channel *chptr, int dir) sync_oplists(chptr, ptr->data, MODE_ADD, RootChan(chptr)->chname); } -#endif /* Used by chm_op and others instead of calling is_chan_op, is_half_op & is_voiced. Since member status is now changed *after* processing all @@ -2917,11 +2467,7 @@ static void mode_get_status(struct Channel *chptr, struct Client *target_p, if (need_check) { *t_op = is_chan_op(chptr, target_p); -#ifdef HALFOPS *t_hop = is_half_op(chptr, target_p); -#else - *t_hop = 0; /* shouldn't be necessary, but... */ -#endif *t_voice = is_voiced(chptr, target_p); *t_admin = is_chan_admin(chptr, target_p); } @@ -2930,105 +2476,119 @@ static void mode_get_status(struct Channel *chptr, struct Client *target_p, *t_hop = 0; } - for (i = 0; i < mode_count_minus; i++) - if (mode_changes_minus[i].client == target_p) + for (i = 0; i < mode_count; i++) + { + if (mode_changes[i].client == target_p) { - if (mode_changes_minus[i].letter == 'o') - *t_op = 0; -#ifdef HALFOPS - else if (mode_changes_minus[i].letter == 'h') + if (mode_changes[i].letter == 'o') + *t_op = (mode_changes[i].dir == MODE_ADD) ? 1 : 0; + else if (mode_changes[i].letter == 'h') { - *t_hop = 0; + *t_hop = (mode_changes[i].dir == MODE_ADD) ? 1 : 0; return; } -#endif - else if (mode_changes_minus[i].letter == 'v') - *t_voice = 0; - - else if (mode_changes_minus[i].letter == 'a') - *t_admin = 0; - } - - for (i = 0; i < mode_count_plus; i++) - if (mode_changes_plus[i].client == target_p) - { - if (mode_changes_plus[i].letter == 'o') - *t_op = 1; -#ifdef HALFOPS - else if (mode_changes_plus[i].letter == 'h') - { - *t_hop = 1; - return; - } -#endif - else if (mode_changes_plus[i].letter == 'v') - *t_voice = 1; - - else if (mode_changes_plus[i].letter == 'a') - *t_admin = 1; + else if (mode_changes[i].letter == 'v') + *t_voice = (mode_changes[i].dir == MODE_ADD) ? 1 : 0; } + } } static void update_channel_info(struct Channel *chptr) { int i; -#ifdef ANONOPS int t_voice, t_hop, t_op, t_admin; - dlink_node *ptr, *ptr_next; + dlink_node *ptr; + dlink_node *ptr_next; - if (hideops_changed == -1) + /* hideops_changed is set to chptr->mode.mode & MODE_HIDEOPS at + * the beginning.. + */ + if (hideops_changed != (chptr->mode.mode & MODE_HIDEOPS)) { - sync_channel_oplists(chptr, MODE_ADD); - chptr->mode.mode &= ~MODE_HIDEOPS; - } - else if (hideops_changed == 1) - { - for (ptr = chptr->locpeons.head; ptr != NULL && ptr->data != NULL; - ptr = ptr->next) + if(chptr->mode.mode & MODE_HIDEOPS) { - mode_get_status(chptr, ptr->data, &t_op, &t_hop, &t_voice, &t_admin, 0); - if (!t_hop && !t_op && t_admin) - sync_oplists(chptr, ptr->data, MODE_DEL, RootChan(chptr)->chname); - } - for (ptr = chptr->locvoiced.head; ptr != NULL && ptr->data != NULL; - ptr = ptr->next) - { - mode_get_status(chptr, ptr->data, &t_op, &t_hop, &t_voice, &t_admin, 0); - if (!t_hop && !t_op && t_admin) - sync_oplists(chptr, ptr->data, MODE_DEL, RootChan(chptr)->chname); - } + for (ptr = chptr->locpeons.head; ptr != NULL && ptr->data != NULL; + ptr = ptr->next) + { + mode_get_status(chptr, ptr->data, &t_op, &t_hop, &t_voice, &t_admin, 0); + if (!t_hop && !t_op && !t_admin) + sync_oplists(chptr, ptr->data, MODE_DEL, RootChan(chptr)->chname); + } - chptr->mode.mode |= MODE_HIDEOPS; + for (ptr = chptr->locvoiced.head; ptr != NULL && ptr->data != NULL; + ptr = ptr->next) + { + mode_get_status(chptr, ptr->data, &t_op, &t_hop, &t_voice, &t_admin, 0); + if (!t_hop && !t_op && !t_admin) + sync_oplists(chptr, ptr->data, MODE_DEL, RootChan(chptr)->chname); + } + + for(ptr = chptr->lochalfops.head; ptr != NULL; ptr = ptr->next) + { + mode_get_status(chptr, ptr->data, &t_op, &t_hop, &t_voice, &t_admin, 1); + if(!t_hop && !t_op && !t_admin) + sync_oplists(chptr, ptr->data, MODE_DEL, RootChan(chptr)->chname); + } + + for(ptr = chptr->locchanops.head; ptr != NULL; ptr = ptr->next) + { + mode_get_status(chptr, ptr->data, &t_op, &t_hop, &t_voice, &t_admin, 1); + if(!t_hop && !t_op && !t_admin) + sync_oplists(chptr, ptr->data, MODE_DEL, RootChan(chptr)->chname); + } + } + else + { + sync_channel_oplists(chptr, MODE_ADD); + chptr->mode.mode &= ~MODE_HIDEOPS; + } } - /* Create a list of deopped users who need a resync.. */ - if ((chptr->mode.mode & MODE_HIDEOPS) && hideops_changed != -1) + /* +/-a hasnt changed but we're still +a, sync those who have changed + * status + */ + else if(chptr->mode.mode & MODE_HIDEOPS) { dlink_list deopped = {NULL, NULL}; + dlink_list opped = {NULL, NULL}; - for (i = 0; i < mode_count_minus; i++) - if ((mode_changes_minus[i].letter == 'o' || mode_changes_minus[i].letter == 'a' || - mode_changes_minus[i].letter == 'h') && - MyConnect(mode_changes_minus[i].client)) + for (i = 0; i < mode_count; i++) + { + if(mode_changes[i].dir == MODE_DEL) { - ptr = make_dlink_node(); - dlinkAdd(mode_changes_minus[i].client, ptr, &deopped); + if((mode_changes[i].letter == 'o' || mode_changes[i].letter == 'h') && + MyConnect(mode_changes[i].client)) + { + if((ptr = dlinkFind(&opped, mode_changes[i].client)) == NULL) + { + ptr = make_dlink_node(); + dlinkAdd(mode_changes[i].client, ptr, &deopped); + } + else + { + dlinkDelete(ptr, &opped); + free_dlink_node(ptr); + } + } } - - for (i = 0; i < mode_count_plus; i++) - if ((mode_changes_plus[i].letter == 'o' || mode_changes_minus[i].letter == 'a' || - mode_changes_plus[i].letter == 'h') && - MyConnect(mode_changes_plus[i].client)) + else { - if ((ptr = dlinkFind(&deopped, mode_changes_plus[i].client)) != NULL) - { - dlinkDelete(ptr, &deopped); - free_dlink_node(ptr); - } - else - sync_oplists(chptr, mode_changes_plus[i].client, MODE_ADD, - RootChan(chptr)->chname); + if((mode_changes[i].letter == 'o' || mode_changes[i].letter == 'h') && + MyConnect(mode_changes[i].client)) + { + if((ptr = dlinkFind(&deopped, mode_changes[i].client)) == NULL) + { + ptr = make_dlink_node(); + dlinkAdd(mode_changes[i].client, ptr, &opped); + } + else + { + dlinkDelete(ptr, &deopped); + free_dlink_node(ptr); + } + } } + } /* ..and send a resync to them */ for (ptr=deopped.head; ptr != NULL && ptr->data != NULL; ptr=ptr_next) @@ -3037,86 +2597,62 @@ static void update_channel_info(struct Channel *chptr) sync_oplists(chptr, ptr->data, MODE_DEL, RootChan(chptr)->chname); free_dlink_node(ptr); } + + for(ptr = opped.head; ptr != NULL; ptr = ptr_next) + { + ptr_next = ptr->next; + sync_oplists(chptr, ptr->data, MODE_ADD, RootChan(chptr)->chname); + free_dlink_node(ptr); + } } -#endif - /* Update channel members lists. Note we must scan mode_changes_minus - earlier, because of the cases like -h+o... */ - for (i = 0; i < mode_count_minus; i++) - if (mode_changes_minus[i].letter == 'o') + /* Update channel members lists. */ + for (i = 0; i < mode_count; i++) + { + if (mode_changes[i].letter == 'o') { -#ifdef REQUIRE_OANDV - if (is_voiced(chptr, mode_changes_minus[i].client)) - change_channel_membership(chptr, &chptr->voiced, &chptr->locvoiced, - mode_changes_minus[i].client); - else -#endif + { + if(mode_changes[i].dir == MODE_DEL) + { + change_channel_membership(chptr, &chptr->peons, &chptr->locpeons, + mode_changes[i].client); + } + else + { + change_channel_membership(chptr, &chptr->chanops, &chptr->locchanops, + mode_changes[i].client); + } + } + } + else if (mode_changes[i].letter == 'h') + { + if(mode_changes[i].dir == MODE_DEL) + { change_channel_membership(chptr, &chptr->peons, &chptr->locpeons, - mode_changes_minus[i].client); - } -#ifdef HALFOPS - else if (mode_changes_minus[i].letter == 'h') - change_channel_membership(chptr, &chptr->peons, &chptr->locpeons, - mode_changes_minus[i].client); -#endif - else if (mode_changes_minus[i].letter == 'v') - { -#ifdef REQUIRE_OANDV - if (is_chan_op(chptr, mode_changes_minus[i].client)) - change_channel_membership(chptr, &chptr->chanops, &chptr->locchanops, - mode_changes_minus[i].client); + mode_changes[i].client); + } else -#endif - change_channel_membership(chptr, &chptr->peons, &chptr->locpeons, - mode_changes_minus[i].client); + { + change_channel_membership(chptr, &chptr->halfops, &chptr->lochalfops, + mode_changes[i].client); + } } - else if (mode_changes_minus[i].letter == 'a') + else if (mode_changes[i].letter == 'v') { - if (is_chan_admin(chptr, mode_changes_minus[i].client)) - change_channel_membership(chptr, &chptr->chanadmins, &chptr->locchanadmins, - mode_changes_minus[i].client); - else - change_channel_membership(chptr, &chptr->peons, &chptr->locpeons, - mode_changes_minus[i].client); - } - - for (i = 0; i < mode_count_plus; i++) - if (mode_changes_plus[i].letter == 'o') - { -#ifdef REQUIRE_OANDV - if (is_voiced(chptr, mode_changes_plus[i].client)) - change_channel_membership(chptr, &chptr->chanops_voiced, - &chptr->locchanops_voiced, mode_changes_plus[i].client); - else -#endif - change_channel_membership(chptr, &chptr->chanops, &chptr->locchanops, - mode_changes_plus[i].client); - } -#ifdef HALFOPS - else if (mode_changes_plus[i].letter == 'h') - change_channel_membership(chptr, &chptr->halfops, &chptr->lochalfops, - mode_changes_plus[i].client); -#endif - else if (mode_changes_plus[i].letter == 'v') - { -#ifdef REQUIRE_OANDV - if (is_chan_op(chptr, mode_changes_plus[i].client)) - change_channel_membership(chptr, &chptr->chanops_voiced, - &chptr->locchanops_voiced, mode_changes_plus[i].client); - else -#endif - change_channel_membership(chptr, &chptr->voiced, &chptr->locvoiced, - mode_changes_plus[i].client); - } - else if (mode_changes_plus[i].letter == 'a') - { - if (is_chan_admin(chptr, mode_changes_plus[i].client)) - change_channel_membership(chptr, &chptr->chanadmins, - &chptr->locchanadmins, mode_changes_plus[i].client); - else - change_channel_membership(chptr, &chptr->voiced, &chptr->locchanadmins, - mode_changes_plus[i].client); + { + if(mode_changes[i].dir == MODE_DEL) + { + change_channel_membership(chptr, &chptr->peons, &chptr->locpeons, + mode_changes[i].client); + } + else + { + change_channel_membership(chptr, &chptr->voiced, &chptr->locvoiced, + mode_changes[i].client); + } + } } + } } #ifdef INTENSIVE_DEBUG @@ -3161,12 +2697,7 @@ do_channel_integrity_check(void) matched_local = -1; \ } SEARCH_LIST(chanops) -#ifdef REQUIRE_OANDV - SEARCH_LIST(chanops_voiced) -#endif -#ifdef HALFOPS SEARCH_LIST(halfops) -#endif SEARCH_LIST(voiced) SEARCH_LIST(peons) #undef SEARCH_LIST @@ -3191,12 +2722,7 @@ do_channel_integrity_check(void) assert(matched); \ } SEARCH_LIST(chanops) -#ifdef HALFOPS SEARCH_LIST(halfops) -#endif -#ifdef REQUIRE_OANDV - SEARCH_LIST(chanops_voiced) -#endif SEARCH_LIST(voiced) SEARCH_LIST(peons) } diff --git a/src/client.c b/src/client.c index a342e73..ba43736 100644 --- a/src/client.c +++ b/src/client.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: client.c,v 1.4 2002/08/14 16:52:02 fishwaldo Exp $ + * $Id: client.c,v 1.5 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" #include "config.h" @@ -124,6 +124,8 @@ struct Client* make_client(struct Client* from) dlink_node *m; client_p = BlockHeapAlloc(client_heap); + if(client_p == NULL) + return NULL; memset(client_p, 0, sizeof(struct Client)); if (from == NULL) { @@ -780,7 +782,7 @@ find_chasing(struct Client *source_p, char *user, int *chasing) { sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, user); - return ((struct Client *)NULL); + return (NULL); } if (chasing) *chasing = 1; @@ -1126,10 +1128,10 @@ static void remove_dependents(struct Client* client_p, * comstud, since m_squit already does the notification. */ - if ((aconf = to->serv->sconf)) - strlcpy(myname, my_name_for_link(me.name, aconf), HOSTLEN); + if ((aconf = to->serv->sconf) != NULL) + strlcpy(myname, my_name_for_link(me.name, aconf), HOSTLEN + 1); else - strlcpy(myname, me.name, HOSTLEN); + strlcpy(myname, me.name, HOSTLEN + 1); recurse_send_quits(client_p, source_p, to, comment1, myname); } @@ -1157,16 +1159,7 @@ void dead_link(struct Client *client_p) else notice = "Write error: connection closed"; - /* Mark it dead before sending out any notices, just in case this ever goes - * global */ - Debug((DEBUG_ERROR, "Closing link to %s: %s", get_client_name(client_p, HIDE_IP), - notice)); - assert(dlinkFind(&abort_list, client_p) == NULL); - m = make_dlink_node(); - dlinkAdd(client_p, m, &abort_list); - - SetDead(client_p); /* You are dead my friend */ - + if (!IsPerson(client_p) && !IsUnknown(client_p) && !IsClosing(client_p)) { sendto_realops_flags(FLAGS_ALL, L_ADMIN, @@ -1176,6 +1169,11 @@ void dead_link(struct Client *client_p) "Closing link to %s: %s", get_client_name(client_p, MASK_IP), notice); } + Debug((DEBUG_ERROR, "Closing link to %s: %s", get_client_name(client_p, HIDE_IP), notice)); + assert(dlinkFind(&abort_list, client_p) == NULL); + m = make_dlink_node(); + dlinkAdd(client_p, m, &abort_list); + SetDead(client_p); /* You are dead my friend */ } void exit_aborted_clients(void) @@ -1326,7 +1324,12 @@ int exit_client( sendto_realops_flags(FLAGS_CCONN, L_ALL, "Client exiting: %s (%s@%s) [%s] [%s]", source_p->name, source_p->username, source_p->host, - comment, source_p->localClient->sockhost); + comment, +#ifdef HIDE_SPOOF_IPS + "255.255.255.255"); +#else + source_p->localClient->sockhost); +#endif log_user_exit(source_p); diff --git a/src/hash.c b/src/hash.c index 88ef30f..2f807b5 100644 --- a/src/hash.c +++ b/src/hash.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: hash.c,v 1.2 2002/08/13 14:45:12 fishwaldo Exp $ + * $Id: hash.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -577,7 +577,7 @@ hash_find_masked_server(const char* name) /* * copy the damn thing and be done with it */ - strlcpy(buf, name, HOSTLEN); + strlcpy(buf, name, HOSTLEN + 1); while ((s = strchr(p, '.')) != 0) { diff --git a/src/hostmask.c b/src/hostmask.c index 4482648..083edd2 100644 --- a/src/hostmask.c +++ b/src/hostmask.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: hostmask.c,v 1.2 2002/08/13 14:45:12 fishwaldo Exp $ + * $Id: hostmask.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -38,12 +38,14 @@ static unsigned long hash_ipv6(struct irc_inaddr *, int); static int try_parse_v4_netmask(const char *, struct irc_inaddr *, int *); static unsigned long hash_ipv4(struct irc_inaddr *, int); -#define DigitParse(ch) if (ch >= '0' && ch <= '9') \ +#define DigitParse(ch) do { \ + if (ch >= '0' && ch <= '9') \ ch = ch - '0'; \ else if (ch >= 'A' && ch <= 'F') \ - ch = ch - 'A' + '0'; \ + ch = ch - 'A' + 10; \ else if (ch >= 'a' && ch <= 'f') \ - ch = ch - 'a' + '0'; + ch = ch - 'a' + 10; \ + } while(0); /* The mask parser/type determination code... */ @@ -54,6 +56,10 @@ static unsigned long hash_ipv4(struct irc_inaddr *, int); * Side effects: None * Comments: Called from parse_netmask */ +/* Fixed so ::/0 (any IPv6 address) is valid + Also a bug in DigitParse above. + -Gozem 2002-07-19 gozem@linux.nu +*/ #ifdef IPV6 static int try_parse_v6_netmask(const char *text, struct irc_inaddr *addr, int *b) @@ -103,10 +109,8 @@ try_parse_v6_netmask(const char *text, struct irc_inaddr *addr, int *b) d[dp] = d[dp] >> 4 * nyble; dp++; - if (p > text && *(p - 1) == ':') - return HM_HOST; bits = strtoul(p + 1, &after, 10); - if (bits == 0 || *after) + if (bits < 0 || *after) return HM_HOST; if (bits > dp * 4 && !(finsert >= 0 && bits <= 128)) return HM_HOST; @@ -120,8 +124,6 @@ try_parse_v6_netmask(const char *text, struct irc_inaddr *addr, int *b) dp++; if (finsert < 0 && bits == 0) bits = dp * 16; - else if (bits == 0) - bits = 128; /* How many words are missing? -A1kmm */ deficit = bits / 16 + ((bits % 16) ? 1 : 0) - dp; /* Now fill in the gaps(from ::) in the copied table... -A1kmm */ @@ -676,11 +678,11 @@ show_iline_prefix(struct Client *sptr, struct ConfItem *aconf, char *name) *prefix_ptr++ = '%'; if (IsConfDoSpoofIp(aconf)) *prefix_ptr++ = '='; - if (IsOper(sptr) && IsConfExemptKline(aconf)) + if (MyOper(sptr) && IsConfExemptKline(aconf)) *prefix_ptr++ = '^'; - if (IsOper(sptr) && IsConfExemptLimits(aconf)) + if (MyOper(sptr) && IsConfExemptLimits(aconf)) *prefix_ptr++ = '>'; - if (IsOper(sptr) && IsConfIdlelined(aconf)) + if (MyOper(sptr) && IsConfIdlelined(aconf)) *prefix_ptr++ = '<'; *prefix_ptr = '\0'; strncpy(prefix_ptr, name, USERLEN); @@ -707,11 +709,7 @@ report_auth(struct Client *client_p) { aconf = arec->aconf; -#ifndef HIDE_SPOOF_IPS - if (!IsOperAdmin(client_p) && IsConfDoSpoofIp(aconf)) -#else - if(IsConfDoSpoofIp(aconf)) -#endif + if (!MyOper(client_p) && IsConfDoSpoofIp(aconf)) continue; get_printable_conf(aconf, &name, &host, &pass, &user, &port, @@ -723,6 +721,9 @@ report_auth(struct Client *client_p) sendto_one(client_p, form_str(RPL_STATSILINE), me.name, client_p->name, (IsConfRestricted(aconf)) ? 'i' : 'I', name, show_iline_prefix(client_p, aconf, user), +#ifdef HIDE_SPOOF_IPS + IsConfDoSpoofIp(aconf) ? "255.255.255.255" : +#endif host, port, classname); } } diff --git a/src/ircd.c b/src/ircd.c index 16a065c..f578a9b 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: ircd.c,v 1.2 2002/08/13 14:45:12 fishwaldo Exp $ + * $Id: ircd.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -364,8 +364,8 @@ static void initialize_global_set_options(void) else GlobalSetOptions.floodcount = 10; - split_users = ConfigChannel.default_split_server_count; - split_servers = ConfigChannel.default_split_user_count; + split_servers = ConfigChannel.default_split_server_count; + split_users = ConfigChannel.default_split_user_count; if(split_users && split_servers && (ConfigChannel.no_create_on_split || ConfigChannel.no_join_on_split)) @@ -408,16 +408,8 @@ static void initialize_message_files(void) */ static void initialize_server_capabs(void) { - /* If halfops support is disabled, remove the capab from the list. */ - if (ConfigChannel.use_halfops == 0) - { - default_server_capabs &= ~CAP_HOPS; - } - - if(ConfigChannel.use_anonops == 0) - default_server_capabs &= ~CAP_AOPS; - - default_server_capabs &= ~CAP_ZIP; +/* right now, we don't do anything - fish */ +return; } diff --git a/src/ircd_lexer.l b/src/ircd_lexer.l index 82cba35..af79dd0 100644 --- a/src/ircd_lexer.l +++ b/src/ircd_lexer.l @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: ircd_lexer.l,v 1.2 2002/08/13 14:45:12 fishwaldo Exp $ + * $Id: ircd_lexer.l,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ %option case-insensitive @@ -56,11 +56,14 @@ int lineno=1; char linebuf[IRCD_BUFSIZE]; +char conffilebuf[IRCD_BUFSIZE]; int include_stack_ptr=0; YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; int lineno_stack[MAX_INCLUDE_DEPTH]; FBFILE* inc_fbfile_in[MAX_INCLUDE_DEPTH]; +char conffile_stack[MAX_INCLUDE_DEPTH][IRCD_BUFSIZE]; void ccomment(void); +void hashcomment(void); void cinclude(void); int ieof(void); %} @@ -78,16 +81,53 @@ include \.include{ws}(\<.*\>|\".*\") \n.* { strcpy(linebuf, yytext+1); lineno++; yyless(1); } {ws} ; -{comment} ; +{comment} { hashcomment(); } {digit}+ { yylval.number = atoi(yytext); return NUMBER; } -{qstring} { yylval.string = yytext+1; - if(yylval.string[yyleng-2] != '"') - ilog(L_ERROR, "Unterminated character string"); +{qstring} { if(yytext[yyleng-2] == '\\') + { + yyless(yyleng-1); /* return last quote */ + yymore(); /* append next string */ + } else - yylval.string[yyleng-2] = '\0'; /* remove close quote */ - return QSTRING; + { + yylval.string = yytext+1; + if(yylval.string[yyleng-2] != '"') + ilog(L_ERROR, "Unterminated character string"); + else + { + int i,j; + + yylval.string[yyleng-2] = '\0'; /* remove close + * quote + */ + + for (j=i=0 ;yylval.string[i] != '\0'; i++,j++) + { + if (yylval.string[i] != '\\') + { + yylval.string[j] = yylval.string[i]; + } + else + { + i++; + if (yylval.string[i] == '\0') /* XXX + * should not + * happen + */ + { + ilog(L_ERROR, + "Unterminated character string"); + break; + } + yylval.string[j] = yylval.string[i]; + } + } + yylval.string[j] = '\0'; + return QSTRING; + } + } } accept_password { return ACCEPT_PASSWORD; } @@ -361,6 +401,17 @@ void ccomment(void) } } +/* #-comment style, look for #include */ +#define INCLUDE "#include" +void hashcomment(void) +{ + if (strlen(yytext) < strlen(INCLUDE)) + return; + + if ( !strncasecmp(yytext, INCLUDE, strlen(INCLUDE)) ) + yyerror("You probably meant '.include', skipping"); +} + /* C-style .includes. This function will properly swap input conf buffers, * and lineno -kre */ void cinclude(void) @@ -396,8 +447,10 @@ void cinclude(void) lineno_stack[include_stack_ptr] = lineno; lineno = 1; inc_fbfile_in[include_stack_ptr] = conf_fbfile_in; + strlcpy(conffile_stack[include_stack_ptr], conffilebuf, IRCD_BUFSIZE); include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; conf_fbfile_in = tmp_fbfile_in; + sprintf(conffilebuf, "%s", c); yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); } } @@ -424,6 +477,7 @@ int ieof(void) yy_delete_buffer(YY_CURRENT_BUFFER); lineno = lineno_stack[include_stack_ptr]; conf_fbfile_in = inc_fbfile_in[include_stack_ptr]; + strlcpy(conffilebuf, conffile_stack[include_stack_ptr], IRCD_BUFSIZE); yy_switch_to_buffer(include_stack[include_stack_ptr]); return 0; } diff --git a/src/ircd_parser.y b/src/ircd_parser.y index a80cbd0..89f3e24 100644 --- a/src/ircd_parser.y +++ b/src/ircd_parser.y @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: ircd_parser.y,v 1.2 2002/08/13 14:45:12 fishwaldo Exp $ + * $Id: ircd_parser.y,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ %{ @@ -285,8 +285,8 @@ int class_redirport_var; %type QSTRING %type NUMBER -%type timespec -%type sizespec +%type timespec, timespec_ +%type sizespec, sizespec_ %% conf: @@ -316,53 +316,38 @@ conf_item: admin_entry ; -timespec: NUMBER - = { - $$ = $1; - } - | NUMBER SECONDS - = { - $$ = $1; - } - | NUMBER MINUTES - = { - $$ = $1 * 60; - } - | NUMBER HOURS - = { - $$ = $1 * 60 * 60; - } - | NUMBER DAYS - = { - $$ = $1 * 60 * 60 * 24; - } - | NUMBER WEEKS - = { - $$ = $1 * 60 * 60 * 24 * 7; - } - | timespec timespec - = { - /* 2 years 3 days */ +timespec_: { $$ = 0; } | timespec; +timespec: NUMBER timespec_ + { $$ = $1 + $2; } + | NUMBER SECONDS timespec_ + { + $$ = $1 + $3; + } + | NUMBER MINUTES timespec_ + { + $$ = $1 * 60 + $3; + } + | NUMBER HOURS timespec_ + { + $$ = $1 * 60 * 60 + $3; + } + | NUMBER DAYS timespec_ + { + $$ = $1 * 60 * 60 * 24 + $3; + } + | NUMBER WEEKS timespec_ + { + $$ = $1 * 60 * 60 * 24 * 7 + $3; + } ; -sizespec: NUMBER - = { - $$ = $1; - } - | NUMBER BYTES - = { - $$ = $1; - } - | NUMBER KBYTES - = { - $$ = $1 * 1024; - } - | NUMBER MBYTES - = { - $$ = $1 * 1024 * 1024; - } +sizespec_: { $$ = 0; } | sizespec; +sizespec: NUMBER sizespec_ { $$ = $1 + $2; } + | NUMBER BYTES sizespec_ { $$ = $1 + $3; } + | NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; } + | NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; } ; @@ -2540,13 +2525,7 @@ channel_entry: CHANNEL channel_items: channel_items channel_item | channel_item; -channel_item: channel_use_except | - channel_use_halfops | - channel_use_invex | - channel_use_knock | - channel_use_vchans | - channel_use_anonops | - channel_vchans_oper_only | +channel_item: channel_vchans_oper_only | channel_max_bans | channel_knock_delay | channel_knock_delay_channel | @@ -2559,105 +2538,6 @@ channel_item: channel_use_except | channel_no_join_on_split | error; -channel_use_except: USE_EXCEPT '=' TYES ';' - { - ConfigChannel.use_except = 1; - } - | - USE_EXCEPT '=' TNO ';' - { - ConfigChannel.use_except = 0; - } ; - - -channel_use_halfops: USE_HALFOPS '=' TYES ';' - { -#ifdef HALFOPS - /* Set to -1 on boot */ - if (ConfigChannel.use_halfops == 0) - { - ilog(L_ERROR, "Ignoring config file entry 'use_halfops = yes' " - "-- can only be changed on boot"); - break; - } - else - ConfigChannel.use_halfops = 1; -#endif - } - | - USE_HALFOPS '=' TNO ';' - { - /* Set to -1 on boot */ - if (ConfigChannel.use_halfops == 1) - { - ilog(L_ERROR, "Ignoring config file entry 'use_halfops = no' " - "-- can only be changed on boot"); - break; - } - else - ConfigChannel.use_halfops = 0; - }; - - -channel_use_anonops: USE_ANONOPS '=' TYES ';' - { -#ifdef ANONOPS - if(ConfigChannel.use_anonops == 0) - { - ilog(L_ERROR, "Ignoring config file entry 'use_anonops = yes' " - "-- can only be changed on boot"); - break; - } - else - ConfigChannel.use_anonops = 1; -#endif - } - | - USE_ANONOPS '=' TNO ';' - { - if(ConfigChannel.use_anonops == 1) - { - ilog(L_ERROR, "Ignoring config file entry 'use_anonops = no' " - "-- can only be changed on boot"); - break; - } - else - ConfigChannel.use_anonops = 0; - } ; - - -channel_use_invex: USE_INVEX '=' TYES ';' - { - ConfigChannel.use_invex = 1; - } - | - USE_INVEX '=' TNO ';' - { - ConfigChannel.use_invex = 0; - } ; - - -channel_use_knock: USE_KNOCK '=' TYES ';' - { - ConfigChannel.use_knock = 1; - } - | - USE_KNOCK '=' TNO ';' - { - ConfigChannel.use_knock = 0; - } ; - - -channel_use_vchans: USE_VCHANS '=' TYES ';' - { -#ifdef VCHANS - ConfigChannel.use_vchans = 1; -#endif - } - | - USE_VCHANS '=' TNO ';' - { ConfigChannel.use_vchans = 0; }; - channel_vchans_oper_only: VCHANS_OPER_ONLY '=' TYES ';' { ConfigChannel.vchans_oper_only = 1; } diff --git a/src/ircdauth.c b/src/ircdauth.c index eb118fe..55a818a 100644 --- a/src/ircdauth.c +++ b/src/ircdauth.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: ircdauth.c,v 1.2 2002/08/13 14:45:12 fishwaldo Exp $ + * $Id: ircdauth.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -538,12 +538,12 @@ GoodAuth(int parc, char **parv) * if ident failed, but the client's I: line specified * no tilde character */ - strlcpy(auth->client->username, parv[2], USERLEN); + strlcpy(auth->client->username, parv[2], USERLEN + 1); /* * Also use IAuth's hostname in case of SPOOF_FREEFORM */ - strlcpy(auth->client->host, parv[3], HOSTLEN); + strlcpy(auth->client->host, parv[3], HOSTLEN + 1); /* * Register them diff --git a/src/linebuf.c b/src/linebuf.c index 6cc69ec..f18fdd3 100644 --- a/src/linebuf.c +++ b/src/linebuf.c @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: linebuf.c,v 1.2 2002/08/13 14:45:12 fishwaldo Exp $ + * $Id: linebuf.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -102,8 +102,11 @@ linebuf_new_line(buf_head_t *bufhead) dlink_node *node; bufline = linebuf_allocate(); + if(bufline == NULL) + return NULL; ++bufline_count; - + + node = make_dlink_node(); bufline->len = 0; @@ -170,6 +173,8 @@ linebuf_skip_crlf(char *ch, int len) break; else if(*ch == '\n') break; + else if (*ch == 0) + return -1; } /* Then, skip until the last CRLF */ @@ -268,6 +273,8 @@ linebuf_copy_line(buf_head_t *bufhead, buf_line_t *bufline, return 0; clen = cpylen = linebuf_skip_crlf(ch, len); + if (clen == -1) + return -1; /* This is the ~overflow case..This doesn't happen often.. */ if(cpylen > (BUF_DATA_SIZE - bufline->len - 1)) @@ -321,65 +328,61 @@ linebuf_copy_line(buf_head_t *bufhead, buf_line_t *bufline, * Copy as much data as possible directly into a linebuf, * splitting at \r\n, but without altering any data. * - * -David-T */ static int linebuf_copy_raw(buf_head_t *bufhead, buf_line_t *bufline, - char *data, int len) + char *data, int len) { + int cpylen = 0; /* how many bytes we've copied */ char *ch = data; /* Pointer to where we are in the read data */ char *bufch = bufline->buf + bufline->len; int clen = 0; /* how many bytes we've processed, and don't ever want to see again.. */ - int remaining; - + /* If its full or terminated, ignore it */ - if ((bufline->len == BUF_DATA_SIZE) || (bufline->terminated == 1)) + + bufline->raw = 1; + assert(bufline->len < BUF_DATA_SIZE); + if (bufline->terminated == 1) return 0; - if (len < (BUF_DATA_SIZE - bufline->len - 1)) - remaining = len; - else - remaining = BUF_DATA_SIZE - bufline->len - 1; + clen = cpylen = linebuf_skip_crlf(ch, len); + if (clen == -1) + return -1; - while (remaining && *ch != '\r' && *ch != '\n') - { - *bufch++ = *ch++; - clen++; - remaining--; - } - - /* - * If we've reached '\r' or '\n', or filled up the linebuf, - * terminate it - */ - if (*ch == '\r' || *ch == '\n' || - (clen >= (BUF_DATA_SIZE - bufline->len - 1))) - { - bufline->terminated = 1; - - /* - * Whilst we have remaining data (and space in the linebuf) - * eat any '\r's or '\n's, but leave them in the linebuf, - * incase it's important ziplinks data - */ - while (remaining && (*ch == '\r' || *ch == '\n')) + /* This is the overflow case..This doesn't happen often.. */ + if(cpylen > (BUF_DATA_SIZE - bufline->len - 1)) { - *bufch++ = *ch++; - clen++; - remaining--; + memcpy(bufch, ch, (BUF_DATA_SIZE - bufline->len - 1)); + bufline->buf[BUF_DATA_SIZE-1] = '\0'; + bufch = bufline->buf + BUF_DATA_SIZE - 2; + bufline->terminated = 1; + bufline->len = BUF_DATA_SIZE - 1; + bufhead->len += BUF_DATA_SIZE - 1; + return clen; } - } + memcpy(bufch, ch, cpylen); + bufch += cpylen; *bufch = '\0'; + bufch--; - /* Tell linebuf_get that it might need to clean up the buffer */ - bufline->raw = 1; - bufline->len += clen; - bufhead->len += clen; + if(*bufch != '\r' && *bufch != '\n') + { + /* No linefeed, bail for the next time */ + bufhead->len += cpylen; + bufline->len += cpylen; + bufline->terminated = 0; + return clen; + } + + bufline->terminated = 1; + bufhead->len += cpylen; + bufline->len += cpylen; return clen; } + /* * linebuf_parse * @@ -406,43 +409,49 @@ linebuf_parse(buf_head_t *bufhead, char *data, int len, int raw) /* First, if we have a partial buffer, try to squeze data into it */ if (bufhead->list.tail != NULL) - { - /* Check we're doing the partial buffer thing */ - bufline = bufhead->list.tail->data; - assert(!bufline->flushing); - /* just try, the worst it could do is *reject* us .. */ - if (raw) /* if we could be dealing with 8-bit data */ - cpylen = linebuf_copy_raw(bufhead, bufline, data, len); - else - cpylen = linebuf_copy_line(bufhead, bufline, data, len); - linecnt++; - /* If we've copied the same as what we've got, quit now */ - if (cpylen == len) - return linecnt; /* all the data done so soon? */ + { + /* Check we're doing the partial buffer thing */ + bufline = bufhead->list.tail->data; + assert(!bufline->flushing); + /* just try, the worst it could do is *reject* us .. */ + if (raw) /* if we could be dealing with 8-bit data */ + cpylen = linebuf_copy_raw(bufhead, bufline, data, len); + else + cpylen = linebuf_copy_line(bufhead, bufline, data, len); + if (cpylen == -1) + return -1; + + linecnt++; + /* If we've copied the same as what we've got, quit now */ + if (cpylen == len) + return linecnt; /* all the data done so soon? */ + + /* Skip the data and update len .. */ + len -= cpylen; + assert(len >= 0); + data += cpylen; + } + + /* Next, the loop */ + while (len > 0) + { + /* We obviously need a new buffer, so .. */ + bufline = linebuf_new_line(bufhead); + + /* And parse */ + if (raw) /* if we could be dealing with 8-bit data */ + cpylen = linebuf_copy_raw(bufhead, bufline, data, len); + else + cpylen = linebuf_copy_line(bufhead, bufline, data, len); + if (cpylen == -1) + return -1; - /* Skip the data and update len .. */ - len -= cpylen; - assert(len >= 0); - data += cpylen; - } - - /* Next, the loop */ - while (len > 0) - { - /* We obviously need a new buffer, so .. */ - bufline = linebuf_new_line(bufhead); - - /* And parse */ - if (raw) /* if we could be dealing with 8-bit data */ - cpylen = linebuf_copy_raw(bufhead, bufline, data, len); - else - cpylen = linebuf_copy_line(bufhead, bufline, data, len); - len -= cpylen; - assert(len >= 0); - data += cpylen; - linecnt++; - } - return linecnt; + len -= cpylen; + assert(len >= 0); + data += cpylen; + linecnt++; + } + return linecnt; } diff --git a/src/modules.c b/src/modules.c index c0350fb..e561b13 100644 --- a/src/modules.c +++ b/src/modules.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: modules.c,v 1.2 2002/08/13 14:45:13 fishwaldo Exp $ + * $Id: modules.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -490,14 +490,14 @@ mo_modlist (struct Client *client_p, struct Client *source_p, int parc, char **p { sendto_one(source_p, form_str(RPL_MODLIST), me.name, parv[0], modlist[i]->name, modlist[i]->address, - modlist[i]->version); + modlist[i]->version, modlist[i]->core?"(core)":""); } } else { sendto_one(source_p, form_str(RPL_MODLIST), me.name, parv[0], modlist[i]->name, modlist[i]->address, - modlist[i]->version); + modlist[i]->version, modlist[i]->core?"(core)":""); } } diff --git a/src/packet.c b/src/packet.c index ec76d7b..f96df07 100644 --- a/src/packet.c +++ b/src/packet.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: packet.c,v 1.2 2002/08/13 14:45:13 fishwaldo Exp $ + * $Id: packet.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" #include "tools.h" @@ -36,6 +36,7 @@ #include "irc_string.h" #include "memory.h" #include "hook.h" +#include "send.h" static char readBuf[READBUF_SIZE]; static void client_dopacket(struct Client *client_p, char *buffer, size_t length); @@ -51,7 +52,44 @@ parse_client_queued(struct Client *client_p) int checkflood = 1; struct LocalUser *lclient_p = client_p->localClient; - if (IsServer(client_p) || !IsRegistered(client_p)) + if(IsUnknown(client_p)) + { + int i = 0; + + for(;;) + { + /* rate unknown clients at MAX_FLOOD per loop */ + if(i >= MAX_FLOOD) + break; + + dolen = linebuf_get(&client_p->localClient->buf_recvq, readBuf, + READBUF_SIZE, LINEBUF_COMPLETE, LINEBUF_PARSED); + + if(dolen <= 0) + break; + + if(!IsDead(client_p)) + { + client_dopacket(client_p, readBuf, dolen); + i++; + + /* if theyve dropped out of the unknown state, break and move + * to the parsing for their appropriate status. --fl + */ + if(!IsUnknown(client_p)) + break; + + } + else if(MyConnect(client_p)) + { + linebuf_donebuf(&client_p->localClient->buf_recvq); + linebuf_donebuf(&client_p->localClient->buf_sendq); + return; + } + } + } + + if (IsServer(client_p) || IsConnecting(client_p) || IsHandshake(client_p)) { while ((dolen = linebuf_get(&client_p->localClient->buf_recvq, readBuf, READBUF_SIZE, LINEBUF_COMPLETE, @@ -59,19 +97,15 @@ parse_client_queued(struct Client *client_p) { if (!IsDead(client_p)) client_dopacket(client_p, readBuf, dolen); - else + else if(MyConnect(client_p)) { - if (MyClient(client_p)) - { - linebuf_donebuf(&client_p->localClient->buf_recvq); - linebuf_donebuf(&client_p->localClient->buf_sendq); - } - + linebuf_donebuf(&client_p->localClient->buf_recvq); + linebuf_donebuf(&client_p->localClient->buf_sendq); return; } } } - else + else if(IsClient(client_p)) { if (ConfigFileEntry.no_oper_flood && IsOper(client_p)) @@ -124,7 +158,8 @@ parse_client_queued(struct Client *client_p) * * marks the end of the clients grace period */ -void flood_endgrace(struct Client *client_p) +void +flood_endgrace(struct Client *client_p) { SetFloodDone(client_p); @@ -153,13 +188,13 @@ flood_recalc(int fd, void *data) if (!lclient_p) return; - /* Reset the sent-per-second count, decrease opers quicker - * than normal users + /* allow a bursting client their allocation per second, allow + * a client whos flooding an extra 2 per second */ - if(ConfigFileEntry.no_oper_flood && IsOper(client_p)) + if(IsFloodDone(client_p)) lclient_p->sent_parsed -= 2; else - lclient_p->sent_parsed--; + lclient_p->sent_parsed = 0; if(lclient_p->sent_parsed < 0) lclient_p->sent_parsed = 0; @@ -376,30 +411,36 @@ read_packet(int fd, void *data) binary = 1; lbuf_len = linebuf_parse(&client_p->localClient->buf_recvq, - readBuf, length, binary); + readBuf, length, binary); if (lbuf_len < 0) { - error_exit_client(client_p, 0); + if (IsClient(client_p)) + sendto_one(client_p, ":%s NOTICE %s :*** - You sent a NULL character in " + "your message. Ignored.", + me.name, client_p->name); + else + exit_client(client_p, client_p, client_p, "NULL character found in message"); return; } lclient_p->actually_read += lbuf_len; + /* Attempt to parse what we have */ + parse_client_queued(client_p); + /* Check to make sure we're not flooding */ if (IsPerson(client_p) && (linebuf_alloclen(&client_p->localClient->buf_recvq) > - ConfigFileEntry.client_flood)) { + ConfigFileEntry.client_flood)) + { if (!(ConfigFileEntry.no_oper_flood && IsOper(client_p))) { exit_client(client_p, client_p, client_p, "Excess Flood"); return; } - } + } - /* Attempt to parse what we have */ - parse_client_queued(client_p); - /* server fd may have changed */ fd_r = client_p->localClient->fd; #ifndef HAVE_SOCKETPAIR @@ -442,7 +483,8 @@ read_packet(int fd, void *data) * with client_p of "local" variation, which contains all the * necessary fields (buffer etc..) */ -void client_dopacket(struct Client *client_p, char *buffer, size_t length) +void +client_dopacket(struct Client *client_p, char *buffer, size_t length) { assert(client_p != NULL); assert(buffer != NULL); @@ -460,7 +502,8 @@ void client_dopacket(struct Client *client_p, char *buffer, size_t length) */ client_p->localClient->receiveB += length; - if (client_p->localClient->receiveB > 1023) { + if (client_p->localClient->receiveB > 1023) + { client_p->localClient->receiveK += (client_p->localClient->receiveB >> 10); client_p->localClient->receiveB &= 0x03ff; /* 2^10 = 1024, 3ff = 1023 */ } diff --git a/src/parse.c b/src/parse.c index 3b52ba2..6e3b4db 100644 --- a/src/parse.c +++ b/src/parse.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: parse.c,v 1.2 2002/08/13 14:45:13 fishwaldo Exp $ + * $Id: parse.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -55,8 +55,8 @@ static void remove_unknown (struct Client *, char *, char *); static void do_numeric (char [], struct Client *, struct Client *, int, char **); -static void handle_command(struct Message *, struct Client *, - struct Client *, int, char **); +static int handle_command(struct Message *, struct Client *, + struct Client *, int, char **); static int hash(char *p); static struct Message *hash_parse(char *); @@ -120,7 +120,8 @@ string_to_array(char *string, char *parv[MAXPARA]) * * NOTE: parse() should not be called recusively by any other functions! */ -void parse(struct Client *client_p, char *pbuffer, char *bufend) +void +parse(struct Client *client_p, char *pbuffer, char *bufend) { struct Client* from = client_p; char* ch; @@ -150,9 +151,9 @@ void parse(struct Client *client_p, char *pbuffer, char *bufend) ch++; /* - ** Copy the prefix to 'sender' assuming it terminates - ** with SPACE (or NULL, which is an error, though). - */ + * Copy the prefix to 'sender' assuming it terminates + * with SPACE (or NULL, which is an error, though). + */ sender = ch; @@ -217,14 +218,12 @@ void parse(struct Client *client_p, char *pbuffer, char *bufend) } /* - ** Extract the command code from the packet. Point s to the end - ** of the command code and calculate the length using pointer - ** arithmetic. Note: only need length for numerics and *all* - ** numerics must have parameters and thus a space after the command - ** code. -avalon - * - * ummm???? - */ + * Extract the command code from the packet. Point s to the end + * of the command code and calculate the length using pointer + * arithmetic. Note: only need length for numerics and *all* + * numerics must have parameters and thus a space after the command + * code. -avalon + */ /* EOB is 3 chars long but is not a numeric */ @@ -250,16 +249,16 @@ void parse(struct Client *client_p, char *pbuffer, char *bufend) if (!mptr || !mptr->cmd) { /* - ** Note: Give error message *only* to recognized - ** persons. It's a nightmare situation to have - ** two programs sending "Unknown command"'s or - ** equivalent to each other at full blast.... - ** If it has got to person state, it at least - ** seems to be well behaving. Perhaps this message - ** should never be generated, though... --msa - ** Hm, when is the buffer empty -- if a command - ** code has been found ?? -Armin - */ + * Note: Give error message *only* to recognized + * persons. It's a nightmare situation to have + * two programs sending "Unknown command"'s or + * equivalent to each other at full blast.... + * If it has got to person state, it at least + * seems to be well behaving. Perhaps this message + * should never be generated, though... --msa + * Hm, when is the buffer empty -- if a command + * code has been found ?? -Armin + */ if (pbuffer[0] != '\0') { if (IsPerson(from)) @@ -289,21 +288,56 @@ void parse(struct Client *client_p, char *pbuffer, char *bufend) i = 0; - if (s) + if (s != NULL) i = string_to_array(s, para); + if (mptr == (struct Message *)NULL) { do_numeric(numeric, client_p, from, i, para); return; } - handle_command(mptr, client_p, from, i, para); + if (handle_command(mptr, client_p, from, i, para) < -1) + { + char *p; + for (p = pbuffer; p <= end; p +=8) + { + /* HACK HACK */ + /* Its expected this nasty code can be removed + * or rewritten later if still needed. + */ + if ((unsigned long)(p+8) > (unsigned long) end) + { + for(;p <= end; p++) + { + ilog(L_CRIT, "%02x |%c", p[0], p[0]); + } + } + else + ilog(L_CRIT, + "%02x %02x %02x %02x %02x %02x %02x %02x |%c%c%c%c%c%c%c%c", + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); + } + } + #ifdef INTENSIVE_DEBUG do_channel_integrity_check(); #endif } -static void +/* + * handle_command + * + * inputs - pointer to message block + * - pointer to client + * - pointer to client message is from + * - count of number of args + * - pointer to argv[] array + * output - -1 if error from server + * side effects - + */ +static int handle_command(struct Message *mptr, struct Client *client_p, struct Client *from, int i, char *hpara[MAXPARA]) { @@ -326,7 +360,7 @@ handle_command(struct Message *mptr, struct Client *client_p, if((IsHandshake(client_p) || IsConnecting(client_p) || IsServer(client_p)) && !(mptr->flags & MFLG_UNREG)) - return; + return(1); } handler = mptr->handlers[client_p->handler]; @@ -334,22 +368,35 @@ handle_command(struct Message *mptr, struct Client *client_p, /* check right amount of params is passed... --is */ if (i < mptr->parameters) { - if(IsServer(client_p)) - sendto_realops_flags(FLAGS_ALL, L_ALL, - "Not enough parameters for command %s from servers %s! (%d < %d)", - mptr->cmd, client_p->name, i, mptr->parameters); - sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS), - me.name, BadPtr(hpara[0]) ? "*" : hpara[0], mptr->cmd); - return; + if (!IsServer(client_p)) + { + sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS), + me.name, BadPtr(hpara[0]) ? "*" : hpara[0], mptr->cmd); + if (MyClient(client_p)) + return(1); + else + return(-1); + } + + sendto_realops_flags(FLAGS_ALL, L_ALL, + "Dropping server %s due to (invalid) command '%s'" + "with only %d arguments (expecting %d).", + client_p->name, mptr->cmd, i, mptr->parameters); + ilog(L_CRIT, "Insufficient parameters (%d) for command '%s' from %s.", + i, mptr->cmd, client_p->name); + + exit_client(client_p, client_p, client_p, + "Not enough arguments to server command."); + return(-1); } (*handler)(client_p, from, i, hpara); - return; + return(1); } /* - * init_hash_parse() + * clear_hash_parse() * * inputs - * output - NONE @@ -357,7 +404,8 @@ handle_command(struct Message *mptr, struct Client *client_p, * any other keyword hash routine is used. * */ -void clear_hash_parse() +void +clear_hash_parse() { memset(msg_hash_table,0,sizeof(msg_hash_table)); } @@ -414,7 +462,8 @@ mod_add_cmd(struct Message *msg) * output - none * side effects - unload this one command name */ -void mod_del_cmd(struct Message *msg) +void +mod_del_cmd(struct Message *msg) { struct MessageHash *ptr; struct MessageHash *last_ptr = NULL; @@ -448,7 +497,8 @@ void mod_del_cmd(struct Message *msg) * output - pointer to struct Message * side effects - */ -static struct Message *hash_parse(char *cmd) +static struct Message * +hash_parse(char *cmd) { struct MessageHash *ptr; int msgindex; @@ -495,7 +545,8 @@ hash(char *p) * output - NONE * side effects - NONE */ -void report_messages(struct Client *source_p) +void +report_messages(struct Client *source_p) { int i; struct MessageHash *ptr; @@ -556,15 +607,15 @@ cancel_clients(struct Client *client_p, struct Client *source_p, char *cmd) */ /* - ** with TS, fake prefixes are a common thing, during the - ** connect burst when there's a nick collision, and they - ** must be ignored rather than killed because one of the - ** two is surviving.. so we don't bother sending them to - ** all ops everytime, as this could send 'private' stuff - ** from lagged clients. we do send the ones that cause - ** servers to be dropped though, as well as the ones from - ** non-TS servers -orabidoo - */ + * with TS, fake prefixes are a common thing, during the + * connect burst when there's a nick collision, and they + * must be ignored rather than killed because one of the + * two is surviving.. so we don't bother sending them to + * all ops everytime, as this could send 'private' stuff + * from lagged clients. we do send the ones that cause + * servers to be dropped though, as well as the ones from + * non-TS servers -orabidoo + */ /* * Incorrect prefix for a server from some connection. If it is a * client trying to be annoying, just QUIT them, if it is a server @@ -609,11 +660,11 @@ cancel_clients(struct Client *client_p, struct Client *source_p, char *cmd) if (IsServer(client_p)) { /* - ** If the fake prefix is coming from a TS server, discard it - ** silently -orabidoo - ** - ** all servers must be TS these days --is - */ + * If the fake prefix is coming from a TS server, discard it + * silently -orabidoo + * + * all servers must be TS these days --is + */ if (source_p->user) { sendto_realops_flags(FLAGS_DEBUG, L_ADMIN, @@ -639,9 +690,8 @@ cancel_clients(struct Client *client_p, struct Client *source_p, char *cmd) * output - * side effects - */ -static void remove_unknown(struct Client *client_p, - char *lsender, - char *lbuffer) +static void +remove_unknown(struct Client *client_p, char *lsender, char *lbuffer) { if (!IsRegistered(client_p)) return; @@ -690,20 +740,21 @@ static void remove_unknown(struct Client *client_p, /* -** -** parc number of arguments ('sender' counted as one!) -** parv[0] pointer to 'sender' (may point to empty string) (not used) -** parv[1]..parv[parc-1] -** pointers to additional parameters, this is a NULL -** terminated list (parv[parc] == NULL). -** -** *WARNING* -** Numerics are mostly error reports. If there is something -** wrong with the message, just *DROP* it! Don't even think of -** sending back a neat error message -- big danger of creating -** a ping pong error message... -*/ -static void do_numeric(char numeric[], + * + * parc number of arguments ('sender' counted as one!) + * parv[0] pointer to 'sender' (may point to empty string) (not used) + * parv[1]..parv[parc-1] + * pointers to additional parameters, this is a NULL + * terminated list (parv[parc] == NULL). + * + * *WARNING* + * Numerics are mostly error reports. If there is something + * wrong with the message, just *DROP* it! Don't even think of + * sending back a neat error message -- big danger of creating + * a ping pong error message... + */ +static void +do_numeric(char numeric[], struct Client *client_p, struct Client *source_p, int parc, @@ -720,12 +771,12 @@ static void do_numeric(char numeric[], numeric[0] = '1'; /* - ** Prepare the parameter portion of the message into 'buffer'. - ** (Because the buffer is twice as large as the message buffer - ** for the socket, no overflow can occur here... ...on current - ** assumptions--bets are off, if these are changed --msa) - ** Note: if buffer is non-empty, it will begin with SPACE. - */ + * Prepare the parameter portion of the message into 'buffer'. + * (Because the buffer is twice as large as the message buffer + * for the socket, no overflow can occur here... ...on current + * assumptions--bets are off, if these are changed --msa) + * Note: if buffer is non-empty, it will begin with SPACE. + */ if (parc > 1) { char *t = buffer; /* Current position within the buffer */ @@ -757,6 +808,10 @@ static void do_numeric(char numeric[], * "right thing" on a nick collision, we have to keep both kills. * ergo we need to ignore ERR_NOSUCHNICK. --fl_ */ + /* quick comment. This _was_ tried. i.e. assume the other servers + * will do the "right thing" and kill a nick that is colliding. + * unfortunately, it did not work. --Dianora + */ if(atoi(numeric) != ERR_NOSUCHNICK) sendto_realops_flags(FLAGS_ALL, L_ADMIN, "*** %s(via %s) sent a %s numeric to me: %s", @@ -797,14 +852,16 @@ static void do_numeric(char numeric[], * output - * side effects - just returns a nastyogram to given user */ -void m_not_oper(struct Client* client_p, struct Client* source_p, +void +m_not_oper(struct Client* client_p, struct Client* source_p, int parc, char* parv[]) { sendto_one(source_p, form_str(ERR_NOPRIVILEGES), me.name, parv[0]); } -void m_unregistered(struct Client* client_p, struct Client* source_p, - int parc, char* parv[]) +void +m_unregistered(struct Client* client_p, struct Client* source_p, + int parc, char* parv[]) { /* bit of a hack. * I don't =really= want to waste a bit in a flag @@ -820,14 +877,16 @@ void m_unregistered(struct Client* client_p, struct Client* source_p, } } -void m_registered(struct Client* client_p, struct Client* source_p, +void +m_registered(struct Client* client_p, struct Client* source_p, int parc, char* parv[]) { sendto_one(client_p, form_str(ERR_ALREADYREGISTRED), me.name, parv[0]); } -void m_ignore(struct Client* client_p, struct Client* source_p, +void +m_ignore(struct Client* client_p, struct Client* source_p, int parc, char* parv[]) { return; diff --git a/src/s_auth.c b/src/s_auth.c index b524b3e..a4e3723 100644 --- a/src/s_auth.c +++ b/src/s_auth.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: s_auth.c,v 1.2 2002/08/13 14:45:13 fishwaldo Exp $ + * $Id: s_auth.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ /* @@ -195,9 +195,9 @@ static void auth_dns_callback(void* vptr, adns_answer* reply) *auth->client->host = '\0'; if(reply && (reply->status == adns_s_ok)) { - if(strlen(*reply->rrs.str) < HOSTLEN) + if(strlen(*reply->rrs.str) <= HOSTLEN) { - strcpy(str, *reply->rrs.str); + strlcpy(str, *reply->rrs.str, HOSTLEN+1); sendheader(auth->client, REPORT_FIN_DNS); } else @@ -205,15 +205,15 @@ static void auth_dns_callback(void* vptr, adns_answer* reply) #ifdef IPV6 if(*auth->client->localClient->sockhost == ':') { - strcat(str, "0"); + strlcat(str, "0",HOSTLEN+1); } if(auth->client->localClient->aftype == AF_INET6 && ConfigFileEntry.dot_in_ip6_addr == 1) { - strcat(str, auth->client->localClient->sockhost); - strcat(str, "."); + strlcat(str, auth->client->localClient->sockhost,HOSTLEN+1); + strlcat(str, ".",HOSTLEN+1); } else #endif - strcat(str, auth->client->localClient->sockhost); + strlcat(str, auth->client->localClient->sockhost,HOSTLEN+1); sendheader(auth->client, REPORT_HOST_TOOLONG); } } @@ -222,16 +222,16 @@ static void auth_dns_callback(void* vptr, adns_answer* reply) #ifdef IPV6 if(*auth->client->localClient->sockhost == ':') { - strcat(str, "0"); + strlcat(str, "0",HOSTLEN); } if(auth->client->localClient->aftype == AF_INET6 && ConfigFileEntry.dot_in_ip6_addr == 1) { - strcat(str, auth->client->localClient->sockhost); - strcat(str, "."); + strlcat(str, auth->client->localClient->sockhost,HOSTLEN+1); + strlcat(str, ".",HOSTLEN+1); sendheader(auth->client, REPORT_FAIL_DNS); } else #endif - strcat(str, auth->client->localClient->sockhost); + strlcat(str, auth->client->localClient->sockhost,HOSTLEN+1); sendheader(auth->client, REPORT_FAIL_DNS); } diff --git a/src/s_bsd.c b/src/s_bsd.c index 39e159b..4b6d0c5 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: s_bsd.c,v 1.2 2002/08/13 14:45:13 fishwaldo Exp $ + * $Id: s_bsd.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -472,8 +472,8 @@ void error_exit_client(struct Client* client_p, int error) } else { - ircsprintf(errmsg, "Read error: %d (%s)", - current_error, strerror(current_error)); + ircsprintf(errmsg, "Read error: %s", + strerror(current_error)); } fd_close(client_p->localClient->fd); client_p->localClient->fd = -1; diff --git a/src/s_conf.c b/src/s_conf.c index c4383ef..0ea44f0 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: s_conf.c,v 1.2 2002/08/13 14:45:13 fishwaldo Exp $ + * $Id: s_conf.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -56,6 +56,7 @@ struct config_server_hide ConfigServerHide; extern int yyparse(); /* defined in y.tab.c */ extern int lineno; extern char linebuf[]; +extern char conffilebuf[IRCD_BUFSIZE]; int scount = 0; /* used by yyparse(), etc */ #ifndef INADDR_NONE @@ -183,7 +184,7 @@ make_conf() aconf = (struct ConfItem*) MyMalloc(sizeof(struct ConfItem)); aconf->status = CONF_ILLEGAL; aconf->aftype = AF_INET; - return (aconf); + return(aconf); } /* @@ -274,6 +275,7 @@ report_configured_links(struct Client* source_p, int mask) char* name; char* classname; int port; + for (tmp = ConfigItemList; tmp; tmp = tmp->next) { if (tmp->status & mask) { @@ -285,7 +287,8 @@ report_configured_links(struct Client* source_p, int mask) return; get_printable_conf(tmp, &name, &host, &pass, &user, &port,&classname); - if (mask & CONF_SERVER) + + if(mask & CONF_SERVER) { char c; char buf[20]; @@ -293,6 +296,7 @@ report_configured_links(struct Client* source_p, int mask) buf[0] = '\0'; c = p->conf_char; + if (tmp->flags & CONF_FLAGS_ALLOW_AUTO_CONN) *s++ = 'A'; if (tmp->flags & CONF_FLAGS_CRYPTLINK) @@ -310,7 +314,10 @@ report_configured_links(struct Client* source_p, int mask) *s++ = '*'; *s++ = '\0'; + /* Allow admins to see actual ips */ + /* except if HIDE_SERVERS_IPS is defined */ +#ifndef HIDE_SERVERS_IPS if(IsOperAdmin(source_p)) sendto_one(source_p, form_str(p->rpl_stats), me.name, source_p->name, c, @@ -321,6 +328,7 @@ report_configured_links(struct Client* source_p, int mask) classname, oper_flags_as_string((int)tmp->hold)); else +#endif sendto_one(source_p, form_str(p->rpl_stats), me.name, source_p->name, c, "*@127.0.0.1", @@ -520,7 +528,7 @@ verify_access(struct Client* client_p, const char* username) else { non_ident[0] = '~'; - strlcpy(&non_ident[1],username, USERLEN); + strlcpy(&non_ident[1],username, USERLEN + 1); aconf = find_address_conf(client_p->host,non_ident, &client_p->localClient->ip, client_p->localClient->aftype); @@ -538,7 +546,7 @@ verify_access(struct Client* client_p, const char* username) } if (ConfigFileEntry.glines) { - if (!IsConfExemptKline(aconf)) + if (!IsConfExemptKline(aconf) && !IsConfExemptGline(aconf)) { if (IsGotId(client_p)) gkill_conf = find_gkill(client_p, client_p->username); @@ -571,7 +579,7 @@ verify_access(struct Client* client_p, const char* username) client_p->host, aconf->name); } #endif - strlcpy(client_p->host, aconf->name, HOSTLEN); + strlcpy(client_p->host, aconf->name, HOSTLEN + 1); SetIPSpoof(client_p); } return(attach_iline(client_p, aconf)); @@ -611,7 +619,7 @@ int attach_iline(struct Client *client_p, struct ConfItem *aconf) ConfConFreq(aconf) && ip_found->count > ConfConFreq(aconf)) { if(!IsConfExemptLimits(aconf)) - return TOO_MANY; /* Already at maximum allowed ip#'s */ + return(TOO_MANY); /* Already at maximum allowed ip#'s */ else { sendto_one(client_p, @@ -620,7 +628,7 @@ int attach_iline(struct Client *client_p, struct ConfItem *aconf) } } - return (attach_conf(client_p, aconf) ); + return(attach_conf(client_p, aconf)); } /* link list of free IP_ENTRY's */ @@ -693,7 +701,7 @@ find_or_add_ip(struct irc_inaddr *ip_in) return(ptr); } } - if ( (ptr = ip_hash_table[hash_index]) != (IP_ENTRY *)NULL ) + if ((ptr = ip_hash_table[hash_index]) != (IP_ENTRY *)NULL) { if( free_ip_entries == (IP_ENTRY *)NULL) outofmemory(); @@ -708,7 +716,7 @@ find_or_add_ip(struct irc_inaddr *ip_in) return(newptr); } - if( free_ip_entries == (IP_ENTRY *)NULL) + if (free_ip_entries == (IP_ENTRY *)NULL) outofmemory(); ptr = ip_hash_table[hash_index] = free_ip_entries; @@ -716,7 +724,7 @@ find_or_add_ip(struct irc_inaddr *ip_in) memcpy(&ptr->ip, ip_in, sizeof(struct irc_inaddr)); ptr->count = 0; ptr->next = (IP_ENTRY *)NULL; - return (ptr); + return(ptr); } /* @@ -812,7 +820,7 @@ count_ip_hash(int *number_ips_stored,u_long *mem_ips_stored) *number_ips_stored = 0; *mem_ips_stored = 0; - for(i = 0; i < IP_HASH_SIZE ;i++) + for (i = 0; i < IP_HASH_SIZE ;i++) { ip_hash_ptr = ip_hash_table[i]; while(ip_hash_ptr) @@ -829,9 +837,9 @@ count_ip_hash(int *number_ips_stored,u_long *mem_ips_stored) /* * iphash_stats() * - * inputs - - * output - - * side effects - + * input - + * output - + * side effects - */ void iphash_stats(struct Client *client_p, struct Client *source_p, @@ -893,9 +901,9 @@ detach_conf(struct Client* client_p,struct ConfItem* aconf) dlink_node *ptr; if(aconf == NULL) - return -1; + return(-1); - for( ptr = client_p->localClient->confs.head; ptr; ptr = ptr->next ) + for(ptr = client_p->localClient->confs.head; ptr; ptr = ptr->next) { if (ptr->data == aconf) { @@ -918,10 +926,10 @@ detach_conf(struct Client* client_p,struct ConfItem* aconf) } dlinkDelete(ptr, &client_p->localClient->confs); free_dlink_node(ptr); - return 0; + return(0); } } - return -1; + return(-1); } /* @@ -941,7 +949,7 @@ is_attached(struct Client *client_p, struct ConfItem *aconf) if (ptr->data == aconf) break; - return (ptr) ? 1 : 0; + return((ptr != NULL) ? 1 : 0); } /* @@ -962,14 +970,14 @@ attach_conf(struct Client *client_p,struct ConfItem *aconf) if (is_attached(client_p, aconf)) { - return 1; + return(1); } if (IsIllegal(aconf)) { return(NOT_AUTHORIZED); } - if ( (aconf->status & CONF_OPERATOR) == 0 ) + if ((aconf->status & CONF_OPERATOR) == 0) { if ((aconf->status & CONF_CLIENT) && ConfLinks(aconf) >= ConfMaxLinks(aconf) && ConfMaxLinks(aconf) > 0) @@ -999,7 +1007,7 @@ attach_conf(struct Client *client_p,struct ConfItem *aconf) aconf->clients++; if (aconf->status & CONF_CLIENT_MASK) ConfLinks(aconf)++; - return 0; + return(0); } /* @@ -1033,7 +1041,7 @@ attach_confs(struct Client* client_p, const char* name, int statmask) ++conf_counter; } } - return conf_counter; + return(conf_counter); } /* @@ -1055,7 +1063,7 @@ attach_connect_block(struct Client *client_p, assert(client_p != NULL); assert(host != NULL); if(client_p == NULL || host == NULL) - return 0; + return(0); for (ptr = ConfigItemList; ptr; ptr = ptr->next) { @@ -1066,9 +1074,9 @@ attach_connect_block(struct Client *client_p, if ((match(name, ptr->name) == 0) || (match(ptr->host, host) == 0)) continue; attach_conf(client_p, ptr); - return -1; + return(-1); } - return 0; + return(0); } /* @@ -1104,14 +1112,14 @@ find_conf_exact(const char* name, const char* user, if (tmp->status & CONF_OPERATOR) { if (tmp->clients < ConfMaxLinks(tmp)) - return tmp; + return(tmp); else continue; } else - return tmp; + return(tmp); } - return NULL; + return(NULL); } /* @@ -1135,9 +1143,9 @@ find_conf_name(dlink_list *list, const char* name, int statmask) aconf = ptr->data; if ((aconf->status & statmask) && aconf->name && (!irccmp(aconf->name, name) || match(aconf->name, name))) - return aconf; + return(aconf); } - return NULL; + return(NULL); } @@ -1183,14 +1191,14 @@ find_conf_by_host(const char* host, int status) struct ConfItem* conf; assert(host != NULL); if(host == NULL) - return NULL; + return(NULL); for (conf = ConfigItemList; conf; conf = conf->next) { if (conf->status == status && conf->host && match(host, conf->host)) - return conf; + return(conf); } - return NULL; + return(NULL); } /* @@ -1236,16 +1244,16 @@ find_u_conf(char *server,char *user,char *host) if (BadPtr(aconf->name)) continue; - if(match(aconf->name,server)) + if (match(aconf->name,server)) { if (BadPtr(aconf->user) || BadPtr(aconf->host)) - return YES; + return(YES); if(match(aconf->user,user) && match(aconf->host,host)) - return YES; + return(YES); } } - return NO; + return(NO); } @@ -1278,9 +1286,10 @@ clear_special_conf(struct ConfItem **this_conf) * as a result of an operator issuing this command, else assume it has been * called as a result of the server receiving a HUP signal. */ -int rehash(int sig) +int +rehash(int sig) { - if (sig) + if (sig != 0) { sendto_realops_flags(FLAGS_ALL, L_ALL, "Got signal SIGHUP, reloading ircd conf. file"); @@ -1298,7 +1307,7 @@ int rehash(int sig) flush_deleted_I_P(); check_klines(); reopen_log(logFileName); - return 0; + return(0); } /* @@ -1407,10 +1416,6 @@ set_default_conf(void) ConfigChannel.vchans_oper_only = NO; - ConfigChannel.use_except = YES; - ConfigChannel.use_invex = YES; - ConfigChannel.use_knock = YES; - ConfigChannel.use_vchans = NO; ConfigChannel.knock_delay = 300; ConfigChannel.knock_delay_channel = 60; ConfigChannel.max_chans_per_user = 15; @@ -1486,18 +1491,6 @@ validate_conf(void) (ConfigFileEntry.client_flood > CLIENT_FLOOD_MAX)) ConfigFileEntry.client_flood = CLIENT_FLOOD_MAX; - /* Hasn't been set yet, so set it now */ - if(ConfigChannel.use_halfops == -1) -#ifdef HALFOPS - ConfigChannel.use_halfops = 1; -#else - ConfigChannel.use_halfops = 0; -#endif - - /* hasnt been set, disable it by default */ - if(ConfigChannel.use_anonops == -1) - ConfigChannel.use_anonops = 0; - GlobalSetOptions.idletime = (ConfigFileEntry.idletime * 60); } @@ -1586,7 +1579,12 @@ lookup_confhost(struct ConfItem* aconf) } /* - * conf_connect_allowed (untested) + * conf_connect_allowed + * + * inputs - pointer to inaddr + * - int type ipv4 or ipv6 + * output - BANNED or accepted + * side effects - none */ int conf_connect_allowed(struct irc_inaddr *addr, int aftype) @@ -1596,10 +1594,10 @@ conf_connect_allowed(struct irc_inaddr *addr, int aftype) /* DLINE exempt also gets you out of static limits/pacing... */ if (aconf && (aconf->status & CONF_EXEMPTDLINE)) - return 0; + return(0); - if (aconf) - return BANNED_CLIENT; + if (aconf != NULL) + return(BANNED_CLIENT); ip_found = find_or_add_ip(addr); if ((CurrentTime - ip_found->last_attempt) < @@ -1607,10 +1605,10 @@ conf_connect_allowed(struct irc_inaddr *addr, int aftype) { ip_found->last_attempt = CurrentTime; ip_found->count--; - return TOO_FAST; + return(TOO_FAST); } ip_found->last_attempt = CurrentTime; - return 0; + return(0); } /* @@ -1635,7 +1633,7 @@ find_kill(struct Client* client_p) return aconf; if(aconf->status & CONF_KILL) return aconf; - return NULL; + return(NULL); } /* add_temp_kline @@ -1721,7 +1719,7 @@ oper_privs_as_string(struct Client *client_p,int port) privs_ptr = privs_out; *privs_ptr = '\0'; - if(port & CONF_OPER_GLINE) + if (port & CONF_OPER_GLINE) { if(client_p) SetOperGline(client_p); @@ -1883,7 +1881,7 @@ get_oper_name(struct Client *client_p) ircsprintf(buffer, "%s!%s@%s{%s}", client_p->name, client_p->username, client_p->host, ((struct ConfItem*)cnode->data)->name); - return buffer; + return(buffer); } /* Probably should assert here for now. If there is an oper out there * with no oper{} conf attached, it would be good for us to know... @@ -1892,7 +1890,7 @@ get_oper_name(struct Client *client_p) } ircsprintf(buffer, "%s!%s@%s{%s}", client_p->name, client_p->username, client_p->host, client_p->servptr->name); - return buffer; + return(buffer); } /* @@ -1944,6 +1942,14 @@ read_conf_files(int cold) filename = get_conf_name(CONF_TYPE); + /* We need to know the initial filename for the yyerror() to report + FIXME: The full path is in conffilenamebuf first time since we + dont know anything else + + - Gozem 2002-07-21 + */ + strlcpy(conffilebuf, filename, IRCD_BUFSIZE); + if ((conf_fbfile_in = fbopen(filename,"r")) == NULL) { if(cold) @@ -1963,8 +1969,6 @@ read_conf_files(int cold) if (cold) { /* set to 'undefined' */ - ConfigChannel.use_halfops = -1; - ConfigChannel.use_anonops = -1; } else { @@ -2332,7 +2336,7 @@ conf_add_server(struct ConfItem *aconf, int lcount) { sendto_realops_flags(FLAGS_ALL, L_ALL,"Bad connect block"); ilog(L_WARN, "Bad connect block"); - return -1; + return(-1); } if (BadPtr(aconf->passwd) && !(aconf->flags & CONF_FLAGS_CRYPTLINK)) @@ -2340,18 +2344,18 @@ conf_add_server(struct ConfItem *aconf, int lcount) sendto_realops_flags(FLAGS_ALL, L_ALL,"Bad connect block, name %s", aconf->name); ilog(L_WARN, "Bad connect block, host %s",aconf->name); - return -1; + return(-1); } - if( SplitUserHost(aconf) < 0 ) + if (SplitUserHost(aconf) < 0) { sendto_realops_flags(FLAGS_ALL, L_ALL,"Bad connect block, name %s", aconf->name); ilog(L_WARN, "Bad connect block, name %s",aconf->name); - return -1; + return(-1); } lookup_confhost(aconf); - return 0; + return(0); } /* @@ -2436,15 +2440,15 @@ conf_add_fields(struct ConfItem *aconf, char *port_field, char *class_field) { - if(host_field) + if (host_field != NULL) DupString(aconf->host, host_field); - if(pass_field) + if (pass_field != NULL) DupString(aconf->passwd, pass_field); - if(user_field) + if (user_field != NULL) DupString(aconf->user, user_field); - if(port_field) + if (port_field != NULL) aconf->port = atoi(port_field); - if(class_field) + if (class_field != NULL) DupString(aconf->className, class_field); } @@ -2462,11 +2466,11 @@ yyerror(char *msg) strip_tabs(newlinebuf, (const unsigned char *)linebuf, strlen(linebuf)); - sendto_realops_flags(FLAGS_ALL, L_ALL,"%d: %s on line: %s", - lineno + 1, msg, newlinebuf); + sendto_realops_flags(FLAGS_ALL, L_ALL,"\"%s\", line %d: %s: %s", + conffilebuf, lineno + 1, msg, newlinebuf); - ilog(L_WARN, "%d: %s on line: %s", - lineno + 1, msg, newlinebuf); + ilog(L_WARN, "\"%s\", line %d: %s: %s", + conffilebuf, lineno + 1, msg, newlinebuf); } int @@ -2474,10 +2478,8 @@ conf_fbgets(char *lbuf,int max_size, FBFILE *fb) { char* buff; - buff = fbgets(lbuf,max_size,fb); - - if(!buff) - return 0; + if ((buff = fbgets(lbuf,max_size,fb)) == NULL) + return(0); return(strlen(lbuf)); } @@ -2485,7 +2487,7 @@ conf_fbgets(char *lbuf,int max_size, FBFILE *fb) int conf_yy_fatal_error(char *msg) { - return 0; + return(0); } diff --git a/src/s_debug.c b/src/s_debug.c index b4978c0..7fda4ef 100644 --- a/src/s_debug.c +++ b/src/s_debug.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: s_debug.c,v 1.2 2002/08/13 14:45:13 fishwaldo Exp $ + * $Id: s_debug.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -244,16 +244,10 @@ void count_memory(struct Client *source_p) channel_users++; for (dlink = chptr->chanops.head; dlink; dlink = dlink->next) channel_users++; -#ifdef REQUIRE_OANDV - for (dlink = chptr->chanops_voiced.head; dlink; dlink = dlink->next) - channel_users++; -#endif for (dlink = chptr->voiced.head; dlink; dlink = dlink->next) channel_users++; -#ifdef HALFOPS for (dlink = chptr->halfops.head; dlink; dlink = dlink->next) channel_users++; -#endif for (dlink = chptr->invites.head; dlink; dlink = dlink->next) channel_invites++; diff --git a/src/s_serv.c b/src/s_serv.c index b15c280..453b6d9 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: s_serv.c,v 1.3 2002/08/15 06:05:02 fishwaldo Exp $ + * $Id: s_serv.c,v 1.4 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -1060,12 +1060,13 @@ int server_estab(struct Client *client_p) ** ...a bit tricky, but you have been warned, besides ** code is more neat this way... --msa */ - SetServer(client_p); client_p->servptr = &me; if (IsDead(client_p)) return CLIENT_EXITED; + SetServer(client_p); + /* Update the capability combination usage counts. -A1kmm */ set_chcap_usage_counts(client_p); @@ -1597,14 +1598,10 @@ burst_all(struct Client *client_p) if(chptr->users != 0) { burst_members(client_p,&chptr->chanops); -#ifdef REQUIRE_OANDV - burst_members(client_p,&chptr->chanops_voiced); -#endif burst_members(client_p,&chptr->voiced); -#ifdef HALFOPS burst_members(client_p,&chptr->halfops); -#endif burst_members(client_p,&chptr->peons); + burst_members(client_p,&chptr->chanadmins); send_channel_modes(client_p, chptr); hinfo.chptr = chptr; hinfo.client = client_p; @@ -1621,14 +1618,11 @@ burst_all(struct Client *client_p) if(vchan->users != 0) { burst_members(client_p,&vchan->chanops); -#ifdef REQUIRE_OANDV - burst_members(client_p,&vchan->chanops_voiced); -#endif burst_members(client_p,&vchan->voiced); -#ifdef HALFOPS burst_members(client_p,&vchan->halfops); -#endif burst_members(client_p,&vchan->peons); + burst_members(client_p,&vchan->chanadmins); + send_channel_modes(client_p, vchan); hinfo.chptr = chptr; hinfo.client = client_p; @@ -1700,14 +1694,10 @@ burst_channel(struct Client *client_p, struct Channel *chptr) #endif burst_ll_members(client_p,&chptr->chanops); -#ifdef REQUIRE_OANDV - burst_ll_members(client_p, &chptr->chanops_voiced); -#endif burst_ll_members(client_p,&chptr->voiced); -#ifdef HALFOPS burst_ll_members(client_p,&chptr->halfops); -#endif burst_ll_members(client_p,&chptr->peons); + burst_ll_members(client_p,&chptr->chanadmins); send_channel_modes(client_p, chptr); add_lazylinkchannel(client_p,chptr); @@ -1728,14 +1718,10 @@ burst_channel(struct Client *client_p, struct Channel *chptr) { vchan = ptr->data; burst_ll_members(client_p,&vchan->chanops); -#ifdef REQUIRE_OANDV - burst_ll_members(client_p,&vchan->chanops_voiced); -#endif burst_ll_members(client_p,&vchan->voiced); -#ifdef HALFOPS burst_ll_members(client_p,&vchan->halfops); -#endif burst_ll_members(client_p,&vchan->peons); + burst_ll_members(client_p,&vchan->chanadmins); send_channel_modes(client_p, vchan); add_lazylinkchannel(client_p,vchan); @@ -2047,8 +2033,8 @@ serv_connect(struct ConfItem *aconf, struct Client *by) client_p = make_client(NULL); /* Copy in the server, hostname, fd */ - strlcpy(client_p->name, aconf->name, HOSTLEN); - strlcpy(client_p->host, aconf->host, HOSTLEN); + strlcpy(client_p->name, aconf->name, HOSTLEN + 1); + strlcpy(client_p->host, aconf->host, HOSTLEN + 1); inetntop(DEF_FAM, &IN_ADDR(aconf->ipnum), client_p->localClient->sockhost, HOSTIPLEN); client_p->localClient->fd = fd; diff --git a/src/s_user.c b/src/s_user.c index a511c6a..e228354 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: s_user.c,v 1.3 2002/08/14 06:29:46 fishwaldo Exp $ + * $Id: s_user.c,v 1.4 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -178,7 +178,8 @@ int user_modes_from_c_to_bitmask[] = * output - * side effects - display to client user counts etc. */ -int show_lusers(struct Client *source_p) +int +show_lusers(struct Client *source_p) { if(!ConfigServerHide.hide_servers || IsOper(source_p)) sendto_one(source_p, form_str(RPL_LUSERCLIENT), me.name, source_p->name, @@ -236,7 +237,8 @@ int show_lusers(struct Client *source_p) * output - * side effects - display to client what we support (for them) */ -void show_isupport(struct Client *source_p) +void +show_isupport(struct Client *source_p) { char isupportbuffer[512]; @@ -276,7 +278,8 @@ void show_isupport(struct Client *source_p) ** nick from local user or kill him/her... */ -int register_local_user(struct Client *client_p, struct Client *source_p, +int +register_local_user(struct Client *client_p, struct Client *source_p, char *nick, char *username) { struct ConfItem* aconf; @@ -296,6 +299,7 @@ int register_local_user(struct Client *client_p, struct Client *source_p, if(!MyConnect(source_p)) return -1; + if(ConfigFileEntry.ping_cookie) { if(!(source_p->flags & FLAGS_PINGSENT) && source_p->localClient->random_ping == 0) @@ -303,7 +307,7 @@ int register_local_user(struct Client *client_p, struct Client *source_p, source_p->localClient->random_ping = (unsigned long)rand(); sendto_one(source_p, "PING :%lu", (unsigned long)source_p->localClient->random_ping); source_p->flags |= FLAGS_PINGSENT; - strlcpy(source_p->username, username, USERLEN); + strlcpy(source_p->username, username, USERLEN + 1); return -1; } if(!(source_p->flags2 & FLAGS2_PING_COOKIE)) @@ -325,7 +329,7 @@ int register_local_user(struct Client *client_p, struct Client *source_p, { sendto_one(source_p,":%s NOTICE %s :*** Notice -- You have an illegal character in your hostname", me.name, source_p->name ); - strncpy(source_p->host,source_p->localClient->sockhost,HOSTIPLEN+1); + strncpy(source_p->host,source_p->localClient->sockhost,HOSTIPLEN+1); } ptr = source_p->localClient->confs.head; @@ -443,7 +447,11 @@ int register_local_user(struct Client *client_p, struct Client *source_p, sendto_realops_flags(FLAGS_CCONN, L_ALL, "Client connecting: %s (%s@%s) [%s] {%s} [%s]", nick, source_p->username, source_p->host, +#ifdef HIDE_SPOOF_IPS + IsIPSpoof(client_p) ? "255.255.255.255" : ipaddr, +#else ipaddr, +#endif get_client_class(source_p), source_p->info); /* If they have died in send_* don't do anything. */ @@ -509,10 +517,11 @@ int register_local_user(struct Client *client_p, struct Client *source_p, * side effects - This function is called when a remote client * is introduced by a server. */ -int register_remote_user(struct Client *client_p, struct Client *source_p, +int +register_remote_user(struct Client *client_p, struct Client *source_p, char *nick, char *username) { - struct User* user = source_p->user; + struct User *user = source_p->user; struct Client *target_p; assert(NULL != source_p); @@ -523,7 +532,7 @@ int register_remote_user(struct Client *client_p, struct Client *source_p, user->last = CurrentTime; - strlcpy(source_p->username, username, USERLEN); + strlcpy(source_p->username, username, USERLEN + 1); SetClient(source_p); @@ -611,6 +620,7 @@ introduce_client(struct Client *client_p, struct Client *source_p, ubuf[0] = '+'; ubuf[1] = '\0'; } + /* arghhh one could try not introducing new nicks to ll leafs * but then you have to introduce them "on the fly" in SJOIN * not fun. @@ -693,7 +703,8 @@ introduce_client(struct Client *client_p, struct Client *source_p, * NOTE: this doesn't allow a hostname to begin with a dot and * will not allow more dots than chars. */ -static int valid_hostname(const char* hostname) +static int +valid_hostname(const char* hostname) { const char* p = hostname; @@ -726,7 +737,8 @@ static int valid_hostname(const char* hostname) * Allow '.' in username to allow for "first.last" * style of username */ -static int valid_username(const char* username) +static int +valid_username(const char* username) { int dots = 0; const char *p = username; @@ -790,6 +802,16 @@ report_and_set_user_flags(struct Client *source_p,struct ConfItem *aconf) ":%s NOTICE %s :*** You are exempt from K/D/G lines. congrats.", me.name,source_p->name); } + /* The else here is to make sure that G line exempt users + * do not get noticed twice. + */ + else if (IsConfExemptGline(aconf)) + { + SetExemptGline(source_p); + sendto_one(source_p, + ":%s NOTICE %s :*** You are exempt from G lines.", + me.name,source_p->name); + } /* If this user is exempt from user limits set it F lined" */ if(IsConfExemptLimits(aconf)) @@ -818,7 +840,8 @@ report_and_set_user_flags(struct Client *source_p,struct ConfItem *aconf) * output - * side effects - */ -int do_local_user(char* nick, struct Client* client_p, struct Client* source_p, +int +do_local_user(char* nick, struct Client* client_p, struct Client* source_p, char* username, char *host, char *server, char *realname) { struct User* user; @@ -856,7 +879,7 @@ int do_local_user(char* nick, struct Client* client_p, struct Client* source_p, /* * save the username in the client */ - strlcpy(source_p->username, username, USERLEN); + strlcpy(source_p->username, username, USERLEN + 1); } } return 0; @@ -869,7 +892,8 @@ int do_local_user(char* nick, struct Client* client_p, struct Client* source_p, * output - * side effects - */ -int do_remote_user(char* nick, struct Client* client_p, struct Client* source_p, +int +do_remote_user(char* nick, struct Client* client_p, struct Client* source_p, char* username, char *host, char *server, char *realname, char *id) { @@ -892,8 +916,8 @@ int do_remote_user(char* nick, struct Client* client_p, struct Client* source_p, strlcpy(source_p->host, host, HOSTLEN); strlcpy(source_p->vhost, host, HOSTLEN); strlcpy(source_p->info, realname, REALLEN); - if (id) - strcpy(source_p->user->id, id); + if (id != NULL) + strcpy(source_p->user->id, id); return register_remote_user(client_p, source_p, source_p->name, username); } @@ -906,7 +930,8 @@ int do_remote_user(char* nick, struct Client* client_p, struct Client* source_p, * parv[1] - username to change mode for * parv[2] - modes to change */ -int user_mode(struct Client *client_p, struct Client *source_p, int parc, char *parv[]) +int +user_mode(struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { int flag; int i; @@ -915,10 +940,9 @@ int user_mode(struct Client *client_p, struct Client *source_p, int parc, char * int what, setflags; int badflag = NO; /* Only send one bad flag notice */ char buf[BUFSIZE]; - dlink_node *ptr; - struct ConfItem *aconf; what = MODE_ADD; + if (parc < 2) { sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), @@ -971,7 +995,7 @@ int user_mode(struct Client *client_p, struct Client *source_p, int parc, char * /* * parse mode change string(s) */ - for (p = &parv[2]; p && *p; p++ ) + for (p = &parv[2]; p && *p; p++) for (m = *p; *m; m++) switch(*m) { @@ -1009,32 +1033,13 @@ int user_mode(struct Client *client_p, struct Client *source_p, int parc, char * { dlink_node *dm; - ptr = source_p->localClient->confs.head; - aconf = ptr->data; - detach_conf(source_p,aconf); - - source_p->flags2 &= ~(FLAGS2_OPER_GLOBAL_KILL| - FLAGS2_OPER_REMOTE| - FLAGS2_OPER_UNKLINE| - FLAGS2_OPER_GLINE| - FLAGS2_OPER_N| - FLAGS2_OPER_K| - FLAGS2_OPER_ADMIN); - + source_p->flags2 &= ~FLAGS2_OPER_FLAGS; dm = dlinkFind(&oper_list,source_p); if(dm != NULL) { dlinkDelete(dm,&oper_list); free_dlink_node(dm); } - - /* - 20001216: - reattach to "old" iline - - einride - */ - remove_one_ip(&source_p->localClient->ip); - check_client(source_p->servptr, source_p, source_p->username); } } break; @@ -1106,7 +1111,7 @@ int user_mode(struct Client *client_p, struct Client *source_p, int parc, char * me.name,parv[0]); source_p->umodes &= ~FLAGS_NCHANGE; /* only tcm's really need this */ } - + if (MyConnect(source_p) && (source_p->umodes & FLAGS_ADMIN) && !IsOperAdmin(source_p)) { sendto_one(source_p,":%s NOTICE %s :*** You need oper and A flag for +a", @@ -1144,8 +1149,9 @@ int user_mode(struct Client *client_p, struct Client *source_p, int parc, char * /* * send the MODE string for user (user) to connection client_p * -avalon - */ -void send_umode(struct Client *client_p, struct Client *source_p, int old, + */ +void +send_umode(struct Client *client_p, struct Client *source_p, int old, int sendmask, char *umode_buf) { int i; @@ -1163,8 +1169,8 @@ void send_umode(struct Client *client_p, struct Client *source_p, int old, for (i = 0; user_modes[i].letter; i++ ) { flag = user_modes[i].mode; + if (MyClient(source_p) && !(flag & sendmask)) - continue; if ((flag & old) && !(source_p->umodes & flag)) { @@ -1179,10 +1185,9 @@ void send_umode(struct Client *client_p, struct Client *source_p, int old, } else if (!(flag & old) && (source_p->umodes & flag)) { - - if (what == MODE_ADD) { + if (what == MODE_ADD) *m++ = user_modes[i].letter; - } else + else { what = MODE_ADD; *m++ = '+'; @@ -1203,7 +1208,8 @@ void send_umode(struct Client *client_p, struct Client *source_p, int old, * output - NONE * side effects - Only send ubuf out to servers that know about this client */ -void send_umode_out(struct Client *client_p, +void +send_umode_out(struct Client *client_p, struct Client *source_p, int old) { @@ -1229,7 +1235,6 @@ void send_umode_out(struct Client *client_p, if (client_p && MyClient(client_p)) send_umode(client_p, source_p, old, ALL_UMODES, buf); - } /* @@ -1239,7 +1244,8 @@ void send_umode_out(struct Client *client_p, * output - NONE * side effects - */ -void user_welcome(struct Client *source_p) +void +user_welcome(struct Client *source_p) { sendto_one(source_p, form_str(RPL_WELCOME), me.name, source_p->name, ServerInfo.network_name, source_p->name ); @@ -1301,7 +1307,8 @@ void user_welcome(struct Client *source_p) * outupt - -1 if exiting 0 if ok * side effects - */ -static int check_X_line(struct Client *client_p, struct Client *source_p) +static int +check_X_line(struct Client *client_p, struct Client *source_p) { struct ConfItem *aconf; char *reason; @@ -1338,7 +1345,7 @@ static int check_X_line(struct Client *client_p, struct Client *source_p) get_client_name(client_p, HIDE_IP)); } - return 0; + return (0); } /* @@ -1353,8 +1360,8 @@ static int check_X_line(struct Client *client_p, struct Client *source_p) * This could also be used by rsa oper routines. */ -int oper_up( struct Client *source_p, - struct ConfItem *aconf ) +int +oper_up( struct Client *source_p, struct ConfItem *aconf ) { int old = (source_p->umodes & ALL_UMODES); char *operprivs=NULL; @@ -1366,7 +1373,7 @@ int oper_up( struct Client *source_p, if((int)aconf->hold) { source_p->umodes |= ((int)aconf->hold & ALL_UMODES); - if( !IsOperN(source_p) ) + if (!IsOperN(source_p)) source_p->umodes &= ~FLAGS_NCHANGE; sendto_one(source_p, ":%s NOTICE %s :*** Oper flags set from conf", @@ -1416,5 +1423,5 @@ int oper_up( struct Client *source_p, source_p->name, operprivs); SendMessageFile(source_p, &ConfigFileEntry.opermotd); - return 1; + return(1); } diff --git a/src/scache.c b/src/scache.c index ee67a3d..5514996 100644 --- a/src/scache.c +++ b/src/scache.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: scache.c,v 1.2 2002/08/13 14:45:13 fishwaldo Exp $ + * $Id: scache.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -96,7 +96,7 @@ const char* find_or_add(const char* name) ptr = (SCACHE*) MyMalloc(sizeof(SCACHE)); assert(0 != ptr); - strlcpy(ptr->name, name, HOSTLEN); + strlcpy(ptr->name, name, HOSTLEN + 1); ptr->next = scache_hash[hash_index]; scache_hash[hash_index] = ptr; diff --git a/src/send.c b/src/send.c index 090cc21..c4cee55 100644 --- a/src/send.c +++ b/src/send.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: send.c,v 1.3 2002/08/14 16:52:02 fishwaldo Exp $ + * $Id: send.c,v 1.4 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -532,18 +532,11 @@ sendto_channel_butone(struct Client *one, struct Client *from, sendto_list_anywhere(one, from, &chptr->chanops, &local_linebuf, &remote_linebuf, &uid_linebuf); -#ifdef REQUIRE_OANDV - sendto_list_anywhere(one, from, &chptr->chanops_voiced, - &local_linebuf, &remote_linebuf, &uid_linebuf); -#endif - sendto_list_anywhere(one, from, &chptr->voiced, &local_linebuf, &remote_linebuf, &uid_linebuf); -#ifdef HALFOPS sendto_list_anywhere(one, from, &chptr->halfops, &local_linebuf, &remote_linebuf, &uid_linebuf); -#endif sendto_list_anywhere(one, from, &chptr->peons, &local_linebuf, &remote_linebuf, &uid_linebuf); @@ -742,12 +735,7 @@ sendto_common_channels_local(struct Client *user, const char *pattern, ...) chptr = ptr->data; sendto_list_local(&chptr->locchanops, &linebuf); -#ifdef REQUIRE_OANDV - sendto_list_local(&chptr->locchanops_voiced, &linebuf); -#endif -#ifdef HALFOPS sendto_list_local(&chptr->lochalfops, &linebuf); -#endif sendto_list_local(&chptr->locvoiced, &linebuf); sendto_list_local(&chptr->locpeons, &linebuf); sendto_list_local(&chptr->locchanadmins, &linebuf); @@ -799,15 +787,10 @@ sendto_channel_local(int type, sendto_list_local(&chptr->locpeons, &linebuf); case ONLY_CHANOPS_HALFOPS_VOICED: sendto_list_local(&chptr->locvoiced, &linebuf); -#ifdef HALFOPS case ONLY_CHANOPS_HALFOPS: sendto_list_local(&chptr->lochalfops, &linebuf); -#endif case ONLY_CHANOPS: sendto_list_local(&chptr->locchanops, &linebuf); -#ifdef REQUIRE_OANDV - sendto_list_local(&chptr->locchanops_voiced, &linebuf); -#endif case ONLY_CHANADMIN: sendto_list_local(&chptr->locchanadmins, &linebuf); } @@ -857,16 +840,10 @@ sendto_channel_remote(struct Client *one, sendto_list_remote(one, from, &chptr->peons, caps, nocaps, &linebuf); case ONLY_CHANOPS_HALFOPS_VOICED: sendto_list_remote(one, from, &chptr->voiced, caps, nocaps, &linebuf); -#ifdef HALFOPS case ONLY_CHANOPS_HALFOPS: sendto_list_remote(one, from, &chptr->halfops, caps, nocaps, &linebuf); -#endif case ONLY_CHANOPS: sendto_list_remote(one, from, &chptr->chanops, caps, nocaps, &linebuf); -#ifdef REQUIRE_OANDV - sendto_list_remote(one, from, &chptr->chanops_voiced, caps, nocaps, - &linebuf); -#endif case ONLY_CHANADMIN: sendto_list_remote(one, from, &chptr->chanadmins, caps, nocaps, &linebuf); } diff --git a/src/vchannel.c b/src/vchannel.c index 66f3813..f04eff8 100644 --- a/src/vchannel.c +++ b/src/vchannel.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: vchannel.c,v 1.2 2002/08/13 14:45:13 fishwaldo Exp $ + * $Id: vchannel.c,v 1.3 2002/08/16 12:05:37 fishwaldo Exp $ */ #include "stdinc.h" @@ -479,23 +479,13 @@ pick_vchan_id(struct Channel *chptr) return target_p->name; } -#ifdef REQUIRE_OANDV - for (lp = chptr->chanops_voiced.head; lp; lp = lp->next) - if (!lp->next) - { - target_p = lp->data; - return target_p->name; - } -#endif -#ifdef HALFOPS for (lp = chptr->halfops.head; lp; lp = lp->next) if (!lp->next) { target_p = lp->data; return target_p->name; } -#endif for (lp = chptr->voiced.head; lp; lp = lp->next) if (!lp->next) @@ -510,7 +500,12 @@ pick_vchan_id(struct Channel *chptr) target_p = lp->data; return target_p->name; } - + for (lp = chptr->chanadmins.head; lp; lp = lp->next) + if (!lp->next) + { + target_p = lp->data; + return target_p->name; + } return chptr->vchan_id; }