X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/628eee0041a53378a1debc275a34d14b88210735..cb097b8840594b6a77aab21d0b4c20f036a7d012:/src/client.c diff --git a/src/client.c b/src/client.c index 0f717bc..cad1b7f 100644 --- a/src/client.c +++ b/src/client.c @@ -231,12 +231,25 @@ free_local_client(struct Client *client_p) rb_free(client_p->localClient->passwd); } + rb_free(client_p->localClient->auth_user); + + if(client_p->localClient->override_timeout_event) + { + rb_event_delete(client_p->localClient->override_timeout_event); + } + rb_free(client_p->localClient->challenge); rb_free(client_p->localClient->fullcaps); rb_free(client_p->localClient->opername); rb_free(client_p->localClient->mangledhost); + if (client_p->localClient->privset) + privilegeset_unref(client_p->localClient->privset); - ssld_decrement_clicount(client_p->localClient->ssl_ctl); + if(IsSSL(client_p)) + ssld_decrement_clicount(client_p->localClient->ssl_ctl); + + if(IsCapable(client_p, CAP_ZIP)) + ssld_decrement_clicount(client_p->localClient->z_ctl); rb_bh_free(lclient_heap, client_p->localClient); client_p->localClient = NULL; @@ -249,6 +262,7 @@ free_client(struct Client *client_p) s_assert(&me != client_p); free_local_client(client_p); free_pre_client(client_p); + rb_free(client_p->certfp); rb_bh_free(client_heap, client_p); } @@ -441,84 +455,9 @@ notify_banned_client(struct Client *client_p, struct ConfItem *aconf, int ban) void check_banned_lines(void) { - struct Client *client_p; /* current local client_p being examined */ - struct ConfItem *aconf = NULL; - rb_dlink_node *ptr, *next_ptr; - - RB_DLINK_FOREACH_SAFE(ptr, next_ptr, lclient_list.head) - { - client_p = ptr->data; - - if(IsMe(client_p)) - continue; - - /* if there is a returned struct ConfItem then kill it */ - if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip, client_p->localClient->ip.ss_family))) - { - if(aconf->status & CONF_EXEMPTDLINE) - continue; - - sendto_realops_snomask(SNO_GENERAL, L_ALL, - "DLINE active for %s", - get_client_name(client_p, HIDE_IP)); - - notify_banned_client(client_p, aconf, D_LINED); - continue; /* and go examine next fd/client_p */ - } - - if(!IsPerson(client_p)) - continue; - - if((aconf = find_kline(client_p)) != NULL) - { - if(IsExemptKline(client_p)) - { - sendto_realops_snomask(SNO_GENERAL, L_ALL, - "KLINE over-ruled for %s, client is kline_exempt [%s@%s]", - get_client_name(client_p, HIDE_IP), - aconf->user, aconf->host); - continue; - } - - sendto_realops_snomask(SNO_GENERAL, L_ALL, - "KLINE active for %s", - get_client_name(client_p, HIDE_IP)); - notify_banned_client(client_p, aconf, K_LINED); - continue; - } - else if((aconf = find_xline(client_p->info, 1)) != NULL) - { - if(IsExemptKline(client_p)) - { - sendto_realops_snomask(SNO_GENERAL, L_ALL, - "XLINE over-ruled for %s, client is kline_exempt [%s]", - get_client_name(client_p, HIDE_IP), - aconf->name); - continue; - } - - sendto_realops_snomask(SNO_GENERAL, L_ALL, "XLINE active for %s", - get_client_name(client_p, HIDE_IP)); - - (void) exit_client(client_p, client_p, &me, "Bad user info"); - continue; - } - } - - /* also check the unknowns list for new dlines */ - RB_DLINK_FOREACH_SAFE(ptr, next_ptr, unknown_list.head) - { - client_p = ptr->data; - - if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip,client_p->localClient->ip.ss_family))) - { - if(aconf->status & CONF_EXEMPTDLINE) - continue; - - notify_banned_client(client_p, aconf, D_LINED); - } - } - + check_dlines(); + check_klines(); + check_xlines(); } /* check_klines_event() @@ -560,8 +499,9 @@ check_klines(void) if(IsExemptKline(client_p)) { sendto_realops_snomask(SNO_GENERAL, L_ALL, - "KLINE over-ruled for %s, client is kline_exempt", - get_client_name(client_p, HIDE_IP)); + "KLINE over-ruled for %s, client is kline_exempt [%s@%s]", + get_client_name(client_p, HIDE_IP), + aconf->user, aconf->host); continue; } @@ -651,8 +591,9 @@ check_xlines(void) if(IsExemptKline(client_p)) { sendto_realops_snomask(SNO_GENERAL, L_ALL, - "XLINE over-ruled for %s, client is kline_exempt", - get_client_name(client_p, HIDE_IP)); + "XLINE over-ruled for %s, client is kline_exempt [%s]", + get_client_name(client_p, HIDE_IP), + aconf->host); continue; } @@ -1172,7 +1113,7 @@ exit_aborted_clients(void *unused) * */ void -dead_link(struct Client *client_p) +dead_link(struct Client *client_p, int sendqex) { struct abort_client *abt; @@ -1182,7 +1123,7 @@ dead_link(struct Client *client_p) abt = (struct abort_client *) rb_malloc(sizeof(struct abort_client)); - if(client_p->flags & FLAGS_SENDQEX) + if(sendqex) rb_strlcpy(abt->notice, "Max SendQ exceeded", sizeof(abt->notice)); else rb_snprintf(abt->notice, sizeof(abt->notice), "Write error: %s", strerror(errno)); @@ -1484,10 +1425,11 @@ exit_local_client(struct Client *client_p, struct Client *source_p, struct Clien on_for = rb_current_time() - source_p->localClient->firsttime; - ilog(L_USER, "%s (%3lu:%02lu:%02lu): %s!%s@%s %d/%d", + ilog(L_USER, "%s (%3lu:%02lu:%02lu): %s!%s@%s %s %d/%d", rb_ctime(rb_current_time(), tbuf, sizeof(tbuf)), on_for / 3600, (on_for % 3600) / 60, on_for % 60, source_p->name, source_p->username, source_p->host, + source_p->sockhost, source_p->localClient->sendK, source_p->localClient->receiveK); sendto_one(source_p, "ERROR :Closing Link: %s (%s)", source_p->host, comment); @@ -1736,14 +1678,14 @@ make_user(struct Client *client_p) * side effects - add's an Server information block to a client * if it was not previously allocated. */ -server_t * +struct Server * make_server(struct Client *client_p) { - server_t *serv = client_p->serv; + struct Server *serv = client_p->serv; if(!serv) { - serv = (server_t *) rb_malloc(sizeof(server_t)); + serv = (struct Server *) rb_malloc(sizeof(struct Server)); client_p->serv = serv; } return client_p->serv; @@ -1881,7 +1823,7 @@ close_connection(struct Client *client_p) ServerStats.is_sv++; ServerStats.is_sbs += client_p->localClient->sendB; ServerStats.is_sbr += client_p->localClient->receiveB; - ServerStats.is_sti += rb_current_time() - client_p->localClient->firsttime; + ServerStats.is_sti += (unsigned long long)(rb_current_time() - client_p->localClient->firsttime); /* * If the connection has been up for a long amount of time, schedule @@ -1907,7 +1849,7 @@ close_connection(struct Client *client_p) ServerStats.is_cl++; ServerStats.is_cbs += client_p->localClient->sendB; ServerStats.is_cbr += client_p->localClient->receiveB; - ServerStats.is_cti += rb_current_time() - client_p->localClient->firsttime; + ServerStats.is_cti += (unsigned long long)(rb_current_time() - client_p->localClient->firsttime); } else ServerStats.is_ni++;