]> jfr.im git - solanum.git/blobdiff - src/s_serv.c
Remove s_assert definition from ircd_defs.h and add it to its own header.
[solanum.git] / src / s_serv.c
index 784be844b5ec9e8d58956efb675fe8eec36c0276..1efc7eb05f2620a9ab293548249e237f3be33c9c 100644 (file)
@@ -55,6 +55,7 @@
 #include "reject.h"
 #include "sslproc.h"
 #include "capability.h"
+#include "s_assert.h"
 
 #ifndef INADDR_NONE
 #define INADDR_NONE ((unsigned int) 0xffffffff)
@@ -102,6 +103,10 @@ init_builtin_capabs(void)
 {
        serv_capindex = capability_index_create("server capabilities");
 
+       /* These two are not set via CAPAB/GCAP keywords. */
+       CAP_CAP = capability_put_anonymous(serv_capindex);
+       CAP_TS6 = capability_put_anonymous(serv_capindex);
+
        CAP_QS = capability_put(serv_capindex, "QS");
        CAP_EX = capability_put(serv_capindex, "EX");
        CAP_CHW = capability_put(serv_capindex, "CHW");
@@ -120,6 +125,9 @@ init_builtin_capabs(void)
        CAP_EOPMOD = capability_put(serv_capindex, "EOPMOD");
        CAP_BAN = capability_put(serv_capindex, "BAN");
        CAP_MLOCK = capability_put(serv_capindex, "MLOCK");
+
+       capability_require(serv_capindex, "QS");
+       capability_require(serv_capindex, "ENCAP");
 }
 
 static CNCB serv_connect_callback;
@@ -319,6 +327,7 @@ check_server(const char *name, struct Client *client_p)
        struct server_conf *tmp_p;
        rb_dlink_node *ptr;
        int error = -1;
+       const char *encr;
 
        s_assert(NULL != client_p);
        if(client_p == NULL)
@@ -353,8 +362,9 @@ check_server(const char *name, struct Client *client_p)
                        {
                                if(ServerConfEncrypted(tmp_p))
                                {
-                                       if(!strcmp(tmp_p->passwd, rb_crypt(client_p->localClient->passwd,
-                                                                       tmp_p->passwd)))
+                                       encr = rb_crypt(client_p->localClient->passwd,
+                                                                       tmp_p->passwd);
+                                       if(encr != NULL && !strcmp(tmp_p->passwd, encr))
                                        {
                                                server_p = tmp_p;
                                                break;
@@ -500,7 +510,7 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr,
        {
                banptr = ptr->data;
 
-               tlen = strlen(banptr->banstr) + 1;
+               tlen = strlen(banptr->banstr) + (banptr->forward ? strlen(banptr->forward) + 1 : 0) + 1;
 
                /* uh oh */
                if(cur_len + tlen > BUFSIZE - 3)
@@ -519,7 +529,10 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr,
                        t = buf + mlen;
                }
 
-               rb_sprintf(t, "%s ", banptr->banstr);
+               if (banptr->forward)
+                       rb_sprintf(t, "%s$%s ", banptr->banstr, banptr->forward);
+               else
+                       rb_sprintf(t, "%s ", banptr->banstr);
                t += tlen;
                cur_len += tlen;
        }
@@ -715,6 +728,7 @@ show_capabilities(struct Client *target_p)
        if(!IsServer(target_p) || !target_p->serv->caps)        /* short circuit if no caps */
                return msgbuf + 1;
 
+       rb_strlcat(msgbuf, " ", sizeof(msgbuf));
        rb_strlcat(msgbuf, capability_index_list(serv_capindex, target_p->serv->caps), sizeof(msgbuf));
 
        return msgbuf + 1;
@@ -874,8 +888,7 @@ server_estab(struct Client *client_p)
                                   me.id, client_p->name, client_p->id,
                                   IsHidden(client_p) ? "(H) " : "", client_p->info);
 
-                       if(IsCapable(target_p, CAP_ENCAP) &&
-                          !EmptyString(client_p->serv->fullcaps))
+                       if(!EmptyString(client_p->serv->fullcaps))
                                sendto_one(target_p, ":%s ENCAP * GCAP :%s",
                                        client_p->id, client_p->serv->fullcaps);
                }
@@ -885,8 +898,7 @@ server_estab(struct Client *client_p)
                                   me.name, client_p->name,
                                   IsHidden(client_p) ? "(H) " : "", client_p->info);
 
-                       if(IsCapable(target_p, CAP_ENCAP) &&
-                          !EmptyString(client_p->serv->fullcaps))
+                       if(!EmptyString(client_p->serv->fullcaps))
                                sendto_one(target_p, ":%s ENCAP * GCAP :%s",
                                        client_p->name, client_p->serv->fullcaps);
                }
@@ -930,8 +942,7 @@ server_estab(struct Client *client_p)
                                   target_p->name, target_p->hopcount + 1,
                                   IsHidden(target_p) ? "(H) " : "", target_p->info);
 
-               if(IsCapable(client_p, CAP_ENCAP) && 
-                  !EmptyString(target_p->serv->fullcaps))
+               if(!EmptyString(target_p->serv->fullcaps))
                        sendto_one(client_p, ":%s ENCAP * GCAP :%s",
                                        get_id(target_p, client_p),
                                        target_p->serv->fullcaps);