[PATCH] Log client process name in winbindd

Andreas Schneider asn at samba.org
Fri Nov 9 06:45:28 UTC 2018


On Friday, 9 November 2018 01:01:05 CET Jeremy Allison wrote:
> On Fri, Nov 09, 2018 at 12:56:27PM +1300, Andrew Bartlett wrote:
> > On Thu, 2018-11-08 at 15:52 -0800, Jeremy Allison via samba-technical
> > 
> > wrote:
> > > On Thu, Nov 08, 2018 at 08:03:30PM +0100, Andreas Schneider wrote:
> > > > > EWRONGPATCH :-).
> > > > 
> > > > Ups, sorry.
> > > 
> > > Can you add error return checks for all uses of
> > > snprintf to check for truncated output please ?
> > > 
> > > RETURN VALUE
> > > 
> > >        Upon successful return, these functions return the number of
> > >        characters printed (excluding the null byte used to end output
> > >        to strings).
> > >        
> > >        The  functions  snprintf()  and  vsnprintf() do not write more
> > >        than size bytes (including the terminating null byte ('\0')). 
> > >        If the output was truncated due to this limit, then the return
> > >        value is the number of characters (excluding the terminating
> > >        null byte) which would have been written to the final string if
> > >        enough space  had  been  availā€ able.  Thus, a return value of
> > >        size or more means that the output was truncated.  (See also
> > >        below under NOTES.)
> > >        
> > >        If an output error is encountered, a negative value is returned.
> > > 
> > > Now maybe the correct thing to do is
> > > ignore the truncation, but we need to
> > > at least acknowledge it in the source
> > > (even if it's with some kind of an
> > > 'ignore' comment).
> > 
> > G'Day Jeremy,
> > 
> > I think you have answered yourself here.  What could possibly,
> > practically be done other than to ignore it?  We don't want a long
> > process name to change the behaviour here).
> 
> Yeah, OK. But I get nervous when I see
> 
> 	snprintf(buf, len, XXXX...)
> 
> calls with no checks. Maybe just make them
> into:
> 
> 	(void)snprintf(buf, len, XXXX...)
> 
> so it's explicit we're ignoring the return ?

I will add checks.

-- 
Andreas Schneider                      asn at samba.org
Samba Team                             www.samba.org
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D





More information about the samba-technical mailing list