unsigned int sessionGen = 0;
-void afsi_log();
+extern void afsi_log(char *pattern, ...);
osi_hyper_t hzero = {0, 0};
osi_hyper_t hones = {0xFFFFFFFF, -1};
-osi_log_t *smb_logp;
+osi_log_t * smb_logp;
osi_rwlock_t smb_globalLock;
osi_rwlock_t smb_rctLock;
-osi_rwlock_t smb_ListenerLock;
+osi_mutex_t smb_ListenerLock;
char smb_LANadapter;
unsigned char smb_sharename[NCBNAMSZ+1] = {0};
void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp,
NCB *ncbp, raw_write_cont_t *rwcp);
void smb_NetbiosInit();
-extern char cm_HostName[];
#ifdef DJGPP
+extern char cm_HostName[];
extern char cm_confDir[];
#endif
for(uidp = vcp->usersp; uidp; uidp = uidp->nextp) {
if (uid == uidp->userID) {
uidp->refCount++;
- osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL," VCP[%x] found-uid[%d] name[%s]",vcp,uidp->userID,(uidp->unp) ? uidp->unp->name : "");
+ osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL," VCP[%x] found-uid[%d] name[%s]",(int)vcp,uidp->userID,(uidp->unp) ? uidp->unp->name : "");
break;
}
}
vcp->usersp = uidp;
lock_InitializeMutex(&uidp->mx, "uid_t mutex");
uidp->userID = uid;
- osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL,"VCP[%x] new-uid[%d] name[%s]",vcp,uidp->userID,(uidp->unp ? uidp->unp->name : ""));
+ osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL,"VCP[%x] new-uid[%d] name[%s]",(int)vcp,uidp->userID,(uidp->unp ? uidp->unp->name : ""));
}
lock_ReleaseWrite(&smb_rctLock);
return uidp;
continue;
if (stricmp(uidp->unp->name, usern) == 0) {
uidp->refCount++;
- osi_LogEvent("AFS smb_FindUserByNameThisSession",NULL,"VCP[%x] uid[%d] match-name[%s]",vcp,uidp->userID,usern);
+ osi_LogEvent("AFS smb_FindUserByNameThisSession",NULL,"VCP[%x] uid[%d] match-name[%s]",(int)vcp,uidp->userID,usern);
break;
} else
continue;
fprintf(stderr, "The following shares are available:\n");
fprintf(stderr, "Share Name (AFS Path)\n");
fprintf(stderr, "---------------------\n");
- fprintf(stderr, "\\\\%s\\%-16s (/afs)\n", smb_localNamep, "ALL");
+ fprintf(stderr, "\\\\%s\\%-16s (%s)\n", smb_localNamep, "ALL", cm_mountRoot);
#ifndef DJGPP
code = GetWindowsDirectory(sbmtpath, sizeof(sbmtpath));
sbmtpath);
if (!len) return num_shares;
p = pathName;
- if (strncmp(p, "/afs", 4) != 0)
+ if (strncmp(p, cm_mountRoot, 4) != 0)
print_afs = 1;
while (*p) {
if (*p == '\\') *p = '/'; /* change to / */
}
fprintf(stderr, "\\\\%s\\%-16s (%s%s)\n",
- smb_localNamep, this_share, (print_afs ? "/afs" : "\0"),
+ smb_localNamep, this_share, (print_afs ? cm_mountRoot : "\0"),
pathName);
num_shares++;
- while (*this_share != NULL) this_share++; /* find next NULL */
- this_share++; /* skip past the NULL */
- } while (*this_share != NULL); /* stop at final NULL */
+ while (*this_share != 0) this_share++; /* find next NUL */
+ this_share++; /* skip past the NUL */
+ } while (*this_share != 0); /* stop at final NUL */
return num_shares;
}
/* We can accept either unix or PC style AFS pathnames. Convert
Unix-style to PC style here for internal use. */
p = pathName;
- if (strncmp(p, "/afs", 4) == 0)
- p += 4; /* skip /afs */
+ if (strncmp(p, cm_mountRoot, 4) == 0)
+ p += strlen(cm_mountRoot); /* skip mount path */
q = p;
while (*q) {
if (*q == '/') *q = '\\'; /* change to \ */
tbp = smb_packetFreeListp;
if (tbp) smb_packetFreeListp = tbp->nextp;
lock_ReleaseWrite(&smb_globalLock);
- if (!tbp) {
+ if (!tbp) {
#ifndef DJGPP
- tbp = GlobalAlloc(GMEM_FIXED, 65540);
+ tbp = calloc(65540,1);
#else /* DJGPP */
- tbp = malloc(sizeof(smb_packet_t));
+ tbp = malloc(sizeof(smb_packet_t));
#endif /* !DJGPP */
- tbp->magic = SMB_PACKETMAGIC;
+ tbp->magic = SMB_PACKETMAGIC;
tbp->ncbp = NULL;
tbp->vcp = NULL;
tbp->resumeCode = 0;
tbp->flags = 0;
#ifdef DJGPP
- npar = SMB_PACKETSIZE >> 4; /* number of paragraphs */
- {
- signed int retval =
- __dpmi_allocate_dos_memory(npar, &tb_sel); /* DOS segment */
- if (retval == -1) {
- afsi_log("Cannot allocate %d paragraphs of DOS memory",
- npar);
- osi_panic("",__FILE__,__LINE__);
- }
- else {
- afsi_log("Allocated %d paragraphs of DOS mem at 0x%X",
- npar, retval);
- seg = retval;
- }
- }
- tbp->dos_pkt = (seg * 16) + 0; /* DOS physical address */
- tbp->dos_pkt_sel = tb_sel;
+ npar = SMB_PACKETSIZE >> 4; /* number of paragraphs */
+ {
+ signed int retval =
+ __dpmi_allocate_dos_memory(npar, &tb_sel); /* DOS segment */
+ if (retval == -1) {
+ afsi_log("Cannot allocate %d paragraphs of DOS memory",
+ npar);
+ osi_panic("",__FILE__,__LINE__);
+ }
+ else {
+ afsi_log("Allocated %d paragraphs of DOS mem at 0x%X",
+ npar, retval);
+ seg = retval;
+ }
+ }
+ tbp->dos_pkt = (seg * 16) + 0; /* DOS physical address */
+ tbp->dos_pkt_sel = tb_sel;
#endif /* DJGPP */
}
- osi_assert(tbp->magic == SMB_PACKETMAGIC);
+ osi_assert(tbp->magic == SMB_PACKETMAGIC);
- return tbp;
+ return tbp;
}
smb_packet_t *smb_CopyPacket(smb_packet_t *pkt)
smb_packet_t *tbp;
tbp = GetPacket();
memcpy(tbp, pkt, sizeof(smb_packet_t));
- tbp->wctp = tbp->data + ((unsigned int)pkt->wctp -
- (unsigned int)pkt->data);
+ tbp->wctp = tbp->data + ((unsigned int)pkt->wctp - (unsigned int)pkt->data);
return tbp;
}
static NCB *GetNCB(void)
{
smb_ncb_t *tbp;
- NCB *ncbp;
+ NCB *ncbp;
#ifdef DJGPP
- unsigned int npar, seg, tb_sel;
+ unsigned int npar, seg, tb_sel;
#endif /* DJGPP */
lock_ObtainWrite(&smb_globalLock);
tbp = smb_ncbFreeListp;
- if (tbp) smb_ncbFreeListp = tbp->nextp;
+ if (tbp)
+ smb_ncbFreeListp = tbp->nextp;
lock_ReleaseWrite(&smb_globalLock);
- if (!tbp) {
+ if (!tbp) {
#ifndef DJGPP
- tbp = GlobalAlloc(GMEM_FIXED, sizeof(*tbp));
+ tbp = calloc(sizeof(*tbp),1);
#else /* DJGPP */
- tbp = malloc(sizeof(*tbp));
- npar = (sizeof(NCB)+15) >> 4; /* number of paragraphs */
- {
- signed int retval =
- __dpmi_allocate_dos_memory(npar, &tb_sel); /* DOS segment */
- if (retval == -1) {
- afsi_log("Cannot allocate %d paragraphs of DOS mem in GetNCB",
- npar);
- osi_panic("",__FILE__,__LINE__);
- } else {
- afsi_log("Allocated %d paragraphs of DOS mem at 0x%X in GetNCB",
- npar, retval);
- seg = retval;
- }
- }
- tbp->dos_ncb = (seg * 16) + 0; /* DOS physical address */
- tbp->dos_ncb_sel = tb_sel;
+ tbp = malloc(sizeof(*tbp));
+ npar = (sizeof(NCB)+15) >> 4; /* number of paragraphs */
+ {
+ signed int retval =
+ __dpmi_allocate_dos_memory(npar, &tb_sel); /* DOS segment */
+ if (retval == -1) {
+ afsi_log("Cannot allocate %d paragraphs of DOS mem in GetNCB",
+ npar);
+ osi_panic("",__FILE__,__LINE__);
+ } else {
+ afsi_log("Allocated %d paragraphs of DOS mem at 0x%X in GetNCB",
+ npar, retval);
+ seg = retval;
+ }
+ }
+ tbp->dos_ncb = (seg * 16) + 0; /* DOS physical address */
+ tbp->dos_ncb_sel = tb_sel;
#endif /* !DJGPP */
- tbp->magic = SMB_NCBMAGIC;
+ tbp->magic = SMB_NCBMAGIC;
}
- osi_assert(tbp->magic == SMB_NCBMAGIC);
+ osi_assert(tbp->magic == SMB_NCBMAGIC);
memset(&tbp->ncb, 0, sizeof(NCB));
- ncbp = &tbp->ncb;
+ ncbp = &tbp->ncb;
#ifdef DJGPP
- dos_memset(tbp->dos_ncb, 0, sizeof(NCB));
+ dos_memset(tbp->dos_ncb, 0, sizeof(NCB));
#endif /* DJGPP */
- return ncbp;
+ return ncbp;
}
void smb_FreePacket(smb_packet_t *tbp)
{
- osi_assert(tbp->magic == SMB_PACKETMAGIC);
+ osi_assert(tbp->magic == SMB_PACKETMAGIC);
- lock_ObtainWrite(&smb_globalLock);
+ lock_ObtainWrite(&smb_globalLock);
tbp->nextp = smb_packetFreeListp;
smb_packetFreeListp = tbp;
tbp->magic = SMB_PACKETMAGIC;
tbp->oddByte = 0;
tbp->ncb_length = 0;
tbp->flags = 0;
- lock_ReleaseWrite(&smb_globalLock);
+ lock_ReleaseWrite(&smb_globalLock);
}
static void FreeNCB(NCB *bufferp)
{
smb_ncb_t *tbp;
- tbp = (smb_ncb_t *) bufferp;
- osi_assert(tbp->magic == SMB_NCBMAGIC);
+ tbp = (smb_ncb_t *) bufferp;
+ osi_assert(tbp->magic == SMB_NCBMAGIC);
- lock_ObtainWrite(&smb_globalLock);
+ lock_ObtainWrite(&smb_globalLock);
tbp->nextp = smb_ncbFreeListp;
smb_ncbFreeListp = tbp;
- lock_ReleaseWrite(&smb_globalLock);
+ lock_ReleaseWrite(&smb_globalLock);
}
/* get a ptr to the data part of a packet, and its count */
unsigned char *smb_GetSMBData(smb_packet_t *smbp, int *nbytesp)
{
- int parmBytes;
- int dataBytes;
- unsigned char *afterParmsp;
+ int parmBytes;
+ int dataBytes;
+ unsigned char *afterParmsp;
- parmBytes = *smbp->wctp << 1;
+ parmBytes = *smbp->wctp << 1;
afterParmsp = smbp->wctp + parmBytes + 1;
- dataBytes = afterParmsp[0] + (afterParmsp[1]<<8);
- if (nbytesp) *nbytesp = dataBytes;
+ dataBytes = afterParmsp[0] + (afterParmsp[1]<<8);
+ if (nbytesp) *nbytesp = dataBytes;
/* don't forget to skip the data byte count, since it follows
- * the parameters; that's where the "2" comes from below.
- */
- return (unsigned char *) (afterParmsp + 2);
+ * the parameters; that's where the "2" comes from below.
+ */
+ return (unsigned char *) (afterParmsp + 2);
}
/* must set all the returned parameters before playing around with the
NTStatus = 0xC000000FL; /* No such file */
}
else if (code == CM_ERROR_TIMEDOUT) {
- NTStatus = 0xC00000CFL; /* Paused */
+ NTStatus = 0xC00000CFL; /* Sharing Paused */
}
else if (code == CM_ERROR_RETRY) {
NTStatus = 0xC000022DL; /* Retry */
NTStatus = 0xC00000CCL; /* Bad network name */
}
else if (code == CM_ERROR_NOIPC) {
- NTStatus = 0xC00000CCL; /* Bad network name */
+#ifdef COMMENT
+ NTStatus = 0xC0000022L; /* Access Denied */
+#else
+ NTStatus = 0xC000013DL; /* Remote Resources */
+#endif
}
else if (code == CM_ERROR_CLOCKSKEW) {
NTStatus = 0xC0000133L; /* Time difference at DC */
error = 6;
}
else if (code == CM_ERROR_NOIPC) {
- class = 1;
- error = 66;
+ class = 2;
+ error = 4; /* bad access */
}
else if (code == CM_ERROR_CLOCKSKEW) {
class = 1; /* invalid function */
smb_renameRock_t rock;
cm_scache_t *oldDscp;
cm_scache_t *newDscp;
+ cm_scache_t *tmpscp;
char *oldLastNamep;
char *newLastNamep;
osi_hyper_t thyper;
*/
thyper.LowPart = 0; /* search dir from here */
thyper.HighPart = 0;
+ /* search for file to already exhist, if so return error*/
+
+ code = cm_Lookup(newDscp,newLastNamep,CM_FLAG_CHECKPATH,userp,&req,&tmpscp);
+ if((code != CM_ERROR_NOSUCHFILE) && (code != CM_ERROR_NOSUCHPATH) && (code != CM_ERROR_NOSUCHVOLUME) ) {
+ cm_ReleaseSCache(tmpscp);
+ return CM_ERROR_EXISTS; /* file exist, do not rename, also
+ fixes move*/
+ }
code = cm_ApplyDir(oldDscp, smb_RenameProc, &rock, &thyper, userp, &req, NULL);
if (code == CM_ERROR_STOPNOW)
void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp,
NCB *ncbp, raw_write_cont_t *rwcp)
{
- static showErrors = 1;
- smb_dispatch_t *dp;
- smb_t *smbp;
- unsigned long code;
- unsigned char *outWctp;
- int nparms; /* # of bytes of parameters */
- char tbuffer[200];
- int nbytes; /* bytes of data, excluding count */
- int temp;
- unsigned char *tp;
- unsigned short errCode;
+ static showErrors = 0;
+ smb_dispatch_t *dp;
+ smb_t *smbp;
+ unsigned long code;
+ unsigned char *outWctp;
+ int nparms; /* # of bytes of parameters */
+ char tbuffer[200];
+ int nbytes; /* bytes of data, excluding count */
+ int temp;
+ unsigned char *tp;
+ unsigned short errCode;
unsigned long NTStatus;
- int noSend;
- unsigned char errClass;
+ int noSend;
+ unsigned char errClass;
unsigned int oldGen;
DWORD oldTime, newTime;
code = smb_ReceiveCoreWriteRaw (vcp, inp, outp,
rwcp);
else {
- osi_LogEvent("AFS Dispatch %s",(myCrt_Dispatch(inp->inCom)),"vcp[%x] lana[%d] lsn[%d]",vcp,vcp->lana,vcp->lsn);
+ osi_LogEvent("AFS Dispatch %s",(myCrt_Dispatch(inp->inCom)),"vcp[%x] lana[%d] lsn[%d]",(int)vcp,vcp->lana,vcp->lsn);
osi_Log4(afsd_logp,"Dispatch %s vcp[%x] lana[%d] lsn[%d]",(myCrt_Dispatch(inp->inCom)),vcp,vcp->lana,vcp->lsn);
code = (*(dp->procp)) (vcp, inp, outp);
- osi_LogEvent("AFS Dispatch return",NULL,"Code[%d]",(code==0)?0:code-CM_ERROR_BASE,"");
+ osi_LogEvent("AFS Dispatch return",NULL,"Code[%d]",(code==0)?0:code-CM_ERROR_BASE);
osi_Log1(afsd_logp,"Dispatch return code[%d]",(code==0)?0:code-CM_ERROR_BASE);
}
void smb_Listener(void *parmp)
{
NCB *ncbp;
- long code;
- long len;
+ long code;
+ long len;
long i, j;
- smb_vc_t *vcp;
+ smb_vc_t *vcp;
int flags = 0;
char rname[NCBNAMSZ+1];
char cname[MAX_COMPUTERNAME_LENGTH+1];
int cnamelen = MAX_COMPUTERNAME_LENGTH+1;
#ifdef DJGPP
- dos_ptr dos_ncb;
- time_t now;
+ dos_ptr dos_ncb;
+ time_t now;
#endif /* DJGPP */
int lana = (int) parmp;
while (1) {
memset(ncbp, 0, sizeof(NCB));
+ flags = 0;
#ifdef DJGPP
/* terminate if shutdown flag is set */
if (smbShutdownFlag == 1)
int delname_tried=0;
int len;
int lana_found = 0;
+ OSVERSIONINFO Version;
+
+ /*******************************************************************/
+ /* ms loopback adapter scan */
+ /*******************************************************************/
+ struct
+ {
+ ADAPTER_STATUS status;
+ NAME_BUFFER NameBuff [30];
+ } Adapter;
+
+ int j;
+ BOOL wla_found;
+
+ /* AFAIK, this is the default for the ms loopback adapter.*/
+ unsigned char kWLA_MAC[6] = { 0x02, 0x00, 0x4c, 0x4f, 0x4f, 0x50 };
+ /*******************************************************************/
+
+ /* Get the version of Windows */
+ memset(&Version, 0x00, sizeof(Version));
+ Version.dwOSVersionInfoSize = sizeof(Version);
+ GetVersionEx(&Version);
/* setup the NCB system */
ncbp = GetNCB();
ncbp->ncb_callname[2] = 100;
ncbp->ncb_lana_num = lana_list.lana[i];
code = Netbios(ncbp);
- if (code == 0) code = ncbp->ncb_retcode;
+ if (code == 0)
+ code = ncbp->ncb_retcode;
if (code != 0) {
- sprintf(s, "Netbios NCBRESET lana %d error code %d", lana_list.lana[i], code);
- afsi_log(s);
- lana_list.lana[i] = 255; /* invalid lana */
+ sprintf(s, "Netbios NCBRESET lana %d error code %d", lana_list.lana[i], code);
+ afsi_log(s);
+ lana_list.lana[i] = 255; /* invalid lana */
} else {
sprintf(s, "Netbios NCBRESET lana %d succeeded", lana_list.lana[i]);
afsi_log(s);
- /* check to see if this is the "Microsoft Loopback Adapter" */
- memset( ncbp, 0, sizeof (*ncbp) );
- ncbp->ncb_command = NCBASTAT;
- ncbp->ncb_lana_num = lana_list.lana[i];
- strcpy( ncbp->ncb_callname, "* " );
- ncbp->ncb_buffer = (char *) &Adapter;
- ncbp->ncb_length = sizeof(Adapter);
- code = Netbios( ncbp );
+ memset( ncbp, 0, sizeof (*ncbp) );
+ ncbp->ncb_command = NCBASTAT;
+ ncbp->ncb_lana_num = lana_list.lana[i];
+ strcpy( ncbp->ncb_callname, "* " );
+ ncbp->ncb_buffer = (char *) &Adapter;
+ ncbp->ncb_length = sizeof(Adapter);
+ code = Netbios( ncbp );
- if ( code == 0 ) {
- wla_found = TRUE;
- for (j=0; wla_found && (j<6); j++)
- wla_found = ( Adapter.status.adapter_address[j] == kWLA_MAC[j] );
-
- if ( wla_found ) {
- sprintf(s, "Windows Loopback Adapter detected lana %d", lana_list.lana[i]);
- afsi_log(s);
-
- /* select this lana; no need to continue */
- lana_list.length = 1;
- lana_list.lana[0] = lana_list.lana[i];
- break;
- }
- }
- }
+ if ( code == 0 ) {
+ wla_found = TRUE;
+ for (j=0; wla_found && (j<6); j++)
+ wla_found = ( Adapter.status.adapter_address[j] == kWLA_MAC[j] );
+
+ if ( wla_found ) {
+ /*
+ * check to see if this is the Microsoft Loopback Adapter"
+ * if we are running on Windows XP or higher
+ */
+ if ( Version.dwPlatformId == VER_PLATFORM_WIN32_NT &&
+ ( Version.dwMajorVersion > 5 ||
+ Version.dwMajorVersion == 5 &&
+ Version.dwMinorVersion >= 1 )
+ )
+ {
+ sprintf(s, "Windows Loopback Adapter detected lana %d", lana_list.lana[i]);
+ afsi_log(s);
+
+ /* select this lana; no need to continue */
+ lana_list.length = 1;
+ lana_list.lana[0] = lana_list.lana[i];
+ break;
+ } else {
+ sprintf(s, "Windows Loopback Adapter disabled lana %d", lana_list.lana[i]);
+ afsi_log(s);
+ lana_list.lana[i] = 255; /* invalid lana */
+ }
+ }
+ }
+ }
}
#else
/* for DJGPP, there is no NCBENUM and NCBRESET is a real reset. so
}
#endif /* !DJGPP */
- try_addname:
/* and declare our name so we can receive connections */
memset(ncbp, 0, sizeof(*ncbp));
len=lstrlen(smb_localNamep);
len = strlen(smb_localNamep);
for(i=len; i<NCBNAMSZ; i++) ncbp->ncb_name[i] = ' ';
#endif
+ sprintf(s, "lana_list.length %d", lana_list.length);
+ afsi_log(s);
+
/* Keep the name so we can unregister it later */
for (l = 0; l < lana_list.length; l++) {
lana = lana_list.lana[l];
if (code == 0) code = ncbp->ncb_retcode;
if (code == 0) {
- fprintf(stderr, "Netbios NCBADDNAME succeeded on lana %d\n", lana);
+ afsi_log("Netbios NCBADDNAME succeeded on lana %d", lana);
#ifdef DJGPP
/* we only use one LANA with djgpp */
lana_list.lana[0] = lana;
else {
sprintf(s, "Netbios NCBADDNAME lana %d error code %d", lana, code);
afsi_log(s);
- fprintf(stderr, "Netbios NCBADDNAME lana %d error code %d\n", lana, code);
if (code == NRC_BRIDGE) { /* invalid LANA num */
lana_list.lana[l] = 255;
continue;
}
else if (code == NRC_DUPNAME) {
- /* Name already exists; try to delete it */
+ afsi_log("Name already exists; try to delete it");
memset(ncbp, 0, sizeof(*ncbp));
ncbp->ncb_command = NCBDELNAME;
memcpy(ncbp->ncb_name,smb_sharename,NCBNAMSZ);
code = Netbios(ncbp, dos_ncb);
#endif /* DJGPP */
if (code == 0) code = ncbp->ncb_retcode;
- else
- fprintf(stderr, "Netbios NCBDELNAME lana %d error code %d\n", lana, code);
- fflush(stderr);
+ else {
+ sprintf(s, "Netbios NCBDELNAME lana %d error code %d\n", lana, code);
+ afsi_log(s);
+ }
if (code != 0 || delname_tried) {
lana_list.lana[l] = 255;
}
{
thread_t phandle;
- int lpid;
- int i;
- long code;
- int len;
- NCB *ncbp;
+ int lpid;
+ int i;
+ int len;
struct tm myTime;
- char s[100];
#ifdef DJGPP
- int npar, seg, sel;
- dos_ptr rawBuf;
+ int npar, seg, sel;
+ dos_ptr rawBuf;
#endif /* DJGPP */
#ifndef DJGPP
/* 4 Raw I/O buffers */
#ifndef DJGPP
- smb_RawBufs = GlobalAlloc(GMEM_FIXED, 65536);
+ smb_RawBufs = calloc(65536,1);
*((char **)smb_RawBufs) = NULL;
for (i=0; i<3; i++) {
- char *rawBuf = GlobalAlloc(GMEM_FIXED, 65536);
+ char *rawBuf = calloc(65536,1);
*((char **)rawBuf) = smb_RawBufs;
smb_RawBufs = rawBuf;
}
#endif
}
#endif /* DJGPP */
+
+int smb_DumpVCP(FILE *outputFile, char *cookie)
+{
+ int zilch;
+ char output[1024];
+ int i;
+
+ smb_vc_t *vcp;
+
+ lock_ObtainRead(&smb_rctLock);
+
+ for(vcp = smb_allVCsp; vcp; vcp=vcp->nextp)
+ {
+ smb_fid_t *fidp;
+
+ sprintf(output, "%s vcp=0x%08X, refCount=%d, flags=%d, vcID=%d, lsn=%d, uidCounter=%d, tidCounter=%d, fidCounter=%d\n",
+ cookie, vcp, vcp->refCount, vcp->flags, vcp->vcID, vcp->lsn, vcp->uidCounter, vcp->tidCounter, vcp->fidCounter);
+ WriteFile(outputFile, output, strlen(output), &zilch, NULL);
+
+ for(fidp = vcp->fidsp; fidp; fidp = (smb_fid_t *) osi_QNext(&fidp->q))
+ {
+ sprintf(output, "%s -- fidp=0x%08X, refCount=%d, fid=%d, vcp=0x%08X, scp=0x%08X, ioctlp=0x%08X, NTopen_pathp=%s, NTopen_wholepathp=%s\n",
+ cookie, fidp, fidp->refCount, fidp->fid, fidp->vcp, fidp->scp, fidp->ioctlp,
+ fidp->NTopen_pathp ? fidp->NTopen_pathp : "NULL",
+ fidp->NTopen_wholepathp ? fidp->NTopen_wholepathp : "NULL");
+ WriteFile(outputFile, output, strlen(output), &zilch, NULL);
+ }
+
+ sprintf(output, "done dumping fidsp\n");
+ WriteFile(outputFile, output, strlen(output), &zilch, NULL);
+ }
+
+ lock_ReleaseRead(&smb_rctLock);
+ return 0;
+}
+
+