kai/samba.git
8 years agos4:winbind/wb_init_domain: use DCERPC_SCHANNEL_128 in order to work against w2k8r2
Stefan Metzmacher [Wed, 22 Jun 2011 16:25:30 +0000 (18:25 +0200)]
s4:winbind/wb_init_domain: use DCERPC_SCHANNEL_128 in order to work against w2k8r2

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Wed Jun 22 19:40:47 CEST 2011 on sn-devel-104

8 years agos4:ntvfs/cifs: add option to use S4U2Proxy
Stefan Metzmacher [Fri, 11 Mar 2011 07:32:22 +0000 (08:32 +0100)]
s4:ntvfs/cifs: add option to use S4U2Proxy

Note: this doesn't work against a Samba4 KDC yet.

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Wed Jun 22 18:17:43 CEST 2011 on sn-devel-104

8 years agos4:auth/kerberos: protect kerberos_kinit_password_cc() against old KDCs
Stefan Metzmacher [Tue, 21 Jun 2011 09:05:15 +0000 (11:05 +0200)]
s4:auth/kerberos: protect kerberos_kinit_password_cc() against old KDCs

If the KDC does not support S4U2Proxy, it might return a ticket
for the TGT client principal.

metze

8 years agos4:auth/kerberos: add S4U2Proxy support to kerberos_kinit_password_cc()
Stefan Metzmacher [Mon, 20 Jun 2011 18:28:44 +0000 (20:28 +0200)]
s4:auth/kerberos: add S4U2Proxy support to kerberos_kinit_password_cc()

For S4U2Proxy we need to use the ticket from the S4U2Self stage
and ask the kdc for the delegated ticket for the target service.

metze

8 years agoUpdate eDirectory schema
Jim McDonough [Wed, 22 Jun 2011 11:36:20 +0000 (07:36 -0400)]
Update eDirectory schema

Autobuild-User: Jim McDonough <jmcd@samba.org>
Autobuild-Date: Wed Jun 22 14:48:09 CEST 2011 on sn-devel-104

8 years agos4-dsdb: bypass validation when relax set
Andrew Tridgell [Wed, 22 Jun 2011 08:14:14 +0000 (18:14 +1000)]
s4-dsdb: bypass validation when relax set

this allows dbcheck to fix bad attributes

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Wed Jun 22 12:27:06 CEST 2011 on sn-devel-104

8 years agosamba-tool: allow for running dbcheck against a remove ldap server
Andrew Tridgell [Wed, 22 Jun 2011 07:38:19 +0000 (17:38 +1000)]
samba-tool: allow for running dbcheck against a remove ldap server

this is useful for running it against a Windows server

8 years agosamba-tool: expanded dbcheck DN checking
Andrew Tridgell [Wed, 22 Jun 2011 07:08:28 +0000 (17:08 +1000)]
samba-tool: expanded dbcheck DN checking

this now checks for bad GUID elements in DN links, and offers to fix
them when possible

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

8 years agos4-dsdb: prioritise GUID in extended_dn_in
Andrew Tridgell [Wed, 22 Jun 2011 07:07:39 +0000 (17:07 +1000)]
s4-dsdb: prioritise GUID in extended_dn_in

if we search with a base DN that has both a GUID and a SID, then use
the GUID first. This matters for the S-1-5-17 SID.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

8 years agos4-dsdb: catch duplicate matches in extended_dn_in
Andrew Tridgell [Wed, 22 Jun 2011 07:05:08 +0000 (17:05 +1000)]
s4-dsdb: catch duplicate matches in extended_dn_in

When searching using extended DNs, if there are multiple matches then
return an object not found error. This is needed for the case of a
duplicate objectSid, which happens for S-1-5-17

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

8 years agos3: Added missing includes to .clang_complete.
Andreas Schneider [Tue, 21 Jun 2011 13:09:28 +0000 (15:09 +0200)]
s3: Added missing includes to .clang_complete.

Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Wed Jun 22 11:15:56 CEST 2011 on sn-devel-104

8 years agos4:auth/kerberos: protect kerberos_kinit_password_cc() against old KDCs
Stefan Metzmacher [Mon, 20 Jun 2011 23:39:58 +0000 (01:39 +0200)]
s4:auth/kerberos: protect kerberos_kinit_password_cc() against old KDCs

Old KDCs may not support S4U2Self (or S4U2Proxy) and return tickets
which belongs to the client principal of the TGT.

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Wed Jun 22 09:10:55 CEST 2011 on sn-devel-104

