The branch, v4-4-test has been updated
       via  f2dc71c s3: smbd: Fix timestamp rounding inside SMB2 create.
       via  9eed186 WHATSNEW: update with latest parameter updates for smbget
       via  2978226 s3-utils/smbget: Update manpages for parameter changes
       via  a7046bc s3-utils/smbget: Fix user-/name password reading from rcfile
       via  9d4cbe6 s3-utils/smbget: Fix reading the rcfile
       via  1ebeb06 s3-utils/smbget: Fix option parsing and apply samba defaults
       via  2aadb75 selftest: fix test_dfree_quota.sh
       via  3029dc0 ctdb: do not provide a useless pkgconfig file for ctdb.
       via  7da9c65 smbd: show correct disk size for different quota and dfree 
block sizes
      from  1133650 VERSION: Bump version up to 4.4.0rc2...

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-4-test


- Log -----------------------------------------------------------------
commit f2dc71c7853a6ff87763869d4b70c423e2b909a0
Author: Jeremy Allison <[email protected]>
Date:   Thu Jan 28 16:35:13 2016 -0800

    s3: smbd: Fix timestamp rounding inside SMB2 create.
    
    Setting "dos filetime resolution = yes" should round
    to 2 second increments. Fix missing path inside smbd.
    
    Fix confirmed by reporter Hubert Gilch <[email protected]>.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11703
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Volker Lendecke <[email protected]>
    
    Autobuild-User(master): Volker Lendecke <[email protected]>
    Autobuild-Date(master): Fri Jan 29 10:41:01 CET 2016 on sn-devel-144
    
    (cherry picked from commit 8024f532e6bcb6cbd8179817fafdd0f12929d629)
    
    Autobuild-User(v4-4-test): Karolin Seeger <[email protected]>
    Autobuild-Date(v4-4-test): Wed Feb  3 15:08:20 CET 2016 on sn-devel-144

commit 9eed1866217447fa07164a53bd099c0c06c0dc9b
Author: Christian Ambach <[email protected]>
Date:   Wed Jan 27 22:59:25 2016 +0100

    WHATSNEW: update with latest parameter updates for smbget
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11700
    
    Signed-off-by: Christian Ambach <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>
    
    Autobuild-User(master): Andreas Schneider <[email protected]>
    Autobuild-Date(master): Thu Jan 28 13:07:34 CET 2016 on sn-devel-144
    
    (cherry picked from commit 9b5198f55234d55c24d265adf072932cfe086f63)

commit 297822600700a9cd2f33c2c4a819bab857953838
Author: Christian Ambach <[email protected]>
Date:   Wed Jan 27 22:37:36 2016 +0100

    s3-utils/smbget: Update manpages for parameter changes
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11700
    
    Signed-off-by: Christian Ambach <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>
    
    (cherry picked from commit fbdde9c4651146412c61f03ce916032497f7a546)

commit a7046bcf122db4a7b544e614236015c1c27b1e16
Author: Christian Ambach <[email protected]>
Date:   Wed Jan 27 22:00:31 2016 +0100

    s3-utils/smbget: Fix user-/name password reading from rcfile
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11700
    
    As the password option is gone, code needs to be able to read password
    from user parameter when user%password syntax is used.
    
    Signed-off-by: Christian Ambach <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>
    
    (cherry picked from commit cac1086ae12d10a6c424f947045d26badc96d751)

commit 9d4cbe61c3649ff95f0b6aa6e3a9fcd5bc4968aa
Author: Christian Ambach <[email protected]>
Date:   Wed Jan 27 21:56:10 2016 +0100

    s3-utils/smbget: Fix reading the rcfile
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11700
    
    shortName in POPT_AUTOHELP is null, so the loop always stopped at this
    item.
    
    Signed-off-by: Christian Ambach <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>
    
    (cherry picked from commit bf1c1ad068a763108f9b8f79431de522783a4302)

