silc.git
9 years agosilc-client: handle prompt abort better silc.client.1.1.19 silc.client.1.1.9 silc.toolkit.1.1.11
Pekka Riikonen [Tue, 6 May 2014 09:24:10 +0000 (12:24 +0300)]
silc-client: handle prompt abort better

When verfying public key abort any previously ungoing prompt so that we
can get the public key verification prompt up.  It's important to not
loose the public key verification prompts so we now allow new prompt to
come up after previous one has aborted.  It leaks Irssi memory, but
handles things correctly towards silcclient library.  Irssi's prompt
handling is broken because it stores the data in a global variable
allowing only one prompt at a time.

9 years agosilcclient: check packet type as responder before starting AKE
Pekka Riikonen [Mon, 5 May 2014 10:53:08 +0000 (13:53 +0300)]
silcclient: check packet type as responder before starting AKE

Do not immediately start the private message key autonegotiation as
responder when a packet comes in but wait until it is decoded from the
private message payload so that responder can properly set up the SKE
properties and start the SKE in proper state.  Initiator is allowed to
start SKE with SILC_PACKET_KEY_EXCHANGE at any time, including when a key
already exists and it would be error to expect that initiator should have
sent SILC_PACKET_KEY_EXCHANGE_1 just because key exists in responder side.

9 years agosilc-server: rpm packaging updates
Pekka Riikonen [Mon, 5 May 2014 08:40:55 +0000 (11:40 +0300)]
silc-server: rpm packaging updates

9 years agoFix compilation warnings
Pekka Riikonen [Mon, 5 May 2014 08:23:48 +0000 (11:23 +0300)]
Fix compilation warnings

9 years agosilc-toolkit: rpm packaging updates
Pekka Riikonen [Mon, 5 May 2014 08:24:08 +0000 (11:24 +0300)]
silc-toolkit: rpm packaging updates

9 years agosilc-client: rpm packaging updates
Pekka Riikonen [Mon, 5 May 2014 08:23:33 +0000 (11:23 +0300)]
silc-client: rpm packaging updates

9 years agoImport debian packages for silc-client, silc-server and silc-toolkit
Pekka Riikonen [Sun, 4 May 2014 16:01:42 +0000 (19:01 +0300)]
Import debian packages for silc-client, silc-server and silc-toolkit

9 years agosilcd: allow ServerType, Location, Admin and AdminEmail to be empty
Pekka Riikonen [Sun, 4 May 2014 15:13:45 +0000 (18:13 +0300)]
silcd: allow ServerType, Location, Admin and AdminEmail to be empty

9 years agoExample silcd.conf file that connects to sauna.silcnet.org directly.
Pekka Riikonen [Sun, 4 May 2014 14:59:06 +0000 (17:59 +0300)]
Example silcd.conf file that connects to sauna.silcnet.org directly.

9 years agoSKE: handle invalid protocol state errors
Pekka Riikonen [Tue, 29 Apr 2014 07:56:24 +0000 (10:56 +0300)]
SKE: handle invalid protocol state errors

With SKE over UDP we can receive packets in wrong order or do
retransmissions but in TCP receiving wrong SKE packet at wrong time is
a protocol error and must result to end of the key exchange.

9 years agoirssi: better public key print out
Pekka Riikonen [Mon, 28 Apr 2014 20:01:30 +0000 (23:01 +0300)]
irssi: better public key print out

When verifying public key show more information about it.

9 years agosilcd: show MAC in welcome notifys
Pekka Riikonen [Mon, 28 Apr 2014 20:00:55 +0000 (23:00 +0300)]
silcd: show MAC in welcome notifys

Shoe cipher and MAC currently in use in the welcome messages servers sends
to client.

9 years agoBump version numbers
Pekka Riikonen [Mon, 28 Apr 2014 20:00:02 +0000 (23:00 +0300)]
Bump version numbers

Bump library version numbers, API has changed.

9 years agosilcclient: auto-negotiation of private message key using SKE over SILCnet
Pekka Riikonen [Mon, 28 Apr 2014 19:59:28 +0000 (22:59 +0300)]
silcclient: auto-negotiation of private message key using SKE over SILCnet

Previously in SILC private messages have been protected in normal mode
using the session key shared between the client and server and other
servers in the network.  This obviously has security implications if
the SILC servers cannot be trusted.

To overcome this issue silcclient library has offered user the ability to
use pre-shared key (or password) as the secret key to protect private
message, or to negotiate fresh key material using SKE peer-to-peer over
the internet (key agreement).

