Exemple #1
0
/* static int remove_tkline_match(const char *host, const char *user)
 * Input: A hostname, a username to unkline.
 * Output: returns YES on success, NO if no tkline removed.
 * Side effects: Any matching tklines are removed.
 */
static int
remove_kline_match(const char *host, const char *user)
{
  struct irc_ssaddr iphost, *piphost;
  struct MaskItem *conf;
  int t = 0;
  int aftype = 0;

  if ((t = parse_netmask(host, &iphost, NULL)) != HM_HOST)
  {
    if (t == HM_IPV6)
      aftype = AF_INET6;
    else
      aftype = AF_INET;

    piphost = &iphost;
  }
  else
    piphost = NULL;

  if ((conf = find_conf_by_address(host, piphost, CONF_KLINE, aftype, user, NULL, 0)))
  {
    if (IsConfDatabase(conf))
    {
      delete_one_address_conf(host, conf);
      return 1;
    }
  }

  return 0;
}
Exemple #2
0
static void
resv_remove(struct Client *source_p, const char *name)
{
  unsigned int type_int = CONF_CRESV;
  const char *type_str = "channel";
  struct MaskItem *conf = NULL;

  if (!IsChanPrefix(*name))
  {
    type_int = CONF_NRESV;
    type_str = "nick";
  }

  if ((conf = find_exact_name_conf(type_int, NULL, name, NULL, NULL)) == NULL)
  {
    if (IsClient(source_p))
     sendto_one_notice(source_p, &me, ":A RESV does not exist for %s: %s", type_str, name);

    return;
  }

  if (!IsConfDatabase(conf))
  {
    if (IsClient(source_p))
      sendto_one_notice(source_p, &me, ":The RESV for %s: %s is in ircd.conf and must be removed by hand.",
                        type_str, name);
    return;
  }

  conf_free(conf);

  if (IsClient(source_p))
    sendto_one_notice(source_p, &me, ":The RESV has been removed on %s: %s", type_str, name);

  sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE,
                       "%s has removed the RESV for %s: %s",
                       get_oper_name(source_p), type_str, name);
  ilog(LOG_TYPE_RESV, "%s removed RESV for [%s]",
       get_oper_name(source_p), name);
}
Exemple #3
0
static void
resv_remove(struct Client *source_p, const char *name)
{
  unsigned int type = CONF_CRESV;
  struct MaskItem *conf = NULL;

  if (!IsChanPrefix(*name))
    type = CONF_NRESV;

  if ((conf = find_exact_name_conf(type, NULL, name, NULL, NULL)) == NULL)
  {
    if (IsClient(source_p))
      sendto_one_notice(source_p, &me, ":No RESV for %s", name);

    return;
  }

  if (!IsConfDatabase(conf))
  {
    if (IsClient(source_p))
      sendto_one_notice(source_p, &me, ":The RESV for %s is in ircd.conf and must be removed by hand",
                        name);
    return;
  }

  conf_free(conf);

  if (IsClient(source_p))
    sendto_one_notice(source_p, &me, ":RESV for [%s] is removed", name);

  sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE,
                       "%s has removed the RESV for: [%s]",
                       get_oper_name(source_p), name);
  ilog(LOG_TYPE_RESV, "%s removed RESV for [%s]",
       get_oper_name(source_p), name);
}