From ffdd6e4d1685779a413e4a8d753b1862259ed42a Mon Sep 17 00:00:00 2001 From: Steve French Date: Sun, 24 Jun 2007 21:15:44 +0000 Subject: [PATCH] [CIFS] fix whitespace More whitespace problems found by checkpatch Signed-off-by: Steve French --- fs/cifs/cifs_debug.c | 10 ++-- fs/cifs/cifsencrypt.c | 104 +++++++++++++++++++++--------------------- 2 files changed, 58 insertions(+), 56 deletions(-) diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index 07838b2ac1..ebd13358cc 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c @@ -58,7 +58,7 @@ cifs_dump_mem(char *label, void *data, int length) } #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", smb->Command, smb->Status.CifsError, @@ -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 mid_q_entry * mid_entry; + struct mid_q_entry *mid_entry; if (server == NULL) return; @@ -114,12 +114,12 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset, { struct list_head *tmp; struct list_head *tmp1; - struct mid_q_entry * mid_entry; + struct mid_q_entry *mid_entry; struct cifsSesInfo *ses; struct cifsTconInfo *tcon; int i; int length = 0; - char * original_buf = buf; + char *original_buf = buf; *beginBuffer = buf + offset; diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index fdeda519ea..8422df81b9 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c @@ -21,7 +21,7 @@ #include #include "cifspdu.h" -#include "cifsglob.h" +#include "cifsglob.h" #include "cifs_debug.h" #include "md5.h" #include "cifs_unicode.h" @@ -29,54 +29,56 @@ #include #include -/* 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 */ /* 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 sequence number before this function is called */ extern void mdfour(unsigned char *out, unsigned char *in, int n); extern void E_md4hash(const unsigned char *passwd, unsigned char *p16); 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, - const char * key, char * signature) +static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu, + const char *key, char *signature) { struct MD5Context context; - if((cifs_pdu == NULL) || (signature == NULL)) + if ((cifs_pdu == NULL) || (signature == NULL)) return -EINVAL; MD5Init(&context); - MD5Update(&context,key,CIFS_SESS_KEY_SIZE+16); - MD5Update(&context,cifs_pdu->Protocol,cifs_pdu->smb_buf_length); - MD5Final(signature,&context); + MD5Update(&context, key, CIFS_SESS_KEY_SIZE+16); + MD5Update(&context, cifs_pdu->Protocol, cifs_pdu->smb_buf_length); + MD5Final(signature, &context); return 0; } -int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct TCP_Server_Info * server, - __u32 * pexpected_response_sequence_number) +int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server, + __u32 *pexpected_response_sequence_number) { int rc = 0; char smb_signature[20]; - if((cifs_pdu == NULL) || (server == NULL)) + if ((cifs_pdu == NULL) || (server == NULL)) return -EINVAL; - if((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) + if ((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) return rc; 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; *pexpected_response_sequence_number = server->sequence_number++; server->sequence_number++; spin_unlock(&GlobalMid_Lock); - rc = cifs_calculate_signature(cifs_pdu, server->mac_signing_key,smb_signature); - if(rc) + rc = cifs_calculate_signature(cifs_pdu, server->mac_signing_key, + smb_signature); + if (rc) memset(cifs_pdu->Signature.SecuritySignature, 0, 8); else memcpy(cifs_pdu->Signature.SecuritySignature, smb_signature, 8); @@ -84,88 +86,88 @@ int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct TCP_Server_Info * server, return rc; } -static int cifs_calc_signature2(const struct kvec * iov, int n_vec, - const char * key, char * signature) +static int cifs_calc_signature2(const struct kvec *iov, int n_vec, + const char *key, char *signature) { struct MD5Context context; int i; - if((iov == NULL) || (signature == NULL)) + if ((iov == NULL) || (signature == NULL)) return -EINVAL; MD5Init(&context); - MD5Update(&context,key,CIFS_SESS_KEY_SIZE+16); - for(i=0;iFlags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) + if ((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) return rc; - spin_lock(&GlobalMid_Lock); - cifs_pdu->Signature.Sequence.SequenceNumber = + spin_lock(&GlobalMid_Lock); + 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++; - server->sequence_number++; - spin_unlock(&GlobalMid_Lock); + *pexpected_response_sequence_number = server->sequence_number++; + server->sequence_number++; + spin_unlock(&GlobalMid_Lock); - rc = cifs_calc_signature2(iov, n_vec, server->mac_signing_key, + rc = cifs_calc_signature2(iov, n_vec, server->mac_signing_key, smb_signature); - if(rc) - memset(cifs_pdu->Signature.SecuritySignature, 0, 8); - else - memcpy(cifs_pdu->Signature.SecuritySignature, smb_signature, 8); - - return rc; + if (rc) + memset(cifs_pdu->Signature.SecuritySignature, 0, 8); + else + memcpy(cifs_pdu->Signature.SecuritySignature, smb_signature, 8); + return rc; } -int cifs_verify_signature(struct smb_hdr * cifs_pdu, const char * mac_key, - __u32 expected_sequence_number) +int cifs_verify_signature(struct smb_hdr *cifs_pdu, const char *mac_key, + __u32 expected_sequence_number) { unsigned int rc; char server_response_sig[8]; char what_we_think_sig_should_be[20]; - if((cifs_pdu == NULL) || (mac_key == NULL)) + if ((cifs_pdu == NULL) || (mac_key == NULL)) return -EINVAL; if (cifs_pdu->Command == SMB_COM_NEGOTIATE) return 0; if (cifs_pdu->Command == SMB_COM_LOCKING_ANDX) { - struct smb_com_lock_req * pSMB = (struct smb_com_lock_req *)cifs_pdu; - if(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE) + struct smb_com_lock_req * pSMB = + (struct smb_com_lock_req *)cifs_pdu; + if (pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE) return 0; } -- 2.39.5