}
for ( i=0; vals[i].bv_val; i++ ) {
ca->line = vals[i].bv_val;
+ ca->linelen = vals[i].bv_len;
if (( ad->ad_type->sat_flags & SLAP_AT_ORDERED_VAL ) &&
ca->line[0] == '{' ) {
char *idx = strchr( ca->line, '}' );
- if ( idx ) ca->line = idx+1;
+ if ( idx ) {
+ ca->linelen -= (idx+1) - ca->line;
+ ca->line = idx+1;
+ }
}
rc = config_parse_vals( ct, ca, i );
if ( rc ) {
char *iptr = NULL;
ca->valx = -1;
ca->line = a->a_vals[i].bv_val;
+ ca->linelen = a->a_vals[i].bv_len;
if ( a->a_desc->ad_type->sat_flags & SLAP_AT_ORDERED ) {
ptr = strchr( ca->line, '}' );
if ( ptr ) {
iptr = strchr( ca->line, '{' );
+ ca->linelen -= (ptr+1) - ca->line;
ca->line = ptr+1;
}
}
if ( next == ca->line + 1 || next[ 0 ] != '}' ) {
return LDAP_OTHER;
}
+ ca->linelen -= (ptr+1) - ca->line;
ca->line = ptr+1;
}
}
bv.bv_val = ptr;
}
ca->line = bv.bv_val;
+ ca->linelen = bv.bv_len;
ca->valx = d->idx[i];
config_parse_vals(ct, ca, d->idx[i] );
rc = config_del_vals( ct, ca );
break;
for (i=0; ml->sml_values[i].bv_val; i++) {
ca->line = ml->sml_values[i].bv_val;
+ ca->linelen = ml->sml_values[i].bv_len;
ca->valx = -1;
rc = config_modify_add( ct, ca, ml->sml_desc, i );
if ( rc )
}
for ( i=0; !BER_BVISNULL( &s->a_vals[i] ); i++ ) {
ca->line = s->a_vals[i].bv_val;
+ ca->linelen = s->a_vals[i].bv_len;
ca->valx = -1;
config_modify_add( ct, ca, s->a_desc, i );
}
s->a_flags &= ~(SLAP_ATTR_IXDEL|SLAP_ATTR_IXADD);
for ( i=0; !BER_BVISNULL( &s->a_vals[i] ); i++ ) {
ca->line = s->a_vals[i].bv_val;
+ ca->linelen = s->a_vals[i].bv_len;
ca->valx = -1;
config_modify_add( ct, ca, s->a_desc, i );
}
if( (Conf[i].length && (!strncasecmp(c->argv[0], Conf[i].name, Conf[i].length))) ||
(!strcasecmp(c->argv[0], Conf[i].name)) ) break;
if ( !Conf[i].name ) return NULL;
+ if (( Conf[i].arg_type & ARGS_TYPES ) == ARG_BINARY ) {
+ size_t decode_len = LUTIL_BASE64_DECODE_LEN(c->linelen);
+ ch_free( c->tline );
+ c->tline = ch_malloc( decode_len+1 );
+ c->linelen = lutil_b64_pton( c->line, c->tline, decode_len );
+ if ( c->linelen < 0 )
+ {
+ ch_free( c->tline );
+ c->tline = NULL;
+ return NULL;
+ }
+ c->line = c->tline;
+ }
return Conf+i;
}
assert( c->argc == 2 );
if ( !check_only )
ber_str2bv( c->argv[1], 0, 1, &c->value_bv );
+ } else if(arg_type == ARG_BINARY) {
+ assert( c->argc == 2 );
+ if ( !check_only ) {
+ c->value_bv.bv_len = c->linelen;
+ c->value_bv.bv_val = ch_malloc( c->linelen );
+ AC_MEMCPY( c->value_bv.bv_val, c->line, c->linelen );
+ }
} else if(arg_type == ARG_DN) {
struct berval bv;
assert( c->argc == 2 );
break;
}
case ARG_BERVAL:
+ case ARG_BINARY:
*(struct berval *)ptr = c->value_bv;
break;
case ARG_ATDESC:
fprintf( stderr, "init_config_attrs: register_at failed\n" );
return code;
}
+ if (( ct[i].arg_type & ARGS_TYPES ) == ARG_BINARY ) {
+ ldif_must_b64_encode_register( ct[i].ad->ad_cname.bv_val,
+ ct[i].ad->ad_type->sat_oid );
+ }
}
return 0;
config_parse_vals(ConfigTable *ct, ConfigArgs *c, int valx)
{
int rc = 0;
+ int arg_type = ct->arg_type & ARGS_TYPES;
snprintf( c->log, sizeof( c->log ), "%s: value #%d",
ct->ad->ad_cname.bv_val, valx );
c->argc = 1;
c->argv[0] = ct->ad->ad_cname.bv_val;
- if ( ( ct->arg_type & ARG_QUOTE ) && c->line[ 0 ] != '"' ) {
+ if ( (( ct->arg_type & ARG_QUOTE ) && c->line[ 0 ] != '"' ) ||
+ (arg_type == ARG_BERVAL || arg_type == ARG_BINARY)) {
c->argv[c->argc] = c->line;
c->argc++;
c->argv[c->argc] = NULL;
config_parse_add(ConfigTable *ct, ConfigArgs *c, int valx)
{
int rc = 0;
+ int arg_type = ct->arg_type & ARGS_TYPES;
snprintf( c->log, sizeof( c->log ), "%s: value #%d",
ct->ad->ad_cname.bv_val, valx );
c->argc = 1;
c->argv[0] = ct->ad->ad_cname.bv_val;
- if ( ( ct->arg_type & ARG_QUOTE ) && c->line[ 0 ] != '"' ) {
+ if ( (( ct->arg_type & ARG_QUOTE ) && c->line[ 0 ] != '"' ) ||
+ (arg_type == ARG_BERVAL || arg_type == ARG_BINARY)) {
c->argv[c->argc] = c->line;
c->argc++;
c->argv[c->argc] = NULL;
int inquote = 0;
c->tline = ch_strdup(c->line);
+ c->linelen = strlen(c->line);
token = strtok_quote(c->tline, " \t", "e_ptr, &inquote);
if(token) for(i = 0; hide[i]; i++) if(!strcasecmp(token, hide[i])) break;