However, both of these feature have severe limitations.  The first one
requiring coordinated effort to somehow share the key or password and
the second requiring peer-to-peer connection which may not be possible
due to NAT and firewalls.

This commit adds a new private message protection method and takes it
into use as the default protection method.  The commits adds support
for automatic negotiation of the private message key using SKE but instead
of doing it peer-to-peer over the internet it is done client-to-client
over the SILC network itself.  This is accomplished by tunneling the
SKE protocol inside private message packets.  As SKE is safe over the
unprotected and untrusted internet it is safe also over the SILC network.

The end result of the auto-negotiation is a shared secret known only
to the two clients.  The SKE provides mutual authentication with digital
signatures to prevent man-in-the-middle attack.  The private messages
protected with this key can be read only by the two clients.  SILC servers
along the way cannot decrypt them.  The key is periodically re-keyed
(5 minutes or so) and it provides Perfect Forward Secrecy.

The auto-negotiation is enabled by default.  It can detect within seconds
if the remote client supports the method and if it doesn't it gives a
notification that the private message protection has been reverted back
to session keys.  Application can disable the feature, if wanted.

This feature does not require any changes to SILC servers.

9 years agosilcclient: fix packet stream coder function
Pekka Riikonen [Mon, 28 Apr 2014 19:43:44 +0000 (22:43 +0300)]
silcclient: fix packet stream coder function

Generate correct FTP packet after, after the packet stream coder function
semantics changed in commit 705167687caeaa66c371dce7cc88719687337b9e.

9 years agosilcclient: Add generic client entry operation context
Pekka Riikonen [Mon, 28 Apr 2014 19:42:43 +0000 (22:42 +0300)]
silcclient: Add generic client entry operation context

Add generic client entry async operation context to the internal
context.  Change the key agreement to start using it.

Add support for aborting client entry operations when the client entry
is deleted or when the connection is closed to the server.

9 years agoSKE: support for simplified key exchange
Pekka Riikonen [Mon, 28 Apr 2014 19:39:06 +0000 (22:39 +0300)]
SKE: support for simplified key exchange

This commit adds support for simplified SILC Key Exchange protocol by
allowing the caller to specify the security properties to be used in
the key exchange.  This will stop the library from exchanging the
SILC_PACKET_KEY_EXCHANGE packet containing the properties.

Support for not sending the SILC_PACKET_SUCCESS acks after a successful
key exchange.

These two changes allow the SKE to be simplified to exchanging only
the SILC_PACKET_KEY_EXHANGE_1 and SILC_PACKET_KEY_EXCHANGE_2 packets
to produce the shared key and to do mutual authentication.

The commit also adds support for generating small proposals in
SILC_PACKET_KEY_EXCHANGE packet by including only one security property
per item instead of listing all of them in the proposal.

Additionally the commit adds support for probe timeout which affects
the first packet sent by initiator.  If responder does not respond to
the first packet in the specified timeframe the key exchange will
timeout.  If it replies the normal key exchange timeout has effect after
that.

9 years agosilccore: packet injection and stream wrap improvements
Pekka Riikonen [Mon, 28 Apr 2014 19:31:35 +0000 (22:31 +0300)]
silccore: packet injection and stream wrap improvements

Add silc_packet_stream_inject to allow injecting of packets to the
specified packet stream.

Add support for specifying the source and destination ids for the
wrapped packet stream allowing to use them in packet sending and using
them in packet reception to take only packets with the specified ids.

The semantics of CAN_WRITE and CAN_READ of wrapped packet stream coder
function has been changed to allow the coder to filter out packets it
does not want or to handle errors in coding.

9 years agoRobodoc compilation update
Pekka Riikonen [Mon, 28 Apr 2014 18:55:33 +0000 (21:55 +0300)]
Robodoc compilation update

Update robodoc compilation.

9 years agoTargeted library message to correct Irssi window
Pekka Riikonen [Mon, 28 Apr 2014 18:49:23 +0000 (21:49 +0300)]
Targeted library message to correct Irssi window

Add support for sending the library generated say-operation messages
to correct window using either nickname or channel name as the target.
Irssi does the rest to show the message in correct window.

9 years agoTargeted say-operation messages
Pekka Riikonen [Mon, 28 Apr 2014 18:47:58 +0000 (21:47 +0300)]
Targeted say-operation messages

Add support for including the client, channel or server with the say()
client operation library can generate.  This allows application to
better target the message to correct window or recipient.

