1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

81249 Commits

Author SHA1 Message Date
Matthieu Patou
9ebb081cce ldb: add the VERIFY_NAME control 2012-06-22 23:22:02 -07:00
Matthieu Patou
d7aa7e8ef0 s4-dsdb: support otherWellKnownObjects 2012-06-22 23:22:02 -07:00
Matthieu Patou
6edd940135 s4-dsdb: Try to avoid much of the time a db search for msDS-IntID
We search in the schema if we have already this intid (using dsdb_attribute_by_attributeID_id because
in the range 0x80000000 0xBFFFFFFFF, attributeID is a DSDB_ATTID_TYPE_INTID).
If so generate another random value.
If not check if the highest USN in the database for the schema partition is the
one that we know.
If so it means that's only this ldb context that is touching the schema in the database.
If not it means that's someone else has modified the database while we are doing our changes too
(this case should be very bery rare) in order to be sure do the search in the database.
2012-06-22 23:22:02 -07:00
Matthieu Patou
1521bb95a7 dsdb-schema: do not reload more often than schema_reload_interval
Samba 4 use to try to reload the schema every time dsdb_get_schema was
called (which could be 20+ time per ldb request). Now we only reload at
most every xx seconds (xx being the value of dsdb:"schema_reload_interval"
 or 120). The timestamp of the last reloaded schema is kept in the
 dsdb_schema object. There is also a timestamp in the ldb_context, that
 is used by the LDAP server to know if it has to reload the schema after
 handling the request. This is used to allow that the schema will be
 immediately reload after a schemaUpdateNow request has been issued, the
 reload can't occur in the handling of the LDAP request itself because
 we have a transaction autostarted.
2012-06-22 23:16:04 -07:00
Matthieu Patou
f8fd615c59 s4-dsdb: fix a warning about unused variable 2012-06-22 23:16:04 -07:00
Olaf Flebbe
8558e321c5 s3: Correct documentation of case sensitive
this fixes bug #8552

Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Fri Jun 22 21:59:59 CEST 2012 on sn-devel-104
2012-06-22 21:59:59 +02:00
Volker Lendecke
e7b58146d8 s3-vfs_gpfs: Fix bug #9003, posix acl on gpfs
gpfs2smb_acl can leave errno!=0 around even if it returned a correct
result!=NULL. We can only rely on errno being set if another error
condition (in this case result==NULL) indicates an error. If
result!=NULL, errno is undefined and can be anything. This leads to
SAFE_FREE(result) further down even in the success case.

Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun 22 19:27:39 CEST 2012 on sn-devel-104
2012-06-22 19:27:39 +02:00
Volker Lendecke
b9a15f1bfa s3: Give machine password changes 10 minutes of time
This is what we do at domain join time as well, see
lib/netapi/joindomain.c:141

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-22 17:28:20 +02:00
Michael Adam
51b30c61f4 s3:torture:smb2: pass smb2-session-reconnect test (add generosity in error case)
samba checks tree before file, so we get a
STATUS_NETWORK_NAME_DELETED instead STATUS_FILE_CLOSED
when operating on a file handle on a invalid tree id.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-22 17:28:18 +02:00
Stefan Metzmacher
4676e7f65d dbwrap: don't ignore the result of dbwrap_parse_record in dbwrap_fetch_int32()
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun 22 17:10:52 CEST 2012 on sn-devel-104
2012-06-22 17:10:52 +02:00
Stefan Metzmacher
0f25bd78ca dbwrap: intialize state.status in dbwrap_fetch_int32()
This might not be needed, but it makes it more clear that
we won't use uninitialized memory, it the callback was not triggered.

