From 29bede2b1a4758a5fd3b18349a126304222c19da Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Thu, 31 Mar 2005 08:18:09 +0000 Subject: [PATCH] Added __SILC_HAVE_PTHREAD, __SILC_HAVE_SIM, __SILC_HAVE_LIBIDN, and __SILC_ENABLE_DEBUG for third-party software. --- CHANGES | 4 ++++ TODO | 12 ------------ apps/silcd/command.c | 7 +++++++ configure.in.pre | 20 +++++++++++++++++--- includes/silcincludes.h.in | 8 +++++++- 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/CHANGES b/CHANGES index 12b4392e..15befc32 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,10 @@ Thu Mar 31 08:52:06 EEST 2005 Pekka Riikonen server names in client library. Affected files in lib/silcclient/. + * Added __SILC_HAVE_PTHREAD, __SILC_HAVE_SIM, __SILC_HAVE_LIBIDN, + and __SILC_ENABLE_DEBUG to include/silcclient.h for third-party + software to check how Toolkit has been compiled. + Wed Mar 30 22:16:35 EEST 2005 Pekka Riikonen * Added silc_utf8_str[n]casecmp into lib/silcutil/silcutf8.[ch]. diff --git a/TODO b/TODO index 38b51048..32f3a9b8 100644 --- a/TODO +++ b/TODO @@ -43,18 +43,6 @@ TODO for SILC Server 1.0 TODO/bugs In SILC Libraries =========================== - o Stringprep checks to the Client Library. - - o Add following defines in silcincludes.h and silcclient.h for - third-party software: - - __SILC_LIBSILC_HAVE_PTHREAD - __SILC_LIBSILC_HAVE_SIM - __SILC_LIBSILC_ENABLE_DEBUG - __SILC_LIBSILCCLIENT_HAVE_PTHREAD - __SILC_LIBSILCCLIENT_HAVE_SIM - __SILC_LIBSILCCLIENT_ENABLE_DEBUG - o Test cases for all payload encoding and decoding routins in lib/silccore/ o Test cases for math library routines in lib/silcmath/ diff --git a/apps/silcd/command.c b/apps/silcd/command.c index b16e4137..621ce145 100644 --- a/apps/silcd/command.c +++ b/apps/silcd/command.c @@ -994,6 +994,13 @@ SILC_SERVER_CMD_FUNC(topic) goto out; } + if (!silc_utf8_valid(tmp, strlen(tmp))) { + silc_server_command_send_status_reply(cmd, SILC_COMMAND_TOPIC, + SILC_STATUS_ERR_NOT_ENOUGH_PARAMS, + 0); + goto out; + } + /* See whether the client is on channel and has rights to change topic */ if (!silc_server_client_on_channel(client, channel, &chl)) { tmp = silc_argument_get_arg_type(cmd->args, 1, &tmp_len); diff --git a/configure.in.pre b/configure.in.pre index c7a3c1c8..2b11a15b 100644 --- a/configure.in.pre +++ b/configure.in.pre @@ -3,12 +3,11 @@ # # Author: Pekka Riikonen # -# Copyright (C) 2000 - 2004 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; 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 @@ -187,9 +186,11 @@ AC_CHECK_HEADERS(dlfcn.h, ]) ]) +__SILC_HAVE_SIM="" AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue) if test x$sim_support = xtrue; then AC_MSG_RESULT(Enabled SIM support.) + __SILC_HAVE_SIM="#define __SILC_HAVE_SIM 1" else AC_MSG_RESULT(No SIM support found.) fi @@ -276,6 +277,7 @@ fi # AC_MSG_CHECKING(whether to enable debugging) summary_debug="no" +__SILC_ENABLE_DEBUG="" AC_ARG_ENABLE(debug, [ --enable-debug enable debugging], [ @@ -284,6 +286,7 @@ AC_ARG_ENABLE(debug, AC_MSG_RESULT(yes) AC_DEFINE(SILC_DEBUG) summary_debug="yes" + __SILC_ENABLE_DEBUG="#define __SILC_ENABLE_DEBUG 1" ;; *) AC_MSG_RESULT(no) @@ -838,6 +841,10 @@ if test x$check_libidn = xtrue; then done fi +__SILC_HAVE_LIBIDN="" +if test x$has_libidn = xtrue; then + __SILC_HAVE_LIBIDN="#define __SILC_HAVE_LIBIDN 1" +fi # iconv support # @@ -1112,6 +1119,7 @@ else has_threads=false fi +__SILC_HAVE_PTHREAD="" AM_CONDITIONAL(SILC_THREADS, test x$has_threads = xtrue) if test x$has_threads = xtrue; then CFLAGS="$CFLAGS -D_REENTRANT" @@ -1142,6 +1150,7 @@ if test x$has_threads = xtrue; then AC_CHECK_FUNC(pthread_create) AC_DEFINE(SILC_HAVE_PTHREAD) AC_DEFINE(SILC_THREADS) + __SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHEAD 1" fi # Native WIN32 compilation under cygwin @@ -1262,6 +1271,11 @@ AM_CONDITIONAL(SILC_LIBTOOLFIX, test x$libtoolfix = xtrue) # Included configure scripts AD_INCLUDE_CONFIGURE +AC_SUBST(__SILC_HAVE_PTHREAD) +AC_SUBST(__SILC_HAVE_SIM) +AC_SUBST(__SILC_HAVE_LIBIDN) +AC_SUBST(__SILC_ENABLE_DEBUG) + # # Makefile outputs # diff --git a/includes/silcincludes.h.in b/includes/silcincludes.h.in index 9f610300..3bc14ca5 100644 --- a/includes/silcincludes.h.in +++ b/includes/silcincludes.h.in @@ -4,7 +4,7 @@ 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 @@ -71,6 +71,12 @@ extern "C" { #define SILC_SIZEOF_CHAR @SILC_SIZEOF_CHAR@ #define SILC_SIZEOF_VOID_P @SILC_SIZEOF_VOID_P@ +/* Compilation time defines, for third-party software */ +@__SILC_HAVE_PTHREAD@ +@__SILC_HAVE_SIM@ +@__SILC_HAVE_LIBIDN@ +@__SILC_ENABLE_DEBUG@ + #if defined(HAVE_SILCDEFS_H) /* Automatically generated configuration header */ #include "silcdefs.h" -- 2.24.0