1. 03 3月, 2017 1 次提交
    • A
      CIFS: use DFS pathnames in SMB2+ Create requests · f0712928
      Aurelien Aptel 提交于
      When connected to a DFS capable share, the client must set the
      SMB2_FLAGS_DFS_OPERATIONS flag in the SMB2 header and use
      DFS path names: "<server>\<share>\<path>" *without* leading \\.
      
      Sources:
      
      [MS-SMB2] 3.2.5.5 Receiving an SMB2 TREE_CONNECT Response
      > TreeConnect.IsDfsShare MUST be set to TRUE, if the SMB2_SHARE_CAP_DFS
      > bit is set in the Capabilities field of the response.
      
      [MS-SMB2] 3.2.4.3 Application Requests Opening a File
      > If TreeConnect.IsDfsShare is TRUE, the SMB2_FLAGS_DFS_OPERATIONS flag
      > is set in the Flags field.
      
      [MS-SMB2] 2.2.13 SMB2 CREATE Request, NameOffset:
      > If SMB2_FLAGS_DFS_OPERATIONS is set in the Flags field of the SMB2
      > header, the file name includes a prefix that will be processed during
      > DFS name normalization as specified in section 3.3.5.9. Otherwise, the
      > file name is relative to the share that is identified by the TreeId in
      > the SMB2 header.
      Signed-off-by: NAurelien Aptel <aaptel@suse.com>
      Acked-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      f0712928
  2. 02 3月, 2017 6 次提交
  3. 25 2月, 2017 1 次提交
  4. 02 2月, 2017 19 次提交
  5. 01 2月, 2017 1 次提交
    • E
      fs: Better permission checking for submounts · 93faccbb
      Eric W. Biederman 提交于
      To support unprivileged users mounting filesystems two permission
      checks have to be performed: a test to see if the user allowed to
      create a mount in the mount namespace, and a test to see if
      the user is allowed to access the specified filesystem.
      
      The automount case is special in that mounting the original filesystem
      grants permission to mount the sub-filesystems, to any user who
      happens to stumble across the their mountpoint and satisfies the
      ordinary filesystem permission checks.
      
      Attempting to handle the automount case by using override_creds
      almost works.  It preserves the idea that permission to mount
      the original filesystem is permission to mount the sub-filesystem.
      Unfortunately using override_creds messes up the filesystems
      ordinary permission checks.
      
      Solve this by being explicit that a mount is a submount by introducing
      vfs_submount, and using it where appropriate.
      
      vfs_submount uses a new mount internal mount flags MS_SUBMOUNT, to let
      sget and friends know that a mount is a submount so they can take appropriate
      action.
      
      sget and sget_userns are modified to not perform any permission checks
      on submounts.
      
      follow_automount is modified to stop using override_creds as that
      has proven problemantic.
      
      do_mount is modified to always remove the new MS_SUBMOUNT flag so
      that we know userspace will never by able to specify it.
      
      autofs4 is modified to stop using current_real_cred that was put in
      there to handle the previous version of submount permission checking.
      
      cifs is modified to pass the mountpoint all of the way down to vfs_submount.
      
      debugfs is modified to pass the mountpoint all of the way down to
      trace_automount by adding a new parameter.  To make this change easier
      a new typedef debugfs_automount_t is introduced to capture the type of
      the debugfs automount function.
      
      Cc: stable@vger.kernel.org
      Fixes: 069d5ac9 ("autofs:  Fix automounts by using current_real_cred()->uid")
      Fixes: aeaa4a79 ("fs: Call d_automount with the filesystems creds")
      Reviewed-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      Reviewed-by: NSeth Forshee <seth.forshee@canonical.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      93faccbb
  6. 15 1月, 2017 1 次提交
    • R
      cifs: initialize file_info_lock · 81ddd8c0
      Rabin Vincent 提交于
      Reviewed-by: NJeff Layton <jlayton@redhat.com>
      CC: Stable <stable@vger.kernel.org>
      
      file_info_lock is not initalized in initiate_cifs_search(), leading to the
      following splat after a simple "mount.cifs ... dir && ls dir/":
      
       BUG: spinlock bad magic on CPU#0, ls/486
        lock: 0xffff880009301110, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
       CPU: 0 PID: 486 Comm: ls Not tainted 4.9.0 #27
       Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
        ffffc900042f3db0 ffffffff81327533 0000000000000000 ffff880009301110
        ffffc900042f3dd0 ffffffff810baf75 ffff880009301110 ffffffff817ae077
        ffffc900042f3df0 ffffffff810baff6 ffff880009301110 ffff880008d69900
       Call Trace:
        [<ffffffff81327533>] dump_stack+0x65/0x92
        [<ffffffff810baf75>] spin_dump+0x85/0xe0
        [<ffffffff810baff6>] spin_bug+0x26/0x30
        [<ffffffff810bb159>] do_raw_spin_lock+0xe9/0x130
        [<ffffffff8159ad2f>] _raw_spin_lock+0x1f/0x30
        [<ffffffff8127e50d>] cifs_closedir+0x4d/0x100
        [<ffffffff81181cfd>] __fput+0x5d/0x160
        [<ffffffff81181e3e>] ____fput+0xe/0x10
        [<ffffffff8109410e>] task_work_run+0x7e/0xa0
        [<ffffffff81002512>] exit_to_usermode_loop+0x92/0xa0
        [<ffffffff810026f9>] syscall_return_slowpath+0x49/0x50
        [<ffffffff8159b484>] entry_SYSCALL_64_fastpath+0xa7/0xa9
      
      Fixes: 3afca265 ("Clarify locking of cifs file and tcon structures and make more granular")
      Signed-off-by: NRabin Vincent <rabinv@axis.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      81ddd8c0
  7. 25 12月, 2016 1 次提交
  8. 15 12月, 2016 3 次提交
    • S
      cifs_get_root shouldn't use path with tree name · 374402a2
      Sachin Prabhu 提交于
      When a server returns the optional flag SMB_SHARE_IS_IN_DFS in response
      to a tree connect, cifs_build_path_to_root() will return a pathname
      which includes the hostname. This causes problems with cifs_get_root()
      which separates each component and does a lookup for each component of
      the path which in this case will incorrectly include looking up the
      hostname component as a path component.
      
      We encountered a problem with dfs shares hosted by a Netapp. When
      connecting to nodes pointed to by the DFS share. The tree connect for
      these nodes return SMB_SHARE_IS_IN_DFS resulting failures in lookup
      in cifs_get_root().
      
      RH bz: 1373153
      The patch was tested against a Netapp simulator and by a user using an
      actual Netapp server.
      Signed-off-by: NSachin Prabhu <sprabhu@redhat.com>
      Reported-by: NPierguido Lambri <plambri@redhat.com>
      Reviewed-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      374402a2
    • G
      Fix default behaviour for empty domains and add domainauto option · 39566443
      Germano Percossi 提交于
      With commit 2b149f11 many things have been fixed/introduced.
      However, the default behaviour for RawNTLMSSP authentication
      seems to be wrong in case the domain is not passed on the command line.
      
      The main points (see below) of the patch are:
       - It alignes behaviour with Windows clients
       - It fixes backward compatibility
       - It fixes UPN
      
      I compared this behavour with the one from a Windows 10 command line
      client. When no domains are specified on the command line, I traced
      the packets and observed that the client does send an empty
      domain to the server.
      In the linux kernel case, the empty domain is replaced by the
      primary domain communicated by the SMB server.
      This means that, if the credentials are valid against the local server
      but that server is part of a domain, then the kernel module will
      ask to authenticate against that domain and we will get LOGON failure.
      
      I compared the packet trace from the smbclient when no domain is passed
      and, in that case, a default domain from the client smb.conf is taken.
      Apparently, connection succeeds anyway, because when the domain passed
      is not valid (in my case WORKGROUP), then the local one is tried and
      authentication succeeds. I tried with any kind of invalid domain and
      the result was always a connection.
      
      So, trying to interpret what to do and picking a valid domain if none
      is passed, seems the wrong thing to do.
      To this end, a new option "domainauto" has been added in case the
      user wants a mechanism for guessing.
      
      Without this patch, backward compatibility also is broken.
      With kernel 3.10, the default auth mechanism was NTLM.
      One of our testing servers accepted NTLM and, because no
      domains are passed, authentication was local.
      
      Moving to RawNTLMSSP forced us to change our command line
      to add a fake domain to pass to prevent this mechanism to kick in.
      
      For the same reasons, UPN is broken because the domain is specified
      in the username.
      The SMB server will work out the domain from the UPN and authenticate
      against the right server.
      Without the patch, though, given the domain is empty, it gets replaced
      with another domain that could be the wrong one for the authentication.
      Signed-off-by: NGermano Percossi <germano.percossi@citrix.com>
      Acked-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      39566443
    • R
      cifs: use %16phN for formatting md5 sum · c6fc663e
      Rasmus Villemoes 提交于
      Passing a gazillion arguments takes a lot of code:
      
      add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-253 (-253)
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      c6fc663e
  9. 14 12月, 2016 1 次提交
  10. 09 12月, 2016 1 次提交
  11. 06 12月, 2016 4 次提交
  12. 03 12月, 2016 1 次提交