Bez tytułu

z k4be, 6 lata temu, napisane w Diff-output, wyświetlone 414 razy.
URL https://pastebin.k4be.pl/view/f169b389 Udostępnij
Pobierz wklejkę lub Pokaż surowy tekst
  1. --- m_listrestrict.c_orig       2018-11-04 19:48:47.024869229 -0000
  2. +++ m_listrestrict.c    2018-11-04 19:47:55.191336981 -0000
  3. @@ -59,18 +59,20 @@
  4.  fakeChannel *fakechanList = NULL; // Also fake channels
  5.  int fakechanCount = 0;
  6.  unsigned short conf_fakechans = 0;
  7. +unsigned short conf_exemptIdents = 0;
  8.  
  9.  // Deez defaults
  10.  int muhDelay = 0; // Default to off yo
  11.  unsigned short needAuth = 0; // Must be identified w/ NickServ (in addition to passing the delay check)
  12.  unsigned short fakeChans = 0; // Send fake channels list
  13.  unsigned short authIsEnough = 0; // Only NickServ auth is enough to be exempt
  14. +unsigned short exemptIdents = 0; // Users without ~ at the beginning of their username are exempt from list restrictions
  15.  time_t glineTime = 86400; // Default to 1 day
  16.  
  17.  // Dat dere module header
  18.  ModuleHeader MOD_HEADER(m_listrestrict) = {
  19.         "m_listrestrict", // Module name
  20. -       "$Id: v1.03 2018/11/04 Gottem/k4be$", // Version
  21. +       "$Id: v1.04 2018/11/04 Gottem/k4be$", // Version
  22.         "Impose certain restrictions on /LIST usage", // Description
  23.         "3.2-b8-1", // Modversion, not sure wat do
  24.         NULL
  25. @@ -108,6 +110,10 @@
  26.                 config_error("A critical error occurred when loading module %s: %s", MOD_HEADER(m_listrestrict).name, ModuleGetErrorStr(lrestrictMI->handle));
  27.                 return MOD_FAILED; // No good
  28.         }
  29. +/*     if(conf_exemptIdents && !IDENT_CHECK){
  30. +               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);
  31. +               return MOD_FAILED; // No good
  32. +       }*/ // here it does not display the error at first start
  33.         return MOD_SUCCESS; // We good
  34.  }
  35.  
  36. @@ -167,6 +173,11 @@
  37.         }
  38.         if(authIsEnough && (*auth || IsLoggedIn(sptr)))
  39.                 *connect = 1;
  40. +       if(exemptIdents && sptr->user && sptr->user->username[0] != '~'){
  41. +               *connect = 1;
  42. +               *auth = 1;
  43. +               *fakechans = 1;
  44. +       }
  45.  }
  46.  
  47.  // Now for the actual override
  48. @@ -349,6 +360,16 @@
  49.                                 conf_fakechans = atoi(cep->ce_vardata);
  50.                         continue;
  51.                 }
  52. +              
  53. +               if(!strcmp(cep->ce_varname, "exemptidents")) {
  54. +                       if(!cep->ce_vardata || (strcmp(cep->ce_vardata, "0") && strcmp(cep->ce_vardata, "1"))) {
  55. +                               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);
  56. +                               errors++; // Increment err0r count fam
  57. +                       }
  58. +                       else
  59. +                               conf_exemptIdents = atoi(cep->ce_vardata);
  60. +                       continue;
  61. +               }
  62.  
  63.                 if(!strcmp(cep->ce_varname, "glinetime")) {
  64.                         // Should be a time string imo (7d10s etc, or just 20)
  65. @@ -478,6 +499,10 @@
  66.                 config_error("[%s] %s::fakechans was enabled but there aren't any configured channels (fakechannel {} block)", MOD_HEADER(m_listrestrict).name, MYCONF);
  67.                 errors++;
  68.         }
  69. +/*     if(conf_exemptIdents && !IDENT_CHECK){
  70. +               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);
  71. +               errors++;
  72. +       }*/ // for some reason this always fails when first starting the ircd
  73.         *errs = errors;
  74.         return errors ? -1 : 1;
  75.  }
  76. @@ -532,6 +557,11 @@
  77.                         fakeChans = atoi(cep->ce_vardata);
  78.                         continue;
  79.                 }
  80. +              
  81. +               if(cep->ce_vardata && !strcmp(cep->ce_varname, "exemptidents")) {
  82. +                       exemptIdents = atoi(cep->ce_vardata);
  83. +                       continue;
  84. +               }
  85.  
  86.                 if(cep->ce_vardata && !strcmp(cep->ce_varname, "glinetime")) {
  87.                         glineTime = config_checkval(cep->ce_vardata, CFG_TIME);
  88. @@ -641,6 +671,7 @@
  89.         authIsEnough = 0;
  90.         glineTime = 86400;
  91.         conf_fakechans = 0;
  92. +       conf_exemptIdents = 0;
  93.         return HOOK_CONTINUE;
  94.  }
  95.  

odpowiedź "Bez tytułu"

Tutaj możesz odpowiedzieć na wklejkę z góry

captcha