]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/bconfig.c
ITS#6378,ITS#6379
[openldap] / servers / slapd / bconfig.c
index a7f4bd35b76405d1f3e6010e1761d8264741ebcf..90cd6229261de78f65fd8f013b43a82db06a2224 100644 (file)
@@ -25,6 +25,7 @@
 #include <ac/ctype.h>
 #include <ac/errno.h>
 #include <sys/stat.h>
+#include <ac/unistd.h>
 
 #include "slap.h"
 
@@ -1783,7 +1784,8 @@ sortval_reject:
                                ServerID *si, **sip;
                                LDAPURLDesc *lud;
                                int num;
-                               if ( lutil_atoi( &num, c->argv[1] ) ||
+                               if (( lutil_atoi( &num, c->argv[1] ) && 
+                                       lutil_atoix( &num, c->argv[1], 16 )) ||
                                        num < 0 || num > SLAP_SYNC_SID_MAX )
                                {
                                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
@@ -1828,7 +1830,7 @@ sortval_reject:
                                        BER_BVZERO( &si->si_url );
                                        slap_serverID = num;
                                        Debug( LDAP_DEBUG_CONFIG,
-                                               "%s: SID=%d\n",
+                                               "%s: SID=0x%03x\n",
                                                c->log, slap_serverID, 0 );
                                }
                                si->si_next = NULL;
@@ -1841,7 +1843,7 @@ sortval_reject:
                                        if ( l ) {
                                                slap_serverID = si->si_num;
                                                Debug( LDAP_DEBUG_CONFIG,
-                                                       "%s: SID=%d (listener=%s)\n",
+                                                       "%s: SID=0x%03x (listener=%s)\n",
                                                        c->log, slap_serverID,
                                                        l->sl_url.bv_val );
                                        }
@@ -2481,7 +2483,7 @@ tcp_buffer_delete( BerVarray vals )
 }
 
 static int
-tcp_buffer_unparse( int idx, int size, int rw, Listener *l, struct berval *val )
+tcp_buffer_unparse( int size, int rw, Listener *l, struct berval *val )
 {
        char buf[sizeof("2147483648")], *ptr;
 
@@ -2526,7 +2528,7 @@ tcp_buffer_unparse( int idx, int size, int rw, Listener *l, struct berval *val )
 }
 
 static int
-tcp_buffer_add_one( int argc, char **argv, int idx )
+tcp_buffer_add_one( int argc, char **argv )
 {
        int rc = 0;
        int size = -1, rw = 0;
@@ -2541,7 +2543,7 @@ tcp_buffer_add_one( int argc, char **argv, int idx )
        }
 
        /* unparse for later use */
-       rc = tcp_buffer_unparse( idx, size, rw, l, &val );
+       rc = tcp_buffer_unparse( size, rw, l, &val );
        if ( rc != LDAP_SUCCESS ) {
                return rc;
        }
@@ -2579,8 +2581,7 @@ tcp_buffer_add_one( int argc, char **argv, int idx )
 
        tcp_buffer = SLAP_REALLOC( tcp_buffer, sizeof( struct berval ) * ( tcp_buffer_num + 2 ) );
        /* append */
-       idx = tcp_buffer_num;
-       tcp_buffer[ idx ] = val;
+       tcp_buffer[ tcp_buffer_num ] = val;
 
        tcp_buffer_num++;
        BER_BVZERO( &tcp_buffer[ tcp_buffer_num ] );
@@ -2625,7 +2626,7 @@ config_tcp_buffer( ConfigArgs *c )
                        }
 
                        /* unparse for later use */
-                       rc = tcp_buffer_unparse( tcp_buffer_num, size, rw, l, &val );
+                       rc = tcp_buffer_unparse( size, rw, l, &val );
                        if ( rc != LDAP_SUCCESS ) {
                                return 1;
                        }
@@ -2658,13 +2659,12 @@ done:;
 
        } else {
                int rc;
-               int idx;
 
-               rc = tcp_buffer_add_one( c->argc - 1, &c->argv[ 1 ], idx );
+               rc = tcp_buffer_add_one( c->argc - 1, &c->argv[ 1 ] );
                if ( rc ) {
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
                                "<%s> unable to add value #%d",
-                               c->argv[0], idx );
+                               c->argv[0], tcp_buffer_num );
                        Debug( LDAP_DEBUG_ANY, "%s: %s\n",
                                c->log, c->cr_msg, 0 );
                        return 1;
@@ -3050,7 +3050,7 @@ static int
 loglevel_init( void )
 {
        slap_verbmasks  lo[] = {
-               { BER_BVC("Any"),       -1 },
+               { BER_BVC("Any"),       (slap_mask_t) LDAP_DEBUG_ANY },
                { BER_BVC("Trace"),     LDAP_DEBUG_TRACE },
                { BER_BVC("Packets"),   LDAP_DEBUG_PACKETS },
                { BER_BVC("Args"),      LDAP_DEBUG_ARGS },
@@ -3202,9 +3202,11 @@ loglevel_print( FILE *out )
 
        fprintf( out, "Installed log subsystems:\n\n" );
        for ( i = 0; !BER_BVISNULL( &loglevel_ops[ i ].word ); i++ ) {
-               fprintf( out, "\t%-30s (%lu)\n",
-                       loglevel_ops[ i ].word.bv_val,
-                       loglevel_ops[ i ].mask );
+               unsigned mask = loglevel_ops[ i ].mask & 0xffffffffUL;
+               fprintf( out,
+                       (mask == ((slap_mask_t) -1 & 0xffffffffUL)
+                        ? "\t%-30s (-1, 0xffffffff)\n" : "\t%-30s (%u, 0x%x)\n"),
+                       loglevel_ops[ i ].word.bv_val, mask, mask );
        }
 
        fprintf( out, "\nNOTE: custom log subsystems may be later installed "
@@ -4576,6 +4578,7 @@ schema_destroy_one( ConfigArgs *ca, ConfigOCs **colst, int nocs,
 
        ca->valx = -1;
        ca->line = NULL;
+       ca->argc = 1;
        if ( cfn->c_cr_head ) {
                struct berval bv = BER_BVC("olcDitContentRules");
                ad = NULL;
@@ -5391,6 +5394,7 @@ config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs,
                                        }
                                        ca->line = bv.bv_val;
                                        ca->valx = d->idx[i];
+                                       config_parse_vals(ct, ca, d->idx[i] );
                                        rc = config_del_vals( ct, ca );
                                        if ( rc != LDAP_SUCCESS ) break;
                                        if ( s )
@@ -5402,6 +5406,7 @@ config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs,
                        } else {
                                ca->valx = -1;
                                ca->line = NULL;
+                               ca->argc = 1;
                                rc = config_del_vals( ct, ca );
                                if ( rc ) rc = LDAP_OTHER;
                                if ( s )
@@ -5448,6 +5453,7 @@ out:
                                        a->a_flags &= ~(SLAP_ATTR_IXDEL|SLAP_ATTR_IXADD);
                                        ca->valx = -1;
                                        ca->line = NULL;
+                                       ca->argc = 1;
                                        config_del_vals( ct, ca );
                                }
                                for ( i=0; !BER_BVISNULL( &s->a_vals[i] ); i++ ) {
@@ -5462,6 +5468,7 @@ out:
                                ct = config_find_table( colst, nocs, a->a_desc, ca );
                                ca->valx = -1;
                                ca->line = NULL;
+                               ca->argc = 1;
                                config_del_vals( ct, ca );
                                s = attr_find( save_attrs, a->a_desc );
                                if ( s ) {