Branch: Tag:

2001-10-08

2001-10-08 04:32:48 by Per Hedbor <ph@opera.com>

Grubba, Calendar.Second->year() is the year _object_, not the number of the year, use ->year_no() to get the number. Fixes [Bug 2369 (#2369)] (it was impossible to create SSL certificates in Roxen 2.2) While I were at it I fixed Tools.X509.time_compare (it always return 0 before, not that it seems to be used)

Rev: lib/modules/Tools.pmod/X509.pmod:1.15

1:   #pike __REAL_VERSION__      /* -  * $Id: X509.pmod,v 1.14 2001/08/23 16:18:25 grubba Exp $ +  * $Id: X509.pmod,v 1.15 2001/10/08 04:32:48 per Exp $    *    * Some random functions for creating RFC-2459 style X.509 certificates.    *
21:      object make_time(int t)   { -  object(Calendar.Second) second = Calendar.Second(t)->set_timezone("UTC"); +  Calendar.Second second = Calendar.Second(t)->set_timezone("UTC");    -  if (second->year() >= 2050) { -  throw( ({ "Tools.X509.make_time: " -  "Times later than 2049 not supported yet\n", -  backtrace() }) ); -  } +  if (second->year_no() >= 2050) { +  error( "Tools.X509.make_time: " +  "Times later than 2049 not supported yet\n" );       return asn1_utc(sprintf("%02d%02d%02d%02d%02d%02dZ", -  second->year() % 100, +  second->year_no() % 100,    second->month_no(),    second->month_day(),    second->hour_no(),
80:   int time_compare(mapping t1, mapping t2)   {    foreach( ({ "year", "mon", "mday", "hour", "min", "sec" }), string name) -  { -  if (t1->name < t2->name) +  if (t1[name] < t2[name])    return -1; -  if (t1->name > t2->name) +  else if (t1[name] > t2[name])    return 1; -  } +     return 0;   }