]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/s_serv.c
Add topic TS and channel TS constraints for /LIST.
[irc/rqf/shadowircd.git] / src / s_serv.c
index e71b1f3016f0503bfeadab0b10deece79fa7c867..79a318c631f57eba07b3dcb78134821b05a4e957 100644 (file)
@@ -21,7 +21,6 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: s_serv.c 3550 2007-08-09 06:47:26Z nenolod $
  */
 
 #include "stdinc.h"
@@ -90,6 +89,7 @@ struct Capability captab[] = {
        { "EUID",       CAP_EUID },
        { "EOPMOD",     CAP_EOPMOD },
        { "BAN",        CAP_BAN },
+       { "MLOCK",      CAP_MLOCK },
        {0, 0}
 };
 
@@ -320,20 +320,31 @@ check_server(const char *name, struct Client *client_p)
                {
                        error = -2;
 
-                       if(ServerConfEncrypted(tmp_p))
+                       if(tmp_p->passwd)
                        {
-                               if(!strcmp(tmp_p->passwd, rb_crypt(client_p->localClient->passwd,
-                                                               tmp_p->passwd)))
+                               if(ServerConfEncrypted(tmp_p))
                                {
-                                       server_p = tmp_p;
-                                       break;
+                                       if(!strcmp(tmp_p->passwd, rb_crypt(client_p->localClient->passwd,
+                                                                       tmp_p->passwd)))
+                                       {
+                                               server_p = tmp_p;
+                                               break;
+                                       }
+                                       else
+                                               continue;
                                }
+                               else if(strcmp(tmp_p->passwd, client_p->localClient->passwd))
+                                       continue;
                        }
-                       else if(!strcmp(tmp_p->passwd, client_p->localClient->passwd))
+
+                       if(tmp_p->certfp)
                        {
-                               server_p = tmp_p;
-                               break;
+                               if(!client_p->certfp || strcasecmp(tmp_p->certfp, client_p->certfp) != 0)
+                                       continue;
                        }
+
+                       server_p = tmp_p;
+                       break;
                }
        }
 
@@ -431,7 +442,8 @@ burst_ban(struct Client *client_p)
                         */
                        rb_strlcpy(operbuf, aconf->info.oper, sizeof buf);
                        p = strrchr(operbuf, '{');
-                       if (operbuf + sizeof operbuf - p > (ptrdiff_t)(melen + 2))
+                       if (p != NULL &&
+                                       operbuf + sizeof operbuf - p > (ptrdiff_t)(melen + 2))
                        {
                                memcpy(p + 1, me.name, melen);
                                p[melen + 1] = '}';
@@ -439,9 +451,8 @@ burst_ban(struct Client *client_p)
                                oper = operbuf;
                        }
                }
-               sendto_one(client_p, ":%s BAN %c %s %s %s %lu %d %d %s :%s%s%s",
+               sendto_one(client_p, ":%s BAN %s %s %s %lu %d %d %s :%s%s%s",
                                me.id,
-                               aconf->status & CONF_ILLEGAL ? '-' : '+',
                                type,
                                aconf->user ? aconf->user : "*", aconf->host,
                                (unsigned long)aconf->created,
@@ -678,6 +689,11 @@ burst_TS6(struct Client *client_p)
                                   ConfigChannel.burst_topicwho ? " " : "",
                                   chptr->topic);
 
+               if(IsCapable(client_p, CAP_MLOCK))
+                       sendto_one(client_p, ":%s MLOCK %ld %s :%s",
+                                  me.id, (long) chptr->channelts, chptr->chname,
+                                  EmptyString(chptr->mode_lock) ? "" : chptr->mode_lock);
+
                hchaninfo.chptr = chptr;
                call_hook(h_burst_channel, &hchaninfo);
        }
@@ -776,15 +792,9 @@ server_estab(struct Client *client_p)
 
        if(IsUnknown(client_p))
        {
-               /*
-                * jdc -- 1.  Use EmptyString(), not [0] index reference.
-                *        2.  Check ->spasswd, not ->passwd.
-                */
-               if(!EmptyString(server_p->spasswd))
-               {
-                       sendto_one(client_p, "PASS %s TS %d :%s", 
-                                  server_p->spasswd, TS_CURRENT, me.id);
-               }
+               /* the server may be linking based on certificate fingerprint now. --nenolod */
+               sendto_one(client_p, "PASS %s TS %d :%s", 
+                          EmptyString(server_p->spasswd) ? "*" : server_p->spasswd, TS_CURRENT, me.id);
 
                /* pass info to new server */
                send_capabilities(client_p, default_server_capabs
@@ -1345,11 +1355,9 @@ serv_connect_callback(rb_fde_t *F, int status, void *data)
        /* Next, send the initial handshake */
        SetHandshake(client_p);
 
-       if(!EmptyString(server_p->spasswd))
-       {
-               sendto_one(client_p, "PASS %s TS %d :%s", 
-                          server_p->spasswd, TS_CURRENT, me.id);
-       }
+       /* the server may be linking based on certificate fingerprint now. --nenolod */
+       sendto_one(client_p, "PASS %s TS %d :%s", 
+                  EmptyString(server_p->spasswd) ? "*" : server_p->spasswd, TS_CURRENT, me.id);
 
        /* pass my info to the new server */
        send_capabilities(client_p, default_server_capabs