/[svn]/ircd-hybrid-7.2/modules/m_connect.c
ViewVC logotype

Diff of /ircd-hybrid-7.2/modules/m_connect.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 970 by michael, Wed Oct 31 18:09:24 2007 UTC revision 971 by michael, Sun Aug 2 23:27:42 2009 UTC
# Line 39  Line 39 
39  #include "hash.h"  #include "hash.h"
40  #include "modules.h"  #include "modules.h"
41    
42  static void mo_connect(struct Client *, struct Client *, int, char **);  static void mo_connect(struct Client *, struct Client *, int, char *[]);
43  static void ms_connect(struct Client *, struct Client *, int, char **);  static void ms_connect(struct Client *, struct Client *, int, char *[]);
44    
45  struct Message connect_msgtab = {  struct Message connect_msgtab = {
46    "CONNECT", 0, 0, 2, 0, MFLG_SLOW, 0,    "CONNECT", 0, 0, 2, 0, MFLG_SLOW, 0,
47    {m_unregistered, m_not_oper, ms_connect, m_ignore, mo_connect, m_ignore}    { m_unregistered, m_not_oper, ms_connect, m_ignore, mo_connect, m_ignore }
48  };  };
49    
50  #ifndef STATIC_MODULES  #ifndef STATIC_MODULES
# Line 75  const char *_version = "$Revision$"; Line 75  const char *_version = "$Revision$";
75   *      parv[3] = remote server   *      parv[3] = remote server
76   */   */
77  static void  static void
78  mo_connect(struct Client* client_p, struct Client* source_p,  mo_connect(struct Client *client_p, struct Client *source_p,
79             int parc, char* parv[])             int parc, char *parv[])
80  {  {
81    int port;    int port;
82    int tmpport;    int tmpport;
83    struct ConfItem *conf = NULL;    struct ConfItem *conf = NULL;
84    struct AccessItem *aconf = NULL;    struct AccessItem *aconf = NULL;
85    struct Client *target_p;    const struct Client *target_p = NULL;
86    
87    /* always privileged with handlers */    if (EmptyString(parv[1]))
   if (MyConnect(source_p) && !IsOperRemote(source_p) && parc > 3)  
88    {    {
89      sendto_one(source_p, form_str(ERR_NOPRIVS),      sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
90                 me.name, source_p->name, "connect");                 me.name, source_p->name, "CONNECT");
91      return;      return;
92    }    }
93    
94    if (hunt_server(client_p, source_p,    if (parc > 3)
                   ":%s CONNECT %s %s :%s", 3, parc, parv) != HUNTED_ISME)  
     return;  
   
   if (*parv[1] == '\0')  
95    {    {
96      sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),      if (!IsOperRemote(source_p))
97                 me.name, source_p->name, "CONNECT");      {
98      return;        sendto_one(source_p, form_str(ERR_NOPRIVS),
99                     me.name, source_p->name, "connect");
100          return;
101        }
102    
103        if (hunt_server(client_p, source_p, ":%s CONNECT %s %s :%s", 3,
104                        parc, parv) != HUNTED_ISME)
105          return;
106    }    }
107    
108    if ((target_p = find_server(parv[1])))    if ((target_p = find_server(parv[1])))
# Line 121  mo_connect(struct Client* client_p, stru Line 123  mo_connect(struct Client* client_p, stru
123                                             NULL, NULL, parv[1], 0)) != NULL)                                             NULL, NULL, parv[1], 0)) != NULL)
124      aconf = (struct AccessItem *)map_to_conf(conf);      aconf = (struct AccessItem *)map_to_conf(conf);
125        
126    if (conf == NULL)    if (conf == NULL || aconf == NULL)
127    {    {
128      sendto_one(source_p,      sendto_one(source_p,
129                 ":%s NOTICE %s :Connect: Host %s not listed in ircd.conf",                 ":%s NOTICE %s :Connect: Host %s not listed in ircd.conf",
130                 me.name, source_p->name, parv[1]);                 me.name, source_p->name, parv[1]);
131      return;      return;
132    }    }
133        
134    /* Get port number from user, if given. If not specified,    /* Get port number from user, if given. If not specified,
135     * use the default form configuration structure. If missing     * use the default form configuration structure. If missing
136     * from there, then use the precompiled default.     * from there, then use the precompiled default.
# Line 210  ms_connect(struct Client *client_p, stru Line 212  ms_connect(struct Client *client_p, stru
212    int tmpport;    int tmpport;
213    struct ConfItem *conf = NULL;    struct ConfItem *conf = NULL;
214    struct AccessItem *aconf = NULL;    struct AccessItem *aconf = NULL;
215    struct Client *target_p;    const struct Client *target_p = NULL;
216    
217    if (hunt_server(client_p, source_p,    if (hunt_server(client_p, source_p,
218                    ":%s CONNECT %s %s :%s", 3, parc, parv) != HUNTED_ISME)                    ":%s CONNECT %s %s :%s", 3, parc, parv) != HUNTED_ISME)
# Line 236  ms_connect(struct Client *client_p, stru Line 238  ms_connect(struct Client *client_p, stru
238     */     */
239    if ((conf = find_matching_name_conf(SERVER_TYPE,    if ((conf = find_matching_name_conf(SERVER_TYPE,
240                                        parv[1], NULL, NULL, 0)) != NULL)                                        parv[1], NULL, NULL, 0)) != NULL)
241      aconf = (struct AccessItem *)map_to_conf(conf);      aconf = map_to_conf(conf);
242    else if ((conf = find_matching_name_conf(SERVER_TYPE,    else if ((conf = find_matching_name_conf(SERVER_TYPE,
243                                             NULL, NULL, parv[1], 0)) != NULL)                                             NULL, NULL, parv[1], 0)) != NULL)
244      aconf = (struct AccessItem *)map_to_conf(conf);      aconf = map_to_conf(conf);
245    
246    if (aconf == NULL)    if (conf == NULL || aconf == NULL)
247    {    {
248      sendto_one(source_p,      sendto_one(source_p,
249                 ":%s NOTICE %s :Connect: Host %s not listed in ircd.conf",                 ":%s NOTICE %s :Connect: Host %s not listed in ircd.conf",
# Line 249  ms_connect(struct Client *client_p, stru Line 251  ms_connect(struct Client *client_p, stru
251      return;      return;
252    }    }
253    
   assert(aconf != NULL);  
   
254    /* Get port number from user, if given. If not specified,    /* Get port number from user, if given. If not specified,
255     * use the default form configuration structure. If missing     * use the default form configuration structure. If missing
256     * from there, then use the precompiled default.     * from there, then use the precompiled default.

Legend:
Removed from v.970  
changed lines
  Added in v.971

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.26