static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) { int OK = 0; int gaa_last_non_option; struct GAAOPTION_port GAATMP_port; struct GAAOPTION_pskkey GAATMP_pskkey; struct GAAOPTION_pskusername GAATMP_pskusername; struct GAAOPTION_srppasswd GAATMP_srppasswd; struct GAAOPTION_srpusername GAATMP_srpusername; struct GAAOPTION_x509certfile GAATMP_x509certfile; struct GAAOPTION_x509keyfile GAATMP_x509keyfile; struct GAAOPTION_pgpsubkey GAATMP_pgpsubkey; struct GAAOPTION_pgpcertfile GAATMP_pgpcertfile; struct GAAOPTION_pgpkeyring GAATMP_pgpkeyring; struct GAAOPTION_pgpkeyfile GAATMP_pgpkeyfile; struct GAAOPTION_x509crlfile GAATMP_x509crlfile; struct GAAOPTION_x509cafile GAATMP_x509cafile; struct GAAOPTION_priority GAATMP_priority; struct GAAOPTION_recordsize GAATMP_recordsize; struct GAAOPTION_mtu GAATMP_mtu; struct GAAOPTION_debug GAATMP_debug; #line 393 "gaa.skel" #ifdef GAA_REST_EXISTS struct GAAREST GAAREST_tmp; #endif opt_list[gaa_num] = 1; for(gaa_last_non_option = gaa_index; (gaa_last_non_option != GAAargc) && (gaa_is_an_argument(GAAargv[gaa_last_non_option]) == GAA_NOT_AN_OPTION); gaa_last_non_option++); if(gaa_num == GAA_REST) { gaa_index = 1; gaa_last_non_option = GAAargc; } switch(gaa_num) { case GAAOPTID_version: OK = 0; #line 109 "cli.gaa" { cli_version(); exit(0); ;}; return GAA_OK; break; case GAAOPTID_help: OK = 0; #line 107 "cli.gaa" { gaa_help(); exit(0); ;}; return GAA_OK; break; case GAAOPTID_list: OK = 0; #line 106 "cli.gaa" { print_list(gaaval->priorities, gaaval->verbose); exit(0); ;}; return GAA_OK; break; case GAAOPTID_benchmark_tls: OK = 0; #line 104 "cli.gaa" { benchmark_tls(gaaval->debug); exit(0) ;}; return GAA_OK; break; case GAAOPTID_benchmark_soft_ciphers: OK = 0; #line 103 "cli.gaa" { benchmark_cipher(0, gaaval->debug); exit(0) ;}; return GAA_OK; break; case GAAOPTID_benchmark_ciphers: OK = 0; #line 102 "cli.gaa" { benchmark_cipher(1, gaaval->debug); exit(0) ;}; return GAA_OK; break; case GAAOPTID_insecure: OK = 0; #line 100 "cli.gaa" { gaaval->insecure = 1 ;}; return GAA_OK; break; case GAAOPTID_port: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_port.arg1, gaa_getstr, GAATMP_port.size1); gaa_index++; #line 97 "cli.gaa" { gaaval->port = GAATMP_port.arg1 ;}; return GAA_OK; break; case GAAOPTID_pskkey: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_pskkey.arg1, gaa_getstr, GAATMP_pskkey.size1); gaa_index++; #line 94 "cli.gaa" { gaaval->psk_key = GAATMP_pskkey.arg1 ;}; return GAA_OK; break; case GAAOPTID_pskusername: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_pskusername.arg1, gaa_getstr, GAATMP_pskusername.size1); gaa_index++; #line 91 "cli.gaa" { gaaval->psk_username = GAATMP_pskusername.arg1 ;}; return GAA_OK; break; case GAAOPTID_srppasswd: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_srppasswd.arg1, gaa_getstr, GAATMP_srppasswd.size1); gaa_index++; #line 88 "cli.gaa" { gaaval->srp_passwd = GAATMP_srppasswd.arg1 ;}; return GAA_OK; break; case GAAOPTID_srpusername: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_srpusername.arg1, gaa_getstr, GAATMP_srpusername.size1); gaa_index++; #line 85 "cli.gaa" { gaaval->srp_username = GAATMP_srpusername.arg1 ;}; return GAA_OK; break; case GAAOPTID_x509certfile: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_x509certfile.arg1, gaa_getstr, GAATMP_x509certfile.size1); gaa_index++; #line 82 "cli.gaa" { gaaval->x509_certfile = GAATMP_x509certfile.arg1 ;}; return GAA_OK; break; case GAAOPTID_x509keyfile: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_x509keyfile.arg1, gaa_getstr, GAATMP_x509keyfile.size1); gaa_index++; #line 79 "cli.gaa" { gaaval->x509_keyfile = GAATMP_x509keyfile.arg1 ;}; return GAA_OK; break; case GAAOPTID_pgpsubkey: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_pgpsubkey.arg1, gaa_getstr, GAATMP_pgpsubkey.size1); gaa_index++; #line 76 "cli.gaa" { gaaval->pgp_subkey = GAATMP_pgpsubkey.arg1 ;}; return GAA_OK; break; case GAAOPTID_pgpcertfile: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_pgpcertfile.arg1, gaa_getstr, GAATMP_pgpcertfile.size1); gaa_index++; #line 73 "cli.gaa" { gaaval->pgp_certfile = GAATMP_pgpcertfile.arg1 ;}; return GAA_OK; break; case GAAOPTID_pgpkeyring: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_pgpkeyring.arg1, gaa_getstr, GAATMP_pgpkeyring.size1); gaa_index++; #line 70 "cli.gaa" { gaaval->pgp_keyring = GAATMP_pgpkeyring.arg1 ;}; return GAA_OK; break; case GAAOPTID_pgpkeyfile: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_pgpkeyfile.arg1, gaa_getstr, GAATMP_pgpkeyfile.size1); gaa_index++; #line 67 "cli.gaa" { gaaval->pgp_keyfile = GAATMP_pgpkeyfile.arg1 ;}; return GAA_OK; break; case GAAOPTID_x509crlfile: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_x509crlfile.arg1, gaa_getstr, GAATMP_x509crlfile.size1); gaa_index++; #line 64 "cli.gaa" { gaaval->x509_crlfile = GAATMP_x509crlfile.arg1 ;}; return GAA_OK; break; case GAAOPTID_x509cafile: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_x509cafile.arg1, gaa_getstr, GAATMP_x509cafile.size1); gaa_index++; #line 61 "cli.gaa" { gaaval->x509_cafile = GAATMP_x509cafile.arg1 ;}; return GAA_OK; break; case GAAOPTID_priority: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_priority.arg1, gaa_getstr, GAATMP_priority.size1); gaa_index++; #line 58 "cli.gaa" { gaaval->priorities = GAATMP_priority.arg1 ;}; return GAA_OK; break; case GAAOPTID_verbose: OK = 0; #line 55 "cli.gaa" { gaaval->verbose = 1 ;}; return GAA_OK; break; case GAAOPTID_recordsize: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_recordsize.arg1, gaa_getint, GAATMP_recordsize.size1); gaa_index++; #line 52 "cli.gaa" { gaaval->record_size = GAATMP_recordsize.arg1 ;}; return GAA_OK; break; case GAAOPTID_print_cert: OK = 0; #line 49 "cli.gaa" { gaaval->print_cert = 1 ;}; return GAA_OK; break; case GAAOPTID_disable_extensions: OK = 0; #line 46 "cli.gaa" { gaaval->disable_extensions = 1 ;}; return GAA_OK; break; case GAAOPTID_fingerprint: OK = 0; #line 43 "cli.gaa" { gaaval->fingerprint = 1 ;}; return GAA_OK; break; case GAAOPTID_x509fmtder: OK = 0; #line 40 "cli.gaa" { gaaval->fmtder = 1 ;}; return GAA_OK; break; case GAAOPTID_crlf: OK = 0; #line 37 "cli.gaa" { gaaval->crlf = 1 ;}; return GAA_OK; break; case GAAOPTID_mtu: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_mtu.arg1, gaa_getint, GAATMP_mtu.size1); gaa_index++; #line 34 "cli.gaa" { gaaval->mtu = GAATMP_mtu.arg1 ;}; return GAA_OK; break; case GAAOPTID_udp: OK = 0; #line 31 "cli.gaa" { gaaval->udp = 1 ;}; return GAA_OK; break; case GAAOPTID_starttls: OK = 0; #line 28 "cli.gaa" { gaaval->starttls = 1 ;}; return GAA_OK; break; case GAAOPTID_noticket: OK = 0; #line 25 "cli.gaa" { gaaval->noticket = 1 ;}; return GAA_OK; break; case GAAOPTID_rehandshake: OK = 0; #line 22 "cli.gaa" { gaaval->rehandshake = 1 ;}; return GAA_OK; break; case GAAOPTID_resume: OK = 0; #line 19 "cli.gaa" { gaaval->resume = 1 ;}; return GAA_OK; break; case GAAOPTID_debug: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_debug.arg1, gaa_getint, GAATMP_debug.size1); gaa_index++; #line 16 "cli.gaa" { gaaval->debug = GAATMP_debug.arg1 ;}; return GAA_OK; break; case GAA_REST: GAA_TESTMOREARGS; GAA_FILL(GAAREST_tmp.arg1, gaa_getstr, GAAREST_tmp.size1); gaa_index++; #line 112 "cli.gaa" { gaaval->rest_args = GAAREST_tmp.arg1; ;}; return GAA_OK; break; #line 413 "gaa.skel" default: break; } return GAA_ERROR_UNKNOWN; }
static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) { int OK = 0; int gaa_last_non_option; struct GAAOPTION_port GAATMP_port; struct GAAOPTION_opaque_prf_input GAATMP_opaque_prf_input; struct GAAOPTION_pskkey GAATMP_pskkey; struct GAAOPTION_pskusername GAATMP_pskusername; struct GAAOPTION_srppasswd GAATMP_srppasswd; struct GAAOPTION_srpusername GAATMP_srpusername; struct GAAOPTION_x509certfile GAATMP_x509certfile; struct GAAOPTION_x509keyfile GAATMP_x509keyfile; struct GAAOPTION_pgpcertfile GAATMP_pgpcertfile; struct GAAOPTION_pgpkeyring GAATMP_pgpkeyring; struct GAAOPTION_pgpkeyfile GAATMP_pgpkeyfile; struct GAAOPTION_x509crlfile GAATMP_x509crlfile; struct GAAOPTION_x509cafile GAATMP_x509cafile; struct GAAOPTION_priority GAATMP_priority; struct GAAOPTION_ctypes GAATMP_ctypes; struct GAAOPTION_kx GAATMP_kx; struct GAAOPTION_macs GAATMP_macs; struct GAAOPTION_comp GAATMP_comp; struct GAAOPTION_protocols GAATMP_protocols; struct GAAOPTION_ciphers GAATMP_ciphers; struct GAAOPTION_recordsize GAATMP_recordsize; struct GAAOPTION_debug GAATMP_debug; #line 393 "gaa.skel" #ifdef GAA_REST_EXISTS struct GAAREST GAAREST_tmp; #endif opt_list[gaa_num] = 1; for(gaa_last_non_option = gaa_index; (gaa_last_non_option != GAAargc) && (gaa_is_an_argument(GAAargv[gaa_last_non_option]) == GAA_NOT_AN_OPTION); gaa_last_non_option++); if(gaa_num == GAA_REST) { gaa_index = 1; gaa_last_non_option = GAAargc; } switch(gaa_num) { case GAAOPTID_copyright: OK = 0; #line 117 "cli.gaa" { print_license(); exit(0); ;}; return GAA_OK; break; case GAAOPTID_version: OK = 0; #line 116 "cli.gaa" { cli_version(); exit(0); ;}; return GAA_OK; break; case GAAOPTID_help: OK = 0; #line 114 "cli.gaa" { gaa_help(); exit(0); ;}; return GAA_OK; break; case GAAOPTID_list: OK = 0; #line 113 "cli.gaa" { print_list(gaaval->verbose); exit(0); ;}; return GAA_OK; break; case GAAOPTID_insecure: OK = 0; #line 111 "cli.gaa" { gaaval->insecure = 1 ;}; return GAA_OK; break; case GAAOPTID_port: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_port.arg1, gaa_getstr, GAATMP_port.size1); gaa_index++; #line 108 "cli.gaa" { gaaval->port = GAATMP_port.arg1 ;}; return GAA_OK; break; case GAAOPTID_opaque_prf_input: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_opaque_prf_input.arg1, gaa_getstr, GAATMP_opaque_prf_input.size1); gaa_index++; #line 105 "cli.gaa" { gaaval->opaque_prf_input = GAATMP_opaque_prf_input.arg1 ;}; return GAA_OK; break; case GAAOPTID_pskkey: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_pskkey.arg1, gaa_getstr, GAATMP_pskkey.size1); gaa_index++; #line 102 "cli.gaa" { gaaval->psk_key = GAATMP_pskkey.arg1 ;}; return GAA_OK; break; case GAAOPTID_pskusername: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_pskusername.arg1, gaa_getstr, GAATMP_pskusername.size1); gaa_index++; #line 99 "cli.gaa" { gaaval->psk_username = GAATMP_pskusername.arg1 ;}; return GAA_OK; break; case GAAOPTID_srppasswd: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_srppasswd.arg1, gaa_getstr, GAATMP_srppasswd.size1); gaa_index++; #line 96 "cli.gaa" { gaaval->srp_passwd = GAATMP_srppasswd.arg1 ;}; return GAA_OK; break; case GAAOPTID_srpusername: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_srpusername.arg1, gaa_getstr, GAATMP_srpusername.size1); gaa_index++; #line 93 "cli.gaa" { gaaval->srp_username = GAATMP_srpusername.arg1 ;}; return GAA_OK; break; case GAAOPTID_x509certfile: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_x509certfile.arg1, gaa_getstr, GAATMP_x509certfile.size1); gaa_index++; #line 90 "cli.gaa" { gaaval->x509_certfile = GAATMP_x509certfile.arg1 ;}; return GAA_OK; break; case GAAOPTID_x509keyfile: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_x509keyfile.arg1, gaa_getstr, GAATMP_x509keyfile.size1); gaa_index++; #line 87 "cli.gaa" { gaaval->x509_keyfile = GAATMP_x509keyfile.arg1 ;}; return GAA_OK; break; case GAAOPTID_pgpcertfile: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_pgpcertfile.arg1, gaa_getstr, GAATMP_pgpcertfile.size1); gaa_index++; #line 84 "cli.gaa" { gaaval->pgp_certfile = GAATMP_pgpcertfile.arg1 ;}; return GAA_OK; break; case GAAOPTID_pgpkeyring: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_pgpkeyring.arg1, gaa_getstr, GAATMP_pgpkeyring.size1); gaa_index++; #line 81 "cli.gaa" { gaaval->pgp_keyring = GAATMP_pgpkeyring.arg1 ;}; return GAA_OK; break; case GAAOPTID_pgpkeyfile: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_pgpkeyfile.arg1, gaa_getstr, GAATMP_pgpkeyfile.size1); gaa_index++; #line 78 "cli.gaa" { gaaval->pgp_keyfile = GAATMP_pgpkeyfile.arg1 ;}; return GAA_OK; break; case GAAOPTID_x509crlfile: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_x509crlfile.arg1, gaa_getstr, GAATMP_x509crlfile.size1); gaa_index++; #line 75 "cli.gaa" { gaaval->x509_crlfile = GAATMP_x509crlfile.arg1 ;}; return GAA_OK; break; case GAAOPTID_x509cafile: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_x509cafile.arg1, gaa_getstr, GAATMP_x509cafile.size1); gaa_index++; #line 72 "cli.gaa" { gaaval->x509_cafile = GAATMP_x509cafile.arg1 ;}; return GAA_OK; break; case GAAOPTID_priority: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_priority.arg1, gaa_getstr, GAATMP_priority.size1); gaa_index++; #line 69 "cli.gaa" { gaaval->priorities = GAATMP_priority.arg1 ;}; return GAA_OK; break; case GAAOPTID_ctypes: OK = 0; GAA_LIST_FILL(GAATMP_ctypes.arg1, gaa_getstr, char*, GAATMP_ctypes.size1); #line 66 "cli.gaa" { gaaval->ctype = GAATMP_ctypes.arg1; gaaval->nctype = GAATMP_ctypes.size1 ;}; return GAA_OK; break; case GAAOPTID_kx: OK = 0; GAA_LIST_FILL(GAATMP_kx.arg1, gaa_getstr, char*, GAATMP_kx.size1); #line 62 "cli.gaa" { gaaval->kx = GAATMP_kx.arg1; gaaval->nkx = GAATMP_kx.size1 ;}; return GAA_OK; break; case GAAOPTID_macs: OK = 0; GAA_LIST_FILL(GAATMP_macs.arg1, gaa_getstr, char*, GAATMP_macs.size1); #line 58 "cli.gaa" { gaaval->macs = GAATMP_macs.arg1; gaaval->nmacs = GAATMP_macs.size1 ;}; return GAA_OK; break; case GAAOPTID_comp: OK = 0; GAA_LIST_FILL(GAATMP_comp.arg1, gaa_getstr, char*, GAATMP_comp.size1); #line 54 "cli.gaa" { gaaval->comp = GAATMP_comp.arg1; gaaval->ncomp = GAATMP_comp.size1 ;}; return GAA_OK; break; case GAAOPTID_protocols: OK = 0; GAA_LIST_FILL(GAATMP_protocols.arg1, gaa_getstr, char*, GAATMP_protocols.size1); #line 50 "cli.gaa" { gaaval->proto = GAATMP_protocols.arg1; gaaval->nproto = GAATMP_protocols.size1 ;}; return GAA_OK; break; case GAAOPTID_ciphers: OK = 0; GAA_LIST_FILL(GAATMP_ciphers.arg1, gaa_getstr, char*, GAATMP_ciphers.size1); #line 46 "cli.gaa" { gaaval->ciphers = GAATMP_ciphers.arg1; gaaval->nciphers = GAATMP_ciphers.size1 ;}; return GAA_OK; break; case GAAOPTID_verbose: OK = 0; #line 42 "cli.gaa" { gaaval->verbose = 1 ;}; return GAA_OK; break; case GAAOPTID_recordsize: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_recordsize.arg1, gaa_getint, GAATMP_recordsize.size1); gaa_index++; #line 39 "cli.gaa" { gaaval->record_size = GAATMP_recordsize.arg1 ;}; return GAA_OK; break; case GAAOPTID_print_cert: OK = 0; #line 36 "cli.gaa" { gaaval->print_cert = 1 ;}; return GAA_OK; break; case GAAOPTID_disable_extensions: OK = 0; #line 33 "cli.gaa" { gaaval->disable_extensions = 1 ;}; return GAA_OK; break; case GAAOPTID_fingerprint: OK = 0; #line 30 "cli.gaa" { gaaval->fingerprint = 1 ;}; return GAA_OK; break; case GAAOPTID_x509fmtder: OK = 0; #line 27 "cli.gaa" { gaaval->fmtder = 1 ;}; return GAA_OK; break; case GAAOPTID_crlf: OK = 0; #line 24 "cli.gaa" { gaaval->crlf = 1 ;}; return GAA_OK; break; case GAAOPTID_starttls: OK = 0; #line 21 "cli.gaa" { gaaval->starttls = 1 ;}; return GAA_OK; break; case GAAOPTID_resume: OK = 0; #line 18 "cli.gaa" { gaaval->resume = 1 ;}; return GAA_OK; break; case GAAOPTID_debug: OK = 0; GAA_TESTMOREARGS; GAA_FILL(GAATMP_debug.arg1, gaa_getint, GAATMP_debug.size1); gaa_index++; #line 15 "cli.gaa" { gaaval->debug = GAATMP_debug.arg1 ;}; return GAA_OK; break; case GAA_REST: GAA_TESTMOREARGS; GAA_FILL(GAAREST_tmp.arg1, gaa_getstr, GAAREST_tmp.size1); gaa_index++; #line 120 "cli.gaa" { gaaval->rest_args = GAAREST_tmp.arg1; ;}; return GAA_OK; break; #line 413 "gaa.skel" default: break; } return GAA_ERROR_UNKNOWN; }
/* * ms_mark - server message handler */ int ms_mark(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { struct Client* acptr; if (!IsServer(sptr)) return protocol_violation(sptr, "MARK from non-server %s", cli_name(sptr)); if (!strcmp(parv[2], MARK_WEBIRC)) { if(parc < 4) return protocol_violation(sptr, "MARK webirc received too few parameters (%u)", parc); if ((acptr = FindUser(parv[1]))) { ircd_strncpy(cli_webirc(acptr), parv[3], BUFSIZE); sendcmdto_serv_butone(sptr, CMD_MARK, cptr, "%s %s :%s", cli_name(acptr), MARK_WEBIRC, parv[3]); } } else if (!strcmp(parv[2], MARK_GEOIP)) { if(parc < 5) return protocol_violation(sptr, "MARK geoip received too few parameters (%u)", parc); if ((acptr = FindUser(parv[1]))) { geoip_apply_mark(acptr, parv[3], parv[4], (parc > 5 ? parv[5] : NULL)); if (parc > 5) sendcmdto_serv_butone(sptr, CMD_MARK, cptr, "%s %s %s %s :%s", cli_name(acptr), MARK_GEOIP, parv[3], parv[4], parv[5]); else sendcmdto_serv_butone(sptr, CMD_MARK, cptr, "%s %s %s %s", cli_name(acptr), MARK_GEOIP, parv[3], parv[4]); } } else if (!strcmp(parv[2], MARK_CVERSION)) { if(parc < 4) return protocol_violation(sptr, "MARK client version received too few parameters (%u)", parc); if ((acptr = FindUser(parv[1]))) { ircd_strncpy(cli_version(acptr), parv[3], VERSIONLEN); sendcmdto_serv_butone(sptr, CMD_MARK, cptr, "%s %s :%s", cli_name(acptr), MARK_CVERSION, parv[3]); } } else if (!strcmp(parv[2], MARK_SSLCLIFP)) { if(parc < 4) return protocol_violation(sptr, "MARK SSL client certificate fingerprint received too few parameters (%u)", parc); if ((acptr = FindUser(parv[1]))) { ircd_strncpy(cli_sslclifp(acptr), parv[3], BUFSIZE); sendcmdto_serv_butone(sptr, CMD_MARK, cptr, "%s %s :%s", cli_name(acptr), MARK_SSLCLIFP, parv[3]); } } else if (!strcmp(parv[2], MARK_KILL)) { if(parc < 4) return protocol_violation(sptr, "MARK kill received too few parameters (%u)", parc); if ((acptr = FindUser(parv[1]))) { ircd_strncpy(cli_killmark(acptr), parv[3], BUFSIZE); sendcmdto_serv_butone(sptr, CMD_MARK, cptr, "%s %s :%s", cli_name(acptr), MARK_KILL, parv[3]); } } else if (!strcmp(parv[2], MARK_MARK) || !strcmp(parv[2], MARK_DNSBL_DATA)) { if(parc < 4) return protocol_violation(sptr, "MARK MARK (tag) received too few parameters (%u)", parc); if ((acptr = FindUser(parv[1]))) { add_mark(acptr, parv[3]); SetMarked(acptr); sendcmdto_serv_butone(sptr, CMD_MARK, cptr, "%s %s :%s", cli_name(acptr), MARK_MARK, parv[3]); } } return 0; }
void checkClient(struct Client *sptr, struct Client *acptr) { struct Channel *chptr; struct Membership *lp; char outbuf[BUFSIZE]; char *privs; time_t nowr; /* Header */ send_reply(sptr, RPL_DATASTR, " "); send_reply(sptr, RPL_CHKHEAD, "user", acptr->cli_name); send_reply(sptr, RPL_DATASTR, " "); ircd_snprintf(0, outbuf, sizeof(outbuf), " Nick:: %s (%s%s)", acptr->cli_name, NumNick(acptr)); send_reply(sptr, RPL_DATASTR, outbuf); if (MyUser(acptr)) { ircd_snprintf(0, outbuf, sizeof(outbuf), " Signed on:: %s", myctime(acptr->cli_firsttime)); send_reply(sptr, RPL_DATASTR, outbuf); } ircd_snprintf(0, outbuf, sizeof(outbuf), " Timestamp:: %s (%d)", myctime(acptr->cli_lastnick), acptr->cli_lastnick); send_reply(sptr, RPL_DATASTR, outbuf); ircd_snprintf(0, outbuf, sizeof(outbuf), " User/Hostmask:: %s@%s (%s)", acptr->cli_user->username, acptr->cli_user->host, ircd_ntoa((const char*) &(cli_ip(acptr)))); send_reply(sptr, RPL_DATASTR, outbuf); if (((feature_int(FEAT_HOST_HIDING_STYLE) == 1) ? HasHiddenHost(acptr) : IsHiddenHost(acptr)) || IsSetHost(acptr)) { ircd_snprintf(0, outbuf, sizeof(outbuf), " Real User/Host:: %s@%s", acptr->cli_user->realusername, acptr->cli_user->realhost); send_reply(sptr, RPL_DATASTR, outbuf); } ircd_snprintf(0, outbuf, sizeof(outbuf), " Real Name:: %s%c", cli_info(acptr), COLOR_OFF); send_reply(sptr, RPL_DATASTR, outbuf); if (IsService(cli_user(acptr)->server)) { if (acptr) send_reply(sptr, RPL_DATASTR, " Status:: Network Service"); else if (IsAdmin(acptr)) send_reply(sptr, RPL_DATASTR, " Status:: IRC Administrator (service)"); else if (IsAnOper(acptr)) send_reply(sptr, RPL_DATASTR, " Status:: IRC Operator (service)"); else send_reply(sptr, RPL_DATASTR, " Status:: Client (service)"); } else if (IsAdmin(acptr)) { send_reply(sptr, RPL_DATASTR, " Status:: IRC Administrator"); } else if (IsAnOper(acptr)) { send_reply(sptr, RPL_DATASTR, " Status:: IRC Operator"); } else { send_reply(sptr, RPL_DATASTR, " Status:: Client"); } if (MyUser(acptr)) { ircd_snprintf(0, outbuf, sizeof(outbuf), " Class:: %s", get_client_class(acptr)); send_reply(sptr, RPL_DATASTR, outbuf); } privs = client_print_privs(acptr); if (strlen(privs) > 1) client_check_privs(acptr, sptr); ircd_snprintf(0, outbuf, sizeof(outbuf), " Connected to:: %s", cli_name(acptr->cli_user->server)); send_reply(sptr, RPL_DATASTR, outbuf); if (cli_version(acptr)) { if (strlen(cli_version(acptr)) > 0) { ircd_snprintf(0, outbuf, sizeof(outbuf), " CTCP Version:: %s", cli_version(acptr)); send_reply(sptr, RPL_DATASTR, outbuf); } } if (cli_user(acptr) && !EmptyString(cli_user(acptr)->swhois)) { ircd_snprintf(0, outbuf, sizeof(outbuf), " SWHOIS:: %s", cli_user(acptr)->swhois); send_reply(sptr, RPL_DATASTR, outbuf); } if (cli_webirc(acptr)) { if (strlen(cli_webirc(acptr)) > 0) { ircd_snprintf(0, outbuf, sizeof(outbuf), " WebIRC:: %s", cli_webirc(acptr)); send_reply(sptr, RPL_DATASTR, outbuf); } } if (cli_sslclifp(acptr) && (strlen(cli_sslclifp(acptr)) > 0)) { ircd_snprintf(0, outbuf, sizeof(outbuf), "SSL Fingerprint:: %s", cli_sslclifp(acptr)); send_reply(sptr, RPL_DATASTR, outbuf); } if (MyUser(acptr)) get_eflags(sptr, acptr); /* +s (SERV_NOTICE) is not relayed to us from remote servers, * so we cannot tell if a remote client has that mode set. * And hacking it onto the end of the output of umode_str is EVIL BAD AND WRONG * (and breaks if the user is +r) so we won't do that either. */ if (strlen(umode_str(acptr)) < 1) strcpy(outbuf, " Umode(s):: <none>"); else ircd_snprintf(0, outbuf, sizeof(outbuf), " Umode(s):: +%s", umode_str(acptr)); send_reply(sptr, RPL_DATASTR, outbuf); if (acptr->cli_user->joined == 0) send_reply(sptr, RPL_DATASTR, " Channel(s):: <none>"); else if (acptr->cli_user->joined > 50) { /* NB. As a sanity check, we DO NOT show the individual channels the * client is on if it is on > 50 channels. This is to prevent the ircd * barfing ala Uworld when someone does /quote check Q :).. (I shouldn't imagine * an Oper would want to see every single channel 'x' client is on anyway if * they are on *that* many). */ ircd_snprintf(0, outbuf, sizeof(outbuf), " Channel(s):: - (total: %u)", acptr->cli_user->joined); send_reply(sptr, RPL_DATASTR, outbuf); } else { char chntext[BUFSIZE]; int len = strlen(" Channel(s):: "); int mlen = strlen(me.cli_name) + len + strlen(sptr->cli_name); *chntext = '\0'; strcpy(chntext, " Channel(s):: "); for (lp = acptr->cli_user->channel; lp; lp = lp->next_channel) { chptr = lp->channel; if (len + strlen(chptr->chname) + mlen > BUFSIZE - 5) { send_reply(sptr, RPL_DATASTR, chntext); *chntext = '\0'; strcpy(chntext, " Channel(s):: "); len = strlen(chntext); } if (IsDeaf(acptr)) *(chntext + len++) = '-'; if (is_chan_op(acptr, chptr)) *(chntext + len++) = '@'; if (is_half_op(acptr, chptr)) *(chntext + len++) = '%'; if (IsOper(sptr) && !ShowChannel(sptr,chptr)) *(chntext + len++) = '*'; if (IsZombie(lp)) *(chntext + len++) = '!'; if (len) *(chntext + len) = '\0'; strcpy(chntext + len, chptr->chname); len += strlen(chptr->chname); strcat(chntext + len, " "); len++; } if (chntext[0] != '\0') send_reply(sptr, RPL_DATASTR, chntext); } /* If client processing command ISN'T target (or a registered * Network Service), show idle time since the last time we * parsed something. */ if (MyUser(acptr) && !(IsService(acptr) == -1) && !(strCasediff(acptr->cli_name, sptr->cli_name) == 0)) { nowr = CurrentTime - acptr->cli_user->last; ircd_snprintf(0, outbuf, sizeof(outbuf), " Idle for:: %d days, %02ld:%02ld:%02ld", nowr / 86400, (nowr / 3600) % 24, (nowr / 60) % 60, nowr % 60); send_reply(sptr, RPL_DATASTR, outbuf); } /* Away message (if applicable) */ if (acptr->cli_user->away) { ircd_snprintf(0, outbuf, sizeof(outbuf), " Away message:: %s", acptr->cli_user->away); send_reply(sptr, RPL_DATASTR, outbuf); } /* If local user.. */ if (MyUser(acptr)) { send_reply(sptr, RPL_DATASTR, " "); ircd_snprintf(0, outbuf, sizeof(outbuf), " Ports:: %d -> %d (client -> server)", cli_port(acptr), cli_listener(acptr)->port); send_reply(sptr, RPL_DATASTR, outbuf); if (feature_bool(FEAT_CHECK_EXTENDED)) { /* Note: sendq = receiveq for a client (it makes sense really) */ ircd_snprintf(0, outbuf, sizeof(outbuf), " Data sent:: %u.%0.3u Kb (%u protocol messages)", cli_receiveK(acptr), cli_receiveB(acptr), cli_receiveM(acptr)); send_reply(sptr, RPL_DATASTR, outbuf); ircd_snprintf(0, outbuf, sizeof(outbuf), " Data received:: %u.%0.3u Kb (%u protocol messages)", cli_sendK(acptr), cli_sendB(acptr), cli_sendM(acptr)); send_reply(sptr, RPL_DATASTR, outbuf); ircd_snprintf(0, outbuf, sizeof(outbuf), " receiveQ size:: %d bytes (max. %d bytes)", DBufLength(&(cli_recvQ(acptr))), feature_int(FEAT_CLIENT_FLOOD)); send_reply(sptr, RPL_DATASTR, outbuf); ircd_snprintf(0, outbuf, sizeof(outbuf), " sendQ size:: %d bytes (max. %d bytes)", DBufLength(&(cli_sendQ(acptr))), get_sendq(acptr)); send_reply(sptr, RPL_DATASTR, outbuf); } } /* Send 'END OF CHECK' message */ send_reply(sptr, RPL_ENDOFCHECK, " "); }
/* * m_notice - generic message handler */ int m_notice(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { char* name; char* server; int ret = 0; int i; int j; int fd = 0; int count; char *clean; char* vector[MAXTARGETS]; char* temp; /* added by Vadtec 02/25/2008 */ char* parv_temp; /* added by Vadtec 02/26/2008 */ int found_g = 0; /* added by Vadtec 02/26/2008 */ int sent = 0; /* added by Vadtec 03/13/2008 */ struct Client* acptr; /* added by Vadtec 02/26/2008 */ struct Channel* chptr; /* added by Vadtec 02/27/2008 */ int isdcc = 0; assert(0 != cptr); assert(cptr == sptr); ClrFlag(sptr, FLAG_TS8); if (parc < 2 || EmptyString(parv[1])) return send_reply(sptr, ERR_NORECIPIENT, MSG_NOTICE); if (parc < 3 || EmptyString(parv[parc - 1])) return send_reply(sptr, ERR_NOTEXTTOSEND); if (parv[1][0] == '@' && IsChannelPrefix(parv[1][1])) { parv[1]++; /* Get rid of '@' */ return m_wallchops(cptr, sptr, parc, parv); } count = unique_name_vector(parv[1], ',', vector, MAXTARGETS); /* Check here to make sure that the client is ours so we dont respond to NOTICES from other server's users. - Vadtec 02/25/2008 */ /* Also, check to make sure that the notice is actually destined for the *server* and not another user. That way we don't process some user saying "what version do you use" to another user via notice. - Vadtec 03/13/2008 */ if (feature_bool(FEAT_CTCP_VERSIONING) && MyConnect(sptr) && !strcmp(parv[1], cli_name(&me))) { /* Added by Vadtec 02/25/2008. This is so that we can do version checking (and banning) of connecting clients. Rules: Only one really. CTCP VERSION is not part of the RFC and therefore clients are not required to respond to a request for their version. NOTE: If we are lucky enough to have _GNU_SOURCE, we will use it over the standard strstr because its case insensetive. This should help against clients that like to send lower case CTCPs from slipping through as easily with only one function call. */ for (fd = HighestFd; fd >= 0 && !sent; --fd) { /* Added the "sent" check here so that if we have already sent the notice we don't needlessly loop through *all* the users - Vadtec 03/13/2008 */ if ((acptr = LocalClientArray[fd])) { if (!cli_user(acptr)) continue; #ifdef _GNU_SOURCE if ((temp = strcasestr(parv[2], "\x01VERSION"))) { /* added \x01 to the string so that it will *only* respond to CTCP version replies. Seems redundant, but we dont want the users doing /notice <server> version (and getting away with it) - Vadtec 03/13/2008 */ temp = strchrnul(parv[2], ' '); /* Moved this here to take advantage of strchrnul - added by Vadtec 03/13/2008 */ #else if ((temp = strstr(parv[2], "\x01VERSION")) || (temp = strstr(parv[2], "\x01version"))) { /* See above comment about \x01 - Vadtec */ temp = strchr(parv[2], ' '); /* Moved this here to take advantage of strchrnul - added by Vadtec 03/13/2008 */ if (temp == 0) temp = parv[2] + strlen(parv[2]); /* This does the same thing as strchrnul - Vadtec */ #endif parv_temp = parv[2]; j = 0; while (j <= (temp - parv[2])) { parv_temp++; j++; } clean = normalizeBuffer(parv_temp); doCleanBuffer((char *) clean); ircd_strncpy(cli_version(sptr), normalizeBuffer(clean), VERSIONLEN); sendcmdto_serv_butone(&me, CMD_MARK, cptr, "%s %s :%s", cli_name(sptr), MARK_CVERSION, cli_version(sptr)); /* Moved here to solve duplicate MARK's if any of the CTCP_* conditions were false 05/13/2009 */ sent = 1; if (feature_bool(FEAT_CTCP_VERSIONING_CHAN)) { sprintf(temp, "%s has version \002%s\002", cli_name(sptr), cli_version(sptr)); /* Announce to channel. */ if ((chptr = FindChannel(feature_str(FEAT_CTCP_VERSIONING_CHANNAME)))) { if (feature_bool(FEAT_CTCP_VERSIONING_USEMSG)) sendcmdto_channel_butone(&me, CMD_PRIVATE, chptr, cptr, SKIP_DEAF | SKIP_BURST, '\0', "%H :%s", chptr, temp); else sendcmdto_channel_butone(&me, CMD_NOTICE, chptr, cptr, SKIP_DEAF | SKIP_BURST, '\0', "%H :%s", chptr, temp); /* Removed sent=1 from here because it caused the MARK above to be sent more then once if any of the conditions leading here are false 05/13/2009 */ } } if (feature_bool(FEAT_CTCP_VERSIONING_KILL)) { if ((found_g = find_kill(acptr))) { sendto_opmask_butone(0, found_g == -2 ? SNO_GLINE : SNO_OPERKILL, found_g == -2 ? "G-line active for %s%s" : "K-line active for %s%s", IsUnknown(sptr) ? "Unregistered Client ":"", get_client_name(sptr, SHOW_IP)); return exit_client_msg(cptr, acptr, &me, "Banned Client: %s", cli_version(acptr)); } } else return 0; } } } } for (i = 0; i < count; ++i) { name = vector[i]; if (IsChannelPrefix(*name)) { ret = find_fline(cptr, sptr, parv[parc-1], WFFLAG_CHANNOTICE, name); if (ret != 0) { if (ret == 2) return CPTR_KILLED; else return 0; } } else { #ifdef _GNU_SOURCE if ((temp = strcasestr(parv[2], "\001DCC"))) { temp = strchrnul(parv[2], ' '); #else if ((temp = strstr(parv[2], "\001DCC")) || (temp = strstr(parv[2], "\001dcc"))) { temp = strchr(parv[2], ' '); #endif isdcc = 1; ret = find_fline(cptr, sptr, parv[parc-1], WFFLAG_DCC, name); if (ret != 0) { if (ret == 2) return CPTR_KILLED; else return 0; } } if (!isdcc) { ret = find_fline(cptr, sptr, parv[parc-1], WFFLAG_NOTICE, name); if (ret != 0) { if (ret == 2) return CPTR_KILLED; else return 0; } } } } i = 0; for (i = 0; i < count; ++i) { name = vector[i]; /* * channel msg? */ if (IsChannelPrefix(*name)) { relay_channel_notice(sptr, name, parv[parc - 1], count); } /* * we have to check for the '@' at least once no matter what we do * handle it first so we don't have to do it twice */ else if ((server = strchr(name, '@'))) relay_directed_notice(sptr, name, server, parv[parc - 1]); else relay_private_notice(sptr, name, parv[parc - 1]); } return 0; } /* * ms_notice - server message handler */ int ms_notice(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { char* name; char* server; ClrFlag(sptr, FLAG_TS8); if (parc < 3) { /* * we can't deliver it, sending an error back is pointless */ return protocol_violation(sptr,"Not enough params for NOTICE"); } name = parv[1]; /* * channel msg? */ if (IsChannelPrefix(*name)) { server_relay_channel_notice(sptr, name, parv[parc - 1]); } /* * coming from another server, we have to check this here */ else if ('$' == *name && IsOper(sptr)) { server_relay_masked_notice(sptr, name, parv[parc - 1]); } else if ((server = strchr(name, '@'))) { /* * XXX - can't get away with not doing everything * relay_directed_notice has to do */ relay_directed_notice(sptr, name, server, parv[parc - 1]); } else { server_relay_private_notice(sptr, name, parv[parc - 1]); } return 0; } /* * mo_notice - oper message handler */ int mo_notice(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { char* name; char* server; int i; int count; char* vector[MAXTARGETS]; assert(0 != cptr); assert(cptr == sptr); ClrFlag(sptr, FLAG_TS8); if (parc < 2 || EmptyString(parv[1])) return send_reply(sptr, ERR_NORECIPIENT, MSG_NOTICE); if (parc < 3 || EmptyString(parv[parc - 1])) return send_reply(sptr, ERR_NOTEXTTOSEND); if (parv[1][0] == '@' && IsChannelPrefix(parv[1][1])) { parv[1]++; /* Get rid of '@' */ return m_wallchops(cptr, sptr, parc, parv); } count = unique_name_vector(parv[1], ',', vector, MAXTARGETS); for (i = 0; i < count; ++i) { name = vector[i]; /* * channel msg? */ if (IsChannelPrefix(*name)) relay_channel_notice(sptr, name, parv[parc - 1], count); else if (*name == '$') relay_masked_notice(sptr, name, parv[parc - 1]); else if ((server = strchr(name, '@'))) relay_directed_notice(sptr, name, server, parv[parc - 1]); else relay_private_notice(sptr, name, parv[parc - 1]); } return 0; }
/** Searches for a K/G-line for a client. If one is found, notify the * user and disconnect them. * @param cptr Client to search for. * @return 0 if client is accepted; -1 if client was locally denied * (K-line); -2 if client was globally denied (G-line); -3 if client * was globally IP denied (Z-line). */ int find_kill(struct Client *cptr) { const char* host; const char* name; const char* realname; const char* country; const char* continent; const char* version; struct DenyConf* deny; struct Gline* agline = NULL; struct Zline* azline = NULL; assert(0 != cptr); if (!cli_user(cptr)) return 0; host = cli_sockhost(cptr); name = cli_user(cptr)->username; realname = cli_info(cptr); country = cli_countrycode(cptr); continent = cli_continentcode(cptr); version = cli_version(cptr); assert(strlen(host) <= HOSTLEN); assert((name ? strlen(name) : 0) <= HOSTLEN); assert((realname ? strlen(realname) : 0) <= REALLEN); assert((country ? strlen(country) : 0) <= 3); assert((continent ? strlen(continent) : 0) <= 3); assert((version ? strlen(version) : 0) <= VERSIONLEN); /* 2000-07-14: Rewrote this loop for massive speed increases. * -- Isomer */ if (!find_except_conf(cptr, EFLAG_KLINE)) { for (deny = denyConfList; deny; deny = deny->next) { if (deny->usermask && match(deny->usermask, name)) continue; if (deny->realmask && match(deny->realmask, realname)) continue; if (deny->countrymask && country && match(deny->countrymask, country)) continue; if (deny->continentmask && continent && match(deny->continentmask, continent)) continue; if (feature_bool(FEAT_CTCP_VERSIONING) && feature_bool(FEAT_CTCP_VERSIONING_KILL)) { if (deny->version && version && match(deny->version, version)) continue; } if (deny->bits > 0) { if (!ipmask_check(&cli_ip(cptr), &deny->address, deny->bits)) continue; } else if (deny->hostmask && match(deny->hostmask, host)) continue; if ((deny->flags & DENY_FLAGS_AUTHEX) && IsAccount(cptr)) { if (!EmptyString(deny->mark) && EmptyString(cli_killmark(cptr))) ircd_strncpy(cli_killmark(cptr), deny->mark, BUFSIZE); continue; } if (EmptyString(deny->message)) send_reply(cptr, SND_EXPLICIT | ERR_YOUREBANNEDCREEP, ":Connection from your host is refused on this server."); else { if (deny->flags & DENY_FLAGS_FILE) killcomment(cptr, deny->message); else send_reply(cptr, SND_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%s.", deny->message); } return -1; } } /* Check Zlines here just in case a spoofed IP matches */ if (!feature_bool(FEAT_DISABLE_ZLINES) && (azline = zline_lookup(cptr, 0))) { /* * find active zlines * added a check against the user's IP address to find_zline() */ send_reply(cptr, SND_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%s.", ZlineReason(azline)); return -3; } /* Don't need to do an except lookup here as it's done in gline_lookup() */ if (!feature_bool(FEAT_DISABLE_GLINES) && (agline = gline_lookup(cptr, 0))) { /* * find active glines * added a check against the user's IP address to find_gline() -Kev */ send_reply(cptr, SND_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%s.", GlineReason(agline)); return -2; } return 0; }