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
Christopher Ng
OpenLDAP
Commits
60533ad1
Commit
60533ad1
authored
19 years ago
by
Howard Chu
Browse files
Options
Downloads
Patches
Plain Diff
More for Modify. Single-valued attrs working.
parent
1ad2e448
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/bconfig.c
+76
-11
76 additions, 11 deletions
servers/slapd/bconfig.c
servers/slapd/config.c
+2
-2
2 additions, 2 deletions
servers/slapd/config.c
servers/slapd/config.h
+1
-0
1 addition, 0 deletions
servers/slapd/config.h
with
79 additions
and
13 deletions
servers/slapd/bconfig.c
+
76
−
11
View file @
60533ad1
...
...
@@ -3050,7 +3050,10 @@ check_vals( ConfigTable *ct, ConfigArgs *ca, void *ptr, int isAttr )
}
for
(
i
=
0
;
vals
[
i
].
bv_val
;
i
++
)
{
ca
->
line
=
vals
[
i
].
bv_val
;
if
(
sort
)
ca
->
line
=
strchr
(
ca
->
line
,
'}'
)
+
1
;
if
(
sort
)
{
char
*
idx
=
strchr
(
ca
->
line
,
'}'
);
if
(
idx
)
ca
->
line
=
idx
+
1
;
}
rc
=
config_parse_vals
(
ct
,
ca
,
i
);
if
(
rc
)
break
;
...
...
@@ -3222,8 +3225,8 @@ config_add_internal( CfBackInfo *cfb, Entry *e, SlapReply *rs, int *renum )
int
i
,
j
,
nocs
,
rc
;
ConfigArgs
ca
=
{
0
};
struct
berval
pdn
;
Entry
*
xe
=
NULL
;
ConfigTable
*
ct
,
*
type_ct
=
NULL
;
char
*
ptr
;
/* Make sure parent exists and entry does not */
ce
=
config_find_base
(
cfb
->
cb_root
,
&
e
->
e_nname
,
&
last
);
...
...
@@ -3393,9 +3396,12 @@ config_add_internal( CfBackInfo *cfb, Entry *e, SlapReply *rs, int *renum )
/* Basic syntax checks are OK. Do the actual settings. */
if
(
type_ct
)
{
ca
.
line
=
type_attr
->
a_vals
[
0
].
bv_val
;
if
(
type_ad
->
ad_type
->
sat_flags
&
SLAP_AT_ORDERED
)
ca
.
line
=
strchr
(
ca
.
line
,
'}'
)
+
1
;
rc
=
config_parse_add
(
type_ct
,
&
ca
,
0
);
if
(
type_ad
->
ad_type
->
sat_flags
&
SLAP_AT_ORDERED
)
{
ptr
=
strchr
(
ca
.
line
,
'}'
);
if
(
ptr
)
ca
.
line
=
ptr
+
1
;
}
ca
.
valx
=
0
;
rc
=
config_parse_add
(
type_ct
,
&
ca
);
if
(
rc
)
{
rc
=
LDAP_OTHER
;
goto
leave
;
...
...
@@ -3407,9 +3413,12 @@ config_add_internal( CfBackInfo *cfb, Entry *e, SlapReply *rs, int *renum )
if
(
!
ct
)
continue
;
/* user data? */
for
(
i
=
0
;
a
->
a_vals
[
i
].
bv_val
;
i
++
)
{
ca
.
line
=
a
->
a_vals
[
i
].
bv_val
;
if
(
a
->
a_desc
->
ad_type
->
sat_flags
&
SLAP_AT_ORDERED
)
ca
.
line
=
strchr
(
ca
.
line
,
'}'
)
+
1
;
rc
=
config_parse_add
(
ct
,
&
ca
,
i
);
if
(
a
->
a_desc
->
ad_type
->
sat_flags
&
SLAP_AT_ORDERED
)
{
ptr
=
strchr
(
ca
.
line
,
'}'
);
if
(
ptr
)
ca
.
line
=
ptr
+
1
;
}
ca
.
valx
=
i
;
rc
=
config_parse_add
(
ct
,
&
ca
);
if
(
rc
)
{
rc
=
LDAP_OTHER
;
goto
leave
;
...
...
@@ -3422,6 +3431,8 @@ ok:
ce
->
ce_entry
=
entry_dup
(
e
);
ce
->
ce_entry
->
e_private
=
ce
;
ce
->
ce_type
=
colst
[
0
]
->
co_type
;
ce
->
ce_be
=
ca
.
be
;
ce
->
ce_bi
=
ca
.
bi
;
if
(
!
last
)
{
cfb
->
cb_root
=
ce
;
}
else
if
(
last
->
ce_kids
)
{
...
...
@@ -3500,6 +3511,7 @@ config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs,
ConfigTable
*
ct
;
CfOcInfo
**
colst
;
int
i
,
nocs
;
char
*
ptr
;
oc_at
=
attr_find
(
e
->
e_attrs
,
slap_schema
.
si_ad_objectClass
);
if
(
!
oc_at
)
return
LDAP_OBJECT_CLASS_VIOLATION
;
...
...
@@ -3507,7 +3519,10 @@ config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs,
colst
=
count_ocs
(
oc_at
,
&
nocs
);
e
->
e_attrs
=
attrs_dup
(
e
->
e_attrs
);
init_config_argv
(
&
ca
);
ca
.
be
=
ce
->
ce_be
;
ca
.
bi
=
ce
->
ce_bi
;
for
(
ml
=
op
->
orm_modlist
;
ml
;
ml
=
ml
->
sml_next
)
{
switch
(
ml
->
sml_op
)
{
...
...
@@ -3545,11 +3560,19 @@ config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs,
rc
=
modify_add_values
(
e
,
&
ml
->
sml_mod
,
get_permissiveModify
(
op
),
&
rs
->
sr_text
,
textbuf
,
textsize
);
ml
->
sml_op
=
mop
;
if
(
mop
==
SLAP_MOD_SOFTADD
&&
rc
==
LDAP_TYPE_OR_VALUE_EXISTS
)
rc
=
LDAP_SUCCESS
;
/* If value already exists, show success here
* and ignore this operation down below.
*/
if
(
mop
==
SLAP_MOD_SOFTADD
)
{
if
(
rc
==
LDAP_TYPE_OR_VALUE_EXISTS
)
rc
=
LDAP_SUCCESS
;
else
mop
=
LDAP_MOD_ADD
;
}
ml
->
sml_op
=
mop
;
break
;
}
break
;
case
LDAP_MOD_INCREMENT
:
/* FIXME */
...
...
@@ -3574,6 +3597,46 @@ config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs,
ct
=
config_find_table
(
colst
,
nocs
,
ml
->
sml_desc
);
if
(
!
ct
)
continue
;
switch
(
ml
->
sml_op
)
{
case
LDAP_MOD_DELETE
:
case
LDAP_MOD_REPLACE
:
{
BerVarray
vals
=
NULL
,
nvals
;
if
(
ml
->
sml_op
==
LDAP_MOD_REPLACE
)
{
vals
=
ml
->
sml_values
;
nvals
=
ml
->
sml_nvalues
;
ml
->
sml_values
=
NULL
;
ml
->
sml_nvalues
=
NULL
;
}
#if 0
rc = config_del_vals( ct, &ca, ml->sml_values );
#endif
if
(
ml
->
sml_op
==
LDAP_MOD_REPLACE
)
{
ml
->
sml_values
=
vals
;
ml
->
sml_nvalues
=
nvals
;
}
if
(
!
vals
)
break
;
}
/* FALLTHRU: LDAP_MOD_REPLACE && vals */
case
LDAP_MOD_ADD
:
for
(
i
=
0
;
ml
->
sml_values
[
i
].
bv_val
;
i
++
)
{
ca
.
line
=
ml
->
sml_values
[
i
].
bv_val
;
if
(
ml
->
sml_desc
->
ad_type
->
sat_flags
&
SLAP_AT_ORDERED
)
{
ptr
=
strchr
(
ca
.
line
,
'}'
);
if
(
ptr
)
ca
.
line
=
ptr
+
1
;
}
ca
.
valx
=
i
;
rc
=
config_parse_add
(
ct
,
&
ca
);
if
(
rc
)
{
rc
=
LDAP_OTHER
;
goto
out
;
}
}
break
;
}
}
}
...
...
@@ -3584,6 +3647,8 @@ out:
attrs_free
(
e
->
e_attrs
);
e
->
e_attrs
=
save_attrs
;
}
ch_free
(
ca
.
argv
);
if
(
colst
)
ch_free
(
colst
);
return
rc
;
}
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/config.c
+
2
−
2
View file @
60533ad1
...
...
@@ -465,12 +465,12 @@ config_parse_vals(ConfigTable *ct, ConfigArgs *c, int valx)
}
int
config_parse_add
(
ConfigTable
*
ct
,
ConfigArgs
*
c
,
int
valx
)
config_parse_add
(
ConfigTable
*
ct
,
ConfigArgs
*
c
)
{
int
rc
=
0
;
snprintf
(
c
->
log
,
sizeof
(
c
->
log
),
"%s: value #%d"
,
ct
->
ad
->
ad_cname
.
bv_val
,
valx
);
ct
->
ad
->
ad_cname
.
bv_val
,
c
->
valx
);
c
->
argc
=
1
;
c
->
argv
[
0
]
=
ct
->
ad
->
ad_cname
.
bv_val
;
if
(
fp_parse_line
(
c
)
)
{
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/config.h
+
1
−
0
View file @
60533ad1
...
...
@@ -97,6 +97,7 @@ typedef struct config_args_s {
unsigned
long
lineno
;
char
log
[
PATH_MAX
+
STRLENOF
(
": line 18446744073709551615"
)
+
1
];
int
depth
;
int
valx
;
/* multi-valued value index */
/* parsed first val for simple cases */
union
{
int
v_int
;
...
...
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