28 Oct, 2011

1 commit

  • Samba supports a setfs info level to negotiate encrypted
    shares. This patch adds the defines so we recognize
    this info level. Later patches will add the enablement
    for it.

    Acked-by: Jeremy Allison
    Signed-off-by: Steve French

    Steve French
     

20 Oct, 2011

1 commit


19 May, 2011

3 commits

  • It's a bad idea to have macro functions that reference variables more
    than once, as the arguments could have side effects. Turn BCC() into
    a static inlined function instead.

    While we're at it, make it return a void * to discourage anyone from
    dereferencing it as-is.

    Reported-and-acked-by: David Howells
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Jeff Layton
     
  • This is the same patch as originally posted, just with some merge
    conflicts fixed up...

    Currently, the ByteCount is usually converted to host-endian on receive.
    This is confusing however, as we need to keep two sets of routines for
    accessing it, and keep track of when to use each routine. Munging
    received packets like this also limits when the signature can be
    calulated.

    Simplify the code by keeping the received ByteCount in little-endian
    format. This allows us to eliminate a set of routines for accessing it
    and we can now drop the *_le suffixes from the accessor functions since
    that's now implied.

    While we're at it, switch all of the places that read the ByteCount
    directly to use the get_bcc inline which should also clean up some
    unaligned accesses.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • There is one big endian field in the cifs protocol, the RFC1001
    length, which cifs code (unlike in the smb2 code) had been handling as
    u32 until the last possible moment, when it was converted to be32 (its
    native form) before sending on the wire. To remove the last sparse
    endian warning, and to make this consistent with the smb2
    implementation (which always treats the fields in their
    native size and endianness), convert all uses of smb_buf_length to
    be32.

    This version incorporates Christoph's comment about
    using be32_add_cpu, and fixes a typo in the second
    version of the patch.

    Signed-off-by: Steve French
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Steve French
     

21 Jan, 2011

2 commits

  • It's possible that when we access the ByteCount that the alignment
    will be off. Most CPUs deal with that transparently, but there's
    usually some performance impact. Some CPUs raise an exception on
    unaligned accesses.

    Fix this by accessing the byte count using the get_unaligned and
    put_unaligned inlined functions. While we're at it, fix the types
    of some of the variables that end up getting returns from these
    functions.

    Acked-by: Pavel Shilovsky
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • Reviewed-by: Suresh Jayaraman
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

27 Oct, 2010

2 commits

  • Mark dependency on crypto modules in Kconfig.

    Defining per structures sdesc and cifs_secmech which are used to store
    crypto hash functions and contexts. They are stored per smb connection
    and used for all auth mechs to genereate hash values and signatures.

    Allocate crypto hashing functions, security descriptiors, and respective
    contexts when a smb/tcp connection is established.
    Release them when a tcp/smb connection is taken down.

    md5 and hmac-md5 are two crypto hashing functions that are used
    throught the life of an smb/tcp connection by various functions that
    calcualte signagure and ntlmv2 hash, HMAC etc.

    structure ntlmssp_auth is defined as per smb connection.

    ntlmssp_auth holds ciphertext which is genereated by rc4/arc4 encryption of
    secondary key, a nonce using ntlmv2 session key and sent in the session key
    field of the type 3 message sent by the client during ntlmssp
    negotiation/exchange

    A key is exchanged with the server if client indicates so in flags in
    type 1 messsage and server agrees in flag in type 2 message of ntlmssp
    negotiation. If both client and agree, a key sent by client in
    type 3 message of ntlmssp negotiation in the session key field.
    The key is a ciphertext generated off of secondary key, a nonce, using
    ntlmv2 hash via rc4/arc4.

    Signing works for ntlmssp in this patch. The sequence number within
    the server structure needs to be zero until session is established
    i.e. till type 3 packet of ntlmssp exchange of a to be very first
    smb session on that smb connection is sent.

    Acked-by: Jeff Layton
    Signed-off-by: Shirish Pargaonkar
    Signed-off-by: Steve French

    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: Jeff Layton
    Signed-off-by: Shirish Pargaonkar
    Signed-off-by: Steve French

    Shirish Pargaonkar
     

