Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
David Barchiesi
OpenLDAP
Commits
356715fd
Commit
356715fd
authored
Oct 30, 2020
by
Ondřej Kuzník
Committed by
Quanah Gibson-Mount
Dec 08, 2020
Browse files
ITS#9363 Zero out values on config delete
parent
a44ba274
Changes
1
Hide whitespace changes
Inline
Side-by-side
servers/slapd/config.c
View file @
356715fd
...
...
@@ -453,14 +453,53 @@ int
config_del_vals
(
ConfigTable
*
cf
,
ConfigArgs
*
c
)
{
int
rc
=
0
;
void
*
ptr
;
/* If there is no handler, just ignore it */
if
(
cf
->
arg_type
&
ARG_MAGIC
)
{
c
->
argv
[
0
]
=
cf
->
ad
->
ad_cname
.
bv_val
;
c
->
op
=
LDAP_MOD_DELETE
;
c
->
type
=
cf
->
arg_type
&
ARGS_USERLAND
;
rc
=
(
*
((
ConfigDriver
*
)
cf
->
arg_item
))(
c
);
return
rc
;
}
/* If there is no handler, just zero it */
if
(
cf
->
arg_type
&
ARG_OFFSET
)
{
if
(
c
->
be
&&
c
->
table
==
Cft_Database
)
ptr
=
c
->
be
->
be_private
;
else
if
(
c
->
bi
)
ptr
=
c
->
bi
->
bi_private
;
else
{
snprintf
(
c
->
cr_msg
,
sizeof
(
c
->
cr_msg
),
"<%s> offset is missing base pointer"
,
c
->
argv
[
0
]
);
Debug
(
LDAP_DEBUG_CONFIG
,
"%s: %s!
\n
"
,
c
->
log
,
c
->
cr_msg
);
return
ARG_BAD_CONF
;
}
ptr
=
(
void
*
)((
char
*
)
ptr
+
(
long
)
cf
->
arg_item
);
}
else
if
(
cf
->
arg_type
&
ARGS_TYPES
)
{
ptr
=
cf
->
arg_item
;
}
if
(
cf
->
arg_type
&
ARGS_TYPES
)
switch
(
cf
->
arg_type
&
ARGS_TYPES
)
{
case
ARG_ON_OFF
:
case
ARG_INT
:
*
(
int
*
)
ptr
=
0
;
break
;
case
ARG_UINT
:
*
(
unsigned
*
)
ptr
=
0
;
break
;
case
ARG_LONG
:
*
(
long
*
)
ptr
=
0
;
break
;
case
ARG_ULONG
:
*
(
size_t
*
)
ptr
=
0
;
break
;
case
ARG_BER_LEN_T
:
*
(
ber_len_t
*
)
ptr
=
0
;
break
;
case
ARG_STRING
:
ch_free
(
*
(
char
**
)
ptr
);
*
(
char
**
)
ptr
=
NULL
;
break
;
case
ARG_BERVAL
:
case
ARG_BINARY
:
ch_free
(
((
struct
berval
*
)
ptr
)
->
bv_val
);
BER_BVZERO
(
(
struct
berval
*
)
ptr
);
break
;
case
ARG_ATDESC
:
*
(
AttributeDescription
**
)
ptr
=
NULL
;
break
;
}
return
rc
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment