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
openldap
OpenLDAP
Commits
acc740d5
Commit
acc740d5
authored
Jun 21, 2000
by
Mark Valence
Browse files
Add ldap_back_attribute to ldap backend
parent
3b7d3568
Changes
4
Hide whitespace changes
Inline
Side-by-side
servers/slapd/back-ldap/Makefile.in
View file @
acc740d5
# $OpenLDAP$
SRCS
=
init.c config.c search.c bind.c unbind.c add.c compare.c
\
delete.c modify.c modrdn.c group.c
delete.c modify.c modrdn.c group.c
attribute.c
OBJS
=
init.lo config.lo search.lo bind.lo unbind.lo add.lo compare.lo
\
delete.lo modify.lo modrdn.lo group.lo
delete.lo modify.lo modrdn.lo group.lo
attribute.lo
LDAP_INCDIR
=
../../../include
LDAP_LIBDIR
=
../../../libraries
...
...
servers/slapd/back-ldap/attribute.c
0 → 100644
View file @
acc740d5
/* group.c - ldap backend acl group routine */
/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include
"portable.h"
#include
<stdio.h>
#include
<ac/socket.h>
#include
<ac/string.h>
#include
"slap.h"
#include
"back-ldap.h"
/* return 0 IFF we can retrieve the attributes
* of entry with e_ndn
*/
int
ldap_back_attribute
(
Backend
*
be
,
Connection
*
conn
,
Operation
*
op
,
Entry
*
target
,
const
char
*
e_ndn
,
AttributeDescription
*
entry_at
,
const
char
***
vals
)
{
struct
ldapinfo
*
li
=
(
struct
ldapinfo
*
)
be
->
be_private
;
int
rc
=
1
,
i
,
j
;
Attribute
*
attr
;
struct
berval
**
abv
;
char
*
s
,
**
v
;
LDAPMessage
*
result
,
*
e
;
char
*
gattr
[
2
];
LDAP
*
ld
;
*
vals
=
NULL
;
if
(
target
!=
NULL
&&
strcmp
(
target
->
e_ndn
,
e_ndn
)
==
0
)
{
/* we already have a copy of the entry */
if
((
attr
=
attr_find
(
target
->
e_attrs
,
entry_at
))
==
NULL
)
return
(
1
);
for
(
i
=
0
;
attr
->
a_vals
[
i
]
!=
NULL
;
i
++
)
{
}
v
=
(
char
**
)
ch_calloc
(
(
i
+
1
),
sizeof
(
char
*
)
);
if
(
v
!=
NULL
)
{
for
(
j
=
0
,
abv
=
attr
->
a_vals
;
--
i
>=
0
;
abv
++
)
{
if
(
(
*
abv
)
->
bv_len
>
0
)
{
s
=
ch_malloc
(
(
*
abv
)
->
bv_len
+
1
);
if
(
s
==
NULL
)
break
;
memcpy
(
s
,
(
*
abv
)
->
bv_val
,
(
*
abv
)
->
bv_len
);
s
[(
*
abv
)
->
bv_len
]
=
0
;
v
[
j
++
]
=
s
;
}
}
v
[
j
]
=
NULL
;
*
vals
=
v
;
rc
=
0
;
}
}
else
{
if
(
ldap_initialize
(
&
ld
,
li
->
url
)
!=
LDAP_SUCCESS
)
{
return
(
1
);
}
if
(
ldap_bind_s
(
ld
,
li
->
binddn
,
li
->
bindpw
,
LDAP_AUTH_SIMPLE
)
==
LDAP_SUCCESS
)
{
gattr
[
0
]
=
entry_at
->
ad_cname
->
bv_val
;
gattr
[
1
]
=
NULL
;
if
(
ldap_search_ext_s
(
ld
,
e_ndn
,
LDAP_SCOPE_BASE
,
"(objectclass=*)"
,
gattr
,
0
,
NULL
,
NULL
,
LDAP_NO_LIMIT
,
LDAP_NO_LIMIT
,
&
result
)
==
LDAP_SUCCESS
)
{
if
((
e
=
ldap_first_entry
(
ld
,
result
))
!=
NULL
)
{
*
vals
=
ldap_get_values
(
ld
,
e
,
entry_at
->
ad_cname
->
bv_val
);
if
(
*
vals
!=
NULL
)
rc
=
0
;
}
ldap_msgfree
(
result
);
}
}
ldap_unbind
(
ld
);
}
return
(
rc
);
}
servers/slapd/back-ldap/external.h
View file @
acc740d5
...
...
@@ -62,6 +62,13 @@ extern int ldap_back_group LDAP_P(( BackendDB *bd,
ObjectClass
*
group_oc
,
AttributeDescription
*
group_at
));
extern
int
ldap_back_attribute
LDAP_P
((
BackendDB
*
bd
,
Connection
*
conn
,
Operation
*
op
,
Entry
*
target
,
const
char
*
e_ndn
,
AttributeDescription
*
entry_at
,
const
char
***
vals
));
LDAP_END_DECL
#endif
/* _LDAP_EXTERNAL_H */
...
...
servers/slapd/back-ldap/init.c
View file @
acc740d5
...
...
@@ -75,7 +75,7 @@ ldap_back_initialize(
bi
->
bi_extended
=
0
;
bi
->
bi_acl_group
=
ldap_back_group
;
bi
->
bi_acl_attribute
=
0
;
bi
->
bi_acl_attribute
=
ldap_back_attribute
;
bi
->
bi_chk_referrals
=
0
;
#ifdef HAVE_CYRUS_SASL
...
...
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