30 Sep, 2010

1 commit

  • Attribue Value (AV) pairs or Target Info (TI) pairs are part of
    ntlmv2 authentication.
    Structure ntlmv2_resp had only definition for two av pairs.
    So removed it, and now allocation of av pairs is dynamic.
    For servers like Windows 7/2008, av pairs sent by server in
    challege packet (type 2 in the ntlmssp exchange/negotiation) can
    vary.

    Server sends them during ntlmssp negotiation. So when ntlmssp is used
    as an authentication mechanism, type 2 challenge packet from server
    has this information. Pluck it and use the entire blob for
    authenticaiton purpose. If user has not specified, extract
    (netbios) domain name from the av pairs which is used to calculate
    ntlmv2 hash. Servers like Windows 7 are particular about the AV pair
    blob.

    Servers like Windows 2003, are not very strict about the contents
    of av pair blob used during ntlmv2 authentication.
    So when security mechanism such as ntlmv2 is used (not ntlmv2 in ntlmssp),
    there is no negotiation and so genereate a minimal blob that gets
    used in ntlmv2 authentication as well as gets sent.

    Fields tilen and tilbob are session specific. AV pair values are defined.

    To calculate ntlmv2 response we need ti/av pair blob.

    For sec mech like ntlmssp, the blob is plucked from type 2 response from
    the server. From this blob, netbios name of the domain is retrieved,
    if user has not already provided, to be included in the Target String
    as part of ntlmv2 hash calculations.

    For sec mech like ntlmv2, create a minimal, two av pair blob.

    The allocated blob is freed in case of error. In case there is no error,
    this blob is used in calculating ntlmv2 response (in CalcNTLMv2_response)
    and is also copied on the response to the server, and then freed.

    The type 3 ntlmssp response is prepared on a buffer,
    5 * sizeof of struct _AUTHENTICATE_MESSAGE, an empirical value large
    enough to hold _AUTHENTICATE_MESSAGE plus a blob with max possible
    10 values as part of ntlmv2 response and lmv2 keys and domain, user,
    workstation names etc.

    Also, kerberos gets selected as a default mechanism if server supports it,
    over the other security mechanisms.

    Signed-off-by: Shirish Pargaonkar
    Signed-off-by: Steve French

    Shirish Pargaonkar
     

09 Sep, 2010

1 commit

  • This reverts commit 9fbc590860e75785bdaf8b83e48fabfe4d4f7d58.

    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: Steve French
    Acked-by: Jeff Layton
    CC: Shirish Pargaonkar

    Steve French
     

21 Aug, 2010

1 commit

  • Make ntlmv2 as an authentication mechanism within ntlmssp
    instead of ntlmv1.
    Parse type 2 response in ntlmssp negotiation to pluck
    AV pairs and use them to calculate ntlmv2 response token.
    Also, assign domain name from the sever response in type 2
    packet of ntlmssp and use that (netbios) domain name in
    calculation of response.

    Enable cifs/smb signing using rc4 and md5.

    Changed name of the structure mac_key to session_key to reflect
    the type of key it holds.

    Use kernel crypto_shash_* APIs instead of the equivalent cifs functions.

    Signed-off-by: Shirish Pargaonkar
    Acked-by: Herbert Xu
    Signed-off-by: Steve French

    Steve French
     

24 Feb, 2010

1 commit


05 Dec, 2009

1 commit


02 Jul, 2009

1 commit

  • cifs: add new cifs_iget function and convert unix codepath to use it

    In order to unify some codepaths, introduce a common cifs_fattr struct
    for storing inode attributes. The different codepaths (unix, legacy,
    normal, etc...) can fill out this struct with inode info. It can then be
    passed as an arg to a common set of routines to get and update inodes.

    Add a new cifs_iget function that uses iget5_locked to identify inodes.
    This will compare inodes based on the uniqueid value in a cifs_fattr
    struct.

    Rather than filling out an already-created inode, have
    cifs_get_inode_info_unix instead fill out cifs_fattr and hand that off
    to cifs_iget. cifs_iget can then properly look for hardlinked inodes.

    On the readdir side, add a new cifs_readdir_lookup function that spawns
    populated dentries. Redefine FILE_UNIX_INFO so that it's basically a
    FILE_UNIX_BASIC_INFO that has a few fields wrapped around it. This
    allows us to more easily use the same function for filling out the fattr
    as the non-readdir codepath.

    With this, we should then have proper hardlink detection and can
    eventually get rid of some nasty CIFS-specific hacks for handing them.

    Signed-off-by: Jeff Layton
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Steve French

    Jeff Layton
     

