silc.git
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

15 years agoPrevent continuing of an already finished FSM.
Skywing [Sun, 9 Nov 2008 04:07:36 +0000 (23:07 -0500)]
Prevent continuing of an already finished FSM.

Another fix for another crash relating to misuse of FSM and callback logic in
the SKE library.

15 years agoFix crash on SKE failure.
Skywing [Sun, 9 Nov 2008 02:19:03 +0000 (21:19 -0500)]
Fix crash on SKE failure.

Adds checks to prevent SKE failure notification callbacks from being called
multiple times for the same SKE instance.  This would often happen, for
example, if we aborted an SKE.

15 years agoFix crash on expired keyboard prompts
Skywing [Sat, 8 Nov 2008 22:54:03 +0000 (17:54 -0500)]
Fix crash on expired keyboard prompts

15 years agoAdd reference counting to SilcClientEntry/SilcServerEntry for getkey response.
Skywing [Sat, 28 Jun 2008 05:21:51 +0000 (00:21 -0500)]
Add reference counting to SilcClientEntry/SilcServerEntry for getkey response.

This is necessary in case the entry goes away before the user responds to the
keyboard input request.  (Fix for getkey crash if a user logs off before one
responds to the getkey prompt.)

15 years agoFix initialization/deinitialization of various Silc*Entry objects.
Skywing [Sat, 28 Jun 2008 05:12:18 +0000 (00:12 -0500)]
Fix initialization/deinitialization of various Silc*Entry objects.

A number of init/deinit cases were failing to clean up
certain resources.

15 years agoFix reference counting for SilcServerEntry objects,
Skywing [Sat, 28 Jun 2008 04:44:03 +0000 (23:44 -0500)]
Fix reference counting for SilcServerEntry objects,

analogous to the previous fixes for the broken
reference counting for SilcChannelEntry and
SilcClientEntry objects.

15 years agoAdd support for autosendcmd on channel entries to the
Skywing [Fri, 27 Jun 2008 05:18:01 +0000 (00:18 -0500)]
Add support for autosendcmd on channel entries to the

SILC client.  Note that we don't support botmasks yet,
but this can be used to send a command on join of a
channel on connect/reconnect/reattach detached session.

15 years agoAssert that the client count is positive prior to decrementing it.
Kp [Fri, 4 Jul 2008 18:06:00 +0000 (13:06 -0500)]
Assert that the client count is positive prior to decrementing it.

A situation has been observed where a silcd has clients connected to it,
but reports 0 local users.  It is believed that when these users log
off, the server underflows and refuses new connections.  Assert that no
underflow occurs, which should prove or disprove this theory.

15 years agoAdd ``ExternalIp'' config directive to ServerInfo tag in
Skywing [Fri, 27 Jun 2008 05:16:37 +0000 (00:16 -0500)]
Add ``ExternalIp'' config directive to ServerInfo tag in

silcd.conf.  This allows server linking with a server
behind a NAT connecting out to a router.

15 years agoFix reference counting for key exchange handling.
Kp [Sat, 28 Jun 2008 05:28:25 +0000 (00:28 -0500)]
Fix reference counting for key exchange handling.

When a key exchange times out, the SKE can be freed before the user
responds.  Switch the SKE callbacks to obtain their own reference to the
object to prevent this.

15 years agoPrevent continuing of an already finished FSM.
Skywing [Sun, 9 Nov 2008 04:07:36 +0000 (23:07 -0500)]
Prevent continuing of an already finished FSM.

Another fix for another crash relating to misuse of FSM and callback logic in
the SKE library.

15 years agoFix crash on SKE failure.
Skywing [Sun, 9 Nov 2008 02:19:03 +0000 (21:19 -0500)]
Fix crash on SKE failure.

Adds checks to prevent SKE failure notification callbacks from being called
multiple times for the same SKE instance.  This would often happen, for
example, if we aborted an SKE.

15 years agoRevert "Don't delete packet stream"
Skywing [Sun, 9 Nov 2008 02:05:06 +0000 (21:05 -0500)]
Revert "Don't delete packet stream"

This reverts commit 544d0faa279dc3a3ca8f635665bd2cb57e92342b.

