Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johan Pascal
OpenLDAP
Commits
01e5664c
Commit
01e5664c
authored
4 years ago
by
Howard Chu
Committed by
Quanah Gibson-Mount
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ITS#9513 Cleanup debug output
Avoid splitting single lines across multiple Debug invocations
parent
c5a56bcb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libraries/liblber/debug.c
+2
-35
2 additions, 35 deletions
libraries/liblber/debug.c
servers/slapd/mr.c
+3
-3
3 additions, 3 deletions
servers/slapd/mr.c
servers/slapd/search.c
+28
-8
28 additions, 8 deletions
servers/slapd/search.c
with
33 additions
and
46 deletions
libraries/liblber/debug.c
+
2
−
35
View file @
01e5664c
...
...
@@ -20,7 +20,6 @@
#include
<ac/stdarg.h>
#include
<ac/stdlib.h>
#include
<ac/string.h>
#include
<ac/time.h>
#include
<ac/ctype.h>
#ifdef LDAP_SYSLOG
...
...
@@ -32,12 +31,8 @@
#include
"lber.h"
#include
"ldap_pvt.h"
static
FILE
*
log_file
=
NULL
;
static
int
debug_lastc
=
'\n'
;
int
lutil_debug_file
(
FILE
*
file
)
{
log_file
=
file
;
ber_set_option
(
NULL
,
LBER_OPT_LOG_PRINT_FILE
,
file
);
return
0
;
...
...
@@ -47,41 +42,13 @@ void (lutil_debug)( int debug, int level, const char *fmt, ... )
{
char
buffer
[
4096
];
va_list
vl
;
int
len
,
off
;
if
(
!
(
level
&
debug
)
)
return
;
#ifdef HAVE_WINSOCK
if
(
log_file
==
NULL
)
{
log_file
=
fopen
(
LDAP_RUNDIR
LDAP_DIRSEP
"openldap.log"
,
"w"
);
if
(
log_file
==
NULL
)
{
log_file
=
fopen
(
"openldap.log"
,
"w"
);
if
(
log_file
==
NULL
)
return
;
}
ber_set_option
(
NULL
,
LBER_OPT_LOG_PRINT_FILE
,
log_file
);
}
#endif
if
(
debug_lastc
==
'\n'
)
{
sprintf
(
buffer
,
"%08x "
,
(
unsigned
)
time
(
0L
));
off
=
9
;
}
else
{
off
=
0
;
}
va_start
(
vl
,
fmt
);
len
=
vsnprintf
(
buffer
+
off
,
sizeof
(
buffer
)
-
off
,
fmt
,
vl
);
if
(
len
>
sizeof
(
buffer
)
-
off
)
len
=
sizeof
(
buffer
)
-
off
;
debug_lastc
=
buffer
[
len
+
off
-
1
];
buffer
[
sizeof
(
buffer
)
-
1
]
=
'\0'
;
if
(
log_file
!=
NULL
)
{
fputs
(
buffer
,
log_file
);
fflush
(
log_file
);
}
fputs
(
buffer
,
stderr
);
vsnprintf
(
buffer
,
sizeof
(
buffer
),
fmt
,
vl
);
va_end
(
vl
);
ber_pvt_log_print
(
buffer
);
}
#if defined(HAVE_EBCDIC) && defined(LDAP_SYSLOG)
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/mr.c
+
3
−
3
View file @
01e5664c
...
...
@@ -415,8 +415,8 @@ matching_rule_use_init( void )
mru
->
smru_names
=
mr
->
smr_names
;
mru
->
smru_desc
=
mr
->
smr_desc
;
Debug
(
LDAP_DEBUG_TRACE
,
" %s (%s):
"
,
mru
->
smru_oid
,
Debug
(
LDAP_DEBUG_TRACE
,
" %s (%s):
\n
"
,
mru
->
smru_oid
,
mru
->
smru_names
?
mru
->
smru_names
[
0
]
:
""
);
at
=
NULL
;
...
...
@@ -437,7 +437,7 @@ matching_rule_use_init( void )
mru
->
smru_applies_oids
=
applies_oids
;
{
char
*
str
=
ldap_matchingruleuse2str
(
&
mru
->
smru_mruleuse
);
Debug
(
LDAP_DEBUG_TRACE
,
"matchingRuleUse: %s
\n
"
,
str
);
Debug
(
LDAP_DEBUG_TRACE
,
"
matchingRuleUse: %s
\n
"
,
str
);
ldap_memfree
(
str
);
}
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/search.c
+
28
−
8
View file @
01e5664c
...
...
@@ -118,9 +118,8 @@ do_search(
goto
return_results
;
}
Debug
(
LDAP_DEBUG_ARGS
,
"SRCH
\"
%s
\"
%d %d"
,
base
.
bv_val
,
op
->
ors_scope
,
op
->
ors_deref
);
Debug
(
LDAP_DEBUG_ARGS
,
" %d %d %d
\n
"
,
Debug
(
LDAP_DEBUG_ARGS
,
"SRCH
\"
%s
\"
%d %d %d %d %d
\n
"
,
base
.
bv_val
,
op
->
ors_scope
,
op
->
ors_deref
,
op
->
ors_slimit
,
op
->
ors_tlimit
,
op
->
ors_attrsonly
);
/* filter - returns a "normalized" version */
...
...
@@ -198,16 +197,37 @@ do_search(
goto
return_results
;
}
Debug
(
LDAP_DEBUG_ARGS
,
" attrs:"
);
if
(
LogTest
(
LDAP_DEBUG_ARGS
)
)
{
char
abuf
[
BUFSIZ
/
2
],
*
ptr
=
abuf
;
unsigned
len
=
0
,
alen
;
if
(
siz
!=
0
)
{
if
(
!
siz
)
{
len
=
1
;
abuf
[
0
]
=
'\0'
;
}
for
(
i
=
0
;
i
<
siz
;
i
++
)
{
Debug
(
LDAP_DEBUG_ARGS
,
" %s"
,
op
->
ors_attrs
[
i
].
an_name
.
bv_val
);
alen
=
op
->
ors_attrs
[
i
].
an_name
.
bv_len
;
if
(
alen
>=
sizeof
(
abuf
))
{
alen
=
sizeof
(
abuf
)
-
1
;
}
if
(
len
&&
(
len
+
1
+
alen
>=
sizeof
(
abuf
)))
{
Debug
(
LDAP_DEBUG_ARGS
,
" attrs: %s
\n
"
,
abuf
);
len
=
0
;
ptr
=
abuf
;
}
if
(
len
)
{
*
ptr
++
=
' '
;
len
++
;
}
ptr
=
lutil_strncopy
(
ptr
,
op
->
ors_attrs
[
i
].
an_name
.
bv_val
,
alen
);
len
+=
alen
;
*
ptr
=
'\0'
;
}
if
(
len
)
{
Debug
(
LDAP_DEBUG_ARGS
,
" attrs: %s
\n
"
,
abuf
);
}
}
Debug
(
LDAP_DEBUG_ARGS
,
"
\n
"
);
if
(
LogTest
(
LDAP_DEBUG_STATS
)
)
{
char
abuf
[
BUFSIZ
/
2
],
*
ptr
=
abuf
;
unsigned
len
=
0
,
alen
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment