samba.git
11 years agontdb: remove --disable-ntdb.
Rusty Russell [Thu, 11 Apr 2013 07:42:16 +0000 (17:12 +0930)]
ntdb: remove --disable-ntdb.

Remove DISABLE_NTDB option, and --disable-ntdb from waf build.  This just
means that it will always get built: it isn't used by default yet.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr 13 02:01:02 CEST 2013 on sn-devel-104

11 years agosource4/cluster and source4/ntvfs: convert to dbwrap, add ntdb option.
Rusty Russell [Thu, 11 Apr 2013 07:42:15 +0000 (17:12 +0930)]
source4/cluster and source4/ntvfs: convert to dbwrap, add ntdb option.

This makes the code use dbwrap_local_open(), so it can handle
NTDB.

brlock.tdb, notify.tdb and openfiles.tdb can now be brlock.ntdb,
notify.ntdb and openfiles.ntdb, if 'use ntdb' is set.

Cc: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agoSamba3-HOWTO: mention NTDB.
Rusty Russell [Thu, 11 Apr 2013 07:42:14 +0000 (17:12 +0930)]
Samba3-HOWTO: mention NTDB.

Not sure if we're keeping this up-to-date, but try to document which
databases can be NTDB now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agoschannel_store.tdb: make it schannel_store.ntdb if 'use ntdb'.
Rusty Russell [Thu, 11 Apr 2013 07:42:13 +0000 (17:12 +0930)]
schannel_store.tdb: make it schannel_store.ntdb if 'use ntdb'.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibcli/auth: convert to dbwrap.
Rusty Russell [Thu, 11 Apr 2013 07:42:12 +0000 (17:12 +0930)]
libcli/auth: convert to dbwrap.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agosecrets: use lpcfg_private_db_path() convenience helper.
Rusty Russell [Thu, 11 Apr 2013 07:42:11 +0000 (17:12 +0930)]
secrets: use lpcfg_private_db_path() convenience helper.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolib/param: lpcfg_private_db_path()
Rusty Russell [Thu, 11 Apr 2013 07:42:10 +0000 (17:12 +0930)]
lib/param: lpcfg_private_db_path()

This wrapper avoids testing lpcfg_use_ntdb() everywhere.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agosource4/scripting/python/samba/samba3: handle ntdb files.
Rusty Russell [Thu, 11 Apr 2013 07:42:09 +0000 (17:12 +0930)]
source4/scripting/python/samba/samba3: handle ntdb files.

Upgrading old Samba 3 instances seems like a place where we don't have
to read ntdb files, but Andrew Bartlett points out that you can run a
Samba 4.0 and even a 4.1 'classic' domain and desire to migrate that
to the AD DC.

So make this upgrade code generic: if it finds an ntdb file, read
that, otherwise read the tdb file.

Cc: Jelmer Vernooij <jelmer@samba.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agoautoconf: build in NTDB.
Rusty Russell [Thu, 11 Apr 2013 07:42:08 +0000 (17:12 +0930)]
autoconf: build in NTDB.

I previously added -DDISABLE_NTDB to FLAGS, but lib/param/util.c
doesn't seem to be compiled with that flag, so it's really not a good
solution.

So instead, compile in ntdb for the autoconf build.  This means:

1) Add -DHAVE_CCAN to cflags.
2) Remove pyntdb from autoconf objects (which is what tdb does)
3) Remove -DDISABLE_NTDB
4) Add ntdb utility objects
5) Link in ntdb everywhere we link in tdb.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agoRemove dependency on detection of HAVE_DIRFD for use of fdopendir().
Jeremy Allison [Wed, 10 Apr 2013 23:30:10 +0000 (16:30 -0700)]
Remove dependency on detection of HAVE_DIRFD for use of fdopendir().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Apr 12 16:21:10 CEST 2013 on sn-devel-104

11 years agoRemove the "Ugly hack" that was the second use of dirfd().
Jeremy Allison [Wed, 10 Apr 2013 23:29:03 +0000 (16:29 -0700)]
Remove the "Ugly hack" that was the second use of dirfd().

The destructor does all the resource deallocation needed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agoIn the struct smb_Dir destructor, use the fsp back pointer to release resources.
Jeremy Allison [Wed, 10 Apr 2013 23:24:15 +0000 (16:24 -0700)]
In the struct smb_Dir destructor, use the fsp back pointer to release resources.

