Commit Graph

114 Commits

Author SHA1 Message Date
Kevin Easton
ab7d59f1f6 Add a length sanity check - just in case there's an implementation out there
that parses AF_UNIX addresses in getaddrinfo() or something.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@189 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-15 14:01:42 +00:00
Kevin Easton
ba365bfd54 Fix logic error that can result in a potential crash (when getaddrinfo() fails
and res happened to be NULL).

Also add missing freeaddrinfo() call.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@188 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-15 13:29:32 +00:00
Kevin Easton
9ec4f49540 Apply patch from snadge to set BIND_4_COMPAT on OpenBSD. This is similar
to the existing BIND_8_COMPAT fix for OSX.

Oh how I hate the /nslookup function.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@187 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-15 13:16:11 +00:00
Kevin Easton
26a62fe7fa Rework the IPV6 verison of BX_ip_to_host() so that it works on BSD (used
by $iptoname() scripting function).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@182 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-14 13:56:52 +00:00
Kevin Easton
f035eceb72 Pass the right socket address length to bind() in client connections with
IPv6 enabled.  This fixes an issue reported by packet, where IPv4 conections
don't work on FreeBSD when the client is built with IPv6 support and you
have a local hostname set (with /hostname, -H or IRCHOST).

Also ensure we clear the full size of the 'server' address structure - doesn't
fix a known problem but is a defensive measure.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@181 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-13 14:06:53 +00:00
Kevin Easton
5d788560a4 Choose the address length passed to connect() based on the address family.
This fixes making IPv4 connections on BSD when the client is compiled with
IPv6 enabled.

Thanks to brabes on sourceforge and snadge@freenode for originally tracking
this down.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@176 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-11 12:22:03 +00:00
Kevin Easton
0219904860 Ensure that real errors from connect() (eg. EINVAL) are detected and
acted on immmediately, even for nonblocking connects.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@175 13b04d17-f746-0410-82c6-800466cd88b0
2012-05-11 12:03:10 +00:00
Kevin Easton
cb0c2aabc2 Improve error handling in /detach - will now soft-fail the detach instead
of killing the whole client.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@163 13b04d17-f746-0410-82c6-800466cd88b0
2012-04-30 08:05:04 +00:00
Kevin Easton
3090365354 Change connect_by_number() so that SERVICE_SERVER sockets are always bound to
IPv4 even on an IPv6-enabled client.  This fixes /detach and wserv when
compiling with --enable-ipv6.

This does also mean that the internal identd, if used, won't listen on IPv6
either.  This isn't a problem yet, since the internal identd is used only on
WINNT and we don't support IPv6 there yet.

This will also need tweaking to support initiating DCC-over-IPv6.

Thanks to snadge and packet for working on this bug.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@162 13b04d17-f746-0410-82c6-800466cd88b0
2012-04-29 12:15:57 +00:00
Kevin Easton
97174632dc Add explicit default value for NICK_COMPLETION_CHAR.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@160 13b04d17-f746-0410-82c6-800466cd88b0
2012-03-06 11:14:51 +00:00
Kevin Easton
a9e1608865 Compile wterm.o, bircsig.o, wnetwork.o, bcompat.o, sterm.o directly
from source files without symlinks.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@159 13b04d17-f746-0410-82c6-800466cd88b0
2012-03-06 11:11:54 +00:00
Kevin Easton
e2ada61548 Modernise autoconf checks for sys_siglist and strsignal.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@156 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-17 12:30:55 +00:00
Kevin Easton
b7c216bcc6 Remove special compilation for help.c - DEFAULT_HELP_PATH isn't
referenced by the code.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@155 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-17 10:31:20 +00:00
Kevin Easton
5222ce2f1d Move window_check_servers() call out of loop, otherwise the client does a
huge amount of work on each keystroke if you have a long server list and
start it up disconnected (-N).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@150 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-10 12:38:08 +00:00
Kevin Easton
87f24694b9 Remove unnecessary ns_init() function.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@149 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-10 11:22:14 +00:00
Kevin Easton
122849f247 Replace _getshort() and _getlong() with NS_GET16() and NS_GET32() respectively.
Fixes compilation on cygwin (and possibly other targets).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@148 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-08 12:53:16 +00:00
Kevin Easton
7978a87c9f Change async DNS resolver code to register its file descriptor with the IO
core.  This fixes /nslookup.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@147 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-08 11:24:48 +00:00
Kevin Easton
ed16081a2b Remove bogus F_SETOWN use in /detach code.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@146 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-01 13:26:50 +00:00
Kevin Easton
5cf8ed2c79 Cleanup create_ipc_socket() and ensure it detects all errors in
connect_by_number().  Make function static since it is only used in one
source file.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@145 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-01 13:21:47 +00:00
Kevin Easton
71cc2bf5f4 Add FORMAT_WHOIS_SECURE for SSL connection info from ratbox, unreal and freenode servers (RPL_WHOISSECURE). Does not support
hybrid yet because it uses numeric 275, which clashes with unreal's RPL_STATSDLINE.

