which included commits to RCS files with non-trunk default branches.
be able to use kgcc to compile all of AFS. Just add CC=kgcc
to your make arguments.
- When building for kernels other than the stock kernel you
- may need to create symlinks in /usr/src named for your
- configuration, e.g. linux-2.2.16-22smp pointing to your
- source tree (linux-2.2.16-22); Redhat provides a unified
- source tree with a switch in include/linux/version.h.
+ When building for multiple kernels in one dest tree,
+ if the kernel version string which UTS_RELEASE is defined to in
+ include/linux/version.h matches the last kernel you built for,
+ the previous kernel module will be overwritten.
+
+Redhat 7.1 (i386_linux24):
+ src/venus/kdump.c may fail to compile.
+
+ You will need pam-devel installed to compile the included
+ PAM module.
+
+ When building for multiple kernels in one dest tree,
+ if the kernel version string which UTS_RELEASE is defined to in
+ include/linux/version.h matches the last kernel you built for,
+ the previous kernel module will be overwritten.
HPUX 11.0 (hp_ux110):
Does not currently build libafs, which means no afs client support,
CD = cd
NTMAKE = nmake /nologo /f ntmakefile install
+NTMAKELANG = nmake /nologo /f ntmakefile en_US
NTMAKE_HEADERS = nmake /nologo /f ntmakefile install_headers
MKDIR = mkdir
+OBJ = obj
# Standard install directory.
!IFDEF AFSDEV_DESTDIR
! ENDIF
config:
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
procmgmt_headers: config
- $(CD) src\procmgmt
+ echo ***** $@
+ $(CD) $(OBJ)\procmgmt
$(NTMAKE_HEADERS)
$(CD) ..\..
afsreg_headers: config
- $(CD) src\WINNT\afsreg
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\afsreg
$(NTMAKE_HEADERS)
$(CD) ..\..\..
util: procmgmt_headers afsreg_headers
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
comerr: util
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
cmd: comerr
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
afsreg: cmd
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
eventlog: afsreg
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
lwp: eventlog
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
rxgen: lwp
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
des: rxgen
-! IF (EXIST(src\des\NTMakefile))
- $(CD) src\des
+ echo ***** $@
+! IF (EXIST($(OBJ)\des\NTMakefile))
+ $(CD) $(OBJ)\des
$(NTMAKE)
$(CD) ..\..
! ELSE
- $(CD) src\des_stub
+ $(CD) $(OBJ)\des_stub
$(NTMAKE)
$(CD) ..\..
! ENDIF
rx: des
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
rxstat: rx
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
rxkad: rxstat
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
pthread: rxkad
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
procmgmt: pthread
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
fsint: procmgmt
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
audit: fsint
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
osi_headers: audit
- $(CD) src\WINNT\client_osi
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\client_osi
$(NTMAKE_HEADERS)
$(CD) ..\..\..
libacl_headers: osi_headers
- $(CD) src\libacl
+ echo ***** $@
+ $(CD) $(OBJ)\libacl
$(NTMAKE_HEADERS)
$(CD) ..\..
cm_headers: libacl_headers
- $(CD) src\WINNT\afsd
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\afsd
$(NTMAKE_HEADERS)
$(CD) ..\..\..
sys: cm_headers
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
auth: sys
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
ubik: auth
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
ptserver: ubik
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
libacl: ptserver
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
kauth: libacl
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
vlserver: kauth
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
usd: vlserver
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
bubasics: usd
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
budb: bubasics
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
butm: budb
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
dir: butm
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
vol: dir
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
volser: vol
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
viced: volser
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
update: viced
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
bucoord: update
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
butc: bucoord
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
bozo: butc
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
bosctlsvc: bozo
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
bu_utils: bosctlsvc
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
libafsrpc: bu_utils
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
libafsauthent: libafsrpc
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
tviced: libafsauthent
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
tbutc: tviced
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
libadmin: tbutc
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
adminutil: libadmin
- $(CD) src\libadmin\$@
+ echo ***** $@
+ $(CD) $(OBJ)\libadmin\$@
$(NTMAKE)
$(CD) ..\..\..
vos: adminutil
- $(CD) src\libadmin\$@
+ echo ***** $@
+ $(CD) $(OBJ)\libadmin\$@
$(NTMAKE)
$(CD) ..\..\..
client: vos
- $(CD) src\libadmin\$@
+ echo ***** $@
+ $(CD) $(OBJ)\libadmin\$@
$(NTMAKE)
$(CD) ..\..\..
kas: client
- $(CD) src\libadmin\$@
+ echo ***** $@
+ $(CD) $(OBJ)\libadmin\$@
$(NTMAKE)
$(CD) ..\..\..
pts: kas
- $(CD) src\libadmin\$@
+ echo ***** $@
+ $(CD) $(OBJ)\libadmin\$@
$(NTMAKE)
$(CD) ..\..\..
bos: pts
- $(CD) src\libadmin\$@
+ echo ***** $@
+ $(CD) $(OBJ)\libadmin\$@
$(NTMAKE)
$(CD) ..\..\..
cfg: bos
- $(CD) src\libadmin\$@
+ echo ***** $@
+ $(CD) $(OBJ)\libadmin\$@
$(NTMAKE)
$(CD) ..\..\..
admintest: cfg
- $(CD) src\libadmin\test
+ echo ***** $@
+ $(CD) $(OBJ)\libadmin\test
$(NTMAKE)
$(CD) ..\..\..
talocale: admintest
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
license: talocale
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
afsadmsvr: license
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
afsusrmgr: afsadmsvr
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
afssvrmgr: afsusrmgr
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
afssvrcfg: afssvrmgr
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
afssvrcpa: afssvrcfg
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
afs_setup_utils: afssvrcpa
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
client_talocale: afs_setup_utils
- $(CD) src\WINNT\talocale
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\talocale
$(NTMAKE)
$(CD) ..\..\..
client_osi: client_talocale
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
afsd: client_osi
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
client_cpa: afsd
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
client_config: client_cpa
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
client_exp: client_config
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
client_creds: client_exp
- $(CD) src\WINNT\$@
+ echo ***** $@
+ $(CD) $(OBJ)\WINNT\$@
$(NTMAKE)
$(CD) ..\..\..
finale: client_creds
- $(CD) src\$@
+ echo ***** $@
+ $(CD) $(OBJ)\$@
$(NTMAKE)
$(CD) ..\..
# InstallShield dependencies
InstallShield5: install
- $(CD) src\WINNT\install\$@
+ $(CD) $(OBJ)\WINNT\install\$@
$(NTMAKE)
$(CD) ..\..\..\..
-# Clean target for src tree
+# Clean target for obj tree
clean: start
nmake /nologo /f ntmakefile "NTMAKE = nmake /nologo /f ntmakefile clean" "NTMAKE_HEADERS = nmake /nologo /f ntmakefile clean" install
- $(CD) src\config
+ $(CD) $(OBJ)\config
nmake /nologo /f ntmakefile clean_version
$(CD) ..\..
in afs space is also valid. In the directory that you uncompressed the
source in, you will only have an src/ directory.
- 1. Make a directory for each system type that you plan on
- building. Current tested system types include the following
- (this step is skipped for the i386_nt40 system type):
-
- alpha_dux40/
- alpha_dux50/ (only tested on 5.0A)
- i386_linux22/
- i386_linux24/ (only tested with 2.4.0 kernel)
- rs_aix42/
- sgi_65/ (file server not tested)
- sun4x_56/
- sun4x_57/
- sun4x_58/
- ppc_darwin_13/
- alpha_linux_2216_22/ (DES does not work, will require one more change to
+ 1. Pick a system to build for, and note its default AFS sys_name.
+ A directory will be automatically created for binaries to be written
+ into with this name when you build.
+
+ alpha_dux40
+ alpha_dux50 (only tested on 5.0A)
+ i386_linux22
+ i386_linux24 (only tested with 2.4.0 kernel)
+ rs_aix42
+ sgi_65 (file server not tested)
+ sun4x_56
+ sun4x_57
+ sun4x_58
+ ppc_darwin_13
+ alpha_linux_22 (DES does not work, will require one more change to
compile)
- hp_ux110/ (No client support, but db servers and utilities work)
- hp_ux102/ (No client support, but db servers and utilities work)
-
- Example:
- % mkdir i386_linux22
- % ls -CF
- i386_linux22/ src/
-
- 2. Within each of those directories, create a dest/ and obj/ directory.
-
- Example:
- % mkdir i386_linux22/dest
- % mkdir i386_linux22/obj
-
- 3. Create symbolic links to the system type you are about to build
- a. If the source is in AFS space
-
- Example:
- % ln -s @sys/dest dest
- % ln -s @sys/obj obj
- % ls -CF
- dest@ i386_linux22/ obj@ src/
-
- Within AFS space, the AFS Cache Manager automatically
- substitutes the local machine's AFS system name (CPU/operating
- system type [ie: alpha_dux40, i386_linux22, ...]) for the @sys
- variable.
-
- b. If this source is NOT in AFS space, You must make a link from
- @sys to your current system type.
-
- Example:
- % ln -s i386_linux22 @sys
- % ln -s @sys/dest dest
- % ln -s @sys/obj obj
- % ls -CF
- dest@ i386_linux22/ obj@ src/ sys@
-
- 5. Create the top level Makefile:
-
- Example:
- % ln -s src/Makefile Makefile
- % ls -CF
- Makefile@ dest@ i386_linux22/ obj@ src/
+ hp_ux110 (No client support, but db servers and utilities work)
+ hp_ux102 (No client support, but db servers and utilities work)
+
+ 2. Using configure in the top level directory, configure for your
+ AFS system type, providing the necessary flags:
+ % ./configure --with-afs-sysname=sun4x_58
+
+ For Linux systems you need also provide the patch in which your
+ kernel headers for your configured kernel can be found. This should
+ be the path of the directory containing a child directory named
+ "include". So if your version file was
+ /usr/src/linux/include/linux/version.h you would invoke:
+ % ./configure --with-afs-sysname=i386_linux24 --with-linux-kernel-headers=/usr/src/linux
+
+ Currently you can build for only one Linux kernel at a time,
+ and the version is extracted from the kernel headers in the root
+ you specify.
+
+ Be prepared to provide the switches --enable-obsolete and
+ --enable-insecure if you require the use of any bundled but obsolete
+ or insecure software included with OpenAFS. See README.obsolete and
+ README.insecure for more details.
B Building
- 1. Make the obj links. This creates links from the @sys/obj/ tree
- back to the source tree. The source tree remains unchanged and
- builds are done in the platform specific object tree.
+ 1. Now, you can build OpenAFS.
- % make links
+ % make
- 2. Begin building
- a. For Linux
- % make SYS_NAME="i386_linux22" LINUX_VERS="2.2.14"
+ When the build completes, you will have a complete binary tree
+ in the dest directory under the directory named for the sys_name you
+ built for, e.g. sun4x_57/dest or i386_linux22/dest
- b. For UNIX versions, specify the system name as given by
- the system type defined in step A1.
- % make SYS_NAME="<system_name>"
+ 2. As appropriate you can clean up or, if you're using Linux, build for
+ another kernel version:
+ a. To clean up:
+ % make clean
- Example for the rs_aix42 operating system:
- % make SYS_NAME="rs_aix42"
+ b. To build for another Linux kernel version:
+ the system type defined in step A1.
+ % ./configure --with-afs-sysname=i386_linux22 --with-linux-kernel-headers=/usr/src/linux-2.2.19-i686
+ % make
+
+ Your dest tree will now include an additional kernel module for your
+ additional kernel headers. Be aware that if the kernel version string
+ which UTS_RELEASE is defined to in include/linux/version.h matches
+ the last kernel you built for, the previous kernel module will be
+ overwritten.
C Problems
If you have a problem building this source, you may want to visit
However, Carnegie Mellon Computing Services has continued to use
and occasionally develop them, and current versions can be found at:
ftp://ftp.andrew.cmu.edu/pub/AFS-Tools
+
+To enable building of the obsolete code included with OpenAFS,
+run configure with the --enable-obsolete switch
In any case, carefully consider the security implications before deploying
these utilities.
+To enable building of the insecure code included with OpenAFS, run
+configure with the --enable-insecure switch.
+
$(INCFILEDIR)\fs_utils.h \
$(INCFILEDIR)\krb.h \
$(INCFILEDIR)\krb_prot.h \
+ $(INCFILEDIR)\cm_dir.h \
$(INCFILEDIR)\smb.h \
$(INCFILEDIR)\smb3.h \
$(INCFILEDIR)\smb_iocons.h \
$(INCFILEDIR)\smb_ioctl.h \
+ $(INCFILEDIR)\afsmsg95.h \
$(INCFILEDIR)\afsrpc.h
IDLFILES =\
$(EXEDIR)\afsshare.exe \
$(DESTDIR)\bin\kpasswd.exe
+install9X: install_headers $(CONF_DLLFILE) \
+ $(EXEDIR)\klog.exe \
+ $(EXEDIR)\tokens.exe \
+ $(EXEDIR)\unlog.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 \
+ $(EXEDIR)\unlog.exe \
+ $(EXEDIR)\fs.exe $(EXEDIR)\symlink.exe \
+ $(EXEDIR)\afsshare.exe \
+ $(DESTDIR)\bin\kpasswd.exe
+
############################################################################
# Local clean target; augments predefined clean target
-clean::
- $(DEL) *.res
-
############################################################################
# assorted exe's
afslog95.res: afslog95.rc AFS_component_version_number.h
libafsconf.res: libafsconf.rc AFS_component_version_number.h
+
+clean::
+ $(DEL) *.res
+ $(DEL) afsrpc.h
+ $(DEL) afsrpc_?.*
+ $(DEL) $(EXELIBS)
#ifndef __AFSD_H_ENV__
#define __AFSD_H_ENV__ 1
+#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.h"
#include <crypt.h>
#include <afs/prs_fs.h>
-#include "cm_access.h"
+#include <osi.h>
+#include "cm_user.h"
+#include "cm_callback.h"
+#ifdef DISKCACHE95
+#include "cm_diskcache95.h"
+#endif /* DISKCACHE95 */
+#include "cm_conn.h"
#include "cm_aclent.h"
#include "cm_cell.h"
#include "cm_config.h"
#include "cm_server.h"
-#include "cm_user.h"
-#include "cm_conn.h"
#include "cm_volume.h"
-#include "cm_access.h"
#include "cm_scache.h"
#include "cm_dcache.h"
-#include "cm_buf.h"
-#include "cm_callback.h"
+#include "cm_access.h"
#include "cm_vnodeops.h"
#include "cm_dir.h"
#include "cm_utils.h"
#include "cm_daemon.h"
#include "cm_ioctl.h"
#include "cm_dnlc.h"
+#include "cm_buf.h"
+#ifdef DJGPP
+#include "afs/afsmsg95.h"
+#endif
#include <afs/vldbint.h>
#include <afs/afsint.h>
#define AFS_DAEMON_SERVICE_NAME "TransarcAFSDaemon"
#define AFS_DAEMON_EVENT_NAME "AFS Client"
+void afs_exit();
+
/* globals from the base afsd */
extern int cm_logChunkSize;
if (code == ERROR_SUCCESS)
afsi_log("LAN adapter number %d", LANadapter);
else {
- LANadapter = 0;
- afsi_log("Default LAN adapter number 0");
+ LANadapter = -1;
+ afsi_log("Default LAN adapter number");
}
dummyLen = sizeof(cacheSize);
void afsi_start();
+#ifndef DJGPP
int afsd_InitCM(char **reasonP);
-int afsd_InitDaemons(char **reasonP);
int afsd_InitSMB(char **reasonP, void *aMBfunc);
+#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);
#include <winsock2.h>
#include <osi.h>
+\r
+#ifdef DEBUG\r
+//#define NOTSERVICE\r
+#endif\r
extern void afsi_log(char *pattern, ...);
WaitToTerminate = CreateEvent(NULL, TRUE, FALSE, NULL);
+#ifndef NOTSERVICE\r
StatusHandle = RegisterServiceCtrlHandler(AFS_DAEMON_SERVICE_NAME,
(LPHANDLER_FUNCTION) afsd_ServiceControlHandler);
ServiceStatus.dwWaitHint = 15000;
ServiceStatus.dwControlsAccepted = 0;
SetServiceStatus(StatusHandle, &ServiceStatus);
+#endif
{
HANDLE h; char *ptbuf[1];
h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME);
if (code != 0)
osi_panic(reason, __FILE__, __LINE__);
+#ifndef NOTSERVICE
ServiceStatus.dwCurrentState = SERVICE_RUNNING;
ServiceStatus.dwWin32ExitCode = NO_ERROR;
ServiceStatus.dwCheckPoint = 0;
ServiceStatus.dwWaitHint = 0;
ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
SetServiceStatus(StatusHandle, &ServiceStatus);
+#endif
{
HANDLE h; char *ptbuf[1];
h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME);
SetServiceStatus(StatusHandle, &ServiceStatus);
}
+#ifdef NOTSERVICE
+void main()
+{
+ afsd_Main();
+ Sleep(1000);
+ return ;
+}
+#else
void _CRTAPI1 main()
{
LONG status = ERROR_SUCCESS;
if (!StartServiceCtrlDispatcher(dispatchTable))
status = GetLastError();
}
+#endif
#define __CM_H_ENV__ 1
#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 */
long VL_GetEntryByID(struct rx_connection *, long, long, struct vldbentry *);
struct AFSCallBack *CallBack,
struct AFSVolSync *Sync);
-StartRXAFS_StoreData (struct rx_call *,
+int StartRXAFS_StoreData (struct rx_call *,
struct AFSFid *Fid,
struct AFSStoreStatus *InStatus,
afs_int32 Pos,
afs_int32 Length,
afs_int32 FileLength);
-EndRXAFS_StoreData(struct rx_call *,
+int EndRXAFS_StoreData(struct rx_call *,
struct AFSFetchStatus *OutStatus,
struct AFSVolSync *Sync);
-RXAFS_StoreACL (struct rx_connection *,
+int RXAFS_StoreACL (struct rx_connection *,
struct AFSFid *Fid,
struct AFSOpaque *AccessList,
struct AFSFetchStatus *OutStatus,
struct AFSVolSync *Sync);
-RXAFS_StoreStatus(struct rx_connection *,
+int RXAFS_StoreStatus(struct rx_connection *,
struct AFSFid *Fid,
struct AFSStoreStatus *InStatus,
struct AFSFetchStatus *OutStatus,
struct AFSVolSync *Sync);
-RXAFS_RemoveFile (struct rx_connection *,
+int RXAFS_RemoveFile (struct rx_connection *,
struct AFSFid *DirFid,
char *namep,
struct AFSFetchStatus *OutStatus,
struct AFSVolSync *Sync);
-RXAFS_CreateFile (struct rx_connection *,
+int RXAFS_CreateFile (struct rx_connection *,
struct AFSFid *DirFid,
char *Name,
struct AFSStoreStatus *InStatus,
struct AFSCallBack *CallBack,
struct AFSVolSync *Sync);
-RXAFS_Rename (struct rx_connection *,
+int RXAFS_Rename (struct rx_connection *,
struct AFSFid *OldDirFid,
char *OldName,
struct AFSFid *NewDirFid,
struct AFSFetchStatus *OutNewDirStatus,
struct AFSVolSync *Sync);
-RXAFS_Symlink (struct rx_connection *,
+int RXAFS_Symlink (struct rx_connection *,
struct AFSFid *DirFid,
char *name,
char *LinkContents,
struct AFSFetchStatus *OutDirStatus,
struct AFSVolSync *Sync);
-RXAFS_Link (struct rx_connection *,
+int RXAFS_Link (struct rx_connection *,
struct AFSFid *DirFid,
char *Name,
struct AFSFid *ExistingFid,
struct AFSFetchStatus *OutDirStatus,
struct AFSVolSync *Sync);
-RXAFS_MakeDir (struct rx_connection *,
+int RXAFS_MakeDir (struct rx_connection *,
struct AFSFid *DirFid,
char *name,
struct AFSStoreStatus *InStatus,
struct AFSCallBack *CallBack,
struct AFSVolSync *Sync);
-RXAFS_RemoveDir (struct rx_connection *,
+int RXAFS_RemoveDir (struct rx_connection *,
struct AFSFid *DirFid,
char *Name,
struct AFSFetchStatus *OutDirStatus,
struct AFSVolSync *Sync);
-RXAFS_GetStatistics (struct rx_connection *,
+int RXAFS_GetStatistics (struct rx_connection *,
struct ViceStatistics *Statistics);
-RXAFS_GiveUpCallBacks (struct rx_connection *,
+int RXAFS_GiveUpCallBacks (struct rx_connection *,
struct AFSCBFids *Fids_Array,
struct AFSCBs *CallBacks_Array);
-RXAFS_GetVolumeInfo (struct rx_connection *,
+int RXAFS_GetVolumeInfo (struct rx_connection *,
char *VolumeName,
struct VolumeInfo *Volumeinfo);
-RXAFS_GetVolumeStatus (struct rx_connection *,
+int RXAFS_GetVolumeStatus (struct rx_connection *,
afs_int32 Volumeid,
struct AFSFetchVolumeStatus *Volumestatus,
char **name,
char **offlineMsg,
char **motd);
-RXAFS_SetVolumeStatus (struct rx_connection *,
+int RXAFS_SetVolumeStatus (struct rx_connection *,
afs_int32 Volumeid,
struct AFSStoreVolumeStatus *Volumestatus,
char *name,
char *olm,
char *motd);
-RXAFS_GetRootVolume (struct rx_connection *,
+int RXAFS_GetRootVolume (struct rx_connection *,
char **VolumeName);
-RXAFS_CheckToken (struct rx_connection *,
+int RXAFS_CheckToken (struct rx_connection *,
afs_int32 ViceId,
struct AFSOpaque *token);
-RXAFS_GetTime (struct rx_connection *,
+int RXAFS_GetTime (struct rx_connection *,
afs_uint32 *Seconds,
afs_uint32 *USeconds);
-RXAFS_BulkStatus (struct rx_connection *,
+int RXAFS_BulkStatus (struct rx_connection *,
struct AFSCBFids *FidsArray,
struct AFSBulkStats *StatArray,
struct AFSCBs *CBArray,
struct AFSVolSync *Sync);
-RXAFS_SetLock (struct rx_connection *,
+int RXAFS_SetLock (struct rx_connection *,
struct AFSFid *Fid,
int Type,
struct AFSVolSync *Sync);
-RXAFS_ExtendLock (struct rx_connection *,
+int RXAFS_ExtendLock (struct rx_connection *,
struct AFSFid *Fid,
struct AFSVolSync *Sync);
-RXAFS_ReleaseLock (struct rx_connection *,
+int RXAFS_ReleaseLock (struct rx_connection *,
struct AFSFid *Fid,
struct AFSVolSync *Sync);
/* This interface is to supported the AFS/DFS Protocol Translator */
-RXAFS_Lookup (struct rx_connection *,
+int RXAFS_Lookup (struct rx_connection *,
struct AFSFid *DirFid,
char *Name,
struct AFSFid *OutFid,
#define CM_ERROR_NOIPC (CM_ERROR_BASE+36)
#define CM_ERROR_BADNTFILENAME (CM_ERROR_BASE+37)
#define CM_ERROR_BUFFERTOOSMALL (CM_ERROR_BASE+38)
+#define CM_ERROR_RENAME_IDENTICAL (CM_ERROR_BASE+39)
#endif /* __CM_H_ENV__ */
#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"
#ifndef _CM_ACCESS_H_ENV__
#define _CM_ACCESS_H_ENV__ 1
+#include "cm_user.h"
+
extern int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *up,
long rights, long *outRights);
#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 <malloc.h>
#include <stdio.h>
long buf_bufferSize = CM_BUF_SIZE;
long buf_hashSize = CM_BUF_HASHSIZE;
+#ifndef DJGPP
static
HANDLE CacheHandle;
static
SYSTEM_INFO sysInfo;
+#endif /* !DJGPP */
/* buffer reservation variables */
long buf_reservedBufs;
/* another hash table */
cm_buf_t **buf_fileHashTablepp;
+#ifdef DISKCACHE95
+/* for experimental disk caching support in Win95 client */
+cm_buf_t *buf_diskFreeListp;
+cm_buf_t *buf_diskFreeListEndp;
+cm_buf_t *buf_diskAllp;
+extern int cm_diskCacheEnabled;
+#endif /* DISKCACHE95 */
+
/* hold a reference to an already held buffer */
void buf_Hold(cm_buf_t *bp)
{
lock_ReleaseWrite(&buf_globalLock);
nAtOnce = buf_nbuffers / 10;
while (1) {
- i = SleepEx(5000, 1);
+#ifndef DJGPP
+ i = SleepEx(5000, 1);
if (i != 0) continue;
+#else
+ thrd_Sleep(5000);
+#endif /* DJGPP */
/* now go through our percentage of the buffers */
for(i=0; i<nAtOnce; i++) {
} /* whole daemon's while loop */
}
+#ifndef DJGPP
/* Create a security attribute structure suitable for use when the cache file
* is created. What we mainly want is that only the administrator should be
* able to do anything with the file. We create an ACL with only one entry,
return psa;
}
+#endif /* !DJGPP */
+#ifndef DJGPP
/* Free a security attribute structure created by CreateCacheFileSA() */
VOID FreeCacheFileSA(PSECURITY_ATTRIBUTES psa)
{
GlobalFree(psa->lpSecurityDescriptor);
GlobalFree(psa);
}
+#endif /* !DJGPP */
/* initialize the buffer package; called with no locks
* held during the initialization phase.
static osi_once_t once;
cm_buf_t *bp;
long sectorSize;
- HANDLE phandle;
+ thread_t phandle;
+#ifndef DJGPP
+ HANDLE hf, hm;
+ PSECURITY_ATTRIBUTES psa;
+#endif /* !DJGPP */
long i;
unsigned long pid;
- HANDLE hf, hm;
char *data;
- PSECURITY_ATTRIBUTES psa;
long cs;
+#ifndef DJGPP
/* Get system info; all we really want is the allocation granularity */
GetSystemInfo(&sysInfo);
+#endif /* !DJGPP */
/* Have to be able to reserve a whole chunk */
if (((buf_nbuffers - 3) * buf_bufferSize) < cm_chunkSize)
/* initialize global locks */
lock_InitializeRWLock(&buf_globalLock, "Global buffer lock");
+#ifndef DJGPP
/*
* Cache file mapping constrained by
* system allocation granularity;
afsi_log("Cache size rounded up to %d buffers",
buf_nbuffers);
}
+#endif /* !DJGPP */
/* remember this for those who want to reset it */
buf_nOrigBuffers = buf_nbuffers;
/* min value for which this works */
sectorSize = 1;
+#ifndef DJGPP
/* Reserve buffer space by mapping cache file */
psa = CreateCacheFileSA();
hf = CreateFile(cm_CachePath,
return CM_ERROR_INVAL;
}
CloseHandle(hm);
+#else
+ /* djgpp doesn't support memory mapped files */
+ data = malloc(buf_nbuffers * buf_bufferSize);
+#endif /* !DJGPP */
/* create buffer headers and put in free list */
bp = malloc(buf_nbuffers * sizeof(cm_buf_t));
osi_EndOnce(&once);
/* and create the incr-syncer */
- phandle = CreateThread((SECURITY_ATTRIBUTES *) 0, 0,
- (LPTHREAD_START_ROUTINE) buf_IncrSyncer, 0, 0, &pid);
+ phandle = thrd_Create(0, 0,
+ (ThreadFunc) buf_IncrSyncer, 0, 0, &pid,
+ "buf_IncrSyncer");
+
osi_assertx(phandle != NULL, "buf: can't create incremental sync proc");
+#ifndef DJGPP
CloseHandle(phandle);
+#endif /* !DJGPP */
}
return 0;
cm_buf_t *bp;
int i;
char *data;
+#ifndef DJGPP
HANDLE hm;
long cs;
return CM_ERROR_INVAL;
}
CloseHandle(hm);
+#else
+ data = malloc(buf_nbuffers * buf_bufferSize);
+#endif /* DJGPP */
/* Create buffer headers and put in free list */
bp = malloc(nbuffers * sizeof(*bp));
lock_ObtainMutex(&bp->mx);
if (code) break;
+
+#ifdef DISKCACHE95
+ /* Disk cache support */
+ /* write buffer to disk cache (synchronous for now) */
+ diskcache_Update(bp->dcp, bp->datap, buf_bufferSize, bp->dataVersion);
+#endif /* DISKCACHE95 */
};
/* do logging after call to GetLastError, or else */
osi_hyper_t pageOffset;
unsigned long tcount;
int created;
+#ifdef DISKCACHE95
+ cm_diskcache_t *dcp;
+#endif /* DISKCACHE95 */
created = 0;
pageOffset.HighPart = offsetp->HighPart;
/* lock it and break out */
lock_ObtainMutex(&bp->mx);
break;
+
+#ifdef DISKCACHE95
+ /* touch disk chunk to update LRU info */
+ diskcache_Touch(bp->dcp);
+#endif /* DISKCACHE95 */
}
/* otherwise, we have to create a page */
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;
code = (*cm_buf_opsp->Readp)(bp, buf_bufferSize, &tcount, NULL);
+
+#ifdef DISKCACHE95
+ code = diskcache_Get(&bp->fid, &bp->offset, bp->datap, buf_bufferSize, &bp->dataVersion, &tcount, &dcp);
+ bp->dcp = dcp; /* pointer to disk cache struct. */
+#endif /* DISKCACHE95 */
+
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;
lock_ReleaseMutex(&bp->mx);
buf_Release(bp);
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
#define _BUF_H__ENV_ 1
#include <osi.h>
+#ifdef DISKCACHE95
+#include "cm_diskcache.h"
+#endif /* DISKCACHE95 */
/* default # of buffers if not changed */
#define CM_BUF_BUFFERS 100
char *datap; /* data in this buffer */
unsigned long error; /* last error code, if CM_BUF_ERROR is set */
struct cm_user *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 */
long cmFlags; /* flags for cm */
+#ifdef DISKCACHE95
+ cm_diskcache_t *dcp; /* diskcache structure */
+#endif /* DISKCACHE95 */
} cm_buf_t;
/* values for cmFlags */
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>
#define _CM_CALLBACK_H_ENV__ 1
#include <osi.h>
-#include "cm_scache.h"
typedef struct cm_callbackRequest {
long callbackCount; /* callback count at start of the request */
struct cm_server *serverp; /* server we really got the callback from */
} cm_callbackRequest_t;
+#include "cm_scache.h"
+
typedef struct cm_racingRevokes {
osi_queue_t q; /* queue for forward/backward searches */
cm_fid_t fid; /* fid revoked */
#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/param.h>
#include <afs/stds.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>
char AFSConfigKeyName[] =
"SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters";
+#define AFS_THISCELL "ThisCell"
+#define AFS_CELLSERVDB_UNIX "CellServDB"
+#define AFS_CELLSERVDB_NT "afsdcell.ini"
+#define AFSDIR_CLIENT_ETC_DIRPATH "c:/afs"
+#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_NT
+#endif /* DJGPP || WIN95 */
+
+
static long cm_ParsePair(char *lineBufferp, char *leftp, char *rightp)
{
char *tp;
int foundCell;
long code;
int tracking = 1, partial = 0;
+ long ip_addr;
+#if defined(DJGPP) || defined(AFS_WIN95_ENV)
+ int c1, c2, c3, c4;
+ char aname[256];
+#endif
+ char *afsconf_path;
foundCell = 0;
+#if !defined(DJGPP)
code = GetWindowsDirectory(wdir, sizeof(wdir));
if (code == 0 || code > sizeof(wdir)) return -1;
-
+
/* add trailing backslash, if required */
tlen = strlen(wdir);
if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
-
- strcat(wdir, "afsdcell.ini");
+#else
+ strcpy(wdir, cm_confDir);
+ strcat(wdir,"/");
+#endif /* !DJGPP */
+ strcat(wdir, AFS_CELLSERVDB);
+
tfilep = fopen(wdir, "r");
- if (!tfilep) return -2;
+
+ 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. */
+ afsconf_path = getenv("AFSCONF");
+ if (!afsconf_path)
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
+ else
+ strcpy(wdir, afsconf_path);
+ strcat(wdir, "/");
+ strcat(wdir, AFS_CELLSERVDB_UNIX);
+ /*fprintf(stderr, "opening cellservdb file %s\n", wdir);*/
+ tfilep = fopen(wdir, "r");
+ if (!tfilep) return -2;
+ }
+
bestp = fopen(wdir, "r");
/* have we seen the cell line for the guy we're looking for? */
else inRightCell = 0;
}
else {
+#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
valuep = strchr(lineBuffer, '#');
if (valuep == NULL) {
fclose(tfilep);
return -4;
}
valuep++; /* skip the "#" */
+
valuep += strspn(valuep, " "); /* skip SP & TAB */
+#endif /* !DJGPP */
if (inRightCell) {
+#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
/* add the server to the VLDB list */
thp = gethostbyname(valuep);
if (thp) {
(*procp)(rockp, &vlSockAddr, valuep);
foundCell = 1;
}
+#else
+ /* For DJGPP, we will read IP address instead
+ of name/comment field */
+ code = sscanf(lineBuffer, "%d.%d.%d.%d #%s",
+ &c1, &c2, &c3, &c4, aname);
+ tp = (char *) &ip_addr;
+ *tp++ = c1;
+ *tp++ = c2;
+ *tp++ = c3;
+ *tp++ = c4;
+ memcpy(&vlSockAddr.sin_addr.s_addr, &ip_addr,
+ sizeof(long));
+ vlSockAddr.sin_family = AF_INET;
+ /* sin_port supplied by connection code */
+ if (procp)
+ (*procp)(rockp, &vlSockAddr, valuep);
+ foundCell = 1;
+#endif /* !DJGPP */
}
} /* a vldb line */
} /* while loop processing all lines */
}
+#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
/* look up the root cell's name in the Registry */
long cm_GetRootCellName(char *cellNamep)
{
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 *afsconf_path;
+ char *newline;
+
+#ifdef DJGPP
+ strcpy(thisCellPath, cm_confDir);
+#else
+ /* Win 95 */
+ afsconf_path = getenv("AFSCONF");
+ if (!afsconf_path)
+ strcpy(thisCellPath, AFSDIR_CLIENT_ETC_DIRPATH);
+ else
+ strcpy(thisCellPath, 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 code;
long tlen;
FILE *tfilep;
+ char *afsconf_path;
+#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
code = GetWindowsDirectory(wdir, sizeof(wdir));
if (code == 0 || code > sizeof(wdir)) return NULL;
/* add trailing backslash, if required */
tlen = strlen(wdir);
if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
+#else
+#ifdef DJGPP
+ strcpy(wdir,cm_confDir);
+#else
+ afsconf_path = getenv("AFSCONF");
+ if (!afsconf_path)
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
+ else
+ strcpy(wdir, 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 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)
{
int inRightCell;
int foundCell;
- tfilep = cm_CommonOpen("afsdcell.ini", "r");
+ tfilep = cm_CommonOpen(AFS_CELLSERVDB, "r");
if (!tfilep) return -1;
foundCell = 0;
long code;
long closeCode;
int tlen;
+ char *afsconf_path;
closeCode = fclose((FILE *)filep);
+#if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
code = GetWindowsDirectory(wdir, sizeof(wdir));
- if (code == 0 || code > sizeof(wdir)) return -1;
+ if (code == 0 || code > sizeof(wdir)) return NULL;
/* add trailing backslash, if required */
tlen = strlen(wdir);
if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
+#else
+#ifdef DJGPP
+ strcpy(wdir,cm_confDir);
+#else
+ afsconf_path = getenv("AFSCONF");
+ if (!afsconf_path)
+ strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
+ else
+ strcpy(wdir, afsconf_path);
+#endif /* !DJGPP */
+ strcat(wdir,"/");
+#endif /* DJGPP || WIN95 */
+
strcpy(sdir, wdir);
if (closeCode != 0) {
return closeCode;
}
- strcat(wdir, "afsdcell.ini");
+ strcat(wdir, AFS_CELLSERVDB);
strcat(sdir, "afsdcel2.ini"); /* new file */
unlink(wdir); /* delete old file */
#ifndef __CM_CONFIG_INTERFACES_ONLY__
#include <stdio.h>
+#ifdef DJGPP
+#include <netinet/in.h>
+#endif /* DJGPP */
extern char AFSConfigKeyName[];
#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 <rx/rx.h>
+#ifndef DJGPP
#include <rxkad.h>
+#else
+#include <rx/rxkad.h>
+#endif
#include "afsd.h"
void cm_InitReq(cm_req_t *reqp)
{
memset((char *)reqp, 0, sizeof(cm_req_t));
+#ifndef DJGPP
reqp->startTime = GetCurrentTime();
+#else
+ gettimeofday(&reqp->startTime, NULL);
+#endif
+
}
long cm_GetServerList(struct cm_fid *fidp, struct cm_user *userp,
if (tsrp->status == busy)
tsrp->status = not_busy;
}
- Sleep(5000);
+ thrd_Sleep(5000);
retry = 1;
}
int same;
/* Back off to allow move to complete */
- Sleep(2000);
+ thrd_Sleep(2000);
/* Update the volume location and see if it changed */
cm_GetServerList(fidp, userp, reqp, &serversp);
* this is to prevent the SMB session from timing out
* In addition, we log an event to the event log
*/
+#ifndef DJGPP
HANDLE h;
char *ptbuf[1];
char s[100];
ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1009, NULL,
1, 0, ptbuf, NULL);
DeregisterEventSource(h);
+#endif /* !DJGPP */
retry = 0;
osi_Log0(afsd_logp, "cm_Analyze: hardDeadTime exceeded");
long firstError = 0;
int someBusy = 0, someOffline = 0;
long timeUsed, timeLeft, hardTimeLeft;
+#ifdef DJGPP
+ struct timeval now;
+#endif /* DJGPP */
*connpp = NULL;
+#ifndef DJGPP
timeUsed = (GetCurrentTime() - reqp->startTime) / 1000;
+#else
+ gettimeofday(&now, NULL);
+ timeUsed = sub_time(now, reqp->startTime) / 1000;
+#endif
+
/* leave 5 seconds margin of safety */
timeLeft = RDRtimeout - timeUsed - 5;
hardTimeLeft = timeLeft;
VBUSY above. This is negative so that old
cache managers treat it as "server is down"*/
+#include "cm_server.h"
+
extern void cm_InitConn(void);
extern void cm_InitReq(cm_req_t *reqp);
#include <afs/param.h>
#include <afs/stds.h>
+#ifndef DJGPP
#include <windows.h>
#include <winsock2.h>
+#else
+#include <netdb.h>
+#endif /* !DJGPP */
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
*/
gethostname(thostName, sizeof(thostName));
thp = gethostbyname(thostName);
- memcpy(&code, thp->h_addr_list[0], 4);
+ if (thp == NULL) /* In djgpp, gethostname returns the netbios
+ name of the machine. gethostbyname will fail
+ looking this up if it differs from DNS name. */
+ code = 0;
+ else
+ memcpy(&code, thp->h_addr_list[0], 4);
srand(ntohl(code));
now = osi_Time();
lastTokenCacheCheck = now - cm_daemonTokenCheckInterval/2 + (rand() % cm_daemonTokenCheckInterval);
while (1) {
- Sleep(30 * 1000); /* sleep 30 seconds */
+ thrd_Sleep(30 * 1000); /* sleep 30 seconds */
/* find out what time it is */
now = osi_Time();
{
static osi_once_t once;
long pid;
- HANDLE phandle;
+ thread_t phandle;
int i;
if (osi_Once(&once)) {
osi_EndOnce(&once);
/* creating pinging daemon */
- phandle = CreateThread((SECURITY_ATTRIBUTES *) 0, 0,
- (LPTHREAD_START_ROUTINE) cm_Daemon, 0, 0, &pid);
+ phandle = thrd_Create((SecurityAttrib) 0, 0,
+ (ThreadFunc) cm_Daemon, 0, 0, &pid, "cm_Daemon");
osi_assert(phandle != NULL);
- CloseHandle(phandle);
+ thrd_CloseHandle(phandle);
for(i=0; i < nDaemons; i++) {
- phandle = CreateThread((SECURITY_ATTRIBUTES *) 0, 0,
- (LPTHREAD_START_ROUTINE) cm_BkgDaemon, 0, 0, &pid);
+ phandle = thrd_Create((SecurityAttrib) 0, 0,
+ (ThreadFunc) cm_BkgDaemon, 0, 0, &pid,
+ "cm_BkgDaemon");
osi_assert(phandle != NULL);
- CloseHandle(phandle);
+ thrd_CloseHandle(phandle);
}
}
}
#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>
-#include <nb30.h>
#include <osi.h>
#include "afsd.h"
lock_ReleaseMutex(&scp->mx);
+#ifdef DISKCACHE95
+ DPRINTF("cm_GetBuffer: fetching data scpDV=%d bufDV=%d scp=%x bp=%x dcp=%x\n",
+ scp->dataVersion, bufp->dataVersion, scp, bufp, bufp->dcp);
+#endif /* DISKCACHE95 */
+
/* now make the call */
do {
code = cm_Conn(&scp->fid, up, reqp, &connp);
qdp = (osi_queueData_t *) osi_QNext(&qdp->q)) {
tbufp = osi_GetQData(qdp);
tbufp->dataVersion = afsStatus.DataVersion;
+
+#ifdef DISKCACHE95
+ /* write buffer out to disk cache */
+ diskcache_Update(tbufp->dcp, tbufp->datap, buf_bufferSize,
+ tbufp->dataVersion);
+#endif /* DISKCACHE95 */
}
}
#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>
struct nc* nameHash[NHSIZE];
+#ifndef DJGPP
#define dnlcNotify(x,debug){ \
HANDLE hh; \
char *ptbuf[1]; \
DeregisterEventSource(hh); \
} \
}
+#else
+#define dnlcNotify(x,debug)
+#endif /* !DJGPP */
static struct nc *
#include <afs/param.h>
#include <afs/stds.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"
+#ifndef DJGPP
#include <rxkad.h>
-
#include "afsrpc.h"
+#else
+#include <rx/rxkad.h>
+#include "afsrpc95.h"
+#endif
+
#include "cm_rpc.h"
/* Copied from afs_tokens.h */
#define PIOCTL_LOGON 0x1
+#define MAX_PATH 260
osi_mutex_t cm_Afsdsbmt_Lock;
*/
void TranslateExtendedChars(char *str)
{
+ char *p;
+
if (!str || !*str)
return;
+#ifndef DJGPP
CharToOem(str, str);
+#else
+ p = str;
+ while (*p) *p++ &= 0x7f; /* turn off high bit; probably not right */
+#endif
}
/* parse the passed-in file name and do a namei on it. If we fail,
uname = tp;
tp += strlen(tp) + 1;
+#ifndef DJGPP /* for win95, session key is back in pioctl */
/* uuid */
memcpy(&uuid, tp, sizeof(uuid));
if (!cm_FindTokenEvent(uuid, sessionKey))
return CM_ERROR_INVAL;
+#endif /* !DJGPP */
} else
cellp = cm_rootCellp;
+ if (flags & PIOCTL_LOGON) {
+ userp = smb_FindCMUserByName(/*ioctlp->fidp->vcp,*/ uname,
+ ioctlp->fidp->vcp->rname);
+ }
+
/* store the token */
lock_ObtainMutex(&userp->mx);
ucellp = cm_GetUCell(userp, cellp);
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);
if (!cellp) 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 */
extern long cm_IoctlSetRxkcrypt(smb_ioctl_t *ioctlp, cm_user_t *userp);
+extern long cm_IoctlShutdown(smb_ioctl_t *ioctlp, cm_user_t *userp);
+
+
#endif /* __CM_IOCTL_INTERFACES_ONLY__ */
#endif /* __CM_IOCTL_H_ENV__ */
#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>
-#include <nb30.h>
#include <osi.h>
#include "afsd.h"
osi_assert(scp->refCount-- > 0);
lock_ReleaseWrite(&cm_scacheLock);
}
+
+/* just look for the scp entry to get filetype */
+/* doesn't need to be perfectly accurate, so locking doesn't matter too much */
+int cm_FindFileType(cm_fid_t *fidp)
+{
+ long hash;
+ cm_scache_t *scp;
+
+ hash = CM_SCACHE_HASH(fidp);
+
+ osi_assert(fidp->cell != 0);
+
+ lock_ObtainWrite(&cm_scacheLock);
+ for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
+ if (cm_FidCmp(fidp, &scp->fid) == 0) {
+ /*scp->refCount++;*/
+ /*cm_AdjustLRU(scp);*/
+ lock_ReleaseWrite(&cm_scacheLock);
+ return scp->fileType;
+ }
+ }
+ lock_ReleaseWrite(&cm_scacheLock);
+ return NULL;
+}
#ifndef __CM_SCACHE_H_ENV__
#define __CM_SCACHE_H_ENV__ 1
+#ifdef DJGPP
+#include "largeint95.h"
+#endif /* DJGPP */
+
typedef struct cm_fid {
unsigned long cell;
unsigned long volume;
(fidp)->unique)) \
% cm_hashTableSize)
+#include "cm_conn.h"
+#include "cm_buf.h"
+
extern cm_scache_t cm_fakeSCache;
extern void cm_InitSCache(long);
#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>
#include <osi.h>
#include <rx/rx.h>
-#include <nb30.h>
#include "afsd.h"
osi_rwlock_t cm_serverLock;
#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>
extern smb_vc_t *smb_allVCsp; /* global vcp list */
smb_vc_t *vcp;
smb_user_t *usersp;
- cm_user_t *userp;
+ cm_user_t *userp = NULL;
cm_ucell_t *ucellp;
BOOL bExpired=FALSE;
*/
lock_ObtainWrite(&smb_rctLock);
for(vcp=smb_allVCsp; vcp; vcp=vcp->nextp) {
- for(usersp=vcp->usersp; usersp; usersp=usersp->nextp) {
- userp=usersp->userp;
- osi_assert(userp);
+ for(usersp=vcp->usersp; usersp; usersp=usersp->nextp) {\r
+ if (usersp->unp) {
+ if ((userp=usersp->unp->userp)==0)\r
+ continue;\r
+ } else\r
+ continue;\r
lock_ObtainMutex(&userp->mx);
for(ucellp=userp->cellInfop; ucellp; ucellp=ucellp->nextp) {
if(ucellp->flags & CM_UCELLFLAG_RXKAD) {
#include <afs/param.h>
#include <afs/stds.h>
+#ifndef DJGPP
#include <windows.h>
+#include <winsock2.h>
+#endif /* !DJGPP */
#include <string.h>
#include <malloc.h>
-#include <winsock2.h>
#include <osi.h>
#include <rx/rx.h>
#include <afs/param.h>
#include <afs/stds.h>
+#ifndef DJGPP
#include <windows.h>
-#include <stddef.h>
#include <winsock2.h>
+#endif /* !DJGPP */
+#include <stddef.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
* which makes the code a little verbose.
*/
if (oldDscp == newDscp) {
+ /* check for identical names */
+ if (strcmp(oldNamep, newNamep) == 0)
+ return CM_ERROR_RENAME_IDENTICAL;
+
oneDir = 1;
lock_ObtainMutex(&oldDscp->mx);
cm_dnlcRemove(oldDscp, oldNamep);
int hasTilde;
} cm_lookupSearch_t;
+#include "cm_dir.h"
+
typedef int (*cm_DirFuncp_t)(struct cm_scache *, struct cm_dirEntry *, void *,
osi_hyper_t *entryOffsetp);
#include <afs/param.h>
#include <afs/stds.h>
+#ifndef DJGPP
#include <windows.h>
-#include <string.h>
-#include <malloc.h>
#include <winsock2.h>
#include <nb30.h>
+#else
+#include <sys/socket.h>
+#endif /* !DJGPP */
+#include <string.h>
+#include <malloc.h>
#include <osi.h>
#include <rx/rx.h>
#include <afs/prs_fs.h>
#include <afs/pioctl_nt.h>
+#ifndef _MFC_VER
#include <winsock2.h>
+#endif
/* Fake error code since NT errno.h doesn't define it */
#include <afs/errmap_nt.h>
* directory or online at http://www.openafs.org/dl/license10.html
*/
+//#define NOSERVICE 1
+
#include <afs/param.h>
#include <afs/stds.h>
+#ifndef DJGPP
#include <windows.h>
+#else
+#include <sys/timeb.h>
+#include <tzfile.h>
+#endif /* !DJGPP */
#include <stddef.h>
#include <stdlib.h>
#include <malloc.h>
smb_user_t *loggedOutUserp = NULL;
unsigned long loggedOutTime;
int loggedOut = 0;
+#ifdef DJGPP
+int smbShutdownFlag = 0;
+#endif /* DJGPP */
int smb_LogoffTokenTransfer;
unsigned long smb_LogoffTransferTimeout;
osi_log_t *smb_logp;
osi_rwlock_t smb_globalLock;
osi_rwlock_t smb_rctLock;
-
-unsigned char smb_LANadapter;
+osi_rwlock_t smb_ListenerLock;
+
+char smb_LANadapter;
+unsigned char smb_sharename[NCBNAMSZ+1] = {0};
/* for debugging */
long smb_maxObsConcurrentCalls=0;
int numNCBs, numSessions;
#define NCBmax 100
-HANDLE NCBavails[NCBmax], NCBevents[NCBmax];
-HANDLE **NCBreturns;
+EVENT_HANDLE NCBavails[NCBmax], NCBevents[NCBmax];
+EVENT_HANDLE **NCBreturns;
DWORD NCBsessions[NCBmax];
NCB *NCBs[NCBmax];
struct smb_packet *bufs[NCBmax];
#define Sessionmax 100
-HANDLE SessionEvents[Sessionmax];
+EVENT_HANDLE SessionEvents[Sessionmax];
unsigned short LSNs[Sessionmax];
+int lanas[Sessionmax];
BOOL dead_sessions[Sessionmax];
+LANA_ENUM lana_list;
/* 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 RAWTIMEOUT INFINITE
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
/* MessageBox or something like it */
int (WINAPI *smb_MBfunc)(HWND, LPCTSTR, LPCTSTR, UINT) = NULL;
+#endif /* DJGPP */
/* GMT time info:
* Time in Unix format of midnight, 1/1/1970 local time.
smb_vc_t *smb_allVCsp;
+smb_username_t *usernamesp = NULL;
+
smb_waitingLock_t *smb_allWaitingLocks;
/* forward decl */
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_confDir[];
+#endif
+
+#ifdef DJGPP
+#define LPTSTR char *
+#define GetComputerName(str, sizep) \
+ strcpy((str), cm_HostName); \
+ *(sizep) = strlen(cm_HostName)
+#endif /* DJGPP */
/*
* Demo expiration
#define EXPIREDATE 834000000 /* Wed Jun 5 1996 */
+char * myCrt_Dispatch(int i)
+{
+ switch (i)
+ {
+ default:
+ return "unknown SMB op";
+ case 0x00:
+ return "(00)ReceiveCoreMakeDir";
+ case 0x01:
+ return "(01)ReceiveCoreRemoveDir";
+ case 0x02:
+ return "(02)ReceiveCoreOpen";
+ case 0x03:
+ return "(03)ReceiveCoreCreate";
+ case 0x04:
+ return "(04)ReceiveCoreClose";
+ case 0x05:
+ return "(05)ReceiveCoreFlush";
+ case 0x06:
+ return "(06)ReceiveCoreUnlink";
+ case 0x07:
+ return "(07)ReceiveCoreRename";
+ case 0x08:
+ return "(08)ReceiveCoreGetFileAttributes";
+ case 0x09:
+ return "(09)ReceiveCoreSetFileAttributes";
+ case 0x0a:
+ return "(0a)ReceiveCoreRead";
+ case 0x0b:
+ return "(0b)ReceiveCoreWrite";
+ case 0x0c:
+ return "(0c)ReceiveCoreLockRecord";
+ case 0x0d:
+ return "(0d)ReceiveCoreUnlockRecord";
+ case 0x0e:
+ return "(0e)SendCoreBadOp";
+ case 0x0f:
+ return "(0f)ReceiveCoreCreate";
+ case 0x10:
+ return "(10)ReceiveCoreCheckPath";
+ case 0x11:
+ return "(11)SendCoreBadOp";
+ case 0x12:
+ return "(12)ReceiveCoreSeek";
+ case 0x1a:
+ return "(1a)ReceiveCoreReadRaw";
+ case 0x1d:
+ return "(1d)ReceiveCoreWriteRawDummy";
+ case 0x22:
+ return "(22)ReceiveV3SetAttributes";
+ case 0x23:
+ return "(23)ReceiveV3GetAttributes";
+ case 0x24:
+ return "(24)ReceiveV3LockingX";
+ case 0x29:
+ return "(29)SendCoreBadOp";
+ case 0x2b:
+ return "(2b)ReceiveCoreEcho";
+ case 0x2d:
+ return "(2d)ReceiveV3OpenX";
+ case 0x2e:
+ return "(2e)ReceiveV3ReadX";
+ case 0x32:
+ return "(32)ReceiveV3Tran2A";
+ case 0x33:
+ return "(33)ReceiveV3Tran2A";
+ case 0x34:
+ return "(34)ReceiveV3FindClose";
+ case 0x35:
+ return "(35)ReceiveV3FindNotifyClose";
+ case 0x70:
+ return "(70)ReceiveCoreTreeConnect";
+ case 0x71:
+ return "(71)ReceiveCoreTreeDisconnect";
+ case 0x72:
+ return "(72)ReceiveNegotiate";
+ case 0x73:
+ return "(73)ReceiveV3SessionSetupX";
+ case 0x74:
+ return "(74)ReceiveV3UserLogoffX";
+ case 0x75:
+ return "(75)ReceiveV3TreeConnectX";
+ case 0x80:
+ return "(80)ReceiveCoreGetDiskAttributes";
+ case 0x81:
+ return "(81)ReceiveCoreSearchDir";
+ case 0xA0:
+ return "(A0)ReceiveNTTransact";
+ case 0xA2:
+ return "(A2)ReceiveNTCreateX";
+ case 0xA4:
+ return "(A4)ReceiveNTCancel";
+ case 0xc0:
+ return "(c0)SendCoreBadOp";
+ case 0xc1:
+ return "(c1)SendCoreBadOp";
+ case 0xc2:
+ return "(c2)SendCoreBadOp";
+ case 0xc3:
+ return "(c3)SendCoreBadOp";
+ }
+}
+char * myCrt_2Dispatch(int i)
+{
+ switch (i)
+ {
+ default:
+ return "unknown SMB op-2";
+ case 0:
+ return "S(00)CreateFile";
+ case 1:
+ return "S(01)FindFirst";
+ case 2:
+ return "S(02)FindNext"; /* FindNext */
+ case 3:
+ return "S(03)QueryFileSystem_ReceiveTran2QFSInfo";
+ case 4:
+ return "S(04)??";
+ case 5:
+ return "S(05)QueryFileInfo_ReceiveTran2QPathInfo";
+ case 6:
+ return "S(06)SetFileInfo_ReceiveTran2SetPathInfo";
+ case 7:
+ return "S(07)SetInfoHandle_ReceiveTran2QFileInfo";
+ case 8:
+ return "S(08)??_ReceiveTran2SetFileInfo";
+ case 9:
+ return "S(09)??_ReceiveTran2FSCTL";
+ case 10:
+ return "S(0a)_ReceiveTran2IOCTL";
+ case 11:
+ return "S(0b)_ReceiveTran2FindNotifyFirst";
+ case 12:
+ return "S(0c)_ReceiveTran2FindNotifyNext";
+ case 13:
+ return "S(0d)CreateDirectory_ReceiveTran2MKDir";
+ }
+}
/* scache must be locked */
unsigned int smb_Attributes(cm_scache_t *scp)
return (int)num;
}
+#ifndef DJGPP
void ShowUnixTime(char *FuncName, long unixTime)
{
FILETIME ft;
osi_Log1(afsd_logp, "%s", osi_LogSaveString(afsd_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(long *pLastWriteTime)
{
smb_NowTZ = seconds;
}
+
+#ifndef DJGPP
void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, long unixTime)
{
struct tm *ltp;
SystemTimeToFileTime(&stm, largeTimep);
}
+#else /* DJGPP */
+void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, long 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
void smb_UnixTimeFromLargeSearchTime(long *unixTimep, FILETIME *largeTimep)
{
SYSTEMTIME stm;
*unixTimep = mktime(<);
_timezone = save_timezone;
}
+#else /* DJGPP */
+void smb_UnixTimeFromLargeSearchTime(long *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(long *dosTimep, long unixTime)
{
int dosTime;
struct tm localJunk;
- ltp = localtime(&unixTime);
+ ltp = localtime((time_t*) &unixTime);
/* if we fail, make up something */
if (!ltp) {
void smb_UnixTimeFromDosUTime(long *unixTimep, long 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)
+smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana)
{
smb_vc_t *vcp;
lock_ObtainWrite(&smb_rctLock);
for(vcp = smb_allVCsp; vcp; vcp=vcp->nextp) {
- if (lsn == vcp->lsn) {
+ if (lsn == vcp->lsn && lana == vcp->lana) {
vcp->refCount++;
break;
}
vcp->refCount = 1;
vcp->tidCounter = 1;
vcp->fidCounter = 1;
+ vcp->uidCounter = 1; /* UID 0 is reserved for blank user */
vcp->nextp = smb_allVCsp;
smb_allVCsp = vcp;
lock_InitializeMutex(&vcp->mx, "vc_t mutex");
vcp->lsn = lsn;
+ vcp->lana = lana;
}
lock_ReleaseWrite(&smb_rctLock);
return vcp;
smb_user_t *smb_FindUID(smb_vc_t *vcp, unsigned short uid, int flags)
{
- smb_user_t *uidp;
+ smb_user_t *uidp = NULL;
lock_ObtainWrite(&smb_rctLock);
for(uidp = vcp->usersp; uidp; uidp = uidp->nextp) {
if (uid == uidp->userID) {
uidp->refCount++;
- break;
+#ifdef DEBUG_VERBOSE
+ {
+ HANDLE h; char *ptbuf[1],buf[132];
+ h = RegisterEventSource(NULL, "AFS Service - smb_FindUID (Find by UID)");
+ sprintf(buf, "VCP[%x] found-uid[%d] name[%s]",vcp,uidp->userID,(uidp->unp ? uidp->unp->name : ""));
+ ptbuf[0] = buf;
+ ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
+ DeregisterEventSource(h);
+ }
+#endif
+ break;
}
}
if (!uidp && (flags & SMB_FLAG_CREATE)) {
vcp->usersp = uidp;
lock_InitializeMutex(&uidp->mx, "uid_t mutex");
uidp->userID = uid;
+#ifdef DEBUG_VERBOSE
+ {
+ HANDLE h; char *ptbuf[1],buf[132];
+ h = RegisterEventSource(NULL, "AFS Service - smb_FindUID (Find by UID)");
+ sprintf(buf, "VCP[%x] new-uid[%d] name[%s]",vcp,uidp->userID,(uidp->unp ? uidp->unp->name : ""));
+ ptbuf[0] = buf;
+ ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
+ DeregisterEventSource(h);
+ }
+#endif
}
lock_ReleaseWrite(&smb_rctLock);
return uidp;
}
+smb_username_t *smb_FindUserByName(char *usern, char *machine, int flags)
+{
+ smb_username_t *unp= NULL;
+
+ lock_ObtainWrite(&smb_rctLock);
+ for(unp = usernamesp; unp; unp = unp->nextp) {
+ if (stricmp(unp->name, usern) == 0 &&
+ stricmp(unp->machine, machine) == 0) {
+ unp->refCount++;
+ break;
+ }
+ }
+ if (!unp && (flags & SMB_FLAG_CREATE)) {
+ unp = malloc(sizeof(*unp));
+ memset(unp, 0, sizeof(*unp));
+ unp->nextp = usernamesp;
+ unp->name = strdup(usern);
+ unp->machine = strdup(machine);
+ usernamesp = unp;
+ lock_InitializeMutex(&unp->mx, "username_t mutex");
+ }
+ lock_ReleaseWrite(&smb_rctLock);
+ return unp;
+}
+
+smb_user_t *smb_FindUserByNameThisSession(smb_vc_t *vcp, char *usern)
+{
+ smb_user_t *uidp= NULL;
+
+ lock_ObtainWrite(&smb_rctLock);
+ for(uidp = vcp->usersp; uidp; uidp = uidp->nextp) {
+ if (!uidp->unp)
+ continue;
+ if (stricmp(uidp->unp->name, usern) == 0) {
+ uidp->refCount++;
+#ifdef DEBUG_VERBOSE
+ {
+ HANDLE h; char *ptbuf[1],buf[132];
+ h = RegisterEventSource(NULL, "AFS Service - smb_FindUserByNameThisSession");
+ sprintf(buf, "VCP[%x] uid[%d] match-name[%s]",vcp,uidp->userID,usern);
+ ptbuf[0] = buf;
+ ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
+ DeregisterEventSource(h);
+ }
+#endif
+ break;
+ } else
+ continue;
+ }
+ lock_ReleaseWrite(&smb_rctLock);
+ return uidp;
+}
void smb_ReleaseUID(smb_user_t *uidp)
{
smb_user_t *up;
osi_assert(up != NULL);
*lupp = up->nextp;
lock_FinalizeMutex(&uidp->mx);
- userp = uidp->userp; /* remember to drop ref later */
+ if (uidp->unp)
+ userp = uidp->unp->userp; /* remember to drop ref later */
}
lock_ReleaseWrite(&smb_rctLock);
if (userp) {
smbp = (smb_t *) inp;
uidp = smb_FindUID(vcp, smbp->uid, 0);
- if (!uidp) return NULL;
+ if ((!uidp) || (!uidp->unp))
+ return NULL;
lock_ObtainMutex(&uidp->mx);
- up = uidp->userp;
+ up = uidp->unp->userp;
cm_HoldUser(up);
lock_ReleaseMutex(&uidp->mx);
lock_InitializeMutex(&fidp->mx, "fid_t mutex");
fidp->fid = fid;
fidp->curr_chunk = fidp->prev_chunk = -2;
- fidp->raw_write_event = CreateEvent(NULL, FALSE, TRUE, NULL);
+ fidp->raw_write_event = thrd_CreateEvent(NULL, FALSE, TRUE, NULL);
if (newFid) {
vcp->fidCounter = fid+1;
if (vcp->fidCounter == 0) vcp->fidCounter = 1;
if (!(fidp->flags & SMB_FID_IOCTL))
scp = fidp->scp;
osi_QRemove((osi_queue_t **) &vcp->fidsp, &fidp->q);
- CloseHandle(fidp->raw_write_event);
+ thrd_CloseHandle(fidp->raw_write_event);
/* and see if there is ioctl stuff to free */
ioctlp = fidp->ioctlp;
char VNComputerName[] = "%COMPUTERNAME%";
char VNLCComputerName[] = "%LCCOMPUTERNAME%";
+/* 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 (/afs)\n", smb_localNamep, "ALL");
+
+#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, "/afs", 4) != 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 ? "/afs" : "\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 */
+
+ return num_shares;
+}
+
/* find a shareName in the table of submounts */
int smb_FindShare(smb_vc_t *vcp, smb_packet_t *inp, char *shareName,
char **pathNamep)
smb_user_t *uidp;
char temp[1024];
DWORD sizeTemp;
+ char sbmtpath[256];
+ char *p, *q;
if (strcmp(shareName, "IPC$") == 0) {
*pathNamep = NULL;
return 1;
}
+#ifndef DJGPP
+ strcpy(sbmtpath, "afsdsbmt.ini");
+#else /* DJGPP */
+ strcpy(sbmtpath, cm_confDir);
+ strcat(sbmtpath, "/afsdsbmt.ini");
+#endif /* !DJGPP */
len = GetPrivateProfileString("AFS Submounts", shareName, "",
- pathName, sizeof(pathName), "afsdsbmt.ini");
+ pathName, sizeof(pathName), sbmtpath);
if (len == 0 || len == sizeof(pathName) - 1) {
*pathNamep = NULL;
return 0;
}
+
+ /* 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 */
+ q = p;
+ while (*q) {
+ if (*q == '/') *q = '\\'; /* change to \ */
+ q++;
+ }
while (1)
{
- if (var = smb_stristr(pathName, VNUserName)) {
+ if (var = smb_stristr(p, VNUserName)) {
uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0);
- smb_subst(pathName, var, sizeof(VNUserName),
- uidp->name);
+ if (uidp && uidp->unp)
+ smb_subst(p, var, sizeof(VNUserName),
+ uidp->unp->name);
+ else
+ smb_subst(p, var, sizeof(VNUserName),
+ " ");
smb_ReleaseUID(uidp);
}
- else if (var = smb_stristr(pathName, VNLCUserName)) {
+ else if (var = smb_stristr(p, VNLCUserName)) {
uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0);
- strcpy(temp, uidp->name);
+ if (uidp && uidp->unp)
+ strcpy(temp, uidp->unp->name);
+ else strcpy(temp, " ");
_strlwr(temp);
- smb_subst(pathName, var, sizeof(VNLCUserName), temp);
+ smb_subst(p, var, sizeof(VNLCUserName), temp);
smb_ReleaseUID(uidp);
}
- else if (var = smb_stristr(pathName, VNComputerName)) {
+ else if (var = smb_stristr(p, VNComputerName)) {
sizeTemp = sizeof(temp);
GetComputerName((LPTSTR)temp, &sizeTemp);
- smb_subst(pathName, var, sizeof(VNComputerName),
+ smb_subst(p, var, sizeof(VNComputerName),
temp);
}
- else if (var = smb_stristr(pathName, VNLCComputerName)) {
+ else if (var = smb_stristr(p, VNLCComputerName)) {
sizeTemp = sizeof(temp);
GetComputerName((LPTSTR)temp, &sizeTemp);
_strlwr(temp);
- smb_subst(pathName, var, sizeof(VNLCComputerName),
+ smb_subst(p, var, sizeof(VNLCComputerName),
temp);
}
else break;
}
- *pathNamep = strdup(pathName);
+ *pathNamep = strdup(p);
return 1;
}
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;
if (tbp) smb_packetFreeListp = tbp->nextp;
lock_ReleaseWrite(&smb_globalLock);
if (!tbp) {
+#ifndef DJGPP
tbp = GlobalAlloc(GMEM_FIXED, 65540);
+#else /* DJGPP */
+ tbp = malloc(sizeof(smb_packet_t));
+#endif /* !DJGPP */
tbp->magic = SMB_PACKETMAGIC;
tbp->ncbp = NULL;
tbp->vcp = NULL;
tbp->oddByte = 0;
tbp->ncb_length = 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;
+#endif /* DJGPP */
+ }
osi_assert(tbp->magic == SMB_PACKETMAGIC);
return tbp;
smb_packet_t *tbp;
tbp = GetPacket();
memcpy(tbp, pkt, sizeof(smb_packet_t));
- tbp->wctp = tbp->data + (pkt->wctp - 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;
+#ifdef DJGPP
+ unsigned int npar, seg, tb_sel;
+#endif /* DJGPP */
+
lock_ObtainWrite(&smb_globalLock);
tbp = smb_ncbFreeListp;
if (tbp) smb_ncbFreeListp = tbp->nextp;
lock_ReleaseWrite(&smb_globalLock);
if (!tbp) {
+#ifndef DJGPP
tbp = GlobalAlloc(GMEM_FIXED, sizeof(*tbp));
+#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;
+#endif /* !DJGPP */
tbp->magic = SMB_NCBMAGIC;
}
osi_assert(tbp->magic == SMB_NCBMAGIC);
memset(&tbp->ncb, 0, sizeof(NCB));
- return &tbp->ncb;
+ ncbp = &tbp->ncb;
+#ifdef DJGPP
+ dos_memset(tbp->dos_ncb, 0, sizeof(NCB));
+#endif /* DJGPP */
+ return ncbp;
}
void smb_FreePacket(smb_packet_t *tbp)
parmCount = *smbp->wctp;
if (parm >= parmCount) {
+#ifndef DJGPP
HANDLE h;
char *ptbuf[1];
char s[100];
ReportEvent(h, EVENTLOG_ERROR_TYPE, 0, 1006, NULL,
1, smbp->ncb_length, ptbuf, smbp);
DeregisterEventSource(h);
+#else /* DJGPP */
+ char s[100];
+
+ sprintf(s, "Bad SMB param %d out of %d, ncb len %d",
+ parm, parmCount, smbp->ncb_length);
+ osi_Log0(afsd_logp, s);
+#endif /* !DJGPP */
osi_panic(s, __FILE__, __LINE__);
}
parmDatap = smbp->wctp + (2*parm) + 1;
parmCount = *smbp->wctp;
if (parm * 2 + offset >= parmCount * 2) {
+#ifndef DJGPP
HANDLE h;
char *ptbuf[1];
char s[100];
ReportEvent(h, EVENTLOG_ERROR_TYPE, 0, 1006, NULL,
1, smbp->ncb_length, ptbuf, smbp);
DeregisterEventSource(h);
+#else /* DJGPP */
+ char s[100];
+
+ sprintf(s, "Bad SMB param %d offset %d out of %d, "
+ "ncb len %d",
+ parm, offset, parmCount, smbp->ncb_length);
+ osi_Log0(afsd_logp, s);
+#endif /* !DJGPP */
+
osi_panic(s, __FILE__, __LINE__);
}
parmDatap = smbp->wctp + (2*parm) + 1 + offset;
long code;
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));
extra = 2 * (*inp->wctp); /* space used by parms, in bytes */
tp = inp->wctp + 1+ extra; /* points to count of data bytes */
extra += tp[0] + (tp[1]<<8);
- extra += (inp->wctp - inp->data); /* distance to last wct field */
+ extra += ((unsigned int)inp->wctp - (unsigned int)inp->data); /* distance to last wct field */
extra += 3; /* wct and length fields */
ncbp->ncb_length = extra; /* bytes to send */
ncbp->ncb_lsn = (unsigned char) vcp->lsn; /* vc to use */
- ncbp->ncb_lana_num = smb_LANadapter;
+ 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)
osi_Log1(afsd_logp, "SendPacket failure code %d", code);
class = 1;
error = 18; /* no files in search */
}
+ else if (code == CM_ERROR_RENAME_IDENTICAL) {
+ class = 1;
+ error = 183; /* Samba uses this */
+ }
else {
class = 2;
error = 1;
smb_fid_t *fidp;
long code;
cm_user_t *userp = NULL;
- char *rawBuf;
- NCB *ncbp;
+ 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 (!fidp)
goto send1;
- if (fidp->flags & SMB_FID_IOCTL)
- return smb_IoctlReadRaw(fidp, vcp, inp, outp);
-
- userp = smb_GetUser(vcp, inp);
-
lock_ObtainMutex(&smb_RawBufLock);
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)
- goto send;
+ goto send1a;
+ if (fidp->flags & SMB_FID_IOCTL)
+ {
+#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);
+ }
+ return rc;
+ }
+
+ userp = smb_GetUser(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;
send:
+ cm_ReleaseUser(userp);
+send1a:
smb_ReleaseFID(fidp);
- cm_ReleaseUser(userp);
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_lsn = (unsigned char) vcp->lsn;
- ncbp->ncb_lana_num = smb_LANadapter;
+ ncbp->ncb_lana_num = vcp->lana;
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(afsd_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);
}
int NTProtoIndex;
int protoIndex; /* index we're using */
int namex;
- long dbytes;
+ int dbytes;
int entryLength;
int tcounter;
char protocol_array[10][1024]; /* protocol signature of the client */
while(1) {
count++;
- Sleep(10000);
+ thrd_Sleep(10000);
if ((count % 360) == 0) /* every hour */
smb_CalculateNowTZ();
/* XXX GC dir search entries */
nwL = smb_allWaitingLocks;
if (nwL == NULL) {
osi_SleepW((long)&smb_allWaitingLocks, &smb_globalLock);
- Sleep(1000);
+ thrd_Sleep(1000);
continue;
}
else first = 1;
FreeNCB(ncbp);
free(wL);
} while (nwL);
- Sleep(1000);
+ thrd_Sleep(1000);
}
}
/* pull pathname and stat block out of request */
tp = smb_GetSMBData(inp, NULL);
- pathp = smb_ParseASCIIBlock(tp, &tp);
+ pathp = smb_ParseASCIIBlock(tp, (char **) &tp);
osi_assert(pathp != NULL);
- statBlockp = smb_ParseVblBlock(tp, &tp, &statLen);
+ statBlockp = smb_ParseVblBlock(tp, (char **) &tp, &statLen);
osi_assert(statBlockp != NULL);
if (statLen == 0) {
statBlockp = initStatBlock;
int maxCount;
smb_dirListPatch_t *dirListPatchesp;
smb_dirListPatch_t *curPatchp;
- long dataLength;
+ int dataLength;
cm_buf_t *bufferp;
long temp;
osi_hyper_t dirLength;
int caseFold;
char *tidPathp;
cm_req_t req;
+ cm_fid_t fid;
+ int fileType;
cm_InitReq(&req);
/* this is one of the entries to use: it is not deleted
* and it matches the star pattern we're looking for.
*/
+
+ /* Eliminate entries that don't match requested
+ attributes */
+ if (!(dsp->attribute & 0x10)) /* no directories */
+ {
+ /* We have already done the cm_TryBulkStat above */
+ fid.cell = scp->fid.cell;
+ fid.volume = scp->fid.volume;
+ fid.vnode = ntohl(dep->fid.vnode);
+ fid.unique = ntohl(dep->fid.unique);
+ fileType = cm_FindFileType(&fid);
+ osi_Log2(afsd_logp, "smb_ReceiveCoreSearchDir: file %s "
+ "has filetype %d", dep->name,
+ fileType);
+ if (fileType == CM_SCACHETYPE_DIRECTORY)
+ goto nextEntry;
+ }
+
*op++ = resByte;
memcpy(op, mask, 11); op += 11;
*op++ = (char) dsp->cookie; /* they say it must be non-zero */
int any;
} smb_unlinkRock_t;
-long smb_UnlinkProc(cm_scache_t *dscp, cm_dirEntry_t *dep, void *vrockp, osi_hyper_t *offp)
+int smb_UnlinkProc(cm_scache_t *dscp, cm_dirEntry_t *dep, void *vrockp, osi_hyper_t *offp)
{
long code;
smb_unlinkRock_t *rockp;
char *newNamep; /* ptr to the new file's name */
} smb_renameRock_t;
-long smb_RenameProc(cm_scache_t *dscp, cm_dirEntry_t *dep, void *vrockp, osi_hyper_t *offp)
+int smb_RenameProc(cm_scache_t *dscp, cm_dirEntry_t *dep, void *vrockp, osi_hyper_t *offp)
{
long code;
smb_renameRock_t *rockp;
int any;
} smb_rmdirRock_t;
-long smb_RmdirProc(cm_scache_t *dscp, cm_dirEntry_t *dep, void *vrockp, osi_hyper_t *offp)
+int smb_RmdirProc(cm_scache_t *dscp, cm_dirEntry_t *dep, void *vrockp, osi_hyper_t *offp)
{
long code;
smb_rmdirRock_t *rockp;
char *fullName;
};
-long smb_FullNameProc(cm_scache_t *scp, cm_dirEntry_t *dep, void *rockp,
+int smb_FullNameProc(cm_scache_t *scp, cm_dirEntry_t *dep, void *rockp,
osi_hyper_t *offp)
{
char shortName[13];
/* Don't jump the gun on an async raw write */
while (fidp->raw_writers) {
lock_ReleaseMutex(&fidp->mx);
- WaitForSingleObject(fidp->raw_write_event, RAWTIMEOUT);
+ thrd_WaitForSingleObject_Event(fidp->raw_write_event, RAWTIMEOUT);
lock_ObtainMutex(&fidp->mx);
}
/*
* 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;
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);
/* adjust counters, pointers, etc. */
/*
* 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;
if (nbytes > count) 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);
buf_SetDirty(bufferp);
cm_user_t *userp;
cm_attr_t truncAttr; /* attribute struct used for truncating file */
char *op;
- long inDataBlockCount;
+ int inDataBlockCount;
fd = smb_GetSMBParm(inp, 0);
count = smb_GetSMBParm(inp, 1);
fidp->scp->clientModTime = time(NULL);
}
+#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 < count)
code = CM_ERROR_PARTIALWRITE;
unsigned short fd;
smb_fid_t *fidp;
cm_user_t *userp;
+#ifndef DJGPP
char *rawBuf;
- int written = 0;
+#else /* DJGPP */
+ dos_ptr rawBuf;
+#endif /* !DJGPP */
+ long written = 0;
long code;
fd = smb_GetSMBParm(inp, 0);
userp = smb_GetUser(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;
lock_ObtainMutex(&fidp->mx);
fidp->raw_writers--;
if (fidp->raw_writers == 0)
- SetEvent(fidp->raw_write_event);
+ thrd_SetEvent(fidp->raw_write_event);
lock_ReleaseMutex(&fidp->mx);
}
/* 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);
fidp->scp->clientModTime = time(NULL);
}
+#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 < count)
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;
if (code == 0 && (writeMode & 1) == 0) {
lock_ObtainMutex(&fidp->mx);
fidp->raw_writers++;
- ResetEvent(fidp->raw_write_event);
+ thrd_ResetEvent(fidp->raw_write_event);
lock_ReleaseMutex(&fidp->mx);
}
*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
HANDLE h;
char *ptbuf[1];
char s[100];
ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1007, NULL,
1, ncbp->ncb_length, ptbuf, inp);
DeregisterEventSource(h);
+#else /* DJGPP */
+ osi_Log1(smb_logp, "SMB message too short, len %d",
+ ncbp->ncb_length);
+#endif /* !DJGPP */
+
return;
}
/* We are an ongoing op */
- InterlockedIncrement(&ongoingOps);
+ thrd_Increment(&ongoingOps);
/* set up response packet for receiving output */
if (!(outp->flags & SMB_PACKETFLAG_SUSPENDED))
/* Raw Write */
code = smb_ReceiveCoreWriteRaw (vcp, inp, outp,
rwcp);
- else
- code = (*(dp->procp)) (vcp, inp, outp);
+ else {
+
+#ifdef DEBUG_VERBOSE
+ HANDLE h; char *ptbuf[1],buf[132];DWORD err;
+ h = RegisterEventSource(NULL, "AFS Server - Dispatch");
+ sprintf(buf,"%s vcp[%x] lana[%d] lsn[%d]",myCrt_Dispatch(inp->inCom),vcp,vcp->lana,vcp->lsn);
+ ptbuf[0] = buf;
+ ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
+ DeregisterEventSource(h);
+#endif
+ code = (*(dp->procp)) (vcp, inp, outp);
+
+#ifdef DEBUG_VERBOSE
+ h = RegisterEventSource(NULL, "AFS Server - Dispatch return ");
+ sprintf(buf,"code[%d]",code-CM_ERROR_BASE);
+ if (code)
+ ptbuf[0] = buf;
+ else
+ ptbuf[0] = "code[0]";
+ ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
+ DeregisterEventSource(h);
+#endif
+ }
if (oldGen != sessionGen) {
+#ifndef DJGPP
HANDLE h;
char *ptbuf[1];
char s[100];
ReportEvent(h, EVENTLOG_WARNING_TYPE, 0,
1005, NULL, 1, ncbp->ncb_length, ptbuf, smbp);
DeregisterEventSource(h);
+#else /* DJGPP */
+ osi_Log1(afsd_logp, "Pkt straddled session startup, "
+ "ncb length %d", ncbp->ncb_length);
+#endif /* !DJGPP */
}
}
else {
/* bad opcode, fail the request, after displaying it */
+#ifndef DJGPP
if (showErrors) {
sprintf(tbuffer, "Received bad SMB req 0x%x", inp->inCom);
code = (*smb_MBfunc)(NULL, tbuffer, "Cancel: don't show again",
MB_OKCANCEL);
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
HANDLE h;
char *ptbuf[1];
char s[100];
ReportEvent(h, EVENTLOG_ERROR_TYPE, 0, 1002, NULL,
1, ncbp->ncb_length, ptbuf, smbp);
DeregisterEventSource(h);
+#else /* DJGPP */
+ osi_Log1(afsd_logp, "Invalid SMB message, length %d",
+ ncbp->ncb_length);
+#endif /* !DJGPP */
code = CM_ERROR_INVAL;
}
if (outp->flags & SMB_PACKETFLAG_NOSEND) {
- InterlockedDecrement(&ongoingOps);
+ thrd_Decrement(&ongoingOps);
return;
}
/* tp now points to the new output record; go back and patch the
* second parameter (off2) to point to the new record.
*/
- temp = tp - ((char *) outp->data);
+ temp = (unsigned int)tp - ((unsigned int) outp->data);
outWctp[3] = (unsigned char) (temp & 0xff);
outWctp[4] = (unsigned char) ((temp >> 8) & 0xff);
outWctp[2] = 0; /* padding */
/* now send the output packet, and return */
if (!noSend)
smb_SendPacket(vcp, outp);
- InterlockedDecrement(&ongoingOps);
+ thrd_Decrement(&ongoingOps);
if (!(vcp->flags & SMB_VCFLAG_ALREADYDEAD)) {
active_vcp = vcp;
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
DWORD code, idx;
while (1) {
- code = WaitForMultipleObjects(numNCBs, NCBevents,
+ code = thrd_WaitForMultipleObjects_Event(numNCBs, NCBevents,
FALSE, INFINITE);
if (code == WAIT_OBJECT_0)
continue;
idx = code - WAIT_OBJECT_0;
- ResetEvent(NCBevents[idx]);
- SetEvent(NCBreturns[0][idx]);
+ thrd_ResetEvent(NCBevents[idx]);
+ thrd_SetEvent(NCBreturns[0][idx]);
}
}
+#endif /* !DJGPP */
/*
* Try to have one NCBRECV request waiting for every live session. Not more
{
DWORD code, idx_session, idx_NCB;
NCB *ncbp;
+#ifdef DJGPP
+ dos_ptr dos_ncb;
+#endif /* DJGPP */
while (1) {
/* Get a session */
- code = WaitForMultipleObjects(numSessions, SessionEvents,
- FALSE, INFINITE);
+ code = thrd_WaitForMultipleObjects_Event(numSessions, SessionEvents,
+ FALSE, INFINITE);
if (code == WAIT_OBJECT_0)
continue;
idx_session = code - WAIT_OBJECT_0;
/* Get an NCB */
NCBretry:
- code = WaitForMultipleObjects(numNCBs, NCBavails,
- FALSE, INFINITE);
+ code = thrd_WaitForMultipleObjects_Event(numNCBs, NCBavails,
+ FALSE, INFINITE);
if (code == WAIT_OBJECT_0)
goto NCBretry;
idx_NCB = code - WAIT_OBJECT_0;
/* Fire it up */
ncbp = NCBs[idx_NCB];
+#ifdef DJGPP
+ dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb;
+#endif /* DJGPP */
ncbp->ncb_lsn = (unsigned char) LSNs[idx_session];
ncbp->ncb_command = NCBRECV | ASYNCH;
- ncbp->ncb_lana_num = smb_LANadapter;
+ ncbp->ncb_lana_num = lanas[idx_session];
+#ifndef DJGPP
ncbp->ncb_buffer = (unsigned char *) bufs[idx_NCB];
- ncbp->ncb_length = SMB_PACKETSIZE;
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;
+ Netbios(ncbp, dos_ncb);
+#endif /* !DJGPP */
}
}
UCHAR rc;
smb_vc_t *vcp;
smb_t *smbp;
+#ifdef DJGPP
+ dos_ptr dos_ncb;
+#endif /* DJGPP */
outncbp = GetNCB();
outbufp = GetPacket();
(*smb_MBfunc)(NULL, "AFS demo expiration",
"afsd dispatcher",
MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
- ExitThread(1);
+ trhd_Exit(1);
}
}
#endif /* !NOEXPIRE */
- code = WaitForMultipleObjects(numNCBs, NCBreturns[myIdx],
- FALSE, INFINITE);
+ code = thrd_WaitForMultipleObjects_Event(numNCBs, NCBreturns[myIdx],
+ FALSE, INFINITE);
if (code == WAIT_OBJECT_0)
continue;
idx_NCB = code - WAIT_OBJECT_0;
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:
/* Client closed session */
dead_sessions[idx_session] = TRUE;
- vcp = smb_FindVC(ncbp->ncb_lsn, 0);
+ vcp = smb_FindVC(ncbp->ncb_lsn, 0, lanas[idx_session]);
/* Should also release vcp. Also, would do
* sanity check that all TID's are gone. */
if (dead_vcp)
loggedOut = 1;
loggedOutTime = vcp->logoffTime;
loggedOutName =
- strdup(vcp->justLoggedOut->name);
+ strdup(vcp->justLoggedOut->unp->name);
loggedOutUserp = vcp->justLoggedOut;
lock_ObtainWrite(&smb_rctLock);
loggedOutUserp->refCount++;
case NRC_INCOMP:
/* Treat as transient error */
{
- HANDLE h;
+#ifndef DJGPP
+ EVENT_HANDLE h;
char *ptbuf[1];
char s[100];
ncbp->ncb_length, ptbuf,
bufp);
DeregisterEventSource(h);
+#else /* DJGPP */
+ osi_Log1(smb_logp,
+ "dispatch smb recv failed, message incomplete, ncb_length %d",
+ ncbp->ncb_length);
+ osi_Log1(smb_logp,
+ "SMB message incomplete, "
+ "length %d", ncbp->ncb_length);
+#endif /* !DJGPP */
+
/*
* We used to discard the packet.
* Instead, try handling it normally.
if (vcp->errorCount++ > 3)
dead_sessions[idx_session] = TRUE;
else {
- Sleep(1000);
- SetEvent(SessionEvents[idx_session]);
+ thrd_Sleep(1000);
+ thrd_SetEvent(SessionEvents[idx_session]);
}
continue;
}
if (smb_concurrentCalls > smb_maxObsConcurrentCalls)
smb_maxObsConcurrentCalls = smb_concurrentCalls;
- vcp = smb_FindVC(ncbp->ncb_lsn, 0);
+ vcp = smb_FindVC(ncbp->ncb_lsn, 0, ncbp->ncb_lana_num);
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 (smbp->com == 0x1d) {
/* Special handling for Write Raw */
raw_write_cont_t rwc;
- HANDLE rwevent;
+ EVENT_HANDLE rwevent;
smb_DispatchPacket(vcp, bufp, outbufp, ncbp, &rwc);
if (rwc.code == 0) {
- rwevent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ rwevent = thrd_CreateEvent(NULL, FALSE, FALSE, NULL);
ncbp->ncb_command = NCBRECV | ASYNCH;
ncbp->ncb_lsn = (unsigned char) vcp->lsn;
- ncbp->ncb_lana_num = smb_LANadapter;
+ ncbp->ncb_lana_num = vcp->lana;
ncbp->ncb_buffer = rwc.buf;
ncbp->ncb_length = 65535;
ncbp->ncb_event = rwevent;
+#ifndef DJGPP
Netbios(ncbp);
- rcode = WaitForSingleObject(rwevent,
- RAWTIMEOUT);
- CloseHandle(rwevent);
+#else
+ Netbios(ncbp, dos_ncb);
+#endif /* !DJGPP */
+ rcode = thrd_WaitForSingleObject_Event(rwevent,
+ RAWTIMEOUT);
+ thrd_CloseHandle(rwevent);
}
- SetEvent(SessionEvents[idx_session]);
+ thrd_SetEvent(SessionEvents[idx_session]);
if (rwc.code == 0)
smb_CompleteWriteRaw(vcp, bufp, outbufp, ncbp,
&rwc);
* (defect 11626)
*/
smb_DispatchPacket(vcp, bufp, outbufp, ncbp, NULL);
- SetEvent(SessionEvents[idx_session]);
+ thrd_SetEvent(SessionEvents[idx_session]);
} else {
- SetEvent(SessionEvents[idx_session]);
+ thrd_SetEvent(SessionEvents[idx_session]);
smb_DispatchPacket(vcp, bufp, outbufp, ncbp, NULL);
}
smb_concurrentCalls--;
doneWithNCB:
- SetEvent(NCBavails[idx_NCB]);
+ thrd_SetEvent(NCBavails[idx_NCB]);
}
}
void InitNCBslot(int idx)
{
struct smb_packet *bufp;
- HANDLE retHandle;
+ EVENT_HANDLE retHandle;
int i;
NCBs[idx] = GetNCB();
- NCBavails[idx] = CreateEvent(NULL, FALSE, TRUE, NULL);
- NCBevents[idx] = CreateEvent(NULL, TRUE, FALSE, NULL);
- retHandle = CreateEvent(NULL, FALSE, FALSE, NULL);
+ NCBavails[idx] = thrd_CreateEvent(NULL, FALSE, TRUE, NULL);
+#ifndef DJGPP
+ NCBevents[idx] = thrd_CreateEvent(NULL, TRUE, FALSE, NULL);
+#endif /* !DJGPP */
+ retHandle = thrd_CreateEvent(NULL, FALSE, FALSE, NULL);
for (i=0; i<smb_NumServerThreads; i++)
NCBreturns[i][idx] = retHandle;
bufp = GetPacket();
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 lana = (int) parmp;
ncbp = GetNCB();
+#ifdef DJGPP
+ dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb;
+#endif /* DJGPP */
while (1) {
+ memset(ncbp, 0, sizeof(NCB));
+#ifdef DJGPP
+ /* terminate if shutdown flag is set */
+ if (smbShutdownFlag == 1)
+ thrd_Exit(1);
+#endif /* DJGPP */
+
#ifndef NOEXPIRE
/* check for demo expiration */
{
strcpy(ncbp->ncb_callname, "*");
for(i=1; i<NCBNAMSZ; i++) ncbp->ncb_callname[i] = ' ';
- ncbp->ncb_lana_num = smb_LANadapter;
+ ncbp->ncb_lana_num = lana;
+#ifndef DJGPP
code = Netbios(ncbp);
+#else /* DJGPP */
+ code = Netbios(ncbp, dos_ncb);
+
+ if (code != 0)
+ {
+ fprintf(stderr, "NCBLISTEN lana=%d failed with code %d\n",
+ ncbp->ncb_lana_num, code);
+ osi_Log2(0, "NCBLISTEN lana=%d failed with code %d",
+ 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 */
+
osi_assert(code == 0);
/* check for remote conns */
flags |= SMB_VCFLAG_REMOTECONN;
osi_Log1(afsd_logp, "New session lsn %d", ncbp->ncb_lsn);
+ /* lock */
+ lock_ObtainMutex(&smb_ListenerLock);
/* New generation */
sessionGen++;
/* Log session startup */
+#ifdef NOSERVICE
+ fprintf(stderr, "New session(ncb_lsn,ncb_lana_num) %d,%d starting from host "
+ "%s\n",
+ ncbp->ncb_lsn,ncbp->ncb_lana_num, rname);
+#endif
if (reportSessionStartups) {
+#ifndef DJGPP
HANDLE h;
char *ptbuf[1];
char s[100];
ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1004, NULL,
1, 0, ptbuf, NULL);
DeregisterEventSource(h);
+#else /* DJGPP */
+ afsi_log("NCBLISTEN completed, call from %s",rname);
+ osi_Log1(afsd_logp, "SMB session startup, %d ongoing ops",
+ ongoingOps);
+ time(&now);
+ fprintf(stderr, "%s: New session %d starting from host "
+ "%s\n",
+ asctime(localtime(&now)), ncbp->ncb_lsn, rname);
+ fflush(stderr);
+#endif /* !DJGPP */
}
/* now ncbp->ncb_lsn is the connection ID */
- vcp = smb_FindVC(ncbp->ncb_lsn, SMB_FLAG_CREATE);
+ vcp = smb_FindVC(ncbp->ncb_lsn, SMB_FLAG_CREATE, ncbp->ncb_lana_num);
vcp->flags |= flags;
+ strcpy(vcp->rname, rname);
/* Allocate slot in session arrays */
/* Re-use dead session if possible, otherwise add one more */
}
}
LSNs[i] = ncbp->ncb_lsn;
+ lanas[i] = ncbp->ncb_lana_num;
+
if (i == numSessions) {
/* Add new NCB for new session */
InitNCBslot(numNCBs);
numNCBs++;
- SetEvent(NCBavails[0]);
- SetEvent(NCBevents[0]);
+ thrd_SetEvent(NCBavails[0]);
+ thrd_SetEvent(NCBevents[0]);
for (j = 0; j < smb_NumServerThreads; j++)
- SetEvent(NCBreturns[j][0]);
+ thrd_SetEvent(NCBreturns[j][0]);
/* Also add new session event */
- SessionEvents[i] = CreateEvent(NULL, FALSE, TRUE, NULL);
+ SessionEvents[i] = thrd_CreateEvent(NULL, FALSE, TRUE, NULL);
numSessions++;
- SetEvent(SessionEvents[0]);
+ thrd_SetEvent(SessionEvents[0]);
} else {
- SetEvent(SessionEvents[i]);
+ thrd_SetEvent(SessionEvents[i]);
}
+ /* unlock */
+ lock_ReleaseMutex(&smb_ListenerLock);
} /* dispatch while loop */
}
+/* initialize Netbios */
+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;
+ int len;
+ int lana_found = 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 = &lana_list;
+ ncbp->ncb_length = sizeof(lana_list);
+ code = Netbios(ncbp);
+ if (code != 0) {
+ sprintf(s, "Netbios NCBENUM error code %d", code);
+ afsi_log(s);
+ osi_panic(s, __FILE__, __LINE__);
+ }
+ }
+ else {
+ lana_list.length = 1;
+ lana_list.lana[0] = smb_LANadapter;
+ }
+
+ for (i = 0; i < lana_list.length; i++) {
+ /* reset the adaptor: in Win32, this is required for every process, and
+ * acts as an init call, not as a real hardware reset.
+ */
+ ncbp->ncb_command = NCBRESET;
+ ncbp->ncb_callname[0] = 100;
+ 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) {
+ 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);
+ }
+ }
+#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 */
+
+ try_addname:
+ /* and declare our name so we can receive connections */
+ memset(ncbp, 0, sizeof(*ncbp));
+ len=lstrlen(smb_localNamep);
+ memset(smb_sharename,' ',NCBNAMSZ);
+ memcpy(smb_sharename,smb_localNamep,len);
+#if 0
+ /*ncbp->ncb_lana_num = smb_LANadapter;*/
+ strcpy(ncbp->ncb_name, smb_localNamep);
+ len = strlen(smb_localNamep);
+ for(i=len; i<NCBNAMSZ; i++) ncbp->ncb_name[i] = ' ';
+#endif
+ /* Keep the name so we can unregister it later */
+ for (l = 0; l < lana_list.length; l++) {
+ lana = lana_list.lana[l];
+
+ 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);
+ {
+ char name[NCBNAMSZ+1];
+ name[NCBNAMSZ]=0;
+ memcpy(name,ncbp->ncb_name,NCBNAMSZ);
+ afsi_log("Netbios NCBADDNAME added new name >%s<",name);
+ }
+
+ if (code == 0) code = ncbp->ncb_retcode;
+ if (code == 0) {
+ fprintf(stderr, "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 {
+ 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 */
+ memset(ncbp, 0, sizeof(*ncbp));
+ 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
+ fprintf(stderr, "Netbios NCBDELNAME lana %d error code %d\n", lana, code);
+ fflush(stderr);
+ if (code != 0 || delname_tried) {
+ lana_list.lana[l] = 255;
+ }
+ else if (code == 0) {
+ if (!delname_tried) {
+ lana--;
+ delname_tried = 1;
+ continue;
+ }
+ }
+ }
+ else {
+ sprintf(s, "Netbios NCBADDNAME lana %d error code %d", lana, code);
+ afsi_log(s);
+ lana_list.lana[l] = 255; /* invalid lana */
+ osi_panic(s, __FILE__, __LINE__);
+ }
+ }
+ if (code == 0) {
+ lana_found = 1; /* at least one worked */
+#ifdef DJGPP
+ break;
+#endif
+ }
+ }
+
+ osi_assert(lana_list.length >= 0);
+ if (!lana_found) {
+ sprintf(s, "No valid LANA numbers found!");
+ osi_panic(s, __FILE__, __LINE__);
+ }
+
+ /* we're done with the NCB now */
+ FreeNCB(ncbp);
+}
+
void smb_Init(osi_log_t *logp, char *snamep, int useV3, int LANadapt,
- int nThreads, void *aMBfunc)
+ int nThreads
+#ifndef DJGPP
+ , void *aMBfunc
+#endif
+ )
+
{
- HANDLE phandle;
- long lpid;
+ thread_t phandle;
+ int lpid;
int i;
long code;
int len;
NCB *ncbp;
struct tm myTime;
char s[100];
+#ifdef DJGPP
+ int npar, seg, sel;
+ dos_ptr rawBuf;
+#endif /* DJGPP */
+#ifndef DJGPP
smb_MBfunc = aMBfunc;
+#endif /* DJGPP */
#ifndef NOEXPIRE
/* check for demo expiration */
{
unsigned long tod = time((void *) 0);
if (tod > EXPIREDATE) {
+#ifndef DJGPP
(*smb_MBfunc)(NULL, "AFS demo expiration",
"afsd",
MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
exit(1);
+#else /* DJGPP */
+ fprintf(stderr, "AFS demo expiration\n");
+ afs_exit(0);
+#endif /* !DJGPP */
}
}
#endif /* !NOEXPIRE */
/* Raw I/O data structures */
lock_InitializeMutex(&smb_RawBufLock, "smb raw buffer lock");
+ lock_InitializeMutex(&smb_ListenerLock, "smb listener lock");
+
/* 4 Raw I/O buffers */
+#ifndef DJGPP
smb_RawBufs = GlobalAlloc(GMEM_FIXED, 65536);
*((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;
smb_packetFreeListp = NULL;
- /* setup the NCB system */
- ncbp = GetNCB();
-
- /* reset the adaptor: in Win32, this is required for every process, and
- * acts as an init call, not as a real hardware reset.
- */
- ncbp->ncb_command = NCBRESET;
- ncbp->ncb_callname[0] = 100;
- ncbp->ncb_callname[2] = 100;
- ncbp->ncb_lana_num = smb_LANadapter;
- code = Netbios(ncbp);
- if (code == 0) code = ncbp->ncb_retcode;
- if (code != 0) {
- sprintf(s, "Netbios NCBRESET error code %d", code);
- afsi_log(s);
- osi_panic(s, __FILE__, __LINE__);
- }
-
- /* and declare our name so we can receive connections */
- memset(ncbp, 0, sizeof(*ncbp));
- ncbp->ncb_lana_num = smb_LANadapter;
- ncbp->ncb_command = NCBADDNAME;
- strncpy(ncbp->ncb_name, snamep, len);
- for(i=len; i<NCBNAMSZ; i++) ncbp->ncb_name[i] = ' ';
- code = Netbios(ncbp);
- if (code == 0) {
- code = ncbp->ncb_retcode;
- }
- if (code != 0) {
- afsi_log("Netbios NCBADDNAME error code %d", code);
- }
-
- /* we're done with the NCB now */
- FreeNCB(ncbp);
+ smb_NetbiosInit();
/* Initialize listener and server structures */
memset(dead_sessions, 0, sizeof(dead_sessions));
- SessionEvents[0] = CreateEvent(NULL, FALSE, FALSE, NULL);
+ SessionEvents[0] = thrd_CreateEvent(NULL, FALSE, FALSE, NULL);
numSessions = 1;
smb_NumServerThreads = nThreads;
- NCBavails[0] = CreateEvent(NULL, FALSE, FALSE, NULL);
- NCBevents[0] = CreateEvent(NULL, FALSE, FALSE, NULL);
- NCBreturns = malloc(nThreads * sizeof(HANDLE *));
+ NCBavails[0] = thrd_CreateEvent(NULL, FALSE, FALSE, NULL);
+ NCBevents[0] = thrd_CreateEvent(NULL, FALSE, FALSE, NULL);
+ NCBreturns = malloc(nThreads * sizeof(EVENT_HANDLE *));
for (i = 0; i < nThreads; i++) {
- NCBreturns[i] = malloc(NCBmax * sizeof(HANDLE));
- NCBreturns[i][0] = CreateEvent(NULL, FALSE, FALSE, NULL);
+ NCBreturns[i] = malloc(NCBmax * sizeof(EVENT_HANDLE));
+ NCBreturns[i][0] = thrd_CreateEvent(NULL, FALSE, FALSE, NULL);
}
for (i = 1; i <= nThreads; i++)
InitNCBslot(i);
/* Start listeners, waiters, servers, and daemons */
- phandle = CreateThread(NULL, 65536, (LPTHREAD_START_ROUTINE) smb_Listener,
- NULL, 0, &lpid);
- osi_assert(phandle != NULL);
- CloseHandle(phandle);
+ for (i = 0; i < lana_list.length; i++) {
+ if (lana_list.lana[i] == 255) continue;
+ phandle = thrd_Create(NULL, 65536, (ThreadFunc) smb_Listener,
+ (void*)lana_list.lana[i], 0, &lpid, "smb_Listener");
+ osi_assert(phandle != NULL);
+ thrd_CloseHandle(phandle);
+ }
- phandle = CreateThread(NULL, 65536, (LPTHREAD_START_ROUTINE) smb_ClientWaiter,
- NULL, 0, &lpid);
+#ifndef DJGPP
+ phandle = thrd_Create(NULL, 65536, (ThreadFunc) smb_ClientWaiter,
+ NULL, 0, &lpid, "smb_ClientWaiter");
osi_assert(phandle != NULL);
- CloseHandle(phandle);
+ thrd_CloseHandle(phandle);
+#endif /* !DJGPP */
- phandle = CreateThread(NULL, 65536, (LPTHREAD_START_ROUTINE) smb_ServerWaiter,
- NULL, 0, &lpid);
+ phandle = thrd_Create(NULL, 65536, (ThreadFunc) smb_ServerWaiter,
+ NULL, 0, &lpid, "smb_ServerWaiter");
osi_assert(phandle != NULL);
- CloseHandle(phandle);
+ thrd_CloseHandle(phandle);
for (i=0; i<nThreads; i++) {
- phandle = CreateThread(NULL, 65536,
- (LPTHREAD_START_ROUTINE) smb_Server,
- (void *) i, 0, &lpid);
+ phandle = thrd_Create(NULL, 65536,
+ (ThreadFunc) smb_Server,
+ (void *) i, 0, &lpid, "smb_Server");
osi_assert(phandle != NULL);
- CloseHandle(phandle);
+ thrd_CloseHandle(phandle);
}
- phandle = CreateThread(NULL, 65536, (LPTHREAD_START_ROUTINE) smb_Daemon,
- NULL, 0, &lpid);
+ phandle = thrd_Create(NULL, 65536, (ThreadFunc) smb_Daemon,
+ NULL, 0, &lpid, "smb_Daemon");
osi_assert(phandle != NULL);
- CloseHandle(phandle);
+ thrd_CloseHandle(phandle);
- phandle = CreateThread(NULL, 65536,
- (LPTHREAD_START_ROUTINE) smb_WaitingLocksDaemon,
- NULL, 0, &lpid);
+ phandle = thrd_Create(NULL, 65536,
+ (ThreadFunc) smb_WaitingLocksDaemon,
+ NULL, 0, &lpid, "smb_WaitingLocksDaemon");
osi_assert(phandle != NULL);
- CloseHandle(phandle);
+ thrd_CloseHandle(phandle);
+
+#ifdef DJGPP
+ smb_ListShares();
+#endif
return;
}
+
+#ifdef DJGPP
+void smb_Shutdown(void)
+{
+ NCB *ncbp;
+ dos_ptr dos_ncb;
+ long code;
+ int i;
+
+ /*fprintf(stderr, "Entering smb_Shutdown\n");*/
+
+ /* setup the NCB system */
+ ncbp = GetNCB();
+ dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb;
+
+ /* Block new sessions by setting shutdown flag */
+ /*smbShutdownFlag = 1;*/
+
+ /* Hang up all sessions */
+ for (i = 1; i < numSessions; i++)
+ {
+ if (dead_sessions[i])
+ continue;
+
+ /*fprintf(stderr, "NCBHANGUP session %d LSN %d\n", i, LSNs[i]);*/
+ ncbp->ncb_command = NCBHANGUP;
+ ncbp->ncb_lana_num = lanas[i]; /*smb_LANadapter;*/
+ ncbp->ncb_lsn = LSNs[i];
+ code = Netbios(ncbp, dos_ncb);
+ /*fprintf(stderr, "returned from NCBHANGUP session %d LSN %d\n", i, LS
+ Ns[i]);*/
+ if (code == 0) code = ncbp->ncb_retcode;
+ if (code != 0) {
+ fprintf(stderr, "Session %d Netbios NCBHANGUP error code %d", i, code);
+ }
+ }
+
+#if 1
+ /* Delete Netbios name */
+ for (i = 0; i < lana_list.length; i++) {
+ if (lana_list.lana[i] == 255) continue;
+ ncbp->ncb_command = NCBDELNAME;
+ ncbp->ncb_lana_num = lana_list.lana[i];
+ memcpy(ncbp->ncb_name,smb_sharename,NCBNAMSZ);
+ code = Netbios(ncbp, dos_ncb);
+ if (code == 0) code = ncbp->ncb_retcode;
+ if (code != 0) {
+ fprintf(stderr, "Netbios NCBDELNAME lana %d error code %d",
+ ncbp->ncb_lana_num, code);
+ }
+ fflush(stderr);
+ }
+#endif
+}
+#endif /* DJGPP */
#ifndef __SMB_H_ENV__
#define __SMB_H_ENV__ 1
+#ifdef DJGPP
+#include "netbios95.h"
+#endif /* DJGPP */
+
/* basic core protocol SMB structure */
typedef struct smb {
unsigned char id[4];
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.
struct smb_fid *fidsp; /* the first child in the open file list */
struct smb_user *justLoggedOut; /* ready for profile upload? */
unsigned long logoffTime; /* tick count when logged off */
- struct cm_user *logonDLLUser; /* integrated logon user */
+ /*struct cm_user *logonDLLUser; /* integrated logon user */
unsigned char errorCount;
+ char rname[17];
+ int lana;
} smb_vc_t;
/* have we negotiated ... */
osi_mutex_t mx;
long userID; /* the session identifier */
struct smb_vc *vcp; /* back ptr to virtual circuit */
- struct cm_user *userp; /* CM user structure */
- char *name; /* user name */
+ struct smb_username *unp; /* user name struct */
} smb_user_t;
+typedef struct smb_username {
+ struct smb_username *nextp; /* next sibling */
+ long refCount; /* ref count */
+ long flags; /* flags; locked by mx */
+ osi_mutex_t mx;
+ struct cm_user *userp; /* CM user structure */
+ char *name; /* user name */
+ char *machine; /* machine name */
+} smb_username_t;
+
#define SMB_USERFLAG_DELETE 1 /* delete struct when ref count zero */
/* one per tree-connect */
/* flags */
long flags;
+
+ /* fid pointer */
+ struct smb_fid *fidp;
} smb_ioctl_t;
/* flags for smb_ioctl_t */
int curr_chunk; /* chunk being read */
int prev_chunk; /* previous chunk read */
int raw_writers; /* pending async raw writes */
- HANDLE raw_write_event; /* signal this when raw_writers zero */
+ EVENT_HANDLE raw_write_event; /* signal this when raw_writers zero */
} smb_fid_t;
#define SMB_FID_OPENREAD 1 /* open for reading */
osi_queue_t q;
char *dptr; /* ptr to attr, time, data, sizel, sizeh */
cm_fid_t fid;
+ cm_dirEntry_t *dep; /* temp */
} smb_dirListPatch_t;
/* waiting lock list elements */
* the response was already
* sent.
*/
+#define SMB_MAX_PATH 256 /* max path length */
/* prototypes */
extern void smb_Init(osi_log_t *logp, char *smbNamep, int useV3, int LANadapt,
- int nThreads, void *aMBfunc);
+ int nThreads
+#ifndef DJGPP
+ , void *aMBfunc
+#endif
+ );
extern void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, long unixTime);
extern void smb_UnixTimeFromDosUTime(long *unixTimep, long dosUTime);
-extern smb_vc_t *smb_FindVC(unsigned short lsn, int flags);
+extern smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana);\r
extern void smb_ReleaseVC(smb_vc_t *vcp);
extern int smb_SUser(cm_user_t *userp);
+#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 BOOL smb_IsLegalFilename(char *filename);
#include "smb3.h"
#include "smb_ioctl.h"
#include "smb_iocons.h"
+\r
+cm_user_t *smb_FindOrCreateUser(smb_vc_t *vcp, char *usern);\r
#endif /* whole file */
* directory or online at http://www.openafs.org/dl/license10.html
*/
+//#define NOSERVICE 1
+
#include <afs/param.h>
#include <afs/stds.h>
+#ifndef DJGPP
#include <windows.h>
+#endif /* !DJGPP */
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
cm_user_t *smb_GetTran2User(smb_vc_t *vcp, smb_tran2Packet_t *inp)
{
smb_user_t *uidp;
- cm_user_t *up;
+ cm_user_t *up = NULL;
uidp = smb_FindUID(vcp, inp->uid, 0);
if (!uidp) return NULL;
lock_ObtainMutex(&uidp->mx);
- up = uidp->userp;
- cm_HoldUser(up);
+ if (uidp->unp) {
+ up = uidp->unp->userp;
+ cm_HoldUser(up);
+ }
lock_ReleaseMutex(&uidp->mx);
smb_ReleaseUID(uidp);
long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
{
- char *tp;
- char *usern, *pwd, *pwdx;
- smb_user_t *uidp, *dead_uidp;
- unsigned short newUid;
- unsigned long caps;
- cm_user_t *userp;
- char *s1 = " ";
-
- /* Check for bad conns */
- if (vcp->flags & SMB_VCFLAG_REMOTECONN)
- return CM_ERROR_REMOTECONN;
-
- /* For NT LM 0.12 and up, get capabilities */
- if (vcp->flags & SMB_VCFLAG_USENT) {
- caps = smb_GetSMBParm(inp, 11);
- if (caps & 0x40)
- vcp->flags |= SMB_VCFLAG_STATUS32;
- /* for now, ignore other capability bits */
- }
-
- /* Parse the data */
- tp = smb_GetSMBData(inp, NULL);
- if (vcp->flags & SMB_VCFLAG_USENT)
- pwdx = smb_ParseString(tp, &tp);
- pwd = smb_ParseString(tp, &tp);
- usern = smb_ParseString(tp, &tp);
-
- /* Create a new UID and cm_user_t structure */
- userp = cm_NewUser();
- lock_ObtainMutex(&vcp->mx);
- newUid = vcp->uidCounter++;
- lock_ReleaseMutex(&vcp->mx);
-
- /* Create a new smb_user_t structure and connect them up */
- uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
- lock_ObtainMutex(&uidp->mx);
- uidp->userp = userp;
- uidp->name = strdup(usern);
- lock_ReleaseMutex(&uidp->mx);
- smb_ReleaseUID(uidp);
-
- if (dead_vcp) {
- dead_uidp = dead_vcp->usersp;
- while (dead_uidp) {
- if (dead_uidp->userp
- && strcmp(dead_uidp->name, usern) == 0)
- break;
- dead_uidp = dead_uidp->nextp;
+ char *tp;
+ char *usern, *pwd, *pwdx;
+ smb_user_t *uidp, *dead_uidp;
+ unsigned short newUid;
+ unsigned long caps;
+ cm_user_t *userp;
+ smb_username_t *unp;
+ char *s1 = " ";
+
+ /* Check for bad conns */
+ if (vcp->flags & SMB_VCFLAG_REMOTECONN)
+ return CM_ERROR_REMOTECONN;
+
+ /* For NT LM 0.12 and up, get capabilities */
+ if (vcp->flags & SMB_VCFLAG_USENT) {
+ caps = smb_GetSMBParm(inp, 11);
+ if (caps & 0x40)
+ vcp->flags |= SMB_VCFLAG_STATUS32;
+ /* for now, ignore other capability bits */
+ }
+
+ /* Parse the data */
+ tp = smb_GetSMBData(inp, NULL);
+ if (vcp->flags & SMB_VCFLAG_USENT)
+ pwdx = smb_ParseString(tp, &tp);
+ pwd = smb_ParseString(tp, &tp);
+ usern = smb_ParseString(tp, &tp);
+
+ if (strlen(usern)==0) {
+ /*return CM_ERROR_NOACCESS;*/
+ newUid = 0; /* always assign uid 0 for blank username */
+ uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
+#ifdef DEBUG_VERBOSE
+ {
+ HANDLE h; char *ptbuf[1],buf[132];
+ h = RegisterEventSource(NULL, "AFS Service - smb_ReceiveV3SessionSetupX");
+ sprintf(buf, "VCP[%x] lsn[%d] anonymous, uid[%d]",vcp,vcp->lsn,uidp->userID);
+ ptbuf[0] = buf;
+ ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
+ DeregisterEventSource(h);
}
- }
-
- /* transfer tokens from dead vcp */
- if (dead_vcp && dead_uidp) {
- cm_user_t *dead_userp;
- s1 = ", tokens from terminated session";
- dead_userp = dead_uidp->userp;
- cm_ResetACLCache(dead_userp);
- userp->cellInfop = dead_userp->cellInfop;
- dead_userp->cellInfop = NULL;
- dead_vcp = NULL;
- }
-
- /* transfer tokens from integrated logon */
- if (vcp->logonDLLUser) {
- s1 = ", tokens from integrated logon";
- cm_ResetACLCache(vcp->logonDLLUser);
- userp->cellInfop = vcp->logonDLLUser->cellInfop;
- vcp->logonDLLUser->cellInfop = NULL;
- vcp->logonDLLUser = NULL;
- }
-
- /* transfer tokens for logoff profile upload */
- if (vcp->justLoggedOut) {
- cm_user_t *logout_userp;
- if (GetTickCount() - vcp->logoffTime <
- 1000 * smb_LogoffTransferTimeout
- && strcmp(vcp->justLoggedOut->name, usern) == 0) {
- s1 = ", tokens from logoff";
- logout_userp = vcp->justLoggedOut->userp;
- cm_ResetACLCache(logout_userp);
- userp->cellInfop = logout_userp->cellInfop;
- logout_userp->cellInfop = NULL;
- }
- vcp->justLoggedOut = NULL;
- }
- else if (loggedOut) {
- cm_user_t *logout_userp;
- if (GetTickCount() - loggedOutTime <
- 1000 * smb_LogoffTransferTimeout
- && strcmp(loggedOutName, usern) == 0) {
- s1 = ", tokens from logoff";
- logout_userp = loggedOutUserp->userp;
- cm_ResetACLCache(logout_userp);
- userp->cellInfop = logout_userp->cellInfop;
- logout_userp->cellInfop = NULL;
+#endif
+ smb_ReleaseUID(uidp);
+ goto done;
+ }
+
+ /* On Windows 2000, this function appears to be called more often than
+ it is expected to be called. This resulted in multiple smb_user_t
+ records existing all for the same user session which results in all
+ of the users tokens disappearing.
+
+ To avoid this problem, we look for an existing smb_user_t record
+ based on the users name, and use that one if we find it.
+ */
+
+ uidp = smb_FindUserByNameThisSession(vcp, usern);
+ if (uidp) { /* already there, so don't create a new one */
+ unp = uidp->unp;
+ userp = unp->userp;
+ newUid = (unsigned short)uidp->userID; /* For some reason these are different types!*/
+#ifdef DEBUG_VERBOSE
+ {
+ HANDLE h; char *ptbuf[1],buf[132];
+ h = RegisterEventSource(NULL, "AFS Service - smb_ReceiveV3SessionSetupX");
+ sprintf(buf,"FindUserByName:VCP[%x],Lana[%d],lsn[%d],userid[%d],name[%s]",vcp,vcp->lana,vcp->lsn,newUid,usern);
+ ptbuf[0] = buf;
+ ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
+ DeregisterEventSource(h);
+ }
+#endif
+ smb_ReleaseUID(uidp);
+ }
+ else {
+ /* do a global search for the username/machine name pair */
+ unp = smb_FindUserByName(usern, vcp->rname, SMB_FLAG_CREATE);
+
+ /* Create a new UID and cm_user_t structure */
+ userp = unp->userp;
+ if (!userp)
+ userp = cm_NewUser();
+ lock_ObtainMutex(&vcp->mx);
+ newUid = vcp->uidCounter++;
+ lock_ReleaseMutex(&vcp->mx);
+
+ /* Create a new smb_user_t structure and connect them up */
+ lock_ObtainMutex(&unp->mx);
+ unp->userp = userp;
+ lock_ReleaseMutex(&unp->mx);
+
+ uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
+ lock_ObtainMutex(&uidp->mx);
+ uidp->unp = unp;
+#ifdef DEBUG_VERBOSE
+ {
+ HANDLE h; char *ptbuf[1],buf[132];
+ h = RegisterEventSource(NULL, "AFS Service - smb_ReceiveV3SessionSetupX");
+ sprintf(buf,"NewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d],name[%s]",vcp,vcp->lana,vcp->lsn,newUid,usern);
+ ptbuf[0] = buf;
+ ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
+ DeregisterEventSource(h);
}
- smb_ReleaseUID(loggedOutUserp);
- loggedOutUserp = NULL;
- free(loggedOutName);
- loggedOutName = NULL;
- loggedOut = 0;
- }
-
- /* Return UID to the client */
- ((smb_t *)outp)->uid = newUid;
- /* Also to the next chained message */
- ((smb_t *)inp)->uid = newUid;
-
- osi_Log3(afsd_logp, "SMB3 session setup name %s creating ID %d%s",
- osi_LogSaveString(afsd_logp, usern), newUid, osi_LogSaveString(afsd_logp, s1));
- smb_SetSMBParm(outp, 2, 0);
- smb_SetSMBDataLength(outp, 0);
- return 0;
+#endif
+ lock_ReleaseMutex(&uidp->mx);
+ smb_ReleaseUID(uidp);
+ }
+
+ done:
+ /* Return UID to the client */
+ ((smb_t *)outp)->uid = newUid;
+ /* Also to the next chained message */
+ ((smb_t *)inp)->uid = newUid;
+
+ osi_Log3(afsd_logp, "SMB3 session setup name %s creating ID %d%s",
+ osi_LogSaveString(afsd_logp, usern), newUid, osi_LogSaveString(afsd_logp, s1));
+ smb_SetSMBParm(outp, 2, 0);
+ smb_SetSMBDataLength(outp, 0);
+ return 0;
}
long smb_ReceiveV3UserLogoffX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
if (uidp) {
char *s1 = NULL, *s2 = NULL;
- /* Also, this is not logon session any more */
- if (uidp->userp == vcp->logonDLLUser) {
- s1 = ", was logon session";
- vcp->logonDLLUser = NULL;
- }
-
- /* But its tokens might be needed later */
- if (uidp->userp && !(uidp->userp->flags & CM_USERFLAG_WASLOGON)
- && smb_LogoffTokenTransfer) {
- s2 = ", pre-logout effect";
- vcp->justLoggedOut = uidp;
- vcp->logoffTime = GetTickCount();
- }
-
if (s2 == NULL) s2 = " ";
if (s1 == NULL) {s1 = s2; s2 = " ";}
osi_Log4(afsd_logp, "SMB3 user logoffX uid %d name %s%s%s",
uidp->userID,
- osi_LogSaveString(afsd_logp, uidp->name),
- s1, s2);
+ osi_LogSaveString(afsd_logp,
+ (uidp->unp) ? uidp->unp->name: " "), s1, s2);
lock_ObtainMutex(&uidp->mx);
uidp->flags |= SMB_USERFLAG_DELETE;
/* We sometimes see 0 word count. What to do? */
if (*inp->wctp == 0) {
+#ifndef DJGPP
HANDLE h;
char *ptbuf[1];
ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1003, NULL,
1, inp->ncb_length, ptbuf, inp);
DeregisterEventSource(h);
+#else /* DJGPP */
+ osi_Log0(afsd_logp, "TRANSACTION2 word count = 0");
+#endif /* !DJGPP */
smb_SetSMBDataLength(outp, 0);
smb_SendPacket(vcp, outp);
size_t shortNameLen;
};
-long cm_GetShortNameProc(cm_scache_t *scp, cm_dirEntry_t *dep, void *vrockp,
+int cm_GetShortNameProc(cm_scache_t *scp, cm_dirEntry_t *dep, void *vrockp,
osi_hyper_t *offp)
{
struct smb_ShortNameRock *rockp;
smb_FreeTran2Packet(outp);
return 0;
}
-
+
lock_ObtainMutex(&scp->mx);
code = cm_SyncOp(scp, NULL, userp, &req, 0,
CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
if (infoLevel == 0x108) {
code = cm_GetShortName((char *)(&p->parmsp[3]), userp, &req,
tidPathp, scp->fid.vnode, shortName,
- &len);
+ (size_t *) &len);
if (code) {
goto done;
}
char shortName[13]; /* 8.3 name if needed */
int NeedShortName;
char *shortNameEnd;
+ int fileType;
+ cm_fid_t fid;
cm_req_t req;
|| (NeedShortName
&& smb_V3MatchMask(shortName, maskp,
CM_FLAG_CASEFOLD)))) {
+
+ /* Eliminate entries that don't match requested
+ attributes */
+ if (!(dsp->attribute & 0x10)) /* no directories */
+ {
+ /* We have already done the cm_TryBulkStat above */
+ fid.cell = scp->fid.cell;
+ fid.volume = scp->fid.volume;
+ fid.vnode = ntohl(dep->fid.vnode);
+ fid.unique = ntohl(dep->fid.unique);
+ fileType = cm_FindFileType(&fid);
+ /*osi_Log2(afsd_logp, "smb_ReceiveTran2SearchDir: file %s "
+ "has filetype %d", dep->name,
+ fileType);*/
+ if (fileType == CM_SCACHETYPE_DIRECTORY)
+ goto nextEntry;
+ }
+
/* finally check if this name will fit */
/* standard dir entry stuff */
curPatchp->fid.volume = scp->fid.volume;
curPatchp->fid.vnode = ntohl(dep->fid.vnode);
curPatchp->fid.unique = ntohl(dep->fid.unique);
+
+ /* temp */
+ curPatchp->dep = dep;
}
if (searchFlags & 4)
/* 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);
{
lock_InitializeMutex(&smb_Dir_Watch_Lock, "Directory Watch List Lock");
}
+
+cm_user_t *smb_FindCMUserByName(/*smb_vc_t *vcp,*/ char *usern, char *machine)
+{
+ cm_user_t *userp;
+ /*int newUid;*/
+ smb_user_t *uidp;
+ smb_username_t *unp;
+
+ unp = smb_FindUserByName(usern, machine, SMB_FLAG_CREATE);
+ if (!unp->userp) {
+ lock_ObtainMutex(&unp->mx);
+ unp->userp = cm_NewUser();
+ lock_ReleaseMutex(&unp->mx);
+#ifdef DEBUG_VERBOSE
+ { //jimpeter
+ HANDLE h; char *ptbuf[1],buf[132];
+ h = RegisterEventSource(NULL, "AFS Service - smb_FindCMUserByName");
+ sprintf(buf,"New User name[%s] machine[%s]",usern,machine);
+ ptbuf[0] = buf;
+ ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
+ DeregisterEventSource(h);
+ }
+#endif
+ }
+#ifdef DEBUG_VERBOSE
+ else { //jimpeter
+ HANDLE h; char *ptbuf[1],buf[132];
+ h = RegisterEventSource(NULL, "AFS Service - smb_FindCMUserByName");
+ sprintf(buf,"Found-name[%s] machine[%s]",usern,machine);
+ ptbuf[0] = buf;
+ ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
+ DeregisterEventSource(h);
+ }
+#endif
+ return unp->userp;
+}
+
extern void smb3_Init();
+#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__ */
#define VIOC_LISTSYMLINK 0x24
#define VIOC_DELSYMLINK 0x25
#define VIOC_MAKESUBMOUNT 0x26
+#define VIOC_SHUTDOWN 0x27
#define VIOC_GETRXKCRYPT 0x27
#define VIOC_SETRXKCRYPT 0x28
#include <afs/param.h>
#include <afs/stds.h>
+#ifndef DJGPP
#include <windows.h>
+#endif /* !DJGPP */
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
smb_ioctlProc_t *smb_ioctlProcsp[SMB_IOCTL_MAXPROCS];
+/*extern unsigned char smb_LANadapter;*/
+extern LANA_ENUM lana_list;
+
void smb_InitIoctl(void)
{
smb_ioctlProcsp[VIOCGETAL] = cm_IoctlGetACL;
smb_ioctlProcsp[VIOC_MAKESUBMOUNT] = cm_IoctlMakeSubmount;
smb_ioctlProcsp[VIOC_GETRXKCRYPT] = cm_IoctlGetRxkcrypt;
smb_ioctlProcsp[VIOC_SETRXKCRYPT] = cm_IoctlSetRxkcrypt;
+#ifdef DJGPP
+ smb_ioctlProcsp[VIOC_SHUTDOWN] = cm_IoctlShutdown;
+#endif
}
/* called to make a fid structure into an IOCTL fid structure */
iop = malloc(sizeof(*iop));
memset(iop, 0, sizeof(*iop));
fidp->ioctlp = iop;
+ iop->fidp = fidp;
}
if (prefix) {
copyPrefix = cm_GetSpace();
return code;
}
- if (iop->flags & SMB_IOCTLFLAG_LOGON) {
- vcp->logonDLLUser = userp;
- userp->flags |= CM_USERFLAG_WASLOGON;
- }
-
leftToCopy = (iop->outDatap - iop->outAllocp) - iop->outCopied;
if (count > leftToCopy) count = leftToCopy;
long count;
long code;
char *op;
- long inDataBlockCount;
+ int inDataBlockCount;
code = 0;
count = smb_GetSMBParm(inp, 1);
smb_user_t *uidp;
uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0);
- osi_Log3(afsd_logp, "Ioctl uid %d user %x name %s",
- uidp->userID, userp,
- osi_LogSaveString(afsd_logp, uidp->name));
+ if (uidp && uidp->unp)
+ osi_Log3(afsd_logp, "Ioctl uid %d user %x name %s",
+ uidp->userID, userp,
+ osi_LogSaveString(afsd_logp, uidp->unp->name));
+ else
+ osi_Log2(afsd_logp, "Ioctl uid %d user %x no name",
+ uidp->userID, userp);
smb_ReleaseUID(uidp);
}
return code;
}
- if (iop->flags & SMB_IOCTLFLAG_LOGON) {
- vcp->logonDLLUser = userp;
- userp->flags |= CM_USERFLAG_WASLOGON;
- }
-
leftToCopy = (iop->outDatap - iop->outAllocp) - iop->outCopied;
if (count > leftToCopy) count = leftToCopy;
/* called from Read Raw to handle IOCTL descriptor reads */
long smb_IoctlReadRaw(smb_fid_t *fidp, smb_vc_t *vcp, smb_packet_t *inp,
- smb_packet_t *outp)
+ smb_packet_t *outp
+#ifdef DJGPP
+, dos_ptr rawBuf
+#endif /* DJGPP */
+)
{
smb_ioctl_t *iop;
long leftToCopy;
NCB *ncbp;
long code;
cm_user_t *userp;
+#ifdef DJGPP
+ dos_ptr dos_ncb;
+
+ if (rawBuf == 0)
+ {
+ osi_Log0(afsd_logp, "Failed to get raw buf for smb_IoctlReadRaw");
+ return -1;
+ }
+#endif /* DJGPP */
iop = fidp->ioctlp;
smb_user_t *uidp;
uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0);
- osi_Log3(afsd_logp, "Ioctl uid %d user %x name %s",
- uidp->userID, userp,
- osi_LogSaveString(afsd_logp, uidp->name));
+ if (uidp && uidp->unp)
+ osi_Log3(afsd_logp, "Ioctl uid %d user %x name %s",
+ uidp->userID, userp,
+ osi_LogSaveString(afsd_logp, uidp->unp->name));
+ else
+ osi_Log2(afsd_logp, "Ioctl uid %d user %x no name",
+ uidp->userID, userp);
smb_ReleaseUID(uidp);
}
return code;
}
- if (iop->flags & SMB_IOCTLFLAG_LOGON) {
- vcp->logonDLLUser = userp;
- userp->flags |= CM_USERFLAG_WASLOGON;
- }
-
leftToCopy = (iop->outDatap - iop->outAllocp) - iop->outCopied;
ncbp = outp->ncbp;
ncbp->ncb_length = (unsigned short) leftToCopy;
ncbp->ncb_lsn = (unsigned char) vcp->lsn;
ncbp->ncb_command = NCBSEND;
- ncbp->ncb_buffer = iop->outCopied + iop->outAllocp;
+ /*ncbp->ncb_lana_num = smb_LANadapter;*/
+ ncbp->ncb_lana_num = vcp->lana;
+#ifndef DJGPP
+ ncbp->ncb_buffer = iop->outCopied + iop->outAllocp;
code = Netbios(ncbp);
+#else /* DJGPP */
+ dosmemput(iop->outCopied + iop->outAllocp, ncbp->ncb_length, rawBuf);
+ ncbp->ncb_buffer = rawBuf;
+ dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb;
+ code = Netbios(ncbp, dos_ncb);
+#endif /* !DJGPP */
+
if (code != 0)
osi_Log1(afsd_logp, "ReadRaw send failure code %d", code);
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__ */
install: install_headers $(LIBFILE)
+install9x: install
+
clean::
+ $(DEL) $(LIBFILE)
\ No newline at end of file
# include the primary makefile
!INCLUDE ..\..\config\NTMakefile.$(SYS_NAME)
-!INCLUDE ..\..\config\NTMakefile.version
+!include ..\..\config\NTMakefile.version
############################################################################
#
install : $(COPYSOURCES) $(COPYHEADERS) $(EXEFILE) lang
-lang ::
- $(CD) lang
- for /f %l in ('dir /B ??_??') do @$(NTLANG) %l $(MAKECMD) /nologo /f NTMakefile install
- $(CD) ..
+install9x: install
+
+lang:: en_US ja_JP ko_KR zh_TW zh_CN pt_BR es_ES de_DE
+
############################################################################
#
# Dependencies
#
+en_US:
+ $(CD) lang
+ $(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+ja_JP:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+ko_KR:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+zh_CN:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+zh_TW:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+pt_BR:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+es_ES:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+de_DE:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
afs_config_stub.res : afs_config_stub.rc AFS_component_version_number.h
+clean::
+ $(CD) lang
+ if exist $(NTLANG) $(NTLANG) en_US $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) ja_JP $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) ko_KR $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) zh_CN $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) zh_TW $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) pt_BR $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) es_ES $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) de_DE $(MAKECMD) /nologo /f NTMakefile clean
+ $(CD) ..
install : $(DLLFILE)
clean ::
- @if exist *.res del *.res
- @if exist RC*. del RC*.
- @if exist RD*. del RD*.
+ $(DEL) *.res RC* RD* $(DLLFILE) $(DEL) $(DLLFILE)
############################################################################
#
# License. For details, see the LICENSE file in the top-level source
# directory or online at http://www.openafs.org/dl/license10.html
-!INCLUDE ..\..\config\NTMakefile.$(SYS_NAME)
-!INCLUDE ..\..\config\NTMakefile.version
+!INCLUDE ..\..\config\NTMakefile.$(SYS_NAME)
+!include ..\..\config\NTMakefile.version
############################################################################
install: $(DLLFILE) lang
+install9x: install
+
############################################################################
# Language target
-lang::
- $(CD) lang
- for /f %l in ('dir /B ??_??') do @$(NTLANG) %l $(MAKECMD) /nologo /f NTMakefile install
- $(CD) ..
-
+lang:: en_US ja_JP ko_KR zh_TW zh_CN pt_BR es_ES de_DE
############################################################################
# Local clean target; augments predefined clean target
clean::
+ $(CD) lang
+ if exist $(NTLANG) $(NTLANG) en_US $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) ja_JP $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) ko_KR $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) zh_CN $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) zh_TW $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) pt_BR $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) es_ES $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) de_DE $(MAKECMD) /nologo /f NTMakefile clean
+ $(CD) ..
############################################################################
# Dependencies
afs_cpa_stub.res : afs_cpa_stub.rc AFS_component_version_number.h
+en_US:
+ $(CD) lang
+ $(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+ja_JP:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+ko_KR:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+zh_CN:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+zh_TW:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+pt_BR:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+es_ES:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+de_DE:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
# include the primary makefile
!INCLUDE ..\..\..\config\NTMakefile.$(SYS_NAME)
-!INCLUDE ..\..\..\config\NTMakefile.version
+!include ..\..\..\config\NTMakefile.version
############################################################################
#
install : $(DLLFILE)
clean ::
- @if exist *.res del *.res
- @if exist RC*. del RC*.
- @if exist RD*. del RD*.
+ $(DEL) *.res RC* RD* $(DLLFILE) $(DEL) $(DLLFILE)
############################################################################
#
install : $(DLLFILE)
clean ::
- @if exist *.res del *.res
- @if exist RC*. del RC*.
- @if exist RD*. del RD*.
+ $(DEL) *.res RC* RD* $(DLLFILE) $(DEL) $(DLLFILE)
############################################################################
#
AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -I..\afsd /D"_WINDOWS" /D"_WINDLL" /D"_AFXDLL" /D"_USRDLL"
!INCLUDE ..\..\config\NTMakefile.$(SYS_NAME)
-!INCLUDE ..\..\config\NTMakefile.version
+!include ..\..\config\NTMakefile.version
############################################################################
# Install target; primary makefile target
install: $(DLLFILE) lang
+install9x: install
############################################################################
# Language target
-lang ::
+lang:: en_US ja_JP ko_KR zh_TW zh_CN pt_BR es_ES de_DE
+
+en_US:
+ $(CD) lang
+ $(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+ja_JP:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+ko_KR:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+zh_CN:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+zh_TW:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+pt_BR:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+es_ES:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+de_DE:
$(CD) lang
- for /f %l in ('dir /B ??_??') do @$(NTLANG) %l $(MAKECMD) /nologo /f NTMakefile install
- $(CD) ..
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
############################################################################
# Local clean target; augments predefined clean target
clean::
+ $(CD) lang
+ if exist $(NTLANG) $(NTLANG) en_US $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) ja_JP $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) ko_KR $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) zh_CN $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) zh_TW $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) pt_BR $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) es_ES $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) de_DE $(MAKECMD) /nologo /f NTMakefile clean
+ $(CD) ..
install : $(DLLFILE)
clean ::
- @if exist *.res del *.res
- @if exist RC*. del RC*.
- @if exist RD*. del RD*.
+ $(DEL) *.res RC* RD* $(DLLFILE) $(DEL) $(DLLFILE)
############################################################################
#
$(INCFILEDIR)\osidb.h \
$(INCFILEDIR)\osilog.h \
$(INCFILEDIR)\osisleep.h \
- $(INCFILEDIR)\perf.h
+ $(INCFILEDIR)\perf.h \
+ $(INCFILEDIR)\osithrdnt.h
$(INCFILEDIR)\dbrpc.h: dbrpc.h
install: install_headers $(DLLFILE)
+install9x: install
+
############################################################################
# Local clean target; augments predefined clean target
clean::
- $(DEL) dbrpc_s.c dbrpc_c.c dbrpc.h
+ $(DEL) dbrpc_s.c dbrpc_c.c dbrpc.h $(DLLFILE) $(INCFILES)
#ifndef _OSI_H_ENV_
#define _OSI_H_ENV_ 1
-#include <rpc.h>
+#include <afs/param.h>
+
/* misc definitions */
+
+/* large int */
+#ifndef DJGPP
+#include <rpc.h>
+#include <largeint.h>
+#include "osithrdnt.h"
+#else /* DJGPP */
+#include "largeint95.h"
+#endif /* !DJGPP */
+
typedef LARGE_INTEGER osi_hyper_t;
+#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"
-/* large int */
-#include <largeint.h>
-
#endif /*_OSI_H_ENV_ */
#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 "dbrpc.h"
#include <assert.h>
-static CRITICAL_SECTION osi_fdCS;
+static Crit_Sec osi_fdCS;
osi_fd_t *osi_allFDs;
osi_fdType_t *osi_allFDTypes;
long osi_nextFD = 0;
osi_fdOps_t osi_TypeFDOps = {
osi_FDTypeCreate,
+#ifndef DJGPP
osi_FDTypeGetInfo,
+#endif
osi_FDTypeClose
};
osi_fdTypeFormat_t *nffp;
/* check for dup name */
- EnterCriticalSection(&osi_fdCS);
+ thrd_EnterCrit(&osi_fdCS);
ftp = osi_FindFDType(namep);
if (!ftp) return -1;
free(ftp);
/* cleanup and go */
- LeaveCriticalSection(&osi_fdCS);
+ thrd_LeaveCrit(&osi_fdCS);
return 0;
}
osi_fdType_t *ftp;
/* check for dup name */
- EnterCriticalSection(&osi_fdCS);
+ thrd_EnterCrit(&osi_fdCS);
osi_assertx(osi_FindFDType(namep) == NULL, "registering duplicate iteration type");
ftp = (osi_fdType_t *) malloc(sizeof(*ftp));
ftp->formatListp = NULL;
osi_QAdd((osi_queue_t **) &osi_allFDTypes, &ftp->q);
- LeaveCriticalSection(&osi_fdCS);
+ thrd_LeaveCrit(&osi_fdCS);
return ftp;
}
formatp->index = index;
/* thread on the list when done */
- EnterCriticalSection(&osi_fdCS);
+ thrd_EnterCrit(&osi_fdCS);
formatp->nextp = typep->formatListp;
typep->formatListp = formatp;
- LeaveCriticalSection(&osi_fdCS);
+ thrd_LeaveCrit(&osi_fdCS);
/* all done */
return 0;
osi_allFDs = NULL;
osi_allFDTypes = NULL;
- InitializeCriticalSection(&osi_fdCS);
+ thrd_InitCrit(&osi_fdCS);
/* now, initialize the types system by adding a type
* iteration operator
/* initialize for failure */
fdp = NULL;
- EnterCriticalSection(&osi_fdCS);
+ thrd_EnterCrit(&osi_fdCS);
fdTypep = osi_FindFDType(namep);
if (fdTypep) {
code = (fdTypep->opsp->Create)(fdTypep, &fdp);
}
else fdp = NULL;
}
- LeaveCriticalSection(&osi_fdCS);
+ thrd_LeaveCrit(&osi_fdCS);
return fdp;
}
{
osi_fd_t *fdp;
- EnterCriticalSection(&osi_fdCS);
+ thrd_EnterCrit(&osi_fdCS);
for(fdp = osi_allFDs; fdp; fdp = (osi_fd_t *) osi_QNext(&fdp->q)) {
if (fdp->fd == fd) break;
}
- LeaveCriticalSection(&osi_fdCS);
+ thrd_LeaveCrit(&osi_fdCS);
return fdp;
}
{
long code;
- EnterCriticalSection(&osi_fdCS);
+ thrd_EnterCrit(&osi_fdCS);
osi_QRemove((osi_queue_t **) &osi_allFDs, &fdp->q);
- LeaveCriticalSection(&osi_fdCS);
+ thrd_LeaveCrit(&osi_fdCS);
/* this call frees the FD's storage, so make sure everything is unthreaded
* before here.
}
+#ifndef DJGPP
long osi_FDTypeGetInfo(osi_fd_t *ifdp, osi_remGetInfoParms_t *outp)
{
osi_typeFD_t *fdp;
outp->icount = 0;
outp->scount = 1;
strcpy(outp->sdata[0], typep->namep);
- EnterCriticalSection(&osi_fdCS);
+ thrd_EnterCrit(&osi_fdCS);
fdp->curp = (osi_fdType_t *) osi_QNext(&typep->q);
- LeaveCriticalSection(&osi_fdCS);
+ thrd_LeaveCrit(&osi_fdCS);
return 0;
}
else {
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;
+struct osi_fdType;
+
/* operations on a file descriptor */
typedef struct osi_fdOps {
/* create an object, passed in the type info and returns
*/
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>
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));
logp->stringsp = malloc((size/10) * OSI_LOG_STRINGSIZE);
/* and sync */
- InitializeCriticalSection(&logp->cs);
+ thrd_InitCrit(&logp->cs);
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;
}
void osi_LogReset(osi_log_t *logp)
{
if (logp) {
- EnterCriticalSection(&logp->cs);
+ thrd_EnterCrit(&logp->cs);
logp->nused = 0;
- LeaveCriticalSection(&logp->cs);
+ thrd_LeaveCrit(&logp->cs);
}
}
free(logp->namep);
free(logp->datap);
- DeleteCriticalSection(&logp->cs);
+ thrd_DeleteCrit(&logp->cs);
free(logp);
}
*/
if (!logp->enabled) return;
- EnterCriticalSection(&logp->cs);
+ thrd_EnterCrit(&logp->cs);
if (logp->nused < logp->alloc) logp->nused++;
else {
logp->first++;
if (ix >= logp->alloc) ix -= logp->alloc;
lep = logp->datap + ix; /* ptr arith */
- lep->tid = GetCurrentThreadId();
+ 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->parms[1] = p1;
lep->parms[2] = p2;
lep->parms[3] = p3;
- LeaveCriticalSection(&logp->cs);
+ thrd_LeaveCrit(&logp->cs);
}
-void osi_LogPrint(osi_log_t *logp, HANDLE handle)
+void osi_LogPrint(osi_log_t *logp, FILE_HANDLE handle)
{
char wholemsg[1000], msg[1000];
int i, ix, ioCount;
if (!logp->enabled) return;
- EnterCriticalSection(&logp->cs);
+ thrd_EnterCrit(&logp->cs);
for (ix = logp->first, i = 0;
i < logp->nused;
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;
}
- LeaveCriticalSection(&logp->cs);
+ thrd_LeaveCrit(&logp->cs);
}
char *osi_LogSaveString(osi_log_t *logp, char *s)
lfdp = malloc(sizeof(*lfdp));
logp = lfdp->logp = typep->rockp; /* the log we were created for */
- EnterCriticalSection(&logp->cs);
+ thrd_EnterCrit(&logp->cs);
lfdp->nused = logp->nused;
lfdp->first = logp->first;
lfdp->current = 0;
- LeaveCriticalSection(&logp->cs);
+ thrd_LeaveCrit(&logp->cs);
*outpp = &lfdp->fd;
return 0;
}
+#ifndef DJGPP
long osi_LogFDGetInfo(osi_fd_t *ifd, osi_remGetInfoParms_t *outp)
{
osi_logFD_t *lfdp;
if (lfdp->current >= lfdp->nused) return OSI_DBRPC_EOF;
/* grab lock */
- EnterCriticalSection(&logp->cs);
+ thrd_EnterCrit(&logp->cs);
/* compute which one we want */
ix = lfdp->first + lfdp->current;
outp->scount = 2;
outp->icount = 1;
- LeaveCriticalSection(&logp->cs);
+ thrd_LeaveCrit(&logp->cs);
return 0;
}
+#endif /* !DJGPP */
long osi_LogFDClose(osi_fd_t *ifdp)
{
#ifndef _OSI_LOG_H__
#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"
long alloc; /* allocated size */
long nused; /* number currently in use */
long first; /* index of first entry */
- CRITICAL_SECTION cs; /* use this, rather than a higher-level
+ Crit_Sec cs; /* use this, rather than a higher-level
* lock, so we can log stuff from
* osi lock pkg */
osi_logEntry_t *datap; /* data for the log */
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 *);
extern void osi_LogPanic(char *filep, long line);
-extern void osi_LogPrint(osi_log_t *logp, HANDLE handle);
+extern void osi_LogPrint(osi_log_t *logp, FILE_HANDLE handle);
extern char *osi_LogSaveString(osi_log_t *logp, char *s);
#include <afs/param.h>
#include <afs/stds.h>
+#ifndef DJGPP
#include <windows.h>
+#endif /* !DJGPP */
#include "osi.h"
#include <stdlib.h>
/* critical section protecting allocation of osi_queueData_t elements */
-CRITICAL_SECTION osi_qdcrit;
+Crit_Sec osi_qdcrit;
/* free list of queue elements */
osi_queueData_t *osi_QDFreeListp = NULL;
if (initd) return;
initd = 1;
- InitializeCriticalSection(&osi_qdcrit);
+ thrd_InitCrit(&osi_qdcrit);
}
osi_queueData_t *osi_QDAlloc(void)
osi_queueData_t *tp;
int i;
- EnterCriticalSection(&osi_qdcrit);
+ thrd_EnterCrit(&osi_qdcrit);
if (tp = osi_QDFreeListp) {
osi_QDFreeListp = (osi_queueData_t *) tp->q.nextp;
}
*/
tp->datap = NULL;
}
- LeaveCriticalSection(&osi_qdcrit);
+ thrd_LeaveCrit(&osi_qdcrit);
osi_assertx(tp->datap == NULL, "queue freelist screwup");
void osi_QDFree(osi_queueData_t *qp)
{
- EnterCriticalSection(&osi_qdcrit);
+ thrd_EnterCrit(&osi_qdcrit);
qp->q.nextp = (osi_queue_t *) osi_QDFreeListp;
qp->datap = NULL;
osi_QDFreeListp = qp;
- LeaveCriticalSection(&osi_qdcrit);
+ thrd_LeaveCrit(&osi_qdcrit);
}
#ifndef _OSISLEEP_H_ENV_
#define _OSISLEEP_H_ENV_ 1
+/*#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 */
osi_queue_t q;
long value; /* sleep value when in a sleep queue, patch addr for turnstiles */
unsigned long tid; /* thread ID of sleeper */
- HANDLE sema; /* semaphore for this entry */
+ EVENT_HANDLE sema; /* semaphore for this entry */
unsigned short states; /* states bits */
unsigned short idx; /* sleep hash table we're in, if in hash */
unsigned short waitFor; /* what are we waiting for; used for bulk wakeups */
/* 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;
* holding this lock, so that locks don't get released while we're copying
* out this info.
*/
-extern CRITICAL_SECTION osi_sleepCookieCS;
+extern Crit_Sec osi_sleepCookieCS;
/* spin lock version of atomic sleep, used internally only */
-extern void osi_SleepSpin(long value, CRITICAL_SECTION *counterp);
+extern void osi_SleepSpin(long value, Crit_Sec *counterp);
/* spin lock version of wakeup, used internally only */
extern void osi_WakeupSpin(long value);
*/
extern void osi_EndOnce(osi_once_t *);
+
+#ifndef DJGPP
/* exported function to wakeup those sleeping on a value */
extern void osi_Wakeup (long);
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 */
unsigned long osi_Time(void);
extern void osi_TWait(osi_turnstile_t *turnp, int waitFor, void *patchp,
- CRITICAL_SECTION *releasep);
+ Crit_Sec *releasep);
extern void osi_TSignal(osi_turnstile_t *turnp);
extern void osi_TBroadcast(osi_turnstile_t *turnp);
-extern void osi_TSignalForMLs(osi_turnstile_t *turnp, int stillHaveReaders, CRITICAL_SECTION *csp);
+extern void osi_TSignalForMLs(osi_turnstile_t *turnp, int stillHaveReaders, Crit_Sec *csp);
#define osi_TInit(t) ((t)->firstp = (t)->lastp = 0)
$(LIBARCH)
############################################################################
+
install: $(LIBFILE) lang
-lang ::
+install9x: install
+
+lang:: en_US ja_JP ko_KR zh_TW zh_CN pt_BR es_ES de_DE
+
+en_US:
+ $(CD) lang
+ $(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+ja_JP:
$(CD) lang
- for /f %l in ('dir /B ??_??') do @$(NTLANG) %l $(MAKECMD) /nologo /f NTMakefile install
- $(CD) ..
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+ko_KR:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+zh_CN:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+zh_TW:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+pt_BR:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+es_ES:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
+
+de_DE:
+ $(CD) lang
+ @$(NTLANG) $@ $(MAKECMD) /nologo /f NTMakefile install
+ $(CD) ..
clean::
+ $(DEL) $(LIBFILE)
+ $(CD) lang
+ if exist $(NTLANG) $(NTLANG) en_US $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) ja_JP $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) ko_KR $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) zh_CN $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) zh_TW $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) pt_BR $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) es_ES $(MAKECMD) /nologo /f NTMakefile clean
+ if exist $(NTLANG) $(NTLANG) de_DE $(MAKECMD) /nologo /f NTMakefile clean
+ $(CD) ..
+
############################################################################
install: $(INCFILES) $(DLLFILE)
+install9x: install
+
clean::
+ $(DEL) $(INCFILES) $(DLLFILE)
\ No newline at end of file
if not exist "Registry Entries" mkdir "Registry Entries"
if not exist "Script Files" mkdir "Script Files"
if not exist "Setup Files" mkdir "Setup Files"
-
-if not exist "Setup Files\Uncompressed Files" mkdir "Setup Files\Uncompressed Files"
-if not exist "Setup Files\Uncompressed Files\Language Independent" mkdir "Setup Files\Uncompressed Files\Language Independent"
-if not exist "Setup Files\Uncompressed Files\Language Independent\OS Independent" mkdir "Setup Files\Uncompressed Files\Language Independent\OS Independent"
-if not exist "Setup Files\Compressed Files" mkdir "Setup Files\Compressed Files"
-if not exist "Setup Files\Compressed Files\Language Independent" mkdir "Setup Files\Compressed Files\Language Independent"
-if not exist "Setup Files\Compressed Files\Language Independent\OS Independent" mkdir "Setup Files\Compressed Files\Language Independent\OS Independent"
-
+\r
+set sub1=Uncompressed Files\r
+call :gencomp\r
+set sub1=Compressed Files\r
+call :gencomp\r
+goto shell\r
+\r
+:gencomp\r
+if not exist "Setup Files\%sub1%" mkdir "Setup Files\%sub1%"\r
+set sub2=Language Independent\r
+call :gencomp2\r
+set sub2=0009-English\r
+call :gencomp2\r
+set sub2=0007-German\r
+call :gencomp2\r
+set sub2=0011-Japanese\r
+call :gencomp2\r
+set sub2=0012-Korean\r
+call :gencomp2\r
+set sub2=0416-Portuguese (Brazilian)\r
+call :gencomp2\r
+set sub2=0404-Chinese (Taiwan)\r
+call :gencomp2\r
+set sub2=000a-Spanish\r
+call :gencomp2\r
+set sub2=0804-Chinese (PRC)\r
+call :gencomp2\r
+goto :eof\r
+\r
+:gencomp2\r
+rem echo ]%sub1%] ]%sub2%]\r
+if not exist "Setup Files\%sub1%\%sub2%" mkdir "Setup Files\%sub1%\%sub2%"
+if not exist "Setup Files\%sub1%\%sub2%\OS Independent" mkdir "Setup Files\%sub1%\%sub2%\OS Independent"
+if not exist "Setup Files\%sub1%\%sub2%\Intel 32" mkdir "Setup Files\%sub1%\%sub2%\Intel 32"
+goto :eof\r
+\r
+:shell\r
if not exist "Shell Objects" mkdir "Shell Objects"
if not exist "String Tables" mkdir "String Tables"
if not exist "String Tables\0009-English" mkdir "String Tables\0009-English"
if not exist "String Tables\000a-Spanish" mkdir "String Tables\000a-Spanish"
if not exist "Text Substitutions" mkdir "Text Substitutions"
-
+:eof
\ No newline at end of file
---FileGroup---=
HKLM0=Software\TransarcCorporation\AFS Client\CurrentVersion
HKLM1=Software\TransarcCorporation\AFS Client
-HKLM2=Software\TransarcCorporation\AFS Client\3.6
+HKLM2=Software\TransarcCorporation\AFS Client\1.0 4.01
HKLM3=SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon
HKCR0=CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}
HKLM4=SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters
HKLM5=SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider
HKCR2=*\shellex\ContextMenuHandlers\AFS Client Shell Extension
HKCR3=FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension
+HKLM6=SYSTEM\CurrentControlSet\Services\NetBT\Parameters\r
[Client:HKCR:*\shellex\ContextMenuHandlers\AFS Client Shell Extension]
---Comment---=
HKLM0=Software\TransarcCorporation\AFS Server\CurrentVersion
HKLM1=System\CurrentControlSet\Services\EventLog\Application\AFS Service
HKLM2=Software\TransarcCorporation\AFS Server
-HKLM3=Software\TransarcCorporation\AFS Server\3.6
+HKLM3=Software\TransarcCorporation\AFS Server\1.0 4.01
[WinNT_Client_NoUninstall:HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\File Manager\AddOns]
---Comment---=
---FileGroup---=
HKLM0=Software\TransarcCorporation\AFS Control Center\CurrentVersion
HKLM1=Software\TransarcCorporation\AFS Control Center
-HKLM2=Software\TransarcCorporation\AFS Control Center\3.6
+HKLM2=Software\TransarcCorporation\AFS Control Center\1.0 4.01
-[Client:HKLM:Software\TransarcCorporation\AFS Client\3.6]
-PatchLevel=N,0
-BetaLevel=N,0
+[Client:HKLM:Software\TransarcCorporation\AFS Client\1.0 4.01]
+PatchLevel=N,401
+BetaLevel=N,1
Revision=N,0
---Comment---=
(Default)=S,
-MajorVersion=N,3
+MajorVersion=N,1
Title=S,<CLIENT_TITLE>
InstallDateString=S,<INSTALL_DATE>
PathName=S,<TARGETDIR>\Client
Software Type=S,File System
-MinorVersion=N,6
+MinorVersion=N,0
ReleaseType=S,<RELEASE_TYPE>
-VersionString=S,3.6
+VersionString=S,1.0 4.01
Description=S,<CLIENT_DESC>
[Client_NoUninstall]
(Default)=S,
Gateway=S,
-[Control_Center:HKLM:Software\TransarcCorporation\AFS Control Center\3.6]
-PatchLevel=N,0
-BetaLevel=N,0
+[Control_Center:HKLM:Software\TransarcCorporation\AFS Control Center\1.0 4.01]
+PatchLevel=N,401
+BetaLevel=N,1
Revision=N,0
---Comment---=
(Default)=S,
-MajorVersion=N,3
+MajorVersion=N,1
InstallDateString=S,<INSTALL_DATE>
PathName=S,<TARGETDIR>\Control Center
Software Type=S,File System
-MinorVersion=N,6
+MinorVersion=N,0
ReleaseType=S,<RELEASE_TYPE>
-VersionString=S,3.6
+VersionString=S,1.0 4.01
Description=S,AFS Control Center for Windows NT
[Client_NoUninstall:HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved]
(Default)=S,
[Control_Center:HKLM:Software\TransarcCorporation\AFS Control Center\CurrentVersion]
-PatchLevel=N,0
-BetaLevel=N,0
+PatchLevel=N,401
+BetaLevel=N,1
Revision=N,0
---Comment---=
(Default)=S,
-MajorVersion=N,3
+MajorVersion=N,1
InstallDateString=S,<INSTALL_DATE>
PathName=S,<TARGETDIR>\Control Center
Software Type=S,File System
-MinorVersion=N,6
+MinorVersion=N,0
ReleaseType=S,<RELEASE_TYPE>
-VersionString=S,3.6
+VersionString=S,1.0 4.01
Description=S,AFS Control Center for Windows NT
[Light_Client]
---FileGroup---=
HKLM0=Software\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion
HKLM1=Software\TransarcCorporation\AFS Supplemental Documentation
-HKLM2=Software\TransarcCorporation\AFS Supplemental Documentation\3.6
+HKLM2=Software\TransarcCorporation\AFS Supplemental Documentation\1.0 4.01
[Data]
Set0=Server
Set7=Docs
[Client:HKLM:Software\TransarcCorporation\AFS Client\CurrentVersion]
-PatchLevel=N,0
-BetaLevel=N,0
+PatchLevel=N,401
+BetaLevel=N,1
Revision=N,0
---Comment---=
(Default)=S,
-MajorVersion=N,3
+MajorVersion=N,1
Title=S,<CLIENT_TITLE>
InstallDateString=S,<INSTALL_DATE>
PathName=S,<TARGETDIR>\Client
Software Type=S,File System
-MinorVersion=N,6
+MinorVersion=N,0
ReleaseType=S,<RELEASE_TYPE>
-VersionString=S,3.6
+VersionString=S,1.0 4.01
Description=S,<CLIENT_DESC>
[Full_Client]
HKLM0=SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters
[Docs:HKLM:Software\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion]
-PatchLevel=N,0
-BetaLevel=N,0
+PatchLevel=N,401
+BetaLevel=N,1
Revision=N,0
---Comment---=
(Default)=S,
-MajorVersion=N,3
+MajorVersion=N,1
InstallDateString=S,<INSTALL_DATE>
PathName=S,<TARGETDIR>\Documentation
Software Type=S,File System
-MinorVersion=N,6
+MinorVersion=N,0
ReleaseType=S,<RELEASE_TYPE>
-VersionString=S,3.6
+VersionString=S,1.0 4.01
Description=S,AFS System Administration Documentation
-[Server:HKLM:Software\TransarcCorporation\AFS Server\3.6]
-PatchLevel=N,0
-BetaLevel=N,0
+[Server:HKLM:Software\TransarcCorporation\AFS Server\1.0 4.01]
+PatchLevel=N,401
+BetaLevel=N,1
Revision=N,0
---Comment---=
(Default)=S,
-MajorVersion=N,3
+MajorVersion=N,1
InstallDateString=S,<INSTALL_DATE>
PathName=S,<TARGETDIR>\Server
Software Type=S,File System
-MinorVersion=N,6
+MinorVersion=N,0
ReleaseType=S,<RELEASE_TYPE>
-VersionString=S,3.6
+VersionString=S,1.0 4.01
Description=S,AFS Server for Windows NT
[Client:HKLM:SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider]
---FileGroup---=
HKLM0=SOFTWARE\Microsoft\Windows NT\CurrentVersion\File Manager\AddOns
-[Docs:HKLM:Software\TransarcCorporation\AFS Supplemental Documentation\3.6]
-PatchLevel=N,0
-BetaLevel=N,0
+[Docs:HKLM:Software\TransarcCorporation\AFS Supplemental Documentation\1.0 4.01]
+PatchLevel=N,401
+BetaLevel=N,1
Revision=N,0
---Comment---=
(Default)=S,
-MajorVersion=N,3
+MajorVersion=N,1
InstallDateString=S,<INSTALL_DATE>
PathName=S,<TARGETDIR>\Documentation
Software Type=S,File System
-MinorVersion=N,6
+MinorVersion=N,0
ReleaseType=S,<RELEASE_TYPE>
-VersionString=S,3.6
+VersionString=S,1.0 4.01
Description=S,AFS System Administration Documentation
[General]
(Default)=S,{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}
[Server:HKLM:Software\TransarcCorporation\AFS Server\CurrentVersion]
-PatchLevel=N,0
-BetaLevel=N,0
+PatchLevel=N,401
+BetaLevel=N,1
Revision=N,0
---Comment---=
(Default)=S,
-MajorVersion=N,3
+MajorVersion=N,1
InstallDateString=S,<INSTALL_DATE>
PathName=S,<TARGETDIR>\Server
Software Type=S,File System
-MinorVersion=N,6
+MinorVersion=N,0
ReleaseType=S,<RELEASE_TYPE>
-VersionString=S,3.6
+VersionString=S,1.0 4.01
Description=S,AFS Server for Windows NT
[Client:HKCR:CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}]
echo [TopDir] > Client_System32_Files.fgl
echo file0=%IS5_DEST%\root.client\usr\vice\etc\afs_cpa.cpl >> Client_System32_Files.fgl
echo file1=%MSVCDIR%\REDIST\Msvcrt.dll >> Client_System32_Files.fgl
-echo file2=%SYSTEMROOT%\system32\Msvcrtd.dll >> Client_System32_Files.fgl
-echo file3=%MSVCDIR%\REDIST\Mfc42.dll >> Client_System32_Files.fgl
-echo file4=%SYSTEMROOT%\system32\mfc42d.dll >> Client_System32_Files.fgl
-echo file5=%SYSTEMROOT%\system32\mfco42d.dll >> Client_System32_Files.fgl
+echo file2=%MSVCDIR%\REDIST\Mfc42.dll >> Client_System32_Files.fgl
echo. >> Client_System32_Files.fgl
echo [General] >> Client_System32_Files.fgl
echo Type=FILELIST >> Client_System32_Files.fgl
echo [TopDir] > Light_Client_System32_Files.fgl
echo file0=%MSVCDIR%\REDIST\Msvcrt.dll >> Light_Client_System32_Files.fgl
-echo file1=%SYSTEMROOT%\system32\Msvcrtd.dll >> Light_Client_System32_Files.fgl
-echo file2=%MSVCDIR%\REDIST\Mfc42.dll >> Light_Client_System32_Files.fgl
-echo file3=%SYSTEMROOT%\system32\mfc42d.dll >> Light_Client_System32_Files.fgl
-echo file4=%SYSTEMROOT%\system32\mfco42d.dll >> Light_Client_System32_Files.fgl
-echo file5=%IS5_DEST%\root.client\usr\vice\etc\afs_cpa.cpl >> Light_Client_System32_Files.fgl
+echo file1=%MSVCDIR%\REDIST\Mfc42.dll >> Light_Client_System32_Files.fgl
+echo file2=%IS5_DEST%\root.client\usr\vice\etc\afs_cpa.cpl >> Light_Client_System32_Files.fgl
echo. >> Light_Client_System32_Files.fgl
echo [General] >> Light_Client_System32_Files.fgl
echo Type=FILELIST >> Light_Client_System32_Files.fgl
echo [TopDir] > Light95_Client_System32_Files.fgl
echo file0=%MSVCDIR%\REDIST\Msvcrt.dll >> Light95_Client_System32_Files.fgl
-echo file1=%SYSTEMROOT%\system32\Msvcrtd.dll >> Light95_Client_System32_Files.fgl
-echo file2=%MSVCDIR%\REDIST\Mfc42.dll >> Light95_Client_System32_Files.fgl
-echo file3=%SYSTEMROOT%\system32\mfc42d.dll >> Light95_Client_System32_Files.fgl
-echo file4=%SYSTEMROOT%\system32\mfco42d.dll >> Light95_Client_System32_Files.fgl
-echo file5=%IS5_DEST%\root.client\usr\vice\etc\afs_cpa.cpl >> Light95_Client_System32_Files.fgl
+echo file1=%MSVCDIR%\REDIST\Mfc42.dll >> Light95_Client_System32_Files.fgl
+echo file2=%IS5_DEST%\root.client\usr\vice\etc\afs_cpa.cpl >> Light95_Client_System32_Files.fgl
echo. >> Light95_Client_System32_Files.fgl
echo [General] >> Light95_Client_System32_Files.fgl
echo Type=FILELIST >> Light95_Client_System32_Files.fgl
echo [TopDir] > Server_System32_Files.fgl
echo file0=%IS5_DEST%\root.server\usr\afs\bin\afsserver.cpl >> Server_System32_Files.fgl
echo file1=%MSVCDIR%\REDIST\Msvcrt.dll >> Server_System32_Files.fgl
-echo file2=%SYSTEMROOT%\system32\Msvcrtd.dll >> Server_System32_Files.fgl
echo. >> Server_System32_Files.fgl
echo [General] >> Server_System32_Files.fgl
echo Type=FILELIST >> Server_System32_Files.fgl
echo [TopDir] > Control_Center_System32_Files.fgl
echo file0=%IS5_DEST%\root.client\usr\vice\etc\afs_cpa.cpl >> Control_Center_System32_Files.fgl
echo file1=%MSVCDIR%\REDIST\Msvcrt.dll >> Control_Center_System32_Files.fgl
-echo file2=%SYSTEMROOT%\system32\Msvcrtd.dll >> Control_Center_System32_Files.fgl
echo. >> Control_Center_System32_Files.fgl
echo [General] >> Control_Center_System32_Files.fgl
echo Type=FILELIST >> Control_Center_System32_Files.fgl
rem Trad_Chinese
set FILEGROUP=Release_Notes_Trad_Chinese_Files.fgl
set IS5_DOC=%IS5_DOCROOT%\install\Documentation\zh_TW
-call :Generate_Release_Notes_File_Group
-
-rem Simp_Chinese
-set FILEGROUP=Release_Notes_Simp_Chinese_Files.fgl
-set IS5_DOC=%IS5_DOCROOT%\install\Documentation\zh_CN
-call :Generate_Release_Notes_File_Group
+call :Generate_Release_Notes_File_Group\r
+\r
+rem Simp_Chinese\r
+set FILEGROUP=Release_Notes_Simp_Chinese_Files.fgl\r
+set IS5_DOC=%IS5_DOCROOT%\install\Documentation\zh_CN\r
+call :Generate_Release_Notes_File_Group\r
rem German
set FILEGROUP=Release_Notes_German_Files.fgl
rem English
set FILEGROUP=Install_Guide_English_Files.fgl
-set IS5_DOC=%IS5_DOCROOT%\install\Documentation\en_US\Html
-call :Generate_Install_Guide_File_Group
+set IS5_DOC=%IS5_DOCROOT%\install\Documentation\en_US\Html\r
+call :Generate_Install_Guide_File_Group\r
rem Japanese
set FILEGROUP=Install_Guide_Japanese_Files.fgl
rem Simp_Chinese
set FILEGROUP=Install_Guide_Simp_Chinese_Files.fgl
-set IS5_DOC=%IS5_DOCROOT%\install\Documentation\zh_CN\Html
+set IS5_DOC=%IS5_DOCROOT%\install\Documentation\zh_CN\Html\r
call :Generate_Install_Guide_File_Group
-
+\r
rem German
set FILEGROUP=Install_Guide_German_Files.fgl
set IS5_DOC=%IS5_DOCROOT%\install\Documentation\de_DE\Html
set FILEGROUP=Install_Guide_Portuguese_Files.fgl
set IS5_DOC=%IS5_DOCROOT%\install\Documentation\pt_BR\Html
call :Generate_Install_Guide_File_Group
-
+\r
goto Sys_Admin_Guide_Files
-:Generate_Install_Guide_File_Group
+:Generate_Install_Guide_File_Group\r
echo [TopDir] > %FILEGROUP%
echo file0=%IS5_DOC%\InstallGd\awqbg000.htm >> %FILEGROUP%
echo file1=%IS5_DOC%\InstallGd\awqbg002.htm >> %FILEGROUP%
set IS5_DOC=%IS5_DOCROOT%\install\Documentation\ko_KR\Html
call :Generate_Doc_Misc_File_Group
copy %AFSROOT%\src\WINNT\license\lang\%IS5_LANG%.rtf %AFSROOT%\src\WINNT\install\InstallShield5\lang\%IS5_LANG%\license.rtf
-
+\r
rem Trad_Chinese
set FILEGROUP=Doc_Misc_Trad_Chinese_Files.fgl
set IS5_LANG=zh_TW
set IS5_DOC=%IS5_DOCROOT%\install\Documentation\zh_TW\Html
call :Generate_Doc_Misc_File_Group
-copy %AFSROOT%\src\WINNT\license\lang\%IS5_LANG%.rtf %AFSROOT%\src\WINNT\install\InstallShield5\lang\%IS5_LANG%\license.rtf
-
+copy %AFSROOT%\src\WINNT\license\lang\%IS5_LANG%.rtf %AFSROOT%\src\WINNT\install\InstallShield5\lang\%IS5_LANG%\license.rtf\r
+\r
rem Simp_Chinese
set FILEGROUP=Doc_Misc_Simp_Chinese_Files.fgl
set IS5_LANG=zh_CN
set IS5_DOC=%IS5_DOCROOT%\install\Documentation\zh_CN\Html
call :Generate_Doc_Misc_File_Group
copy %AFSROOT%\src\WINNT\license\lang\%IS5_LANG%.rtf %AFSROOT%\src\WINNT\install\InstallShield5\lang\%IS5_LANG%\license.rtf
-
+\r
rem German
set FILEGROUP=Doc_Misc_German_Files.fgl
set IS5_LANG=de_DE
goto Doc_Files
-:Generate_Doc_Misc_File_Group
+:Generate_Doc_Misc_File_Group\r
echo [TopDir] > %FILEGROUP%
echo file0=%IS5_DOC%\banner.gif >> %FILEGROUP%
echo file1=%IS5_DOC%\books.gif >> %FILEGROUP%
echo file1=%IS5_INCL%\afs\debug.h >> Client_Afs_Header_Files.fgl
echo file2=%IS5_INCL%\afs\param.h >> Client_Afs_Header_Files.fgl
echo file3=%IS5_INCL%\afs\afs_sysnames.h >> Client_Afs_Header_Files.fgl
-echo file4=%IS5_INCL%\afs\bnode.h >> Client_Afs_Header_Files.fgl
+echo file4=%IS5_INCL%\afs\permit_xprt.h >> Client_Afs_Header_Files.fgl
echo file5=%IS5_INCL%\afs\stds.h >> Client_Afs_Header_Files.fgl
echo file6=%IS5_INCL%\afs\icl.h >> Client_Afs_Header_Files.fgl
echo file7=%IS5_INCL%\afs\procmgmt.h >> Client_Afs_Header_Files.fgl
echo file88=%IS5_INCL%\afs\volint.h >> Client_Afs_Header_Files.fgl
echo file89=%IS5_INCL%\afs\fs_stats.h >> Client_Afs_Header_Files.fgl
echo file90=%IS5_INCL%\afs\bosint.h >> Client_Afs_Header_Files.fgl
+echo file91=%IS5_INCL%\afs\bnode.h >> Client_Afs_Header_Files.fgl
echo. >> Client_Afs_Header_Files.fgl
echo [General] >> Client_Afs_Header_Files.fgl
echo Type=FILELIST >> Client_Afs_Header_Files.fgl
echo Type=FILELIST >> Client_Sample_Files.fgl
echo Version=1.00.000 >> Client_Sample_Files.fgl
+:EOF\r
CompileScript.bat
build:
- BuildSetup.bat
- xcopy/s/e "Media\Transarc AFS\Disk Images\disk1\*.*" $(DESTDIR)\WinInstall
- copy AFS_component_version_number.txt $(DESTDIR)\WinInstall\Version.txt
- del /q "Media\Transarc AFS\Disk Images\disk1\*.*"
+ BuildSetup.bat\r
+ xcopy/s/e/y "Media\Transarc AFS\Disk Images\disk1\*.*" $(DESTDIR)\WinInstall
+ copy AFS_component_version_number.txt $(DESTDIR)\WinInstall\Version.txt\r
+ $(DEL) /q "Media\Transarc AFS\Disk Images\disk1\*.*"
+!IF ((EXIST("$(ISWEB)")) &&("$(ISWEB)"!=""))\r
+! IF (!EXIST($(DESTDIR)\Wininstall\PackageWeb))
+ $(MKDIR) $(DESTDIR)\Wininstall\PackageWeb
+! ENDIF
+ $(DEL) /q $(DESTDIR)\Wininstall\PackageWeb\*.*\r
+ $(ISWEB)\Pftwwiz.exe $(AFSROOT)\src\winnt\install\InstallShield5\PackageWeb.pfw -s -a \r
+!ENDIF\r
install: prep build
-# This file must change to specify a cell.
-# The "511.01.01.01" represents an IP address.
>PutCellNameHere # CellName Comment
511.01.01.01 #DBServerMachineName1
511.02.02.02 #DBServerMachineName2
NOTHING_SELECTED_MSG=You must select something to install before continuing.
DOWNGRADE_LIGHT_CLIENT_MSG=Downgrade AFS Light Client
SETUP_FINISHED_MSG=Setup has finished installing AFS® for Windows on your computer.
-TITLE_MAIN=AFS® for Windows 3.6
-SEVERE_DIALOG_TITLE=AFS® for Windows
+TITLE_MAIN=Open AFS for Windows 1.0 4.01
+SEVERE_DIALOG_TITLE=Open AFS for Windows
UPGRADE_CLIENT_MSG=Upgrade AFS Client
-PRODUCT_VERSION_MINOR=6
+PRODUCT_VERSION_MINOR=0
CONFIGURING_AFS_CLIENT_SERVICE=Configuring the AFS Client service
PRODUCT_NAME_CC=AFS Control Center
PRODUCT_NAME_SERVER=AFS Server
UPGRADE_CC_MSG=Upgrade AFS Control Center
DOWNGRADE_SERVER_MSG=Downgrade AFS Server
-UNINST_DISPLAY_NAME_LIGHT_CLIENT=AFS Light 3.6
+UNINST_DISPLAY_NAME_LIGHT_CLIENT=AFS Light 1.0 4.01
PRODUCT_NAME_LIGHT_CLIENT=AFS Light
ERROR_COMPONENT=Component:
COMPANY_NAME=TransarcCorporation
REINSTALL_CLIENT_MSG=Reinstall AFS Client
DOWNGRADE_CC_MSG=Downgrade AFS Control Center
-UNINST_DISPLAY_NAME_DOCS=AFS Supplemental Documentation 3.6
+UNINST_DISPLAY_NAME_DOCS=AFS Supplemental Documentation 1.0 4.01
UNINST_KEY_SERVER=AFS Server
VIEW_README_PROMPT_MSG=View the readme file
INSTALL_LIGHT_CLIENT_MSG=AFS Light Client
-PRODUCT_VERSION_TITLE=3.6
-UNINST_DISPLAY_NAME_CC=AFS Control Center 3.6
+PRODUCT_VERSION_TITLE=1.0 4.01
+UNINST_DISPLAY_NAME_CC=AFS Control Center 1.0 4.01
ERROR_FILEGROUP=File Group:
ERROR_MOVEDATA=An error occurred during the move data process: %d
CONFIGURING_AFS_SERVER_SERVICE=Configuring the AFS Server service
CLIENT_DESC=AFS Client
SET_NETWORK_PROVIDER_ERROR=Unable to configure the AFS Client as a Network Provider.
-PRODUCT_VERSION_MAJOR=3
-UNINST_DISPLAY_NAME_SERVER=AFS Server 3.6
+PRODUCT_VERSION_MAJOR=1
+UNINST_DISPLAY_NAME_SERVER=AFS Server 1.0 4.01
SETUPUTILS_NOT_FOUND=The file InstallUtils.dll could not be loaded. Setup cannot continue.
LIGHT_CLIENT_ALREADY_INSTALLED_MSG=AFS Light is already installed on this computer.
SETUP_TYPE_MSG=Select the AFS® for Windows products that you wish to install:
UNINST_KEY_CLIENT=AFS Client
UPGRADE_DOCS_MSG=Upgrade AFS Supplemental Documentation
DOWNGRADE_PREP_MSG=Preparing to downgrade the %s. Please wait...this may be a lengthy process.
-PRODUCT_VERSION_PATCH_LEVEL=0
+PRODUCT_VERSION_PATCH_LEVEL=401
NON_UPGRADABLE_SOFTWARE_INSTALLED_ERROR_MSG=Non-upgradable versions of this product are installed on your computer. These \nversions must be uninstalled before the current versions can be installed.
CANT_INSTALL_BOTH_CLIENTS_MSG=Please select only one of the AFS Clients to install. You cannot install both.
UNINST_KEY_LIGHT_CLIENT=AFS Light
UPGRADE_LIGHT_CLIENT_MSG=Upgrade AFS Light Client
UNINST_KEY_DOCS=AFS Supplemental Documentation
-UNINST_DISPLAY_NAME_CLIENT=AFS Client 3.6
+UNINST_DISPLAY_NAME_CLIENT=AFS Client 1.0 4.01
REINSTALL_DOCS_MSG=Reinstall AFS Supplemental Documentation
UPGRADE_PREP_MSG=Preparing to upgrade the %s. Please wait...this may be a lengthy process.
MUST_BE_AN_ADMIN_MSG=You must be a member of the local Administrators group on this Windows system in order to install this product.
////////////////////////////////////////////////////////////////////////////////
//
-// Copyright (C) 1998 Transarc Corporation.
+// Copyright (C) 1998 OpenAFS
// All rights reserved.
//
//
#include "sdlang.h"
#include "sddialog.h"
+
////////////////////// string defines ////////////////////////////
// If the user places a file with this name in the same directory as
///////////////////////////////////////////////////////////////////////////////
function AddPath(szPath)
begin
- LongPathToShortPath(szPath);
-
- if (AddToPath(szPath) < 0) then
- ShowError(@ADD_PATH_ERROR, WARNING);
+ LongPathToShortPath(szPath);
+ if (bWin98 || bWin95) then
+ if (EzBatchAddPath ("Path", szPath, "", AFTER) < 0) then
+ ShowError(@ADD_PATH_ERROR, WARNING);
+ endif;
+ else
+ if (AddToPath(szPath) < 0) then
+ ShowError(@ADD_PATH_ERROR, WARNING);
+ endif;
endif;
-
return 0;
end;
+
+
pthread_95.obj: pthread.c
$(C2OBJ) pthread.c -DAFS_WIN95_ENV /Fopthread_95.obj
-
-install: $(PTHR_DLLFILE) $(PTHR95_DLLFILE) $(LIBINCLUDES)
+install: $(PTHR95_DLLFILE) $(PTHR_DLLFILE) $(LIBINCLUDES)
+\r
+install9x: install\r
pthread.res: pthread.rc AFS_component_version_number.h
$(RC) $*.rc
pthread95.res: pthread95.rc AFS_component_version_number.h
$(RC) $*.rc
+
+clean::
+ $(DEL) /q $(DESTDIR)\lib\win95\*.*
install: $(LIBINCLUDES) $(LIBFILE)
+install9x: install
+
$(LIBFILE): $(LIBOBJS)
$(LIBARCH)
+
+clean::
+ $(DEL) $(LIBINCLUDES)
/*
* SGI specific vnodeops + other misc interface glue
*/
-#ident "$Revision: 1.1.1.3 $"
+#ident "$Revision: 1.1.1.4 $"
#include "../afs/param.h" /* Should be always first */
#ifdef AFS_SGI62_ENV
}
#endif
#if defined(AFS_SPARC64_LINUX20_ENV)
-asmlinkage int afs_xsetgroups32(int gidsetsize, __kernel_gid_t32 *grouplist)
+asmlinkage int afs32_xsetgroups(int gidsetsize, __kernel_gid_t32 *grouplist)
{
gid_t gl[NGROUPS];
int ret, i;
set_fs (old_fs);
return ret;
}
+#ifdef AFS_LINUX24_ENV
+asmlinkage int afs32_xsetgroups32(int gidsetsize, __kernel_gid_t32 *grouplist)
+{
+ gid_t gl[NGROUPS];
+ int ret, i;
+ mm_segment_t old_fs = get_fs ();
+
+ if ((unsigned) gidsetsize > NGROUPS)
+ return -EINVAL;
+ for (i = 0; i < gidsetsize; i++, grouplist++)
+ if (__get_user (gl[i], grouplist))
+ return -EFAULT;
+ set_fs (KERNEL_DS);
+ ret = afs_xsetgroups32(gidsetsize, gl);
+ set_fs (old_fs);
+ return ret;
+}
+#endif
#endif
static int afs_setgroups(cred_t **cr, int ngroups, gid_t *gidset, int change_parent)
esac
clean:
- echo Nothing to delete.
+ rm -f *.o core AFS_component_version_number.c afs_trace.h afs_trace.msf afszcm.cat
afsp->vfs_bsize = 8192;
afsp->vfs_fsid.val[0] = AFS_VFSMAGIC; /* magic */
afsp->vfs_fsid.val[1] = AFS_VFSFSID;
+ afsp->vfs_dev = AFS_VFSMAGIC;
AFS_GUNLOCK();
return 0;
struct usr_inode *ip;
struct usr_vnode *vp;
- usr_assert(followlink == 0);
+ /*usr_assert(followlink == 0);*/
usr_assert(dirvpp == NULL);
/*
*/
if (*fnamep != '/' || uafs_afsPathName(fnamep) != NULL) {
AFS_GLOCK();
- code = uafs_LookupName(fnamep, afs_CurrentDir, compvpp, 0);
+ code = uafs_LookupName(fnamep, afs_CurrentDir, compvpp, 0, 0);
AFS_GUNLOCK();
return code;
}
char *path,
struct usr_vnode *parentVp,
struct usr_vnode **vpp,
- int follow)
+ int follow,
+ int no_eval_mtpt)
{
int code;
int linkCount;
* subdirectory since we hold the global lock
*/
nextVp = NULL;
- code = afs_lookup(vp, pathP, &nextVp, u.u_cred);
+#ifdef AFS_WEB_ENHANCEMENTS
+ if ((nextPathP != NULL && *nextPathP != '\0') || !no_eval_mtpt)
+ code = afs_lookup(vp, pathP, &nextVp, u.u_cred, 0);
+ else
+ code = afs_lookup(vp, pathP, &nextVp, u.u_cred, AFS_LOOKUP_NOEVAL);
+#else
+ code = afs_lookup(vp, pathP, &nextVp, u.u_cred, 0);
+#endif /* AFS_WEB_ENHANCEMENTS */
if (code != 0) {
VN_RELE(vp);
afs_osi_Free(tmpPath, strlen(path)+1);
/*
* Find the target of the symbolic link
*/
- code = uafs_LookupName(pathP, parentVp, &linkVp, 1);
+ code = uafs_LookupName(pathP, parentVp, &linkVp, 1, 0);
if (code) {
afs_osi_Free(pathP, MAX_OSI_PATH+1);
return code;
/*
* look up the parent
*/
- code = uafs_LookupName(pathP, afs_CurrentDir, &parentP, 1);
+ code = uafs_LookupName(pathP, afs_CurrentDir, &parentP, 1, 0);
afs_osi_Free(pathP, len);
if (code != 0) {
return code;
int code;
struct vnode *dirP;
- code = uafs_LookupName(path, afs_CurrentDir, &dirP, 1);
+ code = uafs_LookupName(path, afs_CurrentDir, &dirP, 1, 0);
if (code != 0) {
errno = code;
return -1;
}
} else {
fileP = NULL;
- code = uafs_LookupName(nameP, dirP, &fileP, 1);
+ code = uafs_LookupName(nameP, dirP, &fileP, 1, 0);
VN_RELE(dirP);
if (code != 0) {
errno = code;
if (flags & (O_WRONLY|O_RDWR)) {
fileMode |= VWRITE;
}
+ if (!fileMode) fileMode = VREAD; /* since O_RDONLY is 0 */
code = afs_access(fileP, fileMode, u.u_cred);
if (code != 0) {
VN_RELE(fileP);
int code;
struct vnode *vp;
- code = uafs_LookupName(path, afs_CurrentDir, &vp, 1);
+ code = uafs_LookupName(path, afs_CurrentDir, &vp, 1, 0);
if (code != 0) {
errno = code;
return -1;
int code;
struct vnode *vp;
- code = uafs_LookupName(path, afs_CurrentDir, &vp, 0);
+ code = uafs_LookupName(path, afs_CurrentDir, &vp, 0, 0);
if (code != 0) {
errno = code;
return -1;
struct vnode *vp;
struct usr_vattr attrs;
- code = uafs_LookupName(path, afs_CurrentDir, &vp, 1);
+ code = uafs_LookupName(path, afs_CurrentDir, &vp, 1, 0);
if (code != 0) {
errno = code;
return -1;
struct vnode *vp;
struct usr_vattr attrs;
- code = uafs_LookupName(path, afs_CurrentDir, &vp, 1);
+ code = uafs_LookupName(path, afs_CurrentDir, &vp, 1, 0);
if (code != 0) {
errno = code;
return -1;
/*
* Look up the existing node.
*/
- code = uafs_LookupName(existing, afs_CurrentDir, &existP, 1);
+ code = uafs_LookupName(existing, afs_CurrentDir, &existP, 1, 0);
if (code != 0) {
errno = code;
return -1;
struct usr_uio uio;
struct iovec iov[1];
- code = uafs_LookupName(path, afs_CurrentDir, &vp, 0);
+ code = uafs_LookupName(path, afs_CurrentDir, &vp, 0, 0);
if (code != 0) {
errno = code;
return -1;
char *path)
{
usr_DIR *dirp;
+ struct usr_vnode *fileP;
int fd;
/*
return NULL;
}
+ fileP = afs_FileTable[fd];
+ if (fileP == NULL) {
+ return NULL;
+ }
+
+ if (fileP->v_type != VDIR) {
+ uafs_close_r(fd);
+ errno = ENOTDIR;
+ return NULL;
+ }
+
/*
* Set up the directory structures
*/
return NULL;
}
+#ifdef AFS_WEB_ENHANCEMENTS
+/*
+ * uafs_klog_nopag
+ * klog but don't allocate a new pag
+ */
+int uafs_klog_nopag(
+ char *user,
+ char *cell,
+ char *passwd,
+ char **reason)
+{
+ int code;
+ afs_int32 password_expires = -1;
+
+ usr_mutex_lock(&osi_authenticate_lock);
+ code = ka_UserAuthenticateGeneral(
+ KA_USERAUTH_VERSION /*+KA_USERAUTH_DOSETPAG2*/, user,
+ NULL, cell, passwd, 0, &password_expires,
+ 0, reason);
+ usr_mutex_unlock(&osi_authenticate_lock);
+ return code;
+}
+
+/*
+ * uafs_getcellstatus
+ * get the cell status
+ */
+int uafs_getcellstatus(char *cell, afs_int32 *status)
+{
+ int rc;
+ struct afs_ioctl iob;
+
+ iob.in = cell;
+ iob.in_size = strlen(cell)+1;
+ iob.out = 0;
+ iob.out_size = 0;
+
+ rc = call_syscall(AFSCALL_PIOCTL, /*path*/0, _VICEIOCTL(35),
+ (long)&iob, 0, 0);
+
+ if (rc < 0) {
+ errno = rc;
+ return -1;
+ }
+
+ *status = iob.out;
+ return 0;
+}
+
+/*
+ * uafs_getvolquota
+ * Get quota of volume associated with path
+ */
+int uafs_getvolquota(char *path, afs_int32 *BlocksInUse, afs_int32 *MaxQuota)
+{
+ int rc;
+ struct afs_ioctl iob;
+ VolumeStatus *status;
+ char buf[1024];
+
+ iob.in = 0;
+ iob.in_size = 0;
+ iob.out = buf;
+ iob.out_size = 1024;
+
+ rc = call_syscall(AFSCALL_PIOCTL, path, _VICEIOCTL(4),
+ (long)&iob, 0, 0);
+
+ if (rc != 0) {
+ errno = rc;
+ return -1;
+ }
+
+ status = (VolumeStatus *) buf;
+ *BlocksInUse = status->BlocksInUse;
+ *MaxQuota = status->MaxQuota;
+ return 0;
+}
+
+/*
+ * uafs_setvolquota
+ * Set quota of volume associated with path
+ */
+int uafs_setvolquota(char *path, afs_int32 MaxQuota)
+{
+ int rc;
+ struct afs_ioctl iob;
+ VolumeStatus *status;
+ char buf[1024];
+
+ iob.in = buf;
+ iob.in_size = 1024;
+ iob.out = 0;
+ iob.out_size = 0;
+
+ memset(buf, 0, sizeof(VolumeStatus));
+ status = (VolumeStatus *) buf;
+ status->MaxQuota = MaxQuota;
+ status->MinQuota = -1;
+
+ rc = call_syscall(AFSCALL_PIOCTL, path, _VICEIOCTL(5),
+ (long)&iob, 0, 0);
+
+ if (rc != 0) {
+ errno = rc;
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ * uafs_statmountpoint
+ * Determine whether a dir. is a mount point or not
+ * return 1 if mount point, 0 if not
+ */
+int uafs_statmountpoint(char *path)
+{
+ int retval;
+ int code;
+ char buf[256];
+
+ AFS_GLOCK();
+ retval = uafs_statmountpoint_r(path);
+ AFS_GUNLOCK();
+ return retval;
+}
+
+int uafs_statmountpoint_r(char *path)
+{
+ int code;
+ struct vnode *vp;
+ struct vcache *avc;
+ struct vrequest treq;
+ int r;
+
+ code = uafs_LookupName(path, afs_CurrentDir, &vp, 0, 1);
+ if (code != 0) {
+ errno = code;
+ return -1;
+ }
+
+ avc = (struct vcache *) vp;
+
+ r = avc->mvstat;
+ VN_RELE(vp);
+ return r;
+}
+
+/*
+ * uafs_getRights
+ * Get a list of rights for the current user on path.
+ */
+int uafs_getRights(char *path)
+{
+ int code, rc;
+ struct vnode *vp;
+ int afs_rights;
+
+ AFS_GLOCK();
+ code = uafs_LookupName(path, afs_CurrentDir, &vp, 1, 0);
+ if (code != 0) {
+ errno = code;
+ AFS_GUNLOCK();
+ return -1;
+ }
+
+ afs_rights = PRSFS_READ |
+ PRSFS_WRITE |
+ PRSFS_INSERT |
+ PRSFS_LOOKUP |
+ PRSFS_DELETE |
+ PRSFS_LOCK |
+ PRSFS_ADMINISTER;
+
+ afs_rights = afs_getRights (vp, afs_rights, u.u_cred);
+
+ AFS_GUNLOCK();
+ return afs_rights;
+}
+#endif /* AFS_WEB_ENHANCEMENTS */
+
#endif /* UKERNEL */
extern int uafs_LookupLink(struct usr_vnode *vp, struct usr_vnode *parentP,
struct usr_vnode **vpp);
extern int uafs_LookupName(char *path, struct usr_vnode *parentP,
- struct usr_vnode **vpp, int follow);
+ struct usr_vnode **vpp, int follow,
+ int no_eval_mtpt);
extern int uafs_LookupParent(char *path, struct usr_vnode **vpp);
extern int uafs_GetAttr(struct usr_vnode *vp, struct stat *stats);
}
}
+#if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS)
+/*
+ * afs_getRights
+ * This function is just an interface to afs_GetAccessBits
+ */
+int afs_getRights(OSI_VC_ARG(avc), arights, acred)
+ OSI_VC_DECL(avc);
+ register afs_int32 arights;
+ struct AFS_UCRED *acred;
+{
+ register afs_int32 code;
+ struct vrequest treq;
+ OSI_VC_CONVERT(avc)
+
+ if (code = afs_InitReq(&treq, acred)) return code;
+
+ code = afs_VerifyVCache(avc, &treq);
+ if (code) {
+ code = afs_CheckCode(code, &treq, 16);
+ return code;
+ }
+
+ return afs_GetAccessBits(avc, arights, &treq);
+}
+#endif /* defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS) */
* Below return 0 (and not 1) blocks if the file is zero length. This conforms
* better with the other filesystems that do return 0.
*/
-#ifdef AFS_OSF_ENV
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
#ifdef va_size_rsv
attrs->va_size_rsv = 0;
#endif
/* XXX do this */
/* attrs->va_gen = avc->m.DataVersion;*/
attrs->va_flags = 0;
-#endif /* AFS_OSF_ENV */
+#endif /* AFS_OSF_ENV || AFS_DARWIN_ENV */
#if !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
#if !defined(AFS_HPUX_ENV)
if ((amode & VWRITE) || len != 0xffffffff)
#endif
{
+ /* needed for write access check */
+ tvc->parentVnode = adp->fid.Fid.Vnode;
+ tvc->parentUnique = adp->fid.Fid.Unique;
/* need write mode for these guys */
if (!afs_AccessOK(tvc, PRSFS_WRITE, &treq, CHECK_MODE_BITS)) {
afs_PutVCache(tvc, READ_LOCK);
#if defined(AFS_HPUX102_ENV)
#define AFS_FLOCK k_flock
#else
-#if defined(AFS_SUN56_ENV)
+#if defined(AFS_SUN56_ENV) || defined(AFS_LINUX24_ENV)
#define AFS_FLOCK flock64
#else
#define AFS_FLOCK flock
with it in. However, they fail in race conditions. The question is
what to do for people who don't have source to their application;
this way at least, they can get work done */
+#ifdef AFS_LINUX24_ENV
+ if (af->l_len == OFFSET_MAX)
+ af->l_len = 0; /* since some systems indicate it as EOF */
+#else
if (af->l_len == 0x7fffffff)
af->l_len = 0; /* since some systems indicate it as EOF */
#ifdef AFS_LINUX_64BIT_KERNEL
if (af->l_len == LONG_MAX)
af->l_len = 0; /* since some systems indicate it as EOF */
+#endif
#endif
/* next line makes byte range locks always succeed,
even when they should block */
afs_rwlock_t afs_xcell; /* allocation lock for cells */
struct afs_q CellLRU;
afs_int32 afs_cellindex=0;
+afs_uint32 afs_nextCellNum = 0x100;
/* Local variables. */
struct cell *afs_rootcell = 0;
-struct cell *afs_GetCellByName(acellName, locktype)
+static char afs_AfsdbHandlerWait;
+static char afs_AfsdbLookupWait;
+
+char afs_AfsdbHandlerPresent = 0;
+char afs_AfsdbHandlerInuse = 0;
+
+char *afs_AfsdbHandler_CellName;
+afs_int32 *afs_AfsdbHandler_CellHosts;
+int *afs_AfsdbHandler_Timeout;
+
+char afs_AfsdbHandler_ReqPending;
+char afs_AfsdbHandler_Completed;
+
+
+struct cell *afs_GetCellByName_int();
+
+int afs_strcasecmp(s1, s2)
+ register char *s1, *s2;
+{
+ while (*s1 && *s2) {
+ register char c1, c2;
+
+ c1 = *s1++;
+ c2 = *s2++;
+ if (c1 >= 'A' && c1 <= 'Z') c1 += 0x20;
+ if (c2 >= 'A' && c2 <= 'Z') c2 += 0x20;
+ if (c1 != c2)
+ return c1-c2;
+ }
+
+ return *s1 - *s2;
+}
+
+
+#ifdef AFS_AFSDB_ENV
+int afs_AfsdbHandler(acellName, acellNameLen, kernelMsg)
+ char *acellName;
+ int acellNameLen;
+ afs_int32 *kernelMsg;
+{
+ /* afs_syscall_call() has already grabbed the global lock */
+
+ afs_AfsdbHandlerPresent = 1;
+
+ if (afs_AfsdbHandler_ReqPending) {
+ int i, hostCount;
+
+ hostCount = kernelMsg[0];
+ *afs_AfsdbHandler_Timeout = kernelMsg[1];
+ if (*afs_AfsdbHandler_Timeout) *afs_AfsdbHandler_Timeout += osi_Time();
+
+ for (i=0; i<MAXCELLHOSTS; i++) {
+ if (i >= hostCount)
+ afs_AfsdbHandler_CellHosts[i] = 0;
+ else
+ afs_AfsdbHandler_CellHosts[i] = kernelMsg[2+i];
+ }
+
+ /* Request completed, wake up the relevant thread */
+ afs_AfsdbHandler_ReqPending = 0;
+ afs_AfsdbHandler_Completed = 1;
+ afs_osi_Wakeup(&afs_AfsdbLookupWait);
+ }
+
+ /* Wait for a request */
+ while (afs_AfsdbHandler_ReqPending == 0)
+ afs_osi_Sleep(&afs_AfsdbHandlerWait);
+
+ /* Copy the requested cell name into the request buffer */
+ strncpy(acellName, afs_AfsdbHandler_CellName, acellNameLen);
+
+ /* Return the lookup request to userspace */
+ return 0;
+}
+#endif
+
+
+int afs_GetCellHostsFromDns(acellName, acellHosts, timeout)
+ char *acellName;
+ afs_int32 *acellHosts;
+ int *timeout;
+{
+#ifdef AFS_AFSDB_ENV
+ char grab_glock = 0;
+
+ if (!afs_AfsdbHandlerPresent) return ENOENT;
+
+ if (!ISAFS_GLOCK()) {
+ grab_glock = 1;
+ AFS_GLOCK();
+ }
+
+ /* Wait until the AFSDB handler is available, and grab it */
+ while (afs_AfsdbHandlerInuse)
+ afs_osi_Sleep(&afs_AfsdbLookupWait);
+ afs_AfsdbHandlerInuse = 1;
+
+ /* Set up parameters for the handler */
+ afs_AfsdbHandler_CellName = acellName;
+ afs_AfsdbHandler_CellHosts = acellHosts;
+ afs_AfsdbHandler_Timeout = timeout;
+
+ /* Wake up the AFSDB handler */
+ afs_AfsdbHandler_Completed = 0;
+ afs_AfsdbHandler_ReqPending = 1;
+ afs_osi_Wakeup(&afs_AfsdbHandlerWait);
+
+ /* Wait for the handler to get back to us with the reply */
+ while (!afs_AfsdbHandler_Completed)
+ afs_osi_Sleep(&afs_AfsdbLookupWait);
+
+ /* Release the AFSDB handler and wake up others waiting for it */
+ afs_AfsdbHandlerInuse = 0;
+ afs_osi_Wakeup(&afs_AfsdbLookupWait);
+
+ if (grab_glock) AFS_GUNLOCK();
+
+ if (*acellHosts) return 0;
+ return ENOENT;
+#else
+ return ENOENT;
+#endif
+}
+
+
+void afs_RefreshCell(tc)
+ register struct cell *tc;
+{
+ afs_int32 acellHosts[MAXCELLHOSTS];
+ int timeout;
+
+ /* Don't need to do anything if no timeout or it's not expired */
+ if (!tc->timeout || tc->timeout > osi_Time()) return;
+
+ if (!afs_GetCellHostsFromDns(tc->cellName, acellHosts, &timeout)) {
+ afs_NewCell(tc->cellName, acellHosts, tc->states,
+ tc->lcellp ? tc->lcellp->cellName : (char *) 0,
+ tc->fsport, tc->vlport, timeout);
+ }
+
+ /* In case of a DNS failure, keep old cell data.. */
+ return;
+}
+
+
+struct cell *afs_GetCellByName_Dns(acellName, locktype)
+ register char *acellName;
+ afs_int32 locktype;
+{
+ afs_int32 acellHosts[MAXCELLHOSTS];
+ int timeout;
+
+ if (afs_GetCellHostsFromDns(acellName, acellHosts, &timeout))
+ return (struct cell *) 0;
+ if (afs_NewCell(acellName, acellHosts, CNoSUID, (char *) 0, 0, 0, timeout))
+ return (struct cell *) 0;
+
+ return afs_GetCellByName_int(acellName, locktype, 0);
+}
+
+
+struct cell *afs_GetCellByName_int(acellName, locktype, trydns)
register char *acellName;
afs_int32 locktype;
+ char trydns;
{
register struct cell *tc;
register struct afs_q *cq, *tq;
ObtainWriteLock(&afs_xcell,100);
for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
tc = QTOC(cq); tq = QNext(cq);
- if (!strcmp(tc->cellName, acellName)) {
+ if (!afs_strcasecmp(tc->cellName, acellName)) {
QRemove(&tc->lruq);
QAdd(&CellLRU, &tc->lruq);
ReleaseWriteLock(&afs_xcell);
+ afs_RefreshCell(tc);
return tc;
}
}
ReleaseWriteLock(&afs_xcell);
- return (struct cell *) 0;
+ return trydns ? afs_GetCellByName_Dns(acellName, locktype)
+ : (struct cell *) 0;
+
+} /*afs_GetCellByName_int*/
+
+
+struct cell *afs_GetCellByName(acellName, locktype)
+ register char *acellName;
+ afs_int32 locktype;
+{
+ return afs_GetCellByName_int(acellName, locktype, 1);
} /*afs_GetCellByName*/
QRemove(&tc->lruq);
QAdd(&CellLRU, &tc->lruq);
ReleaseWriteLock(&afs_xcell);
+ afs_RefreshCell(tc);
return tc;
}
}
QRemove(&tc->lruq);
QAdd(&CellLRU, &tc->lruq);
ReleaseWriteLock(&afs_xcell);
+ afs_RefreshCell(tc);
return tc;
}
}
} /*afs_GetCellByIndex*/
-afs_int32 afs_NewCell(acellName, acellHosts, aflags, linkedcname, fsport, vlport)
+afs_int32 afs_NewCell(acellName, acellHosts, aflags, linkedcname, fsport, vlport, timeout)
int aflags;
char *acellName;
register afs_int32 *acellHosts;
char *linkedcname;
u_short fsport, vlport;
+ int timeout;
{
register struct cell *tc, *tcl=0;
register afs_int32 i, newc=0, code=0;
/* Find the cell and mark its servers as not down but gone */
for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
tc = QTOC(cq); tq = QNext(cq);
- if (strcmp(tc->cellName, acellName) == 0) {
+ if (afs_strcasecmp(tc->cellName, acellName) == 0) {
/* we don't want to keep pinging old vlservers which were down,
* since they don't matter any more. It's easier to do this than
* to remove the server from its various hash tables. */
afs_rootcell = tc;
afs_rootCellIndex = tc->cellIndex;
} else {
- tc->cell = *acellHosts; /* won't be reused by another cell */
+ tc->cell = afs_nextCellNum++;
}
tc->states = 0;
tc->lcellp = (struct cell *)0;
}
for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
tcl = QTOC(cq); tq = QNext(cq);
- if (!strcmp(tcl->cellName, linkedcname)) {
+ if (!afs_strcasecmp(tcl->cellName, linkedcname)) {
break;
}
tcl = 0;
tcl->lcellp = tc;
}
tc->states |= aflags;
+ tc->timeout = timeout;
bzero((char *)tc->cellHosts, sizeof(tc->cellHosts));
for (i=0; i<MAXCELLHOSTS; i++) {
extern afs_rwlock_t afs_xcell;
extern struct afs_q CellLRU;
extern afs_int32 afs_cellindex;
+extern afs_int32 afs_nextCellNum;
/* afs_conn.c */
extern afs_rwlock_t afs_xconn;
afs_rwlock_t afs_puttofileLock; /* not used */
char *afs_sysname = 0; /* So that superuser may change the
* local value of @sys */
+char *afs_sysnamelist[MAXNUMSYSNAMES]; /* For support of a list of sysname */
+int afs_sysnamecount = 0;
struct volume *Initialafs_freeVolList;
int afs_memvolumes = 0;
afs_resourceinit_flag = 1;
for (i=0;i<NFENTRIES;i++)
fvTable[i] = 0;
- afs_sysname = afs_osi_Alloc(MAXSYSNAME);
+ for(i=0;i<MAXNUMSYSNAMES;i++)
+ afs_sysnamelist[i] = afs_osi_Alloc(MAXSYSNAME);
+ afs_sysname = afs_sysnamelist[0];
strcpy(afs_sysname, SYS_NAME);
+ afs_sysnamecount = 1;
QInit(&CellLRU);
#if defined(AFS_AIX32_ENV) || defined(AFS_HPUX_ENV)
{ extern afs_int32 afs_preallocs;
for (i=0; i<NFENTRIES; i++)
fvTable[i] = 0;
/* Reinitialize local globals to defaults */
- afs_osi_Free(afs_sysname, MAXSYSNAME);
+ for(i=0; i<MAXNUMSYSNAMES; i++)
+ afs_osi_Free(afs_sysnamelist[i], MAXSYSNAME);
afs_sysname = 0;
+ afs_sysnamecount = 0;
afs_marinerHost = 0;
QInit(&CellLRU);
afs_setTimeHost = (struct server *)0;
afs_volCounter = 1;
afs_waitForever = afs_waitForeverCount = 0;
afs_cellindex = 0;
+ afs_nextCellNum = 0x100;
afs_FVIndex = -1;
afs_server = (struct rx_service *)0;
RWLOCK_INIT(&afs_xconn, "afs_xconn");
/* Exported variables */
afs_uint32 pag_epoch;
+#if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS)
+afs_uint32 pagCounter = 1;
+#else
afs_uint32 pagCounter = 0;
+#endif /* UKERNEL && AFS_WEB_ENHANCEMENTS */
/* Local variables */
* anyway, so the pag is an alternative handle which is somewhat more
* secure (although of course not absolutely secure).
*/
+#if !defined(UKERNEL) || !defined(AFS_WEB_ENHANCEMENTS)
afs_uint32 genpag(void) {
AFS_STATCNT(genpag);
#ifdef AFS_LINUX20_ENV
/* Ensure unique PAG's (mod 200 days) when reloading the client. */
return (('A' << 24) + ((pag_epoch + pagCounter++) & 0xffffff));
-#else
+#else /* AFS_LINUX20_ENV */
return (('A' << 24) + (pagCounter++ & 0xffffff));
-#endif
+#endif /* AFS_LINUX20_ENV */
}
afs_uint32 getpag(void) {
#endif
}
+#else
+
+/* Web enhancement: we don't need to restrict pags to 41XXXXXX since
+ * we are not sharing the space with anyone. So we use the full 32 bits. */
+
+afs_uint32 genpag(void) {
+ AFS_STATCNT(genpag);
+#ifdef AFS_LINUX20_ENV
+ return (pag_epoch + pagCounter++);
+#else
+ return (pagCounter++);
+#endif /* AFS_LINUX20_ENV */
+}
+
+afs_uint32 getpag(void) {
+ AFS_STATCNT(getpag);
+#ifdef AFS_LINUX20_ENV
+ /* Ensure unique PAG's (mod 200 days) when reloading the client. */
+ return (pag_epoch + pagCounter);
+#else
+ return (pagCounter);
+#endif
+}
+#endif /* UKERNEL && AFS_WEB_ENHANCEMENTS */
/* used to require 10 seconds between each setpag to guarantee that
* PAGs never wrap - which would be a security hole. If we presume
#endif
}
+#if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS)
+/*
+ * afs_setpag_val
+ * This function is like setpag but sets the current thread's pag id to a
+ * caller-provided value instead of calling genpag(). This implements a
+ * form of token caching since the caller can recall a particular pag value
+ * for the thread to restore tokens, rather than reauthenticating.
+ */
+int
+#if defined(AFS_SUN5_ENV)
+afs_setpag_val (struct AFS_UCRED **credpp, int pagval)
+#elif defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+afs_setpag_val (struct proc *p, void *args, int *retval, int pagval)
+#else
+afs_setpag_val (int pagval)
+#endif
+{
+ int code = 0;
+
+#if defined(AFS_SGI53_ENV) && defined(MP)
+ /* This is our first chance to get the global lock. */
+ AFS_GLOCK();
+#endif /* defined(AFS_SGI53_ENV) && defined(MP) */
+
+ AFS_STATCNT(afs_setpag);
+#ifdef AFS_SUN5_ENV
+ if (!afs_suser(*credpp))
+#else
+ if (!afs_suser())
+#endif
+ {
+ while (osi_Time() - pag_epoch < pagCounter ) {
+ afs_osi_Wait(1000, (struct afs_osi_WaitHandle *) 0, 0);
+ }
+ }
+
+#if defined(AFS_SUN5_ENV)
+ code = AddPag(pagval, credpp);
+#elif defined(AFS_OSF_ENV) || defined(AFS_FBSD_ENV)
+ code = AddPag(p, pagval, &p->p_rcred);
+#elif defined(AFS_AIX41_ENV)
+ {
+ struct ucred *credp;
+ struct ucred *credp0;
+
+ credp = crref();
+ credp0 = credp;
+ code = AddPag(pagval, &credp);
+ /* If AddPag() didn't make a new cred, then free our cred ref */
+ if (credp == credp0) {
+ crfree(credp);
+ }
+ }
+#elif defined(AFS_HPUX110_ENV)
+ {
+ struct ucred *credp = p_cred(u.u_procp);
+ code = AddPag(pagval, &credp);
+ }
+#elif defined(AFS_SGI_ENV)
+ {
+ cred_t *credp;
+ credp = OSI_GET_CURRENT_CRED();
+ code = AddPag(pagval, &credp);
+ }
+#elif defined(AFS_LINUX20_ENV)
+ {
+ struct AFS_UCRED *credp = crref();
+ code = AddPag(pagval, &credp);
+ crfree(credp);
+ }
+#elif defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ {
+ struct ucred *credp=crdup(p->p_cred->pc_ucred);
+ code=AddPag(p, pagval, &credp);
+ crfree(credp);
+ }
+#else
+ code = AddPag(pagval, &u.u_cred);
+#endif
+
+ afs_Trace1(afs_iclSetp, CM_TRACE_SETPAG, ICL_TYPE_INT32, code);
+#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_SGI53_ENV) && defined(MP)
+ AFS_GUNLOCK();
+#endif /* defined(AFS_SGI53_ENV) && defined(MP) */
+ return (code);
+#else
+ if (!getuerror())
+ setuerror(code);
+ return (code);
+#endif
+}
+#endif /* UKERNEL && AFS_WEB_ENHANCEMENTS */
+
+#if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS)
+int afs_getpag_val()
+{
+ int pagvalue;
+ struct AFS_UCRED *credp = u.u_cred;
+ int gidset0, gidset1;
+
+ gidset0 = credp->cr_groups[0];
+ gidset1 = credp->cr_groups[1];
+ pagvalue=afs_get_pag_from_groups(gidset0, gidset1);
+ return pagvalue;
+}
+#endif /* UKERNEL && AFS_WEB_ENHANCEMENTS */
+
+
#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
int AddPag(struct proc *p, afs_int32 aval, struct AFS_UCRED **credpp)
#else /* AFS_OSF_ENV || AFS_FBSD_ENV */
h = (g0 >> 14);
h = (g1 >> 14) + h + h + h;
ret = ((h << 28) | l);
+#if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS)
+ return ret;
+#else
/* Additional testing */
if (((ret >> 24) & 0xff) == 'A')
return ret;
else
return NOPAG;
+#endif /* UKERNEL && AFS_WEB_ENHANCEMENTS */
}
return NOPAG;
}
AFS_STATCNT(afs_get_groups_from_pag);
+#if !defined(UKERNEL) || !defined(AFS_WEB_ENHANCEMENTS)
pag &= 0x7fffffff;
+#endif /* UKERNEL && AFS_WEB_ENHANCEMENTS */
g0 = 0x3fff & (pag >> 14);
g1 = 0x3fff & pag;
g0 |= ((pag >> 28) / 3) << 14;
AFS_STATCNT(CheckVLServer);
/* Ping dead servers to see if they're back */
- if (!(aserver->flags & SRVR_ISDOWN) || (aserver->flags & SRVR_ISGONE))
+ if (!((aserver->flags & SRVR_ISDOWN) || (sa->sa_flags & SRVADDR_ISDOWN)) || (aserver->flags & SRVR_ISGONE))
return;
if (!aserver->cell)
return; /* can't do much */
#define VFS 1
#include <afs/param.h>
+#include "afsconfig.h"
#include <afs/cmd.h>
#include <assert.h>
#include <sys/file.h>
#include <errno.h>
#include <sys/time.h>
-#ifdef AFS_DEC_ENV
+#include <dirent.h>
+
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
-#include <sys/fs_types.h>
#endif
-#if defined(AFS_SUN_ENV)
-#include <sys/vfs.h>
+
+#ifdef HAVE_SYS_FS_TYPES_H
+#include <sys/fs_types.h>
#endif
-#ifndef AFS_AIX41_ENV
+
+#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
-#include <dirent.h>
-#ifdef AFS_SUN5_ENV
+
+#ifdef HAVE_SYS_FCNTL_H
#include <sys/fcntl.h>
+#endif
+
+#ifdef HAVE_SYS_MNTTAB_H
#include <sys/mnttab.h>
+#endif
+
+#ifdef HAVE_SYS_MNTENT_H
#include <sys/mntent.h>
-#else
-#if defined(AFS_SUN_ENV) || defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV)
-#include <mntent.h>
#endif
+
+#ifdef HAVE_MNTENT_H
+#include <mntent.h>
#endif
-#if defined(AFS_OSF_ENV) || defined(AFS_DEC_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
-#else
+#endif
+
+#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
static int preallocs = 400; /* Def # of allocated memory blocks */
static int enable_peer_stats = 0; /* enable rx stats */
static int enable_process_stats = 0; /* enable rx stats */
+#ifdef AFS_AFSDB_ENV
+static int enable_afsdb = 0; /* enable AFSDB support */
+#endif
#ifdef notdef
static int inodes = 60; /* VERY conservative, but has to be */
#endif
return 0;
}
+#ifdef AFS_AFSDB_ENV
+static AfsdbLookupHandler()
+{
+ afs_int32 kernelMsg[64];
+ char acellName[128];
+ afs_int32 code;
+ struct afsconf_cell acellInfo;
+ int i;
+
+ while (1) {
+ /* On some platforms you only get 4 args to an AFS call */
+ int sizeArg = ((sizeof acellName) << 16) | (sizeof kernelMsg);
+ code = call_syscall(AFSOP_AFSDB_HANDLER, acellName, kernelMsg, sizeArg);
+ if (code) { /* Something is wrong? */
+ sleep(1);
+ continue;
+ }
+
+ code = afsconf_GetAfsdbInfo(acellName, 0, &acellInfo);
+ if (code) {
+ kernelMsg[0] = 0;
+ kernelMsg[1] = 0;
+ } else {
+ kernelMsg[0] = acellInfo.numServers;
+ if (acellInfo.timeout)
+ kernelMsg[1] = acellInfo.timeout - time(0);
+ else
+ kernelMsg[1] = 0;
+ for (i=0; i<acellInfo.numServers; i++)
+ kernelMsg[i+2] = acellInfo.hostAddr[i].sin_addr.s_addr;
+ }
+ }
+}
+#endif
+
#ifdef mac2
#include <sys/ioctl.h>
#endif /* mac2 */
/* -mem_alloc_sleep */
cacheFlags |= AFSCALL_INIT_MEMCACHE_SLEEP;
}
+ if (as->parms[24].items) {
+ /* -afsdb */
+#ifdef AFS_AFSDB_ENV
+ enable_afsdb = 1;
+#else
+ printf("afsd: No AFSDB support; ignoring -afsdb");
+#endif
+ }
/*
* Pull out all the configuration info for the workstation's AFS cache and
}
#endif
+#ifdef AFS_AFSDB_ENV
+ if (enable_afsdb) {
+ if (afsd_verbose)
+ printf("%s: Forking AFSDB lookup handler.\n", rn);
+ code = fork();
+ if (code == 0) {
+ AfsdbLookupHandler();
+ exit(1);
+ }
+ }
+#endif
+
/* Initialize AFS daemon threads. */
if (afsd_verbose)
printf("%s: Forking AFS daemon.\n", rn);
}
/*
- * If the root volume has been explicitly set, tell the kernel.
- */
+ * If the root volume has been explicitly set, tell the kernel.
+ */
if (rootVolSet) {
if (afsd_verbose)
printf("%s: Calling AFSOP_ROOTVOLUME with '%s'\n",
cmd_AddParm(ts, "-enable_peer_stats", CMD_FLAG, CMD_OPTIONAL|CMD_HIDE, "Collect rpc statistics by peer");
cmd_AddParm(ts, "-enable_process_stats", CMD_FLAG, CMD_OPTIONAL|CMD_HIDE, "Collect rpc statistics for this process");
cmd_AddParm(ts, "-mem_alloc_sleep", CMD_FLAG, (CMD_OPTIONAL | CMD_HIDE), "Allow sleeps when allocating memory cache");
+ cmd_AddParm(ts, "-afsdb", CMD_FLAG, (CMD_OPTIONAL
+#ifndef AFS_AFSDB_ENV
+ | CMD_HIDE
+#endif
+ ), "Enable AFSDB support");
return (cmd_Dispatch(argc, argv));
}
include ../config/Makefile.${SYS_NAME}
CFLAGS=-g -I. \
+ -I${TOP_SRCDIR}/config \
-I${SRCDIR}include \
-I${SRCDIR}include/afs \
-I${SRCDIR} ${XCFLAGS}
static char rn[] = "Print_cm_FullPerfInfo"; /* routine name */
struct afs_stats_AuthentInfo *authentP; /*Ptr to authentication stats*/
struct afs_stats_AccessInfo *accessinfP; /*Ptr to access stats*/
- struct afs_stats_AuthorInfo *authorP; /*Ptr to authorship stats*/
static afs_int32 fullPerfLongs =
(sizeof (struct afs_stats_CMFullPerf) >> 2); /*Correct #longs*/
afs_int32 numLongs; /*# longs actually received*/
#include <math.h>
#include <cmd.h>
#include <afs/param.h>
+#include <afsconfig.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#undef IN
#include <time.h>
numBytes = fs_numHosts_perPage * sizeof(struct ServerInfo_line);
fs_lines = (struct ServerInfo_line *) malloc(numBytes);
if (fs_lines == (struct ServerInfo_line *)0) {
- sprintf(errMsg,"[ %s ] Failed to allocate % bytes for FS data lines\n",
+ sprintf(errMsg,"[ %s ] Failed to allocate %d bytes for FS data lines\n",
rn, numBytes);
afsmon_Exit(365);
}
numBytes = fs_cols_perPage * sizeof(struct onode *);
fs_lines_Ptr->data_o[arrIdx] = (struct onode **) malloc(numBytes);
if (fs_lines_Ptr->data_o[arrIdx] == (struct onode **)0) {
- sprintf(errMsg,"[ %s ] Failed to allocate % bytes for FS data onodes\n",
+ sprintf(errMsg,"[ %s ] Failed to allocate %d bytes for FS data onodes\n",
rn, numBytes);
afsmon_Exit(370);
}
}
if (cmIdx >= numCM) { /* whoops! screwed up */
- sprintf(errMsg,"[ %s ] Programming error 1\n");
+ sprintf(errMsg,"[ %s ] Programming error 1\n", rn);
afsmon_Exit(405);
}
numBytes = cm_numHosts_perPage * sizeof(struct ServerInfo_line);
cm_lines = (struct ServerInfo_line *) malloc(numBytes);
if (cm_lines == (struct ServerInfo_line *)0) {
- sprintf(errMsg,"[ %s ] Failed to allocate % bytes for CM data lines\n",
+ sprintf(errMsg,"[ %s ] Failed to allocate %d bytes for CM data lines\n",
rn, numBytes);
afsmon_Exit(445);
}
numBytes = cm_cols_perPage * sizeof(struct onode *);
cm_lines_Ptr->data_o[arrIdx] = (struct onode **) malloc(numBytes);
if (cm_lines_Ptr->data_o[arrIdx] == (struct onode **)0) {
- sprintf(errMsg,"[ %s ] Failed to allocate % bytes for CM data onodes\n",
+ sprintf(errMsg,"[ %s ] Failed to allocate %d bytes for CM data onodes\n",
rn, numBytes);
afsmon_Exit(450);
}
#include <cmd.h>
#include <signal.h>
#include <afs/param.h>
+#include <afsconfig.h>
#undef IN
#include <sys/socket.h>
#include <netdb.h>
#endif
+#include <ctype.h>
#include <gtxwindows.h> /*Generic window package*/
#include <gtxobjects.h> /*Object definitions*/
char *name;
{
struct hostent *he;
+#ifdef AFS_SUN5_ENV
char ip_addr[32];
+#endif
he = gethostbyname(name);
#ifdef AFS_SUN5_ENV
int i;
int j;
int bufslot;
- int exitVal;
int code;
if (afsmon_debug) {
}
fprintf(debugFD,"\t\t-----End of List-----\n");
}
+ return(0);
} /* print_CM() */
char arg3[CFG_STR_LEN]; /* threshold value */
char arg4[CFG_STR_LEN]; /* user's handler */
struct hostent *he; /* host entry */
- int code;
- char ip_addr[32];
if (afsmon_debug) {
fprintf(debugFD,"[ %s ] Called, a_line = %s\n",rn, a_line);
char arg3[CFG_STR_LEN]; /* threshold value */
char arg4[CFG_STR_LEN]; /* user's handler */
char arg5[CFG_STR_LEN]; /* junk characters */
- struct hostent *he; /* host entry */
- int code;
if (afsmon_debug) {
fprintf(debugFD,"[ %s ] Called, a_line = %s\n",rn, a_line);
return(-1);
}
if (strlen(arg3) > THRESH_VAR_LEN-2) {
- fprintf(stderr,"[%s ] threshold value too long\n");
+ fprintf(stderr,"[%s ] threshold value too long\n", rn);
return(-1);
}
int fromIdx;
int toIdx;
int found;
- int idx; /* index to fs_categories[] */
+ int idx = 0; /* index to fs_categories[] */
int i;
int j;
struct afsmon_hostEntry *curr_host;
struct hostent *he; /* hostentry to resolve host name*/
char *handlerPtr; /* ptr to pass theresh handler string */
- int code; /* error code */
+ int code = 0; /* error code */
int linenum = 0; /* config file line number */
int threshCount; /* count of thresholds for each server */
int error_in_config; /* syntax errors in config file ?? */
arg2,arg3,handlerPtr);
else {
- fprintf(stderr,"[ %s ] Programming error 6\n");
+ fprintf(stderr,"[ %s ] Programming error 6\n", rn);
afsmon_Exit(40);
}
if (code) {
fclose(configFD);
-
+ return(0);
}
/*-----------------------------------------------------------------------
{ /* save_FS_results_inCB() */
static char rn[] = "save_FS_results_inCB"; /* routine name */
- int code; /* return status */
struct afsmon_fs_Results_list *tmp_fslist_item; /* temp fs list item */
struct xstat_fs_ProbeResults *tmp_fsPR; /* temp ptr */
int i;
static char rn[] = "save_FS_data_forDisplay"; /* routine name */
struct fs_Display_Data *curr_fsDataP; /* tmp ptr to curr_fsData*/
struct fs_Display_Data *prev_fsDataP; /* tmp ptr to prev_fsData*/
- struct afsmon_hostEntry *tmp_fsNames;
struct afsmon_hostEntry *curr_host;
static int probes_Received = 0; /* number of probes reveived in
the current cycle. If this is equal to numFS we got all
{ /* save_CM_results_inCB() */
static char rn[] = "save_CM_results_inCB"; /* routine name */
- int code; /* return status */
struct afsmon_cm_Results_list *tmp_cmlist_item; /* temp cm list item */
struct xstat_cm_ProbeResults *tmp_cmPR; /* temp ptr */
int i;
if (afsmon_debug) {
- fprintf(debugFD,"[ %s ] Called, a_newProbeCycle= %d\n",a_newProbeCycle);
+ fprintf(debugFD,"[ %s ] Called, a_newProbeCycle= %d\n",rn, a_newProbeCycle);
fflush(debugFD);
}
if (pValue > tValue) {
if (afsmon_debug) {
- fprintf(debugFD,"[ %s ] cm = %s, thresh ovf for %s, threshold= % s, probevalue= %s\n",
+ fprintf(debugFD,"[ %s ] cm = %s, thresh ovf for %s, threshold= %s, probevalue= %s\n",
rn, a_hostEntry->hostName, threshP->itemName, threshP->threshVal , a_Data->data[idx]);
fflush(debugFD);
}
static char rn[] = "save_CM_data_forDisplay"; /* routine name */
struct cm_Display_Data *curr_cmDataP;
struct cm_Display_Data *prev_cmDataP;
- struct afsmon_hostEntry *tmp_cmNames;
struct afsmon_hostEntry *curr_host;
static int probes_Received = 0; /* number of probes reveived in
the current cycle. If this is equal to numFS we got all
static char rn[] = "afsmon_CM_Handler"; /* routine name */
int code; /* return status */
int newProbeCycle; /* start of new probe cycle ? */
- int i;
if (afsmon_debug) {
fprintf(debugFD,
int CMinitFlags = 0; /* flags for xstat_cm_Init */
int code; /* function return code */
struct timeval tv; /* time structure */
- int i;
if (afsmon_debug) {
fprintf(debugFD,"[ %s ] Called\n",rn);
strncpy(fullhostname,curr_FS->hostName,sizeof(fullhostname));
he = GetHostByName(fullhostname);
if (he == (struct hostent *)0) {
- fprintf(stderr,"[ %s ] Cannot get host info for %s\n",fullhostname);
+ fprintf(stderr,"[ %s ] Cannot get host info for %s\n",rn, fullhostname);
return(-1);
}
strncpy(curr_FS->hostName,he->h_name,HOST_NAME_LEN); /* complete name*/
numCollIDs = 1;
collIDP = (afs_int32 *) malloc (sizeof (afs_int32));
if (collIDP == (afs_int32 *)0) {
- fprintf(stderr,"[ %s ] failed to allocate a measely afs_int32 word.Argh!\n");
+ fprintf(stderr,"[ %s ] failed to allocate a measely afs_int32 word.Argh!\n", rn);
return(-1);
}
*collIDP = 2; /* USE A macro for this */
strncpy(fullhostname,curr_CM->hostName,sizeof(fullhostname));
he = GetHostByName(fullhostname);
if (he == (struct hostent *)0) {
- fprintf(stderr,"[ %s ] Cannot get host info for %s\n",fullhostname);
+ fprintf(stderr,"[ %s ] Cannot get host info for %s\n",rn, fullhostname);
return(-1);
}
strncpy(curr_CM->hostName,he->h_name,HOST_NAME_LEN); /* complete name*/
numCollIDs = 1;
collIDP = (afs_int32 *) malloc (sizeof (afs_int32));
if (collIDP == (afs_int32 *)0) {
- fprintf(stderr,"[ %s ] failed to allocate a measely long word.Argh!\n");
+ fprintf(stderr,"[ %s ] failed to allocate a measely long word.Argh!\n", rn);
return(-1);
}
*collIDP = 2; /* USE A macro for this */
static char rn[] = "afsmonInit"; /* Routine name */
char *debug_filename; /* pointer to debug filename */
- char *config_filename; /* pointer to config filename */
FILE *outputFD; /* output file descriptor */
struct cmd_item *hostPtr; /* ptr to parse command line args */
char buf[256]; /* buffer for processing hostnames */
#include "AFS_component_version_number.c"
-main(argc, argv)
+int main(argc, argv)
int argc;
char **argv;
{ /* main() */
else
afsmon_Exit(2);
+ exit(0); /* redundant, but gets rid of warning */
} /*main*/
/* structures to store info of hosts to be monitored */
-static struct afsmon_hostEntry {
+struct afsmon_hostEntry {
char hostName[HOST_NAME_LEN]; /* fs or cm host name */
int numThresh; /* number of thresholds for this host */
struct Threshold *thresh; /* ptr to threshold entries */
${CC} ${CFLAGS} -c audit.c
clean:
- rm -f *.o core AFS_component_version_number.c
+ rm -f *.o core AFS_component_version_number.c *.a
beancount:
wc -l *.c *.h
install: $(INCFILES) $(LIBFILE)
+install9x: install
+
clean::
+ $(DEL) $(INCFILES)
\ No newline at end of file
#else /* ! AFS_AIX_ENV */
int osi_audit (char *audEvent, afs_int32 errCode, ...)
-{}
+{ return 0; }
int osi_auditU (struct rx_call *call, char *audEvent, int errCode, ...)
-{}
+{ return 0; }
#endif
KOBJS= cellconfig.o ktc.krb.o userok.o writeconfig.o authcon.o \
acfg_errors.o ktc_errors.o # comktc.o comvice.o comauth.o
-CFLAGS=-g -I${SRCDIR}include ${XCFLAGS}
+CFLAGS=-g -I${TOP_SRCDIR}/config -I${SRCDIR}include ${XCFLAGS}
LDIRS=
LIBS= libauth.a ${DESTDIR}lib/afs/libsys.a \
${DESTDIR}lib/librxkad.a ${DESTDIR}lib/libdes.a \
${INSTALL} cellconfig.h ${DESTDIR}include/afs
${INSTALL} keys.h ${DESTDIR}include/afs
+includes: auth.h cellconfig.h keys.h
+ ${INSTALL} auth.h ${DESTDIR}include/afs
+ ${INSTALL} cellconfig.h ${DESTDIR}include/afs
+ ${INSTALL} keys.h ${DESTDIR}include/afs
+
clean:
rm -f *.o *.a copyauth testcellconf setkey auth.h cellconfig.h acfg_errors.c ktc_errors.c core\
AFS_component_version_number.c
$(DESTDIR)\lib\afs\afseventlog.lib \
$(EXELIBDIR)\afs\afsreg.lib
+
$(SETKEY_EXEFILE): $(SETKEY_EXEOBJS) $(EXELIBS)
$(EXECONLINK)
$(EXEPREP)
install: $(INCFILES) $(AFSAUTH_LIBFILE) setkey.exe # $(COPYAUTH_EXEFILE) $(AFSAUTH_KRB_LIBFILE)
+install9x: install
+
clean::
$(DEL) acfg_errors.c ktc_errors.c
$(DEL) $(INCFILEDIR)\auth.h $(INCFILEDIR)\cellconfig.h
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <afs/stds.h>
#include <afs/pthread_glock.h>
#ifdef UKERNEL
#include <netdb.h>
#include <sys/file.h>
#include <sys/time.h>
-#endif
+#ifdef AFS_AFSDB_ENV
+#include <arpa/nameser.h>
+#include <resolv.h>
+#endif /* AFS_AFSDB_ENV */
+#endif /* AFS_NT40_ENV */
#include <errno.h>
#include <ctype.h>
#include <time.h>
/* lookup a service name */
struct servent *ts;
register struct afsconf_servPair *tsp;
+
#if defined(AFS_OSF_ENV) || defined(AFS_DEC_ENV)
ts = getservbyname(aname, "");
#else
/* we found it in /etc/services, so we use this value */
return ts->s_port; /* already in network byte order */
}
+
/* not found in /etc/services, see if it is one of ours */
for(tsp = serviceTable;; tsp++) {
if (tsp->name == (char *) 0) return -1;
return code;
}
+#ifdef AFS_AFSDB_ENV
+afsconf_GetAfsdbInfo(acellName, aservice, acellInfo)
+ char *acellName;
+ char *aservice;
+ struct afsconf_cell *acellInfo;
+{
+ afs_int32 code;
+ int tservice, len, i;
+ unsigned char answer[1024];
+ unsigned char *p;
+ char host[256];
+ int server_num = 0;
+ int minttl = 0;
+
+ /* The resolver isn't always MT-safe.. Perhaps this ought to be
+ * replaced with a more fine-grained lock just for the resolver
+ * operations.
+ */
+ LOCK_GLOBAL_MUTEX
+ len = res_search(acellName, C_IN, T_AFSDB, answer, sizeof(answer));
+ UNLOCK_GLOBAL_MUTEX
+
+ if (len < 0)
+ return AFSCONF_NOTFOUND;
+
+ p = answer + sizeof(HEADER); /* Skip header */
+ code = dn_expand(answer, answer + len, p, host, sizeof(host));
+ if (code < 0)
+ return AFSCONF_NOTFOUND;
+ strncpy(acellInfo->name, host, sizeof(acellInfo->name));
+
+ p += code + QFIXEDSZ; /* Skip name */
+
+ while (p < answer + len) {
+ int type, ttl, size;
+
+ code = dn_expand(answer, answer + len, p, host, sizeof(host));
+ if (code < 0)
+ return AFSCONF_NOTFOUND;
+
+ p += code; /* Skip the name */
+ type = (p[0] << 8) | p[1];
+ p += 4; /* Skip type and class */
+ ttl = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
+ p += 4; /* Skip the TTL */
+ size = (p[0] << 8) | p[1];
+ p += 2; /* Skip the size */
+
+ if (type == T_AFSDB) {
+ struct hostent *he;
+
+ code = dn_expand(answer, answer+len, p+2, host, sizeof(host));
+ if (code < 0)
+ return AFSCONF_NOTFOUND;
+
+ /* Do we want to get TTL data for the A record as well? */
+ he = gethostbyname(host);
+ if (he && server_num < MAXHOSTSPERCELL) {
+ afs_int32 ipaddr;
+ memcpy(&ipaddr, he->h_addr, he->h_length);
+ acellInfo->hostAddr[server_num].sin_addr.s_addr = ipaddr;
+ strncpy(acellInfo->hostName[server_num], host,
+ sizeof(acellInfo->hostName[server_num]));
+ server_num++;
+
+ if (!minttl || ttl < minttl) minttl = ttl;
+ }
+ }
+
+ p += size;
+ }
+
+ if (server_num == 0) /* No AFSDB records */
+ return AFSCONF_NOTFOUND;
+ acellInfo->numServers = server_num;
+
+ if (aservice) {
+ tservice = afsconf_FindService(aservice);
+ if (tservice < 0)
+ return AFSCONF_NOTFOUND; /* service not found */
+ for (i=0; i<acellInfo->numServers; i++) {
+ acellInfo->hostAddr[i].sin_port = tservice;
+ }
+ }
+
+ acellInfo->timeout = minttl ? (time(0) + minttl) : 0;
+
+ return 0;
+}
+#endif /* AFS_AFSDB_ENV */
+
afsconf_GetCellInfo(adir, acellName, aservice, acellInfo)
struct afsconf_dir *adir;
char *aservice;
acellInfo->hostAddr[i].sin_port = tservice;
}
}
+ acellInfo->timeout = 0;
UNLOCK_GLOBAL_MUTEX
return 0;
}
else {
UNLOCK_GLOBAL_MUTEX
+#ifdef AFS_AFSDB_ENV
+ return afsconf_GetAfsdbInfo(acellName, aservice, acellInfo);
+#else
return AFSCONF_NOTFOUND;
+#endif /* AFS_AFSDB_ENV */
}
}
struct afsconf_dir *adir;
struct afsconf_keys *astr;
{
+ register afs_int32 code;
+
LOCK_GLOBAL_MUTEX
- afsconf_Check(adir);
+ code = afsconf_Check(adir);
+ if (code)
+ return AFSCONF_FAILURE;
bcopy(adir->keystr, astr, sizeof(struct afsconf_keys));
UNLOCK_GLOBAL_MUTEX
return 0;
register struct afsconf_key *tk;
register afs_int32 best;
struct afsconf_key *bestk;
+ register afs_int32 code;
LOCK_GLOBAL_MUTEX
- afsconf_Check(adir);
+ code = afsconf_Check(adir);
+ if (code)
+ return AFSCONF_FAILURE;
maxa = adir->keystr->nkeys;
best = -1; /* highest kvno we've seen yet */
{
register int i, maxa;
register struct afsconf_key *tk;
+ register afs_int32 code;
LOCK_GLOBAL_MUTEX
- afsconf_Check(adir);
+ code = afsconf_Check(adir);
+ if (code)
+ return AFSCONF_FAILURE;
maxa = adir->keystr->nkeys;
for(tk = adir->keystr->key,i=0;i<maxa;i++,tk++) {
struct sockaddr_in hostAddr[MAXHOSTSPERCELL]; /*IP addresses for cell's servers*/
char hostName[MAXHOSTSPERCELL][MAXHOSTCHARS]; /*Names for cell's servers*/
char *linkedCell; /* Linked cell name, if any */
+ int timeout; /* Data timeout, if non-zero */
};
struct afsconf_entry {
* Instead of sending the session key in the clear, we zero it,
* and send it later, via RPC, encrypted.
*/
+#ifndef AFS_WIN95_ENV
/*
memcpy(ct.HandShakeKey, &token->sessionKey, sizeof(token->sessionKey));
*/
memset(ct.HandShakeKey, 0, sizeof(ct.HandShakeKey));
+#else
+ memcpy(ct.HandShakeKey, &token->sessionKey, sizeof(token->sessionKey));
+#endif
ct.BeginTimestamp = token->startTime;
ct.EndTimestamp = token->endTime;
if (ct.BeginTimestamp == 0) ct.BeginTimestamp = 1;
memcpy(tp, &uuid, sizeof(uuid));
tp += sizeof(uuid);
+#ifndef AFS_WIN95_ENV
/* RPC to send session key */
status = send_key(uuid, token->sessionKey.data);
if (status != RPC_S_OK) {
else
return KTC_RPC;
}
+#endif /* AFS_WIN95_ENV */
/* set up for pioctl */
iob.in = tbuffer;
return KTC_PIOCTLFAIL;
}
+#ifndef AFS_WIN95_ENV /* get rid of RPC for win95 build */
/* RPC to receive session key */
status = receive_key(uuid, token->sessionKey.data);
if (status != RPC_S_OK) {
else
return KTC_RPC;
}
+#endif /* AFS_WIN95_ENV */
cp = tbuffer;
token->endTime = ct.EndTimestamp;
if (ct.AuthHandle == -1) ct.AuthHandle = 999;
token->kvno = ct.AuthHandle;
+#ifndef AFS_WIN95_ENV
/*
* Session key has already been set via RPC
*/
- /*
+#else
memcpy(&token->sessionKey, ct.HandShakeKey, sizeof(ct.HandShakeKey));
- */
+#endif /* AFS_WIN95_ENV */
token->ticketLen = ticketLen;
if (client) {
strcpy(client->name, cp);
#include <sys/stat.h>
#include <stdlib.h> /* for realpath() */
#include <errno.h>
+#include <string.h>
+#include <ctype.h>
#include <rx/xdr.h>
#include <rx/rx.h>
#include "keys.h"
#include "afs/audit.h"
+afs_int32 afsconf_SuperUser();
#if !defined(UKERNEL)
int afsconf_CheckAuth(adir, acall)
return code;
}
+/* special CompFindUser routine that builds up a princ and then
+ calls finduser on it. If found, returns char * to user string,
+ otherwise returns NULL. The resulting string should be immediately
+ copied to other storage prior to release of mutex. */
+static char *CompFindUser(adir, name, sep, inst, realm)
+ struct afsconf_dir *adir;
+ char *name;
+ char *sep;
+ char *inst;
+ char *realm;
+{
+ static char fullname[ MAXKTCNAMELEN + MAXKTCNAMELEN +
+ MAXKTCREALMLEN + 3 ];
+
+ /* always must have name */
+ if ( !name || !name[0] ) { return NULL; }
+ strcpy(fullname, name);
+
+ /* might have instance */
+ if ( inst && inst[0] ) {
+ if ( !sep || !sep[0] ) { return NULL; }
+
+ strcat(fullname, sep);
+ strcat(fullname, inst);
+ }
+
+ /* might have realm */
+ if ( realm && realm[0] )
+ {
+ strcat(fullname, "@");
+ strcat(fullname, realm);
+ }
+
+ if ( FindUser(adir, fullname) ) {
+ return fullname;
+ } else {
+ return NULL;
+ }
+}
+
+
/* make sure user authenticated on rx call acall is in list of valid
- users.
+ users. Copy the "real name" of the authenticated user into namep
+ if a pointer is passed.
*/
-afsconf_SuperUser(adir, acall, namep)
+afs_int32 afsconf_SuperUser(adir, acall, namep)
struct afsconf_dir *adir;
struct rx_call *acall;
char *namep; {
UNLOCK_GLOBAL_MUTEX
return 0;
}
+
if (afsconf_GetNoAuthFlag(adir)) {
- if (namep) strcpy(namep, "<noauth>");
+ if (namep) strcpy(namep, "<NoAuth>");
UNLOCK_GLOBAL_MUTEX
return 1;
}
+
tconn = rx_ConnectionOf(acall);
code = rx_SecurityClassOf(tconn);
if (code == 0) {
char tname[MAXKTCNAMELEN]; /* authentication from ticket */
char tinst[MAXKTCNAMELEN];
char tcell[MAXKTCREALMLEN];
- char uname[MAXKTCNAMELEN]; /* name.instance */
- int ilen; /* length of instance */
+ char tcell_l[MAXKTCREALMLEN];
+ char *tmp;
+
+ /* keep track of which one actually authorized request */
+ char uname[MAXKTCNAMELEN+MAXKTCNAMELEN+MAXKTCREALMLEN+3];
+
afs_uint32 exp;
- static char localcellname[MAXCELLCHARS] = "";
-#if defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
- static char local_realm[AFS_REALM_SZ] = "";
-#endif
+ static char lcell[MAXCELLCHARS] = "";
+ static char lrealm[AFS_REALM_SZ] = "";
- /* des tokens */
+ /* get auth details from server connection */
code = rxkad_GetServerInfo
- (acall->conn, (afs_int32 *) 0, &exp, tname, tinst, tcell, (afs_int32 *) 0);
+ (acall->conn, (afs_int32 *) 0, &exp,
+ tname, tinst, tcell, (afs_int32 *) 0);
if (code) {
UNLOCK_GLOBAL_MUTEX
- return 0; /* bogus */
- }
-
- if (strlen (tcell)) {
- if (!localcellname[0])
- afsconf_GetLocalCell
- (adir, localcellname, sizeof(localcellname));
-#if defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
- if (!local_realm[0]) {
- if (afs_krb_get_lrealm(local_realm, 0) != 0/*KSUCCESS*/)
- strncpy(local_realm, localcellname, AFS_REALM_SZ);
- }
- if (strcasecmp(local_realm, tcell) &&
- (strcasecmp(localcellname, tcell)))
-#else
- if (strcasecmp(localcellname, tcell))
-#endif
- {
- UNLOCK_GLOBAL_MUTEX
- return 0;
- }
- }
- ilen = strlen(tinst);
- strncpy (uname, tname, sizeof(uname));
- if (ilen) {
- if (strlen(uname) + 1 + ilen >= sizeof(uname)) {
- UNLOCK_GLOBAL_MUTEX
- return 0;
- }
- strcat (uname, ".");
- strcat (uname, tinst);
+ return 0; /* bogus connection/other error */
}
+ /* don't bother checking anything else if tix have expired */
#ifdef AFS_PTHREAD_ENV
if (exp < clock_Sec()) {
#else
UNLOCK_GLOBAL_MUTEX
return 0; /* expired tix */
}
- if (strcmp(AUTH_SUPERUSER, uname) == 0) flag = 1;
- else flag = FindUser(adir, uname); /* true iff in userlist file */
+
+ /* generate lowercased version of cell name */
+ strcpy(tcell_l, tcell);
+ tmp = tcell_l;
+ while ( *tmp ) { *tmp = tolower(*tmp); *tmp++; }
+
+ /* determine local cell name. It's static, so will only get
+ calculated the first time through */
+ if (!lcell[0])
+ afsconf_GetLocalCell(adir, lcell, sizeof(lcell));
+
+ /* if running a krb environment, also get the local realm */
+ /* note - this assumes AFS_REALM_SZ <= MAXCELLCHARS */
+ /* just set it to lcell if it fails */
+ if (!lrealm[0]) {
+ if (afs_krb_get_lrealm(lrealm, 0) != 0) /* KSUCCESS */
+ strncpy(lrealm, lcell, AFS_REALM_SZ);
+ }
+
+
+ /* start with no uname and no authorization */
+ strcpy(uname, "");
+ flag = 0;
+
+ /* localauth special case */
+ if ( strlen(tinst) == 0 && strlen(tcell) == 0 &&
+ !strcmp(tname, AUTH_SUPERUSER) ) {
+ strcpy(uname, "<LocalAuth>");
+ flag = 1;
+
+ /* cell of connection matches local cell or krb4 realm */
+ } else if ( !strcasecmp(tcell, lcell) || !strcasecmp(tcell,lrealm) ) {
+ if ( (tmp = CompFindUser(adir, tname, ".", tinst, NULL)) ) {
+ strcpy(uname, tmp);
+ flag = 1;
+#ifdef notyet
+ } else if ( (tmp = CompFindUser(adir, tname, "/", tinst, NULL)) ) {
+ strcpy(uname, tmp);
+ flag = 1;
+#endif
+ }
+
+ /* cell of conn doesn't match local cell or realm */
+ } else {
+ if ( (tmp = CompFindUser(adir, tname, ".", tinst, tcell)) ) {
+ strcpy(uname, tmp);
+ flag = 1;
+#ifdef notyet
+ } else if ( (tmp = CompFindUser(adir, tname, "/", tinst, tcell)) ) {
+ strcpy(uname, tmp);
+ flag = 1;
+#endif
+ } else if ( (tmp = CompFindUser(adir, tname, ".", tinst, tcell_l)) ) {
+ strcpy(uname, tmp);
+ flag = 1;
+#ifdef notyet
+ } else if ( (tmp = CompFindUser(adir, tname, "/", tinst, tcell_l)) ) {
+ strcpy(uname, tmp);
+ flag = 1;
+#endif
+ }
+ }
+
if (namep)
strcpy(namep, uname);
UNLOCK_GLOBAL_MUTEX
return flag;
}
- else {
+ else { /* some other auth type */
UNLOCK_GLOBAL_MUTEX
return 0; /* mysterious, just say no */
}
${INSTALL} bnode.h ${DESTDIR}include/afs/bnode.h
clean:
- rm -f *.a *.o bos bosserver testproc bosint.cs.c bosint.ss.c bosint.xdr.c bosint.h core\
+ rm -f *.a *.o bos bosserver testproc bosint.cs.c bosint.ss.c bosint.xdr.c bosint.h core boserr.c bnode.h\
AFS_component_version_number.c
test:
/* hack to support help flag */
- printf("Usage: bosserver [-noauth] [-log] "
#ifndef AFS_NT40_ENV
+ printf("Usage: bosserver [-noauth] [-log] "
"[-syslog[=FACILITY]] "
-#endif
- /* "[-enable_peer_stats] [-enable_process_stats] " */
+ "[-enable_peer_stats] [-enable_process_stats] "
"[-help]\n");
+#else
+ printf("Usage: bosserver [-noauth] [-log] "
+ "[-enable_peer_stats] [-enable_process_stats] "
+ "[-help]\n");
+#endif
fflush(stdout);
exit(0);
${INSTALL} backup ${DESTDIR}etc
clean:
- rm -f *.o backup convert *.ss.c *.cs.c *.xdr.c *.a core btest ttest AFS_component_version_number.c
+ rm -f *.o backup convert *.ss.c *.cs.c *.xdr.c *.a core btest ttest AFS_component_version_number.c bc.h bucoord_errs.c
lint:
lint -IDEST/include -IDEST/include/afs *.h *.c
else
{
compactDateString(&volumeLinkPtr->volumeEntry.clone, ds, 50),
- printf("%4d %s %9d %16s\n",
+ printf("%4d %s %10u %16s\n",
volumeLinkPtr->volumeEntry.position,
ds,
volumeLinkPtr->volumeEntry.nBytes,
libcmd64.a: ${LIB64OBJS} AFS_component_version_number64.o
-rm -f libcmd64.a
- ar r libcmd64.a ${LIB64OBJS} AFS_component_version_number64.o
+ $(AR) r libcmd64.a ${LIB64OBJS} AFS_component_version_number64.o
$(RANLIB) libcmd64.a
libcmd.a: ${LIBOBJS} AFS_component_version_number.o
-rm -f libcmd.a
- ar r libcmd.a ${LIBOBJS} AFS_component_version_number.o
+ $(AR) r libcmd.a ${LIBOBJS} AFS_component_version_number.o
$(RANLIB) libcmd.a
kinstall:
install: $(LIBFILE) $(INCFILES)
+install9x: install
clean::
$(DEL) cmd_errors.c
+ $(DEL) $(LIBFILE)
test tests:
# build and install the compile_et executable
COMPILE_ET_EXEFILE = $(DESTDIR)\bin\compile_et.exe
+prep:
+ $(DESTDIR)\bin\touch et_lex.lex_nt.c
+ $(DESTDIR)\bin\touch error_table_nt.c
+ @echo If you update et_lex.lex.l, to build correctly, you should delete error_table_nt.c
+
et_lex.lex_nt.c: et_lex.lex.l
- $(LEX) -t et_lex.lex.l > $@
-
+ $(LEX) -t et_lex.lex.l > $@
+
error_table_nt.c: et_lex.lex_nt.c error_table.y
$(YACC) -d -o $@ error_table.y
$(EXEPREP)
####################################################################
-install: $(INCFILES) $(COMERR_LIBFILE) $(COMPILE_ET_EXEFILE)
+install: prep $(INCFILES) $(COMERR_LIBFILE) $(COMPILE_ET_EXEFILE)
+
+install9x: install
clean::
- $(DEL) *~ \#* *.bak \
+ $(DEL) $(COMERR_LIBFILE)
+ $(DEL) $(COMPILE_ET_EXEFILE)
+ $(DEL) *~ *.bak \
*.otl *.aux *.toc *.PS *.dvi *.x9700 *.ps \
*.cp *.fn *.ky *.log *.pg *.tp *.vr \
et.ar TAGS
*
*/
+#undef MEMORYLEAK
#include <afs/param.h>
#include <stdio.h>
+#include <stdlib.h>
#ifndef AFS_NT40_ENV
#include <sys/file.h>
int version = 1;
int use_msf = 0;
-/* C library */
-#ifndef AFS_NT40_ENV
-extern char *malloc();
-#endif
-
-
/* lex stuff */
extern FILE *yyin;
extern FILE *yyout;
"/*\n * %s:\n * This file is automatically generated; please do not edit it.\n */\n";
static const char msf_warning[] =
- "$\n$ %s:\n$ This file is automatically generated; please do not edit it.\n$\n$set 1\n";
+ "$ \n$ %s:\n$ This file is automatically generated; please do not edit it.\n$ \n$set 1\n";
/* pathnames */
char c_file[MAXPATHLEN]; /* output file */
fputs (" 0\n};\n\n", cfile);
fprintf(cfile,
"static const struct error_table et = { text, %ldL, %d };\n\n",
- table_number, current);
+ (long int) table_number, current);
fputs("static struct et_list etlink = { 0, &et};\n\n", cfile);
fprintf(cfile, "void initialize_%s_error_table (%s) {\n",
table_name, (language == lang_C) ? "void" : "NOARGS");
}
fprintf (hfile, "#define ERROR_TABLE_BASE_%s (%ldL)\n",
- table_name, table_number);
+ table_name, (long int) table_number);
/* compatibility... */
fprintf (hfile, "\n/* for compatibility with older versions... */\n");
fprintf (hfile, "#define init_%s_err_tbl initialize_%s_error_table\n",
}
symbol = (char *)malloc(32 * sizeof(char));
gensym_n++;
- sprintf(symbol, "et%ld", gensym_n);
+ sprintf(symbol, "et%ld", (long int) gensym_n);
return(symbol);
}
for (i = 0; i < current; i++) {
if (error_codes[i] != (char *)NULL)
fprintf(hfile, "#define %-40s (%ldL)\n",
- error_codes[i], table_number + i);
+ error_codes[i], (long int) table_number + i);
}
}
[\t\n\r ] ;
\"{PC}*\" { register char *p; yylval.dynstr = ds((char *)yytext+1);
- if (p=strrchr(yylval.dynstr, '"')) *p='\0';
+ if ((p=strrchr(yylval.dynstr, '"'))) *p='\0';
return QUOTED_STRING;
}
/* A lexical scanner generated by flex */\r
\r
/* Scanner skeleton version:\r
- * $Header: /tmp/cvstemp/openafs/src/comerr/et_lex.lex_nt.c,v 1.1.1.2 2001/01/19 20:54:19 hartmans Exp $\r
+ * $Header: /tmp/cvstemp/openafs/src/comerr/et_lex.lex_nt.c,v 1.1.1.3 2001/07/05 01:02:02 hartmans Exp $\r
*/\r
\r
#define FLEX_SCANNER\r
static yyconst int yy_ec[256] =\r
{ 0,\r
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,\r
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
+ 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,\r
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r
1, 2, 1, 4, 5, 1, 1, 1, 1, 1,\r
1, 1, 1, 1, 1, 1, 1, 6, 6, 6,\r
# kernel include environment. param.h is, well, param.h. The afs_sysnames.h
# file is needed by param.h to create unique identifiers for each SYS_TYPE.
-kinstall: lkversion config $(KDIRS) ${KERNELDIR}/afs/param.h \
+# lkversion
+kinstall: config $(KDIRS) ${KERNELDIR}/afs/param.h \
${KERNELDIR}/afs/stds.h \
${KERNELDIR}/afs/afs_sysnames.h \
${KERNELDIR}/config/Makefile.${SYS_NAME} \
${UKERNELDIR}/afs/AFS_component_version_number.c
clean:
- $(RM) -f *.o config core xprt
+ $(RM) -f *.o config core xprt AFS_component_version_number.c
AFS_component_version_number.o: AFS_component_version_number.c
AFS_component_version_number.c:
- echo 'char cml_version_number[]="@(#) OpenAFS stable 1.0.4 built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c;
- echo 'char* AFSVersion = "openafs stable 1.0.4"; ' >>AFS_component_version_number.c;
+ echo 'char cml_version_number[]="@(#) OpenAFS devel built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c;
+ echo 'char* AFSVersion = "openafs devel"; ' >>AFS_component_version_number.c;
noversion: install
!ERROR Can not find src directory from current directory.
!ENDIF
-
-
INCFILEDIR = $(DESTDIR)\include\afs
INCFILES =\
$(INCFILEDIR)\afs_sysnames.h \
$(INCFILEDIR)\stds.h \
$(INCFILEDIR)\icl.h
-
+\r
$(INCFILEDIR)\param.h: param.$(SYS_NAME).h
$(COPY) $? $@
idirs: doclink
+! IF (!EXIST($(DESTDIR)))
+ $(MKDIR) $(DESTDIR)
+! ENDIF
! IF (!EXIST($(DESTDIR)\include))
$(MKDIR) $(DESTDIR)\include
! ENDIF
! IF (!EXIST($(DESTDIR)\root.server\usr\afs\bin))
$(MKDIR) $(DESTDIR)\root.server\usr\afs\bin
! ENDIF
+! IF (!EXIST($(DESTDIR)\root.client))
+ $(MKDIR) $(DESTDIR)\root.client
+! ENDIF
+! IF (!EXIST($(DESTDIR)\root.client\usr))
+ $(MKDIR) $(DESTDIR)\root.client\usr
+! ENDIF
+! IF (!EXIST($(DESTDIR)\root.client\usr\vice))
+ $(MKDIR) $(DESTDIR)\root.client\usr\vice
+! ENDIF
! IF (!EXIST($(DESTDIR)\root.client\usr\vice\etc))
$(MKDIR) $(DESTDIR)\root.client\usr\vice\etc
! ENDIF
-
+INCCOPY = \\r
+ $(DESTDIR)\bin\rmbat.bat \\r
+ $(DESTDIR)\bin\rmbat.rsp \\r
+ $(DESTDIR)\bin\NTBUILD.bat\r
+\r
+$(DESTDIR)\bin\rmbat.bat:..\rmbat.bat\r
+ $(COPY) $? $@
+ util_cr + $@
+\r
+$(DESTDIR)\bin\rmbat.rsp:..\rmbat.rsp\r
+ $(COPY) $? $@
+\r
+$(DESTDIR)\bin\NTBUILD.bat:..\NTBUILD.bat\r
+ $(COPY) $? $@
+ util_cr + $@
+\r
+$(DESTDIR)\bin\NTLang.bat: NTLang.bat util_cr.exe
+ $(COPY) NTLang.bat $(DESTDIR)\bin
+ util_cr + $(DESTDIR)\bin\NTLang.bat
+\r
+$(DESTDIR)\NTDllmap.txt:NTDllmap.txt\r
+ $(COPY) $? $@
+\r
# Create link to docs needed for media build; allow to fail in case
# symlink not available, e.g. if using a 3.4a client, since most builds
# aren't media builds.
$(COPY) NTMakefile.version-NOCML NTMakefile.version
! ENDIF
-$(DESTDIR)\bin\mkvers.exe: mkvers.exe
- $(COPY) mkvers.exe $(DESTDIR)\bin
-
-
-$(DESTDIR)\NTDllmap.txt: NTDllmap.txt
- $(COPY) NTDllmap.txt $(DESTDIR)
-
-
-$(DESTDIR)\bin\NTLang.bat: NTLang.bat
- $(COPY) NTLang.bat $(DESTDIR)\bin
+INCTOOLS = \\r
+ $(DESTDIR)\bin\mkvers.exe \\r
+ $(DESTDIR)\bin\util_cr.exe \\r
+ $(DESTDIR)\bin\touch.exe\r
+\r
+#mkvers.exe : mkvers.obj
+# $(EXECONLINK)
+\r
+$(DESTDIR)\bin\mkvers.exe:mkvers.exe\r
+ $(COPY) mkvers.exe $(DESTDIR)\bin\.
+
+$(DESTDIR)\bin\util_cr.exe:util_cr.exe\r
+ $(COPY) util_cr.exe $(DESTDIR)\bin\.
+\r
+util_cr.exe : util_cr.obj
+ $(EXECONLINK)
+\r
+$(DESTDIR)\bin\touch.exe:touch.exe\r
+ $(COPY) touch.exe $(DESTDIR)\bin\.
langsetup: $(DESTDIR)\bin\NTLang.bat
+install: idirs $(INCTOOLS) $(INCCOPY) version $(INCFILES) $(DESTDIR)\NTDllmap.txt langsetup
-install: idirs version $(INCFILES) $(DESTDIR)\NTDllmap.txt langsetup
-
+install9x: install
# This clean target must be named something different than the universal
# 'clean' so that the version file can be removed last.
clean_version:
$(DEL) NTMakefile.version
+
+clean::
+ $(DEL) $(DESTDIR)\LIB\*.DLL
+ $(DEL) $(DESTDIR)\bin\mkver.exe\r
+ $(DEL) $(DESTDIR)\bin\touch.exe\r
+ $(DEL) $(DESTDIR)\bin\util_cr.exe\r
+ $(DEL) mkver.exe\r
+ $(DEL) touch.exe\r
+ $(DEL) util_cr.exe
\ No newline at end of file
# Command macros.
COPY = copy
-DEL = del
+DEL = -del
+#DEL = $(DESTDIR)\BIN\rmbat # win 98 must use batch file
MKDIR = mkdir
REN = ren
ECHO = echo
# Common clean target.
# Double colon (::) syntax allows supplemental clean target to be specified.
clean::
- $(DEL) *.obj *.lib *.dll *.exe
- $(DEL) *_component_version_number.*
+ $(DEL) /q *.obj *.lib *.dll *.exe
+ $(DEL) /q *_component_version_number.*
# Common lang target.
# Double colon (::) syntax allows supplemental lang target to be specified.
#define AFSOP_GETIFADDRS 21 /* get machine's ethernet interfaces */
#define AFSOP_ADDCELL2 29 /* 2nd add cell protocol interface */
+#define AFSOP_AFSDB_HANDLER 30 /* userspace AFSDB lookup handler */
/* The range 20-30 is reserved for AFS system offsets in the afs_syscall */
#define AFSCALL_PIOCTL 20
#define SYS_NAME_ID_ncrx86_30 1301
#define SYS_NAME_ID_i386_nt35 1400
+#define SYS_NAME_ID_i386_win95 1401
#define SYS_NAME_ID_i386_linux2 1500
#define SYS_NAME_ID_i386_linux22 1501
#define SYS_NAME_ID_sparc64_linux2 1800
#define SYS_NAME_ID_sparc64_linux22 1801
+#define SYS_NAME_ID_sparc64_linux24 1802
#define SYS_NAME_ID_s390_linux2 1900
#define SYS_NAME_ID_s390_linux22 1901
#endif
#define ROOTINO UFSROOTINO
-#endif _PARAM_SUN4C_51_H_
+#endif /* _PARAM_SUN4C_51_H_ */
#define AFS_XBSD_ENV 1 /* {Free,Open,Net}BSD */
#define AFS_X86_XBSD_ENV 1
+#define AFS_NAMEI_ENV 1 /* User space interface to file system */
+#define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */
#define AFS_FBSD_ENV 1
#define AFS_FBSD40_ENV 1
#define AFS_FBSD42_ENV 1
#define AFS_X86_FBSD42_ENV 1
#define AFS_X86_ENV 1
#define AFS_NONFSTRANS 1
-#define AFS_KERBEROS_ENV
+#define AFS_KERBEROS_ENV 1
#define O_SYNC O_FSYNC
#define FTRUNC O_TRUNC
#define AFS_VFSINCL_ENV 1
#define AFS_GREEDY43_ENV 1
#define AFS_ENV 1
-#define AFS_MINPHYS_ENV 1
-#define CMUSTD_ENV 1
#define AFS_SYSCALL 210
#define AFS_MOUNT_AFS "afs"
#ifndef MOUNT_UFS
-#define MOUNT_UFS 1
+#define MOUNT_UFS "ufs"
#endif
#ifndef MOUNT_AFS
#define AFS_HAVE_FFS 1 /* Use system's ffs. */
#define AFS_HAVE_STATVFS 0 /* System doesn't supports statvfs */
-#define AFS_GCPAGS 1 /* if nonzero, garbage collect PAGs */
-#define AFS_3DISPARES 1 /* Utilize the 3 available disk inode spares */
-#define AFS_USE_GETTIMEOFDAY 1 /* use gettimeofday to implement rx clock */
+#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */
+#define AFS_USE_GETTIMEOFDAY 1 /* use gettimeofday to implement rx clock */
-#if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
-#include <machine/endian.h>
-#if BYTE_ORDER == BIG_ENDIAN
-#define AFSBIG_ENDIAN 1
-#else
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define AFSLITTLE_ENDIAN 1
-#else
-#error machine/endian.h must define BYTE_ORDER!
-#endif
-#endif
-#endif /* ! ASSEMBLER && ! __LANGUAGE_ASSEMBLY__ */
-
-#define NEARINODE_HINT 1 /* hint to ufs module to scatter inodes on disk*/
-#define nearInodeHash(volid, hval) { \
- unsigned char* ts = (unsigned char*)&(volid);\
- for ((hval)=0; ts<(unsigned char*)&(volid)+sizeof(volid);ts++){\
- (hval) *= 173; \
- (hval) += *ts; \
- } \
- }
+#define AFSLITTLE_ENDIAN 1
/* Extra kernel definitions (from kdefs file) */
#ifdef _KERNEL
#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */
#define AFS_SYSCALL 210
-#define AFS_64BIT_IOPS_ENV 1
-#define AFS_NAMEI_ENV 1 /* User space interface to file system */
+#define AFS_NAMEI_ENV 1 /* User space interface to file system */
+#define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */
#include <afs/afs_sysnames.h>
#define AFS_USERSPACE_IP_ADDR 1
-#define RXK_LISTENER_ENV 1
-#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */
-
+#define RXK_LISTENER_ENV 1
+#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */
/* Machine / Operating system information */
#define SYS_NAME "i386_fbsd_42"
#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */
#define AFS_SYSCALL 137
-#define AFS_64BIT_ENV
#define AFS_64BIT_IOPS_ENV 1
#define AFS_NAMEI_ENV 1 /* User space interface to file system */
#include <afs/afs_sysnames.h>
typedef char * caddr_t;
#define pipe(fdp) _pipe(fdp, 4096, _O_BINARY)
+
+#define snprintf _snprintf
#endif /* _PARAM_NT35_H_ */
#define VN_HOLD(vp) VREF(((struct vnode *)(vp)))
#endif
-#endif _PARAM_PPC_DARWIN_H_
+#endif /* _PARAM_PPC_DARWIN_H_ */
#define CMSERVERPREF
#endif
-#endif _PARAM_PPC_DARWIN_H_
+#endif /* _PARAM_PPC_DARWIN_H_ */
#define VN_HOLD(vp) VREF(((struct vnode *)(vp)))
#endif
-#endif _PARAM_PPC_DARWIN_H_
+#endif /* _PARAM_PPC_DARWIN_H_ */
#define CMSERVERPREF
#endif
-#endif _PARAM_PPC_DARWIN_H_
+#endif /* _PARAM_PPC_DARWIN_H_ */
#define AFS_SYSCALL 137
#define AFS_64BIT_IOPS_ENV 1
#define AFS_NAMEI_ENV 1 /* User space interface to file system */
-#include <afs/afs_sysnames.h>
-
-#define AFS_USERSPACE_IP_ADDR 1
-#define RXK_LISTENER_ENV 1
-#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */
-
-
-/* Machine / Operating system information */
-#define SYS_NAME "s390_linux22"
-#define SYS_NAME_ID SYS_NAME_ID_s390_linux22
-#define AFSBIG_ENDIAN 1
-#define AFS_HAVE_FFS 1 /* Use system's ffs. */
-#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */
-#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */
#if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
#include <linux/config.h>
#ifndef CONFIG_S390_LOCAL_APIC
#define CONFIG_S390_LOCAL_APIC
#endif
+#ifndef __SMP__
#define __SMP__
+#endif
#define AFS_GLOBAL_SUNLOCK
#endif
+#if defined(MODULE) && defined(CONFIG_MODVERSIONS)
+#define MODVERSIONS
+#include <linux/modversions.h>
+#endif
+
#endif /* __KERNEL__ && !DUMP_KERNEL*/
+#include <afs/afs_sysnames.h>
+
+#define AFS_USERSPACE_IP_ADDR 1
+#define RXK_LISTENER_ENV 1
+#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */
+
+/* Machine / Operating system information */
+#define SYS_NAME "s390_linux22"
+#define SYS_NAME_ID SYS_NAME_ID_s390_linux22
+#define AFSBIG_ENDIAN 1
+#define AFS_HAVE_FFS 1 /* Use system's ffs. */
+#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */
+#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */
+
#ifdef KERNEL
#ifndef MIN
#define MIN(A,B) ((A) < (B) ? (A) : (B))
#define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KM_NOSLEEP)
#define AFS_KFREE kmem_free
#define VATTR_NULL vattr_null
-#endif KERNEL
+#endif /* KERNEL */
#define AFS_DIRENT
#ifndef CMSERVERPREF
#define CMSERVERPREF
#endif
#define ROOTINO UFSROOTINO
-#endif _PARAM_SUN4C_51_H_
+#endif /* _PARAM_SUN4C_51_H_ */
#endif
#define ROOTINO UFSROOTINO
-#endif _PARAM_SUN4C_51_H_
+#endif /* _PARAM_SUN4C_51_H_ */
#define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KM_NOSLEEP)
#define AFS_KFREE kmem_free
#define VATTR_NULL vattr_null
-#endif KERNEL
+#endif /* KERNEL */
#define AFS_DIRENT
#ifndef CMSERVERPREF
#define CMSERVERPREF
#endif
#define ROOTINO UFSROOTINO
-#endif _PARAM_SUN4X_56_H_
+#endif /* _PARAM_SUN4X_56_H_ */
#endif
#define ROOTINO UFSROOTINO
-#endif _PARAM_SUN4C_51_H_
+#endif /* _PARAM_SUN4C_51_H_ */
#define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KM_NOSLEEP)
#define AFS_KFREE kmem_free
#define VATTR_NULL vattr_null
-#endif KERNEL
+#endif /* KERNEL */
#define AFS_DIRENT
#ifndef CMSERVERPREF
#define CMSERVERPREF
#endif
#define ROOTINO UFSROOTINO
-#endif _PARAM_SUN4X_57_H_
+#endif /* _PARAM_SUN4X_57_H_ */
#endif
#define ROOTINO UFSROOTINO
-#endif _PARAM_SUN4C_51_H_
+#endif /* _PARAM_SUN4C_51_H_ */
#define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KM_NOSLEEP)
#define AFS_KFREE kmem_free
#define VATTR_NULL vattr_null
-#endif KERNEL
+#endif /* KERNEL */
#define AFS_DIRENT
#ifndef CMSERVERPREF
#define CMSERVERPREF
#endif
#define ROOTINO UFSROOTINO
-#endif _PARAM_SUN4X_58_H_
+#endif /* _PARAM_SUN4X_58_H_ */
#endif
#define ROOTINO UFSROOTINO
-#endif _PARAM_SUN4X_58_H_
+#endif /* _PARAM_SUN4X_58_H_ */
#define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KM_NOSLEEP)
#define AFS_KFREE kmem_free
#define VATTR_NULL vattr_null
-#endif KERNEL
+#endif /* KERNEL */
#define AFS_DIRENT
#ifndef CMSERVERPREF
#define CMSERVERPREF
#define ROOTINO UFSROOTINO
-#endif _PARAM_SUN4C_51_H_
+#endif /* _PARAM_SUN4C_51_H_ */
all: dlog dpass
clean:
- rm -f adkint.h adkint.cs.c adkint.ss.c adkint.xdr.c *.o dlog
+ rm -f adkint.h adkint.cs.c adkint.ss.c adkint.xdr.c *.o dlog dpass AFS_component_version_number.c
adkint.cs.o: adkint.cs.c
adkint.xdr.o: adkint.xdr.c adkint.h
GPROF =
# by default do not try to hide entry points
F_CC = -c ${GPROF} ${DBG} ${XCFLAGS}
-F_CPP = -I${K_INC} -I.
-MK_STR = " \$${CC} -I\$${SRC} \$${F_CPP} \$${F_CC}"
+F_CPP = -I${K_INC} -I. -I${TOP_SRCDIR}/config
+MK_STR = " \$${CC} -I\$${SRC} \$${F_CPP} \$${F_CC}" -I${TOP_SRCDIR}/config
LDFLAGS = ${XLDFLAGS}
# dont use optimizer, since it pessimizes on uvax2,
make_p_table \
make_s_table \
make_odd \
- make_e \
make_p \
make_s \
make_fp \
- make_ip \
- misc
+ make_ip
+
+XGPROGS = \
+ misc \
+ make_e
# Library component lists.
all: ${GFILES} ${CFILES} ${DEP_LIBS}
+gprogs: ${GPROGS}
+
test:
cd test; $(MAKE)
${INSTALL} $? $@
install install.noversion: all ukinstall ${DESTDIR}lib/libdes.a
- ${INSTALL} des.h des_conf.h mit-cpyright.h ${DESTDIR}include
+ ${INSTALL} des.h des_conf.h mit-cpyright.h crypt.h ${DESTDIR}include
${INSTALL} odd.h ${DESTDIR}include/des_odd.h
clean:
- rm -f ${OBJECTS} ${DEP_LIBS} ${PROGS} ${GPROGS} ${GFILES} AFS_component_version_number.c
+ rm -f ${OBJECTS} ${DEP_LIBS} ${PROGS} ${GPROGS} ${GFILES} AFS_component_version_number.c misco.c
rm -f *.s *.o *.b core *~ *.com *.ld
rm -f tags TAGS ${LLIB}
strng_to_key.o: mit-cpyright.h
strng_to_key.o: des_conf.h ./odd.h
debug_decl.o: debug_decl.c
+make_e.o: make_e.c
make_keyperm.o:
${CC} -I${SRC} ${F_CPP} ${F_CC} ${SRC}/make_keyperm.c
make_ip.o:
${CC} -I${SRC} ${F_CPP} ${F_CC} ${SRC}/key_test.c
testit.o:
${CC} -I${SRC} ${F_CPP} ${F_CC} ${SRC}/testit.c
+crypt.o:
+ ${CC} -I${SRC} ${F_CPP} ${F_CC} ${SRC}/crypt.c
des.o:
${CC} -I${SRC} ${F_CPP} ${F_CC} ${SRC}/des.c
cbc_encrypt.o:
${CC} -I${SRC} ${F_CPP} ${F_CC} ${SRC}/strng_to_key.c
debug_decl.o:
${CC} -I${SRC} ${F_CPP} ${F_CC} ${SRC}/debug_decl.c
+make_e.o:
+ ${CC} -I${SRC} ${F_CPP} ${F_CC} ${SRC}/make_e.c
# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY (see make depend above)
$(EXECONLINK)
install: $(GENERATED_FILES) $(LIBFILE) $(INCFILES)
+
+install9x: install
+
+clean::
+ $(DEL) $(LIBFILE)
\ No newline at end of file
*/
#include <afs/param.h>
+#include <afsconfig.h>
#ifdef vax
#include "conf-bsdvax.h"
#else
#ifdef AFS_NT40_ENV
#include "conf-winnt.h"
#else
-#ifdef AFS_LINUX20_ENV
+#if defined(AFS_LINUX20_ENV) || defined(AFS_DJGPP_ENV)
#ifdef AFS_PPC_LINUX20_ENV
#include "conf-ppc-linux.h"
#else
#include <afs/param.h>
#include <mit-cpyright.h>
#include <stdio.h>
-#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
-#include <string.h>
-#else
+#if defined(HAVE_STRINGS_H)
#include <strings.h>
#endif
+#if defined(HAVE_STRING_H)
+#include <string.h>
+#endif
#include <des.h>
#include "des_internal.h"
#include <windows.h>
#endif
#include <stdlib.h>
+#if defined(HAVE_STRINGS_H)
+#include <strings.h>
+#endif
+#if defined(HAVE_STRING_H)
#include <string.h>
+#endif
/*
* UNIX password, and DES, encryption.
static unsigned char S[8][64] = { /* 48->32 bit substitution tables */
/* S[1] */
- 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
+{ 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
- 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13,
+ 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13, },
/* S[2] */
- 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
+{ 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
- 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9,
+ 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9, },
/* S[3] */
- 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
+{ 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
- 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12,
+ 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12, },
/* S[4] */
- 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
+{ 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
- 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14,
+ 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14, },
/* S[5] */
- 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
+{ 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
- 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3,
+ 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3, },
/* S[6] */
- 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
+{ 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
- 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13,
+ 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13, },
/* S[7] */
- 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
+{ 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
- 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12,
+ 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12, },
/* S[8] */
- 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
+{ 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
- 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11,
+ 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11, }
};
static unsigned char P32Tr[] = { /* 32-bit permutation function */
/*
* "setkey" routine (for backwards compatibility)
*/
+#if 0 /* static and doesn't appear to be referenced */
STATIC
int setkey(key)
register const char *key;
}
return (des_setkey((char *)keyblock.b));
}
+#endif
/*
* "encrypt" routine (for backwards compatibility)
*/
-encrypt(block, flag)
+int encrypt(block, flag)
register char *block;
int flag;
{
for (j = 0; j < 64; j++) {
fprintf(stream,"\n");
for (k = 0; k < 4; k++) {
- fprintf(stream,"0x%08X",P_prime[i][j*4+k]);
+ fprintf(stream,"0x%08lX",P_prime[i][j*4+k]);
if ((j == 63) && (k == 3))
fprintf(stream, "}");
if ((i == 3) && (j == 63) && (k == 3))
n = swap_four_bits_to_ansi(m);
if (des_debug)
fprintf(stderr,
- "i = %d, j = %d, k = %d, l = %d, m = %d, n = %d\n",
+ "i = %ld, j = %ld, k = %ld, l = %ld, m = %ld, n = %ld\n",
i,j,k,l,m,n);
temp[i][j] = n;
}
#include <mit-cpyright.h>
#include <afs/param.h>
+#include <des.h>
+#include "des_internal.h"
#ifdef AFS_PTHREAD_ENV
#include <pthread.h>
#endif
+#if defined(HAVE_STRINGS_H)
+#include <strings.h>
+#endif
+#if defined(HAVE_STRING_H)
#include <string.h>
-#include <des.h>
-#include "des_internal.h"
+#endif
#include "stats.h"
extern void des_fixup_key_parity();
*
* 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)
+#if !defined(BSDUNIX) && !defined(AFS_SGI_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_DJGPP_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)
+#if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_ENV)
seed.host_id = gethostid();
#endif
seed.process_id = getpid();
z = ((x * x) + (x2 * x2)) % 0x7fffffff;
z2 = (x * (x2+83653421)) % 0x7fffffff; /* modulo */
if (des_debug & 8)
- printf("%d %d\n",z,z2);
+ printf("%ld %ld\n",z,z2);
}
if (out != NULL) {
#include "conf.h"
#include <stdio.h>
-
-#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
-#include <string.h>
-#else
+#if defined(HAVE_STRINGS_H)
#include <strings.h>
#endif
+#if defined(HAVE_STRING_H)
+#include <string.h>
+#endif
#ifdef BSDUNIX
#ifdef AFS_SUN5_ENV
#define BSD_COMP
#endif
-#if defined(AFS_FBSD_ENV)
-#define USE_OLD_TTY
-#endif
#include <sys/ioctl.h>
#include <signal.h>
#include <setjmp.h>
#endif
-#if defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#ifdef HAVE_SIGNAL_H
#include <signal.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
static int intrupt;
#endif
-#if defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)
+#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-#include <termios.h>
-#endif
-#ifdef AFS_NT40_ENV
+#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
static int intrupt;
-#if defined(AFS_SGI_ENV) || defined (AFS_AIX_ENV) /*|| defined (AFS_HPUX_ENV) || defined(AFS_SUN5_ENV)*/
+#if defined(AFS_SGI_ENV) || defined (AFS_AIX_ENV) || defined(AFS_FBSD_ENV) /*|| defined (AFS_HPUX_ENV) || defined(AFS_SUN5_ENV)*/
#undef BSDUNIX
#endif
struct sigaction newsig, oldsig;
struct termios save_ttyb, ttyb;
#endif
-#if defined(AFS_DARWIN_ENV)
+#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
FILE *fi;
#endif
#if defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)
if (!ok)
bzero(s, maxa);
printf("\n");
-#ifdef AFS_HPUX_ENV
+#if defined(AFS_HPUX_ENV) || defined(AFS_FBSD_ENV)
/*
* Restore the terminal to its previous characteristics.
* Restore the old signal handler for SIGINT.
#include <mit-cpyright.h>
#include <stdio.h>
-#include <string.h>
#include <afs/param.h>
#include <des.h>
#include "des_internal.h"
+#if defined(HAVE_STRINGS_H)
+#include <strings.h>
+#endif
+#if defined(HAVE_STRING_H)
+#include <string.h>
+#endif
extern int des_debug;
extern int des_debug_print();
if (des_debug)
fprintf(stdout,
- "\nResulting string_to_key = 0x%x 0x%x\n",
+ "\nResulting string_to_key = 0x%lx 0x%lx\n",
*((afs_uint32 *) key),
*((afs_uint32 *) key+1));
}
* -1 ==> error
*/
-#ifndef lint
-static char rcsid_key_test_c[] =
-#endif lint
-
#include <mit-cpyright.h>
#include <stdio.h>
#include <errno.h>
* -1 ==> error
*/
-#ifndef lint
-static char rcsid_testit_c[] =
-#endif lint
-
#include <mit-cpyright.h>
#include <stdio.h>
#include <errno.h>
* -1 ==> error
*/
-#ifndef lint
-static char rcsid_verify_c[] =
-#endif lint
-
#include <mit-cpyright.h>
#include <stdio.h>
#include <errno.h>
* Originally written 8/85 by Steve Miller, MIT Project Athena.
*/
-#include <string.h>
#include <des.h>
#include "des_internal.h"
+#if defined(HAVE_STRINGS_H)
+#include <strings.h>
+#endif
+#if defined(HAVE_STRING_H)
+#include <string.h>
+#endif
/*
* The following are the weak DES keys:
install: $(LIBFILES) $(INCFILES)
clean::
+ $(DEL) $(DESPAR)\lib\afsdes.lib
\ No newline at end of file
UKERNELDIR = ../libuafs/
MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
-INCDIRS= -I${DESTDIR}include ${XINCLS}
+INCDIRS= -I${TOP_SRCDIR}/config -I${DESTDIR}include ${XINCLS}
CFLAGS = ${OPTMZ} ${INCDIRS} ${XCFLAGS}
OBJS=buffer.o dir.o salvage.o
#include <afs/vlserver.h>
#include <afs/pterror.h>
#include <afs/bnode.h>
+#include <afs/volser.h>
#include <ubik.h>
#ifdef AFS_AIX32_ENV
#include <signal.h>
#include "AFS_component_version_number.c"
+int
main (argc, argv)
int argc;
char *argv[];
code = atoi(argv[i]);
offset = code & ((1<<ERRCODE_RANGE)-1);
- printf ("%d (%s).%d = %s\n", code, error_table_name (code), offset,
+ printf ("%d (%s).%d = %s\n", (int) code, error_table_name (code), (int) offset,
error_message (code));
}
return 0;
libafsint.a: ${OBJS} AFS_component_version_number.o
-rm -f $@
- ar rv $@ ${OBJS} AFS_component_version_number.o
+ $(AR) rv $@ ${OBJS} AFS_component_version_number.o
$(RANLIB) $@
afsaux.o: afsaux.c afsint.h
${INSTALL} afscbint.h ${DESTDIR}include/afs
clean:
- rm -f *.o *.cs.c *.ss.c *.er.c afsint.h afsint.xdr.c libafsint.a $(KDSRCS) core AFS_component_version_number.c
+ rm -f *.o *.cs.c *.ss.c *.er.c afsint.h afsint.xdr.c libafsint.a $(KDSRCS) core AFS_component_version_number.c afscbint.xdr.c
# directory or online at http://www.openafs.org/dl/license10.html
!INCLUDE ..\config\NTMakefile.$(SYS_NAME)
+!IF (EXIST(..\config\NTMakefile.version))
!INCLUDE ..\config\NTMakefile.version
+!ENDIF
# Definitions for installing header files
install: $(LIBFILE) $(INCFILES) $(MT_LIBFILE)
+install9x: install
+
clean::
$(DEL) *.cs.c *.ss.c *.xdr.c afsint.h afscbint.h
cd test; $(MAKE)
clean:
- rm -f *.o kaserver kas klog multiklog kpasswd klogin rebuild kauth.cs.c kauth.ss.c kauth.xdr.c kauth.h kautils.h kaerrors.c *.a core kpwvalid AFS_component_version_number.c
+ rm -f *.o kaserver kas klog multiklog kpasswd klogin rebuild kauth.cs.c kauth.ss.c kauth.xdr.c kauth.h kautils.h kaerrors.c *.a core kpwvalid AFS_component_version_number.c klog.krb knfs klogin.krb kdb Kkauth.xdr.c Kkauth.h
kaserver: kautils.o kalocalcell.o kadatabase.o kaprocs.o kalog.o kauth.ss.o kauth.xdr.o kaserver.o kaaux.o krb_udp.o kaauxdb.o $(LIBS) ${auditlib}
${CC} ${LDFLAGS} -o kaserver kaserver.o kautils.o kalocalcell.o kadatabase.o krb_udp.o kaprocs.o kalog.o kauth.ss.o kauth.xdr.o kaaux.o kaauxdb.o $(LIBS) ${XLIBS} ${auditlib}
# Override default definitions in NTMakefile.$(SYS_NAME) before including.
!INCLUDE ..\config\NTMakefile.$(SYS_NAME)
-!INCLUDE ..\config\NTMakefile.version
+!include ..\config\NTMakefile.version
############################################################################
kpwvalid.exe rebuild.exe \
$(DESTDIR)\etc\kas.exe
+install9X: $(INCFILES) $(KAUTH_LIBFILE) $(KAUTH_KRB_LIBFILE) \
+ $(KPASSWD_EXEFILE)
+
# installation targets that depend on local targets
$(DESTDIR)\etc\kas.exe: $(DESTDIR)\root.server\usr\afs\bin\kas.exe
$(COPY) $(DESTDIR)\root.server\usr\afs\bin\kas.exe \
# Local clean target; augments predefined clean target
clean::
-
+ $(DEL) $(KPASSWD_EXEFILE)
if (as->parms[3].items)
sscanf (as->parms[3].items->data, "%d", &kvno);
+#ifdef AFS_S390_LINUX20_ENV
+ code = ubik_Call (KAM_SetPassword, conn, 0, name, instance, kvno, 0, key);
+#else
code = ubik_Call (KAM_SetPassword, conn, 0, name, instance, kvno, key);
+#endif
if (code) com_err (whoami, code,
"so can't set password for %s.%s", name, instance);
return code;
afs_int32 code;
LOCK_GLOBAL_MUTEX
+#ifdef AFS_S390_LINUX20_ENV
+ code = ubik_Call_New (KAM_SetPassword, conn, 0, name,
+ instance, 0, 0, *newkey);
+#else
code = ubik_Call_New (KAM_SetPassword, conn, 0, name,
instance, 0, *newkey);
+#endif
UNLOCK_GLOBAL_MUTEX
return code;
}
static struct afsconf_dir *conf = 0;
static char cell_name[MAXCELLCHARS];
-int ka_CellConfig (char *dir)
+int ka_CellConfig (const char *dir)
{
int code;
#ifdef UKERNEL
char cell[MAXKTCREALMLEN]
);
+#ifdef _MFC_VER
+extern "C" {
+#endif /* _MFC_VER */
extern afs_int32 ka_Init(
int flags
);
+#ifdef _MFC_VER
+}
+#endif /* _MFC_VER */
extern int ka_CellConfig (
- char *dir
+ const char *dir
);
extern char *ka_LocalCell (
#include <sys/types.h>
#ifdef AFS_NT40_ENV
#include <winsock2.h>
+#define snprintf _snprintf
#else
#include <sys/socket.h>
#include <netdb.h>
ka_ConvertBytes (key, sizeof(key), (char *)&entryp->key,
sizeof(entryp->key));
- fprintf(out, " -initial_password foo\n", key);
+ fprintf(out, " -initial_password foo\n");
strcpy(flags,"");
if (entryp->flags & KAFADMIN) strcat(flags, "+ADMIN");
install: $(LIBFILE)
-clean::
+install9x: install
+clean::
+ $(DEL) $(INCFILES)
############################################################################
# Auxiliary build targets not built by default; e.g. test programs
system install:
${INSTALL} afs_Admin.h ${DESTDIR}include/afs
+clean:
+
# directory or online at http://www.openafs.org/dl/license10.html
!include ..\config\NTMakefile.$(SYS_NAME)
-
!include ..\config\NTMakefile.version
INCFILEDIR = $(DESTDIR)\include\afs
install: $(INCFILES)
+install9x: install
+
+clean::
+ $(DEL) $(INCFILES)
* Translate the error
*/
- (error_init_done || pthread_once(&error_init_once, init_once));
+ if ( !error_init_done )
+ pthread_once(&error_init_once, init_once);
code = (afs_int32) errorCode;
*errorTextP = error_message(code);
rc = 1;
}
rc = 1;
-fail_GetDatabaseServerRPC:
-
if (st != NULL) {
*st = tst;
}
afs_admin_iterator_p iter = (afs_admin_iterator_p) malloc(sizeof(afs_admin_iterator_t));
database_server_get_p serv = (database_server_get_p) calloc(1, sizeof(database_server_get_t));
char copyCell[MAXCELLCHARS];
- int mutex_inited = 0;
/*
* Validate arguments
int rc = 0;
afs_status_t tst = 0;
afs_admin_iterator_p iter = (afs_admin_iterator_p) iterationId;
- int iter_locked = 0;
if (iter == NULL) {
tst = ADMITERATORNULL;
int rc = 0;
afs_status_t tst = 0;
int mutex_inited = 0;
- int attr_inited = 0;
int add_item_cond_inited = 0;
int remove_item_cond_inited = 0;
int rc = 0;
afs_status_t tst = 0;
rpc_stat_get_p t = (rpc_stat_get_p) rpc_specific;
- afs_uint32 index = t->index;
t->stats[slot].clientVersion = t->clientVersion;
t->stats[slot].serverVersion = t->serverVersion;
int rc = 0;
afs_status_t tst = 0;
int code;
- int len;
if (handle == NULL) {
tst = ADMRXDEBUGHANDLENULL;
int rc = 0;
afs_status_t tst = 0;
struct rx_debugStats tstats;
- int code;
if (handle == NULL) {
tst = ADMRXDEBUGHANDLENULL;
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <stdlib.h>
#ifdef AFS_NT40_ENV
#include <io.h>
+#else
+#include <unistd.h>
#endif
int rc = 0;
afs_status_t tst = 0;
key_get_p key = (key_get_p) rpc_specific;
- char *ptr = (char *) &key->key[slot];
struct bozo_keyInfo keyInfo;
tst = BOZO_ListKeys(key->server, key->next++,
}
if ((time.mask & BOS_RESTART_TIME_HOUR) &&
- (time.hour < 0) || (time.hour > 23)) {
+ ((time.hour < 0) || (time.hour > 23))) {
tst = ADMBOSHOURINVALID;
goto fail_bos_ExecutableRestartTimeSet;
}
if ((time.mask & BOS_RESTART_TIME_MINUTE) &&
- (time.min < 0) || (time.min > 60)) {
+ ((time.min < 0) || (time.min > 60))) {
tst = ADMBOSMINUTEINVALID;
goto fail_bos_ExecutableRestartTimeSet;
}
if ((time.mask & BOS_RESTART_TIME_SECOND) &&
- (time.sec < 0) || (time.sec > 60)) {
+ ((time.sec < 0) || (time.sec > 60))) {
tst = ADMBOSSECONDINVALID;
goto fail_bos_ExecutableRestartTimeSet;
}
if ((time.mask & BOS_RESTART_TIME_DAY) &&
- (time.day < 0) || (time.day > 6)) {
+ ((time.day < 0) || (time.day > 6))) {
tst = ADMBOSDAYINVALID;
goto fail_bos_ExecutableRestartTimeSet;
}
int rc = 0;
afs_status_t tst = 0;
bos_server_p b_handle = (bos_server_p) serverHandle;
- struct rx_call *tcall;
+ struct rx_call *tcall = NULL;
afs_int32 error;
char buffer;
int have_call = 0;
int have_volume = 0;
unsigned int part = 0;
int try_to_stop_fileserver = 0;
- int stopped_fileserver = 0;
bos_ProcessType_t procType;
bos_ProcessInfo_t procInfo;
FILE *log = NULL;
goto fail_bos_Salvage;
}
- while (poll_rc = bos_ProcessInfoGet(serverHandle, "salvage-tmp", &procType,
- &procInfo, &tst)) {
+ while ((poll_rc = bos_ProcessInfoGet(serverHandle, "salvage-tmp", &procType,
+ &procInfo, &tst))) {
sleep(5);
}
#include <afs/venus.h>
#include <errno.h>
#include <strings.h>
+#include <unistd.h>
#endif
#include <string.h>
#include <afs/kautils.h>
goto fail_afsclient_LocalCellGet;
}
- if (tst = afsconf_GetLocalCell(tdir, cellName, MAXCELLCHARS)) {
+ if ((tst = afsconf_GetLocalCell(tdir, cellName, MAXCELLCHARS))) {
goto fail_afsclient_LocalCellGet;
}
goto fail_afsclient_MountPointCreate;
}
#else
- if (tst = symlink(space, directory)) {
+ if ((tst = symlink(space, directory))) {
goto fail_afsclient_MountPointCreate;
}
#endif
char *ptr;
Acl_t cur_acl;
char cur_user[64];
- int cur_user_acl;
+ int cur_user_acl = 0;
int i;
char tmp[64+35];
int is_dfs;
* file.
*/
- is_dfs = sscanf(old_acl_string, "%d dfs:%d %s", &cur_acl.nplus, &cur_acl.dfs, &cur_acl.cell);
+ is_dfs = sscanf(old_acl_string, "%d dfs:%d %s", &cur_acl.nplus, &cur_acl.dfs, cur_acl.cell);
ptr = strchr(old_acl_string, '\n');
ptr++;
sscanf(ptr, "%d", &cur_acl.nminus);
*/
for(i=0;i<(cur_acl.nplus + cur_acl.nminus);i++) {
- sscanf(ptr, "%s%d\n", &cur_user, &cur_user_acl);
+ sscanf(ptr, "%s%d\n", cur_user, &cur_user_acl);
/*
* Skip the entry for the user we are replacing/adding
*/
int rc = 0;
afs_status_t tst = 0;
- (client_init || pthread_once(&client_init_once, client_once));
+ if ( !client_init )
+ pthread_once(&client_init_once, client_once);
#ifdef AFS_NT40_ENV
if (afs_winsockInit() < 0) {
goto fail_afsclient_Init;
}
- if (tst = ka_CellConfig((char *)AFSDIR_CLIENT_ETC_DIRPATH)) {
+ if ((tst = ka_CellConfig((char *)AFSDIR_CLIENT_ETC_DIRPATH))) {
goto fail_afsclient_Init;
}
}
rc = 1;
-fail_GetServerRPC:
-
if (st != NULL) {
*st = tst;
}
int rc = 0;
afs_status_t tst = 0;
principal_get_p prin = (principal_get_p) rpc_specific;
- kas_identity_p who = (kas_identity_p) dest;
memcpy(dest, &prin->principal[slot], sizeof(kas_identity_t));
rc = 1;
int rc = 0;
afs_status_t tst = 0;
afs_admin_iterator_p iter = (afs_admin_iterator_p) iterationId;
- int locked_iter = 0;
/*
* Validate arguments
int was_spare;
char spare_bytes[4] = {0,0,0,0};
int somethings_changing = 0;
- int have_got_current_flag = 0;
/*
* Validate input arguments.
#include <afs/afs_Admin.h>
#include <time.h>
#ifdef AFS_NT40_ENV
+#ifndef _MFC_VER
#include <winsock2.h>
+#endif /* _MFC_VER */
#endif
#define KAS_MAX_NAME_LEN 64
}
printf("\n");
- printf("RPC stats are version %d\n", version);
+ printf("RPC stats are version %d\n", (int) version);
printf("\n");
exit(0);
include ../../config/Makefile.${SYS_NAME}
CC = ${MT_CC}
-CFLAGS = ${OPTMZ} ${DBG} -I${SRCDIR}include ${MT_CFLAGS}
+CFLAGS = ${OPTMZ} ${DBG} -I${TOP_SRCDIR}/config -I${SRCDIR}include ${MT_CFLAGS}
CCRULE = ${CC} ${CFLAGS} -c $?
VLSERVER = ../../vlserver/
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <afs/stds.h>
#include <stdio.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
+#include <ctype.h>
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#include <io.h>
#else
#include <sys/types.h>
#include <sys/socket.h>
+#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
int rc = 0;
afs_status_t tst = 0;
vldb_entry_get_p entry = (vldb_entry_get_p) rpc_specific;
- int index = entry->index;
/*
* Copy the next entry into the cache
afs_admin_iterator_p iter = (afs_admin_iterator_p) malloc(sizeof(afs_admin_iterator_t));
vldb_entry_get_p entry = (vldb_entry_get_p) calloc(1, sizeof(vldb_entry_get_t));
struct VldbListByAttributes attr;
- afs_int32 nentries = 0;
attr.Mask = 0;
memset(&attr, 0, sizeof(attr));
rc = 1;
-fail_copyvolintXInfo:
-
if (st != NULL) {
*st = tst;
}
int rc = 0;
afs_status_t tst = 0;
volume_get_p entry = (volume_get_p) rpc_specific;
- int index = entry->index;
/*
* Copy the next entry into the cache
#include <afs/afs_Admin.h>
#include <sys/types.h>
#ifdef AFS_NT40_ENV
+#ifndef _MFC_VER
#include <winsock2.h>
+#endif /* _MFC_VER */
#else
#include <sys/socket.h>
#endif
*/
#include "lockprocs.h"
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
/* Finds an index in VLDB entry that matches the volume type, server, and partition.
* If type is zero, will match first index of ANY type (RW, BK, or RO).
afs_int32 type)
{
int e;
- afs_int32 error = 0;
e = FindIndex(cellHandle, entry, oserver, opart, type);
if (e == -1)
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <sys/types.h>
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#include "vsprocs.h"
#include "lockprocs.h"
#include <afs/afs_AdminErrors.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
/*
* Functions that aren't prototyped, but that we use
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <afs/stds.h>
#include <afs/afs_Admin.h>
#include <afs/vlserver.h>
#include "../adminutil/afs_AdminInternal.h"
#include <afs/afs_AdminErrors.h>
#include "afs_vosAdmin.h"
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifdef AFS_NT40_ENV
#include <io.h>
#endif
-static GroupEntries();
+static afs_int32 GroupEntries();
struct release {
afs_int32 time;
afs_status_t tst = 0, temp = 0;
afs_int32 ttid = 0, btid = 0;
afs_int32 backupID;
- afs_int32 code = 0, rcode = 0;
+ afs_int32 rcode = 0;
char vname[VOLSER_MAXVOLNAME +1];
struct nvldbentry entry;
- afs_int32 error = 0;
int vldblocked = 0, vldbmod = 0, backexists = 1;
struct rx_connection *aconn = UV_Bind(cellHandle, aserver,
AFSCONF_VOLUMEPORT);
#define ONERROR(ec, ep, es) if (ec) { fprintf(STDERR, (es), (ep)); error = (ec); goto rfail; }
#define ERROREXIT(ec) { error = (ec); goto rfail; }
+#if 0 /* doesn't appear to be used, why compile it */
static int CloneVol (
afs_cell_handle_p cellHandle,
struct rx_connection *conn,
}
return rc;
}
+#endif
/* Get a "transaction" on this replica. Create the volume
* if necessary. Return the time from which a dump should
}
-static int rel_compar (
- struct release *r1,
- struct release *r2)
-{
- return (r1->time - r2->time);
-}
-
/* VolumeExists()
* Determine if a volume exists on a server and partition.
* Try creating a transaction on the volume. If we can,
afs_status_p st)
{
int rc = 0;
- afs_status_t tst = -1;
+ afs_status_t tst = 0;
struct rx_connection *conn=(struct rx_connection *)0;
volEntries volumeInfo;
struct release *times=0;
int nservers = 0;
struct rx_connection *fromconn = (struct rx_connection *)0;
- afs_int32 error = 0;
int islocked = 0;
afs_int32 clonetid=0, onlinetid;
afs_int32 fromtid=0;
- afs_uint32 fromdate, thisdate;
+ afs_uint32 fromdate=0, thisdate;
int s;
manyDests tr;
manyResults results;
int rwindex, roindex, roclone, roexists;
- afs_int32 rwcrdate;
+ afs_int32 rwcrdate = 0;
struct rtime {
int validtime;
afs_uint32 time;
if(tst) {
goto fail_UV_DumpVolume;
}
- if (tst = DumpFunction(fromcall,filename)) {
+ if ((tst = DumpFunction(fromcall,filename))) {
goto fail_UV_DumpVolume;
}
tst = rx_EndCall(fromcall,rxError);
afs_status_t etst = 0;
struct rx_connection *toconn,*tempconn;
struct rx_call *tocall;
- afs_int32 totid, rcode, terror = 0;
+ afs_int32 totid, rcode;
afs_int32 rxError = 0;
struct volser_status tstatus;
char partName[10];
afs_status_t tst = 0;
int j, nro=0, islocked=0;
struct nvldbentry entry;
- afs_int32 error=0;
int same = 0;
tst = ubik_Call(VL_SetLock, cellHandle->vos, 0,volid,RWVOL, VLOP_ADDSITE);
int rc = 0;
afs_status_t tst = 0;
struct nvldbentry entry;
- int islocked;
+ int islocked = 0;
tst = ubik_Call(VL_SetLock, cellHandle->vos, 0,volid, RWVOL, VLOP_ADDSITE);
if(tst) {
afs_status_t tst = 0;
int modentry = 0;
int idx;
- afs_int32 error = 0;
if (modified) *modified = 0;
idx = Lp_GetRwIndex(cellHandle, entry, 0);
afs_status_t tst = 0;
int idx;
int foundro = 0, modentry = 0;
- afs_int32 error = 0;
if (modified) *modified = 0;
int rc = 0;
afs_status_t tst = 0;
afs_int32 vcode;
- int islocked;
- struct rx_connection *server = NULL;
+ int islocked = 0;
int pass = 0;
afs_int32 modentry = 0;
afs_int32 delentry = 0;
*if the volume is rw. <count> is the number of entries to be processesd.
*<pntr> points to the first entry.< myQueue> is the queue with entries
*grouped */
-static int GroupEntries(
+static afs_int32 GroupEntries(
struct rx_connection *server,
volintInfo *pntr,
afs_int32 count,
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
include ../config/Makefile.${SYS_NAME}
CC=${MT_CC}
-CFLAGS = ${OPTMZ} ${DBG} -I${SRCDIR}include ${MT_CFLAGS}
+CFLAGS = ${OPTMZ} ${DBG} -I${TOP_SRCDIR}/config -I${SRCDIR}include ${MT_CFLAGS}
CCRULE = ${CC} ${CFLAGS} -c $?
AUDIT= ../audit
cm_config.obj: $(WINNTAFSD)\cm_config.c
$(C2OBJ) $(WINNTAFSD)\cm_config.c
-install: $(DESTDIR)\lib\afsauthent.dll
-
DLLLIBS =\
+!IF (("$(SYS_NAME)"=="i386_win95" ) || ("$(SYS_NAME)"=="I386_WIN95" ))
+ $(DESTDIR)\lib\win95\pthread.lib \
+!ELSE
$(DESTDIR)\lib\pthread.lib \
+!ENDIF
$(DESTDIR)\lib\afsrpc.lib \
$(DESTDIR)\lib\afsdes.lib \
$(DESTDIR)\lib\afs\afsutil.lib \
$(DESTDIR)\lib\afs\afsreg.lib \
$(DESTDIR)\lib\afs\afseventlog.lib
-$(DESTDIR)\lib\afsauthent.dll: $(DLLOBJS) $(DLLLIBS)
+$(LIBFILE): $(DLLOBJS) $(DLLLIBS)
$(DLLCONLINK) /DEF:afsauthent.def rpcrt4.lib
$(DLLPREP)
# Definitions for generating versioninfo resources
afsauthent.res: afsauthent.rc AFS_component_version_number.h
$(RC) $*.rc
+
+install: $(LIBFILE)
+
+install9x: install
+
+clean ::
+ $(DEL) $(LIBFILE)
\ No newline at end of file
CC=${MT_CC}
INCLUDES = -I${SRCDIR}include -I.. -I../rx
-CFLAGS = ${OPTMZ} ${DBG} ${INCLUDES} -DRXDEBUG ${MT_CFLAGS}
+CFLAGS = ${OPTMZ} ${DBG} ${INCLUDES} -DRXDEBUG ${MT_CFLAGS} -I${TOP_SRCDIR}/config
SFLAGS=-P -I${SRCDIR}include
RX = ../rx
CCRULE = ${CC} ${CFLAGS} -c $?
#
# $ what /opt/langtools/bin/pxdb32
# /opt/langtools/bin/pxdb32:
-# HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.1.1.5 $
+# HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.1.1.6 $
#
# The problem occurs when -g and -O are both used when compiling des.c.
# The simplest way to work around the problem is to leave out either -g or -O.
# directory or online at http://www.openafs.org/dl/license10.html
!include ..\config\NTMakefile.$(SYS_NAME)
-
!include ..\config\NTMakefile.version
RX = ..\rx
DLLLIBS =\
+!IF (("$(SYS_NAME)"=="i386_win95" ) || ("$(SYS_NAME)"=="I386_WIN95" ))
+ $(DESTDIR)\lib\win95\pthread.lib \
+!ELSE
$(DESTDIR)\lib\pthread.lib \
+!ENDIF
$(DESTDIR)\lib\afs\afsutil.lib \
$(DESTDIR)\lib\afs\afsreg.lib
$(NTMAKE) libstub
! endif
+install9x: install
+
!IF (EXIST(..\..\src\des\NTMakefile))
!ELSE IF (EXIST(..\..\DESLIB))
DESPAR = ..\..\DESLIB\dest
$(DESTDIR)\lib\afsrpc.lib
$(COPY) $(DESPAR)\lib\afsrpc.exp \
$(DESTDIR)\lib\afsrpc.exp
+
+clean::
+ $(DEL) $(DESTDIR)\lib\afsrpc.dll $(DESTDIR)\lib\afsrpc.lib $(DESTDIR)\lib\afsrpc.exp
\ No newline at end of file
#
SHELL=/bin/sh
-INCLUDE= -I. -I/usr/include
+INCLUDE= -I. -I/usr/include -I${TOP_SRCDIR}/config
UOBJ =../UAFS
WEBOBJ =../AFSWEB
AFS =../afs
ukinstall: ukinsthdrs UAFS/$(LIBUAFS) linktest ukinstlibs
linktest: UAFS/$(LIBUAFS) des/libdes.a
- $(CC) $(TEST_CFLAGS) $(TEST_LDFLAGS) -o linktest linktest.c -I${DESTDIR}include -I${DESTDIR}include/rx -I${DESTDIR}root.perf/include UAFS/$(LIBUAFS) des/libdes.a $(TEST_LIBS)
+ $(CC) $(TEST_CFLAGS) $(TEST_LDFLAGS) -o linktest linktest.c -I${DESTDIR}include -I${DESTDIR}include/rx -I${DESTDIR}root.perf/include UAFS/$(LIBUAFS) des/libdes.a $(TEST_LIBS) $(XLIBS)
CRULE1= $(CC) $(OPTF) -DKERNEL $(CFLAGS) -c $?
CRULE2= $(CC) $(OPTF) $(WEBOPTS) -DKERNEL $(CFLAGS) -c $?
$(CRULE2);
clean:
- -rm -rf UAFS* AFSWEB*
- -rm -f h net netinet rpc ufs machine inet nfs sys
+ -rm -rf UAFS* AFSWEB* nsapi des afs afsint config rx
+ -rm -f h net netinet rpc ufs machine inet nfs sys des linktest
# MakefileProto for AIX systems
#
-include $(DESTDIR)../obj/config/Makefile.${SYS_NAME}
+include ../config/Makefile.${SYS_NAME}
MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
# System specific build commands and flags
DEFINES= -DAFSDEBUG -DKERNEL -DUKERNEL -DAFS -DVICE
-CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
+CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
AR = /usr/bin/ar
ARFLAGS = -r
RANLIB = /bin/ranlib
CC = cc
DEFINES= -D_REENTRANT -DAFSDEBUG -DKERNEL -DUKERNEL -DAFS -DVICE
KOPTS=
-CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG} $(XCFLAGS)
+CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG} $(XCFLAGS)
OPTF=-O
# WEBOPTS = -I../nsapi -DNETSCAPE_NSAPI -DNET_SSL -DXP_UNIX -DMCC_HTTPD
#
DBUG=-O
-include $(DESTDIR)/../obj/config/Makefile.${SYS_NAME}
+include ../config/Makefile.${SYS_NAME}
MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
# System specific build commands and flags
-CC = cc
DEFINES=-DAFSDEBUG -DKERNEL -DUKERNEL -DAFS -DVICE -D_NO_PROTO -DOSF
KOPTS=
DBUG=
OPTF=-O
-CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG} -pthread
+CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG} -pthread
WEBOPTS = -I../nsapi -DNETSCAPE_NSAPI -DNET_SSL -DXP_UNIX -DMCC_HTTPD
TEST_CFLAGS=-pthread -D_NO_PROTO -D_REENTRANT -DAFS_PTHREAD_ENV -Dosf -DAFS_OSF_ENV -DOSF
CC = gcc
DEFINES= -D_REENTRANT -DAFSDEBUG -DKERNEL -DUKERNEL -DAFS -DVICE
KOPTS=
-CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
+CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
OPTF=-O
# WEBOPTS = -I../nsapi -DNETSCAPE_NSAPI -DNET_SSL -DXP_UNIX -DMCC_HTTPD
# License. For details, see the LICENSE file in the top-level source
# directory or online at http://www.openafs.org/dl/license10.html
-# MakefileProto for Solaris systems
+# MakefileProto for HP-UX systems
#
-include $(DESTDIR)../obj/config/Makefile.${SYS_NAME}
+include ../config/Makefile.${SYS_NAME}
MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
CC = /opt/ansic/bin/cc
DEFINES= -D_REENTRANT -DAFSDEBUG -DKERNEL -DUKERNEL -DAFS -DVICE
KOPTS=-Wp,-H200000 -Wl,-a,archive +DA1.0 +z
-CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
+CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
OPTF=-O
WEBOPTS = -I../nsapi -DNETSCAPE_NSAPI -DNET_SSL -DXP_UNIX -DMCC_HTTPD
# MakefileProto for Solaris systems
#
-include $(DESTDIR)../obj/config/Makefile.${SYS_NAME}
+include ../config/Makefile.${SYS_NAME}
MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
# System specific build commands and flags
CC = cc
DEFINES=-D_SGI_MP_SOURCE -DAFSDEBUG -DKERNEL -DUKERNEL -DAFS -DVICE
-CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
+CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
OPTF=-O
WEBOPTS = -I../nsapi -DNETSCAPE_NSAPI -DNET_SSL -DXP_UNIX -DMCC_HTTPD
CC = gcc
DEFINES= -D_REENTRANT -DAFSDEBUG -DKERNEL -DUKERNEL -DAFS -DVICE
KOPTS=
-CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
+CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
OPTF=-O
# WEBOPTS = -I../nsapi -DNETSCAPE_NSAPI -DNET_SSL -DXP_UNIX -DMCC_HTTPD
# MakefileProto for Solaris systems
#
-include $(DESTDIR)../obj/config/Makefile.${SYS_NAME}
+include ../config/Makefile.${SYS_NAME}
MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
# System specific build commands and flags
-# Redundant
-# CC = /opt/SUNWspro/bin/cc
DEFINES= -D_REENTRANT -DAFSDEBUG -DKERNEL -DUKERNEL -DAFS -DVICE
-CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
+CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
OPTF=-O
WEBOPTS = -KPIC -I../nsapi -DNETSCAPE_NSAPI -DSOLARIS -DNET_SSL -DXP_UNIX -DMCC_HTTPD
lint ${INCDIRS} passwd.c
clean:
- rm -f *.o log passwd unlog tokens kseal core AFS_component_version_number.c
+ rm -f *.o log passwd unlog tokens kseal core AFS_component_version_number.c tokens.krb
beancount:
wc -l log.c passwd.c unlog.c
# subtle bugs that may have been introduced in process.s, be warned!
OPTIMIZE=${LWP_OPTMZ}
-CFLAGS=${OPTIMIZE} -I${SRCDIR}include ${XCFLAGS}
+CFLAGS=${OPTIMIZE} -I${TOP_SRCDIR}/config -I${SRCDIR}include ${XCFLAGS}
include ../config/Makefile.version
#
liblwp.a : ${LIBOBJS}
-rm -f liblwp.a
- ar rv liblwp.a ${LIBOBJS}
+ $(AR) rv liblwp.a ${LIBOBJS}
$(RANLIB) liblwp.a
libtlwp.a : ${LIBTOBJS}
-rm -f libtlwp.a
- ar rv libtlwp.a ${LIBTOBJS}
+ $(AR) rv libtlwp.a ${LIBTOBJS}
$(RANLIB) libtlwp.a
tlwp.o: lwp.c lwp.h
#
# Installation
#
+all: system
system: install
kinstall ukinstall webinstall:
beancount:
wc -l *.[ch]
+
+includes:
+ ${INSTALL} *.h ${DESTDIR}include
install: $(LIBFILE) $(INCFILES)
+install9x: install
+
$(LIBFILE): $(LIBOBJS)
$(LIBARCH)
rw.exe: rw.obj $(LIBFILE) $(DESTDIR)\lib\afs\afsutil.lib
$(EXECONLINK)
+
+clean::
+ $(DEL) $(LIBFILE)
#include <afs/param.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#include <malloc.h>
#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)
void IOMGR_Initialize() /* noop */
#define MIN(a,b) ((a)>(b)) ? b : a
#endif
+#ifndef NSIG
+#define NSIG 8*sizeof(sigset_t)
+#endif
+
static int SignalSignals();
\f
/********************************\
/* Result of select call */
long result;
+#ifdef AFS_DJGPP_ENV
+ NCB *ncbp;
+ dos_ptr dos_ncb;
+#endif /* AFS_DJGPP_ENV */
+
};
\f
/********************************\
static PROCESS iomgr_badpid;
static void SignalIO(int fds, fd_set *rfds, fd_set *wfds, fd_set *efs,
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
{
struct IoRequest *request;
- if (request=iorFreeList)
+ if ((request=iorFreeList))
iorFreeList = (struct IoRequest *) (request->result);
else request = (struct IoRequest *) malloc(sizeof(struct IoRequest));
struct TM_Elem *earliest;
struct timeval timeout, junk;
bool woke_someone;
-#ifndef AFS_NT40_ENV
- int fds;
-#endif
FD_ZERO(&IOMGR_readfds);
FD_ZERO(&IOMGR_writefds);
/* 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;
LWP_QSignal(req->pid);
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, 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(ncbp, dos_ncb, timeout)
+ 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()
+{
+ 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()
+{
+ 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 */
}\
}
+#ifdef AFS_WIN95_ENV
+
+LPVOID ConvertThreadToFiber(PROCESS x)
+{
+ return NULL;
+}
+LPVOID CreateFiber(DWORD x ,LPVOID y,PROCESS z)
+{
+ return NULL;
+}
+
+VOID SwitchToFiber(LPVOID p)
+{
+}
+
+VOID DeleteFiber(LPVOID p)
+{
+}
+#endif
+
int lwp_MinStackSize = 0;
+
/* LWP_InitializeProcessSupport - setup base support for fibers.
*
* Arguments:
* LWP_SUCCESS (else aborts)
*
*/
+
int LWP_InitializeProcessSupport(int priority, PROCESS *pid)
{
PROCESS pcb;
LWPANCHOR.processcnt--;
}
+
static void Free_PCB(PROCESS pid)
{
Debug(4, ("Entered Free_PCB"))
*/
#define IGNORE_STDS_H 1
+/*#ifndef AFS_DJGPP_ENV*/
#include <afs/param.h>
+/*#endif /* AFS_DJGPP_ENV */
#if defined(RIOS)
END(returnto)
#endif
-#if defined(AFS_NCR_ENV) || defined(AFS_X86_ENV)
+#if defined(AFS_NCR_ENV) || defined(AFS_X86_ENV) || defined(AFS_DJGPP_ENV)
/* Sun 386i... I hope this does the right thing!!!
*
* Written by Derek Atkins <warlord@MIT.EDU>
.set newsp,16
+#ifdef AFS_DJGPP_ENV
+.globl _PRE_Block
+.globl _savecontext
+_savecontext:
+#else
.globl PRE_Block
.globl savecontext
-
savecontext:
+#endif /* AFS_DJGPP_ENV */
pushl %ebp /* New Frame! */
movl %esp,%ebp
pusha /* Push all registers */
+#ifdef AFS_DJGPP_ENV
+ movl $1,_PRE_Block /* Pre-emption code */
+#else
movl $1,PRE_Block /* Pre-emption code */
+#endif /* AFS_DJGPP_ENV */
movl area1(%ebp),%eax /* eax = base of savearea */
movl %esp,(%eax) /* area->topstack = esp */
movl newsp(%ebp),%eax /* get new sp into eax */
/* Shouldnt be here....*/
+#ifdef AFS_DJGPP_ENV
+ call _abort
+#else
call abort
+#endif /* AFS_DJGPP_ENV */
/*
* returnto(area2)
/* stack offset */
.set area2,8
+#ifdef AFS_DJGPP_ENV
+.globl _returnto
+_returnto:
+#else
.globl returnto
-
returnto:
+#endif /* AFS_DJGPP_ENV */
pushl %ebp
movl %esp, %ebp /* New frame, to get correct pointer */
movl area2(%ebp),%eax /* eax = area2 */
movl (%eax),%esp /* restore esp */
popa
+#ifdef AFS_DJGPP_ENV
+ movl $0,_PRE_Block /* clear it up... */
+#else
movl $0,PRE_Block /* clear it up... */
+#endif /* AFS_DJGPP_ENV */
popl %ebp
ret
/* I see, said the blind man, as he picked up his hammer and saw! */
pushl $1234
+#ifdef AFS_DJGPP_ENV
+ call _abort
+#else
call abort
+#endif /* AFS_DJGPP_ENV */
#endif /* AFS_NCR_ENV */
/* ********************************************************************** */
#include <afs/param.h>
+#include <afsconfig.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
#if defined(AFS_PTHREAD_ENV)
#include <pthread.h>
#else /* defined(AFS_PTHREAD_ENV) */
for (i = 0; i < nThreads; i++) {
if (ThreadId[i] == id) {
strncpy(&ThreadName[i][0], name, MAXTHREADNAMELENGTH);
- return;
+ return 0;
}
}
- if (nThreads == MAX_THREADS) return;
+ if (nThreads == MAX_THREADS) return 0;
ThreadId[nThreads] = id;
strncpy(&ThreadName[nThreads][0], name, MAXTHREADNAMELENGTH);
ThreadName[nThreads][MAXTHREADNAMELENGTH -1] =0;
nThreads++;
+
+ return 0;
}
int swapthreadname(id, new, old)
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);
rem License. For details, see the LICENSE file in the top-level source
rem directory or online at http://www.openafs.org/dl/license10.html
+
REM AFS build environment variables for Windows NT.
REM Modify for local configuration; common defaults shown.
REM ########################################################################
-
REM ########################################################################
REM
REM NOTE: You should run NTLANG.REG before attempting to build localized
:args_done
REM ########################################################################
REM General required definitions:
-REM SYS_NAME = <AFS system name>
-
-set SYS_NAME=i386_nt40
+REM SYS_NAME = AFS system name
+SET SYS_NAME=i386_win95
+SET _WIN32_IE=0x400
REM ########################################################################
REM NTMakefile required definitions:
-REM AFSDEV_BUILDTYPE = [ CHECKED | FREE ]
-REM AFSDEV_INCLUDE = <default include directories>
-REM AFSDEV_LIB = <default library directories>
-REM AFSDEV_BIN = <default build binary directories>
+REM AFSDEV_BUILDTYPE = CHECKED / FREE
+REM AFSDEV_INCLUDE = default include directories
+REM AFSDEV_LIB = default library directories
+REM AFSDEV_BIN = default build binary directories
set AFSDEV_BUILDTYPE=%AFSBLD_TYPE%
-set MSVCDIR=c:\dev\tools\DevStudio\vc
+rem Location of VC++ development folder
+set MSVCDIR=c:\progra~1\micros~2\vc98
set AFSDEV_INCLUDE=%MSVCDIR%\include;%MSVCDIR%\mfc\include
set AFSDEV_LIB=%MSVCDIR%\lib;%MSVCDIR%\mfc\lib
set AFSDEV_BIN=%MSVCDIR%\bin
-set AFSROOT=d:\afs\openafs
+REM ########################################################################
+REM Location of base folder where source lies, build directory
+REM e.g. AFSROOT\SRC is source directory of the build tree
+
+set AFSROOT=D:\Dev\AfsSorce\OpenAF~2.2
REM ########################################################################
REM NTMakefile optional definitions:
REM
REM See NTMakefile.SYS_NAME; will normally use defaults.
REM
-REM IS5ROOT = <root directory of the InstallShield5 installation>
-REM You should only define this if you have InstallShield installed on
-REM your computer and want to create the setup as part of the build.
-set IS5ROOT=d:\progra~1\instal~1\instal~1.1pr
+IF [%HOMEDRIVE%]==[] SET HOMEDRIVE=C:
REM ########################################################################
REM Options necessary when using bison
esac
clean:
- /bin/rm -f $(TARGETS) $(OBJS) afs_setcred.o afs_setcred_krb.o core *~
+ /bin/rm -f $(TARGETS) $(OBJS) afs_setcred.o afs_setcred_krb.o core *~ AFS_component_version_number.c
install: all
${INSTALL} -s pam_afs.so.1 ${DESTDIR}lib/pam_afs.so.1
sgi_* ) \
$(CC) -g -I${DESTDIR}include ${CFLAGS} install.c -o pinstall ${LIBS} -lmld ;; \
*) \
- $(CC) -g -I${DESTDIR}include ${CFLAGS} install.c -o pinstall ${LIBS} ;; \
+ $(CC) -g -I. -I${DESTDIR}include ${CFLAGS} install.c -o pinstall ${LIBS} ;; \
esac
- [ -d test ] && ( cd test; $(MAKE) )
- [ -d test ] && ./test/test_install
install: ${DESTDIR}lib/afs/libprocmgmt.a
${INSTALL} procmgmt.h ${DESTDIR}include/afs
+includes:
+ ${INSTALL} procmgmt.h ${DESTDIR}include/afs
+
clean:
$(RM) -f *.o libprocmgmt.a \
core AFS_component_version_number.c
KILL_EXELIBS =\
$(DESTDIR)\lib\afs\afsprocmgmt.lib
-$(RS_KILL_EXEFILE): $(KILL_EXEOBJS) $(KILL_EXELIBS)
+$(RS_KILL_EXEFILE): $(KILL_EXEOBJS) $(KILL_EXELIBS)
$(EXECONLINK)
$(EXEPREP)
install_headers: $(INCFILES)
+install9x: install_headers
+
install: install_headers $(DLLFILE) $(CL_KILL_EXEFILE)
clean::
+ $(DEL) $(INCFILES)
\ No newline at end of file
COMPILE_ET = ${SRCDIR}bin/compile_et
MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
-CFLAGS = $(DBUG) -I${SRCDIR}include ${XCFLAGS}
+CFLAGS = $(DBUG) -I${TOP_SRCDIR}/config -I${SRCDIR}include ${XCFLAGS}
INCLS=${SRCDIR}include/ubik.h \
${SRCDIR}include/lock.h \
${SRCDIR}include/lwp.h \
clean:
$(RM) -f *.o ptserver ptint.cs.c ptint.ss.c ptclient ptint.xdr.c ptint.h \
libprot.a pts readgroup readpwd db_verify testpt pt_util pterror.h pterror.c \
- core AFS_component_version_number.c
+ core AFS_component_version_number.c Kptint.cs.c Kptint.h Kptint.xdr.c
ptserver: ptserver.o ptutils.o ptprocs.o ptint.ss.o ptint.xdr.o utils.o $(LIBS) ${auditlib}
$(CC) ${CFLAGS} -o ptserver ptserver.o ptutils.o ptprocs.o ptint.ss.o ptint.xdr.o utils.o $(LIBS) ${XLIBS} ${auditlib}
${INSTALL} ptclient.h ${DESTDIR}include/afs/prclient.h
${INSTALL} -f db_verify ${DESTDIR}etc/prdb_check
echo '#define ERROR_TABLE_BASE_pr ERROR_TABLE_BASE_pt' >> ${DESTDIR}include/afs/prerror.h
+
+libinstall: ${DESTDIR}lib/afs/libprot.a
+ ${INSTALL} libprot.a ${DESTDIR}lib/afs/libprot.a
+ ${INSTALL} ptserver.h ptint.h pterror.h ptclient.h ${DESTDIR}include/afs
+ ${INSTALL} ptserver.h ${DESTDIR}include/afs/prserver.h
+ ${INSTALL} ptint.h ${DESTDIR}include/afs/print.h
+ ${INSTALL} pterror.h ${DESTDIR}include/afs/prerror.h
+ ${INSTALL} ptclient.h ${DESTDIR}include/afs/prclient.h
+
# Override default definitions in NTMakefile.$(SYS_NAME) before including.
!INCLUDE ..\config\NTMakefile.$(SYS_NAME)
-!INCLUDE ..\config\NTMakefile.version
+!include ..\config\NTMakefile.version
############################################################################
$(DESTDIR)\lib\afs\afsutil.lib \
$(DESTDIR)\lib\afs\afsaudit.lib \
$(DESTDIR)\lib\afs\afseventlog.lib \
- $(DESTDIR)\lib\afs\afsreg.lib \
- $(DESTDIR)\lib\afs\afsprocmgmt.lib
+ $(DESTDIR)\lib\afs\afsreg.lib
+
+!IF (("$(SYS_NAME)"!="i386_win95" ) && ("$(SYS_NAME)"!="I386_WIN95" ))
+PTSERVER_EXELIBS =$(PTSERVER_EXELIBS) $(DESTDIR)\lib\afs\afsprocmgmt.lib
+!ENDIF
$(PTSERVER): $(PTSERVER_EXEOBJS) $(PTSERVER_EXELIBS)
$(INCFILEDIR)\afs\prserver.h $(INCFILEDIR)\afs\print.h \
$(INCFILEDIR)\afs\prerror.h $(INCFILEDIR)\afs\prclient.h
+install9X: $(INCFILES) $(LIBFILE) $(PTS) \
+ $(DESTDIR)\root.server\usr\afs\bin\pts.exe \
+ $(INCFILEDIR)\afs\prserver.h $(INCFILEDIR)\afs\print.h \
+ $(INCFILEDIR)\afs\prerror.h $(INCFILEDIR)\afs\prclient.h
+
+install_libutils: $(INCFILES) $(LIBFILE) $(PTS)
# install various exe's and header files
$(DESTDIR)\root.server\usr\afs\bin\pts.exe: $(PTS)
$(DEL) ptint.cs.c ptint.ss.c ptclient ptint.xdr.c ptint.h
$(DEL) readgroup.exe readpwd.exe db_verify.exe testpt.exe
$(DEL) pterror.h pterror.c
+ $(DEL) $(PTS)
############################################################################
# tests?
extern afs_int32 ubik_lastYesTime;
extern afs_int32 ubik_nBuffers;
-extern int afsconf_ClientAuth();
extern int afsconf_ServerAuth();
extern int afsconf_CheckAuth();
/* hack in help flag support */
- printf ("Usage: ptserver [-database <db path>] "
#ifndef AFS_NT40_ENV
+ printf ("Usage: ptserver [-database <db path>] "
"[-syslog[=FACILITY]] "
-#endif
"[-p <number of processes>] [-rebuild] "
- /* "[-enable_peer_stats] [-enable_process_stats] " */
+ "[-enable_peer_stats] [-enable_process_stats] "
+ "[-help]\n");
+#else
+ printf ("Usage: ptserver [-database <db path>] "
+ "[-p <number of processes>] [-rebuild] "
"[-help]\n");
+#endif
fflush(stdout);
PT_EXIT(1);
sc[0] = rxnull_NewServerSecurityObject();
sc[1] = 0;
if (kerberosKeys) {
- extern int afsconf_GetKey();
sc[2] = rxkad_NewServerSecurityObject
(0, prdir, afsconf_GetKey, (char *)0);
}
#include <ubik.h>
#include <rx/xdr.h>
#include <afs/com_err.h>
+#include <afs/cellconfig.h>
#include "ptserver.h"
#include "pterror.h"
#include <stdlib.h>
-/* $Id: ubik.c,v 1.1 2001/01/19 20:55:46 hartmans Exp $ */
+/* $Id: ubik.c,v 1.1.1.2 2001/07/05 01:03:43 hartmans Exp $ */
#include <sys/types.h>
#include <netinet/in.h>
* a global lock. Thus we can safely drop our locks before calling the
* kernel sleep services.
*/
-static inline CV_WAIT(afs_kcondvar_t *cv, afs_kmutex_t *l)
+static inline int CV_WAIT(afs_kcondvar_t *cv, afs_kmutex_t *l)
{
int isAFSGlocked = ISAFS_GLOCK();
return 0;
}
-static inline CV_TIMEDWAIT(afs_kcondvar_t *cv, afs_kmutex_t *l, int waittime)
+static inline int CV_TIMEDWAIT(afs_kcondvar_t *cv, afs_kmutex_t *l, int waittime)
{
int isAFSGlocked = ISAFS_GLOCK();
long t = waittime * HZ / 1000;
MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
#CC=pcc
-CFLAGS = ${OPTMZ} -I${SRCDIR}include -DRXDEBUG ${XCFLAGS}
+CFLAGS = ${OPTMZ} -I${TOP_SRCDIR}/config -I${SRCDIR}include -DRXDEBUG ${XCFLAGS}
#
# Generic xdr objects (or, at least, xdr stuff that's not newly defined for rx).
RXOBJS = rx_clock.o rx_event.o rx_user.o rx_lwp.o rx.o rx_null.o rx_globals.o \
rx_getaddr.o rx_misc.o rx_packet.o rx_rdwr.o rx_trace.o rx_conncache.o \
- xdr_int64.o
+ xdr_int64.o
MULTIOBJS = rx_multi.o
LIBOBJS = ${RXOBJS} ${MULTIOBJS} ${XDROBJS}
+LIBOBJS_djgpp = ${RXOBJS_djgpp} ${MULTIOBJS} ${XDROBJS_djgpp}
+
+XMIT = rx_xmit_nt.o
+XMIT_H = rx_xmit_nt.h
+
+XDROBJS_djgpp = xdr.o xdr_rec.o xdr_stdio.o \
+ xdr_float.o xdr_refernce.o xdr_update.o \
+ xdr_array.o xdr_mem.o xdr_rx.o xdr_afsuuid.o
+
+RXOBJS_djgpp = rx_clock.o rx_event.o rx_user.o rx_lwp.o rx.o rx_null.o rx_globals.o \
+ rx_getaddr.o rx_misc.o rx_packet.o rx_rdwr.o rx_trace.o rx_conncache.o \
+ xdr_int64.o $(XMIT)
+
BASICINCLS = ${SRCDIR}include/lwp.h ${SRCDIR}include/lock.h \
rx_clock.h rx_queue.h rx_event.h
librx.a: ${LIBOBJS} RX_component_version_number.o
-rm -f $@
- ar rv $@ RX_component_version_number.o ${LIBOBJS}
+ $(AR) rv $@ RX_component_version_number.o ${LIBOBJS}
$(RANLIB) $@
+librx-djgpp: ${LIBOBJS_djgpp} RX_component_version_number.o
+ -rm -f librx.a
+ $(AR) rv librx.a RX_component_version_number.o ${LIBOBJS_djgpp}
+ $(RANLIB) librx.a
+
${DESTDIR}etc/rxdebug: rxdebug
${INSTALL} rxdebug ${DESTDIR}etc/rxdebug
install.noversion noversion install all system: librx.a includes kinstall ukinstall
${INSTALL} librx.a ${DESTDIR}lib
-includes: rx.h rx_user.h rx_event.h rx_queue.h rx_clock.h xdr.h rx_null.h rx_globals.h
+install-djgpp: librx-djgpp includes includes-djgpp kinstall ukinstall
+ ${INSTALL} librx.a ${DESTDIR}lib
+
+includes-djgpp: $(XMIT_H)
+ set ${DESTDIR}include/rx; $(MKDIR_IF_NEEDED)
+ ${INSTALL} $(XMIT_H) ${DESTDIR}include/rx
+
+includes: rx.h rx_user.h rx_event.h rx_queue.h rx_clock.h xdr.h rx_null.h rx_globals.h
set ${DESTDIR}include/rx; $(MKDIR_IF_NEEDED)
${INSTALL} rx_packet.h rx.h rx_user.h rx_event.h rx_queue.h \
rx_globals.h \
-$(INSTALL) UKERNEL/*.[ch] $(UKERNELDIR)rx
clean:
- rm -f *.o *.a core *_component_version_number.c
+ rm -f *.o *.a core *_component_version_number.c rxdumptrace rxdebug
# RX has different strings for it's version number.
VERSFILE=RX_component_version_number
CML_PREFIX=rx_
+
!include ..\config\NTMakefile.version
# Additional debugging flag for RX.
$(EXECONLINK)
$(EXEPREP)
-
install: $(LIBFILE) $(INCFILES) $(RXDEBUG)
+
+install9x: $(LIBFILE) $(INCFILES)
int rx_ReadvProc();
int rx_ReadProc32();
void rx_FlushWrite();
+void rxi_DeleteCachedConnections();
+void rxi_DestroyConnection();
+void rxi_CleanupConnection();
+int rxi_Listen();
int rxi_WriteProc();
int rxi_WritevProc();
int rxi_WritevAlloc();
int rxi_ReadvProc();
int rxi_FillReadVec();
void rxi_FlushWrite();
+int rxi_getAllAddrMaskMtu();
+int rx_getAllAddr();
+void rxi_FreePacket();
+void rxi_FreePacketNoLock();
+int rxi_AllocDataBuf();
+void rxi_RestoreDataBufs();
+void rxi_Sleep();
+void rxi_InitializeThreadSupport();
+int rxi_Recvmsg();
+int rxi_Sendmsg();
+int rxi_IsConnInteresting();
+afs_int32 rx_SlowReadPacket();
+afs_int32 rx_SlowWritePacket();
+afs_int32 rx_SlowGetInt32();
+void rxi_StopListener();
+void rxi_InitPeerParams();
+void rxi_FreeAllPackets();
+void rxi_SendPacketList();
+void rxi_SendPacket();
+void rxi_MorePackets();
+void rxi_MorePacketsNoLock();
+void rxi_PacketsUnWait();
+void rx_CheckPackets();
+void rxi_Wakeup();
void rx_PrintStats();
void rx_PrintPeerStats();
void rx_SetArrivalProc();
void rx_Finalize();
void rx_GetIFInfo();
+void shutdown_rxevent();
+int clock_UnInit();
+void rxi_Delay(int);
#ifndef KERNEL
typedef void (*rx_destructor_t)(void *);
int rx_KeyCreate(rx_destructor_t);
void *rx_GetSpecific(struct rx_connection *conn, int key);
void rx_SetSpecific(struct rx_connection *conn, int key, void *ptr);
+osi_socket rxi_GetUDPSocket(u_short port);
#endif /* KERNEL */
int ntoh_syserr_conv(int error);
#define RX_CONN_USING_PACKET_CKSUM 4 /* non-zero header.spare field seen */
#define RX_CONN_KNOW_WINDOW 8 /* window size negotiation works */
#define RX_CONN_RESET 16 /* connection is reset, remove */
+#define RX_CONN_BUSY 32 /* connection is busy; don't delete */
/* Type of connection, client or server */
#define RX_CLIENT_CONNECTION 0
#ifndef KERNEL
/* Make clock uninitialized. */
+int
clock_UnInit()
{
clockInitialized = 0;
+ return 0;
}
#endif
#include "rx.h"
#endif /* UKERNEL */
-extern void rxi_DestroyConnection(struct rx_connection *);
/*
* We initialize rxi_connectionCache at compile time, so there is no
* need to call queue_Init(&rxi_connectionCache).
struct rx_connection **conn) {
cache_entry_p new_entry;
- if(new_entry = (cache_entry_p) malloc(sizeof(cache_entry_t))) {
+ if((new_entry = (cache_entry_p) malloc(sizeof(cache_entry_t)))) {
new_entry->conn = *conn;
new_entry->parts = *parts;
new_entry->inUse = 1;
{
register struct rxevent *ev, *evqe, *evqpr;
register struct rxepoch *ep, *epqe, *epqpr;
- struct clock ept;
int isEarliest = 0;
MUTEX_ENTER(&rxevent_lock);
if (rx_Log_event) {
struct clock now;
clock_GetTime(&now);
- fprintf(rx_Log_event, "%d.%d: rxevent_Post(%d.%d, %x, %x)\n", now.sec, now.usec, when->sec, when->usec, func, arg);
+ fprintf(rx_Log_event, "%d.%d: rxevent_Post(%d.%d, %x, %x)\n",
+ (int) now.sec, (int) now.usec, (int) when->sec,
+ (int) when->usec, (unsigned int) func, (unsigned int) arg);
}
#endif
if (rx_Log_event) {
struct clock now;
clock_GetTime(&now);
- fprintf(rx_Log_event, "%d.%d: rxevent_Cancel_1(%d.%d, %x, %x)\n", now.sec,
- now.usec, ev->eventTime.sec, ev->eventTime.usec, ev->func,
- ev->arg);
+ fprintf(rx_Log_event, "%d.%d: rxevent_Cancel_1(%d.%d, %x, %x)\n",
+ (int) now.sec, (int) now.usec, (int) ev->eventTime.sec,
+ (int) ev->eventTime.usec, (unsigned int) ev->func,
+ (unsigned int) ev->arg);
}
#endif
/* Append it to the free list (rather than prepending) to keep the free
} while (queue_IsNotEmpty(&ep->events));
}
#ifdef RXDEBUG
- if (rx_Log_event) fprintf(rx_Log_event, "rxevent_RaiseEvents(%d.%d)\n", now.sec, now.usec);
+ if (rx_Log_event) fprintf(rx_Log_event, "rxevent_RaiseEvents(%d.%d)\n",
+ (int) now.sec, (int) now.usec);
#endif
rxevent_raiseScheduled = 0;
MUTEX_EXIT(&rxevent_lock);
* directory or online at http://www.openafs.org/dl/license10.html
*/
+
#ifndef lint
#endif
/* getaddr -- get our internet address. July, 1986 */
#include <afs/param.h>
+#ifndef AFS_DJGPP_ENV
#ifndef KERNEL
#ifndef AFS_NT40_ENV
#include <sys/types.h>
#ifndef KERNEL
/* to satisfy those who call setaddr */
+int
rxi_setaddr(x)
afs_int32 x; {
return 0;
struct ifconf ifc;
struct ifreq ifs[NIFS], *ifr;
struct sockaddr_in *a;
+#if defined(AFS_AIX41_ENV) || defined(AFS_USR_AIX_ENV)
char *cp, *cplim; /* used only for AIX 41 */
+#endif
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0)
int s;
int i, len, count=0;
struct ifconf ifc;
- struct ifreq ifs[NIFS], *ifr, tempIfr;
+ struct ifreq ifs[NIFS], *ifr;
struct sockaddr_in *a;
+#if defined(AFS_AIX41_ENV) || defined(AFS_USR_AIX_ENV)
char *cp, *cplim; /* used only for AIX 41 */
+#endif
#if !defined(AFS_USERSPACE_IP_ADDR)
count = rx_getAllAddr(addrBuffer, 1024);
#endif /* ! AFS_NT40_ENV */
#endif /* !KERNEL || UKERNEL */
+
+#endif /* !AFS_DJGPP_ENV */
}
PROCESS rx_listenerPid = 0; /* LWP process id of socket listener process */
-void rx_ListenerProc(void *dummy);
+static void rx_ListenerProc(void *dummy);
/*
* Delay the current thread the specified number of seconds.
afs_int32 nextPollTime; /* time to next poll FD before sleeping */
int lastPollWorked, doingPoll; /* true iff last poll was useful */
struct timeval tv, *tvp;
- int i, code;
+ int code;
+#ifdef AFS_NT40_ENV
+ int i;
+#endif
PROCESS pid;
char name[MAXTHREADNAMELENGTH] = "srv_0";
* 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 (sfds)
IOMGR_FreeFDSet(sfds);
+ return 0;
}
*/
#include <afs/param.h>
+#include <afsconfig.h>
#ifdef KERNEL
#include <afs/sysincludes.h>
#include <afs/afsincludes.h>
#ifdef AFS_PTHREAD_ENV
#include "rx.h"
#endif /* AFS_PTHREAD_ENV */
+#include <stdlib.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#endif
/*
* Convert from the local (host) to the standard
* (network) system error code.
*/
+int
hton_syserr_conv(code)
register afs_int32 code;
{
if (code == ENOSPC)
err = VDISKFULL;
-#if !defined(AFS_SUN5_ENV) && !defined(AFS_NT40_ENV)
+#if !defined(AFS_SUN5_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_ENV)
/* EDQUOT doesn't exist on solaris */
else if (code == EDQUOT)
err = VOVERQUOTA;
* Convert from the standard (Network) format to the
* local (host) system error code.
*/
+int
ntoh_syserr_conv(int code)
{
register afs_int32 err;
if (code == VDISKFULL)
err = ENOSPC;
else if (code == VOVERQUOTA)
-#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
+#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV) || defined(AFS_DJGPP_ENV)
err = ENOSPC;
#else
err = EDQUOT;
return (char *)(mem_alloc(x));
}
+int
osi_free(x, size)
char *x;
afs_int32 size;
{
- if ((x == &memZero) || !x) return;
+ if ((x == &memZero) || !x) return 0;
LOCK_MALLOC_STATS
osi_alloccnt--; osi_allocsize -= size;
UNLOCK_MALLOC_STATS
mem_free(x, size);
+ return 0;
}
#endif
#endif /* KERNEL */
#ifdef KERNEL
#include "../afs/param.h"
+#include <afsconfig.h>
#if defined(UKERNEL)
#include "../afs/sysincludes.h"
#include "../afs/afsincludes.h"
#include "../rx/rx_globals.h"
#else /* KERNEL */
#include <afs/param.h>
+#include <afsconfig.h>
#include "sys/types.h"
#include <sys/stat.h>
#include <errno.h>
+#if defined(AFS_NT40_ENV) || defined(AFS_DJGPP_ENV)
#ifdef AFS_NT40_ENV
#include <winsock2.h>
+#else
+#include <sys/socket.h>
+#include <netinet/in.h>
+#endif /* AFS_NT40_ENV */
#include "rx_xmit_nt.h"
#include <stdlib.h>
#else
#include "rx_globals.h"
#include <lwp.h>
#include "rx_internal.h"
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#endif /* KERNEL */
-
#ifdef RX_LOCKS_DB
/* rxdb_fileID is used to identify the lock location, along with line#. */
static int rxdb_fileID = RXDB_FILE_RX_PACKET;
extern char cml_version_number[];
extern int (*rx_almostSent)();
-void rxi_FreePacketNoLock(struct rx_packet *p);
static void rxi_SendDebugPacket(struct rx_packet *apacket, osi_socket asocket,
- afs_int32 ahost, short aport, afs_int32 istack);
+ afs_int32 ahost, short aport, afs_int32 istack);
-extern char cml_version_number[];
-extern int (*rx_almostSent)();
/* some rules about packets:
* 1. When a packet is allocated, the final iov_buf contains room for
* a security trailer, but iov_len masks that fact. If the security
static struct rx_packet * allocCBuf(int class)
{
struct rx_packet *c;
-#ifndef KERNEL
- extern void rxi_MorePacketsNoLock();
-#endif /* !KERNEL */
SPLVAR;
NETPRI;
osi_Panic("rxi_AllocPacket: packet not free\n");
c->header.flags = 0;
+#ifdef KERNEL
done:
+#endif
MUTEX_EXIT(&rx_freePktQ_lock);
USERPRI;
*/
void rxi_freeCBuf(struct rx_packet *c)
{
- extern void rxi_PacketsUnWait();
SPLVAR;
NETPRI;
for (i=p->niovecs; nb>0 && i<RX_MAXWVECS; i++) {
register struct rx_packet *cb;
- if (cb = allocCBuf(class)) {
+ if ((cb = allocCBuf(class))) {
p->wirevec[i].iov_base = (caddr_t) cb->localdata;
p->wirevec[i].iov_len = RX_CBUFFERSIZE;
nb -= RX_CBUFFERSIZE;
/* Add more packet buffers */
void rxi_MorePackets(int apackets)
{
- extern void rxi_PacketsUnWait();
struct rx_packet *p, *e;
int getme;
SPLVAR;
/* Add more packet buffers */
void rxi_MorePacketsNoLock(int apackets)
{
- extern void rxi_PacketsUnWait();
struct rx_packet *p, *e;
int getme;
struct rx_packet * p;
int first;
{
- extern void rxi_PacketsUnWait();
int length;
struct iovec *iov, *end;
SPLVAR;
* remove it yourself first if you call this routine. */
void rxi_FreePacket(struct rx_packet *p)
{
- extern void rxi_PacketsUnWait();
SPLVAR;
NETPRI;
while (!(call->error)) {
MUTEX_ENTER(&rx_freePktQ_lock);
/* if an error occurred, or we get the packet we want, we're done */
- if (p = rxi_AllocPacketNoLock(RX_PACKET_CLASS_SEND)) {
+ if ((p = rxi_AllocPacketNoLock(RX_PACKET_CLASS_SEND))) {
MUTEX_EXIT(&rx_freePktQ_lock);
want += delta;
tconn.serial = htonl(tc->serial);
for(j=0;j<RX_MAXCALLS;j++) {
tconn.callNumber[j] = htonl(tc->callNumber[j]);
- if (tcall=tc->call[j]) {
+ if ((tcall=tc->call[j])) {
tconn.callState[j] = tcall->state;
tconn.callMode[j] = tcall->mode;
tconn.callFlags[j] = tcall->flags;
*/
case RX_DEBUGI_GETPEER: {
- int i, j;
+ int i;
register struct rx_peer *tp;
struct rx_debugPeer tpeer;
int i;
int nbytes;
int saven = 0;
- size_t savelen;
+ size_t savelen = 0;
#ifdef KERNEL
int waslocked = ISAFS_GLOCK();
#endif
void rxi_SendPacket(struct rx_connection * conn, struct rx_packet *p,
int istack)
{
+#if defined(KERNEL)
int waslocked;
+#endif
struct sockaddr_in addr;
register struct rx_peer *peer = conn->peer;
osi_socket socket;
int len,
int istack)
{
+#if defined(AFS_SUN5_ENV) && defined(KERNEL)
int waslocked;
+#endif
struct sockaddr_in addr;
register struct rx_peer *peer = conn->peer;
osi_socket socket;
- struct rx_packet *p;
+ struct rx_packet *p = NULL;
struct iovec wirevec[RX_MAXIOVECS];
int i, length;
afs_uint32 serial;
* packet sends (it's repeated elsewhere) */
register struct rx_packet *p;
unsigned int i = 0;
- int savelen, saven = 0;
+ int savelen = 0, saven = 0;
int channel, callNumber;
if (call) {
channel = call->channel;
#ifndef _RX_PACKET_
#define _RX_PACKET_
#ifndef UKERNEL
-#ifdef AFS_NT40_ENV
+#if defined(AFS_NT40_ENV) || defined(AFS_DJGPP_ENV)
#include "rx_xmit_nt.h"
-#else
-#include <sys/uio.h>
#endif
+#ifndef AFS_NT40_ENV
+#include <sys/uio.h>
+#endif /* !AFS_NT40_ENV */
#endif /* !UKERNEL */
/* this file includes the macros and decls which depend on packet
* format, and related packet manipulation macros. Note that code
*/
-#ifdef AFS_NT40_ENV
+#if defined(AFS_NT40_ENV) || defined(AFS_DJGPP_ENV)
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
/*
* Delay the current thread the specified number of seconds.
*/
-rxi_Delay(sec)
+void rxi_Delay(sec)
int sec;
{
sleep(sec);
#ifdef KERNEL
#include "../afs/param.h"
+#include <afsconfig.h>
#ifndef UKERNEL
#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
#include "../afs/sysincludes.h"
#endif /* AFS_ALPHA_ENV */
#else /* KERNEL */
# include <afs/param.h>
+# include <afsconfig.h>
# include <sys/types.h>
#ifndef AFS_NT40_ENV
# include <sys/socket.h>
# include <sys/stat.h>
# include <sys/time.h>
#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
# include "rx_user.h"
# include "rx_clock.h"
# include "rx_queue.h"
# include "rx_internal.h"
#endif /* KERNEL */
-
#ifdef RX_LOCKS_DB
/* rxdb_fileID is used to identify the lock location, along with line#. */
static int rxdb_fileID = RXDB_FILE_RX_RDWR;
* work. It may reduce the length of the packet by up
* to conn->maxTrailerSize, to reflect the length of the
* data + the header. */
- if (error = RXS_CheckPacket(conn->securityObject, call, rp)) {
+ if ((error = RXS_CheckPacket(conn->securityObject, call, rp))) {
/* Used to merely shut down the call, but now we
* shut down the whole connection since this may
* indicate an attempt to hijack it */
struct rx_packet *rp;
struct rx_packet *curp;
struct iovec *call_iov;
- struct iovec *cur_iov;
+ struct iovec *cur_iov = NULL;
curp = call->currentPacket;
if (curp) {
* work. It may reduce the length of the packet by up
* to conn->maxTrailerSize, to reflect the length of the
* data + the header. */
- if (error = RXS_CheckPacket(conn->securityObject, call, rp)) {
+ if ((error = RXS_CheckPacket(conn->securityObject, call, rp))) {
/* Used to merely shut down the call, but now we
* shut down the whole connection since this may
* indicate an attempt to hijack it */
}
#endif /* RX_ENABLE_LOCKS */
}
- if (cp = rxi_AllocSendPacket(call, nbytes)) {
+ if ((cp = rxi_AllocSendPacket(call, nbytes))) {
call->currentPacket = cp;
call->nFree = cp->length;
call->curvec = 1; /* 0th vec is always header */
int nio;
int nbytes;
{
- struct rx_connection *conn = call->conn;
struct rx_packet *cp = call->currentPacket;
register struct rx_packet *tp; /* Temporary packet pointer */
register struct rx_packet *nxp; /* Next packet pointer, for queue_Scan */
nextio = 0;
queue_Init(&tmpq);
do {
- unsigned int t;
-
if (call->nFree == 0 && cp) {
clock_NewTime(); /* Bogus: need new time package */
/* The 0, below, specifies that it is not the last packet:
#ifdef RXDEBUG
#include <afs/param.h>
+#include <afsconfig.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
#ifdef AFS_NT40_ENV
#include <fcntl.h>
#include <io.h>
#else
#include <sys/file.h>
+#include <unistd.h>
#endif
#include "rx.h"
#include "rx_globals.h"
#include <afs/afsutil.h>
#endif
-main(argc, argv)
+int main(argc, argv)
char **argv;
{
struct rx_trace ip;
/* rx_user.c contains routines specific to the user space UNIX implementation of rx */
# include <afs/param.h>
+# include <afsconfig.h>
# include <sys/types.h>
# include <errno.h>
# include <signal.h>
# include <sys/ioctl.h>
#endif
# include <fcntl.h>
-#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV)
+#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_ENV)
# include <sys/syscall.h>
#endif
#include <afs/afs_args.h>
#include <afs/afsutil.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
#ifndef IPPORT_USERRESERVED
/* If in.h doesn't define this, define it anyway. Unfortunately, defining
# include "rx.h"
# include "rx_globals.h"
-
-extern void rxi_Delay();
-
#ifdef AFS_PTHREAD_ENV
#include <assert.h>
*/
osi_socket rxi_GetUDPSocket(u_short port)
{
- int binds, code;
+ int binds, code=0;
osi_socket socketFd = OSI_NULLSOCKET;
struct sockaddr_in taddr;
char *name = "rxi_GetUDPSocket: ";
- extern int rxi_Listen(osi_socket sock);
- int greedy;
+ int greedy=0;
-#ifndef AFS_NT40_ENV
+#if !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_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);
*/ ;
goto error;
}
-#ifndef AFS_NT40_ENV
+#if !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_ENV)
/*
* Set close-on-exec on rx socket
*/
len1 = 32766;
len2 = rx_UdpBufSize;
+#ifndef AFS_DJGPP_ENV
greedy =
(setsockopt(socketFd, SOL_SOCKET, SO_RCVBUF, (char *)&len2,
sizeof(len2)) >= 0);
sizeof(len1)) >= 0) &&
(setsockopt(socketFd, SOL_SOCKET, SO_RCVBUF, (char *)&len2,
sizeof(len2)) >= 0);
+#endif /* AFS_DJGPP_ENV */
}
+#ifndef AFS_DJGPP_ENV
if (!greedy)
(osi_Msg "%s*WARNING* Unable to increase buffering on socket\n", name);
+#endif /* AFS_DJGPP_ENV */
if (rxi_Listen(socketFd) < 0) {
goto error;
}
u_int rxi_numNetAddrs;
static int Inited = 0;
-#if defined(AFS_NT40_ENV)
+#if defined(AFS_NT40_ENV) || defined(AFS_DJGPP_ENV)
int rxi_getaddr(void)
{
if (rxi_numNetAddrs > 0)
-#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DJGPP_ENV)
int rxi_syscall(a3, a4, a5)
afs_uint32 a3, a4;
void * a5;
{
int s;
int i, j, len, res;
+#ifndef AFS_DJGPP_ENV
struct ifconf ifc;
struct ifreq ifs[ADDRSPERSITE];
- struct ifreq ifreq, *ifr;
+ struct ifreq *ifr;
#ifdef AFS_AIX41_ENV
char buf[BUFSIZ], *cp, *cplim;
#endif
struct sockaddr_in *a;
+#endif /* AFS_DJGPP_ENV */
LOCK_IF_INIT
if (Inited) {
s = socket(AF_INET, SOCK_DGRAM, 0);
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 */
*/
#include <afs/param.h>
-#ifdef AFS_NT40_ENV
+#if defined(AFS_NT40_ENV) || defined(AFS_DJGPP_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"
#include "rx_globals.h"
#include "rx_xmit_nt.h"
+#ifdef AFS_NT40_ENV
#include <malloc.h>
+#endif
#include <errno.h>
int recvmsg(int socket, struct msghdr *msgP, int flags)
code = sendto((SOCKET)socket, sbuf, size, flags,
(struct sockaddr*)(msgP->msg_name), msgP->msg_namelen);
+#ifdef AFS_NT40_ENV
if (code == SOCKET_ERROR) {
code = WSAGetLastError();
switch (code) {
}
code = -1;
}
+#endif /* AFS_NT40_ENV */
if (code < size) {
errno = EIO;
-#endif
+#endif /* AFS_NT40_ENV || AFS_DJGPP_ENV */
#define _RX_XMIT_NT_H_
-typedef struct iovec {
+typedef struct iovec
+#ifndef AFS_DJGPP_ENV
+{
void *iov_base;
int iov_len;
-} iovec_t;
+}
+#endif
+iovec_t;
struct msghdr {
char * msg_name;
#include <sys/types.h>
#include <afs/param.h>
+#include <afsconfig.h>
#include <errno.h>
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <netdb.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <string.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
#include <sys/stat.h>
#include <afs/stds.h>
#include <afs/cmd.h>
return ts->s_port; /* returns it in network byte order */
}
-MainCommand(as, arock)
+int MainCommand(as, arock)
char *arock;
struct cmd_syndesc *as;
{
#ifndef AFS_NT40_ENV
#include "AFS_component_version_number.c"
#endif
-main(argc, argv)
+int main(argc, argv)
int argc;
char **argv;
{
#define __XDR_INCLUDE__
#include <afs/param.h>
#ifdef AFS_NT40_ENV
+#ifndef _MFC_VER
#include <winsock2.h>
+#endif /* _MFC_VER */
#endif
#define bool_t int
#define enum_t int
*/
#ifndef xdr_afs_int32
-#ifdef AFS_64BIT_ENV
#define xdr_afs_int32 xdr_int
-#else
-#define xdr_afs_int32 xdr_long
-#endif
#endif
#ifndef xdr_afs_uint32
#define xdr_afs_uint32 xdr_u_int
#endif
+#ifndef xdr_afs_int64
+#define xdr_afs_int64 xdr_int64
+#endif
+#ifndef xdr_afs_uint64
+#define xdr_afs_uint64 xdr_uint64
+#endif
#endif /* __XDR_INCLUDE__ */
return code;
}
+#ifdef undef /* not used */
static u_int
xdrrx_getpos(xdrs)
register XDR *xdrs;
/* Not supported */
return FALSE;
}
+#endif
static AFS_RPC_INLINE_T *
xdrrx_inline(xdrs, len)
rpc_svcout.o rpc_clntout.o
GOAL=rxgen
-CFLAGS = ${DBUG} -I${DESTDIR}include ${XCFLAGS}
+CFLAGS = ${DBUG} -I. -I${DESTDIR}include -I${TOP_SRCDIR}/config ${XCFLAGS}
USNS=cellname
SD=../../../src/CML
install: AFS_component_version_number.c $(EXEFILE) $(INCFILES)
+install9x: install
clean::
-
+ $(DEL) $(EXEFILE)
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
-#ifndef lint
-static char sccsid[] = "@(#)rpc_clntout.c 1.2 87/06/24 (C) 1987 SMI";
-#endif
/*
* rpc_clntout.c, Client-stub outputter for the RPC protocol compiler
* Copyright (C) 1987, Sun Microsytsems, Inc.
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <stdio.h>
-#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
#include <string.h>
-#else
-#include <strings.h>
-#endif
#include "rpc_parse.h"
#include "rpc_util.h"
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_clntout.c,v 1.1.1.2 2001/07/05 01:04:05 hartmans Exp $");
+
#define DEFAULT_TIMEOUT 25 /* in seconds */
static write_program();
* Copyright (C) 1987, Sun Microsystems, Inc.
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <stdio.h>
-#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
-#include <string.h>
-#else
+#include <stdlib.h>
+#ifdef HAVE_STRINGS_H
#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#endif
#include "rpc_util.h"
#include "rpc_parse.h"
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_cout.c,v 1.1.1.2 2001/07/05 01:04:06 hartmans Exp $");
+
static print_header();
static print_trailer();
static space();
* rpc_hout.c, Header file outputter for the RPC protocol compiler
* Copyright (C) 1987, Sun Microsystems, Inc.
*/
+#include <afs/param.h>
+#include <afsconfig.h>
#include <stdio.h>
#include <ctype.h>
#include "rpc_util.h"
#include "rpc_parse.h"
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_hout.c,v 1.1.1.2 2001/07/05 01:04:06 hartmans Exp $");
+
static pconstdef();
static pstructdef();
static puniondef();
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <limits.h>
#include <stdio.h>
-#ifdef AFS_AIX32_ENV
-#include <signal.h>
-#endif
+#include <stdlib.h>
#include <ctype.h>
-#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
-#include <string.h>
-#else
+#ifdef HAVE_STRINGS_H
#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
#endif
-#ifndef AFS_NT40_ENV
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
#include "rpc_util.h"
#include "rpc_parse.h"
#include "rpc_scan.h"
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_main.c,v 1.1.1.4 2001/07/05 01:04:07 hartmans Exp $");
+
#define EXTEND 1 /* alias for TRUE */
struct commandline {
};
#endif
-static c_output();
-static h_output();
-static s_output();
-static l_output();
-static do_registers();
-static parseargs();
+static int c_output();
+static int h_output();
+static int s_output();
+static int l_output();
+static int do_registers();
+static int parseargs();
static int allc = sizeof(allv)/sizeof(allv[0]);
#include "AFS_component_version_number.c"
+int
main(argc, argv)
int argc;
char *argv[];
#if (INT_MAX == 0x7FFFFFFF) && (UINT_MAX == 0xFFFFFFFFu)
f_print(fout, "#ifndef xdr_afs_int32\n");
- f_print(fout, "#ifdef AFS_64BIT_ENV\n");
f_print(fout, "#define xdr_afs_int32 xdr_int\n");
- f_print(fout, "#else\n");
- f_print(fout, "#define xdr_afs_int32 xdr_long\n");
- f_print(fout, "#endif\n");
f_print(fout, "#endif\n");
f_print(fout, "#ifndef xdr_afs_uint32\n");
f_print(fout, "#define xdr_afs_uint32 xdr_u_int\n");
* Copyright (C) 1987 Sun Microsystems, Inc.
*/
#include <afs/param.h>
+#include <afsconfig.h>
+#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
-#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
-#include <string.h>
-#if defined(AFS_SUN5_ENV)
+#ifdef HAVE_STRINGS_H
#include <strings.h>
-#endif
#else
-#include <strings.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#endif
#include "rpc_util.h"
#include "rpc_scan.h"
#include "rpc_parse.h"
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_parse.c,v 1.1.1.3 2001/07/05 01:04:06 hartmans Exp $");
list *proc_defined[MAX_PACKAGES], *special_defined, *typedef_defined, *uniondef_defined;
char *SplitStart = NULL;
static ss_Proc_CodeGeneration();
static ss_ProcName_setup();
static ss_ProcParams_setup();
+static ss_ProcProto_setup();
static ss_ProcSpecial_setup();
static ss_ProcUnmarshallInParams_setup();
static ss_ProcCallRealProc_setup();
}
plist->pl.param_flag |= PROCESSED_PARAM;
for (plist1 = defp->pc.plists; plist1; plist1 = plist1->next) {
- if (streq(plist->pl.param_type, plist1->pl.param_type) && !(plist1->pl.param_flag & PROCESSED_PARAM)) {
+ if ((plist1->component_kind == DEF_PARAM) && streq(plist->pl.param_type, plist1->pl.param_type) && !(plist1->pl.param_flag & PROCESSED_PARAM)) {
char *star="";
char *pntr = index(plist1->pl.param_type, '*');
if (pntr) star = "*";
ss_ProcName_setup(defp);
if (!cflag) {
ss_ProcParams_setup(defp, &somefrees);
+ ss_ProcProto_setup(defp, &somefrees);
ss_ProcSpecial_setup(defp, &somefrees);
ss_ProcUnmarshallInParams_setup(defp);
ss_ProcCallRealProc_setup(defp);
}
plist->pl.param_flag |= PROCESSED_PARAM;
for (plist1 = defp->pc.plists; plist1; plist1 = plist1->next) {
- if (streq(plist->pl.param_type, plist1->pl.param_type) && !(plist1->pl.param_flag & PROCESSED_PARAM)) {
+ if ((plist1->component_kind == DEF_PARAM) && streq(plist->pl.param_type, plist1->pl.param_type) && !(plist1->pl.param_flag & PROCESSED_PARAM)) {
if (plist1->pl.param_flag & INDIRECT_PARAM) {
f_print(fout, ", %s", plist1->pl.param_name);
} else if (index(plist1->pl.param_type, '*') == 0) {
}
+static
+ss_ProcProto_setup(defp, somefrees)
+definition *defp;
+int *somefrees;
+{
+ proc1_list *plist, *plist1;
+ list *listp;
+ definition *defp1;
+ int preserve_flag = 0;
+
+ f_print(fout, "#ifndef KERNEL\n");
+ f_print(fout, "\tafs_int32 %s%s%s%s();\n", prefix, ServerPrefix,
+ PackagePrefix[PackageIndex], defp->pc.proc_name);
+ f_print(fout, "#endif\n");
+}
+
+
static
ss_ProcSpecial_setup(defp, somefrees)
definition *defp;
static
er_ProcMainBody_setup()
{
- f_print(fout, "%s%sExecuteRequest(z_call)\n", prefix, PackagePrefix[PackageIndex]);
+ f_print(fout, "int %s%sExecuteRequest(z_call)\n", prefix, PackagePrefix[PackageIndex]);
f_print(fout, "\tregister struct rx_call *z_call;\n");
f_print(fout, "{\n\tint op;\n");
f_print(fout, "\tXDR z_xdrs;\n");
static
er_HeadofOldStyleProc_setup()
{
- f_print(fout, "\n%s%sExecuteRequest (z_call)\n", prefix, (combinepackages ? MasterPrefix : PackagePrefix[PackageIndex]));
+ f_print(fout, "\nint %s%sExecuteRequest (z_call)\n", prefix, (combinepackages ? MasterPrefix : PackagePrefix[PackageIndex]));
f_print(fout, "\tregister struct rx_call *z_call;\n");
f_print(fout, "{\n");
f_print(fout, "\tint op;\n");
* Copyright (C) 1987, Sun Microsystems, Inc.
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <stdio.h>
+#include <stdlib.h>
#include <ctype.h>
-#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
-#include <string.h>
-#else
+#ifdef HAVE_STRINGS_H
#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#endif
#include "rpc_scan.h"
#include "rpc_util.h"
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_scan.c,v 1.1.1.2 2001/07/05 01:04:07 hartmans Exp $");
+
#define startcomment(where) (where[0] == '/' && where[1] == '*')
#define endcomment(where) (where[-1] == '*' && where[0] == '/')
#define verbatimstart(p) (*(p) == '@' && *((p) + 1) == '{')
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
-#ifndef lint
-static char sccsid[] = "@(#)rpc_svcout.c 1.6 87/06/24 (C) 1987 SMI";
-#endif
/*
* rpc_svcout.c, Server-skeleton outputter for the RPC protocol compiler
* Copyright (C) 1987, Sun Microsytsems, Inc.
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <stdio.h>
-#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
-#include <string.h>
-#else
+#ifdef HAVE_STRINGS_H
#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#endif
#include "rpc_parse.h"
#include "rpc_util.h"
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_svcout.c,v 1.1.1.2 2001/07/05 01:04:07 hartmans Exp $");
+
static char RQSTP[] = "rqstp";
static char TRANSP[] = "transp";
static char ARG[] = "argument";
* Copyright (C) 1987, Sun Microsystems, Inc.
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <stdio.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
#include "rpc_scan.h"
#include "rpc_parse.h"
#include "rpc_util.h"
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_util.c,v 1.1.1.2 2001/07/05 01:04:08 hartmans Exp $");
+
char curline[MAXLINESIZE]; /* current read line */
char *where = curline; /* current point in line */
int linenum = 0; /* current line number */
*/
#include "rxgen_consts.h"
-#ifndef AFS_NT40_ENV
-#ifdef AFS_OSF_ENV
-extern void *malloc();
-#else
-extern char *malloc();
-#endif /* osf */
-#endif /* nt40 */
#define alloc(size) malloc((unsigned)(size))
#define ALLOC(object) (object *) malloc(sizeof(object))
COMPILE_ET = ${SRCDIR}bin/compile_et
MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
-CFLAGS = ${OPTMZ} -I${SRCDIR}include ${XCFLAGS}
+CFLAGS = ${OPTMZ} -I${TOP_SRCDIR}/config -I${SRCDIR}include ${XCFLAGS}
INCLS= ${SRCDIR}include/rx/rx.h \
${SRCDIR}include/rx/xdr.h \
rxkad.h
system: install
clean:
- rm -f *.o tcrypt core *.a rxkad_errs.c rxkad.h AFS_component_version_number.c
+ rm -f *.o tcrypt core *.a rxkad_errs.c rxkad.h AFS_component_version_number.c crypt_conn.c fcrypt.c fcrypt.h sboxes.h
librxkad.a: $(OBJS) ${REGOBJS} AFS_component_version_number.o
-rm -f librxkad.a
install: $(DOMESTIC) $(INCFILES) $(LIBFILE)
+install9x: install
clean::
$(DEL) $(RXKAD_INCFILE) rxkad_errs.c
LIBOBJS = rxstat.cs.o rxstat.ss.o rxstat.xdr.o rxstat.o
+all: librxstat.a includes
+
rxstat.cs.c rxstat.ss.c rxstat.xdr.c rxstat.h: rxstat.xg
${RXGEN} -x rxstat.xg
librxstat.a: ${LIBOBJS} AFS_component_version_number.o
-rm -f $@
- ar rv $@ AFS_component_version_number.o ${LIBOBJS}
+ $(AR) rv $@ AFS_component_version_number.o ${LIBOBJS}
$(RANLIB) $@
kinstall: ${KSRCS}
# directory or online at http://www.openafs.org/dl/license10.html
!INCLUDE ..\config\NTMakefile.$(SYS_NAME)
+!IF (EXIST(..\config\NTMakefile.version))
!INCLUDE ..\config\NTMakefile.version
+!ENDIF
INCFILEDIR = $(DESTDIR)\include
$(RXGEN) -x $**
install: $(LIBFILE) $(INCFILES)
+
+install9x: install
afskauthlib.so: sgi_auth.o ${KAFSLIBS} ${AUTHFILES}
$(LD) ${LDFLAGS} -shared -all -o afskauthlib.so sgi_auth.o $(KAFSLIBS) ${AUTHFILES}
+../inetd/ta-rauth.o: ../inetd/ta-rauth.c
+ (cd ../inetd ; $(MAKE) ta-rauth.o )
+
../rsh/rcmd.o: ../rsh/rcmd.c
(cd ../rsh ; $(MAKE) rcmd.o )
all: test-reauth ${DESTDIR}/lib/afs/libafssiad.so ${DESTDIR}/lib/afs/libafssiad.krb.so
+clean:
+ rm -f test-reauth libafssiad.so libafssiad.krb.so *.s *.o *.b core *~ *.com *.ld AFS_component_version_number.c
+
CFLAGS = $(DEBUG) -I${SRCDIR}include ${XCFLAGS}
${DESTDIR}/lib/afs/libafssiad.so: libafssiad.so
MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
UKERNELDIR=../libuafs/
-CFLAGS= ${DBUG} -I${SRCDIR}include ${XCFLAGS} ${DBG_DEFS}
+CFLAGS= ${DBUG} -I${TOP_SRCDIR}/config -I${SRCDIR}include ${XCFLAGS} ${DBG_DEFS}
SFLAGS=-P -I${SRCDIR}include
LIBS= libsys.a ${SRCDIR}lib/librx.a libsys.a ${SRCDIR}lib/liblwp.a ${SRCDIR}lib/afs/util.a ${XLIBS}
UKSRCS=afsl.exp
clean:
rm -f *.o libsys.a xfsinode iinc idec icreate iopen istat core \
rmtsysc rmtsyss *.o rmtsys.ss.c rmtsys.cs.c rmtsys.xdr.c rmtsys.h \
- rmtsysd AFS_component_version_number.c
+ rmtsysd AFS_component_version_number.c pagsh pagsh.krb
beancount:
wc -l *.c *.s
# Install target; primary makefile target
install: $(INCFILES) $(LIBFILE)
+install9x: install
############################################################################
# Local clean target; augments predefined clean target
clean::
+ $(DEL) $(LIBFILE)
\ No newline at end of file
*/
#include <afs/param.h>
+#include <afsconfig.h>
#ifdef AFS_AIX32_ENV
#include <signal.h>
#endif
#include <stdio.h>
+#include <stdlib.h>
+#ifndef AFS_NT40_ENV
+#include <unistd.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#include <pwd.h>
-
-#ifdef notdef
-/* AFS_KERBEROS_ENV is now conditionally defined in the Makefile */
-#define AFS_KERBEROS_ENV
+#ifdef AFS_KERBEROS_ENV
+#include <sys/types.h>
+#include <sys/stat.h>
#endif
#include "AFS_component_version_number.c"
-main(argc, argv)
+extern afs_int32 setpag();
+
+int main(argc, argv)
int argc;
char **argv;
{
#ifdef AFS_KERBEROS_ENV
/* stolen from auth/ktc.c */
-#include <sys/types.h>
-#include <sys/stat.h>
-
-extern char *malloc();
-
static afs_uint32 curpag()
{
afs_uint32 groups[30];
#include <osi.h>
#include <cm.h>
+#include <cm_dir.h>
#include <cm_cell.h>
#include <cm_user.h>
#include <cm_conn.h>
#include <cm_buf.h>
#include <cm_utils.h>
#include <cm_ioctl.h>
-
+\r
#include <smb.h>
-#include <cm.h>
#include <pioctl_nt.h>
static char AFSConfigKeyName[] =
HKEY parmKey;
DWORD dummyLen;
long code;
+ int hostsize;
if (fileNamep) {
drivep = strchr(fileNamep, ':');
goto havehost;
nogateway:
/* No gateway name in registry; use ourself */
+#ifndef AFS_WIN95_ENV
gethostname(hostName, sizeof(hostName));
+#else
+ /* DJGPP version of gethostname gets the NetBIOS
+ name of the machine, so that is what we are using for
+ the AFS server name instead of the DNS name. */
+ hostsize = sizeof(hostName);
+ GetComputerName(hostName, &hostsize);
+#endif /* AFS_WIN95_ENV */
+
havehost:
ctemp = strchr(hostName, '.'); /* turn ntafs.* into ntafs */
if (ctemp) *ctemp = 0;
hostName, SMB_IOCTL_FILENAME);
}
+ fflush(stdout);
/* now open the file */
fh = CreateFile(tbuffer, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_FLAG_WRITE_THROUGH, NULL);
+ fflush(stdout);
if (fh == INVALID_HANDLE_VALUE)
return -1;
static long UnmarshallLong(fs_ioctlRequest_t *reqp, long *valp)
{
/* not enough data left */
- if (reqp->nbytes < 4) return -1;
+ if (reqp->nbytes < 4) { return -1; }
memcpy(valp, reqp->mp, 4);
reqp->mp += 4;
* calls of setpag, and pioctl are supported.
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#endif
#include <sys/stat.h>
#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#include <rx/xdr.h>
#include "rmtsys.h"
* This module resides in the lib/afs/librmtsys.a library.
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <afs/vice.h>
#include <stdio.h>
#include <rx/xdr.h>
#include <signal.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
/*#include <afs/cellconfig.h>*/
#include "rmtsys.h"
BUTCOBJS = dbentries.obj tcprocs.obj lwps.obj tcmain.obj list.obj recoverDb.obj \
tcudbprocs.obj dump.obj tcstatus.obj butc_xbsa.obj \
$(LWPOBJS) $(BUCOORDOBJS)
-BUTCINCLUDE= -I. -I$(DESTDIR)\include -I$(XBSADIR)\
-BUTCLIBS = $(DESTDIR)\lib\afs\afsbudb.lib \
+BUTCINCLUDE= -I. -I$(DESTDIR)\include -I$(XBSADIR)
+BUTCLIBS=$(DESTDIR)\lib\afs\afsbudb.lib \
$(DESTDIR)\lib\afs\afsbubasics.lib \
$(VOLSERLIBS) \
$(BUTMLIBS) \
$(DESTDIR)\lib\afs\afsreg.lib \
$(DESTDIR)\lib\afs\afsprocmgmt.lib \
$(DESTDIR)\lib\afs\afseventlog.lib \
- $(DESTDIR)\lib\pthread.lib \
+!IF (("$(SYS_NAME)"=="i386_win95" ) || ("$(SYS_NAME)"=="I386_WIN95" ))
+ $(DESTDIR)\lib\win95\pthread.lib \
+!ELSE
+ $(DESTDIR)\lib\pthread.lib \
+!ENDIF
$(DESTDIR)\lib\afsdes.lib
# $(DESTDIR)\lib\afsauthent.lib \
# nmake /nologo /f ntmakefile install
#----------------------------------------------- BUTC
-$(BUTCEXE): $(BUTCOBJS) $(BUTCLIBS)
+$(BUTCEXE): $(BUTCOBJS) $(BUTCLIBS)\r
$(EXECONLINK)
$(EXEPREP)
include ../config/Makefile.${SYS_NAME}
CC=${MT_CC}
-INCLUDES=-I. -I.. -I${SRCDIR}include -I${SRCDIR}include/afs
+INCLUDES=-I${TOP_SRCDIR}/config -I. -I.. -I${SRCDIR}include -I${SRCDIR}include/afs
CFLAGS=${DBG} ${OPTMZ} -DNINTERFACE ${INCLUDES} ${MT_CFLAGS} -DRXDEBUG
LDFLAGS=${DBG} ${XLDFLAGS}
${UTILOBJS} ${DIROBJS} ${VOLOBJS} ${FSINTOBJS}
LIBS= ${SRCDIR}lib/libafsauthent.a \
- ${SRCDIR}lib/libafsrpc.a
+ ${SRCDIR}lib/libafsrpc.a \
+ ${SRCDIR}lib/afs/util.a
include ../config/Makefile.version
include ../config/Makefile.${SYS_NAME}
MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
-CFLAGS=${OPTMZ} -I./ -I${SRCDIR}include ${XCFLAGS}
+CFLAGS=${OPTMZ} -I${TOP_SRCDIR}/config -I./ -I${SRCDIR}include ${XCFLAGS}
UKERNELDIR=../libuafs/
LIBOBJS=disk.o remote.o beacon.o recovery.o ubik.o vote.o lock.o phys.o \
ubik_int.cs.o ubik_int.ss.o ubik_int.xdr.o ubikcmd.o \
clean:
rm -f *.o utst_server utst_client udebug *.a *.cs.c *.ss.c *.xdr.c
- rm -f utst_int.h ubik_int.h uerrors.c ubik.h core AFS_component_version_number.c
+ rm -f utst_int.h ubik_int.h uerrors.c ubik.h core AFS_component_version_number.c Kubik_int.h
system: install
############################################################################
# Install target; primary makefile target
+install9X: $(INCFILES) $(LIBFILE)
+
install: $(INCFILES) $(LIBFILE) $(CL_UDBG_EXEFILE)
* Return Values : 0 on success, non-zero on failure
*/
static verifyInterfaceAddress(ame, info, aservers)
+ afs_uint32 *ame; /* one of my interface addr in net byte order */
struct afsconf_cell *info;
afs_uint32 aservers[]; /* list of all possible server addresses */
- afs_uint32 *ame; /* one of my interface addr in net byte order */
{
afs_uint32 myAddr[UBIK_MAX_INTERFACE_ADDR], *servList, tmpAddr;
int count, index, found, i, j, totalServers, start, end;
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <sys/types.h>
#include <stdlib.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#else
#include <netinet/in.h>
#include <netdb.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#include <signal.h>
#include <time.h>
register afs_int32 total;
total = 0;
- while (tc = *aport++) {
+ while ((tc = *aport++)) {
if (tc < '0' || tc > '9') return -1; /* bad port number */
total *= 10;
total += tc - (int) '0';
usdebug.currentDB, usdebug.up, usdebug.beaconSinceDown);
}
}
+ return (0);
}
#include "AFS_component_version_number.c"
+int
main(argc, argv)
int argc;
char **argv; {
${SRCDIR}lib/libdes.a ${LIBRX} ${SRCDIR}lib/liblwp.a \
${SRCDIR}lib/afs/libcom_err.a ${SRCDIR}lib/afs/util.a \
${SRCDIR}lib/afs/libsys.a
-CFLAGS= ${DBUG} -I${SRCDIR}include ${XCFLAGS}
+CFLAGS= ${DBUG} -I${SRCDIR}include -I${TOP_SRCDIR}/config ${XCFLAGS}
PROGS=upclient upserver
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <afs/stds.h>
#ifdef AFS_AIX32_ENV
#include <signal.h>
#include <sys/time.h>
#include <dirent.h>
#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#include <stdio.h>
#include <errno.h>
#include <rx/xdr.h>
#include <afs/afsutil.h>
#include <afs/fileutil.h>
+RCSID("$Header: /tmp/cvstemp/openafs/src/update/client.c,v 1.1.1.3 2001/07/05 01:04:23 hartmans Exp $");
+
#include "update.h"
#include "global.h"
while(1){/*keep doing it */
char c, c1;
for(df = dirname; df; df=df->next) { /*for each directory do */
- afs_int32 isDir = 0;
char *curDir;
if (verbose) printf ("Checking dir %s\n", df->name);
ZapList(&okhostfiles);
/* construct local path from canonical (wire-format) path */
- if (errcode = ConstructLocalPath(df->name, "/", &curDir)) {
+ if ((errcode = ConstructLocalPath(df->name, "/", &curDir))) {
com_err(whoami, errcode, "Unable to construct local path");
return errcode;
}
goto fail;
}
- while(dp = readdir(dirp)) {
+ while((dp = readdir(dirp))) {
/* for all the files in the directory df->name do*/
strcpy(filename, curDir);
strcat(filename,"/");
char *localname;
/* construct a local path from canonical (wire-format) path */
- if (error = ConstructLocalPath(filename, "/", &localname) ) {
+ if ((error = ConstructLocalPath(filename, "/", &localname))) {
com_err(whoami, error, "Unable to construct local path");
return error;
}
return 0;
}
+int
FetchFile(call, remoteFile, localFile, dirFlag)
struct rx_call *call;
char *localFile, *remoteFile;
{
register char *buffer = (char*) 0;
afs_int32 length;
+#ifdef notdef
XDR xdr;
+#endif
register int blockSize;
afs_int32 error = 0, len;
#ifdef AFS_AIX_ENV
return UPDATE_ERROR;
}
while (!error && length) {
- register nbytes = (length>blockSize?blockSize:length);
+ register int nbytes = (length>blockSize?blockSize:length);
nbytes = rx_Read(call, buffer, nbytes);
if (!nbytes) error = UPDATE_ERROR;
if (write(fd, buffer, nbytes) != nbytes) {
for(tf=okhostfiles; tf; tf=tf->next) {
/* construct local path from canonical (wire-format) path */
- if (rc = ConstructLocalPath(tf->name, "/", &hostfile)) {
+ if ((rc = ConstructLocalPath(tf->name, "/", &hostfile))) {
com_err(whoami, rc, "Unable to construct local path");
return -1;
}
for(tf = modFiles; tf; tf=tf->next) {
/* construct local path from canonical (wire-format) path */
- if (errcode = ConstructLocalPath(tf->name, "/", &fname)) {
+ if ((errcode = ConstructLocalPath(tf->name, "/", &fname))) {
com_err(whoami, errcode, "Unable to construct local path");
return errcode;
}
/* now set the rest of the file status */
errcode = chmod(newfile, mode);
if(errcode){
- printf("could not change protection on %s to %u\n",newfile, mode);
+ printf("could not change protection on %s to %u\n",newfile,
+ (unsigned int) mode);
com_err (whoami, errno,
"could not change protection on %s to %u",
newfile, mode);
errcode = utimes(newfile, tvp);
#endif /* NT40 */
if (errcode) {
- printf("could not change access and modify times on %s to %u %u\n",newfile, atime, mtime);
+ printf("could not change access and modify times on %s to %u %u\n",newfile, (unsigned int) atime, (unsigned int) mtime);
com_err (whoami, errno,
"could not change access and modify times on %s to %u %u",newfile, atime, mtime);
return 1;
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <afs/stds.h>
#ifdef AFS_AIX32_ENV
#include <signal.h>
#include <sys/file.h>
#include <dirent.h>
#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#include <sys/stat.h>
#include <errno.h>
#include <stdio.h>
#include <afs/afsutil.h>
#include <afs/fileutil.h>
+RCSID("$Header: /tmp/cvstemp/openafs/src/update/server.c,v 1.1.1.3 2001/07/05 01:04:23 hartmans Exp $");
+
#include "update.h"
#include "global.h"
-extern UPDATE_ExecuteRequest();
+extern int UPDATE_ExecuteRequest();
static int AddObject(char **expPath, char *dir);
static int PathInDirectory(char *dir, char *path);
int dirLevel[MAXENTRIES];
char *whoami;
-static Quit();
+static int Quit();
/* check whether caller is authorized to manage RX statistics */
int update_rxstat_userok(call)
extern struct rx_securityClass *rxnull_NewServerSecurityObject();
extern afs_int32 afsconf_GetKey();
- int a;
+ int a = 0;
rxkad_level level;
rxkad_level newLevel;
for (a=1; a<argc; a++) {
if (argv[a][0] == '-') { /* parse options */
- int arglen = strlen(argv[a]);
char arg[256];
lcstring (arg, argv[a], sizeof(arg));
-#define IsArg(a) (strncmp (arg,a, arglen) == 0)
newLevel = StringToLevel (&argv[a][1]);
if (newLevel != -1) {
level = newLevel; /* set new level */
rx_StartServer(1); /* Donate this process to the server process pool */
Quit("StartServer returned?");
+ return 0;
}
/* fetch the file name and send it to the remote requester specified by call */
char *reqObject;
/* construct a local path from a canonical (wire-format) path */
- if ( error = ConstructLocalPath(name, "/", &reqObject) ) {
+ if ((error = ConstructLocalPath(name, "/", &reqObject))) {
com_err(whoami, error, "Unable to construct local path");
return UPDATE_ERROR;
}
char *reqObject;
/* construct a local path from a canonical (wire-format) path */
- if ( error = ConstructLocalPath(name, "/", &reqObject) ) {
+ if ((error = ConstructLocalPath(name, "/", &reqObject))) {
com_err(whoami, error, "Unable to construct local path");
return UPDATE_ERROR;
}
return error;
}
-static Quit(msg, a, b)
+static int Quit(msg, a, b)
char *msg;
{
fprintf(stderr, msg, a, b);
char *buffer = (char*) 0;
int blockSize;
afs_int32 length, tlen;
+#ifdef notdef
XDR xdr;
+#endif
#ifdef AFS_AIX_ENV
#include <sys/statfs.h>
struct statfs tstatfs;
rx_Write(call, &tlen, sizeof(afs_int32)); /* send length on fetch */
#endif
while (!error && length) {
- register nbytes = (length>blockSize?blockSize:length);
+ register int nbytes = (length>blockSize?blockSize:length);
nbytes = read(fd, buffer, nbytes);
if (nbytes <= 0) {
fprintf(stderr, "File system read failed\n");
if (!stream) {
error = EIO;
} else {
- while(dp = readdir(dirp)){
+ while((dp = readdir(dirp))){
strcpy(filename, name);
strcat(filename,"/");
strcat(filename,dp->d_name);
strcpy(dirEntry, origDir); strcat(dirEntry, "/");
strcat(dirEntry, dp->d_name);
- err = fprintf(stream, "\"%s\" %u %u %u %u %u %u\n", dirEntry, tstatus.st_mtime,tstatus.st_size,tstatus.st_mode,tstatus.st_uid,tstatus.st_gid, tstatus.st_atime);
+ err = fprintf(stream, "\"%s\" %u %u %u %u %u %u\n", dirEntry,
+ (unsigned int) tstatus.st_mtime,
+ (unsigned int) tstatus.st_size,
+ tstatus.st_mode,
+ tstatus.st_uid,
+ tstatus.st_gid,
+ (unsigned int) tstatus.st_atime);
if (err < 0) error = EIO;
}
err = close(tfd);
struct stat statbuf;
/* construct a local path from a canonical (wire-format) path */
- if ( error = ConstructLocalPath(dir, "/", expPath) ) {
+ if ((error = ConstructLocalPath(dir, "/", expPath))) {
com_err(whoami, error, "Unable to construct local path");
return error;
}
*/
#include <afs/param.h>
+#include <afsconfig.h>
#include <afs/stds.h>
#include <rx/rxkad.h>
#include "global.h"
#include <WINNT/afssw.h>
#endif
#include <stdio.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdlib.h>
+RCSID("$Header: /tmp/cvstemp/openafs/src/update/utils.c,v 1.1.1.3 2001/07/05 01:04:23 hartmans Exp $");
+int
AddToList(ah, aname)
struct filestr **ah;
char *aname; {
return 0;
}
+int
ZapList(ah)
struct filestr **ah; {
register struct filestr *tf, *nf;
RXGEN=${SRCDIR}bin/rxgen
COMPILE_ET = ${SRCDIR}bin/compile_et
-CFLAGS = $(DBG) -I${SRCDIR}include ${XCFLAGS}
+CFLAGS = $(DBG) -I${TOP_SRCDIR}/config -I${SRCDIR}include ${XCFLAGS}
#####################################################################
# include files
# directory or online at http://www.openafs.org/dl/license10.html
!INCLUDE ..\config\NTMakefile.$(SYS_NAME)
-!INCLUDE ..\config\NTMakefile.version
+!IF (EXIST(..\config\NTMakefile.version))
+!include ..\config\NTMakefile.version
+!ENDIF
############################################################################
install: $(INCFILES) $(LIBFILE)
+install9x: install
clean::
-
+ $(DEL) $(LIBFILE)
test:
$(CD) test
COMPONENT=util
include ../config/Makefile.${SYS_NAME}
-CFLAGS = ${OPTMZ} -I$(SRCDIR)include ${XCFLAGS}
+CFLAGS = ${OPTMZ} -I${TOP_SRCDIR}/config -I. -I$(SRCDIR)include ${XCFLAGS}
LDFLAGS = ${OPTMZ} ${XLDFLAGS}
objects = assert.o base64.o casestrcpy.o ktime.o volparse.o hostparse.o \
install: install0 kinstall ukinstall
+install_headers:
+ ${INSTALL} assert.h errors.h vice.h remote.h ktime.h fileutil.h \
+ netutils.h packages.h afsutil.h pthread_glock.h \
+ afs_atomlist.h afs_lhash.h \
+ ${DESTDIR}include/afs
+
kinstall:
${INSTALL} vice.h ../libafs/afs
${INSTALL} base64.c ../libafs/afs/afs_base64.c
install: $(INCFILES) $(LIBFILE)
+
+install9x: install
+
+clean::
+ $(DEL) $(LIBFILE)
\ No newline at end of file
/* Convert a 4 byte integer to a text string. */
extern char* afs_inet_ntoa(afs_uint32 addr);
-
+extern char* afs_inet_ntoa_r(afs_uint32 addr, char *buf);
/* copy strings, converting case along the way. */
extern char *lcstring(char *d, char *s, int n);
#ifdef AFS_NT40_ENV
+#ifndef _MFC_VER
#include <winsock2.h>
+#endif /* _MFC_VER */
/* Initialize the windows sockets before calling networking routines. */
extern int afs_winsockInit(void);
char *int64_to_flipbase64(lb64_string_t s, u_int64_t a)
#endif
{
- int i, j;
+ int i;
#ifdef AFS_64BIT_ENV
afs_int64 n;
#else
return (char *) inet_ntoa(temp);
}
+/* same as above, but to a non-static buffer, must be freed by called */
+char* afs_inet_ntoa_r(afs_uint32 addr, char *buf)
+{
+ int temp;
+
+ temp = ntohl(addr);
+ sprintf(buf, "%d.%d.%d.%d",
+ (temp >> 24 ) & 0xff,
+ (temp >> 16 ) & 0xff,
+ (temp >> 8 ) & 0xff,
+ (temp ) & 0xff);
+ return buf;
+}
+
/*
* gettmpdir() -- Returns pointer to global temporary directory string.
* Always succeeds. Never attempt to deallocate directory string.
int printLocks = 0;
static char ourName[MAXPATHLEN];
+void WriteLogBuffer(buf,len)
+ char *buf;
+ afs_uint32 len;
+{
+ LOCK_SERVERLOG();
+ if (serverLogFD > 0)
+ write(serverLogFD, buf, len);
+ UNLOCK_SERVERLOG();
+}
+
/* VARARGS1 */
void FSLog (const char *format, ...)
{
/* snprintf.c - Formatted, length-limited print to a string */
#include <afs/param.h>
-#if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || defined(AFS_NT40_ENV)
+#if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || (defined(AFS_SUN55_ENV) && !defined(AFS_SUN56_ENV))
#include <sys/types.h>
#include <stdarg.h>
#include <stdio.h>
#include <ctype.h>
#include <netinet/in.h>
#include <netdb.h>
-#if defined(AFS_AIX32_ENV)
+#if defined(AFS_AIX32_ENV) || defined(AFS_SUN55_ENV)
#include <sys/socket.h>
#endif
*/
#include <afs/param.h>
-#if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
-#include <string.h>
-#else
+#include <afsconfig.h>
+#ifdef HAVE_STRINGS_H
#include <strings.h>
+#else
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#endif
-#ifdef AFS_NT40_ENV
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
negative = 0;
/* skip over leading spaces */
- while (tc = *as) {
+ while ((tc = *as)) {
if (tc != ' ' && tc != '\t') break;
}
else base = 10;
/* compute the # itself */
- while(tc = *as) {
+ while((tc = *as)) {
if (!ismeta(tc, base)) return -1;
total *= base;
total += getmeta(tc);
total = 0; /* initialize things */
/* skip over leading spaces */
- while (tc = *as) {
+ while ((tc = *as)) {
if (tc != ' ' && tc != '\t') break;
}
else base = 10;
/* compute the # itself */
- while(tc = *as) {
+ while((tc = *as)) {
if (!ismeta(tc, base)) return -1;
total *= base;
total += getmeta(tc);
blob.out = cellname;
code = pioctl(fname, VIOC_FILE_CELL_NAME, &blob, 1);
- return code;
+ return code ? errno : 0;
}
/* Check if a username is valid: If it contains only digits (or a
if (errno == ENOENT)
fprintf(stderr,"%s: no such cell as '%s'\n", pn, ti->data);
else
- Die(code, ti->data);
+ Die(errno, ti->data);
error = 1;
continue;
}
struct ViceIoctl blob;
struct cmd_item *ti;
char *input = space;
- afs_int32 setp = 1;
+ afs_int32 setp = 0;
ti = as->parms[0].items;
- if (!ti) setp = 0;
blob.in = space;
blob.out = space;
blob.out_size = MAXSIZE;
blob.in_size = sizeof(afs_int32);
- bcopy(&setp, input, sizeof(afs_int32));
input += sizeof(afs_int32);
- if (ti) {
- strcpy(input, ti->data);
+ for(; ti; ti=ti->next) {
+ setp++;
blob.in_size += strlen(ti->data) + 1;
+ if (blob.in_size > MAXSIZE) {
+ fprintf(stderr, "%s: sysname%s too long.\n", pn, setp > 1 ? "s" : "");
+ return 1;
+ }
+ strcpy(input, ti->data);
input += strlen(ti->data);
*(input++) = '\0';
}
+ bcopy(&setp, space, sizeof(afs_int32));
code = pioctl(0, VIOC_AFS_SYSNAME, &blob, 1);
if (code) {
Die(errno, 0);
return 1;
}
if (setp) {
- printf("%s: new sysname set.\n", pn);
+ printf("%s: new sysname%s set.\n", pn, setp > 1 ? " list" : "");
return 0;
}
input = space;
fprintf(stderr, "No sysname name value was found\n");
return 1;
}
- printf("Current sysname is '%s'\n", input);
+ printf("Current sysname%s is:", setp>1 ? " list" : "");
+ for(;setp>0;--setp) {
+ printf(" %s", input);
+ input += strlen(input) + 1;
+ }
+ printf("\n");
return 0;
}
blob.out_size = 0;
code = pioctl(0, VIOC_SETRXKCRYPT, &blob, 1);
if (code)
- Die(code, (char *) 0);
+ Die(errno, (char *) 0);
return 0;
}
code = pioctl(0, VIOC_GETRXKCRYPT, &blob, 1);
- if (code) Die(code, (char *) 0);
+ if (code) Die(errno, (char *) 0);
else {
tp = space;
bcopy(tp, &flag, sizeof(afs_int32));
cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
ts = cmd_CreateSyntax("sysname", SysNameCmd, 0, "get/set sysname (i.e. @sys) value");
- cmd_AddParm(ts, "-newsys", CMD_SINGLE, CMD_OPTIONAL, "new sysname");
+ cmd_AddParm(ts, "-newsys", CMD_LIST, CMD_OPTIONAL, "new sysname");
ts = cmd_CreateSyntax("exportafs", ExportAfsCmd, 0, "enable/disable translators to AFS");
cmd_AddParm(ts, "-type", CMD_SINGLE, 0, "exporter name");
/* ************************************************************* */
#include <afs/param.h>
+#include <afsconfig.h>
#include <errno.h>
#ifdef AFS_AIX32_ENV
#include <signal.h>
#undef _NONSTD_TYPES
#endif
#include <stdio.h>
+#include <afs/afs_args.h>
#include <sys/param.h>
#ifdef AFS_SUN5_ENV
#include <fcntl.h>
#include <afs/vice.h>
#undef VIRTUE
#undef VICE
+#include <sys/ioctl.h>
+#include <netdb.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <afs/venus.h>
/* ************************************************************* */
Boolean renameTargets = false;
Boolean oneLevel = false;
Boolean preserveDate = true;
+Boolean preserveMountPoints = false;
Boolean forceOverwrite = false;
int pageSize;
Boolean oldAcl = false;
char file1[MAXPATHLEN], file2[MAXPATHLEN];
+#define MAXSIZE 2048
+static char space[MAXSIZE];
+
struct OldAcl {
int nplus;
int nminus;
preserveDate = false;
break;
+ case 'm':
+ preserveMountPoints = true;
+ break;
+
default:
fprintf(stderr, "Unknown option: '%c'\n", *cp);
- fprintf(stderr, "usage: up [-v1frx] from to\n");
+ fprintf(stderr, "usage: up [-v1frxm] from to\n");
exit(1);
}
argc--, argv++;
exit(1);
}
- strcpy(file1, argv[0]);
- strcpy(file2, argv[1]);
+ strncpy(file1, argv[0], MAXPATHLEN);
+ strncpy(file2, argv[1], MAXPATHLEN);
} /*ScanArgs*/
return 1;
}
} /*Dealing with symlink*/
+
+ else if ( preserveMountPoints && (code=isMountPoint( file1, &blob )) ) {
+ /*
+ * --------------------- Copy mount point --------------------
+ */
+
+ if ( code > 1 ) {
+ perror("checking for mount point ");
+ return 1;
+ }
+ if (verbose) {
+ printf("Level %d: Mount point %s to %s\n", level, file1, file2);
+ fflush(stdout);
+ }
+
+ /* Don't ovewrite a write protected directory (unless force: -f) */
+ if (!forceOverwrite && goods2 && (s2.st_mode & 0200) == 0) {
+ fprintf(stderr,
+ "Target %s is write protected against its owner; not changed\n",
+ file2);
+ return 1;
+ }
+
+ if (verbose) {
+ printf(" Copy mount point %s for vol %s to %s\n", file1, blob.out, file2);
+ fflush(stdout);
+ }
+
+ unlink(file2); /* Always make the new link (it was easier) */
+
+ strcat(blob.out, "."); /* stupid convention; these end with a period */
+ code = symlink(blob.out, file2);
+ if (code == -1) {
+ fprintf(stderr, "Could not create mount point %s for vol %s\n", file2, blob.out);
+ perror("create mount point ");
+ return 1;
+ }
+
+ } /*Dealing with mount point*/
else if (((s1.st_mode & S_IFMT) == S_IFDIR) && (recursive || (level == 0))) {
/*
return rcode;
} /*Copy*/
+
+
+int isMountPoint( name, blob )
+ char *name;
+ struct ViceIoctl *blob;
+{
+ afs_int32 code;
+ char true_name[1024]; /*dirname*/
+ char parent_dir[1024]; /*Parent directory of true name*/
+ char *last_component; /*Last component of true name*/
+
+ sprintf(true_name, "%s%s",
+ (name[0] == '/') ? "" : "./",
+ name);
+
+ /*
+ * Find rightmost slash, if any.
+ */
+ last_component = (char *) rindex(true_name, '/');
+ if (last_component) {
+ /*
+ * Found it. Designate everything before it as the parent directory,
+ * everything after it as the final component.
+ */
+ strncpy(parent_dir, true_name, last_component - true_name);
+ parent_dir[last_component - true_name] = 0;
+ last_component++; /*Skip the slash*/
+ }
+ else {
+ /*
+ * No slash appears in the given file name. Set parent_dir to the current
+ * directory, and the last component as the given name.
+ */
+ strcpy(parent_dir, ".");
+ last_component = true_name;
+ }
+
+ if (strcmp(last_component, ".") == 0 || strcmp(last_component, "..") == 0) {
+ fprintf(stderr, "up: you may not use '.' or '..' as the last component\n");
+ fprintf(stderr, "up: of a name in the 'up' command.\n");
+ return 3;
+ }
+
+ blob->in = last_component;
+ blob->in_size = strlen(last_component)+1;
+ blob->out_size = MAXSIZE;
+ blob->out = space;
+ bzero(space, MAXSIZE);
+
+ code = pioctl(parent_dir, VIOC_AFS_STAT_MT_PT, blob, 0);
+
+ if (code == 0) {
+ printf("'%s' is a mount point for volume '%s'\n", name, space);
+ fflush(stdout);
+ return 1;
+ }
+ else {
+ if (errno == EINVAL) {
+ /* printf( "'%s' is not a mount point.\n", name);
+ * fflush(stdout);
+ */
+ return 0;
+ }
+ else {
+ fprintf( stderr, "problem examining '%s' in '%s'.\n", last_component, parent_dir );
+ return 2;
+ /* Die(errno, (ti->data ? ti->data : parent_dir));
+ */
+ }
+ }
+ return 4;
+}
#if defined(AFS_HPUX100_ENV)
mflag = 0;
#endif
- printf("----Transarc AFS (R) %s fsck----\n", AFSVersion); /* generated version */
+ printf("----Open AFS (R) %s fsck----\n", AFSVersion); /* generated version */
if (access("/TRYFORCE", 0) == 0)
tryForce = 1;
while (--argc > 0 && **++argv == '-') {
include ../config/Makefile.${SYS_NAME}
DBUG = -g
-CFLAGS = -DNINTERFACE ${DBUG} -I. -I${SRCDIR}include -I${SRCDIR}include/afs \
+CFLAGS = -DNINTERFACE ${DBUG} \
+ -I${TOP_SRCDIR}/config -I. -I${SRCDIR}include -I${SRCDIR}include/afs \
${XCFLAGS} ${DBG_DEFS} -DRXDEBUG
LDFLAGS = ${DBUG} ${XLDFLAGS}
fileserver: viced.o ${objects} ${headers} ${LIBS}
set -x; \
case ${SYS_NAME} in \
- *linux*) \
+ *linux* | *fbsd* ) \
${CC} ${LDFLAGS} -o fileserver ${objects} \
${auditlib} ${LIBS} ${XLIBS} ;; \
rs_aix*) \
system: install
clean:
- rm -f *.o llib-lvice.ln fileserver core AFS_component_version_number.c
+ rm -f *.o llib-lvice.ln fileserver core AFS_component_version_number.c cbd check_sysid fsprobe
beancount:
wc -l *.c *.h
goto retry;
}
} else {
- ViceLog(0,("CB: WhoAreYou failed for %x.%d, error %d\n",
- host->host, host->port, code));
- host->hostFlags |= VENUSDOWN;
+ char hoststr[16];
+ afs_inet_ntoa_r(host->host, hoststr);
+ ViceLog(0,("CB: WhoAreYou failed for %s:%d, error %d\n",
+ hoststr, ntohs(host->port), code));
+ host->hostFlags |= VENUSDOWN;
}
host->hostFlags |= ALTADDR;
h_Unlock_r(host);
}
}
if (code) {
- ViceLog(0,("CB: RCallBackConnectBack failed for %x.%d\n",
- host->host, host->port));
- host->hostFlags |= VENUSDOWN;
+ char hoststr[16];
+ afs_inet_ntoa_r(host->host, hoststr);
+ ViceLog(0,("CB: RCallBackConnectBack failed for %s:%d\n",
+ hoststr, ntohs(host->port)));
+ host->hostFlags |= VENUSDOWN;
}
else
host->hostFlags |= RESETDONE;
host->hostFlags |= ALTADDR; /* alternate addresses valid */
if ( code )
{
- ViceLog(0,
- ("CB: RCallBackConnectBack (host.c) failed for host %x.%d\n",
- host->host, host->port));
- host->hostFlags |= VENUSDOWN;
- }
+ char hoststr[16];
+ afs_inet_ntoa_r(host->host, hoststr);
+ ViceLog(0,
+ ("CB: RCallBackConnectBack (host.c) failed for host %s:%d\n",
+ hoststr, ntohs(host->port)));
+ host->hostFlags |= VENUSDOWN;
+ }
/* Note: it's safe to delete hosts even if they have call
* back state, because break delayed callbacks (called when a
* message is received from the workstation) will always send a
H_LOCK
if(code) {
if ( MultiProbeAlternateAddress_r(host) ) {
- ViceLog(0,
- ("ProbeUuid failed for host %x.%d\n",
- host->host, host->port));
- host->hostFlags |= VENUSDOWN;
+ char hoststr[16];
+ afs_inet_ntoa_r(host->host, hoststr);
+ ViceLog(0,
+ ("ProbeUuid failed for host %s:%d\n",
+ hoststr, ntohs(host->port)));
+ host->hostFlags |= VENUSDOWN;
}
}
} else {
code = RXAFSCB_Probe(host->callback_rxcon);
H_LOCK
if (code) {
- ViceLog(0, ("ProbeUuid failed for host %x.%d\n",
- host->host, host->port));
- host->hostFlags |= VENUSDOWN;
+ char hoststr[16];
+ afs_inet_ntoa_r(host->host, hoststr);
+ ViceLog(0, ("ProbeUuid failed for host %s:%d\n",
+ hoststr, ntohs(host->port)));
+ host->hostFlags |= VENUSDOWN;
}
}
}
ViceLog(0, ("Can't find address for FileServer '%s'\n", FS_HostName));
}
else {
- bcopy(he->h_addr, &FS_HostAddr_NBO, 4);
- FS_HostAddr_HBO = ntohl(FS_HostAddr_NBO);
- ViceLog(0,("FileServer %s has address 0x%x (0x%x in host byte order)\n",
- FS_HostName, FS_HostAddr_NBO, FS_HostAddr_HBO));
+ char hoststr[16];
+ bcopy(he->h_addr, &FS_HostAddr_NBO, 4);
+ afs_inet_ntoa_r(FS_HostAddr_NBO, hoststr);
+ FS_HostAddr_HBO = ntohl(FS_HostAddr_NBO);
+ ViceLog(0,("FileServer %s has address %s (0x%x or 0x%x in host byte order)\n",
+ FS_HostName, hoststr, FS_HostAddr_NBO, FS_HostAddr_HBO));
}
/* Install handler to catch the shutdown signal */
ViceLog(2, ("Set disk usage statistics\n"));
VSetDiskUsage();
if (FS_registered == 1) Do_VLRegisterRPC();
-#ifndef AFS_QUIETFS_ENV
if(printBanner && (++msg&1)) { /* Every 10 minutes */
time_t now = FT_ApproxTime();
if (console != NULL) {
+#ifndef AFS_QUIETFS_ENV
fprintf(console,"File server is running at %s\r",
afs_ctime(&now, tbuffer, sizeof(tbuffer)));
+#endif /* AFS_QUIETFS_ENV */
+ ViceLog(2, ("File server is running at %s\n",
+ afs_ctime(&now, tbuffer, sizeof(tbuffer))));
}
}
-#endif /* AFS_QUIETFS_ENV */
}
} /*FiveMinuteCheckLWP*/
rx_PrintStats(debugFile);
fflush(debugFile);
}
-#ifndef AFS_QUIETFS_ENV
if (console != NULL) {
now = time(0);
- if (dopanic)
+ if (dopanic) {
+#ifndef AFS_QUIETFS_ENV
fprintf(console, "File server has terminated abnormally at %s\r",
afs_ctime(&now, tbuffer, sizeof(tbuffer)));
- else
+#endif
+ ViceLog(0, ("File server has terminated abnormally at %s\n",
+ afs_ctime(&now, tbuffer, sizeof(tbuffer))));
+ } else {
+#ifndef AFS_QUIETFS_ENV
fprintf(console, "File server has terminated normally at %s\r",
afs_ctime(&now, tbuffer, sizeof(tbuffer)));
- }
#endif
+ ViceLog(0, ("File server has terminated normally at %s\n",
+ afs_ctime(&now, tbuffer, sizeof(tbuffer))));
+ }
+ }
exit(0);
UKERNELDIR=../libuafs/
COMPILE_ET = ${SRCDIR}bin/compile_et
-CFLAGS = ${DBUG} -I. -I.. -I${SRCDIR}include ${XCFLAGS}
+CFLAGS = ${DBUG} -I. -I.. -I${TOP_SRCDIR}/config -I${SRCDIR}include ${XCFLAGS}
INCLS=${SRCDIR}include/ubik.h \
${SRCDIR}include/lwp.h \
${SRCDIR}include/lock.h \
${INSTALL} cnvldb.h ${DESTDIR}include/afs
${INSTALL} vldb_check ${DESTDIR}/etc
+libinstall: libvldb.a
+ ${INSTALL} libvldb.a ${DESTDIR}lib/afs
+ ${INSTALL} vl_opcodes.h vlserver.h vldbint.h ${DESTDIR}include/afs
+ ${INSTALL} cnvldb.h ${DESTDIR}include/afs
# Override default definitions in NTMakefile.$(SYS_NAME) before including.
!INCLUDE ..\config\NTMakefile.$(SYS_NAME)
-!INCLUDE ..\config\NTMakefile.version
+!include ..\config\NTMakefile.version
############################################################################
install: $(INCFILES) $(LIBFILE) $(VLSERVER) vldb_check.exe vlclient.exe \
$(MT_LIBFILE)
+install9x: install
+
+install_libutils: $(INCFILES) $(LIBFILE)
+
############################################################################
# clean up
#endif
} else {
/* support help flag */
- printf("Usage: vlserver [-p <number of processes>] [-nojumbo] "
#ifndef AFS_NT40_ENV
+ printf("Usage: vlserver [-p <number of processes>] [-nojumbo] "
"[-syslog[=FACILITY]] "
-#endif
- /*" [-enable_peer_stats] [-enable_process_stats] " */
+ "[-enable_peer_stats] [-enable_process_stats] "
"[-help]\n");
+#else
+ printf("Usage: vlserver [-p <number of processes>] [-nojumbo] "
+ "[-enable_peer_stats] [-enable_process_stats] "
+ "[-help]\n");
+#endif
fflush(stdout);
exit(0);
}
}
bcopy(th->h_addr,&myHost,sizeof(afs_int32));
-#if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV)
+#if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_DJGPP_ENV)
signal(SIGXCPU, CheckSignal_Signal);
#endif
/* get list of servers */
include ../config/Makefile.${SYS_NAME}
include ../config/Makefile.version
-INCDIRS= -I. -I${DESTDIR}include ${FSINCLUDES}
+INCDIRS= -I${TOP_SRCDIR}/config -I. -I${DESTDIR}include ${FSINCLUDES}
LDFLAGS = ${OPTMZ} ${PROF} ${LDIRS} ${XLDFLAGS}
LIBS= ${DESTDIR}lib/afs/libcmd.a vlib.a ${SRCDIR}lib/afs/util.a \
volinfo: vol-info.o physio.o ihandle.o
case ${SYS_NAME} in \
- *linux*) \
+ *linux* | *fbsd*) \
${CC} ${CFLAGS} ${DBG} -o volinfo vol-info.o physio.o \
ihandle.o ${LIBS} ;; \
*) \
clean:
rm -f *.o *.a AFS_component_version_number.c
- rm -f ${SCMPROGS} ${STAGEPROGS} core
+ rm -f ${SCMPROGS} ${STAGEPROGS} core salvager volinfo gi fs_conv_sol26 fs_conv_dux40D
+
beancount:
wc -l *.c *.h
#ifdef AFS_SUN5_ENV
#include <sys/fs/ufs_inode.h>
#else
-#if defined(AFS_DARWIN_ENV)
+#if !defined(AFS_DARWIN_ENV)
#include <ufs/inode.h>
#endif
#endif
{
lb64_string_t str;
int vno = (int)(ih->ih_ino & NAMEI_VNODEMASK);
- int tmp;
namei_HandleToVolDir(name, ih);
static int namei_CreateDataDirectories(namei_t *name, int *created)
{
char tmp[256];
- char *s;
- int i;
*created = 0;
DIR *ds;
struct dirent *dirp;
struct stat st;
- int er;
if (*tree) {
/* delete the children first */
/* now delete all entries in this dir */
if ( (ds = opendir(root)) != (DIR *)NULL) {
errno = 0;
- while (dirp = readdir(ds)) {
+ while ((dirp = readdir(ds))) {
/* ignore . and .. */
if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
continue;
/* GetOGM - get parm and tag from owner, group and mode bits. */
static void GetOGMFromStat(struct stat *status, int *parm, int *tag)
{
- int tmp;
-
*parm = status->st_uid | (status->st_gid << 15);
*parm |= (status->st_mode & 0x18) << 27;
*tag = status->st_mode & 0x7;
Inode namei_icreate(IHandle_t *lh, char *part, int p1, int p2, int p3, int p4)
{
namei_t name;
- namei_ogm_t ogm;
- b32_string_t str1;
- char *p;
- int i;
int fd = -1;
int code = 0;
int created_dir = 0;
IHandle_t tmp;
FdHandle_t *fdP;
FdHandle_t tfd;
- int save_errno;
int tag;
int ogm_parm;
if ((ino & NAMEI_INODESPECIAL) == NAMEI_INODESPECIAL) {
IHandle_t *tmp;
- int was_closed = 0;
int inode_p1, tag;
int type = (int)((ino>>NAMEI_TAGSHIFT) & NAMEI_TAGMASK);
int namei_GetLinkCount(FdHandle_t *h, Inode ino, int lockit)
{
unsigned short row = 0;
- int junk;
int offset, index;
namei_GetLCOffsetAndIndexFromIno(ino, &offset, &index);
dirp1 = opendir(name.n_path);
if (!dirp1)
return 0;
- while (dp1 = readdir(dirp1)) {
+ while ((dp1 = readdir(dirp1))) {
if (*dp1->d_name == '.') continue;
(void) strcpy(path2, name.n_path);
(void) strcat(path2, "/");
(void) strcat(path2, dp1->d_name);
dirp2 = opendir(path2);
if (dirp2) {
- while (dp2 = readdir(dirp2)) {
+ while ((dp2 = readdir(dirp2))) {
if (*dp2->d_name == '.') continue;
if (!DecodeVolumeName(dp2->d_name, &ih.ih_vid)) {
ninodes += namei_ListAFSSubDirs(&ih, writeFun, fp,
int (*judgeFun)(struct ViceInodeInfo *, int),
int singleVolumeNumber)
{
- int i;
IHandle_t myIH = *dirIH;
namei_t name;
char path1[512], path2[512], path3[512];
DIR *dirp1, *dirp2, *dirp3;
struct dirent *dp1, *dp2, *dp3;
- char *s;
struct ViceInodeInfo info;
- int tag, vno;
FdHandle_t linkHandle;
int ninodes = 0;
#ifdef DELETE_ZLC
+ int i;
static void AddToZLCDeleteList(char dir, char *name);
static void DeleteZLCFiles(char *path);
#endif
linkHandle.fd_fd = -1;
dirp1 = opendir(path1);
if (dirp1) {
- while (dp1 = readdir(dirp1)) {
+ while ((dp1 = readdir(dirp1))) {
if (*dp1->d_name == '.') continue;
if (DecodeInode(path1, dp1->d_name, &info, myIH.ih_vid)<0)
continue;
dirp1 = opendir(path1);
if (dirp1) {
- while (dp1 = readdir(dirp1)) {
+ while ((dp1 = readdir(dirp1))) {
if (*dp1->d_name == '.') continue;
if (!strcmp(dp1->d_name, NAMEI_SPECDIR))
continue;
(void) strcat(path2, dp1->d_name);
dirp2 = opendir(path2);
if (dirp2) {
- while (dp2 = readdir(dirp2)) {
+ while ((dp2 = readdir(dirp2))) {
if (*dp2->d_name == '.') continue;
/* Now we've got to the actual data */
(void) strcat(path3, dp2->d_name);
dirp3 = opendir(path3);
if (dirp3) {
- while (dp3 = readdir(dirp3)) {
+ while ((dp3 = readdir(dirp3))) {
if (*dp3->d_name == '.') continue;
if (DecodeInode(path3, dp3->d_name, &info,
myIH.ih_vid)<0)
if (vp->specialStatus == VBUSY)
isbusy = 1;
VDetachVolume_r(ec, vp);
+ if ( *ec ) {
+ Log("VAttachVolume: Error detaching volume (%s)\n", name);
+ }
}
}
if (!(partp = VGetPartition_r(partition, 0))) {
*ec = VNOVOL;
+ Log("VAttachVolume: Error getting partition (%s)\n", partition);
goto done;
}
#endif
VUpdateVolume_r(ec,vp);
if (*ec) {
+ Log("VAttachVolume: Error updating volume\n");
if (vp)
VPutVolume_r(vp);
goto done;
V_dontSalvage(vp) = DONT_SALVAGE;
VAddToVolumeUpdateList_r(ec,vp);
if (*ec) {
+ Log("VAttachVolume: Error adding volume to update list\n");
if (vp)
VPutVolume_r(vp);
goto done;
(char *)&V_disk(vp), sizeof(V_disk(vp)),
VOLUMEINFOMAGIC, VOLUMEINFOVERSION);
VOL_LOCK
+ if (*ec) {
+ Log("VAttachVolume: Error reading diskDataHandle vol header %s; error=%d\n",
+ path, *ec);
+ }
if (!*ec) {
struct IndexFileHeader iHead;
(char *)&iHead, sizeof(iHead),
SMALLINDEXMAGIC, SMALLINDEXVERSION);
VOL_LOCK
+ if (*ec) {
+ Log("VAttachVolume: Error reading smallVnode vol header %s; error=%d\n",
+ path, *ec);
+ }
}
if (!*ec) {
struct IndexFileHeader iHead;
(char *)&iHead, sizeof(iHead),
LARGEINDEXMAGIC, LARGEINDEXVERSION);
VOL_LOCK
+ if (*ec) {
+ Log("VAttachVolume: Error reading largeVnode vol header %s; error=%d\n",
+ path, *ec);
+ }
}
#ifdef AFS_NAMEI_ENV
if (!*ec) {
(char *)&stamp, sizeof(stamp),
LINKTABLEMAGIC, LINKTABLEVERSION);
VOL_LOCK
+ if (*ec) {
+ Log("VAttachVolume: Error reading namei vol header %s; error=%d\n",
+ path, *ec);
+ }
}
#endif
if (*ec) {
- Log("VAttachVolume: Error attaching volume %s; volume needs salvage\n",
- path);
+ Log("VAttachVolume: Error attaching volume %s; volume needs salvage; error=%d\n",
+ path, *ec);
FreeVolume(vp);
return NULL;
}
VOL_LOCK
if (*ec) {
FreeVolume(vp);
+ Log("VAttachVolume: error getting bitmap for volume (%s)\n", path);
return NULL;
}
}
CFLAGS=${DBG} ${OPTMZ} -I${SRCDIR}include ${XCFLAGS} ${DBG_DEFS}
LDFLAGS=${DBG} ${OPTMZ} ${XLDFLAGS}
-INCDIRS= -I${SRCDIR}include/afs -I${SRCDIR}include
+INCDIRS= -I${TOP_SRCDIR}/config -I${SRCDIR}include/afs -I${SRCDIR}include
INCLIBS=-L${SRCDIR}lib/afs -L${SRCDIR}lib
VINCLS=${SRCDIR}include/afs/partition.h ${SRCDIR}include/afs/volume.h \
volserver: $(SOBJS) $(LIBS) $(HACKS)
case ${SYS_NAME} in \
- *linux*) \
+ *linux* | *fbsd* ) \
${CC} ${DBUG} -o volserver $(SOBJS) $(HACKS) \
${LDFLAGS} $(LIBS) ${XLIBS} ;; \
*) \
clean:
rm -f volserver *.o volint.ss.c volint.cs.c *.a volint.h \
- volint.xdr.c vos core volser.h volerr.c AFS_component_version_number.c
+ volint.xdr.c vos core volser.h volerr.c AFS_component_version_number.c restorevol
lint: vos.c vsprocs.c volmain.c volprocs.c lockprocs.c
lint -hb ${INCDIRS} ${INCLIBS} vos.c
pntr->status = 0; /*things are messed up */
strcpy(pntr->name,volname);
pntr->volid = volid;
- Log("1 Volser: ListVolumes: Could not attach volume %u\n",volid);
+ Log("1 Volser: ListVolumes: Could not attach volume %u (%s:%s), error=%d\n",volid,pname,volname,error);
goto drop;
}
if(tv->header->diskstuff.destroyMe == DESTROY_ME) {
pntr->status = 0;
strcpy(pntr->name,volname);
pntr->volid = volid;
- Log("1 Volser: ListVolumes: Volume %u will be destroyed on next salvage\n",volid);
+ Log("1 Volser: ListVolumes: Volume %u (%s) will be destroyed on next salvage\n",volid,volname);
goto drop;
}
pntr->status = 0;
strcpy(pntr->name,volname);
pntr->volid = volid;
- Log("1 Volser: ListVolumes: Volume %u needs to be salvaged\n",volid);
+ Log("1 Volser: ListVolumes: Volume %u (%s) needs to be salvaged\n",volid,volname);
goto drop;
}
pntr->status = 0; /*things are messed up */
strcpy(pntr->name,volname);
pntr->volid = volid;
- Log("1 Volser: ListVolumes: Could not attach volume %u\n",volid);
+ Log("1 Volser: ListVolumes: Could not attach volume %u (%s) error=%d\n",volid,volname,error);
goto drop;
}
if(tv->header->diskstuff.needsSalvaged){
pntr->status = 0;
strcpy(pntr->name,volname);
pntr->volid = volid;
- Log("1 Volser: ListVolumes: Volume %u needs to be salvaged\n",volid);
+ Log("1 Volser: ListVolumes: Volume %u (%s) needs to be salvaged\n",volid, volname);
goto drop;
}
ts = cmd_CreateSyntax("release", ReleaseVolume, 0, "release a volume");
cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID");
- cmd_AddParm(ts, "-f", CMD_FLAG, CMD_OPTIONAL, "force a complete release");
+ cmd_AddParm(ts, "-force", CMD_FLAG, CMD_OPTIONAL, "force a complete release");
COMMONPARMS;
ts = cmd_CreateSyntax("dump", DumpVolume, 0, "dump a volume");
* clone the read/write volume locally.
* ***/
- if (verbose) fprintf(STDOUT,"Starting transaction on source volume %u ...",afromvol);
+ if (verbose) fprintf(STDOUT,"Starting transaction on source volume %u ...",afromvol);
fflush(STDOUT);
code = AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy, &fromtid);
ONERR (code, "Failed to create transaction on the volume %u\n", afromvol);
}
code = afsconf_ClientAuth(tdir, &sc, &scIndex); /* sets sc,scIndex */
if (code) {
- fprintf(STDERR, "vsu_ClientInit: Could not get security object for -localAuth %\n");
+ fprintf(STDERR, "vsu_ClientInit: Could not get security object for -localAuth\n");
return -1;
}
code = afsconf_GetCellInfo(tdir, tdir->cellName, AFSCONF_VLDBSERVICE,