9 years agoFix file transfer crash
Pekka Riikonen [Mon, 28 Apr 2014 12:05:58 +0000 (15:05 +0300)]
Fix file transfer crash

When silc-client accepts new file transfer and receives public key to
verify it will crash because the client connection has no Irssi server
associated to it.  Handle this gracefully.

Call the sucessful public key verify completion after the key has been
saved because the completion callback may free the public key.

9 years agoUse backtrace() in stack tracing for prettier output
Pekka Riikonen [Sun, 27 Apr 2014 07:48:43 +0000 (10:48 +0300)]
Use backtrace() in stack tracing for prettier output

This commit takes the backtrace() call in use to produce stack trace
outputs, plus it gives us x86-64 support for stack trace.

9 years agoStatic analyzer fixes
Pekka Riikonen [Sun, 27 Apr 2014 07:38:34 +0000 (10:38 +0300)]
Static analyzer fixes

More small fixes resulting from clang static analysis.

10 years agoEnable higher security messages MACs
Pekka Riikonen [Tue, 22 Apr 2014 12:29:07 +0000 (15:29 +0300)]
Enable higher security messages MACs

The code to include the source and destination ID in the message payload
MAC has been there for a long time but the use of it has been disabled.
This commit enables it but preserves the backwards support for those
clients unable to verify the MACs.  The support for the newer MACs
have been there for several years.

10 years agoRemove obsolete backwards support code
Pekka Riikonen [Tue, 22 Apr 2014 12:26:55 +0000 (15:26 +0300)]
Remove obsolete backwards support code

Remove the old zero-client id backwards support when starting SKE protocol.

10 years agoLonger default PKCS keys
Pekka Riikonen [Tue, 22 Apr 2014 12:25:37 +0000 (15:25 +0300)]
Longer default PKCS keys

This commit changes the default PKCS key length from 2048 bits to 4096
bits.  It adds warnings to both SILC client and SILC server in start up
in case the existing key is shorter than 4096 to encourage people to
generate new key longer key pair.

This commit also changes the default SKE DH group from 1024 to 1536 bits.
The old group is still supported.

10 years agoStatic analyzer bug fixes
Pekka Riikonen [Tue, 22 Apr 2014 12:22:38 +0000 (15:22 +0300)]
Static analyzer bug fixes

Bunch of small bugs fixed here and there found during static analysis.

11 years agoMac OS X >= 10.7 support
Pekka Riikonen [Fri, 22 Jun 2012 19:21:38 +0000 (22:21 +0300)]
Mac OS X >= 10.7 support

Add support for compiling on Mac OS X > 10.7 and newer.  Summary of
changes:

 - Remove config.guess and config.sub, let the autodist copy proper
   versions from the system.

 - Add support for autoconfg 2.68 and newer.

 - Add support for compiing x86-64 AES code with NASM.

 - Update Mac OS X installation instructions.

13 years agoClient: Fix signature verification double free
Pekka Riikonen [Tue, 25 May 2010 04:24:28 +0000 (07:24 +0300)]
Client: Fix signature verification double free

When client receives public key in the message payload and is compared
against the client's own public key, when the keys differ we have to
return immediately and not try to verify the signature.

13 years agosilcd: check entity validity after command reply
Pekka Riikonen [Tue, 11 May 2010 05:10:10 +0000 (08:10 +0300)]
silcd: check entity validity after command reply

When processing pending command after command reply check that the entity,
client or server, is still registered before processing the command.

13 years agoPacket engine: prevent divide by 0
Pekka Riikonen [Tue, 11 May 2010 04:44:09 +0000 (07:44 +0300)]
Packet engine: prevent divide by 0

13 years agoSKE: Make sure failure received from remote is error status.
Pekka Riikonen [Tue, 11 May 2010 04:41:03 +0000 (07:41 +0300)]
SKE: Make sure failure received from remote is error status.

14 years agosilcd: cancel rekey and heartbeat in silc_server_disconnect_remote
Pekka Riikonen [Sun, 27 Sep 2009 14:44:09 +0000 (17:44 +0300)]
silcd: cancel rekey and heartbeat in silc_server_disconnect_remote

14 years agosilcd: Added heartbeat support
Pekka Riikonen [Sat, 26 Sep 2009 17:21:31 +0000 (20:21 +0300)]
silcd: Added heartbeat support

Added support for sending SILC_PACKET_HEARTBEAT packets to connection,
to make sure they keep alive and to detect if they have died.