Removes one use of dirfd().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agoMaintain a back-pointer to the fsp in struct smb_Dir when opening with FDOPENDIR.
Jeremy Allison [Wed, 10 Apr 2013 23:21:39 +0000 (16:21 -0700)]
Maintain a back-pointer to the fsp in struct smb_Dir when opening with FDOPENDIR.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agolibsmbclient: Use async cli_full_connection in python connection setup
Volker Lendecke [Tue, 9 Apr 2013 10:15:02 +0000 (12:15 +0200)]
libsmbclient: Use async cli_full_connection in python connection setup

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Apr 12 03:07:10 CEST 2013 on sn-devel-104

11 years agolibsmbclient: Make cli_full_connection async
Volker Lendecke [Fri, 5 Apr 2013 12:55:26 +0000 (14:55 +0200)]
libsmbclient: Make cli_full_connection async

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Make cli_tree_connect async
Volker Lendecke [Sat, 6 Apr 2013 08:57:41 +0000 (10:57 +0200)]
libsmbclient: Make cli_tree_connect async

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Make cli_raw_tcon async
Volker Lendecke [Fri, 5 Apr 2013 13:29:14 +0000 (15:29 +0200)]
libsmbclient: Make cli_raw_tcon async

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Streamline cli_openx a bit
Volker Lendecke [Fri, 5 Apr 2013 13:09:02 +0000 (15:09 +0200)]
libsmbclient: Streamline cli_openx a bit

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Use tevent_req_poll_ntstatus in cli_openx
Volker Lendecke [Fri, 5 Apr 2013 13:08:22 +0000 (15:08 +0200)]
libsmbclient: Use tevent_req_poll_ntstatus in cli_openx

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Streamline cli_tcon_andx a bit
Volker Lendecke [Fri, 5 Apr 2013 13:02:51 +0000 (15:02 +0200)]
libsmbclient: Streamline cli_tcon_andx a bit

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Use tevent_req_poll_ntstatus in cli_tcon_andx
Volker Lendecke [Fri, 5 Apr 2013 12:58:02 +0000 (14:58 +0200)]
libsmbclient: Use tevent_req_poll_ntstatus in cli_tcon_andx

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Make cli_start_connection async
Volker Lendecke [Fri, 5 Apr 2013 10:42:01 +0000 (12:42 +0200)]
libsmbclient: Make cli_start_connection async

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Remove unused cli_connect_sock
Volker Lendecke [Thu, 4 Apr 2013 14:56:43 +0000 (16:56 +0200)]
libsmbclient: Remove unused cli_connect_sock

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Add async cli_connect_nb
Volker Lendecke [Thu, 4 Apr 2013 14:55:48 +0000 (16:55 +0200)]
libsmbclient: Add async cli_connect_nb

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Avoid a talloc_strdup in cli_connect_nb
Volker Lendecke [Thu, 4 Apr 2013 13:01:25 +0000 (15:01 +0200)]
libsmbclient: Avoid a talloc_strdup in cli_connect_nb

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Make cli_connect_sock async
Volker Lendecke [Thu, 4 Apr 2013 12:36:51 +0000 (14:36 +0200)]
libsmbclient: Make cli_connect_sock async

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Remove unused sync wrappers
Volker Lendecke [Tue, 2 Apr 2013 11:39:05 +0000 (13:39 +0200)]
libsmbclient: Remove unused sync wrappers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Add async cli_session_setup
Volker Lendecke [Tue, 2 Apr 2013 11:37:30 +0000 (13:37 +0200)]
libsmbclient: Add async cli_session_setup

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Remove unused cli_session_setup_ntlmssp()
Volker Lendecke [Tue, 2 Apr 2013 10:50:43 +0000 (12:50 +0200)]
libsmbclient: Remove unused cli_session_setup_ntlmssp()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Add async cli_session_setup_ntlmssp
Volker Lendecke [Sat, 9 Mar 2013 12:07:57 +0000 (13:07 +0100)]
libsmbclient: Add async cli_session_setup_ntlmssp

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Factor out cli_session_setup_get_account
Volker Lendecke [Sat, 9 Mar 2013 08:53:42 +0000 (09:53 +0100)]
libsmbclient: Factor out cli_session_setup_get_account

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Slightly simplify cli_session_setup_spnego
Volker Lendecke [Fri, 8 Mar 2013 18:41:07 +0000 (19:41 +0100)]
libsmbclient: Slightly simplify cli_session_setup_spnego

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Factor out cli_session_setup_get_principal
Volker Lendecke [Fri, 8 Mar 2013 16:21:13 +0000 (17:21 +0100)]
libsmbclient: Factor out cli_session_setup_get_principal

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Avoid a data copy
Volker Lendecke [Fri, 8 Mar 2013 14:55:51 +0000 (15:55 +0100)]
libsmbclient: Avoid a data copy