metze
2012-06-22 15:16:53 +02:00
Volker Lendecke
d7b9e0d19a dbwrap: Convert fetch_int32 to dbwrap_parse_record
Now dbwrap_fetch_int32 is used in smbd/locking/posix.c is used a
lot more often than before.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-22 15:16:52 +02:00
Volker Lendecke
770d9affd7 s3: Remove reduce_windows_lock_ref_count, used only once
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-22 15:16:51 +02:00
Volker Lendecke
89b2eb1d06 s3: Make reduce_windows_lock_ref_count static
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-22 15:16:49 +02:00
Volker Lendecke
6658a2f6ef s3: Use dbwrap_util for windows_lock_ref_count
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-22 15:16:48 +02:00
Volker Lendecke
e0abd1938a dbwrap: Add dbwrap_fetch_int32
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-22 15:16:47 +02:00
Volker Lendecke
ce7b0b9906 dbwrap: Add dbwrap_change_int32_atomic
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-22 15:16:45 +02:00
Stefan Metzmacher
688cda19ba script/autobuild: fix path to random-sleep.sh
metze
2012-06-22 15:16:44 +02:00
Stefan Metzmacher
ea74131dc8 selftest/knownfail: mark ^samba4.raw.session.expire1 as knownfail
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun 22 15:03:16 CEST 2012 on sn-devel-104
2012-06-22 15:03:16 +02:00
Stefan Metzmacher
9c44f40b8d s4:torture/raw: add raw.session.expire1
This demonstrates the interaction of CAP_DYNAMIC_REAUTH
and NT_STATUS_NETWORK_SESSION_EXPIRED.

