BeOS and Zeta port - some patches

François Revol revol at free.fr
Thu Jan 27 10:51:20 GMT 2005


Hi,
There has been several attempts to port samba to BeOS before, 
and as the one in charge or ports at yellowTAB (makers of Zeta, 
a BeOS-based OS), I had some stuff working on 3.0.0 since last 
year. However we never released this since the current state of 
the OS doesn't permit to run samba reliably (no advisory locking).
We will be implementing locking in the near future, but it has 
come to us that other people are porting Samba 3.0.x as well, 
without locking support of course... And without some features 
we already implemented. To avoid wasting our scarse ressources 
I'm sending here my work-in-progress patches for reference to 
other porters.
We will also have a look at samba 4 which is said to be usable 
without locking, hopefully we can get a port before it is released.

I know those patches won't get into the trunk as is, it is not 
the intend, though I invite developers to read through it anyway 
as there are some generic fixes that might be helpful on other 
platforms (like checking but not caring about the checks for 
st_blocks, seekdir, telldir, SIGBUS=SIGSEGV...).
Now I just saw I should have used HAVE_MMAP somewhere in place 
of __BEOS__, anyway.

I also noticed there is a nasty crash when doing a static build.
If both CP437 and CP850 are references as static modules (in 
static_init_charset), I get a crash that looks a bit like
https://bugzilla.samba.org/show_bug.cgi?id=1725
That looks like a bug in the macro in include/charset.h but I 
already spent a day on it and have other priorities (and it 
doesn't crash on a dynamic build).

The 3.0.0 patch is provided for historical reference.
Most of it got into later revs differently anyway.


François Revol - francois DOT revol AT yellowtab DOT com
--
Software Architect
YellowTab GmbH
http://www.yellowtab.com/
-------------- next part --------------
This is the work in progress on samba 3.0.11 for Zeta.
Francois Revol, revol AT free.fr

cd samba-3.0.11pre2
patch -p1 < thisfile
./autogen.sh
./configure --prefix=/boot/home/config --enable-debug --with-shared-modules=CP850,CP457

diff -urN -x work* samba-3.0.11pre2.org/PATCH.README.BeOS samba-3.0.11pre2/PATCH.README.BeOS
--- samba-3.0.11pre2.org/PATCH.README.BeOS	Thu Jan  1 01:00:00 1970
+++ samba-3.0.11pre2/PATCH.README.BeOS	Wed Jan 26 15:53:00 2005
@@ -0,0 +1,15 @@
+plugins: audit.so, extd_audit.so use syslog(), which is in libbe.so, which we checked for in configure, so we have to use $(LIBS).
+
+before make install:
+# cleanup in case other prog used sbin
+mv /boot/home/config/sbin/* /boot/home/config/bin/
+rmdir /boot/home/config/sbin/
+# fake it
+ln -s bin /boot/home/config/sbin
+
+
+
+Why
+/boot/home/config/lib/??.msg ???
+/boot/home/config/lib/vfs/recycle.so ...
+
diff -urN -x work* samba-3.0.11pre2.org/TODO.BeOS samba-3.0.11pre2/TODO.BeOS
--- samba-3.0.11pre2.org/TODO.BeOS	Thu Jan  1 01:00:00 1970
+++ samba-3.0.11pre2/TODO.BeOS	Wed Jan 26 15:53:00 2005
@@ -0,0 +1,4 @@
+-Wno-shadow
+modules/vfs_beos
+configure.in: AC_DEFINE(STAT_ST_BLOCKSIZE,512) ??
+modules as .so
diff -urN -x work* samba-3.0.11pre2.org/source/Makefile.in samba-3.0.11pre2/source/Makefile.in
--- samba-3.0.11pre2.org/source/Makefile.in	Fri Jan 21 21:29:10 2005
+++ samba-3.0.11pre2/source/Makefile.in	Thu Jan 27 02:19:16 2005
@@ -206,7 +206,8 @@
 	  lib/pam_errors.o intl/lang_tdb.o lib/account_pol.o \
 	  lib/adt_tree.o lib/gencache.o $(TDB_OBJ) \
 	  lib/module.o lib/ldap_escape.o @CHARSET_STATIC@ \
-	  lib/privileges.o lib/secdesc.o lib/secace.o lib/secacl.o
+	  lib/privileges.o lib/secdesc.o lib/secace.o lib/secacl.o \
+	  lib/dummynobody.o lib/dummylocking.o lib/dummyseteuid.o
 
 LIB_NONSMBD_OBJ = $(LIB_OBJ) lib/dummysmbd.o
 
diff -urN -x work* samba-3.0.11pre2.org/source/client/client.c samba-3.0.11pre2/source/client/client.c
--- samba-3.0.11pre2.org/source/client/client.c	Fri Jan 21 21:29:14 2005
+++ samba-3.0.11pre2/source/client/client.c	Wed Jan 26 15:53:00 2005
@@ -1998,7 +1998,11 @@
 	d_printf("File: %s\n", src);
 	d_printf("Size: %-12.0f\tBlocks: %u\t%s\n",
 		(double)sbuf.st_size,
+#ifdef HAVE_STAT_ST_BLOCKS
 		(unsigned int)sbuf.st_blocks,
+#else
+		(unsigned int)-1,
+#endif
 		filetype_to_str(sbuf.st_mode));
 
 #if defined(S_ISCHR) && defined(S_ISBLK)
diff -urN -x work* samba-3.0.11pre2.org/source/configure.in samba-3.0.11pre2/source/configure.in
--- samba-3.0.11pre2.org/source/configure.in	Fri Jan 21 21:29:13 2005
+++ samba-3.0.11pre2/source/configure.in	Thu Jan 27 02:18:58 2005
@@ -211,6 +211,7 @@
 AC_SUBST(PICFLAGS)
 AC_SUBST(PICSUFFIX)
 AC_SUBST(SHLIBEXT)
+AC_SUBST(SHLIB_PLUGIN_LINKTO)
 AC_SUBST(INSTALLCLIENT)
 AC_SUBST(INSTALLCLIENTCMD_SH)
 AC_SUBST(INSTALLCLIENTCMD_A)
@@ -257,6 +258,13 @@
 	LIBS="$LIBS -ldmalloc"	
 fi
 
+AC_ARG_ENABLE(locking, 
+[  --disable-locking       Turn off file locking (DANGEROUS) (default=no)],
+    [if eval "test x$enable_locking = xno"; then
+	AC_DEFINE(DISABLE_LOCKING, 1, [Define to turn off file locking])
+	CFLAGS="${CFLAGS} -Dfcntl=nolock_fcntl"
+    fi])
+
 dnl Checks for programs.
 
 ##
@@ -662,6 +670,26 @@
         fi
       AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
     ;;
+#
+# BeOS sometimes has inet_ntoa in libbind (BONE). syslog stuff is in libbe, for no reason.
+#
+    *beos*)
+        AC_CHECK_LIB(bind,__inet_ntoa)
+        AC_CHECK_LIB(be,openlog)
+	AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+	dnl it does crash, and bring the debugger and stop the configure process, so...
+	samba_cv_REALPATH_TAKES_NULL=no
+	dnl we don't have that one
+	samba_cv_HAVE_BROKEN_GETGROUPS=yes
+	dnl fake nobody
+	AC_DEFINE(WITH_FAKE_NOBODY_USER,1,[Whether to fake the nobody user if OS does not have it])
+	CFLAGS="${CFLAGS} -Dgetpwnam=fake_nobody_getpwnam -Dgetpwuid=fake_nobody_getpwuid"
+	dnl temporary
+	AC_DEFINE(DISABLE_LOCKING, 1, [Define to turn off file locking])
+	CFLAGS="${CFLAGS} -Dfcntl=nolock_fcntl"
+	dnl that should go off in Zeta
+	AC_DEFINE(USE_SETEUID,1,[Whether seteuid() is available])
+    ;;
 
 esac
 
@@ -1005,7 +1033,8 @@
 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
 AC_CHECK_FUNCS(syslog vsyslog timegm)
 AC_CHECK_FUNCS(setlocale nl_langinfo)
-AC_CHECK_FUNCS(nanosleep)
+AC_CHECK_FUNCS(nanosleep snooze)
+AC_CHECK_FUNCS(swab seekdir telldir seteuid)
 # setbuffer, shmget, shm_open are needed for smbtorture
 AC_CHECK_FUNCS(setbuffer shmget shm_open backtrace_symbols)
 AC_CHECK_HEADERS(libexc.h)
@@ -1025,8 +1054,8 @@
 AC_CHECK_FUNCS(getdirentries _write __write _fork __fork)
 AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64)
 AC_CHECK_FUNCS(__sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64)
-AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64)
-AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64)
+AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64 read_pos)
+AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64 write_pos)
 AC_CHECK_FUNCS(open64 _open64 __open64 creat64)
 
 #
@@ -1155,6 +1184,7 @@
 PICFLAGS=""
 PICSUFFIX="po"
 SHLIBEXT="so"
+SHLIB_PLUGIN_LINKTO=""
 
 if test "$enable_shared" = "yes"; then
   # this bit needs to be modified for each OS that is suported by
@@ -1325,6 +1355,15 @@
 			SHLIBEXT="dylib"
 			AC_DEFINE(STAT_ST_BLOCKSIZE,512)
 			;;
+		*beos*)   AC_DEFINE(BEOS,1,[Whether the host os is BeOS/Zeta])
+			BLDSHARED="false" # not workign yet
+			BLDSHARED="true" # XXX
+			LDSHFLAGS="-nostart" 
+			dnl DYNEXP="-Wl,--export-dynamic"
+			PICFLAGS="-fPIC -DPIC"
+			SONAMEFLAG="-Xlinker -soname="
+			SHLIB_PLUGIN_LINKTO="bin/smbd"
+			;;
 
 		*)
 			AC_DEFINE(STAT_ST_BLOCKSIZE,512)
@@ -1723,7 +1762,7 @@
 
 
 ICONV_LOCATION=standard
-LOOK_DIRS="/usr /usr/local /sw /opt"
+LOOK_DIRS="/usr /usr/local /sw /opt /boot/develop"
 AC_ARG_WITH(libiconv,
 [  --with-libiconv=BASEDIR Use libiconv in BASEDIR/lib and BASEDIR/include (default=auto) ],
 [
@@ -1752,8 +1791,9 @@
 dnl in both libiconv and in libc. In this case the jm_ICONV test will always
 dnl succeed when the header is found. To counter this, make sure the 
 dnl library directory is there and check the ABI directory first (which
-dnl should be harmless on other systems.
-    for l in "lib32" "lib" ; do
+dnl should be harmless on other systems).
+dnl We also check for (/boot/develop/)lib/x86 for BeOS and Zeta
+    for l in "lib32" "lib" "lib/x86" ; do
         if test -d "$i/$l" ; then
                 LDFLAGS="$save_LDFLAGS -L$i/$l"
                 LIBS=
diff -urN -x work* samba-3.0.11pre2.org/source/include/byteorder.h samba-3.0.11pre2/source/include/byteorder.h
--- samba-3.0.11pre2.org/source/include/byteorder.h	Mon Oct 25 23:05:05 2004
+++ samba-3.0.11pre2/source/include/byteorder.h	Wed Jan 26 15:53:01 2005
@@ -18,8 +18,8 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#ifndef _BYTEORDER_H
-#define _BYTEORDER_H
+#ifndef SMB_BYTEORDER_H
+#define SMB_BYTEORDER_H
 
 /*
    This file implements macros for machine independent short and 
@@ -97,11 +97,12 @@
 
 /* we know that the 386 can handle misalignment and has the "right" 
    byteorder */
-#ifdef __i386__
+#if defined(__i386__)// || defined(__BEOS__)
 #define CAREFUL_ALIGNMENT 0
 #endif
 
 #ifndef CAREFUL_ALIGNMENT
+#error plop
 #define CAREFUL_ALIGNMENT 1
 #endif
 
diff -urN -x work* samba-3.0.11pre2.org/source/include/config.h.in samba-3.0.11pre2/source/include/config.h.in
--- samba-3.0.11pre2.org/source/include/config.h.in	Fri Jan 21 21:54:18 2005
+++ samba-3.0.11pre2/source/include/config.h.in	Thu Jan 27 02:22:50 2005
@@ -6,6 +6,9 @@
 /* Whether the AIX send_file() API is available */
 #undef AIX_SENDFILE_API
 
+/* Whether the host os is BeOS/Zeta */
+#undef BEOS
+
 /* Does getgrnam work correctly */
 #undef BROKEN_GETGRNAM
 
@@ -39,6 +42,9 @@
 /* Default unix charset name */
 #undef DEFAULT_UNIX_CHARSET
 
+/* Define to turn off file locking */
+#undef DISABLE_LOCKING
+
 /* Define to check invariants around some common functions */
 #undef DMALLOC_FUNC_CHECK
 
@@ -596,6 +602,12 @@
 /* Define to 1 if you have the `asn1' library (-lasn1). */
 #undef HAVE_LIBASN1
 
+/* Define to 1 if you have the `be' library (-lbe). */
+#undef HAVE_LIBBE
+
+/* Define to 1 if you have the `bind' library (-lbind). */
+#undef HAVE_LIBBIND
+
 /* Define to 1 if you have the `com_err' library (-lcom_err). */
 #undef HAVE_LIBCOM_ERR
 
@@ -860,6 +872,9 @@
 /* Define to 1 if you have the `readlink' function. */
 #undef HAVE_READLINK
 
+/* Define to 1 if you have the `read_pos' function. */
+#undef HAVE_READ_POS
+
 /* Define to 1 if you have the `realpath' function. */
 #undef HAVE_REALPATH
 
@@ -902,6 +917,9 @@
 /* Define to 1 if you have the <security/_pam_macros.h> header file. */
 #undef HAVE_SECURITY__PAM_MACROS_H
 
+/* Define to 1 if you have the `seekdir' function. */
+#undef HAVE_SEEKDIR
+
 /* Define to 1 if you have the `select' function. */
 #undef HAVE_SELECT
 
@@ -923,6 +941,9 @@
 /* Define to 1 if you have the `setenv' function. */
 #undef HAVE_SETENV
 
+/* Define to 1 if you have the `seteuid' function. */
+#undef HAVE_SETEUID
+
 /* Define to 1 if you have the `setgidx' function. */
 #undef HAVE_SETGIDX
 
@@ -998,6 +1019,9 @@
 /* Whether we have the atomic_t variable type */
 #undef HAVE_SIG_ATOMIC_T_TYPE
 
+/* Define to 1 if you have the `snooze' function. */
+#undef HAVE_SNOOZE
+
 /* Define to 1 if you have the `snprintf' function. */
 #undef HAVE_SNPRINTF
 
@@ -1098,6 +1122,9 @@
    `HAVE_STRUCT_STAT_ST_RDEV' instead. */
 #undef HAVE_ST_RDEV
 
+/* Define to 1 if you have the `swab' function. */
+#undef HAVE_SWAB
+
 /* Define to 1 if you have the `symlink' function. */
 #undef HAVE_SYMLINK
 
@@ -1241,6 +1268,9 @@
 /* Define to 1 if you have the <sys/xattr.h> header file. */
 #undef HAVE_SYS_XATTR_H
 
+/* Define to 1 if you have the `telldir' function. */
+#undef HAVE_TELLDIR
+
 /* Define to 1 if you have the <termios.h> header file. */
 #undef HAVE_TERMIOS_H
 
@@ -1373,6 +1403,9 @@
 /* Whether the WRFILE:-keytab is supported */
 #undef HAVE_WRFILE_KEYTAB
 
+/* Define to 1 if you have the `write_pos' function. */
+#undef HAVE_WRITE_POS
+
 /* Whether xfs quota support is available */
 #undef HAVE_XFS_QUOTAS
 
@@ -1794,6 +1827,9 @@
 /* Whether to include AFS fake-kaserver support */
 #undef WITH_FAKE_KASERVER
 
+/* Whether to fake the nobody user if OS does not have it */
+#undef WITH_FAKE_NOBODY_USER
+
 /* Whether to include 2.2 compatible LDAP SAM configuration */
 #undef WITH_LDAP_SAMCONFIG
 
@@ -1914,11 +1950,9 @@
 /* Whether to build idmap_tdb as shared module */
 #undef idmap_tdb_init
 
-/* Define to `__inline__' or `__inline' if that's what the C compiler
-   calls it, or to nothing if 'inline' is not supported under any name.  */
-#ifndef __cplusplus
+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
+   if it is not supported. */
 #undef inline
-#endif
 
 /* Define to `unsigned' if <sys/types.h> does not define. */
 #undef ino_t
diff -urN -x work* samba-3.0.11pre2.org/source/lib/dummylocking.c samba-3.0.11pre2/source/lib/dummylocking.c
--- samba-3.0.11pre2.org/source/lib/dummylocking.c	Thu Jan  1 01:00:00 1970
+++ samba-3.0.11pre2/source/lib/dummylocking.c	Thu Jan 27 01:39:49 2005
@@ -0,0 +1,53 @@
+/* 
+   Unix SMB/CIFS implementation.
+   RPC pipe client
+
+   Copyright (C) Tim Potter 2003
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#undef fcntl
+
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+/* Some clueless ppl want to turn off locking... fools.
+   We currently need that in BeOS, hopefully not for long. */
+
+
+int nolock_fcntl (int fd, int cmd, ...)
+{
+	va_list vargs;
+	struct flock *lk;
+	void *dummy;
+	va_start(vargs, cmd);
+	lk = va_arg(vargs, struct flock *);
+	dummy = va_arg(vargs, void *);
+	va_end(vargs);
+fprintf(stderr, "nolock_fcntl(%d, 0x%08lx, )\n", fd, cmd);
+	switch (cmd) {
+	case F_GETLK:
+		lk->l_type = F_UNLCK;
+	case F_SETLK:
+	case F_SETLKW:
+		return 0;
+	default:
+		return fcntl(fd, cmd, lk, dummy);
+	}
+	return -1;
+}
+
diff -urN -x work* samba-3.0.11pre2.org/source/lib/dummynobody.c samba-3.0.11pre2/source/lib/dummynobody.c
--- samba-3.0.11pre2.org/source/lib/dummynobody.c	Thu Jan  1 01:00:00 1970
+++ samba-3.0.11pre2/source/lib/dummynobody.c	Thu Jan 27 08:06:28 2005
@@ -0,0 +1,46 @@
+/* 
+   Unix SMB/CIFS implementation.
+   RPC pipe client
+
+   Copyright (C) Tim Potter 2003
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/* That's only for OSes which don't have a user list or have a 
+   hardcoded one, like BeOS. */
+
+#undef getpwnam
+#undef getpwuid
+
+#include <string.h>
+#include <pwd.h>
+
+static struct passwd nobody_here = { "nobody", "", 65534, 0, "/tmp", "/bin/false", "Guest account" };
+
+struct passwd *fake_nobody_getpwnam(const char *name)
+{
+	if (name && !strcmp(name, "nobody"))
+		return &nobody_here;
+	return getpwnam(name);
+}
+
+struct passwd *fake_nobody_getpwuid(uid_t uid)
+{
+	if (uid == nobody_here.pw_uid)
+		return &nobody_here;
+	return getpwuid(uid);
+}
+
diff -urN -x work* samba-3.0.11pre2.org/source/lib/dummyseteuid.c samba-3.0.11pre2/source/lib/dummyseteuid.c
--- samba-3.0.11pre2.org/source/lib/dummyseteuid.c	Thu Jan  1 01:00:00 1970
+++ samba-3.0.11pre2/source/lib/dummyseteuid.c	Thu Jan 27 02:22:21 2005
@@ -0,0 +1,34 @@
+/* 
+   Unix SMB/CIFS implementation.
+   RPC pipe client
+
+   Copyright (C) Tim Potter 2003
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/* That's only for OSes which don't have a user list or have a 
+   hardcoded one, like BeOS. */
+
+#include <unistd.h>
+
+#if defined(USE_SETEUID) && !defined(HAVE_SETEUID)
+
+int seteuid(uid_t euid)
+{
+	return 0;
+}
+
+#endif
diff -urN -x work* samba-3.0.11pre2.org/source/lib/fault.c samba-3.0.11pre2/source/lib/fault.c
--- samba-3.0.11pre2.org/source/lib/fault.c	Mon Oct 25 23:04:58 2004
+++ samba-3.0.11pre2/source/lib/fault.c	Wed Jan 26 15:53:01 2005
@@ -46,8 +46,10 @@
 		CatchSignal(SIGSEGV,SIGNAL_CAST SIG_DFL);
 #endif
 #ifdef SIGBUS
+#if !defined(SIGSEGV) || (SIGSEGV != SIGBUS)
 		CatchSignal(SIGBUS,SIGNAL_CAST SIG_DFL);
 #endif
+#endif
 #ifdef SIGABRT
 		CatchSignal(SIGABRT,SIGNAL_CAST SIG_DFL);
 #endif
@@ -70,12 +72,15 @@
 void fault_setup(void (*fn)(void *))
 {
 	cont_fn = fn;
-
+#ifdef WTF_BEOS_DEBUGGER_WANTS_TO_CATCH_THOSE
 #ifdef SIGSEGV
 	CatchSignal(SIGSEGV,SIGNAL_CAST sig_fault);
 #endif
 #ifdef SIGBUS
+#if !defined(SIGSEGV) || (SIGSEGV != SIGBUS)
 	CatchSignal(SIGBUS,SIGNAL_CAST sig_fault);
+#endif
+#endif
 #endif
 #ifdef SIGABRT
 	CatchSignal(SIGABRT,SIGNAL_CAST sig_fault);
diff -urN -x work* samba-3.0.11pre2.org/source/lib/iconv.c samba-3.0.11pre2/source/lib/iconv.c
--- samba-3.0.11pre2.org/source/lib/iconv.c	Wed Dec 15 15:33:12 2004
+++ samba-3.0.11pre2/source/lib/iconv.c	Wed Jan 26 19:10:24 2005
@@ -123,6 +123,7 @@
 		for(i = 0; builtin_functions[i].name; i++) 
 			smb_register_charset(&builtin_functions[i]);
 		static_init_charset;
+		//{ charset_weird_init(); /*charset_CP850_init();*/ charset_CP437_init();}
 	}
 }
 
