]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/nickserv.h
more python work. Not safe to run yet
[irc/evilnet/x3.git] / src / nickserv.h
index 78f7d856383f6870df116deab9d5c57f9ca1832e..aca3b211644f39daaadeee7f31a654d907ad7025 100644 (file)
@@ -5,7 +5,7 @@
  *
  * x3 is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -22,6 +22,7 @@
 #define _nickserv_h
 
 #include "hash.h"   /* for NICKLEN, etc., and common.h */
+#include <tre/regex.h> /* for regex in nickserv_config */
 struct svccmd;
 
 #define NICKSERV_HANDLE_LEN ACCOUNTLEN
@@ -101,9 +102,6 @@ struct handle_info {
     char *infoline;
     char *handle;
     char *fakehost;
-#ifdef WITH_PROTOCOL_BAHAMUT
-    unsigned long id;
-#endif
     time_t registered;
     time_t lastseen;
     unsigned short flags;
@@ -131,6 +129,81 @@ struct handle_info_list {
 
 extern const char *handle_flags;
 
+enum reclaim_action {
+    RECLAIM_NONE,
+    RECLAIM_WARN,
+    RECLAIM_SVSNICK,
+    RECLAIM_KILL
+};
+
+struct nickserv_config {
+    unsigned int disable_nicks : 1;
+    unsigned int valid_handle_regex_set : 1;
+    unsigned int valid_nick_regex_set : 1;
+    unsigned int valid_fakehost_regex_set : 1;
+    unsigned int autogag_enabled : 1;
+    unsigned int email_enabled : 1;
+    unsigned int email_required : 1;
+    unsigned int default_hostmask : 1;
+    unsigned int warn_nick_owned : 1;
+    unsigned int warn_clone_auth : 1;
+    unsigned int sync_log : 1;
+    unsigned long nicks_per_handle;
+    unsigned long password_min_length;
+    unsigned long password_min_digits;
+    unsigned long password_min_upper;
+    unsigned long password_min_lower;
+    unsigned long db_backup_frequency;
+    unsigned long handle_expire_frequency;
+    unsigned long autogag_duration;
+    unsigned long email_visible_level;
+    unsigned long cookie_timeout;
+    unsigned long handle_expire_delay;
+    unsigned long nochan_handle_expire_delay;
+    unsigned long modoper_level;
+    unsigned long set_epithet_level;
+    unsigned long set_title_level;
+    unsigned long set_fakehost_level;
+    unsigned long handles_per_email;
+    unsigned long email_search_level;
+    const char *network_name;
+    const char *titlehost_suffix;
+    regex_t valid_handle_regex;
+    regex_t valid_nick_regex;
+    regex_t valid_fakehost_regex;
+    dict_t weak_password_dict;
+    struct policer_params *auth_policer_params;
+    enum reclaim_action reclaim_action;
+    enum reclaim_action auto_reclaim_action;
+    unsigned long auto_reclaim_delay;
+    unsigned char default_maxlogins;
+    unsigned char hard_maxlogins;
+    const char *auto_oper;
+    const char *auto_admin;
+    char default_style;
+    struct string_list *denied_fakehost_words;
+    unsigned int force_handles_lowercase;
+    unsigned int ldap_enable;
+#ifdef WITH_LDAP
+    const char *ldap_uri;
+    const char *ldap_base;
+    const char *ldap_dn_fmt;
+    unsigned int ldap_version;
+    unsigned int ldap_autocreate;
+
+    const char *ldap_admin_dn;
+    const char *ldap_admin_pass;
+    const char *ldap_field_account;
+    const char *ldap_field_password;
+    const char *ldap_field_email;
+    struct string_list *ldap_object_classes;
+    const char *ldap_oper_group_dn;
+    unsigned int ldap_oper_group_level;
+    const char *ldap_field_group_member;
+    unsigned int ldap_timeout;
+#endif
+};
+
 void init_nickserv(const char *nick);
 struct handle_info *get_handle_info(const char *handle);
 struct handle_info *smart_get_handle_info(struct userNode *service, struct userNode *user, const char *name);
@@ -143,7 +216,7 @@ int oper_has_access(struct userNode *user, struct userNode *bot, unsigned int mi
 void nickserv_show_oper_accounts(struct userNode *user, struct svccmd *cmd);
 
 struct handle_info *get_victim_oper(struct svccmd *cmd, struct userNode *user, const char *target);
-struct handle_info *loc_auth(char *handle, char *password);
+struct handle_info *loc_auth(char *handle, char *password, char *userhost);
 
 typedef void (*user_mode_func_t)(struct userNode *user, const char *mode_change);
 void reg_user_mode_func(user_mode_func_t func);