]> jfr.im git - solanum.git/blobdiff - ircd/s_user.c
Add general::tls_ciphers_oper_only
[solanum.git] / ircd / s_user.c
index ac029dbeed9a8a182145481c4c82d32a91d0e5d4..5ac5f56ea8981c7a62e7e35cd5be483446025203 100644 (file)
@@ -81,7 +81,7 @@ int user_modes[256] = {
        0,                      /* O */
        0,                      /* P */
        UMODE_NOFORWARD,        /* Q */
-       UMODE_REGONLYMSG,       /* R */
+       0,                      /* R */
        UMODE_SERVICE,          /* S */
        0,                      /* T */
        0,                      /* U */
@@ -240,7 +240,7 @@ authd_check(struct Client *client_p, struct Client *source_p)
 
                        sendto_one_notice(source_p, ":*** Your IP address %s is listed in %s",
                                source_p->sockhost, blacklist);
-                       add_reject(source_p, NULL, NULL);
+                       add_reject(source_p, NULL, NULL, NULL, "Banned (DNS blacklist)");
                        exit_client(client_p, source_p, &me, "Banned (DNS blacklist)");
                        reject = true;
                }
@@ -283,7 +283,7 @@ authd_check(struct Client *client_p, struct Client *source_p)
                        sendto_one_notice(source_p,
                                ":*** Your IP address %s has been detected as an open proxy (type %s, port %s)",
                                source_p->sockhost, proxy, port);
-                       add_reject(source_p, NULL, NULL);
+                       add_reject(source_p, NULL, NULL, NULL, "Banned (Open proxy)");
                        exit_client(client_p, source_p, &me, "Banned (Open proxy)");
                        reject = true;
                }
@@ -307,7 +307,7 @@ authd_check(struct Client *client_p, struct Client *source_p)
 
                sendto_one_notice(source_p, ":*** Rejected by authentication system: %s",
                        reason);
-               add_reject(source_p, NULL, NULL);
+               add_reject(source_p, NULL, NULL, NULL, "Banned (authentication system)");
                exit_client(client_p, source_p, &me, "Banned (authentication system)");
                reject = true;
                break;
@@ -386,7 +386,9 @@ register_local_user(struct Client *client_p, struct Client *source_p)
        if(source_p->preClient->auth.cid)
                return -1;
 
-       client_p->localClient->last = rb_current_time();
+       /* Set firsttime here so that post_registration_delay works from registration,
+        * rather than initial connection.  */
+       source_p->localClient->firsttime = client_p->localClient->last = rb_current_time();
 
        /* XXX - fixme. we shouldnt have to build a users buffer twice.. */
        if(!IsGotId(source_p) && (strchr(source_p->username, '[') != NULL))
@@ -553,7 +555,7 @@ register_local_user(struct Client *client_p, struct Client *source_p)
           (xconf = find_xline(source_p->info, 1)) != NULL)
        {
                ServerStats.is_ref++;
-               add_reject(source_p, xconf->host, NULL);
+               add_reject(source_p, xconf->host, NULL, NULL, NULL);
                exit_client(client_p, source_p, &me, "Bad user info");
                return CLIENT_EXITED;
        }
@@ -632,7 +634,7 @@ register_local_user(struct Client *client_p, struct Client *source_p)
                add_to_id_hash(source_p->id, source_p);
        }
 
-       if (IsSSL(source_p))
+       if (IsSSL(source_p) && !IsInsecure(source_p))
                source_p->umodes |= UMODE_SSLCLIENT;
 
        if (source_p->umodes & UMODE_INVISIBLE)
@@ -1121,12 +1123,19 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char
                                        }
                                        source_p->flags &= ~OPER_FLAGS;
 
-                                       rb_free(source_p->localClient->opername);
-                                       source_p->localClient->opername = NULL;
-
                                        rb_dlinkFindDestroy(source_p, &local_oper_list);
-                                       privilegeset_unref(source_p->localClient->privset);
-                                       source_p->localClient->privset = NULL;
+                               }
+
+                               if(source_p->user->opername != NULL)
+                               {
+                                       rb_free(source_p->user->opername);
+                                       source_p->user->opername = NULL;
+                               }
+
+                               if(source_p->user->privset != NULL)
+                               {
+                                       privilegeset_unref(source_p->user->privset);
+                                       source_p->user->privset = NULL;
                                }
 
                                rb_dlinkFindDestroy(source_p, &oper_list);
@@ -1413,8 +1422,8 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p)
        SetExemptKline(source_p);
 
        source_p->flags |= oper_p->flags;
-       source_p->localClient->opername = rb_strdup(oper_p->name);
-       source_p->localClient->privset = privilegeset_ref(oper_p->privset);
+       source_p->user->opername = rb_strdup(oper_p->name);
+       source_p->user->privset = privilegeset_ref(oper_p->privset);
 
        rb_dlinkAddAlloc(source_p, &local_oper_list);
        rb_dlinkAddAlloc(source_p, &oper_list);
@@ -1433,6 +1442,8 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p)
        sendto_realops_snomask(SNO_GENERAL, L_ALL,
                             "%s (%s!%s@%s) is now an operator", oper_p->name, source_p->name,
                             source_p->username, source_p->host);
+       sendto_server(NULL, NULL, CAP_TS6, NOCAPS, ":%s OPER %s %s",
+                       use_id(source_p), oper_p->name, oper_p->privset->name);
        if(!(old & UMODE_INVISIBLE) && IsInvisible(source_p))
                ++Count.invisi;
        if((old & UMODE_INVISIBLE) && !IsInvisible(source_p))
@@ -1484,14 +1495,17 @@ construct_umodebuf(void)
                        if (user_modes[i] == 0)
                        {
                                orphaned_umodes |= prev_user_modes[i];
-                               user_modes[i] = prev_user_modes[i];
+                               sendto_realops_snomask(SNO_DEBUG, L_ALL, "Umode +%c is now orphaned", i);
                        }
                        else
+                       {
                                orphaned_umodes &= ~prev_user_modes[i];
+                               sendto_realops_snomask(SNO_DEBUG, L_ALL, "Orphaned umode +%c is picked up by module", i);
+                       }
+                       user_modes[i] = prev_user_modes[i];
                }
                else
                        prev_user_modes[i] = user_modes[i];
-
                if (user_modes[i])
                        *ptr++ = (char) i;
        }