~ubuntu-branches/debian/sid/ircd-hybrid/sid

« back to all changes in this revision

Viewing changes to modules/m_ping.c

  • Committer: Package Import Robot
  • Author(s): Dominic Hargreaves
  • Date: 2015-04-19 15:53:09 UTC
  • mfrom: (1.2.13)
  • Revision ID: package-import@ubuntu.com-20150419155309-06y59x2at2ax5ou3
Tags: 1:8.2.7+dfsg.1-1
* Remove Suggests: hybserv since it doesn't really work with
  ircd-hybrid 8 and above
* New upstream release
  - update debian/copyright with minor changes
  - update config files from new reference.conf
  - fixes DoS from localhost clients (Closes: #782859)
  - supports SSL certficate chaining (Closes: #769741)
* Debconf configuration script no longer ignores the result of
  upgrade questions (Closes: #779082)
* Don't display upgrade warnings on new installs (Closes: #782883)
* Add NEWS item about updated configuration

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3
3
 *
4
 
 *  Copyright (c) 1997-2014 ircd-hybrid development team
 
4
 *  Copyright (c) 1997-2015 ircd-hybrid development team
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
21
21
 
22
22
/*! \file m_ping.c
23
23
 * \brief Includes required functions for processing the PING command.
24
 
 * \version $Id: m_ping.c 4564 2014-08-24 10:24:47Z michael $
 
24
 * \version $Id: m_ping.c 5346 2015-01-11 12:41:14Z michael $
25
25
 */
26
26
 
27
27
#include "stdinc.h"
52
52
static int
53
53
m_ping(struct Client *source_p, int parc, char *parv[])
54
54
{
55
 
  struct Client *target_p;
56
 
  char *origin, *destination;
 
55
  struct Client *target_p = NULL;
 
56
  const char *destination = NULL;
57
57
 
58
58
  if (parc < 2 || EmptyString(parv[1]))
59
59
  {
61
61
    return 0;
62
62
  }
63
63
 
64
 
  origin = parv[1];
65
64
  destination = parv[2];  /* Will get NULL or pointer (parc >= 2!!) */
66
65
 
67
66
  if (ConfigServerHide.disable_remote_commands && !HasUMode(source_p, UMODE_OPER))
68
67
  {
69
68
    sendto_one(source_p, ":%s PONG %s :%s", me.name,
70
 
              (destination) ? destination : me.name, origin);
 
69
               (destination) ? destination : me.name, parv[1]);
71
70
    return 0;
72
71
  }
73
72
 
74
73
  if (!EmptyString(destination) && irccmp(destination, me.name))
75
74
  {
76
 
    /* We're sending it across servers.. origin == source_p->name --fl_ */
77
 
    origin = source_p->name;
78
 
 
79
75
    if ((target_p = hash_find_server(destination)))
80
 
      sendto_one(target_p, ":%s PING %s :%s", source_p->name,
81
 
                 origin, destination);
 
76
      sendto_one(target_p, ":%s PING %s :%s",
 
77
                 ID_or_name(source_p, target_p), source_p->name,
 
78
                 ID_or_name(target_p, target_p));
82
79
    else
83
80
      sendto_one_numeric(source_p, &me, ERR_NOSUCHSERVER, destination);
84
81
  }
85
82
  else
86
83
    sendto_one(source_p, ":%s PONG %s :%s", me.name,
87
 
               (destination) ? destination : me.name, origin);
 
84
               (destination) ? destination : me.name, parv[1]);
88
85
  return 0;
89
86
}
90
87
 
103
100
static int
104
101
ms_ping(struct Client *source_p, int parc, char *parv[])
105
102
{
106
 
  struct Client *target_p;
107
 
  const char *origin, *destination;
 
103
  struct Client *target_p = NULL;
 
104
  const char *destination = NULL;
108
105
 
109
106
  if (parc < 2 || EmptyString(parv[1]))
110
107
  {
112
109
    return 0;
113
110
  }
114
111
 
115
 
  origin = source_p->name;
116
112
  destination = parv[2];  /* Will get NULL or pointer (parc >= 2!!) */
117
113
 
118
114
  if (!EmptyString(destination) && irccmp(destination, me.name) && irccmp(destination, me.id))
119
115
  {
120
116
    if ((target_p = hash_find_server(destination)))
121
 
      sendto_one(target_p, ":%s PING %s :%s", source_p->name,
122
 
                 origin, destination);
123
 
    else
 
117
    {
 
118
      if (target_p->from != source_p->from)
 
119
        sendto_one(target_p, ":%s PING %s :%s",
 
120
                   ID_or_name(source_p, target_p), source_p->name,
 
121
                   ID_or_name(target_p, target_p));
 
122
    }
 
123
    else if (!IsDigit(*destination))
124
124
      sendto_one_numeric(source_p, &me, ERR_NOSUCHSERVER, destination);
125
125
  }
126
126
  else
127
127
    sendto_one(source_p, ":%s PONG %s :%s", ID_or_name(&me, source_p),
128
 
               (destination) ? destination : me.name, origin);
 
128
               (destination) ? destination : me.name, ID_or_name(source_p, source_p));
129
129
  return 0;
130
130
}
131
131
 
151
151
{
152
152
  .node    = { NULL, NULL, NULL },
153
153
  .name    = NULL,
154
 
  .version = "$Revision: 4564 $",
 
154
  .version = "$Revision: 5346 $",
155
155
  .handle  = NULL,
156
156
  .modinit = module_init,
157
157
  .modexit = module_exit,