[Pkg-silc-commits] r324 - in /silc-toolkit/trunk: ./ apps/ debian/ doc/ doc/toolkit/ includes/ lib/ lib/contrib/ lib/silcapputil/ lib/silcasn1/ lib/silcclient/ lib/silccore/ lib/silccrypt/ lib/silchttp/ lib/silcmath/ lib/silcsftp/ lib/silcsim/ lib/silcske/ lib/silcskr/ lib/silcutil/ lib/silcutil/unix/ lib/silcvcard/
micah at users.alioth.debian.org
micah at users.alioth.debian.org
Mon Nov 24 16:25:55 UTC 2008
Author: micah
Date: Mon Nov 24 16:25:55 2008
New Revision: 324
URL: http://svn.debian.org/wsvn/pkg-silc/?sc=1&rev=324
Log:
upgrade silc-toolkit to 1.1.18
Added:
silc-toolkit/trunk/ChangeLog
- copied unchanged from r323, silc-toolkit/branches/upstream/current/ChangeLog
Removed:
silc-toolkit/trunk/CHANGES
Modified:
silc-toolkit/trunk/Makefile.am
silc-toolkit/trunk/Makefile.in
silc-toolkit/trunk/apps/Makefile.am
silc-toolkit/trunk/apps/Makefile.in
silc-toolkit/trunk/configure
silc-toolkit/trunk/configure.ac
silc-toolkit/trunk/debian/changelog
silc-toolkit/trunk/doc/Makefile.am
silc-toolkit/trunk/doc/Makefile.in
silc-toolkit/trunk/doc/toolkit/index.html
silc-toolkit/trunk/doc/toolkit/silctypes-SilcUInt32.html
silc-toolkit/trunk/includes/Makefile.am
silc-toolkit/trunk/includes/Makefile.in
silc-toolkit/trunk/includes/silcdistdefs.h
silc-toolkit/trunk/lib/Makefile.am
silc-toolkit/trunk/lib/Makefile.in
silc-toolkit/trunk/lib/contrib/Makefile.am
silc-toolkit/trunk/lib/contrib/Makefile.in
silc-toolkit/trunk/lib/silcapputil/Makefile.am
silc-toolkit/trunk/lib/silcapputil/Makefile.in
silc-toolkit/trunk/lib/silcapputil/silcidcache.c
silc-toolkit/trunk/lib/silcasn1/Makefile.am
silc-toolkit/trunk/lib/silcasn1/Makefile.in
silc-toolkit/trunk/lib/silcasn1/silcasn1.c
silc-toolkit/trunk/lib/silcasn1/silcasn1_encode.c
silc-toolkit/trunk/lib/silcclient/Makefile.am
silc-toolkit/trunk/lib/silcclient/Makefile.in
silc-toolkit/trunk/lib/silcclient/client.c
silc-toolkit/trunk/lib/silcclient/client.h
silc-toolkit/trunk/lib/silcclient/client_channel.c
silc-toolkit/trunk/lib/silcclient/client_entry.c
silc-toolkit/trunk/lib/silcclient/client_internal.h
silc-toolkit/trunk/lib/silcclient/client_notify.c
silc-toolkit/trunk/lib/silcclient/client_register.c
silc-toolkit/trunk/lib/silcclient/command.c
silc-toolkit/trunk/lib/silcclient/command_reply.c
silc-toolkit/trunk/lib/silccore/Makefile.am
silc-toolkit/trunk/lib/silccore/Makefile.in
silc-toolkit/trunk/lib/silccore/silcpacket.c
silc-toolkit/trunk/lib/silccore/silcpacket.h
silc-toolkit/trunk/lib/silccrypt/Makefile.am
silc-toolkit/trunk/lib/silccrypt/Makefile.in
silc-toolkit/trunk/lib/silccrypt/aes_x86.asm
silc-toolkit/trunk/lib/silccrypt/aes_x86_64.asm
silc-toolkit/trunk/lib/silchttp/Makefile.am
silc-toolkit/trunk/lib/silchttp/Makefile.in
silc-toolkit/trunk/lib/silcmath/Makefile.am
silc-toolkit/trunk/lib/silcmath/Makefile.in
silc-toolkit/trunk/lib/silcsftp/Makefile.am
silc-toolkit/trunk/lib/silcsftp/Makefile.in
silc-toolkit/trunk/lib/silcsim/Makefile.am
silc-toolkit/trunk/lib/silcsim/Makefile.in
silc-toolkit/trunk/lib/silcske/Makefile.am
silc-toolkit/trunk/lib/silcske/Makefile.in
silc-toolkit/trunk/lib/silcske/silcske.c
silc-toolkit/trunk/lib/silcskr/Makefile.am
silc-toolkit/trunk/lib/silcskr/Makefile.in
silc-toolkit/trunk/lib/silcskr/silcskr.c
silc-toolkit/trunk/lib/silcutil/Makefile.am
silc-toolkit/trunk/lib/silcutil/Makefile.in
silc-toolkit/trunk/lib/silcutil/silcfdstream.c
silc-toolkit/trunk/lib/silcutil/silcsocketstream.c
silc-toolkit/trunk/lib/silcutil/silcsocketstream_i.h
silc-toolkit/trunk/lib/silcutil/silcstack.c
silc-toolkit/trunk/lib/silcutil/silctypes.h
silc-toolkit/trunk/lib/silcutil/silcutil.c
silc-toolkit/trunk/lib/silcutil/stacktrace.c
silc-toolkit/trunk/lib/silcutil/stacktrace.h
silc-toolkit/trunk/lib/silcutil/unix/silcunixschedule.c
silc-toolkit/trunk/lib/silcutil/unix/silcunixsocketstream.c
silc-toolkit/trunk/lib/silcvcard/Makefile.am
silc-toolkit/trunk/lib/silcvcard/Makefile.in
silc-toolkit/trunk/silc-toolkit.spec
Modified: silc-toolkit/trunk/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/Makefile.am (original)
+++ silc-toolkit/trunk/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./Makefile.ad file in the source tree.
# Source: ./Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
@@ -27,7 +27,7 @@
SUBDIRS = @LIBSUBDIR@ apps win32 includes doc
-EXTRA_DIST = silcdefs.h.in silc-toolkit.spec symbian libtoolfix CHANGES CREDITS
+EXTRA_DIST = silcdefs.h.in silc-toolkit.spec symbian libtoolfix CREDITS
include $(top_srcdir)/Makefile.defines.in
Modified: silc-toolkit/trunk/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/Makefile.in (original)
+++ silc-toolkit/trunk/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./Makefile.ad file in the source tree.
# Source: ./Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
@@ -101,9 +101,9 @@
$(top_srcdir)/configure \
$(top_srcdir)/tutorial/Makefile.defines.in \
$(top_srcdir)/tutorial/Makefile.defines_int.in \
- $(top_srcdir)/tutorial/Makefile.in COPYING INSTALL TODO \
- config.guess config.sub depcomp install-sh ltmain.sh missing \
- mkinstalldirs
+ $(top_srcdir)/tutorial/Makefile.in COPYING ChangeLog INSTALL \
+ TODO config.guess config.sub depcomp install-sh ltmain.sh \
+ missing mkinstalldirs
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -289,7 +289,7 @@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = 1.0 no-dependencies foreign
SUBDIRS = @LIBSUBDIR@ apps win32 includes doc
-EXTRA_DIST = silcdefs.h.in silc-toolkit.spec symbian libtoolfix CHANGES CREDITS
+EXTRA_DIST = silcdefs.h.in silc-toolkit.spec symbian libtoolfix CREDITS
#
# INCLUDE defines
Modified: silc-toolkit/trunk/apps/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/apps/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/apps/Makefile.am (original)
+++ silc-toolkit/trunk/apps/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./apps/Makefile.ad file in the source tree.
# Source: ./apps/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/apps/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/apps/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/apps/Makefile.in (original)
+++ silc-toolkit/trunk/apps/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./apps/Makefile.ad file in the source tree.
# Source: ./apps/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/configure
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/configure?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/configure (original)
+++ silc-toolkit/trunk/configure Mon Nov 24 16:25:55 2008
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for Toolkit 1.1.7.
+# Generated by GNU Autoconf 2.61 for Toolkit 1.1.8.
#
# Report bugs to <silc-devel at lists.silcnet.org>.
#
@@ -728,8 +728,8 @@
# Identity of this package.
PACKAGE_NAME='Toolkit'
PACKAGE_TARNAME='silc-toolkit'
-PACKAGE_VERSION='1.1.7'
-PACKAGE_STRING='Toolkit 1.1.7'
+PACKAGE_VERSION='1.1.8'
+PACKAGE_STRING='Toolkit 1.1.8'
PACKAGE_BUGREPORT='silc-devel at lists.silcnet.org'
# Factoring default headers for most tests.
@@ -1467,7 +1467,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures Toolkit 1.1.7 to adapt to many kinds of systems.
+\`configure' configures Toolkit 1.1.8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1538,7 +1538,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of Toolkit 1.1.7:";;
+ short | recursive ) echo "Configuration of Toolkit 1.1.8:";;
esac
cat <<\_ACEOF
@@ -1653,7 +1653,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-Toolkit configure 1.1.7
+Toolkit configure 1.1.8
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1667,7 +1667,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by Toolkit $as_me 1.1.7, which was
+It was created by Toolkit $as_me 1.1.8, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2483,7 +2483,7 @@
# Define the identity of the package.
PACKAGE='silc-toolkit'
- VERSION='1.1.7'
+ VERSION='1.1.8'
cat >>confdefs.h <<_ACEOF
@@ -31146,6 +31146,8 @@
#define SILC_STACKTRACE
_ACEOF
+ CFLAGS="$CFLAGS -rdynamic"
+ PC_CFLAGS="$PC_CFLAGS -rdynamic"
;;
*)
{ echo "$as_me:$LINENO: result: no" >&5
@@ -31782,7 +31784,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by Toolkit $as_me 1.1.7, which was
+This file was extended by Toolkit $as_me 1.1.8, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -31835,7 +31837,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-Toolkit config.status 1.1.7
+Toolkit config.status 1.1.8
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
Modified: silc-toolkit/trunk/configure.ac
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/configure.ac?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/configure.ac (original)
+++ silc-toolkit/trunk/configure.ac Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the configure.ad file in the source tree.
# Source: configure.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
@@ -23,7 +23,7 @@
# information.
#
-AC_INIT([Toolkit], [1.1.7], [silc-devel at lists.silcnet.org], [silc-toolkit])
+AC_INIT([Toolkit], [1.1.8], [silc-devel at lists.silcnet.org], [silc-toolkit])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE
AC_PREREQ(2.52)
@@ -1494,6 +1494,8 @@
yes)
AC_MSG_RESULT(yes)
AC_DEFINE([SILC_STACKTRACE], [], [SILC_STACKTRACE])
+ CFLAGS="$CFLAGS -rdynamic"
+ PC_CFLAGS="$PC_CFLAGS -rdynamic"
;;
*)
AC_MSG_RESULT(no)
Modified: silc-toolkit/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/debian/changelog?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/debian/changelog (original)
+++ silc-toolkit/trunk/debian/changelog Mon Nov 24 16:25:55 2008
@@ -1,9 +1,12 @@
-silc-toolkit (1.1.7-3) UNRELEASED; urgency=low
+silc-toolkit (1.1.8-1) UNRELEASED; urgency=low
[ Daniel Kahn Gillmor ]
* cleaning up debian/control. Thanks, Lintian!
- -- Daniel Kahn Gillmor <dkg at fifthhorseman.net> Tue, 02 Sep 2008 13:27:21 -0400
+ [ Micah Anderson ]
+ * New upstream release
+
+ -- Micah Anderson <micah at debian.org> Mon, 24 Nov 2008 11:24:42 -0500
silc-toolkit (1.1.7-2) unstable; urgency=low
Modified: silc-toolkit/trunk/doc/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/doc/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/doc/Makefile.am (original)
+++ silc-toolkit/trunk/doc/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./doc/Makefile.ad file in the source tree.
# Source: ./doc/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/doc/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/doc/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/doc/Makefile.in (original)
+++ silc-toolkit/trunk/doc/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./doc/Makefile.ad file in the source tree.
# Source: ./doc/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/doc/toolkit/index.html
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/doc/toolkit/index.html?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/doc/toolkit/index.html (original)
+++ silc-toolkit/trunk/doc/toolkit/index.html Mon Nov 24 16:25:55 2008
@@ -63,9 +63,9 @@
<big><b>SILC Toolkit Reference Manual</b></big>
<br />
<small>
-Version: 1.1.7<br />
+Version: 1.1.8<br />
Copyright © 1997 - 2007 The SILC Project<br />
-Updated: Thu Mar 20 08:43:07 EET 2008
+Updated: Sat Oct 25 17:28:37 EEST 2008
</small>
<br /><br /><br />
Welcome to the SILC Toolkit Reference Manual. The manual is a complete
Modified: silc-toolkit/trunk/doc/toolkit/silctypes-SilcUInt32.html
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/doc/toolkit/silctypes-SilcUInt32.html?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/doc/toolkit/silctypes-SilcUInt32.html (original)
+++ silc-toolkit/trunk/doc/toolkit/silctypes-SilcUInt32.html Mon Nov 24 16:25:55 2008
@@ -171,13 +171,13 @@
</FONT></PRE><FONT SIZE="+1"><B>
<FONT COLOR="#000055">SOURCE
</FONT></B></FONT>
-<PRE><FONT FACE="courier" size="3"> #if SILC_SIZEOF_LONG == 4
+<PRE><FONT FACE="courier" size="3"> #if SILC_SIZEOF_INT == 4
+ typedef unsigned int <B>SilcUInt32</B>;
+ typedef signed int <A HREF="silctypes-SilcInt32.html">SilcInt32</A>;
+ #else
+ #if SILC_SIZEOF_LONG == 4
typedef unsigned long <B>SilcUInt32</B>;
typedef signed long <A HREF="silctypes-SilcInt32.html">SilcInt32</A>;
- #else
- #if SILC_SIZEOF_INT == 4
- typedef unsigned int <B>SilcUInt32</B>;
- typedef signed int <A HREF="silctypes-SilcInt32.html">SilcInt32</A>;
#else
#if SILC_SIZEOF_LONG_LONG >= 4
#ifndef WIN32
Modified: silc-toolkit/trunk/includes/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/includes/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/includes/Makefile.am (original)
+++ silc-toolkit/trunk/includes/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./includes/Makefile.ad file in the source tree.
# Source: ./includes/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/includes/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/includes/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/includes/Makefile.in (original)
+++ silc-toolkit/trunk/includes/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./includes/Makefile.ad file in the source tree.
# Source: ./includes/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/includes/silcdistdefs.h
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/includes/silcdistdefs.h?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/includes/silcdistdefs.h (original)
+++ silc-toolkit/trunk/includes/silcdistdefs.h Mon Nov 24 16:25:55 2008
@@ -1,7 +1,7 @@
/*
Automatically generated by Autodist 1.4. Do not edit.
- Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+ Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
Distribution: Toolkit
License: distdir/TOOLKIT
*/
Modified: silc-toolkit/trunk/lib/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/Makefile.am (original)
+++ silc-toolkit/trunk/lib/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/Makefile.ad file in the source tree.
# Source: ./lib/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/Makefile.in (original)
+++ silc-toolkit/trunk/lib/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/Makefile.ad file in the source tree.
# Source: ./lib/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/contrib/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/contrib/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/contrib/Makefile.am (original)
+++ silc-toolkit/trunk/lib/contrib/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/contrib/Makefile.ad file in the source tree.
# Source: ./lib/contrib/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/contrib/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/contrib/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/contrib/Makefile.in (original)
+++ silc-toolkit/trunk/lib/contrib/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/contrib/Makefile.ad file in the source tree.
# Source: ./lib/contrib/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcapputil/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcapputil/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcapputil/Makefile.am (original)
+++ silc-toolkit/trunk/lib/silcapputil/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/silcapputil/Makefile.ad file in the source tree.
# Source: ./lib/silcapputil/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcapputil/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcapputil/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcapputil/Makefile.in (original)
+++ silc-toolkit/trunk/lib/silcapputil/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/silcapputil/Makefile.ad file in the source tree.
# Source: ./lib/silcapputil/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcapputil/silcidcache.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcapputil/silcidcache.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcapputil/silcidcache.c (original)
+++ silc-toolkit/trunk/lib/silcapputil/silcidcache.c Mon Nov 24 16:25:55 2008
@@ -142,9 +142,8 @@
if (id) {
/* See if this entry is added already to cache */
if (silc_idcache_find_by_id_one(cache, id, NULL)) {
- SILC_LOG_ERROR(("Attempted to add same ID twice to ID Cache, id %s",
+ SILC_LOG_DEBUG(("Attempted to add same ID twice to ID Cache, id %s",
silc_id_render(id, cache->id_type)));
- SILC_ASSERT(FALSE);
goto err;
}
}
Modified: silc-toolkit/trunk/lib/silcasn1/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcasn1/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcasn1/Makefile.am (original)
+++ silc-toolkit/trunk/lib/silcasn1/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/silcasn1/Makefile.ad file in the source tree.
# Source: ./lib/silcasn1/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcasn1/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcasn1/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcasn1/Makefile.in (original)
+++ silc-toolkit/trunk/lib/silcasn1/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/silcasn1/Makefile.ad file in the source tree.
# Source: ./lib/silcasn1/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcasn1/silcasn1.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcasn1/silcasn1.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcasn1/silcasn1.c (original)
+++ silc-toolkit/trunk/lib/silcasn1/silcasn1.c Mon Nov 24 16:25:55 2008
@@ -53,7 +53,7 @@
asn1->stack2 = silc_stack_alloc(768);
if (!asn1->stack2) {
- silc_stack_free(asn1->stack2);
+ silc_stack_free(asn1->stack1);
return FALSE;
}
Modified: silc-toolkit/trunk/lib/silcasn1/silcasn1_encode.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcasn1/silcasn1_encode.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcasn1/silcasn1_encode.c (original)
+++ silc-toolkit/trunk/lib/silcasn1/silcasn1_encode.c Mon Nov 24 16:25:55 2008
@@ -351,7 +351,7 @@
/* Get OID words from the string */
cp = strchr(oidstr, '.');
while (cp) {
- if (sscanf(oidstr, "%lu", (unsigned long *)&oid) != 1) {
+ if (sscanf(oidstr, "%u", &oid) != 1) {
SILC_LOG_DEBUG(("Malformed OID string"));
goto fail;
}
@@ -362,7 +362,7 @@
cp = strchr(oidstr, '.');
if (!cp) {
- if (sscanf(oidstr, "%lu", (unsigned long *)&oid) != 1) {
+ if (sscanf(oidstr, "%u", &oid) != 1) {
SILC_LOG_DEBUG(("Malformed OID string"));
goto fail;
}
Modified: silc-toolkit/trunk/lib/silcclient/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcclient/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcclient/Makefile.am (original)
+++ silc-toolkit/trunk/lib/silcclient/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/silcclient/Makefile.ad file in the source tree.
# Source: ./lib/silcclient/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcclient/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcclient/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcclient/Makefile.in (original)
+++ silc-toolkit/trunk/lib/silcclient/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/silcclient/Makefile.ad file in the source tree.
# Source: ./lib/silcclient/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcclient/client.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcclient/client.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcclient/client.c (original)
+++ silc-toolkit/trunk/lib/silcclient/client.c Mon Nov 24 16:25:55 2008
@@ -55,7 +55,7 @@
SilcClient client = silc_fsm_get_state_context(fsm);
/* Signal client that we have finished */
- silc_atomic_sub_int16(&client->internal->conns, 1);
+ silc_atomic_sub_int32(&client->internal->conns, 1);
client->internal->connection_closed = TRUE;
SILC_FSM_EVENT_SIGNAL(&client->internal->wait_event);
@@ -529,7 +529,7 @@
/* A connection finished */
SILC_LOG_DEBUG(("Event: connection closed"));
client->internal->connection_closed = FALSE;
- if (silc_atomic_get_int16(&client->internal->conns) == 0 &&
+ if (silc_atomic_get_int32(&client->internal->conns) == 0 &&
client->internal->stop)
SILC_FSM_EVENT_SIGNAL(&client->internal->wait_event);
return SILC_FSM_CONTINUE;
@@ -538,7 +538,7 @@
if (client->internal->stop) {
/* Stop client libarry. If we have running connections, wait until
they finish first. */
- if (silc_atomic_get_int16(&client->internal->conns) == 0) {
+ if (silc_atomic_get_int32(&client->internal->conns) == 0) {
SILC_LOG_DEBUG(("Event: stop"));
silc_fsm_next(fsm, silc_client_st_stop);
}
@@ -672,7 +672,7 @@
silc_fsm_start(thread, silc_client_connection_st_start);
SILC_LOG_DEBUG(("New connection %p", conn));
- silc_atomic_add_int16(&client->internal->conns, 1);
+ silc_atomic_add_int32(&client->internal->conns, 1);
return conn;
}
@@ -936,7 +936,7 @@
nickname_format[sizeof(new_client->internal->
params->nickname_format) - 1] = 0;
- silc_atomic_init16(&new_client->internal->conns, 0);
+ silc_atomic_init32(&new_client->internal->conns, 0);
return new_client;
}
@@ -964,7 +964,7 @@
silc_dlist_uninit(client->internal->ftp_sessions);
if (client->internal->lock)
silc_mutex_free(client->internal->lock);
- silc_atomic_uninit16(&client->internal->conns);
+ silc_atomic_uninit32(&client->internal->conns);
silc_free(client->username);
silc_free(client->hostname);
silc_free(client->realname);
Modified: silc-toolkit/trunk/lib/silcclient/client.h
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcclient/client.h?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcclient/client.h (original)
+++ silc-toolkit/trunk/lib/silcclient/client.h Mon Nov 24 16:25:55 2008
@@ -53,14 +53,17 @@
SilcUInt32 key_len; /* Key data length */
SilcClientKeyAgreement ke; /* Current key agreement context or NULL */
+ SilcAtomic32 refcnt; /* Reference counter */
+ SilcAtomic32 deleted; /* Flag indicating whether the client object is
+ already scheduled for deletion */
+ SilcUInt16 resolve_cmd_ident; /* Command identifier when resolving */
+
/* Flags */
unsigned int valid : 1; /* FALSE if this entry is not valid. Entry
without nickname is not valid. */
unsigned int generated : 1; /* TRUE if library generated `key' */
unsigned int prv_resp : 1; /* TRUE if we are responder when using
private message keys. */
- SilcUInt16 resolve_cmd_ident; /* Command identifier when resolving */
- SilcAtomic8 refcnt; /* Reference counter */
} SilcClientEntryInternal;
/* Internal channel entry context */
@@ -81,20 +84,23 @@
SilcHmac hmac; /* Current HMAC */
unsigned char iv[SILC_CIPHER_MAX_IV_SIZE]; /* Current IV */
+ SilcAtomic32 refcnt; /* Reference counter */
+ SilcAtomic32 deleted; /* Flag indicating whether the
+ channel object is already
+ scheduled for deletion */
SilcUInt16 resolve_cmd_ident; /* Channel information resolving
identifier. This is used when
resolving users, and other
stuff that relates to the
channel. Not used for the
channel resolving itself. */
- SilcAtomic16 refcnt; /* Reference counter */
} SilcChannelEntryInternal;
/* Internal server entry context */
typedef struct SilcServerEntryInternalStruct {
SilcRwLock lock; /* Read/write lock */
SilcUInt16 resolve_cmd_ident; /* Resolving identifier */
- SilcAtomic8 refcnt; /* Reference counter */
+ SilcAtomic32 refcnt; /* Reference counter */
} SilcServerEntryInternal;
#endif /* CLIENT_H */
Modified: silc-toolkit/trunk/lib/silcclient/client_channel.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcclient/client_channel.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcclient/client_channel.c (original)
+++ silc-toolkit/trunk/lib/silcclient/client_channel.c Mon Nov 24 16:25:55 2008
@@ -626,8 +626,14 @@
}
channel->internal.curr_key = NULL;
- channel->cipher = silc_cipher_get_name(channel->internal.send_key);
- channel->hmac = silc_hmac_get_name(channel->internal.hmac);
+ if (channel->internal.send_key)
+ channel->cipher = silc_cipher_get_name(channel->internal.send_key);
+ else
+ channel->cipher = NULL;
+ if (channel->internal.hmac)
+ channel->hmac = silc_hmac_get_name(channel->internal.hmac);
+ else
+ channel->hmac = NULL;
silc_dlist_uninit(channel->internal.private_keys);
channel->internal.private_keys = NULL;
Modified: silc-toolkit/trunk/lib/silcclient/client_entry.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcclient/client_entry.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcclient/client_entry.c (original)
+++ silc-toolkit/trunk/lib/silcclient/client_entry.c Mon Nov 24 16:25:55 2008
@@ -791,7 +791,8 @@
return NULL;
silc_rwlock_alloc(&client_entry->internal.lock);
- silc_atomic_init8(&client_entry->internal.refcnt, 0);
+ silc_atomic_init32(&client_entry->internal.refcnt, 0);
+ silc_atomic_init32(&client_entry->internal.deleted, 1);
client_entry->id = *id;
client_entry->mode = mode;
client_entry->realname = userinfo ? strdup(userinfo) : NULL;
@@ -995,7 +996,8 @@
silc_client_ftp_session_free_client(client, client_entry);
if (client_entry->internal.ke)
silc_client_abort_key_agreement(client, conn, client_entry);
- silc_atomic_uninit8(&client_entry->internal.refcnt);
+ silc_atomic_uninit32(&client_entry->internal.deleted);
+ silc_atomic_uninit32(&client_entry->internal.refcnt);
silc_rwlock_free(client_entry->internal.lock);
silc_free(client_entry);
}
@@ -1005,30 +1007,18 @@
SilcBool silc_client_del_client(SilcClient client, SilcClientConnection conn,
SilcClientEntry client_entry)
{
- SilcBool ret;
-
if (!client_entry)
return FALSE;
- if (silc_atomic_sub_int8(&client_entry->internal.refcnt, 1) > 0)
+ SILC_LOG_DEBUG(("Marking client entry %p deleted"));
+
+ if (silc_atomic_sub_int32(&client_entry->internal.deleted, 1) != 0) {
+ SILC_LOG_DEBUG(("Client entry %p already marked deleted"));
return FALSE;
-
- SILC_LOG_DEBUG(("Deleting client %p", client_entry));
-
- silc_mutex_lock(conn->internal->lock);
- ret = silc_idcache_del_by_context(conn->internal->client_cache,
- client_entry, NULL);
- silc_mutex_unlock(conn->internal->lock);
-
- if (ret) {
- /* Remove from channels */
- silc_client_remove_from_channels(client, conn, client_entry);
-
- /* Free the client entry data */
- silc_client_del_client_entry(client, conn, client_entry);
- }
-
- return ret;
+ }
+
+ silc_client_unref_client(client, conn, client_entry);
+ return TRUE;
}
/* Internal routine used to find client by ID and if not found this creates
@@ -1072,10 +1062,10 @@
SilcClientConnection conn,
SilcClientEntry client_entry)
{
- silc_atomic_add_int8(&client_entry->internal.refcnt, 1);
+ silc_atomic_add_int32(&client_entry->internal.refcnt, 1);
SILC_LOG_DEBUG(("Client %p refcnt %d->%d", client_entry,
- silc_atomic_get_int8(&client_entry->internal.refcnt) - 1,
- silc_atomic_get_int8(&client_entry->internal.refcnt)));
+ silc_atomic_get_int32(&client_entry->internal.refcnt) - 1,
+ silc_atomic_get_int32(&client_entry->internal.refcnt)));
return client_entry;
}
@@ -1084,11 +1074,32 @@
void silc_client_unref_client(SilcClient client, SilcClientConnection conn,
SilcClientEntry client_entry)
{
- if (client_entry) {
- SILC_LOG_DEBUG(("Client %p refcnt %d->%d", client_entry,
- silc_atomic_get_int8(&client_entry->internal.refcnt),
- silc_atomic_get_int8(&client_entry->internal.refcnt) - 1));
- silc_client_del_client(client, conn, client_entry);
+ SilcBool ret;
+
+ if (!client_entry)
+ return;
+
+ SILC_LOG_DEBUG(("Client %p refcnt %d->%d", client_entry,
+ silc_atomic_get_int32(&client_entry->internal.refcnt),
+ silc_atomic_get_int32(&client_entry->internal.refcnt) - 1));
+
+ if (silc_atomic_sub_int32(&client_entry->internal.refcnt, 1) > 0)
+ return;
+
+ SILC_LOG_DEBUG(("Deleting client %p (%d)", client_entry,
+ silc_atomic_get_int32(&client_entry->internal.deleted)));
+
+ silc_mutex_lock(conn->internal->lock);
+ ret = silc_idcache_del_by_context(conn->internal->client_cache,
+ client_entry, NULL);
+ silc_mutex_unlock(conn->internal->lock);
+
+ if (ret) {
+ /* Remove from channels */
+ silc_client_remove_from_channels(client, conn, client_entry);
+
+ /* Free the client entry data */
+ silc_client_del_client_entry(client, conn, client_entry);
}
}
@@ -1626,7 +1637,8 @@
return NULL;
silc_rwlock_alloc(&channel->internal.lock);
- silc_atomic_init16(&channel->internal.refcnt, 0);
+ silc_atomic_init32(&channel->internal.refcnt, 0);
+ silc_atomic_init32(&channel->internal.deleted, 1);
channel->id = *channel_id;
channel->mode = mode;
@@ -1639,7 +1651,7 @@
if (!channel->channel_name) {
silc_rwlock_free(channel->internal.lock);
- silc_atomic_uninit16(&channel->internal.refcnt);
+ silc_atomic_uninit32(&channel->internal.refcnt);
silc_free(channel);
return NULL;
}
@@ -1648,7 +1660,7 @@
NULL, NULL, NULL, TRUE);
if (!channel->user_list) {
silc_rwlock_free(channel->internal.lock);
- silc_atomic_uninit16(&channel->internal.refcnt);
+ silc_atomic_uninit32(&channel->internal.refcnt);
silc_free(channel->channel_name);
silc_free(channel);
return NULL;
@@ -1659,7 +1671,7 @@
SILC_STRING_UTF8, 256, NULL);
if (!channel_namec) {
silc_rwlock_free(channel->internal.lock);
- silc_atomic_uninit16(&channel->internal.refcnt);
+ silc_atomic_uninit32(&channel->internal.refcnt);
silc_free(channel->channel_name);
silc_hash_table_free(channel->user_list);
silc_free(channel);
@@ -1672,7 +1684,7 @@
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_atomic_uninit32(&channel->internal.refcnt);
silc_free(channel_namec);
silc_free(channel->channel_name);
silc_hash_table_free(channel->user_list);
@@ -1694,67 +1706,18 @@
SilcBool silc_client_del_channel(SilcClient client, SilcClientConnection conn,
SilcChannelEntry channel)
{
- SilcIDCacheEntry id_cache;
- SilcBool ret = TRUE;
- SilcCipher key;
- SilcHmac hmac;
- char *namec;
-
if (!channel)
return FALSE;
- if (silc_atomic_sub_int16(&channel->internal.refcnt, 1) > 0)
+ SILC_LOG_DEBUG(("Marking channel entry %p deleted"));
+
+ if (silc_atomic_sub_int32(&channel->internal.deleted, 1) != 0) {
+ SILC_LOG_DEBUG(("Channel entry %p already marked deleted"));
return FALSE;
-
- SILC_LOG_DEBUG(("Deleting channel %p", channel));
-
- silc_mutex_lock(conn->internal->lock);
- if (silc_idcache_find_by_context(conn->internal->channel_cache, channel,
- &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)
- return FALSE;
-
- silc_client_empty_channel(client, conn, channel);
- silc_client_del_channel_private_keys(client, conn, channel);
- silc_hash_table_free(channel->user_list);
- silc_free(channel->channel_name);
- silc_free(channel->topic);
- if (channel->founder_key)
- silc_pkcs_public_key_free(channel->founder_key);
- if (channel->internal.send_key)
- silc_cipher_free(channel->internal.send_key);
- if (channel->internal.receive_key)
- silc_cipher_free(channel->internal.receive_key);
- if (channel->internal.hmac)
- silc_hmac_free(channel->internal.hmac);
- if (channel->internal.old_channel_keys) {
- silc_dlist_start(channel->internal.old_channel_keys);
- while ((key = silc_dlist_get(channel->internal.old_channel_keys)))
- silc_cipher_free(key);
- silc_dlist_uninit(channel->internal.old_channel_keys);
- }
- if (channel->internal.old_hmacs) {
- silc_dlist_start(channel->internal.old_hmacs);
- while ((hmac = silc_dlist_get(channel->internal.old_hmacs)))
- silc_hmac_free(hmac);
- silc_dlist_uninit(channel->internal.old_hmacs);
- }
- if (channel->channel_pubkeys)
- silc_argument_list_free(channel->channel_pubkeys,
- SILC_ARGUMENT_PUBLIC_KEY);
- silc_atomic_uninit16(&channel->internal.refcnt);
- silc_rwlock_free(channel->internal.lock);
- silc_schedule_task_del_by_context(conn->client->schedule, channel);
- silc_free(channel);
-
- return ret;
+ }
+
+ silc_client_unref_channel(client, conn, channel);
+ return TRUE;
}
/* Replaces the channel ID of the `channel' to `new_id'. Returns FALSE
@@ -1806,10 +1769,10 @@
SilcClientConnection conn,
SilcChannelEntry channel_entry)
{
- silc_atomic_add_int16(&channel_entry->internal.refcnt, 1);
+ silc_atomic_add_int32(&channel_entry->internal.refcnt, 1);
SILC_LOG_DEBUG(("Channel %p refcnt %d->%d", channel_entry,
- silc_atomic_get_int16(&channel_entry->internal.refcnt) - 1,
- silc_atomic_get_int16(&channel_entry->internal.refcnt)));
+ silc_atomic_get_int32(&channel_entry->internal.refcnt) - 1,
+ silc_atomic_get_int32(&channel_entry->internal.refcnt)));
return channel_entry;
}
@@ -1818,13 +1781,71 @@
void silc_client_unref_channel(SilcClient client, SilcClientConnection conn,
SilcChannelEntry channel_entry)
{
- if (channel_entry) {
- SILC_LOG_DEBUG(("Channel %p refcnt %d->%d", channel_entry,
- silc_atomic_get_int16(&channel_entry->internal.refcnt),
- silc_atomic_get_int16(&channel_entry->internal.refcnt)
- - 1));
- silc_client_del_channel(client, conn, channel_entry);
- }
+ SilcIDCacheEntry id_cache;
+ SilcBool ret = TRUE;
+ SilcCipher key;
+ SilcHmac hmac;
+ char *namec;
+
+ if (!channel_entry)
+ return;
+
+ SILC_LOG_DEBUG(("Channel %p refcnt %d->%d", channel_entry,
+ silc_atomic_get_int32(&channel_entry->internal.refcnt),
+ silc_atomic_get_int32(&channel_entry->internal.refcnt)
+ - 1));
+
+ if (silc_atomic_sub_int32(&channel_entry->internal.refcnt, 1) > 0)
+ return;
+
+ SILC_LOG_DEBUG(("Deleting channel %p", channel_entry));
+
+ silc_mutex_lock(conn->internal->lock);
+ if (silc_idcache_find_by_context(conn->internal->channel_cache, channel_entry,
+ &id_cache)) {
+ namec = id_cache->name;
+ ret = silc_idcache_del_by_context(conn->internal->channel_cache,
+ channel_entry, NULL);
+ silc_free(namec);
+ }
+ silc_mutex_unlock(conn->internal->lock);
+
+ if (!ret)
+ return;
+
+ silc_client_empty_channel(client, conn, channel_entry);
+ silc_client_del_channel_private_keys(client, conn, channel_entry);
+ silc_hash_table_free(channel_entry->user_list);
+ silc_free(channel_entry->channel_name);
+ silc_free(channel_entry->topic);
+ if (channel_entry->founder_key)
+ silc_pkcs_public_key_free(channel_entry->founder_key);
+ if (channel_entry->internal.send_key)
+ silc_cipher_free(channel_entry->internal.send_key);
+ if (channel_entry->internal.receive_key)
+ silc_cipher_free(channel_entry->internal.receive_key);
+ if (channel_entry->internal.hmac)
+ silc_hmac_free(channel_entry->internal.hmac);
+ if (channel_entry->internal.old_channel_keys) {
+ silc_dlist_start(channel_entry->internal.old_channel_keys);
+ while ((key = silc_dlist_get(channel_entry->internal.old_channel_keys)))
+ silc_cipher_free(key);
+ silc_dlist_uninit(channel_entry->internal.old_channel_keys);
+ }
+ if (channel_entry->internal.old_hmacs) {
+ silc_dlist_start(channel_entry->internal.old_hmacs);
+ while ((hmac = silc_dlist_get(channel_entry->internal.old_hmacs)))
+ silc_hmac_free(hmac);
+ silc_dlist_uninit(channel_entry->internal.old_hmacs);
+ }
+ if (channel_entry->channel_pubkeys)
+ silc_argument_list_free(channel_entry->channel_pubkeys,
+ SILC_ARGUMENT_PUBLIC_KEY);
+ silc_atomic_uninit32(&channel_entry->internal.deleted);
+ silc_atomic_uninit32(&channel_entry->internal.refcnt);
+ silc_rwlock_free(channel_entry->internal.lock);
+ silc_schedule_task_del_by_context(conn->client->schedule, channel_entry);
+ silc_free(channel_entry);
}
/* Free channel entry list */
@@ -2059,7 +2080,7 @@
return NULL;
silc_rwlock_alloc(&server_entry->internal.lock);
- silc_atomic_init8(&server_entry->internal.refcnt, 0);
+ silc_atomic_init32(&server_entry->internal.refcnt, 0);
server_entry->id = *server_id;
if (server_name)
server_entry->server_name = strdup(server_name);
@@ -2111,7 +2132,7 @@
if (!server)
return FALSE;
- if (silc_atomic_sub_int8(&server->internal.refcnt, 1) > 0)
+ if (silc_atomic_sub_int32(&server->internal.refcnt, 1) > 0)
return FALSE;
SILC_LOG_DEBUG(("Deleting server %p", server));
@@ -2130,7 +2151,7 @@
silc_free(server->server_info);
if (server->public_key)
silc_pkcs_public_key_free(server->public_key);
- silc_atomic_uninit8(&server->internal.refcnt);
+ silc_atomic_uninit32(&server->internal.refcnt);
silc_rwlock_free(server->internal.lock);
silc_free(server);
@@ -2198,10 +2219,10 @@
SilcClientConnection conn,
SilcServerEntry server_entry)
{
- silc_atomic_add_int8(&server_entry->internal.refcnt, 1);
+ silc_atomic_add_int32(&server_entry->internal.refcnt, 1);
SILC_LOG_DEBUG(("Server %p refcnt %d->%d", server_entry,
- silc_atomic_get_int8(&server_entry->internal.refcnt) - 1,
- silc_atomic_get_int8(&server_entry->internal.refcnt)));
+ silc_atomic_get_int32(&server_entry->internal.refcnt) - 1,
+ silc_atomic_get_int32(&server_entry->internal.refcnt)));
return server_entry;
}
@@ -2212,8 +2233,8 @@
{
if (server_entry) {
SILC_LOG_DEBUG(("Server %p refcnt %d->%d", server_entry,
- silc_atomic_get_int8(&server_entry->internal.refcnt),
- silc_atomic_get_int8(&server_entry->internal.refcnt)
+ silc_atomic_get_int32(&server_entry->internal.refcnt),
+ silc_atomic_get_int32(&server_entry->internal.refcnt)
- 1));
silc_client_del_server(client, conn, server_entry);
}
Modified: silc-toolkit/trunk/lib/silcclient/client_internal.h
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcclient/client_internal.h?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcclient/client_internal.h (original)
+++ silc-toolkit/trunk/lib/silcclient/client_internal.h Mon Nov 24 16:25:55 2008
@@ -108,7 +108,7 @@
char *silc_client_version; /* Version set by application */
SilcClientRunning running; /* Running/Stopped callback */
void *running_context; /* Context for runnign callback */
- SilcAtomic16 conns; /* Number of connections in client */
+ SilcAtomic32 conns; /* Number of connections in client */
SilcUInt16 next_session_id; /* Next FTP session ID */
/* Events */
Modified: silc-toolkit/trunk/lib/silcclient/client_notify.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcclient/client_notify.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcclient/client_notify.c (original)
+++ silc-toolkit/trunk/lib/silcclient/client_notify.c Mon Nov 24 16:25:55 2008
@@ -4,7 +4,7 @@
Author: Pekka Riikonen <priikone at silcnet.org>
- Copyright (C) 1997 - 2007 Pekka Riikonen
+ Copyright (C) 1997 - 2008 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
@@ -298,8 +298,14 @@
/* Get the channel entry */
channel = silc_client_get_channel_by_id(client, conn, &id.u.channel_id);
- if (!channel)
- goto out;
+ if (!channel) {
+ /** Resolve channel */
+ SILC_FSM_CALL(silc_client_get_channel_by_id_resolve(
+ client, conn, &id.u.channel_id,
+ silc_client_notify_resolved,
+ notify));
+ /* NOT REACHED */
+ }
/* If channel is being resolved handle notify after resolving */
if (channel->internal.resolve_cmd_ident) {
@@ -529,7 +535,7 @@
if (tmp && tmp_len > 128)
tmp[128] = '\0';
- if (packet->dst_id_type == SILC_ID_CHANNEL)
+ if (packet->dst_id_type == SILC_ID_CHANNEL)
if (silc_id_str2id(packet->dst_id, packet->dst_id_len, SILC_ID_CHANNEL,
&id.u.channel_id, sizeof(id.u.channel_id)))
channel = silc_client_get_channel_by_id(client, conn, &id.u.channel_id);
@@ -912,9 +918,7 @@
/* Get HMAC key from the old HMAC context, and update it to the new one */
tmp = (unsigned char *)silc_hmac_get_key(channel->internal.hmac, &tmp_len);
if (tmp) {
- silc_hash_make(silc_hmac_get_hash(newhmac), tmp, tmp_len, hash);
- silc_hmac_set_key(newhmac, hash,
- silc_hash_len(silc_hmac_get_hash(newhmac)));
+ silc_hmac_set_key(newhmac, tmp, tmp_len);
if (channel->internal.hmac)
silc_hmac_free(channel->internal.hmac);
channel->internal.hmac = newhmac;
Modified: silc-toolkit/trunk/lib/silcclient/client_register.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcclient/client_register.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcclient/client_register.c (original)
+++ silc-toolkit/trunk/lib/silcclient/client_register.c Mon Nov 24 16:25:55 2008
@@ -563,25 +563,26 @@
&conn->local_entry->id);
/* Call JOIN command replies for all joined channel */
- silc_idcache_get_all(conn->internal->channel_cache, &channels);
- silc_list_start(channels);
- while ((entry = silc_list_get(channels))) {
- SilcHashTableList htl;
- const char *cipher, *hmac;
-
- channel = entry->context;
- cipher = (channel->internal.send_key ?
- silc_cipher_get_name(channel->internal.send_key) : NULL);
- hmac = (channel->internal.hmac ?
- silc_hmac_get_name(channel->internal.hmac) : NULL);
- silc_hash_table_list(channel->user_list, &htl);
- silc_client_resume_command_callback(client, conn, SILC_COMMAND_JOIN,
- channel->channel_name, channel,
- channel->mode, &htl, channel->topic,
- cipher, hmac, channel->founder_key,
- channel->channel_pubkeys,
- channel->user_limit);
- silc_hash_table_list_reset(&htl);
+ if (silc_idcache_get_all(conn->internal->channel_cache, &channels)) {
+ silc_list_start(channels);
+ while ((entry = silc_list_get(channels))) {
+ SilcHashTableList htl;
+ const char *cipher, *hmac;
+
+ channel = entry->context;
+ cipher = (channel->internal.send_key ?
+ silc_cipher_get_name(channel->internal.send_key) : NULL);
+ hmac = (channel->internal.hmac ?
+ silc_hmac_get_name(channel->internal.hmac) : NULL);
+ silc_hash_table_list(channel->user_list, &htl);
+ silc_client_resume_command_callback(client, conn, SILC_COMMAND_JOIN,
+ channel->channel_name, channel,
+ channel->mode, &htl, channel->topic,
+ cipher, hmac, channel->founder_key,
+ channel->channel_pubkeys,
+ channel->user_limit);
+ silc_hash_table_list_reset(&htl);
+ }
}
conn->internal->registering = FALSE;
Modified: silc-toolkit/trunk/lib/silcclient/command.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcclient/command.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcclient/command.c (original)
+++ silc-toolkit/trunk/lib/silcclient/command.c Mon Nov 24 16:25:55 2008
@@ -411,6 +411,7 @@
SilcUInt32 argc = 0;
unsigned char **argv = NULL;
SilcUInt32 *argv_lens = NULL, *argv_types = NULL;
+ SilcUInt16 cmd_ident;
SilcClientCommand command;
SilcClientCommandContext cmd;
char *arg;
@@ -480,7 +481,7 @@
cmd->argv = argv;
cmd->argv_lens = argv_lens;
cmd->argv_types = argv_types;
- cmd->cmd_ident = silc_client_cmd_ident(conn);
+ cmd_ident = cmd->cmd_ident = silc_client_cmd_ident(conn);
cmd->called = TRUE;
cmd->verbose = TRUE;
silc_list_init(cmd->reply_callbacks,
@@ -492,7 +493,7 @@
silc_client_command_destructor, NULL, FALSE);
silc_fsm_start_sync(&cmd->thread, command->command);
- return cmd->cmd_ident;
+ return cmd_ident;
}
/* Generic function to send any command. The arguments must be sent already
Modified: silc-toolkit/trunk/lib/silcclient/command_reply.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcclient/command_reply.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcclient/command_reply.c (original)
+++ silc-toolkit/trunk/lib/silcclient/command_reply.c Mon Nov 24 16:25:55 2008
@@ -118,6 +118,7 @@
client_entry = silc_client_get_client_by_id(client, conn, &id.u.client_id);
if (client_entry) {
silc_client_remove_from_channels(client, conn, client_entry);
+ client_entry->internal.valid = FALSE;
silc_client_del_client(client, conn, client_entry);
silc_client_unref_client(client, conn, client_entry);
}
@@ -947,6 +948,7 @@
/* Remove the client */
if (client_entry) {
silc_client_remove_from_channels(client, conn, client_entry);
+ client_entry->internal.valid = FALSE;
silc_client_del_client(client, conn, client_entry);
silc_client_unref_client(client, conn, client_entry);
}
@@ -1170,6 +1172,17 @@
silc_client_ref_channel(client, conn, channel);
}
+ /* Get hmac */
+ hmac = silc_argument_get_arg_type(args, 11, NULL);
+ if (hmac && !silc_hmac_is_supported(hmac)) {
+ if (cmd->verbose)
+ SAY(client, conn, SILC_CLIENT_MESSAGE_COMMAND_ERROR,
+ "Cannot join channel: Unsupported HMAC `%s'", hmac);
+ ERROR_CALLBACK(SILC_STATUS_ERR_UNKNOWN_ALGORITHM);
+ silc_rwlock_unlock(channel->internal.lock);
+ goto out;
+ }
+
/* Get the list count */
tmp = silc_argument_get_arg_type(args, 12, &len);
if (!tmp) {
@@ -1238,19 +1251,6 @@
goto out;
}
if (!silc_buffer_pull(&client_mode_list, 4)) {
- silc_rwlock_unlock(channel->internal.lock);
- goto out;
- }
- }
-
- /* Get hmac */
- hmac = silc_argument_get_arg_type(args, 11, NULL);
- if (hmac) {
- if (!silc_hmac_alloc(hmac, NULL, &channel->internal.hmac)) {
- if (cmd->verbose)
- SAY(client, conn, SILC_CLIENT_MESSAGE_COMMAND_ERROR,
- "Cannot join channel: Unsupported HMAC `%s'", hmac);
- ERROR_CALLBACK(SILC_STATUS_ERR_UNKNOWN_ALGORITHM);
silc_rwlock_unlock(channel->internal.lock);
goto out;
}
Modified: silc-toolkit/trunk/lib/silccore/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silccore/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silccore/Makefile.am (original)
+++ silc-toolkit/trunk/lib/silccore/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/silccore/Makefile.ad file in the source tree.
# Source: ./lib/silccore/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silccore/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silccore/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silccore/Makefile.in (original)
+++ silc-toolkit/trunk/lib/silccore/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/silccore/Makefile.ad file in the source tree.
# Source: ./lib/silccore/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silccore/silcpacket.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silccore/silcpacket.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silccore/silcpacket.c (original)
+++ silc-toolkit/trunk/lib/silccore/silcpacket.c Mon Nov 24 16:25:55 2008
@@ -4,7 +4,7 @@
Author: Pekka Riikonen <priikone at silcnet.org>
- Copyright (C) 1997 - 2007 Pekka Riikonen
+ Copyright (C) 1997 - 2008 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
@@ -40,7 +40,7 @@
SilcMutex lock; /* Engine lock */
SilcRng rng; /* RNG for engine */
SilcHashTable contexts; /* Per scheduler contexts */
- SilcPacketCallbacks *callbacks; /* Packet callbacks */
+ const SilcPacketCallbacks *callbacks; /* Packet callbacks */
void *callback_context; /* Context for callbacks */
SilcList streams; /* All streams in engine */
SilcList packet_pool; /* Free list for received packets */
@@ -51,7 +51,7 @@
/* Packet processor context */
typedef struct SilcPacketProcessStruct {
SilcPacketType *types; /* Packets to process */
- SilcPacketCallbacks *callbacks; /* Callbacks or NULL */
+ const SilcPacketCallbacks *callbacks; /* Callbacks or NULL */
void *callback_context;
SilcInt32 priority; /* Priority */
} *SilcPacketProcess;
@@ -81,7 +81,7 @@
unsigned char *dst_id; /* Destination ID */
SilcUInt32 send_psn; /* Sending sequence */
SilcUInt32 receive_psn; /* Receiving sequence */
- SilcAtomic8 refcnt; /* Reference counter */
+ SilcAtomic32 refcnt; /* Reference counter */
SilcUInt8 sid; /* Security ID, set if IV included */
unsigned int src_id_len : 6;
unsigned int src_id_type : 2;
@@ -336,7 +336,6 @@
silc_mutex_unlock(ps->lock);
if (ret == -1) {
/* Cannot read now, do it later. */
- silc_buffer_pull(inbuf, silc_buffer_len(inbuf));
return FALSE;
}
@@ -394,7 +393,6 @@
if (ret == -1) {
/* Cannot read now, do it later. */
- silc_buffer_pull(inbuf, silc_buffer_len(inbuf));
return FALSE;
}
@@ -542,7 +540,7 @@
SilcPacketEngine
silc_packet_engine_start(SilcRng rng, SilcBool router,
- SilcPacketCallbacks *callbacks,
+ const SilcPacketCallbacks *callbacks,
void *callback_context)
{
SilcPacketEngine engine;
@@ -623,7 +621,7 @@
silc_free(engine);
}
-static const char *packet_error[] = {
+static const char * const packet_error[] = {
"Cannot read from stream",
"Cannot write to stream",
"Packet MAC failed",
@@ -697,7 +695,7 @@
return NULL;
ps->stream = stream;
- silc_atomic_init8(&ps->refcnt, 1);
+ silc_atomic_init32(&ps->refcnt, 1);
silc_mutex_alloc(&ps->lock);
/* Allocate out buffer */
@@ -818,7 +816,7 @@
return NULL;
ps->sc = stream->sc;
- silc_atomic_init8(&ps->refcnt, 1);
+ silc_atomic_init32(&ps->refcnt, 1);
silc_mutex_alloc(&ps->lock);
/* Set the UDP packet stream as underlaying stream */
@@ -886,7 +884,9 @@
if (!stream)
return;
- if (silc_atomic_sub_int8(&stream->refcnt, 1) > 0) {
+ if (silc_atomic_sub_int32(&stream->refcnt, 1) > 0) {
+ if (stream->destroyed)
+ return;
stream->destroyed = TRUE;
SILC_LOG_DEBUG(("Marking packet stream %p destroyed", stream));
@@ -972,7 +972,7 @@
silc_free(stream->src_id);
silc_free(stream->dst_id);
- silc_atomic_uninit8(&stream->refcnt);
+ silc_atomic_uninit32(&stream->refcnt);
silc_mutex_free(stream->lock);
silc_free(stream);
}
@@ -1001,7 +1001,7 @@
/* Links `callbacks' to `stream' for specified packet types */
static SilcBool silc_packet_stream_link_va(SilcPacketStream stream,
- SilcPacketCallbacks *callbacks,
+ const SilcPacketCallbacks *callbacks,
void *callback_context,
int priority, va_list ap)
{
@@ -1030,6 +1030,7 @@
stream->process = silc_dlist_init();
if (!stream->process) {
silc_mutex_unlock(stream->lock);
+ silc_free(p);
return FALSE;
}
}
@@ -1079,7 +1080,7 @@
/* Links `callbacks' to `stream' for specified packet types */
SilcBool silc_packet_stream_link(SilcPacketStream stream,
- SilcPacketCallbacks *callbacks,
+ const SilcPacketCallbacks *callbacks,
void *callback_context,
int priority, ...)
{
@@ -1097,7 +1098,7 @@
/* Unlinks `callbacks' from `stream'. */
void silc_packet_stream_unlink(SilcPacketStream stream,
- SilcPacketCallbacks *callbacks,
+ const SilcPacketCallbacks *callbacks,
void *callback_context)
{
SilcPacketProcess p;
@@ -1153,10 +1154,10 @@
void silc_packet_stream_ref(SilcPacketStream stream)
{
- silc_atomic_add_int8(&stream->refcnt, 1);
+ silc_atomic_add_int32(&stream->refcnt, 1);
SILC_LOG_DEBUG(("Stream %p, refcnt %d->%d", stream,
- silc_atomic_get_int8(&stream->refcnt) - 1,
- silc_atomic_get_int8(&stream->refcnt)));
+ silc_atomic_get_int32(&stream->refcnt) - 1,
+ silc_atomic_get_int32(&stream->refcnt)));
}
/* Unreference packet stream */
@@ -1164,11 +1165,11 @@
void silc_packet_stream_unref(SilcPacketStream stream)
{
SILC_LOG_DEBUG(("Stream %p, refcnt %d->%d", stream,
- silc_atomic_get_int8(&stream->refcnt),
- silc_atomic_get_int8(&stream->refcnt) - 1));
- if (silc_atomic_sub_int8(&stream->refcnt, 1) > 0)
+ silc_atomic_get_int32(&stream->refcnt),
+ silc_atomic_get_int32(&stream->refcnt) - 1));
+ if (silc_atomic_sub_int32(&stream->refcnt, 1) > 0)
return;
- silc_atomic_add_int8(&stream->refcnt, 1);
+ silc_atomic_add_int32(&stream->refcnt, 1);
silc_packet_stream_destroy(stream);
}
@@ -1323,6 +1324,7 @@
{
SilcUInt32 len;
unsigned char tmp[32];
+ void *tmp_id;
if (!src_id && !dst_id)
return FALSE;
@@ -1332,16 +1334,17 @@
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);
return FALSE;
}
- stream->src_id = silc_memdup(tmp, len);
- if (!stream->src_id) {
+ tmp_id = silc_memdup(tmp, len);
+ if (!tmp_id) {
silc_mutex_unlock(stream->lock);
return FALSE;
}
+ silc_free(stream->src_id);
+ stream->src_id = tmp_id;
stream->src_id_type = src_id_type;
stream->src_id_len = len;
}
@@ -1349,16 +1352,17 @@
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);
return FALSE;
}
- stream->dst_id = silc_memdup(tmp, len);
- if (!stream->dst_id) {
+ tmp_id = silc_memdup(tmp, len);
+ if (!tmp_id) {
silc_mutex_unlock(stream->lock);
return FALSE;
}
+ silc_free(stream->dst_id);
+ stream->dst_id = tmp_id;
stream->dst_id_type = dst_id_type;
stream->dst_id_len = len;
}
@@ -2340,7 +2344,7 @@
void *stream_context);
/* Packet waiting callbacks */
-static SilcPacketCallbacks silc_packet_wait_cbs =
+static const SilcPacketCallbacks silc_packet_wait_cbs =
{
silc_packet_wait_packet_receive, NULL, NULL
};
@@ -2529,7 +2533,7 @@
} *SilcPacketWrapperStream;
/* Packet wrapper callbacks */
-static SilcPacketCallbacks silc_packet_wrap_cbs =
+static const SilcPacketCallbacks silc_packet_wrap_cbs =
{
silc_packet_wrap_packet_receive, NULL, NULL
};
Modified: silc-toolkit/trunk/lib/silccore/silcpacket.h
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silccore/silcpacket.h?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silccore/silcpacket.h (original)
+++ silc-toolkit/trunk/lib/silccore/silcpacket.h Mon Nov 24 16:25:55 2008
@@ -361,7 +361,7 @@
***/
SilcPacketEngine
silc_packet_engine_start(SilcRng rng, SilcBool router,
- SilcPacketCallbacks *callbacks,
+ const SilcPacketCallbacks *callbacks,
void *callback_context);
/****f* silccore/SilcPacketAPI/silc_packet_engine_stop
@@ -651,7 +651,7 @@
*
***/
SilcBool silc_packet_stream_link(SilcPacketStream stream,
- SilcPacketCallbacks *callbacks,
+ const SilcPacketCallbacks *callbacks,
void *callback_context,
int priority, ...);
@@ -671,7 +671,7 @@
*
***/
void silc_packet_stream_unlink(SilcPacketStream stream,
- SilcPacketCallbacks *callbacks,
+ const SilcPacketCallbacks *callbacks,
void *callback_context);
/****f* silccore/SilcPacketAPI/SilcPacketWrapCoder
Modified: silc-toolkit/trunk/lib/silccrypt/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silccrypt/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silccrypt/Makefile.am (original)
+++ silc-toolkit/trunk/lib/silccrypt/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/silccrypt/Makefile.ad file in the source tree.
# Source: ./lib/silccrypt/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silccrypt/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silccrypt/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silccrypt/Makefile.in (original)
+++ silc-toolkit/trunk/lib/silccrypt/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/silccrypt/Makefile.ad file in the source tree.
# Source: ./lib/silccrypt/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silccrypt/aes_x86.asm
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silccrypt/aes_x86.asm?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silccrypt/aes_x86.asm (original)
+++ silc-toolkit/trunk/lib/silccrypt/aes_x86.asm Mon Nov 24 16:25:55 2008
@@ -595,3 +595,7 @@
%endif
end
+
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
Modified: silc-toolkit/trunk/lib/silccrypt/aes_x86_64.asm
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silccrypt/aes_x86_64.asm?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silccrypt/aes_x86_64.asm (original)
+++ silc-toolkit/trunk/lib/silccrypt/aes_x86_64.asm Mon Nov 24 16:25:55 2008
@@ -864,3 +864,7 @@
%endif
end
+
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
Modified: silc-toolkit/trunk/lib/silchttp/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silchttp/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silchttp/Makefile.am (original)
+++ silc-toolkit/trunk/lib/silchttp/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/silchttp/Makefile.ad file in the source tree.
# Source: ./lib/silchttp/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silchttp/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silchttp/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silchttp/Makefile.in (original)
+++ silc-toolkit/trunk/lib/silchttp/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/silchttp/Makefile.ad file in the source tree.
# Source: ./lib/silchttp/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcmath/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcmath/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcmath/Makefile.am (original)
+++ silc-toolkit/trunk/lib/silcmath/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/silcmath/Makefile.ad file in the source tree.
# Source: ./lib/silcmath/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcmath/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcmath/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcmath/Makefile.in (original)
+++ silc-toolkit/trunk/lib/silcmath/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/silcmath/Makefile.ad file in the source tree.
# Source: ./lib/silcmath/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcsftp/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcsftp/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcsftp/Makefile.am (original)
+++ silc-toolkit/trunk/lib/silcsftp/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/silcsftp/Makefile.ad file in the source tree.
# Source: ./lib/silcsftp/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcsftp/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcsftp/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcsftp/Makefile.in (original)
+++ silc-toolkit/trunk/lib/silcsftp/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/silcsftp/Makefile.ad file in the source tree.
# Source: ./lib/silcsftp/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcsim/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcsim/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcsim/Makefile.am (original)
+++ silc-toolkit/trunk/lib/silcsim/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/silcsim/Makefile.ad file in the source tree.
# Source: ./lib/silcsim/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcsim/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcsim/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcsim/Makefile.in (original)
+++ silc-toolkit/trunk/lib/silcsim/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/silcsim/Makefile.ad file in the source tree.
# Source: ./lib/silcsim/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcske/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcske/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcske/Makefile.am (original)
+++ silc-toolkit/trunk/lib/silcske/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/silcske/Makefile.ad file in the source tree.
# Source: ./lib/silcske/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcske/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcske/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcske/Makefile.in (original)
+++ silc-toolkit/trunk/lib/silcske/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/silcske/Makefile.ad file in the source tree.
# Source: ./lib/silcske/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcske/silcske.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcske/silcske.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcske/silcske.c (original)
+++ silc-toolkit/trunk/lib/silcske/silcske.c Mon Nov 24 16:25:55 2008
@@ -4,7 +4,7 @@
Author: Pekka Riikonen <priikone at silcnet.org>
- Copyright (C) 2000 - 2007 Pekka Riikonen
+ Copyright (C) 2000 - 2008 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
@@ -182,15 +182,11 @@
static SilcSKEStatus silc_ske_check_version(SilcSKE ske)
{
- SilcUInt32 r_software_version = 0;
- char *r_software_string = NULL;
-
if (!ske->remote_version || !ske->version)
return SILC_SKE_STATUS_BAD_VERSION;
if (!silc_parse_version_string(ske->remote_version, NULL, NULL,
- &r_software_version,
- &r_software_string, NULL))
+ NULL, NULL, NULL))
return SILC_SKE_STATUS_BAD_VERSION;
return SILC_SKE_STATUS_OK;
@@ -2026,15 +2022,9 @@
silc_packet_free(ske->packet);
ske->packet = NULL;
- /* Verify the received public key and verify the signature if we are
- doing mutual authentication. */
- if (ske->start_payload &&
- ske->start_payload->flags & SILC_SKE_SP_FLAG_MUTUAL) {
-
- SILC_LOG_DEBUG(("We are doing mutual authentication"));
-
- if (!recv_payload->pk_data && (ske->callbacks->verify_key ||
- ske->repository)) {
+ /* Verify public key, except in rekey, when it is not sent */
+ if (!ske->rekey) {
+ if (!recv_payload->pk_data) {
/** Public key not provided */
SILC_LOG_ERROR(("Remote end did not send its public key (or "
"certificate), even though we require it"));
@@ -2044,8 +2034,7 @@
}
/* Decode the remote's public key */
- if (recv_payload->pk_data &&
- !silc_pkcs_public_key_alloc(recv_payload->pk_type,
+ if (!silc_pkcs_public_key_alloc(recv_payload->pk_type,
recv_payload->pk_data,
recv_payload->pk_len,
&ske->prop->public_key)) {
@@ -2056,39 +2045,36 @@
return SILC_FSM_CONTINUE;
}
- if (ske->prop->public_key && (ske->callbacks->verify_key ||
- ske->repository)) {
- SILC_LOG_DEBUG(("Verifying public key"));
-
- /** Waiting public key verification */
- silc_fsm_next(fsm, silc_ske_st_responder_phase4);
-
- /* If repository is provided, verify the key from there. */
- if (ske->repository) {
- SilcSKRFind find;
-
- find = silc_skr_find_alloc();
- if (!find) {
- ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
- silc_fsm_next(fsm, silc_ske_st_responder_error);
- return SILC_FSM_CONTINUE;
- }
- silc_skr_find_set_pkcs_type(find,
- silc_pkcs_get_type(ske->prop->public_key));
- silc_skr_find_set_public_key(find, ske->prop->public_key);
- silc_skr_find_set_usage(find, SILC_SKR_USAGE_KEY_AGREEMENT);
-
- /* Find key from repository */
- SILC_FSM_CALL(silc_skr_find(ske->repository,
- silc_fsm_get_schedule(fsm), find,
- silc_ske_skr_callback, ske));
- } else {
- /* Verify from application */
+ SILC_LOG_DEBUG(("Verifying public key"));
+
+ /** Waiting public key verification */
+ silc_fsm_next(fsm, silc_ske_st_responder_phase4);
+
+ /* If repository is provided, verify the key from there. */
+ if (ske->repository) {
+ SilcSKRFind find;
+
+ find = silc_skr_find_alloc();
+ if (!find) {
+ ske->status = SILC_SKE_STATUS_OUT_OF_MEMORY;
+ silc_fsm_next(fsm, silc_ske_st_responder_error);
+ return SILC_FSM_CONTINUE;
+ }
+ silc_skr_find_set_pkcs_type(find,
+ silc_pkcs_get_type(ske->prop->public_key));
+ silc_skr_find_set_public_key(find, ske->prop->public_key);
+ silc_skr_find_set_usage(find, SILC_SKR_USAGE_KEY_AGREEMENT);
+
+ /* Find key from repository */
+ SILC_FSM_CALL(silc_skr_find(ske->repository,
+ silc_fsm_get_schedule(fsm), find,
+ silc_ske_skr_callback, ske));
+ } else {
+ /* Verify from application */
+ if (ske->callbacks->verify_key)
SILC_FSM_CALL(ske->callbacks->verify_key(ske, ske->prop->public_key,
ske->callbacks->context,
silc_ske_pk_verified, NULL));
- }
- /* NOT REACHED */
}
}
@@ -2129,7 +2115,7 @@
unsigned char hash[SILC_HASH_MAXLEN];
SilcUInt32 hash_len;
- SILC_LOG_DEBUG(("Public key is authentic"));
+ SILC_LOG_DEBUG(("We are doing mutual authentication"));
/* Compute the hash value */
status = silc_ske_make_hash(ske, hash, &hash_len, TRUE);
@@ -2429,7 +2415,7 @@
ske->timeout = params->timeout_secs ? params->timeout_secs : 30;
if (ske->flags & SILC_SKE_SP_FLAG_IV_INCLUDED)
ske->session_port = params->session_port;
- ske->version = strdup(params->version);
+ ske->version = params->version;
if (!ske->version)
return NULL;
ske->running = TRUE;
Modified: silc-toolkit/trunk/lib/silcskr/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcskr/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcskr/Makefile.am (original)
+++ silc-toolkit/trunk/lib/silcskr/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/silcskr/Makefile.ad file in the source tree.
# Source: ./lib/silcskr/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcskr/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcskr/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcskr/Makefile.in (original)
+++ silc-toolkit/trunk/lib/silcskr/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/silcskr/Makefile.ad file in the source tree.
# Source: ./lib/silcskr/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcskr/silcskr.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcskr/silcskr.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcskr/silcskr.c (original)
+++ silc-toolkit/trunk/lib/silcskr/silcskr.c Mon Nov 24 16:25:55 2008
@@ -632,8 +632,7 @@
SilcBool silc_skr_init(SilcSKR skr)
{
- if (!silc_mutex_alloc(&skr->lock))
- return FALSE;
+ silc_mutex_alloc(&skr->lock);
skr->keys = silc_hash_table_alloc(0, silc_skr_hash, NULL,
silc_skr_compare, NULL,
Modified: silc-toolkit/trunk/lib/silcutil/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcutil/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcutil/Makefile.am (original)
+++ silc-toolkit/trunk/lib/silcutil/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/silcutil/Makefile.ad file in the source tree.
# Source: ./lib/silcutil/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcutil/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcutil/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcutil/Makefile.in (original)
+++ silc-toolkit/trunk/lib/silcutil/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/silcutil/Makefile.ad file in the source tree.
# Source: ./lib/silcutil/Makefile.ad
-# Generated: Thu Mar 20 08:39:31 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:12 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcutil/silcfdstream.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcutil/silcfdstream.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcutil/silcfdstream.c (original)
+++ silc-toolkit/trunk/lib/silcutil/silcfdstream.c Mon Nov 24 16:25:55 2008
@@ -4,7 +4,7 @@
Author: Pekka Riikonen <priikone at silcnet.org>
- Copyright (C) 2005 - 2007 Pekka Riikonen
+ Copyright (C) 2005 - 2008 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
@@ -21,7 +21,7 @@
/************************** Types and definitions ***************************/
-#define SILC_IS_FD_STREAM(s) (s->ops == &silc_fd_stream_ops)
+#define SILC_IS_FD_STREAM(s) (s && s->ops == &silc_fd_stream_ops)
const SilcStreamOps silc_fd_stream_ops;
Modified: silc-toolkit/trunk/lib/silcutil/silcsocketstream.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcutil/silcsocketstream.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcutil/silcsocketstream.c (original)
+++ silc-toolkit/trunk/lib/silcutil/silcsocketstream.c Mon Nov 24 16:25:55 2008
@@ -4,7 +4,7 @@
Author: Pekka Riikonen <priikone at silcnet.org>
- Copyright (C) 2005 - 2007 Pekka Riikonen
+ Copyright (C) 2005 - 2008 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
@@ -350,6 +350,7 @@
!limit_sec && !limit_usec) {
silc_schedule_task_del_by_context(socket_stream->schedule,
socket_stream->qos);
+ silc_free(socket_stream->qos->buffer);
silc_free(socket_stream->qos);
socket_stream->qos = NULL;
return TRUE;
@@ -370,7 +371,8 @@
socket_stream->qos->cur_rate = 0;
socket_stream->qos->sock = socket_stream;
- socket_stream->qos->buffer = silc_malloc(read_limit_bytes);
+ socket_stream->qos->buffer = silc_realloc(socket_stream->qos->buffer,
+ read_limit_bytes);
if (!socket_stream->qos->buffer)
return FALSE;
Modified: silc-toolkit/trunk/lib/silcutil/silcsocketstream_i.h
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcutil/silcsocketstream_i.h?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcutil/silcsocketstream_i.h (original)
+++ silc-toolkit/trunk/lib/silcutil/silcsocketstream_i.h Mon Nov 24 16:25:55 2008
@@ -4,7 +4,7 @@
Author: Pekka Riikonen <priikone at silcnet.org>
- Copyright (C) 2005 - 2006 Pekka Riikonen
+ Copyright (C) 2005 - 2008 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
@@ -56,8 +56,8 @@
unsigned int connected : 1; /* UDP connected state */
};
-#define SILC_IS_SOCKET_STREAM(s) (s->ops == &silc_socket_stream_ops)
-#define SILC_IS_SOCKET_STREAM_UDP(s) (s->ops == &silc_socket_udp_stream_ops)
+#define SILC_IS_SOCKET_STREAM(s) (s && s->ops == &silc_socket_stream_ops)
+#define SILC_IS_SOCKET_STREAM_UDP(s) (s && s->ops == &silc_socket_udp_stream_ops)
extern const SilcStreamOps silc_socket_stream_ops;
extern const SilcStreamOps silc_socket_udp_stream_ops;
Modified: silc-toolkit/trunk/lib/silcutil/silcstack.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcutil/silcstack.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcutil/silcstack.c (original)
+++ silc-toolkit/trunk/lib/silcutil/silcstack.c Mon Nov 24 16:25:55 2008
@@ -4,7 +4,7 @@
Author: Pekka Riikonen <priikone at silcnet.org>
- Copyright (C) 2003 - 2006 Pekka Riikonen
+ Copyright (C) 2003 - 2008 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
@@ -65,6 +65,9 @@
void silc_stack_free(SilcStack stack)
{
int i;
+
+ if (!stack)
+ return;
silc_free(stack->frames);
for (i = 0; i < SILC_STACK_BLOCK_NUM; i++)
Modified: silc-toolkit/trunk/lib/silcutil/silctypes.h
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcutil/silctypes.h?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcutil/silctypes.h (original)
+++ silc-toolkit/trunk/lib/silcutil/silctypes.h Mon Nov 24 16:25:55 2008
@@ -177,13 +177,13 @@
*
* SOURCE
*/
+#if SILC_SIZEOF_INT == 4
+typedef unsigned int SilcUInt32;
+typedef signed int SilcInt32;
+#else
#if SILC_SIZEOF_LONG == 4
typedef unsigned long SilcUInt32;
typedef signed long SilcInt32;
-#else
-#if SILC_SIZEOF_INT == 4
-typedef unsigned int SilcUInt32;
-typedef signed int SilcInt32;
#else
#if SILC_SIZEOF_LONG_LONG >= 4
#ifndef WIN32
@@ -634,4 +634,11 @@
#endif
/***/
+typedef char __check_size1[sizeof(SilcInt8) == 1 ? 1 : -1];
+typedef char __check_size2[sizeof(SilcUInt8) == 1 ? 1 : -1];
+typedef char __check_size3[sizeof(SilcInt16) == 2 ? 1 : -1];
+typedef char __check_size4[sizeof(SilcUInt16) == 2 ? 1 : -1];
+typedef char __check_size5[sizeof(SilcInt32) == 4 ? 1 : -1];
+typedef char __check_size6[sizeof(SilcUInt32) == 4 ? 1 : -1];
+
#endif /* SILCTYPES_H */
Modified: silc-toolkit/trunk/lib/silcutil/silcutil.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcutil/silcutil.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcutil/silcutil.c (original)
+++ silc-toolkit/trunk/lib/silcutil/silcutil.c Mon Nov 24 16:25:55 2008
@@ -557,13 +557,18 @@
printf("%s", prompt);
fflush(stdout);
+ read_again1:
if ((read(fd, input, sizeof(input))) < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ goto read_again1;
fprintf(stderr, "silc: %s\n", strerror(errno));
+ signal(SIGINT, SIG_DFL);
tcsetattr(fd, TCSANOW, &to_old);
return NULL;
}
if (strlen(input) <= 1) {
+ signal(SIGINT, SIG_DFL);
tcsetattr(fd, TCSANOW, &to_old);
return NULL;
}
@@ -591,10 +596,18 @@
printf("%s", prompt);
fflush(stdout);
+ signal(SIGINT, SIG_IGN);
+
+ read_again2:
if ((read(fd, input, sizeof(input))) < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ goto read_again2;
fprintf(stderr, "silc: %s\n", strerror(errno));
+ signal(SIGINT, SIG_DFL);
return NULL;
}
+
+ signal(SIGINT, SIG_DFL);
if (strlen(input) <= 1)
return NULL;
Modified: silc-toolkit/trunk/lib/silcutil/stacktrace.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcutil/stacktrace.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcutil/stacktrace.c (original)
+++ silc-toolkit/trunk/lib/silcutil/stacktrace.c Mon Nov 24 16:25:55 2008
@@ -4,7 +4,7 @@
Author: Pekka Riikonen <priikone at silcnet.org>
- Copyright (C) 2002, 2007 Pekka Riikonen
+ Copyright (C) 2002 - 2008 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
@@ -17,14 +17,72 @@
*/
+/* This file implements memory leak checker and basic memory corruption
+ and double free checker. It is multi-thread safe. It does the
+ following:
+
+ o Tracks all memory allocations and report any unfreed memory at the
+ end of the program with backtrace where the memory was allocated.
+
+ o Checks if a memory location has been freed already and abort the
+ program with the backtrace of the location of the double free.
+
+ o Checks if a given pointer has been allocated at all and abort the
+ program with the backtrace where the invalid free was given.
+
+ o Checks at the time of free if the memory was written out of bounds
+ (overflow) and abort with the backtrace of the free. The backtrace
+ might not help to find the overflow but at least it is detected.
+ By setting SILC_MALLOC_DUMP the memory is dummped to help and see
+ what it contains.
+
+ o Can detect if the memory is read or written out of bounds (overflow)
+ and abort immediately the with the backtrace when the illegal access
+ occurs. This can be enabled by using SILC_MALLOC_PROTECT.
+
+ The following environment variables can be used:
+
+ SILC_MALLOC_NO_FREE
+
+ When set to value 1, the program doesn't actually free any memory.
+ This provides more detailed information especially in case of double
+ free. If the location of the double free cannot be located, by
+ setting this variable the program will show where the memory was
+ originally allocated and freed.
+
+ SILC_MALLOC_DUMP
+
+ When set to value 1, in case of fatal error, dumps the memory location,
+ if possible. This can help see what the memory contains.
+
+ SILC_MALLOC_PROTECT
+
+ When set to value 1 each allocation will have an inaccesible memory
+ page following the allocated memory area. This will detect if the
+ the memory is accessed (read or write) beyond its boundaries. This
+ will help to identify the place where illegal memory access occurs.
+
+ To work correctly this of course expects that code uses SILC memory
+ allocation and access routines.
+
+*/
+
#include "silc.h"
#ifdef SILC_STACKTRACE
+#include <execinfo.h>
+#include <signal.h>
+#include <malloc.h>
+#include <sys/mman.h>
static void *st_blocks = NULL;
static unsigned long st_blocks_count = 0;
+static unsigned long st_num_malloc = 0;
static SilcBool dump = FALSE;
-static SilcBool malloc_check = FALSE;
+static SilcBool no_free = FALSE;
+static SilcBool dump_mem = FALSE;
+static SilcUInt32 pg = 0;
+static SilcMutex lock = NULL;
#ifdef SILC_DEBUG
#define SILC_ST_DEPTH 15
@@ -34,71 +92,207 @@
/* Memory block with stack trace */
typedef struct SilcStBlockStruct {
- unsigned int dumpped : 1; /* Block is dumpped */
- unsigned int depth : 8; /* Depth of stack trace */
- unsigned int line : 23; /* Allocation line in program */
+ struct SilcStBlockStruct *next;
+ struct SilcStBlockStruct *prev;
void *stack[SILC_ST_DEPTH]; /* Stack trace */
const char *file; /* Allocation file in program */
- unsigned long size; /* Allocated memory size */
- struct SilcStBlockStruct *next;
- struct SilcStBlockStruct *prev;
+ const char *free_file; /* Free file in program */
+ SilcUInt32 size; /* Allocated memory size */
+ SilcUInt16 line; /* Allocation line in program */
+ SilcUInt16 free_line; /* Free line in program */
+ SilcUInt16 depth; /* Depth of stack trace */
+ SilcUInt16 dumpped; /* Block is dumpped */
+ SilcUInt32 bound; /* Top bound */
} *SilcStBlock;
-/* Get current frame pointer */
-#define SILC_ST_GET_FP(ret_fp) \
-do { \
- register void *cfp; \
- asm volatile ("movl %%ebp, %0" : "=r" (cfp)); \
- (ret_fp) = cfp; \
-} while(0);
-
-#define SILC_ST_GET_SIZE(size) ((size + sizeof(struct SilcStBlockStruct)))
+#define SILC_ST_TOP_BOUND 0xfeed1977
+#define SILC_ST_BOTTOM_BOUND 0x9152beef
+#define SILC_ST_GET_SIZE(size) ((size + sizeof(struct SilcStBlockStruct) + 4))
#define SILC_ST_GET_STACK(p) ((SilcStBlock)(((unsigned char *)p) - \
sizeof(struct SilcStBlockStruct)))
#define SILC_ST_GET_PTR(p) (((unsigned char *)p) + \
sizeof(struct SilcStBlockStruct))
-
-void silc_st_stacktrace(SilcStBlock stack)
-{
- void *fp;
-
- if (!dump) {
- atexit(silc_st_dump);
- dump = TRUE;
- }
-
- if (!malloc_check) {
- /* Linux libc malloc check */
- setenv("MALLOC_CHECK_", "2", 1);
-
- /* NetBSD malloc check */
- setenv("MALLOC_OPTIONS", "AJ", 1);
-
- malloc_check = TRUE;
- }
-
- /* Save the stack */
- SILC_ST_GET_FP(fp);
- for (stack->depth = 0; fp; stack->depth++) {
- if (stack->depth == SILC_ST_DEPTH)
- break;
-
- /* Get program pointer and frame pointer from this frame */
- stack->stack[stack->depth] = *((void **)(((unsigned char *)fp) + 4));
- fp = *((void **)fp);
- }
+#define SILC_ST_GET_BOUND(p, size) (SilcUInt32 *)(((unsigned char *)p) + \
+ SILC_ST_GET_SIZE(size) - 4)
+
+#define SILC_ST_ALIGN(bytes, align) (((bytes) + (align - 1)) & ~(align - 1))
+#define SILC_ST_GET_SIZE_ALIGN(size, align) \
+ SILC_ST_ALIGN(SILC_ST_GET_SIZE(size) - 4, align)
+#define SILC_ST_GET_PTR_ALIGN(stack, align) \
+ (((unsigned char *)stack) - (SILC_ST_GET_SIZE_ALIGN(stack->size, pg) - \
+ SILC_ST_GET_SIZE(stack->size)) - 4)
+#define SILC_ST_GET_STACK_ALIGN(p, size, align) \
+ ((SilcStBlock)(((unsigned char *)p) + (SILC_ST_GET_SIZE_ALIGN(size, pg) - \
+ SILC_ST_GET_SIZE(size)) + 4))
+
+#define silc_hexdump(ptr, size, file) \
+ silc_log_output_hexdump("", "", 0, ptr, size, "")
+
+void silc_st_abort(SilcStBlock stack, const char *file, int line,
+ char *fmt, ...)
+{
+ void *bt[SILC_ST_DEPTH];
+ SilcUInt32 *bound;
+ va_list va;
+ int btc;
+
+ va_start(va, fmt);
+ vfprintf(stderr, fmt, va);
+ va_end(va);
+
+ fprintf(stderr, "----- BACKTRACE -----\n%s:%d:\n", file, line);
+ btc = backtrace(bt, SILC_ST_DEPTH);
+ backtrace_symbols_fd(bt, btc, 2);
+
+ if (stack) {
+ fprintf(stderr, "----- MEMORY TRACE -----\n");
+ if (stack->free_file)
+ fprintf(stderr, "Freed at: %s:%d\n", stack->free_file,
+ stack->free_line);
+ fprintf(stderr, "Originally allocated at:\n");
+ fprintf(stderr, "%s:%d:\n", stack->file, stack->line);
+ backtrace_symbols_fd(stack->stack, stack->depth, 2);
+ fflush(stderr);
+
+ if (dump_mem) {
+ fprintf(stderr, "----- MEMORY HEADER -----\n");
+ fprintf(stderr, "Header length: %lu, total length %lu\n",
+ sizeof(struct SilcStBlockStruct), SILC_ST_GET_SIZE(stack->size));
+ silc_hexdump((void *)stack, sizeof(struct SilcStBlockStruct), stderr);
+ fflush(stderr);
+ fprintf(stderr, "Header bound is: %p\n",
+ SILC_32_TO_PTR(stack->bound));
+ if (stack->bound != SILC_ST_TOP_BOUND) {
+ fprintf(stderr, "Header bound should be: %p\n",
+ SILC_32_TO_PTR(SILC_ST_TOP_BOUND));
+ fprintf(stderr, "MEMORY IS CORRUPTED (UNDERFLOW)!\n");
+ }
+
+ fprintf(stderr, "----- USER MEMORY -----\n");
+ fprintf(stderr, "Length: %d\n", stack->size);
+ silc_hexdump(((unsigned char *)stack) +
+ sizeof(struct SilcStBlockStruct), stack->size, stderr);
+ fflush(stderr);
+
+ fprintf(stderr, "----- MEMORY FOOTER -----\n");
+ bound = SILC_ST_GET_BOUND(stack, stack->size);
+ silc_hexdump((unsigned char *)bound, 4, stderr);
+ fprintf(stderr, "Footer bound is: %p\n", SILC_32_TO_PTR(*bound));
+ if (*bound != SILC_ST_BOTTOM_BOUND) {
+ fprintf(stderr, "Footer bound should be: %p\n",
+ SILC_32_TO_PTR(SILC_ST_BOTTOM_BOUND));
+ fprintf(stderr, "MEMORY IS CORRUPTED (OVERFLOW)!\n");
+ }
+ }
+ }
+
+ fflush(stderr);
+
+ abort();
+}
+
+void silc_st_sigsegv(int sig, siginfo_t *si, void *context)
+{
+ SilcStBlock orig, stack = (SilcStBlock)si->si_addr;
+
+ /* Make the page accessible again */
+ mprotect(si->si_addr, pg, PROT_READ | PROT_WRITE);
+
+ /* Get the original page from the violated page */
+ orig = (SilcStBlock)(((unsigned char *)si->si_addr) -
+ SILC_ST_GET_SIZE_ALIGN(stack->size, pg));
+ stack = SILC_ST_GET_STACK_ALIGN(orig, stack->size, pg);
+
+ silc_st_abort(stack, __FILE__, __LINE__,
+ "SILC_MALLOC: access violation (overflow)\n");
+}
+
+void silc_st_stacktrace_init(void)
+{
+ const char *var;
+
+ atexit(silc_st_dump);
+ dump = TRUE;
+
+ var = getenv("SILC_MALLOC_NO_FREE");
+ if (var && *var == '1')
+ no_free = TRUE;
+
+ var = getenv("SILC_MALLOC_DUMP");
+ if (var && *var == '1')
+ dump_mem = TRUE;
+
+ var = getenv("SILC_MALLOC_PROTECT");
+ if (var && *var == '1') {
+ struct sigaction sa;
+
+ sa.sa_flags = SA_SIGINFO;
+ sa.sa_sigaction = silc_st_sigsegv;
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGSEGV, &sa, NULL);
+
+#if defined(_SC_PAGESIZE)
+ pg = sysconf(_SC_PAGESIZE);
+#elif defined(_SC_PAGE_SIZE)
+ pg = sysconf(_SC_PAGE_SIZE);
+#else
+ pg = getpagesize();
+#endif /* _SC_PAGESIZE */
+ }
+
+ /* Linux libc malloc check */
+ setenv("MALLOC_CHECK_", "3", 1);
+
+ /* NetBSD malloc check */
+ setenv("MALLOC_OPTIONS", "AJ", 1);
+
+ silc_mutex_alloc(&lock);
}
void *silc_st_malloc(size_t size, const char *file, int line)
{
- SilcStBlock stack = (SilcStBlock)malloc(SILC_ST_GET_SIZE(size));
- assert(stack != NULL);
+ SilcStBlock stack;
+
+ if (silc_unlikely(!dump))
+ silc_st_stacktrace_init();
+
+ if (pg) {
+ unsigned char *ptr;
+
+ if (posix_memalign((void *)&ptr, pg,
+ SILC_ST_GET_SIZE_ALIGN(size, pg) + pg))
+ return NULL;
+
+ /* The inaccessible page too will include the allocation information
+ so that we can get it when access violation occurs in that page. */
+ stack = (SilcStBlock)(ptr + SILC_ST_GET_SIZE_ALIGN(size, pg));
+ stack->size = size;
+
+ /* Protect the page */
+ if (mprotect(stack, pg, PROT_NONE))
+ silc_st_abort(NULL, file, line, "SILC_MALLOC: mprotect() error: %s\n",
+ errno == ENOMEM ? "Cannot allocate memory. \nYour program "
+ "leaks memory, allocates too much or system \n"
+ "is out of memory. The SILC_MALLOC_PROTECT cannot "
+ "be used." : strerror(errno));
+
+ /* Get the accessible page */
+ stack = SILC_ST_GET_STACK_ALIGN(ptr, size, pg);
+ } else {
+ stack = (SilcStBlock)malloc(SILC_ST_GET_SIZE(size));
+ if (!stack)
+ return NULL;
+ }
stack->dumpped = 0;
stack->file = file;
+ stack->free_file = NULL;
stack->line = line;
stack->size = size;
- silc_st_stacktrace(stack);
+ stack->bound = SILC_ST_TOP_BOUND;
+ stack->depth = backtrace(stack->stack, SILC_ST_DEPTH);
+
+ silc_mutex_lock(lock);
stack->next = st_blocks;
stack->prev = NULL;
@@ -106,6 +300,12 @@
((SilcStBlock)st_blocks)->prev = stack;
st_blocks = stack;
st_blocks_count++;
+ st_num_malloc++;
+
+ silc_mutex_unlock(lock);
+
+ if (!pg)
+ *SILC_ST_GET_BOUND(stack, size) = SILC_ST_BOTTOM_BOUND;
return SILC_ST_GET_PTR(stack);
}
@@ -113,7 +313,8 @@
void *silc_st_calloc(size_t items, size_t size, const char *file, int line)
{
void *addr = (void *)silc_st_malloc(items * size, file, line);
- memset(addr, 0, items * size);
+ if (addr)
+ memset(addr, 0, items * size);
return addr;
}
@@ -125,25 +326,63 @@
return silc_st_malloc(size, file, line);
stack = SILC_ST_GET_STACK(ptr);
- if (stack->size >= size) {
+ if (!pg && stack->size >= size) {
+ /* Must update footer when the size changes */
+ if (stack->size != size)
+ *SILC_ST_GET_BOUND(stack, size) = SILC_ST_BOTTOM_BOUND;
+
stack->size = size;
return ptr;
} else {
void *addr = (void *)silc_st_malloc(size, file, line);
- memcpy(addr, ptr, stack->size);
- silc_st_free(ptr, file, line);
+ if (addr) {
+ memcpy(addr, ptr, size > stack->size ? stack->size : size);
+ silc_st_free(ptr, file, line);
+ }
return addr;
}
}
void silc_st_free(void *ptr, const char *file, int line)
{
- SilcStBlock stack;
+ SilcStBlock stack, s;
if (!ptr)
return;
+ /* Check for double free */
+ if (!memcmp((unsigned char *)ptr - sizeof(struct SilcStBlockStruct),
+ "\x47\x47\x47\x47", 4))
+ silc_st_abort(no_free ? ptr - sizeof(struct SilcStBlockStruct) : NULL,
+ file, line, "SILC_MALLOC: double free: %p already freed\n",
+ ptr - sizeof(struct SilcStBlockStruct));
+
stack = SILC_ST_GET_STACK(ptr);
+
+ silc_mutex_lock(lock);
+
+ /* Check if we have ever made this allocation */
+ for (s = st_blocks; s; s = s->next)
+ if (s == stack)
+ break;
+ if (s == NULL)
+ silc_st_abort(NULL, file, line,
+ "SILC_MALLOC: %p was never allocated\n", stack);
+
+ if (!pg) {
+ /* Check for underflow */
+ if (stack->bound != SILC_ST_TOP_BOUND)
+ silc_st_abort(stack, file, line,
+ "SILC_MALLOC: %p was written out of bounds (underflow)\n",
+ stack);
+
+ /* Check for overflow */
+ if (*SILC_ST_GET_BOUND(stack, stack->size) != SILC_ST_BOTTOM_BOUND)
+ silc_st_abort(stack, file, line,
+ "SILC_MALLOC: %p was written out of bounds (overflow)\n",
+ stack);
+ }
+
if (stack->next)
stack->next->prev = stack->prev;
if (stack->prev)
@@ -153,15 +392,35 @@
st_blocks_count--;
- memset(stack, 'F', SILC_ST_GET_SIZE(stack->size));
- free(stack);
+ silc_mutex_unlock(lock);
+
+ stack->free_file = file;
+ stack->free_line = line;
+
+ if (no_free) {
+ memset(stack, 0x47, 8);
+ return;
+ }
+
+ if (pg) {
+ ptr = SILC_ST_GET_PTR_ALIGN(stack, pg);
+ mprotect(ptr + SILC_ST_GET_SIZE_ALIGN(stack->size, pg), pg,
+ PROT_READ | PROT_WRITE);
+ memset(ptr, 0x47, SILC_ST_GET_SIZE_ALIGN(stack->size, pg));
+ free(ptr);
+ } else {
+ memset(stack, 0x47, SILC_ST_GET_SIZE(stack->size));
+ free(stack);
+ }
}
void *silc_st_memdup(const void *ptr, size_t size, const char *file, int line)
{
unsigned char *addr = (unsigned char *)silc_st_malloc(size + 1, file, line);
- memcpy((void *)addr, ptr, size);
- addr[size] = '\0';
+ if (addr) {
+ memcpy((void *)addr, ptr, size);
+ addr[size] = '\0';
+ }
return (void *)addr;
}
@@ -170,15 +429,20 @@
return silc_st_memdup(string, strlen(string), file, line);
}
-/* Dumps the stack into file if there are leaks. The file can be read
- with a special stacktrace tool. */
+/* Dumps the stack into file if there are leaks. */
void silc_st_dump(void)
{
SilcStBlock stack, s;
unsigned long leaks = 0, blocks, bytes;
FILE *fp = NULL;
+ char **syms, *cp;
int i;
+ SilcMutex l;
+
+ l = lock;
+ lock = NULL;
+ silc_mutex_free(l);
for (stack = st_blocks; stack; stack = stack->next) {
bytes = blocks = 0;
@@ -194,6 +458,10 @@
fp = stderr;
}
+ /* Get symbol names */
+ syms = backtrace_symbols(stack->stack, stack->depth);
+
+ /* Find number of leaks and bytes leaked for this leak */
for (s = stack; s; s = s->next) {
if (s->file == stack->file && s->line == stack->line &&
s->depth == stack->depth &&
@@ -206,10 +474,24 @@
}
if (blocks) {
- fprintf(fp, "<stacktrace>%s:%d: #blocks=%lu, bytes=%lu\n",
+ fprintf(fp, "<leak>%s:%d: #blocks=%lu, bytes=%lu\n",
stack->file, stack->line, blocks, bytes);
- for (i = 0; i < stack->depth; i++)
- fprintf(fp, "\tpc=%p\n", stack->stack[i]);
+ for (i = 0; i < stack->depth; i++) {
+ if (syms) {
+ cp = syms[i];
+ if (strchr(cp, '('))
+ cp = strchr(cp, '(') + 1;
+ else if (strchr(cp, ' '))
+ cp = strchr(cp, ' ') + 1;
+ if (strchr(cp, ')'))
+ *strchr(cp, ')') = ' ';
+ fprintf(fp, "\t%s\n", cp);
+ } else {
+ fprintf(fp, "\tpc=%p\n", stack->stack[i]);
+ }
+ }
+ fprintf(fp, "\n");
+ free(syms);
}
}
@@ -224,6 +506,7 @@
"-----------------------------------------\n"
"-----------------------------------------\n",
leaks, st_blocks_count);
+ fprintf(stderr, "Number of allocations: %lu\n", st_num_malloc);
}
if (fp && fp != stderr)
Modified: silc-toolkit/trunk/lib/silcutil/stacktrace.h
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcutil/stacktrace.h?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcutil/stacktrace.h (original)
+++ silc-toolkit/trunk/lib/silcutil/stacktrace.h Mon Nov 24 16:25:55 2008
@@ -1,6 +1,6 @@
/*
- stacktrace.h
+ stacktrace.h
Author: Pekka Riikonen <priikone at silcnet.org>
@@ -17,14 +17,14 @@
*/
-#ifndef STACKTRACE_H
-#define STACKTRACE_H
+#ifndef MEMTRACE_H
+#define MEMTRACE_H
#ifndef SILCMEMORY_H
#error "Do not include internal header file directly"
#endif
-#if defined(__GNUC__) && defined(__i386__)
+#if defined(__GNUC__)
#undef strdup
#define silc_malloc(s) silc_st_malloc((s), __FILE__, __LINE__)
@@ -32,6 +32,7 @@
#define silc_realloc(p, s) silc_st_realloc((p), (s), __FILE__, __LINE__)
#define silc_free(p) silc_st_free((p), __FILE__, __LINE__)
#define silc_memdup(p, s) silc_st_memdup((p), (s), __FILE__, __LINE__)
+#define silc_strdup(s) silc_st_strdup((s), __FILE__, __LINE__)
#define strdup(s) silc_st_strdup((s), __FILE__, __LINE__)
void *silc_st_malloc(size_t size, const char *file, int line);
@@ -44,6 +45,6 @@
#else
#error "memory allocation stack trace not supported on this platform"
-#endif /* __GNUC__ && __i386__ */
+#endif /* __GNUC__ */
-#endif /* STACKTRACE_H */
+#endif /* MEMTRACE_H */
Modified: silc-toolkit/trunk/lib/silcutil/unix/silcunixschedule.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcutil/unix/silcunixschedule.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcutil/unix/silcunixschedule.c (original)
+++ silc-toolkit/trunk/lib/silcutil/unix/silcunixschedule.c Mon Nov 24 16:25:55 2008
@@ -4,7 +4,7 @@
Author: Pekka Riikonen <priikone at silcnet.org>
- Copyright (C) 1998 - 2007 Pekka Riikonen
+ Copyright (C) 1998 - 2008 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
@@ -288,6 +288,7 @@
SILC_LOG_DEBUG(("epoll_ctl (DEL): %s", strerror(errno)));
return FALSE;
}
+ task->scheduled = FALSE;
return TRUE;
}
Modified: silc-toolkit/trunk/lib/silcutil/unix/silcunixsocketstream.c
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcutil/unix/silcunixsocketstream.c?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcutil/unix/silcunixsocketstream.c (original)
+++ silc-toolkit/trunk/lib/silcutil/unix/silcunixsocketstream.c Mon Nov 24 16:25:55 2008
@@ -4,7 +4,7 @@
Author: Pekka Riikonen <priikone at silcnet.org>
- Copyright (C) 1997 - 2007 Pekka Riikonen
+ Copyright (C) 1997 - 2008 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
@@ -106,8 +106,9 @@
/* If QoS was applied, return the data that was pending. */
if (sock->qos->applied && sock->qos->data_len) {
memcpy(buf, qosbuf, sock->qos->data_len);
+ len = sock->qos->data_len;
sock->qos->data_len = 0;
- return sock->qos->data_len;
+ return len;
}
/* If we have active QoS data pending, return with no data */
@@ -116,7 +117,8 @@
return -1;
}
- /* Read the data from the socket. Never read more than the max limit. */
+ /* Read the data from the socket. The qosbuf size is always the max
+ read limit size. */
len = (buf_len < sock->qos->read_limit_bytes ? buf_len :
sock->qos->read_limit_bytes);
len = read(sock->sock, qosbuf, len);
Modified: silc-toolkit/trunk/lib/silcvcard/Makefile.am
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcvcard/Makefile.am?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcvcard/Makefile.am (original)
+++ silc-toolkit/trunk/lib/silcvcard/Makefile.am Mon Nov 24 16:25:55 2008
@@ -2,7 +2,7 @@
# To make changes edit the ./lib/silcvcard/Makefile.ad file in the source tree.
# Source: ./lib/silcvcard/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/lib/silcvcard/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/lib/silcvcard/Makefile.in?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/lib/silcvcard/Makefile.in (original)
+++ silc-toolkit/trunk/lib/silcvcard/Makefile.in Mon Nov 24 16:25:55 2008
@@ -18,7 +18,7 @@
# To make changes edit the ./lib/silcvcard/Makefile.ad file in the source tree.
# Source: ./lib/silcvcard/Makefile.ad
-# Generated: Thu Mar 20 08:39:30 EET 2008 by priikone
+# Generated: Sat Oct 25 17:16:11 EEST 2008 by priikone
# Distribution: Toolkit
# License: distdir/TOOLKIT
Modified: silc-toolkit/trunk/silc-toolkit.spec
URL: http://svn.debian.org/wsvn/pkg-silc/silc-toolkit/trunk/silc-toolkit.spec?rev=324&op=diff
==============================================================================
--- silc-toolkit/trunk/silc-toolkit.spec (original)
+++ silc-toolkit/trunk/silc-toolkit.spec Mon Nov 24 16:25:55 2008
@@ -1,6 +1,6 @@
Summary: SILC Toolkit
Name: silc-toolkit
-Version: 1.1.7
+Version: 1.1.8
Release: 0.fc8
License: GPL/BSD dual licensed
Group: System Environment/Libraries
More information about the Pkg-silc-commits
mailing list