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

Richard Sharpe rsharpe at samba.org
Fri May 17 01:26:55 MDT 2013


On Fri, May 17, 2013 at 12:18 AM, Stefan (metze) Metzmacher
<metze at samba.org> wrote:
> 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.

Sounds good to me.


More information about the samba-technical mailing list