-lib_LTLIBRARIES = libstrongswan.la
+lib_LTLIBRARIES = libstrongswan.la libstrongswan-lite.la
if USE_INTEGRITY_TEST
libstrongswan_la_SOURCES = \
libstrongswan_la_LIBADD = -lpthread -ldl
+libstrongswan_lite_la_SOURCES = \
+chunk.c chunk.h \
+debug.c debug.h \
+asn1/oid.c asn1/oid.h \
+printf_hook.c printf_hook.h \
+settings.c settings.h \
+utils.c utils.h \
+utils/enumerator.c utils/enumerator.h \
+utils/linked_list.c utils/linked_list.h
+
INCLUDES = -I$(top_srcdir)/src/libstrongswan
AM_CFLAGS = -DIPSEC_DIR=\"${ipsecdir}\" \
-DIPSEC_PLUGINDIR=\"${plugindir}\"
if USE_LEAK_DETECTIVE
AM_CFLAGS += -DLEAK_DETECTIVE
- libstrongswan_la_SOURCES += utils/leak_detective.c utils/leak_detective.h
+ libstrongswan_la_SOURCES += \
+ utils/leak_detective.c utils/leak_detective.h
+ libstrongswan_lite_la_SOURCES += \
+ utils/leak_detective.c utils/leak_detective.h \
+ utils/backtrace.c utils/backtrace.h
endif
if USE_LOCK_PROFILER
-DPLUTO -DKLIPS -DDEBUG
pluto_LDADD = \
-oid.o debug.o linked_list.o enumerator.o settings.o utils.o chunk.o \
+$(LIBSTRONGSWANDIR)/libstrongswan-lite.la \
$(LIBFREESWANDIR)/libfreeswan.a \
$(LIBCRYPTODIR)/libcrypto.a \
-lgmp -lresolv -lpthread -ldl
-if USE_LEAK_DETECTIVE
- AM_CFLAGS += -DLEAK_DETECTIVE
- pluto_LDADD += backtrace.o leak_detective.o
-endif
-
_pluto_adns_LDADD = \
$(LIBFREESWANDIR)/libfreeswan.a \
-lresolv -ldl
dist_man_MANS = pluto.8 ipsec.secrets.5
-# Copy functions from libstrongswan
-oid.o : $(LIBSTRONGSWANDIR)/asn1/oid.c $(LIBSTRONGSWANDIR)/asn1/oid.h
- $(COMPILE) -c -o $@ $<
-
-debug.o : $(LIBSTRONGSWANDIR)/debug.c $(LIBSTRONGSWANDIR)/debug.h
- $(COMPILE) -c -o $@ $<
-
-backtrace.o : $(LIBSTRONGSWANDIR)/utils/backtrace.c $(LIBSTRONGSWANDIR)/utils/backtrace.h
- $(COMPILE) -c -o $@ $<
-
-leak_detective.o : $(LIBSTRONGSWANDIR)/utils/leak_detective.c $(LIBSTRONGSWANDIR)/utils/leak_detective.h
- $(COMPILE) -c -o $@ $<
-
-linked_list.o : $(LIBSTRONGSWANDIR)/utils/linked_list.c $(LIBSTRONGSWANDIR)/utils/linked_list.h
- $(COMPILE) -c -o $@ $<
-
-enumerator.o : $(LIBSTRONGSWANDIR)/utils/enumerator.c $(LIBSTRONGSWANDIR)/utils/enumerator.h
- $(COMPILE) -c -o $@ $<
-
-settings.o : $(LIBSTRONGSWANDIR)/settings.c $(LIBSTRONGSWANDIR)/settings.h
- $(COMPILE) -c -o $@ $<
-
-utils.o : $(LIBSTRONGSWANDIR)/utils.c $(LIBSTRONGSWANDIR)/utils.h
- $(COMPILE) -c -o $@ $<
-
-chunk.o : $(LIBSTRONGSWANDIR)/chunk.c $(LIBSTRONGSWANDIR)/chunk.h
- $(COMPILE) -c -o $@ $<
+# This compile option activates the memory leak detective
+if USE_LEAK_DETECTIVE
+ AM_CFLAGS += -DLEAK_DETECTIVE
+endif
# This compile option activates the sending of a strongSwan VID
if USE_VENDORID
time(¤t_time);
DBG(DBG_CONTROL | DBG_PARSING,
- DBG_log(" not before : %s", timetoa(&ac->notBefore, TRUE));
- DBG_log(" current time: %s", timetoa(¤t_time, TRUE));
- DBG_log(" not after : %s", timetoa(&ac->notAfter, TRUE));
+ DBG_log(" not before : %T", &ac->notBefore, TRUE);
+ DBG_log(" current time: %T", ¤t_time, TRUE);
+ DBG_log(" not after : %T", &ac->notAfter, TRUE);
)
if (current_time < ac->notBefore)
{
u_char buf[BUF_LEN];
- whack_log(RC_COMMENT, "%s",timetoa(&ac->installed, utc));
+ whack_log(RC_COMMENT, "%T", &ac->installed, utc);
if (ac->entityName.ptr != NULL)
{
dntoa(buf, BUF_LEN, ac->entityName);
datatot(ac->serialNumber.ptr, ac->serialNumber.len, ':'
, buf, BUF_LEN);
whack_log(RC_COMMENT, " serial: %s", buf);
- whack_log(RC_COMMENT, " validity: not before %s %s",
- timetoa(&ac->notBefore, utc),
+ whack_log(RC_COMMENT, " validity: not before %T %s",
+ &ac->notBefore, utc,
(ac->notBefore < now)?"ok":"fatal (not valid yet)");
- whack_log(RC_COMMENT, " not after %s %s",
- timetoa(&ac->notAfter, utc),
+ whack_log(RC_COMMENT, " not after %T %s",
+ &ac->notAfter, utc,
check_expiry(ac->notAfter, ACERT_WARNING_INTERVAL, TRUE));
if (ac->authKeyID.ptr != NULL)
{
{
ietfAttr_t *attr = list->attr;
- whack_log(RC_COMMENT, "%s, count: %d", timetoa(&attr->installed, utc),
- attr->count);
+ whack_log(RC_COMMENT, "%T, count: %d", &attr->installed, utc, attr->count);
switch (attr->kind)
{
case ASN1_GENERALIZEDTIME:
DBG(DBG_PARSING,
time_t time = asn1totime(&object, type);
- DBG_log(" '%s'", timetoa(&time, TRUE));
+ DBG_log(" '%T'", &time, TRUE);
)
return;
default:
/* strictpolicy per CA not supported yet
*
- whack_log(RC_COMMENT, "%s, \"%s\", strictcrlpolicy: %s"
- , timetoa(&ca->installed, utc), ca->name
+ whack_log(RC_COMMENT, "%T, \"%s\", strictcrlpolicy: %s"
+ , &ca->installed, utc, ca->name
, ca->strictcrlpolicy? "yes":"no");
*/
- whack_log(RC_COMMENT, "%s, \"%s\"", timetoa(&ca->installed, utc), ca->name);
+ whack_log(RC_COMMENT, "%T, \"%s\"", &ca->installed, utc, ca->name);
dntoa(buf, BUF_LEN, ca->authName);
whack_log(RC_COMMENT, " authname: '%s'", buf);
if (ca->ldaphost != NULL)
{
fetch_req_t *req;
- plog("crl update is overdue since %s"
- , timetoa(until, TRUE));
+ plog("crl update is overdue since %T", until, TRUE);
/* try to fetch a crl update */
req = build_crl_fetch_request(crl->issuer
revokedCert = revokedCert->next;
}
- whack_log(RC_COMMENT, "%s, revoked certs: %d",
- timetoa(&crl->installed, utc), revoked);
+ whack_log(RC_COMMENT, "%T, revoked certs: %d",
+ &crl->installed, utc, revoked);
dntoa(buf, BUF_LEN, crl->issuer);
whack_log(RC_COMMENT, " issuer: '%s'", buf);
if (crl->crlNumber.ptr != NULL)
}
list_distribution_points(crl->distributionPoints);
- whack_log(RC_COMMENT, " updates: this %s",
- timetoa(&crl->thisUpdate, utc));
- whack_log(RC_COMMENT, " next %s %s",
- timetoa(&crl->nextUpdate, utc),
+ whack_log(RC_COMMENT, " updates: this %T",
+ &crl->thisUpdate, utc);
+ whack_log(RC_COMMENT, " next %T %s",
+ &crl->nextUpdate, utc,
check_expiry(crl->nextUpdate, CRL_WARNING_INTERVAL, strict));
if (crl->authKeyID.ptr != NULL)
{
}
}
-/* Names of the months */
-
-static const char* months[] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-
-
-/*
- * Display a date either in local or UTC time
- */
-char*
-timetoa(const time_t *time, bool utc)
-{
- static char buf[TIMETOA_BUF];
-
- if (*time == UNDEFINED_TIME)
- sprintf(buf, "--- -- --:--:--%s----", (utc)?" UTC ":" ");
- else
- {
- struct tm *t = (utc)? gmtime(time) : localtime(time);
-
- sprintf(buf, "%s %02d %02d:%02d:%02d%s%04d",
- months[t->tm_mon], t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec,
- (utc)?" UTC ":" ", t->tm_year + 1900
- );
- }
- return buf;
-}
-
/* checks if the expiration date has been reached and
* warns during the warning_interval of the imminent
* expiry. strict=TRUE declares a fatal error,
extern bool write_chunk(const char *filename, const char *label, chunk_t ch
,mode_t mask, bool force);
-/* display a date either in local or UTC time */
-extern char* timetoa(const time_t *time, bool utc);
-
/* warns a predefined interval before expiry */
extern const char* check_expiry(time_t expiration_date,
int warning_interval, bool strict);
{
u_char buf[BUF_LEN];
- whack_log(RC_COMMENT, "%s, trials: %d"
- , timetoa(&req->installed, utc), req->trials);
+ whack_log(RC_COMMENT, "%T, trials: %d"
+ , &req->installed, utc, req->trials);
dntoa(buf, BUF_LEN, req->issuer);
whack_log(RC_COMMENT, " issuer: '%s'", buf);
if (req->authKeyID.ptr != NULL)
if (!kernel_ops->get_policy(&sa, inbound, use_time))
return FALSE;
DBG(DBG_KLIPS,
- DBG_log(" use_time: %s", timetoa(use_time, FALSE))
+ DBG_log(" use_time: %T", use_time, FALSE)
)
}
return TRUE;
if (key->alg == PUBKEY_ALG_RSA)
{
char buf[BUF_LEN];
- char expires_buf[TIMETOA_BUF];
idtoa(&key->id, buf, BUF_LEN);
- strcpy(expires_buf, timetoa(&key->until_time, utc));
- whack_log(RC_COMMENT, "%s, %4d RSA Key %s, until %s %s",
-
- timetoa(&key->installed_time, utc), 8*key->u.rsa.k, key->u.rsa.keyid,
- expires_buf,
+ whack_log(RC_COMMENT, "%T, %4d RSA Key %s, until %T %s",
+ &key->installed_time, utc,
+ 8*key->u.rsa.k, key->u.rsa.keyid,
+ &key->until_time, utc,
check_expiry(key->until_time, PUBKEY_WARNING_INTERVAL, TRUE));
whack_log(RC_COMMENT," %s '%s'",
enum_show(&ident_names, key->id.kind), buf);
#include <stdlib.h>
#include <utils.h>
+#include <chunk.h>
#ifdef LEAK_DETECTIVE
#include <utils/leak_detective.h>
#endif
private_library_t *this = (private_library_t*)lib;
this->public.settings->destroy(this->public.settings);
+ this->public.printf_hook->destroy(this->public.printf_hook);
#ifdef LEAK_DETECTIVE
if (this->detective)
*/
void library_init(char *settings)
{
+ printf_hook_t *pfh;
private_library_t *this = malloc_thing(private_library_t);
lib = &this->public;
this->detective = leak_detective_create();
#endif /* LEAK_DETECTIVE */
+ pfh = printf_hook_create();
+ this->public.printf_hook = pfh;
+
+ pfh->add_handler(pfh, 'b', mem_printf_hook,
+ PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
+ PRINTF_HOOK_ARGTYPE_END);
+ pfh->add_handler(pfh, 'B', chunk_printf_hook,
+ PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_END);
+ pfh->add_handler(pfh, 'T', time_printf_hook,
+ PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
+ PRINTF_HOOK_ARGTYPE_END);
+ pfh->add_handler(pfh, 'V', time_delta_printf_hook,
+ PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_POINTER,
+ PRINTF_HOOK_ARGTYPE_END);
+
this->public.settings = settings_create(settings);
}
* Libstrongswan library context, contains library relevant globals.
*/
struct library_t {
+
+ /**
+ * Printf hook registering facility
+ */
+ printf_hook_t *printf_hook;
+
/**
* various settings loaded from settings file
*/
{
char thisUpdate[TIMETOA_BUF];
- strcpy(thisUpdate, timetoa(&certinfo->thisUpdate, utc));
+ snprintf(thisUpdate, TIMETOA_BUF, "%T", &certinfo->thisUpdate, utc);
if (requests)
{
}
else
{
- whack_log(RC_COMMENT, "%s, until %s %s", thisUpdate
- , timetoa(&certinfo->nextUpdate, utc)
+ whack_log(RC_COMMENT, "%s, until %T %s", thisUpdate
+ , &certinfo->nextUpdate, utc
, check_expiry(certinfo->nextUpdate, OCSP_WARNING_INTERVAL, strict));
}
datatot(certinfo->serialNumber.ptr, certinfo->serialNumber.len, ':'
cert->created = (time_t)pgp_size(packet, 4);
DBG(DBG_PARSING,
DBG_log("L3 - created:");
- DBG_log(" %s", timetoa(&cert->created, TRUE))
+ DBG_log(" %T", &cert->created, TRUE)
)
if (version == 3)
DBG(DBG_PARSING,
DBG_log("L3 - until:");
- DBG_log(" %s", timetoa(&cert->until, TRUE));
+ DBG_log(" %T", &cert->until, TRUE);
)
}
created = (time_t)pgp_size(packet, 4);
DBG(DBG_PARSING,
DBG_log("L3 - created:");
- DBG_log(" %s", timetoa(&cert->created, TRUE))
+ DBG_log(" %T", &cert->created, TRUE)
)
/* key ID of signer - 8 bytes */
c.type = CERT_PGP;
c.u.pgp = cert;
- whack_log(RC_COMMENT, "%s, count: %d", timetoa(&cert->installed, utc), cert->count);
+ whack_log(RC_COMMENT, "%T, count: %d", &cert->installed, utc), cert->count;
datatot(cert->fingerprint, PGP_FINGERPRINT_SIZE, 'x', buf, BUF_LEN);
whack_log(RC_COMMENT, " fingerprint: %s", buf);
form_keyid(cert->publicExponent, cert->modulus, buf, &keysize);
whack_log(RC_COMMENT, " pubkey: %4d RSA Key %s%s", 8*keysize, buf,
(has_private_key(c))? ", has private key" : "");
- whack_log(RC_COMMENT, " created: %s", timetoa(&cert->created, utc));
- whack_log(RC_COMMENT, " until: %s %s", timetoa(&cert->until, utc),
+ whack_log(RC_COMMENT, " created: %T", &cert->created, utc);
+ whack_log(RC_COMMENT, " until: %T %s", &cert->until, utc,
check_expiry(cert->until, CA_CERT_WARNING_INTERVAL, TRUE));
cert = cert->next;
}
/* Pluto main program
* Copyright (C) 1997 Angelos D. Keromytis.
* Copyright (C) 1998-2001 D. Hugh Redelmeier.
+ * Copyright (C) 2009 Andreas Steffen
*
* 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
#include <stdio.h>
#include <stdlib.h>
+#include <syslog.h>
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <freeswan.h>
#include <library.h>
+#include <debug.h>
#include <pfkeyv2.h>
#include <pfkey.h>
return ok;
}
-static void
-delete_lock(void)
+static void delete_lock(void)
{
if (pluto_lock_created)
{
}
}
+static int debug_level = 1;
+
+/**
+ * pluto dbg function
+ */
+static void pluto_dbg(int level, char *fmt, ...)
+{
+ int priority = LOG_INFO;
+ char buffer[8192];
+ char *current = buffer, *next;
+ va_list args;
+
+ if (level <= debug_level)
+ {
+ va_start(args, fmt);
+
+ if (log_to_stderr)
+ {
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+ }
+ if (log_to_syslog)
+ {
+ /* write in memory buffer first */
+ vsnprintf(buffer, sizeof(buffer), fmt, args);
+
+ /* do a syslog with every line */
+ while (current)
+ {
+ next = strchr(current, '\n');
+ if (next)
+ {
+ *(next++) = '\0';
+ }
+ syslog(priority, "%s\n", current);
+ current = next;
+ }
+ }
+ va_end(args);
+ }
+}
+
/* by default pluto sends certificate requests to its peers */
bool no_cr_send = FALSE;
/* select between logging methods */
if (log_to_stderr_desired)
+ {
log_to_syslog = FALSE;
+ }
else
+ {
log_to_stderr = FALSE;
+ }
/* set the logging function of pfkey debugging */
#ifdef DEBUG
abort();
}
+ /* enable pluto debugging hook */
+ dbg = pluto_dbg;
+
init_constants();
init_log("pluto");
while (sc != NULL)
{
- whack_log(RC_COMMENT, "%s, #%d, count: %d"
- , timetoa(&sc->last_load, utc)
+ whack_log(RC_COMMENT, "%T, #%d, count: %d"
+ , &sc->last_load, utc
, sc->number
, sc->count);
whack_log(RC_COMMENT, " %s, session %s, logged %s, has %s"
time(¤t_time);
DBG(DBG_CONTROL | DBG_PARSING ,
- DBG_log(" not before : %s", timetoa(&cert->notBefore, TRUE));
- DBG_log(" current time: %s", timetoa(¤t_time, TRUE));
- DBG_log(" not after : %s", timetoa(&cert->notAfter, TRUE));
+ DBG_log(" not before : %T", &cert->notBefore, TRUE);
+ DBG_log(" current time: %T", ¤t_time, TRUE);
+ DBG_log(" not after : %T", &cert->notAfter, TRUE);
)
if (cert->notAfter < *until)
}
break;
case CERT_REVOKED:
- plog("certificate was revoked on %s, reason: %s"
- , timetoa(&revocationDate, TRUE)
+ plog("certificate was revoked on %T, reason: %s"
+ , &revocationDate, TRUE
, enum_name(&crl_reason_names, revocationReason));
remove_x509_public_key(cert);
return FALSE;
first = FALSE;
}
- whack_log(RC_COMMENT, "%s, count: %d", timetoa(&cert->installed, utc),
+ whack_log(RC_COMMENT, "%T, count: %d", &cert->installed, utc,
cert->count);
dntoa(buf, BUF_LEN, cert->subject);
whack_log(RC_COMMENT, " subject: '%s'", buf);
, 8*keysize, keyid
, cert->smartcard ? ", on smartcard" :
(has_private_key(c)? ", has private key" : ""));
- whack_log(RC_COMMENT, " validity: not before %s %s",
- timetoa(&cert->notBefore, utc),
+ whack_log(RC_COMMENT, " validity: not before %T %s",
+ &cert->notBefore, utc,
(cert->notBefore < now)?"ok":"fatal (not valid yet)");
- whack_log(RC_COMMENT, " not after %s %s",
- timetoa(&cert->notAfter, utc),
+ whack_log(RC_COMMENT, " not after %T %s",
+ &cert->notAfter, utc,
check_expiry(cert->notAfter, CA_CERT_WARNING_INTERVAL, TRUE));
if (cert->subjectKeyID.ptr != NULL)
{
-I$(LIBCRYPTODIR) \
-I$(WHACKDIR)
-AM_CFLAGS = -DDEBUG -DNO_PLUTO -DIPSEC_CONFDIR=\"${confdir}\"
+AM_CFLAGS = \
+-DIPSEC_CONFDIR=\"${confdir}\" \
+-DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
+-DDEBUG -DNO_PLUTO
LIBFREESWANBUILDDIR=$(top_builddir)/src/libfreeswan
LIBCRYPTOBUILDDIR=$(top_builddir)/src/libcrypto
-scepclient_LDADD = debug.o utils.o chunk.o \
- asn1.o ca.o crl.o certs.o constants.o defs.o fetch.o id.o \
- keys.o lex.o md2.o md5.o mp_defs.o ocsp.o oid.o pem.o pgp.o \
- pkcs1.o pkcs7.o rnd.o sha1.o smartcard.o x509.o \
- $(LIBFREESWANBUILDDIR)/libfreeswan.a $(LIBCRYPTOBUILDDIR)/libcrypto.a \
- -lgmp
+scepclient_LDADD = \
+asn1.o ca.o crl.o certs.o constants.o defs.o fetch.o id.o keys.o \
+lex.o library.o md2.o md5.o mp_defs.o ocsp.o pem.o pgp.o pkcs1.o \
+pkcs7.o rnd.o sha1.o smartcard.o x509.o \
+$(LIBSTRONGSWANDIR)/libstrongswan-lite.la \
+$(LIBFREESWANBUILDDIR)/libfreeswan.a \
+$(LIBCRYPTOBUILDDIR)/libcrypto.a \
+-lgmp
+
+# This compile option activates the memory leak detective
+if USE_LEAK_DETECTIVE
+ AM_CFLAGS += -DLEAK_DETECTIVE
+endif
# This compile option activates smartcard support
if USE_SMARTCARD
dist_man_MANS = scepclient.8
-debug.o : $(LIBSTRONGSWANDIR)/debug.c $(LIBSTRONGSWANDIR)/debug.h
- $(COMPILE) -c -o $@ $<
-
-utils.o : $(LIBSTRONGSWANDIR)/utils.c $(LIBSTRONGSWANDIR)/utils.h
- $(COMPILE) -c -o $@ $<
-
-chunk.o : $(LIBSTRONGSWANDIR)/chunk.c $(LIBSTRONGSWANDIR)/chunk.h
- $(COMPILE) -c -o $@ $<
-
asn1.o : $(PLUTODIR)/asn1.c $(PLUTODIR)/asn1.h
$(COMPILE) $(INCLUDES) -c -o $@ $<
lex.o : $(PLUTODIR)/lex.c $(PLUTODIR)/lex.h
$(COMPILE) $(INCLUDES) -c -o $@ $<
+library.o : $(PLUTODIR)/library.c $(PLUTODIR)/library.h
+ $(COMPILE) $(INCLUDES) -c -o $@ $<
+
md2.o : $(PLUTODIR)/md2.c $(PLUTODIR)/md2.h
$(COMPILE) $(INCLUDES) -c -o $@ $<
ocsp.o : $(PLUTODIR)/ocsp.c $(PLUTODIR)/ocsp.h
$(COMPILE) $(INCLUDES) -c -o $@ $<
-oid.o : $(LIBSTRONGSWANDIR)/asn1/oid.c $(LIBSTRONGSWANDIR)/asn1/oid.h
- $(COMPILE) -c -o $@ $<
-
pem.o : $(PLUTODIR)/pem.c $(PLUTODIR)/pem.h
$(COMPILE) $(INCLUDES) -c -o $@ $<
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <syslog.h>
#include <string.h>
#include <getopt.h>
#include <ctype.h>
#include <gmp.h>
#include <freeswan.h>
+#include <library.h>
+#include <debug.h>
#include <asn1/oid.h>
#include "../pluto/constants.h"
free_x509cert(x509_ca_enc);
free_x509cert(x509_ca_sig);
pkcs10_free(pkcs10);
+ library_deinit();
close_log();
/* print any error message to stderr */
exit_scepclient(message);
}
+static int debug_level = 1;
+
+/**
+ * @brief scepclient dbg function
+ */
+static void scepclient_dbg(int level, char *fmt, ...)
+{
+ int priority = LOG_INFO;
+ char buffer[8192];
+ char *current = buffer, *next;
+ va_list args;
+
+ if (level <= debug_level)
+ {
+ va_start(args, fmt);
+
+ if (log_to_stderr)
+ {
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+ }
+ if (log_to_syslog)
+ {
+ /* write in memory buffer first */
+ vsnprintf(buffer, sizeof(buffer), fmt, args);
+
+ /* do a syslog with every line */
+ while (current)
+ {
+ next = strchr(current, '\n');
+ if (next)
+ {
+ *(next++) = '\0';
+ }
+ syslog(priority, "%s\n", current);
+ current = next;
+ }
+ }
+ va_end(args);
+ }
+}
/**
* @brief main of scepclient
*
scep_response = chunk_empty;
log_to_stderr = TRUE;
+ library_init(STRONGSWAN_CONF);
+
for (;;)
{
static const struct option long_opts[] = {
break;
}
+ /* enable scepclient bugging hook */
+ dbg = scepclient_dbg;
+
init_log("scepclient");
cur_debugging = base_debugging;
init_rnd_pool();