Commit ffdd6e4d authored by Steve French's avatar Steve French

[CIFS] fix whitespace

More whitespace problems found by checkpatch
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 75865f8c
...@@ -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;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/random.h> #include <linux/random.h>
/* Calculate and return the CIFS signature based on the mac key and the smb pdu */ /* Calculate and return the CIFS signature based on the mac key and SMB PDU */
/* the 16 byte signature must be allocated by the caller */ /* the 16 byte signature must be allocated by the caller */
/* Note we only use the 1st eight bytes */ /* Note we only use the 1st eight bytes */
/* Note that the smb header signature field on input contains the /* Note that the smb header signature field on input contains the
...@@ -40,43 +40,45 @@ extern void E_md4hash(const unsigned char *passwd, unsigned char *p16); ...@@ -40,43 +40,45 @@ extern void E_md4hash(const unsigned char *passwd, unsigned char *p16);
extern void SMBencrypt(unsigned char *passwd, unsigned char *c8, extern void SMBencrypt(unsigned char *passwd, unsigned char *c8,
unsigned char *p24); unsigned char *p24);
static int cifs_calculate_signature(const struct smb_hdr * cifs_pdu, static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu,
const char * key, char * signature) const char *key, char *signature)
{ {
struct MD5Context context; struct MD5Context context;
if((cifs_pdu == NULL) || (signature == NULL)) if ((cifs_pdu == NULL) || (signature == NULL))
return -EINVAL; return -EINVAL;
MD5Init(&context); MD5Init(&context);
MD5Update(&context,key,CIFS_SESS_KEY_SIZE+16); MD5Update(&context, key, CIFS_SESS_KEY_SIZE+16);
MD5Update(&context,cifs_pdu->Protocol,cifs_pdu->smb_buf_length); MD5Update(&context, cifs_pdu->Protocol, cifs_pdu->smb_buf_length);
MD5Final(signature,&context); MD5Final(signature, &context);
return 0; return 0;
} }
int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct TCP_Server_Info * server, int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server,
__u32 * pexpected_response_sequence_number) __u32 *pexpected_response_sequence_number)
{ {
int rc = 0; int rc = 0;
char smb_signature[20]; char smb_signature[20];
if((cifs_pdu == NULL) || (server == NULL)) if ((cifs_pdu == NULL) || (server == NULL))
return -EINVAL; return -EINVAL;
if((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) if ((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0)
return rc; return rc;
spin_lock(&GlobalMid_Lock); spin_lock(&GlobalMid_Lock);
cifs_pdu->Signature.Sequence.SequenceNumber = cpu_to_le32(server->sequence_number); cifs_pdu->Signature.Sequence.SequenceNumber =
cpu_to_le32(server->sequence_number);
cifs_pdu->Signature.Sequence.Reserved = 0; cifs_pdu->Signature.Sequence.Reserved = 0;
*pexpected_response_sequence_number = server->sequence_number++; *pexpected_response_sequence_number = server->sequence_number++;
server->sequence_number++; server->sequence_number++;
spin_unlock(&GlobalMid_Lock); spin_unlock(&GlobalMid_Lock);
rc = cifs_calculate_signature(cifs_pdu, server->mac_signing_key,smb_signature); rc = cifs_calculate_signature(cifs_pdu, server->mac_signing_key,
if(rc) smb_signature);
if (rc)
memset(cifs_pdu->Signature.SecuritySignature, 0, 8); memset(cifs_pdu->Signature.SecuritySignature, 0, 8);
else else
memcpy(cifs_pdu->Signature.SecuritySignature, smb_signature, 8); memcpy(cifs_pdu->Signature.SecuritySignature, smb_signature, 8);
...@@ -84,50 +86,50 @@ int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct TCP_Server_Info * server, ...@@ -84,50 +86,50 @@ int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct TCP_Server_Info * server,
return rc; return rc;
} }
static int cifs_calc_signature2(const struct kvec * iov, int n_vec, static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
const char * key, char * signature) const char *key, char *signature)
{ {
struct MD5Context context; struct MD5Context context;
int i; int i;
if((iov == NULL) || (signature == NULL)) if ((iov == NULL) || (signature == NULL))
return -EINVAL; return -EINVAL;
MD5Init(&context); MD5Init(&context);
MD5Update(&context,key,CIFS_SESS_KEY_SIZE+16); MD5Update(&context, key, CIFS_SESS_KEY_SIZE+16);
for(i=0;i<n_vec;i++) { for (i=0;i<n_vec;i++) {
if(iov[i].iov_base == NULL) { if (iov[i].iov_base == NULL) {
cERROR(1,("null iovec entry")); cERROR(1 ,("null iovec entry"));
return -EIO; return -EIO;
} else if(iov[i].iov_len == 0) } else if (iov[i].iov_len == 0)
break; /* bail out if we are sent nothing to sign */ break; /* bail out if we are sent nothing to sign */
/* The first entry includes a length field (which does not get /* The first entry includes a length field (which does not get
signed that occupies the first 4 bytes before the header */ signed that occupies the first 4 bytes before the header */
if(i==0) { if (i == 0) {
if (iov[0].iov_len <= 8 ) /* cmd field at offset 9 */ if (iov[0].iov_len <= 8 ) /* cmd field at offset 9 */
break; /* nothing to sign or corrupt header */ break; /* nothing to sign or corrupt header */
MD5Update(&context,iov[0].iov_base+4, iov[0].iov_len-4); MD5Update(&context,iov[0].iov_base+4, iov[0].iov_len-4);
} else } else
MD5Update(&context,iov[i].iov_base, iov[i].iov_len); MD5Update(&context, iov[i].iov_base, iov[i].iov_len);
} }
MD5Final(signature,&context); MD5Final(signature, &context);
return 0; return 0;
} }
int cifs_sign_smb2(struct kvec * iov, int n_vec, struct TCP_Server_Info *server, int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server,
__u32 * pexpected_response_sequence_number) __u32 * pexpected_response_sequence_number)
{ {
int rc = 0; int rc = 0;
char smb_signature[20]; char smb_signature[20];
struct smb_hdr * cifs_pdu = iov[0].iov_base; struct smb_hdr *cifs_pdu = iov[0].iov_base;
if((cifs_pdu == NULL) || (server == NULL)) if ((cifs_pdu == NULL) || (server == NULL))
return -EINVAL; return -EINVAL;
if((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) if ((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0)
return rc; return rc;
spin_lock(&GlobalMid_Lock); spin_lock(&GlobalMid_Lock);
...@@ -141,31 +143,31 @@ int cifs_sign_smb2(struct kvec * iov, int n_vec, struct TCP_Server_Info *server, ...@@ -141,31 +143,31 @@ int cifs_sign_smb2(struct kvec * iov, int n_vec, struct TCP_Server_Info *server,
rc = cifs_calc_signature2(iov, n_vec, server->mac_signing_key, rc = cifs_calc_signature2(iov, n_vec, server->mac_signing_key,
smb_signature); smb_signature);
if(rc) if (rc)
memset(cifs_pdu->Signature.SecuritySignature, 0, 8); memset(cifs_pdu->Signature.SecuritySignature, 0, 8);
else else
memcpy(cifs_pdu->Signature.SecuritySignature, smb_signature, 8); memcpy(cifs_pdu->Signature.SecuritySignature, smb_signature, 8);
return rc; return rc;
} }
int cifs_verify_signature(struct smb_hdr * cifs_pdu, const char * mac_key, int cifs_verify_signature(struct smb_hdr *cifs_pdu, const char *mac_key,
__u32 expected_sequence_number) __u32 expected_sequence_number)
{ {
unsigned int rc; unsigned int rc;
char server_response_sig[8]; char server_response_sig[8];
char what_we_think_sig_should_be[20]; char what_we_think_sig_should_be[20];
if((cifs_pdu == NULL) || (mac_key == NULL)) if ((cifs_pdu == NULL) || (mac_key == NULL))
return -EINVAL; return -EINVAL;
if (cifs_pdu->Command == SMB_COM_NEGOTIATE) if (cifs_pdu->Command == SMB_COM_NEGOTIATE)
return 0; return 0;
if (cifs_pdu->Command == SMB_COM_LOCKING_ANDX) { if (cifs_pdu->Command == SMB_COM_LOCKING_ANDX) {
struct smb_com_lock_req * pSMB = (struct smb_com_lock_req *)cifs_pdu; struct smb_com_lock_req * pSMB =
if(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE) (struct smb_com_lock_req *)cifs_pdu;
if (pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)
return 0; return 0;
} }
......
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