@@ -497,7 +498,17 @@
 
 	n = MIN(*inbytesleft, *outbytesleft);
 
+#ifdef HAVE_SWAB
 	swab(*inbuf, *outbuf, (n&~1));
+#else
+	{
+		int i;
+		for (i = 0; i < n; i+=2) {
+			(*outbuf)[i+1] = (*inbuf)[i];
+			(*outbuf)[i] = (*inbuf)[i+1];
+		}
+	}
+#endif
 	if (n&1) {
 		(*outbuf)[n-1] = 0;
 	}
diff -urN -x work* samba-3.0.11pre2.org/source/lib/interfaces.c samba-3.0.11pre2/source/lib/interfaces.c
--- samba-3.0.11pre2.org/source/lib/interfaces.c	Mon Oct 25 23:04:59 2004
+++ samba-3.0.11pre2/source/lib/interfaces.c	Wed Jan 26 15:53:01 2005
@@ -307,7 +307,14 @@
 			goto next;
 		}
 
+#ifndef __BEOS__
 		nmask = ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr;
+#else
+		/*
+		 * BeOS (BONE) uses a different field for that in ifreq_t.
+		 */
+		nmask = ((struct sockaddr_in *)&ifr->ifr_mask)->sin_addr;
+#endif
 
 		strncpy(ifaces[total].name, iname, sizeof(ifaces[total].name)-1);
 		ifaces[total].name[sizeof(ifaces[total].name)-1] = 0;
