[PATCH] Clean up samba-3.0 for POSIX-96
Paul_GreenVOS at vos.stratus.com
Paul_GreenVOS at vos.stratus.com
Fri May 31 15:52:04 GMT 2002
The attached set of patches cleans up samba-3.0-alpha17 for
systems such as Stratus VOS that implement POSIX-1996 but do not
provide full Unix compatibility. I would be most grateful if
this patch could be applied against samba-3.0. I can supply a
version of this patch for samba-2.2 if/when anyone cares.
Summary of changes by module:
source/configure.in check for non-POSIX headers syslog.h and sys/file.h (and alphabetize list)
source/include/includes.h conditionally include syslog.h and sys/file.h
source/lib/interfaces.c conditionally include sys/time.h and sys/sockio.h (autoconf macros already exist)
source/lib/util_sock.c change memcmp use of (caddr_t) type to (void *); removes only use of nonstandard caddr_t type.
source/libsmb/clifile.c fix bug that references uint not uint32, fix bug that references S_ISVTX not S_ISUID.
source/nsswitch/winbind_nss_config.h conditionally include sys/select.h (autoconf macro already exists)
source/pam_smbpass/general.h conditionally include syslog.h
source/rpc_server/srv_spoolss_nt.c change 'FALSE' to 'False' (Samba defines 'False' in smb.h; POSIX-96 does not admit to FALSE)
source/rpcclient/cmd_reg.c declare optarg and optind (many other Samba source files explicitly declare these names)
source/smbd/chgpasswd.c conditionally reference ONLCR macro (not in POSIX-96)
source/smbd/trans2.c fix bug that references S_ISVTX not S_ISUID
source/smbd/vfs-wrap.c conditionally reference fchown (autoconf HAVE_FCHOWN macro already exists)
source/smbd/utils/smbcontrol.c declare optarg (many other Samba source files explicitly declare this name)
Patch is against samba-3.0-alpha17.
Tested by successfully rebuilding all of samba-3.0-alpha17 here
on Stratus VOS. I actually needed a few other changes, but I'm
not submitting them at this time. I am only submitting the
changes that I am 100% sure of.
Oh, and my official email address is Paul.Green at stratus.com.
This odd addresss (Paul_GreenVOS at vos.stratus.com) is a secondary
address. I use it because it is not Outlook and won't mess up
the formatting of the text.
### START OF PATCH ###
diff -urp oldsamba3/source/configure.in newsamba3/source/configure.in
--- oldsamba3/source/configure.in Fri May 31 13:54:22 2002
+++ newsamba3/source/configure.in Fri May 31 13:54:28 2002
@@ -278,8 +278,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(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 ldap.h lber.h)
diff -urp oldsamba3/source/include/includes.h newsamba3/source/include/includes.h
--- oldsamba3/source/include/includes.h Fri May 31 13:08:57 2002
+++ newsamba3/source/include/includes.h Fri May 31 13:55:27 2002
@@ -216,8 +216,14 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
-/* #include <syslog.h> */
-/* #include <sys/file.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 oldsamba3/source/lib/interfaces.c newsamba3/source/lib/interfaces.c
--- oldsamba3/source/lib/interfaces.c Fri May 31 13:09:54 2002
+++ newsamba3/source/lib/interfaces.c Fri May 31 13:10:13 2002
@@ -38,11 +38,15 @@
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/ioctl.h>
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
+#endif
#include <net/if.h>
#ifndef SIOCGIFCONF
+#ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
+#endif
#endif
#ifdef AUTOCONF_TEST
diff -urp oldsamba3/source/lib/util_sock.c newsamba3/source/lib/util_sock.c
--- oldsamba3/source/lib/util_sock.c Fri May 31 13:09:55 2002
+++ newsamba3/source/lib/util_sock.c Fri May 31 13:10:21 2002
@@ -1020,7 +1020,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 oldsamba3/source/libsmb/clifile.c newsamba3/source/libsmb/clifile.c
--- oldsamba3/source/libsmb/clifile.c Fri May 31 13:28:36 2002
+++ newsamba3/source/libsmb/clifile.c Fri May 31 14:20:06 2002
@@ -76,7 +76,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);
@@ -94,7 +94,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 oldsamba3/source/nsswitch/winbind_nss_config.h newsamba3/source/nsswitch/winbind_nss_config.h
--- oldsamba3/source/nsswitch/winbind_nss_config.h Fri May 31 13:12:17 2002
+++ newsamba3/source/nsswitch/winbind_nss_config.h Fri May 31 13:12:47 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 oldsamba3/source/pam_smbpass/general.h newsamba3/source/pam_smbpass/general.h
--- oldsamba3/source/pam_smbpass/general.h Fri May 31 14:02:45 2002
+++ newsamba3/source/pam_smbpass/general.h Fri May 31 14:02:58 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 oldsamba3/source/rpc_server/srv_spoolss_nt.c newsamba3/source/rpc_server/srv_spoolss_nt.c
--- oldsamba3/source/rpc_server/srv_spoolss_nt.c Fri May 31 13:13:57 2002
+++ newsamba3/source/rpc_server/srv_spoolss_nt.c Fri May 31 13:14:13 2002
@@ -7605,7 +7605,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 oldsamba3/source/rpcclient/cmd_reg.c newsamba3/source/rpcclient/cmd_reg.c
--- oldsamba3/source/rpcclient/cmd_reg.c Fri May 31 17:32:07 2002
+++ newsamba3/source/rpcclient/cmd_reg.c Fri May 31 17:36:07 2002
@@ -897,6 +897,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 oldsamba3/source/smbd/chgpasswd.c newsamba3/source/smbd/chgpasswd.c
--- oldsamba3/source/smbd/chgpasswd.c Fri May 31 13:14:58 2002
+++ newsamba3/source/smbd/chgpasswd.c Fri May 31 13:15:08 2002
@@ -196,7 +196,9 @@ static int dochild(int master, const cha
}
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 oldsamba3/source/smbd/trans2.c newsamba3/source/smbd/trans2.c
--- oldsamba3/source/smbd/trans2.c Fri May 31 14:10:33 2002
+++ newsamba3/source/smbd/trans2.c Fri May 31 14:10:41 2002
@@ -393,7 +393,7 @@ static uint32 unix_perms_to_wire(mode_t
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 oldsamba3/source/smbd/vfs-wrap.c newsamba3/source/smbd/vfs-wrap.c
--- oldsamba3/source/smbd/vfs-wrap.c Fri May 31 14:13:40 2002
+++ newsamba3/source/smbd/vfs-wrap.c Fri May 31 14:23:44 2002
@@ -432,6 +432,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);
@@ -439,6 +440,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 oldsamba3/source/utils/smbcontrol.c newsamba3/source/utils/smbcontrol.c
--- oldsamba3/source/utils/smbcontrol.c Fri May 31 17:13:48 2002
+++ newsamba3/source/utils/smbcontrol.c Fri May 31 17:13:57 2002
@@ -439,6 +439,7 @@ static BOOL do_command(char *dest, char
{
int opt;
char temp[255];
+ extern char *optarg;
extern int optind;
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