commit 1ebeb0677911ab89113c02b5d13a6bb7d8009f52
Author: Andreas Schneider <[email protected]>
Date:   Wed Oct 28 12:37:36 2015 +0100

    s3-utils/smbget: Fix option parsing and apply samba defaults
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11700
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Christian Ambach <[email protected]>
    
    (cherry picked from commit e1548c5bf77186c72f0257592e9084e3b039b87c)

commit 2aadb75d425b7035ca485fb8123e5874181279c7
Author: Uri Simchoni <[email protected]>
Date:   Wed Jan 27 21:47:30 2016 +0200

    selftest: fix test_dfree_quota.sh
    
    Eliminate backslashes from smbcquotas output so that we
    don't have to deal with them correctly when parsing the output.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11697
    
    Signed-off-by: Uri Simchoni <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    (cherry picked from commit e7a8ef4f260cc3d07654664c9e547263a2bc8ee6)

commit 3029dc04ba39e8ca508f9ee8112fb56e774c9336
Author: Günther Deschner <[email protected]>
Date:   Wed Jan 27 15:40:33 2016 +0100

    ctdb: do not provide a useless pkgconfig file for ctdb.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11696
    
    We neither have public headers nor a public library.
    
    Guenther
    
    Signed-off-by: Guenther Deschner <[email protected]>
    Reviewed-by: Amitay Isaacs <[email protected]>
    
    Autobuild-User(master): Amitay Isaacs <[email protected]>
    Autobuild-Date(master): Fri Jan 29 04:33:36 CET 2016 on sn-devel-144

commit 7da9c659d3ca41de13c995872c32cb52ee4f27f7
Author: Uri Simchoni <[email protected]>
Date:   Tue Jan 19 14:57:16 2016 +0200

    smbd: show correct disk size for different quota and dfree block sizes
    
    When file system stats (VFS disk_free_fn) and quota (VFS get_quota_fn)
    return different block sizes, normalize values before comparing.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11681
    
    Signed-off-by: Uri Simchoni <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    (cherry picked from commit 67c89715d00abc588239d8220f09cf51a58db05a)

-----------------------------------------------------------------------

Summary of changes:
 WHATSNEW.txt                             |   7 ++
 ctdb/ctdb.pc.in                          |  19 ----
 ctdb/packaging/RPM/ctdb.spec.in          |   1 -
 ctdb/wscript                             |   9 --
 docs-xml/manpages/smbget.1.xml           |  16 +--
 docs-xml/manpages/smbgetrc.5.xml         |   8 +-
 source3/script/tests/test_dfree_quota.sh |   4 +-
 source3/smbd/dfree.c                     |   9 +-
 source3/smbd/smb2_create.c               |   8 ++
 source3/utils/smbget.c                   | 185 +++++++++++++++++++------------
 10 files changed, 147 insertions(+), 119 deletions(-)
 delete mode 100644 ctdb/ctdb.pc.in


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 399fb2b..7c748c2 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -65,6 +65,13 @@ smbstatus
 'smbstatus' was enhanced to show the state of signing and encryption for
 sessions and shares.
 
+smbget
+------
+The -u and -p options for user and password were replaced by the -U option that
+accepts username[%password] as in many other tools of the Samba suite.
+Similary, smbgetrc files do not accept username and password options any more,
+only a single "user" option which also accepts user%password combinations.
+
 s4-rpc_server
 -------------
 
