summaryrefslogtreecommitdiff
path: root/source3
Commit message (Collapse)AuthorAgeFilesLines
* smbd: use open_internal_dirfsp_at() and OpenDir_fsp() in OpenDir()Ralph Boehme2020-03-241-153/+17
| | | | | | | | | This allows consolidating symlink safe processing of pathnames to the low-level function non_widelink_open() used in the file open codepath via fd_open() and the new utility function open_internal_dirfsp_at(). Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: add open_internal_dirfsp_at()Ralph Boehme2020-03-242-4/+41
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: reformat OpenDir() function definitionRalph Boehme2020-03-241-1/+2
| | | | | | | Gives a nicer diff in the next commit. No change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: update smb_Dir_destructor() to cope with fsp->dptr not being setRalph Boehme2020-03-241-2/+4
| | | | | | | | | | | Currently the only caller of OpenDir_fsp() is dptr_create() which means fsp->dptr will always be set by dptr_create(). A subsequent commit will add another caller so that fsp->dptr will end up being NULL. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: remove fdopendir() fallbackRalph Boehme2020-03-241-45/+2
| | | | | | | | | | | | In order to get rid of SMB_VFS_OPENDIR, we have to require fdopendir(). Everybody but macOS seems to have it, so RIP opendir() fallback. This also prepares for a subsequent commit where we're going to start calling OpenDir_fsp() from inside OpenDir(). Without removing the fallback this would result in a recursion. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: simplify non_widelink_open()Ralph Boehme2020-03-241-8/+1
| | | | | | | | | As fsp->is_directory is already correctly populated by our callers, we can drop the complicated and possibly broken logic that relies on O_DIRECTORY being defined. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs_shadow_copy2: use create_internal_dirfsp_at() and SMB_VFS_FDOPENDIR()Ralph Boehme2020-03-241-5/+39
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: add create_internal_dirfsp_at()Ralph Boehme2020-03-242-0/+58
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs_shadow_copy: use OpenDir() in shadow_copy_get_shadow_copy_data()Ralph Boehme2020-03-241-20/+25
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs_streams_depot: use OpenDir() in walk_streams()Ralph Boehme2020-03-241-13/+12
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs_fruit: use OpenDir() in fruit_disk_free()Ralph Boehme2020-03-241-14/+13
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs_fruit: pass e->d_name directly to fruit_tmsize_do_dirent()Ralph Boehme2020-03-241-9/+9
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs_fruit: let fruit_get_num_bands() take bundle as constRalph Boehme2020-03-241-1/+1
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs_fruit: use OpenDir() instead of SMB_VFS_OPENDIR() in fruit_get_num_bands()Ralph Boehme2020-03-241-15/+10
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs_ceph_snapshots: use OpenDir() in ceph_snap_gmt_convert_dir()Ralph Boehme2020-03-241-22/+21
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs_ceph_snapshots: use OpenDir() in ceph_snap_enum_snapdir()Ralph Boehme2020-03-241-17/+21
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfstest: use OpenDir()Ralph Boehme2020-03-242-43/+57
| | | | | | | | | | Note that as ReadDirName() returns translated names (in Windows "encoding"), in cmd_translate_name() test we have to translate back to UNIX "encoding" to check if the filename matches the user requested path which is also in UNIX "encoding". Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: use canonicalize_connect_path() in create_conn_struct_as_root()Ralph Boehme2020-03-241-0/+8
| | | | | | | | | | This fix ensures create_conn_struct_as_root() works the same way as make_connection_snum() used in smbd for SMB sessions. Without this any caller of create_conn_struct_as_root() will fail to use work on shares if the sharepath contains a symlink. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: make canonicalize_connect_path() publicRalph Boehme2020-03-242-1/+2
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: use OpenDir() in form_junctions()Ralph Boehme2020-03-241-10/+7
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: use OpenDir() in count_dfs_links()Ralph Boehme2020-03-241-7/+7
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs_fruit: move fruit_unlink_internal() back into fruit_unlinkat()Ralph Boehme2020-03-241-65/+57
| | | | | | | I think this makes fruit_unlinkat() easier to read. No change in behaviour. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* vfs_fruit: remove internal directory cleanup logicRalph Boehme2020-03-241-94/+8
| | | | | | | | | | | | | | | | | | | Currently fruit does a cleanup run on a directory when it is being removed: it lists the directory and does an explicit unlink on any found file that is a genuine AppleDouble file. This is not realy needed: the ._ AppleDouble sidecar files are either vetoed by default, so cleanup can be turned on by the built-in "delete veto files" options. Or, if the user sets "fruit:veto_appledouble", the client will see the file in a directory list as ordinary files, so the client is responsible for deleting them first before removing the parent directory. tl;dr One caller of SMB_VFS_OPENDIR() less. :) Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: libsmbclient.h: add missing time.h includeAurelien Aptel2020-03-231-0/+1
| | | | | | | | | | | | | | | | A recent change added a struct with timespec members in the public libsmbclient header. This type is defined in time.h which was not included thus making users of libsmbclient not build properly. /.../libsmbclient.h:158:18: error: field 'btime_ts' has incomplete type struct timespec btime_ts; Fixes: bf13fe0f222 ("s3: libsmbclient: Add internal/external structures needed for readdirplus.") Signed-off-by: Aurelien Aptel <aaptel@suse.com> Reviewed-by: Noel Power <npower@samba.org> Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Mon Mar 23 20:47:44 UTC 2020 on sn-devel-184
* py3: Remove #define PyInt_FromLong PyLong_FromLongAndrew Bartlett2020-03-232-22/+22
| | | | | | | This allows us to end the use of Python 2/3 compatability macros. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power
* py3: Remove #define PyInt_AsLong PyLong_AsLongAndrew Bartlett2020-03-231-20/+20
| | | | | | | This allows us to end the use of Python 2/3 compatability macros. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <npower@samba.org>
* py3: Remove #define PyInt_Type PyLong_TypeAndrew Bartlett2020-03-231-17/+17
| | | | | | | This allows us to end the use of Python 2/3 compatability macros. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <npower@samba.org>
* selftest: Run smb2.compound_find against filesrever only, not nt4_dc and ad_dcAndrew Bartlett2020-03-231-3/+2
| | | | | | | | | This is a slow test of SMB2 protocol features, it needs not to be repeated. It only got run against both by accident at the original merge and then extended to run on the [compount_find] share (with smbd:find async delay usec = 10000) but really does not need to be run three times. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* build: Require --without-ad-dc for --without-adsAndrew Bartlett2020-03-232-0/+5
| | | | | | | | | | | | Building an AD DC while setting --without-ads makes no sense and just wastes compile time on our build hosts. To allow samba-nt4 to build --without-ad-dc we set rpc.spoolss.notify (which is built on the NTVFS fileserver for the callbacks) to run in the ad_member environment rather than nt4_dc and ad_dc. This is also just more realistic in any case. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s3: Remove tevent_wait code. The last user was fsp->deferred_close.Jeremy Allison2020-03-236-98/+0
| | | | | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Mon Mar 23 12:06:45 UTC 2020 on sn-devel-184
* s3: VFS: Remove deferred_close from struct files_struct.Jeremy Allison2020-03-231-10/+3
| | | | | | | Bump up the VFS number to 43. Samba 4.13 will ship with that. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: smbd: Remove all references to fsp->deferred_close.Jeremy Allison2020-03-233-25/+0
| | | | | | | We are now free to remove it from struct files_struct. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: smbd: Convert async SMB2 close to use the wait_queue idiom.Jeremy Allison2020-03-231-15/+37
| | | | | | | | | | | | Use the same mechanism to wait for aio on a handle used by SMB1 reply_tdis(), reply_ulogoffX(), reply_exit(), reply_close() and SMB2 tree disconnect. This removes the last user of fsp->deferred_close, allowing us to remove it. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: smbd: Remove old async versions of SMB1 reply_close().Jeremy Allison2020-03-231-78/+8
| | | | | | | Use the common pattern to wait for aio. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: smbd: Add async internals of reply_close().Jeremy Allison2020-03-231-0/+129
| | | | | | | | | | | | | | | | | | Waits until all aio requests on the closing fsps before returning to the client. Slightly modified version of the existing async reply_close code, updated to use the wait_queue pattern standardized in reply_tdis, reply_ulogoffX and reply_exit. Done this way (commented out) so it is a clean diff and it's clear what is being added. The next commit will remove the old version. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: smbd: In asnyc do_smb1_close() use the utility function meant for async ↵Jeremy Allison2020-03-231-10/+6
| | | | | | | | | SMB1 replies. Don't use the raw call. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: smbd: Update reply_close() to modern DBG_ coding style.Jeremy Allison2020-03-231-6/+6
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3: smbd: In SMB1 reply_close() rename all uses of 'struct smb_request' to ↵Jeremy Allison2020-03-231-23/+23
| | | | | | | | | | smb1req. Will make further changes easier to see, as we now use req for tevent_req structs. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3:rpc_server: Remove dead codeSamuel Cabrero2020-03-208-399/+2
| | | | | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Samuel Cabrero <scabrero@samba.org> Autobuild-Date(master): Fri Mar 20 17:11:28 UTC 2020 on sn-devel-184
* s3:rpc_server: Remove unused RPC module init and shutdown callbacksSamuel Cabrero2020-03-203-51/+2
| | | | | | | | The setup function registers the endpoint server and RPC core routines initialize and shutdown it. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Do not generate and build s3 RPC server codeSamuel Cabrero2020-03-202-32/+15
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Do not include s3 autogenerated headersSamuel Cabrero2020-03-2026-50/+39
| | | | | | | Prototype is generated by the server compat parser. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Remove api_structSamuel Cabrero2020-03-203-744/+0
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Remove dead code and unused struct membersSamuel Cabrero2020-03-202-13/+0
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Remove s3 rpc server loopSamuel Cabrero2020-03-207-2274/+0
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Remove call to s3 rpc services shutdown codeSamuel Cabrero2020-03-201-21/+0
| | | | | | | | | | | | The rpc_<service>_shutdown function unregisters the legacy api_struct from the local dispatch table, which is not longer used as local dispatching is done through dcesrv_interface and will be removed in following commits. The dcesrv_shutdown_registered_ep_servers will unregister endpoint servers. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Switch to core dcerpc server loopSamuel Cabrero2020-03-208-53/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit finally switches the RPC server implementation. At the same we have to do other related changes to keep code compiling and test environments running. First avoid moving the session_info into the allocated pipes_struct memory context as it is owned now by the core RPC server, and the s3compat pidl compiler will update the pipes_struct session_info before dispatching the call with dcesrv_call->auth_state->session_info. Also, fix a segfault in the endpoint mapper daemon when it tries to delete the endpoints previously registered over a NCALRPC connection. If we have: rpc_server : epmapper = external rpc_server : lsarpc = external rpc_daemon : epmd = fork rpc_daemon : lsasd = fork The sequence is: * The endpoint mapper starts (start_epmd in source3/smbd/server.c) * The lsarpc daemon starts (start_lsasd in source3/smbd/server.c) * The lsarpc daemon creates the sockets and registers its endpoints (rpc_ep_register in source3/rpc_server/lsasd.c) * The endpoint registration code opens a NCALRPC connection to the endpoint mapper daemon (ep_register in source3/librpc/rpc/dcerpc_ep.c) and keeps it open to re-register if the endpoint mapper daemon dies (rpc_ep_register_loop in source3/rpc_server/rpc_ep_register.c) * When the endpoint mapper daemon accepts a NCALRPC connection it sets a termination function (srv_epmapper_delete_endpoints) * Suppose the lsarpc daemon exits. The NCALRPC connection termination function is called. * The termination function tries to delete all endpoints registered by that connection by calling _epm_Delete * _epm_Delete calls is_privileged_pipe which access to pipes_struct->session_info. As the call to _epm_Delete occurs outside of the PIDL generated code, the pipes_stuct->session_info is NULL. This commit also sets pipes_struct->session_info from the dcerpc_connection before calling _epm_Delete. As the core rpc server supports security context multiplexing we need to pass the dcesrv_connection to the termination function and let the implementation pick a auth context. In the case of the endpoint mapper the termination function has to pick one of type NCALRPC_AS_SYSTEM to check if the connection is privileged and delete the endpoints registered by the connection being closed. Finally, the samba.tests.dcerpc.raw_protocol testsuite passes against the ad_member environment. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Update winspool generated server stubSamuel Cabrero2020-03-201-6/+4474
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:winbindd: Dispatch RPC calls through interface local handlerSamuel Cabrero2020-03-203-21/+63
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:rpc_server: Dispatch local calls through interfaces local handlerSamuel Cabrero2020-03-201-36/+26
| | | | | Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>