[PATCH] Clean up samba-2.2 for POSIX-96

Paul_GreenVOS at vos.stratus.com Paul_GreenVOS at vos.stratus.com
Sat Jun 1 12:00:12 GMT 2002


At Jeremy's request, here is a version of the POSIX-96 cleanup
patches for the Samba 2.2 branch.

This is exactly the same set of source files and changes as I
submitted yesterday for the 3.0 branch.  The only differences
are due to slight differences in the files between 2.2 and 3.0.

Patch is against 2.2.4.

Tested by successfully rebuilding all of 2.2.4 here on Stratus
VOS.

### START OF PATCH ###

diff -urp oldsamba/source/configure.in newsamba/source/configure.in
--- oldsamba/source/configure.in	Sat Jun  1 07:56:36 2002
+++ newsamba/source/configure.in	Sat Jun  1 07:56:50 2002
@@ -422,8 +422,9 @@ AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.h rpcsvc/ypclnt.h)
+AC_CHECK_HEADERS(stdlib.h string.h strings.h syslog.h sys/file.h)
 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
-AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
+AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h sys/socket.h)
 AC_CHECK_HEADERS(syslog.h sys/syslog.h sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h dlfcn.h synch.h pthread.h nsswitch.h)
diff -urp oldsamba/source/include/includes.h newsamba/source/include/includes.h
--- oldsamba/source/include/includes.h	Sat Jun  1 07:47:53 2002
+++ newsamba/source/include/includes.h	Sat Jun  1 07:58:05 2002
@@ -205,10 +205,14 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
+
 #ifdef HAVE_SYSLOG_H
 #include <syslog.h>
 #endif
+
+#ifdef HAVE_SYS_FILE_H
 #include <sys/file.h>
+#endif
 
 #ifdef HAVE_NETINET_TCP_H
 #include <netinet/tcp.h>
diff -urp oldsamba/source/lib/interfaces.c newsamba/source/lib/interfaces.c
--- oldsamba/source/lib/interfaces.c	Sat Jun  1 14:40:17 2002
+++ newsamba/source/lib/interfaces.c	Sat Jun  1 14:40:52 2002
@@ -45,7 +45,9 @@
 #include <net/if.h>
 
 #ifndef SIOCGIFCONF
+#ifdef HAVE_SYS_SOCKIO_H
 #include <sys/sockio.h>
+#endif
 #endif
 
 #ifdef AUTOCONF_TEST
