From 296826b1f0e3c7dc55c5f5e524b01f7a389e1fec Mon Sep 17 00:00:00 2001 From: Rein Tollevik Date: Thu, 17 Sep 2009 15:06:22 +0000 Subject: [PATCH] ITS#6297 Allow hex in serverID directive --- doc/man/man5/slapd-config.5 | 5 ++++- doc/man/man5/slapd.conf.5 | 3 ++- servers/slapd/bconfig.c | 7 ++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/man/man5/slapd-config.5 b/doc/man/man5/slapd-config.5 index ffbf6f0655..a646deecef 100644 --- a/doc/man/man5/slapd-config.5 +++ b/doc/man/man5/slapd-config.5 @@ -723,7 +723,10 @@ property specifies the maximum security layer receive buffer size allowed. 0 disables security layers. The default is 65536. .TP .B olcServerID: [] -Specify an integer ID from 0 to 4095 for this server. These IDs are +Specify an integer ID from 0 to 4095 for this server (limited +to 3 hexadecimal digits). The ID may also be specified as a +hexadecimal ID by prefixing the value with "0x". +These IDs are required when using multimaster replication and each master must have a unique ID. Note that this requirement also applies to separate masters contributing to a glued set of databases. diff --git a/doc/man/man5/slapd.conf.5 b/doc/man/man5/slapd.conf.5 index a641d7cbeb..0ff35429e9 100644 --- a/doc/man/man5/slapd.conf.5 +++ b/doc/man/man5/slapd.conf.5 @@ -915,7 +915,8 @@ e.g. ldapi:// (and eventually IPSEC). It is not normally used. .TP .B serverID [] Specify an integer ID from 0 to 4095 for this server (limited -to 3 hexadecimal digits). +to 3 hexadecimal digits). The ID may also be specified as a +hexadecimal ID by prefixing the value with "0x". These IDs are required when using multimaster replication and each master must have a unique ID. Note that this requirement also applies to separate masters diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 4beed71a1b..c03c23afda 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -1783,7 +1783,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 +1829,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 +1842,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 ); } -- 2.39.2