8 years agos4:auth/kerberos: remove one indentation level in kerberos_kinit_password_cc()
Stefan Metzmacher [Mon, 20 Jun 2011 19:23:45 +0000 (21:23 +0200)]
s4:auth/kerberos: remove one indentation level in kerberos_kinit_password_cc()

This will make the following changes easier to review.

metze

8 years agos4:auth/kerberos: reformat kerberos_kinit_password_cc()
Stefan Metzmacher [Mon, 20 Jun 2011 19:09:13 +0000 (21:09 +0200)]
s4:auth/kerberos: reformat kerberos_kinit_password_cc()

In order to make the following changes easier to review.

metze

8 years agos4:auth/kerberos: don't mix s4u2self creds with machine account creds
Stefan Metzmacher [Mon, 20 Jun 2011 13:27:58 +0000 (15:27 +0200)]
s4:auth/kerberos: don't mix s4u2self creds with machine account creds

It's important that we don't store the tgt for the machine account
in the same krb5_ccache as the ticket for the impersonated principal.

We may pass it to some krb5/gssapi functions and they may use them
in the wrong way, which would grant machine account privileges to
the client.

metze

8 years agos4:auth/kerberos: use better variable names in kerberos_kinit_password_cc()
Stefan Metzmacher [Mon, 20 Jun 2011 16:01:49 +0000 (18:01 +0200)]
s4:auth/kerberos: use better variable names in kerberos_kinit_password_cc()

This will make the following changes easier to review.

metze

8 years agos4:auth/kerberos: don't ignore return code in kerberos_kinit_password_cc()
Stefan Metzmacher [Mon, 20 Jun 2011 15:41:52 +0000 (17:41 +0200)]
s4:auth/kerberos: don't ignore return code in kerberos_kinit_password_cc()

metze

8 years agosamba-tool: added missing GUID component checks to dbcheck
Andrew Tridgell [Wed, 22 Jun 2011 04:44:36 +0000 (14:44 +1000)]
samba-tool: added missing GUID component checks to dbcheck

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Wed Jun 22 07:59:30 CEST 2011 on sn-devel-104

8 years agopyldb: added methods to get/set extended components on DNs
Andrew Tridgell [Wed, 22 Jun 2011 04:44:12 +0000 (14:44 +1000)]
pyldb: added methods to get/set extended components on DNs

this will be used by the dbcheck code

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

8 years agopydsdb: added get_syntax_oid_from_lDAPDisplayName()
Andrew Tridgell [Wed, 22 Jun 2011 04:41:50 +0000 (14:41 +1000)]
pydsdb: added get_syntax_oid_from_lDAPDisplayName()

this gives you access to the syntax oid of an attribute

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

8 years agoldb: added extended_str() method to pyldb
Andrew Tridgell [Wed, 22 Jun 2011 03:49:37 +0000 (13:49 +1000)]
ldb: added extended_str() method to pyldb

this gives access to ldb_dn_get_extended_linearized() from python

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

8 years agoldb: expose syntax oids to python
Andrew Tridgell [Wed, 22 Jun 2011 02:34:32 +0000 (12:34 +1000)]
ldb: expose syntax oids to python

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

8 years agosamba-tool: try to keep dbcheck.py in a logical ordering
Andrew Tridgell [Wed, 22 Jun 2011 02:23:05 +0000 (12:23 +1000)]
samba-tool: try to keep dbcheck.py in a logical ordering

keep individual error handlers together and separate from driver code

8 years agos4-dsdb: don't add zero GUID to BINARY_DN
Andrew Tridgell [Wed, 22 Jun 2011 01:56:40 +0000 (11:56 +1000)]
s4-dsdb: don't add zero GUID to BINARY_DN

When converting from DRS to ldb format for a BINARY_DN, don't add the
GUID extended DN element if the GUID is all zeros.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

8 years agos3-spoolss: Fix some valgrind warnings.
Andreas Schneider [Mon, 20 Jun 2011 17:27:01 +0000 (19:27 +0200)]
s3-spoolss: Fix some valgrind warnings.

These are in/out values and need to be initialized.

Signed-off-by: Günther Deschner <gd@samba.org>
Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Tue Jun 21 18:58:30 CEST 2011 on sn-devel-104

8 years agos3-rpc_client: Fix some valgrind warnings.
Andreas Schneider [Mon, 20 Jun 2011 13:39:36 +0000 (15:39 +0200)]
s3-rpc_client: Fix some valgrind warnings.

These are in/out values and need to be initialized.

Signed-off-by: Günther Deschner <gd@samba.org>
8 years agos4-smbtorture: rework the spoolss notify test a bit.
Günther Deschner [Tue, 21 Jun 2011 13:06:27 +0000 (15:06 +0200)]
s4-smbtorture: rework the spoolss notify test a bit.

