From: Volker Lendecke Date: Wed, 4 Nov 2020 14:27:56 +0000 (+0100) Subject: locking: Add share_mode_data_dump() accessor function X-Git-Tag: samba-4.14.0rc1~654 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5c3a18e51455c012ab691f00c259014041fb464d;p=thirdparty%2Fsamba.git 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 Reviewed-by: Jeremy Allison --- 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,