--- m_listrestrict.c_orig 2018-11-04 19:48:47.024869229 -0000 +++ m_listrestrict.c 2018-11-04 19:47:55.191336981 -0000 @@ -59,18 +59,20 @@ fakeChannel *fakechanList = NULL; // Also fake channels int fakechanCount = 0; unsigned short conf_fakechans = 0; +unsigned short conf_exemptIdents = 0; // Deez defaults int muhDelay = 0; // Default to off yo unsigned short needAuth = 0; // Must be identified w/ NickServ (in addition to passing the delay check) unsigned short fakeChans = 0; // Send fake channels list unsigned short authIsEnough = 0; // Only NickServ auth is enough to be exempt +unsigned short exemptIdents = 0; // Users without ~ at the beginning of their username are exempt from list restrictions time_t glineTime = 86400; // Default to 1 day // Dat dere module header ModuleHeader MOD_HEADER(m_listrestrict) = { "m_listrestrict", // Module name - "$Id: v1.03 2018/11/04 Gottem/k4be$", // Version + "$Id: v1.04 2018/11/04 Gottem/k4be$", // Version "Impose certain restrictions on /LIST usage", // Description "3.2-b8-1", // Modversion, not sure wat do NULL @@ -108,6 +110,10 @@ config_error("A critical error occurred when loading module %s: %s", MOD_HEADER(m_listrestrict).name, ModuleGetErrorStr(lrestrictMI->handle)); return MOD_FAILED; // No good } +/* if(conf_exemptIdents && !IDENT_CHECK){ + config_error("[%s] %s::exemptidents was enabled but your config does not enable set::options::identd-check. The m_listrestrict would fail to work with this configuration.", MOD_HEADER(m_listrestrict).name, MYCONF); + return MOD_FAILED; // No good + }*/ // here it does not display the error at first start return MOD_SUCCESS; // We good } @@ -167,6 +173,11 @@ } if(authIsEnough && (*auth || IsLoggedIn(sptr))) *connect = 1; + if(exemptIdents && sptr->user && sptr->user->username[0] != '~'){ + *connect = 1; + *auth = 1; + *fakechans = 1; + } } // Now for the actual override @@ -349,6 +360,16 @@ conf_fakechans = atoi(cep->ce_vardata); continue; } + + if(!strcmp(cep->ce_varname, "exemptidents")) { + if(!cep->ce_vardata || (strcmp(cep->ce_vardata, "0") && strcmp(cep->ce_vardata, "1"))) { + config_error("%s:%i: %s::%s must be either 0 or 1 fam", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname); + errors++; // Increment err0r count fam + } + else + conf_exemptIdents = atoi(cep->ce_vardata); + continue; + } if(!strcmp(cep->ce_varname, "glinetime")) { // Should be a time string imo (7d10s etc, or just 20) @@ -478,6 +499,10 @@ config_error("[%s] %s::fakechans was enabled but there aren't any configured channels (fakechannel {} block)", MOD_HEADER(m_listrestrict).name, MYCONF); errors++; } +/* if(conf_exemptIdents && !IDENT_CHECK){ + config_error("[%s] %s::exemptidents was enabled but your config does not enable set::options::identd-check. The m_listrestrict would fail to work with this configuration.", MOD_HEADER(m_listrestrict).name, MYCONF); + errors++; + }*/ // for some reason this always fails when first starting the ircd *errs = errors; return errors ? -1 : 1; } @@ -532,6 +557,11 @@ fakeChans = atoi(cep->ce_vardata); continue; } + + if(cep->ce_vardata && !strcmp(cep->ce_varname, "exemptidents")) { + exemptIdents = atoi(cep->ce_vardata); + continue; + } if(cep->ce_vardata && !strcmp(cep->ce_varname, "glinetime")) { glineTime = config_checkval(cep->ce_vardata, CFG_TIME); @@ -641,6 +671,7 @@ authIsEnough = 0; glineTime = 86400; conf_fakechans = 0; + conf_exemptIdents = 0; return HOOK_CONTINUE; }