Changing smbd_server_connection_terminate[_ex] to allow logging errors at level 0 for some errors

Stefan (metze) Metzmacher metze at samba.org
Fri May 17 01:18:59 MDT 2013


Hi Richard,

> I would like to suggest the following change:
> 
> diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
> index b031c6d..5e7de84 100644
> --- a/source3/smbd/smb2_server.c
> +++ b/source3/smbd/smb2_server.c
> @@ -994,10 +994,11 @@ static NTSTATUS
> smbd_smb2_request_setup_out(struct smbd_smb2_request *req)
>  }
> 
>  void smbd_server_connection_terminate_ex(struct smbd_server_connection *sconn,
> +					 int dbg_lv,
>  					 const char *reason,
>  					 const char *location)
>  {
> -	DEBUG(10,("smbd_server_connection_terminate_ex: reason[%s] at %s\n",
> +	DEBUG(dbg_lv,("smbd_server_connection_terminate_ex: reason[%s] at %s\n",
>  		  reason, location));
>  	exit_server_cleanly(reason);
>  }
> 
> This allows us to decide on a case-by-case basis what DEBUG level we
> want the message to be at.
> 
> There are about 74 uses of smbd_server_connection_terminate in the
> code that I can see, but I can make the changes. I would default to
> level 10 for most of them and only change the more critical ones to
> level 0 (only one or two.)

What about changing the function but hiding the change behind the
smbd_server_connection_terminate() macro and call
smbd_server_connection_terminate_ex
where we want a different behavior.

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20130517/26be5dc3/attachment.pgp>


More information about the samba-technical mailing list