src/nickserv.c (nickserv_addmask): Declare early.
(cmd_oregister): Allow oper to omit fourth parameter, to set no
hostmask.
(cmd_auth): On success, add user's hostmask if the account's hostmask
list is empty.
(cmd_cookie): Append hostmask to account on successful allowauth.
(init_nickserv): Update merge command access.
git-archimport-id: srvx@srvx.net--2006/srvx--devo--1.3--patch-72
# arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3
#
# arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3
#
+2006-12-23 05:31:56 GMT Michael Poole <mdpoole@troilus.org> patch-72
+
+ Summary:
+ Allow NickServ to learn hostmasks automatically.
+ Revision:
+ srvx--devo--1.3--patch-72
+
+ src/nickserv.c (nickserv_addmask): Declare early.
+ (cmd_oregister): Allow oper to omit fourth parameter, to set no
+ hostmask.
+ (cmd_auth): On success, add user's hostmask if the account's hostmask
+ list is empty.
+ (cmd_cookie): Append hostmask to account on successful allowauth.
+ (init_nickserv): Update merge command access.
+
+ modified files:
+ ChangeLog src/nickserv.c
+
+
2006-12-23 05:27:23 GMT Michael Poole <mdpoole@troilus.org> patch-71
Summary:
2006-12-23 05:27:23 GMT Michael Poole <mdpoole@troilus.org> patch-71
Summary:
};
static void nickserv_reclaim(struct userNode *user, struct nick_info *ni, enum reclaim_action action);
static void nickserv_reclaim_p(void *data);
};
static void nickserv_reclaim(struct userNode *user, struct nick_info *ni, enum reclaim_action action);
static void nickserv_reclaim_p(void *data);
+static int nickserv_addmask(struct userNode *user, struct handle_info *hi, const char *mask);
static struct {
unsigned int disable_nicks : 1;
static struct {
unsigned int disable_nicks : 1;
struct userNode *settee;
struct handle_info *hi;
struct userNode *settee;
struct handle_info *hi;
if (!is_valid_handle(argv[1])) {
reply("NSMSG_BAD_HANDLE", argv[1]);
return 0;
}
if (!is_valid_handle(argv[1])) {
reply("NSMSG_BAD_HANDLE", argv[1]);
return 0;
}
- if (strchr(argv[3], '@')) {
+ if (argc < 4) {
+ mask = NULL;
+ settee = NULL;
+ } else if (strchr(argv[3], '@')) {
mask = canonicalize_hostmask(strdup(argv[3]));
if (argc > 4) {
settee = GetUserH(argv[4]);
mask = canonicalize_hostmask(strdup(argv[3]));
if (argc > 4) {
settee = GetUserH(argv[4]);
- string_list_append(hi->masks, mask);
+ if (mask)
+ string_list_append(hi->masks, mask);
reply("NSMSG_WEAK_PASSWORD");
if (hi->passwd[0] != '$')
cryptpass(passwd, hi->passwd);
reply("NSMSG_WEAK_PASSWORD");
if (hi->passwd[0] != '$')
cryptpass(passwd, hi->passwd);
- reply("NSMSG_AUTH_SUCCESS");
+ if (!hi->masks->used) {
+ irc_in_addr_t ip;
+ string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK|GENMASK_NO_HIDING|GENMASK_ANY_IDENT));
+ if (irc_in_addr_is_valid(user->ip) && irc_pton(&ip, NULL, user->hostname))
+ string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK|GENMASK_BYIP|GENMASK_NO_HIDING|GENMASK_ANY_IDENT));
+ }
+ reply("NSMSG_AUTH_SUCCESS");
nickserv_set_email_addr(hi, hi->cookie->data);
reply("NSMSG_EMAIL_CHANGED");
break;
nickserv_set_email_addr(hi, hi->cookie->data);
reply("NSMSG_EMAIL_CHANGED");
break;
+ case ALLOWAUTH: {
+ char *mask = generate_hostmask(user, GENMASK_OMITNICK|GENMASK_NO_HIDING|GENMASK_ANY_IDENT);
set_user_handle_info(user, hi, 1);
set_user_handle_info(user, hi, 1);
+ nickserv_addmask(user, hi, mask);
reply("NSMSG_AUTH_SUCCESS");
reply("NSMSG_AUTH_SUCCESS");
default:
reply("NSMSG_BAD_COOKIE_TYPE", hi->cookie->type);
log_module(NS_LOG, LOG_ERROR, "Bad cookie type %d for account %s.", hi->cookie->type, hi->handle);
default:
reply("NSMSG_BAD_COOKIE_TYPE", hi->cookie->type);
log_module(NS_LOG, LOG_ERROR, "Bad cookie type %d for account %s.", hi->cookie->type, hi->handle);
nickserv_define_func("USERINFO", cmd_userinfo, -1, 1, 0);
nickserv_define_func("RENAME", cmd_rename_handle, -1, 1, 0);
nickserv_define_func("VACATION", cmd_vacation, -1, 1, 0);
nickserv_define_func("USERINFO", cmd_userinfo, -1, 1, 0);
nickserv_define_func("RENAME", cmd_rename_handle, -1, 1, 0);
nickserv_define_func("VACATION", cmd_vacation, -1, 1, 0);
- nickserv_define_func("MERGE", cmd_merge, 0, 1, 0);
+ nickserv_define_func("MERGE", cmd_merge, 750, 1, 0);
if (!nickserv_conf.disable_nicks) {
/* nick management commands */
nickserv_define_func("REGNICK", cmd_regnick, -1, 1, 0);
if (!nickserv_conf.disable_nicks) {
/* nick management commands */
nickserv_define_func("REGNICK", cmd_regnick, -1, 1, 0);