X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fm_server.c;h=1e38d39746079a768573c3e51e432d62175c62a0;hb=2a6a833ef097f5c53726ddd6b59b5643bfa18143;hp=934fd3accb643081762d35eaa4cee414a33ff37f;hpb=f768be2cae6867f20836584d8412bee18da5f4a6;p=ircu2.10.12-pk.git diff --git a/ircd/m_server.c b/ircd/m_server.c index 934fd3a..1e38d39 100644 --- a/ircd/m_server.c +++ b/ircd/m_server.c @@ -204,7 +204,7 @@ check_loop_and_lh(struct Client* cptr, struct Client *sptr, time_t *ghost, const } /* * Avoid other nick collisions... - * This is a doubtfull test though, what else would it be + * This is a doubtful test though, what else would it be * when it has a server.name ? */ else if (!IsServer(acptr) && !IsHandshake(acptr)) @@ -407,14 +407,14 @@ check_loop_and_lh(struct Client* cptr, struct Client *sptr, time_t *ghost, const if (active_lh_line == 1) { if (exit_client_msg(cptr, LHcptr, &me, - "Leaf-only link %s <- %s, check L:", + "Maximum hops exceeded for %s at %s", cli_name(cptr), host) == CPTR_KILLED) return CPTR_KILLED; } else if (active_lh_line == 2) { if (exit_client_msg(cptr, LHcptr, &me, - "Non-Hub link %s <- %s, check H:", + "%s is not allowed to hub for %s", cli_name(cptr), host) == CPTR_KILLED) return CPTR_KILLED; } @@ -424,11 +424,8 @@ check_loop_and_lh(struct Client* cptr, struct Client *sptr, time_t *ghost, const if (exit_client(cptr, LHcptr, &me, "I'm a leaf, define HUB") == CPTR_KILLED) return CPTR_KILLED; } - /* - * Did we kill the incoming server off already ? - */ - if (killed) - return 0; + /* We just squit somebody, and it wasn't cptr. */ + return 0; } return 1; @@ -479,6 +476,20 @@ check_start_timestamp(struct Client *cptr, time_t timestamp, time_t start_timest } } +/** Interpret a server's flags. + * + * @param[in] cptr New server structure. + * @param[in] flags String listing server's P10 flags. + */ +void set_server_flags(struct Client *cptr, const char *flags) +{ + while (*flags) switch (*flags++) { + case 'h': SetHub(cptr); break; + case 's': SetService(cptr); break; + case '6': SetIPv6(cptr); break; + } +} + /** Handle a SERVER message from an unregistered connection. * * \a parv has the following elements: @@ -499,7 +510,6 @@ check_start_timestamp(struct Client *cptr, time_t timestamp, time_t start_timest */ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { - char* ch; char* host; struct ConfItem* aconf; struct Jupe* ajupe; @@ -577,7 +587,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) log_write(LS_NETWORK, L_NOTICE, LOG_NOSNOTICE, "Received unauthorized " "connection from %C [%s]", cptr, ircd_ntoa(&cli_ip(cptr))); - return exit_client(cptr, cptr, &me, "No C:line"); + return exit_client(cptr, cptr, &me, "No Connect block"); } host = cli_name(cptr); @@ -610,22 +620,15 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) cli_serv(cptr)->timestamp = timestamp; cli_serv(cptr)->prot = prot; cli_serv(cptr)->ghost = ghost; + memset(cli_privs(cptr), 255, sizeof(struct Privs)); + ClrPriv(cptr, PRIV_SET); SetServerYXX(cptr, cptr, parv[6]); /* Attach any necessary UWorld config items. */ attach_confs_byhost(cptr, host, CONF_UWORLD); - if (*parv[7] == '+') { - for (ch = parv[7] + 1; *ch; ch++) - switch (*ch) { - case 'h': - SetHub(cptr); - break; - case 's': - SetService(cptr); - break; - } - } + if (*parv[7] == '+') + set_server_flags(cptr, parv[7] + 1); recv_time = TStime(); check_start_timestamp(cptr, timestamp, start_timestamp, recv_time); @@ -664,7 +667,6 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { - char* ch; int i; char* host; struct Client* acptr; @@ -739,17 +741,8 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* Attach any necessary UWorld config items. */ attach_confs_byhost(cptr, host, CONF_UWORLD); - if (*parv[7] == '+') { - for (ch = parv[7] + 1; *ch; ch++) - switch (*ch) { - case 'h': - SetHub(acptr); - break; - case 's': - SetService(acptr); - break; - } - } + if (*parv[7] == '+') + set_server_flags(acptr, parv[7] + 1); Count_newremoteserver(UserStats); if (Protocol(acptr) < 10) @@ -759,9 +752,13 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (*parv[5] == 'J') { SetBurst(acptr); - sendto_opmask_butone(0, SNO_NETWORK, "Net junction: %s %s", - cli_name(sptr), cli_name(acptr)); SetJunction(acptr); + for (bcptr = cli_serv(acptr)->up; !IsMe(bcptr); bcptr = cli_serv(bcptr)->up) + if (IsBurstOrBurstAck(bcptr)) + break; + if (IsMe(bcptr)) + sendto_opmask_butone(0, SNO_NETWORK, "Net junction: %s %s", + cli_name(sptr), cli_name(acptr)); } /* * Old sendto_serv_but_one() call removed because we now need to send @@ -774,10 +771,11 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) continue; if (0 == match(cli_name(&me), cli_name(acptr))) continue; - sendcmdto_one(sptr, CMD_SERVER, bcptr, "%s %d 0 %s %s %s%s +%s%s :%s", + sendcmdto_one(sptr, CMD_SERVER, bcptr, "%s %d 0 %s %s %s%s +%s%s%s :%s", cli_name(acptr), hop + 1, parv[4], parv[5], NumServCap(acptr), IsHub(acptr) ? "h" : "", - IsService(acptr) ? "s" : "", cli_info(acptr)); + IsService(acptr) ? "s" : "", IsIPv6(acptr) ? "6" : "", + cli_info(acptr)); } return 0; }