FIX to RE: Cannot get net ads join to work under Solaris 8

2002-11-17 Thread Clive . Elsum
Andrew,

Another suggestion which appears to work without a kludge is a very minor
mod to the code originally contributed by Roger Beeman [EMAIL PROTECTED],
with the help of Mark Baushke [EMAIL PROTECTED] and the rest of the Gurus at
CISCO. Further improved by Roger with assistance from Edward J. Sabol based
on input by Jamie Zawinski. 
Setting this as a timegm replacement within lib/replace.c overcomes the need
to reset TIMEZONE.


 time_t timegm(struct tm *t)
{
  time_t tl, tb;
  struct tm *tg;

  tl = mktime (t);
  if (tl == -1)
{
  t-tm_hour--;
  tl = mktime (t);
  if (tl == -1)
return -1; /* can't deal with output from strptime */
  tl += 3600;
}
  tg = gmtime (tl);
  tg-tm_isdst = 0;
  tb = mktime (tg);
  if (tb == -1)
{
  tg-tm_hour--;
  tb = mktime (tg);
  if (tb == -1)
return -1; /* can't deal with output from gmtime */
  tb += 3600;
}
  return (tl - (tb - tl));

-
Clive Elsum BAppSc, RHCE
Systems Engineer - Information Technology Group
CSIRO Atmospheric Research
PMB 1, Aspendale, Victoria, Australia  3195
Phone : (+61 3) 9239 4509
Fax:(+61 3) 9239 
E-mail [EMAIL PROTECTED]
-





Re: Cannot get net ads join to work under Solaris 8

2002-11-16 Thread David Collier-Brown -- Customer Engineering
Andrew Bartlett wrote:
 Actually, we got confused - the function that Samba replaced, which I
 suspected could be a problem is 'timegm'.
 
 Either way, there is a but in there somewhere, as it doesn't work for a
 non-GMT timezone.

Ok, timegm is obsoleted in the standard, but it's
still supported on lots of systems, specifically
including anything with the Gnu libc, but
not in Solaris or the Apple BSD.

It's the inverse of gmtime, defined as
time_t timegm(struct tm *tm);
and is perfectly useful in some specific
cases, where one wants to turn a struct tm
back into a time_t.

The usual inverse is
time_t mktime(struct tm *timeptr);
(see http://www.opengroup.org/onlinepubs/007908799/xsh/mktime.html)
and it looks like there is enough functionality
to implement timegm. Older man pages disagree, but
standards folks don't get to frivolously remove things we 
still need.  If they were to try, my Evil Twin, David 
J. Brown,  would spank them (:-)) 
---
The POSIX man page says:
The original values of the tm_wday and tm_yday components of the
structure are ignored, and the original values of the other components 
are not restricted to the ranges described in the time.h entry. 

A positive or 0 value for tm_isdst causes mktime() to presume
initially 
that Daylight Savings Time, respectively, is or is not in effect for 
the specified time. A negative value for tm_isdst causes mktime() to 
attempt to determine whether Daylight Saving Time is in effect for 
the specified time. 

Local timezone information is set as though mktime() called tzset(). 
---
and the older man pages say:
The functions mktime() and timegm() convert the broken-down time in
the
structure pointed to by tm into a time value with the same encoding as
that of the values returned by the time(3) function (that is, seconds
from the Epoch, UTC).  mktime() interprets the input structure
according
to the current timezone setting (see tzset(3)).  timegm() interprets
the
input structure as representing Universal Coordinated Time (UTC). 
---
The workaround is to set the time zone, as you did, but
I suspect there's a better one: probably something
like
if ((x = mktime(timeptr) != -1))
x -= altzone;

I'll ask My Smarter Colleagues[tm].

--dave
-- 
David Collier-Brown,   | Always do right. This will gratify 
Sun Microsystems DCMO  | some people and astonish the rest.
Toronto, Ontario   |
(905) 415-2849 or x52849   | [EMAIL PROTECTED]



RE: Cannot get net ads join to work under Solaris 8

2002-11-16 Thread Clive . Elsum
Following on from this in the replacement for timegm within /lib/replace.c
Solaris returns the TIMEZONE (in our case) as Australia/Victoria. This is
done
during installation.
I expect that SAMBA is looking for some variant of GMT or UTC not
Australia/Victoria.
As a very simple workaround I simply changed the putenv call to force TZ=GMT
and all 
works happily.
 

 time_t timegm(struct tm *tm)
{
time_t ret;
char *tz;
char *tzvar;

tz = getenv(TZ);

  /*putenv(TZ=);
putenv(TZ=GMT);
tzset();
ret = mktime(tm);


Clive Elsum

-
Clive Elsum BAppSc, RHCE
Systems Engineer - Information Technology Group
CSIRO Atmospheric Research
PMB 1, Aspendale, Victoria, Australia  3195
Phone : (+61 3) 9239 4509
Fax:(+61 3) 9239 
E-mail [EMAIL PROTECTED]
-


-Original Message-
From: Andrew Bartlett [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 16 November 2002 7:18 AM
To: David Collier-Brown -- Customer Engineering
Cc: Andrew Bartlett; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: Cannot get net ads join to work under Solaris 8


On Sat, 2002-11-16 at 06:09, David Collier-Brown -- Customer Engineering
wrote:
 Andrew Bartlett wrote:
  Well, it just means that we need to find a real replacement for
  gmtime().  Any chance you could have a look at that function, and see if
  you can figure out why the current replacement doesn't work?
 
   Huh?  My Solaris box has gmtime and gmtime_r, the 
   reentrant variant. 
 
   In principle, gmtime creates a struct tm, in
   Coordinated Universal Time (UTC), just as if
   you called localtime when machine was set to 
   GMT. 

Actually, we got confused - the function that Samba replaced, which I
suspected could be a problem is 'timegm'.  

Either way, there is a but in there somewhere, as it doesn't work for a
non-GMT timezone.

Andrew Bartlett

-- 
Andrew Bartlett [EMAIL PROTECTED]
Manager, Authentication Subsystems, Samba Team  [EMAIL PROTECTED]
Student Network Administrator, Hawker College   [EMAIL PROTECTED]
http://samba.org http://build.samba.org http://hawkerc.net



Re: Cannot get net ads join to work under Solaris 8

2002-11-15 Thread David Collier-Brown -- Customer Engineering
Andrew Bartlett wrote:
 Well, it just means that we need to find a real replacement for
 gmtime().  Any chance you could have a look at that function, and see if
 you can figure out why the current replacement doesn't work?

Huh?  My Solaris box has gmtime and gmtime_r, the 
reentrant variant. 

In principle, gmtime creates a struct tm, in
Coordinated Universal Time (UTC), just as if
you called localtime when machine was set to 
GMT. 

--dave
-- 
David Collier-Brown,   | Always do right. This will gratify 
Sun Microsystems DCMO  | some people and astonish the rest.
Toronto, Ontario   |
(905) 415-2849 or x52849   | [EMAIL PROTECTED]



Re: Cannot get net ads join to work under Solaris 8

2002-11-15 Thread Andrew Bartlett
On Sat, 2002-11-16 at 06:09, David Collier-Brown -- Customer Engineering
wrote:
 Andrew Bartlett wrote:
  Well, it just means that we need to find a real replacement for
  gmtime().  Any chance you could have a look at that function, and see if
  you can figure out why the current replacement doesn't work?
 
   Huh?  My Solaris box has gmtime and gmtime_r, the 
   reentrant variant. 
 
   In principle, gmtime creates a struct tm, in
   Coordinated Universal Time (UTC), just as if
   you called localtime when machine was set to 
   GMT. 

Actually, we got confused - the function that Samba replaced, which I
suspected could be a problem is 'timegm'.  

Either way, there is a but in there somewhere, as it doesn't work for a
non-GMT timezone.

Andrew Bartlett

-- 
Andrew Bartlett [EMAIL PROTECTED]
Manager, Authentication Subsystems, Samba Team  [EMAIL PROTECTED]
Student Network Administrator, Hawker College   [EMAIL PROTECTED]
http://samba.org http://build.samba.org http://hawkerc.net



signature.asc
Description: This is a digitally signed message part


Re: Cannot get net ads join to work under Solaris 8

2002-11-14 Thread Andrew Bartlett
On Thu, 2002-11-14 at 21:30, [EMAIL PROTECTED] wrote:
 HI,
 
 Any clues would be appreciated in getting net ads join working on Solaris 8.
 I have downloaded the latest CVS samba 3.0. on to a solaris 8 box as is.
 I have followed the same procedures as the LINUX CVS port that I have got
 going.
 The only mod needed was that the  --without-sendfile flag did not appear to
 work so I put in with-sendfile=no in configure rather that the default yes
 for the Solaris port. This was not necessary for the Linux port.
 
 Clocks on the machines are synchronized.
 kdestroy works correctly
 kinit works correctly
 klist works correctly
 net ads join fails for the Solaris port but works for the Linux port, errors
 reported below.
 
 root#l ./net ads join -Uadminuser
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from UCS-2LE to CP850 not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from UTF8 to CP850 not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from ASCII to CP850 not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from CP850 to UCS-2LE not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from CP850 to UTF8 not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from CP850 to ASCII not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from CP850 to UTF8 not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from UTF8 to CP850 not supported
 adminuser password: 
 [2002/11/14 21:01:11, 1] libsmb/clikrb5.c:krb5_mk_req2(63)
   krb5_get_credentials failed for w2kads$@OUR.DOMAIN.AU (Clock skew too
 great in KDC reply)

Can you try putting the Solaris machine in the GMT timezone?

My thinking is that the gmtime() replacement might not be functioning
correctly.

Andrew Bartlett

-- 
Andrew Bartlett [EMAIL PROTECTED]
Manager, Authentication Subsystems, Samba Team  [EMAIL PROTECTED]
Student Network Administrator, Hawker College   [EMAIL PROTECTED]
http://samba.org http://build.samba.org http://hawkerc.net



signature.asc
Description: This is a digitally signed message part


RE: Cannot get net ads join to work under Solaris 8

2002-11-14 Thread Clive . Elsum
Many thanks Andrew!! 

Setting the Solaris box to GMT certainly did the trick.
Well done, I appreciate the prompt response to my query.

Clive Elsum

-Original Message-
From: Andrew Bartlett [mailto:abartlet;samba.org]
Sent: Thursday, 14 November 2002 10:19 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Cannot get net ads join to work under Solaris 8


On Thu, 2002-11-14 at 21:30, [EMAIL PROTECTED] wrote:
 HI,
 
 Any clues would be appreciated in getting net ads join working on Solaris
8.
 I have downloaded the latest CVS samba 3.0. on to a solaris 8 box as is.
 I have followed the same procedures as the LINUX CVS port that I have got
 going.
 The only mod needed was that the  --without-sendfile flag did not appear
to
 work so I put in with-sendfile=no in configure rather that the default yes
 for the Solaris port. This was not necessary for the Linux port.
 
 Clocks on the machines are synchronized.
 kdestroy works correctly
 kinit works correctly
 klist works correctly
 net ads join fails for the Solaris port but works for the Linux port,
errors
 reported below.
 
 root#l ./net ads join -Uadminuser
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from UCS-2LE to CP850 not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from UTF8 to CP850 not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from ASCII to CP850 not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from CP850 to UCS-2LE not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from CP850 to UTF8 not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from CP850 to ASCII not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from CP850 to UTF8 not supported
 [2002/11/14 21:01:07, 0] lib/charcnv.c:init_iconv(93)
   Conversion from UTF8 to CP850 not supported
 adminuser password: 
 [2002/11/14 21:01:11, 1] libsmb/clikrb5.c:krb5_mk_req2(63)
   krb5_get_credentials failed for w2kads$@OUR.DOMAIN.AU (Clock skew too
 great in KDC reply)

Can you try putting the Solaris machine in the GMT timezone?

My thinking is that the gmtime() replacement might not be functioning
correctly.

Andrew Bartlett

-- 
Andrew Bartlett [EMAIL PROTECTED]
Manager, Authentication Subsystems, Samba Team  [EMAIL PROTECTED]
Student Network Administrator, Hawker College   [EMAIL PROTECTED]
http://samba.org http://build.samba.org http://hawkerc.net



RE: Cannot get net ads join to work under Solaris 8

2002-11-14 Thread Andrew Bartlett
On Fri, 2002-11-15 at 04:38, [EMAIL PROTECTED] wrote:
 Many thanks Andrew!! 
 
 Setting the Solaris box to GMT certainly did the trick.
 Well done, I appreciate the prompt response to my query.

Well, it just means that we need to find a real replacement for
gmtime().  Any chance you could have a look at that function, and see if
you can figure out why the current replacement doesn't work?

Andrew Bartlett

-- 
Andrew Bartlett [EMAIL PROTECTED]
Manager, Authentication Subsystems, Samba Team  [EMAIL PROTECTED]
Student Network Administrator, Hawker College   [EMAIL PROTECTED]
http://samba.org http://build.samba.org http://hawkerc.net



signature.asc
Description: This is a digitally signed message part