spnego_parse_negTokenInit does a asn_load of that blob, which does a data copy
itself. So we don't have to had it a copy as well.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Fix a leak on talloc_tos()
Volker Lendecke [Fri, 8 Mar 2013 16:40:54 +0000 (17:40 +0100)]
libsmbclient: Fix a leak on talloc_tos()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agoEnsure we test the dirsort module in make test.
Jeremy Allison [Tue, 9 Apr 2013 23:56:24 +0000 (16:56 -0700)]
Ensure we test the dirsort module in make test.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Apr 11 21:17:21 CEST 2013 on sn-devel-104

11 years agoRemove unneeded initializations (we already talloc_zero).
Jeremy Allison [Tue, 9 Apr 2013 18:02:58 +0000 (11:02 -0700)]
Remove unneeded initializations (we already talloc_zero).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agoRemove the use of dirfd inside the vfs_dirsort.c.
Jeremy Allison [Tue, 9 Apr 2013 17:50:55 +0000 (10:50 -0700)]
Remove the use of dirfd inside the vfs_dirsort.c.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agoConvert mtime from a time_t to a struct timespec.
Jeremy Allison [Tue, 9 Apr 2013 17:43:53 +0000 (10:43 -0700)]
Convert mtime from a time_t to a struct timespec.

In preparation for removing the dirfd and using fsp_stat()
and VFS_STAT functions.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agoCheck SMB_VFS_NEXT_OPENDIR return in dirsort_opendir().
Jeremy Allison [Tue, 9 Apr 2013 17:38:24 +0000 (10:38 -0700)]
Check SMB_VFS_NEXT_OPENDIR return in dirsort_opendir().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agoClean error paths in opendir and fd_opendir by only setting handle data on success.
Jeremy Allison [Tue, 9 Apr 2013 17:29:47 +0000 (10:29 -0700)]
Clean error paths in opendir and fd_opendir by only setting handle data on success.

Pass extra struct dirsort_privates * to open_and_sort_dir() function
to avoid it having to re-read the handle data.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agoProtect open_and_sort_dir() from the directory changing size.
Jeremy Allison [Mon, 8 Apr 2013 23:40:35 +0000 (16:40 -0700)]
Protect open_and_sort_dir() from the directory changing size.

Otherwise there could be an error between initial count, allocation
and re-read.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agoUse an index i rather than re-using a state variable.
Jeremy Allison [Mon, 8 Apr 2013 23:38:03 +0000 (16:38 -0700)]
Use an index i rather than re-using a state variable.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agoProtect against early error in SMB_VFS_NEXT_READDIR.
Jeremy Allison [Mon, 8 Apr 2013 23:31:53 +0000 (16:31 -0700)]
Protect against early error in SMB_VFS_NEXT_READDIR.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agoChange source3/modules/vfs_dirsort.c from MALLOC -> TALLOC.
Jeremy Allison [Mon, 8 Apr 2013 22:11:28 +0000 (15:11 -0700)]
Change source3/modules/vfs_dirsort.c from MALLOC -> TALLOC.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agoscripting-provision: Do not enforce domain != realm if we are joining an existing...
Andrew Bartlett [Fri, 5 Apr 2013 01:01:17 +0000 (12:01 +1100)]
scripting-provision: Do not enforce domain != realm if we are joining an existing domain

This will allow us users to join existing oddly named domains without
objection from provision.

Andrew Bartlett

Reviewed-by: Matthieu Patou <mat@matws.net>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Apr 11 10:41:02 CEST 2013 on sn-devel-104

11 years agobuild: Raise minimum python version to 2.5.0 for samba build
Andrew Bartlett [Mon, 8 Apr 2013 07:25:27 +0000 (17:25 +1000)]
build: Raise minimum python version to 2.5.0 for samba build

