Commit Graph

123 Commits

Author SHA1 Message Date
Kevin Easton
aab85f807a Update version number to 1.2.1 in preparation for release.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@537 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-14 10:42:09 +00:00
Kevin Easton
137fbd9b85 Prefer <fcntl.h> over <sys/fcntl.h>.
<fcntl.h> is the name used by POSIX, so we prefer this and only fall back to
<sys/fcntl.h> on non-POSIX systems.  Fixes warnings compiling against musl
libc.

Reported by ncopa.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@531 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-06 10:44:07 +00:00
Kevin Easton
93d06b03c9 Fix overflow in say() when handling a client message over the maximum.
This was noticed when /channel on a very large channel segfaulted.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@528 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-05 09:32:46 +00:00
Kevin Easton
0b6725dbe2 Remove WANT_CHAN_NICK_SERV define and include services commands by default.
They're pretty widely used these days, and the cost is trivial.  And quite frankly,
the less #ifdefs I have to see, the better.

This covers /NICKSERV, /CHANSERV, /OPERSERV and /MEMOSERV.  It also brings 
in the bahamut / unreal /SILENCE server-side-ignore command, and unreal's /HELPOP.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@524 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-04 10:27:19 +00:00
Kevin Easton
a05b1160c3 Change build to pass through CPPFLAGS if provided, and to use the DEFS value set by configure.
The DEFS Makefile variable has been renamed to CPPFLAGS, and is now set based on the CPPFLAGS,
INCLUDES and DEFS values provided by configure.

Reported by cpet, this allows the FreeBSD port to drop a patch.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@519 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-01 14:37:41 +00:00
Kevin Easton
db3fabfc3e Delay setting the /cset CHANMODE mode on new channels until the channel is synched.
Instead of setting the mode at NAMES time (when we know that the channel is new),
remember this for later by setting the GOTNEW flag in the joinlist entry.  Then
check this flag when the channel is synched.

Setting the channel mode takes us out of server "grace mode", which slows down the 
processing of subsequent commands and drastically reduces the number of commands we
can have outstanding before we get kicked off for flooding.  This change allows us
to stay in grace mode while we're synching every channel that we joined at connect.

In turn, this makes joining lots of channels on connect faster, and much less likely
to cause us to be booted with "Excess Flood".


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@515 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-29 14:07:05 +00:00
Kevin Easton
8054c3e4ab Rename show_channel_sync() to channel_sync(), and don't use prepare_command() before it.
prepare_command() does nothing useful here, and it sets the current server to an incorrect value
if the channel sync happens while the current window is set to a window from a different server.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@514 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-29 12:51:40 +00:00
Kevin Easton
7563f1d401 Cache the bitmask of the channel log level in the cset structure instead of the channel structure.
This fixes a bug where the cached channel log level bitmask was not correctly set unless you did a 
/cset CHANNEL_LOG_LEVEL after the channel had been joined, which resulted in most things not being
logged.

It makes most sense to cache the bitmask within the cset structure, and there was even an (ununsed)
field already there for it.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@512 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-26 13:08:43 +00:00
Kevin Easton
3f3bdf5387 Display user and channel mode changes at level MODEUSER and MODECHAN instead of CRAP.
These were already being logged at the correct level, this just fixes the
interaction with window level and window notify_level.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@510 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-18 13:18:13 +00:00
Kevin Easton
c41048b896 Increase size of buffer to handle maximum-length topics in status_topic().
This affects the maximum length of the topic that can be displayed by the %-
status format.  No topic can be longer than IRCD_BUFFER_SIZE, so use that.

Reported by oxy.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@508 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-14 12:57:01 +00:00
Kevin Easton
5126d21126 Add /FSET WHOIS_LOGGEDIN to format RPL_WHOISLOGGEDIN, used by hybrid, ratbox, ircu and derivatives.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@506 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-10 12:56:09 +00:00
Kevin Easton
b99118c030 Add sanity checking of incoming nicknames.
Check that at least the first character of an incoming nickname is valid (we
actually go a bit beyond the RFC by also allowing any char with bit 8 set - at
least Russian servers use nicknames like this).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@501 13b04d17-f746-0410-82c6-800466cd88b0
2014-09-24 06:54:00 +00:00
Kevin Easton
6dc2335df9 The /mv command shouldn't send +v for already-voiced users.
The logic in the massop function to exclude already-voiced users from
massvoice was faulty - it was equivalent to just !nick_isop().


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@500 13b04d17-f746-0410-82c6-800466cd88b0
2014-09-23 13:59:03 +00:00
Kevin Easton
e808dbe94b Change the lag check so that it does not try to format a time_t using %lu.
Recent OpenBSD and NetBSD have changed time_t to be a 64 bit type on all
platforms.  This means that on 32 bit systems, time_t is now longer than
long, and %lu can't be used to format it.

