X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/c98390004f4f14cd8215302d77313f81e2546e22..7f9801883f36c445e7326ed0b35284e23366a83e:/src/kdparse.c diff --git a/src/kdparse.c b/src/kdparse.c index ee95d39..69a0c56 100644 --- a/src/kdparse.c +++ b/src/kdparse.c @@ -25,35 +25,41 @@ */ #include "stdinc.h" -#include "tools.h" -#include "s_log.h" +#include "logger.h" #include "s_conf.h" #include "s_newconf.h" #include "hostmask.h" #include "client.h" -#include "irc_string.h" -#include "memory.h" +#include "match.h" #include "hash.h" /* conf_add_fields() * - * inputs - pointer to config item, host/pass/user/operreason fields + * inputs - pointer to config item, host/pass/user/operreason/date fields * output - NONE * side effects - update respective fields with pointers */ static void conf_add_fields(struct ConfItem *aconf, const char *host_field, const char *pass_field, const char *user_field, - const char *operreason_field) + const char *operreason_field, const char *date_field) { if(host_field != NULL) - DupString(aconf->host, host_field); + aconf->host = rb_strdup(host_field); if(pass_field != NULL) - DupString(aconf->passwd, pass_field); + { + if(!EmptyString(date_field)) + { + aconf->passwd = rb_malloc(strlen(pass_field) + strlen(date_field) + 4); + rb_sprintf(aconf->passwd, "%s (%s)", pass_field, date_field); + } + else + aconf->passwd = rb_strdup(pass_field); + } if(user_field != NULL) - DupString(aconf->user, user_field); + aconf->user = rb_strdup(user_field); if(operreason_field != NULL) - DupString(aconf->spasswd, operreason_field); + aconf->spasswd = rb_strdup(operreason_field); } /* @@ -71,6 +77,7 @@ parse_k_file(FILE * file) char *reason_field = NULL; char *operreason_field = NULL; char *host_field = NULL; + char *date_field = NULL; char line[BUFSIZE]; char *p; @@ -95,11 +102,12 @@ parse_k_file(FILE * file) continue; operreason_field = getfield(NULL); + date_field = getfield(NULL); aconf = make_conf(); aconf->status = CONF_KILL; conf_add_fields(aconf, host_field, reason_field, - user_field, operreason_field); + user_field, operreason_field, date_field); if(aconf->host != NULL) add_conf_by_address(aconf->host, CONF_KILL, aconf->user, aconf); @@ -120,6 +128,7 @@ parse_d_file(FILE * file) char *reason_field = NULL; char *host_field = NULL; char *operreason_field = NULL; + char *date_field = NULL; char line[BUFSIZE]; char *p; @@ -140,10 +149,11 @@ parse_d_file(FILE * file) continue; operreason_field = getfield(NULL); + date_field = getfield(NULL); aconf = make_conf(); aconf->status = CONF_DLINE; - conf_add_fields(aconf, host_field, reason_field, "", operreason_field); + conf_add_fields(aconf, host_field, reason_field, "", operreason_field, date_field); conf_add_d_conf(aconf); } } @@ -184,10 +194,10 @@ parse_x_file(FILE * file) aconf = make_conf(); aconf->status = CONF_XLINE; - DupString(aconf->name, gecos_field); - DupString(aconf->passwd, reason_field); + aconf->name = rb_strdup(gecos_field); + aconf->passwd = rb_strdup(reason_field); - dlinkAddAlloc(aconf, &xline_conf_list); + rb_dlinkAddAlloc(aconf, &xline_conf_list); } } @@ -225,8 +235,8 @@ parse_resv_file(FILE * file) aconf->status = CONF_RESV_CHANNEL; aconf->port = 0; - DupString(aconf->name, host_field); - DupString(aconf->passwd, reason_field); + aconf->name = rb_strdup(host_field); + aconf->passwd = rb_strdup(reason_field); add_to_resv_hash(aconf->name, aconf); } else if(clean_resv_nick(host_field)) @@ -238,9 +248,9 @@ parse_resv_file(FILE * file) aconf->status = CONF_RESV_NICK; aconf->port = 0; - DupString(aconf->name, host_field); - DupString(aconf->passwd, reason_field); - dlinkAddAlloc(aconf, &resv_conf_list); + aconf->name = rb_strdup(host_field); + aconf->passwd = rb_strdup(reason_field); + rb_dlinkAddAlloc(aconf, &resv_conf_list); } } }