The Samba-Bugzilla – Attachment 12411 Details for
Bug 12175
smbget always prompts for a username
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for 4.5
smbget-v4-5.patch (text/plain), 2.17 KB, created by
Andreas Schneider
on 2016-08-26 06:43:12 UTC
(
hide
)
Description:
patch for 4.5
Filename:
MIME Type:
Creator:
Andreas Schneider
Created:
2016-08-26 06:43:12 UTC
Size:
2.17 KB
patch
obsolete
>From a54a5242ae4f567985214e3ccb6ddf79005f344e Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Thu, 25 Aug 2016 14:24:08 +0200 >Subject: [PATCH] s3-util: Fix asking for username and password in smbget. > >If the user specified the username in the URI with with: > > smb://DOMAIN;user:secret@server/share > >the tool should not prompt for the username nor the password. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12175 > >Signed-off-by: Andreas Schneider <asn@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> > >(cherry picked from commit f5401ff3146aabc5fb2dac25e4856c6c3756c8f7) >--- > source3/utils/smbget.c | 26 ++++++++++++-------------- > 1 file changed, 12 insertions(+), 14 deletions(-) > >diff --git a/source3/utils/smbget.c b/source3/utils/smbget.c >index 99261e3..d2d5e00 100644 >--- a/source3/utils/smbget.c >+++ b/source3/utils/smbget.c >@@ -105,7 +105,6 @@ static void get_auth_data(const char *srv, const char *shr, char *wg, int wglen, > static char *savedwg; > static char *savedun; > static char *savedpw; >- char tmp[128]; > > if (hasasked) { > strncpy(wg, savedwg, wglen - 1); >@@ -115,23 +114,22 @@ static void get_auth_data(const char *srv, const char *shr, char *wg, int wglen, > } > hasasked = true; > >- if (!opt.nonprompt && !opt.username_specified) { >- printf("Username for %s at %s [guest] ", shr, srv); >- if (fgets(tmp, sizeof(tmp), stdin) == NULL) { >- return; >- } >- if ((strlen(tmp) > 0) && (tmp[strlen(tmp) - 1] == '\n')) { >- tmp[strlen(tmp) - 1] = '\0'; >- } >- strncpy(un, tmp, unlen - 1); >- } else if (opt.username != NULL) { >+ /* >+ * If no user has been specified un is initialized with the current >+ * username of the user who started smbget. >+ */ >+ if (opt.username_specified) { > strncpy(un, opt.username, unlen - 1); > } > >- if (!opt.nonprompt && !opt.password_specified) { >+ if (!opt.nonprompt && !opt.password_specified && pw[0] == '\0') { > char *prompt; >- if (asprintf(&prompt, "Password for %s at %s: ", shr, srv) == >- -1) { >+ int rc; >+ >+ rc = asprintf(&prompt, >+ "Password for [%s] connecting to //%s/%s: ", >+ un, shr, srv); >+ if (rc == -1) { > return; > } > (void)samba_getpass(prompt, pw, pwlen, false, false); >-- >2.9.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
jra
:
review+
Actions:
View
Attachments on
bug 12175
:
12410
| 12411