From: Kevin L. Mitchell Date: Wed, 13 Dec 2000 19:14:26 +0000 (+0000) Subject: Author: Kev X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=fda0e2796ececf42f7a36f8066cc63fa1ef736fc Author: Kev Log message: This finishes phase one of the struct Client/struct Connection divorce. Everybody is now using the accessor macros. IT IS VERY IMPORTANT THAT ANY NEW CODE USE THESE MACROS! Phase two will be much smaller, involving only a new structure and changes to some accessor macros in client.h, and some code moving from list.c to client.c with addition of struct Connection allocation. It somehow seems appropriate that MIT's mascot is the beaver. Testing: I've compiled and run the server and can't see any differences in behavior. This is, however, a huge change, so something may very well be messed up. Brute-force is the order of the day. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@336 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index 79e9a38..e9ed9b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,137 @@ +2000-12-13 Kevin L. Mitchell + + * ircd/whowas.c: missed a couple of accesses to a struct Client + + * ircd/uping.c: missed a couple of accesses to a struct Client + + * ircd/send.c: missed a couple of accesses to a struct Client + + * ircd/s_user.c: missed a couple of accesses to a struct Client + + * ircd/s_misc.c: missed a couple of accesses to a struct Client + + * ircd/s_conf.c: missed a couple of accesses to a struct Client + + * ircd/s_bsd.c: missed a couple of accesses to a struct Client + + * ircd/s_auth.c: missed a couple of accesses to a struct Client + + * ircd/res.c: missed a couple of accesses to a struct Client + + * ircd/parse.c: missed a couple of accesses to a struct Client + + * ircd/m_whois.c: use new accessor macros for struct Client + + * ircd/m_who.c: use new accessor macros for struct Client + + * ircd/m_wallchops.c: use new accessor macros for struct Client + + * ircd/m_version.c: use new accessor macros for struct Client + + * ircd/m_userip.c: use new accessor macros for struct Client + + * ircd/m_userhost.c: use new accessor macros for struct Client + + * ircd/m_user.c: use new accessor macros for struct Client + + * ircd/m_uping.c: use new accessor macros for struct Client + + * ircd/m_trace.c: use new accessor macros for struct Client + + * ircd/m_topic.c: use new accessor macros for struct Client + + * ircd/m_time.c: use new accessor macros for struct Client + + * ircd/m_stats.c: use new accessor macros for struct Client + + * ircd/m_squit.c: use new accessor macros for struct Client + + * ircd/m_silence.c: use new accessor macros for struct Client + + * ircd/m_server.c: use new accessor macros for struct Client; + remove dead code + + * ircd/m_rpong.c: use new accessor macros for struct Client + + * ircd/m_rping.c: use new accessor macros for struct Client + + * ircd/m_quit.c: use new accessor macros for struct Client + + * ircd/m_privmsg.c: use new accessor macros for struct Client + + * ircd/m_pong.c: use new accessor macros for struct Client; remove + dead code + + * ircd/m_ping.c: use new accessor macros for struct Client + + * ircd/m_pass.c: use new accessor macros for struct Client + + * ircd/m_part.c: use new accessor macros for struct Client + + * ircd/m_oper.c: use new accessor macros for struct Client + + * ircd/m_notice.c: use new accessor macros for struct Client + + * ircd/m_nick.c: use new accessor macros for struct Client + + * ircd/m_names.c: use new accessor macros for struct Client + + * ircd/m_mode.c: use new accessor macros for struct Client + + * ircd/m_map.c: use new accessor macros for struct Client + + * ircd/m_list.c: use new accessor macros for struct Client + + * ircd/m_links.c: use new accessor macros for struct Client; + remove some dead code + + * ircd/m_kill.c: use new accessor macros for struct Client; remove + some dead code + + * ircd/m_kick.c: use new accessor macros for struct Client + + * ircd/m_join.c: use new accessor macros for struct Client; remove + some dead code + + * ircd/m_ison.c: use new accessor macros for struct Client + + * ircd/m_invite.c: use new accessor macros for struct Client + + * ircd/m_info.c: use new accessor macros for struct Client + + * ircd/m_gline.c: use new accessor macros for struct Client + + * ircd/m_error.c: use new accessor macros for struct Client + + * ircd/m_create.c: use new accessor macros for struct Client + + * ircd/m_connect.c: use new accessor macros for struct Client; + removed some dead code + + * ircd/m_burst.c: use new accessor macros for struct Client + + * ircd/m_away.c: use new accessor macros for struct Client + + * ircd/m_admin.c: use new accessor macros for struct Client + + * ircd/hash.c: missed a couple of accesses to a struct Client + + * ircd/gline.c: missed a couple of accesses to a struct Client + + * ircd/crule.c: missed a couple of accesses to a struct Client + + * ircd/class.c: missed an access to a struct Client + + * ircd/channel.c: missed a couple of accesses to a struct Client + + * ircd/IPcheck.c: missed an access to a struct Client + + * include/querycmds.h: fix a couple of stats macros to use + structure accessor macros + + * include/client.h: change structure member names to highlight any + places in the code I've missed + 2000-12-12 Kevin L. Mitchell * ircd/whowas.c: use new struct Client accessor macros diff --git a/include/client.h b/include/client.h index af04046..3e1d998 100644 --- a/include/client.h +++ b/include/client.h @@ -60,7 +60,7 @@ struct hostent; * Macros */ #define CLIENT_LOCAL_SIZE sizeof(struct Client) -#define CLIENT_REMOTE_SIZE offsetof(struct Client, count) +#define CLIENT_REMOTE_SIZE offsetof(struct Client, cli_count) /* * Structures @@ -71,33 +71,33 @@ struct hostent; */ struct Client { - struct Client* next; /* link in GlobalClientList */ - struct Client* prev; /* link in GlobalClientList */ - struct Client* hnext; /* link in hash table bucket or this */ - struct Client* from; /* == self, if Local Client, *NEVER* NULL! */ - struct User* user; /* ...defined, if this is a User */ - struct Server* serv; /* ...defined, if this is a server */ - struct Whowas* whowas; /* Pointer to ww struct to be freed on quit */ - char yxx[4]; /* Numeric Nick: YMM if this is a server, + struct Client* cli_next; /* link in GlobalClientList */ + struct Client* cli_prev; /* link in GlobalClientList */ + struct Client* cli_hnext; /* link in hash table bucket or this */ + struct Client* cli_from; /* == self, if Local Client, *NEVER* NULL! */ + struct User* cli_user; /* ...defined, if this is a User */ + struct Server* cli_serv; /* ...defined, if this is a server */ + struct Whowas* cli_whowas; /* Pointer to ww struct to be freed on quit */ + char cli_yxx[4]; /* Numeric Nick: YMM if this is a server, XX0 if this is a user */ /* * XXX - move these to local part for next release * (lasttime, since) */ - time_t lasttime; /* last time data read from socket */ - time_t since; /* last time we parsed something, flood control */ - - time_t firsttime; /* time client was created */ - time_t lastnick; /* TimeStamp on nick */ - int marker; /* /who processing marker */ - unsigned int flags; /* client flags */ - unsigned int hopcount; /* number of servers to this 0 = local */ - struct in_addr ip; /* Real ip# NOT defined for remote servers! */ - short status; /* Client type */ - unsigned char local; /* local or remote client */ - char name[HOSTLEN + 1]; /* Unique name of the client, nick or host */ - char username[USERLEN + 1]; /* username here now for auth stuff */ - char info[REALLEN + 1]; /* Free form additional client information */ + time_t cli_lasttime; /* last time data read from socket */ + time_t cli_since; /* last time we parsed something, flood control */ + + time_t cli_firsttime; /* time client was created */ + time_t cli_lastnick; /* TimeStamp on nick */ + int cli_marker; /* /who processing marker */ + unsigned int cli_flags; /* client flags */ + unsigned int cli_hopcount; /* number of servers to this 0 = local */ + struct in_addr cli_ip; /* Real ip# NOT defined for remote servers! */ + short cli_status; /* Client type */ + unsigned char cli_local; /* local or remote client */ + char cli_name[HOSTLEN + 1]; /* Unique name of the client, nick or host */ + char cli_username[USERLEN + 1]; /* username here now for auth stuff */ + char cli_info[REALLEN + 1]; /* Free form additional client information */ /* * The following fields are allocated only for local clients * (directly connected to *this* server with a socket. @@ -105,91 +105,91 @@ struct Client { * to which the allocation is tied to! *Never* refer to * these fields, if (from != self). */ - unsigned int count; /* Amount of data in buffer, DON'T PUT + unsigned int cli_count; /* Amount of data in buffer, DON'T PUT variables ABOVE this one! */ - int fd; /* >= 0, for local clients */ - int error; /* last socket level error for client */ - unsigned int snomask; /* mask for server messages */ - time_t nextnick; /* Next time a nick change is allowed */ - time_t nexttarget; /* Next time a target change is allowed */ - unsigned int cookie; /* Random number the user must PONG */ - struct MsgQ sendQ; /* Outgoing message queue--if socket full */ - struct DBuf recvQ; /* Hold for data incoming yet to be parsed */ - unsigned int sendM; /* Statistics: protocol messages send */ - unsigned int sendK; /* Statistics: total k-bytes send */ - unsigned int receiveM; /* Statistics: protocol messages received */ - unsigned int receiveK; /* Statistics: total k-bytes received */ - unsigned short sendB; /* counters to count upto 1-k lots of bytes */ - unsigned short receiveB; /* sent and received. */ - struct Listener* listener; /* listening client which we accepted from */ - struct SLink* confs; /* Configuration record associated */ - HandlerType handler; /* message index into command table for parsing */ - struct DNSReply* dns_reply; /* DNS reply used during client registration */ - struct ListingArgs* listing; - unsigned int max_sendq; /* cached max send queue for client */ - unsigned int ping_freq; /* cached ping freq from client conf class */ - unsigned short lastsq; /* # 2k blocks when sendqueued called last */ - unsigned short port; /* and the remote port# too :-) */ - unsigned char targets[MAXTARGETS]; /* Hash values of current targets */ - char sock_ip[SOCKIPLEN + 1]; /* this is the ip address as a string */ - char sockhost[HOSTLEN + 1]; /* This is the host name from the socket and + int cli_fd; /* >= 0, for local clients */ + int cli_error; /* last socket level error for client */ + unsigned int cli_snomask; /* mask for server messages */ + time_t cli_nextnick; /* Next time a nick change is allowed */ + time_t cli_nexttarget; /* Next time a target change is allowed */ + unsigned int cli_cookie; /* Random number the user must PONG */ + struct MsgQ cli_sendQ; /* Outgoing message queue--if socket full */ + struct DBuf cli_recvQ; /* Hold for data incoming yet to be parsed */ + unsigned int cli_sendM; /* Statistics: protocol messages send */ + unsigned int cli_sendK; /* Statistics: total k-bytes send */ + unsigned int cli_receiveM; /* Statistics: protocol messages received */ + unsigned int cli_receiveK; /* Statistics: total k-bytes received */ + unsigned short cli_sendB; /* counters to count upto 1-k lots of bytes */ + unsigned short cli_receiveB; /* sent and received. */ + struct Listener* cli_listener; /* listening client which we accepted from */ + struct SLink* cli_confs; /* Configuration record associated */ + HandlerType cli_handler; /* message index into command table for parsing */ + struct DNSReply* cli_dns_reply; /* DNS reply used during client registration */ + struct ListingArgs* cli_listing; + unsigned int cli_max_sendq; /* cached max send queue for client */ + unsigned int cli_ping_freq; /* cached ping freq from client conf class */ + unsigned short cli_lastsq; /* # 2k blocks when sendqueued called last */ + unsigned short cli_port; /* and the remote port# too :-) */ + unsigned char cli_targets[MAXTARGETS]; /* Hash values of current targets */ + char cli_sock_ip[SOCKIPLEN + 1]; /* this is the ip address as a string */ + char cli_sockhost[HOSTLEN + 1]; /* This is the host name from the socket and after which the connection was accepted. */ - char passwd[PASSWDLEN + 1]; - char buffer[BUFSIZE]; /* Incoming message buffer; or the error that + char cli_passwd[PASSWDLEN + 1]; + char cli_buffer[BUFSIZE]; /* Incoming message buffer; or the error that caused this clients socket to be `dead' */ }; -#define cli_next(cli) ((cli)->next) -#define cli_prev(cli) ((cli)->prev) -#define cli_hnext(cli) ((cli)->hnext) -#define cli_from(cli) ((cli)->from) -#define cli_user(cli) ((cli)->user) -#define cli_serv(cli) ((cli)->serv) -#define cli_whowas(cli) ((cli)->whowas) -#define cli_yxx(cli) ((cli)->yxx) -#define cli_lasttime(cli) ((cli)->lasttime) -#define cli_since(cli) ((cli)->since) -#define cli_firsttime(cli) ((cli)->firsttime) -#define cli_lastnick(cli) ((cli)->lastnick) -#define cli_marker(cli) ((cli)->marker) -#define cli_flags(cli) ((cli)->flags) -#define cli_hopcount(cli) ((cli)->hopcount) -#define cli_ip(cli) ((cli)->ip) -#define cli_status(cli) ((cli)->status) -#define cli_local(cli) ((cli)->local) -#define cli_name(cli) ((cli)->name) -#define cli_username(cli) ((cli)->username) -#define cli_info(cli) ((cli)->info) - -#define cli_count(cli) ((cli)->count) -#define cli_fd(cli) ((cli)->fd) -#define cli_error(cli) ((cli)->error) -#define cli_snomask(cli) ((cli)->snomask) -#define cli_nextnick(cli) ((cli)->nextnick) -#define cli_nexttarget(cli) ((cli)->nexttarget) -#define cli_cookie(cli) ((cli)->cookie) -#define cli_sendQ(cli) ((cli)->sendQ) -#define cli_recvQ(cli) ((cli)->recvQ) -#define cli_sendM(cli) ((cli)->sendM) -#define cli_sendK(cli) ((cli)->sendK) -#define cli_receiveM(cli) ((cli)->receiveM) -#define cli_receiveK(cli) ((cli)->receiveK) -#define cli_sendB(cli) ((cli)->sendB) -#define cli_receiveB(cli) ((cli)->receiveB) -#define cli_listener(cli) ((cli)->listener) -#define cli_confs(cli) ((cli)->confs) -#define cli_handler(cli) ((cli)->handler) -#define cli_dns_reply(cli) ((cli)->dns_reply) -#define cli_listing(cli) ((cli)->listing) -#define cli_max_sendq(cli) ((cli)->max_sendq) -#define cli_ping_freq(cli) ((cli)->ping_freq) -#define cli_lastsq(cli) ((cli)->lastsq) -#define cli_port(cli) ((cli)->port) -#define cli_targets(cli) ((cli)->targets) -#define cli_sock_ip(cli) ((cli)->sock_ip) -#define cli_sockhost(cli) ((cli)->sockhost) -#define cli_passwd(cli) ((cli)->passwd) -#define cli_buffer(cli) ((cli)->buffer) +#define cli_next(cli) ((cli)->cli_next) +#define cli_prev(cli) ((cli)->cli_prev) +#define cli_hnext(cli) ((cli)->cli_hnext) +#define cli_from(cli) ((cli)->cli_from) +#define cli_user(cli) ((cli)->cli_user) +#define cli_serv(cli) ((cli)->cli_serv) +#define cli_whowas(cli) ((cli)->cli_whowas) +#define cli_yxx(cli) ((cli)->cli_yxx) +#define cli_lasttime(cli) ((cli)->cli_lasttime) +#define cli_since(cli) ((cli)->cli_since) +#define cli_firsttime(cli) ((cli)->cli_firsttime) +#define cli_lastnick(cli) ((cli)->cli_lastnick) +#define cli_marker(cli) ((cli)->cli_marker) +#define cli_flags(cli) ((cli)->cli_flags) +#define cli_hopcount(cli) ((cli)->cli_hopcount) +#define cli_ip(cli) ((cli)->cli_ip) +#define cli_status(cli) ((cli)->cli_status) +#define cli_local(cli) ((cli)->cli_local) +#define cli_name(cli) ((cli)->cli_name) +#define cli_username(cli) ((cli)->cli_username) +#define cli_info(cli) ((cli)->cli_info) + +#define cli_count(cli) ((cli)->cli_count) +#define cli_fd(cli) ((cli)->cli_fd) +#define cli_error(cli) ((cli)->cli_error) +#define cli_snomask(cli) ((cli)->cli_snomask) +#define cli_nextnick(cli) ((cli)->cli_nextnick) +#define cli_nexttarget(cli) ((cli)->cli_nexttarget) +#define cli_cookie(cli) ((cli)->cli_cookie) +#define cli_sendQ(cli) ((cli)->cli_sendQ) +#define cli_recvQ(cli) ((cli)->cli_recvQ) +#define cli_sendM(cli) ((cli)->cli_sendM) +#define cli_sendK(cli) ((cli)->cli_sendK) +#define cli_receiveM(cli) ((cli)->cli_receiveM) +#define cli_receiveK(cli) ((cli)->cli_receiveK) +#define cli_sendB(cli) ((cli)->cli_sendB) +#define cli_receiveB(cli) ((cli)->cli_receiveB) +#define cli_listener(cli) ((cli)->cli_listener) +#define cli_confs(cli) ((cli)->cli_confs) +#define cli_handler(cli) ((cli)->cli_handler) +#define cli_dns_reply(cli) ((cli)->cli_dns_reply) +#define cli_listing(cli) ((cli)->cli_listing) +#define cli_max_sendq(cli) ((cli)->cli_max_sendq) +#define cli_ping_freq(cli) ((cli)->cli_ping_freq) +#define cli_lastsq(cli) ((cli)->cli_lastsq) +#define cli_port(cli) ((cli)->cli_port) +#define cli_targets(cli) ((cli)->cli_targets) +#define cli_sock_ip(cli) ((cli)->cli_sock_ip) +#define cli_sockhost(cli) ((cli)->cli_sockhost) +#define cli_passwd(cli) ((cli)->cli_passwd) +#define cli_buffer(cli) ((cli)->cli_buffer) #define STAT_CONNECTING 0x001 /* connecting to another server */ #define STAT_HANDSHAKE 0x002 /* pass - server sent */ diff --git a/include/querycmds.h b/include/querycmds.h index 3052c1f..d982463 100644 --- a/include/querycmds.h +++ b/include/querycmds.h @@ -37,7 +37,7 @@ extern struct UserStatistics UserStats; */ /* Macros for remote connections: */ -#define Count_newremoteclient(UserStats, cptr) (++UserStats.clients, ++cptr->serv->clients) +#define Count_newremoteclient(UserStats, cptr) (++UserStats.clients, ++(cli_serv(cptr)->clients)) #define Count_newremoteserver(UserStats) (++UserStats.servers) #if 0 #define Count_remoteclientquits(UserStats) (--UserStats.clients) @@ -47,7 +47,7 @@ extern struct UserStatistics UserStats; do { \ --UserStats.clients; \ if (!IsServer(cptr)) \ - --cptr->user->server->serv->clients; \ + --(cli_serv(cli_user(cptr)->server)->clients); \ } while (0) #define Count_remoteserverquits(UserStats) (--UserStats.servers) @@ -57,7 +57,7 @@ extern struct UserStatistics UserStats; #define Count_unknownbecomesclient(cptr, UserStats) \ do { \ --UserStats.unknowns; ++UserStats.local_clients; ++UserStats.clients; \ - if (match("*" DOMAINNAME, cptr->sockhost) == 0) \ + if (match("*" DOMAINNAME, cli_sockhost(cptr)) == 0) \ ++current_load.local_count; \ if (UserStats.local_clients > max_client_count) \ max_client_count = UserStats.local_clients; \ @@ -74,7 +74,7 @@ extern struct UserStatistics UserStats; do \ { \ --UserStats.local_clients; --UserStats.clients; \ - if (match("*" DOMAINNAME, cptr->sockhost) == 0) \ + if (match("*" DOMAINNAME, cli_sockhost(cptr)) == 0) \ --current_load.local_count; \ } while(0) #define Count_serverdisconnects(UserStats) do { --UserStats.local_servers; --UserStats.servers; } while(0) diff --git a/ircd/IPcheck.c b/ircd/IPcheck.c index 439d60e..0fc2cac 100644 --- a/ircd/IPcheck.c +++ b/ircd/IPcheck.c @@ -550,7 +550,7 @@ void IPcheck_disconnect(struct Client *cptr) unsigned short IPcheck_nr(struct Client *cptr) { assert(0 != cptr); - return ip_registry_count(cptr->ip.s_addr); + return ip_registry_count(cli_ip(cptr).s_addr); } void IPcheck_expire() diff --git a/ircd/channel.c b/ircd/channel.c index bbedf15..68d7a86 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -611,7 +611,7 @@ void remove_user_from_all_channels(struct Client* cptr) { struct Membership* chan; assert(0 != cptr); - assert(0 != cptr->user); + assert(0 != cli_user(cptr)); while ((chan = (cli_user(cptr))->channel)) remove_user_from_channel(cptr, chan->channel); @@ -2127,7 +2127,7 @@ mode_parse_ban(struct ParseState *state, int *flag_p) newban->next = 0; DupString(newban->value.ban.banstr, t_str); - newban->value.ban.who = state->sptr->name; + newban->value.ban.who = cli_name(state->sptr); newban->value.ban.when = TStime(); newban->flags = CHFL_BAN | MODE_ADD; diff --git a/ircd/class.c b/ircd/class.c index 32c1feb..a3f855f 100644 --- a/ircd/class.c +++ b/ircd/class.c @@ -260,7 +260,7 @@ void report_classes(struct Client *sptr) unsigned int get_sendq(struct Client *cptr) { assert(0 != cptr); - assert(0 != cptr->local); + assert(0 != cli_local(cptr)); if (cli_max_sendq(cptr)) return cli_max_sendq(cptr); diff --git a/ircd/crule.c b/ircd/crule.c index d956ede..4607107 100644 --- a/ircd/crule.c +++ b/ircd/crule.c @@ -176,7 +176,7 @@ static int crule_connected(int numargs, void *crulearg[]) struct Client *acptr; /* taken from m_links */ - for (acptr = GlobalClientList; acptr; acptr = acptr->next) + for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) { if (!IsServer(acptr) && !IsMe(acptr)) continue; @@ -223,14 +223,14 @@ static int crule_via(int numargs, void *crulearg[]) struct Client *acptr; /* adapted from m_links */ - for (acptr = GlobalClientList; acptr; acptr = acptr->next) + for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) { if (!IsServer(acptr) && !IsMe(acptr)) continue; if (match((char *)crulearg[1], cli_name(acptr))) continue; if (match((char *)crulearg[0], - cli_name(LocalClientArray[(cli_from(acptr))->fd]))) + cli_name(LocalClientArray[cli_fd(cli_from(acptr))]))) continue; return (1); } diff --git a/ircd/gline.c b/ircd/gline.c index faa6547..565d711 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -168,7 +168,7 @@ do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline) if (!cli_user(acptr)) continue; - if (acptr->user->username && + if (cli_user(acptr)->username && match (gline->gl_user, (cli_user(acptr))->username) != 0) continue; @@ -178,7 +178,7 @@ do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline) continue; } else { - if (match(gline->gl_host, acptr->sockhost) != 0) + if (match(gline->gl_host, cli_sockhost(acptr)) != 0) continue; } diff --git a/ircd/hash.c b/ircd/hash.c index c3b58b5..8061a45 100644 --- a/ircd/hash.c +++ b/ircd/hash.c @@ -355,7 +355,7 @@ int hChangeClient(struct Client *cptr, const char *newname) assert(0 != cptr); hRemClient(cptr); - cptr->hnext = clientTable[newhash]; + cli_hnext(cptr) = clientTable[newhash]; clientTable[newhash] = cptr; return 0; } @@ -402,7 +402,7 @@ struct Client* hSeekClient(const char *name, int TMask) if (cptr) { if (0 == (cli_status(cptr) & TMask) || 0 != ircd_strcmp(name, cli_name(cptr))) { struct Client* prev; - while (prev = cptr, cptr = cptr->hnext) { + while (prev = cptr, cptr = cli_hnext(cptr)) { if ((cli_status(cptr) & TMask) && (0 == ircd_strcmp(name, cli_name(cptr)))) { cli_hnext(prev) = cli_hnext(cptr); cli_hnext(cptr) = clientTable[hashv]; diff --git a/ircd/m_admin.c b/ircd/m_admin.c index eb57816..839d714 100644 --- a/ircd/m_admin.c +++ b/ircd/m_admin.c @@ -113,7 +113,7 @@ int m_admin(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!(acptr = find_match_server(parv[1]))) return send_reply(sptr, ERR_NOSUCHSERVER, parv[1]); - parv[1] = acptr->name; + parv[1] = cli_name(acptr); if (hunt_server_cmd(sptr, CMD_ADMIN, cptr, 0, ":%C", 1, parc, parv) != HUNTED_ISME) return 0; } diff --git a/ircd/m_away.c b/ircd/m_away.c index 9595084..787e570 100644 --- a/ircd/m_away.c +++ b/ircd/m_away.c @@ -113,7 +113,7 @@ int m_away(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) assert(0 != cptr); assert(cptr == sptr); - if (user_set_away(sptr->user, away_message)) { + if (user_set_away(cli_user(sptr), away_message)) { sendcmdto_serv_butone(sptr, CMD_AWAY, cptr, ":%s", away_message); send_reply(sptr, RPL_NOWAWAY); } @@ -143,7 +143,7 @@ int ms_away(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsServer(sptr)) return protocol_violation(sptr,"Server trying to set itself away"); - if (user_set_away(sptr->user, away_message)) + if (user_set_away(cli_user(sptr), away_message)) sendcmdto_serv_butone(sptr, CMD_AWAY, cptr, ":%s", away_message); else sendcmdto_serv_butone(sptr, CMD_AWAY, cptr, ""); diff --git a/ircd/m_burst.c b/ircd/m_burst.c index faf51d3..f9a5969 100644 --- a/ircd/m_burst.c +++ b/ircd/m_burst.c @@ -155,7 +155,7 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) if (!IsBurst(sptr)) /* don't allow BURST outside of burst */ return exit_client_msg(cptr, cptr, &me, "HACK: BURST message outside " - "net.burst from %s", sptr->name); + "net.burst from %s", cli_name(sptr)); if (!(chptr = get_channel(sptr, parv[1], CGT_CREATE))) return 0; /* can't create the channel? */ @@ -245,7 +245,7 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) newban = make_link(); /* create new ban */ DupString(newban->value.ban.banstr, ban); - DupString(newban->value.ban.who, sptr->name); + DupString(newban->value.ban.who, cli_name(sptr)); newban->value.ban.when = TStime(); newban->flags = CHFL_BAN | CHFL_BURST_BAN; /* set flags */ @@ -289,7 +289,7 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) } } - if (!(acptr = findNUser(nick)) || acptr->from != cptr) + if (!(acptr = findNUser(nick)) || cli_from(acptr) != cptr) continue; /* ignore this client */ /* Build nick buffer */ diff --git a/ircd/m_connect.c b/ircd/m_connect.c index 094253e..0330e4f 100644 --- a/ircd/m_connect.c +++ b/ircd/m_connect.c @@ -159,7 +159,7 @@ int ms_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ if ((acptr = FindServer(aconf->name))) { sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: Server %s already " - "exists from %s", sptr, parv[1], acptr->from->name); + "exists from %s", sptr, parv[1], cli_name(cli_from(acptr))); return 0; } /* @@ -185,17 +185,6 @@ int ms_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * Allow opers to /connect foo.* 0 bah.* to connect foo and bah * using the conf's configured port */ -#if 0 - /* - * Get port number from params, port must be non-zero if it comes from a - * server. - */ - if ((port = atoi(parv[2])) == 0) { - sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: Invalid port number", - sptr); - return 0; - } -#endif port = atoi(parv[2]); /* * save the old port @@ -278,11 +267,11 @@ int mo_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * Look for closest matching server * needed for "/connect blah 4400 *"? */ - for (acptr2 = acptr3; acptr2 != &me; acptr2 = acptr2->serv->up) { - if (!match(parv[3], acptr2->name)) + for (acptr2 = acptr3; acptr2 != &me; acptr2 = cli_serv(acptr2)->up) { + if (!match(parv[3], cli_name(acptr2))) acptr3 = acptr2; } - parv[3] = acptr3->name; + parv[3] = cli_name(acptr3); if (hunt_server_cmd(sptr, CMD_CONNECT, cptr, 1, "%s %s :%C", 3, parc, parv) != HUNTED_ISME) return 0; @@ -303,7 +292,7 @@ int mo_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ if ((acptr = FindServer(aconf->name))) { sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: Server %s already " - "exists from %s", sptr, parv[1], acptr->from->name); + "exists from %s", sptr, parv[1], cli_name(cli_from(acptr))); return 0; } /* @@ -358,179 +347,3 @@ int mo_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) aconf->port = tmpport; return 0; } - - -#if 0 -/* - * XXX - remove when regression testing complete - * - * m_connect - Added by Jto 11 Feb 1989 - * - * parv[0] = sender prefix - * parv[1] = servername - * parv[2] = port number - * parv[3] = remote server - */ -int m_connect(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) -{ - unsigned short port; - unsigned short tmpport; - struct ConfItem* aconf; - struct ConfItem* cconf; - struct Client* acptr; - struct Jupe* ajupe; - const char* rule; - - if (!IsPrivileged(sptr)) { - sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); /* XXX DEAD */ - return -1; - } - - if (IsLocOp(sptr) && parc > 3) /* Only allow LocOps to make */ - return 0; /* local CONNECTS --SRB */ - - if (parc > 3 && MyUser(sptr)) { - struct Client* acptr2; - struct Client* acptr3; - if (!(acptr3 = find_match_server(parv[3]))) { - sendto_one(sptr, err_str(ERR_NOSUCHSERVER), me.name, parv[0], parv[3]); /* XXX DEAD */ - return 0; - } - - /* Look for closest matching server */ - for (acptr2 = acptr3; acptr2 != &me; acptr2 = acptr2->serv->up) - if (!match(parv[3], acptr2->name)) - acptr3 = acptr2; - - parv[3] = acptr3->name; - } - - if (hunt_server(1, cptr, sptr, /* XXX DEAD */ - "%s%s " TOK_CONNECT " %s %s :%s", 3, parc, parv) != HUNTED_ISME) - return 0; - - if (parc < 2 || *parv[1] == '\0') { - return need_more_params(sptr, "CONNECT"); -#if 0 - return -1; -#endif - } - - if ((acptr = FindServer(parv[1]))) { - if (MyUser(sptr)) - sendto_one(sptr, ":%s NOTICE %s :Connect: Server %s %s %s.", /* XXX DEAD */ - me.name, parv[0], parv[1], "already exists from", acptr->from->name); - else - sendto_one(sptr, "%s NOTICE %s%s :Connect: Server %s %s %s.", /* XXX DEAD */ - NumServ(&me), NumNick(sptr), parv[1], "already exists from", - acptr->from->name); - return 0; - } - - for (aconf = GlobalConfList; aconf; aconf = aconf->next) { - if (CONF_SERVER == aconf->status && 0 == match(parv[1], aconf->name)) - break; - } -#if 0 - /* - * Checked first servernames, then try hostnames. - */ - if (!aconf) { - for (aconf = GlobalConfList; aconf; aconf = aconf->next) { - if (CONF_SERVER == aconf->status && 0 == match(parv[1], aconf->host)) - break; - } - } -#endif - if (!aconf) { - if (MyUser(sptr)) - sendto_one(sptr, ":%s NOTICE %s :Connect: Host %s not listed in ircd.conf", /* XXX DEAD */ - me.name, parv[0], parv[1]); - else - sendto_one(sptr, "%s NOTICE %s%s :Connect: Host %s not listed in ircd.conf", /* XXX DEAD */ - NumServ(&me), NumNick(sptr), parv[1]); - return 0; - } - /* - * Get port number from user, if given. If not specified, - * use the default from configuration structure. If missing - * from there, then use the precompiled default. - */ - tmpport = port = aconf->port; - if (parc > 2 && !BadPtr(parv[2])) { - if ((port = atoi(parv[2])) == 0) { - if (MyUser(sptr)) - sendto_one(sptr, ":%s NOTICE %s :Connect: Invalid port number", me.name, parv[0]); /* XXX DEAD */ - else - sendto_one(sptr, "%s NOTICE %s%s :Connect: Invalid port number", /* XXX DEAD */ - NumServ(&me), NumNick(sptr)); - return 0; - } - } - else if (port == 0 && (port = PORTNUM) == 0) { - if (MyUser(sptr)) - sendto_one(sptr, ":%s NOTICE %s :Connect: missing port number", /* XXX DEAD */ - me.name, parv[0]); - else - sendto_one(sptr, "%s NOTICE %s%s :Connect: missing port number", /* XXX DEAD */ - NumServ(&me), NumNick(sptr)); - return 0; - } - - /* - * Evaluate connection rules... If no rules found, allow the - * connect. Otherwise stop with the first true rule (ie: rules - * are ored together. Oper connects are effected only by D - * lines (CRULEALL) not d lines (CRULEAUTO). - */ - if ((rule = conf_eval_crule(aconf->name, CRULE_ALL))) { - if (MyUser(sptr)) - sendto_one(sptr, ":%s NOTICE %s :Connect: Disallowed by rule: %s", /* XXX DEAD */ - me.name, parv[0], cconf->name); - else - sendto_one(sptr, "%s NOTICE %s%s :Connect: Disallowed by rule: %s", /* XXX DEAD */ - NumServ(&me), NumNick(sptr), cconf->name); - return 0; - } - /* - * Check to see if the server is juped; if it is, disallow the connect - */ - if ((ajupe = jupe_find(aconf->name)) && JupeIsActive(ajupe)) { - sendto_one(sptr, "%s NOTICE %s%s :Connect: Server %s is juped: %s", /* XXX DEAD */ - NumServ(&me), NumNick(sptr), JupeServer(ajupe), - JupeReason(ajupe)); - return 0; - } - - /* - * Notify all operators about remote connect requests - */ - if (!IsAnOper(cptr)) { - sendto_ops_butone(0, &me, ":%s WALLOPS :Remote CONNECT %s %s from %s", /* XXX DEAD */ - me.name, parv[1], parv[2] ? parv[2] : "", - get_client_name(sptr, HIDE_IP)); - ircd_log(L_INFO, "CONNECT From %s : %s %d", /* XXX DEAD */ - parv[0], parv[1], parv[2] ? parv[2] : ""); - } - aconf->port = port; - if (connect_server(aconf, sptr, 0)) { - if (MyUser(sptr)) - sendto_one(sptr, ":%s NOTICE %s :*** Connecting to %s.", /* XXX DEAD */ - me.name, parv[0], aconf->name); - else - sendto_one(sptr, "%s NOTICE %s%s :*** Connecting to %s.", /* XXX DEAD */ - NumServ(&me), NumNick(sptr), aconf->name); - } - else { - if (MyUser(sptr)) - sendto_one(sptr, ":%s NOTICE %s :*** Connection to %s failed", /* XXX DEAD */ - me.name, parv[0], aconf->name); - else - sendto_one(sptr, "%s NOTICE %s%s :*** Connection to %s failed", /* XXX DEAD */ - NumServ(&me), NumNick(sptr), aconf->name); - } - aconf->port = tmpport; - return 0; -} -#endif /* 0 */ - diff --git a/ircd/m_create.c b/ircd/m_create.c index 5313c2b..f413c29 100644 --- a/ircd/m_create.c +++ b/ircd/m_create.c @@ -120,7 +120,7 @@ int ms_create(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) int badop; /* a flag */ if (IsServer(sptr)) - return protocol_violation(sptr,"%s tried to CREATE a channel", sptr->name); + return protocol_violation(sptr,"%s tried to CREATE a channel", cli_name(sptr)); /* sanity checks: Only accept CREATE messages from servers */ if (parc < 3 || *parv[2] == '\0') @@ -136,7 +136,7 @@ int ms_create(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ if (!IsBurstOrBurstAck(sptr) && 0 != chanTS && MAGIC_REMOTE_JOIN_TS != chanTS) - sptr->user->server->serv->lag = TStime() - chanTS; + cli_serv(cli_user(sptr)->server)->lag = TStime() - chanTS; #if 1 /* If this server is >5 minutes fast, squit it */ @@ -147,7 +147,7 @@ int ms_create(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* If we recieve a CREATE for a channel from a server before that server * was linked, then it's a HACK */ - if (MyConnect(sptr) && chanTStimestamp+5*60*60) + if (MyConnect(sptr) && chanTS 1 && *parv[parc - 1] != '\0') ? parv[parc - 1] : "<>"; - Debug((DEBUG_ERROR, "Received ERROR message from %s: %s", sptr->name, para)); + Debug((DEBUG_ERROR, "Received ERROR message from %s: %s", cli_name(sptr), para)); if (cptr == sptr) sendto_opmask_butone(0, SNO_OLDSNO, "ERROR :from %C -- %s", cptr, para); @@ -122,10 +122,10 @@ int ms_error(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) sendto_opmask_butone(0, SNO_OLDSNO, "ERROR :from %C via %C -- %s", sptr, cptr, para); - if (sptr->serv) + if (cli_serv(sptr)) { - MyFree(sptr->serv->last_error_msg); - DupString(sptr->serv->last_error_msg, para); + MyFree(cli_serv(sptr)->last_error_msg); + DupString(cli_serv(sptr)->last_error_msg, para); } return 0; diff --git a/ircd/m_gline.c b/ircd/m_gline.c index bddf451..7f01f9b 100644 --- a/ircd/m_gline.c +++ b/ircd/m_gline.c @@ -134,7 +134,7 @@ ms_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) char *mask = parv[2], *target = parv[1], *reason; if ((parc == 3 && *mask == '-') || parc == 5) { - if (!find_conf_byhost(cptr->confs, sptr->name, CONF_UWORLD)) + if (!find_conf_byhost(cli_confs(cptr), cli_name(sptr), CONF_UWORLD)) return need_more_params(sptr, "GLINE"); reason = parv[4]; diff --git a/ircd/m_info.c b/ircd/m_info.c index 3fe6a26..ea3db75 100644 --- a/ircd/m_info.c +++ b/ircd/m_info.c @@ -129,7 +129,7 @@ int m_info(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s", creation, generation); send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s", - myctime(me.firsttime)); + myctime(cli_firsttime(&me))); send_reply(sptr, RPL_ENDOFINFO); } return 0; @@ -166,7 +166,7 @@ int ms_info(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s", creation, generation); send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s", - myctime(me.firsttime)); + myctime(cli_firsttime(&me))); send_reply(sptr, RPL_ENDOFINFO); } return 0; @@ -200,7 +200,7 @@ int mo_info(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s", creation, generation); send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s", - myctime(me.firsttime)); + myctime(cli_firsttime(&me))); send_reply(sptr, RPL_ENDOFINFO); } return 0; diff --git a/ircd/m_invite.c b/ircd/m_invite.c index af90a34..6950552 100644 --- a/ircd/m_invite.c +++ b/ircd/m_invite.c @@ -129,7 +129,7 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * list the channels you have an invite to. */ struct SLink *lp; - for (lp = sptr->user->invited; lp; lp = lp->next) + for (lp = cli_user(sptr)->invited; lp; lp = lp->next) send_reply(cptr, RPL_INVITELIST, lp->value.chptr->chname); send_reply(cptr, RPL_ENDOFINVITELIST); return 0; @@ -160,15 +160,15 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* Do not disallow to invite to non-existant #channels, otherwise they would simply first be created, causing only MORE bandwidth usage. */ - if (check_target_limit(sptr, acptr, acptr->name, 0)) + if (check_target_limit(sptr, acptr, cli_name(acptr), 0)) return 0; - send_reply(sptr, RPL_INVITING, acptr->name, parv[2]); + send_reply(sptr, RPL_INVITING, cli_name(acptr), parv[2]); - if (acptr->user->away) - send_reply(sptr, RPL_AWAY, acptr->name, acptr->user->away); + if (cli_user(acptr)->away) + send_reply(sptr, RPL_AWAY, cli_name(acptr), cli_user(acptr)->away); - sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%s", acptr->name, parv[2]); + sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%s", cli_name(acptr), parv[2]); return 0; } @@ -179,7 +179,7 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) } if (find_channel_member(acptr, chptr)) { - send_reply(sptr, ERR_USERONCHANNEL, acptr->name, chptr->chname); + send_reply(sptr, ERR_USERONCHANNEL, cli_name(acptr), chptr->chname); return 0; } @@ -190,18 +190,18 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* If we get here, it was a VALID and meaningful INVITE */ - if (check_target_limit(sptr, acptr, acptr->name, 0)) + if (check_target_limit(sptr, acptr, cli_name(acptr), 0)) return 0; - send_reply(sptr, RPL_INVITING, acptr->name, chptr->chname); + send_reply(sptr, RPL_INVITING, cli_name(acptr), chptr->chname); - if (acptr->user->away) - send_reply(sptr, RPL_AWAY, acptr->name, acptr->user->away); + if (cli_user(acptr)->away) + send_reply(sptr, RPL_AWAY, cli_name(acptr), cli_user(acptr)->away); if (MyConnect(acptr)) add_invite(acptr, chptr); - sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", acptr->name, chptr); + sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr); return 0; } @@ -254,7 +254,7 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* * just relay the message */ - sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%s", acptr->name, parv[2]); + sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%s", cli_name(acptr), parv[2]); return 0; } @@ -275,11 +275,11 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return 0; } if (find_channel_member(acptr, chptr)) { - send_reply(sptr, ERR_USERONCHANNEL, acptr->name, chptr->chname); + send_reply(sptr, ERR_USERONCHANNEL, cli_name(acptr), chptr->chname); return 0; } add_invite(acptr, chptr); - sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", acptr->name, chptr); + sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr); return 0; } diff --git a/ircd/m_ison.c b/ircd/m_ison.c index 2b6852b..bf9779f 100644 --- a/ircd/m_ison.c +++ b/ircd/m_ison.c @@ -124,17 +124,17 @@ int m_ison(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) if (parc < 2) return need_more_params(sptr, "ISON"); - mb = msgq_make(sptr, rpl_str(RPL_ISON), me.name, sptr->name); + mb = msgq_make(sptr, rpl_str(RPL_ISON), cli_name(&me), cli_name(sptr)); for (name = ircd_strtok(&p, parv[1], " "); name; name = ircd_strtok(&p, 0, " ")) { if ((acptr = FindUser(name))) { - if (msgq_bufleft(mb) < strlen(acptr->name) + 1) { + if (msgq_bufleft(mb) < strlen(cli_name(acptr)) + 1) { send_buffer(sptr, mb, 0); /* send partial response */ msgq_clean(mb); /* then do another round */ - mb = msgq_make(sptr, rpl_str(RPL_ISON), me.name, sptr->name); + mb = msgq_make(sptr, rpl_str(RPL_ISON), cli_name(&me), cli_name(sptr)); } - msgq_append(0, mb, "%s ", acptr->name); /* append nickname */ + msgq_append(0, mb, "%s ", cli_name(acptr)); /* append nickname */ } } @@ -143,5 +143,3 @@ int m_ison(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) return 0; } - - diff --git a/ircd/m_join.c b/ircd/m_join.c index 8908bdf..051216e 100644 --- a/ircd/m_join.c +++ b/ircd/m_join.c @@ -106,10 +106,6 @@ #include #include -#if !defined(XXX_BOGUS_TEMP_HACK) -#include "handlers.h" /* m_names */ -#endif - /* * Helper function to find last 0 in a comma-separated list of * channel names. @@ -159,7 +155,7 @@ join0(struct JoinBuf *join, struct Client *cptr, struct Client *sptr, joinbuf_init(&part, sptr, cptr, JOINBUF_TYPE_PARTALL, "Left all channels", 0); - while ((member = sptr->user->channel)) + while ((member = cli_user(sptr)->channel)) joinbuf_join(&part, member->channel, IsZombie(member) ? CHFL_ZOMBIE : 0); @@ -196,8 +192,6 @@ int m_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) keys = parv[2]; /* remember where keys are */ - parv[2] = 0; /* for call to m_names below */ - for (name = ircd_strtok(&p, chanlist, ","); name; name = ircd_strtok(&p, 0, ",")) { clean_channelname(name); @@ -227,7 +221,7 @@ int m_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) } else flags = IsModelessChannel(name) ? CHFL_DEOPPED : CHFL_CHANOP; - if (sptr->user->joined >= MAXCHANNELSPERUSER + if (cli_user(sptr)->joined >= MAXCHANNELSPERUSER #ifdef OPER_NO_CHAN_LIMIT /* Opers are allowed to join any number of channels */ && !IsAnOper(sptr) @@ -316,7 +310,7 @@ int ms_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) char *name; if (IsServer(sptr)) { - return protocol_violation(sptr,"%s tried to JOIN a channel, duh!", sptr->name); + return protocol_violation(sptr,"%s tried to JOIN a channel, duh!", cli_name(sptr)); } if (parc < 2 || *parv[1] == '\0') @@ -348,9 +342,9 @@ int ms_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) remove_user_from_channel(sptr, chptr); chptr = FindChannel(name); } else - flags = CHFL_DEOPPED | ((sptr->flags & FLAGS_TS8) ? CHFL_SERVOPOK : 0); + flags = CHFL_DEOPPED | ((cli_flags(sptr) & FLAGS_TS8) ? CHFL_SERVOPOK : 0); } else { - flags = CHFL_DEOPPED | ((sptr->flags & FLAGS_TS8) ? CHFL_SERVOPOK : 0); + flags = CHFL_DEOPPED | ((cli_flags(sptr) & FLAGS_TS8) ? CHFL_SERVOPOK : 0); if ((chptr = get_channel(sptr, name, CGT_CREATE))) chptr->creationtime = creation ? creation : MAGIC_REMOTE_JOIN_TS; diff --git a/ircd/m_kick.c b/ircd/m_kick.c index f5a488a..4703216 100644 --- a/ircd/m_kick.c +++ b/ircd/m_kick.c @@ -115,7 +115,7 @@ int m_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) struct Membership *member = 0; char *name, *comment; - sptr->flags &= ~FLAGS_TS8; + cli_flags(sptr) &= ~FLAGS_TS8; if (parc < 3 || *parv[1] == '\0') return need_more_params(sptr, "KICK"); @@ -134,17 +134,17 @@ int m_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) /* Don't allow the channel service to be kicked */ if (IsChannelService(who)) - return send_reply(sptr, ERR_ISCHANSERVICE, who->name, chptr->chname); + return send_reply(sptr, ERR_ISCHANSERVICE, cli_name(who), chptr->chname); #ifdef NO_OPER_DEOP_LCHAN /* Prevent kicking opers from local channels -DM- */ if (IsOperOnLocalChannel(who, chptr->chname)) - return send_reply(sptr, ERR_ISOPERLCHAN, who->name, chptr->chname); + return send_reply(sptr, ERR_ISOPERLCHAN, cli_name(who), chptr->chname); #endif /* check if kicked user is actually on the channel */ if (!(member = find_member_link(chptr, who)) || IsZombie(member)) - return send_reply(sptr, ERR_USERNOTINCHANNEL, who->name, chptr->chname); + return send_reply(sptr, ERR_USERNOTINCHANNEL, cli_name(who), chptr->chname); /* We rely on ircd_snprintf to truncate the comment */ comment = EmptyString(parv[parc - 1]) ? parv[0] : parv[parc - 1]; @@ -176,7 +176,7 @@ int ms_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) struct Membership *member = 0, *sptr_link = 0; char *name, *comment; - sptr->flags &= ~FLAGS_TS8; + cli_flags(sptr) &= ~FLAGS_TS8; if (parc < 3 || *parv[1] == '\0') return need_more_params(sptr, "KICK"); @@ -203,7 +203,7 @@ int ms_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) * here), if kicker is not on channel, or if kicker is not a channel * operator, bounce the kick */ - if (!IsServer(sptr) && member && who->from != cptr && + if (!IsServer(sptr) && member && cli_from(who) != cptr && (!(sptr_link = find_member_link(chptr, sptr)) || !IsChanOp(sptr_link))) { sendto_opmask_butone(0, SNO_HACK2, "HACK: %C KICK %H %C %s", sptr, chptr, who, comment); diff --git a/ircd/m_kill.c b/ircd/m_kill.c index 49fc718..dd5b36a 100644 --- a/ircd/m_kill.c +++ b/ircd/m_kill.c @@ -141,26 +141,7 @@ int ms_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) "before I got him :(", sptr); return 0; } -#if 0 - /* - * XXX - strictly speaking, the next 2 checks shouldn't be needed - * this function only handles kills from servers, and the check - * is done before the message is propagated --Bleep - */ - if (IsServer(victim) || IsMe(victim)) { - return send_error_to_client(sptr, ERR_CANTKILLSERVER); /* XXX DEAD */ - return 0; - } - if (IsLocOp(sptr) && !MyConnect(victim)) { - return send_error_to_client(sptr, ERR_NOPRIVILEGES); /* XXX DEAD */ - return 0; - } - /* - * XXX - this is guaranteed by the parser not to happen - */ - if (EmptyString(path)) - path = "*no-path*"; /* Bogus server sending??? */ -#endif + /* * Notify all *local* opers about the KILL (this includes the one * originating the kill, if from this server--the special numeric @@ -169,19 +150,19 @@ int ms_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * Note: "victim->name" is used instead of "user" because we may * have changed the target because of the nickname change. */ - inpath = cptr->name; + inpath = cli_name(cptr); sendto_opmask_butone(0, IsServer(sptr) ? SNO_SERVKILL : SNO_OPERKILL, "Received KILL message for %s. From %s Path: %C!%s", get_client_name(victim,SHOW_IP), parv[0], cptr, path); - log_write_kill(victim, sptr, cptr->name, path); + log_write_kill(victim, sptr, cli_name(cptr), path); /* * And pass on the message to other servers. Note, that if KILL * was changed, the message has to be sent to all links, also * back. */ - sendcmdto_serv_butone(sptr, CMD_KILL, cptr, "%C :%s!%s", victim, cptr->name, + sendcmdto_serv_butone(sptr, CMD_KILL, cptr, "%C :%s!%s", victim, cli_name(cptr), path); /* * We *can* have crossed a NICK with this numeric... --Run @@ -201,13 +182,13 @@ int ms_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ if (MyConnect(victim)) sendcmdto_one(&me, CMD_KILL, cptr, "%C :%s!%s (Ghost 5 Numeric Collided)", - victim, cptr->name, path); + victim, cli_name(cptr), path); /* * Set FLAGS_KILLED. This prevents exit_one_client from sending * the unnecessary QUIT for this. (This flag should never be * set in any other place) */ - victim->flags |= FLAGS_KILLED; + cli_flags(victim) |= FLAGS_KILLED; /* * Tell the victim she/he has been zapped, but *only* if @@ -279,7 +260,7 @@ int mo_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return send_reply(sptr, ERR_NOSUCHNICK, user); sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Changed KILL %s into %s", sptr, - user, victim->name); + user, cli_name(victim)); } if (!MyConnect(victim) && IsLocOp(cptr)) return send_reply(sptr, ERR_NOPRIVILEGES); @@ -291,13 +272,13 @@ int mo_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * if the user is +k, prevent a kill from local user */ if (IsChannelService(victim)) - return send_reply(sptr, ERR_ISCHANSERVICE, "KILL", victim->name); + return send_reply(sptr, ERR_ISCHANSERVICE, "KILL", cli_name(victim)); #ifdef LOCAL_KILL_ONLY if (!MyConnect(victim)) { sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Nick %s isnt on your server", sptr, - victim->name); + cli_name(victim)); return 0; } #endif @@ -315,10 +296,10 @@ int mo_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (strlen(comment) > TOPICLEN) comment[TOPICLEN] = '\0'; - inpath = sptr->user->host; + inpath = cli_user(sptr)->host; sprintf_irc(buf, - "%s%s (%s)", cptr->name, IsOper(sptr) ? "" : "(L)", comment); + "%s%s (%s)", cli_name(cptr), IsOper(sptr) ? "" : "(L)", comment); path = buf; /* @@ -349,9 +330,9 @@ int mo_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * the unnecessary QUIT for this. (This flag should never be * set in any other place) */ - victim->flags |= FLAGS_KILLED; + cli_flags(victim) |= FLAGS_KILLED; - sprintf_irc(buf, "Killed by %s (%s)", sptr->name, comment); + sprintf_irc(buf, "Killed by %s (%s)", cli_name(sptr), comment); } else { /* @@ -361,7 +342,7 @@ int mo_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * anyway (as this user don't exist there any more either) */ sendcmdto_one(sptr, CMD_KILL, victim, "%C :%s!%s", victim, inpath, path); - sprintf_irc(buf, "Local kill by %s (%s)", sptr->name, comment); + sprintf_irc(buf, "Local kill by %s (%s)", cli_name(sptr), comment); } return exit_client(cptr, victim, sptr, buf); diff --git a/ircd/m_links.c b/ircd/m_links.c index 60b3d04..cea4270 100644 --- a/ircd/m_links.c +++ b/ircd/m_links.c @@ -128,20 +128,15 @@ int m_links(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) else mask = parc < 2 ? 0 : parv[1]; - for (acptr = GlobalClientList, collapse(mask); acptr; acptr = acptr->next) + for (acptr = GlobalClientList, collapse(mask); acptr; acptr = cli_next(acptr)) { if (!IsServer(acptr) && !IsMe(acptr)) continue; - if (!BadPtr(mask) && match(mask, acptr->name)) + if (!BadPtr(mask) && match(mask, cli_name(acptr))) continue; - send_reply(sptr, RPL_LINKS, acptr->name, acptr->serv->up->name, -#ifndef GODMODE - acptr->hopcount, acptr->serv->prot, -#else /* GODMODE */ - acptr->hopcount, acptr->serv->prot, acptr->serv->timestamp, - NumServ(acptr), -#endif /* GODMODE */ - (acptr->info[0] ? acptr->info : "(Unknown Location)")); + send_reply(sptr, RPL_LINKS, cli_name(acptr), cli_name(cli_serv(acptr)->up), + cli_hopcount(acptr), cli_serv(acptr)->prot, + ((cli_info(acptr))[0] ? cli_info(acptr) : "(Unknown Location)")); } send_reply(sptr, RPL_ENDOFLINKS, BadPtr(mask) ? "*" : mask); @@ -175,20 +170,15 @@ int ms_links(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) else mask = parc < 2 ? 0 : parv[1]; - for (acptr = GlobalClientList, collapse(mask); acptr; acptr = acptr->next) + for (acptr = GlobalClientList, collapse(mask); acptr; acptr = cli_next(acptr)) { if (!IsServer(acptr) && !IsMe(acptr)) continue; - if (!BadPtr(mask) && match(mask, acptr->name)) + if (!BadPtr(mask) && match(mask, cli_name(acptr))) continue; - send_reply(sptr, RPL_LINKS, acptr->name, acptr->serv->up->name, -#ifndef GODMODE - acptr->hopcount, acptr->serv->prot, -#else /* GODMODE */ - acptr->hopcount, acptr->serv->prot, acptr->serv->timestamp, - NumServ(acptr), -#endif /* GODMODE */ - (acptr->info[0] ? acptr->info : "(Unknown Location)")); + send_reply(sptr, RPL_LINKS, cli_name(acptr), cli_name(cli_serv(acptr)->up), + cli_hopcount(acptr), cli_serv(acptr)->prot, + ((cli_info(acptr))[0] ? cli_info(acptr) : "(Unknown Location)")); } send_reply(sptr, RPL_ENDOFLINKS, BadPtr(mask) ? "*" : mask); diff --git a/ircd/m_list.c b/ircd/m_list.c index 92145e2..1a7db90 100644 --- a/ircd/m_list.c +++ b/ircd/m_list.c @@ -127,11 +127,11 @@ int m_list(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) 0 /* chptr */ }; - if (sptr->listing) /* Already listing ? */ + if (cli_listing(sptr)) /* Already listing ? */ { - sptr->listing->chptr->mode.mode &= ~MODE_LISTED; - MyFree(sptr->listing); - sptr->listing = 0; + cli_listing(sptr)->chptr->mode.mode &= ~MODE_LISTED; + MyFree(cli_listing(sptr)); + cli_listing(sptr) = 0; send_reply(sptr, RPL_LISTEND); if (parc < 2) return 0; /* Let LIST abort a listing. */ @@ -297,17 +297,17 @@ int m_list(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (args.max_users > args.min_users + 1 && args.max_time > args.min_time && args.max_topic_time > args.min_topic_time) /* Sanity check */ { - sptr->listing = (struct ListingArgs*) MyMalloc(sizeof(struct ListingArgs)); - assert(0 != sptr->listing); - memcpy(sptr->listing, &args, sizeof(struct ListingArgs)); - if ((sptr->listing->chptr = GlobalChannelList)) { + cli_listing(sptr) = (struct ListingArgs*) MyMalloc(sizeof(struct ListingArgs)); + assert(0 != cli_listing(sptr)); + memcpy(cli_listing(sptr), &args, sizeof(struct ListingArgs)); + if ((cli_listing(sptr)->chptr = GlobalChannelList)) { int m = GlobalChannelList->mode.mode & MODE_LISTED; list_next_channels(sptr, 64); GlobalChannelList->mode.mode |= m; return 0; } - MyFree(sptr->listing); - sptr->listing = 0; + MyFree(cli_listing(sptr)); + cli_listing(sptr) = 0; } send_reply(sptr, RPL_LISTEND); return 0; @@ -316,7 +316,7 @@ int m_list(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) for (; (name = ircd_strtok(&p, parv[1], ",")); parv[1] = 0) { chptr = FindChannel(name); - if (chptr && ShowChannel(sptr, chptr) && sptr->user) + if (chptr && ShowChannel(sptr, chptr) && cli_user(sptr)) send_reply(sptr, RPL_LIST, chptr->chname, chptr->users - number_of_zombies(chptr), chptr->topic); } diff --git a/ircd/m_map.c b/ircd/m_map.c index 77192e9..f7d76ce 100644 --- a/ircd/m_map.c +++ b/ircd/m_map.c @@ -112,19 +112,19 @@ static void dump_map(struct Client *cptr, struct Client *server, char *mask, int *p = '\0'; if (prompt_length > 60) - send_reply(cptr, RPL_MAPMORE, prompt, server->name); + send_reply(cptr, RPL_MAPMORE, prompt, cli_name(server)); else { char lag[512]; - if (server->serv->lag>10000) + if (cli_serv(server)->lag>10000) lag[0]=0; - else if (server->serv->lag<0) + else if (cli_serv(server)->lag<0) strcpy(lag,"(0s)"); else - sprintf(lag,"(%is)",server->serv->lag); + sprintf(lag,"(%is)",cli_serv(server)->lag); send_reply(cptr, RPL_MAP, prompt, ( (IsBurst(server)) ? "*" : (IsBurstAck(server) ? "!" : "")), - server->name, lag, (server == &me) ? UserStats.local_clients : - server->serv->clients); + cli_name(server), lag, (server == &me) ? UserStats.local_clients : + cli_serv(server)->clients); } if (prompt_length > 0) { @@ -135,17 +135,17 @@ static void dump_map(struct Client *cptr, struct Client *server, char *mask, int if (prompt_length > 60) return; strcpy(p, "|-"); - for (lp = server->serv->down; lp; lp = lp->next) - if (match(mask, lp->value.cptr->name)) - lp->value.cptr->flags &= ~FLAGS_MAP; + for (lp = cli_serv(server)->down; lp; lp = lp->next) + if (match(mask, cli_name(lp->value.cptr))) + cli_flags(lp->value.cptr) &= ~FLAGS_MAP; else { - lp->value.cptr->flags |= FLAGS_MAP; + cli_flags(lp->value.cptr) |= FLAGS_MAP; cnt++; } - for (lp = server->serv->down; lp; lp = lp->next) + for (lp = cli_serv(server)->down; lp; lp = lp->next) { - if ((lp->value.cptr->flags & FLAGS_MAP) == 0) + if ((cli_flags(lp->value.cptr) & FLAGS_MAP) == 0) continue; if (--cnt == 0) *p = '`'; diff --git a/ircd/m_mode.c b/ircd/m_mode.c index eaa5f19..54abb04 100644 --- a/ircd/m_mode.c +++ b/ircd/m_mode.c @@ -114,7 +114,7 @@ m_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) !(chptr = FindChannel(parv[1]))) return set_user_mode(cptr, sptr, parc, parv); - sptr->flags &= ~FLAGS_TS8; + cli_flags(sptr) &= ~FLAGS_TS8; if (parc < 3) { char modebuf[MODEBUFLEN]; @@ -168,10 +168,10 @@ ms_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) if (('#' != *parv[1] && '+' != *parv[1])|| !(chptr = FindChannel(parv[1]))) return set_user_mode(cptr, sptr, parc, parv); - sptr->flags &= ~FLAGS_TS8; + cli_flags(sptr) &= ~FLAGS_TS8; if (IsServer(sptr)) { - if (find_conf_byhost(cptr->confs, sptr->name, CONF_UWORLD)) + if (find_conf_byhost(cli_confs(cptr), cli_name(sptr), CONF_UWORLD)) modebuf_init(&mbuf, sptr, cptr, chptr, (MODEBUF_DEST_CHANNEL | /* Send mode to clients */ MODEBUF_DEST_SERVER | /* Send mode to servers */ diff --git a/ircd/m_names.c b/ircd/m_names.c index c04cf5c..f36a767 100644 --- a/ircd/m_names.c +++ b/ircd/m_names.c @@ -149,7 +149,7 @@ void do_names(struct Client* sptr, struct Channel* chptr, int filter) /* Iterate over all channel members, and build up the list. */ - mlen = strlen(me.name) + 10 + strlen(sptr->name); + mlen = strlen(cli_name(&me)) + 10 + strlen(cli_name(sptr)); for (member = chptr->members; member; member = member->next_member) { @@ -181,8 +181,8 @@ void do_names(struct Client* sptr, struct Channel* chptr, int filter) strcat(buf, "+"); idx++; } - strcat(buf, c2ptr->name); - idx += strlen(c2ptr->name) + 1; + strcat(buf, cli_name(c2ptr)); + idx += strlen(cli_name(c2ptr)) + 1; flag = 1; if (mlen + idx + NICKLEN + 5 > BUFSIZE) /* space, modifier, nick, \r \n \0 */ @@ -251,7 +251,7 @@ int m_names(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) struct Channel *ch3ptr; char buf[BUFSIZE]; - mlen = strlen(me.name) + 10 + strlen(sptr->name); + mlen = strlen(cli_name(&me)) + 10 + strlen(cli_name(sptr)); /* List all visible channels/visible members */ @@ -274,14 +274,14 @@ int m_names(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) idx = 5; flag = 0; - for (c2ptr = GlobalClientList; c2ptr; c2ptr = c2ptr->next) + for (c2ptr = GlobalClientList; c2ptr; c2ptr = cli_next(c2ptr)) { int showflag = 0; if (!IsUser(c2ptr) || (sptr != c2ptr && IsInvisible(c2ptr))) continue; - member = c2ptr->user->channel; + member = cli_user(c2ptr)->channel; while (member) { @@ -296,9 +296,9 @@ int m_names(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (showflag) /* Have we already shown them? */ continue; - strcat(buf, c2ptr->name); + strcat(buf, cli_name(c2ptr)); strcat(buf, " "); - idx += strlen(c2ptr->name) + 1; + idx += strlen(cli_name(c2ptr)) + 1; flag = 1; if (mlen + idx + NICKLEN + 3 > BUFSIZE) /* space, \r\n\0 */ @@ -392,7 +392,7 @@ int ms_names(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) struct Channel *ch3ptr; char buf[BUFSIZE]; - mlen = strlen(me.name) + 10 + strlen(sptr->name); + mlen = strlen(cli_name(&me)) + 10 + strlen(cli_name(sptr)); /* List all visible channels/visible members */ @@ -415,14 +415,14 @@ int ms_names(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) idx = 5; flag = 0; - for (c2ptr = GlobalClientList; c2ptr; c2ptr = c2ptr->next) + for (c2ptr = GlobalClientList; c2ptr; c2ptr = cli_next(c2ptr)) { int showflag = 0; if (!IsUser(c2ptr) || (sptr != c2ptr && IsInvisible(c2ptr))) continue; - member = c2ptr->user->channel; + member = cli_user(c2ptr)->channel; while (member) { @@ -437,9 +437,9 @@ int ms_names(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (showflag) /* Have we already shown them? */ continue; - strcat(buf, c2ptr->name); + strcat(buf, cli_name(c2ptr)); strcat(buf, " "); - idx += strlen(c2ptr->name) + 1; + idx += strlen(cli_name(c2ptr)) + 1; flag = 1; if (mlen + idx + NICKLEN + 3 > BUFSIZE) /* space, \r\n\0 */ diff --git a/ircd/m_nick.c b/ircd/m_nick.c index 2f5eda7..3f37708 100644 --- a/ircd/m_nick.c +++ b/ircd/m_nick.c @@ -125,7 +125,7 @@ int m_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* * parv[0] will be empty for clients connecting for the first time */ - client_name = (*sptr->name) ? sptr->name : "*"; + client_name = (*(cli_name(sptr))) ? cli_name(sptr) : "*"; if (parc < 2) { send_reply(sptr, ERR_NONICKNAMEGIVEN); @@ -187,7 +187,7 @@ int m_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * is concerned (user is changing the case of his/her * nickname or somesuch) */ - if (0 != strcmp(acptr->name, nick)) { + if (0 != strcmp(cli_name(acptr), nick)) { /* * Allows change of case in his/her nick */ @@ -217,7 +217,7 @@ int m_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ if (IsUnknown(acptr) && MyConnect(acptr)) { ++ServerStats->is_ref; - IPcheck_connect_fail(acptr->ip); + IPcheck_connect_fail(cli_ip(acptr)); exit_client(cptr, acptr, &me, "Overridden by other sign on"); return set_nick_name(cptr, sptr, nick, parc, parv); } @@ -273,12 +273,12 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsServer(sptr)) { lastnick = atoi(parv[3]); if (lastnick > OLDEST_TS && !IsBurstOrBurstAck(sptr)) - sptr->serv->lag = TStime() - lastnick; + cli_serv(sptr)->lag = TStime() - lastnick; } else { lastnick = atoi(parv[2]); if (lastnick > OLDEST_TS && !IsBurstOrBurstAck(sptr)) - sptr->user->server->serv->lag = TStime() - lastnick; + cli_serv(cli_user(sptr)->server)->lag = TStime() - lastnick; } /* * If do_nick_name() returns a null name OR if the server sent a nick @@ -293,17 +293,17 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) sendto_opmask_butone(0, SNO_OLDSNO, "Bad Nick: %s From: %s %C", parv[1], parv[0], cptr); sendcmdto_one(&me, CMD_KILL, cptr, "%s :%s (%s <- %s[%s])", - IsServer(sptr) ? parv[parc - 2] : parv[0], me.name, parv[1], - nick, cptr->name); + IsServer(sptr) ? parv[parc - 2] : parv[0], cli_name(&me), parv[1], + nick, cli_name(cptr)); if (!IsServer(sptr)) { /* * bad nick _change_ */ sendcmdto_serv_butone(&me, CMD_KILL, 0, "%s :%s (%s <- %s!%s@%s)", - parv[0], me.name, cptr->name, parv[0], - sptr->user ? sptr->username : "", - sptr->user ? sptr->user->server->name : - cptr->name); + parv[0], cli_name(&me), cli_name(cptr), parv[0], + cli_user(sptr) ? cli_username(sptr) : "", + cli_user(sptr) ? cli_name(cli_user(sptr)->server) : + cli_name(cptr)); } return 0; } @@ -334,13 +334,13 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * Ultimate way to jupiter a nick ? >;-). -avalon */ sendto_opmask_butone(0, SNO_OLDSNO, "Nick collision on %C(%C <- %C)", sptr, - acptr->from, cptr); + cli_from(acptr), cptr); ++ServerStats->is_kill; - sendcmdto_one(&me, CMD_KILL, cptr, "%C :%s (%s <- %s)", sptr, me.name, - acptr->from->name, cptr->name); + sendcmdto_one(&me, CMD_KILL, cptr, "%C :%s (%s <- %s)", sptr, cli_name(&me), + cli_name(cli_from(acptr)), cli_name(cptr)); - sptr->flags |= FLAGS_KILLED; + cli_flags(sptr) |= FLAGS_KILLED; /* * if sptr is a server it is exited here, nothing else to do */ @@ -354,7 +354,7 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * nickname or somesuch) */ if (acptr == sptr) { - if (strcmp(acptr->name, nick) != 0) + if (strcmp(cli_name(acptr), nick) != 0) /* * Allows change of case in his/her nick */ @@ -383,7 +383,7 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ if (IsUnknown(acptr) && MyConnect(acptr)) { ++ServerStats->is_ref; - IPcheck_connect_fail(acptr->ip); + IPcheck_connect_fail(cli_ip(acptr)); exit_client(cptr, acptr, &me, "Overridden by other sign on"); return set_nick_name(cptr, sptr, nick, parc, parv); } @@ -412,11 +412,11 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * * compare IP address and username */ - differ = (acptr->ip.s_addr != htonl(base64toint(parv[parc - 3]))) || - (0 != ircd_strcmp(acptr->user->username, parv[4])); + differ = (cli_ip(acptr).s_addr != htonl(base64toint(parv[parc - 3]))) || + (0 != ircd_strcmp(cli_user(acptr)->username, parv[4])); sendto_opmask_butone(0, SNO_OLDSNO, "Nick collision on %C (%C %Tu <- " - "%C %Tu (%s user@host))", acptr, acptr->from, - acptr->lastnick, cptr, lastnick, + "%C %Tu (%s user@host))", acptr, cli_from(acptr), + cli_lastnick(acptr), cptr, lastnick, differ ? "Different" : "Same"); } else { @@ -425,11 +425,11 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * * compare IP address and username */ - differ = (acptr->ip.s_addr != sptr->ip.s_addr) || - (0 != ircd_strcmp(acptr->user->username, sptr->user->username)); + differ = (cli_ip(acptr).s_addr != cli_ip(sptr).s_addr) || + (0 != ircd_strcmp(cli_user(acptr)->username, cli_user(sptr)->username)); sendto_opmask_butone(0, SNO_OLDSNO, "Nick change collision from %C to " - "%C (%C %Tu <- %C %Tu)", sptr, acptr, acptr->from, - acptr->lastnick, cptr, lastnick); + "%C (%C %Tu <- %C %Tu)", sptr, acptr, cli_from(acptr), + cli_lastnick(acptr), cptr, lastnick); } /* * Now remove (kill) the nick on our side if it is the youngest. @@ -440,23 +440,17 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * * This exits the client sending the NICK message */ - if (acptr->from != cptr) { - if ((differ && lastnick >= acptr->lastnick) || (!differ && lastnick <= acptr->lastnick)) { + if (cli_from(acptr) != cptr) { + if ((differ && lastnick >= cli_lastnick(acptr)) || + (!differ && lastnick <= cli_lastnick(acptr))) { if (!IsServer(sptr)) { ++ServerStats->is_kill; sendcmdto_serv_butone(&me, CMD_KILL, sptr, "%C :%s (%s <- %s (Nick " - "collision))", sptr, me.name, acptr->from->name, - cptr->name); + "collision))", sptr, cli_name(&me), cli_name(cli_from(acptr)), + cli_name(cptr)); assert(!MyConnect(sptr)); -#if 0 - /* - * XXX - impossible - */ - if (MyConnect(sptr)) - sendto_one(cptr, "%s " TOK_KILL " %s%s :%s (Ghost 2)", /* XXX DEAD */ - NumServ(&me), NumNick(sptr), me.name); -#endif - sptr->flags |= FLAGS_KILLED; + + cli_flags(sptr) |= FLAGS_KILLED; exit_client(cptr, sptr, &me, "Nick collision (you're a ghost)"); /* * we have killed sptr off, zero out it's pointer so if it's used @@ -464,36 +458,36 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ sptr = 0; } - if (lastnick != acptr->lastnick) + if (lastnick != cli_lastnick(acptr)) return 0; /* Ignore the NICK */ } send_reply(acptr, ERR_NICKCOLLISION, nick); } ++ServerStats->is_kill; - acptr->flags |= FLAGS_KILLED; + cli_flags(acptr) |= FLAGS_KILLED; /* * This exits the client we had before getting the NICK message */ if (differ) { sendcmdto_serv_butone(&me, CMD_KILL, acptr, "%C :%s (%s <- %s (older " - "nick overruled))", acptr, me.name, - acptr->from->name, cptr->name); + "nick overruled))", acptr, cli_name(&me), + cli_name(cli_from(acptr)), cli_name(cptr)); if (MyConnect(acptr)) sendcmdto_one(acptr, CMD_QUIT, cptr, ":Local kill by %s (Ghost)", - me.name); + cli_name(&me)); exit_client(cptr, acptr, &me, "Nick collision (older nick overruled)"); } else { sendcmdto_serv_butone(&me, CMD_KILL, acptr, "%C :%s (%s <- %s (nick " - "collision from same user@host))", acptr, me.name, - acptr->from->name, cptr->name); + "collision from same user@host))", acptr, cli_name(&me), + cli_name(cli_from(acptr)), cli_name(cptr)); if (MyConnect(acptr)) sendcmdto_one(acptr, CMD_QUIT, cptr, ":Local kill by %s (Ghost: ", - "switched servers too fast)", me.name); + "switched servers too fast)", cli_name(&me)); exit_client(cptr, acptr, &me, "Nick collision (You collided yourself)"); } - if (lastnick == acptr->lastnick) + if (lastnick == cli_lastnick(acptr)) return 0; assert(0 != sptr); diff --git a/ircd/m_notice.c b/ircd/m_notice.c index 1ecc885..caff3d0 100644 --- a/ircd/m_notice.c +++ b/ircd/m_notice.c @@ -118,7 +118,7 @@ int m_notice(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) assert(0 != cptr); assert(cptr == sptr); - sptr->flags &= ~FLAGS_TS8; + cli_flags(sptr) &= ~FLAGS_TS8; if (parc < 2 || EmptyString(parv[1])) return send_reply(sptr, ERR_NORECIPIENT, MSG_NOTICE); @@ -161,7 +161,7 @@ int ms_notice(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) char* name; char* server; - sptr->flags &= ~FLAGS_TS8; + cli_flags(sptr) &= ~FLAGS_TS8; if (parc < 3) { /* @@ -208,7 +208,7 @@ int mo_notice(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) assert(0 != cptr); assert(cptr == sptr); - sptr->flags &= ~FLAGS_TS8; + cli_flags(sptr) &= ~FLAGS_TS8; if (parc < 2 || EmptyString(parv[1])) return send_reply(sptr, ERR_NORECIPIENT, MSG_NOTICE); diff --git a/ircd/m_oper.c b/ircd/m_oper.c index 8dda348..3681506 100644 --- a/ircd/m_oper.c +++ b/ircd/m_oper.c @@ -148,27 +148,27 @@ int m_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (EmptyString(name) || EmptyString(password)) return need_more_params(sptr, "OPER"); - aconf = find_conf_exact(name, sptr->username, sptr->sockhost, CONF_OPS); + aconf = find_conf_exact(name, cli_username(sptr), cli_sockhost(sptr), CONF_OPS); if (!aconf) - aconf = find_conf_exact(name, sptr->username, - ircd_ntoa((const char*) &cptr->ip), CONF_OPS); + aconf = find_conf_exact(name, cli_username(sptr), + ircd_ntoa((const char*) &(cli_ip(cptr))), CONF_OPS); if (!aconf || IsIllegal(aconf)) { send_reply(sptr, ERR_NOOPERHOST); sendto_opmask_butone(0, SNO_OLDREALOP, "Failed OPER attempt by %s (%s@%s)", - parv[0], sptr->user->username, sptr->sockhost); + parv[0], cli_user(sptr)->username, cli_sockhost(sptr)); return 0; } assert(0 != (aconf->status & CONF_OPS)); if (oper_password_match(password, aconf->passwd)) { - unsigned int old_mode = (sptr->flags & ALL_UMODES); + unsigned int old_mode = (cli_flags(sptr) & ALL_UMODES); if (ACR_OK != attach_conf(sptr, aconf)) { send_reply(sptr, ERR_NOOPERHOST); sendto_opmask_butone(0, SNO_OLDREALOP, "Failed OPER attempt by %s " - "(%s@%s)", parv[0], sptr->user->username, - sptr->sockhost); + "(%s@%s)", parv[0], cli_user(sptr)->username, + cli_sockhost(sptr)); return 0; } if (CONF_LOCOP == aconf->status) { @@ -183,17 +183,17 @@ int m_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) SetOper(sptr); ++UserStats.opers; } - cptr->handler = OPER_HANDLER; + cli_handler(cptr) = OPER_HANDLER; - sptr->flags |= (FLAGS_WALLOP | FLAGS_SERVNOTICE | FLAGS_DEBUG); + cli_flags(sptr) |= (FLAGS_WALLOP | FLAGS_SERVNOTICE | FLAGS_DEBUG); set_snomask(sptr, SNO_OPERDEFAULT, SNO_ADD); send_umode_out(cptr, sptr, old_mode); send_reply(sptr, RPL_YOUREOPER); sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (%c)", - parv[0], sptr->user->username, sptr->sockhost, + parv[0], cli_user(sptr)->username, cli_sockhost(sptr), IsOper(sptr) ? 'O' : 'o'); log_write(LS_OPER, L_INFO, 0, "OPER (%s) by (%#C)", name, sptr); @@ -201,7 +201,7 @@ int m_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) else { send_reply(sptr, ERR_PASSWDMISMATCH); sendto_opmask_butone(0, SNO_OLDREALOP, "Failed OPER attempt by %s (%s@%s)", - parv[0], sptr->user->username, sptr->sockhost); + parv[0], cli_user(sptr)->username, cli_sockhost(sptr)); } return 0; } @@ -218,7 +218,7 @@ int ms_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ if (!IsServer(sptr) && !IsOper(sptr)) { ++UserStats.opers; - sptr->flags |= FLAGS_OPER; + cli_flags(sptr) |= FLAGS_OPER; sendcmdto_serv_butone(sptr, CMD_MODE, cptr, "%s :+o", parv[0]); } return 0; diff --git a/ircd/m_part.c b/ircd/m_part.c index 4cf098a..19ea1f0 100644 --- a/ircd/m_part.c +++ b/ircd/m_part.c @@ -115,7 +115,7 @@ int m_part(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) char *p = 0; char *name; - sptr->flags &= ~FLAGS_TS8; + cli_flags(sptr) &= ~FLAGS_TS8; /* check number of arguments */ if (parc < 2 || parv[1][0] == '\0') @@ -167,7 +167,7 @@ int ms_part(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) char *p = 0; char *name; - sptr->flags &= ~FLAGS_TS8; + cli_flags(sptr) &= ~FLAGS_TS8; /* check number of arguments */ if (parc < 2 || parv[1][0] == '\0') diff --git a/ircd/m_pass.c b/ircd/m_pass.c index c436ec8..31a9046 100644 --- a/ircd/m_pass.c +++ b/ircd/m_pass.c @@ -114,7 +114,7 @@ int mr_pass(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* Do something here */ } #endif - ircd_strncpy(cptr->passwd, password, PASSWDLEN); + ircd_strncpy(cli_passwd(cptr), password, PASSWDLEN); return 0; } diff --git a/ircd/m_ping.c b/ircd/m_ping.c index 6453ac7..60e2232 100644 --- a/ircd/m_ping.c +++ b/ircd/m_ping.c @@ -171,7 +171,7 @@ int m_ping(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) destination = parv[2]; /* Will get NULL or pointer (parc >= 2!!) */ - if (!EmptyString(destination) && 0 != ircd_strcmp(destination, me.name)) { + if (!EmptyString(destination) && 0 != ircd_strcmp(destination, cli_name(&me))) { if ((acptr = FindServer(destination))) sendcmdto_one(sptr, CMD_PING, acptr, "%C :%s", sptr, destination); else @@ -187,7 +187,7 @@ int m_ping(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* Is this supposed to be here? */ acptr = FindClient(origin); if (acptr && acptr != sptr) - origin = cptr->name; + origin = cli_name(cptr); if (strlen(origin) > 64) origin[64] = '\0'; @@ -222,15 +222,12 @@ int ms_ping(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* * don't bother sending the error back */ -#if 0 - sendto_one(sptr, err_str(ERR_NOORIGIN), me.name, parv[0]); /* XXX DEAD */ -#endif return 0; } origin = parv[1]; destination = parv[2]; /* Will get NULL or pointer (parc >= 2!!) */ - if (!EmptyString(destination) && 0 != ircd_strcmp(destination, me.name)) { + if (!EmptyString(destination) && 0 != ircd_strcmp(destination, cli_name(&me))) { if ((acptr = FindServer(destination))) { /* * Servers can just forward the origin diff --git a/ircd/m_pong.c b/ircd/m_pong.c index 64a4e81..a6b9967 100644 --- a/ircd/m_pong.c +++ b/ircd/m_pong.c @@ -118,21 +118,15 @@ int ms_pong(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) assert(IsServer(cptr)); if (parc < 2 || EmptyString(parv[1])) { -#if 0 - /* - * ignore there is nothing the server sending it can do about it - */ - sendto_one(sptr, err_str(ERR_NOORIGIN), me.name, parv[0]); /* XXX DEAD */ -#endif return protocol_violation(sptr,"No Origin on PONG"); } origin = parv[1]; destination = parv[2]; - cptr->flags &= ~FLAGS_PINGSENT; - sptr->flags &= ~FLAGS_PINGSENT; - cptr->lasttime = CurrentTime; + cli_flags(cptr) &= ~FLAGS_PINGSENT; + cli_flags(sptr) &= ~FLAGS_PINGSENT; + cli_lasttime(cptr) = CurrentTime; - if (!EmptyString(destination) && 0 != ircd_strcmp(destination, me.name)) { + if (!EmptyString(destination) && 0 != ircd_strcmp(destination, cli_name(&me))) { struct Client* acptr; if ((acptr = FindClient(destination))) { sendcmdto_one(sptr, CMD_PONG, acptr, "%s %s", origin, destination); @@ -154,24 +148,24 @@ int mr_pong(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) assert(cptr == sptr); assert(!IsRegistered(sptr)); - cptr->flags &= ~FLAGS_PINGSENT; - cptr->lasttime = CurrentTime; + cli_flags(cptr) &= ~FLAGS_PINGSENT; + cli_lasttime(cptr) = CurrentTime; /* * Check to see if this is a PONG :cookie reply from an * unregistered user. If so, process it. -record */ - if (0 != sptr->cookie && COOKIE_VERIFIED != sptr->cookie) { - if (parc > 1 && sptr->cookie == atol(parv[parc - 1])) { - sptr->cookie = COOKIE_VERIFIED; - if (sptr->user && *sptr->user->host && sptr->name[0]) + if (0 != cli_cookie(sptr) && COOKIE_VERIFIED != cli_cookie(sptr)) { + if (parc > 1 && cli_cookie(sptr) == atol(parv[parc - 1])) { + cli_cookie(sptr) = COOKIE_VERIFIED; + if (cli_user(sptr) && *(cli_user(sptr))->host && (cli_name(sptr))[0]) /* * NICK and USER OK */ - return register_user(cptr, sptr, sptr->name, sptr->user->username, 0); + return register_user(cptr, sptr, cli_name(sptr), cli_user(sptr)->username, 0); } else send_reply(sptr, SND_EXPLICIT | ERR_BADPING, - ":To connect, type /QUOTE PONG %u", sptr->cookie); + ":To connect, type /QUOTE PONG %u", cli_cookie(sptr)); } return 0; } @@ -187,8 +181,8 @@ int m_pong(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { assert(0 != cptr); assert(cptr == sptr); - cptr->flags &= ~FLAGS_PINGSENT; - cptr->lasttime = CurrentTime; + cli_flags(cptr) &= ~FLAGS_PINGSENT; + cli_lasttime(cptr) = CurrentTime; return 0; } diff --git a/ircd/m_privmsg.c b/ircd/m_privmsg.c index fd41623..a3a396c 100644 --- a/ircd/m_privmsg.c +++ b/ircd/m_privmsg.c @@ -114,12 +114,12 @@ int m_privmsg(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) assert(0 != cptr); assert(cptr == sptr); - assert(0 != sptr->user); + assert(0 != cli_user(sptr)); - sptr->flags &= ~FLAGS_TS8; + cli_flags(sptr) &= ~FLAGS_TS8; #ifdef IDLE_FROM_MSG - sptr->user->last = CurrentTime; + cli_user(sptr)->last = CurrentTime; #endif if (parc < 2 || EmptyString(parv[1])) @@ -158,7 +158,7 @@ int ms_privmsg(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) char* name; char* server; - sptr->flags &= ~FLAGS_TS8; + cli_flags(sptr) &= ~FLAGS_TS8; if (parc < 3) { /* @@ -205,12 +205,12 @@ int mo_privmsg(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) char* vector[MAXTARGETS]; assert(0 != cptr); assert(cptr == sptr); - assert(0 != sptr->user); + assert(0 != cli_user(sptr)); - sptr->flags &= ~FLAGS_TS8; + cli_flags(sptr) &= ~FLAGS_TS8; #ifdef IDLE_FROM_MSG - sptr->user->last = CurrentTime; + cli_user(sptr)->last = CurrentTime; #endif if (parc < 2 || EmptyString(parv[1])) diff --git a/ircd/m_quit.c b/ircd/m_quit.c index 3c45f88..45a3a95 100644 --- a/ircd/m_quit.c +++ b/ircd/m_quit.c @@ -110,20 +110,20 @@ int m_quit(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) assert(0 != sptr); assert(cptr == sptr); - if (sptr->user) { + if (cli_user(sptr)) { struct Membership* chan; - for (chan = sptr->user->channel; chan; chan = chan->next_channel) { + for (chan = cli_user(sptr)->channel; chan; chan = chan->next_channel) { if (!IsZombie(chan) && !member_can_send_to_channel(chan)) return exit_client(cptr, sptr, sptr, "Signed off"); } } - comment = cptr->name; + comment = cli_name(cptr); if (parc > 1) { comment = parv[parc - 1]; if (0 == strncmp("Local kill", comment, 10) || 0 == strncmp(comment, "Killed", 6)) - comment = cptr->name; + comment = cli_name(cptr); else if (strlen(comment) > TOPICLEN) comment[TOPICLEN] = '\0'; } diff --git a/ircd/m_rping.c b/ircd/m_rping.c index 4fdabd6..70f21b7 100644 --- a/ircd/m_rping.c +++ b/ircd/m_rping.c @@ -151,7 +151,7 @@ int ms_rping(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * if it's not for me, pass it on */ if (IsMe(destination)) - sendcmdto_one(&me, CMD_RPONG, sptr, "%s %s %s %s :%s", sptr->name, + sendcmdto_one(&me, CMD_RPONG, sptr, "%s %s %s %s :%s", cli_name(sptr), parv[2], parv[3], parv[4], parv[5]); else sendcmdto_one(sptr, CMD_RPING, destination, "%C %s %s %s :%s", @@ -216,7 +216,7 @@ int mo_rping(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (parc > 2) { if ((acptr = find_match_server(parv[2])) && !IsMe(acptr)) { - parv[2] = acptr->name; + parv[2] = cli_name(acptr); if (3 == parc) { /* * const_cast(start_time); diff --git a/ircd/m_rpong.c b/ircd/m_rpong.c index 877c7a6..a325568 100644 --- a/ircd/m_rpong.c +++ b/ircd/m_rpong.c @@ -134,7 +134,7 @@ int ms_rpong(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!(acptr = findNUser(parv[2]))) return 0; - sendcmdto_one(&me, CMD_RPONG, acptr, "%C %s %s :%s", acptr, sptr->name, + sendcmdto_one(&me, CMD_RPONG, acptr, "%C %s %s :%s", acptr, cli_name(sptr), militime(parv[3], parv[4]), parv[5]); } else sendcmdto_one(sptr, CMD_RPONG, acptr, "%s %s %s %s :%s", parv[1], diff --git a/ircd/m_server.c b/ircd/m_server.c index 1d79229..69f24a8 100644 --- a/ircd/m_server.c +++ b/ircd/m_server.c @@ -166,7 +166,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return exit_client_msg(cptr, sptr, &me, "Juped: %s", JupeReason(ajupe)); log_write(LS_NETWORK, L_NOTICE, LOG_NOSNOTICE, "SERVER: %s %s[%s]", parv[1], - cptr->sockhost, cptr->sock_ip); + cli_sockhost(cptr), cli_sock_ip(cptr)); /* * Detect protocol @@ -190,7 +190,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) start_timestamp = atoi(parv[3]); timestamp = atoi(parv[4]); Debug((DEBUG_INFO, "Got SERVER %s with timestamp [%s] age " TIME_T_FMT " (" - TIME_T_FMT ")", host, parv[4], start_timestamp, me.serv->timestamp)); + TIME_T_FMT ")", host, parv[4], start_timestamp, cli_serv(&me)->timestamp)); if ((timestamp < OLDEST_TS || (hop == 1 && start_timestamp < OLDEST_TS))) { @@ -201,7 +201,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) info[REALLEN] = '\0'; if (prot < atoi(MINOR_PROTOCOL)) { sendto_opmask_butone(0, SNO_OLDSNO, "Got incompatible protocol version " - "(%s) from %s", parv[5], cptr->name); + "(%s) from %s", parv[5], cli_name(cptr)); return exit_new_server(cptr, sptr, host, timestamp, "Incompatible protocol: %s", parv[5]); } @@ -222,7 +222,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) } if (*ch || !strchr(host, '.')) { sendto_opmask_butone(0, SNO_OLDSNO, "Bogus server name (%s) from %s", - host, cptr->name); + host, cli_name(cptr)); return exit_client_msg(cptr, cptr, &me, "Bogus server name (%s)", host); } @@ -239,7 +239,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * See if the newly found server is behind a guaranteed * leaf (L-line). If so, close the link. */ - if ((lhconf = find_conf_byhost(cptr->confs, cptr->name, CONF_LEAF)) && + if ((lhconf = find_conf_byhost(cli_confs(cptr), cli_name(cptr), CONF_LEAF)) && (!lhconf->port || (hop > lhconf->port))) { /* @@ -248,12 +248,12 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * both. */ active_lh_line = 1; - if (timestamp <= cptr->serv->timestamp) + if (timestamp <= cli_serv(cptr)->timestamp) LHcptr = 0; /* Kill incoming server */ else LHcptr = cptr; /* Squit ourselfs */ } - else if (!(lhconf = find_conf_byname(cptr->confs, cptr->name, CONF_HUB)) || + else if (!(lhconf = find_conf_byname(cli_confs(cptr), cli_name(cptr), CONF_HUB)) || (lhconf->port && (hop > lhconf->port))) { struct Client *ac3ptr; @@ -261,7 +261,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* Look for net junction causing this: */ LHcptr = 0; /* incoming server */ if (*parv[5] != 'J') { - for (ac3ptr = sptr; ac3ptr != &me; ac3ptr = ac3ptr->serv->up) { + for (ac3ptr = sptr; ac3ptr != &me; ac3ptr = cli_serv(ac3ptr)->up) { if (IsJunction(ac3ptr)) { LHcptr = ac3ptr; break; @@ -291,70 +291,59 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * and not mess with hash internals. * --Nemesi */ - if (!EmptyString(cptr->name) && + if (!EmptyString(cli_name(cptr)) && (IsUnknown(cptr) || IsHandshake(cptr)) && - 0 != ircd_strcmp(cptr->name, host)) + 0 != ircd_strcmp(cli_name(cptr), host)) hChangeClient(cptr, host); - ircd_strncpy(cptr->name, host, HOSTLEN); - ircd_strncpy(cptr->info, info[0] ? info : me.name, REALLEN); - cptr->hopcount = hop; + ircd_strncpy(cli_name(cptr), host, HOSTLEN); + ircd_strncpy(cli_info(cptr), info[0] ? info : cli_name(&me), REALLEN); + cli_hopcount(cptr) = hop; /* check connection rules */ if (0 != conf_eval_crule(host, CRULE_ALL)) { ServerStats->is_ref++; - sendto_opmask_butone(0, SNO_OLDSNO, "Refused connection from %s.", cptr->name); + sendto_opmask_butone(0, SNO_OLDSNO, "Refused connection from %s.", cli_name(cptr)); return exit_client(cptr, cptr, &me, "Disallowed by connection rule"); } if (conf_check_server(cptr)) { ++ServerStats->is_ref; sendto_opmask_butone(0, SNO_OLDSNO, "Received unauthorized connection " - "from %s.", cptr->name); + "from %s.", cli_name(cptr)); return exit_client(cptr, cptr, &me, "No C:line"); } - host = cptr->name; + host = cli_name(cptr); update_load(); - if (!(aconf = find_conf_byname(cptr->confs, host, CONF_SERVER))) { + if (!(aconf = find_conf_byname(cli_confs(cptr), host, CONF_SERVER))) { ++ServerStats->is_ref; -#ifndef GODMODE sendto_opmask_butone(0, SNO_OLDSNO, "Access denied. No conf line for " - "server %s", cptr->name); + "server %s", cli_name(cptr)); return exit_client_msg(cptr, cptr, &me, - "Access denied. No conf line for server %s", cptr->name); -#else /* GODMODE */ - sendto_opmask_butone(0, SNO_OLDSNO, "General C: line active: No line " - "for server %s", cptr->name); - aconf = find_conf_byname(cptr->confs, "general.undernet.org", CONF_SERVER); - if (!aconf) { - sendto_opmask_butone(0, SNO_OLDSNO, "Neither C lines for server %s " - "nor \"general.undernet.org\"", cptr->name); - return exit_client_msg(cptr, cptr, &me, "No C lines for server %s", cptr->name); - } -#endif /* GODMODE */ + "Access denied. No conf line for server %s", cli_name(cptr)); } #ifdef CRYPT_LINK_PASSWORD /* passwd may be NULL. Head it off at the pass... */ - if (*cptr->passwd) { - encr = ircd_crypt(cptr->passwd, aconf->passed); + if (*(cli_passwd(cptr))) { + encr = ircd_crypt(cli_passwd(cptr), aconf->passed); } else encr = ""; #else - encr = cptr->passwd; + encr = cli_passwd(cptr); #endif /* CRYPT_LINK_PASSWORD */ -#ifndef GODMODE + if (*aconf->passwd && !!strcmp(aconf->passwd, encr)) { ++ServerStats->is_ref; sendto_opmask_butone(0, SNO_OLDSNO, "Access denied (passwd mismatch) %s", - cptr->name); + cli_name(cptr)); return exit_client_msg(cptr, cptr, &me, - "No Access (passwd mismatch) %s", cptr->name); + "No Access (passwd mismatch) %s", cli_name(cptr)); } -#endif /* not GODMODE */ - memset(cptr->passwd, 0, sizeof(cptr->passwd)); + + memset(cli_passwd(cptr), 0, sizeof(cli_passwd(cptr))); #ifndef HUB for (i = 0; i <= HighestFd; i++) @@ -394,13 +383,13 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* * Detect wrong numeric. */ - if (0 != ircd_strcmp(acptr->name, host)) { + if (0 != ircd_strcmp(cli_name(acptr), host)) { sendcmdto_serv_butone(&me, CMD_WALLOPS, cptr, ":SERVER Numeric Collision: %s != %s", - acptr->name, host); + cli_name(acptr), host); return exit_client_msg(cptr, cptr, &me, "NUMERIC collision between %s and %s." - " Is your server numeric correct ?", host, acptr->name); + " Is your server numeric correct ?", host, cli_name(acptr)); } /* * Kill our try, if we had one. @@ -429,15 +418,15 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * Our new server might be a juped server, * or someone trying abuse a second Uworld: */ - else if (IsServer(acptr) && (0 == ircd_strncmp(acptr->info, "JUPE", 4) || - find_conf_byhost(cptr->confs, acptr->name, CONF_UWORLD))) + else if (IsServer(acptr) && (0 == ircd_strncmp(cli_info(acptr), "JUPE", 4) || + find_conf_byhost(cli_confs(cptr), cli_name(acptr), CONF_UWORLD))) { if (!IsServer(sptr)) - return exit_client(cptr, sptr, &me, acptr->info); + return exit_client(cptr, sptr, &me, cli_info(acptr)); sendcmdto_serv_butone(&me, CMD_WALLOPS, cptr, ":Received :%s SERVER %s from %s !?!", parv[0], - parv[1], cptr->name); - return exit_new_server(cptr, sptr, host, timestamp, "%s", acptr->info); + parv[1], cli_name(cptr)); + return exit_new_server(cptr, sptr, host, timestamp, "%s", cli_info(acptr)); } /* * Of course we find the handshake this link was before :) @@ -458,41 +447,41 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) struct Client* ac3ptr; /* Search youngest link: */ - for (ac3ptr = acptr; ac3ptr != &me; ac3ptr = ac3ptr->serv->up) - if (ac3ptr->serv->timestamp > c3ptr->serv->timestamp) + for (ac3ptr = acptr; ac3ptr != &me; ac3ptr = cli_serv(ac3ptr)->up) + if (cli_serv(ac3ptr)->timestamp > cli_serv(c3ptr)->timestamp) c3ptr = ac3ptr; if (IsServer(sptr)) { - for (ac3ptr = sptr; ac3ptr != &me; ac3ptr = ac3ptr->serv->up) - if (ac3ptr->serv->timestamp > c3ptr->serv->timestamp) + for (ac3ptr = sptr; ac3ptr != &me; ac3ptr = cli_serv(ac3ptr)->up) + if (cli_serv(ac3ptr)->timestamp > cli_serv(c3ptr)->timestamp) c3ptr = ac3ptr; } - if (timestamp > c3ptr->serv->timestamp) + if (timestamp > cli_serv(c3ptr)->timestamp) { c3ptr = 0; c2ptr = acptr; /* Make sure they differ */ } /* Search second youngest link: */ - for (ac2ptr = acptr; ac2ptr != &me; ac2ptr = ac2ptr->serv->up) + for (ac2ptr = acptr; ac2ptr != &me; ac2ptr = cli_serv(ac2ptr)->up) if (ac2ptr != c3ptr && - ac2ptr->serv->timestamp > - (c2ptr ? c2ptr->serv->timestamp : timestamp)) + cli_serv(ac2ptr)->timestamp > + (c2ptr ? cli_serv(c2ptr)->timestamp : timestamp)) c2ptr = ac2ptr; if (IsServer(sptr)) { - for (ac2ptr = sptr; ac2ptr != &me; ac2ptr = ac2ptr->serv->up) + for (ac2ptr = sptr; ac2ptr != &me; ac2ptr = cli_serv(ac2ptr)->up) if (ac2ptr != c3ptr && - ac2ptr->serv->timestamp > - (c2ptr ? c2ptr->serv->timestamp : timestamp)) + cli_serv(ac2ptr)->timestamp > + (c2ptr ? cli_serv(c2ptr)->timestamp : timestamp)) c2ptr = ac2ptr; } - if (c3ptr && timestamp > (c2ptr ? c2ptr->serv->timestamp : timestamp)) + if (c3ptr && timestamp > (c2ptr ? cli_serv(c2ptr)->timestamp : timestamp)) c2ptr = 0; /* If timestamps are equal, decide which link to break * by name. */ - if ((c2ptr ? c2ptr->serv->timestamp : timestamp) == - (c3ptr ? c3ptr->serv->timestamp : timestamp)) + if ((c2ptr ? cli_serv(c2ptr)->timestamp : timestamp) == + (c3ptr ? cli_serv(c3ptr)->timestamp : timestamp)) { char* n2; char* n2up; @@ -500,23 +489,23 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) char* n3up; if (c2ptr) { - n2 = c2ptr->name; - n2up = MyConnect(c2ptr) ? me.name : c2ptr->serv->up->name; + n2 = cli_name(c2ptr); + n2up = MyConnect(c2ptr) ? cli_name(&me) : cli_name(cli_serv(c2ptr)->up); } else { n2 = host; - n2up = IsServer(sptr) ? sptr->name : me.name; + n2up = IsServer(sptr) ? cli_name(sptr) : cli_name(&me); } if (c3ptr) { - n3 = c3ptr->name; - n3up = MyConnect(c3ptr) ? me.name : c3ptr->serv->up->name; + n3 = cli_name(c3ptr); + n3up = MyConnect(c3ptr) ? cli_name(&me) : cli_name(cli_serv(c3ptr)->up); } else { n3 = host; - n3up = IsServer(sptr) ? sptr->name : me.name; + n3up = IsServer(sptr) ? cli_name(sptr) : cli_name(&me); } if (strcmp(n2, n2up) > 0) n2 = n2up; @@ -533,10 +522,10 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!c2ptr) return exit_new_server(cptr, sptr, host, timestamp, "server %s already exists and is %ld seconds younger.", - host, (long)acptr->serv->timestamp - (long)timestamp); - else if (c2ptr->from == cptr || IsServer(sptr)) + host, (long)cli_serv(acptr)->timestamp - (long)timestamp); + else if (cli_from(c2ptr) == cptr || IsServer(sptr)) { - struct Client *killedptrfrom = c2ptr->from; + struct Client *killedptrfrom = cli_from(c2ptr); if (active_lh_line) { /* @@ -549,7 +538,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * If breaking the loop here solves the L: or H: * line problem, we don't squit that. */ - if (c2ptr->from == cptr || (LHcptr && a_kills_b_too(c2ptr, LHcptr))) + if (cli_from(c2ptr) == cptr || (LHcptr && a_kills_b_too(c2ptr, LHcptr))) active_lh_line = 0; else { @@ -568,16 +557,16 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * a Ghost... (20 seconds is more then enough because all * SERVER messages are at the beginning of a net.burst). --Run */ - if (CurrentTime - cptr->serv->ghost < 20) + if (CurrentTime - cli_serv(cptr)->ghost < 20) { - killedptrfrom = acptr->from; + killedptrfrom = cli_from(acptr); if (exit_client(cptr, acptr, &me, "Ghost loop") == CPTR_KILLED) return CPTR_KILLED; } else if (exit_client_msg(cptr, c2ptr, &me, "Loop <-- %s (new link is %ld seconds younger)", host, - (c3ptr ? (long)c3ptr->serv->timestamp : timestamp) - - (long)c2ptr->serv->timestamp) == CPTR_KILLED) + (c3ptr ? (long)cli_serv(c3ptr)->timestamp : timestamp) - + (long)cli_serv(c2ptr)->timestamp) == CPTR_KILLED) return CPTR_KILLED; /* * Did we kill the incoming server off already ? @@ -591,7 +580,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { if (LHcptr && a_kills_b_too(LHcptr, acptr)) break; - if (acptr->from == cptr || (LHcptr && a_kills_b_too(acptr, LHcptr))) + if (cli_from(acptr) == cptr || (LHcptr && a_kills_b_too(acptr, LHcptr))) active_lh_line = 0; else { @@ -620,7 +609,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return exit_new_server(cptr, sptr, host, timestamp, (active_lh_line == 2) ? "Non-Hub link %s <- %s(%s), check H:" : "Leaf-only link %s <- %s(%s), check L:", - cptr->name, host, + cli_name(cptr), host, lhconf ? (lhconf->name ? lhconf->name : "*") : "!"); } else @@ -631,7 +620,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (exit_client_msg(cptr, LHcptr, &me, (active_lh_line == 2) ? "Non-Hub link %s <- %s(%s), check H:" : "Leaf-only link %s <- %s(%s), check L:", - cptr->name, host, + cli_name(cptr), host, lhconf ? (lhconf->name ? lhconf->name : "*") : "!") == CPTR_KILLED) return CPTR_KILLED; } @@ -660,27 +649,27 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) acptr = make_client(cptr, STAT_SERVER); make_server(acptr); - acptr->serv->prot = prot; - acptr->serv->timestamp = timestamp; - acptr->hopcount = hop; - ircd_strncpy(acptr->name, host, HOSTLEN); - ircd_strncpy(acptr->info, info, REALLEN); - acptr->serv->up = sptr; - acptr->serv->updown = add_dlink(&sptr->serv->down, acptr); + cli_serv(acptr)->prot = prot; + cli_serv(acptr)->timestamp = timestamp; + cli_hopcount(acptr) = hop; + ircd_strncpy(cli_name(acptr), host, HOSTLEN); + ircd_strncpy(cli_info(acptr), info, REALLEN); + cli_serv(acptr)->up = sptr; + cli_serv(acptr)->updown = add_dlink(&(cli_serv(sptr))->down, acptr); /* Use cptr, because we do protocol 9 -> 10 translation for numeric nicks ! */ SetServerYXX(cptr, acptr, parv[6]); Count_newremoteserver(UserStats); if (Protocol(acptr) < 10) - acptr->flags |= FLAGS_TS8; + cli_flags(acptr) |= FLAGS_TS8; add_client_to_list(acptr); hAddClient(acptr); if (*parv[5] == 'J') { SetBurst(acptr); sendto_opmask_butone(0, SNO_NETWORK, "Net junction: %s %s", - sptr->name, acptr->name); + cli_name(sptr), cli_name(acptr)); SetJunction(acptr); } /* @@ -695,11 +684,11 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!(bcptr = LocalClientArray[i]) || !IsServer(bcptr) || bcptr == cptr || IsMe(bcptr)) continue; - if (0 == match(me.name, acptr->name)) + if (0 == match(cli_name(&me), cli_name(acptr))) continue; sendcmdto_one(sptr, CMD_SERVER, bcptr, "%s %d 0 %s %s %s%s 0 :%s", - acptr->name, hop + 1, parv[4], parv[5], NumServCap(acptr), - acptr->info); + cli_name(acptr), hop + 1, parv[4], parv[5], NumServCap(acptr), + cli_info(acptr)); } return 0; } @@ -707,32 +696,32 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsUnknown(cptr) || IsHandshake(cptr)) { make_server(cptr); - cptr->serv->timestamp = timestamp; - cptr->serv->prot = prot; - cptr->serv->ghost = ghost; + cli_serv(cptr)->timestamp = timestamp; + cli_serv(cptr)->prot = prot; + cli_serv(cptr)->ghost = ghost; SetServerYXX(cptr, cptr, parv[6]); if (start_timestamp > OLDEST_TS) { #ifndef RELIABLE_CLOCK #ifdef TESTNET sendto_opmask_butone(0, SNO_OLDSNO, "Debug: my start time: %Tu ; " - "others start time: %Tu", me.serv->timestamp, + "others start time: %Tu", cli_serv(&me)->timestamp, start_timestamp); sendto_opmask_butone(0, SNO_OLDSNO, "Debug: receive time: %Tu ; " "received timestamp: %Tu ; difference %ld", recv_time, timestamp, timestamp - recv_time); #endif - if (start_timestamp < me.serv->timestamp) + if (start_timestamp < cli_serv(&me)->timestamp) { sendto_opmask_butone(0, SNO_OLDSNO, "got earlier start time: " - "%Tu < %Tu", start_timestamp, me.serv->timestamp); - me.serv->timestamp = start_timestamp; + "%Tu < %Tu", start_timestamp, cli_serv(&me)->timestamp); + cli_serv(&me)->timestamp = start_timestamp; TSoffset += timestamp - recv_time; sendto_opmask_butone(0, SNO_OLDSNO, "clock adjusted by adding %d", (int)(timestamp - recv_time)); } - else if ((start_timestamp > me.serv->timestamp) && IsUnknown(cptr)) - cptr->serv->timestamp = TStime(); + else if ((start_timestamp > cli_serv(&me)->timestamp) && IsUnknown(cptr)) + cli_serv(cptr)->timestamp = TStime(); else if (timestamp != recv_time) { @@ -742,7 +731,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * attempts. */ if (IsUnknown(cptr)) - cptr->serv->timestamp = TStime(); + cli_serv(cptr)->timestamp = TStime(); else if (IsHandshake(cptr)) { sendto_opmask_butone(0, SNO_OLDSNO, "clock adjusted by adding %d", @@ -751,10 +740,10 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) } } #else /* RELIABLE CLOCK IS TRUE, we _always_ use our own clock */ - if (start_timestamp < me.serv->timestamp) - me.serv->timestamp = start_timestamp; + if (start_timestamp < cli_serv(&me)->timestamp) + cli_serv(&me)->timestamp = start_timestamp; if (IsUnknown(cptr)) - cptr->serv->timestamp = TStime(); + cli_serv(cptr)->timestamp = TStime(); #endif } @@ -763,13 +752,13 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) else ret = 0; #ifdef RELIABLE_CLOCK - if (abs(cptr->serv->timestamp - recv_time) > 30) + if (abs(cli_serv(cptr)->timestamp - recv_time) > 30) { sendto_opmask_butone(0, SNO_OLDSNO, "Connected to a net with a " "timestamp-clock difference of %Td seconds! " "Used SETTIME to correct this.", timestamp - recv_time); - sendcmdto_one(&me, CMD_SETTIME, cptr, "%Tu :%s", TStime(), me.name); + sendcmdto_one(&me, CMD_SETTIME, cptr, "%Tu :%s", TStime(), cli_name(&me)); } #endif @@ -850,7 +839,7 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) start_timestamp = atoi(parv[3]); timestamp = atoi(parv[4]); Debug((DEBUG_INFO, "Got SERVER %s with timestamp [%s] age " TIME_T_FMT " (" - TIME_T_FMT ")", host, parv[4], start_timestamp, me.serv->timestamp)); + TIME_T_FMT ")", host, parv[4], start_timestamp, cli_serv(&me)->timestamp)); if ((timestamp < OLDEST_TS || (hop == 1 && start_timestamp < OLDEST_TS))) { return exit_client_msg(cptr, sptr, &me, @@ -860,7 +849,7 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) info[REALLEN] = '\0'; if (prot < atoi(MINOR_PROTOCOL)) { sendto_opmask_butone(0, SNO_OLDSNO, "Got incompatible protocol version " - "(%s) from %s", parv[5], cptr->name); + "(%s) from %s", parv[5], cli_name(cptr)); return exit_new_server(cptr, sptr, host, timestamp, "Incompatible protocol: %s", parv[5]); } @@ -889,7 +878,7 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) break; if (*ch || !strchr(host, '.')) { sendto_opmask_butone(0, SNO_OLDSNO, "Bogus server name (%s) from %s", - host, cptr->name); + host, cli_name(cptr)); return exit_client_msg(cptr, cptr, &me, "Bogus server name (%s)", host); } @@ -906,7 +895,7 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * See if the newly found server is behind a guaranteed * leaf (L-line). If so, close the link. */ - if ((lhconf = find_conf_byhost(cptr->confs, cptr->name, CONF_LEAF)) && + if ((lhconf = find_conf_byhost(cli_confs(cptr), cli_name(cptr), CONF_LEAF)) && (!lhconf->port || (hop > lhconf->port))) { /* @@ -915,12 +904,12 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * both. */ active_lh_line = 1; - if (timestamp <= cptr->serv->timestamp) + if (timestamp <= cli_serv(cptr)->timestamp) LHcptr = 0; /* Kill incoming server */ else LHcptr = cptr; /* Squit ourselfs */ } - else if (!(lhconf = find_conf_byname(cptr->confs, cptr->name, CONF_HUB)) || + else if (!(lhconf = find_conf_byname(cli_confs(cptr), cli_name(cptr), CONF_HUB)) || (lhconf->port && (hop > lhconf->port))) { struct Client *ac3ptr; @@ -928,7 +917,7 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* Look for net junction causing this: */ LHcptr = 0; /* incoming server */ if (*parv[5] != 'J') { - for (ac3ptr = sptr; ac3ptr != &me; ac3ptr = ac3ptr->serv->up) { + for (ac3ptr = sptr; ac3ptr != &me; ac3ptr = cli_serv(ac3ptr)->up) { if (IsJunction(ac3ptr)) { LHcptr = ac3ptr; break; @@ -958,72 +947,58 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * and not mess with hash internals. * --Nemesi */ - if ((!(EmptyString(cptr->name))) + if ((!(EmptyString(cli_name(cptr)))) && (IsUnknown(cptr) || IsHandshake(cptr)) - && 0 != ircd_strcmp(cptr->name, host)) + && 0 != ircd_strcmp(cli_name(cptr), host)) hChangeClient(cptr, host); - ircd_strncpy(cptr->name, host, HOSTLEN); - ircd_strncpy(cptr->info, info[0] ? info : me.name, REALLEN); - cptr->hopcount = hop; + ircd_strncpy(cli_name(cptr), host, HOSTLEN); + ircd_strncpy(cli_info(cptr), info[0] ? info : cli_name(&me), REALLEN); + cli_hopcount(cptr) = hop; /* check connection rules */ if (0 != conf_eval_crule(host, CRULE_ALL)) { ServerStats->is_ref++; - sendto_opmask_butone(0, SNO_OLDSNO, "Refused connection from %s.", cptr->name); + sendto_opmask_butone(0, SNO_OLDSNO, "Refused connection from %s.", cli_name(cptr)); return exit_client(cptr, cptr, &me, "Disallowed by connection rule"); } if (conf_check_server(cptr)) { ++ServerStats->is_ref; sendto_opmask_butone(0, SNO_OLDSNO, "Received unauthorized connection " - "from %s.", cptr->name); + "from %s.", cli_name(cptr)); return exit_client(cptr, cptr, &me, "No C conf lines"); } - host = cptr->name; + host = cli_name(cptr); update_load(); - if (!(aconf = find_conf_byname(cptr->confs, host, CONF_SERVER))) { + if (!(aconf = find_conf_byname(cli_confs(cptr), host, CONF_SERVER))) { ++ServerStats->is_ref; -#ifndef GODMODE sendto_opmask_butone(0, SNO_OLDSNO, "Access denied. No conf line for " - "server %s", cptr->name); + "server %s", cli_name(cptr)); return exit_client_msg(cptr, cptr, &me, - "Access denied. No conf line for server %s", cptr->name); -#else /* GODMODE */ - sendto_opmask_butone(0, SNO_OLDSNO, "General C line active: No line " - "for server %s", cptr->name); - aconf = - find_conf_byname(cptr->confs, "general.undernet.org", CONF_SERVER); - if (!aconf) { - sendto_opmask_butone(0, SNO_OLDSNO, "Neither C lines for server %s " - "nor \"general.undernet.org\"", cptr->name); - return exit_client_msg(cptr, cptr, &me, - "No C lines for server %s", cptr->name); - } -#endif /* GODMODE */ + "Access denied. No conf line for server %s", cli_name(cptr)); } #ifdef CRYPT_LINK_PASSWORD /* passwd may be NULL. Head it off at the pass... */ - if (*cptr->passwd) + if (*(cli_passwd(cptr))) { - encr = ircd_crypt(cptr->passwd, aconf->passwd); + encr = ircd_crypt(cli_passwd(cptr), cli_passwd(aconf)); } else encr = ""; #else - encr = cptr->passwd; + encr = cli_passwd(cptr); #endif /* CRYPT_LINK_PASSWORD */ -#ifndef GODMODE - if (*aconf->passwd && !!strcmp(aconf->passwd, encr)) { + + if (*(aconf->passwd) && !!strcmp(aconf->passwd, encr)) { ++ServerStats->is_ref; sendto_opmask_butone(0, SNO_OLDSNO, "Access denied (passwd mismatch) %s", - cptr->name); + cli_name(cptr)); return exit_client_msg(cptr, cptr, &me, - "No Access (passwd mismatch) %s", cptr->name); + "No Access (passwd mismatch) %s", cli_name(cptr)); } -#endif /* not GODMODE */ - memset(cptr->passwd, 0, sizeof(cptr->passwd)); + memset(cli_passwd(cptr), 0, sizeof(cli_passwd(cptr))); #ifndef HUB for (i = 0; i <= HighestFd; i++) @@ -1064,14 +1039,14 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* * Detect wrong numeric. */ - if (0 != ircd_strcmp(acptr->name, host)) + if (0 != ircd_strcmp(cli_name(acptr), host)) { sendcmdto_serv_butone(&me, CMD_WALLOPS, cptr, - ":SERVER Numeric Collision: %s != %s", acptr->name, + ":SERVER Numeric Collision: %s != %s", cli_name(acptr), host); return exit_client_msg(cptr, cptr, &me, "NUMERIC collision between %s and %s." - " Is your server numeric correct ?", host, acptr->name); + " Is your server numeric correct ?", host, cli_name(acptr)); } /* * Kill our try, if we had one. @@ -1100,14 +1075,14 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * Our new server might be a juped server, * or someone trying abuse a second Uworld: */ - else if (IsServer(acptr) && (0 == ircd_strncmp(acptr->info, "JUPE", 4) || - find_conf_byhost(cptr->confs, acptr->name, CONF_UWORLD))) + else if (IsServer(acptr) && (0 == ircd_strncmp(cli_info(acptr), "JUPE", 4) || + find_conf_byhost(cli_confs(cptr), cli_name(acptr), CONF_UWORLD))) { if (!IsServer(sptr)) - return exit_client(cptr, sptr, &me, acptr->info); + return exit_client(cptr, sptr, &me, cli_info(acptr)); sendcmdto_one(&me, CMD_WALLOPS, cptr, ":Received :%s SERVER %s " - "from %s !?!", parv[0], parv[1], cptr->name); - return exit_new_server(cptr, sptr, host, timestamp, "%s", acptr->info); + "from %s !?!", parv[0], parv[1], cli_name(cptr)); + return exit_new_server(cptr, sptr, host, timestamp, "%s", cli_info(acptr)); } /* * Of course we find the handshake this link was before :) @@ -1128,41 +1103,41 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) struct Client* ac3ptr; /* Search youngest link: */ - for (ac3ptr = acptr; ac3ptr != &me; ac3ptr = ac3ptr->serv->up) - if (ac3ptr->serv->timestamp > c3ptr->serv->timestamp) + for (ac3ptr = acptr; ac3ptr != &me; ac3ptr = cli_serv(ac3ptr)->up) + if (cli_serv(ac3ptr)->timestamp > cli_serv(c3ptr)->timestamp) c3ptr = ac3ptr; if (IsServer(sptr)) { - for (ac3ptr = sptr; ac3ptr != &me; ac3ptr = ac3ptr->serv->up) - if (ac3ptr->serv->timestamp > c3ptr->serv->timestamp) + for (ac3ptr = sptr; ac3ptr != &me; ac3ptr = cli_serv(ac3ptr)->up) + if (cli_serv(ac3ptr)->timestamp > cli_serv(c3ptr)->timestamp) c3ptr = ac3ptr; } - if (timestamp > c3ptr->serv->timestamp) + if (timestamp > cli_serv(c3ptr)->timestamp) { c3ptr = 0; c2ptr = acptr; /* Make sure they differ */ } /* Search second youngest link: */ - for (ac2ptr = acptr; ac2ptr != &me; ac2ptr = ac2ptr->serv->up) + for (ac2ptr = acptr; ac2ptr != &me; ac2ptr = cli_serv(ac2ptr)->up) if (ac2ptr != c3ptr && - ac2ptr->serv->timestamp > - (c2ptr ? c2ptr->serv->timestamp : timestamp)) + cli_serv(ac2ptr)->timestamp > + (c2ptr ? cli_serv(c2ptr)->timestamp : timestamp)) c2ptr = ac2ptr; if (IsServer(sptr)) { - for (ac2ptr = sptr; ac2ptr != &me; ac2ptr = ac2ptr->serv->up) + for (ac2ptr = sptr; ac2ptr != &me; ac2ptr = cli_serv(ac2ptr)->up) if (ac2ptr != c3ptr && - ac2ptr->serv->timestamp > - (c2ptr ? c2ptr->serv->timestamp : timestamp)) + cli_serv(ac2ptr)->timestamp > + (c2ptr ? cli_serv(c2ptr)->timestamp : timestamp)) c2ptr = ac2ptr; } - if (c3ptr && timestamp > (c2ptr ? c2ptr->serv->timestamp : timestamp)) + if (c3ptr && timestamp > (c2ptr ? cli_serv(c2ptr)->timestamp : timestamp)) c2ptr = 0; /* If timestamps are equal, decide which link to break * by name. */ - if ((c2ptr ? c2ptr->serv->timestamp : timestamp) == - (c3ptr ? c3ptr->serv->timestamp : timestamp)) + if ((c2ptr ? cli_serv(c2ptr)->timestamp : timestamp) == + (c3ptr ? cli_serv(c3ptr)->timestamp : timestamp)) { char* n2; char* n2up; @@ -1170,23 +1145,23 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) char* n3up; if (c2ptr) { - n2 = c2ptr->name; - n2up = MyConnect(c2ptr) ? me.name : c2ptr->serv->up->name; + n2 = cli_name(c2ptr); + n2up = MyConnect(c2ptr) ? cli_name(&me) : cli_name(cli_serv(c2ptr)->up); } else { n2 = host; - n2up = IsServer(sptr) ? sptr->name : me.name; + n2up = IsServer(sptr) ? cli_name(sptr) : cli_name(&me); } if (c3ptr) { - n3 = c3ptr->name; - n3up = MyConnect(c3ptr) ? me.name : c3ptr->serv->up->name; + n3 = cli_name(c3ptr); + n3up = MyConnect(c3ptr) ? cli_name(&me) : cli_name(cli_serv(c3ptr)->up); } else { n3 = host; - n3up = IsServer(sptr) ? sptr->name : me.name; + n3up = IsServer(sptr) ? cli_name(sptr) : cli_name(&me); } if (strcmp(n2, n2up) > 0) n2 = n2up; @@ -1203,10 +1178,10 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!c2ptr) return exit_new_server(cptr, sptr, host, timestamp, "server %s already exists and is %ld seconds younger.", - host, (long)acptr->serv->timestamp - (long)timestamp); - else if (c2ptr->from == cptr || IsServer(sptr)) + host, (long)cli_serv(acptr)->timestamp - (long)timestamp); + else if (cli_from(c2ptr) == cptr || IsServer(sptr)) { - struct Client *killedptrfrom = c2ptr->from; + struct Client *killedptrfrom = cli_from(c2ptr); if (active_lh_line) { /* @@ -1219,7 +1194,7 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * If breaking the loop here solves the L: or H: * line problem, we don't squit that. */ - if (c2ptr->from == cptr || (LHcptr && a_kills_b_too(c2ptr, LHcptr))) + if (cli_from(c2ptr) == cptr || (LHcptr && a_kills_b_too(c2ptr, LHcptr))) active_lh_line = 0; else { @@ -1238,16 +1213,16 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * a Ghost... (20 seconds is more then enough because all * SERVER messages are at the beginning of a net.burst). --Run */ - if (CurrentTime - cptr->serv->ghost < 20) + if (CurrentTime - cli_serv(cptr)->ghost < 20) { - killedptrfrom = acptr->from; + killedptrfrom = cli_from(acptr); if (exit_client(cptr, acptr, &me, "Ghost loop") == CPTR_KILLED) return CPTR_KILLED; } else if (exit_client_msg(cptr, c2ptr, &me, "Loop <-- %s (new link is %ld seconds younger)", host, - (c3ptr ? (long)c3ptr->serv->timestamp : timestamp) - - (long)c2ptr->serv->timestamp) == CPTR_KILLED) + (c3ptr ? (long)cli_serv(c3ptr)->timestamp : timestamp) - + (long)cli_serv(c2ptr)->timestamp) == CPTR_KILLED) return CPTR_KILLED; /* * Did we kill the incoming server off already ? @@ -1261,7 +1236,7 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { if (LHcptr && a_kills_b_too(LHcptr, acptr)) break; - if (acptr->from == cptr || (LHcptr && a_kills_b_too(acptr, LHcptr))) + if (cli_from(acptr) == cptr || (LHcptr && a_kills_b_too(acptr, LHcptr))) active_lh_line = 0; else { @@ -1289,7 +1264,7 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (LHcptr == 0) { return exit_new_server(cptr, sptr, host, timestamp, (active_lh_line == 2) ? "Non-Hub link %s <- %s(%s)" : "Leaf-only link %s <- %s(%s)", - cptr->name, host, + cli_name(cptr), host, lhconf ? (lhconf->name ? lhconf->name : "*") : "!"); } else @@ -1299,7 +1274,7 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { if (exit_client_msg(cptr, LHcptr, &me, (active_lh_line == 2) ? "Non-Hub link %s <- %s(%s)" : "Leaf-only link %s <- %s(%s)", - cptr->name, host, + cli_name(cptr), host, lhconf ? (lhconf->name ? lhconf->name : "*") : "!") == CPTR_KILLED) return CPTR_KILLED; } @@ -1328,27 +1303,27 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) acptr = make_client(cptr, STAT_SERVER); make_server(acptr); - acptr->serv->prot = prot; - acptr->serv->timestamp = timestamp; - acptr->hopcount = hop; - ircd_strncpy(acptr->name, host, HOSTLEN); - ircd_strncpy(acptr->info, info, REALLEN); - acptr->serv->up = sptr; - acptr->serv->updown = add_dlink(&sptr->serv->down, acptr); + cli_serv(acptr)->prot = prot; + cli_serv(acptr)->timestamp = timestamp; + cli_hopcount(acptr) = hop; + ircd_strncpy(cli_name(acptr), host, HOSTLEN); + ircd_strncpy(cli_info(acptr), info, REALLEN); + cli_serv(acptr)->up = sptr; + cli_serv(acptr)->updown = add_dlink(&(cli_serv(sptr))->down, acptr); /* Use cptr, because we do protocol 9 -> 10 translation for numeric nicks ! */ SetServerYXX(cptr, acptr, parv[6]); Count_newremoteserver(UserStats); if (Protocol(acptr) < 10) - acptr->flags |= FLAGS_TS8; + cli_flags(acptr) |= FLAGS_TS8; add_client_to_list(acptr); hAddClient(acptr); if (*parv[5] == 'J') { SetBurst(acptr); sendto_opmask_butone(0, SNO_NETWORK, "Net junction: %s %s", - sptr->name, acptr->name); + cli_name(sptr), cli_name(acptr)); SetJunction(acptr); } /* @@ -1360,11 +1335,11 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!(bcptr = LocalClientArray[i]) || !IsServer(bcptr) || bcptr == cptr || IsMe(bcptr)) continue; - if (0 == match(me.name, acptr->name)) + if (0 == match(cli_name(&me), cli_name(acptr))) continue; sendcmdto_one(sptr, CMD_SERVER, bcptr, "%s %d 0 %s %s %s%s 0 :%s", - acptr->name, hop + 1, parv[4], parv[5], NumServCap(acptr), - acptr->info); + cli_name(acptr), hop + 1, parv[4], parv[5], NumServCap(acptr), + cli_info(acptr)); } return 0; } @@ -1372,32 +1347,32 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsUnknown(cptr) || IsHandshake(cptr)) { make_server(cptr); - cptr->serv->timestamp = timestamp; - cptr->serv->prot = prot; - cptr->serv->ghost = ghost; + cli_serv(cptr)->timestamp = timestamp; + cli_serv(cptr)->prot = prot; + cli_serv(cptr)->ghost = ghost; SetServerYXX(cptr, cptr, parv[6]); if (start_timestamp > OLDEST_TS) { #ifndef RELIABLE_CLOCK #ifdef TESTNET sendto_opmask_butone(0, SNO_OLDSNO, "Debug: my start time: %Tu ; " - "others start time: %Tu", me.serv->timestamp, + "others start time: %Tu", cli_serv(&me)->timestamp, start_timestamp); sendto_opmask_butone(0, SNO_OLDSNO, "Debug: receive time: %Tu ; " "received timestamp: %Tu ; difference %ld", recv_time, timestamp, timestamp - recv_time); #endif - if (start_timestamp < me.serv->timestamp) + if (start_timestamp < cli_serv(&me)->timestamp) { sendto_opmask_butone(0, SNO_OLDSNO, "got earlier start time: " - "%Tu < %Tu", start_timestamp, me.serv->timestamp); - me.serv->timestamp = start_timestamp; + "%Tu < %Tu", start_timestamp, cli_serv(&me)->timestamp); + cli_serv(&me)->timestamp = start_timestamp; TSoffset += timestamp - recv_time; sendto_opmask_butone(0, SNO_OLDSNO, "clock adjusted by adding %d", (int)(timestamp - recv_time)); } - else if ((start_timestamp > me.serv->timestamp) && IsUnknown(cptr)) - cptr->serv->timestamp = TStime(); + else if ((start_timestamp > cli_serv(&me)->timestamp) && IsUnknown(cptr)) + cli_serv(cptr)->timestamp = TStime(); else if (timestamp != recv_time) { @@ -1407,7 +1382,7 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * attempts. */ if (IsUnknown(cptr)) - cptr->serv->timestamp = TStime(); + cli_serv(cptr)->timestamp = TStime(); else if (IsHandshake(cptr)) { sendto_opmask_butone(0, SNO_OLDSNO, "clock adjusted by adding %d", @@ -1416,10 +1391,10 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) } } #else /* RELIABLE CLOCK IS TRUE, we _always_ use our own clock */ - if (start_timestamp < me.serv->timestamp) - me.serv->timestamp = start_timestamp; + if (start_timestamp < cli_serv(&me)->timestamp) + cli_serv(&me)->timestamp = start_timestamp; if (IsUnknown(cptr)) - cptr->serv->timestamp = TStime(); + cli_serv(cptr)->timestamp = TStime(); #endif } @@ -1428,12 +1403,12 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) else ret = 0; #ifdef RELIABLE_CLOCK - if (abs(cptr->serv->timestamp - recv_time) > 30) + if (abs(cli_serv(cptr)->timestamp - recv_time) > 30) { sendto_opmask_butone(0, SNO_OLDSNO, "Connected to a net with a " "timestamp-clock difference of %Td seconds! Used " "SETTIME to correct this.", timestamp - recv_time); - sendcmdto_one(&me, CMD_SETTIME, cptr, "%Tu :%s", TStime(), me.name); + sendcmdto_one(&me, CMD_SETTIME, cptr, "%Tu :%s", TStime(), cli_name(&me)); } #endif diff --git a/ircd/m_settime.c b/ircd/m_settime.c index 7077690..a75a3c0 100644 --- a/ircd/m_settime.c +++ b/ircd/m_settime.c @@ -124,7 +124,7 @@ int ms_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return need_more_params(sptr, "SETTIME"); if (parc == 2 && MyUser(sptr)) - parv[parc++] = me.name; + parv[parc++] = cli_name(&me); t = atoi(parv[1]); dt = TStime() - t; @@ -141,8 +141,8 @@ int ms_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) sprintf_irc(tbuf, TIME_T_FMT, TStime()); parv[1] = tbuf; #endif - for (lp = me.serv->down; lp; lp = lp->next) - if (cptr != lp->value.cptr && MsgQLength(&lp->value.cptr->sendQ) < 8000) + for (lp = cli_serv(&me)->down; lp; lp = lp->next) + if (cptr != lp->value.cptr && MsgQLength(&(cli_sendQ(lp->value.cptr))) < 8000) sendcmdto_one(sptr, CMD_NOTICE, lp->value.cptr, "%s", parv[1]); } else @@ -157,7 +157,7 @@ int ms_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) #ifdef RELIABLE_CLOCK if ((dt > 600) || (dt < -600)) sendcmdto_serv_butone(&me, CMD_WALLOPS, 0, ":Bad SETTIME from %s: %Tu", - sptr->name, t); + cli_name(sptr), t); if (IsUser(sptr)) { sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :clock is not set %ld seconds %s " @@ -166,7 +166,7 @@ int ms_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) } #else sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " - "seconds %s", sptr->name, (dt < 0) ? -dt : dt, + "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, (dt < 0) ? "forwards" : "backwards"); TSoffset -= dt; if (IsUser(sptr)) @@ -200,7 +200,7 @@ int mo_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return need_more_params(sptr, "SETTIME"); if (parc == 2 && MyUser(sptr)) - parv[parc++] = me.name; + parv[parc++] = cli_name(&me); t = atoi(parv[1]); dt = TStime() - t; @@ -217,8 +217,8 @@ int mo_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) sprintf_irc(tbuf, TIME_T_FMT, TStime()); parv[1] = tbuf; #endif - for (lp = me.serv->down; lp; lp = lp->next) - if (cptr != lp->value.cptr && MsgQLength(&lp->value.cptr->sendQ) < 8000) + for (lp = cli_serv(&me)->down; lp; lp = lp->next) + if (cptr != lp->value.cptr && MsgQLength(&(cli_sendQ(lp->value.cptr))) < 8000) sendcmdto_one(sptr, CMD_SETTIME, lp->value.cptr, "%s", parv[1]); } else @@ -233,7 +233,7 @@ int mo_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) #ifdef RELIABLE_CLOCK if ((dt > 600) || (dt < -600)) sendcmdto_serv_butone(&me, CMD_WALLOPS, 0, ":Bad SETTIME from %s: %Tu", - sptr->name, t); + cli_name(sptr), t); if (IsUser(sptr)) { sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :clock is not set %ld seconds %s " @@ -242,7 +242,7 @@ int mo_settime(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) } #else sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " - "seconds %s", sptr->name, (dt < 0) ? -dt : dt, + "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, (dt < 0) ? "forwards" : "backwards"); TSoffset -= dt; if (IsUser(sptr)) diff --git a/ircd/m_silence.c b/ircd/m_silence.c index 6451d98..9e61fec 100644 --- a/ircd/m_silence.c +++ b/ircd/m_silence.c @@ -130,11 +130,11 @@ int m_silence(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) acptr = sptr; if (parc < 2 || EmptyString(parv[1]) || (acptr = FindUser(parv[1]))) { - if (!(acptr->user)) + if (!(cli_user(acptr))) return 0; - for (lp = acptr->user->silence; lp; lp = lp->next) - send_reply(sptr, RPL_SILELIST, acptr->name, lp->value.cp); - send_reply(sptr, RPL_ENDOFSILELIST, acptr->name); + for (lp = cli_user(acptr)->silence; lp; lp = lp->next) + send_reply(sptr, RPL_SILELIST, cli_name(acptr), lp->value.cp); + send_reply(sptr, RPL_ENDOFSILELIST, cli_name(acptr)); return 0; } cp = parv[1]; @@ -187,7 +187,7 @@ int ms_silence(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) } else { add_silence(sptr, parv[2]); - if (acptr && IsServer(acptr->from)) { + if (acptr && IsServer(cli_from(acptr))) { sendcmdto_one(sptr, CMD_SILENCE, acptr, "%C %s", acptr, parv[2]); } } diff --git a/ircd/m_squit.c b/ircd/m_squit.c index 2d46d8c..c36af4b 100644 --- a/ircd/m_squit.c +++ b/ircd/m_squit.c @@ -76,7 +76,7 @@ int ms_squit(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) comment = parv[parc-1]; if (BadPtr(parv[parc - 1])) - comment=sptr->name; + comment = cli_name(sptr); acptr = FindNServer(server); @@ -99,7 +99,7 @@ int ms_squit(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* If atoi(parv[2]) == 0 we must indeed squit ! * It will be our neighbour. */ - if ( timestamp != 0 && timestamp != acptr->serv->timestamp) { + if ( timestamp != 0 && timestamp != cli_serv(acptr)->timestamp) { Debug((DEBUG_NOTICE, "Ignoring SQUIT with the wrong timestamp")); return 0; } @@ -126,7 +126,7 @@ int mo_squit(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return need_more_params(sptr, "SQUIT"); if (parc < 3 || BadPtr(parv[2])) - comment = sptr->name; + comment = cli_name(sptr); else comment = parv[2]; @@ -136,7 +136,7 @@ int mo_squit(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * when the command is issued by an oper. */ for (acptr = GlobalClientList; (acptr = next_client(acptr, server)); - acptr = acptr->next) { + acptr = cli_next(acptr)) { if (IsServer(acptr) || IsMe(acptr)) break; } @@ -151,9 +151,9 @@ int mo_squit(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * servers like davis.* and davis-r.* when typing * /SQUIT davis* */ - for (acptr2 = acptr->serv->up; acptr2 != &me; - acptr2 = acptr2->serv->up) - if (!match(server, acptr2->name)) + for (acptr2 = cli_serv(acptr)->up; acptr2 != &me; + acptr2 = cli_serv(acptr2)->up) + if (!match(server, cli_name(acptr2))) acptr = acptr2; /* Disallow local opers to squit remote servers */ diff --git a/ircd/m_stats.c b/ircd/m_stats.c index 202933e..51a6c5f 100644 --- a/ircd/m_stats.c +++ b/ircd/m_stats.c @@ -240,16 +240,16 @@ int m_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsInvisible(acptr) && (doall || wilds) && !IsAnOper(acptr) && (acptr != sptr)) continue; /* Only show the ones that match the given mask - if any */ - if (!doall && wilds && match(name, acptr->name)) + if (!doall && wilds && match(name, cli_name(acptr))) continue; /* Skip all that do not match the specific query */ - if (!(doall || wilds) && 0 != ircd_strcmp(name, acptr->name)) + if (!(doall || wilds) && 0 != ircd_strcmp(name, cli_name(acptr))) continue; send_reply(sptr, SND_EXPLICIT | RPL_STATSLINKINFO, - "%s %u %u %u %u %u :%Tu", (*acptr->name) ? acptr->name : "", - (int)MsgQLength(&acptr->sendQ), (int)acptr->sendM, - (int)acptr->sendK, (int)acptr->receiveM, - (int)acptr->receiveK, CurrentTime - acptr->firsttime); + "%s %u %u %u %u %u :%Tu", (*(cli_name(acptr))) ? cli_name(acptr) : "", + (int)MsgQLength(&(cli_sendQ(acptr))), (int)cli_sendM(acptr), + (int)cli_sendK(acptr), (int)cli_receiveM(acptr), + (int)cli_receiveK(acptr), CurrentTime - cli_firsttime(acptr)); } break; } @@ -312,20 +312,6 @@ int m_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) send_reply(sptr, RPL_STATMEMTOT, fda_get_byte_count(), fda_get_block_count()); #endif - -#if 0 -#ifdef MEMSIZESTATS - sendto_one(sptr, rpl_str(RPL_STATMEMTOT), /* XXX DEAD */ - me.name, parv[0], get_mem_size(), get_alloc_cnt()); -#endif -#ifdef MEMLEAKSTATS - report_memleak_stats(sptr, parc, parv); -#endif -#if !defined(MEMSIZESTATS) && !defined(MEMLEAKSTATS) - sendto_one(sptr, ":%s NOTICE %s :stats M : Memory allocation monitoring " /* XXX DEAD */ - "is not enabled on this server", me.name, parv[0]); -#endif -#endif /* 0 */ break; case 'm': for (mptr = msgtab; mptr->cmd; mptr++) @@ -371,7 +357,7 @@ int m_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { time_t nowr; - nowr = CurrentTime - me.since; + nowr = CurrentTime - cli_since(&me); send_reply(sptr, RPL_STATSUPTIME, nowr / 86400, (nowr / 3600) % 24, (nowr / 60) % 60, nowr % 60); send_reply(sptr, RPL_STATSCONN, max_connection_count, max_client_count); @@ -475,16 +461,16 @@ int ms_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * Not here, because ms_stats is specifically a remote command, * thus the check was removed. -Ghostwolf */ /* Only show the ones that match the given mask - if any */ - if (!doall && wilds && match(name, acptr->name)) + if (!doall && wilds && match(name, cli_name(acptr))) continue; /* Skip all that do not match the specific query */ - if (!(doall || wilds) && 0 != ircd_strcmp(name, acptr->name)) + if (!(doall || wilds) && 0 != ircd_strcmp(name, cli_name(acptr))) continue; send_reply(sptr, SND_EXPLICIT | RPL_STATSLINKINFO, - "%s %u %u %u %u %u :%Tu", acptr->name, - (int)MsgQLength(&acptr->sendQ), (int)acptr->sendM, - (int)acptr->sendK, (int)acptr->receiveM, - (int)acptr->receiveK, CurrentTime - acptr->firsttime); + "%s %u %u %u %u %u :%Tu", cli_name(acptr), + (int)MsgQLength(&(cli_sendQ(acptr))), (int)cli_sendM(acptr), + (int)cli_sendK(acptr), (int)cli_receiveM(acptr), + (int)cli_receiveK(acptr), CurrentTime - cli_firsttime(acptr)); } break; } @@ -551,20 +537,6 @@ int ms_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) send_reply(sptr, RPL_STATMEMTOT, fda_get_byte_count(), fda_get_block_count()); #endif - -#if 0 -#ifdef MEMSIZESTATS - sendto_one(sptr, rpl_str(RPL_STATMEMTOT), /* XXX DEAD */ - me.name, parv[0], get_mem_size(), get_alloc_cnt()); -#endif -#ifdef MEMLEAKSTATS - report_memleak_stats(sptr, parc, parv); -#endif -#if !defined(MEMSIZESTATS) && !defined(MEMLEAKSTATS) - sendto_one(sptr, ":%s NOTICE %s :stats M : Memory allocation monitoring " /* XXX DEAD */ - "is not enabled on this server", me.name, parv[0]); -#endif -#endif /* 0 */ break; case 'm': for (mptr = msgtab; mptr->cmd; mptr++) @@ -611,7 +583,7 @@ int ms_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { time_t nowr; - nowr = CurrentTime - me.since; + nowr = CurrentTime - cli_since(&me); send_reply(sptr, RPL_STATSUPTIME, nowr / 86400, (nowr / 3600) % 24, (nowr / 60) % 60, nowr % 60); send_reply(sptr, RPL_STATSCONN, max_connection_count, max_client_count); @@ -708,16 +680,16 @@ int mo_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (doall && IsUser(acptr)) continue; /* Only show the ones that match the given mask - if any */ - if (!doall && wilds && match(name, acptr->name)) + if (!doall && wilds && match(name, cli_name(acptr))) continue; /* Skip all that do not match the specific query */ - if (!(doall || wilds) && 0 != ircd_strcmp(name, acptr->name)) + if (!(doall || wilds) && 0 != ircd_strcmp(name, cli_name(acptr))) continue; send_reply(sptr, SND_EXPLICIT | RPL_STATSLINKINFO, - "%s %u %u %u %u %u :%Tu", acptr->name, - (int)MsgQLength(&acptr->sendQ), (int)acptr->sendM, - (int)acptr->sendK, (int)acptr->receiveM, - (int)acptr->receiveK, CurrentTime - acptr->firsttime); + "%s %u %u %u %u %u :%Tu", cli_name(acptr), + (int)MsgQLength(&(cli_sendQ(acptr))), (int)cli_sendM(acptr), + (int)cli_sendK(acptr), (int)cli_receiveM(acptr), + (int)cli_receiveK(acptr), CurrentTime - cli_firsttime(acptr)); } break; } @@ -780,20 +752,6 @@ int mo_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) send_reply(sptr, RPL_STATMEMTOT, fda_get_byte_count(), fda_get_block_count()); #endif - -#if 0 -#ifdef MEMSIZESTATS - sendto_one(sptr, rpl_str(RPL_STATMEMTOT), /* XXX DEAD */ - me.name, parv[0], get_mem_size(), get_alloc_cnt()); -#endif -#ifdef MEMLEAKSTATS - report_memleak_stats(sptr, parc, parv); -#endif -#if !defined(MEMSIZESTATS) && !defined(MEMLEAKSTATS) - sendto_one(sptr, ":%s NOTICE %s :stats M : Memory allocation monitoring " /* XXX DEAD */ - "is not enabled on this server", me.name, parv[0]); -#endif -#endif /* 0 */ break; case 'm': for (mptr = msgtab; mptr->cmd; mptr++) @@ -840,7 +798,7 @@ int mo_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { time_t nowr; - nowr = CurrentTime - me.since; + nowr = CurrentTime - cli_since(&me); send_reply(sptr, RPL_STATSUPTIME, nowr / 86400, (nowr / 3600) % 24, (nowr / 60) % 60, nowr % 60); send_reply(sptr, RPL_STATSCONN, max_connection_count, max_client_count); diff --git a/ircd/m_time.c b/ircd/m_time.c index c7d3561..b74794e 100644 --- a/ircd/m_time.c +++ b/ircd/m_time.c @@ -112,7 +112,7 @@ int m_time(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) HUNTED_ISME) return 0; - send_reply(sptr, RPL_TIME, me.name, TStime(), TSoffset, date((long)0)); + send_reply(sptr, RPL_TIME, cli_name(&me), TStime(), TSoffset, date((long)0)); return 0; } diff --git a/ircd/m_topic.c b/ircd/m_topic.c index 95f054e..a8d5649 100644 --- a/ircd/m_topic.c +++ b/ircd/m_topic.c @@ -117,7 +117,7 @@ static void do_settopic(struct Client *sptr, struct Client *cptr, newtopic=ircd_strncmp(chptr->topic,topic,TOPICLEN)!=0; /* setting a topic */ ircd_strncpy(chptr->topic, topic, TOPICLEN); - ircd_strncpy(chptr->topic_nick, sptr->name, NICKLEN); + ircd_strncpy(chptr->topic_nick, cli_name(sptr), NICKLEN); chptr->topic_time = CurrentTime; /* Fixed in 2.10.11: Don't propergate local topics */ if (!IsLocalChannel(chptr->chname)) diff --git a/ircd/m_trace.c b/ircd/m_trace.c index 01f7239..d35a270 100644 --- a/ircd/m_trace.c +++ b/ircd/m_trace.c @@ -130,7 +130,7 @@ int m_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* just "TRACE" without parameters. Must be from local client */ parc = 1; acptr = &me; - tname = me.name; + tname = cli_name(&me); i = HUNTED_ISME; } else if (parc < 3 || BadPtr(parv[2])) { /* No target specified. Make one before propagating. */ @@ -139,9 +139,9 @@ int m_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if ((acptr = find_match_server(parv[1])) || ((acptr = FindClient(parv[1])) && !MyUser(acptr))) { if (IsUser(acptr)) - parv[2] = acptr->user->server->name; + parv[2] = cli_name(cli_user(acptr)->server); else - parv[2] = acptr->name; + parv[2] = cli_name(acptr); parc = 3; parv[3] = 0; if ((i = hunt_server_cmd(sptr, CMD_TRACE, cptr, IsServer(acptr), @@ -166,19 +166,14 @@ int m_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!acptr) acptr = next_client(GlobalClientList, tname); else - acptr = acptr->from; + acptr = cli_from(acptr); send_reply(sptr, RPL_TRACELINK, -#ifndef GODMODE - version, debugmode, tname, acptr ? acptr->from->name : "" -#else /* GODMODE */ - version, debugmode, tname, acptr ? acptr->from->name : "", - (acptr && acptr->from->serv) ? acptr->from->serv->timestamp : 0 -#endif /* GODMODE */ - ); /* I really could do without GODMODE */ + version, debugmode, tname, + acptr ? cli_name(cli_from(acptr)) : ""); return 0; } - doall = (parv[1] && (parc > 1)) ? !match(tname, me.name) : 1; + doall = (parv[1] && (parc > 1)) ? !match(tname, cli_name(&me)) : 1; wilds = !parv[1] || strchr(tname, '*') || strchr(tname, '?'); dow = wilds || doall; @@ -190,11 +185,11 @@ int m_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) link_s[i] = 0, link_u[i] = 0; if (doall) { - for (acptr = GlobalClientList; acptr; acptr = acptr->next) { + for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) { if (IsUser(acptr)) - link_u[acptr->from->fd]++; + link_u[cli_fd(cli_from(acptr))]++; else if (IsServer(acptr)) - link_s[acptr->from->fd]++; + link_s[cli_fd(cli_from(acptr))]++; } } @@ -208,20 +203,20 @@ int m_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsInvisible(acptr) && dow && !(MyConnect(sptr) && IsOper(sptr)) && !IsAnOper(acptr) && (acptr != sptr)) continue; - if (!doall && wilds && match(tname, acptr->name)) + if (!doall && wilds && match(tname, cli_name(acptr))) continue; - if (!dow && 0 != ircd_strcmp(tname, acptr->name)) + if (!dow && 0 != ircd_strcmp(tname, cli_name(acptr))) continue; conClass = get_client_class(acptr); - switch (acptr->status) { + switch (cli_status(acptr)) { case STAT_CONNECTING: - send_reply(sptr, RPL_TRACECONNECTING, conClass, acptr->name); + send_reply(sptr, RPL_TRACECONNECTING, conClass, cli_name(acptr)); cnt++; break; case STAT_HANDSHAKE: - send_reply(sptr, RPL_TRACEHANDSHAKE, conClass, acptr->name); + send_reply(sptr, RPL_TRACEHANDSHAKE, conClass, cli_name(acptr)); cnt++; break; case STAT_ME: @@ -244,11 +239,11 @@ int m_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsAnOper(acptr)) send_reply(sptr, RPL_TRACEOPERATOR, conClass, get_client_name(acptr, HIDE_IP), - CurrentTime - acptr->lasttime); + CurrentTime - cli_lasttime(acptr)); else send_reply(sptr, RPL_TRACEUSER, conClass, get_client_name(acptr, HIDE_IP), - CurrentTime - acptr->lasttime); + CurrentTime - cli_lasttime(acptr)); cnt++; } break; @@ -269,19 +264,19 @@ int m_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ case STAT_SERVER: - if (acptr->serv->user) + if (cli_serv(acptr)->user) send_reply(sptr, RPL_TRACESERVER, conClass, link_s[i], - link_u[i], acptr->name, - (*acptr->serv->by) ? acptr->serv->by : "*", - acptr->serv->user->username, acptr->serv->user->host, - CurrentTime - acptr->lasttime, - CurrentTime - acptr->serv->timestamp); + link_u[i], cli_name(acptr), + (*(cli_serv(acptr))->by) ? cli_serv(acptr)->by : "*", + cli_serv(acptr)->user->username, cli_serv(acptr)->user->host, + CurrentTime - cli_lasttime(acptr), + CurrentTime - cli_serv(acptr)->timestamp); else send_reply(sptr, RPL_TRACESERVER, conClass, link_s[i], - link_u[i], acptr->name, - (*acptr->serv->by) ? acptr->serv->by : "*", "*", - me.name, CurrentTime - acptr->lasttime, - CurrentTime - acptr->serv->timestamp); + link_u[i], cli_name(acptr), + (*(cli_serv(acptr))->by) ? cli_serv(acptr)->by : "*", "*", + cli_name(&me), CurrentTime - cli_lasttime(acptr), + CurrentTime - cli_serv(acptr)->timestamp); cnt++; break; default: /* We actually shouldn't come here, -msa */ @@ -297,9 +292,9 @@ int m_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!IsAnOper(sptr) || !cnt) { if (!cnt) /* let the user have some idea that its at the end of the trace */ - send_reply(sptr, RPL_TRACESERVER, 0, link_s[me.fd], - link_u[me.fd], "", *(me.serv->by) ? - me.serv->by : "*", "*", me.name, 0, 0); + send_reply(sptr, RPL_TRACESERVER, 0, link_s[cli_fd(&me)], + link_u[cli_fd(&me)], "", *(cli_serv(&me)->by) ? + cli_serv(&me)->by : "*", "*", cli_name(&me), 0, 0); return 0; } if (doall) { @@ -335,7 +330,7 @@ int ms_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* just "TRACE" without parameters. Must be from local client */ parc = 1; acptr = &me; - tname = me.name; + tname = cli_name(&me); i = HUNTED_ISME; } else if (parc < 3 || BadPtr(parv[2])) { /* No target specified. Make one before propagating. */ @@ -344,9 +339,9 @@ int ms_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if ((acptr = find_match_server(parv[1])) || ((acptr = FindClient(parv[1])) && !MyUser(acptr))) { if (IsUser(acptr)) - parv[2] = acptr->user->server->name; + parv[2] = cli_name(cli_user(acptr)->server); else - parv[2] = acptr->name; + parv[2] = cli_name(acptr); parc = 3; parv[3] = 0; @@ -372,19 +367,14 @@ int ms_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!acptr) acptr = next_client(GlobalClientList, tname); else - acptr = acptr->from; + acptr = cli_from(acptr); send_reply(sptr, RPL_TRACELINK, -#ifndef GODMODE - version, debugmode, tname, acptr ? acptr->from->name : "" -#else /* GODMODE */ - version, debugmode, tname, acptr ? acptr->from->name : "", - (acptr && acptr->from->serv) ? acptr->from->serv->timestamp : 0 -#endif /* GODMODE */ - ); /* I really could do without GODMODE */ + version, debugmode, tname, + acptr ? cli_name(cli_from(acptr)) : ""); return 0; } - doall = (parv[1] && (parc > 1)) ? !match(tname, me.name) : 1; + doall = (parv[1] && (parc > 1)) ? !match(tname, cli_name(&me)) : 1; wilds = !parv[1] || strchr(tname, '*') || strchr(tname, '?'); dow = wilds || doall; @@ -396,11 +386,11 @@ int ms_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) link_s[i] = 0, link_u[i] = 0; if (doall) { - for (acptr = GlobalClientList; acptr; acptr = acptr->next) { + for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) { if (IsUser(acptr)) - link_u[acptr->from->fd]++; + link_u[cli_fd(cli_from(acptr))]++; else if (IsServer(acptr)) - link_s[acptr->from->fd]++; + link_s[cli_fd(cli_from(acptr))]++; } } @@ -414,19 +404,19 @@ int ms_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsInvisible(acptr) && dow && !(MyConnect(sptr) && IsOper(sptr)) && !IsAnOper(acptr) && (acptr != sptr)) continue; - if (!doall && wilds && match(tname, acptr->name)) + if (!doall && wilds && match(tname, cli_name(acptr))) continue; - if (!dow && 0 != ircd_strcmp(tname, acptr->name)) + if (!dow && 0 != ircd_strcmp(tname, cli_name(acptr))) continue; conClass = get_client_class(acptr); - switch (acptr->status) { + switch (cli_status(acptr)) { case STAT_CONNECTING: - send_reply(sptr, RPL_TRACECONNECTING, conClass, acptr->name); + send_reply(sptr, RPL_TRACECONNECTING, conClass, cli_name(acptr)); cnt++; break; case STAT_HANDSHAKE: - send_reply(sptr, RPL_TRACEHANDSHAKE, conClass, acptr->name); + send_reply(sptr, RPL_TRACEHANDSHAKE, conClass, cli_name(acptr)); cnt++; break; case STAT_ME: @@ -449,11 +439,11 @@ int ms_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsAnOper(acptr)) send_reply(sptr, RPL_TRACEOPERATOR, conClass, get_client_name(acptr, HIDE_IP), - CurrentTime - acptr->lasttime); + CurrentTime - cli_lasttime(acptr)); else send_reply(sptr, RPL_TRACEUSER, conClass, get_client_name(acptr, HIDE_IP), - CurrentTime - acptr->lasttime); + CurrentTime - cli_lasttime(acptr)); cnt++; } break; @@ -474,19 +464,19 @@ int ms_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ case STAT_SERVER: - if (acptr->serv->user) + if (cli_serv(acptr)->user) send_reply(sptr, RPL_TRACESERVER, conClass, link_s[i], - link_u[i], acptr->name, - (*acptr->serv->by) ? acptr->serv->by : "*", - acptr->serv->user->username, acptr->serv->user->host, - CurrentTime - acptr->lasttime, - CurrentTime - acptr->serv->timestamp); + link_u[i], cli_name(acptr), + (*(cli_serv(acptr))->by) ? cli_serv(acptr)->by : "*", + cli_serv(acptr)->user->username, cli_serv(acptr)->user->host, + CurrentTime - cli_lasttime(acptr), + CurrentTime - cli_serv(acptr)->timestamp); else send_reply(sptr, RPL_TRACESERVER, conClass, link_s[i], - link_u[i], acptr->name, - (*acptr->serv->by) ? acptr->serv->by : "*", "*", - me.name, CurrentTime - acptr->lasttime, - CurrentTime - acptr->serv->timestamp); + link_u[i], cli_name(acptr), + (*(cli_serv(acptr))->by) ? cli_serv(acptr)->by : "*", "*", + cli_name(&me), CurrentTime - cli_lasttime(acptr), + CurrentTime - cli_serv(acptr)->timestamp); cnt++; break; default: /* We actually shouldn't come here, -msa */ @@ -502,9 +492,9 @@ int ms_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!IsAnOper(sptr) || !cnt) { if (!cnt) /* let the user have some idea that its at the end of the trace */ - send_reply(sptr, RPL_TRACESERVER, 0, link_s[me.fd], - link_u[me.fd], "", *(me.serv->by) ? - me.serv->by : "*", "*", me.name, 0, 0); + send_reply(sptr, RPL_TRACESERVER, 0, link_s[cli_fd(&me)], + link_u[cli_fd(&me)], "", *(cli_serv(&me)->by) ? + cli_serv(&me)->by : "*", "*", cli_name(&me), 0, 0); return 0; } if (doall) { @@ -540,7 +530,7 @@ int mo_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* just "TRACE" without parameters. Must be from local client */ parc = 1; acptr = &me; - tname = me.name; + tname = cli_name(&me); i = HUNTED_ISME; } else if (parc < 3 || BadPtr(parv[2])) { /* No target specified. Make one before propagating. */ @@ -549,9 +539,9 @@ int mo_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if ((acptr = find_match_server(parv[1])) || ((acptr = FindClient(parv[1])) && !MyUser(acptr))) { if (IsUser(acptr)) - parv[2] = acptr->user->server->name; + parv[2] = cli_name(cli_user(acptr)->server); else - parv[2] = acptr->name; + parv[2] = cli_name(acptr); parc = 3; parv[3] = 0; if ((i = hunt_server_cmd(sptr, CMD_TRACE, cptr, IsServer(acptr), @@ -576,19 +566,14 @@ int mo_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!acptr) acptr = next_client(GlobalClientList, tname); else - acptr = acptr->from; + acptr = cli_from(acptr); send_reply(sptr, RPL_TRACELINK, -#ifndef GODMODE - version, debugmode, tname, acptr ? acptr->from->name : "" -#else /* GODMODE */ - version, debugmode, tname, acptr ? acptr->from->name : "", - (acptr && acptr->from->serv) ? acptr->from->serv->timestamp : 0 -#endif /* GODMODE */ - ); /* I really could do without GODMODE */ + version, debugmode, tname, + acptr ? cli_name(cli_from(acptr)) : ""); return 0; } - doall = (parv[1] && (parc > 1)) ? !match(tname, me.name) : 1; + doall = (parv[1] && (parc > 1)) ? !match(tname, cli_name(&me)) : 1; wilds = !parv[1] || strchr(tname, '*') || strchr(tname, '?'); dow = wilds || doall; @@ -600,11 +585,11 @@ int mo_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) link_s[i] = 0, link_u[i] = 0; if (doall) { - for (acptr = GlobalClientList; acptr; acptr = acptr->next) { + for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) { if (IsUser(acptr)) - link_u[acptr->from->fd]++; + link_u[cli_fd(cli_from(acptr))]++; else if (IsServer(acptr)) - link_s[acptr->from->fd]++; + link_s[cli_fd(cli_from(acptr))]++; } } @@ -618,19 +603,19 @@ int mo_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsInvisible(acptr) && dow && !(MyConnect(sptr) && IsOper(sptr)) && !IsAnOper(acptr) && (acptr != sptr)) continue; - if (!doall && wilds && match(tname, acptr->name)) + if (!doall && wilds && match(tname, cli_name(acptr))) continue; - if (!dow && 0 != ircd_strcmp(tname, acptr->name)) + if (!dow && 0 != ircd_strcmp(tname, cli_name(acptr))) continue; conClass = get_client_class(acptr); - switch (acptr->status) { + switch (cli_status(acptr)) { case STAT_CONNECTING: - send_reply(sptr, RPL_TRACECONNECTING, conClass, acptr->name); + send_reply(sptr, RPL_TRACECONNECTING, conClass, cli_name(acptr)); cnt++; break; case STAT_HANDSHAKE: - send_reply(sptr, RPL_TRACEHANDSHAKE, conClass, acptr->name); + send_reply(sptr, RPL_TRACEHANDSHAKE, conClass, cli_name(acptr)); cnt++; break; case STAT_ME: @@ -653,11 +638,11 @@ int mo_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsAnOper(acptr)) send_reply(sptr, RPL_TRACEOPERATOR, conClass, get_client_name(acptr, HIDE_IP), - CurrentTime - acptr->lasttime); + CurrentTime - cli_lasttime(acptr)); else send_reply(sptr, RPL_TRACEUSER, conClass, get_client_name(acptr, HIDE_IP), - CurrentTime - acptr->lasttime); + CurrentTime - cli_lasttime(acptr)); cnt++; } break; @@ -678,19 +663,19 @@ int mo_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ case STAT_SERVER: - if (acptr->serv->user) + if (cli_serv(acptr)->user) send_reply(sptr, RPL_TRACESERVER, conClass, link_s[i], - link_u[i], acptr->name, - (*acptr->serv->by) ? acptr->serv->by : "*", - acptr->serv->user->username, acptr->serv->user->host, - CurrentTime - acptr->lasttime, - CurrentTime - acptr->serv->timestamp); + link_u[i], cli_name(acptr), + (*(cli_serv(acptr))->by) ? cli_serv(acptr)->by : "*", + cli_serv(acptr)->user->username, cli_serv(acptr)->user->host, + CurrentTime - cli_lasttime(acptr), + CurrentTime - cli_serv(acptr)->timestamp); else send_reply(sptr, RPL_TRACESERVER, conClass, link_s[i], - link_u[i], acptr->name, - (*acptr->serv->by) ? acptr->serv->by : "*", "*", - me.name, CurrentTime - acptr->lasttime, - CurrentTime - acptr->serv->timestamp); + link_u[i], cli_name(acptr), + (*(cli_serv(acptr))->by) ? cli_serv(acptr)->by : "*", "*", + cli_name(&me), CurrentTime - cli_lasttime(acptr), + CurrentTime - cli_serv(acptr)->timestamp); cnt++; break; default: /* We actually shouldn't come here, -msa */ @@ -706,9 +691,9 @@ int mo_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!IsAnOper(sptr) || !cnt) { if (!cnt) /* let the user have some idea that its at the end of the trace */ - send_reply(sptr, RPL_TRACESERVER, 0, link_s[me.fd], - link_u[me.fd], "", *(me.serv->by) ? - me.serv->by : "*", "*", me.name, 0, 0); + send_reply(sptr, RPL_TRACESERVER, 0, link_s[cli_fd(&me)], + link_u[cli_fd(&me)], "", *(cli_serv(&me)->by) ? + cli_serv(&me)->by : "*", "*", cli_name(&me), 0, 0); return 0; } if (doall) { diff --git a/ircd/m_uping.c b/ircd/m_uping.c index 0c65dca..de45e31 100644 --- a/ircd/m_uping.c +++ b/ircd/m_uping.c @@ -193,12 +193,12 @@ int mo_uping(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (parc == 2) { parv[parc++] = UDP_PORT; - parv[parc++] = me.name; + parv[parc++] = cli_name(&me); parv[parc++] = "5"; } else if (parc == 3) { if (IsDigit(*parv[2])) - parv[parc++] = me.name; + parv[parc++] = cli_name(&me); else { parv[parc++] = parv[2]; parv[2] = UDP_PORT; @@ -209,7 +209,7 @@ int mo_uping(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (IsDigit(*parv[2])) { if (IsDigit(*parv[3])) { parv[parc++] = parv[3]; - parv[3] = me.name; + parv[3] = cli_name(&me); } else parv[parc++] = "5"; diff --git a/ircd/m_user.c b/ircd/m_user.c index ad0ce75..38f5026 100644 --- a/ircd/m_user.c +++ b/ircd/m_user.c @@ -152,24 +152,24 @@ int m_user(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) user = make_user(cptr); if (!strchr(umode, '.')) /* Not an IP# as hostname ? */ - cptr->flags |= (UFLAGS & atoi(umode)); + cli_flags(cptr) |= (UFLAGS & atoi(umode)); - if ((cptr->flags & FLAGS_SERVNOTICE)) + if ((cli_flags(cptr) & FLAGS_SERVNOTICE)) set_snomask(cptr, (IsDigit(*snomask) && !strchr(snomask, '.')) ? (atoi(snomask) & SNO_USER) : SNO_DEFAULT, SNO_SET); user->server = &me; - ircd_strncpy(cptr->info, info, REALLEN); + ircd_strncpy(cli_info(cptr), info, REALLEN); - if (cptr->name[0] && cptr->cookie == COOKIE_VERIFIED) { + if ((cli_name(cptr))[0] && cli_cookie(cptr) == COOKIE_VERIFIED) { /* * NICK and PONG already received, now we have USER... */ - return register_user(cptr, sptr, sptr->name, username, 0); + return register_user(cptr, sptr, cli_name(sptr), username, 0); } else { ircd_strncpy(user->username, username, USERLEN); - ircd_strncpy(user->host, cptr->sockhost, HOSTLEN); + ircd_strncpy(user->host, cli_sockhost(cptr), HOSTLEN); } return 0; } diff --git a/ircd/m_userhost.c b/ircd/m_userhost.c index c59e335..d8ffb95 100644 --- a/ircd/m_userhost.c +++ b/ircd/m_userhost.c @@ -100,9 +100,9 @@ static void userhost_formatter(struct Client* cptr, struct MsgBuf* mb) { assert(IsUser(cptr)); - msgq_append(0, mb, "%s%s=%c%s@%s", cptr->name, IsAnOper(cptr) ? "*" : "", - cptr->user->away ? '-' : '+', cptr->user->username, - cptr->user->host); + msgq_append(0, mb, "%s%s=%c%s@%s", cli_name(cptr), IsAnOper(cptr) ? "*" : "", + cli_user(cptr)->away ? '-' : '+', cli_user(cptr)->username, + cli_user(cptr)->host); } /* diff --git a/ircd/m_userip.c b/ircd/m_userip.c index c7b5e01..4fa321d 100644 --- a/ircd/m_userip.c +++ b/ircd/m_userip.c @@ -100,9 +100,9 @@ static void userip_formatter(struct Client* cptr, struct MsgBuf* mb) { assert(IsUser(cptr)); - msgq_append(0, mb, "%s%s=%c%s@%s", cptr->name, IsAnOper(cptr) ? "*" : "", - cptr->user->away ? '-' : '+', cptr->user->username, - ircd_ntoa((const char*) &cptr->ip)); + msgq_append(0, mb, "%s%s=%c%s@%s", cli_name(cptr), IsAnOper(cptr) ? "*" : "", + cli_user(cptr)->away ? '-' : '+', cli_user(cptr)->username, + ircd_ntoa((const char*) &(cli_ip(cptr)))); } /* diff --git a/ircd/m_version.c b/ircd/m_version.c index aa303fb..6bbc795 100644 --- a/ircd/m_version.c +++ b/ircd/m_version.c @@ -120,7 +120,7 @@ int m_version(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) send_reply(sptr, ERR_NOSUCHSERVER, parv[1]); return 0; } - parv[1] = acptr->name; + parv[1] = cli_name(acptr); } if (hunt_server_cmd(sptr, CMD_VERSION, cptr, 0, ":%C", 1, parc, parv) == @@ -130,7 +130,7 @@ int m_version(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) sprintf_irc(featurebuf,FEATURES,FEATURESVALUES); - send_reply(sptr, RPL_VERSION, version, debugmode, me.name, serveropts); + send_reply(sptr, RPL_VERSION, version, debugmode, cli_name(&me), serveropts); send_reply(sptr, RPL_ISUPPORT, featurebuf); } @@ -154,13 +154,13 @@ int ms_version(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) send_reply(sptr, ERR_NOSUCHSERVER, parv[1]); return 0; } - parv[1] = acptr->name; + parv[1] = cli_name(acptr); } if (hunt_server_cmd(sptr, CMD_VERSION, cptr, 0, ":%C", 1, parc, parv) == HUNTED_ISME) { - send_reply(sptr, RPL_VERSION, version, debugmode, me.name, serveropts); + send_reply(sptr, RPL_VERSION, version, debugmode, cli_name(&me), serveropts); } return 0; diff --git a/ircd/m_wallchops.c b/ircd/m_wallchops.c index da53c90..6fa55c1 100644 --- a/ircd/m_wallchops.c +++ b/ircd/m_wallchops.c @@ -111,7 +111,7 @@ int m_wallchops(struct Client* cptr, struct Client* sptr, int parc, char* parv[] assert(0 != cptr); assert(cptr == sptr); - sptr->flags &= ~FLAGS_TS8; + cli_flags(sptr) &= ~FLAGS_TS8; if (parc < 2 || EmptyString(parv[1])) return send_reply(sptr, ERR_NORECIPIENT, "WALLCHOPS"); diff --git a/ircd/m_who.c b/ircd/m_who.c index eb9e543..dd31cf1 100644 --- a/ircd/m_who.c +++ b/ircd/m_who.c @@ -119,15 +119,15 @@ static void move_marker(void) struct Client *cptr = GlobalClientList; while (cptr) { - cptr->marker = 0; - cptr = cptr->next; + cli_marker(cptr) = 0; + cptr = cli_next(cptr); } who_marker++; } } #define CheckMark(x, y) ((x == y) ? 0 : (x = y)) -#define Process(cptr) CheckMark(cptr->marker, who_marker) +#define Process(cptr) CheckMark(cli_marker(cptr), who_marker) /* * m_who - generic message handler @@ -369,7 +369,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if ((!(counter < 1)) && matchsel) { struct Membership* member; struct Membership* chan; - for (chan = sptr->user->channel; chan; chan = chan->next_channel) { + for (chan = cli_user(sptr)->channel; chan; chan = chan->next_channel) { chptr = chan->channel; for (member = chptr->members; member; member = member->next_member) { @@ -381,19 +381,19 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) continue; if ((mask) && ((!(matchsel & WHO_FIELD_NIC)) - || matchexec(acptr->name, mymask, minlen)) + || matchexec(cli_name(acptr), mymask, minlen)) && ((!(matchsel & WHO_FIELD_UID)) - || matchexec(acptr->user->username, mymask, minlen)) + || matchexec(cli_user(acptr)->username, mymask, minlen)) && ((!(matchsel & WHO_FIELD_SER)) - || (!(acptr->user->server->flags & FLAGS_MAP))) + || (!(cli_flags(cli_user(acptr)->server) & FLAGS_MAP))) && ((!(matchsel & WHO_FIELD_HOS)) - || matchexec(acptr->user->host, mymask, minlen)) + || matchexec(cli_user(acptr)->host, mymask, minlen)) && ((!(matchsel & WHO_FIELD_REN)) - || matchexec(acptr->info, mymask, minlen)) + || matchexec(cli_info(acptr), mymask, minlen)) && ((!(matchsel & WHO_FIELD_NIP)) - || ((((acptr->ip.s_addr & imask.mask.s_addr) != + || ((((cli_ip(acptr).s_addr & imask.mask.s_addr) != imask.bits.s_addr)) || (imask.fall - && matchexec(ircd_ntoa((const char*) &acptr->ip), mymask, minlen))))) + && matchexec(ircd_ntoa((const char*) &(cli_ip(acptr))), mymask, minlen))))) continue; if (!SHOW_MORE(sptr, counter)) break; @@ -404,7 +404,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* Loop through all clients :-\, if we still have something to match to and we can show more clients */ if ((!(counter < 1)) && matchsel) - for (acptr = me.prev; acptr; acptr = acptr->prev) + for (acptr = cli_prev(&me); acptr; acptr = cli_prev(acptr)) { if (!(IsUser(acptr) && Process(acptr))) continue; @@ -414,19 +414,19 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) continue; if ((mask) && ((!(matchsel & WHO_FIELD_NIC)) - || matchexec(acptr->name, mymask, minlen)) + || matchexec(cli_name(acptr), mymask, minlen)) && ((!(matchsel & WHO_FIELD_UID)) - || matchexec(acptr->user->username, mymask, minlen)) + || matchexec(cli_user(acptr)->username, mymask, minlen)) && ((!(matchsel & WHO_FIELD_SER)) - || (!(acptr->user->server->flags & FLAGS_MAP))) + || (!(cli_flags(cli_user(acptr)->server) & FLAGS_MAP))) && ((!(matchsel & WHO_FIELD_HOS)) - || matchexec(acptr->user->host, mymask, minlen)) + || matchexec(cli_user(acptr)->host, mymask, minlen)) && ((!(matchsel & WHO_FIELD_REN)) - || matchexec(acptr->info, mymask, minlen)) + || matchexec(cli_info(acptr), mymask, minlen)) && ((!(matchsel & WHO_FIELD_NIP)) - || ((((acptr->ip.s_addr & imask.mask.s_addr) != imask.bits.s_addr)) + || ((((cli_ip(acptr).s_addr & imask.mask.s_addr) != imask.bits.s_addr)) || (imask.fall - && matchexec(ircd_ntoa((const char*) &acptr->ip), mymask, minlen))))) + && matchexec(ircd_ntoa((const char*) &(cli_ip(acptr))), mymask, minlen))))) continue; if (!SHOW_MORE(sptr, counter)) break; diff --git a/ircd/m_whois.c b/ircd/m_whois.c index eb041e1..9c6ea1b 100644 --- a/ircd/m_whois.c +++ b/ircd/m_whois.c @@ -139,18 +139,18 @@ static void do_whois(struct Client* sptr, struct Client *acptr) int len; static char buf[512]; - const struct User* user = acptr->user; - const char* name = (!*acptr->name) ? "?" : acptr->name; + const struct User* user = cli_user(acptr); + const char* name = (!*(cli_name(acptr))) ? "?" : cli_name(acptr); a2cptr = user->server; assert(user); send_reply(sptr, RPL_WHOISUSER, name, user->username, user->host, - acptr->info); + cli_info(acptr)); /* Display the channels this user is on. */ if (!IsChannelService(acptr)) { struct Membership* chan; - mlen = strlen(me.name) + strlen(sptr->name) + 12 + strlen(name); + mlen = strlen(cli_name(&me)) + strlen(cli_name(sptr)) + 12 + strlen(name); len = 0; *buf = '\0'; for (chan = user->channel; chan; chan = chan->next_channel) @@ -187,7 +187,7 @@ static void do_whois(struct Client* sptr, struct Client *acptr) if (buf[0] != '\0') send_reply(sptr, RPL_WHOISCHANNELS, name, buf); } - send_reply(sptr, RPL_WHOISSERVER, name, a2cptr->name, a2cptr->info); + send_reply(sptr, RPL_WHOISSERVER, name, cli_name(a2cptr), cli_info(a2cptr)); if (user) { @@ -203,7 +203,7 @@ static void do_whois(struct Client* sptr, struct Client *acptr) if (MyConnect(acptr)) send_reply(sptr, RPL_WHOISIDLE, name, CurrentTime - user->last, - acptr->firsttime); + cli_firsttime(acptr)); } } @@ -225,7 +225,7 @@ static int do_wilds(struct Client* sptr,char *nick,int count) /* Ech! This is hidious! */ for (acptr = GlobalClientList; (acptr = next_client(acptr, nick)); - acptr = acptr->next) + acptr = cli_next(acptr)) { if (!IsRegistered(acptr)) continue; @@ -239,7 +239,7 @@ static int do_wilds(struct Client* sptr,char *nick,int count) * hack? */ if (IsMe(acptr)) { - assert(!acptr->next); + assert(!cli_next(acptr)); break; } @@ -253,8 +253,8 @@ static int do_wilds(struct Client* sptr,char *nick,int count) * - only send replies about common or public channels * the target user(s) are on; */ - user = acptr->user; - name = (!*acptr->name) ? "?" : acptr->name; + user = cli_user(acptr); + name = (!*(cli_name(acptr))) ? "?" : cli_name(acptr); assert(user); invis = (acptr != sptr) && IsInvisible(acptr); @@ -349,7 +349,7 @@ int m_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ acptr = FindUser(parv[1]); if (acptr) - parv[1] = acptr->user->server->name; + parv[1] = cli_name(cli_user(acptr)->server); if (hunt_server_cmd(sptr, CMD_WHOIS, cptr, 0, "%C :%s", 1, parc, parv) != HUNTED_ISME) return 0; @@ -426,7 +426,7 @@ int ms_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ acptr = FindUser(parv[1]); if (acptr) - parv[1] = acptr->user->server->name; + parv[1] = cli_name(cli_user(acptr)->server); if (hunt_server_cmd(sptr, CMD_WHOIS, cptr, 0, "%C :%s", 1, parc, parv) != HUNTED_ISME) return 0; diff --git a/ircd/parse.c b/ircd/parse.c index 64893c8..b718827 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -861,7 +861,7 @@ int parse_client(struct Client *cptr, char *buffer, char *bufend) i = bufend - ((s) ? s : ch); mptr->bytes += i; if ((mptr->flags & MFLG_SLOW)) - cptr->since += (2 + i / 120); + cli_since(cptr) += (2 + i / 120); /* * Allow only 1 msg per 2 seconds * (on average) to prevent dumping. diff --git a/ircd/res.c b/ircd/res.c index 7d92105..fea222e 100644 --- a/ircd/res.c +++ b/ircd/res.c @@ -332,12 +332,12 @@ static void start_resolver(void) ResolverFileDescriptor = socket(AF_INET, SOCK_DGRAM, 0); if (-1 == ResolverFileDescriptor) { report_error("Resolver: error creating socket for %s: %s", - me.name, errno); + cli_name(&me), errno); return; } if (!os_set_nonblocking(ResolverFileDescriptor)) report_error("Resolver: error setting non-blocking for %s: %s", - me.name, errno); + cli_name(&me), errno); } } diff --git a/ircd/s_auth.c b/ircd/s_auth.c index f521649..9b1457b 100644 --- a/ircd/s_auth.c +++ b/ircd/s_auth.c @@ -92,7 +92,7 @@ typedef enum { } ReportType; #define sendheader(c, r) \ - send((c)->fd, HeaderMessages[(r)].message, HeaderMessages[(r)].length, 0) + send(cli_fd(c), HeaderMessages[(r)].message, HeaderMessages[(r)].length, 0) struct AuthRequest* AuthPollList = 0; /* GLOBAL - auth queries pending io */ static struct AuthRequest* AuthIncompleteList = 0; @@ -523,7 +523,7 @@ void start_auth(struct Client* client) #if !defined(NODNS) if (LOOPBACK == inet_netof(cli_ip(client))) { - strcpy(client->sockhost, cli_name(&me)); + strcpy(cli_sockhost(client), cli_name(&me)); } else { struct DNSQuery query; @@ -534,7 +534,7 @@ void start_auth(struct Client* client) if (IsUserPort(auth->client)) sendheader(client, REPORT_DO_DNS); - client->dns_reply = gethost_byaddr((const char*) &(cli_ip(client)), &query); + cli_dns_reply(client) = gethost_byaddr((const char*) &(cli_ip(client)), &query); if (cli_dns_reply(client)) { ++(cli_dns_reply(client))->ref_count; diff --git a/ircd/s_bsd.c b/ircd/s_bsd.c index 949a02a..e66a9d9 100644 --- a/ircd/s_bsd.c +++ b/ircd/s_bsd.c @@ -482,7 +482,7 @@ void close_connection(struct Client *cptr) * CONF_ILLEGAL). But only do this if it was a "good" link. */ aconf->hold = CurrentTime; - aconf->hold += (aconf->hold - cptr->since > HANGONGOODLINK) ? + aconf->hold += (aconf->hold - cli_since(cptr) > HANGONGOODLINK) ? HANGONRETRYDELAY : ConfConFreq(aconf); if (nextconnect > aconf->hold) nextconnect = aconf->hold; @@ -698,7 +698,7 @@ static int read_packet(struct Client *cptr, int socket_ready) */ if (0 == dolen) { if (DBufLength(&(cli_recvQ(cptr))) < 510) - cptr->flags |= FLAGS_NONL; + cli_flags(cptr) |= FLAGS_NONL; else DBufClear(&(cli_recvQ(cptr))); } @@ -1399,8 +1399,8 @@ int connect_server(struct ConfItem* aconf, struct Client* by, if (by && IsUser(by)) { sprintf_irc(cli_serv(cptr)->by, "%s%s", NumNick(by)); assert(0 == cli_serv(cptr)->user); - cli_serv(cptr)->user = by->user; - by->user->refcnt++; + cli_serv(cptr)->user = cli_user(by); + cli_user(by)->refcnt++; } else { *(cli_serv(cptr))->by = '\0'; diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 4be9c2a..24f2798 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -424,7 +424,7 @@ static int is_attached(struct ConfItem *aconf, struct Client *cptr) { struct SLink *lp; - for (lp = cptr->confs; lp; lp = lp->next) { + for (lp = cli_confs(cptr); lp; lp = lp->next) { if (lp->value.aconf == aconf) return 1; } @@ -451,9 +451,9 @@ enum AuthorizationCheckResult attach_conf(struct Client *cptr, struct ConfItem * ConfLinks(aconf) >= ConfMaxLinks(aconf) && ConfMaxLinks(aconf) > 0) return ACR_TOO_MANY_IN_CLASS; /* Use this for printing error message */ lp = make_link(); - lp->next = cptr->confs; + lp->next = cli_confs(cptr); lp->value.aconf = aconf; - cptr->confs = lp; + cli_confs(cptr) = lp; ++aconf->clients; if (aconf->status & CONF_CLIENT_MASK) ConfLinks(aconf)++; @@ -1313,7 +1313,7 @@ int rehash(struct Client *cptr, int sig) if (IsServer(acptr)) { det_confs_butmask(acptr, ~(CONF_HUB | CONF_LEAF | CONF_UWORLD | CONF_ILLEGAL)); - attach_confs_byname(acptr, acptr->name, + attach_confs_byname(acptr, cli_name(acptr), CONF_HUB | CONF_LEAF | CONF_UWORLD); } /* Because admin's are getting so uppity about people managing to diff --git a/ircd/s_misc.c b/ircd/s_misc.c index 90c5b3b..d77caa8 100644 --- a/ircd/s_misc.c +++ b/ircd/s_misc.c @@ -327,7 +327,7 @@ static void exit_downlinks(struct Client *cptr, struct Client *sptr, char *comme /* Remove the downlinks and client of the downlink */ exit_downlinks(acptr, sptr, comment); /* Remove the downlink itself */ - exit_one_client(acptr, me.name); + exit_one_client(acptr, cli_name(&me)); } /* Remove all clients of this server */ acptrp = cli_serv(cptr)->client_list; diff --git a/ircd/s_user.c b/ircd/s_user.c index af86cdf..ea7b01f 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -524,7 +524,7 @@ int register_user(struct Client *cptr, struct Client *sptr, else if ((!lower && !upper) || !IsAlnum(c)) badid = 1; } - if (badid && (!(sptr->flags & FLAGS_GOTID) || + if (badid && (!(cli_flags(sptr) & FLAGS_GOTID) || strcmp(cli_username(sptr), username) != 0)) { ServerStats->is_ref++; @@ -576,7 +576,7 @@ int register_user(struct Client *cptr, struct Client *sptr, update_load(); motd_signon(sptr); nextping = CurrentTime; - if (sptr->snomask & SNO_NOISY) + if (cli_snomask(sptr) & SNO_NOISY) set_snomask(sptr, cli_snomask(sptr) & SNO_NOISY, SNO_ADD); IPcheck_connect_succeeded(sptr); } @@ -812,7 +812,7 @@ int set_nick_name(struct Client* cptr, struct Client* sptr, do { cli_cookie(sptr) = (ircrandom() & 0x7fffffff); } while (!cli_cookie(sptr)); - sendrawto_one(cptr, MSG_PING " :%u", sptr->cookie); + sendrawto_one(cptr, MSG_PING " :%u", cli_cookie(sptr)); } else if (*(cli_user(sptr))->host && cli_cookie(sptr) == COOKIE_VERIFIED) { /* @@ -1305,7 +1305,7 @@ void send_umode(struct Client *cptr, struct Client *sptr, int old, int sendmask) *m++ = userModeList[i].c; } } - else if (!(flag & old) && (sptr->flags & flag)) + else if (!(flag & old) && (cli_flags(sptr) & flag)) { if (what == MODE_ADD) *m++ = userModeList[i].c; diff --git a/ircd/send.c b/ircd/send.c index f05d044..828c4e0 100644 --- a/ircd/send.c +++ b/ircd/send.c @@ -151,7 +151,7 @@ void send_queued(struct Client *to) if ((len = deliver_it(to, &(cli_sendQ(to))))) { msgq_delete(&(cli_sendQ(to)), len); - to->lastsq = MsgQLength(&(cli_sendQ(to))) / 1024; + cli_lastsq(to) = MsgQLength(&(cli_sendQ(to))) / 1024; if (IsBlocked(to)) break; } @@ -303,7 +303,7 @@ void sendcmdto_serv_butone(struct Client *from, const char *cmd, va_end(vd.vd_args); /* send it to our downlinks */ - for (lp = me.serv->down; lp; lp = lp->next) { + for (lp = cli_serv(&me)->down; lp; lp = lp->next) { if (one && lp->value.cptr == cli_from(one)) continue; send_buffer(lp->value.cptr, mb, 0); @@ -558,7 +558,7 @@ void sendcmdto_match_butone(struct Client *from, const char *cmd, /* send buffer along */ sentalong_marker++; - for (cptr = GlobalClientList; cptr; cptr = cptr->next) { + for (cptr = GlobalClientList; cptr; cptr = cli_next(cptr)) { if (cli_from(cptr) == one || IsServer(cptr) || IsMe(cptr) || !match_it(cptr, to, who) || cli_fd(cli_from(cptr)) < 0 || sentalong[cli_fd(cli_from(cptr))] == sentalong_marker) @@ -612,7 +612,8 @@ void vsendto_opmask_butone(struct Client *one, unsigned int mask, */ vd.vd_format = pattern; vd.vd_args = vl; - mb = msgq_make(0, ":%s " MSG_NOTICE " * :*** Notice -- %v", me.name, &vd); + mb = msgq_make(0, ":%s " MSG_NOTICE " * :*** Notice -- %v", cli_name(&me), + &vd); for (; opslist; opslist = opslist->next) send_buffer(opslist->value.cptr, mb, 0); diff --git a/ircd/uping.c b/ircd/uping.c index 83f8a23..3db630d 100644 --- a/ircd/uping.c +++ b/ircd/uping.c @@ -362,7 +362,7 @@ void uping_cancel(struct Client *sptr, struct Client* acptr) struct UPing* ping; struct UPing* ping_next; - Debug((DEBUG_DEBUG, "UPING: cancelling uping for %s", sptr->name)); + Debug((DEBUG_DEBUG, "UPING: cancelling uping for %s", cli_name(sptr))); for (ping = pingList; ping; ping = ping_next) { ping_next = ping->next; if (sptr == ping->client) { diff --git a/ircd/whowas.c b/ircd/whowas.c index b8b12f3..61774d7 100644 --- a/ircd/whowas.c +++ b/ircd/whowas.c @@ -191,7 +191,7 @@ void add_history(struct Client *cptr, int still_on) /* Should be changed to server numeric */ DupString(ww.newww->servername, cli_name(cli_user(cptr)->server)); DupString(ww.newww->realname, cli_info(cptr)); - if (cptr->user->away) + if (cli_user(cptr)->away) DupString(ww.newww->away, cli_user(cptr)->away); else ww.newww->away = NULL;