Changeset 831
- Timestamp:
- 02/09/09 00:42:56 (3 years ago)
- Location:
- branches/ithildin-1.1
- Files:
-
- 9 edited
-
modules/ircd/client.c (modified) (13 diffs)
-
modules/ircd/client.h (modified) (1 diff)
-
modules/ircd/commands/protocol.c (modified) (1 diff)
-
modules/ircd/commands/server.c (modified) (1 diff)
-
modules/ircd/connection.c (modified) (3 diffs)
-
modules/ircd/connection.h (modified) (1 diff)
-
modules/ircd/doc/conf.txt (modified) (1 diff)
-
modules/ircd/server.c (modified) (1 diff)
-
source/conf.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/ithildin-1.1/modules/ircd/client.c
r822 r831 29 29 cp->mdext = mdext_alloc(ircd.mdext.client); 30 30 31 /* all new clients are set unknown even if they're remote (this will get 32 * handled in register_client so it shouldn't be a big deal */ 33 cp->flags |= IRCD_CLIENT_UNKNOWN; 34 ircd.stats.serv.unkclients++; 35 31 36 if (conn != NULL) { 32 37 conn->cli = cp; … … 34 39 get_socket_address(isock_raddr(conn->sock), cp->ip, IPADDR_MAXLEN + 1, 35 40 NULL); 36 ircd.stats.serv.unkclients++;37 41 } else 38 42 cp->pset = LIST_FIRST(ircd.privileges.sets); … … 49 53 unsigned char *s; 50 54 51 if ( cli->flags & IRCD_CLIENT_HISTORY) {55 if (CLIENT_HISTORY(cli)) { 52 56 /* just return the memory */ 53 57 mdext_free(ircd.mdext.client, cli->mdext); … … 110 114 hash_delete(ircd.hashes.client, cli); 111 115 116 if (CLIENT_UNKNOWN(cli)) 117 ircd.stats.serv.unkclients--; 118 112 119 if (cli->conn != NULL) { /* dump it if it's ours */ 113 if (!CLIENT_REGISTERED(cli))114 ircd.stats.serv.unkclients--;115 120 cli->conn->cli = NULL; 116 121 … … 126 131 LIST_REMOVE(cli, lp); 127 132 128 if (!CLIENT_ REGISTERED(cli)) {133 if (!CLIENT_HISTORY(cli)) { 129 134 /* if the client was registered then we need to preserve their client 130 135 * entry for the history list */ … … 189 194 returns = hook_event(ircd.events.stage3_connect, cp); 190 195 while (x < hook_num_returns) { 191 if (returns[x] != NULL) { /* denied, with a reason */196 if (returns[x] != NULL) { /* denied, with a reason */ 192 197 destroy_client(cli, (char *)returns[x]); 193 return IRCD_CONNECTION_CLOSED; /* not successful */198 return IRCD_CONNECTION_CLOSED; /* not successful */ 194 199 } 195 200 x++; … … 199 204 LIST_REMOVE(cp, lp); 200 205 LIST_INSERT_HEAD(ircd.connections.clients, cp, lp); 201 ircd.stats.serv.unkclients--;202 203 206 } 204 207 … … 220 223 221 224 /* accounting stuff */ 225 if (CLIENT_UNKNOWN(cli)) 226 { 227 cli->flags &= ~IRCD_CLIENT_UNKNOWN; 228 ircd.stats.serv.unkclients--; 229 } 222 230 ircd.stats.serv.curclients++; 223 231 if (ircd.stats.serv.maxclients < ircd.stats.serv.curclients) … … 541 549 * overwrite old entries (maybe). if the client table is larger 542 550 * than the history table then we also let the history table grow, 543 * but if the two are *the same size we need to pop the oldest551 * but if the two are the same size we need to pop the oldest 544 552 * entry off. */ 545 553 … … 548 556 } 549 557 550 chp = calloc(1, sizeof(struct client_history));558 chp = calloc(1, sizeof(struct client_history)); 551 559 552 560 /* fill it in ... */ … … 558 566 559 567 /* insert it in the hash */ 560 hash_insert(ircd.hashes.client_history, chp);568 hash_insert(ircd.hashes.client_history, chp); 561 569 TAILQ_INSERT_HEAD(ircd.lists.client_history, chp, lp); 562 570 … … 579 587 free(cli->hist); 580 588 581 if ( cli->flags & IRCD_CLIENT_HISTORY)589 if (CLIENT_HISTORY(cli)) 582 590 destroy_client(cli, NULL); 583 591 else … … 599 607 /* if we found it and they signed off at or after the current time minus 600 608 * the time limit, return the entry. */ 601 if (chp != NULL && ! (chp->cli->flags & IRCD_CLIENT_HISTORY) &&609 if (chp != NULL && !CLIENT_HISTORY(chp->cli) && 602 610 chp->signoff >= (limit ? me.now - limit : 0)) 603 611 return chp->cli; -
branches/ithildin-1.1/modules/ircd/client.h
r748 r831 23 23 char info[GCOSLEN + 1]; /* gecos/gcos info (ircname) */ 24 24 25 #define IRCD_CLIENT_REGISTERED 0x0001 26 /* check to see if the client is registered or not */ 25 #define IRCD_CLIENT_UNKNOWN 0x0001 26 #define IRCD_CLIENT_REGISTERED 0x0002 27 #define IRCD_CLIENT_KILLED 0x0004 28 #define IRCD_CLIENT_HISTORY 0x0008 29 30 #define CLIENT_UNKNOWN(cli) (cli->flags & IRCD_CLIENT_UNKNOWN) 27 31 #define CLIENT_REGISTERED(cli) (cli->flags & IRCD_CLIENT_REGISTERED) 28 #define IRCD_CLIENT_KILLED 0x0002 29 #define IRCD_CLIENT_HISTORY 0x0004 32 #define CLIENT_KILLED(cli) (cli->flags & IRCD_CLIENT_KILLED) 33 #define CLIENT_HISTORY(cli) (cli->flags & IRCD_CLIENT_HISTORY) 34 30 35 int flags; 31 36 -
branches/ithildin-1.1/modules/ircd/commands/protocol.c
r818 r831 38 38 } 39 39 40 cp->proto = proto; 41 cp->proto->setup(cp); 40 set_connection_protocol(cp, proto); 42 41 43 42 return IRCD_PROTOCOL_CHANGED; -
branches/ithildin-1.1/modules/ircd/commands/server.c
r826 r831 228 228 } 229 229 230 cp = cli->conn;231 cli->conn = NULL; /* save/set client's connection to NULL so destroy_client232 doesn't nerf the connection in the process */233 destroy_client(cli, ""); /* cli is no longer valid */234 cp->cli = NULL;235 236 230 /* now we mock up a server connection. joy of joys, our pass should still 237 231 * have been saved. we just reset the protocol, and setup the connection, 238 232 * and then call the server version of the SERVER command. This is pretty 239 233 * dirty. :/ */ 240 cp->proto = pp; 241 cp->proto->setup(cp); 234 set_connection_protocol(cp, pp); 242 235 if ((ret = s_server_cmd(NULL, argc, argv, cp->srv)) != 0) 243 236 return ret; /* Give them whatever s_server_cmd gave, it will always -
branches/ithildin-1.1/modules/ircd/connection.c
r822 r831 25 25 static void connection_init_lookups(connection_t *); 26 26 27 /* set the protocol for a connection, possibly cleaning up if necessary for 28 * protocol changes */ 29 void set_connection_protocol(connection_t *cp, protocol_t *proto) { 30 31 if (cp->proto != NULL) 32 clear_connection_objects(cp); 33 34 cp->proto = proto; 35 cp->proto->setup(cp); 36 } 37 38 /* safely remove both client and server objects from the connection */ 39 void clear_connection_objects(connection_t *cp) { 40 client_t *cli = cp->cli; 41 server_t *srv = cp->srv; 42 43 if (cli != NULL) { 44 cli->conn = NULL; 45 cp->cli = NULL; 46 destroy_client(cli, ""); 47 } 48 49 if (srv != NULL) { 50 srv->conn = NULL; 51 cp->srv = NULL; 52 destroy_server(srv, ""); 53 } 54 } 55 27 56 void destroy_connection(connection_t *c, char *reason) { 28 57 char msg[512]; … … 34 63 #endif 35 64 /* destroy_client/server will set the cli/srv entries to NULL, then call us 36 * again to really des otry the connection. this makes it safe to call65 * again to really destroy the connection. this makes it safe to call 37 66 * 'destroy_connection' even if you're not sure what kind of connection you 38 67 * have. */ … … 362 391 363 392 /* now stick them in the default protocol */ 364 c->proto = ircd.default_proto; 365 c->proto->setup(c); 393 set_connection_protocol(c, ircd.default_proto); 366 394 c->last = me.now; 367 395 /* and monitor them */ -
branches/ithildin-1.1/modules/ircd/connection.h
r828 r831 87 87 }; 88 88 89 void set_connection_protocol(connection_t *, protocol_t *); 90 void clear_connection_objects(connection_t *); 89 91 void destroy_connection(connection_t *, char *); 90 92 int close_unknown_connections(char *); -
branches/ithildin-1.1/modules/ircd/doc/conf.txt
r775 r831 659 659 protocol "some-protocol"; 660 660 661 // ssl: (optional) 662 // this is a boolean flag which specifies whether SSL should be useed to663 // establish a connection to the server. using SSL will turn off use of664 // password verification as well asthe checking of IPs.661 // ssl: (optional) this is a boolean flag which specifies whether 662 // SSL should be used to establish a connection to the server. 663 // using SSL will turn off use of password verification as well as 664 // the checking of IPs. 665 665 ssl <yes|no>; 666 666 -
branches/ithildin-1.1/modules/ircd/server.c
r824 r831 477 477 cp->cls = LIST_FIRST(ircd.lists.classes); /* stick them in the default class 478 478 temporarily. */ 479 cp->proto = proto;480 479 cp->signon = me.now; 481 480 cp->last = me.now; 481 set_connection_protocol(cp, proto); 482 482 483 483 /* put it on the stage2 list. technically it should stay as stage2 until 484 484 * the negotiation is finished and server_register() is called. */ 485 485 LIST_INSERT_HEAD(ircd.connections.stage2, cp, lp); 486 proto->setup(cp);487 486 488 487 sp = cp->srv; -
branches/ithildin-1.1/source/conf.c
r578 r831 498 498 str++; 499 499 while (*str) { 500 if (*str == '\\' )500 if (*str == '\\' && *(str + 1) != '\0') 501 501 str += 2; 502 502 else if (*str == '"') … … 561 561 } 562 562 563 *str++ = '\0'; ;563 *str++ = '\0'; 564 564 continue; 565 565 } else {
Note: See TracChangeset
for help on using the changeset viewer.
