File: debug.c

package info (click to toggle)
gss-ntlmssp 0.7.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid
  • size: 2,168 kB
  • ctags: 884
  • sloc: ansic: 9,283; sh: 4,373; makefile: 241; xml: 150
file content (33 lines) | stat: -rw-r--r-- 690 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* Copyright (C) 2014 GSS-NTLMSSP contributors, see COPYING for license */

#define _GNU_SOURCE
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

bool gssntlm_debug_initialized = false;
bool gssntlm_debug_enabled = false;
static FILE *debug_fd = NULL;

void gssntlm_debug_init(void)
{
    char *env;

    env = secure_getenv("GSSNTLMSSP_DEBUG");
    if (env) {
        debug_fd = fopen(env, "a");
        if (debug_fd) gssntlm_debug_enabled = true;
    }
    gssntlm_debug_initialized = true;
}

void gssntlm_debug_printf(const char *fmt, ...)
{
    va_list ap;

    va_start(ap, fmt);
    vfprintf(debug_fd, fmt, ap);
    va_end(ap);
    fflush(debug_fd);
}