ddiss/samba.git
11 years agos3:smbd: use fsp_persistent_id() as persistent_file_id part for SMB2 (bug #8995)
Stefan Metzmacher [Wed, 13 Jun 2012 10:13:01 +0000 (12:13 +0200)]
s3:smbd: use fsp_persistent_id() as persistent_file_id part for SMB2 (bug #8995)

It seems to be important to have unique persistent file ids,
because windows clients seem to index files by server_guid + persistent_file_id.
Which may break, if we just have a 16-bit range per connection
and the client connects multiple times.

Based on code from Ira Cooper. Use fsp->fh->gen_id as the persistent
fileid in SMB2.

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jun 14 22:04:13 CEST 2012 on sn-devel-104

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smbd: add a fsp_persistent_id() function
Stefan Metzmacher [Thu, 14 Jun 2012 08:32:43 +0000 (10:32 +0200)]
s3:smbd: add a fsp_persistent_id() function

This calculates a 64-bit value that most likely uniquely identifies
the files_struct globally to the server.

* 32-bit random gen_id
* 16-bit truncated open_time
* 16-bit fnum (valatile_id)

Based on code from Ira Cooper. Use fsp->fh->gen_id as the persistent
fileid in SMB2.

Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smbd: try to make fsp->fh->gen_id as globally unique as possible
Stefan Metzmacher [Wed, 13 Jun 2012 10:11:51 +0000 (12:11 +0200)]
s3:smbd: try to make fsp->fh->gen_id as globally unique as possible

This makes sure the value is never 0, it's between 1 and UINT32_MAX.

While fsp->fh->gen_id is 'unsigned long' currently (which might by 8 bytes),
there's some oplock code which truncates it to uint32_t (using IVAL()).

Which means we could reuse fsp->fh->gen_id as persistent file id
until we have a final fix, which uses database.

See bug #8995 for more details.

Based on code from Ira Cooper. Ensure fsp->fh->gen_id starts from
a random point. We will use this as the SMB2 persistent_id.

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agoRevert "s3:smbd: set req->smb2req->compat_chain_fsp in file_fsp()"
Stefan Metzmacher [Sat, 9 Jun 2012 09:11:26 +0000 (11:11 +0200)]
Revert "s3:smbd: set req->smb2req->compat_chain_fsp in file_fsp()"

This reverts commit c2716a7d5ccf78f9716b703c22e6cf4d4f179656.

This is not needed anymore, as we have file_fsp_smb2() now.

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sun Jun 10 18:04:21 CEST 2012 on sn-devel-104

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_ioctl: make use of file_fsp_smb2()
Stefan Metzmacher [Fri, 15 Jun 2012 20:42:27 +0000 (13:42 -0700)]
s3:smb2_ioctl: make use of file_fsp_smb2()

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_lock: make use of file_fsp_smb2()
Stefan Metzmacher [Fri, 8 Jun 2012 09:57:21 +0000 (11:57 +0200)]
s3:smb2_lock: make use of file_fsp_smb2()

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_write: make use of file_fsp_smb2()
Stefan Metzmacher [Fri, 15 Jun 2012 20:31:59 +0000 (13:31 -0700)]
s3:smb2_write: make use of file_fsp_smb2()

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_read: make use of file_fsp_smb2()
Stefan Metzmacher [Fri, 15 Jun 2012 20:29:24 +0000 (13:29 -0700)]
s3:smb2_read: make use of file_fsp_smb2()

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_notify: make use of file_fsp_smb2()
Stefan Metzmacher [Fri, 15 Jun 2012 20:27:55 +0000 (13:27 -0700)]
s3:smb2_notify: make use of file_fsp_smb2()

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years ago3:smb2_setinfo: make use of file_fsp_smb2()
Stefan Metzmacher [Fri, 15 Jun 2012 20:25:11 +0000 (13:25 -0700)]
3:smb2_setinfo: make use of file_fsp_smb2()

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_getinfo: make use of file_fsp_smb2()
Stefan Metzmacher [Fri, 15 Jun 2012 20:23:47 +0000 (13:23 -0700)]
s3:smb2_getinfo: make use of file_fsp_smb2()

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_find: make use of file_fsp_smb2()
Stefan Metzmacher [Fri, 8 Jun 2012 08:42:43 +0000 (10:42 +0200)]
s3:smb2_find: make use of file_fsp_smb2()

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_break: make use of file_fsp_smb2()
Stefan Metzmacher [Fri, 8 Jun 2012 08:36:24 +0000 (10:36 +0200)]
s3:smb2_break: make use of file_fsp_smb2()

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_close: make use of file_fsp_smb2()
Stefan Metzmacher [Fri, 15 Jun 2012 20:15:27 +0000 (13:15 -0700)]
s3:smb2_close: make use of file_fsp_smb2()

metze
Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_flush: make use of file_fsp_smb2()
Stefan Metzmacher [Fri, 15 Jun 2012 19:55:52 +0000 (12:55 -0700)]
s3:smb2_flush: make use of file_fsp_smb2()

metze
Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smbd: add file_fsp_smb2()
Stefan Metzmacher [Fri, 8 Jun 2012 08:11:57 +0000 (10:11 +0200)]
s3:smbd: add file_fsp_smb2()

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_write: pass fsp->fnum to init_strict_lock_struct()
Stefan Metzmacher [Fri, 8 Jun 2012 09:19:00 +0000 (11:19 +0200)]
s3:smb2_write: pass fsp->fnum to init_strict_lock_struct()

fsp->fnum is the same as in_file_id_volatile.

When we start to support durable handles we should pass
in_file_id_persistent.

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Jun  9 18:50:32 CEST 2012 on sn-devel-104

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_read: pass fsp->fnum to init_strict_lock_struct()
Stefan Metzmacher [Fri, 8 Jun 2012 09:19:00 +0000 (11:19 +0200)]
s3:smb2_read: pass fsp->fnum to init_strict_lock_struct()

fsp->fnum is the same as in_file_id_volatile.

When we start to support durable handles we should pass
in_file_id_persistent.

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_lock: use fsp->fnum as locking context
Stefan Metzmacher [Fri, 8 Jun 2012 09:19:00 +0000 (11:19 +0200)]
s3:smb2_lock: use fsp->fnum as locking context

fsp->fnum is the same as in_file_id_volatile.

When we start to support durable handles we should pass
in_file_id_persistent.

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smb2_lock: use smb2req->compat_chain_fsp instead of looking it up again
Stefan Metzmacher [Fri, 8 Jun 2012 10:05:56 +0000 (12:05 +0200)]
s3:smb2_lock: use smb2req->compat_chain_fsp instead of looking it up again

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agos3:smbd: set req->smb2req->compat_chain_fsp in file_fsp()
Stefan Metzmacher [Sat, 9 Jun 2012 09:09:25 +0000 (11:09 +0200)]
s3:smbd: set req->smb2req->compat_chain_fsp in file_fsp()

metze

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agoPart 2 of fix for bug #8998 - Notify code can miss a ChDir.
Volker Lendecke [Thu, 14 Jun 2012 18:26:44 +0000 (11:26 -0700)]
Part 2 of fix for bug #8998 - Notify code can miss a ChDir.

Do a ChDir for notify_onelevel.

11 years agoPart 1 of fix for bug #8998 - Notify code can miss a ChDir.
Volker Lendecke [Thu, 14 Jun 2012 18:24:01 +0000 (11:24 -0700)]
Part 1 of fix for bug #8998 - Notify code can miss a ChDir.

Factor out notify_parent_dir.

11 years agoFix bug #8922.
Jeremy Allison [Fri, 11 May 2012 10:27:01 +0000 (03:27 -0700)]
Fix bug #8922.

Looking at the do_list status returns was historically
ignored, allowing tar to continue after NT_STATUS_ACCESS_DENIED.
Return to this state.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri May 11 14:55:53 CEST 2012 on sn-devel-104

11 years agoComplete fix for bug #8811 - sd_has_inheritable_components segfaults on an SD that...
Jeremy Allison [Fri, 30 Mar 2012 18:58:31 +0000 (11:58 -0700)]
Complete fix for bug #8811 - sd_has_inheritable_components segfaults on an SD that se_access_check accepts.

11 years agos3: remove dependency on automake for "make everything"
Björn Jacke [Tue, 5 Jun 2012 13:37:00 +0000 (15:37 +0200)]
s3: remove dependency on automake for "make everything"

the dependency was introduced by 737a1c9b96a4ba8d8688f4dba1df6d931e10e64d

We now call auto* in examples/VFS from within the main autogen.sh.

This fixes bug #8978.

Autobuild-User: Björn Jacke <bj@sernet.de>
Autobuild-Date: Tue Jun  5 17:32:22 CEST 2012 on sn-devel-104
(cherry picked from commit 5cc86fd560568202bef069eb89f5906f20050085)

11 years agoFix bug #8972 - Directory group write permission bit is set if unix extensions are...
Jeremy Allison [Wed, 13 Jun 2012 17:48:32 +0000 (10:48 -0700)]
Fix bug #8972 - Directory group write permission bit is set if unix extensions are enabled

We can't manipulate file_attributes if it's a posix call.

11 years agos3-winbindd: call dump_core_setup after command line option has been parsed
Matthieu Patou [Fri, 1 Jun 2012 22:33:04 +0000 (15:33 -0700)]
s3-winbindd: call dump_core_setup after command line option has been parsed

Without this fix in some situations winbindd can't coredump.
Such cases append when samba is compiled in a custom prefix (ie.
/home/build/mat/prod/1/) in this case get_dyn_LOGFILEBASE or basename(lp_logfile)
before the configuration file and the command line is parsed will be something like /home/build/mat/prod/1/var
which might not exists on the host where you run it (where it's most
probably more "normal" directories).
Specifying --log-basename didn't help as dump_core_setup is called before the command line and
the config file is read so it didn't help getting a correct value in dump_core_setup.
We fix this issue by calling dump_core_setup() also after the command
line has been read and also after the configfile has been parsed so that
the final location for the coredump is coherent with the final logile
location.

Fix bug #8975 (winbindd can't coredump).

11 years agoFix bug #8311 - Winzip occasionally can not read files out of an open winzip dialog.
Stefan Metzmacher [Mon, 4 Jun 2012 22:59:35 +0000 (15:59 -0700)]
Fix bug #8311 - Winzip occasionally can not read files out of an open winzip dialog.

Backport of the changes in master without the VFS change. Move
all processing into smb_fsctl().

11 years agos3-librpc-crypto: avoid crash with MIT krb5 1.10.0 in gss_get_name_attribute()
Alexander Bokovoy [Thu, 7 Jun 2012 15:24:38 +0000 (18:24 +0300)]
s3-librpc-crypto: avoid crash with MIT krb5 1.10.0 in gss_get_name_attribute()

gss_get_name_attribute() can return unintialized pac_display_buffer
and later gss_release_buffer() will crash on attempting to release it.

The fix on MIT krb5 side is in 1.10.1, reported in both Debian and MIT upstream:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=658514
http://krbdev.mit.edu/rt/Ticket/Display.html?user=guest&pass=guest&id=7087

We need to initialize variables before using gss_get_name_attribute()

Fix bug #8988 (avoid crash with MIT krb5 1.10.0 in gss_get_name_attribute()).

11 years agoWe are triggering the cleanup_timeout_fn() too often, on exiting when an smbd is...
Jeremy Allison [Fri, 1 Jun 2012 19:28:33 +0000 (12:28 -0700)]
We are triggering the cleanup_timeout_fn() too often, on exiting when an smbd is idle.

Calls to exit_server_cleanly() should be treated as a "clean" shutdown,
and not trigger the master smbd to call cleanup_timeout_fn.

The last 2 patches address bug #8971 (cleanup_timeout_fn() is called too often,
on exiting when an smbd is idle.)

11 years agoStop spamming the logs with "Could not remove pid XX from serverid.tdb" messages...
Jeremy Allison [Fri, 1 Jun 2012 19:02:04 +0000 (12:02 -0700)]
Stop spamming the logs with "Could not remove pid XX from serverid.tdb" messages and initiating the cleanup function on every process deat

We now have many sub-processes from smbd that don't serve SMB1/SMB2 requests and
don't register themselves in the serverid.tdb. Only initiate the cleanup
from processes that were explicitly in the child list.

11 years agos3: Fix uninitialized memory read in talloc_free()
Volker Lendecke [Tue, 29 May 2012 13:31:49 +0000 (15:31 +0200)]
s3: Fix uninitialized memory read in talloc_free()

Thanks to laurent gaffie <laurent.gaffie@gmail.com> for reporting
this issue!

11 years agoForward port of Richard Sharpe's <realrichardsharpe@gmail.com> fix for bug #8970...
Jeremy Allison [Thu, 31 May 2012 23:25:52 +0000 (16:25 -0700)]
Forward port of Richard Sharpe's <realrichardsharpe@gmail.com> fix for bug #8970 - Possible memory leaks in the samba master process.

11 years agos3: fix compile of krb5 locator on Solaris
Björn Jacke [Tue, 29 May 2012 06:01:40 +0000 (08:01 +0200)]
s3: fix compile of krb5 locator on Solaris

the krb5 locator plugin on Solaris needs LIBREPLACE_LIBS (bug #8732)

Autobuild-User: Björn Jacke <bj@sernet.de>
Autobuild-Date: Tue May 29 09:58:42 CEST 2012 on sn-devel-104
(cherry picked from commit 3085225e72c75abf84d7740334459cd971ee4c56)

11 years agos3-pid: Catch with pid filename's change when config file is not smb.conf
Matthieu Patou [Wed, 25 Jan 2012 05:29:11 +0000 (21:29 -0800)]
s3-pid: Catch with pid filename's change when config file is not smb.conf

This is what is done in pidfile_create
(cherry picked from commit 9b43ad4fcac1eb6796973336c5614b18a054080d)

Fix bug #8714 (smbcontrol can't find the pid file of winbindd because the later
is created with a different name).

11 years agoFix bug #8627: Crash bug in dns_create_probe.
Jeremy Allison [Thu, 31 May 2012 19:19:53 +0000 (21:19 +0200)]
Fix bug #8627: Crash bug in dns_create_probe.

Fix crash bug in dns_create_probe when dns_create_update fails.

11 years agoSecond part of fix for bug 8953 - winbind can hang as nbt_getdc() has no timeout.
Herb Lewis [Tue, 29 May 2012 23:38:53 +0000 (16:38 -0700)]
Second part of fix for bug 8953 - winbind can hang as nbt_getdc() has no timeout.

If we're running with SEC_ADS and we don't get a cldap response from
the server when querying its name, don't fall back to NetBIOS requests
as they're unlikely to succeed.

Signed-off-by: Jeremy Allison <jra@samba.org>
11 years agoFix bug #8953 - winbind can hang as nbt_getdc() has no timeout.
Jeremy Allison [Tue, 29 May 2012 23:37:35 +0000 (16:37 -0700)]
Fix bug #8953 - winbind can hang as nbt_getdc() has no timeout.

Add a timeout_in_seconds parameter to nbt_getdc() to make it fail
after that time with NT_STATUS_IO_TIMEOUT.

11 years agoFix bug #8373 - Can't join XP Pro workstations to 3.6.1 DC.
Jeremy Allison [Fri, 25 May 2012 16:16:50 +0000 (09:16 -0700)]
Fix bug #8373 - Can't join XP Pro workstations to 3.6.1 DC.

Treat LIBNDR_FLAG_NOALIGN and LIBNDR_FLAG_REMAINING the same as the
other align flags - make them mutually exclusive.

Combined work from Metze, Günther and Jeremy.
(cherry picked from commit 035342c11719d1daa647c0b2ae7cec27a969f83a)

11 years agoFix bad bugfix for bug #8910 - resolve_ads() code can return zero addresses and miss...
Ira Cooper [Wed, 30 May 2012 18:50:06 +0000 (11:50 -0700)]
Fix bad bugfix for bug #8910 - resolve_ads() code can return zero addresses and miss valid DC IP addresses

Original code incorrectly used a while() instead of a for() loop.
We need to iterate over the entire array here.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed May 30 23:29:03 CEST 2012 on sn-devel-104
(cherry picked from commit fc7e1113c34819de6fc8053fb81ee2e0e970bec2)

11 years agoFix bug #8882 - Broken processing of %U with vfs_full_audit when force user is set.
Jeremy Allison [Tue, 24 Apr 2012 00:49:49 +0000 (17:49 -0700)]
Fix bug #8882 - Broken processing of %U with vfs_full_audit when force user is set.

When doing a "force user" we need to remember what the "sanitized_username"
was from the original connect.

11 years agos3-utils: Use ads_do_search_retry in net ads search
Andrew Bartlett [Fri, 18 May 2012 12:02:57 +0000 (22:02 +1000)]
s3-utils: Use ads_do_search_retry in net ads search

This makes it possible to search against a slow server, as will
fallback from 1000 to (eventually) 125 users at a time.

Andrew Bartlett

The last 4 patches address big #8943 (Slow but responsive DC can lock up
winbindd for > 10 minutes at a time).

