summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-04-15 14:48:24 -0400
committerSimo Sorce <simo@redhat.com>2012-04-15 15:00:50 -0400
commit06fed0b0f3e2d1c0f1dfc548ce6f92d87a37a0a0 (patch)
treecdd7cc3acfe0abaafa265e01e21308503490b99c
parent2263252b3a38fda76fd555e367b5fc3d055a9cf7 (diff)
downloadgss-proxy-06fed0b0f3e2d1c0f1dfc548ce6f92d87a37a0a0.tar.gz
gss-proxy-06fed0b0f3e2d1c0f1dfc548ce6f92d87a37a0a0.tar.xz
gss-proxy-06fed0b0f3e2d1c0f1dfc548ce6f92d87a37a0a0.zip
Add logging helpers
-rw-r--r--proxy/Makefile.am1
-rw-r--r--proxy/src/gp_common.h1
-rw-r--r--proxy/src/gp_init.c5
-rw-r--r--proxy/src/gp_log.c33
-rw-r--r--proxy/src/gp_log.h36
5 files changed, 72 insertions, 4 deletions
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index 6f34402..038d234 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -109,6 +109,7 @@ gssproxy_SOURCES = \
src/gp_conv.c \
src/gp_export.c \
src/gp_debug.c \
+ src/gp_log.c \
src/gp_rpc_accept_sec_context.c \
src/gp_rpc_release_handle.c \
src/gp_rpc_acquire_cred.c \
diff --git a/proxy/src/gp_common.h b/proxy/src/gp_common.h
index 89c7827..981eb75 100644
--- a/proxy/src/gp_common.h
+++ b/proxy/src/gp_common.h
@@ -27,6 +27,7 @@
#define _GP_COMMON_H_
#include "gp_debug.h"
+#include "gp_log.h"
/* add element to list head */
#define LIST_ADD(list, elem) do { \
diff --git a/proxy/src/gp_init.c b/proxy/src/gp_init.c
index 6c9c5ef..a4a488f 100644
--- a/proxy/src/gp_init.c
+++ b/proxy/src/gp_init.c
@@ -27,7 +27,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <locale.h>
-#include <syslog.h>
#include <signal.h>
#include "gp_proxy.h"
@@ -66,9 +65,7 @@ void init_server(bool daemonize)
/* Set up neutral locale */
setlocale(LC_ALL, "");
- openlog("gssproxy",
- LOG_CONS|LOG_NDELAY|LOG_NOWAIT|LOG_PERROR|LOG_PID,
- LOG_AUTHPRIV);
+ gp_logging_init();
}
void fini_server(void)
diff --git a/proxy/src/gp_log.c b/proxy/src/gp_log.c
new file mode 100644
index 0000000..31006f6
--- /dev/null
+++ b/proxy/src/gp_log.c
@@ -0,0 +1,33 @@
+/*
+ GSS-PROXY
+
+ Copyright (C) 2012 Red Hat, Inc.
+ Copyright (C) 2012 Simo Sorce <simo.sorce@redhat.com>
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#include "gp_log.h"
+
+void gp_logging_init(void)
+{
+ openlog("gssproxy",
+ LOG_CONS|LOG_NDELAY|LOG_NOWAIT|LOG_PERROR|LOG_PID,
+ LOG_AUTHPRIV);
+}
diff --git a/proxy/src/gp_log.h b/proxy/src/gp_log.h
new file mode 100644
index 0000000..f3549d1
--- /dev/null
+++ b/proxy/src/gp_log.h
@@ -0,0 +1,36 @@
+/*
+ GSS-PROXY
+
+ Copyright (C) 2012 Red Hat, Inc.
+ Copyright (C) 2012 Simo Sorce <simo.sorce@redhat.com>
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef _GP_LOG_H_
+#define _GP_LOG_H_
+
+#include <syslog.h>
+
+#define GPERROR(...) syslog(LOG_ERR, __VA_ARGS__);
+#define GPAUDIT(...) syslog(LOG_INFO, __VA_ARGS__);
+
+void gp_logging_init(void);
+
+#endif /* _GP_LOG_H_ */