Change all code to a consistent style

We use the Linux Kernel format now.
This commit is contained in:
Sam Dodrill 2014-08-03 10:38:55 -07:00
parent 027b2310ca
commit 9890a48cd9
254 changed files with 44148 additions and 48443 deletions

View File

@ -40,21 +40,20 @@
#define COMMIT_INTERVAL 3 /* seconds */
typedef enum
{
BANDB_KLINE,
BANDB_DLINE,
BANDB_XLINE,
BANDB_RESV,
LAST_BANDB_TYPE
typedef enum {
BANDB_KLINE,
BANDB_DLINE,
BANDB_XLINE,
BANDB_RESV,
LAST_BANDB_TYPE
} bandb_type;
static char bandb_letter[LAST_BANDB_TYPE] = {
'K', 'D', 'X', 'R'
'K', 'D', 'X', 'R'
};
static const char *bandb_table[LAST_BANDB_TYPE] = {
"kline", "dline", "xline", "resv"
"kline", "dline", "xline", "resv"
};
@ -66,191 +65,181 @@ static void check_schema(void);
static void
bandb_commit(void *unused)
{
rsdb_transaction(RSDB_TRANS_END);
in_transaction = 0;
rsdb_transaction(RSDB_TRANS_END);
in_transaction = 0;
}
static void
parse_ban(bandb_type type, char *parv[], int parc)
{
const char *mask1 = NULL;
const char *mask2 = NULL;
const char *oper = NULL;
const char *curtime = NULL;
const char *reason = NULL;
const char *perm = NULL;
int para = 1;
const char *mask1 = NULL;
const char *mask2 = NULL;
const char *oper = NULL;
const char *curtime = NULL;
const char *reason = NULL;
const char *perm = NULL;
int para = 1;
if(type == BANDB_KLINE)
{
if(parc != 7)
return;
}
else if(parc != 6)
return;
if(type == BANDB_KLINE) {
if(parc != 7)
return;
} else if(parc != 6)
return;
mask1 = parv[para++];
mask1 = parv[para++];
if(type == BANDB_KLINE)
mask2 = parv[para++];
if(type == BANDB_KLINE)
mask2 = parv[para++];
oper = parv[para++];
curtime = parv[para++];
perm = parv[para++];
reason = parv[para++];
oper = parv[para++];
curtime = parv[para++];
perm = parv[para++];
reason = parv[para++];
if(!in_transaction)
{
rsdb_transaction(RSDB_TRANS_START);
in_transaction = 1;
rb_event_addonce("bandb_commit", bandb_commit, NULL,
COMMIT_INTERVAL);
}
if(!in_transaction) {
rsdb_transaction(RSDB_TRANS_START);
in_transaction = 1;
rb_event_addonce("bandb_commit", bandb_commit, NULL,
COMMIT_INTERVAL);
}
rsdb_exec(NULL,
"INSERT INTO %s (mask1, mask2, oper, time, perm, reason) VALUES('%Q', '%Q', '%Q', %s, %s, '%Q')",
bandb_table[type], mask1, mask2 ? mask2 : "", oper, curtime, perm, reason);
rsdb_exec(NULL,
"INSERT INTO %s (mask1, mask2, oper, time, perm, reason) VALUES('%Q', '%Q', '%Q', %s, %s, '%Q')",
bandb_table[type], mask1, mask2 ? mask2 : "", oper, curtime, perm, reason);
}
static void
parse_unban(bandb_type type, char *parv[], int parc)
{
const char *mask1 = NULL;
const char *mask2 = NULL;
const char *mask1 = NULL;
const char *mask2 = NULL;
if(type == BANDB_KLINE)
{
if(parc != 3)
return;
}
else if(parc != 2)
return;
if(type == BANDB_KLINE) {
if(parc != 3)
return;
} else if(parc != 2)
return;
mask1 = parv[1];
mask1 = parv[1];
if(type == BANDB_KLINE)
mask2 = parv[2];
if(type == BANDB_KLINE)
mask2 = parv[2];
if(!in_transaction)
{
rsdb_transaction(RSDB_TRANS_START);
in_transaction = 1;
rb_event_addonce("bandb_commit", bandb_commit, NULL,
COMMIT_INTERVAL);
}
if(!in_transaction) {
rsdb_transaction(RSDB_TRANS_START);
in_transaction = 1;
rb_event_addonce("bandb_commit", bandb_commit, NULL,
COMMIT_INTERVAL);
}
rsdb_exec(NULL, "DELETE FROM %s WHERE mask1='%Q' AND mask2='%Q'",
bandb_table[type], mask1, mask2 ? mask2 : "");
rsdb_exec(NULL, "DELETE FROM %s WHERE mask1='%Q' AND mask2='%Q'",
bandb_table[type], mask1, mask2 ? mask2 : "");
}
static void
list_bans(void)
{
static char buf[512];
struct rsdb_table table;
int i, j;
static char buf[512];
struct rsdb_table table;
int i, j;
/* schedule a clear of anything already pending */
rb_helper_write_queue(bandb_helper, "C");
/* schedule a clear of anything already pending */
rb_helper_write_queue(bandb_helper, "C");
for(i = 0; i < LAST_BANDB_TYPE; i++)
{
rsdb_exec_fetch(&table, "SELECT mask1,mask2,oper,reason FROM %s WHERE 1",
bandb_table[i]);
for(i = 0; i < LAST_BANDB_TYPE; i++) {
rsdb_exec_fetch(&table, "SELECT mask1,mask2,oper,reason FROM %s WHERE 1",
bandb_table[i]);
for(j = 0; j < table.row_count; j++)
{
if(i == BANDB_KLINE)
rb_snprintf(buf, sizeof(buf), "%c %s %s %s :%s",
bandb_letter[i], table.row[j][0],
table.row[j][1], table.row[j][2], table.row[j][3]);
else
rb_snprintf(buf, sizeof(buf), "%c %s %s :%s",
bandb_letter[i], table.row[j][0],
table.row[j][2], table.row[j][3]);
for(j = 0; j < table.row_count; j++) {
if(i == BANDB_KLINE)
rb_snprintf(buf, sizeof(buf), "%c %s %s %s :%s",
bandb_letter[i], table.row[j][0],
table.row[j][1], table.row[j][2], table.row[j][3]);
else
rb_snprintf(buf, sizeof(buf), "%c %s %s :%s",
bandb_letter[i], table.row[j][0],
table.row[j][2], table.row[j][3]);
rb_helper_write_queue(bandb_helper, "%s", buf);
}
rb_helper_write_queue(bandb_helper, "%s", buf);
}
rsdb_exec_fetch_end(&table);
}
rsdb_exec_fetch_end(&table);
}
rb_helper_write(bandb_helper, "F");
rb_helper_write(bandb_helper, "F");
}
static void
parse_request(rb_helper *helper)
{
static char *parv[MAXPARA + 1];
static char readbuf[READBUF_SIZE];
int parc;
int len;
static char *parv[MAXPARA + 1];
static char readbuf[READBUF_SIZE];
int parc;
int len;
while((len = rb_helper_read(helper, readbuf, sizeof(readbuf))) > 0)
{
parc = rb_string_to_array(readbuf, parv, MAXPARA);
while((len = rb_helper_read(helper, readbuf, sizeof(readbuf))) > 0) {
parc = rb_string_to_array(readbuf, parv, MAXPARA);
if(parc < 1)
continue;
if(parc < 1)
continue;
switch (parv[0][0])
{
case 'K':
parse_ban(BANDB_KLINE, parv, parc);
break;
switch (parv[0][0]) {
case 'K':
parse_ban(BANDB_KLINE, parv, parc);
break;
case 'D':
parse_ban(BANDB_DLINE, parv, parc);
break;
case 'D':
parse_ban(BANDB_DLINE, parv, parc);
break;
case 'X':
parse_ban(BANDB_XLINE, parv, parc);
break;
case 'X':
parse_ban(BANDB_XLINE, parv, parc);
break;
case 'R':
parse_ban(BANDB_RESV, parv, parc);
break;
case 'R':
parse_ban(BANDB_RESV, parv, parc);
break;
case 'k':
parse_unban(BANDB_KLINE, parv, parc);
break;
case 'k':
parse_unban(BANDB_KLINE, parv, parc);
break;
case 'd':
parse_unban(BANDB_DLINE, parv, parc);
break;
case 'd':
parse_unban(BANDB_DLINE, parv, parc);
break;
case 'x':
parse_unban(BANDB_XLINE, parv, parc);
break;
case 'x':
parse_unban(BANDB_XLINE, parv, parc);
break;
case 'r':
parse_unban(BANDB_RESV, parv, parc);
break;
case 'r':
parse_unban(BANDB_RESV, parv, parc);
break;
case 'L':
list_bans();
break;
default:
break;
}
}
case 'L':
list_bans();
break;
default:
break;
}
}
}
static void
error_cb(rb_helper *helper)
{
if(in_transaction)
rsdb_transaction(RSDB_TRANS_END);
exit(1);
if(in_transaction)
rsdb_transaction(RSDB_TRANS_END);
exit(1);
}
#ifndef WINDOWS
static void
dummy_handler(int sig)
{
return;
return;
}
#endif
@ -258,28 +247,28 @@ static void
setup_signals()
{
#ifndef WINDOWS
struct sigaction act;
struct sigaction act;
act.sa_flags = 0;
act.sa_handler = SIG_IGN;
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask, SIGPIPE);
sigaddset(&act.sa_mask, SIGALRM);
act.sa_flags = 0;
act.sa_handler = SIG_IGN;
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask, SIGPIPE);
sigaddset(&act.sa_mask, SIGALRM);
#ifdef SIGTRAP
sigaddset(&act.sa_mask, SIGTRAP);
sigaddset(&act.sa_mask, SIGTRAP);
#endif
#ifdef SIGWINCH
sigaddset(&act.sa_mask, SIGWINCH);
sigaction(SIGWINCH, &act, 0);
sigaddset(&act.sa_mask, SIGWINCH);
sigaction(SIGWINCH, &act, 0);
#endif
sigaction(SIGPIPE, &act, 0);
sigaction(SIGPIPE, &act, 0);
#ifdef SIGTRAP
sigaction(SIGTRAP, &act, 0);
sigaction(SIGTRAP, &act, 0);
#endif
act.sa_handler = dummy_handler;
sigaction(SIGALRM, &act, 0);
act.sa_handler = dummy_handler;
sigaction(SIGALRM, &act, 0);
#endif
}
@ -287,51 +276,49 @@ setup_signals()
static void
db_error_cb(const char *errstr)
{
char buf[256];
rb_snprintf(buf, sizeof(buf), "! :%s", errstr);
rb_helper_write(bandb_helper, buf);
rb_sleep(2 << 30, 0);
exit(1);
char buf[256];
rb_snprintf(buf, sizeof(buf), "! :%s", errstr);
rb_helper_write(bandb_helper, buf);
rb_sleep(2 << 30, 0);
exit(1);
}
int
main(int argc, char *argv[])
{
setup_signals();
bandb_helper = rb_helper_child(parse_request, error_cb, NULL, NULL, NULL, 256, 256, 256, 256); /* XXX fix me */
if(bandb_helper == NULL)
{
fprintf(stderr,
"This is ircd-ratbox bandb. You aren't supposed to run me directly. Maybe you want bantool?\n");
fprintf(stderr,
"However I will print my Id tag $Id: bandb.c 26094 2008-09-19 15:33:46Z androsyn $\n");
fprintf(stderr, "Have a nice day\n");
exit(1);
}
rsdb_init(db_error_cb);
check_schema();
rb_helper_loop(bandb_helper, 0);
setup_signals();
bandb_helper = rb_helper_child(parse_request, error_cb, NULL, NULL, NULL, 256, 256, 256, 256); /* XXX fix me */
if(bandb_helper == NULL) {
fprintf(stderr,
"This is ircd-ratbox bandb. You aren't supposed to run me directly. Maybe you want bantool?\n");
fprintf(stderr,
"However I will print my Id tag $Id: bandb.c 26094 2008-09-19 15:33:46Z androsyn $\n");
fprintf(stderr, "Have a nice day\n");
exit(1);
}
rsdb_init(db_error_cb);
check_schema();
rb_helper_loop(bandb_helper, 0);
return 0;
return 0;
}
static void
check_schema(void)
{
struct rsdb_table table;
int i;
struct rsdb_table table;
int i;
for(i = 0; i < LAST_BANDB_TYPE; i++)
{
rsdb_exec_fetch(&table,
"SELECT name FROM sqlite_master WHERE type='table' AND name='%s'",
bandb_table[i]);
for(i = 0; i < LAST_BANDB_TYPE; i++) {
rsdb_exec_fetch(&table,
"SELECT name FROM sqlite_master WHERE type='table' AND name='%s'",
bandb_table[i]);
rsdb_exec_fetch_end(&table);
rsdb_exec_fetch_end(&table);
if(!table.row_count)
rsdb_exec(NULL,
"CREATE TABLE %s (mask1 TEXT, mask2 TEXT, oper TEXT, time INTEGER, perm INTEGER, reason TEXT)",
bandb_table[i]);
}
if(!table.row_count)
rsdb_exec(NULL,
"CREATE TABLE %s (mask1 TEXT, mask2 TEXT, oper TEXT, time INTEGER, perm INTEGER, reason TEXT)",
bandb_table[i]);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -6,19 +6,17 @@ typedef void rsdb_error_cb(const char *);
typedef int (*rsdb_callback) (int, const char **);
typedef enum rsdb_transtype
{
RSDB_TRANS_START,
RSDB_TRANS_END
typedef enum rsdb_transtype {
RSDB_TRANS_START,
RSDB_TRANS_END
}
rsdb_transtype;
struct rsdb_table
{
char ***row;
int row_count;
int col_count;
void *arg;
struct rsdb_table {
char ***row;
int row_count;
int col_count;
void *arg;
};
int rsdb_init(rsdb_error_cb *);

View File

@ -39,206 +39,206 @@
#define TABLE_MAX 1000
static const char *IntTable[] = {
"000", "100", "200", "300", "400",
"500", "600", "700", "800", "900",
"010", "110", "210", "310", "410",
"510", "610", "710", "810", "910",
"020", "120", "220", "320", "420",
"520", "620", "720", "820", "920",
"030", "130", "230", "330", "430",
"530", "630", "730", "830", "930",
"040", "140", "240", "340", "440",
"540", "640", "740", "840", "940",
"050", "150", "250", "350", "450",
"550", "650", "750", "850", "950",
"060", "160", "260", "360", "460",
"560", "660", "760", "860", "960",
"070", "170", "270", "370", "470",
"570", "670", "770", "870", "970",
"080", "180", "280", "380", "480",
"580", "680", "780", "880", "980",
"090", "190", "290", "390", "490",
"590", "690", "790", "890", "990",
"001", "101", "201", "301", "401",
"501", "601", "701", "801", "901",
"011", "111", "211", "311", "411",
"511", "611", "711", "811", "911",
"021", "121", "221", "321", "421",
"521", "621", "721", "821", "921",
"031", "131", "231", "331", "431",
"531", "631", "731", "831", "931",
"041", "141", "241", "341", "441",
"541", "641", "741", "841", "941",
"051", "151", "251", "351", "451",
"551", "651", "751", "851", "951",
"061", "161", "261", "361", "461",
"561", "661", "761", "861", "961",
"071", "171", "271", "371", "471",
"571", "671", "771", "871", "971",
"081", "181", "281", "381", "481",
"581", "681", "781", "881", "981",
"091", "191", "291", "391", "491",
"591", "691", "791", "891", "991",
"002", "102", "202", "302", "402",
"502", "602", "702", "802", "902",
"012", "112", "212", "312", "412",
"512", "612", "712", "812", "912",
"022", "122", "222", "322", "422",
"522", "622", "722", "822", "922",
"032", "132", "232", "332", "432",
"532", "632", "732", "832", "932",
"042", "142", "242", "342", "442",
"542", "642", "742", "842", "942",
"052", "152", "252", "352", "452",
"552", "652", "752", "852", "952",
"062", "162", "262", "362", "462",
"562", "662", "762", "862", "962",
"072", "172", "272", "372", "472",
"572", "672", "772", "872", "972",
"082", "182", "282", "382", "482",
"582", "682", "782", "882", "982",
"092", "192", "292", "392", "492",
"592", "692", "792", "892", "992",
"003", "103", "203", "303", "403",
"503", "603", "703", "803", "903",
"013", "113", "213", "313", "413",
"513", "613", "713", "813", "913",
"023", "123", "223", "323", "423",
"523", "623", "723", "823", "923",
"033", "133", "233", "333", "433",
"533", "633", "733", "833", "933",
"043", "143", "243", "343", "443",
"543", "643", "743", "843", "943",
"053", "153", "253", "353", "453",
"553", "653", "753", "853", "953",
"063", "163", "263", "363", "463",
"563", "663", "763", "863", "963",
"073", "173", "273", "373", "473",
"573", "673", "773", "873", "973",
"083", "183", "283", "383", "483",
"583", "683", "783", "883", "983",
"093", "193", "293", "393", "493",
"593", "693", "793", "893", "993",
"004", "104", "204", "304", "404",
"504", "604", "704", "804", "904",
"014", "114", "214", "314", "414",
"514", "614", "714", "814", "914",
"024", "124", "224", "324", "424",
"524", "624", "724", "824", "924",
"034", "134", "234", "334", "434",
"534", "634", "734", "834", "934",
"044", "144", "244", "344", "444",
"544", "644", "744", "844", "944",
"054", "154", "254", "354", "454",
"554", "654", "754", "854", "954",
"064", "164", "264", "364", "464",
"564", "664", "764", "864", "964",
"074", "174", "274", "374", "474",
"574", "674", "774", "874", "974",
"084", "184", "284", "384", "484",
"584", "684", "784", "884", "984",
"094", "194", "294", "394", "494",
"594", "694", "794", "894", "994",
"005", "105", "205", "305", "405",
"505", "605", "705", "805", "905",
"015", "115", "215", "315", "415",
"515", "615", "715", "815", "915",
"025", "125", "225", "325", "425",
"525", "625", "725", "825", "925",
"035", "135", "235", "335", "435",
"535", "635", "735", "835", "935",
"045", "145", "245", "345", "445",
"545", "645", "745", "845", "945",
"055", "155", "255", "355", "455",
"555", "655", "755", "855", "955",
"065", "165", "265", "365", "465",
"565", "665", "765", "865", "965",
"075", "175", "275", "375", "475",
"575", "675", "775", "875", "975",
"085", "185", "285", "385", "485",
"585", "685", "785", "885", "985",
"095", "195", "295", "395", "495",
"595", "695", "795", "895", "995",
"006", "106", "206", "306", "406",
"506", "606", "706", "806", "906",
"016", "116", "216", "316", "416",
"516", "616", "716", "816", "916",
"026", "126", "226", "326", "426",
"526", "626", "726", "826", "926",
"036", "136", "236", "336", "436",
"536", "636", "736", "836", "936",
"046", "146", "246", "346", "446",
"546", "646", "746", "846", "946",
"056", "156", "256", "356", "456",
"556", "656", "756", "856", "956",
"066", "166", "266", "366", "466",
"566", "666", "766", "866", "966",
"076", "176", "276", "376", "476",
"576", "676", "776", "876", "976",
"086", "186", "286", "386", "486",
"586", "686", "786", "886", "986",
"096", "196", "296", "396", "496",
"596", "696", "796", "896", "996",
"007", "107", "207", "307", "407",
"507", "607", "707", "807", "907",
"017", "117", "217", "317", "417",
"517", "617", "717", "817", "917",
"027", "127", "227", "327", "427",
"527", "627", "727", "827", "927",
"037", "137", "237", "337", "437",
"537", "637", "737", "837", "937",
"047", "147", "247", "347", "447",
"547", "647", "747", "847", "947",
"057", "157", "257", "357", "457",
"557", "657", "757", "857", "957",
"067", "167", "267", "367", "467",
"567", "667", "767", "867", "967",
"077", "177", "277", "377", "477",
"577", "677", "777", "877", "977",
"087", "187", "287", "387", "487",
"587", "687", "787", "887", "987",
"097", "197", "297", "397", "497",
"597", "697", "797", "897", "997",
"008", "108", "208", "308", "408",
"508", "608", "708", "808", "908",
"018", "118", "218", "318", "418",
"518", "618", "718", "818", "918",
"028", "128", "228", "328", "428",
"528", "628", "728", "828", "928",
"038", "138", "238", "338", "438",
"538", "638", "738", "838", "938",
"048", "148", "248", "348", "448",
"548", "648", "748", "848", "948",
"058", "158", "258", "358", "458",
"558", "658", "758", "858", "958",
"068", "168", "268", "368", "468",
"568", "668", "768", "868", "968",
"078", "178", "278", "378", "478",
"578", "678", "778", "878", "978",
"088", "188", "288", "388", "488",
"588", "688", "788", "888", "988",
"098", "198", "298", "398", "498",
"598", "698", "798", "898", "998",
"009", "109", "209", "309", "409",
"509", "609", "709", "809", "909",
"019", "119", "219", "319", "419",
"519", "619", "719", "819", "919",
"029", "129", "229", "329", "429",
"529", "629", "729", "829", "929",
"039", "139", "239", "339", "439",
"539", "639", "739", "839", "939",
"049", "149", "249", "349", "449",
"549", "649", "749", "849", "949",
"059", "159", "259", "359", "459",
"559", "659", "759", "859", "959",
"069", "169", "269", "369", "469",
"569", "669", "769", "869", "969",
"079", "179", "279", "379", "479",
"579", "679", "779", "879", "979",
"089", "189", "289", "389", "489",
"589", "689", "789", "889", "989",
"099", "199", "299", "399", "499",
"599", "699", "799", "899", "999"
"000", "100", "200", "300", "400",
"500", "600", "700", "800", "900",
"010", "110", "210", "310", "410",
"510", "610", "710", "810", "910",
"020", "120", "220", "320", "420",
"520", "620", "720", "820", "920",
"030", "130", "230", "330", "430",
"530", "630", "730", "830", "930",
"040", "140", "240", "340", "440",
"540", "640", "740", "840", "940",
"050", "150", "250", "350", "450",
"550", "650", "750", "850", "950",
"060", "160", "260", "360", "460",
"560", "660", "760", "860", "960",
"070", "170", "270", "370", "470",
"570", "670", "770", "870", "970",
"080", "180", "280", "380", "480",
"580", "680", "780", "880", "980",
"090", "190", "290", "390", "490",
"590", "690", "790", "890", "990",
"001", "101", "201", "301", "401",
"501", "601", "701", "801", "901",
"011", "111", "211", "311", "411",
"511", "611", "711", "811", "911",
"021", "121", "221", "321", "421",
"521", "621", "721", "821", "921",
"031", "131", "231", "331", "431",
"531", "631", "731", "831", "931",
"041", "141", "241", "341", "441",
"541", "641", "741", "841", "941",
"051", "151", "251", "351", "451",
"551", "651", "751", "851", "951",
"061", "161", "261", "361", "461",
"561", "661", "761", "861", "961",
"071", "171", "271", "371", "471",
"571", "671", "771", "871", "971",
"081", "181", "281", "381", "481",
"581", "681", "781", "881", "981",
"091", "191", "291", "391", "491",
"591", "691", "791", "891", "991",
"002", "102", "202", "302", "402",
"502", "602", "702", "802", "902",
"012", "112", "212", "312", "412",
"512", "612", "712", "812", "912",
"022", "122", "222", "322", "422",
"522", "622", "722", "822", "922",
"032", "132", "232", "332", "432",
"532", "632", "732", "832", "932",
"042", "142", "242", "342", "442",
"542", "642", "742", "842", "942",
"052", "152", "252", "352", "452",
"552", "652", "752", "852", "952",
"062", "162", "262", "362", "462",
"562", "662", "762", "862", "962",
"072", "172", "272", "372", "472",
"572", "672", "772", "872", "972",
"082", "182", "282", "382", "482",
"582", "682", "782", "882", "982",
"092", "192", "292", "392", "492",
"592", "692", "792", "892", "992",
"003", "103", "203", "303", "403",
"503", "603", "703", "803", "903",
"013", "113", "213", "313", "413",
"513", "613", "713", "813", "913",
"023", "123", "223", "323", "423",
"523", "623", "723", "823", "923",
"033", "133", "233", "333", "433",
"533", "633", "733", "833", "933",
"043", "143", "243", "343", "443",
"543", "643", "743", "843", "943",
"053", "153", "253", "353", "453",
"553", "653", "753", "853", "953",
"063", "163", "263", "363", "463",
"563", "663", "763", "863", "963",
"073", "173", "273", "373", "473",
"573", "673", "773", "873", "973",
"083", "183", "283", "383", "483",
"583", "683", "783", "883", "983",
"093", "193", "293", "393", "493",
"593", "693", "793", "893", "993",
"004", "104", "204", "304", "404",
"504", "604", "704", "804", "904",
"014", "114", "214", "314", "414",
"514", "614", "714", "814", "914",
"024", "124", "224", "324", "424",
"524", "624", "724", "824", "924",
"034", "134", "234", "334", "434",
"534", "634", "734", "834", "934",
"044", "144", "244", "344", "444",
"544", "644", "744", "844", "944",
"054", "154", "254", "354", "454",
"554", "654", "754", "854", "954",
"064", "164", "264", "364", "464",
"564", "664", "764", "864", "964",
"074", "174", "274", "374", "474",
"574", "674", "774", "874", "974",
"084", "184", "284", "384", "484",
"584", "684", "784", "884", "984",
"094", "194", "294", "394", "494",
"594", "694", "794", "894", "994",
"005", "105", "205", "305", "405",
"505", "605", "705", "805", "905",
"015", "115", "215", "315", "415",
"515", "615", "715", "815", "915",
"025", "125", "225", "325", "425",
"525", "625", "725", "825", "925",
"035", "135", "235", "335", "435",
"535", "635", "735", "835", "935",
"045", "145", "245", "345", "445",
"545", "645", "745", "845", "945",
"055", "155", "255", "355", "455",
"555", "655", "755", "855", "955",
"065", "165", "265", "365", "465",
"565", "665", "765", "865", "965",
"075", "175", "275", "375", "475",
"575", "675", "775", "875", "975",
"085", "185", "285", "385", "485",
"585", "685", "785", "885", "985",
"095", "195", "295", "395", "495",
"595", "695", "795", "895", "995",
"006", "106", "206", "306", "406",
"506", "606", "706", "806", "906",
"016", "116", "216", "316", "416",
"516", "616", "716", "816", "916",
"026", "126", "226", "326", "426",
"526", "626", "726", "826", "926",
"036", "136", "236", "336", "436",
"536", "636", "736", "836", "936",
"046", "146", "246", "346", "446",
"546", "646", "746", "846", "946",
"056", "156", "256", "356", "456",
"556", "656", "756", "856", "956",
"066", "166", "266", "366", "466",
"566", "666", "766", "866", "966",
"076", "176", "276", "376", "476",
"576", "676", "776", "876", "976",
"086", "186", "286", "386", "486",
"586", "686", "786", "886", "986",
"096", "196", "296", "396", "496",
"596", "696", "796", "896", "996",
"007", "107", "207", "307", "407",
"507", "607", "707", "807", "907",
"017", "117", "217", "317", "417",
"517", "617", "717", "817", "917",
"027", "127", "227", "327", "427",
"527", "627", "727", "827", "927",
"037", "137", "237", "337", "437",
"537", "637", "737", "837", "937",
"047", "147", "247", "347", "447",
"547", "647", "747", "847", "947",
"057", "157", "257", "357", "457",
"557", "657", "757", "857", "957",
"067", "167", "267", "367", "467",
"567", "667", "767", "867", "967",
"077", "177", "277", "377", "477",
"577", "677", "777", "877", "977",
"087", "187", "287", "387", "487",
"587", "687", "787", "887", "987",
"097", "197", "297", "397", "497",
"597", "697", "797", "897", "997",
"008", "108", "208", "308", "408",
"508", "608", "708", "808", "908",
"018", "118", "218", "318", "418",
"518", "618", "718", "818", "918",
"028", "128", "228", "328", "428",
"528", "628", "728", "828", "928",
"038", "138", "238", "338", "438",
"538", "638", "738", "838", "938",
"048", "148", "248", "348", "448",
"548", "648", "748", "848", "948",
"058", "158", "258", "358", "458",
"558", "658", "758", "858", "958",
"068", "168", "268", "368", "468",
"568", "668", "768", "868", "968",
"078", "178", "278", "378", "478",
"578", "678", "778", "878", "978",
"088", "188", "288", "388", "488",
"588", "688", "788", "888", "988",
"098", "198", "298", "398", "498",
"598", "698", "798", "898", "998",
"009", "109", "209", "309", "409",
"509", "609", "709", "809", "909",
"019", "119", "219", "319", "419",
"519", "619", "719", "819", "919",
"029", "129", "229", "329", "429",
"529", "629", "729", "829", "929",
"039", "139", "239", "339", "439",
"539", "639", "739", "839", "939",
"049", "149", "249", "349", "449",
"549", "649", "749", "849", "949",
"059", "159", "259", "359", "459",
"559", "659", "759", "859", "959",
"069", "169", "269", "369", "469",
"569", "669", "769", "869", "969",
"079", "179", "279", "379", "479",
"579", "679", "779", "879", "979",
"089", "189", "289", "389", "489",
"589", "689", "789", "889", "989",
"099", "199", "299", "399", "499",
"599", "699", "799", "899", "999"
};
/*
@ -274,328 +274,290 @@ NOTE: This function handles the following flags only:
int
rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args)
{
char ch;
int written = 0; /* bytes written so far */
int maxbytes = bytes - 1;
char ch;
int written = 0; /* bytes written so far */
int maxbytes = bytes - 1;
while((ch = *format++) && (written < maxbytes))
{
if(ch == '%')
{
/*
* Advance past the %
*/
ch = *format++;
while((ch = *format++) && (written < maxbytes)) {
if(ch == '%') {
/*
* Advance past the %
*/
ch = *format++;
/*
* Put the most common cases first - %s %d etc
*/
/*
* Put the most common cases first - %s %d etc
*/
if(ch == 's')
{
const char *str = va_arg(args, const char *);
if(ch == 's') {
const char *str = va_arg(args, const char *);
while((*dest = *str))
{
++dest;
++str;
while((*dest = *str)) {
++dest;
++str;
if(++written >= maxbytes)
break;
}
if(++written >= maxbytes)
break;
}
continue;
}
continue;
}
if(ch == 'd')
{
int num = va_arg(args, int);
int quotient;
const char *str;
char *digitptr = TempBuffer;
if(ch == 'd') {
int num = va_arg(args, int);
int quotient;
const char *str;
char *digitptr = TempBuffer;
/*
* We have to special-case "0" unfortunately
*/
if(num == 0)
{
*dest++ = '0';
++written;
continue;
}
/*
* We have to special-case "0" unfortunately
*/
if(num == 0) {
*dest++ = '0';
++written;
continue;
}
if(num < 0)
{
*dest++ = '-';
if(++written >= maxbytes)
continue;
if(num < 0) {
*dest++ = '-';
if(++written >= maxbytes)
continue;
num = -num;
}
num = -num;
}
do
{
quotient = num / TABLE_MAX;
do {
quotient = num / TABLE_MAX;
/*
* We'll start with the right-most digits of 'num'.
* Dividing by TABLE_MAX cuts off all but the X
* right-most digits, where X is such that:
*
* 10^X = TABLE_MAX
*
* For example, if num = 1200, and TABLE_MAX = 1000,
* quotient will be 1. Multiplying this by 1000 and
* subtracting from 1200 gives: 1200 - (1 * 1000) = 200.
* We then go right to slot 200 in our array and behold!
* The string "002" (200 backwards) is conveniently
* waiting for us. Then repeat the process with the
* digits left.
*
* The reason we need to have the integers written
* backwards, is because we don't know how many digits
* there are. If we want to express the number 12130
* for example, our first pass would leave us with 130,
* whose slot in the array yields "031", which we
* plug into our TempBuffer[]. The next pass gives us
* 12, whose slot yields "21" which we append to
* TempBuffer[], leaving us with "03121". This is the
* exact number we want, only backwards, so it is
* a simple matter to reverse the string. If we used
* straightfoward numbers, we would have a TempBuffer
* looking like this: "13012" which would be a nightmare
* to deal with.
*/
/*
* We'll start with the right-most digits of 'num'.
* Dividing by TABLE_MAX cuts off all but the X
* right-most digits, where X is such that:
*
* 10^X = TABLE_MAX
*
* For example, if num = 1200, and TABLE_MAX = 1000,
* quotient will be 1. Multiplying this by 1000 and
* subtracting from 1200 gives: 1200 - (1 * 1000) = 200.
* We then go right to slot 200 in our array and behold!
* The string "002" (200 backwards) is conveniently
* waiting for us. Then repeat the process with the
* digits left.
*
* The reason we need to have the integers written
* backwards, is because we don't know how many digits
* there are. If we want to express the number 12130
* for example, our first pass would leave us with 130,
* whose slot in the array yields "031", which we
* plug into our TempBuffer[]. The next pass gives us
* 12, whose slot yields "21" which we append to
* TempBuffer[], leaving us with "03121". This is the
* exact number we want, only backwards, so it is
* a simple matter to reverse the string. If we used
* straightfoward numbers, we would have a TempBuffer
* looking like this: "13012" which would be a nightmare
* to deal with.
*/
str = IntTable[num - (quotient * TABLE_MAX)];
str = IntTable[num - (quotient * TABLE_MAX)];
while((*digitptr = *str))
{
++digitptr;
++str;
}
}
while((num = quotient) != 0);
while((*digitptr = *str)) {
++digitptr;
++str;
}
} while((num = quotient) != 0);
/*
* If the last quotient was a 1 or 2 digit number, there
* will be one or more leading zeroes in TempBuffer[] -
* get rid of them.
*/
while(*(digitptr - 1) == '0')
--digitptr;
/*
* If the last quotient was a 1 or 2 digit number, there
* will be one or more leading zeroes in TempBuffer[] -
* get rid of them.
*/
while(*(digitptr - 1) == '0')
--digitptr;
while(digitptr != TempBuffer)
{
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
while(digitptr != TempBuffer) {
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
continue;
} /* if (ch == 'd') */
continue;
} /* if (ch == 'd') */
if(ch == 'c')
{
*dest++ = va_arg(args, int);
if(ch == 'c') {
*dest++ = va_arg(args, int);
++written;
++written;
continue;
} /* if (ch == 'c') */
continue;
} /* if (ch == 'c') */
if(ch == 'u')
{
unsigned int num = va_arg(args, unsigned int);
unsigned int quotient;
const char *str;
char *digitptr = TempBuffer;
if(ch == 'u') {
unsigned int num = va_arg(args, unsigned int);
unsigned int quotient;
const char *str;
char *digitptr = TempBuffer;
if(num == 0)
{
*dest++ = '0';
++written;
continue;
}
if(num == 0) {
*dest++ = '0';
++written;
continue;
}
do
{
quotient = num / TABLE_MAX;
do {
quotient = num / TABLE_MAX;
/*
* Very similar to case 'd'
*/
/*
* Very similar to case 'd'
*/
str = IntTable[num - (quotient * TABLE_MAX)];
str = IntTable[num - (quotient * TABLE_MAX)];
while((*digitptr = *str))
{
++digitptr;
++str;
}
}
while((num = quotient) != 0);
while((*digitptr = *str)) {
++digitptr;
++str;
}
} while((num = quotient) != 0);
while(*(digitptr - 1) == '0')
--digitptr;
while(*(digitptr - 1) == '0')
--digitptr;
while(digitptr != TempBuffer)
{
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
while(digitptr != TempBuffer) {
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
continue;
} /* if (ch == 'u') */
continue;
} /* if (ch == 'u') */
if(ch == 'Q')
{
const char *arg = va_arg(args, const char *);
if(ch == 'Q') {
const char *arg = va_arg(args, const char *);
if(arg == NULL)
continue;
if(arg == NULL)
continue;
const char *str = rsdb_quote(arg);
const char *str = rsdb_quote(arg);
while((*dest = *str))
{
++dest;
++str;
while((*dest = *str)) {
++dest;
++str;
if(++written >= maxbytes)
break;
}
if(++written >= maxbytes)
break;
}
continue;
}
continue;
}
if(ch == 'l')
{
if(*format == 'u')
{
unsigned long num = va_arg(args, unsigned long);
unsigned long quotient;
const char *str;
char *digitptr = TempBuffer;
if(ch == 'l') {
if(*format == 'u') {
unsigned long num = va_arg(args, unsigned long);
unsigned long quotient;
const char *str;
char *digitptr = TempBuffer;
++format;
++format;
if(num == 0)
{
*dest++ = '0';
++written;
continue;
}
if(num == 0) {
*dest++ = '0';
++written;
continue;
}
do
{
quotient = num / TABLE_MAX;
do {
quotient = num / TABLE_MAX;
/*
* Very similar to case 'u'
*/
/*
* Very similar to case 'u'
*/
str = IntTable[num - (quotient * TABLE_MAX)];
str = IntTable[num - (quotient * TABLE_MAX)];
while((*digitptr = *str))
{
++digitptr;
++str;
}
}
while((num = quotient) != 0);
while((*digitptr = *str)) {
++digitptr;
++str;
}
} while((num = quotient) != 0);
while(*(digitptr - 1) == '0')
--digitptr;
while(*(digitptr - 1) == '0')
--digitptr;
while(digitptr != TempBuffer)
{
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
while(digitptr != TempBuffer) {
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
continue;
}
else
/* if (*format == 'u') */ if(*format == 'd')
{
long num = va_arg(args, long);
long quotient;
const char *str;
char *digitptr = TempBuffer;
continue;
} else
/* if (*format == 'u') */ if(*format == 'd') {
long num = va_arg(args, long);
long quotient;
const char *str;
char *digitptr = TempBuffer;
++format;
++format;
if(num == 0)
{
*dest++ = '0';
++written;
continue;
}
if(num == 0) {
*dest++ = '0';
++written;
continue;
}
if(num < 0)
{
*dest++ = '-';
if(++written >= maxbytes)
continue;
if(num < 0) {
*dest++ = '-';
if(++written >= maxbytes)
continue;
num = -num;
}
num = -num;
}
do
{
quotient = num / TABLE_MAX;
do {
quotient = num / TABLE_MAX;
str = IntTable[num - (quotient * TABLE_MAX)];
str = IntTable[num - (quotient * TABLE_MAX)];
while((*digitptr = *str))
{
++digitptr;
++str;
}
}
while((num = quotient) != 0);
while((*digitptr = *str)) {
++digitptr;
++str;
}
} while((num = quotient) != 0);
while(*(digitptr - 1) == '0')
--digitptr;
while(*(digitptr - 1) == '0')
--digitptr;
while(digitptr != TempBuffer)
{
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
while(digitptr != TempBuffer) {
*dest++ = *--digitptr;
if(++written >= maxbytes)
break;
}
continue;
}
else /* if (*format == 'd') */
{
/* XXX error */
exit(1);
}
continue;
} else { /* if (*format == 'd') */
/* XXX error */
exit(1);
}
} /* if (ch == 'l') */
} /* if (ch == 'l') */
if(ch != '%')
{
/* XXX error */
exit(1);
} /* if (ch != '%') */
} /* if (ch == '%') */
if(ch != '%') {
/* XXX error */
exit(1);
} /* if (ch != '%') */
} /* if (ch == '%') */
*dest++ = ch;
++written;
} /* while ((ch = *format++) && (written < maxbytes)) */
*dest++ = ch;
++written;
} /* while ((ch = *format++) && (written < maxbytes)) */
/*
* Terminate the destination buffer with a \0
*/
*dest = '\0';
/*
* Terminate the destination buffer with a \0
*/
*dest = '\0';
return (written);
return (written);
} /* vSnprintf() */
/*
@ -614,14 +576,14 @@ Return: number of characters copied, NOT including the terminating
int
rs_snprintf(char *dest, const size_t bytes, const char *format, ...)
{
va_list args;
int count;
va_list args;
int count;
va_start(args, format);
va_start(args, format);
count = rs_vsnprintf(dest, bytes, format, args);
count = rs_vsnprintf(dest, bytes, format, args);
va_end(args);
va_end(args);
return (count);
return (count);
} /* Snprintf() */

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2003-2006 Lee Hardy <leeh@leeh.co.uk>
* Copyright (C) 2003-2006 ircd-ratbox development team
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@ -27,7 +27,7 @@
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
*/
#include "stdinc.h"
#include "rsdb.h"
@ -41,224 +41,206 @@ rsdb_error_cb *error_cb;
static void
mlog(const char *errstr, ...)
{
if(error_cb != NULL)
{
char buf[256];
va_list ap;
va_start(ap, errstr);
rb_vsnprintf(buf, sizeof(buf), errstr, ap);
va_end(ap);
error_cb(buf);
}
else
exit(1);
if(error_cb != NULL) {
char buf[256];
va_list ap;
va_start(ap, errstr);
rb_vsnprintf(buf, sizeof(buf), errstr, ap);
va_end(ap);
error_cb(buf);
} else
exit(1);
}
int
rsdb_init(rsdb_error_cb * ecb)
{
const char *bandb_dbpath_env;
char dbpath[PATH_MAX];
char errbuf[128];
error_cb = ecb;
const char *bandb_dbpath_env;
char dbpath[PATH_MAX];
char errbuf[128];
error_cb = ecb;
/* try a path from the environment first, useful for basedir overrides */
bandb_dbpath_env = getenv("BANDB_DBPATH");
/* try a path from the environment first, useful for basedir overrides */
bandb_dbpath_env = getenv("BANDB_DBPATH");
if(bandb_dbpath_env != NULL)
rb_strlcpy(dbpath, bandb_dbpath_env, sizeof(dbpath));
else
rb_strlcpy(dbpath, DBPATH, sizeof(dbpath));
if(bandb_dbpath_env != NULL)
rb_strlcpy(dbpath, bandb_dbpath_env, sizeof(dbpath));
else
rb_strlcpy(dbpath, DBPATH, sizeof(dbpath));
if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK)
{
rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s",
sqlite3_errmsg(rb_bandb));
mlog(errbuf);
return -1;
}
if(access(dbpath, W_OK))
{
rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database for write: %s", strerror(errno));
mlog(errbuf);
return -1;
}
return 0;
if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK) {
rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s",
sqlite3_errmsg(rb_bandb));
mlog(errbuf);
return -1;
}
if(access(dbpath, W_OK)) {
rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database for write: %s", strerror(errno));
mlog(errbuf);
return -1;
}
return 0;
}
void
rsdb_shutdown(void)
{
if(rb_bandb)
sqlite3_close(rb_bandb);
if(rb_bandb)
sqlite3_close(rb_bandb);
}
const char *
rsdb_quote(const char *src)
{
static char buf[BUFSIZE * 4];
char *p = buf;
static char buf[BUFSIZE * 4];
char *p = buf;
/* cheap and dirty length check.. */
if(strlen(src) >= (sizeof(buf) / 2))
return NULL;
/* cheap and dirty length check.. */
if(strlen(src) >= (sizeof(buf) / 2))
return NULL;
while(*src)
{
if(*src == '\'')
*p++ = '\'';
while(*src) {
if(*src == '\'')
*p++ = '\'';
*p++ = *src++;
}
*p++ = *src++;
}
*p = '\0';
return buf;
*p = '\0';
return buf;
}
static int
rsdb_callback_func(void *cbfunc, int argc, char **argv, char **colnames)
{
rsdb_callback cb = (rsdb_callback)((uintptr_t)cbfunc);
(cb) (argc, (const char **)argv);
return 0;
rsdb_callback cb = (rsdb_callback)((uintptr_t)cbfunc);
(cb) (argc, (const char **)argv);
return 0;
}
void
rsdb_exec(rsdb_callback cb, const char *format, ...)
{
static char buf[BUFSIZE * 4];
va_list args;
char *errmsg;
unsigned int i;
int j;
static char buf[BUFSIZE * 4];
va_list args;
char *errmsg;
unsigned int i;
int j;
va_start(args, format);
i = rs_vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
va_start(args, format);
i = rs_vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
if(i >= sizeof(buf))
{
mlog("fatal error: length problem with compiling sql");
}
if(i >= sizeof(buf)) {
mlog("fatal error: length problem with compiling sql");
}
if((i = sqlite3_exec(rb_bandb, buf, (cb ? rsdb_callback_func : NULL), (void *)((uintptr_t)cb), &errmsg)))
{
switch (i)
{
case SQLITE_BUSY:
for(j = 0; j < 5; j++)
{
rb_sleep(0, 500000);
if(!sqlite3_exec
(rb_bandb, buf, (cb ? rsdb_callback_func : NULL), (void *)((uintptr_t)cb), &errmsg))
return;
}
if((i = sqlite3_exec(rb_bandb, buf, (cb ? rsdb_callback_func : NULL), (void *)((uintptr_t)cb), &errmsg))) {
switch (i) {
case SQLITE_BUSY:
for(j = 0; j < 5; j++) {
rb_sleep(0, 500000);
if(!sqlite3_exec
(rb_bandb, buf, (cb ? rsdb_callback_func : NULL), (void *)((uintptr_t)cb), &errmsg))
return;
}
/* failed, fall through to default */
mlog("fatal error: problem with db file: %s", errmsg);
break;
/* failed, fall through to default */
mlog("fatal error: problem with db file: %s", errmsg);
break;
default:
mlog("fatal error: problem with db file: %s", errmsg);
break;
}
}
default:
mlog("fatal error: problem with db file: %s", errmsg);
break;
}
}
}
void
rsdb_exec_fetch(struct rsdb_table *table, const char *format, ...)
{
static char buf[BUFSIZE * 4];
va_list args;
char *errmsg;
char **data;
int pos;
unsigned int retval;
int i, j;
static char buf[BUFSIZE * 4];
va_list args;
char *errmsg;
char **data;
int pos;
unsigned int retval;
int i, j;
va_start(args, format);
retval = rs_vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
va_start(args, format);
retval = rs_vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
if(retval >= sizeof(buf))
{
mlog("fatal error: length problem with compiling sql");
}
if(retval >= sizeof(buf)) {
mlog("fatal error: length problem with compiling sql");
}
if((retval =
sqlite3_get_table(rb_bandb, buf, &data, &table->row_count, &table->col_count, &errmsg)))
{
int success = 0;
if((retval =
sqlite3_get_table(rb_bandb, buf, &data, &table->row_count, &table->col_count, &errmsg))) {
int success = 0;
switch (retval)
{
case SQLITE_BUSY:
for(i = 0; i < 5; i++)
{
rb_sleep(0, 500000);
if(!sqlite3_get_table
(rb_bandb, buf, &data, &table->row_count, &table->col_count,
&errmsg))
{
success++;
break;
}
}
switch (retval) {
case SQLITE_BUSY:
for(i = 0; i < 5; i++) {
rb_sleep(0, 500000);
if(!sqlite3_get_table
(rb_bandb, buf, &data, &table->row_count, &table->col_count,
&errmsg)) {
success++;
break;
}
}
if(success)
break;
if(success)
break;
mlog("fatal error: problem with db file: %s", errmsg);
break;
mlog("fatal error: problem with db file: %s", errmsg);
break;
default:
mlog("fatal error: problem with db file: %s", errmsg);
break;
}
}
default:
mlog("fatal error: problem with db file: %s", errmsg);
break;
}
}
/* we need to be able to free data afterward */
table->arg = data;
/* we need to be able to free data afterward */
table->arg = data;
if(table->row_count == 0)
{
table->row = NULL;
return;
}
if(table->row_count == 0) {
table->row = NULL;
return;
}
/* sqlite puts the column names as the first row */
pos = table->col_count;
table->row = rb_malloc(sizeof(char **) * table->row_count);
for(i = 0; i < table->row_count; i++)
{
table->row[i] = rb_malloc(sizeof(char *) * table->col_count);
/* sqlite puts the column names as the first row */
pos = table->col_count;
table->row = rb_malloc(sizeof(char **) * table->row_count);
for(i = 0; i < table->row_count; i++) {
table->row[i] = rb_malloc(sizeof(char *) * table->col_count);
for(j = 0; j < table->col_count; j++)
{
table->row[i][j] = data[pos++];
}
}
for(j = 0; j < table->col_count; j++) {
table->row[i][j] = data[pos++];
}
}
}
void
rsdb_exec_fetch_end(struct rsdb_table *table)
{
int i;
int i;
for(i = 0; i < table->row_count; i++)
{
rb_free(table->row[i]);
}
rb_free(table->row);
for(i = 0; i < table->row_count; i++) {
rb_free(table->row[i]);
}
rb_free(table->row);
sqlite3_free_table((char **)table->arg);
sqlite3_free_table((char **)table->arg);
}
void
rsdb_transaction(rsdb_transtype type)
{
if(type == RSDB_TRANS_START)
rsdb_exec(NULL, "BEGIN TRANSACTION");
else if(type == RSDB_TRANS_END)
rsdb_exec(NULL, "COMMIT TRANSACTION");
if(type == RSDB_TRANS_START)
rsdb_exec(NULL, "BEGIN TRANSACTION");
else if(type == RSDB_TRANS_END)
rsdb_exec(NULL, "COMMIT TRANSACTION");
}

View File

@ -13,8 +13,8 @@
static void h_can_join(hook_data_channel *);
mapi_hfn_list_av1 adminonly_hfnlist[] = {
{ "can_join", (hookfn) h_can_join },
{ NULL, NULL }
{ "can_join", (hookfn) h_can_join },
{ NULL, NULL }
};
static unsigned int mymode;
@ -22,17 +22,17 @@ static unsigned int mymode;
static int
_modinit(void)
{
mymode = cflag_add('A', chm_staff);
if (mymode == 0)
return -1;
mymode = cflag_add('A', chm_staff);
if (mymode == 0)
return -1;
return 0;
return 0;
}
static void
_moddeinit(void)
{
cflag_orphan('A');
cflag_orphan('A');
}
DECLARE_MODULE_AV1(chm_adminonly, _modinit, _moddeinit, NULL, NULL, adminonly_hfnlist, "$Revision$");
@ -40,12 +40,12 @@ DECLARE_MODULE_AV1(chm_adminonly, _modinit, _moddeinit, NULL, NULL, adminonly_hf
static void
h_can_join(hook_data_channel *data)
{
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;
if((chptr->mode.mode & mymode) && !IsAdmin(source_p)) {
sendto_one_numeric(source_p, 519, "%s :Cannot join channel (+A) - you are not an IRC server administrator", chptr->chname);
data->approved = ERR_CUSTOM;
}
if((chptr->mode.mode & mymode) && !IsAdmin(source_p)) {
sendto_one_numeric(source_p, 519, "%s :Cannot join channel (+A) - you are not an IRC server administrator", chptr->chname);
data->approved = ERR_CUSTOM;
}
}

View File

@ -13,8 +13,8 @@
static void h_can_join(hook_data_channel *);
mapi_hfn_list_av1 operonly_hfnlist[] = {
{ "can_join", (hookfn) h_can_join },
{ NULL, NULL }
{ "can_join", (hookfn) h_can_join },
{ NULL, NULL }
};
static unsigned int mymode;
@ -26,18 +26,18 @@ static unsigned int mymode;
static int
_modinit(void)
{
mymode = cflag_add('O', chm_staff);
if (mymode == 0)
return -1;
mymode = cflag_add('O', chm_staff);
if (mymode == 0)
return -1;
return 0;
return 0;
}
static void
_moddeinit(void)
{
cflag_orphan('O');
cflag_orphan('O');
}
DECLARE_MODULE_AV1(chm_operonly, _modinit, _moddeinit, NULL, NULL, operonly_hfnlist, "$Revision$");
@ -45,12 +45,12 @@ DECLARE_MODULE_AV1(chm_operonly, _modinit, _moddeinit, NULL, NULL, operonly_hfnl
static void
h_can_join(hook_data_channel *data)
{
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;
if((chptr->mode.mode & mymode) && !IsOper(source_p)) {
sendto_one_numeric(source_p, 520, "%s :Cannot join channel (+O) - you are not an IRC operator", chptr->chname);
data->approved = ERR_CUSTOM;
}
if((chptr->mode.mode & mymode) && !IsOper(source_p)) {
sendto_one_numeric(source_p, 520, "%s :Cannot join channel (+O) - you are not an IRC operator", chptr->chname);
data->approved = ERR_CUSTOM;
}
}

View File

@ -12,41 +12,41 @@
static int _modinit(void);
static void _moddeinit(void);
static void chm_operonly(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
DECLARE_MODULE_AV1(chm_operonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision$");
static int
_modinit(void)
{
chmode_table['O'].set_func = chm_operonly;
chmode_table['O'].mode_type = 0;
chmode_table['O'].set_func = chm_operonly;
chmode_table['O'].mode_type = 0;
return 0;
return 0;
}
static void
_moddeinit(void)
{
chmode_table['O'].set_func = chm_nosuch;
chmode_table['O'].mode_type = 0;
chmode_table['O'].set_func = chm_nosuch;
chmode_table['O'].mode_type = 0;
}
static void
chm_operonly(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type)
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type)
{
int newparn = 0;
const char *newparv[] = { "$o" };
int newparn = 0;
const char *newparv[] = { "$o" };
if (MyClient(source_p)) {
chm_simple(source_p, chptr, alevel, parc, parn, parv,
errors, dir, 'i', MODE_INVITEONLY);
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'I', CHFL_INVEX);
} else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
if (MyClient(source_p)) {
chm_simple(source_p, chptr, alevel, parc, parn, parv,
errors, dir, 'i', MODE_INVITEONLY);
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'I', CHFL_INVEX);
} else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
}

View File

@ -13,39 +13,39 @@
static int _modinit(void);
static void _moddeinit(void);
static void chm_quietunreg(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
DECLARE_MODULE_AV1(chm_quietunreg_compat, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision$");
static int
_modinit(void)
{
chmode_table['R'].set_func = chm_quietunreg;
chmode_table['R'].mode_type = 0;
chmode_table['R'].set_func = chm_quietunreg;
chmode_table['R'].mode_type = 0;
return 0;
return 0;
}
static void
_moddeinit(void)
{
chmode_table['R'].set_func = chm_nosuch;
chmode_table['R'].mode_type = 0;
chmode_table['R'].set_func = chm_nosuch;
chmode_table['R'].mode_type = 0;
}
static void
chm_quietunreg(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type)
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type)
{
int newparn = 0;
const char *newparv[] = { "$~a" };
int newparn = 0;
const char *newparv[] = { "$~a" };
if (MyClient(source_p))
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'q', CHFL_QUIET);
else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
if (MyClient(source_p))
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'q', CHFL_QUIET);
else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
}

View File

@ -13,8 +13,8 @@
static void h_can_join(hook_data_channel *);
mapi_hfn_list_av1 sslonly_hfnlist[] = {
{ "can_join", (hookfn) h_can_join },
{ NULL, NULL }
{ "can_join", (hookfn) h_can_join },
{ NULL, NULL }
};
static unsigned int mymode;
@ -22,18 +22,18 @@ static unsigned int mymode;
static int
_modinit(void)
{
mymode = cflag_add('S', chm_simple);
if (mymode == 0)
return -1;
mymode = cflag_add('S', chm_simple);
if (mymode == 0)
return -1;
return 0;
return 0;
}
static void
_moddeinit(void)
{
cflag_orphan('S');
cflag_orphan('S');
}
DECLARE_MODULE_AV1(chm_sslonly, _modinit, _moddeinit, NULL, NULL, sslonly_hfnlist, "$Revision$");
@ -41,12 +41,12 @@ DECLARE_MODULE_AV1(chm_sslonly, _modinit, _moddeinit, NULL, NULL, sslonly_hfnlis
static void
h_can_join(hook_data_channel *data)
{
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;
if((chptr->mode.mode & mymode) && !IsSSLClient(source_p)) {
sendto_one_notice(source_p, ":Only users using SSL can join this channel!");
data->approved = ERR_CUSTOM;
}
if((chptr->mode.mode & mymode) && !IsSSLClient(source_p)) {
sendto_one_notice(source_p, ":Only users using SSL can join this channel!");
data->approved = ERR_CUSTOM;
}
}

View File

@ -12,39 +12,39 @@
static int _modinit(void);
static void _moddeinit(void);
static void chm_sslonly(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
DECLARE_MODULE_AV1(chm_sslonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision$");
static int
_modinit(void)
{
chmode_table['S'].set_func = chm_sslonly;
chmode_table['S'].mode_type = 0;
chmode_table['S'].set_func = chm_sslonly;
chmode_table['S'].mode_type = 0;
return 0;
return 0;
}
static void
_moddeinit(void)
{
chmode_table['S'].set_func = chm_nosuch;
chmode_table['S'].mode_type = 0;
chmode_table['S'].set_func = chm_nosuch;
chmode_table['S'].mode_type = 0;
}
static void
chm_sslonly(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type)
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type)
{
int newparn = 0;
const char *newparv[] = { "$~z" };
int newparn = 0;
const char *newparv[] = { "$~z" };
if (MyClient(source_p))
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'b', CHFL_BAN);
else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
if (MyClient(source_p))
chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
errors, dir, 'b', CHFL_BAN);
else
chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
errors, dir, c, mode_type);
}

View File

@ -20,8 +20,8 @@
static void h_can_create_channel_authenticated(hook_data_client_approval *);
mapi_hfn_list_av1 restrict_hfnlist[] = {
{ "can_create_channel", (hookfn) h_can_create_channel_authenticated },
{ NULL, NULL }
{ "can_create_channel", (hookfn) h_can_create_channel_authenticated },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(createauthonly, NULL, NULL, NULL, NULL, restrict_hfnlist, "$Revision: 833 $");
@ -29,8 +29,8 @@ DECLARE_MODULE_AV1(createauthonly, NULL, NULL, NULL, NULL, restrict_hfnlist, "$R
static void
h_can_create_channel_authenticated(hook_data_client_approval *data)
{
struct Client *source_p = data->client;
struct Client *source_p = data->client;
if (*source_p->user->suser == '\0' && !IsOper(source_p))
data->approved = ERR_NEEDREGGEDNICK;
if (*source_p->user->suser == '\0' && !IsOper(source_p))
data->approved = ERR_NEEDREGGEDNICK;
}

View File

@ -20,8 +20,8 @@
static void h_can_create_channel_authenticated(hook_data_client_approval *);
mapi_hfn_list_av1 restrict_hfnlist[] = {
{ "can_create_channel", (hookfn) h_can_create_channel_authenticated },
{ NULL, NULL }
{ "can_create_channel", (hookfn) h_can_create_channel_authenticated },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(createoperonly, NULL, NULL, NULL, NULL, restrict_hfnlist, "$Revision: 3476 $");
@ -29,11 +29,10 @@ DECLARE_MODULE_AV1(createoperonly, NULL, NULL, NULL, NULL, restrict_hfnlist, "$R
static void
h_can_create_channel_authenticated(hook_data_client_approval *data)
{
struct Client *source_p = data->client;
struct Client *source_p = data->client;
if (!IsOper(source_p))
{
sendto_one_notice(source_p, ":*** Channel creation is restricted to network staff only.");
data->approved = ERR_NEEDREGGEDNICK;
}
if (!IsOper(source_p)) {
sendto_one_notice(source_p, ":*** Channel creation is restricted to network staff only.");
data->approved = ERR_NEEDREGGEDNICK;
}
}

View File

@ -47,25 +47,25 @@ static int moper_test(struct Client *client_p, struct Client *source_p, int parc
*/
struct Message test_msgtab = {
"TEST", /* the /COMMAND you want */
0, /* SET TO ZERO -- number of times command used by clients */
0, /* SET TO ZERO -- number of times command used by clients */
0, /* SET TO ZERO -- number of times command used by clients */
MFLG_SLOW, /* ALWAYS SET TO MFLG_SLOW */
"TEST", /* the /COMMAND you want */
0, /* SET TO ZERO -- number of times command used by clients */
0, /* SET TO ZERO -- number of times command used by clients */
0, /* SET TO ZERO -- number of times command used by clients */
MFLG_SLOW, /* ALWAYS SET TO MFLG_SLOW */
/* the functions to call for each handler. If not using the generic
* handlers, the first param is the function to call, the second is the
* required number of parameters. NOTE: If you specify a min para of 2,
* then parv[1] must *also* be non-empty.
*/
{
{munreg_test, 0}, /* function call for unregistered clients, 0 parms required */
{mclient_test, 0}, /* function call for local clients, 0 parms required */
{mrclient_test, 0}, /* function call for remote clients, 0 parms required */
{mserver_test, 0}, /* function call for servers, 0 parms required */
mg_ignore, /* function call for ENCAP, unused in this test */
{moper_test, 0} /* function call for operators, 0 parms required */
}
/* the functions to call for each handler. If not using the generic
* handlers, the first param is the function to call, the second is the
* required number of parameters. NOTE: If you specify a min para of 2,
* then parv[1] must *also* be non-empty.
*/
{
{munreg_test, 0}, /* function call for unregistered clients, 0 parms required */
{mclient_test, 0}, /* function call for local clients, 0 parms required */
{mrclient_test, 0}, /* function call for remote clients, 0 parms required */
{mserver_test, 0}, /* function call for servers, 0 parms required */
mg_ignore, /* function call for ENCAP, unused in this test */
{moper_test, 0} /* function call for operators, 0 parms required */
}
};
/*
* There are also some macros for the above function calls and parameter counts.
@ -93,9 +93,9 @@ mapi_clist_av1 test_clist[] = { &test_msgtab, NULL };
* terminated with NULLs.
*/
int doing_example_hook;
mapi_hlist_av1 test_hlist[] = {
{ "doing_example_hook", &doing_example_hook, },
{ NULL, NULL }
mapi_hlist_av1 test_hlist[] = {
{ "doing_example_hook", &doing_example_hook, },
{ NULL, NULL }
};
/* The mapi_hfn_list_av1 declares the hook functions which other modules can
@ -106,44 +106,44 @@ mapi_hlist_av1 test_hlist[] = {
static void show_example_hook(void *unused);
mapi_hfn_list_av1 test_hfnlist[] = {
{ "doing_example_hook", (hookfn) show_example_hook },
{ NULL, NULL }
{ "doing_example_hook", (hookfn) show_example_hook },
{ NULL, NULL }
};
/* Here we tell it what to do when the module is loaded */
static int
modinit(void)
{
/* Nothing to do for the example module. */
/* The init function should return -1 on failure,
which will cause the module to be unloaded,
otherwise 0 to indicate success. */
return 0;
/* Nothing to do for the example module. */
/* The init function should return -1 on failure,
which will cause the module to be unloaded,
otherwise 0 to indicate success. */
return 0;
}
/* here we tell it what to do when the module is unloaded */
static void
moddeinit(void)
{
/* Again, nothing to do. */
/* Again, nothing to do. */
}
/* DECLARE_MODULE_AV1() actually declare the MAPI header. */
DECLARE_MODULE_AV1(
/* The first argument is the name */
example,
/* The second argument is the function to call on load */
modinit,
/* And the function to call on unload */
moddeinit,
/* Then the MAPI command list */
test_clist,
/* Next the hook list, if we have one. */
test_hlist,
/* Then the hook function list, if we have one */
test_hfnlist,
/* And finally the version number of this module. */
"$Revision: 3161 $");
/* The first argument is the name */
example,
/* The second argument is the function to call on load */
modinit,
/* And the function to call on unload */
moddeinit,
/* Then the MAPI command list */
test_clist,
/* Next the hook list, if we have one. */
test_hlist,
/* Then the hook function list, if we have one */
test_hfnlist,
/* And finally the version number of this module. */
"$Revision: 3161 $");
/* Any of the above arguments can be NULL to indicate they aren't used. */
@ -159,19 +159,16 @@ DECLARE_MODULE_AV1(
static int
munreg_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
{
sendto_one_notice(source_p, ":You are unregistered and sent no parameters");
}
else
{
sendto_one_notice(source_p, ":You are unregistered and sent parameter: %s", parv[1]);
}
if(parc < 2) {
sendto_one_notice(source_p, ":You are unregistered and sent no parameters");
} else {
sendto_one_notice(source_p, ":You are unregistered and sent parameter: %s", parv[1]);
}
/* illustration of how to call a hook function */
call_hook(doing_example_hook, NULL);
/* illustration of how to call a hook function */
call_hook(doing_example_hook, NULL);
return 0;
return 0;
}
/*
@ -181,19 +178,16 @@ munreg_test(struct Client *client_p, struct Client *source_p, int parc, const ch
static int
mclient_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
{
sendto_one_notice(source_p, ":You are a normal user, and sent no parameters");
}
else
{
sendto_one_notice(source_p, ":You are a normal user, and send parameters: %s", parv[1]);
}
if(parc < 2) {
sendto_one_notice(source_p, ":You are a normal user, and sent no parameters");
} else {
sendto_one_notice(source_p, ":You are a normal user, and send parameters: %s", parv[1]);
}
/* illustration of how to call a hook function */
call_hook(doing_example_hook, NULL);
/* illustration of how to call a hook function */
call_hook(doing_example_hook, NULL);
return 0;
return 0;
}
/*
@ -203,15 +197,12 @@ mclient_test(struct Client *client_p, struct Client *source_p, int parc, const c
static int
mrclient_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
{
sendto_one_notice(source_p, ":You are a remote client, and sent no parameters");
}
else
{
sendto_one_notice(source_p, ":You are a remote client, and sent parameters: %s", parv[1]);
}
return 0;
if(parc < 2) {
sendto_one_notice(source_p, ":You are a remote client, and sent no parameters");
} else {
sendto_one_notice(source_p, ":You are a remote client, and sent parameters: %s", parv[1]);
}
return 0;
}
/*
@ -221,15 +212,12 @@ mrclient_test(struct Client *client_p, struct Client *source_p, int parc, const
static int
mserver_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
{
sendto_one_notice(source_p, ":You are a server, and sent no parameters");
}
else
{
sendto_one_notice(source_p, ":You are a server, and sent parameters: %s", parv[1]);
}
return 0;
if(parc < 2) {
sendto_one_notice(source_p, ":You are a server, and sent no parameters");
} else {
sendto_one_notice(source_p, ":You are a server, and sent parameters: %s", parv[1]);
}
return 0;
}
/*
@ -239,21 +227,18 @@ mserver_test(struct Client *client_p, struct Client *source_p, int parc, const c
static int
moper_test(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
{
sendto_one_notice(source_p, ":You are an operator, and sent no parameters");
}
else
{
sendto_one_notice(source_p, ":You are an operator, and sent parameters: %s", parv[1]);
}
return 0;
if(parc < 2) {
sendto_one_notice(source_p, ":You are an operator, and sent no parameters");
} else {
sendto_one_notice(source_p, ":You are an operator, and sent parameters: %s", parv[1]);
}
return 0;
}
static void
show_example_hook(void *unused)
{
sendto_realops_snomask(SNO_GENERAL, L_ALL, "Called example hook!");
sendto_realops_snomask(SNO_GENERAL, L_ALL, "Called example hook!");
}
/* END OF EXAMPLE MODULE */

View File

@ -18,25 +18,25 @@ DECLARE_MODULE_AV1(extb_account, _modinit, _moddeinit, NULL, NULL, NULL, "$Revis
static int
_modinit(void)
{
extban_table['a'] = eb_account;
extban_table['a'] = eb_account;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['a'] = NULL;
extban_table['a'] = NULL;
}
static int eb_account(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
(void)chptr;
/* $a alone matches any logged in user */
if (data == NULL)
return EmptyString(client_p->user->suser) ? EXTBAN_NOMATCH : EXTBAN_MATCH;
/* $a:MASK matches users logged in under matching account */
return match(data, client_p->user->suser) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
(void)chptr;
/* $a alone matches any logged in user */
if (data == NULL)
return EmptyString(client_p->user->suser) ? EXTBAN_NOMATCH : EXTBAN_MATCH;
/* $a:MASK matches users logged in under matching account */
return match(data, client_p->user->suser) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}

View File

@ -21,46 +21,46 @@ DECLARE_MODULE_AV1(extb_canjoin, _modinit, _moddeinit, NULL, NULL, NULL, "$Revis
static int
_modinit(void)
{
extban_table['j'] = eb_canjoin;
extban_table['j'] = eb_canjoin;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['j'] = NULL;
extban_table['j'] = NULL;
}
static int eb_canjoin(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
struct Channel *chptr2;
int ret;
static int recurse = 0;
struct Channel *chptr2;
int ret;
static int recurse = 0;
(void)mode_type;
/* don't process a $j in a $j'ed list */
if (recurse)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
chptr2 = find_channel(data);
/* must exist, and no point doing this with the same channel */
if (chptr2 == NULL || chptr2 == chptr)
return EXTBAN_INVALID;
/* require consistent target */
if (chptr->chname[0] == '#' && data[0] == '&')
return EXTBAN_INVALID;
/* this allows getting some information about ban exceptions
* but +s/+p doesn't seem the right criterion */
(void)mode_type;
/* don't process a $j in a $j'ed list */
if (recurse)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
chptr2 = find_channel(data);
/* must exist, and no point doing this with the same channel */
if (chptr2 == NULL || chptr2 == chptr)
return EXTBAN_INVALID;
/* require consistent target */
if (chptr->chname[0] == '#' && data[0] == '&')
return EXTBAN_INVALID;
/* this allows getting some information about ban exceptions
* but +s/+p doesn't seem the right criterion */
#if 0
/* privacy! don't allow +s/+p channels to influence another channel */
if (!PubChannel(chptr2))
return EXTBAN_INVALID;
/* privacy! don't allow +s/+p channels to influence another channel */
if (!PubChannel(chptr2))
return EXTBAN_INVALID;
#endif
recurse = 1;
ret = is_banned(chptr2, client_p, NULL, NULL, NULL) == CHFL_BAN ? EXTBAN_MATCH : EXTBAN_NOMATCH;
recurse = 0;
return ret;
recurse = 1;
ret = is_banned(chptr2, client_p, NULL, NULL, NULL) == CHFL_BAN ? EXTBAN_MATCH : EXTBAN_NOMATCH;
recurse = 0;
return ret;
}

View File

@ -20,34 +20,34 @@ DECLARE_MODULE_AV1(extb_channel, _modinit, _moddeinit, NULL, NULL, NULL, "$Revis
static int
_modinit(void)
{
extban_table['c'] = eb_channel;
extban_table['c'] = eb_channel;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['c'] = NULL;
extban_table['c'] = NULL;
}
static int eb_channel(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
struct Channel *chptr2;
struct Channel *chptr2;
(void)chptr;
(void)mode_type;
if (data == NULL)
return EXTBAN_INVALID;
chptr2 = find_channel(data);
if (chptr2 == NULL)
return EXTBAN_INVALID;
/* require consistent target */
if (chptr->chname[0] == '#' && data[0] == '&')
return EXTBAN_INVALID;
/* privacy! don't allow +s/+p channels to influence another channel */
if (!PubChannel(chptr2))
return EXTBAN_INVALID;
return IsMember(client_p, chptr2) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
(void)chptr;
(void)mode_type;
if (data == NULL)
return EXTBAN_INVALID;
chptr2 = find_channel(data);
if (chptr2 == NULL)
return EXTBAN_INVALID;
/* require consistent target */
if (chptr->chname[0] == '#' && data[0] == '&')
return EXTBAN_INVALID;
/* privacy! don't allow +s/+p channels to influence another channel */
if (!PubChannel(chptr2))
return EXTBAN_INVALID;
return IsMember(client_p, chptr2) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}

View File

@ -19,40 +19,39 @@ DECLARE_MODULE_AV1(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, "$Revi
static int
_modinit(void)
{
extban_table['x'] = eb_extended;
extban_table['x'] = eb_extended;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['x'] = NULL;
extban_table['x'] = NULL;
}
static int eb_extended(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
char buf[BUFSIZE];
int ret;
char buf[BUFSIZE];
int ret;
(void)chptr;
(void)chptr;
if (data == NULL)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
client_p->name, client_p->username, client_p->host, client_p->info);
rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
client_p->name, client_p->username, client_p->host, client_p->info);
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
if (ret == EXTBAN_NOMATCH && IsDynSpoof(client_p))
{
rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
client_p->name, client_p->username, client_p->orighost, client_p->info);
if (ret == EXTBAN_NOMATCH && IsDynSpoof(client_p)) {
rb_snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
client_p->name, client_p->username, client_p->orighost, client_p->info);
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}
ret = match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}
return ret;
return ret;
}

View File

@ -18,26 +18,26 @@ DECLARE_MODULE_AV1(extb_oper, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision
static int
_modinit(void)
{
extban_table['o'] = eb_oper;
extban_table['o'] = eb_oper;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['o'] = NULL;
extban_table['o'] = NULL;
}
static int eb_oper(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
(void)chptr;
(void)mode_type;
/* perhaps use data somehow? (opernick/flags?) */
/* so deny any bans with data for now */
if (data != NULL)
return EXTBAN_INVALID;
return IsOper(client_p) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
(void)chptr;
(void)mode_type;
/* perhaps use data somehow? (opernick/flags?) */
/* so deny any bans with data for now */
if (data != NULL)
return EXTBAN_INVALID;
return IsOper(client_p) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}

View File

@ -18,26 +18,26 @@ DECLARE_MODULE_AV1(extb_realname, _modinit, _moddeinit, NULL, NULL, NULL, "$Revi
static int
_modinit(void)
{
extban_table['r'] = eb_realname;
extban_table['r'] = eb_realname;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['r'] = NULL;
extban_table['r'] = NULL;
}
static int eb_realname(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
(void)chptr;
/* This type is not safe for exceptions */
if (mode_type == CHFL_EXCEPTION || mode_type == CHFL_INVEX)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
return match(data, client_p->info) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
(void)chptr;
/* This type is not safe for exceptions */
if (mode_type == CHFL_EXCEPTION || mode_type == CHFL_INVEX)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
return match(data, client_p->info) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}

View File

@ -18,26 +18,26 @@ DECLARE_MODULE_AV1(extb_server, _modinit, _moddeinit, NULL, NULL, NULL, "$Revisi
static int
_modinit(void)
{
extban_table['s'] = eb_server;
extban_table['s'] = eb_server;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['s'] = NULL;
extban_table['s'] = NULL;
}
static int eb_server(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
(void)chptr;
/* This type is not safe for exceptions */
if (mode_type == CHFL_EXCEPTION || mode_type == CHFL_INVEX)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
return match(data, me.name) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
(void)chptr;
/* This type is not safe for exceptions */
if (mode_type == CHFL_EXCEPTION || mode_type == CHFL_INVEX)
return EXTBAN_INVALID;
if (data == NULL)
return EXTBAN_INVALID;
return match(data, me.name) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}

View File

@ -14,24 +14,24 @@ DECLARE_MODULE_AV1(extb_ssl, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision$
static int
_modinit(void)
{
extban_table['z'] = eb_ssl;
extban_table['z'] = eb_ssl;
return 0;
return 0;
}
static void
_moddeinit(void)
{
extban_table['z'] = NULL;
extban_table['z'] = NULL;
}
static int eb_ssl(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type)
struct Channel *chptr, long mode_type)
{
(void)chptr;
(void)mode_type;
if (data != NULL)
return EXTBAN_INVALID;
return IsSSLClient(client_p) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
(void)chptr;
(void)mode_type;
if (data != NULL)
return EXTBAN_INVALID;
return IsSSLClient(client_p) ? EXTBAN_MATCH : EXTBAN_NOMATCH;
}

View File

@ -18,8 +18,8 @@
static void h_noi_umode_changed(hook_data_umode_changed *);
mapi_hfn_list_av1 noi_hfnlist[] = {
{ "umode_changed", (hookfn) h_noi_umode_changed },
{ NULL, NULL }
{ "umode_changed", (hookfn) h_noi_umode_changed },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(force_user_invis, NULL, NULL, NULL, NULL, noi_hfnlist, "1.0.0");
@ -27,9 +27,9 @@ DECLARE_MODULE_AV1(force_user_invis, NULL, NULL, NULL, NULL, noi_hfnlist, "1.0.0
static void
h_noi_umode_changed(hook_data_umode_changed *hdata)
{
struct Client *source_p = hdata->client;
struct Client *source_p = hdata->client;
if (MyClient(source_p) && !IsOper(source_p) && !IsInvisible(source_p)) {
SetInvisible(source_p);
}
if (MyClient(source_p) && !IsOper(source_p) && !IsInvisible(source_p)) {
SetInvisible(source_p);
}
}

View File

@ -23,25 +23,25 @@
#define HURT_EXIT_REASON "Hurt: Failed to identify to services"
enum {
HEAL_NICK = 0,
HEAL_IP
HEAL_NICK = 0,
HEAL_IP
};
typedef struct _hurt_state {
time_t start_time;
uint32_t n_hurts;
rb_dlink_list hurt_clients;
uint16_t cutoff;
time_t default_expire;
const char *exit_reason;
time_t start_time;
uint32_t n_hurts;
rb_dlink_list hurt_clients;
uint16_t cutoff;
time_t default_expire;
const char *exit_reason;
} hurt_state_t;
typedef struct _hurt {
char *ip;
struct sockaddr *saddr;
int saddr_bits;
char *reason;
time_t expire;
char *ip;
struct sockaddr *saddr;
int saddr_bits;
char *reason;
time_t expire;
} hurt_t;
/* }}} */
@ -82,45 +82,45 @@ rb_dlink_list hurt_confs = { NULL, NULL, 0 };
/* {{{ Messages */
struct Message hurt_msgtab = {
"HURT", 0, 0, 0, MFLG_SLOW, {
mg_ignore, mg_ignore, mg_ignore,
mg_ignore, {me_hurt, 0}, {mo_hurt, 3}
}
"HURT", 0, 0, 0, MFLG_SLOW, {
mg_ignore, mg_ignore, mg_ignore,
mg_ignore, {me_hurt, 0}, {mo_hurt, 3}
}
};
struct Message heal_msgtab = {
"HEAL", 0, 0, 0, MFLG_SLOW, {
mg_ignore, mg_ignore, mg_ignore,
mg_ignore, {me_heal, 0}, {mo_heal, 2}
}
"HEAL", 0, 0, 0, MFLG_SLOW, {
mg_ignore, mg_ignore, mg_ignore,
mg_ignore, {me_heal, 0}, {mo_heal, 2}
}
};
/* }}} */
/* {{{ Misc module stuff */
mapi_hfn_list_av1 hurt_hfnlist[] = {
{"client_exit", (hookfn) client_exit_hook},
{"new_local_user", (hookfn) new_local_user_hook},
{"doing_stats", (hookfn) doing_stats_hook},
{NULL, NULL},
{"client_exit", (hookfn) client_exit_hook},
{"new_local_user", (hookfn) new_local_user_hook},
{"doing_stats", (hookfn) doing_stats_hook},
{NULL, NULL},
};
mapi_clist_av1 hurt_clist[] = { &hurt_msgtab, &heal_msgtab, NULL };
DECLARE_MODULE_AV1(
hurt,
modinit,
modfini,
hurt_clist,
NULL,
hurt_hfnlist,
"$Revision: 3161 $"
hurt,
modinit,
modfini,
hurt_clist,
NULL,
hurt_hfnlist,
"$Revision: 3161 $"
);
/* }}} */
hurt_state_t hurt_state = {
.cutoff = HURT_CUTOFF,
.default_expire = HURT_DEFAULT_EXPIRE,
.exit_reason = HURT_EXIT_REASON,
.cutoff = HURT_CUTOFF,
.default_expire = HURT_DEFAULT_EXPIRE,
.exit_reason = HURT_EXIT_REASON,
};
/*
@ -135,14 +135,14 @@ struct ev_entry *hurt_check_ev = NULL;
static int
modinit(void)
{
/* set-up hurt_state. */
hurt_state.start_time = rb_current_time();
/* set-up hurt_state. */
hurt_state.start_time = rb_current_time();
/* add our event handlers. */
hurt_expire_ev = rb_event_add("hurt_expire", hurt_expire_event, NULL, 60);
hurt_check_ev = rb_event_add("hurt_check", hurt_check_event, NULL, 5);
/* add our event handlers. */
hurt_expire_ev = rb_event_add("hurt_expire", hurt_expire_event, NULL, 60);
hurt_check_ev = rb_event_add("hurt_check", hurt_check_event, NULL, 5);
return 0;
return 0;
}
/* }}} */
@ -150,16 +150,15 @@ modinit(void)
static void
modfini(void)
{
rb_dlink_node *ptr, *next_ptr;
rb_dlink_node *ptr, *next_ptr;
/* and delete our events. */
rb_event_delete(hurt_expire_ev);
rb_event_delete(hurt_check_ev);
/* and delete our events. */
rb_event_delete(hurt_expire_ev);
rb_event_delete(hurt_check_ev);
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head)
{
rb_dlinkDestroy(ptr, &hurt_state.hurt_clients);
}
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head) {
rb_dlinkDestroy(ptr, &hurt_state.hurt_clients);
}
}
/* }}} */
@ -170,84 +169,79 @@ modfini(void)
/* {{{ static int mo_hurt()
*
* HURT [<expire>] <ip> <reason>
*
*
* parv[1] - expire or ip
* parv[2] - ip or reason
* parv[3] - reason or NULL
*/
static int
mo_hurt(struct Client *client_p, struct Client *source_p,
int parc, const char **parv)
int parc, const char **parv)
{
const char *ip, *expire, *reason;
int expire_time;
hurt_t *hurt;
struct Client *target_p;
const char *ip, *expire, *reason;
int expire_time;
hurt_t *hurt;
struct Client *target_p;
if (!IsOperK(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
source_p->name, "kline");
return 0;
}
if (!IsOperK(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
source_p->name, "kline");
return 0;
}
if (parc == 3)
expire = NULL, ip = parv[1], reason = parv[2];
else
expire = parv[1], ip = parv[2], reason = parv[3];
if (parc == 3)
expire = NULL, ip = parv[1], reason = parv[2];
else
expire = parv[1], ip = parv[2], reason = parv[3];
if (!expire)
expire_time = HURT_DEFAULT_EXPIRE;
if (expire && (expire_time = valid_temp_time(expire)) < 1) {
sendto_one_notice(source_p, ":Permanent HURTs are not supported");
return 0;
}
if (EmptyString(reason)) {
sendto_one_notice(source_p, ":Empty HURT reasons are bad for business");
return 0;
}
if (!expire)
expire_time = HURT_DEFAULT_EXPIRE;
if (expire && (expire_time = valid_temp_time(expire)) < 1) {
sendto_one_notice(source_p, ":Permanent HURTs are not supported");
return 0;
}
if (EmptyString(reason)) {
sendto_one_notice(source_p, ":Empty HURT reasons are bad for business");
return 0;
}
/* Is this a client? */
if (strchr(ip, '.') == NULL && strchr(ip, ':') == NULL)
{
target_p = find_named_person(ip);
if (target_p == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), ip);
return 0;
}
ip = target_p->orighost;
}
else
{
if (!strncmp(ip, "*@", 2))
ip += 2;
if (strchr(ip, '!') || strchr(ip, '@'))
{
sendto_one_notice(source_p, ":Invalid HURT mask [%s]",
ip);
return 0;
}
}
/* Is this a client? */
if (strchr(ip, '.') == NULL && strchr(ip, ':') == NULL) {
target_p = find_named_person(ip);
if (target_p == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), ip);
return 0;
}
ip = target_p->orighost;
} else {
if (!strncmp(ip, "*@", 2))
ip += 2;
if (strchr(ip, '!') || strchr(ip, '@')) {
sendto_one_notice(source_p, ":Invalid HURT mask [%s]",
ip);
return 0;
}
}
if (hurt_find(ip) != NULL) {
sendto_one(source_p, ":[%s] already HURT", ip);
return 0;
}
if (hurt_find(ip) != NULL) {
sendto_one(source_p, ":[%s] already HURT", ip);
return 0;
}
/*
* okay, we've got this far, now it's time to add the the HURT locally
* and propagate it to other servers on the network.
*/
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added HURT on [%s] for %ld minutes with reason [%s]",
get_oper_name(source_p), ip, (long) expire_time / 60, reason);
/*
* okay, we've got this far, now it's time to add the the HURT locally
* and propagate it to other servers on the network.
*/
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added HURT on [%s] for %ld minutes with reason [%s]",
get_oper_name(source_p), ip, (long) expire_time / 60, reason);
hurt = hurt_new(expire_time, ip, reason);
hurt_add(hurt);
hurt_propagate(NULL, source_p, hurt);
hurt = hurt_new(expire_time, ip, reason);
hurt_add(hurt);
hurt_propagate(NULL, source_p, hurt);
return 0;
return 0;
}
/* }}} */
@ -261,32 +255,32 @@ mo_hurt(struct Client *client_p, struct Client *source_p,
*/
static int
me_hurt(struct Client *client_p, struct Client *source_p,
int parc, const char **parv)
int parc, const char **parv)
{
time_t expire_time;
hurt_t *hurt;
time_t expire_time;
hurt_t *hurt;
/*
* right... if we don't get enough arguments, or if we get any invalid
* arguments, just ignore this request - shit happens, and it's not worth
* dropping a server over.
*/
if (parc < 4 || !IsPerson(source_p))
return 0;
if ((expire_time = atoi(parv[1])) < 1)
return 0;
if (hurt_find(parv[2]) != NULL)
return 0;
if (EmptyString(parv[3]))
return 0;
/*
* right... if we don't get enough arguments, or if we get any invalid
* arguments, just ignore this request - shit happens, and it's not worth
* dropping a server over.
*/
if (parc < 4 || !IsPerson(source_p))
return 0;
if ((expire_time = atoi(parv[1])) < 1)
return 0;
if (hurt_find(parv[2]) != NULL)
return 0;
if (EmptyString(parv[3]))
return 0;
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added HURT on [%s] for %ld minutes with reason [%s]",
get_oper_name(source_p), parv[2], (long) expire_time / 60, parv[3]);
hurt = hurt_new(expire_time, parv[2], parv[3]);
hurt_add(hurt);
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added HURT on [%s] for %ld minutes with reason [%s]",
get_oper_name(source_p), parv[2], (long) expire_time / 60, parv[3]);
hurt = hurt_new(expire_time, parv[2], parv[3]);
hurt_add(hurt);
return 0;
return 0;
}
/* }}} */
@ -298,88 +292,76 @@ me_hurt(struct Client *client_p, struct Client *source_p,
*/
static int
mo_heal(struct Client *client_p, struct Client *source_p,
int parc, const char **parv)
int parc, const char **parv)
{
struct Client *target_p;
struct Client *target_p;
if (!IsOperUnkline(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "unkline");
return 0;
}
if (!IsOperUnkline(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "unkline");
return 0;
}
if (nick_is_valid(parv[1]))
{
target_p = find_named_person(parv[1]);
if (target_p == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
}
if (MyConnect(target_p))
heal_nick(source_p, target_p);
else
sendto_one(target_p, ":%s ENCAP %s HEAL %s",
get_id(source_p, target_p),
target_p->servptr->name,
get_id(target_p, target_p));
}
else if (strchr(parv[1], '.'))
{
if (hurt_find_exact(parv[1]) == NULL)
{
sendto_one_notice(source_p, ":Mask [%s] is not HURT", parv[1]);
return 0;
}
hurt_remove(parv[1]);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s",
get_oper_name(source_p), parv[1]);
sendto_server(NULL, NULL, NOCAPS, NOCAPS, ":%s ENCAP * HEAL %s",
source_p->name, parv[1]);
}
else
{
sendto_one(source_p, ":[%s] is not a valid IP address/nick", parv[1]);
return 0;
}
if (nick_is_valid(parv[1])) {
target_p = find_named_person(parv[1]);
if (target_p == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
}
if (MyConnect(target_p))
heal_nick(source_p, target_p);
else
sendto_one(target_p, ":%s ENCAP %s HEAL %s",
get_id(source_p, target_p),
target_p->servptr->name,
get_id(target_p, target_p));
} else if (strchr(parv[1], '.')) {
if (hurt_find_exact(parv[1]) == NULL) {
sendto_one_notice(source_p, ":Mask [%s] is not HURT", parv[1]);
return 0;
}
hurt_remove(parv[1]);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s",
get_oper_name(source_p), parv[1]);
sendto_server(NULL, NULL, NOCAPS, NOCAPS, ":%s ENCAP * HEAL %s",
source_p->name, parv[1]);
} else {
sendto_one(source_p, ":[%s] is not a valid IP address/nick", parv[1]);
return 0;
}
return 0;
return 0;
}
/* }}} */
static int
me_heal(struct Client *client_p, struct Client *source_p,
int parc, const char **parv)
int parc, const char **parv)
{
struct Client *target_p;
struct Client *target_p;
/* as noted in me_hurt(), if we don't get sufficient arguments...
* *poof*, it's dropped...
*/
if (parc < 2)
return 0;
/* as noted in me_hurt(), if we don't get sufficient arguments...
* *poof*, it's dropped...
*/
if (parc < 2)
return 0;
if (nick_is_valid(parv[1]))
{
target_p = find_person(parv[1]);
if (target_p != NULL && MyConnect(target_p))
heal_nick(source_p, target_p);
}
else if (strchr(parv[1], '.')) /* host or mask to remove ban for */
{
if (hurt_find_exact(parv[1]) == NULL)
return 0;
if (nick_is_valid(parv[1])) {
target_p = find_person(parv[1]);
if (target_p != NULL && MyConnect(target_p))
heal_nick(source_p, target_p);
} else if (strchr(parv[1], '.')) { /* host or mask to remove ban for */
if (hurt_find_exact(parv[1]) == NULL)
return 0;
hurt_remove(parv[1]);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s",
get_oper_name(source_p), parv[1]);
}
else
return 0;
hurt_remove(parv[1]);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s",
get_oper_name(source_p), parv[1]);
} else
return 0;
return 0;
return 0;
}
/*
@ -390,20 +372,18 @@ me_heal(struct Client *client_p, struct Client *source_p,
static void
hurt_check_event(void *arg)
{
rb_dlink_node *ptr, *next_ptr;
struct Client *client_p;
rb_dlink_node *ptr, *next_ptr;
struct Client *client_p;
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head) {
client_p = ptr->data;
if (!EmptyString(client_p->user->suser))
{
rb_dlinkDestroy(ptr, &hurt_state.hurt_clients);
sendto_one_notice(client_p, ":HURT restriction removed for this session");
client_p->localClient->target_last = rb_current_time(); /* don't ask --nenolod */
}
else if (client_p->localClient->receiveM > hurt_state.cutoff)
exit_client(NULL, client_p, &me, hurt_state.exit_reason);
}
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head) {
client_p = ptr->data;
if (!EmptyString(client_p->user->suser)) {
rb_dlinkDestroy(ptr, &hurt_state.hurt_clients);
sendto_one_notice(client_p, ":HURT restriction removed for this session");
client_p->localClient->target_last = rb_current_time(); /* don't ask --nenolod */
} else if (client_p->localClient->receiveM > hurt_state.cutoff)
exit_client(NULL, client_p, &me, hurt_state.exit_reason);
}
}
/* }}} */
@ -411,19 +391,17 @@ hurt_check_event(void *arg)
static void
hurt_expire_event(void *unused)
{
rb_dlink_node *ptr, *next_ptr;
hurt_t *hurt;
rb_dlink_node *ptr, *next_ptr;
hurt_t *hurt;
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_confs.head)
{
hurt = (hurt_t *) ptr->data;
RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_confs.head) {
hurt = (hurt_t *) ptr->data;
if (hurt->expire <= rb_current_time())
{
rb_dlinkFindDestroy(hurt, &hurt_confs);
hurt_destroy(hurt);
}
}
if (hurt->expire <= rb_current_time()) {
rb_dlinkFindDestroy(hurt, &hurt_confs);
hurt_destroy(hurt);
}
}
}
/* }}} */
@ -435,10 +413,10 @@ hurt_expire_event(void *unused)
static void
client_exit_hook(hook_data_client_exit *data)
{
s_assert(data != NULL);
s_assert(data->target != NULL);
s_assert(data != NULL);
s_assert(data->target != NULL);
rb_dlinkFindDestroy(data->target, &hurt_state.hurt_clients);
rb_dlinkFindDestroy(data->target, &hurt_state.hurt_clients);
}
/* }}} */
@ -446,17 +424,16 @@ client_exit_hook(hook_data_client_exit *data)
static void
new_local_user_hook(struct Client *source_p)
{
if (IsAnyDead(source_p) || !EmptyString(source_p->user->suser) ||
IsExemptKline(source_p))
return;
if (IsAnyDead(source_p) || !EmptyString(source_p->user->suser) ||
IsExemptKline(source_p))
return;
if (hurt_find(source_p->sockhost) || hurt_find(source_p->orighost))
{
source_p->localClient->target_last = rb_current_time() + 600; /* don't ask --nenolod */
SetTGChange(source_p);
rb_dlinkAddAlloc(source_p, &hurt_state.hurt_clients);
sendto_one_notice(source_p, ":You are hurt. Please identify to services immediately, or use /stats p for assistance.");
}
if (hurt_find(source_p->sockhost) || hurt_find(source_p->orighost)) {
source_p->localClient->target_last = rb_current_time() + 600; /* don't ask --nenolod */
SetTGChange(source_p);
rb_dlinkAddAlloc(source_p, &hurt_state.hurt_clients);
sendto_one_notice(source_p, ":You are hurt. Please identify to services immediately, or use /stats p for assistance.");
}
}
/* }}} */
@ -464,47 +441,43 @@ new_local_user_hook(struct Client *source_p)
static void
doing_stats_hook(hook_data_int *hdata)
{
rb_dlink_node *ptr;
hurt_t *hurt;
struct Client *source_p;
rb_dlink_node *ptr;
hurt_t *hurt;
struct Client *source_p;
s_assert(hdata);
s_assert(hdata->client);
s_assert(hdata);
s_assert(hdata->client);
source_p = hdata->client;
if(hdata->arg2 != (int) 's')
return;
if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOper(source_p))
return;
if ((ConfigFileEntry.stats_k_oper_only == 1) && !IsOper(source_p))
{
hurt = hurt_find(source_p->sockhost);
if (hurt != NULL)
{
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
return;
}
source_p = hdata->client;
if(hdata->arg2 != (int) 's')
return;
if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOper(source_p))
return;
if ((ConfigFileEntry.stats_k_oper_only == 1) && !IsOper(source_p)) {
hurt = hurt_find(source_p->sockhost);
if (hurt != NULL) {
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
return;
}
hurt = hurt_find(source_p->orighost);
if (hurt != NULL)
{
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
return;
}
return;
}
hurt = hurt_find(source_p->orighost);
if (hurt != NULL) {
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
return;
}
return;
}
RB_DLINK_FOREACH(ptr, hurt_confs.head)
{
hurt = (hurt_t *) ptr->data;
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
}
RB_DLINK_FOREACH(ptr, hurt_confs.head) {
hurt = (hurt_t *) ptr->data;
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
}
}
/* }}} */
@ -518,18 +491,18 @@ doing_stats_hook(hook_data_int *hdata)
static void
hurt_propagate(struct Client *client_p, struct Client *source_p, hurt_t *hurt)
{
if (client_p)
sendto_one(client_p,
":%s ENCAP %s HURT %ld %s :%s",
source_p->name, client_p->name,
(long)(hurt->expire - rb_current_time()),
hurt->ip, hurt->reason);
else
sendto_server(&me, NULL, NOCAPS, NOCAPS,
":%s ENCAP * HURT %ld %s :%s",
source_p->name,
(long)(hurt->expire - rb_current_time()),
hurt->ip, hurt->reason);
if (client_p)
sendto_one(client_p,
":%s ENCAP %s HURT %ld %s :%s",
source_p->name, client_p->name,
(long)(hurt->expire - rb_current_time()),
hurt->ip, hurt->reason);
else
sendto_server(&me, NULL, NOCAPS, NOCAPS,
":%s ENCAP * HURT %ld %s :%s",
source_p->name,
(long)(hurt->expire - rb_current_time()),
hurt->ip, hurt->reason);
}
/* }}} */
@ -537,15 +510,15 @@ hurt_propagate(struct Client *client_p, struct Client *source_p, hurt_t *hurt)
static hurt_t *
hurt_new(time_t expire, const char *ip, const char *reason)
{
hurt_t *hurt;
hurt_t *hurt;
hurt = rb_malloc(sizeof(hurt_t));
hurt = rb_malloc(sizeof(hurt_t));
hurt->ip = rb_strdup(ip);
hurt->reason = rb_strdup(reason);
hurt->expire = rb_current_time() + expire;
hurt->ip = rb_strdup(ip);
hurt->reason = rb_strdup(reason);
hurt->expire = rb_current_time() + expire;
return hurt;
return hurt;
}
/* }}} */
@ -553,85 +526,80 @@ hurt_new(time_t expire, const char *ip, const char *reason)
static void
hurt_destroy(void *hurt)
{
hurt_t *h;
hurt_t *h;
if (!hurt)
return;
if (!hurt)
return;
h = (hurt_t *) hurt;
rb_free(h->ip);
rb_free(h->reason);
rb_free(h);
h = (hurt_t *) hurt;
rb_free(h->ip);
rb_free(h->reason);
rb_free(h);
}
/* }}} */
static void
hurt_add(hurt_t *hurt)
{
rb_dlinkAddAlloc(hurt, &hurt_confs);
rb_dlinkAddAlloc(hurt, &hurt_confs);
}
static hurt_t *
hurt_find_exact(const char *ip)
{
rb_dlink_node *ptr;
hurt_t *hurt;
rb_dlink_node *ptr;
hurt_t *hurt;
RB_DLINK_FOREACH(ptr, hurt_confs.head)
{
hurt = (hurt_t *) ptr->data;
RB_DLINK_FOREACH(ptr, hurt_confs.head) {
hurt = (hurt_t *) ptr->data;
if (!strcasecmp(ip, hurt->ip))
return hurt;
}
if (!strcasecmp(ip, hurt->ip))
return hurt;
}
return NULL;
return NULL;
}
static hurt_t *
hurt_find(const char *ip)
{
rb_dlink_node *ptr;
hurt_t *hurt;
rb_dlink_node *ptr;
hurt_t *hurt;
RB_DLINK_FOREACH(ptr, hurt_confs.head)
{
hurt = (hurt_t *) ptr->data;
RB_DLINK_FOREACH(ptr, hurt_confs.head) {
hurt = (hurt_t *) ptr->data;
if (match(hurt->ip, ip))
return hurt;
}
if (match(hurt->ip, ip))
return hurt;
}
return NULL;
return NULL;
}
static void
hurt_remove(const char *ip)
{
hurt_t *hurt = hurt_find_exact(ip);
hurt_t *hurt = hurt_find_exact(ip);
rb_dlinkFindDestroy(hurt, &hurt_confs);
hurt_destroy(hurt);
rb_dlinkFindDestroy(hurt, &hurt_confs);
hurt_destroy(hurt);
}
/* {{{ static int heal_nick() */
static int
heal_nick(struct Client *source_p, struct Client *target_p)
{
if (rb_dlinkFindDestroy(target_p, &hurt_state.hurt_clients))
{
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s used HEAL on %s",
get_oper_name(source_p), get_client_name(target_p, HIDE_IP));
sendto_one_notice(target_p, ":HURT restriction temporarily removed by operator");
sendto_one_notice(source_p, ":HURT restriction on %s temporarily removed", target_p->name);
target_p->localClient->target_last = rb_current_time(); /* don't ask --nenolod */
return 1;
}
else
{
sendto_one_notice(source_p, ":%s was not hurt", target_p->name);
return 0;
}
if (rb_dlinkFindDestroy(target_p, &hurt_state.hurt_clients)) {
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s used HEAL on %s",
get_oper_name(source_p), get_client_name(target_p, HIDE_IP));
sendto_one_notice(target_p, ":HURT restriction temporarily removed by operator");
sendto_one_notice(source_p, ":HURT restriction on %s temporarily removed", target_p->name);
target_p->localClient->target_last = rb_current_time(); /* don't ask --nenolod */
return 1;
} else {
sendto_one_notice(source_p, ":%s was not hurt", target_p->name);
return 0;
}
}
/* }}} */
@ -643,14 +611,14 @@ heal_nick(struct Client *source_p, struct Client *target_p)
static int
nick_is_valid(const char *nick)
{
const char *s = nick;
const char *s = nick;
for (; *s != '\0'; s++) {
if (!IsNickChar(*s))
return 0;
}
for (; *s != '\0'; s++) {
if (!IsNickChar(*s))
return 0;
}
return 1;
return 1;
}
/* }}} */

View File

@ -1,4 +1,4 @@
/*
/*
* Charybdis: an advanced ircd
* ip_cloaking.c: provide user hostname cloaking
*
@ -25,145 +25,136 @@ char *secretsalt = "32qwnqoWI@DpMd&w";
static void
conf_set_secretsalt(void *data)
{
secretsalt = rb_strdup(data);
secretsalt = rb_strdup(data);
}
static int
_modinit(void)
{
/* add the usermode to the available slot */
user_modes['x'] = find_umode_slot();
construct_umodebuf();
/* add the usermode to the available slot */
user_modes['x'] = find_umode_slot();
construct_umodebuf();
add_top_conf("cloaking", NULL, NULL, NULL);
add_conf_item("cloaking", "secretsalt", CF_QSTRING, conf_set_secretsalt);
add_top_conf("cloaking", NULL, NULL, NULL);
add_conf_item("cloaking", "secretsalt", CF_QSTRING, conf_set_secretsalt);
return 0;
return 0;
}
static void
_moddeinit(void)
{
/* disable the umode and remove it from the available list */
user_modes['x'] = 0;
construct_umodebuf();
/* disable the umode and remove it from the available list */
user_modes['x'] = 0;
construct_umodebuf();
add_top_conf("cloaking", NULL, NULL, NULL);
add_conf_item("cloaking", "secretsalt", CF_QSTRING, conf_set_secretsalt);
add_top_conf("cloaking", NULL, NULL, NULL);
add_conf_item("cloaking", "secretsalt", CF_QSTRING, conf_set_secretsalt);
}
static void check_umode_change(void *data);
static void check_new_user(void *data);
mapi_hfn_list_av1 ip_cloaking_hfnlist[] = {
{ "umode_changed", (hookfn) check_umode_change },
{ "new_local_user", (hookfn) check_new_user },
{ NULL, NULL }
{ "umode_changed", (hookfn) check_umode_change },
{ "new_local_user", (hookfn) check_new_user },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3526 $");
ip_cloaking_hfnlist, "$Revision: 3526 $");
static void
distribute_hostchange(struct Client *client_p, char *newhost)
{
if (newhost != client_p->orighost)
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
newhost);
else
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
newhost);
if (newhost != client_p->orighost)
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
newhost);
else
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
newhost);
sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else
ClearDynSpoof(client_p);
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else
ClearDynSpoof(client_p);
}
static void
do_host_cloak(const char *inbuf, char *outbuf)
{
unsigned char *hash;
char buf[3];
char output[HOSTLEN+1];
int i;
unsigned char *hash;
char buf[3];
char output[HOSTLEN+1];
int i;
hash = HMAC(EVP_sha256(), secretsalt, strlen(secretsalt), (unsigned char*)inbuf, strlen(inbuf), NULL, NULL);
hash = HMAC(EVP_sha256(), secretsalt, strlen(secretsalt), (unsigned char*)inbuf, strlen(inbuf), NULL, NULL);
output[0]=0;
output[0]=0;
for (i = 0; i < 32; i++) {
sprintf(buf, "%.2x", hash[i]);
strcat(output,buf);
}
for (i = 0; i < 32; i++) {
sprintf(buf, "%.2x", hash[i]);
strcat(output,buf);
}
rb_strlcpy(outbuf,output,HOSTLEN+1);
rb_strlcpy(outbuf,output,HOSTLEN+1);
}
static void
check_umode_change(void *vdata)
{
hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
struct Client *source_p = data->client;
hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
struct Client *source_p = data->client;
if (!MyClient(source_p))
return;
if (!MyClient(source_p))
return;
/* didn't change +h umode, we don't need to do anything */
if (!((data->oldumodes ^ source_p->umodes) & user_modes['x']))
return;
/* didn't change +h umode, we don't need to do anything */
if (!((data->oldumodes ^ source_p->umodes) & user_modes['x']))
return;
if (source_p->umodes & user_modes['h'])
{
if (IsIPSpoof(source_p) || source_p->localClient->mangledhost == NULL || (IsDynSpoof(source_p) && strcmp(source_p->host, source_p->localClient->mangledhost)))
{
source_p->umodes &= ~user_modes['x'];
return;
}
if (strcmp(source_p->host, source_p->localClient->mangledhost))
{
distribute_hostchange(source_p, source_p->localClient->mangledhost);
}
else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
source_p->host);
}
else if (!(source_p->umodes & user_modes['x']))
{
if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost))
{
distribute_hostchange(source_p, source_p->orighost);
}
}
if (source_p->umodes & user_modes['h']) {
if (IsIPSpoof(source_p) || source_p->localClient->mangledhost == NULL || (IsDynSpoof(source_p) && strcmp(source_p->host, source_p->localClient->mangledhost))) {
source_p->umodes &= ~user_modes['x'];
return;
}
if (strcmp(source_p->host, source_p->localClient->mangledhost)) {
distribute_hostchange(source_p, source_p->localClient->mangledhost);
} else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
source_p->host);
} else if (!(source_p->umodes & user_modes['x'])) {
if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost)) {
distribute_hostchange(source_p, source_p->orighost);
}
}
}
static void
check_new_user(void *vdata)
{
struct Client *source_p = (void *)vdata;
struct Client *source_p = (void *)vdata;
if (IsIPSpoof(source_p))
{
source_p->umodes &= ~user_modes['x'];
return;
}
source_p->localClient->mangledhost = rb_malloc(HOSTLEN + 1);
do_host_cloak(source_p->orighost, source_p->localClient->mangledhost);
if (IsDynSpoof(source_p))
source_p->umodes &= ~user_modes['x'];
if (source_p->umodes & user_modes['x'])
{
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
}
if (IsIPSpoof(source_p)) {
source_p->umodes &= ~user_modes['x'];
return;
}
source_p->localClient->mangledhost = rb_malloc(HOSTLEN + 1);
do_host_cloak(source_p->orighost, source_p->localClient->mangledhost);
if (IsDynSpoof(source_p))
source_p->umodes &= ~user_modes['x'];
if (source_p->umodes & user_modes['x']) {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
}
}

View File

@ -1,4 +1,4 @@
/*
/*
* Charybdis: an advanced ircd
* ip_cloaking.c: provide user hostname cloaking
*
@ -20,206 +20,191 @@
static int
_modinit(void)
{
/* add the usermode to the available slot */
user_modes['x'] = find_umode_slot();
construct_umodebuf();
/* add the usermode to the available slot */
user_modes['x'] = find_umode_slot();
construct_umodebuf();
return 0;
return 0;
}
static void
_moddeinit(void)
{
/* disable the umode and remove it from the available list */
user_modes['x'] = 0;
construct_umodebuf();
/* disable the umode and remove it from the available list */
user_modes['x'] = 0;
construct_umodebuf();
}
static void check_umode_change(void *data);
static void check_new_user(void *data);
mapi_hfn_list_av1 ip_cloaking_hfnlist[] = {
{ "umode_changed", (hookfn) check_umode_change },
{ "new_local_user", (hookfn) check_new_user },
{ NULL, NULL }
{ "umode_changed", (hookfn) check_umode_change },
{ "new_local_user", (hookfn) check_new_user },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(ip_cloaking, _modinit, _moddeinit, NULL, NULL,
ip_cloaking_hfnlist, "$Revision: 3526 $");
ip_cloaking_hfnlist, "$Revision: 3526 $");
static void
distribute_hostchange(struct Client *client_p, char *newhost)
{
if (newhost != client_p->orighost)
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
newhost);
else
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
newhost);
if (newhost != client_p->orighost)
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
newhost);
else
sendto_one_numeric(client_p, RPL_HOSTHIDDEN, "%s :hostname reset",
newhost);
sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
sendto_server(NULL, NULL,
CAP_EUID | CAP_TS6, NOCAPS, ":%s CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
sendto_server(NULL, NULL,
CAP_TS6, CAP_EUID, ":%s ENCAP * CHGHOST %s :%s",
use_id(&me), use_id(client_p), newhost);
change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
change_nick_user_host(client_p, client_p->name, client_p->username, newhost, 0, "Changing host");
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else
ClearDynSpoof(client_p);
if (newhost != client_p->orighost)
SetDynSpoof(client_p);
else
ClearDynSpoof(client_p);
}
static void
do_host_cloak_ip(const char *inbuf, char *outbuf)
{
/* None of the characters in this table can be valid in an IP */
char chartable[] = "ghijklmnopqrstuvwxyz";
char *tptr;
uint32_t accum = fnv_hash((const unsigned char*) inbuf, 32);
int sepcount = 0;
int totalcount = 0;
int ipv6 = 0;
/* None of the characters in this table can be valid in an IP */
char chartable[] = "ghijklmnopqrstuvwxyz";
char *tptr;
uint32_t accum = fnv_hash((const unsigned char*) inbuf, 32);
int sepcount = 0;
int totalcount = 0;
int ipv6 = 0;
rb_strlcpy(outbuf, inbuf, HOSTLEN + 1);
rb_strlcpy(outbuf, inbuf, HOSTLEN + 1);
if (strchr(outbuf, ':'))
{
ipv6 = 1;
if (strchr(outbuf, ':')) {
ipv6 = 1;
/* Damn you IPv6...
* We count the number of colons so we can calculate how much
* of the host to cloak. This is because some hostmasks may not
* have as many octets as we'd like.
*
* We have to do this ahead of time because doing this during
* the actual cloaking would get ugly
*/
for (tptr = outbuf; *tptr != '\0'; tptr++)
if (*tptr == ':')
totalcount++;
}
else if (!strchr(outbuf, '.'))
return;
/* Damn you IPv6...
* We count the number of colons so we can calculate how much
* of the host to cloak. This is because some hostmasks may not
* have as many octets as we'd like.
*
* We have to do this ahead of time because doing this during
* the actual cloaking would get ugly
*/
for (tptr = outbuf; *tptr != '\0'; tptr++)
if (*tptr == ':')
totalcount++;
} else if (!strchr(outbuf, '.'))
return;
for (tptr = outbuf; *tptr != '\0'; tptr++)
{
if (*tptr == ':' || *tptr == '.')
{
sepcount++;
continue;
}
for (tptr = outbuf; *tptr != '\0'; tptr++) {
if (*tptr == ':' || *tptr == '.') {
sepcount++;
continue;
}
if (ipv6 && sepcount < totalcount / 2)
continue;
if (ipv6 && sepcount < totalcount / 2)
continue;
if (!ipv6 && sepcount < 2)
continue;
if (!ipv6 && sepcount < 2)
continue;
*tptr = chartable[(*tptr + accum) % 20];
accum = (accum << 1) | (accum >> 31);
}
*tptr = chartable[(*tptr + accum) % 20];
accum = (accum << 1) | (accum >> 31);
}
}
static void
do_host_cloak_host(const char *inbuf, char *outbuf)
{
char b26_alphabet[] = "abcdefghijklmnopqrstuvwxyz";
char *tptr;
uint32_t accum = fnv_hash((const unsigned char*) inbuf, 32);
char b26_alphabet[] = "abcdefghijklmnopqrstuvwxyz";
char *tptr;
uint32_t accum = fnv_hash((const unsigned char*) inbuf, 32);
rb_strlcpy(outbuf, inbuf, HOSTLEN + 1);
rb_strlcpy(outbuf, inbuf, HOSTLEN + 1);
/* pass 1: scramble first section of hostname using base26
* alphabet toasted against the FNV hash of the string.
*
* numbers are not changed at this time, only letters.
*/
for (tptr = outbuf; *tptr != '\0'; tptr++)
{
if (*tptr == '.')
break;
/* pass 1: scramble first section of hostname using base26
* alphabet toasted against the FNV hash of the string.
*
* numbers are not changed at this time, only letters.
*/
for (tptr = outbuf; *tptr != '\0'; tptr++) {
if (*tptr == '.')
break;
if (isdigit(*tptr) || *tptr == '-')
continue;
if (isdigit(*tptr) || *tptr == '-')
continue;
*tptr = b26_alphabet[(*tptr + accum) % 26];
*tptr = b26_alphabet[(*tptr + accum) % 26];
/* Rotate one bit to avoid all digits being turned odd or even */
accum = (accum << 1) | (accum >> 31);
}
/* Rotate one bit to avoid all digits being turned odd or even */
accum = (accum << 1) | (accum >> 31);
}
/* pass 2: scramble each number in the address */
for (tptr = outbuf; *tptr != '\0'; tptr++)
{
if (isdigit(*tptr))
*tptr = '0' + (*tptr + accum) % 10;
/* pass 2: scramble each number in the address */
for (tptr = outbuf; *tptr != '\0'; tptr++) {
if (isdigit(*tptr))
*tptr = '0' + (*tptr + accum) % 10;
accum = (accum << 1) | (accum >> 31);
}
accum = (accum << 1) | (accum >> 31);
}
}
static void
check_umode_change(void *vdata)
{
hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
struct Client *source_p = data->client;
hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
struct Client *source_p = data->client;
if (!MyClient(source_p))
return;
if (!MyClient(source_p))
return;
/* didn't change +h umode, we don't need to do anything */
if (!((data->oldumodes ^ source_p->umodes) & user_modes['x']))
return;
/* didn't change +h umode, we don't need to do anything */
if (!((data->oldumodes ^ source_p->umodes) & user_modes['x']))
return;
if (source_p->umodes & user_modes['x'])
{
if (IsIPSpoof(source_p) || source_p->localClient->mangledhost == NULL || (IsDynSpoof(source_p) && strcmp(source_p->host, source_p->localClient->mangledhost)))
{
source_p->umodes &= ~user_modes['x'];
return;
}
if (strcmp(source_p->host, source_p->localClient->mangledhost))
{
distribute_hostchange(source_p, source_p->localClient->mangledhost);
}
else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
source_p->host);
}
else if (!(source_p->umodes & user_modes['x']))
{
if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost))
{
distribute_hostchange(source_p, source_p->orighost);
}
}
if (source_p->umodes & user_modes['x']) {
if (IsIPSpoof(source_p) || source_p->localClient->mangledhost == NULL || (IsDynSpoof(source_p) && strcmp(source_p->host, source_p->localClient->mangledhost))) {
source_p->umodes &= ~user_modes['x'];
return;
}
if (strcmp(source_p->host, source_p->localClient->mangledhost)) {
distribute_hostchange(source_p, source_p->localClient->mangledhost);
} else /* not really nice, but we need to send this numeric here */
sendto_one_numeric(source_p, RPL_HOSTHIDDEN, "%s :is now your hidden host",
source_p->host);
} else if (!(source_p->umodes & user_modes['x'])) {
if (source_p->localClient->mangledhost != NULL &&
!strcmp(source_p->host, source_p->localClient->mangledhost)) {
distribute_hostchange(source_p, source_p->orighost);
}
}
}
static void
check_new_user(void *vdata)
{
struct Client *source_p = (void *)vdata;
struct Client *source_p = (void *)vdata;
if (IsIPSpoof(source_p))
{
source_p->umodes &= ~user_modes['x'];
return;
}
source_p->localClient->mangledhost = rb_malloc(HOSTLEN + 1);
if (!irccmp(source_p->orighost, source_p->sockhost))
do_host_cloak_ip(source_p->orighost, source_p->localClient->mangledhost);
else
do_host_cloak_host(source_p->orighost, source_p->localClient->mangledhost);
if (IsDynSpoof(source_p))
source_p->umodes &= ~user_modes['x'];
if (source_p->umodes & user_modes['x'])
{
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
}
if (IsIPSpoof(source_p)) {
source_p->umodes &= ~user_modes['x'];
return;
}
source_p->localClient->mangledhost = rb_malloc(HOSTLEN + 1);
if (!irccmp(source_p->orighost, source_p->sockhost))
do_host_cloak_ip(source_p->orighost, source_p->localClient->mangledhost);
else
do_host_cloak_host(source_p->orighost, source_p->localClient->mangledhost);
if (IsDynSpoof(source_p))
source_p->umodes &= ~user_modes['x'];
if (source_p->umodes & user_modes['x']) {
rb_strlcpy(source_p->host, source_p->localClient->mangledhost, sizeof(source_p->host));
if (irccmp(source_p->host, source_p->orighost))
SetDynSpoof(source_p);
}
}

View File

@ -1,7 +1,7 @@
/*
* Copyright (C) infinity-infinity God <God@Heaven>
*
* Bob was here
* Bob was here
*/
#include "stdinc.h"
@ -13,9 +13,10 @@
static int mclient_42(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message hgtg_msgtab = {
"42", 0, 0, 0, MFLG_SLOW,
{ mg_ignore, {mclient_42, 0}, mg_ignore, mg_ignore, mg_ignore, {mclient_42, 0}
}
"42", 0, 0, 0, MFLG_SLOW,
{
mg_ignore, {mclient_42, 0}, mg_ignore, mg_ignore, mg_ignore, {mclient_42, 0}
}
};
mapi_clist_av1 hgtg_clist[] = { &hgtg_msgtab, NULL };
@ -27,8 +28,8 @@ DECLARE_MODULE_AV1(42, NULL, NULL, hgtg_clist, NULL, NULL, "Revision 0.42");
static int
mclient_42(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
sendto_one_notice(source_p, ":The Answer to Life, the Universe, and Everything.");
return 0;
sendto_one_notice(source_p, ":The Answer to Life, the Universe, and Everything.");
return 0;
}

View File

@ -41,10 +41,10 @@ static int mo_adminwall(struct Client *, struct Client *, int, const char **);
static int me_adminwall(struct Client *, struct Client *, int, const char **);
struct Message adminwall_msgtab = {
"ADMINWALL", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_adminwall, 2}, {mo_adminwall, 2}}
"ADMINWALL", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_adminwall, 2}, {mo_adminwall, 2}}
};
mapi_clist_av1 adminwall_clist[] = { &adminwall_msgtab, NULL };
DECLARE_MODULE_AV1(adminwall, NULL, NULL, adminwall_clist, NULL, NULL, "$Revision: 20702 $");
@ -56,22 +56,21 @@ DECLARE_MODULE_AV1(adminwall, NULL, NULL, adminwall_clist, NULL, NULL, "$Revisio
*/
static int
mo_adminwall(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(!IsAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "adminwall");
return 0;
}
sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]);
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ADMINWALL :%s", parv[1]);
mo_adminwall(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(!IsAdmin(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "adminwall");
return 0;
}
}
sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]);
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ADMINWALL :%s", parv[1]);
return 0;
}
static int
me_adminwall(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]);
return 0;
me_adminwall(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]);
return 0;
}

View File

@ -25,8 +25,8 @@ extern struct module **modlist;
static int m_cycle(struct Client *, struct Client *, int, const char **);
struct Message cycle_msgtab = {
"CYCLE", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_cycle, 2}, {m_cycle, 2}, mg_ignore, mg_ignore, {m_cycle, 2}}
"CYCLE", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_cycle, 2}, {m_cycle, 2}, mg_ignore, mg_ignore, {m_cycle, 2}}
};
mapi_clist_av1 cycle_clist[] = { &cycle_msgtab, NULL };
@ -35,64 +35,58 @@ DECLARE_MODULE_AV1(cycle, NULL, NULL, cycle_clist, NULL, NULL, "$Revision$");
static int
m_cycle(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
char *p, *name;
char *s = LOCAL_COPY(parv[1]);
struct Channel *chptr;
struct membership *msptr;
char *p, *name;
char *s = LOCAL_COPY(parv[1]);
struct Channel *chptr;
struct membership *msptr;
name = rb_strtok_r(s, ",", &p);
name = rb_strtok_r(s, ",", &p);
/* Finish the flood grace period... */
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
/* Finish the flood grace period... */
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
while(name)
{
if((chptr = find_channel(name)) == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return 0;
}
while(name) {
if((chptr = find_channel(name)) == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return 0;
}
msptr = find_channel_membership(chptr, source_p);
if(msptr == NULL)
{
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name);
return 0;
}
msptr = find_channel_membership(chptr, source_p);
if(msptr == NULL) {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name);
return 0;
}
if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
check_spambot_warning(source_p, NULL);
if((is_any_op(msptr) || !MyConnect(source_p) ||
((can_send(chptr, source_p, msptr) > 0 &&
(source_p->localClient->firsttime +
ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time()))))
{
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s :Cycling", use_id(source_p), chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :Cycling",
source_p->name, source_p->username,
source_p->host, chptr->chname);
}
else
{
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s", use_id(source_p), chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
source_p->name, source_p->username,
source_p->host, chptr->chname);
}
remove_user_from_channel(msptr);
chptr = NULL;
msptr = NULL;
name = rb_strtok_r(NULL, ",", &p);
}
user_join(client_p, source_p, parv[1], parc > 2 ? parv[2] : NULL);
if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
check_spambot_warning(source_p, NULL);
return 0;
if((is_any_op(msptr) || !MyConnect(source_p) ||
((can_send(chptr, source_p, msptr) > 0 &&
(source_p->localClient->firsttime +
ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time())))) {
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s :Cycling", use_id(source_p), chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :Cycling",
source_p->name, source_p->username,
source_p->host, chptr->chname);
} else {
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s", use_id(source_p), chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
source_p->name, source_p->username,
source_p->host, chptr->chname);
}
remove_user_from_channel(msptr);
chptr = NULL;
msptr = NULL;
name = rb_strtok_r(NULL, ",", &p);
}
user_join(client_p, source_p, parv[1], parc > 2 ? parv[2] : NULL);
return 0;
}

View File

@ -35,11 +35,11 @@
#include "packet.h"
static int m_findforwards(struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]);
int parc, const char *parv[]);
struct Message findforwards_msgtab = {
"FINDFORWARDS", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_findforwards, 2}, mg_ignore, mg_ignore, mg_ignore, {m_findforwards, 2}}
"FINDFORWARDS", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_findforwards, 2}, mg_ignore, mg_ignore, mg_ignore, {m_findforwards, 2}}
};
mapi_clist_av1 findforwards_clist[] = { &findforwards_msgtab, NULL };
@ -53,62 +53,54 @@ DECLARE_MODULE_AV1(findforwards, NULL, NULL, findforwards_clist, NULL, NULL, "$R
static int
m_findforwards(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
static time_t last_used = 0;
struct Channel *chptr;
struct membership *msptr;
rb_dlink_node *ptr;
char buf[414];
char *p = buf, *end = buf + sizeof buf - 1;
*p = '\0';
static time_t last_used = 0;
struct Channel *chptr;
struct membership *msptr;
rb_dlink_node *ptr;
char buf[414];
char *p = buf, *end = buf + sizeof buf - 1;
*p = '\0';
/* Allow ircops to search for forwards to nonexistent channels */
if(!IsOper(source_p))
{
if((chptr = find_channel(parv[1])) == NULL || (msptr = find_channel_membership(chptr, source_p)) == NULL)
{
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), parv[1]);
return 0;
}
/* Allow ircops to search for forwards to nonexistent channels */
if(!IsOper(source_p)) {
if((chptr = find_channel(parv[1])) == NULL || (msptr = find_channel_membership(chptr, source_p)) == NULL) {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), parv[1]);
return 0;
}
if(!is_any_op(msptr))
{
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, parv[1]);
return 0;
}
if(!is_any_op(msptr)) {
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, parv[1]);
return 0;
}
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
{
sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "FINDFORWARDS");
return 0;
}
else
last_used = rb_current_time();
}
RB_DLINK_FOREACH(ptr, global_channel_list.head)
{
chptr = ptr->data;
if(chptr->mode.forward && !irccmp(chptr->mode.forward, parv[1]))
{
if(p + strlen(chptr->chname) >= end - 13)
{
strcpy(p, "<truncated> ");
p += 12;
break;
}
strcpy(p, chptr->chname);
p += strlen(chptr->chname);
*p++ = ' ';
}
}
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) {
sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "FINDFORWARDS");
return 0;
} else
last_used = rb_current_time();
}
if(buf[0])
*(--p) = '\0';
RB_DLINK_FOREACH(ptr, global_channel_list.head) {
chptr = ptr->data;
if(chptr->mode.forward && !irccmp(chptr->mode.forward, parv[1])) {
if(p + strlen(chptr->chname) >= end - 13) {
strcpy(p, "<truncated> ");
p += 12;
break;
}
strcpy(p, chptr->chname);
p += strlen(chptr->chname);
*p++ = ' ';
}
}
sendto_one_notice(source_p, ":Forwards for %s: %s", parv[1], buf);
if(buf[0])
*(--p) = '\0';
return 0;
sendto_one_notice(source_p, ":Forwards for %s: %s", parv[1], buf);
return 0;
}

View File

@ -48,11 +48,11 @@
#include "modules.h"
static int mo_forcejoin(struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]);
int parc, const char *parv[]);
struct Message forcejoin_msgtab = {
"FORCEJOIN", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_forcejoin, 3}}
"FORCEJOIN", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_forcejoin, 3}}
};
mapi_clist_av1 force_clist[] = { &forcejoin_msgtab, NULL };
@ -67,152 +67,137 @@ DECLARE_MODULE_AV1(force, NULL, NULL, force_clist, NULL, NULL, "$Revision: 3297
static int
mo_forcejoin(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Client *target_p;
struct Channel *chptr;
int type;
char mode;
char sjmode;
char *newch;
struct Client *target_p;
struct Channel *chptr;
int type;
char mode;
char sjmode;
char *newch;
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
if(!IsOperAdmin(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
if((hunt_server(client_p, source_p, ":%s FORCEJOIN %s %s", 1, parc, parv)) != HUNTED_ISME)
return 0;
if((hunt_server(client_p, source_p, ":%s FORCEJOIN %s %s", 1, parc, parv)) != HUNTED_ISME)
return 0;
/* if target_p is not existant, print message
* to source_p and bail - scuzzy
*/
if((target_p = find_client(parv[1])) == NULL)
{
sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, parv[1]);
return 0;
}
/* if target_p is not existant, print message
* to source_p and bail - scuzzy
*/
if((target_p = find_client(parv[1])) == NULL) {
sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, parv[1]);
return 0;
}
if(!IsPerson(target_p))
return 0;
if(!IsPerson(target_p))
return 0;
sendto_wallops_flags(UMODE_WALLOP, &me,
"FORCEJOIN called for %s %s by %s!%s@%s",
parv[1], parv[2], source_p->name, source_p->username, source_p->host);
ilog(L_MAIN, "FORCEJOIN called for %s %s by %s!%s@%s",
parv[1], parv[2], source_p->name, source_p->username, source_p->host);
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
":%s WALLOPS :FORCEJOIN called for %s %s by %s!%s@%s",
me.name, parv[1], parv[2],
source_p->name, source_p->username, source_p->host);
sendto_wallops_flags(UMODE_WALLOP, &me,
"FORCEJOIN called for %s %s by %s!%s@%s",
parv[1], parv[2], source_p->name, source_p->username, source_p->host);
ilog(L_MAIN, "FORCEJOIN called for %s %s by %s!%s@%s",
parv[1], parv[2], source_p->name, source_p->username, source_p->host);
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
":%s WALLOPS :FORCEJOIN called for %s %s by %s!%s@%s",
me.name, parv[1], parv[2],
source_p->name, source_p->username, source_p->host);
/* select our modes from parv[2] if they exist... (chanop) */
if(*parv[2] == '@')
{
type = CHFL_CHANOP;
mode = 'o';
sjmode = '@';
}
else if(*parv[2] == '+')
{
type = CHFL_VOICE;
mode = 'v';
sjmode = '+';
}
else
{
type = CHFL_PEON;
mode = sjmode = '\0';
}
/* select our modes from parv[2] if they exist... (chanop) */
if(*parv[2] == '@') {
type = CHFL_CHANOP;
mode = 'o';
sjmode = '@';
} else if(*parv[2] == '+') {
type = CHFL_VOICE;
mode = 'v';
sjmode = '+';
} else {
type = CHFL_PEON;
mode = sjmode = '\0';
}
if(mode != '\0')
parv[2]++;
if(mode != '\0')
parv[2]++;
if((chptr = find_channel(parv[2])) != NULL)
{
if(IsMember(target_p, chptr))
{
/* debugging is fun... */
sendto_one_notice(source_p, ":*** Notice -- %s is already in %s",
target_p->name, chptr->chname);
return 0;
}
if((chptr = find_channel(parv[2])) != NULL) {
if(IsMember(target_p, chptr)) {
/* debugging is fun... */
sendto_one_notice(source_p, ":*** Notice -- %s is already in %s",
target_p->name, chptr->chname);
return 0;
}
add_user_to_channel(chptr, target_p, type);
add_user_to_channel(chptr, target_p, type);
sendto_server(target_p, chptr, NOCAPS, NOCAPS,
":%s SJOIN %ld %s + :%c%s",
me.name, (long) chptr->channelts,
chptr->chname, type ? sjmode : ' ', target_p->name);
sendto_server(target_p, chptr, NOCAPS, NOCAPS,
":%s SJOIN %ld %s + :%c%s",
me.name, (long) chptr->channelts,
chptr->chname, type ? sjmode : ' ', target_p->name);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s",
target_p->name, target_p->username,
target_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s",
target_p->name, target_p->username,
target_p->host, chptr->chname);
if(type)
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +%c %s",
me.name, chptr->chname, mode, target_p->name);
if(type)
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +%c %s",
me.name, chptr->chname, mode, target_p->name);
if(chptr->topic != NULL)
{
sendto_one(target_p, form_str(RPL_TOPIC), me.name,
target_p->name, chptr->chname, chptr->topic);
sendto_one(target_p, form_str(RPL_TOPICWHOTIME),
me.name, source_p->name, chptr->chname,
chptr->topic_info, chptr->topic_time);
}
if(chptr->topic != NULL) {
sendto_one(target_p, form_str(RPL_TOPIC), me.name,
target_p->name, chptr->chname, chptr->topic);
sendto_one(target_p, form_str(RPL_TOPICWHOTIME),
me.name, source_p->name, chptr->chname,
chptr->topic_info, chptr->topic_time);
}
channel_member_names(chptr, target_p, 1);
}
else
{
newch = LOCAL_COPY(parv[2]);
if(!check_channel_name(newch))
{
sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name,
source_p->name, (unsigned char *) newch);
return 0;
}
channel_member_names(chptr, target_p, 1);
} else {
newch = LOCAL_COPY(parv[2]);
if(!check_channel_name(newch)) {
sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name,
source_p->name, (unsigned char *) newch);
return 0;
}
/* channel name must begin with & or # */
if(!IsChannelName(newch))
{
sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name,
source_p->name, (unsigned char *) newch);
return 0;
}
/* channel name must begin with & or # */
if(!IsChannelName(newch)) {
sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name,
source_p->name, (unsigned char *) newch);
return 0;
}
/* newch can't be longer than CHANNELLEN */
if(strlen(newch) > CHANNELLEN)
{
sendto_one_notice(source_p, ":Channel name is too long");
return 0;
}
/* newch can't be longer than CHANNELLEN */
if(strlen(newch) > CHANNELLEN) {
sendto_one_notice(source_p, ":Channel name is too long");
return 0;
}
chptr = get_or_create_channel(target_p, newch, NULL);
add_user_to_channel(chptr, target_p, CHFL_CHANOP);
chptr = get_or_create_channel(target_p, newch, NULL);
add_user_to_channel(chptr, target_p, CHFL_CHANOP);
/* send out a join, make target_p join chptr */
sendto_server(target_p, chptr, NOCAPS, NOCAPS,
":%s SJOIN %ld %s +nt :@%s", me.name,
(long) chptr->channelts, chptr->chname, target_p->name);
/* send out a join, make target_p join chptr */
sendto_server(target_p, chptr, NOCAPS, NOCAPS,
":%s SJOIN %ld %s +nt :@%s", me.name,
(long) chptr->channelts, chptr->chname, target_p->name);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s",
target_p->name, target_p->username,
target_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s",
target_p->name, target_p->username,
target_p->host, chptr->chname);
chptr->mode.mode |= MODE_TOPICLIMIT;
chptr->mode.mode |= MODE_NOPRIVMSGS;
chptr->mode.mode |= MODE_TOPICLIMIT;
chptr->mode.mode |= MODE_NOPRIVMSGS;
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +nt", me.name, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +nt", me.name, chptr->chname);
target_p->localClient->last_join_time = rb_current_time();
channel_member_names(chptr, target_p, 1);
target_p->localClient->last_join_time = rb_current_time();
channel_member_names(chptr, target_p, 1);
/* we do this to let the oper know that a channel was created, this will be
* seen from the server handling the command instead of the server that
* the oper is on.
*/
sendto_one_notice(source_p, ":*** Notice -- Creating channel %s", chptr->chname);
}
return 0;
/* we do this to let the oper know that a channel was created, this will be
* seen from the server handling the command instead of the server that
* the oper is on.
*/
sendto_one_notice(source_p, ":*** Notice -- Creating channel %s", chptr->chname);
}
return 0;
}

View File

@ -52,49 +52,45 @@ char *reconstruct_parv(int parc, const char *parv[]);
static int m_identify(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message identify_msgtab = {
"IDENTIFY", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_identify, 0}, mg_ignore, mg_ignore, mg_ignore, {m_identify, 0}}
"IDENTIFY", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_identify, 0}, mg_ignore, mg_ignore, mg_ignore, {m_identify, 0}}
};
mapi_clist_av1 identify_clist[] = {
&identify_msgtab,
NULL
&identify_msgtab,
NULL
};
DECLARE_MODULE_AV1(identify, NULL, NULL, identify_clist, NULL, NULL, "$Revision: 2729 $");
char *reconstruct_parv(int parc, const char *parv[])
{
static char tmpbuf[BUFSIZE]; int i;
static char tmpbuf[BUFSIZE];
int i;
rb_strlcpy(tmpbuf, parv[0], BUFSIZE);
for (i = 1; i < parc; i++)
{
rb_strlcat(tmpbuf, " ", BUFSIZE);
rb_strlcat(tmpbuf, parv[i], BUFSIZE);
}
return tmpbuf;
rb_strlcpy(tmpbuf, parv[0], BUFSIZE);
for (i = 1; i < parc; i++) {
rb_strlcat(tmpbuf, " ", BUFSIZE);
rb_strlcat(tmpbuf, parv[i], BUFSIZE);
}
return tmpbuf;
}
static int m_identify(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
const char *nick;
struct Client *target_p;
const char *nick;
struct Client *target_p;
if (parc < 2 || EmptyString(parv[1]))
{
sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
return 0;
}
if (parc < 2 || EmptyString(parv[1])) {
sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
return 0;
}
nick = parv[1][0] == '#' ? SVS_chanserv_NICK : SVS_nickserv_NICK;
if ((target_p = find_named_person(nick)) && IsService(target_p))
{
sendto_one(target_p, ":%s PRIVMSG %s :IDENTIFY %s", get_id(source_p, target_p), get_id(target_p, target_p), reconstruct_parv(parc - 1, &parv[1]));
}
else
{
sendto_one_numeric(source_p, ERR_SERVICESDOWN, form_str(ERR_SERVICESDOWN), nick);
}
return 0;
nick = parv[1][0] == '#' ? SVS_chanserv_NICK : SVS_nickserv_NICK;
if ((target_p = find_named_person(nick)) && IsService(target_p)) {
sendto_one(target_p, ":%s PRIVMSG %s :IDENTIFY %s", get_id(source_p, target_p), get_id(target_p, target_p), reconstruct_parv(parc - 1, &parv[1]));
} else {
sendto_one_numeric(source_p, ERR_SERVICESDOWN, form_str(ERR_SERVICESDOWN), nick);
}
return 0;
}

View File

@ -15,9 +15,9 @@
#include <string.h>
static int m_mkpasswd(struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]);
int parc, const char *parv[]);
static int mo_mkpasswd(struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]);
int parc, const char *parv[]);
static char *make_md5_salt(int);
static char *make_sha256_salt(int);
@ -26,11 +26,11 @@ static char *generate_random_salt(char *, int);
static char *generate_poor_salt(char *, int);
static char saltChars[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
/* 0 .. 63, ascii - 64 */
/* 0 .. 63, ascii - 64 */
struct Message mkpasswd_msgtab = {
"MKPASSWD", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_mkpasswd, 2}, mg_ignore, mg_ignore, mg_ignore, {mo_mkpasswd, 2}}
"MKPASSWD", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_mkpasswd, 2}, mg_ignore, mg_ignore, mg_ignore, {mo_mkpasswd, 2}}
};
mapi_clist_av1 mkpasswd_clist[] = { &mkpasswd_msgtab, NULL };
@ -45,46 +45,42 @@ DECLARE_MODULE_AV1(mkpasswd, NULL, NULL, mkpasswd_clist, NULL, NULL, "$Revision$
static int
m_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
static time_t last_used = 0;
char *salt;
const char *hashtype;
const char hashdefault[] = "SHA512";
static time_t last_used = 0;
char *salt;
const char *hashtype;
const char hashdefault[] = "SHA512";
if(EmptyString(parv[1]))
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
return 0;
}
if(EmptyString(parv[1])) {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
return 0;
}
if(parc < 3)
hashtype = hashdefault;
else
hashtype = parv[2];
if(parc < 3)
hashtype = hashdefault;
else
hashtype = parv[2];
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
{
/* safe enough to give this on a local connect only */
sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "MKPASSWD");
return 0;
}
else
last_used = rb_current_time();
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) {
/* safe enough to give this on a local connect only */
sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "MKPASSWD");
return 0;
} else
last_used = rb_current_time();
if(!irccmp(hashtype, "SHA256"))
salt = make_sha256_salt(16);
else if(!irccmp(hashtype, "SHA512"))
salt = make_sha512_salt(16);
else if(!irccmp(hashtype, "MD5"))
salt = make_md5_salt(8);
else
{
sendto_one_notice(source_p,
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
return 0;
}
if(!irccmp(hashtype, "SHA256"))
salt = make_sha256_salt(16);
else if(!irccmp(hashtype, "SHA512"))
salt = make_sha512_salt(16);
else if(!irccmp(hashtype, "MD5"))
salt = make_md5_salt(8);
else {
sendto_one_notice(source_p,
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
return 0;
}
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], rb_crypt(parv[1], salt));
return 0;
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], rb_crypt(parv[1], salt));
return 0;
}
/* mo_mkpasswd - mkpasswd message handler
@ -94,124 +90,115 @@ m_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const cha
static int
mo_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
char *salt;
const char *hashtype;
const char hashdefault[] = "SHA512";
char *salt;
const char *hashtype;
const char hashdefault[] = "SHA512";
if(EmptyString(parv[1]))
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
return 0;
}
if(EmptyString(parv[1])) {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
return 0;
}
if(parc < 3)
hashtype = hashdefault;
else
hashtype = parv[2];
if(parc < 3)
hashtype = hashdefault;
else
hashtype = parv[2];
if(!irccmp(hashtype, "SHA256"))
salt = make_sha256_salt(16);
else if(!irccmp(hashtype, "SHA512"))
salt = make_sha512_salt(16);
else if(!irccmp(hashtype, "MD5"))
salt = make_md5_salt(8);
else
{
sendto_one_notice(source_p,
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
return 0;
}
if(!irccmp(hashtype, "SHA256"))
salt = make_sha256_salt(16);
else if(!irccmp(hashtype, "SHA512"))
salt = make_sha512_salt(16);
else if(!irccmp(hashtype, "MD5"))
salt = make_md5_salt(8);
else {
sendto_one_notice(source_p,
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
return 0;
}
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], rb_crypt(parv[1], salt));
return 0;
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], rb_crypt(parv[1], salt));
return 0;
}
char *
make_md5_salt(int length)
{
static char salt[21];
if(length > 16)
{
printf("MD5 salt length too long\n");
exit(0);
}
salt[0] = '$';
salt[1] = '1';
salt[2] = '$';
generate_random_salt(&salt[3], length);
salt[length + 3] = '$';
salt[length + 4] = '\0';
return salt;
static char salt[21];
if(length > 16) {
printf("MD5 salt length too long\n");
exit(0);
}
salt[0] = '$';
salt[1] = '1';
salt[2] = '$';
generate_random_salt(&salt[3], length);
salt[length + 3] = '$';
salt[length + 4] = '\0';
return salt;
}
char *
make_sha256_salt(int length)
{
static char salt[21];
if(length > 16)
{
printf("SHA256 salt length too long\n");
exit(0);
}
salt[0] = '$';
salt[1] = '5';
salt[2] = '$';
generate_random_salt(&salt[3], length);
salt[length + 3] = '$';
salt[length + 4] = '\0';
return salt;
static char salt[21];
if(length > 16) {
printf("SHA256 salt length too long\n");
exit(0);
}
salt[0] = '$';
salt[1] = '5';
salt[2] = '$';
generate_random_salt(&salt[3], length);
salt[length + 3] = '$';
salt[length + 4] = '\0';
return salt;
}
char *
make_sha512_salt(int length)
{
static char salt[21];
if(length > 16)
{
printf("SHA512 salt length too long\n");
exit(0);
}
salt[0] = '$';
salt[1] = '6';
salt[2] = '$';
generate_random_salt(&salt[3], length);
salt[length + 3] = '$';
salt[length + 4] = '\0';
return salt;
static char salt[21];
if(length > 16) {
printf("SHA512 salt length too long\n");
exit(0);
}
salt[0] = '$';
salt[1] = '6';
salt[2] = '$';
generate_random_salt(&salt[3], length);
salt[length + 3] = '$';
salt[length + 4] = '\0';
return salt;
}
char *
generate_poor_salt(char *salt, int length)
{
int i;
srand(time(NULL));
for(i = 0; i < length; i++)
{
salt[i] = saltChars[rand() % 64];
}
return (salt);
int i;
srand(time(NULL));
for(i = 0; i < length; i++) {
salt[i] = saltChars[rand() % 64];
}
return (salt);
}
char *
generate_random_salt(char *salt, int length)
{
char *buf;
int fd, i;
if((fd = open("/dev/random", O_RDONLY)) < 0)
{
return (generate_poor_salt(salt, length));
}
buf = calloc(1, length);
if(read(fd, buf, length) != length)
{
free(buf);
return (generate_poor_salt(salt, length));
}
char *buf;
int fd, i;
if((fd = open("/dev/random", O_RDONLY)) < 0) {
return (generate_poor_salt(salt, length));
}
buf = calloc(1, length);
if(read(fd, buf, length) != length) {
free(buf);
return (generate_poor_salt(salt, length));
}
for(i = 0; i < length; i++)
{
salt[i] = saltChars[abs(buf[i]) % 64];
}
free(buf);
return (salt);
for(i = 0; i < length; i++) {
salt[i] = saltChars[abs(buf[i]) % 64];
}
free(buf);
return (salt);
}

View File

@ -9,9 +9,9 @@
static int mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message oaccept_msgtab = {
"OACCEPT", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_oaccept, 2}}
};
"OACCEPT", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_oaccept, 2}}
};
mapi_clist_av1 oaccept_clist[] = { &oaccept_msgtab, NULL };
@ -20,46 +20,42 @@ DECLARE_MODULE_AV1(oaccept, NULL, NULL, oaccept_clist, NULL, NULL, "$Id $");
static int
mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Metadata *md;
struct DictionaryIter iter;
struct Client *target_p;
char text[10];
struct Metadata *md;
struct DictionaryIter iter;
struct Client *target_p;
char text[10];
if(!(target_p = find_client(parv[1])))
{
sendto_one(source_p, form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
}
if(!(target_p = find_client(parv[1]))) {
sendto_one(source_p, form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
}
/* If we don't check for this, and some idiot tries to OACCEPT a server... */
if(!IsPerson(target_p))
{
sendto_one_notice(source_p, ":That is a server, not a user. What are you doing?");
return 0;
}
/* If we don't check for this, and some idiot tries to OACCEPT a server... */
if(!IsPerson(target_p)) {
sendto_one_notice(source_p, ":That is a server, not a user. What are you doing?");
return 0;
}
rb_snprintf(text, sizeof(text), "O%s", source_p->id);
rb_snprintf(text, sizeof(text), "O%s", source_p->id);
/* Provide a nice error message if you try to OACCEPT someone
* who you've already OACCEPTed. */
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
{
if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text))
{
sendto_one_notice(source_p, ":You're already on %s's OACCEPT list", target_p->name);
return 0;
}
}
/* Provide a nice error message if you try to OACCEPT someone
* who you've already OACCEPTed. */
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata) {
if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text)) {
sendto_one_notice(source_p, ":You're already on %s's OACCEPT list", target_p->name);
return 0;
}
}
user_metadata_add(target_p, text, "OACCEPT", 1);
user_metadata_add(target_p, text, "OACCEPT", 1);
sendto_wallops_flags(UMODE_WALLOP, &me,
"OACCEPT called for %s by %s!%s@%s",
target_p->name,
source_p->name, source_p->username, source_p->host);
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
":%s WALLOPS :OACCEPT called for %s by %s!%s@%s",
me.name, target_p->name, source_p->name, source_p->username,
source_p->host);
return 0;
sendto_wallops_flags(UMODE_WALLOP, &me,
"OACCEPT called for %s by %s!%s@%s",
target_p->name,
source_p->name, source_p->username, source_p->host);
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
":%s WALLOPS :OACCEPT called for %s by %s!%s@%s",
me.name, target_p->name, source_p->name, source_p->username,
source_p->host);
return 0;
}

View File

@ -20,17 +20,17 @@
#include "stdinc.h"
#include "channel.h"
#include "client.h"
#include "client.h"
#include "ircd.h"
#include "numeric.h"
#include "logger.h"
#include "s_serv.h"
#include "s_conf.h"
#include "s_newconf.h"
#include "s_newconf.h"
#include "send.h"
#include "whowas.h"
#include "match.h"
#include "hash.h"
#include "hash.h"
#include "msg.h"
#include "parse.h"
#include "modules.h"
@ -39,8 +39,8 @@ static int mo_ojoin(struct Client *client_p, struct Client *source_p, int parc,
struct Message ojoin_msgtab = {
"OJOIN", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_ojoin, 2}}
"OJOIN", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_ojoin, 2}}
};
mapi_clist_av1 ojoin_clist[] = { &ojoin_msgtab, NULL };
@ -54,133 +54,117 @@ DECLARE_MODULE_AV1(ojoin, NULL, NULL, ojoin_clist, NULL, NULL, "$Revision: 3554
static int
mo_ojoin(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr;
int move_me = 0;
struct Channel *chptr;
int move_me = 0;
/* admins only */
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
/* admins only */
if(!IsOperAdmin(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
if(*parv[1] == '@' || *parv[1] == '%' || *parv[1] == '+' || *parv[1] == '!' || *parv[1] == '~')
{
parv[1]++;
move_me = 1;
}
if(*parv[1] == '@' || *parv[1] == '%' || *parv[1] == '+' || *parv[1] == '!' || *parv[1] == '~') {
parv[1]++;
move_me = 1;
}
if((chptr = find_channel(parv[1])) == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
}
if((chptr = find_channel(parv[1])) == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
}
if(IsMember(source_p, chptr))
{
sendto_one_notice(source_p, ":Please part %s before using OJOIN", parv[1]);
return 0;
}
if(IsMember(source_p, chptr)) {
sendto_one_notice(source_p, ":Please part %s before using OJOIN", parv[1]);
return 0;
}
if(move_me == 1)
parv[1]--;
if(move_me == 1)
parv[1]--;
sendto_wallops_flags(UMODE_WALLOP, &me,
"OJOIN called for %s by %s!%s@%s",
parv[1], source_p->name, source_p->username, source_p->host);
ilog(L_MAIN, "OJOIN called for %s by %s",
parv[1], get_oper_name(source_p));
/* only sends stuff for #channels remotely */
sendto_server(NULL, chptr, NOCAPS, NOCAPS,
":%s WALLOPS :OJOIN called for %s by %s!%s@%s",
me.name, parv[1],
source_p->name, source_p->username, source_p->host);
sendto_wallops_flags(UMODE_WALLOP, &me,
"OJOIN called for %s by %s!%s@%s",
parv[1], source_p->name, source_p->username, source_p->host);
ilog(L_MAIN, "OJOIN called for %s by %s",
parv[1], get_oper_name(source_p));
/* only sends stuff for #channels remotely */
sendto_server(NULL, chptr, NOCAPS, NOCAPS,
":%s WALLOPS :OJOIN called for %s by %s!%s@%s",
me.name, parv[1],
source_p->name, source_p->username, source_p->host);
if(*parv[1] == '~' && ConfigChannel.use_owner)
{
add_user_to_channel(chptr, source_p, CHFL_OWNER);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :~%s",
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +y %s",
me.name, chptr->chname, source_p->name);
}
else if(*parv[1] == '!' && ConfigChannel.use_admin)
{
add_user_to_channel(chptr, source_p, CHFL_ADMIN);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :!%s",
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s",
me.name, chptr->chname, source_p->name);
if(*parv[1] == '~' && ConfigChannel.use_owner) {
add_user_to_channel(chptr, source_p, CHFL_OWNER);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :~%s",
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +y %s",
me.name, chptr->chname, source_p->name);
} else if(*parv[1] == '!' && ConfigChannel.use_admin) {
add_user_to_channel(chptr, source_p, CHFL_ADMIN);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :!%s",
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s",
me.name, chptr->chname, source_p->name);
}
else if(*parv[1] == '@')
{
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :@%s",
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
me.name, chptr->chname, source_p->name);
} else if(*parv[1] == '@') {
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :@%s",
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
me.name, chptr->chname, source_p->name);
}
else if(*parv[1] == '%' && ConfigChannel.use_halfop)
{
add_user_to_channel(chptr, source_p, CHFL_HALFOP);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :%s%s",
me.id, (long) chptr->channelts, chptr->chname, "%", source_p->id);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +h %s",
me.name, chptr->chname, source_p->name);
}
else if(*parv[1] == '+')
{
add_user_to_channel(chptr, source_p, CHFL_VOICE);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :+%s",
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +v %s",
me.name, chptr->chname, source_p->name);
}
else
{
add_user_to_channel(chptr, source_p, CHFL_PEON);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s JOIN %ld %s +",
source_p->id, (long) chptr->channelts, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
}
} else if(*parv[1] == '%' && ConfigChannel.use_halfop) {
add_user_to_channel(chptr, source_p, CHFL_HALFOP);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :%s%s",
me.id, (long) chptr->channelts, chptr->chname, "%", source_p->id);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +h %s",
me.name, chptr->chname, source_p->name);
} else if(*parv[1] == '+') {
add_user_to_channel(chptr, source_p, CHFL_VOICE);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :+%s",
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +v %s",
me.name, chptr->chname, source_p->name);
} else {
add_user_to_channel(chptr, source_p, CHFL_PEON);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s JOIN %ld %s +",
source_p->id, (long) chptr->channelts, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s",
source_p->name,
source_p->username, source_p->host, chptr->chname);
}
/* send the topic... */
if(chptr->topic != NULL)
{
sendto_one(source_p, form_str(RPL_TOPIC), me.name,
source_p->name, chptr->chname, chptr->topic);
sendto_one(source_p, form_str(RPL_TOPICWHOTIME), me.name,
source_p->name, chptr->chname, chptr->topic_info, chptr->topic_time);
}
/* send the topic... */
if(chptr->topic != NULL) {
sendto_one(source_p, form_str(RPL_TOPIC), me.name,
source_p->name, chptr->chname, chptr->topic);
sendto_one(source_p, form_str(RPL_TOPICWHOTIME), me.name,
source_p->name, chptr->chname, chptr->topic_info, chptr->topic_time);
}
source_p->localClient->last_join_time = rb_current_time();
channel_member_names(chptr, source_p, 1);
source_p->localClient->last_join_time = rb_current_time();
channel_member_names(chptr, source_p, 1);
return 0;
return 0;
}

View File

@ -41,8 +41,8 @@ static int mo_okick(struct Client *client_p, struct Client *source_p, int parc,
struct Message okick_msgtab = {
"OKICK", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_okick, 4}}
"OKICK", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_okick, 4}}
};
mapi_clist_av1 okick_clist[] = { &okick_msgtab, NULL };
@ -58,89 +58,84 @@ DECLARE_MODULE_AV1(okick, NULL, NULL, okick_clist, NULL, NULL, "$Revision: 3554
static int
mo_okick(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Client *who;
struct Client *target_p;
struct Channel *chptr;
struct membership *msptr;
int chasing = 0;
char *comment;
char *name;
char *p = NULL;
char *user;
char text[10];
static char buf[BUFSIZE];
struct Client *who;
struct Client *target_p;
struct Channel *chptr;
struct membership *msptr;
int chasing = 0;
char *comment;
char *name;
char *p = NULL;
char *user;
char text[10];
static char buf[BUFSIZE];
if(*parv[2] == '\0')
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "KICK");
return 0;
}
if(*parv[2] == '\0') {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "KICK");
return 0;
}
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
comment = (EmptyString(LOCAL_COPY(parv[3]))) ? LOCAL_COPY(parv[2]) : LOCAL_COPY(parv[3]);
if(strlen(comment) > (size_t) TOPICLEN)
comment[TOPICLEN] = '\0';
comment = (EmptyString(LOCAL_COPY(parv[3]))) ? LOCAL_COPY(parv[2]) : LOCAL_COPY(parv[3]);
if(strlen(comment) > (size_t) TOPICLEN)
comment[TOPICLEN] = '\0';
*buf = '\0';
if((p = strchr(parv[1], ',')))
*p = '\0';
*buf = '\0';
if((p = strchr(parv[1], ',')))
*p = '\0';
name = LOCAL_COPY(parv[1]);
name = LOCAL_COPY(parv[1]);
chptr = find_channel(name);
if(!chptr)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return 0;
}
chptr = find_channel(name);
if(!chptr) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return 0;
}
if((p = strchr(parv[2], ',')))
*p = '\0';
user = LOCAL_COPY(parv[2]); // strtoken(&p2, parv[2], ",");
if(!(who = find_chasing(source_p, user, &chasing)))
{
return 0;
}
if((p = strchr(parv[2], ',')))
*p = '\0';
user = LOCAL_COPY(parv[2]); // strtoken(&p2, parv[2], ",");
if(!(who = find_chasing(source_p, user, &chasing))) {
return 0;
}
if((target_p = find_client(user)) == NULL)
{
sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, user);
return 0;
}
if((target_p = find_client(user)) == NULL) {
sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, user);
return 0;
}
if((msptr = find_channel_membership(chptr, target_p)) == NULL)
{
sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL),
me.name, source_p->name, parv[1], parv[2]);
return 0;
}
if((msptr = find_channel_membership(chptr, target_p)) == NULL) {
sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL),
me.name, source_p->name, parv[1], parv[2]);
return 0;
}
sendto_wallops_flags(UMODE_WALLOP, &me,
"OKICK called for %s %s by %s!%s@%s",
chptr->chname, target_p->name,
source_p->name, source_p->username, source_p->host);
ilog(L_MAIN, "OKICK called for %s %s by %s",
chptr->chname, target_p->name,
get_oper_name(source_p));
/* only sends stuff for #channels remotely */
sendto_server(NULL, chptr, NOCAPS, NOCAPS,
":%s WALLOPS :OKICK called for %s %s by %s!%s@%s",
me.name, chptr->chname, target_p->name,
source_p->name, source_p->username, source_p->host);
sendto_wallops_flags(UMODE_WALLOP, &me,
"OKICK called for %s %s by %s!%s@%s",
chptr->chname, target_p->name,
source_p->name, source_p->username, source_p->host);
ilog(L_MAIN, "OKICK called for %s %s by %s",
chptr->chname, target_p->name,
get_oper_name(source_p));
/* only sends stuff for #channels remotely */
sendto_server(NULL, chptr, NOCAPS, NOCAPS,
":%s WALLOPS :OKICK called for %s %s by %s!%s@%s",
me.name, chptr->chname, target_p->name,
source_p->name, source_p->username, source_p->host);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s KICK %s %s :%s",
me.name, chptr->chname, who->name, comment);
sendto_server(&me, chptr, CAP_TS6, NOCAPS,
":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
remove_user_from_channel(msptr);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s KICK %s %s :%s",
me.name, chptr->chname, who->name, comment);
sendto_server(&me, chptr, CAP_TS6, NOCAPS,
":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
remove_user_from_channel(msptr);
rb_snprintf(text, sizeof(text), "K%s", who->id);
rb_snprintf(text, sizeof(text), "K%s", who->id);
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)
channel_metadata_time_add(chptr, text, rb_current_time(), "KICKNOREJOIN");
return 0;
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)
channel_metadata_time_add(chptr, text, rb_current_time(), "KICKNOREJOIN");
return 0;
}

View File

@ -46,8 +46,8 @@ static int mo_olist(struct Client *, struct Client *, int parc, const char *parv
#ifndef STATIC_MODULES
struct Message olist_msgtab = {
"OLIST", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_olist, 1}}
"OLIST", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_olist, 1}}
};
mapi_clist_av1 olist_clist[] = { &olist_msgtab, NULL };
@ -66,23 +66,22 @@ static void list_named_channel(struct Client *source_p, const char *name);
static int
mo_olist(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(!IsOperSpy(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "oper_spy");
sendto_one(source_p, form_str(RPL_LISTEND),
me.name, source_p->name);
return 0;
}
if(!IsOperSpy(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "oper_spy");
sendto_one(source_p, form_str(RPL_LISTEND),
me.name, source_p->name);
return 0;
}
/* If no arg, do all channels *whee*, else just one channel */
if(parc < 2 || EmptyString(parv[1]))
list_all_channels(source_p);
else
list_named_channel(source_p, parv[1]);
/* If no arg, do all channels *whee*, else just one channel */
if(parc < 2 || EmptyString(parv[1]))
list_all_channels(source_p);
else
list_named_channel(source_p, parv[1]);
sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
return 0;
sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
return 0;
}
@ -95,24 +94,23 @@ mo_olist(struct Client *client_p, struct Client *source_p, int parc, const char
static void
list_all_channels(struct Client *source_p)
{
struct Channel *chptr;
rb_dlink_node *ptr;
struct Channel *chptr;
rb_dlink_node *ptr;
report_operspy(source_p, "LIST", NULL);
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
report_operspy(source_p, "LIST", NULL);
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
RB_DLINK_FOREACH(ptr, global_channel_list.head)
{
chptr = ptr->data;
RB_DLINK_FOREACH(ptr, global_channel_list.head) {
chptr = ptr->data;
sendto_one(source_p, ":%s 322 %s %s %lu :[%s] %s",
me.name, source_p->name, chptr->chname,
rb_dlink_list_length(&chptr->members),
channel_modes(chptr, &me),
chptr->topic == NULL ? "" : chptr->topic);
}
sendto_one(source_p, ":%s 322 %s %s %lu :[%s] %s",
me.name, source_p->name, chptr->chname,
rb_dlink_list_length(&chptr->members),
channel_modes(chptr, &me),
chptr->topic == NULL ? "" : chptr->topic);
}
return;
return;
}
/*
@ -124,28 +122,28 @@ list_all_channels(struct Client *source_p)
static void
list_named_channel(struct Client *source_p, const char *name)
{
struct Channel *chptr;
char *p;
char *n = LOCAL_COPY(name);
struct Channel *chptr;
char *p;
char *n = LOCAL_COPY(name);
if((p = strchr(n, ',')))
*p = '\0';
if((p = strchr(n, ',')))
*p = '\0';
/* Put operspy notice before any output, but only if channel exists */
chptr = EmptyString(n) ? NULL : find_channel(n);
if(chptr != NULL)
report_operspy(source_p, "LIST", chptr->chname);
/* Put operspy notice before any output, but only if channel exists */
chptr = EmptyString(n) ? NULL : find_channel(n);
if(chptr != NULL)
report_operspy(source_p, "LIST", chptr->chname);
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
if(EmptyString(n))
return;
if(EmptyString(n))
return;
if(chptr == NULL)
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), n);
else
sendto_one(source_p, ":%s 322 %s %s %lu :[%s] %s", me.name, source_p->name,
chptr->chname, rb_dlink_list_length(&chptr->members),
channel_modes(chptr, &me), chptr->topic ? chptr->topic : "");
if(chptr == NULL)
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), n);
else
sendto_one(source_p, ":%s 322 %s %s %lu :[%s] %s", me.name, source_p->name,
chptr->chname, rb_dlink_list_length(&chptr->members),
channel_modes(chptr, &me), chptr->topic ? chptr->topic : "");
}

View File

@ -44,8 +44,8 @@
static int mo_omode(struct Client *, struct Client *, int, const char **);
struct Message omode_msgtab = {
"OMODE", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_omode, 3}}
"OMODE", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_omode, 3}}
};
mapi_clist_av1 omode_clist[] = { &omode_msgtab, NULL };
@ -59,199 +59,174 @@ DECLARE_MODULE_AV1(omode, NULL, NULL, omode_clist, NULL, NULL, "$Revision: 3121
static int
mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr = NULL;
struct membership *msptr;
char params[512];
int i;
int wasonchannel;
struct Channel *chptr = NULL;
struct membership *msptr;
char params[512];
int i;
int wasonchannel;
/* admins only */
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
/* admins only */
if(!IsOperAdmin(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
/* Now, try to find the channel in question */
if(!IsChanPrefix(parv[1][0]) || !check_channel_name(parv[1]))
{
sendto_one_numeric(source_p, ERR_BADCHANNAME,
form_str(ERR_BADCHANNAME), parv[1]);
return 0;
}
/* Now, try to find the channel in question */
if(!IsChanPrefix(parv[1][0]) || !check_channel_name(parv[1])) {
sendto_one_numeric(source_p, ERR_BADCHANNAME,
form_str(ERR_BADCHANNAME), parv[1]);
return 0;
}
chptr = find_channel(parv[1]);
chptr = find_channel(parv[1]);
if(chptr == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
}
if(chptr == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
}
/* Now know the channel exists */
msptr = find_channel_membership(chptr, source_p);
wasonchannel = msptr != NULL;
/* Now know the channel exists */
msptr = find_channel_membership(chptr, source_p);
wasonchannel = msptr != NULL;
if (is_any_op(msptr))
{
sendto_one_notice(source_p, ":Use a normal MODE you idiot");
return 0;
}
if (is_any_op(msptr)) {
sendto_one_notice(source_p, ":Use a normal MODE you idiot");
return 0;
}
params[0] = '\0';
for (i = 2; i < parc; i++)
{
if (i != 2)
rb_strlcat(params, " ", sizeof params);
rb_strlcat(params, parv[i], sizeof params);
}
params[0] = '\0';
for (i = 2; i < parc; i++) {
if (i != 2)
rb_strlcat(params, " ", sizeof params);
rb_strlcat(params, parv[i], sizeof params);
}
sendto_wallops_flags(UMODE_WALLOP, &me,
"OMODE called for [%s] [%s] by %s!%s@%s",
parv[1], params, source_p->name, source_p->username, source_p->host);
ilog(L_MAIN, "OMODE called for [%s] [%s] by %s",
parv[1], params, get_oper_name(source_p));
sendto_wallops_flags(UMODE_WALLOP, &me,
"OMODE called for [%s] [%s] by %s!%s@%s",
parv[1], params, source_p->name, source_p->username, source_p->host);
ilog(L_MAIN, "OMODE called for [%s] [%s] by %s",
parv[1], params, get_oper_name(source_p));
if(*chptr->chname != '&')
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
":%s WALLOPS :OMODE called for [%s] [%s] by %s!%s@%s",
me.name, parv[1], params, source_p->name, source_p->username,
source_p->host);
if(*chptr->chname != '&')
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
":%s WALLOPS :OMODE called for [%s] [%s] by %s!%s@%s",
me.name, parv[1], params, source_p->name, source_p->username,
source_p->host);
#if 0
set_channel_mode(client_p, source_p->servptr, chptr, msptr,
parc - 2, parv + 2);
set_channel_mode(client_p, source_p->servptr, chptr, msptr,
parc - 2, parv + 2);
#else
if (parc == 4 && !strcmp(parv[2], "+y") && !irccmp(parv[3], source_p->name))
{
/* Ownering themselves */
if (!wasonchannel)
{
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
}
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +y %s",
me.name, parv[1], source_p->name);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s TMODE %ld %s +y %s",
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_OWNER;
if (parc == 4 && !strcmp(parv[2], "+y") && !irccmp(parv[3], source_p->name)) {
/* Ownering themselves */
if (!wasonchannel) {
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
}
else if (parc == 4 && !strcmp(parv[2], "+a") && !irccmp(parv[3], source_p->name))
{
/* Admining themselves */
if (!wasonchannel)
{
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
}
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s",
me.name, parv[1], source_p->name);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s TMODE %ld %s +a %s",
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_ADMIN;
}
else if (parc == 4 && !strcmp(parv[2], "+o") && !irccmp(parv[3], source_p->name))
{
/* Opping themselves */
if (!wasonchannel)
{
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
}
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
me.name, parv[1], source_p->name);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s TMODE %ld %s +o %s",
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_CHANOP;
}
else if (parc == 4 && !strcmp(parv[2], "+h") && !irccmp(parv[3], source_p->name))
{
/* Halfopping themselves */
if (!wasonchannel)
{
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
}
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +h %s",
me.name, parv[1], source_p->name);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s TMODE %ld %s +h %s",
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_HALFOP;
}
else if (ConfigChannel.use_owner)
{
/* I hope this is correct.
* -- Kabaka */
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +y %s",
me.name, parv[1], source_p->name);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s TMODE %ld %s +y %s",
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_OWNER;
} else if (parc == 4 && !strcmp(parv[2], "+a") && !irccmp(parv[3], source_p->name)) {
/* Admining themselves */
if (!wasonchannel) {
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
}
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s",
me.name, parv[1], source_p->name);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s TMODE %ld %s +a %s",
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_ADMIN;
} else if (parc == 4 && !strcmp(parv[2], "+o") && !irccmp(parv[3], source_p->name)) {
/* Opping themselves */
if (!wasonchannel) {
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
}
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
me.name, parv[1], source_p->name);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s TMODE %ld %s +o %s",
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_CHANOP;
} else if (parc == 4 && !strcmp(parv[2], "+h") && !irccmp(parv[3], source_p->name)) {
/* Halfopping themselves */
if (!wasonchannel) {
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
}
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +h %s",
me.name, parv[1], source_p->name);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s TMODE %ld %s +h %s",
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_HALFOP;
} else if (ConfigChannel.use_owner) {
/* I hope this is correct.
* -- Kabaka */
/* Hack it so set_channel_mode() will accept */
if (wasonchannel)
msptr->flags |= CHFL_OWNER;
else
{
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
msptr = find_channel_membership(chptr, source_p);
}
set_channel_mode(client_p, source_p, chptr, msptr,
parc - 2, parv + 2);
if (wasonchannel)
msptr->flags &= ~CHFL_OWNER;
else
remove_user_from_channel(msptr);
/* Hack it so set_channel_mode() will accept */
if (wasonchannel)
msptr->flags |= CHFL_OWNER;
else {
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
msptr = find_channel_membership(chptr, source_p);
}
else if (ConfigChannel.use_admin)
{
/* Hack it so set_channel_mode() will accept */
if (wasonchannel)
msptr->flags |= CHFL_ADMIN;
else
{
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
msptr = find_channel_membership(chptr, source_p);
}
set_channel_mode(client_p, source_p, chptr, msptr,
parc - 2, parv + 2);
/* We know they were not opped before and they can't have opped
* themselves as set_channel_mode() does not allow that
* -- jilles */
if (wasonchannel)
msptr->flags &= ~CHFL_ADMIN;
else
remove_user_from_channel(msptr);
}
else
{
/* CHFL_ADMIN is only useful if admin is enabled
* so hack it with op if it is not. */
if (wasonchannel)
msptr->flags |= CHFL_CHANOP;
else
{
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
msptr = find_channel_membership(chptr, source_p);
}
set_channel_mode(client_p, source_p, chptr, msptr,
parc - 2, parv + 2);
/* We know they were not opped before and they can't have opped
* themselves as set_channel_mode() does not allow that
* -- jilles */
if (wasonchannel)
msptr->flags &= ~CHFL_CHANOP;
else
remove_user_from_channel(msptr);
}
set_channel_mode(client_p, source_p, chptr, msptr,
parc - 2, parv + 2);
if (wasonchannel)
msptr->flags &= ~CHFL_OWNER;
else
remove_user_from_channel(msptr);
} else if (ConfigChannel.use_admin) {
/* Hack it so set_channel_mode() will accept */
if (wasonchannel)
msptr->flags |= CHFL_ADMIN;
else {
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
msptr = find_channel_membership(chptr, source_p);
}
set_channel_mode(client_p, source_p, chptr, msptr,
parc - 2, parv + 2);
/* We know they were not opped before and they can't have opped
* themselves as set_channel_mode() does not allow that
* -- jilles */
if (wasonchannel)
msptr->flags &= ~CHFL_ADMIN;
else
remove_user_from_channel(msptr);
} else {
/* CHFL_ADMIN is only useful if admin is enabled
* so hack it with op if it is not. */
if (wasonchannel)
msptr->flags |= CHFL_CHANOP;
else {
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
msptr = find_channel_membership(chptr, source_p);
}
set_channel_mode(client_p, source_p, chptr, msptr,
parc - 2, parv + 2);
/* We know they were not opped before and they can't have opped
* themselves as set_channel_mode() does not allow that
* -- jilles */
if (wasonchannel)
msptr->flags &= ~CHFL_CHANOP;
else
remove_user_from_channel(msptr);
}
#endif
return 0;
return 0;
}

View File

@ -37,8 +37,8 @@
static int mo_opme(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message opme_msgtab = {
"OPME", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_opme, 2}}
"OPME", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_opme, 2}}
};
mapi_clist_av1 opme_clist[] = { &opme_msgtab, NULL };
@ -53,62 +53,57 @@ DECLARE_MODULE_AV1(opme, NULL, NULL, opme_clist, NULL, NULL, "$Revision: 3554 $"
static int
mo_opme(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr;
struct membership *msptr;
rb_dlink_node *ptr;
struct Channel *chptr;
struct membership *msptr;
rb_dlink_node *ptr;
/* admins only */
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
/* admins only */
if(!IsOperAdmin(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
if((chptr = find_channel(parv[1])) == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
}
if((chptr = find_channel(parv[1])) == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
}
RB_DLINK_FOREACH(ptr, chptr->members.head)
{
msptr = ptr->data;
RB_DLINK_FOREACH(ptr, chptr->members.head) {
msptr = ptr->data;
if(is_chanop(msptr) || is_admin(msptr) || is_owner(msptr))
{
sendto_one_notice(source_p, ":%s Channel is not opless", parv[1]);
return 0;
}
}
if(is_chanop(msptr) || is_admin(msptr) || is_owner(msptr)) {
sendto_one_notice(source_p, ":%s Channel is not opless", parv[1]);
return 0;
}
}
msptr = find_channel_membership(chptr, source_p);
msptr = find_channel_membership(chptr, source_p);
if(msptr == NULL)
return 0;
if(msptr == NULL)
return 0;
msptr->flags |= CHFL_CHANOP;
msptr->flags |= CHFL_CHANOP;
sendto_wallops_flags(UMODE_WALLOP, &me,
"OPME called for [%s] by %s!%s@%s",
parv[1], source_p->name, source_p->username, source_p->host);
ilog(L_MAIN, "OPME called for [%s] by %s",
parv[1], get_oper_name(source_p));
sendto_wallops_flags(UMODE_WALLOP, &me,
"OPME called for [%s] by %s!%s@%s",
parv[1], source_p->name, source_p->username, source_p->host);
ilog(L_MAIN, "OPME called for [%s] by %s",
parv[1], get_oper_name(source_p));
/* dont send stuff for local channels remotely. */
if(*chptr->chname != '&')
{
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
":%s WALLOPS :OPME called for [%s] by %s!%s@%s",
me.name, parv[1], source_p->name, source_p->username, source_p->host);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS, ":%s PART %s", source_p->id, parv[1]);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :@%s",
me.id, (long) chptr->channelts, parv[1], source_p->id);
}
/* dont send stuff for local channels remotely. */
if(*chptr->chname != '&') {
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
":%s WALLOPS :OPME called for [%s] by %s!%s@%s",
me.name, parv[1], source_p->name, source_p->username, source_p->host);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS, ":%s PART %s", source_p->id, parv[1]);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s SJOIN %ld %s + :@%s",
me.id, (long) chptr->channelts, parv[1], source_p->id);
}
sendto_channel_local(ALL_MEMBERS, chptr,
":%s MODE %s +o %s", me.name, parv[1], source_p->name);
sendto_channel_local(ALL_MEMBERS, chptr,
":%s MODE %s +o %s", me.name, parv[1], source_p->name);
return 0;
return 0;
}

View File

@ -6,9 +6,9 @@
* to clearly show that it is fake. SCENE is a special case and not underlined.
* these commands only work on channels set +N
*
* also adds oper commands FSAY and FACTION, which are like NPC and NPCA
* also adds oper commands FSAY and FACTION, which are like NPC and NPCA
* except without the underline.
*
*
* all of these messages have the hostmask npc.fakeuser.invalid, and their ident
* is the nickname of the user running the commands.
*/
@ -39,57 +39,57 @@ static unsigned int mymode;
static int
_modinit(void)
{
/* initalize the +N cmode */
mymode = cflag_add('N', chm_simple);
if (mymode == 0)
return -1;
/* initalize the +N cmode */
mymode = cflag_add('N', chm_simple);
if (mymode == 0)
return -1;
return 0;
return 0;
}
static void
_moddeinit(void)
{
/* orphan the +N cmode on modunload */
cflag_orphan('N');
/* orphan the +N cmode on modunload */
cflag_orphan('N');
}
struct Message scene_msgtab = {
"SCENE", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_scene, 3}, mg_ignore, mg_ignore, mg_ignore, {m_scene, 3}}
"SCENE", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_scene, 3}, mg_ignore, mg_ignore, mg_ignore, {m_scene, 3}}
};
/* this serves as an alias for people who are used to inspircd/unreal m_roleplay */
struct Message ambiance_msgtab = {
"AMBIANCE", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_scene, 3}, mg_ignore, mg_ignore, mg_ignore, {m_scene, 3}}
};
"AMBIANCE", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_scene, 3}, mg_ignore, mg_ignore, mg_ignore, {m_scene, 3}}
};
struct Message fsay_msgtab = {
"FSAY", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_npc, 4}, mg_ignore, mg_ignore, mg_ignore, {m_fsay, 4}}
};
"FSAY", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_npc, 4}, mg_ignore, mg_ignore, mg_ignore, {m_fsay, 4}}
};
struct Message faction_msgtab = {
"FACTION", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_npca, 4}, mg_ignore, mg_ignore, mg_ignore, {m_faction, 4}}
};
"FACTION", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_npca, 4}, mg_ignore, mg_ignore, mg_ignore, {m_faction, 4}}
};
struct Message npc_msgtab = {
"NPC", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_npc, 4}, mg_ignore, mg_ignore, mg_ignore, {m_npc, 4}}
};
"NPC", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_npc, 4}, mg_ignore, mg_ignore, mg_ignore, {m_npc, 4}}
};
struct Message npca_msgtab = {
"NPCA", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_npca, 4}, mg_ignore, mg_ignore, mg_ignore, {m_npca, 4}}
};
"NPCA", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_npca, 4}, mg_ignore, mg_ignore, mg_ignore, {m_npca, 4}}
};
struct Message roleplay_msgtab = {
"ROLEPLAY", 0, 0, 0, MFLG_SLOW,
{mg_ignore, mg_ignore, mg_ignore, mg_ignore, {me_roleplay, 4}, mg_ignore}
};
"ROLEPLAY", 0, 0, 0, MFLG_SLOW,
{mg_ignore, mg_ignore, mg_ignore, mg_ignore, {me_roleplay, 4}, mg_ignore}
};
mapi_clist_av1 roleplay_clist[] = { &scene_msgtab, &ambiance_msgtab, &fsay_msgtab, &faction_msgtab, &npc_msgtab, &npca_msgtab, &roleplay_msgtab, NULL };
@ -98,118 +98,112 @@ DECLARE_MODULE_AV1(roleplay, _modinit, _moddeinit, roleplay_clist, NULL, NULL, "
static int
m_scene(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
m_displaymsg(source_p, parv[1], 0, 0, "=Scene=", parv[2]);
return 0;
m_displaymsg(source_p, parv[1], 0, 0, "=Scene=", parv[2]);
return 0;
}
static int
m_fsay(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
m_displaymsg(source_p, parv[1], 0, 0, parv[2], parv[3]);
return 0;
m_displaymsg(source_p, parv[1], 0, 0, parv[2], parv[3]);
return 0;
}
static int
m_faction(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
m_displaymsg(source_p, parv[1], 0, 1, parv[2], parv[3]);
return 0;
m_displaymsg(source_p, parv[1], 0, 1, parv[2], parv[3]);
return 0;
}
static int
m_npc(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
m_displaymsg(source_p, parv[1], 1, 0, parv[2], parv[3]);
return 0;
m_displaymsg(source_p, parv[1], 1, 0, parv[2], parv[3]);
return 0;
}
static int
m_npca(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
m_displaymsg(source_p, parv[1], 1, 1, parv[2], parv[3]);
return 0;
m_displaymsg(source_p, parv[1], 1, 1, parv[2], parv[3]);
return 0;
}
static int
m_displaymsg(struct Client *source_p, const char *channel, int underline, int action, const char *nick, const char *text)
{
struct Channel *chptr;
struct membership *msptr;
char nick2[NICKLEN+1];
char *nick3 = rb_strdup(nick);
char text2[BUFSIZE];
struct Channel *chptr;
struct membership *msptr;
char nick2[NICKLEN+1];
char *nick3 = rb_strdup(nick);
char text2[BUFSIZE];
if((chptr = find_channel(channel)) == NULL)
{
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), channel);
return 0;
}
if((chptr = find_channel(channel)) == NULL) {
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), channel);
return 0;
}
if(!(msptr = find_channel_membership(chptr, source_p)))
{
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), chptr->chname);
return 0;
}
if(!(msptr = find_channel_membership(chptr, source_p))) {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), chptr->chname);
return 0;
}
if(!(chptr->mode.mode & chmode_flags['N']))
{
sendto_one_numeric(source_p, 573, "%s :Roleplay commands are not enabled on this channel.", chptr->chname);
return 0;
}
if(!(chptr->mode.mode & chmode_flags['N'])) {
sendto_one_numeric(source_p, 573, "%s :Roleplay commands are not enabled on this channel.", chptr->chname);
return 0;
}
if(!can_send(chptr, source_p, msptr))
{
sendto_one_numeric(source_p, 573, "%s :Cannot send to channel.", chptr->chname);
return 0;
}
if(!can_send(chptr, source_p, msptr)) {
sendto_one_numeric(source_p, 573, "%s :Cannot send to channel.", chptr->chname);
return 0;
}
/* enforce flood stuff on roleplay commands */
if(flood_attack_channel(0, source_p, chptr, chptr->chname))
return 0;
/* enforce flood stuff on roleplay commands */
if(flood_attack_channel(0, source_p, chptr, chptr->chname))
return 0;
/* enforce target change on roleplay commands */
if(!is_chanop_voiced(msptr) && !IsOper(source_p) && !add_channel_target(source_p, chptr))
{
sendto_one(source_p, form_str(ERR_TARGCHANGE),
me.name, source_p->name, chptr->chname);
return 0;
}
/* enforce target change on roleplay commands */
if(!is_chanop_voiced(msptr) && !IsOper(source_p) && !add_channel_target(source_p, chptr)) {
sendto_one(source_p, form_str(ERR_TARGCHANGE),
me.name, source_p->name, chptr->chname);
return 0;
}
if(underline)
rb_snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3));
else
rb_snprintf(nick2, sizeof(nick2), "%s", strip_unprintable(nick3));
if(underline)
rb_snprintf(nick2, sizeof(nick2), "\x1F%s\x1F", strip_unprintable(nick3));
else
rb_snprintf(nick2, sizeof(nick2), "%s", strip_unprintable(nick3));
/* don't allow nicks to be empty after stripping
* this prevents nastiness like fake factions, etc. */
if(EmptyString(nick3))
{
sendto_one_numeric(source_p, 573, "%s :No visible non-stripped characters in nick.", chptr->chname);
return 0;
}
/* don't allow nicks to be empty after stripping
* this prevents nastiness like fake factions, etc. */
if(EmptyString(nick3)) {
sendto_one_numeric(source_p, 573, "%s :No visible non-stripped characters in nick.", chptr->chname);
return 0;
}
if(action)
rb_snprintf(text2, sizeof(text2), "\1ACTION %s\1", text);
else
rb_snprintf(text2, sizeof(text2), "%s", text);
if(action)
rb_snprintf(text2, sizeof(text2), "\1ACTION %s\1", text);
else
rb_snprintf(text2, sizeof(text2), "%s", text);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s (%s)", nick2, source_p->name, channel, text2, source_p->name);
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s",
channel, nick2, text2);
return 0;
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s (%s)", nick2, source_p->name, channel, text2, source_p->name);
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s",
channel, nick2, text2);
return 0;
}
static int
me_roleplay(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr;
struct Channel *chptr;
/* Don't segfault if we get ROLEPLAY with an invalid channel.
* This shouldn't happen but it's best to be on the safe side. */
if((chptr = find_channel(parv[1])) == NULL)
return 0;
/* Don't segfault if we get ROLEPLAY with an invalid channel.
* This shouldn't happen but it's best to be on the safe side. */
if((chptr = find_channel(parv[1])) == NULL)
return 0;
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s (%s)", parv[2], source_p->name, parv[1], parv[3], source_p->name);
return 0;
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s (%s)", parv[2], source_p->name, parv[1], parv[3], source_p->name);
return 0;
}

View File

@ -46,130 +46,120 @@
static int mo_sendbans(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message sendbans_msgtab = {
"SENDBANS", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_sendbans, 2}}
"SENDBANS", 0, 0, 0, MFLG_SLOW,
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_sendbans, 2}}
};
mapi_clist_av1 sendbans_clist[] = {
&sendbans_msgtab,
NULL
&sendbans_msgtab,
NULL
};
DECLARE_MODULE_AV1(sendbans, NULL, NULL, sendbans_clist, NULL, NULL, "$Revision$");
static const char *expand_xline(const char *mask)
{
static char buf[512];
const char *p;
char *q;
static char buf[512];
const char *p;
char *q;
if (!strchr(mask, ' '))
return mask;
if (strlen(mask) > 250)
return NULL;
p = mask;
q = buf;
while (*p != '\0')
{
if (*p == ' ')
*q++ = '\\', *q++ = 's';
else
*q++ = *p;
p++;
}
*q = '\0';
return buf;
if (!strchr(mask, ' '))
return mask;
if (strlen(mask) > 250)
return NULL;
p = mask;
q = buf;
while (*p != '\0') {
if (*p == ' ')
*q++ = '\\', *q++ = 's';
else
*q++ = *p;
p++;
}
*q = '\0';
return buf;
}
static int mo_sendbans(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct ConfItem *aconf;
rb_dlink_node *ptr;
int i, count;
const char *target, *mask2;
struct Client *server_p;
struct ConfItem *aconf;
rb_dlink_node *ptr;
int i, count;
const char *target, *mask2;
struct Client *server_p;
if (!IsOperRemoteBan(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban");
return 0;
}
if (!IsOperXline(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "xline");
return 0;
}
if (!IsOperResv(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "resv");
return 0;
}
if (!IsOperRemoteBan(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban");
return 0;
}
if (!IsOperXline(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "xline");
return 0;
}
if (!IsOperResv(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "resv");
return 0;
}
target = parv[1];
count = 0;
RB_DLINK_FOREACH(ptr, global_serv_list.head)
{
server_p = ptr->data;
if (IsMe(server_p))
continue;
if (match(target, server_p->name))
count++;
}
if (count == 0)
{
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
form_str(ERR_NOSUCHSERVER), target);
return 0;
}
target = parv[1];
count = 0;
RB_DLINK_FOREACH(ptr, global_serv_list.head) {
server_p = ptr->data;
if (IsMe(server_p))
continue;
if (match(target, server_p->name))
count++;
}
if (count == 0) {
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
form_str(ERR_NOSUCHSERVER), target);
return 0;
}
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"%s!%s@%s is sending resvs and xlines to %s",
source_p->name, source_p->username, source_p->host,
target);
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"%s!%s@%s is sending resvs and xlines to %s",
source_p->name, source_p->username, source_p->host,
target);
RB_DLINK_FOREACH(ptr, resv_conf_list.head)
{
aconf = ptr->data;
if (aconf->hold)
continue;
sendto_match_servs(source_p, target,
CAP_ENCAP, NOCAPS,
"ENCAP %s RESV 0 %s 0 :%s",
target, aconf->host, aconf->passwd);
}
RB_DLINK_FOREACH(ptr, resv_conf_list.head) {
aconf = ptr->data;
if (aconf->hold)
continue;
sendto_match_servs(source_p, target,
CAP_ENCAP, NOCAPS,
"ENCAP %s RESV 0 %s 0 :%s",
target, aconf->host, aconf->passwd);
}
HASH_WALK(i, R_MAX, ptr, resvTable)
{
aconf = ptr->data;
if (aconf->hold)
continue;
sendto_match_servs(source_p, target,
CAP_ENCAP, NOCAPS,
"ENCAP %s RESV 0 %s 0 :%s",
target, aconf->host, aconf->passwd);
}
HASH_WALK_END
HASH_WALK(i, R_MAX, ptr, resvTable) {
aconf = ptr->data;
if (aconf->hold)
continue;
sendto_match_servs(source_p, target,
CAP_ENCAP, NOCAPS,
"ENCAP %s RESV 0 %s 0 :%s",
target, aconf->host, aconf->passwd);
}
HASH_WALK_END
RB_DLINK_FOREACH(ptr, xline_conf_list.head)
{
aconf = ptr->data;
if (aconf->hold)
continue;
mask2 = expand_xline(aconf->host);
if (mask2 == NULL)
{
sendto_one_notice(source_p, ":Skipping xline [%s]",
aconf->host);
continue;
}
sendto_match_servs(source_p, target,
CAP_ENCAP, NOCAPS,
"ENCAP %s XLINE 0 %s 2 :%s",
target, mask2, aconf->passwd);
}
RB_DLINK_FOREACH(ptr, xline_conf_list.head) {
aconf = ptr->data;
if (aconf->hold)
continue;
mask2 = expand_xline(aconf->host);
if (mask2 == NULL) {
sendto_one_notice(source_p, ":Skipping xline [%s]",
aconf->host);
continue;
}
sendto_match_servs(source_p, target,
CAP_ENCAP, NOCAPS,
"ENCAP %s XLINE 0 %s 2 :%s",
target, mask2, aconf->passwd);
}
return 0;
return 0;
}

View File

@ -57,8 +57,8 @@
static int mr_webirc(struct Client *, struct Client *, int, const char **);
struct Message webirc_msgtab = {
"WEBIRC", 0, 0, 0, MFLG_SLOW | MFLG_UNREG,
{{mr_webirc, 5}, mg_reg, mg_ignore, mg_ignore, mg_ignore, mg_reg}
"WEBIRC", 0, 0, 0, MFLG_SLOW | MFLG_UNREG,
{{mr_webirc, 5}, mg_reg, mg_ignore, mg_ignore, mg_ignore, mg_reg}
};
mapi_clist_av1 webirc_clist[] = { &webirc_msgtab, NULL };
@ -68,74 +68,68 @@ DECLARE_MODULE_AV1(webirc, NULL, NULL, webirc_clist, NULL, NULL, "$Revision: 207
* mr_webirc - webirc message handler
* parv[1] = password
* parv[2] = fake username (we ignore this)
* parv[3] = fake hostname
* parv[3] = fake hostname
* parv[4] = fake ip
*/
static int
mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct ConfItem *aconf;
const char *encr;
struct ConfItem *aconf;
const char *encr;
if (!strchr(parv[4], '.') && !strchr(parv[4], ':'))
{
sendto_one(source_p, "NOTICE * :Invalid IP");
return 0;
}
if (!strchr(parv[4], '.') && !strchr(parv[4], ':')) {
sendto_one(source_p, "NOTICE * :Invalid IP");
return 0;
}
aconf = find_address_conf(client_p->host, client_p->sockhost,
IsGotId(client_p) ? client_p->username : "webirc",
IsGotId(client_p) ? client_p->username : "webirc",
(struct sockaddr *) &client_p->localClient->ip,
client_p->localClient->ip.ss_family, NULL);
if (aconf == NULL || !(aconf->status & CONF_CLIENT))
return 0;
if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc."))
{
/* XXX */
sendto_one(source_p, "NOTICE * :Not a CGI:IRC auth block");
return 0;
}
if (EmptyString(aconf->passwd))
{
sendto_one(source_p, "NOTICE * :CGI:IRC auth blocks must have a password");
return 0;
}
aconf = find_address_conf(client_p->host, client_p->sockhost,
IsGotId(client_p) ? client_p->username : "webirc",
IsGotId(client_p) ? client_p->username : "webirc",
(struct sockaddr *) &client_p->localClient->ip,
client_p->localClient->ip.ss_family, NULL);
if (aconf == NULL || !(aconf->status & CONF_CLIENT))
return 0;
if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc.")) {
/* XXX */
sendto_one(source_p, "NOTICE * :Not a CGI:IRC auth block");
return 0;
}
if (EmptyString(aconf->passwd)) {
sendto_one(source_p, "NOTICE * :CGI:IRC auth blocks must have a password");
return 0;
}
if (EmptyString(parv[1]))
encr = "";
else if (IsConfEncrypted(aconf))
encr = rb_crypt(parv[1], aconf->passwd);
else
encr = parv[1];
if (EmptyString(parv[1]))
encr = "";
else if (IsConfEncrypted(aconf))
encr = rb_crypt(parv[1], aconf->passwd);
else
encr = parv[1];
if (strcmp(encr, aconf->passwd))
{
sendto_one(source_p, "NOTICE * :CGI:IRC password incorrect");
return 0;
}
if (strcmp(encr, aconf->passwd)) {
sendto_one(source_p, "NOTICE * :CGI:IRC password incorrect");
return 0;
}
rb_strlcpy(source_p->sockhost, parv[4], sizeof(source_p->sockhost));
rb_strlcpy(source_p->sockhost, parv[4], sizeof(source_p->sockhost));
if(strlen(parv[3]) <= HOSTLEN)
rb_strlcpy(source_p->host, parv[3], sizeof(source_p->host));
else
rb_strlcpy(source_p->host, source_p->sockhost, sizeof(source_p->host));
rb_inet_pton_sock(parv[4], (struct sockaddr *)&source_p->localClient->ip);
if(strlen(parv[3]) <= HOSTLEN)
rb_strlcpy(source_p->host, parv[3], sizeof(source_p->host));
else
rb_strlcpy(source_p->host, source_p->sockhost, sizeof(source_p->host));
/* Check dlines now, klines will be checked on registration */
if((aconf = find_dline((struct sockaddr *)&source_p->localClient->ip,
source_p->localClient->ip.ss_family)))
{
if(!(aconf->status & CONF_EXEMPTDLINE))
{
exit_client(client_p, source_p, &me, "D-lined");
return 0;
}
}
rb_inet_pton_sock(parv[4], (struct sockaddr *)&source_p->localClient->ip);
sendto_one(source_p, "NOTICE * :CGI:IRC host/IP set to %s %s", parv[3], parv[4]);
return 0;
/* Check dlines now, klines will be checked on registration */
if((aconf = find_dline((struct sockaddr *)&source_p->localClient->ip,
source_p->localClient->ip.ss_family))) {
if(!(aconf->status & CONF_EXEMPTDLINE)) {
exit_client(client_p, source_p, &me, "D-lined");
return 0;
}
}
sendto_one(source_p, "NOTICE * :CGI:IRC host/IP set to %s %s", parv[3], parv[4]);
return 0;
}

View File

@ -15,8 +15,8 @@
static void h_nl_umode_changed(hook_data_umode_changed *);
mapi_hfn_list_av1 nl_hfnlist[] = {
{ "umode_changed", (hookfn) h_nl_umode_changed },
{ NULL, NULL }
{ "umode_changed", (hookfn) h_nl_umode_changed },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(no_locops, NULL, NULL, NULL, NULL, nl_hfnlist, "$Revision: 3219 $");
@ -24,10 +24,9 @@ DECLARE_MODULE_AV1(no_locops, NULL, NULL, NULL, NULL, nl_hfnlist, "$Revision: 32
static void
h_nl_umode_changed(hook_data_umode_changed *hdata)
{
struct Client *source_p = hdata->client;
struct Client *source_p = hdata->client;
if (MyClient(source_p) && source_p->umodes & UMODE_LOCOPS)
{
source_p->umodes &= ~UMODE_LOCOPS;
}
if (MyClient(source_p) && source_p->umodes & UMODE_LOCOPS) {
source_p->umodes &= ~UMODE_LOCOPS;
}
}

View File

@ -17,8 +17,8 @@
static void h_noi_umode_changed(hook_data_umode_changed *);
mapi_hfn_list_av1 noi_hfnlist[] = {
{ "umode_changed", (hookfn) h_noi_umode_changed },
{ NULL, NULL }
{ "umode_changed", (hookfn) h_noi_umode_changed },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(no_oper_invis, NULL, NULL, NULL, NULL, noi_hfnlist, "$Revision: 3219 $");
@ -26,15 +26,14 @@ DECLARE_MODULE_AV1(no_oper_invis, NULL, NULL, NULL, NULL, noi_hfnlist, "$Revisio
static void
h_noi_umode_changed(hook_data_umode_changed *hdata)
{
struct Client *source_p = hdata->client;
struct Client *source_p = hdata->client;
if (MyClient(source_p) && IsOper(source_p) && !IsOperInvis(source_p) &&
IsInvisible(source_p))
{
ClearInvisible(source_p);
/* If they tried /umode +i, complain; do not complain
* if they opered up while invisible -- jilles */
if (hdata->oldumodes & UMODE_OPER)
sendto_one_notice(source_p, ":*** Opers may not set themselves invisible");
}
if (MyClient(source_p) && IsOper(source_p) && !IsOperInvis(source_p) &&
IsInvisible(source_p)) {
ClearInvisible(source_p);
/* If they tried /umode +i, complain; do not complain
* if they opered up while invisible -- jilles */
if (hdata->oldumodes & UMODE_OPER)
sendto_one_notice(source_p, ":*** Opers may not set themselves invisible");
}
}

View File

@ -22,9 +22,9 @@ static void h_gcn_new_remote_user(struct Client *);
static void h_gcn_client_exit(hook_data_client_exit *);
mapi_hfn_list_av1 gcn_hfnlist[] = {
{ "new_remote_user", (hookfn) h_gcn_new_remote_user },
{ "client_exit", (hookfn) h_gcn_client_exit },
{ NULL, NULL }
{ "new_remote_user", (hookfn) h_gcn_new_remote_user },
{ "client_exit", (hookfn) h_gcn_client_exit },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(globalconnexit, _modinit, _moddeinit, NULL, NULL, gcn_hfnlist, "$Revision: 1869 $");
@ -32,49 +32,49 @@ DECLARE_MODULE_AV1(globalconnexit, _modinit, _moddeinit, NULL, NULL, gcn_hfnlist
static int
_modinit(void)
{
/* add the snomask to the available slot */
snomask_modes['F'] = find_snomask_slot();
/* add the snomask to the available slot */
snomask_modes['F'] = find_snomask_slot();
/* show the fact that we are showing user information in /version */
opers_see_all_users = 1;
/* show the fact that we are showing user information in /version */
opers_see_all_users = 1;
return 0;
return 0;
}
static void
_moddeinit(void)
{
/* disable the snomask and remove it from the available list */
snomask_modes['F'] = 0;
/* disable the snomask and remove it from the available list */
snomask_modes['F'] = 0;
}
static void
h_gcn_new_remote_user(struct Client *source_p)
{
if (!HasSentEob(source_p->servptr))
return;
sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
"Client connecting: %s (%s@%s) [%s] {%s} [%s]",
source_p->name, source_p->username, source_p->orighost,
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255",
"?", source_p->info);
if (!HasSentEob(source_p->servptr))
return;
sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
"Client connecting: %s (%s@%s) [%s] {%s} [%s]",
source_p->name, source_p->username, source_p->orighost,
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255",
"?", source_p->info);
}
static void
h_gcn_client_exit(hook_data_client_exit *hdata)
{
struct Client *source_p;
struct Client *source_p;
source_p = hdata->target;
source_p = hdata->target;
if (MyConnect(source_p) || !IsClient(source_p))
return;
if (!HasSentEob(source_p->servptr))
return;
sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
"Client exiting: %s (%s@%s) [%s] [%s]",
source_p->name,
source_p->username, source_p->host, hdata->comment,
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255");
if (MyConnect(source_p) || !IsClient(source_p))
return;
if (!HasSentEob(source_p->servptr))
return;
sendto_realops_snomask_from(snomask_modes['F'], L_ALL, source_p->servptr,
"Client exiting: %s (%s@%s) [%s] [%s]",
source_p->name,
source_p->username, source_p->host, hdata->comment,
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255");
}

View File

@ -19,8 +19,8 @@
static void h_gla_client_exit(hook_data_client_exit *);
mapi_hfn_list_av1 gla_hfnlist[] = {
{ "client_exit", (hookfn) h_gla_client_exit },
{ NULL, NULL }
{ "client_exit", (hookfn) h_gla_client_exit },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(globallineactive, NULL, NULL, NULL, NULL, gla_hfnlist, "$Revision: 613 $");
@ -28,35 +28,28 @@ DECLARE_MODULE_AV1(globallineactive, NULL, NULL, NULL, NULL, gla_hfnlist, "$Revi
static void
h_gla_client_exit(hook_data_client_exit *hdata)
{
struct Client *source_p;
struct Client *source_p;
source_p = hdata->target;
source_p = hdata->target;
if (MyConnect(source_p) || !IsClient(source_p))
return;
if (!strcmp(hdata->comment, "Bad user info"))
{
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"XLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
}
else if (ConfigFileEntry.kline_reason != NULL &&
!strcmp(hdata->comment, ConfigFileEntry.kline_reason))
{
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"K/DLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
}
else if (!strncmp(hdata->comment, "Temporary K-line ", 17))
{
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"K/DLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
}
else if (!strncmp(hdata->comment, "Temporary D-line ", 17))
{
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"K/DLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
}
if (MyConnect(source_p) || !IsClient(source_p))
return;
if (!strcmp(hdata->comment, "Bad user info")) {
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"XLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
} else if (ConfigFileEntry.kline_reason != NULL &&
!strcmp(hdata->comment, ConfigFileEntry.kline_reason)) {
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"K/DLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
} else if (!strncmp(hdata->comment, "Temporary K-line ", 17)) {
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"K/DLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
} else if (!strncmp(hdata->comment, "Temporary D-line ", 17)) {
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"K/DLINE active for %s[%s@%s]",
source_p->name, source_p->username, source_p->host);
}
}

View File

@ -15,8 +15,8 @@
static void h_sgo_umode_changed(void *);
mapi_hfn_list_av1 sgo_hfnlist[] = {
{ "umode_changed", (hookfn) h_sgo_umode_changed },
{ NULL, NULL }
{ "umode_changed", (hookfn) h_sgo_umode_changed },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(sno_globaloper, NULL, NULL, NULL, NULL, sgo_hfnlist, "$Revision: 639 $");
@ -24,14 +24,14 @@ DECLARE_MODULE_AV1(sno_globaloper, NULL, NULL, NULL, NULL, sgo_hfnlist, "$Revisi
static void
h_sgo_umode_changed(void *vdata)
{
hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
struct Client *source_p = data->client;
hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
struct Client *source_p = data->client;
if (MyConnect(source_p) || !HasSentEob(source_p->servptr))
return;
if (MyConnect(source_p) || !HasSentEob(source_p->servptr))
return;
if (!(data->oldumodes & UMODE_OPER) && IsOper(source_p))
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"%s (%s@%s) is now an operator",
source_p->name, source_p->username, source_p->host);
if (!(data->oldumodes & UMODE_OPER) && IsOper(source_p))
sendto_realops_snomask_from(SNO_GENERAL, L_ALL, source_p->servptr,
"%s (%s@%s) is now an operator",
source_p->name, source_p->username, source_p->host);
}

View File

@ -20,23 +20,23 @@
void show_whois(hook_data_client *);
mapi_hfn_list_av1 whois_hfnlist[] = {
{"doing_whois", (hookfn) show_whois},
{"doing_whois_global", (hookfn) show_whois},
{NULL, NULL}
{"doing_whois", (hookfn) show_whois},
{"doing_whois_global", (hookfn) show_whois},
{NULL, NULL}
};
static int
init(void)
{
snomask_modes['W'] = find_snomask_slot();
snomask_modes['W'] = find_snomask_slot();
return 0;
return 0;
}
static void
fini(void)
{
snomask_modes['W'] = find_snomask_slot();
snomask_modes['W'] = find_snomask_slot();
}
DECLARE_MODULE_AV1(sno_whois, init, fini, NULL, NULL, whois_hfnlist, "$Revision: 3498 $");
@ -44,20 +44,19 @@ DECLARE_MODULE_AV1(sno_whois, init, fini, NULL, NULL, whois_hfnlist, "$Revision:
void
show_whois(hook_data_client *data)
{
struct Client *source_p = data->client;
struct Client *target_p = data->target;
struct Client *source_p = data->client;
struct Client *target_p = data->target;
if(MyClient(target_p) &&
if(MyClient(target_p) &&
#ifdef OPERONLY
IsOper(target_p) &&
IsOper(target_p) &&
#endif
(source_p != target_p) &&
(target_p->snomask & snomask_modes['W']))
{
sendto_one_notice(target_p,
":*** Notice -- %s (%s@%s) is doing a whois on you [%s]",
source_p->name,
source_p->username, source_p->host,
source_p->servptr->name);
}
(source_p != target_p) &&
(target_p->snomask & snomask_modes['W'])) {
sendto_one_notice(target_p,
":*** Notice -- %s (%s@%s) is doing a whois on you [%s]",
source_p->name,
source_p->username, source_p->host,
source_p->servptr->name);
}
}

View File

@ -30,8 +30,8 @@
void show_admin(hook_data *);
mapi_hfn_list_av1 admin_hfnlist[] = {
{"doing_admin", (hookfn) show_admin},
{NULL, NULL}
{"doing_admin", (hookfn) show_admin},
{NULL, NULL}
};
DECLARE_MODULE_AV1(admin_spy, NULL, NULL, NULL, NULL, admin_hfnlist, "$Revision: 498 $");
@ -39,8 +39,8 @@ DECLARE_MODULE_AV1(admin_spy, NULL, NULL, NULL, NULL, admin_hfnlist, "$Revision:
void
show_admin(hook_data *data)
{
sendto_realops_snomask(SNO_SPY, L_ALL,
"admin requested by %s (%s@%s) [%s]",
data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
sendto_realops_snomask(SNO_SPY, L_ALL,
"admin requested by %s (%s@%s) [%s]",
data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
}

View File

@ -30,8 +30,8 @@
void show_info(hook_data *);
mapi_hfn_list_av1 info_hfnlist[] = {
{"doing_info", (hookfn) show_info},
{NULL, NULL}
{"doing_info", (hookfn) show_info},
{NULL, NULL}
};
DECLARE_MODULE_AV1(info_spy, NULL, NULL, NULL, NULL, info_hfnlist, "$Revision: 498 $");
@ -39,8 +39,8 @@ DECLARE_MODULE_AV1(info_spy, NULL, NULL, NULL, NULL, info_hfnlist, "$Revision: 4
void
show_info(hook_data *data)
{
sendto_realops_snomask(SNO_SPY, L_ALL,
"info requested by %s (%s@%s) [%s]",
data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
sendto_realops_snomask(SNO_SPY, L_ALL,
"info requested by %s (%s@%s) [%s]",
data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
}

View File

@ -30,8 +30,8 @@
void show_links(hook_data *);
mapi_hfn_list_av1 links_hfnlist[] = {
{"doing_links", (hookfn) show_links},
{NULL, NULL}
{"doing_links", (hookfn) show_links},
{NULL, NULL}
};
DECLARE_MODULE_AV1(links_spy, NULL, NULL, NULL, NULL, links_hfnlist, "$Revision: 498 $");
@ -39,10 +39,10 @@ DECLARE_MODULE_AV1(links_spy, NULL, NULL, NULL, NULL, links_hfnlist, "$Revision:
void
show_links(hook_data *data)
{
const char *mask = data->arg1;
const char *mask = data->arg1;
sendto_realops_snomask(SNO_SPY, L_ALL,
"LINKS '%s' requested by %s (%s@%s) [%s]",
mask, data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
sendto_realops_snomask(SNO_SPY, L_ALL,
"LINKS '%s' requested by %s (%s@%s) [%s]",
mask, data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
}

View File

@ -30,8 +30,8 @@
void show_motd(hook_data *);
mapi_hfn_list_av1 motd_hfnlist[] = {
{"doing_motd", (hookfn) show_motd},
{NULL, NULL}
{"doing_motd", (hookfn) show_motd},
{NULL, NULL}
};
DECLARE_MODULE_AV1(motd_spy, NULL, NULL, NULL, NULL, motd_hfnlist, "$Revision: 498 $");
@ -39,8 +39,8 @@ DECLARE_MODULE_AV1(motd_spy, NULL, NULL, NULL, NULL, motd_hfnlist, "$Revision: 4
void
show_motd(hook_data *data)
{
sendto_realops_snomask(SNO_SPY, L_ALL,
"motd requested by %s (%s@%s) [%s]",
data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
sendto_realops_snomask(SNO_SPY, L_ALL,
"motd requested by %s (%s@%s) [%s]",
data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
}

View File

@ -30,8 +30,8 @@
void show_stats(hook_data_int *);
mapi_hfn_list_av1 stats_hfnlist[] = {
{"doing_stats", (hookfn) show_stats},
{NULL, NULL}
{"doing_stats", (hookfn) show_stats},
{NULL, NULL}
};
DECLARE_MODULE_AV1(stats_spy, NULL, NULL, NULL, NULL, stats_hfnlist, "$Revision: 498 $");
@ -39,31 +39,28 @@ DECLARE_MODULE_AV1(stats_spy, NULL, NULL, NULL, NULL, stats_hfnlist, "$Revision:
void
show_stats(hook_data_int *data)
{
char statchar = (char) data->arg2;
char statchar = (char) data->arg2;
if(statchar == 'L' || statchar == 'l')
{
const char *name = data->arg1;
if(statchar == 'L' || statchar == 'l') {
const char *name = data->arg1;
if(!EmptyString(name))
sendto_realops_snomask(SNO_SPY, L_ALL,
"STATS %c requested by %s (%s@%s) [%s] on %s",
statchar, data->client->name,
data->client->username,
data->client->host,
data->client->servptr->name, name);
else
sendto_realops_snomask(SNO_SPY, L_ALL,
"STATS %c requested by %s (%s@%s) [%s]",
statchar, data->client->name,
data->client->username,
data->client->host, data->client->servptr->name);
}
else
{
sendto_realops_snomask(SNO_SPY, L_ALL,
"STATS %c requested by %s (%s@%s) [%s]",
statchar, data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
}
if(!EmptyString(name))
sendto_realops_snomask(SNO_SPY, L_ALL,
"STATS %c requested by %s (%s@%s) [%s] on %s",
statchar, data->client->name,
data->client->username,
data->client->host,
data->client->servptr->name, name);
else
sendto_realops_snomask(SNO_SPY, L_ALL,
"STATS %c requested by %s (%s@%s) [%s]",
statchar, data->client->name,
data->client->username,
data->client->host, data->client->servptr->name);
} else {
sendto_realops_snomask(SNO_SPY, L_ALL,
"STATS %c requested by %s (%s@%s) [%s]",
statchar, data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
}
}

View File

@ -30,8 +30,8 @@
void show_stats_p(hook_data *);
mapi_hfn_list_av1 stats_p_hfnlist[] = {
{"doing_stats_p", (hookfn) show_stats_p},
{NULL, NULL}
{"doing_stats_p", (hookfn) show_stats_p},
{NULL, NULL}
};
DECLARE_MODULE_AV1(stats_p_spy, NULL, NULL, NULL, NULL, stats_p_hfnlist, "$Revision: 498 $");
@ -39,8 +39,8 @@ DECLARE_MODULE_AV1(stats_p_spy, NULL, NULL, NULL, NULL, stats_p_hfnlist, "$Revis
void
show_stats_p(hook_data *data)
{
sendto_realops_snomask(SNO_SPY, L_ALL,
"STATS p requested by %s (%s@%s) [%s]",
data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
sendto_realops_snomask(SNO_SPY, L_ALL,
"STATS p requested by %s (%s@%s) [%s]",
data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
}

View File

@ -30,8 +30,8 @@
void show_trace(hook_data_client *);
mapi_hfn_list_av1 trace_hfnlist[] = {
{"doing_trace", (hookfn) show_trace},
{NULL, NULL}
{"doing_trace", (hookfn) show_trace},
{NULL, NULL}
};
DECLARE_MODULE_AV1(trace_spy, NULL, NULL, NULL, NULL, trace_hfnlist, "$Revision: 498 $");
@ -39,15 +39,15 @@ DECLARE_MODULE_AV1(trace_spy, NULL, NULL, NULL, NULL, trace_hfnlist, "$Revision:
void
show_trace(hook_data_client *data)
{
if(data->target)
sendto_realops_snomask(SNO_SPY, L_ALL,
"trace requested by %s (%s@%s) [%s] on %s",
data->client->name, data->client->username,
data->client->host, data->client->servptr->name,
data->target->name);
else
sendto_realops_snomask(SNO_SPY, L_ALL,
"trace requested by %s (%s@%s) [%s]",
data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
if(data->target)
sendto_realops_snomask(SNO_SPY, L_ALL,
"trace requested by %s (%s@%s) [%s] on %s",
data->client->name, data->client->username,
data->client->host, data->client->servptr->name,
data->target->name);
else
sendto_realops_snomask(SNO_SPY, L_ALL,
"trace requested by %s (%s@%s) [%s]",
data->client->name, data->client->username,
data->client->host, data->client->servptr->name);
}

View File

@ -8,7 +8,7 @@
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
* Based on the original code of Services by Andy Church.
*/
#include "services.h"
@ -17,135 +17,137 @@
#include "version.h"
IRCDVar myIrcd[] = {
{"Elemental-IRCd 6.5", /* ircd name */
"+oiS", /* nickserv mode */
"+oiS", /* chanserv mode */
"+oiS", /* memoserv mode */
"+oiS", /* hostserv mode */
"+oaiS", /* operserv mode */
"+oiS", /* botserv mode */
"+oiS", /* helpserv mode */
"+oiS", /* Dev/Null mode */
"+oiS", /* Global mode */
"+oiS", /* nickserv alias mode */
"+oiS", /* chanserv alias mode */
"+oiS", /* memoserv alias mode */
"+oiS", /* hostserv alias mode */
"+oaiS", /* operserv alias mode */
"+oiS", /* botserv alias mode */
"+oiS", /* helpserv alias mode */
"+oiS", /* Dev/Null alias mode */
"+oiS", /* Global alias mode */
"+oiS", /* Used by BotServ Bots */
2, /* Chan Max Symbols */
"-cijlmnpstrgzQF", /* Modes to Remove */
"+ao", /* Channel Umode used by Botserv bots */
1, /* SVSNICK */
1, /* Vhost */
1, /* Has Owner */
"+y", /* Mode to set for an owner */
"-y", /* Mode to unset for an owner */
"+a", /* Mode to set for chan admin */
"-a", /* Mode to unset for chan admin */
NULL, /* Mode On Reg */
NULL, /* Mode on ID for Roots */
NULL, /* Mode on ID for Admins */
NULL, /* Mode on ID for Opers */
NULL, /* Mode on UnReg */
NULL, /* Mode on Nick Change */
1, /* Supports SGlines */
1, /* Supports SQlines */
1, /* Supports SZlines */
1, /* Supports Halfop +h */
3, /* Number of server args */
1, /* Join 2 Set */
1, /* Join 2 Message */
1, /* Has exceptions +e */
0, /* TS Topic Forward */
0, /* TS Topci Backward */
0, /* Protected Umode */
1, /* Has Admin */
1, /* Chan SQlines */
0, /* Quit on Kill */
0, /* SVSMODE unban */
1, /* Has Protect */
0, /* Reverse */
0, /* Chan Reg */
0, /* Channel Mode */
0, /* vidents */
1, /* svshold */
0, /* time stamp on mode */
0, /* NICKIP */
0, /* UMODE */
0, /* O:LINE */
1, /* VHOST ON NICK */
0, /* Change RealName */
CMODE_p, /* No Knock */
0, /* Admin Only */
DEFAULT_MLOCK, /* Default MLOCK */
0, /* Vhost Mode */
1, /* +f */
1, /* +L */
CMODE_j, /* +f Mode */
CMODE_f, /* +L Mode (+f <target>) */
1, /* On nick change check if they could be identified */
0, /* No Knock requires +i */
NULL, /* CAPAB Chan Modes */
0, /* We support TOKENS */
1, /* TOKENS are CASE inSensitive */
0, /* TIME STAMPS are BASE64 */
1, /* +I support */
0, /* SJOIN ban char */
0, /* SJOIN except char */
0, /* SJOIN invite char */
0, /* Can remove User Channel Modes with SVSMODE */
0, /* Sglines are not enforced until user reconnects */
NULL, /* vhost char */
1, /* ts6 */
0, /* support helper umode */
0, /* p10 */
NULL, /* character set */
0, /* reports sync state */
1, /* CIDR channelbans */
0, /* +j */
0, /* +j Mode */
0, /* Use delayed client introduction. */
}
{
"Elemental-IRCd 6.5", /* ircd name */
"+oiS", /* nickserv mode */
"+oiS", /* chanserv mode */
"+oiS", /* memoserv mode */
"+oiS", /* hostserv mode */
"+oaiS", /* operserv mode */
"+oiS", /* botserv mode */
"+oiS", /* helpserv mode */
"+oiS", /* Dev/Null mode */
"+oiS", /* Global mode */
"+oiS", /* nickserv alias mode */
"+oiS", /* chanserv alias mode */
"+oiS", /* memoserv alias mode */
"+oiS", /* hostserv alias mode */
"+oaiS", /* operserv alias mode */
"+oiS", /* botserv alias mode */
"+oiS", /* helpserv alias mode */
"+oiS", /* Dev/Null alias mode */
"+oiS", /* Global alias mode */
"+oiS", /* Used by BotServ Bots */
2, /* Chan Max Symbols */
"-cijlmnpstrgzQF", /* Modes to Remove */
"+ao", /* Channel Umode used by Botserv bots */
1, /* SVSNICK */
1, /* Vhost */
1, /* Has Owner */
"+y", /* Mode to set for an owner */
"-y", /* Mode to unset for an owner */
"+a", /* Mode to set for chan admin */
"-a", /* Mode to unset for chan admin */
NULL, /* Mode On Reg */
NULL, /* Mode on ID for Roots */
NULL, /* Mode on ID for Admins */
NULL, /* Mode on ID for Opers */
NULL, /* Mode on UnReg */
NULL, /* Mode on Nick Change */
1, /* Supports SGlines */
1, /* Supports SQlines */
1, /* Supports SZlines */
1, /* Supports Halfop +h */
3, /* Number of server args */
1, /* Join 2 Set */
1, /* Join 2 Message */
1, /* Has exceptions +e */
0, /* TS Topic Forward */
0, /* TS Topci Backward */
0, /* Protected Umode */
1, /* Has Admin */
1, /* Chan SQlines */
0, /* Quit on Kill */
0, /* SVSMODE unban */
1, /* Has Protect */
0, /* Reverse */
0, /* Chan Reg */
0, /* Channel Mode */
0, /* vidents */
1, /* svshold */
0, /* time stamp on mode */
0, /* NICKIP */
0, /* UMODE */
0, /* O:LINE */
1, /* VHOST ON NICK */
0, /* Change RealName */
CMODE_p, /* No Knock */
0, /* Admin Only */
DEFAULT_MLOCK, /* Default MLOCK */
0, /* Vhost Mode */
1, /* +f */
1, /* +L */
CMODE_j, /* +f Mode */
CMODE_f, /* +L Mode (+f <target>) */
1, /* On nick change check if they could be identified */
0, /* No Knock requires +i */
NULL, /* CAPAB Chan Modes */
0, /* We support TOKENS */
1, /* TOKENS are CASE inSensitive */
0, /* TIME STAMPS are BASE64 */
1, /* +I support */
0, /* SJOIN ban char */
0, /* SJOIN except char */
0, /* SJOIN invite char */
0, /* Can remove User Channel Modes with SVSMODE */
0, /* Sglines are not enforced until user reconnects */
NULL, /* vhost char */
1, /* ts6 */
0, /* support helper umode */
0, /* p10 */
NULL, /* character set */
0, /* reports sync state */
1, /* CIDR channelbans */
0, /* +j */
0, /* +j Mode */
0, /* Use delayed client introduction. */
}
,
{NULL}
};
IRCDCAPAB myIrcdcap[] = {
{
0, /* NOQUIT */
0, /* TSMODE */
0, /* UNCONNECT */
0, /* NICKIP */
0, /* SJOIN */
CAPAB_ZIP, /* ZIP */
0, /* BURST */
CAPAB_TS5, /* TS5 */
0, /* TS3 */
0, /* DKEY */
0, /* PT4 */
0, /* SCS */
CAPAB_QS, /* QS */
CAPAB_UID, /* UID */
CAPAB_KNOCK, /* KNOCK */
0, /* CLIENT */
0, /* IPV6 */
0, /* SSJ5 */
0, /* SN2 */
0, /* TOKEN */
0, /* VHOST */
0, /* SSJ3 */
0, /* NICK2 */
0, /* UMODE2 */
0, /* VL */
0, /* TLKEXT */
0, /* DODKEY */
0, /* DOZIP */
0, 0, 0}
0, /* NOQUIT */
0, /* TSMODE */
0, /* UNCONNECT */
0, /* NICKIP */
0, /* SJOIN */
CAPAB_ZIP, /* ZIP */
0, /* BURST */
CAPAB_TS5, /* TS5 */
0, /* TS3 */
0, /* DKEY */
0, /* PT4 */
0, /* SCS */
CAPAB_QS, /* QS */
CAPAB_UID, /* UID */
CAPAB_KNOCK, /* KNOCK */
0, /* CLIENT */
0, /* IPV6 */
0, /* SSJ5 */
0, /* SN2 */
0, /* TOKEN */
0, /* VHOST */
0, /* SSJ3 */
0, /* NICK2 */
0, /* UMODE2 */
0, /* VL */
0, /* TLKEXT */
0, /* DODKEY */
0, /* DOZIP */
0, 0, 0
}
};
/*******************************************************************/
@ -471,8 +473,8 @@ void charybdis_cmd_notice(char *source, char *dest, char *buf)
ud = find_uid(source);
u = finduser(dest);
send_cmd((UseTS6 ? (ud ? ud->uid : source) : source),
"NOTICE %s :%s", (UseTS6 ? (u ? u->uid : dest) : dest),
buf);
"NOTICE %s :%s", (UseTS6 ? (u ? u->uid : dest) : dest),
buf);
}
}
@ -484,7 +486,7 @@ void charybdis_cmd_notice2(char *source, char *dest, char *msg)
ud = find_uid(source);
u = finduser(dest);
send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "NOTICE %s :%s",
(UseTS6 ? (u ? u->uid : dest) : dest), msg);
(UseTS6 ? (u ? u->uid : dest) : dest), msg);
}
void charybdis_cmd_privmsg(char *source, char *dest, char *buf)
@ -498,7 +500,7 @@ void charybdis_cmd_privmsg(char *source, char *dest, char *buf)
ud2 = find_uid(dest);
send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "PRIVMSG %s :%s",
(UseTS6 ? (ud2 ? ud2->uid : dest) : dest), buf);
(UseTS6 ? (ud2 ? ud2->uid : dest) : dest), buf);
}
void charybdis_cmd_privmsg2(char *source, char *dest, char *msg)
@ -509,7 +511,7 @@ void charybdis_cmd_privmsg2(char *source, char *dest, char *msg)
ud2 = find_uid(dest);
send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "PRIVMSG %s :%s",
(UseTS6 ? (ud2 ? ud2->uid : dest) : dest), msg);
(UseTS6 ? (ud2 ? ud2->uid : dest) : dest), msg);
}
void charybdis_cmd_serv_notice(char *source, char *dest, char *msg)
@ -645,7 +647,7 @@ int anope_event_euid(char *source, int ac, char **av)
s = findserver_uid(servlist, source);
/* Source is always the server */
*source = '\0';
ts = strtoul(av[2], NULL, 10);
ts = strtoul(av[2], NULL, 10);
user = do_nick(source, av[0], av[4], !strcmp(av[8], "*") ? av[5] : av[8], s->name, av[10],
ts, !stricmp(av[0], av[9]) ? ts : 0, 0, av[5], av[7]);
if (user) {
@ -696,11 +698,11 @@ int anope_event_topic(char *source, int ac, char **av)
c->topic_time = topic_time;
record_topic(av[0]);
if (ac > 1 && *av[1])
send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]);
else
send_event(EVENT_TOPIC_UPDATED, 2, av[0], "");
if (ac > 1 && *av[1])
send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]);
else
send_event(EVENT_TOPIC_UPDATED, 2, av[0], "");
}
return MOD_CONT;
}
@ -748,10 +750,10 @@ int anope_event_tburst(char *source, int ac, char **av)
record_topic(av[0]);
if (ac > 1 && *av[3])
send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[3]);
else
send_event(EVENT_TOPIC_UPDATED, 2, av[0], "");
if (ac > 1 && *av[3])
send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[3]);
else
send_event(EVENT_TOPIC_UPDATED, 2, av[0], "");
if (setter)
free(setter);
@ -770,54 +772,92 @@ int anope_event_436(char *source, int ac, char **av)
/* *INDENT-OFF* */
void moduleAddIRCDMsgs(void)
void moduleAddIRCDMsgs(void)
{
Message *m;
updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+","-");
if (UseTS6) {
TS6SID = sstrdup(Numeric);
}
m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("402", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m);
m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m);
m = createMessage("INVITE", anope_event_invite); addCoreMessage(IRCD,m);
m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m);
m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m);
m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m);
m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m);
m = createMessage("TMODE", anope_event_tmode); addCoreMessage(IRCD,m);
m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m);
m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m);
m = createMessage("BMASK", anope_event_bmask); addCoreMessage(IRCD,m);
m = createMessage("UID", anope_event_nick); addCoreMessage(IRCD,m);
m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m);
m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m);
m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m);
m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m);
m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m);
m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m);
m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m);
m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m);
m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m);
m = createMessage("TB", anope_event_tburst); addCoreMessage(IRCD,m);
m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m);
m = createMessage("SVSMODE", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m);
m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m);
m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m);
m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m);
m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m);
m = createMessage("421", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("ENCAP", anope_event_null); addCoreMessage(IRCD,m);
m = createMessage("SID", anope_event_sid); addCoreMessage(IRCD,m);
m = createMessage("EUID", anope_event_euid); addCoreMessage(IRCD,m);
m = createMessage("401", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("402", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("436", anope_event_436);
addCoreMessage(IRCD,m);
m = createMessage("AWAY", anope_event_away);
addCoreMessage(IRCD,m);
m = createMessage("INVITE", anope_event_invite);
addCoreMessage(IRCD,m);
m = createMessage("JOIN", anope_event_join);
addCoreMessage(IRCD,m);
m = createMessage("KICK", anope_event_kick);
addCoreMessage(IRCD,m);
m = createMessage("KILL", anope_event_kill);
addCoreMessage(IRCD,m);
m = createMessage("MODE", anope_event_mode);
addCoreMessage(IRCD,m);
m = createMessage("TMODE", anope_event_tmode);
addCoreMessage(IRCD,m);
m = createMessage("MOTD", anope_event_motd);
addCoreMessage(IRCD,m);
m = createMessage("NICK", anope_event_nick);
addCoreMessage(IRCD,m);
m = createMessage("BMASK", anope_event_bmask);
addCoreMessage(IRCD,m);
m = createMessage("UID", anope_event_nick);
addCoreMessage(IRCD,m);
m = createMessage("NOTICE", anope_event_notice);
addCoreMessage(IRCD,m);
m = createMessage("PART", anope_event_part);
addCoreMessage(IRCD,m);
m = createMessage("PASS", anope_event_pass);
addCoreMessage(IRCD,m);
m = createMessage("PING", anope_event_ping);
addCoreMessage(IRCD,m);
m = createMessage("PRIVMSG", anope_event_privmsg);
addCoreMessage(IRCD,m);
m = createMessage("QUIT", anope_event_quit);
addCoreMessage(IRCD,m);
m = createMessage("SERVER", anope_event_server);
addCoreMessage(IRCD,m);
m = createMessage("SQUIT", anope_event_squit);
addCoreMessage(IRCD,m);
m = createMessage("TOPIC", anope_event_topic);
addCoreMessage(IRCD,m);
m = createMessage("TB", anope_event_tburst);
addCoreMessage(IRCD,m);
m = createMessage("USER", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("WALLOPS", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("WHOIS", anope_event_whois);
addCoreMessage(IRCD,m);
m = createMessage("SVSMODE", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("SVSNICK", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("CAPAB", anope_event_capab);
addCoreMessage(IRCD,m);
m = createMessage("SJOIN", anope_event_sjoin);
addCoreMessage(IRCD,m);
m = createMessage("SVINFO", anope_event_svinfo);
addCoreMessage(IRCD,m);
m = createMessage("ADMIN", anope_event_admin);
addCoreMessage(IRCD,m);
m = createMessage("ERROR", anope_event_error);
addCoreMessage(IRCD,m);
m = createMessage("421", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("ENCAP", anope_event_null);
addCoreMessage(IRCD,m);
m = createMessage("SID", anope_event_sid);
addCoreMessage(IRCD,m);
m = createMessage("EUID", anope_event_euid);
addCoreMessage(IRCD,m);
}
/* *INDENT-ON* */
@ -829,7 +869,7 @@ void charybdis_cmd_sqline(char *mask, char *reason)
ud = find_uid(s_OperServ);
send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
"RESV * %s :%s", mask, reason);
"RESV * %s :%s", mask, reason);
}
void charybdis_cmd_unsgline(char *mask)
@ -838,7 +878,7 @@ void charybdis_cmd_unsgline(char *mask)
ud = find_uid(s_OperServ);
send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
"UNXLINE * %s", mask);
"UNXLINE * %s", mask);
}
void charybdis_cmd_unszline(char *mask)
@ -867,7 +907,7 @@ void charybdis_cmd_sgline(char *mask, char *reason)
ud = find_uid(s_OperServ);
send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
"XLINE * %s 0 :%s", mask, reason);
"XLINE * %s 0 :%s", mask, reason);
}
void charybdis_cmd_remove_akill(char *user, char *host)
@ -879,17 +919,17 @@ void charybdis_cmd_remove_akill(char *user, char *host)
ud = find_uid(s_OperServ);
send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
"UNKLINE * %s %s", user, host);
"UNKLINE * %s %s", user, host);
}
void charybdis_cmd_topic(char *whosets, char *chan, char *whosetit,
char *topic, time_t when)
char *topic, time_t when)
{
Uid *ud;
ud = find_uid(whosets);
send_cmd((UseTS6 ? (ud ? ud->uid : whosets) : whosets), "TOPIC %s :%s",
chan, topic);
chan, topic);
}
void charybdis_cmd_vhost_off(User * u)
@ -910,7 +950,7 @@ void charybdis_cmd_unsqline(char *user)
ud = find_uid(s_OperServ);
send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
"UNRESV * %s", user);
"UNRESV * %s", user);
}
void charybdis_cmd_join(char *user, char *channel, time_t chantime)
@ -932,15 +972,15 @@ reason: the reason for the kline.
*/
void charybdis_cmd_akill(char *user, char *host, char *who, time_t when,
time_t expires, char *reason)
time_t expires, char *reason)
{
Uid *ud;
ud = find_uid(s_OperServ);
send_cmd((UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ),
"KLINE * %ld %s %s :%s",
(long int) (expires - (long) time(NULL)), user, host, reason);
"KLINE * %ld %s %s :%s",
(long int) (expires - (long) time(NULL)), user, host, reason);
}
void charybdis_cmd_svskill(char *source, char *user, char *buf)
@ -958,7 +998,7 @@ void charybdis_cmd_svskill(char *source, char *user, char *buf)
ud = find_uid(source);
ud2 = find_uid(user);
send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "KILL %s :%s",
(UseTS6 ? (ud2 ? ud2->uid : user) : user), buf);
(UseTS6 ? (ud2 ? ud2->uid : user) : user), buf);
}
void charybdis_cmd_svsmode(User * u, int ac, char **av)
@ -988,18 +1028,18 @@ void charybdis_cmd_svsinfo()
/* CAPAB */
/*
QS - Can handle quit storm removal
EX - Can do channel +e exemptions
EX - Can do channel +e exemptions
CHW - Can do channel wall @#
LL - Can do lazy links
IE - Can do invite exceptions
LL - Can do lazy links
IE - Can do invite exceptions
EOB - Can do EOB message
KLN - Can do KLINE message
GLN - Can do GLINE message
HUB - This server is a HUB
KLN - Can do KLINE message
GLN - Can do GLINE message
HUB - This server is a HUB
UID - Can do UIDs
ZIP - Can do ZIPlinks
ENC - Can do ENCrypted links
KNOCK - supports KNOCK
ENC - Can do ENCrypted links
KNOCK - supports KNOCK
TBURST - supports TBURST
PARA - supports invite broadcasting for +p
ENCAP - supports message encapsulation
@ -1056,7 +1096,7 @@ void charybdis_cmd_bob()
}
void charybdis_cmd_bot_nick(char *nick, char *user, char *host, char *real,
char *modes)
char *modes)
{
EnforceQlinedNick(nick, NULL);
if (UseTS6) {
@ -1103,7 +1143,7 @@ int anope_event_away(char *source, int ac, char **av)
}
m_away((UseTS6 ? (u ? u->nick : source) : source),
(ac ? av[0] : NULL));
(ac ? av[0] : NULL));
return MOD_CONT;
}
@ -1140,7 +1180,7 @@ void charybdis_cmd_eob()
int anope_event_join(char *source, int ac, char **av)
{
if (ac != 1) {
/* ignore cmodes in JOIN as per TS6 v8 */
/* ignore cmodes in JOIN as per TS6 v8 */
do_sjoin(source, ac > 2 ? 2 : ac, av);
return MOD_CONT;
} else {
@ -1171,7 +1211,7 @@ int anope_event_privmsg(char *source, int ac, char **av)
u = find_byuid(source);
ud = find_nickuid(av[0]);
m_privmsg((UseTS6 ? (u ? u->nick : source) : source),
(UseTS6 ? (ud ? ud->nick : av[0]) : av[0]), av[1]);
(UseTS6 ? (ud ? ud->nick : av[0]) : av[0]), av[1]);
return MOD_CONT;
}
@ -1409,7 +1449,7 @@ void charybdis_cmd_mode(char *source, char *dest, char *buf)
if (source) {
ud = find_uid(source);
send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "MODE %s %s",
dest, buf);
dest, buf);
} else {
send_cmd(NULL, "MODE %s %s", dest, buf);
}
@ -1460,11 +1500,11 @@ void charybdis_cmd_kick(char *source, char *chan, char *user, char *buf)
if (buf) {
send_cmd((UseTS6 ? (ud ? ud->uid : source) : source),
"KICK %s %s :%s", chan,
(UseTS6 ? (u ? u->uid : user) : user), buf);
"KICK %s %s :%s", chan,
(UseTS6 ? (u ? u->uid : user) : user), buf);
} else {
send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "KICK %s %s",
chan, (UseTS6 ? (u ? u->uid : user) : user));
chan, (UseTS6 ? (u ? u->uid : user) : user));
}
}
@ -1487,7 +1527,7 @@ void charybdis_cmd_bot_chan_mode(char *nick, char *chan)
if (UseTS6) {
u = find_uid(nick);
charybdis_cmd_tmode(nick, chan, "%s %s", ircd->botchanumode,
(u ? u->uid : nick));
(u ? u->uid : nick));
} else {
anope_cmd_mode(ServerName, chan, "%s %s", ircd->botchanumode, nick);
}
@ -1501,7 +1541,7 @@ void charybdis_cmd_quit(char *source, char *buf)
if (buf) {
send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "QUIT :%s",
buf);
buf);
} else {
send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "QUIT");
}
@ -1532,7 +1572,7 @@ void charybdis_cmd_invite(char *source, char *chan, char *nick)
u = finduser(nick);
send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "INVITE %s %s",
(UseTS6 ? (u ? u->uid : nick) : nick), chan);
(UseTS6 ? (u ? u->uid : nick) : nick), chan);
}
/* SQUIT */
@ -1646,7 +1686,7 @@ void charybdis_cmd_svsnick(char *nick, char *newnick, time_t when)
}
void charybdis_cmd_guest_nick(char *nick, char *user, char *host, char *real,
char *modes)
char *modes)
{
/* not supported */
}
@ -1833,7 +1873,7 @@ void charybdis_cmd_jupe(char *jserver, char *who, char *reason)
new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL);
}
/*
/*
1 = valid nick
0 = nick is in valid
*/
@ -1845,7 +1885,7 @@ int charybdis_valid_nick(char *nick)
return 1;
}
/*
/*
1 = valid chan
0 = chan is invalid
*/
@ -1873,7 +1913,7 @@ void charybdis_cmd_ctcp(char *source, char *dest, char *buf)
int charybdis_send_account(int argc, char **argv)
{
send_cmd((UseTS6 ? TS6SID : ServerName), "ENCAP * SU %s :%s",
argv[0], argv[0]);
argv[0], argv[0]);
return MOD_CONT;
}
@ -1883,7 +1923,7 @@ int charybdis_send_account(int argc, char **argv)
int charybdis_send_deaccount(int argc, char **argv)
{
send_cmd((UseTS6 ? TS6SID : ServerName), "ENCAP * SU %s",
argv[0]);
argv[0]);
return MOD_CONT;
}
@ -1971,7 +2011,7 @@ void moduleAddAnopeCmds()
pmodule_set_umode(charybdis_set_umode);
}
/**
/**
* Now tell anope how to use us.
**/
int AnopeInit(int argc, char **argv)
@ -1994,7 +2034,7 @@ int AnopeInit(int argc, char **argv)
pmodule_ircd_csmodes(myCsmodes);
pmodule_ircd_useTSMode(0);
/** Deal with modes anope _needs_ to know **/
/** Deal with modes anope _needs_ to know **/
pmodule_invis_umode(UMODE_i);
pmodule_oper_umode(UMODE_o);
pmodule_invite_cmode(CMODE_i);
@ -2014,7 +2054,7 @@ int AnopeInit(int argc, char **argv)
moduleAddEventHook(hk);
/* XXX: It'd be nice if we could have an event like this, but it's not there yet :( */
/* It's there now! Trystan said so! -GD */
/* It's there now! Trystan said so! -GD */
hk = createEventHook(EVENT_NICK_LOGOUT, charybdis_send_deaccount);
moduleAddEventHook(hk);
@ -2024,8 +2064,8 @@ int AnopeInit(int argc, char **argv)
/* Clean up allocated things in here */
void AnopeFini(void)
{
if (UseTS6)
free(TS6SID);
if (UseTS6)
free(TS6SID);
}
/* EOF */

View File

@ -19,103 +19,103 @@ DECLARE_MODULE_V1("protocol/elemental-ircd", true, _modinit, NULL, PACKAGE_STRIN
/* *INDENT-OFF* */
ircd_t elemental_ircd = {
"elemental-ircd", /* IRCd name */
"$$", /* TLD Prefix, used by Global. */
true, /* Whether or not we use IRCNet/TS6 UID */
false, /* Whether or not we use RCOMMAND */
true, /* Whether or not we support channel owners. */
true, /* Whether or not we support channel protection. */
true, /* Whether or not we support halfops. */
false, /* Whether or not we use P10 */
false, /* Whether or not we use vHosts. */
CMODE_EXLIMIT | CMODE_PERM | CMODE_IMMUNE, /* Oper-only cmodes */
CSTATUS_OWNER, /* Integer flag for owner channel flag. */
CSTATUS_PROTECT, /* Integer flag for protect channel flag. */
CSTATUS_HALFOP, /* Integer flag for halfops. */
"+y", /* Mode we set for owner. */
"+a", /* Mode we set for protect. */
"+h", /* Mode we set for halfops. */
PROTOCOL_SHADOWIRCD, /* Protocol type */
CMODE_PERM, /* Permanent cmodes */
CMODE_IMMUNE, /* Oper-immune cmode */
"beIq", /* Ban-like cmodes */
'e', /* Except mchar */
'I', /* Invex mchar */
IRCD_CIDR_BANS | IRCD_HOLDNICK /* Flags */
"elemental-ircd", /* IRCd name */
"$$", /* TLD Prefix, used by Global. */
true, /* Whether or not we use IRCNet/TS6 UID */
false, /* Whether or not we use RCOMMAND */
true, /* Whether or not we support channel owners. */
true, /* Whether or not we support channel protection. */
true, /* Whether or not we support halfops. */
false, /* Whether or not we use P10 */
false, /* Whether or not we use vHosts. */
CMODE_EXLIMIT | CMODE_PERM | CMODE_IMMUNE, /* Oper-only cmodes */
CSTATUS_OWNER, /* Integer flag for owner channel flag. */
CSTATUS_PROTECT, /* Integer flag for protect channel flag. */
CSTATUS_HALFOP, /* Integer flag for halfops. */
"+y", /* Mode we set for owner. */
"+a", /* Mode we set for protect. */
"+h", /* Mode we set for halfops. */
PROTOCOL_SHADOWIRCD, /* Protocol type */
CMODE_PERM, /* Permanent cmodes */
CMODE_IMMUNE, /* Oper-immune cmode */
"beIq", /* Ban-like cmodes */
'e', /* Except mchar */
'I', /* Invex mchar */
IRCD_CIDR_BANS | IRCD_HOLDNICK /* Flags */
};
struct cmode_ elemental_mode_list[] = {
{ 'i', CMODE_INVITE },
{ 'm', CMODE_MOD },
{ 'n', CMODE_NOEXT },
{ 'p', CMODE_PRIV },
{ 's', CMODE_SEC },
{ 't', CMODE_TOPIC },
{ 'c', CMODE_NOCOLOR},
{ 'r', CMODE_REGONLY},
{ 'z', CMODE_OPMOD },
{ 'g', CMODE_FINVITE},
{ 'L', CMODE_EXLIMIT},
{ 'P', CMODE_PERM },
{ 'F', CMODE_FTARGET},
{ 'Q', CMODE_DISFWD },
{ 'M', CMODE_IMMUNE },
{ 'C', CMODE_NOCTCP },
{ 'A', CMODE_ADMINONLY },
{ 'O', CMODE_OPERONLY },
{ 'S', CMODE_SSLONLY },
{ 'D', CMODE_NOACTIONS },
{ 'T', CMODE_NONOTICE },
{ 'G', CMODE_NOCAPS },
{ 'E', CMODE_NOKICKS },
{ 'd', CMODE_NONICKS },
{ 'K', CMODE_NOREPEAT },
{ 'J', CMODE_KICKNOREJOIN },
{ '\0', 0 }
{ 'i', CMODE_INVITE },
{ 'm', CMODE_MOD },
{ 'n', CMODE_NOEXT },
{ 'p', CMODE_PRIV },
{ 's', CMODE_SEC },
{ 't', CMODE_TOPIC },
{ 'c', CMODE_NOCOLOR},
{ 'r', CMODE_REGONLY},
{ 'z', CMODE_OPMOD },
{ 'g', CMODE_FINVITE},
{ 'L', CMODE_EXLIMIT},
{ 'P', CMODE_PERM },
{ 'F', CMODE_FTARGET},
{ 'Q', CMODE_DISFWD },
{ 'M', CMODE_IMMUNE },
{ 'C', CMODE_NOCTCP },
{ 'A', CMODE_ADMINONLY },
{ 'O', CMODE_OPERONLY },
{ 'S', CMODE_SSLONLY },
{ 'D', CMODE_NOACTIONS },
{ 'T', CMODE_NONOTICE },
{ 'G', CMODE_NOCAPS },
{ 'E', CMODE_NOKICKS },
{ 'd', CMODE_NONICKS },
{ 'K', CMODE_NOREPEAT },
{ 'J', CMODE_KICKNOREJOIN },
{ '\0', 0 }
};
struct cmode_ elemental_status_mode_list[] = {
{ 'y', CSTATUS_OWNER },
{ 'a', CSTATUS_PROTECT },
{ 'o', CSTATUS_OP },
{ 'h', CSTATUS_HALFOP },
{ 'v', CSTATUS_VOICE },
{ '\0', 0 }
{ 'y', CSTATUS_OWNER },
{ 'a', CSTATUS_PROTECT },
{ 'o', CSTATUS_OP },
{ 'h', CSTATUS_HALFOP },
{ 'v', CSTATUS_VOICE },
{ '\0', 0 }
};
struct cmode_ elemental_prefix_mode_list[] = {
{ '~', CSTATUS_OWNER },
{ '!', CSTATUS_PROTECT },
{ '@', CSTATUS_OP },
{ '%', CSTATUS_HALFOP },
{ '+', CSTATUS_VOICE },
{ '\0', 0 }
{ '~', CSTATUS_OWNER },
{ '!', CSTATUS_PROTECT },
{ '@', CSTATUS_OP },
{ '%', CSTATUS_HALFOP },
{ '+', CSTATUS_VOICE },
{ '\0', 0 }
};
struct cmode_ elemental_user_mode_list[] = {
{ 'a', UF_ADMIN },
{ 'i', UF_INVIS },
{ 'o', UF_IRCOP },
{ 'D', UF_DEAF },
{ '\0', 0 }
{ 'a', UF_ADMIN },
{ 'i', UF_INVIS },
{ 'o', UF_IRCOP },
{ 'D', UF_DEAF },
{ '\0', 0 }
};
/* *INDENT-ON* */
void _modinit(module_t * m)
{
MODULE_TRY_REQUEST_DEPENDENCY(m, "protocol/charybdis");
MODULE_TRY_REQUEST_DEPENDENCY(m, "protocol/charybdis");
mode_list = elemental_mode_list;
user_mode_list = elemental_user_mode_list;
status_mode_list = elemental_status_mode_list;
prefix_mode_list = elemental_prefix_mode_list;
mode_list = elemental_mode_list;
user_mode_list = elemental_user_mode_list;
status_mode_list = elemental_status_mode_list;
prefix_mode_list = elemental_prefix_mode_list;
ircd = &elemental_ircd;
ircd = &elemental_ircd;
m->mflags = MODTYPE_CORE;
m->mflags = MODTYPE_CORE;
pmodule_loaded = true;
pmodule_loaded = true;
}
/* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs

View File

@ -3,17 +3,16 @@
void init_bandb(void);
typedef enum
{
BANDB_KLINE,
BANDB_DLINE,
BANDB_XLINE,
BANDB_RESV,
LAST_BANDB_TYPE
typedef enum {
BANDB_KLINE,
BANDB_DLINE,
BANDB_XLINE,
BANDB_RESV,
LAST_BANDB_TYPE
} bandb_type;
void bandb_add(bandb_type, struct Client *source_p, const char *mask1,
const char *mask2, const char *reason, const char *oper_reason, int perm);
const char *mask2, const char *reason, const char *oper_reason, int perm);
void bandb_del(bandb_type, const char *mask1, const char *mask2);
void bandb_rehash_bans(void);
#endif

View File

@ -26,26 +26,26 @@
/* A configured DNSBL */
struct Blacklist {
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
int refcount;
int ipv4; /* Does this blacklist support IPv4 lookups? */
int ipv6; /* Does this blacklist support IPv6 lookups? */
char host[IRCD_RES_HOSTLEN + 1];
char reject_reason[IRCD_BUFSIZE];
unsigned int hits;
time_t lastwarning;
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
int refcount;
int ipv4; /* Does this blacklist support IPv4 lookups? */
int ipv6; /* Does this blacklist support IPv6 lookups? */
char host[IRCD_RES_HOSTLEN + 1];
char reject_reason[IRCD_BUFSIZE];
unsigned int hits;
time_t lastwarning;
};
/* A lookup in progress for a particular DNSBL for a particular client */
struct BlacklistClient {
struct Blacklist *blacklist;
struct Client *client_p;
struct DNSQuery dns_query;
rb_dlink_node node;
struct Blacklist *blacklist;
struct Client *client_p;
struct DNSQuery dns_query;
rb_dlink_node node;
};
/* public interfaces */
struct Blacklist *new_blacklist(char *host, char *reject_reason, int ipv4, int ipv6);
struct Blacklist *new_blacklist(char *host, char *reject_reason, int ipv4, int ipv6);
void lookup_blacklists(struct Client *client_p);
void abort_blacklist_queries(struct Client *client_p);
void unref_blacklist(struct Blacklist *blptr);

View File

@ -14,17 +14,15 @@
struct Client;
struct cachefile
{
char name[CACHEFILELEN];
rb_dlink_list contents;
int flags;
struct cachefile {
char name[CACHEFILELEN];
rb_dlink_list contents;
int flags;
};
struct cacheline
{
char data[CACHELINELEN];
rb_dlink_node linenode;
struct cacheline {
char data[CACHELINELEN];
rb_dlink_node linenode;
};
extern struct cachefile *user_motd;

View File

@ -35,110 +35,102 @@
struct Client;
/* mode structure for channels */
struct Mode
{
unsigned int mode;
int limit;
char key[KEYLEN];
unsigned int join_num;
unsigned int join_time;
char forward[LOC_CHANNELLEN + 1];
struct Mode {
unsigned int mode;
int limit;
char key[KEYLEN];
unsigned int join_num;
unsigned int join_time;
char forward[LOC_CHANNELLEN + 1];
};
/* channel structure */
struct Channel
{
rb_dlink_node node;
struct Mode mode;
char *mode_lock;
char *topic;
char *topic_info;
time_t topic_time;
time_t last_knock; /* don't allow knock to flood */
struct Channel {
rb_dlink_node node;
struct Mode mode;
char *mode_lock;
char *topic;
char *topic_info;
time_t topic_time;
time_t last_knock; /* don't allow knock to flood */
rb_dlink_list members; /* channel members */
rb_dlink_list locmembers; /* local channel members */
rb_dlink_list members; /* channel members */
rb_dlink_list locmembers; /* local channel members */
rb_dlink_list invites;
rb_dlink_list banlist;
rb_dlink_list exceptlist;
rb_dlink_list invexlist;
rb_dlink_list quietlist;
rb_dlink_list invites;
rb_dlink_list banlist;
rb_dlink_list exceptlist;
rb_dlink_list invexlist;
rb_dlink_list quietlist;
time_t first_received_message_time; /* channel flood control */
int received_number_of_privmsgs;
int flood_noticed;
time_t first_received_message_time; /* channel flood control */
int received_number_of_privmsgs;
int flood_noticed;
unsigned int join_count; /* joins within delta */
unsigned int join_delta; /* last ts of join */
unsigned int join_count; /* joins within delta */
unsigned int join_delta; /* last ts of join */
struct Dictionary *metadata;
struct Dictionary *metadata;
unsigned long bants;
time_t channelts;
char *chname;
unsigned long bants;
time_t channelts;
char *chname;
};
struct membership
{
rb_dlink_node channode;
rb_dlink_node locchannode;
rb_dlink_node usernode;
struct membership {
rb_dlink_node channode;
rb_dlink_node locchannode;
rb_dlink_node usernode;
struct Channel *chptr;
struct Client *client_p;
unsigned int flags;
struct Channel *chptr;
struct Client *client_p;
unsigned int flags;
unsigned long bants;
unsigned long bants;
};
#define BANLEN 195
struct Ban
{
char *banstr;
char *who;
time_t when;
rb_dlink_node node;
struct Ban {
char *banstr;
char *who;
time_t when;
rb_dlink_node node;
};
struct mode_letter
{
int mode;
char letter;
struct mode_letter {
int mode;
char letter;
};
struct ChModeChange
{
char letter;
const char *arg;
const char *id;
int dir;
int caps;
int nocaps;
int mems;
int override;
struct Client *client;
struct ChModeChange {
char letter;
const char *arg;
const char *id;
int dir;
int caps;
int nocaps;
int mems;
int override;
struct Client *client;
};
struct ChCapCombo
{
int count;
int cap_yes;
int cap_no;
struct ChCapCombo {
int count;
int cap_yes;
int cap_no;
};
typedef void (*ChannelModeFunc)(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
struct ChannelMode
{
ChannelModeFunc set_func;
long mode_type;
struct ChannelMode {
ChannelModeFunc set_func;
long mode_type;
};
typedef int (*ExtbanFunc)(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type);
struct Channel *chptr, long mode_type);
/* can_send results */
#define CAN_SEND_NO 0
@ -232,14 +224,14 @@ void free_ban(struct Ban *bptr);
extern void destroy_channel(struct Channel *);
extern int can_send(struct Channel *chptr, struct Client *who,
struct membership *);
extern int can_send(struct Channel *chptr, struct Client *who,
struct membership *);
extern int flood_attack_channel(int p_or_n, struct Client *source_p,
struct Channel *chptr, char *chname);
struct Channel *chptr, char *chname);
extern int is_banned(struct Channel *chptr, struct Client *who,
struct membership *msptr, const char *, const char *);
struct membership *msptr, const char *, const char *);
extern int is_quieted(struct Channel *chptr, struct Client *who,
struct membership *msptr, const char *, const char *);
struct membership *msptr, const char *, const char *);
extern int can_join(struct Client *source_p, struct Channel *chptr, char *key);
extern struct membership *find_channel_membership(struct Channel *, struct Client *);
@ -260,7 +252,7 @@ extern void free_channel_list(rb_dlink_list *);
extern int check_channel_name(const char *name);
extern void channel_member_names(struct Channel *chptr, struct Client *,
int show_eon);
int show_eon);
extern void del_invite(struct Channel *chptr, struct Client *who);
@ -277,25 +269,25 @@ extern void check_spambot_warning(struct Client *source_p, const char *name);
extern void check_splitmode(void *);
void set_channel_topic(struct Channel *chptr, const char *topic,
const char *topic_info, time_t topicts);
const char *topic_info, time_t topicts);
extern void init_chcap_usage_counts(void);
extern void set_chcap_usage_counts(struct Client *serv_p);
extern void unset_chcap_usage_counts(struct Client *serv_p);
extern void send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
struct Channel *chptr, struct ChModeChange foo[], int);
struct Channel *chptr, struct ChModeChange foo[], int);
void resv_chan_forcepart(const char *name, const char *reason, int temp_time);
extern void set_channel_mode(struct Client *client_p, struct Client *source_p,
struct Channel *chptr, struct membership *msptr, int parc, const char *parv[]);
struct Channel *chptr, struct membership *msptr, int parc, const char *parv[]);
extern void set_channel_mlock(struct Client *client_p, struct Client *source_p,
struct Channel *chptr, const char *newmlock, int propagate);
struct Channel *chptr, const char *newmlock, int propagate);
extern struct ChannelMode chmode_table[256];
extern int add_id(struct Client *source_p, struct Channel *chptr, const char *banid,
rb_dlink_list * list, long mode_type);
rb_dlink_list * list, long mode_type);
extern int del_id(struct Channel *chptr, const char *banid, rb_dlink_list * list, long mode_type);

View File

@ -37,50 +37,50 @@
extern int chmode_flags[256];
extern void chm_nosuch(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_orphaned(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_simple(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_ban(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_hidden(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_staff(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_forward(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_throttle(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_key(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_limit(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_owner(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_admin(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_op(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_halfop(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_voice(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern unsigned int cflag_add(char c, ChannelModeFunc function);
extern void cflag_orphan(char c);

View File

@ -30,22 +30,21 @@ struct ConfItem;
struct Client;
struct _patricia_tree_t;
struct Class
{
struct Class *next;
char *class_name;
int max_total;
int max_local;
int max_global;
int max_ident;
int max_sendq;
int con_freq;
int ping_freq;
int total;
rb_patricia_tree_t *ip_limits;
int cidr_ipv4_bitlen;
int cidr_ipv6_bitlen;
int cidr_amount;
struct Class {
struct Class *next;
char *class_name;
int max_total;
int max_local;
int max_global;
int max_ident;
int max_sendq;
int con_freq;
int ping_freq;
int total;
rb_patricia_tree_t *ip_limits;
int cidr_ipv4_bitlen;
int cidr_ipv6_bitlen;
int cidr_amount;
};

View File

@ -76,238 +76,231 @@ struct scache_entry;
/*
* Client structures
*/
struct User
{
rb_dlink_list channel; /* chain of channel pointer blocks */
rb_dlink_list invited; /* chain of invite pointer blocks */
char *away; /* pointer to away message */
int refcnt; /* Number of times this block is referenced */
struct User {
rb_dlink_list channel; /* chain of channel pointer blocks */
rb_dlink_list invited; /* chain of invite pointer blocks */
char *away; /* pointer to away message */
int refcnt; /* Number of times this block is referenced */
struct Dictionary *metadata;
struct Dictionary *metadata;
char suser[NICKLEN+1];
char suser[NICKLEN+1];
};
struct Server
{
struct User *user; /* who activated this connection */
char by[NICKLEN];
rb_dlink_list servers;
rb_dlink_list users;
int caps; /* capabilities bit-field */
char *fullcaps;
struct scache_entry *nameinfo;
struct Server {
struct User *user; /* who activated this connection */
char by[NICKLEN];
rb_dlink_list servers;
rb_dlink_list users;
int caps; /* capabilities bit-field */
char *fullcaps;
struct scache_entry *nameinfo;
};
struct ZipStats
{
unsigned long long in;
unsigned long long in_wire;
unsigned long long out;
unsigned long long out_wire;
double in_ratio;
double out_ratio;
struct ZipStats {
unsigned long long in;
unsigned long long in_wire;
unsigned long long out;
unsigned long long out_wire;
double in_ratio;
double out_ratio;
};
struct Client
{
rb_dlink_node node;
rb_dlink_node lnode;
struct User *user; /* ...defined, if this is a User */
struct Server *serv; /* ...defined, if this is a server */
struct Client *servptr; /* Points to server this Client is on */
struct Client *from; /* == self, if Local Client, *NEVER* NULL! */
struct Client {
rb_dlink_node node;
rb_dlink_node lnode;
struct User *user; /* ...defined, if this is a User */
struct Server *serv; /* ...defined, if this is a server */
struct Client *servptr; /* Points to server this Client is on */
struct Client *from; /* == self, if Local Client, *NEVER* NULL! */
struct Whowas *whowas; /* Pointers to whowas structs */
time_t tsinfo; /* TS on the nick, SVINFO on server */
unsigned int umodes; /* opers, normal users subset */
unsigned int flags; /* client flags */
unsigned int flags2; /* ugh. overflow */
struct Whowas *whowas; /* Pointers to whowas structs */
time_t tsinfo; /* TS on the nick, SVINFO on server */
unsigned int umodes; /* opers, normal users subset */
unsigned int flags; /* client flags */
unsigned int flags2; /* ugh. overflow */
unsigned int snomask; /* server notice mask */
unsigned int snomask; /* server notice mask */
int hopcount; /* number of servers to this 0 = local */
unsigned short status; /* Client type */
unsigned char handler; /* Handler index */
unsigned long serial; /* used to enforce 1 send per nick */
int hopcount; /* number of servers to this 0 = local */
unsigned short status; /* Client type */
unsigned char handler; /* Handler index */
unsigned long serial; /* used to enforce 1 send per nick */
/* client->name is the unique name for a client nick or host */
char name[HOSTLEN + 1];
/* client->name is the unique name for a client nick or host */
char name[HOSTLEN + 1];
/*
* client->username is the username from ident or the USER message,
* If the client is idented the USER message is ignored, otherwise
* the username part of the USER message is put here prefixed with a
* tilde depending on the I:line, Once a client has registered, this
* field should be considered read-only.
*/
char username[USERLEN + 1]; /* client's username */
/*
* client->username is the username from ident or the USER message,
* If the client is idented the USER message is ignored, otherwise
* the username part of the USER message is put here prefixed with a
* tilde depending on the I:line, Once a client has registered, this
* field should be considered read-only.
*/
char username[USERLEN + 1]; /* client's username */
/*
* client->host contains the resolved name or ip address
* as a string for the user, it may be fiddled with for oper spoofing etc.
*/
char host[HOSTLEN + 1]; /* client's hostname */
char orighost[HOSTLEN + 1]; /* original hostname (before dynamic spoofing) */
char sockhost[HOSTIPLEN + 1]; /* clients ip */
char info[REALLEN + 1]; /* Free form additional client info */
/*
* client->host contains the resolved name or ip address
* as a string for the user, it may be fiddled with for oper spoofing etc.
*/
char host[HOSTLEN + 1]; /* client's hostname */
char orighost[HOSTLEN + 1]; /* original hostname (before dynamic spoofing) */
char sockhost[HOSTIPLEN + 1]; /* clients ip */
char info[REALLEN + 1]; /* Free form additional client info */
char id[IDLEN]; /* UID/SID, unique on the network */
char id[IDLEN]; /* UID/SID, unique on the network */
/* list of who has this client on their allow list, its counterpart
* is in LocalUser
*/
rb_dlink_list on_allow_list;
/* list of who has this client on their allow list, its counterpart
* is in LocalUser
*/
rb_dlink_list on_allow_list;
time_t first_received_message_time;
int received_number_of_privmsgs;
int flood_noticed;
time_t first_received_message_time;
int received_number_of_privmsgs;
int flood_noticed;
struct LocalUser *localClient;
struct PreClient *preClient;
struct LocalUser *localClient;
struct PreClient *preClient;
time_t large_ctcp_sent; /* ctcp to large group sent, relax flood checks */
char *certfp; /* client certificate fingerprint */
time_t large_ctcp_sent; /* ctcp to large group sent, relax flood checks */
char *certfp; /* client certificate fingerprint */
};
struct LocalUser
{
rb_dlink_node tnode; /* This is the node for the local list type the client is on*/
/*
* The following fields are allocated only for local clients
* (directly connected to *this* server with a socket.
*/
/* Anti flooding part, all because of lamers... */
time_t last_join_time; /* when this client last
struct LocalUser {
rb_dlink_node tnode; /* This is the node for the local list type the client is on*/
/*
* The following fields are allocated only for local clients
* (directly connected to *this* server with a socket.
*/
/* Anti flooding part, all because of lamers... */
time_t last_join_time; /* when this client last
joined a channel */
time_t last_leave_time; /* when this client last
time_t last_leave_time; /* when this client last
* left a channel */
int join_leave_count; /* count of JOIN/LEAVE in less than
int join_leave_count; /* count of JOIN/LEAVE in less than
MIN_JOIN_LEAVE_TIME seconds */
int oper_warn_count_down; /* warn opers of this possible
int oper_warn_count_down; /* warn opers of this possible
spambot every time this gets to 0 */
time_t last_caller_id_time;
time_t last_caller_id_time;
time_t lasttime; /* last time we parsed something */
time_t firsttime; /* time client was created */
time_t lasttime; /* last time we parsed something */
time_t firsttime; /* time client was created */
/* Send and receive linebuf queues .. */
buf_head_t buf_sendq;
buf_head_t buf_recvq;
/*
* we want to use unsigned int here so the sizes have a better chance of
* staying the same on 64 bit machines. The current trend is to use
* I32LP64, (32 bit ints, 64 bit longs and pointers) and since ircd
* will NEVER run on an operating system where ints are less than 32 bits,
* it's a relatively safe bet to use ints. Since right shift operations are
* performed on these, it's not safe to allow them to become negative,
* which is possible for long running server connections. Unsigned values
* generally overflow gracefully. --Bleep
*/
unsigned int sendM; /* Statistics: protocol messages send */
unsigned int sendK; /* Statistics: total k-bytes send */
unsigned int receiveM; /* Statistics: protocol messages received */
unsigned int receiveK; /* Statistics: total k-bytes received */
unsigned short sendB; /* counters to count upto 1-k lots of bytes */
unsigned short receiveB; /* sent and received. */
struct Listener *listener; /* listener accepted from */
struct ConfItem *att_conf; /* attached conf */
struct server_conf *att_sconf;
/* Send and receive linebuf queues .. */
buf_head_t buf_sendq;
buf_head_t buf_recvq;
/*
* we want to use unsigned int here so the sizes have a better chance of
* staying the same on 64 bit machines. The current trend is to use
* I32LP64, (32 bit ints, 64 bit longs and pointers) and since ircd
* will NEVER run on an operating system where ints are less than 32 bits,
* it's a relatively safe bet to use ints. Since right shift operations are
* performed on these, it's not safe to allow them to become negative,
* which is possible for long running server connections. Unsigned values
* generally overflow gracefully. --Bleep
*/
unsigned int sendM; /* Statistics: protocol messages send */
unsigned int sendK; /* Statistics: total k-bytes send */
unsigned int receiveM; /* Statistics: protocol messages received */
unsigned int receiveK; /* Statistics: total k-bytes received */
unsigned short sendB; /* counters to count upto 1-k lots of bytes */
unsigned short receiveB; /* sent and received. */
struct Listener *listener; /* listener accepted from */
struct ConfItem *att_conf; /* attached conf */
struct server_conf *att_sconf;
struct rb_sockaddr_storage ip;
time_t last_nick_change;
int number_of_nick_changes;
struct rb_sockaddr_storage ip;
time_t last_nick_change;
int number_of_nick_changes;
/*
* XXX - there is no reason to save this, it should be checked when it's
* received and not stored, this is not used after registration
*
* agreed. lets get rid of it someday! --nenolod
*/
char *passwd;
char *auth_user;
char *opername; /* name of operator{} block being used or tried (challenge) */
char *challenge;
char *fullcaps;
/*
* XXX - there is no reason to save this, it should be checked when it's
* received and not stored, this is not used after registration
*
* agreed. lets get rid of it someday! --nenolod
*/
char *passwd;
char *auth_user;
char *opername; /* name of operator{} block being used or tried (challenge) */
char *challenge;
char *fullcaps;
int caps; /* capabilities bit-field */
rb_fde_t *F; /* >= 0, for local clients */
int caps; /* capabilities bit-field */
rb_fde_t *F; /* >= 0, for local clients */
/* time challenge response is valid for */
time_t chal_time;
/* time challenge response is valid for */
time_t chal_time;
struct DNSQuery *dnsquery; /* for outgoing server's name lookup */
struct DNSQuery *dnsquery; /* for outgoing server's name lookup */
time_t next_away; /* Don't allow next away before... */
time_t last;
time_t last;
/* clients allowed to talk through +g */
rb_dlink_list allow_list;
/* clients allowed to talk through +g */
rb_dlink_list allow_list;
/* nicknames theyre monitoring */
rb_dlink_list monitor_list;
/* nicknames theyre monitoring */
rb_dlink_list monitor_list;
/*
* Anti-flood stuff. We track how many messages were parsed and how
* many we were allowed in the current second, and apply a simple decay
* to avoid flooding.
* -- adrian
*/
int allow_read; /* how many we're allowed to read in this second */
int actually_read; /* how many we've actually read in this second */
int sent_parsed; /* how many messages we've parsed in this second */
time_t last_knock; /* time of last knock */
unsigned long random_ping;
struct AuthRequest *auth_request;
/*
* Anti-flood stuff. We track how many messages were parsed and how
* many we were allowed in the current second, and apply a simple decay
* to avoid flooding.
* -- adrian
*/
int allow_read; /* how many we're allowed to read in this second */
int actually_read; /* how many we've actually read in this second */
int sent_parsed; /* how many messages we've parsed in this second */
time_t last_knock; /* time of last knock */
unsigned long random_ping;
struct AuthRequest *auth_request;
/* target change stuff */
/* targets we're aware of (fnv32(use_id(target_p))):
* 0..TGCHANGE_NUM-1 regular slots
* TGCHANGE_NUM..TGCHANGE_NUM+TGCHANGE_REPLY-1 reply slots
*/
uint32_t targets[TGCHANGE_NUM + TGCHANGE_REPLY];
unsigned int targets_free; /* free targets */
time_t target_last; /* last time we cleared a slot */
/* target change stuff */
/* targets we're aware of (fnv32(use_id(target_p))):
* 0..TGCHANGE_NUM-1 regular slots
* TGCHANGE_NUM..TGCHANGE_NUM+TGCHANGE_REPLY-1 reply slots
*/
uint32_t targets[TGCHANGE_NUM + TGCHANGE_REPLY];
unsigned int targets_free; /* free targets */
time_t target_last; /* last time we cleared a slot */
struct ListClient *safelist_data;
struct ListClient *safelist_data;
char *mangledhost; /* non-NULL if host mangling module loaded and
char *mangledhost; /* non-NULL if host mangling module loaded and
applicable to this client */
struct _ssl_ctl *ssl_ctl; /* which ssl daemon we're associate with */
struct _ssl_ctl *z_ctl; /* second ctl for ssl+zlib */
uint32_t localflags;
struct ZipStats *zipstats; /* zipstats */
uint16_t cork_count; /* used for corking/uncorking connections */
struct ev_entry *event; /* used for associated events */
struct _ssl_ctl *ssl_ctl; /* which ssl daemon we're associate with */
struct _ssl_ctl *z_ctl; /* second ctl for ssl+zlib */
uint32_t localflags;
struct ZipStats *zipstats; /* zipstats */
uint16_t cork_count; /* used for corking/uncorking connections */
struct ev_entry *event; /* used for associated events */
struct PrivilegeSet *privset; /* privset... */
struct PrivilegeSet *privset; /* privset... */
struct ev_entry *override_timeout_event;
struct ev_entry *override_timeout_event;
};
struct PreClient
{
char spoofnick[NICKLEN + 1];
char spoofuser[USERLEN + 1];
char spoofhost[HOSTLEN + 1];
struct PreClient {
char spoofnick[NICKLEN + 1];
char spoofuser[USERLEN + 1];
char spoofhost[HOSTLEN + 1];
char sasl_agent[IDLEN];
unsigned char sasl_out;
unsigned char sasl_complete;
char sasl_agent[IDLEN];
unsigned char sasl_out;
unsigned char sasl_complete;
rb_dlink_list dnsbl_queries; /* list of struct BlacklistClient * */
struct Blacklist *dnsbl_listed; /* first dnsbl where it's listed */
rb_dlink_list dnsbl_queries; /* list of struct BlacklistClient * */
struct Blacklist *dnsbl_listed; /* first dnsbl where it's listed */
struct rb_sockaddr_storage lip; /* address of our side of the connection */
struct rb_sockaddr_storage lip; /* address of our side of the connection */
};
struct ListClient
{
unsigned int hash_indice;
unsigned int users_min, users_max;
time_t created_min, created_max, topic_min, topic_max;
int operspy;
struct ListClient {
unsigned int hash_indice;
unsigned int users_min, users_max;
time_t created_min, created_max, topic_min, topic_max;
int operspy;
};
/*

View File

@ -28,7 +28,7 @@
#include "setup.h"
/*
/*
* Directory paths and filenames for UNIX systems.
* IRCD_PREFIX is set using ./configure --prefix, see INSTALL.
* The other defaults should be fine.
@ -52,7 +52,7 @@
#define LIBPATH IRCD_PREFIX "/lib/"
#define MODPATH MODULE_DIR
#define AUTOMODPATH MODULE_DIR "/autoload/"
#define ETCPATH ETC_DIR
#define ETCPATH ETC_DIR
#define LOGPATH LOG_DIR
#define UHPATH HELP_DIR "/users"
#define HPATH HELP_DIR "/opers"
@ -94,7 +94,7 @@
#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */
/* RATBOX_SOMAXCONN
* Use SOMAXCONN if OS has it, otherwise use this value for the
* Use SOMAXCONN if OS has it, otherwise use this value for the
* listen(); backlog. 5 for AIX/SUNOS, 25 for other OSs.
*/
#define RATBOX_SOMAXCONN 25

View File

@ -6,10 +6,9 @@
#ifndef INCLUDED_HOOK_H
#define INCLUDED_HOOK_H
typedef struct
{
char *name;
rb_dlink_list hooks;
typedef struct {
char *name;
rb_dlink_list hooks;
} hook;
typedef void (*hookfn) (void *data);
@ -36,67 +35,58 @@ void add_hook(const char *name, hookfn fn);
void remove_hook(const char *name, hookfn fn);
void call_hook(int id, void *arg);
typedef struct
{
struct Client *client;
const void *arg1;
const void *arg2;
typedef struct {
struct Client *client;
const void *arg1;
const void *arg2;
} hook_data;
typedef struct
{
struct Client *client;
const void *arg1;
int arg2;
typedef struct {
struct Client *client;
const void *arg1;
int arg2;
} hook_data_int;
typedef struct
{
struct Client *client;
struct Client *target;
typedef struct {
struct Client *client;
struct Client *target;
} hook_data_client;
typedef struct
{
struct Client *client;
struct Channel *chptr;
int approved;
typedef struct {
struct Client *client;
struct Channel *chptr;
int approved;
} hook_data_channel;
typedef struct
{
struct Client *client;
struct Channel *chptr;
char *key;
typedef struct {
struct Client *client;
struct Channel *chptr;
char *key;
} hook_data_channel_activity;
typedef struct
{
struct Client *client;
struct Channel *chptr;
struct Client *target;
int approved;
typedef struct {
struct Client *client;
struct Channel *chptr;
struct Client *target;
int approved;
} hook_data_channel_approval;
typedef struct
{
struct Client *client;
int approved;
typedef struct {
struct Client *client;
int approved;
} hook_data_client_approval;
typedef struct
{
struct Client *local_link; /* local client originating this, or NULL */
struct Client *target; /* dying client */
struct Client *from; /* causing client (could be &me or target) */
const char *comment;
typedef struct {
struct Client *local_link; /* local client originating this, or NULL */
struct Client *target; /* dying client */
struct Client *from; /* causing client (could be &me or target) */
const char *comment;
} hook_data_client_exit;
typedef struct
{
struct Client *client;
unsigned int oldumodes;
unsigned int oldsnomask;
typedef struct {
struct Client *client;
unsigned int oldumodes;
unsigned int oldsnomask;
} hook_data_umode_changed;
#endif

View File

@ -26,29 +26,28 @@
#ifndef INCLUDE_hostmask_h
#define INCLUDE_hostmask_h 1
enum
{
HM_HOST,
HM_IPV4
enum {
HM_HOST,
HM_IPV4
#ifdef RB_IPV6
, HM_IPV6
, HM_IPV6
#endif
};
int parse_netmask(const char *, struct sockaddr *, int *);
struct ConfItem *find_conf_by_address(const char *host, const char *sockhost,
const char *orighost, struct sockaddr *,
int, int, const char *, const char *);
const char *orighost, struct sockaddr *,
int, int, const char *, const char *);
struct ConfItem *find_exact_conf_by_address(const char *address, int type,
const char *username);
const char *username);
void add_conf_by_address(const char *, int, const char *, const char *, struct ConfItem *);
void delete_one_address_conf(const char *, struct ConfItem *);
void clear_out_address_conf(void);
void clear_out_address_conf_bans(void);
void init_host_hash(void);
struct ConfItem *find_address_conf(const char *host, const char *sockhost,
const char *, const char *, struct sockaddr *,
int, char *);
struct ConfItem *find_address_conf(const char *host, const char *sockhost,
const char *, const char *, struct sockaddr *,
int, char *);
struct ConfItem *find_dline(struct sockaddr *, int);
@ -70,40 +69,37 @@ int match_ipv4(struct sockaddr *, struct sockaddr *, int);
extern struct AddressRec *atable[ATABLE_SIZE];
struct AddressRec
{
/* masktype: HM_HOST, HM_IPV4, HM_IPV6 -A1kmm */
int masktype;
struct AddressRec {
/* masktype: HM_HOST, HM_IPV4, HM_IPV6 -A1kmm */
int masktype;
union
{
struct
{
/* Pointer into ConfItem... -A1kmm */
struct rb_sockaddr_storage addr;
int bits;
}
ipa;
union {
struct {
/* Pointer into ConfItem... -A1kmm */
struct rb_sockaddr_storage addr;
int bits;
}
ipa;
/* Pointer into ConfItem... -A1kmm */
const char *hostname;
}
Mask;
/* Pointer into ConfItem... -A1kmm */
const char *hostname;
}
Mask;
/* type: CONF_CLIENT, CONF_DLINE, CONF_KILL etc... -A1kmm */
int type;
/* type: CONF_CLIENT, CONF_DLINE, CONF_KILL etc... -A1kmm */
int type;
/* Higher precedences overrule lower ones... */
unsigned long precedence;
/* Higher precedences overrule lower ones... */
unsigned long precedence;
/* Only checked if !(type & 1)... */
const char *username;
/* Only checked if type == CONF_CLIENT */
const char *auth_user;
struct ConfItem *aconf;
/* Only checked if !(type & 1)... */
const char *username;
/* Only checked if type == CONF_CLIENT */
const char *auth_user;
struct ConfItem *aconf;
/* The next record in this hash bucket. */
struct AddressRec *next;
/* The next record in this hash bucket. */
struct AddressRec *next;
};

View File

@ -30,96 +30,90 @@
static inline char *
strip_colour(char *string)
{
char *c = string;
char *c2 = string;
char *last_non_space = NULL;
char *c = string;
char *c2 = string;
char *last_non_space = NULL;
/* c is source, c2 is target */
for(; c && *c; c++)
switch (*c)
{
case 3:
if(isdigit(c[1]))
{
c++;
if(isdigit(c[1]))
c++;
if(c[1] == ',' && isdigit(c[2]))
{
c += 2;
if(isdigit(c[1]))
c++;
}
}
break;
case 2:
case 6:
case 7:
case 22:
case 23:
case 27:
case 29:
case 31:
break;
case 32:
*c2++ = *c;
break;
default:
*c2++ = *c;
last_non_space = c2;
break;
}
/* c is source, c2 is target */
for(; c && *c; c++)
switch (*c) {
case 3:
if(isdigit(c[1])) {
c++;
if(isdigit(c[1]))
c++;
if(c[1] == ',' && isdigit(c[2])) {
c += 2;
if(isdigit(c[1]))
c++;
}
}
break;
case 2:
case 6:
case 7:
case 22:
case 23:
case 27:
case 29:
case 31:
break;
case 32:
*c2++ = *c;
break;
default:
*c2++ = *c;
last_non_space = c2;
break;
}
*c2 = '\0';
*c2 = '\0';
if(last_non_space)
*last_non_space = '\0';
if(last_non_space)
*last_non_space = '\0';
return string;
return string;
}
static inline char *
strip_unprintable(char *string)
{
char *c = string;
char *c2 = string;
char *last_non_space = NULL;
char *c = string;
char *c2 = string;
char *last_non_space = NULL;
/* c is source, c2 is target */
for(; c && *c; c++)
switch (*c)
{
case 3:
if(isdigit(c[1]))
{
c++;
if(isdigit(c[1]))
c++;
if(c[1] == ',' && isdigit(c[2]))
{
c += 2;
if(isdigit(c[1]))
c++;
}
}
break;
case 32:
*c2++ = *c;
break;
default:
if (*c < 32 && *c >= 0)
break;
*c2++ = *c;
last_non_space = c2;
break;
}
/* c is source, c2 is target */
for(; c && *c; c++)
switch (*c) {
case 3:
if(isdigit(c[1])) {
c++;
if(isdigit(c[1]))
c++;
if(c[1] == ',' && isdigit(c[2])) {
c += 2;
if(isdigit(c[1]))
c++;
}
}
break;
case 32:
*c2++ = *c;
break;
default:
if (*c < 32 && *c >= 0)
break;
*c2++ = *c;
last_non_space = c2;
break;
}
*c2 = '\0';
*c2 = '\0';
if(last_non_space)
*last_non_space = '\0';
if(last_non_space)
*last_non_space = '\0';
return string;
return string;
}
#endif

View File

@ -29,17 +29,15 @@ struct Dictionary; /* defined in src/dictionary.c */
typedef int (*DCF)(const char *a, const char *b);
struct DictionaryElement
{
struct DictionaryElement *left, *right, *prev, *next;
void *data;
const char *key;
int position;
struct DictionaryElement {
struct DictionaryElement *left, *right, *prev, *next;
void *data;
const char *key;
int position;
};
struct DictionaryIter
{
struct DictionaryElement *cur, *next;
struct DictionaryIter {
struct DictionaryElement *cur, *next;
};
/*
@ -65,7 +63,7 @@ extern struct Dictionary *irc_dictionary_create_named(const char *name, DCF comp
* insertions in the DTree structure.
*/
extern void irc_dictionary_set_comparator_func(struct Dictionary *dict,
DCF compare_cb);
DCF compare_cb);
/*
* irc_dictionary_get_comparator_func() returns the comparator used for lookups and
@ -84,8 +82,8 @@ extern int irc_dictionary_get_linear_index(struct Dictionary *dict, const char *
* a defined callback function to destroy any data attached to it.
*/
extern void irc_dictionary_destroy(struct Dictionary *dtree,
void (*destroy_cb)(struct DictionaryElement *delem, void *privdata),
void *privdata);
void (*destroy_cb)(struct DictionaryElement *delem, void *privdata),
void *privdata);
/*
* irc_dictionary_foreach() iterates all entries in a dtree, and also optionally calls
@ -94,8 +92,8 @@ extern void irc_dictionary_destroy(struct Dictionary *dtree,
* To shortcircuit iteration, return non-zero from the callback function.
*/
extern void irc_dictionary_foreach(struct Dictionary *dtree,
int (*foreach_cb)(struct DictionaryElement *delem, void *privdata),
void *privdata);
int (*foreach_cb)(struct DictionaryElement *delem, void *privdata),
void *privdata);
/*
* irc_dictionary_search() iterates all entries in a dtree, and also optionally calls
@ -105,8 +103,8 @@ extern void irc_dictionary_foreach(struct Dictionary *dtree,
* in that object being returned to the user.
*/
extern void *irc_dictionary_search(struct Dictionary *dtree,
void *(*foreach_cb)(struct DictionaryElement *delem, void *privdata),
void *privdata);
void *(*foreach_cb)(struct DictionaryElement *delem, void *privdata),
void *privdata);
/*
* irc_dictionary_foreach_start() begins an iteration over all items
@ -115,20 +113,20 @@ extern void *irc_dictionary_search(struct Dictionary *dtree,
* of the iteration (but not any other element).
*/
extern void irc_dictionary_foreach_start(struct Dictionary *dtree,
struct DictionaryIter *state);
struct DictionaryIter *state);
/*
* irc_dictionary_foreach_cur() returns the current element of the iteration,
* or NULL if there are no more elements.
*/
extern void *irc_dictionary_foreach_cur(struct Dictionary *dtree,
struct DictionaryIter *state);
struct DictionaryIter *state);
/*
* irc_dictionary_foreach_next() moves to the next element.
*/
extern void irc_dictionary_foreach_next(struct Dictionary *dtree,
struct DictionaryIter *state);
struct DictionaryIter *state);
/*
* irc_dictionary_add() adds a key->value entry to the dictionary tree.

View File

@ -31,37 +31,34 @@
struct Client;
struct rb_dlink_list;
struct SetOptions
{
int maxclients; /* max clients allowed */
int autoconn; /* autoconn enabled for all servers? */
struct SetOptions {
int maxclients; /* max clients allowed */
int autoconn; /* autoconn enabled for all servers? */
int floodcount; /* Number of messages in 1 second */
int ident_timeout; /* timeout for identd lookups */
int floodcount; /* Number of messages in 1 second */
int ident_timeout; /* timeout for identd lookups */
int spam_num;
int spam_time;
int spam_num;
int spam_time;
char operhost[REALLEN];
char operstring[REALLEN];
char adminstring[REALLEN];
char operhost[REALLEN];
char operstring[REALLEN];
char adminstring[REALLEN];
};
struct Metadata
{
const char *name;
const char *value;
time_t timevalue;
struct Metadata {
const char *name;
const char *value;
time_t timevalue;
};
struct Counter
{
int oper; /* Opers */
int total; /* total clients */
int invisi; /* invisible clients */
int max_loc; /* MAX local clients */
int max_tot; /* MAX global clients */
unsigned long totalrestartcount; /* Total client count ever */
struct Counter {
int oper; /* Opers */
int total; /* total clients */
int invisi; /* invisible clients */
int max_loc; /* MAX local clients */
int max_tot; /* MAX global clients */
unsigned long totalrestartcount; /* Total client count ever */
};
extern struct SetOptions GlobalSetOptions; /* defined in ircd.c */

View File

@ -26,7 +26,7 @@
/*
* NOTE: NICKLEN and TOPICLEN do not live here anymore. Set it with configure
* Otherwise there are no user servicable part here.
* Otherwise there are no user servicable part here.
*
*/
@ -94,7 +94,7 @@
#endif
#define HOSTLEN 63 /* Length of hostname. Updated to */
/* comply with RFC1123 */
/* comply with RFC1123 */
#define USERLEN 10
#define REALLEN 50
@ -121,8 +121,8 @@
#define HELPLEN 400
/*
* message return values
/*
* message return values
*/
#define CLIENT_EXITED -2
#define CLIENT_PARSE_ERROR -1

View File

@ -26,14 +26,13 @@
#ifndef __GETOPT_H_INCLUDED__
#define __GETOPT_H_INCLUDED__
struct lgetopt
{
const char *opt; /* name of the argument */
void *argloc; /* where we store the argument to it (-option argument) */
enum
{ INTEGER, YESNO, STRING, USAGE, ENDEBUG }
argtype;
const char *desc; /* description of the argument, usage for printing help */
struct lgetopt {
const char *opt; /* name of the argument */
void *argloc; /* where we store the argument to it (-option argument) */
enum
{ INTEGER, YESNO, STRING, USAGE, ENDEBUG }
argtype;
const char *desc; /* description of the argument, usage for printing help */
};
extern struct lgetopt myopts[];

View File

@ -37,10 +37,9 @@
#include <dlfcn.h>
struct ircd_symbol
{
char *sym; /* name of symbol to be bound to ptr */
void *ptr; /* ptr to symbol in library */
struct ircd_symbol {
char *sym; /* name of symbol to be bound to ptr */
void *ptr; /* ptr to symbol in library */
};
extern void build_symtable(void *, struct ircd_symbol *);

View File

@ -30,18 +30,17 @@
struct Client;
struct Listener
{
struct Listener *next; /* list node pointer */
const char *name; /* listener name */
rb_fde_t *F; /* file descriptor */
int ref_count; /* number of connection references */
int active; /* current state of listener */
int ssl; /* ssl listener */
int defer_accept; /* use TCP_DEFER_ACCEPT */
struct rb_sockaddr_storage addr;
struct DNSQuery *dns_query;
char vhost[HOSTLEN + 1]; /* virtual name of listener */
struct Listener {
struct Listener *next; /* list node pointer */
const char *name; /* listener name */
rb_fde_t *F; /* file descriptor */
int ref_count; /* number of connection references */
int active; /* current state of listener */
int ssl; /* ssl listener */
int defer_accept; /* use TCP_DEFER_ACCEPT */
struct rb_sockaddr_storage addr;
struct DNSQuery *dns_query;
char vhost[HOSTLEN + 1]; /* virtual name of listener */
};
extern void add_listener(int port, const char *vaddr_ip, int family, int ssl, int defer_accept);

View File

@ -35,19 +35,18 @@
#include "ircd_defs.h"
typedef enum ilogfile
{
L_MAIN,
L_USER,
L_FUSER,
L_OPERED,
L_FOPER,
L_SERVER,
L_KILL,
L_KLINE,
L_OPERSPY,
L_IOERROR,
LAST_LOGFILE
typedef enum ilogfile {
L_MAIN,
L_USER,
L_FUSER,
L_OPERED,
L_FOPER,
L_SERVER,
L_KILL,
L_KLINE,
L_OPERSPY,
L_IOERROR,
LAST_LOGFILE
} ilogfile;
struct Client;

View File

@ -28,136 +28,155 @@
#include "config.h"
typedef struct Information
{
const char *name; /* name of item */
const char *strvalue; /* value of item if it's a boolean */
int intvalue; /* value of item if it's an integer */
const char *desc; /* short description of item */
typedef struct Information {
const char *name; /* name of item */
const char *strvalue; /* value of item if it's a boolean */
int intvalue; /* value of item if it's an integer */
const char *desc; /* short description of item */
}
Info;
Info MyInformation[] = {
#ifdef CPATH
{"CPATH", CPATH, 0, "Path to Main Configuration File"},
{"CPATH", CPATH, 0, "Path to Main Configuration File"},
#else
{"CPATH", "NONE", 0, "Path to Main Configuration File"},
{"CPATH", "NONE", 0, "Path to Main Configuration File"},
#endif /* CPATH */
#ifdef DPATH
{"DPATH", DPATH, 0, "Directory Containing Configuration Files"},
{"DPATH", DPATH, 0, "Directory Containing Configuration Files"},
#else
{"DPATH", "NONE", 0, "Directory Containing Configuration Files"},
{"DPATH", "NONE", 0, "Directory Containing Configuration Files"},
#endif /* DPATH */
#ifdef HPATH
{"HPATH", HPATH, 0, "Path to Operator Help Files"},
{"HPATH", HPATH, 0, "Path to Operator Help Files"},
#else
{"HPATH", "NONE", 0, "Path to Operator Help Files"},
{"HPATH", "NONE", 0, "Path to Operator Help Files"},
#endif /* HPATH */
#ifdef UHPATH
{"UHPATH", UHPATH, 0, "Path to User Help Files"},
{"UHPATH", UHPATH, 0, "Path to User Help Files"},
#else
{"UHPATH", "NONE", 0, "Path to User Help Files"},
{"UHPATH", "NONE", 0, "Path to User Help Files"},
#endif /* UH PATH */
#ifdef SOMAXCONN
{"RATBOX_SOMAXCONN", "", SOMAXCONN,
"Maximum Queue Length of Pending Connections"},
{
"RATBOX_SOMAXCONN", "", SOMAXCONN,
"Maximum Queue Length of Pending Connections"
},
#else
{"RATBOX_SOMAXCONN", "", RATBOX_SOMAXCONN,
"Maximum Queue Length of Pending Connections"},
{
"RATBOX_SOMAXCONN", "", RATBOX_SOMAXCONN,
"Maximum Queue Length of Pending Connections"
},
#endif /* SOMAXCONN */
#ifdef RB_IPV6
{"IPV6", "ON", 0, "IPv6 Support"},
{"IPV6", "ON", 0, "IPv6 Support"},
#else
{"IPV6", "OFF", 0, "IPv6 Support"},
{"IPV6", "OFF", 0, "IPv6 Support"},
#endif
{"JOIN_LEAVE_COUNT_EXPIRE_TIME", "", JOIN_LEAVE_COUNT_EXPIRE_TIME,
"Anti SpamBot Parameter"},
{
"JOIN_LEAVE_COUNT_EXPIRE_TIME", "", JOIN_LEAVE_COUNT_EXPIRE_TIME,
"Anti SpamBot Parameter"
},
{"KILLCHASETIMELIMIT", "", KILLCHASETIMELIMIT,
"Nick Change Tracker for KILL"},
{
"KILLCHASETIMELIMIT", "", KILLCHASETIMELIMIT,
"Nick Change Tracker for KILL"
},
#ifdef LPATH
{"LPATH", LPATH, 0, "Path to Log File"},
{"LPATH", LPATH, 0, "Path to Log File"},
#else
{"LPATH", "NONE", 0, "Path to Log File"},
{"LPATH", "NONE", 0, "Path to Log File"},
#endif /* LPATH */
{"MAX_BUFFER", "", MAX_BUFFER, "Maximum Buffer Connections Allowed"},
{"MAX_BUFFER", "", MAX_BUFFER, "Maximum Buffer Connections Allowed"},
{"MAX_JOIN_LEAVE_COUNT", "", MAX_JOIN_LEAVE_COUNT,
"Anti SpamBot Parameter"},
{
"MAX_JOIN_LEAVE_COUNT", "", MAX_JOIN_LEAVE_COUNT,
"Anti SpamBot Parameter"
},
{"MIN_JOIN_LEAVE_TIME", "", MIN_JOIN_LEAVE_TIME,
"Anti SpamBot Parameter"},
{
"MIN_JOIN_LEAVE_TIME", "", MIN_JOIN_LEAVE_TIME,
"Anti SpamBot Parameter"
},
#ifdef MPATH
{"MPATH", MPATH, 0, "Path to MOTD File"},
{"MPATH", MPATH, 0, "Path to MOTD File"},
#else
{"MPATH", "NONE", 0, "Path to MOTD File"},
{"MPATH", "NONE", 0, "Path to MOTD File"},
#endif /* MPATH */
{"NICKNAMEHISTORYLENGTH", "", NICKNAMEHISTORYLENGTH,
"Size of WHOWAS Array"},
{
"NICKNAMEHISTORYLENGTH", "", NICKNAMEHISTORYLENGTH,
"Size of WHOWAS Array"
},
#ifdef OPATH
{"OPATH", OPATH, 0, "Path to Operator MOTD File"},
{"OPATH", OPATH, 0, "Path to Operator MOTD File"},
#else
{"OPATH", "NONE", 0, "Path to Operator MOTD File"},
{"OPATH", "NONE", 0, "Path to Operator MOTD File"},
#endif /* OPATH */
{"OPER_SPAM_COUNTDOWN", "", OPER_SPAM_COUNTDOWN,
"Anti SpamBot Parameter"},
{
"OPER_SPAM_COUNTDOWN", "", OPER_SPAM_COUNTDOWN,
"Anti SpamBot Parameter"
},
#ifdef HAVE_LIBCRYPTO
{"HAVE_LIBCRYPTO", "ON", 0, "Enable OpenSSL CHALLENGE Support"},
{"HAVE_LIBCRYPTO", "ON", 0, "Enable OpenSSL CHALLENGE Support"},
#else
{"HAVE_LIBCRYPTO", "OFF", 0, "Enable OpenSSL CHALLENGE Support"},
{"HAVE_LIBCRYPTO", "OFF", 0, "Enable OpenSSL CHALLENGE Support"},
#endif /* HAVE_LIBCRYPTO */
#ifdef HAVE_LIBZ
{"HAVE_LIBZ", "YES", 0, "zlib (ziplinks) support"},
{"HAVE_LIBZ", "YES", 0, "zlib (ziplinks) support"},
#else
{"HAVE_LIBZ", "NO", 0, "zlib (ziplinks) support"},
{"HAVE_LIBZ", "NO", 0, "zlib (ziplinks) support"},
#endif /* HAVE_LIBZ */
#ifdef PPATH
{"PPATH", PPATH, 0, "Path to Pid File"},
{"PPATH", PPATH, 0, "Path to Pid File"},
#else
{"PPATH", "NONE", 0, "Path to Pid File"},
{"PPATH", "NONE", 0, "Path to Pid File"},
#endif /* PPATH */
{"SELECT_TYPE", SELECT_TYPE, 0, "Method of Multiplexed I/O"},
{"SELECT_TYPE", SELECT_TYPE, 0, "Method of Multiplexed I/O"},
#ifdef SPATH
{"SPATH", SPATH, 0, "Path to Server Executable"},
{"SPATH", SPATH, 0, "Path to Server Executable"},
#else
{"SPATH", "NONE", 0, "Path to Server Executable"},
{"SPATH", "NONE", 0, "Path to Server Executable"},
#endif /* SPATH */
{"TS_MAX_DELTA_DEFAULT", "", TS_MAX_DELTA_DEFAULT,
"Maximum Allowed TS Delta from another Server"},
{"TS_WARN_DELTA_DEFAULT", "", TS_WARN_DELTA_DEFAULT,
"Maximum TS Delta before Sending Warning"},
{
"TS_MAX_DELTA_DEFAULT", "", TS_MAX_DELTA_DEFAULT,
"Maximum Allowed TS Delta from another Server"
},
{
"TS_WARN_DELTA_DEFAULT", "", TS_WARN_DELTA_DEFAULT,
"Maximum TS Delta before Sending Warning"
},
#ifdef USE_IODEBUG_HOOKS
{"USE_IODEBUG_HOOKS", "YES", 0, "IO Debugging support"},
{"USE_IODEBUG_HOOKS", "YES", 0, "IO Debugging support"},
#else
{"USE_IODEBUG_HOOKS", "NO", 0, "IO Debugging support"},
{"USE_IODEBUG_HOOKS", "NO", 0, "IO Debugging support"},
#endif
/*
* since we don't want to include the world here, NULL probably
* isn't defined by the time we read this, just use plain 0 instead
* 0 is guaranteed by the language to be assignable to ALL built
* in types with the correct results.
*/
{0, 0, 0, 0}
/*
* since we don't want to include the world here, NULL probably
* isn't defined by the time we read this, just use plain 0 instead
* 0 is guaranteed by the language to be assignable to ALL built
* in types with the correct results.
*/
{0, 0, 0, 0}
};

View File

@ -51,9 +51,9 @@ int comp_with_mask(void *addr, void *dest, u_int mask);
int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, u_int mask);
/*
* collapse - collapse a string in place, converts multiple adjacent *'s
* collapse - collapse a string in place, converts multiple adjacent *'s
* into a single *.
* collapse - modifies the contents of pattern
* collapse - modifies the contents of pattern
*
* collapse_esc() - collapse with support for escaping chars
*/

View File

@ -41,19 +41,17 @@
#include "msg.h"
#include "hook.h"
struct module
{
char *name;
const char *version;
void *address;
int core;
int mapi_version;
void * mapi_header; /* actually struct mapi_mheader_av<mapi_version> */
struct module {
char *name;
const char *version;
void *address;
int core;
int mapi_version;
void * mapi_header; /* actually struct mapi_mheader_av<mapi_version> */
};
struct module_path
{
char path[MAXPATHLEN];
struct module_path {
char path[MAXPATHLEN];
};
#define MAPI_MAGIC_HDR 0x4D410000
@ -65,28 +63,25 @@ struct module_path
typedef struct Message* mapi_clist_av1;
typedef struct
{
const char * hapi_name;
int * hapi_id;
typedef struct {
const char * hapi_name;
int * hapi_id;
} mapi_hlist_av1;
typedef struct
{
const char * hapi_name;
hookfn fn;
typedef struct {
const char * hapi_name;
hookfn fn;
} mapi_hfn_list_av1;
struct mapi_mheader_av1
{
int mapi_version; /* Module API version */
int (*mapi_register) (void); /* Register function;
struct mapi_mheader_av1 {
int mapi_version; /* Module API version */
int (*mapi_register) (void); /* Register function;
ret -1 = failure (unload) */
void (*mapi_unregister) (void); /* Unregister function. */
mapi_clist_av1 * mapi_command_list; /* List of commands to add. */
mapi_hlist_av1 * mapi_hook_list; /* List of hooks to add. */
mapi_hfn_list_av1 *mapi_hfn_list; /* List of hook_add_hook's to do */
const char * mapi_module_version; /* Module's version (freeform) */
void (*mapi_unregister) (void); /* Unregister function. */
mapi_clist_av1 * mapi_command_list; /* List of commands to add. */
mapi_hlist_av1 * mapi_hook_list; /* List of hooks to add. */
mapi_hfn_list_av1 *mapi_hfn_list; /* List of hook_add_hook's to do */
const char * mapi_module_version; /* Module's version (freeform) */
};
#ifndef STATIC_MODULES

View File

@ -1,4 +1,4 @@
/*
/*
* ircd-ratbox: an advanced Internet Relay Chat Daemon(ircd).
* monitor.h: Code for server-side notify lists.
*
@ -11,11 +11,10 @@
struct rb_bh;
struct monitor
{
struct monitor *hnext;
char name[NICKLEN];
rb_dlink_list users;
struct monitor {
struct monitor *hnext;
char name[NICKLEN];
rb_dlink_list users;
};
extern struct monitor *monitorTable[];

View File

@ -31,15 +31,14 @@
struct Client;
/* MessageHandler */
typedef enum HandlerType
{
UNREGISTERED_HANDLER,
CLIENT_HANDLER,
RCLIENT_HANDLER,
SERVER_HANDLER,
ENCAP_HANDLER,
OPER_HANDLER,
LAST_HANDLER_TYPE
typedef enum HandlerType {
UNREGISTERED_HANDLER,
CLIENT_HANDLER,
RCLIENT_HANDLER,
SERVER_HANDLER,
ENCAP_HANDLER,
OPER_HANDLER,
LAST_HANDLER_TYPE
}
HandlerType;
@ -50,27 +49,25 @@ HandlerType;
*/
typedef int (*MessageHandler) (struct Client *, struct Client *, int, const char *[]);
struct MessageEntry
{
MessageHandler handler;
int min_para;
struct MessageEntry {
MessageHandler handler;
int min_para;
};
/* Message table structure */
struct Message
{
const char *cmd;
unsigned int count; /* number of times command used */
unsigned int rcount; /* number of times command used by server */
unsigned long bytes; /* bytes received for this message */
unsigned int flags; /* bit 0 set means that this command is allowed
struct Message {
const char *cmd;
unsigned int count; /* number of times command used */
unsigned int rcount; /* number of times command used by server */
unsigned long bytes; /* bytes received for this message */
unsigned int flags; /* bit 0 set means that this command is allowed
* to be used only on the average of once per 2
* seconds -SRB
*/
/* handlers:
* UNREGISTERED, CLIENT, RCLIENT, SERVER, OPER, LAST
*/
struct MessageEntry handlers[LAST_HANDLER_TYPE];
/* handlers:
* UNREGISTERED, CLIENT, RCLIENT, SERVER, OPER, LAST
*/
struct MessageEntry handlers[LAST_HANDLER_TYPE];
};
#define MFLG_SLOW 0x01 /* executed roughly once per 2s */

View File

@ -5,22 +5,20 @@
#ifndef _NEWCONF_H_INCLUDED
#define _NEWCONF_H_INCLUDED
struct ConfEntry
{
const char *cf_name;
int cf_type;
void (*cf_func) (void *);
int cf_len;
void *cf_arg;
struct ConfEntry {
const char *cf_name;
int cf_type;
void (*cf_func) (void *);
int cf_len;
void *cf_arg;
};
struct TopConf
{
const char *tc_name;
int (*tc_sfunc) (struct TopConf *);
int (*tc_efunc) (struct TopConf *);
rb_dlink_list tc_items;
struct ConfEntry *tc_entries;
struct TopConf {
const char *tc_name;
int (*tc_sfunc) (struct TopConf *);
int (*tc_efunc) (struct TopConf *);
rb_dlink_list tc_items;
struct ConfEntry *tc_entries;
};
@ -37,17 +35,15 @@ struct TopConf
#define CF_FLIST 0x1000
#define CF_MFLAG 0xFF00
typedef struct conf_parm_t_stru
{
struct conf_parm_t_stru *next;
int type;
union
{
char *string;
int number;
struct conf_parm_t_stru *list;
}
v;
typedef struct conf_parm_t_stru {
struct conf_parm_t_stru *next;
int type;
union {
char *string;
int number;
struct conf_parm_t_stru *list;
}
v;
}
conf_parm_t;

View File

@ -77,7 +77,7 @@ extern const char *form_str(int);
#define RPL_STATSYLINE 218
#define RPL_ENDOFSTATS 219
/* note ircu uses 217 for STATSPLINE frip. conflict
* as RPL_STATSQLINE was used in old 2.8 for Q line
* as RPL_STATSQLINE was used in old 2.8 for Q line
* I'm going to steal 220 for now *sigh*
* -Dianora
*/
@ -318,7 +318,7 @@ extern const char *form_str(int);
#define ERR_USERNOTONSERV 504
/* #define ERR_LAST_ERR_MSG 505
/* #define ERR_LAST_ERR_MSG 505
* moved to 999
*/
#define ERR_WRONGPONG 513

View File

@ -35,7 +35,7 @@
* the network..
* -- adrian
*/
/* MAX_FLOOD is the amount of lines in a 'burst' we allow from a client,
/* MAX_FLOOD is the amount of lines in a 'burst' we allow from a client,
* anything beyond MAX_FLOOD is limited to about one line per second.
*
* MAX_FLOOD_CONN is the amount of lines we allow from a client who has

View File

@ -32,8 +32,8 @@ struct Message;
struct Client;
extern void parse(struct Client *, char *, char *);
extern void handle_encap(struct Client *, struct Client *,
const char *, int, const char *parv[]);
extern void handle_encap(struct Client *, struct Client *,
const char *, int, const char *parv[]);
extern void clear_hash_parse(void);
extern void mod_add_cmd(struct Message *msg);
extern void mod_del_cmd(struct Message *msg);

View File

@ -27,17 +27,17 @@
#include "stdinc.h"
enum {
PRIV_NEEDOPER = 1
PRIV_NEEDOPER = 1
};
typedef unsigned int PrivilegeFlags;
struct PrivilegeSet {
unsigned int status; /* If CONF_ILLEGAL, delete when no refs */
int refs;
char *name;
char *privs;
PrivilegeFlags flags;
rb_dlink_node node;
unsigned int status; /* If CONF_ILLEGAL, delete when no refs */
int refs;
char *name;
char *privs;
PrivilegeFlags flags;
rb_dlink_node node;
};
int privilegeset_in_set(struct PrivilegeSet *set, const char *priv);

View File

@ -12,22 +12,20 @@
#include "match.h"
#include "ircd.h"
/* Maximum number of nameservers in /etc/resolv.conf we care about
/* Maximum number of nameservers in /etc/resolv.conf we care about
* In hybrid, this was 2 -- but in Charybdis, we want to track
* a few more than that ;) --nenolod
*/
#define IRCD_MAXNS 10
struct DNSReply
{
char *h_name;
struct rb_sockaddr_storage addr;
struct DNSReply {
char *h_name;
struct rb_sockaddr_storage addr;
};
struct DNSQuery
{
void *ptr; /* pointer used by callback to identify request */
void (*callback)(void* vptr, struct DNSReply *reply); /* callback to call */
struct DNSQuery {
void *ptr; /* pointer used by callback to identify request */
void (*callback)(void* vptr, struct DNSReply *reply); /* callback to call */
};
extern struct rb_sockaddr_storage irc_nsaddr_list[];

View File

@ -34,41 +34,40 @@
#define RRFIXEDSZ 10
#define HFIXEDSZ 12
typedef struct
{
unsigned id :16; /* query identification number */
typedef struct {
unsigned id :16; /* query identification number */
#ifdef WORDS_BIGENDIAN
/* fields in third byte */
unsigned qr: 1; /* response flag */
unsigned opcode: 4; /* purpose of message */
unsigned aa: 1; /* authoritive answer */
unsigned tc: 1; /* truncated message */
unsigned rd: 1; /* recursion desired */
/* fields in fourth byte */
unsigned ra: 1; /* recursion available */
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
unsigned ad: 1; /* authentic data from named */
unsigned cd: 1; /* checking disabled by resolver */
unsigned rcode :4; /* response code */
/* fields in third byte */
unsigned qr: 1; /* response flag */
unsigned opcode: 4; /* purpose of message */
unsigned aa: 1; /* authoritive answer */
unsigned tc: 1; /* truncated message */
unsigned rd: 1; /* recursion desired */
/* fields in fourth byte */
unsigned ra: 1; /* recursion available */
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
unsigned ad: 1; /* authentic data from named */
unsigned cd: 1; /* checking disabled by resolver */
unsigned rcode :4; /* response code */
#else
/* fields in third byte */
unsigned rd :1; /* recursion desired */
unsigned tc :1; /* truncated message */
unsigned aa :1; /* authoritive answer */
unsigned opcode :4; /* purpose of message */
unsigned qr :1; /* response flag */
/* fields in fourth byte */
unsigned rcode :4; /* response code */
unsigned cd: 1; /* checking disabled by resolver */
unsigned ad: 1; /* authentic data from named */
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
unsigned ra :1; /* recursion available */
/* fields in third byte */
unsigned rd :1; /* recursion desired */
unsigned tc :1; /* truncated message */
unsigned aa :1; /* authoritive answer */
unsigned opcode :4; /* purpose of message */
unsigned qr :1; /* response flag */
/* fields in fourth byte */
unsigned rcode :4; /* response code */
unsigned cd: 1; /* checking disabled by resolver */
unsigned ad: 1; /* authentic data from named */
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
unsigned ra :1; /* recursion available */
#endif
/* remaining bytes */
unsigned qdcount :16; /* number of question entries */
unsigned ancount :16; /* number of answer entries */
unsigned nscount :16; /* number of authority entries */
unsigned arcount :16; /* number of resource entries */
/* remaining bytes */
unsigned qdcount :16; /* number of question entries */
unsigned ancount :16; /* number of answer entries */
unsigned nscount :16; /* number of authority entries */
unsigned arcount :16; /* number of resource entries */
} HEADER;
/*

View File

@ -43,39 +43,36 @@ struct hostent;
/* used by new parser */
/* yacc/lex love globals!!! */
struct ip_value
{
struct rb_sockaddr_storage ip;
int ip_mask;
int type;
struct ip_value {
struct rb_sockaddr_storage ip;
int ip_mask;
int type;
};
extern FILE *conf_fbfile_in;
extern char conf_line_in[256];
struct ConfItem
{
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
unsigned int flags;
int clients; /* Number of *LOCAL* clients using this */
union
{
char *name; /* IRC name, nick, server name, or original u@h */
const char *oper;
} info;
char *host; /* host part of user@host */
char *passwd; /* doubles as kline reason *ugh* */
char *spasswd; /* Password to send. */
char *autojoin; /* channels for users to autojoin to on connect */
char *autojoin_opers; /* channels for opers to autojoin on oper-up */
char *user; /* user part of user@host */
int port;
time_t hold; /* Hold action until this time (calendar time) */
time_t created; /* Creation time (for klines etc) */
time_t lifetime; /* Propagated lines: remember until this time */
char *className; /* Name of class */
struct Class *c_class; /* Class of connection */
rb_patricia_node_t *pnode; /* Our patricia node */
struct ConfItem {
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
unsigned int flags;
int clients; /* Number of *LOCAL* clients using this */
union {
char *name; /* IRC name, nick, server name, or original u@h */
const char *oper;
} info;
char *host; /* host part of user@host */
char *passwd; /* doubles as kline reason *ugh* */
char *spasswd; /* Password to send. */
char *autojoin; /* channels for users to autojoin to on connect */
char *autojoin_opers; /* channels for opers to autojoin on oper-up */
char *user; /* user part of user@host */
int port;
time_t hold; /* Hold action until this time (calendar time) */
time_t created; /* Creation time (for klines etc) */
time_t lifetime; /* Propagated lines: remember until this time */
char *className; /* Name of class */
struct Class *c_class; /* Class of connection */
rb_patricia_node_t *pnode; /* Our patricia node */
};
#define CONF_ILLEGAL 0x80000000
@ -137,192 +134,186 @@ struct ConfItem
/* flag definitions for opers now in client.h */
struct config_file_entry
{
const char *dpath; /* DPATH if set from command line */
const char *configfile;
struct config_file_entry {
const char *dpath; /* DPATH if set from command line */
const char *configfile;
char *egdpool_path;
char *egdpool_path;
char *default_operstring;
char *default_adminstring;
char *default_operhost;
char *static_quit;
char *servicestring;
char *kline_reason;
char *default_operstring;
char *default_adminstring;
char *default_operhost;
char *static_quit;
char *servicestring;
char *kline_reason;
char *identifyservice;
char *identifycommand;
char *fname_userlog;
char *fname_fuserlog;
char *fname_operlog;
char *fname_foperlog;
char *fname_serverlog;
char *fname_killlog;
char *fname_klinelog;
char *fname_operspylog;
char *fname_ioerrorlog;
char *identifyservice;
char *identifycommand;
unsigned char compression_level;
int disable_fake_channels;
int hide_channel_below_users;
int dots_in_ident;
int failed_oper_notice;
int anti_nick_flood;
int use_part_messages;
int anti_spam_exit_message_time;
int max_accept;
int max_monitor;
int max_nick_time;
int max_nick_changes;
int ts_max_delta;
int ts_warn_delta;
int dline_with_reason;
int kline_with_reason;
int kline_delay;
int warn_no_nline;
int nick_delay;
int non_redundant_klines;
int stats_e_disabled;
int stats_c_oper_only;
int stats_y_oper_only;
int stats_h_oper_only;
int stats_o_oper_only;
int stats_k_oper_only;
int stats_i_oper_only;
int stats_P_oper_only;
int map_oper_only;
int operspy_admin_only;
int pace_wait;
int pace_wait_simple;
int short_motd;
int no_oper_flood;
int true_no_oper_flood;
int hide_server;
int hide_spoof_ips;
int hide_error_messages;
int client_exit;
int oper_only_umodes;
int oper_umodes;
int oper_snomask;
int max_targets;
int caller_id_wait;
int min_nonwildcard;
int min_nonwildcard_simple;
int default_floodcount;
int client_flood;
int default_ident_timeout;
int use_egd;
int ping_cookie;
int tkline_expire_notices;
int use_whois_actually;
int disable_auth;
int connect_timeout;
int burst_away;
int reject_ban_time;
int reject_after_count;
int reject_duration;
int throttle_count;
int throttle_duration;
int target_change;
int collision_fnc;
int default_umodes;
int global_snotices;
int operspy_dont_care_user_info;
int use_propagated_bans;
int secret_channels_in_whois;
int expire_override_time;
char *fname_userlog;
char *fname_fuserlog;
char *fname_operlog;
char *fname_foperlog;
char *fname_serverlog;
char *fname_killlog;
char *fname_klinelog;
char *fname_operspylog;
char *fname_ioerrorlog;
unsigned char compression_level;
int disable_fake_channels;
int hide_channel_below_users;
int dots_in_ident;
int failed_oper_notice;
int anti_nick_flood;
int use_part_messages;
int anti_spam_exit_message_time;
int max_accept;
int max_monitor;
int max_nick_time;
int max_nick_changes;
int ts_max_delta;
int ts_warn_delta;
int dline_with_reason;
int kline_with_reason;
int kline_delay;
int warn_no_nline;
int nick_delay;
int non_redundant_klines;
int stats_e_disabled;
int stats_c_oper_only;
int stats_y_oper_only;
int stats_h_oper_only;
int stats_o_oper_only;
int stats_k_oper_only;
int stats_i_oper_only;
int stats_P_oper_only;
int map_oper_only;
int operspy_admin_only;
int pace_wait;
int pace_wait_simple;
int short_motd;
int no_oper_flood;
int true_no_oper_flood;
int hide_server;
int hide_spoof_ips;
int hide_error_messages;
int client_exit;
int oper_only_umodes;
int oper_umodes;
int oper_snomask;
int max_targets;
int caller_id_wait;
int min_nonwildcard;
int min_nonwildcard_simple;
int default_floodcount;
int client_flood;
int default_ident_timeout;
int use_egd;
int ping_cookie;
int tkline_expire_notices;
int use_whois_actually;
int disable_auth;
int connect_timeout;
int burst_away;
int reject_ban_time;
int reject_after_count;
int reject_duration;
int throttle_count;
int throttle_duration;
int target_change;
int collision_fnc;
int default_umodes;
int global_snotices;
int operspy_dont_care_user_info;
int use_propagated_bans;
int secret_channels_in_whois;
int expire_override_time;
int away_interval;
};
struct config_channel_entry
{
char * autochanmodes;
char * exemptchanops;
char * disabledmodes;
int admin_on_channel_create;
int use_halfop;
int use_admin;
int use_owner;
int use_except;
int use_invex;
int use_knock;
int use_forward;
int use_local_channels;
int knock_delay;
int knock_delay_channel;
int max_bans;
int max_bans_large;
int max_chans_per_user;
int no_create_on_split;
int no_join_on_split;
int default_split_server_count;
int default_split_user_count;
int burst_topicwho;
int kick_on_split_riding;
int only_ascii_channels;
int cycle_host_change;
int host_in_topic;
int resv_forcepart;
int channel_target_change;
struct config_channel_entry {
char * autochanmodes;
char * exemptchanops;
char * disabledmodes;
int admin_on_channel_create;
int use_halfop;
int use_admin;
int use_owner;
int use_except;
int use_invex;
int use_knock;
int use_forward;
int use_local_channels;
int knock_delay;
int knock_delay_channel;
int max_bans;
int max_bans_large;
int max_chans_per_user;
int no_create_on_split;
int no_join_on_split;
int default_split_server_count;
int default_split_user_count;
int burst_topicwho;
int kick_on_split_riding;
int only_ascii_channels;
int cycle_host_change;
int host_in_topic;
int resv_forcepart;
int channel_target_change;
int exempt_cmode_c;
int exempt_cmode_C;
int exempt_cmode_D;
int exempt_cmode_T;
int exempt_cmode_N;
int exempt_cmode_G;
int exempt_cmode_K;
int exempt_cmode_c;
int exempt_cmode_C;
int exempt_cmode_D;
int exempt_cmode_T;
int exempt_cmode_N;
int exempt_cmode_G;
int exempt_cmode_K;
};
struct config_server_hide
{
int flatten_links;
int links_delay;
int hidden;
int disable_hidden;
struct config_server_hide {
int flatten_links;
int links_delay;
int hidden;
int disable_hidden;
};
struct server_info
{
char *name;
char sid[4];
char *description;
char *network_name;
char *network_desc;
char *helpchan;
char *helpurl;
int hub;
struct sockaddr_in ip;
int default_max_clients;
struct server_info {
char *name;
char sid[4];
char *description;
char *network_name;
char *network_desc;
char *helpchan;
char *helpurl;
int hub;
struct sockaddr_in ip;
int default_max_clients;
#ifdef RB_IPV6
struct sockaddr_in6 ip6;
struct sockaddr_in6 ip6;
#endif
int specific_ipv4_vhost;
int specific_ipv4_vhost;
#ifdef RB_IPV6
int specific_ipv6_vhost;
int specific_ipv6_vhost;
#endif
char *ssl_private_key;
char *ssl_ca_cert;
char *ssl_cert;
char *ssl_dh_params;
int ssld_count;
char *ssl_private_key;
char *ssl_ca_cert;
char *ssl_cert;
char *ssl_dh_params;
int ssld_count;
};
struct admin_info
{
char *name;
char *description;
char *email;
struct admin_info {
char *name;
char *description;
char *email;
};
struct alias_entry
{
char *name;
char *target;
int flags; /* reserved for later use */
int hits;
struct alias_entry {
char *name;
char *target;
int flags; /* reserved for later use */
int hits;
};
/* All variables are GLOBAL */
@ -339,13 +330,12 @@ extern rb_dlink_list service_list;
extern rb_dlink_list prop_bans;
typedef enum temp_list
{
TEMP_MIN,
TEMP_HOUR,
TEMP_DAY,
TEMP_WEEK,
LAST_TEMP_TYPE
typedef enum temp_list {
TEMP_MIN,
TEMP_HOUR,
TEMP_DAY,
TEMP_WEEK,
LAST_TEMP_TYPE
} temp_list;
extern rb_dlink_list temp_klines[LAST_TEMP_TYPE];
@ -370,10 +360,10 @@ extern int detach_conf(struct Client *);
extern struct ConfItem *find_tkline(const char *, const char *, struct sockaddr *);
extern char *show_iline_prefix(struct Client *, struct ConfItem *, char *);
extern void get_printable_conf(struct ConfItem *,
char **, char **, char **, char **, int *, char **);
char **, char **, char **, char **, int *, char **);
extern char *get_user_ban_reason(struct ConfItem *aconf);
extern void get_printable_kline(struct Client *, struct ConfItem *,
char **, char **, char **, char **);
char **, char **, char **, char **);
extern void yyerror(const char *);
extern int conf_yy_fatal_error(const char *);

View File

@ -59,25 +59,23 @@ extern void init_s_newconf(void);
extern void clear_s_newconf(void);
extern void clear_s_newconf_bans(void);
typedef struct
{
char *ip;
time_t expiry;
rb_patricia_node_t *pnode;
rb_dlink_node node;
typedef struct {
char *ip;
time_t expiry;
rb_patricia_node_t *pnode;
rb_dlink_node node;
} tgchange;
void add_tgchange(const char *host);
tgchange *find_tgchange(const char *host);
/* shared/cluster/hub/leaf confs */
struct remote_conf
{
char *username;
char *host;
char *server;
int flags;
rb_dlink_node node;
struct remote_conf {
char *username;
char *host;
char *server;
int flags;
rb_dlink_node node;
};
/* flags used in shared/cluster */
@ -107,28 +105,27 @@ struct remote_conf
#define CONF_HUB 0x0001
#define CONF_LEAF 0x0002
struct oper_conf
{
char *name;
char *username;
char *host;
char *passwd;
char *certfp;
struct oper_conf {
char *name;
char *username;
char *host;
char *passwd;
char *certfp;
int flags;
int umodes;
int flags;
int umodes;
unsigned int snomask;
unsigned int snomask;
char *vhost;
char *swhois;
char *operstring;
char *vhost;
char *swhois;
char *operstring;
struct PrivilegeSet *privset;
struct PrivilegeSet *privset;
#ifdef HAVE_LIBCRYPTO
char *rsa_pubkey_file;
RSA *rsa_pubkey;
char *rsa_pubkey_file;
RSA *rsa_pubkey;
#endif
};
@ -136,11 +133,11 @@ extern struct remote_conf *make_remote_conf(void);
extern void free_remote_conf(struct remote_conf *);
extern int find_shared_conf(const char *username, const char *host,
const char *server, int flags);
const char *server, int flags);
extern void propagate_generic(struct Client *source_p, const char *command,
const char *target, int cap, const char *format, ...);
const char *target, int cap, const char *format, ...);
extern void cluster_generic(struct Client *, const char *, int cltype,
int cap, const char *format, ...);
int cap, const char *format, ...);
#define OPER_ENCRYPTED 0x00001
#define OPER_NEEDSSL 0x80000
@ -177,28 +174,27 @@ extern void free_oper_conf(struct oper_conf *);
extern void clear_oper_conf(void);
extern struct oper_conf *find_oper_conf(const char *username, const char *host,
const char *locip, const char *oname);
const char *locip, const char *oname);
extern const char *get_oper_privs(int flags);
struct server_conf
{
char *name;
char *host;
char *passwd;
char *spasswd;
char *certfp;
int port;
int flags;
int servers;
time_t hold;
struct server_conf {
char *name;
char *host;
char *passwd;
char *spasswd;
char *certfp;
int port;
int flags;
int servers;
time_t hold;
int aftype;
struct rb_sockaddr_storage my_ipnum;
int aftype;
struct rb_sockaddr_storage my_ipnum;
char *class_name;
struct Class *class;
rb_dlink_node node;
char *class_name;
struct Class *class;
rb_dlink_node node;
};
#define SERVER_ILLEGAL 0x0001
@ -226,8 +222,8 @@ extern struct server_conf *find_server_conf(const char *name);
extern void attach_server_conf(struct Client *, struct server_conf *);
extern void detach_server_conf(struct Client *);
extern void set_server_conf_autoconn(struct Client *source_p, const char *name,
int newval);
extern void set_server_conf_autoconn(struct Client *source_p, const char *name,
int newval);
extern void disable_server_conf_autoconn(const char *name);
@ -240,11 +236,10 @@ extern int valid_wild_card_simple(const char *);
extern int clean_resv_nick(const char *);
time_t valid_temp_time(const char *p);
struct nd_entry
{
char name[NICKLEN+1];
time_t expire;
rb_dlink_node lnode; /* node in ll */
struct nd_entry {
char name[NICKLEN+1];
time_t expire;
rb_dlink_node lnode; /* node in ll */
};
extern void add_nd_entry(const char *name);

View File

@ -37,7 +37,7 @@
/*
* number of seconds to wait after server starts up, before
* starting try_connections()
* TOO SOON and you can nick collide like crazy.
* TOO SOON and you can nick collide like crazy.
*/
#define STARTUP_CONNECTIONS_TIME 60
@ -46,11 +46,10 @@ struct server_conf;
struct Channel;
/* Capabilities */
struct Capability
{
const char *name; /* name of capability */
unsigned int cap; /* mask value */
unsigned int required; /* 1 if required, 0 if not */
struct Capability {
const char *name; /* name of capability */
unsigned int cap; /* mask value */
unsigned int required; /* 1 if required, 0 if not */
};
#define CAP_CAP 0x00001 /* received a CAP to begin with */
@ -110,7 +109,7 @@ extern int MaxConnectionCount; /* GLOBAL - highest number of connections */
extern int refresh_user_links;
/*
* return values for hunt_server()
* return values for hunt_server()
*/
#define HUNTED_NOSUCH (-1) /* if the hunted server is not found */
#define HUNTED_ISME 0 /* if this server should execute the command */
@ -118,8 +117,8 @@ extern int refresh_user_links;
extern int hunt_server(struct Client *client_pt,
struct Client *source_pt,
const char *command, int server, int parc, const char **parv);
struct Client *source_pt,
const char *command, int server, int parc, const char **parv);
extern void send_capabilities(struct Client *, int);
extern const char *show_capabilities(struct Client *client);
extern void try_connections(void *unused);

View File

@ -39,33 +39,32 @@ struct Client;
/*
* statistics structures
*/
struct ServerStatistics
{
unsigned int is_cl; /* number of client connections */
unsigned int is_sv; /* number of server connections */
unsigned int is_ni; /* connection but no idea who it was */
unsigned long long int is_cbs; /* bytes sent to clients */
unsigned long long int is_cbr; /* bytes received to clients */
unsigned long long int is_sbs; /* bytes sent to servers */
unsigned long long int is_sbr; /* bytes received to servers */
unsigned long long int is_cti; /* time spent connected by clients */
unsigned long long int is_sti; /* time spent connected by servers */
unsigned int is_ac; /* connections accepted */
unsigned int is_ref; /* accepts refused */
unsigned int is_unco; /* unknown commands */
unsigned int is_wrdi; /* command going in wrong direction */
unsigned int is_unpf; /* unknown prefix */
unsigned int is_empt; /* empty message */
unsigned int is_num; /* numeric message */
unsigned int is_kill; /* number of kills generated on collisions */
unsigned int is_save; /* number of saves generated on collisions */
unsigned int is_asuc; /* successful auth requests */
unsigned int is_abad; /* bad auth requests */
unsigned int is_rej; /* rejected from cache */
unsigned int is_thr; /* number of throttled connections */
unsigned int is_ssuc; /* successful sasl authentications */
unsigned int is_sbad; /* failed sasl authentications */
unsigned int is_tgch; /* messages blocked due to target change */
struct ServerStatistics {
unsigned int is_cl; /* number of client connections */
unsigned int is_sv; /* number of server connections */
unsigned int is_ni; /* connection but no idea who it was */
unsigned long long int is_cbs; /* bytes sent to clients */
unsigned long long int is_cbr; /* bytes received to clients */
unsigned long long int is_sbs; /* bytes sent to servers */
unsigned long long int is_sbr; /* bytes received to servers */
unsigned long long int is_cti; /* time spent connected by clients */
unsigned long long int is_sti; /* time spent connected by servers */
unsigned int is_ac; /* connections accepted */
unsigned int is_ref; /* accepts refused */
unsigned int is_unco; /* unknown commands */
unsigned int is_wrdi; /* command going in wrong direction */
unsigned int is_unpf; /* unknown prefix */
unsigned int is_empt; /* empty message */
unsigned int is_num; /* numeric message */
unsigned int is_kill; /* number of kills generated on collisions */
unsigned int is_save; /* number of saves generated on collisions */
unsigned int is_asuc; /* successful auth requests */
unsigned int is_abad; /* bad auth requests */
unsigned int is_rej; /* rejected from cache */
unsigned int is_thr; /* number of throttled connections */
unsigned int is_ssuc; /* successful sasl authentications */
unsigned int is_sbad; /* failed sasl authentications */
unsigned int is_tgch; /* messages blocked due to target change */
};
extern struct ServerStatistics ServerStats;

View File

@ -42,11 +42,11 @@ extern void send_umode_out(struct Client *, struct Client *, int);
extern int show_lusers(struct Client *source_p);
extern int register_local_user(struct Client *, struct Client *, const char *);
extern int introduce_client(struct Client *client_p, struct Client *source_p,
struct User *user, const char *nick, int use_euid);
extern int introduce_client(struct Client *client_p, struct Client *source_p,
struct User *user, const char *nick, int use_euid);
extern void change_nick_user_host(struct Client *target_p, const char *nick, const char *user,
const char *host, int newts, const char *format, ...);
const char *host, int newts, const char *format, ...);
extern int user_modes[256];
extern unsigned int find_umode_slot(void);

View File

@ -46,19 +46,19 @@ extern void send_queued(struct Client *to);
extern void sendto_one(struct Client *target_p, const char *, ...) AFP(2, 3);
extern void sendto_one_notice(struct Client *target_p,const char *, ...) AFP(2, 3);
extern void sendto_one_prefix(struct Client *target_p, struct Client *source_p,
const char *command, const char *, ...) AFP(4, 5);
const char *command, const char *, ...) AFP(4, 5);
extern void sendto_one_numeric(struct Client *target_p,
int numeric, const char *, ...) AFP(3, 4);
int numeric, const char *, ...) AFP(3, 4);
extern void sendto_server(struct Client *one, struct Channel *chptr,
unsigned long caps, unsigned long nocaps,
const char *format, ...) AFP(5, 6);
unsigned long caps, unsigned long nocaps,
const char *format, ...) AFP(5, 6);
extern void sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
struct Channel *chptr, const char *, ...) AFP(5, 6);
struct Channel *chptr, const char *, ...) AFP(5, 6);
extern void sendto_channel_opmod(struct Client *one, struct Client *source_p,
struct Channel *chptr, const char *command,
const char *text);
struct Channel *chptr, const char *command,
const char *text);
extern void sendto_channel_local(int type, struct Channel *, const char *, ...) AFP(3, 4);
extern void sendto_channel_local_butone(struct Client *, int type, struct Channel *, const char *, ...) AFP(4, 5);
@ -70,14 +70,14 @@ extern void sendto_common_channels_local_butone(struct Client *, int cap, const
extern void sendto_match_butone(struct Client *, struct Client *,
const char *, int, const char *, ...) AFP(5, 6);
extern void sendto_match_servs(struct Client *source_p, const char *mask,
int capab, int, const char *, ...) AFP(5, 6);
const char *, int, const char *, ...) AFP(5, 6);
extern void sendto_match_servs(struct Client *source_p, const char *mask,
int capab, int, const char *, ...) AFP(5, 6);
extern void sendto_monitor(struct monitor *monptr, const char *, ...) AFP(2, 3);
extern void sendto_anywhere(struct Client *, struct Client *, const char *,
const char *, ...) AFP(4, 5);
const char *, ...) AFP(4, 5);
extern void sendto_realops_snomask(int, int, const char *, ...) AFP(3, 4);
extern void sendto_realops_snomask_from(int, int, struct Client *, const char *, ...) AFP(4, 5);
@ -85,9 +85,9 @@ extern void sendto_realops_snomask_from(int, int, struct Client *, const char *,
extern void sendto_wallops_flags(int, struct Client *, const char *, ...) AFP(3, 4);
extern void kill_client(struct Client *client_p, struct Client *diedie,
const char *pattern, ...) AFP(3, 4);
extern void kill_client_serv_butone(struct Client *one, struct Client *source_p,
const char *pattern, ...) AFP(3, 4);
const char *pattern, ...) AFP(3, 4);
extern void kill_client_serv_butone(struct Client *one, struct Client *source_p,
const char *pattern, ...) AFP(3, 4);
#define L_ALL 0
#define L_OPER 1

View File

@ -39,7 +39,7 @@
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
@ -48,7 +48,7 @@ char *alloca ();
# endif
# endif
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@ -142,7 +142,7 @@ extern int errno;
#ifdef strdupa
#define LOCAL_COPY(s) strdupa(s)
#define LOCAL_COPY(s) strdupa(s)
#else
#if defined(__INTEL_COMPILER) || defined(__GNUC__)
# define LOCAL_COPY(s) __extension__({ char *_s = alloca(strlen(s) + 1); strcpy(_s, s); _s; })

View File

@ -4,11 +4,11 @@
*
* Entirely rewritten, August 2006 by Jilles Tjoelker
* Copyright (C) 2006 Jilles Tjoelker
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
*
* 1.Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2.Redistributions in binary form must reproduce the above copyright
@ -16,7 +16,7 @@
* documentation and/or other materials provided with the distribution.
* 3.The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE

View File

@ -45,22 +45,21 @@ struct Client;
also removed away information. *tough*
- Dianora
*/
struct Whowas
{
int hashv;
char name[NICKLEN + 1];
char username[USERLEN + 1];
char hostname[HOSTLEN + 1];
char sockhost[HOSTIPLEN + 1];
char realname[REALLEN + 1];
char suser[NICKLEN + 1];
const char *servername;
time_t logoff;
struct Client *online; /* Pointer to new nickname for chasing or NULL */
struct Whowas *next; /* for hash table... */
struct Whowas *prev; /* for hash table... */
struct Whowas *cnext; /* for client struct linked list */
struct Whowas *cprev; /* for client struct linked list */
struct Whowas {
int hashv;
char name[NICKLEN + 1];
char username[USERLEN + 1];
char hostname[HOSTLEN + 1];
char sockhost[HOSTIPLEN + 1];
char realname[REALLEN + 1];
char suser[NICKLEN + 1];
const char *servername;
time_t logoff;
struct Client *online; /* Pointer to new nickname for chasing or NULL */
struct Whowas *next; /* for hash table... */
struct Whowas *prev; /* for hash table... */
struct Whowas *cnext; /* for client struct linked list */
struct Whowas *cprev; /* for client struct linked list */
};
/*
@ -93,8 +92,8 @@ void off_history(struct Client *);
** one found...
*/
struct Client *get_history(const char *, time_t);
/* Nick name */
/* Time limit in seconds */
/* Nick name */
/* Time limit in seconds */
/*
** for debugging...counts related structures stored in whowas array.

View File

@ -44,13 +44,13 @@
#ifdef HAVE_WRITEV
#ifndef UIO_MAXIOV
# if defined(__FreeBSD__) || defined(__APPLE__) || defined(__NetBSD__)
/* FreeBSD 4.7 defines it in sys/uio.h only if _KERNEL is specified */
/* FreeBSD 4.7 defines it in sys/uio.h only if _KERNEL is specified */
# define RB_UIO_MAXIOV 1024
# elif defined(__sgi)
/* IRIX 6.5 has sysconf(_SC_IOV_MAX) which might return 512 or bigger */
/* IRIX 6.5 has sysconf(_SC_IOV_MAX) which might return 512 or bigger */
# define RB_UIO_MAXIOV 512
# elif defined(__sun)
/* Solaris (and SunOS?) defines IOV_MAX instead */
/* Solaris (and SunOS?) defines IOV_MAX instead */
# ifndef IOV_MAX
# define RB_UIO_MAXIOV 16
# else
@ -68,24 +68,22 @@
#else
#define RB_UIO_MAXIOV 16
#endif
struct conndata
{
/* We don't need the host here ? */
struct rb_sockaddr_storage S;
struct rb_sockaddr_storage hostaddr;
time_t t;
CNCB *callback;
void *data;
/* We'd also add the retry count here when we get to that -- adrian */
struct conndata {
/* We don't need the host here ? */
struct rb_sockaddr_storage S;
struct rb_sockaddr_storage hostaddr;
time_t t;
CNCB *callback;
void *data;
/* We'd also add the retry count here when we get to that -- adrian */
};
struct acceptdata
{
struct rb_sockaddr_storage S;
rb_socklen_t addrlen;
ACCB *callback;
ACPRE *precb;
void *data;
struct acceptdata {
struct rb_sockaddr_storage S;
rb_socklen_t addrlen;
ACCB *callback;
ACPRE *precb;
void *data;
};
/* Only have open flags for now, could be more later */
@ -95,40 +93,38 @@ struct acceptdata
#define ClearFDOpen(F) (F->flags &= ~FLAG_OPEN)
struct _fde
{
/* New-school stuff, again pretty much ripped from squid */
/*
* Yes, this gives us only one pending read and one pending write per
* filedescriptor. Think though: when do you think we'll need more?
*/
rb_dlink_node node;
int fd; /* So we can use the rb_fde_t as a callback ptr */
uint8_t flags;
uint8_t type;
int pflags;
char *desc;
PF *read_handler;
void *read_data;
PF *write_handler;
void *write_data;
struct timeout_data *timeout;
struct conndata *connect;
struct acceptdata *accept;
void *ssl;
unsigned int handshake_count;
unsigned long ssl_errno;
struct _fde {
/* New-school stuff, again pretty much ripped from squid */
/*
* Yes, this gives us only one pending read and one pending write per
* filedescriptor. Think though: when do you think we'll need more?
*/
rb_dlink_node node;
int fd; /* So we can use the rb_fde_t as a callback ptr */
uint8_t flags;
uint8_t type;
int pflags;
char *desc;
PF *read_handler;
void *read_data;
PF *write_handler;
void *write_data;
struct timeout_data *timeout;
struct conndata *connect;
struct acceptdata *accept;
void *ssl;
unsigned int handshake_count;
unsigned long ssl_errno;
};
typedef void (*comm_event_cb_t) (void *);
#ifdef USE_TIMER_CREATE
typedef struct timer_data
{
timer_t td_timer_id;
comm_event_cb_t td_cb;
void *td_udata;
int td_repeat;
typedef struct timer_data {
timer_t td_timer_id;
comm_event_cb_t td_cb;
void *td_udata;
int td_repeat;
} *comm_event_id;
#endif
@ -137,24 +133,23 @@ extern rb_dlink_list *rb_fd_table;
static inline rb_fde_t *
rb_find_fd(int fd)
{
rb_dlink_list *hlist;
rb_dlink_node *ptr;
rb_dlink_list *hlist;
rb_dlink_node *ptr;
if(rb_unlikely(fd < 0))
return NULL;
if(rb_unlikely(fd < 0))
return NULL;
hlist = &rb_fd_table[rb_hash_fd(fd)];
hlist = &rb_fd_table[rb_hash_fd(fd)];
if(hlist->head == NULL)
return NULL;
if(hlist->head == NULL)
return NULL;
RB_DLINK_FOREACH(ptr, hlist->head)
{
rb_fde_t *F = ptr->data;
if(F->fd == fd)
return F;
}
return NULL;
RB_DLINK_FOREACH(ptr, hlist->head) {
rb_fde_t *F = ptr->data;
if(F->fd == fd)
return F;
}
return NULL;
}

View File

@ -35,7 +35,7 @@ const char *rb_get_ssl_strerror(rb_fde_t *F);
void rb_ssl_start_accepted(rb_fde_t *new_F, ACCB * cb, void *data, int timeout);
void rb_ssl_start_connected(rb_fde_t *F, CNCB * callback, void *data, int timeout);
void rb_connect_tcp_ssl(rb_fde_t *F, struct sockaddr *dest, struct sockaddr *clocal, int socklen,
CNCB * callback, void *data, int timeout);
CNCB * callback, void *data, int timeout);
void rb_ssl_accept_setup(rb_fde_t *F, rb_fde_t *new_F, struct sockaddr *st, int addrlen);
void rb_ssl_shutdown(rb_fde_t *F);
ssize_t rb_ssl_read(rb_fde_t *F, void *buf, size_t count);

View File

@ -22,16 +22,15 @@
*
*/
struct ev_entry
{
rb_dlink_node node;
EVH *func;
void *arg;
char *name;
time_t frequency;
time_t when;
time_t next;
void *data;
void *comm_ptr;
struct ev_entry {
rb_dlink_node node;
EVH *func;
void *arg;
char *name;
time_t frequency;
time_t when;
time_t next;
void *data;
void *comm_ptr;
};
void rb_event_io_register_all(void);

View File

@ -184,7 +184,7 @@ void rb_set_time(void);
const char *rb_lib_version(void);
void rb_lib_init(log_cb * xilog, restart_cb * irestart, die_cb * idie, int closeall, int maxfds,
size_t dh_size, size_t fd_heap_size);
size_t dh_size, size_t fd_heap_size);
void rb_lib_loop(long delay);
time_t rb_current_time(void);

Some files were not shown because too many files have changed in this diff Show More