11 years agos3-libads: Use a reducing page size to try and cope with a slow LDAP server
Andrew Bartlett [Fri, 18 May 2012 12:01:14 +0000 (22:01 +1000)]
s3-libads: Use a reducing page size to try and cope with a slow LDAP server

If we cannot get 1000 users downloaded in 15seconds, try with 500, 250
and then 125 users at a time.

Andrew Bartlett

11 years agos3-winbindd: Always map the LDAP error code to an NTSTATUS
Andrew Bartlett [Fri, 18 May 2012 07:40:59 +0000 (17:40 +1000)]
s3-winbindd: Always map the LDAP error code to an NTSTATUS

We do this so that we catch LDAP_TIMELIMIT_EXCEEDED as NT_STATUS_IO_TIMEOUT, which
has special handling in winbindd_cache.c

Andrew Bartlett

11 years agos3-libads: Map LDAP_TIMELIMIT_EXCEEDED as NT_STATUS_IO_TIMEOUT
Andrew Bartlett [Fri, 18 May 2012 07:38:48 +0000 (17:38 +1000)]
s3-libads: Map LDAP_TIMELIMIT_EXCEEDED as NT_STATUS_IO_TIMEOUT

This allows Samba to then handle this error in the same way it would for RPC connections

Andrew Bartlett

