int hop;
unsigned int required_mask;
const char *missing;
+ int ret;
name = parv[1];
hop = atoi(parv[2]);
/* Now we just have to call check_server and everything should be
* check for us... -A1kmm. */
- switch (check_server(name, client_p))
+ ret = check_server(name, client_p);
+ switch (ret)
{
+ case 0:
+ /* success */
+ break;
case -1:
if(ConfigFileEntry.warn_no_nline)
{
exit_client(client_p, client_p, client_p, "Access denied, requires SSL/TLS but is plaintext");
return;
+ case -6:
+ if (client_p->certfp)
+ {
+ sendto_realops_snomask(SNO_GENERAL, L_ALL,
+ "Connection from servername %s has invalid certificate fingerprint %s",
+ name, client_p->certfp);
+ ilog(L_SERVER, "Access denied, invalid certificate fingerprint %s from %s",
+ client_p->certfp, log_client_name(client_p, SHOW_IP));
+ exit_client(client_p, client_p, client_p, "Invalid fingerprint.");
+ }
+ else
+ {
+ sendto_realops_snomask(SNO_GENERAL, L_ALL,
+ "Connection from servername %s failed certificate validation",
+ name);
+ ilog(L_SERVER, "Access denied; certificate validation failed for certificate from %s",
+ log_client_name(client_p, SHOW_IP));
+ exit_client(client_p, client_p, client_p, "Invalid certificate.");
+ }
+
+ return;
+ case -7:
+ sendto_realops_snomask(SNO_GENERAL, L_ALL,
+ "Connection from servername %s rejected, no more connections allowed in class",
+ name);
+ ilog(L_SERVER, "Access denied, no more connections allowed in class for %s",
+ log_client_name(client_p, SHOW_IP));
+
+ exit_client(client_p, client_p, client_p, "Access denied, no more connections allowed in class");
+ return;
+ default:
+ sendto_realops_snomask(SNO_GENERAL, L_ALL,
+ "Connection from servername %s rejected, unknown error %d",
+ name, ret);
+ ilog(L_SERVER, "Access denied, unknown error %d for server %s%s", ret,
+ EmptyString(client_p->name) ? name : "",
+ log_client_name(client_p, SHOW_IP));
+
+ exit_client(client_p, client_p, client_p, "Unknown error.");
+ return;
}
/* require TS6 for direct links */
return;
}
- if(has_id(client_p) && (target_p = find_id(client_p->id)) != NULL)
- {
- sendto_realops_snomask(SNO_GENERAL, is_remote_connect(client_p) ? L_NETWIDE : L_ALL,
- "Attempt to re-introduce SID %s from %s%s (already in use by %s)",
- client_p->id,
- EmptyString(client_p->name) ? name : "",
- client_p->name, target_p->name);
- ilog(L_SERVER, "Attempt to re-introduce SID %s from %s%s (already in use by %s)",
- client_p->id,
- EmptyString(client_p->name) ? name : "",
- log_client_name(client_p, SHOW_IP),
- target_p->name);
-
- sendto_one(client_p, "ERROR :SID already exists.");
- exit_client(client_p, client_p, client_p, "SID Exists");
- return;
+ if (client_p->preClient && !EmptyString(client_p->preClient->id)) {
+ if ((target_p = find_id(client_p->preClient->id)) != NULL) {
+ sendto_realops_snomask(SNO_GENERAL, is_remote_connect(client_p) ? L_NETWIDE : L_ALL,
+ "Attempt to re-introduce SID %s from %s%s (already in use by %s)",
+ client_p->preClient->id,
+ EmptyString(client_p->name) ? name : "",
+ client_p->name, target_p->name);
+ ilog(L_SERVER, "Attempt to re-introduce SID %s from %s%s (already in use by %s)",
+ client_p->preClient->id,
+ EmptyString(client_p->name) ? name : "",
+ log_client_name(client_p, SHOW_IP),
+ target_p->name);
+
+ sendto_one(client_p, "ERROR :SID already exists.");
+ exit_client(client_p, client_p, client_p, "SID Exists");
+ return;
+ } else {
+ rb_strlcpy(client_p->id, client_p->preClient->id, sizeof(client_p->id));
+ }
}
/*
rb_strlcpy(target_p->name, parv[1], sizeof(target_p->name));
target_p->hopcount = atoi(parv[2]);
- strcpy(target_p->id, parv[3]);
+ rb_strlcpy(target_p->id, parv[3], sizeof(target_p->id));
set_server_gecos(target_p, parv[4]);
target_p->servptr = source_p;