Guenther

8 years agos4-smbtorture: use ipv4 addresses for backchannel spoolss change notify
Günther Deschner [Mon, 20 Jun 2011 16:01:38 +0000 (18:01 +0200)]
s4-smbtorture: use ipv4 addresses for backchannel spoolss change notify
connections for now.

Guenther

8 years agos3: Remove unused code
Volker Lendecke [Mon, 20 Jun 2011 20:25:20 +0000 (22:25 +0200)]
s3: Remove unused code

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Tue Jun 21 15:36:01 CEST 2011 on sn-devel-104

8 years agos3: Convert WINBINDD_WINS_BYNAME to the async API
Volker Lendecke [Tue, 14 Jun 2011 21:51:10 +0000 (23:51 +0200)]
s3: Convert WINBINDD_WINS_BYNAME to the async API

8 years agos3-smbd: longer explanation of smbd_shim code
Andrew Tridgell [Tue, 21 Jun 2011 05:53:36 +0000 (15:53 +1000)]
s3-smbd: longer explanation of smbd_shim code

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Tue Jun 21 09:05:37 CEST 2011 on sn-devel-104

8 years agos3-build: Provide a run-time shim to work around duplicate symbols
Andrew Bartlett [Tue, 31 May 2011 03:18:37 +0000 (13:18 +1000)]
s3-build: Provide a run-time shim to work around duplicate symbols

The become_root() and similar 'smbd' functions that are used widely in
Samba libraries had 'dummy' copies in dummysmbd.c and dummyroot.c.

These have been replaced by a runtime plugin mechanim, which ensures
that standlone binaries still do nothing, while in smbd the correct
function is used.

This avoids having these as duplicate symbols in the smbd binary,
which can cause unpredictable behaviour.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
8 years agolib/util: Restore CH_UNIX as source charset for d_printf()
Andrew Bartlett [Tue, 21 Jun 2011 02:53:12 +0000 (12:53 +1000)]
lib/util: Restore CH_UNIX as source charset for d_printf()

I'm changed this during the change to use the d_printf() code in
common, but should not have.

However, there is a puzzle: What is the right source charset?
Translated strings in our .mo and .msg files are in UTF8, but strings
such as file names on remote servers are in UNIX (whatever that is).
I can't see how this actually works properly when either CH_DISPLAY or
CH_UNIX are other than UTF8!

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
8 years agolib/util Remove display_cd from d_printf()
Andrew Bartlett [Tue, 21 Jun 2011 02:51:30 +0000 (12:51 +1000)]
lib/util Remove display_cd from d_printf()

The setting of the display charset is now done by
convert_string_talloc() selecting the right charset based on
CH_DISPLAY.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
8 years agos4/auth: Trivial spelling fixes.
Brad Hards [Fri, 17 Jun 2011 09:53:11 +0000 (19:53 +1000)]
s4/auth: Trivial spelling fixes.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
8 years agobuild: move dynconfig for top level build up
Andrew Bartlett [Tue, 21 Jun 2011 02:48:22 +0000 (12:48 +1000)]
build: move dynconfig for top level build up

Signed-off-by: Andrew Tridgell <tridge@samba.org>
8 years agolib/ccan/tally.h: update for FreeBSD compile.
Rusty Russell [Tue, 21 Jun 2011 01:50:07 +0000 (11:20 +0930)]
lib/ccan/tally.h: update for FreeBSD compile.

Based on commit 0284423676209380a2e07086b9b356096a2f93e6 from CCAN:
Author: Rusty Russell <rusty@rustcorp.com.au>
Date:   Tue Jun 21 10:43:31 2011 +0930

    tally: fix FreeBSD compile, memleak in tests.

    Posix says ssize_t is in sys/types.h; on Linux stdlib.h is enough.

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Tue Jun 21 05:52:12 CEST 2011 on sn-devel-104

8 years agos4-param Autogenerate the loadparm_globals and loadparm_service tables
Andrew Bartlett [Mon, 20 Jun 2011 05:48:12 +0000 (15:48 +1000)]
s4-param Autogenerate the loadparm_globals and loadparm_service tables

This makes it much easier and less error prone to add new parameters
as we merge the s3 and s4 loadparm systems.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Tue Jun 21 04:41:54 CEST 2011 on sn-devel-104

8 years agoselftest: Run tests for libsmbclient and libnetapi
Andrew Bartlett [Tue, 10 May 2011 20:14:34 +0000 (22:14 +0200)]
selftest: Run tests for libsmbclient and libnetapi

This adds the known failure for the one test (netbios browsing) that
fails.