14 years agoSet SO_KEEPALIVE for all accept()ed sockets.
Pekka Riikonen [Fri, 25 Sep 2009 09:07:41 +0000 (12:07 +0300)]
Set SO_KEEPALIVE for all accept()ed sockets.

14 years agoclientlib: Close connection after failed rekey
Pekka Riikonen [Fri, 25 Sep 2009 09:06:45 +0000 (12:06 +0300)]
clientlib: Close connection after failed rekey

14 years agosilcd: Fixed SIGUSR1 signal handling
Pekka Riikonen [Fri, 25 Sep 2009 09:05:38 +0000 (12:05 +0300)]
silcd: Fixed SIGUSR1 signal handling

Fixed the SIGUSR1 signal handling which can be used to dump the server
internals to /tmp.

Changed also End of Stream handling to handle NULL idata pointer instead
of ignoring the EOS in case it is NULL.

Changed also the DETACH timeout handling to use the packet stream
directly instead of looking up client in the callback.

14 years agoMore string format fixes in silcd and client libary silc.toolkit.1.1.10
Pekka Riikonen [Fri, 7 Aug 2009 11:48:46 +0000 (14:48 +0300)]
More string format fixes in silcd and client libary

14 years agoconfigure: changed AC_PROG_LIBTOOL order to fix disabling shared libs
Pekka Riikonen [Sun, 2 Aug 2009 07:11:20 +0000 (10:11 +0300)]
configure: changed AC_PROG_LIBTOOL order to fix disabling shared libs

14 years agoconfigure: check threads support in OpenBSD. silc.client.1.1.8 silc.server.1.1.17
Pekka Riikonen [Fri, 31 Jul 2009 19:38:06 +0000 (22:38 +0300)]
configure: check threads support in OpenBSD.

14 years agoFixed string format vulnerability in client entry handling.
Pekka Riikonen [Fri, 31 Jul 2009 19:32:57 +0000 (22:32 +0300)]
Fixed string format vulnerability in client entry handling.

Reported and patch provided by William Cummings.

14 years agosilcd: Fixed IDENTIFY command reply handling for channels
Pekka Riikonen [Mon, 8 Jun 2009 05:58:35 +0000 (08:58 +0300)]
silcd: Fixed IDENTIFY command reply handling for channels

The IDENTIFY comamnd reply for channels were broken because the channel ID
parsing always failed.  This would cause issues like USERS command not
returning the users for a channel, making the channel appear empty, in some
specific cases.

Fixed also the USERS command reply to not query the channel information
from router more than once.

14 years agosilcd: Abort active protocols in DETACH command
Pekka Riikonen [Mon, 8 Jun 2009 05:03:02 +0000 (08:03 +0300)]
silcd: Abort active protocols in DETACH command

When detaching client, which results into closing of the actual connection
it is important to abort any active protocols, such as rekeys, because
they cannot be completed with detached clients.

14 years agosilcd: Added SKR to debug levels
Pekka Riikonen [Sun, 7 Jun 2009 17:04:16 +0000 (20:04 +0300)]
silcd: Added SKR to debug levels

14 years agosilcd: Save debug message in ring buffer
Pekka Riikonen [Tue, 2 Jun 2009 05:01:25 +0000 (08:01 +0300)]
silcd: Save debug message in ring buffer

In debug version save 3000 last debug messages in ring buffer so that they
are available in core files.

14 years agoconfigure.ad: Fixed configure to support new autoconf
Pekka Riikonen [Mon, 25 May 2009 17:44:07 +0000 (20:44 +0300)]
configure.ad: Fixed configure to support new autoconf

14 years agosilcd: fixed Deny hostname comparison
Pekka Riikonen [Mon, 25 May 2009 17:43:22 +0000 (20:43 +0300)]
silcd: fixed Deny hostname comparison

Use the silc_strin_match instead of silc_string_compare to match
hostnames and IP addresses in silcd.conf.  Fixed for Deny but changed
in all the other places as well.

15 years agoAdded proper copyright notices to COPYING and BSD files silc.server.1.1.16
Pekka Riikonen [Wed, 11 Mar 2009 15:04:20 +0000 (17:04 +0200)]
Added proper copyright notices to COPYING and BSD files

15 years agosilcd: IDENTIFY command reply didn't save userinfo correctly
Pekka Riikonen [Tue, 3 Mar 2009 06:02:27 +0000 (08:02 +0200)]
silcd: IDENTIFY command reply didn't save userinfo correctly

