]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Move smbXsrv_open_global_parse_record() up in smbXsrv_open.c
authorVolker Lendecke <vl@samba.org>
Thu, 19 Jan 2023 11:22:33 +0000 (12:22 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 24 Jan 2023 08:19:34 +0000 (08:19 +0000)
Avoid a prototype in the next patches

Signed-off-by: Volker Lendecke <vl@samba.org>
source3/smbd/smbXsrv_open.c

index 1e1423fa0cb67f67e541f924d92a269d9db99627..1edd56350338d56b89f2a2ddf5e6d5028fa1577f 100644 (file)
@@ -321,6 +321,56 @@ static NTSTATUS smbXsrv_open_global_allocate(
        return NT_STATUS_INTERNAL_ERROR;
 }
 
+static NTSTATUS smbXsrv_open_global_parse_record(
+       TALLOC_CTX *mem_ctx,
+       struct db_record *rec,
+       struct smbXsrv_open_global0 **global)
+{
+       TDB_DATA key = dbwrap_record_get_key(rec);
+       TDB_DATA val = dbwrap_record_get_value(rec);
+       DATA_BLOB blob = data_blob_const(val.dptr, val.dsize);
+       struct smbXsrv_open_globalB global_blob;
+       enum ndr_err_code ndr_err;
+       NTSTATUS status;
+       TALLOC_CTX *frame = talloc_stackframe();
+
+       ndr_err = ndr_pull_struct_blob(&blob, frame, &global_blob,
+                       (ndr_pull_flags_fn_t)ndr_pull_smbXsrv_open_globalB);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               DEBUG(1,("Invalid record in smbXsrv_open_global.tdb:"
+                        "key '%s' ndr_pull_struct_blob - %s\n",
+                        tdb_data_dbg(key),
+                        ndr_errstr(ndr_err)));
+               status = ndr_map_error2ntstatus(ndr_err);
+               goto done;
+       }
+
+       if (global_blob.version != SMBXSRV_VERSION_0) {
+               status = NT_STATUS_INTERNAL_DB_CORRUPTION;
+               DEBUG(1,("Invalid record in smbXsrv_open_global.tdb:"
+                        "key '%s' unsupported version - %d - %s\n",
+                        tdb_data_dbg(key),
+                        (int)global_blob.version,
+                        nt_errstr(status)));
+               goto done;
+       }
+
+       if (global_blob.info.info0 == NULL) {
+               status = NT_STATUS_INTERNAL_DB_CORRUPTION;
+               DEBUG(1,("Invalid record in smbXsrv_tcon_global.tdb:"
+                        "key '%s' info0 NULL pointer - %s\n",
+                        tdb_data_dbg(key),
+                        nt_errstr(status)));
+               goto done;
+       }
+
+       *global = talloc_move(mem_ctx, &global_blob.info.info0);
+       status = NT_STATUS_OK;
+done:
+       talloc_free(frame);
+       return status;
+}
+
 static NTSTATUS smbXsrv_open_global_verify_record(
        TDB_DATA key,
        TDB_DATA val,
@@ -1265,55 +1315,6 @@ NTSTATUS smb2srv_open_recreate(struct smbXsrv_connection *conn,
 }
 
 
-static NTSTATUS smbXsrv_open_global_parse_record(TALLOC_CTX *mem_ctx,
-                                                struct db_record *rec,
-                                                struct smbXsrv_open_global0 **global)
-{
-       TDB_DATA key = dbwrap_record_get_key(rec);
-       TDB_DATA val = dbwrap_record_get_value(rec);
-       DATA_BLOB blob = data_blob_const(val.dptr, val.dsize);
-       struct smbXsrv_open_globalB global_blob;
-       enum ndr_err_code ndr_err;
-       NTSTATUS status;
-       TALLOC_CTX *frame = talloc_stackframe();
-
-       ndr_err = ndr_pull_struct_blob(&blob, frame, &global_blob,
-                       (ndr_pull_flags_fn_t)ndr_pull_smbXsrv_open_globalB);
-       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-               DEBUG(1,("Invalid record in smbXsrv_open_global.tdb:"
-                        "key '%s' ndr_pull_struct_blob - %s\n",
-                        tdb_data_dbg(key),
-                        ndr_errstr(ndr_err)));
-               status = ndr_map_error2ntstatus(ndr_err);
-               goto done;
-       }
-
-       if (global_blob.version != SMBXSRV_VERSION_0) {
-               status = NT_STATUS_INTERNAL_DB_CORRUPTION;
-               DEBUG(1,("Invalid record in smbXsrv_open_global.tdb:"
-                        "key '%s' unsupported version - %d - %s\n",
-                        tdb_data_dbg(key),
-                        (int)global_blob.version,
-                        nt_errstr(status)));
-               goto done;
-       }
-
-       if (global_blob.info.info0 == NULL) {
-               status = NT_STATUS_INTERNAL_DB_CORRUPTION;
-               DEBUG(1,("Invalid record in smbXsrv_tcon_global.tdb:"
-                        "key '%s' info0 NULL pointer - %s\n",
-                        tdb_data_dbg(key),
-                        nt_errstr(status)));
-               goto done;
-       }
-
-       *global = talloc_move(mem_ctx, &global_blob.info.info0);
-       status = NT_STATUS_OK;
-done:
-       talloc_free(frame);
-       return status;
-}
-
 struct smbXsrv_open_global_traverse_state {
        int (*fn)(struct smbXsrv_open_global0 *, void *);
        void *private_data;