Andrew Bartlett

8 years agos4-torture Enable libnetapi and libsmbclient tests using combined build
Andrew Bartlett [Tue, 10 May 2011 20:12:52 +0000 (22:12 +0200)]
s4-torture Enable libnetapi and libsmbclient tests using combined build

Because we now always build the source3 code, we can link directly
against a private libnetapi and libsmbclient to test the behaviour of
these important APIs.

We use a private libnetapi_net_init(), and by using this interface
rather than the public one, we can ensure that the correct smb.conf is
loaded (as smbtorture4 is a Samba4 semantics binary).

The #include of the source3 includes.h is required to do the manual
lp_load().

Andrew Bartlett

8 years agobuild: disable -Wl,--as-needed to try and fix the build
Andrew Bartlett [Mon, 20 Jun 2011 11:22:59 +0000 (21:22 +1000)]
build: disable -Wl,--as-needed to try and fix the build

The issue here is that the source3 components now built as part of the
top level build do not have their depenencies fully specified, and
this causes the build to fail for many of our users.

When we fix that, we can restore this flag, so we again find that kind
of bug, which will show up for our Gentoo users regardless.

Andrew Bartlett

8 years agos4-cmdline: Rename popt tables to avoid symbol conflicts
Andrew Bartlett [Mon, 20 Jun 2011 10:57:41 +0000 (20:57 +1000)]
s4-cmdline: Rename popt tables to avoid symbol conflicts

These same names are use in the source3 popt code, which is called from
in libsmbclient and libnet.  These are then included in the smbtorture
binary for testing

Andrew Bartlett

8 years agolib/util Remove samba-util-common!
Andrew Bartlett [Mon, 20 Jun 2011 10:36:46 +0000 (20:36 +1000)]
lib/util Remove samba-util-common!

All of this code is now in common, so we don't need the second
'-common' library any more!

Andrew Bartlett

8 years agolib/util: allow parmlist.c to compile under s3 includes.h
Andrew Bartlett [Mon, 20 Jun 2011 10:43:42 +0000 (20:43 +1000)]
lib/util: allow parmlist.c to compile under s3 includes.h

8 years agolib/util: Use common d_printf() in the whole codebase
Andrew Bartlett [Mon, 20 Jun 2011 09:56:50 +0000 (19:56 +1000)]
lib/util: Use common d_printf() in the whole codebase

This removes the lang_tdb based varient, the only user of the lang_tdb
code is SWAT, which calls that directly.

'net' and 'pam_winbind' are internationalised using gettext.

Andrew Bartlett

8 years agos3-param Put &Globals in the FN_ macros, rather than in each entry
Andrew Bartlett [Mon, 20 Jun 2011 07:57:24 +0000 (17:57 +1000)]
s3-param Put &Globals in the FN_ macros, rather than in each entry

This global replace allows an easier comparison between the source3
and source4 loadparm systems.

Andrew Bartlett

8 years agos4-param Add my authorship to this script
Andrew Bartlett [Mon, 20 Jun 2011 05:51:18 +0000 (15:51 +1000)]
s4-param Add my authorship to this script

8 years agolib/util Make unused d_vfprintf() static
Andrew Bartlett [Mon, 20 Jun 2011 05:02:46 +0000 (15:02 +1000)]
lib/util Make unused d_vfprintf() static

8 years agos3: Fix a winbind message
Volker Lendecke [Mon, 20 Jun 2011 20:18:48 +0000 (22:18 +0200)]
s3: Fix a winbind message

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Mon Jun 20 23:28:43 CEST 2011 on sn-devel-104

8 years agos3:idmap_autorid: remove redundant code
Michael Adam [Thu, 9 Jun 2011 22:50:42 +0000 (00:50 +0200)]
s3:idmap_autorid: remove redundant code

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Mon Jun 20 14:56:29 CEST 2011 on sn-devel-104

8 years agos3:idmap_autorid: in initialize, don't leak storedconfig to talloc_tos() in the succe...
Michael Adam [Thu, 9 Jun 2011 22:49:37 +0000 (00:49 +0200)]
s3:idmap_autorid: in initialize, don't leak storedconfig to talloc_tos() in the success case

8 years agos3:idmap_autorid: use "idmap config * : rangesize" instead of "autorid : rangesize"
Michael Adam [Thu, 9 Jun 2011 22:46:19 +0000 (00:46 +0200)]
s3:idmap_autorid: use "idmap config * : rangesize" instead of "autorid : rangesize"

8 years agos3:idmap_autorid: fail initialization if the domain is not "*"
Michael Adam [Tue, 7 Jun 2011 13:53:49 +0000 (15:53 +0200)]
s3:idmap_autorid: fail initialization if the domain is not "*"