15 years agoDon't delete packet stream
Skywing [Sat, 8 Nov 2008 23:46:02 +0000 (18:46 -0500)]
Don't delete packet stream

15 years agoFix crash on expired keyboard prompts
Skywing [Sat, 8 Nov 2008 22:54:03 +0000 (17:54 -0500)]
Fix crash on expired keyboard prompts

15 years agoAdd reference counting to SilcClientEntry/SilcServerEntry for getkey response.
Skywing [Sat, 28 Jun 2008 05:21:51 +0000 (00:21 -0500)]
Add reference counting to SilcClientEntry/SilcServerEntry for getkey response.

This is necessary in case the entry goes away before the user responds to the
keyboard input request.  (Fix for getkey crash if a user logs off before one
responds to the getkey prompt.)

15 years agoFix initialization/deinitialization of various Silc*Entry objects.
Skywing [Sat, 28 Jun 2008 05:12:18 +0000 (00:12 -0500)]
Fix initialization/deinitialization of various Silc*Entry objects.

A number of init/deinit cases were failing to clean up
certain resources.

15 years agoFix reference counting for SilcServerEntry objects,
Skywing [Sat, 28 Jun 2008 04:44:03 +0000 (23:44 -0500)]
Fix reference counting for SilcServerEntry objects,

analogous to the previous fixes for the broken
reference counting for SilcChannelEntry and
SilcClientEntry objects.

15 years agoAdd support for autosendcmd on channel entries to the
Skywing [Fri, 27 Jun 2008 05:18:01 +0000 (00:18 -0500)]
Add support for autosendcmd on channel entries to the

SILC client.  Note that we don't support botmasks yet,
but this can be used to send a command on join of a
channel on connect/reconnect/reattach detached session.

15 years agoAssert that the client count is positive prior to decrementing it.
kp@valhallalegends.com [Fri, 4 Jul 2008 18:06:00 +0000 (13:06 -0500)]
Assert that the client count is positive prior to decrementing it.

A situation has been observed where a silcd has clients connected to it,
but reports 0 local users.  It is believed that when these users log
off, the server underflows and refuses new connections.  Assert that no
underflow occurs, which should prove or disprove this theory.

15 years agoAdd ``ExternalIp'' config directive to ServerInfo tag in
Skywing [Fri, 27 Jun 2008 05:16:37 +0000 (00:16 -0500)]
Add ``ExternalIp'' config directive to ServerInfo tag in

silcd.conf.  This allows server linking with a server
behind a NAT connecting out to a router.

15 years agoFix reference counting for key exchange handling.
kp@valhallalegends.com [Sat, 28 Jun 2008 05:28:25 +0000 (00:28 -0500)]
Fix reference counting for key exchange handling.

When a key exchange times out, the SKE can be freed before the user
responds.  Switch the SKE callbacks to obtain their own reference to the
object to prevent this.

15 years agoFixed channel MAC key setting in JOIN notify and command reply silc.client.1.1.6 silc.server.1.1.14 silc.toolkit.1.1.8
Pekka Riikonen [Sat, 25 Oct 2008 13:58:50 +0000 (16:58 +0300)]
Fixed channel MAC key setting in JOIN notify and command reply

In JOIN notify when MAC algo changes wrong key was set to the new MAC.

In JOIN command reply in backup router the channel key may not be set
in command reply because backup reiceives also CHANNEL_KEY packet from
router and hence clients receive it too, but new MAC context was still
allocated in the command reply, hence using empty MAC without key with
channel messages.

15 years agosilcd: fixed memory leaks
Pekka Riikonen [Wed, 22 Oct 2008 19:22:00 +0000 (22:22 +0300)]
silcd: fixed memory leaks

15 years agoMerge branch 'topic/mm-fixes' of git://208.110.73.182/silc into silc.1.1.branch silc.server.1.1.13
Pekka Riikonen [Wed, 24 Sep 2008 15:18:30 +0000 (18:18 +0300)]
Merge branch 'topic/mm-fixes' of git://208.110.73.182/silc into silc.1.1.branch

