X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2FWINNT%2Fafsd%2Fcm_ioctl.c;h=17399bf6fe52e9a865fdb6e730ea9b2cb276ae71;hp=92c75536e4493d9ac0b1c87ebe30ce636a04472e;hb=c1d1a27ba99284b8877f4449f2871eb81a9b31ce;hpb=87c10e8d7f05dbbdf12ee9e8651dcec07e08af3f diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index 92c7553..17399bf 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -1,16 +1,20 @@ -/* - * Copyright (C) 1998, 1989 Transarc Corporation - All rights reserved - * - * (C) COPYRIGHT IBM CORPORATION 1987, 1988 - * LICENSED MATERIALS - PROPERTY OF IBM - * - * +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html */ #include #include +#ifndef DJGPP #include +#else +#include +#endif /* !DJGPP */ #include #include #include @@ -25,15 +29,26 @@ #include "smb.h" +#ifndef DJGPP #include - #include "afsrpc.h" +#else +#include +#include "afsrpc95.h" +#endif + #include "cm_rpc.h" /* Copied from afs_tokens.h */ #define PIOCTL_LOGON 0x1 +#define MAX_PATH 260 osi_mutex_t cm_Afsdsbmt_Lock; +#ifdef AFS_FREELANCE_CLIENT +extern osi_mutex_t cm_Freelance_Lock; +#endif + +extern afs_int32 cryptall; void cm_InitIoctl(void) { @@ -97,10 +112,17 @@ void cm_ResetACLCache(cm_user_t *userp) */ void TranslateExtendedChars(char *str) { + char *p; + if (!str || !*str) return; +#ifndef DJGPP CharToOem(str, str); +#else + p = str; + while (*p) *p++ &= 0x7f; /* turn off high bit; probably not right */ +#endif } /* parse the passed-in file name and do a namei on it. If we fail, @@ -1111,6 +1133,7 @@ long cm_IoctlCreateMountPoint(struct smb_ioctl *ioctlp, struct cm_user *userp) char fullCell[256]; char volume[256]; char cell[256]; + int ttl; cm_InitReq(&req); @@ -1136,7 +1159,11 @@ long cm_IoctlCreateMountPoint(struct smb_ioctl *ioctlp, struct cm_user *userp) /* Get the full name for this cell */ code = cm_SearchCellFile(cell, fullCell, 0, 0); - if (code) +#ifdef AFS_AFSDB_ENV + if (code && cm_dnsEnabled) + code = cm_SearchCellByDNS(cell, fullCell, &ttl, 0, 0); +#endif + if (code) return CM_ERROR_NOSUCHCELL; sprintf(mpInfo, "%c%s:%s", *ioctlp->inDatap, fullCell, volume); @@ -1145,6 +1172,14 @@ long cm_IoctlCreateMountPoint(struct smb_ioctl *ioctlp, struct cm_user *userp) strcpy(mpInfo, ioctlp->inDatap); } +#ifdef AFS_FREELANCE_CLIENT + if (cm_freelanceEnabled && dscp == cm_rootSCachep) { + /* we are adding the mount point to the root dir., so call + the freelance code to do the add. */ + code = cm_FreelanceAddMount(leaf, fullCell, volume, NULL); + return code; + } +#endif /* create the symlink with mode 644. The lack of X bits tells * us that it is a mount point. */ @@ -1365,13 +1400,20 @@ long cm_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) uname = tp; tp += strlen(tp) + 1; +#ifndef DJGPP /* for win95, session key is back in pioctl */ /* uuid */ memcpy(&uuid, tp, sizeof(uuid)); if (!cm_FindTokenEvent(uuid, sessionKey)) return CM_ERROR_INVAL; +#endif /* !DJGPP */ } else cellp = cm_rootCellp; + if (flags & PIOCTL_LOGON) { + userp = smb_FindCMUserByName(/*ioctlp->fidp->vcp,*/ uname, + ioctlp->fidp->vcp->rname); + } + /* store the token */ lock_ObtainMutex(&userp->mx); ucellp = cm_GetUCell(userp, cellp); @@ -1380,6 +1422,7 @@ long cm_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) free(ucellp->ticketp); /* Discard old token if any */ ucellp->ticketp = malloc(ticketLen); memcpy(ucellp->ticketp, ticket, ticketLen); +#ifndef DJGPP /* * Get the session key from the RPC, rather than from the pioctl. */ @@ -1387,6 +1430,10 @@ long cm_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) memcpy(&ucellp->sessionKey, ct.HandShakeKey, sizeof(ct.HandShakeKey)); */ memcpy(ucellp->sessionKey.data, sessionKey, sizeof(sessionKey)); +#else + /* for win95, we are getting the session key from the pioctl */ + memcpy(&ucellp->sessionKey, ct.HandShakeKey, sizeof(ct.HandShakeKey)); +#endif /* !DJGPP */ ucellp->kvno = ct.AuthHandle; ucellp->expirationTime = ct.EndTimestamp; ucellp->gen++; @@ -1453,6 +1500,7 @@ long cm_IoctlGetTokenIter(struct smb_ioctl *ioctlp, struct cm_user *userp) /* clear token */ ct.AuthHandle = ucellp->kvno; +#ifndef DJGPP /* * Don't give out a real session key here */ @@ -1460,6 +1508,9 @@ long cm_IoctlGetTokenIter(struct smb_ioctl *ioctlp, struct cm_user *userp) memcpy(ct.HandShakeKey, &ucellp->sessionKey, sizeof(ct.HandShakeKey)); */ memset(ct.HandShakeKey, 0, sizeof(ct.HandShakeKey)); +#else + memcpy(ct.HandShakeKey, &ucellp->sessionKey, sizeof(ct.HandShakeKey)); +#endif /* !DJGPP */ ct.ViceId = 37; /* XXX */ ct.BeginTimestamp = 0; /* XXX */ ct.EndTimestamp = ucellp->expirationTime; @@ -1494,7 +1545,9 @@ long cm_IoctlGetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) cm_ucell_t *ucellp; struct ClearToken ct; char *tp; +#ifndef DJGPP afs_uuid_t uuid; +#endif /* !DJGPP */ cm_SkipIoctlPath(ioctlp); @@ -1507,8 +1560,10 @@ long cm_IoctlGetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) if (!cellp) return CM_ERROR_NOSUCHCELL; tp += strlen(tp) + 1; +#ifndef DJGPP /* uuid */ memcpy(&uuid, tp, sizeof(uuid)); +#endif /* !DJGPP */ lock_ObtainMutex(&userp->mx); @@ -1533,6 +1588,7 @@ long cm_IoctlGetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) /* clear token */ ct.AuthHandle = ucellp->kvno; +#ifndef DJGPP /* * Don't give out a real session key here */ @@ -1540,6 +1596,9 @@ long cm_IoctlGetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) memcpy(ct.HandShakeKey, &ucellp->sessionKey, sizeof(ct.HandShakeKey)); */ memset(ct.HandShakeKey, 0, sizeof(ct.HandShakeKey)); +#else + memcpy(ct.HandShakeKey, &ucellp->sessionKey, sizeof(ct.HandShakeKey)); +#endif /* !DJGPP */ ct.ViceId = 37; /* XXX */ ct.BeginTimestamp = 0; /* XXX */ ct.EndTimestamp = ucellp->expirationTime; @@ -1563,7 +1622,9 @@ long cm_IoctlGetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) lock_ReleaseMutex(&userp->mx); +#ifndef DJGPP cm_RegisterNewTokenEvent(uuid, ucellp->sessionKey.data); +#endif /* !DJGPP */ return 0; } @@ -1788,3 +1849,30 @@ long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp) return 0; } +long cm_IoctlGetRxkcrypt(smb_ioctl_t *ioctlp, cm_user_t *userp) +{ + memcpy(ioctlp->outDatap, &cryptall, sizeof(cryptall)); + ioctlp->outDatap += sizeof(cryptall); + + return 0; +} + +long cm_IoctlSetRxkcrypt(smb_ioctl_t *ioctlp, cm_user_t *userp) +{ + cm_SkipIoctlPath(ioctlp); + + memcpy(&cryptall, ioctlp->inDatap, sizeof(cryptall)); + + return 0; +} + +#ifdef DJGPP +extern int afsd_shutdown(int); +extern int afs_shutdown; + +long cm_IoctlShutdown(smb_ioctl_t *ioctlp, cm_user_t *userp) { + afs_shutdown = 1; /* flag to shut down */ + return 0; +} +#endif /* DJGPP */ +