ddiss/samba.git
11 years agos3-printing: fix broken print_job_get_name() return bso8719_smbd_spooler_rb1_36t
David Disseldorp [Tue, 26 Jun 2012 23:23:57 +0000 (01:23 +0200)]
s3-printing: fix broken print_job_get_name() return

11 years agos3-torture: Use static printer for smbd spooler test
David Disseldorp [Fri, 22 Jun 2012 16:49:50 +0000 (18:49 +0200)]
s3-torture: Use static printer for smbd spooler test

11 years agos3-printing: use euid for vlp job tracking
David Disseldorp [Thu, 21 Jun 2012 13:49:55 +0000 (15:49 +0200)]
s3-printing: use euid for vlp job tracking

vlp can be called by print_run_command as root with euids set
appropriately, vlp should use this to track the job owner.

11 years agos3-printing: fill print_generic sysjob id on job submission
David Disseldorp [Thu, 9 Feb 2012 11:08:27 +0000 (12:08 +0100)]
s3-printing: fill print_generic sysjob id on job submission

Change the generic print backend to fill the printing backend job
identifier (sysjob) on submission of a new job.
This is needed to ensure correct mapping of spoolss jobs and entries in
the backend print queue.

This and the last 13 commits attempt to address bug 8719.

11 years agos3-printing: pass lpq command to job_submit
David Disseldorp [Wed, 8 Feb 2012 17:47:11 +0000 (18:47 +0100)]
s3-printing: pass lpq command to job_submit

Currently the generic print backend does not fill the printing backend
job identifier (sysjob) on submission of a new job. The sysjob
identifier is required to correctly map jobs in the printer queue to
corresponding spoolss print jobs.

Passing the lpq command to job_submit allows the generic print backend
to check the printer queue for the new job following submission. This
behaviour will come in a later commit.

11 years agos3-printing: remove unused print_job_fname()
David Disseldorp [Wed, 8 Feb 2012 16:03:06 +0000 (17:03 +0100)]
s3-printing: remove unused print_job_fname()

11 years agos3-printing: pass a talloc ctx to unpack_pjob
David Disseldorp [Wed, 8 Feb 2012 16:57:02 +0000 (17:57 +0100)]
s3-printing: pass a talloc ctx to unpack_pjob

Rather than allocating the devicemode on a null context.

11 years agos3-printing: return talloced print jobs
David Disseldorp [Wed, 8 Feb 2012 15:55:40 +0000 (16:55 +0100)]
s3-printing: return talloced print jobs

print_job_find() currently returns print jobs to callers via a
statically allocated variable, this is particularly messy as the
device mode is talloced under the static variable.

This change adds or passes a talloc context to all callers, giving them
ownership of the returned print job.

11 years agos3-printing: clean up print_job_pause/resume interface
David Disseldorp [Wed, 8 Feb 2012 14:01:15 +0000 (15:01 +0100)]
s3-printing: clean up print_job_pause/resume interface

Currently both return a bool and sometimes set a werr pointer argument,
always return werror instead.

11 years agos3-printing: fix potential print db refcount leak
David Disseldorp [Wed, 8 Feb 2012 12:45:40 +0000 (13:45 +0100)]
s3-printing: fix potential print db refcount leak

11 years agos3-spoolss: remove duplicate "." in smbd spooler path
David Disseldorp [Wed, 1 Feb 2012 12:21:04 +0000 (13:21 +0100)]
s3-spoolss: remove duplicate "." in smbd spooler path

11 years agos3-printing: remove print_parse_jobid()
David Disseldorp [Mon, 30 Jan 2012 16:35:28 +0000 (17:35 +0100)]
s3-printing: remove print_parse_jobid()

With all callers fixed, it is now safe to remove.

11 years agos3-printing: remove redundant variable set
David Disseldorp [Mon, 30 Jan 2012 15:05:21 +0000 (16:05 +0100)]
s3-printing: remove redundant variable set

11 years agos3-printing: remove print_parse_jobid() calls from printing.c
David Disseldorp [Mon, 30 Jan 2012 12:35:21 +0000 (13:35 +0100)]
s3-printing: remove print_parse_jobid() calls from printing.c

In all cases the spoolss layer job id can be determinded from the
printing subsystem allocated job identifier (sysjob).

11 years agos3-printing: rename queue->job sysjob
David Disseldorp [Fri, 27 Jan 2012 11:33:27 +0000 (12:33 +0100)]
s3-printing: rename queue->job sysjob

Print jobs maintain two job identifiers, the jobid allocated by the
spoolss layer (pj->jobid), and the job identifier defined by the
printing backend (pj->sysjob).

Printer job queues currently only contain a single job identifier
variable (queue->job), the variable is sometimes representative of the
spoolss layer job identifier, and more often representative of the
printing backend id.

This change renames the queue job identifier from queue->job to
queue->sysjob, in preparation for a change to only store the printing
backend identifier.

11 years agos3-printing: remove print_parse_jobid() from print_cups.c
David Disseldorp [Mon, 30 Jan 2012 12:44:33 +0000 (13:44 +0100)]
s3-printing: remove print_parse_jobid() from print_cups.c

The spoolss print job identifier is now passed to the cups layer via
struct printjob, therefore it is no longer necessary to parse the job
filename to determine it.

11 years agos3-printing: store print jobid as part of struct printjob
David Disseldorp [Thu, 26 Jan 2012 14:28:34 +0000 (15:28 +0100)]
s3-printing: store print jobid as part of struct printjob

Printing code in some places relies upon the spool-file format to
retrieve the print jobid. By storing the jobid as part of struct
printjob, and hence in the printing TDB, we can move away from this ugly
behaviour.

11 years agotorture: add test for smbd print job spooling
David Disseldorp [Thu, 21 Jun 2012 15:12:23 +0000 (17:12 +0200)]
torture: add test for smbd print job spooling

Clients can print by performing file IO on a printer share, rather than
issuing spoolss RPCs.
This commit attempts to reproduce bug 8719.

11 years agoWHATSNEW: Break line properly.
Karolin Seeger [Sun, 24 Jun 2012 17:19:19 +0000 (19:19 +0200)]
WHATSNEW: Break line properly.

Karolin

11 years agoWHATSNEW: Add more changes since 3.6.5.
Karolin Seeger [Sat, 23 Jun 2012 19:58:06 +0000 (21:58 +0200)]
WHATSNEW: Add more changes since 3.6.5.

Karolin

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)

11 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

11 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>
11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)

11 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)