Signed-off-by: Pekka Riikonen <priikone@silcnet.org>
15 years agoDisconnect problem: Mark incoming connections immediately local
Pekka Riikonen [Wed, 24 Sep 2008 14:56:56 +0000 (17:56 +0300)]
Disconnect problem: Mark incoming connections immediately local

This fixes the problem of SKE remaining running in the background
even though the conncection is closed because it was never aborted
because the connection wasn't marked local.  After SKE timeout a
crash may occur.

15 years agoFixed more backup router reconnecting problems
Pekka Riikonen [Wed, 24 Sep 2008 13:53:38 +0000 (16:53 +0300)]
Fixed more backup router reconnecting problems

Fixed also possible buffer overflows.

15 years agoFixed server/backup router reconnecting
Pekka Riikonen [Wed, 24 Sep 2008 05:46:28 +0000 (08:46 +0300)]
Fixed server/backup router reconnecting

15 years agoDocumented public_ip configuration option silc.server.1.1.12
Pekka Riikonen [Sat, 13 Sep 2008 17:54:45 +0000 (20:54 +0300)]
Documented public_ip configuration option

15 years agoFixed backup router shutdown crash
Pekka Riikonen [Sat, 13 Sep 2008 12:49:23 +0000 (15:49 +0300)]
Fixed backup router shutdown crash

15 years agoSKE: Verify initiator's public key always
Pekka Riikonen [Sat, 13 Sep 2008 12:45:53 +0000 (15:45 +0300)]
SKE: Verify initiator's public key always

We used to verify initiator's public key only if we were doing mutual
authentication.  We now verify it always because calling application
may need the public key initiator sent.

15 years agoMerge branch 'topic/code-cleanup' of git://208.110.73.182/silc into silc.1.1.branch
Pekka Riikonen [Thu, 11 Sep 2008 15:47:55 +0000 (18:47 +0300)]
Merge branch 'topic/code-cleanup' of git://208.110.73.182/silc into silc.1.1.branch

15 years agoMerge branch 'topic/null-fixes' of git://208.110.73.182/silc into silc.1.1.branch
Pekka Riikonen [Thu, 11 Sep 2008 15:41:51 +0000 (18:41 +0300)]
Merge branch 'topic/null-fixes' of git://208.110.73.182/silc into silc.1.1.branch

15 years agoMerge branch 'topic/type-safety' of git://208.110.73.182/silc into silc.1.1.branch
Pekka Riikonen [Thu, 11 Sep 2008 15:41:38 +0000 (18:41 +0300)]
Merge branch 'topic/type-safety' of git://208.110.73.182/silc into silc.1.1.branch

15 years agoFix reference count bug leading to memory corruption on duplicate deletions.
Skywing [Fri, 27 Jun 2008 23:13:59 +0000 (18:13 -0500)]
Fix reference count bug leading to memory corruption on duplicate deletions.

15 years agoMake packet stream reference counts 32 bits.
Skywing [Fri, 20 Jun 2008 22:37:21 +0000 (17:37 -0500)]
Make packet stream reference counts 32 bits.

15 years agoPacket streams: make packet handling callback pointers read only.
Kp [Sun, 1 Jun 2008 21:15:46 +0000 (16:15 -0500)]
Packet streams: make packet handling callback pointers read only.

The function pointers for the packet handling callbacks are never
modified, so make them read only.

15 years agoReorder #if 0/#endif block to avoid splitting a basic block across the #if 0.
Kp [Fri, 4 Jul 2008 18:03:11 +0000 (13:03 -0500)]
Reorder #if 0/#endif block to avoid splitting a basic block across the #if 0.

The bracing convention caused a #if 0/#endif to exclude the close of one
block and the open of another.  This compiled correctly, but confused
other tools that expect to see a block fully present or fully absent.
Move the ending brace of the preceding block out of the #if 0 and the
ending brace of the excluded block into the #if 0 to fix that.

15 years agoFix double free in silcd.
Skywing [Fri, 20 Jun 2008 21:19:32 +0000 (16:19 -0500)]
Fix double free in silcd.

15 years agoPacket streams: avoid double free if silc_id_id2str fails.
Kp [Sun, 1 Jun 2008 17:59:42 +0000 (12:59 -0500)]
Packet streams: avoid double free if silc_id_id2str fails.