The IDENTIFY command reply didn't duplicate the userinfo when adding
new client thus causing weird crashes later when freeing the userinfo.

15 years agosilcd: IDENTIFY command reply didn't save client correctly
Pekka Riikonen [Tue, 3 Mar 2009 05:52:58 +0000 (07:52 +0200)]
silcd: IDENTIFY command reply didn't save client correctly

The IDENTIFY command reply added sometimes new client without
duplicating the nickname of the client thus causing odd crashes later
when trying to free the nickname.

15 years agoPacketEngine: Don't free underlaying stream in packet stream create error
Pekka Riikonen [Fri, 27 Feb 2009 14:22:36 +0000 (16:22 +0200)]
PacketEngine: Don't free underlaying stream in packet stream create error

If packet stream creation failed it freed the stream given as argument.
This is wrong.  It is the caller's responsibility to free it if the
packet stream creation failed.

15 years agosilcd: handle SIGNOFF notify for local clients correctly
Pekka Riikonen [Fri, 27 Feb 2009 14:16:11 +0000 (16:16 +0200)]
silcd: handle SIGNOFF notify for local clients correctly

In some rare cases router can send SIGNOFF notify to server for a client
that is locally connected to the server.  The server didn't close the
client's connection but freed the entry.  This later caused various
different crashes when accessing the freed the client.

15 years agoFixed unsigned <-> signed char issues
Pekka Riikonen [Thu, 26 Feb 2009 06:07:56 +0000 (08:07 +0200)]
Fixed unsigned <-> signed char issues

15 years agoSKE: When failure is received mark SKE always failed
Pekka Riikonen [Thu, 26 Feb 2009 06:06:02 +0000 (08:06 +0200)]
SKE: When failure is received mark SKE always failed

Mark the SKE failed even if we don't receive error from remote.  Fixes
crash where the callback is called back to application without valid
key material and without error status.

15 years agosilcd: increment stat.clients statistics whenever adding new client
Pekka Riikonen [Sat, 17 Jan 2009 09:42:07 +0000 (11:42 +0200)]
silcd: increment stat.clients statistics whenever adding new client

When new client is added to server the stat.clients must always be
incremented.  Otherwise it is possible to go under zero when removing
the clients by server.

15 years agosilcd: do not create dynamic connections on non-dynamic server
Pekka Riikonen [Thu, 15 Jan 2009 10:21:23 +0000 (12:21 +0200)]
silcd: do not create dynamic connections on non-dynamic server

15 years agoAdded scripts/release
Pekka Riikonen [Mon, 12 Jan 2009 07:03:41 +0000 (09:03 +0200)]
Added scripts/release

15 years agoLibtool 2.x support silc.client.1.1.7
Pekka Riikonen [Sat, 10 Jan 2009 16:08:27 +0000 (18:08 +0200)]
Libtool 2.x support

15 years agoUpdated release documentation.
Pekka Riikonen [Sat, 10 Jan 2009 09:54:57 +0000 (11:54 +0200)]
Updated release documentation.

15 years agoFixed operation context NULLin in disconnect.
Pekka Riikonen [Fri, 9 Jan 2009 08:14:12 +0000 (10:14 +0200)]
Fixed operation context NULLin in disconnect.

15 years agoTake stream reference correctly in packet error callback
Pekka Riikonen [Fri, 9 Jan 2009 05:33:55 +0000 (07:33 +0200)]
Take stream reference correctly in packet error callback

Reverted commit e5e28835f5f0c4c5b52f0449e75b7f1c03a37548

15 years agoRemove possible packet error timeouts in EOS callback
Pekka Riikonen [Thu, 8 Jan 2009 20:32:47 +0000 (22:32 +0200)]
Remove possible packet error timeouts in EOS callback

15 years agoAdded debug logs for updating stat.clients value
Pekka Riikonen [Thu, 8 Jan 2009 19:58:39 +0000 (21:58 +0200)]
Added debug logs for updating stat.clients value

15 years agoFixed libtool installation: always use --mode=install silc.server.1.1.15 silc.toolkit.1.1.9
Pekka Riikonen [Thu, 8 Jan 2009 14:25:04 +0000 (16:25 +0200)]
Fixed libtool installation: always use --mode=install

15 years agofix.pl: support for new perl
Pekka Riikonen [Thu, 8 Jan 2009 13:58:57 +0000 (15:58 +0200)]
fix.pl: support for new perl

15 years agoRemoved libtoolfix
Pekka Riikonen [Thu, 8 Jan 2009 12:35:48 +0000 (14:35 +0200)]
Removed libtoolfix

