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
52d2b2ec
Commit
52d2b2ec
authored
24 years ago
by
Kurt Zeilenga
Browse files
Options
Downloads
Patches
Plain Diff
user argument should be optional
parent
a07a97e7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
clients/tools/ldappasswd.c
+14
-25
14 additions, 25 deletions
clients/tools/ldappasswd.c
with
14 additions
and
25 deletions
clients/tools/ldappasswd.c
+
14
−
25
View file @
52d2b2ec
...
...
@@ -29,8 +29,8 @@ usage(const char *s)
{
fprintf
(
stderr
,
"Change password of an LDAP user
\n\n
"
"usage: %s [options] user
\n
"
" user: the
id
enti
ty of the user, normal
ly a DN
\n
"
"usage: %s [options]
[
user
]
\n
"
" user: the
aut
enti
cation identity, common
ly a DN
\n
"
"Password change options:
\n
"
" -a secret old password
\n
"
" -A prompt for old password
\n
"
...
...
@@ -70,7 +70,7 @@ main( int argc, char *argv[] )
char
*
ldaphost
=
NULL
;
char
*
ldapuri
=
NULL
;
char
*
dn
=
NULL
;
char
*
user
=
NULL
;
char
*
binddn
=
NULL
;
struct
berval
passwd
=
{
0
,
NULL
};
...
...
@@ -109,9 +109,6 @@ main( int argc, char *argv[] )
prog
=
(
prog
=
strrchr
(
argv
[
0
],
*
LDAP_DIRSEP
))
==
NULL
?
argv
[
0
]
:
prog
+
1
;
if
(
argc
==
1
)
usage
(
argv
[
0
]);
while
(
(
i
=
getopt
(
argc
,
argv
,
"Aa:Ss:"
"Cd:D:h:H:InO:p:QRU:vw:WxX:Y:Z"
))
!=
EOF
)
{
...
...
@@ -490,10 +487,6 @@ main( int argc, char *argv[] )
}
}
if
(
argc
-
optind
!=
1
)
{
usage
(
argv
[
0
]
);
}
if
(
authmethod
==
-
1
)
{
#ifdef HAVE_CYRUS_SASL
authmethod
=
LDAP_AUTH_SASL
;
...
...
@@ -502,7 +495,13 @@ main( int argc, char *argv[] )
#endif
}
dn
=
strdup
(
argv
[
optind
]
);
if
(
argc
-
optind
>
1
)
{
usage
(
argv
[
0
]
);
}
else
if
(
argc
-
optind
==
1
)
{
user
=
strdup
(
argv
[
optind
]
);
}
else
{
user
=
NULL
;
}
if
(
want_oldpw
&&
oldpw
==
NULL
)
{
/* prompt for old password */
...
...
@@ -532,16 +531,6 @@ main( int argc, char *argv[] )
}
}
if
(
binddn
==
NULL
&&
dn
!=
NULL
)
{
binddn
=
dn
;
dn
=
NULL
;
if
(
passwd
.
bv_val
==
NULL
)
{
passwd
.
bv_val
=
oldpw
;
passwd
.
bv_len
=
oldpw
==
NULL
?
0
:
strlen
(
oldpw
);
}
}
if
(
want_bindpw
&&
passwd
.
bv_val
==
NULL
)
{
/* handle bind password */
fprintf
(
stderr
,
"Bind DN: %s
\n
"
,
binddn
);
...
...
@@ -656,7 +645,7 @@ main( int argc, char *argv[] )
}
}
if
(
dn
!=
NULL
||
oldpw
!=
NULL
||
newpw
!=
NULL
)
{
if
(
user
!=
NULL
||
oldpw
!=
NULL
||
newpw
!=
NULL
)
{
/* build change password control */
BerElement
*
ber
=
ber_alloc_t
(
LBER_USE_DER
);
...
...
@@ -668,10 +657,10 @@ main( int argc, char *argv[] )
ber_printf
(
ber
,
"{"
/*}*/
);
if
(
dn
!=
NULL
)
{
if
(
user
!=
NULL
)
{
ber_printf
(
ber
,
"ts"
,
LDAP_TAG_EXOP_X_MODIFY_PASSWD_ID
,
dn
);
free
(
dn
);
LDAP_TAG_EXOP_X_MODIFY_PASSWD_ID
,
user
);
free
(
user
);
}
if
(
oldpw
!=
NULL
)
{
...
...
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