added gnutls backend and moved backend code into new files
[ircu2.10.12-pk.git] / ircd / m_userip.c
index c7b5e01441b79d5e00cd9fbedba91f3716591ccf..0085a0cd15c29ef9788f6c1b658a210ffe797e85 100644 (file)
  *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
  *                    non-NULL pointers.
  */
-#if 0
-/*
- * No need to include handlers.h here the signatures must match
- * and we don't need to force a rebuild of all the handlers everytime
- * we add a new one to the list. --Bleep
- */
-#include "handlers.h"
-#endif /* 0 */
+#include "config.h"
+
 #include "client.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
+#include "ircd_features.h"
+#include "ircd_log.h"
 #include "msgq.h"
 #include "numeric.h"
 #include "s_user.h"
 #include "struct.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 
-static void userip_formatter(struct Client* cptr, struct MsgBuf* mb)
+static void userip_formatter(struct Client* cptr, struct Client *sptr, struct MsgBuf* mb)
 {
   assert(IsUser(cptr));
-  msgq_append(0, mb, "%s%s=%c%s@%s", cptr->name, IsAnOper(cptr) ? "*" : "",
-             cptr->user->away ? '-' : '+', cptr->user->username,
-             ircd_ntoa((const char*) &cptr->ip));
+  msgq_append(0, mb, "%s%s=%c%s@%s", cli_name(cptr),
+             SeeOper(sptr,cptr) ? "*" : "",
+             cli_user(cptr)->away ? '-' : '+', cli_user(cptr)->username,
+             /* Do not *EVER* change this to give opers the real IP.
+              * Too many scripts rely on this data and can inadvertently
+              * publish the user's real IP, thus breaking the security
+              * of +x.  If an oper wants the real IP, he should go to
+              * /whois to get it.
+              */
+             HasHiddenHost(cptr) && (sptr != cptr) ?
+             feature_str(FEAT_HIDDEN_IP) :
+             ircd_ntoa(&cli_ip(cptr)));
 }
 
 /*
@@ -118,46 +123,3 @@ int m_userip(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   send_user_info(sptr, parv[1], RPL_USERIP, userip_formatter); 
   return 0;
 }
-
-
-#if 0
-/*
- * m_userip added by Carlo Wood 3/8/97.
- *
- * The same as USERHOST, but with the IP-number instead of the hostname.
- */
-int m_userip(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
-{
-  char *s;
-  int i, j = 5;
-  char *p = 0, *sbuf;
-  struct Client *acptr;
-
-  if (parc < 2)
-    return need_more_params(sptr, "USERIP");
-
-  sbuf = sprintf_irc(sendbuf, rpl_str(RPL_USERIP), me.name, parv[0]); /* XXX DEAD */
-  for (i = j, s = ircd_strtok(&p, parv[1], " "); i && s;
-      s = ircd_strtok(&p, (char *)0, " "), i--)
-    if ((acptr = FindUser(s)))
-    {
-      if (i < j)
-        *sbuf++ = ' ';
-      sbuf = sprintf_irc(sbuf, "%s%s=%c%s@%s", acptr->name,
-          IsAnOper(acptr) ? "*" : "", (acptr->user->away) ? '-' : '+',
-          acptr->user->username, ircd_ntoa((const char*) &acptr->ip));
-    }
-    else
-    {
-      if (i < j)
-        sendbufto_one(sptr); /* XXX DEAD */
-      sendto_one(sptr, err_str(ERR_NOSUCHNICK), me.name, parv[0], s); /* XXX DEAD */
-      sbuf = sprintf_irc(sendbuf, rpl_str(RPL_USERIP), me.name, parv[0]); /* XXX DEAD */
-      j = i - 1;
-    }
-  if (i < j)
-    sendbufto_one(sptr); /* XXX DEAD */
-  return 0;
-}
-#endif /* 0 */
-