From: Michael Poole Date: Fri, 11 Jul 2008 02:04:41 +0000 (-0400) Subject: Allow NickServ to ignore accounts if the user's account create ts is wrong. X-Git-Tag: v1.4.0-rc3~3 X-Git-Url: http://git.pk910.de/?p=srvx.git;a=commitdiff_plain;h=d670d26ae0ad194364480e309e8b5c789f2985d5 Allow NickServ to ignore accounts if the user's account create ts is wrong. src/nickserv.c (KEY_HANDLE_TS_MODE): Define. (enum handle_ts_mode): Define. (nickserv_conf): Add handle_ts_mode field. (nickserv_conf_read): Set it. (handle_account): Use it. srvx.conf.example: Document it. --- diff --git a/src/nickserv.c b/src/nickserv.c index 180fea8..6717a56 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -73,6 +73,7 @@ #define KEY_EMAIL_SEARCH_LEVEL "email_search_level" #define KEY_OUNREGISTER_INACTIVE "ounregister_inactive" #define KEY_OUNREGISTER_FLAGS "ounregister_flags" +#define KEY_HANDLE_TS_MODE "account_timestamp_mode" #define KEY_ID "id" #define KEY_PASSWD "passwd" @@ -342,6 +343,11 @@ static void nickserv_reclaim(struct userNode *user, struct nick_info *ni, enum r static void nickserv_reclaim_p(void *data); static int nickserv_addmask(struct userNode *user, struct handle_info *hi, const char *mask); +enum handle_ts_mode { + TS_IGNORE, + TS_IRCU +}; + static struct { unsigned int disable_nicks : 1; unsigned int valid_handle_regex_set : 1; @@ -378,6 +384,7 @@ static struct { struct policer_params *auth_policer_params; enum reclaim_action reclaim_action; enum reclaim_action auto_reclaim_action; + enum handle_ts_mode handle_ts_mode; unsigned long auto_reclaim_delay; unsigned char default_maxlogins; unsigned char hard_maxlogins; @@ -3836,6 +3843,13 @@ nickserv_conf_read(void) if(pos) nickserv_conf.ounregister_flags |= 1 << (pos - 1); } + str = database_get_data(conf_node, KEY_HANDLE_TS_MODE, RECDB_QSTRING); + if (!str) + nickserv_conf.handle_ts_mode = TS_IGNORE; + else if (!irccasecmp(str, "ircu")) + nickserv_conf.handle_ts_mode = TS_IRCU; + else + nickserv_conf.handle_ts_mode = TS_IGNORE; if (!nickserv_conf.disable_nicks) { str = database_get_data(conf_node, "reclaim_action", RECDB_QSTRING); nickserv_conf.reclaim_action = str ? reclaim_action_from_string(str) : RECLAIM_NONE; @@ -3983,6 +3997,10 @@ handle_account(struct userNode *user, const char *stamp, unsigned long timestamp } if (hi) { + if ((nickserv_conf.handle_ts_mode == TS_IRCU) + && (timestamp != hi->registered)) { + return; + } if (HANDLE_FLAGGED(hi, SUSPENDED)) { return; } diff --git a/srvx.conf.example b/srvx.conf.example index d5ea362..d3cac22 100644 --- a/srvx.conf.example +++ b/srvx.conf.example @@ -57,6 +57,8 @@ "default_maxlogins" "2"; // what is the absolute maxlogins value? "hard_maxlogins" "10"; + // Which mode should we use for account timestamps? + "account_timestamp_mode" "ignore"; // This names a file that contains easily guessed passwords. // It always contains "password", "" and the user's // account name.