[SCM] Samba Shared Repository - branch v4-2-test updated

Karolin Seeger kseeger at samba.org
Sat Jan 24 16:38:13 MST 2015


The branch, v4-2-test has been updated
       via  f45d30c s3-pam_smbpass: Fix memory leak in pam_sm_authenticate().
       via  e38f3ea utils: Fix 'net time' segfault.
       via  a5d30bd cli_connect_nb_send: don't segfault on host == NULL.
       via  69dd558 vfs_snapper: encode and decode Snapper DBus strings
       via  428c582 vfs_snapper: add DBus string encoding and decoding helpers
       via  1381ac0 vfs_snapper: free dbus req messages in error paths
       via  f922899 s3-vfs: Fix developer build of vfs_ceph module.
       via  ffc1cca vfs_glusterfs: Add comments to the pipe(2) code.
       via  0c9e53b vfs: Fix a typo
       via  7e0e0e0 vfs:glusterfs: whitespace fix.
       via  42b9b52 vfs_glusterfs: Replace eventfd with pipes, for AIO use
       via  1d05617 vfs/glusterfs: Change xattr key to match gluster key.
       via  d35fa8e vfs_glusterfs: Implement AIO support
       via  bab4805 vfs_glusterfs: Change sys_get_acl_file/fd to return ACLs corresponding to mode bits when there are no ACLs set.
       via  d56da88 vfs_glusterfs: Set connectpath as snapdir-entry-path.
       via  11d3349 vfs_glusterfs: Remember the connect path too for reopening.
       via  9994410 vfs_glusterfs: In vfs_gluster_sys_acl_get_file/fd, reduce the number of getxattr calls.
       via  7b78b08 libsmb: provide authinfo domain for encrypted session referrals
       via  8b95fb7 libsmb: provide authinfo domain for DFS referral auth
       via  e8bf65d libsmb: reuse connections derived from DFS referrals
       via  c2f8c93 samba3.py: Correctly initialize cache directory for passdb test
       via  091a3aa gencache: Request mutexes for gencache_notrans.tdb
       via  20d4a67 gencache: Convert gencache.tdb to tdb_wrap
       via  980bba3 gencache: Convert gencache_notrans to use tdb_wrap
       via  ad16a9a s3:gencache: don't use transaction non non-persistent gencache_notrans.tdb
       via  0810b53 s3:gencache: simply stabilize() a bit more: remove error from state
       via  12ea070 s3:gencache: fix logic in stabilization when deleting a record from stable cache
       via  f24a9e5 lib: Use tdb_parse_record in gencache_set
      from  837c146 s3: auth - tests: Add test for "force user" being a unix-only user, not in passdb.

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


- Log -----------------------------------------------------------------
commit f45d30c1dd8003a23d6e9a6b4f6db296c5490c6b
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jan 22 10:27:59 2015 +0100

    s3-pam_smbpass: Fix memory leak in pam_sm_authenticate().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11066
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 0cb9b28acb7008cd30c6de3add9876eb5607a5a6)
    
    Autobuild-User(v4-2-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-2-test): Sun Jan 25 00:37:52 CET 2015 on sn-devel-104

commit e38f3eac50dc24fe18ac0384b8008fe3b20be615
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Jan 13 17:04:26 2015 +0100

    utils: Fix 'net time' segfault.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11058
    
    This is part two of the bugfix. Make sure we pass the IP we found to
    cli_servertime(). Hence we always pass at least one of name or IP.
    
    Pair-Programmed-With: Michael Adam <obnox at samba.org>
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 45829800eb3f3a8aeccfe7c1114dcf9df60371d5)

commit a5d30bd2ecd8269de1071f535209cc2a33c5cbcd
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 16 16:18:45 2015 +0100

    cli_connect_nb_send: don't segfault on host == NULL.
    
    The functions called futher down can cope with host == NULL.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11058
    
    This is part one of the bugfix:
    This ensures that it is enough to pass one of host or address to the function.
    
    Pair-Programmed-With: Andreas Schneider <asn at samba.org>
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit a0a254f74234bed6c9a0c71a5bda8254fa6f633f)

commit 69dd55806f2487821b98faa8782cd9a562ca730b
Author: David Disseldorp <ddiss at samba.org>
Date:   Wed Jan 21 18:16:57 2015 +0100

    vfs_snapper: encode and decode Snapper DBus strings
    
    Snapper uses a special character encoding for strings used in DBus
    requests and responses. This change ensures that Samba packs and unpacks
    strings in the corresponding format, using the previously added
    encode/decode helper functions.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11055
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 32e9d7fa220d05f5ca95ed61cf6c7aa7d0261c03)