@@ -323,10 +330,17 @@
 		 * minimum size. Usually this doesn't matter, but if
 		 * your machine has tunnel interfaces, etc. that have
 		 * a zero length "link address", this does matter.  */
-
+#ifndef __BEOS__
 		if (inc < sizeof(ifr->ifr_addr))
 			inc = sizeof(ifr->ifr_addr);
 		inc += IFNAMSIZ;
+#else
+		/*
+		 * BONE has a big struct for ifreq, not a union...
+		 * which actually includes everything we would need 
+		 * without any other ioctl.			    */
+		inc = sizeof(struct ifreq);
+#endif
 
 		ifr = (struct ifreq*) (((char*) ifr) + inc);
 		i -= inc;
diff -urN -x work* samba-3.0.11pre2.org/source/lib/system.c samba-3.0.11pre2/source/lib/system.c
--- samba-3.0.11pre2.org/source/lib/system.c	Tue Jan  4 21:30:22 2005
+++ samba-3.0.11pre2/source/lib/system.c	Wed Jan 26 16:27:58 2005
@@ -105,7 +105,7 @@
 A pread wrapper that will deal with EINTR and 64-bit file offsets.
 ********************************************************************/
 
-#if defined(HAVE_PREAD) || defined(HAVE_PREAD64)
+#if defined(HAVE_PREAD) || defined(HAVE_PREAD64) || defined(HAVE_READ_POS)
 ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off)
 {
 	ssize_t ret;
@@ -113,8 +113,11 @@
 	do {
 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_PREAD64)
 		ret = pread64(fd, buf, count, off);
-#else
+#elif defined(HAVE_PREAD)
 		ret = pread(fd, buf, count, off);
+#elif defined(HAVE_READ_POS)
+		/* BeOS had read_pos years before pread came to life... and 64bit off_t */
+		ret = read_pos(fd, off, buf, count);
 #endif
 	} while (ret == -1 && errno == EINTR);
 	return ret;
