#define GotProtoctl(x) ((x)->flags & FLAGS_PROTOCTL)
#define IsBlocked(x) ((x)->flags & FLAGS_BLOCKED)
#define GotCapab(x) ((x)->flags & FLAGS_GOTCAPAB)
-#ifdef NOSPOOF
#define IsNotSpoof(x) ((x)->nospoof == 0)
-#else
-#define IsNotSpoof(x) (1)
-#endif
#ifdef SEEUSERSTATS
#define SetStatsF(x) ((x)->umodes |= UMODE_STATS)
short lastsq; /* # of 2k blocks when sendqueued called last*/
dbuf sendQ; /* Outgoing message queue--if socket full */
dbuf recvQ; /* Hold for data incoming yet to be parsed */
-#ifdef NOSPOOF
uint32_t nospoof; /* Anti-spoofing random number */
-#endif
long oflag; /* Operator access flags -Cabal95 */
long proto; /* ProtoCtl options */
long sendM; /* Statistics: protocol messages send */
int ZLineExists (char *);
#endif
-#ifdef NOSPOOF
-/* From md5.c */
-void MD5Init (uint32_t[]);
-void MD5Transform (uint32_t[], uint32_t[]);
-#endif
/*
** m_functions execute protocol messages on this server:
time_t lastnick = (time_t) 0;
int differ = 1;
-#ifdef NOSPOOF
- uint32_t md5data[16];
- static uint32_t md5hash[4];
-#endif
/*
* If the user didn't specify a nickname, complain
parv[0], nick, sptr->lastnick);
}
else if (!sptr->name[0]) {
-#ifdef NOSPOOF
- /*
- * Client setting NICK the first time.
- *
- * Generate a random string for them to pong with.
- *
- * The first two are server specific. The intent is to randomize
- * things well.
- *
- * We use lots of junk here, but only "low cost" things.
- */
- md5data[0] = NOSPOOF_SEED01;
- md5data[1] = NOSPOOF_SEED02;
- md5data[2] = time (NULL);
- md5data[3] = me.sendM;
- md5data[4] = me.receiveM;
- md5data[5] = 0;
- md5data[6] = getpid ();
- md5data[7] = sptr->ip.s_addr;
- md5data[8] = sptr->fd;
- md5data[9] = 0;
- md5data[10] = 0;
- md5data[11] = 0;
- md5data[12] = md5hash[0]; /* previous runs... */
- md5data[13] = md5hash[1];
- md5data[14] = md5hash[2];
- md5data[15] = md5hash[3];
-
- /*
- * initialize the md5 buffer to known values
- */
- MD5Init (md5hash);
-
- /*
- * transform the above information into gibberish
- */
- MD5Transform (md5hash, md5data);
-
- /*
- * Never release any internal state of our generator. Instead,
- * use two parts of the returned hash and xor them to hide
- * both values.
- */
- sptr->nospoof = (md5hash[0] ^ md5hash[1]);
-
- /*
- * If on the odd chance it comes out zero, make it something
- * non-zero.
- */
+ sptr->nospoof = arc4random ();
if (sptr->nospoof == 0)
sptr->nospoof = 0xdeadbeef;
sendto_one (sptr, ":%s NOTICE %s :*** If you are having problems"
" type /notice %X nospoof now.",
me.name, nick, sptr->nospoof, sptr->nospoof);
sendto_one (sptr, "PING :%X", sptr->nospoof);
-#endif /* NOSPOOF */
#ifdef CONTACT_EMAIL
sendto_one (sptr, ":%s NOTICE %s :*** If you need assistance with a"
NULL
};
-/* This is related to the test for unregistered users in
- * parse.c. Unless NOSPOOF is defined, there is no need to
- * test this here since m_notice and m_message are disallowed.
- * -Studded
- */
-
-#ifdef NOSPOOF
if (notice) {
if (check_registered (sptr))
return 0;
}
else if (check_registered_user (sptr))
return 0;
-#endif
sptr->flags &= ~FLAGS_TS8;
if ((cptr->name[0]) && !IsNotSpoof (cptr)) {
if (BadPtr (parv[1]))
return 0;
-#ifdef NOSPOOF
if (strtoul (parv[1], NULL, 16) != cptr->nospoof)
goto temp;
sptr->nospoof = 0;
-#endif
if (sptr->user && sptr->name[0])
return register_user (cptr, sptr, sptr->name,
sptr->user->username);
return 0;
}
-#ifdef NOSPOOF
temp:
-#endif
return m_message (cptr, sptr, parc, parv, 1);
return 0;
}
return 0;
}
-#ifdef NOSPOOF
/*
** m_nospoof - allows clients to respond to no spoofing patch
** parv[0] = prefix
cptr->nospoof, me.name, cptr->name, (char) 1, (char) 1);
return 0;
}
-#endif /* NOSPOOF */
/*
** m_pong
aClient *acptr;
char *origin, *destination;
-#ifdef NOSPOOF
if (!IsRegistered (cptr))
return m_nospoof (cptr, sptr, parc, parv);
-#endif
if (parc < 2 || *parv[1] == '\0') {
sendto_one (sptr, err_str (ERR_NOORIGIN), me.name, parv[0]);