diff options
| author | Rich Megginson <rmeggins@redhat.com> | 2009-01-14 15:07:58 +0000 |
|---|---|---|
| committer | Rich Megginson <rmeggins@redhat.com> | 2009-01-14 15:07:58 +0000 |
| commit | b3799947308f45e3dac391bb73c09ecf359fdb92 (patch) | |
| tree | 037aabe2ebef7d5d7c19a5883594fc77a94bfb9e | |
| parent | d7d5d7f0ed55f5edbfa10a5911e8cbf44084e7ae (diff) | |
| download | ds-b3799947308f45e3dac391bb73c09ecf359fdb92.tar.gz ds-b3799947308f45e3dac391bb73c09ecf359fdb92.tar.xz ds-b3799947308f45e3dac391bb73c09ecf359fdb92.zip | |
Resolves: bug 222055
Bug Description: DirSync interval should be configurable
Reviewed by: nhosoi (Thanks!)
Fix Description: Added a new config attribute - winSyncInterval - this is how often to run the dirsync search, in seconds. The default is 600 (5 minutes) which was the old hard coded value. Due to the way it's coded, the change only takes effect when the agreement is created or restarted, so the value cannot really be dynamically changed.
Platforms tested: RHEL5
Flag Day: no
Doc impact: yes - document the new attribute
| -rw-r--r-- | ldap/schema/01common.ldif | 3 | ||||
| -rw-r--r-- | ldap/servers/plugins/replication/repl5.h | 1 | ||||
| -rw-r--r-- | ldap/servers/plugins/replication/repl_globals.c | 3 | ||||
| -rw-r--r-- | ldap/servers/plugins/replication/windows_inc_protocol.c | 8 | ||||
| -rw-r--r-- | ldap/servers/plugins/replication/windows_private.c | 49 | ||||
| -rw-r--r-- | ldap/servers/plugins/replication/windowsrepl.h | 8 |
6 files changed, 64 insertions, 8 deletions
diff --git a/ldap/schema/01common.ldif b/ldap/schema/01common.ldif index 3fe93ee2..83ece4f3 100644 --- a/ldap/schema/01common.ldif +++ b/ldap/schema/01common.ldif @@ -218,6 +218,7 @@ attributeTypes: ( 2.16.840.1.113730.3.1.1002 NAME 'nsds7NewWinUserSyncEnabled' D attributeTypes: ( 2.16.840.1.113730.3.1.1003 NAME 'nsds7NewWinGroupSyncEnabled' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' ) attributeTypes: ( 2.16.840.1.113730.3.1.1004 NAME 'nsds7WindowsDomain' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' ) attributeTypes: ( 2.16.840.1.113730.3.1.1005 NAME 'nsds7DirsyncCookie' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' ) +attributeTypes: ( 2.16.840.1.113730.3.1.1099 NAME 'winSyncInterval' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' ) attributeTypes: ( 1.3.6.1.1.4 NAME 'vendorName' EQUALITY 1.3.6.1.4.1.1466.109.114.1 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation X-ORIGIN 'RFC 3045' ) attributeTypes: ( 1.3.6.1.1.5 NAME 'vendorVersion' EQUALITY 1.3.6.1.4.1.1466.109.114.1 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation X-ORIGIN 'RFC 3045' ) attributeTypes: ( 2.16.840.1.113730.3.1.3023 NAME 'nsViewFilter' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'Netscape Directory Server' ) @@ -279,7 +280,7 @@ objectClasses: ( 2.16.840.1.113730.3.2.99 NAME 'cosSuperDefinition' DESC 'Netsca objectClasses: ( 2.16.840.1.113730.3.2.100 NAME 'cosClassicDefinition' DESC 'Netscape defined objectclass' SUP cosSuperDefinition MAY ( cosTemplateDn $ cosspecifier ) X-ORIGIN 'Netscape Directory Server' ) objectClasses: ( 2.16.840.1.113730.3.2.101 NAME 'cosPointerDefinition' DESC 'Netscape defined objectclass' SUP cosSuperDefinition MAY ( cosTemplateDn ) X-ORIGIN 'Netscape Directory Server' ) objectClasses: ( 2.16.840.1.113730.3.2.102 NAME 'cosIndirectDefinition' DESC 'Netscape defined objectclass' SUP cosSuperDefinition MAY ( cosIndirectSpecifier ) X-ORIGIN 'Netscape Directory Server' ) -objectClasses: ( 2.16.840.1.113730.3.2.503 NAME 'nsDSWindowsReplicationAgreement' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsDS5ReplicaHost $ nsDS5ReplicaPort $ nsDS5ReplicaTransportInfo $ nsDS5ReplicaBindDN $ nsDS5ReplicaCredentials $ nsDS5ReplicaBindMethod $ nsDS5ReplicaRoot $ nsDS5ReplicatedAttributeList $ nsDS5ReplicaUpdateSchedule $ nsds5BeginReplicaRefresh $ description $ nsds50ruv $ nsruvReplicaLastModified $ nsds5ReplicaTimeout $ nsds5replicaChangesSentSinceStartup $ nsds5replicaLastUpdateEnd $ nsds5replicaLastUpdateStart $ nsds5replicaLastUpdateStatus $ nsds5replicaUpdateInProgress $ nsds5replicaLastInitEnd $ nsds5replicaLastInitStart $ nsds5replicaLastInitStatus $ nsds5debugreplicatimeout $ nsds5replicaBusyWaitTime $ nsds5replicaSessionPauseTime $ nsds7WindowsReplicaSubtree $ nsds7DirectoryReplicaSubtree $ nsds7NewWinUserSyncEnabled $ nsds7NewWinGroupSyncEnabled $ nsds7WindowsDomain $ nsds7DirsyncCookie) X-ORIGIN 'Netscape Directory Server' ) +objectClasses: ( 2.16.840.1.113730.3.2.503 NAME 'nsDSWindowsReplicationAgreement' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsDS5ReplicaHost $ nsDS5ReplicaPort $ nsDS5ReplicaTransportInfo $ nsDS5ReplicaBindDN $ nsDS5ReplicaCredentials $ nsDS5ReplicaBindMethod $ nsDS5ReplicaRoot $ nsDS5ReplicatedAttributeList $ nsDS5ReplicaUpdateSchedule $ nsds5BeginReplicaRefresh $ description $ nsds50ruv $ nsruvReplicaLastModified $ nsds5ReplicaTimeout $ nsds5replicaChangesSentSinceStartup $ nsds5replicaLastUpdateEnd $ nsds5replicaLastUpdateStart $ nsds5replicaLastUpdateStatus $ nsds5replicaUpdateInProgress $ nsds5replicaLastInitEnd $ nsds5replicaLastInitStart $ nsds5replicaLastInitStatus $ nsds5debugreplicatimeout $ nsds5replicaBusyWaitTime $ nsds5replicaSessionPauseTime $ nsds7WindowsReplicaSubtree $ nsds7DirectoryReplicaSubtree $ nsds7NewWinUserSyncEnabled $ nsds7NewWinGroupSyncEnabled $ nsds7WindowsDomain $ nsds7DirsyncCookie $ winSyncInterval) X-ORIGIN 'Netscape Directory Server' ) objectClasses: ( 2.16.840.1.113730.3.2.128 NAME 'costemplate' DESC 'Netscape defined objectclass' SUP top MAY ( cn $ cospriority ) X-ORIGIN 'Netscape Directory Server' ) objectClasses: ( 2.16.840.1.113730.3.2.304 NAME 'nsView' DESC 'Netscape defined objectclass' SUP top AUXILIARY MAY ( nsViewFilter $ description ) X-ORIGIN 'Netscape Directory Server' ) objectClasses: ( 2.16.840.1.113730.3.2.316 NAME 'nsAttributeEncryption' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ nsEncryptionAlgorithm ) X-ORIGIN 'Netscape Directory Server' ) diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h index 47526793..97ce5569 100644 --- a/ldap/servers/plugins/replication/repl5.h +++ b/ldap/servers/plugins/replication/repl5.h @@ -149,6 +149,7 @@ extern const char *type_nsds7CreateNewUsers; extern const char *type_nsds7CreateNewGroups; extern const char *type_nsds7DirsyncCookie; extern const char *type_nsds7WindowsDomain; +extern const char *type_winSyncInterval; /* To Allow Consumer Initialisation when adding an agreement - */ extern const char *type_nsds5BeginReplicaRefresh; diff --git a/ldap/servers/plugins/replication/repl_globals.c b/ldap/servers/plugins/replication/repl_globals.c index 48329fc4..ed7f801c 100644 --- a/ldap/servers/plugins/replication/repl_globals.c +++ b/ldap/servers/plugins/replication/repl_globals.c @@ -126,13 +126,14 @@ const char *type_nsds5ReplicaTimeout = "nsds5ReplicaTimeout"; const char *type_nsds5ReplicaBusyWaitTime = "nsds5ReplicaBusyWaitTime"; const char *type_nsds5ReplicaSessionPauseTime = "nsds5ReplicaSessionPauseTime"; -/* windows sync specifica attributes */ +/* windows sync specific attributes */ const char *type_nsds7WindowsReplicaArea = "nsds7WindowsReplicaSubtree"; const char *type_nsds7DirectoryReplicaArea = "nsds7DirectoryReplicaSubtree"; const char *type_nsds7CreateNewUsers = "nsds7NewWinUserSyncEnabled"; const char *type_nsds7CreateNewGroups = "nsds7NewWinGroupSyncEnabled"; const char *type_nsds7WindowsDomain = "nsds7WindowsDomain"; const char *type_nsds7DirsyncCookie = "nsds7DirsyncCookie"; +const char *type_winSyncInterval = "winSyncInterval"; /* To Allow Consumer Initialisation when adding an agreement - */ const char *type_nsds5BeginReplicaRefresh = "nsds5BeginReplicaRefresh"; diff --git a/ldap/servers/plugins/replication/windows_inc_protocol.c b/ldap/servers/plugins/replication/windows_inc_protocol.c index fd806bd0..88a91bce 100644 --- a/ldap/servers/plugins/replication/windows_inc_protocol.c +++ b/ldap/servers/plugins/replication/windows_inc_protocol.c @@ -128,11 +128,6 @@ typedef struct windows_inc_private */ #define MAX_WAIT_BETWEEN_SESSIONS PR_SecondsToInterval(60 * 5) /* 5 minutes */ /* - * Periodic synchronization interval. This is used for scheduling the periodic_dirsync event. - * The time is in milliseconds. - */ -#define PERIODIC_DIRSYNC_INTERVAL 5 * 60 * 1000 /* DBDB this should probably be configurable. 5 mins fixed for now */ -/* * tests if the protocol has been shutdown and we need to quit * event_occurred resets the bits in the bit flag, so whoever tests for shutdown * resets the flags, so the next one who tests for shutdown won't get it, so we @@ -345,12 +340,13 @@ windows_inc_run(Private_Repl_Protocol *prp) if (is_first_start) { + unsigned long interval = windows_private_get_sync_interval(prp->agmt) * 1000; /* * The function, the arguments, the time (hence) when it is first to be called, * and the repeat interval. */ /* DBDB: we should probably make this polling interval configurable */ - dirsync = slapi_eq_repeat(periodic_dirsync, (void*) prp, (time_t)0 , PERIODIC_DIRSYNC_INTERVAL); + dirsync = slapi_eq_repeat(periodic_dirsync, (void*) prp, (time_t)0 , interval); is_first_start = PR_FALSE; } break; diff --git a/ldap/servers/plugins/replication/windows_private.c b/ldap/servers/plugins/replication/windows_private.c index a22467bb..8ba8b5c3 100644 --- a/ldap/servers/plugins/replication/windows_private.c +++ b/ldap/servers/plugins/replication/windows_private.c @@ -73,6 +73,7 @@ struct windowsprivate { Slapi_Filter *deleted_filter; /* Used for checking if an entry is an AD tombstone */ Slapi_Entry *raw_entry; /* "raw" un-schema processed last entry read from AD */ void *api_cookie; /* private data used by api callbacks */ + time_t sync_interval; /* how often to run the dirsync search, in seconds */ }; static void windows_private_set_windows_domain(const Repl_Agmt *ra, char *domain); @@ -153,6 +154,16 @@ windows_parse_config_entry(Repl_Agmt *ra, const char *type, Slapi_Entry *e) tmpstr = NULL; retval = 1; } + if (type == NULL || slapi_attr_types_equivalent(type,type_winSyncInterval)) + { + tmpstr = slapi_entry_attr_get_charptr(e, type_winSyncInterval); + if (NULL != tmpstr) + { + windows_private_set_sync_interval(ra,tmpstr); + } + slapi_ch_free_string(&tmpstr); + retval = 1; + } return retval; } @@ -203,6 +214,7 @@ Dirsync_Private* windows_private_new() dp->dirsync_maxattributecount = -1; dp->directory_filter = NULL; dp->deleted_filter = NULL; + dp->sync_interval = PERIODIC_DIRSYNC_INTERVAL; LDAPDebug0Args( LDAP_DEBUG_TRACE, "<= windows_private_new\n" ); return dp; @@ -866,6 +878,43 @@ void windows_private_set_api_cookie(Repl_Agmt *ra, void *api_cookie) LDAPDebug0Args( LDAP_DEBUG_TRACE, "<= windows_private_set_api_cookie\n" ); } +time_t +windows_private_get_sync_interval(const Repl_Agmt *ra) +{ + Dirsync_Private *dp; + + LDAPDebug0Args( LDAP_DEBUG_TRACE, "=> windows_private_get_sync_interval\n" ); + + PR_ASSERT(ra); + + dp = (Dirsync_Private *) agmt_get_priv(ra); + PR_ASSERT (dp); + + LDAPDebug0Args( LDAP_DEBUG_TRACE, "<= windows_private_get_sync_interval\n" ); + + return dp->sync_interval; +} + +void +windows_private_set_sync_interval(Repl_Agmt *ra, char *str) +{ + Dirsync_Private *dp; + time_t tmpval = 0; + + LDAPDebug0Args( LDAP_DEBUG_TRACE, "=> windows_private_set_sync_interval\n" ); + + PR_ASSERT(ra); + + dp = (Dirsync_Private *) agmt_get_priv(ra); + PR_ASSERT (dp); + + if (str && (tmpval = (time_t)atol(str))) { + dp->sync_interval = tmpval; + } + + LDAPDebug0Args( LDAP_DEBUG_TRACE, "<= windows_private_set_sync_interval\n" ); +} + /* an array of function pointers */ static void **_WinSyncAPI = NULL; diff --git a/ldap/servers/plugins/replication/windowsrepl.h b/ldap/servers/plugins/replication/windowsrepl.h index 207c74d7..0b0770b7 100644 --- a/ldap/servers/plugins/replication/windowsrepl.h +++ b/ldap/servers/plugins/replication/windowsrepl.h @@ -80,6 +80,8 @@ Slapi_Entry *windows_private_get_raw_entry(const Repl_Agmt *ra); void windows_private_set_raw_entry(const Repl_Agmt *ra, Slapi_Entry *e); void *windows_private_get_api_cookie(const Repl_Agmt *ra); void windows_private_set_api_cookie(Repl_Agmt *ra, void *cookie); +time_t windows_private_get_sync_interval(const Repl_Agmt *ra); +void windows_private_set_sync_interval(Repl_Agmt *ra, char *str); /* in windows_connection.c */ ConnResult windows_conn_connect(Repl_Connection *conn); @@ -122,6 +124,12 @@ int windows_check_user_password(Repl_Connection *conn, Slapi_DN *sdn, char *pass #define NTUNIQUEID_LENGTH 32 #define AD_GUID_LENGTH 36 +/* + * Periodic synchronization interval. This is used for scheduling the periodic_dirsync event. + * The time is in seconds. + */ +#define PERIODIC_DIRSYNC_INTERVAL 5 * 60 /* default value is 5 minutes */ + /* called for each replication agreement - so the winsync plugin can be agreement specific and store agreement specific data |
