{
unsigned short port;
unsigned short tmpport;
- const char* crule_name;
+ const char* rule;
struct ConfItem* aconf;
struct Client* acptr;
struct Jupe* ajupe;
assert(0 != sptr);
if (!IsPrivileged(sptr))
- return send_error_to_client(sptr, ERR_NOPRIVILEGES);
+ return send_reply(sptr, ERR_NOPRIVILEGES);
if (parc < 4) {
/*
return need_more_params(sptr, "CONNECT");
}
- if (hunt_server(1, cptr, sptr,
- "%s%s " TOK_CONNECT " %s %s :%s", 3, parc, parv) != HUNTED_ISME)
+ if (hunt_server_cmd(sptr, CMD_CONNECT, cptr, 1, "%s %s :%C", 3, parc, parv)
+ != HUNTED_ISME)
return 0;
/*
* present below. --Bleep
*/
if (0 == (aconf = conf_find_server(parv[1]))) {
- sendto_one(sptr, "%s NOTICE %s%s :Connect: Host %s not listed in ircd.conf",
- NumServ(&me), NumNick(sptr), parv[1]);
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: Host %s not listed "
+ "in ircd.conf", sptr, parv[1]);
return 0;
}
/*
* use aconf->name to look up the server
*/
if ((acptr = FindServer(aconf->name))) {
- sendto_one(sptr, "%s NOTICE %s%s :Connect: Server %s %s %s.",
- NumServ(&me), NumNick(sptr), parv[1], "already exists from",
- acptr->from->name);
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: Server %s already "
+ "exists from %s", sptr, parv[1], acptr->from->name);
return 0;
}
/*
* are ored together. Oper connects are effected only by D
* lines (CRULEALL) not d lines (CRULEAUTO).
*/
- if ((crule_name = conf_eval_crule(aconf))) {
- sendto_one(sptr, "%s NOTICE %s%s :Connect: Disallowed by rule: %s",
- NumServ(&me), NumNick(sptr), crule_name);
+ if ((rule = conf_eval_crule(aconf->name, CRULE_ALL))) {
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: Disallowed by rule: %s", sptr, rule);
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",
- NumServ(&me), NumNick(sptr), JupeServer(ajupe),
- JupeReason(ajupe));
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: Server %s is juped: %s",
+ sptr, JupeServer(ajupe), JupeReason(ajupe));
return 0;
}
+
+ /*
+ * 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) {
- sendto_one(sptr, "%s NOTICE %s%s :Connect: Invalid port number",
- NumServ(&me), NumNick(sptr));
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: Invalid port number",
+ sptr);
return 0;
}
+#endif
+ port = atoi(parv[2]);
/*
* save the old port
*/
tmpport = aconf->port;
- aconf->port = port;
+ if (port) {
+ aconf->port = port;
+ }
+ else {
+ port = aconf->port;
+ }
/*
* Notify all operators about remote connect requests
*/
- sendto_ops_butone(0, &me, ":%s WALLOPS :Remote CONNECT %s %s from %s",
- me.name, parv[1], parv[2] ? parv[2] : "",
- get_client_name(sptr, HIDE_IP));
- ircd_log(L_INFO, "CONNECT From %s : %s %d", parv[0], parv[1], parv[2] ? parv[2] : "");
+ sendcmdto_flag_butone(&me, CMD_WALLOPS, 0, FLAGS_WALLOP,
+ ":Remote CONNECT %s %s from %s", parv[1],
+ parv[2] ? parv[2] : "",
+ get_client_name(sptr, HIDE_IP));
+ ircd_log(L_INFO, "CONNECT From %s : %s %d", parv[0], parv[1],
+ parv[2] ? parv[2] : "");
if (connect_server(aconf, sptr, 0)) {
- sendto_one(sptr, "%s NOTICE %s%s :*** Connecting to %s.",
- NumServ(&me), NumNick(sptr), aconf->name);
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :*** Connecting to %s.", sptr,
+ aconf->name);
}
else {
- sendto_one(sptr, "%s NOTICE %s%s :*** Connection to %s failed",
- NumServ(&me), NumNick(sptr), aconf->name);
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :*** Connection to %s failed",
+ sptr, aconf->name);
}
aconf->port = tmpport;
return 0;
{
unsigned short port;
unsigned short tmpport;
- const char* crule_name;
+ const char* rule;
struct ConfItem* aconf;
struct Client* acptr;
struct Jupe* ajupe;
struct Client* acptr3;
if (!(acptr3 = find_match_server(parv[3]))) {
- send_error_to_client(sptr, ERR_NOSUCHSERVER, parv[3]);
+ send_reply(sptr, ERR_NOSUCHSERVER, parv[3]);
return 0;
}
acptr3 = acptr2;
}
parv[3] = acptr3->name;
- if (hunt_server(1, cptr, sptr, "%s%s " TOK_CONNECT " %s %s :%s",
- 3, parc, parv) != HUNTED_ISME)
+ if (hunt_server_cmd(sptr, CMD_CONNECT, cptr, 1, "%s %s :%C", 3, parc,
+ parv) != HUNTED_ISME)
return 0;
}
}
* present below. --Bleep
*/
if (0 == (aconf = conf_find_server(parv[1]))) {
- sendto_one(sptr,
- ":%s NOTICE %s :Connect: Host %s not listed in ircd.conf",
- me.name, parv[0], parv[1]);
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: Host %s not listed "
+ "in ircd.conf", sptr, parv[1]);
return 0;
}
/*
* use aconf->name to look up the server, see above
*/
if ((acptr = FindServer(aconf->name))) {
- sendto_one(sptr, ":%s NOTICE %s :Connect: Server %s %s %s.",
- me.name, parv[0], parv[1], "already exists from",
- acptr->from->name);
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: Server %s already "
+ "exists from %s", sptr, parv[1], acptr->from->name);
return 0;
}
/*
* are ored together. Oper connects are effected only by D
* lines (CRULEALL) not d lines (CRULEAUTO).
*/
- if ((crule_name = conf_eval_crule(aconf))) {
- sendto_one(sptr, ":%s NOTICE %s :Connect: Disallowed by rule: %s",
- me.name, parv[0], crule_name);
+ if ((rule = conf_eval_crule(aconf->name, CRULE_ALL))) {
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: Disallowed by rule: %s", sptr, rule);
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",
- me.name, NumNick(sptr), JupeServer(ajupe), JupeReason(ajupe));
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: Server %s is juped: %s",
+ sptr, JupeServer(ajupe), JupeReason(ajupe));
return 0;
}
/*
if (parc > 2) {
assert(0 != parv[2]);
if (0 == (port = atoi(parv[2]))) {
- sendto_one(sptr, ":%s NOTICE %s :Connect: Invalid port number",
- me.name, parv[0]);
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: Invalid port number",
+ sptr);
return 0;
}
}
if (0 == port && 0 == (port = SERVER_PORT)) {
- sendto_one(sptr, ":%s NOTICE %s :Connect: missing port number",
- me.name, parv[0]);
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Connect: missing port number",
+ sptr);
return 0;
}
aconf->port = port;
if (connect_server(aconf, sptr, 0)) {
- sendto_one(sptr, ":%s NOTICE %s :*** Connecting to %s.",
- me.name, parv[0], aconf->name);
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :*** Connecting to %s.", sptr,
+ aconf->name);
}
else {
- sendto_one(sptr, ":%s NOTICE %s :*** Connection to %s failed",
- me.name, parv[0], aconf->name);
+ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :*** Connection to %s failed",
+ sptr, aconf->name);
}
aconf->port = tmpport;
return 0;
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]);
+ sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); /* XXX DEAD */
return -1;
}
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]);
+ sendto_one(sptr, err_str(ERR_NOSUCHSERVER), me.name, parv[0], parv[3]); /* XXX DEAD */
return 0;
}
parv[3] = acptr3->name;
}
- if (hunt_server(1, cptr, sptr,
+ if (hunt_server(1, cptr, sptr, /* XXX DEAD */
"%s%s " TOK_CONNECT " %s %s :%s", 3, parc, parv) != HUNTED_ISME)
return 0;
if ((acptr = FindServer(parv[1]))) {
if (MyUser(sptr))
- sendto_one(sptr, ":%s NOTICE %s :Connect: Server %s %s %s.",
+ 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.",
+ 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;
#endif
if (!aconf) {
if (MyUser(sptr))
- sendto_one(sptr, ":%s NOTICE %s :Connect: Host %s not listed in ircd.conf",
+ 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",
+ 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;
}
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]);
+ 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",
+ 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",
+ 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",
+ sendto_one(sptr, "%s NOTICE %s%s :Connect: missing port number", /* XXX DEAD */
NumServ(&me), NumNick(sptr));
return 0;
}
* are ored together. Oper connects are effected only by D
* lines (CRULEALL) not d lines (CRULEAUTO).
*/
- for (cconf = GlobalConfList; cconf; cconf = cconf->next) {
- if ((CONF_CRULEALL == cconf->status) &&
- (0 == match(cconf->host, aconf->name))) {
- if (crule_eval(cconf->passwd)) {
- if (MyUser(sptr))
- sendto_one(sptr, ":%s NOTICE %s :Connect: Disallowed by rule: %s",
- me.name, parv[0], cconf->name);
- else
- sendto_one(sptr, "%s NOTICE %s%s :Connect: Disallowed by rule: %s",
- NumServ(&me), NumNick(sptr), cconf->name);
- return 0;
- }
- }
+ 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",
+ 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",
+ 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",
aconf->port = port;
if (connect_server(aconf, sptr, 0)) {
if (MyUser(sptr))
- sendto_one(sptr, ":%s NOTICE %s :*** Connecting to %s.",
+ 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.",
+ 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",
+ 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",
+ sendto_one(sptr, "%s NOTICE %s%s :*** Connection to %s failed", /* XXX DEAD */
NumServ(&me), NumNick(sptr), aconf->name);
}
aconf->port = tmpport;