autorid can only be used as a backend for the default idmap configuration.

8 years agos3: Fix the build, NAME_MAX not universally available
Volker Lendecke [Mon, 20 Jun 2011 10:09:06 +0000 (12:09 +0200)]
s3: Fix the build, NAME_MAX not universally available

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Mon Jun 20 13:45:21 CEST 2011 on sn-devel-104

8 years agoUse tevent_req_oom
Volker Lendecke [Sun, 19 Jun 2011 19:10:01 +0000 (21:10 +0200)]
Use tevent_req_oom

This fixes a few Coverity errors

8 years agotevent: change version to 0.9.12 save-diskspace-tags/tevent-0.9.12
Volker Lendecke [Mon, 20 Jun 2011 09:43:51 +0000 (11:43 +0200)]
tevent: change version to 0.9.12

8 years agotevent: Add tevent_req_oom
Volker Lendecke [Sun, 19 Jun 2011 18:55:46 +0000 (20:55 +0200)]
tevent: Add tevent_req_oom

This is a replacement for tevent_req_nomem(NULL, req)

8 years agotdb_compat: respect TDB_NO_FSYNC environment variable for tdb2.
Rusty Russell [Mon, 20 Jun 2011 09:10:34 +0000 (18:40 +0930)]
tdb_compat: respect TDB_NO_FSYNC environment variable for tdb2.

I don't think this kind of hack belongs in the tdb2 source, but SAMBA uses
it to speed testing, so we should respect it: handle it in our compat
open wrapper.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Mon Jun 20 12:32:08 CEST 2011 on sn-devel-104

8 years agotdb2: tie it into build process if --enable-tdb2-breaks-compat
Rusty Russell [Mon, 20 Jun 2011 09:10:34 +0000 (18:40 +0930)]
tdb2: tie it into build process if --enable-tdb2-breaks-compat

This is simplistic.  We need to support making TDB2 a standalone library,
but for now, we simply built it in-tree.

Once we have tdb1 compatibility in tdb2, we can rename this option to
--enable-tdb2.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb2: create tdb2 versions of various testing TDBs.
Rusty Russell [Mon, 20 Jun 2011 09:10:33 +0000 (18:40 +0930)]
tdb2: create tdb2 versions of various testing TDBs.

Soon, TDB2 will handle tdb1 files, but until then, we substitute.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb2: python wrapper
Rusty Russell [Mon, 20 Jun 2011 09:10:33 +0000 (18:40 +0930)]
tdb2: python wrapper

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agosource3/lib/util_tdb.c: operation timeout support for TDB2.
Rusty Russell [Mon, 20 Jun 2011 09:10:33 +0000 (18:40 +0930)]
source3/lib/util_tdb.c: operation timeout support for TDB2.

TDB2 doesn't have (the racy) signal pointer; the new method is to
override the locking callbacks and do the timeout internally.

The technique here is to invalidate the struct flock when the timeout
occurs, so it works even if it happens before we enter the fcntl() call.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb2: minor changes to SAMBIFY it.
Rusty Russell [Mon, 20 Jun 2011 09:10:33 +0000 (18:40 +0930)]
tdb2: minor changes to SAMBIFY it.

This is a bit messy, but it works.  Kept as a separate patch so it's
easier to merge back and forth with CCAN's tdb2.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb2: add lib/tdb2 (from CCAN init-1161-g661d41f)
Rusty Russell [Mon, 20 Jun 2011 09:10:33 +0000 (18:40 +0930)]
tdb2: add lib/tdb2 (from CCAN init-1161-g661d41f)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_compat: Higher level API fixes.
Rusty Russell [Mon, 20 Jun 2011 09:10:33 +0000 (18:40 +0930)]
tdb_compat: Higher level API fixes.

My previous patches fixed up all direct TDB callers, but there are a
few utility functions and the db_context functions which are still
using the old -1 / 0 return codes.

It's clearer to fix up all the callers of these too, so everywhere is
consistent: non-zero means an error.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_compat: use tdb_open_compat.
Rusty Russell [Mon, 20 Jun 2011 09:10:32 +0000 (18:40 +0930)]
tdb_compat: use tdb_open_compat.

This is a helper for the common case of opening a tdb with a logging
function, but it doesn't do all the work, since TDB1 and TDB2's log
functions are different types.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb2: tdb_parse_record() returns negative errors, not -1.
Rusty Russell [Mon, 20 Jun 2011 09:10:32 +0000 (18:40 +0930)]
tdb2: tdb_parse_record() returns negative errors, not -1.

