*/
#include "stdinc.h"
-#include "tools.h"
#include "send.h"
#include "channel.h"
#include "client.h"
#include "class.h"
#include "ircd.h"
#include "numeric.h"
-#include "memory.h"
-#include "s_log.h"
+#include "logger.h"
#include "s_serv.h"
#include "whowas.h"
-#include "irc_string.h"
-#include "sprintf_irc.h"
+#include "match.h"
#include "hash.h"
#include "msg.h"
#include "parse.h"
static int
ms_xline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
- /* parv[0] parv[1] parv[2] parv[3] parv[4]
- * oper target serv xline type reason
+ /* source_p parv[1] parv[2] parv[3] parv[4]
+ * oper target serv xline type reason
*/
propagate_xline(source_p, parv[1], 0, parv[2], parv[3], parv[4]);
aconf = make_conf();
aconf->status = CONF_XLINE;
- if(strstr(name, "\\s"))
- {
- char *tmp = LOCAL_COPY(name);
- char *orig = tmp;
- char *new = tmp;
-
- while(*orig)
- {
- if(*orig == '\\' && *(orig + 1) != '\0')
- {
- if(*(orig + 1) == 's')
- {
- *new++ = ' ';
- orig += 2;
- }
- /* otherwise skip that and the escaped
- * character after it, so we dont mistake
- * \\s as \s --fl
- */
- else
- {
- *new++ = *orig++;
- *new++ = *orig++;
- }
- }
- else
- *new++ = *orig++;
- }
-
- *new = '\0';
- DupString(aconf->name, tmp);
- }
- else
- DupString(aconf->name, name);
-
- DupString(aconf->passwd, reason);
+ aconf->name = rb_strdup(name);
+ aconf->passwd = rb_strdup(reason);
collapse(aconf->name);
if(temp_time > 0)
{
- aconf->hold = CurrentTime + temp_time;
+ aconf->hold = rb_current_time() + temp_time;
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added temporary %d min. X-Line for [%s] [%s]",
get_oper_name(source_p), name, reason);
}
- dlinkAddAlloc(aconf, &xline_conf_list);
+ rb_dlinkAddAlloc(aconf, &xline_conf_list);
check_xlines();
}
rb_sprintf(buffer, "\"%s\",\"0\",\"%s\",\"%s\",%ld\n",
aconf->name, aconf->passwd,
- get_oper_name(source_p), CurrentTime);
+ get_oper_name(source_p), (long) rb_current_time());
if(fputs(buffer, out) == -1)
{
static int
ms_unxline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
- /* parv[0] parv[1] parv[2]
- * oper target server gecos
+ /* source_p parv[1] parv[2]
+ * oper target server gecos
*/
propagate_generic(source_p, "UNXLINE", parv[1], CAP_CLUSTER,
"%s", parv[2]);
{
struct ConfItem *aconf;
rb_dlink_node *ptr;
+ char *encoded;
+
+ encoded = xline_encode_spaces(name);
RB_DLINK_FOREACH(ptr, xline_conf_list.head)
{
aconf = ptr->data;
- if(!irccmp(aconf->name, name))
+ if(!irccmp(aconf->name, encoded))
{
if (!aconf->hold)
{
- if (!remove_xline_from_file(source_p, name))
+ if (!remove_xline_from_file(source_p, encoded))
return;
}
else
{
sendto_one_notice(source_p,
":X-Line for [%s] is removed",
- name);
+ encoded);
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s has removed the temporary X-Line for: [%s]",
- get_oper_name(source_p), name);
+ get_oper_name(source_p), encoded);
ilog(L_KLINE, "UX %s %s",
- get_oper_name(source_p), name);
+ get_oper_name(source_p), encoded);
}
remove_reject_mask(aconf->name, NULL);
free_conf(aconf);
rb_dlinkDestroy(ptr, &xline_conf_list);
+ rb_free(encoded);
return;
}
}
- sendto_one_notice(source_p, ":No X-Line for %s", name);
+ sendto_one_notice(source_p, ":No X-Line for %s", encoded);
+ rb_free(encoded);
return;
}
const char *gecos;
mode_t oldumask;
char *p;
+ char *encoded;
int error_on_write = 0;
int found_xline = 0;
break;
}
- strlcpy(buff, buf, sizeof(buff));
+ rb_strlcpy(buff, buf, sizeof(buff));
if((p = strchr(buff, '\n')) != NULL)
*p = '\0';
}
/* matching.. */
- if(irccmp(gecos, huntgecos) == 0)
+ encoded = xline_encode_spaces(gecos);
+ if(irccmp(encoded, huntgecos) == 0)
found_xline++;
else
error_on_write = (fputs(buf, out) < 0) ? YES : NO;
+ rb_free(encoded);
}
fclose(in);