commit 428c5826d0dd4421f01be02d906be34a9925990b
Author: David Disseldorp <ddiss at samba.org>
Date:   Wed Jan 21 18:16:56 2015 +0100

    vfs_snapper: add DBus string encoding and decoding helpers
    
    Snapper uses the following mechanism for encoding and decoding strings
    used in DBus traffic:
    Characters above 127 (0x7F - ASCII DEL) must be encoded hexadecimal as
    "\x??". As a consequence "\" must be encoded as "\\".
    
    This change adds string encoding and decoding helpers to vfs_snapper.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11055
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 3d48fc96739bde631f8197aa313a81808481adf3)

commit 1381ac030864b19a4194ca90a4f6fad74b20b8dd
Author: David Disseldorp <ddiss at samba.org>
Date:   Wed Jan 21 18:16:55 2015 +0100

    vfs_snapper: free dbus req messages in error paths
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11055
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit f72fa6390b73f47a57033282335786c24664a3f8)

commit f92289914e64972dba01411ebc152a3a9575a8ae
Author: Günther Deschner <gd at samba.org>
Date:   Fri Jan 9 12:54:51 2015 +0100

    s3-vfs: Fix developer build of vfs_ceph module.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11070
    
    Guenther
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    (cherry picked from commit 5deb685ecd6f611bcf357f7040dc62582a50d2aa)

commit ffc1cca37f37a765566530939e2944d8b617b62f
Author: Ira Cooper <ira at samba.org>
Date:   Thu Jan 22 17:14:31 2015 -0500

    vfs_glusterfs: Add comments to the pipe(2) code.
    
    The guarantees around read(2) and write(2) and pipes are critical
    to understanding this code.  Hopefully these comments will help.
    
    Signed-off-by: Ira Cooper <ira at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Jan 23 20:58:51 CET 2015 on sn-devel-104
    
    (cherry picked from commit 3b2d8bdbb1851961536241d3aaaf6ac936964517)
    
    The last 10 patches address
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11069
    Backport remaining performance patches for vfs_glusterfs to 4.2/4.1.

commit 0c9e53baea56252380919e6fb895f66445a7d0de
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Jan 21 20:49:24 2015 +0100

    vfs: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Thu Jan 22 13:14:38 CET 2015 on sn-devel-104
    
    (cherry picked from commit db63e4887c81c3e458194004353d7ef92c67b393)

commit 7e0e0e0cfd051323ac6b2b69d3d73b6d4c1601c7
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 21 22:07:53 2015 +0100

    vfs:glusterfs: whitespace fix.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Jan 22 03:20:17 CET 2015 on sn-devel-104
    
    (cherry picked from commit cde5d380e192487ae77734afcb3eb3d327aafb98)

commit 42b9b52dd117e689d1957f22483db338b03e5581
Author: Ira Cooper <ira at samba.org>
Date:   Mon Jan 19 23:08:17 2015 -0500

    vfs_glusterfs: Replace eventfd with pipes, for AIO use
    
    Pipes clean up the AIO implementation substantially, due to the fact
    that they implement a natural ithread safe queue instead of us
    creating our own queue.
    
    Signed-off-by: Ira Cooper <ira at samba.org>
    Signed-off-by: Poornima G <pgurusid at redhat.com>
    Reviewed-by: Günther Deschner <gd at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Ira Cooper <ira at samba.org>
    Autobuild-Date(master): Wed Jan 21 20:40:11 CET 2015 on sn-devel-104
    
    (cherry picked from commit 4c3a3d9e6adc95d0f0e1f6030b2406613d9f9f53)

commit 1d05617a1c2b5c236805a9801e876de65a7af1b7
Author: raghavendra talur <raghavendra.talur at gmail.com>
Date:   Wed Dec 10 21:15:03 2014 +0530

    vfs/glusterfs: Change xattr key to match gluster key.
    
    Gluster changed the key used to do get_real_filename
    in 3.5. This changes Samba's glusterfs vfs-module
    to use the same key.
    
    This will render SMB_VFS_GET_REALFILENAME() working
    again under 3.5 and will remove support for that functionality
    for Gluster 3.4 and older.
    
    Signed-off-by: raghavendra talur <raghavendra.talur at gmail.com>
    Reviewed-by: Ira Cooper <ira at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    (cherry picked from commit af9ec9fea5a730023cdee6e236f9585e3a18b0e6)

commit d35fa8eebe73a33ce03c9ec47e0f12cdb7d652fe
Author: Poornima G <pgurusid at redhat.com>
Date:   Thu Dec 11 07:35:10 2014 +0530

    vfs_glusterfs: Implement AIO support
    
    Signed-off-by: Poornima G <pgurusid at redhat.com>
    
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Wed Dec 17 16:35:37 CET 2014 on sn-devel-104
    
    (cherry picked from commit 051b81aac81c7ccb234da221e9f8272b70b265ce)

