The branch, master has been updated
       via  be3c8d0 lib: Make g_lock_locks use TDB_DATA
       via  67fcc7d lib: Make g_lock_dump use TDB_DATA
       via  a6c749e lib: Make g_lock_do use TDB_DATA
       via  ed3521d lib: Make g_lock_write_data use TDB_DATA
       via  a104e08 lib: Make g_lock_unlock use TDB_DATA
       via  bdeb7e7 lib: Make g_lock_lock use TDB_DATA
       via  3bc87a2 lib: Make g_lock_lock_send use TDB_DATA
      from  c7d0e6f samba-tool/tests: Check that dns cleanup does not 
spuriously remove entries

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit be3c8d08ec6331c2d4c1724cb3933c34fb7d7f0f
Author: Volker Lendecke <v...@samba.org>
Date:   Sun Dec 3 20:47:02 2017 +0100

    lib: Make g_lock_locks use TDB_DATA
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Ralph Boehme <s...@samba.org>
    
    Autobuild-User(master): Ralph Böhme <s...@samba.org>
    Autobuild-Date(master): Thu Feb  8 14:50:49 CET 2018 on sn-devel-144

commit 67fcc7dbb9ad63886c594b1f563b6c1d2060cbd1
Author: Volker Lendecke <v...@samba.org>
Date:   Sun Dec 3 20:47:02 2017 +0100

    lib: Make g_lock_dump use TDB_DATA
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Ralph Boehme <s...@samba.org>

commit a6c749e76cd4f3be0f3a0db81324491314b949c0
Author: Volker Lendecke <v...@samba.org>
Date:   Sun Dec 3 20:47:02 2017 +0100

    lib: Make g_lock_do use TDB_DATA
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Ralph Boehme <s...@samba.org>

commit ed3521d1729a7bda1f127f4c5a754bf01b174665
Author: Volker Lendecke <v...@samba.org>
Date:   Sun Dec 3 20:47:02 2017 +0100

    lib: Make g_lock_write_data use TDB_DATA
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Ralph Boehme <s...@samba.org>

commit a104e08171b50b9e23dc1869049d12e0c6176979
Author: Volker Lendecke <v...@samba.org>
Date:   Sun Dec 3 20:47:02 2017 +0100

    lib: Make g_lock_unlock use TDB_DATA
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Ralph Boehme <s...@samba.org>

commit bdeb7e7d8185a112064930edbf0cf1ee5b72999e
Author: Volker Lendecke <v...@samba.org>
Date:   Sun Dec 3 20:47:02 2017 +0100

    lib: Make g_lock_lock use TDB_DATA
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Ralph Boehme <s...@samba.org>

commit 3bc87a20e9c6af358749c0b9d17e03a281086d3e
Author: Volker Lendecke <v...@samba.org>
Date:   Sun Dec 3 20:47:02 2017 +0100

    lib: Make g_lock_lock_send use TDB_DATA
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Ralph Boehme <s...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 libcli/auth/netlogon_creds_cli.c |  9 ++---
 source3/include/g_lock.h         | 14 ++++----
 source3/lib/dbwrap/dbwrap_ctdb.c |  7 ++--
 source3/lib/g_lock.c             | 72 +++++++++++++++++++-------------------
 source3/libsmb/trusts_util.c     |  6 ++--
 source3/smbd/server.c            | 14 ++++----
 source3/torture/test_g_lock.c    | 75 ++++++++++++++++++++++++----------------
 source3/utils/net_g_lock.c       | 14 +++++---
 source3/utils/net_registry.c     |  5 +--
 9 files changed, 123 insertions(+), 93 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/auth/netlogon_creds_cli.c b/libcli/auth/netlogon_creds_cli.c
index cb3d6a9..fdd1195 100644
--- a/libcli/auth/netlogon_creds_cli.c
+++ b/libcli/auth/netlogon_creds_cli.c
@@ -93,7 +93,7 @@ static int netlogon_creds_cli_locked_state_destructor(
 
        if (state->is_glocked) {
                g_lock_unlock(context->db.g_ctx,
-                             context->db.key_name);
+                             string_term_tdb_data(context->db.key_name));
        }
 
        return 0;
@@ -765,7 +765,7 @@ struct tevent_req *netlogon_creds_cli_lock_send(TALLOC_CTX 
*mem_ctx,
 
        subreq = g_lock_lock_send(state, ev,
                                  context->db.g_ctx,
-                                 context->db.key_name,
+                                 string_term_tdb_data(context->db.key_name),
                                  G_LOCK_WRITE);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -978,7 +978,7 @@ struct tevent_req *netlogon_creds_cli_lck_send(
 
        subreq = g_lock_lock_send(state, ev,
                                  context->db.g_ctx,
-                                 context->db.key_name,
+                                 string_term_tdb_data(context->db.key_name),
                                  gtype);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -1014,7 +1014,8 @@ static int netlogon_creds_cli_lck_destructor(
        struct netlogon_creds_cli_context *ctx = lck->context;
        NTSTATUS status;
 
-       status = g_lock_unlock(ctx->db.g_ctx, ctx->db.key_name);
+       status = g_lock_unlock(ctx->db.g_ctx,
+                              string_term_tdb_data(ctx->db.key_name));
        if (!NT_STATUS_IS_OK(status)) {
                DBG_WARNING("g_lock_unlock failed: %s\n", nt_errstr(status));
                smb_panic("g_lock_unlock failed");
diff --git a/source3/include/g_lock.h b/source3/include/g_lock.h
index e6d4de1..c3e3a50 100644
--- a/source3/include/g_lock.h
+++ b/source3/include/g_lock.h
@@ -41,24 +41,24 @@ struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
 struct tevent_req *g_lock_lock_send(TALLOC_CTX *mem_ctx,
                                    struct tevent_context *ev,
                                    struct g_lock_ctx *ctx,
-                                   const char *name,
+                                   TDB_DATA key,
                                    enum g_lock_type type);
 NTSTATUS g_lock_lock_recv(struct tevent_req *req);
-NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name,
+NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, TDB_DATA key,
                     enum g_lock_type lock_type, struct timeval timeout);
-NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, const char *name);
+NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, TDB_DATA key);
 
-NTSTATUS g_lock_write_data(struct g_lock_ctx *ctx, const char *name,
+NTSTATUS g_lock_write_data(struct g_lock_ctx *ctx, TDB_DATA key,
                           const uint8_t *buf, size_t buflen);
 
-NTSTATUS g_lock_do(const char *name, enum g_lock_type lock_type,
+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)(const char *name, void *private_data),
+                int (*fn)(TDB_DATA key, void *private_data),
                 void *private_data);
-NTSTATUS g_lock_dump(struct g_lock_ctx *ctx, const char *name,
+NTSTATUS g_lock_dump(struct g_lock_ctx *ctx, TDB_DATA key,
                     void (*fn)(const struct g_lock_rec *locks,
                                size_t num_locks,
                                const uint8_t *data,
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index 25db140..2885f4e 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -328,7 +328,8 @@ static int db_ctdb_transaction_destructor(struct 
db_ctdb_transaction_handle *h)
 {
        NTSTATUS status;
 
-       status = g_lock_unlock(h->ctx->lock_ctx, h->lock_name);
+       status = g_lock_unlock(h->ctx->lock_ctx,
+                              string_term_tdb_data(h->lock_name));
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("g_lock_unlock failed for %s: %s\n", h->lock_name,
                          nt_errstr(status)));
@@ -380,8 +381,8 @@ static int db_ctdb_transaction_start(struct db_context *db)
        /*
         * Wait a day, i.e. forever...
         */
-       status = g_lock_lock(ctx->lock_ctx, h->lock_name, G_LOCK_WRITE,
-                            timeval_set(86400, 0));
+       status = g_lock_lock(ctx->lock_ctx, string_term_tdb_data(h->lock_name),
+                            G_LOCK_WRITE, timeval_set(86400, 0));
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("g_lock_lock failed: %s\n", nt_errstr(status)));
                TALLOC_FREE(h);
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index 4c42fb0..9ce0e06 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -311,7 +311,7 @@ done:
 struct g_lock_lock_state {
        struct tevent_context *ev;
        struct g_lock_ctx *ctx;
-       const char *name;
+       TDB_DATA key;
        enum g_lock_type type;
 };
 
@@ -343,7 +343,7 @@ static void g_lock_lock_fn(struct db_record *rec, void 
*private_data)
 struct tevent_req *g_lock_lock_send(TALLOC_CTX *mem_ctx,
                                    struct tevent_context *ev,
                                    struct g_lock_ctx *ctx,
-                                   const char *name,
+                                   TDB_DATA key,
                                    enum g_lock_type type)
 {
        struct tevent_req *req;
@@ -357,15 +357,14 @@ struct tevent_req *g_lock_lock_send(TALLOC_CTX *mem_ctx,
        }
        state->ev = ev;
        state->ctx = ctx;
-       state->name = name;
+       state->key = key;
        state->type = type;
 
        fn_state = (struct g_lock_lock_fn_state) {
                .state = state, .self = messaging_server_id(ctx->msg)
        };
 
-       status = dbwrap_do_locked(ctx->db, string_term_tdb_data(name),
-                                 g_lock_lock_fn, &fn_state);
+       status = dbwrap_do_locked(ctx->db, key, g_lock_lock_fn, &fn_state);
        if (tevent_req_nterror(req, status)) {
                DBG_DEBUG("dbwrap_do_locked failed: %s\n",
                          nt_errstr(status));
@@ -418,8 +417,7 @@ static void g_lock_lock_retry(struct tevent_req *subreq)
                .state = state, .self = messaging_server_id(state->ctx->msg)
        };
 
-       status = dbwrap_do_locked(state->ctx->db,
-                                 string_term_tdb_data(state->name),
+       status = dbwrap_do_locked(state->ctx->db, state->key,
                                  g_lock_lock_fn, &fn_state);
        if (tevent_req_nterror(req, status)) {
                DBG_DEBUG("dbwrap_do_locked failed: %s\n",
@@ -454,7 +452,7 @@ NTSTATUS g_lock_lock_recv(struct tevent_req *req)
        return tevent_req_simple_recv_ntstatus(req);
 }
 
-NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name,
+NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, TDB_DATA key,
                     enum g_lock_type type, struct timeval timeout)
 {
        TALLOC_CTX *frame = talloc_stackframe();
@@ -467,7 +465,7 @@ NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char 
*name,
        if (ev == NULL) {
                goto fail;
        }
-       req = g_lock_lock_send(frame, ev, ctx, name, type);
+       req = g_lock_lock_send(frame, ev, ctx, key, type);
        if (req == NULL) {
                goto fail;
        }
@@ -485,7 +483,7 @@ NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char 
*name,
 }
 
 struct g_lock_unlock_state {
-       const char *name;
+       TDB_DATA key;
        struct server_id self;
        NTSTATUS status;
 };
@@ -503,7 +501,10 @@ static void g_lock_unlock_fn(struct db_record *rec,
 
        ok = g_lock_parse(value.dptr, value.dsize, &lck);
        if (!ok) {
-               DBG_DEBUG("g_lock_get for %s failed\n", state->name);
+               DBG_DEBUG("g_lock_get for %s failed\n",
+                         hex_encode_talloc(talloc_tos(),
+                                           state->key.dptr,
+                                           state->key.dsize));
                state->status = NT_STATUS_FILE_INVALID;
                return;
        }
@@ -529,15 +530,14 @@ static void g_lock_unlock_fn(struct db_record *rec,
        state->status = g_lock_store(rec, &lck, NULL);
 }
 
-NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, const char *name)
+NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, TDB_DATA key)
 {
        struct g_lock_unlock_state state = {
-               .self = messaging_server_id(ctx->msg), .name = name
+               .self = messaging_server_id(ctx->msg), .key = key
        };
        NTSTATUS status;
 
-       status = dbwrap_do_locked(ctx->db, string_term_tdb_data(name),
-                                 g_lock_unlock_fn, &state);
+       status = dbwrap_do_locked(ctx->db, key, g_lock_unlock_fn, &state);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_WARNING("dbwrap_do_locked failed: %s\n",
                            nt_errstr(status));
@@ -553,7 +553,7 @@ NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, const char 
*name)
 }
 
 struct g_lock_write_data_state {
-       const char *name;
+       TDB_DATA key;
        struct server_id self;
        const uint8_t *data;
        size_t datalen;
@@ -573,7 +573,10 @@ static void g_lock_write_data_fn(struct db_record *rec,
 
        ok = g_lock_parse(value.dptr, value.dsize, &lck);
        if (!ok) {
-               DBG_DEBUG("g_lock_parse for %s failed\n", state->name);
+               DBG_DEBUG("g_lock_parse for %s failed\n",
+                         hex_encode_talloc(talloc_tos(),
+                                           state->key.dptr,
+                                           state->key.dsize));
                state->status = NT_STATUS_INTERNAL_DB_CORRUPTION;
                return;
        }
@@ -596,16 +599,16 @@ static void g_lock_write_data_fn(struct db_record *rec,
        state->status = g_lock_store(rec, &lck, NULL);
 }
 
-NTSTATUS g_lock_write_data(struct g_lock_ctx *ctx, const char *name,
+NTSTATUS g_lock_write_data(struct g_lock_ctx *ctx, TDB_DATA key,
                           const uint8_t *buf, size_t buflen)
 {
        struct g_lock_write_data_state state = {
-               .name = name, .self = messaging_server_id(ctx->msg),
+               .key = key, .self = messaging_server_id(ctx->msg),
                .data = buf, .datalen = buflen
        };
        NTSTATUS status;
 
-       status = dbwrap_do_locked(ctx->db, string_term_tdb_data(name),
+       status = dbwrap_do_locked(ctx->db, key,
                                  g_lock_write_data_fn, &state);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_WARNING("dbwrap_do_locked failed: %s\n",
@@ -622,7 +625,7 @@ NTSTATUS g_lock_write_data(struct g_lock_ctx *ctx, const 
char *name,
 }
 
 struct g_lock_locks_state {
-       int (*fn)(const char *name, void *private_data);
+       int (*fn)(TDB_DATA key, void *private_data);
        void *private_data;
 };
 
@@ -632,15 +635,11 @@ static int g_lock_locks_fn(struct db_record *rec, void 
*priv)
        struct g_lock_locks_state *state = (struct g_lock_locks_state *)priv;
 
        key = dbwrap_record_get_key(rec);
-       if ((key.dsize == 0) || (key.dptr[key.dsize-1] != 0)) {
-               DEBUG(1, ("invalid key in g_lock.tdb, ignoring\n"));
-               return 0;
-       }
-       return state->fn((char *)key.dptr, state->private_data);
+       return state->fn(key, state->private_data);
 }
 
 int g_lock_locks(struct g_lock_ctx *ctx,
-                int (*fn)(const char *name, void *private_data),
+                int (*fn)(TDB_DATA key, void *private_data),
                 void *private_data)
 {
        struct g_lock_locks_state state;
@@ -659,7 +658,7 @@ int g_lock_locks(struct g_lock_ctx *ctx,
 
 struct g_lock_dump_state {
        TALLOC_CTX *mem_ctx;
-       const char *name;
+       TDB_DATA key;
        void (*fn)(const struct g_lock_rec *locks,
                   size_t num_locks,
                   const uint8_t *data,
@@ -681,7 +680,9 @@ static void g_lock_dump_fn(TDB_DATA key, TDB_DATA data,
        ok = g_lock_parse(data.dptr, data.dsize, &lck);
        if (!ok) {
                DBG_DEBUG("g_lock_parse failed for %s\n",
-                         state->name);
+                         hex_encode_talloc(talloc_tos(),
+                                           state->key.dptr,
+                                           state->key.dsize));
                state->status = NT_STATUS_INTERNAL_DB_CORRUPTION;
                return;
        }
@@ -705,7 +706,7 @@ static void g_lock_dump_fn(TDB_DATA key, TDB_DATA data,
        state->status = NT_STATUS_OK;
 }
 
-NTSTATUS g_lock_dump(struct g_lock_ctx *ctx, const char *name,
+NTSTATUS g_lock_dump(struct g_lock_ctx *ctx, TDB_DATA key,
                     void (*fn)(const struct g_lock_rec *locks,
                                size_t num_locks,
                                const uint8_t *data,
@@ -714,13 +715,12 @@ NTSTATUS g_lock_dump(struct g_lock_ctx *ctx, const char 
*name,
                     void *private_data)
 {
        struct g_lock_dump_state state = {
-               .mem_ctx = ctx, .name = name,
+               .mem_ctx = ctx, .key = key,
                .fn = fn, .private_data = private_data
        };
        NTSTATUS status;
 
-       status = dbwrap_parse_record(ctx->db, string_term_tdb_data(name),
-                                    g_lock_dump_fn, &state);
+       status = dbwrap_parse_record(ctx->db, key, g_lock_dump_fn, &state);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_DEBUG("dbwrap_parse_record returned %s\n",
                          nt_errstr(status));
@@ -770,7 +770,7 @@ fail:
        return false;
 }
 
-NTSTATUS g_lock_do(const char *name, enum g_lock_type lock_type,
+NTSTATUS g_lock_do(TDB_DATA key, enum g_lock_type lock_type,
                   struct timeval timeout,
                   void (*fn)(void *private_data), void *private_data)
 {
@@ -784,12 +784,12 @@ NTSTATUS g_lock_do(const char *name, enum g_lock_type 
lock_type,
                goto done;
        }
 
-       status = g_lock_lock(g_ctx, name, lock_type, timeout);
+       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, name);
+       g_lock_unlock(g_ctx, key);
 
 done:
        TALLOC_FREE(g_ctx);
diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index 27e77e6..fd1b337 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -30,6 +30,7 @@
 #include "libsmb/libsmb.h"
 #include "source3/include/messages.h"
 #include "source3/include/g_lock.h"
+#include "lib/util/util_tdb.h"
 
 /*********************************************************
  Change the domain password on the PDC.
@@ -44,7 +45,8 @@ struct trust_pw_change_state {
 
 static int trust_pw_change_state_destructor(struct trust_pw_change_state 
*state)
 {
-       g_lock_unlock(state->g_ctx, state->g_lock_key);
+       g_lock_unlock(state->g_ctx,
+                     string_term_tdb_data(state->g_lock_key));
        return 0;
 }
 
@@ -191,7 +193,7 @@ NTSTATUS trust_pw_change(struct netlogon_creds_cli_context 
*context,
 
        g_timeout = timeval_current_ofs(10, 0);
        status = g_lock_lock(state->g_ctx,
-                            state->g_lock_key,
+                            string_term_tdb_data(state->g_lock_key),
                             G_LOCK_WRITE, g_timeout);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(1, ("could not get g_lock on [%s]!\n",
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 79786d6..99baf9d 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1480,7 +1480,7 @@ static NTSTATUS smbd_claim_version(struct 
messaging_context *msg,
                return NT_STATUS_UNSUCCESSFUL;
        }
 
-       status = g_lock_lock(ctx, name, G_LOCK_READ,
+       status = g_lock_lock(ctx, string_term_tdb_data(name), G_LOCK_READ,
                             (struct timeval) { .tv_sec = 60 });
        if (!NT_STATUS_IS_OK(status)) {
                DBG_WARNING("g_lock_lock(G_LOCK_READ) failed: %s\n",
@@ -1491,11 +1491,12 @@ static NTSTATUS smbd_claim_version(struct 
messaging_context *msg,
 
        state = (struct smbd_claim_version_state) { .mem_ctx = ctx };
 
-       status = g_lock_dump(ctx, name, smbd_claim_version_parser, &state);
+       status = g_lock_dump(ctx, string_term_tdb_data(name),
+                            smbd_claim_version_parser, &state);
        if (!NT_STATUS_IS_OK(status) &&
            !NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
                DBG_ERR("Could not read samba_version_string\n");
-               g_lock_unlock(ctx, name);
+               g_lock_unlock(ctx, string_term_tdb_data(name));
                TALLOC_FREE(ctx);
                return status;
        }
@@ -1509,7 +1510,7 @@ static NTSTATUS smbd_claim_version(struct 
messaging_context *msg,
                return NT_STATUS_OK;
        }
 
-       status = g_lock_lock(ctx, name, G_LOCK_WRITE,
+       status = g_lock_lock(ctx, string_term_tdb_data(name), G_LOCK_WRITE,
                             (struct timeval) { .tv_sec = 60 });
        if (!NT_STATUS_IS_OK(status)) {
                DBG_WARNING("g_lock_lock(G_LOCK_WRITE) failed: %s\n",
@@ -1520,7 +1521,8 @@ static NTSTATUS smbd_claim_version(struct 
messaging_context *msg,
                return NT_STATUS_SXS_VERSION_CONFLICT;
        }
 
-       status = g_lock_write_data(ctx, name, (const uint8_t *)version,
+       status = g_lock_write_data(ctx, string_term_tdb_data(name),
+                                  (const uint8_t *)version,
                                   strlen(version)+1);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_WARNING("g_lock_write_data failed: %s\n",
@@ -1529,7 +1531,7 @@ static NTSTATUS smbd_claim_version(struct 
messaging_context *msg,
                return status;
        }
 
-       status = g_lock_lock(ctx, name, G_LOCK_READ,
+       status = g_lock_lock(ctx, string_term_tdb_data(name), G_LOCK_READ,
                             (struct timeval) { .tv_sec = 60 });
        if (!NT_STATUS_IS_OK(status)) {
                DBG_WARNING("g_lock_lock(G_LOCK_READ) failed: %s\n",
diff --git a/source3/torture/test_g_lock.c b/source3/torture/test_g_lock.c
index 718c196..43e699f 100644
--- a/source3/torture/test_g_lock.c
+++ b/source3/torture/test_g_lock.c
@@ -24,6 +24,7 @@
 #include "messages.h"
 #include "lib/util/server_id.h"
 #include "lib/util/sys_rw.h"
+#include "lib/util/util_tdb.h"
 
 static bool get_g_lock_ctx(TALLOC_CTX *mem_ctx,
                           struct tevent_context **ev,
@@ -67,7 +68,7 @@ bool run_g_lock1(int dummy)
                goto fail;
        }
 
-       status = g_lock_lock(ctx, lockname, G_LOCK_READ,
+       status = g_lock_lock(ctx, string_term_tdb_data(lockname), G_LOCK_READ,
                             (struct timeval) { .tv_sec = 1 });
        if (!NT_STATUS_IS_OK(status)) {
                fprintf(stderr, "g_lock_lock failed: %s\n",
@@ -75,7 +76,7 @@ bool run_g_lock1(int dummy)
                goto fail;
        }
 
-       status = g_lock_lock(ctx, lockname, G_LOCK_READ,
+       status = g_lock_lock(ctx, string_term_tdb_data(lockname), G_LOCK_READ,
                             (struct timeval) { .tv_sec = 1 });
        if (!NT_STATUS_EQUAL(status, NT_STATUS_WAS_LOCKED)) {
                fprintf(stderr, "Double lock got %s\n",
@@ -83,14 +84,14 @@ bool run_g_lock1(int dummy)
                goto fail;
        }
 
-       status = g_lock_unlock(ctx, lockname);
+       status = g_lock_unlock(ctx, string_term_tdb_data(lockname));
        if (!NT_STATUS_IS_OK(status)) {
                fprintf(stderr, "g_lock_unlock failed: %s\n",
                        nt_errstr(status));
                goto fail;
        }
 
-       status = g_lock_unlock(ctx, lockname);
+       status = g_lock_unlock(ctx, string_term_tdb_data(lockname));
        if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
                fprintf(stderr, "g_lock_unlock returned: %s\n",
                        nt_errstr(status));
@@ -147,14 +148,15 @@ bool run_g_lock2(int dummy)
                goto fail;
        }
 
-       status = g_lock_write_data(ctx, lockname, &data, sizeof(data));
+       status = g_lock_write_data(ctx, string_term_tdb_data(lockname),
+                                  &data, sizeof(data));
        if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_LOCKED)) {
                fprintf(stderr, "unlocked g_lock_write_data returned %s\n",
                        nt_errstr(status));
                goto fail;
        }
 
-       status = g_lock_lock(ctx, lockname, G_LOCK_WRITE,
+       status = g_lock_lock(ctx, string_term_tdb_data(lockname), G_LOCK_WRITE,
                             (struct timeval) { .tv_sec = 1 });
        if (!NT_STATUS_IS_OK(status)) {
                fprintf(stderr, "g_lock_lock returned %s\n",
@@ -162,21 +164,23 @@ bool run_g_lock2(int dummy)


-- 
Samba Shared Repository

Reply via email to