From: Volker Lendecke Date: Sun, 22 Mar 2026 14:49:52 +0000 (+0100) Subject: smbd: Modernize some DEBUGs X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=a4e9dcd0f82001c1756cdfddbf3e215d335be3e5;p=thirdparty%2Fsamba.git smbd: Modernize some DEBUGs Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/source3/smbd/smb1_service.c b/source3/smbd/smb1_service.c index fc4fa11b75a..94cc3a042c1 100644 --- a/source3/smbd/smb1_service.c +++ b/source3/smbd/smb1_service.c @@ -78,8 +78,9 @@ static connection_struct *make_connection_smb1(struct smb_request *req, share_name, now, &tcon); if (!NT_STATUS_IS_OK(status)) { - DEBUG(0,("make_connection_smb1: Couldn't find free tcon for [%s] - %s\n", - share_name, nt_errstr(status))); + DBG_ERR("Couldn't find free tcon for [%s] - %s\n", + share_name, + nt_errstr(status)); TALLOC_FREE(share_name); *pstatus = status; return NULL; @@ -90,7 +91,7 @@ static connection_struct *make_connection_smb1(struct smb_request *req, if (!conn) { TALLOC_FREE(tcon); - DEBUG(0,("make_connection_smb1: Couldn't find free connection.\n")); + DBG_ERR("Couldn't find free connection.\n"); *pstatus = NT_STATUS_INSUFFICIENT_RESOURCES; return NULL; } @@ -143,8 +144,8 @@ connection_struct *make_connection(struct smb_request *req, /* This must ONLY BE CALLED AS ROOT. As it exits this function as * root. */ if (!non_root_mode() && (euid = geteuid()) != 0) { - DEBUG(0,("make_connection: PANIC ERROR. Called as nonroot " - "(%u)\n", (unsigned int)euid )); + DBG_ERR("PANIC ERROR. Called as nonroot (%u)\n", + (unsigned int)euid); smb_panic("make_connection: PANIC ERROR. Called as nonroot\n"); } @@ -154,8 +155,7 @@ connection_struct *make_connection(struct smb_request *req, } if (session == NULL) { - DEBUG(1,("make_connection: refusing to connect with " - "no session setup\n")); + DBG_WARNING("refusing to connect with no session setup\n"); *status = NT_STATUS_ACCESS_DENIED; return NULL; } @@ -168,23 +168,24 @@ connection_struct *make_connection(struct smb_request *req, if (strequal(service_in,HOMES_NAME)) { if (session->homes_snum == -1) { - DEBUG(2, ("[homes] share not available for " - "this user because it was not found " - "or created at session setup " - "time\n")); + DBG_NOTICE("[homes] share not available for " + "this user because it was not found " + "or created at session setup " + "time\n"); *status = NT_STATUS_BAD_NETWORK_NAME; return NULL; } - DEBUG(5, ("making a connection to [homes] service " - "created at session setup time\n")); + DBG_INFO("making a connection to [homes] service " + "created at session setup time\n"); return make_connection_smb1(req, now, session->homes_snum, dev, status); } else if ((session->homes_snum != -1) && strequal(service_in, lp_const_servicename(session->homes_snum))) { - DEBUG(5, ("making a connection to 'homes' service [%s] " - "created at session setup time\n", service_in)); + DBG_INFO("making a connection to 'homes' service [%s] " + "created at session setup time\n", + service_in); return make_connection_smb1(req, now, session->homes_snum, dev, status); @@ -197,7 +198,7 @@ connection_struct *make_connection(struct smb_request *req, } if (!strlower_m(service)) { - DEBUG(2, ("strlower_m %s failed\n", service)); + DBG_NOTICE("strlower_m %s failed\n", service); *status = NT_STATUS_INVALID_PARAMETER; return NULL; } @@ -211,30 +212,31 @@ connection_struct *make_connection(struct smb_request *req, if (snum < 0) { if (strequal(service,"IPC$") || (lp_enable_asu_support() && strequal(service,"ADMIN$"))) { - DEBUG(3,("refusing IPC connection to %s\n", service)); + DBG_NOTICE("refusing IPC connection to %s\n", service); *status = NT_STATUS_ACCESS_DENIED; return NULL; } - DEBUG(3,("%s (%s) couldn't find service %s\n", - get_remote_machine_name(), - tsocket_address_string( - sconn->remote_address, talloc_tos()), - service)); + DBG_NOTICE("%s (%s) couldn't find service %s\n", + get_remote_machine_name(), + tsocket_address_string(sconn->remote_address, + talloc_tos()), + service); *status = NT_STATUS_BAD_NETWORK_NAME; return NULL; } /* Handle non-Dfs clients attempting connections to msdfs proxy */ if (lp_host_msdfs() && (*lp_msdfs_proxy(talloc_tos(), lp_sub, snum) != '\0')) { - DEBUG(3, ("refusing connection to dfs proxy share '%s' " - "(pointing to %s)\n", - service, lp_msdfs_proxy(talloc_tos(), lp_sub, snum))); + DBG_NOTICE("refusing connection to dfs proxy share '%s' " + "(pointing to %s)\n", + service, + lp_msdfs_proxy(talloc_tos(), lp_sub, snum)); *status = NT_STATUS_BAD_NETWORK_NAME; return NULL; } - DEBUG(5, ("making a connection to 'normal' service %s\n", service)); + DBG_INFO("making a connection to 'normal' service %s\n", service); return make_connection_smb1(req, now, snum, dev, status); diff --git a/source3/smbd/smb1_trans2.c b/source3/smbd/smb1_trans2.c index 81358dfcaae..03ca992ee3a 100644 --- a/source3/smbd/smb1_trans2.c +++ b/source3/smbd/smb1_trans2.c @@ -2059,10 +2059,12 @@ static void call_trans2qfilepathinfo(connection_struct *conn, size_t fixed_portion; NTSTATUS status = NT_STATUS_OK; - DEBUG(3,("call_trans2qfilepathinfo %s (%s) level=%d call=%d " - "total_data=%d\n", smb_fname_str_dbg(smb_fname), - fsp_fnum_dbg(fsp), - info_level,tran_call,total_data)); + DBG_NOTICE("%s (%s) level=%" PRIu16 " call=%d total_data=%d\n", + smb_fname_str_dbg(smb_fname), + fsp_fnum_dbg(fsp), + info_level, + tran_call, + total_data); /* Pull out any data sent here before we realloc. */ switch (info_level) { @@ -2079,8 +2081,11 @@ static void call_trans2qfilepathinfo(connection_struct *conn, ea_size = IVAL(pdata,0); if (total_data > 0 && ea_size != total_data) { - DEBUG(4,("call_trans2qfilepathinfo: Rejecting EA request with incorrect \ -total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pdata,0) )); + DBG_NOTICE("Rejecting EA request with " + "incorrect total_data=%d " + "(should be %" PRIu32 ")\n", + total_data, + ea_size); reply_nterror( req, NT_STATUS_INVALID_PARAMETER); return; @@ -2294,12 +2299,12 @@ static bool marshall_posix_acl(connection_struct *conn, char *pdata, SMB_STRUCT_ entry_id = SMB_ACL_NEXT_ENTRY; if (sys_acl_get_tag_type(entry, &tagtype) == -1) { - DEBUG(0,("marshall_posix_acl: SMB_VFS_SYS_ACL_GET_TAG_TYPE failed.\n")); + DBG_ERR("SMB_VFS_SYS_ACL_GET_TAG_TYPE failed.\n"); return False; } if (sys_acl_get_permset(entry, &permset) == -1) { - DEBUG(0,("marshall_posix_acl: SMB_VFS_SYS_ACL_GET_PERMSET failed.\n")); + DBG_ERR("SMB_VFS_SYS_ACL_GET_PERMSET failed.\n"); return False; } @@ -2320,7 +2325,8 @@ static bool marshall_posix_acl(connection_struct *conn, char *pdata, SMB_STRUCT_ { uid_t *puid = (uid_t *)sys_acl_get_qualifier(entry); if (!puid) { - DEBUG(0,("marshall_posix_acl: SMB_VFS_SYS_ACL_GET_QUALIFIER failed.\n")); + DBG_ERR("SMB_VFS_SYS_ACL_GET_" + "QUALIFIER failed.\n"); return False; } own_grp = (unsigned int)*puid; @@ -2339,7 +2345,8 @@ static bool marshall_posix_acl(connection_struct *conn, char *pdata, SMB_STRUCT_ { gid_t *pgid= (gid_t *)sys_acl_get_qualifier(entry); if (!pgid) { - DEBUG(0,("marshall_posix_acl: SMB_VFS_SYS_ACL_GET_QUALIFIER failed.\n")); + DBG_ERR("SMB_VFS_SYS_ACL_GET_" + "QUALIFIER failed.\n"); return False; } own_grp = (unsigned int)*pgid; @@ -2359,7 +2366,7 @@ static bool marshall_posix_acl(connection_struct *conn, char *pdata, SMB_STRUCT_ SIVAL(pdata,6,0xFFFFFFFF); break; default: - DEBUG(0,("marshall_posix_acl: unknown tagtype.\n")); + DBG_ERR("unknown tagtype.\n"); return False; } pdata += SMB_POSIX_ACL_ENTRY_SIZE;