commit bab4805cd866132603d96a517c7abc5ea1769023
Author: Poornima G <pgurusid at redhat.com>
Date:   Fri Dec 12 14:11:49 2014 +0100

    vfs_glusterfs: Change sys_get_acl_file/fd to return ACLs corresponding to mode bits when there are no ACLs set.
    
    Signed-off-by: Poornima G <pgurusid at redhat.com>
    
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    (cherry picked from commit 26b3544251babdfcdf5ada338a4ed39ff18bc47a)

commit d56da88a8654011111201c1bfa154b0b58e2f2f2
Author: raghavendra talur <raghavendra.talur at gmail.com>
Date:   Wed Dec 10 12:30:10 2014 +0530

    vfs_glusterfs: Set connectpath as snapdir-entry-path.
    
    snapview client in gluster would require connectpath
    in order add snapdir entry to readdir result.
    
    Signed-off-by: raghavendra talur <raghavendra.talur at gmail.com>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Wed Dec 10 16:38:27 CET 2014 on sn-devel-104
    
    (cherry picked from commit a12ae815b01b372cbf8697d32d5d45d7b2d5f93d)

commit 11d3349a2fae02d018624dc54bd8ed09cbb8e5f8
Author: raghavendra talur <raghavendra.talur at gmail.com>
Date:   Wed Dec 10 12:26:34 2014 +0530

    vfs_glusterfs: Remember the connect path too for reopening.
    
    As Samba allows us to share subdirs, lets re-use preopened
    connections to glusterfs only if they are for same volume
    AND same connectpath.
    
    Signed-off-by: raghavendra talur <raghavendra.talur at gmail.com>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    (cherry picked from commit 2fb4317352a165d0dd4af78fcf0a576fa246eab2)

commit 9994410a2b5896e2c6056ad5961bd29b5ebf8bd0
Author: Poornima G <pgurusid at redhat.com>
Date:   Thu Oct 30 17:14:51 2014 +0530

    vfs_glusterfs: In vfs_gluster_sys_acl_get_file/fd, reduce the number of getxattr calls.
    
    Signed-off-by: Poornima G <pgurusid at redhat.com>
    Reviewed-by: Ira Cooper <ira at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    (cherry picked from commit a4fa9ca5a7a4c0b770079ab126f8172ff6d6851c)

commit 7b78b08a66fa61b0beff3081744940676c9b36d7
Author: David Disseldorp <ddiss at samba.org>
Date:   Mon Jan 19 13:39:35 2015 +0100

    libsmb: provide authinfo domain for encrypted session referrals
    
    6c9de0cd056afc0b478c02f1bdb0e06532388037 requires this extra change.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11059
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Jan 21 04:29:06 CET 2015 on sn-devel-104
    
    (cherry picked from commit 6da86012a2ca521efe0cf1bf05fcd04c3099b190)

commit 8b95fb773e8f000f2a1555f2f09667d16dad9d0a
Author: David Disseldorp <ddiss at samba.org>
Date:   Fri Jan 16 16:21:23 2015 +0100

    libsmb: provide authinfo domain for DFS referral auth
    
    libsmbclient uses the smbc_init->smbc_get_auth_data_fn() provided
    workgroup/domain in initial connections, but then switches to the
    default smb.conf workgroup/domain when handling DFS referrals.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11059
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 6c9de0cd056afc0b478c02f1bdb0e06532388037)
    [ddiss at samba.org: 4.2 rebase with cli_init_creds() call]

commit e8bf65dba8a1f86ce20db182daea28b3a87e22eb
Author: David Disseldorp <ddiss at samba.org>
Date:   Fri Jan 16 16:21:22 2015 +0100

    libsmb: reuse connections derived from DFS referrals
    
    [MS-DFSC] 3.2.1.1 and 3.2.1.2 states that DFS targets with the same site
    location or relative cost are placed in random order in a DFS referral
    response.
    
    libsmbclient currently resolves DFS referrals on every API call, always
    using the first entry in the referral response. With random ordering,
    libsmbclient may open a new server connection, rather than reuse an
    existing (cached) connection established in a previous DFS referred API
    call.
    
    This change sees libsmbclient check the connection cache for any of the
    DFS referral response entries before creating a new connection.
    
    This change is based on a patch by Har Gagan Sahai
    <SHarGagan at novell.com>.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10123
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 7b7d4f740fe5017107d3100041cc8c7982f0eac7)