In silc_packet_set_ids, the old ID is freed before silc_id_id2str is
called.  If silc_id_id2str fails, then silc_packet_set_ids returns
without resetting the ID pointer.  The pointer is then free, but not
NULL.  When the packet stream is destroyed, silc_packet_stream_destroy
will free the pointer again.  Reset the ID pointer to NULL immediately
after freeing it to prevent this.

15 years agoPacket streams: fix memory leak on dlist allocation failure.
Kp [Sun, 1 Jun 2008 17:25:50 +0000 (12:25 -0500)]
Packet streams: fix memory leak on dlist allocation failure.

If silc_dlist_init fails to allocate a SilcDList for stream->process,
then silc_packet_stream_link_va leaks the newly allocated
SilcPacketProcess.  Fix that by calling silc_free(p) on the error path.

15 years agoASN1: Fix NULL pointer dereference on stack allocation failure.
Kp [Sat, 31 May 2008 04:31:07 +0000 (23:31 -0500)]
ASN1: Fix NULL pointer dereference on stack allocation failure.

If the second silc_stack_alloc fails, then asn1->stack2 is NULL.  Thus,
when silc_asn1_init calls silc_stack_free(asn1->stack2), it is
equivalent to silc_stack_free(NULL).  However, silc_stack_free does not
check for a NULL pointer.  Fix silc_asn1_init to free asn1->stack1, as
was intended.

15 years agoAvoid NULL dereference when leaving a channel with a private key.
Kp [Fri, 25 Apr 2008 03:18:27 +0000 (22:18 -0500)]
Avoid NULL dereference when leaving a channel with a private key.

Split out a patch from Skywing <skywing@valhallalegends.com> to fix a
NULL pointer dereference when the client leaves a +k channel and the
local user had set a key for the channel.

15 years agoASN1: Fix stack variable overwrite when encoding OID.
Kp [Sat, 31 May 2008 21:37:45 +0000 (16:37 -0500)]
ASN1: Fix stack variable overwrite when encoding OID.

The call to sscanf specifies a format string of "%lu", a long unsigned
int.  The pointer argument was cast to unsigned long *, but this is
wrong for 64 bit systems.  On 64 bit systems, unsigned long is 64 bits,
but the oid value is a SilcUInt32 on all systems.  As a result, sscanf
will overwrite a neighboring variable on the stack.  Fix this by
changing the format string to "%u" and removing the cast.

15 years agoTypes: make SilcUInt32 an unsigned int in most cases.
Kp [Sun, 1 Jun 2008 04:57:51 +0000 (23:57 -0500)]
Types: make SilcUInt32 an unsigned int in most cases.

On typical 32-bit systems, both unsigned int and unsigned long are 32
bits wide.  However, they have different format specifiers, so they
cannot be used interchangeably.  On typical 64-bit systems, unsigned int
is 32 bits and unsigned long is 64 bits.  To allow for a more consistent
format string, reorder the type size checks so that SilcUInt32 is an
unsigned int on both 32 bit and 64 bit systems.

15 years agoType sanity: add compile time check that integers are of the expected size.
Kp [Sun, 1 Jun 2008 04:41:59 +0000 (23:41 -0500)]
Type sanity: add compile time check that integers are of the expected size.

The comments in silctypes.h guarantee that certain types are of
particular sizes.  Add compile time checks that will fail if these
guarantees are not met.

15 years agoServer: always drop privileges, even in foreground mode.
Kp [Sun, 13 Jul 2008 16:47:07 +0000 (11:47 -0500)]
Server: always drop privileges, even in foreground mode.

Foreground mode is often used as a debugging aid for live
configurations, so the server may be started with root privileges to let
it bind to its native port.  Since the server already has the ability to
drop root privileges, use that ability to make foreground mode a little
safer.

15 years agoHandle failed memory allocations in packet sending silc.client.1.1.5
Pekka Riikonen [Sun, 31 Aug 2008 07:58:11 +0000 (10:58 +0300)]
Handle failed memory allocations in packet sending