Fixup callers to tdb_parse_record() to be compatible with tdb2.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agosource3/winbindd/idmap_tdb.c: tdb2 support for wrong endian.
Rusty Russell [Mon, 20 Jun 2011 09:10:32 +0000 (18:40 +0930)]
source3/winbindd/idmap_tdb.c: tdb2 support for wrong endian.

TDB has no idea of endian itself, but it knows whether the TDB is the
same endian as the current machine, so we should use that rather than
implementing TDB_BIGENDIAN in tdb2.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_validate: TDB2 support for tdb_validate_child and tdb_backup.
Rusty Russell [Mon, 20 Jun 2011 09:10:32 +0000 (18:40 +0930)]
tdb_validate: TDB2 support for tdb_validate_child and tdb_backup.

We don't expose freelist or hash size for TDB2.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb2: #ifdef out TDB_ERR_NOLOCK and TDB_ERR_LOCK_TIMEOUT.
Rusty Russell [Mon, 20 Jun 2011 09:10:32 +0000 (18:40 +0930)]
tdb2: #ifdef out TDB_ERR_NOLOCK and TDB_ERR_LOCK_TIMEOUT.

These don't exist in tdb2.  The former is used in one weird place in
tdb1, and the latter not at all.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agoldb: replace 'struct TDB_DATA' with 'TDB_DATA'
Rusty Russell [Mon, 20 Jun 2011 09:10:32 +0000 (18:40 +0930)]
ldb: replace 'struct TDB_DATA' with 'TDB_DATA'

The typedef is TDB2 compatible, the struct isn't.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_compat: use tdb_errorstr_compat()
Rusty Russell [Mon, 20 Jun 2011 09:10:32 +0000 (18:40 +0930)]
tdb_compat: use tdb_errorstr_compat()

Since TDB2 functions return the error directly, tdb_errorstr() taken an
error code, not the tdb as it does in TDB1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_compat: use tdb_firstkey_compat/tdb_nextkey_compat everywhere.
Rusty Russell [Mon, 20 Jun 2011 09:10:32 +0000 (18:40 +0930)]
tdb_compat: use tdb_firstkey_compat/tdb_nextkey_compat everywhere.

Note that tdb_nextkey_compat frees the old key for us.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_unlockall/tdb_unlockall_read: ignore return value.
Rusty Russell [Mon, 20 Jun 2011 09:10:32 +0000 (18:40 +0930)]
tdb_unlockall/tdb_unlockall_read: ignore return value.

TDB2 returns void here.  tdb_unlockall will *always* return with the
database unlocked, but it will complain via the log function if it wasn't
locked.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_traverse/tdb_traverse_read: check returns for negative, not -1.
Rusty Russell [Mon, 20 Jun 2011 09:10:31 +0000 (18:40 +0930)]
tdb_traverse/tdb_traverse_read: check returns for negative, not -1.

TDB2 returns a negative error number on failure.  This is compatible
if we always check for < 0 instead of == -1.

Also, there's no tdb_traverse_read in TDB2: we don't try to make
traverse reliable any more, so there are no write locks anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_chainunlock: ignore return value.
Rusty Russell [Mon, 20 Jun 2011 09:10:31 +0000 (18:40 +0930)]
tdb_chainunlock: ignore return value.

TDB2 returns void here.  tdb_chainunlock will *always* return with the
chain unlocked, but it will complain via the log function if it wasn't
locked.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_chainlock: check returns for 0, not -1.
Rusty Russell [Mon, 20 Jun 2011 09:10:31 +0000 (18:40 +0930)]
tdb_chainlock: check returns for 0, not -1.

TDB2 returns a negative error number on failure.  This is compatible
if we always check for != 0 instead of == -1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_transaction_cancel: ignore return value.
Rusty Russell [Mon, 20 Jun 2011 09:10:31 +0000 (18:40 +0930)]
tdb_transaction_cancel: ignore return value.

TDB2 returns void here.  tdb_transaction_cancel will *always* return
with the transaction cancelled, but it will complain via the log
function if a transaction wasn't in progress.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_transaction_commit: check returns for 0, not -1.
Rusty Russell [Mon, 20 Jun 2011 09:10:31 +0000 (18:40 +0930)]
tdb_transaction_commit: check returns for 0, not -1.

TDB2 returns a negative error number on failure.  This is compatible
if we always check for != 0 instead of == -1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_store: check returns for 0, not -1.
Rusty Russell [Mon, 20 Jun 2011 09:10:31 +0000 (18:40 +0930)]
tdb_store: check returns for 0, not -1.

