[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Tue Aug 6 15:41:02 UTC 2019


The branch, master has been updated
       via  5d4aa6e8670 s3:smbd: Fix sync dosmode fallback in async dosmode codepath
       via  ea17bd5539e s3:smbd: Incomplete conversion of former parametric options
       via  f5388f97792 ctdb: fix compilation on systems with glibc robust mutexes
       via  37bb6229ad4 s3: smbd: fix a comment in fd_close()
       via  3e0cafc2b54 s3: smbd: inline dptr_close_internal()
       via  7d72cf02e79 s3: smbd: simplify dptr_CloseDir()
       via  6d0924d8ea0 s3: smbd: remove redundant smb_dname arg from dptr_create()
       via  d84c048ea53 s3: smbd: Remove call to dptr_closecnum() on connection shutdown.
       via  043c2321448 s3: smbd: Remove dptr_close().
       via  196fe53ede8 s3: smbd: Remove dptr_close() from dptr_closecnum().
       via  a8ca5dc467c s3: smbd: Remove dptr_close() from reply_findclose().
       via  779dd3f1e6b s3: smbd: Remove dptr_close() from call_trans2findnext().
       via  269fbc91646 s3: smbd: Remove dptr_close() from call_trans2findfirst().
       via  63e1220a2bb s3: smbd: Remove dptr_close() from reply_fclose().
       via  24722da0b1f s3: smbd: Remove dptr_close() from reply_search().
       via  f5eebfc7251 s3: smbd: Remove dptr_fsp(). No longer used.
       via  37e1dd5af3b s3: smbd: Replace dptr_fsp() with dptr_fetch_lanman2_fsp() in reply_findclose().
       via  b4431ad3051 s3: smbd: Remove dptr_fetch_lanman2() - unused.
       via  d6e709c43ea s3: smbd: Convert call_trans2findnext() to use dptr_fetch_lanman2_fsp().
       via  b922f6e7045 s3: smbd: Add dptr_fetch_lanman2_fsp() - to replace dptr_fetch_lanman2().
       via  e63400841e9 s3: smbd: Remove dptr_fetch() - replace internals with dptr_fetch_fsp().
       via  a2ef44b71bf s3: smbd: Replace dptr_fetch() with dptr_fetch_fsp() in reply_search().
       via  68e403fa587 s3: smbd: Replace dptr_fetch() with dptr_fetch_fsp() in reply_fclose().
       via  96e8175dc81 s3: smbd: Add dptr_fetch_fsp() for SMB1 code. We will use this to replace dptr_fetch().
       via  5a7aaa8060f s3: smbd: Remove now unused dptr_activecnum().
       via  916afa3746a s3: smbd: All directory enumeration is now via file handles - remove unneeded code in idle connections.
       via  de2167668ea s3: smbd: Remove now unused dptr_closepath().
       via  492b322237d s3: smbd: Now we properly open file handles for directory enumerations, we don't need this code in SMB1rmdir.
       via  247515982f0 s3: smbd: Now we are always using fsp handle-based client searches, simplify smb_Dir_destructor().
       via  84312fc5c28 s3: smbd: Now we're using OpenDir_fsp() all the time, make sure we don't leak file handles.
       via  d485c43cc74 s3: smbd: Now we always use handle for directory enumeration, we can delete the fallback code.
       via  a130760f709 s3: smbd: Convert SMB1 reply_search() to use handle-based directory enumeration.
       via  043443ee33b s3: smbd: Convert SMB1 call_trans2findfirst() to use handle-based directory enumeration.
       via  5388df783e4 s3: smbd: Prepare for SMB1 directory handle opens in call_trans2findnext()
       via  264d6b408e0 s3: smbd: Prepare for SMB1 directory handle opens in call_trans2findfirst()
       via  61c239fcec1 s3: smbd: Prepare for SMB1 directory handle opens in reply_findclose()
       via  b055f1ac7b6 s3: smbd: Prepare for SMB1 directory handle opens in reply_fclose()
       via  e686e7b6b3f s3: smbd: Prepare for SMB1 directory handle opens in reply_search()
       via  aa3a087193b s3: smbd: Prepare for SMB1 directory handle opens in dptr_closecnum().
       via  a5f8769c25e s3: smbd: Change dptr_closecnum() to use dptr_close() instead of dptr_close_internal().
       via  5a038f51141 s3: smbd: Make dptr_close() safe to call with an fsp handle stored in dptr->dir_hnd.
       via  2ba48f76eca s3: smbd: Add dptr_fsp() to return any stored files_struct pointer.
       via  f61dae76359 s3: smbd: Move the strange OS/2 directory key == -1 close semantics to the caller.
       via  23d0555c0d0 s3: smbd: dptr_close() can only be called from SMB1 code.
      from  eebcc88ddf9 doc: improve vfs objects parameter description

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5d4aa6e867044e6b58b45acde32ac35e1d0a7765
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Aug 5 11:11:14 2019 +0200

    s3:smbd: Fix sync dosmode fallback in async dosmode codepath
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14070
    RN: Fix sync dosmode fallback in async dosmode codepath
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Tue Aug  6 15:40:18 UTC 2019 on sn-devel-184

commit ea17bd5539eb0be7a446b99c8b6baa4aa1ab273f
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Aug 5 10:59:22 2019 +0200

    s3:smbd: Incomplete conversion of former parametric options
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14069
    RN: Incomplete conversion of former parametric options
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit f5388f97792ac2d7962950dad91aaf8ad49bceaa
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Jul 12 10:49:13 2019 +0200

    ctdb: fix compilation on systems with glibc robust mutexes
    
    On older systems like SLES 11 without POSIX robust mutexes, but with glib robust
    mutexes where all the functions are available but have a "_np" suffix,
    compilation fails in:
    
    ctdb/tests/src/test_mutex_raw.c.239.o: In function `worker':
    /root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:129: undefined reference to `pthread_mutex_consistent'
    ctdb/tests/src/test_mutex_raw.c.239.o: In function `main':
    /root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:285: undefined reference to `pthread_mutex_consistent'
    /root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:332: undefined reference to `pthread_mutexattr_setrobust'
    /root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:363: undefined reference to `pthread_mutex_consistent'
    collect2: ld returned 1 exit status
    
    This could be fixed by using libreplace system/threads.h instead of pthreads.h
    directly, but as there has been a desire to keep test_mutex_raw.c standalone and
    compilable without other external depenencies then libc and libpthread, make the
    tool developer build only. This should get the average user over the cliff.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14038
    RN: Fix compiling ctdb on older systems lacking POSIX robust mutexes
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 37bb6229ad48b7a443eefa19a1845ce92a5bf546
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Aug 4 09:29:44 2019 +0200

    s3: smbd: fix a comment in fd_close()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3e0cafc2b545f16b84f2f46a270e62a541fc4e49
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Aug 4 09:21:55 2019 +0200

    s3: smbd: inline dptr_close_internal()
    
    There's now only one caller left.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7d72cf02e799502bf7df93183d325a3d50433569
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Aug 4 09:15:47 2019 +0200

    s3: smbd: simplify dptr_CloseDir()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6d0924d8ea0391c5b6414a79d25e15ddfd7dd448
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Aug 4 09:13:34 2019 +0200

    s3: smbd: remove redundant smb_dname arg from dptr_create()
    
    Now that dptr_create() is handle based, we can simply used the fsp name.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d84c048ea5350418cff87d5bf12f2f583d592994
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 14:59:00 2019 -0700

    s3: smbd: Remove call to dptr_closecnum() on connection shutdown.
    
    Now all client enumerations use fsp file handles we will
    aleady close them in file_close_conn() above.
    
    The only user of dptr_closecnum() is for the strange old OS/2
    semantics, so I can't get rid of it until SMB1 is removed.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 043c232144830d4da12cae877994caa16ec91c6d
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 14:58:25 2019 -0700

    s3: smbd: Remove dptr_close().
    
    No longer used.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 196fe53ede8743ab02a2a29d574cfd27632ceb3f
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 14:56:42 2019 -0700

    s3: smbd: Remove dptr_close() from dptr_closecnum().
    
    Now we're handle-based close_file() already does
    what is needed to shut down directory enumeration.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit a8ca5dc467c40619722b165a22fdf13b9b474c86
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:55:25 2019 -0700

    s3: smbd: Remove dptr_close() from reply_findclose().
    
    Now we're handle-based close_file() already does
    what is needed to shut down directory enumeration.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 779dd3f1e6bc462057a8f367d6c7cbb5cd75d4ba
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:54:43 2019 -0700

    s3: smbd: Remove dptr_close() from call_trans2findnext().
    
    Now we're handle-based close_file() already does
    what is needed to shut down directory enumeration.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 269fbc9164615d0e6034b873a76552cb138b24ea
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:53:33 2019 -0700

    s3: smbd: Remove dptr_close() from call_trans2findfirst().
    
    Now we're handle-based close_file() already does
    what is needed to shut down directory enumeration.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 63e1220a2bb984a89b2f6e20c37f16d15f1a8814
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:37:02 2019 -0700

    s3: smbd: Remove dptr_close() from reply_fclose().
    
    Now we're handle-based close_file() already does
    what is needed to shut down directory enumeration.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 24722da0b1f2602c111026b7e6af82360d60a637
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:35:57 2019 -0700

    s3: smbd: Remove dptr_close() from reply_search().
    
    Now we're handle-based close_file() already does
    what is needed to shut down directory enumeration.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit f5eebfc725136d1fdf2d6c9f66db59f24338f9c2
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:45:16 2019 -0700

    s3: smbd: Remove dptr_fsp(). No longer used.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 37e1dd5af3b30f1c7a76cced215b440bedc1ba4b
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:43:43 2019 -0700

    s3: smbd: Replace dptr_fsp() with dptr_fetch_lanman2_fsp() in reply_findclose().
    
    Now we have no users of dptr_fsp() left.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit b4431ad3051aa22347455fd3bcb181d17026d501
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:28:53 2019 -0700

    s3: smbd: Remove dptr_fetch_lanman2() - unused.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit d6e709c43ea8d8ecbe43a6a499fa5e3ed956bce6
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:26:40 2019 -0700

    s3: smbd: Convert call_trans2findnext() to use dptr_fetch_lanman2_fsp().
    
    dptr_fetch_lanman2() is now no longer used.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit b922f6e7045fc7906ea60cd715b156ff61d477e2
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:20:08 2019 -0700

    s3: smbd: Add dptr_fetch_lanman2_fsp() - to replace dptr_fetch_lanman2().
    
    Not yet used.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit e63400841e9d3372b8960b8764d45729926fb02f
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:16:37 2019 -0700

    s3: smbd: Remove dptr_fetch() - replace internals with dptr_fetch_fsp().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit a2ef44b71bffb8500dd88538b1e617497816f608
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:11:57 2019 -0700

    s3: smbd: Replace dptr_fetch() with dptr_fetch_fsp() in reply_search().
    
    We now no longer use dptr_fetch().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 68e403fa587b4c6a27e6d0f2b901942a01e42ea6
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:07:33 2019 -0700

    s3: smbd: Replace dptr_fetch() with dptr_fetch_fsp() in reply_fclose().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 96e8175dc81b32ba065ad393f8413373937d41cb
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 13:05:43 2019 -0700

    s3: smbd: Add dptr_fetch_fsp() for SMB1 code. We will use this to replace dptr_fetch().
    
    Not yet used.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 5a7aaa8060fdcfc2e066f1ef859634bc115699db
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 16 09:44:25 2019 -0700

    s3: smbd: Remove now unused dptr_activecnum().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 916afa3746aebe07a06d512db72a852df2f26b9c
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 16 09:43:04 2019 -0700

    s3: smbd: All directory enumeration is now via file handles - remove unneeded code in idle connections.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit de2167668eaff6b896b4f2e255f37b8755aa3fba
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 16 09:41:39 2019 -0700

    s3: smbd: Remove now unused dptr_closepath().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 492b322237db42b025d2c3c16ae0e6c78b736838
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 16 09:39:54 2019 -0700

    s3: smbd: Now we properly open file handles for directory enumerations, we don't need this code in SMB1rmdir.
    
    The share mode exclusion will prevent deletion of open directory
    enumeration handles.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 247515982f01db25b484e707621b56c836663a08
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 15:25:11 2019 -0700

    s3: smbd: Now we are always using fsp handle-based client searches, simplify smb_Dir_destructor().
    
    We know we always have a dir_hnd->dir and dir_hnd->fsp.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 84312fc5c289c926e189504b144bf9655491f706
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 15:21:21 2019 -0700

    s3: smbd: Now we're using OpenDir_fsp() all the time, make sure we don't leak file handles.
    
    We must always set dir_hnd->fsp, even in the fallback to
    SMB_VFS_OPENDIR() case. Remember if we had to fall back
    and fix the destructor to close the additional file
    descriptor if we did.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit d485c43cc74c5550d151fe728ddc53b02ab23df8
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 11:21:12 2019 -0700

    s3: smbd: Now we always use handle for directory enumeration, we can delete the fallback code.
    
    The code inside open_dir_safely() is root safe
    and can replace the deleted open_dir_with_privilege()
    fallback code.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit a130760f70960de559b845fffb1b70dc11db6f24
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Jul 15 17:13:33 2019 -0700

    s3: smbd: Convert SMB1 reply_search() to use handle-based directory enumeration.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 043443ee33bcd8ad61ec59574aaacdde511656da
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Jul 15 17:06:52 2019 -0700

    s3: smbd: Convert SMB1 call_trans2findfirst() to use handle-based directory enumeration.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 5388df783e4b60082113086ce6c94e47a841055f
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 10:46:09 2019 -0700

    s3: smbd: Prepare for SMB1 directory handle opens in call_trans2findnext()
    
    Call close_file() on any SMB1 directory handle once the dptr is closed.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 264d6b408e09c2a1758466ec22adb3386f623777
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 10:45:14 2019 -0700

    s3: smbd: Prepare for SMB1 directory handle opens in call_trans2findfirst()
    
    Call close_file() on any SMB1 directory handle once the dptr is closed.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 61c239fcec1589d078678e729a19920adfe198f6
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 10:42:21 2019 -0700

    s3: smbd: Prepare for SMB1 directory handle opens in reply_findclose()
    
    Call close_file() on any SMB1 directory handle once the dptr is closed.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit b055f1ac7b69ede807eead360b7ffb9c65dea53c
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 10:40:51 2019 -0700

    s3: smbd: Prepare for SMB1 directory handle opens in reply_fclose()
    
    Call close_file() on any SMB1 directory handle once the dptr is closed.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit e686e7b6b3f6d8e8ac1cd71979e59d1382c2124a
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 10:38:45 2019 -0700

    s3: smbd: Prepare for SMB1 directory handle opens in reply_search()
    
    Call close_file() on any SMB1 directory handle once the dptr is closed.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit aa3a087193b23001bd7a17e30644b5cbeb0119eb
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 10:36:20 2019 -0700

    s3: smbd: Prepare for SMB1 directory handle opens in dptr_closecnum().
    
    Call close_file() on any SMB1 directory handle once the dptr is closed.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit a5f8769c25ec119805586c145c09f6a63603bc36
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Jul 15 16:06:09 2019 -0700

    s3: smbd: Change dptr_closecnum() to use dptr_close() instead of dptr_close_internal().
    
    This will allow us to close any outstanding handles on
    an SMB1 connection as later commits move us to using directory
    handles instead of pathname directory opens.
    
    This is inefficient, as it means walking the list twice,
    but this will only be called with active dptrs in the
    OS/2 -1 case, in the connection shutdown case the
    directory handles will already have been closed.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 5a038f511413fdfaa26e41ceee35c1523185b071
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 12:57:00 2019 -0700

    s3: smbd: Make dptr_close() safe to call with an fsp handle stored in dptr->dir_hnd.
    
    SMB1 doesn't currently do this, but subsequent changes will add handle based
    calls to SMB1 so dptr_close() has to be able to cleanly remove any back pointers.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 2ba48f76ecaab3ddcd5d030a1dab3b5a889532b6
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 17 11:00:06 2019 -0700

    s3: smbd: Add dptr_fsp() to return any stored files_struct pointer.
    
    Will allow [find/search]_next() calls to find and close any associated
    fsp. This function is temporary and will eventually go away once I
    modify dptr_fetch() to return an fsp.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit f61dae7635971bcbae4d191219ccb5365984d059
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Jul 15 15:57:48 2019 -0700

    s3: smbd: Move the strange OS/2 directory key == -1 close semantics to the caller.
    
    This will allow us to change dptr_closecnum() to close outstanding fsp
    handles for SMB1 later.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 23d0555c0d0ff2efc62e80dde58f146de97cc27b
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Jul 15 14:58:21 2019 -0700

    s3: smbd: dptr_close() can only be called from SMB1 code.
    
    SMB_ASSERT this is the case.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

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

Summary of changes:
 ctdb/wscript                        |   2 +-
 source3/modules/vfs_ceph.c          |   2 +-
 source3/modules/vfs_glusterfs.c     |   2 +-
 source3/modules/vfs_gpfs.c          |   2 +-
 source3/smbd/conn_idle.c            |  10 -
 source3/smbd/dir.c                  | 358 +++++++++---------------------------
 source3/smbd/dosmode.c              |   6 +-
 source3/smbd/open.c                 |   6 +-
 source3/smbd/proto.h                |  10 +-
 source3/smbd/reply.c                | 114 +++++++++---
 source3/smbd/service.c              |   4 -
 source3/smbd/smb2_query_directory.c |   1 -
 source3/smbd/trans2.c               | 128 ++++++++++---
 13 files changed, 299 insertions(+), 346 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/wscript b/ctdb/wscript
index 3b8fea45e74..573a8f0e643 100644
--- a/ctdb/wscript
+++ b/ctdb/wscript
@@ -1047,7 +1047,7 @@ def build(bld):
                               ib_deps,
                          install_path='${CTDB_TEST_LIBEXECDIR}')
 
