diff options
author | cvsadm <cvsadm> | 2005-01-21 00:44:34 +0000 |
---|---|---|
committer | cvsadm <cvsadm> | 2005-01-21 00:44:34 +0000 |
commit | b2093e3016027d6b5cf06b3f91f30769bfc099e2 (patch) | |
tree | cf58939393a9032182c4fbc4441164a9456e82f8 /ldap/servers/plugins/replication/repl_rootdse.c | |
download | ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.tar.gz ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.tar.xz ds-b2093e3016027d6b5cf06b3f91f30769bfc099e2.zip |
Moving NSCP Directory Server from DirectoryBranch to TRUNK, initial drop. (foxworth)ldapserver7x
Diffstat (limited to 'ldap/servers/plugins/replication/repl_rootdse.c')
-rw-r--r-- | ldap/servers/plugins/replication/repl_rootdse.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/ldap/servers/plugins/replication/repl_rootdse.c b/ldap/servers/plugins/replication/repl_rootdse.c new file mode 100644 index 00000000..2bd1d8e8 --- /dev/null +++ b/ldap/servers/plugins/replication/repl_rootdse.c @@ -0,0 +1,79 @@ +/** BEGIN COPYRIGHT BLOCK + * Copyright 2001 Sun Microsystems, Inc. + * Portions copyright 1999, 2001-2003 Netscape Communications Corporation. + * All rights reserved. + * END COPYRIGHT BLOCK **/ + +#include <string.h> + +#include "repl.h" +#include "cl4.h" +#include "slapi-plugin.h" + +/* Forward Declartions */ +static int repl_rootdse_search (Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *returncode, char *returntext, void *arg); + +int +repl_rootdse_init() +{ + /* The FE DSE *must* be initialised before we get here */ + int return_value= LDAP_SUCCESS; + + slapi_config_register_callback(SLAPI_OPERATION_SEARCH,DSE_FLAG_PREOP,"",LDAP_SCOPE_BASE,"(objectclass=*)",repl_rootdse_search,NULL); + + return return_value; +} + +static int +repl_rootdse_search(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *returncode, char *returntext, void *arg) +{ + +#if 0 + struct berval val; + struct berval *vals[2]; + vals[0] = &val; + vals[1] = NULL; + + /* machine data suffix */ + val.bv_val = REPL_CONFIG_TOP; + val.bv_len = strlen( val.bv_val ); + slapi_entry_attr_replace( e, ATTR_NETSCAPEMDSUFFIX, vals ); + + /* Changelog information */ +/* ONREPL because we now support multiple 4.0 changelogs we no longer publish + info in the rootdse */ + if ( get_repl_backend() != NULL ) + { + char buf[BUFSIZ]; + changeNumber cnum; + + /* Changelog suffix */ + val.bv_val = changelog4_get_suffix (); + if ( val.bv_val != NULL ) + { + val.bv_len = strlen( val.bv_val ); + slapi_entry_attr_replace( e, "changelog", vals ); + } + slapi_ch_free ((void **)&val.bv_val); + + /* First change number contained in log */ + cnum = ldapi_get_first_changenumber(); + sprintf( buf, "%lu", cnum ); + val.bv_val = buf; + val.bv_len = strlen( val.bv_val ); + slapi_entry_attr_replace( e, "firstchangenumber", vals ); + + /* Last change number contained in log */ + cnum = ldapi_get_last_changenumber(); + sprintf( buf, "%lu", cnum ); + val.bv_val = buf; + val.bv_len = strlen( val.bv_val ); + slapi_entry_attr_replace( e, "lastchangenumber", vals ); + } +#endif + + return SLAPI_DSE_CALLBACK_OK; +} + + + |