bug in smbcacls

Christof Schmitt cs at samba.org
Mon Feb 8 22:01:30 UTC 2016


On Mon, Feb 08, 2016 at 05:24:10PM +0100, Andreas Schneider wrote:
> On Friday 05 February 2016 15:10:23 Christof Schmitt wrote:
> > On Thu, Feb 04, 2016 at 10:47:04AM -0700, Christof Schmitt wrote:
> > > On Thu, Feb 04, 2016 at 09:31:37AM -0800, Herb Lewis wrote:
> > > > In source3/lib/util_sd.c function parse_ace there is the following
> > > > line that I think is incorrect
> > > > 
> > > > if (sscanf(p, "%u/%u/%u", &atype, &aflags, &amask) == 3 &&
> > > > 
> > > > in the old samba 3.6 code it used to read
> > > > 
> > > > if (sscanf(p, "%i/%i/%i", &atype, &aflags, &amask) == 3 &&
> > > > 
> > > > and according to the man page for sscanf the %u is only for decimal
> > > > integers while %i also checks for base 16 and base 8 as well. Was there
> > > > a reason this was changed so that hex numbers are no longer allowed?
> > > 
> > > util_sd.c is the result of using common code between smbcacls and
> > > sharesec. There is no reason why we would disallow base 16 and base 8; i
> > > probably just missed that part. Feel free to send a patch, or i can
> > > address this when i have a minute.
> > 
> > I did a bit more research and the format string for the printf was
> > changed in this patch from Andreas:
> > 
> > commit 4c98b9ce8f8de5883796aa38f1193e04a0ee4e58
> > Author: Andreas Schneider <asn at samba.org>
> > Date:   Fri Nov 15 17:02:14 2013 +0100
> > 
> >     s3-utils: Fix scanf format in smbacls.
> > 
> >     Signed-off-by: Andreas Schneider <asn at samba.org>
> >     Reviewed-by: Jeremy Allison <jra at samba.org>
> > 
> > Andreas, can you explain the reason for this? %i seems to be standard
> > POSIX, i don't see why this would be a problem.
> 
> I guess Red Hat internal tools discovered the issues and I fixed them. If you 
> change the format, make sure the variables used have the correct integer type 
> ...

Thanks. The wrong type would explain this change. Using a signed integer
just for %i probably causes more headaches. I started looking into
adding an explicit check for numerical values (%u and %x), some parts
for that are already in the code.

Christof



More information about the samba-technical mailing list