| 55 |
|
{ |
| 56 |
|
int port; |
| 57 |
|
int tmpport; |
| 58 |
< |
struct ConfItem *conf = NULL; |
| 59 |
< |
struct AccessItem *aconf = NULL; |
| 58 |
> |
struct MaskItem *conf = NULL; |
| 59 |
|
const struct Client *target_p = NULL; |
| 60 |
|
|
| 61 |
|
if (EmptyString(parv[1])) |
| 67 |
|
|
| 68 |
|
if (parc > 3) |
| 69 |
|
{ |
| 70 |
< |
if (!HasOFlag(source_p, OPER_FLAG_REMOTE)) |
| 70 |
> |
if (!HasOFlag(source_p, OPER_FLAG_CONNECT_REMOTE)) |
| 71 |
|
{ |
| 72 |
|
sendto_one(source_p, form_str(ERR_NOPRIVS), |
| 73 |
|
me.name, source_p->name, "connect"); |
| 78 |
|
parc, parv) != HUNTED_ISME) |
| 79 |
|
return; |
| 80 |
|
} |
| 81 |
+ |
else if (!HasOFlag(source_p, OPER_FLAG_CONNECT)) |
| 82 |
+ |
{ |
| 83 |
+ |
sendto_one(source_p, form_str(ERR_NOPRIVS), |
| 84 |
+ |
me.name, source_p->name, "connect"); |
| 85 |
+ |
return; |
| 86 |
+ |
} |
| 87 |
|
|
| 88 |
|
if ((target_p = hash_find_server(parv[1]))) |
| 89 |
|
{ |
| 96 |
|
/* |
| 97 |
|
* try to find the name, then host, if both fail notify ops and bail |
| 98 |
|
*/ |
| 99 |
< |
if ((conf = find_matching_name_conf(SERVER_TYPE, |
| 95 |
< |
parv[1], NULL, NULL, 0)) != NULL) |
| 96 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
| 97 |
< |
else if ((conf = find_matching_name_conf(SERVER_TYPE, |
| 98 |
< |
NULL, NULL, parv[1], 0)) != NULL) |
| 99 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
| 100 |
< |
|
| 101 |
< |
if (conf == NULL || aconf == NULL) |
| 99 |
> |
if (!(conf = find_matching_name_conf(CONF_SERVER, parv[1], NULL, NULL, 0))) |
| 100 |
|
{ |
| 101 |
< |
sendto_one(source_p, |
| 102 |
< |
":%s NOTICE %s :Connect: Host %s not listed in ircd.conf", |
| 103 |
< |
me.name, source_p->name, parv[1]); |
| 104 |
< |
return; |
| 101 |
> |
if (!(conf = find_matching_name_conf(CONF_SERVER, NULL, NULL, parv[1], 0))) |
| 102 |
> |
{ |
| 103 |
> |
sendto_one(source_p, |
| 104 |
> |
":%s NOTICE %s :Connect: Host %s not listed in ircd.conf", |
| 105 |
> |
me.name, source_p->name, parv[1]); |
| 106 |
> |
return; |
| 107 |
> |
} |
| 108 |
|
} |
| 109 |
|
|
| 110 |
|
/* Get port number from user, if given. If not specified, |
| 111 |
|
* use the default form configuration structure. If missing |
| 112 |
|
* from there, then use the precompiled default. |
| 113 |
|
*/ |
| 114 |
< |
tmpport = port = aconf->port; |
| 114 |
> |
tmpport = port = conf->port; |
| 115 |
|
|
| 116 |
|
if (parc > 2 && !EmptyString(parv[2])) |
| 117 |
|
{ |
| 142 |
|
ilog(LOG_TYPE_IRCD, "CONNECT From %s : %s %s", |
| 143 |
|
source_p->name, parv[1], parv[2] ? parv[2] : ""); |
| 144 |
|
|
| 145 |
< |
aconf->port = port; |
| 145 |
> |
conf->port = port; |
| 146 |
|
|
| 147 |
|
/* at this point we should be calling connect_server with a valid |
| 148 |
|
* C:line and a valid port in the C:line |
| 149 |
|
*/ |
| 150 |
< |
if (serv_connect(aconf, source_p)) |
| 150 |
> |
if (serv_connect(conf, source_p)) |
| 151 |
|
{ |
| 152 |
|
if (!ConfigServerHide.hide_server_ips && HasUMode(source_p, UMODE_ADMIN)) |
| 153 |
|
sendto_one(source_p, ":%s NOTICE %s :*** Connecting to %s[%s].%d", |
| 154 |
< |
me.name, source_p->name, aconf->host, |
| 155 |
< |
conf->name, aconf->port); |
| 154 |
> |
me.name, source_p->name, conf->host, |
| 155 |
> |
conf->name, conf->port); |
| 156 |
|
else |
| 157 |
|
sendto_one(source_p, ":%s NOTICE %s :*** Connecting to %s.%d", |
| 158 |
< |
me.name, source_p->name, conf->name, aconf->port); |
| 158 |
> |
me.name, source_p->name, conf->name, conf->port); |
| 159 |
|
} |
| 160 |
|
else |
| 161 |
|
{ |
| 162 |
|
sendto_one(source_p, ":%s NOTICE %s :*** Couldn't connect to %s.%d", |
| 163 |
< |
me.name, source_p->name, conf->name, aconf->port); |
| 163 |
> |
me.name, source_p->name, conf->name, conf->port); |
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
/* client is either connecting with all the data it needs or has been |
| 167 |
|
* destroyed |
| 168 |
|
*/ |
| 169 |
< |
aconf->port = tmpport; |
| 169 |
> |
conf->port = tmpport; |
| 170 |
|
} |
| 171 |
|
|
| 172 |
|
/* |
| 186 |
|
{ |
| 187 |
|
int port; |
| 188 |
|
int tmpport; |
| 189 |
< |
struct ConfItem *conf = NULL; |
| 189 |
< |
struct AccessItem *aconf = NULL; |
| 189 |
> |
struct MaskItem *conf = NULL; |
| 190 |
|
const struct Client *target_p = NULL; |
| 191 |
|
|
| 192 |
|
if (hunt_server(client_p, source_p, |
| 211 |
|
/* |
| 212 |
|
* try to find the name, then host, if both fail notify ops and bail |
| 213 |
|
*/ |
| 214 |
< |
if ((conf = find_matching_name_conf(SERVER_TYPE, |
| 215 |
< |
parv[1], NULL, NULL, 0)) != NULL) |
| 216 |
< |
aconf = map_to_conf(conf); |
| 217 |
< |
else if ((conf = find_matching_name_conf(SERVER_TYPE, |
| 218 |
< |
NULL, NULL, parv[1], 0)) != NULL) |
| 219 |
< |
aconf = map_to_conf(conf); |
| 220 |
< |
|
| 221 |
< |
if (conf == NULL || aconf == NULL) |
| 222 |
< |
{ |
| 223 |
< |
sendto_one(source_p, |
| 224 |
< |
":%s NOTICE %s :Connect: Host %s not listed in ircd.conf", |
| 225 |
< |
me.name, source_p->name, parv[1]); |
| 226 |
< |
return; |
| 214 |
> |
if (!(conf = find_matching_name_conf(CONF_SERVER, parv[1], NULL, NULL, 0))) |
| 215 |
> |
{ |
| 216 |
> |
if (!(conf = find_matching_name_conf(CONF_SERVER, NULL, NULL, parv[1], 0))) |
| 217 |
> |
{ |
| 218 |
> |
sendto_one(source_p, |
| 219 |
> |
":%s NOTICE %s :Connect: Host %s not listed in ircd.conf", |
| 220 |
> |
me.name, source_p->name, parv[1]); |
| 221 |
> |
return; |
| 222 |
> |
} |
| 223 |
|
} |
| 224 |
|
|
| 225 |
|
/* Get port number from user, if given. If not specified, |
| 226 |
|
* use the default form configuration structure. If missing |
| 227 |
|
* from there, then use the precompiled default. |
| 228 |
|
*/ |
| 229 |
< |
tmpport = port = aconf->port; |
| 229 |
> |
tmpport = port = conf->port; |
| 230 |
|
|
| 231 |
|
if (parc > 2 && !EmptyString(parv[2])) |
| 232 |
|
{ |
| 233 |
|
port = atoi(parv[2]); |
| 234 |
|
|
| 235 |
|
/* if someone sends port 0, and we have a config port.. use it */ |
| 236 |
< |
if (port == 0 && aconf->port) |
| 237 |
< |
port = aconf->port; |
| 236 |
> |
if (port == 0 && conf->port) |
| 237 |
> |
port = conf->port; |
| 238 |
|
else if (port <= 0) |
| 239 |
|
{ |
| 240 |
|
sendto_one(source_p, ":%s NOTICE %s :Connect: Illegal port number", |
| 271 |
|
ilog(LOG_TYPE_IRCD, "CONNECT From %s : %s %d", |
| 272 |
|
source_p->name, parv[1], port); |
| 273 |
|
|
| 274 |
< |
aconf->port = port; |
| 274 |
> |
conf->port = port; |
| 275 |
|
|
| 276 |
|
/* |
| 277 |
|
* At this point we should be calling connect_server with a valid |
| 278 |
|
* C:line and a valid port in the C:line |
| 279 |
|
*/ |
| 280 |
< |
if (serv_connect(aconf, source_p)) |
| 280 |
> |
if (serv_connect(conf, source_p)) |
| 281 |
|
sendto_one(source_p, ":%s NOTICE %s :*** Connecting to %s.%d", |
| 282 |
< |
me.name, source_p->name, conf->name, aconf->port); |
| 282 |
> |
me.name, source_p->name, conf->name, conf->port); |
| 283 |
|
else |
| 284 |
|
sendto_one(source_p, ":%s NOTICE %s :*** Couldn't connect to %s.%d", |
| 285 |
< |
me.name, source_p->name, conf->name, aconf->port); |
| 285 |
> |
me.name, source_p->name, conf->name, conf->port); |
| 286 |
|
/* |
| 287 |
|
* Client is either connecting with all the data it needs or has been |
| 288 |
|
* destroyed |
| 289 |
|
*/ |
| 290 |
< |
aconf->port = tmpport; |
| 290 |
> |
conf->port = tmpport; |
| 291 |
|
} |
| 292 |
|
|
| 293 |
|
static struct Message connect_msgtab = { |