samba.git
13 years agos3-krb5 Fix Kerberos on FreeBSD with Samba4 DCs
Andrew Bartlett [Sat, 11 Sep 2010 06:13:33 +0000 (16:13 +1000)]
s3-krb5 Fix Kerberos on FreeBSD with Samba4 DCs

The idea of this patch is: Don't support a mix of different kerberos
features.

Either we should prepare a GSSAPI (8003) checksum and mark the request as
such, or we should use the old behaviour (a normal kerberos checksum of 0 data).

Sending the GSSAPI checksum data, but without marking it as GSSAPI broke
Samba4, and seems well outside the expected behaviour, even if Windows accepts it.

Andrew Bartlett
(cherry picked from commit 3b4db34011f06fb785153fa9070fb1da9d8f5c78)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
13 years agos3: Fix a memleak in receive_getdc_response
Volker Lendecke [Sun, 2 Jan 2011 06:42:57 +0000 (07:42 +0100)]
s3: Fix a memleak in receive_getdc_response

The last 2 patches addresbug #7879 (Memory problems in winbind).

13 years agoFix a valgrind error
Volker Lendecke [Sun, 2 Jan 2011 01:48:03 +0000 (02:48 +0100)]
Fix a valgrind error

Thanks to Tridge for the hint.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Jan  2 10:58:51 CET 2011 on sn-devel-104

13 years agos3: Fix bug 7066 -- wbcAuthenticateEx gives unix times
Volker Lendecke [Sat, 18 Dec 2010 15:02:09 +0000 (16:02 +0100)]
s3: Fix bug 7066 -- wbcAuthenticateEx gives unix times

We might eventually want to change this, but right now we get unix times
out of the winbind pipe struct

13 years agos3: Fix another aspect of bug 7262
Volker Lendecke [Tue, 6 Jul 2010 14:55:14 +0000 (16:55 +0200)]
s3: Fix another aspect of bug 7262

