Merged silc_1_1_branch to trunk.
authorPekka Riikonen <priikone@silcnet.org>
Sun, 1 Jul 2007 16:41:58 +0000 (16:41 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 1 Jul 2007 16:41:58 +0000 (16:41 +0000)
136 files changed:
CHANGES
Makefile.ad
Makefile.defines_int.in
README.DIST
README.PLUGIN
apps/Makefile.ad
apps/autodist/CHANGES
apps/autodist/autodist.in
apps/autodist/autodist.spec.in [new file with mode: 0644]
apps/autodist/doc/autodist.1.in
apps/autodist/doc/autodist.texi
apps/irssi/Makefile.am
apps/irssi/configure.ad
apps/irssi/configure.in
apps/irssi/docs/Makefile.am
apps/irssi/docs/help/Makefile.am.gen
apps/irssi/docs/help/in/cmode.in
apps/irssi/docs/help/in/cumode.in
apps/irssi/docs/help/in/key.in
apps/irssi/irssi.spec.in [deleted file]
apps/irssi/scripts/Makefile.am
apps/irssi/scripts/examples/Makefile.am
apps/irssi/silc-client.spec.in [new file with mode: 0644]
apps/irssi/src/Makefile.am
apps/irssi/src/core/Makefile.am
apps/irssi/src/core/modules-load.c
apps/irssi/src/fe-common/silc/Makefile.am
apps/irssi/src/fe-common/silc/fe-common-silc.c
apps/irssi/src/fe-common/silc/fe-silc-messages.c
apps/irssi/src/fe-text/Makefile.am
apps/irssi/src/perl/Makefile.am
apps/irssi/src/silc/core/Makefile.am
apps/irssi/src/silc/core/client_ops.c
apps/irssi/src/silc/core/clientutil.c
apps/irssi/src/silc/core/silc-core.c
apps/irssi/src/silc/core/silc-servers.c
apps/silcd/command.c
apps/silcd/command_reply.c
apps/silcd/idlist.c
apps/silcd/idlist.h
apps/silcd/packet_receive.c
apps/silcd/server.c
apps/silcd/server.h
apps/silcd/server_backup.c
apps/silcd/server_http.c
apps/silcd/server_internal.h
apps/silcd/server_query.c
apps/silcd/server_query.h
apps/silcd/server_util.c
apps/silcd/server_util.h
apps/silcd/serverconfig.c
apps/silcd/serverconfig.h
apps/silcd/serverid.c
apps/silcd/silcd.c
configure.ad
distdir/autodist
distdir/autodist-post-process-dist [new file with mode: 0644]
distdir/client
distdir/common
distdir/default
distdir/pre-dist-client
distdir/pre-dist-toolkit
distdir/server
distdir/toolkit
doc/Makefile.ad
includes/silcsymbian.h
includes/silcversion.h.in
lib/configure.ad
lib/doc/LIBINDEX
lib/doc/command_reply_args.html
lib/doc/notifyargs.html
lib/doc/porting.html
lib/doc/silcclient_using.html
lib/silcapputil/silcapputil.c
lib/silcapputil/silcidcache.c
lib/silcapputil/silcidcache.h
lib/silcasn1/silcasn1_decode.c
lib/silcasn1/silcasn1_encode.c
lib/silcclient/client.c
lib/silcclient/client_connect.c
lib/silcclient/client_entry.c
lib/silcclient/command.c
lib/silcclient/command_reply.c
lib/silcclient/silcclient.h
lib/silcclient/silcclient_entry.h
lib/silccore/DIRECTORY
lib/silccore/README
lib/silccore/silcargument.c
lib/silccore/silcattrs.c
lib/silccore/silcnotify.c
lib/silccore/silcpacket.c
lib/silccore/silcpacket.h
lib/silccrypt/Makefile.ad
lib/silccrypt/ciphers.h
lib/silccrypt/configure.ad
lib/silccrypt/silccipher.c
lib/silccrypt/silcpkcs.c
lib/silcmath/configure.ad
lib/silcsftp/sftp_client.c
lib/silcsftp/sftp_fs_memory.c
lib/silcsim/Makefile.ad
lib/silcske/silcconnauth.c
lib/silcske/silcske.c
lib/silcske/silcske.h
lib/silcskr/silcskr.c
lib/silcutil/silcatomic.h
lib/silcutil/silcbuffer.h
lib/silcutil/silcbuffmt.c
lib/silcutil/silcdlist.h
lib/silcutil/silcfsm.c
lib/silcutil/silclist.h
lib/silcutil/silclog.c
lib/silcutil/silcmime.c
lib/silcutil/silcmutex.h
lib/silcutil/silcnet.h
lib/silcutil/silcschedule.c
lib/silcutil/silcschedule.h
lib/silcutil/silcschedule_i.h
lib/silcutil/silcstack.h
lib/silcutil/silcstringprep.c
lib/silcutil/silctime.c
lib/silcutil/stacktrace.c
lib/silcutil/tests/test_silcschedule.c
lib/silcutil/tests/test_silctime.c
lib/silcutil/unix/silcunixnet.c
lib/silcutil/unix/silcunixschedule.c
lib/silcutil/unix/silcunixthread.c
scripts/silcdoc/gen_index.php
silc-toolkit.spec.in [new file with mode: 0644]
symbian/bld.inf
symbian/silc.mmp
symbian/silc_static.mmp
tutorial/mybot/Makefile
tutorial/mybot/mybot.c
win32/libsilc/libsilc.def
win32/libsilc/libsilc.dsp

diff --git a/CHANGES b/CHANGES
index 0e0d89aa745d4ff3fd844bd0471abbf6913494c1..c5f1ab5111d546ea09568ecaad423ac39a62ea4f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,294 @@
+Sun Jul  1 19:15:15 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * SILC Server 1.1 Beta1.
+
+Sun Jul  1 12:40:06 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Added support for rekey with PFS when using CTR mode
+         encryption.  Affected file is lib/silcske/silcske.c.
+
+       * Added silc_idcache_move that can be used to move entries
+         between caches.  Affected files are
+         lib/silcapputil/silcidcache.[ch].
+
+       * Added better checks for invalid argument and notify payloads.
+         Affected files are lib/silccore/silcnotify.c and
+         silcargument.c.
+
+       * Fixed SILC_PACKET_FLAG_LONG_PAD bitmask value.  Affected
+         file lib/silccore/silcpacket.h.
+
+Sat Jun 30 21:48:08 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Set the destination ID to packet stream as SKE responder
+         if ID was present in key exchange packet.  Affected file
+         is lib/silcske/silcske.[ch].
+
+       * Handle also zero timeouts in the scheduler notify callback
+         to avoid problems with SILC Plugin.  Affected file is
+         apps/irssi/src/silc/core/silc-core.c.
+
+Thu Jun 28 19:19:13 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * SILC Client 1.1.1.
+
+Sun Jun 24 18:47:55 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * SILC Toolkit 1.1.1.
+
+       * Compile sources with _GNU_SOURCE on Linux systems.  Affected
+         file is configure.ad.
+
+Sun Jun 24 16:33:59 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed Unix signal task dispatching to not lock the signals
+         when dispatching the callback to avoid deadlocks.  Affected
+         file is lib/silcutil/unix/silcunixschedule.c.
+
+Sun Jun 24 14:43:21 CEST 2007  Jochen Eisinger <coffee@silcnet.org>
+
+       * Fix configure output for with-plugin.  Affected file is
+         apps/irssi/configure.ad
+
+Tue Jun 19 17:05:48 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Added SILC_VERSION macro for checking package versions at
+         compile time.  Affected files are configure.ad,
+         includes/silc.h.in and includes/silcversion.h.in.
+
+Mon Jun 18 23:47:22 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Use SILC_VERIFY to assert that silc_rwlock_wrlock can be
+         called only once per thread on Unix.  Affected file is
+         lib/silcutil/unix/silcunixthread.c.  Added same for mutex
+         as well.   Documented same on the API in 
+         lib/silcutil/silcmutex.h.
+
+       * Fixed USERS command reply write-lock unlocking.  Affected file
+         is lib/silcclient/command_reply.c.
+
+Mon Jun 18 08:14:26 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed silc_create_key_pair to check for valid identifier.
+         Affected file is lib/silcapputil/silcapputil.c.
+
+Sun Jun 17 20:08:26 CEST 2007  Jochen Eisinger <coffee@silcnet.org>
+
+       * Rewrite signed public message handling, adopting the new
+         hilight interface.  Affected file is
+         apps/irssi/src/fe-common/silc/fe-silc-messages.c
+
+Thu Jun 14 21:15:31 CEST 2007  Jochen Eisinger <coffee@silcnet.org>
+
+       * Fix off by one error when loading modules.  Affected file is
+         apps/irssi/src/core/modules-load.c
+
+       * Don't delete hilight entry (because it's just a pointer, not a
+         copy).  Affected file is 
+         apps/irssi/src/fe-common/silc/fe-silc-messages.c
+
+Mon Jun 11 22:10:17 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Added __SILC_TOOLKIT_x_x_x macro to all Toolkit distribution
+         which can be used to check for Toolkit version in third-party
+         software.  Affected file is configure.ad, includes/silc.h.in.
+
+Sun Jun 10 17:32:15 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Added support for channel@server channel name strings to
+         client library (SILC protocol version 1.3 change).  Affected
+         files are lib/silcclient/silcclient_entry.h, client_entry.c.
+
+       * Added full_nicknames and full_channel_names settings to
+         SilcClientParams that can be used to specify whether client
+         library returns full nickname and channel name strings.
+         Full strings are nick@server and channel@server.  Affected
+         file is lib/silcclient/client_entry.c and command.c.
+
+Sat Jun  9 19:43:25 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed unix connecting failure to return error code correctly.
+         Affected file is lib/silcutil/unix/silcunixnet.c.
+
+Fri Jun  8 23:32:33 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed SKE timeout double free crash.  Affected file is
+         lib/silcske/silcske.c.
+
+       * Fixed MIME multipart decoding buffer overflow.  Affected file
+         is lib/silcutil/silcmime.c.  Thanks to Matt Miller for patch.
+
+Fri Jun  8 18:39:34 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed connection auth protocol timeout crash.  Affected
+         file is lib/silcske/silconnauth.c.
+
+       * Fixed FSM machine finishing to check for existing threads
+         at the final free callback to allow time for the threads to
+         finish.  Affected file lib/silcutil/silcfsm.c.
+
+Thu Jun  7 21:25:31 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed silc_client_get_clients_local to check the nick's
+         server also if nick@server nickname string is given to the
+         function.  Affected file is lib/silcclient/client_entry.c.
+
+Wed Jun  6 18:33:05 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Added notify callback to silc_schedule_init which can be used to 
+         set a notify callback for scheduler which is called when task is
+         added to scheduler or deleted from scheduler.  Affected file
+         is lib/silcutil/silcschedule.[ch].
+
+       * Dispatch timeout tasks after dispatching FD tasks if the timeout
+         was very short.  Affected file is lib/silcutil/silcschedule.c.
+
+       * Rewrote the SILC scheduler handling in SILC Client to not poll
+         every few msecs but to use the new notify callback.  Affected 
+         file is apps/irssi/src/silc/core/silc-core.c.
+
+       * Fixed SFTP client library read buffer size which was too small.
+         Affected file is lib/silcsftp/sftp_client.c.
+
+       * Fixed file transfer crash bug in /QUIT in SILC Client.  Close
+         the FTP sessions before quitting the client.  Affected file
+         is apps/irssi/src/silc/core/silc-servers.c.
+
+Tue Jun  5 20:48:40 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed silc_packet_get_ids to decode the IDs correctly.
+         Affected file is lib/silccore/silcpacket.c.
+
+       * Fixed silc_client_get_clients_local to parse correctly nickname
+         string that may have server name in it (nick@server) regardless
+         whether it was formatted nickname or not.  Affected file is
+         lib/silcclient/client_entry.c.
+
+Mon Jun  4 22:02:53 CEST 2007  Jochen Eisinger <jochen@penguin-breeder.org>
+
+       * Only destroy sendbuffers, if they still exist (they cease to
+         exist during /upgrade).  Affected file is
+         apps/irssi/src/silc/core/silc-servers.c
+
+Mon Jun  4 21:24:17 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Removed --enable-silc-plugin.  Added --with-silc-plugin.
+         Affected files are configure.ad, lib/configure.ad,
+         apps/irssi/configure.ad, apps/irssi/configure.in,
+         apps/irssi/scripts/Makefile.am,
+         apps/irssi/scripts/examples/Makefile.am,
+         apps/irssi/src/silc/core/silc/Makefile.am,
+         apps/irssi/src/fe-common/silc/Makefile.am.
+
+Mon Jun  4 08:35:59 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * SILC Client 1.1.
+
+Sun Jun  3 14:00:09 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed DESTDIR handling in make install.
+
+Sat Jun  2 21:04:32 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * SIM modules are not delivered to SILC CLient distribution
+         anymore.
+
+       * Changed default installation path from /usr/local/silc to
+         /usr/local for all distributions.
+
+       * Removed --with-etcdir and --with-docdir.  The etcdir is now
+         the system's default.  The Docdir is system's default.
+
+Sat Jun  2 00:51:57 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * If public key/private key loading fails set the return
+         pointer to NULL.  Affected file is lib/silccrypt/silcpkcs.c.
+
+       * If private key loading fails in silc_load_key_pair free the
+         loaded public key.  Affected file is
+         lib/silcapputil/silcapputil.c.
+
+       * Fixed key pair loading crash with SILC Plugin if key pair
+         loading fails.  Affected file is
+         apps/irssi/src/silc/core/silc-core.c.
+
+       * Fixed SILC Client help and script file installation path
+         to go to prefix/share/silc.  Affected files are
+         apps/irssi/src/scripts/Makefile.am and
+         apps/irssi/docs/help/Makefile.am.gen.
+
+Thu May 31 16:49:13 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed UTC offset minutes to be actually minutes.  Affected
+         file is lib/silcutil/silctime.c.
+
+Thu May 31 09:40:56 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * SILC Toolkit 1.1.
+
+       * Added support for checking for timezone and tm_gmtoff.
+         Affected files are configure.ad and lib/silcutil/silctime.c.
+
+Wed May 30 18:46:34 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Added silc-toolkit.spec.in RPM spec file.
+
+Mon May 28 23:21:39 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed nickname formatting crash when updating existing
+         client entry.  Affected file is lib/silcclient/client_entry.c.
+
+       * Fixed MIME object encoding in attribute payload encoding.
+         Affected file is lib/silccore/silcattrs.c.
+
+Mon May 28 09:02:26 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * SILC Client 1.1 Beta6
+
+Sun May 27 20:38:30 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Copy SILC Plugin's libfe_common_silc.so to libfe_silc.so so
+         that user's don't have to do it manually.  Affected file
+         is apps/irssi/src/fe-common/silc/core/Makefile.am.
+
+Thu May 24 15:30:31 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * SILC Toolkit 1.1 Beta4.
+
+       * Fixed channel and server entry freeing in client library.
+         Affected file is lib/silcclient/client_entry.c.
+
+       * Do not allow stopping client before it has been started.
+         Affected file is lib/silcclient/client.c.
+
+Wed May 23 23:21:03 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed formatted nickname renaming to rename also irssi's
+         nicklist (/NAMES etc).  Affected file is
+         apps/irssi/src/silc/core/client_ops.c.
+
+       * Fixed SILC Plugin crash when stopping client library before
+         it has been started.  Affected file is
+         apps/irssi/src/silc/core/silc-core.c.
+
+Tue May 22 17:18:54 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * For SILC Client and SILC Server check for 1.1 Toolkit
+         in configure.  Affected file is configure.ad.
+
+       * Added better library linking flags and orders for SILC Client.
+         Affected file is configure.ad, Makefile.defines_int.in and
+         apps/irssi/src/fe-text/Makefile.am
+
+Mon May 21 08:26:38 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * SILC Client 1.1 Beta5.
+
+Sun May 20 18:34:22 CEST 2007  Jochen Eisinger <coffee@silcnet.org>
+
+       * Add hooks for Irssi 0.8.11 module functions.  Affected file
+         is apps/irssi/src/fe-common/silc/fe-common-silc.c
+
 Sat May 19 14:46:36 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
 
        * Fixed passphrase authentication with server.  Affected file
index 8ba32eff7a25b0785d28307c2fe9309eaae26bce..e7dacff6ace2a8de2956e5997ad740dd20415011 100644 (file)
@@ -37,6 +37,7 @@ SUBDIRS =             \
 EXTRA_DIST =           \
        silcdefs.h.in   \
 #ifdef SILC_DIST_TOOLKIT
+       silc-toolkit.spec \
        symbian         \
 #endif SILC_DIST_TOOLKIT
 #ifdef SILC_DIST_CLIENT
index 817ec5fec0e8990c7f298f01f3152ca6811fe5aa..8d639153c575d373b8e57a9bed8c4e411996137f 100644 (file)
@@ -3,7 +3,7 @@
 #
 #  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 - 2005 Pekka Riikonen
+#  Copyright (C) 2000 - 2007 Pekka Riikonen
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -29,7 +29,8 @@ silc_install_prefix=@prefix@
 #
 # Common libraries that are linked against the created executable
 #
-SILC_COMMON_LIBS= -L$(silc_top_srcdir)/lib -lsilc @LIBS@
+SILC_COMMON_LDFLAGS= @LDFLAGS@
+SILC_COMMON_LIBS= -lsilc @LIBS@
 
 #
 # Common compilation flags
@@ -48,10 +49,12 @@ silc_etcdir=@ETCDIR@
 silc_modulesdir=@MODULESDIR@
 silc_helpdir=@HELPDIR@
 silc_docdir=@DOCDIR@
-silc_logsdir=@LOGSDIR@
 etcdir = $(DESTDIR)$(silc_etcdir)
 modulesdir = $(DESTDIR)$(silc_modulesdir)
 helpdir = $(DESTDIR)$(silc_helpdir)
 docdir = $(DESTDIR)$(silc_docdir)
-logsdir = $(DESTDIR)$(silc_logsdir)
 mandir = $(DESTDIR)@mandir@
+#ifdef SILC_DIST_SERVER
+silc_logsdir=@LOGSDIR@
+logsdir = $(DESTDIR)$(silc_logsdir)
+#endif SILC_DIST_SERVER
\ No newline at end of file
index a2942501957a1ad683e1075c92767649e319006a..5031e099cffa9620d1670dcca6ff662a9be91c1f 100644 (file)
@@ -19,51 +19,65 @@ give command:
 
        autodist <name> <version>
 
-Where the <name> is the distribution name.  It is one of the distributions 
-that was defined in distdir/ directory.  The <version> is the version of 
-the distribution that will be prepared.  The version format is 
+Where the <name> is the distribution name.  It is one of the distributions
+that was defined in distdir/ directory.  The <version> is the version of
+the distribution that will be prepared.  The version format is
 major.minor.build, for example 0.9.10.  Example:
 
        autodist client 0.9.15
 
-This prepares 'client' distribution of version 0.9.15.  The package will 
+This prepares 'client' distribution of version 0.9.15.  The package will
 have the version 0.9.15 automatically.
 
+NOTE: Those distribution that have RPM spec files you should specify the
+RPM release version to autodist also by doing the following:
+
+       autodist toolkit 1.1.2 0.fc7
+
+where the "0.fc7" will become the RPM release version.  If you omit the
+release version the default currently is "0.fc7".
+
 
 Configuring and compiling the distribution
 ==========================================
 
-When you prepare the distribution for releasing you should configure the 
-distribution without any specific configuration options, hence just give 
+When you prepare the distribution for releasing you should configure the
+distribution without any specific configuration options, hence just give
 the command:
 
        ./configure
 
+NOTE:  If you have SILC Toolkit installed to your system you must use
+the following command to configure the distribution, so that the Toolkit
+from the system is not used:
+
+       PKG_CONFIG=. ./configure
+
 To compile the distribution, give command:
 
        make
 
-If you want you can clear the environment first with make clean command, 
+If you want you can clear the environment first with make clean command,
 but this is not necessary.
 
 
 Packaging the distribution
 ==========================
 
-After the distribution is prepared, configured and compiled it can be 
+After the distribution is prepared, configured and compiled it can be
 packaged with the following commands:
 
        make -C doc dist-hook
        makedist --bzip2
 
-The 'makedist --bzip2' creates the default 'tar.gz' and 'tar.bz2' 
+The 'makedist --bzip2' creates the default 'tar.gz' and 'tar.bz2'
 distribution.
 
-NOTE:  Before giving this command, make sure that you do not have any of 
+NOTE:  Before giving this command, make sure that you do not have any of
 the tests in the SILC source tree compiled.  If they are the binaries
-will be included in the distribution which is not allowed.  The tests are 
+will be included in the distribution which is not allowed.  The tests are
 always located in the tests/ directory, for example lib/silccore/tests/.
-The tests are not compiled by default, but if you compiled them by 
+The tests are not compiled by default, but if you compiled them by
 yourself make sure you make clean them before creating the distribution.
 
 NOTE:  Same thing must be assured for silcer/ and tutorial/ sub
@@ -71,8 +85,8 @@ directories.  Make sure they are not compiled and does not include any
 extra files.  If you haven't compiled them after the CVS checkout, they do
 not include any extra files.
 
-NOTE for 'toolkit' distribution:  Running ./configure for toolkit 
-distribution is not necessary.  Toolkit is packaged simply by giving 
+NOTE for 'toolkit' distribution:  Running ./configure for toolkit
+distribution is not necessary.  Toolkit is packaged simply by giving
 command:
 
        makedist
@@ -81,19 +95,19 @@ command:
 Before releasing the distribution
 =================================
 
-Before releasing the distribution the created distribution must be tagged 
-in the CVS so that it can be checkout at a later time, if needed.  The tag 
+Before releasing the distribution the created distribution must be tagged
+in the CVS so that it can be checkout at a later time, if needed.  The tag
 format is as follows:
 
        silc_<name>_<version>
 
-Where <name> is the distribution name and <version> is the version of the 
-distribution in following format: major_minor_build, for example 0_9_10.  
+Where <name> is the distribution name and <version> is the version of the
+distribution in following format: major_minor_build, for example 0_9_10.
 Example:
 
        silc_client_0_9_15
 
-To tag the distribution go to the root of the SILC CVS source tree and 
+To tag the distribution go to the root of the SILC CVS source tree and
 give, for example, command:
 
        cvs tag silc_client_0_9_15
index ad8f1a6546a98dd14b66d855643fdefe83ede306..29ff37d29e5da9380df6216f4fdef864d8a51576 100644 (file)
@@ -1,17 +1,18 @@
 In order to compile the SILC Plugin (instead of the SILC Client), pass the
-following options to configure:
+following options to configure, if your Irssi is installed into /usr:
 
-       --enable-silc-plugin --without-silc-includes
+       --prefix=/usr
+       --with-silc-plugin
+       --without-silc-includes
 
-Depending on your OS/architecture you may also need to pass:
+If your Irssi is installed in some other location than /usr, then pass its
+location to --prefix and --with-silc-plugin, for example:
 
-       --with-pic --without-pthreads
+       --prefix=/usr/local
+       --with-silc-plugin=/usr/local/lib/irssi
+       --without-silc-includes
 
-For installing the SILC Plugin to the appropriate directories, you have to
-define the following paths (assuming Irssi is installed to /usr)
+Depending on your OS/architecture you may also need to pass the following
+options to configure:
 
-       --prefix=/usr
-       --with-simdir=/usr/lib/irssi
-
-If you're using Irssi 0.8.10, you may need to rename libfe_common_silc.so to
-libfe_silc.so
+       --with-pic --without-pthreads
index 1b089851deffabc9d888c47669f98b4f7bee9105..2be826d5341c2a1a056e4ed6ce2571cbb50736b3 100644 (file)
@@ -28,6 +28,6 @@ SUBDIRS =     \
        @IRSSI_SUBDIR@ \
 #endif SILC_DIST_CLIENT
 #ifdef SILC_DIST_INPLACE
-       silcstress
+#      silcstress
 #endif SILC_DIST_INPLACE
 
index 36a0f14ad3eea03b87d6ab2148ea0378f5aea513..73d44ff54e6665262cb7ea26ecaa4fe1fbc493e5 100644 (file)
@@ -1,3 +1,14 @@
+Thu May 31 23:34:00 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+       * Autodist 1.3.2.
+
+       * Added 'prereq' directive to support encforcment of Autodist
+         version.
+
+       * Added support for providing extra parameters to autodist that
+         are passed to the hook scripts.  User can specify whatever
+         extra parameter they want.
+
 Wed Feb 21 15:45:50 EET 2007 Pekka Riikonen <priikone@silcnet.org>
 
        * Autodist 1.3.1.
index 8b30e67f0f5716fc2de52affe9e9f35bfee17f96..e4388ab0a4fb9fbc74b1af3485e12dec28556597 100755 (executable)
@@ -2,7 +2,7 @@
 #
 # Author: Pekka Riikonen <priikone@silcnet.org>
 #
-# Copyright (C) 2005 Pekka Riikonen
+# Copyright (C) 2005 - 2007 Pekka Riikonen
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -996,6 +996,7 @@ ad_makedist()
   distribution=`grep "dist:" < autodist.dist | cut -d: -f2` || exit 1
   dist_version=`grep "ver:" < autodist.dist | cut -d: -f2` || exit 1
   am_distdir=`grep "distdir:" < autodist.dist | cut -d: -f2` || exit 1
+  params=`grep "params:" < autodist.dist | cut -d: -f2` || exit 1
   ad_parse_distribution $distribution false
   ad_log "  Distribution: $distribution $dist_version"
   ad_log "  Destination directory: $am_distdir"
@@ -1007,7 +1008,7 @@ ad_makedist()
   fi
 
   # Run pre-dist-hooks
-  ad_run_dist_hooks "$pre_dist_hooks"
+  ad_run_dist_hooks "$pre_dist_hooks" "$params"
 
   # Create distribution directory
   ad_debug "Creating distribution directory $am_distdir"
@@ -1019,7 +1020,7 @@ ad_makedist()
   fi
 
   # Run pre-process-dist-hooks
-  ad_run_dist_hooks "$pre_p_dist_hooks"
+  ad_run_dist_hooks "$pre_p_dist_hooks" "$params"
 
   # Run excludes
   ad_dist_excludes "$excludes" true
@@ -1061,7 +1062,7 @@ ad_makedist()
   ad_process_noprocess false
 
   # Run post-process_dist-hooks
-  ad_run_dist_hooks "$post_p_dist_hooks"
+  ad_run_dist_hooks "$post_p_dist_hooks" "$params"
 
   # Make distribution sane
   ad_makedist_makesane
@@ -1092,7 +1093,7 @@ ad_makedist()
   rm -f $am_distdir.tar
 
   # Run post-dist-hooks
-  ad_run_dist_hooks "$post_dist_hooks"
+  ad_run_dist_hooks "$post_dist_hooks" "$params"
 
   # Cleanup
   rm -rf $am_distdir
@@ -1181,6 +1182,15 @@ ad_parse_distribution()
     ad_fatal "Distribution '$1' is not declared"
   fi
 
+  # Get and enforce prereq version
+  prereq=`sed 's/^[    ]*//' < $distdir/$1 | grep -v "^#" \
+    | grep "prereq " | cut -d' ' -f2- | sort | uniq`
+  if test '!' -z $prereq; then
+    if [[ $ver < $prereq ]]; then
+      ad_fatal "Autodist $prereq or newer is required for distribution $1"
+    fi
+  fi
+
   # Get inherited
   inhs=`sed 's/^[      ]*//' < $distdir/$1 | grep -v "^#" \
     | grep "inherit " | cut -d' ' -f2 | sort | uniq`
@@ -1775,7 +1785,7 @@ ad_process()
 #
 # Run hooks
 #
-# Arguments: ad_run_hooks <hooks>
+# Arguments: ad_run_hooks <hooks> <params>
 #
 ad_run_hooks()
 {
@@ -1790,8 +1800,8 @@ ad_run_hooks()
     if test '!' -f $i; then
       ad_fatal "Hook script $i does not exist"
     fi
-    ad_log "  sh $i \"$distribution\" \"$dist_version\" \"$package\""
-    sh $i "$distribution" "$dist_version" "$package" || exit 1
+    ad_log "  sh $i \"$distribution\" \"$dist_version\" \"$package\" \"$2\""
+    sh $i "$distribution" "$dist_version" "$package" "$2" || exit 1
   done
   ad_log ""
 
@@ -1801,7 +1811,7 @@ ad_run_hooks()
 #
 # Run dist hooks
 #
-# Arguments: ad_run_dist_hooks <hooks>
+# Arguments: ad_run_dist_hooks <hooks> <params>
 #
 ad_run_dist_hooks()
 {
@@ -1817,8 +1827,8 @@ ad_run_dist_hooks()
       ad_fatal "Dist hook script $i does not exist"
     fi
 
-    ad_log "  sh $i \"$distribution\" \"$dist_version\" \"$package\" \"$am_distdir\""
-    sh $i "$distribution" "$dist_version" "$package" "$am_distdir" || exit 1
+    ad_log "  sh $i \"$distribution\" \"$dist_version\" \"$package\" \"$am_distdir\" \"$2\""
+    sh $i "$distribution" "$dist_version" "$package" "$am_distdir" "$2" || exit 1
   done
   ad_log ""
 
@@ -1828,7 +1838,7 @@ ad_run_dist_hooks()
 ###############################################################################
 # Autodist code
 
-usage="Usage: autodist [options] [distribution] [version]"
+usage="Usage: autodist [options] [distribution] [version] [params]"
 help="\
 Autodist prepares source tree for configuration, compilation and
 distribution.  Generates Automake.am files from Automake.ad files, 
@@ -1934,7 +1944,7 @@ while test $# -gt 0; do
     echo "@PACKAGE@ (@PACKAGE_NAME@) $ver" 1>&2;
     echo "Written by Pekka Riikonen" 1>&2;
     echo 1>&2;
-    echo "Copyright (C) 2004 - 2005 SILC Project" 1>&2;
+    echo "Copyright (C) 2004 - 2007 SILC Project" 1>&2;
     echo "\
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. " 1>&2;
@@ -1993,10 +2003,13 @@ else
   ad_fatal "DISTDEFS not defined in $distdir/autodist.conf"
 fi
 
+# Get extra parameters from command line
+shift
+
 #
 # Run pre-hooks
 #
-ad_run_hooks "$pre_hooks"
+ad_run_hooks "$pre_hooks" "$@"
 
 #
 # Generate the Makefile.am files from Makefile.ad files
@@ -2030,11 +2043,12 @@ ad_debug "Creating autodist.dist"
 echo "dist:$distfile" > autodist.dist
 echo "ver:$dist_version" >> autodist.dist
 echo "distdir:$package-$dist_version" >> autodist.dist
+echo "params:$@" >> autodist.dist
 
 #
 # Run post-hooks
 #
-ad_run_hooks "$post_hooks"
+ad_run_hooks "$post_hooks" "$@"
 
 ad_log "Source tree processed successfully."
 ad_debug "Done, now run ./configure and make."
diff --git a/apps/autodist/autodist.spec.in b/apps/autodist/autodist.spec.in
new file mode 100644 (file)
index 0000000..257af83
--- /dev/null
@@ -0,0 +1,54 @@
+Summary: Source distribution management system
+Name: autodist
+Version: AUTODIST_VERSION
+Release: AUTODIST_RELEASE
+License: BSD
+Group: Development/Tools
+URL: http://silcnet.org/software/developers/autodist/
+Source0: http://silcnet.org/download/autodist/sources/autodist-%{version}.tar.bz2
+BuildArch: noarch
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Requires: autoconf >= 2.58
+Requires: automake >= 1.9
+
+%description
+The Autodist is a source distribution management system that allows
+powerful mechanisms to define what is included in and excluded from a
+distribution, and what license the distribution is released under.  It
+is also used to create the actual distribution source packages.
+Autodist allows distribution management in file, directory and file
+content level.  Different distributions may include different portions
+of files, for example, excluding certain features from certain
+distributions.  It is always guaranteed that anything not defined for
+the distribution, is removed automatically (files, file content,
+directories), thus ensuring that nothing is accidentally included in
+the distribution.
+
+%prep
+%setup -q
+
+%build
+./configure --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \
+  --bindir=%{_bindir} --datadir=%{_datadir}
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+rm -f $RPM_BUILD_ROOT/%{_datadir}/autodist/COPYING
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-, root, root, -)
+%{_bindir}/*
+%{_datadir}/autodist/*.conf
+%{_datadir}/autodist/default
+%{_infodir}/autodist.info*
+%{_mandir}/man1/*
+%doc COPYING README TODO CHANGES AUTHORS
+
+%changelog
+* Thu May 31 2007 Pekka Riikonen <priikone@silcnet.org>
+- Initial version
index 90b731211ff27885a1de18170956b53d7802528a..5d877bad1a54ec49892d0f041f38296bc148bcd1 100644 (file)
@@ -3,7 +3,7 @@
 Autodist \- Source distribution management system
 .SH SYNOPSIS
 .B autodist
-[options] [distribution] [version]
+[options] [distribution] [version] [params]
 .PP
 .SH DESCRIPTION
 .PP
index a054dac701185bfb3a39ad51e928f985c4fb31ac..aadb62fca86dad87e06d086aa9c9c8895298ef26 100644 (file)
@@ -579,6 +579,20 @@ Note that, the current header must match exactly the header used in
 files.  Otherwise the replacement will not be complete.
 
 
+@section Directive: prereq <version>
+
+The 'prereq' may be used to enforce the Autodist version.  If the Autodist 
+version used to process the distribution is older than the version 
+specified with 'prereq' the Autodist will fail.
+
+Example:
+@example
+prereq 1.3.2
+@end example
+
+Will require Autodist 1.3.2 or newer for this distribution.
+
+
 @section Directive: inherit <distfile>
 
 The Autodist provides inheritance of distributions.  The 'inherit'
@@ -821,9 +835,11 @@ Zero or more 'pre-hook' directives may be set for distribution.  The
 'pre-hook' hook will be run immediately after invoking Autodist to start
 preparing the source tree for configuration and compilation (@pxref{Preparing source tree, , , , }).
 
-The scripts will get three (3) command line arguments when Autodist
-executes the script: distribution name, distribution version and package
-name of distribution.  The script may use these arguments if it needs them.
+The scripts will get at least three (3) command line arguments when 
+Autodist executes the script: distribution name, distribution version and 
+package name of distribution.  The script may use these arguments if it 
+needs them.  If user passed any extra parameters to autodist in the 
+command line they will also be passed to the script as last arguments.
 
 
 @section Directive: post-hook <filename> [...]
@@ -836,9 +852,11 @@ Zero or more 'post-hook' directives may be set for distribution.  The
 preparing the source three for configuration and compilation (@pxref{Preparing source tree, , , , }).  The Autodist will exit after it has run the
 'post-hook' scripts.
 
-The scripts will get three (3) command line arguments when Autodist
-executes the script: distribution name, distribution version and package
-name of distribution.  The script may use these arguments if it needs them.
+The scripts will get at least three (3) command line arguments when 
+Autodist executes the script: distribution name, distribution version and 
+package name of distribution.  The script may use these arguments if it 
+needs them.  If user passed any extra parameters to autodist in the 
+command line they will also be passed to the script as last arguments.
 
 
 @section Directive: pre-process-dist-hook <filename> [...]
@@ -851,10 +869,12 @@ directives may be set for distribution.  The 'pre-process-dist-hook' hook
 will be run immediately after the Autodist has created the distribution
 directory but has not yet started any distribution processing.
 
-The scripts will get four (4) command line arguments when Autodist
-executes the script: distribution name, distribution version, package
-name of distribution and destination distribution directory name.  The
-script may use these arguments if it needs them.
+The scripts will get at least four (4) command line arguments when 
+Autodist executes the script: distribution name, distribution version, 
+package name of distribution and destination distribution directory name.  
+The script may use these arguments if it needs them.  If user passed any 
+extra parameters to autodist in the command line they will also be passed 
+to the script as last arguments.
 
 
 @section Directive: post-process-dist-hook <filename> [...]
@@ -868,10 +888,12 @@ defined in one 'post-process-dist-hook' directive.  Zero or more
 has finished processing the destination distribution directory but has not
 yet created the distribution package.
 
-The scripts will get four (4) command line arguments when Autodist
-executes the script: distribution name, distribution version, package
-name of distribution and destination distribution directory name.  The
-script may use these arguments if it needs them.
+The scripts will get at least four (4) command line arguments when 
+Autodist executes the script: distribution name, distribution version, 
+package name of distribution and destination distribution directory name.  
+The script may use these arguments if it needs them.  If user passed any 
+extra parameters to autodist in the command line they will also be passed 
+to the script as last arguments.
 
 
 @section Directive: pre-dist-hook <filename> [...]
@@ -884,10 +906,12 @@ distribution.  The 'pre-dist-hook' hook will be run immediately after
 the Autodist has started distribution creation, but has not yet created
 the distribution directory.  This hook is run before 'pre-process-dist-hook'.
 
-The scripts will get four (4) command line arguments when Autodist
-executes the script: distribution name, distribution version, package
-name of distribution and destination distribution directory name.  The
-script may use these arguments if it needs them.
+The scripts will get at least four (4) command line arguments when 
+Autodist executes the script: distribution name, distribution version, 
+package name of distribution and destination distribution directory name. 
+The script may use these arguments if it needs them.  If user passed any 
+extra parameters to autodist in the command line they will also be passed 
+to the script as last arguments.
 
 
 @section Directive: post-dist-hook <filename> [...]
@@ -900,10 +924,12 @@ be set for distribution.  The 'post-dist-hook' hook will be run
 immediately after the Autodist has finished creating the distribution
 package.  This is the last hook Autodist runs.
 
-The scripts will get four (4) command line arguments when Autodist
-executes the script: distribution name, distribution version, package
-name of distribution and destination distribution directory name.  The
-script may use these arguments if it needs them.
+The scripts will get at least four (4) command line arguments when 
+Autodist executes the script: distribution name, distribution version, 
+package name of distribution and destination distribution directory name. 
+The script may use these arguments if it needs them.  If user passed any 
+extra parameters to autodist in the command line they will also be passed 
+to the script as last arguments.
 
 
 @section Running hooks
@@ -1654,6 +1680,7 @@ include doc/nomad
 define _DIST_NOMAD
 define _DIST_NOMAD_LIB
 undef _DIST_CRYPTO
+pre-dist-hook nomad-pre-dist-hook
 @end example
 
 @example
@@ -1767,11 +1794,18 @@ Then you continue with libfoozbar and Nomad:
 autodist libfoozbar 1.0.5
 makedist
 
-autodist nomad 2.0
+Nomad has also an RPM .spec file that you have written and a pre-dist-hook 
+that will replace the RPM release version with sed tool with the one you 
+give as extra parameter to autodist:
+
+autodist nomad 2.0 0.fc7
 makedist
 @end example
 
-The end results are: 'libfoozbar-1.0.5.tar.gz' and 'nomad-2.0.tar.gz'.
+The end results are: 'libfoozbar-1.0.5.tar.gz' and 'nomad-2.0.tar.gz', and 
+the RPM will have a release version '0.fc7' when you compile the RPM.  Any 
+extra parameter that you pass to autodist will be delivered to your hook 
+scripts.
 
 @page
 @contents
index c37c819095752fb52601f950835e5f9f28d9a95d..a5fd056def06bd10e2868b4868f3b792b32b7e0d 100644 (file)
@@ -23,10 +23,11 @@ conffile = silc.conf
 
 if SILCPLUGIN
 themedir = $(datadir)/irssi/themes
+theme_DATA = plugin.theme
 else
 themedir = $(datadir)/silc/themes
-endif
 theme_DATA = default.theme plugin.theme
+endif
 
 noinst_HEADERS = irssi-version.h.in
 
@@ -35,8 +36,7 @@ EXTRA_DIST = \
        curses.m4 \
        README \
        file2header.sh \
-       irssi.spec \
-       irssi.spec.in \
+       silc-client.spec \
        $(conffile) \
        $(theme_DATA) \
        irssi-config.in \
index a25473e75ede08ac76381e712eb9e459d6b10afc..66e007b6658b22b7164eb688359658c33905735a 100644 (file)
@@ -4,7 +4,7 @@
 #
 #  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2005 Pekka Riikonen
+#  Copyright (C) 2005 - 2007 Pekka Riikonen
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -30,9 +30,9 @@ IRSSI_SUBDIR=irssi
 
 # help directory
 #
-HELPDIR="$silc_prefix/help"
+HELPDIR="$datadir/silc/help"
 AC_ARG_WITH(helpdir,
-  [[  --with-helpdir=DIR      directory for SILC Client help files [PREFIX/help]]],
+  [[  --with-helpdir=DIR      directory for SILC Client help files [DATADIR/silc/help]]],
   [
     case "$withval" in
       no|yes)
@@ -54,8 +54,20 @@ AC_ARG_WITH(perl,
 
 # Irssi SILC Plugin support
 #
-AC_ARG_ENABLE(silc-plugin,
-[  --enable-silc-plugin    Compile the SILC Plugin instead of the SILC Client])
+AC_MSG_CHECKING(whether to compile SILC Plugin for Irssi)
+AC_ARG_WITH(silc-plugin,
+  [[  --with-silc-plugin[=DIR] Compile the SILC Plugin for Irssi, specify
+                           Irssi location [/usr/lib/irssi]]],
+  [
+    case "${withval}" in
+      no)
+        AC_MSG_RESULT(no)
+        ;;
+       *)
+        AC_MSG_RESULT(yes)
+       ;;
+    esac
+  ],[AC_MSG_RESULT(no)])
 
 AC_CONFIG_SUBDIRS(apps/irssi)
 AC_CONFIG_FILES(
index c1b1aaf53f345b1100c87d72d8c1b905806a1685..109e5b2cf11e94d6845595b5422f7c7fa72e886b 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT(src)
+AC_INIT([SILC-Client], [0.8.11+], [silc-devel@lists.silcnet.org], [silc-client])
 
 # we don't want VERSION in our config.h
 if test -n "`grep '^#undef VERSION' config.h.in`"; then
@@ -7,7 +7,7 @@ if test -n "`grep '^#undef VERSION' config.h.in`"; then
 fi
 
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(SILC-Client, 0.8.11+)
+AM_INIT_AUTOMAKE
 
 AM_MAINTAINER_MODE
 
@@ -191,14 +191,33 @@ AC_ARG_WITH(perl,
 
 # Irssi SILC Plugin support
 #
-AC_ARG_ENABLE(silc-plugin,
-[  --enable-silc-plugin    Compile the SILC Plugin instead of the SILC Client],
-[case "${enableval}" in
-  yes) silc_plugin=true ;;
-  no)  silc_plugin=false ;;
-  *) AC_MSG_ERROR(bad value ${enableval} for --enable-silc-plugin) ;;
-esac],[silc_plugin=false])
+SILC_IRSSIDIR=
+silc_plugin=false
+AC_MSG_CHECKING(whether to compile SILC Plugin for Irssi)
+AC_ARG_WITH(silc-plugin,
+  [[  --with-silc-plugin[=DIR] Compile the SILC Plugin for Irssi, specify
+                           Irssi location [/usr/lib/irssi]]],
+  [
+    case "${withval}" in
+      no)
+        AC_MSG_RESULT(no)
+        silc_plugin=false
+        ;;
+      yes)
+        AC_MSG_RESULT(yes)
+        silc_plugin=true
+       SILC_IRSSIDIR="/usr/lib/irssi/modules"
+       ;;
+      *)
+        AC_MSG_RESULT(yes)
+        silc_plugin=true
+        SILC_IRSSIDIR="$withval/modules"
+        ;;
+    esac
+  ])
+
 AM_CONDITIONAL(SILCPLUGIN, test x$silc_plugin = xtrue)
+AC_SUBST(SILC_IRSSIDIR)
 
 AC_ARG_WITH(file-offset-size,
 [  --with-file-offset-size=BITS  Set size of file offsets. Usually 32 or 64.
@@ -878,7 +897,6 @@ docs/help/Makefile
 docs/help/in/Makefile
 irssi-version.h
 stamp.h
-irssi.spec
 irssi-config)
 
 dnl ** for building from objdir
index e2ff29c3e40860f7658aa2fb1cd0fa3ac50d283c..31b0f994d6a5d8c086eb104317b8571fc788cc06 100644 (file)
@@ -1,11 +1,5 @@
-include $(top_srcdir)/Makefile.defines.in
-
-docdir = $(silc_docdir)
-
 doc_DATA = signals.txt formats.txt manual.txt startup-HOWTO.html \
        special_vars.txt
-#      faq.txt
-#      startup-HOWTO.txt
 
 EXTRA_DIST = $(doc_DATA)
 
index 3a3704b88ae2a47bd1446719ce05dea96aa28d8c..ff9b0e0d28285ccf3d0b4316382938164f3cb347 100644 (file)
@@ -3,9 +3,11 @@
 if SILCPLUGIN
 helpdir = $(datadir)/irssi/help/silc
 SILCHELP = silc
+ED =
 else
-helpdir = $(datadir)/irssi/help
-SILCHELP = 
+helpdir = $(datadir)/silc/help
+SILCHELP =
+ED = silc
 endif
 
 
@@ -14,6 +16,7 @@ help_DATA = $(SILCHELP) \
 
 EXTRA_DIST = \
        Makefile.am.gen \
+       $(ED) \
        $(help_DATA)
 
 SUBDIRS = in
index 7d8f07636176b505b0a7bb4f5706b2c54997650e..662db332a6ccaa2203b0c52338d5f2fddce757c1 100644 (file)
@@ -1,39 +1,60 @@
 
 @SYNTAX:cmode@
 
-This command is used to manage the modes of the channel.  Most
-of the modes require special privileges, such as channel operator
-or channel founder privileges to work.  The mode is added by
-adding + before the option(s) and removed by adding - before the
-option(s).  The (*) mark below means that only founder may set/unset
-that mode.  Other modes both channel operator and founder may manage.
+ This command is used to manage the modes of the channel.  Most
+ of the modes require special privileges, such as channel operator
+ or channel founder privileges to work.  The mode is added by
+ adding + before the option(s) and removed by adding - before the
+ option(s).  The (*) mark below means that only founder may set/unset
+ that mode.  Other modes both channel operator and founder may manage.
 
-The following modes are available:
+ The following modes are available:
+
+    p               Set/unset channel as private channel.  Private
+                    channels are shown with LIST command with an
+                    indication the channel is private.  Private
+                    channel is not shown on user's joined channel
+                    list (with for example WHOIS command).
 
-    p               Set/unset channel as private channel
     s               Set/unset channel as secret channel.  Secret
-                    channel are not shown in user's channel list
-                    or with /LIST command.
-    k               Enable/disable channel private key usage (*)
-    i               Set/unset channel as invite only channel
+                    channels are entirely invisible.  They are not
+                    shown with LIST command and they do not appear
+                    in user's joined channel list.
+
+    k               Enable/disable private channel key usage.   (*)
+                    When enabled KEY command may be used to set
+                    private channel key(s) on the channel.
+
+    i               Set/unset channel as invite only channel.  If
+                    you are the founder of the channel you will
+                    still be able to join the channel by giving
+                    command /JOIN channel -founder.
+
     t               Set/unset that only channel operator or
                     founder may set channel topic
+
     m               Set/unset user silencing.  Normal users
-                    are not able to talk on channel. (*)
+                    are not able to talk on channel.            (*)
+
     M               Set/unset operator silencing.  Operators
-                    are not able to talk on channel. (*)
-    l <limit>       Set/unset channel's user limit
+                    are not able to talk on channel.            (*)
+
+    l <limit>       Set/unset channel's user count limit
+
     a <passphrase>  Set/unset passphrase for channel that must
-                    be provided when joining to the channel. (*)
-    c <cipher>      Set/unset channel's cipher (*)
-    h <hmac>        Set/unset channel's hmac (*)
+                    be provided when joining to the channel.    (*)
+
+    c <cipher>      Set/unset channel's cipher                  (*)
+
+    h <hmac>        Set/unset channel's HMAC                    (*)
+
     f [<pubkeyfile> <privkeyfile> [<privkey passphrase>]]
-                    Set/unset channel founder authentication. (*)
+                    Set/unset channel founder authentication.   (*)
                     Channel founder may set this mode so that
-                    if the client leaves the channel it can
+                    when the client leaves the channel it can
                     claim the founder rights when it returns
                     to the channel, and to set the channel to
-                    be permanent channel.  You can claim the
+                    be permanent channel.  You can reclaim the
                     founder rights using CUMODE or JOIN commands.
 
                     If the <pubkeyfile> and <privkeyfile> is
@@ -43,7 +64,8 @@ The following modes are available:
                     server.  If these are omitted then the default
                     SILC keypair is used.  Normally you do not need
                     to provide these arguments.
-    C [{[+|-]<pubkeyfile> }]                                (*)
+
+    C [{[+|-]<pubkeyfile> }]                                    (*)
                     Set/unset channel public key mode, and add/remove
                     channel publics key from the channel public key
                     list.  When this mode is set only those users
@@ -67,14 +89,73 @@ The following modes are available:
                     arguments the current channel public key list is
                     displayed.
 
-Multiple modes can be set/unset at once if the modes does not
-require any arguments.  If mode requires an argument then only
-one mode can be set at once.
+ Multiple modes can be set/unset at once if the modes does not
+ require any arguments.  If mode requires an argument then only
+ one mode can be set at once.
+
+ When the +k (private channel key mode) mode is set the channel's
+ default cipher and HMAC are not used.  The private key (see /HELP KEY
+ for help how to set the private channel key) defines the cipher and
+ HMAC for the channel while +k mode is set.  Also the +c and +h modes
+ are ignored when private channel key mode is set.
+
+Examples:
+
+  Set the channel a permanent (persistent).  The channel won't be
+  deleted when last user leaves the channel.  When you as the founder
+  leave the channel you will be able to reclaim the founder rights
+   later.
+
+    /CMODE * +f
+
+  Reclaim founder rights (and operator privileges) for you channel:
+
+    /CUMODE * +of mynick
+
+  You can do the same during joining:
+
+    /JOIN yourchannel -founder
+
+  Change channel founder keypair on your channel.  You can do this if
+  you want to transfer founder rights to some other user or if you
+  created new keypair.  The operation requires that you have a copy of
+  the old keypair:
+
+    /CUMODE * +f mynick /path/to/old/pubkey /path/to/old/privkey
+    /CMODE * +f /path/to/new/pubkey /path/to/new/privkey
+
+  or simply /CMODE * +f if you are already using the new keypair.
+
+  Here's how to transfer founder rights to different user using
+  temporary keypair.  First, create temporary keypair:
+
+    # silc -C
+
+  Become founder on your channel:
+
+    /CUMODE * +f mynick
+
+  Set the temporary keypair on the channel and then send the key
+  pair to your friend with /FILE command or with encrypted Email:
+
+    /CMODE * +f /path/to/temp/pubkey /path/to/temp/privkey
+    (/FILE send /path/to/temp/keypair.tgz yourfriend)
+
+  Tell your friend to give the following command to become founder:
+
+    /CUMODE * +f yourfriend /path/to/temp/pubkey /path/to/temp/privkey
+
+  Your friend then sets his own keypair on the channel:
+
+    /CMODE * +f
 
-When the +k (channel private key mode) mode is set the channel's
-default cipher and HMAC are not used.  The private key (see /HELP KEY
-for help how to set the private key) defines the cipher and HMAC for
-the channel while +k mode is set.  Also the +c and +h modes are ignored
-when channel private key is set.
+  After this the temporary keypair can be removed and your friend has
+  become the founder of the channel.  This way the founder rights can
+  be transferred without ever revealing your own keypair.  When your
+  friend becomes the founder your founder rights will be removed by
+  the server automatically.  It is also possible to continue using the
+  temporary keypair, thus sharing founder rights with two or more
+  users.  Note that it is possible for only one user at a time to
+  have founder mode on the channel even if they share the keypair.
 
 See also: CUMODE, UMODE, JOIN, KEY
index e664da9c54495c8c55ccecfbc478a3519d6aff5e..25beb9f39b633678dbb4558531cf4695f2b4855e 100644 (file)
@@ -1,12 +1,12 @@
 
 @SYNTAX:cumode@
 
-This command is used to manage the users modes on the channel.
-Most of the modes require that the user which changes some
-other user's mode must be channel founder or channel operator.  The
-mode is added by adding + before the option(s) and removed by
-adding - before the option(s).  The following channel user modes
-are available:
+ This command is used to manage the users modes on the channel.
+ Most of the modes require that the user which changes some
+ other user's mode must be channel founder or channel operator.
+ The mode is added by adding + before the option(s) and removed
+ by adding - before the option(s).  The following channel user
+ modes are available:
 
     a <nickname>[@<server>]
 
@@ -19,7 +19,7 @@ are available:
 
         Set/Unset channel founder.  If you are channel
         founder you can set the channel founder authentication
-        using CMODEc command.
+        using the CMODE command.
 
         If the <pubkeyfile> and <privkeyfile> is
         provided then the <pubkeyfile> will the used
@@ -27,11 +27,12 @@ are available:
         is used to compute a signature for the SILC
         server.  If these are omitted then the default
         SILC keypair is used.  Normally you do not need
-        to provide these arguments.
+        to provide these arguments unless you want to use
+        different keypair for channel founder authentication.
 
     o <nickname>[@<server>]
 
-        Set/unset channel operator.  Requires that 
+        Set/unset channel operator.  Requires that
         you are channel operator or channel founder.
 
     b <nickname>[@<server>]
@@ -67,5 +68,20 @@ are available:
         unset this mode itself.  This mode cannot be set
         or unset to yourself.
 
+Examples:
+
+  Become a founder (and operator) on the channel that you have
+  founded and have set the founder mode:
+
+    /CUMODE * +of yournick
+    /CUMODE channel_name +f yournick
+
+  Give operator privileges to your Friend on this channel:
+
+    /CUMODE * +o Friend
+
+  Quiet misbehaving user on your channel:
+
+    /CUMODE * +q lamer
 
 See also: CMODE, UMODE
index bfc4cdc82190586e4e53277719e6e790bb01e3e0..06e115f51e3b7861604748937f79a73c95e42990 100644 (file)
@@ -1,14 +1,12 @@
 
 @SYNTAX:key@
 
-This command is used to set and unset private keys for
-channels, set and unset private keys for private messages
-with remote clients and to send key agreement requests and
-negotiate the key agreement protocol with remote client.
-The key agreement is supported only to negotiate private
-message keys, it currently cannot be used to negotiate
-private keys for channels, as it is not convenient for that
-purpose.
+This command is used to set and unset private channel keys,
+set and unset private message keys with remote users, and
+to send key agreement requests and negotiate the key agreement
+protocol with remote user.  The key agreement is supported only
+to negotiate private message keys, it currently cannot be used
+to negotiate channel private keys.
 
 Types:
 
diff --git a/apps/irssi/irssi.spec.in b/apps/irssi/irssi.spec.in
deleted file mode 100644 (file)
index d902f78..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-# $Revision$, $Date$
-Name:          irssi
-Version:       @VERSION@
-Release:       1
-Vendor:        Timo Sirainen <cras@irssi.org>
-Summary:       Irssi is a IRC client
-Copyright:     GPL
-Group:                 Applications/Communications
-URL:           http://irssi.org/
-Source0:       http://irssi.org/irssi/files/%{name}-%{version}.tar.gz
-BuildRequires: glib-devel
-BuildRequires: ncurses-devel
-BuildRoot:     /tmp/%{name}-%{version}-root
-
-%define                _sysconfdir     /etc
-%define                configure { CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ;  FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; ./configure %{_target_platform}     --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir} }
-
-%description
-Irssi is a modular IRC client that currently has only text
-mode user interface, but 80-90% of the code isn't text mode specific
-so other UI could be created pretty easily. Also, Irssi isn't really
-even IRC specific anymore, there's already a working SILC module
-available. Support for other protocols like ICQ could be create some day
-too.
-
-More information can be found at http://irssi.org/.
-
-%prep
-%setup -q
-
-%build
-export NOCONFIGURE=x
-./autogen.sh       
-%configure \
-       --with-imlib \
-       --enable-ipv6 \
-       --with-textui \
-       --with-socks \
-        --with-bot \
-        --with-proxy \
-        --with-perl=yes \
-       --with-ncurses
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make DESTDIR=$RPM_BUILD_ROOT PREFIX=$RPM_BUILD_ROOT/usr install
-mv $RPM_BUILD_ROOT/%{_datadir}/doc/irssi $RPM_BUILD_ROOT/%{_datadir}/doc/irssi-%version
-strip $RPM_BUILD_ROOT/%{_bindir}/*
-strip $RPM_BUILD_ROOT/%{_libdir}/irssi/modules/lib*.so*
-rm -f $RPM_BUILD_ROOT/%{_libdir}/perl5/5.6.0/i386-linux/perllocal.pod
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files 
-%defattr (644,root,root,755)
-%doc %{_datadir}/doc/irssi-%version/
-
-%attr(755,root,root) %{_bindir}/*
-
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/irssi*
-
-%dir %{_libdir}
-%attr(755,root,root) %{_libdir}/irssi
-%attr(755,root,root) %{_libdir}/perl5
-
-%dir %{_datadir}/irssi
-%attr(755,root,root) %{_datadir}/irssi/*
-
-%changelog
-* Fri Aug 17 2001 - Joose Vettenranta <joose@iki.fi>
-  Created new spec file from spec file founded in irssi-0.7.98.3
index 97a79916a4fe7efc77c9530100152963f1ca192d..1697d3d2ad0285331d0d19ce742edcb736146d19 100644 (file)
@@ -1,8 +1,13 @@
 SUBDIRS = examples
 
-scriptdir = $(datadir)/irssi/scripts
+PLUGIN_SCR = silc.pl
 
-script_DATA = \
+if SILCPLUGIN
+scriptdir = $(datadir)/irssi/scripts
+IRSSI_SCR =
+else
+scriptdir = $(datadir)/silc/scripts
+IRSSI_SCR = \
        autoop.pl \
        autorejoin.pl \
        buf.pl \
@@ -12,8 +17,12 @@ script_DATA = \
        mlock.pl \
        quitmsg.pl \
        scriptassist.pl \
-       silc.pl \
        splitlong.pl \
        usercount.pl
+endif
+
+script_DATA = \
+        $(PLUGIN_SCR) \
+        $(IRSSI_SCR)
 
 EXTRA_DIST = $(script_DATA)
index c8d8c8e06c8cf430af4c35105af32a74f307d359..c8ae64e9e75d598714d941a8c64469cfbcdfe948 100644 (file)
@@ -1,8 +1,15 @@
-scriptdir = $(datadir)/irssi/scripts
 
-script_DATA = \
+if SILCPLUGIN
+scriptdir = $(datadir)/irssi/scripts
+IRSSI_EX_SCR =
+else
+scriptdir = $(datadir)/silc/scripts
+IRSSI_EX_SCR = \
        command.pl \
        msg-event.pl \
        redirect.pl
+endif
+
+script_DATA = $(IRSSI_EX_SCR)
 
 EXTRA_DIST = $(script_DATA)
diff --git a/apps/irssi/silc-client.spec.in b/apps/irssi/silc-client.spec.in
new file mode 100644 (file)
index 0000000..962bb4b
--- /dev/null
@@ -0,0 +1,53 @@
+Summary: SILC Client
+Name: silc-client
+Version: SILC_VERSION
+Release: SILC_RELEASE
+License: GPL
+Group: Applications/Communications
+URL: http://silcnet.org/
+Source0: silc-client-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+BuildRequires: silc-toolkit-devel
+Requires: silc-toolkit >= 1.1
+
+%description
+SILC (Secure Internet Live Conferencing) is a protocol which provides
+secure conferencing services on the Internet over insecure channel.
+SILC Client is used to connect to SILC server and SILC network.
+
+%prep
+%setup -q
+
+%build
+%configure --prefix=%{_prefix} \
+           --mandir=%{_mandir} \
+           --infodir=%{_infodir} \
+           --bindir=%{_bindir} \
+           --datadir=%{_datadir} \
+          --with-perl-lib=%{_libdir}/silc/perl5 \
+           --enable-ipv6 --with-socks --with-perl=yes
+make -j4
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make DESTDIR=$RPM_BUILD_ROOT install
+rm -f $RPM_BUILD_ROOT/%{_libdir}/silc/perl5/*/perllocal.pod
+mv $RPM_BUILD_ROOT/%{_datadir}/doc/silc-client \
+  $RPM_BUILD_ROOT/%{_datadir}/doc/silc-client-%version
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr (755,root,root,755)
+%{_bindir}/*
+%{_libdir}/silc/perl5
+%defattr (644,root,root,755)
+%{_sysconfdir}/silc.conf
+%{_mandir}/man1/*
+%{_datadir}/silc
+%doc %{_datadir}/doc
+
+%changelog
+* Sun Jun  3 2007 - Pekka Riikonen <priikone@silcnet.org>
+- Initial version
index 13de33af3ffc11bbc609ec74bb7064af7961a8c2..d1b8d6a71936f3b1e64eb136b88766341c63721a 100644 (file)
@@ -17,9 +17,6 @@ else
 SBDRS=lib-popt lib-config core
 endif
 
-pkginc_srcdir=$(pkgincludedir)/src
-pkginc_src_HEADERS = \
-       common.h
 noinst_HEADERS = \
        common.h
 
index 8c11695fe97581af12547f4c71135aa7dcef6c21..d9ea60a943d38c88539000fc03ff952d42ad8c43 100644 (file)
@@ -7,7 +7,7 @@ INCLUDES += \
        -I$(top_srcdir)/src/core \
        $(GLIB_CFLAGS) \
        -DSYSCONFDIR=\""$(silc_etcdir)"\" \
-       -DMODULEDIR=\""$(silc_modulesdir)"\"
+       -DMODULEDIR=\""@SILC_IRSSIDIR@"\"
 
 libcore_a_SOURCES = \
        args.c \
index 2ae029e845077769b2d16093af72ade6439ac33f..42703fc653a14da643087cf8552b48657598111c 100644 (file)
@@ -97,7 +97,7 @@ static char *module_get_sub(const char *name, const char *root)
            strcmp(name+rootlen, "_core") == 0)
                 return g_strdup("core");
 
-       if (namelen+1 > rootlen && name[namelen-rootlen-1] == '_' &&
+       if (namelen > rootlen && name[namelen-rootlen-1] == '_' &&
            strcmp(name+namelen-rootlen, root) == 0)
                 return g_strndup(name, namelen-rootlen-1);
 
index 712ffba0369bb00964a6ed5b71b21d81c1201948..51a5a0cdb6fca65d693096d3eaa7881e509bcf1e 100644 (file)
@@ -1,6 +1,6 @@
 include $(top_srcdir)/Makefile.defines.in
 
-moduledir = $(silc_modulesdir)
+moduledir = @SILC_IRSSIDIR@
 
 IRSSI_INCLUDE=../../..
 
@@ -76,3 +76,8 @@ clean-local:
 
 libfe_common_silc.a: libfe_common_silc.la
        cp .libs/libfe_common_silc.a .
+
+if SILCPLUGIN
+install-data-hook: libfe_common_silc.la
+       -ln -s libfe_common_silc.so $(DESTDIR)$(moduledir)/libfe_silc.so
+endif
index d1fc3543787e720d194b771f47aad243c0509662..ee45c2e3904d9a312cd77ce57cf5933754e9452c 100644 (file)
@@ -33,7 +33,7 @@
 void fe_silc_modules_init(void);
 void fe_silc_modules_deinit(void);
 
-void fe_silc_init(void)
+static void silc_init(void)
 {
   theme_register(fecommon_silc_formats);
 
@@ -42,11 +42,21 @@ void fe_silc_init(void)
   fe_silc_messages_init();
   fe_silc_queries_init();
   fe_silcnet_init();
+}
+
+void fe_common_silc_init(void)
+{
+  silc_init();
+  module_register("silc", "fe_common");
+}
 
+void fe_silc_init(void)
+{
+  silc_init();
   module_register("silc", "fe");
 }
 
-void fe_silc_deinit(void)
+void fe_common_silc_deinit(void)
 {
   fe_silc_queries_deinit();
   fe_silc_messages_deinit();
@@ -56,3 +66,8 @@ void fe_silc_deinit(void)
 
   theme_unregister();
 }
+
+void fe_silc_deinit(void)
+{
+  fe_common_silc_deinit();
+}
index acded96f8f617c30e1ed19342f40b73b48bb064f..5d87ae25d372ed7cbf5b8c0befb26126352c575a 100644 (file)
@@ -57,6 +57,7 @@ static void sig_signed_message_public(SERVER_REC * server, const char *msg,
   const char *nickmode, *printnick;
   int for_me, print_channel, level;
   char *color, *freemsg = NULL;
+  HILIGHT_REC *hilight;
 
   /* NOTE: this may return NULL if some channel is just closed with
      /WINDOW CLOSE and server still sends the few last messages */
@@ -66,9 +67,9 @@ static void sig_signed_message_public(SERVER_REC * server, const char *msg,
 
   for_me = !settings_get_bool("hilight_nick_matches") ? FALSE :
       nick_match_msg(chanrec, msg, server->nick);
-  color = for_me ? NULL :
-    (char *)hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC,
-                              msg);
+  hilight = for_me ? NULL :
+         hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg);
+  color = (hilight == NULL) ? NULL : hilight_get_color(hilight);
 
   print_channel = chanrec == NULL ||
       !window_item_is_active((WI_ITEM_REC *) chanrec);
@@ -77,7 +78,7 @@ static void sig_signed_message_public(SERVER_REC * server, const char *msg,
     print_channel = TRUE;
 
   level = MSGLEVEL_PUBLIC;
-  if (for_me || color != NULL)
+  if (for_me)
     level |= MSGLEVEL_HILIGHT;
 
   if (settings_get_bool("emphasis"))
@@ -91,32 +92,31 @@ static void sig_signed_message_public(SERVER_REC * server, const char *msg,
   if (printnick == NULL)
     printnick = nick;
 
-  if (!print_channel) {
-    /* message to active channel in window */
-    if (color != NULL) {
-      /* highlighted nick */
-      printformat_module("fe-common/silc", server, target,
-                        level, VERIFIED_MSG(verified, SILCTXT_PUBMSG_HILIGHT),
-                        color, printnick, msg, nickmode);
-    } else {
-      printformat_module("fe-common/silc", server, target, level,
-                        for_me ? VERIFIED_MSG(verified, SILCTXT_PUBMSG_ME) :
-                                 VERIFIED_MSG(verified,SILCTXT_PUBMSG),
-                        printnick, msg, nickmode);
-    }
-  } else {
-    /* message to not existing/active channel */
-    if (color != NULL) {
-      /* highlighted nick */
-      printformat_module("fe-common/silc", server, target, level,
+  if (color != NULL) {
+    /* highlighted nick */
+    TEXT_DEST_REC dest;
+    format_create_dest(&dest, server, target, level, NULL);
+    hilight_update_text_dest(&dest,hilight);
+    if (!print_channel) /* message to active channel in windpw */
+      printformat_module_dest("fe-common/silc", &dest, 
+                VERIFIED_MSG(verified, SILCTXT_PUBMSG_HILIGHT),
+                color, printnick, msg, nickmode);
+    else /* message to not existing/active channel */
+      printformat_module_dest("fe-common/silc", &dest,
                         VERIFIED_MSG(verified, SILCTXT_PUBMSG_HILIGHT_CHANNEL),
                         color, printnick, target, msg, nickmode);
-    } else {
+
+  } else {
+    if (!print_channel)
+      printformat_module("fe-common/silc", server, target, level,
+                for_me ? VERIFIED_MSG(verified, SILCTXT_PUBMSG_ME) :
+                         VERIFIED_MSG(verified,SILCTXT_PUBMSG),
+                printnick, msg, nickmode);
+    else
       printformat_module("fe-common/silc", server, target, level,
                         for_me ? VERIFIED_MSG(verified, SILCTXT_PUBMSG_ME_CHANNEL) :
                         VERIFIED_MSG(verified, SILCTXT_PUBMSG_CHANNEL),
                         printnick, target, msg, nickmode);
-    }
   }
 
   g_free_not_null(freemsg);
index ebd2053306162d89eb3fdaa7925a76134573d79f..cfa02758a57bb6b8626f6380aeb67be86706469f 100644 (file)
@@ -16,12 +16,13 @@ silc_DEPENDENCIES =                 \
        @PERL_LINK_LIBS@        \
        @PERL_FE_LINK_LIBS@
 
-LIBS = $(SILC_COMMON_LIBS)
 silc_LDADD = \
        @COMMON_LIBS@ \
-       -lsilcclient \
        @PERL_LINK_LIBS@ \
        @PERL_FE_LINK_LIBS@ \
+       $(SILC_COMMON_LDFLAGS) \
+       -lsilcclient \
+       $(SILC_COMMON_LIBS) \
        @PERL_LINK_FLAGS@ \
        @PROG_LIBS@     \
        @TEXTUI_LIBS@
index 46502980cddb53b04ed58929be1584502696fb97..43a6a341ad6813834aba498830cf0d0bab067f44 100644 (file)
@@ -2,7 +2,7 @@ LIBTOOL = $(PERL_LIBTOOL)
 
 include $(top_srcdir)/Makefile.defines.in
 
-moduledir = $(silc_modulesdir)
+moduledir = @SILC_IRSSIDIR@
 
 if SILCPLUGIN
 perl_dirs = silc
index 0a8a9dfd6b49014864d35e18fa2007e741ef7a90..46b85d10506294f293bb1509328da572a33d8798 100644 (file)
@@ -1,6 +1,6 @@
 include $(top_srcdir)/Makefile.defines.in
 
-moduledir = $(silc_modulesdir)
+moduledir = @SILC_IRSSIDIR@
 
 
 IRSSI_INCLUDE=../../..
index 2731d62ee35b21b4e721293eb9a5dda1e504afa7..38e90d0844553855d9cc38cc2497756754e37975 100644 (file)
@@ -729,11 +729,10 @@ void silc_notify(SilcClient client, SilcClientConnection conn,
     name = va_arg(va, char *);
     client_entry = va_arg(va, SilcClientEntry);
 
-    memset(buf, 0, sizeof(buf));
-    snprintf(buf, sizeof(buf) - 1, "%s@%s",
-            client_entry->username, client_entry->hostname);
-    signal_emit("message invite", 4, server, channel ? channel->channel_name :
-               name, client_entry->nickname, buf);
+    silc_snprintf(buf, sizeof(buf) - 1, "%s@%s",
+                 client_entry->username, client_entry->hostname);
+    signal_emit("message invite", 4, server, name,
+               client_entry->nickname, buf);
     break;
 
   case SILC_NOTIFY_TYPE_JOIN:
@@ -843,10 +842,13 @@ void silc_notify(SilcClient client, SilcClientConnection conn,
       if (silc_client_on_channel(channel, client_entry2)) {
        silc_snprintf(buf, sizeof(buf), "%s", client_entry2->nickname);
        silc_client_nickname_format(client, conn, client_entry2, TRUE);
-       if (!silc_utf8_strcasecmp(buf, client_entry2->nickname))
+       if (!silc_utf8_strcasecmp(buf, client_entry2->nickname)) {
+         nicklist_rename_unique(SERVER(server), client_entry2, buf,
+                                client_entry2, client_entry2->nickname);
          printformat_module("fe-common/silc", server, channel->channel_name,
                             MSGLEVEL_CRAP, SILCTXT_CHANNEL_USER_APPEARS,
                             buf, client_entry2->nickname);
+       }
       }
       silc_client_list_free(client, conn, clients);
       silc_free(name);
@@ -899,10 +901,13 @@ void silc_notify(SilcClient client, SilcClientConnection conn,
       if (silc_client_on_channel(channel, client_entry2)) {
        silc_snprintf(buf, sizeof(buf), "%s", client_entry2->nickname);
        silc_client_nickname_format(client, conn, client_entry2, TRUE);
-       if (!silc_utf8_strcasecmp(buf, client_entry2->nickname))
+       if (!silc_utf8_strcasecmp(buf, client_entry2->nickname)) {
+         nicklist_rename_unique(SERVER(server), client_entry2, buf,
+                                client_entry2, client_entry2->nickname);
          printformat_module("fe-common/silc", server, channel->channel_name,
                             MSGLEVEL_CRAP, SILCTXT_CHANNEL_USER_APPEARS,
                             buf, client_entry2->nickname);
+       }
       }
       silc_client_list_free(client, conn, clients);
       silc_free(name);
@@ -1731,6 +1736,20 @@ void silc_command_reply(SilcClient client, SilcClientConnection conn,
       NICK_REC *ownnick;
 
       if (SILC_STATUS_IS_ERROR(status)) {
+       if (status == SILC_STATUS_ERR_NO_SUCH_SERVER) {
+         char *tmp = va_arg(vp, char *);
+         if (tmp)
+           silc_say_error("JOIN: %s: %s", tmp,
+                          silc_get_status_message(status));
+         return;
+       }
+       if (status == SILC_STATUS_ERR_NO_SUCH_CHANNEL) {
+         char *tmp = va_arg(vp, char *);
+         if (tmp)
+           silc_say_error("JOIN: %s: %s", tmp,
+                          silc_get_status_message(status));
+         return;
+       }
        silc_say_error("JOIN: %s", silc_get_status_message(status));
        return;
       }
index 58ec608f8cfd3a8d1515ab9bba37660c2dcca6dc..836347338a3457deaa8af281f5d37ef4d6775dc1 100644 (file)
@@ -52,7 +52,7 @@ void silc_client_print_list(char *list)
   int i=0;
 
   items = g_strsplit(list, ",", -1);
-  
+
   while (items[i] != NULL)
     printformat_module("fe-common/silc", NULL, NULL,
                       MSGLEVEL_CRAP, SILCTXT_CONFIG_LIST,
@@ -430,7 +430,7 @@ void change_private_key_passphrase(const char *answer, CREATE_KEY_REC *rec)
                            ENTRY_REDIRECT_FLAG_HIDDEN, rec);
     return;
   }
-  
+
   if ((rec->passphrase == NULL) && (answer) && (*answer != '\0')) {
     rec->passphrase = g_strdup(answer);
     keyboard_entry_redirect((SIGNAL_FUNC) change_private_key_passphrase,
@@ -454,7 +454,7 @@ void change_private_key_passphrase(const char *answer, CREATE_KEY_REC *rec)
   }
 
   if (silc_change_private_key_passphrase(rec->file, rec->old,
-                                    (rec->passphrase == NULL ? 
+                                    (rec->passphrase == NULL ?
                                      "" : rec->passphrase)) == TRUE)
     printformat_module("fe-common/silc", NULL, NULL,
                       MSGLEVEL_CRAP, SILCTXT_CONFIG_PASSCHANGE);
index 3084f7407760da9fe1c0c73b154f7c109dd7d322..8b6f9f74ed50fc08326068ad805b09a3c27d86d0 100644 (file)
@@ -50,7 +50,7 @@ static int opt_bits = 0;
 static int init_failed = 0;
 #endif
 
-static int idletag = -1;
+static int running = 0;
 
 /* SILC Client */
 SilcClient silc_client = NULL;
@@ -76,10 +76,62 @@ void silc_lag_deinit(void);
 void silc_core_deinit(void);
 #endif
 
-static int my_silc_scheduler(void)
+static gboolean my_silc_scheduler(gpointer data)
 {
+  SILC_LOG_DEBUG(("Timeout"));
   silc_client_run_one(silc_client);
-  return 1;
+  return FALSE;
+}
+
+static gboolean my_silc_scheduler_fd(GIOChannel *source,
+                                     GIOCondition condition,
+                                     gpointer data)
+{
+  SILC_LOG_DEBUG(("I/O event, %d", SILC_PTR_TO_32(data)));
+  silc_client_run_one(silc_client);
+  return TRUE;
+}
+
+static void scheduler_notify_cb(SilcSchedule schedule,
+                               SilcBool added, SilcTask task,
+                               SilcBool fd_task, SilcUInt32 fd,
+                               SilcTaskEvent event,
+                               long seconds, long useconds,
+                               void *context)
+{
+  if (added) {
+    if (fd_task) {
+      /* Add fd */
+      GIOChannel *ch;
+      guint e = 0;
+
+      SILC_LOG_DEBUG(("Add fd %d, events %d", fd, event));
+      g_source_remove_by_user_data(SILC_32_TO_PTR(fd));
+
+      if (event & SILC_TASK_READ)
+        e |= (G_IO_IN | G_IO_PRI | G_IO_HUP | G_IO_ERR);
+      if (event & SILC_TASK_WRITE)
+        e |= (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL);
+
+      if (e) {
+       ch = g_io_channel_unix_new(fd);
+       g_io_add_watch(ch, e, my_silc_scheduler_fd, SILC_32_TO_PTR(fd));
+       g_io_channel_unref(ch);
+      }
+    } else {
+      /* Add timeout */
+      guint t;
+
+      t = (seconds * 1000) + (useconds / 1000);
+      SILC_LOG_DEBUG(("interval %d msec", t));
+      g_timeout_add(t, my_silc_scheduler, NULL);
+    }
+  } else {
+    if (fd_task) {
+      /* Remove fd */
+      g_source_remove_by_user_data(SILC_32_TO_PTR(fd));
+    }
+  }
 }
 
 static CHATNET_REC *create_chatnet(void)
@@ -561,6 +613,7 @@ silc_stopped(SilcClient client, void *context)
 static void
 silc_running(SilcClient client, void *context)
 {
+  running = 1;
   SILC_LOG_DEBUG(("Client library is running"));
 }
 
@@ -602,6 +655,8 @@ static void sig_init_finished(void)
     return;
   }
 
+  silc_schedule_set_notify(silc_client->schedule, scheduler_notify_cb, NULL);
+
   silc_log_set_callback(SILC_LOG_INFO, silc_log_misc, NULL);
   silc_log_set_callback(SILC_LOG_WARNING, silc_log_misc, NULL);
   silc_log_set_callback(SILC_LOG_ERROR, silc_log_misc, NULL);
@@ -609,8 +664,8 @@ static void sig_init_finished(void)
 
   silc_hash_alloc("sha1", &sha1hash);
 
-  /* register SILC scheduler */
-  idletag = g_timeout_add(5, (GSourceFunc) my_silc_scheduler, NULL);
+  /* Run SILC scheduler */
+  my_silc_scheduler(NULL);
 }
 
 /* Init SILC. Called from src/fe-text/silc.c */
@@ -715,6 +770,7 @@ void silc_core_init(void)
   /* Initialize client parameters */
   memset(&params, 0, sizeof(params));
   strcat(params.nickname_format, settings_get_str("nickname_format"));
+  params.full_channel_names = TRUE;
 
   /* Allocate SILC client */
   silc_client = silc_client_alloc(&ops, &params, NULL, silc_version_string);
@@ -788,14 +844,12 @@ void silc_core_init(void)
 
 void silc_core_deinit(void)
 {
-  if (idletag != -1)
-    g_source_remove(idletag);
-
-  int stopped = 0;
-  silc_client_stop(silc_client, silc_stopped, &stopped);
-
-  while (!stopped)
-    silc_client_run_one(silc_client);
+  if (running) {
+    volatile int stopped = 0;
+    silc_client_stop(silc_client, silc_stopped, (void *)&stopped);
+    while (!stopped)
+      silc_client_run_one(silc_client);
+  }
 
   if (opt_hostname)
     silc_free(opt_hostname);
@@ -823,7 +877,9 @@ void silc_core_deinit(void)
 
   chat_protocol_unregister("SILC");
 
-  silc_pkcs_public_key_free(irssi_pubkey);
-  silc_pkcs_private_key_free(irssi_privkey);
+  if (irssi_pubkey)
+    silc_pkcs_public_key_free(irssi_pubkey);
+  if (irssi_privkey)
+    silc_pkcs_private_key_free(irssi_privkey);
   silc_client_free(silc_client);
 }
index 96b22dd2a1e1a12ae27668102a2b8cd3626294b9..e16fb02cdc056fef1116a982f49259c3bf0d7483 100644 (file)
@@ -102,9 +102,14 @@ static void silc_send_msg_clients(SilcClient client,
   clients = silc_client_get_clients_local(silc_client, server->conn,
                                          rec->nick, FALSE);
   if (!clients) {
-    printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
-             "%s: There is no such client (did you mean %s?)", rec->nick,
-             target->nickname);
+    if (strchr(rec->nick, '@') && target->server)
+      printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
+               "%s: There is no such client (did you mean %s@%s?)", rec->nick,
+               target->nickname, target->server);
+    else
+      printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
+               "%s: There is no such client (did you mean %s?)", rec->nick,
+               target->nickname);
     goto out;
   }
 
@@ -275,6 +280,7 @@ static void silc_connect_cb(SilcClient client,
                            void *context)
 {
   SILC_SERVER_REC *server = context;
+  FtpSession ftp;
   char *file;
 
   SILC_LOG_DEBUG(("Connection callback %p, status %d, error %d, message %s",
@@ -348,6 +354,12 @@ static void silc_connect_cb(SilcClient client,
               silc_get_status_message(error), error,
               message ? message : "");
 
+    /* Close FTP sessions */
+    silc_dlist_start(server->ftp_sessions);
+    while ((ftp = silc_dlist_get(server->ftp_sessions)))
+      silc_client_file_close(client, conn, ftp->session_id);
+    silc_dlist_uninit(server->ftp_sessions);
+
     if (server->conn)
       server->conn->context = NULL;
     server->conn = NULL;
@@ -454,8 +466,6 @@ static void sig_disconnected(SILC_SERVER_REC *server)
   if (!IS_SILC_SERVER(server))
     return;
 
-  silc_dlist_uninit(server->ftp_sessions);
-
   if (server->conn) {
     /* Close connection */
     silc_client_close_connection(silc_client, server->conn);
@@ -470,9 +480,11 @@ static void sig_disconnected(SILC_SERVER_REC *server)
   }
 
   /* SILC closes the handle */
-  g_io_channel_unref(net_sendbuffer_handle(server->handle));
-  net_sendbuffer_destroy(server->handle, FALSE);
-  server->handle = NULL;
+  if (server->handle) {
+    g_io_channel_unref(net_sendbuffer_handle(server->handle));
+    net_sendbuffer_destroy(server->handle, FALSE);
+    server->handle = NULL;
+  }
 }
 
 SERVER_REC *silc_server_init_connect(SERVER_CONNECT_REC *conn)
index f5c3824fa0fede2c7f7405a0d4e7427a1fcad8d7..12b5ce26236161276a37e780c79a47e9cfa6d1b1 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2005, 2007 Pekka Riikonen
+  Copyright (C) 1997 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -599,7 +599,7 @@ SILC_SERVER_CMD_FUNC(whois)
 {
   SilcServerCommandContext cmd = (SilcServerCommandContext)context;
   SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_WHOIS, cmd, 1, 256);
-  silc_server_query_command(cmd->server, SILC_COMMAND_WHOIS, cmd);
+  silc_server_query_command(cmd->server, SILC_COMMAND_WHOIS, cmd, NULL);
   silc_server_command_free(cmd);
 }
 
@@ -609,7 +609,7 @@ SILC_SERVER_CMD_FUNC(whowas)
 {
   SilcServerCommandContext cmd = (SilcServerCommandContext)context;
   SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_WHOWAS, cmd, 1, 2);
-  silc_server_query_command(cmd->server, SILC_COMMAND_WHOWAS, cmd);
+  silc_server_query_command(cmd->server, SILC_COMMAND_WHOWAS, cmd, NULL);
   silc_server_command_free(cmd);
 }
 
@@ -619,7 +619,7 @@ SILC_SERVER_CMD_FUNC(identify)
 {
   SilcServerCommandContext cmd = (SilcServerCommandContext)context;
   SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_IDENTIFY, cmd, 1, 256);
-  silc_server_query_command(cmd->server, SILC_COMMAND_IDENTIFY, cmd);
+  silc_server_query_command(cmd->server, SILC_COMMAND_IDENTIFY, cmd, NULL);
   silc_server_command_free(cmd);
 }
 
@@ -1325,9 +1325,8 @@ SILC_TASK_CALLBACK(silc_server_command_quit_cb)
   if (client) {
     /* Free all client specific data, such as client entry and entires
        on channels this client may be on. */
-    silc_server_free_client_data(server, q->sock, client,
-                                TRUE, q->signoff);
-    silc_packet_set_context(q->sock, NULL);
+    silc_server_free_sock_user_data(server, q->sock, q->signoff);
+    silc_server_close_connection(server, q->sock);
   }
 
   silc_packet_stream_unref(q->sock);
@@ -1438,7 +1437,7 @@ SILC_SERVER_CMD_FUNC(kill)
   comment = silc_argument_get_arg_type(cmd->args, 2, &tmp_len2);
   if (comment && tmp_len2 > 128) {
     tmp_len2 = 128;
-    comment[127] = '\0';
+    comment[tmp_len2 - 1] = '\0';
   }
 
   /* If authentication data is provided then verify that killing is
@@ -2295,6 +2294,38 @@ static void silc_server_command_join_channel(SilcServer server,
 /* Server side of command JOIN. Joins client into requested channel. If
    the channel does not exist it will be created. */
 
+void silc_server_command_join_connected(SilcServer server,
+                                       SilcServerEntry server_entry,
+                                       void *context)
+{
+  SilcServerCommandContext cmd = (SilcServerCommandContext)context;
+
+  if (!server_entry) {
+    SilcUInt32 tmp_len;
+    unsigned char *tmp = silc_argument_get_arg_type(cmd->args, 1, &tmp_len);
+    char serv[256 + 1];
+
+    SILC_LOG_DEBUG(("Connecting to router failed"));
+    silc_parse_userfqdn(tmp, NULL, 0, serv, sizeof(serv));
+
+    if (serv[0]) {
+      silc_server_command_send_status_data(cmd, SILC_COMMAND_JOIN,
+                                          SILC_STATUS_ERR_NO_SUCH_SERVER, 0,
+                                          2, serv, strlen(serv));
+    } else {
+      silc_server_command_send_status_data(cmd, SILC_COMMAND_JOIN,
+                                          SILC_STATUS_ERR_NO_SUCH_CHANNEL, 0,
+                                          2, tmp, tmp_len);
+    }
+    silc_server_command_free(cmd);
+    return;
+  }
+
+  /* Reprocess command */
+  SILC_LOG_DEBUG(("Reprocess JOIN after connecting to router"));
+  silc_server_command_join(cmd, NULL);
+}
+
 SILC_SERVER_CMD_FUNC(join)
 {
   SilcServerCommandContext cmd = (SilcServerCommandContext)context;
@@ -2303,6 +2334,7 @@ SILC_SERVER_CMD_FUNC(join)
   unsigned char *auth, *cauth;
   SilcUInt32 tmp_len, auth_len, cauth_len;
   char *tmp, *channel_name, *channel_namec = NULL, *cipher, *hmac;
+  char parsed[256 + 1], serv[256 + 1];
   SilcChannelEntry channel;
   SilcUInt32 umode = 0;
   SilcBool created = FALSE, create_key = TRUE;
@@ -2321,15 +2353,61 @@ SILC_SERVER_CMD_FUNC(join)
 
   /* Truncate over long channel names */
   if (tmp_len > 256) {
-    tmp[tmp_len - 1] = '\0';
     tmp_len = 256;
+    tmp[tmp_len - 1] = '\0';
+  }
+
+  /* Parse server name from the channel name */
+  silc_parse_userfqdn(tmp, parsed, sizeof(parsed), serv,
+                     sizeof(serv));
+  channel_name = parsed;
+
+  if (server->config->dynamic_server) {
+    /* If server name is not specified but local channels is FALSE then the
+       channel will be global, based on our router name. */
+    if (!serv[0] && !server->config->local_channels) {
+      if (!server->standalone) {
+       silc_snprintf(serv, sizeof(serv), server->router->server_name);
+      } else {
+       SilcServerConfigRouter *router;
+       router = silc_server_config_get_primary_router(server);
+       if (router) {
+         /* Create connection to primary router */
+         SILC_LOG_DEBUG(("Create dynamic connection to primary router %s:%d",
+                         router->host, router->port));
+         silc_server_create_connection(server, FALSE, TRUE,
+                                       router->host, router->port,
+                                       silc_server_command_join_connected,
+                                       cmd);
+         return;
+       }
+      }
+    }
+
+    /* If server name is ours, ignore it. */
+    if (serv[0] && silc_utf8_strcasecmp(serv, server->server_name))
+      memset(serv, 0, sizeof(serv));
+
+    /* Create connection */
+    if (serv[0] && server->standalone) {
+      SilcServerConfigRouter *router;
+      router = silc_server_config_get_primary_router(server);
+      if (router) {
+       /* Create connection to primary router */
+       SILC_LOG_DEBUG(("Create dynamic connection to primary router %s:%d",
+                       router->host, router->port));
+       silc_server_create_connection(server, FALSE, TRUE,
+                                     router->host, router->port,
+                                     silc_server_command_join_connected, cmd);
+       return;
+      }
+    }
   }
-  channel_name = tmp;
 
   /* Check for valid channel name.  This is cached, the original is saved
      in the channel context. */
-  channel_namec = silc_channel_name_check(tmp, tmp_len, SILC_STRING_UTF8, 256,
-                                         NULL);
+  channel_namec = silc_channel_name_check(channel_name, strlen(channel_name),
+                                         SILC_STRING_UTF8, 256, NULL);
   if (!channel_namec) {
     silc_server_command_send_status_reply(cmd, SILC_COMMAND_JOIN,
                                          SILC_STATUS_ERR_BAD_CHANNEL, 0);
@@ -2387,10 +2465,22 @@ SILC_SERVER_CMD_FUNC(join)
          channel = silc_server_create_new_channel(server, server->id, cipher,
                                                   hmac, channel_name, TRUE);
          if (!channel) {
-           silc_server_command_send_status_data(
-                                 cmd, SILC_COMMAND_JOIN,
-                                 SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
-                                 0, 2, cipher, strlen(cipher));
+           if (cipher) {
+             silc_server_command_send_status_data(
+                               cmd, SILC_COMMAND_JOIN,
+                               SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
+                               0, 2, cipher, strlen(cipher));
+           } else if (hmac) {
+             silc_server_command_send_status_data(
+                               cmd, SILC_COMMAND_JOIN,
+                               SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
+                               0, 2, hmac, strlen(hmac));
+           } else {
+             silc_server_command_send_status_reply(
+                               cmd, SILC_COMMAND_JOIN,
+                               SILC_STATUS_ERR_RESOURCE_LIMIT,
+                               0);
+           }
            goto out;
          }
 
@@ -2446,10 +2536,22 @@ SILC_SERVER_CMD_FUNC(join)
          channel = silc_server_create_new_channel(server, server->id, cipher,
                                                   hmac, channel_name, TRUE);
          if (!channel) {
-           silc_server_command_send_status_data(
-                                      cmd, SILC_COMMAND_JOIN,
-                                      SILC_STATUS_ERR_UNKNOWN_ALGORITHM, 0,
-                                      2, cipher, strlen(cipher));
+           if (cipher) {
+             silc_server_command_send_status_data(
+                                     cmd, SILC_COMMAND_JOIN,
+                                     SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
+                                     0, 2, cipher, strlen(cipher));
+           } else if (hmac) {
+             silc_server_command_send_status_data(
+                                     cmd, SILC_COMMAND_JOIN,
+                                     SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
+                                     0, 2, hmac, strlen(hmac));
+           } else {
+             silc_server_command_send_status_reply(
+                                     cmd, SILC_COMMAND_JOIN,
+                                     SILC_STATUS_ERR_RESOURCE_LIMIT,
+                                     0);
+           }
            goto out;
          }
 
@@ -2479,10 +2581,22 @@ SILC_SERVER_CMD_FUNC(join)
        channel = silc_server_create_new_channel(server, server->id, cipher,
                                                 hmac, channel_name, TRUE);
        if (!channel) {
-         silc_server_command_send_status_data(
-                                      cmd, SILC_COMMAND_JOIN,
-                                      SILC_STATUS_ERR_UNKNOWN_ALGORITHM, 0,
-                                      2, cipher, strlen(cipher));
+         if (cipher) {
+           silc_server_command_send_status_data(
+                                     cmd, SILC_COMMAND_JOIN,
+                                     SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
+                                     0, 2, cipher, strlen(cipher));
+         } else if (hmac) {
+           silc_server_command_send_status_data(
+                                     cmd, SILC_COMMAND_JOIN,
+                                     SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
+                                     0, 2, hmac, strlen(hmac));
+         } else {
+           silc_server_command_send_status_reply(
+                                     cmd, SILC_COMMAND_JOIN,
+                                     SILC_STATUS_ERR_RESOURCE_LIMIT,
+                                     0);
+         }
          goto out;
        }
 
@@ -4152,12 +4266,12 @@ SILC_SERVER_CMD_FUNC(watch)
   }
 
   if (add_nick && add_nick_len > 128) {
-    add_nick[128] = '\0';
     add_nick_len = 128;
+    add_nick[add_nick_len - 1] = '\0';
   }
   if (del_nick && del_nick_len > 128) {
-    del_nick[128] = '\0';
     del_nick_len = 128;
+    del_nick[del_nick_len - 1] = '\0';
   }
 
   /* Add new nickname to be watched in our cell */
@@ -4386,7 +4500,7 @@ SILC_SERVER_CMD_FUNC(silcoper)
   username = silc_identifier_check(username, tmp_len, SILC_STRING_UTF8, 128,
                                   &tmp_len);
   if (!username) {
-    silc_server_command_send_status_reply(cmd, SILC_COMMAND_OPER,
+    silc_server_command_send_status_reply(cmd, SILC_COMMAND_SILCOPER,
                                          SILC_STATUS_ERR_BAD_USERNAME,
                                          0);
     goto out;
@@ -4435,7 +4549,7 @@ SILC_SERVER_CMD_FUNC(silcoper)
   }
   if (!result) {
     /* Authentication failed */
-    silc_server_command_send_status_reply(cmd, SILC_COMMAND_OPER,
+    silc_server_command_send_status_reply(cmd, SILC_COMMAND_SILCOPER,
                                          SILC_STATUS_ERR_AUTH_FAILED, 0);
     goto out;
   }
@@ -5138,7 +5252,7 @@ SILC_SERVER_CMD_FUNC(connect)
     SILC_GET32_MSB(port, tmp);
 
   /* Create the connection. It is done with timeout and is async. */
-  silc_server_create_connection(server, FALSE, host, port, NULL, NULL);
+  silc_server_create_connection(server, FALSE, FALSE, host, port, NULL, NULL);
 
   /* Send reply to the sender */
   silc_server_command_send_status_reply(cmd, SILC_COMMAND_PRIV_CONNECT,
index e6858ae43e0fca5192173ab51f14ecf23803a750..97aedf0e8e37455267c4818136418a9c24510b9f 100644 (file)
@@ -261,9 +261,10 @@ silc_server_command_reply_whois_save(SilcServerCommandReplyContext cmd)
       return FALSE;
     }
 
-    /* Remove the old cache entry  */
-    silc_idcache_del_by_context(global ? server->global_list->clients :
-                               server->local_list->clients, client, NULL);
+    /* Update entry */
+    silc_idcache_update_by_context(global ? server->global_list->clients :
+                                  server->local_list->clients, client, NULL,
+                                  nickname, TRUE);
 
     silc_free(client->nickname);
     silc_free(client->username);
@@ -277,11 +278,6 @@ silc_server_command_reply_whois_save(SilcServerCommandReplyContext cmd)
     client->mode = mode;
     client->data.status |= SILC_IDLIST_STATUS_RESOLVED;
     client->data.status &= ~SILC_IDLIST_STATUS_RESOLVING;
-
-    /* Create new cache entry */
-    silc_idcache_add(global ? server->global_list->clients :
-                    server->local_list->clients, nickname, client->id,
-                    client);
   }
 
   /* Save channel list if it was sent to us */
@@ -1203,7 +1199,8 @@ SILC_SERVER_CMD_REPLY_FUNC(join)
     silc_hmac_free(hmac);
   silc_server_command_reply_free(cmd);
 
-  silc_pkcs_public_key_free(founder_key);
+  if (founder_key)
+    silc_pkcs_public_key_free(founder_key);
   if (client_id_list)
     silc_buffer_free(client_id_list);
   if (client_mode_list)
index 8088150e8c1ee1e880ee5ff9d9f9fa4e434d2400..e302b6e6bf3ddfed204cdd7fee49e633c4dff14e 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2005, 2007 Pekka Riikonen
+  Copyright (C) 1997 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -62,23 +62,6 @@ void silc_idlist_del_data(void *entry)
   idata->public_key = NULL;
 }
 
-/* Purges ID cache */
-
-SILC_TASK_CALLBACK(silc_idlist_purge)
-{
-  SilcServer server = app_context;
-  SilcIDListPurge i = (SilcIDListPurge)context;
-
-  SILC_LOG_DEBUG(("Purging cache"));
-
-#if 0
-  /* XXX */
-  silc_idcache_purge(i->cache);
-  silc_schedule_task_add_timeout(server->schedule, silc_idlist_purge, i,
-                                i->timeout, 0);
-#endif
-}
-
 /******************************************************************************
 
                           Server entry functions
@@ -380,7 +363,7 @@ silc_idlist_add_client(SilcIDList id_list, char *nickname, char *username,
 
 int silc_idlist_del_client(SilcIDList id_list, SilcClientEntry entry)
 {
-  SILC_LOG_DEBUG(("Start"));
+  SILC_LOG_DEBUG(("Delete client %p", entry));
 
   if (entry) {
     /* Delete client, destructor will free data */
@@ -459,7 +442,8 @@ int silc_idlist_get_clients_by_nickname(SilcIDList id_list, char *nickname,
    is returned to `clients_count'. Caller must free the returned table.
    The 'nickname' must be normalized already. */
 
-int silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
+int silc_idlist_get_clients_by_hash(SilcIDList id_list,
+                                   char *nickname, char *server,
                                    SilcHash md5hash,
                                    SilcClientEntry **clients,
                                    SilcUInt32 *clients_count)
@@ -468,6 +452,7 @@ int silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
   SilcIDCacheEntry id_cache = NULL;
   unsigned char hash[SILC_HASH_MAXLEN];
   SilcClientID client_id;
+  SilcClientEntry client_entry;
 
   SILC_LOG_DEBUG(("Start"));
 
@@ -482,6 +467,21 @@ int silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
   if (!silc_idcache_find_by_id(id_list->clients, &client_id, &list))
     return FALSE;
 
+  /* If server is specified, narrow the search with it. */
+  if (server) {
+    silc_list_start(list);
+    while ((id_cache = silc_list_get(list))) {
+      client_entry = id_cache->context;
+      if (!client_entry->servername)
+       continue;
+      if (!silc_utf8_strcasecmp(client_entry->servername, server))
+       silc_list_del(list, id_cache);
+    }
+  }
+
+  if (!silc_list_count(list))
+    return FALSE;
+
   *clients = silc_realloc(*clients,
                          (silc_list_count(list) + *clients_count) *
                          sizeof(**clients));
@@ -558,18 +558,17 @@ silc_idlist_replace_client_id(SilcServer server,
 
   client = (SilcClientEntry)id_cache->context;
 
-  /* Remove the old entry and add a new one */
-
-  if (!silc_idcache_del_by_context(id_list->clients, client, server))
-    return NULL;
-
   /* Check if anyone is watching old nickname */
   if (server->server_type == SILC_ROUTER)
     silc_server_check_watcher_list(server, client, nickname,
                                   SILC_NOTIFY_TYPE_NICK_CHANGE);
 
+  /* Replace */
+  if (!silc_idcache_update(id_list->clients, id_cache, new_id, nicknamec,
+                          TRUE))
+    return NULL;
+
   silc_free(client->nickname);
-  *client->id = *new_id;
   client->nickname = nickname ? strdup(nickname) : NULL;
 
   /* Check if anyone is watching new nickname */
@@ -577,10 +576,6 @@ silc_idlist_replace_client_id(SilcServer server,
     silc_server_check_watcher_list(server, client, nickname,
                                   SILC_NOTIFY_TYPE_NICK_CHANGE);
 
-  if (!silc_idcache_add(id_list->clients, nicknamec, client->id,
-                       client))
-    return NULL;
-
   SILC_LOG_DEBUG(("Replaced"));
 
   return client;
index fe9f6ced5adf9716128240b10c3aa47b8033ce44..25705a9873d20bcda1fd76e17096ae062a7f6052 100644 (file)
@@ -162,6 +162,9 @@ struct SilcServerEntryStruct {
 
   /* Connection data */
   void *connection;
+
+  void *backup_proto;
+  unsigned int backup  : 1;    /* Set when executing backup protocol */
 };
 
 /*
@@ -543,6 +546,7 @@ struct SilcIDListStruct {
 typedef struct {
   /* Generic data structure. DO NOT add anything before this! */
   SilcIDListDataStruct data;
+  SilcAsyncOperation op;
   SilcServerConfigRef cconfig;
   SilcServerConfigRef sconfig;
   SilcServerConfigRef rconfig;
@@ -588,7 +592,8 @@ int silc_idlist_get_clients_by_nickname(SilcIDList id_list, char *nickname,
                                        char *server,
                                        SilcClientEntry **clients,
                                        SilcUInt32 *clients_count);
-int silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
+int silc_idlist_get_clients_by_hash(SilcIDList id_list,
+                                   char *nickname, char *server,
                                    SilcHash md5hash,
                                    SilcClientEntry **clients,
                                    SilcUInt32 *clients_count);
index f17e28546da22623d727fbc1ee90826b65544281..9b990ff8d5fb587bec5a973171ec2e7400e9fd1d 100644 (file)
@@ -46,8 +46,17 @@ static void silc_server_notify_process(SilcServer server,
   SilcUInt32 tmp_len, tmp2_len;
   SilcBool local, ret;
 
-  if (idata->conn_type == SILC_CONN_CLIENT ||
-      packet->src_id_type != SILC_ID_SERVER || !packet->dst_id) {
+  if (idata->conn_type == SILC_CONN_CLIENT) {
+    SILC_LOG_DEBUG(("Notify received from client, drop it"));
+    return;
+  }
+
+  if (packet->src_id_type != SILC_ID_SERVER){
+    SILC_LOG_DEBUG(("Bad notify packet received"));
+    return;
+  }
+
+  if (!packet->dst_id) {
     SILC_LOG_DEBUG(("Bad notify packet received"));
     return;
   }
@@ -69,8 +78,10 @@ static void silc_server_notify_process(SilcServer server,
 
   /* Parse the Notify Payload */
   payload = silc_notify_payload_parse(buffer->data, silc_buffer_len(buffer));
-  if (!payload)
+  if (!payload) {
+    SILC_LOG_DEBUG(("Marlformed notify payload"));
     return;
+  }
 
   /* If we are router and this packet is not already broadcast packet
      we will broadcast it. The sending socket really cannot be router or
@@ -84,8 +95,10 @@ static void silc_server_notify_process(SilcServer server,
       /* Packet is destined to channel */
       if (!silc_id_str2id(packet->dst_id, packet->dst_id_len,
                          packet->dst_id_type, &channel_id,
-                         sizeof(channel_id)))
+                         sizeof(channel_id))) {
+       SILC_LOG_DEBUG(("Malformed destination ID in notify packet"));
        goto out;
+      }
 
       silc_server_packet_send_dest(server, SILC_PRIMARY_ROUTE(server),
                                   packet->type, packet->flags |
@@ -112,8 +125,10 @@ static void silc_server_notify_process(SilcServer server,
 
   type = silc_notify_get_type(payload);
   args = silc_notify_get_args(payload);
-  if (!args)
+  if (!args) {
+    SILC_LOG_DEBUG(("Notify doesn't have any arguments, drop it"));
     goto out;
+  }
 
   switch(type) {
   case SILC_NOTIFY_TYPE_JOIN:
@@ -133,7 +148,8 @@ static void silc_server_notify_process(SilcServer server,
       channel = silc_idlist_find_channel_by_id(server->local_list,
                                               SILC_ID_GET_ID(id), NULL);
       if (!channel) {
-       SILC_LOG_DEBUG(("Notify for unknown channel"));
+       SILC_LOG_DEBUG(("Notify for unknown channel %s",
+                       silc_id_render(SILC_ID_GET_ID(id), SILC_ID_CHANNEL)));
        goto out;
       }
     }
@@ -251,7 +267,8 @@ static void silc_server_notify_process(SilcServer server,
       channel = silc_idlist_find_channel_by_id(server->local_list,
                                               &channel_id, NULL);
       if (!channel) {
-       SILC_LOG_DEBUG(("Notify for unknown channel"));
+       SILC_LOG_DEBUG(("Notify for unknown channel %s",
+                       silc_id_render(&channel_id, SILC_ID_CHANNEL)));
        goto out;
       }
     }
@@ -383,7 +400,8 @@ static void silc_server_notify_process(SilcServer server,
       channel = silc_idlist_find_channel_by_id(server->local_list,
                                               &channel_id, NULL);
       if (!channel) {
-       SILC_LOG_DEBUG(("Notify for unknown channel"));
+       SILC_LOG_DEBUG(("Notify for unknown channel %s",
+                       silc_id_render(&channel_id, SILC_ID_CHANNEL)));
        goto out;
       }
     }
@@ -503,7 +521,8 @@ static void silc_server_notify_process(SilcServer server,
       channel = silc_idlist_find_channel_by_id(server->local_list,
                                               &channel_id, NULL);
       if (!channel) {
-       SILC_LOG_DEBUG(("Notify for unknown channel"));
+       SILC_LOG_DEBUG(("Notify for unknown channel %s",
+                       silc_id_render(&channel_id, SILC_ID_CHANNEL)));
        goto out;
       }
     }
@@ -823,7 +842,8 @@ static void silc_server_notify_process(SilcServer server,
        channel = silc_idlist_find_channel_by_id(server->local_list,
                                                 &channel_id, NULL);
        if (!channel) {
-         SILC_LOG_DEBUG(("Notify for unknown channel"));
+         SILC_LOG_DEBUG(("Notify for unknown channel %s",
+                         silc_id_render(&channel_id, SILC_ID_CHANNEL)));
          goto out;
        }
       }
@@ -1010,7 +1030,8 @@ static void silc_server_notify_process(SilcServer server,
       channel = silc_idlist_find_channel_by_id(server->local_list,
                                               SILC_ID_GET_ID(id), NULL);
       if (!channel) {
-       SILC_LOG_DEBUG(("Notify for unknown channel"));
+       SILC_LOG_DEBUG(("Notify for unknown channel %s",
+                       silc_id_render(SILC_ID_GET_ID(id), SILC_ID_CHANNEL)));
        goto out;
       }
     }
@@ -1079,7 +1100,8 @@ static void silc_server_notify_process(SilcServer server,
       channel = silc_idlist_find_channel_by_id(server->global_list,
                                               SILC_ID_GET_ID(id), NULL);
       if (!channel) {
-       SILC_LOG_DEBUG(("Notify for unknown channel"));
+       SILC_LOG_DEBUG(("Notify for unknown channel %s",
+                       silc_id_render(SILC_ID_GET_ID(id), SILC_ID_CHANNEL)));
        goto out;
       }
     }
@@ -1208,12 +1230,12 @@ static void silc_server_notify_process(SilcServer server,
 
            /* Get client entry */
            client = silc_idlist_find_client_by_id(server->global_list,
-                                                  SILC_ID_GET_ID(id),
+                                                  SILC_ID_GET_ID(id2),
                                                   TRUE, &cache);
            local = FALSE;
            if (!client) {
              client = silc_idlist_find_client_by_id(server->local_list,
-                                                    SILC_ID_GET_ID(id),
+                                                    SILC_ID_GET_ID(id2),
                                                     TRUE, &cache);
              local = TRUE;
              if (!client)
@@ -1304,7 +1326,8 @@ static void silc_server_notify_process(SilcServer server,
       channel = silc_idlist_find_channel_by_id(server->local_list,
                                               &channel_id, NULL);
       if (!channel) {
-       SILC_LOG_DEBUG(("Notify for unknown channel"));
+       SILC_LOG_DEBUG(("Notify for unknown channel %s",
+                       silc_id_render(SILC_ID_GET_ID(id), SILC_ID_CHANNEL)));
        goto out;
       }
     }
@@ -1564,7 +1587,8 @@ static void silc_server_notify_process(SilcServer server,
       channel = silc_idlist_find_channel_by_id(server->local_list,
                                               SILC_ID_GET_ID(id), NULL);
       if (!channel) {
-       SILC_LOG_DEBUG(("Notify for unknown channel"));
+       SILC_LOG_DEBUG(("Notify for unknown channel %s",
+                       silc_id_render(SILC_ID_GET_ID(id), SILC_ID_CHANNEL)));
        goto out;
       }
     }
@@ -1652,6 +1676,7 @@ static void silc_server_notify_process(SilcServer server,
     break;
 
   default:
+    SILC_LOG_DEBUG(("Unsupported notify %d", type));
     break;
   }
 
@@ -2637,7 +2662,8 @@ static void silc_server_new_id_real(SilcServer server,
         global list. Cell wide information however is kept in the local
         list. */
       entry = silc_idlist_add_client(id_list, NULL, NULL, NULL,
-                                    &id, router, NULL);
+                                    silc_id_dup(&id, SILC_ID_CLIENT),
+                                    router, NULL);
       if (!entry) {
        SILC_LOG_ERROR(("Could not add new client to the ID Cache"));
 
@@ -2716,7 +2742,8 @@ static void silc_server_new_id_real(SilcServer server,
       /* As a router we keep information of all global information in our
         global list. Cell wide information however is kept in the local
         list. */
-      entry = silc_idlist_add_server(id_list, NULL, 0, &id, router,
+      entry = silc_idlist_add_server(id_list, NULL, 0,
+                                    silc_id_dup(&id, SILC_ID_SERVER), router,
                                     router_sock);
       if (!entry) {
        SILC_LOG_ERROR(("Could not add new server to the ID Cache"));
@@ -2958,9 +2985,12 @@ static void silc_server_new_channel_process(SilcServer server,
       }
 
       /* Create the channel with the provided Channel ID */
-      channel = silc_server_create_new_channel_with_id(server, NULL, NULL,
-                                                      channel_name,
-                                                      &channel_id, FALSE);
+      channel =
+       silc_server_create_new_channel_with_id(
+                                    server, NULL, NULL,
+                                    channel_name,
+                                    silc_id_dup(&channel_id, SILC_ID_CHANNEL),
+                                    FALSE);
       if (!channel) {
        silc_channel_payload_free(payload);
        return;
index 16d2298881a375e8e088cd4ed047529175e3df1e..46fccfc085d68ca3bb47b682dd69c7026be39a14 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2005, 2007 Pekka Riikonen
+  Copyright (C) 1997 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
 
 SILC_TASK_CALLBACK(silc_server_get_stats);
 SILC_TASK_CALLBACK(silc_server_connect_router);
+SILC_TASK_CALLBACK(silc_server_connect_to_router_retry);
 SILC_TASK_CALLBACK(silc_server_do_rekey);
 SILC_TASK_CALLBACK(silc_server_purge_expired_clients);
 static void silc_server_accept_new_connection(SilcNetStatus status,
@@ -79,6 +80,9 @@ static SilcBool silc_server_packet_receive(SilcPacketEngine engine,
   SilcServer server = callback_context;
   SilcIDListData idata = stream_context;
 
+  if (!idata)
+    return FALSE;
+
   /* Packets we do not handle */
   switch (packet->type) {
   case SILC_PACKET_HEARTBEAT:
@@ -211,6 +215,33 @@ static void silc_server_packet_eos(SilcPacketEngine engine,
   silc_server_close_connection(server, stream);
 }
 
+SILC_TASK_CALLBACK(silc_server_packet_error_timeout)
+{
+  SilcServer server = app_context;
+  SilcPacketStream stream = context;
+  SilcIDListData idata = silc_packet_get_context(stream);
+
+  if (!idata)
+    return;
+
+  if (server->router_conn && server->router_conn->sock == stream &&
+      !server->router && server->standalone) {
+    silc_server_create_connections(server);
+  } else {
+    /* If backup disconnected then mark that resuming will not be allowed */
+     if (server->server_type == SILC_ROUTER && !server->backup_router &&
+         idata->conn_type == SILC_CONN_SERVER) {
+      SilcServerEntry server_entry = (SilcServerEntry)idata;
+      if (server_entry->server_type == SILC_BACKUP_ROUTER)
+        server->backup_closed = TRUE;
+    }
+
+    silc_server_free_sock_user_data(server, stream, NULL);
+  }
+
+  silc_server_close_connection(server, stream);
+}
+
 /* Packet engine callback to indicate error */
 
 static void silc_server_packet_error(SilcPacketEngine engine,
@@ -219,6 +250,7 @@ static void silc_server_packet_error(SilcPacketEngine engine,
                                     void *callback_context,
                                     void *stream_context)
 {
+  SilcServer server = callback_context;
   SilcIDListData idata = silc_packet_get_context(stream);
   SilcStream sock = silc_packet_stream_get_stream(stream);
   const char *ip;
@@ -230,9 +262,13 @@ static void silc_server_packet_error(SilcPacketEngine engine,
   if (!silc_socket_stream_get_info(sock, NULL, NULL, &ip, &port))
     return;
 
-  SILC_LOG_ERROR(("Connection %s:%d [%s]: %s",
-                 SILC_CONNTYPE_STRING(idata->conn_type), ip, port,
+  SILC_LOG_ERROR(("Connection %s:%d [%s]: %s", ip, port,
+                 SILC_CONNTYPE_STRING(idata->conn_type),
                  silc_packet_error_string(error)));
+
+  silc_schedule_task_add_timeout(server->schedule,
+                                silc_server_packet_error_timeout,
+                                stream, 0, 0);
 }
 
 /* Packet stream callbacks */
@@ -337,11 +373,13 @@ static void silc_server_packet_parse_type(SilcServer server,
 
       status = (SilcStatus)packet->buffer.data[0];
       if (silc_buffer_len(&packet->buffer) > 1 &&
-         silc_utf8_valid(packet->buffer.data + 1, silc_buffer_len(&packet->buffer) - 1))
+         silc_utf8_valid(packet->buffer.data + 1,
+                         silc_buffer_len(&packet->buffer) - 1))
        message = silc_memdup(packet->buffer.data + 1,
                              silc_buffer_len(&packet->buffer) - 1);
 
-      if (!silc_socket_stream_get_info(sock, NULL, &hostname, &ip, NULL))
+      if (!silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
+                                      NULL, &hostname, &ip, NULL))
        break;
 
       SILC_LOG_INFO(("Disconnected by %s (%s): %s (%d) %s", ip, hostname,
@@ -354,21 +392,18 @@ static void silc_server_packet_parse_type(SilcServer server,
       server->backup_noswitch = (status == SILC_STATUS_OK ? FALSE : TRUE);
 
       /* If backup disconnected then mark that resuming will not be allowed */
-#if 0
       if (server->server_type == SILC_ROUTER && !server->backup_router &&
-         sock->type == SILC_CONN_SERVER && sock->user_data) {
-       SilcServerEntry server_entry = sock->user_data;
+         idata->conn_type == SILC_CONN_SERVER) {
+       SilcServerEntry server_entry = (SilcServerEntry)idata;
        if (server_entry->server_type == SILC_BACKUP_ROUTER)
          server->backup_closed = TRUE;
       }
 
       /* Handle the disconnection from our end too */
-      if (sock->user_data && SILC_IS_LOCAL(sock->user_data))
+      if (SILC_IS_LOCAL(idata))
        silc_server_free_sock_user_data(server, sock, NULL);
-      SILC_SET_DISCONNECTING(sock);
       silc_server_close_connection(server, sock);
       server->backup_noswitch = FALSE;
-#endif
     }
     break;
 
@@ -497,9 +532,7 @@ static void silc_server_packet_parse_type(SilcServer server,
        router resuming protocol. */
     if (packet->flags & SILC_PACKET_FLAG_LIST)
       break;
-#if 0
     silc_server_backup_resume_router(server, sock, packet);
-#endif
     break;
 
   default:
@@ -560,6 +593,9 @@ void silc_server_free(SilcServer server)
 {
   SilcList list;
   SilcIDCacheEntry cache;
+  SilcIDListData idata;
+
+  SILC_LOG_DEBUG(("Free server %p", server));
 
   if (!server)
     return;
@@ -574,8 +610,12 @@ void silc_server_free(SilcServer server)
     silc_pkcs_private_key_free(server->private_key);
   if (server->pending_commands)
     silc_dlist_uninit(server->pending_commands);
-  if (server->id_entry)
+  if (server->id_entry) {
+    if (server->id_entry->data.sconn)
+      silc_schedule_task_del_by_context(server->schedule,
+                                       server->id_entry->data.sconn->sock);
     silc_idlist_del_server(server->local_list, server->id_entry);
+  }
 
   /* Delete all channels */
   if (silc_idcache_get_all(server->local_list->channels, &list)) {
@@ -592,24 +632,38 @@ void silc_server_free(SilcServer server)
   /* Delete all clients */
   if (silc_idcache_get_all(server->local_list->clients, &list)) {
     silc_list_start(list);
-    while ((cache = silc_list_get(list)))
+    while ((cache = silc_list_get(list))) {
+      silc_schedule_task_del_by_context(server->schedule, cache->context);
       silc_idlist_del_client(server->local_list, cache->context);
+    }
   }
   if (silc_idcache_get_all(server->global_list->clients, &list)) {
     silc_list_start(list);
-    while ((cache = silc_list_get(list)))
+    while ((cache = silc_list_get(list))) {
+      silc_schedule_task_del_by_context(server->schedule, cache->context);
       silc_idlist_del_client(server->global_list, cache->context);
+    }
   }
 
   /* Delete all servers */
   if (silc_idcache_get_all(server->local_list->servers, &list)) {
     silc_list_start(list);
-    while ((cache = silc_list_get(list)))
+    while ((cache = silc_list_get(list))) {
+      idata = (SilcIDListData)cache->context;
+      if (idata->sconn)
+       silc_schedule_task_del_by_context(server->schedule,
+                                         idata->sconn->sock);
       silc_idlist_del_server(server->local_list, cache->context);
+    }
   }
   if (silc_idcache_get_all(server->global_list->servers, &list)) {
-    while ((cache = silc_list_get(list)))
+    while ((cache = silc_list_get(list))) {
+      idata = (SilcIDListData)cache->context;
+      if (idata->sconn)
+       silc_schedule_task_del_by_context(server->schedule,
+                                         idata->sconn->sock);
       silc_idlist_del_server(server->global_list, cache->context);
+    }
   }
 
   silc_idcache_free(server->local_list->clients);
@@ -629,11 +683,13 @@ void silc_server_free(SilcServer server)
   silc_skr_free(server->repository);
   silc_packet_engine_stop(server->packet_engine);
 
+  silc_schedule_task_del_by_context(server->schedule, server);
+  silc_schedule_uninit(server->schedule);
+  server->schedule = NULL;
+
   silc_free(server->local_list);
   silc_free(server->global_list);
   silc_free(server->server_name);
-  silc_free(server->purge_i);
-  silc_free(server->purge_g);
   silc_free(server);
 
   silc_hmac_unregister_all();
@@ -667,60 +723,19 @@ silc_server_listen(SilcServer server, const char *server_ip, SilcUInt16 port)
 
 SilcBool silc_server_init_secondary(SilcServer server)
 {
-  return TRUE;
-#if 0
-  int sock = 0;
-  SilcPacketStream newsocket = NULL;
   SilcServerConfigServerInfoInterface *interface;
+  SilcNetListener listener;
 
   for (interface = server->config->server_info->secondary; interface;
-       interface = interface->next, sock++) {
-
-    if (!silc_server_listen(server,
-       interface->server_ip, interface->port, &sock_list[sock]))
-      goto err;
-
-    /* Set socket to non-blocking mode */
-    silc_net_set_socket_nonblock(sock_list[sock]);
-
-    /* Add ourselves also to the socket table. The entry allocated above
-       is sent as argument for fast referencing in the future. */
-    silc_socket_alloc(sock_list[sock],
-                     SILC_CONN_SERVER, NULL, &newsocket);
-    server->sockets[sock_list[sock]] = newsocket;
-    SILC_SET_LISTENER(newsocket);
-
-    /* Perform name and address lookups to resolve the listenning address
-       and port. */
-    if (!silc_net_check_local_by_sock(sock_list[sock], &newsocket->hostname,
-                           &newsocket->ip)) {
-      if ((server->config->require_reverse_lookup && !newsocket->hostname) ||
-        !newsocket->ip) {
-        SILC_LOG_ERROR(("IP/DNS lookup failed for local host %s",
-                     newsocket->hostname ? newsocket->hostname :
-                     newsocket->ip ? newsocket->ip : ""));
-        server->stat.conn_failures++;
-        goto err;
-      }
-      if (!newsocket->hostname)
-        newsocket->hostname = strdup(newsocket->ip);
-    }
-    newsocket->port = silc_net_get_local_port(sock);
-
-    newsocket->user_data = (void *)server->id_entry;
-    silc_schedule_task_add(server->schedule, sock_list[sock],
-                          silc_server_accept_new_connection,
-                          (void *)server, 0, 0,
-                          SILC_TASK_FD,
-                          SILC_TASK_PRI_NORMAL);
+       interface = interface->next) {
+    listener = silc_server_listen(server, interface->server_ip,
+                                 interface->port);
+    if (!listener)
+      return FALSE;
+    silc_dlist_add(server->listeners, listener);
   }
 
   return TRUE;
-
- err:
-  do silc_net_close_server(sock_list[sock--]); while (sock >= 0);
-#endif /* 0 */
-  return FALSE;
 }
 
 /* Initializes the entire SILC server. This is called always before running
@@ -734,7 +749,6 @@ SilcBool silc_server_init(SilcServer server)
 {
   SilcServerID *id;
   SilcServerEntry id_entry;
-  SilcIDListPurge purge;
   SilcNetListener listener;
   SilcUInt16 *port;
   char **ip;
@@ -836,13 +850,14 @@ SilcBool silc_server_init(SilcServer server)
                   server->config->server_info->primary->port);
   if (!listener)
     goto err;
-
   silc_dlist_add(server->listeners, listener);
 
   /* Create a Server ID for the server. */
   port = silc_net_listener_get_port(listener, NULL);
   ip = silc_net_listener_get_ip(listener, NULL);
-  silc_id_create_server_id(ip[0], port[0], server->rng, &id);
+  silc_id_create_server_id(server->config->server_info->primary->public_ip ?
+                          server->config->server_info->primary->public_ip :
+                          ip[0], port[0], server->rng, &id);
   if (!id)
     goto err;
 
@@ -862,12 +877,16 @@ SilcBool silc_server_init(SilcServer server)
      the ID list. */
   id_entry =
     silc_idlist_add_server(server->local_list, strdup(server->server_name),
-                          server->server_type, server->id, NULL, NULL);
+                          server->server_type,
+                          silc_id_dup(server->id, SILC_ID_SERVER),
+                          NULL, NULL);
   if (!id_entry) {
     SILC_LOG_ERROR(("Could not add local server to cache"));
     goto err;
   }
   id_entry->data.status |= SILC_IDLIST_STATUS_REGISTERED;
+  id_entry->data.conn_type = (server->server_type == SILC_SERVER ?
+                             SILC_CONN_SERVER : SILC_CONN_ROUTER);
   server->id_entry = id_entry;
 
   /* Create secondary TCP listeners */
@@ -896,23 +915,6 @@ SilcBool silc_server_init(SilcServer server)
     }
   }
 
-  /* Register the ID Cache purge task. This periodically purges the ID cache
-     and removes the expired cache entries. */
-
-  /* Clients local list */
-  server->purge_i = purge = silc_calloc(1, sizeof(*purge));
-  purge->cache = server->local_list->clients;
-  purge->timeout = 600;
-  silc_schedule_task_add_timeout(server->schedule, silc_idlist_purge,
-                                (void *)purge, purge->timeout, 0);
-
-  /* Clients global list */
-  server->purge_g = purge = silc_calloc(1, sizeof(*purge));
-  purge->cache = server->global_list->clients;
-  purge->timeout = 300;
-  silc_schedule_task_add_timeout(server->schedule, silc_idlist_purge,
-                                (void *)purge, purge->timeout, 0);
-
   /* If we are normal server we'll retrieve network statisticial information
      once in a while from the router. */
   if (server->server_type != SILC_ROUTER)
@@ -932,7 +934,7 @@ SilcBool silc_server_init(SilcServer server)
   /* Register client entry expiration timeout */
   silc_schedule_task_add_timeout(server->schedule,
                                 silc_server_purge_expired_clients, server,
-                                600, 0);
+                                120, 0);
 
   /* Initialize HTTP server */
   silc_server_http_init(server);
@@ -947,32 +949,28 @@ SilcBool silc_server_init(SilcServer server)
   return FALSE;
 }
 
-#if 0
 /* Task callback to close a socket connection after rehash */
 
 SILC_TASK_CALLBACK(silc_server_rehash_close_connection)
 {
-  SilcServer server = context;
-  SilcPacketStream sock = server->sockets[fd];
+  SilcServer server = app_context;
+  SilcPacketStream sock = context;
+  SilcIDListData idata = silc_packet_get_context(sock);
+  const char *hostname;
+  SilcUInt16 port;
 
-  if (!sock)
-    return;
+  silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
+                             NULL, &hostname, NULL, &port);
 
   SILC_LOG_INFO(("Connection %s:%d [%s] is unconfigured",
-                sock->hostname, sock->port,
-                (sock->type == SILC_CONN_UNKNOWN ? "Unknown" :
-                 sock->type == SILC_CONN_CLIENT ? "Client" :
-                 sock->type == SILC_CONN_SERVER ? "Server" :
-                 "Router")));
+                hostname, port, SILC_CONNTYPE_STRING(idata->conn_type)));
   silc_schedule_task_del_by_context(server->schedule, sock);
   silc_server_disconnect_remote(server, sock,
                                SILC_STATUS_ERR_BANNED_FROM_SERVER,
                                "This connection is removed from "
                                "configuration");
-  if (sock->user_data)
-    silc_server_free_sock_user_data(server, sock, NULL);
+  silc_server_free_sock_user_data(server, sock, NULL);
 }
-#endif /* 0 */
 
 /* This function basically reads the config file again and switches the config
    object pointed by the server object. After that, we have to fix various
@@ -981,7 +979,6 @@ SILC_TASK_CALLBACK(silc_server_rehash_close_connection)
 
 SilcBool silc_server_rehash(SilcServer server)
 {
-#if 0
   SilcServerConfig newconfig;
 
   SILC_LOG_INFO(("Rehashing server"));
@@ -997,12 +994,6 @@ SilcBool silc_server_rehash(SilcServer server)
     return FALSE;
   }
 
-  /* Reinit scheduler if necessary */
-  if (newconfig->param.connections_max > server->config->param.connections_max)
-    if (!silc_schedule_reinit(server->schedule,
-                             newconfig->param.connections_max))
-      return FALSE;
-
   /* Fix the server_name field */
   if (strcmp(server->server_name, newconfig->server_info->server_name)) {
     silc_free(server->server_name);
@@ -1021,13 +1012,10 @@ SilcBool silc_server_rehash(SilcServer server)
     /* Update the idcache list with a fresh pointer */
     silc_free(server->id_entry->server_name);
     server->id_entry->server_name = strdup(server->server_name);
-    if (!silc_idcache_del_by_context(server->local_list->servers,
-                                    server->id_entry))
-      return FALSE;
-    if (!silc_idcache_add(server->local_list->servers,
-                         strdup(server->id_entry->server_name),
-                         server->id_entry->id, server->id_entry, 0, NULL))
-      return FALSE;
+    silc_idcache_update_by_context(server->local_list->servers,
+                                  server->id_entry, NULL,
+                                  strdup(server->id_entry->server_name),
+                                  TRUE);
   }
 
   /* Set logging */
@@ -1043,13 +1031,6 @@ SilcBool silc_server_rehash(SilcServer server)
     server->private_key = newconfig->server_info->private_key;
     newconfig->server_info->public_key = NULL;
     newconfig->server_info->private_key = NULL;
-
-    /* Allocate PKCS context for local public and private keys */
-    silc_pkcs_free(server->pkcs);
-    if (!silc_pkcs_alloc(server->public_key->name, &server->pkcs))
-      return FALSE;
-    silc_pkcs_public_key_set(server->pkcs, server->public_key);
-    silc_pkcs_private_key_set(server->pkcs, server->private_key);
   }
 
   /* Check for unconfigured server and router connections and close
@@ -1078,11 +1059,10 @@ SilcBool silc_server_rehash(SilcServer server)
        SilcPacketStream sock;
        sock = silc_server_find_socket_by_host(server, SILC_CONN_ROUTER,
                                               ptr->host, ptr->port);
-       if (sock && !SILC_IS_LISTENER(sock))
-         silc_schedule_task_add(server->schedule, sock->sock,
-                                silc_server_rehash_close_connection,
-                                server, 0, 1, SILC_TASK_TIMEOUT,
-                                SILC_TASK_PRI_NORMAL);
+       if (sock)
+         silc_schedule_task_add_timeout(server->schedule,
+                                        silc_server_rehash_close_connection,
+                                        sock, 0, 1);
       }
     }
   }
@@ -1108,11 +1088,10 @@ SilcBool silc_server_rehash(SilcServer server)
        SilcPacketStream sock;
        sock = silc_server_find_socket_by_host(server, SILC_CONN_SERVER,
                                               ptr->host, 0);
-       if (sock && !SILC_IS_LISTENER(sock))
-         silc_schedule_task_add(server->schedule, sock->sock,
-                                silc_server_rehash_close_connection,
-                                server, 0, 1, SILC_TASK_TIMEOUT,
-                                SILC_TASK_PRI_NORMAL);
+       if (sock)
+         silc_schedule_task_add_timeout(server->schedule,
+                                        silc_server_rehash_close_connection,
+                                        sock, 0, 1);
       }
     }
   }
@@ -1139,10 +1118,9 @@ SilcBool silc_server_rehash(SilcServer server)
        sock = silc_server_find_socket_by_host(server, SILC_CONN_CLIENT,
                                               ptr->host, 0);
        if (sock)
-         silc_schedule_task_add(server->schedule, sock->sock,
-                                silc_server_rehash_close_connection,
-                                server, 0, 1, SILC_TASK_TIMEOUT,
-                                SILC_TASK_PRI_NORMAL);
+         silc_schedule_task_add_timeout(server->schedule,
+                                        silc_server_rehash_close_connection,
+                                        sock, 0, 1);
       }
     }
   }
@@ -1185,7 +1163,6 @@ SilcBool silc_server_rehash(SilcServer server)
 #endif /* SILC_DEBUG */
 
   SILC_LOG_DEBUG(("Server rehashed"));
-#endif /* 0 */
 
   return TRUE;
 }
@@ -1233,7 +1210,7 @@ void silc_server_stop(SilcServer server)
       silc_server_free_sock_user_data(server, ps,
                                      "Server is shutting down");
     }
-    silc_dlist_uninit(list);
+    silc_packet_engine_free_streams_list(list);
   }
 
   /* We are not connected to network anymore */
@@ -1245,9 +1222,13 @@ void silc_server_stop(SilcServer server)
 
   silc_server_http_uninit(server);
 
+  /* Cancel any possible retry timeouts */
+  silc_schedule_task_del_by_callback(server->schedule,
+                                    silc_server_connect_router);
+  silc_schedule_task_del_by_callback(server->schedule,
+                                    silc_server_connect_to_router_retry);
+
   silc_schedule_stop(server->schedule);
-  silc_schedule_uninit(server->schedule);
-  server->schedule = NULL;
 
   SILC_LOG_DEBUG(("Server stopped"));
 }
@@ -1259,6 +1240,7 @@ SILC_TASK_CALLBACK(silc_server_purge_expired_clients)
   SilcServer server = context;
   SilcClientEntry client;
   SilcIDList id_list;
+  SilcUInt64 curtime = silc_time();
 
   SILC_LOG_DEBUG(("Expire timeout"));
 
@@ -1267,6 +1249,12 @@ SILC_TASK_CALLBACK(silc_server_purge_expired_clients)
     if (client->data.status & SILC_IDLIST_STATUS_REGISTERED)
       continue;
 
+    /* For unregistered clients the created timestamp is actually
+       unregistered timestamp.  Make sure client remains in history
+       at least 500 seconds. */
+    if (curtime - client->data.created < 500)
+      continue;
+
     id_list = (client->data.status & SILC_IDLIST_STATUS_LOCAL ?
               server->local_list : server->global_list);
 
@@ -1277,7 +1265,7 @@ SILC_TASK_CALLBACK(silc_server_purge_expired_clients)
 
   silc_schedule_task_add_timeout(server->schedule,
                                 silc_server_purge_expired_clients, server,
-                                600, 0);
+                                120, 0);
 }
 
 
@@ -1285,8 +1273,9 @@ SILC_TASK_CALLBACK(silc_server_purge_expired_clients)
 
 /* Free connection context */
 
-static void silc_server_connection_free(SilcServerConnection sconn)
+void silc_server_connection_free(SilcServerConnection sconn)
 {
+  SILC_LOG_DEBUG(("Free connection %p", sconn));
   silc_dlist_del(sconn->server->conns, sconn);
   silc_server_config_unref(&sconn->conn);
   silc_free(sconn->remote_host);
@@ -1298,6 +1287,7 @@ static void silc_server_connection_free(SilcServerConnection sconn)
 
 void silc_server_create_connection(SilcServer server,
                                   SilcBool reconnect,
+                                  SilcBool dynamic,
                                   const char *remote_host, SilcUInt32 port,
                                   SilcServerConnectCallback callback,
                                   void *context)
@@ -1313,6 +1303,10 @@ void silc_server_create_connection(SilcServer server,
   sconn->no_reconnect = reconnect == FALSE;
   sconn->callback = callback;
   sconn->callback_context = context;
+  sconn->no_conf = dynamic;
+  sconn->server = server;
+
+  SILC_LOG_DEBUG(("Created connection %p", sconn));
 
   silc_schedule_task_add_timeout(server->schedule, silc_server_connect_router,
                                 sconn, 0, 0);
@@ -1330,22 +1324,31 @@ silc_server_ke_auth_compl(SilcConnAuth connauth, SilcBool success,
   SilcServerConfigServer *conn;
   SilcServerConfigConnParams *param;
   SilcIDListData idata;
-  SilcServerEntry id_entry;
+  SilcServerEntry id_entry = NULL;
   unsigned char id[32];
   SilcUInt32 id_len;
   SilcID remote_id;
+  const char *ip;
 
   SILC_LOG_DEBUG(("Connection authentication completed"));
 
+  sconn->op = NULL;
+
   if (success == FALSE) {
     /* Authentication failed */
     /* XXX retry connecting */
 
     silc_server_disconnect_remote(server, sconn->sock,
                                  SILC_STATUS_ERR_AUTH_FAILED, NULL);
+    if (sconn->callback)
+      (*sconn->callback)(server, NULL, sconn->callback_context);
+    silc_server_connection_free(sconn);
     return;
   }
 
+  /* XXX For now remote is router always */
+  entry->data.conn_type = SILC_CONN_ROUTER;
+
   SILC_LOG_INFO(("Connected to %s %s",
                 SILC_CONNTYPE_STRING(entry->data.conn_type),
                 sconn->remote_host));
@@ -1363,6 +1366,8 @@ silc_server_ke_auth_compl(SilcConnAuth connauth, SilcBool success,
     if (!id_entry) {
       silc_server_disconnect_remote(server, sconn->sock,
                                    SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
+      if (sconn->callback)
+       (*sconn->callback)(server, NULL, sconn->callback_context);
       silc_server_connection_free(sconn);
       silc_free(entry);
       return;
@@ -1385,6 +1390,8 @@ silc_server_ke_auth_compl(SilcConnAuth connauth, SilcBool success,
                             SILC_STR_END)) {
       silc_server_disconnect_remote(server, sconn->sock,
                                    SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
+      if (sconn->callback)
+       (*sconn->callback)(server, NULL, sconn->callback_context);
       silc_server_connection_free(sconn);
       silc_free(entry);
       return;
@@ -1415,11 +1422,15 @@ silc_server_ke_auth_compl(SilcConnAuth connauth, SilcBool success,
        as NULL since it's local to us. */
     id_entry = silc_idlist_add_server(server->global_list,
                                      strdup(sconn->remote_host),
-                                     SILC_ROUTER, &remote_id.u.server_id,
+                                     SILC_ROUTER,
+                                     silc_id_dup(&remote_id.u.server_id,
+                                                 SILC_ID_SERVER),
                                      NULL, sconn->sock);
     if (!id_entry) {
       silc_server_disconnect_remote(server, sconn->sock,
                                    SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
+      if (sconn->callback)
+       (*sconn->callback)(server, NULL, sconn->callback_context);
       silc_server_connection_free(sconn);
       silc_free(entry);
       return;
@@ -1427,9 +1438,10 @@ silc_server_ke_auth_compl(SilcConnAuth connauth, SilcBool success,
 
     /* Registered */
     silc_idlist_add_data(id_entry, (SilcIDListData)entry);
-    idata = (SilcIDListData)entry;
+    idata = (SilcIDListData)id_entry;
     idata->status |= (SILC_IDLIST_STATUS_REGISTERED |
                      SILC_IDLIST_STATUS_LOCAL);
+    idata->sconn = sconn;
 
     if (!sconn->backup) {
       /* Mark this router our primary router if we're still standalone */
@@ -1459,12 +1471,27 @@ silc_server_ke_auth_compl(SilcConnAuth connauth, SilcBool success,
          silc_server_announce_channels(server, 0, SILC_PRIMARY_ROUTE(server));
        }
 
-#if 0
        /* If we are backup router then this primary router is whom we are
           backing up. */
-       if (server->server_type == SILC_BACKUP_ROUTER)
-         silc_server_backup_add(server, server->id_entry, sock->ip,
+       if (server->server_type == SILC_BACKUP_ROUTER) {
+         silc_socket_stream_get_info(silc_packet_stream_get_stream(sconn->
+                                                                   sock),
+                                     NULL, NULL, &ip, NULL);
+         silc_server_backup_add(server, server->id_entry, ip,
                                 sconn->remote_port, TRUE);
+       }
+#if 0
+      } else {
+       /* We already have primary router.  Disconnect this connection */
+       SILC_LOG_DEBUG(("We already have primary router, disconnect"));
+       silc_idlist_del_server(server->global_list, id_entry);
+       silc_server_disconnect_remote(server, sconn->sock,
+                                     SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
+       if (sconn->callback)
+         (*sconn->callback)(server, NULL, sconn->callback_context);
+       silc_server_connection_free(sconn);
+       silc_free(entry);
+       return;
 #endif /* 0 */
       }
     } else {
@@ -1479,11 +1506,15 @@ silc_server_ke_auth_compl(SilcConnAuth connauth, SilcBool success,
   default:
     silc_server_disconnect_remote(server, sconn->sock,
                                  SILC_STATUS_ERR_AUTH_FAILED, NULL);
+    if (sconn->callback)
+      (*sconn->callback)(server, NULL, sconn->callback_context);
     silc_server_connection_free(sconn);
     silc_free(entry);
     return;
   }
 
+  SILC_LOG_DEBUG(("Connection established, sock %p", sconn->sock));
+
   conn = sconn->conn.ref_ptr;
   param = &server->config->param;
   if (conn && conn->param)
@@ -1494,11 +1525,8 @@ silc_server_ke_auth_compl(SilcConnAuth connauth, SilcBool success,
   silc_schedule_task_add_timeout(server->schedule, silc_server_do_rekey,
                                 sconn->sock, sconn->rekey_timeout, 0);
 
-#if 0
-  /* Perform keepalive. */
-  silc_socket_set_heartbeat(sock, param->keepalive_secs, server,
-                           silc_server_perform_heartbeat,
-                           server->schedule);
+  /* Set the entry as packet stream context */
+  silc_packet_set_context(sconn->sock, id_entry);
 
  out:
   /* Call the completion callback to indicate that we've connected to
@@ -1506,16 +1534,8 @@ silc_server_ke_auth_compl(SilcConnAuth connauth, SilcBool success,
   if (sconn && sconn->callback)
     (*sconn->callback)(server, id_entry, sconn->callback_context);
 
-  /* Free the temporary connection data context */
-  if (sconn) {
-    silc_server_config_unref(&sconn->conn);
-    silc_free(sconn->remote_host);
-    silc_free(sconn->backup_replace_ip);
-    silc_free(sconn);
-  }
   if (sconn == server->router_conn)
     server->router_conn = NULL;
-#endif /* 0 */
 
   silc_free(entry);
 }
@@ -1528,8 +1548,9 @@ static void silc_server_ke_completed(SilcSKE ske, SilcSKEStatus status,
                                     SilcSKERekeyMaterial rekey,
                                     void *context)
 {
-  SilcServerConnection sconn = context;
-  SilcUnknownEntry entry = silc_packet_get_context(sconn->sock);
+  SilcPacketStream sock = context;
+  SilcUnknownEntry entry = silc_packet_get_context(sock);
+  SilcServerConnection sconn = silc_ske_get_context(ske);
   SilcServer server = entry->server;
   SilcServerConfigRouter *conn = sconn->conn.ref_ptr;
   SilcAuthMethod auth_meth = SILC_AUTH_NONE;
@@ -1540,6 +1561,8 @@ static void silc_server_ke_completed(SilcSKE ske, SilcSKEStatus status,
   SilcHmac hmac_send, hmac_receive;
   SilcHash hash;
 
+  sconn->op = NULL;
+
   if (status != SILC_SKE_STATUS_OK) {
     /* SKE failed */
     SILC_LOG_ERROR(("Error (%s) during Key Exchange protocol with %s (%s)",
@@ -1549,6 +1572,8 @@ static void silc_server_ke_completed(SilcSKE ske, SilcSKEStatus status,
     silc_ske_free(ske);
     silc_server_disconnect_remote(server, sconn->sock,
                                  SILC_STATUS_ERR_KEY_EXCHANGE_FAILED, NULL);
+    if (sconn->callback)
+      (*sconn->callback)(server, NULL, sconn->callback_context);
     silc_server_connection_free(sconn);
     return;
   }
@@ -1565,6 +1590,8 @@ static void silc_server_ke_completed(SilcSKE ske, SilcSKEStatus status,
     silc_ske_free(ske);
     silc_server_disconnect_remote(server, sconn->sock,
                                  SILC_STATUS_ERR_KEY_EXCHANGE_FAILED, NULL);
+    if (sconn->callback)
+      (*sconn->callback)(server, NULL, sconn->callback_context);
     silc_server_connection_free(sconn);
     return;
   }
@@ -1582,6 +1609,8 @@ static void silc_server_ke_completed(SilcSKE ske, SilcSKEStatus status,
     silc_ske_free(ske);
     silc_server_disconnect_remote(server, sconn->sock,
                                  SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
+    if (sconn->callback)
+      (*sconn->callback)(server, NULL, sconn->callback_context);
     silc_server_connection_free(sconn);
     return;
   }
@@ -1603,11 +1632,14 @@ static void silc_server_ke_completed(SilcSKE ske, SilcSKEStatus status,
     }
   }
 
+  entry->data.rekey = rekey;
+
   /* Start connection authentication */
-  silc_connauth_initiator(connauth, server->server_type == SILC_ROUTER ?
-                         SILC_CONN_ROUTER : SILC_CONN_SERVER, auth_meth,
-                         auth_data, auth_data_len,
-                         silc_server_ke_auth_compl, sconn);
+  sconn->op =
+    silc_connauth_initiator(connauth, server->server_type == SILC_SERVER ?
+                           SILC_CONN_SERVER : SILC_CONN_ROUTER, auth_meth,
+                           auth_data, auth_data_len,
+                           silc_server_ke_auth_compl, sconn);
 }
 
 /* Function that is called when the network connection to a router has
@@ -1631,6 +1663,8 @@ void silc_server_start_key_exchange(SilcServerConnection sconn)
   if (!sconn->sock) {
     SILC_LOG_ERROR(("Cannot connect: cannot create packet stream"));
     silc_stream_destroy(sconn->stream);
+    if (sconn->callback)
+      (*sconn->callback)(server, NULL, sconn->callback_context);
     silc_server_connection_free(sconn);
     return;
   }
@@ -1640,6 +1674,8 @@ void silc_server_start_key_exchange(SilcServerConnection sconn)
   if (!silc_packet_set_ids(sconn->sock, SILC_ID_SERVER, server->id,
                           0, NULL)) {
     silc_packet_stream_destroy(sconn->sock);
+    if (sconn->callback)
+      (*sconn->callback)(server, NULL, sconn->callback_context);
     silc_server_connection_free(sconn);
     return;
   }
@@ -1664,10 +1700,12 @@ void silc_server_start_key_exchange(SilcServerConnection sconn)
   /* Start SILC Key Exchange protocol */
   SILC_LOG_DEBUG(("Starting key exchange protocol"));
   ske = silc_ske_alloc(server->rng, server->schedule, server->repository,
-                      server->public_key, server->private_key, sconn->sock);
+                      server->public_key, server->private_key, sconn);
   if (!ske) {
     silc_free(entry);
     silc_packet_stream_destroy(sconn->sock);
+    if (sconn->callback)
+      (*sconn->callback)(server, NULL, sconn->callback_context);
     silc_server_connection_free(sconn);
     return;
   }
@@ -1677,7 +1715,7 @@ void silc_server_start_key_exchange(SilcServerConnection sconn)
   /* Start key exchange protocol */
   params.version = silc_version_string;
   params.timeout_secs = server->config->key_exchange_timeout;
-  silc_ske_initiator(ske, sconn->sock, &params, NULL);
+  sconn->op = silc_ske_initiator(ske, sconn->sock, &params, NULL);
 }
 
 /* Timeout callback that will be called to retry connecting to remote
@@ -1712,6 +1750,9 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router_retry)
   if ((sconn->retry_count > param->reconnect_count) &&
       !param->reconnect_keep_trying) {
     SILC_LOG_ERROR(("Could not connect, giving up"));
+
+    if (sconn->callback)
+      (*sconn->callback)(server, NULL, sconn->callback_context);
     silc_server_connection_free(sconn);
     return;
   }
@@ -1754,6 +1795,9 @@ static void silc_server_connection_established(SilcNetStatus status,
     SILC_LOG_ERROR(("Could not connect to %s:%d: %s",
                    sconn->remote_host, sconn->remote_port,
                    silc_net_get_error_string(status)));
+
+    if (sconn->callback)
+      (*sconn->callback)(server, NULL, sconn->callback_context);
     silc_server_connection_free(sconn);
     break;
 
@@ -1765,7 +1809,10 @@ static void silc_server_connection_established(SilcNetStatus status,
       silc_schedule_task_add_timeout(sconn->server->schedule,
                                     silc_server_connect_to_router_retry,
                                     sconn, 1, 0);
+      silc_dlist_del(server->conns, sconn);
     } else {
+      if (sconn->callback)
+       (*sconn->callback)(server, NULL, sconn->callback_context);
       silc_server_connection_free(sconn);
     }
     break;
@@ -1784,6 +1831,8 @@ SILC_TASK_CALLBACK(silc_server_connect_router)
 
   /* Don't connect if we are shutting down. */
   if (server->server_shutdown) {
+    if (sconn->callback)
+      (*sconn->callback)(server, NULL, sconn->callback_context);
     silc_server_connection_free(sconn);
     return;
   }
@@ -1792,7 +1841,7 @@ SILC_TASK_CALLBACK(silc_server_connect_router)
                 (sconn->backup ? "backup router" : "router"),
                 sconn->remote_host, sconn->remote_port));
 
-  if (!server->no_conf) {
+  if (!sconn->no_conf) {
     /* Find connection configuration */
     rconn = silc_server_config_find_router_conn(server, sconn->remote_host,
                                                sconn->remote_port);
@@ -1844,7 +1893,6 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router)
                   "normal server" : server->server_type == SILC_ROUTER ?
                   "router" : "backup router/normal server")));
 
-  /* XXX */
   if (!server->config->routers) {
     /* There wasn't a configured router, we will continue but we don't
        have a connection to outside world.  We will be standalone server. */
@@ -1853,6 +1901,12 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router)
     return;
   }
 
+  /* Cancel any possible retry timeouts */
+  silc_schedule_task_del_by_callback(server->schedule,
+                                    silc_server_connect_router);
+  silc_schedule_task_del_by_callback(server->schedule,
+                                    silc_server_connect_to_router_retry);
+
   /* Create the connections to all our routes */
   for (ptr = server->config->routers; ptr; ptr = ptr->next) {
 
@@ -1868,13 +1922,16 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router)
 
     if (!ptr->initiator)
       continue;
+    if (ptr->dynamic_connection)
+      continue;
 
     /* Check whether we are connecting or connected to this host already */
     if (silc_server_num_sockets_by_remote(server,
                                          silc_net_is_ip(ptr->host) ?
                                          ptr->host : NULL,
                                          silc_net_is_ip(ptr->host) ?
-                                         NULL : ptr->host, ptr->port)) {
+                                         NULL : ptr->host, ptr->port,
+                                         SILC_CONN_ROUTER)) {
       SILC_LOG_DEBUG(("We are already connected to %s:%d",
                      ptr->host, ptr->port));
 
@@ -1892,11 +1949,8 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router)
        if (!sock)
          continue;
        server->backup_noswitch = TRUE;
-#if 0
-       if (sock->user_data)
-         silc_server_free_sock_user_data(server, sock, NULL);
+       silc_server_free_sock_user_data(server, sock, NULL);
        silc_server_disconnect_remote(server, sock, 0, NULL);
-#endif /* 0 */
        server->backup_noswitch = FALSE;
        SILC_LOG_DEBUG(("Reconnecting to primary router"));
       } else {
@@ -1908,6 +1962,7 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router)
     sconn = silc_calloc(1, sizeof(*sconn));
     if (!sconn)
       continue;
+    sconn->server = server;
     sconn->remote_host = strdup(ptr->host);
     sconn->remote_port = ptr->port;
     sconn->backup = ptr->backup_router;
@@ -1916,7 +1971,8 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router)
       sconn->backup_replace_port = ptr->backup_replace_port;
     }
 
-    /* XXX */
+    SILC_LOG_DEBUG(("Created connection %p", sconn));
+
     if (!server->router_conn && !sconn->backup)
       server->router_conn = sconn;
 
@@ -1972,7 +2028,13 @@ silc_server_accept_get_auth(SilcConnAuth connauth,
 
   /* Remote end is server */
   if (conn_type == SILC_CONN_SERVER) {
-    SilcServerConfigServer *sconfig = entry->sconfig.ref_ptr;
+    SilcServerConfigServer *sconfig;
+
+    /* If we are normal server, don't accept the connection */
+    if (server->server_type == SILC_SERVER)
+      return FALSE;
+
+    sconfig = entry->sconfig.ref_ptr;
     if (!sconfig)
       return FALSE;
 
@@ -2016,11 +2078,12 @@ silc_server_accept_auth_compl(SilcConnAuth connauth, SilcBool success,
   SilcServerConfigConnParams *param = &server->config->param;
   SilcServerConnection sconn;
   void *id_entry;
-  const char *hostname;
+  const char *hostname, *ip;
   SilcUInt16 port;
 
+  entry->op = NULL;
   silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
-                             NULL, &hostname, NULL, &port);
+                             NULL, &hostname, &ip, &port);
 
   if (success == FALSE) {
     /* Authentication failed */
@@ -2140,7 +2203,7 @@ silc_server_accept_auth_compl(SilcConnAuth connauth, SilcBool success,
       SilcBool backup_router = FALSE;
       char *backup_replace_ip = NULL;
       SilcUInt16 backup_replace_port = 0;
-      SilcServerConfigServer *sconn = entry->sconfig.ref_ptr;
+      SilcServerConfigServer *srvconn = entry->sconfig.ref_ptr;
       SilcServerConfigRouter *rconn = entry->rconfig.ref_ptr;
 
       /* If we are backup router and this is incoming server connection
@@ -2199,14 +2262,14 @@ silc_server_accept_auth_compl(SilcConnAuth connauth, SilcBool success,
        if (!silc_server_connection_allowed(server, sock,
                                            entry->data.conn_type,
                                            &server->config->param,
-                                           sconn ? sconn->param : NULL,
+                                           srvconn ? srvconn->param : NULL,
                                            silc_connauth_get_ske(connauth))) {
          server->stat.auth_failures++;
          goto out;
        }
-       if (sconn) {
-         if (sconn->param) {
-           param = sconn->param;
+       if (srvconn) {
+         if (srvconn->param) {
+           param = srvconn->param;
 
            if (!param->keepalive_secs)
              param->keepalive_secs = server->config->param.keepalive_secs;
@@ -2220,14 +2283,13 @@ silc_server_accept_auth_compl(SilcConnAuth connauth, SilcBool success,
            }
          }
 
-         backup_router = sconn->backup_router;
+         backup_router = srvconn->backup_router;
        }
       }
 
       /* If we are primary router and we have backup router configured
         but it has not connected to use yet, do not accept any other
         connection. */
-#if 0
       if (server->wait_backup && server->server_type == SILC_ROUTER &&
          !server->backup_router && !backup_router) {
        SilcServerConfigRouter *router;
@@ -2252,7 +2314,6 @@ silc_server_accept_auth_compl(SilcConnAuth connauth, SilcBool success,
          goto out;
        }
       }
-#endif /* 0 */
 
       SILC_LOG_DEBUG(("Remote host is %s",
                      entry->data.conn_type == SILC_CONN_SERVER ?
@@ -2313,9 +2374,11 @@ silc_server_accept_auth_compl(SilcConnAuth connauth, SilcBool success,
       if (entry->data.conn_type == SILC_CONN_SERVER) {
        server->stat.my_servers++;
        server->stat.servers++;
+       SILC_LOG_DEBUG(("my_servers %d", server->stat.my_servers));
       } else {
        server->stat.my_routers++;
        server->stat.routers++;
+       SILC_LOG_DEBUG(("my_routers %d", server->stat.my_routers));
       }
 
       /* Check whether this connection is to be our primary router connection
@@ -2357,15 +2420,7 @@ silc_server_accept_auth_compl(SilcConnAuth connauth, SilcBool success,
   silc_packet_set_context(sock, id_entry);
 
   /* Connection has been fully established now. Everything is ok. */
-  SILC_LOG_DEBUG(("New connection authenticated"));
-
-#if 0
-  /* Perform keepalive. */
-  if (param->keepalive_secs)
-    silc_socket_set_heartbeat(sock, param->keepalive_secs, server,
-                             silc_server_perform_heartbeat,
-                             server->schedule);
-#endif
+  SILC_LOG_DEBUG(("New connection %p authenticated", sconn));
 
   /* Perform Quality of Service */
   if (param->qos)
@@ -2400,6 +2455,10 @@ silc_server_accept_completed(SilcSKE ske, SilcSKEStatus status,
   SilcCipher send_key, receive_key;
   SilcHmac hmac_send, hmac_receive;
   SilcHash hash;
+  unsigned char *pk;
+  SilcUInt32 pk_len;
+
+  entry->op = NULL;
 
   if (status != SILC_SKE_STATUS_OK) {
     /* SKE failed */
@@ -2427,6 +2486,8 @@ silc_server_accept_completed(SilcSKE ske, SilcSKEStatus status,
 
   idata->rekey = rekey;
   idata->public_key = silc_pkcs_public_key_copy(prop->public_key);
+  pk = silc_pkcs_public_key_encode(idata->public_key, &pk_len);
+  silc_hash_make(server->sha1hash, pk, pk_len, idata->fingerprint);
 
   SILC_LOG_DEBUG(("Starting connection authentication"));
   server->stat.auth_attempts++;
@@ -2442,8 +2503,9 @@ silc_server_accept_completed(SilcSKE ske, SilcSKEStatus status,
   }
 
   /* Start connection authentication */
-  silc_connauth_responder(connauth, silc_server_accept_get_auth,
-                         silc_server_accept_auth_compl, sock);
+  entry->op =
+    silc_connauth_responder(connauth, silc_server_accept_get_auth,
+                           silc_server_accept_auth_compl, sock);
 }
 
 /* Accept new TCP connection */
@@ -2548,6 +2610,7 @@ static void silc_server_accept_new_connection(SilcNetStatus status,
   entry->ip = ip;
   entry->port = port;
   entry->server = server;
+  entry->data.conn_type = SILC_CONN_UNKNOWN;
   silc_packet_set_context(packet_stream, entry);
 
   silc_server_config_ref(&entry->cconfig, server->config, cconfig);
@@ -2584,7 +2647,7 @@ static void silc_server_accept_new_connection(SilcNetStatus status,
   /* Start key exchange protocol */
   params.version = silc_version_string;
   params.timeout_secs = server->config->key_exchange_timeout;
-  silc_ske_responder(ske, packet_stream, &params);
+  entry->op = silc_ske_responder(ske, packet_stream, &params);
 }
 
 
@@ -2631,6 +2694,8 @@ SILC_TASK_CALLBACK(silc_server_do_rekey)
   SilcIDListData idata = silc_packet_get_context(sock);
   SilcSKE ske;
 
+  SILC_LOG_DEBUG(("Perform rekey, sock %p", sock));
+
   /* Do not execute rekey with disabled connections */
   if (idata->status & SILC_IDLIST_STATUS_DISABLED)
     return;
@@ -2648,8 +2713,8 @@ SILC_TASK_CALLBACK(silc_server_do_rekey)
                  SILC_CONNTYPE_STRING(idata->conn_type)));
 
   /* Allocate SKE */
-  ske = silc_ske_alloc(server->rng, server->schedule, server->repository,
-                      server->public_key, server->private_key, sock);
+  ske = silc_ske_alloc(server->rng, server->schedule, NULL,
+                      server->public_key, NULL, sock);
   if (!ske)
     return;
 
@@ -2701,8 +2766,8 @@ static void silc_server_rekey(SilcServer server, SilcPacketStream sock,
                  SILC_CONNTYPE_STRING(idata->conn_type)));
 
   /* Allocate SKE */
-  ske = silc_ske_alloc(server->rng, server->schedule, server->repository,
-                      server->public_key, server->private_key, sock);
+  ske = silc_ske_alloc(server->rng, server->schedule, NULL,
+                      server->public_key, NULL, sock);
   if (!ske) {
     silc_packet_free(packet);
     return;
@@ -2736,20 +2801,6 @@ void silc_server_close_connection(SilcServer server,
   const char *hostname;
   SilcUInt16 port;
 
-#if 0
-  /* If any protocol is active cancel its execution. It will call
-     the final callback which will finalize the disconnection. */
-  if (sock->protocol && sock->protocol->protocol &&
-      sock->protocol->protocol->type != SILC_PROTOCOL_SERVER_BACKUP) {
-    SILC_LOG_DEBUG(("Cancelling protocol, calling final callback"));
-    silc_protocol_cancel(sock->protocol, server->schedule);
-    sock->protocol->state = SILC_PROTOCOL_STATE_ERROR;
-    silc_protocol_execute_final(sock->protocol, server->schedule);
-    sock->protocol = NULL;
-    return;
-  }
-#endif
-
   memset(tmp, 0, sizeof(tmp));
   //  silc_socket_get_error(sock, tmp, sizeof(tmp));
   silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
@@ -2760,8 +2811,15 @@ void silc_server_close_connection(SilcServer server,
 
   //  silc_socket_set_qos(sock, 0, 0, 0, 0, NULL);
 
+  if (idata && idata->sconn) {
+    silc_server_connection_free(idata->sconn);
+    idata->sconn = NULL;
+  }
+
   /* Close connection with timeout */
   server->stat.conn_num--;
+  silc_schedule_task_del_by_all(server->schedule, 0,
+                               silc_server_close_connection_final, sock);
   silc_schedule_task_add_timeout(server->schedule,
                                 silc_server_close_connection_final,
                                 sock, 0, 1);
@@ -2799,16 +2857,6 @@ void silc_server_disconnect_remote(SilcServer server,
   silc_server_close_connection(server, sock);
 }
 
-SILC_TASK_CALLBACK(silc_server_free_client_data_timeout)
-{
-  SilcClientEntry client = context;
-
-  assert(!silc_hash_table_count(client->channels));
-
-  silc_idlist_del_data(client);
-  //  silc_idcache_purge_by_context(server->local_list->clients, client);
-}
-
 /* Frees client data and notifies about client's signoff. */
 
 void silc_server_free_client_data(SilcServer server,
@@ -2817,7 +2865,7 @@ void silc_server_free_client_data(SilcServer server,
                                  int notify,
                                  const char *signoff)
 {
-  SILC_LOG_DEBUG(("Freeing client data"));
+  SILC_LOG_DEBUG(("Freeing client %p data", client));
 
   if (client->id) {
     /* Check if anyone is watching this nickname */
@@ -2859,20 +2907,22 @@ void silc_server_free_client_data(SilcServer server,
   SILC_OPER_STATS_UPDATE(client, router, SILC_UMODE_ROUTER_OPERATOR);
   silc_schedule_task_del_by_context(server->schedule, client);
 
+  if (client->data.sconn)
+    silc_server_connection_free(client->data.sconn);
+
   /* We will not delete the client entry right away. We will take it
      into history (for WHOWAS command) for 5 minutes, unless we're
      shutting down server. */
   if (!server->server_shutdown) {
-    silc_schedule_task_add_timeout(server->schedule,
-                                  silc_server_free_client_data_timeout,
-                                  client, 600, 0);
     client->data.status &= ~SILC_IDLIST_STATUS_REGISTERED;
-    client->data.status &= ~SILC_IDLIST_STATUS_LOCAL;
     client->mode = 0;
     client->router = NULL;
     client->connection = NULL;
+    client->data.created = silc_time();
+    silc_dlist_add(server->expired_clients, client);
   } else {
     /* Delete directly since we're shutting down server */
+    SILC_LOG_DEBUG(("Delete client directly"));
     silc_idlist_del_data(client);
     silc_idlist_del_client(server->local_list, client);
   }
@@ -2887,10 +2937,29 @@ void silc_server_free_sock_user_data(SilcServer server,
                                     const char *signoff_message)
 {
   SilcIDListData idata = silc_packet_get_context(sock);
+  const char *ip;
+  SilcUInt16 port;
+
+  SILC_LOG_DEBUG(("Start"));
 
   if (!idata)
     return;
 
+  silc_schedule_task_del_by_context(server->schedule, sock);
+
+  /* Cancel active protocols */
+  if (idata) {
+    if (idata->sconn && idata->sconn->op) {
+      SILC_LOG_DEBUG(("Abort active protocol"));
+      silc_async_abort(idata->sconn->op, NULL, NULL);
+    }
+    if (idata->conn_type == SILC_CONN_UNKNOWN &&
+        ((SilcUnknownEntry)idata)->op) {
+      SILC_LOG_DEBUG(("Abort active protocol"));
+      silc_async_abort(((SilcUnknownEntry)idata)->op, NULL, NULL);
+    }
+  }
+
   switch (idata->conn_type) {
   case SILC_CONN_CLIENT:
     {
@@ -2907,7 +2976,7 @@ void silc_server_free_sock_user_data(SilcServer server,
       SilcServerEntry user_data = (SilcServerEntry)idata;
       SilcServerEntry backup_router = NULL;
 
-      SILC_LOG_DEBUG(("Freeing server data"));
+      SILC_LOG_DEBUG(("Freeing server %p data", user_data));
 
       if (user_data->id)
        backup_router = silc_server_backup_get(server, user_data->id);
@@ -2920,6 +2989,9 @@ void silc_server_free_sock_user_data(SilcServer server,
       if (server->server_shutdown || server->backup_noswitch)
        backup_router = NULL;
 
+      silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
+                                 NULL, NULL, &ip, &port);
+
       /* If this was our primary router connection then we're lost to
         the outside world. */
       if (server->router == user_data) {
@@ -2956,17 +3028,15 @@ void silc_server_free_sock_user_data(SilcServer server,
          /* We stop here to take a breath */
          sleep(2);
 
-#if 0
          if (server->backup_router) {
            server->server_type = SILC_ROUTER;
 
            /* We'll need to constantly try to reconnect to the primary
               router so that we'll see when it comes back online. */
-           silc_server_backup_reconnect(server, sock->ip, sock->port,
+           silc_server_create_connection(server, FALSE, FALSE, ip, port,
                                         silc_server_backup_connected,
                                         NULL);
          }
-#endif /* 0 */
 
          /* Mark this connection as replaced */
          silc_server_backup_replaced_add(server, user_data->id,
@@ -3058,22 +3128,29 @@ void silc_server_free_sock_user_data(SilcServer server,
       }
       server->backup_noswitch = FALSE;
 
-      /* Free the server entry */
-      silc_server_backup_del(server, user_data);
-      silc_server_backup_replaced_del(server, user_data);
-      silc_idlist_del_data(user_data);
-      if (!silc_idlist_del_server(server->local_list, user_data))
-       silc_idlist_del_server(server->global_list, user_data);
+      if (idata->sconn)
+       silc_server_connection_free(idata->sconn);
+
+      /* Statistics */
       if (idata->conn_type == SILC_CONN_SERVER) {
        server->stat.my_servers--;
        server->stat.servers--;
-      } else {
+       SILC_LOG_DEBUG(("my_servers %d", server->stat.my_servers));
+      } else if (idata->conn_type == SILC_CONN_ROUTER) {
        server->stat.my_routers--;
        server->stat.routers--;
+       SILC_LOG_DEBUG(("my_routers %d", server->stat.my_routers));
       }
       if (server->server_type == SILC_ROUTER)
        server->stat.cell_servers--;
 
+      /* Free the server entry */
+      silc_server_backup_del(server, user_data);
+      silc_server_backup_replaced_del(server, user_data);
+      silc_idlist_del_data(user_data);
+      if (!silc_idlist_del_server(server->local_list, user_data))
+       silc_idlist_del_server(server->global_list, user_data);
+
       if (backup_router && backup_router != server->id_entry) {
        /* Announce all of our stuff that was created about 5 minutes ago.
           The backup router knows all the other stuff already. */
@@ -3098,6 +3175,8 @@ void silc_server_free_sock_user_data(SilcServer server,
 
       SILC_LOG_DEBUG(("Freeing unknown connection data"));
 
+      if (idata->sconn)
+       silc_server_connection_free(idata->sconn);
       silc_idlist_del_data(idata);
       silc_free(entry);
       silc_packet_set_context(sock, NULL);
@@ -3878,6 +3957,9 @@ static void silc_server_announce_get_clients(SilcServer server,
       if (!client->connection && !client->router)
        continue;
 
+      SILC_LOG_DEBUG(("Announce Client ID %s",
+                     silc_id_render(client->id, SILC_ID_CLIENT)));
+
       idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
 
       *clients = silc_buffer_realloc(*clients,
@@ -4105,6 +4187,9 @@ void silc_server_announce_get_channel_users(SilcServer server,
   while (silc_hash_table_get(&htl, NULL, (void *)&chl)) {
     clidp = silc_id_payload_encode(chl->client->id, SILC_ID_CLIENT);
 
+    SILC_LOG_DEBUG(("JOIN Client %s", silc_id_render(chl->client->id,
+                                                    SILC_ID_CLIENT)));
+
     /* JOIN Notify */
     tmp = silc_server_announce_encode_notify(SILC_NOTIFY_TYPE_JOIN, 2,
                                             clidp->data,
@@ -4198,6 +4283,9 @@ void silc_server_announce_get_channels(SilcServer server,
       else
        announce = TRUE;
 
+      SILC_LOG_DEBUG(("Announce Channel ID %s",
+                     silc_id_render(channel->id, SILC_ID_CHANNEL)));
+
       silc_id_id2str(channel->id, SILC_ID_CHANNEL, cid, sizeof(cid), &id_len);
       name_len = strlen(channel->channel_name);
 
@@ -4502,10 +4590,10 @@ void silc_server_announce_watches(SilcServer server,
 /* Assembles user list and users mode list from the `channel'. */
 
 SilcBool silc_server_get_users_on_channel(SilcServer server,
-                                     SilcChannelEntry channel,
-                                     SilcBuffer *user_list,
-                                     SilcBuffer *mode_list,
-                                     SilcUInt32 *user_count)
+                                         SilcChannelEntry channel,
+                                         SilcBuffer *user_list,
+                                         SilcBuffer *mode_list,
+                                         SilcUInt32 *user_count)
 {
   SilcChannelClientEntry chl;
   SilcHashTableList htl;
@@ -4919,15 +5007,17 @@ SILC_TASK_CALLBACK(silc_server_get_stats)
     SILC_LOG_DEBUG(("Retrieving stats from router"));
     server->stat.commands_sent++;
     idp = silc_id_payload_encode(server->router->id, SILC_ID_SERVER);
-    packet = silc_command_payload_encode_va(SILC_COMMAND_STATS,
-                                           ++server->cmd_ident, 1,
-                                           1, idp->data,
-                                           silc_buffer_len(idp));
-    silc_server_packet_send(server, SILC_PRIMARY_ROUTE(server),
-                           SILC_PACKET_COMMAND, 0, packet->data,
-                           silc_buffer_len(packet));
-    silc_buffer_free(packet);
-    silc_buffer_free(idp);
+    if (idp) {
+      packet = silc_command_payload_encode_va(SILC_COMMAND_STATS,
+                                             ++server->cmd_ident, 1,
+                                             1, idp->data,
+                                             silc_buffer_len(idp));
+      silc_server_packet_send(server, SILC_PRIMARY_ROUTE(server),
+                             SILC_PACKET_COMMAND, 0, packet->data,
+                             silc_buffer_len(packet));
+      silc_buffer_free(packet);
+      silc_buffer_free(idp);
+    }
   }
 
   silc_schedule_task_add_timeout(server->schedule, silc_server_get_stats,
index b3021e7839cb3307775f9198181fddaa17cd0829..84ed585b79565f047e7d440c369cb709361d071e 100644 (file)
@@ -120,11 +120,6 @@ do {                                                                       \
   silc_free(__fmt__);                                                  \
 } while(0)
 
-/* Check whether rekey protocol is active */
-#define SILC_SERVER_IS_REKEY(sock)                                     \
-  (sock->protocol && sock->protocol->protocol &&                       \
-   sock->protocol->protocol->type == SILC_PROTOCOL_SERVER_REKEY)
-
 /* Output a message to stderr or to the appropriate log facility wether
    we are in the background or not. */
 #define SILC_SERVER_LOG_INFO(fmt)                                      \
@@ -146,6 +141,7 @@ void silc_server_stop(SilcServer server);
 void silc_server_start_key_exchange(SilcServerConnection sconn);
 void silc_server_create_connection(SilcServer server,
                                   SilcBool reconnect,
+                                  SilcBool dynamic,
                                   const char *remote_host, SilcUInt32 port,
                                   SilcServerConnectCallback callback,
                                   void *context);
index c52b3e3597a6651ebc440a5fef4d8b9cd0a2427f..e460c95d720022afabf2d277f2459eb8a3dcca2e 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2001 - 2005, 2007 Pekka Riikonen
+  Copyright (C) 2001 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -22,7 +22,6 @@
 #include "server_internal.h"
 
 SILC_TASK_CALLBACK(silc_server_protocol_backup_done);
-SILC_TASK_CALLBACK(silc_server_backup_connect_to_router);
 SILC_TASK_CALLBACK(silc_server_backup_announce_watches);
 
 static void silc_server_backup_connect_primary(SilcServer server,
@@ -72,6 +71,7 @@ typedef struct {
   SilcUInt32 sessions_count;
   SilcUInt32 initiator_restart;
   long start;
+  int state;
   unsigned int responder        : 1;
   unsigned int received_failure : 1;
   unsigned int timeout          : 1;
@@ -108,7 +108,8 @@ void silc_server_backup_add(SilcServer server, SilcServerEntry backup_server,
   }
 
   SILC_LOG_DEBUG(("Backup router %s will replace %s",
-                 backup_server->data.sconn->remote_host, ip, port));
+                 backup_server->data.sconn ?
+                 backup_server->data.sconn->remote_host : "(me)", ip));
 
   for (i = 0; i < server->backup->servers_count; i++) {
     if (!server->backup->servers[i].server) {
@@ -551,10 +552,10 @@ void silc_server_backup_ping_reply(void *context, void *reply)
     /* The primary is not down, refuse to serve the server as primary */
     SILC_LOG_DEBUG(("PING received, primary is up"));
     silc_server_backup_send_start_use(pc->server, pc->sock, TRUE);
+    silc_packet_free(pc->packet);
   }
 
   silc_packet_stream_unref(pc->sock);
-  silc_packet_free(pc->packet);
   silc_free(pc);
 }
 
@@ -567,6 +568,7 @@ void silc_server_backup_resume_router(SilcServer server,
                                      SilcPacket packet)
 {
   SilcIDListData idata = silc_packet_get_context(sock);
+  SilcServerEntry router = (SilcServerEntry)idata;
   SilcUInt8 type, session;
   SilcServerBackupProtocolContext ctx;
   int i, ret;
@@ -645,7 +647,6 @@ void silc_server_backup_resume_router(SilcServer server,
     return;
   }
 
-
   /* Start the resuming protocol if requested. */
   if (type == SILC_SERVER_BACKUP_START) {
     /* We have received a start for resuming protocol.  We are either
@@ -677,6 +678,8 @@ void silc_server_backup_resume_router(SilcServer server,
     proto_ctx->session = session;
     proto_ctx->start = time(0);
     silc_packet_stream_ref(sock);
+    router->backup = TRUE;
+    router->backup_proto = proto_ctx;
 
     SILC_LOG_DEBUG(("Starting backup resuming protocol as responder"));
     SILC_LOG_INFO(("Starting backup resuming protocol"));
@@ -704,39 +707,35 @@ void silc_server_backup_resume_router(SilcServer server,
     return;
   }
 
-#if 0
   /* Activate the shared protocol context for this socket connection
      if necessary */
   if (type == SILC_SERVER_BACKUP_RESUMED &&
-      idata->conn_type == SILC_CONN_ROUTER && !sock->protocol &&
+      idata->conn_type == SILC_CONN_ROUTER && !router->backup &&
       idata->status & SILC_IDLIST_STATUS_DISABLED) {
     SilcServerEntry backup_router;
 
-    if (silc_server_backup_replaced_get(server, ((SilcServerEntry)idata)->id,
-                                       &backup_router)) {
-      SilcPacketStream bsock =
-       (SilcSocketConnection)backup_router->connection;
-      if (bsock->protocol && bsock->protocol->protocol &&
-         bsock->protocol->protocol->type == SILC_PROTOCOL_SERVER_BACKUP) {
-       sock->protocol = bsock->protocol;
-       ctx = sock->protocol->context;
-       if (ctx->sock)
-         silc_socket_free(ctx->sock); /* unref */
-       ctx->sock = silc_socket_dup(sock);
-      }
+    if (silc_server_backup_replaced_get(server, router->id, &backup_router)) {
+      ctx = backup_router->backup_proto;
+      if (ctx->sock)
+       silc_packet_stream_unref(ctx->sock);
+      router->backup = TRUE;
+      router->backup_proto = ctx;
+      ctx->sock = sock;
+      silc_packet_stream_ref(sock);
     }
   }
 
-
   /* Call the resuming protocol if the protocol is active. */
-  if (SILC_SERVER_IS_BACKUP(sock)) {
-    ctx = sock->protocol->context;
+  if (router->backup) {
+    ctx = router->backup_proto;
     ctx->type = type;
 
     for (i = 0; i < ctx->sessions_count; i++) {
       if (session == ctx->sessions[i].session) {
        ctx->session = session;
-       silc_protocol_execute(sock->protocol, server->schedule, 0, 0);
+       silc_schedule_task_add_timeout(server->schedule,
+                                      silc_server_protocol_backup,
+                                      ctx, 0, 1);
        silc_packet_free(packet);
        return;
       }
@@ -744,7 +743,9 @@ void silc_server_backup_resume_router(SilcServer server,
 
     /* If RESUMED received the session ID is zero, execute the protocol. */
     if (type == SILC_SERVER_BACKUP_RESUMED) {
-      silc_protocol_execute(sock->protocol, server->schedule, 0, 0);
+      silc_schedule_task_add_timeout(server->schedule,
+                                    silc_server_protocol_backup,
+                                    ctx, 0, 1);
       silc_packet_free(packet);
       return;
     }
@@ -753,7 +754,6 @@ void silc_server_backup_resume_router(SilcServer server,
     silc_packet_free(packet);
     return;
   }
-#endif /* 0 */
 
   silc_packet_free(packet);
 }
@@ -766,7 +766,6 @@ SILC_TASK_CALLBACK(silc_server_backup_connected_later)
   SilcServerBackupProtocolContext proto_ctx =
     (SilcServerBackupProtocolContext)context;
   SilcServer server = proto_ctx->server;
-  SilcPacketStream sock = proto_ctx->sock;
 
   SILC_LOG_DEBUG(("Starting backup resuming protocol as initiator"));
   SILC_LOG_INFO(("Starting backup resuming protocol"));
@@ -791,7 +790,7 @@ SILC_TASK_CALLBACK(silc_server_backup_connected_again)
   if (primary) {
     if (!silc_server_find_socket_by_host(server, SILC_CONN_ROUTER,
                                         primary->host, primary->port))
-      silc_server_create_connection(server, FALSE,
+      silc_server_create_connection(server, FALSE, FALSE,
                                    primary->host, primary->port,
                                    silc_server_backup_connected,
                                    context);
@@ -813,7 +812,7 @@ void silc_server_backup_connected(SilcServer server,
     /* Try again */
     silc_schedule_task_add_timeout(server->schedule,
                                   silc_server_backup_connected_again,
-                                  context, 0, 0);
+                                  context, 5, 0);
     return;
   }
 
@@ -841,7 +840,7 @@ SILC_TASK_CALLBACK(silc_server_backup_connect_primary_again)
   if (primary) {
     if (!silc_server_find_socket_by_host(server, SILC_CONN_ROUTER,
                                         primary->host, primary->port))
-      silc_server_create_connection(server, FALSE,
+      silc_server_create_connection(server, FALSE, FALSE,
                                    primary->host, primary->port,
                                    silc_server_backup_connect_primary,
                                    context);
@@ -857,11 +856,11 @@ static void silc_server_backup_connect_primary(SilcServer server,
                                               SilcServerEntry server_entry,
                                               void *context)
 {
-#if 0
   SilcPacketStream backup_router = context;
+  SilcIDListData idata = silc_packet_get_context(backup_router);
+  SilcServerEntry router = (SilcServerEntry)idata;
   SilcServerBackupProtocolContext ctx;
   SilcPacketStream sock;
-  SilcIDListData idata;
   unsigned char data[2];
 
   if (!server_entry) {
@@ -872,16 +871,13 @@ static void silc_server_backup_connect_primary(SilcServer server,
     return;
   }
 
-  /* Unref */
-  silc_packet_stream_unref(backup_router);
-
-  if (!backup_router->protocol)
-    return;
-  if (!server_entry->connection)
+  if (!router->backup || !server_entry->connection) {
+    silc_packet_stream_unref(backup_router);
     return;
+  }
 
-  ctx = (SilcServerBackupProtocolContext)backup_router->protocol->context;
-  sock = (SilcSocketConnection)server_entry->connection;
+  ctx = router->backup_proto;
+  sock = server_entry->connection;
   idata = (SilcIDListData)server_entry;
 
   SILC_LOG_DEBUG(("Sending CONNECTED packet (session %d)", ctx->session));
@@ -892,7 +888,7 @@ static void silc_server_backup_connect_primary(SilcServer server,
   data[0] = SILC_SERVER_BACKUP_CONNECTED;
   data[1] = ctx->session;
   silc_server_packet_send(server, backup_router,
-                         SILC_PACKET_RESUME_ROUTER, 0, data, 2, FALSE);
+                         SILC_PACKET_RESUME_ROUTER, 0, data, 2);
 
   /* The primary connection is disabled until it sends the RESUMED packet
      to us. */
@@ -902,12 +898,17 @@ static void silc_server_backup_connect_primary(SilcServer server,
      the primary router connection since it will send the subsequent
      packets in this protocol. We don't talk with backup router
      anymore. */
-  sock->protocol = backup_router->protocol;
   if (ctx->sock)
-    silc_socket_free(ctx->sock); /* unref */
-  ctx->sock = silc_socket_dup(server_entry->connection);
-  backup_router->protocol = NULL;
-#endif /* 0 */x
+    silc_packet_stream_unref(ctx->sock);
+  ctx->sock = sock;
+  silc_packet_stream_ref(sock);
+  server_entry->backup = TRUE;
+  server_entry->backup_proto = ctx;
+  router->backup = FALSE;
+  router->backup_proto = NULL;
+
+  /* Unref */
+  silc_packet_stream_unref(backup_router);
 }
 
 /* Timeout callback used by the backup router to send the ENDING packet
@@ -916,7 +917,6 @@ static void silc_server_backup_connect_primary(SilcServer server,
 
 SILC_TASK_CALLBACK(silc_server_backup_send_resumed)
 {
-#if 0
   SilcServerBackupProtocolContext ctx = context;
   SilcServer server = ctx->server;
   unsigned char data[2];
@@ -925,7 +925,7 @@ SILC_TASK_CALLBACK(silc_server_backup_send_resumed)
   SILC_LOG_DEBUG(("Start"));
 
   for (i = 0; i < ctx->sessions_count; i++)
-    if (ctx->sessions[i].server_entry == ctx->sock->user_data)
+    if (ctx->sessions[i].server_entry == silc_packet_get_context(ctx->sock))
       ctx->session = ctx->sessions[i].session;
 
   /* We've received all the CONNECTED packets and now we'll send the
@@ -936,8 +936,7 @@ SILC_TASK_CALLBACK(silc_server_backup_send_resumed)
                          data, sizeof(data));
 
   /* The protocol will go to END state. */
-  protocol->state = SILC_PROTOCOL_STATE_END;
-#endif /* 0 */
+  ctx->state = 250;
 }
 
 /* Backup resuming protocol. This protocol is executed when the primary
@@ -945,19 +944,19 @@ SILC_TASK_CALLBACK(silc_server_backup_send_resumed)
 
 SILC_TASK_CALLBACK(silc_server_protocol_backup)
 {
-#if 0
   SilcServerBackupProtocolContext ctx = context;
   SilcServer server = ctx->server;
-  SilcServerEntry server_entry;
+  SilcServerEntry server_entry = NULL;
   SilcPacketStream sock = NULL;
   unsigned char data[2];
+  SilcDList list;
   int i;
 
-  if (protocol->state == SILC_PROTOCOL_STATE_UNKNOWN)
-    protocol->state = SILC_PROTOCOL_STATE_START;
+  if (!ctx->state)
+    ctx->state = 1;
 
-  switch(protocol->state) {
-  case SILC_PROTOCOL_STATE_START:
+  switch(ctx->state) {
+  case 1:
     if (ctx->responder == FALSE) {
       /*
        * Initiator (backup router)
@@ -967,15 +966,19 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup)
         packet will indicate to the primary router that it has been replaced
         by us.  For normal servers it means that we will be resigning as
         being primary router shortly. */
-      for (i = 0; i < server->config->param.connections_max; i++) {
-       sock = server->sockets[i];
-       if (!sock || !sock->user_data ||
-           sock->user_data == server->id_entry ||
-           (sock->type != SILC_CONN_ROUTER &&
-            sock->type != SILC_CONN_SERVER))
+      list = silc_packet_engine_get_streams(server->packet_engine);
+      if (!list)
+       return;
+
+      silc_dlist_start(list);
+      while ((sock = silc_dlist_get(list))) {
+       server_entry = silc_packet_get_context(sock);
+
+       if (!server_entry || server_entry == server->id_entry ||
+           (server_entry->data.conn_type != SILC_CONN_ROUTER &&
+            server_entry->data.conn_type != SILC_CONN_SERVER))
          continue;
 
-       server_entry = sock->user_data;
        if (server_entry->data.status & SILC_IDLIST_STATUS_DISABLED)
          continue;
 
@@ -992,21 +995,23 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup)
                       server_entry->server_name, ctx->sessions_count));
 
        /* This connection is performing this protocol too now */
-       sock->protocol = protocol;
+       server_entry->backup = TRUE;
+       server_entry->backup_proto = ctx;
 
        data[0] = SILC_SERVER_BACKUP_START;
        data[1] = ctx->sessions_count;
        silc_server_packet_send(server, sock, SILC_PACKET_RESUME_ROUTER, 0,
-                               data, sizeof(data), FALSE);
+                               data, sizeof(data));
        ctx->sessions_count++;
       }
+      silc_packet_engine_free_streams_list(list);
 
       /* Announce data to the new primary to be. */
       silc_server_announce_servers(server, TRUE, 0, ctx->sock);
       silc_server_announce_clients(server, 0, ctx->sock);
       silc_server_announce_channels(server, 0, ctx->sock);
 
-      protocol->state++;
+      ctx->state++;
 
     } else {
       /*
@@ -1034,10 +1039,11 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup)
                                             SILC_CONN_ROUTER)) {
        SILC_LOG_DEBUG(("Received START (session %d), reconnect to router",
                        ctx->session));
-       silc_server_create_connection(server, FALSE;
+       silc_packet_stream_ref(ctx->sock);
+       silc_server_create_connection(server, FALSE, FALSE,
                                      primary->host, primary->port,
                                      silc_server_backup_connect_primary,
-                                     silc_socket_dup(ctx->sock));
+                                     ctx->sock);
       } else {
        /* Nowhere to connect just return the CONNECTED packet */
        SILC_LOG_DEBUG(("Received START (session %d), send CONNECTED back",
@@ -1050,7 +1056,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup)
        data[1] = ctx->session;
        silc_server_packet_send(server, ctx->sock,
                                SILC_PACKET_RESUME_ROUTER, 0,
-                               data, sizeof(data), FALSE);
+                               data, sizeof(data));
       }
 
       /* Add this resuming session */
@@ -1064,9 +1070,9 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup)
       if (server->server_type == SILC_ROUTER &&
          (!server->router ||
           server->router->data.status & SILC_IDLIST_STATUS_DISABLED))
-       protocol->state++;
+       ctx->state++;
       else
-       protocol->state = SILC_PROTOCOL_STATE_END;
+       ctx->state = 250;
     }
     break;
 
@@ -1105,10 +1111,9 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup)
 
       /* The ENDING is sent with timeout, and then we continue to the
         END state in the protocol. */
-      silc_schedule_task_add(server->schedule, 0,
-                            silc_server_backup_send_resumed,
-                            protocol, 1, 0, SILC_TASK_TIMEOUT,
-                            SILC_TASK_PRI_NORMAL);
+      silc_schedule_task_add_timeout(server->schedule,
+                                    silc_server_backup_send_resumed,
+                                    ctx, 1, 0);
       return;
 
     } else {
@@ -1127,69 +1132,89 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup)
       /* Switch announced informations to our primary router of using the
         backup router. */
       silc_server_local_servers_toggle_enabled(server, TRUE);
-      silc_server_update_servers_by_server(server, ctx->sock->user_data,
-                                          server->router);
-      silc_server_update_clients_by_server(server, ctx->sock->user_data,
+      silc_server_update_servers_by_server(server,
+                                          silc_packet_get_context(ctx->sock),
+                                          server->router);
+      silc_server_update_clients_by_server(server,
+                                          silc_packet_get_context(ctx->sock),
                                           server->router, TRUE);
 
       /* We as primary router now must send RESUMED packets to all servers
         and routers so that they know we are back.   For backup router we
         send the packet last so that we give the backup as much time as
         possible to deal with message routing at this critical moment. */
-      for (i = 0; i < server->config->param.connections_max; i++) {
-       sock = server->sockets[i];
-       if (!sock || !sock->user_data ||
-           sock->user_data == server->id_entry ||
-           (sock->type != SILC_CONN_ROUTER &&
-            sock->type != SILC_CONN_SERVER))
+      list = silc_packet_engine_get_streams(server->packet_engine);
+      if (!list)
+       return;
+
+      silc_dlist_start(list);
+      while ((sock = silc_dlist_get(list))) {
+       server_entry = silc_packet_get_context(sock);
+
+       if (!server_entry || server_entry == server->id_entry ||
+           (server_entry->data.conn_type != SILC_CONN_ROUTER &&
+            server_entry->data.conn_type != SILC_CONN_SERVER))
          continue;
 
        /* Send to backup last */
        if (sock == ctx->sock)
          continue;
 
-      send_to_backup:
-       server_entry = sock->user_data;
+       server_entry = silc_packet_get_context(sock);
        server_entry->data.status &= ~SILC_IDLIST_STATUS_DISABLED;
 
        SILC_LOG_DEBUG(("Sending RESUMED to %s", server_entry->server_name));
        SILC_LOG_INFO(("Sending RESUMED to %s", server_entry->server_name));
 
        /* This connection is performing this protocol too now */
-       sock->protocol = protocol;
+       server_entry->backup = TRUE;
+       server_entry->backup_proto = ctx;
 
        data[0] = SILC_SERVER_BACKUP_RESUMED;
        data[1] = 0;
        silc_server_packet_send(server, sock, SILC_PACKET_RESUME_ROUTER, 0,
-                               data, sizeof(data), FALSE);
+                               data, sizeof(data));
       }
 
       /* Now send the same packet to backup */
       if (sock != ctx->sock) {
        sleep(1);
        sock = ctx->sock;
-       goto send_to_backup;
+       server_entry = silc_packet_get_context(sock);
+       server_entry->data.status &= ~SILC_IDLIST_STATUS_DISABLED;
+
+       SILC_LOG_DEBUG(("Sending RESUMED to %s", server_entry->server_name));
+       SILC_LOG_INFO(("Sending RESUMED to %s", server_entry->server_name));
+
+       /* This connection is performing this protocol too now */
+       server_entry->backup = TRUE;
+       server_entry->backup_proto = ctx;
+
+       data[0] = SILC_SERVER_BACKUP_RESUMED;
+       data[1] = 0;
+       silc_server_packet_send(server, sock, SILC_PACKET_RESUME_ROUTER, 0,
+                               data, sizeof(data));
       }
+      silc_packet_engine_free_streams_list(list);
 
       /* We are now resumed and are back as primary router in the cell. */
       SILC_LOG_INFO(("We are now the primary router of our cell again"));
       server->wait_backup = FALSE;
 
       /* Announce WATCH list a little later */
-      silc_schedule_task_add(server->schedule, 0,
-                            silc_server_backup_announce_watches,
-                            silc_socket_dup(ctx->sock), 4, 0,
-                            SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
+      silc_packet_stream_ref(ctx->sock);
+      silc_schedule_task_add_timeout(server->schedule,
+                                    silc_server_backup_announce_watches,
+                                    ctx->sock, 4, 0);
 
       /* For us this is the end of this protocol. */
-      if (protocol->final_callback)
-       silc_protocol_execute_final(protocol, server->schedule);
-      else
-       silc_protocol_free(protocol);
+      silc_schedule_task_add_timeout(server->schedule,
+                                    silc_server_protocol_backup_done,
+                                    ctx, 0, 1);
     }
     break;
 
-  case SILC_PROTOCOL_STATE_END:
+  case 250:
     {
       /*
        * Responder (backup router, servers, and remote router)
@@ -1210,7 +1235,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup)
        server->server_type = SILC_BACKUP_ROUTER;
 
       /* We have now new primary router. All traffic goes there from now on. */
-      router = ctx->sock->user_data;
+      router = silc_packet_get_context(ctx->sock);
       if (silc_server_backup_replaced_get(server, router->id,
                                          &backup_router)) {
 
@@ -1249,78 +1274,70 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup)
                              server->router->server_name));
 
       /* Protocol has ended, call the final callback */
-      if (protocol->final_callback)
-       silc_protocol_execute_final(protocol, server->schedule);
-      else
-       silc_protocol_free(protocol);
+      silc_schedule_task_add_timeout(server->schedule,
+                                    silc_server_protocol_backup_done,
+                                    ctx, 0, 1);
     }
     break;
 
-  case SILC_PROTOCOL_STATE_ERROR:
+  case 251:
     /* Protocol has ended, call the final callback */
-    if (protocol->final_callback)
-      silc_protocol_execute_final(protocol, server->schedule);
-    else
-      silc_protocol_free(protocol);
+    silc_schedule_task_add_timeout(server->schedule,
+                                  silc_server_protocol_backup_done,
+                                  ctx, 0, 1);
     break;
 
-  case SILC_PROTOCOL_STATE_FAILURE:
+  case 252:
     /* Protocol has ended, call the final callback */
     SILC_LOG_ERROR(("Error during backup resume: received Failure"));
     ctx->received_failure = TRUE;
-    if (protocol->final_callback)
-      silc_protocol_execute_final(protocol, server->schedule);
-    else
-      silc_protocol_free(protocol);
+    silc_schedule_task_add_timeout(server->schedule,
+                                  silc_server_protocol_backup_done,
+                                  ctx, 0, 1);
     break;
 
-  case SILC_PROTOCOL_STATE_UNKNOWN:
+  default:
     break;
   }
-#endif /* 0 */
 }
 
 /* Final resuming protocol completion callback */
 
 SILC_TASK_CALLBACK(silc_server_protocol_backup_done)
 {
-#if 0
   SilcServerBackupProtocolContext ctx = context;
   SilcServer server = ctx->server;
+  SilcDList list;
   SilcServerEntry server_entry;
   SilcPacketStream sock;
   SilcBool error;
-  int i;
 
-  silc_schedule_task_del_by_context(server->schedule, protocol);
+  silc_schedule_task_del_by_context(server->schedule, ctx);
 
   error = ctx->error;
 
-  if (error) {
+  if (error)
     SILC_LOG_ERROR(("Error occurred during backup router resuming protcool"));
-    if (server->server_type == SILC_SERVER)
-      silc_schedule_task_del_by_callback(server->schedule,
-                                        silc_server_backup_connect_to_router);
-  }
 
   if (server->server_shutdown)
     return;
 
   /* Remove this protocol from all server entries that has it */
-  for (i = 0; i < server->config->param.connections_max; i++) {
-    sock = server->sockets[i];
-    if (!sock || !sock->user_data ||
-       (sock->type != SILC_CONN_ROUTER &&
-        sock->type != SILC_CONN_SERVER))
-      continue;
+  list = silc_packet_engine_get_streams(server->packet_engine);
+  if (!list)
+    return;
 
-    server_entry = sock->user_data;
+  silc_dlist_start(list);
+  while ((sock = silc_dlist_get(list))) {
+    server_entry = silc_packet_get_context(sock);
+    if (!server_entry)
+      continue;
 
-    /* The SilcProtocol context was shared between all connections, clear
-       it from all connections. */
-    if (sock->protocol == protocol) {
-      sock->protocol = NULL;
+    if (server_entry->data.conn_type != SILC_CONN_ROUTER &&
+       server_entry->data.conn_type != SILC_CONN_SERVER)
+      continue;
 
+    if (server_entry->backup_proto == ctx) {
       if (error) {
 
        if (server->server_type == SILC_SERVER &&
@@ -1330,7 +1347,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup_done)
        /* Backup router */
        if (SILC_PRIMARY_ROUTE(server) == sock && server->backup_router) {
          if (ctx->sock == sock) {
-           silc_socket_free(sock); /* unref */
+           silc_packet_stream_unref(sock);
            ctx->sock = NULL;
          }
 
@@ -1345,18 +1362,17 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup_done)
            /* Restart the protocol. */
            proto_ctx = silc_calloc(1, sizeof(*proto_ctx));
            proto_ctx->server = server;
-           proto_ctx->sock = silc_socket_dup(sock);
+           proto_ctx->sock = sock;
            proto_ctx->responder = FALSE;
            proto_ctx->type = SILC_SERVER_BACKUP_START;
            proto_ctx->start = time(0);
            proto_ctx->initiator_restart = ctx->initiator_restart + 1;
+           silc_packet_stream_ref(sock);
 
            /* Start through scheduler */
-           silc_schedule_task_add(server->schedule, 0,
-                                  silc_server_backup_connected_later,
-                                  proto_ctx, 5, 0,
-                                  SILC_TASK_TIMEOUT,
-                                  SILC_TASK_PRI_NORMAL);
+           silc_schedule_task_add_timeout(server->schedule,
+                                          silc_server_backup_connected_later,
+                                          proto_ctx, 5, 0);
          } else {
            /* If failure was received, switch back to normal backup router.
               For some reason primary wouldn't accept that we were supposed
@@ -1365,20 +1381,20 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup_done)
            silc_server_local_servers_toggle_enabled(server, FALSE);
            server_entry->data.status &= ~SILC_IDLIST_STATUS_DISABLED;
            silc_server_update_servers_by_server(server, server->id_entry,
-                                                sock->user_data);
+                                                silc_packet_get_context(sock));
            silc_server_update_clients_by_server(server, NULL,
-                                                sock->user_data, TRUE);
+                                                silc_packet_get_context(sock),
+                                                TRUE);
 
            /* Announce our clients and channels to the router */
            silc_server_announce_clients(server, 0, sock);
            silc_server_announce_channels(server, 0, sock);
 
            /* Announce WATCH list a little later */
-           silc_schedule_task_add(server->schedule, 0,
-                                  silc_server_backup_announce_watches,
-                                  silc_socket_dup(sock), 5, 0,
-                                  SILC_TASK_TIMEOUT,
-                                  SILC_TASK_PRI_NORMAL);
+           silc_packet_stream_ref(sock);
+           silc_schedule_task_add_timeout(server->schedule,
+                                          silc_server_backup_announce_watches,
+                                          sock, 5, 0);
          }
 
          continue;
@@ -1388,6 +1404,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup_done)
       server_entry->data.status &= ~SILC_IDLIST_STATUS_DISABLED;
     }
   }
+  silc_packet_engine_free_streams_list(list);
 
   if (!error) {
     SILC_LOG_INFO(("Backup resuming protocol ended successfully"));
@@ -1403,10 +1420,10 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup_done)
       silc_server_announce_channels(server, 0, server->router->connection);
 
       /* Announce WATCH list a little later */
-      silc_schedule_task_add(server->schedule, 0,
-                            silc_server_backup_announce_watches,
-                            silc_socket_dup(server->router->connection), 4, 0,
-                            SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
+      silc_packet_stream_ref(server->router->connection);
+      silc_schedule_task_add_timeout(server->schedule,
+                                    silc_server_backup_announce_watches,
+                                    server->router->connection, 4, 0);
     }
   } else {
     /* Error */
@@ -1421,42 +1438,42 @@ SILC_TASK_CALLBACK(silc_server_protocol_backup_done)
                                          FALSE);
 
        /* Check couple of times same START_USE just in case. */
-       silc_schedule_task_add(server->schedule, 0,
-                              silc_server_backup_check_status,
-                              silc_socket_dup(server->router->connection),
-                              5, 1, SILC_TASK_TIMEOUT,
-                              SILC_TASK_PRI_NORMAL);
-       silc_schedule_task_add(server->schedule, 0,
-                              silc_server_backup_check_status,
-                              silc_socket_dup(server->router->connection),
-                              20, 1, SILC_TASK_TIMEOUT,
-                              SILC_TASK_PRI_NORMAL);
-       silc_schedule_task_add(server->schedule, 0,
-                              silc_server_backup_check_status,
-                              silc_socket_dup(server->router->connection),
-                              60, 1, SILC_TASK_TIMEOUT,
-                              SILC_TASK_PRI_NORMAL);
+       silc_packet_stream_ref(server->router->connection);
+       silc_schedule_task_add_timeout(server->schedule,
+                                      silc_server_backup_check_status,
+                                      server->router->connection,
+                                      5, 1);
+       silc_packet_stream_ref(server->router->connection);
+       silc_schedule_task_add_timeout(server->schedule,
+                                      silc_server_backup_check_status,
+                                      server->router->connection,
+                                      20, 1);
+       silc_packet_stream_ref(server->router->connection);
+       silc_schedule_task_add_timeout(server->schedule,
+                                      silc_server_backup_check_status,
+                                      server->router->connection,
+                                      60, 1);
       }
     }
   }
 
-  if (ctx->sock && ctx->sock->protocol)
-    ctx->sock->protocol = NULL;
-  if (ctx->sock)
-    silc_socket_free(ctx->sock); /* unref */
-  silc_protocol_free(protocol);
+  if (ctx->sock) {
+    SilcServerEntry r = silc_packet_get_context(ctx->sock);
+    if (r) {
+      r->backup = FALSE;
+      r->backup_proto = NULL;
+    }
+    silc_packet_stream_unref(ctx->sock);
+  }
   silc_free(ctx->sessions);
   silc_free(ctx);
-#endif /* 0 */
 }
 
 SILC_TASK_CALLBACK(silc_server_backup_announce_watches)
 {
-#if 0
   SilcPacketStream sock = context;
   SilcServer server = app_context;
-  if (sock->users > 1)
+  if (silc_packet_stream_is_valid(sock))
     silc_server_announce_watches(server, sock);
-  silc_socket_free(sock);
-#endif /* 0 */
+  silc_packet_stream_unref(sock);
 }
index 663057ec3550450e427cb8b9b3cc377650658fbf..720cc822203bfd555175383a7676122a96c09a42 100644 (file)
@@ -141,6 +141,9 @@ static void silc_server_http_callback(SilcHttpServer httpd,
 
 void silc_server_http_init(SilcServer server)
 {
+  if (!server->config->httpd_ip)
+    return;
+
   /* Allocate HTTP server */
   server->httpd = silc_http_server_alloc(server->config->httpd_ip,
                                         server->config->httpd_port,
index afedb0bdc77ec68459ff5a798b4b8db9ec127baa..e6b916ec7a1431dafc0ba2d1547488f9502cea92 100644 (file)
@@ -120,10 +120,6 @@ struct SilcServerStruct {
   /* Pending command queue */
   SilcDList pending_commands;
 
-  /* Purge context for disconnected clients */
-  SilcIDListPurge purge_i;
-  SilcIDListPurge purge_g;
-
   unsigned int server_type    : 2;   /* Server type (server.h) */
   unsigned int standalone     : 1;   /* Set if server is standalone, and
                                        does not have connection to network. */
index 166db3af25b8efd350e61b5c4350c92a30b4522e..cd5103a4a28a6033c052f62df79a8bb3dc98a4c7 100644 (file)
@@ -61,6 +61,7 @@ typedef struct {
   SilcDList attrs;                 /* Requested Attributes in WHOIS */
 
   /* Query session data */
+  SilcPacketStream router;         /* Router to send our query */
   SilcServerCommandContext cmd;            /* Command context for query */
   SilcServerQueryList querylist;    /* Temporary query list context */
   SilcServerQueryID queries;       /* Ongoing queries */
@@ -69,11 +70,16 @@ typedef struct {
   SilcUInt16 queries_count;        /* Number of ongoing queries */
   SilcUInt16 queries_left;         /* Number of ongoing queries left */
   SilcUInt16 errors_count;         /* number of errors */
-  unsigned int querycmd : 7;       /* Query command (SilcCommand) */
-  unsigned int resolved : 1;       /* TRUE if normal server has resolved
+  unsigned int querycmd      : 7;   /* Query command (SilcCommand) */
+  unsigned int resolved      : 1;   /* TRUE if normal server has resolved
                                       information from router */
+  unsigned int dynamic_prim  : 1;   /* Dynamic connection attempt to primary */
+  unsigned int dynamic_retry : 1;   /* Primary returned error, send to
+                                      nick@serv server. */
+  unsigned int parsed        : 1;   /* Set when query is parsed */
 } *SilcServerQuery;
 
+
 void silc_server_query_free(SilcServerQuery query);
 void silc_server_query_send_error(SilcServer server,
                                  SilcServerQuery query,
@@ -89,7 +95,8 @@ void silc_server_query_add_error_id(SilcServer server,
                                    void *id, SilcIdType id_type);
 void silc_server_query_send_router(SilcServer server, SilcServerQuery query);
 void silc_server_query_send_router_reply(void *context, void *reply);
-void silc_server_query_parse(SilcServer server, SilcServerQuery query);
+SilcBool silc_server_query_parse(SilcServer server, SilcServerQuery query,
+                                SilcBool parse_only);
 void silc_server_query_process(SilcServer server, SilcServerQuery query,
                               SilcBool resolve);
 void silc_server_query_resolve(SilcServer server, SilcServerQuery query,
@@ -220,16 +227,22 @@ void silc_server_query_add_error_id(SilcServer server,
    to the entity who sent this query to us automatically.  Returns
    TRUE if the query is being processed or FALSE on error. */
 
-SilcBool silc_server_query_command(SilcServer server, SilcCommand querycmd,
-                                  SilcServerCommandContext cmd)
+SilcBool silc_server_query_command(SilcServer server,
+                                  SilcCommand querycmd,
+                                  SilcServerCommandContext cmd,
+                                  void *old_query)
 {
   SilcServerQuery query;
 
   SILC_LOG_DEBUG(("Query %s command", silc_get_command_name(querycmd)));
 
-  query = silc_calloc(1, sizeof(*query));
-  query->querycmd = querycmd;
-  query->cmd = silc_server_command_dup(cmd);
+  if (!old_query) {
+    query = silc_calloc(1, sizeof(*query));
+    query->querycmd = querycmd;
+    query->cmd = silc_server_command_dup(cmd);
+    query->router = SILC_PRIMARY_ROUTE(server);
+  } else
+    query = old_query;
 
   switch (querycmd) {
 
@@ -243,6 +256,8 @@ SilcBool silc_server_query_command(SilcServer server, SilcCommand querycmd,
         (!silc_argument_get_arg_type(cmd->args, 1, NULL) &&
          !silc_argument_get_arg_type(cmd->args, 4, NULL) &&
          silc_argument_get_arg_type(cmd->args, 3, NULL)))) {
+      if (!silc_server_query_parse(server, query, TRUE))
+       return FALSE;
       silc_server_query_send_router(server, query);
       return TRUE;
     }
@@ -264,6 +279,8 @@ SilcBool silc_server_query_command(SilcServer server, SilcCommand querycmd,
     if (server->server_type == SILC_SERVER && !server->standalone &&
        cmd->sock != SILC_PRIMARY_ROUTE(server) &&
        !silc_argument_get_arg_type(cmd->args, 5, NULL)) {
+      if (!silc_server_query_parse(server, query, TRUE))
+       return FALSE;
       silc_server_query_send_router(server, query);
       return TRUE;
     }
@@ -276,11 +293,50 @@ SilcBool silc_server_query_command(SilcServer server, SilcCommand querycmd,
   }
 
   /* Now parse the request */
-  silc_server_query_parse(server, query);
+  silc_server_query_parse(server, query, FALSE);
 
   return TRUE;
 }
 
+/* Remote server connected callback. */
+
+void silc_server_query_connected(SilcServer server,
+                                SilcServerEntry server_entry,
+                                void *context)
+{
+  SilcServerQuery query = context;
+
+  if (!server_entry) {
+    /* Connecting failed */
+    SilcConnectionType type = (server->server_type == SILC_ROUTER ?
+                              SILC_CONN_SERVER : SILC_CONN_ROUTER);
+
+    if (query->dynamic_prim /* && @serv != prim.host.name */ &&
+       !silc_server_num_sockets_by_remote(server, query->nick_server,
+                                          query->nick_server, 706, type)) {
+      /* Connection attempt to primary router failed, now try to the one
+        specified in nick@server. */
+      silc_server_create_connection(server, FALSE, TRUE, query->nick_server,
+                                   706, silc_server_query_connected,
+                                   query);
+      query->dynamic_prim = FALSE;
+      return;
+    }
+
+    /* Process the query after failed connect.  This will send error back
+       because such nick was not found. */
+    SILC_LOG_DEBUG(("Process query, connecting failed"));
+    silc_server_query_process(server, query, TRUE);
+    return;
+  }
+
+  /* Reprocess the query */
+  SILC_LOG_DEBUG(("Reprocess query after creating connection to %s",
+                 server_entry->server_name));
+  query->router = server_entry->data.sconn->sock;
+  silc_server_query_command(server, query->querycmd, query->cmd, query);
+}
+
 /* Send the received query to our primary router since we could not
    handle the query directly.  We will reprocess the query after our
    router replies back. */
@@ -290,7 +346,8 @@ void silc_server_query_send_router(SilcServer server, SilcServerQuery query)
   SilcBuffer tmpbuf;
   SilcUInt16 old_ident;
 
-  SILC_LOG_DEBUG(("Forwarding the query to router for processing"));
+  SILC_LOG_DEBUG(("Forwarding the query to router %p for processing",
+                 query->router));
 
   /* Statistics */
   server->stat.commands_sent++;
@@ -299,8 +356,7 @@ void silc_server_query_send_router(SilcServer server, SilcServerQuery query)
   old_ident = silc_command_get_ident(query->cmd->payload);
   silc_command_set_ident(query->cmd->payload, ++server->cmd_ident);
   tmpbuf = silc_command_payload_encode_payload(query->cmd->payload);
-  silc_server_packet_send(server,
-                         SILC_PRIMARY_ROUTE(server),
+  silc_server_packet_send(server, query->router,
                          SILC_PACKET_COMMAND, 0,
                          tmpbuf->data, silc_buffer_len(tmpbuf));
   silc_command_set_ident(query->cmd->payload, old_ident);
@@ -334,6 +390,23 @@ void silc_server_query_send_router_reply(void *context, void *reply)
   /* Check if router sent error reply */
   if (cmdr && !silc_command_get_status(cmdr->payload, NULL, NULL)) {
     SilcBuffer buffer;
+    SilcConnectionType type = (server->server_type == SILC_ROUTER ?
+                              SILC_CONN_SERVER : SILC_CONN_ROUTER);
+
+    /* If this was nick@server query, retry to @serv if the primary router
+       returned error. */
+    if (query->nick_server[0] && !query->dynamic_retry &&
+       !silc_server_num_sockets_by_remote(server, query->nick_server,
+                                          query->nick_server, 1334, type)) {
+      SILC_LOG_DEBUG(("Retry query by connecting to %s:%d",
+                     query->nick_server, 706));
+      silc_server_create_connection(server, FALSE, TRUE, query->nick_server,
+                                   1334, silc_server_query_connected,
+                                   query);
+      query->dynamic_retry = TRUE;
+      query->resolved = FALSE;
+      return;
+    }
 
     SILC_LOG_DEBUG(("Sending error to original query"));
 
@@ -354,12 +427,13 @@ void silc_server_query_send_router_reply(void *context, void *reply)
   }
 
   /* Continue with parsing */
-  silc_server_query_parse(server, query);
+  silc_server_query_parse(server, query, FALSE);
 }
 
 /* Parse the command query and start processing the queries in detail. */
 
-void silc_server_query_parse(SilcServer server, SilcServerQuery query)
+SilcBool silc_server_query_parse(SilcServer server, SilcServerQuery query,
+                                SilcBool parse_only)
 {
   SilcServerCommandContext cmd = query->cmd;
   SilcIDListData idata = silc_packet_get_context(cmd->sock);
@@ -371,6 +445,9 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
   SILC_LOG_DEBUG(("Parsing %s query",
                  silc_get_command_name(query->querycmd)));
 
+  if (query->parsed)
+    goto parsed;
+
   switch (query->querycmd) {
 
   case SILC_COMMAND_WHOIS:
@@ -397,7 +474,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
        silc_server_query_send_error(server, query,
                                     SILC_STATUS_ERR_NOT_ENOUGH_PARAMS, 0);
        silc_server_query_free(query);
-       return;
+       return FALSE;
       }
 
       /* Get the nickname@server string and parse it */
@@ -409,7 +486,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
        silc_server_query_send_error(server, query,
                                     SILC_STATUS_ERR_BAD_NICKNAME, 0);
        silc_server_query_free(query);
-       return;
+       return FALSE;
       }
 
       /* Check nickname */
@@ -420,7 +497,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
          silc_server_query_send_error(server, query,
                                       SILC_STATUS_ERR_BAD_NICKNAME, 0);
          silc_server_query_free(query);
-         return;
+         return FALSE;
        }
        memset(query->nickname, 0, sizeof(query->nickname));
        silc_snprintf(query->nickname, sizeof(query->nickname), "%s", tmp);
@@ -457,7 +534,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
              silc_free(query->ids);
              query->ids = NULL;
              query->ids_count = 0;
-             return;
+             return FALSE;
            }
          }
        }
@@ -482,7 +559,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
       silc_server_query_send_error(server, query,
                                   SILC_STATUS_ERR_NOT_ENOUGH_PARAMS, 0);
       silc_server_query_free(query);
-      return;
+      return FALSE;
     }
 
     /* Get the nickname@server string and parse it */
@@ -492,7 +569,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
       silc_server_query_send_error(server, query,
                                   SILC_STATUS_ERR_BAD_NICKNAME, 0);
       silc_server_query_free(query);
-      return;
+      return FALSE;
     }
 
     /* Check nickname */
@@ -502,7 +579,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
       silc_server_query_send_error(server, query,
                                   SILC_STATUS_ERR_BAD_NICKNAME, 0);
       silc_server_query_free(query);
-      return;
+      return FALSE;
     }
     memset(query->nickname, 0, sizeof(query->nickname));
     silc_snprintf(query->nickname, sizeof(query->nickname), "%s", tmp);
@@ -538,7 +615,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
          silc_server_query_send_error(server, query,
                                       SILC_STATUS_ERR_BAD_NICKNAME, 0);
          silc_server_query_free(query);
-         return;
+         return FALSE;
        }
        memset(query->nickname, 0, sizeof(query->nickname));
        silc_snprintf(query->nickname, sizeof(query->nickname), "%s", tmp);
@@ -555,7 +632,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
          silc_server_query_send_error(server, query,
                                       SILC_STATUS_ERR_BAD_SERVER, 0);
          silc_server_query_free(query);
-         return;
+         return FALSE;
        }
        query->server_name = tmp;
       }
@@ -570,7 +647,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
          silc_server_query_send_error(server, query,
                                       SILC_STATUS_ERR_BAD_CHANNEL, 0);
          silc_server_query_free(query);
-         return;
+         return FALSE;
        }
        query->channel_name = tmp;
       }
@@ -579,7 +656,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
        silc_server_query_send_error(server, query,
                                     SILC_STATUS_ERR_NOT_ENOUGH_PARAMS, 0);
        silc_server_query_free(query);
-       return;
+       return FALSE;
       }
 
     } else {
@@ -613,7 +690,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
                silc_free(query->ids);
                query->ids = NULL;
                query->ids_count = 0;
-               return;
+               return FALSE;
              }
            }
          } else {
@@ -625,7 +702,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
            silc_free(query->ids);
            query->ids = NULL;
            query->ids_count = 0;
-           return;
+           return FALSE;
          }
        }
 
@@ -650,8 +727,54 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
     break;
   }
 
+  query->parsed = TRUE;
+
+ parsed:
+  if (!parse_only && query->nickname) {
+    switch (query->querycmd) {
+    case SILC_COMMAND_WHOIS:
+    case SILC_COMMAND_IDENTIFY:
+      /* Check server name.  If we are open server and don't yet have
+        connection to remote router, create it now. */
+      if (query->nick_server[0] && server->config->dynamic_server &&
+         !query->resolved) {
+       /* If primary router is specified, use that.  Otherwise connect
+          to the server in nick@server string. */
+       SilcServerConfigRouter *router;
+       SilcConnectionType type = (server->server_type == SILC_ROUTER ?
+                                  SILC_CONN_SERVER : SILC_CONN_ROUTER);
+
+       router = silc_server_config_get_primary_router(server);
+       if (router && server->standalone) {
+         /* Create connection to primary router */
+         SILC_LOG_DEBUG(("Create dynamic connection to primary router %s:%d",
+                         router->host, router->port));
+         query->dynamic_prim = TRUE;
+         silc_server_create_connection(server, FALSE, TRUE,
+                                       router->host, router->port,
+                                       silc_server_query_connected, query);
+         return FALSE;
+       } else if (!silc_server_num_sockets_by_remote(server,
+                                                     query->nick_server,
+                                                     query->nick_server,
+                                                     706, type)) {
+         /* Create connection and handle the query after connection */
+         SILC_LOG_DEBUG(("Create dynamic connection to %s:%d",
+                         query->nick_server, 706));
+         silc_server_create_connection(server, FALSE, TRUE,
+                                       query->nick_server, 706,
+                                       silc_server_query_connected, query);
+         return FALSE;
+       }
+      }
+    }
+  }
+
   /* Start processing the query information */
-  silc_server_query_process(server, query, TRUE);
+  if (!parse_only)
+    silc_server_query_process(server, query, TRUE);
+
+  return TRUE;
 }
 
 /* Context for holding clients searched by public key. */
@@ -827,23 +950,29 @@ void silc_server_query_process(SilcServer server, SilcServerQuery query,
   if (query->nickname[0]) {
     /* Get all clients matching nickname from local list */
     if (!silc_idlist_get_clients_by_hash(server->local_list,
-                                        query->nickname, server->md5hash,
+                                        query->nickname,
+                                        query->nick_server[0] ?
+                                        query->nick_server : NULL,
+                                        server->md5hash,
                                         &clients, &clients_count))
       silc_idlist_get_clients_by_nickname(server->local_list,
                                          query->nickname,
-                                         query->nick_server,
-                                        /* XXX nick_server may not be set */
+                                         query->nick_server[0] ?
+                                         query->nick_server : NULL,
                                          &clients, &clients_count);
 
     /* Check global list as well */
     if (check_global) {
       if (!silc_idlist_get_clients_by_hash(server->global_list,
-                                          query->nickname, server->md5hash,
+                                          query->nickname,
+                                          query->nick_server[0] ?
+                                          query->nick_server : NULL,
+                                          server->md5hash,
                                           &clients, &clients_count))
        silc_idlist_get_clients_by_nickname(server->global_list,
                                            query->nickname,
-                                           query->nick_server,
-                                        /* XXX nick_server may not be set */
+                                           query->nick_server[0] ?
+                                           query->nick_server : NULL,
                                            &clients, &clients_count);
     }
 
index 53a11ee25fc86372e3df271861b958ab9349558f..a9a0e02c90142549c388e1fbb4fc55b01264e509 100644 (file)
@@ -27,7 +27,8 @@
    to the entity who sent this query to us automatically.  Returns
    TRUE if the query is being processed or FALSE on error. */
 SilcBool silc_server_query_command(SilcServer server, SilcCommand querycmd,
-                                  SilcServerCommandContext cmd);
+                                  SilcServerCommandContext cmd,
+                                  void *old_query);
 
 /* Find client by the Client ID indicated by the `client_id', and if not
    found then query it by using WHOIS command.  The client information
index 3086aef444e2d77a4e4cec4cd46cf344e934ec2a..19ea23e67821e2efb77f6fe817ce5bc773890ed3 100644 (file)
@@ -189,17 +189,19 @@ SilcBool silc_server_remove_clients_by_server(SilcServer server,
 
       if (server_signoff) {
        idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
-       argv = silc_realloc(argv, sizeof(*argv) * (argc + 1));
-       argv_lens = silc_realloc(argv_lens, sizeof(*argv_lens) *
-                                (argc + 1));
-       argv_types = silc_realloc(argv_types, sizeof(*argv_types) *
-                                 (argc + 1));
-       argv[argc] = silc_calloc(silc_buffer_len(idp), sizeof(*argv[0]));
-       memcpy(argv[argc], idp->data, silc_buffer_len(idp));
-       argv_lens[argc] = silc_buffer_len(idp);
-       argv_types[argc] = argc + 1;
-       argc++;
-       silc_buffer_free(idp);
+       if (idp) {
+         argv = silc_realloc(argv, sizeof(*argv) * (argc + 1));
+         argv_lens = silc_realloc(argv_lens, sizeof(*argv_lens) *
+                                  (argc + 1));
+         argv_types = silc_realloc(argv_types, sizeof(*argv_types) *
+                                   (argc + 1));
+         argv[argc] = silc_calloc(silc_buffer_len(idp), sizeof(*argv[0]));
+         memcpy(argv[argc], idp->data, silc_buffer_len(idp));
+         argv_lens[argc] = silc_buffer_len(idp);
+         argv_types[argc] = argc + 1;
+         argc++;
+         silc_buffer_free(idp);
+       }
       }
 
       /* Update statistics */
@@ -411,10 +413,8 @@ silc_server_update_clients_by_real_server(SilcServer server,
           since the server is local. */
        if (!local) {
          SILC_LOG_DEBUG(("Moving client to local list"));
-         silc_idcache_add(server->local_list->clients, client_cache->name,
-                          client_cache->id, client_cache->context);
-         silc_idcache_del_by_context(server->global_list->clients, client,
-                                     NULL);
+         silc_idcache_move(server->global_list->clients,
+                           server->local_list->clients, client_cache);
        }
        server_entry = server_entry->router;
       } else {
@@ -423,20 +423,16 @@ silc_server_update_clients_by_real_server(SilcServer server,
           since the server is local. */
        if (server_entry->server_type != SILC_BACKUP_ROUTER && !local) {
          SILC_LOG_DEBUG(("Moving client to local list"));
-         silc_idcache_add(server->local_list->clients, client_cache->name,
-                          client_cache->id, client_cache->context);
-         silc_idcache_del_by_context(server->global_list->clients, client,
-                                     NULL);
+         silc_idcache_move(server->global_list->clients,
+                           server->local_list->clients, client_cache);
 
        } else if (server->server_type == SILC_BACKUP_ROUTER && local) {
          /* If we are backup router and this client is on local list, we
             must move it to global list, as it is not currently local to
             us (we are not primary). */
          SILC_LOG_DEBUG(("Moving client to global list"));
-         silc_idcache_add(server->global_list->clients, client_cache->name,
-                          client_cache->id, client_cache->context);
-         silc_idcache_del_by_context(server->local_list->clients, client,
-                                     NULL);
+         silc_idcache_move(server->local_list->clients,
+                           server->global_list->clients, client_cache);
        }
       }
 
@@ -463,10 +459,8 @@ silc_server_update_clients_by_real_server(SilcServer server,
           since the server is global. */
        if (local) {
          SILC_LOG_DEBUG(("Moving client to global list"));
-         silc_idcache_add(server->global_list->clients, client_cache->name,
-                          client_cache->id, client_cache->context);
-         silc_idcache_del_by_context(server->local_list->clients, client,
-                                     NULL);
+         silc_idcache_move(server->local_list->clients,
+                           server->global_list->clients, client_cache);
        }
        server_entry = server_entry->router;
       } else {
@@ -475,10 +469,8 @@ silc_server_update_clients_by_real_server(SilcServer server,
           since the server is global. */
        if (server_entry->server_type != SILC_BACKUP_ROUTER && local) {
          SILC_LOG_DEBUG(("Moving client to global list"));
-         silc_idcache_add(server->global_list->clients, client_cache->name,
-                          client_cache->id, client_cache->context);
-         silc_idcache_del_by_context(server->local_list->clients, client,
-                                     NULL);
+         silc_idcache_move(server->local_list->clients,
+                           server->global_list->clients, client_cache);
        }
       }
       return server_entry;
@@ -1052,19 +1044,29 @@ silc_server_find_socket_by_host(SilcServer server,
 SilcUInt32 silc_server_num_sockets_by_remote(SilcServer server,
                                             const char *ip,
                                             const char *hostname,
-                                            SilcUInt16 port)
+                                            SilcUInt16 port,
+                                            SilcConnectionType type)
 {
   SilcServerConnection conn;
+  SilcIDListData idata;
+  SilcConnectionType t = SILC_CONN_UNKNOWN;
   int count = 0;
 
   if (!ip && !hostname)
     return 0;
 
+  SILC_LOG_DEBUG(("Num connections %d", silc_dlist_count(server->conns)));
+
   silc_dlist_start(server->conns);
   while ((conn = silc_dlist_get(server->conns))) {
+    if (conn->sock) {
+      idata = silc_packet_get_context(conn->sock);
+      if (idata)
+       t = idata->conn_type;
+    }
     if (((ip && !strcmp(conn->remote_host, ip)) ||
         (hostname && !strcmp(conn->remote_host, hostname))) &&
-       conn->remote_port == port)
+       conn->remote_port == port && t == type)
       count++;
   }
 
@@ -1221,6 +1223,7 @@ SilcBool silc_server_connection_allowed(SilcServer server,
                  global->connections_max_per_host);
 
   if (max_hosts && conn_number >= max_hosts) {
+    SILC_LOG_DEBUG(("Server is full, %d >= %d", conn_number, max_hosts));
     SILC_LOG_INFO(("Server is full, closing %s (%s) connection",
                   hostname, ip));
     silc_server_disconnect_remote(server, sock,
@@ -1230,6 +1233,8 @@ SilcBool silc_server_connection_allowed(SilcServer server,
   }
 
   if (num_sockets >= max_per_host) {
+    SILC_LOG_DEBUG(("Too many connections, %d >= %d", num_sockets,
+                   max_per_host));
     SILC_LOG_INFO(("Too many connections from %s (%s), closing connection",
                   hostname, ip));
     silc_server_disconnect_remote(server, sock,
@@ -1985,7 +1990,7 @@ void silc_server_create_connections(SilcServer server)
   silc_schedule_task_del_by_callback(server->schedule,
                                     silc_server_connect_to_router);
   silc_schedule_task_add_timeout(server->schedule,
-                                silc_server_connect_to_router, server, 0, 1);
+                                silc_server_connect_to_router, server, 1, 0);
 }
 
 static void
index e742585d420bcc822baed960c26432374d3c22d8..79e1add52a0a2ee8826d90d6af44d83d8a5ea001 100644 (file)
@@ -105,7 +105,8 @@ SilcUInt32 silc_server_num_sockets_by_ip(SilcServer server, const char *ip,
 SilcUInt32 silc_server_num_sockets_by_remote(SilcServer server,
                                             const char *ip,
                                             const char *hostname,
-                                            SilcUInt16 port);
+                                            SilcUInt16 port,
+                                            SilcConnectionType type);
 
 /* Get public key by key usage and key context. */
 SilcPublicKey silc_server_get_public_key(SilcServer server,
index 7d00e4de4667a8f195d498715e83d8d650752586..fca40453051f1d019c50179d965f34e013a8dc01 100644 (file)
@@ -150,7 +150,7 @@ static SilcBool my_parse_authdata(SilcAuthMethod auth_meth, const char *p,
     SilcPublicKey public_key;
     SilcSKR skr = *auth_data;
     SilcSKRFind find;
-    SilcSKRStatus status;
+    SilcSKRStatus status = SILC_SKR_NOT_FOUND;
 
     if (!silc_pkcs_load_public_key(p, &public_key)) {
       SILC_SERVER_LOG_ERROR(("Error while parsing config file: "
@@ -161,19 +161,20 @@ static SilcBool my_parse_authdata(SilcAuthMethod auth_meth, const char *p,
     find = silc_skr_find_alloc();
     silc_skr_find_set_public_key(find, public_key);
     silc_skr_find_set_usage(find, usage);
-    silc_skr_find_set_context(find, key_context ? key_context : (void *)usage);
+    if (!key_context)
+      silc_skr_find_set_context(find, SILC_32_TO_PTR(usage));
     silc_skr_find(skr, NULL, find, my_find_callback, &status);
-    if (status == SILC_SKR_ALREADY_EXIST) {
+    if (status == SILC_SKR_OK) {
+      /* Already added, ignore error */
       silc_pkcs_public_key_free(public_key);
-      SILC_SERVER_LOG_WARNING(("Warning: public key file \"%s\" already "
-                              "configured, ignoring this key", p));
-      return TRUE; /* non fatal error */
+      return TRUE;
     }
 
     /* Add the public key to repository */
-    if (silc_skr_add_public_key(skr, public_key, usage,
-                               key_context ? key_context : (void *)usage,
-                               NULL) != SILC_SKR_OK) {
+    status = silc_skr_add_public_key(skr, public_key, usage,
+                                    key_context ? key_context :
+                                    (void *)usage, NULL);
+    if (status != SILC_SKR_OK) {
       SILC_SERVER_LOG_ERROR(("Error while adding public key \"%s\"", p));
       return FALSE;
     }
@@ -338,6 +339,12 @@ SILC_CONFIG_CALLBACK(fetch_generic)
     }
     config->httpd_port = (SilcUInt16)port;
   }
+  else if (!strcmp(name, "dynamic_server")) {
+    config->dynamic_server = *(SilcBool *)val;
+  }
+  else if (!strcmp(name, "local_channels")) {
+    config->local_channels = *(SilcBool *)val;
+  }
   else
     return SILC_CONFIG_EINTERNAL;
 
@@ -582,6 +589,11 @@ SILC_CONFIG_CALLBACK(fetch_serverinfo)
     CONFIG_IS_DOUBLE(tmp->server_ip);
     tmp->server_ip = strdup((char *) val);
   }
+  else if (!strcmp(name, "public_ip")) {
+    SILC_SERVER_CONFIG_ALLOCTMP(SilcServerConfigServerInfoInterface);
+    CONFIG_IS_DOUBLE(tmp->public_ip);
+    tmp->public_ip = strdup((char *) val);
+  }
   else if (!strcmp(name, "port")) {
     int port = *(int *)val;
     SILC_SERVER_CONFIG_ALLOCTMP(SilcServerConfigServerInfoInterface);
@@ -1157,6 +1169,9 @@ SILC_CONFIG_CALLBACK(fetch_router)
   else if (!strcmp(name, "backuplocal")) {
     tmp->backup_local = *(SilcBool *)val;
   }
+  else if (!strcmp(name, "dynamic_connection")) {
+    tmp->dynamic_connection = *(SilcBool *)val;
+  }
   else
     return SILC_CONFIG_EINTERNAL;
 
@@ -1203,6 +1218,8 @@ static const SilcConfigTable table_general[] = {
   { "http_server",             SILC_CONFIG_ARG_TOGGLE, fetch_generic,  NULL },
   { "http_server_ip",                  SILC_CONFIG_ARG_STRE,   fetch_generic,  NULL },
   { "http_server_port",                SILC_CONFIG_ARG_INT,    fetch_generic,  NULL },
+  { "dynamic_server",                  SILC_CONFIG_ARG_TOGGLE, fetch_generic,  NULL },
+  { "local_channels",          SILC_CONFIG_ARG_TOGGLE, fetch_generic,  NULL },
   { 0, 0, 0, 0 }
 };
 
@@ -1236,6 +1253,7 @@ static const SilcConfigTable table_pkcs[] = {
 
 static const SilcConfigTable table_serverinfo_c[] = {
   { "ip",              SILC_CONFIG_ARG_STR,    fetch_serverinfo, NULL},
+  { "public_ip",       SILC_CONFIG_ARG_STR,    fetch_serverinfo, NULL},
   { "port",            SILC_CONFIG_ARG_INT,    fetch_serverinfo, NULL},
   { 0, 0, 0, 0 }
 };
@@ -1344,6 +1362,7 @@ static const SilcConfigTable table_routerconn[] = {
   { "backuphost",      SILC_CONFIG_ARG_STRE,   fetch_router,   NULL },
   { "backupport",      SILC_CONFIG_ARG_INT,    fetch_router,   NULL },
   { "backuplocal",     SILC_CONFIG_ARG_TOGGLE, fetch_router,   NULL },
+  { "dynamic_connection",      SILC_CONFIG_ARG_TOGGLE, fetch_router,   NULL },
   { 0, 0, 0, 0 }
 };
 
@@ -1396,6 +1415,24 @@ static SilcBool silc_server_config_check(SilcServerConfig config)
     ret = FALSE;
   }
 
+  if (!config->server_info->public_key ||
+      !config->server_info->private_key) {
+    SILC_SERVER_LOG_ERROR(("\nError: Server keypair is missing"));
+    ret = FALSE;
+  }
+
+  if (!config->server_info->primary) {
+    SILC_SERVER_LOG_ERROR(("\nError: Missing mandatory block `Primary' "
+                          "in `ServerInfo'"));
+    ret = FALSE;
+  }
+
+  if (!config->server_info->primary->server_ip) {
+    SILC_SERVER_LOG_ERROR(("\nError: Missing mandatory field `Ip' "
+                          "in `Primary' in `ServerInfo'"));
+    ret = FALSE;
+  }
+
   /* RouterConnection sanity checks */
 
   if (config->routers && config->routers->backup_router == TRUE &&
@@ -1405,15 +1442,6 @@ static SilcBool silc_server_config_check(SilcServerConfig config)
         "connection. You have marked it incorrectly as backup router."));
     ret = FALSE;
   }
-#if 0
-  if (config->routers && config->routers->initiator == FALSE &&
-      config->routers->backup_router == FALSE) {
-    SILC_SERVER_LOG_ERROR((
-         "\nError: First RouterConnection block must be primary router "
-        "connection and it must be marked as Initiator."));
-    ret = FALSE;
-  }
-#endif
   if (config->routers && config->routers->backup_router == TRUE &&
       !config->servers && !config->routers->next) {
     SILC_SERVER_LOG_ERROR((
index 7ef873e0797a56131c750d81dcf5c496f16b2eff..183f6501634cc1263bf8be9dc56265b61370a66f 100644 (file)
@@ -50,6 +50,7 @@ typedef struct SilcServerConfigPkcsStruct {
 
 typedef struct SilcServerConfigServerInfoInterfaceStruct {
   char *server_ip;
+  char *public_ip;
   SilcUInt16 port;
   struct SilcServerConfigServerInfoInterfaceStruct *next;
 } SilcServerConfigServerInfoInterface;
@@ -149,6 +150,7 @@ typedef struct SilcServerConfigRouterStruct {
   SilcServerConfigConnParams *param;
   SilcBool initiator;
   SilcBool backup_router;
+  SilcBool dynamic_connection;
   char *backup_replace_ip;
   SilcUInt16 backup_replace_port;
   SilcBool backup_local;
@@ -180,6 +182,8 @@ typedef struct {
   SilcBool httpd;
   char *httpd_ip;
   SilcUInt16 httpd_port;
+  SilcBool dynamic_server;
+  SilcBool local_channels;
 
   /* Other configuration sections */
   SilcServerConfigCipher *cipher;
index f840cab92e508a2b5ced3084607fd2e1ac48c4b6..73641c65dd13449a7dce351be999dab4db56f420 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2005 Pekka Riikonen
+  Copyright (C) 1997 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ void silc_id_create_server_id(const char *ip, SilcUInt16 port, SilcRng rng,
 
   (*new_id)->ip.data_len = silc_net_is_ip4(ip) ? 4 : 16;
   (*new_id)->port = SILC_SWAB_16(port);
-  (*new_id)->rnd = silc_rng_get_rn16(rng);
+  (*new_id)->rnd = 0xff;
 
   SILC_LOG_DEBUG(("New ID (%s)", silc_id_render(*new_id, SILC_ID_SERVER)));
 }
index 5bee97205e76a9181cb0d2d1d2f0cdc64c1837bb..14e3657f968d6fd64e6fdbb4b09caf8f00ea215a 100644 (file)
@@ -339,7 +339,7 @@ SILC_TASK_CALLBACK(dump_stats)
       SilcUInt16 port;
       SilcSocket sock;
       SilcIDListData idata = silc_packet_get_context(s);
-      if (!silc_socket_stream_get_info(silc_packet_stream_get_stream(s), 
+      if (!silc_socket_stream_get_info(silc_packet_stream_get_stream(s),
                                       &sock, &hostname, &ip, &port))
        continue;
       fprintf(fdd, "  %d: host %s ip %s port %d type %d\n",
@@ -470,43 +470,43 @@ static DebugLevel debug_levels[] = {
   { 15, "*silcd*,*serverid*,silc_server_*,*idlist*" },
 
   /* All from silcd/ and basic stuff from libs */
-  { 20, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,*silcske*" },
+  { 20, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,*silcske*" },
 
   /* All from silcd/ and more stuff from libs */
-  { 25, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+  { 25, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
     "*silcpacket*,*ske*,*silcrng*" },
 
   /* All from silcd/ and even more stuff from libs */
-  { 30, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+  { 30, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
     "*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*" },
 
   /* All from silcd/ and even more stuff from libs + all from silccore */
-  { 35, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+  { 35, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
     "*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
     "*silcid*,*argument*" },
 
   /* All from silcd/, all from silccore, silccrypt and silcmath */
-  { 40, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+  { 40, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
     "*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
     "*silcid*,*argument*,*pkcs*,*hmac*,*hash*,*cipher*,silc_math*" },
 
   /* All from silcd/, all from silccore, silccrypt and silcmath + stuff
      from silcutil */
-  { 45, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+  { 45, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
     "*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
     "*silcid*,*argument*,*pkcs*,*hmac*,*hash*,*cipher*,silc_math*,*sim*"
     "*sockconn*" },
 
   /* All from silcd/, all from silccore, silccrypt and silcmath + more stuff
      from silcutil */
-  { 50, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+  { 50, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
     "*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
     "*silcid*,*argument*,*pkcs*,*hmac*,*hash*,*cipher*,silc_math*,*sim*"
     "*sockconn*,*net*" },
 
   /* All from silcd/, all from silccore, silccrypt and silcmath + more stuff
      from silcutil */
-  { 55, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcauth*,"
+  { 55, "*silcd*,*serverid*,silc_server_*,*idlist*,*silcconauth*,"
     "*silcpacket*,*ske*,*silcrng*,*command*,*channel*,*private*,*notify*"
     "*silcid*,*argument*,*pkcs*,*hmac*,*hash*,*cipher*,silc_math*,*sim*"
     "*sockconn*,*net*,*log*,*config*" },
@@ -673,8 +673,9 @@ int main(int argc, char **argv)
     silc_pkcs_register_default();
     silc_hash_register_default();
     silc_hmac_register_default();
-    silc_create_key_pair(opt_pkcs, opt_bits, pubfile, prvfile,
-                        opt_identifier, "", NULL, NULL, FALSE);
+    if (!silc_create_key_pair(opt_pkcs, opt_bits, pubfile, prvfile,
+                             opt_identifier, "", NULL, NULL, FALSE))
+      exit(1);
     exit(0);
   }
 
index a303d5c4f8b59b1d74f0582739bc75c62fe4bb88..8ee9d61b87f5e4e494e6f19de149346b9fd56ebb 100644 (file)
@@ -33,6 +33,10 @@ AC_PATH_PROG(sedpath, sed)
 # Put here any platform specific stuff
 #
 case "$target" in
+  *-*-linux*)
+    check_threads=true
+    CFLAGS=`echo $CFLAGS -D_GNU_SOURCE`
+    ;;
   *-*-freebsd*)
     check_threads=true
     ;;
@@ -94,6 +98,29 @@ __SILC_HAVE_PTHREAD=""
 __SILC_HAVE_SIM=""
 __SILC_ENABLE_DEBUG=""
 
+#ifdef SILC_DIST_TOOLKIT
+toolkitver=`echo $VERSION | sed 's/\./ /g'`
+maj=0
+min=0
+bld=0
+for v in $toolkitver
+do
+  if test $maj -eq 0; then
+    maj=$v
+    continue
+  fi
+  if test $min -eq 0; then
+    min=$v
+    continue
+  fi
+  if test $bld -eq 0; then
+    bld=$v
+    continue
+  fi
+done
+__SILC_PACKAGE_VERSION="#define __SILC_TOOLKIT_VERSION SILC_VERSION($maj,$min,$bld)"
+#endif SILC_DIST_TOOLKIT
+
 AC_PROG_RANLIB
 #ifndef SILC_DIST_TOOLKIT
 AC_DISABLE_SHARED
@@ -182,43 +209,9 @@ AC_CHECK_FUNCS(poll select listen bind shutdown close connect setsockopt)
 AC_CHECK_FUNCS(setrlimit time ctime utime gettimeofday getrusage)
 AC_CHECK_FUNCS(chmod fcntl stat fstat getenv putenv strerror)
 AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid sched_yield)
-AC_CHECK_FUNCS(setgroups initgroups nl_langinfo nanosleep tzset)
+AC_CHECK_FUNCS(setgroups initgroups nl_langinfo nanosleep)
 AC_CHECK_FUNCS(strchr snprintf strstr strcpy strncpy memcpy memset memmove)
 
-#ifdef SILC_DIST_SIM
-# SIM support checking
-# XXX These needs to be changed as more supported platforms appear.
-# XXX This probably needs to be made platform dependant check.
-#
-sim_support=false
-AC_MSG_CHECKING(for SIM support)
-AC_MSG_RESULT()
-AC_CHECK_HEADERS(dlfcn.h,
-  [
-    AC_CHECK_LIB(dl, dlopen,
-      [
-        AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
-        sim_support=true
-        LIBS="$LIBS -ldl"
-      ],
-      [
-        AC_CHECK_LIB(c, dlopen,
-          [
-            AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
-            sim_support=true
-          ])
-      ])
-   ])
-
-AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
-if test x$sim_support = xtrue; then
-  AC_MSG_RESULT(Enabled SIM support.)
-  __SILC_HAVE_SIM="#define __SILC_HAVE_SIM 1"
-else
-  AC_MSG_RESULT(No SIM support found.)
-fi
-#endif SILC_DIST_SIM
-
 # lib/contrib conditionals
 #
 AC_CHECK_HEADER(regex.h,
@@ -327,6 +320,23 @@ AC_ARG_ENABLE(debug,
     AC_MSG_RESULT(no)
   ])
 
+# Disable all compiler optimizations
+#
+AC_MSG_CHECKING(whether to enable compiler optimizations)
+want_cc_optimizations=true
+AC_ARG_ENABLE(optimizations,
+  [  --disable-optimizations do not use any compiler optimizations],
+  [
+    AC_MSG_RESULT(no)
+    AC_DEFINE([SILC_NO_CC_OPTIMIZATIONS], [], [SILC_NO_CC_OPTIMIZATIONS])
+    want_cc_optimizations=false
+  ],
+  [
+    AC_MSG_RESULT(yes)
+    want_cc_optimizations=true
+  ])
+AM_CONDITIONAL(SILC_NO_CC_OPTIMIZATIONS, test x$want_cc_optimizations = xfalse)
+
 # Disable all assembler optimizations
 #
 AC_MSG_CHECKING(whether to enable assembler optimizations)
@@ -473,9 +483,9 @@ fi
 if test "$GCC"; then
   # GCC specific options
   if test "x$summary_debug" = "xyes"; then
-    SILC_ADD_CFLAGS(-g -O)
+    SILC_ADD_CFLAGS(-g)
   else
-    SILC_ADD_CFLAGS(-g -O2)
+    SILC_ADD_CFLAGS(-g)
   fi
   SILC_ADD_CFLAGS(-Wall -finline-functions)
   SILC_ADD_CFLAGS(-Wno-pointer-sign)
@@ -483,14 +493,13 @@ else
   # Other compilers
   case "$target" in
     alpha*-dec-osf*)
-      SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
+      SILC_ADD_CFLAGS(-g3)
       ;;
     mips*-sgi-irix*)
-      SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
+      SILC_ADD_CFLAGS(-g3)
       ;;
     *)
       SILC_ADD_CFLAGS(-g)
-      SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
       ;;
   esac
 
@@ -500,6 +509,30 @@ else
   fi
 fi
 
+if test x$want_cc_optimizations = xtrue; then
+  if test "$GCC"; then
+    # GCC specific options
+    if test "x$summary_debug" = "xyes"; then
+      SILC_ADD_CFLAGS(-O)
+    else
+      SILC_ADD_CFLAGS(-O2)
+    fi
+  else
+    # Other compilers
+    case "$target" in
+      alpha*-dec-osf*)
+        SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
+        ;;
+      mips*-sgi-irix*)
+        SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
+        ;;
+      *)
+        SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
+        ;;
+    esac
+  fi
+fi
+
 #
 # Workaround a bug in GCC 2.x which causes memory exhaustion
 # when compiling sha1 with optimizations on UltraSPARC.
@@ -531,54 +564,20 @@ AC_SUBST(FIX_SHA1)
 
 # Default installation destination
 #
-#ifdef SILC_DIST_AUTODIST
 AC_PREFIX_DEFAULT(/usr/local)
-#else !SILC_DIST_AUTODIST
-AC_PREFIX_DEFAULT(/usr/local/silc)
-#endif SILC_DIST_AUTODIST
 if test "x$prefix" != xNONE; then
   silc_prefix="$prefix"
 else
   silc_prefix="$ac_default_prefix"
+  prefix="$silc_prefix"
 fi
 
 #ifndef SILC_DIST_AUTODIST
-# etc directory
-#
-if test "x$sysconfdir" != 'x${prefix}/etc'; then
-  ETCDIR="$sysconfdir"
-else
-  ETCDIR="$silc_prefix/etc"
-fi
-
-AC_ARG_WITH(etcdir,
-  [[  --with-etcdir=DIR       directory for system files [/etc/silc]]],
-  [
-    case "$withval" in
-      no|yes)
-        ;;
-      *)
-        ETCDIR="$withval"
-        ;;
-    esac
-  ])
+ETCDIR=`eval echo $sysconfdir`;ETCDIR=`eval echo $ETCDIR`
 AC_SUBST(ETCDIR)
 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
 
-# doc directory
-#
-DOCDIR="$silc_prefix/doc"
-AC_ARG_WITH(docdir,
-  [[  --with-docdir=DIR       directory for SILC documentation [PREFIX/doc]]],
-  [
-    case "$withval" in
-      no|yes)
-        ;;
-      *)
-        DOCDIR="$withval"
-        ;;
-    esac
-  ])
+DOCDIR=`eval echo $docdir`;DOCDIR=`eval echo $DOCDIR`
 AC_SUBST(DOCDIR)
 AC_DEFINE_UNQUOTED([SILC_DOCDIR], "$DOCDIR", [SILC_DOCDIR])
 #endif SILC_DIST_AUTODIST
@@ -612,7 +611,9 @@ if test -n "$with_silc_includes" || test -n "$with_silc_libs"; then
   if test "$ac_silc_libs" != "no"; then
     compile_libs=false
     LIBSUBDIR=
-    LIBS="$LIBS -L$ac_silc_libs"
+    LDFLAGS="-L$ac_silc_libs $LDFLAGS"
+  else
+    LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
   fi
 
   # Check libs to link against
@@ -629,9 +630,9 @@ if test -n "$with_silc_includes" || test -n "$with_silc_libs"; then
 
 else
   # pkg-config check
-  PKG_CHECK_MODULES(SILC, silc, compile_libs=false, compile_libs=true)
+  PKG_CHECK_MODULES(SILC, [silc >= 1.1], compile_libs=false, compile_libs=true)
 #ifdef SILC_DIST_CLIENTLIB
-  PKG_CHECK_MODULES(SILCCLIENT, silcclient, compile_libs=false, compile_libs=true)
+  PKG_CHECK_MODULES(SILCCLIENT, [silcclient >= 1.1.1], compile_libs=false, compile_libs=true)
 #endif SILC_DIST_CLIENTLIB
 #ifdef SILC_DIST_SERVERLIB
   PKG_CHECK_MODULES(SILCSERVER, silcserver, compile_libs=false, compile_libs=true)
@@ -639,21 +640,57 @@ else
 
   if test x$compile_libs = xfalse; then
     LIBSUBDIR=
-    LIBS="$LIBS $SILC_LIBS"
+    LIBS="$SILC_LIBS $LIBS"
     CFLAGS="$CFLAGS $SILC_CFLAGS"
 #ifdef SILC_DIST_CLIENTLIB
-    LIBS="$LIBS $SILCCLIENT_LIBS"
+    LIBS="$SILCCLIENT_LIBS $LIBS"
     CFLAGS="$CFLAGS $SILCCLIENT_CFLAGS"
 #endif SILC_DIST_CLIENTLIB
 #ifdef SILC_DIST_SERVERLIB
     LIBS="$LIBS $SILCSERVER_LIBS"
     CFLAGS="$CFLAGS $SILCSERVER_CFLAGS"
 #endif SILC_DIST_SERVERLIB
+  else
+    LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
   fi
 fi
+#else SILC_DIST_TOOLKIT
+LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
 #endif SILC_DIST_TOOLKIT
 
-AC_SUBST(LIBSUBDIR)
+#ifdef SILC_DIST_SIM
+# SIM support checking
+# XXX These needs to be changed as more supported platforms appear.
+# XXX This probably needs to be made platform dependant check.
+#
+sim_support=false
+AC_MSG_CHECKING(for SIM support)
+AC_MSG_RESULT()
+AC_CHECK_HEADERS(dlfcn.h,
+  [
+    AC_CHECK_LIB(dl, dlopen,
+      [
+        AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
+        sim_support=true
+        LIBS="$LIBS -ldl"
+      ],
+      [
+        AC_CHECK_LIB(c, dlopen,
+          [
+            AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
+            sim_support=true
+          ])
+      ])
+   ])
+
+AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
+if test x$sim_support = xtrue; then
+  AC_MSG_RESULT(Enabled SIM support.)
+  __SILC_HAVE_SIM="#define __SILC_HAVE_SIM 1"
+else
+  AC_MSG_RESULT(No SIM support found.)
+fi
+#endif SILC_DIST_SIM
 
 # SOCKS4 support checking
 #
@@ -1158,6 +1195,77 @@ if test x$has_threads = xtrue; then
   __SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHREAD 1"
 fi
 
+#
+# Check for timezone and tm_gmtoff for timezone information
+#
+AC_MSG_CHECKING(whether system has timezone)
+AC_RUN_IFELSE(
+  [
+    #include <stdio.h>
+    #include <time.h>
+    int main()
+    {
+      timezone = 0;
+      return 0;
+    }
+  ],
+  [ AC_MSG_RESULT(yes)
+    AC_DEFINE([HAVE_TIMEZONE], [], [HAVE_TIMEZONE]) ],
+  [ AC_MSG_RESULT(no) ],
+  [ AC_MSG_RESULT(no) ]
+)
+AC_MSG_CHECKING(whether system has tm_gmtoff)
+AC_RUN_IFELSE(
+  [
+    #include <stdio.h>
+    #include <time.h>
+    int main()
+    {
+      struct tm tm;
+      tm.tm_gmtoff = 0;
+      return 0;
+    }
+  ],
+  [ AC_MSG_RESULT(yes)
+    AC_DEFINE([HAVE_TM_GMTOFF], [], [HAVE_TM_GMTOFF]) ],
+  [ AC_MSG_RESULT(no) ],
+  [ AC_MSG_RESULT(no) ]
+)
+AC_MSG_CHECKING(whether system has __tm_gmtoff)
+AC_RUN_IFELSE(
+  [
+    #include <stdio.h>
+    #include <time.h>
+    int main()
+    {
+      struct tm tm;
+      tm.__tm_gmtoff = 0;
+      return 0;
+    }
+  ],
+  [ AC_MSG_RESULT(yes)
+    AC_DEFINE([HAVE___TM_GMTOFF], [], [HAVE___TM_GMTOFF]) ],
+  [ AC_MSG_RESULT(no) ],
+  [ AC_MSG_RESULT(no) ]
+)
+AC_MSG_CHECKING(whether system has __tm_gmtoff__)
+AC_RUN_IFELSE(
+  [
+    #include <stdio.h>
+    #include <time.h>
+    int main()
+    {
+      struct tm tm;
+      tm.__tm_gmtoff__ = 0;
+      return 0;
+    }
+  ],
+  [ AC_MSG_RESULT(yes)
+    AC_DEFINE([HAVE___TM_GMTOFF__], [], [HAVE___TM_GMTOFF__]) ],
+  [ AC_MSG_RESULT(no) ],
+  [ AC_MSG_RESULT(no) ]
+)
+
 # Native WIN32 compilation under cygwin
 #
 AC_MSG_CHECKING(whether to compile native WIN32 code)
@@ -1230,12 +1338,15 @@ AD_INCLUDE_CONFIGURE
 #
 # Substitutions
 #
+AC_SUBST(LIBSUBDIR)
 AC_SUBST(SILC_TOP_SRCDIR)
+AC_SUBST(LDFLAGS)
 AC_SUBST(LIBS)
 AC_SUBST(SILC_LIB_INCLUDES)
 AC_SUBST(__SILC_HAVE_PTHREAD)
 AC_SUBST(__SILC_HAVE_SIM)
 AC_SUBST(__SILC_ENABLE_DEBUG)
+AC_SUBST(__SILC_PACKAGE_VERSION)
 
 #
 # Fix the libtool to support run-time configuration.  This allows us
index 450a4a075b75e171968b9fb4bd1e9249244aa73a..475a3f6fbd169554a24f8cab717ff378432e29ef 100644 (file)
@@ -1,6 +1,7 @@
 name SILC Autodist
 package autodist
 bug-report autodist-bugs@silcnet.org
+prereq 1.3.2
 
 license apps/autodist/COPYING
 license-header distdir/GPL-header distdir/BSD-header
@@ -19,5 +20,5 @@ exclude README.* ltmain.sh
 
 noprocess apps/autodist/doc/* apps/autodist/tests/*
 
-post-process-dist-hook distdir/post-process-dist
+post-process-dist-hook distdir/autodist-post-process-dist
 post-dist-hook distdir/post-dist
diff --git a/distdir/autodist-post-process-dist b/distdir/autodist-post-process-dist
new file mode 100644 (file)
index 0000000..768ce02
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+distribution=$1
+dist_version=$2
+package=$3
+distdir=$4
+
+# Remove all CVS directories, as some may be left when we put directories
+# in EXTRA_DIST or 'include' them in distribution.
+
+if test -d $distdir; then
+  rm -rf `find $distdir -name CVS`
+  rm -rf `find $distdir -name Makefile`
+fi
+
+release=$5
+if test -z $release; then
+  release="0.fc7"
+fi
+
+sed -e "s/AUTODIST_VERSION/$dist_version/" -e "s/AUTODIST_RELEASE/$release/" \
+  apps/autodist/autodist.spec.in > $distdir/autodist.spec
+
index c84d1d64a283d91818fb3eb1d634633175b4df9e..4ad2f057443444116a1cb44cb3e2ad6ccfd9af7f 100644 (file)
@@ -1,6 +1,7 @@
 name Client
 package silc-client
 bug-report silc-devel@lists.silcnet.org
+prereq 1.3.2
 
 inherit common
 define SILC_DIST_CLIENT
index 37871e6f3dd25f18c850bf0a4f9901122627fd27..100936f9fec534a3a9da503a743dc66b919cffa0 100644 (file)
@@ -5,7 +5,6 @@ define SILC_DIST_APPS
 define SILC_DIST_LIB
 define SILC_DIST_INCLUDES
 define SILC_DIST_DOC
-define SILC_DIST_SIM
 define SILC_DIST_SFTP
 define SILC_DIST_COMPILER
 define SILC_DIST_IDCACHE
index 9c3a9060884bb9a6417e5c83191872d5faefb3ba..53ecb918081aa8f350bcac0777a2a023f01c78ca 100644 (file)
@@ -14,6 +14,7 @@ inherit server
 inherit toolkit
 
 define SILC_DIST_INPLACE
+define SILC_DIST_SIM
 
 # SFTP is undefined in server, so force it here
 define SILC_DIST_SFTP
index 0e9619dcae785cb7050d6d0e8ccef7ec348905c7..bf3ffb3d2c494d68577fdf4f01207a8606d4c126 100644 (file)
@@ -4,6 +4,14 @@ distribution=$1
 dist_version=$2
 package=$3
 distdir=$4
+release=$5
+
+if test -z $release; then
+  release="0.fc7"
+fi
+
+sed -e "s/SILC_VERSION/$dist_version/" -e "s/SILC_RELEASE/$release/" \
+  apps/irssi/silc-client.spec.in > apps/irssi/silc-client.spec
 
 cd doc
 make dist-hook
index f8a5f11de404598b14c18be85912bf87e820dbba..12d05fd464a1ae6a23ced79c25e1b936f0caae78 100644 (file)
@@ -4,6 +4,14 @@ distribution=$1
 dist_version=$2
 package=$3
 distdir=$4
+release=$5
+
+if test -z $release; then
+  release="0.fc7"
+fi
+
+sed -e "s/SILC_VERSION/$dist_version/" -e "s/SILC_RELEASE/$release/" \
+  silc-toolkit.spec.in > silc-toolkit.spec
 
 ./configure
 
@@ -13,4 +21,3 @@ rm -rf toolkit
 make toolkit-ref-html
 cp ../lib/doc/*.gif toolkit
 cd ..
-
index fd3f71d57f647c416ce09caaeead36842a6cc277..30afb49360498afddbcb9c18d1874bf07aee0c60 100644 (file)
@@ -6,6 +6,7 @@ inherit common
 define SILC_DIST_SERVER
 #define SILC_DIST_SERVERLIB
 define SILC_DIST_HTTP
+define SILC_DIST_SIM
 undef SILC_DIST_SFTP
 
 post-process-dist-hook distdir/post-process-dist
index 17c80c94f76da77b00acd862d66d7f4b2203af39..9d32fc2980d9d1108b7cfa6f7fee4ceb34acd9ec 100644 (file)
@@ -1,6 +1,7 @@
 name Toolkit
 package silc-toolkit
 bug-report silc-devel@lists.silcnet.org
+prereq 1.3.2
 
 # Inherits
 inherit common
@@ -15,6 +16,7 @@ license-header distdir/GPL-header distdir/TOOLKIT-header
 define SILC_DIST_TOOLKIT
 define SILC_DIST_CLIENTLIB
 define SILC_DIST_HTTP
+define SILC_DIST_SIM
 
 # Includes
 include README.CVS
index 2c9855e41b5366431d85b6e717ed7f7a63ffd54a..1818fc1c479d62f96360dfd5f83e7d60a0680c53 100644 (file)
@@ -17,6 +17,7 @@
 
 AUTOMAKE_OPTIONS = 1.0 no-dependencies foreign
 
+#ifdef SILC_DIST_TOOLKIT
 all:
        touch draft-riikonen-silc-spec-09.txt
        touch draft-riikonen-silc-pp-09.txt
@@ -26,7 +27,6 @@ all:
        touch draft-riikonen-silc-multimedia-session-00.txt
        touch draft-riikonen-presence-attrs-04.txt
 
-#ifdef SILC_DIST_TOOLKIT
 makerfc = $(SILC_TOP_SRCDIR)/scripts/makerfc
 
 toolkit-ref-html:
@@ -52,7 +52,6 @@ toolkit-ref-pdf:
         fi
 
 dist-hook:
-       $(SILC_TOP_SRCDIR)/scripts/manpages.pl
        touch draft-riikonen-silc-spec-09.txt
        touch draft-riikonen-silc-pp-09.txt
        touch draft-riikonen-silc-ke-auth-09.txt
@@ -78,14 +77,6 @@ dist-hook:
 #else !SILC_DIST_TOOLKIT
 dist-hook:
        $(SILC_TOP_SRCDIR)/scripts/manpages.pl
-       rm -f draft-riikonen*.txt
-       touch draft-riikonen-silc-spec-09.txt
-       touch draft-riikonen-silc-pp-09.txt
-       touch draft-riikonen-silc-ke-auth-09.txt
-       touch draft-riikonen-silc-commands-07.txt
-       touch draft-riikonen-silc-flags-payloads-04.txt
-       touch draft-riikonen-silc-multimedia-session-00.txt
-       touch draft-riikonen-presence-attrs-04.txt
 #endif SILC_DIST_TOOLKIT
 
 doc-install:
@@ -94,9 +85,9 @@ doc-install:
        -$(INSTALL_DATA) $(top_srcdir)/doc/CodingStyle $(docdir)/
        -$(INSTALL_DATA) $(top_srcdir)/GPL $(docdir)/
        -$(INSTALL_DATA) $(top_srcdir)/BSD $(docdir)/
+       -$(INSTALL_DATA) $(top_srcdir)/doc/*.txt $(docdir)/
 #endif SILC_DIST_TOOLKIT
        -$(INSTALL_DATA) $(top_srcdir)/doc/FAQ $(docdir)/
-       -$(INSTALL_DATA) $(top_srcdir)/doc/*.txt $(docdir)/
        -$(INSTALL_DATA) $(top_srcdir)/COPYING $(docdir)/
        -$(INSTALL_DATA) $(top_srcdir)/CHANGES $(docdir)/
        -$(INSTALL_DATA) $(top_srcdir)/CREDITS $(docdir)/
@@ -114,13 +105,14 @@ EXTRA_DIST =                      \
 #ifdef SILC_DIST_SERVER
        examples silcd.8 silcd.conf.5   \
        example_silcd.conf      \
+       silcalgs.conf           \
 #endif SILC_DIST_SERVER
 #ifdef SILC_DIST_TOOLKIT
        toolkit                 \
        CodingStyle             \
+       draft-riikonen*.txt     \
+       silcalgs.conf           \
 #endif SILC_DIST_TOOLKIT
-       FAQ                     \
-       silcalgs.conf           \
-       draft-riikonen*.txt
+       FAQ
 
 include $(top_srcdir)/Makefile.defines.in
index 505a149c405af671f5eb7fcf6b79ab69bcae87f7..181e783bd1faf01ffd451bcc978de2977924395f 100644 (file)
@@ -4,16 +4,16 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2002 - 2006 Pekka Riikonen
+  Copyright (C) 2002 - 2007 Pekka Riikonen
 
-  The contents of this file are subject to one of the Licenses specified 
-  in the COPYING file;  You may not use this file except in compliance 
-  with the License.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; version 2 of the License.
 
-  The software distributed under the License is distributed on an "AS IS"
-  basis, in the hope that it will be useful, but WITHOUT WARRANTY OF ANY
-  KIND, either expressed or implied.  See the COPYING file for more
-  information.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
 */
 /* Native Symbian specific includes and definitions. */
index ebe86f793a7c1ea50d7b25d810111a5f93107664..45a65c9fe6e8cf757d9b72350e12364ec35cb511 100644 (file)
 extern "C" {
 #endif
 
+/* Version check macro.  Use this to check that package is of specific
+   version compile time.  Use the __SILC_XXX_VERSION below in comparison. */
+#define SILC_VERSION(a, b, c) (((a) << 24) + ((b) << 16) + ((c) << 8)
+@__SILC_PACKAGE_VERSION@
+
 #define SILC_VERSION_STRING "@VERSION@"
 #define SILC_DIST_VERSION_STRING "@VERSION@"
 #define SILC_PROTOCOL_VERSION_STRING "SILC-1.2-@VERSION@ @PACKAGE@"
index dc4ef610402ee9aa5222af2d1cc5a0e7d97582ea..7821a258b8c638fa4935d7eaa58697623ba0d12b 100644 (file)
@@ -83,12 +83,12 @@ SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcvcard"
 LIB_BASE_VERSION=1.1
 
 # libsilc versions
-LIBSILC_CURRENT=1              # prev = 0
+LIBSILC_CURRENT=2              # prev = 1
 LIBSILC_REVISION=0             # prev = 0
 LIBSILC_AGE=0                  # prev = 0
 
 # libsilcclient versions
-LIBSILCCLIENT_CURRENT=1                # prev = 0
+LIBSILCCLIENT_CURRENT=2                # prev = 1
 LIBSILCCLIENT_REVISION=0       # prev = 0
 LIBSILCCLIENT_AGE=0            # prev = 0
 
@@ -133,10 +133,10 @@ AC_CHECK_FUNC(epoll_wait,
     )
   ])
 
+MODULESDIR="$silc_prefix/lib/modules"
 #ifdef SILC_DIST_SIM
 # SIM modules directory
 #
-MODULESDIR="$silc_prefix/modules"
 AC_ARG_WITH(simdir,
   [[  --with-simdir=DIR       directory for SIM modules [PREFIX/modules]]],
   [
@@ -148,9 +148,9 @@ AC_ARG_WITH(simdir,
         ;;
     esac
   ])
-AC_SUBST(MODULESDIR)
 AC_DEFINE_UNQUOTED([SILC_MODULESDIR], "$MODULESDIR", [SILC_MODULESDIR])
 #endif SILC_DIST_SIM
+AC_SUBST(MODULESDIR)
 
 #ifdef SILC_DIST_TOOLKIT
 # Stack trace checking
index 22c358c1377b392b98c658279e549372d46c75e5..93565e0beeea61f07687c226ec04e1c57d4f15ab 100644 (file)
@@ -51,6 +51,6 @@ project and SILC Protocol.
 
 <br /><br />
 <li><a href="http://silcnet.org">SILC Project Website</a><br />
-<li><a href="http://silcnet.org/?page=docs">SILC Protocol Documentation</a><br />
-<li><a href="http://silcnet.org/?page=whitepaper">SILC White Paper</a><br />
-<li><a href="http://silcnet.org/?page=faq">SILC FAQ</a><br />
+<li><a href="http://silcnet.org/support/documentation/">SILC Protocol Documentation</a><br />
+<li><a href="http://silcnet.org/support/documentation/wp/">SILC White Paper</a><br />
+<li><a href="http://silcnet.org/support/faq/">SILC FAQ</a><br />
index 20fc1f478b7c73a0e013c9244530f9268b1af99e..723593c5c1e6123287f8b94bcc6a5acd098d2086 100644 (file)
@@ -30,10 +30,8 @@ The 'command_reply' client operation callback function prototype is as follows:
 <tt>
 &nbsp;&nbsp;
 void (*command_reply)(SilcClient client, SilcClientConnection conn,<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-SilcCommandPayload cmd_payload, bool success, SilcCommand command,<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-SilcStatus status, ...);
+                      SilcCommand command, SilcStatus status,<br />
+                      SilcStatus error, va_list ap);
 </tt>
 
 <br />&nbsp;<br />
index d7e8209435f269df6e95035f207174a7024aef9c..c9c904d5aafee1d04012a9420b29979c9f1cd282 100644 (file)
@@ -85,7 +85,7 @@ The 'message' argument may be NULL.
 Sent to the client if the user is invited on a channel. The 'channel
 argument may be NULL but the `channel_name' is always provided.
 </td>
-<td width="50%"><small>SilcClientChannel channel, char *channel_name,
+<td width="50%"><small>SilcChannelEntry channel, char *channel_name,
 SilcClientEntry inviter
 </td>
 </tr>
@@ -116,7 +116,7 @@ Sent when someone signoff the SILC network.  The 'signoff_message' may be
 NULL.  The `signoff_client' is the client signing off.  The `channel' is
 the channel where the client was joined.  The `channel' may be NULL.
 </td>
-<td width="50%"><small>SilcClientEntry signoff_client, char 
+<td width="50%"><small>SilcClientEntry signoff_client, char
 *signoff_message, SilcChannelEntry channel
 </td>
 </tr>
index 6621298a97218b160ed42009767fab230122cc8f..64a89f7981c8ef6a864abb7c70e6ddc070a17230 100644 (file)
@@ -7,6 +7,7 @@ to the new Toolkit version.
 
 <br />&nbsp;<br />
 <li><a href="#general">General</a><br />
+<li><a href="#platform">Platform changes</a>
 <li><a href="#client">Client library</a><br />
 <li><a href="#util">Utility library</a><br />
 <li><a href="#apputil">Application utility library</a>
@@ -15,7 +16,6 @@ to the new Toolkit version.
 <li><a href="#vcard">VCard library</a>
 <li><a href="#http">HTTP library</a>
 <li><a href="#asn1">ASN.1 library</a>
-<li><a href="#other">Other libraries</a>
 
 <br />&nbsp;<br />
 <h3><a name="general"></a>General changes</h3>
@@ -25,6 +25,15 @@ to silc.h.  The first task in porting from 1.0 to 1.1 is to change these
 filenames in your source tree.
 
 
+<br />&nbsp;<br />
+<h3><a name="platform"></a>Platform changes</h3>
+
+The Windows support has been made better by improving the SILC scheduler
+and network routines.  Calling silc_net_win32_init and silc_net_win32_uninit
+is not needed anymore.  The network routines on Windows are enabled
+automatically.
+
+
 <br />&nbsp;<br />
 <h3><a name="client"></a>Client library, lib/silcclient/</h3>
 
@@ -38,7 +47,7 @@ but with Toolkit 1.1 it should be relatively straightforward.
 
 <h4>SilcClientOperations structure</h4>
 
-The SilcClientOperation structure has changed significantly.  It no longer
+The SilcClientOperations structure has changed significantly.  It no longer
 has `connected', `disconnected' and `failure' function pointers.  Instead a
 new SilcClientConnectCallback has been defined that is given as argument to
 functions like silc_client_connect_to_server, silc_client_connect_to_client
@@ -51,7 +60,7 @@ added, see the API for the details.
 
 <br />&nbsp;<br />
 Also the `detach' client operation function pointer has been removed.  Instead
-the detachment data is now simply delivered in the SILC_COMMNAD_DETACH
+the detachment data is now simply delivered in the SILC_COMMAND_DETACH
 command reply.
 
 <br />&nbsp;<br />
@@ -150,8 +159,8 @@ initially use in the SILC network.
 The functions silc_client_connect_to_server, silc_client_connect_to_client
 and silc_client_key_exchange can all be used to create new SILC session with
 a remote.  To connect SILC server use silc_client_connect_to_server.  You
-now give the SilcClientCnnectionParams as argument which includes the nickname
-user wants to use, you now can give the public key pair as argument that is
+now give the SilcClientConnectionParams as argument which includes the 
+nicknameuser wants to use, you now can give the public key pair as argument that is
 to be used in the connecting.  The new SilcClientConnectCallback will be
 called once the connection has been established and it delivers the
 SilcClientConection context to the application.  It will be later called
@@ -161,7 +170,7 @@ connecting, if necessary.  In the past canceling connection was not possible.
 
 <br />&nbsp;<br />
 <pre>
-SilcAsyncOperations op;
+SilcAsyncOperation op;
 SilcClientConnectionParams params;
 
 memset(&params, 0, sizeof(params));
@@ -206,8 +215,9 @@ silc_client_del_socket has been removed.  They are no longer needed.
 Just like in Toolkit 1.0 we now have SilcClientEntry to represent user,
 SilcChannelEntry to represent channel and SilcServerEntry to represent
 server.  In the past these structures and all API functions that dealt
-with them were in silcclient.h file.  They are now in silcclient_entry.h
-in Toolkit 1.1.
+with them were in <a href="silcclient.html">silcclient.h</a> file.  They
+are now in <a href="silcclient_entry.html">silcclient_entry.h</a> in
+Toolkit 1.1.
 
 <br />&nbsp;<br />
 As an general convention each of these new entries now are reference
@@ -421,25 +431,28 @@ nickname of a certain client entry.
 The Utility library (runtime library) has had several changes and has several
 new interfaces.  Some interfaces has also been removed or moved to some
 other library.  Removed interfaces rae: silcprotocol.h and silcsockconn.h.
-Moved interfaces are: silcapputil.h and silcvcard.h.
+Moved interfaces are: <a href="silcapputil.html">silcapputil.h</a> and
+<a href="silcvcard.html">silcvcard.h</a>.
 
 <h4>SILC Async Operation Interface</h4>
 
-A new asynchronous operation API (silcasync.h) has been added.  It can be
-used to control asynchronous operations, like to cancel them.  Many
-asynchronous routines in SILC Toolkit now return SilcAsyncOperation context
-so that the operation can be controlled by the caller.  It especiallly
-provides a generic way to cancel asynchronous operations which
-can be difficult.
+A new asynchronous operation API (<a href="silcasync.html">silcasync.h</a>)
+has been added.  It can be used to control asynchronous operations, like
+to cancel them.  Many asynchronous routines in SILC Toolkit now return
+SilcAsyncOperation context so that the operation can be controlled by the
+caller.  It especiallly provides a generic way to cancel asynchronous
+operations which can be difficult.
 
 <h4>SILC Atomic Operations Interface</h4>
 
-A new atomic operations API (silcatomic.h) has been added.  It provides
-routines to perform various operations on integeres and pointers atomically.
+A new atomic operations API (<a href="silcatomic.html">silcatomic.h</a>)
+has been added.  It provides routines to perform various operations on
+integeres and pointers atomically.
 
 <h4>SILC Data Stack Interface</h4>
 
-A new data stack (memory pool system) API (silcstack.h) has been added.
+A new data stack (memory pool system) API
+(<a href="silcstack.html">silcstack.h</a>) has been added.
 It provides a fast memory allocation system.  Many routines in the SILC Toolkit
 are SilcStack aware thus enabling them to use the SilcStack as their source
 for memory allocation.  All routines that are SilcStack aware automatically
@@ -449,12 +462,14 @@ by default.
 
 <h4>SILC Condition Variable Interface</h4>
 
-A new condition variable API (silccond.h) has been added.  It provides
-condition variables for multithreaded applications.
+A new condition variable API (<a href="silccond.html">silccond.h</a>)
+has been added.  It provides condition variables for multithreaded
+applications.
 
 <h4>SILC Stream Interface</h4>
 
-A new abstract stream API (silcstream.h) has been added.  The SilcStream
+A new abstract stream API (<a href="silcstream.html">silcstream.h</a>)
+has been added.  The SilcStream
 provides an abstract way of representing different kinds of streams.  The
 API provides functions that can be used to read, write, control and destroy
 streams.  The API is not used to create streams but separate interfaces
@@ -463,19 +478,22 @@ socket stream and file descriptor stream exist.
 
 <h4>SILC FD Stream Interface</h4>
 
-A new file descriptor stream API (silcfdstream.h) has been added.  It
+A new file descriptor stream API
+(<a href="silcfdstream.html">silcfdstream.h</a>) has been added.  It
 provides a blocking and non-blocking file descriptor stream through the
 SilcStream abstraction.
 
 <h4>SILC Socket Stream Interface</h4>
 
-A new socket stream API (silcsocketstream.h) has been added.  It provides
-a blocking and non-blocking socket stream through the SilcStream
+A new socket stream API
+(<a href="silcsocketstream.html">silcsocketstream.h</a>) has been added.
+It provides a blocking and non-blocking socket stream through the SilcStream
 abstraction.
 
 <h4>SILC FSM Interface</h4>
 
-A new Finite State Machine API (silcfsm.h) has been added.  It provides
+A new Finite State Machine API
+(<a href="silcfsm.html">silcfsm.h</a>) has been added.  It provides
 an FSM that can be used to implement all kinds of machines and protocols.
 The machine also supports threads, and threads that are actually executed
 in real system threads.  The SILC FSM API also supports asynchronous
@@ -483,25 +501,28 @@ events.
 
 <h4>SILC Time Interface</h4>
 
-A new SILC Time API (silctime.h) has been added.  It provides utility
+A new SILC Time API
+(<a href="silctime.html">silctime.h</a>) has been added.  It provides utility
 functions to retrieve and represent time in different ways.  It supports
 Universal and Generalized time string creation and parsing and adds a new
 SilcTime structure to represent time.
 
 <h4>SILC Snprintf Interface</h4>
 
-A new snprintf API (silcsnprintf.h) has been added.  It provides snprintf
-and other string formatting routines.
+A new snprintf API
+(<a href="silcsnprintf.html">silcsnprintf.h</a>) has been added.  It
+provides snprintf and other string formatting routines.
 
 <h4>SILC Mutex Interface changes</h4>
 
-The SILC Mutex API (silcmutex) has several changes.  A support for read/write
-locks has been added (SilcRwLock).  Also silc_mutex_assert_locked function
-is added.
+The SILC Mutex API (<a href="silcmutex.html">silcmutex.h</a>)
+has several changes.  A support for read/write locks has been added
+(SilcRwLock).  Also silc_mutex_assert_locked function is added.
 
 <h4>SILC Network Interface changes</h4>
 
-The SILC Network API (silcnet.h) has several changes.  The API is almost
+The SILC Network API
+(<a href="silcnet.html">silcnet.h</a>) has several changes.  The API is almost
 entirely rewritten and most of the old functions have been removed.  The
 API has now both TCP and UDP support, and as previously supports IPv4
 and IPv6.  New functions are silc_net_tcp_create_listener,
@@ -510,8 +531,9 @@ silc_net_udp_connect, silc_net_udp_receive, silc_net_udp_send.
 
 <h4>SILC Scheduler Interface changes</h4>
 
-The SILC Schedule API (silcschedule.h) has several changes.  The scheduler
-has been entirely rewritten but most of the API remains the same.
+The SILC Schedule API
+(<a href="silcschedule.html">silcschedule.h</a>) has several changes.  The
+scheduler has been entirely rewritten but most of the API remains the same.
 The SILC_TASK_GENERIC and SILC_TASK_CALLBACK_GLOCAL have been removed.
 The way signal are dispatched has been changed.  The SILC Schedule is now
 able to itself dispatch all signals.  New functions are
@@ -523,12 +545,14 @@ removed.
 
 <h4>SILC Types Interface changes</h4>
 
-The SILC Type API (silctypes.h) has several changes.  The bool type is
-replaced with SilcBool.  Sockets are now represented by SilcSocket.
+The SILC Type API (<a href="silctypes.html">silctypes.h</a>) has several
+changes.  The bool type is replaced with SilcBool.  Sockets are now
+represented by SilcSocket.
 
 <h4>SILC String util Interface changes</h4>
 
-The SILC string utility API (silcstrutil.h) has changes.  The PEM encoding
+The SILC string utility API
+(<a href="silcstrutil.html">silcstrutil.h</a>) has changes.  The PEM encoding
 and decoding routines has been renamed, silc_base64_encode,
 silc_base64_encode_file and silc_base64_decode.  The silc_mime_parse has
 been removed.  A new silc_string_split function has been added.
@@ -538,18 +562,19 @@ been removed.  A new silc_string_split function has been added.
 
 <h4>SILC File Util Interface changes</h4>
 
-The SILC file utility API (silcfileutil.h) has changes.  A new function
-silc_file_set_nonblock has been added.
+The SILC file utility API (<a href="silcfileutil.html">silcfileutil.h</a>)
+has changes.  A new function silc_file_set_nonblock has been added.
 
 <h4>SILC List and Dynamic List Interface changes</h4>
 
-The SILC List (silclist.h) and SILC Dynamic List (silcdlist.h) APIs have
-changes. New functions silc_list_insert and silc_dlist_insert have been
-added.
+The SILC List (<a href="silclist.html">silclist.h</a>) and SILC Dynamic List
+(silcdlist.h) APIs have changes. New functions silc_list_insert and
+silc_dlist_insert have been added.
 
 <h4>SILC Buffer Interface changes</h4>
 
-The SILC Buffer API (silcbuffer.h) has several changes.  The SilcBuffer
+The SILC Buffer API (<a href="silcbuffer.html">silcbuffer.h</a>) has several
+changes.  The SilcBuffer
 structure no longer contain the buffer length and true length fields
 but silc_buffer_len() and silc_buffr_truelen() macros are available
 instead.  Also silc_buffer_data(), silc_buffer_datalen(), silc_buffer_purge(),
@@ -558,7 +583,8 @@ silc_buffer_enlarge() has been added.  The API also supports SilcStack.
 
 <h4>SILC Buffer Formatting Interface changes</h4>
 
-The SILC Buffer Formatting API (silcbuffmt.h) has several changes.  The
+The SILC Buffer Formatting API
+(<a href="silcbuffmt.html">silcbuffmt.h</a>) has several changes.  The
 silc_buffer_format now automatically allocates memory to the destination
 buffer if it does not have space.  Also new the following new formatters
 have been added: SILC_STR_DATA (replaces SILC_STR_UI_XNSTRING),
@@ -567,10 +593,10 @@ The API also supports SilcStack.
 
 <h4>SILC Memory Interface changes</h4>
 
-The memory allocation API (silcmemory.h) has several changes.  It supports
-now SilcStack as memory source.  Also all memory allocation routines can
-now fail and return NULL as opposed to fatally failing when memory allocation
-fails.
+The memory allocation API (<a href="silcmemory.html">silcmemory.h</a>) has
+several changes.  It supports now SilcStack as memory source.  Also all
+memory allocation routines can now fail and return NULL as opposed to fatally
+failing when memory allocation fails.
 
 <br />&nbsp;<br />
 <h3><a name="apputil"></a>SILC Application Utility library, lib/silcapputil/</h3>
@@ -583,7 +609,8 @@ does not contain any entirely new interfaces.
 
 <h4>SILC Application Utility Interface</h4>
 
-The silcapputil.h contains various application utility functions.  It
+The <a href="silcapputil.html">silcapputil.h</a> contains various application
+utility functions.  It
 existed in Toolkit 1.0 but some of the APIs has been changed.  The
 silc_create_key_pair, silc_load_key_pair and silc_show_public_key APIs
 has changed.  A new silc_show_public_key_file has been added.  Functions
@@ -596,15 +623,15 @@ libraries into this interface in Toolkit 1.1.
 
 <h4>SILC ID Cache Interface</h4>
 
-The ID Cache interface (silcidcache.h) has been moved from lib/silccore
-into lib/silcapputil/.
+The ID Cache interface (<a href="silcidcache.html">silcidcache.h</a>) has
+been moved from lib/silccore into lib/silcapputil/.
 
 <br />&nbsp;<br />
 <h3><a name="skr"></a>SILC Key Repository library, lib/silcskr/</h3>
 
 A new SILC Key Repository library has been added.  The library provides
-a SILC Key Repository API (silcskr.h) which provides a repository for
-storing and retrieving public keys.
+a SILC Key Repository API (<a href="silcskr.html">silcskr.h</a>) which provides
+a repository for storing and retrieving public keys.
 
 <br />&nbsp;<br />
 <h3><a name="vcard"></a>SILC VCard library, lib/silcvcard/</h3>
@@ -620,14 +647,15 @@ Server Interface and SILC HTTP PHP Translator Interface.
 
 <h4>SILC HTTP Server Interface</h4>
 
-The SILC HTTP Server API (silchttpservder.h) provides a simple HTTP
-server implementation for applications that want to integrate a small
-HTTP server.
+The SILC HTTP Server API (<a href="silchttpserver.html">silchttpservder.h</a>)
+provides a simple HTTP server implementation for applications that want to
+integrate a small HTTP server.
 
 <h4>SILC HTTP PHP Translator Interface</h4>
 
-The SILC HTTP PHP Translator API (silchttpphp.h) provides PHP translates
-PHP code into HTML.  It can be used to serve PHP pages in HTTP server.
+The SILC HTTP PHP Translator API (<a href="silchttpphp.html">silchttpphp.h</a>)
+ provides PHP translates PHP code into HTML.  It can be used to serve PHP
+pages in HTTP server.
 
 <br />&nbsp;<br />
 <h3><a name="asn1"></a>SILC ASN.1 library, lib/silcasn1/</h3>
@@ -638,12 +666,13 @@ encoder and decoder interface.
 
 <h4>SILC ASN.1 Interface</h4>
 
-The SILC ASN.1 API (silcasn1.h) provides ASN.1 encoder and decoder.  The
-interface provides efficient encoder and decoder and is support SilcStack
-as memory source.  The interface is simple and it supports almost all ASN.1
-features.
+The SILC ASN.1 API (<a href="silcasn1.html">silcasn1.h</a>) provides ASN.1
+encoder and decoder.  The interface provides efficient encoder and decoder
+and is support SilcStack as memory source.  The interface is simple and it
+supports almost all ASN.1 features.
 
 <h4>SILC BER Interface</h4>
 
-The SILC BER API (silcber.h) provides BER/DER encoder and decoder.  It is
-integral part of the ASN.1 library and the ASN.1 encoder and decoder.
+The SILC BER API (<a href="silcber.html">silcber.h</a>) provides BER/DER
+encoder and decoder.  It is integral part of the ASN.1 library and the ASN.1
+encoder and decoder.
index c703cb38e0e8d87dfe402beb208534e129f76f27..b8830e82f51975f703d426c152520f368ea4ce9a 100644 (file)
@@ -20,10 +20,10 @@ interface routines in the functions and display the data whatever way
 it wants.  The library is entirely transparent to the user interface and
 it does not include any user interface specific issues such as window
 handling or item handling on the screen etc.  These does not interest
-the library.  The `silcclient.h' also defines the client libary interface
-the application can call.  The interface includes for example functions
-for sending channel and private messages, client and channel retrieval
-and other utility functions.
+the library.  The `silcclient.h' and `silcclient_entry.h' also defines the
+client libary interface the application can call.  The interface includes
+for example functions for sending channel and private messages, client and
+channel retrieval and other utility functions.
 
 <br />&nbsp;<br />&nbsp;<br />
 <b>Including Library Headers</b>
@@ -38,28 +38,6 @@ get access all SILC Client Library routines:
 #include "silcclient.h"
 </tt>
 
-<br />&nbsp;<br />&nbsp;<br />
-<b>Network Initialization on Win32</b>
-
-<br />&nbsp;<br />
-If you are programming your SILC client application on Windows system,
-you will need to initialize the network routines in order to be able
-to use the client library.  The network initialization is done by
-calling the silc_net_win32_init at the start of your Windows application.
-Usually this is done either in main() or WinMain() function, or other
-similar place.  This function should be called before calling any other
-SILC routine.
-
-<br />&nbsp;<br />
-<tt>
-if (silc_net_win32_init() == FALSE)<br />
-&nbsp;&nbsp;exit_with_error();
-</tt>
-
-<br />&nbsp;<br />
-This function is available only on Win32 platforms, and on other platforms
-the network routines are initialized automatically by the operating system.
-
 
 <br />&nbsp;<br />&nbsp;<br />
 <b>Creating Client</b>
@@ -76,19 +54,14 @@ The client object is SilcClient which is usually allocated in following
 manner:
 
 <br />&nbsp;<br />
-<tt>&nbsp;&nbsp;SilcClient client = silc_client_alloc(&ops, params, context, silc_version_string);</tt>
+<tt>&nbsp;&nbsp;SilcClient client = silc_client_alloc(&ops, params, context, NULL);</tt>
 
 <br />&nbsp;<br />
 `ops' is the static structure of client operations that library will call.
 `context' can be some application specific context that will be saved into
 the SilcClient object.  It is up to the caller to free this context.
 SilcClient is always passed to the application thus the application
-specific context can be retrieved from the SilcClient object.  See
-`client.h' file for detailed definition of SilcClient object.
-
-<br />&nbsp;<br />
-The `silc_version_string' is the current protocol version string, and you
-can get it by including `silcversion.h' header in your source code.
+specific context can be retrieved from the SilcClient object.
 
 <br />&nbsp;<br />
 `ops' can be defined for example as follows:
@@ -102,13 +75,11 @@ SilcClientOperations ops = {<br />
 &nbsp;&nbsp;  silc_notify,<br />
 &nbsp;&nbsp;  silc_command,<br />
 &nbsp;&nbsp;  silc_command_reply,<br />
-&nbsp;&nbsp;  silc_connect,<br />
-&nbsp;&nbsp;  silc_disconnect,<br />
 &nbsp;&nbsp;  silc_get_auth_method,<br />
 &nbsp;&nbsp;  silc_verify_public_key,<br />
 &nbsp;&nbsp;  silc_ask_passphrase,<br />
-&nbsp;&nbsp;  silc_failure,<br />
 &nbsp;&nbsp;  silc_key_agreement,<br />
+&nbsp;&nbsp;  silc_file_transfer,<br />
 };<br />
 </tt>
 
@@ -123,38 +94,19 @@ it and use it directly in their application.
 <b>Initializing the Client</b>
 
 <br />&nbsp;<br />
-The client must be initialized before running.  However, there are also
-some other tasks that must be done before initializing the client.
-The following pointers must be set by the application  before calling
-the initializing function:
+The client must be initialized before running.  The client is initialized
+simply by calling silc_client_init function:
 
 <br />&nbsp;<br />
-<tt>
-&nbsp;&nbsp;client->username<br />
-&nbsp;&nbsp;client->hostname<br />
-&nbsp;&nbsp;client->realname<br />
-&nbsp;&nbsp;client->pkcs<br />
-&nbsp;&nbsp;client->public_key<br />
-&nbsp;&nbsp;client->private_key
-</tt>
-
-<br />&nbsp;<br />
-You may also set client->nickname if you want.  If it is set then the
-library will change the nickname to that one after the client is connected
-to the server.  If not set, then server will initially give the nickname
-which is same as the username.
-
-<br />&nbsp;<br />
-After setting the pointers one must call:
+<tt>&nbsp;&nbsp;silc_client_init(client, username, hostname, realname,
+                                 foo_client_running, foo_ctx);</tt>
 
 <br />&nbsp;<br />
-<tt>&nbsp;&nbsp;silc_client_init(client);</tt>
-
-<br />&nbsp;<br />
-which then initializes the client library for the `client'.  If the
-pointers mentioned above are not initialized the silc_client_init will
-fail.  The application should check the return value of the silc_client_init
-function.
+which then initializes the client library for the `client'.  The `username'
+and `hostname' pointers are required.  The `foo_client_running' with
+`foo_ctx' in this example will be called by the client library after the
+client is up and running.  After you receive this callback you may start
+using other API functions, such as creating connection to remote server.
 
 
 <br />&nbsp;<br />&nbsp;<br />
@@ -195,15 +147,12 @@ second as possible to provide smooth action for the client library.  You
 can use an timeout task, or an idle task provided by your GUI library to
 accomplish this.  After you have initialized the client library with
 silc_client_init, you should register the timeout task or idle task that
-will call the silc_client_run_one periodically.  In the Toolkit package
-there is GTK-- GUI example in silcer/ directory.  That example calls the
-silc_client_run_one every 50 milliseconds, and it should be sufficient for
-smooth working.
+will call the silc_client_run_one periodically.
 
 <br />&nbsp;<br />
 For Win32 the silc_client_run can be used instead of using the Windows's
 own event loop.  However, if you would like to use the silc_client_run_one
-also on Win32 systems it is possible.
+also on Win32 system it is possible.
 
 
 <br />&nbsp;<br />&nbsp;<br />
@@ -247,60 +196,22 @@ Client library work on the background of the GUI application.
 <b>Creating Connection to Server</b>
 
 <br />&nbsp;<br />
-Connection to remote SILC server is done by calling:
+After your client is up and running you may create connection to remote
+SILC server.  It is done simply by calling:
 
 <br />&nbsp;<br />
-<tt>&nbsp;&nbsp;silc_client_connect_to_server(client, port, hostname, context);</tt>
+<tt>&nbsp;&nbsp;silc_client_connect_to_server(client, &params,
+                                              public_key, private_key,
+                                             remote_host, remote_port,
+                                             foo_connected_cb, foo_ctx);</tt>
 
 <br />&nbsp;<br />
 The function will create the connection asynchronously to the server, ie.
-the function will return before the actual connection is created.  After
-the connection is created the client->ops->connect operation is called.
-
-<br />&nbsp;<br />
-Generally speaking the connections are associated with windows' on the
-screen.  IRC is usually implemented this way, however it is not the
-necessary way to associate the client's connections.  SilcClientConnection
-object is provided by the library (and is always passed to the application)
-that can be used in the application to associate the connection from the
-library.  Application specific context can be saved to the
-SilcClientConnection object which then can be retrieved in the application,
-thus perhaps associate the connection with what ever object in
-application (window or something else).
-
-
-<br />&nbsp;<br />&nbsp;<br />
-<b>Using Own Connecting</b>
-
-<br />&nbsp;<br />
-Application might not want to use silc_client_connect_to_server function
-if it wants to perform its own connecting for some reason.  In this case
-application must call function silc_client_start_key_exchange after it
-has created the connection by itself.  This function starts the key
-exhange protocol between the client and server and the library takes care
-of everything after that.
-
-<br />&nbsp;<br />
-After connection has been created application must call:
-
-<br />&nbsp;<br />
-<tt>
-&nbsp;&nbsp;SilcClientConnection conn;
-
-<br />&nbsp;<br />
-&nbsp;&nbsp;/* Add new connection to client */<br />
-&nbsp;&nbsp;conn = silc_client_add_connection(client, hostname, port, context);
-
-<br />&nbsp;<br />
-&nbsp;&nbsp;/* Start key exchange and let the library handle everything<br />
-&nbsp;&nbsp;   after this point on. */<br />
-&nbsp;&nbsp;silc_client_start_key_exchange(client, conn, sock);
-</tt>
-
-<br />&nbsp;<br />
-NOTE: These calls are performed only and only if application did not call
-silc_client_connect_to_server function, but performed the connecting
-process manually.
+the function will return before the actual connection is created.  The
+`foo_connected_cb' will be called once the connection has been established.
+The `params' may be NULL but it may be used to provide additional parameters
+to the connecting.  For example it is possible to set the initial nickname
+you would like to use into the `params'.
 
 
 <br />&nbsp;<br />&nbsp;<br />
@@ -315,7 +226,7 @@ debugging is enabled.
 
 <br />&nbsp;<br />
 Then, to say in your application you would like to use the debugging use
-the SILC_ENABLE_DEBUG macro.  Put this macro to your main header file, or
+the SILC_DEBUG macro.  Put this macro to your main header file, or
 some other file that needs the debugging enabled.  After using this macro
 you are able to use the debugging routines provided by the SILC Toolkit.
 Note that, the Toolkit library must be compiled with --enable-debug for
@@ -345,7 +256,7 @@ examples could be:
 
 <br />&nbsp;<br />
 <tt>
-&nbsp;&nbsp;silc_log_set_debug_string("silc_client*,*socket*,*ske*");<br />
+&nbsp;&nbsp;silc_log_set_debug_string("silc_client*,*sock*,*ske*");<br />
 </tt>
 
 <br />&nbsp;<br />
@@ -389,79 +300,3 @@ out otherwise, for example binary data.
 Note that the variable arguments in SILC_LOG_HEXDUMP are before the second
 last parenthesis, and the last two arguments are the data, and its length that
 are hexdumped.
-
-
-<br />&nbsp;<br />&nbsp;<br />
-<b>Example Client</b>
-
-<br />&nbsp;<br />
-This section includes an example SILC client implementation in pseudo-like
-C code.  It creates and initializes the client and sets up an imaginary
-user interface.  The user will use the user interface then to create
-the connections.  The SilcClientOperations are expected to be implemented.
-
-<br />&nbsp;<br />
-<pre>
-#include "silc.h"
-#include "silcclient.h"
-
-int main()
-{
-       SilcClientOperations ops = {
-         silc_say,
-         silc_channel_message,
-         silc_private_message,
-         silc_notify,
-         silc_command,
-         silc_command_reply,
-         silc_connect,
-         silc_disconnect,
-         silc_get_auth_method,
-         silc_verify_public_key,
-         silc_ask_passphrase,
-         silc_failure,
-         silc_key_agreement,
-         silc_ftp,
-         silc_detach
-       };
-
-       SilcClient client;
-
-       /* Allocate SILC client. The `silc_version_string' is defined
-          in includes/version.h file. */
-       client = silc_client_alloc(&ops, NULL, NULL, silc_version_string);
-
-       /* Set the mandatory pointers, read public and private key from
-          files (or somewhere) and return pointers and PKCS context. */
-       client->username = silc_get_username();
-       client->hostname = silc_net_localhost();
-       client->realname = silc_get_real_name();
-       client->pkcs = get_public_and_private_key(&client->public_key,
-                                                 &client->private_key);
-
-       /* If the keys does not exist, create a key pair since we must
-          provide key pair to the library. */
-       if (!client->pkcs)
-         generate_key_new_key_pair(client);
-
-       /* Iinitialize client */
-       if (!silc_client_init(client))
-         fatal_error("Could not initialize client");
-
-       /* Initialize user interface. The user interface can be generally
-          initialized at any phase, including before actually allocating
-          and initializing the client, if wished. */
-       InitUserInterface();
-       DoCoolThings();
-
-       /* Start the client. This will start the scheduler. At this phase
-          the user might have the user interface in front of him already.
-          He will use the user interface to create the connection to the
-          server for example. When this function returns the program is
-         ended. */
-       silc_client_run(client);
-
-       /* Client is ended */
-       return 0;
-}
-</pre>
index 67df01eb161720ed6f9075659c8d4f8c43b1acd1..833f40e29b4d230eeb1d1b24120b43d2fb746b13 100644 (file)
@@ -146,6 +146,12 @@ New pair of keys will be created.  Please, answer to following questions.\n\
     silc_free(def);
   }
 
+  if (!strstr(identifier, "UN=") || !strstr(identifier, "HN=")) {
+    fprintf(stderr, "Invalid public key identifier.  You must specify both "
+           "UN and HN\n");
+    return FALSE;
+  }
+
   rng = silc_rng_alloc();
   silc_rng_init(rng);
   silc_rng_global_init(rng);
@@ -202,12 +208,14 @@ New pair of keys will be created.  Please, answer to following questions.\n\
     return FALSE;
 
   /* Save public key into file */
-  silc_pkcs_save_public_key(pkfile, public_key, SILC_PKCS_FILE_BASE64);
+  if (!silc_pkcs_save_public_key(pkfile, public_key, SILC_PKCS_FILE_BASE64))
+    return FALSE;
 
   /* Save private key into file */
-  silc_pkcs_save_private_key(prvfile, private_key,
-                            (const unsigned char *)pass, strlen(pass),
-                            SILC_PKCS_FILE_BIN, rng);
+  if (!silc_pkcs_save_private_key(prvfile, private_key,
+                                 (const unsigned char *)pass, strlen(pass),
+                                 SILC_PKCS_FILE_BIN, rng))
+    return FALSE;
 
   if (return_public_key)
     *return_public_key = public_key;
@@ -265,6 +273,8 @@ SilcBool silc_load_key_pair(const char *pub_filename,
   if (!silc_pkcs_load_private_key(prv_filename,
                                  (const unsigned char *)pass, strlen(pass),
                                  return_private_key)) {
+    silc_pkcs_public_key_free(*return_public_key);
+    *return_public_key = NULL;
     memset(pass, 0, strlen(pass));
     silc_free(pass);
     return FALSE;
index 00237fb829564a71f212e5aa3c318a4af595375c..a6d8c26edeb7e4a49ad77917f76deb19c8f1e185 100644 (file)
@@ -296,6 +296,70 @@ SilcBool silc_idcache_update_by_context(SilcIDCache cache, void *context,
   return silc_idcache_update(cache, c, new_id, new_name, free_old_name);
 }
 
+/* Move entry to another cache */
+
+SilcBool silc_idcache_move(SilcIDCache from_cache, SilcIDCache to_cache,
+                          SilcIDCacheEntry entry)
+{
+  SilcIDCacheEntry c;
+
+  SILC_LOG_DEBUG(("Moving entry %p from %p cache to %p cache", entry,
+                 from_cache, to_cache));
+
+  if (!from_cache || !to_cache || !entry)
+    return FALSE;
+
+  if (from_cache->id_type != to_cache->id_type) {
+    SILC_LOG_ERROR(("Incompatible ID caches, cannot move entry"));
+    return FALSE;
+  }
+
+  if (entry->context) {
+    if (!silc_hash_table_find(from_cache->context_table, entry->context,
+                             NULL, (void *)&c))
+      return FALSE;
+  } else if (entry->name) {
+    if (!silc_hash_table_find(from_cache->name_table, entry->name,
+                             NULL, (void *)&c))
+      return FALSE;
+  } else if (entry->id) {
+    if (!silc_hash_table_find(from_cache->id_table, entry->id,
+                             NULL, (void *)&c))
+      return FALSE;
+  } else {
+    return FALSE;
+  }
+
+  if (entry != c)
+    return FALSE;
+
+  /* See if this entry is added already to cache */
+  if (c->id && silc_idcache_find_by_id_one(to_cache, c->id, NULL)) {
+    SILC_LOG_ERROR(("Attempted to add same ID twice to ID Cache, id %s",
+                   silc_id_render(c->id, to_cache->id_type)));
+    SILC_ASSERT(FALSE);
+    return FALSE;
+  }
+
+  /* Remove from original cache */
+  if (c->name)
+    silc_hash_table_del_by_context(from_cache->name_table, c->name, c);
+  if (c->context)
+    silc_hash_table_del_by_context(from_cache->context_table, c->context, c);
+  if (c->id)
+    silc_hash_table_del_by_context(from_cache->id_table, c->id, c);
+
+  /* Move to the other cache */
+  if (c->id)
+    silc_hash_table_add(to_cache->id_table, c->id, c);
+  if (c->name)
+    silc_hash_table_add(to_cache->name_table, c->name, c);
+  if (c->context)
+    silc_hash_table_add(to_cache->context_table, c->context, c);
+
+  return TRUE;
+}
+
 /* Returns all cache entrys from the ID cache to the `ret' ID Cache List. */
 
 SilcBool silc_idcache_get_all(SilcIDCache cache, SilcList *ret_list)
index 8d4278abb28fb9b07279b2f51a390b21a4401ff8..7d8e1427abfa2219e9b041185b6f475f6f6d3cba 100644 (file)
@@ -240,6 +240,24 @@ SilcBool silc_idcache_update_by_context(SilcIDCache cache, void *context,
                                        void *new_id, char *new_name,
                                        SilcBool free_old_name);
 
+/****f* silcapputil/SilcIDCacheAPI/silc_idcache_move
+ *
+ * SYNOPSIS
+ *
+ *    SilcBool silc_idcache_move(SilcIDCache from_cache, SilcIDCache to_cache,
+ *                               SilcIDCacheEntry entry);
+ *
+ * DESCRIPTION
+ *
+ *    Moves the ID cache entry indicated by `entry' from the `from_cache'
+ *    to `to_cache'.  After this returns TRUE the `entry' is available only
+ *    from the `to_cache'.  Return FALSE if `entry' is not in `from_cache'
+ *    or system is out of memory.
+ *
+ ***/
+SilcBool silc_idcache_move(SilcIDCache from_cache, SilcIDCache to_cache,
+                          SilcIDCacheEntry entry);
+
 /****f* silcapputil/SilcIDCacheAPI/silc_idcache_get_all
  *
  * SYNOPSIS
index 21c39f8cbf06335a4db2695b20c4bc560df7b25d..3030d07cd4af28b3a2093f05ae2b1e58100e24f0 100644 (file)
@@ -230,7 +230,7 @@ static SilcBool silc_asn1_decoder_sof(SilcAsn1 asn1, SilcBuffer src)
     ret = FALSE;                                               \
     goto fail;                                                 \
   }                                                            \
-  *s = silc_smalloc_ua(stack1, *s_len + 1);                    \
+  *s = silc_smalloc(stack1, *s_len + 1);                       \
   if (*s) {                                                    \
     silc_utf8_encode(rdata, rdata_len, (enc), *s, *s_len);     \
     (*s)[*s_len] = '\0';                                       \
index 63b455cc2b82010368d03abdbeb057879b5dd143..11b963ecb6fca8139a54caa5621376aef740f64d 100644 (file)
@@ -38,7 +38,7 @@
     goto fail;                                                         \
   }                                                                    \
   silc_stack_push(asn1->stack2, &frame);                               \
-  s = silc_smalloc_ua(stack2, s_len + 1);                              \
+  s = silc_smalloc(stack2, s_len + 1);                                 \
   if (s) {                                                             \
     silc_utf8_decode(d, d_len, (enc), s, s_len);                       \
     s[s_len] = '\0';                                                   \
index ab13fd6d9fea4963b88eeeaeebb528f46c18fa38..d7942f5f0525d9a336f2933081ab7ba7e36bf560 100644 (file)
@@ -1099,6 +1099,12 @@ void silc_client_stop(SilcClient client, SilcClientStopped stopped,
 {
   SILC_LOG_DEBUG(("Stopping client"));
 
+  if (!silc_fsm_is_started(&client->internal->fsm)) {
+    SILC_LOG_WARNING(("Attempting to stop client library before it has been "
+                     "started (silc_client_init not called)"));
+    return;
+  }
+
   client->internal->running = (SilcClientRunning)stopped;
   client->internal->running_context = context;
 
index 9542363fae0588c2a5930250110d04e016b77982..de87143f047ff3f9dc6be0eb51df4c66b2743fd9 100644 (file)
@@ -789,9 +789,8 @@ SILC_FSM_STATE(silc_client_st_rekey)
 
   /* Allocate SKE */
   conn->internal->ske =
-    silc_ske_alloc(client->rng, conn->internal->schedule,
-                  conn->internal->params.repository,
-                  conn->public_key, conn->private_key, fsm);
+    silc_ske_alloc(client->rng, conn->internal->schedule, NULL,
+                  conn->public_key, NULL, fsm);
   if (!conn->internal->ske)
     return SILC_FSM_FINISH;
 
index c59a48fd3e4992008c26ed4a53cea0323688f2b5..0c812de00adbd6bec3672098d5b4565e334c52f3 100644 (file)
@@ -72,19 +72,23 @@ SilcDList silc_client_get_clients_local_ext(SilcClient client,
   SilcList list;
   SilcDList clients;
   SilcClientEntry entry;
-  char *nicknamec, *parsed = NULL, *format = NULL;
+  char nick[128 + 1], *nicknamec, *parsed = NULL, *format = NULL;
+  char server[256 + 1];
 
   if (!client || !conn || !nickname)
     return NULL;
 
+  /* Get nickname from nickname@server string */
+  silc_parse_userfqdn(nickname, nick, sizeof(nick), server, sizeof(server));
+
   /* Parse nickname in case it is formatted */
-  if (!silc_client_nickname_parse(client, conn, (char *)nickname, &parsed))
+  if (!silc_client_nickname_parse(client, conn, (char *)nick, &parsed))
     return NULL;
 
   if (!get_all && parsed)
-    format = (char *)nickname;
+    format = (char *)nick;
   if (!parsed) {
-    parsed = silc_memdup(nickname, strlen(nickname));
+    parsed = silc_memdup(nick, strlen(nick));
     if (!parsed)
       return NULL;
   }
@@ -133,6 +137,14 @@ SilcDList silc_client_get_clients_local_ext(SilcClient client,
     /* Check multiple cache entries for exact match */
     while ((id_cache = silc_list_get(list))) {
       entry = id_cache->context;
+
+      /* If server was provided, find entries that either have no server
+        set or have the same server.  Ignore those that have different
+        server. */
+      if (server[0] && entry->server &&
+         !silc_utf8_strcasecmp(entry->server, server))
+       continue;
+
       if (silc_utf8_strcasecmp(entry->nickname,
                               format ? format : parsed) &&
          (!get_valid || entry->internal.valid)) {
@@ -340,7 +352,7 @@ static SilcUInt16 silc_client_get_clients_i(SilcClient client,
 
   /* Parse server name from the nickname if set */
   if (silc_parse_userfqdn(nickname, nick, sizeof(nick),
-                         serv, sizeof(serv) == 2))
+                         serv, sizeof(serv)) == 2)
     server = (const char *)serv;
   nickname = (const char *)nick;
 
@@ -769,7 +781,7 @@ SilcClientEntry silc_client_add_client(SilcClient client,
                                       SilcUInt32 mode)
 {
   SilcClientEntry client_entry;
-  char *nick = NULL;
+  char *nick = NULL, parsed[128 + 1];
 
   SILC_LOG_DEBUG(("Adding new client entry"));
 
@@ -783,14 +795,21 @@ SilcClientEntry silc_client_add_client(SilcClient client,
   client_entry->id = *id;
   client_entry->mode = mode;
   client_entry->realname = userinfo ? strdup(userinfo) : NULL;
-  silc_parse_userfqdn(nickname, client_entry->nickname,
-                     sizeof(client_entry->nickname),
-                     client_entry->server,
-                     sizeof(client_entry->server));
+
+  silc_parse_userfqdn(nickname, parsed, sizeof(parsed),
+                     client_entry->server, sizeof(client_entry->server));
+  if (nickname && client->internal->params->full_nicknames)
+    silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname),
+                 nickname);
+  else if (nickname)
+    silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname),
+                 parsed);
+
   silc_parse_userfqdn(username, client_entry->username,
                      sizeof(client_entry->username),
                      client_entry->hostname,
                      sizeof(client_entry->hostname));
+
   client_entry->channels = silc_hash_table_alloc(1, silc_hash_ptr, NULL, NULL,
                                                 NULL, NULL, NULL, TRUE);
   if (!client_entry->channels) {
@@ -801,8 +820,7 @@ SilcClientEntry silc_client_add_client(SilcClient client,
 
   /* Normalize nickname */
   if (client_entry->nickname[0]) {
-    nick = silc_identifier_check(client_entry->nickname,
-                                strlen(client_entry->nickname),
+    nick = silc_identifier_check(parsed, strlen(parsed),
                                 SILC_STRING_UTF8, 128, NULL);
     if (!nick) {
       silc_free(client_entry->realname);
@@ -852,7 +870,7 @@ void silc_client_update_client(SilcClient client,
                               const char *userinfo,
                               SilcUInt32 mode)
 {
-  char *nick = NULL;
+  char *nick = NULL, parsed[128 + 1];
 
   SILC_LOG_DEBUG(("Update client entry"));
 
@@ -860,20 +878,25 @@ void silc_client_update_client(SilcClient client,
 
   if (!client_entry->realname && userinfo)
     client_entry->realname = strdup(userinfo);
+
   if ((!client_entry->username[0] || !client_entry->hostname[0]) && username)
     silc_parse_userfqdn(username, client_entry->username,
                        sizeof(client_entry->username),
                        client_entry->hostname,
                        sizeof(client_entry->username));
+
   if (!client_entry->nickname[0] && nickname) {
-    silc_parse_userfqdn(nickname, client_entry->nickname,
-                       sizeof(client_entry->nickname),
-                       client_entry->server,
-                       sizeof(client_entry->server));
+    silc_parse_userfqdn(nickname, parsed, sizeof(parsed),
+                       client_entry->server, sizeof(client_entry->server));
+    if (client->internal->params->full_nicknames)
+      silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname),
+                   nickname);
+    else
+      silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname),
+                   parsed);
 
     /* Normalize nickname */
-    nick = silc_identifier_check(client_entry->nickname,
-                                strlen(client_entry->nickname),
+    nick = silc_identifier_check(parsed, strlen(parsed),
                                 SILC_STRING_UTF8, 128, NULL);
     if (!nick) {
       silc_rwlock_unlock(client_entry->internal.lock);
@@ -1125,7 +1148,8 @@ SilcClientEntry silc_client_nickname_format(SilcClient client,
   }
 
   /* Is the requested client formatted already */
-  if (!silc_utf8_strcasecmp(client_entry->nickname, 
+  if (client_entry->nickname_normalized &&
+      !silc_utf8_strcasecmp(client_entry->nickname,
                            client_entry->nickname_normalized))
     formatted = TRUE;
 
@@ -1142,7 +1166,7 @@ SilcClientEntry silc_client_nickname_format(SilcClient client,
       unformatted = entry;
       break;
     }
-  }  
+  }
 
   /* If there are no other unformatted clients and the requested client is
      unformatted, just return it. */
@@ -1151,7 +1175,7 @@ SilcClientEntry silc_client_nickname_format(SilcClient client,
     return client_entry;
   }
 
-  /* If priority formatting then the requested client will get the 
+  /* If priority formatting then the requested client will get the
      unformatted nickname, and the unformatted client will get a new
      formatted nickname. */
   if (priority) {
@@ -1161,7 +1185,7 @@ SilcClientEntry silc_client_nickname_format(SilcClient client,
                                      &cp))
         return NULL;
 
-      silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname), 
+      silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname),
                    cp);
       silc_free(cp);
     }
@@ -1344,32 +1368,66 @@ SilcChannelEntry silc_client_get_channel(SilcClient client,
                                         SilcClientConnection conn,
                                         char *channel)
 {
+  SilcList list;
   SilcIDCacheEntry id_cache;
-  SilcChannelEntry entry;
+  SilcChannelEntry entry = NULL;
+  char chname[256 + 1], server[256 + 1];
 
   if (!client || !conn || !channel)
     return NULL;
 
   SILC_LOG_DEBUG(("Find channel %s", channel));
 
+  /* Parse server name from channel name */
+  silc_parse_userfqdn(channel, chname, sizeof(chname), server, sizeof(server));
+
   /* Normalize name for search */
-  channel = silc_channel_name_check(channel, strlen(channel), SILC_STRING_UTF8,
+  channel = silc_channel_name_check(chname, strlen(chname), SILC_STRING_UTF8,
                                    256, NULL);
   if (!channel)
     return NULL;
 
   silc_mutex_lock(conn->internal->lock);
 
-  if (!silc_idcache_find_by_name_one(conn->internal->channel_cache, channel,
-                                    &id_cache)) {
+  if (!silc_idcache_find_by_name(conn->internal->channel_cache, channel,
+                                &list)) {
     silc_mutex_unlock(conn->internal->lock);
     silc_free(channel);
     return NULL;
   }
 
-  SILC_LOG_DEBUG(("Found"));
+  /* If server name was specified with channel name, find the correct
+     channel entry with the server name.  There can only be one channel
+     with same name on same server. */
+  silc_list_start(list);
+  if (server[0]) {
+    while ((id_cache = silc_list_get(list))) {
+      entry = id_cache->context;
+      if (!entry->server[0])
+       continue;
+      if (silc_utf8_strcasecmp(entry->server, server))
+       break;
+    }
+  } else {
+    /* Get first channel without server name specified or one with our
+       current server connection name */
+    while ((id_cache = silc_list_get(list))) {
+      entry = id_cache->context;
+      if (!entry->server[0])
+       break;
+      if (silc_utf8_strcasecmp(entry->server, conn->remote_host))
+       break;
+    }
+  }
 
-  entry = id_cache->context;
+  if (!id_cache) {
+    silc_mutex_unlock(conn->internal->lock);
+    silc_free(channel);
+    return NULL;
+  }
+
+  SILC_LOG_DEBUG(("Found channel %s%s%s", entry->channel_name,
+                 entry->server[0] ? "@" : "", entry->server));
 
   /* Reference */
   silc_client_ref_channel(client, conn, entry);
@@ -1558,9 +1616,9 @@ SilcChannelEntry silc_client_add_channel(SilcClient client,
                                         SilcChannelID *channel_id)
 {
   SilcChannelEntry channel;
-  char *channel_namec;
+  char *channel_namec, name[256 + 1];
 
-  SILC_LOG_DEBUG(("Start"));
+  SILC_LOG_DEBUG(("Adding channel %s", channel_name));
 
   channel = silc_calloc(1, sizeof(*channel));
   if (!channel)
@@ -1571,8 +1629,16 @@ SilcChannelEntry silc_client_add_channel(SilcClient client,
   channel->id = *channel_id;
   channel->mode = mode;
 
-  channel->channel_name = strdup(channel_name);
+  silc_parse_userfqdn(channel_name, name, sizeof(name),
+                     channel->server, sizeof(channel->server));
+  if (client->internal->params->full_channel_names)
+    channel->channel_name = strdup(channel_name);
+  else
+    channel->channel_name = strdup(name);
+
   if (!channel->channel_name) {
+    silc_rwlock_free(channel->internal.lock);
+    silc_atomic_uninit16(&channel->internal.refcnt);
     silc_free(channel);
     return NULL;
   }
@@ -1580,15 +1646,19 @@ SilcChannelEntry silc_client_add_channel(SilcClient client,
   channel->user_list = silc_hash_table_alloc(1, silc_hash_ptr, NULL, NULL,
                                             NULL, NULL, NULL, TRUE);
   if (!channel->user_list) {
+    silc_rwlock_free(channel->internal.lock);
+    silc_atomic_uninit16(&channel->internal.refcnt);
     silc_free(channel->channel_name);
     silc_free(channel);
     return NULL;
   }
 
   /* Normalize channel name */
-  channel_namec = silc_channel_name_check(channel_name, strlen(channel_name),
+  channel_namec = silc_channel_name_check(name, strlen(name),
                                          SILC_STRING_UTF8, 256, NULL);
   if (!channel_namec) {
+    silc_rwlock_free(channel->internal.lock);
+    silc_atomic_uninit16(&channel->internal.refcnt);
     silc_free(channel->channel_name);
     silc_hash_table_free(channel->user_list);
     silc_free(channel);
@@ -1600,6 +1670,8 @@ SilcChannelEntry silc_client_add_channel(SilcClient client,
   /* Add channel to cache, the normalized channel name is saved to cache */
   if (!silc_idcache_add(conn->internal->channel_cache, channel_namec,
                        &channel->id, channel)) {
+    silc_rwlock_free(channel->internal.lock);
+    silc_atomic_uninit16(&channel->internal.refcnt);
     silc_free(channel_namec);
     silc_free(channel->channel_name);
     silc_hash_table_free(channel->user_list);
@@ -1622,9 +1694,10 @@ SilcBool silc_client_del_channel(SilcClient client, SilcClientConnection conn,
                                 SilcChannelEntry channel)
 {
   SilcIDCacheEntry id_cache;
-  SilcBool ret;
+  SilcBool ret = TRUE;
   SilcCipher key;
   SilcHmac hmac;
+  char *namec;
 
   if (!channel)
     return FALSE;
@@ -1636,10 +1709,12 @@ SilcBool silc_client_del_channel(SilcClient client, SilcClientConnection conn,
 
   silc_mutex_lock(conn->internal->lock);
   if (silc_idcache_find_by_context(conn->internal->channel_cache, channel,
-                                  &id_cache))
-    silc_free(id_cache->name);
-  ret = silc_idcache_del_by_context(conn->internal->channel_cache,
-                                   channel, NULL);
+                                  &id_cache)) {
+    namec = id_cache->name;
+    ret = silc_idcache_del_by_context(conn->internal->channel_cache,
+                                     channel, NULL);
+    silc_free(namec);
+  }
   silc_mutex_unlock(conn->internal->lock);
 
   if (!ret)
@@ -2029,7 +2104,8 @@ SilcBool silc_client_del_server(SilcClient client, SilcClientConnection conn,
                                SilcServerEntry server)
 {
   SilcIDCacheEntry id_cache;
-  SilcBool ret;
+  SilcBool ret = TRUE;
+  char *namec;
 
   if (!server)
     return FALSE;
@@ -2041,10 +2117,12 @@ SilcBool silc_client_del_server(SilcClient client, SilcClientConnection conn,
 
   silc_mutex_lock(conn->internal->lock);
   if (silc_idcache_find_by_context(conn->internal->server_cache, server,
-                                  &id_cache))
-    silc_free(id_cache->name);
-  ret = silc_idcache_del_by_context(conn->internal->server_cache,
-                                   server, NULL);
+                                  &id_cache)) {
+    namec = id_cache->name;
+    ret = silc_idcache_del_by_context(conn->internal->server_cache,
+                                     server, NULL);
+    silc_free(namec);
+  }
   silc_mutex_unlock(conn->internal->lock);
 
   silc_free(server->server_name);
index 0f66b97ad2ddeef002fd86c0ff7ccedbcbedb1df..85e33fe38217f0fe7b17c6c70a97270b1d3e2aca 100644 (file)
@@ -938,7 +938,7 @@ SILC_FSM_STATE(silc_client_command_topic)
   SilcClient client = conn->client;
   SilcChannelEntry channel;
   SilcBuffer idp;
-  char *name;
+  char *name, tmp[512];
 
   if (cmd->argc < 2 || cmd->argc > 3) {
     SAY(conn->client, conn, SILC_CLIENT_MESSAGE_INFO,
@@ -953,7 +953,15 @@ SILC_FSM_STATE(silc_client_command_topic)
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
-    name = conn->current_channel->channel_name;
+
+    if (client->internal->params->full_channel_names)
+      silc_snprintf(tmp, sizeof(tmp), conn->current_channel->channel_name);
+    else
+      silc_snprintf(tmp, sizeof(tmp), "%s%s%s",
+                   conn->current_channel->channel_name,
+                   conn->current_channel->server[0] ? "@" : "",
+                   conn->current_channel->server);
+    name = tmp;
   } else {
     name = cmd->argv[1];
   }
@@ -2119,7 +2127,7 @@ SILC_FSM_STATE(silc_client_command_kick)
   SilcBuffer idp, idp2;
   SilcClientEntry target;
   SilcDList clients = NULL;
-  char *name;
+  char *name, tmp[512];
 
   if (cmd->argc < 3) {
     SAY(conn->client, conn, SILC_CLIENT_MESSAGE_INFO,
@@ -2133,7 +2141,15 @@ SILC_FSM_STATE(silc_client_command_kick)
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
-    name = conn->current_channel->channel_name;
+
+    if (client->internal->params->full_channel_names)
+      silc_snprintf(tmp, sizeof(tmp), conn->current_channel->channel_name);
+    else
+      silc_snprintf(tmp, sizeof(tmp), "%s%s%s",
+                   conn->current_channel->channel_name,
+                   conn->current_channel->server[0] ? "@" : "",
+                   conn->current_channel->server);
+    name = tmp;
   } else {
     name = cmd->argv[1];
   }
@@ -2521,7 +2537,7 @@ SILC_FSM_STATE(silc_client_command_leave)
   SilcClient client = conn->client;
   SilcChannelEntry channel;
   SilcBuffer idp;
-  char *name;
+  char *name, tmp[512];
 
   if (cmd->argc != 2) {
     SAY(conn->client, conn, SILC_CLIENT_MESSAGE_INFO,
@@ -2535,7 +2551,15 @@ SILC_FSM_STATE(silc_client_command_leave)
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
-    name = conn->current_channel->channel_name;
+
+    if (client->internal->params->full_channel_names)
+      silc_snprintf(tmp, sizeof(tmp), conn->current_channel->channel_name);
+    else
+      silc_snprintf(tmp, sizeof(tmp), "%s%s%s",
+                   conn->current_channel->channel_name,
+                   conn->current_channel->server[0] ? "@" : "",
+                   conn->current_channel->server);
+    name = tmp;
   } else {
     name = cmd->argv[1];
   }
@@ -2580,7 +2604,7 @@ SILC_FSM_STATE(silc_client_command_users)
 {
   SilcClientCommandContext cmd = fsm_context;
   SilcClientConnection conn = cmd->conn;
-  char *name;
+  char *name, tmp[512];
 
   if (cmd->argc != 2) {
     SAY(conn->client, conn, SILC_CLIENT_MESSAGE_INFO,
@@ -2594,7 +2618,15 @@ SILC_FSM_STATE(silc_client_command_users)
       COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
       goto out;
     }
-    name = conn->current_channel->channel_name;
+
+    if (conn->client->internal->params->full_channel_names)
+      silc_snprintf(tmp, sizeof(tmp), conn->current_channel->channel_name);
+    else
+      silc_snprintf(tmp, sizeof(tmp), "%s%s%s",
+                   conn->current_channel->channel_name,
+                   conn->current_channel->server[0] ? "@" : "",
+                   conn->current_channel->server);
+    name = tmp;
   } else {
     name = cmd->argv[1];
   }
index 9dda29d38e2c4839010a932b86c66e74c48566ee..61e4d73a082dea7df0a86f0d6791a9576612b313 100644 (file)
@@ -127,7 +127,7 @@ static void silc_client_command_process_error(SilcClientCommandContext cmd,
   if (cmd->error == SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID) {
     SilcChannelEntry channel;
 
-    /* Remove unknown client entry from cache */
+    /* Remove unknown channel entry from cache */
     if (!silc_argument_get_decoded(args, 2, SILC_ARGUMENT_ID, &id, NULL))
       return;
 
@@ -143,7 +143,7 @@ static void silc_client_command_process_error(SilcClientCommandContext cmd,
   if (cmd->error == SILC_STATUS_ERR_NO_SUCH_SERVER_ID) {
     SilcServerEntry server_entry;
 
-    /* Remove unknown client entry from cache */
+    /* Remove unknown server entry from cache */
     if (!silc_argument_get_decoded(args, 2, SILC_ARGUMENT_ID, &id, NULL))
       return;
 
@@ -221,7 +221,7 @@ SILC_FSM_STATE(silc_client_command_reply_wait)
   /** Wait for command reply */
   silc_fsm_set_state_context(fsm, NULL);
   silc_fsm_next_later(fsm, silc_client_command_reply_timeout,
-                     cmd->cmd != SILC_COMMAND_PING ? 25 : 60, 0);
+                     cmd->cmd != SILC_COMMAND_PING ? 40 : 60, 0);
   return SILC_FSM_WAIT;
 }
 
@@ -677,7 +677,8 @@ SILC_FSM_STATE(silc_client_command_reply_identify)
     }
 
     /* Notify application */
-    silc_client_command_callback(cmd, channel_entry, name, info);
+    silc_client_command_callback(cmd, channel_entry,
+                                channel_entry->channel_name, info);
     silc_client_unref_channel(client, conn, channel_entry);
     break;
   }
@@ -732,6 +733,7 @@ SILC_FSM_STATE(silc_client_command_reply_nick)
   if (!silc_client_change_nickname(client, conn, conn->local_entry,
                                   nick, &id.u.client_id, idp, idp_len)) {
     ERROR_CALLBACK(SILC_STATUS_ERR_BAD_NICKNAME);
+    silc_rwlock_unlock(conn->local_entry->internal.lock);
     goto out;
   }
 
@@ -800,7 +802,8 @@ SILC_FSM_STATE(silc_client_command_reply_list)
   }
 
   /* Notify application */
-  silc_client_command_callback(cmd, channel_entry, name, topic, usercount);
+  silc_client_command_callback(cmd, channel_entry, channel_entry->channel_name,
+                              topic, usercount);
 
  out:
   silc_client_unref_channel(client, conn, channel_entry);
@@ -1302,7 +1305,7 @@ SILC_FSM_STATE(silc_client_command_reply_join)
   silc_hash_table_list(channel->user_list, &htl);
 
   /* Notify application */
-  silc_client_command_callback(cmd, channel_name, channel, mode, &htl,
+  silc_client_command_callback(cmd, channel->channel_name, channel, mode, &htl,
                               topic, cipher, hmac, channel->founder_key,
                               channel->channel_pubkeys, channel->user_limit);
 
@@ -1945,6 +1948,8 @@ SILC_FSM_STATE(silc_client_command_reply_users)
     }
   }
 
+  silc_rwlock_unlock(channel->internal.lock);
+
   /* Notify application */
   silc_hash_table_list(channel->user_list, &htl);
   silc_client_command_callback(cmd, channel, &htl);
index c67157e600270ecb418cfe31888872c3df23547f..898204a18f46663a571c0c38202d924fb9d3f089 100644 (file)
@@ -437,8 +437,7 @@ typedef void (*SilcVerifyPublicKey)(SilcBool success, void *context);
  *
  * SYNOPSIS
  *
- *    typedef void (*SilcGetAuthMeth)(SilcBool success,
- *                                    SilcAuthMethod auth_meth,
+ *    typedef void (*SilcGetAuthMeth)(SilcAuthMethod auth_meth,
  *                                    const void *auth, SilcUInt32 auth_len,
  *                                    void *context);
  *
@@ -666,13 +665,16 @@ typedef struct SilcClientParamsStruct {
      %H  full hostname - the full hostname of the client
 
      Example format strings: "%n#%a"     (fe. nick#2, nick#3)
-                             "%n@%h%a"   (fe. nick@host, nick@host2)
-                             "%a!%n@%h"  (fe. nick@host, 2!nick@host)
+                             "%n#%h%a"   (fe. nick#host, nick#host2)
+                             "%a!%n#%h"  (fe. nick#host, 2!nick#host)
 
      Note that there must always be some separator characters around '%n'
      format.  It is not possible to put format characters before or after
      '%n' without separators (such ash '#').  Also note that the separator
      character should be a character that cannot be part of normal nickname.
+     Note that, using '@' as a separator is not recommended as the nickname
+     string may contain it to separate a server name from the nickname (eg.
+     nickname@silcnet.org).
   */
   char nickname_format[32];
 
@@ -684,6 +686,21 @@ typedef struct SilcClientParamsStruct {
      value. */
   SilcBool nickname_force_format;
 
+  /* If this is set to TRUE then all nickname strings returned by the library
+     and stored by the library are in the format of 'nickname@server', eg.
+     nickname@silcnet.org.  If this is FALSE then the server name of the
+     nickname is available only from the SilcClientEntry structure.  When this
+     is TRUE the server name is still parsed to SilcClientEntry. */
+  SilcBool full_nicknames;
+
+  /* If this is set to TRUE then all channel name strings returned by the
+     library and stored by the library are in the format of 'channel@server',
+     eg. silc@silcnet.org.  If this is FALSE then the server name of the
+     channel is available only from the SilcChannelEntry structure.  When this
+     is TRUE the server name is still parsed to SilcChannelEntry.  Note that,
+     not all SILC server versions return such channel name strings. */
+  SilcBool full_channel_names;
+
   /* If this is set to TRUE, the silcclient library will not register and
      deregister the cipher, pkcs, hash and hmac algorithms. The application
      itself will need to handle that. */
@@ -1310,9 +1327,12 @@ SilcChannelUser silc_client_on_channel(SilcChannelEntry channel,
  *    be the command name.  The variable argument list must be terminated
  *    with NULL.
  *
- *    Returns FALSE if the command is not known and TRUE after command.
- *    execution.  The `command' client operation callback will be called when
- *    the command is executed to indicate whether or not the command executed
+ *    Returns command identifier for this sent command.  It can be used
+ *    to additionally attach to the command reply using the function
+ *    silc_client_command_pending, if needed.  Returns 0 on error.
+ *
+ *    The `command' client operation callback will be called when the
+ *    command is executed to indicate whether or not the command executed
  *    successfully.
  *
  *    The `command_reply' client operation callbak will be called when reply
index 94106badbd4f10ef95a4bc0085de0f20a74e7119..4b57f859bcde386d125d05cc3be20e44160df1ad 100644 (file)
@@ -78,7 +78,7 @@
  * SOURCE
  */
 struct SilcClientEntryStruct {
-  char nickname[128 + 1];           /* Nickname */
+  char nickname[256 + 1];           /* Nickname */
   char username[128 + 1];           /* Username */
   char hostname[256 + 1];           /* Hostname */
   char server  [256 + 1];           /* SILC server name */
@@ -124,6 +124,7 @@ struct SilcClientEntryStruct {
  */
 struct SilcChannelEntryStruct {
   char *channel_name;               /* Channel name */
+  char server[256 + 1];                     /* SILC server name */
   char *topic;                      /* Current topic, may be NULL */
   SilcPublicKey founder_key;        /* Founder key, may be NULL */
   SilcDList channel_pubkeys;        /* Channel public keys, may be NULL */
@@ -442,46 +443,6 @@ SilcDList silc_client_get_clients_local(SilcClient client,
                                        const char *nickname,
                                        SilcBool return_all);
 
-/****f* silcclient/SilcClientAPI/silc_client_get_clients_by_channel
- *
- * SYNOPSIS
- *
- *    void silc_client_get_clients_by_channel(SilcClient client,
- *                                            SilcClientConnection conn,
- *                                            SilcChannelEntry channel,
- *                                            SilcGetClientCallback completion,
- *                                            void *context);
- *
- * DESCRIPTION
- *
- *    Gets client entries by the channel indicated by `channel'. Thus,
- *    it resovles the users currently on that channel. If all users are
- *    already resolved this returns the users from the channel. If the
- *    users are resolved only partially this resolves the complete user
- *    information. If no users are resolved on this channel at all, this
- *    calls USERS command to resolve all users on the channel. The `completion'
- *    will be called after the entries are available. When server returns
- *    the client information it will be cached and can be accessed locally
- *    at a later time.
- *
- *    This function can be used for example in SILC_COMMAND_JOIN command
- *    reply handling in application to resolve users on that channel.  It
- *    also can be used after calling silc_client_get_channel_resolve to
- *    resolve users on that channel.
- *
- * NOTES
- *
- *    The resolving is done with WHOIS command.  For this reason this
- *    command may take a long time because it resolves detailed user
- *    information.
- *
- ***/
-void silc_client_get_clients_by_channel(SilcClient client,
-                                       SilcClientConnection conn,
-                                       SilcChannelEntry channel,
-                                       SilcGetClientCallback completion,
-                                       void *context);
-
 /****f* silcclient/SilcClientAPI/silc_client_get_client_by_id
  *
  * SYNOPSIS
@@ -718,7 +679,7 @@ SilcChannelEntry silc_client_get_channel(SilcClient client,
  *    Resolves entry for channel by the channel name from the server.
  *    The resolving is done with IDENTIFY command. Note that users on
  *    the channel are not resolved at the same time. Use for example
- *    silc_client_get_clients_by_channel to resolve all users on a channel.
+ *    USERS command to resolve all users on a channel.
  *
  ***/
 void silc_client_get_channel_resolve(SilcClient client,
@@ -774,8 +735,7 @@ SilcChannelEntry silc_client_get_channel_by_id(SilcClient client,
  *    a pending command to it, if needed.  Returns 0 on error.
  *
  *    Note that users on the channel are not resolved at the same time.
- *    Use for example silc_client_get_clients_by_channel to resolve all
- *    users on a channel.
+ *    Use for example USERS command to resolve all users on a channel.
  *
  ***/
 SilcUInt16
index a924294e1a733056a79c6669547604b760171f5d..5a2bd57ba8f4f34612aaed89d12cb4c74fc2e8be 100644 (file)
@@ -11,7 +11,7 @@
 @LINK=silcid.html:SILC ID Interface
 @LINK=silcargument.html:SILC Argument Interface
 @LINK=silcattrs.html:SILC Attributes Interface
-@LINK=silcpacket.html:Packet Protocol Interface
+@LINK=silcpacket.html:Packet Engine Interface
 @LINK=silcpubkey.html:SILC Public Key Payload Interface
 -->
 
index 1ac9cc1fced88d54befe87ec5369330fb9ae25e8..a6cb9295108f55080504ba969315b589ec4ad1b6 100644 (file)
@@ -45,7 +45,7 @@ Locking in packet engine
 Currently the engine lock is used only when the packet free list is accessed,
 or new stream is added or removed.  The packet free list, however, is
 accessed for all incoming packets.  Application free's the packet context so
-the lock must later be acquired be putting the unused packet context back
+the lock must later be acquired for putting the unused packet context back
 to the free list.  It might be possible to later put the packet free list to
 per-thread context.
 
index a98726f86e492d64366f2c05b0ae4ceb944b8722..eac8bdf60e72d5dfef128924ba389df5fbee842f 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2001 - 2006 Pekka Riikonen
+  Copyright (C) 2001 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -67,8 +67,10 @@ SilcArgumentPayload silc_argument_payload_parse(const unsigned char *payload,
                               SILC_STR_UI_SHORT(&p_len),
                               SILC_STR_UI_CHAR(&arg_type),
                               SILC_STR_END);
-    if (ret == -1 || p_len > silc_buffer_len(&buffer) - 3)
+    if (ret == -1 || p_len > silc_buffer_len(&buffer) - 3) {
+      SILC_LOG_DEBUG(("Malformed argument payload"));
       goto err;
+    }
 
     newp->argv_lens[i] = p_len;
     newp->argv_types[i] = arg_type;
@@ -79,8 +81,10 @@ SilcArgumentPayload silc_argument_payload_parse(const unsigned char *payload,
                               SILC_STR_UI_XNSTRING_ALLOC(&newp->argv[i],
                                                          p_len),
                               SILC_STR_END);
-    if (ret == -1)
+    if (ret == -1) {
+      SILC_LOG_DEBUG(("Malformed argument payload"));
       goto err;
+    }
 
     silc_buffer_pull(&buffer, p_len);
     pull_len += 3 + p_len;
index 077d867d4d3b515be047ae6e3302f79b9011b58c..796f6255d3318732c0ffbe7ba47191c8d8c165ed 100644 (file)
@@ -129,6 +129,7 @@ silc_attribute_payload_encode_int(SilcAttribute attribute,
        str = silc_mime_encode(mime, &object_size);
        if (!str)
          return NULL;
+       object = str;
       }
       break;
 
index 645f3a536f42543c2f49b09dda6aea569ae92c2f..fc3dd8b28f559fe7ebcb9155def0a18fab29ea43 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2000 - 2005 Pekka Riikonen
+  Copyright (C) 2000 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -66,6 +66,8 @@ SilcNotifyPayload silc_notify_payload_parse(const unsigned char *payload,
     newp->args = silc_argument_payload_parse(buffer.data,
                                             silc_buffer_len(&buffer),
                                             newp->argc);
+    if (!newp->args)
+      goto err;
     silc_buffer_push(&buffer, 5);
   }
 
index 89e12a476a31a2b588c79a792021eb6c21f3f657..6dbb69bb44ca4d92751cdd58b439a69962a82d50 100644 (file)
@@ -306,7 +306,7 @@ static inline SilcBool silc_packet_stream_read(SilcPacketStream ps,
     inbuf = silc_dlist_get(ps->sc->inbufs);
     if (!inbuf) {
       /* Allocate new data input buffer */
-      inbuf = silc_buffer_alloc(SILC_PACKET_DEFAULT_SIZE * 61);
+      inbuf = silc_buffer_alloc(SILC_PACKET_DEFAULT_SIZE * 65);
       if (!inbuf) {
         silc_mutex_unlock(ps->lock);
         return FALSE;
@@ -638,7 +638,7 @@ static const char *packet_error[] = {
 const char *silc_packet_error_string(SilcPacketError error)
 {
   if (error < SILC_PACKET_ERR_READ || error > SILC_PACKET_ERR_NO_MEMORY)
-    return "";
+    return "<invalid error code>";
   return packet_error[error];
 }
 
@@ -655,13 +655,28 @@ SilcDList silc_packet_engine_get_streams(SilcPacketEngine engine)
 
   silc_mutex_lock(engine->lock);
   silc_list_start(engine->streams);
-  while ((ps = silc_list_get(engine->streams)))
+  while ((ps = silc_list_get(engine->streams))) {
+    silc_packet_stream_ref(ps);
     silc_dlist_add(list, ps);
+  }
   silc_mutex_unlock(engine->lock);
 
   return list;
 }
 
+/* Free list returned by silc_packet_engine_get_streams */
+
+void silc_packet_engine_free_streams_list(SilcDList streams)
+{
+  SilcPacketStream ps;
+
+  silc_dlist_start(streams);
+  while ((ps = silc_dlist_get(streams)))
+    silc_packet_stream_unref(ps);
+
+  silc_dlist_uninit(streams);
+}
+
 /* Create new packet stream */
 
 SilcPacketStream silc_packet_stream_create(SilcPacketEngine engine,
@@ -716,7 +731,7 @@ SilcPacketStream silc_packet_stream_create(SilcPacketEngine engine,
     ps->sc->schedule = schedule;
 
     /* Allocate data input buffer */
-    inbuf = silc_buffer_alloc(SILC_PACKET_DEFAULT_SIZE * 61);
+    inbuf = silc_buffer_alloc(SILC_PACKET_DEFAULT_SIZE * 65);
     if (!inbuf) {
       silc_free(ps->sc);
       ps->sc = NULL;
@@ -1307,11 +1322,11 @@ SilcBool silc_packet_set_ids(SilcPacketStream stream,
   if (!src_id && !dst_id)
     return FALSE;
 
-  SILC_LOG_DEBUG(("Setting new IDs to packet stream"));
-
   silc_mutex_lock(stream->lock);
 
   if (src_id) {
+    SILC_LOG_DEBUG(("Setting source ID to packet stream %p", stream));
+
     silc_free(stream->src_id);
     if (!silc_id_id2str(src_id, src_id_type, tmp, sizeof(tmp), &len)) {
       silc_mutex_unlock(stream->lock);
@@ -1327,6 +1342,8 @@ SilcBool silc_packet_set_ids(SilcPacketStream stream,
   }
 
   if (dst_id) {
+    SILC_LOG_DEBUG(("Setting destination ID to packet stream %p", stream));
+
     silc_free(stream->dst_id);
     if (!silc_id_id2str(dst_id, dst_id_type, tmp, sizeof(tmp), &len)) {
       silc_mutex_unlock(stream->lock);
@@ -1352,37 +1369,19 @@ SilcBool silc_packet_get_ids(SilcPacketStream stream,
                             SilcBool *src_id_set, SilcID *src_id,
                             SilcBool *dst_id_set, SilcID *dst_id)
 {
-  if (src_id && stream->src_id) {
-    (*src_id).type = stream->src_id_type;
-    switch (stream->src_id_type) {
-    case SILC_ID_CLIENT:
-      (*src_id).u.client_id = *(SilcClientID *)stream->src_id;
-      break;
-    case SILC_ID_SERVER:
-      (*src_id).u.server_id = *(SilcServerID *)stream->src_id;
-      break;
-    case SILC_ID_CHANNEL:
-      (*src_id).u.channel_id = *(SilcChannelID *)stream->src_id;
-      break;
-    }
-  }
+  if (src_id && stream->src_id)
+    if (!silc_id_str2id2(stream->src_id, stream->src_id_len,
+                        stream->src_id_type, src_id))
+      return FALSE;
+
   if (stream->src_id && src_id_set)
     *src_id_set = TRUE;
 
-  if (dst_id && stream->dst_id) {
-    (*dst_id).type = stream->dst_id_type;
-    switch (stream->dst_id_type) {
-    case SILC_ID_CLIENT:
-      (*dst_id).u.client_id = *(SilcClientID *)stream->dst_id;
-      break;
-    case SILC_ID_SERVER:
-      (*dst_id).u.server_id = *(SilcServerID *)stream->dst_id;
-      break;
-    case SILC_ID_CHANNEL:
-      (*dst_id).u.channel_id = *(SilcChannelID *)stream->dst_id;
-      break;
-    }
-  }
+  if (dst_id && stream->dst_id)
+    if (!silc_id_str2id2(stream->dst_id, stream->dst_id_len,
+                        stream->dst_id_type, dst_id))
+      return FALSE;
+
   if (stream->dst_id && dst_id_set)
     *dst_id_set = TRUE;
 
@@ -1973,8 +1972,8 @@ static inline SilcBool silc_packet_parse(SilcPacket packet)
                   silc_buffer_len(buffer)), buffer->head,
                   silc_buffer_headlen(buffer) + silc_buffer_len(buffer));
 
-  SILC_LOG_DEBUG(("Incoming packet type: %d (%s)", packet->type,
-                 silc_get_packet_name(packet->type)));
+  SILC_LOG_DEBUG(("Incoming packet type: %d (%s), flags %d", packet->type,
+                 silc_get_packet_name(packet->type), packet->flags));
 
   return TRUE;
 }
index 228a16a16a06b31e55568295d3b45b3f0a9c2600..f8f41cb8a84ec14dc08f32d622dbfda0a20c3758 100644 (file)
@@ -115,7 +115,7 @@ typedef SilcUInt8 SilcPacketFlags;
 #define SILC_PACKET_FLAG_ACK              0x10    /* Acknowledge packet */
 
 /* Impelemntation specific flags */
-#define SILC_PACKET_FLAG_LONG_PAD         0x12    /* Use maximum padding */
+#define SILC_PACKET_FLAG_LONG_PAD         0x20    /* Use maximum padding */
 /***/
 
 /****s* silccore/SilcPacketAPI/SilcPacketEngine
@@ -400,11 +400,24 @@ const char *silc_packet_error_string(SilcPacketError error);
  * DESCRIPTION
  *
  *    Returns list of packet streams added to the packet engine.  The caller
- *    must free the list with silc_dlist_uninit.
+ *    must free the list with silc_packet_engine_free_streams_list.
  *
  ***/
 SilcDList silc_packet_engine_get_streams(SilcPacketEngine engine);
 
+/****f* silccore/SilcPacketAPI/silc_packet_engine_free_streams_list
+ *
+ * SYNOPSIS
+ *
+ *    void silc_packet_engine_free_streams_list(SilcDList streams);
+ *
+ * DESCRIPTION
+ *
+ *    Free's the streams list returned by silc_packet_engine_get_streams.
+ *
+ ***/
+void silc_packet_engine_free_streams_list(SilcDList streams);
+
 /****f* silccore/SilcPacketAPI/silc_packet_stream_create
  *
  * SYNOPSIS
@@ -913,7 +926,7 @@ SilcBool silc_packet_set_ids(SilcPacketStream stream,
                             SilcIdType src_id_type, const void *src_id,
                             SilcIdType dst_id_type, const void *dst_id);
 
-/****f* silccore/SilcPacketAPI/silc_packet_set_ids
+/****f* silccore/SilcPacketAPI/silc_packet_get_ids
  *
  * SYNOPSIS
  *
@@ -1063,7 +1076,7 @@ SilcBool silc_packet_send_va_ext(SilcPacketStream stream,
                                 SilcIdType dst_id_type, void *dst_id,
                                 SilcCipher cipher, SilcHmac hmac, ...);
 
-/****f* silccore/SilcPacketAPI/silc_packet_wait
+/****f* silccore/SilcPacketAPI/silc_packet_wait_init
  *
  * SYNOPSIS
  *
index 766ea169a1292a572f640aec8ea36d482a3e5345..190316627fa63646a9576df3de0a28c0819eb316 100644 (file)
@@ -3,7 +3,7 @@
 #
 #  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 - 2006 Pekka Riikonen
+#  Copyright (C) 2000 - 2007 Pekka Riikonen
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -32,7 +32,6 @@ endif
 
 libsilccrypt_la_SOURCES =      \
        none.c                  \
-       rc5.c                   \
        md5.c                   \
        $(SILC_AES_S)           \
        rsa.c                   \
@@ -40,7 +39,6 @@ libsilccrypt_la_SOURCES =     \
        sha256.c                \
        twofish.c               \
        blowfish.c              \
-       cast.c                  \
        silccipher.c            \
        silchash.c              \
        silchmac.c              \
index 0fb9391cc0643864f149e06ca0f53c8f794f7292..27eadf24707b9de96def208742c71340b47834fb 100644 (file)
@@ -4,12 +4,12 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2000 Pekka Riikonen
+  Copyright (C) 1997 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.
-  
+
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 #define CIPHERS_H
 
 #include "none.h"
-#include "rc5.h"
 #include "twofish.h"
 #include "aes.h"
 #include "blowfish.h"
-#include "cast.h"
 
 #endif
index 283a5ee92ec21c37d91e97ceb36fec3ebff7c3a3..dbc58ab636f0c7f3b64db59676fe106c83d0e16d 100644 (file)
@@ -45,7 +45,7 @@ esac
 fi
 
 SILC_ADD_CC_FLAGS(SILC_CRYPTO, -fno-regmove)
-if test x$summary_debug = xno; then
+if test x$summary_debug = xno -a x$want_cc_optimizations = xtrue; then
   SILC_ADD_CC_FLAGS(SILC_CRYPTO, -fomit-frame-pointer -O3)
 fi
 
index efb4b76a396712f8ce9c989ac3eb6ee6da303239..f7f64600b34633fc788f756d59dfffab5061f143 100644 (file)
@@ -60,12 +60,6 @@ const SilcCipherObject silc_default_ciphers[] =
                      SILC_CIPHER_MODE_CBC),
   SILC_CIPHER_API_DEF("twofish-128-cbc", twofish_cbc, 128, 16, 16,
                      SILC_CIPHER_MODE_CBC),
-  SILC_CIPHER_API_DEF("cast-256-cbc", cast_cbc, 256, 16, 16,
-                     SILC_CIPHER_MODE_CBC),
-  SILC_CIPHER_API_DEF("cast-192-cbc", cast_cbc, 192, 16, 16,
-                     SILC_CIPHER_MODE_CBC),
-  SILC_CIPHER_API_DEF("cast-128-cbc", cast_cbc, 128, 16, 16,
-                     SILC_CIPHER_MODE_CBC),
 #ifdef SILC_DEBUG
   SILC_CIPHER_API_DEF("none", none, 0, 0, 0, 0),
 #endif /* SILC_DEBUG */
index 55c4c8084e08054cb8863d5a957c716900c38ec7..74fd6f03ab8b5a3ed35d106a288ec8853d05e7b9 100644 (file)
@@ -693,6 +693,7 @@ SilcBool silc_pkcs_load_public_key(const char *filename,
 
   silc_free(data);
   silc_free(public_key);
+  *ret_public_key = NULL;
   return FALSE;
 }
 
@@ -778,6 +779,7 @@ SilcBool silc_pkcs_load_private_key(const char *filename,
 
   silc_free(data);
   silc_free(private_key);
+  *ret_private_key = NULL;
   return FALSE;
 }
 
index 4bc79b116adb376fb634ad7c092975e3700b5ee6..7631711996974069b6d73c6f7db60f59c4a31867 100644 (file)
@@ -4,7 +4,7 @@
 #
 #  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2005 Pekka Riikonen
+#  Copyright (C) 2005 - 2007 Pekka Riikonen
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -21,10 +21,12 @@ if test x$compile_libs = xtrue; then
 AC_MSG_NOTICE([configuring math library])
 
 #ifdef SILC_DIST_TMA
-SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
-SILC_ADD_CC_FLAGS(MATH, -funroll-all-loops)
+if test x$want_cc_optimizations = xtrue; then
+  SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+  SILC_ADD_CC_FLAGS(MATH, -funroll-all-loops)
+fi
 if test x$enable_stack_trace != xyes; then
-SILC_ADD_CC_FLAGS(MATH, -fomit-frame-pointer)
+  SILC_ADD_CC_FLAGS(MATH, -fomit-frame-pointer)
 fi
 #endif SILC_DIST_TMA
 
@@ -36,20 +38,26 @@ case "$target" in
   alpha*-*-*)
     if test ! "$GCC"; then
       SILC_ADD_CC_FLAGS(MATH, -DTFM_NO_ASM)
-      SILC_ADD_CC_FLAGS(MATH, -O -Olimit 4000)
+      if test x$want_cc_optimizations = xtrue; then
+        SILC_ADD_CC_FLAGS(MATH, -O -Olimit 4000)
+      fi
       SILC_ADD_CC_FLAGS(MATH, -std1 -DOSF1)
     fi
     ;;
 
   sparcv9-*-* | sparc64-*-*)
-    SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+    if test x$want_cc_optimizations = xtrue; then
+      SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+    fi
     if test ! "$GCC"; then
       SILC_ADD_CC_FLAGS(MATH, -DTFM_NO_ASM)
     fi
     ;;
 
   ultrasparc*-*-*)
-    SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+    if test x$want_cc_optimizations = xtrue; then
+      SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+    fi
     if test ! "$GCC"; then
       SILC_ADD_CC_FLAGS(MATH, -DTFM_NO_ASM)
     fi
@@ -103,7 +111,9 @@ case "$target" in
     ;;
 
   *)
-    SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+    if test x$want_cc_optimizations = xtrue; then
+      SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2))
+    fi
     if test x$enable_stack_trace != xyes; then
       SILC_ADD_CC_FLAGS(MATH, -fomit-frame-pointer)
     fi
index 8751dd7e0b4802cdf105c6d962a9ad958cbf3294..59f7dfb61a29ce9ad9d9d8df216d3a45c31967df 100644 (file)
@@ -330,7 +330,7 @@ static void silc_sftp_client_io(SilcStream stream, SilcStreamStatus status,
                                void *context)
 {
   SilcSFTPClient sftp = context;
-  unsigned char inbuf[63488];
+  unsigned char inbuf[65536];
   SilcBufferStruct packet;
   int ret;
 
index 3c2ededf866ec32ecf87ebe00ab7b4ab0f4ef5a0..c111c9da8848b127379f10e61d1a9bc07a802901 100644 (file)
@@ -58,7 +58,7 @@ typedef struct {
 /* Generates absolute path from relative path that may include '.' and '..'
    in the path. */
 
-static char *mem_expand_path(MemFSEntry root, const char *path)
+static char *memfs_expand_path(MemFSEntry root, const char *path)
 {
   if (!strstr(path, "./") && !strstr(path, "../") &&
       !strstr(path, "/..") && !strstr(path, "/."))
@@ -70,8 +70,8 @@ static char *mem_expand_path(MemFSEntry root, const char *path)
 
 /* Add `entry' to directory `dir'. */
 
-static SilcBool mem_add_entry(MemFSEntry dir, MemFSEntry entry,
-                             SilcBool check_perm)
+static SilcBool memfs_add_entry(MemFSEntry dir, MemFSEntry entry,
+                               SilcBool check_perm)
 {
   int i;
 
@@ -115,7 +115,7 @@ static SilcBool mem_add_entry(MemFSEntry dir, MemFSEntry entry,
 
 /* Removes entry `entry' and all entries under it recursively. */
 
-static SilcBool mem_del_entry(MemFSEntry entry, SilcBool check_perm)
+static SilcBool memfs_del_entry(MemFSEntry entry, SilcBool check_perm)
 {
   int i;
 
@@ -129,7 +129,7 @@ static SilcBool mem_del_entry(MemFSEntry entry, SilcBool check_perm)
   /* Delete all entries recursively under this entry */
   for (i = 0; i < entry->entry_count; i++) {
     if (entry->entry[i]) {
-      if (!mem_del_entry(entry->entry[i], FALSE))
+      if (!memfs_del_entry(entry->entry[i], FALSE))
        return FALSE;
     }
   }
@@ -153,8 +153,8 @@ static SilcBool mem_del_entry(MemFSEntry entry, SilcBool check_perm)
 /* Finds first occurence of entry named `name' under the directory `dir'.
    This does not check subdirectories recursively. */
 
-static MemFSEntry mem_find_entry(MemFSEntry dir, const char *name,
-                                SilcUInt32 name_len)
+static MemFSEntry memfs_find_entry(MemFSEntry dir, const char *name,
+                                  SilcUInt32 name_len)
 {
   int i;
 
@@ -172,13 +172,13 @@ static MemFSEntry mem_find_entry(MemFSEntry dir, const char *name,
 /* Finds the entry by the `path' which may include full path or
    relative path. */
 
-static MemFSEntry mem_find_entry_path(MemFSEntry dir, const char *p)
+static MemFSEntry memfs_find_entry_path(MemFSEntry dir, const char *p)
 {
   MemFSEntry entry = NULL;
   int len;
   char *path, *cp;
 
-  cp = path = mem_expand_path(dir, p);
+  cp = path = memfs_expand_path(dir, p);
 
   if (strlen(cp) == 1 && cp[0] == '/')
     return dir;
@@ -187,7 +187,7 @@ static MemFSEntry mem_find_entry_path(MemFSEntry dir, const char *p)
     cp++;
   len = strcspn(cp, DIR_SEPARATOR);
   while (cp && len) {
-    entry = mem_find_entry(dir, cp, len);
+    entry = memfs_find_entry(dir, cp, len);
     if (!entry) {
       silc_free(cp);
       return NULL;
@@ -207,8 +207,8 @@ static MemFSEntry mem_find_entry_path(MemFSEntry dir, const char *p)
 /* Deletes entry by the name `name' from the directory `dir'. This does
    not check subdirectories recursively. */
 
-static SilcBool mem_del_entry_name(MemFSEntry dir, const char *name,
-                                  SilcUInt32 name_len, SilcBool check_perm)
+static SilcBool memfs_del_entry_name(MemFSEntry dir, const char *name,
+                                    SilcUInt32 name_len, SilcBool check_perm)
 {
   MemFSEntry entry;
 
@@ -216,17 +216,17 @@ static SilcBool mem_del_entry_name(MemFSEntry dir, const char *name,
   if (check_perm)
     return FALSE;
 
-  entry = mem_find_entry(dir, name, name_len);
+  entry = memfs_find_entry(dir, name, name_len);
 
   if (entry)
-    return mem_del_entry(entry, check_perm);
+    return memfs_del_entry(entry, check_perm);
 
   return FALSE;
 }
 
 /* Create new handle and add it to the list of open handles. */
 
-static MemFSFileHandle mem_create_handle(MemFS fs, int fd, MemFSEntry entry)
+static MemFSFileHandle memfs_create_handle(MemFS fs, int fd, MemFSEntry entry)
 {
   MemFSFileHandle handle;
   int i;
@@ -275,7 +275,7 @@ static MemFSFileHandle mem_create_handle(MemFS fs, int fd, MemFSEntry entry)
 
 /* Deletes the handle and remove it from the open handle list. */
 
-static SilcBool mem_del_handle(MemFS fs, MemFSFileHandle handle)
+static SilcBool memfs_del_handle(MemFS fs, MemFSFileHandle handle)
 {
   if (handle->handle > fs->handles_count)
     return FALSE;
@@ -296,7 +296,7 @@ static SilcBool mem_del_handle(MemFS fs, MemFSFileHandle handle)
 
 /* Find handle by handle index. */
 
-static MemFSFileHandle mem_find_handle(MemFS fs, SilcUInt32 handle)
+static MemFSFileHandle memfs_find_handle(MemFS fs, SilcUInt32 handle)
 {
   if (handle > fs->handles_count)
     return NULL;
@@ -393,7 +393,7 @@ void *silc_sftp_fs_memory_add_dir(SilcSFTPFilesystem fs, void *dir,
     return NULL;
   }
 
-  if (!mem_add_entry(dir ? dir : memfs->root, entry, FALSE)) {
+  if (!memfs_add_entry(dir ? dir : memfs->root, entry, FALSE)) {
     silc_free(entry->name);
     silc_free(entry);
     return NULL;
@@ -415,10 +415,10 @@ SilcBool silc_sftp_fs_memory_del_dir(SilcSFTPFilesystem fs, void *dir)
   SilcBool ret;
 
   if (dir)
-    return mem_del_entry(dir, FALSE);
+    return memfs_del_entry(dir, FALSE);
 
   /* Remove from root */
-  ret = mem_del_entry(memfs->root, FALSE);
+  ret = memfs_del_entry(memfs->root, FALSE);
 
   memfs->root = silc_calloc(1, sizeof(*memfs->root));
   if (!memfs->root)
@@ -467,7 +467,7 @@ SilcBool silc_sftp_fs_memory_add_file(SilcSFTPFilesystem fs, void *dir,
     return FALSE;
   }
 
-  return mem_add_entry(dir ? dir : memfs->root, entry, FALSE);
+  return memfs_add_entry(dir ? dir : memfs->root, entry, FALSE);
 }
 
 /* Removes a file indicated by the `filename' from the directory
@@ -481,13 +481,13 @@ SilcBool silc_sftp_fs_memory_del_file(SilcSFTPFilesystem fs, void *dir,
   if (!filename)
     return FALSE;
 
-  return mem_del_entry_name(dir ? dir : memfs->root, filename,
+  return memfs_del_entry_name(dir ? dir : memfs->root, filename,
                            strlen(filename), FALSE);
 }
 
-SilcSFTPHandle mem_get_handle(void *context, SilcSFTP sftp,
-                             const unsigned char *data,
-                             SilcUInt32 data_len)
+SilcSFTPHandle memfs_get_handle(void *context, SilcSFTP sftp,
+                               const unsigned char *data,
+                               SilcUInt32 data_len)
 {
   MemFS fs = (MemFS)context;
   SilcUInt32 handle;
@@ -496,12 +496,12 @@ SilcSFTPHandle mem_get_handle(void *context, SilcSFTP sftp,
     return NULL;
 
   SILC_GET32_MSB(handle, data);
-  return (SilcSFTPHandle)mem_find_handle(fs, handle);
+  return (SilcSFTPHandle)memfs_find_handle(fs, handle);
 }
 
-unsigned char *mem_encode_handle(void *context, SilcSFTP sftp,
-                                SilcSFTPHandle handle,
-                                SilcUInt32 *handle_len)
+unsigned char *memfs_encode_handle(void *context, SilcSFTP sftp,
+                                  SilcSFTPHandle handle,
+                                  SilcUInt32 *handle_len)
 {
   unsigned char *data;
   MemFSFileHandle h = (MemFSFileHandle)handle;
@@ -515,12 +515,12 @@ unsigned char *mem_encode_handle(void *context, SilcSFTP sftp,
   return data;
 }
 
-void mem_open(void *context, SilcSFTP sftp,
-             const char *filename,
-             SilcSFTPFileOperation pflags,
-             SilcSFTPAttributes attrs,
-             SilcSFTPHandleCallback callback,
-             void *callback_context)
+void memfs_open(void *context, SilcSFTP sftp,
+               const char *filename,
+               SilcSFTPFileOperation pflags,
+               SilcSFTPAttributes attrs,
+               SilcSFTPHandleCallback callback,
+               void *callback_context)
 {
   MemFS fs = (MemFS)context;
   MemFSEntry entry;
@@ -534,7 +534,7 @@ void mem_open(void *context, SilcSFTP sftp,
   }
 
   /* Find such file */
-  entry = mem_find_entry_path(fs->root, filename);
+  entry = memfs_find_entry_path(fs->root, filename);
   if (!entry) {
     (*callback)(sftp, SILC_SFTP_STATUS_NO_SUCH_FILE, NULL, callback_context);
     return;
@@ -580,7 +580,7 @@ void mem_open(void *context, SilcSFTP sftp,
   }
 
   /* File opened, return handle */
-  handle = mem_create_handle(fs, fd, entry);
+  handle = memfs_create_handle(fs, fd, entry);
   if (handle)
     (*callback)(sftp, SILC_SFTP_STATUS_OK, (SilcSFTPHandle)handle,
                callback_context);
@@ -589,10 +589,10 @@ void mem_open(void *context, SilcSFTP sftp,
                callback_context);
 }
 
-void mem_close(void *context, SilcSFTP sftp,
-              SilcSFTPHandle handle,
-              SilcSFTPStatusCallback callback,
-              void *callback_context)
+void memfs_close(void *context, SilcSFTP sftp,
+                SilcSFTPHandle handle,
+                SilcSFTPStatusCallback callback,
+                void *callback_context)
 {
   MemFS fs = (MemFS)context;
   MemFSFileHandle h = (MemFSFileHandle)handle;
@@ -607,16 +607,16 @@ void mem_close(void *context, SilcSFTP sftp,
     }
   }
 
-  mem_del_handle(fs, h);
+  memfs_del_handle(fs, h);
   (*callback)(sftp, SILC_SFTP_STATUS_OK, NULL, NULL, callback_context);
 }
 
-void mem_read(void *context, SilcSFTP sftp,
-             SilcSFTPHandle handle,
-             SilcUInt64 offset,
-             SilcUInt32 len,
-             SilcSFTPDataCallback callback,
-             void *callback_context)
+void memfs_read(void *context, SilcSFTP sftp,
+               SilcSFTPHandle handle,
+               SilcUInt64 offset,
+               SilcUInt32 len,
+               SilcSFTPDataCallback callback,
+               void *callback_context)
 {
   MemFSFileHandle h = (MemFSFileHandle)handle;
   unsigned char data[63488];
@@ -649,13 +649,13 @@ void mem_read(void *context, SilcSFTP sftp,
              ret, callback_context);
 }
 
-void mem_write(void *context, SilcSFTP sftp,
-              SilcSFTPHandle handle,
-              SilcUInt64 offset,
-              const unsigned char *data,
-              SilcUInt32 data_len,
-              SilcSFTPStatusCallback callback,
-              void *callback_context)
+void memfs_write(void *context, SilcSFTP sftp,
+                SilcSFTPHandle handle,
+                SilcUInt64 offset,
+                const unsigned char *data,
+                SilcUInt32 data_len,
+                SilcSFTPStatusCallback callback,
+                void *callback_context)
 {
   MemFSFileHandle h = (MemFSFileHandle)handle;
   int ret;
@@ -673,52 +673,52 @@ void mem_write(void *context, SilcSFTP sftp,
   (*callback)(sftp, SILC_SFTP_STATUS_OK, NULL, NULL, callback_context);
 }
 
-void mem_remove(void *context, SilcSFTP sftp,
-               const char *filename,
-               SilcSFTPStatusCallback callback,
-               void *callback_context)
+void memfs_remove(void *context, SilcSFTP sftp,
+                 const char *filename,
+                 SilcSFTPStatusCallback callback,
+                 void *callback_context)
 {
   /* Remove is not supported */
   (*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
              callback_context);
 }
 
-void mem_rename(void *context, SilcSFTP sftp,
-               const char *oldname,
-               const char *newname,
-               SilcSFTPStatusCallback callback,
-               void *callback_context)
+void memfs_rename(void *context, SilcSFTP sftp,
+                 const char *oldname,
+                 const char *newname,
+                 SilcSFTPStatusCallback callback,
+                 void *callback_context)
 {
   /* Rename is not supported */
   (*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
              callback_context);
 }
 
-void mem_mkdir(void *context, SilcSFTP sftp,
-              const char *path,
-              SilcSFTPAttributes attrs,
-              SilcSFTPStatusCallback callback,
-              void *callback_context)
+void memfs_mkdir(void *context, SilcSFTP sftp,
+                const char *path,
+                SilcSFTPAttributes attrs,
+                SilcSFTPStatusCallback callback,
+                void *callback_context)
 {
   /* Mkdir is not supported */
   (*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
              callback_context);
 }
 
-void mem_rmdir(void *context, SilcSFTP sftp,
-              const char *path,
-              SilcSFTPStatusCallback callback,
-              void *callback_context)
+void memfs_rmdir(void *context, SilcSFTP sftp,
+                const char *path,
+                SilcSFTPStatusCallback callback,
+                void *callback_context)
 {
   /* Rmdir is not supported */
   (*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
              callback_context);
 }
 
-void mem_opendir(void *context, SilcSFTP sftp,
-                const char *path,
-                SilcSFTPHandleCallback callback,
-                void *callback_context)
+void memfs_opendir(void *context, SilcSFTP sftp,
+                  const char *path,
+                  SilcSFTPHandleCallback callback,
+                  void *callback_context)
 {
   MemFS fs = (MemFS)context;
   MemFSEntry entry;
@@ -728,7 +728,7 @@ void mem_opendir(void *context, SilcSFTP sftp,
     path = (const char *)DIR_SEPARATOR;
 
   /* Find such directory */
-  entry = mem_find_entry_path(fs->root, path);
+  entry = memfs_find_entry_path(fs->root, path);
   if (!entry) {
     (*callback)(sftp, SILC_SFTP_STATUS_NO_SUCH_FILE, NULL, callback_context);
     return;
@@ -747,7 +747,7 @@ void mem_opendir(void *context, SilcSFTP sftp,
   }
 
   /* Directory opened, return handle */
-  handle = mem_create_handle(fs, 0, entry);
+  handle = memfs_create_handle(fs, 0, entry);
   if (handle)
     (*callback)(sftp, SILC_SFTP_STATUS_OK, (SilcSFTPHandle)handle,
                callback_context);
@@ -756,10 +756,10 @@ void mem_opendir(void *context, SilcSFTP sftp,
                callback_context);
 }
 
-void mem_readdir(void *context, SilcSFTP sftp,
-                SilcSFTPHandle handle,
-                SilcSFTPNameCallback callback,
-                void *callback_context)
+void memfs_readdir(void *context, SilcSFTP sftp,
+                  SilcSFTPHandle handle,
+                  SilcSFTPNameCallback callback,
+                  void *callback_context)
 {
   MemFSFileHandle h = (MemFSFileHandle)handle;
   MemFSEntry entry;
@@ -867,10 +867,10 @@ void mem_readdir(void *context, SilcSFTP sftp,
   silc_sftp_name_free(name);
 }
 
-void mem_stat(void *context, SilcSFTP sftp,
-             const char *path,
-             SilcSFTPAttrCallback callback,
-             void *callback_context)
+void memfs_stat(void *context, SilcSFTP sftp,
+               const char *path,
+               SilcSFTPAttrCallback callback,
+               void *callback_context)
 {
   MemFS fs = (MemFS)context;
   MemFSEntry entry;
@@ -882,7 +882,7 @@ void mem_stat(void *context, SilcSFTP sftp,
     path = (const char *)DIR_SEPARATOR;
 
   /* Find such directory */
-  entry = mem_find_entry_path(fs->root, path);
+  entry = memfs_find_entry_path(fs->root, path);
   if (!entry) {
     (*callback)(sftp, SILC_SFTP_STATUS_NO_SUCH_FILE, NULL, callback_context);
     return;
@@ -921,10 +921,10 @@ void mem_stat(void *context, SilcSFTP sftp,
   silc_sftp_attr_free(attrs);
 }
 
-void mem_lstat(void *context, SilcSFTP sftp,
-              const char *path,
-              SilcSFTPAttrCallback callback,
-              void *callback_context)
+void memfs_lstat(void *context, SilcSFTP sftp,
+                const char *path,
+                SilcSFTPAttrCallback callback,
+                void *callback_context)
 {
   MemFS fs = (MemFS)context;
   MemFSEntry entry;
@@ -936,7 +936,7 @@ void mem_lstat(void *context, SilcSFTP sftp,
     path = (const char *)DIR_SEPARATOR;
 
   /* Find such directory */
-  entry = mem_find_entry_path(fs->root, path);
+  entry = memfs_find_entry_path(fs->root, path);
   if (!entry) {
     (*callback)(sftp, SILC_SFTP_STATUS_NO_SUCH_FILE, NULL, callback_context);
     return;
@@ -983,10 +983,10 @@ void mem_lstat(void *context, SilcSFTP sftp,
   silc_sftp_attr_free(attrs);
 }
 
-void mem_fstat(void *context, SilcSFTP sftp,
-              SilcSFTPHandle handle,
-              SilcSFTPAttrCallback callback,
-              void *callback_context)
+void memfs_fstat(void *context, SilcSFTP sftp,
+                SilcSFTPHandle handle,
+                SilcSFTPAttrCallback callback,
+                void *callback_context)
 {
   MemFSFileHandle h = (MemFSFileHandle)handle;
   SilcSFTPAttributes attrs;
@@ -1026,53 +1026,53 @@ void mem_fstat(void *context, SilcSFTP sftp,
   silc_sftp_attr_free(attrs);
 }
 
-void mem_setstat(void *context, SilcSFTP sftp,
-                const char *path,
-                SilcSFTPAttributes attrs,
-                SilcSFTPStatusCallback callback,
-                void *callback_context)
+void memfs_setstat(void *context, SilcSFTP sftp,
+                  const char *path,
+                  SilcSFTPAttributes attrs,
+                  SilcSFTPStatusCallback callback,
+                  void *callback_context)
 {
   /* Setstat is not supported */
   (*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
              callback_context);
 }
 
-void mem_fsetstat(void *context, SilcSFTP sftp,
-                 SilcSFTPHandle handle,
-                 SilcSFTPAttributes attrs,
-                 SilcSFTPStatusCallback callback,
-                 void *callback_context)
+void memfs_fsetstat(void *context, SilcSFTP sftp,
+                   SilcSFTPHandle handle,
+                   SilcSFTPAttributes attrs,
+                   SilcSFTPStatusCallback callback,
+                   void *callback_context)
 {
   /* Fsetstat is not supported */
   (*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
              callback_context);
 }
 
-void mem_readlink(void *context, SilcSFTP sftp,
-                 const char *path,
-                 SilcSFTPNameCallback callback,
-                 void *callback_context)
+void memfs_readlink(void *context, SilcSFTP sftp,
+                   const char *path,
+                   SilcSFTPNameCallback callback,
+                   void *callback_context)
 {
   /* Readlink is not supported */
   (*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL,
              callback_context);
 }
 
-void mem_symlink(void *context, SilcSFTP sftp,
-                const char *linkpath,
-                const char *targetpath,
-                SilcSFTPStatusCallback callback,
-                void *callback_context)
+void memfs_symlink(void *context, SilcSFTP sftp,
+                  const char *linkpath,
+                  const char *targetpath,
+                  SilcSFTPStatusCallback callback,
+                  void *callback_context)
 {
   /* Symlink is not supported */
   (*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, NULL,
              callback_context);
 }
 
-void mem_realpath(void *context, SilcSFTP sftp,
-                 const char *path,
-                 SilcSFTPNameCallback callback,
-                 void *callback_context)
+void memfs_realpath(void *context, SilcSFTP sftp,
+                   const char *path,
+                   SilcSFTPNameCallback callback,
+                   void *callback_context)
 {
   MemFS fs = (MemFS)context;
   char *realpath;
@@ -1081,7 +1081,7 @@ void mem_realpath(void *context, SilcSFTP sftp,
   if (!path || !strlen(path))
     path = (const char *)DIR_SEPARATOR;
 
-  realpath = mem_expand_path(fs->root, path);
+  realpath = memfs_expand_path(fs->root, path);
   if (!realpath)
     goto fail;
 
@@ -1115,12 +1115,12 @@ void mem_realpath(void *context, SilcSFTP sftp,
   (*callback)(sftp, SILC_SFTP_STATUS_FAILURE, NULL, callback_context);
 }
 
-void mem_extended(void *context, SilcSFTP sftp,
-                 const char *request,
-                 const unsigned char *data,
-                 SilcUInt32 data_len,
-                 SilcSFTPExtendedCallback callback,
-                 void *callback_context)
+void memfs_extended(void *context, SilcSFTP sftp,
+                   const char *request,
+                   const unsigned char *data,
+                   SilcUInt32 data_len,
+                   SilcSFTPExtendedCallback callback,
+                   void *callback_context)
 {
   /* Extended is not supported */
   (*callback)(sftp, SILC_SFTP_STATUS_OP_UNSUPPORTED, NULL, 0,
@@ -1128,25 +1128,25 @@ void mem_extended(void *context, SilcSFTP sftp,
 }
 
 const struct SilcSFTPFilesystemOpsStruct silc_sftp_fs_memory = {
-  mem_get_handle,
-  mem_encode_handle,
-  mem_open,
-  mem_close,
-  mem_read,
-  mem_write,
-  mem_remove,
-  mem_rename,
-  mem_mkdir,
-  mem_rmdir,
-  mem_opendir,
-  mem_readdir,
-  mem_stat,
-  mem_lstat,
-  mem_fstat,
-  mem_setstat,
-  mem_fsetstat,
-  mem_readlink,
-  mem_symlink,
-  mem_realpath,
-  mem_extended
+  memfs_get_handle,
+  memfs_encode_handle,
+  memfs_open,
+  memfs_close,
+  memfs_read,
+  memfs_write,
+  memfs_remove,
+  memfs_rename,
+  memfs_mkdir,
+  memfs_rmdir,
+  memfs_opendir,
+  memfs_readdir,
+  memfs_stat,
+  memfs_lstat,
+  memfs_fstat,
+  memfs_setstat,
+  memfs_fsetstat,
+  memfs_readlink,
+  memfs_symlink,
+  memfs_realpath,
+  memfs_extended
 };
index 0c9149755bfd35c836cb05c1cb49b0e97f85fe0f..e0b3fb25a2bad981d770192a719424d699841f7c 100644 (file)
@@ -3,7 +3,7 @@
 #
 #  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  Copyright (C) 2000 - 2005 Pekka Riikonen
+#  Copyright (C) 2000 - 2007 Pekka Riikonen
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ AUTOMAKE_OPTIONS = 1.0 no-dependencies foreign
 if SILC_SIM
 noinst_LTLIBRARIES = libsilcsim.la
 else
-noinst_LTLIBRARIES = 
+noinst_LTLIBRARIES =
 endif
 
 libsilcsim_la_SOURCES = \
@@ -33,18 +33,17 @@ libsilcsim_la_SOURCES = \
 SIM_CIPHER_OBJS = \
         none.o \
         blowfish.o \
-        rc5.o \
         aes.o \
         rsa.o \
-        twofish.o \
-       cast.o
+        twofish.o
 
 #
 # SILC Hash Functions to be compiled as modules
 #
 SIM_HASH_OBJS = \
        md5.o \
-       sha1.o
+       sha1.o \
+       sha256.o
 
 if SILC_SIM
 all: $(SIM_CIPHER_OBJS) $(SIM_HASH_OBJS)
index 97fdd1668b47d4452e5e8a86d95223f2defb8f11..c3799a8187ead72e327813bf6c7e6b76fb8bf84b 100644 (file)
@@ -357,7 +357,8 @@ SILC_FSM_STATE(silc_connauth_st_initiator_result)
     SILC_LOG_DEBUG(("Authentication successful"));
     connauth->success = TRUE;
   } else {
-    SILC_LOG_DEBUG(("Authentication failed"));
+    SILC_LOG_DEBUG(("Authentication failed, packet %s received",
+                   silc_get_packet_name(connauth->packet->type)));
     connauth->success = FALSE;
   }
   silc_packet_free(connauth->packet);
@@ -486,7 +487,8 @@ SILC_FSM_STATE(silc_connauth_st_responder_authenticate)
 
   if (connauth->aborted) {
     /** Aborted */
-    silc_packet_free(connauth->packet);
+    if (connauth->packet)
+      silc_packet_free(connauth->packet);
     silc_fsm_next(fsm, silc_connauth_st_responder_failure);
     return SILC_FSM_CONTINUE;
   }
index 69b43607173a3e5f0b190fb72277562370580d78..4db209868986ccd79ca41180a0d734e9423479e4 100644 (file)
@@ -671,19 +671,23 @@ static SilcSKEStatus silc_ske_make_hash(SilcSKE ske,
 {
   SilcSKEStatus status = SILC_SKE_STATUS_OK;
   SilcBuffer buf;
-  unsigned char *e, *f, *KEY;
-  SilcUInt32 e_len, f_len, KEY_len;
+  unsigned char *e, *f, *KEY, *s_data;
+  SilcUInt32 e_len, f_len, KEY_len, s_len;
   int ret;
 
   SILC_LOG_DEBUG(("Start"));
 
   if (initiator == FALSE) {
+    s_data = (ske->start_payload_copy ?
+            silc_buffer_data(ske->start_payload_copy) : NULL);
+    s_len = (ske->start_payload_copy ?
+            silc_buffer_len(ske->start_payload_copy) : 0);
     e = silc_mp_mp2bin(&ske->ke1_payload->x, 0, &e_len);
     f = silc_mp_mp2bin(&ske->ke2_payload->x, 0, &f_len);
     KEY = silc_mp_mp2bin(ske->KEY, 0, &KEY_len);
 
     /* Format the buffer used to compute the hash value */
-    buf = silc_buffer_alloc_size(silc_buffer_len(ske->start_payload_copy) +
+    buf = silc_buffer_alloc_size(s_len +
                                 ske->ke2_payload->pk_len +
                                 ske->ke1_payload->pk_len +
                                 e_len + f_len + KEY_len);
@@ -694,28 +698,24 @@ static SilcSKEStatus silc_ske_make_hash(SilcSKE ske,
     if (!ske->ke1_payload->pk_data) {
       ret =
        silc_buffer_format(buf,
-                          SILC_STR_UI_XNSTRING(
-                                  ske->start_payload_copy->data,
-                                  silc_buffer_len(ske->start_payload_copy)),
-                          SILC_STR_UI_XNSTRING(ske->ke2_payload->pk_data,
-                                               ske->ke2_payload->pk_len),
-                          SILC_STR_UI_XNSTRING(e, e_len),
-                          SILC_STR_UI_XNSTRING(f, f_len),
-                          SILC_STR_UI_XNSTRING(KEY, KEY_len),
+                          SILC_STR_DATA(s_data, s_len),
+                          SILC_STR_DATA(ske->ke2_payload->pk_data,
+                                        ske->ke2_payload->pk_len),
+                          SILC_STR_DATA(e, e_len),
+                          SILC_STR_DATA(f, f_len),
+                          SILC_STR_DATA(KEY, KEY_len),
                           SILC_STR_END);
     } else {
       ret =
        silc_buffer_format(buf,
-                          SILC_STR_UI_XNSTRING(
-                                  ske->start_payload_copy->data,
-                                  silc_buffer_len(ske->start_payload_copy)),
-                          SILC_STR_UI_XNSTRING(ske->ke2_payload->pk_data,
-                                               ske->ke2_payload->pk_len),
-                          SILC_STR_UI_XNSTRING(ske->ke1_payload->pk_data,
-                                               ske->ke1_payload->pk_len),
-                          SILC_STR_UI_XNSTRING(e, e_len),
-                          SILC_STR_UI_XNSTRING(f, f_len),
-                          SILC_STR_UI_XNSTRING(KEY, KEY_len),
+                          SILC_STR_DATA(s_data, s_len),
+                          SILC_STR_DATA(ske->ke2_payload->pk_data,
+                                        ske->ke2_payload->pk_len),
+                          SILC_STR_DATA(ske->ke1_payload->pk_data,
+                                        ske->ke1_payload->pk_len),
+                          SILC_STR_DATA(e, e_len),
+                          SILC_STR_DATA(f, f_len),
+                          SILC_STR_DATA(KEY, KEY_len),
                           SILC_STR_END);
     }
     if (ret == -1) {
@@ -736,21 +736,23 @@ static SilcSKEStatus silc_ske_make_hash(SilcSKE ske,
     silc_free(f);
     silc_free(KEY);
   } else {
+    s_data = (ske->start_payload_copy ?
+            silc_buffer_data(ske->start_payload_copy) : NULL);
+    s_len = (ske->start_payload_copy ?
+            silc_buffer_len(ske->start_payload_copy) : 0);
     e = silc_mp_mp2bin(&ske->ke1_payload->x, 0, &e_len);
 
-    buf = silc_buffer_alloc_size(silc_buffer_len(ske->start_payload_copy) +
-                                ske->ke1_payload->pk_len + e_len);
+    buf = silc_buffer_alloc_size(s_len + ske->ke1_payload->pk_len + e_len);
     if (!buf)
       return SILC_SKE_STATUS_OUT_OF_MEMORY;
 
     /* Format the buffer used to compute the hash value */
     ret =
       silc_buffer_format(buf,
-                        SILC_STR_UI_XNSTRING(ske->start_payload_copy->data,
-                                    silc_buffer_len(ske->start_payload_copy)),
-                        SILC_STR_UI_XNSTRING(ske->ke1_payload->pk_data,
-                                             ske->ke1_payload->pk_len),
-                        SILC_STR_UI_XNSTRING(e, e_len),
+                        SILC_STR_DATA(s_data, s_len),
+                        SILC_STR_DATA(ske->ke1_payload->pk_data,
+                                      ske->ke1_payload->pk_len),
+                        SILC_STR_DATA(e, e_len),
                         SILC_STR_END);
     if (ret == -1) {
       silc_buffer_free(buf);
@@ -1611,14 +1613,16 @@ SILC_FSM_STATE(silc_ske_st_initiator_phase4)
 
   payload = ske->ke2_payload;
 
+  /* Compute the HASH value */
+  SILC_LOG_DEBUG(("Computing HASH value"));
+  status = silc_ske_make_hash(ske, hash, &hash_len, FALSE);
+  if (status != SILC_SKE_STATUS_OK)
+    goto err;
+  ske->hash = silc_memdup(hash, hash_len);
+  ske->hash_len = hash_len;
+
   if (ske->prop->public_key) {
     SILC_LOG_DEBUG(("Public key is authentic"));
-
-    /* Compute the hash value */
-    status = silc_ske_make_hash(ske, hash, &hash_len, FALSE);
-    if (status != SILC_SKE_STATUS_OK)
-      goto err;
-
     SILC_LOG_DEBUG(("Verifying signature (HASH)"));
 
     /* Verify signature */
@@ -1630,9 +1634,6 @@ SILC_FSM_STATE(silc_ske_st_initiator_phase4)
     }
 
     SILC_LOG_DEBUG(("Signature is Ok"));
-
-    ske->hash = silc_memdup(hash, hash_len);
-    ske->hash_len = hash_len;
     memset(hash, 'F', hash_len);
   }
 
@@ -1884,6 +1885,7 @@ SILC_FSM_STATE(silc_ske_st_responder_phase1)
   SilcSKEStatus status;
   SilcSKEStartPayload remote_payload = NULL;
   SilcBuffer packet_buf = &ske->packet->buffer;
+  SilcID id;
 
   SILC_LOG_DEBUG(("Start"));
 
@@ -1898,6 +1900,19 @@ SILC_FSM_STATE(silc_ske_st_responder_phase1)
     return SILC_FSM_CONTINUE;
   }
 
+  /* Get remote ID and set it to stream */
+  if (ske->packet->src_id_len) {
+    silc_id_str2id(ske->packet->src_id, ske->packet->src_id_len,
+                  ske->packet->src_id_type,
+                  (ske->packet->src_id_type == SILC_ID_SERVER ?
+                   (void *)&id.u.server_id : (void *)&id.u.client_id),
+                  (ske->packet->src_id_type == SILC_ID_SERVER ?
+                   sizeof(id.u.server_id) : sizeof(id.u.client_id)));
+    silc_packet_set_ids(ske->stream, 0, NULL, ske->packet->src_id_type,
+                       (ske->packet->src_id_type == SILC_ID_SERVER ?
+                        (void *)&id.u.server_id : (void *)&id.u.client_id));
+  }
+
   /* Take a copy of the payload buffer for future use. It is used to
      compute the HASH value. */
   ske->start_payload_copy = silc_buffer_copy(packet_buf);
@@ -2209,22 +2224,23 @@ SILC_FSM_STATE(silc_ske_st_responder_phase5)
     }
     ske->ke2_payload->pk_data = pk;
     ske->ke2_payload->pk_len = pk_len;
+  }
 
-    SILC_LOG_DEBUG(("Computing HASH value"));
-
-    /* Compute the hash value */
-    memset(hash, 0, sizeof(hash));
-    status = silc_ske_make_hash(ske, hash, &hash_len, FALSE);
-    if (status != SILC_SKE_STATUS_OK) {
-      /** Error computing hash */
-      ske->status = status;
-      silc_fsm_next(fsm, silc_ske_st_responder_error);
-      return SILC_FSM_CONTINUE;
-    }
+  SILC_LOG_DEBUG(("Computing HASH value"));
 
-    ske->hash = silc_memdup(hash, hash_len);
-    ske->hash_len = hash_len;
+  /* Compute the hash value */
+  memset(hash, 0, sizeof(hash));
+  status = silc_ske_make_hash(ske, hash, &hash_len, FALSE);
+  if (status != SILC_SKE_STATUS_OK) {
+    /** Error computing hash */
+    ske->status = status;
+    silc_fsm_next(fsm, silc_ske_st_responder_error);
+    return SILC_FSM_CONTINUE;
+  }
+  ske->hash = silc_memdup(hash, hash_len);
+  ske->hash_len = hash_len;
 
+  if (ske->public_key && ske->private_key) {
     SILC_LOG_DEBUG(("Signing HASH value"));
 
     /* Sign the hash value */
@@ -2262,7 +2278,7 @@ SILC_FSM_STATE(silc_ske_st_responder_phase5)
 
   silc_buffer_free(payload_buf);
 
-  /* In case we are doing rekey move to finish it.  */
+  /* In case we are doing rekey move to finish it. */
   if (ske->rekey) {
     /** Finish rekey */
     silc_fsm_next(fsm, silc_ske_st_rekey_responder_done);
@@ -2461,6 +2477,13 @@ SILC_FSM_STATE(silc_ske_st_rekey_initiator_start)
     return SILC_FSM_CONTINUE;
   }
 
+  if (!silc_hash_alloc(ske->rekey->hash, &ske->prop->hash)) {
+    /** Cannot allocate hash */
+    ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
+    silc_fsm_next(fsm, silc_ske_st_initiator_error);
+    return SILC_FSM_CONTINUE;
+  }
+
   /* Send REKEY packet to start rekey protocol */
   if (!silc_ske_packet_send(ske, SILC_PACKET_REKEY, 0, NULL, 0)) {
     /** Error sending packet */
@@ -2506,13 +2529,7 @@ SILC_FSM_STATE(silc_ske_st_rekey_initiator_done)
   silc_packet_get_keys(ske->stream, &send_key, NULL, &hmac_send, NULL);
   key_len = silc_cipher_get_key_len(send_key);
   block_len = silc_cipher_get_block_len(send_key);
-
-  if (!silc_hash_alloc(ske->rekey->hash, &hash)) {
-    /** Cannot allocate hash */
-    ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
-    silc_fsm_next(fsm, silc_ske_st_initiator_error);
-    return SILC_FSM_CONTINUE;
-  }
+  hash = ske->prop->hash;
   hash_len = silc_hash_len(hash);
 
   /* Process key material */
@@ -2543,17 +2560,21 @@ SILC_FSM_STATE(silc_ske_st_rekey_initiator_done)
 
   ske->prop->cipher = send_key;
   ske->prop->hmac = hmac_send;
-  ske->prop->hash = hash;
 
   /* Get sending keys */
   if (!silc_ske_set_keys(ske, ske->keymat, ske->prop, &send_key, NULL,
                         &hmac_send, NULL, NULL)) {
     /** Cannot get keys */
     ske->status = SILC_SKE_STATUS_ERROR;
+    ske->prop->cipher = NULL;
+    ske->prop->hmac = NULL;
     silc_fsm_next(fsm, silc_ske_st_initiator_error);
     return SILC_FSM_CONTINUE;
   }
 
+  ske->prop->cipher = NULL;
+  ske->prop->hmac = NULL;
+
   /* Set the new keys into use.  This will also send REKEY_DONE packet.  Any
      packet sent after this call will be protected with the new keys. */
   if (!silc_packet_set_keys(ske->stream, send_key, NULL, hmac_send, NULL,
@@ -2561,6 +2582,8 @@ SILC_FSM_STATE(silc_ske_st_rekey_initiator_done)
     /** Cannot set keys */
     SILC_LOG_DEBUG(("Cannot set new keys, error sending REKEY_DONE"));
     ske->status = SILC_SKE_STATUS_ERROR;
+    silc_cipher_free(send_key);
+    silc_hmac_free(hmac_send);
     silc_fsm_next(fsm, silc_ske_st_initiator_error);
     return SILC_FSM_CONTINUE;
   }
@@ -2597,6 +2620,8 @@ SILC_FSM_STATE(silc_ske_st_rekey_initiator_end)
                         NULL, &hmac_receive, NULL)) {
     /** Cannot get keys */
     ske->status = SILC_SKE_STATUS_ERROR;
+    ske->prop->cipher = NULL;
+    ske->prop->hmac = NULL;
     silc_fsm_next(fsm, silc_ske_st_initiator_error);
     return SILC_FSM_CONTINUE;
   }
@@ -2608,6 +2633,8 @@ SILC_FSM_STATE(silc_ske_st_rekey_initiator_end)
     /** Cannot set keys */
     SILC_LOG_DEBUG(("Cannot set new keys"));
     ske->status = SILC_SKE_STATUS_ERROR;
+    silc_cipher_free(receive_key);
+    silc_hmac_free(hmac_receive);
     silc_fsm_next(fsm, silc_ske_st_initiator_error);
     return SILC_FSM_CONTINUE;
   }
@@ -2619,6 +2646,8 @@ SILC_FSM_STATE(silc_ske_st_rekey_initiator_end)
   if (!rekey) {
     /** No memory */
     ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
+    ske->prop->cipher = NULL;
+    ske->prop->hmac = NULL;
     silc_fsm_next(fsm, silc_ske_st_initiator_error);
     return SILC_FSM_CONTINUE;
   }
@@ -2647,8 +2676,11 @@ silc_ske_rekey_initiator(SilcSKE ske,
 {
   SILC_LOG_DEBUG(("Start SKE rekey as initator"));
 
-  if (!ske || !stream || !rekey)
+  if (!ske || !stream || !rekey) {
+    SILC_LOG_ERROR(("Missing arguments to silc_ske_rekey_initiator"));
+    SILC_ASSERT(rekey);
     return NULL;
+  }
 
   if (!silc_async_init(&ske->op, silc_ske_abort, NULL, ske))
     return NULL;
@@ -2696,7 +2728,6 @@ SILC_FSM_STATE(silc_ske_st_rekey_responder_wait)
   silc_schedule_task_add_timeout(ske->schedule, silc_ske_timeout,
                                 ske, 30, 0);
 
-
   silc_fsm_next(fsm, silc_ske_st_rekey_responder_start);
 
   /* If REKEY packet already received process it directly */
@@ -2732,6 +2763,13 @@ SILC_FSM_STATE(silc_ske_st_rekey_responder_start)
     return SILC_FSM_CONTINUE;
   }
 
+  if (!silc_hash_alloc(ske->rekey->hash, &ske->prop->hash)) {
+    /** Cannot allocate hash */
+    ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
+    silc_fsm_next(fsm, silc_ske_st_responder_error);
+    return SILC_FSM_CONTINUE;
+  }
+
   /* If doing rekey without PFS, move directly to the end of the protocol. */
   if (!ske->rekey->pfs) {
     /** Rekey without PFS */
@@ -2768,13 +2806,7 @@ SILC_FSM_STATE(silc_ske_st_rekey_responder_done)
   silc_packet_get_keys(ske->stream, &send_key, NULL, &hmac_send, NULL);
   key_len = silc_cipher_get_key_len(send_key);
   block_len = silc_cipher_get_block_len(send_key);
-
-  if (!silc_hash_alloc(ske->rekey->hash, &hash)) {
-    /** Cannot allocate hash */
-    ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
-    silc_fsm_next(fsm, silc_ske_st_responder_error);
-    return SILC_FSM_CONTINUE;
-  }
+  hash = ske->prop->hash;
   hash_len = silc_hash_len(hash);
 
   /* Process key material */
@@ -2805,17 +2837,21 @@ SILC_FSM_STATE(silc_ske_st_rekey_responder_done)
 
   ske->prop->cipher = send_key;
   ske->prop->hmac = hmac_send;
-  ske->prop->hash = hash;
 
   /* Get sending keys */
   if (!silc_ske_set_keys(ske, ske->keymat, ske->prop, &send_key, NULL,
                         &hmac_send, NULL, NULL)) {
     /** Cannot get keys */
     ske->status = SILC_SKE_STATUS_ERROR;
+    ske->prop->cipher = NULL;
+    ske->prop->hmac = NULL;
     silc_fsm_next(fsm, silc_ske_st_responder_error);
     return SILC_FSM_CONTINUE;
   }
 
+  ske->prop->cipher = NULL;
+  ske->prop->hmac = NULL;
+
   /* Set the new keys into use.  This will also send REKEY_DONE packet.  Any
      packet sent after this call will be protected with the new keys. */
   if (!silc_packet_set_keys(ske->stream, send_key, NULL, hmac_send, NULL,
@@ -2823,6 +2859,8 @@ SILC_FSM_STATE(silc_ske_st_rekey_responder_done)
     /** Cannot set keys */
     SILC_LOG_DEBUG(("Cannot set new keys, error sending REKEY_DONE"));
     ske->status = SILC_SKE_STATUS_ERROR;
+    silc_cipher_free(send_key);
+    silc_hmac_free(hmac_send);
     silc_fsm_next(fsm, silc_ske_st_responder_error);
     return SILC_FSM_CONTINUE;
   }
@@ -2859,6 +2897,8 @@ SILC_FSM_STATE(silc_ske_st_rekey_responder_end)
                         NULL, &hmac_receive, NULL)) {
     /** Cannot get keys */
     ske->status = SILC_SKE_STATUS_ERROR;
+    ske->prop->cipher = NULL;
+    ske->prop->hmac = NULL;
     silc_fsm_next(fsm, silc_ske_st_responder_error);
     return SILC_FSM_CONTINUE;
   }
@@ -2870,6 +2910,10 @@ SILC_FSM_STATE(silc_ske_st_rekey_responder_end)
     /** Cannot set keys */
     SILC_LOG_DEBUG(("Cannot set new keys"));
     ske->status = SILC_SKE_STATUS_ERROR;
+    ske->prop->cipher = NULL;
+    ske->prop->hmac = NULL;
+    silc_cipher_free(receive_key);
+    silc_hmac_free(hmac_receive);
     silc_fsm_next(fsm, silc_ske_st_responder_error);
     return SILC_FSM_CONTINUE;
   }
@@ -2881,6 +2925,8 @@ SILC_FSM_STATE(silc_ske_st_rekey_responder_end)
   if (!rekey) {
     /** No memory */
     ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
+    ske->prop->cipher = NULL;
+    ske->prop->hmac = NULL;
     silc_fsm_next(fsm, silc_ske_st_responder_error);
     return SILC_FSM_CONTINUE;
   }
@@ -2971,7 +3017,7 @@ silc_ske_process_key_material_data(unsigned char *data,
     return NULL;
   silc_buffer_format(buf,
                     SILC_STR_UI_CHAR(0),
-                    SILC_STR_UI_XNSTRING(data, data_len),
+                    SILC_STR_DATA(data, data_len),
                     SILC_STR_END);
 
   /* Take IVs */
@@ -3010,8 +3056,8 @@ silc_ske_process_key_material_data(unsigned char *data,
     if (!dist)
       return NULL;
     silc_buffer_format(dist,
-                      SILC_STR_UI_XNSTRING(data, data_len),
-                      SILC_STR_UI_XNSTRING(k1, hash_len),
+                      SILC_STR_DATA(data, data_len),
+                      SILC_STR_DATA(k1, hash_len),
                       SILC_STR_END);
     memset(k2, 0, sizeof(k2));
     silc_hash_make(hash, dist->data, silc_buffer_len(dist), k2);
@@ -3021,7 +3067,7 @@ silc_ske_process_key_material_data(unsigned char *data,
     silc_buffer_pull_tail(dist, hash_len);
     silc_buffer_pull(dist, data_len + hash_len);
     silc_buffer_format(dist,
-                      SILC_STR_UI_XNSTRING(k2, hash_len),
+                      SILC_STR_DATA(k2, hash_len),
                       SILC_STR_END);
     silc_buffer_push(dist, data_len + hash_len);
     memset(k3, 0, sizeof(k3));
@@ -3073,8 +3119,8 @@ silc_ske_process_key_material_data(unsigned char *data,
     if (!dist)
       return NULL;
     silc_buffer_format(dist,
-                      SILC_STR_UI_XNSTRING(data, data_len),
-                      SILC_STR_UI_XNSTRING(k1, hash_len),
+                      SILC_STR_DATA(data, data_len),
+                      SILC_STR_DATA(k1, hash_len),
                       SILC_STR_END);
     memset(k2, 0, sizeof(k2));
     silc_hash_make(hash, dist->data, silc_buffer_len(dist), k2);
@@ -3084,7 +3130,7 @@ silc_ske_process_key_material_data(unsigned char *data,
     silc_buffer_pull_tail(dist, hash_len);
     silc_buffer_pull(dist, data_len + hash_len);
     silc_buffer_format(dist,
-                      SILC_STR_UI_XNSTRING(k2, hash_len),
+                      SILC_STR_DATA(k2, hash_len),
                       SILC_STR_END);
     silc_buffer_push(dist, data_len + hash_len);
     memset(k3, 0, sizeof(k3));
@@ -3160,8 +3206,8 @@ silc_ske_process_key_material(SilcSKE ske,
   if (!buf)
     return NULL;
   silc_buffer_format(buf,
-                    SILC_STR_UI_XNSTRING(tmpbuf, klen),
-                    SILC_STR_UI_XNSTRING(ske->hash, ske->hash_len),
+                    SILC_STR_DATA(tmpbuf, klen),
+                    SILC_STR_DATA(ske->hash, ske->hash_len),
                     SILC_STR_END);
 
   /* Process the key material */
index 45837b367d504cfbbda33628a5812d9eea232596..9c637de61942b32f1654f903312ed80bea8529c5 100644 (file)
@@ -352,6 +352,10 @@ typedef void (*SilcSKECompletionCb)(SilcSKE ske,
  *    SILC_SKE_SP_FLAG_MUTUAL is not set and you are initiator.  For
  *    responder both `public_key' and `private_key' must be set.
  *
+ *    When allocating SKE session for rekey, the `repository' and `private_key'
+ *    pointers must be NULL and the SilcSKEVerifyCb callback must not be
+ *    set with silc_ske_set_callbacks.
+ *
  * EXMPALE
  *
  *    // Initiator example
@@ -443,8 +447,9 @@ void silc_ske_set_callbacks(SilcSKE ske,
  *    the protocol has completed.  The `stream' is the network connection
  *    to the remote host.  The SKE library will handle all key exchange
  *    packets sent and received in the `stream' connection.  The library will
- *    also set the remote host's ID automatically to the `stream'.  The
- *    `params' include SKE parameters, and it must be provided.
+ *    also set the remote host's ID automatically to the `stream' if it is
+ *    present in the exchanged packets.  The `params' include SKE parameters,
+ *    and it must be provided.
  *
  *    If the `start_payload' is NULL the library will generate it
  *    automatically.  Caller may provide it if it wants to send its own
@@ -478,8 +483,10 @@ SilcAsyncOperation silc_ske_initiator(SilcSKE ske,
  *    callback that was set in silc_ske_set_callbacks will be called once
  *    the protocol has completed.  The `stream' is the network connection
  *    to the remote host.  The SKE library will handle all key exchange
- *    packets sent and received in the `stream' connection.  The `params'
- *    include SKE parameters, and must be provided.
+ *    packets sent and received in the `stream' connection.  The library will
+ *    also set the remote hosts's ID automatically to the `stream' if it is
+ *    present in the exchanged packets.  The `params' include SKE parameters,
+ *    and must be provided.
  *
  *    This function returns SilcAsyncOperation operation context which can
  *    be used to control the protocol from the application.  Application may
index 56d0024b4dc780777d8e5e6b8f0d2757b5d6600e..0f2eef54b74669adc04d1272e8e2cb3dd9e79408 100644 (file)
@@ -51,16 +51,16 @@ typedef struct {
 
 #if defined(SILC_DEBUG)
 static const char *find_name[] = {
-  "PKCS TYPE",
-  "USERNAME",
-  "HOST",
-  "REALNAME",
-  "EMAIL",
-  "ORG",
-  "COUNTRY",
+  "PKCS TYPE ",
+  "USERNAME  ",
+  "HOST      ",
+  "REALNAME  ",
+  "EMAIL     ",
+  "ORG       ",
+  "COUNTRY   ",
   "PUBLIC KEY",
-  "CONTEXT",
-  "USAGE",
+  "CONTEXT   ",
+  "USAGE     ",
   NULL
 };
 #endif /* SILC_DEBUG */
@@ -78,7 +78,7 @@ static void silc_skr_type_string(SilcSKRFindType type, void *data,
   case SILC_SKR_FIND_PKCS_TYPE:
   case SILC_SKR_FIND_USAGE:
     silc_snprintf(retbuf, retbuf_size, "[%s] [%d]", find_name[type],
-            (int)SILC_PTR_TO_32(data));
+                 (int)SILC_PTR_TO_32(data));
     break;
 
   case SILC_SKR_FIND_PUBLIC_KEY:
@@ -88,7 +88,7 @@ static void silc_skr_type_string(SilcSKRFindType type, void *data,
 
   default:
     silc_snprintf(retbuf, retbuf_size, "[%s] [%s]", find_name[type],
-            (char *)data);
+                 (char *)data);
   }
 }
 #endif /* SILC_DEBUG */
@@ -271,6 +271,13 @@ static SilcBool silc_skr_add_entry(SilcSKR skr, SilcSKRFindType type,
 {
   SilcSKREntry entry;
 
+#if defined(SILC_DEBUG)
+  char tmp[256];
+  memset(tmp, 0, sizeof(tmp));
+  silc_skr_type_string(type, type_data, tmp, sizeof(tmp) - 1);
+  SILC_LOG_DEBUG(("Search constraint %s", tmp));
+#endif /* SILC_DEBUG */
+
   entry = silc_calloc(1, sizeof(*entry));
   if (!entry)
     return FALSE;
@@ -363,12 +370,16 @@ static SilcSKRStatus silc_skr_add_silc(SilcSKR skr,
   SilcSKRStatus status = SILC_SKR_ERROR;
   SilcPublicKeyIdentifier ident;
   SilcSILCPublicKey silc_pubkey;
+#if defined(SILC_DEBUG)
+  char tmp[256];
+#endif /* SILC_DEBUG */
 
   /* Get the SILC public key */
   silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
   ident = &silc_pubkey->identifier;
 
-  SILC_LOG_DEBUG(("Adding SILC public key [%s]", ident->username));
+  SILC_LOG_DEBUG(("Adding SILC public key %p [%s], context %p",
+                 public_key, ident->username, key_context));
 
   silc_mutex_lock(skr->lock);
 
@@ -391,6 +402,12 @@ static SilcSKRStatus silc_skr_add_silc(SilcSKR skr,
   key->key.key = public_key;
   key->key.key_context = key_context;
 
+#if defined(SILC_DEBUG)
+  silc_skr_type_string(SILC_SKR_FIND_USAGE, SILC_32_TO_PTR(usage),
+                      tmp, sizeof(tmp) - 1);
+  SILC_LOG_DEBUG((" Search constraint %s", tmp));
+#endif /* SILC_DEBUG */
+
   /* Add key specifics */
 
   if (!silc_skr_add_entry(skr, SILC_SKR_FIND_PUBLIC_KEY,
@@ -854,6 +871,8 @@ SilcBool silc_skr_find_set_public_key(SilcSKRFind find,
 
 SilcBool silc_skr_find_set_context(SilcSKRFind find, void *context)
 {
+  if (!context)
+    return TRUE;
   return silc_hash_table_add(find->constr,
                             SILC_32_TO_PTR(SILC_SKR_FIND_CONTEXT), context);
 }
@@ -882,6 +901,9 @@ SilcAsyncOperation silc_skr_find(SilcSKR skr, SilcSchedule schedule,
   SilcHashTableList htl;
   SilcDList list, results = NULL;
   void *type, *ctx, *usage = NULL;
+#if defined(SILC_DEBUG)
+  char tmp[256];
+#endif /* SILC_DEBUG */
 
   SILC_LOG_DEBUG(("Finding key from repository"));
 
@@ -894,21 +916,28 @@ SilcAsyncOperation silc_skr_find(SilcSKR skr, SilcSchedule schedule,
   silc_hash_table_find(find->constr, SILC_32_TO_PTR(SILC_SKR_FIND_USAGE),
                       NULL, &usage);
 
+#if defined(SILC_DEBUG)
+  if (usage) {
+    memset(tmp, 0, sizeof(tmp));
+    silc_skr_type_string(SILC_SKR_FIND_USAGE, usage, tmp, sizeof(tmp) - 1);
+    SILC_LOG_DEBUG(("Finding key by %s", tmp));
+  }
+#endif /* SILC_DEBUG */
+
   silc_hash_table_list(find->constr, &htl);
   while (silc_hash_table_get(&htl, &type, &ctx)) {
 
+    /* SILC_SKR_FIND_USAGE is handled separately while searching the keys. */
+    if ((SilcSKRFindType)SILC_32_TO_PTR(type) == SILC_SKR_FIND_USAGE)
+      continue;
+
 #if defined(SILC_DEBUG)
-    char tmp[256];
     memset(tmp, 0, sizeof(tmp));
     silc_skr_type_string((SilcSKRFindType)SILC_32_TO_PTR(type),
                         ctx, tmp, sizeof(tmp) - 1);
     SILC_LOG_DEBUG(("Finding key by %s", tmp));
 #endif /* SILC_DEBUG */
 
-    /* SILC_SKR_FIND_USAGE is handled separately while searching the keys. */
-    if ((SilcSKRFindType)SILC_32_TO_PTR(type) == SILC_SKR_FIND_USAGE)
-      continue;
-
     /* Find entries by this search constraint */
     if (!silc_skr_find_entry(skr, &status,
                             (SilcSKRFindType)SILC_32_TO_PTR(type),
index 681c8e951c822bd4c59601b85932dec5d087d1d5..3a49aecf07f039d78de8d1241cd13ed470bbe597 100644 (file)
@@ -298,10 +298,10 @@ SILC_ATOMIC_INIT_F(name, bits, type)                                      \
 }
 #endif /* SILC_ATOMIC_MUTEX */
 
-SILC_ATOMIC_INIT(8, 8, SilcUInt8);
-SILC_ATOMIC_INIT(16, 16, SilcUInt16);
-SILC_ATOMIC_INIT(32, 32, SilcUInt32);
-SILC_ATOMIC_INIT(_pointer, Pointer, void *);
+SILC_ATOMIC_INIT(8, 8, SilcUInt8)
+SILC_ATOMIC_INIT(16, 16, SilcUInt16)
+SILC_ATOMIC_INIT(32, 32, SilcUInt32)
+SILC_ATOMIC_INIT(_pointer, Pointer, void *)
 
 /****f* silcutil/SilcAtomicAPI/silc_atomic_uninit32
  *
@@ -372,13 +372,14 @@ SILC_ATOMIC_UNINIT_F(bits, t)                                             \
 #define SILC_ATOMIC_UNINIT(bits, t)                                    \
 SILC_ATOMIC_UNINIT_F(bits, t)                                          \
 {                                                                      \
+  memset(atomic, 0, sizeof(*atomic));                                  \
 }
 #endif /* SILC_ATOMIC_MUTEX */
 
-SILC_ATOMIC_UNINIT(8, 8);
-SILC_ATOMIC_UNINIT(16, 16);
-SILC_ATOMIC_UNINIT(32, 32);
-SILC_ATOMIC_UNINIT(_pointer, Pointer);
+SILC_ATOMIC_UNINIT(8, 8)
+SILC_ATOMIC_UNINIT(16, 16)
+SILC_ATOMIC_UNINIT(32, 32)
+SILC_ATOMIC_UNINIT(_pointer, Pointer)
 
 /****f* silcutil/SilcAtomicAPI/silc_atomic_set_int32
  *
@@ -478,9 +479,9 @@ SILC_ATOMIC_SET_INT_F(bits)                                         \
 }
 #endif /* !SILC_THREADS */
 
-SILC_ATOMIC_SET_INT(8, "b", "b");
-SILC_ATOMIC_SET_INT(16, "w", "w");
-SILC_ATOMIC_SET_INT(32, "l", "");
+SILC_ATOMIC_SET_INT(8, "b", "b")
+SILC_ATOMIC_SET_INT(16, "w", "w")
+SILC_ATOMIC_SET_INT(32, "l", "")
 
 /****f* silcutil/SilcAtomicAPI/silc_atomic_set_pointer
  *
@@ -617,9 +618,9 @@ SILC_ATOMIC_GET_INT_F(bits)                                         \
 }
 #endif /* !SILC_THREADS */
 
-SILC_ATOMIC_GET_INT(8);
-SILC_ATOMIC_GET_INT(16);
-SILC_ATOMIC_GET_INT(32);
+SILC_ATOMIC_GET_INT(8)
+SILC_ATOMIC_GET_INT(16)
+SILC_ATOMIC_GET_INT(32)
 
 /****f* silcutil/SilcAtomicAPI/silc_atomic_get_pointer
  *
@@ -789,9 +790,9 @@ SILC_ATOMIC_ADD_INT_F(bits)                                         \
 }
 #endif /* !SILC_THREADS */
 
-SILC_ATOMIC_ADD_INT(8, "b");
-SILC_ATOMIC_ADD_INT(16, "w");
-SILC_ATOMIC_ADD_INT(32, "l");
+SILC_ATOMIC_ADD_INT(8, "b")
+SILC_ATOMIC_ADD_INT(16, "w")
+SILC_ATOMIC_ADD_INT(32, "l")
 
 /****f* silcutil/SilcAtomicAPI/silc_atomic_sub_int32
  *
@@ -941,9 +942,9 @@ SILC_ATOMIC_INC_F(bits)                                                     \
 }
 #endif /* !SILC_THREADS */
 
-SILC_ATOMIC_INC(8, "b");
-SILC_ATOMIC_INC(16, "w");
-SILC_ATOMIC_INC(32, "l");
+SILC_ATOMIC_INC(8, "b")
+SILC_ATOMIC_INC(16, "w")
+SILC_ATOMIC_INC(32, "l")
 
 /****f* silcutil/SilcAtomicAPI/silc_atomic_dec32
  *
@@ -1047,9 +1048,9 @@ SILC_ATOMIC_DEC_F(bits)                                                   \
 }
 #endif /* !SILC_THREADS */
 
-SILC_ATOMIC_DEC(8, "b");
-SILC_ATOMIC_DEC(16, "w");
-SILC_ATOMIC_DEC(32, "l");
+SILC_ATOMIC_DEC(8, "b")
+SILC_ATOMIC_DEC(16, "w")
+SILC_ATOMIC_DEC(32, "l")
 
 /****f* silcutil/SilcAtomicAPI/silc_atomic_cas32
  *
@@ -1173,9 +1174,9 @@ SILC_ATOMIC_CAS_F(bits)                                                   \
 }
 #endif /* !SILC_THREADS */
 
-SILC_ATOMIC_CAS(8, "b");
-SILC_ATOMIC_CAS(16, "w");
-SILC_ATOMIC_CAS(32, "l");
+SILC_ATOMIC_CAS(8, "b")
+SILC_ATOMIC_CAS(16, "w")
+SILC_ATOMIC_CAS(32, "l")
 
 /****f* silcutil/SilcAtomicAPI/silc_atomic_cas_pointer
  *
index ff9efe3100bb7d2f82ca8bd3fc2696c5211d6bc4..5ce671175b628994820e5edd63a20efb026cb504 100644 (file)
@@ -977,7 +977,7 @@ SilcBuffer silc_buffer_salloc(SilcStack stack, SilcUInt32 len)
     return NULL;
 
   /* Allocate the actual data area */
-  sb->head = (unsigned char *)silc_smalloc_ua(stack, len);
+  sb->head = (unsigned char *)silc_smalloc(stack, len);
   if (silc_unlikely(!sb->head))
     return NULL;
 
@@ -1054,12 +1054,12 @@ SilcBuffer silc_buffer_srealloc(SilcStack stack,
 
   hlen = silc_buffer_headlen(sb);
   dlen = silc_buffer_len(sb);
-  h = (unsigned char *)silc_srealloc_ua(stack, silc_buffer_truelen(sb),
-                                       sb->head, newsize);
+  h = (unsigned char *)silc_srealloc(stack, silc_buffer_truelen(sb),
+                                    sb->head, newsize);
   if (!h) {
     /* Do slow and stack wasting realloc.  The old sb->head is lost and
        is freed eventually. */
-    h = (unsigned char *)silc_smalloc_ua(stack, newsize);
+    h = (unsigned char *)silc_smalloc(stack, newsize);
     if (silc_unlikely(!h))
       return NULL;
     memcpy(h, sb->head, silc_buffer_truelen(sb));
index abcc65f4df6da7352987983713c9a940fc938b06..bbb923e84a77a8e436cfe9a725db83cd872dc560 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2006 Pekka Riikonen
+  Copyright (C) 1997 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -747,8 +747,8 @@ int silc_buffer_sstrformat(SilcStack stack, SilcBuffer dst, ...)
       goto ok;
 
     slen = strlen(string);
-    d = silc_srealloc_ua(stack, len + 1, dst->head,
-                        sizeof(*dst->head) * (slen + len + 1));
+    d = silc_srealloc(stack, len + 1, dst->head,
+                     sizeof(*dst->head) * (slen + len + 1));
     if (silc_unlikely(!d))
       return -1;
     dst->head = d;
index 5b7a6ab69dfda2010bb88fd607ad956743959003..87dfb4cce6cb26871b4602d23153cd55a0e8934d 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2000 - 2006 Pekka Riikonen
+  Copyright (C) 2000 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
  *    Application defines this object and adds contexts to this list with
  *    Dynamic List Interface functions.
  *
- * SOURCE
- */
+ ***/
 typedef struct SilcDListStruct {
   SilcList list;
   void *current;
   void *prev;
 } *SilcDList;
-/***/
 
 /* SilcDListEntry structure, one entry in the list. This MUST NOT be used
    directly by the application. */
@@ -239,22 +237,22 @@ SilcBool silc_dlist_insert(SilcDList list, void *context)
  * SYNOPSIS
  *
  *    static inline
- *    void silc_dlist_del(SilcDList list, void *context);
+ *    void silc_dlist_del(SilcDList list, void *entry);
  *
  * DESCRIPTION
  *
- *    Remove entry from the list. Returns < 0 on error, 0 otherwise.
+ *    Remove entry from the list.
  *
  ***/
 
 static inline
-void silc_dlist_del(SilcDList list, void *context)
+void silc_dlist_del(SilcDList list, void *entry)
 {
   SilcDListEntry e;
 
   silc_list_start(list->list);
   while ((e = (SilcDListEntry)silc_list_get(list->list)) != SILC_LIST_END) {
-    if (e->context == context) {
+    if (e->context == entry) {
       silc_list_del(list->list, e);
 #if defined(SILC_DEBUG)
       memset(e, 'F', sizeof(*e));
index f22540cd0af5ea2800a1127e56a3b9cb5e57edbb..3382713ed50276c90c1c84975727f901dc113a31 100644 (file)
@@ -317,10 +317,6 @@ void silc_fsm_finish(void *fsm)
 
   SILC_ASSERT(!f->finished);
 
-  /* Machine must not have active threads */
-  if (!f->thread && silc_atomic_get_int32(&f->u.m.threads))
-    assert(silc_atomic_get_int32(&f->u.m.threads) == 0);
-
   f->started = FALSE;
   f->finished = TRUE;
 
@@ -484,6 +480,9 @@ SILC_TASK_CALLBACK(silc_fsm_finish_fsm)
       fsm->destructor(fsm, fsm->fsm_context, fsm->destructor_context);
 
   } else {
+    /* Machine must not have active threads */
+    assert(silc_atomic_get_int32(&fsm->u.m.threads) == 0);
+
     if (fsm->u.m.lock) {
       silc_mutex_free(fsm->u.m.lock);
       fsm->u.m.lock = NULL;
index cda1123f7fcfdf4338fa8bc1dcb97a32d00f32b8..81ea3638bd8a468c9a4501c9eb55c1e353c9932c 100644 (file)
@@ -104,6 +104,7 @@ do {                                                        \
   (list).next_offset = silc_offsetof(type, nextfield); \
   (list).prev_set = 0;                                 \
   (list).prev_offset = 0;                              \
+  (list).end_set = 0;                                  \
   (list).head = (list).tail = (list).current = NULL;   \
 } while(0)
 
@@ -143,6 +144,7 @@ do {                                                                \
   (list).next_offset = silc_offsetof(type, nextfield);         \
   (list).prev_offset = silc_offsetof(type, prevfield);         \
   (list).prev_set = 1;                                         \
+  (list).end_set = 0;                                          \
   (list).head = (list).tail = (list).current = NULL;           \
 } while(0)
 
index 82eb52401b252905e9fe09add2c23c77eadc6ab9..824efb701389912d11b260450b86ea63e6ac12fe 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2006 Pekka Riikonen
+  Copyright (C) 1997 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -486,6 +486,8 @@ void silc_log_debug_hexdump(SilcBool enable)
 void silc_log_output_debug(char *file, const char *function,
                           int line, char *string)
 {
+  SilcTimeStruct curtime;
+
 #ifndef SILC_SYMBIAN
   if (!silclog.debug)
     goto end;
@@ -501,6 +503,8 @@ void silc_log_output_debug(char *file, const char *function,
   }
 #endif /* !SILC_SYMBIAN */
 
+  silc_time_value(0, &curtime);
+
 #ifdef SILC_WIN32
   if (strrchr(function, '\\'))
     fprintf(stderr, "%s:%d: %s\n", strrchr(function, '\\') + 1, line, string);
@@ -509,10 +513,12 @@ void silc_log_output_debug(char *file, const char *function,
 #ifdef SILC_SYMBIAN
   silc_symbian_debug(function, line, string);
 #else
-  fprintf(stderr, "%s:%d: %s\n", function, line, string);
+  fprintf(stderr, "%02d:%02d:%02d %s:%d: %s\n", curtime.hour,
+         curtime.minute, curtime.second, function, line,
+         string);
   fflush(stderr);
 #endif /* SILC_SYMBIAN */
-  
+
  end:
   silc_free(string);
 }
index f719e77961694509b9868e4dd8c4b966576315bd..c0817ec0f594d1eaed43c27d1f88fac673929116 100644 (file)
@@ -198,6 +198,7 @@ SilcMime silc_mime_decode(SilcMime mime, const unsigned char *data,
   if (field && strstr(field, "multipart")) {
     char b[1024];
     SilcMime p;
+    unsigned int len;
 
     mime->multiparts = silc_dlist_init();
     if (!mime->multiparts)
@@ -213,7 +214,10 @@ SilcMime silc_mime_decode(SilcMime mime, const unsigned char *data,
     if (!strchr(field, ';'))
       goto err;
     memset(b, 0, sizeof(b));
-    strncat(b, value, strchr(field, ';') - value);
+    len = (unsigned int)(strchr(field, ';') - value);
+    if (len > sizeof(b) - 1)
+      goto err;
+    strncpy(b, value, len);
     if (strchr(b, '"'))
       *strchr(b, '"') = '\0';
     mime->multitype = silc_memdup(b, strlen(b));
index 070a2e9a3e0e774e5e0934cb084eb0680efb1ed4..6e8efeb2b7dfd807ed63d9696f005351bb23d3bf 100644 (file)
@@ -190,7 +190,7 @@ void silc_rwlock_free(SilcRwLock rwlock);
  *    is locked by a writer the current thread will block until the other
  *    thread has issued silc_rwlock_unlock for the `rwlock'.  This function
  *    may be called multiple times to acquire the read lock.  There must be
- *    same amount of silc_rwlock_unlock calls.  If `rwlock' is NULL this
+ *    same number of silc_rwlock_unlock calls.  If `rwlock' is NULL this
  *    function has no effect.
  *
  ***/
@@ -207,7 +207,9 @@ void silc_rwlock_rdlock(SilcRwLock rwlock);
  *    Acquires write lock of the read/write lock `rwlock'.  If the `rwlock'
  *    is locked by a writer or a reader the current thread will block until
  *    the other thread(s) have issued silc_rwlock_unlock for the `rwlock'.
- *    If `rwlock' is NULL this function has no effect.
+ *    A thread may acquire the write lock only once.  A deadlock may occur
+ *    if thread attempts to acquire the write lock when it has already done
+ *    so.  If `rwlock' is NULL this function has no effect.
  *
  ***/
 void silc_rwlock_wrlock(SilcRwLock rwlock);
index ce4cdcc62d3561974cd2b5a43e85e8e816b3aa09..3bbc40ab665501b7b3c34625d347afcb8408b7a0 100644 (file)
@@ -118,7 +118,7 @@ typedef void (*SilcNetCallback)(SilcNetStatus status,
  *
  *    This function creates TCP listener.  This is used to create network
  *    listener for incoming connections, and `callback' will be called
- *    everytime new connection is received.  If `local_ip_addr' is NULL any
+ *    everytime new connection is received.  If `local_ip_addr' is NULL 'any'
  *    address is used.  If provided it can be used bind the listener to
  *    `local_ip_count' many IP addresses provided in `local_ip_addr' table.
  *    On success returns the SilcNetListener context, or NULL on error.
@@ -504,7 +504,7 @@ typedef void (*SilcNetResolveCallback)(const char *result, void *context);
  * SYNOPSIS
  *
  *    SilcBool silc_net_gethostbyname(const char *name, SilcBool prefer_ipv6,
- *                                char *address, SilcUInt32 address_len);
+ *                                    char *address, SilcUInt32 address_len);
  *
  * DESCRIPTION
  *
@@ -553,9 +553,9 @@ void silc_net_gethostbyname_async(const char *name,
  * SYNOPSIS
  *
  *   SilcBool silc_net_gethostbyaddr(const char *addr, char *name,
- *                               SilcUInt32 name_len);
+ *                                   SilcUInt32 name_len);
  *
- * DESCRIPTION
+x * DESCRIPTION
  *
  *    Resolves the hostname for the IP address indicated by the `addr'
  *    This returns TRUE and the resolved hostname to the `name' buffer,
index 6d3f09e1c3d3794f4776ea5211a4115c1492494c..53cb0aa7426f22eb883c7fc5ee73fc427a9db48f 100644 (file)
@@ -473,6 +473,11 @@ static SilcBool silc_schedule_iterate(SilcSchedule schedule, int timeout_usecs)
       /* There is some data available now */
       SILC_LOG_DEBUG(("Running fd tasks"));
       silc_schedule_dispatch_fd(schedule);
+
+      /* If timeout was very short, dispatch also timeout tasks */
+      if (schedule->has_timeout && schedule->timeout.tv_sec == 0 &&
+         schedule->timeout.tv_usec < 50000)
+       silc_schedule_dispatch_timeout(schedule, FALSE);
       continue;
 
     } else {
@@ -543,6 +548,15 @@ void *silc_schedule_get_context(SilcSchedule schedule)
   return schedule->app_context;
 }
 
+/* Set notify callback */
+
+void silc_schedule_set_notify(SilcSchedule schedule,
+                             SilcTaskNotifyCb notify, void *context)
+{
+  schedule->notify = notify;
+  schedule->notify_context = context;
+}
+
 /* Add new task to the scheduler */
 
 SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
@@ -607,6 +621,11 @@ SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
 
     task = (SilcTask)ttask;
 
+    /* Call notify callback */
+    if (schedule->notify)
+      schedule->notify(schedule, TRUE, task, FALSE, 0, 0, seconds, useconds,
+                      schedule->notify_context);
+
   } else if (silc_likely(type == SILC_TASK_FD)) {
     SilcTaskFd ftask;
 
@@ -660,6 +679,11 @@ SilcTask silc_schedule_task_add(SilcSchedule schedule, SilcUInt32 fd,
 
     task = (SilcTask)ftask;
 
+    /* Call notify callback */
+    if (schedule->notify)
+      schedule->notify(schedule, TRUE, task, TRUE, ftask->fd,
+                      SILC_TASK_READ, 0, 0, schedule->notify_context);
+
   } else if (silc_unlikely(type == SILC_TASK_SIGNAL)) {
     SILC_SCHEDULE_UNLOCK(schedule);
     schedule_ops.signal_register(schedule, schedule->internal, fd,
@@ -694,16 +718,28 @@ SilcBool silc_schedule_task_del(SilcSchedule schedule, SilcTask task)
 
     /* Delete from fd queue */
     silc_hash_table_list(schedule->fd_queue, &htl);
-    while (silc_hash_table_get(&htl, NULL, (void *)&task))
+    while (silc_hash_table_get(&htl, NULL, (void *)&task)) {
       task->valid = FALSE;
+
+      /* Call notify callback */
+      if (schedule->notify)
+       schedule->notify(schedule, FALSE, task, TRUE,
+                        ((SilcTaskFd)task)->fd, 0, 0, 0,
+                        schedule->notify_context);
+    }
     silc_hash_table_list_reset(&htl);
 
     /* Delete from timeout queue */
     silc_list_start(schedule->timeout_queue);
-    while ((task = (SilcTask)silc_list_get(schedule->timeout_queue))
-          != SILC_LIST_END)
+    while ((task = (SilcTask)silc_list_get(schedule->timeout_queue))) {
       task->valid = FALSE;
 
+      /* Call notify callback */
+      if (schedule->notify)
+       schedule->notify(schedule, FALSE, task, FALSE, 0, 0, 0, 0,
+                        schedule->notify_context);
+    }
+
     SILC_SCHEDULE_UNLOCK(schedule);
     return TRUE;
   }
@@ -711,6 +747,11 @@ SilcBool silc_schedule_task_del(SilcSchedule schedule, SilcTask task)
   SILC_LOG_DEBUG(("Unregistering task %p", task));
   SILC_SCHEDULE_LOCK(schedule);
   task->valid = FALSE;
+
+  /* Call notify callback */
+  if (schedule->notify)
+    schedule->notify(schedule, FALSE, task, !task->type, 0, 0, 0, 0,
+                    schedule->notify_context);
   SILC_SCHEDULE_UNLOCK(schedule);
 
   return TRUE;
@@ -733,6 +774,11 @@ SilcBool silc_schedule_task_del_by_fd(SilcSchedule schedule, SilcUInt32 fd)
                                       (void *)&task))) {
     SILC_LOG_DEBUG(("Deleting task %p", task));
     task->valid = FALSE;
+
+    /* Call notify callback */
+    if (schedule->notify)
+      schedule->notify(schedule, FALSE, task, TRUE, fd, 0, 0, 0,
+                      schedule->notify_context);
     ret = TRUE;
   }
 
@@ -766,6 +812,12 @@ SilcBool silc_schedule_task_del_by_callback(SilcSchedule schedule,
   while (silc_hash_table_get(&htl, NULL, (void *)&task)) {
     if (task->callback == callback) {
       task->valid = FALSE;
+
+      /* Call notify callback */
+      if (schedule->notify)
+       schedule->notify(schedule, FALSE, task, TRUE,
+                        ((SilcTaskFd)task)->fd, 0, 0, 0,
+                        schedule->notify_context);
       ret = TRUE;
     }
   }
@@ -777,6 +829,11 @@ SilcBool silc_schedule_task_del_by_callback(SilcSchedule schedule,
   while ((task = (SilcTask)silc_list_get(list))) {
     if (task->callback == callback) {
       task->valid = FALSE;
+
+      /* Call notify callback */
+      if (schedule->notify)
+       schedule->notify(schedule, FALSE, task, FALSE, 0, 0, 0, 0,
+                        schedule->notify_context);
       ret = TRUE;
     }
   }
@@ -805,6 +862,12 @@ SilcBool silc_schedule_task_del_by_context(SilcSchedule schedule,
   while (silc_hash_table_get(&htl, NULL, (void *)&task)) {
     if (task->context == context) {
       task->valid = FALSE;
+
+      /* Call notify callback */
+      if (schedule->notify)
+       schedule->notify(schedule, FALSE, task, TRUE,
+                        ((SilcTaskFd)task)->fd, 0, 0, 0,
+                        schedule->notify_context);
       ret = TRUE;
     }
   }
@@ -815,8 +878,13 @@ SilcBool silc_schedule_task_del_by_context(SilcSchedule schedule,
   silc_list_start(list);
   while ((task = (SilcTask)silc_list_get(list))) {
     if (task->context == context) {
-      ret = TRUE;
       task->valid = FALSE;
+
+      /* Call notify callback */
+      if (schedule->notify)
+       schedule->notify(schedule, FALSE, task, FALSE, 0, 0, 0, 0,
+                        schedule->notify_context);
+      ret = TRUE;
     }
   }
 
@@ -849,6 +917,11 @@ SilcBool silc_schedule_task_del_by_all(SilcSchedule schedule, int fd,
   while ((task = (SilcTask)silc_list_get(list))) {
     if (task->callback == callback && task->context == context) {
       task->valid = FALSE;
+
+      /* Call notify callback */
+      if (schedule->notify)
+       schedule->notify(schedule, FALSE, task, FALSE, 0, 0, 0, 0,
+                        schedule->notify_context);
       ret = TRUE;
     }
   }
@@ -883,6 +956,12 @@ SilcBool silc_schedule_set_listen_fd(SilcSchedule schedule, SilcUInt32 fd,
       task->revents = mask;
       silc_schedule_dispatch_fd(schedule);
     }
+
+    /* Call notify callback */
+    if (schedule->notify)
+      schedule->notify(schedule, TRUE, (SilcTask)task,
+                      TRUE, task->fd, mask, 0, 0,
+                      schedule->notify_context);
   }
 
   SILC_SCHEDULE_UNLOCK(schedule);
index e92bb830e45e989ad4e234c7d63227ff2f79206a..8c2154a5619e405f63df48f7dc8152307922124e 100644 (file)
@@ -158,6 +158,49 @@ typedef void (*SilcTaskCallback)(SilcSchedule schedule, void *app_context,
                                 SilcTaskEvent type, SilcUInt32 fd,
                                 void *context);
 
+/****f* silcutil/SilcScheduleAPI/SilcTaskNotifyCb
+ *
+ * SYNOPSIS
+ *
+ *    typedef void (*SilcTaskNotifyCb)(SilcSchedule schedule,
+ *                                     SilcBool added, SilcTask task,
+ *                                     SilcBool fd_task, SilcUInt32 fd,
+ *                                     SilcTaskEvent event,
+ *                                     long seconds, long useconds,
+ *                                     void *context);
+ *
+ * DESCRIPTION
+ *
+ *    Task notify callback.  Callback of this type can be set to scheduler
+ *    by calling silc_schedule_set_notify and will be called whenever new
+ *    task is added or old task is removed.  If `added' is TRUE then `task'
+ *    is added to scheduler.  If `added' is FALSE then `task' will be removed
+ *    from the scheduler.  If `fd_task' is TRUE the `task' is file descriptor
+ *    task and has `fd' is its file descriptor.  If `fd_task' is FALSE then
+ *    the task is timeout task and `seconds' and `useconds' specify the
+ *    timeout.  The `context' is the context given to silc_schedule_set_notify.
+ *
+ * NOTES
+ *
+ *    The `schedule' is locked while this callback is called.  This means that
+ *    new tasks cannot be added or removed inside this callback.
+ *
+ *    When timeout task expires this callback is not called.  This is called
+ *    only when task is explicitly deleted from the scheduler.  Note that,
+ *    when timeout task expires it is removed from the scheduler and `task'
+ *    will become invalid.
+ *
+ *    If fd task changes its events, this will be called as if it was a new
+ *    task with different `event' mask.
+ *
+ ***/
+typedef void (*SilcTaskNotifyCb)(SilcSchedule schedule,
+                                SilcBool added, SilcTask task,
+                                SilcBool fd_task, SilcUInt32 fd,
+                                SilcTaskEvent event,
+                                long seconds, long useconds,
+                                void *app_context);
+
 /* Macros */
 
 /****d* silcutil/SilcScheduleAPI/SILC_ALL_TASKS
@@ -184,8 +227,8 @@ typedef void (*SilcTaskCallback)(SilcSchedule schedule, void *app_context,
  *
  * DESCRIPTION
  *
- *    Generic macro to define task callback functions. This defines a
- *    static function with name `func' as a task callback function.
+ *    Generic macro to declare task callback functions. This defines a
+ *    function with name `func' as a task callback function.
  *
  * SOURCE
  */
@@ -335,6 +378,22 @@ void silc_schedule_wakeup(SilcSchedule schedule);
  ***/
 void *silc_schedule_get_context(SilcSchedule schedule);
 
+/****f* silcutil/SilcScheduleAPI/silc_schedule_set_notify
+ *
+ * SYNOPSIS
+ *
+ *    void silc_schedule_set_notify(SilcSchedule schedule,
+ *                                  SilcTaskNotifyCb notify, void *context);
+ *
+ * DESCRIPTION
+ *
+ *    Set notify callback to scheduler.  The `notify' will be called whenever
+ *    task is added to or deleted from scheduler.
+ *
+ ***/
+void silc_schedule_set_notify(SilcSchedule schedule,
+                             SilcTaskNotifyCb notify, void *context);
+
 /****f* silcutil/SilcScheduleAPI/silc_schedule_task_add_fd
  *
  * SYNOPSIS
@@ -374,7 +433,7 @@ void *silc_schedule_get_context(SilcSchedule schedule);
  *    Add timeout task to scheduler.  The `callback' will be called once
  *    the specified timeout has elapsed.  The task will be removed from the
  *    scheduler automatically once the task expires.  The event returned
- *    to the `callback' is SILC_TASK_EXPIRE.  The task added with zero (0)
+ *    to the `callback' is SILC_TASK_EXPIRE.  A task added with zero (0)
  *    timeout will be executed immediately next time tasks are scheduled.
  *
  ***/
index 3282990fdfd7de6ead8833362cca2e3e05f4fe35..61ea48125a0d96d374db7f2730fd8d95cd6a2adc 100644 (file)
@@ -74,6 +74,8 @@ typedef struct SilcTaskFdStruct {
 struct SilcScheduleStruct {
   void *internal;
   void *app_context;              /* Application specific context */
+  SilcTaskNotifyCb notify;        /* Notify callback */
+  void *notify_context;                   /* Notify context */
   SilcHashTable fd_queue;         /* FD task queue */
   SilcList fd_dispatch;                   /* Dispatched FDs */
   SilcList timeout_queue;         /* Timeout queue */
@@ -106,7 +108,8 @@ typedef struct {
      the wakeup mechanism of the scheduler.  In multi-threaded environment
      the scheduler needs to be wakenup when tasks are added or removed from
      the task queues.  Returns context to the platform specific scheduler.
-     If this returns NULL the scheduler initialization will fail. */
+     If this returns NULL the scheduler initialization will fail.  Do not
+     add FD tasks inside function.  Timeout tasks can be added. */
   void *(*init)(SilcSchedule schedule, void *app_context);
 
   /* Uninitializes the platform specific scheduler context. */
index b10bb600f3441c8b8bb8c1d51bf1d07e43df8a00..3543de2af26bf3ac91a35d7bff5f38bb7994abfd 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2003 - 2006 Pekka Riikonen
+  Copyright (C) 2003 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -48,6 +48,7 @@
  *
  * The data stack is not thread-safe.  If the same stack context must be
  * used in multithreaded environment concurrency control must be employed.
+ * Each thread should allocate their own SilcStack.
  *
  ***/
 
@@ -81,11 +82,11 @@ typedef struct SilcStackStruct *SilcStack;
  *    Static stack frame context that optionally can be used as stack
  *    frame in SilcStack.  By default silc_stack_push use pre-allocated
  *    stack frame (or allocates new one if all frames are reserved), but
- *    user may also use staticly allocated SilcStackFrame instead.  This
+ *    user may also use statically allocated SilcStackFrame instead.  This
  *    is recommended when using SilcStack in recursive routine and the
  *    recursion may become deep.  Using static frame assures that during
  *    recursion frames never run out and silc_stack_push never allocates
- *    any memory.  In other normal usage staticly allocated SilcStackFrame
+ *    any memory.  In other normal usage statically allocated SilcStackFrame
  *    is not needed, unless performance is critical.
  *
  ***/
@@ -142,10 +143,10 @@ void silc_stack_free(SilcStack stack);
  *    If this returns zero (0) the system is out of memory.
  *
  *    If the `frame' is non-NULL then that SilcStackFrame is used as
- *    stack frame.  Usually `frame' is set to NULL by user.  Staticly
+ *    stack frame.  Usually `frame' is set to NULL by user.  Statically
  *    allocated SilcStackFrame should be used when using silc_stack_push
  *    in recursive function and the recursion may become deep.  In this
- *    case using staticly allocated SilcStackFrame is recommended since
+ *    case using statically allocated SilcStackFrame is recommended since
  *    it assures that frames never run out and silc_stack_push never
  *    allocates any memory.  If your routine is not recursive then
  *    setting `frame' to NULL is recommended, unless performance is
@@ -169,8 +170,8 @@ void silc_stack_free(SilcStack stack);
  *    silc_foo_parse_packet(packet, stack);
  *    silc_stack_pop(stack);
  *
- *    Another example with recursion and using staticly allocated
- *    SilcStackFrame.  After popping the staticly allocated frame can
+ *    Another example with recursion and using statically allocated
+ *    SilcStackFrame.  After popping the statically allocated frame can
  *    be reused if necessary.
  *
  *    void silc_foo_this_function(SilcStack stack)
index 18ec3e94c889a648886ebaa47d394c1de904ddd1..b1716cc501f0c783042b34a4e2ceb6db16882324 100644 (file)
@@ -186,7 +186,7 @@ silc_stringprep(const unsigned char *bin, SilcUInt32 bin_len,
     f |= STRINGPREP_NO_UNASSIGNED;
 
   /* Prepare */
-  ret = stringprep((char *)utf8s, utf8s_len + 1, f, profile);
+  ret = stringprep((char *)utf8s, utf8s_len, f, profile);
   SILC_LOG_DEBUG(("stringprep() return %d", ret));
 
   /* Since the stringprep() doesn't allocate returned buffer, and
@@ -194,10 +194,10 @@ silc_stringprep(const unsigned char *bin, SilcUInt32 bin_len,
      much space we must have for the conversion.  Allocate more if it
      fails, and try again. */
   if (ret == STRINGPREP_TOO_SMALL_BUFFER) {
-    utf8s = silc_realloc(utf8s, sizeof(*utf8s) * (utf8s_len * 2));
+    utf8s = silc_realloc(utf8s, sizeof(*utf8s) * ((utf8s_len * 2) + 1));
     if (!utf8s)
       return SILC_STRINGPREP_ERR_OUT_OF_MEMORY;
-    memset(utf8s + utf8s_len, 0, utf8s_len);
+    memset(utf8s + utf8s_len + 1, 0, utf8s_len);
     ret = stringprep((char *)utf8s, utf8s_len * 2, f, profile);
     SILC_LOG_DEBUG(("stringprep() return %d", ret));
   }
index 6dc321d690b56e4875afdcc6f93eec07ab1fa337..639724c4f9d503cfcd8e4b5d2a482aaa21523029 100644 (file)
@@ -69,7 +69,8 @@ SilcInt64 silc_time_msec(void)
 {
   struct timeval curtime;
   silc_gettimeofday(&curtime);
-  return (curtime.tv_sec * 1000) + (curtime.tv_usec / 1000);
+  return (curtime.tv_sec * (SilcUInt64)1000) +
+    (curtime.tv_usec / (SilcUInt64)1000);
 }
 
 /* Return time since Epoch in microseconds */
@@ -78,7 +79,7 @@ SilcInt64 silc_time_usec(void)
 {
   struct timeval curtime;
   silc_gettimeofday(&curtime);
-  return (curtime.tv_sec * 1000000) + curtime.tv_usec;
+  return (curtime.tv_sec * (SilcUInt64)1000000) + curtime.tv_usec;
 }
 
 /* Returns time as string */
@@ -104,9 +105,10 @@ const char *silc_time_string(SilcInt64 time_val)
 
 SilcBool silc_time_value(SilcInt64 time_val, SilcTime ret_time)
 {
-  struct tm *time;
+  struct tm *t;
   unsigned int msec = 0;
   time_t timeval;
+  SilcInt32 ctz = 0;
 
   if (!ret_time)
     return TRUE;
@@ -117,17 +119,18 @@ SilcBool silc_time_value(SilcInt64 time_val, SilcTime ret_time)
   msec = (SilcUInt64)time_val % (SilcUInt64)1000;
   timeval = (time_t)((SilcUInt64)time_val / (SilcUInt64)1000);
 
-  time = localtime(&timeval);
-  if (!time)
+  t = localtime(&timeval);
+  if (!t)
     return FALSE;
 
   memset(ret_time, 0, sizeof(*ret_time));
-  if (!silc_time_fill(ret_time, time->tm_year + 1900, time->tm_mon + 1,
-                     time->tm_mday, time->tm_hour, time->tm_min,
-                     time->tm_sec, msec))
+  if (!silc_time_fill(ret_time, t->tm_year + 1900, t->tm_mon + 1,
+                     t->tm_mday, t->tm_hour, t->tm_min,
+                     t->tm_sec, msec))
     return FALSE;
 
-  ret_time->dst        = time->tm_isdst ? 1 : 0;
+  ret_time->dst        = t->tm_isdst ? 1 : 0;
+
 #ifdef SILC_WIN32
   ret_time->utc_east   = _timezone < 0 ? 1 : 0;
   ret_time->utc_hour   = (ret_time->utc_east ? (-(_timezone)) / 3600 :
@@ -135,15 +138,29 @@ SilcBool silc_time_value(SilcInt64 time_val, SilcTime ret_time)
   ret_time->utc_minute = (ret_time->utc_east ? (-(_timezone)) % 3600 :
                          _timezone % 3600);
 #else
-#if defined(HAVE_TZSET)
+#if defined(HAVE_TIMEZONE)
   ret_time->utc_east   = timezone < 0 ? 1 : 0;
-  ret_time->utc_hour   = (ret_time->utc_east ? (-(timezone)) / 3600 :
-                         timezone / 3600);
-  ret_time->utc_minute = (ret_time->utc_east ? (-(timezone)) % 3600 :
-                         timezone % 3600);
-#endif /* HAVE_TZSET */
+  ctz = timezone;
+  if (ret_time->dst)
+    ctz -= 3600;
+#elif defined(HAVE_TM_GMTOFF)
+  ret_time->utc_east   = t->tm_gmtoff > 0 ? 1 : 0;
+  ctz = -t->tm_gmtoff;
+#elif defined(HAVE___TM_GMTOFF)
+  ret_time->utc_east   = t->__tm_gmtoff > 0 ? 1 : 0;
+  ctz = -t->__tm_gmtoff;
+#elif defined(HAVE___TM_GMTOFF__)
+  ret_time->utc_east   = t->__tm_gmtoff__ > 0 ? 1 : 0;
+  ctz = -t->__tm_gmtoff__;
+#endif /* HAVE_TIMEZONE */
+
+  ret_time->utc_hour   = (ret_time->utc_east ? (-(ctz)) / 3600 : ctz / 3600);
+  ret_time->utc_minute = (ret_time->utc_east ? (-(ctz)) % 3600 : ctz % 3600);
 #endif /* SILC_WIN32 */
 
+  if (ret_time->utc_minute)
+    ret_time->utc_minute /= 60;
+
   return TRUE;
 }
 
index 1eecca1dea8b62b4aa6432ea99cb9e999c64d418..9f335e44258dffe481751c37de03a3fb05a2a61d 100644 (file)
@@ -152,6 +152,8 @@ void silc_st_free(void *ptr, const char *file, int line)
     st_blocks = stack->next;
 
   st_blocks_count--;
+
+  memset(stack, 'F', SILC_ST_GET_SIZE(stack->size));
   free(stack);
 }
 
index 5a6824ccac31003556908d9e877b9bc03110ea2d..204f632fede304c8f21b84d09621f418399ff2fc 100644 (file)
@@ -13,6 +13,15 @@ typedef void (*Callback)(void *context);
 
 SilcSchedule schedule;
 
+void notify_cb(SilcSchedule schedule, SilcBool added, SilcTask task,
+              SilcBool fd_task, SilcUInt32 fd, long sec, long usec,
+              void *context)
+{
+  SILC_LOG_DEBUG(("Notify cb, %s %s task, fd %d, sec %d usec %d",
+                 added ? "added" : "deleted", fd_task ? "fd" :"timeout",
+                 fd, sec, usec));
+}
+
 SILC_TASK_CALLBACK(foo)
 {
 
@@ -92,6 +101,7 @@ int main(int argc, char **argv)
   schedule = silc_schedule_init(NUM_FTASK, NULL);
   if (!schedule)
     goto err;
+  silc_schedule_set_notify(schedule, notify_cb, NULL);
 
   silc_schedule_task_add_signal(schedule, SIGINT, interrupt, NULL);
 
index 0bbe28148b984418275cc4fee8602441da8e9ba5..bcfa713ebd44e839aafd8f978d19a9d060023858 100644 (file)
@@ -22,6 +22,7 @@ int main(int argc, char **argv)
   SILC_LOG_DEBUG(("day       : %d", curtime.day));
   SILC_LOG_DEBUG(("hour      : %d", curtime.hour));
   SILC_LOG_DEBUG(("minute    : %d", curtime.minute));
+  SILC_LOG_DEBUG(("second    : %d", curtime.second));
   SILC_LOG_DEBUG(("msecond   : %d", curtime.msecond));
   SILC_LOG_DEBUG(("utc_hour  : %d", curtime.utc_hour));
   SILC_LOG_DEBUG(("utc_min   : %d", curtime.utc_minute));
index 706af5c0421ae0236977f58100987542b19be2ae..e0befdc19979ca325a83cd39b6da9015e34a28f8 100644 (file)
@@ -164,8 +164,8 @@ silc_net_tcp_create_listener(const char **local_ip_addr,
 
   /* Bind to local addresses */
   for (i = 0; i < local_ip_count; i++) {
-    SILC_LOG_DEBUG(("Binding to local address %s",
-                   local_ip_addr ? local_ip_addr[i] : ipany));
+    SILC_LOG_DEBUG(("Binding to local address %s:%d",
+                   local_ip_addr ? local_ip_addr[i] : ipany, port));
 
     /* Set sockaddr for server */
     if (!silc_net_set_sockaddr(&server,
@@ -628,20 +628,20 @@ SILC_FSM_STATE(silc_net_connect_st_connected)
     }
 
 #if defined(ECONNREFUSED)
-    if (errno == ECONNREFUSED)
+    if (opt == ECONNREFUSED)
       conn->status = SILC_NET_CONNECTION_REFUSED;
 #endif /* ECONNREFUSED */
 #if defined(ETIMEDOUT)
-    if (errno == ETIMEDOUT)
+    if (opt == ETIMEDOUT)
       conn->status = SILC_NET_CONNECTION_TIMEOUT;
 #endif /* ETIMEDOUT */
 #if defined(ENETUNREACH)
-    if (errno == ENETUNREACH)
+    if (opt == ENETUNREACH)
       conn->status = SILC_NET_HOST_UNREACHABLE;
 #endif /* ENETUNREACH */
 
     /** Connecting failed */
-    SILC_LOG_DEBUG(("Connecting failed"));
+    SILC_LOG_DEBUG(("Connecting failed, error %s", strerror(opt)));
     silc_fsm_next(fsm, silc_net_connect_st_finish);
     return SILC_FSM_CONTINUE;
   }
index 579af8bf776ccda5967b48bfce6b952465a1e79d..137d52def8d784e8ddd55dc69f2fd6a661fe81b2 100644 (file)
@@ -271,7 +271,7 @@ SilcBool silc_schedule_internal_schedule_fd(SilcSchedule schedule,
 
   SILC_LOG_DEBUG(("Scheduling fd %lu, mask %x", task->fd, event_mask));
 
-  event.events = 0;
+  memset(&event, 0, sizeof(event));
   if (event_mask & SILC_TASK_READ)
     event.events |= (EPOLLIN | EPOLLPRI);
   if (event_mask & SILC_TASK_WRITE)
@@ -316,9 +316,26 @@ SILC_TASK_CALLBACK(silc_schedule_wakeup_cb)
 
   SILC_LOG_DEBUG(("Wokeup"));
 
-  read(internal->wakeup_pipe[0], &c, 1);
+  (void)read(internal->wakeup_pipe[0], &c, 1);
 }
 
+SILC_TASK_CALLBACK(silc_schedule_wakeup_init)
+{
+  SilcUnixScheduler internal = schedule->internal;
+
+  internal->wakeup_task =
+    silc_schedule_task_add(schedule, internal->wakeup_pipe[0],
+                          silc_schedule_wakeup_cb, internal,
+                          0, 0, SILC_TASK_FD);
+  if (!internal->wakeup_task) {
+    SILC_LOG_WARNING(("Could not add a wakeup task, threads won't work"));
+    close(internal->wakeup_pipe[0]);
+    return;
+  }
+  silc_schedule_internal_schedule_fd(schedule, internal,
+                                    (SilcTaskFd)internal->wakeup_task,
+                                    SILC_TASK_READ);
+}
 #endif /* SILC_THREADS */
 
 /* Initializes the platform specific scheduler.  This for example initializes
@@ -376,20 +393,8 @@ void *silc_schedule_internal_init(SilcSchedule schedule,
     return NULL;
   }
 
-  internal->wakeup_task =
-    silc_schedule_task_add(schedule, internal->wakeup_pipe[0],
-                          silc_schedule_wakeup_cb, internal,
-                          0, 0, SILC_TASK_FD);
-  if (!internal->wakeup_task) {
-    SILC_LOG_ERROR(("Could not add a wakeup task, threads won't work"));
-    close(internal->wakeup_pipe[0]);
-    close(internal->wakeup_pipe[1]);
-    silc_free(internal);
-    return NULL;
-  }
-  silc_schedule_internal_schedule_fd(schedule, internal,
-                                    (SilcTaskFd)internal->wakeup_task,
-                                    SILC_TASK_READ);
+  silc_schedule_task_add_timeout(schedule, silc_schedule_wakeup_init,
+                                internal, 0, 0);
 #endif /* SILC_THREADS */
 
   internal->app_context = app_context;
@@ -444,7 +449,7 @@ void silc_schedule_internal_wakeup(SilcSchedule schedule, void *context)
 
   SILC_LOG_DEBUG(("Wakeup"));
 
-  write(internal->wakeup_pipe[1], "!", 1);
+  (void)write(internal->wakeup_pipe[1], "!", 1);
 #endif
 }
 
@@ -454,6 +459,8 @@ static void silc_schedule_internal_sighandler(int signal)
 {
   int i;
 
+  SILC_LOG_DEBUG(("Start"));
+
   for (i = 0; i < SIGNAL_COUNT; i++) {
     if (signal_call[i].sig == signal) {
       signal_call[i].call = TRUE;
@@ -543,11 +550,13 @@ void silc_schedule_internal_signals_call(SilcSchedule schedule, void *context)
         signal_call[i].callback) {
       SILC_LOG_DEBUG(("Calling signal %d callback",
                      signal_call[i].sig));
+      silc_schedule_internal_signals_unblock(schedule, context);
       signal_call[i].callback(schedule, internal->app_context,
                              SILC_TASK_INTERRUPT,
                              signal_call[i].sig,
                              signal_call[i].context);
       signal_call[i].call = FALSE;
+      silc_schedule_internal_signals_block(schedule, context);
     }
   }
 
index fbfb0da254c697596f9f2c4ee75fbbaf52c47bac..bd551c2990ac4e5a449c7e38ec686c4f80aa705a 100644 (file)
@@ -144,8 +144,7 @@ void silc_mutex_lock(SilcMutex mutex)
 {
 #ifdef SILC_THREADS
   if (mutex) {
-    if (pthread_mutex_lock(&mutex->mutex))
-      SILC_ASSERT(FALSE);
+    SILC_VERIFY(pthread_mutex_lock(&mutex->mutex) == 0);
     mutex->locked = TRUE;
   }
 #endif /* SILC_THREADS */
@@ -155,8 +154,7 @@ void silc_mutex_unlock(SilcMutex mutex)
 {
 #ifdef SILC_THREADS
   if (mutex) {
-    if (pthread_mutex_unlock(&mutex->mutex))
-      SILC_ASSERT(FALSE);
+    SILC_VERIFY(pthread_mutex_unlock(&mutex->mutex) == 0);
     mutex->locked = FALSE;
   }
 #endif /* SILC_THREADS */
@@ -166,7 +164,7 @@ void silc_mutex_assert_locked(SilcMutex mutex)
 {
 #ifdef SILC_THREADS
   if (mutex)
-    SILC_ASSERT(mutex->locked);
+    SILC_VERIFY(mutex->locked);
 #endif /* SILC_THREADS */
 }
 
@@ -216,7 +214,7 @@ void silc_rwlock_wrlock(SilcRwLock rwlock)
 {
 #ifdef SILC_THREADS
   if (rwlock)
-    pthread_rwlock_wrlock(&rwlock->rwlock);
+    SILC_VERIFY(pthread_rwlock_wrlock(&rwlock->rwlock) == 0);
 #endif /* SILC_THREADS */
 }
 
@@ -224,7 +222,7 @@ void silc_rwlock_unlock(SilcRwLock rwlock)
 {
 #ifdef SILC_THREADS
   if (rwlock)
-    pthread_rwlock_unlock(&rwlock->rwlock);
+    SILC_VERIFY(pthread_rwlock_unlock(&rwlock->rwlock) == 0);
 #endif /* SILC_THREADS */
 }
 
index b425a7916a7b5f7bf4d0e130ee61e0e914a8f71c..f7c8535802ddddc913c5e64d2466cf95ea619094 100644 (file)
@@ -43,7 +43,7 @@
 
 <table border="0" cellspacing="0" cellpadding="6" width="100%">
  <tr valign="top" bgcolor="#dddddd">
-  <td><small>Copyright &copy; 2001 - 2005 SILC Project<br />
+  <td><small>Copyright &copy; 2001 - 2007 SILC Project<br />
     <a href="http://silcnet.org">SILC Project Website</a></small></td>
   <td align="right"><small>
    <a href="index.html">SILC Toolkit Reference Manual</a><br />
@@ -121,7 +121,7 @@ if ($type == 0) {
 </table>
 <table border="0" cellspacing="0" cellpadding="6" width="100%">
  <tr valign="top" bgcolor="#dddddd">
-  <td><small>Copyright &copy; 2001 - 2005 SILC Project<br />
+  <td><small>Copyright &copy; 2001 - 2007 SILC Project<br />
     <a href="http://silcnet.org">SILC Project Website</a></small></td>
   <td align="right"><small>
    <a href="index.html">SILC Toolkit Reference Manual</a><br />
diff --git a/silc-toolkit.spec.in b/silc-toolkit.spec.in
new file mode 100644 (file)
index 0000000..ea620ba
--- /dev/null
@@ -0,0 +1,107 @@
+Summary: SILC Toolkit
+Name: silc-toolkit
+Version: SILC_VERSION
+Release: SILC_RELEASE
+License: GPL/BSD dual licensed
+Group: System Environment/Libraries
+URL: http://silcnet.org/
+Source0: silc-toolkit-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+BuildRequires: pkgconfig
+Obsoletes: libsilc
+Obsoletes: libsilc-devel
+Obsoletes: libsilc-doc
+Provides: libsilc
+Provides: libsilc-devel
+Provides: libsilc-doc
+Epoch: 0
+
+%description
+SILC Toolkit providing SILC Protocol Core Library, SILC Client Library,
+runtime library and many other libraries.  SILC Toolkit enables SILC
+application development.  SILC (Secure Internet Live Conferencing) is a
+secure conferencing protocol.
+
+%package devel
+Group: Development/Libraries
+Summary: SILC Toolkit providing headers, libraries and documentation
+Requires: silc-toolkit = %{epoch}:%{version}-%{release}
+Requires: pkgconfig
+
+%description devel
+The SILC Toolkit development libraries, headers and documentation.  SILC
+Toolkit enables SILC application development.
+
+%prep
+%setup -q -n silc-toolkit-%{version}
+
+%build
+%configure --libdir=%{_libdir} \
+           --includedir=%{_includedir}/silc \
+           --with-simdir=%{_libdir}/silc/modules \
+           --docdir=%{_docdir}/%{name}-%{version}
+make -j4
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make DESTDIR=$RPM_BUILD_ROOT install
+chmod 0755 ${RPM_BUILD_ROOT}%{_libdir}/lib*
+chmod 0755 ${RPM_BUILD_ROOT}%{_libdir}/silc/modules/*.so
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(0755, root, root, 0755)
+%{_libdir}/libsilc-1.1.so*
+%{_libdir}/libsilcclient-1.1.so*
+%dir %_libdir/silc
+%dir %_libdir/silc/modules
+%{_libdir}/silc/modules/*.so
+%defattr(0644, root, root, 0755)
+%doc CHANGES COPYING GPL BSD
+
+%files devel
+%defattr(0644, root, root, 0755)
+%doc CHANGES COPYING GPL BSD doc/toolkit
+%{_libdir}/libsilc.so
+%{_libdir}/libsilc.*a
+%{_libdir}/libsilcclient.so
+%{_libdir}/libsilcclient.*a
+%{_libdir}/pkgconfig/silc.pc
+%{_libdir}/pkgconfig/silcclient.pc
+%dir %_includedir/silc
+%{_includedir}/silc/*.h
+
+%changelog
+* Wed May 30 2007 Pekka Riikonen <priikone@silcnet.org>
+- Rewrote .spec for SILC Toolkit 1.1.  Obsoletes libsilc.  Renamed to
+  silc-toolkit.
+
+* Tue Sep 1 2004 Toni Willberg <toniw@iki.fi>
+- 0.9.12-0.fdr.6 - Had to remove smp_mflags because build fails with them
+  (Michael Schwendt)
+
+* Tue Aug 31 2004 Toni Willberg <toniw@iki.fi>
+- 0.9.12-0.fdr.5 - corrections to lib and include path (from Michael Schwendt)
+
+* Tue Aug 31 2004 Toni Willberg <toniw@iki.fi>
+- 0.9.12-0.fdr.4 - post/postun /sbin/ldconfig
+  (Patch 823 from Stu Tomlinson)
+
+* Tue Aug 31 2004 Toni Willberg <toniw@iki.fi>
+- 0.9.12-0.fdr.3 - Move libs to %{_libdir} and add a silc.pc
+  (Patch 815 from Stu Tomlinson)
+
+* Tue Aug 17 2004 Toni Willberg <toniw@iki.fi>
+- fix so permissions and hardcoded paths (patch from Michael Schwendt)
+
+* Mon Jul 5 2004 Toni Willberg <toniw@iki.fi>
+- Fixed various errors
+
+* Sun Jul 4 2004 Toni Willberg <toniw@iki.fi>
+- Initial version for Fedora
index a72522928c14cb340fcd6d062d63186c58caefcd..4e2169b29add2ce7f94e001b0d712ee257f6d9bf 100644 (file)
@@ -8,4 +8,3 @@ silcclient.mmp
 silcclient_static.mmp\r
 \r
 PRJ_TESTMMPFILES\r
-test_silcnet.mmp\r
index c1b02bd2badafa9c3926622021715fb42f0e01df..7e0582b3a5d06ff617a8c2f9d70b3abeae1dbe3e 100644 (file)
@@ -17,7 +17,7 @@ SOURCE silcasn1.c silcasn1_decode.c silcasn1_encode.c silcber.c
 SOURCEPATH ..\lib\silccore\r
 SOURCE silcargument.c silcattrs.c silcauth.c silcchannel.c silccommand.c silcid.c silcmessage.c silcnotify.c silcpacket.c silcpubkey.c silcstatus.c\r
 SOURCEPATH ..\lib\silccrypt\r
-SOURCE aes.c blowfish.c cast.c md5.c none.c rc5.c rsa.c sha1.c sha256.c silccipher.c silchash.c silchmac.c silcpk.c silcpkcs.c silcpkcs1.c silcrng.c twofish.c\r
+SOURCE aes.c blowfish.c md5.c none.c rsa.c sha1.c sha256.c silccipher.c silchash.c silchmac.c silcpk.c silcpkcs.c silcpkcs1.c silcrng.c twofish.c\r
 SOURCEPATH ..\lib\silchttp\r
 SOURCE silchttpserver.c\r
 SOURCEPATH ..\lib\silcmath\r
index 55ded7c27300dd0aac5d38db578e22922fe5bd87..946bc43f8bbf95bd09b330ec22c41ea4353010b4 100644 (file)
@@ -17,7 +17,7 @@ SOURCE silcasn1.c silcasn1_decode.c silcasn1_encode.c silcber.c
 SOURCEPATH ..\lib\silccore\r
 SOURCE silcargument.c silcattrs.c silcauth.c silcchannel.c silccommand.c silcid.c silcmessage.c silcnotify.c silcpacket.c silcpubkey.c silcstatus.c\r
 SOURCEPATH ..\lib\silccrypt\r
-SOURCE aes.c blowfish.c cast.c md5.c none.c rc5.c rsa.c sha1.c sha256.c silccipher.c silchash.c silchmac.c silcpk.c silcpkcs.c silcpkcs1.c silcrng.c twofish.c\r
+SOURCE aes.c blowfish.c md5.c none.c rsa.c sha1.c sha256.c silccipher.c silchash.c silchmac.c silcpk.c silcpkcs.c silcpkcs1.c silcrng.c twofish.c\r
 SOURCEPATH ..\lib\silchttp\r
 SOURCE silchttpserver.c\r
 SOURCEPATH ..\lib\silcmath\r
index 4cda00a69c9527323cf161d6d7ac573942bfd3a6..445e1af794c8da0ff6cf3b4a8499d9d4a598384f 100644 (file)
@@ -17,7 +17,7 @@
 
 AUTOMAKE_OPTIONS = 1.0 no-dependencies foreign
 
-CFLAGS = $(INCLUDES) $(SILC_COMMON_LIBS) $(LDFLAGS)
+CFLAGS = $(INCLUDES) $(SILC_COMMON_LDFLAGS) $(SILC_COMMON_LIBS) $(LDFLAGS)
 SOURCES = mybot.c
 
 all: mybot
index 6e689d061cb106239301ed1a5f60d76a15abfcef..02b52a2ae9dcb37c348a809a64966d4ffddaf9a2 100644 (file)
@@ -1,8 +1,8 @@
 /*
 
-  mybot.c 
+  mybot.c
 
-  Author: Pekka Riikonen <priikone@silcnet.org>, November 2002
+  Author: Pekka Riikonen <priikone@silcnet.org>, November 2002, 2007
   This code is Public Domain.
 
   MyBot
   gcc -o mybot mybot.c -I/usr/local/silc/include -L/usr/local/silc/lib \
       -lsilc -lsilcclient -lpthread -ldl
 
-  The MyBot works as follows (logicly):
-
-  main -> mybot_start -> silc_client_connect_to_server
-                v
-          silc_client_run (message loop...)
-                v
-          silc_verify_public_key
-                v
-          silc_get_auth_method
-                v
-          silc_connected -> silc_client_command_call (JOIN)
-                v
-          silc_command_reply -> silc_send_channel_message ("hello")
-                v
-          message loop...
-                v
-  main <- mybot_start
-
 */
 
 #include "silc.h"              /* Mandatory include for SILC applications */
 
 SilcClientOperations ops;
 
+static void silc_running(SilcClient client, void *application);
+static void silc_stopped(SilcClient client, void *context);
+
 /******* MyBot code **********************************************************/
 
 /* This is context for our MyBot client */
 typedef struct {
   SilcClient client;           /* The actual SILC Client */
   SilcClientConnection conn;   /* Connection to the server */
+  SilcPublicKey public_key;     /* My public key */
+  SilcPrivateKey private_key;   /* My private key */
 } *MyBot;
 
+/* Connect callback called after connected to remote server. */
+
+static void
+silc_connected(SilcClient client, SilcClientConnection conn,
+              SilcClientConnectionStatus status,
+              SilcStatus error, const char *message,
+              void *context)
+{
+  MyBot mybot = client->application;
+
+  if (status == SILC_CLIENT_CONN_DISCONNECTED) {
+    SILC_LOG_DEBUG(("Disconnected %s", message ? message : ""));
+    silc_client_stop(client, silc_stopped, mybot);
+    return;
+  }
+
+  if (status != SILC_CLIENT_CONN_SUCCESS &&
+      status != SILC_CLIENT_CONN_SUCCESS_RESUME) {
+    SILC_LOG_DEBUG(("Error connecting to server %d", status));
+    silc_client_stop(client, silc_stopped, mybot);
+    return;
+  }
+
+  fprintf(stdout, "\nMyBot: Connected to server\n\n");
+
+  /* Now that we have connected to server, let's join a channel named
+     "mybot". */
+  silc_client_command_call(client, conn, "JOIN mybot");
+
+  /* Save the connection context */
+  mybot->conn = conn;
+}
+
+/* Running callback given to silc_client_init called to indicate that the
+   Client Library is running.  After this Client API functions can be
+   called. */
+
+static void silc_running(SilcClient client, void *application)
+{
+  MyBot mybot = application;
+
+  SILC_LOG_DEBUG(("Client is running"));
+
+  /* Connect to server.  The silc_connected callback will be called after
+     the connection is established or if an error occurs during connecting. */
+  silc_client_connect_to_server(mybot->client, NULL,
+                               mybot->public_key, mybot->private_key,
+                               "silc.silcnet.org", 706,
+                               silc_connected, mybot);
+}
+
+/* Client stopped callback given to silc_client_stop.  Called to indicate
+   that Client Library is stopped. */
+
+static void silc_stopped(SilcClient client, void *context)
+{
+  SILC_LOG_DEBUG(("Client stopped"));
+}
+
 /* Start the MyBot, by creating the SILC Client entity by using the
    SILC Client Library API. */
 int mybot_start(void)
 {
   MyBot mybot;
+  SilcClientParams params;
 
   /* Allocate the MyBot structure */
   mybot = silc_calloc(1, sizeof(*mybot));
@@ -65,60 +112,36 @@ int mybot_start(void)
     return 1;
   }
 
-  /* Allocate our SILC Client which is the MyBot.  The arguments to the
-     function are:
-
-     ops           - our client operations that the library requires
-     param         - parameters, but we don't have any so we pass NULL,
-     application   - our application, ie. the MyBot of course!
-     version       - silc version, provided by the library if we put NULL
-  */
-  mybot->client = silc_client_alloc(&ops, NULL, mybot, NULL);
+  memset(&params, 0, sizeof(params));
+  params.threads = TRUE;
+  mybot->client = silc_client_alloc(&ops, &params, mybot, NULL);
   if (!mybot->client) {
     perror("Could not allocate SILC Client");
     return 1;
   }
 
-  /* Now fill the allocated client with mandatory parameters the library
-     requires: username, hostname and "real name". */
-  mybot->client->username = silc_get_username();
-  mybot->client->hostname = silc_net_localhost();
-  mybot->client->realname = strdup("I am the MyBot");
-
   /* Now we initialize the client. */
-  if (!silc_client_init(mybot->client)) {
+  if (!silc_client_init(mybot->client, silc_get_username(),
+                       silc_net_localhost(), "I am the MyBot",
+                       silc_running, mybot)) {
     perror("Could not init client");
     return 1;
   }
 
-  /* Then we load our public key from the file.  The library requires
-     the key pair loaded before the client is started.  The SILC Toolkit
-     provides nice routines to do just that so we don't have to worry
-     about much.
-
-     Oh, and if the key pair doesn't exist, we create one here
-     automatically, and save them to files for future. */
   if (!silc_load_key_pair("mybot.pub", "mybot.prv", "",
-                         &mybot->client->pkcs,
-                         &mybot->client->public_key,
-                         &mybot->client->private_key)) {
+                         &mybot->public_key,
+                         &mybot->private_key)) {
     /* The keys don't exist.  Let's generate us a key pair then!  There's
        nice ready routine for that too.  Let's do 2048 bit RSA key pair. */
     fprintf(stdout, "MyBot: Key pair does not exist, generating it.\n");
     if (!silc_create_key_pair("rsa", 2048, "mybot.pub", "mybot.prv", NULL, "",
-                             &mybot->client->pkcs,
-                             &mybot->client->public_key,
-                             &mybot->client->private_key, FALSE)) {
+                             &mybot->public_key,
+                             &mybot->private_key, FALSE)) {
       perror("Could not generated key pair");
       return 1;
     }
   }
 
-  /* Start connecting to server.  This is asynchronous connecting so the
-     connection is actually created later after we run the client. */
-  silc_client_connect_to_server(mybot->client, NULL, 706,
-                               "silc.silcnet.org", mybot);
-
   /* And, then we are ready to go.  Since we are really simple client we
      don't have user interface and we don't have to deal with message loops
      or interactivity.  That's why we can just hand over the execution
@@ -181,7 +204,7 @@ silc_channel_message(SilcClient client, SilcClientConnection conn,
 
 
 /* Private message to the client. The `sender' is the sender of the
-   message. The message is `message'and maybe NULL.  The `flags'  
+   message. The message is `message'and maybe NULL.  The `flags'
    indicates message flags  and it is used to determine how the message
    can be interpreted (like it may tell the message is multimedia
    message). */
@@ -252,8 +275,8 @@ silc_notify(SilcClient client, SilcClientConnection conn,
 
 static void
 silc_command(SilcClient client, SilcClientConnection conn,
-            SilcClientCommandContext cmd_context, bool success,
-            SilcCommand command, SilcStatus status)
+            SilcBool success, SilcCommand command, SilcStatus status,
+            SilcUInt32 argc, unsigned char **argv)
 {
   /* If error occurred in client library with our command, print the error */
   if (status != SILC_STATUS_OK)
@@ -282,92 +305,44 @@ silc_command(SilcClient client, SilcClientConnection conn,
 
 static void
 silc_command_reply(SilcClient client, SilcClientConnection conn,
-                  SilcCommandPayload cmd_payload, bool success,
-                  SilcCommand command, SilcStatus status, ...)
+                  SilcCommand command, SilcStatus status,
+                  SilcStatus error, va_list ap)
 {
-  va_list va;
-
   /* If error occurred in client library with our command, print the error */
   if (status != SILC_STATUS_OK)
     fprintf(stderr, "MyBot: COMMAND REPLY %s: %s\n",
            silc_get_command_name(command),
            silc_get_status_message(status));
 
-  va_start(va, status);
-
-  /* Check for successful JOIN */
+  /* Check for successful JOIN.  See
+     http://silcnet.org/docs/toolkit/command_reply_args.html for the
+     different arguments the client library returns. */
   if (command == SILC_COMMAND_JOIN) {
     SilcChannelEntry channel;
+    SilcHash sha1hash;
 
-    (void)va_arg(va, SilcClientEntry);
-    channel = va_arg(va, SilcChannelEntry);
+    (void)va_arg(ap, SilcClientEntry);
+    channel = va_arg(ap, SilcChannelEntry);
 
     fprintf(stdout, "MyBot: Joined '%s' channel\n", channel->channel_name);
 
     /* Now send the "hello" to the channel */
-    silc_client_send_channel_message(client, conn, channel, NULL, 0,
-                                    "hello", strlen("hello"), FALSE);
+    silc_client_send_channel_message(client, conn, channel, NULL, 0, NULL,
+                                    "hello", strlen("hello"));
     fprintf(stdout, "MyBot: Sent 'hello' to channel\n");
 
-    /* Now send digitally signed "hello" to the channel */
+    /* Now send digitally signed "hello" to the channel.  We have to allocate
+       hash function for the signature process. */
+    silc_hash_alloc("sha1", &sha1hash);
     silc_client_send_channel_message(client, conn, channel, NULL,
-                                    SILC_MESSAGE_FLAG_SIGNED,
-                                    "hello, with signature", 
-                                    strlen("hello, with signature"), FALSE);
+                                    SILC_MESSAGE_FLAG_SIGNED, sha1hash,
+                                    "hello, with signature",
+                                    strlen("hello, with signature"));
+    silc_hash_free(sha1hash);
     fprintf(stdout, "MyBot: Sent 'hello, with signature' to channel\n");
   }
-
-  va_end(va);
 }
 
-
-/* Called to indicate that connection was either successfully established
-   or connecting failed.  This is also the first time application receives
-   the SilcClientConnection objecet which it should save somewhere.
-   If the `success' is FALSE the application must always call the function
-   silc_client_close_connection. */
-
-static void
-silc_connected(SilcClient client, SilcClientConnection conn,
-              SilcClientConnectionStatus status)
-{
-  MyBot mybot = client->application;
-  SilcBuffer idp;
-
-  if (status == SILC_CLIENT_CONN_ERROR) {
-    fprintf(stderr, "MyBot: Could not connect to server\n");
-    silc_client_close_connection(client, conn);
-    return;
-  }
-
-  fprintf(stdout, "MyBot: Connected to server.\n");
-
-  /* Save the connection context */
-  mybot->conn = conn;
-
-  /* Now that we are connected, join to mybot channel with JOIN command. */
-  silc_client_command_call(client, conn, "JOIN mybot");
-}
-
-
-/* Called to indicate that connection was disconnected to the server.
-   The `status' may tell the reason of the disconnection, and if the
-   `message' is non-NULL it may include the disconnection message
-   received from server. */
-
-static void
-silc_disconnected(SilcClient client, SilcClientConnection conn,
-                 SilcStatus status, const char *message)
-{
-  MyBot mybot = client->application;
-
-  /* We got disconnected from server */
-  mybot->conn = NULL;
-  fprintf(stdout, "MyBot: %s:%s\n", silc_get_status_message(status),
-         message);
-}
-
-
 /* Find authentication method and authentication data by hostname and
    port. The hostname may be IP address as well. When the authentication
    method has been resolved the `completion' callback with the found
@@ -377,13 +352,14 @@ silc_disconnected(SilcClient client, SilcClientConnection conn,
 static void
 silc_get_auth_method(SilcClient client, SilcClientConnection conn,
                     char *hostname, SilcUInt16 port,
+                    SilcAuthMethod auth_method,
                     SilcGetAuthMeth completion,
                     void *context)
 {
   /* MyBot assumes that there is no authentication requirement in the
      server and sends nothing as authentication.  We just reply with
      TRUE, meaning we know what is the authentication method. :). */
-  completion(TRUE, SILC_AUTH_NONE, NULL, 0, context);
+  completion(SILC_AUTH_NONE, NULL, 0, context);
 }
 
 
@@ -395,14 +371,12 @@ silc_get_auth_method(SilcClient client, SilcClientConnection conn,
 
 static void
 silc_verify_public_key(SilcClient client, SilcClientConnection conn,
-                      SilcSocketType conn_type, unsigned char *pk,
-                      SilcUInt32 pk_len, SilcSKEPKType pk_type,
+                      SilcConnectionType conn_type,
+                      SilcPublicKey public_key,
                       SilcVerifyPublicKey completion, void *context)
 {
-  /* MyBot is also very trusting, so we just accept the public key
-     we get here.  Of course, we would have to verify the authenticity
-     of the public key but our bot is too simple for that.  We just
-     reply with TRUE, meaning "yeah, we trust it". :) */
+  fprintf(stdout, "MyBot: server's public key\n");
+  silc_show_public_key(public_key);
   completion(TRUE, context);
 }
 
@@ -422,26 +396,6 @@ silc_ask_passphrase(SilcClient client, SilcClientConnection conn,
 }
 
 
-/* Notifies application that failure packet was received.  This is called
-   if there is some protocol active in the client.  The `protocol' is the
-   protocol context.  The `failure' is opaque pointer to the failure
-   indication.  Note, that the `failure' is protocol dependant and
-   application must explicitly cast it to correct type.  Usually `failure'
-   is 32 bit failure type (see protocol specs for all protocol failure
-   types). */
-
-static void
-silc_failure(SilcClient client, SilcClientConnection conn,
-            SilcProtocol protocol, void *failure)
-{
-  /* Well, something bad must have happened during connecting to the
-     server since we got here.  Let's just print that something failed.
-     The "failure" would include more information but let's not bother
-     with that now. */
-  fprintf(stderr, "MyBot: Connecting failed (protocol failure)\n");
-}
-
-
 /* Asks whether the user would like to perform the key agreement protocol.
    This is called after we have received an key agreement packet or an
    reply to our key agreement packet. This returns TRUE if the user wants
@@ -450,15 +404,13 @@ silc_failure(SilcClient client, SilcClientConnection conn,
    silc_client_perform_key_agreement). If TRUE is returned also the
    `completion' and `context' arguments must be set by the application. */
 
-static bool
+static void
 silc_key_agreement(SilcClient client, SilcClientConnection conn,
                   SilcClientEntry client_entry, const char *hostname,
-                  SilcUInt16 port, SilcKeyAgreementCallback *completion,
-                  void **context)
+                  SilcUInt16 protocol, SilcUInt16 port)
 {
   /* MyBot does not support incoming key agreement protocols, it's too
      simple for that. */
-  return FALSE;
 }
 
 
@@ -478,30 +430,6 @@ silc_ftp(SilcClient client, SilcClientConnection conn,
 }
 
 
-/* Delivers SILC session detachment data indicated by `detach_data' to the
-   application.  If application has issued SILC_COMMAND_DETACH command
-   the client session in the SILC network is not quit.  The client remains
-   in the network but is detached.  The detachment data may be used later
-   to resume the session in the SILC Network.  The appliation is
-   responsible of saving the `detach_data', to for example in a file.
-
-   The detachment data can be given as argument to the functions
-   silc_client_connect_to_server, or silc_client_add_connection when
-   creating connection to remote server, inside SilcClientConnectionParams
-   structure.  If it is provided the client library will attempt to resume
-   the session in the network.  After the connection is created
-   successfully, the application is responsible of setting the user
-   interface for user into the same state it was before detaching (showing
-   same channels, channel modes, etc).  It can do this by fetching the
-   information (like joined channels) from the client library. */
-
-static void
-silc_detach(SilcClient client, SilcClientConnection conn,
-           const unsigned char *detach_data, SilcUInt32 detach_data_len)
-{
-  /* Oh, and MyBot does not support session detaching either. */
-}
-
 /* Our client operations for the MyBot.  This structure is filled with
    functions and given as argument to the silc_client_alloc function.
    Even though our little bot does not need all these functions we must
@@ -515,19 +443,15 @@ SilcClientOperations ops = {
   silc_notify,
   silc_command,
   silc_command_reply,
-  silc_connected,
-  silc_disconnected,
   silc_get_auth_method,
   silc_verify_public_key,
   silc_ask_passphrase,
-  silc_failure,
   silc_key_agreement,
-  silc_ftp,
-  silc_detach
+  silc_ftp
 };
 
 int main(int argc, char **argv)
 {
-  /* Start the bot */
+  /* Start mybot */
   return mybot_start();
 }
index 216e130aa8f57f1de41b35570e79fce4740fd009..d7b97c5ab349638ce11f9bafc196260a0b4a1b8b 100644 (file)
-EXPORTS
-       silc_argument_get_arg_num @ 1 ;
-       silc_argument_get_arg_type @ 2 ;
-       silc_argument_get_decoded @ 3 ;
-       silc_argument_get_first_arg @ 4 ;
-       silc_argument_get_next_arg @ 5 ;
-       silc_argument_list_free @ 6 ;
-       silc_argument_list_parse @ 7 ;
-       silc_argument_list_parse_decoded @ 8 ;
-       silc_argument_payload_encode @ 9 ;
-       silc_argument_payload_encode_one @ 10 ;
-       silc_argument_payload_encode_payload @ 11 ;
-       silc_argument_payload_free @ 12 ;
-       silc_argument_payload_parse @ 13 ;
-       silc_command_get @ 14 ;
-       silc_command_get_args @ 15 ;
-       silc_command_get_ident @ 16 ;
-       silc_command_get_status @ 17 ;
-       silc_command_payload_encode @ 18 ;
-       silc_command_payload_encode_payload @ 19 ;
-       silc_command_payload_encode_va @ 20 ;
-       silc_command_payload_encode_vap @ 21 ;
-       silc_command_payload_free @ 22 ;
-       silc_command_payload_parse @ 23 ;
-       silc_command_reply_payload_encode_va @ 24 ;
-       silc_command_reply_payload_encode_vap @ 25 ;
-       silc_command_set_command @ 26 ;
-       silc_command_set_ident @ 27 ;
-       silc_auth_get_data @ 28 ;
-       silc_auth_get_method @ 29 ;
-       silc_auth_get_public_data @ 30 ;
-       silc_auth_payload_encode @ 31 ;
-       silc_auth_payload_free @ 32 ;
-       silc_auth_payload_parse @ 33 ;
-       silc_auth_public_key_auth_generate @ 34 ;
-       silc_auth_public_key_auth_generate_wpub @ 35 ;
-       silc_auth_public_key_auth_verify @ 36 ;
-       silc_auth_public_key_auth_verify_data @ 37 ;
-       silc_auth_verify @ 38 ;
-       silc_auth_verify_data @ 39 ;
-       silc_key_agreement_get_hostname @ 40 ;
-       silc_key_agreement_get_port @ 41 ;
-       silc_key_agreement_get_protocol @ 42 ;
-       silc_key_agreement_payload_encode @ 43 ;
-       silc_key_agreement_payload_free @ 44 ;
-       silc_key_agreement_payload_parse @ 45 ;
-       silc_id_dup @ 46 ;
-       silc_id_get_len @ 47 ;
-       silc_id_id2str @ 48 ;
-       silc_id_payload_encode @ 49 ;
-       silc_id_payload_encode_data @ 50 ;
-       silc_id_payload_free @ 51 ;
-       silc_id_payload_get_data @ 52 ;
-       silc_id_payload_get_id @ 53 ;
-       silc_id_payload_get_len @ 54 ;
-       silc_id_payload_get_type @ 55 ;
-       silc_id_payload_parse @ 56 ;
-       silc_id_payload_parse_id @ 57 ;
-       silc_id_str2id @ 58 ;
-       silc_id_str2id2 @ 59 ;
-       silc_attribute_get_attribute @ 60 ;
-       silc_attribute_get_data @ 61 ;
-       silc_attribute_get_flags @ 62 ;
-       silc_attribute_get_object @ 63 ;
-       silc_attribute_get_verify_data @ 64 ;
-       silc_attribute_payload_alloc @ 65 ;
-       silc_attribute_payload_encode @ 66 ;
-       silc_attribute_payload_encode_data @ 67 ;
-       silc_attribute_payload_free @ 68 ;
-       silc_attribute_payload_list_free @ 69 ;
-       silc_attribute_payload_parse @ 70 ;
-       silc_channel_get_id @ 71 ;
-       silc_channel_get_id_parse @ 72 ;
-       silc_channel_get_mode @ 73 ;
-       silc_channel_get_name @ 74 ;
-       silc_channel_key_get_cipher @ 75 ;
-       silc_channel_key_get_id @ 76 ;
-       silc_channel_key_get_key @ 77 ;
-       silc_channel_key_payload_encode @ 78 ;
-       silc_channel_key_payload_free @ 79 ;
-       silc_channel_key_payload_parse @ 80 ;
-       silc_channel_payload_encode @ 81 ;
-       silc_channel_payload_free @ 82 ;
-       silc_channel_payload_list_free @ 83 ;
-       silc_channel_payload_parse @ 84 ;
-       silc_channel_payload_parse_list @ 85 ;
-       silc_packet_engine_get_streams @ 86 ;
-       silc_packet_engine_start @ 87 ;
-       silc_packet_engine_stop @ 88 ;
-       silc_packet_error_string @ 89 ;
-       silc_packet_free @ 90 ;
-       silc_packet_get_context @ 91 ;
-       silc_packet_get_engine @ 92 ;
-       silc_packet_get_ids @ 93 ;
-       silc_packet_get_keys @ 94 ;
-       silc_packet_get_sender @ 95 ;
-       silc_packet_send @ 96 ;
-       silc_packet_send_ext @ 97 ;
-       silc_packet_send_va @ 98 ;
-       silc_packet_send_va_ext @ 99 ;
-       silc_packet_set_context @ 100 ;
-       silc_packet_set_ids @ 101 ;
-       silc_packet_set_keys @ 102 ;
-       silc_packet_set_sid @ 103 ;
-       silc_packet_stream_add_remote @ 104 ;
-       silc_packet_stream_create @ 105 ;
-       silc_packet_stream_destroy @ 106 ;
-       silc_packet_stream_get_stream @ 107 ;
-       silc_packet_stream_inject_packet @ 108 ;
-       silc_packet_stream_is_udp @ 109 ;
-       silc_packet_stream_is_valid @ 110 ;
-       silc_packet_stream_link @ 111 ;
-       silc_packet_stream_ref @ 112 ;
-       silc_packet_stream_set_iv_included @ 113 ;
-       silc_packet_stream_set_router @ 114 ;
-       silc_packet_stream_set_stream @ 115 ;
-       silc_packet_stream_unlink @ 116 ;
-       silc_packet_stream_unref @ 117 ;
-       silc_packet_stream_wrap @ 118 ;
-       silc_packet_wait @ 119 ;
-       silc_packet_wait_init @ 120 ;
-       silc_packet_wait_uninit @ 121 ;
-       silc_packet_wrap_close @ 122 ;
-       silc_packet_wrap_destroy @ 123 ;
-       silc_packet_wrap_get_schedule @ 124 ;
-       silc_packet_wrap_notifier @ 125 ;
-       silc_packet_wrap_read @ 126 ;
-       silc_packet_wrap_read_more @ 127 ;
-       silc_packet_wrap_write @ 128 ;
-       silc_notify_get_arg_num @ 129 ;
-       silc_notify_get_args @ 130 ;
-       silc_notify_get_type @ 131 ;
-       silc_notify_payload_encode @ 132 ;
-       silc_notify_payload_encode_args @ 133 ;
-       silc_notify_payload_free @ 134 ;
-       silc_notify_payload_parse @ 135 ;
-       silc_status_get_args @ 136 ;
-       silc_message_get_data @ 137 ;
-       silc_message_get_flags @ 138 ;
-       silc_message_get_mac @ 139 ;
-       silc_message_payload_decrypt @ 140 ;
-       silc_message_payload_encode @ 141 ;
-       silc_message_payload_encrypt @ 142 ;
-       silc_message_payload_free @ 143 ;
-       silc_message_payload_parse @ 144 ;
-       silc_message_signed_get_public_key @ 145 ;
-       silc_message_signed_verify @ 146 ;
-       silc_public_key_payload_decode @ 147 ;
-       silc_public_key_payload_encode @ 148 ;
-       silc_file_set_nonblock @ 149 ;
-       silc_get_real_name @ 150 ;
-       silc_get_username @ 151 ;
-       silc_gettimeofday @ 152 ;
-       silc_cond_alloc @ 153 ;
-       silc_cond_broadcast @ 154 ;
-       silc_cond_free @ 155 ;
-       silc_cond_signal @ 156 ;
-       silc_cond_timedwait @ 157 ;
-       silc_cond_wait @ 158 ;
-       silc_mutex_alloc @ 159 ;
-       silc_mutex_assert_locked @ 160 ;
-       silc_mutex_free @ 161 ;
-       silc_mutex_lock @ 162 ;
-       silc_mutex_unlock @ 163 ;
-       silc_rwlock_alloc @ 164 ;
-       silc_rwlock_free @ 165 ;
-       silc_rwlock_rdlock @ 166 ;
-       silc_rwlock_unlock @ 167 ;
-       silc_rwlock_wrlock @ 168 ;
-       silc_thread_create @ 169 ;
-       silc_thread_exit @ 170 ;
-       silc_thread_self @ 171 ;
-       silc_thread_wait @ 172 ;
-       silc_thread_yield @ 173 ;
-       silc_socket_stream_close @ 174 ;
-       silc_socket_stream_destroy @ 175 ;
-       silc_socket_stream_notifier @ 176 ;
-       silc_socket_stream_read @ 177 ;
-       silc_socket_stream_write @ 178 ;
-       silc_socket_udp_stream_read @ 179 ;
-       silc_socket_udp_stream_write @ 180 ;
-       silc_net_accept @ 181 ;
-       silc_net_addr2bin @ 182 ;
-       silc_net_close_connection @ 183 ;
-       silc_net_close_listener @ 184 ;
-       silc_net_set_socket_nonblock @ 185 ;
-       silc_net_tcp_connect @ 186 ;
-       silc_net_tcp_create_listener @ 187 ;
-       silc_net_udp_connect @ 188 ;
-       silc_net_udp_receive @ 189 ;
-       silc_net_udp_send @ 190 ;
-       silc_schedule_internal_init @ 191 ;
-       silc_schedule_internal_schedule_fd @ 192 ;
-       silc_schedule_internal_signal_register @ 193 ;
-       silc_schedule_internal_signal_unregister @ 194 ;
-       silc_schedule_internal_signals_block @ 195 ;
-       silc_schedule_internal_signals_call @ 196 ;
-       silc_schedule_internal_signals_unblock @ 197 ;
-       silc_schedule_internal_uninit @ 198 ;
-       silc_schedule_internal_wakeup @ 199 ;
-       silc_fd_stream_close @ 200 ;
-       silc_fd_stream_create @ 201 ;
-       silc_fd_stream_create2 @ 202 ;
-       silc_fd_stream_destroy @ 203 ;
-       silc_fd_stream_file @ 204 ;
-       silc_fd_stream_file2 @ 205 ;
-       silc_fd_stream_get_error @ 206 ;
-       silc_fd_stream_get_info @ 207 ;
-       silc_fd_stream_get_schedule @ 208 ;
-       silc_fd_stream_notifier @ 209 ;
-       silc_fd_stream_read @ 210 ;
-       silc_fd_stream_write @ 211 ;
-       silc_hash_table_add @ 212 ;
-       silc_hash_table_add_ext @ 213 ;
-       silc_hash_table_alloc @ 214 ;
-       silc_hash_table_count @ 215 ;
-       silc_hash_table_del @ 216 ;
-       silc_hash_table_del_by_context @ 217 ;
-       silc_hash_table_del_by_context_ext @ 218 ;
-       silc_hash_table_del_ext @ 219 ;
-       silc_hash_table_find @ 220 ;
-       silc_hash_table_find_by_context @ 221 ;
-       silc_hash_table_find_by_context_ext @ 222 ;
-       silc_hash_table_find_ext @ 223 ;
-       silc_hash_table_find_foreach @ 224 ;
-       silc_hash_table_find_foreach_ext @ 225 ;
-       silc_hash_table_foreach @ 226 ;
-       silc_hash_table_free @ 227 ;
-       silc_hash_table_get @ 228 ;
-       silc_hash_table_list @ 229 ;
-       silc_hash_table_list_reset @ 230 ;
-       silc_hash_table_rehash @ 231 ;
-       silc_hash_table_rehash_ext @ 232 ;
-       silc_hash_table_replace @ 233 ;
-       silc_hash_table_replace_ext @ 234 ;
-       silc_hash_table_size @ 235 ;
-       silc_schedule @ 236 ;
-       silc_schedule_get_context @ 237 ;
-       silc_schedule_get_fd_events @ 238 ;
-       silc_schedule_init @ 239 ;
-       silc_schedule_one @ 240 ;
-       silc_schedule_set_listen_fd @ 241 ;
-       silc_schedule_stop @ 242 ;
-       silc_schedule_task_add @ 243 ;
-       silc_schedule_task_del @ 244 ;
-       silc_schedule_task_del_by_all @ 245 ;
-       silc_schedule_task_del_by_callback @ 246 ;
-       silc_schedule_task_del_by_context @ 247 ;
-       silc_schedule_task_del_by_fd @ 248 ;
-       silc_schedule_uninit @ 249 ;
-       silc_schedule_unset_listen_fd @ 250 ;
-       silc_schedule_wakeup @ 251 ;
-       silc_calloc @ 252 ;
-       silc_free @ 253 ;
-       silc_malloc @ 254 ;
-       silc_memdup @ 255 ;
-       silc_realloc @ 256 ;
-       silc_scalloc @ 257 ;
-       silc_smalloc @ 258 ;
-       silc_smalloc_ua @ 259 ;
-       silc_smemdup @ 260 ;
-       silc_srealloc @ 261 ;
-       silc_srealloc_ua @ 262 ;
-       silc_sstrdup @ 263 ;
-       silc_config_close @ 264 ;
-       silc_config_get_filename @ 265 ;
-       silc_config_get_line @ 266 ;
-       silc_config_init @ 267 ;
-       silc_config_main @ 268 ;
-       silc_config_open @ 269 ;
-       silc_config_read_current_line @ 270 ;
-       silc_config_read_line @ 271 ;
-       silc_config_register @ 272 ;
-       silc_config_register_table @ 273 ;
-       silc_config_strerror @ 274 ;
-       silc_log_debug @ 275 ;
-       silc_log_debug_hexdump @ 276 ;
-       silc_log_fflush_callback @ 277 ;
-       silc_log_flush_all @ 278 ;
-       silc_log_flushdelay @ 279 ;
-       silc_log_get_file @ 280 ;
-       silc_log_output @ 281 ;
-       silc_log_output_debug @ 282 ;
-       silc_log_output_hexdump @ 283 ;
-       silc_log_quick @ 284 ;
-       silc_log_reset_all @ 285 ;
-       silc_log_reset_callbacks @ 286 ;
-       silc_log_reset_debug_callbacks @ 287 ;
-       silc_log_set_callback @ 288 ;
-       silc_log_set_debug_callbacks @ 289 ;
-       silc_log_set_debug_string @ 290 ;
-       silc_log_set_file @ 291 ;
-       silc_log_timestamp @ 292 ;
-       silc_net_accept_connection @ 293 ;
-       silc_net_check_host_by_sock @ 294 ;
-       silc_net_check_local_by_sock @ 295 ;
-       silc_net_get_error_string @ 296 ;
-       silc_net_get_local_port @ 297 ;
-       silc_net_get_remote_port @ 298 ;
-       silc_net_get_socket_opt @ 299 ;
-       silc_net_gethostbyaddr @ 300 ;
-       silc_net_gethostbyaddr_async @ 301 ;
-       silc_net_gethostbyname @ 302 ;
-       silc_net_gethostbyname_async @ 303 ;
-       silc_net_is_ip @ 304 ;
-       silc_net_is_ip4 @ 305 ;
-       silc_net_is_ip6 @ 306 ;
-       silc_net_listener_get_hostname @ 307 ;
-       silc_net_listener_get_ip @ 308 ;
-       silc_net_listener_get_port @ 309 ;
-       silc_net_localhost @ 310 ;
-       silc_net_localip @ 311 ;
-       silc_net_resolve_completion @ 312 ;
-       silc_net_set_socket_opt @ 313 ;
-       silc_stringprep @ 314 ;
-       silc_socket_host_lookup_finish @ 315 ;
-       silc_socket_stream_get_error @ 316 ;
-       silc_socket_stream_get_info @ 317 ;
-       silc_socket_stream_get_schedule @ 318 ;
-       silc_socket_stream_is_udp @ 319 ;
-       silc_socket_stream_set_info @ 320 ;
-       silc_socket_stream_set_qos @ 321 ;
-       silc_socket_tcp_stream_create @ 322 ;
-       silc_socket_udp_stream_create @ 323 ;
-       silc_compare_timeval @ 324 ;
-       silc_time @ 325 ;
-       silc_time_generalized @ 326 ;
-       silc_time_generalized_string @ 327 ;
-       silc_time_msec @ 328 ;
-       silc_time_string @ 329 ;
-       silc_time_universal @ 330 ;
-       silc_time_universal_string @ 331 ;
-       silc_time_usec @ 332 ;
-       silc_time_value @ 333 ;
-       silc_timezone @ 334 ;
-       silc_file_close @ 335 ;
-       silc_file_open @ 336 ;
-       silc_file_open_mode @ 337 ;
-       silc_file_read @ 338 ;
-       silc_file_readfile @ 339 ;
-       silc_file_size @ 340 ;
-       silc_file_write @ 341 ;
-       silc_file_writefile @ 342 ;
-       silc_file_writefile_mode @ 343 ;
-       silc_check_line @ 344 ;
-       silc_fingerprint @ 345 ;
-       silc_format @ 346 ;
-       silc_get_input @ 347 ;
-       silc_gets @ 348 ;
-       silc_hash_client_id_compare @ 349 ;
-       silc_hash_client_id_hash @ 350 ;
-       silc_hash_data @ 351 ;
-       silc_hash_data_compare @ 352 ;
-       silc_hash_id @ 353 ;
-       silc_hash_id_compare @ 354 ;
-       silc_hash_id_compare_full @ 355 ;
-       silc_hash_ptr @ 356 ;
-       silc_hash_public_key @ 357 ;
-       silc_hash_public_key_compare @ 358 ;
-       silc_hash_string @ 359 ;
-       silc_hash_string_compare @ 360 ;
-       silc_hash_uint @ 361 ;
-       silc_hash_utf8_compare @ 362 ;
-       silc_hash_utf8_string @ 363 ;
-       silc_parse_command_line @ 364 ;
-       silc_parse_userfqdn @ 365 ;
-       silc_string_is_ascii @ 366 ;
-       silc_to_lower @ 367 ;
-       silc_to_upper @ 368 ;
-       silc_utf8_decode @ 369 ;
-       silc_utf8_decoded_len @ 370 ;
-       silc_utf8_encode @ 371 ;
-       silc_utf8_encoded_len @ 372 ;
-       silc_utf8_strcasecmp @ 373 ;
-       silc_utf8_strncasecmp @ 374 ;
-       silc_utf8_valid @ 375 ;
-       silc_base64_decode @ 376 ;
-       silc_base64_encode @ 377 ;
-       silc_base64_encode_file @ 378 ;
-       silc_string_compare @ 379 ;
-       silc_string_match @ 380 ;
-       silc_string_regex_combine @ 381 ;
-       silc_string_regex_match @ 382 ;
-       silc_string_regexify @ 383 ;
-       silc_string_split @ 384 ;
-       silc_strncat @ 385 ;
-       silc_fsm_alloc @ 386 ;
-       silc_fsm_continue @ 387 ;
-       silc_fsm_continue_sync @ 388 ;
-       silc_fsm_event_alloc @ 389 ;
-       silc_fsm_event_free @ 390 ;
-       silc_fsm_event_init @ 391 ;
-       silc_fsm_event_signal @ 392 ;
-       silc_fsm_event_timedwait @ 393 ;
-       silc_fsm_event_wait @ 394 ;
-       silc_fsm_finish @ 395 ;
-       silc_fsm_free @ 396 ;
-       silc_fsm_get_context @ 397 ;
-       silc_fsm_get_machine @ 398 ;
-       silc_fsm_get_schedule @ 399 ;
-       silc_fsm_get_state_context @ 400 ;
-       silc_fsm_init @ 401 ;
-       silc_fsm_is_started @ 402 ;
-       silc_fsm_next @ 403 ;
-       silc_fsm_next_later @ 404 ;
-       silc_fsm_set_context @ 405 ;
-       silc_fsm_set_state_context @ 406 ;
-       silc_fsm_signal @ 407 ;
-       silc_fsm_start @ 408 ;
-       silc_fsm_start_sync @ 409 ;
-       silc_fsm_thread @ 410 ;
-       silc_fsm_thread_alloc @ 411 ;
-       silc_fsm_thread_init @ 412 ;
-       silc_fsm_thread_wait @ 413 ;
-       silc_buffer_format @ 414 ;
-       silc_buffer_format_vp @ 415 ;
-       silc_buffer_sformat @ 416 ;
-       silc_buffer_sformat_vp @ 417 ;
-       silc_buffer_sstrformat @ 418 ;
-       silc_buffer_strformat @ 419 ;
-       silc_buffer_sunformat @ 420 ;
-       silc_buffer_sunformat_vp @ 421 ;
-       silc_buffer_unformat @ 422 ;
-       silc_buffer_unformat_vp @ 423 ;
-       silc_stream_close @ 424 ;
-       silc_stream_destroy @ 425 ;
-       silc_stream_get_schedule @ 426 ;
-       silc_stream_read @ 427 ;
-       silc_stream_set_notifier @ 428 ;
-       silc_stream_write @ 429 ;
-       silc_async_abort @ 430 ;
-       silc_async_alloc @ 431 ;
-       silc_async_free @ 432 ;
-       silc_async_get_context @ 433 ;
-       silc_async_halt @ 434 ;
-       silc_async_init @ 435 ;
-       silc_async_resume @ 436 ;
-       silc_asprintf @ 437 ;
-       silc_snprintf @ 438 ;
-       silc_vasprintf @ 439 ;
-       silc_vsnprintf @ 440 ;
-       silc_mime_add_data @ 441 ;
-       silc_mime_add_field @ 442 ;
-       silc_mime_add_multipart @ 443 ;
-       silc_mime_alloc @ 444 ;
-       silc_mime_assemble @ 445 ;
-       silc_mime_assembler_alloc @ 446 ;
-       silc_mime_assembler_free @ 447 ;
-       silc_mime_decode @ 448 ;
-       silc_mime_encode @ 449 ;
-       silc_mime_encode_partial @ 450 ;
-       silc_mime_free @ 451 ;
-       silc_mime_get_data @ 452 ;
-       silc_mime_get_field @ 453 ;
-       silc_mime_get_multiparts @ 454 ;
-       silc_mime_is_multipart @ 455 ;
-       silc_mime_is_partial @ 456 ;
-       silc_mime_partial_free @ 457 ;
-       silc_mime_set_multipart @ 458 ;
-       silc_mime_steal_data @ 459 ;
-       silc_idcache_add @ 460 ;
-       silc_idcache_alloc @ 461 ;
-       silc_idcache_del @ 462 ;
-       silc_idcache_del_by_context @ 463 ;
-       silc_idcache_del_by_id @ 464 ;
-       silc_idcache_find_by_context @ 465 ;
-       silc_idcache_find_by_id @ 466 ;
-       silc_idcache_find_by_id_one @ 467 ;
-       silc_idcache_find_by_name @ 468 ;
-       silc_idcache_find_by_name_one @ 469 ;
-       silc_idcache_free @ 470 ;
-       silc_idcache_get_all @ 471 ;
-       silc_idcache_update @ 472 ;
-       silc_idcache_update_by_context @ 473 ;
-       silc_change_private_key_passphrase @ 474 ;
-       silc_channel_name_check @ 475 ;
-       silc_channel_name_verify @ 476 ;
-       silc_client_chmode @ 477 ;
-       silc_client_chumode @ 478 ;
-       silc_client_chumode_char @ 479 ;
-       silc_create_key_pair @ 480 ;
-       silc_get_command_name @ 481 ;
-       silc_get_mode_list @ 482 ;
-       silc_get_packet_name @ 483 ;
-       silc_get_status_message @ 484 ;
-       silc_id_render @ 485 ;
-       silc_identifier_check @ 486 ;
-       silc_identifier_verify @ 487 ;
-       silc_load_key_pair @ 488 ;
-       silc_parse_version_string @ 489 ;
-       silc_show_public_key @ 490 ;
-       silc_show_public_key_file @ 491 ;
-       silc_version_to_num @ 492 ;
-       silc_rc5_cbc_context_len @ 493 ;
-       silc_rc5_cbc_decrypt @ 494 ;
-       silc_rc5_cbc_encrypt @ 495 ;
-       silc_rc5_cbc_set_iv @ 496 ;
-       silc_rc5_cbc_set_key @ 497 ;
-       silc_sha256_context_len @ 498 ;
-       silc_sha256_final @ 499 ;
-       silc_sha256_init @ 500 ;
-       silc_sha256_transform @ 501 ;
-       silc_sha256_update @ 502 ;
-       silc_none_context_len @ 503 ;
-       silc_none_decrypt @ 504 ;
-       silc_none_encrypt @ 505 ;
-       silc_none_set_iv @ 506 ;
-       silc_none_set_key @ 507 ;
-       silc_sha1_context_len @ 508 ;
-       silc_sha1_final @ 509 ;
-       silc_sha1_init @ 510 ;
-       silc_sha1_transform @ 511 ;
-       silc_sha1_update @ 512 ;
-       silc_pkcs_algorithm_register @ 513 ;
-       silc_pkcs_algorithm_unregister @ 514 ;
-       silc_pkcs_decrypt @ 515 ;
-       silc_pkcs_encrypt @ 516 ;
-       silc_pkcs_find_algorithm @ 517 ;
-       silc_pkcs_find_pkcs @ 518 ;
-       silc_pkcs_get_algorithm @ 519 ;
-       silc_pkcs_get_context @ 520 ;
-       silc_pkcs_get_name @ 521 ;
-       silc_pkcs_get_pkcs @ 522 ;
-       silc_pkcs_get_supported @ 523 ;
-       silc_pkcs_get_type @ 524 ;
-       silc_pkcs_load_private_key @ 525 ;
-       silc_pkcs_load_public_key @ 526 ;
-       silc_pkcs_private_key_alloc @ 527 ;
-       silc_pkcs_private_key_free @ 528 ;
-       silc_pkcs_private_key_get_len @ 529 ;
-       silc_pkcs_public_key_alloc @ 530 ;
-       silc_pkcs_public_key_compare @ 531 ;
-       silc_pkcs_public_key_copy @ 532 ;
-       silc_pkcs_public_key_encode @ 533 ;
-       silc_pkcs_public_key_free @ 534 ;
-       silc_pkcs_public_key_get_len @ 535 ;
-       silc_pkcs_register @ 536 ;
-       silc_pkcs_register_default @ 537 ;
-       silc_pkcs_save_private_key @ 538 ;
-       silc_pkcs_save_public_key @ 539 ;
-       silc_pkcs_sign @ 540 ;
-       silc_pkcs_unregister @ 541 ;
-       silc_pkcs_unregister_all @ 542 ;
-       silc_pkcs_verify @ 543 ;
-       silc_hash_alloc @ 544 ;
-       silc_hash_alloc_by_oid @ 545 ;
-       silc_hash_babbleprint @ 546 ;
-       silc_hash_block_len @ 547 ;
-       silc_hash_final @ 548 ;
-       silc_hash_fingerprint @ 549 ;
-       silc_hash_free @ 550 ;
-       silc_hash_get_name @ 551 ;
-       silc_hash_get_oid @ 552 ;
-       silc_hash_get_supported @ 553 ;
-       silc_hash_init @ 554 ;
-       silc_hash_is_supported @ 555 ;
-       silc_hash_len @ 556 ;
-       silc_hash_make @ 557 ;
-       silc_hash_register @ 558 ;
-       silc_hash_register_default @ 559 ;
-       silc_hash_transform @ 560 ;
-       silc_hash_unregister @ 561 ;
-       silc_hash_unregister_all @ 562 ;
-       silc_hash_update @ 563 ;
-       silc_aes_cbc_context_len @ 564 ;
-       silc_aes_cbc_decrypt @ 565 ;
-       silc_aes_cbc_encrypt @ 566 ;
-       silc_aes_cbc_set_iv @ 567 ;
-       silc_aes_cbc_set_key @ 568 ;
-       silc_aes_ctr_context_len @ 569 ;
-       silc_aes_ctr_decrypt @ 570 ;
-       silc_aes_ctr_encrypt @ 571 ;
-       silc_aes_ctr_set_iv @ 572 ;
-       silc_aes_ctr_set_key @ 573 ;
-       silc_pkcs1_decode @ 574 ;
-       silc_pkcs1_decrypt @ 575 ;
-       silc_pkcs1_encode @ 576 ;
-       silc_pkcs1_encrypt @ 577 ;
-       silc_pkcs1_export_private_key @ 578 ;
-       silc_pkcs1_export_public_key @ 579 ;
-       silc_pkcs1_generate_key @ 580 ;
-       silc_pkcs1_import_private_key @ 581 ;
-       silc_pkcs1_import_public_key @ 582 ;
-       silc_pkcs1_private_key_bitlen @ 583 ;
-       silc_pkcs1_private_key_free @ 584 ;
-       silc_pkcs1_public_key_bitlen @ 585 ;
-       silc_pkcs1_public_key_compare @ 586 ;
-       silc_pkcs1_public_key_copy @ 587 ;
-       silc_pkcs1_public_key_free @ 588 ;
-       silc_pkcs1_sign @ 589 ;
-       silc_pkcs1_sign_no_oid @ 590 ;
-       silc_pkcs1_verify @ 591 ;
-       silc_pkcs1_verify_no_oid @ 592 ;
-       silc_cast_cbc_context_len @ 593 ;
-       silc_cast_cbc_decrypt @ 594 ;
-       silc_cast_cbc_encrypt @ 595 ;
-       silc_cast_cbc_set_iv @ 596 ;
-       silc_cast_cbc_set_key @ 597 ;
-       silc_cipher_alloc @ 598 ;
-       silc_cipher_decrypt @ 599 ;
-       silc_cipher_encrypt @ 600 ;
-       silc_cipher_free @ 601 ;
-       silc_cipher_get_block_len @ 602 ;
-       silc_cipher_get_iv @ 603 ;
-       silc_cipher_get_iv_len @ 604 ;
-       silc_cipher_get_key_len @ 605 ;
-       silc_cipher_get_mode @ 606 ;
-       silc_cipher_get_name @ 607 ;
-       silc_cipher_get_supported @ 608 ;
-       silc_cipher_is_supported @ 609 ;
-       silc_cipher_register @ 610 ;
-       silc_cipher_register_default @ 611 ;
-       silc_cipher_set_iv @ 612 ;
-       silc_cipher_set_key @ 613 ;
-       silc_cipher_unregister @ 614 ;
-       silc_cipher_unregister_all @ 615 ;
-       silc_md5_context_len @ 616 ;
-       silc_md5_final @ 617 ;
-       silc_md5_init @ 618 ;
-       silc_md5_transform @ 619 ;
-       silc_md5_update @ 620 ;
-       silc_rsa_generate_keys @ 621 ;
-       silc_rsa_private_operation @ 622 ;
-       silc_rsa_public_operation @ 623 ;
-       silc_blowfish_cbc_context_len @ 624 ;
-       silc_blowfish_cbc_decrypt @ 625 ;
-       silc_blowfish_cbc_encrypt @ 626 ;
-       silc_blowfish_cbc_set_iv @ 627 ;
-       silc_blowfish_cbc_set_key @ 628 ;
-       silc_twofish_cbc_context_len @ 629 ;
-       silc_twofish_cbc_decrypt @ 630 ;
-       silc_twofish_cbc_encrypt @ 631 ;
-       silc_twofish_cbc_set_iv @ 632 ;
-       silc_twofish_cbc_set_key @ 633 ;
-       silc_hmac_alloc @ 634 ;
-       silc_hmac_final @ 635 ;
-       silc_hmac_free @ 636 ;
-       silc_hmac_get_hash @ 637 ;
-       silc_hmac_get_key @ 638 ;
-       silc_hmac_get_name @ 639 ;
-       silc_hmac_get_supported @ 640 ;
-       silc_hmac_init @ 641 ;
-       silc_hmac_init_with_key @ 642 ;
-       silc_hmac_is_supported @ 643 ;
-       silc_hmac_len @ 644 ;
-       silc_hmac_make @ 645 ;
-       silc_hmac_make_truncated @ 646 ;
-       silc_hmac_make_with_key @ 647 ;
-       silc_hmac_register @ 648 ;
-       silc_hmac_register_default @ 649 ;
-       silc_hmac_set_key @ 650 ;
-       silc_hmac_unregister @ 651 ;
-       silc_hmac_unregister_all @ 652 ;
-       silc_hmac_update @ 653 ;
-       silc_rng_add_noise @ 654 ;
-       silc_rng_alloc @ 655 ;
-       silc_rng_free @ 656 ;
-       silc_rng_get_byte @ 657 ;
-       silc_rng_get_byte_fast @ 658 ;
-       silc_rng_get_rn16 @ 659 ;
-       silc_rng_get_rn32 @ 660 ;
-       silc_rng_get_rn_data @ 661 ;
-       silc_rng_get_rn_string @ 662 ;
-       silc_rng_global_add_noise @ 663 ;
-       silc_rng_global_get_byte @ 664 ;
-       silc_rng_global_get_byte_fast @ 665 ;
-       silc_rng_global_get_rn16 @ 666 ;
-       silc_rng_global_get_rn32 @ 667 ;
-       silc_rng_global_get_rn_data @ 668 ;
-       silc_rng_global_get_rn_string @ 669 ;
-       silc_rng_global_init @ 670 ;
-       silc_rng_global_uninit @ 671 ;
-       silc_rng_init @ 672 ;
-       silc_pkcs_silc_decode_identifier @ 673 ;
-       silc_pkcs_silc_decrypt @ 674 ;
-       silc_pkcs_silc_encode_identifier @ 675 ;
-       silc_pkcs_silc_encrypt @ 676 ;
-       silc_pkcs_silc_export_private_key @ 677 ;
-       silc_pkcs_silc_export_private_key_file @ 678 ;
-       silc_pkcs_silc_export_public_key @ 679 ;
-       silc_pkcs_silc_export_public_key_file @ 680 ;
-       silc_pkcs_silc_generate_key @ 681 ;
-       silc_pkcs_silc_get_algorithm @ 682 ;
-       silc_pkcs_silc_import_private_key @ 683 ;
-       silc_pkcs_silc_import_private_key_file @ 684 ;
-       silc_pkcs_silc_import_public_key @ 685 ;
-       silc_pkcs_silc_import_public_key_file @ 686 ;
-       silc_pkcs_silc_private_key_bitlen @ 687 ;
-       silc_pkcs_silc_private_key_free @ 688 ;
-       silc_pkcs_silc_public_key_bitlen @ 689 ;
-       silc_pkcs_silc_public_key_compare @ 690 ;
-       silc_pkcs_silc_public_key_copy @ 691 ;
-       silc_pkcs_silc_public_key_free @ 692 ;
-       silc_pkcs_silc_public_key_version @ 693 ;
-       silc_pkcs_silc_sign @ 694 ;
-       silc_pkcs_silc_verify @ 695 ;
-       silc_skr_add_public_key @ 696 ;
-       silc_skr_add_public_key_simple @ 697 ;
-       silc_skr_alloc @ 698 ;
-       silc_skr_del_public_key @ 699 ;
-       silc_skr_find @ 700 ;
-       silc_skr_find_alloc @ 701 ;
-       silc_skr_find_free @ 702 ;
-       silc_skr_find_set_context @ 703 ;
-       silc_skr_find_set_country @ 704 ;
-       silc_skr_find_set_email @ 705 ;
-       silc_skr_find_set_host @ 706 ;
-       silc_skr_find_set_org @ 707 ;
-       silc_skr_find_set_pkcs_type @ 708 ;
-       silc_skr_find_set_public_key @ 709 ;
-       silc_skr_find_set_realname @ 710 ;
-       silc_skr_find_set_usage @ 711 ;
-       silc_skr_find_set_username @ 712 ;
-       silc_skr_free @ 713 ;
-       silc_skr_init @ 714 ;
-       silc_skr_ref_public_key @ 715 ;
-       silc_skr_uninit @ 716 ;
-       silc_skr_unref_public_key @ 717 ;
-       silc_mp_abs @ 718 ;
-       silc_mp_add @ 719 ;
-       silc_mp_add_ui @ 720 ;
-       silc_mp_and @ 721 ;
-       silc_mp_cmp @ 722 ;
-       silc_mp_cmp_si @ 723 ;
-       silc_mp_cmp_ui @ 724 ;
-       silc_mp_div @ 725 ;
-       silc_mp_div_2exp @ 726 ;
-       silc_mp_div_2exp_qr @ 727 ;
-       silc_mp_div_qr @ 728 ;
-       silc_mp_div_ui @ 729 ;
-       silc_mp_gcd @ 730 ;
-       silc_mp_gcdext @ 731 ;
-       silc_mp_get_str @ 732 ;
-       silc_mp_get_ui @ 733 ;
-       silc_mp_init @ 734 ;
-       silc_mp_mod @ 735 ;
-       silc_mp_mod_2exp @ 736 ;
-       silc_mp_mod_ui @ 737 ;
-       silc_mp_mul @ 738 ;
-       silc_mp_mul_2exp @ 739 ;
-       silc_mp_mul_ui @ 740 ;
-       silc_mp_neg @ 741 ;
-       silc_mp_or @ 742 ;
-       silc_mp_pow @ 743 ;
-       silc_mp_pow_mod @ 744 ;
-       silc_mp_pow_mod_ui @ 745 ;
-       silc_mp_pow_ui @ 746 ;
-       silc_mp_set @ 747 ;
-       silc_mp_set_si @ 748 ;
-       silc_mp_set_str @ 749 ;
-       silc_mp_set_ui @ 750 ;
-       silc_mp_sinit @ 751 ;
-       silc_mp_size @ 752 ;
-       silc_mp_sizeinbase @ 753 ;
-       silc_mp_sqrt @ 754 ;
-       silc_mp_sub @ 755 ;
-       silc_mp_sub_ui @ 756 ;
-       silc_mp_uninit @ 757 ;
-       silc_mp_xor @ 758 ;
-       silc_math_gen_prime @ 759 ;
-       silc_math_prime_test @ 760 ;
-       silc_mp_bin2mp @ 761 ;
-       silc_mp_mp2bin @ 762 ;
-       silc_mp_mp2bin_noalloc @ 763 ;
-       silc_mp_modinv @ 764 ;
-       silc_asn1_encode @ 772 ;
-       silc_asn1_alloc @ 773 ;
-       silc_asn1_free @ 775 ;
-       silc_asn1_init @ 776 ;
-       silc_asn1_uninit @ 778 ;
-       silc_asn1_decode @ 779 ;
-       silc_ber_decode @ 780 ;
-       silc_ber_encode @ 781 ;
-       silc_ber_encoded_len @ 782 ;
-       silc_connauth_alloc @ 783 ;
-       silc_connauth_free @ 784 ;
-       silc_connauth_get_ske @ 785 ;
-       silc_connauth_initiator @ 786 ;
-       silc_connauth_responder @ 787 ;
-       silc_connauth_timeout @ 788 ;
-       silc_ske_alloc @ 789 ;
-       silc_ske_free @ 790 ;
-       silc_ske_free_key_material @ 791 ;
-       silc_ske_free_rekey_material @ 792 ;
-       silc_ske_get_context @ 793 ;
-       silc_ske_get_key_material @ 794 ;
-       silc_ske_get_security_properties @ 795 ;
-       silc_ske_initiator @ 796 ;
-       silc_ske_map_status @ 797 ;
-       silc_ske_packet_send_retry @ 798 ;
-       silc_ske_parse_version @ 799 ;
-       silc_ske_process_key_material @ 800 ;
-       silc_ske_process_key_material_data @ 801 ;
-       silc_ske_rekey_initiator @ 802 ;
-       silc_ske_rekey_responder @ 803 ;
-       silc_ske_responder @ 804 ;
-       silc_ske_set_callbacks @ 805 ;
-       silc_ske_set_keys @ 806 ;
-       silc_ske_payload_ke_decode @ 807 ;
-       silc_ske_payload_ke_encode @ 808 ;
-       silc_ske_payload_ke_free @ 809 ;
-       silc_ske_payload_start_decode @ 810 ;
-       silc_ske_payload_start_encode @ 811 ;
-       silc_ske_payload_start_free @ 812 ;
-       silc_ske_get_supported_groups @ 813 ;
-       silc_ske_group_free @ 814 ;
-       silc_ske_group_get_by_name @ 815 ;
-       silc_ske_group_get_by_number @ 816 ;
-       silc_ske_group_get_name @ 817 ;
-       silc_ske_group_get_number @ 818 ;
-       silc_http_php @ 819 ;
-       silc_http_php_file @ 820 ;
-       silc_http_server_add_header @ 821 ;
-       silc_http_server_alloc @ 822 ;
-       silc_http_server_free @ 823 ;
-       silc_http_server_get_header @ 824 ;
-       silc_http_server_send @ 825 ;
-       silc_http_server_send_error @ 826 ;
-       silc_sftp_fs_memory_add_dir @ 827 ;
-       silc_sftp_fs_memory_add_file @ 828 ;
-       silc_sftp_fs_memory_alloc @ 829 ;
-       silc_sftp_fs_memory_del_dir @ 830 ;
-       silc_sftp_fs_memory_del_file @ 831 ;
-       silc_sftp_fs_memory_free @ 832 ;
-       silc_sftp_attr_decode @ 833 ;
-       silc_sftp_attr_encode @ 834 ;
-       silc_sftp_attr_free @ 835 ;
-       silc_sftp_map_errno @ 836 ;
-       silc_sftp_name_add @ 837 ;
-       silc_sftp_name_decode @ 838 ;
-       silc_sftp_name_encode @ 839 ;
-       silc_sftp_name_free @ 840 ;
-       silc_sftp_packet_decode @ 841 ;
-       silc_sftp_packet_encode @ 842 ;
-       silc_sftp_packet_encode_vp @ 843 ;
-       silc_sftp_client_shutdown @ 844 ;
-       silc_sftp_client_start @ 845 ;
-       silc_sftp_close @ 846 ;
-       silc_sftp_extended @ 847 ;
-       silc_sftp_fsetstat @ 848 ;
-       silc_sftp_fstat @ 849 ;
-       silc_sftp_lstat @ 850 ;
-       silc_sftp_mkdir @ 851 ;
-       silc_sftp_open @ 852 ;
-       silc_sftp_opendir @ 853 ;
-       silc_sftp_read @ 854 ;
-       silc_sftp_readdir @ 855 ;
-       silc_sftp_readlink @ 856 ;
-       silc_sftp_realpath @ 857 ;
-       silc_sftp_remove @ 858 ;
-       silc_sftp_rename @ 859 ;
-       silc_sftp_rmdir @ 860 ;
-       silc_sftp_setstat @ 861 ;
-       silc_sftp_stat @ 862 ;
-       silc_sftp_symlink @ 863 ;
-       silc_sftp_write @ 864 ;
-       silc_sftp_server_set_monitor @ 865 ;
-       silc_sftp_server_shutdown @ 866 ;
-       silc_sftp_server_start @ 867 ;
-       silc_vcard_alloc @ 868 ;
-       silc_vcard_decode @ 869 ;
-       silc_vcard_encode @ 870 ;
-       silc_vcard_fprintf @ 871 ;
-       silc_vcard_free @ 872 ;
-       silc_utf8_c2w @ 873 ;
-       silc_utf8_w2c @ 874 ;
-
+EXPORTS\r
+       silc_argument_get_arg_num @ 1 ;\r
+       silc_argument_get_arg_type @ 2 ;\r
+       silc_argument_get_decoded @ 3 ;\r
+       silc_argument_get_first_arg @ 4 ;\r
+       silc_argument_get_next_arg @ 5 ;\r
+       silc_argument_list_free @ 6 ;\r
+       silc_argument_list_parse @ 7 ;\r
+       silc_argument_list_parse_decoded @ 8 ;\r
+       silc_argument_payload_encode @ 9 ;\r
+       silc_argument_payload_encode_one @ 10 ;\r
+       silc_argument_payload_encode_payload @ 11 ;\r
+       silc_argument_payload_free @ 12 ;\r
+       silc_argument_payload_parse @ 13 ;\r
+       silc_command_get @ 14 ;\r
+       silc_command_get_args @ 15 ;\r
+       silc_command_get_ident @ 16 ;\r
+       silc_command_get_status @ 17 ;\r
+       silc_command_payload_encode @ 18 ;\r
+       silc_command_payload_encode_payload @ 19 ;\r
+       silc_command_payload_encode_va @ 20 ;\r
+       silc_command_payload_encode_vap @ 21 ;\r
+       silc_command_payload_free @ 22 ;\r
+       silc_command_payload_parse @ 23 ;\r
+       silc_command_reply_payload_encode_va @ 24 ;\r
+       silc_command_reply_payload_encode_vap @ 25 ;\r
+       silc_command_set_command @ 26 ;\r
+       silc_command_set_ident @ 27 ;\r
+       silc_auth_get_data @ 28 ;\r
+       silc_auth_get_method @ 29 ;\r
+       silc_auth_get_public_data @ 30 ;\r
+       silc_auth_payload_encode @ 31 ;\r
+       silc_auth_payload_free @ 32 ;\r
+       silc_auth_payload_parse @ 33 ;\r
+       silc_auth_public_key_auth_generate @ 34 ;\r
+       silc_auth_public_key_auth_generate_wpub @ 35 ;\r
+       silc_auth_public_key_auth_verify @ 36 ;\r
+       silc_auth_public_key_auth_verify_data @ 37 ;\r
+       silc_auth_verify @ 38 ;\r
+       silc_auth_verify_data @ 39 ;\r
+       silc_key_agreement_get_hostname @ 40 ;\r
+       silc_key_agreement_get_port @ 41 ;\r
+       silc_key_agreement_get_protocol @ 42 ;\r
+       silc_key_agreement_payload_encode @ 43 ;\r
+       silc_key_agreement_payload_free @ 44 ;\r
+       silc_key_agreement_payload_parse @ 45 ;\r
+       silc_id_dup @ 46 ;\r
+       silc_id_get_len @ 47 ;\r
+       silc_id_id2str @ 48 ;\r
+       silc_id_payload_encode @ 49 ;\r
+       silc_id_payload_encode_data @ 50 ;\r
+       silc_id_payload_free @ 51 ;\r
+       silc_id_payload_get_data @ 52 ;\r
+       silc_id_payload_get_id @ 53 ;\r
+       silc_id_payload_get_len @ 54 ;\r
+       silc_id_payload_get_type @ 55 ;\r
+       silc_id_payload_parse @ 56 ;\r
+       silc_id_payload_parse_id @ 57 ;\r
+       silc_id_str2id @ 58 ;\r
+       silc_id_str2id2 @ 59 ;\r
+       silc_attribute_get_attribute @ 60 ;\r
+       silc_attribute_get_data @ 61 ;\r
+       silc_attribute_get_flags @ 62 ;\r
+       silc_attribute_get_object @ 63 ;\r
+       silc_attribute_get_verify_data @ 64 ;\r
+       silc_attribute_payload_alloc @ 65 ;\r
+       silc_attribute_payload_encode @ 66 ;\r
+       silc_attribute_payload_encode_data @ 67 ;\r
+       silc_attribute_payload_free @ 68 ;\r
+       silc_attribute_payload_list_free @ 69 ;\r
+       silc_attribute_payload_parse @ 70 ;\r
+       silc_channel_get_id @ 71 ;\r
+       silc_channel_get_id_parse @ 72 ;\r
+       silc_channel_get_mode @ 73 ;\r
+       silc_channel_get_name @ 74 ;\r
+       silc_channel_key_get_cipher @ 75 ;\r
+       silc_channel_key_get_id @ 76 ;\r
+       silc_channel_key_get_key @ 77 ;\r
+       silc_channel_key_payload_encode @ 78 ;\r
+       silc_channel_key_payload_free @ 79 ;\r
+       silc_channel_key_payload_parse @ 80 ;\r
+       silc_channel_payload_encode @ 81 ;\r
+       silc_channel_payload_free @ 82 ;\r
+       silc_channel_payload_list_free @ 83 ;\r
+       silc_channel_payload_parse @ 84 ;\r
+       silc_channel_payload_parse_list @ 85 ;\r
+       silc_packet_engine_get_streams @ 86 ;\r
+       silc_packet_engine_start @ 87 ;\r
+       silc_packet_engine_stop @ 88 ;\r
+       silc_packet_error_string @ 89 ;\r
+       silc_packet_free @ 90 ;\r
+       silc_packet_get_context @ 91 ;\r
+       silc_packet_get_engine @ 92 ;\r
+       silc_packet_get_ids @ 93 ;\r
+       silc_packet_get_keys @ 94 ;\r
+       silc_packet_get_sender @ 95 ;\r
+       silc_packet_send @ 96 ;\r
+       silc_packet_send_ext @ 97 ;\r
+       silc_packet_send_va @ 98 ;\r
+       silc_packet_send_va_ext @ 99 ;\r
+       silc_packet_set_context @ 100 ;\r
+       silc_packet_set_ids @ 101 ;\r
+       silc_packet_set_keys @ 102 ;\r
+       silc_packet_set_sid @ 103 ;\r
+       silc_packet_stream_add_remote @ 104 ;\r
+       silc_packet_stream_create @ 105 ;\r
+       silc_packet_stream_destroy @ 106 ;\r
+       silc_packet_stream_get_stream @ 107 ;\r
+       silc_packet_stream_inject_packet @ 108 ;\r
+       silc_packet_stream_is_udp @ 109 ;\r
+       silc_packet_stream_is_valid @ 110 ;\r
+       silc_packet_stream_link @ 111 ;\r
+       silc_packet_stream_ref @ 112 ;\r
+       silc_packet_stream_set_iv_included @ 113 ;\r
+       silc_packet_stream_set_router @ 114 ;\r
+       silc_packet_stream_set_stream @ 115 ;\r
+       silc_packet_stream_unlink @ 116 ;\r
+       silc_packet_stream_unref @ 117 ;\r
+       silc_packet_stream_wrap @ 118 ;\r
+       silc_packet_wait @ 119 ;\r
+       silc_packet_wait_init @ 120 ;\r
+       silc_packet_wait_uninit @ 121 ;\r
+       silc_packet_wrap_close @ 122 ;\r
+       silc_packet_wrap_destroy @ 123 ;\r
+       silc_packet_wrap_get_schedule @ 124 ;\r
+       silc_packet_wrap_notifier @ 125 ;\r
+       silc_packet_wrap_read @ 126 ;\r
+       silc_packet_wrap_read_more @ 127 ;\r
+       silc_packet_wrap_write @ 128 ;\r
+       silc_notify_get_arg_num @ 129 ;\r
+       silc_notify_get_args @ 130 ;\r
+       silc_notify_get_type @ 131 ;\r
+       silc_notify_payload_encode @ 132 ;\r
+       silc_notify_payload_encode_args @ 133 ;\r
+       silc_notify_payload_free @ 134 ;\r
+       silc_notify_payload_parse @ 135 ;\r
+       silc_status_get_args @ 136 ;\r
+       silc_message_get_data @ 137 ;\r
+       silc_message_get_flags @ 138 ;\r
+       silc_message_get_mac @ 139 ;\r
+       silc_message_payload_decrypt @ 140 ;\r
+       silc_message_payload_encode @ 141 ;\r
+       silc_message_payload_encrypt @ 142 ;\r
+       silc_message_payload_free @ 143 ;\r
+       silc_message_payload_parse @ 144 ;\r
+       silc_message_signed_get_public_key @ 145 ;\r
+       silc_message_signed_verify @ 146 ;\r
+       silc_public_key_payload_decode @ 147 ;\r
+       silc_public_key_payload_encode @ 148 ;\r
+       silc_file_set_nonblock @ 149 ;\r
+       silc_get_real_name @ 150 ;\r
+       silc_get_username @ 151 ;\r
+       silc_gettimeofday @ 152 ;\r
+       silc_cond_alloc @ 153 ;\r
+       silc_cond_broadcast @ 154 ;\r
+       silc_cond_free @ 155 ;\r
+       silc_cond_signal @ 156 ;\r
+       silc_cond_timedwait @ 157 ;\r
+       silc_cond_wait @ 158 ;\r
+       silc_mutex_alloc @ 159 ;\r
+       silc_mutex_assert_locked @ 160 ;\r
+       silc_mutex_free @ 161 ;\r
+       silc_mutex_lock @ 162 ;\r
+       silc_mutex_unlock @ 163 ;\r
+       silc_rwlock_alloc @ 164 ;\r
+       silc_rwlock_free @ 165 ;\r
+       silc_rwlock_rdlock @ 166 ;\r
+       silc_rwlock_unlock @ 167 ;\r
+       silc_rwlock_wrlock @ 168 ;\r
+       silc_thread_create @ 169 ;\r
+       silc_thread_exit @ 170 ;\r
+       silc_thread_self @ 171 ;\r
+       silc_thread_wait @ 172 ;\r
+       silc_thread_yield @ 173 ;\r
+       silc_socket_stream_close @ 174 ;\r
+       silc_socket_stream_destroy @ 175 ;\r
+       silc_socket_stream_notifier @ 176 ;\r
+       silc_socket_stream_read @ 177 ;\r
+       silc_socket_stream_write @ 178 ;\r
+       silc_socket_udp_stream_read @ 179 ;\r
+       silc_socket_udp_stream_write @ 180 ;\r
+       silc_net_accept @ 181 ;\r
+       silc_net_addr2bin @ 182 ;\r
+       silc_net_close_connection @ 183 ;\r
+       silc_net_close_listener @ 184 ;\r
+       silc_net_set_socket_nonblock @ 185 ;\r
+       silc_net_tcp_connect @ 186 ;\r
+       silc_net_tcp_create_listener @ 187 ;\r
+       silc_net_udp_connect @ 188 ;\r
+       silc_net_udp_receive @ 189 ;\r
+       silc_net_udp_send @ 190 ;\r
+       silc_schedule_internal_init @ 191 ;\r
+       silc_schedule_internal_schedule_fd @ 192 ;\r
+       silc_schedule_internal_signal_register @ 193 ;\r
+       silc_schedule_internal_signal_unregister @ 194 ;\r
+       silc_schedule_internal_signals_block @ 195 ;\r
+       silc_schedule_internal_signals_call @ 196 ;\r
+       silc_schedule_internal_signals_unblock @ 197 ;\r
+       silc_schedule_internal_uninit @ 198 ;\r
+       silc_schedule_internal_wakeup @ 199 ;\r
+       silc_fd_stream_close @ 200 ;\r
+       silc_fd_stream_create @ 201 ;\r
+       silc_fd_stream_create2 @ 202 ;\r
+       silc_fd_stream_destroy @ 203 ;\r
+       silc_fd_stream_file @ 204 ;\r
+       silc_fd_stream_file2 @ 205 ;\r
+       silc_fd_stream_get_error @ 206 ;\r
+       silc_fd_stream_get_info @ 207 ;\r
+       silc_fd_stream_get_schedule @ 208 ;\r
+       silc_fd_stream_notifier @ 209 ;\r
+       silc_fd_stream_read @ 210 ;\r
+       silc_fd_stream_write @ 211 ;\r
+       silc_hash_table_add @ 212 ;\r
+       silc_hash_table_add_ext @ 213 ;\r
+       silc_hash_table_alloc @ 214 ;\r
+       silc_hash_table_count @ 215 ;\r
+       silc_hash_table_del @ 216 ;\r
+       silc_hash_table_del_by_context @ 217 ;\r
+       silc_hash_table_del_by_context_ext @ 218 ;\r
+       silc_hash_table_del_ext @ 219 ;\r
+       silc_hash_table_find @ 220 ;\r
+       silc_hash_table_find_by_context @ 221 ;\r
+       silc_hash_table_find_by_context_ext @ 222 ;\r
+       silc_hash_table_find_ext @ 223 ;\r
+       silc_hash_table_find_foreach @ 224 ;\r
+       silc_hash_table_find_foreach_ext @ 225 ;\r
+       silc_hash_table_foreach @ 226 ;\r
+       silc_hash_table_free @ 227 ;\r
+       silc_hash_table_get @ 228 ;\r
+       silc_hash_table_list @ 229 ;\r
+       silc_hash_table_list_reset @ 230 ;\r
+       silc_hash_table_rehash @ 231 ;\r
+       silc_hash_table_rehash_ext @ 232 ;\r
+       silc_hash_table_replace @ 233 ;\r
+       silc_hash_table_replace_ext @ 234 ;\r
+       silc_hash_table_size @ 235 ;\r
+       silc_schedule @ 236 ;\r
+       silc_schedule_get_context @ 237 ;\r
+       silc_schedule_get_fd_events @ 238 ;\r
+       silc_schedule_init @ 239 ;\r
+       silc_schedule_one @ 240 ;\r
+       silc_schedule_set_listen_fd @ 241 ;\r
+       silc_schedule_stop @ 242 ;\r
+       silc_schedule_task_add @ 243 ;\r
+       silc_schedule_task_del @ 244 ;\r
+       silc_schedule_task_del_by_all @ 245 ;\r
+       silc_schedule_task_del_by_callback @ 246 ;\r
+       silc_schedule_task_del_by_context @ 247 ;\r
+       silc_schedule_task_del_by_fd @ 248 ;\r
+       silc_schedule_uninit @ 249 ;\r
+       silc_schedule_unset_listen_fd @ 250 ;\r
+       silc_schedule_wakeup @ 251 ;\r
+       silc_calloc @ 252 ;\r
+       silc_free @ 253 ;\r
+       silc_malloc @ 254 ;\r
+       silc_memdup @ 255 ;\r
+       silc_realloc @ 256 ;\r
+       silc_scalloc @ 257 ;\r
+       silc_smalloc @ 258 ;\r
+       silc_smalloc_ua @ 259 ;\r
+       silc_smemdup @ 260 ;\r
+       silc_srealloc @ 261 ;\r
+       silc_srealloc_ua @ 262 ;\r
+       silc_sstrdup @ 263 ;\r
+       silc_config_close @ 264 ;\r
+       silc_config_get_filename @ 265 ;\r
+       silc_config_get_line @ 266 ;\r
+       silc_config_init @ 267 ;\r
+       silc_config_main @ 268 ;\r
+       silc_config_open @ 269 ;\r
+       silc_config_read_current_line @ 270 ;\r
+       silc_config_read_line @ 271 ;\r
+       silc_config_register @ 272 ;\r
+       silc_config_register_table @ 273 ;\r
+       silc_config_strerror @ 274 ;\r
+       silc_log_debug @ 275 ;\r
+       silc_log_debug_hexdump @ 276 ;\r
+       silc_log_fflush_callback @ 277 ;\r
+       silc_log_flush_all @ 278 ;\r
+       silc_log_flushdelay @ 279 ;\r
+       silc_log_get_file @ 280 ;\r
+       silc_log_output @ 281 ;\r
+       silc_log_output_debug @ 282 ;\r
+       silc_log_output_hexdump @ 283 ;\r
+       silc_log_quick @ 284 ;\r
+       silc_log_reset_all @ 285 ;\r
+       silc_log_reset_callbacks @ 286 ;\r
+       silc_log_reset_debug_callbacks @ 287 ;\r
+       silc_log_set_callback @ 288 ;\r
+       silc_log_set_debug_callbacks @ 289 ;\r
+       silc_log_set_debug_string @ 290 ;\r
+       silc_log_set_file @ 291 ;\r
+       silc_log_timestamp @ 292 ;\r
+       silc_net_accept_connection @ 293 ;\r
+       silc_net_check_host_by_sock @ 294 ;\r
+       silc_net_check_local_by_sock @ 295 ;\r
+       silc_net_get_error_string @ 296 ;\r
+       silc_net_get_local_port @ 297 ;\r
+       silc_net_get_remote_port @ 298 ;\r
+       silc_net_get_socket_opt @ 299 ;\r
+       silc_net_gethostbyaddr @ 300 ;\r
+       silc_net_gethostbyaddr_async @ 301 ;\r
+       silc_net_gethostbyname @ 302 ;\r
+       silc_net_gethostbyname_async @ 303 ;\r
+       silc_net_is_ip @ 304 ;\r
+       silc_net_is_ip4 @ 305 ;\r
+       silc_net_is_ip6 @ 306 ;\r
+       silc_net_listener_get_hostname @ 307 ;\r
+       silc_net_listener_get_ip @ 308 ;\r
+       silc_net_listener_get_port @ 309 ;\r
+       silc_net_localhost @ 310 ;\r
+       silc_net_localip @ 311 ;\r
+       silc_net_resolve_completion @ 312 ;\r
+       silc_net_set_socket_opt @ 313 ;\r
+       silc_stringprep @ 314 ;\r
+       silc_socket_host_lookup_finish @ 315 ;\r
+       silc_socket_stream_get_error @ 316 ;\r
+       silc_socket_stream_get_info @ 317 ;\r
+       silc_socket_stream_get_schedule @ 318 ;\r
+       silc_socket_stream_is_udp @ 319 ;\r
+       silc_socket_stream_set_info @ 320 ;\r
+       silc_socket_stream_set_qos @ 321 ;\r
+       silc_socket_tcp_stream_create @ 322 ;\r
+       silc_socket_udp_stream_create @ 323 ;\r
+       silc_compare_timeval @ 324 ;\r
+       silc_time @ 325 ;\r
+       silc_time_generalized @ 326 ;\r
+       silc_time_generalized_string @ 327 ;\r
+       silc_time_msec @ 328 ;\r
+       silc_time_string @ 329 ;\r
+       silc_time_universal @ 330 ;\r
+       silc_time_universal_string @ 331 ;\r
+       silc_time_usec @ 332 ;\r
+       silc_time_value @ 333 ;\r
+       silc_timezone @ 334 ;\r
+       silc_file_close @ 335 ;\r
+       silc_file_open @ 336 ;\r
+       silc_file_open_mode @ 337 ;\r
+       silc_file_read @ 338 ;\r
+       silc_file_readfile @ 339 ;\r
+       silc_file_size @ 340 ;\r
+       silc_file_write @ 341 ;\r
+       silc_file_writefile @ 342 ;\r
+       silc_file_writefile_mode @ 343 ;\r
+       silc_check_line @ 344 ;\r
+       silc_fingerprint @ 345 ;\r
+       silc_format @ 346 ;\r
+       silc_get_input @ 347 ;\r
+       silc_gets @ 348 ;\r
+       silc_hash_client_id_compare @ 349 ;\r
+       silc_hash_client_id_hash @ 350 ;\r
+       silc_hash_data @ 351 ;\r
+       silc_hash_data_compare @ 352 ;\r
+       silc_hash_id @ 353 ;\r
+       silc_hash_id_compare @ 354 ;\r
+       silc_hash_id_compare_full @ 355 ;\r
+       silc_hash_ptr @ 356 ;\r
+       silc_hash_public_key @ 357 ;\r
+       silc_hash_public_key_compare @ 358 ;\r
+       silc_hash_string @ 359 ;\r
+       silc_hash_string_compare @ 360 ;\r
+       silc_hash_uint @ 361 ;\r
+       silc_hash_utf8_compare @ 362 ;\r
+       silc_hash_utf8_string @ 363 ;\r
+       silc_parse_command_line @ 364 ;\r
+       silc_parse_userfqdn @ 365 ;\r
+       silc_string_is_ascii @ 366 ;\r
+       silc_to_lower @ 367 ;\r
+       silc_to_upper @ 368 ;\r
+       silc_utf8_decode @ 369 ;\r
+       silc_utf8_decoded_len @ 370 ;\r
+       silc_utf8_encode @ 371 ;\r
+       silc_utf8_encoded_len @ 372 ;\r
+       silc_utf8_strcasecmp @ 373 ;\r
+       silc_utf8_strncasecmp @ 374 ;\r
+       silc_utf8_valid @ 375 ;\r
+       silc_base64_decode @ 376 ;\r
+       silc_base64_encode @ 377 ;\r
+       silc_base64_encode_file @ 378 ;\r
+       silc_string_compare @ 379 ;\r
+       silc_string_match @ 380 ;\r
+       silc_string_regex_combine @ 381 ;\r
+       silc_string_regex_match @ 382 ;\r
+       silc_string_regexify @ 383 ;\r
+       silc_string_split @ 384 ;\r
+       silc_strncat @ 385 ;\r
+       silc_fsm_alloc @ 386 ;\r
+       silc_fsm_continue @ 387 ;\r
+       silc_fsm_continue_sync @ 388 ;\r
+       silc_fsm_event_alloc @ 389 ;\r
+       silc_fsm_event_free @ 390 ;\r
+       silc_fsm_event_init @ 391 ;\r
+       silc_fsm_event_signal @ 392 ;\r
+       silc_fsm_event_timedwait @ 393 ;\r
+       silc_fsm_event_wait @ 394 ;\r
+       silc_fsm_finish @ 395 ;\r
+       silc_fsm_free @ 396 ;\r
+       silc_fsm_get_context @ 397 ;\r
+       silc_fsm_get_machine @ 398 ;\r
+       silc_fsm_get_schedule @ 399 ;\r
+       silc_fsm_get_state_context @ 400 ;\r
+       silc_fsm_init @ 401 ;\r
+       silc_fsm_is_started @ 402 ;\r
+       silc_fsm_next @ 403 ;\r
+       silc_fsm_next_later @ 404 ;\r
+       silc_fsm_set_context @ 405 ;\r
+       silc_fsm_set_state_context @ 406 ;\r
+       silc_fsm_signal @ 407 ;\r
+       silc_fsm_start @ 408 ;\r
+       silc_fsm_start_sync @ 409 ;\r
+       silc_fsm_thread @ 410 ;\r
+       silc_fsm_thread_alloc @ 411 ;\r
+       silc_fsm_thread_init @ 412 ;\r
+       silc_fsm_thread_wait @ 413 ;\r
+       silc_buffer_format @ 414 ;\r
+       silc_buffer_format_vp @ 415 ;\r
+       silc_buffer_sformat @ 416 ;\r
+       silc_buffer_sformat_vp @ 417 ;\r
+       silc_buffer_sstrformat @ 418 ;\r
+       silc_buffer_strformat @ 419 ;\r
+       silc_buffer_sunformat @ 420 ;\r
+       silc_buffer_sunformat_vp @ 421 ;\r
+       silc_buffer_unformat @ 422 ;\r
+       silc_buffer_unformat_vp @ 423 ;\r
+       silc_stream_close @ 424 ;\r
+       silc_stream_destroy @ 425 ;\r
+       silc_stream_get_schedule @ 426 ;\r
+       silc_stream_read @ 427 ;\r
+       silc_stream_set_notifier @ 428 ;\r
+       silc_stream_write @ 429 ;\r
+       silc_async_abort @ 430 ;\r
+       silc_async_alloc @ 431 ;\r
+       silc_async_free @ 432 ;\r
+       silc_async_get_context @ 433 ;\r
+       silc_async_halt @ 434 ;\r
+       silc_async_init @ 435 ;\r
+       silc_async_resume @ 436 ;\r
+       silc_asprintf @ 437 ;\r
+       silc_snprintf @ 438 ;\r
+       silc_vasprintf @ 439 ;\r
+       silc_vsnprintf @ 440 ;\r
+       silc_mime_add_data @ 441 ;\r
+       silc_mime_add_field @ 442 ;\r
+       silc_mime_add_multipart @ 443 ;\r
+       silc_mime_alloc @ 444 ;\r
+       silc_mime_assemble @ 445 ;\r
+       silc_mime_assembler_alloc @ 446 ;\r
+       silc_mime_assembler_free @ 447 ;\r
+       silc_mime_decode @ 448 ;\r
+       silc_mime_encode @ 449 ;\r
+       silc_mime_encode_partial @ 450 ;\r
+       silc_mime_free @ 451 ;\r
+       silc_mime_get_data @ 452 ;\r
+       silc_mime_get_field @ 453 ;\r
+       silc_mime_get_multiparts @ 454 ;\r
+       silc_mime_is_multipart @ 455 ;\r
+       silc_mime_is_partial @ 456 ;\r
+       silc_mime_partial_free @ 457 ;\r
+       silc_mime_set_multipart @ 458 ;\r
+       silc_mime_steal_data @ 459 ;\r
+       silc_idcache_add @ 460 ;\r
+       silc_idcache_alloc @ 461 ;\r
+       silc_idcache_del @ 462 ;\r
+       silc_idcache_del_by_context @ 463 ;\r
+       silc_idcache_del_by_id @ 464 ;\r
+       silc_idcache_find_by_context @ 465 ;\r
+       silc_idcache_find_by_id @ 466 ;\r
+       silc_idcache_find_by_id_one @ 467 ;\r
+       silc_idcache_find_by_name @ 468 ;\r
+       silc_idcache_find_by_name_one @ 469 ;\r
+       silc_idcache_free @ 470 ;\r
+       silc_idcache_get_all @ 471 ;\r
+       silc_idcache_update @ 472 ;\r
+       silc_idcache_update_by_context @ 473 ;\r
+       silc_change_private_key_passphrase @ 474 ;\r
+       silc_channel_name_check @ 475 ;\r
+       silc_channel_name_verify @ 476 ;\r
+       silc_client_chmode @ 477 ;\r
+       silc_client_chumode @ 478 ;\r
+       silc_client_chumode_char @ 479 ;\r
+       silc_create_key_pair @ 480 ;\r
+       silc_get_command_name @ 481 ;\r
+       silc_get_mode_list @ 482 ;\r
+       silc_get_packet_name @ 483 ;\r
+       silc_get_status_message @ 484 ;\r
+       silc_id_render @ 485 ;\r
+       silc_identifier_check @ 486 ;\r
+       silc_identifier_verify @ 487 ;\r
+       silc_load_key_pair @ 488 ;\r
+       silc_parse_version_string @ 489 ;\r
+       silc_show_public_key @ 490 ;\r
+       silc_show_public_key_file @ 491 ;\r
+       silc_version_to_num @ 492 ;\r
+       silc_sha256_context_len @ 498 ;\r
+       silc_sha256_final @ 499 ;\r
+       silc_sha256_init @ 500 ;\r
+       silc_sha256_transform @ 501 ;\r
+       silc_sha256_update @ 502 ;\r
+       silc_none_context_len @ 503 ;\r
+       silc_none_decrypt @ 504 ;\r
+       silc_none_encrypt @ 505 ;\r
+       silc_none_set_iv @ 506 ;\r
+       silc_none_set_key @ 507 ;\r
+       silc_sha1_context_len @ 508 ;\r
+       silc_sha1_final @ 509 ;\r
+       silc_sha1_init @ 510 ;\r
+       silc_sha1_transform @ 511 ;\r
+       silc_sha1_update @ 512 ;\r
+       silc_pkcs_algorithm_register @ 513 ;\r
+       silc_pkcs_algorithm_unregister @ 514 ;\r
+       silc_pkcs_decrypt @ 515 ;\r
+       silc_pkcs_encrypt @ 516 ;\r
+       silc_pkcs_find_algorithm @ 517 ;\r
+       silc_pkcs_find_pkcs @ 518 ;\r
+       silc_pkcs_get_algorithm @ 519 ;\r
+       silc_pkcs_get_context @ 520 ;\r
+       silc_pkcs_get_name @ 521 ;\r
+       silc_pkcs_get_pkcs @ 522 ;\r
+       silc_pkcs_get_supported @ 523 ;\r
+       silc_pkcs_get_type @ 524 ;\r
+       silc_pkcs_load_private_key @ 525 ;\r
+       silc_pkcs_load_public_key @ 526 ;\r
+       silc_pkcs_private_key_alloc @ 527 ;\r
+       silc_pkcs_private_key_free @ 528 ;\r
+       silc_pkcs_private_key_get_len @ 529 ;\r
+       silc_pkcs_public_key_alloc @ 530 ;\r
+       silc_pkcs_public_key_compare @ 531 ;\r
+       silc_pkcs_public_key_copy @ 532 ;\r
+       silc_pkcs_public_key_encode @ 533 ;\r
+       silc_pkcs_public_key_free @ 534 ;\r
+       silc_pkcs_public_key_get_len @ 535 ;\r
+       silc_pkcs_register @ 536 ;\r
+       silc_pkcs_register_default @ 537 ;\r
+       silc_pkcs_save_private_key @ 538 ;\r
+       silc_pkcs_save_public_key @ 539 ;\r
+       silc_pkcs_sign @ 540 ;\r
+       silc_pkcs_unregister @ 541 ;\r
+       silc_pkcs_unregister_all @ 542 ;\r
+       silc_pkcs_verify @ 543 ;\r
+       silc_hash_alloc @ 544 ;\r
+       silc_hash_alloc_by_oid @ 545 ;\r
+       silc_hash_babbleprint @ 546 ;\r
+       silc_hash_block_len @ 547 ;\r
+       silc_hash_final @ 548 ;\r
+       silc_hash_fingerprint @ 549 ;\r
+       silc_hash_free @ 550 ;\r
+       silc_hash_get_name @ 551 ;\r
+       silc_hash_get_oid @ 552 ;\r
+       silc_hash_get_supported @ 553 ;\r
+       silc_hash_init @ 554 ;\r
+       silc_hash_is_supported @ 555 ;\r
+       silc_hash_len @ 556 ;\r
+       silc_hash_make @ 557 ;\r
+       silc_hash_register @ 558 ;\r
+       silc_hash_register_default @ 559 ;\r
+       silc_hash_transform @ 560 ;\r
+       silc_hash_unregister @ 561 ;\r
+       silc_hash_unregister_all @ 562 ;\r
+       silc_hash_update @ 563 ;\r
+       silc_aes_cbc_context_len @ 564 ;\r
+       silc_aes_cbc_decrypt @ 565 ;\r
+       silc_aes_cbc_encrypt @ 566 ;\r
+       silc_aes_cbc_set_iv @ 567 ;\r
+       silc_aes_cbc_set_key @ 568 ;\r
+       silc_aes_ctr_context_len @ 569 ;\r
+       silc_aes_ctr_decrypt @ 570 ;\r
+       silc_aes_ctr_encrypt @ 571 ;\r
+       silc_aes_ctr_set_iv @ 572 ;\r
+       silc_aes_ctr_set_key @ 573 ;\r
+       silc_pkcs1_decode @ 574 ;\r
+       silc_pkcs1_decrypt @ 575 ;\r
+       silc_pkcs1_encode @ 576 ;\r
+       silc_pkcs1_encrypt @ 577 ;\r
+       silc_pkcs1_export_private_key @ 578 ;\r
+       silc_pkcs1_export_public_key @ 579 ;\r
+       silc_pkcs1_generate_key @ 580 ;\r
+       silc_pkcs1_import_private_key @ 581 ;\r
+       silc_pkcs1_import_public_key @ 582 ;\r
+       silc_pkcs1_private_key_bitlen @ 583 ;\r
+       silc_pkcs1_private_key_free @ 584 ;\r
+       silc_pkcs1_public_key_bitlen @ 585 ;\r
+       silc_pkcs1_public_key_compare @ 586 ;\r
+       silc_pkcs1_public_key_copy @ 587 ;\r
+       silc_pkcs1_public_key_free @ 588 ;\r
+       silc_pkcs1_sign @ 589 ;\r
+       silc_pkcs1_sign_no_oid @ 590 ;\r
+       silc_pkcs1_verify @ 591 ;\r
+       silc_pkcs1_verify_no_oid @ 592 ;\r
+       silc_cipher_alloc @ 598 ;\r
+       silc_cipher_decrypt @ 599 ;\r
+       silc_cipher_encrypt @ 600 ;\r
+       silc_cipher_free @ 601 ;\r
+       silc_cipher_get_block_len @ 602 ;\r
+       silc_cipher_get_iv @ 603 ;\r
+       silc_cipher_get_iv_len @ 604 ;\r
+       silc_cipher_get_key_len @ 605 ;\r
+       silc_cipher_get_mode @ 606 ;\r
+       silc_cipher_get_name @ 607 ;\r
+       silc_cipher_get_supported @ 608 ;\r
+       silc_cipher_is_supported @ 609 ;\r
+       silc_cipher_register @ 610 ;\r
+       silc_cipher_register_default @ 611 ;\r
+       silc_cipher_set_iv @ 612 ;\r
+       silc_cipher_set_key @ 613 ;\r
+       silc_cipher_unregister @ 614 ;\r
+       silc_cipher_unregister_all @ 615 ;\r
+       silc_md5_context_len @ 616 ;\r
+       silc_md5_final @ 617 ;\r
+       silc_md5_init @ 618 ;\r
+       silc_md5_transform @ 619 ;\r
+       silc_md5_update @ 620 ;\r
+       silc_rsa_generate_keys @ 621 ;\r
+       silc_rsa_private_operation @ 622 ;\r
+       silc_rsa_public_operation @ 623 ;\r
+       silc_blowfish_cbc_context_len @ 624 ;\r
+       silc_blowfish_cbc_decrypt @ 625 ;\r
+       silc_blowfish_cbc_encrypt @ 626 ;\r
+       silc_blowfish_cbc_set_iv @ 627 ;\r
+       silc_blowfish_cbc_set_key @ 628 ;\r
+       silc_twofish_cbc_context_len @ 629 ;\r
+       silc_twofish_cbc_decrypt @ 630 ;\r
+       silc_twofish_cbc_encrypt @ 631 ;\r
+       silc_twofish_cbc_set_iv @ 632 ;\r
+       silc_twofish_cbc_set_key @ 633 ;\r
+       silc_hmac_alloc @ 634 ;\r
+       silc_hmac_final @ 635 ;\r
+       silc_hmac_free @ 636 ;\r
+       silc_hmac_get_hash @ 637 ;\r
+       silc_hmac_get_key @ 638 ;\r
+       silc_hmac_get_name @ 639 ;\r
+       silc_hmac_get_supported @ 640 ;\r
+       silc_hmac_init @ 641 ;\r
+       silc_hmac_init_with_key @ 642 ;\r
+       silc_hmac_is_supported @ 643 ;\r
+       silc_hmac_len @ 644 ;\r
+       silc_hmac_make @ 645 ;\r
+       silc_hmac_make_truncated @ 646 ;\r
+       silc_hmac_make_with_key @ 647 ;\r
+       silc_hmac_register @ 648 ;\r
+       silc_hmac_register_default @ 649 ;\r
+       silc_hmac_set_key @ 650 ;\r
+       silc_hmac_unregister @ 651 ;\r
+       silc_hmac_unregister_all @ 652 ;\r
+       silc_hmac_update @ 653 ;\r
+       silc_rng_add_noise @ 654 ;\r
+       silc_rng_alloc @ 655 ;\r
+       silc_rng_free @ 656 ;\r
+       silc_rng_get_byte @ 657 ;\r
+       silc_rng_get_byte_fast @ 658 ;\r
+       silc_rng_get_rn16 @ 659 ;\r
+       silc_rng_get_rn32 @ 660 ;\r
+       silc_rng_get_rn_data @ 661 ;\r
+       silc_rng_get_rn_string @ 662 ;\r
+       silc_rng_global_add_noise @ 663 ;\r
+       silc_rng_global_get_byte @ 664 ;\r
+       silc_rng_global_get_byte_fast @ 665 ;\r
+       silc_rng_global_get_rn16 @ 666 ;\r
+       silc_rng_global_get_rn32 @ 667 ;\r
+       silc_rng_global_get_rn_data @ 668 ;\r
+       silc_rng_global_get_rn_string @ 669 ;\r
+       silc_rng_global_init @ 670 ;\r
+       silc_rng_global_uninit @ 671 ;\r
+       silc_rng_init @ 672 ;\r
+       silc_pkcs_silc_decode_identifier @ 673 ;\r
+       silc_pkcs_silc_decrypt @ 674 ;\r
+       silc_pkcs_silc_encode_identifier @ 675 ;\r
+       silc_pkcs_silc_encrypt @ 676 ;\r
+       silc_pkcs_silc_export_private_key @ 677 ;\r
+       silc_pkcs_silc_export_private_key_file @ 678 ;\r
+       silc_pkcs_silc_export_public_key @ 679 ;\r
+       silc_pkcs_silc_export_public_key_file @ 680 ;\r
+       silc_pkcs_silc_generate_key @ 681 ;\r
+       silc_pkcs_silc_get_algorithm @ 682 ;\r
+       silc_pkcs_silc_import_private_key @ 683 ;\r
+       silc_pkcs_silc_import_private_key_file @ 684 ;\r
+       silc_pkcs_silc_import_public_key @ 685 ;\r
+       silc_pkcs_silc_import_public_key_file @ 686 ;\r
+       silc_pkcs_silc_private_key_bitlen @ 687 ;\r
+       silc_pkcs_silc_private_key_free @ 688 ;\r
+       silc_pkcs_silc_public_key_bitlen @ 689 ;\r
+       silc_pkcs_silc_public_key_compare @ 690 ;\r
+       silc_pkcs_silc_public_key_copy @ 691 ;\r
+       silc_pkcs_silc_public_key_free @ 692 ;\r
+       silc_pkcs_silc_public_key_version @ 693 ;\r
+       silc_pkcs_silc_sign @ 694 ;\r
+       silc_pkcs_silc_verify @ 695 ;\r
+       silc_skr_add_public_key @ 696 ;\r
+       silc_skr_add_public_key_simple @ 697 ;\r
+       silc_skr_alloc @ 698 ;\r
+       silc_skr_del_public_key @ 699 ;\r
+       silc_skr_find @ 700 ;\r
+       silc_skr_find_alloc @ 701 ;\r
+       silc_skr_find_free @ 702 ;\r
+       silc_skr_find_set_context @ 703 ;\r
+       silc_skr_find_set_country @ 704 ;\r
+       silc_skr_find_set_email @ 705 ;\r
+       silc_skr_find_set_host @ 706 ;\r
+       silc_skr_find_set_org @ 707 ;\r
+       silc_skr_find_set_pkcs_type @ 708 ;\r
+       silc_skr_find_set_public_key @ 709 ;\r
+       silc_skr_find_set_realname @ 710 ;\r
+       silc_skr_find_set_usage @ 711 ;\r
+       silc_skr_find_set_username @ 712 ;\r
+       silc_skr_free @ 713 ;\r
+       silc_skr_init @ 714 ;\r
+       silc_skr_ref_public_key @ 715 ;\r
+       silc_skr_uninit @ 716 ;\r
+       silc_skr_unref_public_key @ 717 ;\r
+       silc_mp_abs @ 718 ;\r
+       silc_mp_add @ 719 ;\r
+       silc_mp_add_ui @ 720 ;\r
+       silc_mp_and @ 721 ;\r
+       silc_mp_cmp @ 722 ;\r
+       silc_mp_cmp_si @ 723 ;\r
+       silc_mp_cmp_ui @ 724 ;\r
+       silc_mp_div @ 725 ;\r
+       silc_mp_div_2exp @ 726 ;\r
+       silc_mp_div_2exp_qr @ 727 ;\r
+       silc_mp_div_qr @ 728 ;\r
+       silc_mp_div_ui @ 729 ;\r
+       silc_mp_gcd @ 730 ;\r
+       silc_mp_gcdext @ 731 ;\r
+       silc_mp_get_str @ 732 ;\r
+       silc_mp_get_ui @ 733 ;\r
+       silc_mp_init @ 734 ;\r
+       silc_mp_mod @ 735 ;\r
+       silc_mp_mod_2exp @ 736 ;\r
+       silc_mp_mod_ui @ 737 ;\r
+       silc_mp_mul @ 738 ;\r
+       silc_mp_mul_2exp @ 739 ;\r
+       silc_mp_mul_ui @ 740 ;\r
+       silc_mp_neg @ 741 ;\r
+       silc_mp_or @ 742 ;\r
+       silc_mp_pow @ 743 ;\r
+       silc_mp_pow_mod @ 744 ;\r
+       silc_mp_pow_mod_ui @ 745 ;\r
+       silc_mp_pow_ui @ 746 ;\r
+       silc_mp_set @ 747 ;\r
+       silc_mp_set_si @ 748 ;\r
+       silc_mp_set_str @ 749 ;\r
+       silc_mp_set_ui @ 750 ;\r
+       silc_mp_sinit @ 751 ;\r
+       silc_mp_size @ 752 ;\r
+       silc_mp_sizeinbase @ 753 ;\r
+       silc_mp_sqrt @ 754 ;\r
+       silc_mp_sub @ 755 ;\r
+       silc_mp_sub_ui @ 756 ;\r
+       silc_mp_uninit @ 757 ;\r
+       silc_mp_xor @ 758 ;\r
+       silc_math_gen_prime @ 759 ;\r
+       silc_math_prime_test @ 760 ;\r
+       silc_mp_bin2mp @ 761 ;\r
+       silc_mp_mp2bin @ 762 ;\r
+       silc_mp_mp2bin_noalloc @ 763 ;\r
+       silc_mp_modinv @ 764 ;\r
+       silc_asn1_encode @ 772 ;\r
+       silc_asn1_alloc @ 773 ;\r
+       silc_asn1_free @ 775 ;\r
+       silc_asn1_init @ 776 ;\r
+       silc_asn1_uninit @ 778 ;\r
+       silc_asn1_decode @ 779 ;\r
+       silc_ber_decode @ 780 ;\r
+       silc_ber_encode @ 781 ;\r
+       silc_ber_encoded_len @ 782 ;\r
+       silc_connauth_alloc @ 783 ;\r
+       silc_connauth_free @ 784 ;\r
+       silc_connauth_get_ske @ 785 ;\r
+       silc_connauth_initiator @ 786 ;\r
+       silc_connauth_responder @ 787 ;\r
+       silc_connauth_timeout @ 788 ;\r
+       silc_ske_alloc @ 789 ;\r
+       silc_ske_free @ 790 ;\r
+       silc_ske_free_key_material @ 791 ;\r
+       silc_ske_free_rekey_material @ 792 ;\r
+       silc_ske_get_context @ 793 ;\r
+       silc_ske_get_key_material @ 794 ;\r
+       silc_ske_get_security_properties @ 795 ;\r
+       silc_ske_initiator @ 796 ;\r
+       silc_ske_map_status @ 797 ;\r
+       silc_ske_packet_send_retry @ 798 ;\r
+       silc_ske_parse_version @ 799 ;\r
+       silc_ske_process_key_material @ 800 ;\r
+       silc_ske_process_key_material_data @ 801 ;\r
+       silc_ske_rekey_initiator @ 802 ;\r
+       silc_ske_rekey_responder @ 803 ;\r
+       silc_ske_responder @ 804 ;\r
+       silc_ske_set_callbacks @ 805 ;\r
+       silc_ske_set_keys @ 806 ;\r
+       silc_ske_payload_ke_decode @ 807 ;\r
+       silc_ske_payload_ke_encode @ 808 ;\r
+       silc_ske_payload_ke_free @ 809 ;\r
+       silc_ske_payload_start_decode @ 810 ;\r
+       silc_ske_payload_start_encode @ 811 ;\r
+       silc_ske_payload_start_free @ 812 ;\r
+       silc_ske_get_supported_groups @ 813 ;\r
+       silc_ske_group_free @ 814 ;\r
+       silc_ske_group_get_by_name @ 815 ;\r
+       silc_ske_group_get_by_number @ 816 ;\r
+       silc_ske_group_get_name @ 817 ;\r
+       silc_ske_group_get_number @ 818 ;\r
+       silc_http_php @ 819 ;\r
+       silc_http_php_file @ 820 ;\r
+       silc_http_server_add_header @ 821 ;\r
+       silc_http_server_alloc @ 822 ;\r
+       silc_http_server_free @ 823 ;\r
+       silc_http_server_get_header @ 824 ;\r
+       silc_http_server_send @ 825 ;\r
+       silc_http_server_send_error @ 826 ;\r
+       silc_sftp_fs_memory_add_dir @ 827 ;\r
+       silc_sftp_fs_memory_add_file @ 828 ;\r
+       silc_sftp_fs_memory_alloc @ 829 ;\r
+       silc_sftp_fs_memory_del_dir @ 830 ;\r
+       silc_sftp_fs_memory_del_file @ 831 ;\r
+       silc_sftp_fs_memory_free @ 832 ;\r
+       silc_sftp_attr_decode @ 833 ;\r
+       silc_sftp_attr_encode @ 834 ;\r
+       silc_sftp_attr_free @ 835 ;\r
+       silc_sftp_map_errno @ 836 ;\r
+       silc_sftp_name_add @ 837 ;\r
+       silc_sftp_name_decode @ 838 ;\r
+       silc_sftp_name_encode @ 839 ;\r
+       silc_sftp_name_free @ 840 ;\r
+       silc_sftp_packet_decode @ 841 ;\r
+       silc_sftp_packet_encode @ 842 ;\r
+       silc_sftp_packet_encode_vp @ 843 ;\r
+       silc_sftp_client_shutdown @ 844 ;\r
+       silc_sftp_client_start @ 845 ;\r
+       silc_sftp_close @ 846 ;\r
+       silc_sftp_extended @ 847 ;\r
+       silc_sftp_fsetstat @ 848 ;\r
+       silc_sftp_fstat @ 849 ;\r
+       silc_sftp_lstat @ 850 ;\r
+       silc_sftp_mkdir @ 851 ;\r
+       silc_sftp_open @ 852 ;\r
+       silc_sftp_opendir @ 853 ;\r
+       silc_sftp_read @ 854 ;\r
+       silc_sftp_readdir @ 855 ;\r
+       silc_sftp_readlink @ 856 ;\r
+       silc_sftp_realpath @ 857 ;\r
+       silc_sftp_remove @ 858 ;\r
+       silc_sftp_rename @ 859 ;\r
+       silc_sftp_rmdir @ 860 ;\r
+       silc_sftp_setstat @ 861 ;\r
+       silc_sftp_stat @ 862 ;\r
+       silc_sftp_symlink @ 863 ;\r
+       silc_sftp_write @ 864 ;\r
+       silc_sftp_server_set_monitor @ 865 ;\r
+       silc_sftp_server_shutdown @ 866 ;\r
+       silc_sftp_server_start @ 867 ;\r
+       silc_vcard_alloc @ 868 ;\r
+       silc_vcard_decode @ 869 ;\r
+       silc_vcard_encode @ 870 ;\r
+       silc_vcard_fprintf @ 871 ;\r
+       silc_vcard_free @ 872 ;\r
+       silc_utf8_c2w @ 873 ;\r
+       silc_utf8_w2c @ 874 ;\r
+       silc_packet_engine_free_streams_list @ 875 ;\r
+       silc_schedule_set_notify @ 876 ;\r
+\r
index c921afe5e7e22c9dbe11eddf1daba4030bf7c0ce..d05533d00314ef53cb42882b17df4d9646fcf606 100644 (file)
@@ -305,10 +305,6 @@ SOURCE=..\..\lib\silccrypt\blowfish.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\..\lib\silccrypt\cast.c\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=..\..\lib\silccrypt\md5.c\r
 # End Source File\r
 # Begin Source File\r
@@ -317,10 +313,6 @@ SOURCE=..\..\lib\silccrypt\none.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\..\lib\silccrypt\rc5.c\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=..\..\lib\silccrypt\rsa.c\r
 # End Source File\r
 # Begin Source File\r
@@ -753,14 +745,6 @@ SOURCE=..\..\lib\silccrypt\blowfish_internal.h
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\..\lib\silccrypt\cast.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\lib\silccrypt\cast_internal.h\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=..\..\lib\silccrypt\ciphers.h\r
 # End Source File\r
 # Begin Source File\r
@@ -781,14 +765,6 @@ SOURCE=..\..\lib\silccrypt\none.h
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\..\lib\silccrypt\rc5.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\lib\silccrypt\rc5_internal.h\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=..\..\lib\silccrypt\rijndael_internal.h\r
 # End Source File\r
 # Begin Source File\r