]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/s_conf.c
Do not allow a topic change if a user may not send to the channel
[irc/rqf/shadowircd.git] / src / s_conf.c
index 3f4608890272a6a8bca7115689d798321d900ac2..b03a1305e2d94463f3a4a40796bad09f3f89c6a3 100644 (file)
@@ -674,6 +674,8 @@ set_default_conf(void)
        ServerInfo.description = NULL;
        ServerInfo.network_name = rb_strdup(NETWORK_NAME_DEFAULT);
        ServerInfo.network_desc = rb_strdup(NETWORK_DESC_DEFAULT);
+       ServerInfo.helpchan = rb_strdup("");
+       ServerInfo.helpurl = rb_strdup("");
 
        memset(&ServerInfo.ip, 0, sizeof(ServerInfo.ip));
        ServerInfo.specific_ipv4_vhost = 0;
@@ -804,6 +806,7 @@ set_default_conf(void)
        ConfigFileEntry.min_nonwildcard = 4;
        ConfigFileEntry.min_nonwildcard_simple = 3;
        ConfigFileEntry.default_floodcount = 8;
+       ConfigFileEntry.default_ident_timeout = 5;
        ConfigFileEntry.client_flood = CLIENT_FLOOD_DEFAULT;
        ConfigFileEntry.tkline_expire_notices = 0;
 
@@ -892,7 +895,7 @@ validate_conf(void)
                splitchecking = 0;
        }
 
-       if(!valid_hostname(ConfigFileEntry.default_operhost))
+       if(!valid_hostname(ConfigFileEntry.default_operhost) && !EmptyString(ConfigFileEntry.default_operhost))
        {
                conf_report_error("Warning -- invalid default_operhost specified, ignoring.");
                ConfigFileEntry.default_operhost = rb_strdup("");
@@ -1133,6 +1136,36 @@ deactivate_conf(struct ConfItem *aconf, rb_dlink_node *ptr)
        }
 }
 
+/* Given a new ban ConfItem, look for any matching ban, update the lifetime
+ * from it and delete it.
+ */
+void
+replace_old_ban(struct ConfItem *aconf)
+{
+       rb_dlink_node *ptr;
+       struct ConfItem *oldconf;
+
+       ptr = find_prop_ban(aconf->status, aconf->user, aconf->host);
+       if(ptr != NULL)
+       {
+               oldconf = ptr->data;
+               /* Remember at least as long as the old one. */
+               if(oldconf->lifetime > aconf->lifetime)
+                       aconf->lifetime = oldconf->lifetime;
+               /* Force creation time to increase. */
+               if(oldconf->created >= aconf->created)
+                       aconf->created = oldconf->created + 1;
+               /* Leave at least one second of validity. */
+               if(aconf->hold <= aconf->created)
+                       aconf->hold = aconf->created + 1;
+               if(aconf->lifetime < aconf->hold)
+                       aconf->lifetime = aconf->hold;
+               /* Tell deactivate_conf() to destroy it. */
+               oldconf->lifetime = rb_current_time();
+               deactivate_conf(oldconf, ptr);
+       }
+}
+
 static void
 expire_prop_bans(void *list)
 {
@@ -1300,7 +1333,7 @@ get_user_ban_reason(struct ConfItem *aconf)
                rb_snprintf(reasonbuf, sizeof reasonbuf,
                                "Temporary %c-line %d min. - ",
                                aconf->status == CONF_DLINE ? 'D' : 'K',
-                               (aconf->hold - aconf->created) / 60);
+                               (int)((aconf->hold - aconf->created) / 60));
        else
                reasonbuf[0] = '\0';
        if (aconf->passwd)
@@ -1443,6 +1476,10 @@ clear_out_old_conf(void)
        ServerInfo.network_name = NULL;
        rb_free(ServerInfo.network_desc);
        ServerInfo.network_desc = NULL;
+       rb_free(ServerInfo.helpchan);
+       ServerInfo.helpchan = NULL;
+       rb_free(ServerInfo.helpurl);
+       ServerInfo.helpurl = NULL;
 
        ServerInfo.ssld_count = 1;