[SCM] Samba Shared Repository - branch v3-5-stable updated
Karolin Seeger
kseeger at samba.org
Mon Dec 17 01:07:10 MST 2012
The branch, v3-5-stable has been updated
via 0c72376 WHATSNEW: Prepare release notes for Samba 3.5.20.
via 403ddeb Fix bug #9455 munmap called for an address location not mapped by samba.
via 0a99e5d source3/libaddns: don't depend on the order in resp->answers[]
via 4fabb76 source3/libaddns: remove pointless check for resp->num_additionals != 1
via 6848625 lib/replace: replace all *printf function if we replace snprintf (bug #9390)
via dcd11b2 libreplace: Fix symbol names for snprintf/asprintf/vasprintf.
via ce6e959 libreplace: fixed declaration of dprintf() on FreeBSD (cherry picked from commit a599319d0a389ff0c31dae8068cd7a78352aa9e7) (cherry picked from commit fa16d0e4c2329fad8edde5a5e8d626a90caba6d9)
via 043eb5e libreplace: added replacements for dprintf() and vdprintf()
via 3f0c021 libreplace: some systems don't have memmem()
via 42cfbb8 Another fix needed for bug #9236 - ACL masks incorrectly applied when setting ACLs.
via ea35034 docs-xml: fix use of <smbconfoption> tag (fix bug #9345)
via 18d9c35 Second part of fix for bug #7781 - Samba transforms ShareName to lowercase (sharename) when adding new share via MMC
via 429133f Fix bug #7781 (Samba transforms "ShareName" to lowercase when adding new share via MMC)
from a6c3bff WHATSNEW: Start release notes for Samba 3.5.20.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-stable
- Log -----------------------------------------------------------------
commit 0c723760b4a8975bcd11e645ff76f6834559ae71
Author: Karolin Seeger <kseeger at samba.org>
Date: Fri Dec 14 10:12:34 2012 +0100
WHATSNEW: Prepare release notes for Samba 3.5.20.
Karolin
(cherry picked from commit 31292e6fbedef78126435c92d6e687a4844847d9)
commit 403ddeb5d8832ab14cbcf3e77d108cefb8386149
Author: Jeremy Allison <jra at samba.org>
Date: Mon Dec 10 10:40:12 2012 -0800
Fix bug #9455 munmap called for an address location not mapped by samba.
Signed-off-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 06e3c65af559baaee7fa61ed3df1287b786d1858)
commit 0a99e5d09a38e51607248290e9d9cb7f5c1b5808
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Nov 9 08:59:36 2012 +0100
source3/libaddns: don't depend on the order in resp->answers[]
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit eecc1d294256210ee8c2f6ab79d21b835258a6d4)
The last 2 patches address bug #9402 - lib/addns doesn't work samba4 with a
bind9 server.
(cherry picked from commit cf4773f929b2ac01bfe22e8113ccd3843c92bf56)
commit 4fabb76106fc5224d48d380c9b1a6cb399dc3621
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Nov 9 08:55:40 2012 +0100
source3/libaddns: remove pointless check for resp->num_additionals != 1
We never use resp->additionals, so there's no reason to check.
This fixes dns updates against BIND9 (used in a Samba4 domain).
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit b59c5db5f74f56c0536635a41ae51c389109ceb5)
(cherry picked from commit 4bb99f454cea8a0c37422f1e64cabe96543ca6e8)
commit 6848625add89ca7fd97a4bf1705cad89c0ea2092
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Nov 13 14:07:11 2012 +0100
lib/replace: replace all *printf function if we replace snprintf (bug #9390)
This fixes segfaults in log level = 10 on Solaris.
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Björn Jacke <bj at sernet.de>
Autobuild-User(master): Björn Jacke <bj at sernet.de>
Autobuild-Date(master): Wed Nov 14 19:41:14 CET 2012 on sn-devel-104
(cherry picked from commit a15da3625850d97b3da1b02308c870f820007c52)
The last 5 patches address bug #9390 - Solaris printf doesn't allow %s, NULL.
(cherry picked from commit 05f151c041e407514c1b35619b2f2454aa4d614b)
commit dcd11b2f2c523a2f80295ad993dfd1f2b6403fba
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun May 13 03:21:34 2012 +0200
libreplace: Fix symbol names for snprintf/asprintf/vasprintf.
Autobuild-User: Jelmer Vernooij <jelmer at samba.org>
Autobuild-Date: Sun May 13 05:16:28 CEST 2012 on sn-devel-104
(cherry picked from commit cf67da70c9a63c4dc63f287059321d6c36d1e19e)
(cherry picked from commit 27405fb8cfaa56f3a39cdcd2fd635fd37af629f9)
commit ce6e9599721fcf83d8418019849b8e59ed8bffef
Author: Andrew Tridgell <tridge at freebsd.home.tridgell.net>
Date: Wed Mar 24 05:06:25 2010 +1100
libreplace: fixed declaration of dprintf() on FreeBSD (cherry picked from commit a599319d0a389ff0c31dae8068cd7a78352aa9e7)
(cherry picked from commit fa16d0e4c2329fad8edde5a5e8d626a90caba6d9)
commit 043eb5e62ee89eae4f6dec5854aea3ed9925e3fb
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu Feb 11 20:18:50 2010 +1100
libreplace: added replacements for dprintf() and vdprintf()
these are very useful for writing files with formatted writes
Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>
(cherry picked from commit d6fb64c51244529388b1f79ba8220ff608e1e4de)
(cherry picked from commit 4bf8dc438318e06ee96dc1b6084dddd8700739e7)
commit 3f0c0217adae57cdc40537a34624f1c0b0179938
Author: Andrew Tridgell <tridge at samba.org>
Date: Sat Jan 2 10:01:11 2010 +1100
libreplace: some systems don't have memmem()
added rep_memmem() and a testsuite
(cherry picked from commit fef3c910da421e890925e5e61275fc457da87f6e)
(cherry picked from commit 42057793ebb3ccdc4e63f59753bca8dd677e9748)
commit 42cfbb83b877714b925187b7745b214fa0a2dbad
Author: Jeremy Allison <jra at samba.org>
Date: Thu Nov 8 13:45:19 2012 -0800
Another fix needed for bug #9236 - ACL masks incorrectly applied when setting ACLs.
Not caught by make test as it's an extreme edge case for strange
incoming ACLs. I only found this as I'm making raw.acls and smb2.acls
pass against 3.6.x with acl_xattr mapped onto a POSIX backend (which
isn't tested in make test).
An incoming inheritable ACE entry containing only one permission,
WRITE_DATA maps into a POSIX owner perm of "-w-", which violates
the principle that the owner of a file/directory can always read.
(cherry picked from commit 92292ac55144521824610a5d4b09f8dc1ff19a8a)
commit ea35034eb147748a6468abe1041dba2a44cca773
Author: Björn Baumbach <bb at sernet.de>
Date: Fri Nov 2 10:25:27 2012 +0100
docs-xml: fix use of <smbconfoption> tag (fix bug #9345)
Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Karolin Seeger <ks at samba.org>
Autobuild-User(master): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(master): Fri Nov 2 12:37:42 CET 2012 on sn-devel-104
(cherry picked from commit 3ecbe8c83a003825fc58f6dcb9e02a35aad2d86e)
Autobuild-User(v4-0-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-0-test): Mon Nov 5 13:09:12 CET 2012 on sn-devel-104
(cherry picked from commit 6195cb667b1c162436bfbf5d4f499bdc776f83b4)
(cherry picked from commit a6dea8e6556bd5e391cd709b86664fb7cc34433a)
(cherry picked from commit 9a8d7ab3773e1d4d1981f8b45998d689180a4cbf)
commit 18d9c35ec1afe7c819578e6fb2dffa6a46ba062d
Author: Jeremy Allison <jra at samba.org>
Date: Thu Nov 1 11:56:22 2012 -0700
Second part of fix for bug #7781 - Samba transforms ShareName to lowercase (sharename) when adding new share via MMC
Ensure safe_strcpy is safe when src == dest. This probably needs porting
to master/3.6.x/4.0.x.
(cherry picked from commit e81b3c9a2aa58cbf5e12ef129fa63aab784c9598)
commit 429133f5ad716019995f2ae6407ce563e1b6872b
Author: Jeremy Allison <jra at samba.org>
Date: Wed May 23 22:22:17 2012 +0200
Fix bug #7781 (Samba transforms "ShareName" to lowercase when adding new share via MMC)
Signed-off-by: Michael Adam <obnox at samba.org>
(cherry picked from commit 3b1528dcd67d62f20313094be9b5d609a1ca4f25)
-----------------------------------------------------------------------
Summary of changes:
WHATSNEW.txt | 17 +++++++-
docs-xml/build/DTD/samba.entities | 13 +++--
lib/replace/libreplace.m4 | 4 +-
lib/replace/replace.c | 54 ++++++++++++++++++++++
lib/replace/replace.h | 38 +++++++++++++++-
lib/replace/snprintf.c | 17 +++----
lib/replace/test/testsuite.c | 37 +++++++++++++++
source3/include/proto.h | 2 +-
source3/lib/dummysmbd.c | 2 +-
source3/lib/util_str.c | 8 +++
source3/lib/util_unistr.c | 3 +
source3/libaddns/dnsgss.c | 16 +++++--
source3/modules/vfs_xattr_tdb.c | 3 +-
source3/param/loadparm.c | 9 +---
source3/printing/nt_printing.c | 12 +----
source3/registry/reg_backend_printing.c | 7 ++-
source3/rpc_server/srv_srvsvc_nt.c | 75 +++++++++++++++++--------------
source3/smbd/lanman.c | 14 ++++--
source3/smbd/msdfs.c | 3 +-
source3/smbd/posix_acls.c | 14 ++++--
source3/smbd/service.c | 16 +++++--
source3/smbd/smb2_tcon.c | 2 +-
22 files changed, 270 insertions(+), 96 deletions(-)
Changeset truncated at 500 lines:
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index f0114d6..e2249fc 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -8,12 +8,27 @@ This is the latest stable release of Samba 3.5.
Major enhancements in Samba 3.5.20 include:
-o
+o Fix segfaults in log level = 10 on Solaris (bug #9390).
+o Apply ACL masks correctly when setting ACLs (bug #9236).
+
Changes since 3.5.19:
---------------------
o Jeremy Allison <jra at samba.org>
+ * BUG 7781: Samba transforms ShareName to lowercase (sharename) when adding
+ new share via MMC.
+ * BUG 9236: Apply ACL masks correctly when setting ACLs.
+ * BUG 9455: munmap called for an address location not mapped by Samba.
+
+
+o Björn Baumbach <bb at sernet.de>
+ * BUG 9345: Fix usage of <smbconfoption> tag.
+
+
+o Stefan Metzmacher <metze at samba.org>
+ * BUG 9390: Fix segfaults in log level = 10 on Solaris.
+ * BUG 9402: Fix dns updates against BIND9 (used in a Samba4 domain).
######################################################################
diff --git a/docs-xml/build/DTD/samba.entities b/docs-xml/build/DTD/samba.entities
index f5d8cd2..c7e46c2 100644
--- a/docs-xml/build/DTD/samba.entities
+++ b/docs-xml/build/DTD/samba.entities
@@ -180,7 +180,7 @@ use only by developers and generate HUGE amounts of log
data, most of which is extremely cryptic.</para>
<para>Note that specifying this parameter here will
-override the <smbconfoption><name>log level</name></smbconfoption> parameter
+override the <smbconfoption name="log level" /> parameter
in the &smb.conf; file.</para>
</listitem>
</varlistentry>'>
@@ -207,7 +207,7 @@ use only by developers and generate HUGE amounts of log
data, most of which is extremely cryptic.</para>
<para>Note that specifying this parameter here will
-override the <smbconfoption><name>log level</name></smbconfoption> parameter
+override the <smbconfoption name="log level" /> parameter
in the &smb.conf; file.</para>
</listitem>
</varlistentry>'>
@@ -297,11 +297,13 @@ being on a locally connected subnet.
<para>If this parameter is not set then the name resolve order
defined in the &smb.conf; file parameter
-(<smbconfoption><name>name resolve order</name></smbconfoption>) will be used.
+(<smbconfoption name="name resolve order" />) will be used.
</para>
<para>The default order is lmhosts, host, wins, bcast. Without
-this parameter or any entry in the <smbconfoption><name>name resolve order</name></smbconfoption> parameter of the &smb.conf; file, the name
+this parameter or any entry in the
+<smbconfoption name="name resolve order" /> parameter of
+the &smb.conf; file, the name
resolution methods will be attempted in this order. </para></listitem>
</varlistentry>'>
@@ -310,7 +312,8 @@ resolution methods will be attempted in this order. </para></listitem>
<term>-n|--netbiosname <primary NetBIOS name></term>
<listitem><para>This option allows you to override
the NetBIOS name that Samba uses for itself. This is identical
-to setting the <smbconfoption><name>netbios name</name></smbconfoption> parameter in the &smb.conf; file.
+to setting the <smbconfoption name="netbios name" /> parameter in
+the &smb.conf; file.
However, a command
line setting will take precedence over settings in
&smb.conf;.</para></listitem>
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index af85879..7a26deb 100644
--- a/lib/replace/libreplace.m4
+++ b/lib/replace/libreplace.m4
@@ -108,7 +108,7 @@ AC_CHECK_HEADERS(unix.h)
AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename)
AC_CHECK_FUNCS(waitpid wait4 strlcpy strlcat initgroups memmove strdup)
-AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp dup2)
+AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp dup2 dprintf vdprintf)
AC_CHECK_FUNCS(isatty chown lchown link readlink symlink realpath)
AC_HAVE_DECL(setresuid, [#include <unistd.h>])
AC_HAVE_DECL(setresgid, [#include <unistd.h>])
@@ -228,6 +228,8 @@ AC_HAVE_DECL(environ, [#include <unistd.h>])
AC_CHECK_FUNCS(strnlen)
AC_CHECK_FUNCS(strtoull __strtoull strtouq strtoll __strtoll strtoq)
+AC_CHECK_FUNCS(memmem)
+
# this test disabled as we don't actually need __VA_ARGS__ yet
AC_TRY_CPP([
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index fc15717..85d0e36 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -681,3 +681,57 @@ char *rep_realpath(const char *path, char *resolved_path)
return NULL;
}
#endif
+
+
+#ifndef HAVE_MEMMEM
+void *rep_memmem(const void *haystack, size_t haystacklen,
+ const void *needle, size_t needlelen)
+{
+ if (needlelen == 0) {
+ return discard_const(haystack);
+ }
+ while (haystacklen >= needlelen) {
+ char *p = memchr(haystack, *(const char *)needle,
+ haystacklen-(needlelen-1));
+ if (!p) return NULL;
+ if (memcmp(p, needle, needlelen) == 0) {
+ return p;
+ }
+ haystack = p+1;
+ haystacklen -= (p - (const char *)haystack) + 1;
+ }
+ return NULL;
+}
+#endif
+
+#if !defined(HAVE_VDPRINTF) || !defined(HAVE_C99_VSNPRINTF)
+int rep_vdprintf(int fd, const char *format, va_list ap)
+{
+ char *s = NULL;
+ int ret;
+
+ vasprintf(&s, format, ap);
+ if (s == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ ret = write(fd, s, strlen(s));
+ free(s);
+ return ret;
+}
+#endif
+
+#if !defined(HAVE_DPRINTF) || !defined(HAVE_C99_VSNPRINTF)
+int rep_dprintf(int fd, const char *format, ...)
+{
+ int ret;
+ va_list ap;
+
+ va_start(ap, format);
+ ret = vdprintf(fd, format, ap);
+ va_end(ap);
+
+ return ret;
+}
+#endif
+
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index 6424d10..a028d7a 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -140,6 +140,12 @@ char *rep_strdup(const char *s);
void *rep_memmove(void *dest,const void *src,int size);
#endif
+#ifndef HAVE_MEMMEM
+#define memmem rep_memmem
+void *rep_memmem(const void *haystack, size_t haystacklen,
+ const void *needle, size_t needlelen);
+#endif
+
#ifndef HAVE_MKTIME
#define mktime rep_mktime
/* prototype is in "system/time.h" */
@@ -350,7 +356,17 @@ int rep_dlclose(void *handle);
#endif
#endif
-#ifndef HAVE_VASPRINTF
+#if !defined(HAVE_VDPRINTF) || !defined(HAVE_C99_VSNPRINTF)
+#define vdprintf rep_vdprintf
+int rep_vdprintf(int fd, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
+#endif
+
+#if !defined(HAVE_DPRINTF) || !defined(HAVE_C99_VSNPRINTF)
+#define dprintf rep_dprintf
+int rep_dprintf(int fd, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
+#endif
+
+#if !defined(HAVE_VASPRINTF) || !defined(HAVE_C99_VSNPRINTF)
#define vasprintf rep_vasprintf
int rep_vasprintf(char **ptr, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
#endif
@@ -365,11 +381,29 @@ int rep_snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4);
int rep_vsnprintf(char *,size_t ,const char *, va_list ap) PRINTF_ATTRIBUTE(3,0);
#endif
-#ifndef HAVE_ASPRINTF
+#if !defined(HAVE_ASPRINTF) || !defined(HAVE_C99_VSNPRINTF)
#define asprintf rep_asprintf
int rep_asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
#endif
+#if !defined(HAVE_C99_VSNPRINTF)
+#ifdef REPLACE_BROKEN_PRINTF
+/*
+ * We do not redefine printf by default
+ * as it breaks the build if system headers
+ * use __attribute__((format(printf, 3, 0)))
+ * instead of __attribute__((format(__printf__, 3, 0)))
+ */
+#define printf rep_printf
+#endif
+int rep_printf(const char *, ...) PRINTF_ATTRIBUTE(1,2);
+#endif
+
+#if !defined(HAVE_C99_VSNPRINTF)
+#define fprintf rep_fprintf
+int rep_fprintf(FILE *stream, const char *, ...) PRINTF_ATTRIBUTE(2,3);
+#endif
+
#ifndef HAVE_VSYSLOG
#ifdef HAVE_SYSLOG
#define vsyslog rep_vsyslog
diff --git a/lib/replace/snprintf.c b/lib/replace/snprintf.c
index bca7742..6b4a711 100644
--- a/lib/replace/snprintf.c
+++ b/lib/replace/snprintf.c
@@ -1187,7 +1187,7 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
return max;
}
- int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
+ int rep_vsnprintf (char *str, size_t count, const char *fmt, va_list args)
{
return dopr(str, count, fmt, args);
}
@@ -1200,7 +1200,7 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
* that doesn't work properly according to the autoconf test.
*/
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
- int snprintf(char *str,size_t count,const char *fmt,...)
+ int rep_snprintf(char *str,size_t count,const char *fmt,...)
{
size_t ret;
va_list ap;
@@ -1213,7 +1213,7 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
#endif
#ifndef HAVE_C99_VSNPRINTF
- int printf(const char *fmt, ...)
+ int rep_printf(const char *fmt, ...)
{
va_list ap;
int ret;
@@ -1234,7 +1234,7 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
#endif
#ifndef HAVE_C99_VSNPRINTF
- int fprintf(FILE *stream, const char *fmt, ...)
+ int rep_fprintf(FILE *stream, const char *fmt, ...)
{
va_list ap;
int ret;
@@ -1256,8 +1256,8 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
#endif
-#ifndef HAVE_VASPRINTF
- int vasprintf(char **ptr, const char *format, va_list ap)
+#if !defined(HAVE_VASPRINTF) || !defined(HAVE_C99_VSNPRINTF)
+ int rep_vasprintf(char **ptr, const char *format, va_list ap)
{
int ret;
va_list ap2;
@@ -1278,9 +1278,8 @@ static int add_cnk_list_entry(struct pr_chunk_x **list,
}
#endif
-
-#ifndef HAVE_ASPRINTF
- int asprintf(char **ptr, const char *format, ...)
+#if !defined(HAVE_ASPRINTF) || !defined(HAVE_C99_VSNPRINTF)
+ int rep_asprintf(char **ptr, const char *format, ...)
{
va_list ap;
int ret;
diff --git a/lib/replace/test/testsuite.c b/lib/replace/test/testsuite.c
index 7929f11..caa70d6 100644
--- a/lib/replace/test/testsuite.c
+++ b/lib/replace/test/testsuite.c
@@ -1015,6 +1015,42 @@ static int test_utimes(void)
return true;
}
+static int test_memmem(void)
+{
+ char *s;
+
+ printf("test: memmem\n");
+
+ s = memmem("foo", 3, "fo", 2);
+ if (strcmp(s, "foo") != 0) {
+ printf(__location__ ": Failed memmem\n");
+ return false;
+ }
+
+ s = memmem("foo", 3, "", 0);
+ if (strcmp(s, "foo") != 0) {
+ printf(__location__ ": Failed memmem\n");
+ return false;
+ }
+
+ s = memmem("foo", 4, "o", 1);
+ if (strcmp(s, "oo") != 0) {
+ printf(__location__ ": Failed memmem\n");
+ return false;
+ }
+
+ s = memmem("foobarfodx", 11, "fod", 3);
+ if (strcmp(s, "fodx") != 0) {
+ printf(__location__ ": Failed memmem\n");
+ return false;
+ }
+
+ printf("success: memmem\n");
+
+ return true;
+}
+
+
struct torture_context;
bool torture_local_replace(struct torture_context *ctx)
{
@@ -1065,6 +1101,7 @@ bool torture_local_replace(struct torture_context *ctx)
ret &= test_getifaddrs();
ret &= test_utime();
ret &= test_utimes();
+ ret &= test_memmem();
return ret;
}
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 785cc30..cee5d6a 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -7002,7 +7002,7 @@ bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir);
void load_registry_shares(void);
int add_home_service(const char *service, const char *username, const char *homedir);
-int find_service(fstring service);
+int find_service(const char *service_in, fstring service);
connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
int snum, user_struct *vuser,
DATA_BLOB password,
diff --git a/source3/lib/dummysmbd.c b/source3/lib/dummysmbd.c
index a41e6dc..28c6f0e 100644
--- a/source3/lib/dummysmbd.c
+++ b/source3/lib/dummysmbd.c
@@ -28,7 +28,7 @@ int get_client_fd(void)
return -1;
}
-int find_service(fstring service)
+int find_service(const char *service_in, fstring service)
{
return -1;
}
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index d869637..c98bebe 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -514,6 +514,10 @@ char *safe_strcpy_fn(const char *fn,
return NULL;
}
+ if (src == dest) {
+ return dest;
+ }
+
#ifdef DEVELOPER
clobber_region(fn,line,dest, maxlength+1);
#endif
@@ -2301,6 +2305,10 @@ bool validate_net_name( const char *name,
{
int i;
+ if (!name) {
+ return false;
+ }
+
for ( i=0; i<max_len && name[i]; i++ ) {
/* fail if strchr_m() finds one of the invalid characters */
if ( name[i] && strchr_m( invalid_chars, name[i] ) ) {
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index f53ef94..e8483d3 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -45,6 +45,7 @@ void gfree_case_tables(void)
unmap_file(upcase_table, 0x20000);
else
SAFE_FREE(upcase_table);
+ upcase_table = NULL;
}
if ( lowcase_table ) {
@@ -52,6 +53,7 @@ void gfree_case_tables(void)
unmap_file(lowcase_table, 0x20000);
else
SAFE_FREE(lowcase_table);
+ lowcase_table = NULL;
}
if ( valid_table ) {
@@ -59,6 +61,7 @@ void gfree_case_tables(void)
unmap_file(valid_table, 0x10000);
else
SAFE_FREE(valid_table);
+ valid_table = NULL;
}
initialized = false;
}
diff --git a/source3/libaddns/dnsgss.c b/source3/libaddns/dnsgss.c
index c903741..a8b2ea1 100644
--- a/source3/libaddns/dnsgss.c
+++ b/source3/libaddns/dnsgss.c
@@ -164,6 +164,8 @@ static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx,
struct dns_request *resp;
struct dns_buffer *buf;
struct dns_tkey_record *tkey;
+ struct dns_rrec *tkey_answer = NULL;
+ uint16_t i;
err = dns_receive(mem_ctx, conn, &buf);
if (!ERR_DNS_IS_OK(err)) goto error;
@@ -174,10 +176,16 @@ static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx,
/*
* TODO: Compare id and keyname
*/
-
- if ((resp->num_additionals != 1) ||
- (resp->num_answers == 0) ||
- (resp->answers[0]->type != QTYPE_TKEY)) {
+
+ for (i=0; i < resp->num_answers; i++) {
+ if (resp->answers[i]->type != QTYPE_TKEY) {
+ continue;
+ }
+
+ tkey_answer = resp->answers[i];
+ }
+
+ if (tkey_answer == NULL) {
err = ERROR_DNS_INVALID_MESSAGE;
goto error;
}
diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c
index f7fbfce..fa8db04 100644
--- a/source3/modules/vfs_xattr_tdb.c
+++ b/source3/modules/vfs_xattr_tdb.c
@@ -733,8 +733,7 @@ static int xattr_tdb_connect(vfs_handle_struct *handle, const char *service,
return res;
}
- fstrcpy(sname, service);
- snum = find_service(sname);
+ snum = find_service(service, sname);
if (snum == -1) {
/*
* Should not happen, but we should not fail just *here*.
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 8c1cf09..eaff9e6 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -9471,15 +9471,10 @@ struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
const char *sharename)
{
struct share_params *result;
- char *sname;
+ fstring sname;
int snum;
- if (!(sname = SMB_STRDUP(sharename))) {
- return NULL;
- }
-
- snum = find_service(sname);
- SAFE_FREE(sname);
+ snum = find_service(sharename, sname);
if (snum < 0) {
return NULL;
--
Samba Shared Repository
More information about the samba-cvs
mailing list