1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

52494 Commits

Author SHA1 Message Date
Ralph Boehme
295d3501d7 s3/lib: add update_stat_ex_file_id()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:23 +00:00
Ralph Boehme
506ef2761c s3/lib: add update_stat_ex_itime()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:23 +00:00
Ralph Boehme
30b7f9ae2d s3: add st_ex_file_id to struct stat_ex
st_ex_file_id is an immutable, never reused numeric identifier for objects in a
filesystem.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:23 +00:00
Ralph Boehme
df4a380d9f s3: add st_ex_itime to struct stat_ex
st_ex_itime is an immutable original birth time aka instantiation time. Set when
a file is created, never changes thereafter. May not be set by the client.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:23 +00:00
Ralph Boehme
d18bdc1c43 s3: convert struct stat_ex st_ex_calculated_birthtime bool to flags
Subsequent commits will add more flags, this paves the way.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:23 +00:00
Ralph Boehme
a5f4e33f87 s3: remove unused st_ex_mask from struct stat_ex
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:23 +00:00
Ralph Boehme
ae6dd4853e vfs_catia: pass stat info to synthetic_smb_fname()
This doesn't cause visible damage in vanilla Samba, but would affect downstream
consumers that add additional fields to struct smb_filename.

For the same reason there's no test.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14015
RN: Ensure vfs_catia passes stat info to stacked VFS modules

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:23 +00:00
Andreas Schneider
163c0cc84a s3:winbind: Add support for storing KRB5 credential in KCM
This can store crentiials in the Kerberos Credential Manager e.g.
provided by sssd.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jul  1 19:22:02 UTC 2019 on sn-devel-184
2019-07-01 19:22:02 +00:00
Swen Schillig
a75727f191 source3: Update all consumers of strtoul_err(), strtoull_err() to new API
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2019-06-30 11:32:18 +00:00
Jeremy Allison
cd66614a4e s3: smbd: Make open_directory() always open a fd.
As we never use kernel oplocks on directory handles,
there is no reason not to always open file descriptors (no
more "stat" opens on directories).

Preparing to have SMB1search use real directory
opens.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-06-30 11:32:17 +00:00
Volker Lendecke
0b556e7827 vfs_preopen: TALLOC_FREE(fde) before closing the underlying fd
Without that we might get wrong stuff out of epoll

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Jun 28 16:42:42 UTC 2019 on sn-devel-184
2019-06-28 16:42:42 +00:00
Volker Lendecke
c26e42cb53 vfs_preopen: Fix an uninitialized variable read
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2019-06-28 15:02:21 +00:00
Volker Lendecke
6bc70dcde2 vfs_preopen: Fix for O_NOFOLLOW
Since 4301505d97 core smbd code passes O_NOFOLLOW together with
[O_RDONLY|O_RDWR] as flags. This breaks activating vfs_preopen, we
need to look at *just* the access mode.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2019-06-28 15:02:21 +00:00
Volker Lendecke
c88240e0e7 smbd: Fix broken brlock for clustering
This should have been in f11c5887f4, sorry. We now always need
TDB_SEQNUM on brlock.tdb.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2019-06-28 15:02:21 +00:00
Michael Adam
fee8cf326b vfs:glusterfs_fuse: treat ENOATTR as ENOENT
The original implementation of the virtual xattr get_real_filename
in gluster was misusing the ENOENT errno as the authoritative anwer
that the file/dir that we were asking the real filename for does not
exist. But since the getxattr call is done on the parent directory,
this is a violation of the getxattr API which uses ENOENT for the
case that the file/dir that the getxattr call is done against does
not exist.

Now after a recent regression for fuse-mount re-exports due to
gluster mapping ENOENT to ESTALE in the fuse-bridge, the gluster
implementation is changed to more correctly return ENOATTR if the
requested file does not exist.

This patch changes the glusterfs_fuse vfs module to treat ENOATTR as
ENOENT to be fully functional again with latest gluster.

- Without this patch, samba against a new gluster will work correctly,
  but the get_real_filename optimization for a non-existing entry
  is lost.