RHEL5 has a python26 package for a modern python, and was the main reason we
kept python 2.5 support.

However, this support never actually worked for AD DC installations,
as samba-tool uses a feature only in 2.5 and above.  Very few folks
noticed and those were on RHEL5, and moving to 2.5 allows us to remove
some other workarounds.

Andrew Bartlett

Reviewed-by: Matthieu Patou <mat@matws.net>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 years agoAvoid leaking temp file if an exception is raised
Jean Raby [Thu, 11 Apr 2013 01:33:34 +0000 (21:33 -0400)]
Avoid leaking temp file if an exception is raised

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Apr 11 06:06:03 CEST 2013 on sn-devel-104

11 years agos3:smbd: do not access data behind req->buf+req->buflen in srvstr_pull_req_talloc()
Ralph Wuerthner [Thu, 4 Apr 2013 11:29:01 +0000 (13:29 +0200)]
s3:smbd: do not access data behind req->buf+req->buflen in srvstr_pull_req_talloc()

Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Apr 10 02:03:13 CEST 2013 on sn-devel-104

11 years agos3:smbd: convert srvstr_pull_req_talloc() into a function
Ralph Wuerthner [Thu, 4 Apr 2013 11:24:36 +0000 (13:24 +0200)]
s3:smbd: convert srvstr_pull_req_talloc() into a function

Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
11 years agos3:smbd: do not access data behind req->buf+req->buflen in srvstr_get_path_req_wcard()
Ralph Wuerthner [Thu, 4 Apr 2013 10:59:36 +0000 (12:59 +0200)]
s3:smbd: do not access data behind req->buf+req->buflen in srvstr_get_path_req_wcard()

Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
11 years agopython-samba-tool domain classicupgrade: Make failure to connect directly to the...
Andrew Bartlett [Fri, 5 Apr 2013 04:23:20 +0000 (15:23 +1100)]
python-samba-tool domain classicupgrade: Make failure to connect directly to the LDAP backend fatal

This is better than failing just a little further down the stack with a useless error
about use-before-set.

Andrew Bartlett

Reviewed-by: Michael Adam <obnox@samba.org>
11 years agobuild: Remove extra space in shebang
Andrew Bartlett [Sun, 7 Apr 2013 22:33:55 +0000 (08:33 +1000)]
build: Remove extra space in shebang

Reviewed-by: Michael Adam <obnox@samba.org>
11 years agobuild: Replace #!/usr/bin/env python with passed in PYTHON=
Andrew Bartlett [Mon, 8 Apr 2013 05:57:45 +0000 (15:57 +1000)]
build: Replace #!/usr/bin/env python with passed in PYTHON=

This means that if we were forced to use a specific python for the build, we
will put that binary into the top of samba-tool, so it continues to work
after the install.

Andrew Bartlett

Reviewed-by: Michael Adam <obnox@samba.org>
11 years agovfs_fake_perms: Fix bug 9775, segfault for "artificial" conn_structs
Volker Lendecke [Tue, 9 Apr 2013 19:18:34 +0000 (21:18 +0200)]
vfs_fake_perms: Fix bug 9775, segfault for "artificial" conn_structs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 10 00:12:06 CEST 2013 on sn-devel-104

11 years agovfs_fake_perms: Slightly streamline code
Volker Lendecke [Tue, 9 Apr 2013 19:07:23 +0000 (21:07 +0200)]
vfs_fake_perms: Slightly streamline code

Don't initialize a variable directly set

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agovfs_fake_perms: Slightly streamline code
Volker Lendecke [Tue, 9 Apr 2013 19:07:23 +0000 (21:07 +0200)]
vfs_fake_perms: Slightly streamline code

Do an early error return

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agos3-netlogon: enumerate UPN suffixes from PASSDB when available
Alexander Bokovoy [Wed, 3 Apr 2013 13:52:45 +0000 (16:52 +0300)]
s3-netlogon: enumerate UPN suffixes from PASSDB when available

Optionally append list of UPN suffixes if PDB module returns non-empty one.

Refactor fill_forest_trust_array() in source3 to allow reuse of the code between
_netr_DsRGetForestTrustInformation() and _netr_GetForestTrustInformation()

