#undef COMMENT_IS_FILE
-/* #undef DEBUGMODE *//* define DEBUGMODE to enable debugging mode.*/
-//#define DEBUGMODE
+/* #undef DEBUGMODE */ /* define DEBUGMODE to enable debugging mode */
/*
* Defining FORCE_CORE will automatically "unlimit core", forcing the
extern int find_dccblock (char *);
extern int find_restrict (aClient *);
extern int rehash (aClient *, aClient *, int);
-// fixme: this is used 2 diffrent ways depending on the file ?
extern int initconf (int);
-// extern aConfItem *initconf();
extern void add_temp_conf();
extern void inittoken ();
extern int do_channel_synch(char *);
extern Ban *make_ban ();
extern anUser *make_user (aClient *);
extern aSqlineItem *make_sqline ();
-//extern aJinxItem *make_jinx ();
extern aConfItem *make_conf ();
extern aClass *make_class ();
extern aServer *make_server ();
#define FLAGS_PING 0x80000 /* UPING SENT */
#define FLAGS_ASKEDPING 0x100000 /* UPONG GOT*/
-//#define FLAGS_SJOIN 0x1000000 /* have SJOIN */
#define FLAGS_MAP 0x2000000 /* Show this entry in /map */
#define FLAGS_JOINING 0x4000000 /* Prevent user from getting killed during JOIN */
-//#define FLAGS_SNICK 0x8000000 /* have SNICK */
/* Need more flags - here's flags2 */
#define UMODE_INVISIBLE 0x0001 /* makes user invisible */
#define UMODE_OPER 0x0002 /* Operator */
-//#define UMODE_WEBTV 0x0004 /* WebTV user */
#define UMODE_FAILOP 0x0008 /* Shows some global messages */
/* mode 0x0010 available */
#define UMODE_REGMSGONLY 0x0020 /* Only registered users may message */
char host[HOSTLEN+1];
char mask[HOSTLEN+1];
char server[HOSTLEN+1];
-// char hidden[5]; /* Used for /whowas masking -GZ */
/*
** In a perfect world the 'server' name
** should not be needed, a pointer to the
char version[REALLEN+1]; /* version of the client (servers only) -GZ */
int jinx; /* Tag for jinx */
int cc; /* Cline client-check for connect -GZ */
-// char hidden[5]; /* Used for /whowas masking -GZ */
aClient *srvptr; /* Server introducing this. May be &me */
Link *history; /* Whowas linked list */
/*
#include "h.h"
-/* Quick & dirty inline version of mycmp for hash-tables -Donwulff */
+/* Case-insensitive string compare; jumps to label 'where' on match */
#define thecmp(str1, str2, where) { \
char *st1=str1, *st2=str2; \
while (tolower(*st1)==tolower(*st2)) \
}
#endif /*CHROOTDIR/UID/GID */
- /* didn't set debuglevel */
- /* but asked for debugging output to tty */
- /*
- if ((debuglevel < 0) && (bootopt & BOOT_TTY)) {
- (void) fprintf(stderr,
- "you specified -t without -x. use -x <n>\n");
- exit(-1);
- }
- */
if (argc > 0)
return bad_command (); /* This should exit out */
Link *lp;
int i;
- /* "caching" slab-allocator... ie. we're allocating one pages
- (hopefully - upped to the Linux default, not dbuf.c) worth of
- link-structures at time to avoid all the malloc overhead.
- All links left free from this process or separately freed
- by a call to free_link() are moved over to freelink-list.
- Impact? Let's see... -Donwulff */
+ /* Slab allocator: allocate LINKSIZE Link structs at once to
+ * reduce malloc overhead. Freed links go to the freelink list
+ * for reuse.
+ */
if (freelink == NULL) {
lp = (Link *) MyMalloc (LINKSIZE * sizeof (Link));
freelink = lp + 1;
#endif
strncpy(acptr->user->mask, return_user_mask(acptr->user->host), HOSTLEN +1) ;
- printf("check: %s \n",return_user_mask(acptr->user->host) );
#endif /* CLIENT_MASKING */
}
char static tmp[HOSTLEN + 1] ;
strncpy(tmp,crypt(data, salt),HOSTLEN) ;
- printf("%s/n",tmp) ;
return (tmp) ;
}
while (--length >= 0 && ch2) {
char g = (*ch1 = *ch2++);
- /*
- * Yuck. Stuck. To make sure we stay backward compatible,
- * we must assume that either CR or LF terminates the message
- * and not CR-LF. By allowing CR or LF (alone) into the body
- * of messages, backward compatibility is lost and major
- * problems will arise. - Avalon
+ /* Either CR or LF alone terminates a message, not just
+ * CR-LF. Allowing bare CR or LF in message bodies would
+ * break compatibility with older implementations.
*/
if (g < '\16' && (g == '\n' || g == '\r')) {
if (ch1 == cptr->buffer)
len = (s) ? (s - ch) : 0;
if (len == 3 && isdigit (*ch) && isdigit (*(ch + 1))
&& isdigit (*(ch + 2))) {
+ /* IRC numeric reply: exactly 3 decimal digits */
mptr = NULL;
numeric =
(*ch - '0') * 100 + (*(ch + 1) - '0') * 10 + (*(ch + 2) - '0');
server.sin_addr.s_addr = inet_addr (ipname);
server.sin_port = htons (port);
/*
- * Try 10 times to bind the socket with an interval of 20
- * seconds. Do this so we dont have to keepp trying manually
- * to bind. Why ? Because a port that has closed often lingers
- * around for a short time.
- * This used to be the case. Now it no longer is.
- * Could cause the server to hang for too long - avalon
*/
if (bind (cptr->fd, (struct sockaddr *) &server, sizeof (server)) ==
-1) {
(void) close (cptr->fd);
return -1;
}
- if (cptr == &me) { /* KLUDGE to get it work... */
+ if (cptr == &me) { /* Report port to stdout during startup */
char buf[1024];
(void) sprintf (buf, rpl_str (RPL_MYPORTIS), me.name, "*",
return -2;
check_serverback:
+ /* Verify connecting server's IP matches DNS, then search for
+ * matching C/N lines. If hp is NULL but hostp exists, retry
+ * with the resolver's cached result.
+ */
if (hp) {
for (i = 0; hp->h_addr_list[i]; i++)
if (!memcmp (hp->h_addr_list[i], (char *) &cptr->ip, sizeof (struct in_addr)))
break;
det_confs_butmask (cptr, 0);
- cptr->from = NULL; /* ...this should catch them! >:) --msa */
+ cptr->from = NULL;
/*
- * fd remap to keep local[i] filled at the bottom.
+ * Move highest fd down to fill the gap left by the closed
+ * connection, keeping the local[] array compact. Skip log fds.
*/
if (empty > 0)
if ((j = highest_fd) > (i = empty) && (local[j]->status != STAT_LOG)) {
#include <arpa/inet.h>
#include "h.h"
-#define debug 1
static int lookup_confhost (aConfItem *);
static int advanced_check (char *, int);
int ZLineExists (char *);
if (IsIllegal (aconf))
continue;
- for (;;) { /* Fake loop, that I can use break here --msa */
- /* Yes I know this could be much cleaner, but I did not
- * want to put it into its own separate function, but
- * I believe the X:should be like this:
- * X:restartpass:diepass
- * which leaves this code untouched. This is already indented
- * enough to justify that...
+ for (;;) { /* Parse remaining fields; break on missing field */
+ /* X: line format is X:restartpass:diepass
*/
if ((tmp = getfield (NULL)) == NULL)
break;
return; /* ...must *never* exit self!! */
}
else if (IsServer (sptr)) {
- /*
- ** Old sendto_serv_but_one() call removed because we now
- ** need to send different names to different servers
- ** (domain name matching)
- */
+ /* Propagate SQUIT to each server link individually */
for (i = 0; i <= highest_fd; i++) {
aConfItem *aconf;
** - Avalon
*/
if (!IsMe (acptr) && IsPerson (acptr)) {
- /* Added for .U3.2. drop remote 'You are not on
- ** that channel', we should be synced anyway,
- ** and this is an annoying message with TSpre7
- ** still on the net; would result in numeric 442 for
- ** every KICK... Can be removed when TSpre7 is gone.
- ** --Run
+ /* Drop remote ERR_NOTONCHANNEL to avoid spurious
+ * 442 numerics during KICK propagation.
*/
if (numeric == ERR_NOTONCHANNEL)
return 0;
/*
* sendto_one_notice
*
- * sendto_one_notice should be used for all NOTICEs that might be
- * addressed to a remote user, *and* are from this server
- *
- * *** MAKE ME LOOK MORE PRETTY:
- * This really should not be here, but I'm too lazy to go change all
- * the notice calls below. Seeing as s_uping.c is the only place from
- * which it's called, and because it should really be removed, I've
- * put it here; instead of in send.c -TheShadow
+ * Sends a NOTICE to a client, prefixing with "NOTICE nick :".
+ * Used by the UPING subsystem.
*/
void sendto_one_notice (aClient *to, char *pattern, ...)
{
if (cptr->acpt)
sendto_one_notice (cptr->acpt, "UPING: sendto() failed: %s",
strerror (get_sockerr (cptr)));
-// Debug((DEBUG_SEND, "send_ping: sendto failed on %d (%d)", cptr->fd, err));
(void) end_ping (cptr);
}
else if (--(cptr->count) <= 0) {
int m_gnotice (aClient *cptr, aClient *sptr, int parc, char *parv[])
{
char *message;
-/* char *pv[4]; Compiler says this is not used */
if (check_registered (sptr))
return 0;
int m_globops (aClient *cptr, aClient *sptr, int parc, char *parv[])
{
char *message;
-/* char *pv[4]; Compiler says this is not used */
if (check_registered (sptr))
return 0;
int m_locops (aClient *cptr, aClient *sptr, int parc, char *parv[])
{
char *message;
-/* char *pv[4]; Compiler says this is not used */
if (check_registered_user (cptr))
return 0;
int m_goper (aClient *cptr, aClient *sptr, int parc, char *parv[])
{
char *message;
-/* char *pv[4]; Compiler says this is not used */
if (check_registered (sptr))
return 0;
if ((aconf = find_conf_name (parv[1], CONF_QUARANTINED_NICK))
|| (asqline = find_sqline_match (parv[1]))) {
-// fixme
-// char *qrsn = (aconf) ? aconf->passwd : asqline->reason;
char *qtyp = (aconf) ? "Q:Lined" : "SQLined";
if (!find_conf_host (cptr->confs, sptr->user->server, CONF_UWORLD))
"on non-existant server %s.", sptr->name, server);
strncpyzt (user->server, server, sizeof (user->server));
strncpyzt (user->host, host, sizeof (user->host));
- //strncpyzt(user->hidden, hidden, sizeof(user->hidden));
goto user_finish; }
else {
strncpyzt(sptr->sup_server, server, sizeof(sptr->sup_server));