[PATCH] Fix samba-2.2.6pre2 to build on VOS

Paul_GreenVOS at vos.stratus.com Paul_GreenVOS at vos.stratus.com
Wed Sep 4 02:57:01 GMT 2002


The POSIX environment in the Stratus VOS operating system does
not implement Unix (AF_UNIX) sockets and samba recognizes this
(config.h #undefs HAVE_UNIXSOCKET).  However, there are a couple
of places that do not test this macro and so fail to compile
here.

I have no doubt that winbindd won't work due to this, but I'm
not trying to build it, either.  These changes at least get the
various other Samba programs to compile and link cleanly on VOS.
These changes should not affect any other platforms that already
can build Samba cleanly, because clearly they implement AF_UNIX
sockets.

I have successfully built Samba-2.2.6pre2 with the following
patches on a (32-bit) Solaris workstation, so I have some
non-zero level of confidence that I did not do anything stupid.
(The patch makes sure that anyone who attempts to call the
functions that need the Unix sockets get a fatal error on
systems that do not implement Unix sockets).

We do not (yet) implement setgroups, so I've also fixed Samba to
diagnose attempts to invoke it when it does not exist.

Changed programs:
	source/lib/util_sock.c
	source/nsswitch/wb_client.c
	source/nsswitch/wb_common.c

If this patch is acceptable, I will submit a similar patch for HEAD.

### START OF PATCH ###

diff -urp --new-file oldsamba/source/lib/util_sock.c newsamba/source/lib/util_sock.c
--- oldsamba/source/lib/util_sock.c	Tue Sep  3 18:02:26 2002
+++ newsamba/source/lib/util_sock.c	Tue Sep  3 18:02:36 2002
@@ -1029,6 +1029,7 @@ int create_pipe_sock(const char *socket_
 					const char *socket_name,
 					mode_t dir_perms)
 {
+#ifdef HAVE_UNIXSOCKET
         struct sockaddr_un sunaddr;
         struct stat st;
         int sock;
@@ -1117,6 +1118,10 @@ int create_pipe_sock(const char *socket_
         /* Success! */
         
         return sock;
+#else
+        DEBUG(0, ("create_pipe_sock: No Unix sockets on this system\n"));
+        return -1;
+#endif /* HAVE_UNIXSOCKET */
 }
 
 /*******************************************************************
diff -urp --new-file oldsamba/source/nsswitch/wb_client.c newsamba/source/nsswitch/wb_client.c
--- oldsamba/source/nsswitch/wb_client.c	Tue Sep  3 18:03:01 2002
+++ newsamba/source/nsswitch/wb_client.c	Tue Sep  3 18:05:00 2002
@@ -327,11 +327,18 @@ int winbind_initgroups(char *user, gid_t
 
 		/* Set the groups */
 
+#ifdef HAVE_SETGROUPS
 		if (sys_setgroups(ngroups, groups) == -1) {
 			errno = EPERM;
 			result = -1;
 			goto done;
 		}
+#else
+		DEBUG(10,("winbind_initgroups: No setgroups on this system.\n"));
+		errno = ENOSYS;
+		result = -1;
+		goto done;
+#endif /* HAVE_SETGROUPS */
 
 	} else {
 		
diff -urp --new-file oldsamba/source/nsswitch/wb_common.c newsamba/source/nsswitch/wb_common.c
--- oldsamba/source/nsswitch/wb_common.c	Tue Sep  3 18:03:13 2002
+++ newsamba/source/nsswitch/wb_common.c	Tue Sep  3 18:04:50 2002
@@ -98,6 +98,7 @@ void close_sock(void)
 
 int winbind_open_pipe_sock(void)
 {
+#ifdef HAVE_UNIXSOCKET
 	struct sockaddr_un sunaddr;
 	static pid_t our_pid;
 	struct stat st;
@@ -166,6 +167,9 @@ int winbind_open_pipe_sock(void)
 	}
         
 	return winbindd_fd;
+#else
+	return -1;
+#endif /* HAVE_UNIXSOCKET */
 }
 
 /* Write data to winbindd socket */

### END OF PATCH ###

Thanks
PG
--
Paul Green                  | Mail: Paul.Green at stratus.com
Senior Technical Consultant | Voice: +1 978-461-7557   FAX: +1 978-461-3610
Stratus Technologies        | Video: PictureTel/AT&T by request.
Maynard, MA  01754          | Disclaimer: I speak for myself, not Stratus.




More information about the samba-technical mailing list