Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
975a5e9a
Commit
975a5e9a
authored
Dec 29, 2001
by
Howard Chu
Browse files
Added dnPretty2/dnNormalize2 using preallocated destination berval
parent
729fe566
Changes
29
Hide whitespace changes
Inline
Side-by-side
servers/slapd/acl.c
View file @
975a5e9a
...
...
@@ -755,7 +755,7 @@ acl_mask(
if
(
b
->
a_group_pat
.
bv_len
&&
op
->
o_ndn
.
bv_len
)
{
char
buf
[
1024
];
struct
berval
bv
=
{
1024
,
buf
};
struct
berval
*
ndn
=
NULL
;
struct
berval
ndn
=
{
0
,
NULL
}
;
int
rc
;
/* b->a_group is an unexpanded entry name, expanded it should be an
...
...
@@ -765,19 +765,19 @@ acl_mask(
/* see if asker is listed in dnattr */
if
(
b
->
a_group_style
==
ACL_STYLE_REGEX
)
{
string_expand
(
&
bv
,
b
->
a_group_pat
.
bv_val
,
e
->
e_ndn
,
matches
);
if
(
dnNormalize
(
NULL
,
&
bv
,
&
ndn
)
!=
LDAP_SUCCESS
)
{
if
(
dnNormalize
2
(
NULL
,
&
bv
,
&
ndn
)
!=
LDAP_SUCCESS
)
{
/* did not expand to a valid dn */
continue
;
}
bv
=
*
ndn
;
bv
=
ndn
;
}
else
{
bv
=
b
->
a_group_pat
;
}
rc
=
backend_group
(
be
,
conn
,
op
,
e
,
&
bv
,
&
op
->
o_ndn
,
b
->
a_group_oc
,
b
->
a_group_at
);
if
(
ndn
)
ber_bv
free
(
ndn
);
if
(
ndn
.
bv_val
)
free
(
ndn
.
bv_val
);
if
(
rc
!=
0
)
{
continue
;
...
...
@@ -1208,7 +1208,7 @@ aci_set_gather (void *cookie, char *name, struct berval *attr)
AciSetCookie
*
cp
=
cookie
;
struct
berval
**
bvals
=
NULL
;
char
**
vals
=
NULL
;
struct
berval
bv
,
*
ndn
=
NULL
;
struct
berval
bv
,
ndn
;
int
i
;
/* this routine needs to return the bervals instead of
...
...
@@ -1218,12 +1218,12 @@ aci_set_gather (void *cookie, char *name, struct berval *attr)
bv
.
bv_val
=
name
;
bv
.
bv_len
=
strlen
(
name
);
if
(
dnNormalize
(
NULL
,
&
bv
,
&
ndn
)
==
LDAP_SUCCESS
)
{
if
(
dnNormalize
2
(
NULL
,
&
bv
,
&
ndn
)
==
LDAP_SUCCESS
)
{
const
char
*
text
;
AttributeDescription
*
desc
=
NULL
;
if
(
slap_bv2ad
(
attr
,
&
desc
,
&
text
)
==
LDAP_SUCCESS
)
{
backend_attribute
(
cp
->
be
,
NULL
,
NULL
,
cp
->
e
,
ndn
,
desc
,
&
bvals
);
cp
->
e
,
&
ndn
,
desc
,
&
bvals
);
if
(
bvals
!=
NULL
)
{
for
(
i
=
0
;
bvals
[
i
]
!=
NULL
;
i
++
)
{
}
vals
=
ch_calloc
(
i
+
1
,
sizeof
(
char
*
));
...
...
@@ -1236,7 +1236,7 @@ aci_set_gather (void *cookie, char *name, struct berval *attr)
ber_bvecfree
(
bvals
);
}
}
ber_bv
free
(
ndn
);
free
(
ndn
.
bv_val
);
}
return
(
vals
);
}
...
...
@@ -1258,7 +1258,7 @@ aci_match_set (
if
(
setref
==
0
)
{
set
=
aci_bvstrdup
(
subj
);
}
else
{
struct
berval
subjdn
,
*
ndn
=
NULL
;
struct
berval
subjdn
,
ndn
=
{
0
,
NULL
}
;
struct
berval
setat
;
struct
berval
**
bvals
;
const
char
*
text
;
...
...
@@ -1283,19 +1283,19 @@ aci_match_set (
setat
.
bv_len
=
sizeof
(
SLAPD_ACI_SET_ATTR
)
-
1
;
}
if
(
setat
.
bv_val
!=
NULL
)
{
if
(
dnNormalize
(
NULL
,
&
subjdn
,
&
ndn
)
==
LDAP_SUCCESS
if
(
dnNormalize
2
(
NULL
,
&
subjdn
,
&
ndn
)
==
LDAP_SUCCESS
&&
slap_bv2ad
(
&
setat
,
&
desc
,
&
text
)
==
LDAP_SUCCESS
)
{
backend_attribute
(
be
,
NULL
,
NULL
,
e
,
ndn
,
desc
,
&
bvals
);
&
ndn
,
desc
,
&
bvals
);
if
(
bvals
!=
NULL
)
{
if
(
bvals
[
0
]
!=
NULL
)
set
=
ch_strdup
(
bvals
[
0
]
->
bv_val
);
ber_bvecfree
(
bvals
);
}
}
if
(
ndn
)
ber_bv
free
(
ndn
);
if
(
ndn
.
bv_val
)
free
(
ndn
.
bv_val
);
}
ch_free
(
subjdn
.
bv_val
);
}
...
...
@@ -1515,13 +1515,13 @@ aci_group_member (
grp_oc
=
oc_bvfind
(
&
grpoc
);
if
(
grp_oc
!=
NULL
&&
grp_ad
!=
NULL
)
{
struct
berval
*
ndn
=
NULL
;
struct
berval
ndn
;
bv
.
bv_val
=
(
char
*
)
ch_malloc
(
1024
);
bv
.
bv_len
=
1024
;
string_expand
(
&
bv
,
subjdn
,
e
->
e_ndn
,
matches
);
if
(
dnNormalize
(
NULL
,
&
bv
,
&
ndn
)
==
LDAP_SUCCESS
)
{
rc
=
(
backend_group
(
be
,
conn
,
op
,
e
,
&
bv
,
&
op
->
o_ndn
,
grp_oc
,
grp_ad
)
==
0
);
ber_bv
free
(
ndn
);
if
(
dnNormalize
2
(
NULL
,
&
bv
,
&
ndn
)
==
LDAP_SUCCESS
)
{
rc
=
(
backend_group
(
be
,
conn
,
op
,
e
,
&
ndn
,
&
op
->
o_ndn
,
grp_oc
,
grp_ad
)
==
0
);
free
(
ndn
.
bv_val
);
}
ch_free
(
bv
.
bv_val
);
}
...
...
@@ -1600,12 +1600,12 @@ aci_mask(
return
(
0
);
if
(
aci_strbvcmp
(
"access-id"
,
&
bv
)
==
0
)
{
struct
berval
*
ndn
=
NULL
;
struct
berval
ndn
;
rc
=
1
;
if
(
dnNormalize
(
NULL
,
&
sdn
,
&
ndn
)
==
LDAP_SUCCESS
)
{
if
(
strcasecmp
(
op
->
o_ndn
.
bv_val
,
ndn
->
bv_val
)
!=
0
)
if
(
dnNormalize
2
(
NULL
,
&
sdn
,
&
ndn
)
==
LDAP_SUCCESS
)
{
if
(
strcasecmp
(
op
->
o_ndn
.
bv_val
,
ndn
.
bv_val
)
!=
0
)
rc
=
0
;
ber_bv
free
(
ndn
);
free
(
ndn
.
bv_val
);
}
return
(
rc
);
}
...
...
servers/slapd/aclparse.c
View file @
975a5e9a
...
...
@@ -221,11 +221,10 @@ parse_acl(
if
(
a
->
acl_dn_pat
.
bv_len
!=
0
)
{
if
(
a
->
acl_dn_style
!=
ACL_STYLE_REGEX
)
{
struct
berval
*
bv
=
NULL
;
dnNormalize
(
NULL
,
&
a
->
acl_dn_pat
,
&
bv
);
struct
berval
bv
;
dnNormalize
2
(
NULL
,
&
a
->
acl_dn_pat
,
&
bv
);
free
(
a
->
acl_dn_pat
.
bv_val
);
a
->
acl_dn_pat
=
*
bv
;
free
(
bv
);
a
->
acl_dn_pat
=
bv
;
}
else
{
int
e
=
regcomp
(
&
a
->
acl_dn_re
,
a
->
acl_dn_pat
.
bv_val
,
REG_EXTENDED
|
REG_ICASE
);
...
...
@@ -378,10 +377,7 @@ parse_acl(
}
if
(
sty
!=
ACL_STYLE_REGEX
)
{
struct
berval
*
ndn
=
NULL
;
dnNormalize
(
NULL
,
&
bv
,
&
ndn
);
b
->
a_dn_pat
=
*
ndn
;
free
(
ndn
);
dnNormalize2
(
NULL
,
&
bv
,
&
b
->
a_dn_pat
);
free
(
bv
.
bv_val
);
}
else
{
b
->
a_dn_pat
=
bv
;
...
...
@@ -473,11 +469,8 @@ parse_acl(
regtest
(
fname
,
lineno
,
bv
.
bv_val
);
b
->
a_group_pat
=
bv
;
}
else
{
struct
berval
*
ndn
=
NULL
;
ber_str2bv
(
right
,
0
,
0
,
&
bv
);
dnNormalize
(
NULL
,
&
bv
,
&
ndn
);
b
->
a_group_pat
=
*
ndn
;
free
(
ndn
);
dnNormalize2
(
NULL
,
&
bv
,
&
b
->
a_group_pat
);
}
if
(
value
&&
*
value
)
{
...
...
servers/slapd/back-bdb/modrdn.c
View file @
975a5e9a
...
...
@@ -30,7 +30,7 @@ bdb_modrdn(
struct
bdb_info
*
bdb
=
(
struct
bdb_info
*
)
be
->
be_private
;
AttributeDescription
*
children
=
slap_schema
.
si_ad_children
;
struct
berval
p_dn
,
p_ndn
;
struct
berval
new_dn
=
{
0
,
NULL
},
*
new_ndn
=
NULL
;
struct
berval
new_dn
=
{
0
,
NULL
},
new_ndn
=
{
0
,
NULL
}
;
int
isroot
=
-
1
;
Entry
*
e
,
*
p
=
NULL
;
Entry
*
matched
;
...
...
@@ -393,12 +393,12 @@ retry: /* transaction retry */
/* Build target dn and make sure target entry doesn't exist already. */
build_new_dn
(
&
new_dn
,
new_parent_dn
,
newrdn
);
dnNormalize
(
NULL
,
&
new_dn
,
&
new_ndn
);
dnNormalize
2
(
NULL
,
&
new_dn
,
&
new_ndn
);
Debug
(
LDAP_DEBUG_TRACE
,
"bdb_modrdn: new ndn=%s
\n
"
,
new_ndn
,
0
,
0
);
new_ndn
.
bv_val
,
0
,
0
);
rc
=
bdb_dn2id
(
be
,
ltid
,
new_ndn
,
&
id
);
rc
=
bdb_dn2id
(
be
,
ltid
,
&
new_ndn
,
&
id
);
switch
(
rc
)
{
case
DB_LOCK_DEADLOCK
:
case
DB_LOCK_NOTGRANTED
:
...
...
@@ -416,7 +416,7 @@ retry: /* transaction retry */
Debug
(
LDAP_DEBUG_TRACE
,
"bdb_modrdn: new ndn=%s does not exist
\n
"
,
new_ndn
,
0
,
0
);
new_ndn
.
bv_val
,
0
,
0
);
/* Get attribute type and attribute value of our new rdn, we will
* need to add that to our new entry
...
...
@@ -574,7 +574,7 @@ retry: /* transaction retry */
* they can be individually freed later.
*/
e
->
e_name
=
new_dn
;
e
->
e_nname
=
*
new_ndn
;
e
->
e_nname
=
new_ndn
;
/* add new one */
rc
=
bdb_dn2id_add
(
be
,
ltid
,
np_ndn
,
e
);
...
...
@@ -647,7 +647,7 @@ return_results:
done:
if
(
new_dn
.
bv_val
!=
NULL
)
free
(
new_dn
.
bv_val
);
if
(
new_ndn
!=
NULL
)
ber_bv
free
(
new_ndn
);
if
(
new_ndn
.
bv_val
!=
NULL
)
free
(
new_ndn
.
bv_val
);
/* LDAP v2 supporting correct attribute handling. */
if
(
new_rdn_types
!=
NULL
)
charray_free
(
new_rdn_types
);
...
...
servers/slapd/back-dnssrv/search.c
View file @
975a5e9a
...
...
@@ -39,7 +39,7 @@ dnssrv_back_search(
char
*
hostlist
=
NULL
;
char
**
hosts
=
NULL
;
char
*
refdn
;
struct
berval
*
nrefdn
=
NULL
;
struct
berval
nrefdn
=
{
0
,
NULL
}
;
struct
berval
**
urls
=
NULL
;
assert
(
get_manageDSAit
(
op
)
);
...
...
@@ -114,7 +114,7 @@ dnssrv_back_search(
bv
.
bv_val
=
refdn
;
bv
.
bv_len
=
strlen
(
refdn
);
rc
=
dnNormalize
(
NULL
,
&
bv
,
&
nrefdn
);
rc
=
dnNormalize
2
(
NULL
,
&
bv
,
&
nrefdn
);
if
(
rc
!=
LDAP_SUCCESS
)
{
send_ldap_result
(
conn
,
op
,
LDAP_OTHER
,
NULL
,
"DNS SRV problem processing manageDSAit control"
,
...
...
@@ -123,7 +123,7 @@ dnssrv_back_search(
}
}
if
(
strcmp
(
nrefdn
->
bv_val
,
ndn
->
bv_val
)
!=
0
)
{
if
(
strcmp
(
nrefdn
.
bv_val
,
ndn
->
bv_val
)
!=
0
)
{
/* requested dn is subordinate */
Debug
(
LDAP_DEBUG_TRACE
,
...
...
@@ -221,8 +221,8 @@ dnssrv_back_search(
NULL
,
NULL
,
NULL
,
NULL
);
}
free
(
refdn
);
ber_bv
free
(
nrefdn
);
if
(
refdn
)
free
(
refdn
);
if
(
nrefdn
.
bv_val
)
free
(
nrefdn
.
bv_val
);
done:
if
(
domain
!=
NULL
)
ch_free
(
domain
);
...
...
servers/slapd/back-ldap/config.c
View file @
975a5e9a
...
...
@@ -114,10 +114,10 @@ ldap_back_db_config(
/* dn massaging */
}
else
if
(
strcasecmp
(
argv
[
0
],
"suffixmassage"
)
==
0
)
{
#ifndef ENABLE_REWRITE
struct
berval
*
bd2
;
struct
berval
*
bd2
,
*
nd2
;
#endif
/* ENABLE_REWRITE */
BackendDB
*
tmp_be
;
struct
berval
bdn
,
*
ndn
=
NULL
;
struct
berval
bdn
,
ndn
;
/*
* syntax:
...
...
@@ -140,14 +140,13 @@ ldap_back_db_config(
bdn
.
bv_val
=
argv
[
1
];
bdn
.
bv_len
=
strlen
(
bdn
.
bv_val
);
if
(
dnNormalize
(
NULL
,
&
bdn
,
&
ndn
)
!=
LDAP_SUCCESS
)
{
if
(
dnNormalize
2
(
NULL
,
&
bdn
,
&
ndn
)
!=
LDAP_SUCCESS
)
{
fprintf
(
stderr
,
"%s: line %d: suffix DN %s is invalid
\n
"
,
fname
,
lineno
,
bdn
.
bv_val
);
return
(
1
);
}
tmp_be
=
select_backend
(
ndn
,
0
,
0
);
ber_bvfree
(
ndn
);
ndn
=
NULL
;
tmp_be
=
select_backend
(
&
ndn
,
0
,
0
);
free
(
ndn
.
bv_val
);
if
(
tmp_be
!=
NULL
&&
tmp_be
!=
be
)
{
fprintf
(
stderr
,
"%s: line %d: suffix already in use"
" by another backend in"
...
...
@@ -159,13 +158,13 @@ ldap_back_db_config(
bdn
.
bv_val
=
argv
[
2
];
bdn
.
bv_len
=
strlen
(
bdn
.
bv_val
);
if
(
dnNormalize
(
NULL
,
&
bdn
,
&
ndn
)
!=
LDAP_SUCCESS
)
{
if
(
dnNormalize
2
(
NULL
,
&
bdn
,
&
ndn
)
!=
LDAP_SUCCESS
)
{
fprintf
(
stderr
,
"%s: line %d: suffix DN %s is invalid
\n
"
,
fname
,
lineno
,
bdn
.
bv_val
);
return
(
1
);
}
tmp_be
=
select_backend
(
ndn
,
0
,
0
);
ber_bv
free
(
ndn
);
tmp_be
=
select_backend
(
&
ndn
,
0
,
0
);
free
(
ndn
.
bv_val
);
if
(
tmp_be
!=
NULL
)
{
fprintf
(
stderr
,
"%s: line %d: massaged suffix"
" already in use by another backend in"
...
...
@@ -186,15 +185,15 @@ ldap_back_db_config(
#else
/* !ENABLE_REWRITE */
bd2
=
ber_bvstrdup
(
argv
[
1
]
);
ber_bvecadd
(
&
li
->
suffix_massage
,
bd2
);
nd
n
=
NULL
;
dnNormalize
(
NULL
,
bd2
,
&
nd
n
);
ber_bvecadd
(
&
li
->
suffix_massage
,
nd
n
);
nd
2
=
NULL
;
dnNormalize
(
NULL
,
bd2
,
&
nd
2
);
ber_bvecadd
(
&
li
->
suffix_massage
,
nd
2
);
bd2
=
ber_bvstrdup
(
argv
[
2
]
);
ber_bvecadd
(
&
li
->
suffix_massage
,
bd2
);
nd
n
=
NULL
;
dnNormalize
(
NULL
,
bd2
,
&
nd
n
);
ber_bvecadd
(
&
li
->
suffix_massage
,
nd
n
);
nd
2
=
NULL
;
dnNormalize
(
NULL
,
bd2
,
&
nd
2
);
ber_bvecadd
(
&
li
->
suffix_massage
,
nd
2
);
#endif
/* !ENABLE_REWRITE */
#ifdef ENABLE_REWRITE
...
...
servers/slapd/back-ldap/search.c
View file @
975a5e9a
...
...
@@ -418,9 +418,7 @@ ldap_send_entry(
ldap_back_dn_massage
(
li
,
&
bdn
,
&
ent
.
e_name
,
0
,
0
);
#endif
/* !ENABLE_REWRITE */
bv
=
NULL
;
dnNormalize
(
NULL
,
&
ent
.
e_name
,
&
bv
);
ent
.
e_nname
=
*
bv
;
dnNormalize2
(
NULL
,
&
ent
.
e_name
,
&
ent
.
e_nname
);
ent
.
e_id
=
0
;
ent
.
e_attrs
=
0
;
ent
.
e_private
=
0
;
...
...
servers/slapd/back-ldbm/alias.c
View file @
975a5e9a
...
...
@@ -220,8 +220,7 @@ static char* get_alias_dn(
const
char
**
errmsg
)
{
int
rc
;
char
*
dn
;
struct
berval
*
ndn
=
NULL
;
struct
berval
ndn
;
Attribute
*
a
;
AttributeDescription
*
aliasedObjectName
=
slap_schema
.
si_ad_aliasedObjectName
;
...
...
@@ -255,16 +254,14 @@ static char* get_alias_dn(
return
NULL
;
}
rc
=
dnNormalize
(
NULL
,
a
->
a_vals
[
0
],
&
ndn
);
rc
=
dnNormalize
2
(
NULL
,
a
->
a_vals
[
0
],
&
ndn
);
if
(
rc
!=
LDAP_SUCCESS
)
{
*
err
=
LDAP_ALIAS_PROBLEM
;
*
errmsg
=
"alias aliasedObjectName value is invalid"
;
return
NULL
;
}
dn
=
ndn
->
bv_val
;
free
(
ndn
);
return
dn
;
return
ndn
.
bv_val
;
}
static
char
*
new_superior
(
...
...
servers/slapd/back-ldbm/cache.c
View file @
975a5e9a
...
...
@@ -576,20 +576,20 @@ cache_find_entry_dn2id(
{
int
rc
;
struct
berval
bv
;
struct
berval
*
ndn
=
NULL
;
struct
berval
ndn
;
ID
id
;
bv
.
bv_val
=
dn
;
bv
.
bv_len
=
strlen
(
dn
);
rc
=
dnNormalize
(
NULL
,
&
bv
,
&
ndn
);
rc
=
dnNormalize
2
(
NULL
,
&
bv
,
&
ndn
);
if
(
rc
!=
LDAP_SUCCESS
)
{
return
NOID
;
}
id
=
cache_find_entry_ndn2id
(
be
,
cache
,
ndn
->
bv_val
);
id
=
cache_find_entry_ndn2id
(
be
,
cache
,
ndn
.
bv_val
);
ber_bv
free
(
ndn
);
free
(
ndn
.
bv_val
);
return
(
id
);
}
...
...
servers/slapd/back-ldbm/modrdn.c
View file @
975a5e9a
...
...
@@ -49,7 +49,7 @@ ldbm_back_modrdn(
AttributeDescription
*
children
=
slap_schema
.
si_ad_children
;
struct
ldbminfo
*
li
=
(
struct
ldbminfo
*
)
be
->
be_private
;
struct
berval
p_dn
,
p_ndn
;
struct
berval
new_dn
=
{
0
,
NULL
},
*
new_ndn
=
NULL
;
struct
berval
new_dn
=
{
0
,
NULL
},
new_ndn
=
{
0
,
NULL
}
;
Entry
*
e
,
*
p
=
NULL
;
Entry
*
matched
;
int
isroot
=
-
1
;
...
...
@@ -462,14 +462,14 @@ ldbm_back_modrdn(
/* Build target dn and make sure target entry doesn't exist already. */
build_new_dn
(
&
new_dn
,
new_parent_dn
,
newrdn
);
dnNormalize
(
NULL
,
&
new_dn
,
&
new_ndn
);
dnNormalize
2
(
NULL
,
&
new_dn
,
&
new_ndn
);
#ifdef NEW_LOGGING
LDAP_LOG
((
"backend"
,
LDAP_LEVEL_DETAIL1
,
"ldbm_back_modrdn: new ndn=%s
\n
"
,
new_ndn
->
bv_val
));
"ldbm_back_modrdn: new ndn=%s
\n
"
,
new_ndn
.
bv_val
));
#else
Debug
(
LDAP_DEBUG_TRACE
,
"ldbm_back_modrdn: new ndn=%s
\n
"
,
new_ndn
->
bv_val
,
0
,
0
);
new_ndn
.
bv_val
,
0
,
0
);
#endif
/* check for abandon */
...
...
@@ -480,7 +480,7 @@ ldbm_back_modrdn(
}
ldap_pvt_thread_mutex_unlock
(
&
op
->
o_abandonmutex
);
if
(
(
rc_id
=
dn2id
(
be
,
new_ndn
->
bv_val
,
&
id
)
)
||
id
!=
NOID
)
{
if
(
(
rc_id
=
dn2id
(
be
,
new_ndn
.
bv_val
,
&
id
)
)
||
id
!=
NOID
)
{
/* if (rc_id) something bad happened to ldbm cache */
send_ldap_result
(
conn
,
op
,
rc_id
?
LDAP_OPERATIONS_ERROR
:
LDAP_ALREADY_EXISTS
,
...
...
@@ -490,11 +490,11 @@ ldbm_back_modrdn(
#ifdef NEW_LOGGING
LDAP_LOG
((
"backend"
,
LDAP_LEVEL_INFO
,
"ldbm_back_modrdn: new ndn (%s) does not exist
\n
"
,
new_ndn
));
"ldbm_back_modrdn: new ndn (%s) does not exist
\n
"
,
new_ndn
.
bv_val
));
#else
Debug
(
LDAP_DEBUG_TRACE
,
"ldbm_back_modrdn: new ndn=%s does not exist
\n
"
,
new_ndn
,
0
,
0
);
new_ndn
.
bv_val
,
0
,
0
);
#endif
...
...
@@ -751,9 +751,9 @@ ldbm_back_modrdn(
free
(
e
->
e_dn
);
free
(
e
->
e_ndn
);
e
->
e_name
=
new_dn
;
e
->
e_nname
=
*
new_ndn
;
e
->
e_nname
=
new_ndn
;
new_dn
.
bv_val
=
NULL
;
new_ndn
=
NULL
;
new_ndn
.
bv_val
=
NULL
;
/* add new one */
if
(
dn2id_add
(
be
,
e
->
e_ndn
,
e
->
e_id
)
!=
0
)
{
...
...
@@ -801,7 +801,7 @@ ldbm_back_modrdn(
return_results:
if
(
new_dn
.
bv_val
!=
NULL
)
free
(
new_dn
.
bv_val
);
if
(
new_ndn
!=
NULL
)
ber_bv
free
(
new_ndn
);
if
(
new_ndn
.
bv_val
!=
NULL
)
free
(
new_ndn
.
bv_val
);
/* LDAP v2 supporting correct attribute handling. */
if
(
new_rdn_types
!=
NULL
)
charray_free
(
new_rdn_types
);
...
...
servers/slapd/back-ldbm/passwd.c
View file @
975a5e9a
...
...
@@ -39,7 +39,7 @@ ldbm_back_exop_passwd(
struct
berval
*
new
=
NULL
;
struct
berval
dn
;
struct
berval
*
ndn
=
NULL
;
struct
berval
ndn
;
assert
(
reqoid
!=
NULL
);
assert
(
strcmp
(
LDAP_EXOP_X_MODIFY_PASSWD
,
reqoid
)
==
0
);
...
...
@@ -102,13 +102,13 @@ ldbm_back_exop_passwd(
goto
done
;
}
rc
=
dnNormalize
(
NULL
,
&
dn
,
&
ndn
);
rc
=
dnNormalize
2
(
NULL
,
&
dn
,
&
ndn
);
if
(
rc
!=
LDAP_SUCCESS
)
{
*
text
=
"Invalid DN"
;
goto
done
;
}
e
=
dn2entry_w
(
be
,
ndn
->
bv_val
,
NULL
);
e
=
dn2entry_w
(
be
,
ndn
.
bv_val
,
NULL
);
if
(
e
==
NULL
)
{
*
text
=
"could not locate authorization entry"
;
rc
=
LDAP_NO_SUCH_OBJECT
;
...
...
@@ -187,8 +187,8 @@ done:
ber_bvfree
(
hash
);
}
if
(
ndn
!=
NULL
)
{
ber_bv
free
(
ndn
);
if
(
ndn
.
bv_val
!=
NULL
)
{
free
(
ndn
.
bv_val
);
}
return
rc
;
...
...
servers/slapd/back-meta/attribute.c
View file @
975a5e9a
...
...
@@ -147,8 +147,8 @@ meta_back_attribute(
return
1
;
}
rc
=
ldap_bind_s
(
ld
,
li
->
targets
[
candidate
]
->
binddn
->
bv_val
,
li
->
targets
[
candidate
]
->
bindpw
->
bv_val
,
LDAP_AUTH_SIMPLE
);
rc
=
ldap_bind_s
(
ld
,
li
->
targets
[
candidate
]
->
binddn
.
bv_val
,
li
->
targets
[
candidate
]
->
bindpw
.
bv_val
,
LDAP_AUTH_SIMPLE
);
if
(
rc
!=
LDAP_SUCCESS
)
{
return
1
;
}
...
...
servers/slapd/back-meta/back-meta.h
View file @
975a5e9a
...
...
@@ -113,13 +113,13 @@ struct metaconn {
struct
metatarget
{
char
*
uri
;
struct
berval
*
psuffix
;
/* pretty suffix */
struct
berval
*
suffix
;
/* normalized suffix */
struct
berval
*
binddn
;
struct
berval
*
bindpw
;
struct
berval
psuffix
;
/* pretty suffix */
struct
berval
suffix
;
/* normalized suffix */
struct
berval
binddn
;
struct
berval
bindpw
;
struct
berval
*
pseudorootdn
;
struct
berval
*
pseudorootpw
;
struct
berval
pseudorootdn
;
struct
berval
pseudorootpw
;
struct
rewrite_info
*
rwinfo
;
...
...
servers/slapd/back-meta/bind.c
View file @
975a5e9a
...
...
@@ -166,10 +166,10 @@ meta_back_bind(
#endif
/* !NEW_LOGGING */
}
if
(
isroot
&&
li
->
targets
[
i
]
->
pseudorootdn
!=
NULL
)
{
realdn
=
li
->
targets
[
i
]
->
pseudorootdn
;
realndn
=
li
->
targets
[
i
]
->
pseudorootdn
;
realcred
=
li
->
targets
[
i
]
->
pseudorootpw
;
if
(
isroot
&&
li
->
targets
[
i
]
->
pseudorootdn
.
bv_val
!=
NULL
)
{
realdn
=
&
li
->
targets
[
i
]
->
pseudorootdn
;
realndn
=
&
li
->
targets
[
i
]
->
pseudorootdn
;
realcred
=
&
li
->
targets
[
i
]
->
pseudorootpw
;
realmethod
=
LDAP_AUTH_SIMPLE
;
}
...
...
servers/slapd/back-meta/candidates.c
View file @
975a5e9a
...
...
@@ -139,7 +139,7 @@ meta_back_count_candidates(
assert
(
li
->
ntargets
!=
0
);
for
(
i
=
0
;
i
<
li
->
ntargets
;
++
i
)
{
if
(
meta_back_is_candidate
(
li
->
targets
[
i
]
->
suffix
,
ndn
)
)
{
if
(
meta_back_is_candidate
(
&
li
->
targets
[
i
]
->
suffix
,
ndn
)
)
{
++
cnt
;
}
}
...
...
@@ -187,7 +187,7 @@ meta_back_select_unique_candidate(
}
for
(
i
=
0
;
i
<
li
->
ntargets
;
++
i
)
{
if
(
meta_back_is_candidate
(
li
->
targets
[
i
]
->
suffix
,
ndn
)
)
{
if
(
meta_back_is_candidate
(
&
li
->
targets
[
i
]
->
suffix
,
ndn
)
)
{
return
i
;
}
}
...
...
servers/slapd/back-meta/config.c
View file @
975a5e9a
...
...
@@ -202,7 +202,8 @@ meta_back_db_config(
dn
.
bv_val
=
ludp
->
lud_dn
;
dn
.
bv_len
=
strlen
(
ludp
->
lud_dn
);
rc
=
dnPretty
(
NULL
,
&
dn
,
&
pdn
);
rc
=
dnPrettyNormal
(
NULL
,
&
dn
,
&
li
->
targets
[
i
]
->
psuffix
,
&
li
->
targets
[
i
]
->
suffix
);
if
(
rc
!=
LDAP_SUCCESS
)
{
fprintf
(
stderr
,
"%s: line %d: "
"target '%s' DN is invalid
\n
"
,
...
...
@@ -210,18 +211,6 @@ meta_back_db_config(
return
(
1
);
}
rc
=
dnNormalize
(
NULL
,
&
dn
,
&
ndn
);
if
(
rc
!=
LDAP_SUCCESS
)
{
fprintf
(
stderr
,
"%s: line %d: "
"target '%s' DN is invalid
\n
"
,
fname
,
lineno
,
argv
[
1
]
);
ber_bvfree
(
ndn
);
return
(
1
);
}
li
->
targets
[
i
]
->
psuffix
=
pdn
;
li
->
targets
[
i
]
->
suffix
=
ndn
;
li
->
targets
[
i
]
->
uri
=
ch_strdup
(
argv
[
1
]
);
last
=
strstr
(
li
->
targets
[
i
]
->
uri
,
ludp
->
lud_dn
);
assert
(
last
!=
NULL
);
...
...
@@ -231,7 +220,7 @@ meta_back_db_config(
* uri MUST be a branch of suffix!
*/
#if 0 /* too strict a constraint */
if ( select_backend( li->targets[ i ]->suffix, 0, 0 ) != be ) {