[Fedora-directory-commits] ldapserver/ldap/servers/slapd pblock.c, 1.14, 1.15 plugin_syntax.c, 1.6, 1.7 schema.c, 1.15, 1.16 slap.h, 1.34, 1.35 slapi-plugin.h, 1.25, 1.26

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Tue Jul 15 16:49:45 UTC 2008


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2672/ldap/servers/slapd

Modified Files:
	pblock.c plugin_syntax.c schema.c slap.h slapi-plugin.h 
Log Message:
Resolves: #447353
Summary: RFE: search optimization and single character substring searches
Description: extended the substring key to have 3 types:
* begin (e.g., *^a)
* middle (e.g., *abc)
* end (e.g., *xy$)
* Usage: turn an index object to extensibleobject and set an integer value as
follows:
* dn: cn=sn, cn=index, cn=userRoot, cn=ldbm database, cn=plugins, cn=config
* objectClass: extensibleObject
* nsSubStrBegin: 2
* nsSubStrMiddle: 3
* nsSubStrEnd: 2
* [...]



Index: pblock.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/pblock.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- pblock.c	27 Jun 2008 19:28:21 -0000	1.14
+++ pblock.c	15 Jul 2008 16:49:42 -0000	1.15
@@ -1059,6 +1059,9 @@
 		}
 		(*(IFP *)value) = pblock->pb_plugin->plg_syntax_compare;
 		break;
+	case SLAPI_SYNTAX_SUBSTRLENS:
+		(*(int **)value) = pblock->pb_substrlens;
+		break;
 
 	/* controls we know about */
 	case SLAPI_MANAGEDSAIT:
@@ -2298,12 +2301,15 @@
 		}
 		pblock->pb_plugin->plg_syntax_compare = (IFP) value;
 		break;
-        case SLAPI_ENTRY_PRE_OP:
-                pblock->pb_pre_op_entry = (Slapi_Entry *) value;
-                break;
-        case SLAPI_ENTRY_POST_OP:
-                pblock->pb_post_op_entry = (Slapi_Entry *) value;
-                break;
+	case SLAPI_SYNTAX_SUBSTRLENS:
+		pblock->pb_substrlens = (int *) value;
+		break;
+	case SLAPI_ENTRY_PRE_OP:
+		pblock->pb_pre_op_entry = (Slapi_Entry *) value;
+		break;
+	case SLAPI_ENTRY_POST_OP:
+		pblock->pb_post_op_entry = (Slapi_Entry *) value;
+		break;
 
 	/* target address for all operations */
 	case SLAPI_TARGET_ADDRESS:


Index: plugin_syntax.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/plugin_syntax.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- plugin_syntax.c	30 Jun 2008 17:28:16 -0000	1.6
+++ plugin_syntax.c	15 Jul 2008 16:49:42 -0000	1.7
@@ -309,6 +309,38 @@
 	return( rc );
 }
 
+/*
+ * almost identical to slapi_call_syntax_values2keys_sv except accepting 
+ * pblock to pass some info such as substrlen.
+ */
+int
+slapi_call_syntax_values2keys_sv_pb(
+    void			*vpi,
+    Slapi_Value		**vals,
+    Slapi_Value		***ivals,
+    int				ftype,
+	Slapi_PBlock	*pb
+)
+{
+	int					rc;
+	struct slapdplugin	*pi = vpi;
+
+	LDAPDebug( LDAP_DEBUG_FILTER, "=> slapi_call_syntax_values2keys\n",
+	    0, 0, 0 );
+
+	slapi_pblock_set( pb, SLAPI_PLUGIN, vpi );
+
+	*ivals = NULL;
+	rc = -1;	/* means no values2keys function */
+	if ( pi != NULL && pi->plg_syntax_values2keys != NULL ) {
+		rc = pi->plg_syntax_values2keys( pb, vals, ivals, ftype );
+	}
+
+	LDAPDebug( LDAP_DEBUG_FILTER,
+	    "<= slapi_call_syntax_values2keys %d\n", rc, 0, 0 );
+	return( rc );
+}
+
 SLAPI_DEPRECATED int
 slapi_call_syntax_assertion2keys_ava( /* JCM SLOW FUNCTION */
     void		*vpi,


Index: schema.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/schema.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- schema.c	27 Jun 2008 19:28:21 -0000	1.15
+++ schema.c	15 Jul 2008 16:49:42 -0000	1.16
@@ -456,7 +456,7 @@
   int i, oc_count = 0;
   int unknown_class = 0;
   char errtext[ BUFSIZ ];
-  PRUint32 schema_flags;
+  PRUint32 schema_flags = 0;
 
   /* smart referrals are not allowed in Directory Lite */
   if ( config_is_slapd_lite() ) {


Index: slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slap.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- slap.h	6 Jun 2008 17:53:35 -0000	1.34
+++ slap.h	15 Jul 2008 16:49:42 -0000	1.35
@@ -1444,8 +1444,18 @@
 	/* For password policy control */
 	int		pb_pwpolicy_ctrl;
 	void	*pb_vattr_context;      /* hold the vattr_context for roles/cos */
+
+	int		*pb_substrlens; /* user specified minimum substr search key lengths:
+							 * nsSubStrBegin, nsSubStrMiddle, nsSubStrEnd
+							 */
 } slapi_pblock;
 
+/* index if substrlens */
+#define INDEX_SUBSTRBEGIN	0
+#define INDEX_SUBSTRMIDDLE	1
+#define INDEX_SUBSTREND		2
+#define INDEX_SUBSTRLEN		3	/* size of the substrlens */
+
 /* The referral element */
 typedef struct ref {
      char          *ref_dn;       /* The DN of the entry that contains the referral */


Index: slapi-plugin.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slapi-plugin.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- slapi-plugin.h	8 Jul 2008 19:59:39 -0000	1.25
+++ slapi-plugin.h	15 Jul 2008 16:49:42 -0000	1.26
@@ -891,6 +891,8 @@
  */
 int slapi_call_syntax_values2keys_sv( void *vpi, Slapi_Value **vals,
 	Slapi_Value ***ivals, int ftype );
+int slapi_call_syntax_values2keys_sv_pb( void *vpi, Slapi_Value **vals,
+	Slapi_Value ***ivals, int ftype, Slapi_PBlock *pb );
 int slapi_call_syntax_assertion2keys_ava_sv( void *vpi, Slapi_Value *val,
 	Slapi_Value ***ivals, int ftype );
 int slapi_call_syntax_assertion2keys_sub_sv( void *vpi, char *initial,
@@ -1582,6 +1584,9 @@
 #define SLAPI_PLUGIN_SYNTAX_FLAGS		707
 #define SLAPI_PLUGIN_SYNTAX_COMPARE		708
 
+/* user defined substrlen; not stored in slapdplugin, but pblock itself */
+#define SLAPI_SYNTAX_SUBSTRLENS	709
+
 /* ACL plugin functions and arguments */
 #define SLAPI_PLUGIN_ACL_INIT			730
 #define SLAPI_PLUGIN_ACL_SYNTAX_CHECK		731




More information about the Fedora-directory-commits mailing list