--- ./source/smbwrapper/smbw.c.uw	2004-11-16 03:03:11.000000000 +0000
+++ ./source/smbwrapper/smbw.c	2005-02-07 22:07:12.280000005 +0000
@@ -21,6 +21,12 @@
 #include "includes.h"
 #include "realcalls.h"
 
+#if defined(HAVE_UNIXWARE_ACLS)
+#define SETACL          ACL_SET
+#define GETACL          ACL_GET
+#define GETACLCNT       ACL_CNT
+#endif
+
 pstring smbw_cwd;
 
 static struct smbw_file *smbw_files;
@@ -1444,7 +1450,7 @@
 /***************************************************** 
 say no to acls
 *******************************************************/
- int smbw_acl(const char *pathp, int cmd, int nentries, aclent_t *aclbufp)
+ int smbw_acl(const char *pathp, int cmd, int nentries, void *aclbufp)
 {
 	if (cmd == GETACL || cmd == GETACLCNT) return 0;
 	errno = ENOSYS;
@@ -1456,7 +1462,7 @@
 /***************************************************** 
 say no to acls
 *******************************************************/
- int smbw_facl(int fd, int cmd, int nentries, aclent_t *aclbufp)
+ int smbw_facl(int fd, int cmd, int nentries, void *aclbufp)
 {
 	if (cmd == GETACL || cmd == GETACLCNT) return 0;
 	errno = ENOSYS;
--- ./source/aparser/Makefile.uw	2004-11-16 03:03:16.000000000 +0000
+++ ./source/aparser/Makefile	2005-02-07 22:07:12.360000000 +0000
@@ -1,5 +1,5 @@
-CFLAGS=-Wall -g
-CC=gcc
+CFLAGS=
+CC=cc
 
 OBJ = vluke.o parser.o 
 AWKPROGS=dump.awk harness.awk header.awk parsefn.awk main.awk parsetree.awk template.awk util.awk
--- ./source/param/loadparm.c.uw	2004-11-16 03:03:16.000000000 +0000
+++ ./source/param/loadparm.c	2005-02-07 22:10:48.550000032 +0000
@@ -1508,8 +1508,8 @@
 	Globals.bAllowTrustedDomains = True;
 
 	string_set(&Globals.szTemplateShell, "/bin/false");
-	string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
-	string_set(&Globals.szTemplatePrimaryGroup, "nobody");
+	string_set(&Globals.szTemplateHomedir, "/usr/%D/%U");
+	string_set(&Globals.szTemplatePrimaryGroup, "nogroup");
 	string_set(&Globals.szWinbindSeparator, "\\");
 	string_set(&Globals.szAclCompat, "");
 	string_set(&Globals.szCupsServer, "");
--- ./source/nsswitch/nss.h.uw	2005-02-07 22:07:12.370000006 +0000
+++ ./source/nsswitch/nss.h	2005-02-07 22:07:12.370000009 +0000
@@ -0,0 +1,58 @@
+/*-
+ * Copyright (c) 2003 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by
+ * Jacques A. Vidrine, Safeport Network Services, and Network
+ * Associates Laboratories, the Security Research Division of Network
+ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: /repoman/r/ncvs/src/include/nss.h,v 1.2 2004/01/09 13:43:49 nectar Exp $
+ *
+ * Compatibility header for the GNU C Library-style nsswitch interface.
+ */
+#ifndef _NSS_H_
+#define _NSS_H_
+
+#include <nsswitch.h>
+
+enum nss_status {
+	NSS_STATUS_TRYAGAIN = -2,
+	NSS_STATUS_UNAVAIL,
+	NSS_STATUS_NOTFOUND,
+	NSS_STATUS_SUCCESS,
+	NSS_STATUS_RETURN
+};
+
+#define __nss_compat_result(rv, err)		\
+((rv == NSS_STATUS_TRYAGAIN && err == ERANGE) ? NS_RETURN : \
+ (rv == NSS_STATUS_TRYAGAIN) ? NS_TRYAGAIN :	\
+ (rv == NSS_STATUS_UNAVAIL)  ? NS_UNAVAIL  :	\
+ (rv == NSS_STATUS_NOTFOUND) ? NS_NOTFOUND :	\
+ (rv == NSS_STATUS_SUCCESS)  ? NS_SUCCESS  :	\
+ (rv == NSS_STATUS_RETURN)   ? NS_RETURN   : 0)
+
+#endif
+
--- ./source/nsswitch/nss_compat.c.uw	2005-02-07 22:07:12.370000015 +0000
+++ ./source/nsswitch/nss_compat.c	2005-02-07 22:07:12.370000018 +0000
@@ -0,0 +1,272 @@
+/*-
+ * Copyright (c) 2003 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by
+ * Jacques A. Vidrine, Safeport Network Services, and Network
+ * Associates Laboratories, the Security Research Division of Network
+ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Compatibility shims for the GNU C Library-style nsswitch interface.
+ */
+#include <sys/cdefs.h>
+//__FBSDID("$FreeBSD: /repoman/r/ncvs/src/lib/libc/net/nss_compat.c,v 1.3 2004/03/30 15:56:15 nectar Exp $");
+
+//#include "namespace.h"
+#include <sys/param.h>
+#include <errno.h>
+#include "nss.h"
+#include <stdio.h>
+#include "nsswitch.h"
+//#include <pthread.h>
+//#include <pthread_np.h>
+//#include "un-namespace.h"
+//#include "libc_private.h"
+
+
+struct group;
+struct passwd;
+
+//static int	terminator;
+
+/*#define DECLARE_TERMINATOR(x)					\
+//static pthread_key_t	 _term_key_##x;				\
+//static void							\
+//_term_create_##x(void)						\
+//{								\
+//	(void)_pthread_key_create(&_term_key_##x, NULL);	\
+//}								\
+//static void		*_term_main_##x;			\
+//static pthread_once_t	 _term_once_##x = PTHREAD_ONCE_INIT
+
+//#define SET_TERMINATOR(x, y)						\
+//do {									\
+//	if (!__isthreaded || _pthread_main_np())			\
+//		_term_main_##x = (y);					\
+//	else {								\
+//			(void)_pthread_once(&_term_once_##x, _term_create_##x);	\
+//			(void)_pthread_setspecific(_term_key_##x, y);		\
+//	}								\
+} while (0)
+//
+//#define CHECK_TERMINATOR(x)					\
+//(!__isthreaded || _pthread_main_np() ?				\
+//   (_term_main_##x) :						\
+//  ((void)_pthread_once(&_term_once_##x, _term_create_##x),	\
+//    _pthread_getspecific(_term_key_##x)))
+
+
+
+//DECLARE_TERMINATOR(group);*/
+
+int __nss_compat_getgrnam_r(void *retval, void *mdata, va_list ap)
+{
+	int (*fn)(const char *, struct group *, char *, size_t, int *);
+	const char	*name;
+	struct group	*grp;
+	char		*buffer;
+	int		*errnop;
+	size_t		 bufsize;
+	enum nss_status	 status;
+
+	fn = mdata;
+	name = va_arg(ap, const char *);
+	grp = va_arg(ap, struct group *);
+	buffer = va_arg(ap, char *);
+	bufsize = va_arg(ap, size_t);
+	errnop = va_arg(ap, int *);
+	status = fn(name, grp, buffer, bufsize, errnop);
+	status = __nss_compat_result(status, *errnop);
+	if (status == NS_SUCCESS)
+		*(struct group **)retval = grp;
+	return (status);
+}
+
+
+int __nss_compat_getgrgid_r(void *retval, void *mdata, va_list ap)
+{
+	int (*fn)(gid_t, struct group *, char *, size_t, int *);
+	gid_t		 gid;
+	struct group	*grp;
+	char		*buffer;
+	int		*errnop;
+	size_t		 bufsize;
+	enum nss_status	 status;
+	
+	fn = mdata;
+	gid = va_arg(ap, gid_t);
+	grp = va_arg(ap, struct group *);
+	buffer = va_arg(ap, char *);
+	bufsize = va_arg(ap, size_t);
+	errnop = va_arg(ap, int *);
+	status = fn(gid, grp, buffer, bufsize, errnop);
+	status = __nss_compat_result(status, *errnop);
+	if (status == NS_SUCCESS)
+		*(struct group **)retval = grp;
+	return (status);
+}
+
+
+int __nss_compat_getgrent_r(void *retval, void *mdata, va_list ap)
+{
+	int (*fn)(struct group *, char *, size_t, int *);
+	struct group	*grp;
+	char		*buffer;
+	int		*errnop;
+	size_t		 bufsize;
+	enum nss_status	 status;
+
+	//if (CHECK_TERMINATOR(group))
+	//	return (NS_NOTFOUND);
+	fn = mdata;
+	grp = va_arg(ap, struct group *);
+	buffer = va_arg(ap, char *);
+	bufsize = va_arg(ap, size_t);
+	errnop = va_arg(ap, int *);
+	status = fn(grp, buffer, bufsize, errnop);
+	status = __nss_compat_result(status, *errnop);
+	if (status == NS_SUCCESS)
+		*(struct group **)retval = grp;
+	//else if (status != NS_RETURN)
+	//	SET_TERMINATOR(group, &terminator);
+	return (status);
+}
+
+
+int __nss_compat_setgrent(void *retval, void *mdata, va_list ap)
+{
+
+	//SET_TERMINATOR(group, NULL);
+	((int (*)(void))mdata)();
+	return (NS_UNAVAIL);
+}
+
+
+int __nss_compat_endgrent(void *retval, void *mdata, va_list ap)
+{
+
+	//SET_TERMINATOR(group, NULL);
+	((int (*)(void))mdata)();
+	return (NS_UNAVAIL);
+}
+
+
+
+//DECLARE_TERMINATOR(passwd);
+
+
+int __nss_compat_getpwnam_r(void *retval, void *mdata, va_list ap)
+{
+	int (*fn)(const char *, struct passwd *, char *, size_t, int *);
+	const char	*name;
+	struct passwd	*pwd;
+	char		*buffer;
+	int		*errnop;
+	size_t		 bufsize;
+	enum nss_status	 status;
+
+	fn = mdata;
+	name = va_arg(ap, const char *);
+	pwd = va_arg(ap, struct passwd *);
+	buffer = va_arg(ap, char *);
+	bufsize = va_arg(ap, size_t);
+	errnop = va_arg(ap, int *);
+	status = fn(name, pwd, buffer, bufsize, errnop);
+	fprintf(stderr, "compat_r=%d\n", status);
+	status = __nss_compat_result(status, *errnop);
+	fprintf(stderr, "compat_r2=%d\n", status);
+	if (status == NS_SUCCESS)
+		*(struct passwd **)retval = pwd;
+	return (status);
+}
+
+
+int __nss_compat_getpwuid_r(void *retval, void *mdata, va_list ap)
+{
+	int (*fn)(uid_t, struct passwd *, char *, size_t, int *);
+	uid_t		 uid;
+	struct passwd	*pwd;
+	char		*buffer;
+	int		*errnop;
+	size_t		 bufsize;
+	enum nss_status	 status;
+	
+	fn = mdata;
+	uid = va_arg(ap, uid_t);
+	pwd = va_arg(ap, struct passwd *);
+	buffer = va_arg(ap, char *);
+	bufsize = va_arg(ap, size_t);
+	errnop = va_arg(ap, int *);
+	status = fn(uid, pwd, buffer, bufsize, errnop);
+	status = __nss_compat_result(status, *errnop);
+	if (status == NS_SUCCESS)
+		*(struct passwd **)retval = pwd;
+	return (status);
+}
+
+
+int __nss_compat_getpwent_r(void *retval, void *mdata, va_list ap)
+{
+	int (*fn)(struct passwd *, char *, size_t, int *);
+	struct passwd	*pwd;
+	char		*buffer;
+	int		*errnop;
+	size_t		 bufsize;
+	enum nss_status	 status;
+
+	//if (CHECK_TERMINATOR(passwd))
+	//	return (NS_NOTFOUND);
+	fn = mdata;
+	pwd = va_arg(ap, struct passwd *);
+	buffer = va_arg(ap, char *);
+	bufsize = va_arg(ap, size_t);
+	errnop = va_arg(ap, int *);
+	status = fn(pwd, buffer, bufsize, errnop);
+	status = __nss_compat_result(status, *errnop);
+	if (status == NS_SUCCESS)
+		*(struct passwd **)retval = pwd;
+	//else if (status != NS_RETURN)
+	//	SET_TERMINATOR(passwd, &terminator);
+	return (status);
+}
+
+
+int __nss_compat_setpwent(void *retval, void *mdata, va_list ap)
+{
+
+	//SET_TERMINATOR(passwd, NULL);
+	((int (*)(void))mdata)();
+	return (NS_UNAVAIL);
+}
+
+
+int __nss_compat_endpwent(void *retval, void *mdata, va_list ap)
+{
+
+	//SET_TERMINATOR(passwd, NULL);
+	((int (*)(void))mdata)();
+	return (NS_UNAVAIL);
+}
+
--- ./source/nsswitch/winbind_nss_uw7.c.uw	2005-02-07 22:07:12.380000004 +0000
+++ ./source/nsswitch/winbind_nss_uw7.c	2005-02-07 22:07:12.380000007 +0000
@@ -0,0 +1,160 @@
+/* 
+   Unix SMB/CIFS implementation.
+
+   AIX loadable authentication module, providing identification 
+   routines against Samba winbind/Windows NT Domain
+
+   Copyright (C) Aaron Collins 2003
+   
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+   
+   This library 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
+   Library General Public License for more details.
+   
+   You should have received a copy of the GNU Library General Public
+   License along with this library; if not, write to the
+   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA  02111-1307, USA.   
+*/
+
+#include "winbind_client.h"
+#include <nsswitch.h>
+#include <iaf.h>
+#include <ia.h>
+
+
+#define NSDB_GROUP		"group"
+#define NSDB_PASSWD		"passwd"
+
+#define NSS_METHOD_PROTOTYPE(method) \
+	int method(void *, void *, va_list)
+
+/* Make sure that the module gets registered needed by freebsd 5.1 */
+
+extern enum nss_status _nss_winbind_getgrent_r(struct group *, char *, size_t,
+    int *);
+extern enum nss_status _nss_winbind_getgrnam_r(const char *, struct group *,
+    char *, size_t, int *);
+extern enum nss_status _nss_winbind_getgrgid_r(gid_t gid, struct group *, char *,
+    size_t, int *);
+extern enum nss_status _nss_winbind_setgrent(void);
+extern enum nss_status _nss_winbind_endgrent(void);
+
+extern enum nss_status _nss_winbind_getpwent_r(struct passwd *, char *, size_t,
+    int *);
+extern enum nss_status _nss_winbind_getpwnam_r(const char *, struct passwd *,
+    char *, size_t, int *);
+extern enum nss_status _nss_winbind_getpwuid_r(gid_t gid, struct passwd *, char *,
+    size_t, int *);
+extern enum nss_status _nss_winbind_setpwent(void);
+extern enum nss_status _nss_winbind_endpwent(void);
+
+NSS_METHOD_PROTOTYPE(__nss_compat_getgrnam_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_getgrgid_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_getgrent_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_setgrent);
+NSS_METHOD_PROTOTYPE(__nss_compat_endgrent);
+
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwnam_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwuid_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwent_r);
+NSS_METHOD_PROTOTYPE(__nss_compat_setpwent);
+NSS_METHOD_PROTOTYPE(__nss_compat_endpwent);
+
+NSS_METHOD_PROTOTYPE(_nss_winbind_openinfo);
+
+static ns_mtab methods[] = {
+{ NSDB_GROUP, "getgrnam_r", __nss_compat_getgrnam_r, (void *) _nss_winbind_getgrnam_r },
+{ NSDB_GROUP, "getgrgid_r", __nss_compat_getgrgid_r, _nss_winbind_getgrgid_r },
+{ NSDB_GROUP, "getgrent_r", __nss_compat_getgrent_r, _nss_winbind_getgrent_r },
+{ NSDB_GROUP, "endgrent",   __nss_compat_setgrent,   _nss_winbind_setgrent },
+{ NSDB_GROUP, "setgrent",   __nss_compat_endgrent,   _nss_winbind_endgrent },
+
+{ NSDB_PASSWD, "getpwnam_r", __nss_compat_getpwnam_r, _nss_winbind_getpwnam_r },
+{ NSDB_PASSWD, "getpwuid_r", __nss_compat_getpwuid_r, _nss_winbind_getpwuid_r },
+{ NSDB_PASSWD, "getpwent_r", __nss_compat_getpwent_r, _nss_winbind_getpwent_r },
+{ NSDB_PASSWD, "endpwent",   __nss_compat_setpwent,   _nss_winbind_setpwent },
+{ NSDB_PASSWD, "setpwent",   __nss_compat_endpwent,   _nss_winbind_endpwent },
+
+{ "iaf",	"ia_openinfo",	_nss_winbind_openinfo, 0},
+};
+
+ns_mtab *
+nss_module_register(const char *source, unsigned int *mtabsize,
+    nss_module_unregister_fn *unreg)
+{
+        *mtabsize = sizeof(methods)/sizeof(methods[0]);
+        *unreg = NULL;
+        return (methods);
+}
+
+/* int ia_openinfo(const char  * logname, uinfo_t  * uinfo); */
+int 
+_nss_winbind_openinfo(void *rv, void *mdata, va_list ap)
+{
+	const char *name;
+	struct passwd p;
+	char buf[512];
+	int *errnop, *ret = rv;
+	enum nss_status status;
+	int n, dlen, slen;
+	uinfo_t *uipp = NULL;
+	uinfo_t uip;
+
+	name = va_arg(ap, const char *);
+	uipp = va_arg(ap, uinfo_t *);
+
+	*uipp = 0;
+	
+	status = _nss_winbind_getpwnam_r(name, &p, buf, 512, errnop);
+	status = __nss_compat_result(status, *errnop);
+
+	if (status == NS_SUCCESS) {
+		dlen = strlen(p.pw_dir);
+		slen = strlen(p.pw_shell);
+
+		/* struct + 1 group + dir + shell */
+		n = sizeof(*uip) + 1 + sizeof(gid_t) + dlen + 1 + slen + 1;
+
+		if ((uip = malloc(n)) == NULL) {
+			return NS_TRYAGAIN;
+		}
+
+		bzero(uip, n);
+
+		strncpy(uip->ia_name, p.pw_name, sizeof(uip->ia_name));
+		strncpy(uip->ia_pwdp, p.pw_passwd, sizeof(uip->ia_pwdp));
+		uip->ia_uid = p.pw_uid;
+		uip->ia_gid = p.pw_gid;
+		uip->ia_lstchg = -1;
+		uip->ia_min = -1;
+		uip->ia_max = -1;
+		uip->ia_warn = -1;
+		uip->ia_inact = -1;
+		uip->ia_expire = -1;
+
+		uip->ia_dirsz = dlen;
+		uip->ia_shsz = slen;
+		uip->ia_lvlcnt = 0;
+		uip->ia_sgidcnt = 1;
+
+		uip->ia_lvlp = (level_t *)&uip[1];
+		uip->ia_sgidp = (gid_t *)&uip[1];
+		uip->ia_dirp = (char *)&uip->ia_sgidp[1];
+		uip->ia_shellp = &uip->ia_dirp[dlen + 1];
+		*uip->ia_sgidp = p.pw_gid;
+		strcpy(uip->ia_dirp, p.pw_dir);
+		strcpy(uip->ia_shellp, p.pw_shell);
+
+		*ret = 0;
+		*uipp = uip;
+	}
+
+	fprintf(stderr, "ia_openinfo: status=%d\n", status);
+	return status;
+}
--- ./source/nsswitch/winbind_nss.h.uw	2004-11-16 03:03:17.000000000 +0000
+++ ./source/nsswitch/winbind_nss.h	2005-02-07 22:07:12.380000020 +0000
@@ -58,6 +58,10 @@
 
 #else /* Nothing's defined. Neither gnu nor sun nor hp */
 
+#include "nss.h"
+typedef enum nss_status NSS_STATUS;
+
+/*
 typedef enum
 {
   NSS_STATUS_SUCCESS=0,
@@ -65,6 +69,7 @@
   NSS_STATUS_UNAVAIL=2,
   NSS_STATUS_TRYAGAIN=3
 } NSS_STATUS;
+*/
 
 #endif
 
--- ./source/nsswitch/wb_common.c.uw	2004-11-16 03:03:18.000000000 +0000
+++ ./source/nsswitch/wb_common.c	2005-02-07 22:07:12.380000037 +0000
@@ -234,7 +234,8 @@
 		struct timeval tv;
 		fd_set w_fds;
 		int ret;
-		int connect_errno = 0, errnosize;
+		int connect_errno = 0; 
+		size_t errnosize;
 
 		if (wait_time >= CONNECT_TIMEOUT)
 			goto error_out;
@@ -249,7 +250,7 @@
 				ret = select(fd + 1, NULL, &w_fds, NULL, &tv);
 
 				if (ret > 0) {
-					errnosize = sizeof(connect_errno);
+					errnosize = (size_t)sizeof(connect_errno);
 
 					ret = getsockopt(fd, SOL_SOCKET,
 							SO_ERROR, &connect_errno, &errnosize);
--- ./source/lib/charcnv.c.uw	2004-11-16 03:03:20.000000000 +0000
+++ ./source/lib/charcnv.c	2005-02-07 22:07:12.390000009 +0000
@@ -70,7 +70,7 @@
 		setlocale(LC_ALL, "");
 #endif
 		ln = nl_langinfo(CODESET);
-		if (ln) {
+		if (ln && ln[0] != '\0') {
 			/* Check whether the charset name is supported
 			   by iconv */
 			smb_iconv_t handle = smb_iconv_open(ln,"UCS-2LE");
--- ./source/lib/iconv.c.uw	2004-11-16 03:03:19.000000000 +0000
+++ ./source/lib/iconv.c	2005-02-07 22:07:12.390000029 +0000
@@ -642,15 +642,15 @@
 
 	*inbytesleft = in_left;
 	*outbytesleft = out_left;
-	*inbuf = c;
-	*outbuf = uc;	
+	*inbuf = (const char *)c;
+	*outbuf = (char *)uc;	
 	return 0;
 
 error:
 	*inbytesleft = in_left;
 	*outbytesleft = out_left;
-	*inbuf = c;
-	*outbuf = uc;
+	*inbuf = (const char *)c;
+	*outbuf = (char *)uc;
 	return -1;
 }
 
@@ -755,16 +755,16 @@
 
 	*inbytesleft = in_left;
 	*outbytesleft = out_left;
-	*inbuf  = uc;
-	*outbuf = c;
+	*inbuf  = (const char *)uc;
+	*outbuf = (char *)c;
 	
 	return 0;
 
 error:
 	*inbytesleft = in_left;
 	*outbytesleft = out_left;
-	*inbuf  = uc;
-	*outbuf = c;
+	*inbuf  = (const char *)uc;
+	*outbuf = (char *)c;
 	return -1;
 }
 
--- ./source/include/vfs.h.uw	2004-11-16 03:03:28.000000000 +0000
+++ ./source/include/vfs.h	2005-02-07 22:07:12.390000046 +0000
@@ -464,7 +464,7 @@
 
 #define SMB_VFS_HANDLE_SET_DATA(handle, datap, free_fn, type, ret) { \
 	if (!(handle)) { \
-		DEBUG(0,("%s() failed to set handle->data!\n",FUNCTION_MACRO)); \
+		DEBUG(0,("%s() failed to set vfs_handle->data!\n",FUNCTION_MACRO)); \
 		ret; \
 	} else { \
 		if ((handle)->free_data) { \
--- ./source/include/local.h.uw	2004-11-16 03:03:28.000000000 +0000
+++ ./source/include/local.h	2005-02-07 22:08:12.000000010 +0000
@@ -98,7 +98,7 @@
 
 /* the default guest account - normally set in the Makefile or smb.conf */
 #ifndef GUEST_ACCOUNT
-#define GUEST_ACCOUNT "nobody"
+#define GUEST_ACCOUNT "nouser"
 #endif
 
 /* user to test password server with as invalid in security=server mode. */
--- ./source/tdb/Makefile.uw	2004-11-16 03:03:34.000000000 +0000
+++ ./source/tdb/Makefile	2005-02-07 22:07:12.390000060 +0000
@@ -3,7 +3,7 @@
 #
 
 CFLAGS = -DSTANDALONE -DTDB_DEBUG -g -DHAVE_MMAP=1
-CC = gcc
+CC = cc
 
 ADMINPROGS = tdbdump tdbbackup
 PROGS = tdbtest tdbtool tdbtorture
@@ -14,19 +14,19 @@
 admintools: $(ADMINPROGS)
 
 tdbtest: tdbtest.o $(TDB_OBJ)
-	$(CC) $(CFLAGS) -o tdbtest tdbtest.o $(TDB_OBJ) -lgdbm
+	$(CC) $(CFLAGS) -o tdbtest tdbtest.o $(TDB_OBJ) -lgdbm ../bin/libsmbclient.a
 
 tdbtool: tdbtool.o $(TDB_OBJ)
-	$(CC) $(CFLAGS) -o tdbtool tdbtool.o $(TDB_OBJ)
+	$(CC) $(CFLAGS) -o tdbtool tdbtool.o $(TDB_OBJ) ../bin/libsmbclient.a
 
 tdbtorture: tdbtorture.o $(TDB_OBJ)
-	$(CC) $(CFLAGS) -o tdbtorture tdbtorture.o $(TDB_OBJ)
+	$(CC) $(CFLAGS) -o tdbtorture tdbtorture.o $(TDB_OBJ) ../bin/libsmbclient.a
 
 tdbdump: tdbdump.o $(TDB_OBJ)
-	$(CC) $(CFLAGS) -o tdbdump tdbdump.o $(TDB_OBJ)
+	$(CC) $(CFLAGS) -o tdbdump tdbdump.o $(TDB_OBJ) ../bin/libsmbclient.a
 
 tdbbackup: tdbbackup.o $(TDB_OBJ)
-	$(CC) $(CFLAGS) -o tdbbackup tdbbackup.o $(TDB_OBJ)
+	$(CC) $(CFLAGS) -o tdbbackup tdbbackup.o $(TDB_OBJ) ../bin/libsmbclient.a
 
 clean:
 	rm -f $(PROGS) *.o *~ *% core test.db test.tdb test.gdbm
--- ./source/script/installswat.sh.uw	2004-11-16 03:03:33.000000000 +0000
+++ ./source/script/installswat.sh	2005-02-07 22:07:12.400000005 +0000
@@ -103,6 +103,7 @@
               fi
           fi
           for f in $SRCDIR../docs/$dir/images/*.png; do
+              if [ "$f" = "$SRCDIR../docs/$dir/images/*.png" ]; then break; fi
               FNAME=$INSTALLDIR/`basename $f`
               echo $FNAME
               cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
--- ./source/configure.in.uw	2004-11-16 03:03:30.000000000 +0000
+++ ./source/configure.in	2005-02-07 22:07:12.410000019 +0000
@@ -780,9 +780,9 @@
 
 ],
 	samba_cv_optimize_out_funcation_calls=yes,samba_cv_optimize_out_funcation_calls=no)])
-if test x"$samba_cv_optimize_out_funcation_calls" = x"yes"; then
-   AC_DEFINE(HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS,1,[Whether the compiler will optimize out function calls])
-fi
+#if test x"$samba_cv_optimize_out_funcation_calls" = x"yes"; then
+#   AC_DEFINE(HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS,1,[Whether the compiler will optimize out function calls])
+#fi
 
 ############################################
 # check for unix domain sockets
@@ -1263,12 +1263,14 @@
 		*sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
 			AC_DEFINE(STAT_ST_BLOCKSIZE,512)
 			;;
-		*unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
-			BLDSHARED="true"
-			LDSHFLAGS="-shared"
-			SONAMEFLAG="-Wl,-soname,"
+		*unixware*|*UnixWare*|*sysv5*) BLDSHARED="true"
+			LDSHFLAGS="-G"
+			SONAMEFLAG="-Wl,-h,"
 			PICFLAGS="-KPIC"
+                        AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
 			AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+		        AC_DEFINE(SYSV,1,[Whether this is a system V system])
+			AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
 			;;
 		*next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
 			AC_DEFINE(STAT_ST_BLOCKSIZE,512)
@@ -1289,13 +1291,6 @@
 			AC_DEFINE(STAT_ST_BLOCKSIZE,512)
 			;;
 
-		*sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
-			if [ test "$GCC" != yes ]; then
-				AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
-			fi
-			LDSHFLAGS="-G"
-			AC_DEFINE(STAT_ST_BLOCKSIZE,512)
-			;;
 		*vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
 			BLDSHARED="false"
 			LDSHFLAGS=""
@@ -3914,7 +3909,7 @@
   yes)
 
 	case "$host_os" in
-	*sysv5*)
+	*unixware*|*UnixWare*|*sysv5*)
 		AC_MSG_RESULT(Using UnixWare ACLs)
 		AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
 		;;
@@ -4279,6 +4274,14 @@
 		    nsswitch/winbind_nss_linux.o"
 		WINBIND_NSS_EXTRA_LIBS="-lsocket"
 		;;
+        *unixware*|*sysv5*|*UnixWare*)
+                # UW714+ winbind client is implemented as a wrapper around
+                # the Linux version.
+                WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_uw7.o \
+                    nsswitch/nss_compat.o \
+                    nsswitch/winbind_nss_linux.o"
+                WINBIND_NSS_EXTA_LIBS="-lsocket -lnsl"
+                ;;
 	*hpux11*)
 		WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
 		;;
--- ./source/config.guess.uw	2004-11-16 03:03:15.000000000 +0000
+++ ./source/config.guess	2005-02-07 22:07:12.460000006 +0000
@@ -972,6 +972,11 @@
         # Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
 	exit 0 ;;
+     i*86:5:UnixWare:7.*)
+         # Additional variants of Unixware.
+         # Use sysv4.2uw... so that sysv4* matches it.
+       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       exit 0 ;;
     i*86:OS/2:*:*)
 	# If we were able to find `uname', then EMX Unix compatibility
 	# is probably installed.
--- ./source/Makefile.in.uw	2004-11-16 03:03:12.000000000 +0000
+++ ./source/Makefile.in	2005-02-07 22:07:12.480000009 +0000
@@ -1154,7 +1154,7 @@
 bin/CP850.@SHLIBEXT@: $(CP850_OBJ:.o=.@PICSUFFIX@)
 	@echo "Building plugin $@"
 	@$(SHLD) $(LDSHFLAGS) -o $@ $(CP850_OBJ:.o=.@PICSUFFIX@) \
-		@SONAMEFLAG@`basename $@`
+		@SONAMEFLAG@`basename $@` -L./bin -lsmbclient
 
 bin/CP437.@SHLIBEXT@: $(CP437_OBJ:.o=.@PICSUFFIX@)
 	@echo "Building plugin $@"
--- ./examples/VFS/configure.in.uw	2004-11-16 03:03:50.000000000 +0000
+++ ./examples/VFS/configure.in	2005-02-07 22:07:12.480000025 +0000
@@ -175,7 +175,7 @@
 
 # these are the defaults, good for lots of systems
 HOST_OS="$host_os"
-LDSHFLAGS="-shared"
+LDSHFLAGS="-G"
 SONAMEFLAG="#"
 SHLD="\${CC}"
 PICFLAGS=""
--- ./examples/pdb/Makefile.uw	2004-11-16 03:03:50.000000000 +0000
+++ ./examples/pdb/Makefile	2005-02-07 22:07:12.490000002 +0000
@@ -1,14 +1,14 @@
 # Makefile for samba-pdb examples
 # Variables
 
-CC = gcc
+CC = cc
 LIBTOOL = libtool
 
 SAMBA_SRC = ../../source
 SAMBA_INCL = ../../source/include
 UBIQX_SRC = ../../source/ubiqx
 SMBWR_SRC = ../../source/smbwrapper
-CFLAGS = -I$(SAMBA_SRC) -I$(SAMBA_INCL) -I$(UBIQX_SRC) -I$(SMBWR_SRC) -Wall -g -I/usr/include/heimdal -fPIC
+CFLAGS = -I$(SAMBA_SRC) -I$(SAMBA_INCL) -I$(UBIQX_SRC) -I$(SMBWR_SRC) -I/usr/include/heimdal -KPIC
 PDB_OBJS = pdb_test.so
 
 # Default target
@@ -18,7 +18,7 @@
 # Pattern rules
 
 %.so: %.lo
-	$(LIBTOOL) --mode=link $(CC) -shared -o $@ $< $(LDFLAGS)
+	$(LIBTOOL) --mode=link $(CC) -G -o $@ $< $(LDFLAGS)
 
 %.lo: %.c
 	$(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