Implement a special case of _netr_DsRGetForestTrustInformation in smbd
when trusted_domain_name is NULL (covered by test_DsrEnumerateDomainTrusts()
in rpc.netlogon torture tests, see comment in source4/torture/rpc/netlogon.c).

Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Apr  9 22:19:34 CEST 2013 on sn-devel-104

11 years agoPASSDB: add support to set and enumerate UPN suffixes associated with our forest
Alexander Bokovoy [Wed, 3 Apr 2013 13:37:00 +0000 (16:37 +0300)]
PASSDB: add support to set and enumerate UPN suffixes associated with our forest

Samba PDC may manage a forest containing DNS domains in addition to the primary one.
Information about them is advertised via netr_DsRGetForestTrustInformation when
trusted_domain_name is NULL, according to MS-NRPC and MS-LSAD, and
via netr_GetForestTrustInformation.

This changeset only expands PASSDB API; how suffixes are maintained is left
to specific PDB modules. Set function is added so that suffixes could be
managed through 'net' and other Samba utilities, if possible.

One possible implementation is available for ipasam module in FreeIPA:
http://git.fedorahosted.org/cgit/freeipa.git/commit/?id=cc56723151c9ebf58d891e85617319d861af14a4

Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agos3-waf: filter out ldapsam internal init functions
Alexander Bokovoy [Wed, 3 Apr 2013 13:01:34 +0000 (16:01 +0300)]
s3-waf: filter out ldapsam internal init functions

pdb_ldapsam_init* functions (init and init_common) are used in
pdb_ipa.c and pdb_nds.c which are always linked together with
pdb_ldap.c where pdb_ldapsam_init* functions reside.

Tested with both ldapsam integrated (into libpdb) and as
a separate module.

Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agowafsamba: fix samba_abi for default catch-all case
Alexander Bokovoy [Wed, 3 Apr 2013 12:52:06 +0000 (15:52 +0300)]
wafsamba: fix samba_abi for default catch-all case

Only filter out the symbol when positive match was not found and there is
negative match.

ABI signature file generator worked incorrectly for cases when mixture of
positive and negative matches were provided. This resulted in generating empty
signature file for libpdb since there was no catch-all positive match anymore.

Commit 9ba44cc610426fb558b49aa9680b5bdf55c29082 removed explicit '*' positive
match and corresponding vscript generator adds '*' by default if global match
list is empty, so this commit introduces feature parity into signature
generator.

Reviewed-by: Andreas Schneider <asn@samba.org>
11 years agowinbindd: Avoid a fd leak when we can not fork
Volker Lendecke [Tue, 9 Apr 2013 14:37:29 +0000 (16:37 +0200)]
winbindd: Avoid a fd leak when we can not fork

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Jim McDonough <jmcd@samba.org>
Autobuild-User(master): Jim McDonough <jmcd@samba.org>
Autobuild-Date(master): Tue Apr  9 20:27:27 CEST 2013 on sn-devel-104

11 years agopylibsmb: Avoid a segfault if no credentials are passed to libsmb.Conn()
Volker Lendecke [Tue, 9 Apr 2013 12:29:11 +0000 (14:29 +0200)]
pylibsmb: Avoid a segfault if no credentials are passed to libsmb.Conn()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Autobuild-User(master): Richard Sharpe <sharpe@samba.org>
Autobuild-Date(master): Tue Apr  9 18:30:06 CEST 2013 on sn-devel-104

11 years agoBUG 9766: Cache name_to_sid/sid_to_name correctly.
Andreas Schneider [Thu, 4 Apr 2013 10:18:25 +0000 (12:18 +0200)]
BUG 9766: Cache name_to_sid/sid_to_name correctly.

If there is no domain_name specified we still need to set to for
caching else we will not find the entry later if we lookup the entry
with the domain_name.

Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Tue Apr  9 16:32:44 CEST 2013 on sn-devel-104

11 years agoBUG 9139: Fix the username map optimization.
Andreas Schneider [Fri, 5 Apr 2013 12:07:37 +0000 (14:07 +0200)]
BUG 9139: Fix the username map optimization.

If we successfully map a user. We call

set_last_from_to(user_in, unixname);

in the while loop reading the map file. After a successfull map we don't
stop and continue the loop to check all other mappings in the username
mapfile. But when we hit the end of the file and leave the loop we call:

set_last_from_to(user_in, user_in);

