$(INCFILEDIR)\smb3.h \
$(INCFILEDIR)\smb_iocons.h \
$(INCFILEDIR)\smb_ioctl.h \
- $(INCFILEDIR)\afsmsg95.h \
$(INCFILEDIR)\afsrpc.h \
!IFDEF OSICRASH
$(INCFILEDIR)\afsdcrash.h \
$(DEL) $*.lib $*.exp
############################################################################
-# afslog95.dll
-
-LOG95_DLLFILE = $(DESTDIR)\root.client\usr\vice\etc\afslog95.dll
-
-LOG95_DLLOBJS =\
- $(OUT)\afslog95.obj \
- $(OUT)\afslog95.res
-
-LOG95_DLLLIBS =\
- $(DESTDIR)\lib\afsauthent.lib \
- $(DESTDIR)\lib\libafsconf.lib
-
-$(LOG95_DLLFILE): $(LOG95_DLLOBJS) $(LOG95_DLLLIBS)
- $(DLLGUILINK) $(LOGONLINKFLAGS) -def:afslog95.def dnsapi.lib mpr.lib
- $(DLLPREP)
- $(COPY) $*.lib $(DESTDIR)\lib
- $(DEL) $*.lib $*.exp
-
-############################################################################
# Install target; primary makefile target
install_objs: $(OUT)\cm_dns.obj $(OUT)\cm_config.obj $(LANAHELPERLIB) $(OUT)\afsicf.obj
$(EXEDIR)\afsshare.exe \
$(DESTDIR)\bin\kpasswd.exe $(EXEDIR)\cmdebug.exe $(EXEDIR)\afscpcc.exe
-install9X: install_headers $(CONF_DLLFILE) \
- $(EXEDIR)\klog.exe \
- $(EXEDIR)\tokens.exe \
- $(EXEDIR)\unlog.exe $(EXEDIR)\afsd.exe $(EXEDIR)\afsd_service.exe \
- $(EXEDIR)\fs.exe $(EXEDIR)\symlink.exe \
- $(LOGON_DLLFILE) $(LOG95_DLLFILE) \
- $(EXEDIR)\afsshare.exe \
- $(DESTDIR)\bin\kpasswd.exe
-
install_libutils: install_headers $(CONF_DLLFILE) \
$(EXEDIR)\klog.exe \
$(EXEDIR)\tokens.exe \
$(OUT)\afslogon.res: afslogon.rc AFS_component_version_number.h
-$(OUT)\afslog95.res: afslog95.rc AFS_component_version_number.h
-
$(OUT)\libafsconf.res: libafsconf.rc AFS_component_version_number.h
############################################################################
$(DEL) MSG?????.bin
$(DEL) $(CONF_DLLFILE)
$(DEL) $(LOGON_DLLFILE)
- $(DEL) $(LOG95_DLLFILE)
mkdir:
#include <afs/param.h>
-#ifndef DJGPP
BOOL InitClass(HANDLE);
BOOL InitInstance(HANDLE, int);
LONG APIENTRY MainWndProc(HWND, unsigned int, unsigned int, long);
BOOL APIENTRY About(HWND, unsigned int, unsigned int, long);
-#endif /* !DJGPP */
-#ifndef DJGPP
#include <nb30.h>
-#else /* DJGPP */
-#include <sys/farptr.h>
-#include <go32.h>
-#include "dosdefs95.h"
-#include "largeint95.h"
-#endif /* !DJGPP */
#include "afsdicon.h"
#include "cm_freelance.h"
#include "smb_ioctl.h"
#include "afsd_init.h"
-#ifdef DJGPP
-#include "afs/afsmsg95.h"
-#else
#include "afsd_eventlog.h"
-#endif
#include <afs/vldbint.h>
#include <afs/afsint.h>
}
-#if !defined(DJGPP)
static void afsd_InitServerPreferences(void)
{
HKEY hkPrefs = 0;
RegCloseKey(hkPrefs);
}
}
-#endif /* DJGPP */
/*
* AFSD Initialization
/* Initialize the RPC server for session keys */
RpcInit();
-#if !defined(DJGPP)
afsd_InitServerPreferences();
-#endif
return 0;
}
void afsi_start();
-#ifndef DJGPP
int afsd_InitCM(char **reasonP);
int afsd_InitSMB(char **reasonP, void *aMBfunc);
void GenerateMiniDump(PEXCEPTION_POINTERS ep);
-#else /* DJGPP */
-int afsd_InitCM(char **reasonP, struct cmd_syndesc *as, char *arock);
-int afsd_InitSMB(char **reasonP);
-#endif /* !DJGPP */
int afsd_InitDaemons(char **reasonP);
void afsd_ForceTrace(BOOL flush);
void afsd_SetUnhandledExceptionFilter();
#define AFS_PTHREAD_ENV 1
#endif
#include <rx/rx.h>
-#ifdef DJGPP /* we need these for vldbentry decl., etc. */
-#include <afs/vldbint.h>
-#include <afs/afsint.h>
-#endif /* DJGPP */
/* from .xg file */
/* FIXME: these were "long" but Windows NT wants "int" */
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
-#endif
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
-#ifndef DJGPP
#include <nb30.h>
-#endif
#include <osi.h>
#include "afsd.h"
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
-#endif
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
-#endif
#include <osi.h>
#include <stdio.h>
#include <assert.h>
lock_ReleaseWrite(&buf_globalLock);
nAtOnce = (long)sqrt((double)cm_data.buf_nbuffers);
while (buf_ShutdownFlag == 0) {
-#ifndef DJGPP
i = SleepEx(5000, 1);
if (i != 0) continue;
-#else
- thrd_Sleep(5000);
-#endif /* DJGPP */
if (buf_ShutdownFlag == 1)
return;
"buf_IncrSyncer");
osi_assertx(phandle != NULL, "buf: can't create incremental sync proc");
-#ifndef DJGPP
CloseHandle(phandle);
-#endif /* !DJGPP */
}
#ifdef TESTING
*/
long buf_AddBuffers(afs_uint64 nbuffers)
{
-#ifndef DJGPP
/* The size of a virtual cache cannot be changed after it has
* been created. Subsequent calls to MapViewofFile() with
* an existing mapping object name would not allow the
nbuffers, cm_data.buf_nbuffers);
return CM_ERROR_INVAL;
-#else
- cm_buf_t *bp;
- int i;
- char *data;
-
- data = malloc(buf_nbuffers * cm_data.buf_blockSize);
-
- /* Create buffer headers and put in free list */
- bp = malloc(nbuffers * sizeof(*bp));
-
- for (i=0; i<nbuffers; i++) {
- memset(bp, 0, sizeof(*bp));
-
- lock_InitializeMutex(&bp->mx, "cm_buf_t");
-
- /* grab appropriate number of bytes from aligned zone */
- bp->datap = data;
-
- bp->flags |= CM_BUF_INLRU;
-
- lock_ObtainWrite(&buf_globalLock);
- /* note that buf_allp chain is covered by buf_globalLock now */
- bp->allp = cm_data.buf_allp;
- cm_data.buf_allp = bp;
- osi_QAdd((osi_queue_t **) &cm_data.buf_freeListp, &bp->q);
- if (!cm_data.buf_freeListEndp)
- cm_data.buf_freeListEndp = bp;
- cm_data.buf_nbuffers++;
- lock_ReleaseWrite(&buf_globalLock);
-
- bp++;
- data += cm_data.buf_blockSize;
-
- } /* for loop over all buffers */
-
- return 0;
-#endif /* DJGPP */
}
/* interface to set the number of buffers to an exact figure.
osi_assert(!(bp->flags & (CM_BUF_READING | CM_BUF_WRITING)));
/* setup offset, event */
-#ifndef DJGPP /* doesn't seem to be used */
bp->over.Offset = bp->offset.LowPart;
bp->over.OffsetHigh = bp->offset.HighPart;
-#endif /* !DJGPP */
/* start the I/O; may drop lock */
bp->flags |= CM_BUF_READING;
if (code != 0) {
/* failure or queued */
-#ifndef DJGPP /* cm_bufRead always returns 0 */
if (code != ERROR_IO_PENDING) {
-#endif
bp->error = code;
bp->flags |= CM_BUF_ERROR;
bp->flags &= ~CM_BUF_READING;
buf_ValidateBufQueues();
#endif /* TESTING */
return code;
-#ifndef DJGPP
}
-#endif
} else {
/* otherwise, I/O completed instantly and we're done, except
* for padding the xfr out with 0s and checking for EOF
char *datap; /* data in this buffer */
unsigned long error; /* last error code, if CM_BUF_ERROR is set */
cm_user_t *userp; /* user who wrote to the buffer last */
-#ifndef DJGPP
OVERLAPPED over; /* overlapped structure for I/O */
-#endif
/* fields added for the CM; locked by scp->mx */
long dataVersion; /* data version of this page */
extern cm_buf_t *buf_Find(struct cm_scache *, osi_hyper_t *);
-#ifndef DJGPP
extern HANDLE buf_GetFileHandle(long);
-#endif /* !DJGPP */
extern void buf_LockedCleanAsync(cm_buf_t *, cm_req_t *);
#include <afs/afs_args.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
-#else
-#include <sys/socket.h>
-#endif /* !DJGPP */
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <nb30.h>
#include <winsock2.h>
-#endif /* !DJGPP */
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#include <afs/stds.h>
#include <afs/cellconfig.h>
-#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
-#else
-#include <sys/socket.h>
-#include <netdb.h>
-#endif /* !DJGPP */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#endif
/* TODO: these should be pulled in from dirpath.h */
-#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
#define AFS_THISCELL "ThisCell"
-#endif
#define AFS_CELLSERVDB_UNIX "CellServDB"
#define AFS_CELLSERVDB_NT "afsdcell.ini"
#ifndef AFSDIR_CLIENT_ETC_DIRPATH
#define AFSDIR_CLIENT_ETC_DIRPATH "c:/afs"
#endif
-#if defined(DJGPP) || defined(AFS_WIN95_ENV)
-#define AFS_CELLSERVDB AFS_CELLSERVDB_UNIX
-#ifdef DJGPP
-extern char cm_confDir[];
-extern int errno;
-#endif /* DJGPP */
-#else
#define AFS_CELLSERVDB AFS_CELLSERVDB_UNIX
-#endif /* DJGPP || WIN95 */
static long cm_ParsePair(char *lineBufferp, char *leftp, char *rightp)
{
int foundCell = 0;
long code;
int tracking = 1, partial = 0;
-#if defined(DJGPP) || defined(AFS_WIN95_ENV)
- char *afsconf_path;
- DWORD dwSize;
-#endif
if ( IsWindowsModule(cellNamep) )
return -3;
cm_GetCellServDB(wdir);
tfilep = fopen(wdir, "r");
-#if defined(DJGPP) || defined(AFS_WIN95_ENV)
- if (!tfilep) {
- /* If we are using DJGPP client, cellservdb will be in afsconf dir. */
- /* If we are in Win95 here, we are linking with klog etc. and are
- using DJGPP client even though DJGPP is not defined. So we still
- need to check AFSCONF for location. */
- dwSize = GetEnvironmentVariable("AFSCONF", NULL, 0);
- afsconf_path = malloc(dwSize);
- dwSize = GetEnvironmentVariable("AFSCONF", afsconf_path, dwSize);
- if (!afsconf_path)
- strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
- else {
- strcpy(wdir, afsconf_path);
- free(afsconf_path);
- }
- strcat(wdir, "/");
- strcat(wdir, AFS_CELLSERVDB);
- /*fprintf(stderr, "opening cellservdb file %s\n", wdir);*/
- tfilep = fopen(wdir, "r");
- if (!tfilep)
- return -2;
- }
-#else
/* If we are NT or higher, we don't do DJGPP, So just fail */
if ( !tfilep )
return -2;
-#endif
bestp = fopen(wdir, "r");
else inRightCell = 0;
}
else {
-#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
valuep = strchr(lineBuffer, '#');
if (valuep == NULL) {
fclose(tfilep);
while (valuep[strlen(valuep) - 1] == ' ' || valuep[strlen(valuep) - 1] == '\t')
valuep[strlen(valuep) - 1] = '\0';
-#endif /* !DJGPP */
if (inRightCell) {
-#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
/* add the server to the VLDB list */
WSASetLastError(0);
thp = gethostbyname(valuep);
(*procp)(rockp, &vlSockAddr, valuep);
foundCell = 1;
}
-#else
- thp = 0;
-#endif /* !DJGPP */
if (!thp) {
long ip_addr;
int c1, c2, c3, c4;
#endif /* AFS_AFSDB_ENV */
}
-#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
/* look up the CellServDBDir's name in the Registry
* or use the Client Dirpath value to produce a CellServDB
* filename
*/
long cm_GetCellServDB(char *cellNamep)
{
-#if !defined(DJGPP)
DWORD code, dummyLen;
HKEY parmKey;
int tlen;
tlen = (int)strlen(cellNamep);
if (cellNamep[tlen-1] != '\\')
strcat(cellNamep, "\\");
-#else
- strcpy(cellNamep, cm_confDir);
- strcat(cellNamep,"/");
-#endif /* !DJGPP */
strcat(cellNamep, AFS_CELLSERVDB);
return 0;
return 0;
}
-#else
-/* look up the root cell's name in the THISCELL file */
-long cm_GetRootCellName(char *cellNamep)
-{
- FILE *thisCell;
- char thisCellPath[256];
- char *newline;
- DWORD dwSize;
-
-#ifdef DJGPP
- strcpy(thisCellPath, cm_confDir);
-#else
- /* Win 95 */
- char *afsconf_path;
- dwSize = GetEnvironmentVariable("AFSCONF", NULL, 0);
- afsconf_path = malloc(dwSize);
- dwSize = GetEnvironmentVariable("AFSCONF", afsconf_path, dwSize);
- if (!afsconf_path)
- strcpy(thisCellPath, AFSDIR_CLIENT_ETC_DIRPATH);
- else {
- strcpy(thisCellPath, afsconf_path);
- free(afsconf_path);
- }
-#endif
- strcat(thisCellPath,"/");
-
- strcat(thisCellPath, AFS_THISCELL);
- thisCell = fopen(thisCellPath, "r");
- if (thisCell == NULL)
- return -1;
-
- fgets(cellNamep, 256, thisCell);
- fclose(thisCell);
-
- newline = strrchr(cellNamep,'\n');
- if (newline) *newline = '\0';
- newline = strrchr(cellNamep,'\r');
- if (newline) *newline = '\0';
-
- return 0;
-}
-#endif /* !DJGPP */
cm_configFile_t *cm_CommonOpen(char *namep, char *rwp)
{
long tlen;
FILE *tfilep;
-#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
/* add trailing backslash, if required */
tlen = (long)(strlen(wdir));
if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
-#else
-#ifdef DJGPP
- strcpy(wdir,cm_confDir);
-#else
- DWORD dwSize;
- char *afsconf_path;
-
- dwSize = GetEnvironmentVariable("AFSCONF", NULL, 0);
- afsconf_path = malloc(dwSize);
- dwSize = GetEnvironmentVariable("AFSCONF", afsconf_path, dwSize);
-
- if (!afsconf_path)
- strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
- else {
- strcpy(wdir, afsconf_path);
- free(afsconf_path);
- }
-#endif /* !DJGPP */
- strcat(wdir,"/");
-#endif /* DJGPP || WIN95 */
strcat(wdir, namep);
return ((cm_configFile_t *) tfilep);
}
-#ifndef DJGPP
long cm_WriteConfigString(char *labelp, char *valuep)
{
DWORD code, dummyDisp;
return (long)0;
}
-#endif /* !DJGPP */
-#ifndef DJGPP
long cm_WriteConfigInt(char *labelp, long value)
{
DWORD code, dummyDisp;
return 0;
}
-#endif /* !DJGPP */
cm_configFile_t *cm_OpenCellFile(void)
{
long code;
long closeCode;
int tlen;
-#ifdef AFS_WIN95_ENV
- char *afsconf_path;
- DWORD dwSize;
-#endif
- closeCode = fclose((FILE *)filep);
+ closeCode = fclose((FILE *)filep);
-#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
/* add trailing backslash, if required */
tlen = (int)strlen(wdir);
if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
-#else
-#ifdef DJGPP
- strcpy(wdir,cm_confDir);
-#else
- dwSize = GetEnvironmentVariable("AFSCONF", NULL, 0);
- afsconf_path = malloc(dwSize);
- dwSize = GetEnvironmentVariable("AFSCONF", afsconf_path, dwSize);
- if (!afsconf_path)
- strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
- else {
- strcpy(wdir, afsconf_path);
- free(afsconf_path);
- }
-#endif /* !DJGPP */
- strcat(wdir,"/");
-#endif /* DJGPP || WIN95 */
strcpy(sdir, wdir);
DWORD dwSize;
#endif
-#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
/* add trailing backslash, if required */
tlen = (int)strlen(wdir);
if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
-#else
-#ifdef DJGPP
- strcpy(wdir,cm_confDir);
-#else
- dwSize = GetEnvironmentVariable("AFSCONF", NULL, 0);
- afsconf_path = malloc(dwSize);
- dwSize = GetEnvironmentVariable("AFSCONF", afsconf_path, dwSize);
- if (!afsconf_path)
- strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
- else {
- strcpy(wdir, afsconf_path);
- free(afsconf_path);
- }
-#endif /* !DJGPP */
- strcat(wdir,"\\");
-#endif /* DJGPP || WIN95 */
strcpy(dir, wdir);
}
#ifndef __CM_CONFIG_INTERFACES_ONLY__
#include <stdio.h>
-#ifdef DJGPP
-#include <netinet/in.h>
-#endif /* DJGPP */
typedef FILE cm_configFile_t;
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
-#endif /* !DJGPP */
#include <string.h>
#include <malloc.h>
#include <osi.h>
void cm_InitReq(cm_req_t *reqp)
{
memset((char *)reqp, 0, sizeof(cm_req_t));
-#ifndef DJGPP
reqp->startTime = GetTickCount();
-#else
- gettimeofday(&reqp->startTime, NULL);
-#endif
}
static long cm_GetServerList(struct cm_fid *fidp, struct cm_user *userp,
* and retry */
/* timeleft - get if from reqp the same way as cmXonnByMServers does */
-#ifndef DJGPP
timeUsed = (GetTickCount() - reqp->startTime) / 1000;
-#else
- gettimeofday(&now, NULL);
- timeUsed = sub_time(now, reqp->startTime) / 1000;
-#endif
/* leave 5 seconds margin for sleep */
timeLeft = HardDeadtimeout - timeUsed;
{
char addr[16];
char *format;
-#ifndef DJGPP
DWORD msgID;
-#endif
switch ( errorCode ) {
case VNOVOL:
-#ifndef DJGPP
msgID = MSG_SERVER_REPORTS_VNOVOL;
-#endif
format = "Server %s reported volume %d as not attached.";
break;
case VMOVED:
-#ifndef DJGPP
msgID = MSG_SERVER_REPORTS_VMOVED;
-#endif
format = "Server %s reported volume %d as moved.";
break;
case VOFFLINE:
-#ifndef DJGPP
msgID = MSG_SERVER_REPORTS_VOFFLINE;
-#endif
format = "Server %s reported volume %d as offline.";
break;
case VSALVAGE:
-#ifndef DJGPP
msgID = MSG_SERVER_REPORTS_VSALVAGE;
-#endif
format = "Server %s reported volume %d as needs salvage.";
break;
case VNOSERVICE:
-#ifndef DJGPP
msgID = MSG_SERVER_REPORTS_VNOSERVICE;
-#endif
format = "Server %s reported volume %d as not in service.";
break;
case VIO:
-#ifndef DJGPP
msgID = MSG_SERVER_REPORTS_VIO;
-#endif
format = "Server %s reported volume %d as temporarily unaccessible.";
break;
}
((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24));
osi_Log2(afsd_logp, format, osi_LogSaveString(afsd_logp,addr), fidp->volume);
-#ifndef DJGPP
LogEvent(EVENTLOG_WARNING_TYPE, msgID, addr, fidp->volume);
-#endif
/* Mark server offline for this volume */
if (!serversp) {
((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16),
((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24));
-#ifndef DJGPP
LogEvent(EVENTLOG_WARNING_TYPE, MSG_RX_HARD_DEAD_TIME_EXCEEDED, addr);
-#endif /* !DJGPP */
retry = 0;
osi_Log1(afsd_logp, "cm_Analyze: hardDeadTime exceeded addr[%s]",
long firstError = 0;
int someBusy = 0, someOffline = 0, allOffline = 1, allBusy = 1, allDown = 1;
long timeUsed, timeLeft, hardTimeLeft;
-#ifdef DJGPP
- struct timeval now;
-#endif /* DJGPP */
if (serversp == NULL) {
osi_Log1(afsd_logp, "cm_ConnByMServers returning 0x%x", CM_ERROR_NOSUCHVOLUME);
*connpp = NULL;
-#ifndef DJGPP
timeUsed = (GetTickCount() - reqp->startTime) / 1000;
-#else
- gettimeofday(&now, NULL);
- timeUsed = sub_time(now, reqp->startTime) / 1000;
-#endif
/* leave 5 seconds margin of safety */
timeLeft = ConnDeadtimeout - timeUsed - 5;
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
#include <iphlpapi.h>
-#else
-#include <netdb.h>
-#endif /* !DJGPP */
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
static int daemon_ShutdownFlag = 0;
-#ifndef DJGPP
void cm_IpAddrDaemon(long parm)
{
extern void smb_CheckVCs(void);
}
}
}
-#endif
void cm_BkgDaemon(long parm)
{
lock_InitializeRWLock(&cm_daemonLock, "cm_daemonLock");
osi_EndOnce(&once);
-#ifndef DJGPP
/* creating IP Address Change monitor daemon */
phandle = thrd_Create((SecurityAttrib) 0, 0,
(ThreadFunc) cm_IpAddrDaemon, 0, 0, &pid, "cm_IpAddrDaemon");
osi_assert(phandle != NULL);
thrd_CloseHandle(phandle);
-#endif /* DJGPP */
/* creating pinging daemon */
phandle = thrd_Create((SecurityAttrib) 0, 0,
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
#include <nb30.h>
-#endif /* !DJGPP */
#ifdef COMMENT
#include <malloc.h>
#endif
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
-#endif /* !DJGPP */
#include <string.h>
#include <malloc.h>
#include <osi.h>
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
-#endif /* !DJGPP */
#include <string.h>
#include <stdlib.h>
#include <osi.h>
#include <afs/param.h>
#include <afs/stds.h>
#include <afs/cellconfig.h>
-#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
-#endif
#include "cm_dns_private.h"
#include "cm_dns.h"
#include <lwp.h>
/*extern void afsi_log(char *pattern, ...);*/
static char dns_addr[30];
-#ifdef DJGPP
-extern char cm_confDir[];
-#endif
static int cm_dnsEnabled = -1;
void DNSlowerCase(char *str)
strcpy(dns_addr, addr);
} else {
/* Now check for the AFSDNS.INI file */
-#ifdef DJGPP
- strcpy(configpath, cm_confDir);
-#elif defined(AFS_WIN95_ENV)
- char *path = getenv("AFSCONF");
- if (path) strcpy(configpath, path);
- else strcpy(configpath, "c:\\afscli");
-#else /* nt */
code = GetWindowsDirectory(configpath, sizeof(configpath));
if (code == 0 || code > sizeof(configpath)) return -1;
-#endif
strcat(configpath, "\\afsdns.ini");
/* Currently we only get (and query) the first nameserver. Getting
return (-1);
}
-#ifdef DJGPP
- /* the win95 sock.vxd will not allow sendto for unbound sockets,
- * so just bind to nothing and it works */
-
- __djgpp_set_socket_blocking_mode(commSock, 0);
- bind(commSock,0,sizeof( SOCKADDR_IN ) );
-#endif /* DJGPP */
-
strncpy(query, cellName, 1024);
query[1023] = 0;
if (query[strlen(query)-1] != '.') {
#ifndef __DNS_AFS_private_h_env_
#define __DNS_AFS_private_h_env_
-#ifdef DJGPP
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-/*#else
- #include <windows.h>*/
-#endif
-
#ifdef KERNEL
#define SOCKET struct osi_socket *
#else
#include <string.h>
-#ifdef DJGPP
-
-char *inet_ntoa(struct in_addr in)
-{
- static char out[256];
- char temp[20];
- unsigned long sVal,pVal;
-
- out[0] = '\0';
-
-
- pVal = ntohl(in.s_addr);
-
- sVal = pVal;
- sVal >>= 24;
- sprintf(out,"%ld",sVal);
-
- sVal = pVal;
- sVal <<= 8;
- sVal >>= 24;
- sprintf(out,"%s.%ld",out,sVal);
-
- sVal = pVal;
- sVal <<= 16;
- sVal >>= 24;
- sprintf(out,"%s.%ld",out,sVal);
-
- sVal = pVal;
- sVal <<= 24;
- sVal >>= 24;
- sprintf(out,"%s.%ld",out,sVal);
-
- return(&out[0]);
-}
-
-unsigned long inet_addr(const char *cp)
-{
-
- unsigned long val=0;
- unsigned char sVal;
-
- char cp2[256];
-
- char* ptr = cp2;
- int i;
- int len;
-
- strcpy(cp2,cp);
-
- for (i=0; i<=strlen(cp); i++)
- {
- if (cp2[i] == '.')
- {
- cp2[i] = '\0';
- sVal = atoi(ptr);
- ptr = &cp2[i+1];
- val = val << 8;
- val &= 0xffffff00;
- val |= sVal;
- //printf("%x\t%lx\n",sVal,val);
- };
- };
- sVal = atoi(ptr);
- val = val << 8;
- val &= 0xffffff00;
- val |= sVal;
- //printf("%x\t%lx\n",sVal,val);
-
- return htonl(val);
-}
-
-#endif /* DJGPP */
-
#define BUFSIZE 2048
/*
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <winreg.h>
#include <winsock2.h>
-#else
-#include <netdb.h>
-#endif /* !DJGPP */
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
time_t FakeFreelanceModTime = 0x3b49f6e2;
static int freelance_ShutdownFlag = 0;
-#if !defined(DJGPP)
static HANDLE hFreelanceChangeEvent = 0;
static HANDLE hFreelanceSymlinkChangeEvent = 0;
-#endif
void cm_InitFakeRootDir();
-#if !defined(DJGPP)
void cm_FreelanceChangeNotifier(void * parmp) {
HKEY hkFreelance = 0;
}
}
}
-#endif
void
cm_FreelanceShutdown(void)
{
freelance_ShutdownFlag = 1;
-#if !defined(DJGPP)
if (hFreelanceChangeEvent != 0)
thrd_SetEvent(hFreelanceChangeEvent);
if (hFreelanceSymlinkChangeEvent != 0)
thrd_SetEvent(hFreelanceSymlinkChangeEvent);
-#endif
}
void cm_InitFreelance() {
-#if !defined(DJGPP)
thread_t phandle;
int lpid;
-#endif
lock_InitializeMutex(&cm_Freelance_Lock, "Freelance Lock");
cm_InitFakeRootDir();
// --- end of yj code
-#if !defined(DJGPP)
/* Start the registry monitor */
phandle = thrd_Create(NULL, 65536, (ThreadFunc) cm_FreelanceChangeNotifier,
NULL, 0, &lpid, "cm_FreelanceChangeNotifier");
NULL, 0, &lpid, "cm_FreelanceSymlinkChangeNotifier");
osi_assert(phandle != NULL);
thrd_CloseHandle(phandle);
-#endif
}
/* yj: Initialization of the fake root directory */
char hdir[120];
long code;
char rootCellName[256];
-#if !defined(DJGPP)
HKEY hkFreelance = 0, hkFreelanceSymlinks = 0;
DWORD dwType, dwSize;
DWORD dwMountPoints = 0;
DWORD dwIndex;
DWORD dwSymlinks = 0;
FILETIME ftLastWriteTime;
-#endif
-#if !defined(DJGPP)
if (RegOpenKeyEx( HKEY_LOCAL_MACHINE,
AFSREG_CLT_OPENAFS_SUBKEY "\\Freelance",
0,
RegCloseKey(hkFreelance);
return 0;
}
-#endif
/* What follows is the old code to read freelance mount points
* out of a text file modified to copy the data into the registry
fp = fopen(hdir, "r");
}
-#if !defined(DJGPP)
RegCreateKeyEx( HKEY_LOCAL_MACHINE,
AFSREG_CLT_OPENAFS_SUBKEY "\\Freelance",
0,
&hkFreelance,
NULL);
dwIndex = 0;
-#endif
if (!fp) {
-#if !defined(DJGPP)
RegCloseKey(hkFreelance);
-#endif
rootCellName[0] = '.';
code = cm_GetRootCellName(&rootCellName[1]);
if (code == 0) {
if (t2)
*(t2+1) = '\0';
-#if !defined(DJGPP)
if ( hkFreelance ) {
char szIndex[16];
/* we are migrating to the registry */
dwSize = (DWORD)strlen(line) + 1;
RegSetValueEx( hkFreelance, szIndex, 0, dwType, line, dwSize);
}
-#endif
// line is not empty, so let's parse it
t = strchr(line, '#');
aLocalMountPoint++;
}
fclose(fp);
-#if !defined(DJGPP)
if ( hkFreelance ) {
RegCloseKey(hkFreelance);
DeleteFile(hdir);
}
-#endif
return 0;
}
return cm_noLocalMountPoints;
}
-#if !defined(DJGPP)
long cm_FreelanceMountPointExists(char * filename)
{
char* cp;
return found;
}
-#endif
long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw, cm_fid_t *fidp)
{
char fullname[200];
int n;
int alias = 0;
-#if !defined(DJGPP)
HKEY hkFreelance = 0;
DWORD dwType, dwSize;
DWORD dwMountPoints;
DWORD dwIndex;
-#endif
/* before adding, verify the cell name; if it is not a valid cell,
don't add the mount point.
return -1;
}
-#if !defined(DJGPP)
if ( cm_FreelanceMountPointExists(filename) ||
cm_FreelanceSymlinkExists(filename) )
return -1;
-#endif
osi_Log1(afsd_logp,"Freelance Adding Mount for Cell: %s",
osi_LogSaveString(afsd_logp,cellname));
lock_ObtainMutex(&cm_Freelance_Lock);
-#if !defined(DJGPP)
if (RegOpenKeyEx( HKEY_LOCAL_MACHINE,
AFSREG_CLT_OPENAFS_SUBKEY "\\Freelance",
0,
}
RegCloseKey(hkFreelance);
} else
-#endif
{
cm_GetConfigDir(hfile);
strcat(hfile, AFS_FREELANCE_INI);
char hfile[120], hfile2[120];
FILE *fp1, *fp2;
int found=0;
-#if !defined(DJGPP)
HKEY hkFreelance = 0;
DWORD dwType, dwSize;
DWORD dwMountPoints;
DWORD dwIndex;
-#endif
lock_ObtainMutex(&cm_Freelance_Lock);
-#if !defined(DJGPP)
if (RegOpenKeyEx( HKEY_LOCAL_MACHINE,
AFSREG_CLT_OPENAFS_SUBKEY "\\Freelance",
0,
}
RegCloseKey(hkFreelance);
} else
-#endif
{
cm_GetConfigDir(hfile);
strcat(hfile, AFS_FREELANCE_INI);
char line[512];
char fullname[200];
int alias = 0;
-#if !defined(DJGPP)
HKEY hkFreelanceSymlinks = 0;
DWORD dwType, dwSize;
DWORD dwSymlinks;
DWORD dwIndex;
-#endif
/* before adding, verify the filename. If it is already in use, either as
* as mount point or a cellname, do not permit the creation of the symlink.
return -1;
}
-#if !defined(DJGPP)
if ( cm_FreelanceMountPointExists(filename) ||
cm_FreelanceSymlinkExists(filename) )
return -1;
-#endif
lock_ObtainMutex(&cm_Freelance_Lock);
-#if !defined(DJGPP)
if (RegCreateKeyEx( HKEY_LOCAL_MACHINE,
AFSREG_CLT_OPENAFS_SUBKEY "\\Freelance\\Symlinks",
0,
}
RegCloseKey(hkFreelanceSymlinks);
}
-#endif
lock_ReleaseMutex(&cm_Freelance_Lock);
/* cm_reInitLocalMountPoints(); */
char line[512];
char shortname[200];
int found=0;
-#if !defined(DJGPP)
HKEY hkFreelanceSymlinks = 0;
DWORD dwType, dwSize;
DWORD dwSymlinks;
DWORD dwIndex;
-#endif
lock_ObtainMutex(&cm_Freelance_Lock);
-#if !defined(DJGPP)
if (RegOpenKeyEx( HKEY_LOCAL_MACHINE,
AFSREG_CLT_OPENAFS_SUBKEY "\\Freelance\\Symlinks",
0,
}
RegCloseKey(hkFreelanceSymlinks);
}
-#endif
lock_ReleaseMutex(&cm_Freelance_Lock);
cm_noteLocalMountPointChange();
#include <afs/ptserver.h>
#include <ubik.h>
-#ifndef DJGPP
#include <windows.h>
-#else
-#include <sys/socket.h>
-#endif /* !DJGPP */
#include <errno.h>
#include <stdlib.h>
#include <malloc.h>
#include "smb.h"
#include "cm_server.h"
-#ifndef DJGPP
#include <rx/rxkad.h>
#include "afsrpc.h"
-#else
-#include <rx/rxkad.h>
-#include "afsrpc95.h"
-#endif
#include "cm_rpc.h"
#include <strsafe.h>
*/
void TranslateExtendedChars(char *str)
{
-#ifdef DJGPP
- char *p;
-#endif
-
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,
}
#endif
-#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_data.rootCellp;
osi_Log0(smb_logp,"cm_IoctlSetToken - no name specified");
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.
*/
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++;
/* clear token */
ct.AuthHandle = ucellp->kvno;
-#ifndef DJGPP
/*
* Don't give out a real session key here
*/
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;
cm_ucell_t *ucellp;
struct ClearToken ct;
char *tp;
-#ifndef DJGPP
afs_uuid_t uuid;
-#endif /* !DJGPP */
-
cm_SkipIoctlPath(ioctlp);
tp = ioctlp->inDatap;
return CM_ERROR_NOSUCHCELL;
tp += strlen(tp) + 1;
-#ifndef DJGPP
/* uuid */
memcpy(&uuid, tp, sizeof(uuid));
-#endif /* !DJGPP */
lock_ObtainMutex(&userp->mx);
/* clear token */
ct.AuthHandle = ucellp->kvno;
-#ifndef DJGPP
/*
* Don't give out a real session key here
*/
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;
lock_ReleaseMutex(&userp->mx);
-#ifndef DJGPP
cm_RegisterNewTokenEvent(uuid, ucellp->sessionKey.data);
-#endif /* !DJGPP */
return 0;
}
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 */
-
long cm_IoctlGetSMBName(smb_ioctl_t *ioctlp, cm_user_t *userp)
{
smb_user_t *uidp = ioctlp->uidp;
#include <malloc.h>
#include <osi.h>
-#ifndef DJGPP
#include "afsrpc.h"
-#else
-#include "afsrpc95.h"
-#endif
#include "afsd.h"
#include "afsd_init.h"
#ifndef __CM_RPC_H__
#define __CM_RPC_H__
-#ifndef DJGPP
#include "afsrpc.h"
-#else
-#include "afsrpc95.h"
-#endif
void cm_RegisterNewTokenEvent(afs_uuid_t uuid, char sessionKey[8]);
BOOL cm_FindTokenEvent(afs_uuid_t uuid, char sessionKey[8]);
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
#include <nb30.h>
-#endif /* !DJGPP */
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
#ifndef __CM_SCACHE_H_ENV__
#define __CM_SCACHE_H_ENV__ 1
-#ifdef DJGPP
-#include "largeint95.h"
-#endif /* DJGPP */
-
#define MOUNTPOINTLEN 1024
typedef struct cm_fid {
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
#include <nb30.h>
-#else
-#include <sys/socket.h>
-#endif /* !DJGPP */
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#ifndef __CM_SERVER_H_ENV__
#define __CM_SERVER_H_ENV__ 1
-#ifndef DJGPP
#include <winsock2.h>
-#else /* DJGPP */
-#include <netinet/in.h>
-#endif /* !DJGPP */
#include <osi.h>
/* pointed to by volumes and cells without holds; cm_serverLock is obtained
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
-#endif /* !DJGPP */
#include <malloc.h>
#include <string.h>
#include <afs/stds.h>
#include <errno.h>
-#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
#ifndef EWOULDBLOCK
#define ESTALE WSAESTALE
#define EREMOTE WSAEREMOTE
#endif /* EWOULDBLOCK */
-#endif /* !DJGPP */
#include <afs/unified_afs.h>
#include <string.h>
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
-#endif /* !DJGPP */
#include <stddef.h>
#include <malloc.h>
#include <string.h>
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
#include <nb30.h>
-#else
-#include <sys/socket.h>
-#endif /* !DJGPP */
#include <string.h>
#include <malloc.h>
#include "afsd.h"
nbytes = count; /* don't go past end of request */
/* now copy the data */
-#ifdef DJGPP
- if (dosflag)
- dosmemget((dos_ptr)op, nbytes, bufferp->datap + bufIndex);
- else
-#endif /* DJGPP */
- memcpy(bufferp->datap + bufIndex, op, nbytes);
+ memcpy(bufferp->datap + bufIndex, op, nbytes);
buf_SetDirty(bufferp);
/* and record the last writer */
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <ntstatus.h>
-#else
-#include <sys/timeb.h>
-#include <tzfile.h>
-#endif /* !DJGPP */
#include <stddef.h>
#include <stdlib.h>
#include <malloc.h>
/* for raw I/O */
osi_mutex_t smb_RawBufLock;
-#ifdef DJGPP
-#define SMB_RAW_BUFS 4
-dos_ptr smb_RawBufs;
-int smb_RawBufSel[SMB_RAW_BUFS];
-#else
char *smb_RawBufs;
-#endif /* DJGPP */
#define SMB_MASKFLAG_TILDE 1
#define SMB_MASKFLAG_CASEFOLD 2
long code;
osi_hyper_t offset;
long count;
-#ifndef DJGPP
char *buf;
-#else
- dos_ptr buf;
-#endif /* DJGPP */
int writeMode;
long alreadyWritten;
} raw_write_cont_t;
/* global state about V3 protocols */
int smb_useV3; /* try to negotiate V3 */
-#ifndef DJGPP
static showErrors = 1;
/* MessageBox or something like it */
int (_stdcall *smb_MBfunc)(HWND, LPCTSTR, LPCTSTR, UINT) = NULL;
-#endif /* DJGPP */
/* GMT time info:
* Time in Unix format of midnight, 1/1/1970 local time.
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();
-#ifdef DJGPP
-#ifndef AFS_WIN95_ENV
-DWORD smb_ServerExceptionFilter(void);
-#endif
-
-extern char cm_HostName[];
-extern char cm_confDir[];
-#endif
-
-#ifdef DJGPP
-#define LPTSTR char *
-#define GetComputerName(str, sizep) \
- strcpy((str), cm_HostName); \
- *(sizep) = strlen(cm_HostName)
-#endif /* DJGPP */
#ifdef LOG_PACKET
void smb_LogPacket(smb_packet_t *packet);
return (int)num;
}
-#ifndef DJGPP
void ShowUnixTime(char *FuncName, time_t unixTime)
{
FILETIME ft;
osi_Log1(smb_logp, "%s", osi_LogSaveString(smb_logp, msg));
}
}
-#endif /* DJGPP */
-#ifndef DJGPP
/* Determine if we are observing daylight savings time */
void GetTimeZoneInfo(BOOL *pDST, LONG *pDstBias, LONG *pBias)
{
*/
*pDST = localDST.wHour != local.wHour;
}
-#else
-/* Determine if we are observing daylight savings time */
-void GetTimeZoneInfo(BOOL *pDST, LONG *pDstBias, LONG *pBias)
-{
- struct timeb t;
-
- ftime(&t);
- *pDST = t.dstflag;
- *pDstBias = -60; /* where can this be different? */
- *pBias = t.timezone;
-}
-#endif /* DJGPP */
void CompensateForSmbClientLastWriteTimeBugs(afs_uint32 *pLastWriteTime)
}
#endif /* USE_NUMERIC_TIME_CONV */
-#ifndef DJGPP
#ifdef USE_NUMERIC_TIME_CONV
void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, time_t unixTime)
{
SystemTimeToFileTime(&stm, largeTimep);
}
#endif /* USE_NUMERIC_TIME_CONV */
-#else /* DJGPP */
-void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, time_t unixTime)
-{
- /* unixTime: seconds since 1/1/1970 00:00:00 GMT */
- /* FILETIME: 100ns intervals since 1/1/1601 00:00:00 ??? */
- LARGE_INTEGER *ft = (LARGE_INTEGER *) largeTimep;
- LARGE_INTEGER ut;
- int leap_years = 89; /* leap years betw 1/1/1601 and 1/1/1970 */
-
- /* set ft to number of 100ns intervals betw 1/1/1601 and 1/1/1970 GMT */
- *ft = ConvertLongToLargeInteger(((EPOCH_YEAR-1601) * 365 + leap_years)
- * 24 * 60);
- *ft = LargeIntegerMultiplyByLong(*ft, 60);
- *ft = LargeIntegerMultiplyByLong(*ft, 10000000);
-
- /* add unix time */
- ut = ConvertLongToLargeInteger(unixTime);
- ut = LargeIntegerMultiplyByLong(ut, 10000000);
- *ft = LargeIntegerAdd(*ft, ut);
-}
-#endif /* !DJGPP */
-#ifndef DJGPP
#ifdef USE_NUMERIC_TIME_CONV
void smb_UnixTimeFromLargeSearchTime(time_t *unixTimep, FILETIME *largeTimep)
{
_timezone = save_timezone;
}
#endif /* USE_NUMERIC_TIME_CONV */
-#else /* DJGPP */
-void smb_UnixTimeFromLargeSearchTime(time_t *unixTimep, FILETIME *largeTimep)
-{
- /* unixTime: seconds since 1/1/1970 00:00:00 GMT */
- /* FILETIME: 100ns intervals since 1/1/1601 00:00:00 GMT? */
- LARGE_INTEGER *ft = (LARGE_INTEGER *) largeTimep;
- LARGE_INTEGER a;
- int leap_years = 89;
-
- /* set to number of 100ns intervals betw 1/1/1601 and 1/1/1970 */
- a = ConvertLongToLargeInteger(((EPOCH_YEAR-1601) * 365 + leap_years) * 24 * 60);
- a = LargeIntegerMultiplyByLong(a, 60);
- a = LargeIntegerMultiplyByLong(a, 10000000);
-
- /* subtract it from ft */
- a = LargeIntegerSubtract(*ft, a);
-
- /* divide down to seconds */
- *unixTimep = LargeIntegerDivideByLong(a, 10000000);
-}
-#endif /* !DJGPP */
void smb_SearchTimeFromUnixTime(afs_uint32 *searchTimep, time_t unixTime)
{
void smb_UnixTimeFromDosUTime(time_t *unixTimep, afs_uint32 dosTime)
{
-#ifndef DJGPP
*unixTimep = dosTime + smb_localZero;
-#else /* DJGPP */
- /* dosTime seems to be already adjusted for GMT */
- *unixTimep = dosTime;
-#endif /* !DJGPP */
}
smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana)
char VNComputerName[] = "%COMPUTERNAME%";
char VNLCComputerName[] = "%LCCOMPUTERNAME%";
-#ifdef DJGPP
-/* List available shares */
-int smb_ListShares()
-{
- char sbmtpath[256];
- char pathName[256];
- char shareBuf[4096];
- int num_shares=0;
- char *this_share;
- int len;
- char *p;
- int print_afs = 0;
- int code;
-
- /*strcpy(shareNameList[num_shares], "all");
- strcpy(pathNameList[num_shares++], "/afs");*/
- fprintf(stderr, "The following shares are available:\n");
- fprintf(stderr, "Share Name (AFS Path)\n");
- fprintf(stderr, "---------------------\n");
- fprintf(stderr, "\\\\%s\\%-16s (%s)\n", smb_localNamep, "ALL", cm_mountRoot);
-
-#ifndef DJGPP
- code = GetWindowsDirectory(sbmtpath, sizeof(sbmtpath));
- if (code == 0 || code > sizeof(sbmtpath)) return -1;
-#else
- strcpy(sbmtpath, cm_confDir);
-#endif /* !DJGPP */
- strcat(sbmtpath, "/afsdsbmt.ini");
- len = GetPrivateProfileString("AFS Submounts", NULL, NULL,
- shareBuf, sizeof(shareBuf),
- sbmtpath);
- if (len == 0) {
- return num_shares;
- }
-
- this_share = shareBuf;
- do
- {
- print_afs = 0;
- /*strcpy(shareNameList[num_shares], this_share);*/
- len = GetPrivateProfileString("AFS Submounts", this_share,
- NULL,
- pathName, 256,
- sbmtpath);
- if (!len)
- return num_shares;
- p = pathName;
- if (strncmp(p, cm_mountRoot, strlen(cm_mountRoot)) != 0)
- print_afs = 1;
- while (*p) {
- if (*p == '\\') *p = '/'; /* change to / */
- p++;
- }
-
- fprintf(stderr, "\\\\%s\\%-16s (%s%s)\n",
- smb_localNamep, this_share, (print_afs ? cm_mountRoot : "\0"),
- pathName);
- num_shares++;
- 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;
-}
-#endif /* DJGPP */
typedef struct smb_findShare_rock {
char * shareName;
char *var;
char temp[1024];
DWORD sizeTemp;
-#ifdef DJGPP
- char sbmtpath[MAX_PATH];
-#endif
char *p, *q;
HKEY parmKey;
DWORD code;
return 0;
}
-#ifndef DJGPP
code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_OPENAFS_SUBKEY "\\Submounts",
0, KEY_QUERY_VALUE, &parmKey);
if (code == ERROR_SUCCESS) {
} else {
len = 0;
}
-#else /* DJGPP */
- strcpy(sbmtpath, cm_confDir);
- strcat(sbmtpath, "/afsdsbmt.ini");
- len = GetPrivateProfileString("AFS Submounts", shareName, "",
- pathName, sizeof(pathName), sbmtpath);
-#endif /* !DJGPP */
if (len != 0 && len != sizeof(pathName) - 1) {
/* We can accept either unix or PC style AFS pathnames. Convert
* Unix-style to PC style here for internal use.
static smb_packet_t *GetPacket(void)
{
smb_packet_t *tbp;
-#ifdef DJGPP
- unsigned int npar, seg, tb_sel;
-#endif
lock_ObtainWrite(&smb_globalLock);
tbp = smb_packetFreeListp;
smb_packetFreeListp = tbp->nextp;
lock_ReleaseWrite(&smb_globalLock);
if (!tbp) {
-#ifndef DJGPP
tbp = calloc(65540,1);
-#else /* DJGPP */
- tbp = malloc(sizeof(smb_packet_t));
-#endif /* !DJGPP */
tbp->magic = SMB_PACKETMAGIC;
tbp->ncbp = NULL;
tbp->vcp = NULL;
tbp->flags = 0;
tbp->spacep = NULL;
-#ifdef DJGPP
- npar = SMB_PACKETSIZE >> 4; /* number of paragraphs */
- {
- signed int retval =
- __dpmi_allocate_dos_memory(npar, &tb_sel); /* DOS segment */
- if (retval == -1) {
- osi_Log1(smb_logp, "Cannot allocate %d paragraphs of DOS memory",
- npar);
- osi_panic("",__FILE__,__LINE__);
- }
- else {
- osi_Log2(smb_logp, "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);
{
smb_ncb_t *tbp;
NCB *ncbp;
-#ifdef DJGPP
- unsigned int npar, seg, tb_sel;
-#endif /* DJGPP */
lock_ObtainWrite(&smb_globalLock);
tbp = smb_ncbFreeListp;
smb_ncbFreeListp = tbp->nextp;
lock_ReleaseWrite(&smb_globalLock);
if (!tbp) {
-#ifndef DJGPP
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) {
- osi_Log1(smb_logp, "Cannot allocate %d paragraphs of DOS mem in GetNCB",
- npar);
- osi_panic("",__FILE__,__LINE__);
- } else {
- osi_Log2(smb_logp, "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;
}
memset(&tbp->ncb, 0, sizeof(NCB));
ncbp = &tbp->ncb;
-#ifdef DJGPP
- dos_memset(tbp->dos_ncb, 0, sizeof(NCB));
-#endif /* DJGPP */
return ncbp;
}
parm, parmCount, smbp->ncb_length);
osi_Log3(smb_logp,"Bad SMB param %d out of %d, ncb len %d",
parm, parmCount, smbp->ncb_length);
-#ifndef DJGPP
LogEvent(EVENTLOG_ERROR_TYPE, MSG_BAD_SMB_PARAM,
__FILE__, __LINE__, parm, parmCount, smbp->ncb_length);
-#endif /* !DJGPP */
osi_panic(s, __FILE__, __LINE__);
}
parmDatap = smbp->wctp + (2*parm) + 1;
parm, parmCount, smbp->ncb_length);
osi_Log3(smb_logp,"Bad SMB param %d out of %d, ncb len %d",
parm, parmCount, smbp->ncb_length);
-#ifndef DJGPP
LogEvent(EVENTLOG_ERROR_TYPE, MSG_BAD_SMB_PARAM,
__FILE__, __LINE__, parm, parmCount, smbp->ncb_length);
-#endif /* !DJGPP */
osi_panic(s, __FILE__, __LINE__);
}
parmDatap = smbp->wctp + (2*parm) + 1;
sprintf(s, "Bad SMB param %d offset %d out of %d, ncb len %d",
parm, offset, parmCount, smbp->ncb_length);
-#ifndef DJGPP
LogEvent(EVENTLOG_ERROR_TYPE, MSG_BAD_SMB_PARAM_WITH_OFFSET,
__FILE__, __LINE__, parm, offset, parmCount, smbp->ncb_length);
-#endif /* !DJGPP */
osi_Log4(smb_logp, "Bad SMB param %d offset %d out of %d, ncb len %d",
parm, offset, parmCount, smbp->ncb_length);
osi_panic(s, __FILE__, __LINE__);
long code = 0;
unsigned char *tp;
int localNCB = 0;
-#ifdef DJGPP
- dos_ptr dos_ncb;
-#endif /* DJGPP */
ncbp = inp->ncbp;
if (ncbp == NULL) {
ncbp = GetNCB();
localNCB = 1;
}
-#ifdef DJGPP
- dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb;
-#endif /* DJGPP */
memset((char *)ncbp, 0, sizeof(NCB));
ncbp->ncb_lsn = (unsigned char) vcp->lsn; /* vc to use */
ncbp->ncb_lana_num = vcp->lana;
ncbp->ncb_command = NCBSEND; /* op means send data */
-#ifndef DJGPP
ncbp->ncb_buffer = (char *) inp;/* packet */
code = Netbios(ncbp);
-#else /* DJGPP */
- ncbp->ncb_buffer = inp->dos_pkt;/* packet */
- ((smb_ncb_t*)ncbp)->orig_pkt = inp;
-
- /* copy header information from virtual to DOS address space */
- dosmemput((char*)inp, SMB_PACKETSIZE, inp->dos_pkt);
- code = Netbios(ncbp, dos_ncb);
-#endif /* !DJGPP */
if (code != 0) {
const char * s = ncb_error_string(code);
osi_Log2(smb_logp, "SendPacket failure code %d \"%s\"", code, s);
-#ifndef DJGPP
LogEvent(EVENTLOG_WARNING_TYPE, MSG_SMB_SEND_PACKET_FAILURE, s);
-#endif /* !DJGPP */
lock_ObtainMutex(&vcp->mx);
if (!(vcp->flags & SMB_VCFLAG_ALREADYDEAD)) {
cm_user_t *userp = NULL;
NCB *ncbp;
int rc;
-#ifndef DJGPP
char *rawBuf = NULL;
-#else
- dos_ptr rawBuf = NULL;
- dos_ptr dos_ncb;
-#endif /* DJGPP */
rawBuf = NULL;
finalCount = 0;
if (smb_RawBufs) {
/* Get a raw buf, from head of list */
rawBuf = smb_RawBufs;
-#ifndef DJGPP
smb_RawBufs = *(char **)smb_RawBufs;
-#else /* DJGPP */
- smb_RawBufs = _farpeekl(_dos_ds, smb_RawBufs);
-#endif /* !DJGPP */
}
lock_ReleaseMutex(&smb_RawBufLock);
if (!rawBuf)
if (fidp->flags & SMB_FID_IOCTL)
{
lock_ReleaseMutex(&fidp->mx);
-#ifndef DJGPP
rc = smb_IoctlReadRaw(fidp, vcp, inp, outp);
-#else
- rc = smb_IoctlReadRaw(fidp, vcp, inp, outp, rawBuf);
-#endif
if (rawBuf) {
/* Give back raw buffer */
lock_ObtainMutex(&smb_RawBufLock);
-#ifndef DJGPP
*((char **) rawBuf) = smb_RawBufs;
-#else /* DJGPP */
- _farpokel(_dos_ds, rawBuf, smb_RawBufs);
-#endif /* !DJGPP */
smb_RawBufs = rawBuf;
lock_ReleaseMutex(&smb_RawBufLock);
userp = smb_GetUserFromVCP(vcp, inp);
-#ifndef DJGPP
code = smb_ReadData(fidp, &offset, count, rawBuf, userp, &finalCount);
-#else /* DJGPP */
- /* have to give ReadData flag so it will treat buffer as DOS mem. */
- code = smb_ReadData(fidp, &offset, count, (unsigned char *)rawBuf,
- userp, &finalCount, TRUE /* rawFlag */);
-#endif /* !DJGPP */
if (code != 0)
goto send;
send1:
ncbp = outp->ncbp;
-#ifdef DJGPP
- dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb;
-#endif /* DJGPP */
memset((char *)ncbp, 0, sizeof(NCB));
ncbp->ncb_length = (unsigned short) finalCount;
ncbp->ncb_command = NCBSEND;
ncbp->ncb_buffer = rawBuf;
-#ifndef DJGPP
code = Netbios(ncbp);
-#else /* DJGPP */
- code = Netbios(ncbp, dos_ncb);
-#endif /* !DJGPP */
if (code != 0)
osi_Log1(smb_logp, "ReadRaw send failure code %d", code);
if (rawBuf) {
/* Give back raw buffer */
lock_ObtainMutex(&smb_RawBufLock);
-#ifndef DJGPP
*((char **) rawBuf) = smb_RawBufs;
-#else /* DJGPP */
- _farpokel(_dos_ds, rawBuf, smb_RawBufs);
-#endif /* !DJGPP */
smb_RawBufs = rawBuf;
lock_ReleaseMutex(&smb_RawBufLock);
/*
* smb_ReadData -- common code for Read, Read And X, and Raw Read
*/
-#ifndef DJGPP
long smb_ReadData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count, char *op,
cm_user_t *userp, long *readp)
-#else /* DJGPP */
-long smb_ReadData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count, char *op,
- cm_user_t *userp, long *readp, int dosflag)
-#endif /* !DJGPP */
{
osi_hyper_t offset;
long code = 0;
if (nbytes > count) nbytes = count; /* don't go past EOF */
/* now copy the data */
-#ifdef DJGPP
- if (dosflag)
- dosmemput(bufferp->datap + bufIndex, nbytes, (dos_ptr)op);
- else
-#endif /* DJGPP */
- memcpy(op, bufferp->datap + bufIndex, nbytes);
+ memcpy(op, bufferp->datap + bufIndex, nbytes);
/* adjust counters, pointers, etc. */
op += nbytes;
/*
* smb_WriteData -- common code for Write and Raw Write
*/
-#ifndef DJGPP
long smb_WriteData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count, char *op,
cm_user_t *userp, long *writtenp)
-#else /* DJGPP */
-long smb_WriteData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count, char *op,
- cm_user_t *userp, long *writtenp, int dosflag)
-#endif /* !DJGPP */
{
osi_hyper_t offset;
long code = 0;
nbytes = count; /* don't go past end of request */
/* now copy the data */
-#ifdef DJGPP
- if (dosflag)
- dosmemget((dos_ptr)op, nbytes, bufferp->datap + bufIndex);
- else
-#endif /* DJGPP */
- memcpy(bufferp->datap + bufIndex, op, nbytes);
+ memcpy(bufferp->datap + bufIndex, op, nbytes);
buf_SetDirty(bufferp);
/* and record the last writer */
code = 0;
while ( code == 0 && count > 0 ) {
-#ifndef DJGPP
code = smb_WriteData(fidp, &offset, count, op, userp, &written);
-#else /* DJGPP */
- code = smb_WriteData(fidp, &offset, count, op, userp, &written, FALSE);
-#endif /* !DJGPP */
if (code == 0 && written == 0)
code = CM_ERROR_PARTIALWRITE;
unsigned short fd;
smb_fid_t *fidp;
cm_user_t *userp;
-#ifndef DJGPP
char *rawBuf;
-#else /* DJGPP */
- dos_ptr rawBuf;
-#endif /* !DJGPP */
long written = 0;
long code = 0;
userp = smb_GetUserFromVCP(vcp, inp);
-#ifndef DJGPP
rawBuf = rwcp->buf;
code = smb_WriteData(fidp, &rwcp->offset, rwcp->count, rawBuf, userp,
&written);
-#else /* DJGPP */
- rawBuf = (dos_ptr) rwcp->buf;
- code = smb_WriteData(fidp, &rwcp->offset, rwcp->count,
- (unsigned char *) rawBuf, userp,
- &written, TRUE);
-#endif /* !DJGPP */
-
if (rwcp->writeMode & 0x1) { /* synchronous */
smb_t *op;
/* Give back raw buffer */
lock_ObtainMutex(&smb_RawBufLock);
-#ifndef DJGPP
*((char **)rawBuf) = smb_RawBufs;
-#else /* DJGPP */
- _farpokel(_dos_ds, rawBuf, smb_RawBufs);
-#endif /* !DJGPP */
smb_RawBufs = rawBuf;
lock_ReleaseMutex(&smb_RawBufLock);
cm_user_t *userp;
char *op;
unsigned short writeMode;
-#ifndef DJGPP
char *rawBuf;
-#else /* DJGPP */
- dos_ptr rawBuf;
-#endif /* !DJGPP */
-
fd = smb_GetSMBParm(inp, 0);
totalCount = smb_GetSMBParm(inp, 1);
count = smb_GetSMBParm(inp, 10);
code = 0;
while ( code == 0 && count > 0 ) {
-#ifndef DJGPP
code = smb_WriteData(fidp, &offset, count, op, userp, &written);
-#else /* DJGPP */
- code = smb_WriteData(fidp, &offset, count, op, userp, &written, FALSE);
-#endif /* !DJGPP */
if (code == 0 && written == 0)
code = CM_ERROR_PARTIALWRITE;
if (smb_RawBufs) {
/* Get a raw buf, from head of list */
rawBuf = smb_RawBufs;
-#ifndef DJGPP
smb_RawBufs = *(char **)smb_RawBufs;
-#else /* DJGPP */
- smb_RawBufs = _farpeekl(_dos_ds, smb_RawBufs);
-#endif /* !DJGPP */
}
else
code = CM_ERROR_USESTD;
*op++ = (unsigned char) (count & 0xff);
*op++ = (unsigned char) ((count >> 8) & 0xff);
-#ifndef DJGPP
code = smb_ReadData(fidp, &offset, count, op, userp, &finalCount);
-#else /* DJGPP */
- code = smb_ReadData(fidp, &offset, count, op, userp, &finalCount, FALSE);
-#endif /* !DJGPP */
/* fix some things up */
smb_SetSMBParm(outp, 0, finalCount);
/* Sanity check */
if (ncbp->ncb_length < offsetof(struct smb, vdata)) {
/* log it and discard it */
-#ifndef DJGPP
LogEvent(EVENTLOG_WARNING_TYPE, MSG_BAD_SMB_TOO_SHORT,
__FILE__, __LINE__, ncbp->ncb_length);
-#endif /* !DJGPP */
osi_Log1(smb_logp, "SMB message too short, len %d", ncbp->ncb_length);
return;
}
if (oldGen != sessionGen) {
newTime = GetTickCount();
-#ifndef DJGPP
LogEvent(EVENTLOG_WARNING_TYPE, MSG_BAD_SMB_WRONG_SESSION,
newTime - oldTime, ncbp->ncb_length);
-#endif /* !DJGPP */
osi_Log2(smb_logp, "Pkt straddled session startup, "
"took %d ms, ncb length %d", newTime - oldTime, ncbp->ncb_length);
}
smb_LogPacket(inp);
#endif /* LOG_PACKET */
-#ifndef DJGPP
if (showErrors) {
sprintf(tbuffer, "Received bad SMB req 0x%x", inp->inCom);
code = (*smb_MBfunc)(NULL, tbuffer, "Cancel: don't show again",
if (code == IDCANCEL)
showErrors = 0;
}
-#endif /* DJGPP */
code = CM_ERROR_BADOP;
}
/* catastrophic failure: log as much as possible */
if (code == CM_ERROR_BADSMB) {
-#ifndef DJGPP
LogEvent(EVENTLOG_WARNING_TYPE, MSG_BAD_SMB_INVALID,
ncbp->ncb_length);
-#endif /* !DJGPP */
#ifdef LOG_PACKET
smb_LogPacket(inp);
#endif /* LOG_PACKET */
return;
}
-#ifndef DJGPP
/* Wait for Netbios() calls to return, and make the results available to server
* threads. Note that server threads can't wait on the NCBevents array
* themselves, because NCB events are manual-reset, and the servers would race
thrd_SetEvent(NCBreturns[0][idx]);
}
}
-#endif /* !DJGPP */
/*
* Try to have one NCBRECV request waiting for every live session. Not more
DWORD code;
int idx_session, idx_NCB;
NCB *ncbp;
-#ifdef DJGPP
- dos_ptr dos_ncb;
-#endif /* DJGPP */
while (smbShutdownFlag == 0) {
/* Get a session */
ncbp->ncb_lsn = (unsigned char) LSNs[idx_session];
ncbp->ncb_command = NCBRECV | ASYNCH;
ncbp->ncb_lana_num = lanas[idx_session];
-#ifndef DJGPP
ncbp->ncb_buffer = (unsigned char *) bufs[idx_NCB];
ncbp->ncb_event = NCBevents[idx_NCB];
ncbp->ncb_length = SMB_PACKETSIZE;
Netbios(ncbp);
-#else /* DJGPP */
- ncbp->ncb_buffer = bufs[idx_NCB]->dos_pkt;
- ((smb_ncb_t*)ncbp)->orig_pkt = bufs[idx_NCB];
- ncbp->ncb_event = NCBreturns[0][idx_NCB];
- ncbp->ncb_length = SMB_PACKETSIZE;
- dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb;
- Netbios(ncbp, dos_ncb);
-#endif /* !DJGPP */
}
}
UCHAR rc;
smb_vc_t *vcp = NULL;
smb_t *smbp;
-#ifdef DJGPP
- dos_ptr dos_ncb;
-#endif /* DJGPP */
rx_StartClientThread();
}
ncbp = NCBs[idx_NCB];
-#ifdef DJGPP
- dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb;
-#endif /* DJGPP */
idx_session = NCBsessions[idx_NCB];
rc = ncbp->ncb_retcode;
case NRC_SNUMOUT:
case NRC_SABORT:
-#ifndef DJGPP
LogEvent(EVENTLOG_WARNING_TYPE, MSG_UNEXPECTED_SMB_SESSION_CLOSE, ncb_error_string(rc));
/* fallthrough */
-#endif /* !DJGPP */
case NRC_SCLOSED:
/* Client closed session */
vcp = smb_FindVC(ncbp->ncb_lsn, 0, lanas[idx_session]);
case NRC_INCOMP:
/* Treat as transient error */
-#ifndef DJGPP
LogEvent(EVENTLOG_WARNING_TYPE, MSG_BAD_SMB_INCOMPLETE,
ncbp->ncb_length);
-#endif /* !DJGPP */
osi_Log1(smb_logp,
"dispatch smb recv failed, message incomplete, ncb_length %d",
ncbp->ncb_length);
vcp->errorCount = 0;
bufp = (struct smb_packet *) ncbp->ncb_buffer;
-#ifdef DJGPP
- bufp = ((smb_ncb_t *) ncbp)->orig_pkt;
- /* copy whole packet to virtual memory */
- /*fprintf(stderr, "smb_Server: copying dos packet at 0x%x, "
- "bufp=0x%x\n",
- bufp->dos_pkt / 16, bufp);*/
- fflush(stderr);
- dosmemget(bufp->dos_pkt, ncbp->ncb_length, bufp->data);
-#endif /* DJGPP */
smbp = (smb_t *)bufp->data;
outbufp->flags = 0;
-#if !defined(DJGPP) && !defined(AFS_WIN32_ENV)
__try
{
-#endif
if (smbp->com == 0x1d) {
/* Special handling for Write Raw */
raw_write_cont_t rwc;
ncbp->ncb_buffer = rwc.buf;
ncbp->ncb_length = 65535;
ncbp->ncb_event = rwevent;
-#ifndef DJGPP
Netbios(ncbp);
-#else
- Netbios(ncbp, dos_ncb);
-#endif /* !DJGPP */
rcode = thrd_WaitForSingleObject_Event(rwevent, RAWTIMEOUT);
thrd_CloseHandle(rwevent);
}
/* TODO: what else needs to be serialized? */
smb_DispatchPacket(vcp, bufp, outbufp, ncbp, NULL);
}
-#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
}
__except( smb_ServerExceptionFilter() ) {
}
-#endif
smb_concurrentCalls--;
* force trace and give control to upstream exception handlers. Useful for
* debugging.
*/
-#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
DWORD smb_ServerExceptionFilter(void) {
/* While this is not the best time to do a trace, if it succeeds, then
* we have a trace (assuming tracing was enabled). Otherwise, this should
buf_ForceTrace(TRUE);
return EXCEPTION_CONTINUE_SEARCH;
}
-#endif
/*
* Create a new NCB and associated events, packet buffer, and "space" buffer.
NCBavails[idx] = thrd_CreateEvent(NULL, FALSE, TRUE, eventName);
if ( GetLastError() == ERROR_ALREADY_EXISTS )
osi_Log1(smb_logp, "Event Object Already Exists: %s", osi_LogSaveString(smb_logp, eventName));
-#ifndef DJGPP
sprintf(eventName,"NCBevents[%d]", idx);
NCBevents[idx] = thrd_CreateEvent(NULL, TRUE, FALSE, eventName);
if ( GetLastError() == ERROR_ALREADY_EXISTS )
osi_Log1(smb_logp, "Event Object Already Exists: %s", osi_LogSaveString(smb_logp, eventName));
-#endif /* !DJGPP */
sprintf(eventName,"NCBReturns[0<=i<smb_NumServerThreads][%d]", idx);
retHandle = thrd_CreateEvent(NULL, FALSE, FALSE, eventName);
if ( GetLastError() == ERROR_ALREADY_EXISTS )
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;
-#endif /* DJGPP */
INT_PTR lana = (INT_PTR) parmp;
ncbp = GetNCB();
-#ifdef DJGPP
- dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb;
-#endif /* DJGPP */
/* retrieve computer name */
GetComputerName(cname, &cnamelen);
ncbp->ncb_lana_num = (UCHAR)lana;
-#ifndef DJGPP
code = Netbios(ncbp);
-#else /* DJGPP */
- code = Netbios(ncbp, dos_ncb);
-#endif
if (code != 0)
{
-#ifndef DJGPP
char tbuffer[256];
-#endif
/* terminate silently if shutdown flag is set */
if (smbShutdownFlag == 1) {
-#ifndef DJGPP
ExitThread(1);
-#else
- thrd_Exit(1);
-#endif
}
osi_Log2(smb_logp,
osi_Log0(smb_logp,
"Client exiting due to network failure. Please restart client.\n");
-#ifndef DJGPP
sprintf(tbuffer,
"Client exiting due to network failure. Please restart client.\n"
"NCBLISTEN lana=%d failed with code %d",
MB_OK|MB_SERVICE_NOTIFICATION);
osi_assert(tbuffer);
ExitThread(1);
-#else
- fprintf(stderr, "NCBLISTEN lana=%d failed with code %d\n",
- ncbp->ncb_lana_num, code);
- fprintf(stderr, "\nClient exiting due to network failure "
- "(possibly due to power-saving mode)\n");
- fprintf(stderr, "Please restart client.\n");
- afs_exit(AFS_EXITCODE_NETWORK_FAILURE);
-#endif /* !DJGPP */
}
/* check for remote conns */
ncbp->ncb_lsn,ncbp->ncb_lana_num, osi_LogSaveString(smb_logp, rname), ongoingOps);
if (reportSessionStartups) {
-#ifndef DJGPP
LogEvent(EVENTLOG_INFORMATION_TYPE, MSG_SMB_SESSION_START, ongoingOps);
-#else /* DJGPP */
- time(&now);
- fprintf(stderr, "%s: New session %d starting from host %s\n",
- asctime(localtime(&now)), ncbp->ncb_lsn, rname);
- fflush(stderr);
-#endif /* !DJGPP */
}
lock_ObtainMutex(&vcp->mx);
ncbp->ncb_lsn,ncbp->ncb_lana_num, osi_LogSaveString(smb_logp, rname), ongoingOps);
if (reportSessionStartups) {
-#ifndef DJGPP
LogEvent(EVENTLOG_INFORMATION_TYPE, MSG_SMB_SESSION_START, ongoingOps);
-#else /* DJGPP */
- time(&now);
- fprintf(stderr, "%s: Re-using session %d starting from host %s\n",
- asctime(localtime(&now)), ncbp->ncb_lsn, rname);
- fflush(stderr);
-#endif /* !DJGPP */
}
}
void smb_NetbiosInit()
{
NCB *ncbp;
-#ifdef DJGPP
- dos_ptr dos_ncb;
-#endif /* DJGPP */
int i, lana, code, l;
char s[100];
int delname_tried=0;
/* setup the NCB system */
ncbp = GetNCB();
-#ifdef DJGPP
- dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb;
-#endif /* DJGPP */
-#ifndef DJGPP
if (smb_LANadapter == -1) {
ncbp->ncb_command = NCBENUM;
ncbp->ncb_buffer = (PUCHAR)&lana_list;
afsi_log("Netbios NCBRESET lana %d succeeded", lana_list.lana[i]);
}
}
-#else
- /* for DJGPP, there is no NCBENUM and NCBRESET is a real reset. so
- we will just fake the LANA list */
- if (smb_LANadapter == -1) {
- for (i = 0; i < 8; i++)
- lana_list.lana[i] = i;
- lana_list.length = 8;
- }
- else {
- lana_list.length = 1;
- lana_list.lana[0] = smb_LANadapter;
- }
-#endif /* !DJGPP */
/* and declare our name so we can receive connections */
memset(ncbp, 0, sizeof(*ncbp));
ncbp->ncb_command = NCBADDNAME;
ncbp->ncb_lana_num = lana;
memcpy(ncbp->ncb_name,smb_sharename,NCBNAMSZ);
-#ifndef DJGPP
code = Netbios(ncbp);
-#else /* DJGPP */
- code = Netbios(ncbp, dos_ncb);
-#endif /* !DJGPP */
afsi_log("Netbios NCBADDNAME lana=%d code=%d retcode=%d complete=%d",
lana, code, ncbp->ncb_retcode, ncbp->ncb_cmd_cplt);
if (code == 0) code = ncbp->ncb_retcode;
if (code == 0) {
afsi_log("Netbios NCBADDNAME succeeded on lana %d\n", lana);
-#ifdef DJGPP
- /* we only use one LANA with djgpp */
- lana_list.lana[0] = lana;
- lana_list.length = 1;
-#endif
}
else {
afsi_log("Netbios NCBADDNAME lana %d error code %d", lana, code);
ncbp->ncb_command = NCBDELNAME;
memcpy(ncbp->ncb_name,smb_sharename,NCBNAMSZ);
ncbp->ncb_lana_num = lana;
-#ifndef DJGPP
code = Netbios(ncbp);
-#else
- code = Netbios(ncbp, dos_ncb);
-#endif /* DJGPP */
if (code == 0)
code = ncbp->ncb_retcode;
else {
}
if (code == 0) {
lana_found = 1; /* at least one worked */
-#ifdef DJGPP
- break;
-#endif
}
}
void smb_Init(osi_log_t *logp, char *snamep, int useV3, int LANadapt,
int nThreads
-#ifndef DJGPP
, void *aMBfunc
-#endif
)
{
INT_PTR i;
int len;
struct tm myTime;
-#ifdef DJGPP
- int npar, seg, sel;
- dos_ptr rawBuf;
-#endif /* DJGPP */
EVENT_HANDLE retHandle;
char eventName[MAX_PATH];
smb_TlsRequestSlot = TlsAlloc();
-#ifndef DJGPP
smb_MBfunc = aMBfunc;
-#endif /* DJGPP */
smb_useV3 = useV3;
smb_LANadapter = LANadapt;
lock_InitializeMutex(&smb_ListenerLock, "smb listener lock");
/* 4 Raw I/O buffers */
-#ifndef DJGPP
smb_RawBufs = calloc(65536,1);
*((char **)smb_RawBufs) = NULL;
for (i=0; i<3; i++) {
*((char **)rawBuf) = smb_RawBufs;
smb_RawBufs = rawBuf;
}
-#else /* DJGPP */
- npar = 65536 >> 4; /* number of paragraphs */
- seg = __dpmi_allocate_dos_memory(npar, &smb_RawBufSel[0]);
- if (seg == -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, seg);
- }
- smb_RawBufs = (seg * 16) + 0; /* DOS physical address */
-
- _farpokel(_dos_ds, smb_RawBufs, NULL);
- for (i=0; i<SMB_RAW_BUFS-1; i++) {
- npar = 65536 >> 4; /* number of paragraphs */
- seg = __dpmi_allocate_dos_memory(npar, &smb_RawBufSel[i+1]);
- if (seg == -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, seg);
- }
- rawBuf = (seg * 16) + 0; /* DOS physical address */
- /*_farpokel(_dos_ds, smb_RawBufs, smb_RawBufs);*/
- _farpokel(_dos_ds, rawBuf, smb_RawBufs);
- smb_RawBufs = rawBuf;
- }
-#endif /* !DJGPP */
/* global free lists */
smb_ncbFreeListp = NULL;
thrd_CloseHandle(phandle);
}
-#ifndef DJGPP
phandle = thrd_Create(NULL, 65536, (ThreadFunc) smb_ClientWaiter,
NULL, 0, &lpid, "smb_ClientWaiter");
osi_assert(phandle != NULL);
thrd_CloseHandle(phandle);
-#endif /* !DJGPP */
phandle = thrd_Create(NULL, 65536, (ThreadFunc) smb_ServerWaiter,
NULL, 0, &lpid, "smb_ServerWaiter");
osi_assert(phandle != NULL);
thrd_CloseHandle(phandle);
-#ifdef DJGPP
- smb_ListShares();
-#endif
-
return;
}
void smb_Shutdown(void)
{
NCB *ncbp;
-#ifdef DJGPP
- dos_ptr dos_ncb;
-#endif
long code = 0;
int i;
smb_vc_t *vcp;
/* setup the NCB system */
ncbp = GetNCB();
-#ifdef DJGPP
- dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb;
-#endif
/* Block new sessions by setting shutdown flag */
smbShutdownFlag = 1;
ncbp->ncb_command = NCBHANGUP;
ncbp->ncb_lana_num = lanas[i]; /*smb_LANadapter;*/
ncbp->ncb_lsn = (UCHAR)LSNs[i];
-#ifndef DJGPP
code = Netbios(ncbp);
-#else
- code = Netbios(ncbp, dos_ncb);
-#endif
/*fprintf(stderr, "returned from NCBHANGUP session %d LSN %d\n", i, LSNs[i]);*/
if (code == 0) code = ncbp->ncb_retcode;
if (code != 0) {
ncbp->ncb_command = NCBDELNAME;
ncbp->ncb_lana_num = lana_list.lana[i];
memcpy(ncbp->ncb_name,smb_sharename,NCBNAMSZ);
-#ifndef DJGPP
code = Netbios(ncbp);
-#else
- code = Netbios(ncbp, dos_ncb);
-#endif
if (code == 0)
code = ncbp->ncb_retcode;
if (code != 0) {
#ifndef __SMB_H_ENV__
#define __SMB_H_ENV__ 1
-#ifdef DJGPP
-#include "netbios95.h"
-#endif /* DJGPP */
-
#include <ntsecapi.h>
/* Support largefiles by default */
unsigned char oddByte;
unsigned short ncb_length;
unsigned char flags;
-#ifdef DJGPP
- dos_ptr dos_pkt;
- unsigned int dos_pkt_sel;
-#endif /* DJGPP */
} smb_packet_t;
/* smb_packet flags */
NCB ncb; /* ncb to use */
struct myncb *nextp; /* when on free list */
long magic;
-#ifdef DJGPP
- dos_ptr dos_ncb;
- smb_packet_t *orig_pkt;
- unsigned int dos_ncb_sel;
-#endif /* DJGPP */
} smb_ncb_t;
/* structures representing environments from kernel / SMB network.
extern void smb_Init(osi_log_t *logp, char *smbNamep, int useV3, int LANadapt,
int nThreads
-#ifndef DJGPP
, void *aMBfunc
-#endif
);
extern void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, time_t unixTime);
extern int smb_SUser(cm_user_t *userp);
-#ifndef DJGPP
long smb_WriteData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count, char *op,
cm_user_t *userp, long *writtenp);
-#else /* DJGPP */
-long smb_WriteData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count, char *op,
- cm_user_t *userp, long *writtenp, int dosflag);
-#endif /* !DJGPP */
-#ifndef DJGPP
extern long smb_ReadData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count,
char *op, cm_user_t *userp, long *readp);
-#else /* DJGPP */
-extern long smb_ReadData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count,
- char *op, cm_user_t *userp, long *readp, int dosflag);
-#endif /* !DJGPP */
extern long smb_Rename(smb_vc_t *vcp, smb_packet_t *inp, char *oldPathp, char *newPathp, int attrs);
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <ntstatus.h>
#define SECURITY_WIN32
#include <security.h>
#include <lmaccess.h>
-#endif /* !DJGPP */
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
/* We sometimes see 0 word count. What to do? */
if (*inp->wctp == 0) {
osi_Log0(smb_logp, "Transaction2 word count = 0");
-#ifndef DJGPP
LogEvent(EVENTLOG_WARNING_TYPE, MSG_SMB_ZERO_TRANSACTION_COUNT);
-#endif /* !DJGPP */
smb_SetSMBDataLength(outp, 0);
smb_SendPacket(vcp, outp);
/* We sometimes see 0 word count. What to do? */
if (*inp->wctp == 0) {
osi_Log0(smb_logp, "Transaction2 word count = 0");
-#ifndef DJGPP
LogEvent(EVENTLOG_WARNING_TYPE, MSG_SMB_ZERO_TRANSACTION_COUNT);
-#endif /* !DJGPP */
smb_SetSMBDataLength(outp, 0);
smb_SendPacket(vcp, outp);
code = 0;
while ( code == 0 && count > 0 ) {
-#ifndef DJGPP
code = smb_WriteData(fidp, &offset, count, op, userp, &written);
-#else /* DJGPP */
- code = smb_WriteData(fidp, &offset, count, op, userp, &written, FALSE);
-#endif /* !DJGPP */
if (code == 0 && written == 0)
code = CM_ERROR_PARTIALWRITE;
/* set the packet data length the count of the # of bytes */
smb_SetSMBDataLength(outp, count);
-#ifndef DJGPP
code = smb_ReadData(fidp, &offset, count, op, userp, &finalCount);
-#else /* DJGPP */
- code = smb_ReadData(fidp, &offset, count, op, userp, &finalCount, FALSE);
-#endif /* !DJGPP */
/* fix some things up */
smb_SetSMBParm(outp, 5, finalCount);
/* SMB auth related functions */
extern void smb_NegotiateExtendedSecurity(void ** secBlob, int * secBlobLength);
-#ifdef DJGPP
-#define DELETE (0x00010000)
-#define READ_CONTROL (0x00020000)
-#define SYNCHRONIZE (0x00100000)
-#define FILE_WRITE_ATTRIBUTES ( 0x0100 )
-#define FILE_GENERIC_READ (0x00120089)
-#define FILE_GENERIC_WRITE (0x00120116)
-#define FILE_GENERIC_EXECUTE (0x001200a0)
-#endif /* DJGPP */
-
#endif /* __SMB3_H_ENV__ */
#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_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;
smb_ioctlProcsp[VIOC_FLUSHALL] = cm_IoctlFlushAllVolumes;
/* 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
-#ifdef DJGPP
- , dos_ptr rawBuf
-#endif /* DJGPP */
)
{
smb_ioctl_t *iop;
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;
/*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);
extern long smb_IoctlV3Read(smb_fid_t *fidp, smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
-#ifndef DJGPP
extern long smb_IoctlReadRaw(smb_fid_t *fidp, smb_vc_t *vcp, smb_packet_t *inp,
smb_packet_t *outp);
-#else /* DJGPP */
-extern long smb_IoctlReadRaw(smb_fid_t *fidp, smb_vc_t *vcp, smb_packet_t *inp,
- smb_packet_t *outp, dos_ptr rawBuf);
-#endif /* !DJGPP */
#endif /* __SMB_IOCTL_H_ENV__ */
/* misc definitions */
/* large int */
-#ifndef DJGPP
#include <rpc.h>
#if !defined(_MSC_VER) || (_MSC_VER < 1300)
#include "largeint.h"
#endif
#include "osithrdnt.h"
-#else /* DJGPP */
-#include "largeint95.h"
-#endif /* !DJGPP */
typedef LARGE_INTEGER osi_hyper_t;
#if _MSC_VER >= 1300
#define LargeIntegerNotEqualToZero(a) ((a).HighPart || (a).LowPart)
#endif
-#ifndef DJGPP
typedef GUID osi_uid_t;
-#else /* DJGPP */
-typedef int osi_uid_t;
-#endif /* !DJGPP */
typedef int int32;
-#ifndef DJGPP
/* basic util functions */
#include "osiutils.h"
/* lock type definitions */
#include "osiltype.h"
-#endif /* !DJGPP */
/* basic sleep operations */
#include "osisleep.h"
-#ifndef DJGPP
/* base lock definitions */
#include "osibasel.h"
/* RPC debug stuff */
#include "osidb.h"
-#else /* DJGPP */
-#include "osithrd95.h"
-#endif /* !DJGPP */
/* log stuff */
#include "osilog.h"
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <rpc.h>
#include "dbrpc.h"
-#endif /* !DJGPP */
#include <malloc.h>
#include "osi.h"
#include <assert.h>
osi_fdOps_t osi_TypeFDOps = {
osi_FDTypeCreate,
-#ifndef DJGPP
osi_FDTypeGetInfo,
-#endif
osi_FDTypeClose
};
}
-#ifndef DJGPP
long osi_FDTypeGetInfo(osi_fd_t *ifdp, osi_remGetInfoParms_t *outp)
{
osi_typeFD_t *fdp;
return OSI_DBRPC_EOF;
}
}
-#endif /* !DJGPP */
long osi_FDTypeClose(osi_fd_t *ifdp)
{
#ifndef _OSIFD_H_ENV_
#define _OSIFD_H_ENV_ 1
-#ifndef DJGPP
#include "dbrpc.h"
-#endif /* !DJGPP */
#include "osiqueue.h"
struct osi_fd;
*/
long (*Create)(struct osi_fdType *, struct osi_fd **);
-#ifndef DJGPP
/* gets info about the object; fields are type specific, and eventually
* self-labelling
*/
long (*GetInfo)(struct osi_fd *, osi_remGetInfoParms_t *);
-#endif
/* close an object; frees the storage associated with it */
long (*Close)(struct osi_fd *);
extern long osi_FDTypeCreate(osi_fdType_t *, osi_fd_t **);
-#ifndef DJGPP
extern long osi_FDTypeGetInfo(osi_fd_t *, osi_remGetInfoParms_t *);
-#endif
extern long osi_FDTypeClose(osi_fd_t *);
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
#include <rpc.h>
-#endif /* !DJGPP */
#include <malloc.h>
#include "osi.h"
-#ifndef DJGPP
#include "dbrpc.h"
-#endif /* !DJGPP */
#include <stdio.h>
#include <assert.h>
#include <WINNT\afsreg.h>
osi_fdOps_t osi_logFDOps = {
osi_LogFDCreate,
-#ifndef DJGPP
osi_LogFDGetInfo,
-#endif
osi_LogFDClose
};
LARGE_INTEGER bigTemp;
LARGE_INTEGER bigJunk;
-#ifndef DJGPP
if (osi_Once(&osi_logOnce)) {
QueryPerformanceFrequency(&bigFreq);
if (bigFreq.LowPart == 0 && bigFreq.HighPart == 0)
/* done with init */
osi_EndOnce(&osi_logOnce);
}
-#endif /* !DJGPP */
logp = malloc(sizeof(osi_log_t));
memset(logp, 0, sizeof(osi_log_t));
strcpy(tbuffer, "log:");
strcat(tbuffer, namep);
typep = osi_RegisterFDType(tbuffer, &osi_logFDOps, logp);
-#ifndef DJGPP
if (typep) {
/* add formatting info */
osi_AddFDFormatInfo(typep, OSI_DBRPC_REGIONINT, 0,
osi_AddFDFormatInfo(typep, OSI_DBRPC_REGIONSTRING, 1,
"Time (mics)", 0);
}
-#endif
return logp;
}
lep->tid = thrd_Current();
/* get the time, using the high res timer if available */
-#ifndef DJGPP
if (osi_logFreq) {
QueryPerformanceCounter(&bigTime);
lep->micros = (bigTime.LowPart / osi_logFreq) * osi_logTixToMicros;
}
else lep->micros = GetCurrentTime() * 1000;
-#else
- lep->micros = gettime_us();
-#endif /* !DJGPP */
lep->formatp = formatp;
lep->parms[0] = p0;
lep->micros / 1000000,
lep->micros % 1000000,
lep->tid, msg);
-#ifndef DJGPP
if (!WriteFile(handle, wholemsg, strlen(wholemsg),
&ioCount, NULL))
-#else /* DJGPP */
- if ((ioCount = fwrite(wholemsg, 1, strlen(wholemsg), handle)) == 0)
-#endif /* !DJGPP */
break;
}
return 0;
}
-#ifndef DJGPP
long osi_LogFDGetInfo(osi_fd_t *ifd, osi_remGetInfoParms_t *outp)
{
osi_logFD_t *lfdp;
thrd_LeaveCrit(&logp->cs);
return 0;
}
-#endif /* !DJGPP */
long osi_LogFDClose(osi_fd_t *ifdp)
{
#define _OSI_LOG_H__ 1
#include "osi.h"
-#ifndef DJGPP
#include "osisleep.h"
#include "osibasel.h"
#include "osistatl.h"
-#endif /* !DJGPP */
#include "osifd.h"
#include "osiqueue.h"
extern long osi_LogFDCreate(osi_fdType_t *, osi_fd_t **);
-#ifndef DJGPP
extern long osi_LogFDGetInfo(osi_fd_t *, osi_remGetInfoParms_t *);
-#endif
extern long osi_LogFDClose(osi_fd_t *);
#include <afs/param.h>
#include <afs/stds.h>
-#ifndef DJGPP
#include <windows.h>
-#endif /* !DJGPP */
#include "osi.h"
#include <stdlib.h>
/*#include "osi.h"*/
#include "osifd.h"
#include "osiqueue.h"
-#ifdef DJGPP
-#include "osithrd95.h"
-#endif /* DJGPP */
/* states bits */
#define OSI_SLEEPINFO_SIGNALLED 1 /* this sleep structure has been signalled */
/* struct for single-shot initialization support */
typedef struct osi_once {
-#ifndef DJGPP
long atomic; /* used for atomicity */
-#else
- osi_mutex_t atomic; /* used for atomicity */
-#endif /* !DJGPP */
int done; /* tells if initialization is done */
} osi_once_t;
/* spin lock version of wakeup, used internally only */
extern void osi_WakeupSpin(LONG_PTR value);
-#ifndef DJGPP
/* exported function to sleep on a value */
extern void osi_Sleep (LONG_PTR);
-#endif
extern void osi_FreeSleepInfo(osi_sleepInfo_t *);
extern void osi_EndOnce(osi_once_t *);
-#ifndef DJGPP
/* exported function to wakeup those sleeping on a value */
extern void osi_Wakeup (LONG_PTR);
extern void osi_Init (void);
-#endif /* !DJGPP */
/* create a ptr to a cookie */
osi_sleepFD_t *osi_CreateSleepCookie(void);
/* functions for the sleep FD implementation */
extern long osi_SleepFDCreate(osi_fdType_t *, osi_fd_t **);
-#ifndef DJGPP
extern long osi_SleepFDGetInfo(osi_fd_t *, osi_remGetInfoParms_t *);
-#endif
extern long osi_SleepFDClose(osi_fd_t *);
/* functions for getting hash sizes */
#endif
#else /* AFS_XBSD_ENV */
-#if defined(AFS_LINUX20_ENV) || defined(AFS_DJGPP_ENV)
+#if defined(AFS_LINUX20_ENV)
#ifdef AFS_PARISC_LINUX20_ENV
#include "conf-parisc-linux.h"
#else
*
* Note: this routine calls des_set_random_generator_seed.
*/
-#if !defined(BSDUNIX) && !defined(AFS_SGI_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_DJGPP_ENV)
+#if !defined(BSDUNIX) && !defined(AFS_SGI_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
you lose ... (aka, you get to implement an analog of this for your system ...)
#else
* use a host id and process id in generating the seed to ensure
* that different servers have different streams:
*/
-#if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_ENV)
+#if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV)
seed.host_id = gethostid();
#endif
seed.process_id = getpid();
#ifdef AFS_SUN5_ENV
#include <fcntl.h>
#endif
-#ifdef AFS_DJGPP_ENV
-#include "dosdefs95.h"
-#include "netbios95.h"
-#include <sys/socket.h>
-#include <sys/farptr.h>
-#include <dpmi.h>
-#include <go32.h>
-#include <crt0.h>
-int _crt0_startup_flags = _CRT0_FLAG_LOCK_MEMORY;
-#endif /* AFS_DJGPP_ENV */
#if defined(USE_PTHREADS) || defined(USE_SOLARIS_THREADS)
struct IoRequest *next; /* for iorFreeList */
-#ifdef AFS_DJGPP_ENV
- NCB *ncbp;
- dos_ptr dos_ncb;
-#endif /* AFS_DJGPP_ENV */
-
};
-\f
+
/********************************\
* *
* Stuff for managing signals *
int code);
static void SignalTimeout(int code, struct timeval *timeout);
-#ifdef AFS_DJGPP_ENV
-/* handle Netbios NCB completion */
-static int NCB_fd;
-int anyNCBComplete = FALSE;
-int handler_seg, handler_off; /* seg:off of NCB completion handler */
-static __dpmi_regs callback_regs;
-static _go32_dpmi_seginfo callback_info;
-#endif /* AFS_DJGPP_ENV */
-
/* fd_set pool managment.
* Use the pool instead of creating fd_set's on the stack. fd_set's can be
* 8K in size, so making three could put 24K in the limited space of an LWP
/* Note: SignalSignals() may yield! */
if (anySigsDelivered && SignalSignals ())
woke_someone = TRUE;
-#ifndef AFS_DJGPP_ENV
FT_GetTimeOfDay(&junk, 0); /* force accurate time check */
-#endif
TM_Rescan(Requests);
for (;;) {
register struct IoRequest *req;
req->pid->iomgrRequest = 0;
}
-#ifdef AFS_DJGPP_ENV
- if (IOMGR_CheckNCB()) /* check for completed netbios requests */
- woke_someone = TRUE;
-#endif /* AFS_DJGPP_ENV */
-
if (woke_someone) LWP_DispatchProcess();
} while (woke_someone);
}
#endif /* NT40 */
-#ifdef AFS_DJGPP_ENV
- /* We do this also for the DOS-box Win95 client, since
- NCB calls don't interrupt a select, but we want to catch them
- in a reasonable amount of time (say, half a second). */
- iomgr_timeout.tv_sec = 0;
- iomgr_timeout.tv_usec = IOMGR_WIN95WAITTIME;
-#endif /* DJGPP */
-
/* Check one last time for a signal delivery. If one comes after
this, the signal handler will set iomgr_timeout to zero, causing
the select to return immediately. The timer package won't return
if (anySigsDelivered)
continue; /* go to the top and handle them. */
-#ifdef AFS_DJGPP_ENV
- if (IOMGR_CheckNCB()) /* check for completed netbios requests */
- LWP_DispatchProcess();
-#endif /* AFS_DJGPP_ENV */
-
#ifdef AFS_NT40_ENV
if (IOMGR_readfds.fd_count == 0 && IOMGR_writefds.fd_count == 0
&& IOMGR_exceptfds.fd_count == 0) {
continue;
}
#endif /* AFS_NT40_ENV */
-#ifndef AFS_DJGPP_ENV
FT_GetTimeOfDay(&junk, 0);
-#endif
SignalTimeout(code, &timeout);
}
-#ifdef AFS_DJGPP_ENV
- IOMGR_CheckNCB();
-#endif /* AFS_DJGPP_ENV */
}
LWP_DispatchProcess();
}
IOMGR_Initialize: so force a check for signals regardless */
memset(allOnes, 0xff, sizeof(allOnes));
-#ifdef AFS_DJGPP_ENV
- install_ncb_handler();
-#endif /* AFS_DJGPP_ENV */
-
return LWP_CreateProcess(IOMGR, AFS_LWP_MINSTACKSIZE, 0, (void *) 0,
"IO MANAGER", &IOMGR_Id);
}
/* This routine calls select is a fashion that simulates the standard sleep routine */
void IOMGR_Sleep (int seconds)
{
-#ifndef AFS_DJGPP_ENV
struct timeval timeout;
timeout.tv_sec = seconds;
timeout.tv_usec = 0;
IOMGR_Select(0, 0, 0, 0, &timeout);
-#else
- struct timeval timeout;
- int s;
- fd_set set, empty;
- FD_ZERO(&empty);
- FD_ZERO(&set);
- s = socket(AF_INET,SOCK_STREAM,0);
- FD_SET(s,&set);
-
- timeout.tv_sec = seconds;
- timeout.tv_usec = 0;
- IOMGR_Select(1,&set,&empty,&empty,&timeout);
- close(s);
-#endif /* DJGPP */
}
#endif /* USE_PTHREADS */
-
-
-#ifdef AFS_DJGPP_ENV
-
-/* Netbios code for djgpp port */
-
-int IOMGR_NCBSelect(NCB *ncbp, dos_ptr dos_ncb, struct timeval *timeout)
-{
- struct IoRequest *request;
- int result;
-
- if (timeout != NULL && timeout->tv_sec == 0 && timeout->tv_usec == 0)
- {
- /* Poll */
- if (ncbp->ncb_event != NULL)
- {
- /* error */
- return -1;
- }
-
- if (get_dos_member_b(NCB, dos_ncb, ncb_cmd_cplt) != 0xff)
- {
- return 1;
- }
- else {
- return 0;
- }
- }
-
- /* Construct request block & insert */
- request = NewRequest();
- request->ncbp = ncbp;
- request->dos_ncb = dos_ncb;
-
- if (timeout == NULL)
- {
- request->timeout.TotalTime.tv_sec = -1;
- request->timeout.TotalTime.tv_usec = -1;
- }
- else
- {
- request -> timeout.TotalTime = *timeout;
- /* check for bad request */
- if (timeout->tv_sec < 0 || timeout->tv_usec < 0 || timeout->tv_usec > 999999)
- {
- /* invalid arg */
- iomgr_badtv = *timeout;
- iomgr_badpid = LWP_ActiveProcess;
- /* now fixup request */
- if(request->timeout.TotalTime.tv_sec < 0)
- request->timeout.TotalTime.tv_sec = 1;
- request->timeout.TotalTime.tv_usec = 100000;
- }
- }
-
- request->timeout.BackPointer = (char *)request;
-
- /* Insert my PID in case of IOMGR_Cancel */
- request -> pid = LWP_ActiveProcess;
- LWP_ActiveProcess -> iomgrRequest = request;
-
-#ifdef DEBUG
- request -> timeout.Next = (struct TM_Elem *) 1;
- request -> timeout.Prev = (struct TM_Elem *) 1;
-#endif /* DEBUG */
- TM_Insert(Requests, &request->timeout);
-
- if (ncbp->ncb_event != NULL)
- {
- /* since we were given an event, we can return immediately and just
- signal the event once the request completes. */
- return 0;
- }
- else
- {
- /* Wait for action */
-
- LWP_QWait();
-
- /* Update parameters & return */
- result = request -> result;
-
- FreeRequest(request);
- return (result > 1 ? 1 : result);
- }
-}
-
-int IOMGR_CheckNCB(void)
-{
- int woke_someone = FALSE;
- EVENT_HANDLE ev;
- PROCESS pid;
-
- anyNCBComplete = FALSE;
- FOR_ALL_ELTS(r, Requests, {
- register struct IoRequest *req;
- req = (struct IoRequest *) r -> BackPointer;
-
- if (req->dos_ncb && get_dos_member_b(NCB, req->dos_ncb, ncb_cmd_cplt) != 0xff)
- {
- /* this NCB has completed */
- TM_Remove(Requests, &req->timeout);
-
- /* copy out NCB from DOS to virtual space */
- dosmemget(req->dos_ncb, sizeof(NCB), (char *) req->ncbp);
-
- if (ev = req->ncbp->ncb_event)
- {
- thrd_SetEvent(ev);
- }
- else
- {
- woke_someone = TRUE;
- LWP_QSignal(pid=req->pid);
- pid->iomgrRequest = 0;
- }
- }
- })
- return woke_someone;
-}
-
-int ncb_handler(__dpmi_regs *r)
-{
- anyNCBComplete = TRUE; /* NCB completed */
- /* Make sure that the IOMGR process doesn't pause on the select. */
- iomgr_timeout.tv_sec = 0;
- iomgr_timeout.tv_usec = 0;
- return;
-}
-
-int install_ncb_handler(void)
-{
- callback_info.pm_offset = (long) ncb_handler;
- if (_go32_dpmi_allocate_real_mode_callback_retf(&callback_info,
- &callback_regs))
- {
- fprintf(stderr, "error, allocate_real_mode_callback_retf failed\n");
- return -1;
- }
-
- handler_seg = callback_info.rm_segment;
- handler_off = callback_info.rm_offset;
-
- /*printf("NCB handler_seg=0x%x, off=0x%x\n", handler_seg, handler_off);*/
-}
-#endif /* AFS_DJGPP_ENV */
#include "lwp.h"
#include "preempt.h"
-#if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_DJGPP_ENV)
+#if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
int PRE_Block = 0;
*/
#define IGNORE_STDS_H 1
-/*#ifndef AFS_DJGPP_ENV*/
#include <afs/param.h>
-/*#endif /* AFS_DJGPP_ENV */
#if defined(RIOS)
struct timeval time;
register int expired;
-#ifndef AFS_DJGPP_ENV
FT_AGetTimeOfDay(&time, 0);
-#else
- FT_GetTimeOfDay(&time, 0); /* we need a real time value */
-#endif
expired = 0;
FOR_ALL_ELTS(e, tlist, {
if (!blocking(e)) {
struct timeval twait;
struct timeval *tp = NULL;
-#ifndef AFS_DJGPP_ENV
#ifdef AFS_LINUX20_ENV
if (stdin->_IO_read_ptr < stdin->_IO_read_end)
return 1;
return 1;
#endif
#endif
-#else /* DJGPP */
- if (stdin->_cnt > 0)
- return 1;
-#endif /* DJGPP */
FD_ZERO(&rdfds);
FD_SET(fileno(stdin), &rdfds);
char *htable, *ptable;
int tmp_status, i;
-#if defined(AFS_DJGPP_ENV) && !defined(DEBUG)
- __djgpp_set_quiet_socket(1);
-#endif
-
SPLVAR;
INIT_PTHREAD_LOCKS;
RCSID
("$Header$");
-#ifndef AFS_DJGPP_ENV
#ifndef KERNEL
#ifndef AFS_NT40_ENV
#include <sys/types.h>
#endif /* ! AFS_NT40_ENV */
#endif /* !KERNEL || UKERNEL */
-
-#endif /* !AFS_DJGPP_ENV */
* Put the socket into non-blocking mode so that rx_Listener
* can do a polling read before entering select
*/
-#ifndef AFS_DJGPP_ENV
if (fcntl(sock, F_SETFL, FNDELAY) == -1) {
perror("fcntl");
(osi_Msg "rxi_Listen: unable to set non-blocking mode on socket\n");
return -1;
}
-#else
- if (__djgpp_set_socket_blocking_mode(sock, 1) < 0) {
- perror("__djgpp_set_socket_blocking_mode");
- (osi_Msg "rxi_Listen: unable to set non-blocking mode on socket\n");
- return -1;
- }
-#endif /* AFS_DJGPP_ENV */
if (sock > FD_SETSIZE - 1) {
(osi_Msg "rxi_Listen: socket descriptor > (FD_SETSIZE-1) = %d\n",
if (code == ENOSPC)
err = VDISKFULL;
-#if !defined(AFS_SUN5_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_ENV)
+#if !defined(AFS_SUN5_ENV) && !defined(AFS_NT40_ENV)
/* EDQUOT doesn't exist on solaris */
else if (code == EDQUOT)
err = VOVERQUOTA;
if (code == VDISKFULL)
err = ENOSPC;
else if (code == VOVERQUOTA)
-#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV) || defined(AFS_DJGPP_ENV)
+#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
err = ENOSPC;
#else
err = EDQUOT;
#include "sys/types.h"
#include <sys/stat.h>
#include <errno.h>
-#if defined(AFS_NT40_ENV) || defined(AFS_DJGPP_ENV)
+#if defined(AFS_NT40_ENV)
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#ifndef EWOULDBLOCK
#ifndef _RX_PACKET_
#define _RX_PACKET_
#ifndef UKERNEL
-#if defined(AFS_NT40_ENV) || defined(AFS_DJGPP_ENV)
+#if defined(AFS_NT40_ENV)
#include "rx_xmit_nt.h"
#endif
#ifndef AFS_NT40_ENV
*/
-#if defined(AFS_NT40_ENV) || defined(AFS_DJGPP_ENV)
+#if defined(AFS_NT40_ENV)
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
# include <sys/ioctl.h>
#endif
# include <fcntl.h>
-#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_ENV)
+#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV)
# include <sys/syscall.h>
#endif
#include <afs/afs_args.h>
#endif
#if 0
-#if !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_ENV)
+#if !defined(AFS_NT40_ENV)
if (ntohs(port) >= IPPORT_RESERVED && ntohs(port) < IPPORT_USERRESERVED) {
/* (osi_Msg "%s*WARNING* port number %d is not a reserved port number. Use port numbers above %d\n", name, port, IPPORT_USERRESERVED);
*/ ;
(osi_Msg "%sbind failed\n", name);
goto error;
}
-#if !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_ENV)
+#if !defined(AFS_NT40_ENV)
/*
* Set close-on-exec on rx socket
*/
fcntl(socketFd, F_SETFD, 1);
#endif
-#ifndef AFS_DJGPP_ENV
/* Use one of three different ways of getting a socket buffer expanded to
* a reasonable size.
*/
rx_stats.socketGreedy = greedy;
MUTEX_EXIT(&rx_stats_mutex);
}
-#endif /* AFS_DJGPP_ENV */
#ifdef AFS_LINUX22_ENV
setsockopt(socketFd, SOL_IP, IP_MTU_DISCOVER, &pmtu, sizeof(pmtu));
static u_int rxi_numNetAddrs;
static int Inited = 0;
-#if defined(AFS_NT40_ENV) || defined(AFS_DJGPP_ENV)
+#if defined(AFS_NT40_ENV)
int
rxi_getaddr(void)
{
-#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DJGPP_ENV)
+#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
int
rxi_syscall(a3, a4, a5)
afs_uint32 a3, a4;
{
int s;
int i, j, len, res;
-#ifndef AFS_DJGPP_ENV
struct ifconf ifc;
struct ifreq ifs[ADDRSPERSITE];
struct ifreq *ifr;
char buf[BUFSIZ], *cp, *cplim;
#endif
struct sockaddr_in *a;
-#endif /* AFS_DJGPP_ENV */
LOCK_IF_INIT;
if (Inited) {
if (s < 0)
return;
-#ifndef AFS_DJGPP_ENV
#ifdef AFS_AIX41_ENV
ifc.ifc_len = sizeof(buf);
ifc.ifc_buf = buf;
rxi_MorePackets(npackets * (ncbufs + 1));
}
}
-#else /* AFS_DJGPP_ENV */
- close(s);
- return;
-#endif /* AFS_DJGPP_ENV */
}
#endif /* AFS_NT40_ENV */
RCSID
("$Header$");
-#if defined(AFS_NT40_ENV) || defined(AFS_DJGPP_ENV)
+#if defined(AFS_NT40_ENV)
-#ifdef AFS_NT40_ENV
#include <winsock2.h>
-#else
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-typedef int SOCKET;
-#endif
#include "rx.h"
#include "rx_packet.h"
return code;
}
-#endif /* AFS_NT40_ENV || AFS_DJGPP_ENV */
+#endif /* AFS_NT40_ENV */
typedef struct iovec
-#ifndef AFS_DJGPP_ENV
{
void *iov_base;
int iov_len;
}
-#endif
iovec_t;
struct msghdr {
}
memcpy(&myHost, th->h_addr, sizeof(afs_int32));
-#if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_ENV)
+#if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV)
signal(SIGXCPU, CheckSignal_Signal);
#endif
/* get list of servers */