RIP dmr.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@144 13b04d17-f746-0410-82c6-800466cd88b0
2011-10-13 12:45:27 +00:00
Kevin Easton
15f6d8ac06 Pass through arguments of 338 numeric unchanged to script hook.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@143 13b04d17-f746-0410-82c6-800466cd88b0
2011-10-06 09:48:10 +00:00
Kevin Easton
b355145d69 Add /FSET CHANNEL_URL to format the RPL_CHANNELURL (328) numeric sent by dalnet and atheme services.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@142 13b04d17-f746-0410-82c6-800466cd88b0
2011-10-04 12:47:01 +00:00
Kevin Easton
89b77f68fe Cleanups and simplifications in mircansi(), removal of some more warnings.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@141 13b04d17-f746-0410-82c6-800466cd88b0
2011-09-07 14:41:06 +00:00
Kevin Easton
206df688ba Fix mircansi() so that it properly handles non-numeric characters
after a comma.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@140 13b04d17-f746-0410-82c6-800466cd88b0
2011-09-07 12:48:35 +00:00
Kevin Easton
cc0a27d7fe Rework stripansicodes() to take a const char * argument rather than const unsigned char *,
fixing a large number of warnings. 


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@139 13b04d17-f746-0410-82c6-800466cd88b0
2011-09-07 10:13:18 +00:00
Kevin Easton
43aaf645e2 Use PC_SILENT macro in BX_prepare_command()
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@138 13b04d17-f746-0410-82c6-800466cd88b0
2011-09-06 06:55:38 +00:00
Kevin Easton
736777bea3 Change instances of open-coded "3" in calls to prepare_command() with PC_SILENT macro.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@137 13b04d17-f746-0410-82c6-800466cd88b0
2011-09-06 06:48:57 +00:00
Kevin Easton
02e4ced684 Add PC_TOPIC flag to prepare_command() for topic-change commands.
Clean up e_topic(), splitting out untopic() and using prepare_command()
to check for ops.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@136 13b04d17-f746-0410-82c6-800466cd88b0
2011-09-05 12:57:31 +00:00
Kevin Easton
83ac47c4f5 Minor cleanup for error_not_opped().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@135 13b04d17-f746-0410-82c6-800466cd88b0
2011-08-30 14:52:56 +00:00
Kevin Easton
c89a718fa1 Change the channel mode flags from const ints in names.c to #define macros in names.h.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@134 13b04d17-f746-0410-82c6-800466cd88b0
2011-08-30 14:50:42 +00:00
Kevin Easton
3f8952f20a Fix some memory leaks that occur when clearing the URL-grabber list.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@133 13b04d17-f746-0410-82c6-800466cd88b0
2011-06-01 12:53:30 +00:00
Kevin Easton
52753a9e15 Further cleanups in the URL grabber - remove unnecessary globals, change
url_list from extern to static.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@132 13b04d17-f746-0410-82c6-800466cd88b0
2011-05-17 14:16:34 +00:00
Kevin Easton
b628217600 Fix a memory leak in the URL grabber - as old URLs were expired from the list,
they weren't being freed.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@131 13b04d17-f746-0410-82c6-800466cd88b0
2011-05-17 14:03:29 +00:00
Kevin Easton
41d0516849 Remove some dead code in funny_mode().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@130 13b04d17-f746-0410-82c6-800466cd88b0
2011-05-16 13:16:25 +00:00
Kevin Easton
1569a5233f Fix a regression with the previous changes to $help() - topics with embedded
spaces are enclosed in quotes eg. $help("cdcc tresend").


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@129 13b04d17-f746-0410-82c6-800466cd88b0
2011-05-03 11:55:34 +00:00
Kevin Easton
7c36bdd4ad Cleanups to $help() function, removing some half-baked functionality that
never worked properly.  Search LOAD_PATH for the SCRIPT_HELP file.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@128 13b04d17-f746-0410-82c6-800466cd88b0
2011-05-02 12:34:39 +00:00
Kevin Easton
c5b5fdd4af Sort the chelp index after loading - ensures that all topics are reachable.
Use correct define for PUBLIC_ACCESS.

Some cleanups - separate out help index freeing, change get_help_topic() to return
void.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@127 13b04d17-f746-0410-82c6-800466cd88b0
2011-05-02 11:43:38 +00:00
Kevin Easton
1838a37a6c Cleanups in get_help_topic(). Topic now displays correctly, rather than the
argument supplied to /bhelp.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@126 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-18 14:30:03 +00:00
Kevin Easton
ab170a123d Further simplifications and improvements to the chelp code.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@125 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-18 12:54:13 +00:00
Kevin Easton
09c34c045f Further cleanups and fixes in chelp.c:read_file(). Now properly adds NULLs to
terminate the lists, that the code in get_help_topic() expects to be there - 
fixes a potential crash in /bhelp.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@123 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-17 11:58:16 +00:00
Kevin Easton
df5547af72 Add .xxx TLD to country(), and some more const-correctness.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@122 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-17 03:33:00 +00:00
Kevin Easton
780ac2c149 Cleanup and rename replace_color() to put_color(), including sanity-checking of
foreground color code - this ensures that if a wild color code makes it this
far, it doesn't crash the client.



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@121 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-08 13:10:05 +00:00
Kevin Easton
fd9980b9c7 Fix spelling mistake.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@119 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-08 12:29:55 +00:00
Kevin Easton
7f293687b1 Correct help text for /bhelp, reported by t3gah.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@118 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-05 23:24:22 +00:00
Kevin Easton
9b92ec3c11 Cleanups and simplifications in read_file().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@117 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-05 11:59:06 +00:00
Kevin Easton
c816dcec22 Add missing entry for new USERMODE_OTHERS /fset.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@116 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-05 05:47:49 +00:00
Kevin Easton
3f0ef54b18 Remove some dead code and add a sanity check to create_fsets().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@115 13b04d17-f746-0410-82c6-800466cd88b0
2011-04-05 05:45:20 +00:00
Kevin Easton
c45c6a69bf Cleanup p_mode() and correct handling of user mode changes where the source
and the target aren't the same (reported by gauze).  This doesn't happen
on standard servers, but is used by services on some networks.

Adds /FSET USERMODE_OTHER.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@114 13b04d17-f746-0410-82c6-800466cd88b0
2011-03-31 22:20:21 +00:00
Kevin Easton
719279790e Add some more TLDs to $country(), synchronised with the IANA list: .ax, .eu,
.me, .rs, .tl, .asia, .cat, .jobs, .tel and .travel.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@113 13b04d17-f746-0410-82c6-800466cd88b0
2011-03-31 08:32:23 +00:00
Kevin Easton
b17b09949b Improve country() by using "static const" for lookup table (makes function 25% smaller)
and const-correctness.  Add .mobi TLD.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@112 13b04d17-f746-0410-82c6-800466cd88b0
2011-03-23 11:17:23 +00:00