[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm index.c, 1.13, 1.13.2.1
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv28897/ldap/servers/slapd/back-ldbm
Modified Files:
Tag: Directory_Server_8_0_Branch
index.c
Log Message:
Resolves: 452169
Summary: Crash in indexing code when attribute is missing.
Index: index.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/index.c,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -r1.13 -r1.13.2.1
--- index.c 4 Oct 2007 03:28:19 -0000 1.13
+++ index.c 10 Jul 2008 22:47:10 -0000 1.13.2.1
@@ -652,13 +652,21 @@
* BE_INDEX_EQUALITY flag so the equality index is
* removed.
*/
- slapi_entry_attr_find( olde->ep_entry, mods[i]->mod_type, &curr_attr);
- for (j = 0; mods_valueArray[j] != NULL; j++ ) {
- if ( valuearray_find(curr_attr, evals, mods_valueArray[j]) == -1 ) {
- if (!(flags & BE_INDEX_EQUALITY)) {
- flags |= BE_INDEX_EQUALITY;
+ slapi_entry_attr_find( newe->ep_entry, mods[i]->mod_type, &curr_attr);
+ if (curr_attr) {
+ for (j = 0; mods_valueArray[j] != NULL; j++ ) {
+ if ( valuearray_find(curr_attr, evals, mods_valueArray[j]) == -1 ) {
+ if (!(flags & BE_INDEX_EQUALITY)) {
+ flags |= BE_INDEX_EQUALITY;
+ }
}
}
+ } else {
+ /* If we didn't find the attribute in the new
+ * entry, we should remove the equality index. */
+ if (!(flags & BE_INDEX_EQUALITY)) {
+ flags |= BE_INDEX_EQUALITY;
+ }
}
rc = index_addordel_values_sv( be, basetype,
15 years, 9 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd slapi-plugin.h, 1.19, 1.19.2.1
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv28674/ldap/servers/slapd
Modified Files:
Tag: Directory_Server_8_0_Branch
slapi-plugin.h
Log Message:
Resolves: 454328
Summary: Obey ulimit stack size limit on LP64 systems.
Index: slapi-plugin.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slapi-plugin.h,v
retrieving revision 1.19
retrieving revision 1.19.2.1
diff -u -r1.19 -r1.19.2.1
--- slapi-plugin.h 5 Oct 2007 23:31:07 -0000 1.19
+++ slapi-plugin.h 10 Jul 2008 22:41:37 -0000 1.19.2.1
@@ -172,9 +172,7 @@
#define SLAPD_DEFAULT_THREAD_STACKSIZE 262144L
#elif ( defined ( AIX ))
#define SLAPD_DEFAULT_THREAD_STACKSIZE 262144L
-/* All 64-bit builds get a bigger stack size */
-#elif ( defined ( __LP64__ )) || defined (_LP64)
-#define SLAPD_DEFAULT_THREAD_STACKSIZE 262144L
+/* All other platforms use the default stack size */
#else
#define SLAPD_DEFAULT_THREAD_STACKSIZE 0
#endif
15 years, 9 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd filterentry.c, 1.4.2.2, 1.4.2.3 slapi-private.h, 1.8.2.2, 1.8.2.3 vattr.c, 1.5.2.1, 1.5.2.2
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9966/servers/slapd
Modified Files:
Tag: Directory71RtmBranch
filterentry.c slapi-private.h vattr.c
Log Message:
Related: 448831
Summary: Need to pass pb to vattr_test_filter for fix for bug 448831 to work properly.
Index: filterentry.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/filterentry.c,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -r1.4.2.2 -r1.4.2.3
--- filterentry.c 9 Jul 2008 19:41:45 -0000 1.4.2.2
+++ filterentry.c 10 Jul 2008 19:43:17 -0000 1.4.2.3
@@ -857,7 +857,7 @@
if ( only_check_access || rc != LDAP_SUCCESS ) {
return( rc );
}
- rc = vattr_test_filter( e, f, FILTER_TYPE_AVA, f->f_ava.ava_type );
+ rc = vattr_test_filter( pb, e, f, FILTER_TYPE_AVA, f->f_ava.ava_type );
break;
case LDAP_FILTER_SUBSTRINGS:
@@ -869,7 +869,7 @@
if ( only_check_access || rc != LDAP_SUCCESS ) {
return( rc );
}
- rc = vattr_test_filter( e, f, FILTER_TYPE_SUBSTRING, f->f_sub_type);
+ rc = vattr_test_filter( pb, e, f, FILTER_TYPE_SUBSTRING, f->f_sub_type);
break;
case LDAP_FILTER_GE:
@@ -882,7 +882,7 @@
if ( only_check_access || rc != LDAP_SUCCESS ) {
return( rc );
}
- rc = vattr_test_filter( e, f, FILTER_TYPE_AVA, f->f_ava.ava_type);
+ rc = vattr_test_filter( pb, e, f, FILTER_TYPE_AVA, f->f_ava.ava_type);
break;
case LDAP_FILTER_LE:
@@ -895,7 +895,7 @@
if ( only_check_access || rc != LDAP_SUCCESS ) {
return( rc );
}
- rc = vattr_test_filter( e, f, FILTER_TYPE_AVA, f->f_ava.ava_type);
+ rc = vattr_test_filter( pb, e, f, FILTER_TYPE_AVA, f->f_ava.ava_type);
break;
case LDAP_FILTER_PRESENT:
@@ -907,7 +907,7 @@
if ( only_check_access || rc != LDAP_SUCCESS ) {
return( rc );
}
- rc = vattr_test_filter( e, f, FILTER_TYPE_PRES, f->f_type);
+ rc = vattr_test_filter( pb, e, f, FILTER_TYPE_PRES, f->f_type);
break;
case LDAP_FILTER_APPROX:
@@ -920,7 +920,7 @@
if ( only_check_access || rc != LDAP_SUCCESS ) {
return( rc );
}
- rc = vattr_test_filter( e, f, FILTER_TYPE_AVA, f->f_ava.ava_type);
+ rc = vattr_test_filter( pb, e, f, FILTER_TYPE_AVA, f->f_ava.ava_type);
break;
case LDAP_FILTER_EXTENDED:
Index: slapi-private.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slapi-private.h,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.3
diff -u -r1.8.2.2 -r1.8.2.3
--- slapi-private.h 9 Jul 2008 19:41:45 -0000 1.8.2.2
+++ slapi-private.h 10 Jul 2008 19:43:17 -0000 1.8.2.3
@@ -465,7 +465,8 @@
void slapi_vattrcache_cache_all();
void slapi_vattrcache_cache_none();
-int vattr_test_filter(/* Entry we're interested in */ Slapi_Entry *e,
+int vattr_test_filter( Slapi_PBlock *pb,
+ /* Entry we're interested in */ Slapi_Entry *e,
Slapi_Filter *f,
filter_type_t filter_type,
char *type);
Index: vattr.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/vattr.c,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -u -r1.5.2.1 -r1.5.2.2
--- vattr.c 9 Jul 2008 19:41:45 -0000 1.5.2.1
+++ vattr.c 10 Jul 2008 19:43:17 -0000 1.5.2.2
@@ -383,7 +383,8 @@
* >0 an ldap error code
*
*/
-int vattr_test_filter( /* Entry we're interested in */ Slapi_Entry *e,
+int vattr_test_filter( Slapi_PBlock *pb,
+ /* Entry we're interested in */ Slapi_Entry *e,
Slapi_Filter *f,
filter_type_t filter_type,
char * type) {
15 years, 9 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd entry.c, 1.8.2.2, 1.8.2.3 filterentry.c, 1.4.2.1, 1.4.2.2 getfilelist.c, 1.6, 1.6.2.1 plugin_syntax.c, 1.4, 1.4.2.1 proto-slap.h, 1.10.2.4, 1.10.2.5 regex.c, 1.4.2.1, 1.4.2.2 sasl_map.c, 1.7, 1.7.2.1 slapi-private.h, 1.8.2.1, 1.8.2.2 vattr.c, 1.5, 1.5.2.1
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5023/slapd
Modified Files:
Tag: Directory71RtmBranch
entry.c filterentry.c getfilelist.c plugin_syntax.c
proto-slap.h regex.c sasl_map.c slapi-private.h vattr.c
Log Message:
Resolves: 448831
Summary: Make regex code obey search timelimit.
Index: entry.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/entry.c,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.3
diff -u -r1.8.2.2 -r1.8.2.3
--- entry.c 25 Aug 2005 18:25:08 -0000 1.8.2.2
+++ entry.c 9 Jul 2008 19:41:45 -0000 1.8.2.3
@@ -1855,7 +1855,7 @@
f->f_choice,
&f->f_ava );
} else if ( filter_type == FILTER_TYPE_SUBSTRING) {
- *rc = plugin_call_syntax_filter_sub( tmp_attr,
+ *rc = plugin_call_syntax_filter_sub( NULL, tmp_attr,
&f->f_sub);
} else if ( filter_type == FILTER_TYPE_PRES ) {
/* type is there, that's all we need to know. */
Index: filterentry.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/filterentry.c,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -r1.4.2.1 -r1.4.2.2
--- filterentry.c 16 Jan 2008 01:50:17 -0000 1.4.2.1
+++ filterentry.c 9 Jul 2008 19:41:45 -0000 1.4.2.2
@@ -688,7 +688,7 @@
rc = -1;
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
if ( slapi_attr_type_cmp( f->f_sub_type, a->a_type, SLAPI_TYPE_CMP_SUBTYPE ) == 0 ) {
- rc = plugin_call_syntax_filter_sub( a, &f->f_sub );
+ rc = plugin_call_syntax_filter_sub( pb, a, &f->f_sub );
if ( rc == 0 ) {
break;
}
@@ -721,8 +721,8 @@
rc = -1;
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
if ( slapi_attr_type_cmp( f->f_sub_type, a->a_type, SLAPI_TYPE_CMP_SUBTYPE ) == 0 ) {
- rc = plugin_call_syntax_filter_sub( a, &f->f_sub );
- if ( rc == 0 ) {
+ rc = plugin_call_syntax_filter_sub( pb, a, &f->f_sub );
+ if ( rc == 0 || rc == LDAP_TIMELIMIT_EXCEEDED) {
break;
}
}
Index: getfilelist.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/getfilelist.c,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- getfilelist.c 19 Apr 2005 22:07:36 -0000 1.6
+++ getfilelist.c 9 Jul 2008 19:41:45 -0000 1.6.2.1
@@ -125,7 +125,7 @@
slapd_re_lock();
s = slapd_re_comp((char *)pattern);
if (!s)
- match = slapd_re_exec((char *)filename);
+ match = slapd_re_exec((char *)filename, -1 /* no timelimit */);
slapd_re_unlock();
return match;
Index: plugin_syntax.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/plugin_syntax.c,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- plugin_syntax.c 19 Apr 2005 22:07:36 -0000 1.4
+++ plugin_syntax.c 9 Jul 2008 19:41:45 -0000 1.4.2.1
@@ -206,15 +206,17 @@
int
plugin_call_syntax_filter_sub(
+ Slapi_PBlock *pb,
Slapi_Attr *a,
struct subfilt *fsub
)
{
- return(plugin_call_syntax_filter_sub_sv(a,fsub));
+ return(plugin_call_syntax_filter_sub_sv(pb,a,fsub));
}
int
plugin_call_syntax_filter_sub_sv(
+ Slapi_PBlock *pb,
Slapi_Attr *a,
struct subfilt *fsub
)
@@ -235,6 +237,13 @@
{
Slapi_Value **va= valueset_get_valuearray(&a->a_present_values);
pblock_init( &pipb );
+ if (pb)
+ {
+ Operation *op = NULL;
+ /* to pass SLAPI_SEARCH_TIMELIMIT & SLAPI_OPINITATED_TIME */
+ slapi_pblock_get( pb, SLAPI_OPERATION, &op );
+ slapi_pblock_set( &pipb, SLAPI_OPERATION, op );
+ }
slapi_pblock_set( &pipb, SLAPI_PLUGIN, (void *) a->a_plugin );
rc = a->a_plugin->plg_syntax_filter_sub( &pipb,
fsub->sf_initial, fsub->sf_any, fsub->sf_final, va);
Index: proto-slap.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/proto-slap.h,v
retrieving revision 1.10.2.4
retrieving revision 1.10.2.5
diff -u -r1.10.2.4 -r1.10.2.5
--- proto-slap.h 11 Jan 2008 01:09:14 -0000 1.10.2.4
+++ proto-slap.h 9 Jul 2008 19:41:45 -0000 1.10.2.5
@@ -672,8 +672,8 @@
struct slapdplugin *slapi_get_global_syntax_plugins();
int plugin_call_syntax_filter_ava( const Slapi_Attr *a, int ftype, struct ava *ava );
int plugin_call_syntax_filter_ava_sv( const Slapi_Attr *a, int ftype, struct ava *ava, Slapi_Value **retVal, int useDeletedValues );
-int plugin_call_syntax_filter_sub( Slapi_Attr *a, struct subfilt *fsub );
-int plugin_call_syntax_filter_sub_sv( Slapi_Attr *a, struct subfilt *fsub );
+int plugin_call_syntax_filter_sub( Slapi_PBlock *pb, Slapi_Attr *a, struct subfilt *fsub );
+int plugin_call_syntax_filter_sub_sv( Slapi_PBlock *pb, Slapi_Attr *a, struct subfilt *fsub );
int plugin_call_syntax_get_compare_fn(void *vpi, value_compare_fn_type *compare_fn);
struct slapdplugin *plugin_syntax_find( const char *nameoroid );
void plugin_syntax_enumerate( SyntaxEnumFunc sef, void *arg );
Index: regex.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/regex.c,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -r1.4.2.1 -r1.4.2.2
--- regex.c 30 Apr 2008 20:57:44 -0000 1.4.2.1
+++ regex.c 9 Jul 2008 19:41:45 -0000 1.4.2.2
@@ -61,6 +61,10 @@
* Modification history:
*
* $Log$
+ * Revision 1.4.2.2 2008/07/09 19:41:45 nkinder
+ * Resolves: 448831
+ * Summary: Make regex code obey search timelimit.
+ *
* Revision 1.4.2.1 2008/04/30 20:57:44 nhosoi
* Resolves: #182621
* Summary: Allow larger regex buffer to enable long substring filters
@@ -679,7 +683,7 @@
static UCHAR *bopat[MAXTAG];
static UCHAR *eopat[MAXTAG];
#ifdef NEEDPROTOS
-static UCHAR *pmatch( UCHAR *lp, UCHAR *ap );
+static UCHAR *pmatch( UCHAR *lp, UCHAR *ap, time_t time_up, int *err );
#else /* NEEDPROTOS */
static UCHAR *pmatch();
#endif /* NEEDPROTOS */
@@ -704,14 +708,18 @@
* to the beginning and the end of the matched fragment,
* respectively.
*
+ * return values: 0 -- did not match
+ * 1 -- matched
+ * othersise -- ldap error (TIMELIMIT_EXCEEDED only)
*/
int
-slapd_re_exec( char *lp )
+slapd_re_exec( char *lp, time_t time_up )
{
register UCHAR c;
register UCHAR *ep = 0;
register UCHAR *ap = nfa;
+ int ldaperror = 0;
bol = (UCHAR*)lp;
@@ -729,7 +737,7 @@
switch(*ap) {
case BOL: /* anchored: match from BOL only */
- ep = pmatch((UCHAR*)lp,ap);
+ ep = pmatch((UCHAR*)lp,ap,time_up,&ldaperror);
break;
case CHR: /* ordinary char: locate it fast */
c = *(ap+1);
@@ -739,7 +747,7 @@
return 0;
default: /* regular matching all the way. */
do {
- if ((ep = pmatch((UCHAR*)lp,ap)))
+ if ((ep = pmatch((UCHAR*)lp,ap,time_up,&ldaperror)))
break;
lp++;
} while (*lp);
@@ -748,6 +756,8 @@
case END: /* munged automaton. fail always */
return 0;
}
+ if (ldaperror)
+ return ldaperror;
if (!ep)
return 0;
@@ -828,13 +838,19 @@
#define CCLSKIP 18 /* [CLO] CCL 16bytes END ... */
static UCHAR *
-pmatch( UCHAR *lp, UCHAR *ap)
+pmatch( UCHAR *lp, UCHAR *ap, time_t time_up, int *err )
{
register int op, c, n;
register UCHAR *e; /* extra pointer for CLO */
register UCHAR *bp; /* beginning of subpat.. */
register UCHAR *ep; /* ending of subpat.. */
UCHAR *are; /* to save the line ptr. */
+ time_t curtime = current_time();
+
+ if ( time_up != -1 && curtime > time_up ) {
+ *err = LDAP_TIMELIMIT_EXCEEDED;
+ return 0;
+ }
while ((op = *ap++) != END)
switch(op) {
@@ -911,7 +927,7 @@
ap += n;
while (lp >= are) {
- if ((e = pmatch(lp, ap)) != NULL)
+ if ((e = pmatch(lp, ap, time_up, err)) != NULL)
return e;
--lp;
}
Index: sasl_map.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/sasl_map.c,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- sasl_map.c 25 Apr 2005 20:38:29 -0000 1.7
+++ sasl_map.c 9 Jul 2008 19:41:45 -0000 1.7.2.1
@@ -429,9 +429,10 @@
recomp_result = slapd_re_comp(dp->regular_expression);
if (recomp_result) {
LDAPDebug( LDAP_DEBUG_ANY, "sasl_map_check : re_comp failed for expression (%s)\n", dp->regular_expression, 0, 0 );
+ } else {
+ matched = slapd_re_exec(sasl_user_and_realm, -1 /* no timelimit */);
+ LDAPDebug( LDAP_DEBUG_TRACE, "regex: %s, id: %s, %s\n", dp->regular_expression, sasl_user_and_realm, matched ? "matched" : "didn't match" );
}
- matched = slapd_re_exec(sasl_user_and_realm);
- LDAPDebug( LDAP_DEBUG_TRACE, "regex: %s, id: %s, %s\n", dp->regular_expression, sasl_user_and_realm, matched ? "matched" : "didn't match" );
if (matched) {
if (matched == 1) {
/* Allocate buffers for the returned strings */
Index: slapi-private.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/slapi-private.h,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -u -r1.8.2.1 -r1.8.2.2
--- slapi-private.h 26 Aug 2005 15:44:35 -0000 1.8.2.1
+++ slapi-private.h 9 Jul 2008 19:41:45 -0000 1.8.2.2
@@ -1159,7 +1159,7 @@
void bervalarray_add_berval_fast(struct berval ***vals, const struct berval *addval, int nvals, int *maxvals);
-int slapd_re_exec( char *lp );
+int slapd_re_exec( char *lp, time_t time_up );
char *slapd_re_comp( char *pat );
int slapd_re_subs( char *src, char* dst );
void slapd_re_lock( void );
Index: vattr.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/vattr.c,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- vattr.c 19 Apr 2005 22:07:37 -0000 1.5
+++ vattr.c 9 Jul 2008 19:41:45 -0000 1.5.2.1
@@ -510,7 +510,7 @@
rc = plugin_call_syntax_filter_ava( a,
f->f_choice, &f->f_ava );
} else if ( filter_type == FILTER_TYPE_SUBSTRING) {
- rc = plugin_call_syntax_filter_sub( a,
+ rc = plugin_call_syntax_filter_sub( pb, a,
&f->f_sub);
}
@@ -582,7 +582,7 @@
} else if ( filter_type == FILTER_TYPE_SUBSTRING ) {
- rc = test_substring_filter( NULL, e, f, 0 /* no access check */,
+ rc = test_substring_filter( pb, e, f, 0 /* no access check */,
0 /* do test filter */, &acl_test_done);
} else if ( filter_type == FILTER_TYPE_PRES ) {
15 years, 9 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm ldbm_search.c, 1.6.2.2, 1.6.2.3
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5023/slapd/back-ldbm
Modified Files:
Tag: Directory71RtmBranch
ldbm_search.c
Log Message:
Resolves: 448831
Summary: Make regex code obey search timelimit.
Index: ldbm_search.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/ldbm_search.c,v
retrieving revision 1.6.2.2
retrieving revision 1.6.2.3
diff -u -r1.6.2.2 -r1.6.2.3
--- ldbm_search.c 11 Jan 2008 19:20:24 -0000 1.6.2.2
+++ ldbm_search.c 9 Jul 2008 19:41:46 -0000 1.6.2.3
@@ -1303,6 +1303,10 @@
{
/* Failed the filter test, and this isn't a VLV Search */
cache_return( &inst->inst_cache, &(sr->sr_entry) );
+ if (LDAP_TIMELIMIT_EXCEEDED == filter_test) {
+ slapi_send_ldap_result( pb, LDAP_TIMELIMIT_EXCEEDED, NULL, NULL, nentries, urls );
+ return -1;
+ }
}
}
}
15 years, 9 months
[Fedora-directory-commits] ldapserver/ldap/servers/plugins/syntaxes string.c, 1.5.2.1, 1.5.2.2
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/syntaxes
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5023/plugins/syntaxes
Modified Files:
Tag: Directory71RtmBranch
string.c
Log Message:
Resolves: 448831
Summary: Make regex code obey search timelimit.
Index: string.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/syntaxes/string.c,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -u -r1.5.2.1 -r1.5.2.2
--- string.c 30 Apr 2008 20:57:44 -0000 1.5.2.1
+++ string.c 9 Jul 2008 19:41:45 -0000 1.5.2.2
@@ -189,9 +189,20 @@
char pat[BUFSIZ];
char buf[BUFSIZ];
char ebuf[BUFSIZ];
+ time_t curtime = 0;
+ time_t time_up = 0;
+ time_t optime = 0; /* time op was initiated */
+ int timelimit = 0; /* search timelimit */
LDAPDebug( LDAP_DEBUG_FILTER, "=> string_filter_sub\n",
0, 0, 0 );
+ slapi_pblock_get( pb, SLAPI_SEARCH_TIMELIMIT, &timelimit );
+ slapi_pblock_get( pb, SLAPI_OPINITIATED_TIME, &optime );
+ /*
+ * (timelimit==-1) means no time limit
+ */
+ time_up = ( timelimit==-1 ? -1 : optime + timelimit);
+
/*
* construct a regular expression corresponding to the
* filter and let regex do the work for each value
@@ -253,18 +264,21 @@
p = (bigpat) ? bigpat : pat;
slapd_re_lock();
if ( (tmpbuf = slapd_re_comp( p )) != 0 ) {
- LDAPDebug( LDAP_DEBUG_ANY, "re_comp (%s) failed (%s)\n",
- pat, p, 0 );
- slapd_re_unlock();
- if( bigpat != NULL ) {
- slapi_ch_free((void**)&bigpat );
- }
- return( LDAP_OPERATIONS_ERROR );
+ LDAPDebug( LDAP_DEBUG_ANY, "re_comp (%s) failed (%s): %s\n",
+ pat, p, tmpbuf );
+ rc = LDAP_OPERATIONS_ERROR;
+ goto bailout;
} else {
LDAPDebug( LDAP_DEBUG_TRACE, "re_comp (%s)\n",
escape_string( p, ebuf ), 0, 0 );
}
+ curtime = current_time();
+ if ( time_up != -1 && curtime > time_up ) {
+ rc = LDAP_TIMELIMIT_EXCEEDED;
+ goto bailout;
+ }
+
/*
* test the regex against each value
*/
@@ -290,22 +304,22 @@
}
value_normalize( realval, syntax, 1 /* trim leading blanks */ );
- tmprc = slapd_re_exec( realval );
+ tmprc = slapd_re_exec( realval, time_up );
LDAPDebug( LDAP_DEBUG_TRACE, "re_exec (%s) %i\n",
escape_string( realval, ebuf ), tmprc, 0 );
- if ( tmprc != 0 ) {
+ if ( tmprc == 1 ) {
rc = 0;
break;
+ } else if ( tmprc != 0 ) {
+ rc = tmprc;
+ break;
}
}
+bailout:
slapd_re_unlock();
- if ( tmpbuf != NULL ) {
- slapi_ch_free((void**)&tmpbuf );
- }
- if( bigpat != NULL ) {
- slapi_ch_free((void**)&bigpat );
- }
+ slapi_ch_free((void**)&tmpbuf ); /* NULL is fine */
+ slapi_ch_free((void**)&bigpat ); /* NULL is fine */
LDAPDebug( LDAP_DEBUG_FILTER, "<= string_filter_sub %d\n",
rc, 0, 0 );
15 years, 9 months
[Fedora-directory-commits] ldapserver/ldap/servers/plugins/acl acl.c, 1.6.2.1, 1.6.2.2
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/acl
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5023/plugins/acl
Modified Files:
Tag: Directory71RtmBranch
acl.c
Log Message:
Resolves: 448831
Summary: Make regex code obey search timelimit.
Index: acl.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/acl/acl.c,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -u -r1.6.2.1 -r1.6.2.2
--- acl.c 11 Jan 2008 20:52:46 -0000 1.6.2.1
+++ acl.c 9 Jul 2008 19:41:44 -0000 1.6.2.2
@@ -3255,7 +3255,7 @@
** matching, it seems that step() is leaking 1036 bytes/search
** I couldn't figure out why it's leaking.
*/
- rc = slapd_re_exec( realval );
+ rc = slapd_re_exec( realval, -1 /* no timelimit */ );
slapd_re_unlock();
15 years, 9 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd csngen.c, 1.5, 1.5.2.1
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv14717/ldap/servers/slapd
Modified Files:
Tag: Directory71RtmBranch
csngen.c
Log Message:
Resolves: 233642
Summary: MMR breaks with time skew errors
Index: csngen.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/csngen.c,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- csngen.c 19 Apr 2005 22:07:36 -0000 1.5
+++ csngen.c 9 Jul 2008 17:50:34 -0000 1.5.2.1
@@ -55,6 +55,9 @@
#define STATE_FORMAT "%8x%8x%8x%4hx%4hx"
#define STATE_LENGTH 32
#define MAX_VAL(x,y) ((x)>(y)?(x):(y))
+#define CSN_CALC_TSTAMP(gen) ((gen)->state.sampled_time + \
+ (gen)->state.local_offset + \
+ (gen)->state.remote_offset)
/*
* **************************************************************************
@@ -268,8 +271,7 @@
gen->state.seq_num = 0;
}
- (*csn)->tstamp = gen->state.sampled_time + gen->state.local_offset +
- gen->state.remote_offset;
+ (*csn)->tstamp = CSN_CALC_TSTAMP(gen);
(*csn)->seqnum = gen->state.seq_num ++;
(*csn)->rid = gen->state.rid;
(*csn)->subseqnum = 0;
@@ -303,8 +305,9 @@
of time so that it does not generate smaller csns */
int csngen_adjust_time (CSNGen *gen, const CSN* csn)
{
- time_t remote_time, remote_offset;
+ time_t remote_time, remote_offset, cur_time;
PRUint16 remote_seqnum;
+ int rc;
if (gen == NULL || csn == NULL)
return CSN_INVALID_PARAMETER;
@@ -314,21 +317,38 @@
PR_RWLock_Wlock (gen->lock);
- if (remote_seqnum > gen->state.seq_num )
- {
- if (remote_seqnum < CSN_MAX_SEQNUM)
- {
- gen->state.seq_num = remote_seqnum + 1;
- }
- else
- {
- remote_time++;
- }
- }
+ /* make sure we have the current time */
+ csngen_update_time();
+ cur_time = g_sampled_time;
+
+ /* make sure sampled_time is current */
+ /* must only call adjust_local_time if the current time is greater than
+ the generator state time */
+ if ((cur_time > gen->state.sampled_time) &&
+ (CSN_SUCCESS != (rc = _csngen_adjust_local_time(gen, cur_time))))
+ {
+ /* _csngen_adjust_local_time will log error */
+ PR_RWLock_Unlock (gen->lock);
+ csngen_dump_state(gen);
+ return rc;
+ }
- if (remote_time >= gen->state.sampled_time)
+ cur_time = CSN_CALC_TSTAMP(gen);
+ if (remote_time >= cur_time)
{
- remote_offset = remote_time - gen->state.sampled_time;
+ if (remote_seqnum > gen->state.seq_num )
+ {
+ if (remote_seqnum < CSN_MAX_SEQNUM)
+ {
+ gen->state.seq_num = remote_seqnum + 1;
+ }
+ else
+ {
+ remote_time++;
+ }
+ }
+
+ remote_offset = remote_time - cur_time;
if (remote_offset > gen->state.remote_offset)
{
if (remote_offset <= CSN_MAX_TIME_ADJUST)
@@ -341,10 +361,18 @@
"adjustment limit exceeded; value - %d, limit - %d\n",
remote_offset, CSN_MAX_TIME_ADJUST);
PR_RWLock_Unlock (gen->lock);
+ csngen_dump_state(gen);
return CSN_LIMIT_EXCEEDED;
}
}
- }
+ }
+ else if (gen->state.remote_offset > 0)
+ {
+ /* decrease remote offset? */
+ /* how to decrease remote offset but ensure that we don't
+ generate a duplicate CSN, or a CSN smaller than one we've already
+ generated? */
+ }
PR_RWLock_Unlock (gen->lock);
@@ -571,7 +599,14 @@
{
time_t time_diff = cur_time - gen->state.sampled_time;
- if (time_diff > 0)
+ if (time_diff == 0) {
+ /* This is a no op - _csngen_adjust_local_time should never be called
+ in this case, because there is nothing to adjust - but just return
+ here to protect ourselves
+ */
+ return CSN_SUCCESS;
+ }
+ else if (time_diff > 0)
{
gen->state.sampled_time = cur_time;
if (time_diff > gen->state.local_offset)
@@ -583,7 +618,7 @@
return CSN_SUCCESS;
}
- else /* time was turend back */
+ else /* time was turned back */
{
if (abs (time_diff) > CSN_MAX_TIME_ADJUST)
{
15 years, 9 months
[Fedora-directory-commits] ldapserver/ldap/servers/plugins/replication repl5.h, 1.8, 1.8.2.1 repl5_inc_protocol.c, 1.8.2.1, 1.8.2.2 repl5_replica.c, 1.11, 1.11.2.1 repl_extop.c, 1.7.2.1, 1.7.2.2 windows_inc_protocol.c, 1.11, 1.11.2.1
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/replication
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv14717/ldap/servers/plugins/replication
Modified Files:
Tag: Directory71RtmBranch
repl5.h repl5_inc_protocol.c repl5_replica.c repl_extop.c
windows_inc_protocol.c
Log Message:
Resolves: 233642
Summary: MMR breaks with time skew errors
Index: repl5.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5.h,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- repl5.h 6 May 2005 03:35:52 -0000 1.8
+++ repl5.h 9 Jul 2008 17:50:33 -0000 1.8.2.1
@@ -477,6 +477,7 @@
void replica_get_referrals(const Replica *r, char ***referrals);
void replica_set_referrals(Replica *r,const Slapi_ValueSet *vs);
int replica_update_csngen_state (Replica *r, const RUV *ruv);
+int replica_update_csngen_state_ext (Replica *r, const RUV *ruv, const CSN *extracsn);
CSN *replica_get_purge_csn(const Replica *r);
int replica_log_ruv_elements (const Replica *r);
void replica_enumerate_replicas (FNEnumReplica fn, void *arg);
Index: repl5_inc_protocol.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_inc_protocol.c,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -u -r1.8.2.1 -r1.8.2.2
--- repl5_inc_protocol.c 9 Jul 2008 17:27:18 -0000 1.8.2.1
+++ repl5_inc_protocol.c 9 Jul 2008 17:50:33 -0000 1.8.2.2
@@ -1099,13 +1099,20 @@
rc = replica_update_csngen_state (replica, ruv);
object_release (prp->replica_object);
replica = NULL;
- if (rc != 0) /* too much skew */
+ if (rc == CSN_LIMIT_EXCEEDED) /* too much skew */
{
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
"%s: Incremental protocol: fatal error - too much time skew between replicas!\n",
agmt_get_long_name(prp->agmt));
next_state = STATE_STOP_FATAL_ERROR;
}
+ else if (rc != 0) /* internal error */
+ {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "%s: Incremental protocol: fatal internal error updating the CSN generator!\n",
+ agmt_get_long_name(prp->agmt));
+ next_state = STATE_STOP_FATAL_ERROR;
+ }
else
{
rc = send_updates(prp, ruv, &num_changes_sent);
Index: repl5_replica.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_replica.c,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- repl5_replica.c 19 Apr 2005 22:07:32 -0000 1.11
+++ repl5_replica.c 9 Jul 2008 17:50:33 -0000 1.11.2.1
@@ -1038,7 +1038,7 @@
}
int
-replica_update_csngen_state (Replica *r, const RUV *ruv)
+replica_update_csngen_state_ext (Replica *r, const RUV *ruv, const CSN *extracsn)
{
int rc = 0;
CSNGen *gen;
@@ -1052,34 +1052,42 @@
return -1;
}
- if (csn == NULL) /* ruv contains no csn - we are done */
+ if ((csn == NULL) && (extracsn == NULL)) /* ruv contains no csn and no extra - we are done */
{
return 0;
}
+ if (csn_compare(extracsn, csn) > 0) /* extracsn > csn */
+ {
+ csn_free (&csn); /* free */
+ csn = (CSN*)extracsn; /* use this csn to do the update */
+ }
+
PR_Lock(r->repl_lock);
gen = (CSNGen *)object_get_data (r->repl_csngen);
PR_ASSERT (gen);
rc = csngen_adjust_time (gen, csn);
- if (rc != CSN_SUCCESS)
- {
- rc = -1;
- goto done;
- }
-
- rc = 0;
+ /* rc will be either CSN_SUCCESS (0) or clock skew */
done:
PR_Unlock(r->repl_lock);
- if (csn)
+ if (csn != extracsn) /* do not free the given csn */
+ {
csn_free (&csn);
+ }
return rc;
}
+int
+replica_update_csngen_state (Replica *r, const RUV *ruv)
+{
+ return replica_update_csngen_state_ext(r, ruv, NULL);
+}
+
/*
* dumps replica state for debugging purpose
*/
Index: repl_extop.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl_extop.c,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -u -r1.7.2.1 -r1.7.2.2
--- repl_extop.c 2 Mar 2006 01:11:55 -0000 1.7.2.1
+++ repl_extop.c 9 Jul 2008 17:50:33 -0000 1.7.2.2
@@ -546,7 +546,6 @@
Replica *replica = NULL;
void *conn;
consumer_connection_extension *connext = NULL;
- CSN *mycsn = NULL;
char *replicacsnstr = NULL;
CSN *replicacsn = NULL;
int zero = 0;
@@ -699,55 +698,37 @@
gen = object_get_data(gen_obj);
if (NULL != gen)
{
- if (csngen_new_csn(gen, &mycsn, PR_FALSE /* notify */) == CSN_SUCCESS)
+ replicacsn = csn_new_by_string(replicacsnstr);
+ if (NULL != replicacsn)
{
- replicacsn = csn_new_by_string(replicacsnstr);
- if (NULL != replicacsn)
+ /* ONREPL - we used to manage clock skew here. However, csn generator
+ code already does it. The csngen also manages local skew caused by
+ system clock reset, so to keep it consistent, I removed code from here */
+ /* update the state of the csn generator */
+ rc = replica_update_csngen_state_ext (replica, supplier_ruv, replicacsn); /* too much skew */
+ if (rc == CSN_LIMIT_EXCEEDED)
{
- /* ONREPL - we used to manage clock skew here. However, csn generator
- code already does it. The csngen also manages local skew caused by
- system clock reset, so to keep it consistent, I removed code from here */
- time_t diff = 0L;
- diff = csn_time_difference(mycsn, replicacsn);
- if (diff > 0)
- {
- /* update the state of the csn generator */
- rc = csngen_adjust_time (gen, replicacsn);
- if (rc == CSN_LIMIT_EXCEEDED) /* too much skew */
- {
- response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
- goto send_response;
- }
- }
- else if (diff <= 0)
- {
- /* Supplier's clock is behind ours */
- /* XXXggood check if CSN smaller than purge point */
- /* response = NSDS50_REPL_BELOW_PURGEPOINT; */
- /* goto send_response; */
- }
+ response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "conn=%d op=%d repl=\"%s\": "
+ "Excessive clock skew from supplier RUV\n",
+ connid, opid, repl_root);
+ goto send_response;
}
- else
+ else if (rc != 0)
{
- /* Oops, csnstr couldn't be converted */
+ /* Oops, problem csn or ruv format, or memory, or .... */
response = NSDS50_REPL_INTERNAL_ERROR;
goto send_response;
}
+
}
else
{
- /* Oops, csn generator failed */
+ /* Oops, csnstr couldn't be converted */
response = NSDS50_REPL_INTERNAL_ERROR;
goto send_response;
}
-
- /* update csn generator's state from the supplier's ruv */
- rc = replica_update_csngen_state (replica, supplier_ruv); /* too much skew */
- if (rc != 0)
- {
- response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
- goto send_response;
- }
}
else
{
@@ -984,11 +965,6 @@
{
object_release(gen_obj);
}
- /* mycsn */
- if (NULL != mycsn)
- {
- csn_free(&mycsn);
- }
/* replicacsn */
if (NULL != replicacsn)
{
Index: windows_inc_protocol.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/windows_inc_protocol.c,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- windows_inc_protocol.c 6 May 2005 03:33:36 -0000 1.11
+++ windows_inc_protocol.c 9 Jul 2008 17:50:33 -0000 1.11.2.1
@@ -795,13 +795,20 @@
rc = replica_update_csngen_state (replica, ruv);
object_release (prp->replica_object);
replica = NULL;
- if (rc != 0) /* too much skew */
+ if (rc == CSN_LIMIT_EXCEEDED) /* too much skew */
{
- slapi_log_error(SLAPI_LOG_FATAL, windows_repl_plugin_name,
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
"%s: Incremental protocol: fatal error - too much time skew between replicas!\n",
agmt_get_long_name(prp->agmt));
next_state = STATE_STOP_FATAL_ERROR;
}
+ else if (rc != 0) /* internal error */
+ {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "%s: Incremental protocol: fatal internal error updating the CSN generator!\n",
+ agmt_get_long_name(prp->agmt));
+ next_state = STATE_STOP_FATAL_ERROR;
+ }
else
{
rc = send_updates(prp, ruv, &num_changes_sent);
15 years, 9 months
[Fedora-directory-commits] ldapserver/ldap/servers/plugins/replication repl5_inc_protocol.c, 1.8, 1.8.2.1
by Doctor Conrad
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/replication
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12621/plugins/replication
Modified Files:
Tag: Directory71RtmBranch
repl5_inc_protocol.c
Log Message:
Resolves: 450973
Summary: Don't immediately exit in repl async thread when the consumer encounters an error.
Index: repl5_inc_protocol.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_inc_protocol.c,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- repl5_inc_protocol.c 4 May 2005 23:58:51 -0000 1.8
+++ repl5_inc_protocol.c 9 Jul 2008 17:27:18 -0000 1.8.2.1
@@ -288,6 +288,7 @@
while (!finished)
{
conres = conn_read_result_ex(conn, NULL, NULL, NULL, &message_id, 0);
+ slapi_log_error(SLAPI_LOG_REPL, NULL, "repl5_inc_result_threadmain: read result for message_id %d\n", message_id);
/* Timeout here means that we didn't block, not a real timeout */
if (CONN_TIMEOUT == conres)
{
@@ -322,6 +323,7 @@
}
if (conres != CONN_TIMEOUT)
{
+ int should_finish = 0;
if (message_id)
{
rd->last_message_id_received = message_id;
@@ -338,16 +340,18 @@
}
conn_get_error_ex(conn, &operation_code, &connection_error, &ldap_error_string);
- slapi_log_error(SLAPI_LOG_REPL, NULL, "repl5_inc_result_threadmain: result %d, %d, %d, %s\n", operation_code,connection_error,conres,ldap_error_string);
- rd->result = repl5_inc_update_from_op_result(rd->prp, conres, connection_error, csn_str, uniqueid, replica_id, &finished, &(rd->num_changes_sent));
- if (rd->result)
+ slapi_log_error(SLAPI_LOG_REPL, NULL, "repl5_inc_result_threadmain: result %d, %d, %d, %d, %s\n", operation_code,connection_error,conres,message_id,ldap_error_string);
+ rd->result = repl5_inc_update_from_op_result(rd->prp, conres, connection_error, csn_str, uniqueid, replica_id, &should_finish, &(rd->num_changes_sent));
+ if (rd->result || should_finish)
{
- slapi_log_error(SLAPI_LOG_REPL, NULL, "repl5_inc_result_threadmain: got op result %d\n", rd->result);
+ slapi_log_error(SLAPI_LOG_REPL, NULL, "repl5_inc_result_threadmain: got op result %d should finish %d\n", rd->result, should_finish);
/* If so then we need to take steps to abort the update process */
PR_Lock(rd->lock);
rd->abort = 1;
PR_Unlock(rd->lock);
/* We also need to log the error, including details stored from when the operation was sent */
+ /* we cannot finish yet - we still need to waitfor the pending results, then
+ * the main repl code will shut down this thread */
}
}
/* Should we stop ? */
15 years, 9 months