Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
James Lowden
OpenLDAP
Commits
9ac3909e
Commit
9ac3909e
authored
Mar 09, 2021
by
Howard Chu
Committed by
Quanah Gibson-Mount
Mar 31, 2021
Browse files
ITS#9513 Intercept liblber error printer
And add time and thread ID prefix to all debug output
parent
01e5664c
Changes
2
Hide whitespace changes
Inline
Side-by-side
libraries/liblber/options.c
View file @
9ac3909e
...
...
@@ -66,6 +66,10 @@ ber_get_option(
case
LBER_OPT_LOG_PRINT_FILE
:
*
((
FILE
**
)
outvalue
)
=
(
FILE
*
)
ber_pvt_err_file
;
return
LBER_OPT_SUCCESS
;
case
LBER_OPT_LOG_PRINT_FN
:
*
(
BER_LOG_PRINT_FN
*
)
outvalue
=
ber_pvt_log_print
;
return
LBER_OPT_SUCCESS
;
}
ber_errno
=
LBER_ERROR_PARAM
;
...
...
servers/slapd/main.c
View file @
9ac3909e
...
...
@@ -377,6 +377,19 @@ usage( char *name )
);
}
typedef
void
(
BER_logger
)(
const
char
*
buf
);
static
BER_logger
*
ber_logger
;
static
void
debug_print
(
const
char
*
data
)
{
char
buf
[
4136
];
/* 4096 + 40 */
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
buf
[
sizeof
(
buf
)
-
1
]
=
'\0'
;
snprintf
(
buf
,
sizeof
(
buf
)
-
1
,
"%lx.%05x %p %s"
,
(
long
)
tv
.
tv_sec
,
tv
.
tv_usec
,
(
void
*
)
ldap_pvt_thread_self
(),
data
);
ber_logger
(
buf
);
}
#ifdef HAVE_NT_SERVICE_MANAGER
void
WINAPI
ServiceMain
(
DWORD
argc
,
LPTSTR
*
argv
)
...
...
@@ -720,6 +733,8 @@ unhandled_option:;
if
(
optind
!=
argc
)
goto
unhandled_option
;
ber_get_option
(
NULL
,
LBER_OPT_LOG_PRINT_FN
,
&
ber_logger
);
ber_set_option
(
NULL
,
LBER_OPT_LOG_PRINT_FN
,
debug_print
);
ber_set_option
(
NULL
,
LBER_OPT_DEBUG_LEVEL
,
&
slap_debug
);
ldap_set_option
(
NULL
,
LDAP_OPT_DEBUG_LEVEL
,
&
slap_debug
);
ldif_debug
=
slap_debug
;
...
...
@@ -843,6 +858,8 @@ unhandled_option:;
debug_unknowns
=
NULL
;
if
(
rc
)
goto
destroy
;
ber_set_option
(
NULL
,
LBER_OPT_DEBUG_LEVEL
,
&
slap_debug
);
ldap_set_option
(
NULL
,
LDAP_OPT_DEBUG_LEVEL
,
&
slap_debug
);
}
if
(
syslog_unknowns
)
{
rc
=
parse_debug_unknowns
(
syslog_unknowns
,
&
ldap_syslog
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment