File: AAA_VMS_2_2_0_PORT.TXT 21-May-2001 J. Malmberg Porting log for SAMBA 2.2.0 to OpenVMS. Issues noted with the 2.0.8 version that are not resolved with 2.2.0 [.client]client.c The new file needs an edit for a prompt. OpenVMS uses Control-Z for end of file, and UNIX uses Control-D by default. Note while OpenVMS is coded this way in the driver, it appears that this can be changed for some versions of UNIX like operating system. [.lib]interface.c The OpenVMS version has a bug fix needed to prevent an access violation in some cases. This bug fix apparently did not make it into the 2.0.7 or 2.0.8 releases. It does not appear to be fixed in SAMBA 2.2.0 [.smbd]connection.c The OpenVMS version has a change to allow running the SMBD multiple times in an interactive session. Need to check if this is still an issue. New notes: Used the @CONFIGURE_THIS.COM procedure to generate logical names and search paths for the build. $@CONFIGURE_THIS.COM SAMBA_VMS CMS_ROOT: CMS_ROOT:[SAMBA_VMS] Then used CONFIG_H.COM to create a new CONFIG.H. Hand edited CONFIG_VMS.H for a first try, guessing at some options. 22-May-2001 J. Malmberg Attempted a MMS build. It died because it could not parse "../tdb/tdb.h". Relative UNIX style path names do not work well. This use of relative path names is inconsistent with the rest of SAMBA. 23-May-2001 J. Malmberg Fixed reference for tdb.h in include.h. Now it asserts an error about needing to implement spinlock code. Removed definition of SPINLOCK from config_vms.h spinlock.h is complaining about HAVE_CONFIG_H not being defined. If it is defined as 1, it causes the include file to be included again. Fixed CONFIG.H to make sure that it is only included once. Will have to modify the config_h.com procedure to add this to the procedure when it generates it. Something is also causing nsswitch/winbindd_nss.h to be referenced from SMB.H. Needed to add a nsswitch: logical name so the build could find it. Another case that is inconsistent with the rest of SAMBA. Now I am getting too many undefined acl_*_t symbols for the compiler to handle. Searching the source to find out why. Aparently the option to select POSIX_ACLS caused this. Removing fixed that. The dl*() functions in the Compaq C RTL are now conflicting with FRONTPORT. Need to fix. 24-May-2001 J. Malmberg Fixed definitions of dlsym() and dlclose(). SERVER.C has changed, VMS Macro hack is causing a diagnostic in the invocation of smbd_set_server_fd(dup(0)). In SERVER.C the compiler is complaining about changing the sign of an unsigned constant. In SERVER.C there is an undefined symbol LOGFILEBASE. Fixed LOGFLEBASE in CONFIG_VMS.H The new version stores the socket file descriptor in a local static variable instead of a global, and then uses an internal function to access it. To make SAMBA 2.0.6 work on OpenVMS, I had to use a macro to replace dup() with the symbol "Client". For 2.2.0, I had to modify VMS_SERVER.C to have a function that returned the socket descriptor. Then I used a macro to replace the dup() function with the new function. connection.c has been changed, I am not sure how to put the OpenVMS specific patch back into it, so I will have to follow up on it later. The patch was needed because the DCL shell runs all of it's programs with the same pid. This means that when running smbd in debug, it fails a test that was in the old version. From the looks of the new code, it is probably time to replace the entire module with a VMS specific version that used VMS locking calls. This would make it much faster. The new VFS structure has members that are pointers to functions. Unfortunately, these members have the same names as macros used to implement the functions in the FRONTPORT library. Changed CONFIG_VMS.H to implement those functions with #pragma declarations instead of macros. More symbols that are greater than 31 characters needed to be aliased with macros in CONFIG.H predict.c no longer seems to exist. 25-May-2001 J. Malmberg [.lib]smbrun.c has been changed to only use fork(), which does not exist on OpenVMS. Replace with the one from samba 2.0.6. system.c has routines setpwent(),getpwent(), and getpwent(). Setup macros to get the code to compile. More routines to add to FRONTPORT once I find out what they do. util_sock is using an unknown struct sockaddr_un with members sun_family and sun_path instead of using struct sockaddr. lib.exe fails to link with many symbols in the transfer vector no longer existing. It also requires modules from nsswitch and tdb. Started creating nsswitch and tdb shared images. The TDB.C module fails to compile, it uses "struct stat" instead of SMB_STRUCT_STAT. Then it references ino_t and dev_t. This is not compatable with VMS. I Patched the module for now, I will need to look at converting it to use RMS calls for better control. wb_common.c not compiling, the struct sockaddr_un came up again, and memset, stnrcpy, and strncat are not declared. 27-May-2001 J. Malmberg passdb.c is referencing fchmod(). No checking is done of the HAVE_FCHMOD symbol. Faked it out with a macro for now. smbd is referencing flock(), need to find out why, as fcntl should be overriding this. 29-May-2001 J. Malmberg Found a sys_fork() routine that will hide some fork() calls that need to be found. Must break the build to find these references. vfs.c is having problems compiling because the vfs struct contains members that are function pointers with the same names as the macros. Did some tricks to get it to compile. 30-May-2001 J. Malmberg msdfs.c is referencing symlink, and readlink, and lstat(). Fixed with macros. Type mismatch with an internal function can not be fixed. Will need a code patch to continue. struct vfs is also being used, and this breaks the macro trick with lstat. 2-Jun-2001 J. Malmberg LOCKTEST.C will not compile. Some obvious coding errors. Unknown routine setlinebuf. Note that HAVE_SETLINEBUF is not defined. Used a macro to get the compile/link to continue. RPCCHECK.C will not compile. Not obvious how to resolve change in interface so will remove it from the build. RPCCLIENT.C is referencing a function setlinebuf. Used a macro to get the compile/link to continue. RPCTORTURE is missing a structure and other definitions. From examining the code, put a structure in config_vms.h to get a compile. CLIENT.C As noted before, this needs an edit to properly identify the end of file character. Need to use termios.h code to calculate, so must implement that function in FRONTPORT TORTURE.C requires a cast to allow a char pointer to be passed to a routine that expects an unsigned char pointer. SMBW_SAMPLE.C will not compile. Unexpected newline in string literal. Also wrapper functions not prototyped, causing type mismatches. Removing it from build. TDBTEST requires GDBM module. This is not present in OpenVMS. Removing it from build. TDBTOOL will not compile. Unexpected newline in string literal and type mismatch between signed and unsigned characters. I needed to change a printf() to a series of puts(), and apply casts to the print_data() arguments. TDBTORTURE has a FORK() in it. VLUKE will not compile. PARSER.H will not compile, it has a relative path for byteorder.h. Even after fixing this, test.h is missing. 04-Jun-2001 J. Malmberg RPCTORTURE is not linking. 5 undefined routines that I can not find in the source. 06-Jun-2001 J. Malmberg The build finally seems to work. Deleted all object files, object libraries, and executables, and started it again. To actually get a system working, the following routines need to be fixed or written: fport__fcntl(), fport__fstat(). The internal structure needs to have two structures, one for the logical end of file, and one for where the file has actually be extended to. fport__fstat() needs to return the logical end of file. fport__read(), fport__write(). The internal buffer needs to be 2x max record size. When a non binary file is opened for writing, if a write crosses a record boundary, the next record must be read in, and then the data overlaid on the boundary. [Above not quite correct] The syslog facility can be optionally implemented as a later project. New functions: setgroups() in grp.h int setgroups(size_t count, gid_t * GROUPS) This function sets the process's supplementary group IDs. Requires privileges of course. Returns 0 for success and -1 for error. EPERM is the only errno defined. This information is from the LINUX info pages. int initgroups(const char *USER, gid_t GID) This function scans the group database for all the groups USER belongs to. if GID is not -1, this group is included too. This information is from the LINUX info pages. setgrent(), endgrent, getgrent() These functions scan the group database. The above group functions are being implemented as functions that scan the OpenVMS RIGHTS Identifiers. Some translations are being don. setsid() - Not sure how to implement this function, or what value it would have. Best to tell SAMBA that it is not present. getgrlimit() - No idea of what this function does. Not in LINUX, and not in X-OPEN. flock() - Searching LINUX for Kernel Oplocks and failed. It appears that this is used only for LINUX share modes, so should be compiled out. capget() capset(). Linux Capability functions. No documentation yet found. Basically commented out the module as template for an OpenVMS specific KERNEL Oplocks implementation. fchmod() - See UNIX standard fchown() - See UNIX standard ***** setlinebuf() - Obsolete setvbuf() should be used instead. void setlinebuf(FILE * STREAM) This makes the file STREAM to be line buffered. On OpenVMS, this basically has can only affect some devices like terminals. Note that this is setting it to the default condition for OpenVMS terminals. #define setlinebuf(stream) setvbuf(stream, NULL, _IOLBF, 256) The problem is that on OpenVMS, this setting is typically made before the terminal is using the port. This may be a bit tricky for general purpose. int setvbuf(FILE *STREAM, char *BUF, int MODE, size_t SIZE) readlink(), symlink() Since OpenVMS before DII COE does not support symbolic links, just implent macros to return error conditions and see if the SAMBA code buys this. getegid(),geteuid(),seteuid(),setegid() Continue for now for these to be macros that map to fport__getgid(), etc. Readline support: char * fport__rl_readline_name(void) This procedure returns the address of an internal variable that can in the future be used to hold the name of a file that the readline history can be saved/restored from. char *(**((* rl_attempted_completion_function) (char * text, int start, int end))(void); char *(*rl_event_hook)(void))(void); *********** fork() and sysfork() handling. NMBD_SYNCLISTS.C - It looks like this module can be changed with a VMS specific code. It will take a bit of work. NMBD_WINSSERVER.C - It looks almost trivial to convert this code to use OpenVMS Asynchronous writes. CHGPASSWD.C - The password change routines are not portable to OpenVMS. Replacing this module with an operating system specific module is easier. STARTSTOP.C - This needs to be replaced with OpenVMS specific code for starting and stopping the SMBD and NMBD processes. SYSTEM.C - The module sys_popen() does some things with fork() and pipes that are not portable. UTIL_FILE.C - This uses the SYS_POPEN to execute host commands. This does not really translate well to OpenVMS. ********************************************* 27-Jun-2001 J. Malmberg Some smoke testing, from a non-privileged account. DEBUG2HTML - Accepts input from SYS$INPUT, outputs HTML to sys$output. LOCKTEST and LOCKTEST2 - prints out a help screen and exits. I have no server to test against. MAKE_UNICODEMAP - Prints out a help screen and exits. MASKTEST - Access violates. MSGTEST - Complains about not being able to open SMB.CONF. NMBD - exits with out a message. NMBLOOKUP - Prints out a help text and exits. RPCCLIENT - Prints out a help text and exits. RPCTORTURE - Complains about not being able to open SMB.CONF, prints a help menu and exits. SMBD - Complains that it is not running as root and exit. SMBFILTER - Prints out and exits. SMBMNT - Prints out a help text and exits. SMBMOUNT - Prints out a help text and exits. SMBPASSWD - Complains about not being able to open SMB.CONF and exits. SMBSH - Complains about not being able to get smbw shared lock and exits. SMBSPOOL - Prints out 'network smb "Unknown" "Windows Printer via SAMBA" SMBSTATUS - Complains about not being able to open SMB.CONF and exits. SMBTORTURE - Complains about not being able to open SMB.CONF and also not being able to determine the interface in use. SMBUMOUNT - prints out a help text and exits. SMBW_SAMPLE prints out a help text and exits. SWAT - Accepts input from SYS$INPUT, outputs HTML complaining about authorization needed. TDBTOOL - prompts for TDB>, prints a help text in response to help. "q" command is not working. TDBTORTURE - complains about no locks being available and exits. TESTPARM - complains about not being able to open SMB.CONF and exits. Note that the file is world readable on VMS equivalent to the path. TESTPRNS - prints out a help text and exit. Note the HTML documents in the CMS_ROOT:[SAMBA] directory tree do not all have the correct names needed for local web browsers. A procedure will need to be written to build a directory tree that they can read.