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
b8edef2b
Commit
b8edef2b
authored
25 years ago
by
Kurt Zeilenga
Browse files
Options
Downloads
Patches
Plain Diff
Copy LDBM bind "ACL_AUTH" and SASL framework to bdb2.
parent
7541ccbe
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/back-bdb2/bind.c
+59
-13
59 additions, 13 deletions
servers/slapd/back-bdb2/bind.c
servers/slapd/back-ldbm/bind.c
+20
-5
20 additions, 5 deletions
servers/slapd/back-ldbm/bind.c
tests/data/slapd-bdb2-acl.conf
+11
-4
11 additions, 4 deletions
tests/data/slapd-bdb2-acl.conf
with
90 additions
and
22 deletions
servers/slapd/back-bdb2/bind.c
+
59
−
13
View file @
b8edef2b
...
...
@@ -65,6 +65,7 @@ bdb2i_back_bind_internal(
Operation
*
op
,
char
*
dn
,
int
method
,
char
*
mech
,
struct
berval
*
cred
,
char
**
edn
)
...
...
@@ -86,17 +87,33 @@ bdb2i_back_bind_internal(
/* get entry with reader lock */
if
(
(
e
=
bdb2i_dn2entry_r
(
be
,
dn
,
&
matched
))
==
NULL
)
{
/* allow noauth binds */
if
(
method
==
LDAP_AUTH_SIMPLE
&&
cred
->
bv_len
==
0
)
{
/*
* bind successful, but return 1 so we don't
* authorize based on noauth credentials
*/
send_ldap_result
(
conn
,
op
,
LDAP_SUCCESS
,
NULL
,
NULL
);
rc
=
1
;
}
else
if
(
be_isroot_pw
(
be
,
dn
,
cred
)
)
{
/* front end will send result */
*
edn
=
ch_strdup
(
be_root_dn
(
be
)
);
rc
=
0
;
rc
=
1
;
if
(
method
==
LDAP_AUTH_SIMPLE
)
{
if
(
cred
->
bv_len
==
0
)
{
/* SUCCESS */
send_ldap_result
(
conn
,
op
,
LDAP_SUCCESS
,
NULL
,
NULL
);
}
else
if
(
be_isroot_pw
(
be
,
dn
,
cred
)
)
{
/* front end will send result */
*
edn
=
ch_strdup
(
be_root_dn
(
be
)
);
rc
=
0
;
}
else
{
send_ldap_result
(
conn
,
op
,
LDAP_NO_SUCH_OBJECT
,
matched
,
NULL
);
}
}
else
if
(
method
==
LDAP_AUTH_SASL
)
{
if
(
mech
!=
NULL
&&
strcasecmp
(
mech
,
"DIGEST-MD5"
)
==
0
)
{
/* insert DIGEST calls here */
send_ldap_result
(
conn
,
op
,
LDAP_AUTH_METHOD_NOT_SUPPORTED
,
NULL
,
NULL
);
}
else
{
send_ldap_result
(
conn
,
op
,
LDAP_AUTH_METHOD_NOT_SUPPORTED
,
NULL
,
NULL
);
}
}
else
{
send_ldap_result
(
conn
,
op
,
LDAP_NO_SUCH_OBJECT
,
matched
,
NULL
);
rc
=
1
;
...
...
@@ -111,6 +128,14 @@ bdb2i_back_bind_internal(
/* check for deleted */
if
(
!
access_allowed
(
be
,
conn
,
op
,
e
,
"entry"
,
NULL
,
ACL_AUTH
)
)
{
send_ldap_result
(
conn
,
op
,
LDAP_INSUFFICIENT_ACCESS
,
""
,
""
);
rc
=
1
;
goto
return_results
;
}
switch
(
method
)
{
case
LDAP_AUTH_SIMPLE
:
if
(
cred
->
bv_len
==
0
)
{
...
...
@@ -130,6 +155,14 @@ bdb2i_back_bind_internal(
goto
return_results
;
}
if
(
!
access_allowed
(
be
,
conn
,
op
,
e
,
"userpassword"
,
NULL
,
ACL_AUTH
)
)
{
send_ldap_result
(
conn
,
op
,
LDAP_INSUFFICIENT_ACCESS
,
""
,
""
);
rc
=
1
;
goto
return_results
;
}
if
(
(
a
=
attr_find
(
e
->
e_attrs
,
"userpassword"
))
==
NULL
)
{
send_ldap_result
(
conn
,
op
,
LDAP_INAPPROPRIATE_AUTH
,
NULL
,
NULL
);
...
...
@@ -155,11 +188,21 @@ bdb2i_back_bind_internal(
if
(
bdb2i_krbv4_ldap_auth
(
be
,
cred
,
&
ad
)
!=
LDAP_SUCCESS
)
{
send_ldap_result
(
conn
,
op
,
LDAP_INVALID_CREDENTIALS
,
NULL
,
NULL
);
rc
=
0
;
rc
=
1
;
goto
return_results
;
}
if
(
!
access_allowed
(
be
,
conn
,
op
,
e
,
"krbname"
,
NULL
,
ACL_AUTH
)
)
{
send_ldap_result
(
conn
,
op
,
LDAP_INSUFFICIENT_ACCESS
,
""
,
""
);
rc
=
1
;
goto
return_results
;
}
sprintf
(
krbname
,
"%s%s%s@%s"
,
ad
.
pname
,
*
ad
.
pinst
?
"."
:
""
,
ad
.
pinst
,
ad
.
prealm
);
if
(
(
a
=
attr_find
(
e
->
e_attrs
,
"krbname"
))
==
NULL
)
{
/*
* no krbName values present: check against DN
...
...
@@ -195,6 +238,9 @@ bdb2i_back_bind_internal(
goto
return_results
;
#endif
case
LDAP_AUTH_SASL
:
/* insert sasl code here */
default:
send_ldap_result
(
conn
,
op
,
LDAP_STRONG_AUTH_NOT_SUPPORTED
,
NULL
,
"auth method not supported"
);
...
...
@@ -237,7 +283,7 @@ bdb2_back_bind(
}
ret
=
bdb2i_back_bind_internal
(
be
,
conn
,
op
,
dn
,
method
,
cred
,
edn
);
ret
=
bdb2i_back_bind_internal
(
be
,
conn
,
op
,
dn
,
method
,
mech
,
cred
,
edn
);
(
void
)
bdb2i_leave_backend_r
(
lock
);
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/back-ldbm/bind.c
+
20
−
5
View file @
b8edef2b
...
...
@@ -98,16 +98,19 @@ ldbm_back_bind(
rc
=
0
;
/* front end will send result */
}
else
{
send_ldap_result
(
conn
,
op
,
LDAP_NO_SUCH_OBJECT
,
matched
,
NULL
);
send_ldap_result
(
conn
,
op
,
LDAP_NO_SUCH_OBJECT
,
matched
,
NULL
);
}
}
else
if
(
method
==
LDAP_AUTH_SASL
)
{
if
(
mech
!=
NULL
&&
strcasecmp
(
mech
,
"DIGEST-MD5"
)
)
{
if
(
mech
!=
NULL
&&
strcasecmp
(
mech
,
"DIGEST-MD5"
)
==
0
)
{
/* insert DIGEST calls here */
send_ldap_result
(
conn
,
op
,
LDAP_INAPPROPRIATE_AUTH
,
NULL
,
NULL
);
send_ldap_result
(
conn
,
op
,
LDAP_AUTH_METHOD_NOT_SUPPORTED
,
NULL
,
NULL
);
}
else
{
send_ldap_result
(
conn
,
op
,
LDAP_INAPPROPRIATE_AUTH
,
NULL
,
NULL
);
send_ldap_result
(
conn
,
op
,
LDAP_AUTH_METHOD_NOT_SUPPORTED
,
NULL
,
NULL
);
}
}
else
{
...
...
@@ -193,13 +196,22 @@ ldbm_back_bind(
if
(
krbv4_ldap_auth
(
be
,
cred
,
&
ad
)
!=
LDAP_SUCCESS
)
{
send_ldap_result
(
conn
,
op
,
LDAP_INVALID_CREDENTIALS
,
NULL
,
NULL
);
rc
=
0
;
rc
=
1
;
goto
return_results
;
}
if
(
!
access_allowed
(
be
,
conn
,
op
,
e
,
"krbname"
,
NULL
,
ACL_AUTH
)
)
{
send_ldap_result
(
conn
,
op
,
LDAP_INSUFFICIENT_ACCESS
,
""
,
""
);
rc
=
1
;
goto
return_results
;
}
sprintf
(
krbname
,
"%s%s%s@%s"
,
ad
.
pname
,
*
ad
.
pinst
?
"."
:
""
,
ad
.
pinst
,
ad
.
prealm
);
if
(
(
a
=
attr_find
(
e
->
e_attrs
,
"krbname"
))
==
NULL
)
{
/*
* no krbName values present: check against DN
...
...
@@ -236,6 +248,9 @@ ldbm_back_bind(
goto
return_results
;
#endif
case
LDAP_AUTH_SASL
:
/* insert SASL code here */
default:
send_ldap_result
(
conn
,
op
,
LDAP_STRONG_AUTH_NOT_SUPPORTED
,
NULL
,
"auth method not supported"
);
...
...
This diff is collapsed.
Click to expand it.
tests/data/slapd-bdb2-acl.conf
+
11
−
4
View file @
b8edef2b
...
...
@@ -24,19 +24,26 @@ index cn,sn,uid pres,eq,approx
index
default
none
lastmod
on
defaultaccess
none
access
to
attr
=
objectclass
by
*
read
access
to
attr
=
userpassword
access
to
filter
=
"objectclass=person"
attr
=
userpassword
by
self
write
by
*
compare
by
anonymous
auth
by
*
none
access
to
dn
=
".*,ou=Alumni Association,ou=People,o=University of Michigan,c=US"
by
dn
=
".*,o=University of Michigan,c=US"
read
by
dn
=
".*,o=University of Michigan,c=US"
read
by
anonymous
auth
by
*
none
access
to
attr
=
member
by
dnattr
=
member
selfwrite
by
*
read
access
to
filter
=
"objectclass=rfc822mailgroup"
by
dn
=
"Bjorn Jensen,ou=Information Technology Division,ou=People,o=University of Michigan,c=US"
write
by
*
read
access
to
*
by
*
read
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