From 816a5b080c797c0db47b7b274a85646343c3466e Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sat, 23 Apr 2005 13:32:20 +0000 Subject: [PATCH] Merged silc_1_0_branch to trunk. cvs -z3 update -j silc_trunk_merged_silc_1_0_branch_4 -j silc_1_0_branch --- CHANGES | 24 ++ Makefile.ad | 2 +- README.DIST | 18 +- apps/autodist/CHANGES | 50 ++++ apps/autodist/TODO | 16 ++ apps/autodist/autodist.conf | 2 +- apps/autodist/autodist.in | 332 +++++++++++++++---------- apps/autodist/configure.ad | 1 + apps/autodist/doc/Makefile.am | 3 + apps/autodist/doc/autodist.1.in | 98 ++++++++ apps/autodist/doc/autodist.texi | 240 +++++++++++++------ apps/autodist/tests/Makefile.am | 5 +- apps/autodist/tests/autodist1.test | 18 +- apps/autodist/tests/autodist2.test | 10 +- apps/autodist/tests/autodist3.test | 103 ++++++++ apps/autodist/tests/autodist4.test | 103 ++++++++ apps/autodist/tests/autodist5.test | 104 ++++++++ apps/silcd/command.c | 372 ++++++++++++++--------------- apps/silcd/command_reply.c | 3 + apps/silcd/configure.ad | 80 +++++++ apps/silcd/idlist.c | 12 +- apps/silcd/idlist.h | 3 +- apps/silcd/packet_send.c | 11 +- apps/silcd/server.c | 19 +- apps/silcd/server_internal.h | 7 +- apps/silcd/server_query.c | 32 ++- apps/silcd/server_util.c | 60 ----- apps/silcd/server_util.h | 8 - apps/silcd/serverconfig.c | 7 - apps/silcd/silcd.c | 11 +- configure.ad | 130 ++++------ distdir/autodist | 9 +- distdir/client | 4 + distdir/common | 1 + distdir/post-dist | 14 ++ distdir/post-process-dist | 13 + distdir/server | 7 +- distdir/toolkit | 5 + doc/Makefile.ad | 1 - includes/silcincludes.h.in | 2 + lib/Makefile.ad | 8 +- lib/configure.ad | 23 +- lib/doc/LIBINDEX | 2 +- lib/silcclient/client.c | 6 +- lib/silcclient/client_attrs.c | 6 +- lib/silcclient/silcclient.h | 4 +- lib/silccore/silcidcache.c | 7 +- lib/silccore/silcidcache.h | 11 +- lib/silccore/silcmessage.c | 4 +- lib/silccore/silcmessage.h | 7 +- lib/silcutil/silcapputil.c | 12 +- scripts/silcdoc/gen_index.php | 4 +- scripts/silcdoc/silcdoc | 2 +- util/robodoc/Source/config.h | 30 --- win32/libsilc/libsilc.def | 2 + 55 files changed, 1389 insertions(+), 679 deletions(-) create mode 100644 apps/autodist/CHANGES create mode 100644 apps/autodist/TODO create mode 100644 apps/autodist/doc/autodist.1.in create mode 100755 apps/autodist/tests/autodist3.test create mode 100755 apps/autodist/tests/autodist4.test create mode 100755 apps/autodist/tests/autodist5.test create mode 100644 apps/silcd/configure.ad create mode 100644 distdir/post-dist create mode 100644 distdir/post-process-dist delete mode 100644 util/robodoc/Source/config.h diff --git a/CHANGES b/CHANGES index fa8a3230..baa76976 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,27 @@ +Fri Apr 22 12:21:44 EEST 2005 Pekka Riikonen + + * 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 + + * 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 + + * 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 * Added Autodist. diff --git a/Makefile.ad b/Makefile.ad index 1ffcbca2..e76466de 100644 --- a/Makefile.ad +++ b/Makefile.ad @@ -137,7 +137,7 @@ toolkit-install: -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: \ diff --git a/README.DIST b/README.DIST index e5264ef8..f741abe1 100644 --- a/README.DIST +++ b/README.DIST @@ -6,24 +6,16 @@ tree and how to package distributions for releasing. This also defines 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 diff --git a/apps/autodist/CHANGES b/apps/autodist/CHANGES new file mode 100644 index 00000000..7f9bf01b --- /dev/null +++ b/apps/autodist/CHANGES @@ -0,0 +1,50 @@ +Sat Apr 23 12:49:09 EEST 2005 Pekka Riikonen + + * Autodist 1.2.1. + + * Fixed 'noprocess' sed script. + +Fri Apr 22 20:23:06 EEST 2005 Pekka Riikonen + + * 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 + + * Remove extra ' ' and '\t' when joining backslashed lines. + + * Fixed argument delivery to hook scripts. + +Mon Apr 18 21:05:42 EEST 2005 Pekka Riikonen + + * Process '*.ad' files before calling autoconf and automake. + + * Various shell compatibility kludges added. + +Mon Apr 18 20:06:24 EEST 2005 Pekka Riikonen + + * 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 + + * 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 + + * First release, Autodist 1.0. diff --git a/apps/autodist/TODO b/apps/autodist/TODO new file mode 100644 index 00000000..e3e00ead --- /dev/null +++ b/apps/autodist/TODO @@ -0,0 +1,16 @@ +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. diff --git a/apps/autodist/autodist.conf b/apps/autodist/autodist.conf index 4748b0e3..cbf17b5c 100644 --- a/apps/autodist/autodist.conf +++ b/apps/autodist/autodist.conf @@ -36,7 +36,7 @@ AUTOCONF="autoconf" # 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. diff --git a/apps/autodist/autodist.in b/apps/autodist/autodist.in index 27e6c222..2e8a3614 100755 --- a/apps/autodist/autodist.in +++ b/apps/autodist/autodist.in @@ -30,6 +30,47 @@ # 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 @@ -60,7 +101,7 @@ distdefs= undistdefs= # All distribution options -options= +doptions= opt_template=false opt_no_dist=false opt_no_inherit=false @@ -74,11 +115,13 @@ excludes= # 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= @@ -181,26 +224,29 @@ ad_create_distdefs_h() 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 <>$fname done - echo >> $fname - echo "#endif /* _"$DP"_DISTDEFS_H */" >> $fname + cat >> $fname <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 @@ -268,13 +319,15 @@ ad_make_configure() # 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 @@ -294,7 +347,7 @@ ad_make_configure_ac() 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" @@ -303,14 +356,16 @@ ad_make_configure_ac() # 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 < configure.ac + sed -e :a -e '/\\$/N; s/[ ]*\\\n//; ta' < $fname > configure.ac else cp -p $fname.tmp configure.ac fi @@ -376,14 +431,16 @@ ad_make_makefile_ams() 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 <> $fname.am + sed -e :a -e '/\\$/N; s/[ ]*\\\n//; ta' < $fname.tmp >> $fname.am else cat $ff >> $fname.am fi @@ -417,16 +474,6 @@ ad_process_ads() 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 @@ -453,13 +500,15 @@ ad_process_ads() # 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= @@ -553,7 +602,7 @@ ad_dist_includes() 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. @@ -639,16 +688,21 @@ ad_process_tree() { 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 @@ -692,7 +746,7 @@ ad_process_source_tree() # 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 @@ -730,7 +784,7 @@ ad_makedist_makesane() 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` @@ -774,16 +828,19 @@ ad_makedist() 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 @@ -793,8 +850,8 @@ ad_makedist() 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" @@ -818,8 +875,8 @@ ad_makedist() 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 @@ -845,6 +902,9 @@ ad_makedist() 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 @@ -912,6 +972,23 @@ ad_clear_options() # 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 @@ -919,11 +996,11 @@ ad_parse_distribution() 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 @@ -931,23 +1008,23 @@ ad_parse_distribution() 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 @@ -959,13 +1036,13 @@ ad_parse_distribution() 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 @@ -984,17 +1061,17 @@ ad_parse_distribution() 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 @@ -1002,7 +1079,7 @@ ad_parse_distribution() 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 @@ -1012,35 +1089,41 @@ ad_parse_distribution() 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 @@ -1071,15 +1154,14 @@ ad_process_distdefs() 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 @@ -1147,19 +1229,22 @@ ad_process_license_header() # 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 @@ -1177,6 +1262,9 @@ ad_process_noprocess() ad_process_file() { local found=false + local f + local defs + local ndefs # Process only regular files if test '!' -f $1; then @@ -1185,7 +1273,7 @@ ad_process_file() 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. @@ -1194,15 +1282,15 @@ ad_process_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 @@ -1279,6 +1367,9 @@ ad_process_file() ad_process_source_file() { local found=false + local f + local defs + local ndefs # Process only regular files if test '!' -f $1; then @@ -1287,7 +1378,7 @@ ad_process_source_file() 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. @@ -1296,14 +1387,15 @@ ad_process_source_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 @@ -1386,7 +1478,7 @@ ad_run_hooks() 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 " autodist.dist echo "ver:$dist_version" >> autodist.dist -echo "$package-$dist_version" >> autodist.dist +echo "distdir:$package-$dist_version" >> autodist.dist # # Run post-hooks diff --git a/apps/autodist/configure.ad b/apps/autodist/configure.ad index 806ac54f..3f2d1f72 100644 --- a/apps/autodist/configure.ad +++ b/apps/autodist/configure.ad @@ -47,6 +47,7 @@ apps/autodist/Makefile apps/autodist/autodist apps/autodist/makedist apps/autodist/doc/Makefile +apps/autodist/doc/autodist.1 apps/autodist/tests/Makefile ) #endif SILC_DIST_AUTODIST diff --git a/apps/autodist/doc/Makefile.am b/apps/autodist/doc/Makefile.am index 2ffb4b0c..003c0744 100644 --- a/apps/autodist/doc/Makefile.am +++ b/apps/autodist/doc/Makefile.am @@ -17,3 +17,6 @@ info_TEXINFOS = autodist.texi autodist_TEXINFOS = fdl.texi + +man_MANS = autodist.1 +EXTRA_DIST = $(man_MANS) diff --git a/apps/autodist/doc/autodist.1.in b/apps/autodist/doc/autodist.1.in new file mode 100644 index 00000000..333ccb34 --- /dev/null +++ b/apps/autodist/doc/autodist.1.in @@ -0,0 +1,98 @@ +.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 instead of default 'distdir'. +.PP +.TP +\fB\-s\fR, \fB\-\-distdefs\fR \fB[]\fR +Prints distribution defines of 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. diff --git a/apps/autodist/doc/autodist.texi b/apps/autodist/doc/autodist.texi index 870cc91f..928432e4 100644 --- a/apps/autodist/doc/autodist.texi +++ b/apps/autodist/doc/autodist.texi @@ -349,7 +349,7 @@ AUTOMAKE="automake -a -c" 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. @@ -427,7 +427,8 @@ and are ignored. 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 @@ -444,6 +445,8 @@ optional directive, and if omitted the distribution package name will 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 @@ -458,8 +461,8 @@ Will create distribution packages named, for example, as 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 @@ -513,8 +516,8 @@ If the new header file has fewer lines that the current header file, all 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 @@ -524,6 +527,16 @@ the header file should start the license text at the second character also. 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 @@ -556,7 +569,7 @@ In this example, if the text in the current header file is found in any 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. @@ -639,14 +652,14 @@ distribution. The following options are available. 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 @@ -761,19 +774,22 @@ process a file. The Autodist will not process the file during 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 -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 [...] @@ -805,6 +821,39 @@ executes the script: distribution name, distribution version and package name of distribution. The script may use these arguments if it needs them. +@section Directive: pre-process-dist-hook [...] + +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 [...] + +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 [...] The 'pre-dist-hook' directive can be used define additional scripts that @@ -812,8 +861,8 @@ will be run when Autodist has started distribution creation. This directive 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 @@ -824,12 +873,12 @@ script may use these arguments if it needs them. @section Directive: post-dist-hook [...] 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 @@ -837,6 +886,37 @@ name of distribution and destination distribution directory name. The 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 @@ -856,8 +936,8 @@ define SILC_DIST_IRSSI 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 @@ -969,6 +1049,9 @@ preparation. They will be processed when creating the distribution package. 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 @@ -995,7 +1078,7 @@ configuration and compilation (@pxref{Preparing source tree, , , , }). 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: @@ -1037,12 +1120,13 @@ a compiler friendly format, defined below, should be used. @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: @@ -1099,6 +1183,8 @@ The following example shows the use of source code format: #ifndef SILC_DIST_FOOBAR foobar_replacement(); + foobar_hack_init(); + foobar_init(); #else /* SILC_DIST_FOOBAR */ real_foobar(); #endif /* SILC_DIST_FOOBAR */ @@ -1115,21 +1201,21 @@ would be: 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 @@ -1232,14 +1318,14 @@ not using Autodist, then you would do this by running perhaps 'aclocal', 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 @@ -1262,10 +1348,10 @@ distribution run Autodist without any arguments. 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 @@ -1275,6 +1361,8 @@ prepare. 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 @@ -1288,7 +1376,7 @@ 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 @@ -1297,6 +1385,12 @@ the distribution you have prepared will behave in your source tree exactly 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 @@ -1309,18 +1403,18 @@ Before creating a new distribution package, you will need to prepare 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: @@ -1332,16 +1426,11 @@ This example would create, in addition of 'tar.gz' package, also a '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 @@ -1356,7 +1445,7 @@ For additional help, you may give: @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: @@ -1367,7 +1456,7 @@ 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 @@ -1387,7 +1476,7 @@ define _DIST_FOOZBAR 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': @@ -1442,7 +1531,7 @@ directory 'distdir': 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 @@ -1484,6 +1573,7 @@ undef _DIST_CRYPTO @example # Common template +option template define _DIST_DOC define _DIST_LIB define _DIST_MATH diff --git a/apps/autodist/tests/Makefile.am b/apps/autodist/tests/Makefile.am index faf528af..c1e2ae65 100644 --- a/apps/autodist/tests/Makefile.am +++ b/apps/autodist/tests/Makefile.am @@ -19,7 +19,10 @@ AUTOMAKE_OPTIONS = 1.0 no-dependencies foreign TESTS = \ autodist1.test \ - autodist2.test + autodist2.test \ + autodist3.test \ + autodist4.test \ + autodist5.test clean-local: -rm -rf test diff --git a/apps/autodist/tests/autodist1.test b/apps/autodist/tests/autodist1.test index 2ea7cc43..f475436d 100755 --- a/apps/autodist/tests/autodist1.test +++ b/apps/autodist/tests/autodist1.test @@ -22,15 +22,24 @@ Makefile ) 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 @@ -40,6 +49,9 @@ cat << EOF > subdir/configure.ad # subdir/configure.ad fragment #ifndef _DIST_NODEF echo "_DIST_NODEF ok" +#else _DIST_NODEF +echo "ERROR" +exit 1 #endif _DIST_NODEF EOF diff --git a/apps/autodist/tests/autodist2.test b/apps/autodist/tests/autodist2.test index 3a01e4fa..16e5f931 100755 --- a/apps/autodist/tests/autodist2.test +++ b/apps/autodist/tests/autodist2.test @@ -22,15 +22,19 @@ Makefile ) 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 diff --git a/apps/autodist/tests/autodist3.test b/apps/autodist/tests/autodist3.test new file mode 100755 index 00000000..e70109d9 --- /dev/null +++ b/apps/autodist/tests/autodist3.test @@ -0,0 +1,103 @@ +#!/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 + diff --git a/apps/autodist/tests/autodist4.test b/apps/autodist/tests/autodist4.test new file mode 100755 index 00000000..1de80115 --- /dev/null +++ b/apps/autodist/tests/autodist4.test @@ -0,0 +1,103 @@ +#!/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 + diff --git a/apps/autodist/tests/autodist5.test b/apps/autodist/tests/autodist5.test new file mode 100755 index 00000000..58691e3f --- /dev/null +++ b/apps/autodist/tests/autodist5.test @@ -0,0 +1,104 @@ +#!/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 + diff --git a/apps/silcd/command.c b/apps/silcd/command.c index 5d94f74b..c11e5497 100644 --- a/apps/silcd/command.c +++ b/apps/silcd/command.c @@ -421,7 +421,7 @@ bool silc_server_command_pending_timed(SilcServer server, 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); @@ -488,6 +488,9 @@ silc_server_command_send_status_reply(SilcServerCommandContext cmd, { SilcBuffer buffer; + /* Statistics */ + cmd->server->stat.commands_sent++; + SILC_LOG_DEBUG(("Sending command status %d", status)); buffer = @@ -514,6 +517,9 @@ silc_server_command_send_status_data(SilcServerCommandContext cmd, { SilcBuffer buffer; + /* Statistics */ + cmd->server->stat.commands_sent++; + SILC_LOG_DEBUG(("Sending command status %d", status)); buffer = @@ -540,6 +546,9 @@ silc_server_command_send_status_data2(SilcServerCommandContext cmd, { SilcBuffer buffer; + /* Statistics */ + cmd->server->stat.commands_sent++; + SILC_LOG_DEBUG(("Sending command status %d", status)); buffer = @@ -569,6 +578,9 @@ silc_server_command_pending_error_check(SilcServerCommandContext cmd, 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, @@ -623,7 +635,7 @@ SILC_SERVER_CMD_FUNC(nick) 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; @@ -720,14 +732,11 @@ SILC_SERVER_CMD_FUNC(nick) 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); @@ -746,7 +755,7 @@ silc_server_command_list_send_reply(SilcServerCommandContext cmd, SilcUInt32 gch_count) { int i, k; - SilcBuffer packet, idp; + SilcBuffer idp; SilcChannelEntry entry; SilcStatus status; SilcUInt16 ident = silc_command_get_ident(cmd->payload); @@ -801,18 +810,13 @@ silc_server_command_list_send_reply(SilcServerCommandContext cmd, } /* 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++; } @@ -840,18 +844,13 @@ silc_server_command_list_send_reply(SilcServerCommandContext cmd, } /* 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++; } @@ -879,6 +878,9 @@ SILC_SERVER_CMD_FUNC(list) 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); @@ -938,7 +940,7 @@ SILC_SERVER_CMD_FUNC(topic) 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); @@ -1045,16 +1047,12 @@ SILC_SERVER_CMD_FUNC(topic) /* 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); @@ -1078,7 +1076,7 @@ SILC_SERVER_CMD_FUNC(invite) SilcIDListData idata; SilcArgumentPayload args; SilcHashTableList htl; - SilcBuffer packet, list, tmp2; + SilcBuffer list, tmp2; SilcBufferStruct alist; unsigned char *tmp, *atype = NULL; SilcUInt32 len, type, len2; @@ -1332,15 +1330,12 @@ SILC_SERVER_CMD_FUNC(invite) /* 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: @@ -1556,7 +1551,7 @@ SILC_SERVER_CMD_FUNC(info) { 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; @@ -1644,6 +1639,9 @@ SILC_SERVER_CMD_FUNC(info) 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); @@ -1668,6 +1666,9 @@ SILC_SERVER_CMD_FUNC(info) 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); @@ -1709,18 +1710,14 @@ SILC_SERVER_CMD_FUNC(info) 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: @@ -1809,6 +1806,9 @@ SILC_SERVER_CMD_FUNC(stats) 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); @@ -1852,13 +1852,10 @@ SILC_SERVER_CMD_FUNC(stats) 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: @@ -2269,6 +2266,9 @@ static void silc_server_command_join_channel(SilcServer server, 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 @@ -2458,6 +2458,9 @@ SILC_SERVER_CMD_FUNC(join) 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); @@ -2593,7 +2596,7 @@ SILC_SERVER_CMD_FUNC(motd) { 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); @@ -2633,22 +2636,16 @@ SILC_SERVER_CMD_FUNC(motd) 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; @@ -2667,6 +2664,9 @@ SILC_SERVER_CMD_FUNC(motd) 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); @@ -2694,6 +2694,9 @@ SILC_SERVER_CMD_FUNC(motd) 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); @@ -2725,15 +2728,12 @@ SILC_SERVER_CMD_FUNC(motd) } 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); } @@ -2751,7 +2751,6 @@ SILC_SERVER_CMD_FUNC(umode) 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); @@ -2814,12 +2813,9 @@ SILC_SERVER_CMD_FUNC(umode) /* 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); @@ -2836,7 +2832,7 @@ SILC_SERVER_CMD_FUNC(cmode) 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; @@ -2924,18 +2920,14 @@ SILC_SERVER_CMD_FUNC(cmode) 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; } @@ -3298,26 +3290,21 @@ SILC_SERVER_CMD_FUNC(cmode) 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: @@ -3340,7 +3327,7 @@ SILC_SERVER_CMD_FUNC(cumode) 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; @@ -3682,15 +3669,11 @@ SILC_SERVER_CMD_FUNC(cumode) } /* 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: @@ -3712,7 +3695,7 @@ SILC_SERVER_CMD_FUNC(kick) 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; @@ -3816,14 +3799,10 @@ SILC_SERVER_CMD_FUNC(kick) /* 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); @@ -4128,6 +4107,9 @@ SILC_SERVER_CMD_FUNC(watch) 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); @@ -4386,6 +4368,10 @@ SILC_SERVER_CMD_FUNC(watch) /* 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); @@ -4528,7 +4514,7 @@ SILC_SERVER_CMD_FUNC(ban) 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; @@ -4670,16 +4656,11 @@ SILC_SERVER_CMD_FUNC(ban) } /* 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: @@ -4779,7 +4760,7 @@ SILC_SERVER_CMD_FUNC(users) 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; @@ -4840,6 +4821,9 @@ SILC_SERVER_CMD_FUNC(users) !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); @@ -4909,23 +4893,19 @@ SILC_SERVER_CMD_FUNC(users) /* 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) @@ -4944,7 +4924,6 @@ SILC_SERVER_CMD_FUNC(getkey) { SilcServerCommandContext cmd = (SilcServerCommandContext)context; SilcServer server = cmd->server; - SilcBuffer packet; SilcClientEntry client; SilcServerEntry server_entry; SilcClientID *client_id = NULL; @@ -4997,6 +4976,9 @@ SILC_SERVER_CMD_FUNC(getkey) 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); @@ -5049,6 +5031,9 @@ SILC_SERVER_CMD_FUNC(getkey) 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); @@ -5086,14 +5071,11 @@ SILC_SERVER_CMD_FUNC(getkey) } 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) diff --git a/apps/silcd/command_reply.c b/apps/silcd/command_reply.c index b4862c61..198b7167 100644 --- a/apps/silcd/command_reply.c +++ b/apps/silcd/command_reply.c @@ -962,6 +962,9 @@ SILC_SERVER_CMD_REPLY_FUNC(motd) 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 */ diff --git a/apps/silcd/configure.ad b/apps/silcd/configure.ad new file mode 100644 index 00000000..d758333b --- /dev/null +++ b/apps/silcd/configure.ad @@ -0,0 +1,80 @@ +#ifdef SILC_DIST_SERVER +# +# silcd/configure.ad +# +# Author: Pekka Riikonen +# +# 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 diff --git a/apps/silcd/idlist.c b/apps/silcd/idlist.c index 621c4c4f..0a1561ce 100644 --- a/apps/silcd/idlist.c +++ b/apps/silcd/idlist.c @@ -407,7 +407,6 @@ int silc_idlist_del_client(SilcIDList id_list, SilcClientEntry entry) 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; @@ -435,12 +434,19 @@ int silc_idlist_del_client(SilcIDList id_list, SilcClientEntry entry) /* 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); @@ -448,6 +454,8 @@ void silc_idlist_client_destructor(SilcIDCache cache, 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)); diff --git a/apps/silcd/idlist.h b/apps/silcd/idlist.h index cff9c43c..0c4d0a60 100644 --- a/apps/silcd/idlist.h +++ b/apps/silcd/idlist.h @@ -616,7 +616,8 @@ silc_idlist_replace_client_id(SilcServer server, 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, diff --git a/apps/silcd/packet_send.c b/apps/silcd/packet_send.c index a7b13f0d..42a936e0 100644 --- a/apps/silcd/packet_send.c +++ b/apps/silcd/packet_send.c @@ -1923,6 +1923,9 @@ void silc_server_send_command(SilcServer server, SilcBuffer packet; va_list ap; + /* Statistics */ + server->stat.commands_sent++; + va_start(ap, argc); packet = silc_command_payload_encode_vap(command, ident, argc, ap); @@ -1946,12 +1949,15 @@ void silc_server_send_command_reply(SilcServer server, 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); } @@ -1972,6 +1978,9 @@ void silc_server_send_dest_command_reply(SilcServer server, SilcBuffer packet; va_list ap; + /* Statistics */ + server->stat.commands_sent++; + va_start(ap, argc); packet = silc_command_reply_payload_encode_vap(command, status, error, diff --git a/apps/silcd/server.c b/apps/silcd/server.c index 2c3875a5..cf5ddde8 100644 --- a/apps/silcd/server.c +++ b/apps/silcd/server.c @@ -278,7 +278,7 @@ bool silc_server_init_secondary(SilcServer server) bool silc_server_init(SilcServer server) { - int sock; + int sock = -1; SilcServerID *id; SilcServerEntry id_entry; SilcIDListPurge purge; @@ -343,22 +343,22 @@ bool silc_server_init(SilcServer server) /* 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 = @@ -2862,6 +2862,7 @@ void silc_server_packet_parse_type(SilcServer server, */ if (packet->flags & SILC_PACKET_FLAG_LIST) break; + server->stat.commands_received++; silc_server_command_process(server, sock, packet); break; @@ -2873,6 +2874,7 @@ void silc_server_packet_parse_type(SilcServer server, */ if (packet->flags & SILC_PACKET_FLAG_LIST) break; + server->stat.commands_received++; silc_server_command_reply(server, sock, packet); break; @@ -5079,6 +5081,8 @@ void silc_server_announce_watches(SilcServer server, 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, @@ -5718,6 +5722,7 @@ SILC_TASK_CALLBACK(silc_server_get_stats) 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, diff --git a/apps/silcd/server_internal.h b/apps/silcd/server_internal.h index ebbeadab..b92f80f3 100644 --- a/apps/silcd/server_internal.h +++ b/apps/silcd/server_internal.h @@ -4,12 +4,11 @@ Author: Pekka Riikonen - 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 @@ -62,6 +61,8 @@ typedef struct { 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; /* diff --git a/apps/silcd/server_query.c b/apps/silcd/server_query.c index a2486009..f54145da 100644 --- a/apps/silcd/server_query.c +++ b/apps/silcd/server_query.c @@ -294,6 +294,9 @@ void silc_server_query_send_router(SilcServer server, SilcServerQuery query) 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); @@ -336,6 +339,9 @@ void silc_server_query_send_router_reply(void *context, void *reply) 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, @@ -407,16 +413,18 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query) } /* 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 */ @@ -1100,6 +1108,9 @@ void silc_server_query_resolve(SilcServer server, SilcServerQuery 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, @@ -1968,6 +1979,9 @@ SilcClientEntry silc_server_query_client(SilcServer server, 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; diff --git a/apps/silcd/server_util.c b/apps/silcd/server_util.c index 46cf87aa..1f202168 100644 --- a/apps/silcd/server_util.c +++ b/apps/silcd/server_util.c @@ -1093,66 +1093,6 @@ bool silc_server_client_on_channel(SilcClientEntry client, (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. */ diff --git a/apps/silcd/server_util.h b/apps/silcd/server_util.h index 62b3d60f..1c9c5ee0 100644 --- a/apps/silcd/server_util.h +++ b/apps/silcd/server_util.h @@ -94,14 +94,6 @@ bool silc_server_client_on_channel(SilcClientEntry client, 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, diff --git a/apps/silcd/serverconfig.c b/apps/silcd/serverconfig.c index 0afc3f39..545a39ff 100644 --- a/apps/silcd/serverconfig.c +++ b/apps/silcd/serverconfig.c @@ -921,12 +921,6 @@ SILC_CONFIG_CALLBACK(fetch_admin) 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; @@ -1286,7 +1280,6 @@ static const SilcConfigTable table_admin[] = { { "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 } diff --git a/apps/silcd/silcd.c b/apps/silcd/silcd.c index 86d75b55..10222098 100644 --- a/apps/silcd/silcd.c +++ b/apps/silcd/silcd.c @@ -4,12 +4,11 @@ Author: Pekka Riikonen - 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 @@ -302,6 +301,8 @@ SILC_TASK_CALLBACK(dump_stats) 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 @@ -398,7 +399,7 @@ SILC_TASK_CALLBACK(dump_stats) (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; @@ -419,7 +420,7 @@ SILC_TASK_CALLBACK(dump_stats) (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; diff --git a/configure.ad b/configure.ad index 410d19f2..b7affd6f 100644 --- a/configure.ad +++ b/configure.ad @@ -25,6 +25,7 @@ AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_LN_S +AC_PROG_EGREP AC_SUBST(LN_S) AC_PATH_PROG(sedpath, sed) @@ -43,7 +44,9 @@ case "$target" in ;; esac -CFLAGS= +# Control compiler optimizations +CFLAGS=`echo $CFLAGS | sed 's/-O[ 0123456789s]*//g'` + AC_PROG_CC AC_C_INLINE AC_C_CONST @@ -287,6 +290,7 @@ if test "$GCC"; then SILC_ADD_CFLAGS(-g -O2) fi SILC_ADD_CFLAGS(-Wall -finline-functions) + SILC_ADD_CFLAGS(-Wno-pointer-sign) else # Other compilers case "$target" in @@ -426,57 +430,6 @@ AC_SUBST(MODULESDIR) 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 @@ -487,7 +440,6 @@ AC_SUBST(PIDFILE) 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"]) @@ -495,25 +447,44 @@ AC_ARG_WITH(silc-libs, [ --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" @@ -865,7 +836,6 @@ fi # 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]]], @@ -889,6 +859,7 @@ AC_ARG_WITH(pthreads, ]) if test x$check_threads = xtrue; then + has_threads=false SAVE_LIBS="$LIBS" SAVE_CFLAGS="$CFLAGS" SAVE_LDFLAGS="$LDFLAGS" @@ -1019,7 +990,6 @@ AM_CONDITIONAL(SILC_BEOS, test xfalse = xtrue) AM_CONDITIONAL(SILC_OS2, test xfalse = xtrue) #ifdef SILC_DIST_TOOLKIT - # --without-irssi # without_irssi=false @@ -1047,7 +1017,6 @@ AC_ARG_WITH(silcd, [ AC_MSG_RESULT(yes) ]) - #endif SILC_DIST_TOOLKIT #ifdef SILC_DIST_CLIENT @@ -1080,6 +1049,9 @@ AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR]) ## Misc ## +# Make enable-shared aware +AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes) + # Other configure scripts # @@ -1158,19 +1130,6 @@ irssi/Makefile.defines_int 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 @@ -1197,7 +1156,6 @@ echo "---------------------------" echo " Target host ...................: $target" echo " Compiler ......................: $CC" echo " CFLAGS ........................: $CFLAGS" -echo " CPPFLAGS ......................: $CPPFLAGS" echo " LDFLAGS .......................: $LDFLAGS" echo " LIBS ..........................: $LIBS" echo "" @@ -1221,10 +1179,6 @@ echo " include directory .............: $s_includedir" #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" diff --git a/distdir/autodist b/distdir/autodist index 0aa0831f..450a4a07 100644 --- a/distdir/autodist +++ b/distdir/autodist @@ -11,8 +11,13 @@ define SILC_DIST_APPS 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 diff --git a/distdir/client b/distdir/client index 76ec28b1..13f35fef 100644 --- a/distdir/client +++ b/distdir/client @@ -1,7 +1,11 @@ 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 diff --git a/distdir/common b/distdir/common index 39a2a5bf..3fa00057 100644 --- a/distdir/common +++ b/distdir/common @@ -7,4 +7,5 @@ define SILC_DIST_DOC define SILC_DIST_SIM define SILC_DIST_MPI define SILC_DIST_MATH +define SILC_DIST_SFTP define SILC_DIST_COMPILER diff --git a/distdir/post-dist b/distdir/post-dist new file mode 100644 index 00000000..c026866e --- /dev/null +++ b/distdir/post-dist @@ -0,0 +1,14 @@ +#!/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 + diff --git a/distdir/post-process-dist b/distdir/post-process-dist new file mode 100644 index 00000000..f6e4f38e --- /dev/null +++ b/distdir/post-process-dist @@ -0,0 +1,13 @@ +#!/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 diff --git a/distdir/server b/distdir/server index 15eaecc4..97f82d34 100644 --- a/distdir/server +++ b/distdir/server @@ -1,7 +1,10 @@ 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 diff --git a/distdir/toolkit b/distdir/toolkit index 180ab29a..de5af055 100644 --- a/distdir/toolkit +++ b/distdir/toolkit @@ -1,13 +1,18 @@ 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 diff --git a/doc/Makefile.ad b/doc/Makefile.ad index f6c1b5f3..85e313cd 100644 --- a/doc/Makefile.ad +++ b/doc/Makefile.ad @@ -74,7 +74,6 @@ dist-hook: #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 diff --git a/includes/silcincludes.h.in b/includes/silcincludes.h.in index 8e57209f..23e8f340 100644 --- a/includes/silcincludes.h.in +++ b/includes/silcincludes.h.in @@ -295,9 +295,11 @@ extern "C" { #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 } diff --git a/lib/Makefile.ad b/lib/Makefile.ad index 5e12f56b..c662a01b 100644 --- a/lib/Makefile.ad +++ b/lib/Makefile.ad @@ -28,9 +28,11 @@ SILCLIB_DIRS = \ #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 @@ -106,6 +108,6 @@ libsilcclient.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 diff --git a/lib/configure.ad b/lib/configure.ad index 9433d0b1..ff9e2a3c 100644 --- a/lib/configure.ad +++ b/lib/configure.ad @@ -33,9 +33,11 @@ SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcmath" 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 @@ -49,7 +51,7 @@ SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcclient" # 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 @@ -66,14 +68,14 @@ SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcclient" 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) @@ -84,9 +86,7 @@ AC_SUBST(LIBSILCCLIENT_CURRENT) 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) @@ -105,6 +105,7 @@ AC_ARG_ENABLE(stack-trace, ], AC_MSG_RESULT(no) ) +#endif SILC_DIST_TOOLKIT # # Makefile outputs @@ -127,7 +128,9 @@ lib/silcutil/epoc/Makefile #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 diff --git a/lib/doc/LIBINDEX b/lib/doc/LIBINDEX index 3cdac009..b12935e1 100644 --- a/lib/doc/LIBINDEX +++ b/lib/doc/LIBINDEX @@ -7,7 +7,7 @@
Version: @VERSION@
-Copyright © 1997 - 2004 The SILC Project
+Copyright © 1997 - 2005 The SILC Project
Updated: @DATE@