17 Apr, 2009

1 commit

  • Jeff made a good point that we should endian convert the UniqueId when we use
    it to set i_ino Even though this value is opaque to the client, when comparing
    the inode numbers of the same server file from two different clients (one
    big endian, one little endian) or when we compare a big endian client's view
    of i_ino with what the server thinks - we should get the same value

    Signed-off-by: Steve French

    Steve French
     

12 Mar, 2009

3 commits

  • There are about 60 fsctl calls which Windows claims would be able
    to be sent remotely and handled by the server. This adds the #defines
    for them. A few of them look immediately useful, but need to also
    add the structure definitions for them so they can be sent as SMBs.

    Signed-off-by: Steve French

    Steve French
     
  • Also updates some DFS flag definitions

    Signed-off-by: Steve French

    Steve French
     
  • In contrast to the now-obsolete smbfs, cifs does not send SMB_COM_FLUSH
    in response to an explicit fsync(2) to guarantee that all volatile data
    is written to stable storage on the server side, provided the server
    honors the request (which, to my knowledge, is true for Windows and
    Samba with 'strict sync' enabled).
    This patch modifies the cifs_fsync implementation to restore the
    fsync-behavior of smbfs by triggering SMB_COM_FLUSH after sending
    outstanding data on the client side to the server.

    Signed-off-by: Horst Reiterer
    Acked-by: Jeff Layton
    Signed-off-by: Steve French

    Steve French
     

26 Dec, 2008

1 commit


06 Aug, 2008

1 commit

  • We'd like to be able to use the unix SET_PATH_INFO_BASIC args to set
    file times as well, but that makes the argument list rather long. Bundle
    up the args for unix SET_PATH_INFO call into a struct. For now, we don't
    actually use the times fields anywhere. That will be done in a follow-on
    patch.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

24 Jul, 2008

1 commit


24 May, 2008

1 commit


17 May, 2008

2 commits


12 May, 2008

1 commit

  • When creating a directory on a CIFS share without POSIX extensions,
    and the given mode has no write bits set, set the ATTR_READONLY bit.

    When creating a file, set ATTR_READONLY if the create mode has no write
    bits set and we're not using unix extensions.

    There are some comments about this being problematic due to the VFS
    splitting creates into 2 parts. I'm not sure what that's actually
    talking about, but I'm assuming that it has something to do with how
    mknod is implemented. In the simple case where we have no unix
    extensions and we're just creating a regular file, there's no reason
    we can't set ATTR_READONLY.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

26 Apr, 2008

1 commit


25 Apr, 2008

2 commits


19 Apr, 2008

1 commit


18 Apr, 2008

1 commit


31 Dec, 2007

1 commit


02 Nov, 2007

1 commit


31 Oct, 2007

1 commit


18 Oct, 2007

1 commit


29 Sep, 2007

1 commit


31 Aug, 2007

1 commit


15 Jul, 2007

1 commit

  • In the cleanup phase of the dbench test, we were noticing sharing
    violation followed by failed directory removals when dbench
    did not close the test files before the cleanup phase started.
    Using the new POSIX unlink, which Samba has supported for a few
    months, avoids this.

    Signed-off-by: Steve French

    Steve French
     

13 Jul, 2007

1 commit

  • This should be the last big batch of whitespace/formatting fixes.
    checkpatch warnings for the cifs directory are down about 90% and
    many of the remaining ones are harder to remove or make the code
    harder to read.

    Signed-off-by: Steve French

    Steve French
     

25 Jun, 2007

1 commit