Bug 1894 - nmbd_serverlistdb - An unsigned time_t type should never be equal to -1
Summary: nmbd_serverlistdb - An unsigned time_t type should never be equal to -1
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.0.7
Hardware: Alpha OpenVMS
: P3 normal
Target Milestone: none
Assignee: Tim Potter
QA Contact: Samba QA Contact
URL:
Keywords:
: 1895 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-08 18:28 UTC by John Malmberg
Modified: 2005-08-24 10:24 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Malmberg 2004-10-08 18:28:19 UTC
In the module nmbd_serverlistdb,

In the routines expire_servers(),

A comparison is being made with a time_t type to see if it is -1.

On a platform where time_t is unsigned, it can never have a negative value.

Some C compilers have an extension where they will promote the -1 to be an
unsigned type with all bits set to make this work, but I would recommend putting
a cast of (time_t) on these comparisons just to make sure that these conversions
work, as from a logical point of view, any comparison of an unsigned value with
a negative number should always be false.

See bug 1888
Comment 1 John Malmberg 2004-10-08 19:52:46 UTC
*** Bug 1895 has been marked as a duplicate of this bug. ***
Comment 2 John Malmberg 2004-10-08 20:01:49 UTC
Additional affected modules:

NMBD_WORKGROUPDB.C/expire_workgroups_and_servers()

TRANS2.C/interpret_long_unix_date()
Comment 3 Tim Potter 2005-08-02 13:43:13 UTC
Also fixed.
Comment 4 Gerald (Jerry) Carter (dead mail address) 2005-08-24 10:24:45 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.