NTSTATUS trick for NTTIME?

Andrew Bartlett abartlet at samba.org
Thu Mar 10 04:05:12 MST 2011


On Thu, 2011-03-10 at 10:30 +0100, Volker Lendecke wrote:
> On Thu, Mar 10, 2011 at 02:38:11PM +1100, tridge at samba.org wrote:
> > There may be a simpler way to achieve what you want. If we add the
> > -Wconversion warning to the developer flags then we will get a warning
> > on mixing of time_t and NTTIME, where NTTIME is typedef to a uint64_t.
> > 
> > I wrote a little test here:
> > 
> >   http://git.samba.org/?p=tridge/junkcode.git;a=tree;f=nttime;
> > 
> > and I get these warnings from the test:
> > 
> >  nttime_test.c:25: warning: conversion to ‘time_t’ from ‘NTTIME’ may change the sign of the result
> >  nttime_test.c:27: warning: conversion to ‘NTTIME’ from ‘time_t’ may change the sign of the result
> >  nttime_test.c:33: warning: conversion to ‘NTTIME’ from ‘time_t’ may change the sign of the result
> >  nttime_test.c:35: warning: conversion to ‘time_t’ from ‘NTTIME’ may change the sign of the result

> > I also think the structure approach may not win us as much as it does
> > for NTSTATUS. The NTSTATUS type is mostly used as a return value, but
> > NTTIME is often used as a pointer argument. When used as a pointer
> > argument, you only get a warning, not a compile error, which means we
> > aren't actually better off than we are with -Wconversion. For
> 
> Well, except that we get them as additional warnings instead
> of having them hidden between hundreds of other warnings. To
> be useful in development, I don't think relying on waf magic
> in autobuild is good enough. The round-trip time there is
> just too high. Doing some waf magic on top of the structure
> approach is probably very worthwile too.

Can we get back to the fundamental problem you need to solve?  If I
understand it, you need a programmatic tool to ensure you can make this
important conversion of passdb to NTTIME safely.  

It seems to me that with the -Wconversions approach you don't even need
modifications to the build system to start work.  Could you store the
(verbose) output of a clean -Wconversion build, and then use diff to
compare your modified build with that output?  

In the longer term we can continue to ensure the issue does not result
in regressions by the regular expression filter on this warning as part
of autobuild that Tridge suggests, as once your initial change is made
latency should no longer be an issue.

Do you think this approach would allow you to get started without
further distractions?

Andrew Bartlett
-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Cisco Inc.



More information about the samba-technical mailing list