ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_connect.c
(Generate patch)

Comparing:
ircd-hybrid-8/modules/m_connect.c (file contents), Revision 1474 by michael, Sun Jul 22 14:44:07 2012 UTC vs.
ircd-hybrid/trunk/modules/m_connect.c (file contents), Revision 1832 by michael, Fri Apr 19 19:16:09 2013 UTC

# Line 55 | Line 55 | mo_connect(struct Client *client_p, stru
55   {
56    int port;
57    int tmpport;
58 <  struct ConfItem *conf = NULL;
59 <  struct AccessItem *aconf = NULL;
58 >  struct MaskItem *conf = NULL;
59    const struct Client *target_p = NULL;
60  
61    if (EmptyString(parv[1]))
62    {
63 <    sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
63 >    sendto_one(source_p, ERR_NEEDMOREPARAMS,
64                 me.name, source_p->name, "CONNECT");
65      return;
66    }
# Line 70 | Line 69 | mo_connect(struct Client *client_p, stru
69    {
70      if (!HasOFlag(source_p, OPER_FLAG_REMOTE))
71      {
72 <      sendto_one(source_p, form_str(ERR_NOPRIVS),
72 >      sendto_one(source_p, ERR_NOPRIVS,
73                   me.name, source_p->name, "connect");
74        return;
75      }
# Line 91 | Line 90 | mo_connect(struct Client *client_p, stru
90    /*
91     * try to find the name, then host, if both fail notify ops and bail
92     */
93 <  if ((conf = find_matching_name_conf(SERVER_TYPE,
95 <                                      parv[1], NULL, NULL, 0)) != NULL)
96 <    aconf = (struct AccessItem *)map_to_conf(conf);
97 <  else if ((conf = find_matching_name_conf(SERVER_TYPE,
98 <                                           NULL, NULL, parv[1], 0)) != NULL)
99 <    aconf = (struct AccessItem *)map_to_conf(conf);
100 <  
101 <  if (conf == NULL || aconf == NULL)
93 >  if (!(conf = find_matching_name_conf(CONF_SERVER, parv[1], NULL, NULL, 0)))
94    {
95 <    sendto_one(source_p,
96 <               ":%s NOTICE %s :Connect: Host %s not listed in ircd.conf",
97 <               me.name, source_p->name, parv[1]);
98 <    return;
95 >    if  (!(conf = find_matching_name_conf(CONF_SERVER,  NULL, NULL, parv[1], 0)))
96 >    {
97 >      sendto_one(source_p,
98 >                 ":%s NOTICE %s :Connect: Host %s not listed in ircd.conf",
99 >                 me.name, source_p->name, parv[1]);
100 >      return;
101 >    }
102    }
103  
104    /* Get port number from user, if given. If not specified,
105     * use the default form configuration structure. If missing
106     * from there, then use the precompiled default.
107     */
108 <  tmpport = port = aconf->port;
108 >  tmpport = port = conf->port;
109  
110    if (parc > 2 && !EmptyString(parv[2]))
111    {
# Line 141 | Line 136 | mo_connect(struct Client *client_p, stru
136    ilog(LOG_TYPE_IRCD, "CONNECT From %s : %s %s",
137         source_p->name, parv[1], parv[2] ? parv[2] : "");
138  
139 <  aconf->port = port;
139 >  conf->port = port;
140  
141    /* at this point we should be calling connect_server with a valid
142     * C:line and a valid port in the C:line
143     */
144 <  if (serv_connect(aconf, source_p))
144 >  if (serv_connect(conf, source_p))
145    {
146      if (!ConfigServerHide.hide_server_ips && HasUMode(source_p, UMODE_ADMIN))
147        sendto_one(source_p, ":%s NOTICE %s :*** Connecting to %s[%s].%d",
148 <                 me.name, source_p->name, aconf->host,
149 <                 conf->name, aconf->port);
148 >                 me.name, source_p->name, conf->host,
149 >                 conf->name, conf->port);
150      else
151        sendto_one(source_p, ":%s NOTICE %s :*** Connecting to %s.%d",
152 <                 me.name, source_p->name, conf->name, aconf->port);
152 >                 me.name, source_p->name, conf->name, conf->port);
153    }
154    else
155    {
156      sendto_one(source_p, ":%s NOTICE %s :*** Couldn't connect to %s.%d",
157 <               me.name, source_p->name, conf->name, aconf->port);
157 >               me.name, source_p->name, conf->name, conf->port);
158    }
159  
160    /* client is either connecting with all the data it needs or has been
161     * destroyed
162     */
163 <  aconf->port = tmpport;
163 >  conf->port = tmpport;
164   }
165  
166   /*
# Line 185 | Line 180 | ms_connect(struct Client *client_p, stru
180   {
181    int port;
182    int tmpport;
183 <  struct ConfItem *conf = NULL;
189 <  struct AccessItem *aconf = NULL;
183 >  struct MaskItem *conf = NULL;
184    const struct Client *target_p = NULL;
185  
186    if (hunt_server(client_p, source_p,
# Line 195 | Line 189 | ms_connect(struct Client *client_p, stru
189  
190    if (EmptyString(parv[1]))
191    {
192 <    sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
192 >    sendto_one(source_p, ERR_NEEDMOREPARAMS,
193                 me.name, source_p->name, "CONNECT");
194      return;
195    }
# Line 211 | Line 205 | ms_connect(struct Client *client_p, stru
205    /*
206     * try to find the name, then host, if both fail notify ops and bail
207     */
208 <  if ((conf = find_matching_name_conf(SERVER_TYPE,
209 <                                      parv[1], NULL, NULL, 0)) != NULL)
210 <    aconf = map_to_conf(conf);
211 <  else if ((conf = find_matching_name_conf(SERVER_TYPE,
212 <                                           NULL, NULL, parv[1], 0)) != NULL)
213 <    aconf = map_to_conf(conf);
214 <
215 <  if (conf == NULL || aconf == NULL)
216 <  {
223 <    sendto_one(source_p,
224 <               ":%s NOTICE %s :Connect: Host %s not listed in ircd.conf",
225 <               me.name, source_p->name, parv[1]);
226 <    return;
208 >  if (!(conf = find_matching_name_conf(CONF_SERVER, parv[1], NULL, NULL, 0)))
209 >  {
210 >    if  (!(conf = find_matching_name_conf(CONF_SERVER,  NULL, NULL, parv[1], 0)))
211 >    {
212 >      sendto_one(source_p,
213 >                 ":%s NOTICE %s :Connect: Host %s not listed in ircd.conf",
214 >                 me.name, source_p->name, parv[1]);
215 >      return;
216 >    }
217    }
218  
219    /* Get port number from user, if given. If not specified,
220     * use the default form configuration structure. If missing
221     * from there, then use the precompiled default.
222     */
223 <  tmpport = port = aconf->port;
223 >  tmpport = port = conf->port;
224  
225    if (parc > 2 && !EmptyString(parv[2]))
226    {
227      port = atoi(parv[2]);
228  
229      /* if someone sends port 0, and we have a config port.. use it */
230 <    if (port == 0 && aconf->port)
231 <      port = aconf->port;
230 >    if (port == 0 && conf->port)
231 >      port = conf->port;
232      else if (port <= 0)
233      {
234        sendto_one(source_p, ":%s NOTICE %s :Connect: Illegal port number",
# Line 275 | Line 265 | ms_connect(struct Client *client_p, stru
265    ilog(LOG_TYPE_IRCD, "CONNECT From %s : %s %d",
266         source_p->name, parv[1], port);
267  
268 <  aconf->port = port;
268 >  conf->port = port;
269  
270    /*
271     * At this point we should be calling connect_server with a valid
272     * C:line and a valid port in the C:line
273     */
274 <  if (serv_connect(aconf, source_p))
274 >  if (serv_connect(conf, source_p))
275      sendto_one(source_p, ":%s NOTICE %s :*** Connecting to %s.%d",
276 <               me.name, source_p->name, conf->name, aconf->port);
276 >               me.name, source_p->name, conf->name, conf->port);
277    else
278      sendto_one(source_p, ":%s NOTICE %s :*** Couldn't connect to %s.%d",
279 <               me.name, source_p->name, conf->name, aconf->port);
279 >               me.name, source_p->name, conf->name, conf->port);
280    /*
281     * Client is either connecting with all the data it needs or has been
282     * destroyed
283     */
284 <  aconf->port = tmpport;
284 >  conf->port = tmpport;
285   }
286  
287   static struct Message connect_msgtab = {

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)