TDB2 returns a negative error number on failure.  This is compatible
if we always check for != 0 instead of == -1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_delete: check returns for 0, not -1.
Rusty Russell [Mon, 20 Jun 2011 09:10:31 +0000 (18:40 +0930)]
tdb_delete: check returns for 0, not -1.

TDB2 returns a negative error number on failure.  This is compatible
if we always check for != 0 instead of == -1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_fetch_compat: use instead of tdb_fetch.
Rusty Russell [Mon, 20 Jun 2011 09:10:31 +0000 (18:40 +0930)]
tdb_fetch_compat: use instead of tdb_fetch.

This is a noop for tdb1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agotdb_compat.h: divert every tdb build and includes to tdb_compat
Rusty Russell [Mon, 20 Jun 2011 09:10:25 +0000 (18:40 +0930)]
tdb_compat.h: divert every tdb build and includes to tdb_compat

We change all the headers and wscript files to use tdb_compat; this
means we have one place to decide whether to use TDB1 or TDB2.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agolib/tdb_compat: header for tdb1 vs tdb2.
Rusty Russell [Mon, 20 Jun 2011 07:28:15 +0000 (16:58 +0930)]
lib/tdb_compat: header for tdb1 vs tdb2.

TDB2's API is slightly different from TDB1.  In particular, all functions
return 0 (TDB_SUCCESS) or a negative error number, rather than -1 or tdb_null
and storing the error in tdb_error() (though TDB2 does that as well).

The simplest fix is to replace all the different functions with a wrapper,
and that is done here.

Compatibility functions:

tdb_null: not used as an error return, so not defined by tdb2.
tdb_fetch_compat: TDB1-style data-returning tdb_fetch.
tdb_firstkey_compat: TDB1-style data-returning tdb_firstkey
tdb_nextkey_compat: TDB1-style data-returning tdb_nextkey, with
TDB2-style free of old key.
tdb_errorstr_compat: TDB1-style tdb_errorstr() which takes TDB instead of ecode.
TDB_CONTEXT: TDB1-style typedef for struct tdb_context.
tdb_open_compat: Simplified open routine which takes log function, sets
TDB_ALLOW_NESTING as Samba expects, and adds TDB_CLEAR_IF_FIRST support.

Things defined away in TDB2 wrappers:

tdb_traverse_read: TDB2's tdb_traverse only uses read-locks anyway.
tdb_reopen/tdb_reopen_all: TDB2 detects this error itself.
TDB_INCOMPATIBLE_HASH: TDB2 uses the Jenkins hash already.
TDB_VOLATILE: TDB2 shouldn't have freelist scaling issues.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agosource3/smdb/files.c: file_name_hash to use Jenkins hash from CCAN.
Rusty Russell [Mon, 20 Jun 2011 07:27:15 +0000 (16:57 +0930)]
source3/smdb/files.c: file_name_hash to use Jenkins hash from CCAN.

Rather than tdb's internal one.

8 years agosource3/lib/util.c: str_checksum to use Jenkins hash from CCAN.
Rusty Russell [Mon, 20 Jun 2011 07:26:15 +0000 (16:56 +0930)]
source3/lib/util.c: str_checksum to use Jenkins hash from CCAN.

Rather than tdb's internal one.

8 years agosmb_share_modes: don't use tdb_jenkins_hash.
Rusty Russell [Mon, 20 Jun 2011 07:25:15 +0000 (16:55 +0930)]
smb_share_modes: don't use tdb_jenkins_hash.

