]> jfr.im git - solanum.git/blobdiff - ircd/newconf.c
whowas.c: store account name in whowas (#323)
[solanum.git] / ircd / newconf.c
index d6eef9f08972873b98771d8ba861e1ca64deb7c9..101942f975c11b94787b9d8396c39680b7a2dd1c 100644 (file)
@@ -356,7 +356,7 @@ static struct mode_table auth_table[] = {
 
 static struct mode_table connect_table[] = {
        { "autoconn",   SERVER_AUTOCONN         },
-       { "compressed", SERVER_COMPRESSED       },
+       { "compressed", 0                       },
        { "encrypted",  SERVER_ENCRYPTED        },
        { "topicburst", SERVER_TB               },
        { "sctp",       SERVER_SCTP             },
@@ -768,7 +768,7 @@ conf_end_class(struct TopConf *tc)
 
        if(EmptyString(yy_class->class_name))
        {
-               conf_report_error("Ignoring connect block -- missing name.");
+               conf_report_error("Ignoring class block -- missing name.");
                return 0;
        }
 
@@ -1231,50 +1231,53 @@ conf_begin_connect(struct TopConf *tc)
 static int
 conf_end_connect(struct TopConf *tc)
 {
-       if(EmptyString(yy_server->name))
+       if (EmptyString(yy_server->name))
        {
                conf_report_error("Ignoring connect block -- missing name.");
                return 0;
        }
 
-       if(ServerInfo.name != NULL && !irccmp(ServerInfo.name, yy_server->name))
+       if (ServerInfo.name != NULL && !irccmp(ServerInfo.name, yy_server->name))
        {
-               conf_report_error("Ignoring connect block for %s -- name is equal to my own name.",
-                               yy_server->name);
+               conf_report_error("Ignoring connect block for %s -- name is "
+                                 "equal to my own name.", yy_server->name);
                return 0;
        }
 
-       if((EmptyString(yy_server->passwd) || EmptyString(yy_server->spasswd)) && EmptyString(yy_server->certfp))
+       if ((EmptyString(yy_server->passwd) || EmptyString(yy_server->spasswd))
+           && EmptyString(yy_server->certfp))
        {
-               conf_report_error("Ignoring connect block for %s -- no fingerprint or password credentials provided.",
-                                       yy_server->name);
+               conf_report_error("Ignoring connect block for %s -- no "
+                                 "fingerprint or password credentials "
+                                 "provided.", yy_server->name);
                return 0;
        }
 
-       if((yy_server->flags & SERVER_SSL) && EmptyString(yy_server->certfp))
+       if ((yy_server->flags & SERVER_SSL) && EmptyString(yy_server->certfp))
        {
-               conf_report_error("Ignoring connect block for %s -- no fingerprint provided for SSL connection.",
-                                       yy_server->name);
+               conf_report_error("Ignoring connect block for %s -- no "
+                                 "fingerprint provided for SSL "
+                                 "connection.", yy_server->name);
                return 0;
        }
 
-       if(EmptyString(yy_server->connect_host)
-                       && GET_SS_FAMILY(&yy_server->connect4) != AF_INET
-                       && GET_SS_FAMILY(&yy_server->connect6) != AF_INET6
-               )
+       if (! (yy_server->flags & SERVER_SSL) && ! EmptyString(yy_server->certfp))
        {
-               conf_report_error("Ignoring connect block for %s -- missing host.",
-                                       yy_server->name);
+               conf_report_error("Ignoring connect block for %s -- "
+                                 "fingerprint authentication has "
+                                 "been requested; but the ssl flag "
+                                 "is not set.", yy_server->name);
                return 0;
        }
 
-#ifndef HAVE_LIBZ
-       if(ServerConfCompressed(yy_server))
+       if (EmptyString(yy_server->connect_host)
+           && GET_SS_FAMILY(&yy_server->connect4) != AF_INET
+           && GET_SS_FAMILY(&yy_server->connect6) != AF_INET6)
        {
-               conf_report_error("Ignoring connect::flags::compressed -- zlib not available.");
-               yy_server->flags &= ~SERVER_COMPRESSED;
+               conf_report_error("Ignoring connect block for %s -- missing "
+                                 "host.", yy_server->name);
+               return 0;
        }
-#endif
 
        add_server_conf(yy_server);
        rb_dlinkAdd(yy_server, &yy_server->node, &server_conf_list);
@@ -1344,7 +1347,20 @@ conf_set_connect_send_password(void *data)
                rb_free(yy_server->spasswd);
        }
 
-       yy_server->spasswd = rb_strdup(data);
+       if (EmptyString((const char *) data))
+       {
+               yy_server->spasswd = NULL;
+               conf_report_warning("Invalid send_password for connect "
+                                   "block; must not be empty if provided");
+       }
+       else if (strpbrk(data, " :"))
+       {
+               yy_server->spasswd = NULL;
+               conf_report_error("Invalid send_password for connect "
+                                 "block; cannot contain spaces or colons");
+       }
+       else
+               yy_server->spasswd = rb_strdup(data);
 }
 
 static void
@@ -1355,7 +1371,21 @@ conf_set_connect_accept_password(void *data)
                memset(yy_server->passwd, 0, strlen(yy_server->passwd));
                rb_free(yy_server->passwd);
        }
-       yy_server->passwd = rb_strdup(data);
+
+       if (EmptyString((const char *) data))
+       {
+               yy_server->passwd = NULL;
+               conf_report_warning("Invalid accept_password for connect "
+                                   "block; must not be empty if provided");
+       }
+       else if (strpbrk(data, " :"))
+       {
+               yy_server->passwd = NULL;
+               conf_report_error("Invalid accept_password for connect "
+                                 "block; cannot contain spaces or colons");
+       }
+       else
+               yy_server->passwd = rb_strdup(data);
 }
 
 static void