15 years agoDocumented public_ip field
Pekka Riikonen [Thu, 8 Jan 2009 09:31:48 +0000 (11:31 +0200)]
Documented public_ip field

15 years agoMerge branch 'topic/detach-fixes' of git://valera-ext.nynaeve.net/silc into silc...
Pekka Riikonen [Thu, 8 Jan 2009 09:20:01 +0000 (11:20 +0200)]
Merge branch 'topic/detach-fixes' of git://valera-ext.nynaeve.net/silc into silc.1.1.branch

15 years agoPacket engine: more padding length check fixes
Pekka Riikonen [Tue, 16 Dec 2008 15:17:58 +0000 (17:17 +0200)]
Packet engine: more padding length check fixes

The padding length must be checked differently depending on whether the
packet is fully encrypted with session key or if only the header is
encrypted with session key (fe. channel messages).

15 years agoDon't decrement my_clients when killing or expiring a detached client.
Skywing [Sat, 13 Dec 2008 21:27:48 +0000 (16:27 -0500)]
Don't decrement my_clients when killing or expiring a detached client.

This prevents my_clients from getting out of sync when a detached
client is forcibly removed, fixing a regression.

15 years agoMerge branch 'topic/format-cleanup' of git://valera-ext.nynaeve.net/silc into silc...
Pekka Riikonen [Sat, 13 Dec 2008 20:30:25 +0000 (22:30 +0200)]
Merge branch 'topic/format-cleanup' of git://valera-ext.nynaeve.net/silc into silc.1.1.branch

15 years agoMerge branch 'topic/detach-fixes' of git://valera-ext.nynaeve.net/silc into silc...
Pekka Riikonen [Sat, 13 Dec 2008 20:02:18 +0000 (22:02 +0200)]
Merge branch 'topic/detach-fixes' of git://valera-ext.nynaeve.net/silc into silc.1.1.branch

15 years agoCleanup: limit length of strings scanned by scanf.
Kp [Sat, 13 Dec 2008 18:37:39 +0000 (12:37 -0600)]
Cleanup: limit length of strings scanned by scanf.

Several uses of scanf-type functions allowed the scanned string to
supply an arbitrarily large input string.  Add length qualifiers to
prevent scanf from overrunning the supplied buffer.

15 years agoCleanup: fix long/int format string errors.
Kp [Sun, 7 Dec 2008 21:48:48 +0000 (15:48 -0600)]
Cleanup: fix long/int format string errors.

Two format strings used long values with int format specifiers.
Fix the format specifiers so that the entire value can be printed.

15 years agoFix error logging format string mangled by a bogus comma.
Kp [Mon, 8 Dec 2008 00:24:33 +0000 (18:24 -0600)]
Fix error logging format string mangled by a bogus comma.

A format string was split over two lines, with the second line
containing the format specifier that prints the channel name.  A comma
was incorrectly appended to the first line, causing the format specifier
substring to become an argument string.  Since no format specifiers
remain in the main string, the logger does not format any arguments.
Remove the bogus comma to fix that.

15 years agoCleanup: fix various int/long format string errors.
Kp [Mon, 8 Dec 2008 00:59:23 +0000 (18:59 -0600)]
Cleanup: fix various int/long format string errors.

Various format strings used int values with long format specifiers.
Fix the format specifiers to be consistent with the values supplied.

15 years agoCleanup: cast socket to long before logging it.
Kp [Sun, 7 Dec 2008 21:46:47 +0000 (15:46 -0600)]
Cleanup: cast socket to long before logging it.

The SilcSocket type varies in size, depending on the host platform.  On
Unix systems, it is an int, which is 32-bits on all interesting
platforms.  On Windows, it is a SOCKET, which is also 32-bits.  However,
on Symbian, SilcSocket is a void pointer.  Changing %lu to %u may not
work in all cases due to this size difference, so instead cast the
socket to a long unsigned, which should avoid loss of precision on all
platforms and still satisfy the %lu format specifier.

15 years agoFix missing argument in SKR debug logging.
Kp [Sun, 7 Dec 2008 21:49:36 +0000 (15:49 -0600)]
Fix missing argument in SKR debug logging.

The format string used in SKR debug logging calls for a pointer and two
int values.  However, only the two int values were provided, so the
debug logs would be wrong if they were ever printed.  Based on context,
the format string probably wanted the SilcSKRKey.  Add it.