It's a nice hash, but this usage has nothing to do with TDB.  So use the
Jenkins hash directly from CCAN instead (it's the same one).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agolib: import ccan modules for tdb2
Rusty Russell [Mon, 20 Jun 2011 07:24:15 +0000 (16:54 +0930)]
lib: import ccan modules for tdb2

Imported from git://git.ozlabs.org/~ccan/ccan init-1161-g661d41f

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years agos3: Replace shadow_copy2 with a new implementation
Volker Lendecke [Mon, 20 Jun 2011 07:52:21 +0000 (09:52 +0200)]
s3: Replace shadow_copy2 with a new implementation

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Mon Jun 20 11:17:47 CEST 2011 on sn-devel-104

8 years agopyldb: add unit test for get(myattribute, defVal)
Matthieu Patou [Sat, 11 Jun 2011 14:09:40 +0000 (18:09 +0400)]
pyldb: add unit test for get(myattribute, defVal)

Autobuild-User: Matthieu Patou <mat@samba.org>
Autobuild-Date: Mon Jun 20 09:23:15 CEST 2011 on sn-devel-104

8 years agolibcli/util Rename common map_nt_error_from_unix to avoid duplicate symbol
Andrew Bartlett [Mon, 20 Jun 2011 04:55:32 +0000 (14:55 +1000)]
libcli/util Rename common map_nt_error_from_unix to avoid duplicate symbol

The two error tables need to be combined, but for now seperate the names.

(As the common parts of the tree now use the _common function,
errmap_unix.c must be included in the s3 autoconf build).

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Mon Jun 20 08:12:03 CEST 2011 on sn-devel-104

8 years agolibcli/util Bring samba4 unix -> nt_status code in common.
Andrew Bartlett [Mon, 20 Jun 2011 04:03:26 +0000 (14:03 +1000)]
libcli/util Bring samba4 unix -> nt_status code in common.

Due to library link orders, this is already the function that is being
used.  However we still need to sort out the duplicate symbol issues,
probably by renaming things.

Andrew Bartlett

8 years agos3-libcli Remove unused error mapping tables
Andrew Bartlett [Mon, 20 Jun 2011 03:24:38 +0000 (13:24 +1000)]
s3-libcli Remove unused error mapping tables

The functions which uesed these tables have since moved in common.

Andrew Bartlett

8 years agos3-winbind Move winbind privileged socket dir into state_path()
Andrew Bartlett [Mon, 20 Jun 2011 00:13:09 +0000 (10:13 +1000)]
s3-winbind Move winbind privileged socket dir into state_path()

On default installs, this will be the same as the old lock_path(), but
lock_path() is now a directory that can safely be mapped to /var/locks
and removed by the OS on reboot.  It is important that the directory
permissions of this directory be preserved, as they may be customised.

Andrew Bartlett

8 years agobuild: Put lockdir and cachedir in FHS-like locations by default
Andrew Bartlett [Wed, 15 Jun 2011 04:40:51 +0000 (14:40 +1000)]
build: Put lockdir and cachedir in FHS-like locations by default

This does not move statedir, leaving it in PREFIX/var/locks because
state files such as idmap are dangerous to move, as they might
re-create, causing chaos.

This isn't ideal, but I don't have a better solution right now.

Andrew Bartlett

8 years agos4-build Change default paths and --with flags for a 4.0 release
Andrew Bartlett [Tue, 14 Jun 2011 07:01:02 +0000 (17:01 +1000)]
s4-build Change default paths and --with flags for a 4.0 release

The following changes are made since Samba 3.6:

* --with-ncalrpcdir and --with-nmbdsocketdir are replaced with --with-socket-dir
  (with ntp_signd, winbindd, nmbd subdirs)

* This moves the winbind socket out of /tmp.  Distributions have moved
  this out of /tmp for quite some time now, and /var/run in the FHS
  blessed location these days.  --with-socketdir should point to
  /var/run in a distribution package.

* Configuration files are expected in PREFIX/etc instead of PREFIX/lib
  (they need to be moved manually)

* SWAT data files have moved to PREFIX/share/swat (alongside
  PREFIX/share/setup containing samba4 provision templates).

* The --with-fhs option is no longer available (it was never very
  useful, and major distributions (Debian, OpenSuSE, Fedora) either
  specified every option (overriding the effect) or didn't specify it
  at all.

* PID files are now in PREFIX/var/run, moved from PREFIX/var/locks

* The ncalrpc and nmbd sockets are now in PREFIX/var/run by default

The following changes are made for users of Samba3 binaries built with the top level build in master

* 'state' files are now expected to be in their Samba 3.6 location
  PREFIX/var/locks (and will need to be moved manually)

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
8 years agos4-upgradeprovision: propose the use of findprovisionranges if no ranges are present
Matthieu Patou [Sun, 19 Jun 2011 21:05:04 +0000 (01:05 +0400)]
s4-upgradeprovision: propose the use of findprovisionranges if no ranges are present

Autobuild-User: Matthieu Patou <mat@samba.org>
Autobuild-Date: Mon Jun 20 00:30:59 CEST 2011 on sn-devel-104

8 years agos4: create script to find provision ranges for old provision without this information
Matthieu Patou [Sun, 19 Jun 2011 21:00:48 +0000 (01:00 +0400)]
s4: create script to find provision ranges for old provision without this information

8 years agos4-sambatool: extract the confirm function in a separte module for reuse
Matthieu Patou [Sun, 19 Jun 2011 19:09:59 +0000 (23:09 +0400)]
s4-sambatool: extract the confirm function in a separte module for reuse

8 years agos4-samba-tool: remove unused imports
Matthieu Patou [Sun, 19 Jun 2011 17:27:32 +0000 (21:27 +0400)]
s4-samba-tool: remove unused imports