aboutsummaryrefslogtreecommitdiff
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2007-06-24 21:15:44 +0000
committerSteve French <sfrench@us.ibm.com>2007-06-24 21:15:44 +0000
commitffdd6e4d1685779a413e4a8d753b1862259ed42a (patch)
tree7f0296830abf8feb1352b557de048d646352f307 /fs/cifs
parent75865f8cc8b38c30c3923b74de4b29a00cc4c0e4 (diff)
[CIFS] fix whitespace
More whitespace problems found by checkpatch Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifs_debug.c10
-rw-r--r--fs/cifs/cifsencrypt.c104
2 files changed, 58 insertions, 56 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 07838b2ac1c..ebd13358cca 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 fdeda519eac..8422df81b99 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -21,7 +21,7 @@
#include <linux/fs.h>
#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 <linux/ctype.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 */
/* 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;i<n_vec;i++) {
- if(iov[i].iov_base == NULL) {
- cERROR(1,("null iovec entry"));
+ MD5Update(&context, key, CIFS_SESS_KEY_SIZE+16);
+ for (i=0;i<n_vec;i++) {
+ if (iov[i].iov_base == NULL) {
+ cERROR(1 ,("null iovec entry"));
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 */
- /* 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 */
- if(i==0) {
+ if (i == 0) {
if (iov[0].iov_len <= 8 ) /* cmd field at offset 9 */
break; /* nothing to sign or corrupt header */
MD5Update(&context,iov[0].iov_base+4, iov[0].iov_len-4);
} 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;
}
-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)
{
int rc = 0;
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;
- 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 =
+ 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;
}