11 years agoFix the loop unrolling inside resolve_ads(). If we don't get an IP list don't use...
Jeremy Allison [Mon, 30 Apr 2012 18:05:51 +0000 (11:05 -0700)]
Fix the loop unrolling inside resolve_ads(). If we don't get an IP list don't use interpret_string_addr(), as this only returns one address, use interpret_string_addr_internal() instead.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Apr 30 23:21:16 CEST 2012 on sn-devel-104
(cherry picked from commit 1270cfb45ffa0bbcacf7254b5b45f492a8dcde77)

The last 4 patches address bug #8910 (resolve_ads() code can return zero
addresses and miss valid DC IP addresses).

11 years agoProtect all of the name resolution methods from returning null addrs. Ensure all...
Jeremy Allison [Fri, 27 Apr 2012 23:25:58 +0000 (16:25 -0700)]
Protect all of the name resolution methods from returning null addrs. Ensure all returns go through remove_duplicate_addrs2(). (cherry picked from commit 11973608186926e5417ee81c8709ea5b0a7ef2e1)

11 years agoFix convert_ss2service() to filter out zero addresses.
Jeremy Allison [Mon, 30 Apr 2012 21:45:43 +0000 (14:45 -0700)]
Fix convert_ss2service() to filter out zero addresses.

