]> jfr.im git - solanum.git/blobdiff - modules/m_signon.c
sasl: reformat the other messages consistently
[solanum.git] / modules / m_signon.c
index 592330a8ca7f2c4a3cd062f9b3f456057656a7a7..ce79de81e7fac41e035ba3fa0bb4aacca642a65e 100644 (file)
 #include "msg.h"
 #include "parse.h"
 #include "modules.h"
-#include "sprintf_irc.h"
 #include "whowas.h"
 #include "monitor.h"
 #include "s_stats.h"
 #include "snomask.h"
-#include "irc_string.h"
+#include "match.h"
 #include "s_user.h"
 
 static int me_svslogin(struct Client *, struct Client *, int, const char **);
@@ -66,7 +65,7 @@ struct Message signon_msgtab = {
        {mg_ignore, mg_ignore, {ms_signon, 6}, mg_ignore, mg_ignore, mg_ignore}
 };
 
-mapi_clist_av1 signon_clist[] = { 
+mapi_clist_av1 signon_clist[] = {
        &svslogin_msgtab, &signon_msgtab, NULL
 };
 
@@ -153,7 +152,11 @@ me_svslogin(struct Client *client_p, struct Client *source_p,
        int valid = 0;
 
        if(!(source_p->flags & FLAGS_SERVICE))
+       {
+               sendto_realops_snomask(SNO_GENERAL, L_ALL,
+                       "Non-service server %s attempting to execute services-only command SVSLOGIN", source_p->name);
                return 0;
+       }
 
        if((target_p = find_client(parv[1])) == NULL)
                return 0;
@@ -214,8 +217,11 @@ me_svslogin(struct Client *client_p, struct Client *source_p,
                exist_p->flags |= FLAGS_KILLED;
                kill_client_serv_butone(NULL, exist_p, "%s (Nickname regained by services)",
                                        me.name);
+               sendto_realops_snomask(SNO_SKILL, L_ALL,
+                               "Nick collision due to SVSLOGIN on %s",
+                               nick);
 
-               snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
+               rb_snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
                        me.name);
                exit_client(NULL, exist_p, &me, buf);
        }else if((exist_p = find_client(nick)) && IsUnknown(exist_p) && exist_p != target_p) {
@@ -321,6 +327,8 @@ ms_signon(struct Client *client_p, struct Client *source_p,
                else
                        return 0;
        }
+       else
+               login[0] = '\0';
 
        target_p = find_named_client(parv[1]);
        if(target_p != NULL && target_p != source_p)
@@ -337,17 +345,17 @@ ms_signon(struct Client *client_p, struct Client *source_p,
                                                     "Nick change collision from SIGNON from %s to %s(%s <- %s)(both killed)",
                                                     source_p->name, target_p->name, target_p->from->name,
                                                     client_p->name);
-               
+
                                ServerStats.is_kill++;
                                sendto_one_numeric(target_p, ERR_NICKCOLLISION,
                                                   form_str(ERR_NICKCOLLISION), target_p->name);
-               
+
                                kill_client_serv_butone(NULL, source_p, "%s (Nick change collision)", me.name);
-               
+
                                ServerStats.is_kill++;
-               
+
                                kill_client_serv_butone(NULL, target_p, "%s (Nick change collision)", me.name);
-               
+
                                target_p->flags |= FLAGS_KILLED;
                                exit_client(NULL, target_p, &me, "Nick collision(new)");
                                source_p->flags |= FLAGS_KILLED;
@@ -358,7 +366,7 @@ ms_signon(struct Client *client_p, struct Client *source_p,
                        {
                                sameuser = !irccmp(target_p->username, source_p->username) &&
                                        !irccmp(target_p->host, source_p->host);
-               
+
                                if((sameuser && newts < target_p->tsinfo) ||
                                   (!sameuser && newts > target_p->tsinfo))
                                {
@@ -372,18 +380,18 @@ ms_signon(struct Client *client_p, struct Client *source_p,
                                                                     "Nick change collision from SIGNON from %s to %s(%s <- %s)(newer killed)",
                                                                     source_p->name, target_p->name,
                                                                     target_p->from->name, client_p->name);
-               
+
                                        ServerStats.is_kill++;
-               
+
                                        sendto_one_numeric(target_p, ERR_NICKCOLLISION,
                                                           form_str(ERR_NICKCOLLISION), target_p->name);
-               
+
                                        /* kill the client issuing the nickchange */
                                        kill_client_serv_butone(client_p, source_p,
                                                                "%s (Nick change collision)", me.name);
-               
+
                                        source_p->flags |= FLAGS_KILLED;
-               
+
                                        if(sameuser)
                                                exit_client(client_p, source_p, &me, "Nick collision(old)");
                                        else
@@ -402,21 +410,21 @@ ms_signon(struct Client *client_p, struct Client *source_p,
                                                                     "Nick collision from SIGNON on %s(%s <- %s)(newer killed)",
                                                                     target_p->name, target_p->from->name,
                                                                     client_p->name);
-               
+
                                        sendto_one_numeric(target_p, ERR_NICKCOLLISION,
                                                           form_str(ERR_NICKCOLLISION), target_p->name);
-               
+
                                        /* kill the client who existed before hand */
-                                       kill_client_serv_butone(client_p, target_p, 
+                                       kill_client_serv_butone(client_p, target_p,
                                                        "%s (Nick collision)", me.name);
-               
+
                                        ServerStats.is_kill++;
-               
+
                                        target_p->flags |= FLAGS_KILLED;
                                        (void) exit_client(client_p, target_p, &me, "Nick collision");
                                }
                        }
-               
+
                }
        }
 
@@ -432,9 +440,6 @@ send_signon(struct Client *client_p, struct Client *target_p,
        sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s SIGNON %s %s %s %ld %s",
                        use_id(target_p), nick, user, host,
                        (long) target_p->tsinfo, *login ? login : "0");
-       sendto_server(client_p, NULL, NOCAPS, CAP_TS6, ":%s SIGNON %s %s %s %ld %s",
-                       target_p->name, nick, user, host,
-                       (long) target_p->tsinfo, *login ? login : "0");
 
        strcpy(target_p->user->suser, login);