]> git.sur5r.net Git - openldap/commitdiff
ITS#6430, more for #6419
authorHoward Chu <hyc@openldap.org>
Sat, 12 Dec 2009 07:18:52 +0000 (07:18 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 12 Dec 2009 07:18:52 +0000 (07:18 +0000)
servers/slapd/config.c
servers/slapd/slap.h

index df317d0028e99f8b0716fe429ab49cde155871e5..78a270e71f847c60423956f8f47804335cc22ac2 100644 (file)
@@ -1353,6 +1353,20 @@ slap_cf_aux_table_parse( const char *word, void *dst, slap_cf_aux_table *tab0, L
 
                                rc = lutil_atoulx( ulptr, val, 0 );
                                break;
+
+                       case 'x':
+                               if ( tab->aux != NULL ) {
+                                       struct berval value;
+                                       slap_cf_aux_table_parse_x *func = (slap_cf_aux_table_parse_x *)tab->aux;
+
+                                       ber_str2bv( val, 0, 1, &value );
+
+                                       rc = func( &value, (void *)((char *)dst + tab->off), tab, tabmsg, 0 );
+
+                               } else {
+                                       rc = 1;
+                               }
+                               break;
                        }
 
                        if ( rc ) {
@@ -1443,6 +1457,26 @@ slap_cf_aux_table_unparse( void *src, struct berval *bv, slap_cf_aux_table *tab0
                        ptr += snprintf( ptr, sizeof( buf ) - ( ptr - buf ), "%lu", *ulptr );
                        break;
 
+               case 'x':
+                       *ptr++ = ' ';
+                       ptr = lutil_strcopy( ptr, tab->key.bv_val );
+                       if ( tab->quote ) *ptr++ = '"';
+                       if ( tab->aux != NULL ) {
+                               struct berval value;
+                               slap_cf_aux_table_parse_x *func = (slap_cf_aux_table_parse_x *)tab->aux;
+                               int rc;
+
+                               value.bv_val = ptr;
+                               value.bv_len = buf + sizeof( buf ) - ptr;
+
+                               rc = func( &value, (void *)((char *)src + tab->off), tab, "(unparse)", 1 );
+                               if ( rc == 0 ) {
+                                       ptr += value.bv_len;
+                               }
+                       }
+                       if ( tab->quote ) *ptr++ = '"';
+                       break;
+
                default:
                        assert( 0 );
                }
index 076b898a5b6ac60b4f2434d98939a6109bc3ac57..82e3d79674752356aec735d10b6066762d8f7d37 100644 (file)
@@ -1630,6 +1630,14 @@ typedef struct slap_cf_aux_table {
        void *aux;
 } slap_cf_aux_table;
 
+typedef int 
+slap_cf_aux_table_parse_x LDAP_P((
+       struct berval *val,
+       void *bc,
+       slap_cf_aux_table *tab0,
+       const char *tabmsg,
+       int unparse ));
+
 #define SLAP_LIMIT_TIME        1
 #define SLAP_LIMIT_SIZE        2