Compiling OpenSCEP.
Hello.
An ITP has been filed against wnpp that I wish to package OpenSCEP (Bug
#118532). This is a server to help you build scaleable VPNs using Ciscos
Certificate Enrollment Protocol.
This question might be better of at a gcc mailing list, but I will try
here first and apologize for the possible inconvenience.
I have compiled a crippled version (I will explain why) and ran parts og
the enrollment process with success. So the whole suite seems to work
fine and configuration seems correct. The program is crippled as I had
to cripple a function ``asn1_time_to_time'' in order to make the program
compile.
I have tried to compile with both gcc3 and gcc2.95. I have tried
different version of OpenSSL and OpenLDAP (upon which the program
relies) with no result.
The real issue here is that I don't program C, but I will try to explain.
Running make yields the error:
sceplist.o: In function `asn1_time_to_time':
/home/lars/src/openscep-0.3.6/scepd/sceplist.c:127: undefined reference to
`altzone'
Now I gather that ``altzone'' should be declared in /usr/include/time.h
from what I can gather from Google. Furthermore ctime(3) states that
altzone should be present if the system is to be Posix compliant.
(Correct me if I am wrong.).
There is no mention of ``altzone'' in either /usr/lib or /usr/include as
far as I can make out. But the "twin variable" ``timezone'' is however
declared (in /usr/include/time.h)
So, why "twin variable"? Well the code in sceplist.c looks like this
(with line 127 marked by me):
----------------------------------------------------------------------
/* convert ASN1 time string to a struct tm */
static time_t asn1_time_to_time(ASN1_TIME *tm) {
struct tm rtm;
char work[3];
time_t rt;
extern time_t timezone, altzone;
/* prepare work and result buffers for the conversions */
memset(work, '\0', sizeof(work));
memset(&rtm, 0, sizeof(struct tm));
/* convert ASN1 time string to struct tm structure elements*/
memcpy(work, tm->data + 10, 2);
rtm.tm_sec = atoi(work);
memcpy(work, tm->data + 8, 2);
rtm.tm_min = atoi(work);
memcpy(work, tm->data + 6, 2);
rtm.tm_hour = atoi(work);
memcpy(work, tm->data + 4, 2);
rtm.tm_mday = atoi(work);
memcpy(work, tm->data + 2, 2);
rtm.tm_mon = atoi(work);
memcpy(work, tm->data, 2);
rtm.tm_year = atoi(work);
if (rtm.tm_year < 70)
rtm.tm_year += 100;
/* set the time zone to GMT, as mktime uses the local time zone*/
[LARS: THIS IS LINE 127] timezone = 0; altzone = 0;
/* use mktime to normalize the structure and t convert to a */
/* time_t value */
rt = mktime(&rtm);
/* reset the time zone to local settings */
tzset();
return rt;
}
----------------------------------------------------------------------
As you can see for yourself, ``altzone '' is used twice. The first
mention seems to me to be a declaration and the second an assignment.
And well, ... I just don't get it.
The documentation mentions that some compilers might need to be executed
as :
``CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure''
But there is no posix library as far as I can make out in Debian, so
that won't do.
I have been struggling with this for some weeks now, but I am none the
wiser.
I hope someone out there can point me in the right direction or just
downright solve the problem.
The source is available from the project homepage at
http://openscep.othello.org/ btw.
--
Lars Bahner,
http://lars.bahner.com/
All will reveal itself and things will be clear.
Reply to: