[SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Matthieu Patou
The branch, master has been updated
   via  a2f4309 torture-dfs: fix a typo that was causing the test to be 
flacky
  from  642c6ba Fix Bug 8152 - smbd crash in release_ip()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit a2f430911271ed3d9a681e64d250facb8e66f3f2
Author: Matthieu Patou 
Date:   Fri May 20 10:30:54 2011 +0400

torture-dfs: fix a typo that was causing the test to be flacky

Autobuild-User: Matthieu Patou 
Autobuild-Date: Fri May 20 09:39:12 CEST 2011 on sn-devel-104

---

Summary of changes:
 source4/torture/dfs/domaindfs.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/dfs/domaindfs.c b/source4/torture/dfs/domaindfs.c
index 4914217..89e9cc1 100644
--- a/source4/torture/dfs/domaindfs.c
+++ b/source4/torture/dfs/domaindfs.c
@@ -371,7 +371,7 @@ static bool test_getsysvolreferral(struct torture_context 
*tctx,

resp3.referral_entries[0].referral.v3.referrals.r1.DFS_path,
str+1));
torture_assert_int_equal(tctx, strlen(
-
resp2.referral_entries[0].referral.v3.referrals.r1.netw_address) > 0,
+
resp3.referral_entries[0].referral.v3.referrals.r1.netw_address) > 0,
 1,
 "Length of first referral is less than 0");
torture_assert_int_equal(tctx, 
strstr(resp3.referral_entries[0].referral.v3.referrals.r1.netw_address,


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Volker Lendecke
The branch, master has been updated
   via  d432c7e s3: Remove unused cli_setup_packet()
  from  a2f4309 torture-dfs: fix a typo that was causing the test to be 
flacky

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit d432c7e27866c4b3f53bb4c2b2e8cc9bf48b9e3d
Author: Volker Lendecke 
Date:   Fri May 20 08:36:46 2011 +0200

s3: Remove unused cli_setup_packet()

Autobuild-User: Volker Lendecke 
Autobuild-Date: Fri May 20 10:51:36 CEST 2011 on sn-devel-104

---

Summary of changes:
 source3/libsmb/clientgen.c |5 -
 source3/libsmb/proto.h |1 -
 2 files changed, 0 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index ec0965f..5a1ac82 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -417,11 +417,6 @@ void cli_setup_packet_buf(struct cli_state *cli, char *buf)
SSVAL(buf,smb_flg2, flags2);
 }
 
-void cli_setup_packet(struct cli_state *cli)
-{
-   cli_setup_packet_buf(cli, cli->outbuf);
-}
-
 /
  Setup the bcc length of the packet from a pointer to the end of the data.
 /
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index 4ac767c..03f3ed9 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -157,7 +157,6 @@ bool cli_state_seqnum_remove(struct cli_state *cli,
 bool cli_receive_smb(struct cli_state *cli);
 bool cli_send_smb(struct cli_state *cli);
 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
-void cli_setup_packet(struct cli_state *cli);
 void cli_setup_bcc(struct cli_state *cli, void *p);
 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Andreas Schneider
The branch, master has been updated
   via  7ab9e26 s3-epmapper: Fixed endpoint registration.
  from  d432c7e s3: Remove unused cli_setup_packet()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 7ab9e26b601e4e51736ce6eace46e6588fa1148f
Author: Andreas Schneider 
Date:   Wed May 18 12:10:42 2011 +0200

s3-epmapper: Fixed endpoint registration.

Autobuild-User: Andreas Schneider 
Autobuild-Date: Fri May 20 12:03:18 CEST 2011 on sn-devel-104

---

Summary of changes:
 source3/rpc_server/rpc_ep_setup.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_server/rpc_ep_setup.c 
b/source3/rpc_server/rpc_ep_setup.c
index 2dc54bd..918bcd4 100644
--- a/source3/rpc_server/rpc_ep_setup.c
+++ b/source3/rpc_server/rpc_ep_setup.c
@@ -133,7 +133,7 @@ static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX 
*mem_ctx,
  struct tevent_context *ev_ctx,
  struct messaging_context *msg_ctx,
  const struct ndr_interface_table 
*iface,
- const char *name,
+ const char *ncalrpc,
  uint16_t port,
  struct dcerpc_binding_handle **pbh);
 
@@ -256,7 +256,7 @@ static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX 
*mem_ctx,
  struct tevent_context *ev_ctx,
  struct messaging_context *msg_ctx,
  const struct ndr_interface_table 
*iface,
- const char *name,
+ const char *ncalrpc,
  uint16_t port,
  struct dcerpc_binding_handle **pbh)
 {
@@ -266,7 +266,7 @@ static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX 
*mem_ctx,
status = dcerpc_binding_vector_create(mem_ctx,
  iface,
  port,
- name,
+ ncalrpc,
  &v);
if (!NT_STATUS_IS_OK(status)) {
return status;
@@ -276,7 +276,7 @@ static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX 
*mem_ctx,
iface,
v,
&iface->syntax_id.uuid,
-   name,
+   iface->name,
pbh);
talloc_free(v);
if (!NT_STATUS_IS_OK(status)) {


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Stefan Metzmacher
The branch, master has been updated
   via  1e472f1 s3:testparm: don't return an error for a warning message
  from  7ab9e26 s3-epmapper: Fixed endpoint registration.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 1e472f1534985a9e70a2bed45723e08fe8dee078
Author: Stefan Metzmacher 
Date:   Fri May 20 08:31:16 2011 +0200

s3:testparm: don't return an error for a warning message

metze

Autobuild-User: Stefan Metzmacher 
Autobuild-Date: Fri May 20 13:14:39 CEST 2011 on sn-devel-104

---

Summary of changes:
 source3/utils/testparm.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index edb11a6..f8b8c7f 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -154,7 +154,6 @@ to the default value * or a valid password server.\n", 
sec_setting );
sec_setting = "";
 
fprintf(stderr, "WARNING: The setting 'security=%s' is should 
NOT be combined with the 'password server' parameter.\n  (by default Samba will 
discover the correct DC to contact automatically).\n", sec_setting );
-   ret = 1;
}
 
/*


-- 
Samba Shared Repository


[SCM] Samba Website Repository - branch master updated

2011-05-20 Thread John Terpstra
The branch, master has been updated
   via  8997f02 Added Paulo Dias company to Portugal index.
  from  2ec6c01 add myself to the team list

http://gitweb.samba.org/?p=samba-web.git;a=shortlog;h=master


- Log -
commit 8997f021c1623999ac1491566e87ec880883d9d4
Author: John H Terpstra 
Date:   Fri May 20 07:09:26 2011 -0500

Added Paulo Dias company to Portugal index.

---

Summary of changes:
 support/portugal.html |   20 
 1 files changed, 20 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/support/portugal.html b/support/portugal.html
index 6370c3c..b3dcdaf 100644
--- a/support/portugal.html
+++ b/support/portugal.html
@@ -32,5 +32,25 @@ Samba solutions, most commonly:
 We offer installation and support for virtually any Samba scenario.
 
 
+
+
+Paulo Dias Soluções para Informática Unipessoal 
Lda
+
+Paulo Dias Soluções para Informática Unipessoal Lda
+Rua de Santo António de Contumil, 265 
+4350-289 Porto Portugal
+
+http://www.pdsinformatica.com";>http://www.pdsinformatica.com 
+mailto:ge...@pdsinformatica.com";>ge...@pdsinformatica.com
+
+
+We are a small IT company based in Porto, we install, support and
+manage, Linux Servers based on OpenLdap and Samba integration. We
+provide our customers with File Sharing, Authentication, Voice over IP
+and other linux based services and servers like web servers, database
+and email.
+
+
+
 
 


-- 
Samba Website Repository


Re: [SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Björn JACKE
On 2010-05-25 at 07:41 +0200 Stefan (metze) Metzmacher sent off:
> I think we also need -qhalt=e here, to match -Werror.
> 
> I'm wondering if --errwarn is the correct thing for the sun case...

-qhalt=w and -errwarn=%all are the equivalent options for -Werror. Some
configure checks need to bail out errors even on warnings, that's all what
this is needed for.

Cheers
Björn


Re: [SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Björn JACKE
Hi Metze,

On 2010-06-10 at 20:50 +0200 Stefan (metze) Metzmacher sent off:
> > +   *  h_errno is defined as function call macro for multithreaded 
> > applications
> > +   *  in HP-UX. *this* h_errno is not used in the HP-UX codepath of our nss
> > +   *  modules, so let's simply comment it out here:
> > +   * int h_errno;
> > +   */
> > nss_status_t status;
> >  } nss_XbyY_args_t;
> 
> Aren't this structures of fixed predefined size?
> Don't we use this to cast a given buffer into something we use?