diff --git a/ctdb/ctdb.pc.in b/ctdb/ctdb.pc.in
deleted file mode 100644
index 5f5bfab..0000000
--- a/ctdb/ctdb.pc.in
+++ /dev/null
@@ -1,19 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-datarootdir=@datarootdir@
-includedir=@includedir@
-libdir=@libdir@
-bindir=@bindir@
-sbindir=@sbindir@
-mandir=@mandir@
-localstatedir=@localstatedir@
-srcdir=@srcdir@
-etcdir=@sysconfdir@
-
-Name: ctdb
-Description: A clustered database to store temporary data
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir}
-Cflags: -I${includedir}
-URL: http://ctdb.samba.org/
-
diff --git a/ctdb/packaging/RPM/ctdb.spec.in b/ctdb/packaging/RPM/ctdb.spec.in
index 55ce0e5..420ec52 100644
--- a/ctdb/packaging/RPM/ctdb.spec.in
+++ b/ctdb/packaging/RPM/ctdb.spec.in
@@ -217,7 +217,6 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man7/ctdb.7.gz
 %{_mandir}/man7/ctdb-statistics.7.gz
 %{_mandir}/man7/ctdb-tunables.7.gz
-%{_libdir}/pkgconfig/ctdb.pc
 
 
 %package devel
diff --git a/ctdb/wscript b/ctdb/wscript
index edd4aa4..e1fad17 100755
--- a/ctdb/wscript
+++ b/ctdb/wscript
@@ -615,15 +615,6 @@ def build(bld):
     bld.install_dir(bld.env.CTDB_RUNDIR)
     bld.install_dir(bld.env.CTDB_VARDIR)
 