metze
2012-06-22 12:56:48 +02:00
Stefan Metzmacher
b40fa94360 s3:smbd: fix warning in smbd_tevent_trace_callback() without profile support
metze
2012-06-22 12:56:47 +02:00
Stefan Metzmacher
ad82c52db0 s3:serverid: don't ignore the result of dbwrap_parse_record()
metze
2012-06-22 12:56:45 +02:00
Stefan Metzmacher
31ad4d77e3 s4:torture/smb2: run smb2.session.reauth5 in a subdirectory
This way we can give anonymous full access to the directory.

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun 22 11:30:06 CEST 2012 on sn-devel-104
2012-06-22 11:30:05 +02:00
Rusty Russell
3c4263e758 tdb: don't use err.h in tests.
It's not portable.  While we could use ccan/err, it seems overkill since
we actually only use it in one test (I obviously cut & paste the #include).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Fri Jun 22 09:22:28 CEST 2012 on sn-devel-104
2012-06-22 09:22:28 +02:00
Rusty Russell
1783fe3443 tdb: make TDB_NOSYNC merely disable sync.
(As suggested by Stefan Metzmacher, based on the change to ntdb.)

Since commit ec96ea690e, we handle the case
where a process dies during a transaction commit.  Unfortunately, TDB_NOSYNC
means this no longer works, as it disables the recovery area as well as the
actual msync/fsync.  We should do everything except the syncs.

This also means we can do a complete test with $TDB_NO_FSYNC set; just
to get more complete coverage, we disable it explicitly for one test
(where we override the actual sync calls anyway).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
945473aac0 dbwrap: dbwrap_hash_size().
Implemented for ntdb and tdb; falls back to 0 for others.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
e92cb556fd dbwrap: dbwrap_name().
Useful for debug messages: particularly once we start switching between .tdb
and .ntdb files.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
41f799d877 dbwrap: dbwrap_transaction_start_nonblock().
Implemented for ntdb and tdb; falls back to the blocking variant
for others.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
f6eb187fda dbwrap: dbwrap_fetch_locked_timeout().
Implemented for ntdb and tdb; falls back to the non-timeout variant
for others.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
431667b47c dbwrap: add dbwrap_check() function.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
9d97bf3f47 dbwrap: dbwrap_local_open()
This simply opens a tdb: it will eventually switch depending on the
extension.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
1acf548eb7 dbwrap: remove get_flags().
The flags returned were TDB-specific: this was only used for detecting
the endianness of obsolete databases (the conversion code was put in in
2003, with reference to Samba 2.3).

It's easier to remove it than to translate the NTDB flags to TDB flags,
and it's a really weird thing to ask for anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
fc9b298761 util_tdb: move timeout chainlock variants from source3/lib/util/util_tdb.c
We're about to use them for dbwrap.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
02bacf1f95 util: util_ntdb ntdb_fetch_int32/ntdb_store_int32 and ntdb_add_int32_atomic
Similar to the util_tdb versions, but return the error code.

ntdb_add_int32_atomic seems a clearer name than tdb_change_int32_atomic.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
348159d1e4 util: util_ntdb.c gets NTDB_ERROR => NTSTATUS map.
Very similar to the tdb version.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
88ad365caf util: util_ntdb.c gains bystring functions.
Very similar to the util_tdb versions, but these return the error.
I've only implemented those functions actually used.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
8113d53bb4 util: ntdb_new() supports NTDB_CLEAR_IF_FIRST.
There are various issues with NTDB_CLEAR_IF_FIRST which makes it
better if we don't have to use it, but much of the code does, so
we fake up support here.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
735290f474 util: util_ntdb.c
The first function is ntdb_new: this is preferred over ntdb_open, as
it makes the ntdb_context returned (and all NTDB_DATA returned from
ntdb_fetch) valid talloc pointers.

The API is very similar to tdb_wrap_open().

Note that we handle $TDB_NO_FSYNC here, since ntdb doesn't do that
hack (and it's great for speeding up testing!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
7c1d9fb3c1 ntdb: take advantage of direct access across expand.
This means we no longer have to unmap if we want to compare a record.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
4c51ee1116 ntdb: test arbitrary operations during ntdb_parse_record().
In particular, this tests that we can store enough records to make the
database expand while we map the given record.  We use a global lock for
this, but it could happen in theory with another process.

It also tests the that we can recurse inside ntdb_parse_record().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
01ec4a72de ntdb: make database read-only during ntdb_parse() callback.
Since we have a readlock, any write will grab a write lock: if it happens
to be on the same bucket, we'll fail.

For that reason, enforce read-only so every write operation fails
(even for NTDB_NOLOCK or NTDB_INTERNAL dbs), and document it!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
bd5c061932 ntdb: allow direct access for NTDB_INTERNAL dbs during expansion.
NTDB_INTERNAL databases need to malloc and copy to keep old versions
around if we expand, in a similar way to the manner in which keep old
mmaps around.

Of course, it only works for read-only accesses, since the two copies
are not synced.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
0a34f342c3 ntdb: enhancement to allow direct access to the ntdb map during expansion.
This means keeping the old mmap around when we expand the database.
We could revert to read/write, except for platforms with incoherent
mmap (ie. OpenBSD), where we need to use mmap for all accesses.

Thus we keep a linked list of old maps, and unmap them when the last access
finally goes away.

This is required if we want ntdb_parse_record() callbacks to be able
to expand the database.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
66d151d689 ntdb: don't munmap the database on every close.
Since we can have multiple openers, we should leave the mmap in place
for the other openers to use.  Enhance the test to check the bug (it
still works, because without mmap we fall back to read/write, but
performance would be terrible!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
406bd2d121 ntdb: hand correct error code when alloc_read allocation fails.
-ECUTNPASTE.  This is not a usage error!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:16 +02:00
Rusty Russell
f7f6992c1e autobuild: always set TDB_NO_FSYNC.
Then we unset it inside the tdb test target itself.  This means that
new code can't accidently forget it, and we can set it in the
'buildnice' script on sn-devel, for example.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:16 +02:00
Rusty Russell
0265837ee8 ntdb: respect TDB_NO_FSYNC flag for 'make test'
This reduces test time from 31 seconds to 6, on my laptop.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:16 +02:00
Stefan Metzmacher
0c54e7c936 s4:torture/smb2: add smb2.durable-open.lock-oplock
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun 22 03:37:54 CEST 2012 on sn-devel-104
2012-06-22 03:37:54 +02:00
Stefan Metzmacher
ff36ce74c0 selftest: samba3.smb2.durable-open.lock => samba3.smb2.durable-open.lock-lease
metze
2012-06-22 01:47:33 +02:00
Stefan Metzmacher
7d8db45028 s4:torture/smb2: rename smb2.durable-open.lock to smb2.durable-open.lock-lease
metze
2012-06-22 01:47:33 +02:00