Commit a6fd7fa9 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

add -S to slapadd to set desired SID in generated entryCSN/contextCSN

parent 5ed5bc58
......@@ -18,6 +18,7 @@ slapadd \- Add entries to a SLAPD database
.B [\-o name[=value]
.B [\-q]
.B [\-s]
.B [\-S SID]
.B [\-u]
.B [\-v]
.B [\-w]
......@@ -119,6 +120,10 @@ databases containing special objects, such as fractional objects on a
partial replica. Loading normal objects which do not conform to
schema may result in unexpected and ill behavior.
.TP
.B \-S " SID"
Server ID to use in generated entryCSN. Also used for contextCSN
if `\-w' is set as well. Defaults to 0.
.TP
.B \-u
enable dry-run (don't write to backend) mode.
.TP
......
......@@ -67,6 +67,9 @@ slapadd( int argc, char **argv )
int rc = EXIT_SUCCESS;
int manage = 0;
/* default "000" */
csnsid = 0;
slap_tool_init( progname, SLAPADD, argc, argv );
memset( &opbuf, 0, sizeof(opbuf) );
......@@ -220,7 +223,7 @@ slapadd( int argc, char **argv )
nvals[1].bv_len = 0;
nvals[1].bv_val = NULL;
csn.bv_len = lutil_csnstr( csnbuf, sizeof( csnbuf ), 0, 0 );
csn.bv_len = lutil_csnstr( csnbuf, sizeof( csnbuf ), csnsid, 0 );
csn.bv_val = csnbuf;
timestamp.bv_val = timebuf;
......
......@@ -241,7 +241,7 @@ slap_tool_init(
switch( tool ) {
case SLAPADD:
options = "b:cd:f:F:gj:l:n:o:qstuvw";
options = "b:cd:f:F:gj:l:n:o:qsS:tuvw";
break;
case SLAPCAT:
......@@ -384,6 +384,14 @@ slap_tool_init(
realm = optarg;
break;
case 'S':
if ( lutil_atoul( &csnsid, optarg )
|| csnsid > SLAP_SYNC_SID_MAX )
{
usage( tool, progname );
}
break;
case 's': /* dump subtree */
if ( tool == SLAPADD )
mode |= SLAP_TOOL_NO_SCHEMA_CHECK;
......
......@@ -60,6 +60,7 @@ typedef struct tool_vars {
slap_ssf_t tv_tls_ssf;
slap_ssf_t tv_sasl_ssf;
unsigned tv_dn_mode;
unsigned int tv_csnsid;
} tool_vars;
extern tool_vars tool_globals;
......@@ -91,6 +92,7 @@ extern tool_vars tool_globals;
#define tls_ssf tool_globals.tv_tls_ssf
#define sasl_ssf tool_globals.tv_sasl_ssf
#define dn_mode tool_globals.tv_dn_mode
#define csnsid tool_globals.tv_csnsid
#define SLAP_TOOL_LDAPDN_PRETTY SLAP_LDAPDN_PRETTY
#define SLAP_TOOL_LDAPDN_NORMAL (SLAP_LDAPDN_PRETTY << 1)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment