beta10
@@ -1,5 +1,5 @@
|
||||
|
||||
Unreal3.2-Selene (BETA7) RELEASE NOTES
|
||||
Unreal3.2-Selene (BETA10) RELEASE NOTES
|
||||
======================================
|
||||
|
||||
I M P O R T A N T R E A D I N G
|
||||
|
||||
@@ -1257,3 +1257,43 @@ seen. gmtime warning still there
|
||||
- Added EXLIBS= to make custommodule so a module can specify additional libraries it needs
|
||||
- Changed version to beta9 and updated documentation
|
||||
- Made +I once again work in win32
|
||||
*** beta9 released ***
|
||||
- Fixed a stupid m_oper bug
|
||||
- Fixed a win32 editor bug causing a crash when you click save multiple times
|
||||
- Fixed a /stats q bug where it would crash if there was an sqline with no reason, reported by toji (#0000120)
|
||||
- Fixed a bug that caused locops to see client exiting but not client connecting notices while +s +c,
|
||||
reported and fixed by cmx (#0000123)
|
||||
- Fixed a bug reported by dimplesx where +H did not decrease the oper count (#0000129)
|
||||
- Documentation bug #0000152 reported by Tony at sexnet.org fixed regarding
|
||||
example.conf being wrong about set::socks
|
||||
- First part of skyper's security audit patch
|
||||
- Some more of skyper's security audit patch. Some of them were simply
|
||||
unfair in regards to performance or blindly added strlcats/strlcpy
|
||||
- Fixed some problems with skyper's patch (typos)
|
||||
- Fixed a cloak problem on OSes with 64bit integers (reported by wolven)
|
||||
- Updated credits
|
||||
- Memory leak fixes with scanners
|
||||
- Some fixes with connect(). Knowing my luck this will fuck up to hell
|
||||
- Fixed another memory leak with the scanners
|
||||
- Fixed some helpop typos reported by BiGi (#0000144)
|
||||
- Fixed a typo in /stats ? where T/t were reversed, reported by Zer0
|
||||
- Fixed a typo displaying a message to edit config.h after compiling reported by dimplesx
|
||||
(#0000133)
|
||||
- Fixed a bug where except ban didn't work (reported by Hercules)
|
||||
- Fixed a scanner memory leak, and made some changes to make the HTTP scanner work
|
||||
- Fixed a bug in the socks scanner causing it to fail
|
||||
- Removed some typecasts from free calls, *hopefully* it will fix some problems
|
||||
- Fixed a bug with \r\n being mistakenly parsed wrong. Thanks to John_z
|
||||
- Fixed a config parser bug that would cause a crash under certain conditions. Reported by
|
||||
roskecr (#0000173)
|
||||
- Rewrote check_pings and the whole way banning people are handled. Do loop.do_bancheck = 1
|
||||
to provoke a bans check. This possibly fixes #00001702, #0000137 and other
|
||||
funny bugs.
|
||||
- Fixed a number of bugs in the upper patch.
|
||||
- Fixed an OpenBSD bug reported by RaYmAn, k0adh, and numerous others (#0000104)
|
||||
- Credits changes
|
||||
- Fixed problem in dopm (short and char should NEVER be passed to va_arg)
|
||||
- Fixed HCN so it uses IP instead of sockhost.
|
||||
- Changed version to beta10 and updated documentation
|
||||
- Removed obsolete network files
|
||||
- Added some new network files (hopefully I'll be able to get all the submissions added soon)
|
||||
|
||||
@@ -153,8 +153,8 @@ build:
|
||||
done
|
||||
@echo ' __________________________________________________ '
|
||||
@echo '| Compile is now complete. |'
|
||||
@echo '| You might want to see include/config.h to adjust |'
|
||||
@echo '| some settings |'
|
||||
@echo '| You should now read the documentation and learn |'
|
||||
@echo '| how to configure your IRCd. |'
|
||||
@echo '| |'
|
||||
@echo '| If you really like UnrealIRCd, and would like to |'
|
||||
@echo '| make a donation, please read the Donation file in|'
|
||||
|
||||
@@ -99,10 +99,10 @@ ac_cv_underscore=no
|
||||
else
|
||||
ac_cv_underscore=yes
|
||||
fi
|
||||
])
|
||||
if test "$ac_cv_underscore" = "yes"; then
|
||||
AC_DEFINE(UNDERSCORE)
|
||||
fi
|
||||
])
|
||||
|
||||
MODULEFLAGS=$ac_cv_pic
|
||||
AC_DEFINE(DYNAMIC_LINKING)
|
||||
@@ -234,6 +234,12 @@ dnl Checks for library functions.
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_FUNC_SETPGRP
|
||||
AC_FUNC_SETVBUF_REVERSED
|
||||
AC_CHECK_FUNCS(snprintf,AC_DEFINE(HAVE_SNPRINTF))
|
||||
AC_CHECK_FUNCS(vsnprintf,AC_DEFINE(HAVE_VSNPRINTF))
|
||||
AC_CHECK_FUNCS(strlcpy, AC_DEFINE(HAVE_STRLCPY))
|
||||
AC_CHECK_FUNCS(strlcat, AC_DEFINE(HAVE_STRLCAT))
|
||||
AC_CHECK_FUNCS(strlncat, AC_DEFINE(HAVE_STRLNCAT))
|
||||
|
||||
AC_CACHE_CHECK(if we can set the core size to unlimited, ac_cv_force_core,[
|
||||
AC_TRY_RUN([
|
||||
#include <sys/time.h>
|
||||
|
||||
@@ -973,6 +973,9 @@ If set to no, the user must set +x manually to receive the oper host.
|
||||
|
||||
set::scan::endpoint <ip:port>;
|
||||
Specifies the IP and port that the server will tell an incomming open proxy to connect to.
|
||||
This must be a valid IP and port, in addition the port on the specified IP must be open and
|
||||
able to accept connections. Therefore it is a good idea to specify the IP of your server
|
||||
and a port you know is open.
|
||||
|
||||
set::scan::bantime <timevalue>;
|
||||
A time value that defines the length of time that a user caught by the scanner will be
|
||||
|
||||
@@ -576,7 +576,7 @@ except ban {
|
||||
};
|
||||
|
||||
/*
|
||||
* NEW: except socks {}
|
||||
* NEW: except scan {}
|
||||
* OLD: e:Line
|
||||
* Makes it so scan.so doesn't scan you.
|
||||
*
|
||||
@@ -701,7 +701,7 @@ set {
|
||||
show-connect-info;
|
||||
};
|
||||
|
||||
socks {
|
||||
scan {
|
||||
ban-message "Insecure SOCKS server";
|
||||
quit-message "Insecure SOCKS server";
|
||||
ban-time "4d";
|
||||
|
||||
@@ -61,7 +61,7 @@ help Svscmds {
|
||||
" /MSG OPERSERV RAW :services <command>";
|
||||
" Use /HELPOP <command name> to get info about that command";
|
||||
" -";
|
||||
" ----------oOo-----------";
|
||||
" -----------oOo-----------";
|
||||
" SVSNICK SVSMODE SVSKILL";
|
||||
" SVSNOOP SVSJOIN SVSPART";
|
||||
" SVSO SWHOIS SQLINE";
|
||||
@@ -1059,3 +1059,12 @@ help Svsfline {
|
||||
" :server SVSFLINE - file (Deletes the filename)";
|
||||
" :server SVSFLINE * (Wipes the DCCDENY list)";
|
||||
};
|
||||
|
||||
help Svsmotd {
|
||||
"Changes the Services Message Of The Day";
|
||||
"Must be sent through an U:Lined server.";
|
||||
"Syntax: SVSMOTD # :<text> (Adds to Services MOTD)";
|
||||
" SVSMOTD ! (Deletes the MOTD)";
|
||||
" SVSMOTD ! :<text> (Deletes and Adds text)";
|
||||
"Example: SVSMOTD # :Services MOTD";
|
||||
};
|
||||
|
||||
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 52 B |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 443 B |
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 453 B |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 451 B |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 441 B |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 447 B |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 449 B |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 445 B |
@@ -130,7 +130,7 @@ extern char *strtoken(char **, char *, char *);
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define DupString(x,y) do{x=MyMalloc(strlen(y)+1);(void)strcpy(x,y);}while(0)
|
||||
#define DupString(x,y) do{int l=strlen(y);x=MyMalloc(l+1);(void)memcpy(x,y, l+1);}while(0)
|
||||
|
||||
extern u_char tolowertab[], touppertab[];
|
||||
|
||||
|
||||
@@ -594,14 +594,14 @@
|
||||
#ifdef BSD_RELIABLE_SIGNALS
|
||||
# if defined(SYSV_UNRELIABLE_SIGNALS) || defined(POSIX_SIGNALS)
|
||||
error You stuffed up config.h signals
|
||||
#defines use only one.
|
||||
#define use only one.
|
||||
# endif
|
||||
#define HAVE_RELIABLE_SIGNALS
|
||||
#endif
|
||||
#ifdef SYSV_UNRELIABLE_SIGNALS
|
||||
# ifdef POSIX_SIGNALS
|
||||
error You stuffed up config.h signals
|
||||
#defines use only one.
|
||||
#define use only one.
|
||||
# endif
|
||||
#undef HAVE_RELIABLE_SIGNALS
|
||||
#endif
|
||||
|
||||
@@ -45,7 +45,7 @@ extern struct stats *ircstp;
|
||||
extern int bootopt;
|
||||
extern time_t TSoffset;
|
||||
/* Prototype added to force errors -- Barubary */
|
||||
extern TS check_pings(TS now, int check_kills);
|
||||
extern TS check_pings(TS now);
|
||||
extern TS TS2ts(char *s);
|
||||
extern time_t timeofday;
|
||||
/* newconf */
|
||||
@@ -77,6 +77,7 @@ extern ConfigItem_admin *conf_admin;
|
||||
extern ConfigItem_admin *conf_admin_tail;
|
||||
extern ConfigItem_drpass *conf_drpass;
|
||||
extern ConfigItem_ulines *conf_ulines;
|
||||
extern ConfigItem_ssl *conf_ssl;
|
||||
extern ConfigItem_tld *conf_tld;
|
||||
extern ConfigItem_oper *conf_oper;
|
||||
extern ConfigItem_listen *conf_listen;
|
||||
@@ -205,6 +206,13 @@ extern char *strerror(int);
|
||||
extern int dgets(int, char *, int);
|
||||
extern char *inetntoa(char *);
|
||||
|
||||
#if !defined(HAVE_SNPRINT) || !defined(HAVE_VSNPRINTF)
|
||||
#ifndef _WIN32
|
||||
extern int snprintf (char *str, size_t count, const char *fmt, ...);
|
||||
extern int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
extern int dbufalloc, dbufblocks, debuglevel;
|
||||
#else
|
||||
@@ -411,6 +419,15 @@ extern long UMODE_HIDEOPER; /* 0x20000000 Hide oper mode */
|
||||
extern long UMODE_SETHOST; /* 0x40000000 used sethost */
|
||||
extern long UMODE_STRIPBADWORDS; /* 0x80000000 */
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
size_t strlcpy(char *dst, const char *src, size_t size);
|
||||
#endif
|
||||
#ifndef HAVE_STRLCAT
|
||||
size_t strlcat(char *dst, const char *src, size_t size);
|
||||
#endif
|
||||
#ifndef HAVE_STRLNCAT
|
||||
size_t strlncat(char *dst, const char *src, size_t size, size_t n);
|
||||
#endif
|
||||
|
||||
|
||||
extern int dopacket(aClient *, char *, int);
|
||||
|
||||
@@ -56,7 +56,6 @@ char *my_itoa(int i);
|
||||
/* s_kline.c */
|
||||
int find_tkline_match(aClient *cptr, int xx);
|
||||
extern EVENT(tkl_check_expire);
|
||||
int tkl_sweep(void);
|
||||
|
||||
/* s_serv.c */
|
||||
void load_tunefile(void);
|
||||
|
||||
@@ -82,6 +82,7 @@ typedef struct _configitem_listen ConfigItem_listen;
|
||||
typedef struct _configitem_allow ConfigItem_allow;
|
||||
typedef struct _configitem_allow_channel ConfigItem_allow_channel;
|
||||
typedef struct _configitem_vhost ConfigItem_vhost;
|
||||
typedef struct _configitem_ssl ConfigItem_ssl;
|
||||
typedef struct _configitem_except ConfigItem_except;
|
||||
typedef struct _configitem_link ConfigItem_link;
|
||||
typedef struct _configitem_ban ConfigItem_ban;
|
||||
@@ -344,7 +345,7 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
|
||||
#define SendWallops(x) (!IsMe(x) && ((x)->umodes & UMODE_WALLOP))
|
||||
#define SendServNotice(x) (((x)->user) && ((x)->user->snomask & SNO_SNOTICE))
|
||||
#define IsListening(x) ((x)->flags & FLAGS_LISTEN)
|
||||
#define DoAccess(x) ((x)->flags & FLAGS_CHKACCESS)
|
||||
// #define DoAccess(x) ((x)->flags & FLAGS_CHKACCESS)
|
||||
#define IsLocal(x) ((x)->flags & FLAGS_LOCAL)
|
||||
#define IsDead(x) ((x)->flags & FLAGS_DEADSOCKET)
|
||||
#define GotProtoctl(x) ((x)->flags & FLAGS_PROTOCTL)
|
||||
@@ -389,7 +390,7 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
|
||||
#define SetWallops(x) ((x)->umodes |= UMODE_WALLOP)
|
||||
#define SetDNS(x) ((x)->flags |= FLAGS_DOINGDNS)
|
||||
#define DoingDNS(x) ((x)->flags & FLAGS_DOINGDNS)
|
||||
#define SetAccess(x) ((x)->flags |= FLAGS_CHKACCESS)
|
||||
#define SetAccess(x) ((x)->flags |= FLAGS_CHKACCESS); Debug((DEBUG_DEBUG, "SetAccess(%s)", (x)->name))
|
||||
#define SetBlocked(x) ((x)->flags |= FLAGS_BLOCKED)
|
||||
#define DoingAuth(x) ((x)->flags & FLAGS_AUTH)
|
||||
#define NoNewLine(x) ((x)->flags & FLAGS_NONL)
|
||||
@@ -588,8 +589,8 @@ struct MotdItem {
|
||||
|
||||
struct aloopStruct {
|
||||
unsigned do_garbage_collect : 1;
|
||||
unsigned do_tkl_sweep : 1;
|
||||
unsigned ircd_booted : 1;
|
||||
unsigned do_bancheck : 1;
|
||||
};
|
||||
|
||||
typedef struct Whowas {
|
||||
@@ -935,6 +936,14 @@ struct _configitem_listen {
|
||||
char *ip;
|
||||
int port;
|
||||
long options, clients;
|
||||
ConfigItem_ssl *ssl;
|
||||
};
|
||||
|
||||
struct _configitem_ssl {
|
||||
char *cert;
|
||||
char *key;
|
||||
char *ca;
|
||||
char *cipher;
|
||||
};
|
||||
|
||||
struct _configitem_vhost {
|
||||
|
||||
@@ -33,10 +33,9 @@
|
||||
#endif
|
||||
#if !defined(_WIN32) || defined(USE_PTHREADS)
|
||||
#include <pthread.h>
|
||||
typedef pthread_attr_t THREAD_ATTR;
|
||||
typedef pthread_t THREAD;
|
||||
typedef pthread_mutex_t MUTEX;
|
||||
#define IRCCreateThread(thread, attr, start, arg) TDebug(CreateThread); pthread_attr_init(&attr); pthread_create(&thread, &attr, (void*)start, arg)
|
||||
#define IRCCreateThread(thread, start, arg) TDebug(CreateThread); pthread_create(&thread, NULL, (void*)start, arg)
|
||||
#define IRCMutexLock(mutex) TDebug(MutexLock); pthread_mutex_lock(&mutex)
|
||||
#define IRCMutexTryLock(mutex) TDebug(MutexTryLock); pthread_mutex_trylock(&mutex);
|
||||
#define IRCMutexUnlock(mutex) TDebug(MutexUnlcok); pthread_mutex_unlock(&mutex)
|
||||
@@ -44,14 +43,14 @@ typedef pthread_mutex_t MUTEX;
|
||||
#define IRCMutexDestroy(mutex) TDebug(MutexDestroy); pthread_mutex_destroy(&mutex)
|
||||
#define IRCJoinThread(thread,return) TDebug(JoinThread); pthread_join(thread, return)
|
||||
#define IRCExitThread(value) TDebug(ExitThread); pthread_exit(value)
|
||||
#define IRCDetachThread(value) TDebug(DetachThread); pthread_detach(value);
|
||||
#define IRCTerminateThread(thread, value) pthread_cancel(&thread)
|
||||
#define IRCThreadSelf() pthread_self()
|
||||
#define IRCThreadEqual(thread1, thread2) pthread_equal(thread1,thread2)
|
||||
#else
|
||||
typedef short THREAD_ATTR; /* Not needed but makes porting easier */
|
||||
typedef unsigned long THREAD;
|
||||
typedef HANDLE MUTEX;
|
||||
#define IRCCreateThread(thread, attr, start, arg) thread = _beginthread((void *)start, 0, arg)
|
||||
#define IRCCreateThread(thread, start, arg) thread = _beginthread((void *)start, 0, arg)
|
||||
#define IRCMutexLock(mutex) WaitForSingleObject(mutex, INFINITE)
|
||||
#define IRCMutexTryLock(mutex) WaitForSingleObject(mutex, 0)
|
||||
#define IRCMutexUnlock(mutex) ReleaseMutex(mutex)
|
||||
@@ -62,6 +61,7 @@ typedef HANDLE MUTEX;
|
||||
#define IRCTerminateThread(thread, value) TerminateThread((HANDLE)thread, value)
|
||||
#define IRCThreadSelf() GetCurrentThread()
|
||||
#define IRCThreadEqual(thread1, thread2) thread1 == thread2 ? 1 : 0
|
||||
#define IRCDetachThread(value) ;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#define PATCH1 "3"
|
||||
#define PATCH2 ".2"
|
||||
#define PATCH3 "-Selene"
|
||||
#define PATCH4 "[beta9]"
|
||||
#define PATCH4 "[beta10]"
|
||||
#define PATCH5 ""
|
||||
#define PATCH6 ""
|
||||
#define PATCH7 ""
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* AwesomeChristians Chat Network (irc.awesomechristians.com) Network Configuration File
|
||||
* --------------------------------------------------
|
||||
* Added-at: 31 December 2001 15:25
|
||||
* Author: ChildLikeFaith
|
||||
* Email: childlikefaith@awesomechristians.com
|
||||
* -----------------------------------------
|
||||
*/
|
||||
|
||||
set {
|
||||
network-name "AwesomeChristians Chat Network";
|
||||
default-server "irc.awesomechristians.com";
|
||||
services-server "services.awesomechristians.com";
|
||||
stats-server "services.awesomechristians.com";
|
||||
help-channel "#operhelp";
|
||||
hiddenhost-prefix "awesome";
|
||||
prefix-quit "Quit:";
|
||||
hosts {
|
||||
local "ircop.awesomechristians.net";
|
||||
global "ircop.awesomechristians.net";
|
||||
coadmin "co.admin.awesomechristians.net";
|
||||
admin "admin.awesomechristians.net";
|
||||
servicesadmin "services.admin.awesomechristians.net";
|
||||
netadmin "network.admin.awesomechristians.net";
|
||||
host-on-oper-up "on";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* CTCP Networks (irc.ctcp.net) Network Configuration File
|
||||
*
|
||||
* Added-at: 12 February 2002 19:54
|
||||
* Author: Mark
|
||||
* Email: mark@ctcp.net
|
||||
*/
|
||||
|
||||
set {
|
||||
network-name "CTCP Networks";
|
||||
default-server "irc.ctcp.net";
|
||||
services-server "services.ctcp.net";
|
||||
stats-server "stats.ctcp.net";
|
||||
help-channel "#opers";
|
||||
hiddenhost-prefix "ctcp";
|
||||
hosts {
|
||||
local "locop.ctcp.net";
|
||||
global "oper.ctcp.net";
|
||||
coadmin "coadmin.ctcp.net";
|
||||
admin "admin.ctcp.net";
|
||||
servicesadmin "csop.ctcp.net";
|
||||
netadmin "netadmin.ctcp.net";
|
||||
host-on-oper-up yes;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Dark Kaos Network (irc.darkkaos.net) Network Configuration File
|
||||
*
|
||||
* Added-at: 04 February 2002 03:15
|
||||
* Author: ka0t1c_m4n
|
||||
* Email: drk_kaos@yahoo.com
|
||||
*/
|
||||
|
||||
set {
|
||||
network-name "Dark Kaos Network";
|
||||
default-server "irc.darkkaos.net";
|
||||
services-server "services.darkkaos.net";
|
||||
stats-server "stats.darkkaos.net";
|
||||
help-channel "#help";
|
||||
hiddenhost-prefix "hide";
|
||||
hosts {
|
||||
local "localop.darkkaos.net";
|
||||
global "would.u.like.to.be.me.com";
|
||||
coadmin "ircop.darkkaos.net";
|
||||
admin "i.hate.terr.oists.net";
|
||||
servicesadmin "Csop.darkkaos.net";
|
||||
netadmin "netadmin.darkkaos.net";
|
||||
host-on-oper-up yes;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Discussioni.Org (IRC.Discussioni.Org) Network Configuration File
|
||||
*
|
||||
* Added-at: 17 January 2002 22:39
|
||||
* Author: Jollino
|
||||
* Email: jollino@discussioni.org
|
||||
*/
|
||||
|
||||
set {
|
||||
network-name "Discussioni.Org";
|
||||
default-server "IRC.Discussioni.Org";
|
||||
services-server "Services.Discussioni.Org";
|
||||
stats-server "Stats.Discussioni.Org";
|
||||
help-channel "#help";
|
||||
hiddenhost-prefix "DISCUSSIONI";
|
||||
hosts {
|
||||
local "LocOp.Discussioni.Org";
|
||||
global "Oper.Discussioni.Org";
|
||||
coadmin "Co-Admin.Discussioni.Org";
|
||||
admin "Admin.Discussioni.Org";
|
||||
servicesadmin "ServOper.Discussioni.Org";
|
||||
netadmin "NetAdmin.Discussioni.Org";
|
||||
host-on-oper-up yes;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* IceChat (irc.icechat.net) Network Configuration File
|
||||
*
|
||||
* Added-at: 19 February 2002 16:55
|
||||
* Author: Rosco
|
||||
* Email: pssystem@home.com
|
||||
*/
|
||||
|
||||
set {
|
||||
network-name "IceChat";
|
||||
default-server "irc.icechat.net";
|
||||
services-server "services.icechat.net";
|
||||
stats-server "stats.icechat.net";
|
||||
help-channel "#help";
|
||||
hiddenhost-prefix "00";
|
||||
hosts {
|
||||
local "locop.icechat.net";
|
||||
global "oper.icechat.net";
|
||||
coadmin "coadmin.icechat.net";
|
||||
admin "admin.icechat.net";
|
||||
servicesadmin "csop.icechat.net";
|
||||
netadmin "netadmin.icechat.net";
|
||||
host-on-oper-up yes;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* ROXnet (irc.rox.za.net) Network Configuration File
|
||||
* --------------------------------------------------
|
||||
* Added-at: 14 July 1999 00:00 GMT
|
||||
* Author: Stskeeps (Carsten Munk)
|
||||
* E-Mail: stskeeps@roxnet.org
|
||||
* $Id$
|
||||
* -----------------------------------------
|
||||
*/
|
||||
|
||||
set {
|
||||
network-name "IRCsystems";
|
||||
default-server "irc.ircsystems.net";
|
||||
services-server "services.ircsystems.net";
|
||||
stats-server "stats.ircsystems.net";
|
||||
help-channel "#IRCsystems";
|
||||
hiddenhost-prefix "rox";
|
||||
prefix-quit "Quit:";
|
||||
hosts {
|
||||
local "locop.ircsystems.net";
|
||||
global "ircop.ircsystems.net";
|
||||
coadmin "coadmin.ircsystems.net";
|
||||
admin "admin.ircsystems.net";
|
||||
servicesadmin "csops.ircsystems.net";
|
||||
techadmin "techadmin.ircsystems.net";
|
||||
netadmin "netadmin.ircsystems.net";
|
||||
host-on-oper-up "off";
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* l33t-irc.com (irc.l33t-irc.com) Network Configuration File
|
||||
*
|
||||
* Added-at: 04 January 2002 15:46
|
||||
* Author: [LW]FlOwBiE
|
||||
* Email: flowbie@l33t-irc.com
|
||||
*/
|
||||
|
||||
set {
|
||||
network-name "l33t-irc.com";
|
||||
default-server "irc.l33t-irc.com";
|
||||
services-server "services.l33t-irc.com";
|
||||
stats-server "stats.l33t-irc.com";
|
||||
help-channel "#l33t-irc.com";
|
||||
hiddenhost-prefix "l33t-irc.com";
|
||||
hosts {
|
||||
local "local.l33t-irc.com";
|
||||
global "l33t-irc";
|
||||
coadmin "coadmin.l33t-irc.com";
|
||||
admin "admin.l33t-irc.com";
|
||||
servicesadmin "servicesadmin.l33t-irc.com";
|
||||
netadmin "netadmin.l33t-irc.com";
|
||||
host-on-oper no;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -6,57 +6,33 @@
|
||||
* of these networks.
|
||||
*/
|
||||
|
||||
networks/action-irc.network ......: Action-IRC (http://www.action-irc.net)
|
||||
networks/awesomechristians.network: Awesome Christians Chat Network (http://www.awesomechristians.com)
|
||||
networks/axenet.network ..........: AXEnet (http://www.axenet.org)
|
||||
networks/bitchx.network ..........: BitchX (http://www.bitchx.cl)
|
||||
networks/blind-irc.network .......: Blind-Irc (http://www.blind-irc.com)
|
||||
networks/bunker7.network .........: Bunker7 (http://www.bunker7.net)
|
||||
networks/burnnet.network .........: BuRnNET (http://www.burncycl.net)
|
||||
networks/cabonet.network .........: CaboNet (http://www.cabonet.org)
|
||||
networks/cc2.network .............: CC2 (http://www.cc2.org)
|
||||
networks/chatcrap.network ........: ChatCrap (http://www.chatcrap.com)
|
||||
networks/chatuniverse.network ....: ChatUniverse (http://www.chatuniverse.net)
|
||||
networks/coolchat.network ........: Coolchat (http://www.coolchat.net)
|
||||
networks/cynicnet.network ........: CynicNet (http://www.cynicnet.org)
|
||||
networks/dark-core.network .......: Dark Core Networks
|
||||
networks/darkfyre.network ........: Darkfyre (http://www.darkfyre.net)
|
||||
networks/darkwar.network .........: Darkwar (http://www.darkwar.net)
|
||||
networks/ctcp.network ............: CTCP Networks (http://www.ctcp.net)
|
||||
networks/darkkaos.network ........: Dark Kaos Network (http://www.darkkaos.net)
|
||||
networks/digitalirc.network ......: DigitalIRC (http://www.digitalirc.net)
|
||||
networks/discussioni.network .....: Discussioni.org (http://www.discussioni.org)
|
||||
networks/dragonwings.network .....: DragonWings (http://www.dragonwings.org)
|
||||
networks/fireirc.network .........: FireIRC (http://www.fireirc.net)
|
||||
networks/flort.network ...........: Flort
|
||||
networks/friendlyirc.network .....: FriendlyIRC (http://www.friendlyirc.net)
|
||||
networks/gamescafe.network .......: GamesCafe (http://www.gamerscafe.net)
|
||||
networks/geridnet.network ........: Gerid.Net (http://www.gerid.net)
|
||||
networks/german-elite.network ....: German-Elite (http://www.german-elite.net)
|
||||
networks/german-global-irc.network: German Global IRC (http://www.global-irc.de)
|
||||
networks/globalchat.network ......: GlobalChat (http://www.globalchat.ca)
|
||||
networks/global-irc.network ......: Global-IRC (http://www.global-irc.net)
|
||||
networks/globo.network ...........: Globo
|
||||
networks/icechat.network .........: IceChat (http://www.icechat.net)
|
||||
networks/infinity.network ........: Infinity-IRC.org (http://www.infinity-irc.org)
|
||||
networks/irclatino.network .......: IRCLatino (http://www.irclatino.org)
|
||||
networks/irc4ever.network ........: IRC4ever (http://www.irc4ever.net)
|
||||
networks/isno.network ............: Isno (http://www.isno.net)
|
||||
networks/israelnet.network .......: IsraelNet (http://www.israel.net)
|
||||
networks/l33t-irc.network ........: L33T-IRC (http://www.l33t-irc.com)
|
||||
networks/lcirc.network ...........: LCIrc (http://www.lcirc.net)
|
||||
networks/lostchat.network ........: Lostchat (http://www.lostchat.net)
|
||||
networks/maxatnet.network ........: MaxatNet
|
||||
networks/phatnet.network .........: PhatNet (http://www.phat-net.de)
|
||||
networks/outsiderz.network .......: Outsiderz (http://www.outsiderz.com)
|
||||
networks/phazenet.network ........: PhazeNet (http://www.phazenet.com)
|
||||
networks/pheernet.network ........: PheerNet (http://www.pheernet.org)
|
||||
networks/roxnet.network ..........: ROXnet (http://www.roxnet.org)
|
||||
networks/shallomchat.network .....: ShallomChat (http://www.shallomchat.org)
|
||||
networks/solargalaxy.network .....: SolarGalaxy (http://www.solargalaxy.net)
|
||||
netwrosk/spamnet.network .........: SpamNet (http://www.spamnet.org)
|
||||
networks/spin.network ............: SpiN (http://www.spinempire.com)
|
||||
networks/starequinox.network .....: StarEquinox (http://www.starequinox.net)
|
||||
networks/stormdancing.network ....: StormDancing (http://www.stormdancing.net)
|
||||
networks/thainet.network .........: Thai IRC Network
|
||||
networks/tspre.network ...........: TSpre (http://www.tspre.org)
|
||||
networks/unitedirc.network .......: UnitedIRC (http://www.unitedirc.com)
|
||||
networks/unitedirc-org.network ...: Unitedirc (http://www.unitedirc.org)
|
||||
networks/united-irc.network ......: united-irc
|
||||
networks/uzaynet.network .........: UzayNet (http://www.uzaynet.nu)
|
||||
networks/wazzza.network ..........: wazZza (http://www.wazzza.org)
|
||||
networks/x-irc.network ...........: x-irc (http://www.x-irc.net)
|
||||
networks/zirc.network ............: ZiRC (http://www.zirc.org)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
*
|
||||
* Outsiderz.com (irc.Outsiderz.com) Network Configuration File
|
||||
*
|
||||
* Added-at: 29 January 2002 07:35
|
||||
* Author: DrDeath
|
||||
* Email: DrDeath@hotmail.com
|
||||
*/
|
||||
|
||||
set {
|
||||
network-name "Outsiderz.com";
|
||||
default-server "irc.Outsiderz.com";
|
||||
services-server "services.outsiderz.com";
|
||||
stats-server "stats.outsiderz.com";
|
||||
help-channel "#Outsiderz";
|
||||
hiddenhost-prefix "Outsiderz";
|
||||
hosts {
|
||||
local "LocOP.Outsiderz.com";
|
||||
global "IrcOP.Outsiderz.com";
|
||||
coadmin "CoAdmin.Outsiderz.com";
|
||||
admin "Admin.Outsiderz.com";
|
||||
servicesadmin "CsOP.Outsiderz.com";
|
||||
netadmin "NetAdmin.Outsiderz.com";
|
||||
host-on-oper-up yes;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -50,12 +50,15 @@ char *stripbadwords_channel(char *str)
|
||||
char *ptr;
|
||||
int errorcode, matchlen, stringlen;
|
||||
ConfigItem_badword *this_word;
|
||||
|
||||
size_t n;
|
||||
if (!conf_badword_channel)
|
||||
return str;
|
||||
strncpy(cleanstr, str, sizeof(cleanstr) - 1); /* Let's work on a backup */
|
||||
memset(&pmatch, 0, sizeof(pmatch));
|
||||
stringlen = strlen(cleanstr);
|
||||
|
||||
/*
|
||||
* work on a copy
|
||||
*/
|
||||
stringlen = strlcpy(cleanstr, str, sizeof cleanstr);
|
||||
memset(&pmatch, 0, sizeof pmatch);
|
||||
matchlen = 0;
|
||||
buf[0] = '\0';
|
||||
|
||||
@@ -68,23 +71,28 @@ char *stripbadwords_channel(char *str)
|
||||
return cleanstr;
|
||||
}
|
||||
|
||||
ptr = cleanstr; /* Set pointer to start of string */
|
||||
/*
|
||||
* Set pointer to start of string
|
||||
*/
|
||||
ptr = cleanstr;
|
||||
|
||||
while (regexec(&pcomp, ptr, MAX_MATCH, pmatch,
|
||||
0) != REG_NOMATCH)
|
||||
{
|
||||
if (pmatch[0].rm_so == -1)
|
||||
break;
|
||||
matchlen += pmatch[0].rm_eo - pmatch[0].rm_so;
|
||||
strncat(buf, ptr, pmatch[0].rm_so);
|
||||
strlncat(buf, ptr, sizeof buf, pmatch[0].rm_so);
|
||||
if (this_word->replace)
|
||||
strcat(buf, this_word->replace);
|
||||
strlcat(buf, this_word->replace, sizeof buf);
|
||||
else
|
||||
strcat(buf, REPLACEWORD);
|
||||
strlcat(buf, REPLACEWORD, sizeof buf);
|
||||
ptr += pmatch[0].rm_eo; /* Set pointer after the match pos */
|
||||
memset(&pmatch, 0, sizeof(pmatch));
|
||||
}
|
||||
strcat(buf, ptr); /* All the better to eat you with! */
|
||||
strncpy(cleanstr, buf, sizeof(cleanstr));
|
||||
/* All the better to eat you with! */
|
||||
strlcat(buf, ptr, sizeof buf);
|
||||
memcpy(cleanstr, buf, sizeof cleanstr);
|
||||
memset(buf, 0, sizeof(buf));
|
||||
regfree(&pcomp);
|
||||
if (matchlen == stringlen)
|
||||
@@ -101,18 +109,21 @@ char *stripbadwords_message(char *str)
|
||||
static char cleanstr[4096];
|
||||
char buf[4096];
|
||||
char *ptr;
|
||||
ConfigItem_badword *this_word;
|
||||
int errorcode, matchlen, stringlen;
|
||||
|
||||
ConfigItem_badword *this_word;
|
||||
size_t n;
|
||||
if (!conf_badword_message)
|
||||
return str;
|
||||
strncpy(cleanstr, str, sizeof(cleanstr) - 1); /* Let's work on a backup */
|
||||
memset(&pmatch, 0, sizeof(pmatch));
|
||||
stringlen = strlen(cleanstr);
|
||||
|
||||
/*
|
||||
* work on a copy
|
||||
*/
|
||||
stringlen = strlcpy(cleanstr, str, sizeof cleanstr);
|
||||
memset(&pmatch, 0, sizeof pmatch);
|
||||
matchlen = 0;
|
||||
buf[0] = '\0';
|
||||
|
||||
for (this_word = conf_badword_message; this_word; this_word = (ConfigItem_badword *)this_word->next)
|
||||
for (this_word = conf_badword_message; this_word; this_word = (ConfigItem_badword *)this_word->next)
|
||||
{
|
||||
if ((errorcode =
|
||||
regcomp(&pcomp, this_word->word, REG_ICASE)) > 0)
|
||||
@@ -121,23 +132,28 @@ char *stripbadwords_message(char *str)
|
||||
return cleanstr;
|
||||
}
|
||||
|
||||
ptr = cleanstr; /* Set pointer to start of string */
|
||||
/*
|
||||
* Set pointer to start of string
|
||||
*/
|
||||
ptr = cleanstr;
|
||||
|
||||
while (regexec(&pcomp, ptr, MAX_MATCH, pmatch,
|
||||
0) != REG_NOMATCH)
|
||||
{
|
||||
if (pmatch[0].rm_so == -1)
|
||||
break;
|
||||
matchlen += pmatch[0].rm_eo - pmatch[0].rm_so;
|
||||
strncat(buf, ptr, pmatch[0].rm_so);
|
||||
strlncat(buf, ptr, sizeof buf, pmatch[0].rm_so);
|
||||
if (this_word->replace)
|
||||
strcat(buf, this_word->replace);
|
||||
strlcat(buf, this_word->replace, sizeof buf);
|
||||
else
|
||||
strcat(buf, REPLACEWORD);
|
||||
strlcat(buf, REPLACEWORD, sizeof buf);
|
||||
ptr += pmatch[0].rm_eo; /* Set pointer after the match pos */
|
||||
memset(&pmatch, 0, sizeof(pmatch));
|
||||
}
|
||||
strcat(buf, ptr); /* All the better to eat you with! */
|
||||
strncpy(cleanstr, buf, sizeof(cleanstr));
|
||||
/* All the better to eat you with! */
|
||||
strlcat(buf, ptr, sizeof buf);
|
||||
memcpy(cleanstr, buf, sizeof cleanstr);
|
||||
memset(buf, 0, sizeof(buf));
|
||||
regfree(&pcomp);
|
||||
if (matchlen == stringlen)
|
||||
|
||||
@@ -539,13 +539,13 @@ extern Ban *is_banned(aClient *cptr, aClient *sptr, aChannel *chptr)
|
||||
|
||||
s = make_nick_user_host(cptr->name, cptr->user->username,
|
||||
cptr->user->realhost);
|
||||
strcpy(realhost, s);
|
||||
strlcpy(realhost, s, sizeof realhost);
|
||||
|
||||
if (dovirt)
|
||||
{
|
||||
s = make_nick_user_host(cptr->name, cptr->user->username,
|
||||
cptr->user->virthost);
|
||||
strcpy(virthost, s);
|
||||
cptr->user->virthost);
|
||||
strlcpy(virthost, s, sizeof virthost);
|
||||
}
|
||||
/* We now check +b first, if a +b is found we then see if there is a +e.
|
||||
* If a +e was found we return NULL, if not, we return the ban.
|
||||
@@ -811,7 +811,8 @@ static void channel_modes(aClient *cptr, char *mbuf, char *pbuf, aChannel *chptr
|
||||
if (IsMember(cptr, chptr) || IsServer(cptr)
|
||||
|| IsULine(cptr))
|
||||
{
|
||||
(void)ircsprintf(bcbuf, "%s ", chptr->mode.key);
|
||||
/* FIXME: hope pbuf is long enough */
|
||||
(void)snprintf(bcbuf, sizeof bcbuf, "%s ", chptr->mode.key);
|
||||
(void)strcat(pbuf, bcbuf);
|
||||
}
|
||||
}
|
||||
@@ -821,7 +822,8 @@ static void channel_modes(aClient *cptr, char *mbuf, char *pbuf, aChannel *chptr
|
||||
if (IsMember(cptr, chptr) || IsServer(cptr)
|
||||
|| IsULine(cptr))
|
||||
{
|
||||
(void)ircsprintf(bcbuf, "%s ", chptr->mode.link);
|
||||
/* FIXME: is pbuf long enough? */
|
||||
(void)snprintf(bcbuf, sizeof bcbuf, "%s ", chptr->mode.link);
|
||||
(void)strcat(pbuf, bcbuf);
|
||||
}
|
||||
}
|
||||
@@ -879,8 +881,8 @@ static int send_mode_list(aClient *cptr, char *chname, TS creationtime, Member *
|
||||
if (strlen(parabuf) + strlen(name) + 11 < (size_t)MODEBUFLEN)
|
||||
{
|
||||
if (*parabuf)
|
||||
(void)strcat(parabuf, " ");
|
||||
(void)strcat(parabuf, name);
|
||||
(void)strlcat(parabuf, " ", sizeof parabuf);
|
||||
(void)strlcat(parabuf, name, sizeof parabuf);
|
||||
count++;
|
||||
*cp++ = flag;
|
||||
*cp = '\0';
|
||||
@@ -901,7 +903,7 @@ static int send_mode_list(aClient *cptr, char *chname, TS creationtime, Member *
|
||||
*cp++ = '+';
|
||||
if (count != RESYNCMODES)
|
||||
{
|
||||
(void)strcpy(parabuf, name);
|
||||
(void)strlcpy(parabuf, name, sizeof parabuf);
|
||||
*cp++ = flag;
|
||||
}
|
||||
count = 0;
|
||||
@@ -2727,10 +2729,13 @@ CMD_FUNC(channel_link)
|
||||
continue;
|
||||
}
|
||||
if (*jbuf)
|
||||
(void)strcat(jbuf, ",");
|
||||
(void)strncat(jbuf, name, sizeof(jbuf) - i - 1);
|
||||
(void)strlcat(jbuf, ",", sizeof jbuf);
|
||||
(void)strlncat(jbuf, name, sizeof jbuf, sizeof(jbuf) - i - 1);
|
||||
i += strlen(name) + 1;
|
||||
}
|
||||
/*
|
||||
* FIXME: Hopefully parv[1] is long enough?
|
||||
*/
|
||||
(void)strcpy(parv[1], jbuf);
|
||||
|
||||
p = NULL;
|
||||
@@ -2963,8 +2968,8 @@ CMD_FUNC(m_join)
|
||||
continue;
|
||||
}
|
||||
if (*jbuf)
|
||||
(void)strcat(jbuf, ",");
|
||||
(void)strncat(jbuf, name, sizeof(jbuf) - i - 1);
|
||||
(void)strlcat(jbuf, ",", sizeof jbuf);
|
||||
(void)strlncat(jbuf, name, sizeof jbuf, sizeof(jbuf) - i - 1);
|
||||
i += strlen(name) + 1;
|
||||
}
|
||||
(void)strcpy(parv[1], jbuf);
|
||||
@@ -3933,7 +3938,7 @@ char mode_buf[MODEBUFLEN], parabuf[MODEBUFLEN];
|
||||
if (mode_buf[2] == '\0')
|
||||
mode_buf[0] = '\0';
|
||||
else
|
||||
strcat(mode_buf, "]");
|
||||
strlcat(mode_buf, "]", sizeof mode_buf);
|
||||
#endif
|
||||
if (!IsAnOper(cptr))
|
||||
sendto_one(cptr,
|
||||
@@ -4268,7 +4273,7 @@ CMD_FUNC(m_list)
|
||||
if (mode_buf[2] == '\0')
|
||||
mode_buf[0] = '\0';
|
||||
else
|
||||
strcat(mode_buf, "]");
|
||||
strlcat(mode_buf, "]", sizeof mode_buf);
|
||||
#endif
|
||||
sendto_one(sptr,
|
||||
rpl_str(RPL_LIST),
|
||||
@@ -4442,7 +4447,7 @@ void send_user_joins(aClient *cptr, aClient *user)
|
||||
int cnt = 0, len = 0, clen;
|
||||
char *mask;
|
||||
|
||||
ircsprintf(buf, ":%s %s ", user->name,
|
||||
snprintf(buf, sizeof buf, ":%s %s ", user->name,
|
||||
(IsToken(cptr) ? TOK_JOIN : MSG_JOIN));
|
||||
len = strlen(buf);
|
||||
|
||||
@@ -4462,18 +4467,18 @@ void send_user_joins(aClient *cptr, aClient *user)
|
||||
buf[len - 1] = '\0';
|
||||
sendto_one(cptr, "%s", buf);
|
||||
}
|
||||
ircsprintf(buf, ":%s %s ", user->name,
|
||||
snprintf(buf, sizeof buf, ":%s %s ", user->name,
|
||||
(IsToken(cptr) ? TOK_JOIN : MSG_JOIN));
|
||||
len = strlen(buf);
|
||||
cnt = 0;
|
||||
}
|
||||
(void)strcpy(buf + len, chptr->chname);
|
||||
(void)strlcpy(buf + len, chptr->chname, sizeof buf-len);
|
||||
cnt++;
|
||||
len += clen;
|
||||
if (lp->next)
|
||||
{
|
||||
len++;
|
||||
(void)strcat(buf, ",");
|
||||
(void)strlcat(buf, ",", sizeof buf);
|
||||
}
|
||||
}
|
||||
if (*buf && cnt)
|
||||
@@ -4672,8 +4677,8 @@ else if (b == MAXMODEPARAMS) {\
|
||||
}
|
||||
#define Addsingle(x) modebuf[b] = x; b++
|
||||
#define CheckStatus(x,y) if (modeflags & (y)) { Addit((x), nick); }
|
||||
#define AddBan(x) strcat(banbuf, x); strcat(banbuf, " ");
|
||||
#define AddEx(x) strcat(exbuf, x); strcat(exbuf, " ");
|
||||
#define AddBan(x) strlcat(banbuf, x, sizeof banbuf); strlcat(banbuf, " ", sizeof banbuf);
|
||||
#define AddEx(x) strlcat(exbuf, x, sizeof exbuf); strlcat(exbuf, " ", sizeof banbuf);
|
||||
|
||||
|
||||
CMD_FUNC(m_sjoin)
|
||||
@@ -4853,7 +4858,7 @@ CMD_FUNC(m_sjoin)
|
||||
b = 1;
|
||||
c = 0;
|
||||
bp = buf;
|
||||
strcpy(cbuf, parv[parc-1]);
|
||||
strlcpy(cbuf, parv[parc-1], sizeof cbuf);
|
||||
for (s = s0 = strtoken(&p, cbuf, " "); s; s = s0 = strtoken(&p, (char *)NULL, " "))
|
||||
{
|
||||
|
||||
@@ -4986,15 +4991,15 @@ CMD_FUNC(m_sjoin)
|
||||
|
||||
if (!merge && !removetheirs && !nomode)
|
||||
{
|
||||
strcpy(modebuf, parv[3]);
|
||||
strlcpy(modebuf, parv[3], sizeof modebuf);
|
||||
parabuf[0] = '\0';
|
||||
if (!nopara)
|
||||
for (b = 4; b <= (parc - 2); b++)
|
||||
{
|
||||
strcat(parabuf, parv[b]);
|
||||
strcat(parabuf, " ");
|
||||
strlcat(parabuf, parv[b], sizeof parabuf);
|
||||
strlcat(parabuf, " ", sizeof parabuf);
|
||||
}
|
||||
strcpy(paraback, parabuf);
|
||||
strlcpy(paraback, parabuf, sizeof paraback);
|
||||
ap = mp2parv(modebuf, parabuf);
|
||||
set_mode(chptr, cptr, ap->parc, ap->parv, &pcount, pvar, 0);
|
||||
sendto_serv_butone_sjoin(cptr,
|
||||
@@ -5009,13 +5014,13 @@ CMD_FUNC(m_sjoin)
|
||||
aCtab *acp;
|
||||
bcopy(&chptr->mode, &oldmode, sizeof(Mode));
|
||||
/* merge the modes */
|
||||
strcpy(modebuf, parv[3]);
|
||||
strlcpy(modebuf, parv[3], sizeof modebuf);
|
||||
parabuf[0] = '\0';
|
||||
if (!nopara)
|
||||
for (b = 4; b <= (parc - 2); b++)
|
||||
{
|
||||
strcat(parabuf, parv[b]);
|
||||
strcat(parabuf, " ");
|
||||
strlcat(parabuf, parv[b], sizeof parabuf);
|
||||
strlcat(parabuf, " ", sizeof parabuf);
|
||||
}
|
||||
ap = mp2parv(modebuf, parabuf);
|
||||
set_mode(chptr, cptr, ap->parc, ap->parv, &pcount, pvar, 0);
|
||||
@@ -5024,7 +5029,7 @@ CMD_FUNC(m_sjoin)
|
||||
We first see if any para modes are set
|
||||
|
||||
*/
|
||||
strcpy(modebuf, "-");
|
||||
strlcpy(modebuf, "-", sizeof modebuf);
|
||||
parabuf[0] = '\0';
|
||||
b = 1;
|
||||
/* however, is this really going to happen at all? may be unneeded */
|
||||
@@ -5064,7 +5069,7 @@ CMD_FUNC(m_sjoin)
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(modebuf, "+");
|
||||
strlcpy(modebuf, "+", sizeof modebuf);
|
||||
b = 1;
|
||||
}
|
||||
for (acp = cFlagTab; acp->mode; acp++)
|
||||
@@ -5120,7 +5125,7 @@ CMD_FUNC(m_sjoin)
|
||||
z = MAX(x, y);
|
||||
if (z == x)
|
||||
{
|
||||
strcpy(chptr->mode.key, oldmode.key);
|
||||
strlcpy(chptr->mode.key, oldmode.key, sizeof chptr->mode.key);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -5136,7 +5141,7 @@ CMD_FUNC(m_sjoin)
|
||||
z = MAX(x, y);
|
||||
if (z == x)
|
||||
{
|
||||
strcpy(chptr->mode.link, oldmode.link);
|
||||
strlcpy(chptr->mode.link, oldmode.link, sizeof(chptr->mode.link));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -5187,7 +5192,7 @@ CMD_FUNC(m_sjoin)
|
||||
oldts, chptr->creationtime);
|
||||
|
||||
|
||||
strcpy(parabuf, "");
|
||||
strlcpy(parabuf, "", sizeof parabuf);
|
||||
for (i = 2; i <= (parc - 2); i++)
|
||||
{
|
||||
if (!parv[i])
|
||||
@@ -5195,9 +5200,9 @@ CMD_FUNC(m_sjoin)
|
||||
sendto_ops("Got null parv in SJ3 code");
|
||||
continue;
|
||||
}
|
||||
strcat(parabuf, parv[i]);
|
||||
strlcat(parabuf, parv[i], sizeof parabuf);
|
||||
if (((i + 1) <= (parc - 2)))
|
||||
strcat(parabuf, " ");
|
||||
strlcat(parabuf, " ", sizeof parabuf);
|
||||
}
|
||||
if (!chptr->users)
|
||||
{
|
||||
@@ -5260,7 +5265,7 @@ static int send_ban_list(aClient *cptr, char *chname, TS creationtime, aChannel
|
||||
*cp++ = '+';
|
||||
if (count != MODEPARAMS)
|
||||
{
|
||||
(void)strcpy(parabuf, name);
|
||||
(void)strlcpy(parabuf, name, sizeof parabuf);
|
||||
*cp++ = 'b';
|
||||
}
|
||||
count = 0;
|
||||
@@ -5298,7 +5303,7 @@ static int send_ban_list(aClient *cptr, char *chname, TS creationtime, aChannel
|
||||
*cp++ = '+';
|
||||
if (count != MODEPARAMS)
|
||||
{
|
||||
(void)strcpy(parabuf, name);
|
||||
(void)strlcpy(parabuf, name, sizeof parabuf);
|
||||
*cp++ = 'e';
|
||||
}
|
||||
count = 0;
|
||||
@@ -5339,9 +5344,9 @@ void send_channel_modes_sjoin(aClient *cptr, aChannel *chptr)
|
||||
else
|
||||
{
|
||||
if (!SupportSJOIN2(cptr))
|
||||
strcpy(parabuf, "<none>");
|
||||
strlcpy(parabuf, "<none>", sizeof parabuf);
|
||||
else
|
||||
strcpy(parabuf, "<->");
|
||||
strlcpy(parabuf, "<->", sizeof parabuf);
|
||||
}
|
||||
ircsprintf(buf, "%s %ld %s %s %s :",
|
||||
(IsToken(cptr) ? TOK_SJOIN : MSG_SJOIN),
|
||||
|
||||
@@ -203,7 +203,8 @@ char *hidehost(char *host)
|
||||
#else
|
||||
l[i] = ((l[i] + KEY2) ^ KEY) + KEY3;
|
||||
#endif
|
||||
l[i] <<= 2; l[i] >>= 2;
|
||||
|
||||
l[i] &= 0x3FFFFFFF;
|
||||
}
|
||||
ircsprintf(cloaked, "%lx:%lx:%lx:IP",
|
||||
l[2], l[1], l[0]);
|
||||
@@ -220,7 +221,7 @@ char *hidehost(char *host)
|
||||
if (!(*p))
|
||||
{
|
||||
/* Do IPv4 cloaking here */
|
||||
strcpy(h1, host);
|
||||
strlcpy(h1, host, sizeof h1);
|
||||
i = 0;
|
||||
for (i = 0, p = strtok(h1, "."); p && (i <= 3); p = strtok(NULL, "."), i++)
|
||||
{
|
||||
@@ -241,9 +242,10 @@ char *hidehost(char *host)
|
||||
l[4] = crc32(host, strlen(host));
|
||||
l[2] = ((l[4] + KEY) ^ KEY3)^ KEY2;
|
||||
#endif
|
||||
l[2] <<= 2; l[2] >>= 2;
|
||||
l[0] <<= 1; l[0] >>= 1;
|
||||
ircsprintf(cloaked, "%lX.%lX.%lX.IP", l[2], l[1], l[0]);
|
||||
l[2] &= 0x3FFFFFFF;
|
||||
l[0] &= 0x7FFFFFFF;
|
||||
l[1] &= 0xFFFFFFFF;
|
||||
snprintf(cloaked, sizeof cloaked, "%lX.%lX.%lX.IP", l[2], l[1], l[0]);
|
||||
return cloaked;
|
||||
}
|
||||
else
|
||||
@@ -265,14 +267,13 @@ char *hidehost(char *host)
|
||||
#else
|
||||
l[0] = ((crc32(host, strlen(host)) ^ KEY2) + KEY) ^ KEY3;
|
||||
#endif
|
||||
l[0] <<= 2;
|
||||
l[0] >>= 2;
|
||||
l[0] &= 0x3FFFFFFF;
|
||||
p++;
|
||||
if (*p)
|
||||
sprintf(cloaked, "%s-%lX.%s", hidden_host,
|
||||
snprintf(cloaked, sizeof cloaked, "%s-%lX.%s", hidden_host,
|
||||
l[0], p);
|
||||
else
|
||||
sprintf(cloaked, "%s-%lX", hidden_host, l[0]);
|
||||
snprintf(cloaked, sizeof cloaked, "%s-%lX", hidden_host, l[0]);
|
||||
|
||||
return cloaked;
|
||||
}
|
||||
|
||||
@@ -613,14 +613,14 @@ int crule_parsearglist(crule_treeptr argrootp, int *next_tokp, char **ruleptr)
|
||||
{
|
||||
if ((arglen + wordlen) < (CR_MAXARGLEN - 1))
|
||||
{
|
||||
strcat(currarg, " ");
|
||||
strcat(currarg, word);
|
||||
strlcat(currarg, " ", sizeof currarg);
|
||||
strlcat(currarg, word, sizeof currarg);
|
||||
arglen += wordlen + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(currarg, word);
|
||||
strlcpy(currarg, word, sizeof currarg);
|
||||
arglen = wordlen;
|
||||
}
|
||||
errcode = crule_gettoken(next_tokp, ruleptr);
|
||||
|
||||
@@ -297,7 +297,7 @@ int dbuf_getmsg(dbuf *dyn, char *buf, int length)
|
||||
while (length > 0 && dlen > 0)
|
||||
{
|
||||
dlen--;
|
||||
if (*s == '\n' /* || *s == '\r' */ ) /*let stop at \n now .. */
|
||||
if (*s == '\n' || *s == '\r' )
|
||||
{
|
||||
copy = dyn->length - dlen;
|
||||
/*
|
||||
|
||||
@@ -211,7 +211,6 @@ DLLFUNC int m_akill(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
sendto_serv_butone(cptr, ":%s AKILL %s %s",
|
||||
IsServer(cptr) ? parv[0] : me.name, hostmask, usermask);
|
||||
|
||||
|
||||
check_pings(TStime(), 1);
|
||||
loop.do_bancheck = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -114,20 +114,20 @@ int m_guest_Unload(int module_unload)
|
||||
|
||||
DLLFUNC int m_guest(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
{
|
||||
int randnum;
|
||||
char guestnick[NICKLEN];
|
||||
char *param[2];
|
||||
int randnum;
|
||||
char guestnick[NICKLEN];
|
||||
char *param[2];
|
||||
|
||||
randnum = 1+(int) (99999.0*rand()/(RAND_MAX+10000.0));
|
||||
snprintf(guestnick, NICKLEN, "Guest%d", randnum);
|
||||
randnum = 1+(int) (99999.0*rand()/(RAND_MAX+10000.0));
|
||||
snprintf(guestnick, NICKLEN, "Guest%d", randnum);
|
||||
|
||||
while(find_client(guestnick, (aClient *)NULL))
|
||||
{
|
||||
randnum = 1+(int) (99999.0*rand()/(RAND_MAX+10000.0));
|
||||
snprintf(guestnick, NICKLEN, "Guest%d", randnum);
|
||||
}
|
||||
param[0] = sptr->name;
|
||||
param[1] = guestnick;
|
||||
m_nick(sptr,cptr,2,param);
|
||||
while(find_client(guestnick, (aClient *)NULL))
|
||||
{
|
||||
randnum = 1+(int) (99999.0*rand()/(RAND_MAX+10000.0));
|
||||
snprintf(guestnick, NICKLEN, "Guest%d", randnum);
|
||||
}
|
||||
param[0] = sptr->name;
|
||||
param[1] = guestnick;
|
||||
m_nick(sptr,cptr,2,param);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ DLLFUNC int m_kill(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
user = parv[1];
|
||||
path = parv[2]; /* Either defined or NULL (parc >= 2!!) */
|
||||
|
||||
strcpy(inpath, oinpath);
|
||||
strlcpy(inpath, oinpath, sizeof inpath);
|
||||
|
||||
#ifndef ROXnet
|
||||
if (IsServer(cptr) && (s = (char *)index(inpath, '.')) != NULL)
|
||||
@@ -245,9 +245,9 @@ DLLFUNC int m_kill(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
** ...!operhost!oper
|
||||
** ...!operhost!oper (comment)
|
||||
*/
|
||||
strcpy(inpath,
|
||||
strlcpy(inpath,
|
||||
IsHidden(cptr) ? cptr->user->virthost : cptr->user->
|
||||
realhost);
|
||||
realhost, sizeof inpath);
|
||||
if (kcount < 2) { /* Only check the path the first time
|
||||
around, or it gets appended to itself. */
|
||||
if (!BadPtr(path))
|
||||
|
||||
@@ -148,11 +148,9 @@ DLLFUNC int m_kline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
{
|
||||
*hosttemp = 0;
|
||||
hosttemp++;
|
||||
bzero(name, sizeof(name));
|
||||
bzero(uhost, sizeof(uhost));
|
||||
strlcpy(name, parv[1], sizeof name);
|
||||
strlcpy(uhost, hosttemp, sizeof uhost);
|
||||
|
||||
strncpy(name, parv[1], sizeof(name) - 1);
|
||||
strncpy(uhost, hosttemp, sizeof(uhost) - 1);
|
||||
|
||||
if (name[0] == '\0' || uhost[0] == '\0')
|
||||
{
|
||||
@@ -200,7 +198,7 @@ DLLFUNC int m_kline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
if (!acptr->user)
|
||||
return 0;
|
||||
|
||||
strcpy(name, acptr->user->username);
|
||||
strlcpy(name, acptr->user->username, sizeof name);
|
||||
if (MyClient(acptr))
|
||||
host = acptr->sockhost;
|
||||
else
|
||||
@@ -217,8 +215,14 @@ DLLFUNC int m_kline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
|
||||
/* Add some wildcards */
|
||||
|
||||
/*
|
||||
* sscanf is bad :/ at least make host < uhost
|
||||
*/
|
||||
if (strlen(host) > sizeof uhost)
|
||||
host[sizeof uhost - 1] = '\0';
|
||||
|
||||
strlcpy(uhost, host, sizeof uhost);
|
||||
|
||||
strcpy(uhost, host);
|
||||
if (isdigit(host[strlen(host) - 1]))
|
||||
{
|
||||
if (sscanf(host, "%d.%d.%d.%*d", &ip1, &ip2, &ip3))
|
||||
@@ -242,6 +246,6 @@ DLLFUNC int m_kline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
bconf->reason = parv[2] ? strdup(parv[2]) : NULL;
|
||||
bconf->flag.type2 = CONF_BAN_TYPE_TEMPORARY;
|
||||
AddListItem(bconf, conf_ban);
|
||||
check_pings(TStime(), 1);
|
||||
loop.do_bancheck = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -69,8 +69,6 @@ static oper_oflag_t oper_oflags[] = {
|
||||
"is now a co administrator (C)" },
|
||||
{ OFLAG_ISGLOBAL, &UMODE_OPER, &oper_host,
|
||||
"is now an operator (O)" },
|
||||
/* { 0xFFFFFFFF, &UMODE_LOCOP, &locop_host,
|
||||
"is now a local operator (o)" }, */
|
||||
{ OFLAG_HELPOP, &UMODE_HELPOP, 0 ,
|
||||
0 },
|
||||
{ OFLAG_GLOBOP, &UMODE_FAILOP, 0 ,
|
||||
@@ -79,8 +77,6 @@ static oper_oflag_t oper_oflags[] = {
|
||||
0 },
|
||||
{ OFLAG_WHOIS, &UMODE_WHOIS, 0 ,
|
||||
0 },
|
||||
{ OFLAG_HIDE, &UMODE_HIDE, 0 ,
|
||||
0 },
|
||||
{ 0, 0, 0 ,
|
||||
0 },
|
||||
};
|
||||
@@ -192,8 +188,8 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
|
||||
sptr->since += 7;
|
||||
return 0;
|
||||
}
|
||||
strcpy(nuhhost, make_user_host(sptr->user->username, sptr->user->realhost));
|
||||
strcpy(nuhhost2, make_user_host(sptr->user->username, Inet_ia2p(&sptr->ip)));
|
||||
strlcpy(nuhhost, make_user_host(sptr->user->username, sptr->user->realhost), sizeof(nuhhost));
|
||||
strlcpy(nuhhost2, make_user_host(sptr->user->username, Inet_ia2p(&sptr->ip)), sizeof(nuhhost2));
|
||||
for (oper_from = (ConfigItem_oper_from *) aconf->from;
|
||||
oper_from; oper_from = (ConfigItem_oper_from *) oper_from->next)
|
||||
if (!match(oper_from->name, nuhhost) || !match(oper_from->name, nuhhost2))
|
||||
@@ -256,6 +252,7 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
|
||||
|
||||
if ((aconf->oflags & OFLAG_HIDE) && iNAH && !BadPtr(host)) {
|
||||
iNAH_host(sptr, host);
|
||||
SetHidden(sptr);
|
||||
}
|
||||
|
||||
if (!IsOper(sptr))
|
||||
|
||||
@@ -213,6 +213,6 @@ DLLFUNC int m_rakill(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
sendto_serv_butone(cptr, ":%s RAKILL %s %s",
|
||||
IsServer(cptr) ? parv[0] : me.name, hostmask, usermask);
|
||||
|
||||
check_pings(TStime(), 1);
|
||||
loop.do_bancheck = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -200,10 +200,12 @@ int channel_svsmode(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
}
|
||||
i++;
|
||||
|
||||
strcpy(uhost, make_nick_user_host(acptr->name,
|
||||
acptr->user->username, acptr->user->realhost));
|
||||
strcpy(vhost, make_nick_user_host(acptr->name,
|
||||
acptr->user->username, acptr->user->virthost ? acptr->user->virthost : acptr->user->realhost));
|
||||
strlcpy(uhost, make_nick_user_host(acptr->name,
|
||||
acptr->user->username, acptr->user->realhost),
|
||||
sizeof uhost);
|
||||
strlcpy(vhost, make_nick_user_host(acptr->name,
|
||||
acptr->user->username, acptr->user->virthost ? acptr->user->virthost : acptr->user->realhost),
|
||||
sizeof vhost);
|
||||
ban = chptr->banlist;
|
||||
while (ban) {
|
||||
bnext = ban->next;
|
||||
@@ -240,12 +242,13 @@ int channel_svsmode(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
}
|
||||
i++;
|
||||
|
||||
strcpy(uhost, make_nick_user_host(acptr->name,
|
||||
acptr->user->username, acptr->user->realhost));
|
||||
strcpy(vhost, make_nick_user_host(acptr->name,
|
||||
strlcpy(uhost, make_nick_user_host(acptr->name,
|
||||
acptr->user->username, acptr->user->realhost),
|
||||
sizeof uhost);
|
||||
strlcpy(vhost, make_nick_user_host(acptr->name,
|
||||
acptr->user->username, acptr->user->virthost
|
||||
? acptr->user->virthost :
|
||||
acptr->user->realhost));
|
||||
acptr->user->realhost), sizeof vhost);
|
||||
ban = chptr->exlist;
|
||||
while (ban) {
|
||||
bnext = ban->next;
|
||||
|
||||
@@ -140,7 +140,7 @@ int m_svsnick(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
{
|
||||
RunHook2(HOOKTYPE_LOCAL_NICKCHANGE, acptr, parv[2]);
|
||||
}
|
||||
(void)strcpy(acptr->name, parv[2]);
|
||||
(void)strlcpy(acptr->name, parv[2], sizeof acptr->name);
|
||||
(void)add_to_client_hash_table(parv[2], acptr);
|
||||
if (IsPerson(acptr))
|
||||
hash_check_watch(acptr, RPL_LOGON);
|
||||
|
||||
@@ -180,6 +180,8 @@ DLLFUNC int m_unkline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
return 0;
|
||||
}
|
||||
/* This wasn't here before -- Barubary */
|
||||
check_pings(TStime(), 1);
|
||||
/* check_pings crap */
|
||||
/* No, and it shouldn't have been, dork. It crashes the IRCd randomly. -Stskeeps */
|
||||
loop.do_bancheck = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ DLLFUNC int m_unzline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
the same thing to remove it if they specified *@ or something... */
|
||||
if ((in = index(parv[1], '@')))
|
||||
{
|
||||
strcpy(userhost, in + 1);
|
||||
strlcpy(userhost, in + 1, sizeof userhost);
|
||||
in = &userhost[0];
|
||||
while (*in)
|
||||
{
|
||||
@@ -189,7 +189,7 @@ DLLFUNC int m_unzline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(userhost, parv[1]);
|
||||
strlcpy(userhost, parv[1], sizeof userhost);
|
||||
in = &userhost[0];
|
||||
while (*in)
|
||||
{
|
||||
|
||||
@@ -300,20 +300,20 @@ DLLFUNC int m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
{
|
||||
buf[0] = '\0';
|
||||
if (IsNetAdmin(acptr))
|
||||
strcat(buf, "a Network Administrator");
|
||||
strlcat(buf, "a Network Administrator", sizeof buf);
|
||||
else if (IsSAdmin(acptr))
|
||||
strcat(buf, "a Services Operator");
|
||||
strlcat(buf, "a Services Operator", sizeof buf);
|
||||
else if (IsAdmin(acptr) && !IsCoAdmin(acptr))
|
||||
strcat(buf, "a Server Administrator");
|
||||
strlcat(buf, "a Server Administrator", sizeof buf);
|
||||
else if (IsCoAdmin(acptr))
|
||||
strcat(buf, "a Co Administrator");
|
||||
strlcat(buf, "a Co Administrator", sizeof buf);
|
||||
else if (IsServices(acptr))
|
||||
strcat(buf, "a Network Service");
|
||||
strlcat(buf, "a Network Service", sizeof buf);
|
||||
else if (IsOper(acptr))
|
||||
strcat(buf, "an IRC Operator");
|
||||
strlcat(buf, "an IRC Operator", sizeof buf);
|
||||
|
||||
else
|
||||
strcat(buf, "a Local IRC Operator");
|
||||
strlcat(buf, "a Local IRC Operator", sizeof buf);
|
||||
if (buf[0])
|
||||
sendto_one(sptr,
|
||||
rpl_str(RPL_WHOISOPERATOR), me.name,
|
||||
|
||||
@@ -168,7 +168,7 @@ DLLFUNC int m_zline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
|
||||
if ((acptr = find_client(parv[1], NULL)))
|
||||
{
|
||||
strcpy(userhost, inetntoa((char *)&acptr->ip));
|
||||
strlcpy(userhost, inetntoa((char *)&acptr->ip), sizeof userhost);
|
||||
person = &acptr->name[0];
|
||||
acptr = NULL;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ DLLFUNC int m_zline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
work with ip addresses and nicks */
|
||||
else if ((in = index(parv[1], '@')) && (*(in + 1) != '\0'))
|
||||
{
|
||||
strcpy(userhost, in + 1);
|
||||
strlcpy(userhost, in + 1, sizeof userhost);
|
||||
in = &userhost[0];
|
||||
while (*in)
|
||||
{
|
||||
@@ -200,7 +200,7 @@ DLLFUNC int m_zline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(userhost, parv[1]);
|
||||
strlcpy(userhost, parv[1], sizeof userhost);
|
||||
in = &userhost[0];
|
||||
while (*in)
|
||||
{
|
||||
@@ -260,22 +260,13 @@ DLLFUNC int m_zline(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
{
|
||||
goto propo_label;
|
||||
}
|
||||
if (!match(mask, inetntoa((char *)&cptr->ip)))
|
||||
{
|
||||
sendto_realops("Tried to zap cptr, from %s",
|
||||
parv[0]);
|
||||
MyFree(bconf);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddListItem(bconf, conf_ban);
|
||||
}
|
||||
AddListItem(bconf, conf_ban);
|
||||
propo_label:
|
||||
if (propo == 1) /* propo is if a ulined server is propagating a z-line
|
||||
this should go after the above check */
|
||||
sendto_serv_butone(cptr, ":%s ZLINE %s :%s", parv[0], parv[1],
|
||||
reason ? reason : "");
|
||||
|
||||
check_pings(TStime(), 1);
|
||||
loop.do_bancheck = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -111,12 +111,25 @@ int m_scan_Load(int module_load)
|
||||
if (Scan_endpoint.SIN_PORT == 0)
|
||||
{
|
||||
|
||||
if (*conf_listen->ip == '*') {
|
||||
ircd_log(LOG_ERROR, "Scan.so failed to load: set::scan::endpoint is missing");
|
||||
HooktypeDel(ScanHost,ScanModInfo.handle);
|
||||
HookDel(LocConnect);
|
||||
HookDel(ConfUnknown);
|
||||
HookDel(ServerStats);
|
||||
LockEventSystem();
|
||||
EventDel(Scannings_clean);
|
||||
UnlockEventSystem();
|
||||
IRCMutexDestroy(Scannings_lock);
|
||||
return MOD_FAILED;
|
||||
}
|
||||
|
||||
#ifndef INET6
|
||||
Scan_endpoint.SIN_ADDR.S_ADDR = inet_addr("127.0.0.1");
|
||||
Scan_endpoint.SIN_ADDR.S_ADDR = inet_addr(conf_listen->ip);
|
||||
#else
|
||||
inet_pton(AFINET, "127.0.0.1", Scan_endpoint.SIN_ADDR.S_ADDR);
|
||||
inet_pton(AFINET, conf_listen->ip, Scan_endpoint.SIN_ADDR.S_ADDR);
|
||||
#endif
|
||||
Scan_endpoint.SIN_PORT = htons(2121);
|
||||
Scan_endpoint.SIN_PORT = htons(conf_listen->port);
|
||||
Scan_endpoint.SIN_FAMILY = AFINET;
|
||||
}
|
||||
if (Scan_BanTime == 0)
|
||||
@@ -159,9 +172,11 @@ int m_scan_Unload(void)
|
||||
HooktypeDel(ScanHost,ScanModInfo.handle);
|
||||
HookDel(LocConnect);
|
||||
HookDel(ConfUnknown);
|
||||
HookDel(ServerStats);
|
||||
LockEventSystem();
|
||||
EventDel(Scannings_clean);
|
||||
UnlockEventSystem();
|
||||
IRCMutexDestroy(Scannings_lock);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -249,7 +264,7 @@ EVENT(e_scan_ban)
|
||||
if (!sr)
|
||||
return;
|
||||
|
||||
strcpy(hostip, Inet_ia2p(&sr->in));
|
||||
strlcpy(hostip, Inet_ia2p(&sr->in), sizeof hostip);
|
||||
tkllayer[4] = hostip;
|
||||
tkllayer[5] = me.name;
|
||||
ircsprintf(mo, "%li", Scan_BanTime + TStime());
|
||||
@@ -266,7 +281,7 @@ void Eadd_scan(struct IN_ADDR *in, char *reason)
|
||||
{
|
||||
Scan_Result *sr = (Scan_Result *) MyMalloc(sizeof(Scan_Result));
|
||||
sr->in = *in;
|
||||
strcpy(sr->reason, reason);
|
||||
strlcpy(sr->reason, reason, sizeof sr->reason);
|
||||
LockEventSystem();
|
||||
EventAddEx(ScanModInfo.handle, "scan_ban", 0, 1, e_scan_ban, (void *)sr);
|
||||
UnlockEventSystem();
|
||||
@@ -286,7 +301,6 @@ DLLFUNC int h_scan_connect(aClient *sptr)
|
||||
Scan_AddrStruct *sr = NULL;
|
||||
Hook *hook = NULL;
|
||||
THREAD thread;
|
||||
THREAD_ATTR thread_attr;
|
||||
|
||||
if (Find_except(Inet_ia2p(&sptr->ip), 0))
|
||||
return 0;
|
||||
@@ -307,7 +321,7 @@ DLLFUNC int h_scan_connect(aClient *sptr)
|
||||
{
|
||||
IRCMutexLock(sr->lock);
|
||||
sr->refcnt++;
|
||||
IRCCreateThread(thread, thread_attr, (hook->func.voidfunc), sr);
|
||||
IRCCreateThread(thread, (hook->func.voidfunc), sr);
|
||||
IRCMutexUnlock(sr->lock);
|
||||
}
|
||||
return 1;
|
||||
|
||||
@@ -147,7 +147,6 @@ int scan_http_Unload(int module_unload)
|
||||
void scan_http_scan(Scan_AddrStruct *h)
|
||||
{
|
||||
THREAD thread[3];
|
||||
THREAD_ATTR thread_attr;
|
||||
HSStruct *p = NULL;
|
||||
|
||||
IRCMutexLock((h->lock));
|
||||
@@ -156,19 +155,19 @@ void scan_http_scan(Scan_AddrStruct *h)
|
||||
p = MyMalloc(sizeof(HSStruct));
|
||||
p->hs = h;
|
||||
p->port = 3128;
|
||||
IRCCreateThread(thread[0], thread_attr, scan_http_scan_port, p);
|
||||
IRCCreateThread(thread[0], scan_http_scan_port, p);
|
||||
/* Then we take 8080 .. */
|
||||
h->refcnt++;
|
||||
p = MyMalloc(sizeof(HSStruct));
|
||||
p->hs = h;
|
||||
p->port = 8080;
|
||||
IRCCreateThread(thread[1], thread_attr, scan_http_scan_port, p);
|
||||
IRCCreateThread(thread[1], scan_http_scan_port, p);
|
||||
/* And then we try to infect them with Code Red .. */
|
||||
h->refcnt++;
|
||||
p = MyMalloc(sizeof(HSStruct));
|
||||
p->hs = h;
|
||||
p->port = 80;
|
||||
IRCCreateThread(thread[2], thread_attr, scan_http_scan_port, p);
|
||||
IRCCreateThread(thread[2], scan_http_scan_port, p);
|
||||
IRCMutexUnlock((h->lock));
|
||||
IRCJoinThread(thread[0], NULL);
|
||||
IRCJoinThread(thread[1], NULL);
|
||||
@@ -176,6 +175,7 @@ void scan_http_scan(Scan_AddrStruct *h)
|
||||
IRCMutexLock((h->lock));
|
||||
h->refcnt--;
|
||||
IRCMutexUnlock((h->lock));
|
||||
IRCDetachThread(IRCThreadSelf());
|
||||
IRCExitThread(NULL);
|
||||
return;
|
||||
}
|
||||
@@ -240,8 +240,7 @@ void scan_http_scan_port(HSStruct *z)
|
||||
*/
|
||||
set_non_blocking(fd, NULL);
|
||||
if ((retval = connect(fd, (struct sockaddr *)&sin,
|
||||
sizeof(sin))) == -1 && !((ERRNO == P_EWOULDBLOCK)
|
||||
|| (ERRNO == P_EINPROGRESS)))
|
||||
sizeof(sin))) == -1 && !(ERRNO == P_EINPROGRESS))
|
||||
{
|
||||
/* we have no socks server! */
|
||||
CLOSE_SOCK(fd);
|
||||
@@ -261,7 +260,7 @@ void scan_http_scan_port(HSStruct *z)
|
||||
}
|
||||
|
||||
bzero(httpbuf, sizeof(httpbuf));
|
||||
sprintf(httpbuf, "CONNECT %s:%i HTTP/1.1\n\n",
|
||||
snprintf(httpbuf, sizeof httpbuf, "CONNECT %s:%i HTTP/1.1\n\n",
|
||||
Inet_ia2p(&xScan_endpoint->SIN_ADDR), ntohs(xScan_endpoint->SIN_PORT));
|
||||
if ((retval = send(fd, httpbuf, strlen(httpbuf), 0)) != strlen(httpbuf))
|
||||
{
|
||||
|
||||
@@ -143,18 +143,18 @@ int scan_socks_Unload(int module_unload)
|
||||
void scan_socks_scan(Scan_AddrStruct *h)
|
||||
{
|
||||
THREAD thread[2];
|
||||
THREAD_ATTR thread_attr;
|
||||
IRCMutexLock((h->lock));
|
||||
h->refcnt++;
|
||||
IRCCreateThread(thread[0], thread_attr, scan_socks4_scan, h);
|
||||
IRCCreateThread(thread[0], scan_socks4_scan, h);
|
||||
h->refcnt++;
|
||||
IRCCreateThread(thread[1], thread_attr, scan_socks5_scan, h);
|
||||
IRCCreateThread(thread[1], scan_socks5_scan, h);
|
||||
IRCMutexUnlock((h->lock));
|
||||
IRCJoinThread(thread[0], NULL);
|
||||
IRCJoinThread(thread[1], NULL);
|
||||
IRCMutexLock((h->lock));
|
||||
h->refcnt--;
|
||||
IRCMutexUnlock((h->lock));
|
||||
IRCDetachThread(IRCThreadSelf());
|
||||
IRCExitThread(NULL);
|
||||
return;
|
||||
}
|
||||
@@ -186,6 +186,13 @@ void scan_socks4_scan(Scan_AddrStruct *h)
|
||||
IRCMutexUnlock((h->lock));
|
||||
/* IPv6 ?*/
|
||||
#ifdef INET6
|
||||
IRCMutexLock((h->lock));
|
||||
#ifndef INET6
|
||||
sin.SIN_ADDR.S_ADDR = h->in.S_ADDR;
|
||||
#else
|
||||
bcopy(sin.SIN_ADDR.S_ADDR, h->in.S_ADDR, sizeof(h->in.S_ADDR));
|
||||
#endif
|
||||
IRCMutexUnlock((h->lock));
|
||||
/* ::ffff:ip hack */
|
||||
cp = (u_char *)&h->in.s6_addr;
|
||||
if (!(cp[0] == 0 && cp[1] == 0 && cp[2] == 0 && cp[3] == 0 && cp[4] == 0
|
||||
@@ -200,7 +207,6 @@ void scan_socks4_scan(Scan_AddrStruct *h)
|
||||
goto exituniverse;
|
||||
return;
|
||||
}
|
||||
|
||||
sin.SIN_PORT = htons((unsigned short)SCAN_ON_PORT);
|
||||
sin.SIN_FAMILY = AFINET;
|
||||
/* We do this non-blocking to prevent a hang of the entire ircd with newer
|
||||
@@ -222,14 +228,14 @@ void scan_socks4_scan(Scan_AddrStruct *h)
|
||||
*/
|
||||
set_non_blocking(fd, NULL);
|
||||
if ((retval = connect(fd, (struct sockaddr *)&sin,
|
||||
sizeof(sin))) == -1 && !((ERRNO == P_EWOULDBLOCK)
|
||||
|| (ERRNO == P_EINPROGRESS)))
|
||||
sizeof(sin))) == -1 && !(ERRNO == P_EINPROGRESS))
|
||||
{
|
||||
/* we have no socks server! */
|
||||
CLOSE_SOCK(fd);
|
||||
goto exituniverse;
|
||||
return;
|
||||
}
|
||||
ircd_log(LOG_ERROR, "%s:%d - (Connection Established)", Inet_ia2p(&h->in), SCAN_ON_PORT);
|
||||
|
||||
/* We wait for write-ready */
|
||||
tv.tv_sec = xScan_TimeOut;
|
||||
@@ -293,6 +299,7 @@ exituniverse:
|
||||
IRCMutexLock((h->lock));
|
||||
h->refcnt--;
|
||||
IRCMutexUnlock((h->lock));
|
||||
/* We get joined, we need no steekin Detach */
|
||||
IRCExitThread(NULL);
|
||||
return;
|
||||
}
|
||||
@@ -359,8 +366,7 @@ void scan_socks5_scan(Scan_AddrStruct *h)
|
||||
set_non_blocking(fd, NULL);
|
||||
if ((retval = connect(fd, (struct sockaddr *)&sin,
|
||||
sizeof(sin))) == -1 &&
|
||||
!((ERRNO == P_EWOULDBLOCK)
|
||||
|| (ERRNO == P_EINPROGRESS)))
|
||||
!(ERRNO == P_EINPROGRESS))
|
||||
{
|
||||
/* we have no socks server! */
|
||||
CLOSE_SOCK(fd);
|
||||
@@ -456,6 +462,7 @@ exituniverse:
|
||||
IRCMutexLock(h->lock);
|
||||
h->refcnt--;
|
||||
IRCMutexUnlock(h->lock);
|
||||
/* We need no steekin detach */
|
||||
IRCExitThread(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -159,9 +159,8 @@ int httpd_Unload(int module_unload)
|
||||
void httpd_setup_acceptthread(void)
|
||||
{
|
||||
THREAD thread;
|
||||
THREAD_ATTR thread_attr;
|
||||
|
||||
IRCCreateThread(thread, thread_attr, httpd_acceptthread, NULL);
|
||||
IRCCreateThread(thread, httpd_acceptthread, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -172,7 +171,6 @@ void httpd_acceptthread(void *p)
|
||||
int retval;
|
||||
SOCKET callerfd = -1;
|
||||
THREAD thread;
|
||||
THREAD_ATTR thread_attr;
|
||||
HTTPd_Request *req = NULL;
|
||||
|
||||
tv.tv_sec = 10;
|
||||
@@ -190,7 +188,7 @@ void httpd_acceptthread(void *p)
|
||||
req = (HTTPd_Request *) MyMallocEx(sizeof(HTTPd_Request));
|
||||
req->fd = callerfd;
|
||||
set_sock_opts(callerfd, NULL);
|
||||
IRCCreateThread(thread, thread_attr,
|
||||
IRCCreateThread(thread,
|
||||
httpd_socketthread, (void *)req);
|
||||
req = NULL;
|
||||
}
|
||||
@@ -282,6 +280,7 @@ void httpd_socketthread(void *preq)
|
||||
MyFree(hp2);
|
||||
}
|
||||
MyFree(request);
|
||||
IRCDetachThread(IRCThreadSelf());
|
||||
IRCExitThread(NULL);
|
||||
return;
|
||||
}
|
||||
@@ -385,8 +384,8 @@ void sockprintf(HTTPd_Request *r, char *format, ...)
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
vsprintf(r->inbuf, format, ap);
|
||||
strcat(r->inbuf, "\r\n");
|
||||
vsnprintf(r->inbuf, sizeof r->inbuf, format, ap);
|
||||
strlcat(r->inbuf, "\r\n", sizeof(r->inbuf));
|
||||
va_end(ap);
|
||||
set_blocking(r->fd);
|
||||
send(r->fd, r->inbuf, strlen(r->inbuf), 0),
|
||||
|
||||
@@ -105,7 +105,7 @@ DLLFUNC int h_u_phtml(HTTPd_Request *r)
|
||||
{
|
||||
int section = 0;
|
||||
char buf[1024];
|
||||
char bbuf[1024];
|
||||
char bbuf[sizeof buf];
|
||||
char *s;
|
||||
FILE *f = NULL;
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ void ban_flooder(aClient *cptr)
|
||||
NULL /*8 reason */
|
||||
};
|
||||
|
||||
strcpy(hostip, (char *)inetntoa((char *)&cptr->ip));
|
||||
strlcpy(hostip, (char *)inetntoa((char *)&cptr->ip), sizeof(hostip));
|
||||
|
||||
tkllayer[4] = hostip;
|
||||
tkllayer[5] = me.name;
|
||||
|
||||
@@ -187,7 +187,7 @@ static void rem_request(ResRQ *old)
|
||||
#ifdef _WIN32
|
||||
while (old->locked)
|
||||
Sleep(0);
|
||||
#endif
|
||||
#endif
|
||||
for (rptr = &first; *rptr; r2ptr = *rptr, rptr = &(*rptr)->next)
|
||||
if (*rptr == old)
|
||||
{
|
||||
@@ -203,7 +203,7 @@ static void rem_request(ResRQ *old)
|
||||
r2ptr = old;
|
||||
#ifndef _WIN32
|
||||
if (r2ptr->he.h_name)
|
||||
MyFree((char *)r2ptr->he.h_name);
|
||||
MyFree(r2ptr->he.h_name);
|
||||
for (i = 0; i < MAXALIASES; i++)
|
||||
if ((s = r2ptr->he.h_aliases[i]))
|
||||
MyFree(s);
|
||||
@@ -213,7 +213,7 @@ static void rem_request(ResRQ *old)
|
||||
#endif
|
||||
if (r2ptr->name)
|
||||
MyFree(r2ptr->name);
|
||||
MyFree((char *)r2ptr);
|
||||
MyFree(r2ptr);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -731,7 +731,7 @@ static int proc_answer(ResRQ *rptr, HEADER *hptr, char *buf, char *eob)
|
||||
/* name server never returns with trailing '.' */
|
||||
if (!index(hostbuf, '.') && (ircd_res.options & RES_DEFNAMES))
|
||||
{
|
||||
(void)strcat(hostbuf, dot);
|
||||
(void)strlcat(hostbuf, dot, sizeof hostbuf);
|
||||
len++;
|
||||
(void)strncat(hostbuf, ircd_res.defdname,
|
||||
sizeof(hostbuf) - 1 - len);
|
||||
@@ -789,7 +789,7 @@ static int proc_answer(ResRQ *rptr, HEADER *hptr, char *buf, char *eob)
|
||||
if (!hp->h_name && len < HOSTLEN)
|
||||
{
|
||||
hp->h_name =(char *)MyMalloc(len+1);
|
||||
(void)strcpy(hp->h_name, hostbuf);
|
||||
(void)strlcpy(hp->h_name, hostbuf, len+1);
|
||||
}
|
||||
ans++;
|
||||
adr++;
|
||||
@@ -820,7 +820,7 @@ static int proc_answer(ResRQ *rptr, HEADER *hptr, char *buf, char *eob)
|
||||
else
|
||||
{
|
||||
hp->h_name = (char *)MyMalloc(len + 1);
|
||||
(void)strcpy(hp->h_name, hostbuf);
|
||||
(void)strlcpy(hp->h_name, hostbuf, len +1);
|
||||
}
|
||||
ans++;
|
||||
break;
|
||||
@@ -832,7 +832,7 @@ static int proc_answer(ResRQ *rptr, HEADER *hptr, char *buf, char *eob)
|
||||
if (alias >= &(hp->h_aliases[MAXALIASES - 1]))
|
||||
break;
|
||||
*alias = (char *)MyMalloc(len + 1);
|
||||
(void)strcpy(*alias++, hostbuf);
|
||||
(void)strlcpy(*alias++, hostbuf, len+1);
|
||||
*alias = NULL;
|
||||
ans++;
|
||||
break;
|
||||
@@ -1096,7 +1096,7 @@ struct hostent *get_res(char *lp,long id)
|
||||
long amt;
|
||||
struct hostent *hp, *he = rptr->he;
|
||||
|
||||
strcpy(tempname, he->h_name);
|
||||
strlcpy(tempname, he->h_name, sizeof tempname);
|
||||
hp = gethostbyname(tempname);
|
||||
if (hp && !bcmp(hp->h_addr, he->h_addr, sizeof(struct IN_ADDR)))
|
||||
{
|
||||
@@ -1590,7 +1590,7 @@ static aCache *rem_list(aCache *cp)
|
||||
if (*cpp == cp)
|
||||
{
|
||||
*cpp = cp->list_next;
|
||||
MyFree((char *)cp);
|
||||
MyFree(cp);
|
||||
break;
|
||||
}
|
||||
return cr;
|
||||
@@ -1669,7 +1669,7 @@ static void rem_cache(aCache *ocp)
|
||||
break;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
MyFree((char *)hp);
|
||||
MyFree(hp);
|
||||
#else
|
||||
/*
|
||||
* free memory used to hold the various host names and the array
|
||||
@@ -1681,7 +1681,7 @@ static void rem_cache(aCache *ocp)
|
||||
{
|
||||
for (hashv = 0; hp->h_aliases[hashv]; hashv++)
|
||||
MyFree(hp->h_aliases[hashv]);
|
||||
MyFree((char *)hp->h_aliases);
|
||||
MyFree(hp->h_aliases);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1690,11 +1690,11 @@ static void rem_cache(aCache *ocp)
|
||||
if (hp->h_addr_list)
|
||||
{
|
||||
if (*hp->h_addr_list)
|
||||
MyFree((char *)*hp->h_addr_list);
|
||||
MyFree((char *)hp->h_addr_list);
|
||||
MyFree(*hp->h_addr_list);
|
||||
MyFree(hp->h_addr_list);
|
||||
}
|
||||
#endif
|
||||
MyFree((char *)ocp);
|
||||
MyFree(ocp);
|
||||
|
||||
incache--;
|
||||
cainfo.ca_dels++;
|
||||
@@ -1911,6 +1911,9 @@ int res_copyhostent(struct hostent *from, struct hostent *to)
|
||||
*/
|
||||
amt = (long)to + sizeof(struct hostent);
|
||||
to->h_name = (char *)amt;
|
||||
/*
|
||||
* WIN32: FIXME: THIS LOOKS BAD
|
||||
*/
|
||||
strcpy(to->h_name, from->h_name);
|
||||
amt += strlen(to->h_name)+1;
|
||||
/* Setup tto alias list */
|
||||
|
||||
@@ -464,7 +464,7 @@ int ircd_res_init(void)
|
||||
if (ircd_res.defdname[0] == 0 &&
|
||||
gethostname(buf, sizeof(ircd_res.defdname) - 1) == 0 &&
|
||||
(cp = strchr(buf, '.')) != NULL)
|
||||
strcpy(ircd_res.defdname, cp + 1);
|
||||
strlcpy(ircd_res.defdname, cp + 1, sizeof ircd_res.defdname);
|
||||
|
||||
/* find components of local domain that might be searched */
|
||||
if (havesearch == 0)
|
||||
|
||||
@@ -100,8 +100,7 @@ void start_auth(aClient *cptr)
|
||||
sock.SIN_FAMILY = AFINET;
|
||||
|
||||
if (connect(cptr->authfd, (struct sockaddr *)&sock,
|
||||
sizeof(sock)) == -1 && !((ERRNO == P_EWOULDBLOCK)
|
||||
|| (ERRNO == P_EINPROGRESS)))
|
||||
sizeof(sock)) == -1 && !(ERRNO == P_EINPROGRESS))
|
||||
{
|
||||
ircstp->is_abad++;
|
||||
/*
|
||||
|
||||
@@ -106,7 +106,7 @@ static struct SOCKADDR_IN mysk;
|
||||
|
||||
static struct SOCKADDR *connect_inet(ConfigItem_link *, aClient *, int *);
|
||||
static int completed_connection(aClient *);
|
||||
static int check_init(aClient *, char *);
|
||||
static int check_init(aClient *, char *, size_t);
|
||||
#ifndef _WIN32
|
||||
static void do_dns_async();
|
||||
void set_sock_opts(int, aClient *);
|
||||
@@ -354,7 +354,7 @@ int inetport(aClient *cptr, char *name, int port)
|
||||
{
|
||||
(void)ircsprintf(cptr->sockhost, "%-.42s.%.u",
|
||||
name, (unsigned int)port);
|
||||
(void)strcpy(cptr->name, me.name);
|
||||
(void)strlcpy(cptr->name, me.name, sizeof cptr->name);
|
||||
}
|
||||
/*
|
||||
* At first, open a new socket
|
||||
@@ -407,7 +407,7 @@ int inetport(aClient *cptr, char *name, int port)
|
||||
{
|
||||
ircsprintf(backupbuf, "Error binding stream socket to IP %s port %i",
|
||||
ipname, port);
|
||||
strcat(backupbuf, "- %s:%s");
|
||||
strlcat(backupbuf, "- %s:%s", sizeof backupbuf);
|
||||
report_error(backupbuf, cptr);
|
||||
CLOSE_SOCK(cptr->fd);
|
||||
cptr->fd = -1;
|
||||
@@ -647,7 +647,7 @@ void write_pidfile(void)
|
||||
* from either the server's sockhost (if client fd is a tty or localhost)
|
||||
* or from the ip# converted into a string. 0 = success, -1 = fail.
|
||||
*/
|
||||
static int check_init(aClient *cptr, char *sockn)
|
||||
static int check_init(aClient *cptr, char *sockn, size_t size)
|
||||
{
|
||||
struct SOCKADDR_IN sk;
|
||||
int len = sizeof(struct SOCKADDR_IN);
|
||||
@@ -668,7 +668,7 @@ static int check_init(aClient *cptr, char *sockn)
|
||||
report_error("connect failure: %s %s", cptr);
|
||||
return -1;
|
||||
}
|
||||
(void)strcpy(sockn, (char *)Inet_si2p(&sk));
|
||||
(void)strlcpy(sockn, (char *)Inet_si2p(&sk), size);
|
||||
|
||||
#ifdef INET6
|
||||
if (IN6_IS_ADDR_LOOPBACK(&sk.SIN_ADDR))
|
||||
@@ -703,7 +703,7 @@ int check_client(aClient *cptr)
|
||||
Debug((DEBUG_DNS, "ch_cl: check access for %s[%s]",
|
||||
cptr->name, inetntoa((char *)&cptr->ip)));
|
||||
|
||||
if (check_init(cptr, sockname))
|
||||
if (check_init(cptr, sockname, sizeof(sockname)))
|
||||
return -2;
|
||||
|
||||
hp = cptr->hostp;
|
||||
@@ -2295,7 +2295,7 @@ int connect_server(ConfigItem_link *aconf, aClient *by, struct hostent *hp)
|
||||
cptr->serv->conf = aconf;
|
||||
if (by && IsPerson(by))
|
||||
{
|
||||
(void)strcpy(cptr->serv->by, by->name);
|
||||
(void)strlcpy(cptr->serv->by, by->name, sizeof cptr->serv->by);
|
||||
if (cptr->serv->user)
|
||||
free_user(cptr->serv->user, NULL);
|
||||
cptr->serv->user = by->user;
|
||||
@@ -2303,7 +2303,7 @@ int connect_server(ConfigItem_link *aconf, aClient *by, struct hostent *hp)
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)strcpy(cptr->serv->by, "AutoConn.");
|
||||
(void)strlcpy(cptr->serv->by, "AutoConn.", sizeof cptr->serv->by);
|
||||
if (cptr->serv->user)
|
||||
free_user(cptr->serv->user, NULL);
|
||||
cptr->serv->user = NULL;
|
||||
|
||||
@@ -692,9 +692,9 @@ static ConfigFile *config_parse(char *filename, char *confdata)
|
||||
if (curce)
|
||||
config_error("%s: Unexpected EOF for variable starting at %i\n",
|
||||
filename, curce->ce_varlinenum);
|
||||
else if (cursection)
|
||||
else if (cursection)
|
||||
config_error("%s: Unexpected EOF for section starting at %i\n",
|
||||
filename, curce->ce_sectlinenum);
|
||||
filename, cursection->ce_sectlinenum);
|
||||
else
|
||||
config_error("%s: Unexpected EOF.\n", filename);
|
||||
config_entry_free(curce);
|
||||
@@ -3695,7 +3695,8 @@ int rehash(aClient *cptr, aClient *sptr, int sig)
|
||||
listen_cleanup();
|
||||
close_listeners();
|
||||
run_configuration();
|
||||
check_pings(TStime(), 1);
|
||||
loop.do_bancheck = 1;
|
||||
/* Check pings is done AFTERWARDS return anyhow, fuckheads. */
|
||||
sendto_realops("Completed rehash");
|
||||
return 0;
|
||||
}
|
||||
@@ -3857,7 +3858,7 @@ ConfigItem_ban *Find_ban(char *host, short type)
|
||||
if (ban->flag.type == type)
|
||||
if (!match(ban->mask, host)) {
|
||||
/* Person got a exception */
|
||||
if (Find_except(host, type))
|
||||
if (type == CONF_BAN_USER && Find_except(host, CONF_EXCEPT_BAN))
|
||||
return NULL;
|
||||
return ban;
|
||||
}
|
||||
@@ -3925,11 +3926,21 @@ int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost)
|
||||
sockhost, fullname));
|
||||
if (index(aconf->hostname, '@'))
|
||||
{
|
||||
/*
|
||||
* Doing strlcpy / strlcat here
|
||||
* would simply be a waste. We are
|
||||
* ALREADY sure that it is proper
|
||||
* lengths
|
||||
*/
|
||||
(void)strcpy(uhost, cptr->username);
|
||||
(void)strcat(uhost, "@");
|
||||
}
|
||||
else
|
||||
*uhost = '\0';
|
||||
/*
|
||||
* Same here as above
|
||||
* -Stskeeps
|
||||
*/
|
||||
(void)strncat(uhost, fullname,
|
||||
sizeof(uhost) - strlen(uhost));
|
||||
if (!match(aconf->hostname, uhost))
|
||||
|
||||
@@ -365,8 +365,8 @@ int m_vhost(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
me.name, sptr->name, user);
|
||||
return 0;
|
||||
}
|
||||
strcpy(host, make_user_host(sptr->user->username, sptr->user->realhost));
|
||||
strcpy(host2, make_user_host(sptr->user->username, (char *)Inet_ia2p(&sptr->ip)));
|
||||
strlcpy(host, make_user_host(sptr->user->username, sptr->user->realhost), sizeof host);
|
||||
strlcpy(host2, make_user_host(sptr->user->username, (char *)Inet_ia2p(&sptr->ip)), sizeof host2);
|
||||
for (from = (ConfigItem_oper_from *)vhost->from; from; from = (ConfigItem_oper_from *)from->next) {
|
||||
if (!match(from->name, host) || !match(from->name, host2))
|
||||
break;
|
||||
@@ -392,10 +392,10 @@ int m_vhost(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
len = strlen(vhost->virthost);
|
||||
length = len > HOSTLEN ? HOSTLEN : len;
|
||||
sptr->user->virthost = MyMalloc(length + 1);
|
||||
strncpy(sptr->user->virthost, vhost->virthost, length + 1);
|
||||
strlcpy(sptr->user->virthost, vhost->virthost, length + 1);
|
||||
if (vhost->virtuser) {
|
||||
strcpy(olduser, sptr->user->username);
|
||||
strncpy(sptr->user->username, vhost->virtuser, USERLEN);
|
||||
strlcpy(sptr->user->username, vhost->virtuser, USERLEN);
|
||||
}
|
||||
sptr->umodes |= UMODE_HIDE;
|
||||
sptr->umodes |= UMODE_SETHOST;
|
||||
@@ -441,10 +441,11 @@ void ircd_log(int flags, char *format, ...)
|
||||
char buf[2048], timebuf[128];
|
||||
int fd;
|
||||
struct stat fstats;
|
||||
|
||||
va_start(ap, format);
|
||||
ircvsprintf(buf, format, ap);
|
||||
strcat(buf, "\n");
|
||||
sprintf(timebuf, "[%s] - ", myctime(TStime()));
|
||||
strlcat(buf, "\n", sizeof buf);
|
||||
snprintf(timebuf, sizeof timebuf, "[%s] - ", myctime(TStime()));
|
||||
for (logs = conf_log; logs; logs = (ConfigItem_log *) logs->next) {
|
||||
#ifdef HAVE_SYSLOG
|
||||
if (!stricmp(logs->file, "syslog") && logs->flags & flags) {
|
||||
|
||||
@@ -46,7 +46,7 @@ aTKline *tklines = NULL;
|
||||
#define AllocCpy(x,y) x = (char *) MyMalloc(strlen(y) + 1); strcpy(x,y)
|
||||
#define GFreeStr(x) MyFree((char *) x)
|
||||
#define GFreeGline(x) MyFree((aGline *) x)
|
||||
extern char zlinebuf[];
|
||||
extern char zlinebuf[BUFSIZE];
|
||||
|
||||
/*
|
||||
|
||||
@@ -124,27 +124,27 @@ aTKline *tkl_expire(aTKline * tmp)
|
||||
{
|
||||
if (tmp->type & TKL_KILL)
|
||||
{
|
||||
strcpy(whattype, "G:Line");
|
||||
strlcpy(whattype, "G:Line", sizeof whattype);
|
||||
}
|
||||
else if (tmp->type & TKL_ZAP)
|
||||
{
|
||||
strcpy(whattype, "Global Z:Line");
|
||||
strlcpy(whattype, "Global Z:Line", sizeof whattype);
|
||||
}
|
||||
else if (tmp->type & TKL_SHUN)
|
||||
strcpy(whattype, "Shun");
|
||||
strlcpy(whattype, "Shun", sizeof whattype);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tmp->type & TKL_KILL)
|
||||
{
|
||||
strcpy(whattype, "Timed K:Line");
|
||||
strlcpy(whattype, "Timed K:Line", sizeof whattype);
|
||||
}
|
||||
else if (tmp->type & TKL_ZAP)
|
||||
{
|
||||
strcpy(whattype, "Timed Z:Line");
|
||||
strlcpy(whattype, "Timed Z:Line", sizeof whattype);
|
||||
}
|
||||
else if (tmp->type & TKL_SHUN)
|
||||
strcpy(whattype, "Local Shun");
|
||||
strlcpy(whattype, "Local Shun", sizeof whattype);
|
||||
}
|
||||
sendto_snomask(SNO_TKL,
|
||||
"*** Expiring %s (%s@%s) made by %s (Reason: %s) set %li seconds ago",
|
||||
@@ -227,8 +227,8 @@ EVENT(tkl_check_expire)
|
||||
|
||||
|
||||
/*
|
||||
returns -1 if no tkline found
|
||||
returns >= 0 if client exits
|
||||
returns <0 if client exists (banned)
|
||||
returns 1 if it is excepted
|
||||
*/
|
||||
|
||||
int find_tkline_match(aClient *cptr, int xx)
|
||||
@@ -265,14 +265,14 @@ int find_tkline_match(aClient *cptr, int xx)
|
||||
}
|
||||
|
||||
if (points != 1)
|
||||
return -1;
|
||||
return 1;
|
||||
strcpy(host, make_user_host(cname, chost));
|
||||
strcpy(host2, make_user_host(cname, cip));
|
||||
for (excepts = conf_except; excepts; excepts = (ConfigItem_except *)excepts->next) {
|
||||
if (excepts->flag.type != CONF_EXCEPT_TKL || excepts->type != lp->type)
|
||||
continue;
|
||||
if (!match(excepts->mask, host) || !match(excepts->mask, host2))
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((lp->type & TKL_KILL) && (xx != 2))
|
||||
@@ -317,14 +317,14 @@ int find_tkline_match(aClient *cptr, int xx)
|
||||
if (lp->type & (TKL_SHUN))
|
||||
{
|
||||
if (IsShunned(cptr))
|
||||
return -1;
|
||||
return 1;
|
||||
if (IsAdmin(cptr))
|
||||
return -1;
|
||||
return 1;
|
||||
SetShunned(cptr);
|
||||
return -1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return 3;
|
||||
}
|
||||
|
||||
int find_tkline_match_zap(aClient *cptr)
|
||||
@@ -363,7 +363,7 @@ int find_tkline_match_zap(aClient *cptr)
|
||||
inet_ntop(AF_INET6, (char *)&cptr->ip,
|
||||
mydummy, MYDUMMY_SIZE));
|
||||
#endif
|
||||
strcpy(zlinebuf, msge);
|
||||
strlcpy(zlinebuf, msge, sizeof zlinebuf);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
@@ -372,22 +372,6 @@ int find_tkline_match_zap(aClient *cptr)
|
||||
}
|
||||
|
||||
|
||||
int tkl_sweep(void)
|
||||
{
|
||||
/* just sweeps local for people that should be killed */
|
||||
aClient *acptr;
|
||||
long i;
|
||||
|
||||
tkl_check_expire(NULL);
|
||||
for (i = 0; i <= (MAXCONNECTIONS - 1); i++)
|
||||
{
|
||||
if ((acptr = local[i]))
|
||||
find_tkline_match(acptr, 0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void tkl_stats(aClient *cptr)
|
||||
{
|
||||
aTKline *tk;
|
||||
@@ -597,7 +581,8 @@ int m_tkl(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
(LOG_TKL, "Permanent %s added for %s@%s on %s GMT (from %s: %s)",
|
||||
txt, parv[3], parv[4], gmt, parv[5], parv[8]);
|
||||
}
|
||||
loop.do_tkl_sweep = 1;
|
||||
loop.do_bancheck = 1;
|
||||
/* Makes check_pings be run ^^ */
|
||||
if (type & TKL_GLOBAL)
|
||||
{
|
||||
sendto_serv_butone(cptr,
|
||||
|
||||
@@ -222,7 +222,7 @@ char *myctime(time_t value)
|
||||
static char buf[28];
|
||||
char *p;
|
||||
|
||||
(void)strcpy(buf, ctime(&value));
|
||||
(void)strlcpy(buf, ctime(&value), sizeof buf);
|
||||
if ((p = (char *)index(buf, '\n')) != NULL)
|
||||
*p = '\0';
|
||||
|
||||
@@ -431,7 +431,7 @@ int exit_client(aClient *cptr, aClient *sptr, aClient *from, char *comment)
|
||||
sendto_conn_hcn
|
||||
("*** Notice -- Client exiting: %s (%s@%s) [%s] [%s]",
|
||||
sptr->name, sptr->user->username,
|
||||
sptr->user->realhost, comment, sptr->sockhost);
|
||||
sptr->user->realhost, comment, inet_ntoa(sptr->ip));
|
||||
|
||||
/* Clean out list and watch structures -Donwulff */
|
||||
hash_del_watch_list(sptr);
|
||||
@@ -490,6 +490,11 @@ int exit_client(aClient *cptr, aClient *sptr, aClient *from, char *comment)
|
||||
*/
|
||||
if (cptr && !recurse)
|
||||
{
|
||||
/*
|
||||
* We are sure as we RELY on sptr->srvptr->name and
|
||||
* sptr->name to be less or equal to HOSTLEN
|
||||
* Waste of strlcpy/strlcat here
|
||||
*/
|
||||
(void)strcpy(comment1, sptr->srvptr->name);
|
||||
(void)strcat(comment1, " ");
|
||||
(void)strcat(comment1, sptr->name);
|
||||
|
||||
@@ -74,6 +74,9 @@ int do_numeric(int numeric, aClient *cptr, aClient *sptr, int parc, char *parv[
|
||||
buffer[0] = '\0';
|
||||
if (parc > 2)
|
||||
{
|
||||
/*
|
||||
* For strlcat nazis, please read above
|
||||
*/
|
||||
for (i = 2; i < (parc - 1); i++)
|
||||
{
|
||||
(void)strcat(buffer, " ");
|
||||
|
||||
@@ -1729,7 +1729,7 @@ CMD_FUNC(m_watch)
|
||||
continue;
|
||||
}
|
||||
*buf = '\0';
|
||||
strcpy(buf, lp->value.wptr->nick);
|
||||
strlcpy(buf, lp->value.wptr->nick, sizeof buf);
|
||||
count =
|
||||
strlen(parv[0]) + strlen(me.name) + 10 +
|
||||
strlen(buf);
|
||||
@@ -1851,6 +1851,11 @@ char *get_client_name2(aClient *acptr, int showports)
|
||||
return pointer;
|
||||
if (!strrchr(pointer, '.'))
|
||||
return NULL;
|
||||
/*
|
||||
* This may seem like wack but remind this is only used
|
||||
* in rows of get_client_name2's, so it's perfectly fair
|
||||
*
|
||||
*/
|
||||
strcpy((char *)strrchr((char *)pointer, '.'), ".0]");
|
||||
|
||||
return pointer;
|
||||
@@ -2243,7 +2248,7 @@ CMD_FUNC(m_stats)
|
||||
for (bans = conf_ban; bans; bans = (ConfigItem_ban *)bans->next) {
|
||||
if (bans->flag.type == CONF_BAN_NICK && (bans->flag.type2 == CONF_BAN_TYPE_AKILL))
|
||||
sendto_one(sptr, rpl_str(RPL_SQLINE_NICK),
|
||||
me.name, parv[0], bans->mask, bans->reason);
|
||||
me.name, parv[0], bans->mask, bans->reason ? bans->reason : "No Reason");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2443,9 +2448,9 @@ CMD_FUNC(m_stats)
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"S - Send the dynamic configuration list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"T - Send the tld block list");
|
||||
"t - Send the tld block list");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"t - Send connection information");
|
||||
"T - Send connection information");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
"u - Send server uptime and connection count");
|
||||
sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, parv[0],
|
||||
@@ -3733,7 +3738,7 @@ HUNTED_ISME)
|
||||
goto playmotd;
|
||||
}
|
||||
#endif
|
||||
strcpy(userhost,make_user_host(cptr->user->username, cptr->user->realhost));
|
||||
strlcpy(userhost,make_user_host(cptr->user->username, cptr->user->realhost), sizeof userhost);
|
||||
for (ptr = conf_tld; ptr; ptr = (ConfigItem_tld *) ptr->next)
|
||||
{
|
||||
if (!match(ptr->mask, userhost))
|
||||
@@ -4025,7 +4030,7 @@ CMD_FUNC(m_rules)
|
||||
goto playrules;
|
||||
}
|
||||
#endif
|
||||
strcpy(userhost,make_user_host(cptr->user->username, cptr->user->realhost));
|
||||
strlcpy(userhost,make_user_host(cptr->user->username, cptr->user->realhost), sizeof userhost);
|
||||
for (ptr = conf_tld; ptr; ptr = (ConfigItem_tld *) ptr->next)
|
||||
{
|
||||
if (!match(ptr->mask, userhost))
|
||||
|
||||
@@ -125,7 +125,7 @@ int advanced_check(char *userhost, int ipstat)
|
||||
char *ipseg[10 + 2];
|
||||
char safebuffer[512] = ""; /* buffer strtoken() can mess up to its heart's content...;> */
|
||||
|
||||
strcpy(safebuffer, userhost);
|
||||
strlcpy(safebuffer, userhost, sizeof safebuffer);
|
||||
|
||||
#define userhost safebuffer
|
||||
#define IP_WILDS_OK(x) ((x)<2? 0 : 1)
|
||||
@@ -272,7 +272,7 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
|
||||
char *current = malloc(strlen(parv[1])+1);
|
||||
char *xparv[3];
|
||||
bzero(current, strlen(parv[1])+1);
|
||||
bzero(output, 501);
|
||||
bzero(output, sizeof output);
|
||||
while(format->parameters[i] && j < 500) {
|
||||
k = 0;
|
||||
if (format->parameters[i] == '%') {
|
||||
@@ -295,7 +295,7 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
|
||||
continue;
|
||||
if (j + strlen(current)+1 >= 500)
|
||||
break;
|
||||
strcat(output, current);
|
||||
strlcat(output, current, sizeof output);
|
||||
j += strlen(current);
|
||||
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ int hunt_server_token(aClient *cptr, aClient *sptr, char *command, char *token,
|
||||
}
|
||||
if (acptr)
|
||||
{
|
||||
char buff[512];
|
||||
char buff[1024];
|
||||
if (IsMe(acptr) || MyClient(acptr))
|
||||
return HUNTED_ISME;
|
||||
if (match(acptr->name, parv[server]))
|
||||
@@ -887,7 +887,7 @@ extern int register_user(aClient *cptr, aClient *sptr, char *nick, char *usernam
|
||||
"Your GECOS (real name) is banned from this server");
|
||||
}
|
||||
tkl_check_expire(NULL);
|
||||
if ((xx = find_tkline_match(sptr, 0)) != -1)
|
||||
if ((xx = find_tkline_match(sptr, 0)) < 0)
|
||||
{
|
||||
ircstp->is_ref++;
|
||||
return xx;
|
||||
@@ -2398,6 +2398,11 @@ CMD_FUNC(m_umode)
|
||||
IRCstats.operators++;
|
||||
if ((setflags & UMODE_OPER) && !IsOper(sptr))
|
||||
IRCstats.operators--;
|
||||
/* FIXME: This breaks something */
|
||||
if (!(setflags & UMODE_HIDEOPER) && IsHideOper(sptr))
|
||||
IRCstats.operators--;
|
||||
if ((setflags & UMODE_HIDEOPER) && !IsHideOper(sptr))
|
||||
IRCstats.operators++;
|
||||
if (!(setflags & UMODE_INVISIBLE) && IsInvisible(sptr))
|
||||
IRCstats.invisible++;
|
||||
if ((setflags & UMODE_INVISIBLE) && !IsInvisible(sptr))
|
||||
|
||||
@@ -1659,12 +1659,12 @@ void sendto_connectnotice(char *nick, anUser *user, aClient *sptr)
|
||||
#endif
|
||||
ircsprintf(connecth,
|
||||
"*** Notice -- Client connecting: %s (%s@%s) [%s] {%s}", nick,
|
||||
user->username, user->realhost, sptr->sockhost,
|
||||
user->username, user->realhost, inet_ntoa(sptr->ip),
|
||||
sptr->class ? sptr->class->name : "0");
|
||||
|
||||
for (i = 0; i <= LastSlot; i++)
|
||||
if ((cptr = local[i]) && !IsServer(cptr) && !IsMe(cptr) &&
|
||||
IsOper(cptr) && (cptr->user->snomask & SNO_CLIENT))
|
||||
IsAnOper(cptr) && (cptr->user->snomask & SNO_CLIENT))
|
||||
{
|
||||
if (IsHybNotice(cptr))
|
||||
sendto_one(cptr, ":%s NOTICE %s :%s", me.name,
|
||||
|
||||
@@ -437,6 +437,771 @@ void iCstrip(char *line)
|
||||
*c = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* from ircd-hybrid-7beta14
|
||||
* (C) respective coders
|
||||
*/
|
||||
/**************************************************************
|
||||
* Original header, taken from mutt...:
|
||||
* Patrick Powell Tue Apr 11 09:48:21 PDT 1995
|
||||
* A bombproof version of doprnt (dopr) included.
|
||||
* Sigh. This sort of thing is always nasty do deal with. Note that
|
||||
* the version here does not include floating point...
|
||||
*
|
||||
* snprintf() is used instead of sprintf() as it does limit checks
|
||||
* for string length. This covers a nasty loophole.
|
||||
*
|
||||
* The other functions are there to prevent NULL pointers from
|
||||
* causing nast effects.
|
||||
*
|
||||
* More Recently:
|
||||
* Brandon Long <blong@fiction.net> 9/15/96 for mutt 0.43
|
||||
* This was ugly. It is still ugly. I opted out of floating point
|
||||
* numbers, but the formatter understands just about everything
|
||||
* from the normal C string format, at least as far as I can tell from
|
||||
* the Solaris 2.5 printf(3S) man page.
|
||||
*
|
||||
* Brandon Long <blong@fiction.net> 10/22/97 for mutt 0.87.1
|
||||
* Ok, added some minimal floating point support, which means this
|
||||
* probably requires libm on most operating systems. Don't yet
|
||||
* support the exponent (e,E) and sigfig (g,G). Also, fmtint()
|
||||
* was pretty badly broken, it just wasn't being exercised in ways
|
||||
* which showed it, so that's been fixed. Also, formated the code
|
||||
* to mutt conventions, and removed dead code left over from the
|
||||
* original. Also, there is now a builtin-test, just compile with:
|
||||
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
|
||||
* and run snprintf for results.
|
||||
*
|
||||
* Thomas Roessler <roessler@guug.de> 01/27/98 for mutt 0.89i
|
||||
* The PGP code was using unsigned hexadecimal formats.
|
||||
* Unfortunately, unsigned formats simply didn't work.
|
||||
*
|
||||
* Michael Elkins <me@cs.hmc.edu> 03/05/98 for mutt 0.90.8
|
||||
* The original code assumed that both snprintf() and vsnprintf() were
|
||||
* missing. Some systems only have snprintf() but not vsnprintf(), so
|
||||
* the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF.
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
|
||||
|
||||
/* varargs declarations: */
|
||||
|
||||
# define HAVE_STDARGS /* let's hope that works everywhere (mj) */
|
||||
# define VA_LOCAL_DECL va_list ap
|
||||
# define VA_START(f) va_start(ap, f)
|
||||
# define VA_SHIFT(v,t) ; /* no-op for ANSI */
|
||||
# define VA_END va_end(ap)
|
||||
|
||||
|
||||
static void dopr (char *buffer, size_t maxlen, const char *format,
|
||||
va_list args);
|
||||
static void fmtstr (char *buffer, size_t *currlen, size_t maxlen,
|
||||
char *value, int flags, int min, int max);
|
||||
static void fmtint (char *buffer, size_t *currlen, size_t maxlen,
|
||||
long value, int base, int min, int max, int flags);
|
||||
static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
||||
long double fvalue, int min, int max, int flags);
|
||||
static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c );
|
||||
|
||||
/*
|
||||
* dopr(): poor man's version of doprintf
|
||||
*/
|
||||
|
||||
/* format read states */
|
||||
#define DP_S_DEFAULT 0
|
||||
#define DP_S_FLAGS 1
|
||||
#define DP_S_MIN 2
|
||||
#define DP_S_DOT 3
|
||||
#define DP_S_MAX 4
|
||||
#define DP_S_MOD 5
|
||||
#define DP_S_CONV 6
|
||||
#define DP_S_DONE 7
|
||||
|
||||
/* format flags - Bits */
|
||||
#define DP_F_MINUS (1 << 0)
|
||||
#define DP_F_PLUS (1 << 1)
|
||||
#define DP_F_SPACE (1 << 2)
|
||||
#define DP_F_NUM (1 << 3)
|
||||
#define DP_F_ZERO (1 << 4)
|
||||
#define DP_F_UP (1 << 5)
|
||||
#define DP_F_UNSIGNED (1 << 6)
|
||||
|
||||
/* Conversion Flags */
|
||||
#define DP_C_SHORT 1
|
||||
#define DP_C_LONG 2
|
||||
#define DP_C_LDOUBLE 3
|
||||
|
||||
#define char_to_int(p) (p - '0')
|
||||
#undef MAX
|
||||
#define MAX(p,q) ((p >= q) ? p : q)
|
||||
|
||||
static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
|
||||
{
|
||||
char ch;
|
||||
long value;
|
||||
long double fvalue;
|
||||
char *strvalue;
|
||||
int min;
|
||||
int max;
|
||||
int state;
|
||||
int flags;
|
||||
int cflags;
|
||||
size_t currlen;
|
||||
|
||||
state = DP_S_DEFAULT;
|
||||
currlen = flags = cflags = min = 0;
|
||||
max = -1;
|
||||
ch = *format++;
|
||||
|
||||
while (state != DP_S_DONE)
|
||||
{
|
||||
if ((ch == '\0') || (currlen >= maxlen))
|
||||
state = DP_S_DONE;
|
||||
|
||||
switch(state)
|
||||
{
|
||||
case DP_S_DEFAULT:
|
||||
if (ch == '%')
|
||||
state = DP_S_FLAGS;
|
||||
else
|
||||
dopr_outch (buffer, &currlen, maxlen, ch);
|
||||
ch = *format++;
|
||||
break;
|
||||
case DP_S_FLAGS:
|
||||
switch (ch)
|
||||
{
|
||||
case '-':
|
||||
flags |= DP_F_MINUS;
|
||||
ch = *format++;
|
||||
break;
|
||||
case '+':
|
||||
flags |= DP_F_PLUS;
|
||||
ch = *format++;
|
||||
break;
|
||||
case ' ':
|
||||
flags |= DP_F_SPACE;
|
||||
ch = *format++;
|
||||
break;
|
||||
case '#':
|
||||
flags |= DP_F_NUM;
|
||||
ch = *format++;
|
||||
break;
|
||||
case '0':
|
||||
flags |= DP_F_ZERO;
|
||||
ch = *format++;
|
||||
break;
|
||||
default:
|
||||
state = DP_S_MIN;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DP_S_MIN:
|
||||
if (isdigit((unsigned char)ch))
|
||||
{
|
||||
min = 10*min + char_to_int (ch);
|
||||
ch = *format++;
|
||||
}
|
||||
else if (ch == '*')
|
||||
{
|
||||
min = va_arg (args, int);
|
||||
ch = *format++;
|
||||
state = DP_S_DOT;
|
||||
}
|
||||
else
|
||||
state = DP_S_DOT;
|
||||
break;
|
||||
case DP_S_DOT:
|
||||
if (ch == '.')
|
||||
{
|
||||
state = DP_S_MAX;
|
||||
ch = *format++;
|
||||
}
|
||||
else
|
||||
state = DP_S_MOD;
|
||||
break;
|
||||
case DP_S_MAX:
|
||||
if (isdigit((unsigned char)ch))
|
||||
{
|
||||
if (max < 0)
|
||||
max = 0;
|
||||
max = 10*max + char_to_int (ch);
|
||||
ch = *format++;
|
||||
}
|
||||
else if (ch == '*')
|
||||
{
|
||||
max = va_arg (args, int);
|
||||
ch = *format++;
|
||||
state = DP_S_MOD;
|
||||
}
|
||||
else
|
||||
state = DP_S_MOD;
|
||||
break;
|
||||
case DP_S_MOD:
|
||||
/* Currently, we don't support Long Long, bummer */
|
||||
switch (ch)
|
||||
{
|
||||
case 'h':
|
||||
cflags = DP_C_SHORT;
|
||||
ch = *format++;
|
||||
break;
|
||||
case 'l':
|
||||
cflags = DP_C_LONG;
|
||||
ch = *format++;
|
||||
break;
|
||||
case 'L':
|
||||
cflags = DP_C_LDOUBLE;
|
||||
ch = *format++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
state = DP_S_CONV;
|
||||
break;
|
||||
case DP_S_CONV:
|
||||
switch (ch)
|
||||
{
|
||||
case 'd':
|
||||
case 'i':
|
||||
if (cflags == DP_C_SHORT)
|
||||
value = va_arg (args, int);
|
||||
else if (cflags == DP_C_LONG)
|
||||
value = va_arg (args, long int);
|
||||
else
|
||||
value = va_arg (args, int);
|
||||
fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
|
||||
break;
|
||||
case 'o':
|
||||
flags |= DP_F_UNSIGNED;
|
||||
if (cflags == DP_C_SHORT)
|
||||
value = va_arg (args, int);
|
||||
else if (cflags == DP_C_LONG)
|
||||
value = va_arg (args, unsigned long int);
|
||||
else
|
||||
value = va_arg (args, unsigned int);
|
||||
fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags);
|
||||
break;
|
||||
case 'u':
|
||||
flags |= DP_F_UNSIGNED;
|
||||
if (cflags == DP_C_SHORT)
|
||||
value = va_arg (args, int);
|
||||
else if (cflags == DP_C_LONG)
|
||||
value = va_arg (args, unsigned long int);
|
||||
else
|
||||
value = va_arg (args, unsigned int);
|
||||
fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
|
||||
break;
|
||||
case 'X':
|
||||
flags |= DP_F_UP;
|
||||
case 'x':
|
||||
flags |= DP_F_UNSIGNED;
|
||||
if (cflags == DP_C_SHORT)
|
||||
value = va_arg (args, int);
|
||||
else if (cflags == DP_C_LONG)
|
||||
value = va_arg (args, unsigned long int);
|
||||
else
|
||||
value = va_arg (args, unsigned int);
|
||||
fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags);
|
||||
break;
|
||||
case 'f':
|
||||
if (cflags == DP_C_LDOUBLE)
|
||||
fvalue = va_arg (args, long double);
|
||||
else
|
||||
fvalue = va_arg (args, double);
|
||||
/* um, floating point? */
|
||||
fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags);
|
||||
break;
|
||||
case 'E':
|
||||
flags |= DP_F_UP;
|
||||
case 'e':
|
||||
if (cflags == DP_C_LDOUBLE)
|
||||
fvalue = va_arg (args, long double);
|
||||
else
|
||||
fvalue = va_arg (args, double);
|
||||
break;
|
||||
case 'G':
|
||||
flags |= DP_F_UP;
|
||||
case 'g':
|
||||
if (cflags == DP_C_LDOUBLE)
|
||||
fvalue = va_arg (args, long double);
|
||||
else
|
||||
fvalue = va_arg (args, double);
|
||||
break;
|
||||
case 'c':
|
||||
dopr_outch (buffer, &currlen, maxlen, va_arg (args, int));
|
||||
break;
|
||||
case 's':
|
||||
strvalue = va_arg (args, char *);
|
||||
if (max < 0)
|
||||
max = maxlen; /* ie, no max */
|
||||
fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max);
|
||||
break;
|
||||
case 'p':
|
||||
strvalue = va_arg (args, void *);
|
||||
fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags);
|
||||
break;
|
||||
case 'n':
|
||||
if (cflags == DP_C_SHORT)
|
||||
{
|
||||
short int *num;
|
||||
num = va_arg (args, short int *);
|
||||
*num = currlen;
|
||||
}
|
||||
else if (cflags == DP_C_LONG)
|
||||
{
|
||||
long int *num;
|
||||
num = va_arg (args, long int *);
|
||||
*num = currlen;
|
||||
}
|
||||
else
|
||||
{
|
||||
int *num;
|
||||
num = va_arg (args, int *);
|
||||
*num = currlen;
|
||||
}
|
||||
break;
|
||||
case '%':
|
||||
dopr_outch (buffer, &currlen, maxlen, ch);
|
||||
break;
|
||||
case 'w':
|
||||
/* not supported yet, treat as next char */
|
||||
ch = *format++;
|
||||
break;
|
||||
default:
|
||||
/* Unknown, skip */
|
||||
break;
|
||||
}
|
||||
ch = *format++;
|
||||
state = DP_S_DEFAULT;
|
||||
flags = cflags = min = 0;
|
||||
max = -1;
|
||||
break;
|
||||
case DP_S_DONE:
|
||||
break;
|
||||
default:
|
||||
/* hmm? */
|
||||
break; /* some picky compilers need this */
|
||||
}
|
||||
}
|
||||
if (currlen < maxlen - 1)
|
||||
buffer[currlen] = '\0';
|
||||
else
|
||||
buffer[maxlen - 1] = '\0';
|
||||
}
|
||||
|
||||
static void fmtstr (char *buffer, size_t *currlen, size_t maxlen,
|
||||
char *value, int flags, int min, int max)
|
||||
{
|
||||
int padlen, strln; /* amount to pad */
|
||||
int cnt = 0;
|
||||
|
||||
if (value == 0)
|
||||
{
|
||||
value = "<NULL>";
|
||||
}
|
||||
|
||||
for (strln = 0; value[strln]; ++strln); /* strlen */
|
||||
padlen = min - strln;
|
||||
if (padlen < 0)
|
||||
padlen = 0;
|
||||
if (flags & DP_F_MINUS)
|
||||
padlen = -padlen; /* Left Justify */
|
||||
|
||||
while ((padlen > 0) && (cnt < max))
|
||||
{
|
||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||
--padlen;
|
||||
++cnt;
|
||||
}
|
||||
while (*value && (cnt < max))
|
||||
{
|
||||
dopr_outch (buffer, currlen, maxlen, *value++);
|
||||
++cnt;
|
||||
}
|
||||
while ((padlen < 0) && (cnt < max))
|
||||
{
|
||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||
++padlen;
|
||||
++cnt;
|
||||
}
|
||||
}
|
||||
|
||||
/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
|
||||
|
||||
static void fmtint (char *buffer, size_t *currlen, size_t maxlen,
|
||||
long value, int base, int min, int max, int flags)
|
||||
{
|
||||
int signvalue = 0;
|
||||
unsigned long uvalue;
|
||||
char convert[20];
|
||||
int place = 0;
|
||||
int spadlen = 0; /* amount to space pad */
|
||||
int zpadlen = 0; /* amount to zero pad */
|
||||
int caps = 0;
|
||||
|
||||
if (max < 0)
|
||||
max = 0;
|
||||
|
||||
uvalue = value;
|
||||
|
||||
if(!(flags & DP_F_UNSIGNED))
|
||||
{
|
||||
if( value < 0 ) {
|
||||
signvalue = '-';
|
||||
uvalue = -value;
|
||||
}
|
||||
else
|
||||
if (flags & DP_F_PLUS) /* Do a sign (+/i) */
|
||||
signvalue = '+';
|
||||
else
|
||||
if (flags & DP_F_SPACE)
|
||||
signvalue = ' ';
|
||||
}
|
||||
|
||||
if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
|
||||
|
||||
do {
|
||||
convert[place++] =
|
||||
(caps? "0123456789ABCDEF":"0123456789abcdef")
|
||||
[uvalue % (unsigned)base ];
|
||||
uvalue = (uvalue / (unsigned)base );
|
||||
} while(uvalue && (place < 20));
|
||||
if (place == 20) place--;
|
||||
convert[place] = 0;
|
||||
|
||||
zpadlen = max - place;
|
||||
spadlen = min - MAX (max, place) - (signvalue ? 1 : 0);
|
||||
if (zpadlen < 0) zpadlen = 0;
|
||||
if (spadlen < 0) spadlen = 0;
|
||||
if (flags & DP_F_ZERO)
|
||||
{
|
||||
zpadlen = MAX(zpadlen, spadlen);
|
||||
spadlen = 0;
|
||||
}
|
||||
if (flags & DP_F_MINUS)
|
||||
spadlen = -spadlen; /* Left Justifty */
|
||||
|
||||
#ifdef DEBUG_SNPRINTF
|
||||
dprint (1, (debugfile, "zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
|
||||
zpadlen, spadlen, min, max, place));
|
||||
#endif
|
||||
|
||||
/* Spaces */
|
||||
while (spadlen > 0)
|
||||
{
|
||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||
--spadlen;
|
||||
}
|
||||
|
||||
/* Sign */
|
||||
if (signvalue)
|
||||
dopr_outch (buffer, currlen, maxlen, signvalue);
|
||||
|
||||
/* Zeros */
|
||||
if (zpadlen > 0)
|
||||
{
|
||||
while (zpadlen > 0)
|
||||
{
|
||||
dopr_outch (buffer, currlen, maxlen, '0');
|
||||
--zpadlen;
|
||||
}
|
||||
}
|
||||
|
||||
/* Digits */
|
||||
while (place > 0)
|
||||
dopr_outch (buffer, currlen, maxlen, convert[--place]);
|
||||
|
||||
/* Left Justified spaces */
|
||||
while (spadlen < 0) {
|
||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||
++spadlen;
|
||||
}
|
||||
}
|
||||
|
||||
static long double abs_val (long double value)
|
||||
{
|
||||
long double result = value;
|
||||
|
||||
if (value < 0)
|
||||
result = -value;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static long double pow10 (int exp)
|
||||
{
|
||||
long double result = 1;
|
||||
|
||||
while (exp)
|
||||
{
|
||||
result *= 10;
|
||||
exp--;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static long round (long double value)
|
||||
{
|
||||
long intpart;
|
||||
|
||||
intpart = value;
|
||||
value = value - intpart;
|
||||
if (value >= 0.5)
|
||||
intpart++;
|
||||
|
||||
return intpart;
|
||||
}
|
||||
|
||||
static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
||||
long double fvalue, int min, int max, int flags)
|
||||
{
|
||||
int signvalue = 0;
|
||||
long double ufvalue;
|
||||
char iconvert[20];
|
||||
char fconvert[20];
|
||||
int iplace = 0;
|
||||
int fplace = 0;
|
||||
int padlen = 0; /* amount to pad */
|
||||
int zpadlen = 0;
|
||||
int caps = 0;
|
||||
long intpart;
|
||||
long fracpart;
|
||||
|
||||
/*
|
||||
* AIX manpage says the default is 0, but Solaris says the default
|
||||
* is 6, and sprintf on AIX defaults to 6
|
||||
*/
|
||||
if (max < 0)
|
||||
max = 6;
|
||||
|
||||
ufvalue = abs_val (fvalue);
|
||||
|
||||
if (fvalue < 0)
|
||||
signvalue = '-';
|
||||
else
|
||||
if (flags & DP_F_PLUS) /* Do a sign (+/i) */
|
||||
signvalue = '+';
|
||||
else
|
||||
if (flags & DP_F_SPACE)
|
||||
signvalue = ' ';
|
||||
|
||||
intpart = ufvalue;
|
||||
|
||||
/*
|
||||
* Sorry, we only support 9 digits past the decimal because of our
|
||||
* conversion method
|
||||
*/
|
||||
if (max > 9)
|
||||
max = 9;
|
||||
|
||||
/* We "cheat" by converting the fractional part to integer by
|
||||
* multiplying by a factor of 10
|
||||
*/
|
||||
fracpart = round ((pow10 (max)) * (ufvalue - intpart));
|
||||
|
||||
if (fracpart >= pow10 (max))
|
||||
{
|
||||
intpart++;
|
||||
fracpart -= pow10 (max);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_SNPRINTF
|
||||
dprint (1, (debugfile, "fmtfp: %f =? %d.%d\n", fvalue, intpart, fracpart));
|
||||
#endif
|
||||
|
||||
/* Convert integer part */
|
||||
do {
|
||||
iconvert[iplace++] =
|
||||
(caps? "0123456789ABCDEF":"0123456789abcdef")[intpart % 10];
|
||||
intpart = (intpart / 10);
|
||||
} while(intpart && (iplace < 20));
|
||||
if (iplace == 20) iplace--;
|
||||
iconvert[iplace] = 0;
|
||||
|
||||
/* Convert fractional part */
|
||||
do {
|
||||
fconvert[fplace++] =
|
||||
(caps? "0123456789ABCDEF":"0123456789abcdef")[fracpart % 10];
|
||||
fracpart = (fracpart / 10);
|
||||
} while(fracpart && (fplace < 20));
|
||||
if (fplace == 20) fplace--;
|
||||
fconvert[fplace] = 0;
|
||||
|
||||
/* -1 for decimal point, another -1 if we are printing a sign */
|
||||
padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
|
||||
zpadlen = max - fplace;
|
||||
if (zpadlen < 0)
|
||||
zpadlen = 0;
|
||||
if (padlen < 0)
|
||||
padlen = 0;
|
||||
if (flags & DP_F_MINUS)
|
||||
padlen = -padlen; /* Left Justifty */
|
||||
|
||||
if ((flags & DP_F_ZERO) && (padlen > 0))
|
||||
{
|
||||
if (signvalue)
|
||||
{
|
||||
dopr_outch (buffer, currlen, maxlen, signvalue);
|
||||
--padlen;
|
||||
signvalue = 0;
|
||||
}
|
||||
while (padlen > 0)
|
||||
{
|
||||
dopr_outch (buffer, currlen, maxlen, '0');
|
||||
--padlen;
|
||||
}
|
||||
}
|
||||
while (padlen > 0)
|
||||
{
|
||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||
--padlen;
|
||||
}
|
||||
if (signvalue)
|
||||
dopr_outch (buffer, currlen, maxlen, signvalue);
|
||||
|
||||
while (iplace > 0)
|
||||
dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]);
|
||||
|
||||
/*
|
||||
* Decimal point. This should probably use locale to find the correct
|
||||
* char to print out.
|
||||
*/
|
||||
dopr_outch (buffer, currlen, maxlen, '.');
|
||||
|
||||
while (fplace > 0)
|
||||
dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
|
||||
|
||||
while (zpadlen > 0)
|
||||
{
|
||||
dopr_outch (buffer, currlen, maxlen, '0');
|
||||
--zpadlen;
|
||||
}
|
||||
|
||||
while (padlen < 0)
|
||||
{
|
||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||
++padlen;
|
||||
}
|
||||
}
|
||||
|
||||
static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c)
|
||||
{
|
||||
if (*currlen < maxlen)
|
||||
buffer[(*currlen)++] = c;
|
||||
}
|
||||
#endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */
|
||||
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
|
||||
{
|
||||
str[0] = 0;
|
||||
dopr(str, count, fmt, args);
|
||||
return(strlen(str));
|
||||
}
|
||||
#endif /* !HAVE_VSNPRINTF */
|
||||
|
||||
#ifndef HAVE_SNPRINTF
|
||||
/* VARARGS3 */
|
||||
#ifdef HAVE_STDARGS
|
||||
int snprintf (char *str,size_t count,const char *fmt,...)
|
||||
#else
|
||||
int snprintf (va_alist) va_dcl
|
||||
#endif
|
||||
{
|
||||
#ifndef HAVE_STDARGS
|
||||
char *str;
|
||||
size_t count;
|
||||
char *fmt;
|
||||
#endif
|
||||
VA_LOCAL_DECL;
|
||||
|
||||
VA_START (fmt);
|
||||
VA_SHIFT (str, char *);
|
||||
VA_SHIFT (count, size_t );
|
||||
VA_SHIFT (fmt, char *);
|
||||
(void) vsnprintf(str, count, fmt, ap);
|
||||
VA_END;
|
||||
return(strlen(str));
|
||||
}
|
||||
|
||||
#ifdef TEST_SNPRINTF
|
||||
#ifndef LONG_STRING
|
||||
#define LONG_STRING 1024
|
||||
#endif
|
||||
int main (void)
|
||||
{
|
||||
char buf1[LONG_STRING];
|
||||
char buf2[LONG_STRING];
|
||||
char *fp_fmt[] = {
|
||||
"%-1.5f",
|
||||
"%1.5f",
|
||||
"%123.9f",
|
||||
"%10.5f",
|
||||
"% 10.5f",
|
||||
"%+22.9f",
|
||||
"%+4.9f",
|
||||
"%01.3f",
|
||||
"%4f",
|
||||
"%3.1f",
|
||||
"%3.2f",
|
||||
NULL
|
||||
};
|
||||
double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996,
|
||||
0.9996, 1.996, 4.136, 0};
|
||||
char *int_fmt[] = {
|
||||
"%-1.5d",
|
||||
"%1.5d",
|
||||
"%123.9d",
|
||||
"%5.5d",
|
||||
"%10.5d",
|
||||
"% 10.5d",
|
||||
"%+22.33d",
|
||||
"%01.3d",
|
||||
"%4d",
|
||||
NULL
|
||||
};
|
||||
long int_nums[] = { -1, 134, 91340, 341, 0203, 0};
|
||||
int x, y;
|
||||
int fail = 0;
|
||||
int num = 0;
|
||||
|
||||
printf ("Testing snprintf format codes against system sprintf...\n");
|
||||
|
||||
for (x = 0; fp_fmt[x] != NULL ; x++)
|
||||
for (y = 0; fp_nums[y] != 0 ; y++)
|
||||
{
|
||||
snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]);
|
||||
sprintf (buf2, fp_fmt[x], fp_nums[y]);
|
||||
if (strcmp (buf1, buf2))
|
||||
{
|
||||
printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", /* __SPRINTF_CHECKED__ */
|
||||
fp_fmt[x], buf1, buf2);
|
||||
fail++;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
|
||||
for (x = 0; int_fmt[x] != NULL ; x++)
|
||||
for (y = 0; int_nums[y] != 0 ; y++)
|
||||
{
|
||||
snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]);
|
||||
sprintf (buf2, int_fmt[x], int_nums[y]);
|
||||
if (strcmp (buf1, buf2))
|
||||
{
|
||||
printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", /* __SPRINTF_CHECKED__ */
|
||||
int_fmt[x], buf1, buf2);
|
||||
fail++;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
printf ("%d tests failed out of %d.\n", fail, num);
|
||||
}
|
||||
#endif /* SNPRINTF_TEST */
|
||||
|
||||
#endif /* !HAVE_SNPRINTF */
|
||||
|
||||
|
||||
/*
|
||||
* Copyright 1996, 1997, 1998, 1999, 2000 Michiel Boland.
|
||||
* Under the BSD license (without advertising clause)
|
||||
@@ -585,6 +1350,82 @@ time_t rfc2time(char *s)
|
||||
day + daytab[year % 4 == 0][mon] + 365L * (year - 1970L) + ((year - 1969L) >> 2))));
|
||||
}
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
/*
|
||||
* bsd'sh strlcpy().
|
||||
* The strlcpy() function copies up to size-1 characters from the
|
||||
* NUL-terminated string src to dst, NUL-terminating the result.
|
||||
* Return: total length of the string tried to create.
|
||||
*/
|
||||
size_t
|
||||
strlcpy(char *dst, const char *src, size_t size)
|
||||
{
|
||||
size_t len = strlen(src);
|
||||
size_t ret = len;
|
||||
|
||||
if (size <= 0)
|
||||
return 0;
|
||||
if (len >= size)
|
||||
len = size - 1;
|
||||
memcpy(dst, src, len);
|
||||
dst[len] = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCAT
|
||||
/*
|
||||
* bsd'sh strlcat().
|
||||
* The strlcat() function appends the NUL-terminated string src to the end of
|
||||
* dst. It will append at most size - strlen(dst) - 1 bytes, NUL-terminating
|
||||
* the result.
|
||||
*/
|
||||
size_t
|
||||
strlcat(char *dst, const char *src, size_t size)
|
||||
{
|
||||
size_t len1 = strlen(dst);
|
||||
size_t len2 = strlen(src);
|
||||
size_t ret = len1 + len2;
|
||||
|
||||
if (len1 + len2 >= size)
|
||||
len2 = size - (len1 + 1);
|
||||
|
||||
if (len2 > 0) {
|
||||
memcpy(dst + len1, src, len2);
|
||||
dst[len1 + len2] = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLNCAT
|
||||
/*
|
||||
* see strlcat(), but never cat more then n characters.
|
||||
*/
|
||||
size_t
|
||||
strlncat(char *dst, const char *src, size_t size, size_t n)
|
||||
{
|
||||
size_t len1 = strlen(dst);
|
||||
size_t len2 = strlen(src);
|
||||
size_t ret = len1 + len2;
|
||||
|
||||
if (len2 > n)
|
||||
len2 = n;
|
||||
|
||||
if (len1 + len2 >= size)
|
||||
len2 = size - (len1 + 1);
|
||||
|
||||
if (len2 > 0) {
|
||||
memcpy(dst + len1, src, len2);
|
||||
dst[len1 + len2] = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const char Base64[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
static const char Pad64 = '=';
|
||||
|
||||
@@ -91,12 +91,10 @@ char *unrealcredits[] =
|
||||
"{X} (Laurie) x@tspre.org",
|
||||
"- Making the main code/design of UnrealIRCd/32 gui",
|
||||
" bugfounds, etc",
|
||||
"www.secure-tech.net",
|
||||
"Phil Veale - email@philipveale.com - www.flame.tiefighter.org",
|
||||
"- Donating webhosting",
|
||||
"TheDarkOne & x-irc.net",
|
||||
"- Donating DNS and development shells",
|
||||
"irc4ever.net",
|
||||
"- Donating backup DNS",
|
||||
"- Development shells",
|
||||
"RaYmAn (Jens Andersen)",
|
||||
"- Supporting with hardware, software, movies, etc, and for",
|
||||
" a great friendship, and spending a lot of time with sts",
|
||||
@@ -121,8 +119,12 @@ char *unrealcredits[] =
|
||||
" - donation to the UnrealIRCd development",
|
||||
"Jan Knutar (JK@IRC)",
|
||||
" - RAM donation, Shell donations :D, and a hell lot of other stuff",
|
||||
"ThePlayer",
|
||||
" - Donation to re-buy tspre.org",
|
||||
"Thanks to Headbang and WonderWal too for hardware+software",
|
||||
"donations",
|
||||
"powerstorm.net",
|
||||
" - Donating an alpha shell",
|
||||
" (yes your name can be here too;)",
|
||||
"",
|
||||
" \37These people have helped alpha/betatesting/fixing bugs\37",
|
||||
@@ -139,6 +141,7 @@ char *unrealcredits[] =
|
||||
"nemesis - nemesis@unrealircd.info",
|
||||
"Ron885 - Ron885@unrealircd.info",
|
||||
"iDW-badSol - iDW-badSol@unrealircd.info",
|
||||
"SciFi - SciFi@unrealircd.info",
|
||||
"",
|
||||
"Thanks to former supporters, and anyone who has helped without",
|
||||
"officially joining the staff",
|
||||
|
||||
@@ -175,23 +175,19 @@ LRESULT RESubClassFunc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam) {
|
||||
* (c) 2001 codemastr
|
||||
*/
|
||||
typedef struct colorlist {
|
||||
struct colorlist *prev,*next;
|
||||
char *color;
|
||||
struct colorlist *next, *prev;
|
||||
} ColorList;
|
||||
|
||||
ColorList *TextColors = NULL;
|
||||
void AddColor(char *color) {
|
||||
ColorList *clist;
|
||||
|
||||
clist = MyMalloc(sizeof(ColorList));
|
||||
clist = MyMallocEx(sizeof(ColorList));
|
||||
if (!clist)
|
||||
return;
|
||||
clist->color = strdup(color);
|
||||
clist->prev = NULL;
|
||||
clist->next = TextColors;
|
||||
if (TextColors)
|
||||
TextColors->prev = clist;
|
||||
TextColors = clist;
|
||||
AddListItem(clist,TextColors);
|
||||
}
|
||||
|
||||
ColorList *DelNewestColor() {
|
||||
@@ -207,14 +203,13 @@ ColorList *DelNewestColor() {
|
||||
}
|
||||
|
||||
void WipeColors() {
|
||||
ColorList *clist, q;
|
||||
ColorList *clist, *next;
|
||||
|
||||
for (clist = TextColors; clist; clist = clist->next)
|
||||
for (clist = TextColors; clist; clist = next)
|
||||
{
|
||||
q.next = clist->next;
|
||||
next = clist->next;
|
||||
MyFree(clist->color);
|
||||
MyFree(clist);
|
||||
clist = &q;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -267,6 +262,7 @@ DWORD CALLBACK RTFToIRC(int fd, char *pbBuff, long cb) {
|
||||
char cmd[15], value[500], color[25], colorbuf[4];
|
||||
char colors[16];
|
||||
pbBuff++;
|
||||
TextColors = NULL;
|
||||
bzero(buffer, cb);
|
||||
for (; *pbBuff; pbBuff++) {
|
||||
if (*pbBuff == '\r' || *pbBuff == '\n')
|
||||
|
||||