]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
checkpoint
authorMark Andrews <marka@isc.org>
Fri, 13 Dec 2002 02:37:35 +0000 (02:37 +0000)
committerMark Andrews <marka@isc.org>
Fri, 13 Dec 2002 02:37:35 +0000 (02:37 +0000)
bin/named/unix/os.c
lib/dns/Makefile.in
lib/dns/sec/dst/dst_api.c
lib/dns/sec/dst/gssapi_link.c
lib/dns/sec/dst/openssl_link.c
lib/dns/sec/dst/openssldh_link.c
lib/dns/sec/dst/openssldsa_link.c
lib/dns/sec/dst/opensslrsa_link.c

index 8efd57ae5f859d20fb4b3fc41d4918c199bc796e..0e5f57f6772d992ffbd3d33b3989216959358970 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: os.c,v 1.60 2002/07/10 01:13:42 marka Exp $ */
+/* $Id: os.c,v 1.61 2002/12/13 02:37:33 marka Exp $ */
 
 #include <config.h>
 #include <stdarg.h>
@@ -357,6 +357,10 @@ void
 ns_os_chroot(const char *root) {
        char strbuf[ISC_STRERRORSIZE];
        if (root != NULL) {
+               isc_uint32_t dummy;
+
+               isc_random_get(&dummy);
+
                if (chroot(root) < 0) {
                        isc__strerror(errno, strbuf, sizeof(strbuf));
                        ns_main_earlyfatal("chroot(): %s", strbuf);
index d4ac22df8419df88429ad5dbef8c50a944ea6cb2..412bbde8b278677ed8221d97ad5df822fa07ec73 100644 (file)
@@ -13,7 +13,7 @@
 # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
 # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: Makefile.in,v 1.134 2002/12/13 02:11:12 marka Exp $
+# $Id: Makefile.in,v 1.135 2002/12/13 02:37:34 marka Exp $
 
 srcdir =       @srcdir@
 VPATH =                @srcdir@
@@ -34,13 +34,13 @@ LIBS =              @LIBS@
 
 # Alphabetically
 
-DSTOBJS =      sec/dst/dst_api.@O@ \
-               sec/dst/dst_lib.@O@ sec/dst/dst_parse.@O@ \
-               sec/dst/dst_result.@O@ sec/dst/gssapi_link.@O@ \
-               sec/dst/gssapictx.@O@ sec/dst/hmac_link.@O@ \
-               sec/dst/key.@O@ sec/dst/openssl_link.@O@ \
-               sec/dst/openssldh_link.@O@ sec/dst/openssldsa_link.@O@ \
-               sec/dst/opensslrsa_link.@O@
+DSTOBJS =      sec/dst/dst_api.@O@ sec/dst/dst_lib.@O@ sec/dst/dst_parse.@O@ \
+               sec/dst/dst_result.@O@ sec/dst/hmac_link.@O@ sec/dst/key.@O@
+
+OPENSSLOBJS =  sec/dst/openssl_link.@O@ sec/dst/openssldh_link.@O@ \
+               sec/dst/openssldsa_link.@O@ sec/dst/opensslrsa_link.@O@
+
+GSSAPIOBJS =   sec/dst/gssapi_link.@O@ sec/dst/gssapictx.@O@
 
 # Alphabetically
 OBJS =         acl.@O@ adb.@O@ byaddr.@O@ \
@@ -56,7 +56,7 @@ OBJS =                acl.@O@ adb.@O@ byaddr.@O@ \
                stats.@O@ tcpmsg.@O@ time.@O@ timer.@O@ tkey.@O@ \
                tsig.@O@ ttl.@O@ validator.@O@ \
                version.@O@ view.@O@ xfrin.@O@ zone.@O@ zonekey.@O@ zt.@O@ \
-               ${OTHEROBJS} ${DSTOBJS}
+               ${OTHEROBJS} ${DSTOBJS} ${OPENSSLOBJS} ${GSSAPIOBJS}
 
 # Alphabetically
 SRCS =         acl.c adb.c byaddr.c \
@@ -100,6 +100,26 @@ libdns.la: ${OBJS}
                -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
                ${OBJS} ${LIBS}
 
+libdstcypto.@SA@: ${OPENSSLOBJS}
+       ${AR} ${ARFLAGS} $@ ${OPENSSLOBJS}
+       ${RANLIB} $@
+
+libdstcypto.la: ${OPENSSLOBJS}
+       ${LIBTOOL} --mode=link \
+               ${CC} ${ALL_CFLAGS} -o $@ -rpath ${libdir} \
+               -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
+               ${OPENSSLOBJS} ${LIBS}
+
+libdstgssapi.@SA@: ${GSSAPIOBJS}
+       ${AR} ${ARFLAGS} $@ ${GSSAPIOBJS}
+       ${RANLIB} $@
+
+libdstgssapi.la: ${GSSAPIOBJS}
+       ${LIBTOOL} --mode=link \
+               ${CC} ${ALL_CFLAGS} -o $@ -rpath ${libdir} \
+               -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
+               ${GSSAPIOBJS} ${LIBS}
+
 timestamp: libdns.@A@
        touch timestamp
 
index 44d939c10a80bb81c680980e99c658c9d284e4c3..f9a4567971b0ecb9868ad655f5eb080f6a73beaf 100644 (file)
@@ -19,7 +19,7 @@
 
 /*
  * Principal Author: Brian Wellington
- * $Id: dst_api.c,v 1.104 2002/11/12 22:22:32 explorer Exp $
+ * $Id: dst_api.c,v 1.105 2002/12/13 02:37:34 marka Exp $
  */
 
 #include <config.h>
@@ -103,6 +103,14 @@ static isc_result_t        addsuffix(char *filename, unsigned int len,
                        goto out;               \
        } while (0)
 
+#define RETERR2(x)                             \
+       do {                                    \
+               result = (x);                   \
+               if (result != ISC_R_SUCCESS &&  \
+                   result != ISC_R_NOTIMPLEMENTED)     \
+                       goto out;               \
+       } while (0)
+
 #define CHECKALG(alg)                          \
        do {                                    \
                isc_result_t _r;                \
@@ -119,22 +127,7 @@ dst_lib_init(isc_mem_t *mctx, isc_entropy_t *ectx, unsigned int eflags) {
        REQUIRE(dst_initialized == ISC_FALSE);
 
        dst__memory_pool = NULL;
-
-#ifdef OPENSSL
-       UNUSED(mctx);
-       /*
-        * When using --with-openssl, there seems to be no good way of not
-        * leaking memory due to the openssl error handling mechanism.
-        * Avoid assertions by using a local memory context and not checking
-        * for leaks on exit.
-        */
-       result = isc_mem_create(0, 0, &dst__memory_pool);
-       if (result != ISC_R_SUCCESS)
-               return (result);
-       isc_mem_setdestroycheck(dst__memory_pool, ISC_FALSE);
-#else
        isc_mem_attach(mctx, &dst__memory_pool);
-#endif
        isc_entropy_attach(ectx, &dst_entropy_pool);
        dst_entropy_flags = eflags;
 
@@ -142,16 +135,12 @@ dst_lib_init(isc_mem_t *mctx, isc_entropy_t *ectx, unsigned int eflags) {
 
        memset(dst_t_func, 0, sizeof(dst_t_func));
        RETERR(dst__hmacmd5_init(&dst_t_func[DST_ALG_HMACMD5]));
-#ifdef OPENSSL
-       RETERR(dst__openssl_init());
-       RETERR(dst__opensslrsa_init(&dst_t_func[DST_ALG_RSAMD5]));
-       RETERR(dst__opensslrsa_init(&dst_t_func[DST_ALG_RSASHA1]));
-       RETERR(dst__openssldsa_init(&dst_t_func[DST_ALG_DSA]));
-       RETERR(dst__openssldh_init(&dst_t_func[DST_ALG_DH]));
-#endif
-#ifdef GSSAPI
-       RETERR(dst__gssapi_init(&dst_t_func[DST_ALG_GSSAPI]));
-#endif
+       RETERR2(dst__openssl_init());
+       RETERR2(dst__opensslrsa_init(&dst_t_func[DST_ALG_RSAMD5]));
+       RETERR2(dst__opensslrsa_init(&dst_t_func[DST_ALG_RSASHA1]));
+       RETERR2(dst__openssldsa_init(&dst_t_func[DST_ALG_DSA]));
+       RETERR2(dst__openssldh_init(&dst_t_func[DST_ALG_DH]));
+       RETERR2(dst__gssapi_init(&dst_t_func[DST_ALG_GSSAPI]));
        dst_initialized = ISC_TRUE;
        return (ISC_R_SUCCESS);
 
@@ -169,14 +158,11 @@ dst_lib_destroy(void) {
        for (i = 0; i < DST_MAX_ALGS; i++)
                if (dst_t_func[i] != NULL && dst_t_func[i]->cleanup != NULL)
                        dst_t_func[i]->cleanup();
-#ifdef OPENSSL
        dst__openssl_destroy();
-#endif
        if (dst__memory_pool != NULL)
                isc_mem_detach(&dst__memory_pool);
        if (dst_entropy_pool != NULL)
                isc_entropy_detach(&dst_entropy_pool);
-
 }
 
 isc_boolean_t
index fb2d877ff92452d6bfb1c0adc4a966114a961fad..873811ba747f9cad9b2d369803d7cdcaa8fb9e56 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 /*
- * $Id: gssapi_link.c,v 1.10 2002/02/27 22:11:57 bwelling Exp $
+ * $Id: gssapi_link.c,v 1.11 2002/12/13 02:37:34 marka Exp $
  */
 
 #ifdef GSSAPI
@@ -216,5 +216,17 @@ dst__gssapi_init(dst_func_t **funcp) {
 }
 
 #else
-int  gssapi_link_unneeded = 1;
+
+#include <config.h>
+#include <stdlib.h>
+#include <isc/util.h>
+#include "dst_internal.h"
+
+isc_result_t
+dst__gssapi_init(dst_func_t **funcp) {
+       REQUIRE(funcp != NULL);
+       UNUSED(funcp);
+       return (ISC_R_NOTIMPLEMENTED);
+}
+
 #endif
index f1760307f07109b8f3e01796508a426886400516..c7449d320463902118d495b176304612f37a557e 100644 (file)
@@ -19,7 +19,7 @@
 
 /*
  * Principal Author: Brian Wellington
- * $Id: openssl_link.c,v 1.51 2002/10/31 04:35:02 marka Exp $
+ * $Id: openssl_link.c,v 1.52 2002/12/13 02:37:35 marka Exp $
  */
 #ifdef OPENSSL
 
@@ -56,6 +56,7 @@ static int nlocks;
 static ENGINE *e;
 #endif
 
+static isc_mem_t *openssl__memory_pool = NULL;
 
 static int
 entropy_get(unsigned char *buf, int num) {
@@ -102,22 +103,22 @@ id_callback(void) {
 
 static void *
 mem_alloc(size_t size) {
-       INSIST(dst__memory_pool != NULL);
-       return (isc_mem_allocate(dst__memory_pool, size));
+       INSIST(openssl__memory_pool != NULL);
+       return (isc_mem_allocate(openssl__memory_pool, size));
 }
 
 static void
 mem_free(void *ptr) {
-       INSIST(dst__memory_pool != NULL);
+       INSIST(openssl__memory_pool != NULL);
        if (ptr != NULL)
-               isc_mem_free(dst__memory_pool, ptr);
+               isc_mem_free(openssl__memory_pool, ptr);
 }
 
 static void *
 mem_realloc(void *ptr, size_t size) {
        void *p;
 
-       INSIST(dst__memory_pool != NULL);
+       INSIST(openssl__memory_pool != NULL);
        p = NULL;
        if (size > 0) {
                p = mem_alloc(size);
@@ -130,9 +131,14 @@ mem_realloc(void *ptr, size_t size) {
 }
 
 isc_result_t
-dst__openssl_init() {
+dst__openssl_init(void) {
        isc_result_t result;
 
+        result = isc_mem_create(0, 0, &openssl__memory_pool);
+        if (result != ISC_R_SUCCESS)
+                return (result);
+        isc_mem_setdestroycheck(openssl__memory_pool, ISC_FALSE);
+
        CRYPTO_set_mem_functions(mem_alloc, mem_realloc, mem_free);
        nlocks = CRYPTO_num_locks();
        locks = mem_alloc(sizeof(isc_mutex_t) * nlocks);
@@ -179,7 +185,7 @@ dst__openssl_init() {
 }
 
 void
-dst__openssl_destroy() {
+dst__openssl_destroy(void) {
        ERR_clear_error();
 #ifdef USE_ENGINE
        if (e != NULL)
@@ -191,6 +197,8 @@ dst__openssl_destroy() {
        }
        if (rm != NULL)
                mem_free(rm);
+       if (openssl__memory_pool != NULL)
+               isc_mem_detach(&openssl__memory_pool);
 }
 
 isc_result_t
@@ -212,7 +220,23 @@ dst__openssl_toresult(isc_result_t fallback) {
 #else /* OPENSSL */
 
 #include <isc/util.h>
+#include "dst_internal.h"
+#include "dst_openssl.h"
+
+isc_result_t
+dst__openssl_init(void) {
+       return (ISC_R_NOTIMPLEMENTED);
+}
 
-EMPTY_TRANSLATION_UNIT
+void
+dst__openssl_destroy(void) {
+       /* empty */
+}
+
+isc_result_t
+dst__openssl_toresult(isc_result_t fallback) {
+       UNUSED(fallback);
+       return (ISC_R_NOTIMPLEMENTED);
+}
 
 #endif /* OPENSSL */
index da38e5c484dfb66497095a06f82cbc0389862182..2615447f47282db39649c588ccb04d38979ea841 100644 (file)
@@ -19,7 +19,7 @@
 
 /*
  * Principal Author: Brian Wellington
- * $Id: openssldh_link.c,v 1.48 2002/03/19 04:30:55 marka Exp $
+ * $Id: openssldh_link.c,v 1.49 2002/12/13 02:37:35 marka Exp $
  */
 
 #ifdef OPENSSL
@@ -602,8 +602,17 @@ dst__openssldh_init(dst_func_t **funcp) {
 
 #else /* OPENSSL */
 
+#include <config.h>
 #include <isc/util.h>
+#include <stdlib.h>            /* NULL */
+#include "dst_internal.h"
 
-EMPTY_TRANSLATION_UNIT
+isc_result_t
+dst__openssldh_init(dst_func_t **funcp) {
+       REQUIRE(funcp != NULL);
+       UNUSED(funcp);
+       
+       return (ISC_R_NOTIMPLEMENTED);
+}
 
 #endif /* OPENSSL */
index aba2af3e8709f23bcab73ddcac8f37a9bf7bd45b..dfd14beb23b6c0453aba7499d14eb1dadc46118c 100644 (file)
@@ -17,7 +17,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: openssldsa_link.c,v 1.11 2002/03/19 04:30:56 marka Exp $ */
+/* $Id: openssldsa_link.c,v 1.12 2002/12/13 02:37:35 marka Exp $ */
 
 #ifdef OPENSSL
 
@@ -437,8 +437,17 @@ dst__openssldsa_init(dst_func_t **funcp) {
 
 #else /* OPENSSL */
 
+#include <config.h>
+#include <stdlib.h>
 #include <isc/util.h>
+#include "dst_internal.h"
 
-EMPTY_TRANSLATION_UNIT
+isc_result_t
+dst__openssldsa_init(dst_func_t **funcp) {
+       REQUIRE(funcp != NULL);
+       UNUSED(funcp);
+
+       return (ISC_R_NOTIMPLEMENTED);
+}
 
 #endif /* OPENSSL */
index 0b8f9b5a48cade13af2b73377fb3e9f7eaed6b21..2d3646b96dca4fec2eabe68b1a54881209bf3a7e 100644 (file)
@@ -17,7 +17,7 @@
 
 /*
  * Principal Author: Brian Wellington
- * $Id: opensslrsa_link.c,v 1.23 2002/03/19 04:30:57 marka Exp $
+ * $Id: opensslrsa_link.c,v 1.24 2002/12/13 02:37:35 marka Exp $
  */
 #ifdef OPENSSL
 
@@ -521,8 +521,17 @@ dst__opensslrsa_init(dst_func_t **funcp) {
 
 #else /* OPENSSL */
 
+#include <config.h>
+#include <stdlib.h>
 #include <isc/util.h>
+#include "dst_internal.h"
 
-EMPTY_TRANSLATION_UNIT
+isc_result_t
+dst__opensslrsa_init(dst_func_t **funcp) {
+       REQUIRE(funcp != NULL);
+       UNUSED(funcp);
+
+       return (ISC_R_NOTIMPLEMENTED);
+}
 
 #endif /* OPENSSL */