15 years agoFix missing argument in client_entry.c debug logging.
Kp [Sun, 7 Dec 2008 22:04:56 +0000 (16:04 -0600)]
Fix missing argument in client_entry.c debug logging.

Logging modifications during merge commit
e9374395ec9747bddd3ea0bfd3e5a17717e97b31 resulted in several log
messages that purport to print a pointer, but do not push one for the
logging code to format.  Add the pointer that was clearly meant in each
case.

15 years agoFix missing argument in silc_client_abort_key_agreement debug logging.
Kp [Sun, 7 Dec 2008 22:35:05 +0000 (16:35 -0600)]
Fix missing argument in silc_client_abort_key_agreement debug logging.

The debug log in silc_client_abort_key_agreement purports to print a
pointer, but does not push one for the logging code to format.  Fix
that, and extend the message to print some other values that might be
interesting.

15 years agoHTTP: fix stack overwrite due to format string error.
Kp [Sat, 13 Dec 2008 03:38:54 +0000 (21:38 -0600)]
HTTP: fix stack overwrite due to format string error.

On AMD64, %lu refers to a 64-bit unsigned value, but the address passed
to sscanf points to a 32-bit unsigned value.  This causes an adjoining
value on the stack to be overwritten with data from the converted
integer.  Fix the format string to match the size of the supplied value,
and remove the pointer cast.

15 years agoID Cache: Fixed destructor callback calling.
Pekka Riikonen [Sat, 13 Dec 2008 19:48:04 +0000 (21:48 +0200)]
ID Cache: Fixed destructor callback calling.

The destructor context given to the ID cache destructor callback was wrong
which caused odd crashes.

15 years agoPacket engine: do not do the padding length check for CTR mode.
Pekka Riikonen [Sat, 13 Dec 2008 19:27:01 +0000 (21:27 +0200)]
Packet engine: do not do the padding length check for CTR mode.

15 years agoCancel future rekeys on a detaching client connection.
Skywing [Sat, 13 Dec 2008 19:15:15 +0000 (14:15 -0500)]
Cancel future rekeys on a detaching client connection.

Previously, these wouldn't be cancelled properly, and might result in
some complaints from the SILC SKE library due to bad parameters.

15 years agoMerge branch 'topic/detach-fixes' of git://valera-ext.nynaeve.net/silc into silc...
Pekka Riikonen [Sat, 13 Dec 2008 19:13:21 +0000 (21:13 +0200)]
Merge branch 'topic/detach-fixes' of git://valera-ext.nynaeve.net/silc into silc.1.1.branch

15 years agoSend resume notifications to previous owner server when client resumes.
Skywing [Sat, 13 Dec 2008 18:43:25 +0000 (13:43 -0500)]
Send resume notifications to previous owner server when client resumes.

Previously, resume notifications were broadcast to all routers, but not
necessarily the original owner of a particular detached user.  This
caused various breakage when a user was previously homed at a plain
server and then resumed at a router server, as the users previous home
server would never have been properly notified about the resume.

15 years agoMerge branch 'topic/serverlink-fixes' of git://valera-ext.nynaeve.net/silc into silc...
Pekka Riikonen [Sat, 13 Dec 2008 16:18:20 +0000 (18:18 +0200)]
Merge branch 'topic/serverlink-fixes' of git://valera-ext.nynaeve.net/silc into silc.1.1.branch

Additional changes:

- Do not register packet error timeout multiple times
- Added padding length sanity checks to packet engine
- Removed old unused macros from silcd

15 years agoMerge branch 'topic/detach-fixes' of git://valera-ext.nynaeve.net/silc into silc...
Pekka Riikonen [Sat, 13 Dec 2008 15:56:31 +0000 (17:56 +0200)]
Merge branch 'topic/detach-fixes' of git://valera-ext.nynaeve.net/silc into silc.1.1.branch

15 years agoFix use-after-free condition when reconnecting silcd to router silcd.
Skywing [Fri, 12 Dec 2008 04:57:37 +0000 (23:57 -0500)]
Fix use-after-free condition when reconnecting silcd to router silcd.

This fixes a use-after-free bug wherein silcd can reuse the context on
the SilcPacketStream when we receive an EOS indication after the link
was terminated due to a timeout error.

15 years agoDon't count detached users in server local user count.
Skywing [Fri, 12 Dec 2008 04:22:04 +0000 (23:22 -0500)]
Don't count detached users in server local user count.

This commit decrements the count of users when a detach occurs, and
increments the count when a user re-attaches.

