s3-auth Use the common gensec_ntlmssp_update in gensec_ntlmssp3_server
[ira/wip.git] / source3 / utils / net_registry_check.c
index ce7032ab64963b94a753638920eba172b9ebe0bc..8d1a91c44b3786e512e28be3bddf963f0be6f3b5 100644 (file)
@@ -207,15 +207,11 @@ static bool tdb_data_read_regval(TDB_DATA *buf, struct regval *result)
        return true;
 }
 
-static bool tdb_data_is_empty(TDB_DATA d) {
-       return (d.dptr == NULL) || (d.dsize == 0);
-}
-
 static bool tdb_data_is_cstr(TDB_DATA d) {
-       if (tdb_data_is_empty(d)) {
+       if (tdb_data_is_empty(d) || (d.dptr[d.dsize-1] != '\0')) {
                return false;
        }
-       return (d.dptr[d.dsize-1] == '\0');
+       return strchr((char *)d.dptr, '\0') == (char *)&d.dptr[d.dsize-1];
 }
 
 static char* tdb_data_print(TALLOC_CTX *mem_ctx, TDB_DATA d)
@@ -358,7 +354,8 @@ static bool check_ctx_open_output(struct check_ctx *ctx)
                ctx->opt.wipe = true;
        }
 
-       ctx->odb = db_open(ctx, ctx->opt.output, 0, TDB_DEFAULT, oflags, 0644);
+       ctx->odb = db_open(ctx, ctx->opt.output, 0, TDB_DEFAULT, oflags, 0644,
+                          DBWRAP_LOCK_ORDER_1);
        if (ctx->odb == NULL) {
                d_fprintf(stderr,
                          _("Could not open db (%s) for writing: %s\n"),
@@ -370,7 +367,8 @@ static bool check_ctx_open_output(struct check_ctx *ctx)
 
 
 static bool check_ctx_open_input(struct check_ctx *ctx) {
-       ctx->idb = db_open(ctx, ctx->fname, 0, TDB_DEFAULT, O_RDONLY, 0);
+       ctx->idb = db_open(ctx, ctx->fname, 0, TDB_DEFAULT, O_RDONLY, 0,
+                          DBWRAP_LOCK_ORDER_1);
        if (ctx->idb == NULL) {
                d_fprintf(stderr,
                          _("Could not open db (%s) for reading: %s\n"),
@@ -668,8 +666,7 @@ static bool srprs_path(const char **ptr, const char* prefix, char sep,
                return false;
        }
        *ppath = path;
-       /* We know pos ends in '\0'. */
-       *ptr = &pos[strlen(pos)];
+       *ptr = strchr(pos, '\0');
        return true;
 }