[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Wed Nov 6 21:59:03 UTC 2019
The branch, master has been updated
via 18cc62b98d4 vfs: Use file_id_str_buf() in vfs_delay_inject_brl_lock_timer()
via 2d5aba4d863 smbd: Use struct initialization instead of ZERO_STRUCT()
via 001371f45e5 vfs: Use file_id_str_buf() in smb_full_audit_file_id_create()
via 3f80b8abac3 smbd: Use file_id_str_buf() in set_write_time()
via d04581bfe92 smbd: Use file_id_str_buf() in rename_open_files()
via 1bbdae22344 smbd: Use file_id_str_buf() in contend_level2_oplocks_begin_default()
via 56f93f21114 smbd: Use file_id_str_buf() in process_kernel_oplock_break()
via 6018cc5a078 smbd: Use file_id_str_buf() in process_oplock_break_message()
via 75962acade6 smbd: Use file_id_str_buf() in initial_break_processing()
via 6e521461c5d smbd: Use file_id_str_buf() in downgrade_lease()
via 8dd7b129138 smbd: Use file_id_str_buf() in downgrade_oplock()
via c7731649fde smbd: Use file_id_str_buf() in set_file_oplock()
via d6f952f4c7c smbd: Use file_id_str_buf() in set_file_oplock()
via 2651463e19c ntlm_auth: Fix nonempty line endings
via 995de9c2d2e ntlm_auth: Simplify session generation
via 8ec9e976666 auth: Simplify session generation
via dd8aba30483 lib: Avoid includes.h in g_lock.c
via 8febbc2bcd2 lib: Remove g_lock_do()
via 9dd65d1f991 net: Avoid the use of g_lock_do()
via d9bd074cc8c net: Avoid the use of g_lock_do()
via aaad4d012d8 g_lock: Avoid sys_random(), use generate_random()
via d6223677bfd dbwrap_tdb: Avoid a use of talloc_stackframe()
via 54d673742f3 lib: Remove #define serverid_equal server_id_equal
from b749c923373 s3: smbd: SMB1 UNIX extensions - remove dead code.
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 18cc62b98d47c349d542b435e603d8de72a67200
Author: Volker Lendecke <vl at samba.org>
Date: Tue Nov 5 21:56:44 2019 +0100
vfs: Use file_id_str_buf() in vfs_delay_inject_brl_lock_timer()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Nov 6 21:58:52 UTC 2019 on sn-devel-184
commit 2d5aba4d8633d9cf62f6ed7847dad9ebc41f46ce
Author: Volker Lendecke <vl at samba.org>
Date: Tue Nov 5 21:54:21 2019 +0100
smbd: Use struct initialization instead of ZERO_STRUCT()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 001371f45e5a069aa9cfaef9c35dc47b371935a8
Author: Volker Lendecke <vl at samba.org>
Date: Mon Nov 4 07:39:48 2019 +0100
vfs: Use file_id_str_buf() in smb_full_audit_file_id_create()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 3f80b8abac3e4a59371017b841cc43dfe486f18e
Author: Volker Lendecke <vl at samba.org>
Date: Mon Nov 4 07:39:48 2019 +0100
smbd: Use file_id_str_buf() in set_write_time()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit d04581bfe926013bda2df2beefd836555e53e8f9
Author: Volker Lendecke <vl at samba.org>
Date: Mon Nov 4 07:39:48 2019 +0100
smbd: Use file_id_str_buf() in rename_open_files()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 1bbdae2234487393e4a964d59b4d772a8a758eff
Author: Volker Lendecke <vl at samba.org>
Date: Mon Nov 4 07:39:48 2019 +0100
smbd: Use file_id_str_buf() in contend_level2_oplocks_begin_default()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 56f93f21114588e7cef8cf837a57ceaad9f9b8bc
Author: Volker Lendecke <vl at samba.org>
Date: Mon Nov 4 07:39:48 2019 +0100
smbd: Use file_id_str_buf() in process_kernel_oplock_break()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 6018cc5a078fbe042910d6bb07850c21d2ffd923
Author: Volker Lendecke <vl at samba.org>
Date: Mon Nov 4 07:39:48 2019 +0100
smbd: Use file_id_str_buf() in process_oplock_break_message()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 75962acade60530ff99663ffbc1ca9d0eb79ccc0
Author: Volker Lendecke <vl at samba.org>
Date: Mon Nov 4 07:39:48 2019 +0100
smbd: Use file_id_str_buf() in initial_break_processing()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 6e521461c5d57ddf01904e75b80602d662da9057
Author: Volker Lendecke <vl at samba.org>
Date: Mon Nov 4 07:39:48 2019 +0100
smbd: Use file_id_str_buf() in downgrade_lease()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 8dd7b129138d9b89368eb0b5f8f04300672f2e98
Author: Volker Lendecke <vl at samba.org>
Date: Mon Nov 4 07:39:48 2019 +0100
smbd: Use file_id_str_buf() in downgrade_oplock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit c7731649fde2b2336bba3de7e38a9281b3330414
Author: Volker Lendecke <vl at samba.org>
Date: Mon Nov 4 07:39:48 2019 +0100
smbd: Use file_id_str_buf() in set_file_oplock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit d6f952f4c7ca03829d199a3cf9c5b2998146462e
Author: Volker Lendecke <vl at samba.org>
Date: Sun Nov 3 18:52:07 2019 +0100
smbd: Use file_id_str_buf() in set_file_oplock()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 2651463e19cac9cd346e282b9b6316952c683b2e
Author: Volker Lendecke <vl at samba.org>
Date: Sat Nov 2 14:08:00 2019 +0100
ntlm_auth: Fix nonempty line endings
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 995de9c2d2e95a782b81c215efc8d4ab4b3d54b9
Author: Volker Lendecke <vl at samba.org>
Date: Sat Nov 2 14:01:10 2019 +0100
ntlm_auth: Simplify session generation
We don't need to parse a text sid, we have those as binary available
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 8ec9e97666653469e5bd56ef0576fb0af1406a82
Author: Volker Lendecke <vl at samba.org>
Date: Sat Nov 2 13:56:49 2019 +0100
auth: Simplify session generation
We don't need to parse a text sid, we have those as binary available
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit dd8aba30483649ea28199241fbc2410b1b4595a5
Author: Volker Lendecke <vl at samba.org>
Date: Thu Oct 10 16:30:14 2019 +0200
lib: Avoid includes.h in g_lock.c
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 8febbc2bcd2a136281ad9b4b90537028b6d5c4e2
Author: Volker Lendecke <vl at samba.org>
Date: Thu Oct 10 13:40:44 2019 +0200
lib: Remove g_lock_do()
This puts too much logic into this lowlevel infrastructure module,
given the two minor external users.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 9dd65d1f991722bf6686ae21e4607192fc2bf327
Author: Volker Lendecke <vl at samba.org>
Date: Thu Oct 10 13:38:17 2019 +0200
net: Avoid the use of g_lock_do()
g_lock_do() does too much in g_lock.c, and it's rarely used.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit d9bd074cc8c0859f4f6333080d457a551e6367a4
Author: Volker Lendecke <vl at samba.org>
Date: Thu Oct 10 10:27:54 2019 +0200
net: Avoid the use of g_lock_do()
g_lock_do() does too much in g_lock.c, and it's rarely used.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit aaad4d012d83b2e203b7974f56b3f6f72d1c9141
Author: Volker Lendecke <vl at samba.org>
Date: Wed Oct 9 21:38:42 2019 +0200
g_lock: Avoid sys_random(), use generate_random()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit d6223677bfded0aed659df4a78f318ffc180003c
Author: Volker Lendecke <vl at samba.org>
Date: Wed Oct 16 15:27:49 2019 +0200
dbwrap_tdb: Avoid a use of talloc_stackframe()
For really large keys (that probably don't exist), use dump_data()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 54d673742f3a81ecdfb98f66a928d119293697ba
Author: Volker Lendecke <vl at samba.org>
Date: Wed Oct 9 21:38:04 2019 +0200
lib: Remove #define serverid_equal server_id_equal
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/dbwrap/dbwrap_tdb.c | 20 ++--
source3/include/g_lock.h | 4 -
source3/include/proto.h | 1 -
source3/lib/g_lock.c | 80 ++--------------
source3/locking/brlock.c | 7 +-
source3/locking/locking.c | 7 +-
source3/locking/posix.c | 4 +-
source3/modules/vfs_delay_inject.c | 3 +-
source3/modules/vfs_full_audit.c | 9 +-
source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 5 +-
source3/smbd/open.c | 2 +-
source3/smbd/oplock.c | 93 ++++++++++++-------
source3/smbd/reply.c | 19 ++--
source3/smbd/sesssetup.c | 2 +-
source3/torture/test_g_lock.c | 2 +-
source3/utils/net_g_lock.c | 51 ++++++-----
source3/utils/net_registry.c | 136 +++++++++++++--------------
source3/utils/net_status.c | 2 +-
source3/utils/ntlm_auth.c | 147 ++++++++++++++----------------
source3/utils/status.c | 2 +-
source4/auth/session.c | 15 +--
21 files changed, 276 insertions(+), 335 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/dbwrap/dbwrap_tdb.c b/lib/dbwrap/dbwrap_tdb.c
index eb08a01a161..1ac7dc9ed7a 100644
--- a/lib/dbwrap/dbwrap_tdb.c
+++ b/lib/dbwrap/dbwrap_tdb.c
@@ -42,24 +42,24 @@ static NTSTATUS db_tdb_delete(struct db_record *rec);
static void db_tdb_log_key(const char *prefix, TDB_DATA key)
{
- size_t len;
- char *keystr;
- TALLOC_CTX *frame;
if (DEBUGLEVEL < 10) {
return;
}
- frame = talloc_stackframe();
- len = key.dsize;
if (DEBUGLEVEL == 10) {
/*
* Only fully spam at debuglevel > 10
*/
- len = MIN(10, key.dsize);
+ key.dsize = MIN(10, key.dsize);
}
- keystr = hex_encode_talloc(frame, (unsigned char *)(key.dptr),
- len);
- DBG_DEBUG("%s key %s\n", prefix, keystr);
- TALLOC_FREE(frame);
+
+ if (key.dsize < 1024) {
+ char keystr[key.dsize*2+1];
+ hex_encode_buf(keystr, key.dptr, key.dsize);
+ DBG_DEBUG("%s key %s\n", prefix, keystr);
+ return;
+ }
+
+ dump_data(DEBUGLEVEL, key.dptr, key.dsize);
}
static int db_tdb_record_destr(struct db_record* data)
diff --git a/source3/include/g_lock.h b/source3/include/g_lock.h
index c3e3a509b80..782a2e9d160 100644
--- a/source3/include/g_lock.h
+++ b/source3/include/g_lock.h
@@ -51,10 +51,6 @@ NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, TDB_DATA key);
NTSTATUS g_lock_write_data(struct g_lock_ctx *ctx, TDB_DATA key,
const uint8_t *buf, size_t buflen);
-NTSTATUS g_lock_do(TDB_DATA key, enum g_lock_type lock_type,
- struct timeval timeout,
- void (*fn)(void *private_data), void *private_data);
-
int g_lock_locks(struct g_lock_ctx *ctx,
int (*fn)(TDB_DATA key, void *private_data),
void *private_data);
diff --git a/source3/include/proto.h b/source3/include/proto.h
index c98f7cfa351..cdec671dac3 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -399,7 +399,6 @@ uint32_t map_share_mode_to_deny_mode(uint32_t share_access, uint32_t private_opt
#include "lib/util_procid.h"
-#define serverid_equal(p1, p2) server_id_equal(p1,p2)
struct server_id interpret_pid(const char *pid_string);
bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index ef6bbb52613..b01bb591f77 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -17,9 +17,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "includes.h"
+#include "replace.h"
#include "system/filesys.h"
#include "lib/util/server_id.h"
+#include "lib/util/debug.h"
+#include "lib/util/talloc_stack.h"
+#include "lib/util/samba_util.h"
+#include "lib/util_path.h"
#include "dbwrap/dbwrap.h"
#include "dbwrap/dbwrap_open.h"
#include "dbwrap/dbwrap_watch.h"
@@ -244,7 +248,7 @@ static NTSTATUS g_lock_trylock(struct db_record *rec, struct server_id self,
g_lock_get_rec(&lck, i, &lock);
- if (serverid_equal(&self, &lock.pid)) {
+ if (server_id_equal(&self, &lock.pid)) {
if (lock.lock_type == type) {
status = NT_STATUS_WAS_LOCKED;
goto done;
@@ -405,7 +409,7 @@ struct tevent_req *g_lock_lock_send(TALLOC_CTX *mem_ctx,
if (!tevent_req_set_endtime(
fn_state.watch_req, state->ev,
- timeval_current_ofs(5 + sys_random() % 5, 0))) {
+ timeval_current_ofs(5 + generate_random() % 5, 0))) {
return tevent_req_post(req, ev);
}
tevent_req_set_callback(fn_state.watch_req, g_lock_lock_retry, req);
@@ -458,7 +462,7 @@ static void g_lock_lock_retry(struct tevent_req *subreq)
if (!tevent_req_set_endtime(
fn_state.watch_req, state->ev,
- timeval_current_ofs(5 + sys_random() % 5, 0))) {
+ timeval_current_ofs(5 + generate_random() % 5, 0))) {
return;
}
tevent_req_set_callback(fn_state.watch_req, g_lock_lock_retry, req);
@@ -528,7 +532,7 @@ static void g_lock_unlock_fn(struct db_record *rec,
for (i=0; i<lck.num_recs; i++) {
struct g_lock_rec lockrec;
g_lock_get_rec(&lck, i, &lockrec);
- if (serverid_equal(&state->self, &lockrec.pid)) {
+ if (server_id_equal(&state->self, &lockrec.pid)) {
break;
}
}
@@ -601,7 +605,7 @@ static void g_lock_write_data_fn(struct db_record *rec,
struct g_lock_rec lockrec;
g_lock_get_rec(&lck, i, &lockrec);
if ((lockrec.lock_type == G_LOCK_WRITE) &&
- serverid_equal(&state->self, &lockrec.pid)) {
+ server_id_equal(&state->self, &lockrec.pid)) {
break;
}
}
@@ -750,67 +754,3 @@ NTSTATUS g_lock_dump(struct g_lock_ctx *ctx, TDB_DATA key,
}
return NT_STATUS_OK;
}
-
-static bool g_lock_init_all(TALLOC_CTX *mem_ctx,
- struct tevent_context **pev,
- struct messaging_context **pmsg,
- struct g_lock_ctx **pg_ctx)
-{
- struct tevent_context *ev = NULL;
- struct messaging_context *msg = NULL;
- struct g_lock_ctx *g_ctx = NULL;
-
- ev = samba_tevent_context_init(mem_ctx);
- if (ev == NULL) {
- d_fprintf(stderr, "ERROR: could not init event context\n");
- goto fail;
- }
- msg = messaging_init(mem_ctx, ev);
- if (msg == NULL) {
- d_fprintf(stderr, "ERROR: could not init messaging context\n");
- goto fail;
- }
- g_ctx = g_lock_ctx_init(mem_ctx, msg);
- if (g_ctx == NULL) {
- d_fprintf(stderr, "ERROR: could not init g_lock context\n");
- goto fail;
- }
-
- *pev = ev;
- *pmsg = msg;
- *pg_ctx = g_ctx;
- return true;
-fail:
- TALLOC_FREE(g_ctx);
- TALLOC_FREE(msg);
- TALLOC_FREE(ev);
- return false;
-}
-
-NTSTATUS g_lock_do(TDB_DATA key, enum g_lock_type lock_type,
- struct timeval timeout,
- void (*fn)(void *private_data), void *private_data)
-{
- struct tevent_context *ev = NULL;
- struct messaging_context *msg = NULL;
- struct g_lock_ctx *g_ctx = NULL;
- NTSTATUS status;
-
- if (!g_lock_init_all(talloc_tos(), &ev, &msg, &g_ctx)) {
- status = NT_STATUS_ACCESS_DENIED;
- goto done;
- }
-
- status = g_lock_lock(g_ctx, key, lock_type, timeout);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
- fn(private_data);
- g_lock_unlock(g_ctx, key);
-
-done:
- TALLOC_FREE(g_ctx);
- TALLOC_FREE(msg);
- TALLOC_FREE(ev);
- return status;
-}
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index f3fb75ef136..c0ff99a21c5 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -112,7 +112,7 @@ const struct GUID *brl_req_guid(const struct byte_range_lock *brl)
static bool brl_same_context(const struct lock_context *ctx1,
const struct lock_context *ctx2)
{
- return (serverid_equal(&ctx1->pid, &ctx2->pid) &&
+ return (server_id_equal(&ctx1->pid, &ctx2->pid) &&
(ctx1->smblctx == ctx2->smblctx) &&
(ctx1->tid == ctx2->tid));
}
@@ -1466,7 +1466,8 @@ void brl_close_fnum(struct byte_range_lock *br_lck)
for (i=0; i < num_locks_copy; i++) {
struct lock_struct *lock = &locks_copy[i];
- if (lock->context.tid == tid && serverid_equal(&lock->context.pid, &pid) &&
+ if (lock->context.tid == tid &&
+ server_id_equal(&lock->context.pid, &pid) &&
(lock->fnum == fnum)) {
brl_unlock(
br_lck,
@@ -1525,7 +1526,7 @@ bool brl_mark_disconnected(struct files_struct *fsp)
return false;
}
- if (!serverid_equal(&lock->context.pid, &self)) {
+ if (!server_id_equal(&lock->context.pid, &self)) {
TALLOC_FREE(br_lck);
return false;
}
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 568d2002229..52309e5fc81 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -532,7 +532,7 @@ static bool rename_share_filename_fn(
e->name_hash = state->new_name_hash;
*modified = true;
- ok = serverid_equal(&e->pid, &state->self);
+ ok = server_id_equal(&e->pid, &state->self);
if (ok) {
return false;
}
@@ -1013,11 +1013,12 @@ bool set_sticky_write_time(struct file_id fileid, struct timespec write_time)
bool set_write_time(struct file_id fileid, struct timespec write_time)
{
struct share_mode_lock *lck;
+ struct file_id_buf idbuf;
- DEBUG(5,("set_write_time: %s id=%s\n",
+ DBG_INFO("%s id=%s\n",
timestring(talloc_tos(),
convert_timespec_to_time_t(write_time)),
- file_id_string_tos(&fileid)));
+ file_id_str_buf(fileid, &idbuf));
lck = get_existing_share_mode_lock(talloc_tos(), fileid);
if (lck == NULL) {
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 3b75cfe481a..91485133eb2 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -681,7 +681,7 @@ static struct lock_list *posix_lock_list(TALLOC_CTX *ctx,
}
/* Ignore locks not owned by this process. */
- if (!serverid_equal(&lock->context.pid, &lock_ctx->pid)) {
+ if (!server_id_equal(&lock->context.pid, &lock_ctx->pid)) {
continue;
}
@@ -1223,7 +1223,7 @@ static bool locks_exist_on_context(const struct lock_struct *plocks,
}
/* Ignore locks not owned by this process. */
- if (!serverid_equal(&lock->context.pid, &lock_ctx->pid)) {
+ if (!server_id_equal(&lock->context.pid, &lock_ctx->pid)) {
continue;
}
diff --git a/source3/modules/vfs_delay_inject.c b/source3/modules/vfs_delay_inject.c
index 569bd40054a..6be9fe57292 100644
--- a/source3/modules/vfs_delay_inject.c
+++ b/source3/modules/vfs_delay_inject.c
@@ -334,8 +334,9 @@ static void vfs_delay_inject_brl_lock_timer(struct tevent_context *ev,
status = share_mode_wakeup_waiters(state->fsp->file_id);
if (!NT_STATUS_IS_OK(status)) {
+ struct file_id_buf idbuf;
DBG_ERR("share_mode_wakeup_waiters(%s) %s\n",
- file_id_string_tos(&state->fsp->file_id),
+ file_id_str_buf(state->fsp->file_id, &idbuf),
nt_errstr(status));
}
}
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index a13c4da419b..8e46f983390 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -1875,16 +1875,17 @@ static int smb_full_audit_chflags(vfs_handle_struct *handle,
static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *handle,
const SMB_STRUCT_STAT *sbuf)
{
- struct file_id id_zero;
+ struct file_id id_zero = { 0 };
struct file_id result;
-
- ZERO_STRUCT(id_zero);
+ struct file_id_buf idbuf;
result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
do_log(SMB_VFS_OP_FILE_ID_CREATE,
!file_id_equal(&id_zero, &result),
- handle, "%s", file_id_string_tos(&result));
+ handle,
+ "%s",
+ file_id_str_buf(result, &idbuf));
return result;
}
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index 6246a61672e..d4de3cdcfdd 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -862,7 +862,7 @@ static int count_sess_files_fn(struct file_id fid,
*/
struct sessionid *sess = &info->session_list[rh + i];
if ((e->uid == sess->uid) &&
- serverid_equal(&e->pid, &sess->pid)) {
+ server_id_equal(&e->pid, &sess->pid)) {
info->ctr->array[i].num_open++;
return 0;
@@ -981,7 +981,8 @@ static int share_file_fn(struct file_id fid,
if (strequal(d->servicepath, sfs->in_sharepath)) {
for (i=0; i < sfs->resp_entries; i++) {
- if (serverid_equal(&e->pid, &sfs->svrid_arr[offset + i])) {
+ if (server_id_equal(
+ &e->pid, &sfs->svrid_arr[offset + i])) {
sfs->netconn_arr[i].num_open ++;
return 0;
}
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 9493021c48d..2d4168c3ebe 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1566,7 +1566,7 @@ static bool validate_my_share_entries_fn(
struct validate_my_share_entries_state *state = private_data;
files_struct *fsp;
- if (!serverid_equal(&state->self, &e->pid)) {
+ if (!server_id_equal(&state->self, &e->pid)) {
return false;
}
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index b3da84b1269..1a62821c760 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -58,6 +58,7 @@ NTSTATUS set_file_oplock(files_struct *fsp)
struct kernel_oplocks *koplocks = sconn->oplocks.kernel_ops;
bool use_kernel = lp_kernel_oplocks(SNUM(fsp->conn)) &&
(koplocks != NULL);
+ struct file_id_buf buf;
if (fsp->oplock_type == LEVEL_II_OPLOCK && use_kernel) {
DEBUG(10, ("Refusing level2 oplock, kernel oplocks "
@@ -82,7 +83,7 @@ NTSTATUS set_file_oplock(files_struct *fsp)
DBG_INFO("granted oplock on file %s, %s/%"PRIu64", "
"tv_sec = %x, tv_usec = %x\n",
fsp_str_dbg(fsp),
- file_id_string_tos(&fsp->file_id),
+ file_id_str_buf(fsp->file_id, &buf),
fsp->fh->gen_id,
(int)fsp->open_time.tv_sec,
(int)fsp->open_time.tv_usec);
@@ -219,10 +220,12 @@ bool remove_oplock(files_struct *fsp)
ret = remove_share_oplock(lck, fsp);
if (!ret) {
+ struct file_id_buf buf;
+
DBG_ERR("failed to remove share oplock for "
"file %s, %s, %s\n",
fsp_str_dbg(fsp), fsp_fnum_dbg(fsp),
- file_id_string_tos(&fsp->file_id));
+ file_id_str_buf(fsp->file_id, &buf));
}
release_file_oplock(fsp);
@@ -249,10 +252,12 @@ bool downgrade_oplock(files_struct *fsp)
}
ret = downgrade_share_oplock(lck, fsp);
if (!ret) {
- DEBUG(0,("downgrade_oplock: failed to downgrade share oplock "
- "for file %s, %s, file_id %s\n",
- fsp_str_dbg(fsp), fsp_fnum_dbg(fsp),
- file_id_string_tos(&fsp->file_id)));
+ struct file_id_buf idbuf;
+ DBG_ERR("failed to downgrade share oplock "
+ "for file %s, %s, file_id %s\n",
+ fsp_str_dbg(fsp),
+ fsp_fnum_dbg(fsp),
+ file_id_str_buf(fsp->file_id, &idbuf));
}
downgrade_file_oplock(fsp);
@@ -475,9 +480,11 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
uint16_t lease_version, epoch;
NTSTATUS status;
uint32_t i;
+ struct file_id_buf idbuf;
- DEBUG(10, ("%s: Downgrading %s to %x\n", __func__,
- file_id_string_tos(&id), (unsigned)lease_state));
+ DBG_DEBUG("Downgrading %s to %"PRIu32"\n",
+ file_id_str_buf(id, &idbuf),
+ lease_state);
lck = get_existing_share_mode_lock(talloc_tos(), id);
if (lck == NULL) {
@@ -647,8 +654,10 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
}
}
- DEBUG(10, ("%s: Downgrading %s to %x => %s\n", __func__,
- file_id_string_tos(&id), (unsigned)lease_state, nt_errstr(status)));
+ DBG_DEBUG("Downgrading %s to %"PRIu32" => %s\n",
+ file_id_str_buf(id, &idbuf),
+ lease_state,
+ nt_errstr(status));
/*
* No, we did not modify the share mode array. We did modify
@@ -661,8 +670,11 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
fsps_lease_update(sconn, &id, key);
TALLOC_FREE(lck);
- DEBUG(10, ("%s: Downgrading %s to %x => %s\n", __func__,
- file_id_string_tos(&id), (unsigned)lease_state, nt_errstr(status)));
+
+ DBG_DEBUG("Downgrading %s to %"PRIu32" => %s\n",
+ file_id_str_buf(id, &idbuf),
+ lease_state,
+ nt_errstr(status));
/*
* Dynamic share case. Ensure other opens are copies.
@@ -677,8 +689,10 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
fsps_lease_update(sconn, &ids[i], key);
- DEBUG(10, ("%s: Downgrading %s to %x => %s\n", __func__,
- file_id_string_tos(&ids[i]), (unsigned)lease_state, nt_errstr(status)));
+ DBG_DEBUG("Downgrading %s to %"PRIu32" => %s\n",
+ file_id_str_buf(ids[i], &idbuf),
+ lease_state,
+ nt_errstr(status));
TALLOC_FREE(lck);
}
@@ -730,12 +744,14 @@ static files_struct *initial_break_processing(
unsigned long file_id)
{
files_struct *fsp = NULL;
+ struct file_id_buf idbuf;
- DEBUG(3, ("initial_break_processing: called for %s/%u\n"
- "Current oplocks_open (exclusive = %d, levelII = %d)\n",
- file_id_string_tos(&id), (int)file_id,
- sconn->oplocks.exclusive_open,
- sconn->oplocks.level_II_open));
+ DBG_NOTICE("called for %s/%u\n"
+ "Current oplocks_open (exclusive = %d, levelII = %d)\n",
+ file_id_str_buf(id, &idbuf),
+ (int)file_id,
+ sconn->oplocks.exclusive_open,
+ sconn->oplocks.level_II_open);
/*
* We need to search the file open table for the
@@ -747,9 +763,11 @@ static files_struct *initial_break_processing(
if(fsp == NULL) {
/* The file could have been closed in the meantime - return success. */
- DEBUG(3, ("initial_break_processing: cannot find open file "
- "with file_id %s gen_id = %lu, allowing break to "
- "succeed.\n", file_id_string_tos(&id), file_id));
+ DBG_NOTICE("cannot find open file "
+ "with file_id %s gen_id = %lu, allowing break to "
+ "succeed.\n",
+ file_id_str_buf(id, &idbuf),
+ file_id);
return NULL;
}
@@ -768,7 +786,7 @@ static files_struct *initial_break_processing(
"has no oplock. "
--
Samba Shared Repository
More information about the samba-cvs
mailing list