1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675
|
/* convert-conf.c - Convert ircu2.10.11 ircd.conf to ircu2.10.12 format.
* Copyright 2005 Michael Poole
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
#include <ctype.h> /* tolower() */
#include <stdio.h> /* *printf(), fgets() */
#include <stdlib.h> /* free(), strtol() */
#include <string.h> /* strlen(), memcpy(), strchr(), strspn() */
#define MAX_FIELDS 5
const char *admin_names[] = { "location", "contact", "contact", 0 },
*connect_names[] = { "host", "password", "name", "#port", "class", 0 },
*crule_names[] = { "server", "", "rule", 0 },
*general_names[] = { "name", "vhost", "description", "", "#numeric", 0 },
*motd_names[] = { "host", "file", 0 },
*class_names[] = { "name", "#pingfreq", "#connectfreq", "#maxlinks", "#sendq", 0 },
*removed_features[] = { "VIRTUAL_HOST", "TIMESEC", "OPERS_SEE_IN_SECRET_CHANNELS", "LOCOP_SEE_IN_SECRET_CHANNELS", "HIS_STATS_h", "HIS_DESYNCS", "AUTOHIDE", 0 };
char orig_line[512], line[512], dbuf[512];
char *fields[MAX_FIELDS + 1];
unsigned int nfields;
unsigned int lineno;
/*** GENERIC SUPPORT CODE ***/
static int split_line(char *input, char **output)
{
size_t quoted = 0, jj;
char *dest = dbuf, ch;
nfields = 1;
output[0] = dest;
while (*input != '\0' && *input != '#') switch (ch = *input++) {
case ':':
if (quoted)
*dest++ = ch;
else {
*dest++ = '\0';
if (nfields >= MAX_FIELDS)
return nfields;
output[nfields++] = dest;
}
break;
case '\\':
switch (ch = *input++) {
case 'b': *dest++ = '\b'; break;
case 'f': *dest++ = '\f'; break;
case 'n': *dest++ = '\n'; break;
case 'r': *dest++ = '\r'; break;
case 't': *dest++ = '\t'; break;
case 'v': *dest++ = '\v'; break;
default: *dest++ = ch; break;
}
break;
case '"': quoted = !quoted; break;
default: *dest++ = ch; break;
}
*dest = '\0';
for (jj = nfields; jj < MAX_FIELDS; ++jj)
output[jj] = dest;
return nfields;
}
static void simple_line(const char *block, const char **names, const char *extra)
{
size_t ii;
/* Print the current line and start the new block. */
fprintf(stdout, "# %s\n%s {\n", orig_line, block);
/* Iterate over fields in input line, formatting each. */
for (ii = 0; ii < nfields && names[ii]; ++ii) {
if (!fields[ii][0] || !names[ii][0])
continue;
else if (names[ii][0] == '#')
fprintf(stdout, "\t%s = %s;\n", names[ii] + 1, fields[ii]);
else
fprintf(stdout, "\t%s = \"%s\";\n", names[ii], fields[ii]);
}
/* Close the new block (including any fixed-form text). */
if (extra)
fprintf(stdout, "\t%s\n", extra);
fputs("};\n", stdout);
}
#define dupstring(TARGET, SOURCE) do { free(TARGET); if (SOURCE) { size_t len = strlen(SOURCE) + 1; (TARGET) = malloc(len); memcpy((TARGET), (SOURCE), len); } else (TARGET) = 0; } while(0)
/*** MANAGING LISTS OF STRINGS ***/
struct string_list {
struct string_list *next;
char *origin;
char *extra;
char value[1];
};
/** Find or insert the element from \a list that contains \a value.
* If an element of \a list already contains \a value, return it.
* Otherwise, append a new element to \a list containing \a value and
* return it.
* @param[in,out] list A list of strings.
* @param[in] value A string to search for.
* @return A string list element from \a list containing \a value.
*/
static struct string_list *string_get(struct string_list **list, const char *value)
{
struct string_list *curr;
size_t len = strlen(value), ii;
while ((curr = *list)) {
for (ii = 0; tolower(curr->value[ii]) == tolower(value[ii]) && ii < len; ++ii) ;
if (curr->value[ii] == '\0' && value[ii] == '\0')
return curr;
list = &curr->next;
}
*list = calloc(1, sizeof(**list) + len);
memcpy((*list)->value, value, len);
return *list;
}
/*** SERVER CONNECTION RELATED CODE ***/
struct connect {
char *host;
char *password;
char *port;
char *class;
char *hub;
char *maximum;
struct connect *next;
struct string_list *origins;
char name[1];
} *connects;
static struct connect *get_connect(const char *name)
{
struct connect *conn;
size_t ii, nlen;
/* Look for a pre-existing connection with the same name. */
nlen = strlen(name);
for (conn = connects; conn; conn = conn->next)
{
for (ii = 0; tolower(name[ii]) == tolower(conn->name[ii]) && ii < nlen; ++ii) ;
if (conn->name[ii] == '\0' && name[ii] == '\0')
break;
}
/* If none was found, create a new one. */
if (!conn)
{
conn = calloc(1, sizeof(*conn) + nlen);
for (ii = 0; ii < nlen; ++ii)
conn->name[ii] = name[ii];
conn->next = connects;
connects = conn;
}
/* Return the connection. */
return conn;
}
static void do_connect(void)
{
struct connect *conn = get_connect(fields[2]);
dupstring(conn->host, fields[0]);
dupstring(conn->password, fields[1]);
dupstring(conn->port, fields[3]);
dupstring(conn->class, fields[4]);
string_get(&conn->origins, orig_line);
}
static void do_hub(void)
{
struct connect *conn = get_connect(fields[2]);
dupstring(conn->hub, fields[0]);
dupstring(conn->maximum, fields[3]);
string_get(&conn->origins, orig_line);
}
static void do_leaf(void)
{
struct connect *conn = get_connect(fields[2]);
free(conn->hub);
conn->hub = 0;
string_get(&conn->origins, orig_line);
}
static void finish_connects(void)
{
struct connect *conn;
struct string_list *sl;
for (conn = connects; conn; conn = conn->next)
{
for (sl = conn->origins; sl; sl = sl->next)
fprintf(stdout, "# %s\n", sl->value);
if (conn->host == NULL
|| conn->password == NULL
|| conn->class == NULL)
{
fprintf(stderr, "H:line missing C:line for %s\n", conn->name);
continue;
}
fprintf(stdout,
"Connect {\n\tname =\"%s\";\n\thost = \"%s\";\n"
"\tpassword = \"%s\";\n\tclass = \"%s\";\n",
conn->name, conn->host, conn->password, conn->class);
if (conn->port && conn->port[0] != '\0')
fprintf(stdout, "\tport = %s;\n", conn->port);
else
fprintf(stdout,
"# Every Connect block should have a port number.\n"
"# To prevent autoconnects, set autoconnect = no.\n"
"#\tport = 4400;\n"
"\tautoconnect = no;\n");
if (conn->maximum && conn->maximum[0] != '\0')
fprintf(stdout, "\tmaxhops = %s;\n", conn->maximum);
if (conn->hub && conn->hub[0] != '\0')
fprintf(stdout, "\thub = \"%s\";\n", conn->hub);
fprintf(stdout, "};\n\n");
}
}
/*** FEATURE MANAGEMENT CODE ***/
struct feature {
struct string_list *values;
struct string_list *origins;
struct feature *next;
char name[1];
} *features;
struct remapped_feature {
const char *name;
const char *privilege;
int flags; /* 2 = global, 1 = local */
struct feature *feature;
} remapped_features[] = {
/* Specially handled privileges: If you change the index of
* anything with NULL privilege, change the code in
* finish_operators() to match!
*/
{ "CRYPT_OPER_PASSWORD", NULL, 0, 0 }, /* default: true */
{ "OPER_KILL", NULL, 2, 0 }, /* default: true */
{ "LOCAL_KILL_ONLY", NULL, 2, 0 }, /* default: false */
/* remapped features that affect all opers */
{ "OPER_NO_CHAN_LIMIT", "chan_limit", 3, 0 },
{ "OPER_MODE_LCHAN", "mode_lchan", 3, 0 },
{ "OPER_WALK_THROUGH_LMODES", "walk_lchan", 3, 0 },
{ "NO_OPER_DEOP_LCHAN", "deop_lchan", 3, 0 },
{ "SHOW_INVISIBLE_USERS", "show_invis", 3, 0 },
{ "SHOW_ALL_INVISIBLE_USERS", "show_all_invis", 3, 0 },
{ "UNLIMIT_OPER_QUERY", "unlimit_query", 3, 0 },
/* remapped features affecting only global opers */
{ "OPER_REHASH", "rehash", 2, 0 },
{ "OPER_RESTART", "restart", 2, 0 },
{ "OPER_DIE", "die", 2, 0 },
{ "OPER_GLINE", "gline", 2, 0 },
{ "OPER_LGLINE", "local_gline", 2, 0 },
{ "OPER_JUPE", "jupe", 2, 0 },
{ "OPER_LJUPE", "local_jupe", 2, 0 },
{ "OPER_OPMODE", "opmode", 2, 0 },
{ "OPER_LOPMODE", "local_opmode", 2, 0 },
{ "OPER_FORCE_OPMODE", "force_opmode", 2, 0 },
{ "OPER_FORCE_LOPMODE", "force_local_opmode", 2, 0 },
{ "OPER_BADCHAN", "badchan", 2, 0 },
{ "OPER_LBADCHAN", "local_badchan", 2, 0 },
{ "OPER_SET", "set", 2, 0 },
{ "OPER_WIDE_GLINE", "wide_gline", 2, 0 },
/* remapped features affecting only local opers */
{ "LOCOP_KILL", "kill", 1, 0 },
{ "LOCOP_REHASH", "rehash", 1, 0 },
{ "LOCOP_RESTART", "restart", 1, 0 },
{ "LOCOP_DIE", "die", 1, 0 },
{ "LOCOP_LGLINE", "local_gline", 1, 0 },
{ "LOCOP_LJUPE", "local_jupe", 1, 0 },
{ "LOCOP_LOPMODE", "local_opmode", 1, 0 },
{ "LOCOP_FORCE_LOPMODE", "force_local_opmode", 1, 0 },
{ "LOCOP_LBADCHAN", "local_badchan", 1, 0 },
{ "LOCOP_WIDE_GLINE", "wide_gline", 1, 0 },
{ 0, 0, 0, 0 }
};
static void do_feature(void)
{
struct feature *feat;
size_t ii;
ii = strlen(fields[0]);
feat = calloc(1, sizeof(*feat) + ii);
while (ii-- > 0)
feat->name[ii] = fields[0][ii];
feat->next = features;
features = feat;
string_get(&feat->origins, orig_line);
for (ii = 1; fields[ii] && fields[ii][0]; ++ii)
string_get(&feat->values, fields[ii]);
}
static void finish_features(void)
{
struct remapped_feature *rmf;
struct string_list *sl;
struct feature *feat;
size_t ii;
fputs("Features {\n", stdout);
fputs("\t\"OPLEVELS\" = \"FALSE\";\n", stdout);
fputs("\t\"ZANNELS\" = \"FALSE\";\n", stdout);
for (feat = features; feat; feat = feat->next) {
/* Display the original feature line we are talking about. */
for (sl = feat->origins; sl; sl = sl->next)
fprintf(stdout, "# %s\n", sl->value);
/* See if the feature was remapped to an oper privilege. */
for (rmf = remapped_features; rmf->name; rmf++)
if (0 == strcmp(feat->name, rmf->name))
break;
if (rmf->name) {
rmf->feature = feat;
fprintf(stdout, "# Above feature mapped to an oper privilege.\n");
continue;
}
/* Was it removed? */
for (ii = 0; removed_features[ii]; ++ii)
if (0 == strcmp(feat->name, removed_features[ii]))
break;
if (removed_features[ii]) {
fprintf(stdout, "# Above feature no longer exists.\n");
continue;
}
/* If it had no value before, drop it now since the lexer does
* not accept empty strings and the grammar does not accept
* empty stringlists.*/
if (!feat->values) {
fprintf(stdout, "# Above feature had no value.\n");
continue;
}
/* Wasn't remapped, wasn't removed: print it out. */
fprintf(stdout, "\t\"%s\" =", feat->name);
for (sl = feat->values; sl; sl = sl->next)
fprintf(stdout, " \"%s\"", sl->value);
fprintf(stdout, ";\n");
}
fputs("};\n\n", stdout);
}
/*** OPERATOR BLOCKS ***/
struct operator {
char *name;
char *host;
char *password;
char *class;
char *origin;
int is_local;
struct operator *next;
} *operators;
static void do_operator(int is_local)
{
struct operator *oper;
oper = calloc(1, sizeof(*oper));
dupstring(oper->host, fields[0]);
dupstring(oper->password, fields[1]);
dupstring(oper->name, fields[2]);
dupstring(oper->class, fields[4]);
dupstring(oper->origin, orig_line);
oper->is_local = is_local;
oper->next = operators;
operators = oper;
}
static void finish_operators(void)
{
struct remapped_feature *remap;
struct operator *oper;
struct feature *feat;
char *pw_salt = "";
int global_kill = 0, mask = 0;
size_t ii;
if ((feat = remapped_features[0].feature) && feat->values
&& 0 == strcmp(feat->values->value, "FALSE"))
pw_salt = "$PLAIN$";
if ((feat = remapped_features[1].feature) && feat->values
&& 0 == strcmp(feat->values->value, "FALSE"))
global_kill = 1;
else if ((feat = remapped_features[2].feature) && feat->values
&& 0 == strcmp(feat->values->value, "FALSE"))
global_kill = 2;
for (oper = operators; oper; oper = oper->next) {
fprintf(stdout, "# %s\nOperator {\n\tname = \"%s\";\n"
"\thost = \"%s\";\n\tpassword = \"%s%s\";\n"
"\tclass = \"%s\";\n",
oper->origin, oper->name, oper->host, pw_salt,
oper->password, oper->class);
if (oper->is_local) {
fputs("\tlocal = yes;\n", stdout);
mask = 1;
} else {
fputs("\tlocal = no;\n", stdout);
if (global_kill == 1)
fputs("\tkill = no;\n\tlocal_kill = no;\n", stdout);
else if (global_kill == 2)
fputs("\tkill = no;\n\tlocal_kill = yes;\n", stdout);
mask = 2;
}
for (ii = 0; (remap = &remapped_features[ii++])->name; ) {
if (!remap->feature || !remap->privilege
|| !remap->feature->values || !(remap->flags & mask))
continue;
fprintf(stdout, "\t%s = %s;\n", remap->privilege,
strcmp(remap->feature->values->value, "TRUE") ? "no" : "yes");
}
fputs("};\n\n", stdout);
}
}
/*** OTHER CONFIG TRANSFORMS ***/
static void do_kill(void)
{
const char *host = fields[0], *reason = fields[1], *user = fields[2];
if (!memcmp(host, "$R", 3)) {
fprintf(stderr, "Empty realname K: line at line %u.\n", lineno);
return;
}
/* Print the current line and start the new block. */
fprintf(stdout, "# %s\nKill {\n", orig_line);
/* Translate the user-matching portions. */
if (host[0] == '$' && host[1] == 'R') {
/* Realname kill, possibly with a username */
fprintf(stdout, "\trealname = \"%s\";\n", host + 2);
if (user[0] != '\0' && (user[0] != '*' || user[1] != '\0'))
fprintf(stdout, "\thost = \"%s@*\";\n", user);
} else {
/* Normal host or IP-based kill */
if (user[0] != '\0' && (user[0] != '*' || user[1] != '\0'))
fprintf(stdout, "\thost = \"%s@%s\";\n", user, host);
else
fprintf(stdout, "\thost = \"%s\";\n", host);
}
/* Translate the reason section. */
if (reason[0] == '!')
fprintf(stdout, "\tfile = \"%s\";\n", reason + 1);
else
fprintf(stdout, "\treason = \"%s\";\n", reason);
/* Close the block. */
fprintf(stdout, "};\n");
}
static void do_port(void)
{
const char *ipmask = fields[0], *iface = fields[1], *flags = fields[2], *port = fields[3];
/* Print the current line and start the new block. */
fprintf(stdout, "# %s\nPort {\n", orig_line);
/* Print the easy fields. */
fprintf(stdout, "\tport = %s;\n", port);
if (iface && iface[0] != '\0')
fprintf(stdout, "\tvhost = \"%s\";\n", iface);
if (ipmask && ipmask[0] != '\0')
fprintf(stdout, "\tmask = \"%s\";\n", ipmask);
/* Translate flag field. */
while (*flags) switch (*flags++) {
case 'C': case 'c': /* client port is default state */; break;
case 'S': case 's': fprintf(stdout, "\tserver = yes;\n"); break;
case 'H': case 'h': fprintf(stdout, "\thidden = yes;\n"); break;
}
/* Close the block. */
fprintf(stdout, "};\n");
}
struct string_list *quarantines;
static void do_quarantine(void)
{
struct string_list *q;
q = string_get(&quarantines, fields[0]);
dupstring(q->origin, orig_line);
dupstring(q->extra, fields[1]);
}
static void finish_quarantines(void)
{
struct string_list *sl;
if (quarantines)
{
fputs("Quarantine {\n", stdout);
for (sl = quarantines; sl; sl = sl->next)
fprintf(stdout, "# %s\n\t\"%s\" = \"%s\";\n", sl->origin, sl->value, sl->extra);
fputs("};\n\n", stdout);
}
}
static void do_uworld(void)
{
fprintf(stdout, "# %s\n", orig_line);
if (fields[0] && fields[0][0])
fprintf(stdout, "Uworld { name = \"%s\"; };\n", fields[0]);
if (fields[1] && fields[1][0])
fprintf(stdout, "Jupe { nick = \"%s\"; };\n", fields[1]);
}
static void emit_client(const char *mask, const char *passwd, const char *class, long maxlinks, int is_ip)
{
char *delim;
size_t len;
delim = strchr(mask, '@');
if (delim) {
*delim++ = '\0';
if (is_ip) {
len = strspn(delim, "0123456789.*");
if (delim[len]) {
fprintf(stderr, "Invalid IP mask on line %u.\n", lineno);
return;
}
fprintf(stdout, "Client {\n\tusername = \"%s\";\n\tip = \"%s\";\n", mask, delim);
} else {
fprintf(stdout, "Client {\n\tusername =\"%s\";\n\thost = \"%s\";\n", mask, delim);
}
} else if (is_ip) {
len = strspn(mask, "0123456789.*");
if (mask[len])
return;
fprintf(stdout, "Client {\n\tip = \"%s\";\n", mask);
} else {
if (!strchr(mask, '.') && !strchr(mask, '*'))
return;
fprintf(stdout, "Client {\n\thost = \"%s\";\n", mask);
}
if (passwd)
fprintf(stdout, "\tpassword = \"%s\";\n", passwd);
if (maxlinks >= 0)
fprintf(stdout, "\tmaxlinks = %ld;\n", maxlinks);
fprintf(stdout, "\tclass = \"%s\";\n};\n", class);
}
static void do_client(void)
{
char *passwd = NULL, *delim;
long maxlinks;
/* Print the current line. */
fprintf(stdout, "# %s\n", orig_line);
/* See if the password is really a maxlinks count. */
maxlinks = strtol(fields[1], &delim, 10);
if (fields[1][0] == '\0')
maxlinks = -1;
else if (maxlinks < 0 || maxlinks > 99 || *delim != '\0')
passwd = fields[1];
/* Translate the IP and host mask fields into blocks. */
emit_client(fields[0], passwd, fields[4], maxlinks, 1);
emit_client(fields[2], passwd, fields[4], maxlinks, 0);
}
int main(int argc, char *argv[])
{
FILE *ifile;
if (argc < 2)
ifile = stdin;
else if (!(ifile = fopen(argv[1], "rt"))) {
fprintf(stderr, "Unable to open file %s for input.\n", argv[1]);
return 1;
}
for (lineno = 1; fgets(line, sizeof(line), ifile); ++lineno) {
/* Read line and pass comments through. */
size_t len = strlen(line);
if (line[0] == '#') {
fputs(line, stdout);
continue;
}
/* Strip trailing whitespace. */
while (len > 0 && isspace(line[len-1]))
line[--len] = '\0';
/* Pass blank lines through. */
if (len == 0) {
fputc('\n', stdout);
continue;
}
/* Skip but report invalid lines. */
if (line[1] != ':') {
fprintf(stdout, "# %s\n", line);
fprintf(stderr, "Invalid input line %d.\n", lineno);
continue;
}
/* Copy the original line into a reusable variable. */
strcpy(orig_line, line);
/* Split line into fields. */
nfields = split_line(line + 2, fields);
/* Process the input line. */
switch (line[0]) {
case 'A': case 'a': simple_line("Admin", admin_names, NULL); break;
case 'C': case 'c': do_connect(); break;
case 'D': simple_line("CRule", crule_names, "all = yes;"); break;
case 'd': simple_line("CRule", crule_names, NULL); break;
case 'F': case 'f': do_feature(); break;
case 'H': case 'h': do_hub(); break;
case 'I': case 'i': do_client(); break;
case 'K': case 'k': do_kill(); break;
case 'L': case 'l': do_leaf(); break;
case 'M': case 'm': simple_line("General", general_names, NULL); break;
case 'O': do_operator(0); break;
case 'o': do_operator(1); break;
case 'P': case 'p': do_port(); break;
case 'Q': case 'q': do_quarantine(); break;
case 'T': case 't': simple_line("Motd", motd_names, NULL); break;
case 'U': case 'u': do_uworld(); break;
case 'Y': case 'y': simple_line("Class", class_names, NULL); break;
default:
fprintf(stderr, "Unknown line %u with leading character '%c'.\n", lineno, line[0]);
break;
}
}
fclose(ifile);
fputs("\n# The following lines were intentionally moved and rearranged."
"\n# Our apologies for any inconvenience this may cause."
"\n\n", stdout);
finish_connects();
finish_quarantines();
finish_features();
finish_operators();
return 0;
}
|