- With this patch, Samba will not work correctly any more against
  very old gluster servers: Those (correctly) returned ENOATTR
  always, which Samba originally interpreted as EOPNOTSUPP, triggering
  the expensive directory scan. With this patch, ENOATTR is
  interpreted as ENOENT, the authoritative answer that the requested
  entry does not exist, which is wrong unless it really does not exist.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri Jun 28 12:52:03 UTC 2019 on sn-devel-184
2019-06-28 12:52:03 +00:00
Michael Adam
8899eb21d4 vfs:glusterfs: treat ENOATTR as ENOENT
The original implementation of the virtual xattr get_real_filename
in gluster was misusing the ENOENT errno as the authoritative anwer
that the file/dir that we were asking the real filename for does not
exist. But since the getxattr call is done on the parent directory,
this is a violation of the getxattr API which uses ENOENT for the
case that the file/dir that the getxattr call is done against does
not exist.

Now after a recent regression for fuse-mount re-exports due to
gluster mapping ENOENT to ESTALE in the fuse-bridge, the gluster
implementation is changed to more correctly return ENOATTR if the
requested file does not exist.

This patch changes the glusterfs vfs module to treat ENOATTR as ENOENT
to be fully functional again with latest gluster.

- Without this patch, samba against a new gluster will work correctly,
  but the get_real_filename optimization for a non-existing entry
  is lost.

- With this patch, Samba will not work correctly any more against
  very old gluster servers: Those (correctly) returned ENOATTR
  always, which Samba originally interpreted as EOPNOTSUPP, triggering
  the expensive directory scan. With this patch, ENOATTR is
  interpreted as ENOENT, the authoritative answer that the requested
  entry does not exist, which is wrong unless it really does not exist.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2019-06-28 11:37:24 +00:00
Shyamsunder Rathi
6e5bff80a0 s3:notifyd: Handle sigup in notifyd to reparse smb.conf
At present, SIGHUP is blocked on notifyd. So, if parent smbd
is started with "log level" 10 in smb.conf, and later changed
to 0, the SIGHUP will not change the log level to 0 in notify
smbd process and it will keep printing verbose logs in the
corresponding log files.

Proposed fix is to write a SIGHUP handler for notifyd and set
it to reload services.

Reviewed-by: Hemanth Thummala <hemanth.thummala@nutanix.com>
Signed-off-by: Shyamsunder Rathi <shyam.rathi@nutanix.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by:Volker Lendecke <vl@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jun 27 17:57:12 UTC 2019 on sn-devel-184
2019-06-27 17:57:12 +00:00
Andreas Schneider
cd1f418473 s3:utils: Use GnuTLS RC4 in npc_rpc_trust
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-06-27 12:54:24 +00:00
Andreas Schneider
acf605f595 s4:rpc_server: Use GnuTLS RC4 in lsa endpoint
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-06-27 12:54:24 +00:00
Andreas Schneider
80b6ad51f9 s3:rpc_client: Use C99 inititializer in dcerpc_samr_chgpasswd_user()
This also cleans up after using them.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-06-27 12:54:24 +00:00
Andreas Schneider
67e6a9af2c libcli:auth: Return NTSTATUS for netlogon_creds_arcfour_crypt()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-06-27 12:54:23 +00:00
Andreas Schneider
cad3adb0b4 libcli:auth: Return NTSTATUS for netlogon_creds_decrypt_samlogon_logon()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-06-27 12:54:23 +00:00
Andreas Schneider
00dd1a8bf8 libcli:auth: Return NTSTATUS for netlogon_creds_encrypt_samlogon_validation()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-06-27 12:54:23 +00:00
Andrew Bartlett
8f4c30f785 lib/crypto: move gnutls error wrapper to own subsystem
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-06-27 12:54:22 +00:00
Jeremy Allison
29ee235cae s3: torture: Ensure we can always get a POSIX ACL on a directory handle.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun 26 19:31:28 UTC 2019 on sn-devel-184
2019-06-26 19:31:28 +00:00
Jeremy Allison
61777349f1 s3: smbd: We also need to open a real directory fd when modifying security.
Makes the logic identical to file open.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-26 18:14:23 +00:00
David Disseldorp
2436496e71 client: enable allinfo and altname tab completion
Should tab-complete a single remote path.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Tue Jun 25 10:55:45 UTC 2019 on sn-devel-184
2019-06-25 10:55:45 +00:00
Jeremy Allison
05667d36de s3: torture: Add POSIX-ACL-OPLOCK test to check interaction of posix ACL operations with an oplocked Windows handle.
(Spoiler alert, it breaks the oplock :-).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jun 24 20:05:34 UTC 2019 on sn-devel-184
2019-06-24 20:05:34 +00:00
Jeremy Allison
78bdbfbf54 s3: smbd: Posix ACLs. Now we know we have a handle, always use VFS_FCHMOD instead of VFS_CHMOD.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:10 +00:00
Jeremy Allison
644ab10b04 s3: modules: Fruit. Now we know we have a handle, always use VFS_FCHMOD instead of VFS_CHMOD.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:10 +00:00
Jeremy Allison
bd203e98f8 s3: smbd: If smbd_do_qfilepathinfo() causes an oplock or lease break, we must check for deferred open here.
Note this isn't an issue in SMB2, as no SMB2 info level requests
called by smbd_do_qfilepathinfo()/smbd_do_setfilepathinfo() from
SMB2 can cause a oplock or lease break.