@@ -125,7 +128,7 @@
 A write wrapper that will deal with EINTR and 64-bit file offsets.
 ********************************************************************/
 
-#if defined(HAVE_PWRITE) || defined(HAVE_PWRITE64)
+#if defined(HAVE_PWRITE) || defined(HAVE_PWRITE64) || defined(HAVE_WRITE_POS)
 ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off)
 {
 	ssize_t ret;
@@ -133,8 +136,10 @@
 	do {
 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_PWRITE64)
 		ret = pwrite64(fd, buf, count, off);
-#else
+#elif defined(HAVE_PWRITE)
 		ret = pwrite(fd, buf, count, off);
+#elif defined(HAVE_WRITE_POS)
+		ret = write_pos(fd, off, buf, count);
 #endif
 	} while (ret == -1 && errno == EINTR);
 	return ret;
@@ -393,11 +398,17 @@
 
 void sys_seekdir(DIR *dirp, long offset)
 {
+#if defined(HAVE_SEEKDIR)
 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_SEEKDIR64)
 	seekdir64(dirp, offset);
 #else
 	seekdir(dirp, offset);
 #endif
+#else
+	/* No seekdir system call. */
+	errno = ENOSYS;
+	return -1;
+#endif
 }
 
 /*******************************************************************
@@ -406,11 +417,17 @@
 
 long sys_telldir(DIR *dirp)
 {
+#if defined(HAVE_TELLDIR)
 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_TELLDIR64)
 	return (long)telldir64(dirp);
 #else
 	return (long)telldir(dirp);
 #endif
+#else
+	/* no telldir system call. */
+	errno = ENOSYS;
+	return -1;
+#endif
 }
 
 /*******************************************************************
@@ -812,7 +829,7 @@
 #if !defined(HAVE_SETGROUPS)
 	errno = ENOSYS;
 	return -1;
-#endif /* HAVE_SETGROUPS */
+#else
 
 #if !defined(HAVE_BROKEN_GETGROUPS)
 	return setgroups(setlen, gidset);
@@ -852,6 +869,7 @@
 	SAFE_FREE(group_list);
 	return 0 ;
 #endif /* HAVE_BROKEN_GETGROUPS */
+#endif /* HAVE_SETGROUPS */
 }
 
 /**************************************************************************
diff -urN -x work* samba-3.0.11pre2.org/source/libsmb/clifile.c samba-3.0.11pre2/source/libsmb/clifile.c
--- samba-3.0.11pre2.org/source/libsmb/clifile.c	Tue Jan  4 21:30:24 2005
+++ samba-3.0.11pre2/source/libsmb/clifile.c	Wed Jan 26 15:53:01 2005
@@ -261,8 +261,10 @@
 	}
 
 	sbuf->st_size = IVAL2_TO_SMB_BIG_UINT(rdata,0);     /* total size, in bytes */
