From c9fc9c9242a1faa7786d4fece363baac2176baa0 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Thu, 18 Apr 2013 17:20:47 +0300 Subject: [PATCH] security: add dummy digest tester --- src/core/Makefile.am | 13 +++++- src/core/sip-sec-digest-tests.c | 97 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 src/core/sip-sec-digest-tests.c diff --git a/src/core/Makefile.am b/src/core/Makefile.am index e3436b1b..39520354 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -165,7 +165,9 @@ libsipe_core_la_SOURCES += sipe-media.h sipe-media.c \ sdpmsg.h sdpmsg.c endif -check_PROGRAMS = sipe_xml_tests +check_PROGRAMS = + +check_PROGRAMS += sipe_xml_tests sipe_xml_tests_SOURCES = sipe-xml-tests.c sipe_xml_tests_CFLAGS = $(libsipe_core_la_CFLAGS) sipe_xml_tests_LDADD = \ @@ -174,6 +176,15 @@ sipe_xml_tests_LDADD = \ $(LIBXML2_LIBS) \ $(GLIB_LIBS) +check_PROGRAMS += sip_sec_digest_tests +sip_sec_digest_tests_SOURCES = sip-sec-digest-tests.c +sip_sec_digest_tests_CFLAGS = $(libsipe_core_la_CFLAGS) +sip_sec_digest_tests_LDADD = \ + libsipe_core_la-sipe-utils.lo \ + libsipe_core_crypto_nss_la-sipe-digest-nss.lo \ + $(NSS_LIBS) \ + $(GLIB_LIBS) + # disables "caching" of memory blocks in tests TESTS_ENVIRONMENT = G_SLICE="always-malloc" TESTS = $(check_PROGRAMS) diff --git a/src/core/sip-sec-digest-tests.c b/src/core/sip-sec-digest-tests.c new file mode 100644 index 00000000..f8d3b762 --- /dev/null +++ b/src/core/sip-sec-digest-tests.c @@ -0,0 +1,97 @@ +/** + * @file sip-sec-digest-test.c + * + * pidgin-sipe + * + * Copyright (C) 2013 SIPE Project + * + * + * 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. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include + +#include + +#include "sipe-common.h" +#include "uuid.h" + +#include "sip-sec-digest.c" + +/* + * Stubs + */ +gboolean sipe_backend_debug_enabled(void) +{ + return(TRUE); +} + +void sipe_backend_debug_literal(sipe_debug_level level, + const gchar *msg) +{ + printf("DEBUG(%d): %s\n", level, msg); +} + +void sipe_backend_debug(sipe_debug_level level, + const gchar *format, + ...) +{ + va_list ap; + gchar *newformat = g_strdup_printf("DEBUG(%d): %s\n", level, format); + + va_start(ap, format); + vprintf(newformat, ap); + va_end(ap); + + g_free(newformat); +} + +const gchar *sipe_backend_network_ip_address(SIPE_UNUSED_PARAMETER struct sipe_core_public *sipe_public) +{ + return(NULL); +} + +char *generateUUIDfromEPID(SIPE_UNUSED_PARAMETER const gchar *epid) +{ + return(NULL); +} + +char *sipe_get_epid(SIPE_UNUSED_PARAMETER const char *self_sip_uri, + SIPE_UNUSED_PARAMETER const char *hostname, + SIPE_UNUSED_PARAMETER const char *ip_address) +{ + return(NULL); +} + +/* + * Tester code + */ +int main(SIPE_UNUSED_PARAMETER int argc, SIPE_UNUSED_PARAMETER char *argv[]) +{ + guint failed = 0; + + return(failed); +} + +/* + Local Variables: + mode: c + c-file-style: "bsd" + indent-tabs-mode: t + tab-width: 8 + End: +*/ -- 2.11.4.GIT