Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
James Lowden
OpenLDAP
Commits
ca0c1737
Commit
ca0c1737
authored
15 years ago
by
Quanah Gibson-Mount
Browse files
Options
Downloads
Patches
Plain Diff
better diagnostics
parent
41d79ff0
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
servers/slapd/slapadd.c
+48
-14
48 additions, 14 deletions
servers/slapd/slapadd.c
servers/slapd/slapcommon.c
+14
-5
14 additions, 5 deletions
servers/slapd/slapcommon.c
servers/slapd/slapcommon.h
+2
-0
2 additions, 0 deletions
servers/slapd/slapcommon.h
with
64 additions
and
19 deletions
servers/slapd/slapadd.c
+
48
−
14
View file @
ca0c1737
...
...
@@ -143,7 +143,9 @@ slapadd( int argc, char **argv )
/* nextline is the line number of the end of the current entry */
for
(
lineno
=
1
;
ldif_read_record
(
ldiffp
,
&
nextline
,
&
buf
,
&
lmax
);
lineno
=
nextline
+
1
)
{
lineno
=
nextline
+
1
)
{
BackendDB
*
bd
;
Entry
*
e
;
if
(
lineno
<
jumpline
)
...
...
@@ -173,9 +175,28 @@ slapadd( int argc, char **argv )
/* make sure the DN is not empty */
if
(
BER_BVISEMPTY
(
&
e
->
e_nname
)
&&
!
BER_BVISEMPTY
(
be
->
be_nsuffix
))
{
fprintf
(
stderr
,
"%s: empty dn=
\"
%s
\"
(line=%d)
\n
"
,
progname
,
e
->
e_dn
,
lineno
);
!
BER_BVISEMPTY
(
be
->
be_nsuffix
))
{
fprintf
(
stderr
,
"%s: line %d: "
"cannot add entry with empty dn=
\"
%s
\"
"
,
progname
,
lineno
,
e
->
e_dn
);
bd
=
select_backend
(
&
e
->
e_nname
,
nosubordinates
);
if
(
bd
)
{
BackendDB
*
bdtmp
;
int
dbidx
=
0
;
LDAP_STAILQ_FOREACH
(
bdtmp
,
&
backendDB
,
be_next
)
{
if
(
bdtmp
==
bd
)
break
;
dbidx
++
;
}
assert
(
bdtmp
!=
NULL
);
fprintf
(
stderr
,
"; did you mean to use database #%d (%s)?"
,
dbidx
,
bd
->
be_suffix
[
0
].
bv_val
);
}
fprintf
(
stderr
,
"
\n
"
);
rc
=
EXIT_FAILURE
;
entry_free
(
e
);
if
(
continuemode
)
continue
;
...
...
@@ -183,19 +204,32 @@ slapadd( int argc, char **argv )
}
/* check backend */
if
(
select_backend
(
&
e
->
e_nname
,
nosubordinates
)
!=
be
)
{
bd
=
select_backend
(
&
e
->
e_nname
,
nosubordinates
);
if
(
bd
!=
be
)
{
fprintf
(
stderr
,
"%s: line %d: "
"database (%s) not configured to hold
\"
%s
\"
\n
"
,
"database
#%d
(%s) not configured to hold
\"
%s
\"
"
,
progname
,
lineno
,
be
?
be
->
be_suffix
[
0
].
bv_val
:
"<none>"
,
dbnum
,
be
->
be_suffix
[
0
].
bv_val
,
e
->
e_dn
);
fprintf
(
stderr
,
"%s: line %d: "
"database (%s) not configured to hold
\"
%s
\"\n
"
,
progname
,
lineno
,
be
?
be
->
be_nsuffix
[
0
].
bv_val
:
"<none>"
,
e
->
e_ndn
);
if
(
bd
)
{
BackendDB
*
bdtmp
;
int
dbidx
=
0
;
LDAP_STAILQ_FOREACH
(
bdtmp
,
&
backendDB
,
be_next
)
{
if
(
bdtmp
==
bd
)
break
;
dbidx
++
;
}
assert
(
bdtmp
!=
NULL
);
fprintf
(
stderr
,
"; did you mean to use database #%d (%s)?"
,
dbidx
,
bd
->
be_suffix
[
0
].
bv_val
);
}
else
{
fprintf
(
stderr
,
"; no database configured for that naming context"
);
}
fprintf
(
stderr
,
"
\n
"
);
rc
=
EXIT_FAILURE
;
entry_free
(
e
);
if
(
continuemode
)
continue
;
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/slapcommon.c
+
14
−
5
View file @
ca0c1737
...
...
@@ -218,7 +218,7 @@ slap_tool_init(
char
*
subtree
=
NULL
;
char
*
ldiffile
=
NULL
;
char
**
debug_unknowns
=
NULL
;
int
rc
,
i
,
dbnum
;
int
rc
,
i
;
int
mode
=
SLAP_TOOL_MODE
;
int
truncatemode
=
0
;
int
use_glue
=
1
;
...
...
@@ -353,7 +353,7 @@ slap_tool_init(
break
;
case
'n'
:
/* which config file db to index */
if
(
lutil_atoi
(
&
dbnum
,
optarg
)
)
{
if
(
lutil_atoi
(
&
dbnum
,
optarg
)
||
dbnum
<
0
)
{
usage
(
tool
,
progname
);
}
break
;
...
...
@@ -689,12 +689,12 @@ slap_tool_init(
progname
,
dbnum
,
0
);
}
}
else
if
(
dbnum
<
0
||
dbnum
>
(
nbackends
-
1
)
)
{
}
else
if
(
dbnum
>=
nbackends
)
{
fprintf
(
stderr
,
"Database number selected via -n is out of range
\n
"
"Must be in the range 0 to %d"
" (number of configured databases)
\n
"
,
nbackends
-
1
);
" (
the
number of configured databases)
\n
"
,
nbackends
-
1
);
exit
(
EXIT_FAILURE
);
}
else
{
...
...
@@ -705,6 +705,15 @@ slap_tool_init(
}
startup:
;
if
(
be
)
{
BackendDB
*
bdtmp
;
dbnum
=
0
;
LDAP_STAILQ_FOREACH
(
bdtmp
,
&
backendDB
,
be_next
)
{
if
(
bdtmp
==
be
)
break
;
dbnum
++
;
}
}
#ifdef CSRIMALLOC
mal_leaktrace
(
1
);
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/slapcommon.h
+
2
−
0
View file @
ca0c1737
...
...
@@ -34,6 +34,7 @@ enum slaptool {
typedef
struct
tool_vars
{
Backend
*
tv_be
;
int
tv_dbnum
;
int
tv_verbose
;
int
tv_quiet
;
int
tv_update_ctxcsn
;
...
...
@@ -66,6 +67,7 @@ typedef struct tool_vars {
extern
tool_vars
tool_globals
;
#define be tool_globals.tv_be
#define dbnum tool_globals.tv_dbnum
#define verbose tool_globals.tv_verbose
#define quiet tool_globals.tv_quiet
#define jumpline tool_globals.tv_jumpline
...
...
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