+#ifdef HAVE_STAT_ST_BLOCKS
 	sbuf->st_blocks = IVAL2_TO_SMB_BIG_UINT(rdata,8);   /* number of blocks allocated */
 	sbuf->st_blocks /= STAT_ST_BLOCKSIZE;
+#endif
 	sbuf->st_ctime = interpret_long_date(rdata + 16);    /* time of last change */
 	sbuf->st_atime = interpret_long_date(rdata + 24);    /* time of last access */
 	sbuf->st_mtime = interpret_long_date(rdata + 32);    /* time of last modification */
diff -urN -x work* samba-3.0.11pre2.org/source/nsswitch/wb_client.c samba-3.0.11pre2/source/nsswitch/wb_client.c
--- samba-3.0.11pre2.org/source/nsswitch/wb_client.c	Wed Dec 15 15:33:13 2004
+++ samba-3.0.11pre2/source/nsswitch/wb_client.c	Wed Jan 26 15:53:01 2005
@@ -346,6 +346,9 @@
 			result = -1;
 			goto done;
 		}
+		errno = EPERM;
+		result = -1;
+		goto done;
 
 	} else {
 		
diff -urN -x work* samba-3.0.11pre2.org/source/nsswitch/wb_common.c samba-3.0.11pre2/source/nsswitch/wb_common.c
--- samba-3.0.11pre2.org/source/nsswitch/wb_common.c	Mon Oct 25 23:04:57 2004
+++ samba-3.0.11pre2/source/nsswitch/wb_common.c	Wed Jan 26 15:53:01 2005
@@ -166,6 +166,7 @@
 }
 
 /* Connect to winbindd socket */
+#ifdef HAVE_UNIXSOCKET
 
 static int winbind_named_pipe_sock(const char *dir)
 {
@@ -289,6 +290,7 @@
         
 	return fd;
 }
+#endif
 
 /* Connect to winbindd socket */
 
diff -urN -x work* samba-3.0.11pre2.org/source/tdb/tdbback.c samba-3.0.11pre2/source/tdb/tdbback.c
--- samba-3.0.11pre2.org/source/tdb/tdbback.c	Wed Dec 15 15:33:17 2004
+++ samba-3.0.11pre2/source/tdb/tdbback.c	Wed Jan 26 15:53:01 2005
@@ -31,7 +31,9 @@
 #include <string.h>
 #include <fcntl.h>
 #include <time.h>
+#ifndef __BEOS__
 #include <sys/mman.h>
+#endif
 
 #include <sys/stat.h>
 #include <sys/time.h>
diff -urN -x work* samba-3.0.11pre2.org/source/tdb/tdbbackup.c samba-3.0.11pre2/source/tdb/tdbbackup.c
--- samba-3.0.11pre2.org/source/tdb/tdbbackup.c	Mon Oct 25 23:05:11 2004
+++ samba-3.0.11pre2/source/tdb/tdbbackup.c	Wed Jan 26 15:53:01 2005
@@ -54,7 +54,10 @@
 #include <string.h>
 #include <fcntl.h>
 #include <time.h>
+#ifndef __BEOS__
 #include <sys/mman.h>
+#endif
+
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <ctype.h>
diff -urN -x work* samba-3.0.11pre2.org/source/tests/summary.c samba-3.0.11pre2/source/tests/summary.c
--- samba-3.0.11pre2.org/source/tests/summary.c	Mon Oct 25 23:04:58 2004
+++ samba-3.0.11pre2/source/tests/summary.c	Wed Jan 26 15:53:01 2005
@@ -2,7 +2,7 @@
 
 main()
 {
-#if !(defined(HAVE_FCNTL_LOCK) || defined(HAVE_STRUCT_FLOCK64))
+#if !(defined(HAVE_FCNTL_LOCK) || defined(HAVE_STRUCT_FLOCK64)) && !defined(__BEOS__)
 	printf("ERROR: No locking available. Running Samba would be unsafe\n");
 	exit(1);
 #endif
@@ -11,7 +11,7 @@
 	printf("WARNING: No automated network interface determination\n");
 #endif
 
-#if !(defined(USE_SETEUID) || defined(USE_SETREUID) || defined(USE_SETRESUID) || defined(USE_SETUIDX))
+#if !(defined(USE_SETEUID) || defined(USE_SETREUID) || defined(USE_SETRESUID) || defined(USE_SETUIDX)) && !defined(__BEOS__)
 	printf("ERROR: no seteuid method available\n");
 	exit(1);
 #endif
-------------- next part --------------
diff -urN samba-3.0.0.org/PATCH.README.BeOS samba-3.0.0/PATCH.README.BeOS
--- samba-3.0.0.org/PATCH.README.BeOS	Thu Jan  1 01:00:00 1970
+++ samba-3.0.0/PATCH.README.BeOS	Sat Dec 20 09:19:41 2003
@@ -0,0 +1,15 @@
+plugins: audit.so, extd_audit.so use syslog(), which is in libbe.so, which we checked for in configure, so we have to use $(LIBS).
+
+before make install:
+# cleanup in case other prog used sbin
+mv /boot/home/config/sbin/* /boot/home/config/bin/
+rmdir /boot/home/config/sbin/
+# fake it
+ln -s bin /boot/home/config/sbin
+
+
+
+Why
+/boot/home/config/lib/??.msg ???
+/boot/home/config/lib/vfs/recycle.so ...
+
diff -urN samba-3.0.0.org/TODO.BeOS samba-3.0.0/TODO.BeOS
--- samba-3.0.0.org/TODO.BeOS	Thu Jan  1 01:00:00 1970
+++ samba-3.0.0/TODO.BeOS	Fri Dec 19 17:37:06 2003
@@ -0,0 +1,4 @@
+-Wno-shadow
+modules/vfs_beos
+configure.in: AC_DEFINE(STAT_ST_BLOCKSIZE,512) ??
+modules as .so
Binary files samba-3.0.0.org/a.out and samba-3.0.0/a.out differ
diff -urN samba-3.0.0.org/source/Makefile.in samba-3.0.0/source/Makefile.in
--- samba-3.0.0.org/source/Makefile.in	Wed Sep 24 19:16:13 2003
+++ samba-3.0.0/source/Makefile.in	Sat Dec 20 08:51:59 2003
@@ -1021,111 +1021,111 @@
 
 bin/rhosts. at SHLIBEXT@: $(AUTH_RHOSTS_OBJ:.o=.po)
 	@echo "Building plugin $@"
-	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_RHOSTS_OBJ:.o=.po) @SONAMEFLAG@`basename $@`
+	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_RHOSTS_OBJ:.o=.po) @SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/builtin. at SHLIBEXT@: $(AUTH_BUILTIN_OBJ:.o=.po)
 	@echo "Building plugin $@"
-	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_BUILTIN_OBJ:.o=.po) @SONAMEFLAG@`basename $@`
+	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_BUILTIN_OBJ:.o=.po) @SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/domain. at SHLIBEXT@: $(AUTH_DOMAIN_OBJ:.o=.po)
 	@echo "Building plugin $@"
-	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_DOMAIN_OBJ:.o=.po) @SONAMEFLAG@`basename $@`
+	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_DOMAIN_OBJ:.o=.po) @SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/smbserver. at SHLIBEXT@: $(AUTH_SERVER_OBJ:.o=.po)
 	@echo "Building plugin $@"
-	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_SERVER_OBJ:.o=.po) @SONAMEFLAG@`basename $@`
+	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_SERVER_OBJ:.o=.po) @SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/winbind. at SHLIBEXT@: $(AUTH_WINBIND_OBJ:.o=.po)
 	@echo "Building plugin $@"
-	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_WINBIND_OBJ:.o=.po) @SONAMEFLAG@`basename $@`
+	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_WINBIND_OBJ:.o=.po) @SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/unix. at SHLIBEXT@: $(AUTH_UNIX_OBJ:.o=.po)
 	@echo "Building plugin $@"
-	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_UNIX_OBJ:.o=.po) @SONAMEFLAG@`basename $@`
+	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_UNIX_OBJ:.o=.po) @SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/sam. at SHLIBEXT@: $(AUTH_SAM_OBJ:.o=.po)
 	@echo "Building plugin $@"
-	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_SAM_OBJ:.o=.po) @SONAMEFLAG@`basename $@`
+	@$(SHLD) $(LDSHFLAGS) -o $@ $(AUTH_SAM_OBJ:.o=.po) @SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/mysql. at SHLIBEXT@: $(MYSQL_OBJ:.o=.po)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(MYSQL_OBJ:.o=.po) @MYSQL_LIBS@ \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/ldapsam. at SHLIBEXT@: passdb/pdb_ldap.po
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) $(LDAP_LIBS) -o $@ passdb/pdb_ldap.po \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/tdbsam. at SHLIBEXT@: passdb/pdb_tdb.po
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ passdb/pdb_tdb.po \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/smbpasswd. at SHLIBEXT@: passdb/pdb_smbpasswd.po
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ passdb/pdb_smbpasswd.po \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/weird. at SHLIBEXT@: $(DEVEL_HELP_WEIRD_OBJ:.o=.po)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(DEVEL_HELP_WEIRD_OBJ:.o=.po) \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/CP850. at SHLIBEXT@: $(DEVEL_HELP_CP850_OBJ:.o=.po)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(DEVEL_HELP_CP850_OBJ:.o=.po) \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/CP437. at SHLIBEXT@: $(DEVEL_HELP_CP437_OBJ:.o=.po)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(DEVEL_HELP_CP437_OBJ:.o=.po) \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/xml. at SHLIBEXT@: $(XML_OBJ:.o=.po)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(XML_OBJ:.o=.po) @XML_LIBS@ \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/audit. at SHLIBEXT@: $(VFS_AUDIT_OBJ:.o=.po)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_AUDIT_OBJ:.o=.po) \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` $(LIBS) @SHLIB_PLUGIN_LINKTO@
 
 bin/extd_audit. at SHLIBEXT@: $(VFS_EXTD_AUDIT_OBJ:.o=.po)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_EXTD_AUDIT_OBJ:.o=.po) \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` $(LIBS) @SHLIB_PLUGIN_LINKTO@
 
 bin/recycle. at SHLIBEXT@: $(VFS_RECYCLE_OBJ:.o=.po)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_RECYCLE_OBJ:.o=.po) \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/netatalk. at SHLIBEXT@: $(VFS_NETATALK_OBJ:.o=.po)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_NETATALK_OBJ:.o=.po) \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/fake_perms. at SHLIBEXT@: $(VFS_FAKE_PERMS_OBJ:.o=.po)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_FAKE_PERMS_OBJ:.o=.po) \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/default_quota. at SHLIBEXT@: $(VFS_DEFAULT_QUOTA_OBJ:.o=.po)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_DEFAULT_QUOTA_OBJ:.o=.po) \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/readonly. at SHLIBEXT@: $(VFS_READONLY_OBJ:.o=.po)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_READONLY_OBJ:.o=.po) \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/cap. at SHLIBEXT@: $(VFS_CAP_OBJ:.o=.po)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(VFS_CAP_OBJ:.o=.po) \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` @SHLIB_PLUGIN_LINKTO@
 
 bin/wbinfo at EXEEXT@: $(WBINFO_OBJ) @BUILD_POPT@ bin/.dummy
 	@echo Linking $@
diff -urN samba-3.0.0.org/source/configure.in samba-3.0.0/source/configure.in
--- samba-3.0.0.org/source/configure.in	Wed Sep 24 19:16:13 2003
+++ samba-3.0.0/source/configure.in	Fri Dec 19 23:01:10 2003
@@ -145,6 +145,7 @@
 AC_SUBST(PICSUFFIX)
 AC_SUBST(POBAD_CC)
 AC_SUBST(SHLIBEXT)
+AC_SUBST(SHLIB_PLUGIN_LINKTO)
 AC_SUBST(INSTALLCLIENT)
 AC_SUBST(INSTALLCLIENTCMD_SH)
 AC_SUBST(INSTALLCLIENTCMD_A)
@@ -543,6 +544,13 @@
         fi
       AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
     ;;
+#
+# BeOS sometimes has inet_ntoa in libbind (BONE). syslog stuff is in libbe, for no reason.
+#
+    *beos*)
+        AC_CHECK_LIB(bind,__inet_ntoa)
+        AC_CHECK_LIB(be,openlog)
+    ;;
 
 esac
 
@@ -1024,6 +1032,7 @@
 PICSUFFIX="po"
 POBAD_CC="#"
 SHLIBEXT="so"
+SHLIB_PLUGIN_LINKTO=""
 
 if test "$enable_shared" = "yes"; then
   # this bit needs to be modified for each OS that is suported by
@@ -1186,6 +1195,15 @@
 			BLDSHARED="true"
 			LDSHFLAGS="-bundle -flat_namespace -undefined suppress"
 			SHLIBEXT="dylib"
+			AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+			;;
+		*beos*)   AC_DEFINE(BEOS,1,[Whether the host os is BeOS/Zeta])
+			BLDSHARED="false" # not workign yet
+			LDSHFLAGS="-nostart" 
+			DYNEXP="-Wl,--export-dynamic"
+			PICFLAG="" # PIC is on by default
+			SONAMEFLAG="-Xlinker -soname="
+			SHLIB_PLUGIN_LINKTO="bin/smbd"
 			AC_DEFINE(STAT_ST_BLOCKSIZE,512)
 			;;
 
diff -urN samba-3.0.0.org/source/iftest.c samba-3.0.0/source/iftest.c
--- samba-3.0.0.org/source/iftest.c	Thu Jan  1 01:00:00 1970
+++ samba-3.0.0/source/iftest.c	Sat Dec 20 08:30:30 2003
@@ -0,0 +1,6 @@
+#define HAVE_IFACE_AIX 1
+#define AUTOCONF_TEST 1
+//#include "confdefs.h"
+#include <sys/sockio.h>
+#include "./lib/interfaces.c"
+
diff -urN samba-3.0.0.org/source/include/byteorder.h samba-3.0.0/source/include/byteorder.h
--- samba-3.0.0.org/source/include/byteorder.h	Fri Aug 15 22:39:52 2003
+++ samba-3.0.0/source/include/byteorder.h	Fri Nov 14 01:35:03 2003
@@ -18,8 +18,8 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#ifndef _BYTEORDER_H
-#define _BYTEORDER_H
+#ifndef SMB_BYTEORDER_H
+#define SMB_BYTEORDER_H
 
 /*
    This file implements macros for machine independent short and 
@@ -97,7 +97,7 @@
 
 /* we know that the 386 can handle misalignment and has the "right" 
    byteorder */
-#ifdef __i386__
+#if defined(__i386__) || defined(__BEOS__)
 #define CAREFUL_ALIGNMENT 0
 #endif
 
diff -urN samba-3.0.0.org/source/include/config.h.in samba-3.0.0/source/include/config.h.in
--- samba-3.0.0.org/source/include/config.h.in	Thu Sep 25 03:54:13 2003
+++ samba-3.0.0/source/include/config.h.in	Fri Dec 19 22:26:28 2003
@@ -3,6 +3,9 @@
 /* Whether the host os is aix */
 #undef AIX
 
+/* Whether the host os is BeOS/Zeta */
+#undef BEOS
+
 /* Does getgrnam work correctly */
 #undef BROKEN_GETGRNAM
 
@@ -537,6 +540,12 @@
 
 /* Define to 1 if you have the `asn1' library (-lasn1). */
 #undef HAVE_LIBASN1
+
+/* Define to 1 if you have the `be' library (-lbe). */
+#undef HAVE_LIBBE
+
+/* Define to 1 if you have the `bind' library (-lbind). */
+#undef HAVE_LIBBIND
 
 /* Define to 1 if you have the `com_err' library (-lcom_err). */
 #undef HAVE_LIBCOM_ERR
diff -urN samba-3.0.0.org/source/lib/fault.c samba-3.0.0/source/lib/fault.c
--- samba-3.0.0.org/source/lib/fault.c	Thu Aug 28 23:42:43 2003
+++ samba-3.0.0/source/lib/fault.c	Tue Jan 25 18:00:12 2005
@@ -46,8 +46,10 @@
 		CatchSignal(SIGSEGV,SIGNAL_CAST SIG_DFL);
 #endif
 #ifdef SIGBUS
+#if !defined(SIGSEGV) || (SIGSEGV != SIGBUS)
 		CatchSignal(SIGBUS,SIGNAL_CAST SIG_DFL);
 #endif
+#endif
 		return; /* this should cause a core dump */
 	}
 	exit(1);
