Stop compiler warnings.
[openssl.git] / crypto / bio / b_sock.c
index 5b66603d7d92a5982908dbde542d7042d737fe76..6d77b9d8d40d64e5b29820b950b3e92c86249dc0 100644 (file)
@@ -95,8 +95,10 @@ static struct ghbn_cache_st
        } ghbn_cache[GHBN_NUM];
 
 static int get_ip(const char *str,unsigned char *ip);
+#if 0
 static void ghbn_free(struct hostent *a);
 static struct hostent *ghbn_dup(struct hostent *a);
+#endif
 int BIO_get_host_ip(const char *str, unsigned char *ip)
        {
        int i;
@@ -266,6 +268,7 @@ long BIO_ghbn_ctrl(int cmd, int iarg, char *parg)
        return(1);
        }
 
+#if 0
 static struct hostent *ghbn_dup(struct hostent *a)
        {
        struct hostent *ret;
@@ -343,20 +346,27 @@ static void ghbn_free(struct hostent *a)
        OPENSSL_free(a);
        }
 
+#endif
+
 struct hostent *BIO_gethostbyname(const char *name)
        {
+#if 1
+       /* Caching gethostbyname() results forever is wrong,
+        * so we have to let the true gethostbyname() worry about this */
+       return gethostbyname(name);
+#else
        struct hostent *ret;
        int i,lowi=0,j;
        unsigned long low= (unsigned long)-1;
 
-/*     return(gethostbyname(name)); */
 
-#if 0 /* It doesn't make sense to use locking here: The function interface
-          * is not thread-safe, because threads can never be sure when
-          * some other thread destroys the data they were given a pointer to.
-          */
+#  if 0
+       /* It doesn't make sense to use locking here: The function interface
+        * is not thread-safe, because threads can never be sure when
+        * some other thread destroys the data they were given a pointer to.
+        */
        CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME);
-#endif
+#  endif
        j=strlen(name);
        if (j < 128)
                {
@@ -384,20 +394,21 @@ struct hostent *BIO_gethostbyname(const char *name)
                 * parameter is 'char *', instead of 'const char *'
                 */
                ret=gethostbyname(
-#ifndef CONST_STRICT
+#  ifndef CONST_STRICT
                    (char *)
-#endif
+#  endif
                    name);
 
                if (ret == NULL)
                        goto end;
                if (j > 128) /* too big to cache */
                        {
-#if 0 /* If we were trying to make this function thread-safe (which
-          * is bound to fail), we'd have to give up in this case
-          * (or allocate more memory). */
+#  if 0
+                       /* If we were trying to make this function thread-safe (which
+                        * is bound to fail), we'd have to give up in this case
+                        * (or allocate more memory). */
                        ret = NULL;
-#endif
+#  endif
                        goto end;
                        }
 
@@ -421,12 +432,14 @@ struct hostent *BIO_gethostbyname(const char *name)
                ghbn_cache[i].order=BIO_ghbn_miss+BIO_ghbn_hits;
                }
 end:
-#if 0
+#  if 0
        CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME);
-#endif
+#  endif
        return(ret);
+#endif
        }
 
+
 int BIO_sock_init(void)
        {
 #ifdef OPENSSL_SYS_WINDOWS