srvx-commits Mailing List for srvx IRC Services (Page 32)
Brought to you by:
entrope
You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(80) |
Sep
(51) |
Oct
(94) |
Nov
(132) |
Dec
(85) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(163) |
Feb
(96) |
Mar
(70) |
Apr
(182) |
May
(173) |
Jun
(73) |
Jul
(101) |
Aug
(101) |
Sep
(71) |
Oct
(76) |
Nov
(58) |
Dec
(60) |
| 2003 |
Jan
(61) |
Feb
(14) |
Mar
(3) |
Apr
|
May
(7) |
Jun
(22) |
Jul
(81) |
Aug
(41) |
Sep
(34) |
Oct
(41) |
Nov
(16) |
Dec
(28) |
| 2004 |
Jan
(7) |
Feb
|
Mar
(3) |
Apr
(15) |
May
(11) |
Jun
(1) |
Jul
(4) |
Aug
(1) |
Sep
(4) |
Oct
(1) |
Nov
(1) |
Dec
(1) |
| 2005 |
Jan
(13) |
Feb
(6) |
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2009 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(2) |
Feb
(3) |
Mar
(4) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
| 2012 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
| 2025 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Zoot <zo...@us...> - 2002-08-14 19:43:29
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv17598/src
Modified Files:
proto-p10.c
Log Message:
Remove some unused and unnecessary code.
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** proto-p10.c 14 Aug 2002 04:09:27 -0000 1.22
--- proto-p10.c 14 Aug 2002 19:43:25 -0000 1.23
***************
*** 1969,1975 ****
};
unsigned int remove = 0, pos = 0;
- char buffer[40 + KEYLEN];
- buffer[pos++] = '-';
while(*modes)
{
--- 1969,1973 ----
***************
*** 1981,1989 ****
{
remove |= flag_p[0];
-
- if((flag_p[0] & CHANNEL_MODES) & channel->modes)
- {
- buffer[pos++] = flag_p[0];
- }
break;
}
--- 1979,1982 ----
***************
*** 2001,2010 ****
if((remove & MODE_KEY) && channel->key)
{
- pos += sprintf(buffer + pos, " %s", channel->key);
channel->key[0] = '\0';
}
if((remove & MODE_LIMIT) && channel->limit)
{
- pos += sprintf(buffer + pos, " %d", channel->limit);
channel->limit = 0;
}
--- 1994,2001 ----
|
|
From: Zoot <zo...@us...> - 2002-08-14 04:09:30
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv22687/src Modified Files: proto-p10.c Log Message: Clean up the kludged P10 token/command switching up a little. Index: proto-p10.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto-p10.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** proto-p10.c 14 Aug 2002 02:54:56 -0000 1.21 --- proto-p10.c 14 Aug 2002 04:09:27 -0000 1.22 *************** *** 21,191 **** #include "proto-common.c" - /* Protocol messages; aliased to full commands or tokens depending - on compile-time configuration. ircu 2.10.11 requires tokens - WITH THE EXCEPTION OF THE FOLLOWING: - PASS - SERVER - - For some reason, ircu 2.10.11 does not parse the tokenized forms - of these commands. - */ - #ifdef ENABLE_TOKENS - #define P10_ACCOUNT TOK_ACCOUNT - #define P10_ADMIN TOK_ADMIN - #define P10_ASLL TOK_ASLL - #define P10_AWAY TOK_AWAY - #define P10_BURST TOK_BURST - #define P10_CLEARMODE TOK_CLEARMODE - #define P10_CLOSE TOK_CLOSE - #define P10_CNOTICE TOK_CNOTICE - #define P10_CONNECT TOK_CONNECT - #define P10_CPRIVMSG TOK_CPRIVMSG - #define P10_CREATE TOK_CREATE - #define P10_DESTRUCT TOK_DESTRUCT - #define P10_DESYNCH TOK_DESYNCH - #define P10_DIE TOK_DIE - #define P10_DNS TOK_DNS - #define P10_EOB TOK_EOB - #define P10_EOB_ACK TOK_EOB_ACK - #define P10_ERROR TOK_ERROR - #define P10_GET TOK_GET - #define P10_GLINE TOK_GLINE - #define P10_HASH TOK_HASH - #define P10_HELP TOK_HELP - #define P10_INFO TOK_INFO - #define P10_INVITE TOK_INVITE - #define P10_ISON TOK_ISON - #define P10_JOIN TOK_JOIN - #define P10_JUPE TOK_JUPE - #define P10_KICK TOK_KICK - #define P10_KILL TOK_KILL - #define P10_LINKS TOK_LINKS - #define P10_LIST TOK_LIST - #define P10_LUSERS TOK_LUSERS - #define P10_MAP TOK_MAP - #define P10_MODE TOK_MODE - #define P10_MOTD TOK_MOTD - #define P10_NAMES TOK_NAMES - #define P10_NICK TOK_NICK - #define P10_NOTICE TOK_NOTICE - #define P10_OPER TOK_OPER - #define P10_OPMODE TOK_OPMODE - #define P10_PART TOK_PART - #define P10_PASS CMD_PASS - #define P10_PING TOK_PING - #define P10_PONG TOK_PONG - #define P10_POST TOK_POST - #define P10_PRIVMSG TOK_PRIVMSG - #define P10_PRIVS TOK_PRIVS - #define P10_PROTO TOK_PROTO - #define P10_QUIT TOK_QUIT - #define P10_REHASH TOK_REHASH - #define P10_RESET TOK_RESET - #define P10_RESTART TOK_RESTART - #define P10_RPING TOK_RPING - #define P10_RPONG TOK_RPONG - #define P10_SERVER CMD_SERVER - #define P10_SERVLIST TOK_SERVLIST - #define P10_SERVSET TOK_SERVSET - #define P10_SET TOK_SET - #define P10_SETTIME TOK_SETTIME - #define P10_SILENCE TOK_SILENCE - #define P10_SQUERY TOK_SQUERY - #define P10_SQUIT TOK_SQUIT - #define P10_STATS TOK_STATS - #define P10_TIME TOK_TIME - #define P10_TOPIC TOK_TOPIC - #define P10_TRACE TOK_TRACE - #define P10_UPING TOK_UPING - #define P10_USER TOK_USER - #define P10_USERHOST TOK_USERHOST - #define P10_USERIP TOK_USERIP - #define P10_VERSION TOK_VERSION - #define P10_WALLCHOPS TOK_WALLCHOPS - #define P10_WALLOPS TOK_WALLOPS - #define P10_WALLUSERS TOK_WALLUSERS - #define P10_WHO TOK_WHO - #define P10_WHOIS TOK_WHOIS - #define P10_WHOWAS TOK_WHOWAS - #else /* !ENABLE_TOKENS */ - #define P10_ACCOUNT CMD_ACCOUNT - #define P10_ADMIN CMD_ADMIN - #define P10_ASLL CMD_ASLL - #define P10_AWAY CMD_AWAY - #define P10_BURST CMD_BURST - #define P10_CLEARMODE CMD_CLEARMODE - #define P10_CLOSE CMD_CLOSE - #define P10_CNOTICE CMD_CNOTICE - #define P10_CONNECT CMD_CONNECT - #define P10_CPRIVMSG CMD_CPRIVMSG - #define P10_CREATE CMD_CREATE - #define P10_DESTRUCT CMD_DESTRUCT - #define P10_DESYNCH CMD_DESYNCH - #define P10_DIE CMD_DIE - #define P10_DNS CMD_DNS - #define P10_EOB CMD_EOB - #define P10_EOB_ACK CMD_EOB_ACK - #define P10_ERROR CMD_ERROR - #define P10_GET CMD_GET - #define P10_GLINE CMD_GLINE - #define P10_HASH CMD_HASH - #define P10_HELP CMD_HELP - #define P10_INFO CMD_INFO - #define P10_INVITE CMD_INVITE - #define P10_ISON CMD_ISON - #define P10_JOIN CMD_JOIN - #define P10_JUPE CMD_JUPE - #define P10_KICK CMD_KICK - #define P10_KILL CMD_KILL - #define P10_LINKS CMD_LINKS - #define P10_LIST CMD_LIST - #define P10_LUSERS CMD_LUSERS - #define P10_MAP CMD_MAP - #define P10_MODE CMD_MODE - #define P10_MOTD CMD_MOTD - #define P10_NAMES CMD_NAMES - #define P10_NICK CMD_NICK - #define P10_NOTICE CMD_NOTICE - #define P10_OPER CMD_OPER - #define P10_OPMODE CMD_OPMODE - #define P10_PART CMD_PART - #define P10_PASS CMD_PASS - #define P10_PING CMD_PING - #define P10_PONG CMD_PONG - #define P10_POST CMD_POST - #define P10_PRIVMSG CMD_PRIVMSG - #define P10_PRIVS CMD_PRIVS - #define P10_PROTO CMD_PROTO - #define P10_QUIT CMD_QUIT - #define P10_REHASH CMD_REHASH - #define P10_RESET CMD_RESET - #define P10_RESTART CMD_RESTART - #define P10_RPING CMD_RPING - #define P10_RPONG CMD_RPONG - #define P10_SERVER CMD_SERVER - #define P10_SERVLIST CMD_SERVLIST - #define P10_SERVSET CMD_SERVSET - #define P10_SET CMD_SET - #define P10_SETTIME CMD_SETTIME - #define P10_SILENCE CMD_SILENCE - #define P10_SQUERY CMD_SQUERY - #define P10_SQUIT CMD_SQUIT - #define P10_STATS CMD_STATS - #define P10_TIME CMD_TIME - #define P10_TOPIC CMD_TOPIC - #define P10_TRACE CMD_TRACE - #define P10_UPING CMD_UPING - #define P10_USER CMD_USER - #define P10_USERHOST CMD_USERHOST - #define P10_USERIP CMD_USERIP - #define P10_VERSION CMD_VERSION - #define P10_WALLCHOPS CMD_WALLCHOPS - #define P10_WALLOPS CMD_WALLOPS - #define P10_WALLUSERS CMD_WALLUSERS - #define P10_WHO CMD_WHO - #define P10_WHOIS CMD_WHOIS - #define P10_WHOWAS CMD_WHOWAS - #endif /* ENABLE_TOKENS */ - /* Full commands. */ #define CMD_ACCOUNT "ACCOUNT" --- 21,24 ---- *************** *** 345,348 **** --- 178,271 ---- #define TOK_WHOIS "W" #define TOK_WHOWAS "X" + + /* Protocol messages; aliased to full commands or tokens depending + on compile-time configuration. ircu prefers tokens WITH THE + EXCEPTION OF THE SERVER AND PASS COMMANDS, which cannot be + tokenized, because clients' (ie. a linking server) commands are + only checked against the full command list. + */ + #ifdef ENABLE_TOKENS + #define TYPE(NAME) TOK_ ## NAME + #else /* !ENABLE_TOKENS */ + #define TYPE(NAME) CMD_ ## NAME + #endif /* ENABLE_TOKENS */ + + #define P10_ACCOUNT TYPE(ACCOUNT) + #define P10_ADMIN TYPE(ADMIN) + #define P10_ASLL TYPE(ASLL) + #define P10_AWAY TYPE(AWAY) + #define P10_BURST TYPE(BURST) + #define P10_CLEARMODE TYPE(CLEARMODE) + #define P10_CLOSE TYPE(CLOSE) + #define P10_CNOTICE TYPE(CNOTICE) + #define P10_CONNECT TYPE(CONNECT) + #define P10_CPRIVMSG TYPE(CPRIVMSG) + #define P10_CREATE TYPE(CREATE) + #define P10_DESTRUCT TYPE(DESTRUCT) + #define P10_DESYNCH TYPE(DESYNCH) + #define P10_DIE TYPE(DIE) + #define P10_DNS TYPE(DNS) + #define P10_EOB TYPE(EOB) + #define P10_EOB_ACK TYPE(EOB_ACK) + #define P10_ERROR TYPE(ERROR) + #define P10_GET TYPE(GET) + #define P10_GLINE TYPE(GLINE) + #define P10_HASH TYPE(HASH) + #define P10_HELP TYPE(HELP) + #define P10_INFO TYPE(INFO) + #define P10_INVITE TYPE(INVITE) + #define P10_ISON TYPE(ISON) + #define P10_JOIN TYPE(JOIN) + #define P10_JUPE TYPE(JUPE) + #define P10_KICK TYPE(KICK) + #define P10_KILL TYPE(KILL) + #define P10_LINKS TYPE(LINKS) + #define P10_LIST TYPE(LIST) + #define P10_LUSERS TYPE(LUSERS) + #define P10_MAP TYPE(MAP) + #define P10_MODE TYPE(MODE) + #define P10_MOTD TYPE(MOTD) + #define P10_NAMES TYPE(NAMES) + #define P10_NICK TYPE(NICK) + #define P10_NOTICE TYPE(NOTICE) + #define P10_OPER TYPE(OPER) + #define P10_OPMODE TYPE(OPMODE) + #define P10_PART TYPE(PART) + #define P10_PASS CMD_PASS + #define P10_PING TYPE(PING) + #define P10_PONG TYPE(PONG) + #define P10_POST TYPE(POST) + #define P10_PRIVMSG TYPE(PRIVMSG) + #define P10_PRIVS TYPE(PRIVS) + #define P10_PROTO TYPE(PROTO) + #define P10_QUIT TYPE(QUIT) + #define P10_REHASH TYPE(REHASH) + #define P10_RESET TYPE(RESET) + #define P10_RESTART TYPE(RESTART) + #define P10_RPING TYPE(RPING) + #define P10_RPONG TYPE(RPONG) + #define P10_SERVER CMD_SERVER + #define P10_SERVLIST TYPE(SERVLIST) + #define P10_SERVSET TYPE(SERVSET) + #define P10_SET TYPE(SET) + #define P10_SETTIME TYPE(SETTIME) + #define P10_SILENCE TYPE(SILENCE) + #define P10_SQUERY TYPE(SQUERY) + #define P10_SQUIT TYPE(SQUIT) + #define P10_STATS TYPE(STATS) + #define P10_TIME TYPE(TIME) + #define P10_TOPIC TYPE(TOPIC) + #define P10_TRACE TYPE(TRACE) + #define P10_UPING TYPE(UPING) + #define P10_USER TYPE(USER) + #define P10_USERHOST TYPE(USERHOST) + #define P10_USERIP TYPE(USERIP) + #define P10_VERSION TYPE(VERSION) + #define P10_WALLCHOPS TYPE(WALLCHOPS) + #define P10_WALLOPS TYPE(WALLOPS) + #define P10_WALLUSERS TYPE(WALLUSERS) + #define P10_WHO TYPE(WHO) + #define P10_WHOIS TYPE(WHOIS) + #define P10_WHOWAS TYPE(WHOWAS) /* Servers claiming to have a boot or link time before PREHISTORY |
|
From: Entrope <en...@us...> - 2002-08-14 03:04:02
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv4402/src
Modified Files:
ioset.c ioset.h proto-common.c sockcheck.c
Log Message:
add new function, ioset_connect(), to handle common TCP connection code
use this in create_socket_client() and proxy-checking
Index: ioset.c
===================================================================
RCS file: /cvsroot/srvx/services/src/ioset.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** ioset.c 30 Jul 2002 02:15:11 -0000 1.7
--- ioset.c 14 Aug 2002 03:03:58 -0000 1.8
***************
*** 29,32 ****
--- 29,35 ----
#include <sys/select.h>
#endif
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
#ifndef IOSET_DEBUG
***************
*** 76,79 ****
--- 79,139 ----
}
+ struct io_fd *
+ ioset_connect(struct sockaddr *local, unsigned int sa_size, const char *peer, unsigned int port, int blocking, void (*connect_cb)(struct io_fd *fd))
+ {
+ int fd, res;
+ struct io_fd *io_fd;
+ struct sockaddr_in sin;
+ unsigned long ip;
+
+ if (!getipbyname(peer, &ip)) {
+ log(MAIN_LOG, LOG_ERROR, "getipbyname(%s) failed.\n", peer);
+ return NULL;
+ }
+ sin.sin_addr.s_addr = ip;
+ if (local) {
+ if ((fd = socket(local->sa_family, SOCK_STREAM, 0)) < 0) {
+ log(MAIN_LOG, LOG_ERROR, "socket() for %s returned errno %d (%s)\n", peer, errno, strerror(errno));
+ return NULL;
+ }
+ if (bind(fd, local, sa_size) < 0) {
+ log(MAIN_LOG, LOG_ERROR, "bind() of socket for %s (fd %d) returned errno %d (%s). Will use the default.\n", peer, fd, errno, strerror(errno));
+ }
+ } else {
+ if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
+ log(MAIN_LOG, LOG_ERROR, "socket() for %s returned errno %d (%s)\n", peer, errno, strerror(errno));
+ return NULL;
+ }
+ }
+ sin.sin_family = AF_INET;
+ sin.sin_port = htons(port);
+ if (blocking) {
+ res = connect(fd, (struct sockaddr*)&sin, sizeof(sin));
+ io_fd = ioset_add(fd);
+ } else {
+ io_fd = ioset_add(fd);
+ res = connect(fd, (struct sockaddr*)&sin, sizeof(sin));
+ }
+ if (!io_fd) {
+ close(fd);
+ return NULL;
+ }
+ if (res < 0) {
+ switch (errno) {
+ case EINPROGRESS: /* only if !blocking */
+ return io_fd;
+ default:
+ log(MAIN_LOG, LOG_ERROR, "connect(%s:%d) (fd %d) returned errno %d (%s).\n", peer, port, io_fd->fd, errno, strerror(errno));
+ /* then fall through */
+ case EHOSTUNREACH:
+ case ECONNREFUSED:
+ ioset_close(io_fd->fd, 1);
+ return NULL;
+ }
+ }
+ if (connect_cb) connect_cb(io_fd);
+ return io_fd;
+ }
+
static void
ioset_try_write(struct io_fd *fd)
***************
*** 125,130 ****
void ioset_run(void)
{
! extern int socket_fd;
!
struct timeval select_timeout;
unsigned int nn;
--- 185,189 ----
void ioset_run(void)
{
! extern struct io_fd *socket_io_fd;
struct timeval select_timeout;
unsigned int nn;
***************
*** 134,140 ****
while (!quit_services) {
! while (socket_fd == -1) {
! uplink_connect();
! }
/* How long to sleep? (fill in select_timeout) */
--- 193,197 ----
while (!quit_services) {
! while (!socket_io_fd) uplink_connect();
/* How long to sleep? (fill in select_timeout) */
Index: ioset.h
===================================================================
RCS file: /cvsroot/srvx/services/src/ioset.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** ioset.h 2 Jul 2002 00:01:09 -0000 1.3
--- ioset.h 14 Aug 2002 03:03:58 -0000 1.4
***************
*** 22,25 ****
--- 22,28 ----
#define IOSET_H
+ /* Forward declare, since ioset_connect() takes a sockaddr argument. */
+ struct sockaddr;
+
struct io_fd {
int fd;
***************
*** 37,40 ****
--- 40,44 ----
struct io_fd *ioset_add(int fd);
+ struct io_fd *ioset_connect(struct sockaddr *local, unsigned int sa_size, const char *hostname, unsigned int port, int blocking, void (*connect_cb)(struct io_fd *fd));
void ioset_run(void);
void ioset_write(struct io_fd *fd, const char *buf, unsigned int nbw);
Index: proto-common.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-common.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** proto-common.c 4 Aug 2002 21:12:57 -0000 1.7
--- proto-common.c 14 Aug 2002 03:03:58 -0000 1.8
***************
*** 33,44 ****
#endif
- int socket_fd = -1;
unsigned int lines_processed;
FILE *replay_file;
struct userList dead_users;
static char replay_line[MAXLEN+80];
! static struct io_fd *socket_io_fd;
! static int ping_freq = 120, ping_timeout = 30;
extern struct cManagerNode cManager;
--- 33,45 ----
#endif
unsigned int lines_processed;
FILE *replay_file;
struct userList dead_users;
+ struct io_fd *socket_io_fd;
static char replay_line[MAXLEN+80];
! static int ping_freq = 120;
! static int ping_timeout = 30;
! static int replay_connected;
extern struct cManagerNode cManager;
***************
*** 76,85 ****
{
while (!quit_services) {
! if (socket_fd < 0) {
! /* and this is to get some of the logging right */
self->link = self->boot = now;
cManager.uplink->state = AUTHENTICATING;
irc_introduce(cManager.uplink->password);
! socket_fd = 1;
} else if (!replay_read()) {
log(MAIN_LOG, LOG_ERROR, "Connection to server lost.\n");
--- 77,86 ----
{
while (!quit_services) {
! if (!replay_connected) {
! /* this time fudging is to get some of the logging right */
self->link = self->boot = now;
cManager.uplink->state = AUTHENTICATING;
irc_introduce(cManager.uplink->password);
! replay_connected = 1;
} else if (!replay_read()) {
log(MAIN_LOG, LOG_ERROR, "Connection to server lost.\n");
***************
*** 93,164 ****
create_socket_client(struct uplinkNode *target)
{
! int socket_desc;
! int port = target->port;
! const char *addr = target->host;
! struct sockaddr_in sain;
! struct hostent *host_info;
if (replay_file) return feof(replay_file) ? 0 : 1;
! log(MAIN_LOG, LOG_INFO, "Connecting to %s:%i...\n", addr, port);
!
! if (socket_fd != -1) {
! /* Leave the existing socket open, say we failed. */
! log(MAIN_LOG, LOG_ERROR, "Refusing to create second connection to %s:%d.\n", addr, port);
! return 0;
}
! if ((host_info = gethostbyname(addr)) == NULL) {
! log(MAIN_LOG, LOG_ERROR, "Resolve failed: %s\n", strerror(errno));
! target->state = DISCONNECTED;
! target->tries++;
! return 0;
! }
! memcpy((char*)&(sain.sin_addr), host_info->h_addr, host_info->h_length);
! sain.sin_family = host_info->h_addrtype;
! sain.sin_port = htons((u_short) port);
!
! if ((socket_desc = socket(host_info->h_addrtype, SOCK_STREAM, 0)) < 0) {
! log(MAIN_LOG, LOG_ERROR, "Socket create failed: %s\n", strerror(errno));
! log(MAIN_LOG, LOG_ERROR, MSG_FATAL_ERROR);
! exit(1);
! }
! if (cManager.uplink->bind_addr) {
! if (bind(socket_desc, (struct sockaddr*) cManager.uplink->bind_addr, sizeof(struct sockaddr)) < 0) {
! log(MAIN_LOG, LOG_ERROR, "Error: bind() in socket setup returned errno %d (%s)\n", errno, strerror(errno));
! log(MAIN_LOG, LOG_ERROR, MSG_FATAL_ERROR);
! exit(1);
! }
! }
! if (connect(socket_desc, (struct sockaddr *)&sain, sizeof(sain)) < 0) {
! log(MAIN_LOG, LOG_ERROR, "Connect failed: %s\n", strerror(errno));
! switch(errno)
! {
! case ECONNREFUSED:
! case ETIMEDOUT:
! case ENETUNREACH:
! case EHOSTUNREACH:
! case EAGAIN:
! target->state = DISCONNECTED;
! target->tries++;
! return 0;
! default:
! log(MAIN_LOG, LOG_ERROR, MSG_FATAL_ERROR);
! exit(1);
! }
}
-
- log(MAIN_LOG, LOG_INFO, "Connection to server established.\n");
- socket_fd = socket_desc;
- socket_io_fd = ioset_add(socket_fd);
socket_io_fd->readable_cb = uplink_readable;
socket_io_fd->wants_reads = 1;
!
cManager.uplink = target;
-
target->state = AUTHENTICATING;
target->tries = 0;
-
return 1;
}
--- 94,122 ----
create_socket_client(struct uplinkNode *target)
{
! int port = target->port;
! const char *addr = target->host;
if (replay_file) return feof(replay_file) ? 0 : 1;
! if (socket_io_fd) {
! /* Leave the existing socket open, say we failed. */
! log(MAIN_LOG, LOG_ERROR, "Refusing to create second connection to %s:%d.\n", addr, port);
! return 0;
}
! log(MAIN_LOG, LOG_INFO, "Connecting to %s:%i...\n", addr, port);
! socket_io_fd = ioset_connect((struct sockaddr*)cManager.uplink->bind_addr, sizeof(struct sockaddr), addr, port, 1, NULL);
! if (!socket_io_fd) {
! target->state = DISCONNECTED;
! target->tries++;
! return 0;
}
socket_io_fd->readable_cb = uplink_readable;
socket_io_fd->wants_reads = 1;
! log(MAIN_LOG, LOG_INFO, "Connection to server established.\n");
cManager.uplink = target;
target->state = AUTHENTICATING;
target->tries = 0;
return 1;
}
***************
*** 242,246 ****
int i, recv_len;
! recv_len = read(socket_fd, in+used, sizeof(in)-used);
if (recv_len < 0) {
/* if it would have blocked, pretend we succeeded */
--- 200,204 ----
int i, recv_len;
! recv_len = read(socket_io_fd->fd, in+used, sizeof(in)-used);
if (recv_len < 0) {
/* if it would have blocked, pretend we succeeded */
***************
*** 316,321 ****
close_socket(void)
{
! if (!replay_file) ioset_close(socket_fd, 1);
! socket_fd = -1;
cManager.uplink->state = DISCONNECTED;
if (self->uplink) DelServer(self->uplink, 0, NULL);
--- 274,283 ----
close_socket(void)
{
! if (replay_file) {
! replay_connected = 0;
! } else {
! ioset_close(socket_io_fd->fd, 1);
! socket_io_fd = NULL;
! }
cManager.uplink->state = DISCONNECTED;
if (self->uplink) DelServer(self->uplink, 0, NULL);
Index: sockcheck.c
===================================================================
RCS file: /cvsroot/srvx/services/src/sockcheck.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -C2 -r1.75 -r1.76
*** sockcheck.c 11 Aug 2002 03:26:15 -0000 1.75
--- sockcheck.c 14 Aug 2002 03:03:58 -0000 1.76
***************
*** 636,641 ****
sockcheck_begin_test(struct sockcheck_client *client)
{
- struct sockaddr_in sin;
- int fd;
struct io_fd *io_fd;
--- 636,639 ----
***************
*** 646,694 ****
do {
client->state = client->tests->list[client->test_index];
! if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
! log(PC_LOG, LOG_ERROR, "Error: socket() for client %s returned errno %d (%s)\n", client->addr->hostname, errno, strerror(errno));
! goto cleanup_1;
}
- if (sockcheck_conf.local_addr) {
- if (bind(fd, (struct sockaddr*)sockcheck_conf.local_addr, sizeof(struct sockaddr)) < 0) {
- log(PC_LOG, LOG_ERROR, "Error: bind() for client %s fd %d returned errno %d (%s)\n", client->addr->hostname, fd, errno, strerror(errno));
- }
- }
- sin.sin_family = AF_INET;
- sin.sin_port = htons(client->state->port);
- sin.sin_addr.s_addr = client->addr->addr;
- client->fd = io_fd = ioset_add(fd);
client->read_pos = 0;
client->read_used = 0;
io_fd->data = client;
- io_fd->connect_cb = sockcheck_connected;
io_fd->readable_cb = sockcheck_readable;
- if (connect(fd, (struct sockaddr*)&sin, sizeof(sin)) < 0) {
- switch (errno) {
- case EINPROGRESS:
- /* continue waiting for the connect() to complete */
- break;
- default:
- log(PC_LOG, LOG_ERROR, "Error: connect() for client %s:%d fd %d returned errno %d (%s)\n", client->addr->hostname, client->state->port, fd, errno, strerror(errno));
- case EHOSTUNREACH:
- case ECONNREFUSED:
- /* go on to next test.. */
- goto cleanup_2;
- }
- } else {
- log(PC_LOG, LOG_INFO, "\nUnexpected immediate success connecting to %s\n", client->addr->hostname);
- sockcheck_connected(io_fd);
- return;
- }
timeq_add(now + client->state->timeout, sockcheck_timeout_client, client);
if (SOCKCHECK_DEBUG) {
! log(PC_LOG, LOG_INFO, "Starting proxy check on %s:%d (test %d) with fd %d (%p)\n", client->addr->hostname, client->state->port, client->test_index, fd, io_fd);
}
return;
- cleanup_2:
- ioset_close(fd, 1);
- cleanup_1:
- client->test_index++;
- client->fd = NULL;
} while (client->test_index < client->tests->used);
/* Ran out of tests to run; accept this client. */
--- 644,661 ----
do {
client->state = client->tests->list[client->test_index];
! client->fd = io_fd = ioset_connect((struct sockaddr*)sockcheck_conf.local_addr, sizeof(struct sockaddr), client->addr->hostname, client->state->port, 0, sockcheck_connected);
! if (!io_fd) {
! client->test_index++;
! continue;
}
client->read_pos = 0;
client->read_used = 0;
io_fd->data = client;
io_fd->readable_cb = sockcheck_readable;
timeq_add(now + client->state->timeout, sockcheck_timeout_client, client);
if (SOCKCHECK_DEBUG) {
! log(PC_LOG, LOG_INFO, "Starting proxy check on %s:%d (test %d) with fd %d (%p)\n", client->addr->hostname, client->state->port, client->test_index, io_fd->fd, io_fd);
}
return;
} while (client->test_index < client->tests->used);
/* Ran out of tests to run; accept this client. */
|
|
From: Zoot <zo...@us...> - 2002-08-14 02:54:58
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv1974/src
Modified Files:
chanserv.c proto-p10.c
Log Message:
Support ircu 2.10.11's +r channel mode.
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.271
retrieving revision 1.272
diff -C2 -r1.271 -r1.272
*** chanserv.c 14 Aug 2002 02:51:11 -0000 1.271
--- chanserv.c 14 Aug 2002 02:54:56 -0000 1.272
***************
*** 828,831 ****
--- 828,832 ----
case 'm': lock_mode(MODE_MODERATED); break;
case 'D': lock_mode(MODE_DELAYJOINS); break;
+ case 'r': lock_mode(MODE_REGONLY); break;
case 'l':
if(lock)
***************
*** 908,911 ****
--- 909,913 ----
if(mode & MODE_MODERATED) buffer[pos++] = 'm';
if(mode & MODE_DELAYJOINS) buffer[pos++] = 'D';
+ if(mode & MODE_REGONLY) buffer[pos++] = 'r';
/* parse_mode_lock() restricts limit to positive numbers. */
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** proto-p10.c 14 Aug 2002 02:51:11 -0000 1.20
--- proto-p10.c 14 Aug 2002 02:54:56 -0000 1.21
***************
*** 609,612 ****
--- 609,614 ----
do_chan_mode(MODE_KEY, 'k');
do_chan_mode(MODE_LIMIT, 'l');
+ do_chan_mode(MODE_DELAYJOINS, 'D');
+ do_chan_mode(MODE_REGONLY, 'r');
#undef do_chan_mode
if (chan->modes & MODE_KEY) pos += sprintf(out+pos, " %s", chan->key);
***************
*** 1892,1895 ****
--- 1894,1898 ----
case 'm': do_chan_mode(MODE_MODERATED); break;
case 'D': do_chan_mode(MODE_DELAYJOINS); break;
+ case 'r': do_chan_mode(MODE_REGONLY); break;
#undef do_chan_mode
case 'l':
|
|
From: Zoot <zo...@us...> - 2002-08-14 02:51:15
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv907/src
Modified Files:
chanserv.c hash.h proto-p10.c
Log Message:
Support the P10 CLEARMODE command and make OPMODE a bit more paranoid about checking arguments.
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.270
retrieving revision 1.271
diff -C2 -r1.270 -r1.271
*** chanserv.c 14 Aug 2002 01:36:11 -0000 1.270
--- chanserv.c 14 Aug 2002 02:51:11 -0000 1.271
***************
*** 389,394 ****
#define ACTION_DEL_BAN 0x0020
! /* The 24 allows for [+-ntlksimp] and lots of fudge factor. */
! #define MODELEN 24 + KEYLEN
#define PADLEN 21
#define ACCESSLEN 10
--- 389,394 ----
#define ACTION_DEL_BAN 0x0020
! /* The 40 allows for [+-ntlksimprD] and lots of fudge factor. */
! #define MODELEN 40 + KEYLEN
#define PADLEN 21
#define ACCESSLEN 10
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.88
retrieving revision 1.89
diff -C2 -r1.88 -r1.89
*** hash.h 14 Aug 2002 01:36:11 -0000 1.88
--- hash.h 14 Aug 2002 02:51:11 -0000 1.89
***************
*** 37,40 ****
--- 37,43 ----
#define MODE_LIMIT 0x0400
#define MODE_DELAYJOINS 0x0800
+ #define MODE_REGONLY 0x1000
+
+ #define CHANNEL_MODES (MODE_PRIVATE | MODE_SECRET | MODE_MODERATED | MODE_TOPICLIMIT | MODE_INVITEONLY | MODE_NOPRIVMSGS | MODE_KEY | MODE_LIMIT | MODE_DELAYJOINS | MODE_REGONLY)
#define FLAGS_OPER 0x0001 /* Operator +O */
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** proto-p10.c 14 Aug 2002 01:48:11 -0000 1.19
--- proto-p10.c 14 Aug 2002 02:51:11 -0000 1.20
***************
*** 1119,1126 ****
return 0;
}
- if (!IsChannelName(argv[1])) {
- log(MAIN_LOG, LOG_ERROR, "Received OPMODE for non-channel %s.\n", argv[1]);
- return 0;
- }
if (!(cn = GetChannel(argv[1]))) {
--- 1119,1122 ----
***************
*** 1132,1135 ****
--- 1128,1135 ----
return 0;
}
+ if(!IsOper(un)) {
+ log(MAIN_LOG, LOG_ERROR, "Non-privileged user %s using OPMODE.\n", un->nick);
+ return 0;
+ }
modes = unsplit_string(argv + 2, argc - 2, NULL);
***************
*** 1137,1140 ****
--- 1137,1167 ----
}
+ int clear_chanmode(struct chanNode *channel, struct userNode *who, const char *modes);
+
+ static CMD_FUNC(cmd_clearmode)
+ {
+ struct chanNode *cn;
+ struct userNode *un;
+
+ if (argc < 3) {
+ return 0;
+ }
+
+ if (!(cn = GetChannel(argv[1]))) {
+ log(MAIN_LOG, LOG_ERROR, "Unable to find channel %s whose mode is changing\n", argv[1]);
+ return 0;
+ }
+ if (!(un = GetUserH(origin))) {
+ log(MAIN_LOG, LOG_ERROR, "Unable to find user %s requesting CLEARMODE.\n", origin);
+ return 0;
+ }
+ if(!IsOper(un)) {
+ log(MAIN_LOG, LOG_ERROR, "Non-privileged user %s using CLEARMODE.\n", un->nick);
+ return 0;
+ }
+
+ return clear_chanmode(cn, un, argv[2]);
+ }
+
static CMD_FUNC(cmd_topic)
{
***************
*** 1414,1417 ****
--- 1441,1446 ----
dict_insert(irc_func_dict, CMD_OPMODE, cmd_opmode);
dict_insert(irc_func_dict, TOK_OPMODE, cmd_opmode);
+ dict_insert(irc_func_dict, CMD_CLEARMODE, cmd_clearmode);
+ dict_insert(irc_func_dict, TOK_CLEARMODE, cmd_clearmode);
/* In P10, DESTRUCT doesn't do anything except be broadcast to servers.
***************
*** 1991,1994 ****
--- 2020,2120 ----
call_mode_change_funcs(channel, who, MODE_CHANGE_MISC, NULL);
}
+ return 1;
+ }
+
+ int
+ clear_chanmode(struct chanNode *channel, struct userNode *who, const char *modes)
+ {
+ static int flags[] = {
+ MODE_CHANOP, 'o',
+ MODE_VOICE, 'v',
+ MODE_PRIVATE, 'p',
+ MODE_SECRET, 's',
+ MODE_MODERATED, 'm',
+ MODE_TOPICLIMIT, 't',
+ MODE_INVITEONLY, 'i',
+ MODE_NOPRIVMSGS, 'n',
+ MODE_KEY, 'k',
+ MODE_BAN, 'b',
+ MODE_LIMIT, 'l',
+ MODE_DELAYJOINS, 'D',
+ MODE_REGONLY, 'r',
+ 0x0, 0x0
+ };
+ unsigned int remove = 0, pos = 0;
+ char buffer[40 + KEYLEN];
+
+ buffer[pos++] = '-';
+ while(*modes)
+ {
+ int *flag_p;
+
+ for(flag_p = flags; flag_p[0]; flag_p += 2)
+ {
+ if(*modes == flag_p[1])
+ {
+ remove |= flag_p[0];
+
+ if((flag_p[0] & CHANNEL_MODES) & channel->modes)
+ {
+ buffer[pos++] = flag_p[0];
+ }
+ break;
+ }
+ }
+ modes++;
+ }
+
+ if(!remove)
+ {
+ return 1;
+ }
+
+ /* Handle channel modes that take arguments in order
+ of their appearance in flags[]. */
+ if((remove & MODE_KEY) && channel->key)
+ {
+ pos += sprintf(buffer + pos, " %s", channel->key);
+ channel->key[0] = '\0';
+ }
+ if((remove & MODE_LIMIT) && channel->limit)
+ {
+ pos += sprintf(buffer + pos, " %d", channel->limit);
+ channel->limit = 0;
+ }
+
+ /* Remove simple modes. */
+ channel->modes &= ~remove;
+
+ /* If removing bans, kill 'em all. */
+ if(remove & MODE_BAN && channel->banlist.used)
+ {
+ unsigned int i;
+ struct banNode **ary = channel->banlist.list;
+ struct string_list *removed;
+ char *ban;
+
+ removed = alloc_string_list(channel->banlist.used);
+ for (i=0; i<channel->banlist.used; i++)
+ {
+ ban = strdup(ary[i]->ban);
+ string_list_append(removed, ban);
+ }
+ DelChannelBan(removed->used, (const char **)removed->list, channel, who, 0);
+ free_string_list(removed);
+ }
+
+ /* Remove member modes. */
+ if(remove & (MODE_CHANOP | MODE_VOICE) && channel->members.used)
+ {
+ int mask = ~(remove & (MODE_CHANOP | MODE_VOICE));
+ unsigned int i;
+
+ for(i = 0; i < channel->members.used; i++)
+ {
+ channel->members.list[i]->modes &= mask;
+ }
+ }
+
return 1;
}
|
|
From: Zoot <zo...@us...> - 2002-08-14 01:48:14
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv5865/src
Modified Files:
proto-p10.c
Log Message:
Support the P10 OPMODE command; note that it reports the origin to the mode-change hooks.
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** proto-p10.c 14 Aug 2002 01:36:12 -0000 1.18
--- proto-p10.c 14 Aug 2002 01:48:11 -0000 1.19
***************
*** 1110,1113 ****
--- 1110,1140 ----
}
+ static CMD_FUNC(cmd_opmode)
+ {
+ struct chanNode *cn;
+ struct userNode *un;
+ const char *modes;
+
+ if (argc < 3) {
+ return 0;
+ }
+ if (!IsChannelName(argv[1])) {
+ log(MAIN_LOG, LOG_ERROR, "Received OPMODE for non-channel %s.\n", argv[1]);
+ return 0;
+ }
+
+ if (!(cn = GetChannel(argv[1]))) {
+ log(MAIN_LOG, LOG_ERROR, "Unable to find channel %s whose mode is changing\n", argv[1]);
+ return 0;
+ }
+ if (!(un = GetUserH(origin))) {
+ log(MAIN_LOG, LOG_ERROR, "Unable to find user %s requesting OPMODE.\n", origin);
+ return 0;
+ }
+
+ modes = unsplit_string(argv + 2, argc - 2, NULL);
+ return mod_chanmode(cn, un, modes, NULL, 0);
+ }
+
static CMD_FUNC(cmd_topic)
{
***************
*** 1385,1388 ****
--- 1412,1418 ----
dict_insert(irc_func_dict, CMD_GLINE, cmd_gline);
dict_insert(irc_func_dict, TOK_GLINE, cmd_gline);
+ dict_insert(irc_func_dict, CMD_OPMODE, cmd_opmode);
+ dict_insert(irc_func_dict, TOK_OPMODE, cmd_opmode);
+
/* In P10, DESTRUCT doesn't do anything except be broadcast to servers.
* Apparently to obliterate channels from any servers that think they
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv778/src
Modified Files:
chanserv.c common.h hash.c hash.h opserv.c proto-bahamut.c
proto-p10.c proto.h tools.c
Log Message:
Make the individual protocol modules responsible for channel mode parsing.
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.269
retrieving revision 1.270
diff -C2 -r1.269 -r1.270
*** chanserv.c 11 Aug 2002 03:26:16 -0000 1.269
--- chanserv.c 14 Aug 2002 01:36:11 -0000 1.270
***************
*** 1246,1250 ****
if(removed->used)
{
! DelChannelBan(removed->used, removed->list, channel->channel, chanserv, 1);
}
--- 1246,1250 ----
if(removed->used)
{
! DelChannelBan(removed->used, (const char **)removed->list, channel->channel, chanserv, 1);
}
***************
*** 1772,1776 ****
parse_mode_lock(&CHANSERV_DEFAULT_MODES, 1, cData);
! mod_chanmode(channel, CHANSERV_DEFAULT_MODES, NULL, 0);
irc_mode(chanserv, channel, CHANSERV_DEFAULT_MODES);
--- 1772,1776 ----
parse_mode_lock(&CHANSERV_DEFAULT_MODES, 1, cData);
! mod_chanmode(channel, chanserv, CHANSERV_DEFAULT_MODES, NULL, 0);
irc_mode(chanserv, channel, CHANSERV_DEFAULT_MODES);
***************
*** 2989,2993 ****
else
{
! AddChannelBan(1, &ban, channel, chanserv, now, 1);
}
}
--- 2989,2993 ----
else
{
! AddChannelBan(1, (const char **)&ban, channel, chanserv, now, 1);
}
}
***************
*** 3113,3117 ****
if(removed->used)
{
! DelChannelBan(removed->used, removed->list, channel, chanserv, 1);
acted = 1;
}
--- 3113,3117 ----
if(removed->used)
{
! DelChannelBan(removed->used, (const char **)removed->list, channel, chanserv, 1);
acted = 1;
}
***************
*** 3207,3211 ****
string_list_append(removed, ban);
}
! DelChannelBan(removed->used, removed->list, channel, chanserv, 1);
free_string_list(removed);
--- 3207,3211 ----
string_list_append(removed, ban);
}
! DelChannelBan(removed->used, (const char **)removed->list, channel, chanserv, 1);
free_string_list(removed);
***************
*** 3229,3233 ****
}
! mod_chanmode(channel, change, NULL, 0);
irc_mode(chanserv, channel, change);
--- 3229,3233 ----
}
! mod_chanmode(channel, chanserv, change, NULL, 0);
irc_mode(chanserv, channel, change);
***************
*** 3835,3839 ****
create_mode_lock(modes, channel->channel_info);
! mod_chanmode(channel, modes, NULL, 0);
irc_mode(chanserv, channel, modes);
}
--- 3835,3839 ----
create_mode_lock(modes, channel->channel_info);
! mod_chanmode(channel, chanserv, modes, NULL, 0);
irc_mode(chanserv, channel, modes);
}
***************
*** 3853,3857 ****
}
! mod_chanmode(channel, changes, NULL, 0);
if(!check_user_level(user, channel, channel->channel_info->options[optEnfModes], 1, 0))
--- 3853,3857 ----
}
! mod_chanmode(channel, chanserv, changes, NULL, 0);
if(!check_user_level(user, channel, channel->channel_info->options[optEnfModes], 1, 0))
***************
*** 3863,3867 ****
create_mode_lock(modes, channel->channel_info);
! mod_chanmode(channel, modes, NULL, 0);
irc_mode(chanserv, channel, modes);
--- 3863,3867 ----
create_mode_lock(modes, channel->channel_info);
! mod_chanmode(channel, chanserv, modes, NULL, 0);
irc_mode(chanserv, channel, modes);
***************
*** 5122,5126 ****
create_mode_lock(modes, channel->channel_info);
! mod_chanmode(channel, modes, NULL, 0);
irc_mode(chanserv, channel, modes);
}
--- 5122,5126 ----
create_mode_lock(modes, channel->channel_info);
! mod_chanmode(channel, chanserv, modes, NULL, 0);
irc_mode(chanserv, channel, modes);
}
***************
*** 5759,5763 ****
char modes[MODELEN];
create_mode_lock(modes, cData);
! mod_chanmode(channel, modes, NULL, 0);
irc_mode(chanserv, channel, modes);
}
--- 5759,5763 ----
char modes[MODELEN];
create_mode_lock(modes, cData);
! mod_chanmode(channel, chanserv, modes, NULL, 0);
irc_mode(chanserv, channel, modes);
}
***************
*** 5850,5854 ****
ban = bData->mask;
! AddChannelBan(1, &ban, channel, chanserv, now, 1);
KickChannelUser(user, channel, chanserv, kick_reason);
return;
--- 5850,5854 ----
ban = bData->mask;
! AddChannelBan(1, (const char **)&ban, channel, chanserv, now, 1);
KickChannelUser(user, channel, chanserv, kick_reason);
return;
***************
*** 6073,6077 ****
create_mode_lock(correct, channel->channel_info);
! mod_chanmode(channel, correct, NULL, 0);
irc_mode(chanserv, channel, correct);
--- 6073,6077 ----
create_mode_lock(correct, channel->channel_info);
! mod_chanmode(channel, chanserv, correct, NULL, 0);
irc_mode(chanserv, channel, correct);
***************
*** 6115,6119 ****
{
char *remove = change;
! DelChannelBan(1, &remove, channel, chanserv, 1);
chanserv_notice(user, CSMSG_MASK_PROTECTED, remove);
}
--- 6115,6119 ----
{
char *remove = change;
! DelChannelBan(1, (const char **)&remove, channel, chanserv, 1);
chanserv_notice(user, CSMSG_MASK_PROTECTED, remove);
}
Index: common.h
===================================================================
RCS file: /cvsroot/srvx/services/src/common.h,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -r1.77 -r1.78
*** common.h 5 Aug 2002 03:22:19 -0000 1.77
--- common.h 14 Aug 2002 01:36:11 -0000 1.78
***************
*** 90,94 ****
int getusermodes(char *sender);
void mod_usermode(struct userNode *user, const char *modes);
- void mod_chanmode(struct chanNode *channel, const char *mode_change, const char *key, int limit);
int verify_chanmode(const char *modes);
int split_line(unsigned char *line, int irc_colon, int argv_size, unsigned char *argv[]);
--- 90,93 ----
Index: hash.c
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.c,v
retrieving revision 1.162
retrieving revision 1.163
diff -C2 -r1.162 -r1.163
*** hash.c 8 Aug 2002 02:15:57 -0000 1.162
--- hash.c 14 Aug 2002 01:36:11 -0000 1.163
***************
*** 341,345 ****
strcpy(orig_key, cNode->key);
cNode->modes = 0;
! mod_chanmode(cNode, modes, key, limit);
cNode->timestamp = time_;
rel_age = 1;
--- 341,345 ----
strcpy(orig_key, cNode->key);
cNode->modes = 0;
! mod_chanmode(cNode, NULL, modes, key, limit);
cNode->timestamp = time_;
rel_age = 1;
***************
*** 381,385 ****
}
modebuf[nn] = 0;
! mod_chanmode(cNode, modebuf, 0, 0);
irc_mode(reops.list[0], cNode, modebuf);
}
--- 381,385 ----
}
modebuf[nn] = 0;
! mod_chanmode(cNode, NULL, modebuf, 0, 0);
irc_mode(reops.list[0], cNode, modebuf);
}
***************
*** 409,413 ****
while (banlist[nn] != ' ' && banlist[nn]) nn++;
while (banlist[nn] == ' ') banlist[nn++] = 0;
! AddChannelBan(1, &ban, cNode, NULL, now, 0);
}
}
--- 409,413 ----
while (banlist[nn] != ' ' && banlist[nn]) nn++;
while (banlist[nn] == ' ') banlist[nn++] = 0;
! AddChannelBan(1, (const char **)&ban, cNode, NULL, now, 0);
}
}
***************
*** 454,458 ****
for (n=channel->banlist.used; n>0; ) {
argh = channel->banlist.list[--n]->ban;
! DelChannelBan(1, &argh, channel, NULL, 0);
}
--- 454,458 ----
for (n=channel->banlist.used; n>0; ) {
argh = channel->banlist.list[--n]->ban;
! DelChannelBan(1, (const char **)&argh, channel, NULL, 0);
}
***************
*** 609,613 ****
static void
! chan_apply_bans(struct userNode *who, struct chanNode *channel, char *what, unsigned int count, char **list)
{
char buffer[400];
--- 609,613 ----
static void
! chan_apply_bans(struct userNode *who, struct chanNode *channel, char *what, unsigned int count, const char **list)
{
char buffer[400];
***************
*** 695,699 ****
}
! int ChannelBanExists(struct chanNode *channel, char *ban)
{
unsigned int n;
--- 695,699 ----
}
! int ChannelBanExists(struct chanNode *channel, const char *ban)
{
unsigned int n;
***************
*** 710,714 ****
void
! AddChannelBan(unsigned int num, char **banset, struct chanNode* channel, struct userNode *who, time_t set, int announce)
{
unsigned int n, i;
--- 710,714 ----
void
! AddChannelBan(unsigned int num, const char **banset, struct chanNode* channel, struct userNode *who, time_t set, int announce)
{
unsigned int n, i;
***************
*** 747,751 ****
silently. */
if (remove) {
! DelChannelBan(remove->used, remove->list, channel, who, announce);
free_string_list(remove);
}
--- 747,751 ----
silently. */
if (remove) {
! DelChannelBan(remove->used, (const char **)remove->list, channel, who, announce);
free_string_list(remove);
}
***************
*** 754,758 ****
void
! DelChannelBan(unsigned int num, char **banset, struct chanNode* channel, struct userNode *who, int announce)
{
unsigned int n, m;
--- 754,758 ----
void
! DelChannelBan(unsigned int num, const char **banset, struct chanNode* channel, struct userNode *who, int announce)
{
unsigned int n, m;
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.87
retrieving revision 1.88
diff -C2 -r1.87 -r1.88
*** hash.h 13 Aug 2002 03:04:07 -0000 1.87
--- hash.h 14 Aug 2002 01:36:11 -0000 1.88
***************
*** 225,231 ****
! int ChannelBanExists(struct chanNode *channel, char *ban);
! void AddChannelBan(unsigned int num, char **banset, struct chanNode* channel, struct userNode *who, time_t set, int announce);
! void DelChannelBan(unsigned int num, char **banset, struct chanNode* channel, struct userNode *who, int announce);
void AddChannelOp(unsigned int num, struct userNode **newops, struct chanNode *channel, struct userNode *who, int announce);
--- 225,231 ----
! int ChannelBanExists(struct chanNode *channel, const char *ban);
! void AddChannelBan(unsigned int num, const char **banset, struct chanNode* channel, struct userNode *who, time_t set, int announce);
! void DelChannelBan(unsigned int num, const char **banset, struct chanNode* channel, struct userNode *who, int announce);
void AddChannelOp(unsigned int num, struct userNode **newops, struct chanNode *channel, struct userNode *who, int announce);
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.261
retrieving revision 1.262
diff -C2 -r1.261 -r1.262
*** opserv.c 11 Aug 2002 03:26:16 -0000 1.261
--- opserv.c 14 Aug 2002 01:36:11 -0000 1.262
***************
*** 444,448 ****
return 0;
}
! AddChannelBan(1, &mask, channel, opserv, time(0), 1);
opserv_notice(user, OSMSG_ADDED_BAN, mask, channel->name);
return 1;
--- 444,448 ----
return 0;
}
! AddChannelBan(1, (const char **)&mask, channel, opserv, time(0), 1);
opserv_notice(user, OSMSG_ADDED_BAN, mask, channel->name);
return 1;
***************
*** 573,582 ****
list[count++] = channel->banlist.list[n]->ban;
if (count == ArrayLength(list)) {
! DelChannelBan(count, list, channel, opserv, 1);
count = 0;
}
}
if (count) {
! DelChannelBan(count, list, channel, opserv, 1);
}
opserv_notice(user, OSMSG_CLEARBANS_DONE, channel->name);
--- 573,582 ----
list[count++] = channel->banlist.list[n]->ban;
if (count == ArrayLength(list)) {
! DelChannelBan(count, (const char **)list, channel, opserv, 1);
count = 0;
}
}
if (count) {
! DelChannelBan(count, (const char **)list, channel, opserv, 1);
}
opserv_notice(user, OSMSG_CLEARBANS_DONE, channel->name);
***************
*** 1074,1078 ****
}
mask = generate_hostmask(target, 0);
! AddChannelBan(1, &mask, channel, opserv, time(0), 1);
free(mask);
KickChannelUser(target, channel, opserv, reason);
--- 1074,1078 ----
}
mask = generate_hostmask(target, 0);
! AddChannelBan(1, (const char **)&mask, channel, opserv, time(0), 1);
free(mask);
KickChannelUser(target, channel, opserv, reason);
***************
*** 1097,1101 ****
if (channel->banlist.used < MAXBANS) {
char *ban = "*!*@*";
! AddChannelBan(1, &ban, channel, opserv, now, 1);
}
/* now kick them */
--- 1097,1101 ----
if (channel->banlist.used < MAXBANS) {
char *ban = "*!*@*";
! AddChannelBan(1, (const char **)&ban, channel, opserv, now, 1);
}
/* now kick them */
***************
*** 1134,1138 ****
irc_mode(opserv, channel, mc);
}
! mod_chanmode(channel, changes, NULL, 0);
irc_mode(opserv, channel, changes);
opserv_notice(user, OSMSG_MODE_SET, channel->name);
--- 1134,1138 ----
irc_mode(opserv, channel, mc);
}
! mod_chanmode(channel, opserv, changes, NULL, 0);
irc_mode(opserv, channel, changes);
opserv_notice(user, OSMSG_MODE_SET, channel->name);
***************
*** 1151,1155 ****
}
usermask = generate_hostmask(target, 0);
! AddChannelBan(1, &usermask, channel, opserv, now, 1);
opserv_notice(user, OSMSG_ADDED_BAN, usermask, channel->name);
free(usermask);
--- 1151,1155 ----
}
usermask = generate_hostmask(target, 0);
! AddChannelBan(1, (const char **)&usermask, channel, opserv, now, 1);
opserv_notice(user, OSMSG_ADDED_BAN, usermask, channel->name);
free(usermask);
***************
*** 1267,1271 ****
{
OPSERV_MIN_PARMS(2, true);
! DelChannelBan(argc-1, (char**)argv+1, channel, opserv, 1);
opserv_notice(user, OSMSG_UNBAN_DONE, channel->name);
return 1;
--- 1267,1271 ----
{
OPSERV_MIN_PARMS(2, true);
! DelChannelBan(argc-1, (const char **)argv+1, channel, opserv, 1);
opserv_notice(user, OSMSG_UNBAN_DONE, channel->name);
return 1;
***************
*** 1978,1982 ****
AddChannelUser(opserv, channel);
AddChannelOp(1, &opserv, channel, opserv, 1);
! AddChannelBan(1, &ban_all, channel, opserv, now, 0);
channel->modes |= MODE_SECRET | MODE_INVITEONLY;
irc_mode(opserv, channel, "+sib *!*@*");
--- 1978,1982 ----
AddChannelUser(opserv, channel);
AddChannelOp(1, &opserv, channel, opserv, 1);
! AddChannelBan(1, (const char **)&ban_all, channel, opserv, now, 0);
channel->modes |= MODE_SECRET | MODE_INVITEONLY;
irc_mode(opserv, channel, "+sib *!*@*");
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** proto-bahamut.c 13 Aug 2002 03:04:07 -0000 1.14
--- proto-bahamut.c 14 Aug 2002 01:36:12 -0000 1.15
***************
*** 759,765 ****
struct chanNode *cn;
struct modeNode *mn;
! const char *mchange;
! chan_mode_t mode;
! int add = 1, next = 4, res = 1, bit;
if (!(cn = GetChannel(argv[1]))) {
--- 759,763 ----
struct chanNode *cn;
struct modeNode *mn;
! const char *modes;
if (!(cn = GetChannel(argv[1]))) {
***************
*** 776,848 ****
}
! for (mchange = argv[3], mode = cn->modes; *mchange; mchange++) {
! switch (*mchange) {
! case '+': add = 1; break;
! case '-': add = 0; break;
! #define CHAN_MODE(CHAR, FLAG) case CHAR: if (add) mode |= FLAG; else mode &= ~FLAG; break
! CHAN_MODE('n', MODE_NOPRIVMSGS);
! CHAN_MODE('t', MODE_TOPICLIMIT);
! CHAN_MODE('s', MODE_SECRET);
! CHAN_MODE('p', MODE_PRIVATE);
! CHAN_MODE('i', MODE_INVITEONLY);
! CHAN_MODE('m', MODE_MODERATED);
! CHAN_MODE('D', MODE_DELAYJOINS);
! #undef CHAN_MODE
! case 'l':
! if (add) {
! mode |= MODE_LIMIT;
! cn->limit = atoi(argv[next++]);
! } else {
! mode &= ~MODE_LIMIT;
! }
! break;
! case 'k':
! if (add) {
! mode |= MODE_KEY;
! safestrncpy(cn->key, argv[next++], sizeof(cn->key));
! } else {
! next++;
! mode &= ~MODE_KEY;
! }
! break;
! case 'o':
! case 'v': {
! struct userNode *vic;
! if (!(vic = GetUserH(argv[next++]))) {
! log(MAIN_LOG, LOG_ERROR, "Unable to find user %s\n", argv[next-1]);
! res = 0;
! break;
! }
! if (!(mn = GetUserMode(cn, vic))) {
! log(MAIN_LOG, LOG_ERROR, "Unable to find user %s in channel %s\n", vic->nick, cn->name);
! res = 0;
! break;
! }
! bit = (*mchange == 'o') ? MODE_CHANOP : MODE_VOICE;
! if (add) mn->modes |= bit; else mn->modes &= ~bit;
! if (un && (bit == MODE_CHANOP)) {
! call_mode_change_funcs(cn, un, (add ? MODE_CHANGE_OP : MODE_CHANGE_DEOP), vic);
! }
! break;
! }
! case 'b': {
! char *ban = argv[next++];
! if (add) {
! AddChannelBan(1, &ban, cn, un, now, 0);
! if (un) call_mode_change_funcs(cn, un, MODE_CHANGE_BAN, ban);
! } else {
! DelChannelBan(1, &ban, cn, un, 0);
! }
! break;
! }
! }
! }
! if (mode != cn->modes && un) {
! cn->modes = mode;
! call_mode_change_funcs(cn, un, MODE_CHANGE_MISC, NULL);
! } else {
! cn->modes = mode;
! }
! return res;
} else if ((un = GetUserH(argv[1]))) {
mod_usermode(un, argv[2]);
--- 774,779 ----
}
! modes = unsplit_string(argv + 3, argc - 3, NULL);
! return mod_chanmode(cn, un, modes, NULL, 0);
} else if ((un = GetUserH(argv[1]))) {
mod_usermode(un, argv[2]);
***************
*** 1055,1057 ****
--- 986,1155 ----
}
info->on_notice = handler;
+ }
+
+ int
+ mod_chanmode(struct chanNode *channel, struct userNode *who, const char *modes, const char *key, int limit)
+ {
+ const char *word = modes;
+ int add = 1;
+ chan_mode_t old;
+
+ if(!word || !*word) {
+ return 0;
+ }
+
+ #define advance_word do \
+ { \
+ while (*word != ' ' && *word) word++;\
+ while (*word == ' ') word++; \
+ } while(0)
+ advance_word;
+
+ old = channel->modes;
+
+ while (modes) {
+ switch (*modes++) {
+ case ' ':
+ case 0:
+ modes = NULL;
+ break;
+ case '+': add = 1; break;
+ case '-': add = 0; break;
+ #define do_chan_mode(FLAG) do { if (add) channel->modes |= FLAG; else channel->modes &= ~FLAG; } while(0)
+ case 'n': do_chan_mode(MODE_NOPRIVMSGS); break;
+ case 't': do_chan_mode(MODE_TOPICLIMIT); break;
+ case 's': do_chan_mode(MODE_SECRET); break;
+ case 'p': do_chan_mode(MODE_PRIVATE); break;
+ case 'i': do_chan_mode(MODE_INVITEONLY); break;
+ case 'm': do_chan_mode(MODE_MODERATED); break;
+ case 'D': do_chan_mode(MODE_DELAYJOINS); break;
+ #undef do_chan_mode
+ case 'l':
+ if (add) {
+ channel->modes |= MODE_LIMIT;
+ if(limit) {
+ channel->limit = limit;
+ } else {
+ if(!*word) {
+ return 0;
+ }
+ channel->limit = strtoul(word, NULL, 0);
+ advance_word;
+ }
+
+ if(!channel->limit) {
+ channel->modes &= ~MODE_LIMIT;
+ }
+ } else {
+ /* Old limit not given for MODE -l */
+ channel->modes &= ~MODE_LIMIT;
+ }
+ break;
+ case 'k':
+ if (add) {
+ channel->modes |= MODE_KEY;
+ if(key) {
+ safestrncpy(channel->key, key, sizeof(channel->key));
+ } else {
+ unsigned int n;
+
+ if(!*word) {
+ return 0;
+ }
+ for (n=0; (*word != ' ' && *word) && (n < sizeof(channel->key)-1); n++) {
+ channel->key[n] = *word++;
+ }
+ channel->key[n] = 0;
+ advance_word;
+ }
+ } else {
+ /* Gobble up the key to preserve the alignment between
+ letters and arguments. */
+ if(!key)
+ {
+ if(!*word) {
+ return 0;
+ }
+ advance_word;
+ }
+
+ channel->modes &= ~MODE_KEY;
+ }
+ break;
+ case 'o':
+ case 'v': {
+ char numeric[COMBO_NUMERIC_LEN + 1];
+ const char *start;
+ unsigned int length;
+ struct userNode *vic;
+ struct modeNode *mn;
+ int bit;
+
+ if(!*word) {
+ return 0;
+ }
+ for(start = word, length = 0; *word; word++, length++) {
+ if(*word == ' ' || length >= COMBO_NUMERIC_LEN) {
+ break;
+ }
+ }
+ safestrncpy(numeric, start, length + 1);
+
+ vic = GetUserH(numeric);
+ advance_word;
+ if (!vic) {
+ log(MAIN_LOG, LOG_ERROR, "Unable to find user with numeric %s\n", numeric);
+ return 0;
+ }
+ mn = GetUserMode(channel, vic);
+ if (!mn) {
+ log(MAIN_LOG, LOG_ERROR, "Unable to find user %s in channel %s\n", vic->nick, channel->name);
+ return 0;
+ }
+
+ bit = (modes[-1] == 'o') ? MODE_CHANOP : MODE_VOICE;
+ if (add) mn->modes |= bit;
+ else mn->modes &= ~bit;
+ if(bit != MODE_CHANOP) break;
+
+ if (who) {
+ call_mode_change_funcs(channel, who, add ? MODE_CHANGE_OP : MODE_CHANGE_DEOP, vic);
+ }
+ break;
+ }
+ case 'b': {
+ unsigned int length;
+ char ban[NICKLEN + USERLEN + HOSTLEN + 3];
+ const char *start, *list = (const char *)ban;
+
+ if(!*word) {
+ return 0;
+ }
+ for(start = word, length = 0; *word; word++, length++) {
+ if(*word == ' ' || length >= NICKLEN + USERLEN + HOSTLEN + 2) {
+ break;
+ }
+ }
+ safestrncpy(ban, start, length + 1);
+
+ advance_word;
+ if (add) {
+ AddChannelBan(1, &list, channel, who, now, 0);
+ if (who) {
+ call_mode_change_funcs(channel, who, MODE_CHANGE_BAN, (char *)ban);
+ }
+ } else {
+ DelChannelBan(1, &list, channel, who, 0);
+ }
+ break;
+ }
+ }
+ }
+
+ #undef advance_word
+
+ if (channel->modes != old && who) {
+ call_mode_change_funcs(channel, who, MODE_CHANGE_MISC, NULL);
+ }
+ return 1;
}
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** proto-p10.c 13 Aug 2002 21:17:25 -0000 1.17
--- proto-p10.c 14 Aug 2002 01:36:12 -0000 1.18
***************
*** 1073,1079 ****
static CMD_FUNC(cmd_mode)
{
! if (argc < 3) return 0;
if (!IsChannelName(argv[1])) {
! struct userNode *un = GetUserH(argv[1]);
if (!un) {
log(MAIN_LOG, LOG_ERROR, "Unable to find user %s whose mode is changing\n", argv[1]);
--- 1073,1085 ----
static CMD_FUNC(cmd_mode)
{
! struct chanNode *cn;
! struct userNode *un;
! const char *modes;
!
! if (argc < 3) {
! return 0;
! }
if (!IsChannelName(argv[1])) {
! un = GetUserH(argv[1]);
if (!un) {
log(MAIN_LOG, LOG_ERROR, "Unable to find user %s whose mode is changing\n", argv[1]);
***************
*** 1082,1182 ****
mod_usermode(un, argv[2]);
return 1;
! } else {
! struct chanNode *cn;
! struct userNode *un;
! int next_arg=3, res=1, add=1, bit;
! const char *mchange;
! struct modeNode *mn;
! chan_mode_t mode;
! if (!(cn = GetChannel(argv[1]))) {
! log(MAIN_LOG, LOG_ERROR, "Unable to find channel %s whose mode is changing\n", argv[1]);
! return 0;
! }
! if ((un = GetUserH(origin))) {
! /* Update idle time for person setting the mode */
! if ((mn = GetUserMode(cn, un))) {
! mn->idle_since = now;
! }
! } else {
! /* If it came from a server, reset timestamp to re-sync. */
! cn->timestamp = atoi(argv[argc-1]);
! }
! mchange = argv[2];
! mode = cn->modes;
! while (*mchange) {
! switch (*mchange++) {
! case 0: break;
! case '+': add = 1; break;
! case '-': add = 0; break;
! #define do_chan_mode(FLAG) do { if (add) mode |= FLAG; else mode &= ~FLAG; } while(0)
! case 'n': do_chan_mode(MODE_NOPRIVMSGS); break;
! case 't': do_chan_mode(MODE_TOPICLIMIT); break;
! case 's': do_chan_mode(MODE_SECRET); break;
! case 'p': do_chan_mode(MODE_PRIVATE); break;
! case 'i': do_chan_mode(MODE_INVITEONLY); break;
! case 'm': do_chan_mode(MODE_MODERATED); break;
! case 'D': do_chan_mode(MODE_DELAYJOINS); break;
! #undef do_chan_mode
! case 'l':
! if (add) {
! mode |= MODE_LIMIT;
! cn->limit = atoi(argv[next_arg++]);
! } else {
! /* Old limit not given for MODE -l */
! mode &= ~MODE_LIMIT;
! }
! break;
! case 'k':
! if (add) {
! mode |= MODE_KEY;
! safestrncpy(cn->key, argv[next_arg++], sizeof(cn->key));
! } else {
! /* Gobble the key up so following arguments line up. */
! next_arg++;
! mode &= ~MODE_KEY;
! }
! break;
! case 'o':
! case 'v': {
! struct userNode *vic;
! vic = GetUserN(argv[next_arg++]);
! if (!vic) {
! log(MAIN_LOG, LOG_ERROR, "Unable to find user with numeric %s\n", argv[next_arg-1]);
! res = 0;
! break;
! }
! mn = GetUserMode(cn, vic);
! if (!mn) {
! log(MAIN_LOG, LOG_ERROR, "Unable to find user %s in channel %s\n", vic->nick, cn->name);
! res = 0;
! break;
! }
! bit = (mchange[-1] == 'o') ? MODE_CHANOP : MODE_VOICE;
! if (add) mn->modes |= bit;
! else mn->modes &= ~bit;
! if(bit != MODE_CHANOP) break;
!
! if(un) call_mode_change_funcs(cn, un, add ? MODE_CHANGE_OP : MODE_CHANGE_DEOP, vic);
! break;}
! case 'b': {
! char *ban = argv[next_arg++];
! if (add) {
! AddChannelBan(1, &ban, cn, un, now, 0);
! if (un) call_mode_change_funcs(cn, un, MODE_CHANGE_BAN, ban);
! } else DelChannelBan(1, &ban, cn, un, 0);
! break;
! }
! }
! }
! if (mode != cn->modes && un) {
! cn->modes = mode;
! call_mode_change_funcs(cn, un, MODE_CHANGE_MISC, NULL);
! } else {
! cn->modes = mode;
}
! return res;
}
}
--- 1088,1111 ----
mod_usermode(un, argv[2]);
return 1;
! }
! if (!(cn = GetChannel(argv[1]))) {
! log(MAIN_LOG, LOG_ERROR, "Unable to find channel %s whose mode is changing\n", argv[1]);
! return 0;
! }
! if ((un = GetUserH(origin))) {
! struct modeNode *mn;
! /* Update idle time for person setting the mode */
! if ((mn = GetUserMode(cn, un))) {
! mn->idle_since = now;
}
! } else {
! /* If it came from a server, reset timestamp to re-sync. */
! cn->timestamp = atoi(argv[argc-1]);
}
+
+ modes = unsplit_string(argv + 2, argc - 2, NULL);
+ return mod_chanmode(cn, un, modes, NULL, 0);
}
***************
*** 1866,1869 ****
--- 1795,1965 ----
user->dead = 1;
userList_append(&dead_users, user);
+ }
+
+ int
+ mod_chanmode(struct chanNode *channel, struct userNode *who, const char *modes, const char *key, int limit)
+ {
+ const char *word = modes;
+ int add = 1;
+ chan_mode_t old;
+
+ if(!word || !*word) {
+ return 0;
+ }
+
+ #define advance_word do \
+ { \
+ while (*word != ' ' && *word) word++;\
+ while (*word == ' ') word++; \
+ } while(0)
+ advance_word;
+
+ old = channel->modes;
+
+ while (modes) {
+ switch (*modes++) {
+ case ' ':
+ case 0:
+ modes = NULL;
+ break;
+ case '+': add = 1; break;
+ case '-': add = 0; break;
+ #define do_chan_mode(FLAG) do { if (add) channel->modes |= FLAG; else channel->modes &= ~FLAG; } while(0)
+ case 'n': do_chan_mode(MODE_NOPRIVMSGS); break;
+ case 't': do_chan_mode(MODE_TOPICLIMIT); break;
+ case 's': do_chan_mode(MODE_SECRET); break;
+ case 'p': do_chan_mode(MODE_PRIVATE); break;
+ case 'i': do_chan_mode(MODE_INVITEONLY); break;
+ case 'm': do_chan_mode(MODE_MODERATED); break;
+ case 'D': do_chan_mode(MODE_DELAYJOINS); break;
+ #undef do_chan_mode
+ case 'l':
+ if (add) {
+ channel->modes |= MODE_LIMIT;
+ if(limit) {
+ channel->limit = limit;
+ } else {
+ if(!*word) {
+ return 0;
+ }
+ channel->limit = strtoul(word, NULL, 0);
+ advance_word;
+ }
+
+ if(!channel->limit) {
+ channel->modes &= ~MODE_LIMIT;
+ }
+ } else {
+ /* Old limit not given for MODE -l */
+ channel->modes &= ~MODE_LIMIT;
+ }
+ break;
+ case 'k':
+ if (add) {
+ channel->modes |= MODE_KEY;
+ if(key) {
+ safestrncpy(channel->key, key, sizeof(channel->key));
+ } else {
+ unsigned int n;
+
+ if(!*word) {
+ return 0;
+ }
+ for (n=0; (*word != ' ' && *word) && (n < sizeof(channel->key)-1); n++) {
+ channel->key[n] = *word++;
+ }
+ channel->key[n] = 0;
+ advance_word;
+ }
+ } else {
+ /* Gobble up the key to preserve the alignment between
+ letters and arguments. */
+ if(!key)
+ {
+ if(!*word) {
+ return 0;
+ }
+ advance_word;
+ }
+
+ channel->modes &= ~MODE_KEY;
+ }
+ break;
+ case 'o':
+ case 'v': {
+ char numeric[COMBO_NUMERIC_LEN + 1];
+ const char *start;
+ unsigned int length;
+ struct userNode *vic;
+ struct modeNode *mn;
+ int bit;
+
+ if(!*word) {
+ return 0;
+ }
+ for(start = word, length = 0; *word; word++, length++) {
+ if(*word == ' ' || length >= COMBO_NUMERIC_LEN) {
+ break;
+ }
+ }
+ safestrncpy(numeric, start, length + 1);
+
+ vic = GetUserN(numeric);
+ advance_word;
+ if (!vic) {
+ log(MAIN_LOG, LOG_ERROR, "Unable to find user with numeric %s\n", numeric);
+ return 0;
+ }
+ mn = GetUserMode(channel, vic);
+ if (!mn) {
+ log(MAIN_LOG, LOG_ERROR, "Unable to find user %s in channel %s\n", vic->nick, channel->name);
+ return 0;
+ }
+
+ bit = (modes[-1] == 'o') ? MODE_CHANOP : MODE_VOICE;
+ if (add) mn->modes |= bit;
+ else mn->modes &= ~bit;
+ if(bit != MODE_CHANOP) break;
+
+ if (who) {
+ call_mode_change_funcs(channel, who, add ? MODE_CHANGE_OP : MODE_CHANGE_DEOP, vic);
+ }
+ break;
+ }
+ case 'b': {
+ unsigned int length;
+ char ban[NICKLEN + USERLEN + HOSTLEN + 3];
+ const char *start, *list = (const char *)ban;
+
+ if(!*word) {
+ return 0;
+ }
+ for(start = word, length = 0; *word; word++, length++) {
+ if(*word == ' ' || length >= NICKLEN + USERLEN + HOSTLEN + 2) {
+ break;
+ }
+ }
+ safestrncpy(ban, start, length + 1);
+
+ advance_word;
+ if (add) {
+ AddChannelBan(1, &list, channel, who, now, 0);
+ if (who) {
+ call_mode_change_funcs(channel, who, MODE_CHANGE_BAN, (char *)ban);
+ }
+ } else {
+ DelChannelBan(1, &list, channel, who, 0);
+ }
+ break;
+ }
+ }
+ }
+
+ #undef advance_word
+
+ if (channel->modes != old && who) {
+ call_mode_change_funcs(channel, who, MODE_CHANGE_MISC, NULL);
+ }
+ return 1;
}
Index: proto.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto.h,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -r1.60 -r1.61
*** proto.h 13 Aug 2002 03:04:07 -0000 1.60
--- proto.h 14 Aug 2002 01:36:12 -0000 1.61
***************
*** 170,173 ****
--- 170,174 ----
void DelServer(struct server* serv, int announce, const char *message);
void DelUser(struct userNode* user, struct userNode *killer, int announce, const char *why);
+ int mod_chanmode(struct chanNode *channel, struct userNode *who, const char *modes, const char *key, int limit);
/* (most protocols will want to make an AddUser helper function) */
Index: tools.c
===================================================================
RCS file: /cvsroot/srvx/services/src/tools.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -C2 -r1.111 -r1.112
*** tools.c 5 Aug 2002 03:22:18 -0000 1.111
--- tools.c 14 Aug 2002 01:36:12 -0000 1.112
***************
*** 184,258 ****
}
- void mod_chanmode(struct chanNode *channel, const char *mode_change, const char *key, int limit)
- {
- int add = 1;
- const char *word = mode_change;
-
- if (!mode_change || !*mode_change) return;
- while (*word != ' ' && *word) word++;
- while (*word == ' ') word++;
- while (1) {
- switch (*mode_change++) {
- case 0:
- case ' ':
- return;
- case '+': add = 1; break;
- case '-': add = 0; break;
- #define do_chan_mode(FLAG) do { if (add) channel->modes |= FLAG; else channel->modes &= ~FLAG; } while (0)
- case 'n': do_chan_mode(MODE_NOPRIVMSGS); break;
- case 't': do_chan_mode(MODE_TOPICLIMIT); break;
- case 's': do_chan_mode(MODE_SECRET); break;
- case 'p': do_chan_mode(MODE_PRIVATE); break;
- case 'i': do_chan_mode(MODE_INVITEONLY); break;
- case 'm': do_chan_mode(MODE_MODERATED); break;
- case 'D': do_chan_mode(MODE_DELAYJOINS); break;
- #undef do_chan_mode
- case 'k':
- if (add) {
- channel->modes |= MODE_KEY;
- if(key)
- {
- safestrncpy(channel->key, key, sizeof(channel->key));
- }
- else
- {
- unsigned int n;
- for (n=0; (*word != ' ' && *word) && (n < sizeof(channel->key)-1); n++) {
- channel->key[n] = *word++;
- }
- channel->key[n] = 0;
- }
- } else {
- /* Gobble up the key to preserve the alignment between
- letters and arguments. */
- if(!key)
- {
- while(*word && *word != ' ') word++;
- }
-
- channel->modes &= ~MODE_KEY;
- }
- break;
- case 'l':
- if (add) {
- channel->modes |= MODE_LIMIT;
- if(limit) {
- channel->limit = limit;
- } else {
- channel->limit = strtoul(word, NULL, 0);
- }
- while (*word != ' ' && *word) word++;
- while (*word == ' ') word++;
-
- if(!channel->limit) {
- channel->modes &= ~MODE_LIMIT;
- }
- } else {
- channel->modes &= ~MODE_LIMIT;
- }
- }
- }
- }
-
int verify_chanmode(const char *modes)
{
--- 184,187 ----
|
|
From: Zoot <zo...@us...> - 2002-08-13 21:17:45
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv24600/src
Modified Files:
proto-p10.c
Log Message:
Make tokenized P10 protocol output an option; merge in new commands from ircu 2.10.11.
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** proto-p10.c 13 Aug 2002 03:04:07 -0000 1.16
--- proto-p10.c 13 Aug 2002 21:17:25 -0000 1.17
***************
*** 21,159 ****
#include "proto-common.c"
! #define CMD_ACCOUNT "ACCOUNT"
! #define CMD_ADMIN "ADMIN"
! #define CMD_AWAY "AWAY"
! #define CMD_BURST "BURST"
! #define CMD_CLOSE "CLOSE"
! #define CMD_CNOTICE "CNOTICE"
! #define CMD_CONNECT "CONNECT"
! #define CMD_CPRIVMSG "CPRIVMSG"
! #define CMD_CREATE "CREATE"
! #define CMD_DESTRUCT "DESTRUCT"
! #define CMD_DESYNCH "DESYNCH"
! #define CMD_DIE "DIE"
! #define CMD_DNS "DNS"
! #define CMD_EOB "END_OF_BURST"
! #define CMD_EOB_ACK "EOB_ACK"
! #define CMD_ERROR "ERROR"
! #define CMD_GLINE "GLINE"
! #define CMD_HASH "HASH"
! #define CMD_HELP "HELP"
! #define CMD_INFO "INFO"
! #define CMD_INVITE "INVITE"
! #define CMD_ISON "ISON"
! #define CMD_JOIN "JOIN"
! #define CMD_JUPE "JUPE"
! #define CMD_KICK "KICK"
! #define CMD_KILL "KILL"
! #define CMD_LINKS "LINKS"
! #define CMD_LIST "LIST"
! #define CMD_LUSERS "LUSERS"
! #define CMD_MAP "MAP"
! #define CMD_MODE "MODE"
! #define CMD_MOTD "MOTD"
! #define CMD_NAMES "NAMES"
! #define CMD_NICK "NICK"
! #define CMD_NOTICE "NOTICE"
! #define CMD_OPER "OPER"
! #define CMD_PART "PART"
! #define CMD_PASS "PASS"
! #define CMD_PING "PING"
! #define CMD_PONG "PONG"
! #define CMD_PRIVMSG "PRIVMSG"
! #define CMD_QUIT "QUIT"
! #define CMD_REHASH "REHASH"
! #define CMD_RESTART "RESTART"
! #define CMD_RPING "RPING"
! #define CMD_RPONG "RPONG"
! #define CMD_SERVER "SERVER"
! #define CMD_SERVLIST "SERVLIST"
! #define CMD_SERVSET "SERVSET"
! #define CMD_SETTIME "SETTIME"
! #define CMD_SILENCE "SILENCE"
! #define CMD_SQUERY "SQUERY"
! #define CMD_SQUIT "SQUIT"
! #define CMD_STATS "STATS"
! #define CMD_TIME "TIME"
! #define CMD_TOPIC "TOPIC"
! #define CMD_TRACE "TRACE"
! #define CMD_UPING "UPING"
! #define CMD_USER "USER"
! #define CMD_USERHOST "USERHOST"
! #define CMD_USERIP "USERIP"
! #define CMD_VERSION "VERSION"
! #define CMD_WALLCHOPS "WALLCHOPS"
! #define CMD_WALLOPS "WALLOPS"
! #define CMD_WHO "WHO"
! #define CMD_WHOIS "WHOIS"
! #define CMD_WHOWAS "WHOWAS"
!
! #define TOK_ACCOUNT "AC"
! #define TOK_ADMIN "AD"
! #define TOK_AWAY "A"
! #define TOK_BURST "B"
! #define TOK_CLOSE "CLOSE"
! #define TOK_CNOTICE "CN"
! #define TOK_CONNECT "CO"
! #define TOK_CPRIVMSG "CP"
! #define TOK_CREATE "C"
! #define TOK_DESTRUCT "DE"
! #define TOK_DESYNCH "DS"
! #define TOK_DIE "DIE"
! #define TOK_DNS "DNS"
! #define TOK_EOB "EB"
! #define TOK_EOB_ACK "EA"
! #define TOK_ERROR "Y"
! #define TOK_GLINE "GL"
! #define TOK_HASH "HASH"
! #define TOK_HELP "HELP"
! #define TOK_INFO "F"
! #define TOK_INVITE "I"
! #define TOK_ISON "ISON"
! #define TOK_JOIN "J"
! #define TOK_JUPE "JU"
! #define TOK_KICK "K"
! #define TOK_KILL "D"
! #define TOK_LINKS "LI"
! #define TOK_LIST "LIST"
! #define TOK_LUSERS "LU"
! #define TOK_MAP "MAP"
! #define TOK_MODE "M"
! #define TOK_MOTD "MO"
! #define TOK_NAMES "E"
! #define TOK_NICK "N"
! #define TOK_NOTICE "O"
! #define TOK_OPER "OPER"
! #define TOK_PART "L"
! #define TOK_PASS "PASS"
! #define TOK_PING "G"
! #define TOK_PONG "Z"
! #define TOK_PRIVMSG "P"
! #define TOK_QUIT "Q"
! #define TOK_REHASH "REHASH"
! #define TOK_RESTART "RESTART"
! #define TOK_RPING "RI"
! #define TOK_RPONG "RO"
! #define TOK_SERVER "S"
! #define TOK_SERVLIST "SERVLIST"
! #define TOK_SERVSET "SERVSET"
! #define TOK_SETTIME "SE"
! #define TOK_SILENCE "U"
! #define TOK_SQUERY "SQUERY"
! #define TOK_SQUIT "SQ"
! #define TOK_STATS "R"
! #define TOK_TIME "TI"
! #define TOK_TOPIC "T"
! #define TOK_TRACE "TR"
! #define TOK_UPING "UPING"
! #define TOK_USER "USER"
! #define TOK_USERHOST "USERHOST"
! #define TOK_USERIP "USERIP"
! #define TOK_VERSION "V"
! #define TOK_WALLCHOPS "WC"
! #define TOK_WALLOPS "WA"
! #define TOK_WHO "H"
! #define TOK_WHOIS "W"
! #define TOK_WHOWAS "X"
/* Servers claiming to have a boot or link time before PREHISTORY
--- 21,348 ----
#include "proto-common.c"
! /* Protocol messages; aliased to full commands or tokens depending
! on compile-time configuration. ircu 2.10.11 requires tokens
! WITH THE EXCEPTION OF THE FOLLOWING:
! PASS
! SERVER
!
! For some reason, ircu 2.10.11 does not parse the tokenized forms
! of these commands.
! */
! #ifdef ENABLE_TOKENS
! #define P10_ACCOUNT TOK_ACCOUNT
! #define P10_ADMIN TOK_ADMIN
! #define P10_ASLL TOK_ASLL
! #define P10_AWAY TOK_AWAY
! #define P10_BURST TOK_BURST
! #define P10_CLEARMODE TOK_CLEARMODE
! #define P10_CLOSE TOK_CLOSE
! #define P10_CNOTICE TOK_CNOTICE
! #define P10_CONNECT TOK_CONNECT
! #define P10_CPRIVMSG TOK_CPRIVMSG
! #define P10_CREATE TOK_CREATE
! #define P10_DESTRUCT TOK_DESTRUCT
! #define P10_DESYNCH TOK_DESYNCH
! #define P10_DIE TOK_DIE
! #define P10_DNS TOK_DNS
! #define P10_EOB TOK_EOB
! #define P10_EOB_ACK TOK_EOB_ACK
! #define P10_ERROR TOK_ERROR
! #define P10_GET TOK_GET
! #define P10_GLINE TOK_GLINE
! #define P10_HASH TOK_HASH
! #define P10_HELP TOK_HELP
! #define P10_INFO TOK_INFO
! #define P10_INVITE TOK_INVITE
! #define P10_ISON TOK_ISON
! #define P10_JOIN TOK_JOIN
! #define P10_JUPE TOK_JUPE
! #define P10_KICK TOK_KICK
! #define P10_KILL TOK_KILL
! #define P10_LINKS TOK_LINKS
! #define P10_LIST TOK_LIST
! #define P10_LUSERS TOK_LUSERS
! #define P10_MAP TOK_MAP
! #define P10_MODE TOK_MODE
! #define P10_MOTD TOK_MOTD
! #define P10_NAMES TOK_NAMES
! #define P10_NICK TOK_NICK
! #define P10_NOTICE TOK_NOTICE
! #define P10_OPER TOK_OPER
! #define P10_OPMODE TOK_OPMODE
! #define P10_PART TOK_PART
! #define P10_PASS CMD_PASS
! #define P10_PING TOK_PING
! #define P10_PONG TOK_PONG
! #define P10_POST TOK_POST
! #define P10_PRIVMSG TOK_PRIVMSG
! #define P10_PRIVS TOK_PRIVS
! #define P10_PROTO TOK_PROTO
! #define P10_QUIT TOK_QUIT
! #define P10_REHASH TOK_REHASH
! #define P10_RESET TOK_RESET
! #define P10_RESTART TOK_RESTART
! #define P10_RPING TOK_RPING
! #define P10_RPONG TOK_RPONG
! #define P10_SERVER CMD_SERVER
! #define P10_SERVLIST TOK_SERVLIST
! #define P10_SERVSET TOK_SERVSET
! #define P10_SET TOK_SET
! #define P10_SETTIME TOK_SETTIME
! #define P10_SILENCE TOK_SILENCE
! #define P10_SQUERY TOK_SQUERY
! #define P10_SQUIT TOK_SQUIT
! #define P10_STATS TOK_STATS
! #define P10_TIME TOK_TIME
! #define P10_TOPIC TOK_TOPIC
! #define P10_TRACE TOK_TRACE
! #define P10_UPING TOK_UPING
! #define P10_USER TOK_USER
! #define P10_USERHOST TOK_USERHOST
! #define P10_USERIP TOK_USERIP
! #define P10_VERSION TOK_VERSION
! #define P10_WALLCHOPS TOK_WALLCHOPS
! #define P10_WALLOPS TOK_WALLOPS
! #define P10_WALLUSERS TOK_WALLUSERS
! #define P10_WHO TOK_WHO
! #define P10_WHOIS TOK_WHOIS
! #define P10_WHOWAS TOK_WHOWAS
! #else /* !ENABLE_TOKENS */
! #define P10_ACCOUNT CMD_ACCOUNT
! #define P10_ADMIN CMD_ADMIN
! #define P10_ASLL CMD_ASLL
! #define P10_AWAY CMD_AWAY
! #define P10_BURST CMD_BURST
! #define P10_CLEARMODE CMD_CLEARMODE
! #define P10_CLOSE CMD_CLOSE
! #define P10_CNOTICE CMD_CNOTICE
! #define P10_CONNECT CMD_CONNECT
! #define P10_CPRIVMSG CMD_CPRIVMSG
! #define P10_CREATE CMD_CREATE
! #define P10_DESTRUCT CMD_DESTRUCT
! #define P10_DESYNCH CMD_DESYNCH
! #define P10_DIE CMD_DIE
! #define P10_DNS CMD_DNS
! #define P10_EOB CMD_EOB
! #define P10_EOB_ACK CMD_EOB_ACK
! #define P10_ERROR CMD_ERROR
! #define P10_GET CMD_GET
! #define P10_GLINE CMD_GLINE
! #define P10_HASH CMD_HASH
! #define P10_HELP CMD_HELP
! #define P10_INFO CMD_INFO
! #define P10_INVITE CMD_INVITE
! #define P10_ISON CMD_ISON
! #define P10_JOIN CMD_JOIN
! #define P10_JUPE CMD_JUPE
! #define P10_KICK CMD_KICK
! #define P10_KILL CMD_KILL
! #define P10_LINKS CMD_LINKS
! #define P10_LIST CMD_LIST
! #define P10_LUSERS CMD_LUSERS
! #define P10_MAP CMD_MAP
! #define P10_MODE CMD_MODE
! #define P10_MOTD CMD_MOTD
! #define P10_NAMES CMD_NAMES
! #define P10_NICK CMD_NICK
! #define P10_NOTICE CMD_NOTICE
! #define P10_OPER CMD_OPER
! #define P10_OPMODE CMD_OPMODE
! #define P10_PART CMD_PART
! #define P10_PASS CMD_PASS
! #define P10_PING CMD_PING
! #define P10_PONG CMD_PONG
! #define P10_POST CMD_POST
! #define P10_PRIVMSG CMD_PRIVMSG
! #define P10_PRIVS CMD_PRIVS
! #define P10_PROTO CMD_PROTO
! #define P10_QUIT CMD_QUIT
! #define P10_REHASH CMD_REHASH
! #define P10_RESET CMD_RESET
! #define P10_RESTART CMD_RESTART
! #define P10_RPING CMD_RPING
! #define P10_RPONG CMD_RPONG
! #define P10_SERVER CMD_SERVER
! #define P10_SERVLIST CMD_SERVLIST
! #define P10_SERVSET CMD_SERVSET
! #define P10_SET CMD_SET
! #define P10_SETTIME CMD_SETTIME
! #define P10_SILENCE CMD_SILENCE
! #define P10_SQUERY CMD_SQUERY
! #define P10_SQUIT CMD_SQUIT
! #define P10_STATS CMD_STATS
! #define P10_TIME CMD_TIME
! #define P10_TOPIC CMD_TOPIC
! #define P10_TRACE CMD_TRACE
! #define P10_UPING CMD_UPING
! #define P10_USER CMD_USER
! #define P10_USERHOST CMD_USERHOST
! #define P10_USERIP CMD_USERIP
! #define P10_VERSION CMD_VERSION
! #define P10_WALLCHOPS CMD_WALLCHOPS
! #define P10_WALLOPS CMD_WALLOPS
! #define P10_WALLUSERS CMD_WALLUSERS
! #define P10_WHO CMD_WHO
! #define P10_WHOIS CMD_WHOIS
! #define P10_WHOWAS CMD_WHOWAS
! #endif /* ENABLE_TOKENS */
!
! /* Full commands. */
! #define CMD_ACCOUNT "ACCOUNT"
! #define CMD_ADMIN "ADMIN"
! #define CMD_ASLL "ASLL"
! #define CMD_AWAY "AWAY"
! #define CMD_BURST "BURST"
! #define CMD_CLEARMODE "CLEARMODE"
! #define CMD_CLOSE "CLOSE"
! #define CMD_CNOTICE "CNOTICE"
! #define CMD_CONNECT "CONNECT"
! #define CMD_CPRIVMSG "CPRIVMSG"
! #define CMD_CREATE "CREATE"
! #define CMD_DESTRUCT "DESTRUCT"
! #define CMD_DESYNCH "DESYNCH"
! #define CMD_DIE "DIE"
! #define CMD_DNS "DNS"
! #define CMD_EOB "END_OF_BURST"
! #define CMD_EOB_ACK "EOB_ACK"
! #define CMD_ERROR "ERROR"
! #define CMD_GET "GET"
! #define CMD_GLINE "GLINE"
! #define CMD_HASH "HASH"
! #define CMD_HELP "HELP"
! #define CMD_INFO "INFO"
! #define CMD_INVITE "INVITE"
! #define CMD_ISON "ISON"
! #define CMD_JOIN "JOIN"
! #define CMD_JUPE "JUPE"
! #define CMD_KICK "KICK"
! #define CMD_KILL "KILL"
! #define CMD_LINKS "LINKS"
! #define CMD_LIST "LIST"
! #define CMD_LUSERS "LUSERS"
! #define CMD_MAP "MAP"
! #define CMD_MODE "MODE"
! #define CMD_MOTD "MOTD"
! #define CMD_NAMES "NAMES"
! #define CMD_NICK "NICK"
! #define CMD_NOTICE "NOTICE"
! #define CMD_OPER "OPER"
! #define CMD_OPMODE "OPMODE"
! #define CMD_PART "PART"
! #define CMD_PASS "PASS"
! #define CMD_PING "PING"
! #define CMD_PONG "PONG"
! #define CMD_POST "POST"
! #define CMD_PRIVMSG "PRIVMSG"
! #define CMD_PRIVS "PRIVS"
! #define CMD_PROTO "PROTO"
! #define CMD_QUIT "QUIT"
! #define CMD_REHASH "REHASH"
! #define CMD_RESET "RESET"
! #define CMD_RESTART "RESTART"
! #define CMD_RPING "RPING"
! #define CMD_RPONG "RPONG"
! #define CMD_SERVER "SERVER"
! #define CMD_SERVLIST "SERVLIST"
! #define CMD_SERVSET "SERVSET"
! #define CMD_SET "SET"
! #define CMD_SETTIME "SETTIME"
! #define CMD_SILENCE "SILENCE"
! #define CMD_SQUERY "SQUERY"
! #define CMD_SQUIT "SQUIT"
! #define CMD_STATS "STATS"
! #define CMD_TIME "TIME"
! #define CMD_TOPIC "TOPIC"
! #define CMD_TRACE "TRACE"
! #define CMD_UPING "UPING"
! #define CMD_USER "USER"
! #define CMD_USERHOST "USERHOST"
! #define CMD_USERIP "USERIP"
! #define CMD_VERSION "VERSION"
! #define CMD_WALLCHOPS "WALLCHOPS"
! #define CMD_WALLOPS "WALLOPS"
! #define CMD_WALLUSERS "WALLUSERS"
! #define CMD_WHO "WHO"
! #define CMD_WHOIS "WHOIS"
! #define CMD_WHOWAS "WHOWAS"
!
! /* Tokenized commands. */
! #define TOK_ACCOUNT "AC"
! #define TOK_ADMIN "AD"
! #define TOK_ASLL "LL"
! #define TOK_AWAY "A"
! #define TOK_BURST "B"
! #define TOK_CLEARMODE "CM"
! #define TOK_CLOSE "CLOSE"
! #define TOK_CNOTICE "CN"
! #define TOK_CONNECT "CO"
! #define TOK_CPRIVMSG "CP"
! #define TOK_CREATE "C"
! #define TOK_DESTRUCT "DE"
! #define TOK_DESYNCH "DS"
! #define TOK_DIE "DIE"
! #define TOK_DNS "DNS"
! #define TOK_EOB "EB"
! #define TOK_EOB_ACK "EA"
! #define TOK_ERROR "Y"
! #define TOK_GET "GET"
! #define TOK_GLINE "GL"
! #define TOK_HASH "HASH"
! #define TOK_HELP "HELP"
! #define TOK_INFO "F"
! #define TOK_INVITE "I"
! #define TOK_ISON "ISON"
! #define TOK_JOIN "J"
! #define TOK_JUPE "JU"
! #define TOK_KICK "K"
! #define TOK_KILL "D"
! #define TOK_LINKS "LI"
! #define TOK_LIST "LIST"
! #define TOK_LUSERS "LU"
! #define TOK_MAP "MAP"
! #define TOK_MODE "M"
! #define TOK_MOTD "MO"
! #define TOK_NAMES "E"
! #define TOK_NICK "N"
! #define TOK_NOTICE "O"
! #define TOK_OPER "OPER"
! #define TOK_OPMODE "OM"
! #define TOK_PART "L"
! #define TOK_PASS "PA"
! #define TOK_PING "G"
! #define TOK_PONG "Z"
! #define TOK_POST "POST"
! #define TOK_PRIVMSG "P"
! #define TOK_PRIVS "PRIVS"
! #define TOK_PROTO "PROTO"
! #define TOK_QUIT "Q"
! #define TOK_REHASH "REHASH"
! #define TOK_RESET "RESET"
! #define TOK_RESTART "RESTART"
! #define TOK_RPING "RI"
! #define TOK_RPONG "RO"
! #define TOK_SERVER "S"
! #define TOK_SERVLIST "SERVSET"
! #define TOK_SERVSET "SERVSET"
! #define TOK_SET "SET"
! #define TOK_SETTIME "SE"
! #define TOK_SILENCE "U"
! #define TOK_SQUERY "SQUERY"
! #define TOK_SQUIT "SQ"
! #define TOK_STATS "R"
! #define TOK_TIME "TI"
! #define TOK_TOPIC "T"
! #define TOK_TRACE "TR"
! #define TOK_UPING "UP"
! #define TOK_USER "USER"
! #define TOK_USERHOST "USERHOST"
! #define TOK_USERIP "USERIP"
! #define TOK_VERSION "V"
! #define TOK_WALLCHOPS "WC"
! #define TOK_WALLOPS "WA"
! #define TOK_WALLUSERS "WU"
! #define TOK_WHO "H"
! #define TOK_WHOIS "W"
! #define TOK_WHOWAS "X"
/* Servers claiming to have a boot or link time before PREHISTORY
***************
*** 247,255 ****
if (srv == self) {
/* The +s, ignored by Run's ircu, means "service" to Undernet's ircu */
! putsock("%s %s %d %li %li J10 %s%s +s :%s",
! CMD_SERVER, srv->name, srv->hops+1, srv->boot, srv->link, srv->numeric, extranum, srv->description);
} else {
! putsock("%s %s %s %d %li %li %c10 %s%s +s :%s",
! self->numeric, CMD_SERVER, srv->name, srv->hops+1, srv->boot, srv->link, (srv->self_burst ? 'J' : 'P'), srv->numeric, extranum, srv->description);
}
}
--- 436,444 ----
if (srv == self) {
/* The +s, ignored by Run's ircu, means "service" to Undernet's ircu */
! putsock(P10_SERVER " %s %d %li %li J10 %s%s +s :%s",
! srv->name, srv->hops+1, srv->boot, srv->link, srv->numeric, extranum, srv->description);
} else {
! putsock("%s " P10_SERVER " %s %d %li %li %c10 %s%s +s :%s",
! self->numeric, srv->name, srv->hops+1, srv->boot, srv->link, (srv->self_burst ? 'J' : 'P'), srv->numeric, extranum, srv->description);
}
}
***************
*** 275,283 ****
/* we don't need to put the + in modes because it's in the format string. */
! putsock("%s %s %s %d %li %s %s +%s %s %s :%s",
! user->uplink->numeric, CMD_NICK, user->nick, user->uplink->hops+1, user->timestamp, user->ident, user->hostname, modes, b64ip, user->numeric, user->info);
} else {
! putsock("%s %s %s %d %li %s %s %s %s :%s",
! user->uplink->numeric, CMD_NICK, user->nick, user->uplink->hops+1, user->timestamp, user->ident, user->hostname, b64ip, user->numeric, user->info);
}
}
--- 464,472 ----
/* we don't need to put the + in modes because it's in the format string. */
! putsock("%s " P10_NICK " %s %d %li %s %s +%s %s %s :%s",
! user->uplink->numeric, user->nick, user->uplink->hops+1, user->timestamp, user->ident, user->hostname, modes, b64ip, user->numeric, user->info);
} else {
! putsock("%s " P10_NICK " %s %d %li %s %s %s %s :%s",
! user->uplink->numeric, user->nick, user->uplink->hops+1, user->timestamp, user->ident, user->hostname, b64ip, user->numeric, user->info);
}
}
***************
*** 286,290 ****
irc_account(struct userNode *user, const char *stamp)
{
! putsock("%s %s %s %s", self->numeric, CMD_ACCOUNT, user->numeric, stamp);
}
--- 475,479 ----
irc_account(struct userNode *user, const char *stamp)
{
! putsock("%s " P10_ACCOUNT " %s %s", self->numeric, user->numeric, stamp);
}
***************
*** 292,296 ****
irc_nick(struct userNode *user, const char *new_nick)
{
! putsock("%s %s %s "FMT_TIME_T, user->numeric, CMD_NICK, new_nick, now);
}
--- 481,485 ----
irc_nick(struct userNode *user, const char *new_nick)
{
! putsock("%s " P10_NICK " %s "FMT_TIME_T, user->numeric, new_nick, now);
}
***************
*** 299,303 ****
{
if (!from || !to) return;
! putsock("%s %s %s", from->numeric, CMD_TOPIC, to);
}
--- 488,492 ----
{
if (!from || !to) return;
! putsock("%s " P10_TOPIC " %s", from->numeric, to);
}
***************
*** 318,322 ****
}
! putsock("%s %s %s %d :%s", self->numeric, CMD_SQUIT, srv->name, 0, message);
if (srv == self) {
--- 507,511 ----
}
! putsock("%s " P10_SQUIT " %s %d :%s", self->numeric, srv->name, 0, message);
if (srv == self) {
***************
*** 331,335 ****
irc_wallchops(struct userNode *from, const char *to, const char *message)
{
! putsock("%s %s %s :%s", from->numeric, CMD_WALLCHOPS, to, message);
}
--- 520,524 ----
irc_wallchops(struct userNode *from, const char *to, const char *message)
{
! putsock("%s " P10_WALLCHOPS " %s :%s", from->numeric, to, message);
}
***************
*** 337,341 ****
irc_notice(struct userNode *from, const char *to, const char *message)
{
! putsock("%s %s %s :%s", from->numeric, CMD_NOTICE, to, message);
}
--- 526,530 ----
irc_notice(struct userNode *from, const char *to, const char *message)
{
! putsock("%s " P10_NOTICE " %s :%s", from->numeric, to, message);
}
***************
*** 343,347 ****
irc_privmsg(struct userNode *from, const char *to, const char *message)
{
! putsock("%s %s %s :%s", from->numeric, CMD_PRIVMSG, to, message);
}
--- 532,536 ----
irc_privmsg(struct userNode *from, const char *to, const char *message)
{
! putsock("%s " P10_PRIVMSG " %s :%s", from->numeric, to, message);
}
***************
*** 349,353 ****
irc_eob(void)
{
! putsock("%s %s", self->numeric, CMD_EOB);
}
--- 538,542 ----
irc_eob(void)
{
! putsock("%s " P10_EOB, self->numeric);
}
***************
*** 355,365 ****
irc_eob_ack(void)
{
! putsock("%s %s", self->numeric, CMD_EOB_ACK);
}
void
! irc_ping(const char *something)
{
! putsock("%s %s :%s", self->numeric, CMD_PING, something);
}
--- 544,554 ----
irc_eob_ack(void)
{
! putsock("%s " P10_EOB_ACK, self->numeric);
}
void
! irc_ping(const char *payload)
{
! putsock("%s " P10_PING " :%s", self->numeric, payload);
}
***************
*** 367,371 ****
irc_pong(const char *who, const char *data)
{
! putsock("%s %s %s :%s", self->numeric, CMD_PONG, who, data);
}
--- 556,560 ----
irc_pong(const char *who, const char *data)
{
! putsock("%s " P10_PONG " %s :%s", self->numeric, who, data);
}
***************
*** 373,377 ****
irc_pass(const char *passwd)
{
! putsock("PASS :%s", passwd);
}
--- 562,566 ----
irc_pass(const char *passwd)
{
! putsock(P10_PASS " :%s", passwd);
}
***************
*** 393,397 ****
irc_gline(struct server *srv, struct gline *gline)
{
! putsock("%s %s %s +%s %ld :%s", self->numeric, CMD_GLINE, (srv ? srv->numeric : "*"), gline->target, gline->expires-now, gline->reason);
}
--- 582,587 ----
irc_gline(struct server *srv, struct gline *gline)
{
! putsock("%s " P10_GLINE " %s +%s %ld :%s",
! self->numeric, (srv ? srv->numeric : "*"), gline->target, gline->expires-now, gline->reason);
}
***************
*** 399,403 ****
irc_ungline(const char *mask)
{
! putsock("%s %s * -%s", self->numeric, CMD_GLINE, mask);
}
--- 589,593 ----
irc_ungline(const char *mask)
{
! putsock("%s " P10_GLINE " * -%s", self->numeric, mask);
}
***************
*** 436,440 ****
unsigned int n;
! base_len = sprintf(burst_line, "%s %s %s " FMT_TIME_T " ", self->numeric, CMD_BURST, chan->name, chan->timestamp);
len = irc_make_chanmode(chan, burst_line+base_len);
pos = base_len + len - 1;
--- 626,631 ----
unsigned int n;
! base_len = sprintf(burst_line, "%s " P10_BURST " %s " FMT_TIME_T " ",
! self->numeric, chan->name, chan->timestamp);
len = irc_make_chanmode(chan, burst_line+base_len);
pos = base_len + len - 1;
***************
*** 494,498 ****
irc_quit(struct userNode *user, const char *message)
{
! putsock("%s %s :%s", user->numeric, CMD_QUIT, message);
}
--- 685,689 ----
irc_quit(struct userNode *user, const char *message)
{
! putsock("%s " P10_QUIT " :%s", user->numeric, message);
}
***************
*** 501,507 ****
{
if (to) {
! putsock("%s %s :%s", to, CMD_ERROR, message);
} else {
! putsock(":%s %s :%s", self->name, CMD_ERROR, message);
}
}
--- 692,698 ----
{
if (to) {
! putsock("%s " P10_ERROR " :%s", to, message);
} else {
! putsock(":%s " P10_ERROR " :%s", self->name, message);
}
}
***************
*** 511,517 ****
{
if (from) {
! putsock("%s %s %s :%s!%s (%s)", from->numeric, CMD_KILL, target->numeric, self->name, from->nick, message);
} else {
! putsock("%s %s %s :%s (%s)", self->numeric, CMD_KILL, target->numeric, self->name, message);
}
}
--- 702,710 ----
{
if (from) {
! putsock("%s " P10_KILL " %s :%s!%s (%s)",
! from->numeric, target->numeric, self->name, from->nick, message);
} else {
! putsock("%s " P10_KILL " %s :%s (%s)",
! self->numeric, target->numeric, self->name, message);
}
}
***************
*** 527,531 ****
numeric = self->numeric;
}
! putsock("%s %s %s %s "FMT_TIME_T, numeric, CMD_MODE, target->name, modes, target->timestamp);
}
--- 720,725 ----
numeric = self->numeric;
}
! putsock("%s " P10_MODE " %s %s "FMT_TIME_T,
! numeric, target->name, modes, target->timestamp);
}
***************
*** 533,537 ****
irc_invite(struct userNode *from, struct userNode *who, struct chanNode *to)
{
! putsock("%s %s %s %s", from->numeric, CMD_INVITE, who->nick, to->name);
}
--- 727,731 ----
irc_invite(struct userNode *from, struct userNode *who, struct chanNode *to)
{
! putsock("%s " P10_INVITE " %s %s", from->numeric, who->nick, to->name);
}
***************
*** 540,546 ****
{
if (what->members.used == 1) {
! putsock("%s %s %s %lu", who->numeric, CMD_CREATE, what->name, what->timestamp);
} else {
! putsock("%s %s %s", who->numeric, CMD_JOIN, what->name);
}
}
--- 734,741 ----
{
if (what->members.used == 1) {
! putsock("%s " P10_CREATE " %s %lu",
! who->numeric, what->name, what->timestamp);
} else {
! putsock("%s " P10_JOIN " %s", who->numeric, what->name);
}
}
***************
*** 552,556 ****
struct modeNode *mn = GetUserMode(channel, who);
numeric = (mn && (mn->modes & MODE_CHANOP)) ? who->numeric : self->numeric;
! putsock("%s %s %s %s :%s", numeric, CMD_KICK, channel->name, target->numeric, msg);
}
--- 747,752 ----
struct modeNode *mn = GetUserMode(channel, who);
numeric = (mn && (mn->modes & MODE_CHANOP)) ? who->numeric : self->numeric;
! putsock("%s " P10_KICK " %s %s :%s",
! numeric, channel->name, target->numeric, msg);
}
***************
*** 558,562 ****
irc_stats(struct userNode *from, struct server *target, char type)
{
! putsock("%s %s %c :%s", from->numeric, CMD_STATS, type, target->numeric);
}
--- 754,758 ----
irc_stats(struct userNode *from, struct server *target, char type)
{
! putsock("%s " P10_STATS " %c :%s", from->numeric, type, target->numeric);
}
***************
*** 565,571 ****
{
if (reason) {
! putsock("%s %s %s :%s", who->numeric, CMD_PART, what->name, reason);
} else {
! putsock("%s %s %s", who->numeric, CMD_PART, what->name);
}
}
--- 761,767 ----
{
if (reason) {
! putsock("%s " P10_PART " %s :%s", who->numeric, what->name, reason);
} else {
! putsock("%s " P10_PART " %s", who->numeric, what->name);
}
}
***************
*** 574,578 ****
irc_topic(struct userNode *who, struct chanNode *what, const char *topic)
{
! putsock("%s %s %s :%s", who->numeric, CMD_TOPIC, what->name, topic);
}
--- 770,774 ----
irc_topic(struct userNode *who, struct chanNode *what, const char *topic)
{
! putsock("%s " P10_TOPIC " %s :%s", who->numeric, what->name, topic);
}
|
|
From: Zoot <zo...@us...> - 2002-08-13 21:17:45
|
Update of /cvsroot/srvx/services In directory usw-pr-cvs1:/tmp/cvs-serv24600 Modified Files: configure.in Log Message: Make tokenized P10 protocol output an option; merge in new commands from ircu 2.10.11. Index: configure.in =================================================================== RCS file: /cvsroot/srvx/services/configure.in,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -r1.54 -r1.55 *** configure.in 11 Aug 2002 03:26:16 -0000 1.54 --- configure.in 13 Aug 2002 21:17:25 -0000 1.55 *************** *** 242,245 **** --- 242,257 ---- fi]) + AC_MSG_CHECKING(whether to enable tokenization) + AC_ARG_ENABLE(tokens, + [ --enable-tokens Enables tokenization of P10 protocol output + (required when linking to ircu 2.10.11)], + [ + AC_DEFINE(ENABLE_TOKENS, 1, [Define if tokenized P10 desired]) + AC_MSG_RESULT(yes) + ], + [ + AC_MSG_RESULT(no) + ]) + AC_MSG_CHECKING(whether to enable debug behaviors) AC_ARG_ENABLE(debug, |
|
From: Adrian D. <sai...@us...> - 2002-08-13 03:04:13
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv32127
Modified Files:
hash.h helpserv.c nickserv.c proto-bahamut.c proto-p10.c
proto.h
Log Message:
Remove now-invalid IsNickName from hash.h
Have HelpServ check bots nicks against the per-proto is_valid_nick()
Have HelpServ check the result of creating its user
Rename nickserv.c:is_valid_nick to is_registerable_nick, and have it check the per-proto is_valid_nick()
Make per-proto is_valid_nick() an exported function
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.86
retrieving revision 1.87
diff -C2 -r1.86 -r1.87
*** hash.h 11 Aug 2002 03:26:16 -0000 1.86
--- hash.h 13 Aug 2002 03:04:07 -0000 1.87
***************
*** 186,194 ****
void reg_server_link_func(server_link_func_t handler);
- #define IsNickName(x) ( \
- (isalpha(*(x)) || \
- ((*(x) >= 0x5B) && (*(x) <= 0x60)) || \
- ((*(x) >= 0x7B) && (*(x) <= 0x7D))) && \
- !strcspn((x)+1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789[]\\`_^{|}"))
typedef int (*new_user_func_t) (struct userNode *user);
void reg_new_user_func(new_user_func_t handler);
--- 186,189 ----
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** helpserv.c 11 Aug 2002 03:26:16 -0000 1.23
--- helpserv.c 13 Aug 2002 03:04:07 -0000 1.24
***************
*** 142,145 ****
--- 142,146 ----
#define HSMSG_REG_SUCCESS "%s now has ownership of bot %s."
#define HSMSG_NEED_UNREG_CONFIRM "To unregister this bot, you must /msg $S unregister CONFIRM"
+ #define HSMSG_ERROR_ADDING_SERVICE "Error creating new user $b%s$b"
/* Rename */
***************
*** 1754,1758 ****
REQUIRE_PARMS(2);
! if (IsNickName(argv[1])) {
char *newnick = argv[1], *oldnick, *reason;
--- 1755,1759 ----
REQUIRE_PARMS(2);
! if (is_valid_nick(argv[1])) {
char *newnick = argv[1], *oldnick, *reason;
***************
*** 2109,2113 ****
hs = calloc(1, sizeof(struct helpserv_bot));
! hs->helpserv = AddService(nick, helpserv_conf.description);
reg_privmsg_func(hs->helpserv, helpserv_botmsg);
--- 2110,2118 ----
hs = calloc(1, sizeof(struct helpserv_bot));
! if (!(hs->helpserv = AddService(nick, helpserv_conf.description))) {
! free(hs);
! return NULL;
! }
!
reg_privmsg_func(hs->helpserv, helpserv_botmsg);
***************
*** 2151,2155 ****
REQUIRE_PARMS(4);
nick = argv[1];
! if (!IsNickName(nick)) {
helpserv_notice(user, HSMSG_ILLEGAL_NICK, nick);
return 0;
--- 2156,2160 ----
REQUIRE_PARMS(4);
nick = argv[1];
! if (!is_valid_nick(nick)) {
helpserv_notice(user, HSMSG_ILLEGAL_NICK, nick);
return 0;
***************
*** 2171,2175 ****
if (!(handle = helpserv_get_handle_info(user, argv[3]))) return 0;
! hs = register_helpserv(nick, helpchan, user->handle_info->handle);
hs->registered = now;
helpserv_add_user(hs, handle, HlOwner);
--- 2176,2184 ----
if (!(handle = helpserv_get_handle_info(user, argv[3]))) return 0;
! if (!(hs = register_helpserv(nick, helpchan, user->handle_info->handle))) {
! helpserv_notice(user, HSMSG_ERROR_ADDING_SERVICE, nick);
! return 0;
! }
!
hs->registered = now;
helpserv_add_user(hs, handle, HlOwner);
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.194
retrieving revision 1.195
diff -C2 -r1.194 -r1.195
*** nickserv.c 11 Aug 2002 03:26:16 -0000 1.194
--- nickserv.c 13 Aug 2002 03:04:07 -0000 1.195
***************
*** 531,537 ****
static int
! is_valid_nick(const char *nick)
{
struct userNode *user;
/* cant register a juped nick/service nick.. client could kill it. */
user = GetUserH(nick);
--- 531,539 ----
static int
! is_registerable_nick(const char *nick)
{
struct userNode *user;
+ /* first, check that the nick is acceptible by the server */
+ if (!is_valid_nick(nick)) return 0;
/* cant register a juped nick/service nick.. client could kill it. */
user = GetUserH(nick);
***************
*** 1553,1557 ****
if (is_valid_oper(user, 0, 1)) {
nick = (argc < 2) ? user->nick : (char*)argv[1];
! if (!is_valid_nick(nick)) {
nickserv_notice(user, NSMSG_BAD_NICK, nick);
return 0;
--- 1555,1559 ----
if (is_valid_oper(user, 0, 1)) {
nick = (argc < 2) ? user->nick : (char*)argv[1];
! if (!is_registerable_nick(nick)) {
nickserv_notice(user, NSMSG_BAD_NICK, nick);
return 0;
***************
*** 1568,1572 ****
} else {
nick = user->nick;
! if (!is_valid_nick(nick)) {
nickserv_notice(user, NSMSG_BAD_NICK, nick);
return 0;
--- 1570,1574 ----
} else {
nick = user->nick;
! if (!is_registerable_nick(nick)) {
nickserv_notice(user, NSMSG_BAD_NICK, nick);
return 0;
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** proto-bahamut.c 8 Aug 2002 02:15:58 -0000 1.13
--- proto-bahamut.c 13 Aug 2002 03:04:07 -0000 1.14
***************
*** 94,98 ****
}
! static int
is_valid_nick(const unsigned char *nick) {
/* IRC has some of The Most Fucked-Up ideas about character sets
--- 94,98 ----
}
! int
is_valid_nick(const unsigned char *nick) {
/* IRC has some of The Most Fucked-Up ideas about character sets
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** proto-p10.c 10 Aug 2002 00:49:04 -0000 1.15
--- proto-p10.c 13 Aug 2002 03:04:07 -0000 1.16
***************
*** 1544,1548 ****
}
! static int
is_valid_nick(const unsigned char *nick) {
/* IRC has some of The Most Fucked-Up ideas about character sets
--- 1544,1548 ----
}
! int
is_valid_nick(const unsigned char *nick) {
/* IRC has some of The Most Fucked-Up ideas about character sets
Index: proto.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -r1.59 -r1.60
*** proto.h 8 Aug 2002 02:15:58 -0000 1.59
--- proto.h 13 Aug 2002 03:04:07 -0000 1.60
***************
*** 164,167 ****
--- 164,168 ----
/* stuff originally from other headers that is really protocol-specific */
+ int is_valid_nick(const unsigned char *nick);
struct userNode *AddService(const char *nick, const char *desc);
struct userNode *AddClone(const char *nick, const char *ident, const char *hostname, const char *desc);
|
|
From: Entrope <en...@us...> - 2002-08-13 01:13:40
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv6749/src Added Files: mod-snoop.c modules.c modules.h Log Message: add the compile-time module code that should have been in the last commit ***** Error reading new file: [Errno 2] No such file or directory: 'mod-snoop.c' |
|
From: Entrope <en...@us...> - 2002-08-11 03:26:24
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv8293/src
Modified Files:
sockcheck.c opserv.c nickserv.c mini-tools.c main.c helpserv.c
hash.h global.c conf.c compat.h chanserv.c Makefile.am
Log Message:
add configure --with-modules option (and sample module, for arcnet's use)
require automake-1.5 or higher (to make --with-modules and $(OBJEXT) work sanely)
make kick_func callbacks return void, not int
make conf_register_reload() call the config re(lo)ad function
add split_line() to mini-tools.c
make valid_user_for() remove allowauth from dict itself
Index: sockcheck.c
===================================================================
RCS file: /cvsroot/srvx/services/src/sockcheck.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -C2 -r1.74 -r1.75
*** sockcheck.c 30 Jul 2002 02:15:11 -0000 1.74
--- sockcheck.c 11 Aug 2002 03:26:15 -0000 1.75
***************
*** 1080,1084 ****
{
conf_register_reload(sockcheck_read_conf);
- sockcheck_read_conf();
reg_exit_func(sockcheck_shutdown);
_sockcheck_init();
--- 1080,1083 ----
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.260
retrieving revision 1.261
diff -C2 -r1.260 -r1.261
*** opserv.c 5 Aug 2002 03:22:19 -0000 1.260
--- opserv.c 11 Aug 2002 03:26:16 -0000 1.261
***************
*** 4373,4377 ****
{
opserv = AddService(nick, "Oper Services");
- opserv_conf_read();
conf_register_reload(opserv_conf_read);
--- 4373,4376 ----
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.193
retrieving revision 1.194
diff -C2 -r1.193 -r1.194
*** nickserv.c 8 Aug 2002 02:15:58 -0000 1.193
--- nickserv.c 11 Aug 2002 03:26:16 -0000 1.194
***************
*** 647,650 ****
--- 647,651 ----
}
if (!res && (dict_find(nickserv_allow_auth_dict, user->nick, NULL) == hi)) {
+ dict_remove(nickserv_allow_auth_dict, user->nick);
res = 2;
}
***************
*** 1335,1344 ****
}
res = valid_user_for(user, hi);
! if (res == 0) {
nickserv_notice(user, NSMSG_HOSTMASK_INVALID, hi->handle);
log(NS_LOG, LOG_OTHER, IDENT_FORMAT" did not have a matching host for account '%s'.\n", IDENT_DATA(user), hi->handle);
return 0;
- } else if (res == 2) {
- dict_remove(nickserv_allow_auth_dict, user->nick);
}
if (!checkpass(passwd, hi->passwd)) {
--- 1336,1343 ----
}
res = valid_user_for(user, hi);
! if (!res) {
nickserv_notice(user, NSMSG_HOSTMASK_INVALID, hi->handle);
log(NS_LOG, LOG_OTHER, IDENT_FORMAT" did not have a matching host for account '%s'.\n", IDENT_DATA(user), hi->handle);
return 0;
}
if (!checkpass(passwd, hi->passwd)) {
***************
*** 3314,3318 ****
userList_init(&curr_helpers);
- conf_register_reload(nickserv_conf_read);
nickserv_service = service_register(nickserv, 0);
--- 3313,3316 ----
Index: mini-tools.c
===================================================================
RCS file: /cvsroot/srvx/services/src/mini-tools.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** mini-tools.c 30 Jul 2002 02:15:11 -0000 1.2
--- mini-tools.c 11 Aug 2002 03:26:16 -0000 1.3
***************
*** 26,29 ****
--- 26,56 ----
}
+ int
+ split_line(unsigned char *line, int irc_colon, int argv_size, unsigned char *argv[])
+ {
+ int argc = 0;
+ int n;
+ while (*line && (argc < argv_size)) {
+ while (*line == ' ') *line++ = 0;
+ if (*line == ':' && irc_colon && argc > 0) {
+ /* the rest is a single parameter */
+ argv[argc++] = line + 1;
+ break;
+ }
+ if (!*line) break;
+ argv[argc++] = line;
+ if (argc >= argv_size) break;
+ while (*line != ' ' && *line) line++;
+ }
+ #ifdef NDEBUG
+ n = 0;
+ #else
+ for (n=argc; n<argv_size; n++) {
+ argv[n] = (unsigned char*)0xFEEDBEEF;
+ }
+ #endif
+ return argc;
+ }
+
void
tools_init(void)
Index: main.c
===================================================================
RCS file: /cvsroot/srvx/services/src/main.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -C2 -r1.131 -r1.132
*** main.c 4 Aug 2002 21:12:57 -0000 1.131
--- main.c 11 Aug 2002 03:26:16 -0000 1.132
***************
*** 57,60 ****
--- 57,63 ----
#include "sockcheck.h"
#include "helpserv.h"
+ #ifdef EXTRA_MODULES
+ #include "modules.h"
+ #endif
extern FILE *replay_file;
***************
*** 753,757 ****
}
- uplink_compile();
conf_register_reload(uplink_compile);
--- 756,759 ----
***************
*** 796,799 ****
--- 798,804 ----
conf_globals();
conf_rlimits();
+ #ifdef EXTRA_MODULES
+ modules_init();
+ #endif
modcmd_finalize();
if (replay_file) log(MAIN_LOG, LOG_INFO, "Beginning replay...\n");
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** helpserv.c 5 Aug 2002 03:22:19 -0000 1.22
--- helpserv.c 11 Aug 2002 03:26:16 -0000 1.23
***************
*** 3677,3681 ****
helpserv_enabled = 1;
- helpserv_conf_read();
conf_register_reload(helpserv_conf_read);
--- 3677,3680 ----
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.85
retrieving revision 1.86
diff -C2 -r1.85 -r1.86
*** hash.h 8 Aug 2002 02:15:58 -0000 1.85
--- hash.h 11 Aug 2002 03:26:16 -0000 1.86
***************
*** 225,229 ****
void KickChannelUser(struct userNode* target, struct chanNode* channel, struct userNode *kicker, const char *why);
! typedef int (*kick_func_t) (struct userNode *kicker, struct userNode *user, struct chanNode *chan);
void reg_kick_func(kick_func_t handler);
void ChannelUserKicked(struct userNode* kicker, struct userNode* victim, struct chanNode* channel);
--- 225,229 ----
void KickChannelUser(struct userNode* target, struct chanNode* channel, struct userNode *kicker, const char *why);
! typedef void (*kick_func_t) (struct userNode *kicker, struct userNode *user, struct chanNode *chan);
void reg_kick_func(kick_func_t handler);
void ChannelUserKicked(struct userNode* kicker, struct userNode* victim, struct chanNode* channel);
Index: global.c
===================================================================
RCS file: /cvsroot/srvx/services/src/global.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -r1.48 -r1.49
*** global.c 5 Aug 2002 03:22:19 -0000 1.48
--- global.c 11 Aug 2002 03:26:16 -0000 1.49
***************
*** 765,769 ****
reg_oper_func(global_process_oper);
- global_conf_read();
conf_register_reload(global_conf_read);
--- 765,768 ----
Index: conf.c
===================================================================
RCS file: /cvsroot/srvx/services/src/conf.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** conf.c 30 Jul 2002 02:15:11 -0000 1.28
--- conf.c 11 Aug 2002 03:26:16 -0000 1.29
***************
*** 35,38 ****
--- 35,39 ----
}
reload_funcs[num_rfs++] = crf;
+ crf();
}
Index: compat.h
===================================================================
RCS file: /cvsroot/srvx/services/src/compat.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** compat.h 5 Aug 2002 02:58:17 -0000 1.11
--- compat.h 11 Aug 2002 03:26:16 -0000 1.12
***************
*** 9,13 ****
# define alloca __builtin_alloca
#else
! # if defined(HAVE_ALLOCA_H) && defined(CAN_INCLUDE_ALLOCA_H)
# include <alloca.h>
# else
--- 9,13 ----
# define alloca __builtin_alloca
#else
! # if defined(HAVE_ALLOCA_H)
# include <alloca.h>
# else
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.268
retrieving revision 1.269
diff -C2 -r1.268 -r1.269
*** chanserv.c 10 Aug 2002 01:20:29 -0000 1.268
--- chanserv.c 11 Aug 2002 03:26:16 -0000 1.269
***************
*** 6013,6022 ****
}
! static int
handle_kick(struct userNode *kicker, struct userNode *victim, struct chanNode *channel)
{
char *reason = CSMSG_PROTECT_REASON;
! if(!channel->channel_info || IsService(kicker) || (kicker == victim) || IsSuspended(channel->channel_info)) return 0;
if(protect_user(victim, kicker, channel->channel_info))
--- 6013,6022 ----
}
! static void
handle_kick(struct userNode *kicker, struct userNode *victim, struct chanNode *channel)
{
char *reason = CSMSG_PROTECT_REASON;
! if(!channel->channel_info || IsService(kicker) || (kicker == victim) || IsSuspended(channel->channel_info)) return;
if(protect_user(victim, kicker, channel->channel_info))
***************
*** 6024,6029 ****
KickChannelUser(kicker, channel, chanserv, reason);
}
-
- return 0;
}
--- 6024,6027 ----
***************
*** 6990,6994 ****
{
chanserv = AddService(nick, "Channel Services");
- chanserv_conf_read();
conf_register_reload(chanserv_conf_read);
--- 6988,6991 ----
Index: Makefile.am
===================================================================
RCS file: /cvsroot/srvx/services/src/Makefile.am,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -r1.51 -r1.52
*** Makefile.am 30 Jul 2002 02:15:11 -0000 1.51
--- Makefile.am 11 Aug 2002 03:26:16 -0000 1.52
***************
*** 10,15 ****
srvx_LIBS = @RX_LIBS@
! EXTRA_srvx_SOURCES = proto-bahamut.c proto-common.c proto-p10.c
! srvx_LDADD = @PROTO_FILES@
srvx_SOURCES = \
chanserv.c chanserv.h \
--- 10,16 ----
srvx_LIBS = @RX_LIBS@
! EXTRA_srvx_SOURCES = proto-bahamut.c proto-common.c proto-p10.c mod-snoop.c
! srvx_LDADD = @MODULE_OBJS@
! srvx_DEPENDENCIES = @MODULE_OBJS@
srvx_SOURCES = \
chanserv.c chanserv.h \
***************
*** 43,46 ****
checkdb_SOURCES = checkdb.c recdb.c recdb.h dict-splay.c dict.h log.h mini-tools.c
! globtest_SOURCES = tools.c globtest.c common.h dict-splay.c mini-tools.c
globtest_CFLAGS = -DGLOBTEST
--- 44,48 ----
checkdb_SOURCES = checkdb.c recdb.c recdb.h dict-splay.c dict.h log.h mini-tools.c
! globtest_SOURCES = tools.c globtest.c common.h dict-splay.c dict.h mini-tools.c
globtest_CFLAGS = -DGLOBTEST
+
|
|
From: Entrope <en...@us...> - 2002-08-11 03:26:24
|
Update of /cvsroot/srvx/services
In directory usw-pr-cvs1:/tmp/cvs-serv8293
Modified Files:
configure.in Makefile.am
Log Message:
add configure --with-modules option (and sample module, for arcnet's use)
require automake-1.5 or higher (to make --with-modules and $(OBJEXT) work sanely)
make kick_func callbacks return void, not int
make conf_register_reload() call the config re(lo)ad function
add split_line() to mini-tools.c
make valid_user_for() remove allowauth from dict itself
Index: configure.in
===================================================================
RCS file: /cvsroot/srvx/services/configure.in,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -r1.53 -r1.54
*** configure.in 5 Aug 2002 03:04:46 -0000 1.53
--- configure.in 11 Aug 2002 03:26:16 -0000 1.54
***************
*** 63,84 ****
AC_STRUCT_TM
- dnl Solaris needs alloca.h included.. go figure
- AC_MSG_CHECKING(for working alloca.h)
- AC_TRY_RUN([
- #include <alloca.h>
- main()
- {
- char *x;
- x = alloca(1);
- exit(0);
- }
- ],
- AC_MSG_RESULT(yes)
- AC_DEFINE(CAN_INCLUDE_ALLOCA_H, 1, [Define if you must include <alloca.h> to get alloca]),
- AC_MSG_RESULT(no), :)
-
-
dnl Would rather not bail on headers, BSD has alot of the functions elsewhere. -Jedi
! AC_CHECK_HEADERS(fcntl.h malloc.h netdb.h netinet/in.h sys/resource.h sys/timeb.h sys/times.h sys/param.h sys/socket.h sys/time.h sys/types.h sys/wait.h unistd.h getopt.h memory.h regex.h alloca.h arpa/inet.h,,)
dnl portability stuff, hurray! -Jedi
--- 63,68 ----
AC_STRUCT_TM
dnl Would rather not bail on headers, BSD has alot of the functions elsewhere. -Jedi
! AC_CHECK_HEADERS(fcntl.h malloc.h netdb.h netinet/in.h sys/resource.h sys/timeb.h sys/times.h sys/param.h sys/socket.h sys/time.h sys/types.h sys/wait.h unistd.h getopt.h memory.h regex.h arpa/inet.h,,)
dnl portability stuff, hurray! -Jedi
***************
*** 94,98 ****
AC_CHECK_FUNCS(select socket strcspn strspn strtod strtoul,,AC_MSG_ERROR([a required function was not found. srvx build will fail.]))
! dnl Check if mmap() works. Autoconf has its own test for this.
AC_FUNC_MMAP
--- 78,83 ----
AC_CHECK_FUNCS(select socket strcspn strspn strtod strtoul,,AC_MSG_ERROR([a required function was not found. srvx build will fail.]))
! dnl Check for functions (and how to get them).
! AC_FUNC_ALLOCA
AC_FUNC_MMAP
***************
*** 241,249 ****
AC_MSG_RESULT(P10)
AC_DEFINE(WITH_PROTOCOL_P10, 1, [Define if using the P10 dialect of IRC])
PROTO_FILES=proto-p10.c
elif test "x$withval" = "xbahamut" ; then
AC_MSG_RESULT(Bahamut)
AC_DEFINE(WITH_PROTOCOL_BAHAMUT, 1, [Define if using the Bahamut dialect of IRC])
! PROTO_FILES=proto-bahamut.c
else
AC_MSG_ERROR([Unknown IRC dialect $withval])
--- 226,235 ----
AC_MSG_RESULT(P10)
AC_DEFINE(WITH_PROTOCOL_P10, 1, [Define if using the P10 dialect of IRC])
+ MODULE_OBJS="$MODULE_OBJS proto-p10.\$(OBJEXT)"
PROTO_FILES=proto-p10.c
elif test "x$withval" = "xbahamut" ; then
AC_MSG_RESULT(Bahamut)
AC_DEFINE(WITH_PROTOCOL_BAHAMUT, 1, [Define if using the Bahamut dialect of IRC])
! MODULE_OBJS="$MODULE_OBJS proto-bahamut.\$(OBJEXT)"
else
AC_MSG_ERROR([Unknown IRC dialect $withval])
***************
*** 282,285 ****
--- 268,298 ----
])
+ AC_MSG_CHECKING(for extra module files)
+ AC_ARG_ENABLE(modules,
+ [ --enable-modules=list,of,modules Enable extra modules],
+ [
+ OIFS="$IFS"
+ IFS=','
+ EXTRA_MODULE_OBJS=""
+ module_list=""
+ dnl Must use a separate file because autoconf can't stand newlines in an AC_SUBSTed variable.
+ MODULE_DEFINES="src/modules-list.h"
+ echo > $MODULE_DEFINES
+ touch $MODULE_DEFINES
+ for module in $enableval ; do
+ EXTRA_MODULE_OBJS="$EXTRA_MODULE_OBJS mod-$module.\$(OBJEXT)"
+ module_list="$module_list $module"
+ CNAME=`echo $module | tr a-z A-Z`
+ echo "#define WITH_MODULE_$CNAME 1" >> $MODULE_DEFINES
+ done
+ IFS="$OIFS"
+ MODULE_OBJS="$MODULE_OBJS modules.\$(OBJEXT) $EXTRA_MODULE_OBJS"
+ AC_DEFINE(EXTRA_MODULES, 1, [Define if there are extra modules to be initialized.])
+ AC_MSG_RESULT($module_list)
+ ],
+ [
+ AC_MSG_RESULT(none)
+ ])
+
MY_SUBDIRS=""
RX_INCLUDES=""
***************
*** 296,300 ****
fi
! AC_SUBST(PROTO_FILES)
AC_SUBST(MY_SUBDIRS)
AC_SUBST(RX_INCLUDES)
--- 309,313 ----
fi
! AC_SUBST(MODULE_OBJS)
AC_SUBST(MY_SUBDIRS)
AC_SUBST(RX_INCLUDES)
Index: Makefile.am
===================================================================
RCS file: /cvsroot/srvx/services/Makefile.am,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** Makefile.am 31 May 2002 04:13:23 -0000 1.17
--- Makefile.am 11 Aug 2002 03:26:16 -0000 1.18
***************
*** 2,5 ****
--- 2,6 ----
SUBDIRS = @MY_SUBDIRS@
DIST_SUBDIRS = src rx
+ AUTOMAKE_OPTIONS = gnu 1.5
all: srvx
|
|
From: Zoot <zo...@us...> - 2002-08-10 01:23:35
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv12251/src
Modified Files:
Tag: rel-1_1-branch
chanserv.c
Log Message:
Don't trim bans that haven't been triggered yet but fall within the range to be kept.
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.232.2.7
retrieving revision 1.232.2.8
diff -C2 -r1.232.2.7 -r1.232.2.8
*** chanserv.c 30 Jul 2002 18:12:13 -0000 1.232.2.7
--- chanserv.c 10 Aug 2002 01:23:32 -0000 1.232.2.8
***************
*** 2919,2927 ****
next = bData->next;
! if(bData->triggered < limit)
! {
! del_channel_ban(bData);
! count++;
! }
}
--- 2919,2929 ----
next = bData->next;
! if((bData->triggered && bData->triggered >= limit) || (bData->set && bData->set >= limit))
! {
! continue;
! }
!
! del_channel_ban(bData);
! count++;
}
|
|
From: Zoot <zo...@us...> - 2002-08-10 01:20:32
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv10761/src
Modified Files:
chanserv.c
Log Message:
Don't trim bans that have not been triggered yet but were added within the range to be kept.
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.267
retrieving revision 1.268
diff -C2 -r1.267 -r1.268
*** chanserv.c 7 Aug 2002 20:27:09 -0000 1.267
--- chanserv.c 10 Aug 2002 01:20:29 -0000 1.268
***************
*** 2459,2467 ****
next = bData->next;
! if(bData->triggered < limit)
! {
! del_channel_ban(bData);
! count++;
! }
}
--- 2459,2469 ----
next = bData->next;
! if((bData->triggered && bData->triggered >= limit) || (bData->set && bData->set >= limit))
! {
! continue;
! }
!
! del_channel_ban(bData);
! count++;
}
|
|
From: Zoot <zo...@us...> - 2002-08-10 00:49:07
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv32253/src
Modified Files:
proto-p10.c
Log Message:
Squelch the warning about an invalid boot time for servers more than a hop away, who are supposed to have one of 0.
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** proto-p10.c 8 Aug 2002 02:50:02 -0000 1.14
--- proto-p10.c 10 Aug 2002 00:49:04 -0000 1.15
***************
*** 643,647 ****
if (srv->boot <= PREHISTORY) {
/* Server from the mists of time.. */
! log(MAIN_LOG, LOG_ERROR, "Server %s claims to have booted at time "FMT_TIME_T". This is absurd.\n", srv->name, srv->boot);
} else if ((str = conf_get_data("server/reliable_clock", RECDB_QSTRING))
&& enabled_string(str)) {
--- 643,649 ----
if (srv->boot <= PREHISTORY) {
/* Server from the mists of time.. */
! if(srv->hops == 1) {
! log(MAIN_LOG, LOG_ERROR, "Server %s claims to have booted at time "FMT_TIME_T". This is absurd.\n", srv->name, srv->boot);
! }
} else if ((str = conf_get_data("server/reliable_clock", RECDB_QSTRING))
&& enabled_string(str)) {
|
|
From: Zoot <zo...@us...> - 2002-08-08 02:50:05
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv21940/src
Modified Files:
proto-p10.c
Log Message:
Parse the ACCOUNT command so separate services instances can cooperate to some degree.
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** proto-p10.c 8 Aug 2002 02:15:58 -0000 1.13
--- proto-p10.c 8 Aug 2002 02:50:02 -0000 1.14
***************
*** 787,791 ****
user = AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[9], argv[10], (time_t)atoi(argv[3]), argv[8]);
! call_account_func(user, argv[7]);
} else {
AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[8], argv[9], (time_t)atoi(argv[3]), argv[7]);
--- 787,794 ----
user = AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[9], argv[10], (time_t)atoi(argv[3]), argv[8]);
! if(user)
! {
! call_account_func(user, argv[7]);
! }
} else {
AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[8], argv[9], (time_t)atoi(argv[3]), argv[7]);
***************
*** 798,801 ****
--- 801,827 ----
}
+ static CMD_FUNC(cmd_account)
+ {
+ struct userNode *user;
+
+ if (argc < 3) {
+ return 0;
+ }
+
+ if (!origin || !GetServerH(origin)) {
+ /* Protocol violation - ACCOUNT from user. */
+ return 0;
+ }
+
+ user = GetUserN(argv[1]);
+ if(!user) {
+ /* Ignore ACCOUNT for user that QUIT; probably crossed */
+ return 1;
+ }
+
+ call_account_func(user, argv[2]);
+ return 1;
+ }
+
static CMD_FUNC(cmd_burst)
{
***************
*** 1192,1195 ****
--- 1218,1223 ----
dict_insert(irc_func_dict, CMD_NICK, cmd_nick);
dict_insert(irc_func_dict, TOK_NICK, cmd_nick);
+ dict_insert(irc_func_dict, CMD_ACCOUNT, cmd_account);
+ dict_insert(irc_func_dict, TOK_ACCOUNT, cmd_account);
dict_insert(irc_func_dict, CMD_PASS, cmd_pass);
dict_insert(irc_func_dict, TOK_PASS, cmd_pass);
|
|
From: Zoot <zo...@us...> - 2002-08-08 02:16:00
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv4108/src
Modified Files:
hash.c hash.h nickserv.c proto-bahamut.c proto-p10.c proto.h
Log Message:
Abstract account stamping a bit more.
Index: hash.c
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.c,v
retrieving revision 1.161
retrieving revision 1.162
diff -C2 -r1.161 -r1.162
*** hash.c 30 Jul 2002 02:15:11 -0000 1.161
--- hash.c 8 Aug 2002 02:15:57 -0000 1.162
***************
*** 226,229 ****
--- 226,276 ----
}
+ static account_func_t account_func = NULL;
+
+ void
+ reg_account_func(account_func_t handler)
+ {
+ if (account_func) {
+ log(DEBUG_LOG, LOG_WARNING, "Reregistering ACCOUNT handler.\n");
+ }
+ account_func = handler;
+ }
+
+ void
+ call_account_func(struct userNode *user, char *stamp)
+ {
+ /* We've received an account stamp for a user; notify
+ NickServ, which registers the sole account_func
+ right now.
+
+ (P10 Protocol violation if (user->modes & FLAGS_STAMPED here.)
+ */
+ if(account_func)
+ {
+ account_func(user, stamp);
+ }
+
+ #ifdef WITH_PROTOCOL_P10
+ /* Mark the user so we don't stamp it again. */
+ user->modes |= FLAGS_STAMPED;
+ #endif
+ }
+
+ void
+ StampUser(struct userNode *user, char *stamp)
+ {
+ #ifdef WITH_PROTOCOL_P10
+ /* The P10 protocol says we can't stamp users who already
+ have a stamp. */
+ if(user->modes & FLAGS_STAMPED)
+ {
+ return;
+ }
+ #endif
+
+ irc_account(user, stamp);
+ user->modes |= FLAGS_STAMPED;
+ }
+
static new_channel_func_t *ncf_list;
static unsigned int ncf_size = 0, ncf_used = 0;
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.84
retrieving revision 1.85
diff -C2 -r1.84 -r1.85
*** hash.h 30 Jul 2002 02:15:11 -0000 1.84
--- hash.h 8 Aug 2002 02:15:58 -0000 1.85
***************
*** 50,53 ****
--- 50,54 ----
#define FLAGS_GAGGED 0x0400 /* for gagged users */
#define FLAGS_AWAY 0x0800 /* for away users */
+ #define FLAGS_STAMPED 0x1000 /* for users who have been stamped */
#define IsOper(x) ((x)->modes & FLAGS_OPER)
***************
*** 199,202 ****
--- 200,208 ----
void reg_nick_change_func(nick_change_func_t handler);
void NickChange(struct userNode* user, const char *new_nick, int no_announce);
+
+ typedef void (*account_func_t) (struct userNode *user, char *stamp);
+ void reg_account_func(account_func_t handler);
+ void call_account_func(struct userNode *user, char *stamp);
+ void StampUser(struct userNode *user, char *stamp);
typedef void (*new_channel_func_t) (struct chanNode *chan);
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.192
retrieving revision 1.193
diff -C2 -r1.192 -r1.193
*** nickserv.c 8 Aug 2002 01:11:56 -0000 1.192
--- nickserv.c 8 Aug 2002 02:15:58 -0000 1.193
***************
*** 768,772 ****
/* Stamp the user with an account ID. */
inttobase64(id, hi->id, IDLEN);
! irc_account(user, id);
}
} else {
--- 768,772 ----
/* Stamp the user with an account ID. */
inttobase64(id, hi->id, IDLEN);
! StampUser(user, id);
}
} else {
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** proto-bahamut.c 8 Aug 2002 00:11:15 -0000 1.12
--- proto-bahamut.c 8 Aug 2002 02:15:58 -0000 1.13
***************
*** 35,40 ****
};
- static account_func_t account_func = NULL;
-
static dict_t service_msginfo_dict; /* holds service_message_info structs */
static int uplink_capab;
--- 35,38 ----
***************
*** 1057,1068 ****
}
info->on_notice = handler;
- }
-
- void
- reg_account_func(account_func_t handler)
- {
- if (account_func) {
- log(DEBUG_LOG, LOG_WARNING, "Reregistering ACCOUNT handler.\n");
- }
- account_func = handler;
}
--- 1055,1057 ----
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** proto-p10.c 8 Aug 2002 00:11:15 -0000 1.12
--- proto-p10.c 8 Aug 2002 02:15:58 -0000 1.13
***************
*** 169,174 ****
static unsigned int num_notice_funcs = 0;
- static account_func_t account_func = NULL;
-
static struct userNode *AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip);
--- 169,172 ----
***************
*** 789,797 ****
user = AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[9], argv[10], (time_t)atoi(argv[3]), argv[8]);
! /* NickServ registers the sole account_func right now. */
! if(user && account_func)
! {
! account_func(user, argv[7]);
! }
} else {
AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[8], argv[9], (time_t)atoi(argv[3]), argv[7]);
--- 787,791 ----
user = AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[9], argv[10], (time_t)atoi(argv[3]), argv[8]);
! call_account_func(user, argv[7]);
} else {
AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[8], argv[9], (time_t)atoi(argv[3]), argv[7]);
***************
*** 1678,1690 ****
}
notice_funcs[numeric] = handler;
- }
-
- void
- reg_account_func(account_func_t handler)
- {
- if (account_func) {
- log(DEBUG_LOG, LOG_WARNING, "Reregistering ACCOUNT handler.\n");
- }
- account_func = handler;
}
--- 1672,1675 ----
Index: proto.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -C2 -r1.58 -r1.59
*** proto.h 8 Aug 2002 00:11:15 -0000 1.58
--- proto.h 8 Aug 2002 02:15:58 -0000 1.59
***************
*** 104,110 ****
void reg_mode_change_func(mode_change_func_t handler);
- typedef void (*account_func_t) (struct userNode *user, char *stamp);
- void reg_account_func(account_func_t handler);
-
#define MODE_CHANGE_MISC 0x001
#define MODE_CHANGE_OP 0x002
--- 104,107 ----
|
|
From: Zoot <zo...@us...> - 2002-08-08 01:11:59
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv12744/src
Modified Files:
nickserv.c
Log Message:
Deauthenticate users when their accounts are suspended.
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -C2 -r1.191 -r1.192
*** nickserv.c 8 Aug 2002 01:05:20 -0000 1.191
--- nickserv.c 8 Aug 2002 01:11:56 -0000 1.192
***************
*** 155,159 ****
#define NSMSG_PLEASE_SET_EMAIL "We now require email addresses for users. Please use the $bset email$b command to set your email address!"
#define NSMSG_WEAK_PASSWORD "WARNING: You are using a password that is considered weak (easy to guess). It is STRONGLY recommended you change it (now, if not sooner) by typing \"/msg $N@$s PASS oldpass newpass\" (with your current password and a new password)."
! #define NSMSG_HANDLE_SUSPENDED "Your $N account has been suspended."
#define NSMSG_AUTH_SUCCESS "I recognize you."
#define NSMSG_AUTH_ALLOWED "User $b%s$b may now authenticate to account $b%s$b."
--- 155,159 ----
#define NSMSG_PLEASE_SET_EMAIL "We now require email addresses for users. Please use the $bset email$b command to set your email address!"
#define NSMSG_WEAK_PASSWORD "WARNING: You are using a password that is considered weak (easy to guess). It is STRONGLY recommended you change it (now, if not sooner) by typing \"/msg $N@$s PASS oldpass newpass\" (with your current password and a new password)."
! #define NSMSG_HANDLE_SUSPENDED "Your $b$N$b account has been suspended; you may not use it."
#define NSMSG_AUTH_SUCCESS "I recognize you."
#define NSMSG_AUTH_ALLOWED "User $b%s$b may now authenticate to account $b%s$b."
***************
*** 1737,1740 ****
--- 1737,1753 ----
}
if (!uNode) HANDLE_CLEAR_FLAG(hi, HELPING);
+ }
+
+ if (added & HI_FLAG_SUSPENDED) {
+ struct userNode *un, *next;
+
+ for (un = hi->users; un; un = next) {
+ next = un->next_authed;
+ un->handle_info = NULL;
+ un->next_authed = NULL;
+
+ nickserv_notice(un, NSMSG_HANDLE_SUSPENDED);
+ }
+ hi->users = NULL;
}
|
|
From: Zoot <zo...@us...> - 2002-08-08 01:05:23
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv9541/src
Modified Files:
nickserv.c
Log Message:
Be more careful about attempting to remove users from the helper list.
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.190
retrieving revision 1.191
diff -C2 -r1.190 -r1.191
*** nickserv.c 8 Aug 2002 00:11:15 -0000 1.190
--- nickserv.c 8 Aug 2002 01:05:20 -0000 1.191
***************
*** 1744,1748 ****
userList_append(&curr_helpers, uNode);
}
! } else if (!after) {
/* Remove user from current helper list. */
for (uNode = hi->users; uNode; uNode = uNode->next_authed) {
--- 1744,1748 ----
userList_append(&curr_helpers, uNode);
}
! } else if (!after && before) {
/* Remove user from current helper list. */
for (uNode = hi->users; uNode; uNode = uNode->next_authed) {
|
|
From: Zoot <zo...@us...> - 2002-08-08 00:11:18
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv16975/src
Modified Files:
nickserv.c nickserv.h proto-bahamut.c proto-p10.c proto.h
Log Message:
Support ACCOUNT stamping for the P10 protocol (works with ircu 2.10.11 and lain 1.2) so users who authenticate to services stay authenticated until they quit regardless of server splits and services restarts.
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.189
retrieving revision 1.190
diff -C2 -r1.189 -r1.190
*** nickserv.c 7 Aug 2002 03:02:18 -0000 1.189
--- nickserv.c 8 Aug 2002 00:11:15 -0000 1.190
***************
*** 249,252 ****
--- 249,253 ----
static struct service *nickserv_service;
static dict_t nickserv_handle_dict; /* contains struct handle_info* */
+ static dict_t nickserv_id_dict; /* contains struct handle_info* */
static dict_t nickserv_nick_dict; /* contains struct nick_info* */
static dict_t nickserv_opt_dict; /* contains option_func_t* */
***************
*** 311,316 ****
{
struct handle_info *hi;
! /* Assign a unique account ID to the account. */
if (!id) {
id = 1 + highest_id++;
--- 312,319 ----
{
struct handle_info *hi;
+ char id_base64[IDLEN + 1];
! /* Assign a unique account ID to the account; note that 0 is
! an invalid account ID. 1 is therefore the first account ID. */
if (!id) {
id = 1 + highest_id++;
***************
*** 323,326 ****
--- 326,339 ----
}
}
+ inttobase64(id_base64, id, IDLEN);
+
+ #ifndef NDEBUG
+ /* Make sure an account with the same ID doesn't exist. This is
+ truly impossible, but it never hurts to expect it. */
+ if ((hi = dict_find(nickserv_id_dict, id_base64, NULL))) {
+ log(NS_LOG, LOG_WARNING, "Duplicated account ID %lu (%s) found belonging to %s while inserting %s.\n", id, id_base64, hi->handle, handle);
+ }
+ #endif
+
hi = calloc(1, sizeof(*hi));
hi->id = id;
***************
*** 331,334 ****
--- 344,348 ----
hi->infoline = NULL;
dict_insert(nickserv_handle_dict, hi->handle, hi);
+ dict_insert(nickserv_id_dict, strdup(id_base64), hi);
return hi;
}
***************
*** 404,407 ****
--- 418,422 ----
struct userNode *un, *next;
struct handle_info *hi = vhi;
+ char id[IDLEN + 1];
free_string_list(hi->masks);
***************
*** 411,414 ****
--- 426,431 ----
un->next_authed = NULL;
}
+ inttobase64(id, hi->id, IDLEN);
+ dict_remove(nickserv_id_dict, id);
while (hi->nicks) delete_nick(hi->nicks);
if (hi->infoline) free(hi->infoline);
***************
*** 705,709 ****
static void
! set_user_handle_info(struct userNode *user, struct handle_info *hi)
{
unsigned int n;
--- 722,726 ----
static void
! set_user_handle_info(struct userNode *user, struct handle_info *hi, int stamp)
{
unsigned int n;
***************
*** 745,749 ****
--- 762,775 ----
hi->lastseen = now;
if (IsHelper(user)) userList_append(&curr_helpers, user);
+
+ if (stamp) {
+ char id[IDLEN + 1];
+
+ /* Stamp the user with an account ID. */
+ inttobase64(id, hi->id, IDLEN);
+ irc_account(user, id);
+ }
} else {
+ /* We cannot clear the user's account ID, unfortunately. */
user->next_authed = NULL;
}
***************
*** 775,779 ****
hi->lastseen = now;
hi->flags = HI_DEFAULT_FLAGS;
! if (settee) set_user_handle_info(settee, hi);
if (nickserv_conf.disable_nicks || (user != settee)) {
--- 801,805 ----
hi->lastseen = now;
hi->flags = HI_DEFAULT_FLAGS;
! if (settee) set_user_handle_info(settee, hi, 1);
if (nickserv_conf.disable_nicks || (user != settee)) {
***************
*** 1347,1351 ****
if (hi->passwd[0] != '$') cryptpass(passwd, hi->passwd);
! set_user_handle_info(user, hi);
nickserv_notice(user, NSMSG_AUTH_SUCCESS);
return 1;
--- 1373,1377 ----
if (hi->passwd[0] != '$') cryptpass(passwd, hi->passwd);
! set_user_handle_info(user, hi, 1);
nickserv_notice(user, NSMSG_AUTH_SUCCESS);
return 1;
***************
*** 1486,1494 ****
case ACTIVATION:
safestrncpy(hi->passwd, hi->cookie->data, sizeof(hi->passwd));
! set_user_handle_info(user, hi);
nickserv_notice(user, NSMSG_HANDLE_ACTIVATED);
break;
case PASSWORD_CHANGE:
! set_user_handle_info(user, hi);
safestrncpy(hi->passwd, hi->cookie->data, sizeof(hi->passwd));
nickserv_notice(user, NSMSG_PASSWORD_CHANGED);
--- 1512,1520 ----
case ACTIVATION:
safestrncpy(hi->passwd, hi->cookie->data, sizeof(hi->passwd));
! set_user_handle_info(user, hi, 1);
nickserv_notice(user, NSMSG_HANDLE_ACTIVATED);
break;
case PASSWORD_CHANGE:
! set_user_handle_info(user, hi, 1);
safestrncpy(hi->passwd, hi->cookie->data, sizeof(hi->passwd));
nickserv_notice(user, NSMSG_PASSWORD_CHANGED);
***************
*** 1499,1503 ****
break;
case ALLOWAUTH:
! set_user_handle_info(user, hi);
nickserv_notice(user, NSMSG_AUTH_SUCCESS);
break;
--- 1525,1529 ----
break;
case ALLOWAUTH:
! set_user_handle_info(user, hi, 1);
nickserv_notice(user, NSMSG_AUTH_SUCCESS);
break;
***************
*** 3087,3090 ****
--- 3113,3136 ----
void
+ handle_account(struct userNode *user, char *stamp)
+ {
+ struct handle_info *hi;
+
+ hi = dict_find(nickserv_id_dict, stamp, NULL);
+ if (hi) {
+ /* valid_user_for() is theoretically unnecessary here
+ because users must authenticate to receive a stamp
+ in the first place; however, we must prevent
+ stamped users from getting onto suspended handles.
+ The last argument is 0 because we don't want to
+ stamp the user again. */
+ if (HANDLE_FLAGGED(hi, SUSPENDED)) {
+ return;
+ }
+ set_user_handle_info(user, hi, 0);
+ }
+ }
+
+ void
handle_nick_change(struct userNode *user, const char *new_nick)
{
***************
*** 3109,3113 ****
if (user->auth_policer) policer_delete(user->auth_policer);
dict_remove(nickserv_allow_auth_dict, user->nick);
! set_user_handle_info(user, NULL);
}
--- 3155,3159 ----
if (user->auth_policer) policer_delete(user->auth_policer);
dict_remove(nickserv_allow_auth_dict, user->nick);
! set_user_handle_info(user, NULL, 0);
}
***************
*** 3165,3168 ****
--- 3211,3215 ----
reg_nick_change_func(handle_nick_change);
reg_del_user_func(nickserv_remove_user);
+ reg_account_func(handle_account);
/* set up handle_inverse_flags */
***************
*** 3242,3245 ****
--- 3289,3295 ----
nickserv_handle_dict = dict_new();
dict_set_free_data(nickserv_handle_dict, free_handle_info);
+
+ nickserv_id_dict = dict_new();
+ dict_set_free_keys(nickserv_id_dict, free);
nickserv_nick_dict = dict_new();
Index: nickserv.h
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -r1.36 -r1.37
*** nickserv.h 7 Aug 2002 03:02:18 -0000 1.36
--- nickserv.h 8 Aug 2002 00:11:15 -0000 1.37
***************
*** 27,30 ****
--- 27,33 ----
#define COOKIELEN 10
+ /* IDLEN is 6 because it takes 5.33 Base64 digits to store 32 bytes. */
+ #define IDLEN 6
+
/* HI_FLAG_* go into handle_info.flags */
#define HI_FLAG_OPER_SUSPENDED 0x00000001
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** proto-bahamut.c 5 Aug 2002 03:22:19 -0000 1.11
--- proto-bahamut.c 8 Aug 2002 00:11:15 -0000 1.12
***************
*** 35,38 ****
--- 35,40 ----
};
+ static account_func_t account_func = NULL;
+
static dict_t service_msginfo_dict; /* holds service_message_info structs */
static int uplink_capab;
***************
*** 230,233 ****
--- 232,242 ----
void
+ irc_account(struct userNode *user, const char *stamp)
+ {
+ /* ACCOUNT: NOOP on Bahamut until I look at it. -- Zoot */
+ (void)user;(void)stamp;
+ }
+
+ void
irc_nick(struct userNode *user, const char *new_nick) {
if (user->uplink == self) {
***************
*** 281,286 ****
void
! irc_pong(const char *data) {
! putsock("PONG %s :%s", self->name, data);
}
--- 290,295 ----
void
! irc_pong(const char *who, const char *data) {
! putsock(":%s PONG %s :%s", self->name, who, data);
}
***************
*** 660,665 ****
static CMD_FUNC(cmd_ping)
{
! (void)argv;(void)argc;
! irc_pong(origin);
timeq_del(0, timed_send_ping, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
timeq_del(0, timed_ping_timeout, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
--- 669,673 ----
static CMD_FUNC(cmd_ping)
{
! irc_pong(self->name, argc > 1 ? argv[1] : origin);
timeq_del(0, timed_send_ping, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
timeq_del(0, timed_ping_timeout, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
***************
*** 1049,1051 ****
--- 1057,1068 ----
}
info->on_notice = handler;
+ }
+
+ void
+ reg_account_func(account_func_t handler)
+ {
+ if (account_func) {
+ log(DEBUG_LOG, LOG_WARNING, "Reregistering ACCOUNT handler.\n");
+ }
+ account_func = handler;
}
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** proto-p10.c 6 Aug 2002 16:12:07 -0000 1.11
--- proto-p10.c 8 Aug 2002 00:11:15 -0000 1.12
***************
*** 21,24 ****
--- 21,25 ----
#include "proto-common.c"
+ #define CMD_ACCOUNT "ACCOUNT"
#define CMD_ADMIN "ADMIN"
#define CMD_AWAY "AWAY"
***************
*** 88,91 ****
--- 89,93 ----
#define CMD_WHOWAS "WHOWAS"
+ #define TOK_ACCOUNT "AC"
#define TOK_ADMIN "AD"
#define TOK_AWAY "A"
***************
*** 167,170 ****
--- 169,174 ----
static unsigned int num_notice_funcs = 0;
+ static account_func_t account_func = NULL;
+
static struct userNode *AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip);
***************
*** 282,285 ****
--- 286,295 ----
void
+ irc_account(struct userNode *user, const char *stamp)
+ {
+ putsock("%s %s %s %s", self->numeric, CMD_ACCOUNT, user->numeric, stamp);
+ }
+
+ void
irc_nick(struct userNode *user, const char *new_nick)
{
***************
*** 775,779 ****
if (argv[6][0] == '+') {
if (argc < 10) return 0;
! AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[8], argv[9], (time_t)atoi(argv[3]), argv[7]);
} else {
AddUser(serv, argv[1], argv[4], argv[5], "+", argv[7], argv[8], (time_t)atoi(argv[3]), argv[6]);
--- 785,800 ----
if (argv[6][0] == '+') {
if (argc < 10) return 0;
! if (argc > 10) {
! /* The user is +r and has an ACCOUNT stamp in argv[7]. */
! user = AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[9], argv[10], (time_t)atoi(argv[3]), argv[8]);
!
! /* NickServ registers the sole account_func right now. */
! if(user && account_func)
! {
! account_func(user, argv[7]);
! }
! } else {
! AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[8], argv[9], (time_t)atoi(argv[3]), argv[7]);
! }
} else {
AddUser(serv, argv[1], argv[4], argv[5], "+", argv[7], argv[8], (time_t)atoi(argv[3]), argv[6]);
***************
*** 1354,1358 ****
{
static unsigned int next_numeric = 0;
! if (self->clients >= self->num_mask) return -1;
while (self->users[next_numeric]) {
if (++next_numeric > self->num_mask) next_numeric = 0;
--- 1375,1379 ----
{
static unsigned int next_numeric = 0;
! if (self->clients > self->num_mask) return -1;
while (self->users[next_numeric]) {
if (++next_numeric > self->num_mask) next_numeric = 0;
***************
*** 1657,1660 ****
--- 1678,1690 ----
}
notice_funcs[numeric] = handler;
+ }
+
+ void
+ reg_account_func(account_func_t handler)
+ {
+ if (account_func) {
+ log(DEBUG_LOG, LOG_WARNING, "Reregistering ACCOUNT handler.\n");
+ }
+ account_func = handler;
}
Index: proto.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -r1.57 -r1.58
*** proto.h 6 Aug 2002 16:12:07 -0000 1.57
--- proto.h 8 Aug 2002 00:11:15 -0000 1.58
***************
*** 104,107 ****
--- 104,110 ----
void reg_mode_change_func(mode_change_func_t handler);
+ typedef void (*account_func_t) (struct userNode *user, char *stamp);
+ void reg_account_func(account_func_t handler);
+
#define MODE_CHANGE_MISC 0x001
#define MODE_CHANGE_OP 0x002
***************
*** 147,150 ****
--- 150,156 ----
void irc_raw(const char *what);
void irc_stats(struct userNode *from, struct server *target, char type);
+
+ /* account maintenance */
+ void irc_account(struct userNode *user, const char *stamp);
/* numeric messages */
|
|
From: Zoot <zo...@us...> - 2002-08-07 20:27:13
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv25533/src
Modified Files:
chanserv.c
Log Message:
Don't tell the user they have been deleted from their channels' userlists if they weren't on any userlists to begin with.
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.266
retrieving revision 1.267
diff -C2 -r1.266 -r1.267
*** chanserv.c 6 Aug 2002 02:32:38 -0000 1.266
--- chanserv.c 7 Aug 2002 20:27:09 -0000 1.267
***************
*** 6140,6153 ****
(void)user;
! for(h_user = handle->users; h_user; h_user = h_user->next_authed)
{
! chanserv_notice(h_user, CSMSG_HANDLE_UNREGISTERED);
! }
! for(channel = handle->channels; channel; channel = next)
! {
! /* del_channel_user() deletes the chanList nodes, so we
! don't worry about them. */
! next = channel->next;
! del_channel_user(channel->channel, channel->user);
}
}
--- 6140,6157 ----
(void)user;
! if(handle->channels)
{
! for(h_user = handle->users; h_user; h_user = h_user->next_authed)
! {
! chanserv_notice(h_user, CSMSG_HANDLE_UNREGISTERED);
! }
!
! for(channel = handle->channels; channel; channel = next)
! {
! /* del_channel_user() deletes the chanList nodes, so we
! don't worry about them. */
! next = channel->next;
! del_channel_user(channel->channel, channel->user);
! }
}
}
|
|
From: Zoot <zo...@us...> - 2002-08-07 03:02:21
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv14813/src
Modified Files:
nickserv.c nickserv.h
Log Message:
Assign accounts unique numeric IDs in preparation for P10 ACCOUNT support.
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.188
retrieving revision 1.189
diff -C2 -r1.188 -r1.189
*** nickserv.c 7 Aug 2002 02:49:20 -0000 1.188
--- nickserv.c 7 Aug 2002 03:02:18 -0000 1.189
***************
*** 70,73 ****
--- 70,74 ----
#define KEY_ACCOUNTS_PER_EMAIL "accounts_per_email"
+ #define KEY_ID "id"
#define KEY_PASSWD "passwd"
#define KEY_NICKS "nicks"
***************
*** 135,138 ****
--- 136,140 ----
#define NSMSG_USER_IS_SERVICE "$b%s$b is a network service; you can only use that command on real users."
#define NSMSG_HANDLEINFO_ON "Account information for $b%s$b:"
+ #define NSMSG_HANDLEINFO_ID " Account ID: %lu"
#define NSMSG_HANDLEINFO_REGGED " Registered on: %s"
#define NSMSG_HANDLEINFO_LASTSEEN " Last seen: %s"
***************
*** 286,289 ****
--- 288,294 ----
} nickserv_conf;
+ /* We have 2^32 unique account IDs to use. */
+ unsigned long int highest_id = 0;
+
const char *NSMSG_VERSION_ID = "$Id$";
***************
*** 303,310 ****
static struct handle_info *
! register_handle(const char *handle, const char *passwd)
{
struct handle_info *hi;
hi = calloc(1, sizeof(*hi));
hi->userlist_style = HI_DEFAULT_STYLE;
hi->announcements = '?';
--- 308,328 ----
static struct handle_info *
! register_handle(const char *handle, const char *passwd, unsigned long int id)
{
struct handle_info *hi;
+
+ /* Assign a unique account ID to the account. */
+ if (!id) {
+ id = 1 + highest_id++;
+ } else {
+ /* highest_id is always the highest ID, so if we're seeing an ID
+ again, panic. */
+ assert(id != highest_id);
+ if(id > highest_id) {
+ highest_id = id;
+ }
+ }
hi = calloc(1, sizeof(*hi));
+ hi->id = id;
hi->userlist_style = HI_DEFAULT_STYLE;
hi->announcements = '?';
***************
*** 751,755 ****
cryptpass(passwd, crypted);
! hi = register_handle(handle, crypted);
hi->masks = alloc_string_list(1);
hi->users = NULL;
--- 769,773 ----
cryptpass(passwd, crypted);
! hi = register_handle(handle, crypted, 0);
hi->masks = alloc_string_list(1);
hi->users = NULL;
***************
*** 1043,1046 ****
--- 1061,1065 ----
nickserv_notice(user, NSMSG_HANDLEINFO_ON, hi->handle);
+ nickserv_notice(user, NSMSG_HANDLEINFO_ID, hi->id);
nickserv_notice(user, NSMSG_HANDLEINFO_REGGED, ctime(&hi->registered));
***************
*** 2235,2238 ****
--- 2254,2263 ----
/* create the object */
dict_t obj = alloc_object();
+ assert(hi);
+
+ /* set account ID - must have been assigned */
+ assert(hi->id);
+ snprintf(num, sizeof(num), FMT_TIME_T, hi->id);
+ dict_insert(obj, KEY_ID, alloc_record_data_qstring(num));
/* set the password */
dict_insert(obj, KEY_PASSWD, alloc_record_data_qstring(hi->passwd));
***************
*** 2749,2755 ****
--- 2774,2783 ----
struct handle_info *hi;
struct userNode *authed_users;
+ unsigned long int id;
unsigned int ii;
dict_t subdb;
+ str = database_get_data(obj, KEY_ID, RECDB_QSTRING);
+ id = str ? strtoul(str, NULL, 0) : 0;
str = database_get_data(obj, KEY_PASSWD, RECDB_QSTRING);
if (!str) {
***************
*** 2764,2768 ****
authed_users = NULL;
}
! hi = register_handle(handle, str);
if (authed_users) {
hi->users = authed_users;
--- 2792,2796 ----
authed_users = NULL;
}
! hi = register_handle(handle, str, id);
if (authed_users) {
hi->users = authed_users;
Index: nickserv.h
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** nickserv.h 30 Jul 2002 02:15:11 -0000 1.35
--- nickserv.h 7 Aug 2002 03:02:18 -0000 1.36
***************
*** 73,76 ****
--- 73,77 ----
struct handle_info {
+ unsigned long int id;
struct nick_info *nicks; /* linked list of owned nicks */
struct string_list *masks;
|
|
From: Zoot <zo...@us...> - 2002-08-07 02:49:23
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv8341/src
Modified Files:
nickserv.c
Log Message:
Don't send spurious access denied messages when users register nicks.
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.187
retrieving revision 1.188
diff -C2 -r1.187 -r1.188
*** nickserv.c 7 Aug 2002 01:44:30 -0000 1.187
--- nickserv.c 7 Aug 2002 02:49:20 -0000 1.188
***************
*** 1507,1511 ****
return 0;
}
! if (is_valid_oper(user, 0, 0)) {
nick = (argc < 2) ? user->nick : (char*)argv[1];
if (!is_valid_nick(nick)) {
--- 1507,1511 ----
return 0;
}
! if (is_valid_oper(user, 0, 1)) {
nick = (argc < 2) ? user->nick : (char*)argv[1];
if (!is_valid_nick(nick)) {
|
|
From: Zoot <zo...@us...> - 2002-08-07 02:49:22
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv8360/src
Modified Files:
Tag: rel-1_1-branch
nickserv.c
Log Message:
Don't send spurious access denied messages when users register nicks.
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.170
retrieving revision 1.170.2.1
diff -C2 -r1.170 -r1.170.2.1
*** nickserv.c 18 Jun 2002 03:23:39 -0000 1.170
--- nickserv.c 7 Aug 2002 02:49:19 -0000 1.170.2.1
***************
*** 1557,1561 ****
return 0;
}
! if (is_valid_oper(user, 0, 0)) {
nick = (argc < 2) ? user->nick : (char*)argv[1];
if (!is_valid_nick(nick)) {
--- 1557,1561 ----
return 0;
}
! if (is_valid_oper(user, 0, 1)) {
nick = (argc < 2) ? user->nick : (char*)argv[1];
if (!is_valid_nick(nick)) {
|