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
David Barchiesi
OpenLDAP
Commits
4c2e3eed
Commit
4c2e3eed
authored
20 years ago
by
Luke Howard
Browse files
Options
Downloads
Patches
Plain Diff
Add slapi_entry_add_rdn_values(), slapi_entry_rdn_values_present(), slapi_entry_schema_check() API
parent
26380527
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
servers/slapd/slapi/proto-slapi.h
+4
-0
4 additions, 0 deletions
servers/slapd/slapi/proto-slapi.h
servers/slapd/slapi/slapi_utils.c
+95
-0
95 additions, 0 deletions
servers/slapd/slapi/slapi_utils.c
with
99 additions
and
0 deletions
servers/slapd/slapi/proto-slapi.h
+
4
−
0
View file @
4c2e3eed
...
...
@@ -61,6 +61,10 @@ extern int slapi_entry_add_string(Slapi_Entry *e, const char *type, const char *
extern
int
slapi_entry_delete_string
(
Slapi_Entry
*
e
,
const
char
*
type
,
const
char
*
value
);
extern
int
slapi_entry_first_attr
(
const
Slapi_Entry
*
e
,
Slapi_Attr
**
attr
);
extern
int
slapi_entry_next_attr
(
const
Slapi_Entry
*
e
,
Slapi_Attr
*
prevattr
,
Slapi_Attr
**
attr
);
extern
int
slapi_entry_schema_check
(
Slapi_PBlock
*
pb
,
Slapi_Entry
*
e
);
extern
int
slapi_entry_rdn_values_present
(
const
Slapi_Entry
*
e
);
extern
int
slapi_entry_add_rdn_values
(
Slapi_Entry
*
e
);
extern
char
*
slapi_entry_get_dn
(
Slapi_Entry
*
e
);
extern
int
slapi_x_entry_get_id
(
Slapi_Entry
*
e
);
extern
void
slapi_entry_set_dn
(
Slapi_Entry
*
e
,
char
*
dn
);
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/slapi/slapi_utils.c
+
95
−
0
View file @
4c2e3eed
...
...
@@ -4071,3 +4071,98 @@ char *slapi_dn_plus_rdn( const char *dn, const char *rdn )
#endif
/* LDAP_SLAPI */
}
int
slapi_entry_schema_check
(
Slapi_PBlock
*
pb
,
Slapi_Entry
*
e
)
{
#ifdef LDAP_SLAPI
Backend
*
be
;
const
char
*
text
;
char
textbuf
[
SLAP_TEXT_BUFLEN
]
=
{
'\0'
};
size_t
textlen
=
sizeof
textbuf
;
int
rc
;
if
(
slapi_pblock_get
(
pb
,
SLAPI_BACKEND
,
(
void
**
)
&
be
)
!=
0
)
return
-
1
;
rc
=
entry_schema_check
(
be
,
e
,
NULL
,
&
text
,
textbuf
,
textlen
);
return
(
rc
==
LDAP_SUCCESS
)
?
0
:
1
;
#else
return
-
1
;
#endif
/* LDAP_SLAPI */
}
int
slapi_entry_rdn_values_present
(
const
Slapi_Entry
*
e
)
{
#ifdef LDAP_SLAPI
LDAPDN
dn
;
int
rc
;
int
i
=
0
,
match
=
0
;
char
*
dn_str
;
dn_str
=
slapi_entry_get_dn
(
(
Slapi_Entry
*
)
e
);
rc
=
ldap_str2dn
(
dn_str
,
&
dn
,
LDAP_DN_FORMAT_LDAPV3
);
if
(
rc
!=
LDAP_SUCCESS
)
{
return
0
;
}
if
(
dn
[
0
]
!=
NULL
)
{
LDAPRDN
rdn
=
dn
[
0
];
for
(
i
=
0
;
rdn
[
i
]
!=
NULL
;
i
++
)
{
LDAPAVA
*
ava
=
&
rdn
[
0
][
i
];
Slapi_Attr
*
a
=
NULL
;
if
(
slapi_attr_entry_attr_find
(
e
,
ava
->
la_attr
.
bv_val
,
&
a
)
==
0
&&
slapi_attr_value_find
(
a
,
&
ava
->
la_value
)
==
0
)
match
++
;
}
}
ldap_dnfree
(
dn
);
return
(
i
==
match
);
#else
return
0
;
#endif
/* LDAP_SLAPI */
}
int
slapi_entry_add_rdn_values
(
Slapi_Entry
*
e
)
{
#ifdef LDAP_SLAPI
LDAPDN
dn
;
int
i
,
rc
;
char
*
dn_str
;
dn_str
=
slapi_entry_get_dn
(
e
);
rc
=
ldap_str2dn
(
dn_str
,
&
dn
,
LDAP_DN_FORMAT_LDAPV3
);
if
(
rc
!=
LDAP_SUCCESS
)
{
return
rc
;
}
if
(
dn
[
0
]
!=
NULL
)
{
LDAPRDN
rdn
=
dn
[
0
];
struct
berval
*
vals
[
2
];
for
(
i
=
0
;
rdn
[
i
]
!=
NULL
;
i
++
)
{
LDAPAVA
*
ava
=
&
rdn
[
0
][
i
];
Slapi_Attr
*
a
=
NULL
;
if
(
slapi_attr_entry_attr_find
(
e
,
ava
->
la_attr
.
bv_val
,
&
a
)
==
0
&&
slapi_attr_value_find
(
a
,
&
ava
->
la_value
)
==
0
)
continue
;
vals
[
0
]
=
&
ava
->
la_value
;
vals
[
1
]
=
NULL
;
slapi_entry_attr_merge
(
e
,
ava
->
la_attr
.
bv_val
,
vals
);
}
}
ldap_dnfree
(
dn
);
return
LDAP_SUCCESS
;
#else
return
LDAP_OTHER
;
#endif
/* LDAP_SLAPI */
}
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