-    if bld.env.HAVE_ROBUST_MUTEXES and sys.platform.startswith('linux'):
+    if bld.env.HAVE_ROBUST_MUTEXES and sys.platform.startswith('linux') and bld.env.DEVELOPER:
         bld.SAMBA_BINARY('test_mutex_raw',
                          source='tests/src/test_mutex_raw.c',
                          deps='pthread',
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 1b293ddb1b0..28363f003c2 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -146,7 +146,7 @@ static int cephwrap_connect(struct vfs_handle_struct *handle,  const char *servi
 	/*
 	 * Unless we have an async implementation of getxattrat turn this off.
 	 */
-	lp_do_parameter(SNUM(handle->conn), "smbd:async dosmode", "false");
+	lp_do_parameter(SNUM(handle->conn), "smbd async dosmode", "false");
 
 	return 0;
 
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 95f32f9d0a6..3aa66c270e1 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -366,7 +366,7 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle,
 	/*
 	 * Unless we have an async implementation of getxattrat turn this off.
 	 */
-	lp_do_parameter(SNUM(handle->conn), "smbd:async dosmode", "false");
+	lp_do_parameter(SNUM(handle->conn), "smbd async dosmode", "false");
 
 done:
 	if (ret < 0) {
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index f0d5074d36b..22848496178 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -2195,7 +2195,7 @@ static int vfs_gpfs_connect(struct vfs_handle_struct *handle,
 	 * Unless we have an async implementation of get_dos_attributes turn
 	 * this off.
 	 */
-	lp_do_parameter(SNUM(handle->conn), "smbd:async dosmode", "false");
+	lp_do_parameter(SNUM(handle->conn), "smbd async dosmode", "false");
 
 	return 0;
 }
diff --git a/source3/smbd/conn_idle.c b/source3/smbd/conn_idle.c
index 8fa42b2dd63..1934e9cc130 100644
--- a/source3/smbd/conn_idle.c
+++ b/source3/smbd/conn_idle.c
@@ -59,16 +59,6 @@ bool conn_idle_all(struct smbd_server_connection *sconn, time_t t)
 	for (conn=sconn->connections;conn;conn=conn->next) {
 		time_t age = t - conn->lastused;
 
-		/*
-		 * Don't idle connections with active
-		 * SMB1 directory scans. When all scans
-		 * are via file handles this code can
-		 * be removed.
-		 */
-		if (dptr_activecnum(sconn, conn)) {
-			return false;
-		}
-
 		if (conn->num_files_open > 0 || age < deadtime) {
 			return false;
 		}
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 7a845e9a2d0..521cb60324e 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -59,6 +59,7 @@ struct smb_Dir {
 	unsigned int file_number;
 	files_struct *fsp; /* Back pointer to containing fsp, only
 			      set from OpenDir_fsp(). */
+	bool fallback_opendir;
 };
 
 struct dptr_struct {
@@ -169,77 +170,6 @@ uint16_t dptr_attr(struct smbd_server_connection *sconn, int key)
 	return(0);
 }
 
-/****************************************************************************
- Close a dptr (internal func).
-****************************************************************************/
-
-static void dptr_close_internal(struct dptr_struct *dptr)
-{
-	struct smbd_server_connection *sconn = dptr->conn->sconn;
-
-	DEBUG(4,("closing dptr key %d\n",dptr->dnum));
-
-	if (sconn == NULL) {
-		goto done;
-	}
-
-	if (sconn->using_smb2) {
-		goto done;
-	}
-
-	DLIST_REMOVE(sconn->searches.dirptrs, dptr);
-
-	/*
-	 * Free the dnum in the bitmap. Remember the dnum value is always 
-	 * biased by one with respect to the bitmap.
-	 */
-
-	if (!bitmap_query(sconn->searches.dptr_bmap, dptr->dnum - 1)) {
-		DEBUG(0,("dptr_close_internal : Error - closing dnum = %d and bitmap not set !\n",
-			dptr->dnum ));
-	}
-
-	bitmap_clear(sconn->searches.dptr_bmap, dptr->dnum - 1);
-
-done:
-	TALLOC_FREE(dptr->dir_hnd);
-	TALLOC_FREE(dptr);
-}
-
-/****************************************************************************
- Close a dptr given a key.
-****************************************************************************/
-
-void dptr_close(struct smbd_server_connection *sconn, int *key)
-{
-	struct dptr_struct *dptr;
-
-	if(*key == INVALID_DPTR_KEY)
-		return;
-
-	/* OS/2 seems to use -1 to indicate "close all directories" */
-	if (*key == -1) {
-		struct dptr_struct *next;
-		for(dptr = sconn->searches.dirptrs; dptr; dptr = next) {
-			next = dptr->next;
-			dptr_close_internal(dptr);
-		}
-		*key = INVALID_DPTR_KEY;
-		return;
-	}
-
-	dptr = dptr_get(sconn, *key);
-
-	if (!dptr) {
-		DEBUG(0,("Invalid key %d given to dptr_close\n", *key));
-		return;
-	}
-
-	dptr_close_internal(dptr);
-
-	*key = INVALID_DPTR_KEY;
-}
-
 /****************************************************************************
  Close all dptrs for a cnum.
 ****************************************************************************/
@@ -256,104 +186,13 @@ void dptr_closecnum(connection_struct *conn)
 	for(dptr = sconn->searches.dirptrs; dptr; dptr = next) {
 		next = dptr->next;
 		if (dptr->conn == conn) {
-			dptr_close_internal(dptr);
+			files_struct *fsp = dptr->dir_hnd->fsp;
+			close_file(NULL, fsp, NORMAL_CLOSE);
+			fsp = NULL;
 		}
 	}
 }
 
-/****************************************************************************
- Are there any SMB1 searches active on this connection struct ?
-****************************************************************************/
-
-bool dptr_activecnum(const struct smbd_server_connection *sconn,
-			const struct connection_struct *conn)
-{
-	const struct dptr_struct *dptr;
-
-	for(dptr = sconn->searches.dirptrs; dptr; dptr = dptr->next) {
-		if (dptr->conn == conn) {
-			return true;
-		}
-	}
-	return false;
-}
-
-/****************************************************************************
- Close a dptr that matches a given path, only if it matches the spid also.
-****************************************************************************/
-
-void dptr_closepath(struct smbd_server_connection *sconn,
-		    char *path,uint16_t spid)
-{
-	struct dptr_struct *dptr, *next;
-	for(dptr = sconn->searches.dirptrs; dptr; dptr = next) {
-		next = dptr->next;
-		if (spid == dptr->spid &&
-				strequal(dptr->smb_dname->base_name,path)) {
-			dptr_close_internal(dptr);
-		}
-	}
-}
-
-/****************************************************************************
- Safely do an OpenDir as root, ensuring we're in the right place.
-****************************************************************************/
-
-static struct smb_Dir *open_dir_with_privilege(connection_struct *conn,
-					struct smb_request *req,
-					const struct smb_filename *smb_dname,
-					const char *wcard,
-					uint32_t attr)
-{
-	struct smb_Dir *dir_hnd = NULL;
-	struct smb_filename *smb_fname_cwd = NULL;
-	struct smb_filename *saved_dir_fname = vfs_GetWd(talloc_tos(), conn);
-	struct privilege_paths *priv_paths = req->priv_paths;
-	int ret;
-
-	if (saved_dir_fname == NULL) {
-		return NULL;
-	}
-
-	if (vfs_ChDir(conn, smb_dname) == -1) {
-		return NULL;
-	}
-
-	/* Now check the stat value is the same. */
-	smb_fname_cwd = synthetic_smb_fname(talloc_tos(),
-					".",
-					NULL,
-					NULL,
-					smb_dname->flags);
-	if (smb_fname_cwd == NULL) {
-		goto out;
-	}
-	ret = SMB_VFS_STAT(conn, smb_fname_cwd);
-	if (ret != 0) {
-		goto out;
-	}
-
-	if (!check_same_stat(&smb_fname_cwd->st, &priv_paths->parent_name.st)) {
-		DEBUG(0,("open_dir_with_privilege: stat mismatch between %s "
-			"and %s\n",
-			smb_dname->base_name,
-			smb_fname_str_dbg(&priv_paths->parent_name)));
-		goto out;
-	}
-
-	dir_hnd = open_dir_safely(NULL, conn, smb_fname_cwd, wcard, attr);
-
-	if (dir_hnd != NULL) {
-		talloc_set_destructor(dir_hnd, smb_Dir_destructor);
-	}
-
-  out:
-
-	vfs_ChDir(conn, saved_dir_fname);
-	TALLOC_FREE(saved_dir_fname);
-	return dir_hnd;
-}
-
 /****************************************************************************
  Create a new dir ptr. If the flag old_handle is true then we must allocate
  from the bitmap range 0 - 255 as old SMBsearch directory handles are only
@@ -366,7 +205,6 @@ static struct smb_Dir *open_dir_with_privilege(connection_struct *conn,
 NTSTATUS dptr_create(connection_struct *conn,
 		struct smb_request *req,
 		files_struct *fsp,
-		const struct smb_filename *smb_dname,
 		bool old_handle,
 		bool expect_close,
 		uint16_t spid,
@@ -379,11 +217,7 @@ NTSTATUS dptr_create(connection_struct *conn,
 	struct dptr_struct *dptr = NULL;
 	struct smb_Dir *dir_hnd;
 
-	if (fsp && fsp->is_directory && fsp->fh->fd != -1) {
-		smb_dname = fsp->fsp_name;
-	}
-
-	DEBUG(5,("dptr_create dir=%s\n", smb_dname->base_name));
+	DBG_INFO("dir=%s\n", fsp_str_dbg(fsp));
 
 	if (sconn == NULL) {
 		DEBUG(0,("dptr_create: called with fake connection_struct\n"));
@@ -394,69 +228,13 @@ NTSTATUS dptr_create(connection_struct *conn,
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
-	if (fsp) {
-		if (!(fsp->access_mask & SEC_DIR_LIST)) {
-			DEBUG(5,("dptr_create: directory %s "
-				"not open for LIST access\n",
-				smb_dname->base_name));
-			return NT_STATUS_ACCESS_DENIED;
-		}
-		dir_hnd = OpenDir_fsp(NULL, conn, fsp, wcard, attr);
-	} else {
-		int ret;
-		bool backup_intent = (req && req->priv_paths);
-		NTSTATUS status;
-		struct smb_filename *smb_dname_cp =
-			cp_smb_filename(talloc_tos(), smb_dname);
-
-		if (smb_dname_cp == NULL) {
-			return NT_STATUS_NO_MEMORY;
-		}
-
-		if (req != NULL && req->posix_pathnames) {
-			ret = SMB_VFS_LSTAT(conn, smb_dname_cp);
-		} else {
-			ret = SMB_VFS_STAT(conn, smb_dname_cp);
-		}
-		if (ret == -1) {
-			status = map_nt_error_from_unix(errno);
-			TALLOC_FREE(smb_dname_cp);
-			return status;
-		}
-		if (!S_ISDIR(smb_dname_cp->st.st_ex_mode)) {
-			TALLOC_FREE(smb_dname_cp);
-			return NT_STATUS_NOT_A_DIRECTORY;
-		}
-		status = smbd_check_access_rights(conn,
-						smb_dname_cp,
-						backup_intent,
-						SEC_DIR_LIST);
-		if (!NT_STATUS_IS_OK(status)) {
-			TALLOC_FREE(smb_dname_cp);
-			return status;
-		}
-		if (backup_intent) {
-			dir_hnd = open_dir_with_privilege(conn,
-						req,
-						smb_dname_cp,
-						wcard,
-						attr);
-		} else {
-			dir_hnd = open_dir_safely(NULL,
-					conn,
-					smb_dname_cp,
-					wcard,
-					attr);
-			if (dir_hnd != NULL) {
-				talloc_set_destructor(dir_hnd,
-					smb_Dir_destructor);
-			}
-		}
-
-
-		TALLOC_FREE(smb_dname_cp);
+	if (!(fsp->access_mask & SEC_DIR_LIST)) {
+		DBG_INFO("dptr_create: directory %s "
+			"not open for LIST access\n",
+			fsp_str_dbg(fsp));
+		return NT_STATUS_ACCESS_DENIED;
 	}
-
+	dir_hnd = OpenDir_fsp(NULL, conn, fsp, wcard, attr);
 	if (!dir_hnd) {
 		return map_nt_error_from_unix(errno);
 	}
@@ -468,8 +246,8 @@ NTSTATUS dptr_create(connection_struct *conn,
 		return NT_STATUS_NO_MEMORY;
 	}
 
-	dptr->smb_dname = cp_smb_filename(dptr, smb_dname);
-	if (!dptr->smb_dname) {
+	dptr->smb_dname = cp_smb_filename(dptr, fsp->fsp_name);
+	if (dptr->smb_dname == NULL) {
 		TALLOC_FREE(dptr);
 		TALLOC_FREE(dir_hnd);
 		return NT_STATUS_NO_MEMORY;
@@ -540,10 +318,8 @@ NTSTATUS dptr_create(connection_struct *conn,
 	DLIST_ADD(sconn->searches.dirptrs, dptr);
 
 done:
-	DEBUG(3,("creating new dirptr %d for path %s, expect_close = %d\n",
-		dptr->dnum,
-		dptr->smb_dname->base_name,
-		expect_close));
+	DBG_INFO("creating new dirptr [%d] for path [%s], expect_close = %d\n",
+		 dptr->dnum, fsp_str_dbg(fsp), expect_close);
 
 	*dptr_ret = dptr;
 
@@ -557,15 +333,39 @@ done:
 
 void dptr_CloseDir(files_struct *fsp)
 {
-	if (fsp->dptr) {
+	struct smbd_server_connection *sconn = fsp->dptr->conn->sconn;
+
+	if (fsp->dptr == NULL) {
+		return;
+	}
+
+	/*
+	 * The destructor for the struct smb_Dir (fsp->dptr->dir_hnd)
+	 * now handles all resource deallocation.
+	 */
+
+	DBG_INFO("closing dptr key %d\n", fsp->dptr->dnum);
+
+	if (sconn != NULL && !sconn->using_smb2) {
+		DLIST_REMOVE(sconn->searches.dirptrs, fsp->dptr);
+
 		/*
-		 * The destructor for the struct smb_Dir
-		 * (fsp->dptr->dir_hnd) now handles
-		 * all resource deallocation.
+		 * Free the dnum in the bitmap. Remember the dnum value is
+		 * always biased by one with respect to the bitmap.
 		 */
-		dptr_close_internal(fsp->dptr);
-		fsp->dptr = NULL;
+
+		if (!bitmap_query(sconn->searches.dptr_bmap,
+				  fsp->dptr->dnum - 1))
+		{
+			DBG_ERR("closing dnum = %d and bitmap not set !\n",
+				fsp->dptr->dnum);
+		}
+
+		bitmap_clear(sconn->searches.dptr_bmap, fsp->dptr->dnum - 1);
 	}
+
+	TALLOC_FREE(fsp->dptr->dir_hnd);
+	TALLOC_FREE(fsp->dptr);
 }
 
 void dptr_SeekDir(struct dptr_struct *dptr, long offset)
@@ -910,10 +710,11 @@ static long map_wire_to_dir_offset(struct dptr_struct *dptr, uint32_t wire_offse
 }
 
 /****************************************************************************
- Fetch the dir ptr and seek it given the 5 byte server field.
+ Return the associated fsp and seek the dir_hnd on it it given the 5 byte
+ server field.
 ****************************************************************************/
 
-struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn,
+files_struct *dptr_fetch_fsp(struct smbd_server_connection *sconn,
 			       char *buf, int *num)
 {
 	unsigned int key = *(unsigned char *)buf;
@@ -921,7 +722,7 @@ struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn,
 	uint32_t wire_offset;
 	long seekoff;
 
-	if (!dptr) {
+	if (dptr == NULL) {
 		DEBUG(3,("fetched null dirptr %d\n",key));
 		return(NULL);
 	}
@@ -931,26 +732,24 @@ struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn,
 	SeekDir(dptr->dir_hnd,seekoff);
 	DEBUG(3,("fetching dirptr %d for path %s at offset %d\n",
 		key, dptr->smb_dname->base_name, (int)seekoff));
-	return(dptr);
+	return dptr->dir_hnd->fsp;
 }
 
 /****************************************************************************
- Fetch the dir ptr.
+ Fetch the fsp associated with the dptr_num.
 ****************************************************************************/
 
-struct dptr_struct *dptr_fetch_lanman2(struct smbd_server_connection *sconn,
+files_struct *dptr_fetch_lanman2_fsp(struct smbd_server_connection *sconn,
 				       int dptr_num)
 {
 	struct dptr_struct *dptr  = dptr_get(sconn, dptr_num);
-
-	if (!dptr) {
-		DEBUG(3,("fetched null dirptr %d\n",dptr_num));
-		return(NULL);
+	if (dptr == NULL) {
+		return NULL;
 	}
-	DEBUG(3,("fetching dirptr %d for path %s\n",
+	DBG_NOTICE("fetching dirptr %d for path %s\n",
 		dptr_num,
-		dptr->smb_dname->base_name));
-	return(dptr);
+		dptr->smb_dname->base_name);
+	return dptr->dir_hnd->fsp;
 }
 
 static bool mangle_mask_match(connection_struct *conn,
@@ -1514,23 +1313,25 @@ bool is_visible_file(connection_struct *conn, const char *dir_path,
 
 static int smb_Dir_destructor(struct smb_Dir *dir_hnd)
 {


-- 
Samba Shared Repository



More information about the samba-cvs mailing list