The lag check doesn't actually care what is in the first field of the PING
command, so change it to be our nick (which is arguably what it should be).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@498 13b04d17-f746-0410-82c6-800466cd88b0
2014-09-21 14:54:12 +00:00
Kevin Easton
ced7f9bcc9 keys.c: Convert most uses of unsigned char to char, clearing up warnings.
This also fixes the ability to bind to key sequences ending in ^.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@476 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-17 21:37:32 +00:00
Kevin Easton
d03781f45b Fix the $timer() scripting function.
This function never worked - function_timer() was creating a string but then
never throwing it away and returning a part of the argument instead, which
then caused a crash because it couldn't be freed later in the expression
parsing.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@472 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-16 03:17:13 +00:00
Kevin Easton
ffea653764 Fix the /TKB (timed kickban) command.
An incorrect pointer was being passed to malloc_sprintf(), causing a
crash.  Use m_sprintf() instead.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@471 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-16 03:13:26 +00:00
Kevin Easton
73c9947324 Rewrite the termcap/terminfo detection logic in configure.
The new logic is considerably shorter and simpler, and should mean that
terminfo is properly used in preference to termcap on NetBSD.  This also
allows us to include term.h in term.c, where the system definition of
tparm() lives on some systems (NetBSD is one such).

The new logic also means we link against libtinfo in preference to
libncurses, which should mean a little less memory used at runtime and a
fraction faster startup time.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@434 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-10 04:50:52 +00:00
Kevin Easton
456a0061f0 Fix output when client is built against termcap.
The pointer passed to tgetstr() must not be reset each time around the loop.
Also some other minor cleanups in term_init().


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@428 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-01 13:06:02 +00:00
Kevin Easton
25dcf0709b Don't crash if the user gives a bogus status format with too many elements.
Replace unused .format_var member of status_expandos list with .args. For
expandos which have a subformat, this stores how many arguments are passed to
sprintf() when the subformat is expanded in the callback function.  The
convert_sub_format() function then uses this to limit the number of %s
conversion specifiers it creates in the converted subformat.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@426 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-30 13:09:03 +00:00
Kevin Easton
02327eebae Fix STATUS_NOTIFY so that it appears in the right window.
The old code was reusing the 'window' variable, which means that it
could pick up the STATUS_NOTIFY format from the wrong window.  You
would only have noticed this if you have windows with different settings
for STATUS_NOTIFY.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@425 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-29 13:25:10 +00:00
Kevin Easton
e9d180f526 Improve handling of padding in status formats.
Status formats support a %<PAD>c syntax for specifying padding.  This change
ensures that we only use padding consisting of the characters "0123456789.",
which ensures it won't confuse sprintf.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@424 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-29 13:14:19 +00:00
Kevin Easton
3de05c07c1 Only build and use the compat.c bsd_setenv/bsd_putenv/bsd_unsetenv on systems
that don't provide the POSIX setenv().

