summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2020-11-04 15:27:56 +0100
committerJeremy Allison <jra@samba.org>2020-11-10 19:49:35 +0000
commit5c3a18e51455c012ab691f00c259014041fb464d (patch)
treea74dd38067d5e96a91cf8496296a4e3bc35d7739 /source3/locking
parentce64b3caf3948459c1edf13896834a34d2a917e8 (diff)
downloadsamba-5c3a18e51455c012ab691f00c259014041fb464d.tar.gz
locking: Add share_mode_data_dump() accessor function
This is a special case for net tdb dump. The alternative would be to change the net tdb dump behaviour. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/share_mode_lock.c30
-rw-r--r--source3/locking/share_mode_lock.h2
2 files changed, 32 insertions, 0 deletions
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index 2ce7c1c2ea7..c860810d086 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -1146,6 +1146,36 @@ char *share_mode_filename(TALLOC_CTX *mem_ctx, struct share_mode_lock *lck)
return fname;
}
+char *share_mode_data_dump(
+ TALLOC_CTX *mem_ctx, struct share_mode_lock *lck)
+{
+ struct ndr_print *p = talloc(mem_ctx, struct ndr_print);
+ char *ret = NULL;
+
+ if (p == NULL) {
+ return NULL;
+ }
+
+ *p = (struct ndr_print) {
+ .print = ndr_print_string_helper,
+ .depth = 1,
+ .private_data = talloc_strdup(mem_ctx, ""),
+ };
+
+ if (p->private_data == NULL) {
+ TALLOC_FREE(p);
+ return NULL;
+ }
+
+ ndr_print_share_mode_data(p, "SHARE_MODE_DATA", lck->data);
+
+ ret = p->private_data;
+
+ TALLOC_FREE(p);
+
+ return ret;
+}
+
struct share_mode_watch_state {
bool blockerdead;
struct server_id blocker;
diff --git a/source3/locking/share_mode_lock.h b/source3/locking/share_mode_lock.h
index 8531d319728..4254859ce0a 100644
--- a/source3/locking/share_mode_lock.h
+++ b/source3/locking/share_mode_lock.h
@@ -101,6 +101,8 @@ bool share_mode_have_entries(struct share_mode_lock *lck);
NTTIME share_mode_changed_write_time(struct share_mode_lock *lck);
const char *share_mode_servicepath(struct share_mode_lock *lck);
char *share_mode_filename(TALLOC_CTX *mem_ctx, struct share_mode_lock *lck);
+char *share_mode_data_dump(
+ TALLOC_CTX *mem_ctx, struct share_mode_lock *lck);
struct tevent_req *share_mode_watch_send(
TALLOC_CTX *mem_ctx,