AIX portability problem in samba3 passdb/pdb_ldap.c
davec-b at rogers.com
Mon Aug 14 15:47:04 GMT 2006
Hmmn, there's an strptime in the OpenBSD codebase, which
could be adopted, in lib/libc/time, with the usual BSD license.
Chris Cowan wrote:
> Thanks for the offer. I was trying to stick to using IBM's proprietary
> compiler, and the native OS libraries. In doing some google searches, it
> appears that other opensource packages have run into this. Although
> strptime() is not "technically" broken on AIX, and I found at least one
> PMR opened on this issue to clarify the correct behavior.
> I just wanted to point out this problem, since I'm sure it will probably
> rear on plaforms other than Linux. I wrote something using sscanf and
> sprintf to quickly fix this (but then found out about
> include/safe_string.h ;)
> I should also mention that the actual core file was generated from the
> timegm(&tm) call. The member values in tm were non-sensical after the
> failed strptime() and were subsequently used as an array indices, etc.
> (tm->tm_mon in particular). Perhaps timegm() should do some range checking?
> David Collier-Brown <davec-b at rogers.com> wrote on 08/13/2006 05:19:12 PM:
> > Numerous strptimes require whitespace, so one often parses
> > such date-stamps with sscanf, as we did before strptime was invented.
> > If you can't use the glibc version for some reason, I can
> > happily write you a strptime implemented by rewriting the
> > date string into a sscanf string.
> > --dave (who is doing porting libraries in his Copious Spare Time) c-b
> > Chris Cowan wrote:
> > >
> > > Just ran across this problem with the Samba 3 LDAP passdb code on
> AIX. I
> > > was getting intermittent failures authenticating on AIX 5.2 and total
> > > failure on AIX 5.3.
> > >
> > > The code is checking the modifyTimestamp attribute in ldap and then
> > > the string into struct tm with strptime(). My ldap servers
> return the
> > > timestamp in the format "20060810153445Z." strptime() on AIX wants the
> > > fields in the buffer to be delimited. (e.g. with whitespace like
> "2006 08
> > > 10 15 34 45Z") The glib2 version on Linux doesn't require this. Of
> > > course, there is also a question of whether you should have this
> > > definition, too:
> > --
> > David Collier-Brown, | Always do right. This will gratify
> > System Programmer and Author | some people and astonish the rest
> > davecb at spamcop.net | -- Mark Twain
> > (416) 223-5943
David Collier-Brown, | Always do right. This will gratify
System Programmer and Author | some people and astonish the rest
davecb at spamcop.net | -- Mark Twain
More information about the samba-technical