15 years agosilc_stack_free can now be called with NULL stack
Pekka Riikonen [Sun, 31 Aug 2008 06:58:49 +0000 (09:58 +0300)]
silc_stack_free can now be called with NULL stack

15 years agoHandle EAGAIN and EINTR correctly in silc_get_input in case of error
Pekka Riikonen [Sat, 30 Aug 2008 12:08:03 +0000 (15:08 +0300)]
Handle EAGAIN and EINTR correctly in silc_get_input in case of error

15 years agoMark client entry invalid when killed and when notified non-existing
Pekka Riikonen [Sat, 30 Aug 2008 11:15:49 +0000 (14:15 +0300)]
Mark client entry invalid when killed and when notified non-existing

15 years agoFixed command calling crash
Pekka Riikonen [Sat, 30 Aug 2008 11:14:45 +0000 (14:14 +0300)]
Fixed command calling crash

If command finishes synchronously the command context is not valid
anymore and cannot be accessed.  Reported by Sami Farin.

15 years agoChanged packet_error structure const correctly
Pekka Riikonen [Sat, 30 Aug 2008 11:12:33 +0000 (14:12 +0300)]
Changed packet_error structure const correctly

15 years agoFixed resuming to work even when there are no joined channels
Pekka Riikonen [Sat, 30 Aug 2008 11:12:00 +0000 (14:12 +0300)]
Fixed resuming to work even when there are no joined channels

15 years agoFixed channel private key deleting to restore original keys correctly
Pekka Riikonen [Sat, 30 Aug 2008 11:10:45 +0000 (14:10 +0300)]
Fixed channel private key deleting to restore original keys correctly

15 years agoResolve channel in INVITE notify if we don't have it yet
Pekka Riikonen [Sat, 30 Aug 2008 07:50:24 +0000 (10:50 +0300)]
Resolve channel in INVITE notify if we don't have it yet

Fixes bug that user cannot se INVITE notifications sent by other users.

15 years agoRemove client from expired client list before deleting it silc.server.1.1.11
Pekka Riikonen [Sun, 22 Jun 2008 14:42:40 +0000 (17:42 +0300)]
Remove client from expired client list before deleting it

15 years agoFixed the silc_parse_userqfdn argument handling, again.
Pekka Riikonen [Sun, 22 Jun 2008 13:56:36 +0000 (16:56 +0300)]
Fixed the silc_parse_userqfdn argument handling, again.

15 years agoFixed silc_parse_userfqdn argument check silc.server.1.1.10
Pekka Riikonen [Sun, 22 Jun 2008 08:04:37 +0000 (11:04 +0300)]
Fixed silc_parse_userfqdn argument check

15 years agoMake sure client entry is not expired more than once
Pekka Riikonen [Sun, 22 Jun 2008 08:03:58 +0000 (11:03 +0300)]
Make sure client entry is not expired more than once

15 years agoClose socket if TCP connecting fails to avoid leaking sockets silc.server.1.1.9
Pekka Riikonen [Mon, 9 Jun 2008 05:26:01 +0000 (08:26 +0300)]
Close socket if TCP connecting fails to avoid leaking sockets

15 years agoAdd non-executing stack when compiling AES asm for GNU/ELF.
Pekka Riikonen [Mon, 9 Jun 2008 05:18:33 +0000 (08:18 +0300)]
Add non-executing stack when compiling AES asm for GNU/ELF.

Patch by Kp <kp@valhallalegends.com>bg

Signed-off-by: Pekka Riikonen <priikone@silcnet.org>
15 years agoFixed automatic reconnection to router and malloc failure handlings
Pekka Riikonen [Mon, 9 Jun 2008 05:11:20 +0000 (08:11 +0300)]
Fixed automatic reconnection to router and malloc failure handlings

If remote router disconnects while still being in Unkonwn state reconnect
to the router after disconnecting.  This should prevent the bugs where
server doesn't reconnect to router after being disconnected at the early
connection state.

Fixed various memory allocation failure handlings.

15 years agoFree sock user data before disconnecting remote peer
Pekka Riikonen [Fri, 6 Jun 2008 05:26:04 +0000 (08:26 +0300)]
Free sock user data before disconnecting remote peer