[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Wed Apr 19 00:54:03 UTC 2017
The branch, master has been updated
via d58481b s3-tests: assignement in shell shall have no spaces around equal sign
via ff4fb69 _netr_ServerPasswordSet2: use info level 26 to set plain text machine password
via f775068 selftest: also run smb2.compound_find against share with async delay set
via 2601894 s4/torture: add a test for compound SMB2 FIND requests
via 9c95eca s3/smbd: add "smbd:find async delay usec" to SMB2 FIND
via d99bd1c s3/smbd: make write time fetching async
via 682f1b7 s3/smbd: enable processing SMB2 requests async internally
via d1f8d3e s3/smbd: ask_sharemode is not needed for info_level SMB_FIND_FILE_NAMES_INFO
via f589919 s3/smbd: add file_id return arg to smbd_dirptr_lanman2_entry
via 06891c1 s3/locking: add fetch_share_mode_send/recv
via cc56fcd dbwrap_watch: add parse_record_send/recv wrappers
via b3f8e9a dbwrap: add dbwrap_parse_record_send/recv
via 2813b53 dbwrap_ctdb: implement parse_record_send()/recv()
via 6a1734e dbwrap_ctdb: factor out a db_ctdb_try_parse_local_record() function
via 0a0c50d ctdb_conn: add ctdbd_parse_send/recv
via 4449844 dbwrap: add parse_record_send/recv to struct db_context
via 27acbb2 dbwrap: add enum dbwrap_req_state
via 1fcb66e lib/util: add and use iov_concat
via 1e8e048 lib: param: Remove lpcfg_register_defaults_hook().
from 4fe2b24 smbldap: Move ldapsam_privates to pdb_ldap.h
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit d58481bd133a8f59ae553eeff6335162f3c7071c
Author: Alexander Bokovoy <ab at samba.org>
Date: Tue Apr 18 18:28:29 2017 +0300
s3-tests: assignement in shell shall have no spaces around equal sign
When assigning value to 'failed', no spaces should be around '=' sign.
Signed-off-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Apr 19 02:53:25 CEST 2017 on sn-devel-144
commit ff4fb6935a32e33ef01c97d4ee103bc11ac31da0
Author: Alexander Bokovoy <ab at samba.org>
Date: Fri Mar 31 12:44:58 2017 +0300
_netr_ServerPasswordSet2: use info level 26 to set plain text machine password
To support password change for machine or trusted domain accounts in Active
Directory environment we need to pass down actual plain text password
instead of NT hashes. This would allow a backend like ipasam to update
Kerberos keys as well as NT hashes.
By calling samr_SetUserInfo2 info level 26 we ensure PASSDB layer can
actually get the plain text password. If PASSDB backend implements
pdb_update_sam_account() callback, it then gets the plain text password
from samr_SetUserInfo2.
A plain text password is a data blob represented as up to 256 WCHARs. It
is UTF-16 coded on wire and we have its length from the buffer.
SetUserInfo2 SAMR call chain in decode_pw_buffer() does explicitly
expect 512+4 bytes in the buffer. It then calls convert_string_talloc()
to convert it to UNIX charset passing the correct value of the plaintext
password length. However, convert_string_talloc() expects the length of
input string *including* the terminating null and we pass just the
string length.
convert_string_talloc() then explicitly null-terminates the resulting
string by adding two nulls. In most cases UNIX charset is UTF-8, so we
get null-terminated UTF-8 string down to PASSDB layer.
MS-SAMR does not limit what does the password should contain. It says
it is 'userPassword' value. Either 'userPassword' or 'unicodePwd' cannot
contain null characters according to MS-ADTS 3.1.1.3.1.5 because they
must be proper UTF-8 and UTF-16 strings accordingly.
We are talking to our own SAMR service here.
Signed-off-by: Alexander Bokovoy <ab at samba.org>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit f775068c4091339cddb1fee278ac51423800c8cf
Author: Ralph Boehme <slow at samba.org>
Date: Thu Feb 23 22:20:39 2017 +0100
selftest: also run smb2.compound_find against share with async delay set
Add a share with "smbd:find async delay usec" set to 10000 and run the
test smb2.compound_find added in the previous commit against this new
share as well.
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 26018947f9b2b1e7d45b54738710fb1d7a6a5ec6
Author: Ralph Boehme <slow at samba.org>
Date: Wed Jan 11 17:09:54 2017 +0100
s4/torture: add a test for compound SMB2 FIND requests
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 9c95eca0f4116d52c8522a2066783e4722b21337
Author: Ralph Boehme <slow at samba.org>
Date: Wed Jan 11 15:36:38 2017 +0100
s3/smbd: add "smbd:find async delay usec" to SMB2 FIND
This is just a hack for selftest that will be used in subsequent commits
for torturing compound find requests.
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit d99bd1c48be7193cc43ecb5d608a017909b8f548
Author: Ralph Boehme <slow at samba.org>
Date: Sun Dec 18 08:53:43 2016 +0100
s3/smbd: make write time fetching async
Finally use the new async dbwrap_parse_record_send/recv() functions
respectively the fetch_share_mode_send/recv wrappers for fetching the
write time from locking.tdb.
Previously for a directory with n files we would sit idle in the
directory enumeration loop fo n * m seconds waiting for responses from
ctdb, where m is the response time in seconds for a dbwrap request via
ctbd.
This is known to kill performance and we even have a parameter
"smbd:search ask sharemode" that can be used to disable fetching the
write time from locking.tdb.
Using fetch_write_time_send() works this way: in the directory
enumeration loop that calls smbd_dirptr_lanman2_entry() to marshall the
directory entries we
1. call fetch_write_time_send() after calling smbd_dirptr_lanman2_entry
passing a pointer to the current position in the marshall buffer.
2. If fetch_write_time_send() has set the out parameter "stop", we exit
the enumeration loop. This is necessary because we only send dbwrap
requests but don't consume the results. This has the potential to
deadlock so we must stop sending requests as soon as our ctdb send
queue is full.
3. In the fetch_write_time_done() callback, if the recv function got a
locking.tdb record, we push the write time into the marshall buffer
at the offet saved in the request state.
This new feature is still off by default as it doesn't
give any improvement in the non-clustered usecase.
"smbd:async search ask sharemode" can be used to activate it,
which makes only sense with "clustering = yes" (execept for testing).
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 682f1b7d65be1bd5055d8184bb1c6f79d9545ceb
Author: Ralph Boehme <slow at samba.org>
Date: Wed Jan 11 15:00:24 2017 +0100
s3/smbd: enable processing SMB2 requests async internally
The idea is to allow the implementation of an SMB2 request to tell the
main SMB2 processing engine that it wants to handle a requests
asynchronously internally.
This has two use cases:
- it allows (internal) async processing of compound requests that would
otherwise be rejected by the SMB2 processing engine
- it preserves sync semantics at the SMB layer, some clients might not
expect arbitrary SMB2 requests going async
Not used for now, will be used in laters commit for async SMB2 FIND
requests.
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit d1f8d3e18b565b1408b212480ef5f74c6a7393af
Author: Ralph Boehme <slow at samba.org>
Date: Fri Dec 23 19:51:49 2016 +0100
s3/smbd: ask_sharemode is not needed for info_level SMB_FIND_FILE_NAMES_INFO
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit f589919d674185620f07f7910ef1897dc070137a
Author: Ralph Boehme <slow at samba.org>
Date: Thu Dec 22 14:53:17 2016 +0100
s3/smbd: add file_id return arg to smbd_dirptr_lanman2_entry
Not used for now, needed for async write_time updates in
smbd_smb2_query_directory_send().
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 06891c11d2a105d11cf4696002e75e10566b58e0
Author: Ralph Boehme <slow at samba.org>
Date: Wed Jan 4 08:00:29 2017 +0100
s3/locking: add fetch_share_mode_send/recv
The boolean out parameter "queued" tells the caller whether the
async request is blocked in a full send queue:
false := request is dispatched
true := send queue is full, request waiting to be dispatched
This is useful in a clustered Samba environment where the async dbwrap
request is sent over a socket to the local ctdbd.
If the send queue is full and the caller was issuing multiple async
dbwrap requests in a loop, the caller knows it's probably time to stop
sending requests for now and try again later.
This will be used in subsequent commits in
smbd_smb2_query_directory_send() when implementing async write time
updates. Directories may contain umpteen files so we send many requests
to ctdb without going through tevent and reading the responses which
has the potential to deadlock.
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit cc56fcd0e57475a689ee19e8e145e2917e957fe7
Author: Ralph Boehme <slow at samba.org>
Date: Mon Dec 26 10:15:11 2016 +0100
dbwrap_watch: add parse_record_send/recv wrappers
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit b3f8e9a62ce50edca54c5f31795cfd8e5f613b64
Author: Ralph Boehme <slow at samba.org>
Date: Tue Dec 27 09:13:37 2016 +0100
dbwrap: add dbwrap_parse_record_send/recv
The req_state parameter tells the caller whether the async request is
blocked in a full send queue:
req_state >= DBWRAP_REQ_DISPATCHED := request is dispatched
req_state < DBWRAP_REQ_DISPATCHED := send queue is full
This is useful in a clustered Samba environment where the async dbwrap
request is sent over a socket to the local ctdbd.
If the send queue is full and the caller was issuing multiple async
dbwrap requests in a loop, the caller knows it's probably time to stop
sending requests for now and try again later.
This will be used in subsequent commits in
smbd_smb2_query_directory_send() when implementing async write time
updates. Directories may contain umpteen files so we send many requests
to ctdb without going through tevent and reading the responses which has
the potential to deadlock.
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 2813b53e1ad60bf2f055a3a6e4124aa07edc6fb4
Author: Ralph Boehme <slow at samba.org>
Date: Wed Dec 21 08:38:25 2016 +0100
dbwrap_ctdb: implement parse_record_send()/recv()
This mainly works like the sync version, but calls ctdbd_parse_send/recv
instead.
We use one global ctdb connection that is used exclusively for async
requests.
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 6a1734ebfd3936e35628df7b04c502bffbec970d
Author: Ralph Boehme <slow at samba.org>
Date: Thu Feb 23 18:28:32 2017 +0100
dbwrap_ctdb: factor out a db_ctdb_try_parse_local_record() function
Pair-programmed-with: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Ralph Boehme <slow at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 0a0c50d361415c18760935a8d6883506b1395ffa
Author: Ralph Boehme <slow at samba.org>
Date: Mon Jan 9 08:17:02 2017 +0100
ctdb_conn: add ctdbd_parse_send/recv
Implement the ctdb packet layer for async parse send/recv with tevent.
ctdbd_setup_fde() will is used to create an fde from the
connection fd and will be called from dbwrap_ctdb.
ctdbd_parse_send() and ctdbd_parse_recv() will be used by dbwrap_ctdb
for async packet sending and receiving.
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 4449844096b29c8f3cce5b83615e89162715a383
Author: Ralph Boehme <slow at samba.org>
Date: Tue Jan 10 14:48:07 2017 +0100
dbwrap: add parse_record_send/recv to struct db_context
The implementation comes next.
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 27acbb26ee7ae8d4f475ed742fb28ada84f24cc1
Author: Ralph Boehme <slow at samba.org>
Date: Tue Jan 10 14:22:21 2017 +0100
dbwrap: add enum dbwrap_req_state
This will be used by async dwrap_parse_send() as an out argument, giving
the caller an indication about the state of the request.
This is can be useful for the caller if it is a sync function and sends
multiple async dbwrap requests. As it's a sync function it won't return
to the main tevent event loop and so the async dbwrap recv function are
not called.
As a result the function may deadlock: our receive queue may already be
full with results from a peer, the peer might be blocked in his send
queue (because we're not receiving), the peer therefor doesn't read from
his receive queue so our send queue will block as well.
To inform the caller of this situation "send queue full" we return this
state information to the caller of the dbwrap send function.
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 1fcb66efe0530593cc31a3f64a96fc5ca543fcc3
Author: Ralph Boehme <slow at samba.org>
Date: Wed Feb 22 17:21:15 2017 +0100
lib/util: add and use iov_concat
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 1e8e048bf01447148ffa89ec237e2f9f58ff0ab6
Author: Jeremy Allison <jra at samba.org>
Date: Tue Apr 18 10:21:50 2017 -0700
lib: param: Remove lpcfg_register_defaults_hook().
Completely unused functionality. Gets rid of another
talloc_autofree_context(). Updated WHATSNEW to make
this clear.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
-----------------------------------------------------------------------
Summary of changes:
WHATSNEW.txt | 10 +
lib/dbwrap/dbwrap.c | 112 ++++
lib/dbwrap/dbwrap.h | 56 ++
lib/dbwrap/dbwrap_private.h | 12 +
lib/dbwrap/wscript_build | 2 +-
lib/param/loadparm.c | 32 -
lib/param/param.h | 16 -
lib/util/iov_buf.c | 21 +
lib/util/iov_buf.h | 6 +-
lib/util/wscript_build | 1 +
libcli/smb/smbXcli_base.c | 26 +-
selftest/target/Samba3.pm | 4 +
source3/include/ctdbd_conn.h | 15 +
source3/lib/ctdb_dummy.c | 5 +
source3/lib/ctdbd_conn.c | 844 ++++++++++++++++++++++++++-
source3/lib/dbwrap/dbwrap_ctdb.c | 219 ++++++-
source3/lib/dbwrap/dbwrap_ctdb.h | 1 +
source3/lib/dbwrap/dbwrap_watch.c | 84 +++
source3/lib/util.c | 12 +
source3/locking/proto.h | 7 +
source3/locking/share_mode_lock.c | 125 ++++
source3/rpc_server/netlogon/srv_netlog_nt.c | 79 ++-
source3/script/tests/test_net_cred_change.sh | 6 +-
source3/selftest/tests.py | 4 +
source3/smbd/globals.h | 13 +-
source3/smbd/smb2_query_directory.c | 289 ++++++++-
source3/smbd/smb2_server.c | 18 +
source3/smbd/trans2.c | 10 +-
source4/torture/smb2/compound.c | 123 ++++
source4/torture/smb2/smb2.c | 1 +
30 files changed, 2021 insertions(+), 132 deletions(-)
Changeset truncated at 500 lines:
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index c276ce2..5e6d159 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -50,6 +50,16 @@ smb.conf changes
map untrusted to domain Deprecated
strict sync Default changed yes
+Removal of lpcfg_register_defaults_hook()
+-----------------------------------------
+
+The undocumented and unsupported function lpcfg_register_defaults_hook()
+that was used by external projects to call into Samba and modify
+smb.conf default parameter settings has been removed. If your project
+was using this call please raise the issue on
+samba-technical at lists.samba.org in order to design a supported
+way of obtaining the same functionality.
+
KNOWN ISSUES
============
diff --git a/lib/dbwrap/dbwrap.c b/lib/dbwrap/dbwrap.c
index 68e5608..025d463 100644
--- a/lib/dbwrap/dbwrap.c
+++ b/lib/dbwrap/dbwrap.c
@@ -26,6 +26,7 @@
#include "dbwrap/dbwrap.h"
#include "dbwrap/dbwrap_private.h"
#include "lib/util/util_tdb.h"
+#include "lib/util/tevent_ntstatus.h"
/*
* Fall back using fetch if no genuine exists operation is provided
@@ -368,6 +369,117 @@ NTSTATUS dbwrap_parse_record(struct db_context *db, TDB_DATA key,
return db->parse_record(db, key, parser, private_data);
}
+struct dbwrap_parse_record_state {
+ struct db_context *db;
+ TDB_DATA key;
+ uint8_t _keybuf[64];
+};
+
+static void dbwrap_parse_record_done(struct tevent_req *subreq);
+
+struct tevent_req *dbwrap_parse_record_send(
+ TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct db_context *db,
+ TDB_DATA key,
+ void (*parser)(TDB_DATA key, TDB_DATA data, void *private_data),
+ void *private_data,
+ enum dbwrap_req_state *req_state)
+{
+ struct tevent_req *req = NULL;
+ struct tevent_req *subreq = NULL;
+ struct dbwrap_parse_record_state *state = NULL;
+ NTSTATUS status;
+
+ req = tevent_req_create(mem_ctx, &state, struct dbwrap_parse_record_state);
+ if (req == NULL) {
+ *req_state = DBWRAP_REQ_ERROR;
+ return NULL;
+ }
+
+ *state = (struct dbwrap_parse_record_state) {
+ .db = db,
+ };
+
+ if (parser == NULL) {
+ parser = dbwrap_null_parser;
+ }
+
+ *req_state = DBWRAP_REQ_INIT;
+
+ if (db->parse_record_send == NULL) {
+ /*
+ * Backend doesn't implement async version, call sync one
+ */
+ status = db->parse_record(db, key, parser, private_data);
+ if (tevent_req_nterror(req, status)) {
+ *req_state = DBWRAP_REQ_DONE;
+ return tevent_req_post(req, ev);
+ }
+
+ *req_state = DBWRAP_REQ_DONE;
+ tevent_req_done(req);
+ return tevent_req_post(req, ev);
+ }
+
+ /*
+ * Copy the key into our state ensuring the key data buffer is always
+ * available to the all dbwrap backend over the entire lifetime of the
+ * async request. Otherwise the caller might have free'd the key buffer.
+ */
+ if (key.dsize > sizeof(state->_keybuf)) {
+ state->key.dptr = talloc_memdup(state, key.dptr, key.dsize);
+ if (tevent_req_nomem(state->key.dptr, req)) {
+ return tevent_req_post(req, ev);
+ }
+ } else {
+ memcpy(state->_keybuf, key.dptr, key.dsize);
+ state->key.dptr = state->_keybuf;
+ }
+ state->key.dsize = key.dsize;
+
+ subreq = db->parse_record_send(state,
+ ev,
+ db,
+ state->key,
+ parser,
+ private_data,
+ req_state);
+ if (tevent_req_nomem(subreq, req)) {
+ *req_state = DBWRAP_REQ_ERROR;
+ return tevent_req_post(req, ev);
+ }
+
+ tevent_req_set_callback(subreq,
+ dbwrap_parse_record_done,
+ req);
+ return req;
+}
+
+static void dbwrap_parse_record_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ struct dbwrap_parse_record_state *state = tevent_req_data(
+ req, struct dbwrap_parse_record_state);
+ NTSTATUS status;
+
+ status = state->db->parse_record_recv(subreq);
+ TALLOC_FREE(subreq);
+ if (!NT_STATUS_IS_OK(status)) {
+ tevent_req_nterror(req, status);
+ return;
+ }
+
+ tevent_req_done(req);
+ return;
+}
+
+NTSTATUS dbwrap_parse_record_recv(struct tevent_req *req)
+{
+ return tevent_req_simple_recv_ntstatus(req);
+}
+
int dbwrap_wipe(struct db_context *db)
{
if (db->wipe == NULL) {
diff --git a/lib/dbwrap/dbwrap.h b/lib/dbwrap/dbwrap.h
index 6b77236..fac65ee 100644
--- a/lib/dbwrap/dbwrap.h
+++ b/lib/dbwrap/dbwrap.h
@@ -22,6 +22,7 @@
#include "replace.h"
#include <talloc.h>
+#include <tevent.h>
#include "libcli/util/ntstatus.h"
#include "tdb.h"
#include "lib/param/loadparm.h"
@@ -43,6 +44,29 @@ enum dbwrap_lock_order {
#define DBWRAP_FLAG_NONE 0x0000000000000000ULL
#define DBWRAP_FLAG_OPTIMIZE_READONLY_ACCESS 0x0000000000000001ULL
+enum dbwrap_req_state {
+ /**
+ * We are creating the request
+ */
+ DBWRAP_REQ_INIT,
+ /**
+ * The request is queued and waiting to be dispatched
+ */
+ DBWRAP_REQ_QUEUED,
+ /**
+ * We are waiting to receive the reply
+ */
+ DBWRAP_REQ_DISPATCHED,
+ /**
+ * The request is finished
+ */
+ DBWRAP_REQ_DONE,
+ /**
+ * The request errored out
+ */
+ DBWRAP_REQ_ERROR
+};
+
/* The following definitions come from lib/dbwrap.c */
TDB_DATA dbwrap_record_get_key(const struct db_record *rec);
@@ -75,6 +99,38 @@ NTSTATUS dbwrap_parse_record(struct db_context *db, TDB_DATA key,
void (*parser)(TDB_DATA key, TDB_DATA data,
void *private_data),
void *private_data);
+/**
+ * Async implementation of dbwrap_parse_record
+ *
+ * @param[in] mem_ctx talloc memory context to use.
+ *
+ * @param[in] ev tevent context to use
+ *
+ * @param[in] db Database to query
+ *
+ * @param[in] key Record key, the function makes a copy of this
+ *
+ * @param[in] parser Parser callback function
+ *
+ * @param[in] private_data Private data for the callback function
+ *
+ * @param[out] req_state Pointer to a enum dbwrap_req_state variable
+ *
+ * @note req_state is updated in the send function. To determine the final
+ * result of the request the caller should therefor not rely on req_state. The
+ * primary use case is to give the caller an indication whether the request is
+ * already sent to ctdb (DBWRAP_REQ_DISPATCHED) or if it's still stuck in the
+ * sendqueue (DBWRAP_REQ_QUEUED).
+ **/
+struct tevent_req *dbwrap_parse_record_send(
+ TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct db_context *db,
+ TDB_DATA key,
+ void (*parser)(TDB_DATA key, TDB_DATA data, void *private_data),
+ void *private_data,
+ enum dbwrap_req_state *req_state);
+NTSTATUS dbwrap_parse_record_recv(struct tevent_req *req);
int dbwrap_wipe(struct db_context *db);
int dbwrap_check(struct db_context *db);
int dbwrap_get_seqnum(struct db_context *db);
diff --git a/lib/dbwrap/dbwrap_private.h b/lib/dbwrap/dbwrap_private.h
index 15ebbc9..9b50ccc 100644
--- a/lib/dbwrap/dbwrap_private.h
+++ b/lib/dbwrap/dbwrap_private.h
@@ -23,6 +23,9 @@
#ifndef __DBWRAP_PRIVATE_H__
#define __DBWRAP_PRIVATE_H__
+struct tevent_context;
+struct tevent_req;
+
struct db_record {
struct db_context *db;
TDB_DATA key, value;
@@ -55,6 +58,15 @@ struct db_context {
void (*parser)(TDB_DATA key, TDB_DATA data,
void *private_data),
void *private_data);
+ struct tevent_req *(*parse_record_send)(
+ TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct db_context *db,
+ TDB_DATA key,
+ void (*parser)(TDB_DATA key, TDB_DATA data, void *private_data),
+ void *private_data,
+ enum dbwrap_req_state *req_state);
+ NTSTATUS (*parse_record_recv)(struct tevent_req *req);
int (*exists)(struct db_context *db,TDB_DATA key);
int (*wipe)(struct db_context *db);
int (*check)(struct db_context *db);
diff --git a/lib/dbwrap/wscript_build b/lib/dbwrap/wscript_build
index b719a60..83e5895 100644
--- a/lib/dbwrap/wscript_build
+++ b/lib/dbwrap/wscript_build
@@ -1,6 +1,6 @@
SRC = '''dbwrap.c dbwrap_util.c dbwrap_rbt.c dbwrap_cache.c dbwrap_tdb.c
dbwrap_local_open.c'''
-DEPS= '''samba-util util_tdb samba-errors tdb tdb-wrap samba-hostconfig'''
+DEPS= '''samba-util util_tdb samba-errors tdb tdb-wrap samba-hostconfig tevent tevent-util'''
bld.SAMBA_LIBRARY('dbwrap',
source=SRC,
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index d7287ab..c8a8b6d 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -2551,23 +2551,6 @@ static int lpcfg_destructor(struct loadparm_context *lp_ctx)
return 0;
}
-struct defaults_hook_data {
- const char *name;
- lpcfg_defaults_hook hook;
- struct defaults_hook_data *prev, *next;
-} *defaults_hooks = NULL;
-
-
-bool lpcfg_register_defaults_hook(const char *name, lpcfg_defaults_hook hook)
-{
- struct defaults_hook_data *hook_data = talloc(talloc_autofree_context(),
- struct defaults_hook_data);
- hook_data->name = talloc_strdup(hook_data, name);
- hook_data->hook = hook;
- DLIST_ADD(defaults_hooks, hook_data);
- return false;
-}
-
/**
* Initialise the global parameter structure.
*
@@ -2580,7 +2563,6 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
struct loadparm_context *lp_ctx;
struct parmlist_entry *parm;
char *logfile;
- struct defaults_hook_data *defaults_hook;
lp_ctx = talloc_zero(mem_ctx, struct loadparm_context);
if (lp_ctx == NULL)
@@ -3004,20 +2986,6 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
"rpc server dynamic port range",
"49152-65535");
- /* Allow modules to adjust defaults */
- for (defaults_hook = defaults_hooks; defaults_hook;
- defaults_hook = defaults_hook->next) {
- bool ret;
-
- ret = defaults_hook->hook(lp_ctx);
- if (!ret) {
- DEBUG(1, ("Defaults hook %s failed to run.",
- defaults_hook->name));
- talloc_free(lp_ctx);
- return NULL;
- }
- }
-
for (i = 0; parm_table[i].label; i++) {
if (!(lp_ctx->flags[i] & FLAG_CMDLINE)) {
lp_ctx->flags[i] |= FLAG_DEFAULT;
diff --git a/lib/param/param.h b/lib/param/param.h
index a6dbafa..589b890 100644
--- a/lib/param/param.h
+++ b/lib/param/param.h
@@ -47,8 +47,6 @@ struct gensec_settings;
struct bitmap;
struct file_lists;
-typedef bool (*lpcfg_defaults_hook) (struct loadparm_context *);
-
#ifdef CONFIG_H_IS_FROM_SAMBA
#include "lib/param/param_proto.h"
#include "lib/param/param_functions.h"
@@ -216,20 +214,6 @@ const char *lpcfg_socket_options(struct loadparm_context *);
struct dcerpc_server_info *lpcfg_dcerpc_server_info(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx);
struct gensec_settings *lpcfg_gensec_settings(TALLOC_CTX *, struct loadparm_context *);
-/* Hooks to override defaults.
- *
- * Every time a loadparm context is initialized, the hooks are
- * called on it, once Samba itself has set defaults.
- *
- * This allows modules to tweak defaults (before any smb.conf file or registry
- * is loaded). Usually they would do this by calling lpcfg_do_global_parameter
- * or lpcfg_do_service_parameter.
- *
- * A good use case for this is OpenChange, which by default enables its
- * DCE/RPC services when it is installed.
- * */
-bool lpcfg_register_defaults_hook(const char *name, lpcfg_defaults_hook hook);
-
/* The following definitions come from param/util.c */
diff --git a/lib/util/iov_buf.c b/lib/util/iov_buf.c
index d260b2f..592bc5d 100644
--- a/lib/util/iov_buf.c
+++ b/lib/util/iov_buf.c
@@ -20,6 +20,7 @@
#include "replace.h"
#include "system/filesys.h"
#include "iov_buf.h"
+#include <talloc.h>
ssize_t iov_buflen(const struct iovec *iov, int iovcnt)
{
@@ -90,3 +91,23 @@ bool iov_advance(struct iovec **iov, int *iovcnt, size_t n)
*iovcnt = cnt;
return true;
}
+
+uint8_t *iov_concat(TALLOC_CTX *mem_ctx, const struct iovec *iov, int count)
+{
+ ssize_t buflen;
+ uint8_t *buf;
+
+ buflen = iov_buflen(iov, count);
+ if (buflen == -1) {
+ return NULL;
+ }
+
+ buf = talloc_array(mem_ctx, uint8_t, buflen);
+ if (buf == NULL) {
+ return NULL;
+ }
+
+ iov_buf(iov, count, buf, buflen);
+
+ return buf;
+}
diff --git a/lib/util/iov_buf.h b/lib/util/iov_buf.h
index 8f0ca26..79b81b8 100644
--- a/lib/util/iov_buf.h
+++ b/lib/util/iov_buf.h
@@ -20,13 +20,13 @@
#ifndef __LIB_IOV_BUF_H__
#define __LIB_IOV_BUF_H__
-#include <unistd.h>
-#include <stdint.h>
-#include <stdbool.h>
+#include "replace.h"
+#include <talloc.h>
ssize_t iov_buflen(const struct iovec *iov, int iovlen);
ssize_t iov_buf(const struct iovec *iov, int iovcnt,
uint8_t *buf, size_t buflen);
bool iov_advance(struct iovec **iov, int *iovcnt, size_t n);
+uint8_t *iov_concat(TALLOC_CTX *mem_ctx, const struct iovec *iov, int count);
#endif
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 91505eb..d093947 100644
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -78,6 +78,7 @@ bld.SAMBA_SUBSYSTEM('samba-util-core',
bld.SAMBA_LIBRARY('iov_buf',
source='iov_buf.c',
+ deps='talloc',
local_include=False,
private_library=True)
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 1fcf11e..1ec11a9 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -1343,28 +1343,6 @@ static size_t smbXcli_iov_len(const struct iovec *iov, int count)
return ret;
}
-static uint8_t *smbXcli_iov_concat(TALLOC_CTX *mem_ctx,
- const struct iovec *iov,
- int count)
-{
- ssize_t buflen;
- uint8_t *buf;
-
- buflen = iov_buflen(iov, count);
- if (buflen == -1) {
- return NULL;
- }
-
- buf = talloc_array(mem_ctx, uint8_t, buflen);
- if (buf == NULL) {
- return NULL;
- }
-
- iov_buf(iov, count, buf, buflen);
-
- return buf;
-}
-
static void smb1cli_req_flags(enum protocol_types protocol,
uint32_t smb1_capabilities,
uint8_t smb_command,
@@ -1647,7 +1625,7 @@ static NTSTATUS smb1cli_conn_signv(struct smbXcli_conn *conn,
frame = talloc_stackframe();
- buf = smbXcli_iov_concat(frame, &iov[1], iov_count - 1);
+ buf = iov_concat(frame, &iov[1], iov_count - 1);
if (buf == NULL) {
return NT_STATUS_NO_MEMORY;
}
@@ -1739,7 +1717,7 @@ static NTSTATUS smb1cli_req_writev_submit(struct tevent_req *req,
if (common_encryption_on(state->conn->smb1.trans_enc)) {
char *buf, *enc_buf;
- buf = (char *)smbXcli_iov_concat(talloc_tos(), iov, iov_count);
+ buf = (char *)iov_concat(talloc_tos(), iov, iov_count);
if (buf == NULL) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 0aa88ee..c241bd1 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1979,6 +1979,10 @@ sub provision($$$$$$$$)
copy = tmp
kernel oplocks = yes
vfs objects = streams_xattr xattr_tdb
+
+[compound_find]
+ copy = tmp
+ smbd:find async delay usec = 10000
";
close(CONF);
--
Samba Shared Repository
More information about the samba-cvs
mailing list