The SMB1 trans2.c: calling of smbd_do_setfilepathinfo()
correctly copes with this, this was just missed in the
SMB1 call of smbd_do_qfilepathinfo().

Needed for the following POSIX ACL query interacting
with Windows oplock file test to follow.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:10 +00:00
Jeremy Allison
147ce70eea s3: smbd: Make set_unix_posix_default_acl() take an fsp argument, not smb_fname.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:10 +00:00
Jeremy Allison
77454ecfbd s3: smbd: Add default ACLS can only be set on directory check to smb_set_posix_acl().
This was already being checked in the lower layer,
so no change in behavior, just an efficiency and
clarity change.

Just move an extra check here so we refuse the
set if a default ACL is sent on a file object
before we go into the lower layers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:10 +00:00
Jeremy Allison
503e1243d2 s3: smbd: Only pass fsp to remove_posix_acl(). No longer uses smb_fname.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:10 +00:00
Jeremy Allison
caa4024a91 s3: smbd: Only pass fsp to set_unix_posix_acl(). No longer uses smb_fname.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:10 +00:00
Jeremy Allison
681f0f2337 s3: smbd: Change set_unix_posix_default_acl() to return NTSTATUS.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
763b52d237 s3: smbd: Cleanup - make set_unix_posix_default_acl() use modern coding standards.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
0b496fd905 s3: smbd: Make set_unix_posix_acl() return NTSTATUS.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
e626cb70fd s3: smbd: Cleanup - make remove_posix_acl() return NTSTATUS.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
5210ff66a6 s3: smbd: Cleanup - make set_unix_posix_acl() use modern coding standards.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
59de452810 s3: smbd: Cleanup - make remove_posix_acl() use modern coding standards.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
18c95f0470 s3: smbd: Fix smb_query_posix_acl() to always use fsp handle.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
7c57544b06 s3: smbd: Plumb through struct smb_request *req parameter so it can be used by smb_query_posix_acl().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
c9f55b782d s3: smbd: Fix smb_query_posix_acl() to use modern coding standards.
Add wrap protection.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
4772377b07 s3: smbd: Factor out code into a separate function smb_query_posix_acl().
Will clean up coding standards next.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
7260519501 s3: smbd: Now we always have a handle in smb_set_posix_acl(), use it instead of smb_fname.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
bf743b01d8 s3: smbd: Update smb_set_posix_acl() to always use an open file handle.
Uses get_posix_fsp() added in the previous commit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
df7cec42f0 s3: smbd: Add get_posix_fsp() utility function. Not yet used.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
d6b46c0353 s3: smbd: Clarify logic with helper variables in smb_set_posix_acl()
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:09 +00:00
Jeremy Allison
42712ccb87 s3: smbd: Make data offset use clearer in smb_set_posix_acl()
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2019-06-24 18:49:08 +00:00