]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/getdxbyname.c
Add strdup.c from -llutil, renamed to ldap_strdup() and always used.
[openldap] / libraries / libldap / getdxbyname.c
index 50683f6c37933c12753b1018fb91d3e5d4583863..c31d926374b09d9dea095cdb43e01f92cd2d7691 100644 (file)
@@ -1,63 +1,41 @@
-#ifdef LDAP_DNS
 /*
  *  Copyright (c) 1995 Regents of the University of Michigan.
  *  All rights reserved.
  *
- * getdxbyname - retrieve DX records from the DNS (from TXT records for now)
+ * ldap_getdxbyname - retrieve DX records from the DNS (from TXT records for now)
  */
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
 
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#endif /* MACOS */
-
-#if !defined(MACOS) && !defined(DOS) && !defined( _WIN32 )
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <resolv.h>
-#endif
-#include "lber.h"
-#include "ldap.h"
-#include "ldap-int.h"
+#include "portable.h"
 
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#endif /* DOS */
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
 
+#include <stdio.h>
+#include <stdlib.h>
 
-#ifdef NEEDPROTOS
-static char ** decode_answer( unsigned char *answer, int len );
-#else /* NEEDPROTOS */
-static char **decode_answer();
-#endif /* NEEDPROTOS */
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
 
-extern int h_errno;
-extern char *h_errlist[];
+#include "ldap-int.h"
 
+static char ** decode_answer LDAP_P(( unsigned char *answer, int len ));
 
 #define MAX_TO_SORT    32
 
 
 /*
- * getdxbyname - lookup DNS DX records for domain and return an ordered
+ * ldap_getdxbyname - lookup DNS DX records for domain and return an ordered
  *     array.
  */
 char **
-getdxbyname( char *domain )
+ldap_getdxbyname( char *domain )
 {
     unsigned char      buf[ PACKETSZ ];
     char               **dxs;
     int                        rc;
 
-    Debug( LDAP_DEBUG_TRACE, "getdxbyname( %s )\n", domain, 0, 0 );
+    Debug( LDAP_DEBUG_TRACE, "ldap_getdxbyname( %s )\n", domain, 0, 0 );
 
     memset( buf, 0, sizeof( buf ));
 
@@ -67,7 +45,7 @@ getdxbyname( char *domain )
         * punt:  return list conisting of the original domain name only
         */
        if (( dxs = (char **)malloc( 2 * sizeof( char * ))) == NULL ||
-               ( dxs[ 0 ] = strdup( domain )) == NULL ) {
+               ( dxs[ 0 ] = ldap_strdup( domain )) == NULL ) {
            if ( dxs != NULL ) {
                free( dxs );
            }
@@ -91,9 +69,11 @@ decode_answer( unsigned char *answer, int len )
     int                        dx_pref[ MAX_TO_SORT ];
 
 #ifdef LDAP_DEBUG
+#ifdef notdef
     if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
-/*     __p_query( answer );    /* */
+               __p_query( answer );
     }
+#endif
 #endif /* LDAP_DEBUG */
 
     dxs = NULL;
@@ -215,4 +195,4 @@ decode_answer( unsigned char *answer, int len )
     return( dxs );
 }
 
-#endif /* LDAP_DNS */
+#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */