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
42a20681
Commit
42a20681
authored
24 years ago
by
Kurt Zeilenga
Browse files
Options
Downloads
Patches
Plain Diff
SASL closer to working from frontend only, need to work through
states.
parent
55ae3cff
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
servers/slapd/bind.c
+12
-0
12 additions, 0 deletions
servers/slapd/bind.c
servers/slapd/connection.c
+3
-7
3 additions, 7 deletions
servers/slapd/connection.c
servers/slapd/sasl.c
+15
-15
15 additions, 15 deletions
servers/slapd/sasl.c
with
30 additions
and
22 deletions
servers/slapd/bind.c
+
12
−
0
View file @
42a20681
...
...
@@ -184,6 +184,8 @@ do_bind(
ldap_pvt_thread_mutex_unlock
(
&
conn
->
c_mutex
);
if
(
method
==
LDAP_AUTH_SASL
)
{
char
*
edn
;
if
(
version
<
LDAP_VERSION3
)
{
Debug
(
LDAP_DEBUG_ANY
,
"do_bind: sasl with LDAPv%ld
\n
"
,
(
unsigned
long
)
version
,
0
,
0
);
...
...
@@ -238,6 +240,16 @@ do_bind(
}
ldap_pvt_thread_mutex_unlock
(
&
conn
->
c_mutex
);
edn
=
NULL
;
rc
=
sasl_bind
(
conn
,
op
,
dn
,
ndn
,
mech
,
&
cred
,
&
edn
);
if
(
rc
==
LDAP_SUCCESS
&&
edn
!=
NULL
)
{
ldap_pvt_thread_mutex_lock
(
&
conn
->
c_mutex
);
conn
->
c_dn
=
edn
;
ldap_pvt_thread_mutex_unlock
(
&
conn
->
c_mutex
);
}
goto
cleanup
;
}
else
{
/* Not SASL, cancel any in-progress bind */
ldap_pvt_thread_mutex_lock
(
&
conn
->
c_mutex
);
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/connection.c
+
3
−
7
View file @
42a20681
...
...
@@ -817,16 +817,12 @@ operations_error:
break
;
case
LDAP_REQ_BIND
:
conn
->
c_sasl_bind_in_progress
=
rc
==
LDAP_SASL_BIND_IN_PROGRESS
?
1
:
0
;
if
(
conn
->
c_conn_state
==
SLAP_C_BINDING
)
{
conn
->
c_conn_state
=
SLAP_C_ACTIVE
;
}
/*
* Is this ever the case? For now, rely on
* the backend to set this.
*/
if
(
rc
==
LDAP_SASL_BIND_IN_PROGRESS
)
{
conn
->
c_sasl_bind_in_progress
=
1
;
}
}
ldap_pvt_thread_mutex_lock
(
&
active_threads_mutex
);
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/sasl.c
+
15
−
15
View file @
42a20681
...
...
@@ -134,7 +134,7 @@ int sasl_bind(
char
*
ndn
,
char
*
mech
,
struct
berval
*
cred
,
char
**
edn
)
char
**
edn
)
{
struct
berval
response
;
const
char
*
errstr
;
...
...
@@ -180,7 +180,7 @@ int sasl_bind(
callbacks
,
SASL_SECURITY_LAYER
,
&
conn
->
c_sasl_bind_context
);
if
(
sc
!=
SASL_OK
)
{
send_ldap_result
(
conn
,
op
,
LDAP_AUTH_METHOD_NOT_SUPPORTED
,
send_ldap_result
(
conn
,
op
,
rc
=
LDAP_AUTH_METHOD_NOT_SUPPORTED
,
NULL
,
NULL
,
NULL
,
NULL
);
}
else
{
conn
->
c_authmech
=
ch_strdup
(
mech
);
...
...
@@ -188,7 +188,7 @@ int sasl_bind(
cred
->
bv_val
,
cred
->
bv_len
,
(
char
**
)
&
response
.
bv_val
,
(
unsigned
*
)
&
response
.
bv_len
,
&
errstr
);
if
(
(
sc
!=
SASL_OK
)
&&
(
sc
!=
SASL_CONTINUE
)
)
{
send_ldap_result
(
conn
,
op
,
ldap_pvt_sasl_err2ldap
(
sc
),
send_ldap_result
(
conn
,
op
,
rc
=
ldap_pvt_sasl_err2ldap
(
sc
),
NULL
,
errstr
,
NULL
,
NULL
);
}
}
...
...
@@ -196,7 +196,7 @@ int sasl_bind(
sc
=
sasl_server_step
(
conn
->
c_sasl_bind_context
,
cred
->
bv_val
,
cred
->
bv_len
,
(
char
**
)
&
response
.
bv_val
,
(
unsigned
*
)
&
response
.
bv_len
,
&
errstr
);
if
(
(
sc
!=
SASL_OK
)
&&
(
sc
!=
SASL_CONTINUE
)
)
{
send_ldap_result
(
conn
,
op
,
ldap_pvt_sasl_err2ldap
(
sc
),
send_ldap_result
(
conn
,
op
,
rc
=
ldap_pvt_sasl_err2ldap
(
sc
),
NULL
,
errstr
,
NULL
,
NULL
);
}
}
...
...
@@ -206,30 +206,30 @@ int sasl_bind(
if
(
(
sc
=
sasl_getprop
(
conn
->
c_sasl_bind_context
,
SASL_USERNAME
,
(
void
**
)
&
authzid
)
)
!=
SASL_OK
)
{
send_ldap_result
(
conn
,
op
,
ldap_pvt_sasl_err2ldap
(
sc
),
send_ldap_result
(
conn
,
op
,
rc
=
ldap_pvt_sasl_err2ldap
(
sc
),
NULL
,
NULL
,
NULL
,
NULL
);
}
else
{
if
(
*
edn
!=
NULL
)
{
free
(
*
edn
);
}
if
(
strcasecmp
(
authzid
,
"anonymous"
)
==
0
)
{
*
edn
=
ch_strdup
(
""
);
}
else
{
if
(
strncasecmp
(
authzid
,
"anonymous"
,
sizeof
(
"anonyous"
)
-
1
)
&&
(
(
authzid
[
sizeof
(
"anonymous"
)]
==
'\0'
)
||
(
authzid
[
sizeof
(
"anonymous"
)]
==
'@'
)
)
)
{
*
edn
=
ch_malloc
(
sizeof
(
"authzid="
)
+
strlen
(
authzid
)
);
strcpy
(
*
edn
,
"authzid="
);
strcat
(
*
edn
,
authzid
);
}
/* let FE send result */
rc
=
0
;
send_ldap_result
(
conn
,
op
,
rc
=
LDAP_SUCCESS
,
NULL
,
NULL
,
NULL
,
NULL
);
}
}
else
if
(
sc
==
SASL_CONTINUE
)
{
/*
* We set c_sasl_bind_in_progress because it doesn't appear
* that connection.c sets this (unless do_bind() itself
* returns LDAP_SASL_BIND_IN_PROGRESS).
*/
conn
->
c_sasl_bind_in_progress
=
1
;
send_ldap_sasl
(
conn
,
op
,
LDAP_SASL_BIND_IN_PROGRESS
,
send_ldap_sasl
(
conn
,
op
,
rc
=
LDAP_SASL_BIND_IN_PROGRESS
,
NULL
,
NULL
,
NULL
,
NULL
,
&
response
);
}
...
...
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