Commit 790fe579 authored by Steve French's avatar Steve French

[CIFS] more whitespace cleanup

Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 6dc0f87e
...@@ -98,7 +98,7 @@ cifs_read_super(struct super_block *sb, void *data, ...@@ -98,7 +98,7 @@ cifs_read_super(struct super_block *sb, void *data,
/* BB should we make this contingent on mount parm? */ /* BB should we make this contingent on mount parm? */
sb->s_flags |= MS_NODIRATIME | MS_NOATIME; sb->s_flags |= MS_NODIRATIME | MS_NOATIME;
sb->s_fs_info = kzalloc(sizeof(struct cifs_sb_info),GFP_KERNEL); sb->s_fs_info = kzalloc(sizeof(struct cifs_sb_info), GFP_KERNEL);
cifs_sb = CIFS_SB(sb); cifs_sb = CIFS_SB(sb);
if (cifs_sb == NULL) if (cifs_sb == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -117,9 +117,10 @@ cifs_read_super(struct super_block *sb, void *data, ...@@ -117,9 +117,10 @@ cifs_read_super(struct super_block *sb, void *data,
#ifdef CONFIG_CIFS_EXPERIMENTAL #ifdef CONFIG_CIFS_EXPERIMENTAL
if (experimEnabled != 0) if (experimEnabled != 0)
sb->s_export_op = &cifs_export_ops; sb->s_export_op = &cifs_export_ops;
#endif /* EXPERIMENTAL */ #endif /* EXPERIMENTAL */
/* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512) /* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
sb->s_blocksize = cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */ sb->s_blocksize =
cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
#ifdef CONFIG_CIFS_QUOTA #ifdef CONFIG_CIFS_QUOTA
sb->s_qcop = &cifs_quotactl_ops; sb->s_qcop = &cifs_quotactl_ops;
#endif #endif
...@@ -164,10 +165,10 @@ cifs_put_super(struct super_block *sb) ...@@ -164,10 +165,10 @@ cifs_put_super(struct super_block *sb)
cFYI(1, ("In cifs_put_super")); cFYI(1, ("In cifs_put_super"));
cifs_sb = CIFS_SB(sb); cifs_sb = CIFS_SB(sb);
if (cifs_sb == NULL) { if (cifs_sb == NULL) {
cFYI(1,("Empty cifs superblock info passed to unmount")); cFYI(1, ("Empty cifs superblock info passed to unmount"));
return; return;
} }
rc = cifs_umount(sb, cifs_sb); rc = cifs_umount(sb, cifs_sb);
if (rc) { if (rc) {
cERROR(1, ("cifs_umount failed with return code %d", rc)); cERROR(1, ("cifs_umount failed with return code %d", rc));
} }
...@@ -180,7 +181,7 @@ static int ...@@ -180,7 +181,7 @@ static int
cifs_statfs(struct dentry *dentry, struct kstatfs *buf) cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
struct super_block *sb = dentry->d_sb; struct super_block *sb = dentry->d_sb;
int xid; int xid;
int rc = -EOPNOTSUPP; int rc = -EOPNOTSUPP;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
...@@ -193,7 +194,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -193,7 +194,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
buf->f_type = CIFS_MAGIC_NUMBER; buf->f_type = CIFS_MAGIC_NUMBER;
/* instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO */ /* instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO */
buf->f_namelen = PATH_MAX; /* PATH_MAX may be too long - it would buf->f_namelen = PATH_MAX; /* PATH_MAX may be too long - it would
presumably be total path, but note presumably be total path, but note
that some servers (includinng Samba 3) that some servers (includinng Samba 3)
have a shorter maximum path */ have a shorter maximum path */
...@@ -217,8 +218,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -217,8 +218,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
bypassed it because we detected that this was an older LANMAN sess */ bypassed it because we detected that this was an older LANMAN sess */
if (rc) if (rc)
rc = SMBOldQFSInfo(xid, pTcon, buf); rc = SMBOldQFSInfo(xid, pTcon, buf);
/* /* int f_type;
int f_type;
__fsid_t f_fsid; __fsid_t f_fsid;
int f_namelen; */ int f_namelen; */
/* BB get from info in tcon struct at mount time call to QFSAttrInfo */ /* BB get from info in tcon struct at mount time call to QFSAttrInfo */
......
This diff is collapsed.
/* /*
* fs/cifs/misc.c * fs/cifs/misc.c
* *
* Copyright (C) International Business Machines Corp., 2002,2005 * Copyright (C) International Business Machines Corp., 2002,2007
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
...@@ -49,7 +49,7 @@ _GetXid(void) ...@@ -49,7 +49,7 @@ _GetXid(void)
GlobalTotalActiveXid++; GlobalTotalActiveXid++;
if (GlobalTotalActiveXid > GlobalMaxActiveXid) if (GlobalTotalActiveXid > GlobalMaxActiveXid)
GlobalMaxActiveXid = GlobalTotalActiveXid; /* keep high water mark for number of simultaneous vfs ops in our filesystem */ GlobalMaxActiveXid = GlobalTotalActiveXid; /* keep high water mark for number of simultaneous vfs ops in our filesystem */
if(GlobalTotalActiveXid > 65000) if (GlobalTotalActiveXid > 65000)
cFYI(1,("warning: more than 65000 requests active")); cFYI(1,("warning: more than 65000 requests active"));
xid = GlobalCurrentXid++; xid = GlobalCurrentXid++;
spin_unlock(&GlobalMid_Lock); spin_unlock(&GlobalMid_Lock);
...@@ -60,7 +60,7 @@ void ...@@ -60,7 +60,7 @@ void
_FreeXid(unsigned int xid) _FreeXid(unsigned int xid)
{ {
spin_lock(&GlobalMid_Lock); spin_lock(&GlobalMid_Lock);
/* if(GlobalTotalActiveXid == 0) /* if (GlobalTotalActiveXid == 0)
BUG(); */ BUG(); */
GlobalTotalActiveXid--; GlobalTotalActiveXid--;
spin_unlock(&GlobalMid_Lock); spin_unlock(&GlobalMid_Lock);
...@@ -242,7 +242,7 @@ __u16 GetNextMid(struct TCP_Server_Info *server) ...@@ -242,7 +242,7 @@ __u16 GetNextMid(struct TCP_Server_Info *server)
__u16 last_mid; __u16 last_mid;
int collision; int collision;
if(server == NULL) if (server == NULL)
return mid; return mid;
spin_lock(&GlobalMid_Lock); spin_lock(&GlobalMid_Lock);
...@@ -260,7 +260,7 @@ __u16 GetNextMid(struct TCP_Server_Info *server) ...@@ -260,7 +260,7 @@ __u16 GetNextMid(struct TCP_Server_Info *server)
struct mid_q_entry *mid_entry; struct mid_q_entry *mid_entry;
collision = 0; collision = 0;
if(server->CurrentMid == 0) if (server->CurrentMid == 0)
server->CurrentMid++; server->CurrentMid++;
list_for_each(tmp, &server->pending_mid_q) { list_for_each(tmp, &server->pending_mid_q) {
...@@ -273,7 +273,7 @@ __u16 GetNextMid(struct TCP_Server_Info *server) ...@@ -273,7 +273,7 @@ __u16 GetNextMid(struct TCP_Server_Info *server)
break; break;
} }
} }
if(collision == 0) { if (collision == 0) {
mid = server->CurrentMid; mid = server->CurrentMid;
break; break;
} }
...@@ -325,7 +325,7 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , ...@@ -325,7 +325,7 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
/* Uid is not converted */ /* Uid is not converted */
buffer->Uid = treeCon->ses->Suid; buffer->Uid = treeCon->ses->Suid;
buffer->Mid = GetNextMid(treeCon->ses->server); buffer->Mid = GetNextMid(treeCon->ses->server);
if(multiuser_mount != 0) { if (multiuser_mount != 0) {
/* For the multiuser case, there are few obvious technically */ /* For the multiuser case, there are few obvious technically */
/* possible mechanisms to match the local linux user (uid) */ /* possible mechanisms to match the local linux user (uid) */
/* to a valid remote smb user (smb_uid): */ /* to a valid remote smb user (smb_uid): */
...@@ -350,13 +350,13 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , ...@@ -350,13 +350,13 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
/* BB Add support for establishing new tCon and SMB Session */ /* BB Add support for establishing new tCon and SMB Session */
/* with userid/password pairs found on the smb session */ /* with userid/password pairs found on the smb session */
/* for other target tcp/ip addresses BB */ /* for other target tcp/ip addresses BB */
if(current->fsuid != treeCon->ses->linux_uid) { if (current->fsuid != treeCon->ses->linux_uid) {
cFYI(1,("Multiuser mode and UID did not match tcon uid")); cFYI(1,("Multiuser mode and UID did not match tcon uid"));
read_lock(&GlobalSMBSeslock); read_lock(&GlobalSMBSeslock);
list_for_each(temp_item, &GlobalSMBSessionList) { list_for_each(temp_item, &GlobalSMBSessionList) {
ses = list_entry(temp_item, struct cifsSesInfo, cifsSessionList); ses = list_entry(temp_item, struct cifsSesInfo, cifsSessionList);
if(ses->linux_uid == current->fsuid) { if (ses->linux_uid == current->fsuid) {
if(ses->server == treeCon->ses->server) { if (ses->server == treeCon->ses->server) {
cFYI(1,("found matching uid substitute right smb_uid")); cFYI(1,("found matching uid substitute right smb_uid"));
buffer->Uid = ses->Suid; buffer->Uid = ses->Suid;
break; break;
...@@ -374,8 +374,8 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , ...@@ -374,8 +374,8 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
buffer->Flags2 |= SMBFLG2_DFS; buffer->Flags2 |= SMBFLG2_DFS;
if (treeCon->nocase) if (treeCon->nocase)
buffer->Flags |= SMBFLG_CASELESS; buffer->Flags |= SMBFLG_CASELESS;
if((treeCon->ses) && (treeCon->ses->server)) if ((treeCon->ses) && (treeCon->ses->server))
if(treeCon->ses->server->secMode & if (treeCon->ses->server->secMode &
(SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
} }
...@@ -392,11 +392,11 @@ checkSMBhdr(struct smb_hdr *smb, __u16 mid) ...@@ -392,11 +392,11 @@ checkSMBhdr(struct smb_hdr *smb, __u16 mid)
and that the message ids match */ and that the message ids match */
if ((*(__le32 *) smb->Protocol == cpu_to_le32(0x424d53ff)) && if ((*(__le32 *) smb->Protocol == cpu_to_le32(0x424d53ff)) &&
(mid == smb->Mid)) { (mid == smb->Mid)) {
if(smb->Flags & SMBFLG_RESPONSE) if (smb->Flags & SMBFLG_RESPONSE)
return 0; return 0;
else { else {
/* only one valid case where server sends us request */ /* only one valid case where server sends us request */
if(smb->Command == SMB_COM_LOCKING_ANDX) if (smb->Command == SMB_COM_LOCKING_ANDX)
return 0; return 0;
else else
cERROR(1, ("Rcvd Request not response")); cERROR(1, ("Rcvd Request not response"));
...@@ -458,16 +458,16 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) ...@@ -458,16 +458,16 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length)
return 1; return 1;
clc_len = smbCalcSize_LE(smb); clc_len = smbCalcSize_LE(smb);
if(4 + len != length) { if (4 + len != length) {
cERROR(1, ("Length read does not match RFC1001 length %d",len)); cERROR(1, ("Length read does not match RFC1001 length %d",len));
return 1; return 1;
} }
if (4 + len != clc_len) { if (4 + len != clc_len) {
/* check if bcc wrapped around for large read responses */ /* check if bcc wrapped around for large read responses */
if((len > 64 * 1024) && (len > clc_len)) { if ((len > 64 * 1024) && (len > clc_len)) {
/* check if lengths match mod 64K */ /* check if lengths match mod 64K */
if(((4 + len) & 0xFFFF) == (clc_len & 0xFFFF)) if (((4 + len) & 0xFFFF) == (clc_len & 0xFFFF))
return 0; /* bcc wrapped */ return 0; /* bcc wrapped */
} }
cFYI(1, ("Calculated size %d vs length %d mismatch for mid %d", cFYI(1, ("Calculated size %d vs length %d mismatch for mid %d",
...@@ -483,7 +483,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) ...@@ -483,7 +483,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length)
but server says length is 0x21 bytes too long as if the server but server says length is 0x21 bytes too long as if the server
forget to reset the smb rfc1001 length when it reset the forget to reset the smb rfc1001 length when it reset the
wct and bcc to minimum size and drop the t2 parms and data */ wct and bcc to minimum size and drop the t2 parms and data */
if((4+len > clc_len) && (len <= clc_len + 512)) if ((4+len > clc_len) && (len <= clc_len + 512))
return 0; return 0;
else { else {
cERROR(1, ("RFC1001 size %d bigger than SMB for Mid=%d", cERROR(1, ("RFC1001 size %d bigger than SMB for Mid=%d",
...@@ -503,13 +503,13 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) ...@@ -503,13 +503,13 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
struct cifsFileInfo *netfile; struct cifsFileInfo *netfile;
cFYI(1,("Checking for oplock break or dnotify response")); cFYI(1,("Checking for oplock break or dnotify response"));
if((pSMB->hdr.Command == SMB_COM_NT_TRANSACT) && if ((pSMB->hdr.Command == SMB_COM_NT_TRANSACT) &&
(pSMB->hdr.Flags & SMBFLG_RESPONSE)) { (pSMB->hdr.Flags & SMBFLG_RESPONSE)) {
struct smb_com_transaction_change_notify_rsp * pSMBr = struct smb_com_transaction_change_notify_rsp * pSMBr =
(struct smb_com_transaction_change_notify_rsp *)buf; (struct smb_com_transaction_change_notify_rsp *)buf;
struct file_notify_information * pnotify; struct file_notify_information * pnotify;
__u32 data_offset = 0; __u32 data_offset = 0;
if(pSMBr->ByteCount > sizeof(struct file_notify_information)) { if (pSMBr->ByteCount > sizeof(struct file_notify_information)) {
data_offset = le32_to_cpu(pSMBr->DataOffset); data_offset = le32_to_cpu(pSMBr->DataOffset);
pnotify = (struct file_notify_information *) pnotify = (struct file_notify_information *)
...@@ -520,15 +520,15 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) ...@@ -520,15 +520,15 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
sizeof(struct smb_hdr)+60); */ sizeof(struct smb_hdr)+60); */
return TRUE; return TRUE;
} }
if(pSMBr->hdr.Status.CifsError) { if (pSMBr->hdr.Status.CifsError) {
cFYI(1,("notify err 0x%d",pSMBr->hdr.Status.CifsError)); cFYI(1,("notify err 0x%d",pSMBr->hdr.Status.CifsError));
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
if(pSMB->hdr.Command != SMB_COM_LOCKING_ANDX) if (pSMB->hdr.Command != SMB_COM_LOCKING_ANDX)
return FALSE; return FALSE;
if(pSMB->hdr.Flags & SMBFLG_RESPONSE) { if (pSMB->hdr.Flags & SMBFLG_RESPONSE) {
/* no sense logging error on invalid handle on oplock /* no sense logging error on invalid handle on oplock
break - harmless race between close request and oplock break - harmless race between close request and oplock
break response is expected from time to time writing out break response is expected from time to time writing out
...@@ -544,11 +544,11 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) ...@@ -544,11 +544,11 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
return FALSE; /* on valid oplock brk we get "request" */ return FALSE; /* on valid oplock brk we get "request" */
} }
} }
if(pSMB->hdr.WordCount != 8) if (pSMB->hdr.WordCount != 8)
return FALSE; return FALSE;
cFYI(1,(" oplock type 0x%d level 0x%d",pSMB->LockType,pSMB->OplockLevel)); cFYI(1,(" oplock type 0x%d level 0x%d",pSMB->LockType,pSMB->OplockLevel));
if(!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE))
return FALSE; return FALSE;
/* look up tcon based on tid & uid */ /* look up tcon based on tid & uid */
...@@ -560,14 +560,14 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) ...@@ -560,14 +560,14 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
list_for_each(tmp1,&tcon->openFileList){ list_for_each(tmp1,&tcon->openFileList){
netfile = list_entry(tmp1,struct cifsFileInfo, netfile = list_entry(tmp1,struct cifsFileInfo,
tlist); tlist);
if(pSMB->Fid == netfile->netfid) { if (pSMB->Fid == netfile->netfid) {
struct cifsInodeInfo *pCifsInode; struct cifsInodeInfo *pCifsInode;
read_unlock(&GlobalSMBSeslock); read_unlock(&GlobalSMBSeslock);
cFYI(1,("file id match, oplock break")); cFYI(1,("file id match, oplock break"));
pCifsInode = pCifsInode =
CIFS_I(netfile->pInode); CIFS_I(netfile->pInode);
pCifsInode->clientCanCacheAll = FALSE; pCifsInode->clientCanCacheAll = FALSE;
if(pSMB->OplockLevel == 0) if (pSMB->OplockLevel == 0)
pCifsInode->clientCanCacheRead pCifsInode->clientCanCacheRead
= FALSE; = FALSE;
pCifsInode->oplockPending = TRUE; pCifsInode->oplockPending = TRUE;
...@@ -575,7 +575,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) ...@@ -575,7 +575,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
netfile->netfid, netfile->netfid,
tcon); tcon);
cFYI(1,("about to wake up oplock thd")); cFYI(1,("about to wake up oplock thd"));
if(oplockThread) if (oplockThread)
wake_up_process(oplockThread); wake_up_process(oplockThread);
return TRUE; return TRUE;
} }
...@@ -681,7 +681,7 @@ cifs_convertUCSpath(char *target, const __le16 * source, int maxlen, ...@@ -681,7 +681,7 @@ cifs_convertUCSpath(char *target, const __le16 * source, int maxlen,
default: default:
len = cp->uni2char(src_char, &target[j], len = cp->uni2char(src_char, &target[j],
NLS_MAX_CHARSET_SIZE); NLS_MAX_CHARSET_SIZE);
if(len > 0) { if (len > 0) {
j += len; j += len;
continue; continue;
} else { } else {
...@@ -690,7 +690,7 @@ cifs_convertUCSpath(char *target, const __le16 * source, int maxlen, ...@@ -690,7 +690,7 @@ cifs_convertUCSpath(char *target, const __le16 * source, int maxlen,
} }
j++; j++;
/* make sure we do not overrun callers allocated temp buffer */ /* make sure we do not overrun callers allocated temp buffer */
if(j >= (2 * NAME_MAX)) if (j >= (2 * NAME_MAX))
break; break;
} }
cUCS_out: cUCS_out:
...@@ -711,7 +711,7 @@ cifsConvertToUCS(__le16 * target, const char *source, int maxlen, ...@@ -711,7 +711,7 @@ cifsConvertToUCS(__le16 * target, const char *source, int maxlen,
char src_char; char src_char;
__u16 temp; __u16 temp;
if(!mapChars) if (!mapChars)
return cifs_strtoUCS(target, source, PATH_MAX, cp); return cifs_strtoUCS(target, source, PATH_MAX, cp);
for(i = 0, j = 0; i < maxlen; j++) { for(i = 0, j = 0; i < maxlen; j++) {
...@@ -749,7 +749,7 @@ cifsConvertToUCS(__le16 * target, const char *source, int maxlen, ...@@ -749,7 +749,7 @@ cifsConvertToUCS(__le16 * target, const char *source, int maxlen,
len_remaining, &temp); len_remaining, &temp);
/* if no match, use question mark, which /* if no match, use question mark, which
at least in some cases servers as wild card */ at least in some cases servers as wild card */
if(charlen < 1) { if (charlen < 1) {
target[j] = cpu_to_le16(0x003f); target[j] = cpu_to_le16(0x003f);
charlen = 1; charlen = 1;
} else } else
......
...@@ -140,9 +140,9 @@ cifs_inet_pton(int address_family, char *cp,void *dst) ...@@ -140,9 +140,9 @@ cifs_inet_pton(int address_family, char *cp,void *dst)
/* calculate length by finding first slash or NULL */ /* calculate length by finding first slash or NULL */
/* BB Should we convert '/' slash to '\' here since it seems already done /* BB Should we convert '/' slash to '\' here since it seems already done
before this */ before this */
if( address_family == AF_INET ){ if ( address_family == AF_INET ) {
ret = in4_pton(cp, -1 /* len */, dst , '\\', NULL); ret = in4_pton(cp, -1 /* len */, dst , '\\', NULL);
} else if( address_family == AF_INET6 ){ } else if ( address_family == AF_INET6 ) {
ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
} }
#ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2
...@@ -773,7 +773,7 @@ map_smb_to_linux_error(struct smb_hdr *smb) ...@@ -773,7 +773,7 @@ map_smb_to_linux_error(struct smb_hdr *smb)
if (smb->Flags2 & SMBFLG2_ERR_STATUS) { if (smb->Flags2 & SMBFLG2_ERR_STATUS) {
/* translate the newer STATUS codes to old style errors and then to POSIX errors */ /* translate the newer STATUS codes to old style errors and then to POSIX errors */
__u32 err = le32_to_cpu(smb->Status.CifsError); __u32 err = le32_to_cpu(smb->Status.CifsError);
if(cifsFYI & CIFS_RC) if (cifsFYI & CIFS_RC)
cifs_print_status(err); cifs_print_status(err);
ntstatus_to_dos(err, &smberrclass, &smberrcode); ntstatus_to_dos(err, &smberrclass, &smberrcode);
} else { } else {
...@@ -889,15 +889,15 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time) ...@@ -889,15 +889,15 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
sec = 2 * st->TwoSeconds; sec = 2 * st->TwoSeconds;
min = st->Minutes; min = st->Minutes;
if((sec > 59) || (min > 59)) if ((sec > 59) || (min > 59))
cERROR(1,("illegal time min %d sec %d", min, sec)); cERROR(1,("illegal time min %d sec %d", min, sec));
sec += (min * 60); sec += (min * 60);
sec += 60 * 60 * st->Hours; sec += 60 * 60 * st->Hours;
if(st->Hours > 24) if (st->Hours > 24)
cERROR(1,("illegal hours %d",st->Hours)); cERROR(1,("illegal hours %d",st->Hours));
days = sd->Day; days = sd->Day;
month = sd->Month; month = sd->Month;
if((days > 31) || (month > 12)) if ((days > 31) || (month > 12))
cERROR(1,("illegal date, month %d day: %d", month, days)); cERROR(1,("illegal date, month %d day: %d", month, days));
month -= 1; month -= 1;
days += total_days_of_prev_months[month]; days += total_days_of_prev_months[month];
...@@ -911,13 +911,13 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time) ...@@ -911,13 +911,13 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
consider 2 special case years, ie the years 2000 and 2100, and only consider 2 special case years, ie the years 2000 and 2100, and only
adjust for the lack of leap year for the year 2100, as 2000 was a adjust for the lack of leap year for the year 2100, as 2000 was a
leap year (divisable by 400) */ leap year (divisable by 400) */
if(year >= 120) /* the year 2100 */ if (year >= 120) /* the year 2100 */
days = days - 1; /* do not count leap year for the year 2100 */ days = days - 1; /* do not count leap year for the year 2100 */
/* adjust for leap year where we are still before leap day */ /* adjust for leap year where we are still before leap day */
if(year != 120) if (year != 120)
days -= ((year & 0x03) == 0) && (month < 2 ? 1 : 0); days -= ((year & 0x03) == 0) && (month < 2 ? 1 : 0);
sec += 24 * 60 * 60 * days; sec += 24 * 60 * 60 * days;
ts.tv_sec = sec; ts.tv_sec = sec;
......
This diff is collapsed.
This diff is collapsed.
/* /*
Unix SMB/Netbios implementation. Unix SMB/Netbios implementation.
Version 1.9. Version 1.9.
SMB parameters and setup SMB parameters and setup
...@@ -57,7 +57,7 @@ void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24); ...@@ -57,7 +57,7 @@ void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24);
/* /*
This implements the X/Open SMB password encryption This implements the X/Open SMB password encryption
It takes a password, a 8 byte "crypt key" and puts 24 bytes of It takes a password, a 8 byte "crypt key" and puts 24 bytes of
encrypted password into p24 */ encrypted password into p24 */
/* Note that password must be uppercased and null terminated */ /* Note that password must be uppercased and null terminated */
void void
...@@ -74,8 +74,8 @@ SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24) ...@@ -74,8 +74,8 @@ SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24)
SMBOWFencrypt(p21, c8, p24); SMBOWFencrypt(p21, c8, p24);
memset(p14,0,15); memset(p14, 0, 15);
memset(p21,0,21); memset(p21, 0, 21);
} }
/* Routines for Windows NT MD4 Hash functions. */ /* Routines for Windows NT MD4 Hash functions. */
...@@ -90,14 +90,14 @@ _my_wcslen(__u16 * str) ...@@ -90,14 +90,14 @@ _my_wcslen(__u16 * str)
/* /*
* Convert a string into an NT UNICODE string. * Convert a string into an NT UNICODE string.
* Note that regardless of processor type * Note that regardless of processor type
* this must be in intel (little-endian) * this must be in intel (little-endian)
* format. * format.
*/ */
static int static int
_my_mbstowcs(__u16 * dst, const unsigned char *src, int len) _my_mbstowcs(__u16 * dst, const unsigned char *src, int len)
{ /* not a very good conversion routine - change/fix */ { /* BB not a very good conversion routine - change/fix */
int i; int i;
__u16 val; __u16 val;
...@@ -112,7 +112,7 @@ _my_mbstowcs(__u16 * dst, const unsigned char *src, int len) ...@@ -112,7 +112,7 @@ _my_mbstowcs(__u16 * dst, const unsigned char *src, int len)
return i; return i;
} }
/* /*
* Creates the MD4 Hash of the users password in NT UNICODE. * Creates the MD4 Hash of the users password in NT UNICODE.
*/ */
...@@ -123,7 +123,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16) ...@@ -123,7 +123,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16)
__u16 wpwd[129]; __u16 wpwd[129];
/* Password cannot be longer than 128 characters */ /* Password cannot be longer than 128 characters */
if(passwd) { if (passwd) {
len = strlen((char *) passwd); len = strlen((char *) passwd);
if (len > 128) { if (len > 128) {
len = 128; len = 128;
...@@ -138,7 +138,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16) ...@@ -138,7 +138,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16)
len = _my_wcslen(wpwd) * sizeof (__u16); len = _my_wcslen(wpwd) * sizeof (__u16);
mdfour(p16, (unsigned char *) wpwd, len); mdfour(p16, (unsigned char *) wpwd, len);
memset(wpwd,0,129 * 2); memset(wpwd, 0, 129 * 2);
} }
#if 0 /* currently unused */ #if 0 /* currently unused */
...@@ -184,8 +184,8 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n, ...@@ -184,8 +184,8 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n,
struct HMACMD5Context ctx; struct HMACMD5Context ctx;
/* might as well do one alloc to hold both (user_u and dom_u) */ /* might as well do one alloc to hold both (user_u and dom_u) */
user_u = kmalloc(2048 * sizeof(wchar_t),GFP_KERNEL); user_u = kmalloc(2048 * sizeof(wchar_t), GFP_KERNEL);
if(user_u == NULL) if (user_u == NULL)
return; return;
dom_u = user_u + 1024; dom_u = user_u + 1024;
...@@ -206,7 +206,7 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n, ...@@ -206,7 +206,7 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n,
kfree(user_u); kfree(user_u);
} }
#endif #endif
/* Does the des encryption from the NT or LM MD4 hash. */ /* Does the des encryption from the NT or LM MD4 hash. */
static void static void
...@@ -256,15 +256,15 @@ SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24) ...@@ -256,15 +256,15 @@ SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24)
#if 0 #if 0
static void static void
SMBOWFencrypt_ntv2(const unsigned char kr[16], SMBOWFencrypt_ntv2(const unsigned char kr[16],
const struct data_blob * srv_chal, const struct data_blob *srv_chal,
const struct data_blob * cli_chal, unsigned char resp_buf[16]) const struct data_blob *cli_chal, unsigned char resp_buf[16])
{ {
struct HMACMD5Context ctx; struct HMACMD5Context ctx;
hmac_md5_init_limK_to_64(kr, 16, &ctx); hmac_md5_init_limK_to_64(kr, 16, &ctx);
hmac_md5_update(srv_chal->data, srv_chal->length, &ctx); hmac_md5_update(srv_chal->data, srv_chal->length, &ctx);
hmac_md5_update(cli_chal->data, cli_chal->length, &ctx); hmac_md5_update(cli_chal->data, cli_chal->length, &ctx);
hmac_md5_final(resp_buf, &ctx); hmac_md5_final(resp_buf, &ctx);
} }
static void static void
......
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