diff -urp oldsamba/source/lib/util_sock.c newsamba/source/lib/util_sock.c
--- oldsamba/source/lib/util_sock.c	Thu May 23 15:54:34 2002
+++ newsamba/source/lib/util_sock.c	Thu May 23 15:57:12 2002
@@ -931,7 +931,7 @@ static BOOL matchname(char *remotehost,s
 	
 	/* Look up the host address in the address list we just got. */
 	for (i = 0; hp->h_addr_list[i]; i++) {
-		if (memcmp(hp->h_addr_list[i], (caddr_t) & addr, sizeof(addr)) == 0)
+		if (memcmp(hp->h_addr_list[i], (void *) & addr, sizeof(addr)) == 0)
 			return True;
 	}
 	
diff -urp oldsamba/source/libsmb/clifile.c newsamba/source/libsmb/clifile.c
--- oldsamba/source/libsmb/clifile.c	Thu May 23 15:54:46 2002
+++ newsamba/source/libsmb/clifile.c	Thu May 23 15:57:27 2002
@@ -77,7 +77,7 @@ static BOOL cli_link_internal(struct cli
 
 uint32  unix_perms_to_wire(mode_t perms)
 {
-        uint ret = 0;
+        uint32 ret = 0;
 
         ret |= ((perms & S_IXOTH) ?  UNIX_X_OTH : 0);
         ret |= ((perms & S_IWOTH) ?  UNIX_W_OTH : 0);
@@ -95,7 +95,7 @@ uint32  unix_perms_to_wire(mode_t perms)
         ret |= ((perms & S_ISGID) ?  UNIX_SET_GID : 0);
 #endif
 #ifdef S_ISUID
-        ret |= ((perms & S_ISVTX) ?  UNIX_SET_UID : 0);
+        ret |= ((perms & S_ISUID) ?  UNIX_SET_UID : 0);
 #endif
         return ret;
 }
diff -urp oldsamba/source/nsswitch/winbind_nss_config.h newsamba/source/nsswitch/winbind_nss_config.h
--- oldsamba/source/nsswitch/winbind_nss_config.h	Thu May 23 15:55:08 2002
+++ newsamba/source/nsswitch/winbind_nss_config.h	Thu May 23 15:58:17 2002
@@ -38,6 +38,10 @@
 #include <unistd.h>
 #endif
 
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
diff -urp oldsamba/source/pam_smbpass/general.h newsamba/source/pam_smbpass/general.h
--- oldsamba/source/pam_smbpass/general.h	Sat Jun  1 09:02:05 2002
+++ newsamba/source/pam_smbpass/general.h	Sat Jun  1 09:03:00 2002
@@ -11,11 +11,14 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <syslog.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
+
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
 
 /*
  * here is the string to inform the user that the new passwords they
diff -urp oldsamba/source/rpc_server/srv_spoolss_nt.c newsamba/source/rpc_server/srv_spoolss_nt.c
--- oldsamba/source/rpc_server/srv_spoolss_nt.c	Thu May 23 15:55:38 2002
+++ newsamba/source/rpc_server/srv_spoolss_nt.c	Thu May 23 15:59:14 2002
@@ -7886,7 +7886,7 @@ static WERROR getprintprocessordirectory
 
 	unistr2_to_ascii(long_archi, environment, sizeof(long_archi)-1);
 
-	if (get_short_archi(short_archi, long_archi)==FALSE)
+	if (get_short_archi(short_archi, long_archi)==False)
 		return WERR_INVALID_ENVIRONMENT;
 
 	if((info=(PRINTPROCESSOR_DIRECTORY_1 *)malloc(sizeof(PRINTPROCESSOR_DIRECTORY_1))) == NULL)
diff -urp oldsamba/source/rpcclient/cmd_reg.c newsamba/source/rpcclient/cmd_reg.c
--- oldsamba/source/rpcclient/cmd_reg.c	Sat Jun  1 14:30:46 2002
+++ newsamba/source/rpcclient/cmd_reg.c	Sat Jun  1 14:32:15 2002
@@ -898,6 +898,8 @@ nt registry shutdown
 static NTSTATUS cmd_reg_shutdown(struct cli_state *cli, TALLOC_CTX *mem_ctx,
                                  int argc, char **argv)
 {
+	extern char *optarg;
+	extern int optind;
 	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
 	fstring msg;
 	uint32 timeout = 20;
diff -urp oldsamba/source/smbd/chgpasswd.c newsamba/source/smbd/chgpasswd.c
--- oldsamba/source/smbd/chgpasswd.c	Thu May 23 15:55:48 2002
+++ newsamba/source/smbd/chgpasswd.c	Thu May 23 15:59:33 2002
@@ -193,7 +193,9 @@ static int dochild(int master, char *sla
 	}
 	stermios.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL);
 	stermios.c_lflag |= ICANON;
+#ifdef ONLCR
  	stermios.c_oflag &= ~(ONLCR);
+#endif
 	if (tcsetattr(0, TCSANOW, &stermios) < 0)
 	{
 		DEBUG(3, ("could not set attributes of pty\n"));
diff -urp oldsamba/source/smbd/trans2.c newsamba/source/smbd/trans2.c
--- oldsamba/source/smbd/trans2.c	Thu May 23 15:55:49 2002
+++ newsamba/source/smbd/trans2.c	Thu May 23 15:59:44 2002
@@ -399,7 +399,7 @@ static mode_t unix_perms_from_wire( conn
 	ret |= ((perms & UNIX_SET_GID ) ? S_ISGID : 0);
 #endif
 #ifdef S_ISUID
-	ret |= ((perms & UNIX_SET_UID ) ? S_ISVTX : 0);
+	ret |= ((perms & UNIX_SET_UID ) ? S_ISUID : 0);
 #endif
 
 	if (VALID_STAT(*pst) && S_ISDIR(pst->st_mode)) {
diff -urp oldsamba/source/smbd/vfs-wrap.c newsamba/source/smbd/vfs-wrap.c
--- oldsamba/source/smbd/vfs-wrap.c	Fri May 24 17:17:43 2002
+++ newsamba/source/smbd/vfs-wrap.c	Sat Jun  1 14:46:01 2002
@@ -409,6 +409,7 @@ int vfswrap_chown(connection_struct *con
 
 int vfswrap_fchown(files_struct *fsp, int fd, uid_t uid, gid_t gid)
 {
+#ifdef HAVE_FCHOWN
     int result;
 
     START_PROFILE(syscall_fchown);
@@ -416,6 +417,10 @@ int vfswrap_fchown(files_struct *fsp, in
     result = fchown(fd, uid, gid);
     END_PROFILE(syscall_fchown);
     return result;
+#else
+    errno = ENOSYS;
+    return 0;
+#endif
 }
 
 int vfswrap_chdir(connection_struct *conn, const char *path)
diff -urp oldsamba/source/utils/smbcontrol.c newsamba/source/utils/smbcontrol.c
--- oldsamba/source/utils/smbcontrol.c	Sat Jun  1 14:35:08 2002
+++ newsamba/source/utils/smbcontrol.c	Sat Jun  1 14:36:20 2002
@@ -344,6 +344,7 @@ static BOOL do_command(char *dest, char 
 {
 	int opt;
 	char temp[255];
+	extern char *optarg;
 	extern int optind;
 	pstring servicesf = CONFIGFILE;
 	BOOL interactive = False;

### 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