30 Oct, 2011

1 commit

  • Re-posting a patch originally posted by Oskar Liljeblad after
    rebasing on 3.2.

    Modify cifs to assume that the supplied password is encoded according
    to iocharset. Before this patch passwords would be treated as
    raw 8-bit data, which made authentication with Unicode passwords impossible
    (at least passwords with characters > 0xFF).

    The previous code would as a side effect accept passwords encoded with
    ISO 8859-1, since Unicode < 0x100 basically is ISO 8859-1. Software which
    relies on that will no longer support password chars > 0x7F unless it also
    uses iocharset=iso8859-1. (mount.cifs does not care about the encoding so
    it will work as expected.)

    Signed-off-by: Oskar Liljeblad
    Signed-off-by: Shirish Pargaonkar
    Reviewed-by: Pavel Shilovsky
    Tested-by: A
    Signed-off-by: Steve French

    Shirish Pargaonkar
     

25 Oct, 2011

2 commits


20 Oct, 2011

2 commits

  • ...which will allow cifs to do an asynchronous read call to the server.
    The caller will allocate and set up cifs_readdata for each READ_AND_X
    call that should be issued on the wire. The pages passed in are added
    to the pagecache, but not placed on the LRU list yet (as we need the
    page->lru to keep the pages on the list in the readdata).

    When cifsd identifies the mid, it will see that there is a special
    receive handler for the call, and use that to receive the rest of the
    frame. cifs_readv_receive will then marshal up a kvec array with
    kmapped pages from the pagecache, which eliminates one copy of the
    data. Once the data is received, the pages are added to the LRU list,
    set uptodate, and unlocked.

    Reviewed-and-Tested-by: Pavel Shilovsky
    Signed-off-by: Jeff Layton

    Jeff Layton
     
  • In order to handle larger SMBs for readpages and other calls, we want
    to be able to read into a preallocated set of buffers. Rather than
    changing all of the existing code to preallocate buffers however, we
    instead add a receive callback function to the MID.

    cifsd will call this function once the mid_q_entry has been identified
    in order to receive the rest of the SMB. If the mid can't be identified
    or the receive pointer is unset, then the standard 3rd phase receive
    function will be called.

    Reviewed-and-Tested-by: Pavel Shilovsky
    Signed-off-by: Jeff Layton

    Jeff Layton
     

17 Oct, 2011

1 commit

  • Now build security descriptor to change either owner or group at the
    server. Initially security descriptor was built to change only
    (D)ACL, that functionality has been extended.

    When either an Owner or a Group of a file object at the server is changed,
    rest of security descriptor remains same (DACL etc.).

    To set security descriptor, it is necessary to open that file
    with permission bits of either WRITE_DAC if DACL is being modified or
    WRITE_OWNER (Take Ownership) if Owner or Group is being changed.

    It is the server that decides whether a set security descriptor with
    either owner or group change succeeds or not.

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

    Shirish Pargaonkar
     

14 Oct, 2011

1 commit


13 Oct, 2011

2 commits

  • Add mount options backupuid and backugid.

    It allows an authenticated user to access files with the intent to back them
    up including their ACLs, who may not have access permission but has
    "Backup files and directories user right" on them (by virtue of being part
    of the built-in group Backup Operators.

    When mount options backupuid is specified, cifs client restricts the
    use of backup intents to the user whose effective user id is specified
    along with the mount option.

    When mount options backupgid is specified, cifs client restricts the
    use of backup intents to the users whose effective user id belongs to the
    group id specified along with the mount option.

    If an authenticated user is not part of the built-in group Backup Operators
    at the server, access to such files is denied, even if allowed by the client.

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

    Shirish Pargaonkar
     
  • We have two versions of signature generating code. A vectorized and
    non-vectorized version. Eliminate a large chunk of cut-and-paste
    code by turning the non-vectorized version into a wrapper around the
    vectorized one.

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

    Jeff Layton
     

08 Jul, 2011

1 commit


07 Jul, 2011

1 commit


25 Jun, 2011

2 commits

  • a) superblock argument is unused
    b) it always returns 0

    Acked-by: Pavel Shilovsky
    Reviewed-by: Jeff Layton
    Signed-off-by: Al Viro

    Al Viro
     
  • To close sget() races we'll need to be able to set cifs_sb up before
    we get the superblock, so we'll want to be able to do cifs_mount()
    earlier. Fortunately, it's easy to do - setting ->s_maxbytes can
    be done in cifs_read_super(), ditto for ->s_time_gran and as for
    putting MS_POSIXACL into ->s_flags, we can mirror it in ->mnt_cifs_flags
    until cifs_read_super() is called. Kill unused 'devname' argument,
    while we are at it...

    Acked-by: Pavel Shilovsky
    Reviewed-by: Jeff Layton
    Signed-off-by: Al Viro

    Al Viro
     

