as far as I am aware there shouldn't be security issues, the replacement code for timegm will not be thread safe, however
> Yup. Caught that. > Are there any security issues with changing environment variables? > > > On Mon, Feb 11, 2013 at 6:01 AM, Egger Clemens > > <[email protected]> wrote: regarding other places: when I > > developed that patch I found another similar use of mktime in the > > module ow_1923.c, however I didn't touch the code since I had no > > corresponding iButton for testing. > > > > Clemens > > > > > From: Paul Alfille [mailto:[email protected]] Sent: Sunday, > > > 10 February, 2013 1:15 AM To: OWFS (One-wire file system) > > > discussion and help Subject: Re: [Owfs-developers] Patch - DS1921 > > > Thermochron iButton - reading udate values depends on local time > > > zone > > > > > > Thank you. The patch had been overlooked, but now is applied. I'm > > > going to see if there are other places with the same error. Paul > > > > > > On Fri, Feb 8, 2013 at 6:42 AM, Egger Clemens > > > <[email protected]> wrote: Hi Paul, > > > > > > any feedback for me regarding this patch? > > > > > > Best regards, Clemens Egger > > > > > > > > > > -----Original Message----- From: Egger Clemens Sent: Wednesday, > > > > 23 January, 2013 1:16 PM To: OWFS Developer's list Subject: > > > > Patch - DS1921 Thermochron iButton - reading udate values > > > > depends on local time zone > > > > > > > > Hi, > > > > > > > > working with the DS1921 Thermochron iButton I noticed that, when > > > > writing a time value to clock/udate and reading it immediately > > > > afterwards, the returned value differs notably to the written > > > > value. This is dependent on the local time zone and whether it's > > > > daylight saving time or not. My environment variable TZ usually > > > > reads "Europe/Berlin". In the following example there's a > > > > difference of 3600 seconds i.e. 1 hour between the two values. > > > > > > > > $ ./owwrite -s 3000 21.D5542E000000/clock/udate 1352387000; > > > > ./owread -s 3000 21.D5542E000000/clock/udate 1352383400 > > > > > > > > Looking at the source code, I discovered that the function > > > > mktime is used to convert a struct tm to time_t. However mktime > > > > uses the local time zone which explains the time shift. > > > > > > > > The following workaround makes the time shift disappear: just > > > > set the TZ environment variable to UTC when invoking the server. > > > > TZ=UTC ./owserver -u -p 3000 > > > > > > > > There's a function timegm which is basically the opposite part > > > > to gmtime. The latter is already used in the code when writing a > > > > udate value to the iButton. In my opinion timegm would be more > > > > suitable than mktime. I developed a patch to fix this issue, see > > > > attachment. > > > > > > > > BTW: I already submitted this patch last year Nov 8 to this > > > > list, but I never got any feedback - just in case this sounds > > > > familiar. > > > > > > > > Best regards Clemens Egger > > > ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ Owfs-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/owfs-developers
