]> jfr.im git - irc/evilnet/x3.git/commitdiff
support for new style cloaked hosts (requires type to be set to 7)
authorsirvulcan <redacted>
Mon, 25 Feb 2008 02:25:29 +0000 (02:25 +0000)
committersirvulcan <redacted>
Mon, 25 Feb 2008 02:25:29 +0000 (02:25 +0000)
src/hash.h
src/proto-p10.c
x3.conf.example

index 976765062feb6c67bfb86afefdbc491d423f858f..132f852bc87b322310c729a3eaa3965b2b4ed373 100644 (file)
@@ -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)
index 5e552d07a6d487c6959a4dedf52cf8a1aba8985a..aa44db506494ab615c21c48cb07e461989ea455a 100644 (file)
@@ -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];
index 80a95fcfa813d7160b28e59fb480dab2c3302247..5a9c614c18623f70cd54e1153f7b1ddebfc01912 100644 (file)
     "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.