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

Comparing ircd-hybrid/trunk/src/conf.c (file contents):
Revision 1921 by michael, Tue Apr 30 14:54:20 2013 UTC vs.
Revision 1922 by michael, Tue Apr 30 15:08:42 2013 UTC

# Line 216 | Line 216 | conf_free(struct MaskItem *conf)
216    MyFree(conf);
217   }
218  
219 static const struct shared_flags
220 {
221  const unsigned int type;
222  const unsigned char letter;
223 } flag_table[] = {
224  { SHARED_KLINE,   'K' },
225  { SHARED_UNKLINE, 'U' },
226  { SHARED_XLINE,   'X' },
227  { SHARED_UNXLINE, 'Y' },
228  { SHARED_RESV,    'Q' },
229  { SHARED_UNRESV,  'R' },
230  { SHARED_LOCOPS,  'L' },
231  { SHARED_DLINE,   'D' },
232  { SHARED_UNDLINE, 'E' },
233  { 0, '\0' }
234 };
235
236 /*
237 * inputs       - pointer to client requesting confitem report
238 *              - ConfType to report
239 * output       - none
240 * side effects -
241 */
242 void
243 report_confitem_types(struct Client *source_p, enum maskitem_type type)
244 {
245  dlink_node *ptr = NULL, *dptr = NULL;
246  struct MaskItem *conf = NULL;
247  const struct ClassItem *class = NULL;
248  const struct shared_flags *shared = NULL;
249  char buf[12];
250  char *p = NULL;
251
252  switch (type)
253  {
254  case CONF_XLINE:
255    DLINK_FOREACH(ptr, xconf_items.head)
256    {
257      conf = ptr->data;
258
259      sendto_one(source_p, form_str(RPL_STATSXLINE),
260                 me.name, source_p->name,
261                 conf->until ? 'x': 'X', conf->count,
262                 conf->name, conf->reason);
263    }
264    break;
265
266  case CONF_ULINE:
267    shared = flag_table;
268    DLINK_FOREACH(ptr, uconf_items.head)
269    {
270      conf = ptr->data;
271
272      p = buf;
273
274      *p++ = 'c';
275      for (; shared->type; ++shared)
276        if (shared->type & conf->flags)
277          *p++ = shared->letter;
278        else
279          *p++ = ToLower(shared->letter);
280
281      sendto_one(source_p, form_str(RPL_STATSULINE),
282                 me.name, source_p->name, conf->name,
283                 conf->user?conf->user: "*",
284                 conf->host?conf->host: "*", buf);
285    }
286
287    shared = flag_table;
288    DLINK_FOREACH(ptr, cluster_items.head)
289    {
290      conf = ptr->data;
291
292      p = buf;
293
294      *p++ = 'C';
295      for (; shared->type; ++shared)
296        if (shared->type & conf->flags)
297          *p++ = shared->letter;
298        else
299          *p++ = ToLower(shared->letter);
300
301      sendto_one(source_p, form_str(RPL_STATSULINE),
302                 me.name, source_p->name, conf->name,
303                 "*", "*", buf);
304    }
305
306    break;
307
308  case CONF_OPER:
309    DLINK_FOREACH(ptr, oconf_items.head)
310    {
311      conf = ptr->data;
312
313      /* Don't allow non opers to see oper privs */
314      if (HasUMode(source_p, UMODE_OPER))
315        sendto_one(source_p, form_str(RPL_STATSOLINE),
316                   me.name, source_p->name, 'O', conf->user, conf->host,
317                   conf->name, oper_privs_as_string(conf->port),
318                   conf->class ? conf->class->name : "<default>");
319      else
320        sendto_one(source_p, form_str(RPL_STATSOLINE),
321                   me.name, source_p->name, 'O', conf->user, conf->host,
322                   conf->name, "0",
323                   conf->class ? conf->class->name : "<default>");
324    }
325    break;
326
327  case CONF_CLASS:
328    DLINK_FOREACH(ptr, class_get_list()->head)
329    {
330      class = ptr->data;
331      sendto_one(source_p, form_str(RPL_STATSYLINE),
332                 me.name, source_p->name, 'Y',
333                 class->name, class->ping_freq,
334                 class->con_freq,
335                 class->max_total, class->max_sendq,
336                 class->max_recvq,
337                 class->ref_count,
338                 class->number_per_cidr, class->cidr_bitlen_ipv4,
339                 class->number_per_cidr, class->cidr_bitlen_ipv6,
340                 class->active ? "active" : "disabled");
341    }
342    break;
343
344  case CONF_SERVICE:
345    DLINK_FOREACH(ptr, service_items.head)
346    {
347      conf = ptr->data;
348      sendto_one(source_p, form_str(RPL_STATSSERVICE),
349                 me.name, source_p->name, 'S', "*", conf->name, 0, 0);
350    }
351    break;
352
353  case CONF_SERVER:
354    DLINK_FOREACH(ptr, server_items.head)
355    {
356      p = buf;
357      conf = ptr->data;
358
359      buf[0] = '\0';
360
361      if (IsConfAllowAutoConn(conf))
362        *p++ = 'A';
363      if (IsConfSSL(conf))
364        *p++ = 'S';
365      if (buf[0] == '\0')
366        *p++ = '*';
367
368      *p = '\0';
369
370      /*
371       * Allow admins to see actual ips unless hide_server_ips is enabled
372       */
373      if (!ConfigServerHide.hide_server_ips && HasUMode(source_p, UMODE_ADMIN))
374        sendto_one(source_p, form_str(RPL_STATSCLINE),
375                   me.name, source_p->name, 'C', conf->host,
376                   buf, conf->name, conf->port,
377                   conf->class ? conf->class->name : "<default>");
378        else
379          sendto_one(source_p, form_str(RPL_STATSCLINE),
380                     me.name, source_p->name, 'C',
381                     "*@127.0.0.1", buf, conf->name, conf->port,
382                     conf->class ? conf->class->name : "<default>");
383    }
384    break;
385
386  case CONF_HUB:
387    DLINK_FOREACH(ptr, server_items.head)
388    {
389      conf = ptr->data;
390
391      DLINK_FOREACH(dptr, conf->hub_list.head)
392        sendto_one(source_p, form_str(RPL_STATSHLINE), me.name,
393                   source_p->name, 'H', dptr->data, conf->name, 0, "*");
394    }
395
396    DLINK_FOREACH(ptr, server_items.head)
397    {
398      conf = ptr->data;
399
400      DLINK_FOREACH(dptr, conf->leaf_list.head)
401        sendto_one(source_p, form_str(RPL_STATSLLINE), me.name,
402                   source_p->name, 'L', dptr->data, conf->name, 0, "*");
403    }
404
405    break;
406
407  default:
408    break;
409  }
410 }
411
219   /* check_client()
220   *
221   * inputs       - pointer to client

Diff Legend

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