This overwrites the successful mapping, and the next time we call
map_username() we skip the username and no mapping is done.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
11 years agodoc: Document performance impact of "hide unxx" parameters
Volker Lendecke [Fri, 5 Apr 2013 14:44:08 +0000 (16:44 +0200)]
doc: Document performance impact of "hide unxx" parameters

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Fri Apr  5 18:40:58 CEST 2013 on sn-devel-104

11 years agogetpass: Don't fail if stdin is not a tty
Stef Walter [Thu, 4 Apr 2013 13:55:10 +0000 (15:55 +0200)]
getpass: Don't fail if stdin is not a tty

We don't need to manipulate the tty state (such as turning off
echo) when prompting for passwords if we're not reading from a tty.

Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Autobuild-Date(master): Fri Apr  5 07:34:37 CEST 2013 on sn-devel-104

11 years agotevent: Only set poll_ev->delete=false if it was true
Volker Lendecke [Thu, 4 Apr 2013 08:23:02 +0000 (10:23 +0200)]
tevent: Only set poll_ev->delete=false if it was true

Might not be noticable, but I thought it would be an obvious tiny
optimization. Possibly the compiler already does this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Apr  4 18:32:39 CEST 2013 on sn-devel-104

11 years agoBUG 9699: Fix adding case sensitive spn.
Andreas Schneider [Wed, 3 Apr 2013 13:46:00 +0000 (15:46 +0200)]
BUG 9699: Fix adding case sensitive spn.

We should be able to define the case of the spn cause it is important
for some services like nfs. 'net ads keytab add "nfs"' should not
result in an uppercase spn.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr  3 23:57:32 CEST 2013 on sn-devel-104

11 years agoccan: fix HAVE_BSWAP_64 for autoconf.
Rusty Russell [Tue, 2 Apr 2013 06:30:01 +0000 (17:00 +1030)]
ccan: fix HAVE_BSWAP_64 for autoconf.

Autoconf defines HAVE_BSWAP_64_DECL, we want HAVE_BSWAP_64.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agolibsmbclient: Fix cli_session_setup_guest_send
Volker Lendecke [Wed, 3 Apr 2013 11:24:53 +0000 (13:24 +0200)]
libsmbclient: Fix cli_session_setup_guest_send

This worked fine so far, but for the wrong reason: We only ever called
this through the sync wrapper. The tevent_req_nterror in the NT_STATUS_OK
case does not call tevent_req_finish. So the tevent_loop_poll did call
into the core send/receive smb code. This is a fix for the case when
smb1cli_req_chain_submit fails for some reason.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Apr  3 18:39:30 CEST 2013 on sn-devel-104

11 years agontvfs: support setfileinfo with FULL_EA_INFORMATION
David Disseldorp [Wed, 3 Apr 2013 12:01:00 +0000 (14:01 +0200)]
ntvfs: support setfileinfo with FULL_EA_INFORMATION

Use existing unmarshall and set helper functions. This allows the
smb2.setinfo.setinfo test to run against the ntvfs file server.

Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Apr  3 16:14:33 CEST 2013 on sn-devel-104

11 years agos3:wscript: change --with-dmapi to default=auto to match the autoconf build
Stefan Metzmacher [Fri, 22 Mar 2013 08:39:42 +0000 (09:39 +0100)]
s3:wscript: change --with-dmapi to default=auto to match the autoconf build

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Apr  3 11:45:12 CEST 2013 on sn-devel-104

