1. 27 10月, 2010 1 次提交
    • S
      NTLM auth and sign - Allocate session key/client response dynamically · 21e73393
      Shirish Pargaonkar 提交于
      Start calculating auth response within a session.  Move/Add pertinet
      data structures like session key, server challenge and ntlmv2_hash in
      a session structure.  We should do the calculations within a session
      before copying session key and response over to server data
      structures because a session setup can fail.
      
      Only after a very first smb session succeeds, it copy/make its
      session key, session key of smb connection.  This key stays with
      the smb connection throughout its life.
      sequence_number within server is set to 0x2.
      
      The authentication Message Authentication Key (mak) which consists
      of session key followed by client response within structure session_key
      is now dynamic.  Every authentication type allocates the key + response
      sized memory within its session structure and later either assigns or
      frees it once the client response is sent and if session's session key
      becomes connetion's session key.
      
      ntlm/ntlmi authentication functions are rearranged.  A function
      named setup_ntlm_resp(), similar to setup_ntlmv2_resp(), replaces
      function cifs_calculate_session_key().
      
      size of CIFS_SESS_KEY_SIZE is changed to 16, to reflect the byte size
      of the key it holds.
      Reviewed-by: NJeff Layton <jlayton@samba.org>
      Signed-off-by: NShirish Pargaonkar <shirishpargaonkar@gmail.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      21e73393
  2. 21 10月, 2010 1 次提交
    • S
      cifs: convert cifs_tcp_ses_lock from a rwlock to a spinlock · 3f9bcca7
      Suresh Jayaraman 提交于
      cifs_tcp_ses_lock is a rwlock with protects the cifs_tcp_ses_list,
      server->smb_ses_list and the ses->tcon_list. It also protects a few
      ref counters in server, ses and tcon. In most cases the critical section
      doesn't seem to be large, in a few cases where it is slightly large, there
      seem to be really no benefit from concurrent access. I briefly considered RCU
      mechanism but it appears to me that there is no real need.
      
      Replace it with a spinlock and get rid of the last rwlock in the cifs code.
      Signed-off-by: NSuresh Jayaraman <sjayaraman@suse.de>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      3f9bcca7
  3. 15 10月, 2010 1 次提交
  4. 08 10月, 2010 4 次提交
    • S
      [CIFS] Remove build warning · d2445556
      Steve French 提交于
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      d2445556
    • J
      cifs: implement recurring workqueue job to prune old tcons · 2de970ff
      Jeff Layton 提交于
      Create a workqueue job that cleans out unused tlinks. For now, it uses
      a hardcoded expire time of 10 minutes. When it's done, the work rearms
      itself. On umount, the work is cancelled before tearing down the tlink
      tree.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      2de970ff
    • J
      cifs: add "multiuser" mount option · 0eb8a132
      Jeff Layton 提交于
      This allows someone to declare a mount as a multiuser mount.
      
      Multiuser mounts also imply "noperm" since we want to allow the server
      to handle permission checking. It also (for now) requires Kerberos
      authentication. Eventually, we could expand this to other authtypes, but
      that requires a scheme to allow per-user credential stashing in some
      form.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      0eb8a132
    • J
      cifs: add routines to build sessions and tcons on the fly · 9d002df4
      Jeff Layton 提交于
      This patch is rather large, but it's a bit difficult to do piecemeal...
      
      For non-multiuser mounts, everything will basically work as it does
      today. A call to cifs_sb_tlink will return the "master" tcon link.
      
      Turn the tcon pointer in the cifs_sb into a radix tree that uses the
      fsuid of the process as a key. The value is a new "tcon_link" struct
      that contains info about a tcon that's under construction.
      
      When a new process needs a tcon, it'll call cifs_sb_tcon. That will
      then look up the tcon_link in the radix tree. If it exists and is
      valid, it's returned.
      
      If it doesn't exist, then we stuff a new tcon_link into the tree and
      mark it as pending and then go and try to build the session/tcon.
      If that works, the tcon pointer in the tcon_link is updated and the
      pending flag is cleared.
      
      If the construction fails, then we set the tcon pointer to an ERR_PTR
      and clear the pending flag.
      
      If the radix tree is searched and the tcon_link is marked pending
      then we go to sleep and wait for the pending flag to be cleared.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      9d002df4
  5. 30 9月, 2010 8 次提交
  6. 15 9月, 2010 1 次提交
    • J
      cifs: fix potential double put of TCP session reference · 460cf341
      Jeff Layton 提交于
      cifs_get_smb_ses must be called on a server pointer on which it holds an
      active reference. It first does a search for an existing SMB session. If
      it finds one, it'll put the server reference and then try to ensure that
      the negprot is done, etc.
      
      If it encounters an error at that point then it'll return an error.
      There's a potential problem here though. When cifs_get_smb_ses returns
      an error, the caller will also put the TCP server reference leading to a
      double-put.
      
      Fix this by having cifs_get_smb_ses only put the server reference if
      it found an existing session that it could use and isn't returning an
      error.
      
      Cc: stable@kernel.org
      Reviewed-by: NSuresh Jayaraman <sjayaraman@suse.de>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      460cf341
  7. 09 9月, 2010 4 次提交
    • J
      cifs: prevent possible memory corruption in cifs_demultiplex_thread · 32670396
      Jeff Layton 提交于
      cifs_demultiplex_thread sets the addr.sockAddr.sin_port without any
      regard for the socket family. While it may be that the error in question
      here never occurs on an IPv6 socket, it's probably best to be safe and
      set the port properly if it ever does.
      
      Break the port setting code out of cifs_fill_sockaddr and into a new
      function, and call that from cifs_demultiplex_thread.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      32670396
    • J
      cifs: eliminate some more premature cifsd exits · 7332f2a6
      Jeff Layton 提交于
      If the tcpStatus is still CifsNew, the main cifs_demultiplex_loop can
      break out prematurely in some cases. This is wrong as we will almost
      always have other structures with pointers to the TCP_Server_Info. If
      the main loop breaks under any other condition other than tcpStatus ==
      CifsExiting, then it'll face a use-after-free situation.
      
      I don't see any reason to treat a CifsNew tcpStatus differently than
      CifsGood. I believe we'll still want to attempt to reconnect in either
      case. What should happen in those situations is that the MIDs get marked
      as MID_RETRY_NEEDED. This will make CIFSSMBNegotiate return -EAGAIN, and
      then the caller can retry the whole thing on a newly reconnected socket.
      If that fails again in the same way, the caller of cifs_get_smb_ses
      should tear down the TCP_Server_Info struct.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      7332f2a6
    • J
      cifs: prevent cifsd from exiting prematurely · 522bbe65
      Jeff Layton 提交于
      When cifs_demultiplex_thread exits, it does a number of cleanup tasks
      including freeing the TCP_Server_Info struct. Much of the existing code
      in cifs assumes that when there is a cisfSesInfo struct, that it holds a
      reference to a valid TCP_Server_Info struct.
      
      We can never allow cifsd to exit when a cifsSesInfo struct is still
      holding a reference to the server. The server pointers will then point
      to freed memory.
      
      This patch eliminates a couple of questionable conditions where it does
      this.  The idea here is to make an -EINTR return from kernel_recvmsg
      behave the same way as -ERESTARTSYS or -EAGAIN. If the task was
      signalled from cifs_put_tcp_session, then tcpStatus will be CifsExiting,
      and the kernel_recvmsg call will return quickly.
      
      There's also another condition where this can occur too -- if the
      tcpStatus is still in CifsNew, then it will also exit if the server
      closes the socket prematurely.  I think we'll probably also need to fix
      that situation, but that requires a bit more consideration.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      522bbe65
    • S
      Revert "[CIFS] Fix ntlmv2 auth with ntlmssp" · c8e56f1f
      Steve French 提交于
      This reverts commit 9fbc5908.
      
      The change to kernel crypto and fixes to ntlvm2 and ntlmssp
      series, introduced a regression.  Deferring this patch series
      to 2.6.37 after Shirish fixes it.
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      Acked-by: NJeff Layton <jlayton@redhat.com>
      CC: Shirish Pargaonkar <shirishp@us.ibm.com>
      c8e56f1f
  8. 24 8月, 2010 1 次提交
  9. 21 8月, 2010 1 次提交
  10. 19 8月, 2010 1 次提交
  11. 06 8月, 2010 1 次提交
  12. 02 8月, 2010 11 次提交
  13. 06 5月, 2010 1 次提交
  14. 28 4月, 2010 1 次提交
  15. 27 4月, 2010 3 次提交