diff options
author | Andreas Schneider <asn@samba.org> | 2012-11-22 15:51:33 +0100 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2012-12-03 14:35:09 +0100 |
commit | bed60120d49f3285070db130974fa385b9b57b37 (patch) | |
tree | 303c85dc2cbb8d6fc77d0d3c1e4eb72ba8a42188 /source3/utils | |
parent | 1ded99cd1447b674a7af6e738a492a597425b6ba (diff) | |
download | samba-bed60120d49f3285070db130974fa385b9b57b37.tar.gz samba-bed60120d49f3285070db130974fa385b9b57b37.tar.bz2 samba-bed60120d49f3285070db130974fa385b9b57b37.zip |
net: Use new samba_getpass() function for 'net ads'.
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_ads.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 03658d3c5b..80368ee163 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -2091,6 +2091,7 @@ static int net_ads_password(struct net_context *c, int argc, const char **argv) const char *new_password = NULL; char *chr, *prompt; const char *user; + char pwd[256] = {0}; ADS_STATUS ret; if (c->display_usage) { @@ -2149,15 +2150,22 @@ static int net_ads_password(struct net_context *c, int argc, const char **argv) if (argv[1]) { new_password = (const char *)argv[1]; } else { + int rc; + if (asprintf(&prompt, _("Enter new password for %s:"), user) == -1) { return -1; } - new_password = getpass(prompt); + rc = samba_getpass(prompt, pwd, sizeof(pwd), false, true); + if (rc < 0) { + return -1; + } + new_password = pwd; free(prompt); } ret = kerberos_set_password(ads->auth.kdc_server, auth_principal, auth_password, user, new_password, ads->auth.time_offset); + memset(pwd, '\0', sizeof(pwd)); if (!ADS_ERR_OK(ret)) { d_fprintf(stderr, _("Password change failed: %s\n"), ads_errstr(ret)); ads_destroy(&ads); |