samba-3.0.0 -- some comments + patch

Peter Breitenlohner peb at mppmu.mpg.de
Mon Sep 29 09:31:56 GMT 2003


Hi,

I would like to suggest the attached patch for samba-3.0.0 which

A) Introduces a configure option `--without-swat' (we really don't need
that)

B) Tries to fix several minor problems:

1.) I am sure you dont want to install "include/libsmbclient.h" with execute
permissions

2.) When configuring outside the source tree, configure attemts to touch
several files in the build tree in non-existing directories.

BW: What is the reason for that `touch'? I think when configuring outside
the source tree, configure should NOT modify the source tree (not even
timestamps)!!

3.) Tries to avoid or defeat some of the (gcc) compiler warnings (discards
qualifier or incompatible pointer type). There are, however, quite a few of
them left. One in particular looks potentially dangerous:

	samba-3.0.0/source/rpcclient/cmd_spoolss.c:1185 warning:
		passing arg 1 of `strtok' discards qualifiers from pointer target type

Since strtok can modify its first argument, this function really shouldn't
be called with a const argument. Unfortunately trying to fix this seems to
be a major enterprise.

regards
Peter Breitenlohner <peb at mppmu.mpg.de>
-------------- next part --------------
diff -ur -x configure -x autom4te.cache samba-3.0.0.orig/source/Makefile.in samba-3.0.0/source/Makefile.in
--- samba-3.0.0.orig/source/Makefile.in	2003-09-24 19:16:13.000000000 +0200
+++ samba-3.0.0/source/Makefile.in	2003-09-25 17:45:40.000000000 +0200
@@ -119,7 +119,7 @@
 
 # Note that all executable programs now provide for an optional executable suffix.
 
-SBIN_PROGS = bin/smbd at EXEEXT@ bin/nmbd at EXEEXT@ bin/swat at EXEEXT@ @EXTRA_SBIN_PROGS@
+SBIN_PROGS = bin/smbd at EXEEXT@ bin/nmbd at EXEEXT@ @EXTRA_SBIN_PROGS@
 
 BIN_PROGS1 = bin/smbclient at EXEEXT@ bin/net at EXEEXT@ bin/smbspool at EXEEXT@ \
 	bin/testparm at EXEEXT@ bin/testprns at EXEEXT@ bin/smbstatus at EXEEXT@ 
@@ -1161,7 +1161,7 @@
 
 bin/t_snprintf at EXEEXT@: lib/snprintf.c
 	$(CC) $(FLAGS) -o $@ -DTEST_SNPRINTF lib/snprintf.c -lm
-install: installbin installman installscripts installdat installswat installmodules @INSTALLCLIENT@
+install: installbin installman installscripts installdat @INSTALL_SWAT@ installmodules @INSTALLCLIENT@
 
 install-everything: install installmodules
 
@@ -1215,7 +1215,7 @@
 	-$(INSTALLCLIENTCMD_SH) bin/libsmbclient. at SHLIBEXT@ $(DESTDIR)${prefix}/lib
 	-$(INSTALLCLIENTCMD_A) bin/libsmbclient.a $(DESTDIR)${prefix}/lib
 	@$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)${prefix}/include
-	-$(INSTALLCMD) $(srcdir)/include/libsmbclient.h $(DESTDIR)${prefix}/include
+	-$(INSTALLCMD) -m 644 $(srcdir)/include/libsmbclient.h $(DESTDIR)${prefix}/include
 
 # Python extensions
 
diff -ur -x configure -x autom4te.cache samba-3.0.0.orig/source/aclocal.m4 samba-3.0.0/source/aclocal.m4
--- samba-3.0.0.orig/source/aclocal.m4	2003-08-28 23:42:42.000000000 +0200
+++ samba-3.0.0/source/aclocal.m4	2003-09-25 18:45:59.000000000 +0200
@@ -73,7 +73,7 @@
 	AC_SUBST($1_STATIC)
 	AC_SUBST($1_MODULES)
 	AC_DEFINE_UNQUOTED([static_init_]translit([$1], [A-Z], [a-z]), [{$init_static_modules_]translit([$1], [A-Z], [a-z])[}], [Static init functions])
-    	ifelse([$2], , :, [touch $2])
+    	ifelse([$2], , :, [touch $srcdir/$2])
 ])
 
 dnl AC_PROG_CC_FLAG(flag)
diff -ur -x configure -x autom4te.cache samba-3.0.0.orig/source/client/client.c samba-3.0.0/source/client/client.c
--- samba-3.0.0.orig/source/client/client.c	2003-09-08 18:04:35.000000000 +0200
+++ samba-3.0.0/source/client/client.c	2003-09-25 16:51:53.000000000 +0200
@@ -2036,7 +2036,7 @@
  Try and browse available connections on a host.
 ****************************************************************************/
 
-static BOOL list_servers(char *wk_grp)
+static BOOL list_servers(const char *wk_grp)
 {
 	if (!cli->server_domain)
 		return False;
diff -ur -x configure -x autom4te.cache samba-3.0.0.orig/source/configure.in samba-3.0.0/source/configure.in
--- samba-3.0.0.orig/source/configure.in	2003-09-24 19:16:13.000000000 +0200
+++ samba-3.0.0/source/configure.in	2003-09-25 17:45:44.000000000 +0200
@@ -79,6 +79,28 @@
   esac])
 
 #################################################
+# check if swat should be included
+AC_MSG_CHECKING(whether to include swat)
+AC_ARG_WITH(swat,
+[  --with-swat             Include swat (default=yes)],
+[ case "$withval" in
+  no)
+    AC_MSG_RESULT(no)
+    INSTALL_SWAT=
+    ;;
+  *)
+    AC_MSG_RESULT(yes)
+    EXTRA_SBIN_PROGS="$EXTRA_SBIN_PROGS bin/swat\$(EXEEXT)"
+    INSTALL_SWAT=installswat
+    ;;
+  esac ],
+  AC_MSG_RESULT(yes)
+  EXTRA_SBIN_PROGS="$EXTRA_SBIN_PROGS bin/swat\$(EXEEXT)"
+  INSTALL_SWAT=installswat
+)
+AC_SUBST(INSTALL_SWAT)
+
+#################################################
 # set SWAT directory location
 AC_ARG_WITH(swatdir,
 [  --with-swatdir=DIR      Where to put SWAT files ($ac_default_prefix/swat)],
diff -ur -x configure -x autom4te.cache samba-3.0.0.orig/source/include/nt_printing.h samba-3.0.0/source/include/nt_printing.h
--- samba-3.0.0.orig/source/include/nt_printing.h	2003-06-07 19:57:32.000000000 +0200
+++ samba-3.0.0/source/include/nt_printing.h	2003-09-25 17:56:48.000000000 +0200
@@ -420,7 +420,7 @@
 	uint32 flags;
 	union {
 		uint32 value[2];
-		char *data;
+		const char *data;
 	} notify;
 } SPOOLSS_NOTIFY_MSG;
 
diff -ur -x configure -x autom4te.cache samba-3.0.0.orig/source/lib/util_str.c samba-3.0.0/source/lib/util_str.c
--- samba-3.0.0.orig/source/lib/util_str.c	2003-09-24 19:16:13.000000000 +0200
+++ samba-3.0.0/source/lib/util_str.c	2003-09-25 16:32:41.000000000 +0200
@@ -1193,7 +1193,7 @@
 
 	for (s = src; *s && !(((unsigned char)s[0]) & 0x80); s++) {
 		if (*s == c)
-			return s;
+			return (void *) s;
 	}
 
 	if (!*s)
@@ -1241,7 +1241,7 @@
 					break;
 				}
 				/* No - we have a match ! */
-			       	return cp;
+			       	return (void *) cp;
 			}
 		} while (cp-- != s);
 		if (!got_mb)
diff -ur -x configure -x autom4te.cache samba-3.0.0.orig/source/smbd/notify_hash.c samba-3.0.0/source/smbd/notify_hash.c
--- samba-3.0.0.orig/source/smbd/notify_hash.c	2003-06-07 19:57:39.000000000 +0200
+++ samba-3.0.0/source/smbd/notify_hash.c	2003-09-25 16:39:32.000000000 +0200
@@ -41,7 +41,7 @@
 	SMB_STRUCT_STAT st;
 	pstring full_name;
 	char *p;
-	char *fname;
+	const char *fname;
 	size_t remaining_len;
 	size_t fullname_len;
 	void *dp;
diff -ur -x configure -x autom4te.cache samba-3.0.0.orig/source/tdb/tdbutil.c samba-3.0.0/source/tdb/tdbutil.c
--- samba-3.0.0.orig/source/tdb/tdbutil.c	2003-09-24 19:16:13.000000000 +0200
+++ samba-3.0.0/source/tdb/tdbutil.c	2003-09-25 16:38:17.000000000 +0200
@@ -36,13 +36,13 @@
 }
 
 /***************************************************************
- Make a TDB_DATA and keep the const warning in one place
+ Make a TDB_DATA and defeat the const warning.
 ****************************************************************/
 
 static TDB_DATA make_tdb_data(const char *dptr, size_t dsize)
 {
 	TDB_DATA ret;
-	ret.dptr = dptr;
+	ret.dptr = (void *) dptr;
 	ret.dsize = dsize;
 	return ret;
 }
@@ -55,7 +55,7 @@
 {
 	/* Allow tdb_chainlock to be interrupted by an alarm. */
 	int ret;
-	gotalarm = 0;
+	sig_atomic_t gotalarm = 0;
 	tdb_set_lock_alarm(&gotalarm);
 
 	if (timeout) {


More information about the samba-technical mailing list