-Unreal3.2-Selene (BETA2) RELEASE NOTES
+Unreal3.2-Selene (BETA4) RELEASE NOTES
======================================
I M P O R T A N T R E A D I N G
- Fixed a typo in config.h
- Final changes to prepare for beta3
- Fixed some bugreport stuff
+- Fixed codemastr-on-crack bug regarding oflag
+- Fixed a win32 bug where the http scanner didn't get loaded
+- Hopefully fixed the weird Z:line bug on win32?
+- Fixed the Z:line bug (caused by stskeeps-on-crack coding) reported by Power2All
+- Removed the tokens for /users, /summon, and /samode (these never come from a server so they don't need
+ it)
+- Added a utility to auto create version.c for win32. It's the worst coding I've ever done, but it works :P
+- Added a hell lot of DNS debugging code, and fixed the BIGENDIAN problem
+ with resolver. Thanks to dawn and Trash.net for shell on a sparc
+- Added umodes.c, long val = get_umode('c');
+- Added new umode system to win32 makefile
+- Made umode_delete(flag, mode);
+- made the umodestring variable smaller to conserve memory
+- Added M_RESETIDLE to fix a /privmsg bug
+- Fixed a bug with nickserv passwords found and fixed by Mathieu
+- Fixed a DEBUGMODE problem with umodes.c
+- Fixed a snomask bug found by Rob
+- Made the missing commands error a little more.. tardfriendly
+- Preperation for beta4
extern int m_umode(aClient *, aClient *, int, char **);
extern int m_names(aClient *, aClient *, int, char **);
extern int m_server_estab(aClient *);
+extern void umode_init(void);
+extern long umode_get(char ch);
extern void send_umode(aClient *, aClient *, long, long, char *);
extern void send_umode_out(aClient *, aClient *, long);
extern atime(char *xtime);
+/* Mode externs
+*/
+extern long UMODE_INVISIBLE; /* 0x0001 makes user invisible */
+extern long UMODE_OPER; /* 0x0002 Operator */
+extern long UMODE_WALLOP; /* 0x0004 send wallops to them */
+extern long UMODE_FAILOP; /* 0x0008 Shows some global messages */
+extern long UMODE_HELPOP; /* 0x0010 Help system operator */
+extern long UMODE_REGNICK; /* 0x0020 Nick set by services as registered */
+extern long UMODE_SADMIN; /* 0x0040 Services Admin */
+extern long UMODE_ADMIN; /* 0x0080 Admin */
+extern long UMODE_SERVNOTICE;/* 0x0100 server notices such as kill */
+extern long UMODE_LOCOP; /* 0x0200 Local operator -- SRB */
+extern long UMODE_RGSTRONLY; /* 0x0400 Only reg nick message */
+extern long UMODE_WEBTV; /* 0x0800 WebTV Client */
+extern long UMODE_SERVICES; /* 0x4000 services */
+extern long UMODE_HIDE; /* 0x8000 Hide from Nukes */
+extern long UMODE_NETADMIN; /* 0x10000 Network Admin */
+extern long UMODE_TECHADMIN; /* 0x40000 Tech Admin */
+extern long UMODE_COADMIN; /* 0x80000 Co Admin */
+extern long UMODE_WHOIS; /* 0x100000 gets notice on /whois */
+extern long UMODE_KIX; /* 0x200000 usermode +q */
+extern long UMODE_BOT; /* 0x400000 User is a bot */
+extern long UMODE_SECURE; /* 0x800000 User is a secure connect */
+extern long UMODE_HIDING; /* 0x2000000 Totally invisible .. */
+extern long UMODE_VICTIM; /* 0x8000000 Intentional Victim */
+extern long UMODE_DEAF; /* 0x10000000 Deaf */
+extern long UMODE_HIDEOPER; /* 0x20000000 Hide oper mode */
+extern long UMODE_SETHOST; /* 0x40000000 used sethost */
+extern long UMODE_STRIPBADWORDS; /* 0x80000000 */
+
+
+
extern int dopacket(aClient *, char *, int);
extern void debug(int, char *, ...);
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS `AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
*/
/*
- * @(#)nameser.h 8.1 (Berkeley) 6/2/93
- * $Id$
+ * @(#)nameser.h 8.1 (Berkeley) 6/2/93
+ * $NetBSD: nameser.h,v 1.14 2000/08/09 14:41:00 itojun Exp $
*/
+#ifndef _ARPA_NAMESER_H_
+#define _ARPA_NAMESER_H_
+
+#include <sys/param.h>
+
+#ifdef _AUX_SOURCE
+# include <sys/types.h>
+#endif
+
/*
* revision information. this is the release date in YYYYMMDD format.
* it can change every day so the right thing to do with it is use it
* is new enough to contain a certain feature.
*/
-#define __BIND 19960801 /* interface version stamp */
+#define __BIND 19960801 /* interface version stamp */
/*
* Define constants based on rfc883
*/
-#define PACKETSZ 512 /* maximum packet size */
-#define MAXDNAME 1025 /* maximum presentation domain name */
-#define MAXCDNAME 255 /* maximum compressed domain name */
-#define MAXLABEL 63 /* maximum length of domain label */
-#define HFIXEDSZ 12 /* #/bytes of fixed data in header */
-#define QFIXEDSZ 4 /* #/bytes of fixed data in query */
-#define RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
-#define INT32SZ 4 /* for systems without 32-bit ints */
-#define INT16SZ 2 /* for systems without 16-bit ints */
-#define INADDRSZ 4 /* IPv4 T_A */
-#define IN6ADDRSZ 16 /* IPv6 T_AAAA */
+#define PACKETSZ 512 /* maximum packet size */
+#define MAXDNAME 1025 /* maximum presentation domain name */
+#define MAXCDNAME 255 /* maximum compressed domain name */
+#define MAXLABEL 63 /* maximum length of domain label */
+#define HFIXEDSZ 12 /* #/bytes of fixed data in header */
+#define QFIXEDSZ 4 /* #/bytes of fixed data in query */
+#define RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
+#define INT32SZ 4 /* for systems without 32-bit ints */
+#define INT16SZ 2 /* for systems without 16-bit ints */
+#define INADDRSZ 4 /* IPv4 T_A */
+#define IN6ADDRSZ 16 /* IPv6 T_AAAA */
/*
* Internet nameserver port number
*/
-#define NAMESERVER_PORT 53
+#define NAMESERVER_PORT 53
/*
* Currently defined opcodes
*/
-#define QUERY 0x0 /* standard query */
-#define IQUERY 0x1 /* inverse query */
-#define STATUS 0x2 /* nameserver status query */
-/*#define xxx 0x3*/ /* 0x3 reserved */
-#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */
+#define QUERY 0x0 /* standard query */
+#define IQUERY 0x1 /* inverse query */
+#define STATUS 0x2 /* nameserver status query */
+/*#define xxx 0x3*/ /* 0x3 reserved */
+#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */
/*
* Currently defined response codes
*/
-#define NOERROR 0 /* no error */
-#define FORMERR 1 /* format error */
-#define SERVFAIL 2 /* server failure */
-#define NXDOMAIN 3 /* non existent domain */
-#define NOTIMP 4 /* not implemented */
-#define REFUSED 5 /* query refused */
+#define NOERROR 0 /* no error */
+#define FORMERR 1 /* format error */
+#define SERVFAIL 2 /* server failure */
+#define NXDOMAIN 3 /* non existent domain */
+#define NOTIMP 4 /* not implemented */
+#define REFUSED 5 /* query refused */
/*
* Type values for resources and queries
*/
-#define T_A 1 /* host address */
-#define T_NS 2 /* authoritative server */
-#define T_MD 3 /* mail destination */
-#define T_MF 4 /* mail forwarder */
-#define T_CNAME 5 /* canonical name */
-#define T_SOA 6 /* start of authority zone */
-#define T_MB 7 /* mailbox domain name */
-#define T_MG 8 /* mail group member */
-#define T_MR 9 /* mail rename name */
-#define T_NULL 10 /* null resource record */
-#define T_WKS 11 /* well known service */
-#define T_PTR 12 /* domain name pointer */
-#define T_HINFO 13 /* host information */
-#define T_MINFO 14 /* mailbox information */
-#define T_MX 15 /* mail routing information */
-#define T_TXT 16 /* text strings */
-#define T_RP 17 /* responsible person */
-#define T_AFSDB 18 /* AFS cell database */
-#define T_X25 19 /* X_25 calling address */
-#define T_ISDN 20 /* ISDN calling address */
-#define T_RT 21 /* router */
-#define T_NSAP 22 /* NSAP address */
-#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */
-#define T_SIG 24 /* security signature */
-#define T_KEY 25 /* security key */
-#define T_PX 26 /* X.400 mail mapping */
-#define T_GPOS 27 /* geographical position (withdrawn) */
-#define T_AAAA 28 /* IP6 Address */
-#define T_LOC 29 /* Location Information */
-#define T_NXT 30 /* Next Valid Name in Zone */
-#define T_EID 31 /* Endpoint identifier */
-#define T_NIMLOC 32 /* Nimrod locator */
-#define T_SRV 33 /* Server selection */
-#define T_ATMA 34 /* ATM Address */
-#define T_NAPTR 35 /* Naming Authority PoinTeR */
- /* non standard */
-#define T_UINFO 100 /* user (finger) information */
-#define T_UID 101 /* user ID */
-#define T_GID 102 /* group ID */
-#define T_UNSPEC 103 /* Unspecified format (binary data) */
- /* Query type values which do not appear in resource records */
-#define T_IXFR 251 /* incremental zone transfer */
-#define T_AXFR 252 /* transfer zone of authority */
-#define T_MAILB 253 /* transfer mailbox records */
-#define T_MAILA 254 /* transfer mail agent records */
-#define T_ANY 255 /* wildcard match */
+#define T_A 1 /* host address */
+#define T_NS 2 /* authoritative server */
+#define T_MD 3 /* mail destination */
+#define T_MF 4 /* mail forwarder */
+#define T_CNAME 5 /* canonical name */
+#define T_SOA 6 /* start of authority zone */
+#define T_MB 7 /* mailbox domain name */
+#define T_MG 8 /* mail group member */
+#define T_MR 9 /* mail rename name */
+#define T_NULL 10 /* null resource record */
+#define T_WKS 11 /* well known service */
+#define T_PTR 12 /* domain name pointer */
+#define T_HINFO 13 /* host information */
+#define T_MINFO 14 /* mailbox information */
+#define T_MX 15 /* mail routing information */
+#define T_TXT 16 /* text strings */
+#define T_RP 17 /* responsible person */
+#define T_AFSDB 18 /* AFS cell database */
+#define T_X25 19 /* X_25 calling address */
+#define T_ISDN 20 /* ISDN calling address */
+#define T_RT 21 /* router */
+#define T_NSAP 22 /* NSAP address */
+#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */
+#define T_SIG 24 /* security signature */
+#define T_KEY 25 /* security key */
+#define T_PX 26 /* X.400 mail mapping */
+#define T_GPOS 27 /* geographical position (withdrawn) */
+#define T_AAAA 28 /* IP6 Address */
+#define T_LOC 29 /* Location Information */
+#define T_NXT 30 /* Next Valid Name in Zone */
+#define T_EID 31 /* Endpoint identifier */
+#define T_NIMLOC 32 /* Nimrod locator */
+#define T_SRV 33 /* Server selection */
+#define T_ATMA 34 /* ATM Address */
+#define T_NAPTR 35 /* Naming Authority PoinTeR */
+#define T_OPT 41 /* OPT pseudo-RR, RFC2761 */
+ /* non standard */
+#define T_UINFO 100 /* user (finger) information */
+#define T_UID 101 /* user ID */
+#define T_GID 102 /* group ID */
+#define T_UNSPEC 103 /* Unspecified format (binary data) */
+ /* Query type values which do not appear in resource records */
+#define T_IXFR 251 /* incremental zone transfer */
+#define T_AXFR 252 /* transfer zone of authority */
+#define T_MAILB 253 /* transfer mailbox records */
+#define T_MAILA 254 /* transfer mail agent records */
+#define T_ANY 255 /* wildcard match */
/*
* Values for class field
*/
-#define C_IN 1 /* the arpa internet */
-#define C_CHAOS 3 /* for chaos net (MIT) */
-#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */
- /* Query class values which do not appear in resource records */
-#define C_ANY 255 /* wildcard match */
+#define C_IN 1 /* the arpa internet */
+#define C_CHAOS 3 /* for chaos net (MIT) */
+#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */
+ /* Query class values which do not appear in resource records */
+#define C_ANY 255 /* wildcard match */
/*
* Flags field of the KEY RR rdata
*/
-#define KEYFLAG_TYPEMASK 0xC000 /* Mask for "type" bits */
-#define KEYFLAG_TYPE_AUTH_CONF 0x0000 /* Key usable for both */
-#define KEYFLAG_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */
-#define KEYFLAG_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */
-#define KEYFLAG_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */
+#define KEYFLAG_TYPEMASK 0xC000 /* Mask for "type" bits */
+#define KEYFLAG_TYPE_AUTH_CONF 0x0000 /* Key usable for both */
+#define KEYFLAG_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */
+#define KEYFLAG_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */
+#define KEYFLAG_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */
/* The type bits can also be interpreted independently, as single bits: */
-#define KEYFLAG_NO_AUTH 0x8000 /* Key not usable for authentication */
-#define KEYFLAG_NO_CONF 0x4000 /* Key not usable for confidentiality */
-
-#define KEYFLAG_EXPERIMENTAL 0x2000 /* Security is *mandatory* if bit=0 */
-#define KEYFLAG_RESERVED3 0x1000 /* reserved - must be zero */
-#define KEYFLAG_RESERVED4 0x0800 /* reserved - must be zero */
-#define KEYFLAG_USERACCOUNT 0x0400 /* key is assoc. with a user acct */
-#define KEYFLAG_ENTITY 0x0200 /* key is assoc. with entity eg host */
-#define KEYFLAG_ZONEKEY 0x0100 /* key is zone key for the zone named */
-#define KEYFLAG_IPSEC 0x0080 /* key is for IPSEC use (host or user)*/
-#define KEYFLAG_EMAIL 0x0040 /* key is for email (MIME security) */
-#define KEYFLAG_RESERVED10 0x0020 /* reserved - must be zero */
-#define KEYFLAG_RESERVED11 0x0010 /* reserved - must be zero */
-#define KEYFLAG_SIGNATORYMASK 0x000F /* key can sign DNS RR's of same name */
+#define KEYFLAG_NO_AUTH 0x8000 /* Key not usable for authentication */
+#define KEYFLAG_NO_CONF 0x4000 /* Key not usable for confidentiality */
+
+#define KEYFLAG_EXPERIMENTAL 0x2000 /* Security is *mandatory* if bit=0 */
+#define KEYFLAG_RESERVED3 0x1000 /* reserved - must be zero */
+#define KEYFLAG_RESERVED4 0x0800 /* reserved - must be zero */
+#define KEYFLAG_USERACCOUNT 0x0400 /* key is assoc. with a user acct */
+#define KEYFLAG_ENTITY 0x0200 /* key is assoc. with entity eg host */
+#define KEYFLAG_ZONEKEY 0x0100 /* key is zone key for the zone named */
+#define KEYFLAG_IPSEC 0x0080 /* key is for IPSEC use (host or user)*/
+#define KEYFLAG_EMAIL 0x0040 /* key is for email (MIME security) */
+#define KEYFLAG_RESERVED10 0x0020 /* reserved - must be zero */
+#define KEYFLAG_RESERVED11 0x0010 /* reserved - must be zero */
+#define KEYFLAG_SIGNATORYMASK 0x000F /* key can sign DNS RR's of same name */
#define KEYFLAG_RESERVED_BITMASK ( KEYFLAG_RESERVED3 | \
- KEYFLAG_RESERVED4 | \
- KEYFLAG_RESERVED10| KEYFLAG_RESERVED11)
+ KEYFLAG_RESERVED4 | \
+ KEYFLAG_RESERVED10| KEYFLAG_RESERVED11)
/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
-#define ALGORITHM_MD5RSA 1 /* MD5 with RSA */
-#define ALGORITHM_EXPIRE_ONLY 253 /* No alg, no security */
-#define ALGORITHM_PRIVATE_OID 254 /* Key begins with OID indicating alg */
+#define ALGORITHM_MD5RSA 1 /* MD5 with RSA */
+#define ALGORITHM_EXPIRE_ONLY 253 /* No alg, no security */
+#define ALGORITHM_PRIVATE_OID 254 /* Key begins with OID indicating alg */
/* Signatures */
- /* Size of a mod or exp in bits */
-#define MIN_MD5RSA_KEY_PART_BITS 512
-#define MAX_MD5RSA_KEY_PART_BITS 2552
- /* Total of binary mod and exp, bytes */
-#define MAX_MD5RSA_KEY_BYTES ((MAX_MD5RSA_KEY_PART_BITS+7/8)*2+3)
- /* Max length of text sig block */
-#define MAX_KEY_BASE64 (((MAX_MD5RSA_KEY_BYTES+2)/3)*4)
+ /* Size of a mod or exp in bits */
+#define MIN_MD5RSA_KEY_PART_BITS 512
+#define MAX_MD5RSA_KEY_PART_BITS 2552
+ /* Total of binary mod and exp, bytes */
+#define MAX_MD5RSA_KEY_BYTES ((MAX_MD5RSA_KEY_PART_BITS+7/8)*2+3)
+ /* Max length of text sig block */
+#define MAX_KEY_BASE64 (((MAX_MD5RSA_KEY_BYTES+2)/3)*4)
/*
* Status return codes for T_UNSPEC conversion routines
*/
-#define CONV_SUCCESS 0
-#define CONV_OVERFLOW (-1)
-#define CONV_BADFMT (-2)
-#define CONV_BADCKSUM (-3)
-#define CONV_BADBUFLEN (-4)
+#define CONV_SUCCESS 0
+#define CONV_OVERFLOW (-1)
+#define CONV_BADFMT (-2)
+#define CONV_BADCKSUM (-3)
+#define CONV_BADBUFLEN (-4)
+
+#ifndef BYTE_ORDER
+#if (BSD >= 199103)
+# include <machine/endian.h>
+#else
+#ifdef linux
+# include <endian.h>
+#else
+#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */
+#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
+#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/
+
+#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \
+ defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \
+ defined(__alpha__) || defined(__alpha) || defined(__vax__)
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
+
+#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
+ defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
+ defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\
+ defined(apollo) || defined(__convex__) || defined(_CRAY) || \
+ defined(__hppa) || defined(__hp9000) || \
+ defined(__hp9000s300) || defined(__hp9000s700) || \
+ defined (BIT_ZERO_ON_LEFT) || defined(m68k)
+#define BYTE_ORDER BIG_ENDIAN
+#endif
+#endif /* linux */
+#endif /* BSD */
+#endif /* BYTE_ORDER */
+
+#if !defined(BYTE_ORDER) || \
+ (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \
+ BYTE_ORDER != PDP_ENDIAN)
+ /* you must determine what the correct bit order is for
+ * your compiler - the next line is an intentional error
+ * which will force your compiles to bomb until you fix
+ * the above macros.
+ */
+ error "Undefined or invalid BYTE_ORDER";
+#endif
/*
* Structure for query header. The order of the fields is machine- and
*/
typedef struct {
- unsigned id :16; /* query identification number */
-#if WORDS_BIGENDIAN
- /* fields in third byte */
- unsigned qr: 1; /* response flag */
- unsigned opcode: 4; /* purpose of message */
- unsigned aa: 1; /* authoritive answer */
- unsigned tc: 1; /* truncated message */
- unsigned rd: 1; /* recursion desired */
- /* fields in fourth byte */
- unsigned ra: 1; /* recursion available */
- unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
- unsigned ad: 1; /* authentic data from named */
- unsigned cd: 1; /* checking disabled by resolver */
- unsigned rcode :4; /* response code */
-#else /* WORDS_BIGENDIAN */
- /* fields in third byte */
- unsigned rd :1; /* recursion desired */
- unsigned tc :1; /* truncated message */
- unsigned aa :1; /* authoritive answer */
- unsigned opcode :4; /* purpose of message */
- unsigned qr :1; /* response flag */
- /* fields in fourth byte */
- unsigned rcode :4; /* response code */
- unsigned cd: 1; /* checking disabled by resolver */
- unsigned ad: 1; /* authentic data from named */
- unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
- unsigned ra :1; /* recursion available */
-#endif /* WORDS_BIGENDIAN */
- /* remaining bytes */
- unsigned qdcount :16; /* number of question entries */
- unsigned ancount :16; /* number of answer entries */
- unsigned nscount :16; /* number of authority entries */
- unsigned arcount :16; /* number of resource entries */
+ unsigned id :16; /* query identification number */
+#if BYTE_ORDER == BIG_ENDIAN
+ /* fields in third byte */
+ unsigned qr: 1; /* response flag */
+ unsigned opcode: 4; /* purpose of message */
+ unsigned aa: 1; /* authoritive answer */
+ unsigned tc: 1; /* truncated message */
+ unsigned rd: 1; /* recursion desired */
+ /* fields in fourth byte */
+ unsigned ra: 1; /* recursion available */
+ unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
+ unsigned ad: 1; /* authentic data from named */
+ unsigned cd: 1; /* checking disabled by resolver */
+ unsigned rcode :4; /* response code */
+#endif
+#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
+ /* fields in third byte */
+ unsigned rd :1; /* recursion desired */
+ unsigned tc :1; /* truncated message */
+ unsigned aa :1; /* authoritive answer */
+ unsigned opcode :4; /* purpose of message */
+ unsigned qr :1; /* response flag */
+ /* fields in fourth byte */
+ unsigned rcode :4; /* response code */
+ unsigned cd: 1; /* checking disabled by resolver */
+ unsigned ad: 1; /* authentic data from named */
+ unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
+ unsigned ra :1; /* recursion available */
+#endif
+ /* remaining bytes */
+ unsigned qdcount :16; /* number of question entries */
+ unsigned ancount :16; /* number of answer entries */
+ unsigned nscount :16; /* number of authority entries */
+ unsigned arcount :16; /* number of resource entries */
} HEADER;
/*
* Defines for handling compressed domain names
*/
-#define INDIR_MASK 0xc0
+#define INDIR_MASK 0xc0
+
/*
* Inline versions of get/put short/long. Pointer is advanced.
* portable or it can be elegant but rarely both.
*/
#define GETSHORT(s, cp) { \
- register u_char *t_cp = (u_char *)(cp); \
- (s) = ((u_int16_t)t_cp[0] << 8) \
- | ((u_int16_t)t_cp[1]) \
- ; \
- (cp) += INT16SZ; \
+ register const u_char *t_cp = (const u_char *)(cp); \
+ (s) = ((const u_int16_t)t_cp[0] << 8) \
+ | ((const u_int16_t)t_cp[1]) \
+ ; \
+ (cp) += INT16SZ; \
}
#define GETLONG(l, cp) { \
- register u_char *t_cp = (u_char *)(cp); \
- (l) = ((u_int32_t)t_cp[0] << 24) \
- | ((u_int32_t)t_cp[1] << 16) \
- | ((u_int32_t)t_cp[2] << 8) \
- | ((u_int32_t)t_cp[3]) \
- ; \
- (cp) += INT32SZ; \
+ register const u_char *t_cp = (const u_char *)(cp); \
+ (l) = ((const u_int32_t)t_cp[0] << 24) \
+ | ((const u_int32_t)t_cp[1] << 16) \
+ | ((const u_int32_t)t_cp[2] << 8) \
+ | ((const u_int32_t)t_cp[3]) \
+ ; \
+ (cp) += INT32SZ; \
}
#define PUTSHORT(s, cp) { \
- register u_int16_t t_s = (u_int16_t)(s); \
- register u_char *t_cp = (u_char *)(cp); \
- *t_cp++ = t_s >> 8; \
- *t_cp = t_s; \
- (cp) += INT16SZ; \
+ register u_int16_t t_s = (u_int16_t)(s); \
+ register u_char *t_cp = (u_char *)(cp); \
+ *t_cp++ = (u_int32_t)t_s >> 8; \
+ *t_cp = t_s; \
+ (cp) += INT16SZ; \
}
#define PUTLONG(l, cp) { \
- register u_int32_t t_l = (u_int32_t)(l); \
- register u_char *t_cp = (u_char *)(cp); \
- *t_cp++ = t_l >> 24; \
- *t_cp++ = t_l >> 16; \
- *t_cp++ = t_l >> 8; \
- *t_cp = t_l; \
- (cp) += INT32SZ; \
+ register u_int32_t t_l = (u_int32_t)(l); \
+ register u_char *t_cp = (u_char *)(cp); \
+ *t_cp++ = t_l >> 24; \
+ *t_cp++ = t_l >> 16; \
+ *t_cp++ = t_l >> 8; \
+ *t_cp = t_l; \
+ (cp) += INT32SZ; \
}
+
+#endif /* _ARPA_NAMESER_H_ */
+
#define MAXBANLENGTH 1024
#define MAXSILES 5
#define MAXSILELENGTH 128
+#define UMODETABLESZ (sizeof(long) * 8)
/*
* Watch it - Don't change this unless you also change the ERR_TOOMANYWATCH
* and PROTOCOL_SUPPORTED settings.
* -DuffJ
*/
-#define UMODE_INVISIBLE 0x0001 /* makes user invisible */
-#define UMODE_OPER 0x0002 /* Operator */
-#define UMODE_WALLOP 0x0004 /* send wallops to them */
-#define UMODE_FAILOP 0x0008 /* Shows some global messages */
-#define UMODE_HELPOP 0x0010 /* Help system operator */
-#define UMODE_REGNICK 0x0020 /* Nick set by services as registered */
-#define UMODE_SADMIN 0x0040 /* Services Admin */
-#define UMODE_ADMIN 0x0080 /* Admin */
-#define UMODE_SERVNOTICE 0x0100 /* server notices such as kill */
-#define UMODE_LOCOP 0x0200 /* Local operator -- SRB */
-#define UMODE_RGSTRONLY 0x0400 /* Only reg nick message */
-#define UMODE_WEBTV 0x0800 /* WebTV Client */
-#define UMODE_SERVICES 0x4000 /* services */
-#define UMODE_HIDE 0x8000 /* Hide from Nukes */
-#define UMODE_NETADMIN 0x10000 /* Network Admin */
-#define UMODE_TECHADMIN 0x40000 /* Tech Admin */
-#define UMODE_COADMIN 0x80000 /* Co Admin */
-#define UMODE_WHOIS 0x100000 /* gets notice on /whois */
-#define UMODE_KIX 0x200000 /* usermode +q */
-#define UMODE_BOT 0x400000 /* User is a bot */
-#define UMODE_SECURE 0x800000 /* User is a secure connect */
-#define UMODE_FCLIENT 0x1000000 /* recieve client on far connects.. */
-#define UMODE_HIDING 0x2000000 /* Totally invisible .. */
-#define UMODE_VICTIM 0x8000000 /* Intentional Victim */
-#define UMODE_DEAF 0x10000000
-#define UMODE_HIDEOPER 0x20000000 /* Hide oper mode */
-#define UMODE_SETHOST 0x40000000 /* used sethost */
-#define UMODE_STRIPBADWORDS 0x80000000 /* */
#define SNO_KILLS 0x0001
#define SNO_CLIENT 0x0002
#define SNO_DEFOPER "+kcfvG"
#define SNO_DEFUSER "+k"
-#define SEND_UMODES (UMODE_INVISIBLE|UMODE_OPER|UMODE_WALLOP|UMODE_FAILOP|UMODE_HELPOP|UMODE_RGSTRONLY|UMODE_REGNICK|UMODE_SADMIN|UMODE_NETADMIN|UMODE_TECHADMIN|UMODE_COADMIN|UMODE_ADMIN|UMODE_SERVICES|UMODE_HIDE|UMODE_WHOIS|UMODE_KIX|UMODE_BOT|UMODE_SECURE|UMODE_FCLIENT|UMODE_HIDING|UMODE_DEAF|UMODE_VICTIM|UMODE_HIDEOPER|UMODE_SETHOST|UMODE_STRIPBADWORDS|UMODE_WEBTV)
+#define SEND_UMODES (UMODE_INVISIBLE|UMODE_OPER|UMODE_WALLOP|UMODE_FAILOP|UMODE_HELPOP|UMODE_RGSTRONLY|UMODE_REGNICK|UMODE_SADMIN|UMODE_NETADMIN|UMODE_TECHADMIN|UMODE_COADMIN|UMODE_ADMIN|UMODE_SERVICES|UMODE_HIDE|UMODE_WHOIS|UMODE_KIX|UMODE_BOT|UMODE_SECURE|UMODE_HIDING|UMODE_DEAF|UMODE_VICTIM|UMODE_HIDEOPER|UMODE_SETHOST|UMODE_STRIPBADWORDS|UMODE_WEBTV)
#define ALL_UMODES (SEND_UMODES|UMODE_SERVNOTICE|UMODE_LOCOP|UMODE_SERVICES)
#define FLAGS_ID (FLAGS_DOID|FLAGS_GOTID)
#define M_SHUN 0x0008
#define M_NOLAG 0x0010
#define M_ALIAS 0x0020
+#define M_RESETIDLE 0x0040
struct Command {
aCommand *next;
extern ircstats IRCstats;
+typedef struct {
+ long mode;
+ char flag;
+} aUMtable;
+
+extern aUMtable *Usermode_Table;
+extern short Usermode_highest;
+
#define LISTENER_NORMAL 0x000001
#define LISTENER_CLIENTSONLY 0x000002
#define PATCH1 "3"
#define PATCH2 ".2"
#define PATCH3 "-Selene"
-#define PATCH4 "[beta3]"
+#define PATCH4 "[beta4]"
#define PATCH5 ""
#define PATCH6 ""
#define PATCH7 ""
SRC/VERSION.OBJ SRC/S_UNREAL.OBJ SRC/RES_INIT.OBJ \
SRC/S_KLINE.OBJ SRC/S_EXTRA.OBJ SRC/IRCSPRINTF.OBJ SRC/LUSERS.OBJ \
SRC/SCACHE.OBJ SRC/ALN.OBJ SRC/BADWORDS.OBJ SRC/WEBTV.OBJ SRC/RES.OBJ SRC/MODULES.OBJ \
- SRC/S_SVS.OBJ SRC/EVENTS.OBJ
+ SRC/S_SVS.OBJ SRC/EVENTS.OBJ SRC/UMODES.OBJ
MOD_FILES=SRC/L_COMMANDS.OBJ SRC/M_CHGHOST.OBJ SRC/M_SDESC.OBJ SRC/M_SETIDENT.OBJ \
SRC/M_SETNAME.OBJ SRC/M_SETHOST.OBJ SRC/M_CHGIDENT.OBJ SRC/M_SVSMOTD.OBJ \
SRC/SCAN.OBJ SRC/SCAN_SOCKS.OBJ SRC/SCAN_HTTP.OBJ
-ALL: WIRCD.EXE
+ALL: CONF WIRCD.EXE
CLEAN:
- -@erase src\*.exe 2>NUL
- -@erase src\*.obj 2>NUL
- -@erase src\win32.res 2>NUL
- -@erase src\version.c 2>NUL
- -@erase src\win32\*.obj 2>NUL
- -@erase .\*.exe 2>NUL
-
+ -@erase src\*.obj >NUL
+ -@erase src\win32.res >NUL
+ -@erase src\version.c >NUL
+ -@erase src\win32\*.obj >NUL
+ -@erase .\*.exe >NUL
+CONF:
+ -@copy include\win32\setup.h include\setup.h >NUL
+ $(CC) src/win32/config.c
+ -@config.exe
./WIRCD.EXE: $(OBJ_FILES) $(MOD_FILES) SRC/win32/WIN32.RES
$(LINK) $(LFLAGS) $(OBJ_FILES) $(MOD_FILES) SRC/win32/WIN32.RES SRC/WIN32/GNU_REGEX.LIB SRC/WIN32/DEBUG/STACKTRACE.LIB /MAPINFO:LINES /MAP
src/events.obj: src/events.c $(INCLUDES)
$(CC) $(CFLAGS) src/events.c
+src/umodes.obj: src/umodes.c $(INCLUDES)
+ $(CC) $(CFLAGS) src/umodes.c
+
src/l_commands.obj: src/modules/l_commands.c $(INCLUDES)
$(CC) $(CFLAGS) src/modules/l_commands.c
res_init.o res_comp.o res_mkquery.o res_skipname.o s_auth.o \
s_bsd.o s_conf.o s_debug.o s_err.o s_extra.o s_kline.o \
s_misc.o s_numeric.o s_serv.o s_svs.o $(STRTOUL) socket.o \
- ssl.o s_unreal.o \
- s_user.o scache.o send.o support.o version.o webtv.o \
- whowas.o zip.o
+ ssl.o s_unreal.o s_user.o scache.o send.o support.o umodes.o \
+ version.o webtv.o whowas.o zip.o
SRC=$(OBJS:%.o=%.c)
support.o: support.c $(INCLUDES)
$(CC) $(CFLAGS) -c support.c
+umodes.o: umodes.c $(INCLUDES)
+ $(CC) $(CFLAGS) -c umodes.c
+
userload.o: userload.c $(INCLUDES)
$(CC) $(CFLAGS) -c userload.c
bzero((char *)&me, sizeof(me));
setup_signals();
init_ircstats();
+ umode_init();
clear_scache_hash_table();
#ifdef FORCE_CORE
corelim.rlim_cur = corelim.rlim_max = RLIM_INFINITY;
user->lopt = NULL;
user->whowas = NULL;
user->snomask = 0;
+ user->oflag = 0;
user->virthost = MyMalloc(5);
*user->virthost = '\0';
cptr->user = user;
#ifdef SCAN_API
extern MSymbolTable scan_socks_depend[];
+extern MSymbolTable scan_http_depend[];
#endif
/* Place includes here */
#endif
#ifdef SCAN_API
module_depend_resolve(&scan_socks_depend[0]);
+ module_depend_resolve(&scan_http_depend[0]);
m_scan_init(module_load);
scan_socks_init(module_load);
+ scan_http_init(module_load);
#endif
}
#ifdef SCAN_API
m_scan_load(module_load);
scan_socks_load(module_load);
+ scan_http_load(module_load);
#endif
}
#endif
#ifdef SCAN_API
scan_socks_unload();
+ scan_http_unload();
m_scan_unload();
#endif
}
/*
* We call our add_Command crap here
*/
- add_Command(MSG_PRIVATE, TOK_PRIVATE, m_private, MAXPARA);
+ add_CommandX(MSG_PRIVATE, TOK_PRIVATE, m_private, MAXPARA, M_USER|M_SERVER|M_RESETIDLE);
add_Command(MSG_NOTICE, TOK_NOTICE, m_notice, MAXPARA);
}
DLLFUNC int m_svs2mode(aClient *cptr, aClient *sptr, int parc, char *parv[]);
extern ircstats IRCstats;
-extern int user_modes[];
#define MSG_SVSMODE "SVSMODE"
#define TOK_SVSMODE "n"
#define MSG_SVS2MODE "SVS2MODE"
int parc;
char *parv[];
{
- int flag;
- int *s;
+ int i;
char **p, *m;
aClient *acptr;
int what, setflags;
if (!(acptr = find_person(parv[1], NULL)))
return 0;
setflags = 0;
- for (s = user_modes; (flag = *s); s += 2)
- if (acptr->umodes & flag)
- setflags |= flag;
+ for (i = 0; i <= Usermode_highest; i++)
+ if (Usermode_Table[i].flag && (acptr->umodes & Usermode_Table[i].mode))
+ setflags |= Usermode_Table[i].mode;
/*
* parse mode change string(s)
*/
}
default:
setmodex:
- for (s = user_modes; (flag = *s); s += 2)
- if (*m == (char)(*(s + 1)))
+ for (i = 0; i <= Usermode_highest; i++)
+ {
+ if (!Usermode_Table[i].flag)
+ continue;
+ if (*m == Usermode_Table[i].flag)
{
if (what == MODE_ADD)
- acptr->umodes |= flag;
+ acptr->umodes |= Usermode_Table[i].mode;
else
acptr->umodes &=
- ~flag;
+ ~Usermode_Table[i].mode;
break;
}
+ }
break;
}
if (parc > 3)
int parc;
char *parv[];
{
- int flag;
- int *s;
+ int i;
char **p, *m;
aClient *acptr;
int what, setflags;
return 0;
setflags = 0;
- for (s = user_modes; (flag = *s); s += 2)
- if (acptr->umodes & flag)
- setflags |= flag;
- /*
+ for (i = 0; i <= Usermode_highest; i++)
+ if (Usermode_Table[i].flag && (acptr->umodes & Usermode_Table[i].mode))
+ setflags |= Usermode_Table[i].mode;
+ /*
* parse mode change string(s)
*/
for (p = &parv[2]; p && *p; p++)
IRCstats.operators--;
default:
setmodey:
- for (s = user_modes; (flag = *s); s += 2)
- if (*m == (char)(*(s + 1)))
+ for (i = 0; i <= Usermode_highest; i++)
+ {
+ if (!Usermode_Table[i].flag)
+ continue;
+ if (*m == Usermode_Table[i].flag)
{
if (what == MODE_ADD)
- acptr->umodes |= flag;
+ acptr->umodes |= Usermode_Table[i].mode;
else
acptr->umodes &=
- ~flag;
+ ~Usermode_Table[i].mode;
break;
+
}
+ }
break;
}
/* Externally defined stuffs */
extern int lifesux;
-extern int user_modes[];
int build_searchopts(aClient *sptr, int parc, char *parv[])
}
s = parv[args];
while (*s) {
- for (i = 1; user_modes[i] != 0x0; i += 2) {
- if (*s == (char)user_modes[i]) {
+ for (i = 0; i <= Usermode_highest; i++) {
+ if (*s == Usermode_Table[i].flag) {
wsopts.umodes |=
- user_modes[i - 1];
+ Usermode_Table[i].mode;
break;
}
}
ConfigItem_blackhole blackhole_conf;
char blackhole_stop = 0;
SOCKET blackholefd = 0;
-static struct SOCKADDR_IN blackholesin;
+struct SOCKADDR_IN blackholesin;
/* Some prototypes .. aint they sweet? */
DLLFUNC int h_scan_connect(aClient *sptr);
DLLFUNC EVENT (HS_Cleanup);
i = 0;
HS_Cleanup(NULL);
IRCMutexLock(HSlock);
- for (j = 0; j <= SCAN_AT_ONCE; j++)
+ for (j = 0; j < SCAN_AT_ONCE; j++)
if (Hosts[i].host[0])
i++;
IRCMutexUnlock(HSlock);
i = 0;
VS_Ban(NULL);
IRCMutexLock(VSlock);
- for (j = 0; j <= SCAN_AT_ONCE; j++)
+ for (j = 0; j < SCAN_AT_ONCE; j++)
if (VHosts[i].host[0])
i++;
IRCMutexUnlock(VSlock);
{
int i;
- for (i = 0; i <= SCAN_AT_ONCE; i++)
+ for (i = 0; i < SCAN_AT_ONCE; i++)
if (!(*Hosts[i].host))
{
strcpy(Hosts[i].host, host);
{
int i;
- for (i = 0; i <= SCAN_AT_ONCE; i++)
+ for (i = 0; i < SCAN_AT_ONCE; i++)
if (!(*VHosts[i].host))
{
strcpy(VHosts[i].host, host);
{
int i;
- for (i = 0; i <= SCAN_AT_ONCE; i++)
+ for (i = 0; i < SCAN_AT_ONCE; i++)
if (!strcmp(Hosts[i].host, host))
{
return (&Hosts[i]);
{
int i;
- for (i = 0; i <= SCAN_AT_ONCE; i++)
+ for (i = 0; i < SCAN_AT_ONCE; i++)
if (!strcmp(VHosts[i].host, host))
{
return (&VHosts[i]);
/* If it is called as a event, get lock */
if (data == NULL)
IRCMutexLock(HSlock);
- for (i = 0; i <= SCAN_AT_ONCE; i++)
+ for (i = 0; i < SCAN_AT_ONCE; i++)
if (Hosts[i].host[0] && (Hosts[i].refcnt <= 0))
{
*(Hosts[i].host) = '\0';
if (data == NULL)
IRCMutexLock(VSlock);
- for (i = 0; i <= SCAN_AT_ONCE; i++)
+ for (i = 0; i < SCAN_AT_ONCE; i++)
if (*VHosts[i].host && *VHosts[i].reason)
{
me.name, sptr->name);
sendto_one(sptr, ":%s NOTICE %s :*** Currently scanning:",
me.name, sptr->name);
- for (i = 0; i <= SCAN_AT_ONCE; i++)
+ for (i = 0; i < SCAN_AT_ONCE; i++)
if (*Hosts[i].host)
sendto_one(sptr, ":%s NOTICE %s :*** IP: %s refcnt: %i",
me.name, sptr->name, Hosts[i].host, Hosts[i].refcnt);
sendto_one(sptr, ":%s NOTICE %s :*** Currently banning:",
me.name, sptr->name);
- for (i = 0; i <= SCAN_AT_ONCE; i++)
+ for (i = 0; i < SCAN_AT_ONCE; i++)
if (*VHosts[i].host)
sendto_one(sptr, ":%s NOTICE %s :*** IP: %s Reason: %s",
me.name, sptr->name, VHosts[i].host, VHosts[i].reason);
return;
}
- sin.sin_port = htons(z->port);
+ sin.sin_port = htons((unsigned short)z->port);
sin.sin_family = AF_INET;
/* We do this non-blocking to prevent a hang of the entire ircd with newer
* versions of glibc. Don't you just love new "features?"
return;
}
- sin.sin_port = htons(SCAN_ON_PORT);
+ sin.sin_port = htons((unsigned short)SCAN_ON_PORT);
sin.sin_family = AF_INET;
/* We do this non-blocking to prevent a hang of the entire ircd with newer
* versions of glibc. Don't you just love new "features?"
add_Command(MSG_STATS, TOK_STATS, m_stats, MAXPARA);
add_Command(MSG_LINKS, TOK_LINKS, m_links, MAXPARA);
add_CommandX(MSG_ADMIN, TOK_ADMIN, m_admin, MAXPARA, M_UNREGISTERED|M_USER);
- add_Command(MSG_SUMMON, TOK_SUMMON, m_summon, 1);
- add_Command(MSG_USERS, TOK_USERS, m_users, MAXPARA);
- add_Command(MSG_SAMODE, TOK_SAMODE, m_samode, MAXPARA);
+ add_Command(MSG_SUMMON, NULL, m_summon, 1);
+ add_Command(MSG_USERS, NULL, m_users, MAXPARA);
+ add_Command(MSG_SAMODE, NULL, m_samode, MAXPARA);
add_Command(MSG_SVSKILL, TOK_SVSKILL, m_svskill, MAXPARA);
add_Command(MSG_HELP, TOK_HELP, m_help, 1);
add_Command(MSG_HELPOP, TOK_HELP, m_help, 1);
void add_Command(char *cmd, char *token, int (*func)(), unsigned char parameters)
{
add_Command_backend(cmd, func, parameters, 0, 0);
- add_Command_backend(token, func, parameters, 1, 0);
+ if (token)
+ add_Command_backend(token, func, parameters, 1, 0);
}
void add_CommandX(char *cmd, char *token, int (*func)(), unsigned char parameters, int flags)
if (cmptr == NULL)
return (do_numeric(numeric, cptr, from, i, para));
cmptr->count++;
- if (IsRegisteredUser(cptr) && (cmptr->cmd == MSG_PRIVATE) || (cmptr->cmd == TOK_PRIVATE))
+ if (IsRegisteredUser(cptr) && (cmptr->flags & M_RESETIDLE))
from->user->last = TStime();
#ifndef DEBUGMODE
if (!ircd_res.nscount)
{
ircd_res.nscount = 1;
+ Debug((DEBUG_DNS, "Setting nameserver to be %s",
+ NAME_SERVER));
#ifdef INET6
/* still IPv4 */
ircd_res.nsaddr_list[0].sin_addr.s_addr =
(void)setsockopt(ret, SOL_SOCKET, SO_BROADCAST, &on, on);
#endif
}
-#ifdef DEBUG
+#ifdef DEBUGMODE
if (op & RES_INITDEBG);
ircd_res.options |= RES_DEBUG;
#endif
last = r2ptr;
break;
}
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_INFO, "rem_request:Remove %#x at %#x %#x",
old, *rptr, r2ptr));
#endif
#endif
if (--rptr->retries <= 0)
{
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_ERROR, "timeout %x now %d cptr %x",
rptr, now, rptr->cinfo.value.cptr));
#endif
resend_query(rptr);
#endif
tout = now + rptr->timeout;
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_INFO, "r %x now %d retry %d c %x",
rptr, now, rptr->retries,
rptr->cinfo.value.cptr));
char *msg;
int len, rcount;
{
+#ifdef DEBUGMODE
+ char debbuffer[50];
+ int j;
+#endif
+
int i;
int sent = 0, max;
if (!max)
max = 1;
+#ifdef DEBUGMODE
+ Debug((DEBUG_DNS, "send_res_msg: Dumping packet contents"));
+ *debbuffer = '\0';
+ j = 0;
+ for (i = 0; i < len; i++)
+ {
+ debbuffer[j] = msg[i] > 32 ? msg[i] : '.';
+ j++;
+ if (j == 32)
+ {
+ debbuffer[j] = '\0';
+ Debug((DEBUG_DNS, "- %s", debbuffer));
+ j = 0;
+ }
+ }
+ if (j > 0)
+ {
+ debbuffer[j] = '\0';
+ Debug((DEBUG_DNS, "- %s", debbuffer));
+ }
+#endif
+
+
for (i = 0; i < max; i++)
{
+ Debug((DEBUG_DNS, "Sending to nameserver %i",
+ i));
+#ifndef INET6
+ Debug((DEBUG_DNS, "IP: %s",
+ inet_ntoa(ircd_res.nsaddr_list[i].sin_addr)));
+#endif
#ifdef INET6
/* still IPv4 */
ircd_res.nsaddr_list[i].sin_family = AF_INET;
#else
ircd_res.nsaddr_list[i].sin_family = AF_INET;
#endif
+ ERRNO = 0;
#ifdef INET6
if (sendto(resfd, msg, len, 0,
(struct sockaddr *)&(ircd_res.nsaddr_list[i]),
#endif
{
+ Debug((DEBUG_DNS, "send_res_msg, errno = %s",strerror(ERRNO)));
reinfo.re_sent++;
sent++;
}
(u_int)(cp[3]), (u_int)(cp[2]), (u_int)(cp[1]), (u_int)(cp[0]));
#endif
#endif
+ Debug((DEBUG_DNS, "do_query_number: built %s rptr = %lx",
+ ipbuf, rptr));
if (!rptr)
{
(u_char *)buf, sizeof(buf));
if (r <= 0)
{
+ Debug((DEBUG_DNS, "query_name: NO_RECOVERY"));
h_errno = NO_RECOVERY;
return r;
}
s = send_res_msg(buf, r, rptr->sends);
if (s == -1)
{
+ Debug((DEBUG_DNS, "query_name: TRY_AGAIN"));
h_errno = TRY_AGAIN;
return -1;
}
ans++;
break;
default:
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_INFO, "proc_answer: type:%d for:%s",
type, hostbuf));
#endif
hptr->qdcount = ntohs(hptr->qdcount);
hptr->nscount = ntohs(hptr->nscount);
hptr->arcount = ntohs(hptr->arcount);
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_NOTICE, "get_res:id = %d rcode = %d ancount = %d",
hptr->id, hptr->rcode, hptr->ancount));
#endif
inetntoa((char *)&rptr->he.h_addr)));
#endif
}
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_INFO, "get_res:Proc answer = %d", a));
#endif
if (a > 0 && rptr->type == T_PTR)
if (lp)
bcopy((char *)&rptr->cinfo, lp, sizeof(Link));
cp = make_cache(rptr);
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_INFO, "get_res:cp=%#x rptr=%#x (made)", cp, rptr));
#endif
aCache *cp = NULL;
int hashv;
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_INFO,
"add_to_cache:ocp %#x he %#x name %#x addrl %#x 0 %#x",
ocp, HE(ocp), HE(ocp)->h_name, HE(ocp)->h_addr_list,
ocp->hnum_next = hashtable[hashv].num_list;
hashtable[hashv].num_list = ocp;
-#ifdef DEBUG
+#ifdef DEBUGMODE
#ifdef INET6
Debug((DEBUG_INFO, "add_to_cache:added %s[%08x%08x%08x%08x] cache %#x.",
ocp->he.h_name,
if (!rptr)
return;
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_DEBUG, "u_l:cp %#x na %#x al %#x ad %#x",
- cp, HE(cp)->h_name, HE(cp)->h_aliases, HE(cp)->he.h_addr));
+ cp, HE(cp)->h_name, HE(cp)->h_aliases, HE(cp)->h_addr));
Debug((DEBUG_DEBUG, "u_l:rptr %#x h_n %#x", rptr, HE(rptr)->h_name));
#endif
/*
base = (char **)MyRealloc((char *)base,
sizeof(char *) * (addrcount + 1));
HE(cp)->h_aliases = base;
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_DNS, "u_l:add name %s hal %x ac %d",
- s, HE(CP)->h_aliases, addrcount));
+ s, HE(cp)->h_aliases, addrcount));
#endif
base[addrcount - 1] = strdup(s);
base[addrcount] = NULL;
base = (char **)MyRealloc((char *)ab,
(addrcount + 1) * sizeof(*ab));
HE(cp)->h_addr_list = base;
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_DNS, "u_l:add IP %x hal %x ac %d",
ntohl(((struct IN_ADDR *)s)->S_ADDR),
HE(cp)->h_addr_list, addrcount));
hashv = hash_name(name);
cp = hashtable[hashv].name_list;
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_DNS, "find_cache_name:find %s : hashv = %d", name, hashv));
#endif
{
aCache *cp;
int hashv, i;
-#ifdef DEBUG
+#ifdef DEBUGMODE
struct IN_ADDR *ip = (struct IN_ADDR *)numb;
#endif
hashv = hash_number((u_char *)numb);
cp = hashtable[hashv].num_list;
-#ifdef DEBUG
+#ifdef DEBUGMODE
#ifdef INET6
Debug((DEBUG_DNS,
"find_cache_number:find %s[%08x%08x%08x%08x]: hashv = %d",
cp->ttl = rptr->ttl;
cp->expireat = TStime() + cp->ttl;
HE(rptr)->h_name = NULL;
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_INFO, "make_cache:made cache %#x", cp));
#endif
return add_to_cache(cp);
int hashv;
aClient *cptr;
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_DNS, "rem_cache: ocp %#x hp %#x l_n %#x aliases %#x",
ocp, hp, ocp->list_next, hp->h_aliases));
#endif
* remove cache entry from hashed name lists
*/
hashv = hash_name(hp->h_name);
-#ifdef DEBUG
+#ifdef DEBUGMODE
Debug((DEBUG_DEBUG, "rem_cache: h_name %s hashv %d next %#x first %#x",
hp->h_name, hashv, ocp->hname_next, hashtable[hashv].name_list));
#endif
* remove cache entry from hashed number list
*/
hashv = hash_number((u_char *)hp->h_addr);
-#ifdef DEBUG
+#ifdef DEBUGMODE
# ifdef INET6
Debug((DEBUG_DEBUG, "rem_cache: h_addr %s hashv %d next %#x first %#x",
inet_ntop(AF_INET6, hp->h_addr, mydummy, MYDUMMY_SIZE),
dots--;
}
*pp = NULL;
-#ifdef DEBUG
- if (ircd_res.options & RES_DEBUG)
+#ifdef DEBUGMODE
+ Debug((DEBUG_DNS, ";; res_init()... default dnsrch list:"));
+ for (pp = ircd_res.dnsrch; *pp; pp++)
{
- printf(";; res_init()... default dnsrch list:\n");
- for (pp = ircd_res.dnsrch; *pp; pp++)
- printf(";;\t%s\n", *pp);
- printf(";;\t..END..\n");
+ Debug((DEBUG_DNS, ";;\t%s", *pp));
}
+ Debug((DEBUG_DNS, ";;\t..END..\n"));
#endif /* DEBUG */
#endif /* !RFC1535 */
}
char *cp = options;
int i;
-#ifdef DEBUG
- if (ircd_res.options & RES_DEBUG)
- printf(";; ircd_res_setoptions(\"%s\", \"%s\")...\n",
- options, source);
+#ifdef DEBUGMODE
+ Debug((DEBUG_DNS, ";; ircd_res_setoptions(\"%s\", \"%s\")...",
+ options, source));
#endif
while (*cp)
{
ircd_res.ndots = i;
else
ircd_res.ndots = RES_MAXNDOTS;
-#ifdef DEBUG
- if (ircd_res.options & RES_DEBUG)
- printf(";;\tndots=%d\n", ircd_res.ndots);
+#ifdef DEBUGMODE
+ Debug((DEBUG_DNS, ";;\tndots=%d", ircd_res.ndots));
#endif
}
else if (!strncmp(cp, "debug", sizeof("debug") - 1))
{
-#ifdef DEBUG
- if (!(ircd_res.options & RES_DEBUG))
- {
- printf
- (";; ircd_res_setoptions(\"%s\", \"%s\")..\n",
- options, source);
+#ifdef DEBUGMODE
+ Debug((DEBUG_DNS,
+ ";; ircd_res_setoptions(\"%s\", \"%s\")..",
+ options, source));
ircd_res.options |= RES_DEBUG;
- }
- printf(";;\tdebug\n");
#endif
}
else if (!strncmp(cp, "inet6", sizeof("inet6") - 1))
h_errno = NETDB_INTERNAL;
return (-1);
}
-#ifdef DEBUG
- if (ircd_res.options & RES_DEBUG)
- printf(";; res_mkquery(%d, %s, %d, %d)\n",
- op, dname, class, type);
+#ifdef DEBUGMODE
+ Debug((DEBUG_DNS,
+ ";; res_mkquery(%d, %s, %d, %d)",
+ op, dname, class, type));
#endif
/*
* Initialize header fields.
#endif /*_WIN32*/
resfd = init_resolver(0x1f);
+ Debug((DEBUG_DNS, "resfd %d", resfd));
return;
}
#ifndef _WIN32
if (resfd >= 0 && FD_ISSET(resfd, &read_set))
{
+ Debug((DEBUG_DNS, "Doing DNS async.."));
do_dns_async();
nfds--;
FD_CLR(resfd, &read_set);
if (!find_Command_simple("AWAY") || !find_Command_simple("KILL") ||
!find_Command_simple("OPER") || !find_Command_simple("PING"))
{
- Error("Someone forgot to load modules with proper commands in them. Read the documentation");
+ Error("Someone forgot to load modules with proper commands in them. Read the documentation (.RELEASE.NOTES)");
}
#ifdef _WIN32
if (config_error_flag)
if (getrusage(RUSAGE_SELF, &rus) == -1)
{
-#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__APPLE__)
-/* extern char *sys_errlist[]; */
+#ifdef _SOLARIS
+ extern char *sys_errlist[];
#endif
sendto_one(cptr, ":%s NOTICE %s :Getruseage error: %s.",
me.name, nick, sys_errlist[errno]);
extern char *me_hash;
extern char backupbuf[];
static char buf[BUFSIZE], buf2[BUFSIZE];
-int user_modes[] = { UMODE_OPER, 'o',
- UMODE_LOCOP, 'O',
- UMODE_INVISIBLE, 'i',
- UMODE_WALLOP, 'w',
- UMODE_FAILOP, 'g',
- UMODE_HELPOP, 'h',
- UMODE_SERVNOTICE, 's',
- UMODE_SERVICES, 'S',
- UMODE_SADMIN, 'a',
- UMODE_HIDEOPER, 'H',
- UMODE_ADMIN, 'A',
- UMODE_NETADMIN, 'N',
- UMODE_TECHADMIN, 'T',
- UMODE_COADMIN, 'C',
- UMODE_REGNICK, 'r',
- UMODE_RGSTRONLY, 'R',
- UMODE_HIDE, 'x',
- UMODE_WHOIS, 'W',
- UMODE_KIX, 'q',
- UMODE_BOT, 'B',
- UMODE_HIDING, 'I',
- UMODE_SECURE, 'z',
- UMODE_DEAF, 'd',
- UMODE_VICTIM, 'v',
- UMODE_SETHOST, 't',
- UMODE_WEBTV, 'V',
-#ifdef STRIPBADWORDS
- UMODE_STRIPBADWORDS, 'G',
-#endif
- 0, 0
-};
int sno_mask[] = {
SNO_KILLS, 'k',
int newumode;
int what;
char **p, *m;
- int flag;
- int *s;
+ int i;
newumode = 0;
what = MODE_ADD;
case '\t':
break;
default:
- for (s = user_modes; (flag = *s); s += 2)
- if (*m == (char)(*(s + 1)))
- {
- if (what == MODE_ADD)
- {
- newumode |= flag;
- }
- else
- {
- newumode &= ~flag;
- }
- break;
- }
+ for (i = 0; i <= Usermode_highest; i++)
+ {
+ if (!Usermode_Table[i].flag)
+ continue;
+ if (*m == Usermode_Table[i].flag)
+ {
+ if (what == MODE_ADD)
+ newumode |= Usermode_Table[i].mode;
+ else
+ newumode &= ~Usermode_Table[i].mode;
+ }
+ }
}
return (newumode);
}
-char umodestring[512];
-
-void make_umodestr(void)
-{
-
- int *s;
- char *m;
-
- m = umodestring;
-
- for (s = user_modes; *s; s += 2)
- {
- *m++ = (char)(*(s + 1));
- }
-
- *m = '\0';
-}
+char umodestring[UMODETABLESZ+1];
/*
** next_client
/* Copy password to the passwd field if it's given after NICK
* - originally by taz, modified by Wizzu
*/
- if ((parc > 2) && (strlen(parv[2]) < sizeof(sptr->passwd)))
+ if ((parc > 2) && (strlen(parv[2]) <= PASSWDLEN))
{
if (sptr->passwd)
MyFree(sptr->passwd);
char *get_mode_str(aClient *acptr)
{
- int flag;
- int *s;
+ int i;
char *m;
m = buf;
*m++ = '+';
- for (s = user_modes; (flag = *s) && (m - buf < BUFSIZE - 4); s += 2)
- if ((acptr->umodes & flag))
- *m++ = (char)(*(s + 1));
+ for (i = 0; (i <= Usermode_highest) && (m - buf < BUFSIZE - 4); i++)
+
+ if (Usermode_Table[i].flag && (acptr->umodes & Usermode_Table[i].mode))
+ *m++ = Usermode_Table[i].flag;
*m = '\0';
return buf;
}
-char *get_modestr(long modes)
+
+char *get_modestr(long umodes)
{
- int flag;
- int *s;
+ int i;
char *m;
m = buf;
*m++ = '+';
- for (s = user_modes; (flag = *s) && (m - buf < BUFSIZE - 4); s += 2)
- if ((modes & flag))
- *m++ = (char)(*(s + 1));
+ for (i = 0; (i <= Usermode_highest) && (m - buf < BUFSIZE - 4); i++)
+
+ if (Usermode_Table[i].flag && (umodes & Usermode_Table[i].mode))
+ *m++ = Usermode_Table[i].flag;
*m = '\0';
return buf;
}
int m_umode(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
int flag;
- int *s;
+ int i;
char **p, *m;
aClient *acptr;
int what, setflags, setsnomask;
/* find flags already set for user */
setflags = 0;
- for (s = user_modes; (flag = *s); s += 2)
- if ((sptr->umodes & flag))
- setflags |= flag;
+
+ for (i = 0; i <= Usermode_highest; i++)
+ if ((sptr->umodes & Usermode_Table[i].mode))
+ setflags |= Usermode_Table[i].mode;
+
if (MyConnect(sptr))
setsnomask = sptr->user->snomask;
/*
(void)m_botmotd(sptr, sptr, 1, parv);
default:
def:
- for (s = user_modes; (flag = *s); s += 2)
- if (*m == (char)(*(s + 1)))
+
+ for (i = 0; i <= Usermode_highest; i++)
+ {
+ if (*m == Usermode_Table[i].flag)
{
if (what == MODE_ADD)
- sptr->umodes |= flag;
+ sptr->umodes |= Usermode_Table[i].mode;
else
- sptr->umodes &= ~flag;
+ sptr->umodes &= ~Usermode_Table[i].mode;
break;
}
if (flag == 0 && MyConnect(sptr) && !rpterror)
{
- sendto_one(sptr,
- err_str(ERR_UMODEUNKNOWNFLAG),
- me.name, parv[0]);
- rpterror = 1;
+ sendto_one(sptr,
+ err_str(ERR_UMODEUNKNOWNFLAG),
+ me.name, parv[0]);
+ rpterror = 1;
}
+ }
break;
}
/*
ClearCoAdmin(sptr);
if (IsTechAdmin(sptr))
ClearTechAdmin(sptr);
+ if (sptr->user->snomask & SNO_CLIENT)
+ sptr->user->snomask &= ~SNO_CLIENT;
+ if (sptr->user->snomask & SNO_FCLIENT)
+ sptr->user->snomask &= ~SNO_FCLIENT;
+ if (sptr->user->snomask & SNO_FLOOD)
+ sptr->user->snomask &= ~SNO_FLOOD;
+ if (sptr->user->snomask & SNO_JUNK)
+ sptr->user->snomask &= ~SNO_JUNK;
+ if (sptr->user->snomask & SNO_EYES)
+ sptr->user->snomask &= ~SNO_EYES;
+ if (sptr->user->snomask & SNO_VHOST)
+ sptr->user->snomask &= ~SNO_VHOST;
+ if (sptr->user->snomask & SNO_TKL)
+ sptr->user->snomask &= ~SNO_TKL;
+
}
/*
long old, sendmask;
char *umode_buf;
{
- int *s, flag;
+ int i;
+ long flag;
char *m;
int what = MODE_NULL;
*/
m = umode_buf;
*m = '\0';
- for (s = user_modes; (flag = *s); s += 2)
+ for (i = 0; i <= Usermode_highest; i++)
{
+ if (!Usermode_Table[i].flag)
+ continue;
+ flag = Usermode_Table[i].mode;
if (MyClient(sptr) && !(flag & sendmask))
continue;
if ((flag & old) && !(sptr->umodes & flag))
{
if (what == MODE_DEL)
- *m++ = *(s + 1);
+ *m++ = Usermode_Table[i].flag;
else
{
what = MODE_DEL;
*m++ = '-';
- *m++ = *(s + 1);
+ *m++ = Usermode_Table[i].flag;
}
}
else if (!(flag & old) && (sptr->umodes & flag))
{
if (what == MODE_ADD)
- *m++ = *(s + 1);
+ *m++ = Usermode_Table[i].flag;
else
{
what = MODE_ADD;
*m++ = '+';
- *m++ = *(s + 1);
+ *m++ = Usermode_Table[i].flag;
}
}
}
--- /dev/null
+/************************************************************************
+ * IRC - Internet Relay Chat, s_unreal.c
+ * (C) 1999-2000 Carsten Munk (Techie/Stskeeps) <stskeeps@tspre.org>
+ *
+ * See file AUTHORS in IRC package for additional names of
+ * the programmers.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 1, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "struct.h"
+#include "common.h"
+#include "sys.h"
+#include "numeric.h"
+#include "msg.h"
+#include "channel.h"
+#include "version.h"
+#include <time.h>
+#ifdef _WIN32
+#include <sys/timeb.h>
+#endif
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef _WIN32
+#include <io.h>
+#endif
+#include <fcntl.h>
+#include "h.h"
+
+extern char umodestring[UMODETABLESZ+1];
+
+aUMtable *Usermode_Table = NULL;
+short Usermode_highest = 0;
+
+long UMODE_INVISIBLE = 0L; /* 0x0001 makes user invisible */
+long UMODE_OPER = 0L; /* 0x0002 Operator */
+long UMODE_WALLOP = 0L; /* 0x0004 send wallops to them */
+long UMODE_FAILOP = 0L; /* 0x0008 Shows some global messages */
+long UMODE_HELPOP = 0L; /* 0x0010 Help system operator */
+long UMODE_REGNICK = 0L; /* 0x0020 Nick set by services as registered */
+long UMODE_SADMIN = 0L; /* 0x0040 Services Admin */
+long UMODE_ADMIN = 0L; /* 0x0080 Admin */
+long UMODE_SERVNOTICE = 0L;/* 0x0100 server notices such as kill */
+long UMODE_LOCOP = 0L; /* 0x0200 Local operator -- SRB */
+long UMODE_RGSTRONLY = 0L; /* 0x0400 Only reg nick message */
+long UMODE_WEBTV = 0L; /* 0x0800 WebTV Client */
+long UMODE_SERVICES = 0L; /* 0x4000 services */
+long UMODE_HIDE = 0L; /* 0x8000 Hide from Nukes */
+long UMODE_NETADMIN = 0L; /* 0x10000 Network Admin */
+long UMODE_TECHADMIN = 0L; /* 0x40000 Tech Admin */
+long UMODE_COADMIN = 0L; /* 0x80000 Co Admin */
+long UMODE_WHOIS = 0L; /* 0x100000 gets notice on /whois */
+long UMODE_KIX = 0L; /* 0x200000 usermode +q */
+long UMODE_BOT = 0L; /* 0x400000 User is a bot */
+long UMODE_SECURE = 0L; /* 0x800000 User is a secure connect */
+long UMODE_HIDING = 0L; /* 0x2000000 Totally invisible .. */
+long UMODE_VICTIM = 0L; /* 0x8000000 Intentional Victim */
+long UMODE_DEAF = 0L; /* 0x10000000 Deaf */
+long UMODE_HIDEOPER = 0L; /* 0x20000000 Hide oper mode */
+long UMODE_SETHOST = 0L; /* 0x40000000 used sethost */
+long UMODE_STRIPBADWORDS = 0L; /* 0x80000000 */
+
+
+
+void umode_init(void)
+{
+ long val = 1;
+ int i;
+ Usermode_Table = (aUMtable *)MyMalloc(sizeof(aUMtable) * UMODETABLESZ);
+ bzero(Usermode_Table, sizeof(aUMtable) * UMODETABLESZ);
+ for (i = 0; i < UMODETABLESZ; i++)
+ {
+ Usermode_Table[i].mode = val;
+ val *= 2;
+ }
+ Usermode_highest = 0;
+ /* Set up modes */
+ UMODE_INVISIBLE = umode_get('i'); /* 0x0001 /* makes user invisible */
+ UMODE_OPER = umode_get('o'); /* 0x0002 Operator */
+ UMODE_WALLOP = umode_get('w'); /* 0x0004 send wallops to them */
+ UMODE_FAILOP = umode_get('g'); /* 0x0008 Shows some global messages */
+ UMODE_HELPOP = umode_get('h'); /* 0x0010 Help system operator */
+ UMODE_REGNICK = umode_get('r'); /* 0x0020 Nick set by services as registered */
+ UMODE_SADMIN = umode_get('a'); /* 0x0040 Services Admin */
+ UMODE_ADMIN = umode_get('A'); /* 0x0080 Admin */
+ UMODE_SERVNOTICE = umode_get('s');/* 0x0100 server notices such as kill */
+ UMODE_LOCOP = umode_get('O'); /* 0x0200 Local operator -- SRB */
+ UMODE_RGSTRONLY = umode_get('R'); /* 0x0400 Only reg nick message */
+ UMODE_WEBTV = umode_get('V'); /* 0x0800 WebTV Client */
+ UMODE_SERVICES = umode_get('S'); /* 0x4000 services */
+ UMODE_HIDE = umode_get('x'); /* 0x8000 Hide from Nukes */
+ UMODE_NETADMIN = umode_get('N'); /* 0x10000 Network Admin */
+ UMODE_TECHADMIN = umode_get('T'); /* 0x40000 Tech Admin */
+ UMODE_COADMIN = umode_get('C'); /* 0x80000 Co Admin */
+ UMODE_WHOIS = umode_get('W'); /* 0x100000 gets notice on /whois */
+ UMODE_KIX = umode_get('q'); /* 0x200000 usermode +q */
+ UMODE_BOT = umode_get('B'); /* 0x400000 User is a bot */
+ UMODE_SECURE = umode_get('z'); /* 0x800000 User is a secure connect */
+ UMODE_HIDING = umode_get('I'); /* 0x2000000 Totally invisible .. */
+ UMODE_VICTIM = umode_get('v'); /* 0x8000000 Intentional Victim */
+ UMODE_DEAF = umode_get('d'); /* 0x10000000 Deaf */
+ UMODE_HIDEOPER = umode_get('H'); /* 0x20000000 Hide oper mode */
+ UMODE_SETHOST = umode_get('t'); /* 0x40000000 used sethost */
+ UMODE_STRIPBADWORDS = umode_get('G'); /* 0x80000000 */
+}
+
+void make_umodestr(void)
+{
+ int i;
+ char *m;
+
+ m = umodestring;
+ for (i = 0; i <= Usermode_highest; i++)
+ {
+ if (Usermode_Table[i].flag)
+ *m++ = Usermode_Table[i].flag;
+ }
+ *m = '\0';
+}
+long umode_get(char ch)
+{
+ short i = 0;
+ short j = 0;
+ while (i < UMODETABLESZ)
+ {
+ if (!Usermode_Table[i].flag)
+ {
+ break;
+ }
+ i++;
+ }
+ if (i != UMODETABLESZ)
+ {
+ Usermode_Table[i].flag = ch;
+ Debug((DEBUG_DEBUG, "umode_get(%c) returning %04x",
+ ch, Usermode_Table[i].mode));
+ /* Update usermode table highest */
+ for (j = 0; j < UMODETABLESZ; j++)
+ if (Usermode_Table[i].flag)
+ if (i > Usermode_highest)
+ Usermode_highest = i;
+ make_umodestr();
+ return (Usermode_Table[i].mode);
+ }
+ else
+ {
+ Debug((DEBUG_DEBUG, "umode_get failed, no space"));
+ return (0);
+ }
+}
+
+
+int umode_delete(char ch, long val)
+{
+ int i = 0;
+ Debug((DEBUG_DEBUG, "umode_delete %c, %li",
+ ch, val));
+
+ while (i < UMODETABLESZ)
+ {
+ if ((Usermode_Table[i].flag == ch) && (Usermode_Table[i].mode == val))
+ {
+ Usermode_Table[i].flag = '\0';
+ return 1;
+ }
+ i++;
+ }
+ return -1;
+}
--- /dev/null
+
+#include <stdio.h>
+#include <string.h>
+int main() {
+ FILE *fd = fopen("Changes", "r");
+ FILE *fd2;
+ char buf[1024];
+ int i = 0, space = 0, j = 0;
+ char releaseid[512];
+ int generation = 0;
+
+ if (!fd) {
+ return -1;
+ }
+
+ while (fgets(buf, 1023, fd)) {
+ if (!strstr(buf, "Changes,v"))
+ continue;
+ else {
+ while (!isdigit(buf[i]))
+ i++;
+ j = i;
+ while (buf[j]) {
+ if (buf[j] == ' ')
+ space++;
+ if (space == 3) {
+ buf[j] = 0;
+ break;
+ }
+ j++;
+ }
+ strcpy(releaseid,&buf[i]);
+ }
+ }
+ fclose(fd);
+ i = 0;
+ fd = fopen("src/version.c", "r");
+ if (!fd)
+ generation = 1;
+ else {
+ while (fgets(buf, 1023, fd)) {
+ if (!strstr(buf, "char *generation"))
+ continue;
+ while (!isdigit(buf[i]))
+ i++;
+ j = i;
+ while (isdigit(buf[j]))
+ j++;
+ buf[j] = 0;
+ generation = (atoi(&buf[i])+1);
+ }
+ }
+ fd = fopen("src/version.c.sh", "r");
+ if (!fd)
+ return 0;
+ fd2 = fopen("src/version.c", "w");
+ if (!fd2)
+ return 0;
+ while (fgets(buf, 1023, fd)) {
+ if (!strncmp("cat >version.c <<!SUB!THIS!",buf,27)) {
+ while (fgets(buf, 1023, fd)) {
+ if (!strncmp("!SUB!THIS!",buf,10))
+ break;
+ if (!strncmp("char *creation = \"$creation\";",buf,29))
+ fprintf(fd2,"char *creation = __TIMESTAMP__;\n");
+ else if (!strncmp("char *generation = \"$generation\";",buf,33))
+ fprintf(fd2,"char *generation = \"%d\";\n",generation);
+ else if (!strncmp("char *buildid = \"$id\";",buf,22))
+ fprintf(fd2,"char *buildid = \"%s\";\n",releaseid);
+ else
+ fprintf(fd2,"%s", buf);
+ }
+ }
+ }
+
+
+}
+
\ No newline at end of file