11 years agoFix remove_duplicate_addrs2 to do exactly what it says. Previously it could leave...
Jeremy Allison [Fri, 27 Apr 2012 23:02:15 +0000 (16:02 -0700)]
Fix remove_duplicate_addrs2 to do exactly what it says. Previously it could leave zero addresses in the list. (cherry picked from commit 01e884675e3d1cffb0149108225fbd21c3a73f4e)

11 years agoFix bug #8957 - Typo in pam_winbindd code MUST fix.
Jeremy Allison [Sat, 26 May 2012 00:19:29 +0000 (17:19 -0700)]
Fix bug #8957 - Typo in pam_winbindd code MUST fix.

11 years agos3-passdb: Fix negative SID->uid/gid cache handling. (bug #8952)
Ira Cooper [Thu, 24 May 2012 01:39:03 +0000 (21:39 -0400)]
s3-passdb: Fix negative SID->uid/gid cache handling. (bug #8952)

-1 uid/gid signals a non existent uid/gid.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos3-auth: Don't lookup the system user in pdb.
Andreas Schneider [Mon, 14 May 2012 08:31:32 +0000 (10:31 +0200)]
s3-auth: Don't lookup the system user in pdb.

This fixes bug #8944, ldapsam:trusted and ipasam. It is an additional
fix for bug #8567 (0528cb5f3a15b72dcb34ece21a3ffb3e7b8d6eb9).

Signed-off-by: Andreas Schneider <asn@samba.org>
11 years agoCheck the return from create_acl_blob
Richard Sharpe [Thu, 17 May 2012 03:21:34 +0000 (20:21 -0700)]
Check the return from create_acl_blob

Autobuild-User: Richard Sharpe <sharpe@samba.org>
Autobuild-Date: Thu May 17 07:17:29 CEST 2012 on sn-devel-104
(cherry picked from commit 632af6645376185500820a5be9dbf5c0c3d1e515)

The last two commits address bug #8945 (vfs_acl_common discards errors from
writing to the underlying storage).

11 years agoFix the overwriting of errno before use in a DEBUG statement and use the return value...
Richard Sharpe [Tue, 15 May 2012 14:47:14 +0000 (07:47 -0700)]
Fix the overwriting of errno before use in a DEBUG statement and use the return value from store_acl_blob_fsp rather than ignoring it.

Autobuild-User: Richard Sharpe <sharpe@samba.org>
Autobuild-Date: Wed May 16 03:43:41 CEST 2012 on sn-devel-104
(cherry picked from commit bfe4a2baeec6bc4558a617ec67532ea11f865861)

12 years agoWHATSNEW: Start release notes for 3.6.6.
Karolin Seeger [Fri, 11 May 2012 14:26:25 +0000 (16:26 +0200)]
WHATSNEW: Start release notes for 3.6.6.

Karolin

12 years agos3-printing: Add new printers to registry.
Björn Baumbach [Fri, 28 Oct 2011 03:43:05 +0000 (05:43 +0200)]
s3-printing: Add new printers to registry.

This fixes bug #8554, #8612 and #8748.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
12 years agos3:auth/server_info: the primary rid should be in the groups rid array (bug #8798)
Alejandro Escanero Blanco [Wed, 9 May 2012 09:35:51 +0000 (11:35 +0200)]
s3:auth/server_info: the primary rid should be in the groups rid array (bug #8798)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Wed May  9 19:36:01 CEST 2012 on sn-devel-104
(cherry picked from commit 6132cf2a5cd77c79546a2d6cc3fbf3c93f54183b)

12 years agos3:registry: return error when Key does not exist in regdb_fetch_values_internal...
Michael Adam [Fri, 4 May 2012 16:01:00 +0000 (18:01 +0200)]
s3:registry: return error when Key does not exist in regdb_fetch_values_internal() (cherry picked from commit 8a723ddfc1645e52830fb5f47a34f032f9c38931)

12 years agos3:registry: replace call to reg_openkey() in reg_createkey() by accesscheck. (cherry...
Michael Adam [Mon, 23 Apr 2012 14:44:15 +0000 (16:44 +0200)]
s3:registry: replace call to reg_openkey() in reg_createkey() by accesscheck. (cherry picked from commit c1cc15c33be8926ffef173b514d0fb260292d9a3)

12 years agos3:registry: remove a superfluous fill_subkey_cache() in reg_createkey()
Michael Adam [Mon, 23 Apr 2012 14:13:29 +0000 (16:13 +0200)]
s3:registry: remove a superfluous fill_subkey_cache() in reg_createkey()

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>
(cherry picked from commit 03ae7117df2ae42213a3ef9a5ea3adad2bf264e0)

12 years agos3:registry: use fill_subkey_cache to check exsistence in regkey_open_onelevel().
Michael Adam [Mon, 23 Apr 2012 14:07:21 +0000 (16:07 +0200)]
s3:registry: use fill_subkey_cache to check exsistence in regkey_open_onelevel().

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>
(cherry picked from commit af9d70fbce541c382a5fc54b1cc1af9b0b60a692)

12 years agos3:registry: let fill_subkey_cache return WERR_BADFILE when the subkey list could...
Michael Adam [Mon, 23 Apr 2012 14:05:33 +0000 (16:05 +0200)]
s3:registry: let fill_subkey_cache return WERR_BADFILE when the subkey list could not be loaded

WERR_NO_MORE_ITEMS seems inappropriate.

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>
(cherry picked from commit 4b3dca83bf0da405524a64ca19771fd747ebe267)

12 years agos3:registry: convert reg_openkey() to use talloc instead of SMB_STRDUP etc (cherry...
Michael Adam [Mon, 23 Apr 2012 13:47:33 +0000 (15:47 +0200)]
s3:registry: convert reg_openkey() to use talloc instead of SMB_STRDUP etc (cherry picked from commit 42dd99d85ca04c10691f78d6340c6b702ade974b)

12 years agos3:registry untangle an assignment from the check in regkey_open_onelevel() (cherry...
Michael Adam [Mon, 23 Apr 2012 13:30:38 +0000 (15:30 +0200)]
s3:registry untangle an assignment from the check in regkey_open_onelevel() (cherry picked from commit 12b7b4f0a7d8607dc206c32a3822d5678c14d43b)

12 years agos3:registry: untangle assignment from check in regkey_open_onelevel() (cherry picked...
Michael Adam [Mon, 23 Apr 2012 13:29:41 +0000 (15:29 +0200)]
s3:registry: untangle assignment from check in regkey_open_onelevel() (cherry picked from commit 52d3c5c14898b5f2514d1512289370eb6f6fd369)

12 years agos3:registry: fix seqnum race in regdb_fetch_keys_internal
Michael Adam [Wed, 11 Apr 2012 13:51:40 +0000 (15:51 +0200)]
s3:registry: fix seqnum race in regdb_fetch_keys_internal

This prevents race between fetching seqnum and key content.

Because there is currently no way to atomically fetch the
record along with the seqnum, I use a loop.
This is far from optimal and should should ideally be done
differently. But for now it fixes the race.
(cherry picked from commit 66fcac5e479a530091ecb43d9f8cf90f4351ad17)

12 years agos3:registry avoid pruning the sequencenumber while flushing the regsubkey_ctr
Gregor Beck [Wed, 13 Jul 2011 14:51:54 +0000 (16:51 +0200)]
s3:registry avoid pruning the sequencenumber while flushing the regsubkey_ctr

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Jul 15 08:34:47 CEST 2011 on sn-devel-104
(cherry picked from commit 5049e3e142977a4c3d0f5a0fd9c06429f4d85bed)

12 years agos3:registry: fix seqnum race in fetch_values_internal
Michael Adam [Wed, 11 Apr 2012 13:48:02 +0000 (15:48 +0200)]
s3:registry: fix seqnum race in fetch_values_internal

This prevents race between fetching seqnum and key content.

Because there is currently no way to atomically fetch the
record along with the seqnum, I use a loop.
This is far from optimal and should should ideally be done
differently. But for now it fixes the race.
(cherry picked from commit 13bccba3c2f6e6fdda2b4a40dd4b1e250a98a7ef)

Conflicts:

source3/registry/reg_backend_db.c

12 years agos3:registry: update the seqnum in the subkey cache at the end of regval_store_keys
Michael Adam [Wed, 11 Apr 2012 14:02:44 +0000 (16:02 +0200)]
s3:registry: update the seqnum in the subkey cache at the end of regval_store_keys

The purpose is to prevent next reads from going to disk.

Note that this will currently only be effective with local tdbs, not
with ctdb: For tdb, store and delete bump the seqnum while transaction
commit does not. For ctdb, transaction commit bumps the seqnum, while
store and delete don't... This needs fixing (in ctdb).
(cherry picked from commit 16d83149c1b5620598edd37bbd1a73bebec82b6e)

12 years agos3:registry:db: update the value container seqnum after storing/deleting to prevent...
Michael Adam [Wed, 11 Apr 2012 13:38:29 +0000 (15:38 +0200)]
s3:registry:db: update the value container seqnum after storing/deleting to prevent next read from going to disk if possible

Note that this will currently only be effective in the local TDB implementation.
For CTDB, this wont work since seqnum currently works differently there (needs
fixing): For tdb, store and delete operations bump the db seqnum, while
transaction commits don't. For ctdb, the seqnum is bumped by the transaction
commit but not by store and delete operations.
(cherry picked from commit 13347d11c0e918f82e7e3c21125acc5e241d389f)

12 years agos3:registry: wrap reg_deletekey() into a transaction
Michael Adam [Thu, 12 Apr 2012 20:53:24 +0000 (22:53 +0200)]
s3:registry: wrap reg_deletekey() into a transaction

This is wrong layering but fixes a race condition.
(cherry picked from commit e3ad0456515c97f6697190c86b8cec4af8e1e190)

12 years agos3:registry: wrap reg_createkey() in a transaction
Michael Adam [Thu, 12 Apr 2012 20:17:35 +0000 (22:17 +0200)]
s3:registry: wrap reg_createkey() in a transaction

This is wrong layering (calling into regdb_transaction* in the reg_api code)
but fixes a potential race. It makes the multi-step create procedure atomic.

This should completely be done in the backend.
(cherry picked from commit 65d9b116d0283b010e9e3c9ecf185ca42850838e)

12 years agos3:registry: untangle assignments from checks in reg_createkey() (cherry picked from...
Michael Adam [Thu, 12 Apr 2012 15:58:26 +0000 (17:58 +0200)]
s3:registry: untangle assignments from checks in reg_createkey() (cherry picked from commit 4ac9625fe42ded0717aafdf6eec4c1b2217c3c68)

12 years agos3:registry: wrap reg_deletevalue() in a transaction
Michael Adam [Thu, 12 Apr 2012 15:52:43 +0000 (17:52 +0200)]
s3:registry: wrap reg_deletevalue() in a transaction

This is at the wrong layer, but if fixes a race potentially causing
data corruption by concurrent access.
(cherry picked from commit c1208c4a9c10b03579dca3bcd304709e631d3c25)

12 years agos3:registry: untangle assignment from check in reg_deletevalue() (cherry picked from...
Michael Adam [Thu, 12 Apr 2012 15:46:02 +0000 (17:46 +0200)]
s3:registry: untangle assignment from check in reg_deletevalue() (cherry picked from commit 585746338bda22ff8337d41c8cc50533c5facf56)

12 years agos3:registry: fix race in reg_setvalue that could lead to data corruption
Michael Adam [Thu, 12 Apr 2012 11:38:32 +0000 (13:38 +0200)]
s3:registry: fix race in reg_setvalue that could lead to data corruption

(there was no lock around fetching the values and storing them)

The layering is wrong in that it uses regdb transactions in reg_api
(cherry picked from commit 9220377ceebf05e756fd108cbd30b503598e0fb8)

12 years agos3:registry: untangle assignment from check and add a debugmessage in reg_setvalue...
Michael Adam [Fri, 20 Apr 2012 13:19:47 +0000 (15:19 +0200)]
s3:registry: untangle assignment from check and add a debugmessage in reg_setvalue() (cherry picked from commit a81d399456eb86ffb60bed8704cd8c7864b742db)

12 years agos3:registry: don't leak the old contents when updating the value cache (cherry picked...
Michael Adam [Thu, 12 Apr 2012 06:18:04 +0000 (08:18 +0200)]
s3:registry: don't leak the old contents when updating the value cache (cherry picked from commit 0bf44361caace3a4974dafa305033fb926d0f6d6)

12 years agos3:registry: fix debug message in regdb_store_values_internal() (cherry picked from...
Michael Adam [Fri, 30 Mar 2012 13:39:58 +0000 (15:39 +0200)]
s3:registry: fix debug message in regdb_store_values_internal() (cherry picked from commit c46403f74116708f2f8b1d531f5881bb9d7f2a84)

12 years agos3:registry: improve log message in regdb_unpack_values() (cherry picked from commit...
Michael Adam [Fri, 30 Mar 2012 13:35:14 +0000 (15:35 +0200)]
s3:registry: improve log message in regdb_unpack_values() (cherry picked from commit ae441d97cdbe8e35cd342ba979bacc3757c06cb7)

12 years agos3:registry: fix a debug message typo (cherry picked from commit 9f82e1175f28bdc1c09e...
Michael Adam [Fri, 30 Mar 2012 13:14:01 +0000 (15:14 +0200)]
s3:registry: fix a debug message typo (cherry picked from commit 9f82e1175f28bdc1c09e7bd795699b29049a77e3)

12 years agos3:registry: add a new function regval_ctr_value_byname()
Michael Adam [Fri, 30 Mar 2012 12:39:50 +0000 (14:39 +0200)]
s3:registry: add a new function regval_ctr_value_byname()

This is like regval_ctr_key_exists() but does not return bool,
but the regval_blob instead, if found, and NULL if not found.
(cherry picked from commit b037d5461a7a9a2e51a3dd2794fcc47dfcff4468)

12 years agos3:registry: rename regval_ctr_key_exists() to regval_ctr_value_exists() (cherry...
Michael Adam [Fri, 30 Mar 2012 12:33:39 +0000 (14:33 +0200)]
s3:registry: rename regval_ctr_key_exists() to regval_ctr_value_exists() (cherry picked from commit 60cdf3c8b5bbda9434f0d8a05fc581ab41b42d5c)

12 years agos4:torture:rpc:spoolss: also initialize driverName before checking it in test_Printer...
Michael Adam [Thu, 29 Mar 2012 23:00:51 +0000 (01:00 +0200)]
s4:torture:rpc:spoolss: also initialize driverName before checking it in test_PrinterData_DsSpooler() (cherry picked from commit 46428f96a4089925355b4eeebebb8d7f27e2ec0b)

12 years agos3:registry:reg_api: fix reg_queryvalue to not fail when values are modified while...
Michael Adam [Thu, 29 Mar 2012 22:10:14 +0000 (00:10 +0200)]
s3:registry:reg_api: fix reg_queryvalue to not fail when values are modified while it runs (cherry picked from commit 5d26120b5ab180212d570dd256e8989e0c80224d)

12 years agos3:registry: implement values_need_update and subkeys_need_update in the smbconf...
Michael Adam [Sat, 5 May 2012 00:12:25 +0000 (02:12 +0200)]
s3:registry: implement values_need_update and subkeys_need_update in the smbconf backend

It simply calls to the regdb functions.
This fixes a caching issue uncovered by recent changes.
(cherry picked from commit bff7589818e602ace6cd0a4125d5f6a2ba97cded)

12 years agoFix bug 8920, null dereference
Steve Langasek [Wed, 9 May 2012 05:56:00 +0000 (07:56 +0200)]
Fix bug 8920, null dereference

Description: Avoid null dereference in initialize_password_db()
 When initialize_password_db() is called with reload=True, it's assumed that
 the free_private_data member of pdb_methods is non-null.  This is not
 necessarily the case, as the tdb backend has no private data and therefore
 no free function.  Check to see if we have private data that needs freed
 before calling.
Author: Steve Langasek <steve.langasek@ubuntu.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/829221

12 years agos3-pam_winbind: Fix the build.
Jeremy Allison [Thu, 10 May 2012 07:53:57 +0000 (09:53 +0200)]
s3-pam_winbind: Fix the build.

Jeremy

Part of a fix for bug #8915 (Samba fails to build with iniparser-3.0.0 and
iniparser-3.1.0).

12 years agoFix pam_winbind build against newer iniparser library.
Simo Sorce [Wed, 9 May 2012 11:55:41 +0000 (13:55 +0200)]
Fix pam_winbind build against newer iniparser library.

iniparser_getstr is deprecated and has been removed in newer libraries
available in Fedora. Use iniparse_getstring instead.

Autobuild-User: Simo Sorce <idra@samba.org>
Autobuild-Date: Tue Apr 24 02:56:10 CEST 2012 on sn-devel-104

Based on commit adbace20a24b6ae4fbd6d17b7153833f4ac8c88d in master.

12 years agos3-docs: Fix bug #7930.
Karolin Seeger [Tue, 8 May 2012 14:33:07 +0000 (16:33 +0200)]
s3-docs: Fix bug #7930.

Add hint that setting "profile acls = yes" on normal shares can cause trouble.

Karolin

Autobuild-User: Karolin Seeger <kseeger@samba.org>
Autobuild-Date: Tue May  8 18:47:59 CEST 2012 on sn-devel-104
(cherry picked from commit 4cc04a29247a0c4b3de9884890364a5712534073)

12 years agos3-VFS: Fix building out-of-tree modules.
Richard Sharpe [Tue, 8 May 2012 12:53:10 +0000 (14:53 +0200)]
s3-VFS: Fix building out-of-tree modules.

Fix bug #8822 (VFS module init function name has to be manually changed
depending on build environment).

12 years agos3-docs: Fix several typos.
Karolin Seeger [Tue, 8 May 2012 10:01:28 +0000 (12:01 +0200)]
s3-docs: Fix several typos.

Part of a fix for bug #7938. Based on a patch provided by John Bradshaw
<john@johnbradshaw.org>.

Karolin

12 years agos3-docs: overrided -> overridden
Karolin Seeger [Tue, 8 May 2012 09:05:37 +0000 (11:05 +0200)]
s3-docs: overrided -> overridden

Fix typo. Part of a fix for bug #7938. Based on a patch provided by John
Bradshaw <john@johnbradshaw.org>.

12 years agos3/ldap: remove outdated netscape ds 5 schema file
Björn Jacke [Tue, 8 May 2012 12:10:51 +0000 (14:10 +0200)]
s3/ldap: remove outdated netscape ds 5 schema file

remove outdated netscape ds 5 schema file and put a README there pointing to
the FDS schema file instead. This fixes bug #8869

(commit b31f773ae1640313dc1ba86b334e9bbb9cb31bd6 in master)

12 years agoFix bug #8877 - Syslog broken owing to mistyping of debug_settings.syslog.
Joseph Tam [Thu, 19 Apr 2012 18:46:16 +0000 (11:46 -0700)]
Fix bug #8877 - Syslog broken owing to mistyping of debug_settings.syslog.

Setting "syslog only = yes" did not divert log messages to syslog.  The test in
lib/util/debug.c:Debug1():747

   if( syslog_level < state.settings.syslog )

produces wrong results since .syslog is typed "bool" rather than "int".
The attached patch fixes this by typing this field correctly as "int".

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Apr 20 00:06:12 CEST 2012 on sn-devel-104
(cherry picked from commit 00d5f32025bf13285ab3f8ffae914107c9eca275)

Signed-off-by: Jeremy Allison <jra@samba.org>
12 years agoBugfix for #8857 - Setting traverse rights fails to enable directory traversal when...
Jeremy Allison [Tue, 17 Apr 2012 01:17:25 +0000 (18:17 -0700)]
Bugfix for #8857 - Setting traverse rights fails to enable directory traversal when acl_xattr in use.

We were incorrectly checking the parent directory ACL, instead
of the ACL of the directory we're trying to open.

12 years agoFix incorrect debug - parent_name is never set !
Jeremy Allison [Tue, 17 Apr 2012 01:04:51 +0000 (18:04 -0700)]
Fix incorrect debug - parent_name is never set !

12 years agoFix bug #8831 - Inconsistent (with manpage) command-line switch for "help" in smbtree
Jeremy Allison [Fri, 30 Mar 2012 19:23:07 +0000 (12:23 -0700)]
Fix bug #8831 - Inconsistent (with manpage) command-line switch for "help" in smbtree

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Mar 30 22:59:53 CEST 2012 on sn-devel-104
(cherry picked from commit efd94d159883cb0841d8ac83223a1e63098a8d72)

12 years agoWrong assertion/comparison: Compare value not pointer
Olaf Flebbe [Thu, 12 Apr 2012 09:29:41 +0000 (11:29 +0200)]
Wrong assertion/comparison: Compare value not pointer

Fix bug #8859 (Wrong assertion: Checks pointer not value).