27 May, 2011

4 commits

  • secMode to sec_mode
    and
    cifsTconInfo to cifs_tcon
    and
    cifsSesInfo to cifs_ses

    Signed-off-by: Steve French

    Steve French
     
  • Add rwpidforward mount option that switches on a mode when we forward
    pid of a process who opened a file to any read and write operation.

    This can prevent applications like WINE from failing on read or write
    operation on a previously locked file region from the same netfd from
    another process if we use mandatory brlock style.

    It is actual for WINE because during a run of WINE program two processes
    work on the same netfd - share the same file struct between several VFS
    fds:
    1) WINE-server does open and lock;
    2) WINE-application does read and write.

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

    Pavel Shilovsky
     
  • Now we point superblock to a server share root and set a root dentry
    appropriately. This let us share superblock between mounts like
    //server/sharename/foo/bar and //server/sharename/foo further.

    Reviewed-by: Jeff Layton
    Signed-off-by: Pavel Shilovsky

    Signed-off-by: Steve French

    Steve French
     
  • We need it to make them work with mandatory locking style because
    we can fail in a situation like when kernel need to flush dirty pages
    and there is a lock held by a process who opened file.

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

    Pavel Shilovsky
     

26 May, 2011

1 commit

  • Add the ability for CIFS to do an asynchronous write. The kernel will
    set the frame up as it would for a "normal" SMBWrite2 request, and use
    cifs_call_async to send it. The mid callback will then be configured to
    handle the result.

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

    Jeff Layton
     

24 May, 2011

1 commit


23 May, 2011

3 commits

  • The current code always ignores the max_pending limit. Have it instead
    only optionally ignore the pending limit. For CIFSSMBEcho, we need to
    ignore it to make sure they always can go out. For async reads, writes
    and potentially other calls, we need to respect it.

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

    Jeff Layton
     
  • We'll need this for async writes, so convert the call to take a kvec
    array. CIFSSMBEcho is changed to put a kvec on the stack and pass
    in the SMB buffer using that.

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

    Jeff Layton
     
  • Further consolidate the SendReceive code by moving the checks run over
    the packet into a separate function that all the SendReceive variants
    can call.

    We can also eliminate the check for a receive_len that's too big or too
    small. cifs_demultiplex_thread already checks that and disconnects the
    socket if that occurs, while setting the midStatus to MALFORMED. It'll
    never call this code if that's the case.

    Finally do a little cleanup. Use "goto out" on errors so that the flow
    of code in the normal case is more evident. Also switch the logErr
    variable in map_smb_to_linux_error to a bool.

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

    Jeff Layton
     

19 May, 2011

8 commits

  • Move extern for cifsConvertToUCS to different header to prevent following warning:

    CHECK fs/cifs/cifs_unicode.c
    fs/cifs/cifs_unicode.c:267:1: warning: symbol 'cifsConvertToUCS' was not declared. Should it be static?

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

    Steve French
     
  • Previously mount options were copied and updated in the cifs_sb_info
    struct only when CONFIG_CIFS_DFS_UPCALL was enabled. Making this
    information generally available allows us to remove a number of ifdefs,
    extra function params, and temporary variables.

    Reviewed-by: Jeff Layton
    Signed-off-by: Sean Finney
    Signed-off-by: Steve French

    Sean Finney
     
  • 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
     
  • Define (global) data structures to store ids, uids and gids, to which a
    SID maps. There are two separate trees, one for SID/uid and another one
    for SID/gid.

    A new type of key, cifs_idmap_key_type, is used.

    Keys are instantiated and searched using credential of the root by
    overriding and restoring the credentials of the caller requesting the key.

    Id mapping functions are invoked under config option of cifs acl.

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

    Shirish Pargaonkar
     
  • Allow setting cifs_acl on the server.
    Pass on to the server the ACL blob generated by an application.
    cifs is just a pass-through, it does not monitor or inspect the contents
    of the blob, server decides whether to enforce/apply the ACL blob composed
    by an application.
    If setting of ACL is succeessful, mark the inode for revalidation.

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

    Steve French
     
  • local cifs functions (repost)

    Using kernel crypto APIs for DES encryption during LM and NT hash generation
    instead of local functions within cifs.
    Source file smbdes.c is deleted sans four functions, one of which
    uses ecb des functionality provided by kernel crypto APIs.

    Remove function SMBOWFencrypt.

    Add return codes to various functions such as calc_lanman_hash,
    SMBencrypt, and SMBNTencrypt. Includes fix noticed by Dan Carpenter.

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

    Steve French
     
  • Recent Windows versions now create symlinks more frequently
    and they do use this "reparse point" symlink mechanism. We can of course
    do symlinks nicely to Samba and other servers which support the
    CIFS Unix Extensions and we can also do SFU symlinks and "client only"
    "MF" symlinks optionally, but for recent Windows we currently can not
    handle the common "reparse point" symlinks fully, removing the caller
    for this. We will need to extend and reenable this "reparse point" worker
    code in cifs and fix cifs_symlink to call this. In the interim this code
    has been moved to its own config option so it is not compiled in by default
    until cifs_symlink fixed up (and tested) to use this.

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

    Steve French
     
  • The CIFSSMBNotify worker is unused, pending changes to allow it to be called
    via inotify, so move it into its own experimental config option so it does
    not get built in, until the necessary VFS support is fixed. It used to
    be used in dnotify, but according to Jeff, inotify needs minor changes
    before we can reenable this.

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

    Steve French
     

28 Jan, 2011

1 commit

  • Replaced md4 hashing function local to cifs module with kernel crypto APIs.
    As a result, md4 hashing function and its supporting functions in
    file md4.c are not needed anymore.

    Cleaned up function declarations, removed forward function declarations,
    and removed a header file that is being deleted from being included.

    Verified that sec=ntlm/i, sec=ntlmv2/i, and sec=ntlmssp/i work correctly.

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

    Shirish Pargaonkar
     

26 Jan, 2011

1 commit

  • If we don't have Exclusive oplock we write a data to the server.
    Also set invalidate_mapping flag on the inode if we wrote something
    to the server. Add cifs_iovec_write to let the client write iovec
    buffers through CIFSSMBWrite2.

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

    Pavel Shilovsky
     

21 Jan, 2011

2 commits


20 Jan, 2011

1 commit

  • When we get oplock break notification we should set the appropriate
    value of OplockLevel field in oplock break acknowledge according to
    the oplock level held by the client in this time. As we only can have
    level II oplock or no oplock in the case of oplock break, we should be
    aware only about clientCanCacheRead field in cifsInodeInfo structure.

    Also fix bug connected with wrong interpretation of OplockLevel field
    during oplock break notification processing.

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

    Pavel Shilovsky
     

08 Dec, 2010

1 commit

  • It's possible that cifs_mount will call cifs_build_path_to_root on a
    newly instantiated cifs_sb. In that case, it's likely that the
    master_tlink pointer has not yet been instantiated.

    Fix this by having cifs_build_path_to_root take a cifsTconInfo pointer
    as well, and have the caller pass that in.

    Reported-and-Tested-by: Robbert Kouprie
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

07 Dec, 2010

1 commit

  • Some of the code under CONFIG_CIFS_ACL is dependent upon code under
    CONFIG_CIFS_EXPERIMENTAL, but the Kconfig options don't reflect that
    dependency. Move more of the ACL code out from under
    CONFIG_CIFS_EXPERIMENTAL and under CONFIG_CIFS_ACL.

    Also move find_readable_file out from other any sort of Kconfig
    option and make it a function normally compiled in.

    Reported-and-Acked-by: Randy Dunlap
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

30 Nov, 2010

2 commits


11 Nov, 2010

1 commit