فهرست منبع

Update the slapi-plugin documentation on new slapi functions, and added a slapi function for checking on shutdowns

Fix Description:  removed the g_get_shutdown() functions from the plugins, and replaced them with the slapi version

Reviewed by: Richm (Thanks!)
(cherry picked from commit 4d564ef42db022a5102c9b6ae1bdd41a18c1dd7f)
Mark Reynolds 13 سال پیش
والد
کامیت
07601165b5

+ 1 - 1
ldap/servers/plugins/linkedattrs/fixup_task.c

@@ -355,7 +355,7 @@ linked_attrs_add_backlinks_callback(Slapi_Entry *e, void *callback_data)
         int perform_update = 0;
         Slapi_DN *targetsdn = NULL;
 
-        if (g_get_shutdown()) {
+        if (slapi_is_shutting_down()) {
             rc = -1;
             goto done;
         }

+ 0 - 2
ldap/servers/plugins/linkedattrs/linked_attrs.h

@@ -138,8 +138,6 @@ int linked_attrs_fixup_task_add(Slapi_PBlock *pb, Slapi_Entry *e,
                            Slapi_Entry *eAfter, int *returncode,
                            char *returntext, void *arg);
 
-int g_get_shutdown();		/* declared in proto-slap.h */
-
 /*
  * misc
  */

+ 1 - 1
ldap/servers/plugins/memberof/memberof.c

@@ -1700,7 +1700,7 @@ int memberof_get_groups_callback(Slapi_Entry *e, void *callback_data)
 	Slapi_ValueSet *groupvals = *((memberof_get_groups_data*)callback_data)->groupvals;
 	int rc = 0;
 
-	if(g_get_shutdown()){
+	if(slapi_is_shutting_down()){
 		rc = -1;
 		goto bail;
 	}

+ 0 - 2
ldap/servers/plugins/memberof/memberof.h

@@ -96,6 +96,4 @@ void memberof_wlock_config();
 void memberof_unlock_config();
 int memberof_config_get_all_backends();
 
-int g_get_shutdown();		/* declared in proto-slap.h */
-
 #endif	/* _MEMBEROF_H_ */

+ 1 - 3
ldap/servers/plugins/replication/cl5_api.c

@@ -265,8 +265,6 @@ typedef struct cl5desc
 
 typedef void (*VFP)(void *);
 
-int g_get_shutdown();		/* declared in proto-slap.h */
-
 /***** Global Variables *****/
 static CL5Desc s_cl5Desc;
 
@@ -3472,7 +3470,7 @@ static void _cl5TrimFile (Object *obj, long *numToTrim)
 
 	entry.op = &op;
 
-	while ( !finished && !g_get_shutdown() )
+	while ( !finished && !slapi_is_shutting_down() )
 	{
 		it = NULL;
 		count = 0;

+ 1 - 4
ldap/servers/plugins/replication/repl5_replica.c

@@ -50,9 +50,6 @@
 #include "csnpl.h"
 #include "cl5_api.h"
 
-/* from proto-slap.h */
-int g_get_shutdown();
-
 #define RUV_SAVE_INTERVAL (30 * 1000) /* 30 seconds */
 #define START_UPDATE_DELAY 2 /* 2 second */
 
@@ -2506,7 +2503,7 @@ process_reap_entry (Slapi_Entry *entry, void *cb_data)
 	int rc = -1;
 
 	/* abort reaping if we've been told to stop or we're shutting down */
-	if (*tombstone_reap_stop || g_get_shutdown()) {
+	if (*tombstone_reap_stop || slapi_is_shutting_down()) {
 		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
 						"process_reap_entry: the tombstone reap process "
 						" has been stopped\n");

+ 1 - 2
ldap/servers/plugins/replication/repl5_replica_config.c

@@ -86,7 +86,6 @@ static struct berval *create_ruv_payload(char *value);
 static int replica_cleanup_task (Object *r, const char *task_name, char *returntext, int apply_mods);
 static int replica_task_done(Replica *replica);
 static multimaster_mtnode_extension * _replica_config_get_mtnode_ext (const Slapi_Entry *e);
-int g_get_shutdown();
 
 /*
  * Note: internal add/modify/delete operations should not be run while
@@ -1325,7 +1324,7 @@ replica_cleanallruv_monitor_thread(void *arg)
 
 	slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanAllRUV_task: Waiting for all the replicas to get cleaned...\n");
 
-	while(!g_get_shutdown())
+	while(!slapi_is_shutting_down())
 	{
 		DS_Sleep(PR_SecondsToInterval(10));
 		found = 0;

+ 1 - 1
ldap/servers/plugins/usn/usn_cleanup.c

@@ -148,7 +148,7 @@ usn_cleanup_thread(void *arg)
         int opflags = OP_FLAG_TOMBSTONE_ENTRY;
 
         /* check for shutdown */
-        if(g_get_shutdown()){
+        if(slapi_is_shutting_down()){
             slapi_task_log_notice(task, "USN tombstone cleanup task aborted due to shutdown.");
             slapi_task_log_status(task, "USN tombstone cleanup task aborted due to shutdown.");
             slapi_log_error(SLAPI_LOG_FATAL, USN_PLUGIN_SUBSYSTEM,

+ 5 - 0
ldap/servers/slapd/libglobs.c

@@ -890,6 +890,11 @@ int g_get_shutdown()
     return slapd_shutdown;
 }
 
+int slapi_is_shutting_down()
+{
+	return slapd_shutdown;
+}
+
 
 static int cmd_shutdown;
 

+ 21 - 1
ldap/servers/slapd/slapi-plugin.h

@@ -5321,6 +5321,13 @@ void slapi_ch_array_add( char ***array, char *string );
  */
 int slapi_ch_array_utf8_inlist(char **array, char *string);
 
+/**
+ * Check if the server has started shutting down
+ *
+ * \return 1 if the server is shutting down
+ */
+int slapi_is_shutting_down();
+
 /*
  * checking routines for allocating and freeing memory
  */
@@ -6762,7 +6769,20 @@ int slapi_re_exec( Slapi_Regex *re_handle, const char *subject, time_t time_up )
  * \warning The regex handler should be released by slapi_re_free().
  */
 int slapi_re_subs( Slapi_Regex *re_handle, const char *subject, const char *src, char **dst, unsigned long dstlen );
-/* extension to handle search filters properly */
+/**
+ * Substitutes '&' or '\#' in the param src with the matched string.  If the 'src' is a search filter
+ * do not remove & if it is part of a compound filter.
+ *
+ * \param re_handle The regex handler returned from slapi_re_comp.
+ * \param subject A string checked against the compiled pattern.
+ * \param src A given string which could contain the substitution symbols.
+ * \param dst A pointer pointing to the memory which stores the output string.
+ * \param dstlen Size of the memory dst.
+ * \param filter Set to 1 if the src is a ldap search filter
+ * \return This function returns 1 if the substitution was successful.
+ * \return This function returns 0 if the substitution failed.
+ * \warning The regex handler should be released by slapi_re_free().
+ */
 int slapi_re_subs_ext( Slapi_Regex *re_handle, const char *subject, const char *src, char **dst, unsigned long dstlen, int filter );
 /**
  * Releases the regex handler which was returned from slapi_re_comp.