mirror of
https://github.com/samba-team/samba.git
synced 2025-11-22 16:23:49 +03:00
smbd: Move smbXsrv_open_global_parse_record() up in smbXsrv_open.c
Avoid a prototype in the next patches Signed-off-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user