(Unable to maintain users' groups via UsrMgr)

13 years agoѕ3/configue: set Tru64 cc's PIC switch right (none)
Björn Jacke [Fri, 26 Nov 2010 00:32:53 +0000 (01:32 +0100)]
ѕ3/configue: set Tru64 cc's PIC switch right (none)

-fPIC made shared library builds fail there

Fixes #7821

(cherry picked from commit dbcf73c45782c310cb7ff1f2177d410399e2f06d)

13 years agos3:winbind: fix bug #7894 - sporadic winbind panic in rpc query_user_list
Michael Adam [Thu, 30 Dec 2010 10:12:42 +0000 (11:12 +0100)]
s3:winbind: fix bug #7894 - sporadic winbind panic in rpc query_user_list

correctly evaluate return code of rpccli_samr_QueryDisplayInfo()
before accessing results.

13 years agoFix bug #7892 - open_file_fchmod() leaves a stale lock.
Jeremy Allison [Wed, 29 Dec 2010 01:24:27 +0000 (17:24 -0800)]
Fix bug #7892 - open_file_fchmod() leaves a stale lock.

13 years agos3: Use smbsock_any_connect in winbind
Volker Lendecke [Tue, 21 Dec 2010 20:55:01 +0000 (21:55 +0100)]
s3: Use smbsock_any_connect in winbind

The last 7 patches address bug #7881 (winbind flaky against w2k8).

13 years agos3: Retry *SMBSERVER in nb_connect
Volker Lendecke [Tue, 21 Dec 2010 17:52:53 +0000 (18:52 +0100)]
s3: Retry *SMBSERVER in nb_connect

13 years agos3: Add smbsock_any_connect
Volker Lendecke [Mon, 13 Dec 2010 16:17:51 +0000 (17:17 +0100)]
s3: Add smbsock_any_connect

13 years agos3: Add an async smbsock_connect
Volker Lendecke [Sun, 12 Dec 2010 17:55:06 +0000 (18:55 +0100)]
s3: Add an async smbsock_connect

This connects to 445 and after 5 milliseconds also to 139. It treats a netbios
session setup failure as equivalent as a TCP connect failure. So if 139 is
faster but fails the nb session setup, the 445 still has the chance to succeed.

13 years agov3-5-test: Pull in tevent_req_poll_ntstatus from master
Volker Lendecke [Wed, 22 Dec 2010 14:21:27 +0000 (15:21 +0100)]
v3-5-test: Pull in tevent_req_poll_ntstatus from master

13 years agos3: Add async cli_session_request
Volker Lendecke [Sun, 12 Dec 2010 17:54:31 +0000 (18:54 +0100)]
s3: Add async cli_session_request

This does not do the redirects, but I think that might be obsolete anyway

13 years agos3: Add some const to name_mangle()
Volker Lendecke [Sun, 12 Dec 2010 17:53:49 +0000 (18:53 +0100)]
s3: Add some const to name_mangle()

13 years agos3:net ads dns register: use "cluster addresses" option if configured (bug #7871)
Stefan Metzmacher [Thu, 16 Dec 2010 11:07:24 +0000 (12:07 +0100)]
s3:net ads dns register: use "cluster addresses" option if configured (bug #7871)

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Dec 17 16:49:14 CET 2010 on sn-devel-104
(cherry picked from commit 1dc2fa7616207a2d3a9f1cbe69b2ec1fc61634fd)
(cherry picked from commit 9a40e5f6a500571cc752383ca7fa27347e4efa45)

13 years agos3:net ads dns register: add support for specifying addresse on the commandline ...
Michael Adam [Thu, 16 Dec 2010 00:49:14 +0000 (01:49 +0100)]
s3:net ads dns register: add support for specifying addresse on the commandline (bug #7871)

In the clustering case, this is also made the only possiblity to do dns updates,
since the list addresses on the local interfaces is not suitable in that case.

This fixes the "net ads dns register" part of bug #7871.
It might be extended by a parsing of the "cluster addresses" setting.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 5e83a05009787d8a2086db1adc1ed58d61b3725d)
(cherry picked from commit 9ed3d33fb3d7365a127ea2752032840272697902)

13 years agos3:net: add net_update_dns_ext() that accepts a list of addresses as parameter (bug...
Michael Adam [Wed, 15 Dec 2010 23:52:41 +0000 (00:52 +0100)]
s3:net: add net_update_dns_ext() that accepts a list of addresses as parameter (bug# 7871)

This generalized form of net_update_dns() will be used to
add support for specifying a list of addresses on the commandline
of "net ads dns register".

This prepares the "net ads dns register" part of the fix for bug #7871.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 4d91f98b433e07922373bf4e3ba9668b7af71a00)
(cherry picked from commit 4b7775500b1055acf62decbc0fc8283b088da452)

13 years agos3:net: disable dynamic dns updates at the end of "net ads join" in a cluster (bug...
Michael Adam [Wed, 1 Dec 2010 23:42:21 +0000 (00:42 +0100)]
s3:net: disable dynamic dns updates at the end of "net ads join" in a cluster (bug #7871)

In a clustered environment, registering the set of ip addresses that are
assigned to the interfaces of the node that performs the join does usually
not have the desired effect, since the local interfaces do not carry
complete set of the cluster's public IP addresses.  And it can also contain
internal addresses that should not be visible to the outside at all.
In order to do dns updates in a clustererd setup, use net ads dns register.

This fixes the net ads join part of bug #7871.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit b8f19df53e66bf0260b4ae6c49acea87ac379deb)
(cherry picked from commit 1c73d52ddddfcec25cf079da4a0d6bf81fb030da)

13 years agos3-net Allow 'net ads dns register' to take an optional hostname argument
Andrew Bartlett [Fri, 10 Dec 2010 04:08:53 +0000 (15:08 +1100)]
s3-net Allow 'net ads dns register' to take an optional hostname argument

This allows the administrator to more carefully chose what name to register.

Andrew Bartlett
(cherry picked from commit c2a1ad9047508cf2745a9019e6783c8b8f7ef475)
(cherry picked from commit 10c5a59315ef69eeb4d8bc19237de9787284a63d)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
13 years agos3:ntlm_auth: support clients which offer a spnego mechs we don't support (bug #7855)
Stefan Metzmacher [Wed, 1 Dec 2010 23:39:23 +0000 (00:39 +0100)]
s3:ntlm_auth: support clients which offer a spnego mechs we don't support (bug #7855)

Before we rejected the authentication if we don't support the
first spnego mech the client offered.

We now negotiate the first mech we support.

This fix works arround problems, when a client
sends the NEGOEX (1.3.6.1.4.1.311.2.2.30) oid,
which we don't support.

metze
(cherry picked from commit f802075f08fe0d86f3d176f2302236aeb5834f3d)
Modified to work in the v3-5-test branch, e.g. use ntlmssp_end()

The last 9 patches address bug #7855 (ntlm_auth only handles the first spnego
mech).

13 years agos3:ntlm_auth: free session key, as we don't use it (at least for now)
Stefan Metzmacher [Wed, 1 Dec 2010 04:59:16 +0000 (05:59 +0100)]
s3:ntlm_auth: free session key, as we don't use it (at least for now)

metze
(cherry picked from commit ee4f5ac6182969bcab91955e6d6581e408d222f1)

13 years agos3:ntlm_auth: fix memory leak in the raw ntlmssp code path
Stefan Metzmacher [Wed, 1 Dec 2010 04:50:59 +0000 (05:50 +0100)]
s3:ntlm_auth: fix memory leak in the raw ntlmssp code path

metze
(cherry picked from commit 9a56ade6b1d627126418c75de4602610b4482503)

13 years agos3: Correctly unwrap the krb ticket in gss-spnego (cherry picked from commit 547b268c...
Stefan Metzmacher [Tue, 30 Nov 2010 09:52:52 +0000 (10:52 +0100)]
s3: Correctly unwrap the krb ticket in gss-spnego (cherry picked from commit 547b268cfaa2e791bf92e8804bfa504c4e37050b)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
renamed to _spnego_parse_krb5_wrap()

metze

13 years agos3: Fall back to raw NTLMSSP for the gss-spnego protocol
Volker Lendecke [Thu, 16 Sep 2010 08:22:00 +0000 (10:22 +0200)]
s3: Fall back to raw NTLMSSP for the gss-spnego protocol

This is to handle the mod_auth_ntlm_winbind protocol
sending "Negotiate" to IE, which sends raw NTLMSSP
instead of a SPNEGO wrapped NTLMSSP blob.
(cherry picked from commit 70ab7eb5303a5ff058939541dd5bc1f81113a48e)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
13 years agos3: Split off output generation from manage_squid_ntlmssp_request (cherry picked...
Stefan Metzmacher [Tue, 30 Nov 2010 09:46:28 +0000 (10:46 +0100)]
s3: Split off output generation from manage_squid_ntlmssp_request (cherry picked from commit de2c143f4d540f695db5c7fe8685614c03977365)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
13 years agos3: Wrap the ntlm_auth loop with a talloc_stackframe (cherry picked from commit ae483...
Volker Lendecke [Thu, 16 Sep 2010 08:36:21 +0000 (10:36 +0200)]
s3: Wrap the ntlm_auth loop with a talloc_stackframe (cherry picked from commit ae483bbe9af526623189cefe7735f3f2813da6d7)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
13 years agos3: Fix some debug msgs in ntlm_auth (cherry picked from commit 6400f3ee62108e3dd1e6c...
Volker Lendecke [Wed, 15 Sep 2010 08:29:44 +0000 (10:29 +0200)]
s3: Fix some debug msgs in ntlm_auth (cherry picked from commit 6400f3ee62108e3dd1e6c1013ccea9fb4b08d562)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
13 years agontlm_auth: Fix a valgrind error (cherry picked from commit 69db4b4ccf051b05517e6eb903...
Volker Lendecke [Mon, 13 Sep 2010 16:09:20 +0000 (18:09 +0200)]
ntlm_auth: Fix a valgrind error (cherry picked from commit 69db4b4ccf051b05517e6eb9039ab48f90608075)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
13 years agoFix bso#3185, return false when EOF is encountered in param name.
Holger Hetterich [Sat, 4 Dec 2010 17:18:50 +0000 (18:18 +0100)]
Fix bso#3185, return false when EOF is encountered in param name.

13 years agos3: Fix bug 7843: Expand the local SAMs aliases
Jeremy Allison [Sun, 5 Dec 2010 19:40:21 +0000 (20:40 +0100)]
s3: Fix bug 7843: Expand the local SAMs aliases

13 years agos3: Fix bug 7842: WINBINDD_LOOKUPRIDS does not return the domain name
Volker Lendecke [Sat, 4 Dec 2010 19:34:05 +0000 (20:34 +0100)]
s3: Fix bug 7842: WINBINDD_LOOKUPRIDS does not return the domain name

13 years agos3: Fix bug 7841: WINBINDD_LOOKUPRIDS asks the wrong domain
Volker Lendecke [Sat, 4 Dec 2010 19:31:36 +0000 (20:31 +0100)]
s3: Fix bug 7841: WINBINDD_LOOKUPRIDS asks the wrong domain

13 years agoFix bug #7835 - vfs_fill_sparse() doesn't use posix_fallocate when strict allocate...
Jeremy Allison [Thu, 2 Dec 2010 23:27:17 +0000 (15:27 -0800)]
Fix bug #7835 - vfs_fill_sparse() doesn't use posix_fallocate when strict allocate is on

Tries posix_fallocate() and then falls back to old code.

Jeremy.

13 years agos3: Fix "force group" with ntlmssp guest session setup
Volker Lendecke [Sat, 13 Nov 2010 17:03:25 +0000 (18:03 +0100)]
s3: Fix "force group" with ntlmssp guest session setup

This one is subtle: Set "force group = <somegroup>" together with "guest ok =
yes". Then try "smbclient //server/share -U%". Works. Then try to connect to
the same share from Windows 2003 using an anonymous connection. Breaks with

make_connection: connection to share denied due to security descriptor

although the share_info.tdb is empty. I've seen reports of this on the lists,
but I could never ever nail it until a customer gave me access to such a box.

What happens? With an empty share_info.tdb we create a security descriptor
allow everything to the world. The problem with the above parameter combination
is that S-1-1-0 (World) is lost in the token. When you look at the callers of
create_local_token, they are only called if the preceding check_ntlm_password
did not create server_info->ptok. Not so with the one in auth_ntlmssp.c. So, if
we get a NTLMSSP session setup with user="", domain="", pass="" we call
create_local_token even though check_guest_security() via
make_server_info_guest() has already correctly done so. In this case
create_local_token puts S-1-1-0 into user_sids[1], which is supposed to be the
primary group sid of the user logging in. "force group" then overwrites this ->
the world is gone -> "denied due to security descriptor".

Why don't you see it with smbclient -U% (anonymous connection)? smbclient does
not use ntlmssp for anon session setup.

This seems not to happen to 3.6.

Volker

Fix bug #7817 ("force group" broken).

13 years agos3: Make winbind recover from a signing error
Volker Lendecke [Thu, 18 Nov 2010 12:28:47 +0000 (13:28 +0100)]
s3: Make winbind recover from a signing error

When winbind sees a signing error on the smb connection to a DC (for whatever
reason, our bug, network glitch, etc) it should recover properly. The "old"
code in clientgen.c just closed the socket in this case. This is the right
thing to do, this connection is spoiled anyway. The new, async code did not do
this so far, which led to the code in winbindd_cm.c not detect that we need to
reconnect.

Fix bug #7800 (winbind does not recover from smb signing errors).

13 years agoswitch from mtime to ctime which is more reliable if files can be accessed outside...
olivier [Wed, 10 Nov 2010 16:48:06 +0000 (17:48 +0100)]
switch from mtime to ctime which is more reliable if files can be accessed outside samba as well

Fix bug #7789 (change vfs_scannedonly from mtime to ctime).

13 years agoFix bug #7812 - vfs_acl_xattr/vfs_acl_tdb: ACL inheritance cannot be disabled
Jeremy Allison [Tue, 23 Nov 2010 22:21:25 +0000 (14:21 -0800)]
Fix bug #7812 - vfs_acl_xattr/vfs_acl_tdb: ACL inheritance cannot be disabled

We were losing the incoming security descriptor revision number and
most importantly the "type" field as sent by the client. Ensure we
correctly store these in the xattr object.

Jeremy.

13 years agoFix our privileges code to display privileges with the "high" 32-bit value set.
Jeremy Allison [Wed, 17 Nov 2010 23:58:15 +0000 (15:58 -0800)]
Fix our privileges code to display privileges with the "high" 32-bit value set.

SeSecurityPrivilege is the first LUID we have added that has a non-zero
"high" value, ensure our LUID code correctly supports it.

Jeremy.

The last 14 patches address bug #7716 (acl_xattr and acl_tdb modules don't store
unmodified copies of security descriptors).

13 years agoAdd SeSecurityPrivilige.
Jeremy Allison [Fri, 19 Nov 2010 00:13:28 +0000 (16:13 -0800)]
Add SeSecurityPrivilige.

Jeremy.

13 years agoEnsure we have correct parameters to use Windows ACL modules.
Jeremy Allison [Fri, 22 Oct 2010 23:14:28 +0000 (16:14 -0700)]
Ensure we have correct parameters to use Windows ACL modules.

13 years agoAdd acl_xattr:ignore system acls boolean (normally false) to allow Samba ACL module...
Jeremy Allison [Sat, 23 Oct 2010 00:28:58 +0000 (17:28 -0700)]
Add acl_xattr:ignore system acls boolean (normally false) to allow Samba ACL module to ignore mapping to lower POSIX layer. With this fix Samba 3.6.x now passes RAW-ACLs (with certain smb.conf parameters set).

Jeremy.

13 years agoAdd make_default_filesystem_acl() function to be used in following change to acl_xatt...
Jeremy Allison [Fri, 22 Oct 2010 23:04:53 +0000 (16:04 -0700)]
Add make_default_filesystem_acl() function to be used in following change to acl_xattr and acl_tdb module.

13 years agoFix handling of "NULL" DACL. Map to u/g/w - rwx.
Jeremy Allison [Fri, 22 Oct 2010 22:56:31 +0000 (15:56 -0700)]
Fix handling of "NULL" DACL. Map to u/g/w - rwx.

13 years agoFix "force unknown ACL user" to strip out foreign SIDs from POSIX ACLs if they can...
Jeremy Allison [Sat, 23 Oct 2010 00:23:13 +0000 (17:23 -0700)]
Fix "force unknown ACL user" to strip out foreign SIDs from POSIX ACLs if they can't be mapped.

13 years agoAdd debug message to get_nt_acl_internal() to see what we got.
Jeremy Allison [Fri, 22 Oct 2010 21:55:52 +0000 (14:55 -0700)]
Add debug message to get_nt_acl_internal() to see what we got.

13 years agoFix valgrind "uninitialized read" error on "info" when returning !NT_STATUS_OK.
Jeremy Allison [Fri, 22 Oct 2010 21:54:19 +0000 (14:54 -0700)]
Fix valgrind "uninitialized read" error on "info" when returning !NT_STATUS_OK.

13 years agoFix bug #7734 - When creating files with "inherit ACLs" set to true, we neglect to...
Jeremy Allison [Fri, 15 Oct 2010 21:12:04 +0000 (14:12 -0700)]
Fix bug #7734 - When creating files with "inherit ACLs" set to true, we neglect to apply appropriate create masks.

Jeremy.
(cherry picked from commit 8cad5e23b6e2440a566def6fb138d484e3b47643)

13 years agoFix bug #7733 - Invalid client DOS attributes on create can cause incorrect unix...
Jeremy Allison [Fri, 15 Oct 2010 20:30:07 +0000 (13:30 -0700)]
Fix bug #7733 - Invalid client DOS attributes on create can cause incorrect unix mode_t to be generated.

It turns out a client can send an NTCreateX call for a new file, but specify
FILE_ATTRIBUTE_DIRECTORY in the attribute list. Windows silently strips this,
but we don't - causing the unix_mode() function to go through the "mode bits
for new directory" codepath, instead of the "mode bits for new file" codepath.

Jeremy.
(cherry picked from commit 92adb686372a9b67e47efb5b051bc351212f1780)

13 years agoMake the vfs_acl_xattr and other modules work with NULL SD's. Fix the "protected...
Jeremy Allison [Sat, 23 Oct 2010 00:18:45 +0000 (17:18 -0700)]
Make the vfs_acl_xattr and other modules work with NULL SD's. Fix the "protected" inheritance problem (bleeding up from the POSIX layer).

Jeremy

13 years agoCanonicalize incoming and outgoing ACLs.
Jeremy Allison [Sat, 23 Oct 2010 00:11:17 +0000 (17:11 -0700)]
Canonicalize incoming and outgoing ACLs.

Jeremy.

13 years agoMake the posix ACL module cope with a NULL incoming DACL and a missing owner/group.
Jeremy Allison [Sat, 23 Oct 2010 00:07:10 +0000 (17:07 -0700)]
Make the posix ACL module cope with a NULL incoming DACL and a missing owner/group.

Jeremy.

13 years agoFix bug #7785 - atime limit.
Jeremy Allison [Tue, 23 Nov 2010 19:16:31 +0000 (11:16 -0800)]
Fix bug #7785 - atime limit.

On a 64-bit time_t system make MAX_TIME_T the max value that
can be represented in a struct tm. This allows applications to
set times in the future beyond the 32-bit time_t limit (2037).

This is only in source3/configure.in, needs adding to the waf
configure/build system (but I'll need help with that).

Jeremy.

13 years agos3-docs: Update 3.2 features.
Samba-JP oota [Tue, 23 Nov 2010 16:06:48 +0000 (17:06 +0100)]
s3-docs: Update 3.2 features.
(cherry picked from commit aa54713615c5d0367528733ff2c3a5650eed96f7)

13 years agoFix bug #7791 - gvfsd-smb (Gnome vfs) fails to copy files from a SMB share using...
Jeremy Allison [Thu, 11 Nov 2010 17:44:21 +0000 (09:44 -0800)]
Fix bug #7791 - gvfsd-smb (Gnome vfs) fails to copy files from a SMB share using SMB signing.

The underlying problem is that the old code invoked by cli_write() increments
cli->mid directly when issuing outstanding writes. This should now be done only
in libsmb/clientgen.c to make metze's new signing engine works correctly. Just
deleting this code fixes the problem.

Jeremy.

13 years agoSecond part of fix for bug #7777 - When requesting lookups for BUILTIN sids, winbindd...
Jeremy Allison [Fri, 5 Nov 2010 19:13:38 +0000 (12:13 -0700)]
Second part of fix for bug #7777 - When requesting lookups for BUILTIN sids, winbindd allocates new uids/gids in error.

Ensure we return after calling passdb for SID lookups for which we are
authoritative.

Jeremy.

13 years agoFirst part of fix for bug #7777 - When requesting lookups for BUILTIN sids, winbindd...
Jeremy Allison [Fri, 5 Nov 2010 19:11:53 +0000 (12:11 -0700)]
First part of fix for bug #7777 - When requesting lookups for BUILTIN sids, winbindd allocates new uids/gids in error.

Ensure idmap_init_passdb_domain() correctly initialized the default
domain first.

Jeremy.

13 years agos3: Fix bug 7779, crash in expand_msdfs
Volker Lendecke [Sat, 6 Nov 2010 20:18:35 +0000 (21:18 +0100)]
s3: Fix bug 7779, crash in expand_msdfs

13 years agos3: Fix a getgrent crash with many groups
Volker Lendecke [Wed, 3 Nov 2010 12:08:37 +0000 (13:08 +0100)]
s3: Fix a getgrent crash with many groups

Fix bug #7774.

13 years agoFix bug #7744 - "dfree cache time" doesn't work.
Jeremy Allison [Wed, 20 Oct 2010 20:58:15 +0000 (13:58 -0700)]
Fix bug #7744 - "dfree cache time" doesn't work.

There is a bug in processing the dfree cache time, which is associated with the
smbd idle timer. The idle timer call conn_idle_all(), which updates the
conn->lastused timestamp. The dfree cache time code in smbd/dfree.c depends on
conn->lastused being up to date to refresh the cached dfree value.

Unfortunately the conn_idle_all() returns early if any of the connection
structs is not idle, never updating any further conn->lastused timestamps. If
(as is common due to an IPC$ connection) there are more than one used
connection struct, then the conn->lastused timestamps after the IPC$ connection
in the connection list will never be updated.

Ensure we always update conn->lastused for all connections when calling
conn_idle_all().

Jeremy.

13 years agoFix bug #7743 - Inconsistent use of system name lookup can cause a domain joined...
Jeremy Allison [Wed, 20 Oct 2010 18:22:57 +0000 (11:22 -0700)]
Fix bug #7743 - Inconsistent use of system name lookup can cause a domain joined machine to fail to find users.

Ensure all username lookups go through Get_Pwnam_alloc(), which is the
correct wrapper function. We were using it *some* of the time anyway,
so this just makes us properly consistent.

Jeremy.

13 years agos3: Fix bug 7730 -- crash in winbindd_dsgetdcname.c
Volker Lendecke [Fri, 15 Oct 2010 14:37:47 +0000 (16:37 +0200)]
s3: Fix bug 7730 -- crash in winbindd_dsgetdcname.c

13 years agoFix bug 7716 - acl_xattr and acl_tdb modules don't store unmodified copies of securit...
Jeremy Allison [Thu, 7 Oct 2010 21:26:13 +0000 (14:26 -0700)]
Fix bug 7716 - acl_xattr and acl_tdb modules don't store unmodified copies of security descriptors.

As pointed out by an OEM, the code within smbd/posix_acl.c, even though passed
a const pointer to a security descriptor, still modifies the ACE entries within
it (which are not const pointers).

This means ACLs stored in the extended attribute by the acl_xattr module have
already been modified by the POSIX acl layer, and are not the original intent
of storing the "unmodified" ACL from the client.

Use dup_sec_desc to make a copy of the incoming ACL on talloc_tos() - that
is what is then modified inside smbd/posix_acl.c, leaving the original ACL
to be correctly stored in the xattr.

Jeremy.

13 years agos3: Attempt to fix bug 7665
Volker Lendecke [Sat, 2 Oct 2010 09:50:26 +0000 (11:50 +0200)]
s3: Attempt to fix bug 7665

Quite a few of our internal routines put stuff on talloc_tos() these days.
In top-level netapi routines, properly allocate a stackframe and clean it
again. Also, don't leak memory in the rpccli_ callers onto the libnetapi
context.

13 years agos3:librpc/ndr: use new strlen_m_ext_term() in ndr_charset_length(): fix bug #7594
Michael Adam [Sun, 31 Oct 2010 00:04:25 +0000 (02:04 +0200)]
s3:librpc/ndr: use new strlen_m_ext_term() in ndr_charset_length(): fix bug #7594

This fixes the calculation of needed space for destination unicode charset.

The last 4 patches address bug #7594 ("wbinfo -u" and "wbinfo -g" gives no
output (log=>ndr_pull_error)).

13 years agolibrpc/ndr: correctly implement ndr_charset_length()
Stefan Metzmacher [Wed, 25 Aug 2010 08:05:15 +0000 (10:05 +0200)]
librpc/ndr: correctly implement ndr_charset_length()

Before we ignored the charset type.

metze

Signed-off-by: Michael Adam <obnox@samba.org>
13 years agos3:lib/util_str: add strlen_m_ext_term() - variant of strlen_m_ext() counting terminator
Michael Adam [Sun, 31 Oct 2010 00:02:16 +0000 (02:02 +0200)]
s3:lib/util_str: add strlen_m_ext_term() - variant of strlen_m_ext() counting terminator

13 years agos3:lib/util_str: add strlen_m_ext() that takes the dest charset as a parameter.
Michael Adam [Mon, 1 Nov 2010 15:28:43 +0000 (16:28 +0100)]
s3:lib/util_str: add strlen_m_ext() that takes the dest charset as a parameter.

13 years agoFix bug 7409 - Thousands of reduce_name: couldn't get realpath.
Jeremy Allison [Mon, 13 Sep 2010 23:51:59 +0000 (16:51 -0700)]
Fix bug 7409 - Thousands of reduce_name: couldn't get realpath.

Don't log this at level 1 - every EACCES will generate one.
Thanks to muehlfeld@medizinische-genetik.de for pointing this out.

Jeremy.

13 years agoWHATASNEW: Start 3.5.7 release notes.
Karolin Seeger [Fri, 8 Oct 2010 12:36:50 +0000 (14:36 +0200)]
WHATASNEW: Start 3.5.7 release notes.

Karolin

13 years agoVERSION: Bump version number up to 3.5.7.
Karolin Seeger [Fri, 8 Oct 2010 12:35:23 +0000 (14:35 +0200)]
VERSION: Bump version number up to 3.5.7.

Karolin

13 years agoWHATSNEW: Update release notes.
Karolin Seeger [Thu, 7 Oct 2010 16:21:32 +0000 (18:21 +0200)]
WHATSNEW: Update release notes.

Karolin

13 years agos3: Stop using the write cache after an oplock break
Volker Lendecke [Sat, 2 Oct 2010 15:07:00 +0000 (17:07 +0200)]
s3: Stop using the write cache after an oplock break

Fix bug #7715 (Setting Samba Write Cache Size Can Cause File Corruption).

13 years agoFix bug 7694 - Crash bug with invalid SPNEGO token.
Jeremy Allison [Sun, 26 Sep 2010 11:59:31 +0000 (04:59 -0700)]
Fix bug 7694 - Crash bug with invalid SPNEGO token.

Found by the CodeNomicon test suites at the SNIA plugfest.

http://www.codenomicon.com/

If an invalid SPNEGO packet contains no OIDs we crash in the SMB1/SMB2 server
as we indirect the first returned value OIDs[0], which is returned as NULL.

Modified for 3.5.x.

Jeremy.

13 years agoWHATSNEW: Update release notes.
Karolin Seeger [Wed, 6 Oct 2010 19:24:30 +0000 (21:24 +0200)]
WHATSNEW: Update release notes.

Karolin

13 years agoFix bug #7698 - Assert causes smbd to panic on invalid NetBIOS session request.
Jeremy Allison [Sun, 26 Sep 2010 11:49:29 +0000 (04:49 -0700)]
Fix bug #7698 - Assert causes smbd to panic on invalid NetBIOS session request.

Found by the CodeNomicon test suites at the SNIA plugfest.

http://www.codenomicon.com/

If an invalid NetBIOS session request is received the code in name_len() in
libsmb/nmblib.c can hit an assert.

Re-write name_len() and name_extract() to use "buf/len" pairs and
always limit reads.

(Modified for 3.5.x)

Jeremy.

13 years agos3: Fix bug 7470
Volker Lendecke [Sat, 25 Sep 2010 17:56:58 +0000 (10:56 -0700)]
s3: Fix bug 7470

S_IREAD and S_IWRITE are not standard.

Thanks to Joachim Schmitz <schmitz@hp.com> for reporting!

13 years agoWHATSNEW: Update changes since 3.5.5.
Karolin Seeger [Mon, 27 Sep 2010 20:04:27 +0000 (22:04 +0200)]
WHATSNEW: Update changes since 3.5.5.

Karolin

13 years agos3: Fix bug 7688, rpcclient command line completion crashing
Volker Lendecke [Sat, 18 Sep 2010 14:37:04 +0000 (07:37 -0700)]
s3: Fix bug 7688, rpcclient command line completion crashing

We've grown more than 100 rpcclient commands by now, so this would overwrite
the array of 100 completions. There's nicer ways to fix this problem, but 1000
rpcclient commands should be at least a bit away.

13 years agoVERSION: Bump version number up to 3.5.6.
Karolin Seeger [Sat, 25 Sep 2010 13:21:17 +0000 (15:21 +0200)]
VERSION: Bump version number up to 3.5.6.

Karolin

13 years agoWHATSNEW: Prepare release notes for Samba 3.5.6.
Karolin Seeger [Sat, 25 Sep 2010 13:20:26 +0000 (15:20 +0200)]
WHATSNEW: Prepare release notes for Samba 3.5.6.

Karolin

13 years agos3: Remove a global variable in bugfix for bug 7665
Volker Lendecke [Tue, 21 Sep 2010 22:41:23 +0000 (15:41 -0700)]
s3: Remove a global variable in bugfix for bug 7665

13 years agos3-libnetapi: Fix Bug #7665, memory leak in netapi connection manager.
Günther Deschner [Tue, 21 Sep 2010 04:05:37 +0000 (21:05 -0700)]
s3-libnetapi: Fix Bug #7665, memory leak in netapi connection manager.

Guenther
(cherry picked from commit 6f47a24bc55be0ea907594a748774675a105b5e3)

13 years agos3: Fix the charset_pull routine
Volker Lendecke [Mon, 6 Sep 2010 13:13:48 +0000 (15:13 +0200)]
s3: Fix the charset_pull routine

In the push routine we do the SVAL, so we should do the SSVAL here.

Fix bug #7531 (3.5.3 unusable on solaris 10).

13 years agos3: fix build on platforms without st_blocks and st_blksize stat struct members
Björn Jacke [Mon, 7 Jun 2010 21:06:28 +0000 (23:06 +0200)]
s3: fix build on platforms without st_blocks and st_blksize stat struct members

This fixes bug 7474.

13 years agoFix bug #7693 - smbd changing mode of files on rename
Jeremy Allison [Wed, 22 Sep 2010 19:26:13 +0000 (12:26 -0700)]
Fix bug #7693 - smbd changing mode of files on rename

When using "map archive", don't change the archive bit on
renames or writes with UNIX extensions turned on.

Jeremy.

13 years agos3:smbd: Align change notify replies on 4-byte boundary
Chere Zhou [Tue, 6 Jul 2010 00:18:35 +0000 (17:18 -0700)]
s3:smbd: Align change notify replies on 4-byte boundary

MS-CIFS section 2.2.7.4.2 states this is mandatory.  WinXP clients
don't seem to care, but a Win7 client will send an immediate Close()
to the directory handle when receiving an incorrectly aligned
change notify response.

Fix bug #7662 (Change notify replies must be aligned on 4-byte boundary for
Win7.)

13 years agolibwbclient: Fix a fd-leak at dlclose-time
Volker Lendecke [Mon, 10 May 2010 10:05:01 +0000 (12:05 +0200)]
libwbclient: Fix a fd-leak at dlclose-time

__attribute__((destructor)) makes winbind_close_sock() being called at
dlclose() time.

Found while testing apache on Linux with mod_auth_pam.

Other platforms will have to find a different fix. One possibility would be to
always close the socket after each operation, but this badly sucks
performance-wise.

Fix bug #7684 (fd leak in libwbclient.so).

13 years agoFix bug #7669.
Jeremy Allison [Thu, 9 Sep 2010 13:54:23 +0000 (15:54 +0200)]
Fix bug #7669.

Fix bug #7669 (buffer overflow in sid_parse() in Samba3 and dom_sid_parse in
Samba4).

CVE-2010-3069:

===========
Description
===========

All current released versions of Samba are vulnerable to
a buffer overrun vulnerability. The sid_parse() function
(and related dom_sid_parse() function in the source4 code)
do not correctly check their input lengths when reading a
binary representation of a Windows SID (Security ID). This
allows a malicious client to send a sid that can overflow
the stack variable that is being used to store the SID in the
Samba smbd server.

A connection to a file share is needed to exploit this
vulnerability, either authenticated or unauthenticated
(guest connection).
(cherry picked from commit a34c3e999bb1ea61da31c5b3e845b19663039358)

13 years agoWHATSNEW: Start release notes for 3.5.5.
Karolin Seeger [Wed, 15 Sep 2010 18:52:40 +0000 (20:52 +0200)]
WHATSNEW: Start release notes for 3.5.5.

Karolin
(cherry picked from commit 28f6e4144b092bd21f49ca989d36df19ce002231)
(cherry picked from commit 160cbf1d242617409977e87d12f4871625052d4d)

13 years agos3-spoolss: add and use spoolss_printerinfo2_to_setprinterinfo2().
Günther Deschner [Thu, 3 Jun 2010 14:30:55 +0000 (16:30 +0200)]
s3-spoolss: add and use spoolss_printerinfo2_to_setprinterinfo2().

This fixes some invalid typecasts.

Guenther

The last 3 patches address bug #7658 (fix some "dereferencing type-punned
pointer will break strict-aliasing rules" warnings).

13 years agos3-rpcclient: fix two more invalid typecasts in spoolss commands.
Günther Deschner [Mon, 10 May 2010 12:44:30 +0000 (14:44 +0200)]
s3-rpcclient: fix two more invalid typecasts in spoolss commands.

Guenther
(cherry picked from commit 83736066a3f94eaadb422016c9f22cb18bec2cd7)

13 years agos3-net: fix a "dereferencing type-punned pointer will break strict-aliasing rules...
Günther Deschner [Tue, 25 May 2010 10:43:00 +0000 (12:43 +0200)]
s3-net: fix a "dereferencing type-punned pointer will break strict-aliasing rules" warning.

Guenther
(cherry picked from commit f12028a3fd5c64bc8e13996cb9a18a19ec0929e0)

13 years agos3: Cache results of finding printer names
Volker Lendecke [Fri, 27 Aug 2010 12:44:16 +0000 (14:44 +0200)]
s3: Cache results of finding printer names

With hundreds of printers or on a slow machine, this can become expensive.

Problem reported and patch sponsored by DESY, Hamburg (www.desy.de)

Fix bug #7656 (Scalability problem with hundreds of printers).

13 years agoFix bug #7651 - mknod and mkfifo fails with "No such file or directory"
Jeremy Allison [Thu, 26 Aug 2010 23:49:21 +0000 (16:49 -0700)]
Fix bug #7651 - mknod and mkfifo fails with "No such file or directory"

Ensure we check the correct stat struct once we've created the
special fix. Thanks to izh1979@gmail.com for pointing out the
bug.

Jeremy.

13 years agos3-dcerpc: avoid talloc_move on schannel creds in cli_rpc_pipe_open_schannel_with_key().
Günther Deschner [Mon, 23 Aug 2010 14:02:23 +0000 (16:02 +0200)]
s3-dcerpc: avoid talloc_move on schannel creds in cli_rpc_pipe_open_schannel_with_key().

Initially, the schannel creds were talloc memduped, then, during the netlogon
creds client merge (baf7274fed2f1ae7a9e3a57160bf5471566e636c) they were first
talloc_referenced and then later (53765c81f726a8c056cc4e57004592dd489975c9)
talloc_moved.

The issue with using talloc_move here is that users of that function in winbind
will only be able to have two schanneled connections, as the cached schannel
credentials pointer from the netlogon pipe will be set to NULL. Do a deep copy
of the struct instead.

Guenther
(cherry picked from commit 898c6123355a3a11ec17f0396c4cb3018c75c184)

13 years agoFinal part of fix for bug #7636 - winbind internal error, backtrace.
Jeremy Allison [Mon, 23 Aug 2010 20:05:56 +0000 (13:05 -0700)]
Final part of fix for bug #7636 - winbind internal error, backtrace.

Ensure cm_get_schannel_creds() returns NTSTATUS.

Jeremy.
(cherry picked from commit 33060f67be100836d381a74bced351c6579cc58d)

13 years agos3: fall back to cups-config for underlinked libs
Björn Jacke [Thu, 12 Aug 2010 14:18:45 +0000 (16:18 +0200)]
s3: fall back to cups-config for underlinked libs

some OpenBSD systems have underlinked cups libraries. If linking against cups
alone fails, try to link against all the cups-config --libs cruft, which we
usually don't want. (bugzila #7244)
(cherry picked from commit 616e187d68e3e7b202413a96518b31d029e9563a)

13 years agos3: Fix bug 7635
Volker Lendecke [Sat, 21 Aug 2010 09:32:58 +0000 (11:32 +0200)]
s3: Fix bug 7635

smbclient -M not sending due to NT_STATUS_PIPE_BROKEN

13 years agoFix bug #7589 - ntlm_auth fails to use cached credentials.
Jeremy Allison [Thu, 29 Jul 2010 20:44:35 +0000 (13:44 -0700)]
Fix bug #7589 - ntlm_auth fails to use cached credentials.

In handling the WINBINDD_PAM_AUTH message winbindd canonicalizes a *copy*
of the mapped username, but fails to canonicalize the actual username
sent to the backend domain process. When "winbind default domain"
is set this can lead to credentials being cached with an index of
user: user, not DOMAIN\user. All other code paths that use
canonicalize_username() (WINBINDD_PAM_CHAUTHTOK, WINBINDD_PAM_LOGOFF)
correctly canonicalize the data sent to the backend. All calls
the can cause credentials to be looked up (PAM_CHAUTHTOK etc.)
correctly call canonicalize_username() to create the credential
lookup key.

Jeremy.