char *s,
int check_dup )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
Slapi_Entry *e = NULL;
char *pTmpS;
}
return e;
-#else /* !defined(LDAP_SLAPI) */
+#else
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
char *
Slapi_Entry *e,
int *len )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
char *ret;
ldap_pvt_thread_mutex_lock( &entry2str_mutex );
ldap_pvt_thread_mutex_unlock( &entry2str_mutex );
return ret;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
char *
slapi_entry_get_dn( Slapi_Entry *e )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
return e->e_name.bv_val;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
int
slapi_x_entry_get_id( Slapi_Entry *e )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
return e->e_id;
#else
return NOID;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
void
Slapi_Entry *e,
char *ldn )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
struct berval dn = { 0, NULL };
dn.bv_val = ldn;
dn.bv_len = strlen( ldn );
dnPrettyNormal( NULL, &dn, &e->e_name, &e->e_nname );
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
Slapi_Entry *
slapi_entry_dup( Slapi_Entry *e )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
char *tmp = NULL;
Slapi_Entry *tmpEnt;
int len = 0;
}
return tmpEnt;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
int
Slapi_Entry *e,
char *type )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
} else {
return -1; /* something went wrong */
}
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return -1;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
Slapi_Entry *
slapi_entry_alloc( void )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
return (Slapi_Entry *)slapi_ch_calloc( 1, sizeof(Slapi_Entry) );
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
void
slapi_entry_free( Slapi_Entry *e )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
entry_free( e );
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
int
char *type,
struct berval **vals )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
BerVarray bv;
ch_free( bv );
return rc;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return -1;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
int
char *type,
Slapi_Attr **attr )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
AttributeDescription *ad = NULL;
const char *text;
int rc;
}
return 0;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return -1;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
char *
Slapi_Attr *attr,
struct berval ***vals )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
int i, j;
struct berval **bv;
*vals = (struct berval **)bv;
return 0;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return -1;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
char *
slapi_dn_normalize( char *dn )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
struct berval bdn;
struct berval ndn;
ch_free( ndn.bv_val );
return dn;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
/*
char *
slapi_dn_normalize_case( char *dn )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
slapi_dn_normalize( dn );
ldap_pvt_str2lower( dn );
return dn;
-#else /* defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
int
char *dn,
char *suffix )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
struct berval bdn, ndn;
struct berval bsuffix, nsuffix;
dnNormalize2( NULL, &bsuffix, &nsuffix );
return dnIsSuffix( &ndn, &nsuffix );
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return 0;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
char *
slapi_dn_ignore_case( char *dn )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
return slapi_dn_normalize_case( dn );
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
char *
slapi_ch_malloc( unsigned long size )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
return ch_malloc( size );
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
void
slapi_ch_free( void **ptr )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
ch_free( *ptr );
*ptr = NULL;
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
void
slapi_ch_free_string( char **ptr )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
slapi_ch_free( (void **)ptr );
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
void
unsigned long nelem,
unsigned long size )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
return ch_calloc( nelem, size );
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
char *
char *block,
unsigned long size )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
return ch_realloc( block, size );
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
char *
slapi_ch_strdup( char *s )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
return ch_strdup( (const char *)s );
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
size_t
slapi_ch_stlen( char *s )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
return strlen( (const char *)s );
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return 0;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
int
struct berval **val,
int *iscritical )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
int i;
int rc = 0;
}
return rc;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return 0;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
void
char *controloid,
unsigned long controlops )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
/* FIXME -- can not add controls to OpenLDAP dynamically */
slapi_log_error( SLAPI_LOG_FATAL, "SLAPI_CONTROLS",
"OpenLDAP does not support dynamic registration of LDAP controls\n" );
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
int
char ***ctrloidsp,
unsigned long **ctrlopsp )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
int i, n;
int rc = 1;
char **oids = NULL;
}
return rc;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return 1;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
void
slapi_register_supported_saslmechanism( char *mechanism )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
/* FIXME -- can not add saslmechanism to OpenLDAP dynamically */
slapi_log_error( SLAPI_LOG_FATAL, "SLAPI_SASL",
"OpenLDAP does not support dynamic registration of SASL mechanisms\n" );
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
char **
slapi_get_supported_saslmechanisms( void )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
/* FIXME -- can not get the saslmechanism wihtout a connection. */
slapi_log_error( SLAPI_LOG_FATAL, "SLAPI_SASL",
"can not get the saslmechanism "
"wihtout a connection\n" );
return NULL;
-#else /* defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
char **
slapi_get_supported_extended_ops( void )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
int i, j, k;
char **ppExtOpOID = NULL;
int numExtOps = 0;
ppExtOpOID[ i + k ] = NULL;
return ppExtOpOID;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
void
int nentries,
struct berval **urls )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
Connection *conn;
Operation *op;
struct berval *s;
}
send_ldap_result( conn, op, err, matched, text, NULL, NULL );
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
int
char **attrs,
int attrsonly )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
Backend *be;
Connection *pConn;
Operation *pOp;
return rc;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return -1;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
Slapi_Filter *
slapi_str2filter( char *str )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
return str2filter( str );
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
void
Slapi_Filter *f,
int recurse )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
filter_free( f );
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
Slapi_Filter *
int
slapi_filter_get_choice( Slapi_Filter *f )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
int rc;
if ( f != NULL ) {
}
return rc;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return -1; /* invalid filter type */
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
int
char **type,
struct berval **bval )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
int ftype;
int rc = LDAP_SUCCESS;
}
return rc;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return -1;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
Slapi_Filter *
slapi_filter_list_first( Slapi_Filter *f )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
int ftype;
if ( f == NULL ) {
} else {
return NULL;
}
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
Slapi_Filter *
Slapi_Filter *f,
Slapi_Filter *fprev )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
int ftype;
if ( f == NULL ) {
}
return NULL;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
int
char *respName,
struct berval *response )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
send_ldap_extended( conn,op, errornum, NULL, NULL, NULL,
respName,response, NULL );
return LDAP_SUCCESS;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return -1;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
int
struct berval **vals,
struct berval *v )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
/*
* FIXME: what's the point?
*/
return 1;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return 1;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
#define MAX_HOSTNAME 512
char *
slapi_get_hostname( void )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
char *hn = NULL;
/*
#endif /* !_SPARC */
return hn;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return NULL;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
/*
char *fmt,
... )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
int rc = LDAP_SUCCESS;
va_list arglist;
va_end( arglist );
return rc;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return -1;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
unsigned long
slapi_timer_current_time( void )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
static int first_time = 1;
#if !defined (_WIN32)
struct timeval now;
QueryPerformanceCounter( &now );
return (1000000*(now.QuadPart-base_time.QuadPart))/performance_freq.QuadPart;
#endif /* _WIN32 */
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return 0;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
/*
unsigned long
slapi_timer_get_time( char *label )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
unsigned long start = slapi_timer_current_time();
printf("%10ld %10ld usec %s\n", start, 0, label);
return start;
-#else /* !defined(LDAP_SLAPI) */
+#else /* LDAP_SLAPI */
return 0;
-#endif /* !defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
/*
char *label,
unsigned long start )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
unsigned long stop = slapi_timer_current_time();
printf ("%10ld %10ld usec %s\n", stop, stop - start, label);
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
void
slapi_free_search_results_internal( Slapi_PBlock *pb )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
Slapi_Entry **entries;
int k = 0, nEnt = 0;
}
slapi_ch_free( (void **)&entries );
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
/*
*/
int slapi_x_backend_set_pb( Slapi_PBlock *pb, Backend *be )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
int rc;
rc = slapi_pblock_set( pb, SLAPI_BACKEND, (void *)be );
return LDAP_SUCCESS;
#else
return -1;
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
/*
* If oldStyle is TRUE, then a value suitable for setting to
* the deprecated SLAPI_CONN_AUTHTYPE value is returned
*/
int slapi_x_connection_set_pb( Slapi_PBlock *pb, Connection *conn )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
char *connAuthType;
int rc;
return rc;
#else
return -1;
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
/*
*/
int slapi_x_operation_set_pb( Slapi_PBlock *pb, Operation *op )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
int isRoot = 0;
int isUpdateDn = 0;
int rc;
int slapi_is_connection_ssl( Slapi_PBlock *pb, int *isSSL )
{
-#if defined( LDAP_SLAPI )
+#ifdef LDAP_SLAPI
Connection *conn;
slapi_pblock_get( pb, SLAPI_CONNECTION, &conn );
return LDAP_SUCCESS;
#else
return -1;
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
/*
int slapi_attr_get_flags( const Slapi_Attr *attr, unsigned long *flags )
{
-#if defined( LDAP_SLAPI )
+#ifdef LDAP_SLAPI
AttributeType *at;
if ( attr == NULL )
return LDAP_SUCCESS;
#else
return -1;
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
int slapi_attr_flag_is_set( const Slapi_Attr *attr, unsigned long flag )
{
-#if defined( LDAP_SLAPI )
+#ifdef LDAP_SLAPI
unsigned long flags;
if ( slapi_attr_get_flags( attr, &flags ) != 0 )
return (flags & flag) ? 1 : 0;
#else
return 0;
-#endif /* defined(LDAP_SLAPI) */
+#endif /* LDAP_SLAPI */
}
Slapi_Attr *slapi_attr_new( void )