From: sirvulcan Date: Mon, 25 Feb 2008 02:25:29 +0000 (+0000) Subject: support for new style cloaked hosts (requires type to be set to 7) X-Git-Tag: 1.9~314 X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/commitdiff_plain/412b1e16431d0eafbe1bacb0d7e610971144035c?hp=3c10e41ef5b719442d1c5ae3384d673600082d4c support for new style cloaked hosts (requires type to be set to 7) --- diff --git a/src/hash.h b/src/hash.h index 9767650..132f852 100644 --- a/src/hash.h +++ b/src/hash.h @@ -75,6 +75,8 @@ #define FLAGS_HIDDEN_HOST 0x2000 /* user's host is masked by their account */ #define FLAGS_REGNICK 0x4000 /* user owns their current nick */ #define FLAGS_REGISTERING 0x8000 /* user has issued account register command, is waiting for email cookie */ +#define FLAGS_CLOAKHOST 0x10000 /* user has cloaked host */ +#define FLAGS_CLOAKIP 0x20000 /* user has cloaked ip */ #define IsOper(x) ((x)->modes & FLAGS_OPER) #define IsService(x) ((x)->modes & FLAGS_SERVICE) diff --git a/src/proto-p10.c b/src/proto-p10.c index 5e552d0..aa44db5 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -2774,6 +2774,8 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char * { struct userNode *oldUser, *uNode; unsigned int n, ignore_user; + char *tstr; + int type; if ((strlen(numeric) < 3) || (strlen(numeric) > 5)) { log_module(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): numeric %s wrong length!", uplink, nick, numeric); @@ -2822,11 +2824,15 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char * safestrncpy(uNode->numeric, numeric, sizeof(uNode->numeric)); irc_p10_pton(&uNode->ip, realip); - 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); - } else if (irc_in_addr_is_ipv6(uNode->ip)) { - make_ipv6virthost((char*)irc_ntoa(&uNode->ip), uNode->hostname, uNode->crypthost); + tstr = conf_get_data("server/type", RECDB_QSTRING); + type = atoi(tstr); + if (type > 6) { + 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); + } else if (irc_in_addr_is_ipv6(uNode->ip)) { + make_ipv6virthost((char*)irc_ntoa(&uNode->ip), uNode->hostname, uNode->crypthost); + } } if (!uNode->crypthost && uNode->cryptip) @@ -2981,6 +2987,30 @@ void mod_usermode(struct userNode *user, const char *mode_change) { // case 'h': do_user_mode(FLAGS_HELPER); break; // I check if there's an 'h' in the first part, and if there, // then everything after the space becomes their new host. + case 'C': do_user_mode(FLAGS_CLOAKHOST); + if (*word) { + char cloakhost[MAXLEN]; + unsigned int ii; + for (ii=0; (*word != ' ') && (*word != '\0'); ) + cloakhost[ii++] = *word++; + cloakhost[ii] = 0; + while (*word == ' ') + word++; + safestrncpy(user->crypthost, cloakhost, sizeof(user->crypthost)); + } + break; + case 'c': do_user_mode(FLAGS_CLOAKIP); + if (*word) { + char cloakip[MAXLEN]; + unsigned int ii; + for (ii=0; (*word != ' ') && (*word != '\0'); ) + cloakip[ii++] = *word++; + cloakip[ii] = 0; + while (*word == ' ') + word++; + safestrncpy(user->cryptip, cloakip, sizeof(user->cryptip)); + } + break; case 'h': do_user_mode(FLAGS_SETHOST); if (*word) { char sethost[MAXLEN]; diff --git a/x3.conf.example b/x3.conf.example index 80a95fc..5a9c614 100644 --- a/x3.conf.example +++ b/x3.conf.example @@ -51,13 +51,15 @@ "key1" "45432"; // Set these key values to the network KEY values you use "key2" "76934"; // for host hiding style 2. "key3" "98336"; + "prefix" "AfterNET"; // If you use style 2 then this is the name that is prefixed to hosts. "numeric" "51"; // hint: If you get collisions on link, CHANGE THIS. /* Type handles some changes in nefarious 1.0 (was 0.5.0) * 4 - nefarious 0.4.x and other ircds - * 5 - nefarious 1.0.x and higher (Branch Revision) - * 6 - nefarious 1.0.x and higher (Trunk Revision) + * 5 - nefarious 1.0.x and higher (Obselete) + * 6 - nefarious 1.1.0 and higher (Branch Revision) + * 7 - nefarious 1.2.0 and higher (Trunk Revsions) */ - "type" "5"; + "type" "6"; "host_in_topic" "1"; //Set to 1 if your Nefarious server have the HOST_IN_TOPIC F:line set to TRUE. "max_users" "256"; // You can save a little memory by setting this to a lower value. "force_n2k" "1"; // Use extended (5-digit) numnick for self, even if 3 are possible.