* call to the ioctl code.
*/
afs_int32
-smb_IoctlPrepareRead(struct smb_fid *fidp, smb_ioctl_t *ioctlp, cm_user_t *userp)
+smb_IoctlPrepareRead(struct smb_fid *fidp, smb_ioctl_t *ioctlp, cm_user_t *userp, afs_uint32 pflags)
{
afs_int32 opcode;
smb_ioctlProc_t *procp = NULL;
}
/* otherwise, make the call */
ioctlp->ioctl.outDatap += sizeof(afs_int32); /* reserve room for return code */
- code = (*procp)(ioctlp, userp);
+ code = (*procp)(ioctlp, userp, pflags);
osi_Log1(afsd_logp, "smb_IoctlPrepareRead operation returns code 0x%x", code);
/* copy in return code */
afs_int32 leftToCopy;
char *op;
afs_int32 code;
- cm_user_t *userp;
+ smb_user_t *uidp;
+ cm_user_t *userp = NULL;
+ smb_t *smbp;
+ int isSystem = 0;
iop = fidp->ioctlp;
count = smb_GetSMBParm(inp, 1);
- userp = smb_GetUserFromVCP(vcp, inp);
+
+ /* Get the user and determine if it is the local machine account */
+ smbp = (smb_t *) inp;
+ uidp = smb_FindUID(vcp, smbp->uid, 0);
+ if (uidp) {
+ isSystem = smb_userIsLocalSystem(uidp);
+ userp = smb_GetUserFromUID(uidp);
+ smb_ReleaseUID(uidp);
+ }
+
+ if (!userp) {
+ userp = cm_rootUserp;
+ cm_HoldUser(userp);
+ }
/* Identify tree */
code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &iop->tidPathp);
- if(code) {
+ if (code) {
cm_ReleaseUser(userp);
return CM_ERROR_NOSUCHPATH;
}
/* turn the connection around, if required */
- code = smb_IoctlPrepareRead(fidp, iop, userp);
+ code = smb_IoctlPrepareRead(fidp, iop, userp, isSystem ? AFSCALL_FLAG_LOCAL_SYSTEM : 0);
if (code) {
cm_ReleaseUser(userp);
return CM_ERROR_NOSUCHPATH;
}
- code = smb_IoctlPrepareRead(fidp, iop, userp);
+ code = smb_IoctlPrepareRead(fidp, iop, userp, 0);
if (uidp) {
iop->uidp = 0;
smb_ReleaseUID(uidp);
goto done;
}
- code = smb_IoctlPrepareRead(fidp, iop, userp);
+ code = smb_IoctlPrepareRead(fidp, iop, userp, 0);
if (code) {
goto done;
}
}
afs_int32
-smb_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
char *saveDataPtr;
char *tp;
code = CM_ERROR_INVAL;
goto done;
}
+
+ if (!(pflags & AFSCALL_FLAG_LOCAL_SYSTEM) && (flags & PIOCTL_LOGON)) {
+ code = CM_ERROR_NOACCESS;
+ goto done;
+ }
} else {
cellp = cm_data.rootCellp;
osi_Log0(smb_logp,"cm_IoctlSetToken - no name specified");
}
- if (flags & PIOCTL_LOGON) {
+ if ((pflags & AFSCALL_FLAG_LOCAL_SYSTEM) && (flags & PIOCTL_LOGON)) {
userp = smb_FindCMUserByName(smbname, ioctlp->fidp->vcp->rname,
SMB_FLAG_CREATE|SMB_FLAG_AFSLOGON);
release_userp = 1;
ucellp->flags |= CM_UCELLFLAG_RXKAD;
lock_ReleaseMutex(&userp->mx);
- if (flags & PIOCTL_LOGON) {
+ if ((pflags & AFSCALL_FLAG_LOCAL_SYSTEM) && (flags & PIOCTL_LOGON)) {
ioctlp->ioctl.flags |= CM_IOCTLFLAG_LOGON;
}
cm_ResetACLCache(cellp, userp);
done:
+ SecureZeroMemory(sessionKey, sizeof(sessionKey));
+
if (release_userp)
cm_ReleaseUser(userp);
afs_int32
-smb_IoctlGetSMBName(smb_ioctl_t *ioctlp, cm_user_t *userp)
+smb_IoctlGetSMBName(smb_ioctl_t *ioctlp, cm_user_t *userp, afs_uint32 pflags)
{
smb_user_t *uidp = ioctlp->uidp;
}
afs_int32
-smb_IoctlGetACL(smb_ioctl_t *ioctlp, cm_user_t *userp)
+smb_IoctlGetACL(smb_ioctl_t *ioctlp, cm_user_t *userp, afs_uint32 pflags)
{
cm_scache_t *scp;
afs_int32 code;
}
afs_int32
-smb_IoctlSetACL(smb_ioctl_t *ioctlp, cm_user_t *userp)
+smb_IoctlSetACL(smb_ioctl_t *ioctlp, cm_user_t *userp, afs_uint32 pflags)
{
cm_scache_t *scp;
afs_int32 code;
}
afs_int32
-smb_IoctlGetFileCellName(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlGetFileCellName(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *scp;
}
afs_int32
-smb_IoctlFlushAllVolumes(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlFlushAllVolumes(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_req_t req;
}
afs_int32
-smb_IoctlFlushVolume(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlFlushVolume(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *scp;
}
afs_int32
-smb_IoctlFlushFile(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlFlushFile(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *scp;
}
afs_int32
-smb_IoctlSetVolumeStatus(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlSetVolumeStatus(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *scp;
}
afs_int32
-smb_IoctlGetVolumeStatus(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlGetVolumeStatus(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *scp;
}
afs_int32
-smb_IoctlGetFid(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlGetFid(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *scp;
}
afs_int32
-smb_IoctlGetFileType(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlGetFileType(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *scp;
}
afs_int32
-smb_IoctlGetOwner(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlGetOwner(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *scp;
}
afs_int32
-smb_IoctlWhereIs(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlWhereIs(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *scp;
afs_int32
-smb_IoctlStatMountPoint(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlStatMountPoint(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *dscp;
}
afs_int32
-smb_IoctlDeleteMountPoint(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlDeleteMountPoint(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *dscp;
}
afs_int32
-smb_IoctlCheckServers(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlCheckServers(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl); /* we don't care about the path */
}
afs_int32
-smb_IoctlGag(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlGag(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
/* we don't print anything superfluous, so we don't support the gag call */
return CM_ERROR_INVAL;
}
afs_int32
-smb_IoctlCheckVolumes(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlCheckVolumes(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
return cm_IoctlCheckVolumes(&ioctlp->ioctl, userp);
}
-afs_int32 smb_IoctlSetCacheSize(struct smb_ioctl *ioctlp, struct cm_user *userp)
+afs_int32 smb_IoctlSetCacheSize(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
afs_int32
-smb_IoctlTraceControl(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlTraceControl(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlGetCacheParms(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlGetCacheParms(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlGetCell(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlGetCell(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlNewCell(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlNewCell(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlNewCell2(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlNewCell2(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlGetWsCell(smb_ioctl_t *ioctlp, cm_user_t *userp)
+smb_IoctlGetWsCell(smb_ioctl_t *ioctlp, cm_user_t *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlSysName(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlSysName(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlGetCellStatus(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlGetCellStatus(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlSetCellStatus(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlSetCellStatus(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlSetSPrefs(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlSetSPrefs(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlGetSPrefs(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlGetSPrefs(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlStoreBehind(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlStoreBehind(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
/* we ignore default asynchrony since we only have one way
* of doing this today.
}
afs_int32
-smb_IoctlCreateMountPoint(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlCreateMountPoint(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *dscp;
}
afs_int32
-smb_IoctlSymlink(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlSymlink(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *dscp;
}
afs_int32
-smb_IoctlListlink(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlListlink(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *dscp;
}
afs_int32
-smb_IoctlIslink(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlIslink(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{/*CHECK FOR VALID SYMLINK*/
afs_int32 code;
cm_scache_t *dscp;
}
afs_int32
-smb_IoctlDeletelink(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlDeletelink(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *dscp;
}
afs_int32
-smb_IoctlGetTokenIter(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlGetTokenIter(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlGetToken(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlGetToken(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
afs_int32
-smb_IoctlDelToken(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlDelToken(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
afs_int32
-smb_IoctlDelAllToken(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlDelAllToken(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
afs_int32
-smb_IoctlMakeSubmount(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlMakeSubmount(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlGetRxkcrypt(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlGetRxkcrypt(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlSetRxkcrypt(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlSetRxkcrypt(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlRxStatProcess(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlRxStatProcess(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
afs_int32
-smb_IoctlRxStatPeer(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlRxStatPeer(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlUnicodeControl(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlUnicodeControl(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlUUIDControl(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlUUIDControl(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
afs_int32
-smb_IoctlMemoryDump(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlMemoryDump(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_SkipIoctlPath(&ioctlp->ioctl);
}
afs_int32
-smb_IoctlPathAvailability(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlPathAvailability(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *scp;
}
afs_int32
-smb_IoctlVolStatTest(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlVolStatTest(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
cm_req_t req;
*
*/
afs_int32
-smb_IoctlSetOwner(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlSetOwner(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *scp;
*
*/
afs_int32
-smb_IoctlSetGroup(struct smb_ioctl *ioctlp, struct cm_user *userp)
+smb_IoctlSetGroup(struct smb_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pflags)
{
afs_int32 code;
cm_scache_t *scp;