+Fri Apr 22 12:21:44 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
+
+ * Use silc_server_send_command_reply to send replies instead
+ of encoding packet itself. Affected file silcd/command.c.
+
+ * Added command sending and receiving statistics to server.
+ Affected files in silcd/.
+
+ * GCC 4 warning fixes. -Wno-pointer-sign option is now used
+ with GCC, for it not to warn about pointer signedness.
+
+Tue Apr 19 11:57:35 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added context to the SilcIDCache destructor. Affected
+ files are lib/silccore/silcidcache.[ch],
+ lib/silcclient/client.c and silcd/server.c.
+
+Mon Apr 18 09:53:28 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added pkg-config check to configure.
+
+ * The PublicKeyDir must not be used with Admin block in server
+ config. Affected file silcd/serverconfig.c.
+
Sat Apr 16 20:23:48 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
* Added Autodist.
-mkdir -p $(docdir)/toolkit/
-$(INSTALL_DATA) $(srcdir)/doc/toolkit/* $(docdir)/toolkit
-$(INSTALL_DATA) $(srcdir)/lib/doc/*.gif $(docdir)/toolkit
- -cp -R $(srcdir)/tutorial $(prefix)
+ -cp -R $(srcdir)/tutorial $(docdir)
#endif SILC_DIST_TOOLKIT
install-data-hook: \
the procedure what one should do when distribution is created for
releasing.
-
-The 'distributions' file
-========================
-
-The 'distributions' file descibres all distributions that can be created
-from the SILC CVS source tree. You should read that file if you want to
-learn how to create new distributions. The file already defines the main
-distributions that can be created from the soure tree. These are the
-'client', 'server' and 'toolkit' distributions.
+The distdir/ directory contains all distributions that can be created
+from the source tree. The distdir/default cannot be packaged, it must
+be used only for development.
Preparing distribution
======================
-The SILC CVS source tree must be prepared before it can be configured,
-compiled and packaged. The ./prepare script is used to prepare
-distribution for configuration, compilation and packaging. To prepare a
-specific distribution with specific version, give command:
+To prepare a specific distribution with specific version for packaging,
+give command:
autodist <name> <version>
--- /dev/null
+Sat Apr 23 12:49:09 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
+
+ * Autodist 1.2.1.
+
+ * Fixed 'noprocess' sed script.
+
+Fri Apr 22 20:23:06 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
+
+ * Autodist 1.2.
+
+ * Various 'cat' optimizations.
+
+ * More test cases in tests/.
+
+ * No Autodist header for "other" '.ad' files as we don't know
+ what the file contains.
+
+ * No non-source distdef format processing for source files
+ anymore.
+
+Tue Apr 19 17:12:09 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
+
+ * Remove extra ' ' and '\t' when joining backslashed lines.
+
+ * Fixed argument delivery to hook scripts.
+
+Mon Apr 18 21:05:42 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
+
+ * Process '*.ad' files before calling autoconf and automake.
+
+ * Various shell compatibility kludges added.
+
+Mon Apr 18 20:06:24 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
+
+ * Autodist 1.1.
+
+ * All 'local' variables must be at the start of function for
+ compatibility.
+
+Sun Apr 17 20:08:28 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added TODO.
+
+ * Added pre-process-dist-hook and post-process-dist-hook.
+
+ * Added autodist.1.
+
+Sun Apr 16 23:00:02 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
+
+ * First release, Autodist 1.0.
--- /dev/null
+TODO In Autodist
+================
+
+o Autodist should produce output file when 'license-header' is used for
+ files that _was not_ re-licensed. This would be useful to check if
+ there are files in the distribution with wrong license.
+
+o Better 'license-header' implementation.
+
+o Perhaps ability to partially re-license the source tree. Now all files
+ will be processed if 'license-header' is used.
+
+o Better 'noprocess' so that it would work with directories recursively,
+ such as noprocess foo/bar, would not process anything under foo/bar.
+
+o Perhaps output autodist.log when processing the source tree.
# Location of the automake tool. If this is omitted the Autodist will not
# run automake. User need to run it manually then.
#
-AUTOMAKE="automake -a"
+AUTOMAKE="automake -a -c"
# Location of the libtoolize tool. This option should be omitted if your
# source tree does not use libtool.
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+###############################################################################
+# Shell compatibility
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ # Despite of this, we have managed to segfault some zsh's.
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+
###############################################################################
# Global variables
undistdefs=
# All distribution options
-options=
+doptions=
opt_template=false
opt_no_dist=false
opt_no_inherit=false
# All noprocesses
noprocess=
-# All pre, post pre-dist and post-dist hooks
+# All hooks
pre_hooks=
post_hooks=
pre_dist_hooks=
post_dist_hooks=
+pre_p_dist_hooks=
+post_p_dist_hooks=
# Distribution license and license header
license=
fname=$DISTDEFS
rm -f $fname
- echo "/*" > $fname
- echo " Automatically generated by Autodist $ver. Do not edit." >> $fname
- echo >> $fname
- echo " Generated: `date` by `whoami`" >> $fname
- echo " Distribution: $distribution" >> $fname
- echo " License: $license" >> $fname
- echo "*/" >> $fname
- echo >> $fname
- echo "#ifndef _"$DP"_DISTDEFS_H" >> $fname
- echo "#define _"$DP"_DISTDEFS_H" >> $fname
- echo >> $fname
+ cat > $fname <<EOF
+/*
+ Automatically generated by Autodist $ver. Do not edit.
+
+ Generated: `date` by `whoami`
+ Distribution: $distribution
+ License: $license
+*/
+
+#ifndef _`echo $DP`_DISTDEFS_H
+#define _`echo $DP`_DISTDEFS_H
+
+EOF
for i in $distdefs
do
echo "#define $i 1" >>$fname
done
- echo >> $fname
- echo "#endif /* _"$DP"_DISTDEFS_H */" >> $fname
+ cat >> $fname <<EOF
+#endif /* _`echo $DP`_DISTDEFS_H */
+EOF
ad_debug "<ad_create_distdefs_h"
}
#
ad_make_configure()
{
- ad_debug ">ad_make_configure"
local run_autoconf=false
+ ad_debug ">ad_make_configure"
+
rm -f configure
if test "$ACLOCAL"; then
ad_debug "Running aclocal"
- $ACLOCAL 1>/dev/null 2>/dev/null
+ if test x$debug = xtrue; then
+ $ACLOCAL
+ else
+ $ACLOCAL 1>/dev/null 2>/dev/null
+ fi
if test $? != 0; then
ad_fatal "aclocal failed"
fi
#
ad_make_configure_ac()
{
+ local check
+
ad_debug ">ad_make_configure_ac: $1"
if test '!' -f $1; then
ad_fatal "The configure file '$1' does not exist"
fi
- local check="`cat $1 | sed 's/^[ ]*//' | grep -v "^#" | grep -e "AD_INIT"`"
+ check="`sed 's/^[ ]*//' < $1 | grep -v "^#" | grep -e "AD_INIT"`"
if test -z $check; then
rm -f configure.ad.cfs
rm -f $fname $fname.tmp
done
if test -f configure.ad.cfs; then
- local check="`cat $1 | sed 's/^[ ]*//' | grep -v "^#" | grep -e "AD_INCLUDE_CONFIGURE"`"
+ check="`sed 's/^[ ]*//' < $1 | grep -v "^#" | grep -e "AD_INCLUDE_CONFIGURE"`"
if test -z $check; then
rm -f configure.ad.cfs
ad_warning "configure.ad fragments found but 'AD_INCLUDE_CONFIGURE' is not set"
# Header for configure.ac
fname="configure.tmp.ac"
- echo "# Automatically generated by Autodist $ver. Do not edit." > $fname
- echo "# To make changes edit the $i file in the source tree." >> $fname
- echo >> $fname
- echo "# Source: $i" >> $fname
- echo "# Generated: `date` by `whoami`" >> $fname
- echo "# Distribution: $distribution" >> $fname
- echo "# License: $license" >> $fname
- echo >> $fname
+ cat > $fname <<EOF
+# Automatically generated by Autodist $ver. Do not edit.
+# To make changes edit the configure.ad file in the source tree.
+
+# Source: configure.ad
+# Generated: `date` by `whoami`
+# Distribution: $distribution
+# License: $license
+
+EOF
ad_debug "creating configure.ac"
if test -f configure.ad.cfs; then
# Remove any trailing backslashes
if test -f "$fname"; then
- cat $fname | sed -e :a -e '/\\$/N; s/\\\n//; ta' > configure.ac
+ sed -e :a -e '/\\$/N; s/[ ]*\\\n//; ta' < $fname > configure.ac
else
cp -p $fname.tmp configure.ac
fi
fname=`echo $ff | sed s/\.ad//`
# Header for the Makefile.am
- echo "# Automatically generated by Autodist $ver from Makefile.ad. Do not edit." > $fname.am
- echo "# To make changes edit the $ff file in the source tree." >> $fname.am
- echo >> $fname.am
- echo "# Source: $ff" >> $fname.am
- echo "# Generated: `date` by `whoami`" >> $fname.am
- echo "# Distribution: $distribution" >> $fname.am
- echo "# License: $license" >> $fname.am
- echo >> $fname.am
+ cat > $fname.am <<EOF
+# Automatically generated by Autodist $ver from Makefile.ad. Do not edit.
+# To make changes edit the $ff file in the source tree.
+
+# Source: $ff
+# Generated: `date` by `whoami`
+# Distribution: $distribution
+# License: $license
+
+EOF
# Run the distribution processing for this Makefile.ad
ad_debug "Processing $ff to be $fname.am"
# Remove any trailing backslashes
if test -f "$fname.tmp"; then
- cat $fname.tmp | sed -e :a -e '/\\$/N; s/\\\n//; ta' >> $fname.am
+ sed -e :a -e '/\\$/N; s/[ ]*\\\n//; ta' < $fname.tmp >> $fname.am
else
cat $ff >> $fname.am
fi
do
fname=`echo $i | sed s/\.ad//`
- # Header
- echo "# Automatically generated by Autodist $ver. Do not edit." > $fname
- echo "# To make changes edit the $i file in the source tree." >> $fname
- echo >> $fname
- echo "# Source: $i" >> $fname
- echo "# Generated: `date` by `whoami`" >> $fname
- echo "# Distribution: $distribution" >> $fname
- echo "# License: $license" >> $fname
- echo >> $fname
-
# Run the distribution processing for this file
ad_debug "Processing $i to be $fname"
ad_process_file $i $fname
#
ad_dist_includes()
{
+ local incs
+
ad_debug ">ad_dist_includes: $1 $2"
# By default do not expand pathnames
set -f
# Add : separator at the end
- local incs="`echo "$1" | sed 's/$/ : /'`"
+ incs="`echo "$1" | sed 's/$/ : /'`"
src=
dst=
fi
# Recursively call this function with expanded pathnames. The
- # reason why we don't let sh by default expand patnames is that
+ # reason why we don't let sh by default expand pathnames is that
# the include's destination is optional. If sh expands by default
# we don't know the destination. For this reason, we handle the
# expansion here ourselves.
{
ad_debug ">ad_process_tree: $1"
- # We take all files, other than *.ad, including source files, in case
- # they use the non-C-compiler-friendly format of distdefs, which is
- # possible.
-
- files=`find $am_distdir \! -name \*\.ad`
+ # Take files, except source and .ad files.
+ files=`find $am_distdir \! -name \*\.ad \( \
+ \! -name \*\.[cC] -a \
+ \! -name \*\.[cC][cCpP] -a \
+ \! -name \*\.[cC][xX][xX] -a \
+ \! -name \*\.[cC][pP][pP] -a \
+ \! -name \*\.[cC]++ -a \
+ \! -name \*\.m -a \
+ \! -name \*\.[hH] -a \
+ \! -name \*\.hh \)`
files=`echo $files | sed 's/$am_distdir//'`
# Take away noprocess list
if test -f autodist.noprocess; then
- files=`echo $files | sh autodist.noprocess` || exit 1
+ files=`echo $files" " | sh autodist.noprocess` || exit 1
fi
for ff in $files
# Take away noprocess list
if test -f autodist.noprocess; then
- files=`echo $files | sh autodist.noprocess` || exit 1
+ files=`echo $files" " | sh autodist.noprocess` || exit 1
fi
for ff in $files
ad_fatal "Makefile: No such file or directory"
fi
- configh=`grep "^CONFIG_HEADER" Makefile | cut -d= -f2 | sed 's/^[ \t]//'`
+ configh=`grep "^CONFIG_HEADER" Makefile | cut -d= -f2 | sed 's/^[ ]*//'`
touch $am_distdir/$configh.in 1>/dev/null 2>/dev/null
files=`find $am_distdir -name Makefile\.in`
fi
# Parse the requested distribution
- distribution=`cat autodist.dist | grep "dist:" | cut -d: -f2`
- dist_version=`cat autodist.dist | grep "ver:" | cut -d: -f2`
+ distribution=`grep "dist:" < autodist.dist | cut -d: -f2` || exit 1
+ dist_version=`grep "ver:" < autodist.dist | cut -d: -f2` || exit 1
+ am_distdir=`grep "distdir:" < autodist.dist | cut -d: -f2` || exit 1
ad_parse_distribution $distribution false
ad_process_distdefs
- am_distdir="$package-$dist_version"
if test x$opt_no_dist = xtrue; then
ad_fatal "The '$distribution' distribution cannot be packaged"
fi
+ # Run pre-dist-hooks
+ ad_run_dist_hooks "$pre_dist_hooks"
+
# Create distribution directory
ad_debug "Creating distribution directory $am_distdir"
$MAKE distdir || exit 1
ad_fatal "Distribution directory $am_distdir not created"
fi
- # Run pre-dist-hooks
- ad_run_dist_hooks "$pre_dist_hooks"
+ # Run pre-process-dist-hooks
+ ad_run_dist_hooks "$pre_p_dist_hooks"
# Run excludes
ad_dist_excludes "$excludes"
ad_debug "Process distribution tree"
ad_process_tree $am_distdir
- # Run post-dist-hooks
- ad_run_dist_hooks "$post_dist_hooks"
+ # Run post-process_dist-hooks
+ ad_run_dist_hooks "$post_p_dist_hooks"
# Make distribution sane
ad_makedist_makesane
fi
rm -f $am_distdir.tar
+ # Run post-dist-hooks
+ ad_run_dist_hooks "$post_dist_hooks"
+
# Cleanup
rm -rf $am_distdir
rm -f autodist.noprocess
#
ad_parse_distribution()
{
+ local inhs
+ local defs
+ local undefs
+ local incs
+ local excs
+ local nops
+ local opts
+ local dname
+ local dpname
+ local bugr
+ local prh
+ local poh
+ local prdh
+ local podh
+ local prpdh
+ local popdh
+
ad_debug ">ad_parse_distribution: $1 $2"
if test '!' -f $distdir/$1; then
fi
# Get inherited
- local inhs=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ inhs=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "inherit " | cut -d' ' -f2 | sort | uniq`
# Get distdefs
- local defs=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ defs=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "define " | cut -d' ' -f2 | sort | uniq`
if test "$inhs" = "" && test "$defs" = ""; then
fi
# Get undefined distdefs
- local undefs=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ undefs=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "undef " | cut -d' ' -f2 | sort | uniq`
# Get includes
- local incs=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ incs=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "include " | sed 's/include / : /'`
# Get excludes
- local excs=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ excs=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "exclude " | cut -d' ' -f2- | sort | uniq`
# Get noprocesses
- local nops=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ nops=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "noprocess " | cut -d' ' -f2- | sort | uniq`
# Get options
- local opts=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ opts=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "option " | cut -d' ' -f2- | sort | uniq`
# Check options
ad_fatal "Template distribution '$1' cannot be prepared or packaged"
fi
- ad_debug "inherits=$inhs"
- ad_debug "distdefs=$defs"
- ad_debug "includes=$incs"
- ad_debug "excludes=$excs"
- ad_debug "noprocess=$nops"
- ad_debug "undistdefs=$undefs"
- ad_debug "options=$opts"
+ ad_debug "inherits: $inhs"
+ ad_debug "distdefs: $defs"
+ ad_debug "includes: $incs"
+ ad_debug "excludes: $excs"
+ ad_debug "noprocess: $nops"
+ ad_debug "undistdefs: $undefs"
+ ad_debug "options: $opts"
# Expand distdefs from inherited distributions
for i in $inhs
done
# Get license
- license=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ license=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "license " | cut -d' ' -f2`
- licenseh=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ licenseh=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "license-header " | sed 's/license-header / : /'`
- ad_debug "license=$license"
- ad_debug "licenseh=$licenseh"
+ ad_debug "license: $license"
+ ad_debug "licenseh: $licenseh"
if test x$2 = xfalse; then
# Get distribution name
- local dname=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ dname=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "name " | cut -d' ' -f2-`
if test "$dname"; then
fi
# Get distribution package name (optional)
- local dpname=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ dpname=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "package " | cut -d' ' -f2`
if test "$dpname"; then
fi
# Get Bug-report email address (optional)
- local bugr=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ bugr=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "bug-report " | cut -d' ' -f2-`
if test "$bugr"; then
bug_report=$bugr
fi
- ad_debug "distribution=$distribution"
- ad_debug "package=$package"
- ad_debug "bug-report=$bug_report"
+ ad_debug "distribution: $distribution"
+ ad_debug "package: $package"
+ ad_debug "bug-report: $bug_report"
# Get hooks (optional)
- local prh=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ prh=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "pre-hook " | cut -d' ' -f2-`
- local poh=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
+ poh=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
| grep "post-hook " | cut -d' ' -f2-`
- local prdh=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \
- | grep "pre-dist-hook " | sed 's/^[ ]*//' | cut -d' ' -f2-`
- local podh=`cat $distdir/$1 | grep -v "^#" \
- | grep "post-dist-hook " | sed 's/^[ ]*//' | cut -d' ' -f2-`
+ prdh=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
+ | grep "pre-dist-hook " | cut -d' ' -f2-`
+ podh=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
+ | grep "post-dist-hook " | cut -d' ' -f2-`
+ prpdh=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
+ | grep "pre-process-dist-hook " | cut -d' ' -f2-`
+ popdh=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \
+ | grep "post-process-dist-hook " | cut -d' ' -f2-`
pre_hooks="$pre_hooks $prh"
post_hooks="$post_hooks $poh"
pre_dist_hooks="$pre_dist_hooks $prdh"
post_dist_hooks="$post_dist_hooks $podh"
- options="$options $opts"
+ pre_p_dist_hooks="$pre_p_dist_hooks $prpdh"
+ post_p_dist_hooks="$post_p_dist_hooks $popdh"
+ doptions="$doptions $opts"
- ad_handle_options "$options"
- ad_debug "options=$options"
+ ad_handle_options "$doptions"
+ ad_debug "options: $doptions"
fi
# Return to caller
distdefs=`echo $distdefs | sed s/$i//`
done
- rm -f autodist.tmp.defs autodist.pre.hooks autodist.post.hooks
- rm -f autodist.pre.dist.hooks autodist.post.dist.hooks
+ rm -f autodist.tmp.defs
# Remove duplicate distdefs
for i in $distdefs
do
echo $i >>autodist.tmp.defs
done
- distdefs=`cat autodist.tmp.defs | sort | uniq`
+ distdefs=`sort < autodist.tmp.defs | uniq`
distdefs=`echo $distdefs`
rm -f autodist.tmp.defs
#
ad_process_noprocess()
{
- ad_debug ">ad_process_noprocess"
local np=false
-
local n="sed "
+ ad_debug ">ad_process_noprocess"
+
+ cur=`pwd`
+ cd $am_distdir || exit 1
for i in $noprocess
do
# Escape
ie=`echo $i | sed 's/\\//\\\\\//g'` || exit 1
- n="$n -e 's/$am_distdir\\/$ie//'"
+ n="$n -e 's/$am_distdir\\/$ie //'"
np=true
done
+ cd $cur || exit 1
rm -f autodist.noprocess
if test x$np = xtrue; then
ad_process_file()
{
local found=false
+ local f
+ local defs
+ local ndefs
# Process only regular files
if test '!' -f $1; then
ad_debug ">ad_process_file: $1 $2"
- local f="autodist.tmp.script"
+ f="autodist.tmp.script"
rm -f $f
# If license header is provided, replace the license header in the file.
ad_debug "Getting #ifdef's and #ifndef's"
# Get defined distribution defines
- local defs=`awk "/^#ifdef "$DP"_DIST_|^#else "$DP"_DIST_/ { print; }" \
+ defs=`awk "/^#ifdef "$DP"_DIST_|^#else "$DP"_DIST_/ { print; }" \
$1 |cut -d'*' -f2 |cut -d' ' -f2 | sort | uniq`
# Get explicitly not-defined distribution defines
- local ndefs=`awk "/^#ifndef "$DP"_DIST_|^#else !"$DP"_DIST_/ { print; }" \
+ ndefs=`awk "/^#ifndef "$DP"_DIST_|^#else !"$DP"_DIST_/ { print; }" \
$1 |cut -d'*' -f2 |cut -d' ' -f2 | cut -d'!' -f2 | sort | uniq`
- ad_debug "defs=$defs"
- ad_debug "ndefs=$ndefs"
+ ad_debug "defs in $1: $defs"
+ ad_debug "ndefs in $1: $ndefs"
# Create the script to include and exclude stuff in the file according
# to the distribution defines
ad_process_source_file()
{
local found=false
+ local f
+ local defs
+ local ndefs
# Process only regular files
if test '!' -f $1; then
ad_debug ">ad_process_source_file: $1 $2"
- local f="autodist.tmp.script"
+ f="autodist.tmp.script"
rm -f $f
# If license header is provided, replace the license header in the file.
ad_debug "Getting #ifdef's and #ifndef's"
# Get defined distribution defines
- local defs=`awk '/^#ifdef SILC_DIST_|^#else \/\* SILC_DIST_/ { print; }' \
+ defs=`awk '/^#ifdef SILC_DIST_|^#else \/\* SILC_DIST_/ { print; }' \
$1 |cut -d'*' -f2 |cut -d' ' -f2 | sort | uniq`
# Get explicitly not-defined distribution defines
- local ndefs=`awk '/^#ifndef SILC_DIST_|^#else \/\* \!SILC_DIST_/ { print; }' \
+ ndefs=`awk '/^#ifndef SILC_DIST_|^#else \/\* \!SILC_DIST_/ { print; }' \
$1 |cut -d'*' -f2 |cut -d' ' -f2 | cut -d'!' -f2 | sort | uniq`
- ad_debug "defs=$defs ndefs=$ndefs"
+ ad_debug "defs in $1: $defs"
+ ad_debug "ndefs in $1: $ndefs"
# Create the script to include and exclude stuff in the file according
# to the distribution defines
if test '!' -f $i; then
ad_fatal "Hook script $i does not exist"
fi
- sh $i $distribution $dist_version $package || exit 1
+ sh $i "$distribution" "$dist_version" "$package" || exit 1
done
ad_debug "<ad_run_hooks: $1"
if test '!' -f $i; then
ad_fatal "Dist hook script $i does not exist"
fi
- sh $i $distribution $dist_version $package $am_distdir || exit 1
+ sh $i "$distribution" "$dist_version" "$package" "$am_distdir" || exit 1
done
ad_debug "<ad_run_dist_hooks: $1"
#
ad_make_configure_ac ./configure.ad
+#
+# Process all files with .ad suffix for distribution processing
+#
+ad_process_ads
+
#
# Generate configure script
#
#
ad_make_makefile_ins
-#
-# Process all files with .ad suffix for distribution processing
-#
-ad_process_ads
-
#
# Create autodist.dist
#
ad_debug "Creating autodist.dist"
echo "dist:$distfile" > autodist.dist
echo "ver:$dist_version" >> autodist.dist
-echo "$package-$dist_version" >> autodist.dist
+echo "distdir:$package-$dist_version" >> autodist.dist
#
# Run post-hooks
apps/autodist/autodist
apps/autodist/makedist
apps/autodist/doc/Makefile
+apps/autodist/doc/autodist.1
apps/autodist/tests/Makefile
)
#endif SILC_DIST_AUTODIST
info_TEXINFOS = autodist.texi
autodist_TEXINFOS = fdl.texi
+
+man_MANS = autodist.1
+EXTRA_DIST = $(man_MANS)
--- /dev/null
+.TH AUTODIST "1" "April 2005" "@PACKAGE_NAME@ @VERSION@" "User Commands"
+.SH NAME
+Autodist \- Source distribution management system
+.SH SYNOPSIS
+.B autodist
+[options] [distribution] [version]
+.PP
+.SH DESCRIPTION
+.PP
+The Autodist is a source distribution management system that allows
+powerful mechanisms to define what is included in and excluded from a
+distribution, and what license the distribution is released under. It is
+also used to create the actual distribution source packages. Autodist
+allows distribution management in file, directory and file content level.
+Different distributions may include different portions of files, for
+example, excluding certain features from certain distributions. It is
+always guaranteed that anything not defined for the distribution, is
+removed automatically (files, file content, directories), thus ensuring
+that nothing is accidentally included in the distribution.
+.PP
+Autodist is closely related to the Autoconf and Automake tools, and
+complements the features Autoconf and Automake provides. It is especially
+targeted into circumstances where multiple distributions are created from
+one source tree. The Autoconf and Automake environment is mainly designed
+for one application per one source tree situations. Autodist provides
+mechanisms to create all kinds of distributions that can be created from
+one source tree. To be able to use Autodist, the Autoconf and Automake
+must be installed into the system.
+.PP
+.SH OPTIONS
+.B Operation modes:
+.PP
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Prints the help for the Autodist and exits.
+.PP
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Prints version number and exits.
+.PP
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Verbosely report processing.
+.PP
+.TP
+\fB\-d\fR, \fB\-\-distdir\fR
+Search distributions from <dir> instead of default 'distdir'.
+.PP
+.TP
+\fB\-s\fR, \fB\-\-distdefs\fR \fB[<dist>]\fR
+Prints distribution defines of <dist> and exits.
+.PP
+.TP
+\fB\-i\fR, \fB\-\-init\fR
+Initializes Autodist environment. Creates the default distribution
+directory 'distdir', 'autodist.conf' configuration file and the
+default distribution 'default', then exits.
+.PP
+.TP
+\fB\-m\fR, \fB\-\-makedist\fR
+Creates and packages distribution
+.PP
+.TP
+\fB\-\-gzip\fR
+Create package compressed with gzip (default)
+.PP
+.TP
+\fB\-\-bzip2\fR
+Create also package compressed with bzip2
+.PP
+.TP
+\fB\-\-compress\fR
+Create also package compressed with compress
+.PP
+.TP
+\fB\-\-zip\fR
+Create also package compressed with zip
+.SH COPYRIGHT
+Copyright \(co 2005 Pekka Riikonen, SILC Project
+.br
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE.
+.SH "SEE ALSO"
+.BR autoconf (1),
+.BR automake (1),
+.PP
+The full documentation for
+.B autodist
+is maintained as a Texinfo manual. If the
+.B info
+and
+.B autodist
+programs are properly installed at your site, the command
+.IP
+.B info autodist
+.PP
+should give you access to the complete manual.
The 'AUTOMAKE' specifies the location of the 'automake' tool. If
Autodist should not run 'automake' this option may be removed or set
to empty value. User need to then run it manually. By default, the
-'-a' and '-c' options are given to 'automake' to add any missing required
+'-a' and '-c' options are given to 'automake' to add any missing required
files.
The 'name' directive defines the name of the distribution. It is optional
directive, and if omitted the distribution name will be the name of the
-distfile.
+distfile. The 'PACKAGE_NAME' define delivered by Autoconf will contain
+this name string.
Example:
@example
be the name of the distribution, if defined, or if omitted, then the name
of the distfile. If this directive is omitted then normal GNU convention
is used to decide the package name, derived from the distribution name.
+The 'PACKAGE_TARNAME' define delivered by Autoconf will contain this
+package name string.
Example:
@example
The 'bug-report' directive can be used to define the email address where
the bug-reports for the distribution should be sent. The directive is
-optional. The 'bug-report' email address will be set for the Autoconf
-which will deliver it via AC_INIT macro.
+optional. The 'PACKAGE_BUGREPORT' define delivered by Autoconf will
+contain this bug report string.
@section Directive: license <filename>
of the lines from the current header will not be replaced. If the new header
has fewer lines, empty lines must be added to it. If the new header file
has more lines than the current header file, the extra lines will not appear
-in the replaced header. Basic rule is to always make sure the header file
-has equal amount of lines in them.
+in the replaced header. Basic rule is to always make sure the header
+files have equal amount of lines in them.
Second limitation is in indentation of the header files. It is suggested,
though not mandatory, that the header files have the same indentation as
If same indentation is not used the appearance of the replaced header
may not be perfect. While this is a cosmetic issue, one still to remember.
+Third limitation is that the distribution cannot be partially re-licensed.
+If the 'license-header' directive is used then all files that have the
+specified header will be replaced with the new header. There are
+currently two ways to not re-license a file; use different license header
+in the file than one specified in 'license-header', or specify the file or
+directory in 'noprocess' directive. Using 'noprocess' is not possible if
+the file needs to be otherwise processed for the distribution. Future
+versions of Autodist may provide a mechanism to re-license only part of
+the distribution.
+
Example current header:
@example
--- Start example
file in the distribution it will be replaced with the new header file.
Notice that, both header files has same amount of lines (8 lines).
-Note that, the current header must match exactly the header used in
+Note that, the current header must match exactly the header used in
files. Otherwise the replacement will not be complete.
template
@end example
-When set, the distribution is a template distribution. Templates are
-special distributions which cannot be prepared or packaged with Autodist.
-Templates can only be inherited. Usually, templates are used to define a
-common template distribution for other distributions. Templates may set
-distdefs, undefines, includes and excludes. A large software project
-could have several distributions that share a common base. In this case
-defining the common base as a template distribution and then inheriting
-that distribution makes it easier to manage the distfiles.
+When set, the distribution is a template distribution. Templates are
+special distributions which cannot be prepared or packaged with Autodist.
+Templates can only be inherited. Usually, templates are used to define a
+common template distribution for other distributions. Templates may set
+distdefs, undefines, includes, excludes and noprocesses. A large software
+project could have several distributions that share a common base. In
+this case defining the common base as a template distribution and then
+inheriting that distribution makes it easier to manage the distfiles.
@example
no-dist
preparation or during distribution packaging. This directive is optional.
One or more file can be specified in the 'noprocess' directive. Zero or
more 'noprocess' directives can be used in distribution. The <filename>
-can be a single file, a single directory or a regular expression that
-will match several files and/or directories. If directory is specified
-then all files inside the directory will not be processed.
+can be a single file or a regular expression that will match several files.
+Note that, in current Autodist version 'noprocess' cannot be used to
+specify directories.
Example:
@example
noprocess autodist.texi
+noprocess apps/foo/*
@end example
-Autodist will not process 'autodist.texi' file.
+Autodist will not process 'autodist.texi' file, and any file that match
+'apps/foo/*'. Note that, any subdirectory under 'apps/foo/' will not
+match, and will be processed.
-Note that, 'noprocess' directive cannot be used to disallow processing
-of any file with '.ad' suffix.
+Also note that, 'noprocess' directive cannot be used to disallow
+processing of any file with '.ad' suffix.
@section Directive: pre-hook <filename> [...]
name of distribution. The script may use these arguments if it needs them.
+@section Directive: pre-process-dist-hook <filename> [...]
+
+The 'pre-process-dist-hook' directive can be used define additional
+scripts that will be run when Autodist has started distribution creation.
+This directive is optional. One or more scripts may be defined in one
+'pre-process-dist-hook' directive. Zero or more 'pre-process-dist-hook'
+directives may be set for distribution. The 'pre-process-dist-hook' hook
+will be run immediately after the Autodist has created the distribution
+directory but has not yet started any distribution processing.
+
+The scripts will get four (4) command line arguments when Autodist
+executes the script: distribution name, distribution version, package
+name of distribution and destination distribution directory name. The
+script may use these arguments if it needs them.
+
+
+@section Directive: post-process-dist-hook <filename> [...]
+
+The 'post-process-dist-hook' directive can be used define additional
+scripts that will be run when Autodist has finished distribution
+processing. This directive is optional. One or more scripts may be
+defined in one 'post-process-dist-hook' directive. Zero or more
+'post-process-dist-hook' directives may be set for distribution. The
+'post-process-dist-hook' hook will be run immediately after the Autodist
+has finished processing the destination distribution directory but has not
+yet created the distribution package.
+
+The scripts will get four (4) command line arguments when Autodist
+executes the script: distribution name, distribution version, package
+name of distribution and destination distribution directory name. The
+script may use these arguments if it needs them.
+
+
@section Directive: pre-dist-hook <filename> [...]
The 'pre-dist-hook' directive can be used define additional scripts that
is optional. One or more scripts may be defined in one 'pre-dist-hook'
directive. Zero or more 'pre-dist-hook' directives may be set for
distribution. The 'pre-dist-hook' hook will be run immediately after
-the Autodist has created the distribution directory but has not yet
-started any distribution processing.
+the Autodist has started distribution creation, but has not yet created
+the distribution directory. This hook is run before 'pre-process-dist-hook'.
The scripts will get four (4) command line arguments when Autodist
executes the script: distribution name, distribution version, package
@section Directive: post-dist-hook <filename> [...]
The 'post-dist-hook' directive can be used define additional scripts that
-will be run when Autodist has finished distribution processing. This
+will be run when Autodist has finished distribution creation. This
directive is optional. One or more scripts may be defined in one
'post-dist-hook' directive. Zero or more 'post-dist-hook' directives may
-be set for distribution. The 'post-dist-hook' hook will be run immediately
-after the Autodist has finished processing the destination distribution
-directory but has not yet created the distribution package.
+be set for distribution. The 'post-dist-hook' hook will be run
+immediately after the Autodist has finished creating the distribution
+package. This is the last hook Autodist runs.
The scripts will get four (4) command line arguments when Autodist
executes the script: distribution name, distribution version, package
script may use these arguments if it needs them.
+@section Running hooks
+
+The Autodist runs the hooks in the following order:
+
+Preparing source tree for configuration and compilation:
+
+@example
+<...Autodist started...>
+pre-hook
+<...preparation...>
+post-hook
+<...Autodist exits...>
+@end example
+
+Creating distribution:
+
+@example
+<...Autodist started...>
+pre-dist-hook
+<...distribution directory created...>
+pre-process-dist-hook
+<...processing all files, processing excludes and includes...>
+post-process-dist-hook
+<...creating distribution package...>
+post-dist-hook
+<...Autodist exits...>
+@end example
+
+When creating distribution the 'pre-hook' and 'post-hook' are not run.
+
+
@section Example distfile
The following is a simple distfile example. The example assumes that the
undef SILC_DIST_MPI
exclude doc/draft*
pre-hook scripts/client-pre-run
-post-dist-hook scripts/client-post-dist-run
-post-dist-hook scripts/client-post-dist-kludge
+post-process-dist-hook scripts/client-post-process
+post-dist-hook scripts/client-post-dist-bin
@end example
@menu
If you need processed files during configuration or compilation then they
need to have '.ad' suffix.
+Note that, the distdef format used in these files must be the non-source
+format.
+
@menu
* Distdefines:: Using distdefs in files
@end menu
By default the distdefs are named '_DIST_XXX', where 'XXX' is the name of
distdef. However, many projects will want to define their own prefix
for distdefs in the 'autodist.conf' configuration file (@pxref{autodist.conf, , , , }).
-In the following examples a prefix 'SILC' is used, hence the prefix for
+In the following examples a prefix 'SILC' is used, hence the prefix for
the distdefs are 'SILC_DIST_'.
The basic format for the distdefs are as follows:
@end example
Note that, only the format defined above is supported. Other more complex
-use of the preprocessor directives such as using '&&' and '||' in the '#ifdef'
-or '#ifndef' are not supported, and neither is '#elif'. Also note, that in
-the compiler friendly format the name of the distdef in comments and the
-use of '!' character in the '#else' branch of '#ifdef' are mandatory. Also
-note, that the distdef conditionals must be placed at the start of the line,
-they must not be indented.
+use of the preprocessor directives such as using '&&' and '||' in the
+'#ifdef' or '#ifndef' are not supported, and neither is '#elif'. Also
+note, that the name of the distdef in '#else' and '#endif' directives in
+non-source format and in source format inside C comments (/* */), and the
+use of '!' character in the '#else' branch of '#ifdef'" are mandatory.
+Also note, that the distdef conditionals must be placed at the start of
+the line, they must not be indented.
The following example shows the use of non-source format:
#ifndef SILC_DIST_FOOBAR
foobar_replacement();
+ foobar_hack_init();
+ foobar_init();
#else /* SILC_DIST_FOOBAR */
real_foobar();
#endif /* SILC_DIST_FOOBAR */
real_foobar();
@end example
-Even before processing the source files with Autodist, the preprocessor
-will respect the preprocessor directives if the code use '#include' to
-include the distdef header file created by the Autodist (see
-'autodist.conf' (@pxref{autodist.conf, , , , })). When the distribution
-is packaged (@pxref{Creating distribution, , , , }) the Autodist will
-process the files, and will remove any line not defined to be included.
+Even before processing the source files with Autodist, the preprocessor
+will respect the preprocessor directives if the code use '#include' to
+include the distdef header file created by the Autodist (see
+'autodist.conf' (@pxref{autodist.conf, , , , })). When the distribution
+is packaged (@pxref{Creating distribution, , , , }) the Autodist will
+process the files, and will remove any line not defined to be included.
The preprocessor directives will also be removed.
-Because the software project includes the header file with '#include' the
-distdef header file needs to be present in the distribution, unless it is
+Because the software project includes the header file with '#include' the
+distdef header file needs to be present in the distribution, unless it is
placed inside some other '#ifdef' conditional. If the distribution is
prepared but not compiled (it is packaged after preparation without
-compilation) then including the distdef header in the source is not
+compilation) then including the distdef header in the source is not
necessary. Including it then in the distribution is not necessary either.
-
+
The software project should not use the same name space that distdef
conditionals use for other than distribution usage. The Autodist will
process any line that uses the formats above and has the specified prefix
this process is performed by Autodist, and running these tools manually
or using 'autogen.sh' script is not necessary.
-By default the 'autodist.conf' (@pxref{autodist.conf, , , , }) has defined
-the tools that will be run by the Autodist when preparing the source tree.
-These are 'aclocal', 'autoheader', 'autoconf', 'automake' and
-'libtoolize'. If you do not whish that Autodist runs some or any of these
-tools automatically, do not set them in the 'autodist.conf'. You would
-then need to run them manually. However, this is not recommended. If you
-need to run additional preparation scripts you may set your scripts either
-in the 'pre-hook' and/or 'post-hook' where you can run what ever
+By default the 'autodist.conf' (@pxref{autodist.conf, , , , }) has defined
+the tools that will be run by the Autodist when preparing the source tree.
+These are 'aclocal', 'autoheader', 'autoconf', 'automake' and
+'libtoolize'. If you do not wish that Autodist runs some or any of these
+tools automatically, do not set them in the 'autodist.conf'. You would
+then need to run them manually. However, this is not recommended. If you
+need to run additional preparation scripts you may set your scripts either
+in the 'pre-hook' and/or 'post-hook' where you can run what ever
additional processing you may need to prepare your source tree.
By default the Autodist creates a 'default' distribution when you
The Autodist will prepare your source tree. After that you may run
'./configure' and continue to compile with 'make'.
-If you do not whish to use the 'default' distribution, or you whish
+If you do not wish to use the 'default' distribution, or you wish
to do the development in a tree specificly prepared for some specific
distribution, or you are preparing to create a new distribution package,
-you will need to run the Autodist with the distribution you whish to
+you will need to run the Autodist with the distribution you wish to
prepare.
@example
This prepares your source tree for 'example-distribution' of version
'1.0.3'. After that you may run './configure' and continue to compile
with 'make'. If the version is omitted the version will be '0.0'.
+The 'PACKAGE_VERSION' define delivered by Autoconf will contain this
+version.
Note that, running Autodist for preparation merely prepares your source
tree for the distribution, it does not create an actual distribution
However, the source files, or any other file (except files ending with
'.ad' suffix) are not processed by the Autodist. When compiling
your sources the preprocessor, however, will respect your distdef
-conditionals inside your source files if you include the distdef header
+conditionals inside your source files if you '#include' the distdef header
file. This way, even the compiled binaries will be compiled for that
distribution, even though the source files has not yet been processed
by the Autodist. Rest of the files in the distribution will be processed
the same way as if it was already packaged with Autodist (providing that
you remember to include the distdef header file in your code).
+When preparing the source tree Autodist will create a file 'autodist.dist'
+which will contain information on the prepared distribution. When
+Creating the distribution that file will be read by the Autodist
+automatically. That file should not be removed or the distribution
+cannot be packaged.
+
@menu
* Creating distribution:: Creating distribution with Autodist
@end menu
the source tree for the distribution you want to create. After preparing
your source tree you will be ready to create a new distribution. The
Autodist package provides a simple helper script 'makedist' that may
-be used to create the distribution. However, if you whish, you may
+be used to create the distribution. However, if you wish, you may
run the Autodist yourself, as the 'makedist' will call Autodist anyway.
-To create a new distribution for the distribution you have prepared for
-run makedist.
+To create a new distribution for the distribution you have prepared for,
+run first './configure' and then 'makedist'.
@example
makedist
@end example
This will run the Autodist and create a new distribution package that
-is archived with 'tar' and compressed with 'gzip'. If you whish to
+is archived with 'tar' and compressed with 'gzip'. If you wish to
create packages also compressed with 'bzip2', 'compress' and/or 'zip'
you may give one or all of the following options:
'tar.bz2', 'tar.Z' and '.zip' packages. Current version of Autodist does
not support archiving with 'shar'.
-If you whish to run additional processing for your distributions when
-they are being packaged you may set 'pre-dist-hook' and/or 'post-dist-hook'
-in your distribution file. Also note that any hooks provided by Automake
-in Makefiles will be run in normal manner.
-
-For additional help, you may give:
-
-@example
- makedist --help
-@end example
+If you wish to run additional processing for your distributions when they
+are being packaged you may set 'pre-process-dist-hook',
+'post-process-dist-hook, 'pre-dist-hook' and/or 'post-dist-hook' in your
+distribution file. Also note that any hooks provided by Automake in
+Makefiles will be run in normal manner.
@node Examples
@section Single distribution tree example, start to finish
Lets suppose you have a simple source tree with one application,
-called 'foozbar' you whish to release. While you would probably suffice
+called 'foozbar' you wish to release. While you would probably suffice
using Autoconf and Automake features you may still use Autodist.
First, you create the default 'distdir' into your software package:
Then, you create the 'configure.ad' file from your existing 'configure.ac'
or 'configure.in' file. If you don't have configure script written yet,
-please refer to the Autoconf manual. In the 'autodist.ad' you add as
+please refer to the Autoconf manual. In the 'configure.ad' you add as
first macro in the file:
@example
This distribution file go into 'distdir/foozbar'.
And there you go. You have succesfully integrated Autodist into your
-source tree. If you need to do development and you whish to use the
+source tree. If you need to do development and you wish to use the
'default' distribution for that, you should inherit the new 'foozbar'
distribution in it. Add the following line in 'distdir/default':
Then, you create the 'configure.ad' file from your existing 'configure.ac'
or 'configure.in' file. If you don't have configure script written yet,
-please refer to the Autoconf manual. In the 'autodist.ad' you add as
+please refer to the Autoconf manual. In the 'configure.ad' you add as
first macro in the file:
@example
@example
# Common template
+option template
define _DIST_DOC
define _DIST_LIB
define _DIST_MATH
TESTS = \
autodist1.test \
- autodist2.test
+ autodist2.test \
+ autodist3.test \
+ autodist4.test \
+ autodist5.test
clean-local:
-rm -rf test
)
AC_OUTPUT
echo configure.ad ok
+#else !_DIST_DEFAULT
+echo "ERROR"
+exit 1
#endif _DIST_DEFAULT
EOF
cat << EOF > Makefile.ad
-SUBDIRS= \
+SUBDIRS= \\
#ifdef _DIST_NODEF
- nodef \
+ nodef \\
+ poa \\
+ paa \\
#endif _DIST_NODEF
-#endif
+ . \\
+ . \\
+ . \\
+ . \\
+
EOF
rm -rf distdir subdir
# subdir/configure.ad fragment
#ifndef _DIST_NODEF
echo "_DIST_NODEF ok"
+#else _DIST_NODEF
+echo "ERROR"
+exit 1
#endif _DIST_NODEF
EOF
)
AC_OUTPUT
echo configure.ad ok
+#else !_DIST_TEST
+echo "ERROR"
+exit 1
#endif _DIST_TEST
EOF
cat << EOF > Makefile.ad
-SUBDIRS= \
+SUBDIRS= \\
#ifndef _DIST_TEST
- nodef \
+ nodef \\
#endif _DIST_TEST
-#endif
+ . \\
+
EOF
rm -rf distdir subdir
--- /dev/null
+#!/bin/sh
+
+AUTODIST=../autodist
+
+rm -f ./autodist
+
+echo "Testing with /bin/zsh"
+
+# Change shell to zsh
+if test '!' -f /bin/zsh; then
+ echo "/bin/zsh does not exist, cannot run test"
+ exit 0
+fi
+cat $AUTODIST | sed 's/#!\/bin\/sh/#!\/bin\/zsh/' > ./autodist
+
+AUTODIST=../autodist # from inside tests/test
+
+rm -rf test
+mkdir test
+
+cd test || exit 1
+
+chmod +x $AUTODIST || exit 1
+
+cat << EOF > configure.ad
+AD_INIT
+#ifdef _DIST_TEST
+AC_CANONICAL_BUILD
+AM_INIT_AUTOMAKE
+AC_PREREQ(2.52)
+AC_CONFIG_HEADERS(config.h)
+AD_INCLUDE_CONFIGURE
+AC_CONFIG_FILES(
+Makefile
+)
+AC_OUTPUT
+echo configure.ad ok
+#else !_DIST_TEST
+echo "ERROR"
+exit 1
+#endif _DIST_TEST
+EOF
+
+cat << EOF > Makefile.ad
+SUBDIRS= \\
+#ifndef _DIST_TEST
+ nodef \\
+#endif _DIST_TEST
+ . \\
+
+EOF
+
+rm -rf distdir subdir
+mkdir -p subdir || exit 1
+
+cat << EOF > subdir/configure.ad
+# subdir/configure.ad fragment
+#ifndef _DIST_NODEF
+#ifdef _DIST_TEST
+echo "_DIST_NODEF ok"
+#endif _DIST_TEST
+#endif _DIST_NODEF
+EOF
+
+$AUTODIST -i || exit 1
+if test '!' -d distdir; then
+ echo "error: distdir/ does no exist"
+ exit 1
+fi
+
+cp -p ../../default distdir || exit 1
+cp -p ../../autodist.conf distdir || exit 1
+
+cat << EOF > distdir/test
+name Test Distribution
+package test-distro
+bug-report test-dist@test.org
+define _DIST_TEST
+EOF
+
+touch README NEWS AUTHORS ChangeLog
+
+echo "inherit test" >> distdir/default
+
+$AUTODIST || exit 1
+$AUTODIST test 1.0 || exit 1
+
+./configure || exit 1
+make || exit 1
+echo make ok
+
+$AUTODIST -m || exit 1
+
+if test '!' -f test-distro-1.0.tar.gz; then
+ echo "error: makedist failed"
+ exit 1
+fi
+
+echo test ok
+
+# Cleanup
+rm -rf subdir distdir $AUTODIST
+
--- /dev/null
+#!/bin/sh
+
+AUTODIST=../autodist
+
+rm -f ./autodist
+
+echo "Testing with /bin/ksh"
+
+# Change shell to ksh
+if test '!' -f /bin/ksh; then
+ echo "/bin/zsh does not exist, cannot run test"
+ exit 0
+fi
+cat $AUTODIST | sed 's/#!\/bin\/sh/#!\/bin\/ksh/' > ./autodist
+
+AUTODIST=../autodist # from inside tests/test
+
+rm -rf test
+mkdir test
+
+cd test || exit 1
+
+chmod +x $AUTODIST || exit 1
+
+cat << EOF > configure.ad
+AD_INIT
+#ifdef _DIST_TEST
+AC_CANONICAL_BUILD
+AM_INIT_AUTOMAKE
+AC_PREREQ(2.52)
+AC_CONFIG_HEADERS(config.h)
+AD_INCLUDE_CONFIGURE
+AC_CONFIG_FILES(
+Makefile
+)
+AC_OUTPUT
+echo configure.ad ok
+#else !_DIST_TEST
+echo "ERROR"
+exit 1
+#endif _DIST_TEST
+EOF
+
+cat << EOF > Makefile.ad
+SUBDIRS= \\
+#ifndef _DIST_TEST
+ nodef \\
+#endif _DIST_TEST
+ . \\
+
+EOF
+
+rm -rf distdir subdir
+mkdir -p subdir || exit 1
+
+cat << EOF > subdir/configure.ad
+# subdir/configure.ad fragment
+#ifndef _DIST_NODEF
+#ifdef _DIST_TEST
+echo "_DIST_NODEF ok"
+#endif _DIST_TEST
+#endif _DIST_NODEF
+EOF
+
+$AUTODIST -i || exit 1
+if test '!' -d distdir; then
+ echo "error: distdir/ does no exist"
+ exit 1
+fi
+
+cp -p ../../default distdir || exit 1
+cp -p ../../autodist.conf distdir || exit 1
+
+cat << EOF > distdir/test
+ name Test Distribution
+ package test-distro
+ bug-report test-dist@test.org
+ define _DIST_TEST
+EOF
+
+touch README NEWS AUTHORS ChangeLog
+
+echo "inherit test" >> distdir/default
+
+$AUTODIST || exit 1
+$AUTODIST test 1.0 || exit 1
+
+./configure || exit 1
+make || exit 1
+echo make ok
+
+$AUTODIST -m || exit 1
+
+if test '!' -f test-distro-1.0.tar.gz; then
+ echo "error: makedist failed"
+ exit 1
+fi
+
+echo test ok
+
+# Cleanup
+rm -rf subdir distdir $AUTODIST
+
--- /dev/null
+#!/bin/sh
+
+AUTODIST=../autodist
+
+rm -f ./autodist
+
+echo "Testing with /bin/ash"
+
+# Change shell to ash
+if test '!' -f /bin/ash; then
+ echo "/bin/zsh does not exist, cannot run test"
+ exit 0
+fi
+cat $AUTODIST | sed 's/#!\/bin\/sh/#!\/bin\/ash/' > ./autodist
+
+AUTODIST=../autodist # from inside tests/test
+
+rm -rf test
+mkdir test
+
+cd test || exit 1
+
+chmod +x $AUTODIST || exit 1
+
+cat << EOF > configure.ad
+AD_INIT
+#ifdef _DIST_TEST
+AC_CANONICAL_BUILD
+AM_INIT_AUTOMAKE
+AC_PREREQ(2.52)
+AC_CONFIG_HEADERS(config.h)
+AD_INCLUDE_CONFIGURE
+AC_CONFIG_FILES(
+Makefile
+)
+AC_OUTPUT
+echo configure.ad ok
+#else !_DIST_TEST
+echo "ERROR"
+exit 1
+#endif _DIST_TEST
+EOF
+
+cat << EOF > Makefile.ad
+SUBDIRS= \\
+#ifndef _DIST_TEST
+ nodef \\
+#endif _DIST_TEST
+ . \\
+
+EOF
+
+rm -rf distdir subdir
+mkdir -p subdir || exit 1
+
+cat << EOF > subdir/configure.ad
+# subdir/configure.ad fragment
+#ifndef _DIST_NODEF
+#ifdef _DIST_TEST
+echo "_DIST_NODEF ok"
+#endif _DIST_TEST
+#endif _DIST_NODEF
+EOF
+
+$AUTODIST -i || exit 1
+if test '!' -d distdir; then
+ echo "error: distdir/ does no exist"
+ exit 1
+fi
+
+cp -p ../../default distdir || exit 1
+cp -p ../../autodist.conf distdir || exit 1
+
+cat << EOF > distdir/test
+ name Test Distribution
+ package test-distro
+bug-report test-dist@test.org
+define _DIST_TEST
+#define _DIST_NODEF
+EOF
+
+touch README NEWS AUTHORS ChangeLog
+
+echo "inherit test" >> distdir/default
+
+$AUTODIST || exit 1
+$AUTODIST test 1.0 || exit 1
+
+./configure || exit 1
+make || exit 1
+echo make ok
+
+$AUTODIST -m || exit 1
+
+if test '!' -f test-distro-1.0.tar.gz; then
+ echo "error: makedist failed"
+ exit 1
+fi
+
+echo test ok
+
+# Cleanup
+rm -rf subdir distdir $AUTODIST
+
reply->timeout =
silc_schedule_task_add(server->schedule, 0,
silc_server_command_pending_timeout, reply,
- timeout ? timeout : 10, 0,
+ timeout ? timeout : 12, 0,
SILC_TASK_TIMEOUT, SILC_TASK_PRI_LOW);
silc_dlist_add(server->pending_commands, reply);
{
SilcBuffer buffer;
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
SILC_LOG_DEBUG(("Sending command status %d", status));
buffer =
{
SilcBuffer buffer;
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
SILC_LOG_DEBUG(("Sending command status %d", status));
buffer =
{
SilcBuffer buffer;
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
SILC_LOG_DEBUG(("Sending command status %d", status));
buffer =
if (!silc_command_get_status(cmdr->payload, NULL, NULL)) {
SilcBuffer buffer;
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
/* Send the same command reply payload */
silc_command_set_command(cmdr->payload, silc_command_get(cmd->payload));
silc_command_set_ident(cmdr->payload,
SilcServerCommandContext cmd = (SilcServerCommandContext)context;
SilcClientEntry client = (SilcClientEntry)cmd->sock->user_data;
SilcServer server = cmd->server;
- SilcBuffer packet, nidp, oidp = NULL;
+ SilcBuffer nidp, oidp = NULL;
SilcClientID *new_id;
SilcUInt32 nick_len;
unsigned char *nick, *nickc = NULL;
send_reply:
/* Send the new Client ID as reply command back to client */
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_NICK,
- SILC_STATUS_OK, 0, ident, 2,
- 2, nidp->data, nidp->len,
- 3, nick, nick_len);
- silc_server_packet_send(cmd->server, cmd->sock, SILC_PACKET_COMMAND_REPLY,
- 0, packet->data, packet->len, FALSE);
-
- silc_buffer_free(packet);
+ silc_server_send_command_reply(cmd->server, cmd->sock,
+ SILC_COMMAND_NICK,
+ SILC_STATUS_OK, 0, ident, 2,
+ 2, nidp->data, nidp->len,
+ 3, nick, nick_len);
silc_buffer_free(nidp);
if (oidp)
silc_buffer_free(oidp);
SilcUInt32 gch_count)
{
int i, k;
- SilcBuffer packet, idp;
+ SilcBuffer idp;
SilcChannelEntry entry;
SilcStatus status;
SilcUInt16 ident = silc_command_get_ident(cmd->payload);
}
/* Send the reply */
- packet =
- silc_command_reply_payload_encode_va(SILC_COMMAND_LIST,
- status, 0, ident, 4,
- 2, idp->data, idp->len,
- 3, entry->channel_name,
- strlen(entry->channel_name),
- 4, topic, topic ? strlen(topic) : 0,
- 5, usercount, 4);
- silc_server_packet_send(cmd->server, cmd->sock,
- SILC_PACKET_COMMAND_REPLY, 0, packet->data,
- packet->len, FALSE);
- silc_buffer_free(packet);
+ silc_server_send_command_reply(cmd->server, cmd->sock, SILC_COMMAND_LIST,
+ status, 0, ident, 4,
+ 2, idp->data, idp->len,
+ 3, entry->channel_name,
+ strlen(entry->channel_name),
+ 4, topic, topic ? strlen(topic) : 0,
+ 5, usercount, 4);
silc_buffer_free(idp);
k++;
}
}
/* Send the reply */
- packet =
- silc_command_reply_payload_encode_va(SILC_COMMAND_LIST,
- status, 0, ident, 4,
- 2, idp->data, idp->len,
- 3, entry->channel_name,
- strlen(entry->channel_name),
- 4, topic, topic ? strlen(topic) : 0,
- 5, usercount, 4);
- silc_server_packet_send(cmd->server, cmd->sock,
- SILC_PACKET_COMMAND_REPLY, 0, packet->data,
- packet->len, FALSE);
- silc_buffer_free(packet);
+ silc_server_send_command_reply(cmd->server, cmd->sock, SILC_COMMAND_LIST,
+ status, 0, ident, 4,
+ 2, idp->data, idp->len,
+ 3, entry->channel_name,
+ strlen(entry->channel_name),
+ 4, topic, topic ? strlen(topic) : 0,
+ 5, usercount, 4);
silc_buffer_free(idp);
k++;
}
SilcBuffer tmpbuf;
SilcUInt16 old_ident;
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
tmpbuf = silc_command_payload_encode_payload(cmd->payload);
SilcChannelID *channel_id;
SilcChannelEntry channel;
SilcChannelClientEntry chl;
- SilcBuffer packet, idp;
+ SilcBuffer idp;
unsigned char *tmp;
SilcUInt32 argc, tmp_len;
SilcUInt16 ident = silc_command_get_ident(cmd->payload);
/* Send the topic to client as reply packet */
idp = silc_id_payload_encode(channel_id, SILC_ID_CHANNEL);
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_TOPIC,
- SILC_STATUS_OK, 0, ident, 2,
- 2, idp->data, idp->len,
- 3, channel->topic,
- channel->topic ?
- strlen(channel->topic) : 0);
- silc_server_packet_send(cmd->server, cmd->sock, SILC_PACKET_COMMAND_REPLY,
- 0, packet->data, packet->len, FALSE);
-
- silc_buffer_free(packet);
+ silc_server_send_command_reply(cmd->server, cmd->sock, SILC_COMMAND_TOPIC,
+ SILC_STATUS_OK, 0, ident, 2,
+ 2, idp->data, idp->len,
+ 3, channel->topic,
+ channel->topic ?
+ strlen(channel->topic) : 0);
silc_buffer_free(idp);
silc_free(channel_id);
SilcIDListData idata;
SilcArgumentPayload args;
SilcHashTableList htl;
- SilcBuffer packet, list, tmp2;
+ SilcBuffer list, tmp2;
SilcBufferStruct alist;
unsigned char *tmp, *atype = NULL;
SilcUInt32 len, type, len2;
/* Send command reply */
tmp = silc_argument_get_arg_type(cmd->args, 1, &len);
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_INVITE,
- SILC_STATUS_OK, 0, ident, 2,
- 2, tmp, len,
- 3, type && list ?
- list->data : NULL,
- type && list ? list->len : 0);
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
- packet->data, packet->len, FALSE);
- silc_buffer_free(packet);
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_INVITE,
+ SILC_STATUS_OK, 0, ident, 2,
+ 2, tmp, len,
+ 3, type && list ?
+ list->data : NULL,
+ type && list ? list->len : 0);
silc_buffer_free(list);
out:
{
SilcServerCommandContext cmd = (SilcServerCommandContext)context;
SilcServer server = cmd->server;
- SilcBuffer packet, idp;
+ SilcBuffer idp;
unsigned char *tmp;
SilcUInt32 tmp_len;
char *dest_server = NULL, *server_info = NULL, *server_name;
SilcBuffer tmpbuf;
SilcUInt16 old_ident;
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
tmpbuf = silc_command_payload_encode_payload(cmd->payload);
SilcBuffer tmpbuf;
SilcUInt16 old_ident;
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
tmpbuf = silc_command_payload_encode_payload(cmd->payload);
server_name = entry->server_name;
/* Send the reply */
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_INFO,
- SILC_STATUS_OK, 0, ident, 3,
- 2, idp->data, idp->len,
- 3, server_name,
- strlen(server_name),
- 4, server_info,
- server_info ?
- strlen(server_info) : 0);
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
- packet->data, packet->len, FALSE);
-
- silc_buffer_free(packet);
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_INFO,
+ SILC_STATUS_OK, 0, ident, 3,
+ 2, idp->data, idp->len,
+ 3, server_name,
+ strlen(server_name),
+ 4, server_info,
+ server_info ?
+ strlen(server_info) : 0);
silc_buffer_free(idp);
out:
statistical information. */
if (!cmd->pending && server->server_type != SILC_ROUTER &&
!server->standalone) {
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
/* Send request to our router */
SilcBuffer idp = silc_id_payload_encode(server->router->id,
SILC_ID_SERVER);
SILC_STR_UI_INT(server->stat.router_ops),
SILC_STR_END);
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_STATS,
- SILC_STATUS_OK, 0, ident, 2,
- 2, tmp, tmp_len,
- 3, stats->data, stats->len);
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY,
- 0, packet->data, packet->len, FALSE);
- silc_buffer_free(packet);
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_STATS,
+ SILC_STATUS_OK, 0, ident, 2,
+ 2, tmp, tmp_len,
+ 3, stats->data, stats->len);
silc_buffer_free(stats);
out:
silc_server_packet_send(server, sock, SILC_PACKET_COMMAND_REPLY, 0,
reply->data, reply->len, FALSE);
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
/* Send JOIN notify to locally connected clients on the channel. If
we are normal server then router will send or have sent JOIN notify
already. However since we've added the client already to our channel
goto out;
}
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
tmpbuf = silc_command_payload_encode_payload(cmd->payload);
{
SilcServerCommandContext cmd = (SilcServerCommandContext)context;
SilcServer server = cmd->server;
- SilcBuffer packet, idp;
+ SilcBuffer idp;
char *motd, *dest_server = NULL;
SilcUInt32 motd_len;
SilcUInt16 ident = silc_command_get_ident(cmd->payload);
goto out;
motd[motd_len] = 0;
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_MOTD,
- SILC_STATUS_OK, 0,
- ident, 2,
- 2, idp->data, idp->len,
- 3, motd, motd_len);
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_MOTD,
+ SILC_STATUS_OK, 0, ident, 2,
+ 2, idp->data, idp->len,
+ 3, motd, motd_len);
} else {
/* No motd */
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_MOTD,
- SILC_STATUS_OK, 0,
- ident, 1,
- 2, idp->data, idp->len);
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_MOTD,
+ SILC_STATUS_OK, 0, ident, 1,
+ 2, idp->data, idp->len);
}
-
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
- packet->data, packet->len, FALSE);
- silc_buffer_free(packet);
silc_buffer_free(idp);
} else {
SilcServerEntry entry;
SilcBuffer tmpbuf;
SilcUInt16 old_ident;
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
tmpbuf = silc_command_payload_encode_payload(cmd->payload);
SilcBuffer tmpbuf;
SilcUInt16 old_ident;
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
tmpbuf = silc_command_payload_encode_payload(cmd->payload);
}
idp = silc_id_payload_encode(entry->id, SILC_ID_SERVER);
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_MOTD,
- SILC_STATUS_OK, 0, ident, 2,
- 2, idp->data, idp->len,
- 3, entry->motd,
- entry->motd ?
- strlen(entry->motd) : 0);
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
- packet->data, packet->len, FALSE);
- silc_buffer_free(packet);
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_MOTD,
+ SILC_STATUS_OK, 0, ident, 2,
+ 2, idp->data, idp->len,
+ 3, entry->motd,
+ entry->motd ?
+ strlen(entry->motd) : 0);
silc_buffer_free(idp);
}
SilcServerCommandContext cmd = (SilcServerCommandContext)context;
SilcServer server = cmd->server;
SilcClientEntry client = (SilcClientEntry)cmd->sock->user_data;
- SilcBuffer packet;
unsigned char *tmp_mask, m[4];
SilcUInt32 mask = 0;
SilcUInt16 ident = silc_command_get_ident(cmd->payload);
/* Send command reply to sender */
SILC_PUT32_MSB(client->mode, m);
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_UMODE,
- SILC_STATUS_OK, 0, ident, 1,
- 2, m, sizeof(m));
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
- packet->data, packet->len, FALSE);
- silc_buffer_free(packet);
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_UMODE,
+ SILC_STATUS_OK, 0, ident, 1,
+ 2, m, sizeof(m));
out:
silc_server_command_free(cmd);
SilcChannelID *channel_id = NULL;
SilcChannelEntry channel;
SilcChannelClientEntry chl;
- SilcBuffer packet, cidp;
+ SilcBuffer cidp;
unsigned char *tmp, *tmp_id, *tmp_mask, *chpkdata = NULL;
char *cipher = NULL, *hmac = NULL, *passphrase = NULL, ulimit[4];
SilcUInt32 mode_mask = 0, old_mask = 0, tmp_len, tmp_len2, chpklen;
if (channel->channel_pubkeys)
chpklist = silc_server_get_channel_pk_list(server, channel,
FALSE, FALSE);
- packet =
- silc_command_reply_payload_encode_va(SILC_COMMAND_CMODE,
- SILC_STATUS_OK, 0, ident, 4,
- 2, tmp_id, tmp_len2,
- 3, m, sizeof(m),
- 4, fkey ? fkey->data : NULL,
- fkey ? fkey->len : 0,
- 5, chpklist ? chpklist->data : NULL,
- chpklist ? chpklist->len : 0);
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
- packet->data, packet->len, FALSE);
- silc_buffer_free(packet);
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_CMODE,
+ SILC_STATUS_OK, 0, ident, 4,
+ 2, tmp_id, tmp_len2,
+ 3, m, sizeof(m),
+ 4, fkey ? fkey->data : NULL,
+ fkey ? fkey->len : 0,
+ 5, chpklist ? chpklist->data : NULL,
+ chpklist ? chpklist->len : 0);
goto out;
}
chpklist = silc_server_get_channel_pk_list(server, channel, FALSE, FALSE);
/* Send command reply to sender */
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_CMODE,
- SILC_STATUS_OK, 0, ident, 5,
- 2, tmp_id, tmp_len2,
- 3, tmp_mask, 4,
- 4, fkey ? fkey->data : NULL,
- fkey ? fkey->len : 0,
- 5, chpklist ? chpklist->data :
- NULL, chpklist ? chpklist->len
- : 0,
- 6, (mode_mask &
- SILC_CHANNEL_MODE_ULIMIT ?
- ulimit : NULL),
- (mode_mask &
- SILC_CHANNEL_MODE_ULIMIT ?
- sizeof(ulimit) : 0));
-
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
- packet->data, packet->len, FALSE);
-
- silc_buffer_free(packet);
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_CMODE,
+ SILC_STATUS_OK, 0, ident, 5,
+ 2, tmp_id, tmp_len2,
+ 3, tmp_mask, 4,
+ 4, fkey ? fkey->data : NULL,
+ fkey ? fkey->len : 0,
+ 5, chpklist ? chpklist->data :
+ NULL, chpklist ? chpklist->len
+ : 0,
+ 6, (mode_mask &
+ SILC_CHANNEL_MODE_ULIMIT ?
+ ulimit : NULL),
+ (mode_mask &
+ SILC_CHANNEL_MODE_ULIMIT ?
+ sizeof(ulimit) : 0));
silc_buffer_free(cidp);
out:
SilcChannelEntry channel;
SilcClientEntry target_client;
SilcChannelClientEntry chl;
- SilcBuffer packet, idp;
+ SilcBuffer idp;
unsigned char *tmp_id, *tmp_ch_id, *tmp_mask;
SilcUInt32 target_mask, sender_mask = 0, tmp_len, tmp_ch_len;
int notify = FALSE;
}
/* Send command reply to sender */
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_CUMODE,
- SILC_STATUS_OK, 0, ident, 3,
- 2, tmp_mask, 4,
- 3, tmp_ch_id, tmp_ch_len,
- 4, tmp_id, tmp_len);
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
- packet->data, packet->len, FALSE);
-
- silc_buffer_free(packet);
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_CUMODE,
+ SILC_STATUS_OK, 0, ident, 3,
+ 2, tmp_mask, 4,
+ 3, tmp_ch_id, tmp_ch_len,
+ 4, tmp_id, tmp_len);
silc_buffer_free(idp);
out:
SilcClientID *client_id;
SilcChannelEntry channel;
SilcChannelClientEntry chl;
- SilcBuffer idp, packet;
+ SilcBuffer idp;
SilcUInt32 tmp_len, target_idp_len, clen;
SilcUInt16 ident = silc_command_get_ident(cmd->payload);
unsigned char *tmp, *comment, *target_idp;
/* Send the reply back to the client */
- packet =
- silc_command_reply_payload_encode_va(SILC_COMMAND_KICK,
- SILC_STATUS_OK, 0, ident, 2,
- 2, tmp, tmp_len,
- 3, target_idp, target_idp_len);
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
- packet->data, packet->len, FALSE);
- silc_buffer_free(packet);
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_KICK,
+ SILC_STATUS_OK, 0, ident, 2,
+ 2, tmp, tmp_len,
+ 3, target_idp, target_idp_len);
/* Send KICKED notify to local clients on the channel */
idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
SILC_LOG_DEBUG(("Forwarding WATCH to router"));
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
tmpbuf = silc_command_payload_encode_payload(cmd->payload);
/* Distribute the watch list to backup routers too */
if (server->backup) {
SilcBuffer tmpbuf;
+
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
tmpbuf = silc_command_payload_encode_payload(cmd->payload);
SilcServerCommandContext cmd = (SilcServerCommandContext)context;
SilcServer server = cmd->server;
SilcClientEntry client = (SilcClientEntry)cmd->sock->user_data;
- SilcBuffer packet, list, tmp2;
+ SilcBuffer list, tmp2;
SilcChannelEntry channel;
SilcChannelClientEntry chl;
SilcChannelID *channel_id = NULL;
}
/* Send the reply back to the client */
- packet =
- silc_command_reply_payload_encode_va(SILC_COMMAND_BAN,
- SILC_STATUS_OK, 0, ident, 2,
- 2, id, id_len,
- 3, list ? list->data : NULL,
- list ? list->len : 0);
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
- packet->data, packet->len, FALSE);
-
- silc_buffer_free(packet);
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_BAN,
+ SILC_STATUS_OK, 0, ident, 2,
+ 2, id, id_len,
+ 3, list ? list->data : NULL,
+ list ? list->len : 0);
silc_buffer_free(list);
out:
SilcServer server = cmd->server;
SilcChannelEntry channel;
SilcChannelID *id = NULL;
- SilcBuffer packet, idp;
+ SilcBuffer idp;
unsigned char *channel_id;
SilcUInt32 channel_id_len;
SilcBuffer client_id_list;
!cmd->pending) {
SilcBuffer tmpbuf;
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
tmpbuf = silc_command_payload_encode_payload(cmd->payload);
/* Send reply */
idp = silc_id_payload_encode(channel->id, SILC_ID_CHANNEL);
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_USERS,
- SILC_STATUS_OK, 0, ident, 4,
- 2, idp->data, idp->len,
- 3, lc, 4,
- 4, client_id_list ?
- client_id_list->data : NULL,
- client_id_list ?
- client_id_list->len : 0,
- 5, client_mode_list ?
- client_mode_list->data : NULL,
- client_mode_list ?
- client_mode_list->len : 0);
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
- packet->data, packet->len, FALSE);
-
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_USERS,
+ SILC_STATUS_OK, 0, ident, 4,
+ 2, idp->data, idp->len,
+ 3, lc, 4,
+ 4, client_id_list ?
+ client_id_list->data : NULL,
+ client_id_list ?
+ client_id_list->len : 0,
+ 5, client_mode_list ?
+ client_mode_list->data : NULL,
+ client_mode_list ?
+ client_mode_list->len : 0);
silc_buffer_free(idp);
- silc_buffer_free(packet);
if (client_id_list)
silc_buffer_free(client_id_list);
if (client_mode_list)
{
SilcServerCommandContext cmd = (SilcServerCommandContext)context;
SilcServer server = cmd->server;
- SilcBuffer packet;
SilcClientEntry client;
SilcServerEntry server_entry;
SilcClientID *client_id = NULL;
if (!dest_sock)
goto out;
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
tmpbuf = silc_command_payload_encode_payload(cmd->payload);
SilcBuffer tmpbuf;
SilcUInt16 old_ident;
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
old_ident = silc_command_get_ident(cmd->payload);
silc_command_set_ident(cmd->payload, ++server->cmd_ident);
tmpbuf = silc_command_payload_encode_payload(cmd->payload);
}
tmp = silc_argument_get_arg_type(cmd->args, 1, &tmp_len);
- packet = silc_command_reply_payload_encode_va(SILC_COMMAND_GETKEY,
- SILC_STATUS_OK, 0, ident, 2,
- 2, tmp, tmp_len,
- 3, pk ? pk->data : NULL,
- pk ? pk->len : 0);
- silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
- packet->data, packet->len, FALSE);
- silc_buffer_free(packet);
+ silc_server_send_command_reply(server, cmd->sock, SILC_COMMAND_GETKEY,
+ SILC_STATUS_OK, 0, ident, 2,
+ 2, tmp, tmp_len,
+ 3, pk ? pk->data : NULL,
+ pk ? pk->len : 0);
out:
if (idp)
if (server->server_type != SILC_SERVER)
goto out;
+ /* Statistics */
+ cmd->server->stat.commands_sent++;
+
/* entry isn't known so we IDENTIFY it. otherwise the
silc_server_command_motd won't know about it and tell
the client that there is no such server */
--- /dev/null
+#ifdef SILC_DIST_SERVER
+#
+# silcd/configure.ad
+#
+# Author: Pekka Riikonen <priikone@silcnet.org>
+#
+# Copyright (C) 2000 - 2005 Pekka Riikonen
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+
+# Logs directory
+#
+LOGSDIR="$silc_prefix/logs"
+AC_ARG_WITH(logsdir,
+ [[ --with-logsdir=DIR directory for SILC Server logs [PREFIX/logs]]],
+ [
+ case "$withval" in
+ no|yes)
+ ;;
+ *)
+ LOGSDIR="$withval"
+ ;;
+ esac
+ ])
+AC_SUBST(LOGSDIR)
+AC_DEFINE_UNQUOTED([SILC_LOGSDIR], "$LOGSDIR", [SILC_LOGSDIR])
+
+# silcd config file checking
+#
+summary_silcd_configfile="/etc/silc/silcd.conf"
+AC_ARG_WITH(silcd-config-file,
+ [[ --with-silcd-config-file=FILE use FILE as default configuration file
+ for SILC Server [/etc/silc/silcd.conf]]],
+ AC_DEFINE_UNQUOTED([SILC_SERVER_CONFIG_FILE], "$withval", [SILC_SERVER_CONFIG_FILE])
+ summary_silcd_configfile="$withval"
+ )
+
+# silcd pid file checking
+#
+if test "x$localstatedir" != 'x${prefix}/var'; then
+ PIDFILE="$localstatedir/silcd.pid"
+else
+ PIDFILE="$silc_prefix/var/silcd.pid"
+fi
+
+AC_ARG_WITH(silcd-pid-file,
+ [[ --with-silcd-pid-file=FILE use FILE as default pid file for SILC
+ Server [/var/run/silcd.pid]]],
+ [
+ case "$withval" in
+ no|yes)
+ ;;
+ *)
+ PIDFILE="$withval"
+ ;;
+ esac
+ ])
+AC_SUBST(PIDFILE)
+
+#ifdef SILC_DIST_TOOLKIT
+if test x$without_silcd = xfalse ; then
+#endif SILC_DIST_TOOLKIT
+ AC_CONFIG_FILES(
+silcd/Makefile
+doc/example_silcd.conf
+)
+#ifdef SILC_DIST_TOOLKIT
+fi
+#endif SILC_DIST_TOOLKIT
+
+silcd="yes"
+#endif SILC_DIST_SERVER
SILC_LOG_DEBUG(("Start"));
if (entry) {
- /* Remove from cache. Destructor callback deletes stuff. */
if (!silc_idcache_del_by_context(id_list->clients, entry)) {
SILC_LOG_DEBUG(("Unknown client, did not delete"));
return FALSE;
/* ID Cache destructor */
void silc_idlist_client_destructor(SilcIDCache cache,
- SilcIDCacheEntry entry)
+ SilcIDCacheEntry entry,
+ void *context)
{
+ SilcServer server = context;
SilcClientEntry client;
client = (SilcClientEntry)entry->context;
if (client) {
+ /* Remove this client from the public key hash list */
+ if (client->data.public_key)
+ silc_hash_table_del_by_context(server->pk_hash,
+ client->data.public_key, client);
+
assert(!silc_hash_table_count(client->channels));
silc_free(client->nickname);
silc_free(client->servername);
silc_free(client->userinfo);
silc_free(client->id);
silc_free(client->attrs);
+ if (client->data.public_key)
+ silc_pkcs_public_key_free(client->data.public_key);
silc_hash_table_free(client->channels);
memset(client, 'A', sizeof(*client));
SilcIDList id_list, SilcClientID *old_id,
SilcClientID *new_id, const char *nickname);
void silc_idlist_client_destructor(SilcIDCache cache,
- SilcIDCacheEntry entry);
+ SilcIDCacheEntry entry,
+ void *context);
SilcChannelEntry
silc_idlist_add_channel(SilcIDList id_list, char *channel_name, int mode,
SilcChannelID *id, SilcServerEntry router,
SilcBuffer packet;
va_list ap;
+ /* Statistics */
+ server->stat.commands_sent++;
+
va_start(ap, argc);
packet = silc_command_payload_encode_vap(command, ident, argc, ap);
SilcBuffer packet;
va_list ap;
+ /* Statistics */
+ server->stat.commands_sent++;
+
va_start(ap, argc);
packet = silc_command_reply_payload_encode_vap(command, status, error,
ident, argc, ap);
silc_server_packet_send(server, sock, SILC_PACKET_COMMAND_REPLY, 0,
- packet->data, packet->len, TRUE);
+ packet->data, packet->len, FALSE);
silc_buffer_free(packet);
va_end(ap);
}
SilcBuffer packet;
va_list ap;
+ /* Statistics */
+ server->stat.commands_sent++;
+
va_start(ap, argc);
packet = silc_command_reply_payload_encode_vap(command, status, error,
bool silc_server_init(SilcServer server)
{
- int sock;
+ int sock = -1;
SilcServerID *id;
SilcServerEntry id_entry;
SilcIDListPurge purge;
/* Initialize ID caches */
server->local_list->clients =
silc_idcache_alloc(0, SILC_ID_CLIENT, silc_idlist_client_destructor,
- FALSE, TRUE);
+ server, FALSE, TRUE);
server->local_list->servers =
- silc_idcache_alloc(0, SILC_ID_SERVER, NULL, FALSE, TRUE);
+ silc_idcache_alloc(0, SILC_ID_SERVER, NULL, NULL, FALSE, TRUE);
server->local_list->channels =
- silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL, FALSE, TRUE);
+ silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL, NULL, FALSE, TRUE);
/* These are allocated for normal server as well as these hold some
global information that the server has fetched from its router. For
router these are used as they are supposed to be used on router. */
server->global_list->clients =
silc_idcache_alloc(0, SILC_ID_CLIENT, silc_idlist_client_destructor,
- FALSE, TRUE);
+ server, FALSE, TRUE);
server->global_list->servers =
- silc_idcache_alloc(0, SILC_ID_SERVER, NULL, FALSE, TRUE);
+ silc_idcache_alloc(0, SILC_ID_SERVER, NULL, NULL, FALSE, TRUE);
server->global_list->channels =
- silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL, FALSE, TRUE);
+ silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL, NULL, FALSE, TRUE);
/* Init watcher lists */
server->watcher_list =
*/
if (packet->flags & SILC_PACKET_FLAG_LIST)
break;
+ server->stat.commands_received++;
silc_server_command_process(server, sock, packet);
break;
*/
if (packet->flags & SILC_PACKET_FLAG_LIST)
break;
+ server->stat.commands_received++;
silc_server_command_reply(server, sock, packet);
break;
if (!client || !client->id)
continue;
+ server->stat.commands_sent++;
+
idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
args = silc_buffer_alloc_size(2);
silc_buffer_format(args,
if (!server->standalone) {
SILC_LOG_DEBUG(("Retrieving stats from router"));
+ server->stat.commands_sent++;
idp = silc_id_payload_encode(server->router->id, SILC_ID_SERVER);
packet = silc_command_payload_encode_va(SILC_COMMAND_STATS,
++server->cmd_ident, 1,
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2003 Pekka Riikonen
+ Copyright (C) 1997 - 2005 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
SilcUInt32 packets_sent; /* Sent SILC packets */
SilcUInt32 packets_received; /* Received SILC packets */
SilcUInt32 conn_num; /* Number of connections */
+ SilcUInt32 commands_sent; /* Commands/replies sent */
+ SilcUInt32 commands_received; /* Commands/replies received */
} SilcServerStatistics;
/*
SILC_LOG_DEBUG(("Forwarding the query to router for processing"));
+ /* Statistics */
+ server->stat.commands_sent++;
+
/* Send WHOIS command to our router */
old_ident = silc_command_get_ident(query->cmd->payload);
silc_command_set_ident(query->cmd->payload, ++server->cmd_ident);
SILC_LOG_DEBUG(("Sending error to original query"));
+ /* Statistics */
+ server->stat.commands_sent++;
+
/* Send the same command reply payload which contains the error */
silc_command_set_command(cmdr->payload, query->querycmd);
silc_command_set_ident(cmdr->payload,
}
/* Check nickname */
- tmp = silc_identifier_check(query->nickname, strlen(query->nickname),
- SILC_STRING_UTF8, 128, &tmp_len);
- if (!tmp) {
- silc_server_query_send_error(server, query,
- SILC_STATUS_ERR_BAD_NICKNAME, 0);
- silc_server_query_free(query);
- return;
+ if (tmp) {
+ tmp = silc_identifier_check(query->nickname, strlen(query->nickname),
+ SILC_STRING_UTF8, 128, &tmp_len);
+ if (!tmp) {
+ silc_server_query_send_error(server, query,
+ SILC_STATUS_ERR_BAD_NICKNAME, 0);
+ silc_server_query_free(query);
+ return;
+ }
+ silc_free(query->nickname);
+ query->nickname = tmp;
}
- silc_free(query->nickname);
- query->nickname = tmp;
} else {
/* Parse the IDs included in the query */
r->argc++;
}
+ /* Statistics */
+ server->stat.commands_sent++;
+
/* Send WHOIS command */
res_cmd = silc_command_payload_encode(SILC_COMMAND_WHOIS,
r->argc, r->arg, r->arg_lens,
always_resolve) {
SilcBuffer buffer, idp;
+ /* Statistics */
+ server->stat.commands_sent++;
+
if (client) {
client->data.status |= SILC_IDLIST_STATUS_RESOLVING;
client->data.status &= ~SILC_IDLIST_STATUS_RESOLVED;
(void *)chl);
}
-/* Checks string for bad characters and returns TRUE if they are found. */
-
-bool silc_server_name_bad_chars(const char *name, SilcUInt32 name_len)
-{
- int i;
-
- for (i = 0; i < name_len; i++) {
- if (!isascii(name[i]))
- return TRUE;
- if (name[i] <= 32) return TRUE;
- if (name[i] == ' ') return TRUE;
- if (name[i] == '*') return TRUE;
- if (name[i] == '?') return TRUE;
- if (name[i] == ',') return TRUE;
- if (name[i] == '@') return TRUE;
- if (name[i] == '!') return TRUE;
- }
-
- return FALSE;
-}
-
-/* Same as silc_server_name_bad_chars but check for channel names. */
-
-bool silc_server_name_bad_chchars(const char *name, SilcUInt32 name_len)
-{
- int i;
-
- for (i = 0; i < name_len; i++) {
- if (!isascii(name[i]))
- return TRUE;
- if (name[i] <= 32) return TRUE;
- if (name[i] == ' ') return TRUE;
- if (name[i] == '*') return TRUE;
- if (name[i] == '?') return TRUE;
- if (name[i] == ',') return TRUE;
- }
-
- return FALSE;
-}
-
-/* Modifies the `name' if it includes bad characters and returns new
- allocated name that does not include bad characters. */
-
-char *silc_server_name_modify_bad(const char *name, SilcUInt32 name_len)
-{
- int i;
- char *newname = strdup(name);
-
- for (i = 0; i < name_len; i++) {
- if (!isascii(newname[i])) newname[i] = '_';
- if (newname[i] <= 32) newname[i] = '_';
- if (newname[i] == ' ') newname[i] = '_';
- if (newname[i] == '*') newname[i] = '_';
- if (newname[i] == '?') newname[i] = '_';
- if (newname[i] == ',') newname[i] = '_';
- }
-
- return newname;
-}
-
/* Find number of sockets by IP address indicated by `ip'. Returns 0 if
socket connections with the IP address does not exist. */
SilcChannelEntry channel,
SilcChannelClientEntry *chl);
-/* Checks string for bad characters and returns TRUE if they are found. */
-bool silc_server_name_bad_chars(const char *name, SilcUInt32 name_len);
-bool silc_server_name_bad_chchars(const char *name, SilcUInt32 name_len);
-
-/* Modifies the `nick' if it includes bad characters and returns new
- allocated nickname that does not include bad characters. */
-char *silc_server_name_modify_bad(const char *name, SilcUInt32 name_len);
-
/* Find number of sockets by IP address indicated by `ip'. Returns 0 if
socket connections with the IP address does not exist. */
SilcUInt32 silc_server_num_sockets_by_ip(SilcServer server, const char *ip,
goto got_err;
}
}
- else if (!strcmp(name, "publickeydir")) {
- if (!my_parse_publickeydir((char *) val, (void *)&tmp->publickeys)) {
- got_errno = SILC_CONFIG_EPRINTLINE;
- goto got_err;
- }
- }
else
return SILC_CONFIG_EINTERNAL;
return SILC_CONFIG_OK;
{ "nick", SILC_CONFIG_ARG_STRE, fetch_admin, NULL },
{ "passphrase", SILC_CONFIG_ARG_STR, fetch_admin, NULL },
{ "publickey", SILC_CONFIG_ARG_STR, fetch_admin, NULL },
- { "publickeydir", SILC_CONFIG_ARG_STR, fetch_admin, NULL },
{ "port", SILC_CONFIG_ARG_INT, fetch_admin, NULL },
{ "params", SILC_CONFIG_ARG_STR, fetch_admin, NULL },
{ 0, 0, 0, 0 }
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2003 Pekka Riikonen
+ Copyright (C) 1997 - 2005 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
STAT_OUTPUT(" Authentication failures : %d", silcd->stat.auth_failures);
STAT_OUTPUT(" Packets sent : %d", silcd->stat.packets_sent);
STAT_OUTPUT(" Packets received : %d", silcd->stat.packets_received);
+ STAT_OUTPUT(" Commands sent : %d", silcd->stat.commands_sent);
+ STAT_OUTPUT(" Commands received : %d", silcd->stat.commands_received);
STAT_OUTPUT(" Connections : %d", silcd->stat.conn_num);
#undef STAT_OUTPUT
(unsigned char *)"N/A", client_entry->id ?
silc_id_render(client_entry->id, SILC_ID_CLIENT) : "N/A",
client_entry->data.status, server_entry ?
- server_entry->server_name ? server_entry->server_name :
+ server_entry->server_name ? server_entry->server_name :
"N/A" : "local");
if (!silc_idcache_list_next(list, &id_cache))
break;
(unsigned char *)"N/A", client_entry->id ?
silc_id_render(client_entry->id, SILC_ID_CLIENT) : "N/A",
client_entry->data.status, server_entry ?
- server_entry->server_name ? server_entry->server_name :
+ server_entry->server_name ? server_entry->server_name :
"N/A" : "local");
if (!silc_idcache_list_next(list, &id_cache))
break;
AC_PROG_MAKE_SET
AC_PROG_LN_S
+AC_PROG_EGREP
AC_SUBST(LN_S)
AC_PATH_PROG(sedpath, sed)
;;
esac
-CFLAGS=
+# Control compiler optimizations
+CFLAGS=`echo $CFLAGS | sed 's/-O[ 0123456789s]*//g'`
+
AC_PROG_CC
AC_C_INLINE
AC_C_CONST
SILC_ADD_CFLAGS(-g -O2)
fi
SILC_ADD_CFLAGS(-Wall -finline-functions)
+ SILC_ADD_CFLAGS(-Wno-pointer-sign)
else
# Other compilers
case "$target" in
AC_DEFINE_UNQUOTED([SILC_MODULESDIR], "$MODULESDIR", [SILC_MODULESDIR])
#endif SILC_DIST_SIM
-#ifdef SILC_DIST_SERVER
-# Logs directory
-#
-LOGSDIR="$silc_prefix/logs"
-AC_ARG_WITH(logsdir,
- [[ --with-logsdir=DIR directory for SILC Server logs [PREFIX/logs]]],
- [
- case "$withval" in
- no|yes)
- ;;
- *)
- LOGSDIR="$withval"
- ;;
- esac
- ])
-AC_SUBST(LOGSDIR)
-AC_DEFINE_UNQUOTED([SILC_LOGSDIR], "$LOGSDIR", [SILC_LOGSDIR])
-
-# silcd config file checking
-#
-summary_silcd_configfile="/etc/silc/silcd.conf"
-AC_ARG_WITH(silcd-config-file,
- [[ --with-silcd-config-file=FILE use FILE as default configuration file
- for SILC Server [/etc/silc/silcd.conf]]],
- AC_DEFINE_UNQUOTED([SILC_SERVER_CONFIG_FILE], "$withval", [SILC_SERVER_CONFIG_FILE])
- summary_silcd_configfile="$withval"
- )
-
-# silcd pid file checking
-#
-if test "x$localstatedir" != 'x${prefix}/var'; then
- PIDFILE="$localstatedir/silcd.pid"
-else
- PIDFILE="$silc_prefix/var/silcd.pid"
-fi
-
-AC_ARG_WITH(silcd-pid-file,
- [[ --with-silcd-pid-file=FILE use FILE as default pid file for SILC
- Server [/var/run/silcd.pid]]],
- [
- case "$withval" in
- no|yes)
- ;;
- *)
- PIDFILE="$withval"
- ;;
- esac
- ])
-AC_SUBST(PIDFILE)
-#endif SILC_DIST_SERVER
-
#ifdef SILC_DIST_COMPILER
##
## With/without checkings
compile_libs=true
#ifndef SILC_DIST_TOOLKIT
-
AC_ARG_WITH(silc-includes,
[ --with-silc-includes=DIR SILC Toolkit includes [search in DIR]],
[ac_silc_includes="$withval"], [ac_silc_includes="no"])
[ --with-silc-libs=DIR SILC Toolkit libraries [search in DIR]],
[ac_silc_libs="$withval"], [ac_silc_libs="no"])
-#
-# XXX missing checking the __SILC_WITH_XXX defines from the provided libs
-# in order to determine correct libs to link.
+if test -n "$with_silc_includes" || test -n "$with_silc_libs"; then
-#
-# XXX missing pkg-config check.
+ # Manually provided libs
+ if test "$ac_silc_includes" != "no"; then
+ compile_libs=false
+ SILC_LIB_INCLUDES="-I$ac_silc_includes"
+ fi
+ if test "$ac_silc_libs" != "no"; then
+ compile_libs=false
+ LIBS="$LIBS -L$ac_silc_libs"
+ fi
-if test "$ac_silc_includes" != "no"; then
- compile_libs=false
- SILC_LIB_INCLUDES="-I$ac_silc_includes"
-fi
-if test "$ac_silc_libs" != "no"; then
- compile_libs=false
- LIBS="$LIBS -L$ac_silc_libs"
-fi
+ # Check libs to link against
+ f=`$EGREP __SILC_HAVE_PTHREAD $ac_silc_includes/silcincludes.h`
+ if test -n "$f"; then
+ LIBS="$LIBS -lpthread"
+ check_threads=false
+ has_threads=true
+ fi
+ f=`$EGREP __SILC_HAVE_SIM $ac_silc_includes/silcincludes.h`
+ if test -n "$f"; then
+ LIBS="$LIBS -ldl"
+ fi
+else
+ # pkg-config check
+ PKG_CHECK_MODULES(SILC, silc, compile_libs=false, compile_libs=true)
+ PKG_CHECK_MODULES(SILCCLIENT, silcclient, compile_libs=false, compile_libs=true)
+
+ if test x$compile_libs = xfalse; then
+ LIBS="$LIBS $SILC_LIBS"
+ CFLAGS="$CFLAGS $SILC_CFLAGS"
+ LIBS="$LIBS $SILCCLIENT_LIBS"
+ CFLAGS="$CFLAGS $SILCCLIENT_CFLAGS"
+ fi
+fi
#endif SILC_DIST_TOOLKIT
-
# SOCKS4 support checking
#
SAVE_LIBS="$LIBS"
# POSIX threads support
#
-has_threads=false
AC_MSG_CHECKING(whether to search for POSIX threads)
AC_ARG_WITH(pthreads,
[[ --with-pthreads[=DIR] use POSIX threads [search in DIR/include and DIR/lib]]],
])
if test x$check_threads = xtrue; then
+ has_threads=false
SAVE_LIBS="$LIBS"
SAVE_CFLAGS="$CFLAGS"
SAVE_LDFLAGS="$LDFLAGS"
AM_CONDITIONAL(SILC_OS2, test xfalse = xtrue)
#ifdef SILC_DIST_TOOLKIT
-
# --without-irssi
#
without_irssi=false
[
AC_MSG_RESULT(yes)
])
-
#endif SILC_DIST_TOOLKIT
#ifdef SILC_DIST_CLIENT
## Misc
##
+# Make enable-shared aware
+AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes)
+
# Other configure scripts
#
fi
#endif SILC_DIST_TOOLKIT
-#ifdef SILC_DIST_TOOLKIT
-if test x$without_silcd = xfalse ; then
-#endif SILC_DIST_TOOLKIT
-#ifdef SILC_DIST_SERVER
- AC_CONFIG_FILES(
-silcd/Makefile
-doc/example_silcd.conf
-)
-#endif SILC_DIST_SERVER
-#ifdef SILC_DIST_TOOLKIT
-fi
-#endif SILC_DIST_TOOLKIT
-
#ifdef SILC_DIST_TOOLKIT
AC_CONFIG_FILES(
silc/Makefile
echo " Target host ...................: $target"
echo " Compiler ......................: $CC"
echo " CFLAGS ........................: $CFLAGS"
-echo " CPPFLAGS ......................: $CPPFLAGS"
echo " LDFLAGS .......................: $LDFLAGS"
echo " LIBS ..........................: $LIBS"
echo ""
#endif SILC_DIST_INCLUDES
echo ""
-#ifdef SILC_DIST_SERVER
-silcd="yes"
-#endif SILC_DIST_SERVER
-
#ifdef SILC_DIST_TOOLKIT
if test x$without_irssi = xtrue; then
irssi="no"
include apps/autodist/INSTALL INSTALL
include apps/autodist/AUTHORS AUTHORS
include apps/autodist/README README
+include apps/autodist/TODO TODO
+include apps/autodist/CHANGES CHANGES
exclude apps/autodist/INSTALL apps/autodist/AUTHORS apps/autodist/README
-exclude TODO README.* ltmain.sh
+exclude apps/autodist/TODO apps/autodist/CHANGES
+exclude README.* ltmain.sh
-noprocess apps/autodist/doc apps/autodist/tests
+noprocess apps/autodist/doc/* apps/autodist/tests/*
+post-process-dist-hook distdir/post-process-dist
+post-dist-hook distdir/post-dist
name Client
package silc-client
bug-report silc-devel@lists.silcnet.org
+
inherit common
define SILC_DIST_CLIENT
define SILC_DIST_CLIENTLIB
+
pre-hook distdir/pre-run
+post-process-dist-hook distdir/post-process-dist
+post-dist-hook distdir/post-dist
define SILC_DIST_SIM
define SILC_DIST_MPI
define SILC_DIST_MATH
+define SILC_DIST_SFTP
define SILC_DIST_COMPILER
--- /dev/null
+#!/bin/sh
+
+distribution=$1
+dist_version=$2
+package=$3
+distdir=$4
+
+if test -f $distdir.tar.gz; then
+ md5sum $distdir.tar.gz > $distdir.tar.gz.md5
+fi
+if test -f $distdir.tar.bz2; then
+ md5sum $distdir.tar.bz2 > $distdir.tar.bz2.md5
+fi
+
--- /dev/null
+#!/bin/sh
+
+distribution=$1
+dist_version=$2
+package=$3
+distdir=$4
+
+# Remove all CVS directories, as some may be left when we put directories
+# in EXTRA_DIST or 'include' them in distribution.
+
+if test -d $distdir; then
+ rm -rf `find $distdir -name CVS`
+fi
name Server
package silc-server
bug-report silc-devel@lists.silcnet.org
-license distdir/BSD
-license-header distdir/GPL-header distdir/BSD-header
+
inherit common
define SILC_DIST_SERVER
+undef SILC_DIST_SFTP
+
+post-process-dist-hook distdir/post-process-dist
+post-dist-hook distdir/post-dist
name Toolkit
package silc-toolkit
bug-report silc-devel@lists.silcnet.org
+
inherit common
inherit client
inherit server
define SILC_DIST_TOOLKIT
+
include README.CVS
include README.WIN32
include README.MACOSX
include silcer
include tutorial
+
pre-hook distdir/pre-run
+post-process-dist-hook distdir/post-process-dist
+post-dist-hook distdir/post-dist
#else !SILC_DIST_TOOLKIT
dist-hook:
- rm -rf `find $(top_distdir)/doc -name CVS`
$(SILC_TOP_SRCDIR)/scripts/manpages.pl
rm draft-riikonen*.txt
touch draft-riikonen-silc-spec-08.txt
#include "silcske_payload.h"
#include "silcske_groups.h"
+#ifdef SILC_DIST_SFTP
/* SILC SFTP library */
#include "silcsftp.h"
#include "silcsftp_fs.h"
+#endif /* SILC_DIST_SFTP */
#ifdef __cplusplus
}
#ifdef SILC_DIST_MATH
silcmath \
#endif SILC_DIST_MATH
+#ifdef SILC_DIST_SFTP
+ silcsftp \
+#endif SILC_DIST_SFTP
silcske \
- silcutil \
- silcsftp
+ silcutil
SILCLIB = libsilc.a
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = silc.pc silcclient.pc
-EXTRA_DIST = doc silc.pc.in silcclient.pc.in
+EXTRA_DIST = silc.pc.in silcclient.pc.in
#endif SILC_DIST_TOOLKIT
SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcmath/mpi"
#endif SILC_DIST_MPI
#endif SILC_DIST_MATH
-SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcske"
SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcutil"
+SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcske"
+#ifdef SILC_DIST_SFTP
SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcsftp"
+#endif SILC_DIST_SFTP
#ifdef SILC_DIST_SIM
SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcsim"
#endif SILC_DIST_SIM
# Do the releases and library versioning according to following rules:
#
# - If any code has changed in library, increment [LIB]_REVISION
-# - If functions were added, set [LIB]_REVISION to 0
+# - If functions were added, removed or changed, set [LIB]_REVISION to 0
# - If functions were added, removed or changed, increment [LIB]_CURRENT
# - If functions were added, increment [LIB]_AGE
# - If functions were removed, set [LIB]_AGE to 0
LIB_BASE_VERSION=1.0
# libsilc versions
-LIBSILC_CURRENT=4 # prev = 3
+LIBSILC_CURRENT=5 # prev = 4
LIBSILC_REVISION=0 # prev = 0
-LIBSILC_AGE=3 # prev = 2
+LIBSILC_AGE=3 # prev = 3
# libsilcclient versions
-LIBSILCCLIENT_CURRENT=3 # prev = 3
-LIBSILCCLIENT_REVISION=1 # prev = 0
-LIBSILCCLIENT_AGE=2 # prev = 2
+LIBSILCCLIENT_CURRENT=4 # prev = 4
+LIBSILCCLIENT_REVISION=0 # prev = 0
+LIBSILCCLIENT_AGE=3 # prev = 3
# Substitute the version numbers
AC_SUBST(LIB_BASE_VERSION)
AC_SUBST(LIBSILCCLIENT_REVISION)
AC_SUBST(LIBSILCCLIENT_AGE)
-# Make enable-shared aware
-AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes)
-
+#ifdef SILC_DIST_TOOLKIT
# Stack trace checking
#
AC_MSG_CHECKING(whether to enable stack tracing)
],
AC_MSG_RESULT(no)
)
+#endif SILC_DIST_TOOLKIT
#
# Makefile outputs
#ifdef SILC_DIST_MATH
lib/silcmath/Makefile
#endif SILC_DIST_MATH
+#ifdef SILC_DIST_SFTP
lib/silcsftp/Makefile
+#endif SILC_DIST_SFTP
#ifdef SILC_DIST_INPLACE
lib/silcutil/tests/Makefile
lib/silccrypt/tests/Makefile
<br />
<small>
Version: @VERSION@<br />
-Copyright © 1997 - 2004 The SILC Project<br />
+Copyright © 1997 - 2005 The SILC Project<br />
Updated: @DATE@
</small>
<br /><br /><br />
conn->remote_port = port;
conn->context = context;
conn->internal->client_cache =
- silc_idcache_alloc(0, SILC_ID_CLIENT, NULL, FALSE, TRUE);
+ silc_idcache_alloc(0, SILC_ID_CLIENT, NULL, NULL, FALSE, TRUE);
conn->internal->channel_cache = silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL,
- FALSE, TRUE);
+ NULL, FALSE, TRUE);
conn->internal->server_cache = silc_idcache_alloc(0, SILC_ID_SERVER, NULL,
- FALSE, TRUE);
+ NULL, FALSE, TRUE);
conn->internal->pending_commands = silc_dlist_init();
conn->internal->ftp_sessions = silc_dlist_init();
/* Return all attributes */
-const SilcHashTable silc_client_attributes_get(SilcClient client,
- SilcClientConnection conn)
+SilcHashTable silc_client_attributes_get(SilcClient client,
+ SilcClientConnection conn)
{
- return (const SilcHashTable)conn->internal->attrs;
+ return conn->internal->attrs;
}
/* Construct a Requested Attributes buffer. If the `attribute' is zero (0)
* payload while traversing the table.
*
***/
-const SilcHashTable silc_client_attributes_get(SilcClient client,
- SilcClientConnection conn);
+SilcHashTable silc_client_attributes_get(SilcClient client,
+ SilcClientConnection conn);
/****f* silcclient/SilcClientAPI/silc_client_attributes_request
*
SilcHashTable name_table;
SilcHashTable context_table;
SilcIDCacheDestructor destructor;
+ void *context;
SilcIdType type;
unsigned int delete_id : 1;
unsigned int delete_name : 1;
SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type,
SilcIDCacheDestructor destructor,
+ void *destructor_context,
bool delete_id, bool delete_name)
{
SilcIDCache cache;
cache->context_table = silc_hash_table_alloc(count, silc_hash_ptr, NULL,
NULL, NULL, NULL, NULL, TRUE);
cache->destructor = destructor;
+ cache->context = destructor_context;
cache->type = id_type;
cache->delete_id = delete_id;
cache->delete_name = delete_name;
if (ret == TRUE) {
/* Call the destructor */
if (cache->destructor)
- cache->destructor(cache, c);
+ cache->destructor(cache, c, cache->context);
/* Free the entry, it has been deleted from the hash tables */
silc_idcache_destructor(NULL, c, NULL);
if (ret == TRUE) {
/* Call the destructor */
if (cache->destructor)
- cache->destructor(cache, c);
+ cache->destructor(cache, c, cache->context);
/* Free the entry, it has been deleted from the hash tables */
silc_idcache_destructor(NULL, c, NULL);
* SYNOPSIS
*
* typedef void (*SilcIDCacheDestructor)(SilcIDCache cache,
- * SilcIDCacheEntry entry);
+ * SilcIDCacheEntry entry,
+ * void *context);
*
* DESCRIPTION
*
*
***/
typedef void (*SilcIDCacheDestructor)(SilcIDCache cache,
- SilcIDCacheEntry entry);
+ SilcIDCacheEntry entry,
+ void *context);
#define SILC_ID_CACHE_EXPIRE 3600
#define SILC_ID_CACHE_EXPIRE_DEF (time(NULL) + SILC_ID_CACHE_EXPIRE)
* SYNOPSIS
*
* SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type,
- * SilcIDCacheDestructor destructor);
+ * SilcIDCacheDestructor destructor,
+ * void *destructor_context,
+ * bool delete_id, bool delete_name);
*
* DESCRIPTION
*
***/
SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type,
SilcIDCacheDestructor destructor,
+ void *destructor_context,
bool delete_id, bool delete_name);
/****f* silccore/SilcIDCacheAPI/silc_idcache_free
/* Return signature of the message */
-const SilcMessageSignedPayload
+SilcMessageSignedPayload
silc_message_get_signature(SilcMessagePayload payload)
{
- return (const SilcMessageSignedPayload)payload->sig;
+ return payload->sig;
}
/******************************************************************************
*
* SYNOPSIS
*
- * const SilcMessageSignedPayload
+ * SilcMessageSignedPayload
* silc_message_get_signature(SilcMessagePayload payload);
*
* DESCRIPTION
* could not be retrieved from the message.
*
* The caller SHOULD verify the signature by calling the
- * silc_message_signed_verify function.
+ * silc_message_signed_verify function. Caller must not free the
+ * returned payload pointer.
*
***/
-const SilcMessageSignedPayload
+SilcMessageSignedPayload
silc_message_get_signature(SilcMessagePayload payload);
/****f* silccore/SilcMessageAPI/silc_message_signed_payload_parse
/*
- silcapputil.c
+ silcapputil.c
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2002 Pekka Riikonen
+ Copyright (C) 2002 - 2005 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
char *username = NULL, *realname = NULL;
char *hostname, email[256];
char *ident;
-
+
/* Get realname */
realname = silc_get_real_name();
alg = silc_get_input("PKCS name (l to list names) [rsa]: ", FALSE);
if (!alg)
alg = strdup("rsa");
-
+
if (*alg == 'l' || *alg == 'L') {
char *list = silc_pkcs_get_supported();
printf("%s\n", list);
printf("Organization : %s\n", ident->org);
if (ident->country)
printf("Country : %s\n", ident->country);
- printf("Fingerprint (SHA1) : %s\n", fingerprint);
- printf("Babbleprint (SHA1) : %s\n", babbleprint);
+ printf("Fingerprint (SHA1) : %s\n", fingerprint);
+ printf("Babbleprint (SHA1) : %s\n", babbleprint);
fflush(stdout);
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tr valign="top" bgcolor="#dddddd">
- <td><small>Copyright © 2001 - 2002 SILC Project<br />
+ <td><small>Copyright © 2001 - 2005 SILC Project<br />
<a href="http://silcnet.org">SILC Project Website</a></small></td>
<td align="right"><small>
<a href="index.html">SILC Toolkit Reference Manual</a><br />
</table>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tr valign="top" bgcolor="#dddddd">
- <td><small>Copyright © 2001 - 2002 SILC Project<br />
+ <td><small>Copyright © 2001 - 2005 SILC Project<br />
<a href="http://silcnet.org">SILC Project Website</a></small></td>
<td align="right"><small>
<a href="index.html">SILC Toolkit Reference Manual</a><br />
# Generate the top index.html file
index=`find $SRC -name "LIBINDEX"`
- version=`grep SILC_VERSION_STRING $SRC/../includes/version_internal.h |cut -d\" -f2`
+ version=`grep "define SILC_VERSION_STRING" $SRC/../includes/silcversion.h |cut -d\" -f2`
curdate=`date`
sed -e "/@VERSION@/s//$version/" -e "/@DATE@/s//$curdate/" -e "/@BODY@/ r $DST/index.html.tmp" -e s/@BODY@//g $index >$DST/index.html
sh gen.sh $DST gen_index.php 2 $DST/index.html $DST/index.html
+++ /dev/null
-/* Source/config.h. Generated automatically by configure. */
-/* Source/config.h.in. Generated automatically from configure.in by autoheader. */
-
-/* Define to empty if the keyword does not work. */
-/* #undef const */
-
-/* Define if you don't have vprintf but do have _doprnt. */
-/* #undef HAVE_DOPRNT */
-
-/* Define if you have the strftime function. */
-#define HAVE_STRFTIME 1
-
-/* Define if you have the vprintf function. */
-#define HAVE_VPRINTF 1
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-/* #undef size_t */
-
-/* Define if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define if you have the strstr function. */
-#define HAVE_STRSTR 1
-
-/* Name of package */
-#define PACKAGE "robodoc"
-
-/* Version number of package */
-#define VERSION "3.2.3"
-
silc_stringprep @ 923;\r
silc_identifier_check @ 924 ;\r
silc_identifier_verify @ 925 ;\r
+ silc_channel_name_check @ 926 ;\r
+ silc_channel_name_verify @ 927 ;\r