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
orbea -
OpenLDAP
Commits
afd3f7c5
Commit
afd3f7c5
authored
Apr 23, 2005
by
Howard Chu
Browse files
Fix DB_CONFIG loading
parent
f01bb8d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
servers/slapd/back-bdb/config.c
View file @
afd3f7c5
...
...
@@ -353,6 +353,30 @@ bdb_cf_gen(ConfigArgs *c)
break
;
case
BDB_CONFIG
:
if
((
slapMode
&
SLAP_SERVER_MODE
)
&&
!
(
bdb
->
bi_flags
&
BDB_IS_OPEN
)
&&
!
bdb
->
bi_db_config
)
{
char
buf
[
SLAP_TEXT_BUFLEN
];
FILE
*
f
=
fopen
(
bdb
->
bi_db_config_path
,
"r"
);
struct
berval
bv
;
if
(
f
)
{
bdb
->
bi_flags
|=
BDB_HAS_CONFIG
;
while
(
fgets
(
buf
,
sizeof
(
buf
),
f
))
{
ber_str2bv
(
buf
,
0
,
1
,
&
bv
);
if
(
bv
.
bv_val
[
bv
.
bv_len
-
1
]
==
'\n'
)
{
bv
.
bv_len
--
;
bv
.
bv_val
[
bv
.
bv_len
]
=
'\0'
;
}
/* shouldn't need this, but ... */
if
(
bv
.
bv_val
[
bv
.
bv_len
-
1
]
==
'\r'
)
{
bv
.
bv_len
--
;
bv
.
bv_val
[
bv
.
bv_len
]
=
'\0'
;
}
ber_bvarray_add
(
&
bdb
->
bi_db_config
,
&
bv
);
}
fclose
(
f
);
}
}
if
(
bdb
->
bi_db_config
)
{
int
i
;
struct
berval
bv
;
...
...
servers/slapd/back-bdb/init.c
View file @
afd3f7c5
...
...
@@ -527,32 +527,6 @@ bdb_db_open( BackendDB *be )
XLOCK_ID
(
bdb
->
bi_dbenv
,
&
bdb
->
bi_cache
.
c_locker
);
}
if
((
slapMode
&
SLAP_SERVER_MODE
)
&&
(
bdb
->
bi_flags
&
BDB_HAS_CONFIG
))
{
char
buf
[
SLAP_TEXT_BUFLEN
];
FILE
*
f
=
fopen
(
bdb
->
bi_db_config_path
,
"r"
);
struct
berval
bv
;
if
(
f
)
{
while
(
fgets
(
buf
,
sizeof
(
buf
),
f
))
{
ber_str2bv
(
buf
,
0
,
1
,
&
bv
);
if
(
bv
.
bv_val
[
bv
.
bv_len
-
1
]
==
'\n'
)
{
bv
.
bv_len
--
;
bv
.
bv_val
[
bv
.
bv_len
]
=
'\0'
;
}
/* shouldn't need this, but ... */
if
(
bv
.
bv_val
[
bv
.
bv_len
-
1
]
==
'\r'
)
{
bv
.
bv_len
--
;
bv
.
bv_val
[
bv
.
bv_len
]
=
'\0'
;
}
ber_bvarray_add
(
&
bdb
->
bi_db_config
,
&
bv
);
}
fclose
(
f
);
}
else
{
/* Eh? It disappeared between config and open?? */
bdb
->
bi_flags
&=
~
BDB_HAS_CONFIG
;
}
}
bdb
->
bi_flags
|=
BDB_IS_OPEN
;
return
0
;
...
...
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