]> jfr.im git - irc/rizon/plexus4.git/commitdiff
Also send (resolved) cgihost in UWEBIRC
authorOrillion <redacted>
Sun, 29 Jan 2017 12:32:15 +0000 (13:32 +0100)
committerAdam <redacted>
Thu, 2 Feb 2017 01:08:34 +0000 (20:08 -0500)
include/client.h
modules/core/m_server.c
modules/m_webirc.c
modules/m_whois.c
src/client.c
src/numeric.c
src/s_user.c
src/upgrade.c

index 2c5aab9be690e2fb00637435f8d20761bc8a0f70..636b1e81499bda2a39245430fae08a6e04258786 100644 (file)
@@ -504,7 +504,8 @@ struct Client
 
   dlink_list        invited;   /**< invites this client has to channels */
 
-  char              *cgisockhost; /**< if this client is a webirc client, this is the host of where they are from */
+  char              *cgisockhost; /**< if this client is a webirc client, this is the ip of where they are from */
+  char              *cgihost;     /**< if this client is a webirc client, this is the host of where they are from */
 };
 
 
index 58338bc69ae373688277a5cc654078702e2527e3..f663c5bd8b5c0974a547bd9a8f0fd612c6e2338f 100644 (file)
@@ -118,8 +118,8 @@ sendnick_TS(struct Client *client_p, struct Client *target_p)
       sendto_one(client_p, ":%s ENCAP * CERTFP %s :%s",
                  ID(&me), ID(target_p), target_p->certfp);
 
-    if (!EmptyString(target_p->cgisockhost))
-      sendto_one(client_p, ":%s ENCAP * UWEBIRC %s :%s", ID(&me), ID(target_p), target_p->cgisockhost);
+    if (!EmptyString(target_p->cgisockhost) && !EmptyString(target_p->cgihost))
+      sendto_one(client_p, ":%s ENCAP * UWEBIRC %s %s :%s", ID(&me), ID(target_p), target_p->cgisockhost, target_p->cgihost);
   }
 
   if (target_p->away[0])
index 7ed614821945451be227c0abaa63710f55bb46ca..3f54e1d7eb66f9b1b42b35d34ac228d6b494f528 100644 (file)
@@ -69,6 +69,8 @@ webirc_apply(struct Client *target_p, const char *host, const char *ip, const ch
   /* store original host */
   if (target_p->cgisockhost == NULL)
     target_p->cgisockhost = xstrdup(target_p->sockhost);
+  if (target_p->cgihost == NULL)
+    target_p->cgihost = xstrdup(target_p->realhost);
 
   /* apply new ip and host */
   strlcpy(target_p->sockhost, ip, sizeof(target_p->sockhost));
@@ -427,7 +429,8 @@ me_swebirc(struct Client *client_p, struct Client *source_p, int parc, char *par
 /*
  * me_uwebirc
  *      parv[1] = user
- *      parv[2] = webirc sochost
+ *      parv[2] = webirc sockhost
+ *      parv[3] = webirc realhost
  */
 static void
 me_uwebirc(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
@@ -439,8 +442,14 @@ me_uwebirc(struct Client *client_p, struct Client *source_p, int parc, char *par
   MyFree(target_p->cgisockhost);
   target_p->cgisockhost = NULL;
 
-  if (parc > 2 && !EmptyString(parv[2]))
+  MyFree(target_p->cgihost);
+  target_p->cgihost = NULL;
+
+  if (parc > 3 && !EmptyString(parv[3]))
+  {
     target_p->cgisockhost = xstrdup(parv[2]);
+    target_p->cgihost = xstrdup(parv[3]);
+  }
 }
 
 static struct Message webirc_msgtab =
index 34a550c0ccd42b846b9f4713ae9c3c71062816ff..19c752e28c6de043cc35fc84b69692bb043b6693 100644 (file)
@@ -174,8 +174,8 @@ whois_person(struct Client *source_p, struct Client *target_p)
                  source_p->name, target_p->name);
   }
 
-  if (HasUMode(source_p, UMODE_OPER) && target_p->cgisockhost)
-    sendto_one(source_p, form_str(RPL_WHOISREALIP), me.name, source_p->name, target_p->name, target_p->cgisockhost);
+  if (HasUMode(source_p, UMODE_OPER) && !EmptyString(target_p->cgihost) && !EmptyString(target_p->cgisockhost))
+    sendto_one(source_p, form_str(RPL_WHOISREALIP), me.name, source_p->name, target_p->name, target_p->cgihost, target_p->cgisockhost);
 
   if (HasUMode(source_p, UMODE_OPER) || source_p == target_p)
   {
index a92fa671abac9b3ba2eb78cfea07df547c702033..7c8f73508f6821e9674abcf0978122d1735970a6 100644 (file)
@@ -173,6 +173,7 @@ free_client(struct Client *client_p)
   MyFree(client_p->serv);
   MyFree(client_p->certfp);
   MyFree(client_p->cgisockhost);
+  MyFree(client_p->cgihost);
 
   assert(dlink_list_length(&client_p->invited) == 0);
 
index dfdbcd6a45b2663b4a465f2a11d318ca6618c7e9..1f28d64a5138d8d0afc82e0b6de505fca60495e6 100644 (file)
@@ -214,7 +214,7 @@ static const char *const replies[] =
   /* 606 */  [RPL_WATCHLIST]            = ":%s 606 %s :%s",
   /* 607 */  [RPL_ENDOFWATCHLIST]       = ":%s 607 %s :End of WATCH %c",
   /* 671 */  [RPL_WHOISSECURE]          = ":%s 671 %s %s :is using a secure connection",
-  /* 672 */  [RPL_WHOISREALIP]          = ":%s 672 %s %s :is actually from %s",
+  /* 672 */  [RPL_WHOISREALIP]          = ":%s 672 %s %s :is actually from %s [%s]",
   /* 702 */  [RPL_MODLIST]              = ":%s 702 %s %s %p %s %s",
   /* 703 */  [RPL_ENDOFMODLIST]         = ":%s 703 %s :End of /MODLIST.",
   /* 704 */  [RPL_HELPSTART]            = ":%s 704 %s %s :%s",
index bca161424a8a650382549deb720153d9917bcd22..bfc4c996b1a2fd26ed6db8ee562ea7ce96dec533 100644 (file)
@@ -713,8 +713,8 @@ introduce_client(struct Client *source_p)
         if (!EmptyString(source_p->certfp))
           sendto_one(server, ":%s ENCAP * CERTFP %s :%s", ID(&me), ID(source_p), source_p->certfp);
 
-        if (!EmptyString(source_p->cgisockhost))
-          sendto_one(server, ":%s ENCAP * UWEBIRC %s :%s", ID(&me), ID(source_p), source_p->cgisockhost);
+        if (!EmptyString(source_p->cgisockhost) && !EmptyString(source_p->cgihost))
+          sendto_one(server, ":%s ENCAP * UWEBIRC %s %s :%s", ID(&me), ID(source_p), source_p->cgisockhost, source_p->cgihost);
       }
     }
   }
index a25a7f62ce87543210a08bb560b3f3838ce482fb..40e067d3b74284e06eb3c3564459ecd7fab4e8a3 100644 (file)
@@ -104,6 +104,7 @@ serialize_client(struct Client *client, int migration)
   json_object_set_new(j, "sockhost", json_string(client->sockhost));
   json_object_set_new(j, "certfp", json_string(client->certfp));
   json_object_set_new(j, "cgisockhost", json_string(client->cgisockhost));
+  json_object_set_new(j, "cgihost", json_string(client->cgihost));
 
   if (client->localClient != NULL)
   {
@@ -372,6 +373,9 @@ unserialize_client(json_t *client, int migrate)
   p = json_string_value(json_object_get(client, "cgisockhost"));
   if (p)
     client_p->cgisockhost = xstrdup(p);
+  p = json_string_value(json_object_get(client, "cgihost"));
+  if (p)
+    client_p->cgihost = xstrdup(p);
 
   if (IsMe(client_p->servptr))
   {