]> jfr.im git - solanum.git/blobdiff - modules/core/m_server.c
Remove shared blocks
[solanum.git] / modules / core / m_server.c
index f4e922bbeed131cbc36a321a3ce5d37d1d4de2f6..850a67d8d0d90eccc3d8650341f62df594d21ea8 100644 (file)
@@ -188,6 +188,36 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
 
                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",
@@ -266,22 +296,25 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
                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));
+               }
        }
 
        /*
@@ -627,7 +660,7 @@ ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
 
        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;