diff --git a/lib/silcclient/client.c b/lib/silcclient/client.c index d4546038..61191981 100644 --- a/lib/silcclient/client.c +++ b/lib/silcclient/client.c @@ -254,11 +254,11 @@ silc_client_add_connection(SilcClient client, 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(); diff --git a/lib/silcclient/client_attrs.c b/lib/silcclient/client_attrs.c index fc0821da..eaf0a233 100644 --- a/lib/silcclient/client_attrs.c +++ b/lib/silcclient/client_attrs.c @@ -218,10 +218,10 @@ bool silc_client_attribute_del(SilcClient client, /* 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) diff --git a/lib/silcclient/silcclient.h b/lib/silcclient/silcclient.h index a8193896..d68d6a6f 100644 --- a/lib/silcclient/silcclient.h +++ b/lib/silcclient/silcclient.h @@ -2800,8 +2800,8 @@ bool silc_client_attribute_del(SilcClient client, * 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 * diff --git a/lib/silccore/silcidcache.c b/lib/silccore/silcidcache.c index da86f743..62fb5af0 100644 --- a/lib/silccore/silcidcache.c +++ b/lib/silccore/silcidcache.c @@ -67,6 +67,7 @@ struct SilcIDCacheStruct { SilcHashTable name_table; SilcHashTable context_table; SilcIDCacheDestructor destructor; + void *context; SilcIdType type; unsigned int delete_id : 1; unsigned int delete_name : 1; @@ -102,6 +103,7 @@ struct SilcIDCacheListStruct { SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type, SilcIDCacheDestructor destructor, + void *destructor_context, bool delete_id, bool delete_name) { SilcIDCache cache; @@ -123,6 +125,7 @@ SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type, 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; @@ -344,7 +347,7 @@ static void silc_idcache_purge_foreach(void *key, void *context, 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); @@ -385,7 +388,7 @@ bool silc_idcache_purge_by_context(SilcIDCache cache, void *context) 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); diff --git a/lib/silccore/silcidcache.h b/lib/silccore/silcidcache.h index 69c5290f..b5612d39 100644 --- a/lib/silccore/silcidcache.h +++ b/lib/silccore/silcidcache.h @@ -111,7 +111,8 @@ typedef struct SilcIDCacheListStruct *SilcIDCacheList; * SYNOPSIS * * typedef void (*SilcIDCacheDestructor)(SilcIDCache cache, - * SilcIDCacheEntry entry); + * SilcIDCacheEntry entry, + * void *context); * * DESCRIPTION * @@ -122,7 +123,8 @@ typedef struct SilcIDCacheListStruct *SilcIDCacheList; * ***/ 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) @@ -134,7 +136,9 @@ typedef void (*SilcIDCacheDestructor)(SilcIDCache cache, * SYNOPSIS * * SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type, - * SilcIDCacheDestructor destructor); + * SilcIDCacheDestructor destructor, + * void *destructor_context, + * bool delete_id, bool delete_name); * * DESCRIPTION * @@ -150,6 +154,7 @@ typedef void (*SilcIDCacheDestructor)(SilcIDCache cache, ***/ 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 diff --git a/lib/silccore/silcmessage.c b/lib/silccore/silcmessage.c index 2876ab56..32ab2e83 100644 --- a/lib/silccore/silcmessage.c +++ b/lib/silccore/silcmessage.c @@ -423,10 +423,10 @@ unsigned char *silc_message_get_iv(SilcMessagePayload payload) /* Return signature of the message */ -const SilcMessageSignedPayload +SilcMessageSignedPayload silc_message_get_signature(SilcMessagePayload payload) { - return (const SilcMessageSignedPayload)payload->sig; + return payload->sig; } /****************************************************************************** diff --git a/lib/silccore/silcmessage.h b/lib/silccore/silcmessage.h index ff139dec..32e40c93 100644 --- a/lib/silccore/silcmessage.h +++ b/lib/silccore/silcmessage.h @@ -343,7 +343,7 @@ unsigned char *silc_message_get_iv(SilcMessagePayload payload); * * SYNOPSIS * - * const SilcMessageSignedPayload + * SilcMessageSignedPayload * silc_message_get_signature(SilcMessagePayload payload); * * DESCRIPTION @@ -354,10 +354,11 @@ unsigned char *silc_message_get_iv(SilcMessagePayload payload); * 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 diff --git a/lib/silcutil/silcapputil.c b/lib/silcutil/silcapputil.c index a79ee597..415d591f 100644 --- a/lib/silcutil/silcapputil.c +++ b/lib/silcutil/silcapputil.c @@ -1,10 +1,10 @@ /* - silcapputil.c + silcapputil.c Author: Pekka Riikonen - 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 @@ -25,7 +25,7 @@ static char *silc_create_pk_identifier(void) char *username = NULL, *realname = NULL; char *hostname, email[256]; char *ident; - + /* Get realname */ realname = silc_get_real_name(); @@ -89,7 +89,7 @@ New pair of keys will be created. Please, answer to following questions.\n\ 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); @@ -347,8 +347,8 @@ bool silc_show_public_key(const char *pub_filename) 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); diff --git a/scripts/silcdoc/gen_index.php b/scripts/silcdoc/gen_index.php index 28ddeed9..a263d059 100644 --- a/scripts/silcdoc/gen_index.php +++ b/scripts/silcdoc/gen_index.php @@ -44,7 +44,7 @@ -
Copyright © 2001 - 2002 SILC Project
+
Copyright © 2001 - 2005 SILC Project
SILC Project Website
SILC Toolkit Reference Manual
@@ -122,7 +122,7 @@ if ($type == 0) {
-
Copyright © 2001 - 2002 SILC Project
+
Copyright © 2001 - 2005 SILC Project
SILC Project Website
SILC Toolkit Reference Manual
diff --git a/scripts/silcdoc/silcdoc b/scripts/silcdoc/silcdoc index 57bb9400..9f7bffce 100755 --- a/scripts/silcdoc/silcdoc +++ b/scripts/silcdoc/silcdoc @@ -196,7 +196,7 @@ if [ "$TYPE" = "HTML" ]; then # 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 diff --git a/util/robodoc/Source/config.h b/util/robodoc/Source/config.h deleted file mode 100644 index 63046640..00000000 --- a/util/robodoc/Source/config.h +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 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" - diff --git a/win32/libsilc/libsilc.def b/win32/libsilc/libsilc.def index 64626089..e47325b0 100644 --- a/win32/libsilc/libsilc.def +++ b/win32/libsilc/libsilc.def @@ -598,3 +598,5 @@ EXPORTS silc_stringprep @ 923; silc_identifier_check @ 924 ; silc_identifier_verify @ 925 ; + silc_channel_name_check @ 926 ; + silc_channel_name_verify @ 927 ; -- 2.24.0