@@ -67,12 +69,15 @@
 void fault_setup(void (*fn)(void *))
 {
 	cont_fn = fn;
-
+#ifdef WTF_BEOS_DEBUGGER_WANTS_TO_CATCH_THOSE
 #ifdef SIGSEGV
 	CatchSignal(SIGSEGV,SIGNAL_CAST sig_fault);
 #endif
 #ifdef SIGBUS
+#if !defined(SIGSEGV) || (SIGSEGV != SIGBUS)
 	CatchSignal(SIGBUS,SIGNAL_CAST sig_fault);
+#endif
+#endif
 #endif
 }
 
diff -urN samba-3.0.0.org/source/lib/interfaces.c samba-3.0.0/source/lib/interfaces.c
--- samba-3.0.0.org/source/lib/interfaces.c	Sat Jun  7 19:57:32 2003
+++ samba-3.0.0/source/lib/interfaces.c	Thu Jan 29 16:56:30 2004
@@ -307,7 +307,14 @@
 			goto next;
 		}
 
+#ifndef __BEOS__
 		nmask = ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr;
+#else
+		/*
+		 * BeOS (BONE) uses a different field for that in ifreq_t.
+		 */
+		nmask = ((struct sockaddr_in *)&ifr->ifr_mask)->sin_addr;
+#endif
 
 		strncpy(ifaces[total].name, iname, sizeof(ifaces[total].name)-1);
 		ifaces[total].name[sizeof(ifaces[total].name)-1] = 0;
@@ -323,10 +330,17 @@
 		 * minimum size. Usually this doesn't matter, but if
 		 * your machine has tunnel interfaces, etc. that have
 		 * a zero length "link address", this does matter.  */
-
+#ifndef __BEOS__
 		if (inc < sizeof(ifr->ifr_addr))
 			inc = sizeof(ifr->ifr_addr);
 		inc += IFNAMSIZ;
+#else
+		/*
+		 * BONE has a big struct for ifreq, not a union...
+		 * which actually includes everything we would need 
+		 * without any other ioctl.			    */
+		inc = sizeof(struct ifreq);
+#endif
 
 		ifr = (struct ifreq*) (((char*) ifr) + inc);
 		i -= inc;
diff -urN samba-3.0.0.org/source/lib/system_smbd.c samba-3.0.0/source/lib/system_smbd.c
--- samba-3.0.0.org/source/lib/system_smbd.c	Wed Jul 16 17:56:26 2003
+++ samba-3.0.0/source/lib/system_smbd.c	Fri Nov 14 01:46:58 2003
@@ -92,13 +92,13 @@
 
 	restore_re_gid();
 
-	if (setgroups(ngrp_saved, gids_saved) != 0) {
-		/* yikes! */
-		DEBUG(0,("ERROR: getgrouplist: failed to reset group list!\n"));
-		smb_panic("getgrouplist: failed to reset group list!\n");
-		free(gids_saved);
-		return -1;
-	}
+//	if (setgroups(ngrp_saved, gids_saved) != 0) {
+//		/* yikes! */
+//		DEBUG(0,("ERROR: getgrouplist: failed to reset group list!\n"));
+//		smb_panic("getgrouplist: failed to reset group list!\n");
+//		free(gids_saved);
+//		return -1;
+//	}
 
 	free(gids_saved);
 	return ret;
diff -urN samba-3.0.0.org/source/libsmb/libsmbclient.c samba-3.0.0/source/libsmb/libsmbclient.c
--- samba-3.0.0.org/source/libsmb/libsmbclient.c	Sat Jun  7 19:57:33 2003
+++ samba-3.0.0/source/libsmb/libsmbclient.c	Fri Nov 14 11:21:08 2003
@@ -1140,7 +1140,9 @@
 
 	st->st_size = size;
 	st->st_blksize = 512;
+#ifndef __BEOS__
 	st->st_blocks = (size+511)/512;
+#endif /* __BEOS__ */
 	st->st_uid = getuid();
 	st->st_gid = getgid();
 
diff -urN samba-3.0.0.org/source/modules/vfs_recycle.c samba-3.0.0/source/modules/vfs_recycle.c
--- samba-3.0.0.org/source/modules/vfs_recycle.c	Mon Sep  8 18:04:35 2003
+++ samba-3.0.0/source/modules/vfs_recycle.c	Fri Nov 14 00:54:02 2003
@@ -213,7 +213,11 @@
 	char *tok_str;
 	BOOL ret = False;
 
-	mode = S_IREAD | S_IWRITE | S_IEXEC;
+	mode = S_IREAD | S_IWRITE
+#ifdef S_IEXEC
+ | S_IEXEC
+#endif
+;
 
 	tmp_str = strdup(dname);
 	ALLOC_CHECK(tmp_str, done);