-    sed_expr = 's/@PACKAGE_VERSION@/%s/g' % VERSION
-    t = bld.SAMBA_GENERATOR('ctdb-pc',
-                            source='ctdb.pc.in',
-                            target='ctdb.pc',
-                            rule='sed -e "%s" ${SRC} > ${TGT}' % sed_expr,
-                            dep_vars=['VERSION'])
-    t.env.VERSION = VERSION
-    bld.INSTALL_FILES('${LIBDIR}/pkgconfig', 'ctdb.pc')
-
     # Unit tests
     ctdb_unit_tests = [
         'db_hash_test',
diff --git a/docs-xml/manpages/smbget.1.xml b/docs-xml/manpages/smbget.1.xml
index 965e229..59e2ffe 100644
--- a/docs-xml/manpages/smbget.1.xml
+++ b/docs-xml/manpages/smbget.1.xml
@@ -22,8 +22,7 @@
                <arg choice="opt">-a, --guest</arg>
                <arg choice="opt">-r, --resume</arg>
                <arg choice="opt">-R, --recursive</arg>
-               <arg choice="opt">-u, --username=STRING</arg>
-               <arg choice="opt">-p, --password=STRING</arg>
+               <arg choice="opt">-U, --username=STRING</arg>
                <arg choice="opt">-w, --workgroup=STRING</arg>
                <arg choice="opt">-n, --nonprompt</arg>
                <arg choice="opt">-d, --debuglevel=INT</arg>
@@ -35,7 +34,7 @@
                <arg choice="opt">-v, --verbose</arg>
                <arg choice="opt">-b, --blocksize</arg>
                <arg choice="opt">-O, --stdout</arg>
-               <arg choice="opt">-U, --update</arg>
+               <arg choice="opt">-u, --update</arg>
                <arg choice="opt">-?, --help</arg>
                <arg choice="opt">--usage</arg>
                <arg choice="req">smb://host/share/path/to/file</arg>
@@ -78,13 +77,8 @@
        </varlistentry>
 
        <varlistentry>
-               <term>-u, --username=STRING</term>
-               <listitem><para>Username to use</para></listitem>
-       </varlistentry>
-
-       <varlistentry>
-               <term>-p, --password=STRING</term>
-               <listitem><para>Password to use</para></listitem>
+               <term> -U, 
--username=<replaceable>username[%password]</replaceable></term>
+               <listitem><para>Username (and password) to use</para></listitem>
        </varlistentry>
 
        <varlistentry>
@@ -153,7 +147,7 @@
        </varlistentry>
 
        <varlistentry>
-               <term>-U, --update</term>
+               <term>-u, --update</term>
                <listitem><para>Download only when remote file is newer than 
local file or local file is missing.</para></listitem>
        </varlistentry>
 
diff --git a/docs-xml/manpages/smbgetrc.5.xml b/docs-xml/manpages/smbgetrc.5.xml
index a1a9b57..f1bb8b5 100644
--- a/docs-xml/manpages/smbgetrc.5.xml
+++ b/docs-xml/manpages/smbgetrc.5.xml
@@ -53,15 +53,11 @@
                        <listitem><para>Whether directories should be 
downloaded recursively</para></listitem>
                </varlistentry>
 
-               <varlistentry><term>username 
<replaceable>name</replaceable></term>
-                       <listitem><para>Username to use when logging in to the 
remote server. Use an empty string for anonymous access.
+               <varlistentry><term>user 
<replaceable>name[%password]</replaceable></term>
+                       <listitem><para>Username (and password) to use when 
logging in to the remote server. Use an empty string for anonymous access.
                        </para></listitem>
                </varlistentry>
 
-               <varlistentry><term>password 
<replaceable>pass</replaceable></term>
-                       <listitem><para>Password to use when logging 
in.</para></listitem>
-               </varlistentry>
-
                <varlistentry><term>workgroup 
<replaceable>wg</replaceable></term>
                        <listitem><para>Workgroup to use when logging 
in</para></listitem>
                </varlistentry>
diff --git a/source3/script/tests/test_dfree_quota.sh 
b/source3/script/tests/test_dfree_quota.sh
index c693b7b..5392d3d 100755
--- a/source3/script/tests/test_dfree_quota.sh
+++ b/source3/script/tests/test_dfree_quota.sh
@@ -128,10 +128,10 @@ test_smbcquotas() {
     shift
        subunit_start_test "$name"
     setup_conf "$conf" "."
-       output=$($VALGRIND $smbcquotas //$SERVER/dfq $@ 2>/dev/null)
+       output=$($VALGRIND $smbcquotas //$SERVER/dfq $@ 2>/dev/null | tr '\\' 
'/')
        status=$?
        if [ "$status" = "0" ]; then
-               received=$(echo "$output" | awk "/$SERVER\\\\$user/ {printf 
\"%s%s%s\", \$3, \$4, \$5}")
+               received=$(echo "$output" | awk "/$SERVER\\/$user/ {printf 
\"%s%s%s\", \$3, \$4, \$5}")
                if [ "$expected" = "$received" ]; then
                        subunit_pass_test "$name"
                else
diff --git a/source3/smbd/dfree.c b/source3/smbd/dfree.c
index 62d2ea4..765fbe6 100644
--- a/source3/smbd/dfree.c
+++ b/source3/smbd/dfree.c
@@ -124,7 +124,14 @@ uint64_t sys_disk_free(connection_struct *conn, const char 
*path,
        }
 
        if (disk_quotas(conn, path, &bsize_q, &dfree_q, &dsize_q)) {
-               (*bsize) = bsize_q;
+               uint64_t min_bsize = MIN(*bsize, bsize_q);
+
+               (*dfree) = (*dfree) * (*bsize) / min_bsize;
+               (*dsize) = (*dsize) * (*bsize) / min_bsize;
+               dfree_q = dfree_q * bsize_q / min_bsize;
+               dsize_q = dsize_q * bsize_q / min_bsize;
+
+               (*bsize) = min_bsize;
                (*dfree) = MIN(*dfree,dfree_q);
                (*dsize) = MIN(*dsize,dsize_q);
        }
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index 54a598d..62948a0 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -1280,6 +1280,14 @@ static struct tevent_req 
*smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
        state->out_last_write_ts = result->fsp_name->st.st_ex_mtime;
        state->out_change_ts = get_change_timespec(smb1req->conn,
                                        result, result->fsp_name);
+
+       if (lp_dos_filetime_resolution(SNUM(smb2req->tcon->compat))) {
+               dos_filetime_timespec(&state->out_creation_ts);
+               dos_filetime_timespec(&state->out_last_access_ts);
+               dos_filetime_timespec(&state->out_last_write_ts);
+               dos_filetime_timespec(&state->out_change_ts);
+       }
+
        state->out_allocation_size =
                        SMB_VFS_GET_ALLOC_SIZE(smb1req->conn, result,
                                               &(result->fsp_name->st));
diff --git a/source3/utils/smbget.c b/source3/utils/smbget.c
index f596a8c..1dd8d77 100644
--- a/source3/utils/smbget.c
+++ b/source3/utils/smbget.c
@@ -23,10 +23,6 @@
 
 static int columns = 0;
 
-static int debuglevel;
-static char *outputfile;
-
-
 static time_t total_start_time = 0;
 static off_t total_bytes = 0;
 
@@ -42,11 +38,26 @@ static off_t total_bytes = 0;
 /* Number of bytes to read at once */
 #define SMB_DEFAULT_BLOCKSIZE  64000
 
-static const char *username = NULL, *password = NULL, *workgroup = NULL;
-static bool nonprompt = false, quiet = false, dots = false,
-           keep_permissions = false, verbose = false, send_stdout = false,
-           update = false;
-static unsigned int blocksize = SMB_DEFAULT_BLOCKSIZE;
+struct opt {
+       char *workgroup;
+       bool username_specified;
+       char *username;
+       bool password_specified;
+       char *password;
+
+       char *outputfile;
+       size_t blocksize;
+
+       bool nonprompt;
+       bool quiet;
+       bool dots;
+       bool keep_permissions;
+       bool verbose;
+       bool send_stdout;
+       bool update;
+       int debuglevel;
+};
+static struct opt opt;
 
 static bool smb_download_file(const char *base, const char *name,
                              bool recursive, bool resume, bool toplevel,
@@ -105,7 +116,7 @@ static void get_auth_data(const char *srv, const char *shr, 
char *wg, int wglen,
        }
        hasasked = true;
 
-       if (!nonprompt && !username) {
+       if (!opt.nonprompt && !opt.username_specified) {
                printf("Username for %s at %s [guest] ", shr, srv);
                if (fgets(tmp, sizeof(tmp), stdin) == NULL) {
                        return;
@@ -114,11 +125,11 @@ static void get_auth_data(const char *srv, const char 
*shr, char *wg, int wglen,
                        tmp[strlen(tmp) - 1] = '\0';
                }
                strncpy(un, tmp, unlen - 1);
-       } else if (username) {
-               strncpy(un, username, unlen - 1);
+       } else if (opt.username != NULL) {
+               strncpy(un, opt.username, unlen - 1);
        }
 
-       if (!nonprompt && !password) {
+       if (!opt.nonprompt && !opt.password_specified) {
                char *prompt;
                if (asprintf(&prompt, "Password for %s at %s: ", shr, srv) ==
                    -1) {
@@ -126,12 +137,12 @@ static void get_auth_data(const char *srv, const char 
*shr, char *wg, int wglen,
                }
                (void)samba_getpass(prompt, pw, pwlen, false, false);
                free(prompt);
-       } else if (password) {
-               strncpy(pw, password, pwlen - 1);
+       } else if (opt.password != NULL) {
+               strncpy(pw, opt.password, pwlen-1);
        }
 
-       if (workgroup) {
-               strncpy(wg, workgroup, wglen - 1);
+       if (opt.workgroup != NULL) {
+               strncpy(wg, opt.workgroup, wglen-1);
        }
 
        /* save the values found for later */
@@ -139,12 +150,14 @@ static void get_auth_data(const char *srv, const char 
*shr, char *wg, int wglen,
        savedun = SMB_STRDUP(un);
        savedpw = SMB_STRDUP(pw);
 
-       if (!quiet) {
+       if (!opt.quiet) {
                char *wgtmp, *usertmp;
                wgtmp = SMB_STRNDUP(wg, wglen);
                usertmp = SMB_STRNDUP(un, unlen);
-               printf("Using workgroup %s, %s%s\n", wgtmp,
-                      *usertmp ? "user " : "guest user", usertmp);
+               printf("Using workgroup %s, %s%s\n",
+                      wgtmp,
+                      *usertmp ? "user " : "guest user",
+                      usertmp);
                free(wgtmp);
                free(usertmp);
        }
@@ -218,21 +231,21 @@ static int smb_download_dir(const char *base, const char 
*name, int resume)
                        break;
 
                case SMBC_PRINTER_SHARE:
-                       if (!quiet) {
+                       if (!opt.quiet) {
                                printf("Ignoring printer share %s\n",
                                       dirent->name);
                        }
                        break;
 
                case SMBC_COMMS_SHARE:
-                       if (!quiet) {
+                       if (!opt.quiet) {
                                printf("Ignoring comms share %s\n",
                                       dirent->name);
                        }
                        break;
 
                case SMBC_IPC_SHARE:
-                       if (!quiet) {
+                       if (!opt.quiet) {
                                printf("Ignoring ipc$ share %s\n",
                                       dirent->name);
                        }
@@ -247,7 +260,7 @@ static int smb_download_dir(const char *base, const char 
*name, int resume)
        }
        free(tmpname);
 
-       if (keep_permissions) {
+       if (opt.keep_permissions) {
                if (smbc_fstat(dirhandle, &remotestat) < 0) {
                        fprintf(stderr,
                                "Unable to get stats on %s on remote server\n",
@@ -420,11 +433,11 @@ static bool smb_download_file(const char *base, const 
char *name,
        }
 
        /* Open local file according to the mode */
-       if (update) {
+       if (opt.update) {
                /* if it is up-to-date, skip */
                if (stat(newpath, &localstat) == 0 &&
                    localstat.st_mtime >= remotestat.st_mtime) {
-                       if (verbose) {
+                       if (opt.verbose) {
                                printf("%s is up-to-date, skipping\n", newpath);
                        }
                        smbc_close(remotehandle);
@@ -440,7 +453,7 @@ static bool smb_download_file(const char *base, const char 
*name,
                        return false;
                }
                /* no offset */
-       } else if (!send_stdout) {
+       } else if (!opt.send_stdout) {
                localhandle = open(newpath, O_CREAT | O_NONBLOCK | O_RDWR |
                                                (!resume ? O_EXCL : 0),
                                   0755);
@@ -463,11 +476,11 @@ static bool smb_download_file(const char *base, const 
char *name,
 
                if (localstat.st_size &&
                    localstat.st_size == remotestat.st_size) {
-                       if (verbose) {
+                       if (opt.verbose) {
                                fprintf(stderr, "%s is already downloaded "
                                        "completely.\n",
                                        path);
-                       } else if (!quiet) {
+                       } else if (!opt.quiet) {
                                fprintf(stderr, "%s\n", path);
                        }
                        smbc_close(remotehandle);
@@ -480,7 +493,7 @@ static bool smb_download_file(const char *base, const char 
*name,
                        offset_download =
                            localstat.st_size - RESUME_DOWNLOAD_OFFSET;
                        offset_check = localstat.st_size - RESUME_CHECK_OFFSET;
-                       if (verbose) {
+                       if (opt.verbose) {
                                printf("Trying to start resume of %s at %jd\n"
                                       "At the moment %jd of %jd bytes have "
                                       "been retrieved\n",
@@ -546,7 +559,7 @@ static bool smb_download_file(const char *base, const char 
*name,
 
                        if (memcmp(checkbuf[0], checkbuf[1],
                                   RESUME_CHECK_SIZE) == 0) {
-                               if (verbose) {
+                               if (opt.verbose) {
                                        printf("Current local and remote file "
                                               "appear to be the same. "
                                               "Starting download from "
@@ -570,7 +583,7 @@ static bool smb_download_file(const char *base, const char 
*name,
                offset_check = 0;
        }
 
-       readbuf = (char *)SMB_MALLOC(blocksize);
+       readbuf = (char *)SMB_MALLOC(opt.blocksize);
        if (!readbuf) {
                if (localhandle != STDOUT_FILENO) {
                        close(localhandle);
@@ -580,12 +593,14 @@ static bool smb_download_file(const char *base, const 
char *name,
 
        /* Now, download all bytes from offset_download to the end */
        for (curpos = offset_download; curpos < remotestat.st_size;
-            curpos += blocksize) {
-               ssize_t bytesread = smbc_read(remotehandle, readbuf, blocksize);
+            curpos += opt.blocksize) {
+               ssize_t bytesread = smbc_read(remotehandle,
+                                             readbuf,
+                                             opt.blocksize);
                if(bytesread < 0) {
                        fprintf(stderr,
-                               "Can't read %u bytes at offset %jd, file %s\n",
-                               blocksize, (intmax_t)curpos, path);
+                               "Can't read %zu bytes at offset %jd, file %s\n",
+                               opt.blocksize, (intmax_t)curpos, path);
                        smbc_close(remotehandle);
                        if (localhandle != STDOUT_FILENO) {
                                close(localhandle);
@@ -609,9 +624,9 @@ static bool smb_download_file(const char *base, const char 
*name,
                        return false;
                }
 
-               if (dots) {
+               if (opt.dots) {
                        fputc('.', stderr);
-               } else if (!quiet) {
+               } else if (!opt.quiet) {
                        print_progress(newpath, start_time, time_mono(NULL),
                                       start_offset, curpos,
                                       remotestat.st_size);
@@ -620,10 +635,10 @@ static bool smb_download_file(const char *base, const 
char *name,
 
        free(readbuf);
 
-       if (dots) {
+       if (opt.dots) {
                fputc('\n', stderr);
                printf("%s downloaded\n", path);
-       } else if (!quiet) {
+       } else if (!opt.quiet) {
                int i;
                fprintf(stderr, "\r%s", path);
                if (columns) {
@@ -634,7 +649,7 @@ static bool smb_download_file(const char *base, const char 
*name,
                fputc('\n', stderr);
        }
 
-       if (keep_permissions && !send_stdout) {
+       if (opt.keep_permissions && !opt.send_stdout) {
                if (fchmod(localhandle, remotestat.st_mode) < 0) {
                        fprintf(stderr, "Unable to change mode of local "
                                "file %s to %o\n",
@@ -656,7 +671,7 @@ static void clean_exit(void)
 {
        char bs[100];
        human_readable(total_bytes, bs, sizeof(bs));
-       if (!quiet) {
+       if (!opt.quiet) {
                fprintf(stderr, "Downloaded %s in %lu seconds\n", bs,
                        (unsigned long)(time_mono(NULL) - total_start_time));
        }
@@ -692,7 +707,7 @@ static int readrcfile(const char *name, const struct 
poptOption long_options[])
 
                found = false;
 
-               for (i = 0; long_options[i].shortName; i++) {
+               for (i = 0; long_options[i].argInfo; i++) {
                        if (!long_options[i].longName) {
                                continue;
                        }
@@ -723,6 +738,16 @@ static int readrcfile(const char *name, const struct 
poptOption long_options[])
                        case POPT_ARG_STRING:
                                stringdata = (char **)long_options[i].arg;
                                *stringdata = SMB_STRDUP(val);
+                               if (long_options[i].shortName == 'U') {
+                                       char *p;
+                                       opt.username_specified = true;
+                                       p = strchr(*stringdata, '%');
+                                       if (p != NULL) {
+                                               *p = '\0';
+                                               opt.password = p + 1;
+                                               opt.password_specified = true;
+                                       }
+                               }
                                break;
                        default:
                                fprintf(stderr, "Invalid variable %s at "
@@ -744,7 +769,7 @@ static int readrcfile(const char *name, const struct 
poptOption long_options[])
        return 0;
 }
 
-int main(int argc, const char **argv)
+int main(int argc, char **argv)
 {


-- 
Samba Shared Repository

Reply via email to