This fixes building plugins that link to compat.c on OS X (shared libraries on
OS X don't have direct access to environ).  It also reduces the binary size on
platforms which provide setenv(), which these days is most of them.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@382 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-09 21:40:55 +00:00
Kevin Easton
4118a120bc Don't truncate the password and salt passed to crypt() by the $crypt()
scripting function - this allows alternate hashing methods to be selected
if supported by the C library.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@361 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-20 12:50:39 +00:00
Kevin Easton
2fea73808f Improve the initial seeding of the randm() RNG. This is the RNG selected
for $rand() when RANDOM_SOURCE is 1.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@359 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 15:10:17 +00:00
Kevin Easton
641565d4eb Strengthen the algorithm that generates a random cookie for /detach.
This is a backwards-compatible change, no update to the scr-bx binary
is necessary.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@358 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 14:51:28 +00:00
Kevin Easton
5582171286 Switch random_number() to always use the best entropy source for internal
client purposes.  The RANDOM_SOURCE setting now only affects the $rand()
scripting function.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@357 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 14:47:04 +00:00
Kevin Easton
0b0dbf5cf7 Make the RANDOM_LOCAL_PORTS setting actually use a random port.
The code was calling random_number(65535 - 1024), but a non-zero argument
to random_number() is actually a seed to reseed the generator, and causes
random_number() to return zero.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@331 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-15 15:06:21 +00:00
Kevin Easton
a6f8021cd9 Fix a couple of compiler warnings in irc.c - two places where the address
of an array was tested (always not-NULL) and one unused variable (first_time
in io()).

The user-visible change here is that the emergency exit QUIT messages 
(eg "User abort with 5 Ctrl-C's") will be correctly relayed to the local 
terminal now.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@321 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-14 14:39:24 +00:00
Kevin Easton
1cfaf1349c Remove XLINK CTCP reply handler - it's not used for the botlink
functionality.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@320 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-14 13:34:04 +00:00
Kevin Easton
6691732900 Make add_socketread() close the new socket if it can't be added to the
socket manager because it exceeds FD_SETSIZE.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@307 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-07 23:03:45 +00:00
Tim Cava
d68a196b8a Mention fixes to commands in the banlist.c cleanup.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@297 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-31 05:40:44 +00:00
Kevin Easton
9378704c39 Improve the list_channels() function so that it behaves correctly when
connected to multiple servers.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@285 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 14:01:20 +00:00
Kevin Easton
7d9ffbe792 Add Changelog entry for socklen_t change.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@284 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 13:33:09 +00:00
Kevin Easton
2235c029bb Update Changelog for sys/termios -> termios fix.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@276 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 02:03:44 +00:00
Tim Cava
ee761e7f02 Skip malformed entries in abots.sav, which avoids two null dereferences found by Coverity.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@250 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-28 05:22:20 +00:00
Kevin Easton
8a04cbeba8 Don't pass the output of convert_output_format(FORMAT_DCC, ...) directly to
sprintf() as a format string, because there could (and usually are!) '%'
characters that will be interpreted by sprintf.

This also allows clean compilation under -Werror=format-security.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@246 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-23 14:36:32 +00:00
Kevin Easton
c51810738e Improve handling of one kind of malformed CDCC save file, where the pack
description line doesn't contain a space.  Found by Coverity.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@244 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-20 01:45:29 +00:00
Kevin Easton
882c3150e2 Fix open file leak in /LASTLOG, in situations like:
/LASTLOG -FILE /tmp/a -FILE /tmp/a
/LASTLOG -FILE /tmp/a -CLEAR
/LASTLOG -FILE /tmp/a -LITERAL
/LASTLOG -FILE /tmp/a -BOGUS

Found by Coverity.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@243 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-18 12:55:32 +00:00
Kevin Easton
2fc84d5f93 Fix a file descriptor leak when connect() fails during a SOCKS4 proxy
connection attempt.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@242 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-18 11:00:12 +00:00
Tim Cava
df8328c3a1 Fix out-of-bounds error in cryptit() found by Coverity.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@240 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-16 14:40:52 +00:00
Kevin Easton
ceb0492734 Cleanup save_formats() by removing unused function argument.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@238 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-16 12:21:03 +00:00
Kevin Easton
bad477f9dc Fix off-by-one error in the check for s against FD_SETSIZE in add_socketread()
and set_socketwrite().  This was found by Coverity.



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@237 13b04d17-f746-0410-82c6-800466cd88b0
2013-06-16 06:04:29 +00:00
Kevin Easton
092d9789e0 Order the rfc1459[] array correctly.
This is a longstanding bug - it's also present in EPIC4 and EPIC5 so it's
probably been in BitchX since the beginning.  The bug has been latent until
the AUTHENTICATE and CAP commands were added, which perturbed the binary
search so that the client didn't see invite messages properly.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@235 13b04d17-f746-0410-82c6-800466cd88b0
2013-04-24 12:05:44 +00:00
Kevin Easton
73269ea887 Bail out of check_auto_reply() early if auto_str is NULL. This fixes a
crash after /SETAR -.

Reported by riderplus.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@234 13b04d17-f746-0410-82c6-800466cd88b0
2013-03-01 12:33:00 +00:00
Kevin Easton
17e3a91f03 Remove handling for the 484 numeric. It was intended for ircnet's 484
(ERR_RESTRICTED), to set user mode +r - however this does not appear to
be necessary anymore.  It was also buggy for several reasons: due to 
a change in set_server_flag() this has actually been setting mode +G; and
484 is ERR_ISCHANSERVICE on other ircds.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@233 13b04d17-f746-0410-82c6-800466cd88b0
2013-02-25 12:22:54 +00:00
Kevin Easton
e99861dbfb Add /OBITS command showing obituaries for long-time BitchX friends.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@230 13b04d17-f746-0410-82c6-800466cd88b0
2013-02-21 22:29:34 +00:00
Kevin Easton
1390402af1 Fix abuses of the RESIZE() macro in array.c, of the form:
x = RESIZE(x, type, size);

which should just be:

RESIZE(x, type, size);

The erroneous use is undefined behaviour according to the C standard, and
causes new versions of gcc (and, apparently, clang) to throw a warning.

Reported by nenolod/moogle.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@227 13b04d17-f746-0410-82c6-800466cd88b0
2013-02-16 08:11:07 +00:00
Kevin Easton
a1ec2113e9 Fix sort_scores in the acro plugin - pass the correct number of array entries
to qsort() and properly reconstruct the list.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@224 13b04d17-f746-0410-82c6-800466cd88b0
2013-01-04 10:11:32 +00:00
Kevin Easton
f51de3a170 Fix the timer callbacks in the acro plugin to use the correct function
signature.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@223 13b04d17-f746-0410-82c6-800466cd88b0
2013-01-04 09:03:12 +00:00