commit c2f8c939a3e0c9e7c9333ecc0db2f17cf2e6463c
Author: Christof Schmitt <cs at samba.org>
Date:   Thu Jan 15 14:31:19 2015 -0700

    samba3.py: Correctly initialize cache directory for passdb test
    
    Running 'make test TESTS=tests.samba3' succeeds, but the log shows that
    it tried to open the gencache tdb in the wrong directory:
    Unable to create directory /usr/local/samba/var/cache for file gencache.tdb. Error was No such file or directory
    
    Fix this by correctly initializing the cache directory.
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-By: Jelmer Vernooij <jelmer at samba.org>
    
    Autobuild-User(master): Christof Schmitt <cs at samba.org>
    Autobuild-Date(master): Fri Jan 16 02:36:39 CET 2015 on sn-devel-104
    (cherry picked from commit c31f54112e21b2e76398a402e864a2b6b6c74e6c)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11032

commit 091a3aa86ec74cfaf54e5fdb3e0141acc310587c
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Nov 17 14:59:34 2014 -0700

    gencache: Request mutexes for gencache_notrans.tdb
    
    The check in tdb_wrap ensures that mutexes are only used on systems that
    properly support them.
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Wed Nov 26 19:04:11 CET 2014 on sn-devel-104
    (cherry picked from commit 068f9e26486fbcd36c109df9ada50c9384ba52c5)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11032

commit 20d4a6773c9f4004b36a8a0e0b00e9bb7f2e52b1
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Nov 17 15:44:47 2014 -0700

    gencache: Convert gencache.tdb to tdb_wrap
    
    This change is not strictly necessary, but for consistency both gencache
    tdbs are now opened through tdb_wrap.
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit f80bbba2870a80ed421a1a222e430df86028e7c7)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11032

commit 980bba34b61a4fdc7b689e31104eee6b416a17e0
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Nov 17 14:30:49 2014 -0700

    gencache: Convert gencache_notrans to use tdb_wrap
    
    This allows using on the mutex check in tdb_wrap.
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    (cherry picked from commit 139bd9589ac759b4e7a6ae9aa465320c5fa85d18)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11032

commit ad16a9a5b30bc0c026aea380402d6072c3d62e72
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jul 2 07:44:04 2014 +0200

    s3:gencache: don't use transaction non non-persistent gencache_notrans.tdb
    
    gencache_notrans.tdb is a non-persistent cache layer above the
    persistent gencache.tdb. Despite its name, and despite the
    nature of non-persistent tdbs, the current stabilization code
    uses a transaction on gencache_notrans.tdb like this:
    
      transaction_start(cache)
      transaction_start(cache_notrans)
      traverse(cache_notrans, stabilize_fn)
      transaction_commit(cache)
      transaction_commit(cache_notrans)
    
    where stabilze_fn does this on a record:
      1. store it to or delete it from cache
         (depending on the timeout)
      2. delete it from the cache_notrans
    
    This patch changes gencache_notrans.tdb to avoid
    transactions by using an all-record lock like this:
    
      tdb_allrecord_lock(cache_notrans)
      transaction_start(cache)
      traverse(cache_notrans, stabilize_fn_mod)
      transaction_commit(cache)
      traverse(cache_notrans, wipe_fn)
      tdb_wipe_all(cache_notrans)
      tdb_allrecord_unlock(cache_notrans)
    
    with stabilize_fn_mod doing only:
      1. store the record to or delete it from cache
         (depending on the timeout)
    
    and wipe_fn deleting the records from the gencache_notrans db.
    
    This is a step towards making non-persistent-db specific features
    like mutex locking usable for gencache_notrans.tdb.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit 35fd2ca4984b3a1a8bbcb5c1c9e0d724e3c63d80)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11032

commit 0810b532ba752feb0c6660daa9636ffe0fea3441
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jun 26 16:56:41 2014 +0200

    s3:gencache: simply stabilize() a bit more: remove error from state
    
    state.error is set to true if and only if the traverse
    callback returns error (-1), and hence only if the traverse
    fails.
    
    Hence the the error state is redundant.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit d240cf7894f076a2ed2b6bc434f20a93cfbb1ca4)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11032

commit 12ea070c029bd63e7654829a8b8fe05b4bbcca8f
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jun 26 16:37:17 2014 +0200

    s3:gencache: fix logic in stabilization when deleting a record from stable cache
    
    Set state->written = true in the delete case
    if and only if the record has really been deleted.
    
    This does currently not seem to lead to an unneeded
    write to the DB, since failure to delete the record
    will cause the traverse and hence the transaction
    to cancel. But I think this is clearer.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    (cherry picked from commit 202ee81e869f4b51e1f904ef6ac3fb0030edfede)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11032

commit f24a9e5a745a6a06577809b7e7278746186e7fa4
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 25 21:03:18 2014 +0000

    lib: Use tdb_parse_record in gencache_set
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Wed Nov 26 14:50:38 CET 2014 on sn-devel-104
    (cherry picked from commit ec0c9ad0994d35e22ecc50e552d14582c51622b1)
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11032

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

Summary of changes:
 python/samba/tests/samba3.py       |   1 +
 source3/lib/gencache.c             | 178 +++++++++++-------
 source3/libsmb/cliconnect.c        |  22 ++-
 source3/libsmb/clidfs.c            | 118 +++++++++---
 source3/modules/vfs_ceph.c         |  30 ++-
 source3/modules/vfs_glusterfs.c    | 365 +++++++++++++++++++++++++++++++++----
 source3/modules/vfs_snapper.c      | 238 ++++++++++++++++++++++--
 source3/pam_smbpass/pam_smb_auth.c |  11 +-
 source3/utils/net_time.c           |  21 ++-
 9 files changed, 811 insertions(+), 173 deletions(-)


Changeset truncated at 500 lines:

diff --git a/python/samba/tests/samba3.py b/python/samba/tests/samba3.py
index 51d76dd..6eb7154 100644
--- a/python/samba/tests/samba3.py
+++ b/python/samba/tests/samba3.py
@@ -72,6 +72,7 @@ class PassdbTestCase(TestCaseInTempDir):
         self.lp.set("private dir", datadir)
         self.lp.set("state directory", datadir)
         self.lp.set("lock directory", datadir)
+        self.lp.set("cache directory", datadir)
         passdb.set_secrets_dir(datadir)
         self.pdb = passdb.PDB("tdbsam")
 
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index 3e67d9e..ec96f5a 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -25,6 +25,7 @@
 #include "system/filesys.h"
 #include "system/glob.h"
 #include "util_tdb.h"
+#include "tdb_wrap/tdb_wrap.h"
 #include "../lib/util/memcache.h"
 
 #undef  DBGC_CLASS
@@ -36,8 +37,8 @@
 #define BLOB_TYPE "DATA_BLOB"
 #define BLOB_TYPE_LEN 9
 
-static struct tdb_context *cache;
-static struct tdb_context *cache_notrans;
+static struct tdb_wrap *cache;
+static struct tdb_wrap *cache_notrans;
 static int cache_notrans_seqnum;
 
 /**
@@ -68,12 +69,14 @@ static bool gencache_init(void)
 
 	DEBUG(5, ("Opening cache file at %s\n", cache_fname));
 
-	cache = tdb_open_log(cache_fname, 0, TDB_DEFAULT|TDB_INCOMPATIBLE_HASH, open_flags, 0644);
+	cache = tdb_wrap_open(NULL, cache_fname, 0,
+			      TDB_DEFAULT|TDB_INCOMPATIBLE_HASH,
+			      open_flags, 0644);
 	if (cache) {
 		int ret;
-		ret = tdb_check(cache, NULL, NULL);
+		ret = tdb_check(cache->tdb, NULL, NULL);
 		if (ret != 0) {
-			tdb_close(cache);
+			TALLOC_FREE(cache);
 
 			/*
 			 * Retry with CLEAR_IF_FIRST.
@@ -85,18 +88,19 @@ static bool gencache_init(void)
 			 * CLEAR_IF_FIRST databases, so lets use it here to
 			 * clean up a broken database.
 			 */
