1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

smbXsrv_session.c: use DBG* macros instead of static log level numbers

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Björn Jacke 2023-06-07 02:05:57 +02:00 committed by Andrew Bartlett
parent fa700369a9
commit 6003090d5f

View File

@ -300,28 +300,28 @@ static void smbXsrv_session_close_loop(struct tevent_req *subreq)
(ndr_pull_flags_fn_t)ndr_pull_smbXsrv_session_closeB);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
DEBUG(1,("smbXsrv_session_close_loop: "
DBG_WARNING("smbXsrv_session_close_loop: "
"ndr_pull_struct_blob - %s\n",
nt_errstr(status)));
nt_errstr(status));
goto next;
}
DEBUG(10,("smbXsrv_session_close_loop: MSG_SMBXSRV_SESSION_CLOSE\n"));
if (DEBUGLVL(10)) {
DBG_DEBUG("smbXsrv_session_close_loop: MSG_SMBXSRV_SESSION_CLOSE\n");
if (DEBUGLVL(DBGLVL_DEBUG)) {
NDR_PRINT_DEBUG(smbXsrv_session_closeB, &close_blob);
}
if (close_blob.version != SMBXSRV_VERSION_0) {
DEBUG(0,("smbXsrv_session_close_loop: "
"ignore invalid version %u\n", close_blob.version));
DBG_ERR("smbXsrv_session_close_loop: "
"ignore invalid version %u\n", close_blob.version);
NDR_PRINT_DEBUG(smbXsrv_session_closeB, &close_blob);
goto next;
}
close_info0 = close_blob.info.info0;
if (close_info0 == NULL) {
DEBUG(0,("smbXsrv_session_close_loop: "
"ignore NULL info %u\n", close_blob.version));
DBG_ERR("smbXsrv_session_close_loop: "
"ignore NULL info %u\n", close_blob.version);
NDR_PRINT_DEBUG(smbXsrv_session_closeB, &close_blob);
goto next;
}
@ -330,10 +330,10 @@ static void smbXsrv_session_close_loop(struct tevent_req *subreq)
close_info0->old_session_wire_id,
now, &session);
if (NT_STATUS_EQUAL(status, NT_STATUS_USER_SESSION_DELETED)) {
DEBUG(4,("smbXsrv_session_close_loop: "
DBG_INFO("smbXsrv_session_close_loop: "
"old_session_wire_id %llu not found\n",
(unsigned long long)close_info0->old_session_wire_id));
if (DEBUGLVL(4)) {
(unsigned long long)close_info0->old_session_wire_id);
if (DEBUGLVL(DBGLVL_INFO)) {
NDR_PRINT_DEBUG(smbXsrv_session_closeB, &close_blob);
}
goto next;
@ -341,38 +341,38 @@ static void smbXsrv_session_close_loop(struct tevent_req *subreq)
if (!NT_STATUS_IS_OK(status) &&
!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED) &&
!NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_SESSION_EXPIRED)) {
DEBUG(1,("smbXsrv_session_close_loop: "
DBG_WARNING("smbXsrv_session_close_loop: "
"old_session_wire_id %llu - %s\n",
(unsigned long long)close_info0->old_session_wire_id,
nt_errstr(status)));
if (DEBUGLVL(1)) {
nt_errstr(status));
if (DEBUGLVL(DBGLVL_WARNING)) {
NDR_PRINT_DEBUG(smbXsrv_session_closeB, &close_blob);
}
goto next;
}
if (session->global->session_global_id != close_info0->old_session_global_id) {
DEBUG(1,("smbXsrv_session_close_loop: "
DBG_WARNING("smbXsrv_session_close_loop: "
"old_session_wire_id %llu - global %u != %u\n",
(unsigned long long)close_info0->old_session_wire_id,
session->global->session_global_id,
close_info0->old_session_global_id));
if (DEBUGLVL(1)) {
close_info0->old_session_global_id);
if (DEBUGLVL(DBGLVL_WARNING)) {
NDR_PRINT_DEBUG(smbXsrv_session_closeB, &close_blob);
}
goto next;
}
if (session->global->creation_time != close_info0->old_creation_time) {
DEBUG(1,("smbXsrv_session_close_loop: "
DBG_WARNING("smbXsrv_session_close_loop: "
"old_session_wire_id %llu - "
"creation %s (%llu) != %s (%llu)\n",
(unsigned long long)close_info0->old_session_wire_id,
nt_time_string(rec, session->global->creation_time),
(unsigned long long)session->global->creation_time,
nt_time_string(rec, close_info0->old_creation_time),
(unsigned long long)close_info0->old_creation_time));
if (DEBUGLVL(1)) {
(unsigned long long)close_info0->old_creation_time);
if (DEBUGLVL(DBGLVL_WARNING)) {
NDR_PRINT_DEBUG(smbXsrv_session_closeB, &close_blob);
}
goto next;
@ -382,11 +382,11 @@ static void smbXsrv_session_close_loop(struct tevent_req *subreq)
session, NULL);
if (subreq == NULL) {
status = NT_STATUS_NO_MEMORY;
DEBUG(0, ("smbXsrv_session_close_loop: "
DBG_ERR("smbXsrv_session_close_loop: "
"smb2srv_session_shutdown_send(%llu) failed: %s\n",
(unsigned long long)session->global->session_wire_id,
nt_errstr(status)));
if (DEBUGLVL(1)) {
nt_errstr(status));
if (DEBUGLVL(DBGLVL_WARNING)) {
NDR_PRINT_DEBUG(smbXsrv_session_closeB, &close_blob);
}
goto next;
@ -421,18 +421,18 @@ static void smbXsrv_session_close_shutdown_done(struct tevent_req *subreq)
status = smb2srv_session_shutdown_recv(subreq);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("smbXsrv_session_close_loop: "
DBG_ERR("smbXsrv_session_close_loop: "
"smb2srv_session_shutdown_recv(%llu) failed: %s\n",
(unsigned long long)session->global->session_wire_id,
nt_errstr(status)));
nt_errstr(status));
}
status = smbXsrv_session_logoff(session);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("smbXsrv_session_close_loop: "
DBG_ERR("smbXsrv_session_close_loop: "
"smbXsrv_session_logoff(%llu) failed: %s\n",
(unsigned long long)session->global->session_wire_id,
nt_errstr(status)));
nt_errstr(status));
}
TALLOC_FREE(session);
@ -843,10 +843,10 @@ static void smbXsrv_session_global_verify_record(struct db_record *db_rec,
(ndr_pull_flags_fn_t)ndr_pull_smbXsrv_session_globalB);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
DEBUG(1,("smbXsrv_session_global_verify_record: "
DBG_WARNING("smbXsrv_session_global_verify_record: "
"key '%s' ndr_pull_struct_blob - %s\n",
tdb_data_dbg(key),
nt_errstr(status)));
nt_errstr(status));
TALLOC_FREE(frame);
*is_free = true;
if (was_free) {
@ -855,16 +855,16 @@ static void smbXsrv_session_global_verify_record(struct db_record *db_rec,
return;
}
DEBUG(10,("smbXsrv_session_global_verify_record\n"));
if (DEBUGLVL(10)) {
DBG_DEBUG("smbXsrv_session_global_verify_record\n");
if (DEBUGLVL(DBGLVL_DEBUG)) {
NDR_PRINT_DEBUG(smbXsrv_session_globalB, &global_blob);
}
if (global_blob.version != SMBXSRV_VERSION_0) {
DEBUG(0,("smbXsrv_session_global_verify_record: "
DBG_ERR("smbXsrv_session_global_verify_record: "
"key '%s' use unsupported version %u\n",
tdb_data_dbg(key),
global_blob.version));
global_blob.version);
NDR_PRINT_DEBUG(smbXsrv_session_globalB, &global_blob);
TALLOC_FREE(frame);
*is_free = true;
@ -896,12 +896,12 @@ static void smbXsrv_session_global_verify_record(struct db_record *db_rec,
exists = serverid_exists(&global->channels[0].server_id);
if (!exists) {
struct server_id_buf idbuf;
DEBUG(2,("smbXsrv_session_global_verify_record: "
DBG_NOTICE("smbXsrv_session_global_verify_record: "
"key '%s' server_id %s does not exist.\n",
tdb_data_dbg(key),
server_id_str_buf(global->channels[0].server_id,
&idbuf)));
if (DEBUGLVL(2)) {
&idbuf));
if (DEBUGLVL(DBGLVL_NOTICE)) {
NDR_PRINT_DEBUG(smbXsrv_session_globalB, &global_blob);
}
TALLOC_FREE(frame);
@ -953,9 +953,9 @@ static NTSTATUS smbXsrv_session_global_store(struct smbXsrv_session_global0 *glo
(ndr_push_flags_fn_t)ndr_push_smbXsrv_session_globalB);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
DEBUG(1,("smbXsrv_session_global_store: key '%s' ndr_push - %s\n",
DBG_WARNING("smbXsrv_session_global_store: key '%s' ndr_push - %s\n",
tdb_data_dbg(key),
nt_errstr(status)));
nt_errstr(status));
TALLOC_FREE(global->db_rec);
return status;
}
@ -963,16 +963,16 @@ static NTSTATUS smbXsrv_session_global_store(struct smbXsrv_session_global0 *glo
val = make_tdb_data(blob.data, blob.length);
status = dbwrap_record_store(global->db_rec, val, TDB_REPLACE);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1,("smbXsrv_session_global_store: key '%s' store - %s\n",
DBG_WARNING("smbXsrv_session_global_store: key '%s' store - %s\n",
tdb_data_dbg(key),
nt_errstr(status)));
nt_errstr(status));
TALLOC_FREE(global->db_rec);
return status;
}
if (DEBUGLVL(10)) {
DEBUG(10,("smbXsrv_session_global_store: key '%s' stored\n",
tdb_data_dbg(key)));
if (DEBUGLVL(DBGLVL_DEBUG)) {
DBG_DEBUG("smbXsrv_session_global_store: key '%s' stored\n",
tdb_data_dbg(key));
NDR_PRINT_DEBUG(smbXsrv_session_globalB, &global_blob);
}
@ -1164,11 +1164,11 @@ static void smb2srv_session_close_previous_check(struct tevent_req *req)
(ndr_push_flags_fn_t)ndr_push_smbXsrv_session_closeB);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
DEBUG(1,("smb2srv_session_close_previous_check: "
DBG_WARNING("smb2srv_session_close_previous_check: "
"old_session[%llu] new_session[%llu] ndr_push - %s\n",
(unsigned long long)close_info0.old_session_wire_id,
(unsigned long long)close_info0.new_session_wire_id,
nt_errstr(status)));
nt_errstr(status));
tevent_req_nterror(req, status);
return;
}
@ -1272,9 +1272,9 @@ static int smbXsrv_session_destructor(struct smbXsrv_session *session)
status = smbXsrv_session_clear_and_logoff(session);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("smbXsrv_session_destructor: "
DBG_ERR("smbXsrv_session_destructor: "
"smbXsrv_session_logoff() failed: %s\n",
nt_errstr(status)));
nt_errstr(status));
}
TALLOC_FREE(session->global);
@ -1386,22 +1386,22 @@ NTSTATUS smbXsrv_session_create(struct smbXsrv_connection *conn,
status = smbXsrv_session_global_store(global);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("smbXsrv_session_create: "
DBG_ERR("smbXsrv_session_create: "
"global_id (0x%08x) store failed - %s\n",
session->global->session_global_id,
nt_errstr(status)));
nt_errstr(status));
TALLOC_FREE(session);
return status;
}
if (DEBUGLVL(10)) {
if (DEBUGLVL(DBGLVL_DEBUG)) {
struct smbXsrv_sessionB session_blob = {
.version = SMBXSRV_VERSION_0,
.info.info0 = session,
};
DEBUG(10,("smbXsrv_session_create: global_id (0x%08x) stored\n",
session->global->session_global_id));
DBG_DEBUG("smbXsrv_session_create: global_id (0x%08x) stored\n",
session->global->session_global_id);
NDR_PRINT_DEBUG(smbXsrv_sessionB, &session_blob);
}
@ -1468,16 +1468,16 @@ NTSTATUS smbXsrv_session_update(struct smbXsrv_session *session)
NTSTATUS status;
if (session->global->db_rec != NULL) {
DEBUG(0, ("smbXsrv_session_update(0x%08x): "
DBG_ERR("smbXsrv_session_update(0x%08x): "
"Called with db_rec != NULL'\n",
session->global->session_global_id));
session->global->session_global_id);
return NT_STATUS_INTERNAL_ERROR;
}
if (table == NULL) {
DEBUG(0, ("smbXsrv_session_update(0x%08x): "
DBG_ERR("smbXsrv_session_update(0x%08x): "
"Called with table == NULL'\n",
session->global->session_global_id));
session->global->session_global_id);
return NT_STATUS_INTERNAL_ERROR;
}
@ -1491,21 +1491,21 @@ NTSTATUS smbXsrv_session_update(struct smbXsrv_session *session)
status = smbXsrv_session_global_store(session->global);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("smbXsrv_session_update: "
DBG_ERR("smbXsrv_session_update: "
"global_id (0x%08x) store failed - %s\n",
session->global->session_global_id,
nt_errstr(status)));
nt_errstr(status));
return status;
}
if (DEBUGLVL(10)) {
if (DEBUGLVL(DBGLVL_DEBUG)) {
struct smbXsrv_sessionB session_blob = {
.version = SMBXSRV_VERSION_0,
.info.info0 = session,
};
DEBUG(10,("smbXsrv_session_update: global_id (0x%08x) stored\n",
session->global->session_global_id));
DBG_DEBUG("smbXsrv_session_update: global_id (0x%08x) stored\n",
session->global->session_global_id);
NDR_PRINT_DEBUG(smbXsrv_sessionB, &session_blob);
}
@ -1867,10 +1867,10 @@ NTSTATUS smbXsrv_session_logoff(struct smbXsrv_session *session)
*/
status = smb2srv_tcon_disconnect_all(session);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("smbXsrv_session_logoff(0x%08x): "
DBG_ERR("smbXsrv_session_logoff(0x%08x): "
"smb2srv_tcon_disconnect_all() failed: %s\n",
session->global->session_global_id,
nt_errstr(status)));
nt_errstr(status));
error = status;
}
}
@ -1894,11 +1894,11 @@ NTSTATUS smbXsrv_session_logoff(struct smbXsrv_session *session)
if (!NT_STATUS_IS_OK(status)) {
TDB_DATA key = dbwrap_record_get_key(global_rec);
DEBUG(0, ("smbXsrv_session_logoff(0x%08x): "
DBG_ERR("smbXsrv_session_logoff(0x%08x): "
"failed to delete global key '%s': %s\n",
session->global->session_global_id,
tdb_data_dbg(key),
nt_errstr(status)));
nt_errstr(status));
error = status;
}
}
@ -1920,11 +1920,11 @@ NTSTATUS smbXsrv_session_logoff(struct smbXsrv_session *session)
if (!NT_STATUS_IS_OK(status)) {
TDB_DATA key = dbwrap_record_get_key(local_rec);
DEBUG(0, ("smbXsrv_session_logoff(0x%08x): "
DBG_ERR("smbXsrv_session_logoff(0x%08x): "
"failed to delete local key '%s': %s\n",
session->global->session_global_id,
tdb_data_dbg(key),
nt_errstr(status)));
nt_errstr(status));
error = status;
}
table->local.num_sessions -= 1;
@ -1953,8 +1953,8 @@ NTSTATUS smbXsrv_session_logoff_all(struct smbXsrv_client *client)
int count = 0;
if (table == NULL) {
DEBUG(10, ("smbXsrv_session_logoff_all: "
"empty session_table, nothing to do.\n"));
DBG_DEBUG("smbXsrv_session_logoff_all: "
"empty session_table, nothing to do.\n");
return NT_STATUS_OK;
}
@ -1964,17 +1964,17 @@ NTSTATUS smbXsrv_session_logoff_all(struct smbXsrv_client *client)
smbXsrv_session_logoff_all_callback,
&state, &count);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("smbXsrv_session_logoff_all: "
DBG_ERR("smbXsrv_session_logoff_all: "
"dbwrap_traverse() failed: %s\n",
nt_errstr(status)));
nt_errstr(status));
return status;
}
if (!NT_STATUS_IS_OK(state.first_status)) {
DEBUG(0, ("smbXsrv_session_logoff_all: "
DBG_ERR("smbXsrv_session_logoff_all: "
"count[%d] errors[%d] first[%s]\n",
count, state.errors,
nt_errstr(state.first_status)));
nt_errstr(state.first_status));
return state.first_status;
}
@ -2466,25 +2466,25 @@ static int smbXsrv_session_global_traverse_fn(struct db_record *rec, void *data)
ndr_err = ndr_pull_struct_blob(&blob, frame, &global_blob,
(ndr_pull_flags_fn_t)ndr_pull_smbXsrv_session_globalB);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
DEBUG(1,("Invalid record in smbXsrv_session_global.tdb:"
DBG_WARNING("Invalid record in smbXsrv_session_global.tdb:"
"key '%s' ndr_pull_struct_blob - %s\n",
tdb_data_dbg(key),
ndr_errstr(ndr_err)));
ndr_errstr(ndr_err));
goto done;
}
if (global_blob.version != SMBXSRV_VERSION_0) {
DEBUG(1,("Invalid record in smbXsrv_session_global.tdb:"
DBG_WARNING("Invalid record in smbXsrv_session_global.tdb:"
"key '%s' unsupported version - %d\n",
tdb_data_dbg(key),
(int)global_blob.version));
(int)global_blob.version);
goto done;
}
if (global_blob.info.info0 == NULL) {
DEBUG(1,("Invalid record in smbXsrv_tcon_global.tdb:"
DBG_WARNING("Invalid record in smbXsrv_tcon_global.tdb:"
"key '%s' info0 NULL pointer\n",
tdb_data_dbg(key)));
tdb_data_dbg(key));
goto done;
}
@ -2511,8 +2511,8 @@ NTSTATUS smbXsrv_session_global_traverse(
status = smbXsrv_session_global_init(NULL);
if (!NT_STATUS_IS_OK(status)) {
unbecome_root();
DEBUG(0, ("Failed to initialize session_global: %s\n",
nt_errstr(status)));
DBG_ERR("Failed to initialize session_global: %s\n",
nt_errstr(status));
return status;
}