p = slapi_value_get_string( &attr->a_vals[0] );
if ( p != NULL ) {
- return slapi_ch_strdup( (char *)p );
+ return slapi_ch_strdup( p );
}
}
}
char *
-slapi_ch_strdup( char *s )
+slapi_ch_strdup( const char *s )
{
- return ch_strdup( (const char *)s );
+ return ch_strdup( s );
}
size_t
-slapi_ch_stlen( char *s )
+slapi_ch_stlen( const char *s )
{
- return strlen( (const char *)s );
+ return strlen( s );
}
int
Slapi_Value *slapi_value_init_string(Slapi_Value *v, const char *s)
{
- v->bv_val = slapi_ch_strdup( (char *)s );
+ v->bv_val = slapi_ch_strdup( s );
v->bv_len = strlen( s );
return v;
mods[i] = (LDAPMod *)slapi_ch_malloc( sizeof(LDAPMod) );
modp = mods[i];
modp->mod_op = ml->sml_op | LDAP_MOD_BVALUES;
- modp->mod_type = slapi_ch_strdup( ml->sml_type.bv_val );
- ml->sml_type.bv_val = NULL;
+ if ( BER_BVISNULL( &ml->sml_type ) ) {
+ /* may happen for internally generated mods */
+ assert( ml->sml_desc != NULL );
+ modp->mod_type = slapi_ch_strdup( ml->sml_desc->ad_cname.bv_val );
+ } else {
+ modp->mod_type = slapi_ch_strdup( ml->sml_type.bv_val );
+ BER_BVZERO( &ml->sml_type );
+ }
if ( ml->sml_values != NULL ) {
for( j = 0; ml->sml_values[j].bv_val != NULL; j++ )
return type;
}
+void slapi_be_set_readonly( Slapi_Backend *be, int readonly )
+{
+ if ( be == NULL )
+ return;
+
+ if ( readonly )
+ be->be_restrictops |= SLAP_RESTRICT_OP_WRITES;
+ else
+ be->be_restrictops &= ~(SLAP_RESTRICT_OP_WRITES);
+}
+
+int slapi_be_get_readonly( Slapi_Backend *be )
+{
+ if ( be == NULL )
+ return 0;
+
+ return ( (be->be_restrictops & SLAP_RESTRICT_OP_WRITES) == SLAP_RESTRICT_OP_WRITES );
+}
+
+const char *slapi_x_be_get_updatedn( Slapi_Backend *be )
+{
+ if ( be == NULL )
+ return NULL;
+
+ return be->be_update_ndn.bv_val;
+}
+
+Slapi_Backend *slapi_be_select( const Slapi_DN *sdn )
+{
+ Slapi_Backend *be;
+
+ slapi_sdn_get_ndn( sdn );
+
+ be = select_backend( (struct berval *)&sdn->ndn, 0, 0 );
+
+ return be;
+}
+
#if 0
void
slapi_operation_set_flag(Slapi_Operation *op, unsigned long flag)