@@ -1398,9 +1428,6 @@ conf_set_connect_flags(void *data)
 {
        conf_parm_t *args = data;
 
-       /* note, we allow them to set compressed, then remove it later if
-        * they do and LIBZ isnt available
-        */
        set_modes_from_table(&yy_server->flags, "flag", connect_table, args);
 }
 
@@ -1580,24 +1607,6 @@ conf_set_general_stats_l_oper_only(void *data)
                conf_report_error("Invalid setting '%s' for general::stats_l_oper_only.", val);
 }
 
-static void
-conf_set_general_compression_level(void *data)
-{
-#ifdef HAVE_LIBZ
-       ConfigFileEntry.compression_level = *(unsigned int *) data;
-
-       if((ConfigFileEntry.compression_level < 1) || (ConfigFileEntry.compression_level > 9))
-       {
-               conf_report_error
-                       ("Invalid general::compression_level %d -- using default.",
-                        ConfigFileEntry.compression_level);
-               ConfigFileEntry.compression_level = 0;
-       }
-#else
-       conf_report_error("Ignoring general::compression_level -- zlib not available.");
-#endif
-}
-
 static void
 conf_set_general_default_umodes(void *data)
 {
@@ -2653,7 +2662,6 @@ static struct ConfEntry conf_general_table[] =
        { "oper_only_umodes",   CF_STRING | CF_FLIST, conf_set_general_oper_only_umodes, 0, NULL },
        { "oper_umodes",        CF_STRING | CF_FLIST, conf_set_general_oper_umodes,      0, NULL },
        { "oper_snomask",       CF_QSTRING, conf_set_general_oper_snomask, 0, NULL },
-       { "compression_level",  CF_INT,    conf_set_general_compression_level,  0, NULL },
        { "havent_read_conf",   CF_YESNO,  conf_set_general_havent_read_conf,   0, NULL },
        { "hide_error_messages",CF_STRING, conf_set_general_hide_error_messages,0, NULL },
        { "stats_i_oper_only",  CF_STRING, conf_set_general_stats_i_oper_only,  0, NULL },
@@ -2737,6 +2745,15 @@ static struct ConfEntry conf_general_table[] =
        { "hide_opers",         CF_YESNO, NULL, 0, &ConfigFileEntry.hide_opers          },
        { "certfp_method",      CF_STRING, conf_set_general_certfp_method, 0, NULL },
        { "drain_reason",       CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.drain_reason        },
+       { "sasl_only_client_message",   CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.sasl_only_client_message    },
+       { "identd_only_client_message", CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.identd_only_client_message  },
+       { "sctp_forbidden_client_message",      CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.sctp_forbidden_client_message       },
+       { "ssltls_only_client_message", CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.ssltls_only_client_message  },
+       { "not_authorised_client_message",      CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.not_authorised_client_message       },
+       { "illegal_hostname_client_message",    CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.not_authorised_client_message       },
+       { "server_full_client_message", CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.server_full_client_message  },
+       { "illegal_name_long_client_message",   CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.illegal_name_long_client_message    },
+       { "illegal_name_short_client_message",  CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.illegal_name_short_client_message   },
        { "tls_ciphers_oper_only",      CF_YESNO, NULL, 0, &ConfigFileEntry.tls_ciphers_oper_only       },
        { "oper_secure_only",   CF_YESNO, NULL, 0, &ConfigFileEntry.oper_secure_only    },
        { "\0",                 0,        NULL, 0, NULL }