diff -urN samba-3.0.0.org/source/nsswitch/wb_client.c samba-3.0.0/source/nsswitch/wb_client.c
--- samba-3.0.0.org/source/nsswitch/wb_client.c	Fri Aug 15 22:39:57 2003
+++ samba-3.0.0/source/nsswitch/wb_client.c	Fri Nov 14 01:45:01 2003
@@ -316,11 +316,11 @@
 
 		/* Set the groups */
 
-		if (sys_setgroups(ngroups, groups) == -1) {
+//		if (sys_setgroups(ngroups, groups) == -1) {
 			errno = EPERM;
 			result = -1;
 			goto done;
-		}
+//		}
 
 	} else {
 		
diff -urN samba-3.0.0.org/source/nsswitch/wb_common.c samba-3.0.0/source/nsswitch/wb_common.c
--- samba-3.0.0.org/source/nsswitch/wb_common.c	Fri Aug 15 22:39:57 2003
+++ samba-3.0.0/source/nsswitch/wb_common.c	Fri Nov 14 01:00:21 2003
@@ -130,6 +130,7 @@
 }
 
 /* Connect to winbindd socket */
+#ifdef HAVE_UNIXSOCKET
 
 static int winbind_named_pipe_sock(const char *dir)
 {
@@ -197,6 +198,7 @@
         
 	return fd;
 }
+#endif
 
 /* Connect to winbindd socket */
 
diff -urN samba-3.0.0.org/source/rpc_server/srv_spoolss_nt.c samba-3.0.0/source/rpc_server/srv_spoolss_nt.c
--- samba-3.0.0.org/source/rpc_server/srv_spoolss_nt.c	Thu Aug 28 23:42:45 2003
+++ samba-3.0.0/source/rpc_server/srv_spoolss_nt.c	Fri Nov 14 01:41:42 2003
@@ -1803,7 +1803,11 @@
 		&& (RA_WIN2K == get_remote_arch()) )
 	{
 		DEBUG(10,("_spoolss_open_printer_ex: Enabling LAN/WAN hack for Win2k clients.\n"));
+#ifdef __BEOS__
+		snooze( 500000 );
+#else
 		usleep( 500000 );
+#endif /* __BEOS__ */
 	}
 
 	return WERR_OK;
diff -urN samba-3.0.0.org/source/smbd/dosmode.c samba-3.0.0/source/smbd/dosmode.c
--- samba-3.0.0.org/source/smbd/dosmode.c	Sat Jun  7 19:57:39 2003
+++ samba-3.0.0/source/smbd/dosmode.c	Fri Nov 14 00:52:20 2003
@@ -135,10 +135,11 @@
   
 	if (S_ISDIR(sbuf->st_mode))
 		result = aDIR | (result & aRONLY);
-
+#ifndef __BEOS__
 	if (sbuf->st_size > sbuf->st_blocks * (SMB_OFF_T)sbuf->st_blksize) {
 		result |= FILE_ATTRIBUTE_SPARSE;
 	}
+#endif
  
 #ifdef S_ISLNK
 #if LINKS_READ_ONLY
diff -urN samba-3.0.0.org/source/tdb/tdbback.c samba-3.0.0/source/tdb/tdbback.c
--- samba-3.0.0.org/source/tdb/tdbback.c	Tue Jul  1 16:40:46 2003
+++ samba-3.0.0/source/tdb/tdbback.c	Fri Nov 14 01:05:34 2003
@@ -26,7 +26,9 @@
 #include <string.h>
 #include <fcntl.h>
 #include <time.h>
+#ifndef __BEOS__
 #include <sys/mman.h>
+#endif
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <ctype.h>
diff -urN samba-3.0.0.org/source/tdb/tdbbackup.c samba-3.0.0/source/tdb/tdbbackup.c
--- samba-3.0.0.org/source/tdb/tdbbackup.c	Tue Jul  1 22:44:26 2003
+++ samba-3.0.0/source/tdb/tdbbackup.c	Fri Nov 14 01:55:23 2003
@@ -49,7 +49,10 @@
 #include <string.h>
 #include <fcntl.h>
 #include <time.h>
+#ifndef __BEOS__
 #include <sys/mman.h>
+#endif
+
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <ctype.h>
diff -urN samba-3.0.0.org/source/tests/summary.c samba-3.0.0/source/tests/summary.c
--- samba-3.0.0.org/source/tests/summary.c	Mon Apr 17 07:56:49 2000
+++ samba-3.0.0/source/tests/summary.c	Fri Nov 14 00:41:35 2003
@@ -2,7 +2,7 @@
 
 main()
 {
-#if !(defined(HAVE_FCNTL_LOCK) || defined(HAVE_STRUCT_FLOCK64))
+#if !(defined(HAVE_FCNTL_LOCK) || defined(HAVE_STRUCT_FLOCK64)) && !defined(__BEOS__)
 	printf("ERROR: No locking available. Running Samba would be unsafe\n");
 	exit(1);
 #endif
@@ -11,7 +11,7 @@
 	printf("WARNING: No automated network interface determination\n");
 #endif
 
-#if !(defined(USE_SETEUID) || defined(USE_SETREUID) || defined(USE_SETRESUID) || defined(USE_SETUIDX))
+#if !(defined(USE_SETEUID) || defined(USE_SETREUID) || defined(USE_SETRESUID) || defined(USE_SETUIDX)) && !defined(__BEOS__)
 	printf("ERROR: no seteuid method available\n");
 	exit(1);
 #endif
diff -urN samba-3.0.0.org/source/utils/profiles.c samba-3.0.0/source/utils/profiles.c
--- samba-3.0.0.org/source/utils/profiles.c	Fri Aug 15 22:40:01 2003
+++ samba-3.0.0/source/utils/profiles.c	Fri Dec 19 16:50:44 2003
@@ -295,7 +295,9 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#ifndef __BEOS__
 #include <sys/mman.h>
+#endif
 
 typedef unsigned int DWORD;
 typedef unsigned short WORD;
@@ -610,7 +612,18 @@
    * dealing with the records. We are interested in the sk record
    */
   start = 0;
+#ifdef HAVE_MMAP
   base = mmap(&start, sbuf.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+#else
+  base = malloc(sbuf.st_size);
+  if (base) {
+    if (read(fd, base, sbuf.st_size) < sbuf.st_size) {
+      free(base);
+      base = -1;
+    }
+  } else
+    base = (void *)-1;
+#endif
 
   if ((int)base == -1) {
     fprintf(stderr, "Could not mmap file: %s, %s\n", poptPeekArg(pc),
@@ -726,7 +739,12 @@
     sk_hdr = (SK_HDR *)(base + OFF(IVAL(&sk_hdr->prev_off, 0)));
   } while (sk_off != first_sk_off);
 
-  munmap(base, sbuf.st_size); 
+#ifdef HAVE_MMAP
+  munmap(base, sbuf.st_size);
+#else
+  lseek(fd, 0LL, SEEK_SET);
+  write(fd, base, sbuf.st_size);
+#endif
 
   poptFreeContext(pc);
 


More information about the samba-technical mailing list