11 years agowafsamba: display the default value in help for SAMBA3_ADD_OPTION
Stefan Metzmacher [Fri, 22 Mar 2013 08:37:09 +0000 (09:37 +0100)]
wafsamba: display the default value in help for SAMBA3_ADD_OPTION

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
11 years agos3:modules: fix the build of vfs_notify_fam (bug #9545)
Stefan Metzmacher [Fri, 22 Mar 2013 08:30:05 +0000 (09:30 +0100)]
s3:modules: fix the build of vfs_notify_fam (bug #9545)

This adds the --with-fam option and configure checks.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
11 years agos3:lib/server_mutex: open mutex.tdb with CLEAR_IF_FIRST
Stefan Metzmacher [Thu, 28 Mar 2013 10:04:31 +0000 (11:04 +0100)]
s3:lib/server_mutex: open mutex.tdb with CLEAR_IF_FIRST

/var/lock/samba is typically on tpmfs.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
11 years agos3:lib/gencache: place gencache.tdb into /var/cache/samba
Stefan Metzmacher [Thu, 28 Mar 2013 10:00:27 +0000 (11:00 +0100)]
s3:lib/gencache: place gencache.tdb into /var/cache/samba

/var/lock/samba is located on tmpfs on newer systems,
but we want to keep things like the server affinity cache
across reboots.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
11 years agoEnsure EA value is allocated on the right context.
Jeremy Allison [Thu, 28 Mar 2013 15:55:11 +0000 (08:55 -0700)]
Ensure EA value is allocated on the right context.

Ensure we free on error condition (tidyup, not a leak).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Tue Apr  2 21:54:33 CEST 2013 on sn-devel-104

11 years agoFinal fix for bug #9130 - Certain xattrs cause Windows error 0x800700FF
Jeremy Allison [Wed, 27 Mar 2013 18:54:34 +0000 (11:54 -0700)]
Final fix for bug #9130 - Certain xattrs cause Windows error 0x800700FF

The spec lies when it says that NextEntryOffset is the only value
considered when finding the next EA. We were adding 4 more extra
pad bytes than needed (i.e. if the next entry already was on a 4
byte boundary, then we were adding 4 additional pad bytes).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
11 years agoEnsure we don't return uninitialized memory in the pad bytes.
Jeremy Allison [Tue, 26 Mar 2013 23:46:51 +0000 (16:46 -0700)]
Ensure we don't return uninitialized memory in the pad bytes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
11 years agoAdd a test to show that zero-length EA's are never returned over SMB2.
Jeremy Allison [Tue, 26 Mar 2013 20:26:49 +0000 (13:26 -0700)]
Add a test to show that zero-length EA's are never returned over SMB2.

Zero length EA's only delete an EA, never store. Proves we should
never return zero-length EA's even if they have been set on the
POSIX side.

ntvfs server doesn't implement the FULL_EA_INFORMATION setinfo
call, so add to selftest/knownfail.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
11 years agoFix bug #9130 - Certain xattrs cause Windows error 0x800700FF
Jeremy Allison [Tue, 26 Mar 2013 23:38:00 +0000 (16:38 -0700)]
Fix bug #9130 - Certain xattrs cause Windows error 0x800700FF

Ensure ntvfs server never returns zero length EA's.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
11 years agoFix bug #9130 - Certain xattrs cause Windows error 0x800700FF
Jeremy Allison [Tue, 26 Mar 2013 23:37:22 +0000 (16:37 -0700)]
Fix bug #9130 - Certain xattrs cause Windows error 0x800700FF

Ensure we never return any zero-length EA's.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
11 years agoChange estimate_ea_size() to correctly estimate the EA size over SMB2.
Jeremy Allison [Tue, 26 Mar 2013 22:54:31 +0000 (15:54 -0700)]
Change estimate_ea_size() to correctly estimate the EA size over SMB2.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
11 years agoModify fill_ea_chained_buffer() to be able to do size calculation only, no marshalling.
Jeremy Allison [Tue, 26 Mar 2013 22:46:06 +0000 (15:46 -0700)]
Modify fill_ea_chained_buffer() to be able to do size calculation only, no marshalling.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
11 years agoEnsure we can never return an uninitialized EA list.
Jeremy Allison [Fri, 29 Mar 2013 17:07:20 +0000 (10:07 -0700)]
Ensure we can never return an uninitialized EA list.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@suse.de>
11 years agoAdd a comment about why we are removing the INHERITED bit so people understand.
Richard Sharpe [Tue, 2 Apr 2013 13:48:03 +0000 (06:48 -0700)]
Add a comment about why we are removing the INHERITED bit so people understand.

Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Apr  2 20:05:13 CEST 2013 on sn-devel-104

11 years agoBUG 9758: Don't leak the epm_Map policy handle.
Andreas Schneider [Tue, 2 Apr 2013 11:08:19 +0000 (13:08 +0200)]
BUG 9758: Don't leak the epm_Map policy handle.

Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Autobuild-Date(master): Tue Apr  2 17:16:56 CEST 2013 on sn-devel-104

11 years agoepm: Increase debug level for already registered endpoints.
Andreas Schneider [Tue, 2 Apr 2013 11:09:13 +0000 (13:09 +0200)]
epm: Increase debug level for already registered endpoints.

Reviewed-by: Alexander Bokovoy <ab@samba.org>
11 years agoFix bad SMB2 opcode reading in server.
Jeremy Allison [Tue, 2 Apr 2013 03:11:26 +0000 (20:11 -0700)]
Fix bad SMB2 opcode reading in server.

SMB2 opcodes are 16-bit values. We should *never*
be reading them with IVAL(inhdr, SMB2_HDR_OPCODE),
it should always be SVAL(inhdr, SMB2_HDR_OPCODE).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Autobuild-User(master): Richard Sharpe <sharpe@samba.org>
Autobuild-Date(master): Tue Apr  2 07:28:48 CEST 2013 on sn-devel-104

11 years agoMake sure that we only propogate the INHERITED flag when we are allowed to.
Richard Sharpe [Thu, 28 Mar 2013 02:36:43 +0000 (19:36 -0700)]
Make sure that we only propogate the INHERITED flag when we are allowed to.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 28 19:43:41 CET 2013 on sn-devel-104

11 years agoOptimization suggested by Volker. Don't do a stat system call on normal read path.
Jeremy Allison [Mon, 25 Mar 2013 16:54:50 +0000 (09:54 -0700)]
Optimization suggested by Volker. Don't do a stat system call on normal read path.

Only do it if we need it in the sendfile() path.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Mar 28 17:51:22 CET 2013 on sn-devel-104

11 years agolibcli/auth: avoid using transactions a chainlock is enough
Stefan Metzmacher [Wed, 27 Mar 2013 07:43:18 +0000 (08:43 +0100)]
libcli/auth: avoid using transactions a chainlock is enough

We're just writting a single record into a CLEAR_IF_FIRST|TDB_NOSYNC
tdb.

We just need to make sure we lock the record between reading and writting.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Mar 28 14:52:14 CET 2013 on sn-devel-104

11 years agoCall smb_panic when we try to exit the server uncleanly. This gives us the normal...
Richard Sharpe [Wed, 27 Mar 2013 03:17:11 +0000 (20:17 -0700)]
Call smb_panic when we try to exit the server uncleanly. This gives us the normal traceback and memory dump, but also runs the normal panic action.

Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Mar 27 22:58:37 CET 2013 on sn-devel-104

11 years agoauth/ntlmssp: Avoid use-after-free of user_info after logon failure at log level 5
Andrew Bartlett [Fri, 15 Mar 2013 02:00:55 +0000 (13:00 +1100)]
auth/ntlmssp: Avoid use-after-free of user_info after logon failure at log level 5

Reviewed-by: Jeremy Allison <jra@samba.org>
11 years agodbwrap: Add a comment explaining a restriction
Volker Lendecke [Wed, 27 Mar 2013 09:23:50 +0000 (10:23 +0100)]
dbwrap: Add a comment explaining a restriction

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Mar 27 13:40:15 CET 2013 on sn-devel-104

11 years agosmbd: Remove an optimization that became unnecessary
Volker Lendecke [Wed, 31 Oct 2012 12:13:50 +0000 (13:13 +0100)]
smbd: Remove an optimization that became unnecessary

After we only collect nonlocal vnns in idx_state.vnns now, at this point
we *know* we have something to send to a remote node. The previous code
avoided the call to notify_push_remote_blob with an if-statement that
has now become unnecessary.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Mar 26 13:16:39 CET 2013 on sn-devel-104

11 years agosmbd: We don't collect our own vnn anymore
Volker Lendecke [Wed, 31 Oct 2012 12:11:19 +0000 (13:11 +0100)]
smbd: We don't collect our own vnn anymore

notify_trigger_index_parser will not anymore add ourselves into the vnn
list that it collects.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agosmbd: Slightly simplify notify_trigger
Volker Lendecke [Wed, 31 Oct 2012 12:10:12 +0000 (13:10 +0100)]
smbd: Slightly simplify notify_trigger

We have a good chance that we did not collect any remote vnns. This
avoids trying to walk the remote vnns altogether.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agosmbd: Slightly simplify notify_trigger
Volker Lendecke [Wed, 31 Oct 2012 12:08:18 +0000 (13:08 +0100)]
smbd: Slightly simplify notify_trigger

This straightens the for-loop walking the path components slightly

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>