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
7ad384d9
Commit
7ad384d9
authored
17 years ago
by
Howard Chu
Browse files
Options
Downloads
Patches
Plain Diff
ITS#5159 slap_passwd_parse fix from HEAD
parent
1ad33ee3
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-ldap/extended.c
+7
-6
7 additions, 6 deletions
servers/slapd/back-ldap/extended.c
servers/slapd/overlays/rwm.c
+3
-0
3 additions, 0 deletions
servers/slapd/overlays/rwm.c
servers/slapd/passwd.c
+17
-6
17 additions, 6 deletions
servers/slapd/passwd.c
with
27 additions
and
12 deletions
servers/slapd/back-ldap/extended.c
+
7
−
6
View file @
7ad384d9
...
...
@@ -125,11 +125,9 @@ ldap_back_exop_passwd(
assert
(
rs
->
sr_ctrls
==
NULL
);
if
(
BER_BVISNULL
(
&
ndn
)
&&
op
->
ore_reqdata
!=
NULL
)
{
/* NOTE: most of this code is mutuated
* from slap_passwd_parse(); we can't call
* that function since now the request data
* has been destroyed by NULL-terminating
* the bervals. Luckily enough, we only need
/* NOTE: most of this code is mutated
* from slap_passwd_parse();
* But here we only need
* the first berval... */
ber_tag_t
tag
;
...
...
@@ -154,7 +152,7 @@ ldap_back_exop_passwd(
tag
=
ber_peek_tag
(
ber
,
&
len
);
if
(
tag
==
LDAP_TAG_EXOP_MODIFY_PASSWD_ID
)
{
tag
=
ber_
scanf
(
ber
,
"m"
,
&
tmpid
);
tag
=
ber_
get_stringbv
(
ber
,
&
tmpid
,
LBER_BV_NOTERM
);
if
(
tag
==
LBER_ERROR
)
{
return
LDAP_PROTOCOL_ERROR
;
...
...
@@ -162,8 +160,11 @@ ldap_back_exop_passwd(
}
if
(
!
BER_BVISEMPTY
(
&
tmpid
)
)
{
char
idNull
=
tmpid
.
bv_val
[
tmpid
.
bv_len
];
tmpid
.
bv_val
[
tmpid
.
bv_len
]
=
'\0'
;
rs
->
sr_err
=
dnPrettyNormal
(
NULL
,
&
tmpid
,
&
dn
,
&
ndn
,
op
->
o_tmpmemctx
);
tmpid
.
bv_val
[
tmpid
.
bv_len
]
=
idNull
;
if
(
rs
->
sr_err
!=
LDAP_SUCCESS
)
{
/* should have been successfully parsed earlier! */
return
rs
->
sr_err
;
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/overlays/rwm.c
+
3
−
0
View file @
7ad384d9
...
...
@@ -845,8 +845,11 @@ rwm_exop_passwd( Operation *op, SlapReply *rs )
}
if
(
!
BER_BVISNULL
(
&
id
)
)
{
char
idNul
=
id
.
bv_val
[
id
.
bv_len
];
id
.
bv_val
[
id
.
bv_len
]
=
'\0'
;
rs
->
sr_err
=
dnPrettyNormal
(
NULL
,
&
id
,
&
op
->
o_req_dn
,
&
op
->
o_req_ndn
,
op
->
o_tmpmemctx
);
id
.
bv_val
[
id
.
bv_len
]
=
idNul
;
if
(
rs
->
sr_err
!=
LDAP_SUCCESS
)
{
rs
->
sr_text
=
"Invalid DN"
;
return
rs
->
sr_err
;
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/passwd.c
+
17
−
6
View file @
7ad384d9
...
...
@@ -53,7 +53,7 @@ int passwd_extop(
Modifications
*
ml
;
slap_callback
cb
=
{
NULL
,
slap_null_cb
,
NULL
,
NULL
};
int
i
,
nhash
;
char
**
hashes
;
char
**
hashes
,
idNul
;
int
rc
;
BackendDB
*
op_be
;
int
freenewpw
=
0
;
...
...
@@ -77,6 +77,10 @@ int passwd_extop(
rs
->
sr_err
=
slap_passwd_parse
(
op
->
ore_reqdata
,
&
id
,
&
qpw
->
rs_old
,
&
qpw
->
rs_new
,
&
rs
->
sr_text
);
if
(
!
BER_BVISNULL
(
&
id
))
{
idNul
=
id
.
bv_val
[
id
.
bv_len
];
id
.
bv_val
[
id
.
bv_len
]
=
'\0'
;
}
if
(
rs
->
sr_err
==
LDAP_SUCCESS
&&
!
BER_BVISEMPTY
(
&
id
)
)
{
Statslog
(
LDAP_DEBUG_STATS
,
"%s PASSMOD id=
\"
%s
\"
%s%s
\n
"
,
op
->
o_log_prefix
,
id
.
bv_val
,
...
...
@@ -90,12 +94,15 @@ int passwd_extop(
}
if
(
rs
->
sr_err
!=
LDAP_SUCCESS
)
{
if
(
!
BER_BVISNULL
(
&
id
))
id
.
bv_val
[
id
.
bv_len
]
=
idNul
;
return
rs
->
sr_err
;
}
if
(
!
BER_BVISEMPTY
(
&
id
)
)
{
rs
->
sr_err
=
dnPrettyNormal
(
NULL
,
&
id
,
&
op
->
o_req_dn
,
&
op
->
o_req_ndn
,
op
->
o_tmpmemctx
);
id
.
bv_val
[
id
.
bv_len
]
=
idNul
;
if
(
rs
->
sr_err
!=
LDAP_SUCCESS
)
{
rs
->
sr_text
=
"Invalid DN"
;
rc
=
rs
->
sr_err
;
...
...
@@ -317,6 +324,10 @@ error_return:;
return
rc
;
}
/* NOTE: The DN in *id is NOT NUL-terminated here. dnNormalize will
* reject it in this condition, the caller must NUL-terminate it.
* FIXME: should dnNormalize still be complaining about that?
*/
int
slap_passwd_parse
(
struct
berval
*
reqdata
,
struct
berval
*
id
,
struct
berval
*
oldpass
,
...
...
@@ -341,9 +352,9 @@ int slap_passwd_parse( struct berval *reqdata,
/* ber_init2 uses reqdata directly, doesn't allocate new buffers */
ber_init2
(
ber
,
reqdata
,
0
);
tag
=
ber_s
canf
(
ber
,
"{"
/*}*/
);
tag
=
ber_s
kip_tag
(
ber
,
&
len
);
if
(
tag
=
=
LBER_
ERROR
)
{
if
(
tag
!
=
LBER_
SEQUENCE
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"slap_passwd_parse: decoding error
\n
"
,
0
,
0
,
0
);
rc
=
LDAP_PROTOCOL_ERROR
;
...
...
@@ -361,7 +372,7 @@ int slap_passwd_parse( struct berval *reqdata,
goto
done
;
}
tag
=
ber_
scanf
(
ber
,
"m"
,
id
);
tag
=
ber_
get_stringbv
(
ber
,
id
,
LBER_BV_NOTERM
);
if
(
tag
==
LBER_ERROR
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"slap_passwd_parse: ID parse failed.
\n
"
,
...
...
@@ -383,7 +394,7 @@ int slap_passwd_parse( struct berval *reqdata,
goto
done
;
}
tag
=
ber_
scanf
(
ber
,
"m"
,
oldpass
);
tag
=
ber_
get_stringbv
(
ber
,
oldpass
,
LBER_BV_NOTERM
);
if
(
tag
==
LBER_ERROR
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"slap_passwd_parse: OLD parse failed.
\n
"
,
...
...
@@ -414,7 +425,7 @@ int slap_passwd_parse( struct berval *reqdata,
goto
done
;
}
tag
=
ber_
scanf
(
ber
,
"m"
,
newpass
);
tag
=
ber_
get_stringbv
(
ber
,
newpass
,
LBER_BV_NOTERM
);
if
(
tag
==
LBER_ERROR
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"slap_passwd_parse: NEW parse failed.
\n
"
,
...
...
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