Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
Bugzilla
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
openldap
OpenLDAP
Commits
4a9213f7
Commit
4a9213f7
authored
22 years ago
by
Luke Howard
Browse files
Options
Downloads
Patches
Plain Diff
Distinguish between AUTHTYPE and AUTHMETHOD (latter is static storage)
for Sun ONE harmonisation
parent
30d94695
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/slapi_pblock.c
+0
-6
0 additions, 6 deletions
servers/slapd/slapi/slapi_pblock.c
servers/slapd/slapi/slapi_utils.c
+30
-10
30 additions, 10 deletions
servers/slapd/slapi/slapi_utils.c
with
30 additions
and
16 deletions
servers/slapd/slapi/slapi_pblock.c
+
0
−
6
View file @
4a9213f7
...
...
@@ -367,12 +367,6 @@ slapi_pblock_destroy( Slapi_PBlock* pb )
str
=
NULL
;
}
get
(
pb
,
SLAPI_CONN_AUTHTYPE
,
(
void
**
)
&
str
);
if
(
str
!=
NULL
)
{
ch_free
(
str
);
str
=
NULL
;
}
get
(
pb
,
SLAPI_CONN_AUTHMETHOD
,
(
void
**
)
&
str
);
if
(
str
!=
NULL
)
{
ch_free
(
str
);
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/slapi/slapi_utils.c
+
30
−
10
View file @
4a9213f7
...
...
@@ -1151,29 +1151,43 @@ int slapi_x_backend_set_pb( Slapi_PBlock *pb, Backend *be )
}
#if defined(LDAP_SLAPI)
static
char
*
Authorization2AuthType
(
AuthorizationInformation
*
authz
,
int
is_tls
)
/*
* If oldStyle is TRUE, then a value suitable for setting to
* the deprecated SLAPI_CONN_AUTHTYPE value is returned
* (pointer to static storage).
*
* If oldStyle is FALSE, then a value suitable for setting to
* the new SLAPI_CONN_AUTHMETHOD will be returned, which is
* a pointer to allocated memory and will include the SASL
* mechanism (if any).
*/
static
char
*
Authorization2AuthType
(
AuthorizationInformation
*
authz
,
int
is_tls
,
int
oldStyle
)
{
size_t
len
;
char
*
authType
;
switch
(
authz
->
sai_method
)
{
case
LDAP_AUTH_SASL
:
len
=
sizeof
(
SLAPD_AUTH_SASL
)
+
authz
->
sai_mech
.
bv_len
;
authType
=
slapi_ch_malloc
(
len
);
snprintf
(
authType
,
len
,
"%s%s"
,
SLAPD_AUTH_SASL
,
authz
->
sai_mech
.
bv_val
);
case
LDAP_AUTH_SASL
:
if
(
oldStyle
)
{
authType
=
SLAPD_AUTH_SASL
;
}
else
{
len
=
sizeof
(
SLAPD_AUTH_SASL
)
+
authz
->
sai_mech
.
bv_len
;
authType
=
slapi_ch_malloc
(
len
);
snprintf
(
authType
,
len
,
"%s%s"
,
SLAPD_AUTH_SASL
,
authz
->
sai_mech
.
bv_val
);
}
break
;
case
LDAP_AUTH_SIMPLE
:
authType
=
slapi_ch_strdup
(
SLAPD_AUTH_SIMPLE
);
authType
=
oldStyle
?
SLAPD_AUTH_SIMPLE
:
slapi_ch_strdup
(
SLAPD_AUTH_SIMPLE
);
break
;
case
LDAP_AUTH_NONE
:
authType
=
slapi_ch_strdup
(
SLAPD_AUTH_NONE
);
authType
=
oldStyle
?
SLAPD_AUTH_NONE
:
slapi_ch_strdup
(
SLAPD_AUTH_NONE
);
break
;
default:
authType
=
NULL
;
break
;
}
if
(
is_tls
&&
authType
==
NULL
)
{
authType
=
slapi_ch_strdup
(
SLAPD_AUTH_SSL
);
authType
=
oldStyle
?
SLAPD_AUTH_SSL
:
slapi_ch_strdup
(
SLAPD_AUTH_SSL
);
}
return
authType
;
...
...
@@ -1209,16 +1223,22 @@ int slapi_x_connection_set_pb( Slapi_PBlock *pb, Connection *conn )
if
(
rc
!=
LDAP_SUCCESS
)
return
rc
;
connAuthType
=
Authorization2AuthType
(
&
conn
->
c_authz
,
conn
->
c_is_tls
);
/* Returns pointer to static string */
connAuthType
=
Authorization2AuthType
(
&
conn
->
c_authz
,
conn
->
c_is_tls
,
1
);
if
(
connAuthType
!=
NULL
)
{
rc
=
slapi_pblock_set
(
pb
,
SLAPI_CONN_AUTHTYPE
,
(
void
*
)
connAuthType
);
if
(
rc
!=
LDAP_SUCCESS
)
return
rc
;
}
/* Returns pointer to allocated string */
connAuthType
=
Authorization2AuthType
(
&
conn
->
c_authz
,
conn
->
c_is_tls
,
0
);
if
(
connAuthType
!=
NULL
)
{
rc
=
slapi_pblock_set
(
pb
,
SLAPI_CONN_AUTHMETHOD
,
(
void
*
)
connAuthType
);
if
(
rc
!=
LDAP_SUCCESS
)
return
rc
;
}
if
(
conn
->
c_authz
.
sai_dn
.
bv_val
!=
NULL
)
{
char
*
connDn
=
slapi_ch_strdup
(
conn
->
c_authz
.
sai_dn
.
bv_val
);
rc
=
slapi_pblock_set
(
pb
,
SLAPI_CONN_DN
,
(
void
*
)
connDn
);
...
...
@@ -1282,7 +1302,7 @@ int slapi_x_operation_set_pb( Slapi_PBlock *pb, Operation *op )
if
(
rc
!=
LDAP_SUCCESS
)
return
rc
;
opAuthType
=
Authorization2AuthType
(
&
op
->
o_authz
,
op
->
o_conn
->
c_is_tls
);
opAuthType
=
Authorization2AuthType
(
&
op
->
o_authz
,
op
->
o_conn
->
c_is_tls
,
1
);
if
(
opAuthType
!=
NULL
)
{
rc
=
slapi_pblock_set
(
pb
,
SLAPI_OPERATION_AUTHTYPE
,
(
void
*
)
opAuthType
);
if
(
rc
!=
LDAP_SUCCESS
)
...
...
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