/[smeserver]/rpms/samba/sme10/samba-4.4.7-fix_smget_auth_callback.patch
ViewVC logotype

Annotation of /rpms/samba/sme10/samba-4.4.7-fix_smget_auth_callback.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Thu Mar 2 16:04:48 2017 UTC (7 years, 3 months ago) by unnilennium
Branch: MAIN
CVS Tags: samba-4_4_4-12_5_el7_sme, samba-4_4_4-12_6_el7_sme, samba-4_4_4-14_6_el7_sme, samba-4_4_4-12_el7_3
update to samba-4.4.4-12 upstream version

1 unnilennium 1.1 From 8fec0f145a06d900bbcfc8959749cc78ab6be8ed Mon Sep 17 00:00:00 2001
2     From: Andreas Schneider <asn@samba.org>
3     Date: Thu, 25 Aug 2016 14:24:08 +0200
4     Subject: [PATCH] s3-util: Fix asking for username and password in smbget.
5    
6     If the user specified the username in the URI with with:
7    
8     smb://DOMAIN;user:secret@server/share
9    
10     the tool should not prompt for the username nor the password.
11    
12     BUG: https://bugzilla.samba.org/show_bug.cgi?id=12175
13    
14     Signed-off-by: Andreas Schneider <asn@samba.org>
15     Reviewed-by: Jeremy Allison <jra@samba.org>
16    
17     (cherry picked from commit f5401ff3146aabc5fb2dac25e4856c6c3756c8f7)
18     ---
19     source3/utils/smbget.c | 26 ++++++++++++--------------
20     1 file changed, 12 insertions(+), 14 deletions(-)
21    
22     diff --git a/source3/utils/smbget.c b/source3/utils/smbget.c
23     index 4909fa2..74ca7f8 100644
24     --- a/source3/utils/smbget.c
25     +++ b/source3/utils/smbget.c
26     @@ -105,7 +105,6 @@ static void get_auth_data(const char *srv, const char *shr, char *wg, int wglen,
27     static char *savedwg;
28     static char *savedun;
29     static char *savedpw;
30     - char tmp[128];
31    
32     if (hasasked) {
33     strncpy(wg, savedwg, wglen - 1);
34     @@ -115,23 +114,22 @@ static void get_auth_data(const char *srv, const char *shr, char *wg, int wglen,
35     }
36     hasasked = true;
37    
38     - if (!opt.nonprompt && !opt.username_specified) {
39     - printf("Username for %s at %s [guest] ", shr, srv);
40     - if (fgets(tmp, sizeof(tmp), stdin) == NULL) {
41     - return;
42     - }
43     - if ((strlen(tmp) > 0) && (tmp[strlen(tmp) - 1] == '\n')) {
44     - tmp[strlen(tmp) - 1] = '\0';
45     - }
46     - strncpy(un, tmp, unlen - 1);
47     - } else if (opt.username != NULL) {
48     + /*
49     + * If no user has been specified un is initialized with the current
50     + * username of the user who started smbget.
51     + */
52     + if (opt.username_specified) {
53     strncpy(un, opt.username, unlen - 1);
54     }
55    
56     - if (!opt.nonprompt && !opt.password_specified) {
57     + if (!opt.nonprompt && !opt.password_specified && pw[0] == '\0') {
58     char *prompt;
59     - if (asprintf(&prompt, "Password for %s at %s: ", shr, srv) ==
60     - -1) {
61     + int rc;
62     +
63     + rc = asprintf(&prompt,
64     + "Password for [%s] connecting to //%s/%s: ",
65     + un, shr, srv);
66     + if (rc == -1) {
67     return;
68     }
69     (void)samba_getpass(prompt, pw, pwlen, false, false);
70     --
71     2.9.3
72    

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed