+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
const char *url,
int *enclosedp,
int *ldaps ));
-static void hex_unescape LDAP_P(( char *s ));
-static int unhex( char c );
int
* return non-zero if this looks like a LDAP URL; zero if not
* if non-zero returned, *urlp will be moved past "ldap://" part of URL
*/
- char* p;
+ const char *p;
if ( url == NULL ) {
return( NULL );
}
- p = (char *) url;
+ p = url;
/* skip leading '<' (if any) */
if ( *p == '<' ) {
if (( q = strchr( url, ':' )) != NULL ) {
*q++ = '\0';
- hex_unescape( q );
+ ldap_pvt_hex_unescape( q );
if( *q == '\0' ) {
LDAP_FREE( url );
ludp->lud_port = atoi( q );
}
- hex_unescape( url );
+ ldap_pvt_hex_unescape( url );
ludp->lud_host = LDAP_STRDUP( url );
if( ludp->lud_host == NULL ) {
if( *p != '\0' ) {
/* parse dn part */
- hex_unescape( p );
+ ldap_pvt_hex_unescape( p );
ludp->lud_dn = LDAP_STRDUP( p );
} else {
ludp->lud_dn = LDAP_STRDUP( "" );
if( *p != '\0' ) {
/* parse attributes */
- hex_unescape( p );
+ ldap_pvt_hex_unescape( p );
ludp->lud_attrs = ldap_str2charray( p, "," );
if( ludp->lud_attrs == NULL ) {
if( *p != '\0' ) {
/* parse the scope */
- hex_unescape( p );
+ ldap_pvt_hex_unescape( p );
ludp->lud_scope = str2scope( p );
if( ludp->lud_scope == -1 ) {
if( *p != '\0' ) {
/* parse the filter */
- hex_unescape( p );
+ ldap_pvt_hex_unescape( p );
if( ! *p ) {
/* missing filter */
}
for( i=0; ludp->lud_exts[i] != NULL; i++ ) {
- hex_unescape( ludp->lud_exts[i] );
+ ldap_pvt_hex_unescape( ludp->lud_exts[i] );
}
if( i == 0 ) {
}
-static void
-hex_unescape( char *s )
+void
+ldap_pvt_hex_unescape( char *s )
{
/*
* Remove URL hex escapes from s... done in place. The basic concept for
for ( p = s; *s != '\0'; ++s ) {
if ( *s == '%' ) {
if ( *++s != '\0' ) {
- *p = unhex( *s ) << 4;
+ *p = ldap_pvt_unhex( *s ) << 4;
}
if ( *++s != '\0' ) {
- *p++ += unhex( *s );
+ *p++ += ldap_pvt_unhex( *s );
}
} else {
*p++ = *s;
}
-static int
-unhex( char c )
+int
+ldap_pvt_unhex( int c )
{
return( c >= '0' && c <= '9' ? c - '0'
: c >= 'A' && c <= 'F' ? c - 'A' + 10