[CIFS] whitespace/formatting fixes
This should be the last big batch of whitespace/formatting fixes. checkpatch warnings for the cifs directory are down about 90% and many of the remaining ones are harder to remove or make the code harder to read. Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
@@ -498,7 +498,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
|
||||
return 0;
|
||||
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)
|
||||
|| (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));
|
||||
return 0;
|
||||
}
|
||||
@@ -508,7 +509,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
|
||||
return 0;
|
||||
} else if ((cls != ASN1_UNI) || (con != ASN1_CON)
|
||||
|| (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));
|
||||
return 0;
|
||||
}
|
||||
@@ -540,32 +542,34 @@ decode_negTokenInit(unsigned char *security_blob, int length,
|
||||
rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag);
|
||||
if (!rc) {
|
||||
cFYI(1,
|
||||
("Error 1 decoding negTokenInit header exit 2"));
|
||||
("Error decoding negTokenInit hdr exit2"));
|
||||
return 0;
|
||||
}
|
||||
if ((tag == ASN1_OJI) && (con == ASN1_PRI)) {
|
||||
rc = asn1_oid_decode(&ctx, end, &oid, &oidlen);
|
||||
if (rc) {
|
||||
cFYI(1,
|
||||
("OID len = %d oid = 0x%lx 0x%lx 0x%lx 0x%lx",
|
||||
oidlen, *oid, *(oid + 1), *(oid + 2),
|
||||
*(oid + 3)));
|
||||
rc = compare_oid(oid, oidlen, NTLMSSP_OID,
|
||||
NTLMSSP_OID_LEN);
|
||||
("OID len = %d oid = 0x%lx 0x%lx "
|
||||
"0x%lx 0x%lx",
|
||||
oidlen, *oid, *(oid + 1),
|
||||
*(oid + 2), *(oid + 3)));
|
||||
rc = compare_oid(oid, oidlen,
|
||||
NTLMSSP_OID, NTLMSSP_OID_LEN);
|
||||
kfree(oid);
|
||||
if (rc)
|
||||
use_ntlmssp = TRUE;
|
||||
}
|
||||
} 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) {
|
||||
cFYI(1,
|
||||
("Error decoding last part of negTokenInit exit 3"));
|
||||
("Error decoding last part negTokenInit exit3"));
|
||||
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,
|
||||
("Exit 4 cls = %d con = %d tag = %d end = %p (%d)",
|
||||
cls, con, tag, end, *end));
|
||||
@@ -573,7 +577,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
|
||||
}
|
||||
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
|
||||
cFYI(1,
|
||||
("Error decoding last part of negTokenInit exit 5"));
|
||||
("Error decoding last part negTokenInit exit5"));
|
||||
return 0;
|
||||
} else if ((cls != ASN1_UNI) || (con != ASN1_CON)
|
||||
|| (tag != ASN1_SEQ)) {
|
||||
@@ -584,7 +588,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
|
||||
|
||||
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
|
||||
cFYI(1,
|
||||
("Error decoding last part of negTokenInit exit 7"));
|
||||
("Error decoding last part negTokenInit exit 7"));
|
||||
return 0;
|
||||
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
|
||||
cFYI(1,
|
||||
@@ -594,7 +598,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
|
||||
}
|
||||
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
|
||||
cFYI(1,
|
||||
("Error decoding last part of negTokenInit exit 9"));
|
||||
("Error decoding last part negTokenInit exit9"));
|
||||
return 0;
|
||||
} else if ((cls != ASN1_UNI) || (con != ASN1_PRI)
|
||||
|| (tag != ASN1_GENSTR)) {
|
||||
@@ -603,7 +607,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
|
||||
cls, con, tag, end, *end));
|
||||
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)
|
||||
|
@@ -145,7 +145,6 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
|
||||
(ses->serverNOS == NULL)) {
|
||||
buf += sprintf(buf, "\nentry for %s not fully "
|
||||
"displayed\n\t", ses->serverName);
|
||||
|
||||
} else {
|
||||
length =
|
||||
sprintf(buf,
|
||||
|
@@ -173,18 +173,20 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* BB what if signatures are supposed to be on for session but server does not
|
||||
send one? BB */
|
||||
/* BB what if signatures are supposed to be on for session but
|
||||
server does not send one? BB */
|
||||
|
||||
/* Do not need to verify session setups with signature "BSRSPYL " */
|
||||
if (memcmp(cifs_pdu->Signature.SecuritySignature, "BSRSPYL ", 8) == 0)
|
||||
cFYI(1,("dummy signature received for smb command 0x%x",cifs_pdu->Command));
|
||||
cFYI(1, ("dummy signature received for smb command 0x%x",
|
||||
cifs_pdu->Command));
|
||||
|
||||
/* save off the origiginal signature so we can modify the smb and check
|
||||
its signature against what the server sent */
|
||||
memcpy(server_response_sig, cifs_pdu->Signature.SecuritySignature, 8);
|
||||
|
||||
cifs_pdu->Signature.Sequence.SequenceNumber = cpu_to_le32(expected_sequence_number);
|
||||
cifs_pdu->Signature.Sequence.SequenceNumber =
|
||||
cpu_to_le32(expected_sequence_number);
|
||||
cifs_pdu->Signature.Sequence.Reserved = 0;
|
||||
|
||||
rc = cifs_calculate_signature(cifs_pdu, mac_key,
|
||||
@@ -193,8 +195,8 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu,
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
|
||||
/* cifs_dump_mem("what we think it should be: ",what_we_think_sig_should_be,16); */
|
||||
/* cifs_dump_mem("what we think it should be: ",
|
||||
what_we_think_sig_should_be, 16); */
|
||||
|
||||
if (memcmp(server_response_sig, what_we_think_sig_should_be, 8))
|
||||
return -EACCES;
|
||||
@@ -254,14 +256,16 @@ int CalcNTLMv2_partial_mac_key(struct cifsSesInfo * ses,
|
||||
for (i = 0; i < user_name_len; i++)
|
||||
ucase_buf[i] = nls_info->charset2upper[(int)ses->userName[i]];
|
||||
ucase_buf[i] = 0;
|
||||
user_name_len = cifs_strtoUCS(unicode_buf, ucase_buf, MAX_USERNAME_SIZE*2, nls_info);
|
||||
user_name_len = cifs_strtoUCS(unicode_buf, ucase_buf,
|
||||
MAX_USERNAME_SIZE*2, nls_info);
|
||||
unicode_buf[user_name_len] = 0;
|
||||
user_name_len++;
|
||||
|
||||
for (i = 0; i < dom_name_len; i++)
|
||||
ucase_buf[i] = nls_info->charset2upper[(int)ses->domainName[i]];
|
||||
ucase_buf[i] = 0;
|
||||
dom_name_len = cifs_strtoUCS(unicode_buf+user_name_len, ucase_buf, MAX_USERNAME_SIZE*2, nls_info);
|
||||
dom_name_len = cifs_strtoUCS(unicode_buf+user_name_len, ucase_buf,
|
||||
MAX_USERNAME_SIZE*2, nls_info);
|
||||
|
||||
unicode_buf[user_name_len + dom_name_len] = 0;
|
||||
hmac_md5_update((const unsigned char *) unicode_buf,
|
||||
@@ -288,7 +292,8 @@ void calc_lanman_hash(struct cifsSesInfo * ses, char * lnm_session_key)
|
||||
|
||||
if ((ses->server->secMode & SECMODE_PW_ENCRYPT) == 0)
|
||||
if (extended_security & CIFSSEC_MAY_PLNTXT) {
|
||||
memcpy(lnm_session_key, password_with_pad, CIFS_ENCPWD_SIZE);
|
||||
memcpy(lnm_session_key, password_with_pad,
|
||||
CIFS_ENCPWD_SIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -403,7 +408,8 @@ void setup_ntlmv2_rsp(struct cifsSesInfo * ses, char * resp_buf,
|
||||
ses->server->mac_signing_key.len = 16 + sizeof(struct ntlmv2_resp);
|
||||
}
|
||||
|
||||
void CalcNTLMv2_response(const struct cifsSesInfo * ses, char * v2_session_response)
|
||||
void CalcNTLMv2_response(const struct cifsSesInfo *ses,
|
||||
char *v2_session_response)
|
||||
{
|
||||
struct HMACMD5Context context;
|
||||
/* rest of v2 struct already generated */
|
||||
|
@@ -448,8 +448,7 @@ static void cifs_umount_begin(struct vfsmount * vfsmnt, int flags)
|
||||
|
||||
/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
|
||||
/* cancel_notify_requests(tcon); */
|
||||
if (tcon->ses && tcon->ses->server)
|
||||
{
|
||||
if (tcon->ses && tcon->ses->server) {
|
||||
cFYI(1, ("wake up tasks now - umount begin not complete"));
|
||||
wake_up_all(&tcon->ses->server->request_q);
|
||||
wake_up_all(&tcon->ses->server->response_q);
|
||||
@@ -484,9 +483,10 @@ static const struct super_operations cifs_super_ops = {
|
||||
.alloc_inode = cifs_alloc_inode,
|
||||
.destroy_inode = cifs_destroy_inode,
|
||||
/* .drop_inode = generic_delete_inode,
|
||||
.delete_inode = cifs_delete_inode, *//* Do not need the above two functions
|
||||
unless later we add lazy close of inodes or unless the kernel forgets to call
|
||||
us with the same number of releases (closes) as opens */
|
||||
.delete_inode = cifs_delete_inode, */ /* Do not need above two
|
||||
functions unless later we add lazy close of inodes or unless the
|
||||
kernel forgets to call us with the same number of releases (closes)
|
||||
as opens */
|
||||
.show_options = cifs_show_options,
|
||||
.umount_begin = cifs_umount_begin,
|
||||
.remount_fs = cifs_remount,
|
||||
@@ -878,7 +878,8 @@ static int cifs_oplock_thread(void * dummyarg)
|
||||
/* mutex_lock(&inode->i_mutex);*/
|
||||
if (S_ISREG(inode->i_mode)) {
|
||||
rc = filemap_fdatawrite(inode->i_mapping);
|
||||
if (CIFS_I(inode)->clientCanCacheRead == 0) {
|
||||
if (CIFS_I(inode)->clientCanCacheRead
|
||||
== 0) {
|
||||
filemap_fdatawait(inode->i_mapping);
|
||||
invalidate_remote_inode(inode);
|
||||
}
|
||||
|
@@ -366,17 +366,19 @@ struct smb_hdr {
|
||||
#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
|
||||
|
||||
/*
|
||||
* Share Name Length @S8A
|
||||
* Note: This length is limited by the SMB used to get @S8A
|
||||
* the Share info. NetShareEnum only returns 13 @S8A
|
||||
* chars, including the null termination. @S8A
|
||||
* Share Name Length (SNLEN)
|
||||
* Note: This length was limited by the SMB used to get
|
||||
* the Share info. NetShareEnum only returned 13
|
||||
* chars, including the null termination.
|
||||
* This was removed because it no longer is limiting.
|
||||
*/
|
||||
#define SNLEN 12 /*@S8A */
|
||||
|
||||
/*
|
||||
* Comment Length
|
||||
@@ -819,7 +821,8 @@ typedef struct smb_com_writex_req {
|
||||
__le16 DataLengthLow;
|
||||
__le16 DataOffset;
|
||||
__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];
|
||||
} __attribute__((packed)) WRITEX_REQ;
|
||||
|
||||
@@ -838,7 +841,8 @@ typedef struct smb_com_write_req {
|
||||
__le16 DataOffset;
|
||||
__le32 OffsetHigh;
|
||||
__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];
|
||||
} __attribute__((packed)) WRITE_REQ;
|
||||
|
||||
@@ -897,7 +901,8 @@ typedef struct smb_com_read_rsp {
|
||||
__le16 DataLengthHigh;
|
||||
__u64 Reserved2;
|
||||
__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];
|
||||
} __attribute__((packed)) READ_RSP;
|
||||
|
||||
@@ -1744,7 +1749,9 @@ typedef struct smb_com_transaction2_get_dfs_refer_req {
|
||||
__u8 Reserved3;
|
||||
__le16 SubCommand; /* one setup word */
|
||||
__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;
|
||||
char RequestFileName[1];
|
||||
} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ;
|
||||
@@ -1753,7 +1760,10 @@ typedef struct dfs_referral_level_3 {
|
||||
__le16 VersionNumber;
|
||||
__le16 ReferralSize;
|
||||
__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 Proximity;
|
||||
__le16 DfsPathOffset;
|
||||
@@ -1779,11 +1789,13 @@ typedef struct smb_com_transaction_get_dfs_refer_rsp {
|
||||
#define DFSREF_STORAGE_SERVER 0x0002
|
||||
|
||||
/* 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. */
|
||||
/* Some of the following such as the encryption/compression ones would be */
|
||||
/* invoked from tools via a specialized hook into the VFS rather than via the */
|
||||
/* standard vfs entry points */
|
||||
/*
|
||||
* List of ioctl function codes that look to be of interest to remote clients
|
||||
* like this one. Need to do some experimentation to make sure they all work
|
||||
* remotely. Some of the following, such as the encryption/compression ones
|
||||
* 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_2 0x00090004
|
||||
#define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008
|
||||
@@ -1872,7 +1884,7 @@ typedef struct {
|
||||
__le16 MajorVersionNumber;
|
||||
__le16 MinorVersionNumber;
|
||||
__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. */
|
||||
#define CIFS_UNIX_MAJOR_VERSION 1
|
||||
@@ -2362,8 +2374,10 @@ struct data_blob {
|
||||
T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks
|
||||
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_BASIC) - BB check for missing inode fields
|
||||
Actually need QUERY_FILE_UNIX_INFO since has inode num
|
||||
T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) BB check for missing
|
||||
inode fields
|
||||
Actually a need QUERY_FILE_UNIX_INFO
|
||||
since has inode num
|
||||
BB what about a) blksize/blkbits/blocks
|
||||
b) i_version
|
||||
c) i_rdev
|
||||
@@ -2373,8 +2387,6 @@ struct data_blob {
|
||||
T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX
|
||||
TRANS2_GET_DFS_REFERRAL - OPTIONAL but recommended
|
||||
T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/* xsymlink is a symlink format (used by MacOS) that can be used
|
||||
@@ -2410,7 +2422,8 @@ typedef struct file_xattr_info {
|
||||
__u32 xattr_value_len;
|
||||
char xattr_name[0];
|
||||
/* 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 */
|
||||
@@ -2436,7 +2449,8 @@ typedef struct file_xattr_info {
|
||||
typedef struct file_chattr_info {
|
||||
__le64 mask; /* list of all possible attribute bits */
|
||||
__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
|
||||
|
||||
|
@@ -139,14 +139,14 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
|
||||
/* on "soft" mounts we wait once */
|
||||
if ((tcon->retry == FALSE) ||
|
||||
(tcon->ses->status == CifsExiting)) {
|
||||
cFYI(1,("gave up waiting on reconnect in smb_init"));
|
||||
cFYI(1, ("gave up waiting on "
|
||||
"reconnect in smb_init"));
|
||||
return -EHOSTDOWN;
|
||||
} /* else "hard" mount - keep retrying
|
||||
until process is killed or server
|
||||
comes back on-line */
|
||||
} else /* TCP session is reestablished now */
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
nls_codepage = load_nls_default();
|
||||
@@ -174,8 +174,8 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
|
||||
atomic_inc(&tconInfoReconnectCount);
|
||||
|
||||
cFYI(1, ("reconnect tcon rc = %d", rc));
|
||||
/* Removed call to reopen open files here -
|
||||
it is safer (and faster) to reopen files
|
||||
/* Removed call to reopen open files here.
|
||||
It is safer (and faster) to reopen files
|
||||
one at a time as needed in read and write */
|
||||
|
||||
/* Check if handle based operation so we
|
||||
@@ -282,16 +282,15 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
|
||||
/* on "soft" mounts we wait once */
|
||||
if ((tcon->retry == FALSE) ||
|
||||
(tcon->ses->status == CifsExiting)) {
|
||||
cFYI(1,("gave up waiting on reconnect in smb_init"));
|
||||
cFYI(1, ("gave up waiting on "
|
||||
"reconnect in smb_init"));
|
||||
return -EHOSTDOWN;
|
||||
} /* else "hard" mount - keep retrying
|
||||
until process is killed or server
|
||||
comes on-line */
|
||||
} else /* TCP session is reestablished now */
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
nls_codepage = load_nls_default();
|
||||
/* need to prevent multiple threads trying to
|
||||
simultaneously reconnect the same SMB session */
|
||||
@@ -317,8 +316,8 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
|
||||
atomic_inc(&tconInfoReconnectCount);
|
||||
|
||||
cFYI(1, ("reconnect tcon rc = %d", rc));
|
||||
/* Removed call to reopen open files here -
|
||||
it is safer (and faster) to reopen files
|
||||
/* Removed call to reopen open files here.
|
||||
It is safer (and faster) to reopen files
|
||||
one at a time as needed in read and write */
|
||||
|
||||
/* Check if handle based operation so we
|
||||
@@ -392,7 +391,6 @@ static int validate_t2(struct smb_t2_rsp * pSMB)
|
||||
CIFSMaxBufSize+MAX_CIFS_HDR_SIZE)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -504,7 +502,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
|
||||
utc = CURRENT_TIME;
|
||||
ts = cnvrtDosUnixTm(le16_to_cpu(rsp->SrvTime.Date),
|
||||
le16_to_cpu(rsp->SrvTime.Time));
|
||||
cFYI(1,("SrvTime: %d sec since 1970 (utc: %d) diff: %d",
|
||||
cFYI(1, ("SrvTime %d sec since 1970 (utc: %d) diff: %d",
|
||||
(int)ts.tv_sec, (int)utc.tv_sec,
|
||||
(int)(utc.tv_sec - ts.tv_sec)));
|
||||
val = (int)(utc.tv_sec - ts.tv_sec);
|
||||
@@ -1036,7 +1034,6 @@ PsxCreat:
|
||||
sizeof (FILE_UNIX_BASIC_INFO));
|
||||
}
|
||||
|
||||
|
||||
psx_create_err:
|
||||
cifs_buf_release(pSMB);
|
||||
|
||||
@@ -1143,7 +1140,8 @@ OldOpenRetry:
|
||||
being created */
|
||||
|
||||
/* BB FIXME BB */
|
||||
/* pSMB->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK); */
|
||||
/* pSMB->CreateOptions = cpu_to_le32(create_options &
|
||||
CREATE_OPTIONS_MASK); */
|
||||
/* BB FIXME END BB */
|
||||
|
||||
pSMB->Sattr = cpu_to_le16(ATTR_HIDDEN | ATTR_SYSTEM | ATTR_DIRECTORY);
|
||||
@@ -1296,10 +1294,9 @@ openRetry:
|
||||
}
|
||||
|
||||
int
|
||||
CIFSSMBRead(const int xid, struct cifsTconInfo *tcon,
|
||||
const int netfid, const unsigned int count,
|
||||
const __u64 lseek, unsigned int *nbytes, char **buf,
|
||||
int * pbuf_type)
|
||||
CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
|
||||
const unsigned int count, const __u64 lseek, unsigned int *nbytes,
|
||||
char **buf, int *pbuf_type)
|
||||
{
|
||||
int rc = -EACCES;
|
||||
READ_REQ *pSMB = NULL;
|
||||
@@ -1362,7 +1359,8 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon,
|
||||
/*check that DataLength would not go beyond end of SMB */
|
||||
if ((data_length > CIFSMaxBufSize)
|
||||
|| (data_length > count)) {
|
||||
cFYI(1,("bad length %d for count %d",data_length,count));
|
||||
cFYI(1, ("bad length %d for count %d",
|
||||
data_length, count));
|
||||
rc = -EIO;
|
||||
*nbytes = 0;
|
||||
} else {
|
||||
@@ -1440,7 +1438,7 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
|
||||
pSMB->WriteMode = 0;
|
||||
pSMB->Remaining = 0;
|
||||
|
||||
/* Can increase buffer size if buffer is big enough in some cases - ie we
|
||||
/* Can increase buffer size if buffer is big enough in some cases ie we
|
||||
can send more if LARGE_WRITE_X capability returned by the server and if
|
||||
our buffer is big enough or if we convert to iovecs on socket writes
|
||||
and eliminate the copy to the CIFS buffer */
|
||||
@@ -1478,7 +1476,8 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
|
||||
|
||||
if (wct == 14)
|
||||
pSMB->ByteCount = cpu_to_le16(byte_count);
|
||||
else { /* old style write has byte count 4 bytes earlier so 4 bytes pad */
|
||||
else { /* old style write has byte count 4 bytes earlier
|
||||
so 4 bytes pad */
|
||||
struct smb_com_writex_req *pSMBW =
|
||||
(struct smb_com_writex_req *)pSMB;
|
||||
pSMBW->ByteCount = cpu_to_le16(byte_count);
|
||||
@@ -1944,7 +1943,8 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
|
||||
dummy_string, 24, nls_codepage, remap);
|
||||
} else {
|
||||
len_of_str = cifsConvertToUCS((__le16 *)rename_info->target_name,
|
||||
target_name, PATH_MAX, nls_codepage, remap);
|
||||
target_name, PATH_MAX, nls_codepage,
|
||||
remap);
|
||||
}
|
||||
rename_info->target_name_len = cpu_to_le32(2 * len_of_str);
|
||||
count = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2;
|
||||
@@ -2005,7 +2005,8 @@ copyRetry:
|
||||
pSMB->OldFileName[name_len] = 0x04; /* pad */
|
||||
/* protocol requires ASCII signature byte on Unicode string */
|
||||
pSMB->OldFileName[name_len + 1] = 0x00;
|
||||
name_len2 = cifsConvertToUCS((__le16 *)&pSMB->OldFileName[name_len + 2],
|
||||
name_len2 =
|
||||
cifsConvertToUCS((__le16 *)&pSMB->OldFileName[name_len + 2],
|
||||
toName, PATH_MAX, nls_codepage, remap);
|
||||
name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
|
||||
name_len2 *= 2; /* convert to bytes */
|
||||
@@ -2313,9 +2314,8 @@ querySymLinkRetry:
|
||||
|
||||
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
|
||||
name_len =
|
||||
cifs_strtoUCS((__le16 *) pSMB->FileName, searchName, PATH_MAX
|
||||
/* find define for this maxpathcomponent */
|
||||
, nls_codepage);
|
||||
cifs_strtoUCS((__le16 *) pSMB->FileName, searchName,
|
||||
PATH_MAX, nls_codepage);
|
||||
name_len++; /* trailing null */
|
||||
name_len *= 2;
|
||||
} else { /* BB improve the check for buffer overruns BB */
|
||||
@@ -2370,8 +2370,8 @@ querySymLinkRetry:
|
||||
min_t(const int, buflen, count) / 2);
|
||||
/* BB FIXME investigate remapping reserved chars here */
|
||||
cifs_strfromUCS_le(symlinkinfo,
|
||||
(__le16 *) ((char *)&pSMBr->hdr.Protocol +
|
||||
data_offset),
|
||||
(__le16 *) ((char *)&pSMBr->hdr.Protocol
|
||||
+ data_offset),
|
||||
name_len, nls_codepage);
|
||||
} else {
|
||||
strncpy(symlinkinfo,
|
||||
@@ -2443,7 +2443,6 @@ validate_ntransact(char * buf, char ** ppparm, char ** ppdata,
|
||||
end_of_smb = 2 /* sizeof byte count */ + pSMBr->ByteCount +
|
||||
(char *)&pSMBr->ByteCount;
|
||||
|
||||
|
||||
data_offset = le32_to_cpu(pSMBr->DataOffset);
|
||||
data_count = le32_to_cpu(pSMBr->DataCount);
|
||||
parm_offset = le32_to_cpu(pSMBr->ParameterOffset);
|
||||
@@ -2464,7 +2463,8 @@ validate_ntransact(char * buf, char ** ppparm, char ** ppdata,
|
||||
return -EINVAL;
|
||||
} else if (data_count + *ppdata > end_of_smb) {
|
||||
cFYI(1,("data %p + count %d (%p) ends after end of smb %p start %p",
|
||||
*ppdata, data_count, (data_count + *ppdata), end_of_smb, pSMBr)); /* BB FIXME */
|
||||
*ppdata, data_count, (data_count + *ppdata),
|
||||
end_of_smb, pSMBr));
|
||||
return -EINVAL;
|
||||
} else if (parm_count + data_count > pSMBr->ByteCount) {
|
||||
cFYI(1, ("parm count and data count larger than SMB"));
|
||||
@@ -2527,8 +2527,10 @@ CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon,
|
||||
pSMBr->ByteCount +
|
||||
(char *)&pSMBr->ByteCount;
|
||||
|
||||
struct reparse_data * reparse_buf = (struct reparse_data *)
|
||||
((char *)&pSMBr->hdr.Protocol + data_offset);
|
||||
struct reparse_data *reparse_buf =
|
||||
(struct reparse_data *)
|
||||
((char *)&pSMBr->hdr.Protocol
|
||||
+ data_offset);
|
||||
if ((char *)reparse_buf >= end_of_smb) {
|
||||
rc = -EIO;
|
||||
goto qreparse_out;
|
||||
@@ -2546,15 +2548,18 @@ CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon,
|
||||
name_len = UniStrnlen((wchar_t *)
|
||||
(reparse_buf->LinkNamesBuf +
|
||||
reparse_buf->TargetNameOffset),
|
||||
min(buflen/2, reparse_buf->TargetNameLen / 2));
|
||||
min(buflen/2,
|
||||
reparse_buf->TargetNameLen / 2));
|
||||
cifs_strfromUCS_le(symlinkinfo,
|
||||
(__le16 *) (reparse_buf->LinkNamesBuf +
|
||||
reparse_buf->TargetNameOffset),
|
||||
name_len, nls_codepage);
|
||||
} else { /* ASCII names */
|
||||
strncpy(symlinkinfo,reparse_buf->LinkNamesBuf +
|
||||
strncpy(symlinkinfo,
|
||||
reparse_buf->LinkNamesBuf +
|
||||
reparse_buf->TargetNameOffset,
|
||||
min_t(const int, buflen, reparse_buf->TargetNameLen));
|
||||
min_t(const int, buflen,
|
||||
reparse_buf->TargetNameLen));
|
||||
}
|
||||
} else {
|
||||
rc = -EIO;
|
||||
@@ -2577,7 +2582,8 @@ qreparse_out:
|
||||
#ifdef CONFIG_CIFS_POSIX
|
||||
|
||||
/*Convert an Access Control Entry from wire format to local POSIX xattr format*/
|
||||
static void cifs_convert_ace(posix_acl_xattr_entry * ace, struct cifs_posix_ace * cifs_ace)
|
||||
static void cifs_convert_ace(posix_acl_xattr_entry *ace,
|
||||
struct cifs_posix_ace *cifs_ace)
|
||||
{
|
||||
/* u8 cifs fields do not need le conversion */
|
||||
ace->e_perm = cpu_to_le16(cifs_ace->cifs_e_perm);
|
||||
@@ -2609,7 +2615,8 @@ static int cifs_copy_posix_acl(char * trgt,char * src, const int buflen,
|
||||
size += sizeof(struct cifs_posix_ace) * count;
|
||||
/* check if we would go beyond end of SMB */
|
||||
if (size_of_data_area < size) {
|
||||
cFYI(1,("bad CIFS POSIX ACL size %d vs. %d",size_of_data_area,size));
|
||||
cFYI(1, ("bad CIFS POSIX ACL size %d vs. %d",
|
||||
size_of_data_area, size));
|
||||
return -EINVAL;
|
||||
}
|
||||
} else if (acl_type & ACL_TYPE_DEFAULT) {
|
||||
@@ -2661,8 +2668,8 @@ static __u16 convert_ace_to_cifs_ace(struct cifs_posix_ace * cifs_ace,
|
||||
}
|
||||
|
||||
/* Convert ACL from local Linux POSIX xattr to CIFS POSIX ACL wire format */
|
||||
static __u16 ACL_to_cifs_posix(char * parm_data,const char * pACL,const int buflen,
|
||||
const int acl_type)
|
||||
static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
|
||||
const int buflen, const int acl_type)
|
||||
{
|
||||
__u16 rc = 0;
|
||||
struct cifs_posix_acl *cifs_acl = (struct cifs_posix_acl *)parm_data;
|
||||
@@ -2753,7 +2760,8 @@ queryAclRetry:
|
||||
pSMB->Timeout = 0;
|
||||
pSMB->Reserved2 = 0;
|
||||
pSMB->ParameterOffset = cpu_to_le16(
|
||||
offsetof(struct smb_com_transaction2_qpi_req ,InformationLevel) - 4);
|
||||
offsetof(struct smb_com_transaction2_qpi_req,
|
||||
InformationLevel) - 4);
|
||||
pSMB->DataCount = 0;
|
||||
pSMB->DataOffset = 0;
|
||||
pSMB->SetupCount = 1;
|
||||
@@ -3015,12 +3023,12 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid,
|
||||
rc = validate_ntransact(iov[0].iov_base, (char **)&parm,
|
||||
(char **)&psec_desc,
|
||||
&parm_len, &data_len);
|
||||
|
||||
if (rc)
|
||||
goto qsec_out;
|
||||
pSMBr = (struct smb_com_ntransact_rsp *)iov[0].iov_base;
|
||||
|
||||
cERROR(1,("smb %p parm %p data %p",pSMBr,parm,psec_desc)); /* BB removeme BB */
|
||||
cERROR(1, ("smb %p parm %p data %p",
|
||||
pSMBr, parm, psec_desc)); /* BB removeme BB */
|
||||
|
||||
if (le32_to_cpu(pSMBr->ParameterCount) != 4) {
|
||||
rc = -EIO; /* bad smb */
|
||||
@@ -3186,7 +3194,8 @@ QPathInfoRetry:
|
||||
else if (!legacy && (pSMBr->ByteCount < 40))
|
||||
rc = -EIO; /* bad smb */
|
||||
else if (legacy && (pSMBr->ByteCount < 24))
|
||||
rc = -EIO; /* 24 or 26 expected but we do not read last field */
|
||||
rc = -EIO; /* 24 or 26 expected but we do not read
|
||||
last field */
|
||||
else if (pFindData) {
|
||||
int size;
|
||||
__u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
|
||||
@@ -3314,9 +3323,8 @@ findUniqueRetry:
|
||||
|
||||
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
|
||||
name_len =
|
||||
cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, PATH_MAX
|
||||
/* find define for this maxpathcomponent */
|
||||
, nls_codepage);
|
||||
cifsConvertToUCS((__le16 *) pSMB->FileName, searchName,
|
||||
PATH_MAX, nls_codepage);
|
||||
name_len++; /* trailing null */
|
||||
name_len *= 2;
|
||||
} else { /* BB improve the check for buffer overruns BB */
|
||||
@@ -3496,7 +3504,8 @@ findFirstRetry:
|
||||
else
|
||||
psrch_inf->endOfSearch = FALSE;
|
||||
|
||||
psrch_inf->entries_in_buffer = le16_to_cpu(parms->SearchCount);
|
||||
psrch_inf->entries_in_buffer =
|
||||
le16_to_cpu(parms->SearchCount);
|
||||
psrch_inf->index_of_last_entry = 2 /* skip . and .. */ +
|
||||
psrch_inf->entries_in_buffer;
|
||||
*pnetfid = parms->SearchHandle;
|
||||
@@ -3534,7 +3543,8 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
|
||||
pSMB->TotalDataCount = 0; /* no EAs */
|
||||
pSMB->MaxParameterCount = cpu_to_le16(8);
|
||||
pSMB->MaxDataCount =
|
||||
cpu_to_le16((tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00);
|
||||
cpu_to_le16((tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) &
|
||||
0xFFFFFF00);
|
||||
pSMB->MaxSetupCount = 0;
|
||||
pSMB->Reserved = 0;
|
||||
pSMB->Flags = 0;
|
||||
@@ -3588,7 +3598,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
|
||||
if (rc) {
|
||||
if (rc == -EBADF) {
|
||||
psrch_inf->endOfSearch = TRUE;
|
||||
rc = 0; /* search probably was closed at end of search above */
|
||||
rc = 0; /* search probably was closed at end of search*/
|
||||
} else
|
||||
cFYI(1, ("FindNext returned = %d", rc));
|
||||
} else { /* decode response */
|
||||
@@ -3617,11 +3627,12 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
|
||||
psrch_inf->endOfSearch = TRUE;
|
||||
else
|
||||
psrch_inf->endOfSearch = FALSE;
|
||||
|
||||
psrch_inf->entries_in_buffer = le16_to_cpu(parms->SearchCount);
|
||||
psrch_inf->entries_in_buffer =
|
||||
le16_to_cpu(parms->SearchCount);
|
||||
psrch_inf->index_of_last_entry +=
|
||||
psrch_inf->entries_in_buffer;
|
||||
/* cFYI(1,("fnxt2 entries in buf %d index_of_last %d",psrch_inf->entries_in_buffer,psrch_inf->index_of_last_entry)); */
|
||||
/* cFYI(1,("fnxt2 entries in buf %d index_of_last %d",
|
||||
psrch_inf->entries_in_buffer, psrch_inf->index_of_last_entry)); */
|
||||
|
||||
/* BB fixme add unlock here */
|
||||
}
|
||||
@@ -3636,12 +3647,12 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
|
||||
FNext2_err_exit:
|
||||
if (rc != 0)
|
||||
cifs_buf_release(pSMB);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
CIFSFindClose(const int xid, struct cifsTconInfo *tcon, const __u16 searchHandle)
|
||||
CIFSFindClose(const int xid, struct cifsTconInfo *tcon,
|
||||
const __u16 searchHandle)
|
||||
{
|
||||
int rc = 0;
|
||||
FINDCLOSE_REQ *pSMB = NULL;
|
||||
@@ -3698,7 +3709,6 @@ GetInodeNumberRetry:
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
|
||||
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
|
||||
name_len =
|
||||
cifsConvertToUCS((__le16 *) pSMB->FileName, searchName,
|
||||
@@ -3863,14 +3873,15 @@ getDFSRetry:
|
||||
/* BB Add logic to parse referrals here */
|
||||
rc = validate_t2((struct smb_t2_rsp *)pSMBr);
|
||||
|
||||
if (rc || (pSMBr->ByteCount < 17)) /* BB also check enough total bytes returned */
|
||||
/* BB Also check if enough total bytes returned? */
|
||||
if (rc || (pSMBr->ByteCount < 17))
|
||||
rc = -EIO; /* bad smb */
|
||||
else {
|
||||
__u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
|
||||
__u16 data_count = le16_to_cpu(pSMBr->t2.DataCount);
|
||||
|
||||
cFYI(1,
|
||||
("Decoding GetDFSRefer response. BCC: %d Offset %d",
|
||||
("Decoding GetDFSRefer response BCC: %d Offset %d",
|
||||
pSMBr->ByteCount, data_offset));
|
||||
referrals =
|
||||
(struct dfs_referral_level_3 *)
|
||||
@@ -3878,11 +3889,17 @@ getDFSRetry:
|
||||
data_offset +
|
||||
(char *) &pSMBr->hdr.Protocol);
|
||||
cFYI(1,("num_referrals: %d dfs flags: 0x%x ... \nfor referral one refer size: 0x%x srv type: 0x%x refer flags: 0x%x ttl: 0x%x",
|
||||
le16_to_cpu(pSMBr->NumberOfReferrals),le16_to_cpu(pSMBr->DFSFlags), le16_to_cpu(referrals->ReferralSize),le16_to_cpu(referrals->ServerType),le16_to_cpu(referrals->ReferralFlags),le16_to_cpu(referrals->TimeToLive)));
|
||||
le16_to_cpu(pSMBr->NumberOfReferrals),
|
||||
le16_to_cpu(pSMBr->DFSFlags),
|
||||
le16_to_cpu(referrals->ReferralSize),
|
||||
le16_to_cpu(referrals->ServerType),
|
||||
le16_to_cpu(referrals->ReferralFlags),
|
||||
le16_to_cpu(referrals->TimeToLive)));
|
||||
/* BB This field is actually two bytes in from start of
|
||||
data block so we could do safety check that DataBlock
|
||||
begins at address of pSMBr->NumberOfReferrals */
|
||||
*number_of_UNC_in_array = le16_to_cpu(pSMBr->NumberOfReferrals);
|
||||
*number_of_UNC_in_array =
|
||||
le16_to_cpu(pSMBr->NumberOfReferrals);
|
||||
|
||||
/* BB Fix below so can return more than one referral */
|
||||
if (*number_of_UNC_in_array > 1)
|
||||
@@ -3892,7 +3909,8 @@ getDFSRetry:
|
||||
name_len = 0;
|
||||
for (i = 0; i < *number_of_UNC_in_array; i++) {
|
||||
/* make sure that DfsPathOffset not past end */
|
||||
__u16 offset = le16_to_cpu(referrals->DfsPathOffset);
|
||||
__u16 offset =
|
||||
le16_to_cpu(referrals->DfsPathOffset);
|
||||
if (offset > data_count) {
|
||||
/* if invalid referral, stop here and do
|
||||
not try to copy any more */
|
||||
@@ -3902,33 +3920,36 @@ getDFSRetry:
|
||||
temp = ((char *)referrals) + offset;
|
||||
|
||||
if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) {
|
||||
name_len += UniStrnlen((wchar_t *)temp,data_count);
|
||||
name_len += UniStrnlen((wchar_t *)temp,
|
||||
data_count);
|
||||
} else {
|
||||
name_len += strnlen(temp, data_count);
|
||||
}
|
||||
referrals++;
|
||||
/* BB add check that referral pointer does not fall off end PDU */
|
||||
|
||||
/* BB add check that referral pointer does
|
||||
not fall off end PDU */
|
||||
}
|
||||
/* BB add check for name_len bigger than bcc */
|
||||
*targetUNCs =
|
||||
kmalloc(name_len+1+ (*number_of_UNC_in_array),GFP_KERNEL);
|
||||
kmalloc(name_len+1+(*number_of_UNC_in_array),
|
||||
GFP_KERNEL);
|
||||
if (*targetUNCs == NULL) {
|
||||
rc = -ENOMEM;
|
||||
goto GetDFSRefExit;
|
||||
}
|
||||
/* copy the ref strings */
|
||||
referrals =
|
||||
(struct dfs_referral_level_3 *)
|
||||
(8 /* sizeof data hdr */ +
|
||||
data_offset +
|
||||
referrals = (struct dfs_referral_level_3 *)
|
||||
(8 /* sizeof data hdr */ + data_offset +
|
||||
(char *) &pSMBr->hdr.Protocol);
|
||||
|
||||
for (i = 0; i < *number_of_UNC_in_array; i++) {
|
||||
temp = ((char *)referrals) + le16_to_cpu(referrals->DfsPathOffset);
|
||||
temp = ((char *)referrals) +
|
||||
le16_to_cpu(referrals->DfsPathOffset);
|
||||
if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) {
|
||||
cifs_strfromUCS_le(*targetUNCs,
|
||||
(__le16 *) temp, name_len, nls_codepage);
|
||||
(__le16 *) temp,
|
||||
name_len,
|
||||
nls_codepage);
|
||||
} else {
|
||||
strncpy(*targetUNCs, temp, name_len);
|
||||
}
|
||||
@@ -4010,8 +4031,7 @@ oldQFSInfoRetry:
|
||||
cFYI(1, ("qfsinf resp BCC: %d Offset %d",
|
||||
pSMBr->ByteCount, data_offset));
|
||||
|
||||
response_data =
|
||||
(FILE_SYSTEM_ALLOC_INFO *)
|
||||
response_data = (FILE_SYSTEM_ALLOC_INFO *)
|
||||
(((char *) &pSMBr->hdr.Protocol) + data_offset);
|
||||
FSData->f_bsize =
|
||||
le16_to_cpu(response_data->BytesPerSector) *
|
||||
@@ -4164,7 +4184,8 @@ QFSAttributeRetry:
|
||||
} else { /* decode response */
|
||||
rc = validate_t2((struct smb_t2_rsp *)pSMBr);
|
||||
|
||||
if (rc || (pSMBr->ByteCount < 13)) { /* BB also check enough bytes returned */
|
||||
if (rc || (pSMBr->ByteCount < 13)) {
|
||||
/* BB also check if enough bytes returned */
|
||||
rc = -EIO; /* bad smb */
|
||||
} else {
|
||||
__u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
|
||||
@@ -4346,7 +4367,8 @@ SETFSUnixRetry:
|
||||
pSMB->Flags = 0;
|
||||
pSMB->Timeout = 0;
|
||||
pSMB->Reserved2 = 0;
|
||||
param_offset = offsetof(struct smb_com_transaction2_setfsi_req, FileNum) - 4;
|
||||
param_offset = offsetof(struct smb_com_transaction2_setfsi_req, FileNum)
|
||||
- 4;
|
||||
offset = param_offset + params;
|
||||
|
||||
pSMB->MaxParameterCount = cpu_to_le16(4);
|
||||
@@ -4625,8 +4647,8 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
|
||||
pSMB->TotalParameterCount = pSMB->ParameterCount;
|
||||
pSMB->ParameterOffset = cpu_to_le16(param_offset);
|
||||
parm_data =
|
||||
(struct file_end_of_file_info *) (((char *) &pSMB->hdr.Protocol) +
|
||||
offset);
|
||||
(struct file_end_of_file_info *) (((char *) &pSMB->hdr.Protocol)
|
||||
+ offset);
|
||||
pSMB->DataOffset = cpu_to_le16(offset);
|
||||
parm_data->FileSize = cpu_to_le64(size);
|
||||
pSMB->Fid = fid;
|
||||
@@ -4672,8 +4694,8 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
|
||||
time and resort to the original setpathinfo level which takes the ancient
|
||||
DOS time format with 2 second granularity */
|
||||
int
|
||||
CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, const FILE_BASIC_INFO * data,
|
||||
__u16 fid)
|
||||
CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
|
||||
const FILE_BASIC_INFO *data, __u16 fid)
|
||||
{
|
||||
struct smb_com_transaction2_sfi_req *pSMB = NULL;
|
||||
struct smb_com_transaction2_sfi_rsp *pSMBr = NULL;
|
||||
@@ -5166,7 +5188,8 @@ QAllEAsRetry:
|
||||
if (rc < (int)buf_size) {
|
||||
memcpy(EAData, "user.", 5);
|
||||
EAData += 5;
|
||||
memcpy(EAData,temp_ptr,temp_fea->name_len);
|
||||
memcpy(EAData, temp_ptr,
|
||||
temp_fea->name_len);
|
||||
EAData += temp_fea->name_len;
|
||||
/* null terminate name */
|
||||
*EAData = 0;
|
||||
@@ -5183,11 +5206,15 @@ QAllEAsRetry:
|
||||
/* account for trailing null */
|
||||
name_len--;
|
||||
temp_ptr++;
|
||||
value_len = le16_to_cpu(temp_fea->value_len);
|
||||
value_len =
|
||||
le16_to_cpu(temp_fea->value_len);
|
||||
name_len -= value_len;
|
||||
temp_ptr += value_len;
|
||||
/* BB check that temp_ptr is still within smb BB*/
|
||||
/* no trailing null to account for in value len */
|
||||
/* BB check that temp_ptr is still
|
||||
within the SMB BB*/
|
||||
|
||||
/* no trailing null to account for
|
||||
in value len */
|
||||
/* go on to next EA */
|
||||
temp_fea = (struct fea *)temp_ptr;
|
||||
}
|
||||
@@ -5305,7 +5332,8 @@ QEARetry:
|
||||
__u16 value_len;
|
||||
name_len -= 4;
|
||||
temp_ptr += 4;
|
||||
value_len = le16_to_cpu(temp_fea->value_len);
|
||||
value_len =
|
||||
le16_to_cpu(temp_fea->value_len);
|
||||
/* BB validate that value_len falls within SMB,
|
||||
even though maximum for name_len is 255 */
|
||||
if (memcmp(temp_fea->name, ea_name,
|
||||
@@ -5317,8 +5345,9 @@ QEARetry:
|
||||
memcpy(ea_value,
|
||||
temp_fea->name+temp_fea->name_len+1,
|
||||
rc);
|
||||
/* ea values, unlike ea names,
|
||||
are not null terminated */
|
||||
/* ea values, unlike ea
|
||||
names, are not null
|
||||
terminated */
|
||||
} else if (buf_size == 0) {
|
||||
/* skip copy - calc size only */
|
||||
} else {
|
||||
@@ -5334,8 +5363,8 @@ QEARetry:
|
||||
temp_ptr++;
|
||||
name_len -= value_len;
|
||||
temp_ptr += value_len;
|
||||
/* no trailing null to account for in value len */
|
||||
/* go on to next EA */
|
||||
/* No trailing null to account for in
|
||||
value_len. Go on to next EA */
|
||||
temp_fea = (struct fea *)temp_ptr;
|
||||
}
|
||||
}
|
||||
@@ -5428,10 +5457,12 @@ SetEARetry:
|
||||
/* caller ensures that ea_value_len is less than 64K but
|
||||
we need to ensure that it fits within the smb */
|
||||
|
||||
/*BB add length check that it would fit in negotiated SMB buffer size BB */
|
||||
/*BB add length check to see if it would fit in
|
||||
negotiated SMB buffer size BB */
|
||||
/* if (ea_value_len > buffer_size - 512 (enough for header)) */
|
||||
if (ea_value_len)
|
||||
memcpy(parm_data->list[0].name+name_len+1,ea_value,ea_value_len);
|
||||
memcpy(parm_data->list[0].name+name_len+1,
|
||||
ea_value, ea_value_len);
|
||||
|
||||
pSMB->TotalDataCount = pSMB->DataCount;
|
||||
pSMB->ParameterCount = cpu_to_le16(params);
|
||||
|
@@ -637,7 +637,8 @@ multi_t2_fnd:
|
||||
wake_up_process(task_to_wake);
|
||||
} else if ((is_valid_oplock_break(smb_buffer, server) == FALSE)
|
||||
&& (isMultiRsp == FALSE)) {
|
||||
cERROR(1, ("No task to wake, unknown frame rcvd! NumMids %d", midCount.counter));
|
||||
cERROR(1, ("No task to wake, unknown frame received! "
|
||||
"NumMids %d", midCount.counter));
|
||||
cifs_dump_mem("Received Data is: ", (char *)smb_buffer,
|
||||
sizeof(struct smb_hdr));
|
||||
#ifdef CONFIG_CIFS_DEBUG2
|
||||
@@ -708,8 +709,8 @@ multi_t2_fnd:
|
||||
list_for_each(tmp, &server->pending_mid_q) {
|
||||
mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
|
||||
if (mid_entry->midState == MID_REQUEST_SUBMITTED) {
|
||||
cFYI(1,
|
||||
("Clearing Mid 0x%x - waking up ",mid_entry->mid));
|
||||
cFYI(1, ("Clearing Mid 0x%x - waking up ",
|
||||
mid_entry->mid));
|
||||
task_to_wake = mid_entry->tsk;
|
||||
if (task_to_wake) {
|
||||
wake_up_process(task_to_wake);
|
||||
@@ -763,7 +764,8 @@ multi_t2_fnd:
|
||||
}
|
||||
|
||||
static int
|
||||
cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
cifs_parse_mount_options(char *options, const char *devname,
|
||||
struct smb_vol *vol)
|
||||
{
|
||||
char *value;
|
||||
char *data;
|
||||
@@ -819,7 +821,8 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
if ((value = strchr(data, '=')) != NULL)
|
||||
*value++ = '\0';
|
||||
|
||||
if (strnicmp(data, "user_xattr",10) == 0) {/*parse before user*/
|
||||
/* Have to parse this before we parse for "user" */
|
||||
if (strnicmp(data, "user_xattr", 10) == 0) {
|
||||
vol->no_xattr = 0;
|
||||
} else if (strnicmp(data, "nouser_xattr", 12) == 0) {
|
||||
vol->no_xattr = 1;
|
||||
@@ -870,7 +873,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
(value[temp_len+1] == separator[0])) {
|
||||
/* reinsert comma */
|
||||
value[temp_len] = separator[0];
|
||||
temp_len+=2; /* move after the second comma */
|
||||
temp_len += 2; /* move after second comma */
|
||||
while (value[temp_len] != 0) {
|
||||
if (value[temp_len] == separator[0]) {
|
||||
if (value[temp_len+1] ==
|
||||
@@ -897,7 +900,8 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
allocating a few bytes too many, which is ok */
|
||||
vol->password = kzalloc(temp_len, GFP_KERNEL);
|
||||
if (vol->password == NULL) {
|
||||
printk("CIFS: no memory for pass\n");
|
||||
printk(KERN_WARNING "CIFS: no memory "
|
||||
"for password\n");
|
||||
return 1;
|
||||
}
|
||||
for (i = 0, j = 0; i < temp_len; i++, j++) {
|
||||
@@ -912,7 +916,8 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
} else {
|
||||
vol->password = kzalloc(temp_len+1, GFP_KERNEL);
|
||||
if (vol->password == NULL) {
|
||||
printk("CIFS: no memory for pass\n");
|
||||
printk(KERN_WARNING "CIFS: no memory "
|
||||
"for password\n");
|
||||
return 1;
|
||||
}
|
||||
strcpy(vol->password, value);
|
||||
@@ -923,7 +928,8 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
} else if (strnlen(value, 35) < 35) {
|
||||
vol->UNCip = value;
|
||||
} else {
|
||||
printk(KERN_WARNING "CIFS: ip address too long\n");
|
||||
printk(KERN_WARNING "CIFS: ip address "
|
||||
"too long\n");
|
||||
return 1;
|
||||
}
|
||||
} else if (strnicmp(data, "sec", 3) == 0) {
|
||||
@@ -968,8 +974,8 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
|| (strnicmp(data, "target", 6) == 0)
|
||||
|| (strnicmp(data, "path", 4) == 0)) {
|
||||
if (!value || !*value) {
|
||||
printk(KERN_WARNING
|
||||
"CIFS: invalid path to network resource\n");
|
||||
printk(KERN_WARNING "CIFS: invalid path to "
|
||||
"network resource\n");
|
||||
return 1; /* needs_arg; */
|
||||
}
|
||||
if ((temp_len = strnlen(value, 300)) < 300) {
|
||||
@@ -982,7 +988,8 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
vol->UNC[1] = '\\';
|
||||
} else if (strncmp(vol->UNC, "\\\\", 2) != 0) {
|
||||
printk(KERN_WARNING
|
||||
"CIFS: UNC Path does not begin with // or \\\\ \n");
|
||||
"CIFS: UNC Path does not begin "
|
||||
"with // or \\\\ \n");
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
@@ -1001,14 +1008,15 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
vol->domainname = value;
|
||||
cFYI(1, ("Domain name set"));
|
||||
} else {
|
||||
printk(KERN_WARNING "CIFS: domain name too long\n");
|
||||
printk(KERN_WARNING "CIFS: domain name too "
|
||||
"long\n");
|
||||
return 1;
|
||||
}
|
||||
} else if (strnicmp(data, "prefixpath", 10) == 0) {
|
||||
if (!value || !*value) {
|
||||
printk(KERN_WARNING
|
||||
"CIFS: invalid path prefix\n");
|
||||
return 1; /* needs_arg; */
|
||||
return 1; /* needs_argument */
|
||||
}
|
||||
if ((temp_len = strnlen(value, 1024)) < 1024) {
|
||||
if (value[0] != '/')
|
||||
@@ -1034,7 +1042,8 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
if (strnlen(value, 65) < 65) {
|
||||
if (strnicmp(value, "default", 7))
|
||||
vol->iocharset = value;
|
||||
/* if iocharset not set load_nls_default used by caller */
|
||||
/* if iocharset not set then load_nls_default
|
||||
is used by caller */
|
||||
cFYI(1, ("iocharset set to %s", value));
|
||||
} else {
|
||||
printk(KERN_WARNING "CIFS: iocharset name too long.\n");
|
||||
@@ -1101,12 +1110,14 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
if (value[i] == 0)
|
||||
break;
|
||||
else
|
||||
vol->source_rfc1001_name[i] = value[i];
|
||||
vol->source_rfc1001_name[i] =
|
||||
value[i];
|
||||
}
|
||||
/* The string has 16th byte zero still from
|
||||
set at top of the function */
|
||||
if ((i == 15) && (value[i] != 0))
|
||||
printk(KERN_WARNING "CIFS: netbiosname longer than 15 truncated.\n");
|
||||
printk(KERN_WARNING "CIFS: netbiosname"
|
||||
" longer than 15 truncated.\n");
|
||||
}
|
||||
} else if (strnicmp(data, "servern", 7) == 0) {
|
||||
/* servernetbiosname specified override *SMBSERVER */
|
||||
@@ -1118,19 +1129,22 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
|
||||
for (i = 0; i < 15; i++) {
|
||||
/* BB are there cases in which a comma can be
|
||||
valid in this workstation netbios name (and need
|
||||
special handling)? */
|
||||
valid in this workstation netbios name
|
||||
(and need special handling)? */
|
||||
|
||||
/* user or mount helper must uppercase netbiosname */
|
||||
/* user or mount helper must uppercase
|
||||
the netbiosname */
|
||||
if (value[i] == 0)
|
||||
break;
|
||||
else
|
||||
vol->target_rfc1001_name[i] = value[i];
|
||||
vol->target_rfc1001_name[i] =
|
||||
value[i];
|
||||
}
|
||||
/* The string has 16th byte zero still from
|
||||
set at top of the function */
|
||||
if ((i == 15) && (value[i] != 0))
|
||||
printk(KERN_WARNING "CIFS: server netbiosname longer than 15 truncated.\n");
|
||||
printk(KERN_WARNING "CIFS: server net"
|
||||
"biosname longer than 15 truncated.\n");
|
||||
}
|
||||
} else if (strnicmp(data, "credentials", 4) == 0) {
|
||||
/* ignore */
|
||||
@@ -1187,7 +1201,8 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
/* turn off mandatory locking in mode
|
||||
if remote locking is turned off since the
|
||||
local vfs will do advisory */
|
||||
if (vol->file_mode == (S_IALLUGO & ~(S_ISUID | S_IXGRP)))
|
||||
if (vol->file_mode ==
|
||||
(S_IALLUGO & ~(S_ISUID | S_IXGRP)))
|
||||
vol->file_mode = S_IALLUGO;
|
||||
} else if (strnicmp(data, "setuids", 7) == 0) {
|
||||
vol->setuids = 1;
|
||||
@@ -1227,17 +1242,22 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
} else if (strnlen(value, 49) == 48) {
|
||||
vol->in6_addr = value;
|
||||
} else {
|
||||
printk(KERN_WARNING "CIFS: ip v6 address not 48 characters long\n");
|
||||
printk(KERN_WARNING "CIFS: ip v6 address not "
|
||||
"48 characters long\n");
|
||||
return 1;
|
||||
}
|
||||
} else if (strnicmp(data, "noac", 4) == 0) {
|
||||
printk(KERN_WARNING "CIFS: Mount option noac not supported. Instead set /proc/fs/cifs/LookupCacheEnabled to 0\n");
|
||||
printk(KERN_WARNING "CIFS: Mount option noac not "
|
||||
"supported. Instead set "
|
||||
"/proc/fs/cifs/LookupCacheEnabled to 0\n");
|
||||
} else
|
||||
printk(KERN_WARNING "CIFS: Unknown mount option %s\n",data);
|
||||
printk(KERN_WARNING "CIFS: Unknown mount option %s\n",
|
||||
data);
|
||||
}
|
||||
if (vol->UNC == NULL) {
|
||||
if (devname == NULL) {
|
||||
printk(KERN_WARNING "CIFS: Missing UNC name for mount target\n");
|
||||
printk(KERN_WARNING "CIFS: Missing UNC name for mount "
|
||||
"target\n");
|
||||
return 1;
|
||||
}
|
||||
if ((temp_len = strnlen(devname, 300)) < 300) {
|
||||
@@ -1249,7 +1269,8 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
|
||||
vol->UNC[0] = '\\';
|
||||
vol->UNC[1] = '\\';
|
||||
} else if (strncmp(vol->UNC, "\\\\", 2) != 0) {
|
||||
printk(KERN_WARNING "CIFS: UNC Path does not begin with // or \\\\ \n");
|
||||
printk(KERN_WARNING "CIFS: UNC Path does not "
|
||||
"begin with // or \\\\ \n");
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
@@ -1281,14 +1302,20 @@ cifs_find_tcp_session(struct in_addr * target_ip_addr,
|
||||
== target_ip_addr->s_addr)) || (target_ip6_addr
|
||||
&& memcmp(&ses->server->addr.sockAddr6.sin6_addr,
|
||||
target_ip6_addr, sizeof(*target_ip6_addr)))) {
|
||||
/* BB lock server and tcp session and increment use count here?? */
|
||||
*psrvTcp = ses->server; /* found a match on the TCP session */
|
||||
/* BB lock server and tcp session and increment
|
||||
use count here?? */
|
||||
|
||||
/* found a match on the TCP session */
|
||||
*psrvTcp = ses->server;
|
||||
|
||||
/* BB check if reconnection needed */
|
||||
if (strncmp
|
||||
(ses->userName, userName,
|
||||
MAX_USERNAME_SIZE) == 0){
|
||||
read_unlock(&GlobalSMBSeslock);
|
||||
return ses; /* found exact match on both tcp and SMB sessions */
|
||||
/* Found exact match on both TCP and
|
||||
SMB sessions */
|
||||
return ses;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1319,7 +1346,8 @@ find_unc(__be32 new_target_ip_addr, char *uncName, char *userName)
|
||||
/* BB lock tcon, server and tcp session and increment use count here? */
|
||||
/* found a match on the TCP session */
|
||||
/* BB check if reconnection needed */
|
||||
cFYI(1, ("IP match, old UNC: %s new: %s",
|
||||
cFYI(1,
|
||||
("IP match, old UNC: %s new: %s",
|
||||
tcon->treeName, uncName));
|
||||
if (strncmp
|
||||
(tcon->treeName, uncName,
|
||||
@@ -1367,9 +1395,8 @@ connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
|
||||
}
|
||||
|
||||
int
|
||||
get_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
|
||||
const char *old_path, const struct nls_table *nls_codepage,
|
||||
unsigned int *pnum_referrals,
|
||||
get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path,
|
||||
const struct nls_table *nls_codepage, unsigned int *pnum_referrals,
|
||||
unsigned char **preferrals, int remap)
|
||||
{
|
||||
char *temp_unc;
|
||||
@@ -1379,7 +1406,8 @@ get_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
|
||||
|
||||
if (pSesInfo->ipc_tid == 0) {
|
||||
temp_unc = kmalloc(2 /* for slashes */ +
|
||||
strnlen(pSesInfo->serverName,SERVER_NAME_LEN_WITH_NULL * 2)
|
||||
strnlen(pSesInfo->serverName,
|
||||
SERVER_NAME_LEN_WITH_NULL * 2)
|
||||
+ 1 + 4 /* slash IPC$ */ + 2,
|
||||
GFP_KERNEL);
|
||||
if (temp_unc == NULL)
|
||||
@@ -1424,7 +1452,8 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
|
||||
__be16 orig_port = 0;
|
||||
|
||||
if (*csocket == NULL) {
|
||||
rc = sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, csocket);
|
||||
rc = sock_create_kern(PF_INET, SOCK_STREAM,
|
||||
IPPROTO_TCP, csocket);
|
||||
if (rc < 0) {
|
||||
cERROR(1, ("Error %d creating socket", rc));
|
||||
*csocket = NULL;
|
||||
@@ -1464,7 +1493,8 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
|
||||
if (!connected) {
|
||||
psin_server->sin_port = htons(RFC1001_PORT);
|
||||
rc = (*csocket)->ops->connect(*csocket, (struct sockaddr *)
|
||||
psin_server, sizeof (struct sockaddr_in),0);
|
||||
psin_server,
|
||||
sizeof (struct sockaddr_in), 0);
|
||||
if (rc >= 0)
|
||||
connected = 1;
|
||||
}
|
||||
@@ -1482,7 +1512,8 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
|
||||
/* Eventually check for other socket options to change from
|
||||
the default. sock_setsockopt not used because it expects
|
||||
user space buffer */
|
||||
cFYI(1, ("sndbuf %d rcvbuf %d rcvtimeo 0x%lx",(*csocket)->sk->sk_sndbuf,
|
||||
cFYI(1, ("sndbuf %d rcvbuf %d rcvtimeo 0x%lx",
|
||||
(*csocket)->sk->sk_sndbuf,
|
||||
(*csocket)->sk->sk_rcvbuf, (*csocket)->sk->sk_rcvtimeo));
|
||||
(*csocket)->sk->sk_rcvtimeo = 7 * HZ;
|
||||
/* make the bufsizes depend on wsize/rsize and max requests */
|
||||
@@ -1498,7 +1529,8 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
|
||||
sessinit is sent but no second negprot */
|
||||
struct rfc1002_session_packet *ses_init_buf;
|
||||
struct smb_hdr *smb_buf;
|
||||
ses_init_buf = kzalloc(sizeof(struct rfc1002_session_packet), GFP_KERNEL);
|
||||
ses_init_buf = kzalloc(sizeof(struct rfc1002_session_packet),
|
||||
GFP_KERNEL);
|
||||
if (ses_init_buf) {
|
||||
ses_init_buf->trailer.session_req.called_len = 32;
|
||||
if (target_name && (target_name[0] != 0)) {
|
||||
@@ -1552,7 +1584,8 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
|
||||
__be16 orig_port = 0;
|
||||
|
||||
if (*csocket == NULL) {
|
||||
rc = sock_create_kern(PF_INET6, SOCK_STREAM, IPPROTO_TCP, csocket);
|
||||
rc = sock_create_kern(PF_INET6, SOCK_STREAM,
|
||||
IPPROTO_TCP, csocket);
|
||||
if (rc < 0) {
|
||||
cERROR(1, ("Error %d creating ipv6 socket", rc));
|
||||
*csocket = NULL;
|
||||
@@ -1753,11 +1786,13 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
|
||||
}
|
||||
|
||||
if (volume_info.UNCip && volume_info.UNC) {
|
||||
rc = cifs_inet_pton(AF_INET, volume_info.UNCip,&sin_server.sin_addr.s_addr);
|
||||
rc = cifs_inet_pton(AF_INET, volume_info.UNCip,
|
||||
&sin_server.sin_addr.s_addr);
|
||||
|
||||
if (rc <= 0) {
|
||||
/* not ipv4 address, try ipv6 */
|
||||
rc = cifs_inet_pton(AF_INET6,volume_info.UNCip,&sin_server6.sin6_addr.in6_u);
|
||||
rc = cifs_inet_pton(AF_INET6, volume_info.UNCip,
|
||||
&sin_server6.sin6_addr.in6_u);
|
||||
if (rc > 0)
|
||||
address_type = AF_INET6;
|
||||
} else {
|
||||
@@ -1777,7 +1812,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
|
||||
/* success */
|
||||
rc = 0;
|
||||
} else if (volume_info.UNCip) {
|
||||
/* BB using ip addr as server name connect to the DFS root below */
|
||||
/* BB using ip addr as server name to connect to the
|
||||
DFS root below */
|
||||
cERROR(1, ("Connecting to DFS root not implemented yet"));
|
||||
kfree(volume_info.UNC);
|
||||
kfree(volume_info.password);
|
||||
@@ -1786,7 +1822,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
|
||||
return -EINVAL;
|
||||
} else /* which servers DFS root would we conect to */ {
|
||||
cERROR(1,
|
||||
("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified"));
|
||||
("CIFS mount error: No UNC path (e.g. -o "
|
||||
"unc=//192.168.1.100/public) specified"));
|
||||
kfree(volume_info.UNC);
|
||||
kfree(volume_info.password);
|
||||
kfree(volume_info.prepath);
|
||||
@@ -1801,7 +1838,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
|
||||
} else {
|
||||
cifs_sb->local_nls = load_nls(volume_info.iocharset);
|
||||
if (cifs_sb->local_nls == NULL) {
|
||||
cERROR(1,("CIFS mount error: iocharset %s not found",volume_info.iocharset));
|
||||
cERROR(1, ("CIFS mount error: iocharset %s not found",
|
||||
volume_info.iocharset));
|
||||
kfree(volume_info.UNC);
|
||||
kfree(volume_info.password);
|
||||
kfree(volume_info.prepath);
|
||||
@@ -1827,7 +1865,6 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
if (srvTcp) {
|
||||
cFYI(1, ("Existing tcp session with server found"));
|
||||
} else { /* create socket */
|
||||
@@ -1845,8 +1882,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
|
||||
volume_info.source_rfc1001_name,
|
||||
volume_info.target_rfc1001_name);
|
||||
if (rc < 0) {
|
||||
cERROR(1,
|
||||
("Error connecting to IPv4 socket. Aborting operation"));
|
||||
cERROR(1, ("Error connecting to IPv4 socket. "
|
||||
"Aborting operation"));
|
||||
if (csocket != NULL)
|
||||
sock_release(csocket);
|
||||
kfree(volume_info.UNC);
|
||||
@@ -1867,7 +1904,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
|
||||
return rc;
|
||||
} else {
|
||||
memset(srvTcp, 0, sizeof (struct TCP_Server_Info));
|
||||
memcpy(&srvTcp->addr.sockAddr, &sin_server, sizeof (struct sockaddr_in));
|
||||
memcpy(&srvTcp->addr.sockAddr, &sin_server,
|
||||
sizeof (struct sockaddr_in));
|
||||
atomic_set(&srvTcp->inFlight, 0);
|
||||
/* BB Add code for ipv6 case too */
|
||||
srvTcp->ssocket = csocket;
|
||||
@@ -1894,8 +1932,10 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
|
||||
}
|
||||
wait_for_completion(&cifsd_complete);
|
||||
rc = 0;
|
||||
memcpy(srvTcp->workstation_RFC1001_name, volume_info.source_rfc1001_name,16);
|
||||
memcpy(srvTcp->server_RFC1001_name, volume_info.target_rfc1001_name,16);
|
||||
memcpy(srvTcp->workstation_RFC1001_name,
|
||||
volume_info.source_rfc1001_name, 16);
|
||||
memcpy(srvTcp->server_RFC1001_name,
|
||||
volume_info.target_rfc1001_name, 16);
|
||||
srvTcp->sequence_number = 0;
|
||||
}
|
||||
}
|
||||
@@ -1922,7 +1962,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
|
||||
pSesInfo->password = volume_info.password;
|
||||
if (volume_info.username)
|
||||
strncpy(pSesInfo->userName,
|
||||
volume_info.username,MAX_USERNAME_SIZE);
|
||||
volume_info.username,
|
||||
MAX_USERNAME_SIZE);
|
||||
if (volume_info.domainname) {
|
||||
int len = strlen(volume_info.domainname);
|
||||
pSesInfo->domainName =
|
||||
@@ -1935,7 +1976,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
|
||||
pSesInfo->overrideSecFlg = volume_info.secFlg;
|
||||
down(&pSesInfo->sesSem);
|
||||
/* BB FIXME need to pass vol->secFlgs BB */
|
||||
rc = cifs_setup_session(xid,pSesInfo, cifs_sb->local_nls);
|
||||
rc = cifs_setup_session(xid, pSesInfo,
|
||||
cifs_sb->local_nls);
|
||||
up(&pSesInfo->sesSem);
|
||||
if (!rc)
|
||||
atomic_inc(&srvTcp->socketUseCount);
|
||||
@@ -2200,7 +2242,8 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||
pSMB->req_no_secext.MaxBufferSize = cpu_to_le16(ses->server->maxBuf);
|
||||
pSMB->req_no_secext.MaxMpxCount = cpu_to_le16(ses->server->maxReq);
|
||||
|
||||
if (ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
|
||||
if (ses->server->secMode &
|
||||
(SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
|
||||
smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
|
||||
|
||||
capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS |
|
||||
@@ -2304,8 +2347,9 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||
__u16 action = le16_to_cpu(pSMBr->resp.Action);
|
||||
__u16 blob_len = le16_to_cpu(pSMBr->resp.SecurityBlobLength);
|
||||
if (action & GUEST_LOGIN)
|
||||
cFYI(1, (" Guest login")); /* do we want to mark SesInfo struct ? */
|
||||
ses->Suid = smb_buffer_response->Uid; /* UID left in wire format (le) */
|
||||
cFYI(1, (" Guest login")); /* BB mark SesInfo struct? */
|
||||
ses->Suid = smb_buffer_response->Uid; /* UID left in wire format
|
||||
(little endian) */
|
||||
cFYI(1, ("UID = %d ", ses->Suid));
|
||||
/* response can have either 3 or 4 word count - Samba sends 3 */
|
||||
bcc_ptr = pByteArea(smb_buffer_response);
|
||||
@@ -2319,7 +2363,9 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||
if ((long) (bcc_ptr) % 2) {
|
||||
remaining_words =
|
||||
(BCC(smb_buffer_response) - 1) / 2;
|
||||
bcc_ptr++; /* Unicode strings must be word aligned */
|
||||
/* Unicode strings must be word
|
||||
aligned */
|
||||
bcc_ptr++;
|
||||
} else {
|
||||
remaining_words =
|
||||
BCC(smb_buffer_response) / 2;
|
||||
@@ -2332,11 +2378,13 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||
terminating last Unicode string in response */
|
||||
if (ses->serverOS)
|
||||
kfree(ses->serverOS);
|
||||
ses->serverOS = kzalloc(2 * (len + 1), GFP_KERNEL);
|
||||
ses->serverOS = kzalloc(2 * (len + 1),
|
||||
GFP_KERNEL);
|
||||
if (ses->serverOS == NULL)
|
||||
goto sesssetup_nomem;
|
||||
cifs_strfromUCS_le(ses->serverOS,
|
||||
(__le16 *)bcc_ptr, len,nls_codepage);
|
||||
(__le16 *)bcc_ptr,
|
||||
len, nls_codepage);
|
||||
bcc_ptr += 2 * (len + 1);
|
||||
remaining_words -= len + 1;
|
||||
ses->serverOS[2 * len] = 0;
|
||||
@@ -2345,11 +2393,13 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||
len = UniStrnlen((wchar_t *)bcc_ptr,
|
||||
remaining_words-1);
|
||||
kfree(ses->serverNOS);
|
||||
ses->serverNOS = kzalloc(2 * (len + 1),GFP_KERNEL);
|
||||
ses->serverNOS = kzalloc(2 * (len + 1),
|
||||
GFP_KERNEL);
|
||||
if (ses->serverNOS == NULL)
|
||||
goto sesssetup_nomem;
|
||||
cifs_strfromUCS_le(ses->serverNOS,
|
||||
(__le16 *)bcc_ptr,len,nls_codepage);
|
||||
(__le16 *)bcc_ptr,
|
||||
len, nls_codepage);
|
||||
bcc_ptr += 2 * (len + 1);
|
||||
ses->serverNOS[2 * len] = 0;
|
||||
ses->serverNOS[1 + (2 * len)] = 0;
|
||||
@@ -2361,26 +2411,31 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||
remaining_words -= len + 1;
|
||||
if (remaining_words > 0) {
|
||||
len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words);
|
||||
/* last string is not always null terminated (for e.g. for Windows XP & 2000) */
|
||||
/* last string is not always null terminated
|
||||
(for e.g. for Windows XP & 2000) */
|
||||
if (ses->serverDomain)
|
||||
kfree(ses->serverDomain);
|
||||
ses->serverDomain =
|
||||
kzalloc(2*(len+1),GFP_KERNEL);
|
||||
kzalloc(2*(len+1),
|
||||
GFP_KERNEL);
|
||||
if (ses->serverDomain == NULL)
|
||||
goto sesssetup_nomem;
|
||||
cifs_strfromUCS_le(ses->serverDomain,
|
||||
(__le16 *)bcc_ptr,len,nls_codepage);
|
||||
(__le16 *)bcc_ptr,
|
||||
len, nls_codepage);
|
||||
bcc_ptr += 2 * (len + 1);
|
||||
ses->serverDomain[2*len] = 0;
|
||||
ses->serverDomain[1+(2*len)] = 0;
|
||||
} /* else no more room so create dummy domain string */
|
||||
else {
|
||||
} else { /* else no more room so create
|
||||
dummy domain string */
|
||||
if (ses->serverDomain)
|
||||
kfree(ses->serverDomain);
|
||||
ses->serverDomain =
|
||||
kzalloc(2, GFP_KERNEL);
|
||||
}
|
||||
} else { /* no room so create dummy domain and NOS string */
|
||||
} else { /* no room so create dummy domain
|
||||
and NOS string */
|
||||
|
||||
/* if these kcallocs fail not much we
|
||||
can do, but better to not fail the
|
||||
sesssetup itself */
|
||||
@@ -2397,18 +2452,21 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||
pByteArea(smb_buffer_response)
|
||||
<= BCC(smb_buffer_response)) {
|
||||
kfree(ses->serverOS);
|
||||
ses->serverOS = kzalloc(len + 1,GFP_KERNEL);
|
||||
ses->serverOS = kzalloc(len + 1,
|
||||
GFP_KERNEL);
|
||||
if (ses->serverOS == NULL)
|
||||
goto sesssetup_nomem;
|
||||
strncpy(ses->serverOS, bcc_ptr, len);
|
||||
|
||||
bcc_ptr += len;
|
||||
bcc_ptr[0] = 0; /* null terminate the string */
|
||||
/* null terminate the string */
|
||||
bcc_ptr[0] = 0;
|
||||
bcc_ptr++;
|
||||
|
||||
len = strnlen(bcc_ptr, 1024);
|
||||
kfree(ses->serverNOS);
|
||||
ses->serverNOS = kzalloc(len + 1,GFP_KERNEL);
|
||||
ses->serverNOS = kzalloc(len + 1,
|
||||
GFP_KERNEL);
|
||||
if (ses->serverNOS == NULL)
|
||||
goto sesssetup_nomem;
|
||||
strncpy(ses->serverNOS, bcc_ptr, len);
|
||||
@@ -2419,21 +2477,25 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||
len = strnlen(bcc_ptr, 1024);
|
||||
if (ses->serverDomain)
|
||||
kfree(ses->serverDomain);
|
||||
ses->serverDomain = kzalloc(len + 1,GFP_KERNEL);
|
||||
ses->serverDomain = kzalloc(len + 1,
|
||||
GFP_KERNEL);
|
||||
if (ses->serverDomain == NULL)
|
||||
goto sesssetup_nomem;
|
||||
strncpy(ses->serverDomain, bcc_ptr, len);
|
||||
strncpy(ses->serverDomain, bcc_ptr,
|
||||
len);
|
||||
bcc_ptr += len;
|
||||
bcc_ptr[0] = 0;
|
||||
bcc_ptr++;
|
||||
} else
|
||||
cFYI(1,
|
||||
("Variable field of length %d extends beyond end of smb ",
|
||||
("Variable field of length %d "
|
||||
"extends beyond end of smb ",
|
||||
len));
|
||||
}
|
||||
} else {
|
||||
cERROR(1,
|
||||
(" Security Blob Length extends beyond end of SMB"));
|
||||
(" Security Blob Length extends beyond "
|
||||
"end of SMB"));
|
||||
}
|
||||
} else {
|
||||
cERROR(1,
|
||||
@@ -2645,7 +2707,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
|
||||
remaining_words =
|
||||
(BCC(smb_buffer_response)
|
||||
- 1) / 2;
|
||||
bcc_ptr++; /* Unicode strings must be word aligned */
|
||||
/* Must word align unicode strings */
|
||||
bcc_ptr++;
|
||||
} else {
|
||||
remaining_words =
|
||||
BCC
|
||||
@@ -2691,7 +2754,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
|
||||
remaining_words -= len + 1;
|
||||
if (remaining_words > 0) {
|
||||
len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words);
|
||||
/* last string is not always null terminated (for e.g. for Windows XP & 2000) */
|
||||
/* last string not always null terminated
|
||||
(for e.g. for Windows XP & 2000) */
|
||||
kfree(ses->serverDomain);
|
||||
ses->serverDomain =
|
||||
kzalloc(2 *
|
||||
@@ -2756,7 +2820,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
|
||||
ses->serverDomain =
|
||||
kzalloc(len + 1,
|
||||
GFP_KERNEL);
|
||||
strncpy(ses->serverDomain, bcc_ptr, len);
|
||||
strncpy(ses->serverDomain,
|
||||
bcc_ptr, len);
|
||||
bcc_ptr += len;
|
||||
bcc_ptr[0] = 0;
|
||||
bcc_ptr++;
|
||||
@@ -2766,8 +2831,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
|
||||
len));
|
||||
}
|
||||
} else {
|
||||
cERROR(1,
|
||||
(" Security Blob Length extends beyond end of SMB"));
|
||||
cERROR(1, ("Security Blob Length extends beyond"
|
||||
" end of SMB"));
|
||||
}
|
||||
} else {
|
||||
cERROR(1, ("No session structure passed in."));
|
||||
@@ -3017,15 +3082,18 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||
__u16 blob_len =
|
||||
le16_to_cpu(pSMBr->resp.SecurityBlobLength);
|
||||
if (action & GUEST_LOGIN)
|
||||
cFYI(1, (" Guest login")); /* BB do we want to set anything in SesInfo struct ? */
|
||||
cFYI(1, (" Guest login")); /* BB Should we set anything
|
||||
in SesInfo struct ? */
|
||||
/* if (SecurityBlob2->MessageType != NtLm??) {
|
||||
cFYI("Unexpected message type on auth response is %d"));
|
||||
} */
|
||||
|
||||
if (ses) {
|
||||
cFYI(1,
|
||||
("Does UID on challenge %d match auth response UID %d ",
|
||||
("Check challenge UID %d vs auth response UID %d",
|
||||
ses->Suid, smb_buffer_response->Uid));
|
||||
ses->Suid = smb_buffer_response->Uid; /* UID left in wire format */
|
||||
/* UID left in wire format */
|
||||
ses->Suid = smb_buffer_response->Uid;
|
||||
bcc_ptr = pByteArea(smb_buffer_response);
|
||||
/* response can have either 3 or 4 word count - Samba sends 3 */
|
||||
if ((pSMBr->resp.hdr.WordCount == 3)
|
||||
@@ -3146,7 +3214,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||
|
||||
len = strnlen(bcc_ptr, 1024);
|
||||
kfree(ses->serverNOS);
|
||||
ses->serverNOS = kzalloc(len+1,GFP_KERNEL);
|
||||
ses->serverNOS = kzalloc(len+1,
|
||||
GFP_KERNEL);
|
||||
strncpy(ses->serverNOS, bcc_ptr, len);
|
||||
bcc_ptr += len;
|
||||
bcc_ptr[0] = 0;
|
||||
@@ -3307,7 +3376,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
|
||||
bcc_ptr[1] = 0;
|
||||
bcc_ptr += 2;
|
||||
}
|
||||
/* else do not bother copying these informational fields */
|
||||
/* else do not bother copying these information fields*/
|
||||
} else {
|
||||
length = strnlen(bcc_ptr, 1024);
|
||||
if ((bcc_ptr + length) -
|
||||
@@ -3319,7 +3388,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
|
||||
strncpy(tcon->nativeFileSystem, bcc_ptr,
|
||||
length);
|
||||
}
|
||||
/* else do not bother copying these informational fields */
|
||||
/* else do not bother copying these information fields*/
|
||||
}
|
||||
if ((smb_buffer_response->WordCount == 3) ||
|
||||
(smb_buffer_response->WordCount == 7))
|
||||
@@ -3425,7 +3494,8 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
|
||||
if (linuxExtEnabled == 0)
|
||||
pSesInfo->capabilities &= (~CAP_UNIX);
|
||||
/* pSesInfo->sequence_number = 0;*/
|
||||
cFYI(1, ("Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d",
|
||||
cFYI(1,
|
||||
("Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d",
|
||||
pSesInfo->server->secMode,
|
||||
pSesInfo->server->capabilities,
|
||||
pSesInfo->server->timeAdj));
|
||||
@@ -3456,7 +3526,8 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
|
||||
} else
|
||||
v2_response = kmalloc(16 + 64 /* blob */, GFP_KERNEL);
|
||||
if (v2_response) {
|
||||
CalcNTLMv2_response(pSesInfo,v2_response);
|
||||
CalcNTLMv2_response(pSesInfo,
|
||||
v2_response);
|
||||
/* if (first_time)
|
||||
cifs_calculate_ntlmv2_mac_key(
|
||||
pSesInfo->server->mac_signing_key,
|
||||
|
@@ -1035,7 +1035,8 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode)
|
||||
/* if it fails, try another handle - might be */
|
||||
/* dangerous to hold up writepages with retry */
|
||||
if (rc) {
|
||||
cFYI(1, ("failed on reopen file in wp"));
|
||||
cFYI(1,
|
||||
("failed on reopen file in wp"));
|
||||
read_lock(&GlobalSMBSeslock);
|
||||
/* can not use this handle, no write
|
||||
pending on this one after all */
|
||||
|
@@ -285,7 +285,6 @@ static int decode_sfu_inode(struct inode *inode, __u64 size,
|
||||
CIFSSMBClose(xid, pTcon, netfid);
|
||||
}
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
||||
#define SFBITS_MASK (S_ISVTX | S_ISGID | S_ISUID) /* SETFILEBITS valid bits */
|
||||
@@ -317,8 +316,6 @@ static int get_sfu_uid_mode(struct inode *inode,
|
||||
#else
|
||||
return -EOPNOTSUPP;
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
int cifs_get_inode_info(struct inode **pinode,
|
||||
@@ -364,7 +361,6 @@ int cifs_get_inode_info(struct inode **pinode,
|
||||
CIFS_MOUNT_MAP_SPECIAL_CHR);
|
||||
adjustTZ = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
/* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */
|
||||
if (rc) {
|
||||
|
@@ -274,7 +274,6 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
|
||||
else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
|
||||
cERROR(1, ("SFU style symlinks not implemented yet"));
|
||||
/* add open and read as in fs/cifs/inode.c */
|
||||
|
||||
} else {
|
||||
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, GENERIC_READ,
|
||||
OPEN_REPARSE_POINT, &fid, &oplock, NULL,
|
||||
@@ -315,7 +314,9 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
|
||||
num_referrals));
|
||||
if (referrals) {
|
||||
cFYI(1,("referral string: %s", referrals));
|
||||
strncpy(tmpbuffer, referrals, len-1);
|
||||
strncpy(tmpbuffer,
|
||||
referrals,
|
||||
len-1);
|
||||
}
|
||||
}
|
||||
kfree(referrals);
|
||||
|
@@ -47,8 +47,10 @@ _GetXid(void)
|
||||
|
||||
spin_lock(&GlobalMid_Lock);
|
||||
GlobalTotalActiveXid++;
|
||||
|
||||
/* keep high water mark for number of simultaneous ops in filesystem */
|
||||
if (GlobalTotalActiveXid > GlobalMaxActiveXid)
|
||||
GlobalMaxActiveXid = GlobalTotalActiveXid; /* keep high water mark for number of simultaneous vfs ops in our filesystem */
|
||||
GlobalMaxActiveXid = GlobalTotalActiveXid;
|
||||
if (GlobalTotalActiveXid > 65000)
|
||||
cFYI(1, ("warning: more than 65000 requests active"));
|
||||
xid = GlobalCurrentXid++;
|
||||
@@ -148,8 +150,8 @@ cifs_buf_get(void)
|
||||
but it may be more efficient to always alloc same size
|
||||
albeit slightly larger than necessary and maxbuffersize
|
||||
defaults to this and can not be bigger */
|
||||
ret_buf =
|
||||
(struct smb_hdr *) mempool_alloc(cifs_req_poolp, GFP_KERNEL | GFP_NOFS);
|
||||
ret_buf = (struct smb_hdr *) mempool_alloc(cifs_req_poolp,
|
||||
GFP_KERNEL | GFP_NOFS);
|
||||
|
||||
/* clear the first few header bytes */
|
||||
/* for most paths, more is cleared in header_assemble */
|
||||
@@ -187,8 +189,8 @@ cifs_small_buf_get(void)
|
||||
but it may be more efficient to always alloc same size
|
||||
albeit slightly larger than necessary and maxbuffersize
|
||||
defaults to this and can not be bigger */
|
||||
ret_buf =
|
||||
(struct smb_hdr *) mempool_alloc(cifs_sm_req_poolp, GFP_KERNEL | GFP_NOFS);
|
||||
ret_buf = (struct smb_hdr *) mempool_alloc(cifs_sm_req_poolp,
|
||||
GFP_KERNEL | GFP_NOFS);
|
||||
if (ret_buf) {
|
||||
/* No need to clear memory here, cleared in header assemble */
|
||||
/* memset(ret_buf, 0, sizeof(struct smb_hdr) + 27);*/
|
||||
|
@@ -51,7 +51,6 @@ static void dump_cifs_file_struct(struct file *file, char *label)
|
||||
if (cf->srch_inf.emptyDir) {
|
||||
cFYI(1, ("empty dir"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG2 */
|
||||
@@ -255,7 +254,6 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
|
||||
tmp_inode->i_fop = &cifs_file_direct_nobrl_ops;
|
||||
else
|
||||
tmp_inode->i_fop = &cifs_file_direct_ops;
|
||||
|
||||
} else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
|
||||
tmp_inode->i_fop = &cifs_file_nobrl_ops;
|
||||
else
|
||||
|
Reference in New Issue
Block a user