diff options
-rw-r--r-- | server/nss/nsssrv.c | 7 | ||||
-rw-r--r-- | server/server.mk | 2 | ||||
-rw-r--r-- | server/util/util.h | 11 |
3 files changed, 16 insertions, 4 deletions
diff --git a/server/nss/nsssrv.c b/server/nss/nsssrv.c index 176da5207..5ade80ec4 100644 --- a/server/nss/nsssrv.c +++ b/server/nss/nsssrv.c @@ -27,6 +27,7 @@ #include <sys/un.h> #include <string.h> #include <sys/time.h> +#include <errno.h> #include "talloc.h" #include "events.h" #include "util/util.h" @@ -167,7 +168,7 @@ static void accept_fd_handler(struct event_context *ev, len = sizeof(cctx->addr); cctx->cfd = accept(nctx->lfd, (struct sockaddr *)&cctx->addr, &len); if (cctx->cfd == -1) { - DEBUG(1, ("Accept failed [%s]", strerror(errno))); + DEBUG(0, ("Accept failed [%s]", strerror(errno))); talloc_free(cctx); return; } @@ -177,11 +178,13 @@ static void accept_fd_handler(struct event_context *ev, if (!cctx->cfde) { close(cctx->cfd); talloc_free(cctx); - DEBUG(1, ("Failed to queue client handler\n")); + DEBUG(0, ("Failed to queue client handler\n")); } talloc_set_destructor(cctx, client_destructor); + DEBUG(2, ("Client connected!\n")); + return; } diff --git a/server/server.mk b/server/server.mk index 3f2a66ba4..89916af19 100644 --- a/server/server.mk +++ b/server/server.mk @@ -1,4 +1,4 @@ -SERVER_OBJ = server.o monitor.o process.o service.o service_task.o util/signal.o util/become_daemon.o nss/nsssrv.o nss/nsssrv_packet.o nss/nsssrv_cmd.o +SERVER_OBJ = server.o monitor.o process.o service.o service_task.o util/debug.o util/signal.o util/become_daemon.o nss/nsssrv.o nss/nsssrv_packet.o nss/nsssrv_cmd.o install:: all ${INSTALLCMD} -d $(DESTDIR)$(sbindir) diff --git a/server/util/util.h b/server/util/util.h index 495e3a241..1ca359303 100644 --- a/server/util/util.h +++ b/server/util/util.h @@ -1,9 +1,18 @@ #ifndef __SSSD_UTIL_H__ #define __SSSD_UTIL_H__ +#include <stdio.h> #include <stdbool.h> -#define DEBUG(level, body) +extern int debug_level; +void debug_fn(const char *format, ...); + +#define DEBUG(level, body) do { \ + if (level <= debug_level) { \ + debug_fn("%s[%s]: ", __location__, __FUNCTION__); \ + debug_fn body; \ + } \ +} while(0); #define DEBUGADD(level, body) #ifndef discard_const |