you may very well be right. I didn't see this - the solaris/hpux shared nss
code is quite a pain to read


> If so args->status is wrong now and we better keep an 'int _not_used'.

alright, I'll change it this way, thanks!

Cheers
Björn
-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-37-0, fax: +49-551-37-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen


pgpDGaPi6RKhX.pgp
Description: PGP signature


Re: [SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Jelmer Vernooij
Hi Matthias,

On Fri, 2010-05-28 at 03:25 -0500, Matthias Dieter Wallnöfer wrote:
> diff --git a/source4/web_server/wsgi.c b/source4/web_server/wsgi.c
> index 7ee70e1..7a23ae4 100644
> --- a/source4/web_server/wsgi.c
> +++ b/source4/web_server/wsgi.c
> @@ -300,7 +300,9 @@ static PyObject *create_environ(bool tls, int 
> content_length, struct http_header
>   if (!strcasecmp(hdr->name, "Content-Type")) {
>   PyDict_SetItemString(env, "CONTENT_TYPE", 
> PyString_FromString(hdr->value));
>   } else { 
> - asprintf(&name, "HTTP_%s", hdr->name);
> + if (asprintf(&name, "HTTP_%s", hdr->name) < 0) {
> + continue;
> + }
>   PyDict_SetItemString(env, name, 
> PyString_FromString(hdr->value));
>   free(name);
>   }
^^^ Please don't ignore allocation problems, instead raise an exception
as I indicated in my review of your code in bugzilla.

Cheers,

Jelmer


signature.asc
Description: This is a digitally signed message part


Re: [SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Jelmer Vernooij
Hi Metze,

On Sun, 2010-08-08 at 04:08 -0500, Stefan Metzmacher wrote:
> - Log -
> commit ad94ae980462dc4c581a2fa1d7e927c2ae625c19
> Author: Stefan Metzmacher 
> Date:   Thu Aug 5 17:19:16 2010 +0200
> 
> librpc/idl/mgmt.idl: add missing size_is()
> 
> metze
> 
> commit 0a7f749bc80d9846b97cd22cd503473a205aaafd
> Author: Stefan Metzmacher 
> Date:   Thu Aug 5 16:10:37 2010 +0200
> 
> pidl:NDR: correctly handle bracket arrays with 'string'
> 
> metze
> 
> ---
> 
> Summary of changes:
>  librpc/idl/mgmt.idl|2 +-
>  pidl/lib/Parse/Pidl/NDR.pm |4 
>  2 files changed, 5 insertions(+), 1 deletions(-)
> 
> 
> Changeset truncated at 500 lines
> 
> diff --git a/librpc/idl/mgmt.idl b/librpc/idl/mgmt.idl
> index 35857f2..17c8cc4 100644
> --- a/librpc/idl/mgmt.idl
> +++ b/librpc/idl/mgmt.idl
> @@ -70,6 +70,6 @@ interface mgmt
>   WERROR mgmt_inq_princ_name (
>   [in]uint32  authn_proto,
>   [in]uint32  princ_name_size,
> - [out]   [string,charset(DOS)] uint8 princ_name[]
> + [out]   [string,size_is(princ_name_size),charset(DOS)] 
> uint8 princ_name[]
>   );
>  }
> diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm
> index c1ac600..20f52bf 100644
> --- a/pidl/lib/Parse/Pidl/NDR.pm
> +++ b/pidl/lib/Parse/Pidl/NDR.pm
> @@ -125,6 +125,10 @@ sub GetElementLevelTable($$)
>   if ($d eq "*") {
>   $is_conformant = 1;
>   if ($size = shift @size_is) {
> + if (has_property($e, "string")) {
> + $is_string = 1;
> + delete($e->{PROPERTIES}->{string});
> + }
>   } elsif ((scalar(@size_is) == 0) and has_property($e, 
> "string")) {
>   $is_string = 1;
>   delete($e->{PROPERTIES}->{string});
This change appears to be breaking openchange:

http://buildbot.openchange.org/builders/kubuntu1004-server/builds/150/steps/compile/logs/stdio

gen_ndr/ndr_exchange.c: In function ‘ndr_push_StringsArray_r’:
gen_ndr/ndr_exchange.c:6530: error: expected expression before ‘;’ token
gen_ndr/ndr_exchange.c:6531: error: ‘_status’ undeclared (first use in
this function)
gen_ndr/ndr_exchange.c:6531: error: (Each undeclared identifier is
reported only once
gen_ndr/ndr_exchange.c:6531: error: for each function it appears in.)
gen_ndr/ndr_exchange.c:6536: error: expected expression before ‘;’ token

Cheers,

Jelmer



Re: [SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Jelmer Vernooij
Hi Matthias,

On Sat, 2010-04-17 at 13:12 -0500, Matthias Dieter Wallnöfer wrote:
> - Log -
> commit c678563efec82e84c9c86309cbf9495950a02b8c
> Author: Matthias Dieter Wallnöfer 
> Date:   Sat Apr 17 20:08:15 2010 +0200
> 
> s4:kdc/db-glue.c - use "TALLOC_FREE" insteal of "talloc_free" for the 
> "priv" context
> 
> Also after a free "priv" could be != NULL and may be freed again.
> This should fix bug #7365.
We tend to avoid TALLOC_FREE in Samba 4, opting for explicitly setting
variable to NULL explicitly. This way valgrind will tell us about double
frees. 

If you think we should consider using TALLOC_FREE, I think we should
discuss that first - for now, please use talloc_free() and assignments
to NULL.

Cheers,

Jelmer


Re: [SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Jelmer Vernooij
Hi Matthieu,

On Sat, 2010-10-30 at 16:27 +0200, Matthieu Patou wrote:
> - Log -
> commit dce1a8f5233608d5bf59730200af3e041ce5
> Author: Matthieu Patou 
> Date:   Thu Oct 28 13:09:51 2010 +0400
> 
> provision: when deriving netbiosname from hostname force the netbiosname 
> to be compliant
> 
> It means no space/_/-/@ and less than 16 chars.
> 
> diff --git a/source4/scripting/python/samba/provision.py 
> b/source4/scripting/python/samba/provision.py
> index 5205ba5..49ad5d7 100644
> --- a/source4/scripting/python/samba/provision.py
> +++ b/source4/scripting/python/samba/provision.py
> @@ -443,6 +443,11 @@ def guess_names(lp=None, hostname=None, domain=None, 
> dnsdomain=None,
>  netbiosname = lp.get("netbios name")
>  if netbiosname is None:
>  netbiosname = hostname
> +# remove forbidden chars
> +for char in  " !#$%&'()-.@^_{}~":
> +netbiosname = "".join(netbiosname.split(char))
> +#force the length to be <16
> +netbiosname = netbiosname[0:15]
>  assert netbiosname is not None
>  netbiosname = netbiosname.upper()
>  if not valid_netbios_name(netbiosname):
> @@ -534,7 +539,14 @@ def make_smbconf(smbconf, setup_path, hostname, domain, 
> realm, serverrole,
>  assert smbconf is not None
>  if hostname is None:
>  hostname = socket.gethostname().split(".")[0]
> -netbiosname = hostname.upper()
> +netbiosname = hostname.upper()
> +# remove forbidden chars
> +for char in  " !#$%&'()-.@^_{}~":
> +netbiosname = "".join(netbiosname.split(char))
This logic is flawed - those characters are the ones that are allowed
(in addition to alphanumeric characters). Any other characters should be
stripped out. 

It would also be nice if we could share the list of acceptable NetBIOS
name characters between these two functions. 

> +#force the length to be <16
> +netbiosname = netbiosname[0:15]
If we have to do this sort of mangling I wonder if we shouldn't better
raise an error and let the user specify a name. 

Cheers,

Jelmer


Re: [SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Jelmer Vernooij
On Fri, 2010-12-10 at 22:35 +0100, Matthieu Patou wrote:
> commit 6875a611a71bf6d1623fc62361fc8b145b1f6559
> Author: Matthieu Patou 
> Date:   Fri Dec 10 23:16:28 2010 +0300
> 
> build: add a function to test if -lc is needed
> 
> This is needed on openbsd as some linking flags makes mandatory to
> specify the libc for the linking
> 
Urgh, there is something seriously broken if a C compiler doesn't link
to libc by default (I can understand a -nostdlib option). Is this
default OpenBSD behaviour or something specific to this host?

Cheers,

Jelmer


Re: talloc dep for talloc.h

2011-05-20 Thread Jelmer Vernooij
On Tue, 2011-01-04 at 21:27 +1100, Andrew Bartlett wrote:
> On Tue, 2011-01-04 at 09:55 +0100, Jelmer Vernooij wrote:
> > On Tue, 2011-01-04 at 05:40 +0100, Andrew Bartlett wrote:
> > > commit 640028d158583825ea5ffd1266f099cf8776db5d
> > > Author: Andrew Bartlett 
> > > Date:   Tue Jan 4 14:41:38 2011 +1100
> > > 
> > > nsswitch Add talloc depencency for nsstest
> > > 
> > > nsstest does not use talloc, but it includes talloc.h via includes.h,
> > > and so without this it cannot find the right internal header.
> > > 
> > > This wasn't noticed before, as most linux developer boxes have a 
> > > talloc.h.
> > > 
> > > The issue was reported by Adam Tauno Williams  > > whitemice.org>
> > I'm a bit puzzled by this, as e.g. sn doesn't have talloc.h installed
> > either and neither have most of the build farm hosts. Perhaps it happens
> > if talloc.h is installed but not in /usr/include ?
> 
> That is odd, but I reproduced it locally, by removing libtalloc-devel
> from my Fedora 12 laptop.  I've tested it before and after this commit
> (including a waf configure).
That is odd indeed. Is talloc.pc perhaps part of the the libtalloc
package on RedHat instead of libtalloc-devel ?

Cheers,

Jelmer



Re: [SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Jelmer Vernooij
On Tue, 2011-01-04 at 05:40 +0100, Andrew Bartlett wrote:
> commit 640028d158583825ea5ffd1266f099cf8776db5d
> Author: Andrew Bartlett 
> Date:   Tue Jan 4 14:41:38 2011 +1100
> 
> nsswitch Add talloc depencency for nsstest
> 
> nsstest does not use talloc, but it includes talloc.h via includes.h,
> and so without this it cannot find the right internal header.
> 
> This wasn't noticed before, as most linux developer boxes have a talloc.h.
> 
> The issue was reported by Adam Tauno Williams 
I'm a bit puzzled by this, as e.g. sn doesn't have talloc.h installed
either and neither have most of the build farm hosts. Perhaps it happens
if talloc.h is installed but not in /usr/include ?

Cheers,

Jelmer


Re: talloc dep for talloc.h

2011-05-20 Thread simo
On Tue, 2011-01-04 at 11:30 +0100, Jelmer Vernooij wrote:
> On Tue, 2011-01-04 at 21:27 +1100, Andrew Bartlett wrote:
> > On Tue, 2011-01-04 at 09:55 +0100, Jelmer Vernooij wrote:
> > > On Tue, 2011-01-04 at 05:40 +0100, Andrew Bartlett wrote:
> > > > commit 640028d158583825ea5ffd1266f099cf8776db5d
> > > > Author: Andrew Bartlett 
> > > > Date:   Tue Jan 4 14:41:38 2011 +1100
> > > > 
> > > > nsswitch Add talloc depencency for nsstest
> > > > 
> > > > nsstest does not use talloc, but it includes talloc.h via 
> > > > includes.h,
> > > > and so without this it cannot find the right internal header.
> > > > 
> > > > This wasn't noticed before, as most linux developer boxes have a 
> > > > talloc.h.
> > > > 
> > > > The issue was reported by Adam Tauno Williams  > > > whitemice.org>
> > > I'm a bit puzzled by this, as e.g. sn doesn't have talloc.h installed
> > > either and neither have most of the build farm hosts. Perhaps it happens
> > > if talloc.h is installed but not in /usr/include ?
> > 
> > That is odd, but I reproduced it locally, by removing libtalloc-devel
> > from my Fedora 12 laptop.  I've tested it before and after this commit
> > (including a waf configure).
> That is odd indeed. Is talloc.pc perhaps part of the the libtalloc
> package on RedHat instead of libtalloc-devel ?

talloc.pc is in libtalloc-devel in fedora and in RHEL.

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer 
Principal Software Engineer at Red Hat, Inc. 



[SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Volker Lendecke
The branch, master has been updated
   via  8a2eff8 s3: Fork the echo handler only after SMB1 negprot is done
   via  af9afe9 s3: Fix Coverity ID 2573: UNUSED_VALUE
   via  f043bab s3: Fix an uninitialized variable
  from  1e472f1 s3:testparm: don't return an error for a warning message

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 8a2eff871f990aaaf1e11b333035097f5e6d3268
Author: Volker Lendecke 
Date:   Fri May 20 13:07:17 2011 +0200

s3: Fork the echo handler only after SMB1 negprot is done

This enables activating the echo responder also if SMB2 is enabled, albeit 
it
will only be used for SMB1 at this moment.

Autobuild-User: Volker Lendecke 
Autobuild-Date: Fri May 20 15:06:03 CEST 2011 on sn-devel-104

commit af9afe9f4fc21b9c800bb14c65cbfecb155d3519
Author: Volker Lendecke 
Date:   Fri May 20 13:25:31 2011 +0200

s3: Fix Coverity ID 2573: UNUSED_VALUE

Andrew B., please check!

commit f043babcbdef26980a607de517be05092bf037a9
Author: Volker Lendecke 
Date:   Fri May 20 15:21:43 2011 +0200

s3: Fix an uninitialized variable

---

Summary of changes:
 source3/lib/netapi/netapi.c |5 +++--
 source3/smbd/negprot.c  |5 +
 source3/smbd/process.c  |9 ++---
 source3/smbd/proto.h|1 +
 source3/smbd/reply.c|2 +-
 5 files changed, 12 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c
index 06e353d..1d34934 100644
--- a/source3/lib/netapi/netapi.c
+++ b/source3/lib/netapi/netapi.c
@@ -293,9 +293,10 @@ char *libnetapi_errstr(NET_API_STATUS status)
if (status & 0xc000) {
ret = talloc_strdup(NULL, 
 
get_friendly_nt_error_msg(NT_STATUS(status)));
+   } else {
+   ret = talloc_strdup(NULL,
+   get_friendly_werror_msg(W_ERROR(status)));
}
-
-   ret = talloc_strdup(NULL, get_friendly_werror_msg(W_ERROR(status)));
TALLOC_FREE(frame);
return ret;
 }
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index 9f201b8..aa10563 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -716,6 +716,11 @@ void reply_negprot(struct smb_request *req)
}
 
TALLOC_FREE(cliprotos);
+
+   if (lp_async_smb_echo_handler() && !fork_echo_handler(sconn)) {
+   exit_server("Failed to fork echo handler");
+   }
+
END_PROFILE(SMBnegprot);
return;
 }
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 5f9845c..7f04a7b 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2798,7 +2798,7 @@ static void smbd_echo_loop(struct smbd_server_connection 
*sconn,
 /*
  * Handle SMBecho requests in a forked child process
  */
-static bool fork_echo_handler(struct smbd_server_connection *sconn)
+bool fork_echo_handler(struct smbd_server_connection *sconn)
 {
int listener_pipe[2];
int res;
@@ -2912,8 +2912,7 @@ void smbd_process(struct smbd_server_connection *sconn)
const char *remaddr = NULL;
int ret;
 
-   if (lp_maxprotocol() == PROTOCOL_SMB2 &&
-   !lp_async_smb_echo_handler()) {
+   if (lp_maxprotocol() == PROTOCOL_SMB2) {
/*
 * We're not making the decision here,
 * we're just allowing the client
@@ -3034,10 +3033,6 @@ void smbd_process(struct smbd_server_connection *sconn)
exit_server("Failed to init smb_signing");
}
 
-   if (lp_async_smb_echo_handler() && !fork_echo_handler(sconn)) {
-   exit_server("Failed to fork echo handler");
-   }
-
/* Setup oplocks */
if (!init_oplocks(sconn->msg_ctx))
exit_server("Failed to init oplocks");
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 1f2b1a9..589d45d 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -750,6 +750,7 @@ size_t req_wct_ofs(struct smb_request *req);
 void chain_reply(struct smb_request *req);
 bool req_is_in_chain(struct smb_request *req);
 void smbd_process(struct smbd_server_connection *sconn);
+bool fork_echo_handler(struct smbd_server_connection *sconn);
 
 /* The following definitions come from smbd/quotas.c  */
 
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index fc381d8..99ab4ca 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -5815,7 +5815,7 @@ static void rename_open_files(connection_struct *conn,
files_struct *fsp;
bool did_rename = False;
NTSTATUS status;
-   uint32_t new_name_hash;
+   uint32_t new_name_hash = 0;
 
for(fsp = file_find_di_first(conn->sconn, lck->id); fsp;
fsp = file_find_di_next(fsp)) {


-- 
Samba Shar

Re: [SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Jelmer Vernooij
Hi Matthias,

On Fri, 2010-05-28 at 12:08 -0500, Matthias Dieter Wallnöfer wrote:
> Summary of changes:
>  source4/web_server/wsgi.c |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> 
> Changeset truncated at 500 lines:
> 
> diff --git a/source4/web_server/wsgi.c b/source4/web_server/wsgi.c
> index 7a23ae4..db1a5f2 100644
> --- a/source4/web_server/wsgi.c
> +++ b/source4/web_server/wsgi.c
> @@ -301,7 +301,8 @@ static PyObject *create_environ(bool tls, int 
> content_length, struct http_header
>   PyDict_SetItemString(env, "CONTENT_TYPE", 
> PyString_FromString(hdr->value));
>   } else { 
>   if (asprintf(&name, "HTTP_%s", hdr->name) < 0) {
> - continue;
> + PyErr_NoMemory();
> + return NULL;
>   }
This will leak the 'env' python object. You probably also want to call
Py_DECREF here.

Cheers,

Jelmer


signature.asc
Description: This is a digitally signed message part


Re: [SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Jelmer Vernooij
On Mon, 2010-05-31 at 09:46 +0200, Stefan (metze) Metzmacher wrote:
> > diff --git a/lib/talloc/wscript b/lib/talloc/wscript
> > index 3a87506..61930f6 100644
> > --- a/lib/talloc/wscript
> > +++ b/lib/talloc/wscript
> > @@ -60,14 +60,14 @@ def build(bld):
> >abi_file='ABI/talloc-%s.sigs' % VERSION,
> >abi_match='talloc* _talloc*',
> >hide_symbols=True,
> > -  vnum=VERSION)
> > +  vnum=VERSION, is_bundled=True)
> >  
> >  # should we also install the symlink to libtalloc1.so here?
> >  bld.SAMBA_LIBRARY('talloc-compat1',
> >'compat/talloc_compat1.c',
> >deps='talloc',
> >enabled = bld.env.TALLOC_COMPAT1,
> > -  vnum=VERSION)
> > +  vnum=VERSION, is_bundled=True)
> >
> 
> shouldn't we use 'not bld.env.standalone_talloc' instead of 'True'
> here too?
That's a good point, thanks. Fixed in master.

Cheers,

Jelmer


signature.asc
Description: This is a digitally signed message part


Re: [SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Jelmer Vernooij
On Mon, 2010-05-31 at 19:49 +0200, Stefan (metze) Metzmacher wrote:
> Am 31.05.2010 19:23, schrieb Jelmer Vernooij:
> > The branch, master has been updated
> >via  7f75ee0... ldb: Install ldb_handlers.h header.
> >via  fe8302b... ldb: Remove Samba-specific symbols.
> >via  1bc53f0... ldb: Move utility functions to separate file.
> >via  82d56b9... ldb: Fix dependencies when building with system ldb.
> >   from  471ed70... s3:smbd map_username() doesn't need sconn anymore
> > 
> > http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
> > 
> > 
> > - Log -
> > commit 7f75ee025ff9c02763fb9201d94af4b2739c8e03
> > Author: Jelmer Vernooij 
> > Date:   Mon May 31 18:29:11 2010 +0200
> > 
> > ldb: Install ldb_handlers.h header.
> > 
> > commit fe8302b235197e359a20ba0489eb72b54793963e
> > Author: Jelmer Vernooij 
> > Date:   Mon May 31 18:28:09 2010 +0200
> > 
> > ldb: Remove Samba-specific symbols.
> > 
> > commit 1bc53f0213b04e30ebf2ac60695c84c5781e4e72
> > Author: Jelmer Vernooij 
> > Date:   Mon May 31 18:12:05 2010 +0200
> > 
> > ldb: Move utility functions to separate file.
> > 
> > commit 82d56b937445585b9e60451daf660aee5ace0523
> > Author: Jelmer Vernooij 
> > Date:   Mon May 31 16:05:41 2010 +0200
> > 
> > ldb: Fix dependencies when building with system ldb.
> 
> I'm getting this again:
> 
> [1862/1965] abi_check: source4/bin/default/source4/lib/ldb/libldb-samba4.so
> libldb-samba4.so: symbol ldb_wrap_connect has been added - please mark
> it _PRIVATE_ or update minor version
> signature: struct ldb_context *(TALLOC_CTX *, struct
> tevent_context *, struct loadparm_context *, const char *, struct
> auth_session_info *, struct cli_credentials *, unsigned int)
> libldb-samba4.so: symbol ldb_register_samba_handlers has been added -
> please mark it _PRIVATE_ or update minor version
> signature: int (struct ldb_context *)
> libldb-samba4.so: symbol ldb_wrap_fork_hook has been added - please mark
> it _PRIVATE_ or update minor version
> signature: void (void)
> libldb-samba4.so: symbol ldb_samba_syntax_by_lDAPDisplayName has been
> added - please mark it _PRIVATE_ or update minor version
> signature: const struct ldb_schema_syntax *(struct ldb_context
> *, const char *)
> libldb-samba4.so: symbol ldb_samba_syntax_by_name has been added -
> please mark it _PRIVATE_ or update minor version
> signature: const struct ldb_schema_syntax *(struct ldb_context
> *, const char *)
> Waf: Leaving directory `/home/metze/master4/source4/bin'
> Build failed: ABI for libldb-samba4.so has changed - please fix library
> version then build with --abi-update
> See http://wiki.samba.org/index.php/Waf#ABI_Checking for more information
> make: *** [all] Fehler 1
Have you tried a "git clean -f -x -d" ?

I can't reproduce the issue with that, and as far as I can tell the
buildfarm is happy too.

Cheers,

Jelmer


signature.asc
Description: This is a digitally signed message part


[SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Christian Ambach
The branch, master has been updated
   via  df650fa s3:smbd remove unused code
  from  8a2eff8 s3: Fork the echo handler only after SMB1 negprot is done

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit df650fa8cf4954245eced7eccb26388c24acee82
Author: Christian Ambach 
Date:   Fri May 20 14:17:36 2011 +0200

s3:smbd remove unused code

in the early CTDB days, the RELEASE_IP message was defined
and some code was added to react on such a message to make
smbd exit if the IP address it was using for the server socket
is removed by CTDB.
Later, it was discovered that we need to stop smbd immediately
and logic was added to ctdb_conn to call release_ip() without
going through the messaging system.

So this code is not used and can be removed

Autobuild-User: Christian Ambach 
Autobuild-Date: Fri May 20 16:18:24 CEST 2011 on sn-devel-104

---

Summary of changes:
 source3/librpc/idl/messaging.idl |1 -
 source3/smbd/process.c   |   11 ---
 2 files changed, 0 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/librpc/idl/messaging.idl b/source3/librpc/idl/messaging.idl
index 8618d53..0c0672c 100644
--- a/source3/librpc/idl/messaging.idl
+++ b/source3/librpc/idl/messaging.idl
@@ -75,7 +75,6 @@ interface messaging
 
/* cluster reconfigure events */
MSG_SMB_BRL_VALIDATE= 0x0311,
-   MSG_SMB_RELEASE_IP  = 0x0312,
 
/*Close a specific file given a share entry. */
MSG_SMB_CLOSE_FILE  = 0x0313,
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 7f04a7b..dc637de 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2375,15 +2375,6 @@ static void release_ip(const char *ip, void *priv)
}
 }
 
-static void msg_release_ip(struct messaging_context *msg_ctx, void 
*private_data,
-  uint32_t msg_type, struct server_id server_id, 
DATA_BLOB *data)
-{
-   struct smbd_server_connection *sconn = talloc_get_type_abort(
-   private_data, struct smbd_server_connection);
-
-   release_ip((char *)data->data, sconn->client_id.addr);
-}
-
 #ifdef CLUSTER_SUPPORT
 static int client_get_tcp_info(int sock, struct sockaddr_storage *server,
   struct sockaddr_storage *client)
@@ -3040,8 +3031,6 @@ void smbd_process(struct smbd_server_connection *sconn)
/* register our message handlers */
messaging_register(sconn->msg_ctx, NULL,
   MSG_SMB_FORCE_TDIS, msg_force_tdis);
-   messaging_register(sconn->msg_ctx, sconn,
-  MSG_SMB_RELEASE_IP, msg_release_ip);
messaging_register(sconn->msg_ctx, NULL,
   MSG_SMB_CLOSE_FILE, msg_close_file);
 


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Jeremy Allison
The branch, master has been updated
   via  95a55e2 Fix bug 8133 - strange behavior for the file (whose 
filename first character is period ) in SMB2 case.
   via  38c77db Optimization. If the attributes passed to can_rename() 
include both FILE_ATTRIBUTE_HIDDEN and FILE_ATTRIBUTE_SYSTEM then there's no 
point in reading the source DOS attribute, as we're not going to deny the 
rename on attribute match.
  from  df650fa s3:smbd remove unused code

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 95a55e2feabfae3b0874ae9aa2ce716ca0a9ae39
Author: Jeremy Allison 
Date:   Thu May 19 16:39:18 2011 -0700

Fix bug 8133 - strange behavior for the file (whose filename first 
character is period ) in SMB2 case.

When doing SMB2 renames, we need to match all filetypes (no attributes 
field in the SMB2 call).
By default a file starting with a period is returned as 
FILE_ATTRIBUTE_HIDDEN in Samba.

Autobuild-User: Jeremy Allison 
Autobuild-Date: Fri May 20 19:26:04 CEST 2011 on sn-devel-104

commit 38c77db9892b5d607a7a05fab563f5f6977794e1
Author: Jeremy Allison 
Date:   Thu May 19 16:38:11 2011 -0700

Optimization. If the attributes passed to can_rename() include both 
FILE_ATTRIBUTE_HIDDEN and FILE_ATTRIBUTE_SYSTEM then there's no point in 
reading the source DOS attribute, as we're not going to deny the rename on 
attribute match.

---

Summary of changes:
 source3/smbd/reply.c  |   13 -
 source3/smbd/trans2.c |5 +++--
 2 files changed, 11 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 99ab4ca..31f596c 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2381,15 +2381,18 @@ void reply_ctemp(struct smb_request *req)
 static NTSTATUS can_rename(connection_struct *conn, files_struct *fsp,
uint16 dirtype)
 {
-   uint32 fmode;
-
if (!CAN_WRITE(conn)) {
return NT_STATUS_MEDIA_WRITE_PROTECTED;
}
 
-   fmode = dos_mode(conn, fsp->fsp_name);
-   if ((fmode & ~dirtype) & (FILE_ATTRIBUTE_HIDDEN | 
FILE_ATTRIBUTE_SYSTEM)) {
-   return NT_STATUS_NO_SUCH_FILE;
+   if ((dirtype & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) !=
+   (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) {
+   /* Only bother to read the DOS attribute if we might deny the
+  rename on the grounds of attribute missmatch. */
+   uint32_t fmode = dos_mode(conn, fsp->fsp_name);
+   if ((fmode & ~dirtype) & (FILE_ATTRIBUTE_HIDDEN | 
FILE_ATTRIBUTE_SYSTEM)) {
+   return NT_STATUS_NO_SUCH_FILE;
+   }
}
 
if (S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index f5b87c7..cc21b32 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -6050,8 +6050,9 @@ static NTSTATUS 
smb2_file_rename_information(connection_struct *conn,
  "SMB_FILE_RENAME_INFORMATION (fnum %d) %s -> %s\n",
  fsp->fnum, fsp_str_dbg(fsp),
  smb_fname_str_dbg(smb_fname_dst)));
-   status = rename_internals_fsp(conn, fsp, smb_fname_dst, 0,
- overwrite);
+   status = rename_internals_fsp(conn, fsp, smb_fname_dst,
+   (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM),
+   overwrite);
 
  out:
TALLOC_FREE(smb_fname_dst);


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-5-test updated

2011-05-20 Thread Karolin Seeger
The branch, v3-5-test has been updated
   via  19bbd0a s3/configure: fix GNU ld version detection with old gcc 
releases
  from  c8ba5d4 tdb_expand: limit the expansion with huge records

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -
commit 19bbd0a4f0c39aaf6f0f3ecdcce7c52bb8264a5a
Author: Björn Jacke 
Date:   Fri Nov 26 15:14:14 2010 +0100

s3/configure: fix GNU ld version detection with old gcc releases

needed as old gcc releases output everything to stderr, even stdout output 
from
ld

Fixes #7825

Autobuild-User: Björn Jacke 
Autobuild-Date: Fri Nov 26 20:15:24 CET 2010 on sn-devel-104
(cherry picked from commit 70a7da0e101910e3ceb08b86d4b840b219e24d7d)

---

Summary of changes:
 source3/configure.in |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/configure.in b/source3/configure.in
index b21e261..2c9fe1e 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -215,7 +215,7 @@ dnl Certain versions of GNU ld the default is not to have 
the
 dnl --allow-shlib-undefined flag defined.  This causes a stackload of
 dnl warnings when building modules.
 if test "$ac_cv_prog_gnu_ld" = "yes"; then
-   ac_cv_gnu_ld_version=`$CC -Wl,-v /dev/null 2>/dev/null | head -1`
+   ac_cv_gnu_ld_version=`$CC -Wl,-v /dev/null 2>&1 < /dev/null | grep "GNU 
ld"`
AC_MSG_CHECKING(GNU ld release date)
changequote(,)dnl
ac_cv_gnu_ld_date=`echo $ac_cv_gnu_ld_version | sed -n 
's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-5-test updated

2011-05-20 Thread Karolin Seeger
The branch, v3-5-test has been updated
   via  9c75728 s3-net: make sure we dont crash when publishing a single 
printer.
  from  19bbd0a s3/configure: fix GNU ld version detection with old gcc 
releases

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -
commit 9c75728c62cccb8da606ece2d9df08b592e7c7c0
Author: Günther Deschner 
Date:   Fri Oct 1 06:08:12 2010 +0200

s3-net: make sure we dont crash when publishing a single printer.

Guenther
(cherry picked from commit 21576e3f8c32878910460bf9575c200ad93d682a)

Part of a fix for bug #7993 ("net rpc printer MIGRATE" command fails).

---

Summary of changes:
 source3/utils/net_rpc_printer.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index dfc150f..8b6d73e 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -1091,6 +1091,11 @@ static bool get_printer_info(struct rpc_pipe_client 
*pipe_hnd,
 &hnd))
return false;
 
+   *info_p = talloc_zero(mem_ctx, union spoolss_PrinterInfo);
+   if (*info_p == NULL) {
+   return false;
+   }
+
if (!net_spoolss_getprinter(pipe_hnd, mem_ctx, &hnd, level, *info_p)) {
rpccli_spoolss_ClosePrinter(pipe_hnd, mem_ctx, &hnd, NULL);
return false;


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-6-test updated

2011-05-20 Thread Karolin Seeger
The branch, v3-6-test has been updated
   via  7304370 talloc: splitout _talloc_free_children_internal()
   via  e3ff6f5 talloc: fixed a use after free error in 
talloc_free_children()
   via  d54493b talloc: use _talloc_free_internal() in 
talloc_free_children()
   via  ac6bb22 talloc: test talloc_steal out of a talloc_pool
   via  ade2fe7 talloc: add memset() calls to test_pool()
   via  75ce3de talloc: setup the new 'tc' before TC_UNDEFINE_GROW_CHUNK() 
_talloc_realloc()
   via  8e95d32 talloc: make really sure only optimize realloc if there's 
only one pool chunk
   via  dc8b297 talloc: make use of _talloc_free_poolmem() in 
_talloc_realloc()
   via  4cf761b talloc: split the handling of FLAG_POOL/FLAG_POOLMEM in 
_talloc_free_internal
  from  eb15457 Fix typos in LDAP schema files

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -
commit 7304370a2423230120a9ceebd1016966658f713f
Author: Stefan Metzmacher 
Date:   Tue May 17 08:50:45 2011 +0200

talloc: splitout _talloc_free_children_internal()

metze

Autobuild-User: Stefan Metzmacher 
Autobuild-Date: Tue May 17 10:49:13 CEST 2011 on sn-devel-104
(cherry picked from commit df2cb2f672569e5d113fe2e77fdc1ee16c8b646d)

The last 9 patches address bug #8140 (talloc: valgrind false positives and 
other
backports).

commit e3ff6f5bbe09913b45ea1aef613c8790b25a978c
Author: Stefan Metzmacher 
Date:   Fri Apr 8 12:30:46 2011 +0200

talloc: fixed a use after free error in talloc_free_children()

This is similar to commit 6f51a1f45bf4de062cce7a562477e8140630a53d.

metze
(cherry picked from commit 38633c9f0b7f86673f08903999583ad5b62c3548)

commit d54493b4b43cc0d299486e571d813f90a7b22059
Author: Stefan Metzmacher 
Date:   Fri Apr 8 12:27:05 2011 +0200

talloc: use _talloc_free_internal() in talloc_free_children()

metze
(cherry picked from commit f3b855d2ff9576715afe50d75678829c6bc0842d)

commit ac6bb22a8c054e5949e07f563bf9fba46d22358d
Author: Stefan Metzmacher 
Date:   Mon May 16 19:25:47 2011 +0200

talloc: test talloc_steal out of a talloc_pool

metze

Autobuild-User: Stefan Metzmacher 
Autobuild-Date: Tue May 17 09:43:01 CEST 2011 on sn-devel-104
(cherry picked from commit 37b2130ed9612a7334888ecd2fee26b0b45ac271)

commit ade2fe7e8fc299e01ba13a08c95598eefa5b99b5
Author: Stefan Metzmacher 
Date:   Tue May 17 08:20:13 2011 +0200

talloc: add memset() calls to test_pool()

This way we the pool based valgrind code.

metze
(cherry picked from commit 16cc52cf70a9918843f9761baf483338c80bf1d0)

commit 75ce3de1eb2e7042c7a4ffcb6f0f6aa2a41c19b5
Author: Stefan Metzmacher 
Date:   Tue May 17 08:19:04 2011 +0200

talloc: setup the new 'tc' before TC_UNDEFINE_GROW_CHUNK() _talloc_realloc()

metze
(cherry picked from commit c281f2fc1a359d0d3b91b94438f11bb7c88170b5)

commit 8e95d3201adc546000ca29816c83aba6fab52b1a
Author: Stefan Metzmacher 
Date:   Mon May 16 20:15:59 2011 +0200

talloc: make really sure only optimize realloc if there's only one pool 
chunk

*talloc_pool_objectcount(pool_tc) == 2 doesn't mean the one of the objects
is the pool itself! So we better check for == 1 and calculate the chunk 
count.

metze
(cherry picked from commit 7102105c8954627dc30a851327cf2642ac0783d5)

commit dc8b2979168c6688c647cdc39d321eb54bd0aa5b
Author: Stefan Metzmacher 
Date:   Mon May 16 20:23:13 2011 +0200

talloc: make use of _talloc_free_poolmem() in _talloc_realloc()

This should follow the same logic...

metze
(cherry picked from commit 14b662ee4f278764b9dfd620851e908d29f29fc4)

commit 4cf761bb5a030340625172a51212b11613efea02
Author: Stefan Metzmacher 
Date:   Mon May 16 19:06:07 2011 +0200

talloc: split the handling of FLAG_POOL/FLAG_POOLMEM in 
_talloc_free_internal

The optimization of the object_count == 1 case should only happen
for when we're not destroying the pool itself. And it should only
happen if the pool itself is still valid.

If the pool isn't valid (it has TALLOC_FLAG_FREE),
object_count == 1 does not mean that the pool is the last object,
which can happen if you use talloc_steal/move() on memory
from the pool and then free the pool itself.

Thanks to Volker for noticing this!

metze
(cherry picked from commit 2d514be1ed3b8245157a0a51186ec7f9db828202)

---

Summary of changes:
 lib/talloc/talloc.c|  216 ++--
 lib/talloc/testsuite.c |   86 +++
 2 files changed, 203 insertions(+), 99 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index 2a956dc..4700aa9 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc

[SCM] Samba Shared Repository - branch v3-6-test updated

2011-05-20 Thread Karolin Seeger
The branch, v3-6-test has been updated
   via  ba6f63ca s3:rpc_server: create lp_ncalrpc_dir() with 0755 before 
lp_ncalrpc_dir()/np with 0700
   via  6e89c23 ncalrpc: Force ncalrpc dir to be mode 755 in all users
  from  7304370 talloc: splitout _talloc_free_children_internal()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -
commit ba6f63ca67fc9e0b2bfa54ccf2cf0b78c53db74b
Author: Stefan Metzmacher 
Date:   Tue May 17 10:32:38 2011 +0200

s3:rpc_server: create lp_ncalrpc_dir() with 0755 before lp_ncalrpc_dir()/np 
with 0700

metze

Autobuild-User: Stefan Metzmacher 
Autobuild-Date: Tue May 17 13:01:14 CEST 2011 on sn-devel-104
(cherry picked from commit cb227d6d1492247d8aff03807cac0b7266202a38)

The last 2 patches address bug #8141 (wrong permissions on 
lp_ncalrpc_dir()).

commit 6e89c230046f1b7300ba5f76dfbc81c57af69fe5
Author: Andrew Bartlett 
Date:   Sun May 8 10:29:27 2011 +0200

ncalrpc: Force ncalrpc dir to be mode 755 in all users

This allows this directory to be shared between Samba3 and Samba4 in a
Franky-style setup easily.

Andrew Bartlett
(cherry picked from commit aae9353ecf56323b63da66aa84d8a0a4f219d94d)

---

Summary of changes:
 source3/rpc_server/rpc_server.c   |   15 +--
 source4/smbd/service_named_pipe.c |7 +++
 2 files changed, 20 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c
index 681898d..8ec55bb 100644
--- a/source3/rpc_server/rpc_server.c
+++ b/source3/rpc_server/rpc_server.c
@@ -263,6 +263,17 @@ bool setup_named_pipe_socket(const char *pipe_name,
}
state->fd = -1;
 
+   /*
+* As lp_ncalrpc_dir() should have 0755, but
+* lp_ncalrpc_dir()/np should have 0700, we need to
+* create lp_ncalrpc_dir() first.
+*/
+   if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) {
+   DEBUG(0, ("Failed to create pipe directory %s - %s\n",
+ lp_ncalrpc_dir(), strerror(errno)));
+   goto out;
+   }
+
np_dir = talloc_asprintf(state, "%s/np", lp_ncalrpc_dir());
if (!np_dir) {
DEBUG(0, ("Out of memory\n"));
@@ -889,13 +900,13 @@ bool setup_dcerpc_ncalrpc_socket(struct tevent_context 
*ev_ctx,
return false;
}
 
-   if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0700)) {
+   if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) {
DEBUG(0, ("Failed to create pipe directory %s - %s\n",
  lp_ncalrpc_dir(), strerror(errno)));
goto out;
}
 
-   state->fd = create_pipe_sock(lp_ncalrpc_dir(), name, 0700);
+   state->fd = create_pipe_sock(lp_ncalrpc_dir(), name, 0755);
if (state->fd == -1) {
DEBUG(0, ("Failed to create pipe socket! [%s/%s]\n",
  lp_ncalrpc_dir(), name));
diff --git a/source4/smbd/service_named_pipe.c 
b/source4/smbd/service_named_pipe.c
index 086a037..a1e013d 100644
--- a/source4/smbd/service_named_pipe.c
+++ b/source4/smbd/service_named_pipe.c
@@ -200,6 +200,13 @@ NTSTATUS tstream_setup_named_pipe(TALLOC_CTX *mem_ctx,
goto fail;
}
 
+   if (!directory_create_or_exist(lpcfg_ncalrpc_dir(lp_ctx), geteuid(), 
0755)) {
+   status = map_nt_error_from_unix(errno);
+   DEBUG(0,(__location__ ": Failed to create ncalrpc pipe 
directory '%s' - %s\n",
+lpcfg_ncalrpc_dir(lp_ctx), nt_errstr(status)));
+   goto fail;
+   }
+
dirname = talloc_asprintf(pipe_sock, "%s/np", 
lpcfg_ncalrpc_dir(lp_ctx));
if (dirname == NULL) {
goto fail;


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-6-test updated

2011-05-20 Thread Karolin Seeger
The branch, v3-6-test has been updated
   via  72e50d3 Fix Bug 8152 - smbd crash in release_ip()
  from  ba6f63ca s3:rpc_server: create lp_ncalrpc_dir() with 0755 before 
lp_ncalrpc_dir()/np with 0700

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -
commit 72e50d34eeac4cd72ec2f6b3609b5373f1f1ec15
Author: Christian Ambach 
Date:   Thu May 19 18:13:40 2011 +0200

Fix Bug 8152 - smbd crash in release_ip()

release_ip() needs the private_data, but it was never saved away
to feed it into release_ip() later

Autobuild-User: Christian Ambach 
Autobuild-Date: Thu May 19 21:21:14 CEST 2011 on sn-devel-104
(cherry picked from commit 642c6ba2b9c581bacfcb9a6cb4c5c95d446263ce)

---

Summary of changes:
 source3/lib/ctdbd_conn.c |5 +
 source3/smbd/process.c   |3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index b928ed9..1d01da6 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -1361,6 +1361,11 @@ NTSTATUS ctdbd_register_ips(struct ctdbd_connection 
*conn,
}
 
conn->release_ip_handler = release_ip_handler;
+   /*
+* store the IP address of the server socket for later
+* comparison in release_ip()
+*/
+   conn->release_ip_priv = private_data;
 
/*
 * We want to be told about IP releases
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 5d0acd7..ea4c36b 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2357,6 +2357,9 @@ static void release_ip(const char *ip, void *priv)
p = addr + 7;
}
 
+   DEBUG(10, ("Got release IP message for %s, "
+  "our address is %s\n", ip, p));
+
if ((strcmp(p, ip) == 0) || ((p != addr) && strcmp(addr, ip) == 0)) {
/* we can't afford to do a clean exit - that involves
   database writes, which would potentially mean we


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-6-test updated

2011-05-20 Thread Karolin Seeger
The branch, v3-6-test has been updated
   via  8546896 Fix bug 8153 found when building on an IPv6-only system by 
Kai Blin.
  from  72e50d3 Fix Bug 8152 - smbd crash in release_ip()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -
commit 85468960ebdb3d813bd863e57f6dca6bab61bec2
Author: Jeremy Allison 
Date:   Thu May 19 12:32:15 2011 -0700

Fix bug 8153 found when building on an IPv6-only system by Kai Blin.

When building on IPv6-only, doing:

hints.ai_family = AF_INET;
getaddrinfo("0.0.0.0", NULL, &hints, &ppres)

fails as AF_INET is unavailable on an IPv6-only system. This
causes us to fallback to our replacement getaddrinfo code
which is IPv4-only.

As we're only trying to detect a specific AIX bug here,
broaden the tests to find that bug, and also test for
working getaddrinfo in an IPv6-only safe way.

---

Summary of changes:
 lib/replace/libreplace_network.m4 |   19 ---
 1 files changed, 16 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/replace/libreplace_network.m4 
b/lib/replace/libreplace_network.m4
index f9bca40..eadcc6b 100644
--- a/lib/replace/libreplace_network.m4
+++ b/lib/replace/libreplace_network.m4
@@ -240,12 +240,25 @@ if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then
{
struct addrinfo hints = {0,};
struct addrinfo *ppres;
-   const char hostname[] = "0.0.0.0";
+   const char hostname1[] = "0.0.0.0";
+   const char hostname2[] = "127.0.0.1";
+   const char hostname3[] = "::";
hints.ai_socktype = SOCK_STREAM;
-   hints.ai_family = AF_INET;
+   hints.ai_family = AF_UNSPEC;
hints.ai_flags =
AI_NUMERICHOST|AI_PASSIVE|AI_ADDRCONFIG;
-   return getaddrinfo(hostname, NULL, &hints, &ppres) != 0 
? 1 : 0;
+   /* Test for broken flag combination on AIX. */
+   if (getaddrinfo(hostname1, NULL, &hints, &ppres) == 
EAI_BADFLAGS) {
+   /* This fails on an IPv6-only box, but not with
+  the EAI_BADFLAGS error. */
+   return 1;
+   }
+   if (getaddrinfo(hostname2, NULL, &hints, &ppres) == 0) {
+   /* IPv4 lookup works - good enough. */
+   return 0;
+   }
+   /* Uh-oh, no IPv4. Are we IPv6-only ? */
+   return getaddrinfo(hostname3, NULL, &hints, &ppres) != 
0 ? 1 : 0;
}],
libreplace_cv_HAVE_GETADDRINFO=yes,
libreplace_cv_HAVE_GETADDRINFO=no)


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-6-test updated

2011-05-20 Thread Karolin Seeger
The branch, v3-6-test has been updated
   via  aba30a8 s3-epmapper: Fixed endpoint registration.
  from  8546896 Fix bug 8153 found when building on an IPv6-only system by 
Kai Blin.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -
commit aba30a8d502f0a425672205734bfb91d4286fc14
Author: Andreas Schneider 
Date:   Wed May 18 12:10:42 2011 +0200

s3-epmapper: Fixed endpoint registration.

Autobuild-User: Andreas Schneider 
Autobuild-Date: Fri May 20 12:03:18 CEST 2011 on sn-devel-104
(cherry picked from commit 7ab9e26b601e4e51736ce6eace46e6588fa1148f)

Fix bug #8155 (Registering only named pipes on EPM for a service doesn't 
work).

---

Summary of changes:
 source3/rpc_server/rpc_ep_setup.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_server/rpc_ep_setup.c 
b/source3/rpc_server/rpc_ep_setup.c
index d00b351..2d4c7e9 100644
--- a/source3/rpc_server/rpc_ep_setup.c
+++ b/source3/rpc_server/rpc_ep_setup.c
@@ -133,7 +133,7 @@ static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX 
*mem_ctx,
  struct tevent_context *ev_ctx,
  struct messaging_context *msg_ctx,
  const struct ndr_interface_table 
*iface,
- const char *name,
+ const char *ncalrpc,
  uint16_t port,
  struct dcerpc_binding_handle **pbh);
 
@@ -256,7 +256,7 @@ static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX 
*mem_ctx,
  struct tevent_context *ev_ctx,
  struct messaging_context *msg_ctx,
  const struct ndr_interface_table 
*iface,
- const char *name,
+ const char *ncalrpc,
  uint16_t port,
  struct dcerpc_binding_handle **pbh)
 {
@@ -266,7 +266,7 @@ static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX 
*mem_ctx,
status = dcerpc_binding_vector_create(mem_ctx,
  iface,
  port,
- name,
+ ncalrpc,
  &v);
if (!NT_STATUS_IS_OK(status)) {
return status;
@@ -276,7 +276,7 @@ static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX 
*mem_ctx,
iface,
v,
&iface->syntax_id.uuid,
-   name,
+   iface->name,
pbh);
talloc_free(v);
if (!NT_STATUS_IS_OK(status)) {


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-6-test updated

2011-05-20 Thread Karolin Seeger
The branch, v3-6-test has been updated
   via  9231770 Make protocol version 2 the default protocol, and only run 
on version 1 if V1 is explcitly given as a module option.
  from  aba30a8 s3-epmapper: Fixed endpoint registration.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -
commit 9231770df9189701da7020c77ebd672942f25773
Author: Holger Hetterich 
Date:   Wed May 18 15:24:23 2011 +0200

Make protocol version 2 the default protocol, and only run on version 1 if 
V1 is explcitly given as a module option.

I haven't received a single line of feedback on protocol v1
for at least 1 1/2 years, whereas protocol v2 has an active
userbase and more people developing around it.

This patch includes a manpage update, describing the new
version handling, as well as documenting the recent changes
making the module transfer the IP address of the client machine
as submitted with
464c69609aa7e582f484c1d357b7c6d3eb2bcbe3.

Bug #8148 (Default to protocol version 2 for SMB Traffic Analyzer in Samba
3.6.0).

---

Summary of changes:
 docs-xml/manpages-3/vfs_smb_traffic_analyzer.8.xml |   10 ++
 source3/modules/vfs_smb_traffic_analyzer.c |   11 +--
 2 files changed, 11 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/vfs_smb_traffic_analyzer.8.xml 
b/docs-xml/manpages-3/vfs_smb_traffic_analyzer.8.xml
index 882ee6a..9450703 100644
--- a/docs-xml/manpages-3/vfs_smb_traffic_analyzer.8.xml
+++ b/docs-xml/manpages-3/vfs_smb_traffic_analyzer.8.xml
@@ -45,6 +45,8 @@
protocol, supporting only a small list of VFS operations, and had
several drawbacks. The protocol version 2 is a try to solve the
problems version 1 had while at the same time adding new features.
+   With the release of Samba 3.6.0, the module will run protocol version 2
+   by default.

 
 
@@ -77,6 +79,7 @@
SHARE - the name of the share on 
which the VFS operation occured
FILENAME - the name of the file that 
was used by the VFS operation
TIMESTAMP - a timestamp, formatted 
as "-mm-dd hh-mm-ss.ms" indicating when the VFS operation 
occured
+   IP - The IP Address (v4 or v6) of 
the client machine that initiated the VFS operation.

 

@@ -224,9 +227,9 @@

smb_traffic_analyzer:protocol_version = STRING

-   If STRING matches to V1 or is not given at all, the module
-   will use version 1 of the protocol. If STRING matches to "V2"
-   the module will use version 2 of the protocol.
+   If STRING matches to V1, the module will use version 1 of 
the
+   protocol. If STRING is not given, the module will use version 2 
of the
+   protocol, which is the default.



@@ -241,7 +244,6 @@

/data/example
smb_traffic_analyzer
-   V2
examplehost
3491

diff --git a/source3/modules/vfs_smb_traffic_analyzer.c 
b/source3/modules/vfs_smb_traffic_analyzer.c
index e8aa385..e441f9c 100644
--- a/source3/modules/vfs_smb_traffic_analyzer.c
+++ b/source3/modules/vfs_smb_traffic_analyzer.c
@@ -452,7 +452,7 @@ static void 
smb_traffic_analyzer_send_data(vfs_handle_struct *handle,
"protocol_version", NULL );
 
 
-   if ( protocol_version == NULL || strcmp( protocol_version,"V1") == 0) {
+   if (protocol_version != NULL && strcmp(protocol_version,"V1") == 0) {
 
struct rw_data *s_data = (struct rw_data *) data;
 
@@ -489,7 +489,10 @@ static void 
smb_traffic_analyzer_send_data(vfs_handle_struct *handle,
return;
}
 
-   } else if ( strcmp( protocol_version, "V2") == 0) {
+   } else {
+   /**
+* Protocol 2 is used by default.
+*/
 
switch( vfs_operation ) {
case vfs_id_open: ;
@@ -557,10 +560,6 @@ static void 
smb_traffic_analyzer_send_data(vfs_handle_struct *handle,
return;
}
 
-   } else {
-   DEBUG(1, ("smb_traffic_analyzer_send_data_socket: "
-   "error, unknown protocol given!\n"));
-   return;
}
 
if (!str) {


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Jeremy Allison
The branch, master has been updated
   via  9f14d10 Fix bug #8157 - std_pcap_cache_reload() fails to parse a 
cups printcap file correctly.
  from  95a55e2 Fix bug 8133 - strange behavior for the file (whose 
filename first character is period ) in SMB2 case.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 9f14d10366e291ef635c80f55c095b5c34b6dd73
Author: Jeremy Allison 
Date:   Fri May 20 12:27:02 2011 -0700

Fix bug #8157 - std_pcap_cache_reload() fails to parse a cups printcap file 
correctly.

The parsing code made some strange assumptions about what is a printer
name, and what is a comment.

Autobuild-User: Jeremy Allison 
Autobuild-Date: Fri May 20 22:52:23 CEST 2011 on sn-devel-104

---

Summary of changes:
 source3/printing/print_standard.c |   13 +
 1 files changed, 5 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/printing/print_standard.c 
b/source3/printing/print_standard.c
index 6a86d84..c4f9c5b 100644
--- a/source3/printing/print_standard.c
+++ b/source3/printing/print_standard.c
@@ -93,6 +93,10 @@ bool std_pcap_cache_reload(const char *pcap_name)
 
has_punctuation = (strchr_m(p, ' ') ||
   strchr_m(p, '\t') ||
+  strchr_m(p, '"') ||
+  strchr_m(p, '\'') ||
+  strchr_m(p, ';') ||
+  strchr_m(p, ',') ||
   strchr_m(p, '(') ||
   strchr_m(p, ')'));
 
@@ -101,11 +105,7 @@ bool std_pcap_cache_reload(const char *pcap_name)
continue;
}
 
-   if (strlen(p) <= MAXPRINTERLEN &&
-   strlen(p) > strlen(name) && !has_punctuation) {
-   if (!*comment) {
-   strlcpy(comment, name, sizeof(comment));
-   }
+   if (strlen(p) <= MAXPRINTERLEN && *name == '\0' && 
!has_punctuation) {
strlcpy(name, p, sizeof(name));
continue;
}
@@ -117,9 +117,6 @@ bool std_pcap_cache_reload(const char *pcap_name)
}
}
 
-   comment[60] = 0;
-   name[MAXPRINTERLEN] = 0;
-
if (*name && !pcap_cache_add(name, comment, NULL)) {
x_fclose(pcap_file);
return false;


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2011-05-20 Thread Jeremy Allison
The branch, master has been updated
   via  4360c5b Patch for bug #8156 - net ads join fails to use the user's 
kerberos ticket.
   via  e0b2f6b The "workgroup" parameter is not used at all in 
cli_session_setup_kerberos(). Remove it.
  from  9f14d10 Fix bug #8157 - std_pcap_cache_reload() fails to parse a 
cups printcap file correctly.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 4360c5bf276aa958864254ee22b3a3d4a4560381
Author: Jeremy Allison 
Date:   Fri May 20 14:43:50 2011 -0700

Patch for bug #8156 - net ads join fails to use the user's kerberos ticket.

If kerberos_get_realm_from_hostname() or 
kerberos_get_default_realm_from_ccache() fails due to
 a misconfigured krb5.conf, try the "realm =" from smb.conf as a fallcback 
before going back to
 NTLMSSP (which we'll do anyway).

Autobuild-User: Jeremy Allison 
Autobuild-Date: Sat May 21 00:58:09 CEST 2011 on sn-devel-104

commit e0b2f6bd267e19986d31275ff3bf88600eaaeaf3
Author: Jeremy Allison 
Date:   Fri May 20 14:34:18 2011 -0700

The "workgroup" parameter is not used at all in 
cli_session_setup_kerberos(). Remove it.

---

Summary of changes:
 source3/libsmb/cliconnect.c |   48 +++---
 1 files changed, 31 insertions(+), 17 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 374dd97..69d5ce6 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -1412,7 +1412,7 @@ static void cli_session_setup_kerberos_done(struct 
tevent_req *subreq);
 
 static struct tevent_req *cli_session_setup_kerberos_send(
TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
-   const char *principal, const char *workgroup)
+   const char *principal)
 {
struct tevent_req *req, *subreq;
struct cli_session_setup_kerberos_state *state;
@@ -1500,8 +1500,7 @@ static ADS_STATUS cli_session_setup_kerberos_recv(struct 
tevent_req *req)
 }
 
 static ADS_STATUS cli_session_setup_kerberos(struct cli_state *cli,
-const char *principal,
-const char *workgroup)
+const char *principal)
 {
struct tevent_context *ev;
struct tevent_req *req;
@@ -1514,8 +1513,7 @@ static ADS_STATUS cli_session_setup_kerberos(struct 
cli_state *cli,
if (ev == NULL) {
goto fail;
}
-   req = cli_session_setup_kerberos_send(ev, ev, cli, principal,
- workgroup);
+   req = cli_session_setup_kerberos_send(ev, ev, cli, principal);
if (req == NULL) {
goto fail;
}
@@ -1873,6 +1871,9 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state 
*cli, const char *user,
host = strchr_m(cli->desthost, '.');
if (dest_realm) {
realm = SMB_STRDUP(dest_realm);
+   if (!realm) {
+   return 
ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
+   }
strupper_m(realm);
} else {
if (host) {
@@ -1884,25 +1885,38 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state 
*cli, const char *user,
}
}
 
-   if (realm && *realm) {
-   principal = talloc_asprintf(talloc_tos(),
-   "cifs/%s@%s",
-   cli->desthost,
-   realm);
-   if (!principal) {
-   SAFE_FREE(realm);
+   if (realm == NULL || *realm == '\0') {
+   realm = SMB_STRDUP(lp_realm());
+   if (!realm) {
return 
ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
}
-   DEBUG(3,("cli_session_setup_spnego: guessed "
-   "server principal=%s\n",
-   principal ? principal : ""));
+   strupper_m(realm);
+   DEBUG(3,("cli_session_setup_spnego: cannot "
+   "get realm from dest_realm %s, "
+   "desthost %s. Using default "
+   "smb.conf realm %s\n",
+   dest_re