Commit 789c56b7 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6: (24 commits)
  [CIFS] merge conflict in fs/cifs/export.c
  [CIFS] Allow disabling CIFS Unix Extensions as mount option
  [CIFS] More whitespace/formatting fixes (noticed by checkpatch)
  [CIFS] Typo in previous patch
  [CIFS] zero_user_page() conversions
  [CIFS] use simple_prepare_write to zero page data
  [CIFS] Fix build break - inet.h not included when experimental ifdef off
  [CIFS] Add support for new POSIX unlink
  [CIFS] whitespace/formatting fixes
  [CIFS] Fix oops in cifs_create when nfsd server exports cifs mount
  [CIFS] whitespace cleanup
  [CIFS] Fix packet signatures for NTLMv2 case
  [CIFS] more whitespace fixes
  [CIFS] more whitespace cleanup
  [CIFS] whitespace cleanup
  [CIFS] whitespace cleanup
  [CIFS] ipv6 support no longer experimental
  [CIFS] Mount should fail if server signing off but client mount option requires it
  [CIFS] whitespace fixes
  [CIFS] Fix sign mount option and sign proc config setting
  ...
parents 7209a1dc 1ff8392c
Version 1.50
------------
Fix NTLMv2 signing. NFS server mounted over cifs works (if cifs mount is
done with "serverino" mount option). Add support for POSIX Unlink
(helps with certain sharing violation cases when server such as
Samba supports newer POSIX CIFS Protocol Extensions).
Version 1.49 Version 1.49
------------ ------------
IPv6 support. Enable ipv6 addresses to be passed on mount (put the ipv6 IPv6 support. Enable ipv6 addresses to be passed on mount (put the ipv6
...@@ -8,7 +15,11 @@ when Unix Extensions were ignored). This allows users to override the ...@@ -8,7 +15,11 @@ when Unix Extensions were ignored). This allows users to override the
default uid and gid for files when they are certain that the uids or default uid and gid for files when they are certain that the uids or
gids on the server do not match those of the client. Make "sec=none" gids on the server do not match those of the client. Make "sec=none"
mount override username (so that null user connection is attempted) mount override username (so that null user connection is attempted)
to match what documentation said. to match what documentation said. Support for very large reads, over 127K,
available to some newer servers (such as Samba 3.0.26 and later but
note that it also requires setting CIFSMaxBufSize at module install
time to a larger value which may hurt performance in some cases).
Make sign option force signing (or fail if server does not support it).
Version 1.48 Version 1.48
------------ ------------
......
...@@ -301,10 +301,21 @@ A partial list of the supported mount options follows: ...@@ -301,10 +301,21 @@ A partial list of the supported mount options follows:
during the local client kernel build will be used. during the local client kernel build will be used.
If server does not support Unicode, this parameter is If server does not support Unicode, this parameter is
unused. unused.
rsize default read size (usually 16K) rsize default read size (usually 16K). The client currently
wsize default write size (usually 16K, 32K is often better over GigE) can not use rsize larger than CIFSMaxBufSize. CIFSMaxBufSize
maximum wsize currently allowed by CIFS is 57344 (14 4096 byte defaults to 16K and may be changed (from 8K to the maximum
pages) kmalloc size allowed by your kernel) at module install time
for cifs.ko. Setting CIFSMaxBufSize to a very large value
will cause cifs to use more memory and may reduce performance
in some cases. To use rsize greater than 127K (the original
cifs protocol maximum) also requires that the server support
a new Unix Capability flag (for very large read) which some
newer servers (e.g. Samba 3.0.26 or later) do. rsize can be
set from a minimum of 2048 to a maximum of 130048 (127K or
CIFSMaxBufSize, whichever is smaller)
wsize default write size (default 57344)
maximum wsize currently allowed by CIFS is 57344 (fourteen
4096 byte pages)
rw mount the network share read-write (note that the rw mount the network share read-write (note that the
server may still consider the share read-only) server may still consider the share read-only)
ro mount network share read-only ro mount network share read-only
...@@ -359,7 +370,7 @@ A partial list of the supported mount options follows: ...@@ -359,7 +370,7 @@ A partial list of the supported mount options follows:
Note that this does not affect the normal ACL check on the Note that this does not affect the normal ACL check on the
target machine done by the server software (of the server target machine done by the server software (of the server
ACL against the user name provided at mount time). ACL against the user name provided at mount time).
serverino Use servers inode numbers instead of generating automatically serverino Use server's inode numbers instead of generating automatically
incrementing inode numbers on the client. Although this will incrementing inode numbers on the client. Although this will
make it easier to spot hardlinked files (as they will have make it easier to spot hardlinked files (as they will have
the same inode numbers) and inode numbers may be persistent, the same inode numbers) and inode numbers may be persistent,
...@@ -367,12 +378,11 @@ A partial list of the supported mount options follows: ...@@ -367,12 +378,11 @@ A partial list of the supported mount options follows:
are unique if multiple server side mounts are exported under a are unique if multiple server side mounts are exported under a
single share (since inode numbers on the servers might not single share (since inode numbers on the servers might not
be unique if multiple filesystems are mounted under the same be unique if multiple filesystems are mounted under the same
shared higher level directory). Note that this requires that shared higher level directory). Note that some older
the server support the CIFS Unix Extensions as other servers (e.g. pre-Windows 2000) do not support returning UniqueIDs
do not return a unique IndexNumber on SMB FindFirst (most or the CIFS Unix Extensions equivalent and for those
servers return zero as the IndexNumber). Parameter has no this mount option will have no effect. Exporting cifs mounts
effect to Windows servers and others which do not support the under nfsd requires this mount option on the cifs mount.
CIFS Unix Extensions.
noserverino Client generates inode numbers (rather than using the actual one noserverino Client generates inode numbers (rather than using the actual one
from the server) by default. from the server) by default.
setuids If the CIFS Unix extensions are negotiated with the server setuids If the CIFS Unix extensions are negotiated with the server
...@@ -582,10 +592,10 @@ the start of smb requests and responses can be enabled via: ...@@ -582,10 +592,10 @@ the start of smb requests and responses can be enabled via:
echo 1 > /proc/fs/cifs/traceSMB echo 1 > /proc/fs/cifs/traceSMB
Two other experimental features are under development and to test Two other experimental features are under development. To test these
require enabling CONFIG_CIFS_EXPERIMENTAL requires enabling CONFIG_CIFS_EXPERIMENTAL
More efficient write operations ipv6 enablement
DNOTIFY fcntl: needed for support of directory change DNOTIFY fcntl: needed for support of directory change
notification and perhaps later for file leases) notification and perhaps later for file leases)
......
...@@ -18,9 +18,9 @@ better) ...@@ -18,9 +18,9 @@ better)
d) Kerberos/SPNEGO session setup support - (started) d) Kerberos/SPNEGO session setup support - (started)
e) More testing of NTLMv2 authentication (mostly implemented - double check e) Cleanup now unneeded SessSetup code in
that NTLMv2 signing works, also need to cleanup now unneeded SessSetup code in fs/cifs/connect.c and add back in NTLMSSP code if any servers
fs/cifs/connect.c) need it
f) MD5-HMAC signing SMB PDUs when SPNEGO style SessionSetup f) MD5-HMAC signing SMB PDUs when SPNEGO style SessionSetup
used (Kerberos or NTLMSSP). Signing alreadyimplemented for NTLM used (Kerberos or NTLMSSP). Signing alreadyimplemented for NTLM
...@@ -106,6 +106,12 @@ but recognizes them ...@@ -106,6 +106,12 @@ but recognizes them
succeed but still return access denied (appears to be Windows succeed but still return access denied (appears to be Windows
server not cifs client problem) and has not been reproduced recently. server not cifs client problem) and has not been reproduced recently.
NTFS partitions do not have this problem. NTFS partitions do not have this problem.
4) Unix/POSIX capabilities are reset after reconnection, and affect
a few fields in the tree connection but we do do not know which
superblocks to apply these changes to. We should probably walk
the list of superblocks to set these. Also need to check the
flags on the second mount to the same share, and see if we
can do the same trick that NFS does to remount duplicate shares.
Misc testing to do Misc testing to do
================== ==================
......
...@@ -459,7 +459,7 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -459,7 +459,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
unsigned int cls, con, tag, oidlen, rc; unsigned int cls, con, tag, oidlen, rc;
int use_ntlmssp = FALSE; int use_ntlmssp = FALSE;
*secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default */ *secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default*/
/* cifs_dump_mem(" Received SecBlob ", security_blob, length); */ /* cifs_dump_mem(" Received SecBlob ", security_blob, length); */
...@@ -498,7 +498,8 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -498,7 +498,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
return 0; return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON) } else if ((cls != ASN1_CTX) || (con != ASN1_CON)
|| (tag != ASN1_EOC)) { || (tag != ASN1_EOC)) {
cFYI(1,("cls = %d con = %d tag = %d end = %p (%d) exit 0", cFYI(1,
("cls = %d con = %d tag = %d end = %p (%d) exit 0",
cls, con, tag, end, *end)); cls, con, tag, end, *end));
return 0; return 0;
} }
...@@ -508,7 +509,8 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -508,7 +509,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
return 0; return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_CON) } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
|| (tag != ASN1_SEQ)) { || (tag != ASN1_SEQ)) {
cFYI(1,("cls = %d con = %d tag = %d end = %p (%d) exit 1", cFYI(1,
("cls = %d con = %d tag = %d end = %p (%d) exit 1",
cls, con, tag, end, *end)); cls, con, tag, end, *end));
return 0; return 0;
} }
...@@ -540,32 +542,34 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -540,32 +542,34 @@ decode_negTokenInit(unsigned char *security_blob, int length,
rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag); rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag);
if (!rc) { if (!rc) {
cFYI(1, cFYI(1,
("Error 1 decoding negTokenInit header exit 2")); ("Error decoding negTokenInit hdr exit2"));
return 0; return 0;
} }
if ((tag == ASN1_OJI) && (con == ASN1_PRI)) { if ((tag == ASN1_OJI) && (con == ASN1_PRI)) {
rc = asn1_oid_decode(&ctx, end, &oid, &oidlen); rc = asn1_oid_decode(&ctx, end, &oid, &oidlen);
if(rc) { if (rc) {
cFYI(1, cFYI(1,
("OID len = %d oid = 0x%lx 0x%lx 0x%lx 0x%lx", ("OID len = %d oid = 0x%lx 0x%lx "
oidlen, *oid, *(oid + 1), *(oid + 2), "0x%lx 0x%lx",
*(oid + 3))); oidlen, *oid, *(oid + 1),
rc = compare_oid(oid, oidlen, NTLMSSP_OID, *(oid + 2), *(oid + 3)));
NTLMSSP_OID_LEN); rc = compare_oid(oid, oidlen,
NTLMSSP_OID, NTLMSSP_OID_LEN);
kfree(oid); kfree(oid);
if (rc) if (rc)
use_ntlmssp = TRUE; use_ntlmssp = TRUE;
} }
} else { } else {
cFYI(1,("This should be an oid what is going on? ")); cFYI(1, ("Should be an oid what is going on?"));
} }
} }
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, cFYI(1,
("Error decoding last part of negTokenInit exit 3")); ("Error decoding last part negTokenInit exit3"));
return 0; return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { /* tag = 3 indicating mechListMIC */ } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
/* tag = 3 indicating mechListMIC */
cFYI(1, cFYI(1,
("Exit 4 cls = %d con = %d tag = %d end = %p (%d)", ("Exit 4 cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end)); cls, con, tag, end, *end));
...@@ -573,7 +577,7 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -573,7 +577,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
} }
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, cFYI(1,
("Error decoding last part of negTokenInit exit 5")); ("Error decoding last part negTokenInit exit5"));
return 0; return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_CON) } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
|| (tag != ASN1_SEQ)) { || (tag != ASN1_SEQ)) {
...@@ -584,7 +588,7 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -584,7 +588,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, cFYI(1,
("Error decoding last part of negTokenInit exit 7")); ("Error decoding last part negTokenInit exit 7"));
return 0; return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
cFYI(1, cFYI(1,
...@@ -594,16 +598,17 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -594,16 +598,17 @@ decode_negTokenInit(unsigned char *security_blob, int length,
} }
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, cFYI(1,
("Error decoding last part of negTokenInit exit 9")); ("Error decoding last part negTokenInit exit9"));
return 0; return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_PRI) } else if ((cls != ASN1_UNI) || (con != ASN1_PRI)
|| (tag != ASN1_GENSTR)) { || (tag != ASN1_GENSTR)) {
cFYI(1, cFYI(1,
("Exit 10 cls = %d con = %d tag = %d end = %p (%d)", ("Exit10 cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end)); cls, con, tag, end, *end));
return 0; return 0;
} }
cFYI(1, ("Need to call asn1_octets_decode() function for this %s", ctx.pointer)); /* is this UTF-8 or ASCII? */ cFYI(1, ("Need to call asn1_octets_decode() function for %s",
ctx.pointer)); /* is this UTF-8 or ASCII? */
} }
/* if (use_kerberos) /* if (use_kerberos)
......
...@@ -58,7 +58,7 @@ cifs_dump_mem(char *label, void *data, int length) ...@@ -58,7 +58,7 @@ cifs_dump_mem(char *label, void *data, int length)
} }
#ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2
void cifs_dump_detail(struct smb_hdr * smb) void cifs_dump_detail(struct smb_hdr *smb)
{ {
cERROR(1, ("Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d", cERROR(1, ("Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d",
smb->Command, smb->Status.CifsError, smb->Command, smb->Status.CifsError,
...@@ -67,10 +67,10 @@ void cifs_dump_detail(struct smb_hdr * smb) ...@@ -67,10 +67,10 @@ void cifs_dump_detail(struct smb_hdr * smb)
} }
void cifs_dump_mids(struct TCP_Server_Info * server) void cifs_dump_mids(struct TCP_Server_Info *server)
{ {
struct list_head *tmp; struct list_head *tmp;
struct mid_q_entry * mid_entry; struct mid_q_entry *mid_entry;
if (server == NULL) if (server == NULL)
return; return;
...@@ -114,12 +114,12 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset, ...@@ -114,12 +114,12 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
{ {
struct list_head *tmp; struct list_head *tmp;
struct list_head *tmp1; struct list_head *tmp1;
struct mid_q_entry * mid_entry; struct mid_q_entry *mid_entry;
struct cifsSesInfo *ses; struct cifsSesInfo *ses;
struct cifsTconInfo *tcon; struct cifsTconInfo *tcon;
int i; int i;
int length = 0; int length = 0;
char * original_buf = buf; char *original_buf = buf;
*beginBuffer = buf + offset; *beginBuffer = buf + offset;
...@@ -145,7 +145,6 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset, ...@@ -145,7 +145,6 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
(ses->serverNOS == NULL)) { (ses->serverNOS == NULL)) {
buf += sprintf(buf, "\nentry for %s not fully " buf += sprintf(buf, "\nentry for %s not fully "
"displayed\n\t", ses->serverName); "displayed\n\t", ses->serverName);
} else { } else {
length = length =
sprintf(buf, sprintf(buf,
...@@ -901,90 +900,14 @@ security_flags_write(struct file *file, const char __user *buffer, ...@@ -901,90 +900,14 @@ security_flags_write(struct file *file, const char __user *buffer,
} }
/* flags look ok - update the global security flags for cifs module */ /* flags look ok - update the global security flags for cifs module */
extended_security = flags; extended_security = flags;
if (extended_security & CIFSSEC_MUST_SIGN) {
/* requiring signing implies signing is allowed */
extended_security |= CIFSSEC_MAY_SIGN;
cFYI(1, ("packet signing now required"));
} else if ((extended_security & CIFSSEC_MAY_SIGN) == 0) {
cFYI(1, ("packet signing disabled"));
}
/* BB should we turn on MAY flags for other MUST options? */
return count; return count;
} }
/* static int
ntlmv2_enabled_read(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int len;
len = sprintf(page, "%d\n", ntlmv2_support);
len -= off;
*start = page + off;
if (len > count)
len = count;
else
*eof = 1;
if (len < 0)
len = 0;
return len;
}
static int
ntlmv2_enabled_write(struct file *file, const char __user *buffer,
unsigned long count, void *data)
{
char c;
int rc;
rc = get_user(c, buffer);
if (rc)
return rc;
if (c == '0' || c == 'n' || c == 'N')
ntlmv2_support = 0;
else if (c == '1' || c == 'y' || c == 'Y')
ntlmv2_support = 1;
else if (c == '2')
ntlmv2_support = 2;
return count;
}
static int
packet_signing_enabled_read(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int len;
len = sprintf(page, "%d\n", sign_CIFS_PDUs);
len -= off;
*start = page + off;
if (len > count)
len = count;
else
*eof = 1;
if (len < 0)
len = 0;
return len;
}
static int
packet_signing_enabled_write(struct file *file, const char __user *buffer,
unsigned long count, void *data)
{
char c;
int rc;
rc = get_user(c, buffer);
if (rc)
return rc;
if (c == '0' || c == 'n' || c == 'N')
sign_CIFS_PDUs = 0;
else if (c == '1' || c == 'y' || c == 'Y')
sign_CIFS_PDUs = 1;
else if (c == '2')
sign_CIFS_PDUs = 2;
return count;
} */
#endif #endif
...@@ -43,6 +43,6 @@ struct cifs_sb_info { ...@@ -43,6 +43,6 @@ struct cifs_sb_info {
mode_t mnt_dir_mode; mode_t mnt_dir_mode;
int mnt_cifs_flags; int mnt_cifs_flags;
int prepathlen; int prepathlen;
char * prepath; char *prepath;
}; };
#endif /* _CIFS_FS_SB_H */ #endif /* _CIFS_FS_SB_H */
...@@ -66,7 +66,7 @@ cifs_strtoUCS(__le16 * to, const char *from, int len, ...@@ -66,7 +66,7 @@ cifs_strtoUCS(__le16 * to, const char *from, int len,
{ {
int charlen; int charlen;
int i; int i;
wchar_t * wchar_to = (wchar_t *)to; /* needed to quiet sparse */ wchar_t *wchar_to = (wchar_t *)to; /* needed to quiet sparse */
for (i = 0; len && *from; i++, from += charlen, len -= charlen) { for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Convert a unicode character to upper or lower case using * Convert a unicode character to upper or lower case using
* compressed tables. * compressed tables.
* *
* Copyright (c) International Business Machines Corp., 2000,2005555555555555555555555555555555555555555555555555555555 * Copyright (c) International Business Machines Corp., 2000,2007
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -70,7 +70,7 @@ int cifs_strtoUCS(__le16 *, const char *, int, const struct nls_table *); ...@@ -70,7 +70,7 @@ int cifs_strtoUCS(__le16 *, const char *, int, const struct nls_table *);
* Address of the first string * Address of the first string
*/ */
static inline wchar_t * static inline wchar_t *
UniStrcat(wchar_t * ucs1, const wchar_t * ucs2) UniStrcat(wchar_t *ucs1, const wchar_t *ucs2)
{ {
wchar_t *anchor = ucs1; /* save a pointer to start of ucs1 */ wchar_t *anchor = ucs1; /* save a pointer to start of ucs1 */
...@@ -88,7 +88,7 @@ UniStrcat(wchar_t * ucs1, const wchar_t * ucs2) ...@@ -88,7 +88,7 @@ UniStrcat(wchar_t * ucs1, const wchar_t * ucs2)
* or NULL if the character is not in the string * or NULL if the character is not in the string
*/ */
static inline wchar_t * static inline wchar_t *
UniStrchr(const wchar_t * ucs, wchar_t uc) UniStrchr(const wchar_t *ucs, wchar_t uc)
{ {
while ((*ucs != uc) && *ucs) while ((*ucs != uc) && *ucs)
ucs++; ucs++;
...@@ -107,7 +107,7 @@ UniStrchr(const wchar_t * ucs, wchar_t uc) ...@@ -107,7 +107,7 @@ UniStrchr(const wchar_t * ucs, wchar_t uc)
* > 0: First string is greater than second * > 0: First string is greater than second
*/ */
static inline int static inline int
UniStrcmp(const wchar_t * ucs1, const wchar_t * ucs2) UniStrcmp(const wchar_t *ucs1, const wchar_t *ucs2)
{ {
while ((*ucs1 == *ucs2) && *ucs1) { while ((*ucs1 == *ucs2) && *ucs1) {
ucs1++; ucs1++;
...@@ -120,7 +120,7 @@ UniStrcmp(const wchar_t * ucs1, const wchar_t * ucs2) ...@@ -120,7 +120,7 @@ UniStrcmp(const wchar_t * ucs1, const wchar_t * ucs2)
* UniStrcpy: Copy a string * UniStrcpy: Copy a string
*/ */
static inline wchar_t * static inline wchar_t *
UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2) UniStrcpy(wchar_t *ucs1, const wchar_t *ucs2)
{ {
wchar_t *anchor = ucs1; /* save the start of result string */ wchar_t *anchor = ucs1; /* save the start of result string */
...@@ -132,7 +132,7 @@ UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2) ...@@ -132,7 +132,7 @@ UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2)
* UniStrlen: Return the length of a string (in 16 bit Unicode chars not bytes) * UniStrlen: Return the length of a string (in 16 bit Unicode chars not bytes)
*/ */
static inline size_t static inline size_t
UniStrlen(const wchar_t * ucs1) UniStrlen(const wchar_t *ucs1)
{ {
int i = 0; int i = 0;
...@@ -142,10 +142,11 @@ UniStrlen(const wchar_t * ucs1) ...@@ -142,10 +142,11 @@ UniStrlen(const wchar_t * ucs1)
} }
/* /*
* UniStrnlen: Return the length (in 16 bit Unicode chars not bytes) of a string (length limited) * UniStrnlen: Return the length (in 16 bit Unicode chars not bytes) of a
* string (length limited)
*/ */
static inline size_t static inline size_t
UniStrnlen(const wchar_t * ucs1, int maxlen) UniStrnlen(const wchar_t *ucs1, int maxlen)
{ {
int i = 0; int i = 0;
...@@ -161,7 +162,7 @@ UniStrnlen(const wchar_t * ucs1, int maxlen) ...@@ -161,7 +162,7 @@ UniStrnlen(const wchar_t * ucs1, int maxlen)
* UniStrncat: Concatenate length limited string * UniStrncat: Concatenate length limited string
*/ */
static inline wchar_t * static inline wchar_t *
UniStrncat(wchar_t * ucs1, const wchar_t * ucs2, size_t n) UniStrncat(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{ {
wchar_t *anchor = ucs1; /* save pointer to string 1 */ wchar_t *anchor = ucs1; /* save pointer to string 1 */
...@@ -179,7 +180,7 @@ UniStrncat(wchar_t * ucs1, const wchar_t * ucs2, size_t n) ...@@ -179,7 +180,7 @@ UniStrncat(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
* UniStrncmp: Compare length limited string * UniStrncmp: Compare length limited string
*/ */
static inline int static inline int
UniStrncmp(const wchar_t * ucs1, const wchar_t * ucs2, size_t n) UniStrncmp(const wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{ {
if (!n) if (!n)
return 0; /* Null strings are equal */ return 0; /* Null strings are equal */
...@@ -194,7 +195,7 @@ UniStrncmp(const wchar_t * ucs1, const wchar_t * ucs2, size_t n) ...@@ -194,7 +195,7 @@ UniStrncmp(const wchar_t * ucs1, const wchar_t * ucs2, size_t n)
* UniStrncmp_le: Compare length limited string - native to little-endian * UniStrncmp_le: Compare length limited string - native to little-endian
*/ */
static inline int static inline int
UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2, size_t n) UniStrncmp_le(const wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{ {
if (!n) if (!n)
return 0; /* Null strings are equal */ return 0; /* Null strings are equal */
...@@ -209,7 +210,7 @@ UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2, size_t n) ...@@ -209,7 +210,7 @@ UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2, size_t n)
* UniStrncpy: Copy length limited string with pad * UniStrncpy: Copy length limited string with pad
*/ */
static inline wchar_t * static inline wchar_t *
UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2, size_t n) UniStrncpy(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{ {
wchar_t *anchor = ucs1; wchar_t *anchor = ucs1;
...@@ -226,7 +227,7 @@ UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2, size_t n) ...@@ -226,7 +227,7 @@ UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
* UniStrncpy_le: Copy length limited string with pad to little-endian * UniStrncpy_le: Copy length limited string with pad to little-endian
*/ */
static inline wchar_t * static inline wchar_t *
UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2, size_t n) UniStrncpy_le(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
{ {
wchar_t *anchor = ucs1; wchar_t *anchor = ucs1;
...@@ -247,7 +248,7 @@ UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2, size_t n) ...@@ -247,7 +248,7 @@ UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2, size_t n)
* NULL if no matching string is found * NULL if no matching string is found
*/ */
static inline wchar_t * static inline wchar_t *
UniStrstr(const wchar_t * ucs1, const wchar_t * ucs2) UniStrstr(const wchar_t *ucs1, const wchar_t *ucs2)
{ {
const wchar_t *anchor1 = ucs1; const wchar_t *anchor1 = ucs1;
const wchar_t *anchor2 = ucs2; const wchar_t *anchor2 = ucs2;
...@@ -297,7 +298,7 @@ UniToupper(register wchar_t uc) ...@@ -297,7 +298,7 @@ UniToupper(register wchar_t uc)
* UniStrupr: Upper case a unicode string * UniStrupr: Upper case a unicode string
*/ */
static inline wchar_t * static inline wchar_t *
UniStrupr(register wchar_t * upin) UniStrupr(register wchar_t *upin)
{ {
register wchar_t *up; register wchar_t *up;
...@@ -338,7 +339,7 @@ UniTolower(wchar_t uc) ...@@ -338,7 +339,7 @@ UniTolower(wchar_t uc)
* UniStrlwr: Lower case a unicode string * UniStrlwr: Lower case a unicode string
*/ */
static inline wchar_t * static inline wchar_t *
UniStrlwr(register wchar_t * upin) UniStrlwr(register wchar_t *upin)
{ {
register wchar_t *up; register wchar_t *up;
......
This diff is collapsed.
This diff is collapsed.
...@@ -45,7 +45,7 @@ extern void cifs_read_inode(struct inode *); ...@@ -45,7 +45,7 @@ extern void cifs_read_inode(struct inode *);
extern const struct inode_operations cifs_dir_inode_ops; extern const struct inode_operations cifs_dir_inode_ops;
extern int cifs_create(struct inode *, struct dentry *, int, extern int cifs_create(struct inode *, struct dentry *, int,
struct nameidata *); struct nameidata *);
extern struct dentry * cifs_lookup(struct inode *, struct dentry *, extern struct dentry *cifs_lookup(struct inode *, struct dentry *,
struct nameidata *); struct nameidata *);
extern int cifs_unlink(struct inode *, struct dentry *); extern int cifs_unlink(struct inode *, struct dentry *);
extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *); extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *);
...@@ -63,16 +63,16 @@ extern const struct inode_operations cifs_symlink_inode_ops; ...@@ -63,16 +63,16 @@ extern const struct inode_operations cifs_symlink_inode_ops;
/* Functions related to files and directories */ /* Functions related to files and directories */
extern const struct file_operations cifs_file_ops; extern const struct file_operations cifs_file_ops;
extern const struct file_operations cifs_file_direct_ops; /* if directio mount */ extern const struct file_operations cifs_file_direct_ops; /* if directio mnt */
extern const struct file_operations cifs_file_nobrl_ops; extern const struct file_operations cifs_file_nobrl_ops;
extern const struct file_operations cifs_file_direct_nobrl_ops; /* if directio mount */ extern const struct file_operations cifs_file_direct_nobrl_ops; /* no brlocks */
extern int cifs_open(struct inode *inode, struct file *file); extern int cifs_open(struct inode *inode, struct file *file);
extern int cifs_close(struct inode *inode, struct file *file); extern int cifs_close(struct inode *inode, struct file *file);
extern int cifs_closedir(struct inode *inode, struct file *file); extern int cifs_closedir(struct inode *inode, struct file *file);
extern ssize_t cifs_user_read(struct file *file, char __user *read_data, extern ssize_t cifs_user_read(struct file *file, char __user *read_data,
size_t read_size, loff_t * poffset); size_t read_size, loff_t *poffset);
extern ssize_t cifs_user_write(struct file *file, const char __user *write_data, extern ssize_t cifs_user_write(struct file *file, const char __user *write_data,
size_t write_size, loff_t * poffset); size_t write_size, loff_t *poffset);
extern int cifs_lock(struct file *, int, struct file_lock *); extern int cifs_lock(struct file *, int, struct file_lock *);
extern int cifs_fsync(struct file *, struct dentry *, int); extern int cifs_fsync(struct file *, struct dentry *, int);
extern int cifs_flush(struct file *, fl_owner_t id); extern int cifs_flush(struct file *, fl_owner_t id);
...@@ -88,7 +88,8 @@ extern struct dentry_operations cifs_ci_dentry_ops; ...@@ -88,7 +88,8 @@ extern struct dentry_operations cifs_ci_dentry_ops;
/* Functions related to symlinks */ /* Functions related to symlinks */
extern void *cifs_follow_link(struct dentry *direntry, struct nameidata *nd); extern void *cifs_follow_link(struct dentry *direntry, struct nameidata *nd);
extern void cifs_put_link(struct dentry *direntry, struct nameidata *nd, void *); extern void cifs_put_link(struct dentry *direntry,
struct nameidata *nd, void *);
extern int cifs_readlink(struct dentry *direntry, char __user *buffer, extern int cifs_readlink(struct dentry *direntry, char __user *buffer,
int buflen); int buflen);
extern int cifs_symlink(struct inode *inode, struct dentry *direntry, extern int cifs_symlink(struct inode *inode, struct dentry *direntry,
...@@ -98,7 +99,7 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *, ...@@ -98,7 +99,7 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *,
size_t, int); size_t, int);
extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
extern int cifs_ioctl (struct inode * inode, struct file * filep, extern int cifs_ioctl (struct inode *inode, struct file *filep,
unsigned int command, unsigned long arg); unsigned int command, unsigned long arg);
#define CIFS_VERSION "1.49" #define CIFS_VERSION "1.50"
#endif /* _CIFSFS_H */ #endif /* _CIFSFS_H */
/* /*
* fs/cifs/cifsglob.h * fs/cifs/cifsglob.h
* *
* Copyright (C) International Business Machines Corp., 2002,2006 * Copyright (C) International Business Machines Corp., 2002,2007
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* Jeremy Allison (jra@samba.org) * Jeremy Allison (jra@samba.org)
* *
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#define MAX_TREE_SIZE 2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1 #define MAX_TREE_SIZE 2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1
#define MAX_SERVER_SIZE 15 #define MAX_SERVER_SIZE 15
#define MAX_SHARE_SIZE 64 /* used to be 20 - this should still be enough */ #define MAX_SHARE_SIZE 64 /* used to be 20, this should still be enough */
#define MAX_USERNAME_SIZE 32 /* 32 is to allow for 15 char names + null #define MAX_USERNAME_SIZE 32 /* 32 is to allow for 15 char names + null
termination then *2 for unicode versions */ termination then *2 for unicode versions */
#define MAX_PASSWORD_SIZE 16 #define MAX_PASSWORD_SIZE 16
...@@ -104,6 +104,17 @@ enum protocolEnum { ...@@ -104,6 +104,17 @@ enum protocolEnum {
/* Netbios frames protocol not supported at this time */ /* Netbios frames protocol not supported at this time */
}; };
struct mac_key {
unsigned int len;
union {
char ntlm[CIFS_SESS_KEY_SIZE + 16];
struct {
char key[16];
struct ntlmv2_resp resp;
} ntlmv2;
} data;
};
/* /*
***************************************************************** *****************************************************************
* Except the CIFS PDUs themselves all the * Except the CIFS PDUs themselves all the
...@@ -159,7 +170,8 @@ struct TCP_Server_Info { ...@@ -159,7 +170,8 @@ struct TCP_Server_Info {
/* 16th byte of RFC1001 workstation name is always null */ /* 16th byte of RFC1001 workstation name is always null */
char workstation_RFC1001_name[SERVER_NAME_LEN_WITH_NULL]; char workstation_RFC1001_name[SERVER_NAME_LEN_WITH_NULL];
__u32 sequence_number; /* needed for CIFS PDU signature */ __u32 sequence_number; /* needed for CIFS PDU signature */
char mac_signing_key[CIFS_SESS_KEY_SIZE + 16]; struct mac_key mac_signing_key;
char ntlmv2_hash[16];
unsigned long lstrp; /* when we got last response from this server */ unsigned long lstrp; /* when we got last response from this server */
}; };
...@@ -200,8 +212,8 @@ struct cifsSesInfo { ...@@ -200,8 +212,8 @@ struct cifsSesInfo {
char serverName[SERVER_NAME_LEN_WITH_NULL * 2]; /* BB make bigger for char serverName[SERVER_NAME_LEN_WITH_NULL * 2]; /* BB make bigger for
TCP names - will ipv6 and sctp addresses fit? */ TCP names - will ipv6 and sctp addresses fit? */
char userName[MAX_USERNAME_SIZE + 1]; char userName[MAX_USERNAME_SIZE + 1];
char * domainName; char *domainName;
char * password; char *password;
}; };
/* no more than one of the following three session flags may be set */ /* no more than one of the following three session flags may be set */
#define CIFS_SES_NT4 1 #define CIFS_SES_NT4 1
...@@ -269,7 +281,9 @@ struct cifsTconInfo { ...@@ -269,7 +281,9 @@ struct cifsTconInfo {
FILE_SYSTEM_UNIX_INFO fsUnixInfo; FILE_SYSTEM_UNIX_INFO fsUnixInfo;
unsigned retry:1; unsigned retry:1;
unsigned nocase:1; unsigned nocase:1;
/* BB add field for back pointer to sb struct? */ unsigned unix_ext:1; /* if off disable Linux extensions to CIFS protocol
for this mount even if server would support */
/* BB add field for back pointer to sb struct(s)? */
}; };
/* /*
...@@ -291,9 +305,9 @@ struct cifs_search_info { ...@@ -291,9 +305,9 @@ struct cifs_search_info {
__u16 entries_in_buffer; __u16 entries_in_buffer;
__u16 info_level; __u16 info_level;
__u32 resume_key; __u32 resume_key;
char * ntwrk_buf_start; char *ntwrk_buf_start;
char * srch_entries_start; char *srch_entries_start;
char * presume_name; char *presume_name;
unsigned int resume_name_len; unsigned int resume_name_len;
unsigned endOfSearch:1; unsigned endOfSearch:1;
unsigned emptyDir:1; unsigned emptyDir:1;
...@@ -309,15 +323,15 @@ struct cifsFileInfo { ...@@ -309,15 +323,15 @@ struct cifsFileInfo {
__u16 netfid; /* file id from remote */ __u16 netfid; /* file id from remote */
/* BB add lock scope info here if needed */ ; /* BB add lock scope info here if needed */ ;
/* lock scope id (0 if none) */ /* lock scope id (0 if none) */
struct file * pfile; /* needed for writepage */ struct file *pfile; /* needed for writepage */
struct inode * pInode; /* needed for oplock break */ struct inode *pInode; /* needed for oplock break */
struct mutex lock_mutex; struct mutex lock_mutex;
struct list_head llist; /* list of byte range locks we have. */ struct list_head llist; /* list of byte range locks we have. */
unsigned closePend:1; /* file is marked to close */ unsigned closePend:1; /* file is marked to close */
unsigned invalidHandle:1; /* file closed via session abend */ unsigned invalidHandle:1; /* file closed via session abend */
atomic_t wrtPending; /* handle in use - defer close */ atomic_t wrtPending; /* handle in use - defer close */
struct semaphore fh_sem; /* prevents reopen race after dead ses*/ struct semaphore fh_sem; /* prevents reopen race after dead ses*/
char * search_resume_name; /* BB removeme BB */ char *search_resume_name; /* BB removeme BB */
struct cifs_search_info srch_inf; struct cifs_search_info srch_inf;
}; };
...@@ -327,7 +341,7 @@ struct cifsFileInfo { ...@@ -327,7 +341,7 @@ struct cifsFileInfo {
struct cifsInodeInfo { struct cifsInodeInfo {
struct list_head lockList; struct list_head lockList;
/* BB add in lists for dirty pages - i.e. write caching info for oplock */ /* BB add in lists for dirty pages i.e. write caching info for oplock */
struct list_head openFileList; struct list_head openFileList;
int write_behind_rc; int write_behind_rc;
__u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */
...@@ -381,9 +395,9 @@ static inline void cifs_stats_bytes_read(struct cifsTconInfo *tcon, ...@@ -381,9 +395,9 @@ static inline void cifs_stats_bytes_read(struct cifsTconInfo *tcon,
} }
#else #else
#define cifs_stats_inc(field) do {} while(0) #define cifs_stats_inc(field) do {} while (0)
#define cifs_stats_bytes_written(tcon, bytes) do {} while(0) #define cifs_stats_bytes_written(tcon, bytes) do {} while (0)
#define cifs_stats_bytes_read(tcon, bytes) do {} while(0) #define cifs_stats_bytes_read(tcon, bytes) do {} while (0)
#endif #endif
...@@ -410,8 +424,8 @@ struct mid_q_entry { ...@@ -410,8 +424,8 @@ struct mid_q_entry {
struct oplock_q_entry { struct oplock_q_entry {
struct list_head qhead; struct list_head qhead;
struct inode * pinode; struct inode *pinode;
struct cifsTconInfo * tcon; struct cifsTconInfo *tcon;
__u16 netfid; __u16 netfid;
}; };
...@@ -426,7 +440,7 @@ struct dir_notify_req { ...@@ -426,7 +440,7 @@ struct dir_notify_req {
__u16 netfid; __u16 netfid;
__u32 filter; /* CompletionFilter (for multishot) */ __u32 filter; /* CompletionFilter (for multishot) */
int multishot; int multishot;
struct file * pfile; struct file *pfile;
}; };
#define MID_FREE 0 #define MID_FREE 0
......
...@@ -366,17 +366,19 @@ struct smb_hdr { ...@@ -366,17 +366,19 @@ struct smb_hdr {
#define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 ) #define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 )
/* /*
* Computer Name Length * Computer Name Length (since Netbios name was length 16 with last byte 0x20)
* No longer as important, now that TCP names are more commonly used to
* resolve hosts.
*/ */
#define CNLEN 15 #define CNLEN 15
/* /*
* Share Name Length @S8A * Share Name Length (SNLEN)
* Note: This length is limited by the SMB used to get @S8A * Note: This length was limited by the SMB used to get
* the Share info. NetShareEnum only returns 13 @S8A * the Share info. NetShareEnum only returned 13
* chars, including the null termination. @S8A * chars, including the null termination.
* This was removed because it no longer is limiting.
*/ */
#define SNLEN 12 /*@S8A */
/* /*
* Comment Length * Comment Length
...@@ -712,6 +714,7 @@ typedef struct smb_com_findclose_req { ...@@ -712,6 +714,7 @@ typedef struct smb_com_findclose_req {
#define REQ_OPLOCK 0x00000002 #define REQ_OPLOCK 0x00000002
#define REQ_BATCHOPLOCK 0x00000004 #define REQ_BATCHOPLOCK 0x00000004
#define REQ_OPENDIRONLY 0x00000008 #define REQ_OPENDIRONLY 0x00000008
#define REQ_EXTENDED_INFO 0x00000010
typedef struct smb_com_open_req { /* also handles create */ typedef struct smb_com_open_req { /* also handles create */
struct smb_hdr hdr; /* wct = 24 */ struct smb_hdr hdr; /* wct = 24 */
...@@ -818,7 +821,8 @@ typedef struct smb_com_writex_req { ...@@ -818,7 +821,8 @@ typedef struct smb_com_writex_req {
__le16 DataLengthLow; __le16 DataLengthLow;
__le16 DataOffset; __le16 DataOffset;
__le16 ByteCount; __le16 ByteCount;
__u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ __u8 Pad; /* BB check for whether padded to DWORD
boundary and optimum performance here */
char Data[0]; char Data[0];
} __attribute__((packed)) WRITEX_REQ; } __attribute__((packed)) WRITEX_REQ;
...@@ -837,7 +841,8 @@ typedef struct smb_com_write_req { ...@@ -837,7 +841,8 @@ typedef struct smb_com_write_req {
__le16 DataOffset; __le16 DataOffset;
__le32 OffsetHigh; __le32 OffsetHigh;
__le16 ByteCount; __le16 ByteCount;
__u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ __u8 Pad; /* BB check for whether padded to DWORD
boundary and optimum performance here */
char Data[0]; char Data[0];
} __attribute__((packed)) WRITE_REQ; } __attribute__((packed)) WRITE_REQ;
...@@ -896,7 +901,8 @@ typedef struct smb_com_read_rsp { ...@@ -896,7 +901,8 @@ typedef struct smb_com_read_rsp {
__le16 DataLengthHigh; __le16 DataLengthHigh;
__u64 Reserved2; __u64 Reserved2;
__u16 ByteCount; __u16 ByteCount;
__u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ __u8 Pad; /* BB check for whether padded to DWORD
boundary and optimum performance here */
char Data[1]; char Data[1];
} __attribute__((packed)) READ_RSP; } __attribute__((packed)) READ_RSP;
...@@ -1743,7 +1749,9 @@ typedef struct smb_com_transaction2_get_dfs_refer_req { ...@@ -1743,7 +1749,9 @@ typedef struct smb_com_transaction2_get_dfs_refer_req {
__u8 Reserved3; __u8 Reserved3;
__le16 SubCommand; /* one setup word */ __le16 SubCommand; /* one setup word */
__le16 ByteCount; __le16 ByteCount;
__u8 Pad[3]; /* Win2K has sent 0x0F01 (max resp length perhaps?) followed by one byte pad - doesn't seem to matter though */ __u8 Pad[3]; /* Win2K has sent 0x0F01 (max response length
perhaps?) followed by one byte pad - doesn't
seem to matter though */
__le16 MaxReferralLevel; __le16 MaxReferralLevel;
char RequestFileName[1]; char RequestFileName[1];
} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ; } __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ;
...@@ -1752,7 +1760,10 @@ typedef struct dfs_referral_level_3 { ...@@ -1752,7 +1760,10 @@ typedef struct dfs_referral_level_3 {
__le16 VersionNumber; __le16 VersionNumber;
__le16 ReferralSize; __le16 ReferralSize;
__le16 ServerType; /* 0x0001 = CIFS server */ __le16 ServerType; /* 0x0001 = CIFS server */
__le16 ReferralFlags; /* or proximity - not clear which since always set to zero - SNIA spec says 0x01 means strip off PathConsumed chars before submitting RequestFileName to remote node */ __le16 ReferralFlags; /* or proximity - not clear which since it is
always set to zero - SNIA spec says 0x01
means strip off PathConsumed chars before
submitting RequestFileName to remote node */
__le16 TimeToLive; __le16 TimeToLive;
__le16 Proximity; __le16 Proximity;
__le16 DfsPathOffset; __le16 DfsPathOffset;
...@@ -1778,11 +1789,13 @@ typedef struct smb_com_transaction_get_dfs_refer_rsp { ...@@ -1778,11 +1789,13 @@ typedef struct smb_com_transaction_get_dfs_refer_rsp {
#define DFSREF_STORAGE_SERVER 0x0002 #define DFSREF_STORAGE_SERVER 0x0002
/* IOCTL information */ /* IOCTL information */
/* List of ioctl function codes that look to be of interest to remote clients like this. */ /*
/* Need to do some experimentation to make sure they all work remotely. */ * List of ioctl function codes that look to be of interest to remote clients
/* Some of the following such as the encryption/compression ones would be */ * like this one. Need to do some experimentation to make sure they all work
/* invoked from tools via a specialized hook into the VFS rather than via the */ * remotely. Some of the following, such as the encryption/compression ones
/* standard vfs entry points */ * would be invoked from tools via a specialized hook into the VFS rather
* than via the standard vfs entry points
*/
#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000 #define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000
#define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004 #define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004
#define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008 #define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008
...@@ -1871,7 +1884,7 @@ typedef struct { ...@@ -1871,7 +1884,7 @@ typedef struct {
__le16 MajorVersionNumber; __le16 MajorVersionNumber;
__le16 MinorVersionNumber; __le16 MinorVersionNumber;
__le64 Capability; __le64 Capability;
} __attribute__((packed)) FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */ } __attribute__((packed)) FILE_SYSTEM_UNIX_INFO; /* Unix extension level 0x200*/
/* Version numbers for CIFS UNIX major and minor. */ /* Version numbers for CIFS UNIX major and minor. */
#define CIFS_UNIX_MAJOR_VERSION 1 #define CIFS_UNIX_MAJOR_VERSION 1
...@@ -1886,14 +1899,18 @@ typedef struct { ...@@ -1886,14 +1899,18 @@ typedef struct {
#define CIFS_UNIX_POSIX_PATH_OPS_CAP 0x00000020 /* Allow new POSIX path based #define CIFS_UNIX_POSIX_PATH_OPS_CAP 0x00000020 /* Allow new POSIX path based
calls including posix open calls including posix open
and posix unlink */ and posix unlink */
#define CIFS_UNIX_LARGE_READ_CAP 0x00000040 /* support reads >128K (up
to 0xFFFF00 */
#define CIFS_UNIX_LARGE_WRITE_CAP 0x00000080
#ifdef CONFIG_CIFS_POSIX #ifdef CONFIG_CIFS_POSIX
/* Can not set pathnames cap yet until we send new posix create SMB since /* Can not set pathnames cap yet until we send new posix create SMB since
otherwise server can treat such handles opened with older ntcreatex otherwise server can treat such handles opened with older ntcreatex
(by a new client which knows how to send posix path ops) (by a new client which knows how to send posix path ops)
as non-posix handles (can affect write behavior with byte range locks. as non-posix handles (can affect write behavior with byte range locks.
We can add back in POSIX_PATH_OPS cap when Posix Create/Mkdir finished */ We can add back in POSIX_PATH_OPS cap when Posix Create/Mkdir finished */
/* #define CIFS_UNIX_CAP_MASK 0x0000003b */ /* #define CIFS_UNIX_CAP_MASK 0x000000fb */
#define CIFS_UNIX_CAP_MASK 0x0000001b #define CIFS_UNIX_CAP_MASK 0x000000db
#else #else
#define CIFS_UNIX_CAP_MASK 0x00000013 #define CIFS_UNIX_CAP_MASK 0x00000013
#endif /* CONFIG_CIFS_POSIX */ #endif /* CONFIG_CIFS_POSIX */
...@@ -2138,6 +2155,12 @@ typedef struct { ...@@ -2138,6 +2155,12 @@ typedef struct {
/* struct following varies based on requested level */ /* struct following varies based on requested level */
} __attribute__((packed)) OPEN_PSX_RSP; /* level 0x209 SetPathInfo data */ } __attribute__((packed)) OPEN_PSX_RSP; /* level 0x209 SetPathInfo data */
#define SMB_POSIX_UNLINK_FILE_TARGET 0
#define SMB_POSIX_UNLINK_DIRECTORY_TARGET 1
struct unlink_psx_rq { /* level 0x20a SetPathInfo */
__le16 type;
} __attribute__((packed));
struct file_internal_info { struct file_internal_info {
__u64 UniqueId; /* inode number */ __u64 UniqueId; /* inode number */
...@@ -2291,7 +2314,7 @@ struct fealist { ...@@ -2291,7 +2314,7 @@ struct fealist {
struct data_blob { struct data_blob {
__u8 *data; __u8 *data;
size_t length; size_t length;
void (*free) (struct data_blob * data_blob); void (*free) (struct data_blob *data_blob);
} __attribute__((packed)); } __attribute__((packed));
...@@ -2357,8 +2380,10 @@ struct data_blob { ...@@ -2357,8 +2380,10 @@ struct data_blob {
T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks
T2 SET_PATH_INFO (SMB_SET_FILE_BASIC_INFO2) T2 SET_PATH_INFO (SMB_SET_FILE_BASIC_INFO2)
T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_LINK) T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_LINK)
T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) - BB check for missing inode fields T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) BB check for missing
Actually need QUERY_FILE_UNIX_INFO since has inode num inode fields
Actually a need QUERY_FILE_UNIX_INFO
since has inode num
BB what about a) blksize/blkbits/blocks BB what about a) blksize/blkbits/blocks
b) i_version b) i_version
c) i_rdev c) i_rdev
...@@ -2368,8 +2393,6 @@ struct data_blob { ...@@ -2368,8 +2393,6 @@ struct data_blob {
T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX
TRANS2_GET_DFS_REFERRAL - OPTIONAL but recommended TRANS2_GET_DFS_REFERRAL - OPTIONAL but recommended
T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL
*/ */
/* xsymlink is a symlink format (used by MacOS) that can be used /* xsymlink is a symlink format (used by MacOS) that can be used
...@@ -2405,7 +2428,8 @@ typedef struct file_xattr_info { ...@@ -2405,7 +2428,8 @@ typedef struct file_xattr_info {
__u32 xattr_value_len; __u32 xattr_value_len;
char xattr_name[0]; char xattr_name[0];
/* followed by xattr_value[xattr_value_len], no pad */ /* followed by xattr_value[xattr_value_len], no pad */
} __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute, info level 0x205 */ } __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute info
level 0x205 */
/* flags for chattr command */ /* flags for chattr command */
...@@ -2431,7 +2455,8 @@ typedef struct file_xattr_info { ...@@ -2431,7 +2455,8 @@ typedef struct file_xattr_info {
typedef struct file_chattr_info { typedef struct file_chattr_info {
__le64 mask; /* list of all possible attribute bits */ __le64 mask; /* list of all possible attribute bits */
__le64 mode; /* list of actual attribute bits on this inode */ __le64 mode; /* list of actual attribute bits on this inode */
} __attribute__((packed)) FILE_CHATTR_INFO; /* ext attributes (chattr, chflags) level 0x206 */ } __attribute__((packed)) FILE_CHATTR_INFO; /* ext attributes
(chattr, chflags) level 0x206 */
#endif #endif
......
...@@ -64,19 +64,19 @@ extern unsigned int smbCalcSize(struct smb_hdr *ptr); ...@@ -64,19 +64,19 @@ extern unsigned int smbCalcSize(struct smb_hdr *ptr);
extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr);
extern int decode_negTokenInit(unsigned char *security_blob, int length, extern int decode_negTokenInit(unsigned char *security_blob, int length,
enum securityEnum *secType); enum securityEnum *secType);
extern int cifs_inet_pton(int, char * source, void *dst); extern int cifs_inet_pton(int, char *source, void *dst);
extern int map_smb_to_linux_error(struct smb_hdr *smb); extern int map_smb_to_linux_error(struct smb_hdr *smb);
extern void header_assemble(struct smb_hdr *, char /* command */ , extern void header_assemble(struct smb_hdr *, char /* command */ ,
const struct cifsTconInfo *, int /* length of const struct cifsTconInfo *, int /* length of
fixed section (word count) in two byte units */); fixed section (word count) in two byte units */);
extern int small_smb_init_no_tc(const int smb_cmd, const int wct, extern int small_smb_init_no_tc(const int smb_cmd, const int wct,
struct cifsSesInfo *ses, struct cifsSesInfo *ses,
void ** request_buf); void **request_buf);
extern int CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, extern int CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses,
const int stage, const int stage,
const struct nls_table *nls_cp); const struct nls_table *nls_cp);
extern __u16 GetNextMid(struct TCP_Server_Info *server); extern __u16 GetNextMid(struct TCP_Server_Info *server);
extern struct oplock_q_entry * AllocOplockQEntry(struct inode *, u16, extern struct oplock_q_entry *AllocOplockQEntry(struct inode *, u16,
struct cifsTconInfo *); struct cifsTconInfo *);
extern void DeleteOplockQEntry(struct oplock_q_entry *); extern void DeleteOplockQEntry(struct oplock_q_entry *);
extern struct timespec cifs_NTtimeToUnix(u64 /* utc nanoseconds since 1601 */ ); extern struct timespec cifs_NTtimeToUnix(u64 /* utc nanoseconds since 1601 */ );
...@@ -90,7 +90,7 @@ extern int cifs_get_inode_info(struct inode **pinode, ...@@ -90,7 +90,7 @@ extern int cifs_get_inode_info(struct inode **pinode,
struct super_block *sb, int xid); struct super_block *sb, int xid);
extern int cifs_get_inode_info_unix(struct inode **pinode, extern int cifs_get_inode_info_unix(struct inode **pinode,
const unsigned char *search_path, const unsigned char *search_path,
struct super_block *sb,int xid); struct super_block *sb, int xid);
extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *, extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *,
const char *); const char *);
...@@ -99,7 +99,7 @@ void cifs_proc_init(void); ...@@ -99,7 +99,7 @@ void cifs_proc_init(void);
void cifs_proc_clean(void); void cifs_proc_clean(void);
extern int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, extern int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
struct nls_table * nls_info); struct nls_table *nls_info);
extern int CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses); extern int CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses);
extern int CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, extern int CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
...@@ -108,11 +108,11 @@ extern int CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, ...@@ -108,11 +108,11 @@ extern int CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
extern int CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, extern int CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
const char *searchName, const struct nls_table *nls_codepage, const char *searchName, const struct nls_table *nls_codepage,
__u16 *searchHandle, struct cifs_search_info * psrch_inf, __u16 *searchHandle, struct cifs_search_info *psrch_inf,
int map, const char dirsep); int map, const char dirsep);
extern int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, extern int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
__u16 searchHandle, struct cifs_search_info * psrch_inf); __u16 searchHandle, struct cifs_search_info *psrch_inf);
extern int CIFSFindClose(const int, struct cifsTconInfo *tcon, extern int CIFSFindClose(const int, struct cifsTconInfo *tcon,
const __u16 search_handle); const __u16 search_handle);
...@@ -124,7 +124,7 @@ extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, ...@@ -124,7 +124,7 @@ extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
const struct nls_table *nls_codepage, int remap); const struct nls_table *nls_codepage, int remap);
extern int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon, extern int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon,
const unsigned char *searchName, const unsigned char *searchName,
FILE_ALL_INFO * findData, FILE_ALL_INFO *findData,
const struct nls_table *nls_codepage, int remap); const struct nls_table *nls_codepage, int remap);
extern int CIFSSMBUnixQPathInfo(const int xid, extern int CIFSSMBUnixQPathInfo(const int xid,
...@@ -146,10 +146,10 @@ extern int get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, ...@@ -146,10 +146,10 @@ extern int get_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
const char *old_path, const char *old_path,
const struct nls_table *nls_codepage, const struct nls_table *nls_codepage,
unsigned int *pnum_referrals, unsigned int *pnum_referrals,
unsigned char ** preferrals, unsigned char **preferrals,
int remap); int remap);
extern void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon, extern void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon,
struct super_block * sb, struct smb_vol * vol); struct super_block *sb, struct smb_vol *vol);
extern int CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon,
struct kstatfs *FSData); struct kstatfs *FSData);
extern int SMBOldQFSInfo(const int xid, struct cifsTconInfo *tcon, extern int SMBOldQFSInfo(const int xid, struct cifsTconInfo *tcon,
...@@ -181,7 +181,7 @@ extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, ...@@ -181,7 +181,7 @@ extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon,
const struct nls_table *nls_codepage, const struct nls_table *nls_codepage,
int remap_special_chars); int remap_special_chars);
extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon,
__u64 size, __u16 fileHandle,__u32 opener_pid, __u64 size, __u16 fileHandle, __u32 opener_pid,
int AllocSizeFlag); int AllocSizeFlag);
extern int CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *pTcon, extern int CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *pTcon,
char *full_path, __u64 mode, __u64 uid, char *full_path, __u64 mode, __u64 uid,
...@@ -196,7 +196,10 @@ extern int CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon, ...@@ -196,7 +196,10 @@ extern int CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon,
extern int CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon,
const char *name, const struct nls_table *nls_codepage, const char *name, const struct nls_table *nls_codepage,
int remap_special_chars); int remap_special_chars);
extern int CIFSPOSIXDelFile(const int xid, struct cifsTconInfo *tcon,
const char *name, __u16 type,
const struct nls_table *nls_codepage,
int remap_special_chars);
extern int CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon,
const char *name, const char *name,
const struct nls_table *nls_codepage, const struct nls_table *nls_codepage,
...@@ -205,8 +208,8 @@ extern int CIFSSMBRename(const int xid, struct cifsTconInfo *tcon, ...@@ -205,8 +208,8 @@ extern int CIFSSMBRename(const int xid, struct cifsTconInfo *tcon,
const char *fromName, const char *toName, const char *fromName, const char *toName,
const struct nls_table *nls_codepage, const struct nls_table *nls_codepage,
int remap_special_chars); int remap_special_chars);
extern int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon, extern int CIFSSMBRenameOpenFile(const int xid, struct cifsTconInfo *pTcon,
int netfid, char * target_name, int netfid, char *target_name,
const struct nls_table *nls_codepage, const struct nls_table *nls_codepage,
int remap_special_chars); int remap_special_chars);
extern int CIFSCreateHardLink(const int xid, extern int CIFSCreateHardLink(const int xid,
...@@ -255,7 +258,7 @@ extern int CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, ...@@ -255,7 +258,7 @@ extern int CIFSSMBClose(const int xid, struct cifsTconInfo *tcon,
extern int CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBRead(const int xid, struct cifsTconInfo *tcon,
const int netfid, unsigned int count, const int netfid, unsigned int count,
const __u64 lseek, unsigned int *nbytes, char **buf, const __u64 lseek, unsigned int *nbytes, char **buf,
int * return_buf_type); int *return_buf_type);
extern int CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
const int netfid, const unsigned int count, const int netfid, const unsigned int count,
const __u64 lseek, unsigned int *nbytes, const __u64 lseek, unsigned int *nbytes,
...@@ -270,9 +273,9 @@ extern int CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon, ...@@ -270,9 +273,9 @@ extern int CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon,
const struct nls_table *nls_codepage, const struct nls_table *nls_codepage,
int remap_special_chars); int remap_special_chars);
extern int cifs_convertUCSpath(char *target, const __le16 *source, int maxlen, extern int cifs_convertUCSpath(char *target, const __le16 *source, int maxlen,
const struct nls_table * codepage); const struct nls_table *codepage);
extern int cifsConvertToUCS(__le16 * target, const char *source, int maxlen, extern int cifsConvertToUCS(__le16 *target, const char *source, int maxlen,
const struct nls_table * cp, int mapChars); const struct nls_table *cp, int mapChars);
extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
const __u16 netfid, const __u64 len, const __u16 netfid, const __u64 len,
...@@ -291,19 +294,21 @@ extern void sesInfoFree(struct cifsSesInfo *); ...@@ -291,19 +294,21 @@ extern void sesInfoFree(struct cifsSesInfo *);
extern struct cifsTconInfo *tconInfoAlloc(void); extern struct cifsTconInfo *tconInfoAlloc(void);
extern void tconInfoFree(struct cifsTconInfo *); extern void tconInfoFree(struct cifsTconInfo *);
extern int cifs_sign_smb(struct smb_hdr *, struct TCP_Server_Info *,__u32 *); extern int cifs_sign_smb(struct smb_hdr *, struct TCP_Server_Info *, __u32 *);
extern int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *, extern int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *,
__u32 *); __u32 *);
extern int cifs_verify_signature(struct smb_hdr *, const char * mac_key, extern int cifs_verify_signature(struct smb_hdr *,
const struct mac_key *mac_key,
__u32 expected_sequence_number); __u32 expected_sequence_number);
extern int cifs_calculate_mac_key(char * key,const char * rn,const char * pass); extern int cifs_calculate_mac_key(struct mac_key *key, const char *rn,
const char *pass);
extern int CalcNTLMv2_partial_mac_key(struct cifsSesInfo *, extern int CalcNTLMv2_partial_mac_key(struct cifsSesInfo *,
const struct nls_table *); const struct nls_table *);
extern void CalcNTLMv2_response(const struct cifsSesInfo *, char * ); extern void CalcNTLMv2_response(const struct cifsSesInfo *, char * );
extern void setup_ntlmv2_rsp(struct cifsSesInfo *, char *, extern void setup_ntlmv2_rsp(struct cifsSesInfo *, char *,
const struct nls_table *); const struct nls_table *);
#ifdef CONFIG_CIFS_WEAK_PW_HASH #ifdef CONFIG_CIFS_WEAK_PW_HASH
extern void calc_lanman_hash(struct cifsSesInfo * ses, char * lnm_session_key); extern void calc_lanman_hash(struct cifsSesInfo *ses, char *lnm_session_key);
#endif /* CIFS_WEAK_PW_HASH */ #endif /* CIFS_WEAK_PW_HASH */
extern int CIFSSMBCopy(int xid, extern int CIFSSMBCopy(int xid,
struct cifsTconInfo *source_tcon, struct cifsTconInfo *source_tcon,
...@@ -313,27 +318,27 @@ extern int CIFSSMBCopy(int xid, ...@@ -313,27 +318,27 @@ extern int CIFSSMBCopy(int xid,
const struct nls_table *nls_codepage, const struct nls_table *nls_codepage,
int remap_special_chars); int remap_special_chars);
extern int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon,
const int notify_subdirs,const __u16 netfid, const int notify_subdirs, const __u16 netfid,
__u32 filter, struct file * file, int multishot, __u32 filter, struct file *file, int multishot,
const struct nls_table *nls_codepage); const struct nls_table *nls_codepage);
extern ssize_t CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon, extern ssize_t CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
const unsigned char *searchName, char * EAData, const unsigned char *searchName, char *EAData,
size_t bufsize, const struct nls_table *nls_codepage, size_t bufsize, const struct nls_table *nls_codepage,
int remap_special_chars); int remap_special_chars);
extern ssize_t CIFSSMBQueryEA(const int xid,struct cifsTconInfo * tcon, extern ssize_t CIFSSMBQueryEA(const int xid, struct cifsTconInfo *tcon,
const unsigned char * searchName,const unsigned char * ea_name, const unsigned char *searchName, const unsigned char *ea_name,
unsigned char * ea_value, size_t buf_size, unsigned char *ea_value, size_t buf_size,
const struct nls_table *nls_codepage, int remap_special_chars); const struct nls_table *nls_codepage, int remap_special_chars);
extern int CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon,
const char *fileName, const char * ea_name, const char *fileName, const char *ea_name,
const void * ea_value, const __u16 ea_value_len, const void *ea_value, const __u16 ea_value_len,
const struct nls_table *nls_codepage, int remap_special_chars); const struct nls_table *nls_codepage, int remap_special_chars);
extern int CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon,
__u16 fid, char *acl_inf, const int buflen, __u16 fid, char *acl_inf, const int buflen,
const int acl_type /* ACCESS vs. DEFAULT */); const int acl_type /* ACCESS vs. DEFAULT */);
extern int CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon,
const unsigned char *searchName, const unsigned char *searchName,
char *acl_inf, const int buflen,const int acl_type, char *acl_inf, const int buflen, const int acl_type,
const struct nls_table *nls_codepage, int remap_special_chars); const struct nls_table *nls_codepage, int remap_special_chars);
extern int CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon,
const unsigned char *fileName, const unsigned char *fileName,
......
This diff is collapsed.
This diff is collapsed.
...@@ -135,10 +135,10 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -135,10 +135,10 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
char *full_path = NULL; char *full_path = NULL;
FILE_ALL_INFO * buf = NULL; FILE_ALL_INFO *buf = NULL;
struct inode *newinode = NULL; struct inode *newinode = NULL;
struct cifsFileInfo * pCifsFile = NULL; struct cifsFileInfo *pCifsFile = NULL;
struct cifsInodeInfo * pCifsInode; struct cifsInodeInfo *pCifsInode;
int disposition = FILE_OVERWRITE_IF; int disposition = FILE_OVERWRITE_IF;
int write_only = FALSE; int write_only = FALSE;
...@@ -207,8 +207,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -207,8 +207,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
} else { } else {
/* If Open reported that we actually created a file /* If Open reported that we actually created a file
then we now have to set the mode if possible */ then we now have to set the mode if possible */
if ((cifs_sb->tcon->ses->capabilities & CAP_UNIX) && if ((pTcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) {
(oplock & CIFS_CREATE_ACTION)) {
mode &= ~current->fs->umask; mode &= ~current->fs->umask;
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
...@@ -235,8 +234,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -235,8 +234,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
/* Could set r/o dos attribute if mode & 0222 == 0 */ /* Could set r/o dos attribute if mode & 0222 == 0 */
} }
/* BB server might mask mode so we have to query for Unix case*/ /* server might mask mode so we have to query for it */
if (pTcon->ses->capabilities & CAP_UNIX) if (pTcon->unix_ext)
rc = cifs_get_inode_info_unix(&newinode, full_path, rc = cifs_get_inode_info_unix(&newinode, full_path,
inode->i_sb, xid); inode->i_sb, xid);
else { else {
...@@ -264,7 +263,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -264,7 +263,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
direntry->d_op = &cifs_dentry_ops; direntry->d_op = &cifs_dentry_ops;
d_instantiate(direntry, newinode); d_instantiate(direntry, newinode);
} }
if ((nd->flags & LOOKUP_OPEN) == FALSE) { if ((nd == NULL /* nfsd case - nfs srv does not set nd */) ||
((nd->flags & LOOKUP_OPEN) == FALSE)) {
/* mknod case - do not leave file open */ /* mknod case - do not leave file open */
CIFSSMBClose(xid, pTcon, fileHandle); CIFSSMBClose(xid, pTcon, fileHandle);
} else if (newinode) { } else if (newinode) {
...@@ -323,7 +323,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, ...@@ -323,7 +323,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
char *full_path = NULL; char *full_path = NULL;
struct inode * newinode = NULL; struct inode *newinode = NULL;
if (!old_valid_dev(device_number)) if (!old_valid_dev(device_number))
return -EINVAL; return -EINVAL;
...@@ -336,7 +336,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, ...@@ -336,7 +336,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
full_path = build_path_from_dentry(direntry); full_path = build_path_from_dentry(direntry);
if (full_path == NULL) if (full_path == NULL)
rc = -ENOMEM; rc = -ENOMEM;
else if (pTcon->ses->capabilities & CAP_UNIX) { else if (pTcon->unix_ext) {
mode &= ~current->fs->umask; mode &= ~current->fs->umask;
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path,
...@@ -490,7 +490,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, ...@@ -490,7 +490,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
cFYI(1, cFYI(1,
(" Full path: %s inode = 0x%p", full_path, direntry->d_inode)); (" Full path: %s inode = 0x%p", full_path, direntry->d_inode));
if (pTcon->ses->capabilities & CAP_UNIX) if (pTcon->unix_ext)
rc = cifs_get_inode_info_unix(&newInode, full_path, rc = cifs_get_inode_info_unix(&newInode, full_path,
parent_dir_inode->i_sb, xid); parent_dir_inode->i_sb, xid);
else else
......
...@@ -26,28 +26,41 @@ ...@@ -26,28 +26,41 @@
/* /*
* See Documentation/filesystems/Exporting * See Documentation/filesystems/Exporting
* and examples in fs/exportfs * and examples in fs/exportfs
*
* Since cifs is a network file system, an "fsid" must be included for
* any nfs exports file entries which refer to cifs paths. In addition
* the cifs mount must be mounted with the "serverino" option (ie use stable
* server inode numbers instead of locally generated temporary ones).
* Although cifs inodes do not use generation numbers (have generation number
* of zero) - the inode number alone should be good enough for simple cases
* in which users want to export cifs shares with NFS. The decode and encode
* could be improved by using a new routine which expects 64 bit inode numbers
* instead of the default 32 bit routines in fs/exportfs
*
*/ */
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/exportfs.h> #include <linux/exportfs.h>
#include "cifsglob.h"
#include "cifs_debug.h"
#ifdef CONFIG_CIFS_EXPERIMENTAL #ifdef CONFIG_CIFS_EXPERIMENTAL
static struct dentry *cifs_get_parent(struct dentry *dentry) static struct dentry *cifs_get_parent(struct dentry *dentry)
{ {
/* BB need to add code here eventually to enable export via NFSD */ /* BB need to add code here eventually to enable export via NFSD */
cFYI(1, ("get parent for %p", dentry));
return ERR_PTR(-EACCES); return ERR_PTR(-EACCES);
} }
struct export_operations cifs_export_ops = { struct export_operations cifs_export_ops = {
.get_parent = cifs_get_parent, .get_parent = cifs_get_parent,
/* Following five export operations are unneeded so far and can default */ /* Following five export operations are unneeded so far and can default:
/* .get_dentry = .get_dentry =
.get_name = .get_name =
.find_exported_dentry = .find_exported_dentry =
.decode_fh = .decode_fh =
.encode_fs = */ .encode_fs = */
}; };
#endif /* EXPERIMENTAL */ #endif /* EXPERIMENTAL */
...@@ -66,7 +66,7 @@ static __u32 convert_to_cifs_notify_flags(unsigned long fcntl_notify_flags) ...@@ -66,7 +66,7 @@ static __u32 convert_to_cifs_notify_flags(unsigned long fcntl_notify_flags)
return cifs_ntfy_flags; return cifs_ntfy_flags;
} }
int cifs_dir_notify(struct file * file, unsigned long arg) int cifs_dir_notify(struct file *file, unsigned long arg)
{ {
int xid; int xid;
int rc = -EINVAL; int rc = -EINVAL;
......
This diff is collapsed.
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* vfs operations that deal with io control * vfs operations that deal with io control
* *
* Copyright (C) International Business Machines Corp., 2005 * Copyright (C) International Business Machines Corp., 2005,2007
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2) #define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2)
int cifs_ioctl (struct inode * inode, struct file * filep, int cifs_ioctl (struct inode *inode, struct file *filep,
unsigned int command, unsigned long arg) unsigned int command, unsigned long arg)
{ {
int rc = -ENOTTY; /* strange error - but the precedent */ int rc = -ENOTTY; /* strange error - but the precedent */
......
This diff is collapsed.
...@@ -170,7 +170,7 @@ mdfour(unsigned char *out, unsigned char *in, int n) ...@@ -170,7 +170,7 @@ mdfour(unsigned char *out, unsigned char *in, int n)
while (n > 64) { while (n > 64) {
copy64(M, in); copy64(M, in);
mdfour64(M,&A,&B, &C, &D); mdfour64(M, &A, &B, &C, &D);
in += 64; in += 64;
n -= 64; n -= 64;
} }
......
This diff is collapsed.
This diff is collapsed.
/* /*
* fs/cifs/ntlmssp.h * fs/cifs/ntlmssp.h
* *
* Copyright (c) International Business Machines Corp., 2002,2006 * Copyright (c) International Business Machines Corp., 2002,2007
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
...@@ -27,18 +27,18 @@ ...@@ -27,18 +27,18 @@
#define UnknownMessage cpu_to_le32(8) #define UnknownMessage cpu_to_le32(8)
/* Negotiate Flags */ /* Negotiate Flags */
#define NTLMSSP_NEGOTIATE_UNICODE 0x01 // Text strings are in unicode #define NTLMSSP_NEGOTIATE_UNICODE 0x01 /* Text strings are in unicode */
#define NTLMSSP_NEGOTIATE_OEM 0x02 // Text strings are in OEM #define NTLMSSP_NEGOTIATE_OEM 0x02 /* Text strings are in OEM */
#define NTLMSSP_REQUEST_TARGET 0x04 // Server return its auth realm #define NTLMSSP_REQUEST_TARGET 0x04 /* Server return its auth realm */
#define NTLMSSP_NEGOTIATE_SIGN 0x0010 // Request signature capability #define NTLMSSP_NEGOTIATE_SIGN 0x0010 /* Request signature capability */
#define NTLMSSP_NEGOTIATE_SEAL 0x0020 // Request confidentiality #define NTLMSSP_NEGOTIATE_SEAL 0x0020 /* Request confidentiality */
#define NTLMSSP_NEGOTIATE_DGRAM 0x0040 #define NTLMSSP_NEGOTIATE_DGRAM 0x0040
#define NTLMSSP_NEGOTIATE_LM_KEY 0x0080 // Use LM session key for sign/seal #define NTLMSSP_NEGOTIATE_LM_KEY 0x0080 /* Sign/seal use LM session key */
#define NTLMSSP_NEGOTIATE_NTLM 0x0200 // NTLM authentication #define NTLMSSP_NEGOTIATE_NTLM 0x0200 /* NTLM authentication */
#define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000 #define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x1000
#define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000 #define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x2000
#define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x4000 // client/server on same machine #define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x4000 /* client/server on same machine */
#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x8000 // Sign for all security levels #define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x8000 /* Sign for all security levels */
#define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000 #define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000
#define NTLMSSP_TARGET_TYPE_SERVER 0x20000 #define NTLMSSP_TARGET_TYPE_SERVER 0x20000
#define NTLMSSP_TARGET_TYPE_SHARE 0x40000 #define NTLMSSP_TARGET_TYPE_SHARE 0x40000
......
This diff is collapsed.
This diff is collapsed.
...@@ -153,7 +153,7 @@ static uchar sbox[8][4][16] = { ...@@ -153,7 +153,7 @@ static uchar sbox[8][4][16] = {
}; };
static void static void
permute(char *out, char *in, uchar * p, int n) permute(char *out, char *in, uchar *p, int n)
{ {
int i; int i;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
...@@ -202,18 +202,18 @@ dohash(char *out, char *in, char *key, int forw) ...@@ -202,18 +202,18 @@ dohash(char *out, char *in, char *key, int forw)
char *rl; char *rl;
/* Have to reduce stack usage */ /* Have to reduce stack usage */
pk1 = kmalloc(56+56+64+64,GFP_KERNEL); pk1 = kmalloc(56+56+64+64, GFP_KERNEL);
if(pk1 == NULL) if (pk1 == NULL)
return; return;
ki = kmalloc(16*48, GFP_KERNEL); ki = kmalloc(16*48, GFP_KERNEL);
if(ki == NULL) { if (ki == NULL) {
kfree(pk1); kfree(pk1);
return; return;
} }
cd = pk1 + 56; cd = pk1 + 56;
pd1= cd + 56; pd1 = cd + 56;
rl = pd1 + 64; rl = pd1 + 64;
permute(pk1, key, perm1, 56); permute(pk1, key, perm1, 56);
...@@ -247,7 +247,7 @@ dohash(char *out, char *in, char *key, int forw) ...@@ -247,7 +247,7 @@ dohash(char *out, char *in, char *key, int forw)
char *r2; /* r2[32] */ char *r2; /* r2[32] */
er = kmalloc(48+48+32+32+32, GFP_KERNEL); er = kmalloc(48+48+32+32+32, GFP_KERNEL);
if(er == NULL) { if (er == NULL) {
kfree(pk1); kfree(pk1);
kfree(ki); kfree(ki);
return; return;
...@@ -327,8 +327,8 @@ smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw) ...@@ -327,8 +327,8 @@ smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
char *keyb; /* keyb[64] */ char *keyb; /* keyb[64] */
unsigned char key2[8]; unsigned char key2[8];
outb = kmalloc(64 * 3,GFP_KERNEL); outb = kmalloc(64 * 3, GFP_KERNEL);
if(outb == NULL) if (outb == NULL)
return; return;
inb = outb + 64; inb = outb + 64;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment