X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/ba4b4d51cca3e321dbb82384f00b9458e72e7639..f79cdffc2ce0a1a1a74ca5eadc85b165a9f6944f:/src/proto-p10.c diff --git a/src/proto-p10.c b/src/proto-p10.c index ba1810b..88989bf 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -80,6 +80,7 @@ #define CMD_PROTO "PROTO" #define CMD_QUIT "QUIT" #define CMD_REHASH "REHASH" +#define CMD_REMOVE "REMOVE" #define CMD_RESET "RESET" #define CMD_RESTART "RESTART" #define CMD_RPING "RPING" @@ -121,6 +122,7 @@ #define CMD_WHO "WHO" #define CMD_WHOIS "WHOIS" #define CMD_WHOWAS "WHOWAS" +#define CMD_ZLINE "ZLINE" /* Tokenized commands. */ #define TOK_ACCOUNT "AC" @@ -177,6 +179,7 @@ #define TOK_PROTO "PROTO" #define TOK_QUIT "Q" #define TOK_REHASH "REHASH" +#define TOK_REMOVE "RM" #define TOK_RESET "RESET" #define TOK_RESTART "RESTART" #define TOK_RPING "RI" @@ -218,6 +221,7 @@ #define TOK_WHO "H" #define TOK_WHOIS "W" #define TOK_WHOWAS "X" +#define TOK_ZLINE "ZL" /* Protocol messages; aliased to full commands or tokens depending on compile-time configuration. ircu prefers tokens WITH THE @@ -283,6 +287,7 @@ #define P10_PROTO TYPE(PROTO) #define P10_QUIT TYPE(QUIT) #define P10_REHASH TYPE(REHASH) +#define P10_REMOVE TYPE(REMOVE) #define P10_RESET TYPE(RESET) #define P10_RESTART TYPE(RESTART) #define P10_RPING TYPE(RPING) @@ -323,6 +328,7 @@ #define P10_WHO TYPE(WHO) #define P10_WHOIS TYPE(WHOIS) #define P10_WHOWAS TYPE(WHOWAS) +#define P10_ZLINE TYPE(ZLINE) #define P10_EXEMPT TYPE(EXEMPT) /* Servers claiming to have a boot or link time before PREHISTORY @@ -343,8 +349,8 @@ static const char *his_servername; static const char *his_servercomment; static int extended_accounts; -/* These correspond to 1 << X: 012345678901234567 */ -const char irc_user_mode_chars[] = "o iw dkgn I"; +/* These correspond to 1 << X: 01234567890123456789012345 */ +const char irc_user_mode_chars[] = "oOiw dkgh x BnIX azDRWHLq"; static struct userNode *AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip); @@ -514,7 +520,7 @@ irc_p10_pton(irc_in_addr_t *ip, const char *input) do { if (*input == '_') { unsigned int left; - for (left = (25 - strlen(input)) / 3; left; left--) + for (left = (25 - strlen(input)) / 3 - pos; left; left--) ip->in6[pos++] = 0; input++; } else { @@ -1247,7 +1253,7 @@ static CMD_FUNC(cmd_whois) else irc_numeric(from, RPL_WHOISUSER, "%s %s %s * :%s", who->nick, who->ident, who->hostname, who->info); - if (IsService(who) || (from == who)) { + if (!IsService(who) || (from == who)) { struct modeNode *mn; mlen = strlen(self->name) + strlen(from->nick) + 12 + strlen(who->nick); len = 0; @@ -1577,7 +1583,7 @@ static CMD_FUNC(cmd_account) if(!strcmp(argv[2],"C")) { - if((hi = loc_auth(argv[4], argv[5], NULL))) + if((hi = loc_auth(NULL, argv[4], argv[5], NULL))) { /* Return a AC A */ putsock("%s " P10_ACCOUNT " %s A %s "FMT_TIME_T, self->numeric, server->numeric , argv[3], hi->registered); @@ -1593,7 +1599,21 @@ static CMD_FUNC(cmd_account) } else if(!strcmp(argv[2],"H")) /* New enhanced (host) version of C */ { - if((hi = loc_auth(argv[5], argv[6], argv[4] ))) + if((hi = loc_auth(NULL, argv[5], argv[6], argv[4] ))) + { + /* Return a AC A */ + putsock("%s " P10_ACCOUNT " %s A %s "FMT_TIME_T, self->numeric, server->numeric , argv[3], hi->registered); + } + else + { + /* Return a AC D */ + putsock("%s " P10_ACCOUNT " %s D %s", self->numeric, server->numeric , argv[3]); + } + return 1; + } + else if(!strcmp(argv[2],"S")) + { + if((hi = loc_auth(argv[5], argv[6], argv[7], argv[4]))) { /* Return a AC A */ putsock("%s " P10_ACCOUNT " %s A %s "FMT_TIME_T, self->numeric, server->numeric , argv[3], hi->registered); @@ -1757,7 +1777,8 @@ static CMD_FUNC(cmd_privs) for (tmp = x3_strtok(&p, argv[i], ","); tmp; tmp = x3_strtok(&p, NULL, ",")) { if (!strcmp(tmp, "PRIV_NONE")) { - clear_privs(user); + if (now > user->timestamp+5) + clear_privs(user); break; } else client_modify_priv_by_name(user, tmp, what); @@ -1780,7 +1801,9 @@ static CMD_FUNC(cmd_burst) struct modeNode *mNode; long mode; int oplevel = -1; + int type = 0; char *user, *end, sep; + char *tstr; time_t in_timestamp; char* parm = NULL; @@ -1788,6 +1811,11 @@ static CMD_FUNC(cmd_burst) return 0; modes[0] = 0; + tstr = conf_get_data("server/type", RECDB_QSTRING); + if(tstr) { + type = atoi(tstr); + } + exemptlist[0] = 0; banlist[0] = 0; @@ -1798,7 +1826,7 @@ static CMD_FUNC(cmd_burst) int n_modes; for (pos=argv[next], n_modes = 1; *pos; pos++) if ((*pos == 'k') || (*pos == 'l') || (*pos == 'A') - || (*pos == 'U')) + || (*pos == 'U') || ((type > 7) && (*pos == 'L'))) n_modes++; if (next + n_modes > argc) n_modes = argc - next; @@ -2487,7 +2515,7 @@ free_user(struct userNode *user) } static void -parse_cleanup(void) +parse_cleanup(UNUSED_ARG(void *extra)) { unsigned int nn; free(of_list); @@ -2511,7 +2539,7 @@ p10_conf_reload(void) { } static void -remove_unbursted_channel(struct chanNode *cNode) { +remove_unbursted_channel(struct chanNode *cNode, UNUSED_ARG(void *extra)) { if (unbursted_channels) dict_remove(unbursted_channels, cNode->name); } @@ -2685,6 +2713,11 @@ init_parse(void) /* We have reliable clock! Always! Wraaa! */ dict_insert(irc_func_dict, CMD_SETTIME, cmd_dummy); dict_insert(irc_func_dict, TOK_SETTIME, cmd_dummy); + /* Ignore ZLINE/ZL/REMOVE/RM */ + dict_insert(irc_func_dict, CMD_ZLINE, cmd_dummy); + dict_insert(irc_func_dict, TOK_ZLINE, cmd_dummy); + dict_insert(irc_func_dict, CMD_REMOVE, cmd_dummy); + dict_insert(irc_func_dict, TOK_REMOVE, cmd_dummy); /* ignore /trace and /motd commands targetted at us */ dict_insert(irc_func_dict, TOK_TRACE, cmd_dummy); @@ -2723,8 +2756,8 @@ init_parse(void) memset(notice_funcs, 0, sizeof(privmsg_func_t)*num_notice_funcs); userList_init(&dead_users); - reg_del_channel_func(remove_unbursted_channel); - reg_exit_func(parse_cleanup); + reg_del_channel_func(remove_unbursted_channel, NULL); + reg_exit_func(parse_cleanup, NULL); // reg_notice_func(opserv, check_ctcp); } @@ -3062,7 +3095,7 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char * tstr = conf_get_data("server/type", RECDB_QSTRING); type = atoi(tstr); - if (type > 6) { + if (type == 7) { if (irc_in_addr_is_ipv4(uNode->ip)) { make_virtip((char*)irc_ntoa(&uNode->ip), (char*)irc_ntoa(&uNode->ip), uNode->cryptip); make_virthost((char*)irc_ntoa(&uNode->ip), uNode->hostname, uNode->crypthost); @@ -3297,6 +3330,14 @@ void mod_usermode(struct userNode *user, const char *mode_change) { assign_fakehost(user, host, 0); } break; + case 'a': do_user_mode(FLAGS_ADMIN); break; + case 'z': do_user_mode(FLAGS_SSL); break; + case 'D': do_user_mode(FLAGS_PRIVDEAF); break; + case 'R': do_user_mode(FLAGS_ACCOUNTONLY); break; + case 'W': do_user_mode(FLAGS_WHOIS); break; + case 'H': do_user_mode(FLAGS_HIDEOPER); break; + case 'L': do_user_mode(FLAGS_NOLINK); break; + case 'q': do_user_mode(FLAGS_COMMONCHANSONLY); break; } #undef do_user_mode } @@ -3594,6 +3635,7 @@ mod_chanmode_announce(struct userNode *who, struct chanNode *channel, struct mod DO_MODE_CHAR(NOQUITMSGS, 'Q'); DO_MODE_CHAR(NOAMSG, 'T'); DO_MODE_CHAR(OPERSONLY, 'O'); + DO_MODE_CHAR(ADMINSONLY, 'a'); DO_MODE_CHAR(REGISTERED, 'z'); DO_MODE_CHAR(SSLONLY, 'Z'); DO_MODE_CHAR(HIDEMODE, 'L'); @@ -3650,6 +3692,7 @@ mod_chanmode_announce(struct userNode *who, struct chanNode *channel, struct mod DO_MODE_CHAR(NOQUITMSGS, 'Q'); DO_MODE_CHAR(NOAMSG, 'T'); DO_MODE_CHAR(OPERSONLY, 'O'); + DO_MODE_CHAR(ADMINSONLY, 'a'); DO_MODE_CHAR(REGISTERED, 'z'); DO_MODE_CHAR(SSLONLY, 'Z'); DO_MODE_CHAR(HIDEMODE, 'L'); @@ -3725,6 +3768,7 @@ mod_chanmode_format(struct mod_chanmode *change, char *outbuff) DO_MODE_CHAR(NOQUITMSGS, 'Q'); DO_MODE_CHAR(NOAMSG, 'T'); DO_MODE_CHAR(OPERSONLY, 'O'); + DO_MODE_CHAR(ADMINSONLY, 'a'); DO_MODE_CHAR(REGISTERED, 'z'); DO_MODE_CHAR(SSLONLY, 'Z'); DO_MODE_CHAR(HIDEMODE, 'L'); @@ -3749,6 +3793,7 @@ mod_chanmode_format(struct mod_chanmode *change, char *outbuff) DO_MODE_CHAR(NOQUITMSGS, 'Q'); DO_MODE_CHAR(NOAMSG, 'T'); DO_MODE_CHAR(OPERSONLY, 'O'); + DO_MODE_CHAR(ADMINSONLY, 'a'); DO_MODE_CHAR(REGISTERED, 'z'); DO_MODE_CHAR(SSLONLY, 'Z'); DO_MODE_CHAR(HIDEMODE, 'L');