This is done as current silc routers have a bug where only a detached
users previous home server is not properly pro-actively notified of a
user resuming elsewhere unless the user resumes on a router server.

The issue with non-router-server resume notification will be fixed
seperately.  This change allows member servers to operate reliably in
the event that there is a router with the aforementioned bug in their
silcnet.

15 years agoUse primary router when sending WHOIS packet if client->router is NULL.
Skywing [Sun, 23 Nov 2008 18:54:12 +0000 (13:54 -0500)]
Use primary router when sending WHOIS packet if client->router is NULL.

client may be non-NULL, but client->router may be NULL when we enter
silc_server_query_client in the case of a detached client on a remote
server that has not been fully resolved yet.  In this case, we should
try and send the packet using the primary router.  This fixes a crash
wherein silc_server_query_client would sometimes crash with a NULL
dereference if called on a remote detached client.

15 years agoUse primary router when sending WHOIS packet if client->router is NULL.
Skywing [Sun, 23 Nov 2008 18:54:12 +0000 (13:54 -0500)]
Use primary router when sending WHOIS packet if client->router is NULL.

client may be non-NULL, but client->router may be NULL when we enter
silc_server_query_client in the case of a detached client on a remote
server that has not been fully resolved yet.  In this case, we should
try and send the packet using the primary router.  This fixes a crash
wherein silc_server_query_client would sometimes crash with a NULL
dereference if called on a remote detached client.

15 years agosilcd: disconnect packet errors with random timeout
Pekka Riikonen [Sun, 23 Nov 2008 10:58:28 +0000 (12:58 +0200)]
silcd: disconnect packet errors with random timeout

15 years agoPacket engine: moved packet sanity checks after MAC check
Pekka Riikonen [Sun, 23 Nov 2008 10:56:20 +0000 (12:56 +0200)]
Packet engine: moved packet sanity checks after MAC check

15 years agoRemoved extra semicolons from SILC_ASSERT and SILC_VERIFY macros
Pekka Riikonen [Sun, 23 Nov 2008 10:48:21 +0000 (12:48 +0200)]
Removed extra semicolons from SILC_ASSERT and SILC_VERIFY macros

15 years agoMerge branch 'master' of git://valera-ext.nynaeve.net/silc into silc.1.1.branch
Pekka Riikonen [Sat, 22 Nov 2008 16:14:35 +0000 (18:14 +0200)]
Merge branch 'master' of git://valera-ext.nynaeve.net/silc into silc.1.1.branch

Code cleanup during merge.

Reverted External IP commit

Reverted changes to silcsocketstream API.  The user context can be now
set to SilcClientConnectionParams.  Increased shared library revision to
avoid backwards incompatiblity.

Signed-off-by: Pekka Riikonen <priikone@silcnet.org>
15 years agoCancel silc_server_connect_to_router_retry when connecting.
Skywing [Sat, 22 Nov 2008 04:57:32 +0000 (23:57 -0500)]
Cancel silc_server_connect_to_router_retry when connecting.

There exists a crash bug such that an un-cancelled timeout callback for
silc_server_connect_to_retry fires after the connection object has
already been cleaned up.  Any router_retry requests must be cancelled
when we are deleting the associated connect object.  The fix that was
implemented was to cancel silc_server_connect_to_router_retry in
addition to silc_server_connect_to_router when a call to
silc_server_create_connections is made.  (This routine is called when
we are to make new server connections if reconnects are enabled.)

The problem would typically occur after a long enough time with silcd
trying to connect to a router server over and over; there is a race
condition component that can delay the initial use-after-free condition
for some time.

15 years agoMark outbound initiated server to server connections as local.
Skywing [Sat, 22 Nov 2008 02:24:07 +0000 (21:24 -0500)]
Mark outbound initiated server to server connections as local.

This fixes an issue where if a disconnect packet is received by the
server for an outbound silc connection (i.e. a server to server link)
and there is an outstanding async operation, such as an SKE or
connection auth, the server will corrupt the heap due to not properly
calling the async abort routine.

This issue would typically happen when we have a silcd setup to connect
to a remote router server, where both ends of the connection have public
keys configured, but the initiator server's IP is wrong.  In this case,
we will get past key exchange and then fail at the connection auth
packet, typically crashing the initiator silcd after heap corruption.

15 years agoMerge branch 'master' of git://valera-ext.nynaeve.net/silc
Skywing [Sat, 22 Nov 2008 00:38:40 +0000 (19:38 -0500)]
Merge branch 'master' of git://valera-ext.nynaeve.net/silc