-			cache = tdb_open_log(cache_fname, 0,
-					     TDB_DEFAULT|
-					     TDB_INCOMPATIBLE_HASH|
-					     TDB_CLEAR_IF_FIRST,
-					     open_flags, 0644);
+			cache = tdb_wrap_open(NULL, cache_fname, 0,
+					      TDB_DEFAULT|
+					      TDB_INCOMPATIBLE_HASH|
+					      TDB_CLEAR_IF_FIRST,
+					      open_flags, 0644);
 		}
 	}
 
 	if (!cache && (errno == EACCES)) {
 		open_flags = O_RDONLY;
-		cache = tdb_open_log(cache_fname, 0, TDB_DEFAULT|TDB_INCOMPATIBLE_HASH, open_flags,
-				     0644);
+		cache = tdb_wrap_open(NULL, cache_fname, 0,
+				      TDB_DEFAULT|TDB_INCOMPATIBLE_HASH,
+				      open_flags, 0644);
 		if (cache) {
 			DEBUG(5, ("gencache_init: Opening cache file %s read-only.\n", cache_fname));
 		}
@@ -111,17 +115,17 @@ static bool gencache_init(void)
 
 	DEBUG(5, ("Opening cache file at %s\n", cache_fname));
 
-	cache_notrans = tdb_open_log(cache_fname, 0,
-				     TDB_CLEAR_IF_FIRST|
-				     TDB_INCOMPATIBLE_HASH|
-				     TDB_SEQNUM|
-				     TDB_NOSYNC,
-				     open_flags, 0644);
+	cache_notrans = tdb_wrap_open(NULL, cache_fname, 0,
+				      TDB_CLEAR_IF_FIRST|
+				      TDB_INCOMPATIBLE_HASH|
+				      TDB_SEQNUM|
+				      TDB_NOSYNC|
+				      TDB_MUTEX_LOCKING,
+				      open_flags, 0644);
 	if (cache_notrans == NULL) {
 		DEBUG(5, ("Opening %s failed: %s\n", cache_fname,
 			  strerror(errno)));
-		tdb_close(cache);
-		cache = NULL;
+		TALLOC_FREE(cache);
 		return false;
 	}
 
@@ -240,6 +244,17 @@ static bool gencache_have_val(const char *keystr, const DATA_BLOB *data,
 	return state.gotit;
 }
 
+static int last_stabilize_parser(TDB_DATA key, TDB_DATA data,
+				 void *private_data)
+{
+	time_t *last_stabilize = private_data;
+
+	if ((data.dsize != 0) && (data.dptr[data.dsize-1] == '\0')) {
+		*last_stabilize = atoi((char *)data.dptr);
+	}
+	return 0;
+}
+
 /**
  * Set an entry in the cache file. If there's no such
  * one, then add it.
@@ -256,7 +271,6 @@ bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob,
 			    time_t timeout)
 {
 	int ret;
-	TDB_DATA databuf;
 	char* val;
 	time_t last_stabilize;
 	static int writecount;
@@ -299,7 +313,7 @@ bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob,
 		   timeout > time(NULL) ? "ahead" : "in the past"));
 
 	ret = tdb_store_bystring(
-		cache_notrans, keystr,
+		cache_notrans->tdb, keystr,
 		make_tdb_data((uint8_t *)val, talloc_array_length(val)),
 		0);
 	TALLOC_FREE(val);
@@ -326,12 +340,10 @@ bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob,
 	 */
 
 	last_stabilize = 0;
-	databuf = tdb_fetch_compat(cache_notrans, last_stabilize_key());
-	if ((databuf.dptr != NULL)
-	    && (databuf.dptr[databuf.dsize-1] == '\0')) {
-		last_stabilize = atoi((char *)databuf.dptr);
-		SAFE_FREE(databuf.dptr);
-	}
+
+	tdb_parse_record(cache_notrans->tdb, last_stabilize_key(),
+			 last_stabilize_parser, &last_stabilize);
+
 	if ((last_stabilize
 	     + lp_parm_int(-1, "gencache", "stabilize_interval", 300))
 	    < time(NULL)) {
@@ -478,7 +490,7 @@ bool gencache_parse(const char *keystr,
 		 * Make sure that nobody has changed the gencache behind our
 		 * back.
 		 */
-		int current_seqnum = tdb_get_seqnum(cache_notrans);
+		int current_seqnum = tdb_get_seqnum(cache_notrans->tdb);
 		if (current_seqnum == cache_notrans_seqnum) {
 			/*
 			 * Ok, our memcache is still current, use it without
@@ -496,11 +508,12 @@ bool gencache_parse(const char *keystr,
 
 	state.is_memcache = false;
 
-	ret = tdb_parse_record(cache_notrans, key, gencache_parse_fn, &state);
+	ret = tdb_parse_record(cache_notrans->tdb, key,
+			       gencache_parse_fn, &state);
 	if (ret == 0) {
 		return true;
 	}
-	ret = tdb_parse_record(cache, key, gencache_parse_fn, &state);
+	ret = tdb_parse_record(cache->tdb, key, gencache_parse_fn, &state);
 	return (ret == 0);
 }
 
@@ -595,11 +608,13 @@ fail:
 
 struct stabilize_state {
 	bool written;
-	bool error;
 };
 static int stabilize_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val,
 			void *priv);
 
+static int wipe_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val,
+		   void *priv);
+
 /**
  * Stabilize gencache
  *
@@ -617,9 +632,9 @@ bool gencache_stabilize(void)
 		return false;
 	}
 
-	res = tdb_transaction_start_nonblock(cache);
+	res = tdb_transaction_start_nonblock(cache->tdb);
 	if (res != 0) {
-		if (tdb_error(cache) == TDB_ERR_NOLOCK)
+		if (tdb_error(cache->tdb) == TDB_ERR_NOLOCK)
 		{
 			/*
 			 * Someone else already does the stabilize,
@@ -629,52 +644,61 @@ bool gencache_stabilize(void)
 		}
 
 		DEBUG(10, ("Could not start transaction on gencache.tdb: "
-			   "%s\n", tdb_errorstr_compat(cache)));
+			   "%s\n", tdb_errorstr_compat(cache->tdb)));
 		return false;
 	}
-	res = tdb_transaction_start(cache_notrans);
+
+	res = tdb_lockall(cache_notrans->tdb);
 	if (res != 0) {
-		tdb_transaction_cancel(cache);
-		DEBUG(10, ("Could not start transaction on "
+		tdb_transaction_cancel(cache->tdb);
+		DEBUG(10, ("Could not get allrecord lock on "
 			   "gencache_notrans.tdb: %s\n",
-			   tdb_errorstr_compat(cache_notrans)));
+			   tdb_errorstr_compat(cache_notrans->tdb)));
 		return false;
 	}
 
-	state.error = false;
 	state.written = false;
 
-	res = tdb_traverse(cache_notrans, stabilize_fn, &state);
-	if ((res < 0) || state.error) {
-		tdb_transaction_cancel(cache_notrans);
-		tdb_transaction_cancel(cache);
+	res = tdb_traverse(cache_notrans->tdb, stabilize_fn, &state);
+	if (res < 0) {
+		tdb_unlockall(cache_notrans->tdb);
+		tdb_transaction_cancel(cache->tdb);
 		return false;
 	}
 
 	if (!state.written) {
-		tdb_transaction_cancel(cache_notrans);
-		tdb_transaction_cancel(cache);
+		tdb_unlockall(cache_notrans->tdb);
+		tdb_transaction_cancel(cache->tdb);
 		return true;
 	}
 
-	res = tdb_transaction_commit(cache);
+	res = tdb_transaction_commit(cache->tdb);
 	if (res != 0) {
 		DEBUG(10, ("tdb_transaction_commit on gencache.tdb failed: "
-			   "%s\n", tdb_errorstr_compat(cache)));
-		tdb_transaction_cancel(cache_notrans);
+			   "%s\n", tdb_errorstr_compat(cache->tdb)));
+		tdb_unlockall(cache_notrans->tdb);
 		return false;
 	}
 
-	res = tdb_transaction_commit(cache_notrans);
+	res = tdb_traverse(cache_notrans->tdb, wipe_fn, NULL);
 	if (res != 0) {
-		DEBUG(10, ("tdb_transaction_commit on gencache.tdb failed: "
-			   "%s\n", tdb_errorstr_compat(cache)));
+		DEBUG(10, ("tdb_traverse with wipe_fn on gencache_notrans.tdb "
+			  "failed: %s\n",
+			   tdb_errorstr_compat(cache_notrans->tdb)));
+		tdb_unlockall(cache_notrans->tdb);
+		return false;
+	}
+
+	res = tdb_unlockall(cache_notrans->tdb);
+	if (res != 0) {
+		DEBUG(10, ("tdb_unlockall on gencache.tdb failed: "
+			   "%s\n", tdb_errorstr_compat(cache->tdb)));
 		return false;
 	}
 
 	now = talloc_asprintf(talloc_tos(), "%d", (int)time(NULL));
 	if (now != NULL) {
-		tdb_store(cache_notrans, last_stabilize_key(),
+		tdb_store(cache_notrans->tdb, last_stabilize_key(),
 			  string_term_tdb_data(now), 0);
 		TALLOC_FREE(now);
 	}
@@ -698,14 +722,14 @@ static int stabilize_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val,
 		return 0;
 	}
 	if ((timeout < time(NULL)) || (val.dsize == 0)) {
-		res = tdb_delete(cache, key);
-		if ((res != 0) && (tdb_error(cache) == TDB_ERR_NOEXIST)) {
-			res = 0;
-		} else {
+		res = tdb_delete(cache->tdb, key);
+		if (res == 0) {
 			state->written = true;
+		} else if (tdb_error(cache->tdb) == TDB_ERR_NOEXIST) {
+			res = 0;
 		}
 	} else {
-		res = tdb_store(cache, key, val, 0);
+		res = tdb_store(cache->tdb, key, val, 0);
 		if (res == 0) {
 			state->written = true;
 		}
@@ -713,20 +737,42 @@ static int stabilize_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val,
 
 	if (res != 0) {
 		DEBUG(10, ("Transfer to gencache.tdb failed: %s\n",
-			   tdb_errorstr_compat(cache)));
-		state->error = true;
+			   tdb_errorstr_compat(cache->tdb)));
 		return -1;
 	}
 
-	if (tdb_delete(cache_notrans, key) != 0) {
+	return 0;
+}
+
+static int wipe_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val,
+		   void *priv)
+{
+	int res;
+	bool ok;
+	time_t timeout;
+
+	res = tdb_data_cmp(key, last_stabilize_key());
+	if (res == 0) {
+		return 0;
+	}
+
+	ok = gencache_pull_timeout((char *)val.dptr, &timeout, NULL);
+	if (!ok) {
+		DEBUG(10, ("Ignoring invalid entry\n"));
+		return 0;
+	}
+
+	res = tdb_delete(tdb, key);
+	if (res != 0) {
 		DEBUG(10, ("tdb_delete from gencache_notrans.tdb failed: "
-			   "%s\n", tdb_errorstr_compat(cache_notrans)));
-		state->error = true;
+			   "%s\n", tdb_errorstr_compat(cache_notrans->tdb)));
 		return -1;
 	}
+
 	return 0;
 }
 
+
 /**
  * Get existing entry from the cache file.
  *
@@ -810,7 +856,7 @@ static int gencache_iterate_blobs_fn(struct tdb_context *tdb, TDB_DATA key,
 	if (tdb_data_cmp(key, last_stabilize_key()) == 0) {
 		return 0;
 	}
-	if (state->in_persistent && tdb_exists(cache_notrans, key)) {
+	if (state->in_persistent && tdb_exists(cache_notrans->tdb, key)) {
 		return 0;
 	}
 
@@ -865,10 +911,10 @@ void gencache_iterate_blobs(void (*fn)(const char *key, DATA_BLOB value,
 	state.private_data = private_data;
 
 	state.in_persistent = false;
-	tdb_traverse(cache_notrans, gencache_iterate_blobs_fn, &state);
+	tdb_traverse(cache_notrans->tdb, gencache_iterate_blobs_fn, &state);
 
 	state.in_persistent = true;
-	tdb_traverse(cache, gencache_iterate_blobs_fn, &state);
+	tdb_traverse(cache->tdb, gencache_iterate_blobs_fn, &state);
 }
 
 /**
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 9508651..7292805 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -3013,21 +3013,29 @@ static struct tevent_req *cli_connect_nb_send(
 {
 	struct tevent_req *req, *subreq;
 	struct cli_connect_nb_state *state;
-	char *p;
 
 	req = tevent_req_create(mem_ctx, &state, struct cli_connect_nb_state);
 	if (req == NULL) {
 		return NULL;
 	}
-	state->desthost = host;
 	state->signing_state = signing_state;
 	state->flags = flags;
 
-	p = strchr(host, '#');
-	if (p != NULL) {
-		name_type = strtol(p+1, NULL, 16);
-		host = talloc_strndup(state, host, p - host);
-		if (tevent_req_nomem(host, req)) {
+	if (host != NULL) {
+		char *p = strchr(host, '#');
+
+		if (p != NULL) {
+			name_type = strtol(p+1, NULL, 16);
+			host = talloc_strndup(state, host, p - host);
+			if (tevent_req_nomem(host, req)) {
+				return tevent_req_post(req, ev);
+			}
+		}
+
+		state->desthost = host;
+	} else {
+		state->desthost = print_canonical_sockaddr(state, dest_ss);
+		if (tevent_req_nomem(state->desthost, req)) {
 			return tevent_req_post(req, ev);
 		}
 	}
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index 93f04c5..603a4d2 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -111,6 +111,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
 	char *newserver, *newshare;
 	const char *username;
 	const char *password;
+	const char *domain;
 	NTSTATUS status;
 	int flags = 0;
 
@@ -184,11 +185,15 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
 
 	username = get_cmdline_auth_info_username(auth_info);
 	password = get_cmdline_auth_info_password(auth_info);
+	domain = get_cmdline_auth_info_domain(auth_info);
+	if ((domain == NULL) || (domain[0] == '\0')) {
+		domain = lp_workgroup();
+	}
 
 	status = cli_session_setup(c, username,
 				   password, strlen(password),
 				   password, strlen(password),
-				   lp_workgroup());
+				   domain);
 	if (!NT_STATUS_IS_OK(status)) {
 		/* If a password was not supplied then
 		 * try again with a null username. */
@@ -209,7 +214,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
 		d_printf("Anonymous login successful\n");
 		status = cli_init_creds(c, "", lp_workgroup(), "");
 	} else {
-		status = cli_init_creds(c, username, lp_workgroup(), password);
+		status = cli_init_creds(c, username, domain, password);
 	}
 
 	if (!NT_STATUS_IS_OK(status)) {
@@ -240,7 +245,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
 				force_encrypt,
 				username,
 				password,
-				lp_workgroup())) {
+				domain)) {
 		cli_shutdown(c);
 		return do_connect(ctx, newserver,
 				newshare, auth_info, false,
@@ -262,7 +267,7 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
 		status = cli_cm_force_encryption(c,
 					username,
 					password,
-					lp_workgroup(),
+					domain,
 					sharename);
 		if (!NT_STATUS_IS_OK(status)) {
 			cli_shutdown(c);
@@ -837,6 +842,11 @@ NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
 
 /********************************************************************
 ********************************************************************/
+struct cli_dfs_path_split {
+	char *server;
+	char *share;
+	char *extrapath;
+};
 
 NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
 			  const char *mountpt,
@@ -854,9 +864,9 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
 	char *cleanpath = NULL;
 	char *extrapath = NULL;
 	int pathlen;
-	char *server = NULL;
-	char *share = NULL;
 	struct cli_state *newcli = NULL;
+	struct cli_state *ccli = NULL;
+	int count = 0;
 	char *newpath = NULL;
 	char *newmount = NULL;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list