-/*
- * 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 <afs/param.h>
#include <afs/stds.h>
+#ifndef DJGPP
#include <windows.h>
+#endif /* !DJGPP */
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
smb_ioctlProc_t *smb_ioctlProcsp[SMB_IOCTL_MAXPROCS];
+/*extern unsigned char smb_LANadapter;*/
+
void smb_InitIoctl(void)
{
smb_ioctlProcsp[VIOCGETAL] = cm_IoctlGetACL;
smb_ioctlProcsp[VIOC_LISTSYMLINK] = cm_IoctlListlink;
smb_ioctlProcsp[VIOC_DELSYMLINK] = cm_IoctlDeletelink;
smb_ioctlProcsp[VIOC_MAKESUBMOUNT] = cm_IoctlMakeSubmount;
+ smb_ioctlProcsp[VIOC_GETRXKCRYPT] = cm_IoctlGetRxkcrypt;
+ smb_ioctlProcsp[VIOC_SETRXKCRYPT] = cm_IoctlSetRxkcrypt;
+ smb_ioctlProcsp[VIOC_ISSYMLINK] = cm_IoctlIslink;
+#ifdef DJGPP
+ smb_ioctlProcsp[VIOC_SHUTDOWN] = cm_IoctlShutdown;
+#endif
+ smb_ioctlProcsp[VIOC_TRACEMEMDUMP] = cm_IoctlMemoryDump;
+ smb_ioctlProcsp[VIOC_ISSYMLINK] = cm_IoctlIslink;
}
/* called to make a fid structure into an IOCTL fid structure */
iop = malloc(sizeof(*iop));
memset(iop, 0, sizeof(*iop));
fidp->ioctlp = iop;
+ iop->fidp = fidp;
}
if (prefix) {
copyPrefix = cm_GetSpace();
if (!ioctlp->inAllocp) ioctlp->inAllocp = malloc(SMB_IOCTL_MAXDATA);
if (!ioctlp->outAllocp) ioctlp->outAllocp = malloc(SMB_IOCTL_MAXDATA);
+ /* Fixes fs la problem. We do a StrToOEM later and if this data isn't initialized we get memory issues. */
+ (void) memset(ioctlp->inAllocp, 0, SMB_IOCTL_MAXDATA);
+ (void) memset(ioctlp->outAllocp, 0, SMB_IOCTL_MAXDATA);
+
/* and make sure that we've reset our state for the new incoming request */
if (!(ioctlp->flags & SMB_IOCTLFLAG_DATAIN)) {
ioctlp->inCopied = 0;
return code;
}
- if (iop->flags & SMB_IOCTLFLAG_LOGON) {
- vcp->logonDLLUser = userp;
- userp->flags |= CM_USERFLAG_WASLOGON;
- }
-
leftToCopy = (iop->outDatap - iop->outAllocp) - iop->outCopied;
if (count > leftToCopy) count = leftToCopy;
op = smb_GetSMBData(outp, NULL);
*op++ = 1;
- *op++ = count & 0xff;
- *op++ = (count >> 8) & 0xff;
+ *op++ = (char)(count & 0xff);
+ *op++ = (char)((count >> 8) & 0xff);
/* now copy the data into the response packet */
memcpy(op, iop->outCopied + iop->outAllocp, count);
long count;
long code;
char *op;
- long inDataBlockCount;
+ int inDataBlockCount;
code = 0;
count = smb_GetSMBParm(inp, 1);
count = smb_GetSMBParm(inp, 5);
userp = smb_GetUser(vcp, inp);
+ osi_assert(userp != 0);
{
smb_user_t *uidp;
uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0);
- osi_Log3(afsd_logp, "Ioctl uid %d user %x name %s",
- uidp->userID, userp,
- osi_LogSaveString(afsd_logp, uidp->name));
- smb_ReleaseUID(uidp);
+ if (uidp && uidp->unp)
+ osi_Log3(afsd_logp, "Ioctl uid %d user %x name %s",
+ uidp->userID, userp,
+ osi_LogSaveString(afsd_logp, uidp->unp->name));
+ else {
+ if (uidp)
+ osi_Log2(afsd_logp, "Ioctl uid %d user %x no name",
+ uidp->userID, userp);
+ else
+ osi_Log1(afsd_logp, "Ioctl no uid user %x no name",
+ userp);
+ }
+ if (uidp) smb_ReleaseUID(uidp);
}
iop->tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid);
return code;
}
- if (iop->flags & SMB_IOCTLFLAG_LOGON) {
- vcp->logonDLLUser = userp;
- userp->flags |= CM_USERFLAG_WASLOGON;
- }
-
leftToCopy = (iop->outDatap - iop->outAllocp) - iop->outCopied;
if (count > leftToCopy) count = leftToCopy;
/* called from Read Raw to handle IOCTL descriptor reads */
long smb_IoctlReadRaw(smb_fid_t *fidp, smb_vc_t *vcp, smb_packet_t *inp,
- smb_packet_t *outp)
+ smb_packet_t *outp
+#ifdef DJGPP
+, dos_ptr rawBuf
+#endif /* DJGPP */
+)
{
smb_ioctl_t *iop;
long leftToCopy;
NCB *ncbp;
long code;
cm_user_t *userp;
+#ifdef DJGPP
+ dos_ptr dos_ncb;
+
+ if (rawBuf == 0)
+ {
+ osi_Log0(afsd_logp, "Failed to get raw buf for smb_IoctlReadRaw");
+ return -1;
+ }
+#endif /* DJGPP */
iop = fidp->ioctlp;
smb_user_t *uidp;
uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0);
- osi_Log3(afsd_logp, "Ioctl uid %d user %x name %s",
- uidp->userID, userp,
- osi_LogSaveString(afsd_logp, uidp->name));
- smb_ReleaseUID(uidp);
+ if (uidp && uidp->unp)
+ osi_Log3(afsd_logp, "Ioctl uid %d user %x name %s",
+ uidp->userID, userp,
+ osi_LogSaveString(afsd_logp, uidp->unp->name));
+ else if (uidp)
+ osi_Log2(afsd_logp, "Ioctl uid %d user %x no name",
+ uidp->userID, userp);
+ else
+ osi_Log1(afsd_logp, "Ioctl no uid user %x no name",
+ userp);
+ if (uidp) smb_ReleaseUID(uidp);
}
iop->tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid);
return code;
}
- if (iop->flags & SMB_IOCTLFLAG_LOGON) {
- vcp->logonDLLUser = userp;
- userp->flags |= CM_USERFLAG_WASLOGON;
- }
-
leftToCopy = (iop->outDatap - iop->outAllocp) - iop->outCopied;
ncbp = outp->ncbp;
ncbp->ncb_length = (unsigned short) leftToCopy;
ncbp->ncb_lsn = (unsigned char) vcp->lsn;
ncbp->ncb_command = NCBSEND;
- ncbp->ncb_buffer = iop->outCopied + iop->outAllocp;
+ /*ncbp->ncb_lana_num = smb_LANadapter;*/
+ ncbp->ncb_lana_num = vcp->lana;
+#ifndef DJGPP
+ ncbp->ncb_buffer = iop->outCopied + iop->outAllocp;
code = Netbios(ncbp);
+#else /* DJGPP */
+ dosmemput(iop->outCopied + iop->outAllocp, ncbp->ncb_length, rawBuf);
+ ncbp->ncb_buffer = rawBuf;
+ dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb;
+ code = Netbios(ncbp, dos_ncb);
+#endif /* !DJGPP */
+
if (code != 0)
osi_Log1(afsd_logp, "ReadRaw send failure code %d", code);