the-correct-mkdir-fix-20040318

Apply the correct file including the fix to the MIT recursive directory
creation patch.
This commit is contained in:
Jeffrey Altman 2004-03-18 06:13:55 +00:00 committed by Jeffrey Altman
parent 1d568df733
commit 8f0422422d

View File

@ -25,8 +25,6 @@
#include "smb.h" #include "smb.h"
extern smb_vc_t *dead_vcp;
extern osi_hyper_t hzero; extern osi_hyper_t hzero;
smb_packet_t *smb_Directory_Watches = NULL; smb_packet_t *smb_Directory_Watches = NULL;
@ -111,7 +109,7 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *
{ {
char *tp; char *tp;
char *usern, *pwd, *pwdx; char *usern, *pwd, *pwdx;
smb_user_t *uidp, *dead_uidp; smb_user_t *uidp;
unsigned short newUid; unsigned short newUid;
unsigned long caps; unsigned long caps;
cm_user_t *userp; cm_user_t *userp;
@ -164,7 +162,8 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *
if (!userp) if (!userp)
userp = cm_NewUser(); userp = cm_NewUser();
lock_ObtainMutex(&vcp->mx); lock_ObtainMutex(&vcp->mx);
if(!vcp->uidCounter) vcp->uidCounter++; /* handle unlikely wraparounds */ if (!vcp->uidCounter)
vcp->uidCounter++; /* handle unlikely wraparounds */
newUid = (strlen(usern)==0)?0:vcp->uidCounter++; newUid = (strlen(usern)==0)?0:vcp->uidCounter++;
lock_ReleaseMutex(&vcp->mx); lock_ReleaseMutex(&vcp->mx);
@ -176,7 +175,7 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *
uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE); uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
lock_ObtainMutex(&uidp->mx); lock_ObtainMutex(&uidp->mx);
uidp->unp = unp; uidp->unp = unp;
osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d],TicketKTCName[%s]",vcp,vcp->lana,vcp->lsn,newUid,usern); osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d],TicketKTCName[%s]",(int)vcp,vcp->lana,vcp->lsn,newUid,usern);
osi_Log4(afsd_logp,"smb_ReceiveV3SessionSetupX MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d]",vcp,vcp->lana,vcp->lsn,newUid); osi_Log4(afsd_logp,"smb_ReceiveV3SessionSetupX MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d]",vcp,vcp->lana,vcp->lsn,newUid);
lock_ReleaseMutex(&uidp->mx); lock_ReleaseMutex(&uidp->mx);
smb_ReleaseUID(uidp); smb_ReleaseUID(uidp);
@ -205,7 +204,7 @@ long smb_ReceiveV3UserLogoffX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou
/* find the tree and free it */ /* find the tree and free it */
uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0); uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0);
/* TODO: smb_ReleaseUID? */ /* TODO: smb_ReleaseUID() ? */
if (uidp) { if (uidp) {
char *s1 = NULL, *s2 = NULL; char *s1 = NULL, *s2 = NULL;
@ -569,12 +568,11 @@ long smb_ReceiveV3Tran2A(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
} }
/* now copy the parms and data */ /* now copy the parms and data */
if( parmCount != 0 ) if ( parmCount != 0 )
{ {
memcpy(((char *)asp->parmsp) + parmDisp, inp->data + parmOffset, parmCount); memcpy(((char *)asp->parmsp) + parmDisp, inp->data + parmOffset, parmCount);
} }
if( dataCount != 0 ) if ( dataCount != 0 ) {
{
memcpy(asp->datap + dataDisp, inp->data + dataOffset, dataCount); memcpy(asp->datap + dataDisp, inp->data + dataOffset, dataCount);
} }
@ -590,8 +588,8 @@ long smb_ReceiveV3Tran2A(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
lock_ReleaseWrite(&smb_globalLock); lock_ReleaseWrite(&smb_globalLock);
/* now dispatch it */ /* now dispatch it */
if(asp->opcode >= 0 && asp->opcode < 20 && smb_tran2DispatchTable[asp->opcode].procp) { if ( asp->opcode >= 0 && asp->opcode < 20 && smb_tran2DispatchTable[asp->opcode].procp) {
osi_LogEvent("AFS-Dispatch-2[%s]",myCrt_2Dispatch(asp->opcode),"vcp[%x] lana[%d] lsn[%d]",vcp,vcp->lana,vcp->lsn); osi_LogEvent("AFS-Dispatch-2[%s]",myCrt_2Dispatch(asp->opcode),"vcp[%x] lana[%d] lsn[%d]",(int)vcp,vcp->lana,vcp->lsn);
osi_Log4(afsd_logp,"AFS Server - Dispatch-2 %s vcp[%x] lana[%d] lsn[%d]",myCrt_2Dispatch(asp->opcode),vcp,vcp->lana,vcp->lsn); osi_Log4(afsd_logp,"AFS Server - Dispatch-2 %s vcp[%x] lana[%d] lsn[%d]",myCrt_2Dispatch(asp->opcode),vcp,vcp->lana,vcp->lsn);
code = (*smb_tran2DispatchTable[asp->opcode].procp)(vcp, asp, outp); code = (*smb_tran2DispatchTable[asp->opcode].procp)(vcp, asp, outp);
} }
@ -890,8 +888,8 @@ long smb_ReceiveTran2Open(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op)
if (extraInfo) { if (extraInfo) {
outp->parmsp[parmSlot] = smb_Attributes(scp); parmSlot++; outp->parmsp[parmSlot] = smb_Attributes(scp); parmSlot++;
smb_SearchTimeFromUnixTime(&dosTime, scp->clientModTime); smb_SearchTimeFromUnixTime(&dosTime, scp->clientModTime);
outp->parmsp[parmSlot] = dosTime & 0xffff; parmSlot++; outp->parmsp[parmSlot] = (unsigned short)(dosTime & 0xffff); parmSlot++;
outp->parmsp[parmSlot] = (dosTime>>16) & 0xffff; parmSlot++; outp->parmsp[parmSlot] = (unsigned short)((dosTime>>16) & 0xffff); parmSlot++;
outp->parmsp[parmSlot] = (unsigned short) (scp->length.LowPart & 0xffff); outp->parmsp[parmSlot] = (unsigned short) (scp->length.LowPart & 0xffff);
parmSlot++; parmSlot++;
outp->parmsp[parmSlot] = (unsigned short) ((scp->length.LowPart >> 16) & 0xffff); outp->parmsp[parmSlot] = (unsigned short) ((scp->length.LowPart >> 16) & 0xffff);
@ -1183,7 +1181,8 @@ long smb_ReceiveTran2QPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t
spacep = cm_GetSpace(); spacep = cm_GetSpace();
smb_StripLastComponent(spacep->data, &lastComp, smb_StripLastComponent(spacep->data, &lastComp,
(char *)(&p->parmsp[3])); (char *)(&p->parmsp[3]));
if(lastComp) { /* Make sure that lastComp is not NULL */
if (lastComp) {
if (strcmp(lastComp, "\\desktop.ini") == 0) { if (strcmp(lastComp, "\\desktop.ini") == 0) {
code = cm_NameI(cm_rootSCachep, spacep->data, code = cm_NameI(cm_rootSCachep, spacep->data,
CM_FLAG_CASEFOLD CM_FLAG_CASEFOLD
@ -1496,16 +1495,14 @@ long smb_ReceiveTran2SetFileInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet
/* prepare for setattr call */ /* prepare for setattr call */
attr.mask = 0; attr.mask = 0;
lastMod = *((FILETIME *)(p->datap + 16));
/* when called as result of move a b, lastMod is (-1, -1). If the check for -1
is not present, timestamp
of the resulting file will be 1969 (-1)
*/
lastMod = *((FILETIME *)(p->datap + 16));
/* when called as result of move a b, lastMod is (-1, -1).
* If the check for -1 is not present, timestamp
* of the resulting file will be 1969 (-1)
*/
if (LargeIntegerNotEqualToZero(*((LARGE_INTEGER *)&lastMod)) && if (LargeIntegerNotEqualToZero(*((LARGE_INTEGER *)&lastMod)) &&
lastMod.dwLowDateTime != -1 && lastMod.dwLowDateTime != -1 && lastMod.dwHighDateTime != -1) {
lastMod.dwHighDateTime != -1)
{
attr.mask |= CM_ATTRMASK_CLIENTMODTIME; attr.mask |= CM_ATTRMASK_CLIENTMODTIME;
smb_UnixTimeFromLargeSearchTime(&attr.clientModTime, smb_UnixTimeFromLargeSearchTime(&attr.clientModTime,
&lastMod); &lastMod);
@ -1671,7 +1668,6 @@ long smb_ApplyV3DirListPatches(cm_scache_t *dscp,
/* merge in hidden (dot file) attribute */ /* merge in hidden (dot file) attribute */
if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE )
lattr |= SMB_ATTR_HIDDEN; lattr |= SMB_ATTR_HIDDEN;
*((u_long *)dptr) = lattr; *((u_long *)dptr) = lattr;
dptr += 4; dptr += 4;
} }
@ -1722,7 +1718,6 @@ long smb_ApplyV3DirListPatches(cm_scache_t *dscp,
/* merge in hidden (dot file) attribute */ /* merge in hidden (dot file) attribute */
if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE )
attr |= SMB_ATTR_HIDDEN; attr |= SMB_ATTR_HIDDEN;
*dptr++ = attr & 0xff; *dptr++ = attr & 0xff;
*dptr++ = (attr >> 8) & 0xff; *dptr++ = (attr >> 8) & 0xff;
} }
@ -2002,7 +1997,7 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t
nextCookie, dsp->cookie); nextCookie, dsp->cookie);
userp = smb_GetTran2User(vcp, p); userp = smb_GetTran2User(vcp, p);
if(!userp) { if (!userp) {
osi_Log1(afsd_logp, "T2 dir search unable to resolve user [%d]", p->uid); osi_Log1(afsd_logp, "T2 dir search unable to resolve user [%d]", p->uid);
smb_ReleaseDirSearch(dsp); smb_ReleaseDirSearch(dsp);
smb_FreeTran2Packet(outp); smb_FreeTran2Packet(outp);
@ -2249,7 +2244,8 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t
/* Eliminate entries that don't match requested /* Eliminate entries that don't match requested
attributes */ attributes */
if (smb_hideDotFiles && !(dsp->attribute & SMB_ATTR_HIDDEN) && smb_IsDotFile(dep->name)) if (smb_hideDotFiles && !(dsp->attribute & SMB_ATTR_HIDDEN) &&
smb_IsDotFile(dep->name))
goto nextEntry; /* no hidden files */ goto nextEntry; /* no hidden files */
if (!(dsp->attribute & SMB_ATTR_DIRECTORY)) /* no directories */ if (!(dsp->attribute & SMB_ATTR_DIRECTORY)) /* no directories */
@ -2446,9 +2442,8 @@ nextEntry:
* or if something went wrong, close the search. * or if something went wrong, close the search.
*/ */
/* ((searchFlags & 1) || ((searchFlags & 2) && eos) */ /* ((searchFlags & 1) || ((searchFlags & 2) && eos) */
/* pbh - added patch submitted to openafs-dev from James Petterson on 26 Feb, 2003 */ if ((searchFlags & 1) || (returnedNames == 0) || ((searchFlags & 2) &&
if ((searchFlags & 1) || (returnedNames == 0) || ((searchFlags & 2) && eos) eos) || code != 0)
|| code != 0)
smb_DeleteDirSearch(dsp); smb_DeleteDirSearch(dsp);
if (code) if (code)
smb_SendTran2Error(vcp, p, opx, code); smb_SendTran2Error(vcp, p, opx, code);
@ -2546,6 +2541,7 @@ long smb_ReceiveV3OpenX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
#ifdef NOTSERVICE #ifdef NOTSERVICE
osi_Log0(afsd_logp, "IOCTL Open"); osi_Log0(afsd_logp, "IOCTL Open");
#endif #endif
fidp = smb_FindFID(vcp, 0, SMB_FLAG_CREATE); fidp = smb_FindFID(vcp, 0, SMB_FLAG_CREATE);
smb_SetupIoctlFid(fidp, spacep); smb_SetupIoctlFid(fidp, spacep);
@ -2587,7 +2583,6 @@ long smb_ReceiveV3OpenX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
free(hexp); free(hexp);
} }
#endif #endif
userp = smb_GetUser(vcp, inp); userp = smb_GetUser(vcp, inp);
dscp = NULL; dscp = NULL;
@ -2684,8 +2679,7 @@ long smb_ReceiveV3OpenX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
setAttr.mask = CM_ATTRMASK_LENGTH; setAttr.mask = CM_ATTRMASK_LENGTH;
setAttr.length.LowPart = 0; setAttr.length.LowPart = 0;
setAttr.length.HighPart = 0; setAttr.length.HighPart = 0;
code = cm_SetAttr(scp, &setAttr, userp, code = cm_SetAttr(scp, &setAttr, userp, &req);
&req);
} }
} /* lookup succeeded */ } /* lookup succeeded */
} }
@ -2985,17 +2979,15 @@ long smb_ReceiveV3SetAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *
if (searchTime != 0) { if (searchTime != 0) {
smb_UnixTimeFromSearchTime(&unixTime, searchTime); smb_UnixTimeFromSearchTime(&unixTime, searchTime);
if (unixTime != -1) { if ( unixTime != -1 ) {
attrs.mask = CM_ATTRMASK_CLIENTMODTIME; attrs.mask = CM_ATTRMASK_CLIENTMODTIME;
attrs.clientModTime = unixTime; attrs.clientModTime = unixTime;
code = cm_SetAttr(scp, &attrs, userp, &req); code = cm_SetAttr(scp, &attrs, userp, &req);
osi_Log1(afsd_logp, "SMB receive V3SetAttributes [fid=%ld]", fid); osi_Log1(afsd_logp, "SMB receive V3SetAttributes [fid=%ld]", fid);
} } else {
else {
osi_Log1(afsd_logp, "**smb_UnixTimeFromSearchTime failed searchTime=%ld", searchTime); osi_Log1(afsd_logp, "**smb_UnixTimeFromSearchTime failed searchTime=%ld", searchTime);
} }
} }
else code = 0; else code = 0;
@ -3228,10 +3220,8 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
free(hexp); free(hexp);
} }
#endif #endif
userp = smb_GetUser(vcp, inp); userp = smb_GetUser(vcp, inp);
if (!userp) {
if(!userp) {
osi_Log1(afsd_logp, "NTCreateX Invalid user [%d]", ((smb_t *) inp)->uid); osi_Log1(afsd_logp, "NTCreateX Invalid user [%d]", ((smb_t *) inp)->uid);
free(realPathp); free(realPathp);
return CM_ERROR_INVAL; return CM_ERROR_INVAL;
@ -3243,7 +3233,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
} }
else { else {
baseFidp = smb_FindFID(vcp, baseFid, 0); baseFidp = smb_FindFID(vcp, baseFid, 0);
if(!baseFidp) { if (!baseFidp) {
osi_Log1(afsd_logp, "NTCreateX Invalid base fid [%d]", baseFid); osi_Log1(afsd_logp, "NTCreateX Invalid base fid [%d]", baseFid);
free(realPathp); free(realPathp);
cm_ReleaseUser(userp); cm_ReleaseUser(userp);
@ -3284,7 +3274,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD, CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD,
userp, tidPathp, &req, &dscp); userp, tidPathp, &req, &dscp);
if(code && if (code &&
(tp = strrchr(spacep->data,'\\')) && (tp = strrchr(spacep->data,'\\')) &&
(createDisp == 2) && (createDisp == 2) &&
(realDirFlag == 1)) { (realDirFlag == 1)) {
@ -3292,7 +3282,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
treeCreate = TRUE; treeCreate = TRUE;
treeStartp = realPathp + (tp - spacep->data); treeStartp = realPathp + (tp - spacep->data);
if(*tp && !smb_IsLegalFilename(tp)) { if (*tp && !smb_IsLegalFilename(tp)) {
if(baseFid != 0) smb_ReleaseFID(baseFidp); if(baseFid != 0) smb_ReleaseFID(baseFidp);
cm_ReleaseUser(userp); cm_ReleaseUser(userp);
free(realPathp); free(realPathp);
@ -3424,12 +3414,12 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
else { else {
char *tp, *pp; char *tp, *pp;
char *cp; /* This component */ char *cp; /* This component */
int clen; /* length of component */ int clen = 0; /* length of component */
cm_scache_t *tscp; cm_scache_t *tscp;
int isLast = 0; int isLast = 0;
/* create directory */ /* create directory */
if(!treeCreate) treeStartp = lastNamep; if ( !treeCreate ) treeStartp = lastNamep;
osi_assert(dscp != NULL); osi_assert(dscp != NULL);
osi_Log1(afsd_logp, "smb_ReceiveNTCreateX creating directory [%s]", osi_Log1(afsd_logp, "smb_ReceiveNTCreateX creating directory [%s]",
osi_LogSaveString(afsd_logp, treeStartp)); osi_LogSaveString(afsd_logp, treeStartp));
@ -3446,6 +3436,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
tp = strchr(pp, '\\'); tp = strchr(pp, '\\');
if(!tp) { if(!tp) {
strcpy(cp,pp); strcpy(cp,pp);
clen = strlen(cp);
isLast = 1; /* indicate last component. the supplied path never ends in a slash */ isLast = 1; /* indicate last component. the supplied path never ends in a slash */
} }
else { else {
@ -3507,7 +3498,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
free(realPathp); free(realPathp);
return CM_ERROR_ISDIR; return CM_ERROR_ISDIR;
} }
/* (only applies for single component case) */ /* (only applies to single component case) */
if (realDirFlag == 1 && scp->fileType == CM_SCACHETYPE_FILE) { if (realDirFlag == 1 && scp->fileType == CM_SCACHETYPE_FILE) {
cm_ReleaseSCache(scp); cm_ReleaseSCache(scp);
if (dscp) cm_ReleaseSCache(dscp); if (dscp) cm_ReleaseSCache(dscp);
@ -3597,11 +3588,15 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out
unsigned int extendedRespRequired; unsigned int extendedRespRequired;
int realDirFlag; int realDirFlag;
unsigned int desiredAccess; unsigned int desiredAccess;
/*unsigned int allocSize;*/ #ifdef DEBUG_VERBOSE
/*unsigned int shareAccess;*/ unsigned int allocSize;
unsigned int shareAccess;
#endif
unsigned int extAttributes; unsigned int extAttributes;
unsigned int createDisp; unsigned int createDisp;
/*unsigned int sdLen;*/ #ifdef DEBUG_VERBOSE
unsigned int sdLen;
#endif
unsigned int createOptions; unsigned int createOptions;
int initialModeBits; int initialModeBits;
unsigned short baseFid; unsigned short baseFid;
@ -3644,19 +3639,25 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out
return CM_ERROR_INVAL; return CM_ERROR_INVAL;
baseFid = (unsigned short)lparmp[1]; baseFid = (unsigned short)lparmp[1];
desiredAccess = lparmp[2]; desiredAccess = lparmp[2];
/*allocSize = lparmp[3];*/ #ifdef DEBUG_VERBOSE
allocSize = lparmp[3];
#endif /* DEBUG_VERSOSE */
extAttributes = lparmp[5]; extAttributes = lparmp[5];
/*shareAccess = lparmp[6];*/ #ifdef DEBUG_VEROSE
shareAccess = lparmp[6];
#endif
createDisp = lparmp[7]; createDisp = lparmp[7];
createOptions = lparmp[8]; createOptions = lparmp[8];
/*sdLen = lparmp[9];*/ #ifdef DEBUG_VERBOSE
sdLen = lparmp[9];
#endif
nameLength = lparmp[11]; nameLength = lparmp[11];
/* #ifdef DEBUG_VERBOSE
osi_Log4(afsd_logp,"NTTransCreate with da[%x],ea[%x],sa[%x],cd[%x]",desiredAccess,extAttributes,shareAccess,createDisp); osi_Log4(afsd_logp,"NTTransCreate with da[%x],ea[%x],sa[%x],cd[%x]",desiredAccess,extAttributes,shareAccess,createDisp);
osi_Log2(afsd_logp,"... co[%x],sdl[%x],as[%x]",createOptions,sdLen,allocSize); osi_Log2(afsd_logp,"... co[%x],sdl[%x],as[%x]",createOptions,sdLen,allocSize);
osi_Log1(afsd_logp,"... flags[%x]",flags); osi_Log1(afsd_logp,"... flags[%x]",flags);
*/ #endif
/* mustBeDir is never set; createOptions directory bit seems to be /* mustBeDir is never set; createOptions directory bit seems to be
* more important * more important
@ -3688,6 +3689,7 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out
* Nothing here to handle SMB_IOCTL_FILENAME. * Nothing here to handle SMB_IOCTL_FILENAME.
* Will add it if necessary. * Will add it if necessary.
*/ */
#ifdef DEBUG_VERBOSE #ifdef DEBUG_VERBOSE
{ {
char *hexp, *asciip; char *hexp, *asciip;
@ -3930,8 +3932,8 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out
/* set inp->fid so that later read calls in same msg can find fid */ /* set inp->fid so that later read calls in same msg can find fid */
inp->fid = fidp->fid; inp->fid = fidp->fid;
/* check whether we are required to send and extended response */ /* check whether we are required to send an extended response */
if(!extendedRespRequired) { if (!extendedRespRequired) {
/* out parms */ /* out parms */
parmOffset = 8*4 + 39; parmOffset = 8*4 + 39;
parmOffset += 1; /* pad to 4 */ parmOffset += 1; /* pad to 4 */
@ -3979,9 +3981,7 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out
*((USHORT *)outData) = (scp->fileType == CM_SCACHETYPE_DIRECTORY); *((USHORT *)outData) = (scp->fileType == CM_SCACHETYPE_DIRECTORY);
outData += 2; /* is a dir? */ outData += 2; /* is a dir? */
lock_ReleaseMutex(&scp->mx); lock_ReleaseMutex(&scp->mx);
} else {
} else { /* extended response required */
/* out parms */ /* out parms */
parmOffset = 8*4 + 39; parmOffset = 8*4 + 39;
parmOffset += 1; /* pad to 4 */ parmOffset += 1; /* pad to 4 */
@ -4041,7 +4041,6 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out
cm_ReleaseUser(userp); cm_ReleaseUser(userp);
/* free(realPathp); Can't free realPathp here because fidp->NTopen_wholepathp points there */ /* free(realPathp); Can't free realPathp here because fidp->NTopen_wholepathp points there */
/* leave scp held since we put it in fidp->scp */ /* leave scp held since we put it in fidp->scp */
return 0; return 0;
} }
@ -4060,8 +4059,7 @@ long smb_ReceiveNTTranNotifyChange(smb_vc_t *vcp, smb_packet_t *inp,
watchtree = smb_GetSMBParm(inp, 22) && 0xffff; /* TODO: should this be 0xff ? */ watchtree = smb_GetSMBParm(inp, 22) && 0xffff; /* TODO: should this be 0xff ? */
fidp = smb_FindFID(vcp, fid, 0); fidp = smb_FindFID(vcp, fid, 0);
if (!fidp) {
if(!fidp) {
osi_Log1(afsd_logp, "ERROR: NotifyChange given invalid fid [%d]", fid); osi_Log1(afsd_logp, "ERROR: NotifyChange given invalid fid [%d]", fid);
return CM_ERROR_BADFD; return CM_ERROR_BADFD;
} }
@ -4086,7 +4084,6 @@ long smb_ReceiveNTTranNotifyChange(smb_vc_t *vcp, smb_packet_t *inp,
smb_ReleaseFID(fidp); smb_ReleaseFID(fidp);
outp->flags |= SMB_PACKETFLAG_NOSEND; outp->flags |= SMB_PACKETFLAG_NOSEND;
return 0; return 0;
} }
@ -4245,7 +4242,7 @@ void smb_NotifyChange(DWORD action, DWORD notifyFilter,
filter = 0x17; filter = 0x17;
fidp = smb_FindFID(vcp, fid, 0); fidp = smb_FindFID(vcp, fid, 0);
if(!fidp) { if (!fidp) {
lastWatch = watch; lastWatch = watch;
watch = watch->nextp; watch = watch->nextp;
continue; continue;
@ -4399,10 +4396,10 @@ long smb_ReceiveNTCancel(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
watchtree = smb_GetSMBParm(watch, 22) & 0xffff; watchtree = smb_GetSMBParm(watch, 22) & 0xffff;
fidp = smb_FindFID(vcp, fid, 0); fidp = smb_FindFID(vcp, fid, 0);
if(fidp) { if (fidp) {
osi_Log3(afsd_logp, "Cancelling change notification for fid %d wtree %d file %s", osi_Log3(afsd_logp, "Cancelling change notification for fid %d wtree %d file %s",
fid, watchtree, fid, watchtree,
osi_LogSaveString(afsd_logp, fidp->NTopen_wholepathp)); osi_LogSaveString(afsd_logp, (fidp)?fidp->NTopen_wholepathp:""));
scp = fidp->scp; scp = fidp->scp;
lock_ObtainMutex(&scp->mx); lock_ObtainMutex(&scp->mx);
@ -4445,7 +4442,6 @@ void smb3_Init()
cm_user_t *smb_FindCMUserByName(/*smb_vc_t *vcp,*/ char *usern, char *machine) cm_user_t *smb_FindCMUserByName(/*smb_vc_t *vcp,*/ char *usern, char *machine)
{ {
cm_user_t *userp;
/*int newUid;*/ /*int newUid;*/
smb_username_t *unp; smb_username_t *unp;
@ -4454,9 +4450,9 @@ cm_user_t *smb_FindCMUserByName(/*smb_vc_t *vcp,*/ char *usern, char *machine)
lock_ObtainMutex(&unp->mx); lock_ObtainMutex(&unp->mx);
unp->userp = cm_NewUser(); unp->userp = cm_NewUser();
lock_ReleaseMutex(&unp->mx); lock_ReleaseMutex(&unp->mx);
osi_LogEvent("AFS smb_FindCMUserByName New User",NULL,"name[%s] machine[%s]",usern,machine); osi_LogEvent("AFS smb_FindCMUserByName : New User",NULL,"name[%s] machine[%s]",usern,machine);
} else { } else {
osi_LogEvent("AFS smb_FindCMUserByName Found",NULL,"name[%s] machine[%s]",usern,machine); osi_LogEvent("AFS smb_FindCMUserByName : Found",NULL,"name[%s] machine[%s]",usern,machine);
} }
return unp->userp; return unp->userp;
} }