When attempting to compile courier-imap-4.4.1 on Solaris 9 using the Sun
Studio 12 compiler I ran into the following compilation error:
cc -I./.. -I.. -g -o couriertls starttls.o argparse.o -Wl,-lsocket
-Wl,-lnsl -L/usr/local/ssl/lib -L/usr/local/lib ./.libs/libcouriertls.a
-lssl -lcrypto -lnsl ./.libs/libspipe.a ../rfc1035/librfc1035.a
../md5/.libs/libmd5.a ../random128/.libs/librandom128.a
../numlib/.libs/libnumlib.a ../liblock/.libs/liblock.a
../soxwrap/libsoxwrap.a -lsocket -R/usr/local/ssl/lib -R/usr/local/lib
Undefined first referenced
symbol in file
setenv starttls.o
This is because the native libc on solaris 9 does not have a setenv().
However, putenv() can equivalently be used in its place. I wrote the
attached patch to work around this issue replacing the setenv function
calls with equivalent putenv calls.
If this patch provides the same functionality would it be possible to have
these changes incorporated into a future release, so that courier-imap can
be compiled on solaris 9 systems.
David Diffenbaugh
Open System Solutions
Office of Information Technology
Rutgers University
diff -ruN tcpd/starttls.c tcpd.new/starttls.c
--- tcpd/starttls.c 2008-07-21 17:23:59.465102000 -0400
+++ tcpd.new/starttls.c 2008-07-21 17:25:04.787150000 -0400
@@ -275,7 +275,12 @@
"TLS_SUBJECT_%s", n)]=0;
if (dcs->set_subject)
- setenv(namebuf, v, 1);
+ {
+ char *envstring = malloc(strlen(namebuf) + strlen(v) +
2);
+ sprintf(envstring, "%s=%s", namebuf, v);
+ putenv(envstring);
+ free(envstring);
+ }
}
}
@@ -321,8 +326,10 @@
buf=tls_get_encryption_desc(ssl);
- setenv("TLS_CONNECTED_PROTOCOL",
- buf ? buf:"(unknown)", 1);
+ char *tlsenvstring = malloc(strlen("TLS_CONNECTED_PROTOCOL=") +
strlen(buf ? buf:"(unknown)") + 1);
+ sprintf(tlsenvstring,"TLS_CONNECTED_PROTOCOL=%s",buf ?
buf:"(unknown)");
+ putenv(tlsenvstring);
+ free(tlsenvstring);
if (buf)
free(buf);
diff -ruN tcpd/tlsclient.c tcpd.new/tlsclient.c
--- tcpd/tlsclient.c 2008-07-21 17:28:02.446741000 -0400
+++ tcpd.new/tlsclient.c 2008-07-21 17:27:18.560510000 -0400
@@ -273,7 +273,11 @@
if (*p >= 'a' && *p <= 'z')
*p -= 'a' - 'A';
- setenv(a, b, 1);
+ char *envstring = malloc(sizeof(a) + sizeof(b) + 2);
+ sprintf(envstring,"%s=%s",a,b);
+ putenv(envstring);
+ free(envstring);
+
free(a);
}
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Courier-imap mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap