#pragma ident "%Z%%M% %I% %E% SMI"
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* Copyright (c) 1995 Regents of the University of Michigan.
* All rights reserved.
*/
/*
* nsldapi_getdxbyname - retrieve DX records from the DNS (from
* TXT records for now)
*/
#include <stdio.h>
#ifdef LDAP_DNS
#include <string.h>
#include <ctype.h>
#ifdef macintosh
#include <stdlib.h>
#include "macos.h"
#endif /* macintosh */
#ifdef _WINDOWS
#include <windows.h>
#endif
#include <netdb.h>
#include <resolv.h>
#endif
#include "ldap-int.h"
#if defined( DOS )
#include "msdos.h"
#endif /* DOS */
#ifdef NEEDPROTOS
#else /* NEEDPROTOS */
static char **decode_answer();
#endif /* NEEDPROTOS */
extern int h_errno;
extern char *h_errlist[];
/*
* nsldapi_getdxbyname - lookup DNS DX records for domain and return an ordered
* array.
*/
char **
{
char **dxs;
int rc;
/* XXX not MT safe XXX */
/*
* punt: return list conisting of the original domain name only
*/
NSLDAPI_FREE( dxs );
}
} else {
}
}
return( dxs );
}
static char **
{
unsigned char *eom, *p;
#ifdef LDAP_DEBUG
if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
/* __p_query( answer ); */
}
#endif /* LDAP_DEBUG */
return( NULL );
}
if ( ancount < 1 ) {
return( NULL );
}
/*
* skip over the query
*/
return( NULL );
}
/*
* pull out the answers we are interested in
*/
err = NO_RECOVERY;
continue;
}
p += rc; /* skip over name */
p += INT16SZ;
p += INT16SZ;
p += INT32SZ; /* skip over TTL */
p += INT16SZ;
char *q, *r;
q = (char *)p;
txt_len = *q - 3;
r = q + 4;
while ( isspace( *r )) {
++r;
--txt_len;
}
pref = 0;
while ( isdigit( *r )) {
pref *= 10;
pref += ( *r - '0' );
++r;
--txt_len;
}
}
while ( isspace( *r )) {
++r;
--txt_len;
}
if ( dx_count == 0 ) {
} else {
( dx_count + 2 ) * sizeof( char * ));
}
== NULL ) {
err = NO_RECOVERY;
continue;
}
}
q += ( *q + 1 ); /* move past last TXT record */
}
}
p += rr_len;
}
if ( err == 0 ) {
if ( dx_count == 0 ) {
} else {
/*
* sort records based on associated preference value
*/
char *tmp_dx;
for ( i = 0; i < sort_count; ++i ) {
for ( j = i + 1; j < sort_count; ++j ) {
}
}
}
}
}
return( dxs );
}
#endif /* LDAP_DNS */