diff --git a/Changes b/Changes index cf150d1a1..a2ea9aadd 100644 --- a/Changes +++ b/Changes @@ -420,4 +420,8 @@ - Backported the passwd stuff, not needed. - Fixed a crash problem on /quit or /squit - Fixed some aligning in the VL PROTOCTL -- Fixed some fucked up passwd stuff again .. \ No newline at end of file +- Fixed some fucked up passwd stuff again .. +- Fixed a little Client Protoctl problem +- Fixed a crypto problem (forgot an #ifdef bad sts!) +- Fully added V:lines (doesn't really do much till the next version, since old versions don't support it) +- Added /stats v to list V:lines (/stats V still does vhost.conf) diff --git a/include/common.h b/include/common.h index 137bd92f3..afbeb250a 100644 --- a/include/common.h +++ b/include/common.h @@ -208,7 +208,7 @@ extern struct SLink *find_user_link(/* struct SLink *, struct Client * */); #define ZIPSTUFF "" #endif -#define PROTOCTL_CLIENT "TOKEN WATCH=128 SAFELIST HCN PREFIX=@+%" +#define PROTOCTL_CLIENT "TOKEN WATCH=128 SAFELIST HCN PREFIX=@%+" #define PROTOCTL_SERVER "NOQUIT TOKEN NICKv2 SJOIN SJOIN2 UMODE2 ALN VL" ZIPSTUFF #ifdef _WIN32 diff --git a/include/numeric.h b/include/numeric.h index b4e81db3f..30d7be7c4 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -250,6 +250,7 @@ #define RPL_STATSTLINE 224 #define RPL_STATSELINE 225 #define RPL_STATSNLINE 226 +#define RPL_STATSVLINE 227 #define RPL_SERVICEINFO 231 #define RPL_RULES 232 #define RPL_SERVICE 233 diff --git a/include/struct.h b/include/struct.h index 4de2ceab7..b4882b6e4 100644 --- a/include/struct.h +++ b/include/struct.h @@ -651,6 +651,7 @@ struct ConfItem { #define CONF_TLINE 0x8000000 /* T:Line */ #define CONF_SOCKSEXCEPT 0x10000000 #define CONF_NLINE 0x20000000 +#define CONF_VERSION 0x40000000 #define CONF_OPS (CONF_OPERATOR | CONF_LOCOP) #define CONF_SERVER_MASK (CONF_CONNECT_SERVER | CONF_NOCONNECT_SERVER) #define CONF_CLIENT_MASK (CONF_CLIENT | CONF_SERVICE | CONF_OPS | \ diff --git a/src/s_conf.c b/src/s_conf.c index 47c975ddb..3f341a31f 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -1241,6 +1241,10 @@ int initconf(opt) case 'u': /* *Every* server on the net must define the same !!! */ aconf->status = CONF_UWORLD; break; + case 'V': + case 'v': + aconf->status = CONF_VERSION; + break; case 'Y': case 'y': aconf->status = CONF_CLASS; diff --git a/src/s_err.c b/src/s_err.c index 75073b1d7..742ef87ed 100644 --- a/src/s_err.c +++ b/src/s_err.c @@ -262,7 +262,7 @@ static char *replies[] = { /* 224 RPL_STATSTLINE */ ":%s 224 %s T %s %s %s", /* 225 RPL_STATSELINE */ ":%s 225 %s e %s %s %s", /* 226 RPL_STATSNLINE */ ":%s 226 %s n %s %s", -/* 227 */ NULL, +/* 227 RPL_STATSVLINE */ ":%s 227 %s V %s %s %s", /* 228 */ NULL, /* 229 */ NULL, /* 230 */ NULL, diff --git a/src/s_serv.c b/src/s_serv.c index 24c1d0a26..026e2e109 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -759,13 +759,98 @@ int m_server(cptr, sptr, parc, parv) /* we also have a fail safe incase they say they are sending * VL stuff and don't -- codemastr */ + aConfItem *vlines = NULL; protocol = (char *)strtok((char *)info, "-"); if (protocol) flags = (char *)strtok((char *)NULL, " "); - if (flags) { + if (flags) inf = (char *)strtok((char *)NULL, ""); + if (inf) { strncpyzt(cptr->info, inf[0] ? inf : me.name, sizeof(cptr->info)); + for (vlines = conf; vlines; vlines = vlines->next) { + if ((vlines->status & CONF_VERSION) && !match(vlines->name,cptr->name)) + break; } + if (vlines) { + char *proto = vlines->host; + char *vflags = vlines->passwd; + int result = 0; + int i; + protocol++; + /* check the protocol */ + switch(*proto) { + case '<': + proto++; + if (atoi(protocol) < atoi(proto)) + result = 1; + else + result = 0; + break; + case '>': + proto++; + if (atoi(protocol) > atoi(proto)) + result = 1; + else + result = 0; + break; + case '=': + proto++; + if (atoi(protocol) == atoi(proto)) + result = 1; + else + result = 0; + break; + case '!': + proto++; + if (atoi(protocol) != atoi(proto)) + result = 1; + else + result = 0; + break; + /* default to = if anything else */ + default: + if (atoi(protocol) == atoi(proto)) + result = 1; + else + result = 0; + break; + } /* switch(*proto) */ + /* For Services */ + if (atoi(protocol) == 0) + result = 0; + /* if the proto in the V:line is * let it pass */ + if (*proto == '*') + result = 0; + + + if (result) + return exit_client(cptr, cptr, cptr, "Denied by V:line"); + + /* If it passed the protocol check, check the flags */ + + for(i = 0; vflags[i]; i++) { + if (vflags[i] == '!') { + i++; + if (strchr(flags, (int)vflags[i])) { + result = 1; + break; + } + } + if (!strchr(flags, (int)vflags[i])) { + result = 1; + break; + } + } /* for(i = 0; vflags[i]; i++) */ + if (*vflags == '*') + result = 0; + /* for services */ + if (!strcmp(flags, "0")) + result = 0; + if (result) + return exit_client(cptr, cptr, cptr, "Denied by V:line"); + + } /* if (vlines) */ + } /* if (flags) */ else strncpyzt(cptr->info, info[0] ? info : me.name, sizeof(cptr->info)); } @@ -1846,6 +1931,7 @@ static int report_array[][3] = { {CONF_MISSING, RPL_STATSXLINE, 'X'}, {CONF_TLINE, RPL_STATSTLINE, 't'}, {CONF_SOCKSEXCEPT, RPL_STATSELINE, 'e'}, + {CONF_VERSION, RPL_STATSVLINE, 'V'}, {0, 0} }; @@ -1992,6 +2078,9 @@ static void report_configured_links(sptr, mask) sendto_one(sptr, rpl_str(RPL_STATSNLINE), me.name, sptr->name, host, pass); } + else if (mask == CONF_VERSION) + sendto_one(sptr, rpl_str(RPL_STATSVLINE), + me.name, sptr->name, host, pass, name); /* else if (mask == CONF_EXCEPT) { ppx = MyMalloc(strlen(tmp->passwd) + 1); @@ -2310,6 +2399,8 @@ int m_stats(cptr, sptr, parc, parv) break; } case 'v': + report_configured_links(sptr, CONF_VERSION); + break; case 'V': vhost_report(sptr); break; diff --git a/src/send.c b/src/send.c index 0483f5cad..f2c4e3a7d 100644 --- a/src/send.c +++ b/src/send.c @@ -1517,7 +1517,11 @@ void sendto_connectnotice(nick, user, sptr) ircsprintf(connectd, "*** Notice -- Client connecting on port %d: %s (%s@%s) %s", sptr->acpt->port, nick, user->username, user->realhost, - IsSecure(sptr) ? "[secure]" : ""); +#ifdef CRYPTOIRCD + IsSecure(sptr) ? "[secure]" : ""); +#else + ""); +#endif ircsprintf(connecth, "*** Notice -- Client connecting: %s (%s@%s) [%s] {%d}", nick, user->username, user->realhost, sptr->sockhost,