*/
#include "portable.h"
-#include "slapi_common.h"
#include <stdio.h>
#include "ldap_pvt.h"
#include "lutil.h"
#include "slap.h"
-#include "slapi.h"
#ifdef LDAP_SLAPI
+#include "slapi.h"
static char **anlist2charray( AttributeName *an );
static Slapi_PBlock *initSearchPlugin( Backend *be, Connection *conn, Operation *op,
struct berval *base, int scope, int deref, int sizelimit, int timelimit,
int attrsonly, int managedsait );
static int doPreSearchPluginFNs( Backend *be, Slapi_PBlock *pb );
static int doSearchRewriteFNs( Backend *be, Slapi_PBlock *pb, Filter **filter, struct berval *fstr );
-static int doPostSearchPluginFNs( Backend *be, Slapi_PBlock *pb );
+static void doPostSearchPluginFNs( Backend *be, Slapi_PBlock *pb );
#endif /* LDAPI_SLAPI */
int
if ( StatslogTest( LDAP_DEBUG_STATS ) ) {
char abuf[BUFSIZ/2], *ptr = abuf;
- int len = 0;
+ int len = 0, alen;
Statslog( LDAP_DEBUG_STATS,
"conn=%lu op=%lu SRCH base=\"%s\" scope=%d filter=\"%s\"\n",
op->o_connid, op->o_opid, pbase.bv_val, scope, fstr.bv_val );
for ( i = 0; i<siz; i++ ) {
- if (len + 1 + an[i].an_name.bv_len > sizeof(abuf)) {
+ alen = an[i].an_name.bv_len;
+ if (alen >= sizeof(abuf)) {
+ alen = sizeof(abuf)-1;
+ }
+ if (len && (len + 1 + alen >= sizeof(abuf))) {
Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu SRCH attr=%s\n",
op->o_connid, op->o_opid, abuf, 0, 0 );
len = 0;
*ptr++ = ' ';
len++;
}
- ptr = lutil_strcopy(ptr, an[i].an_name.bv_val);
- len += an[i].an_name.bv_len;
+ ptr = lutil_strncopy(ptr, an[i].an_name.bv_val, alen);
+ len += alen;
+ *ptr = '\0';
}
if (len) {
Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu SRCH attr=%s\n",
goto return_results;
}
- /* deref the base if needed */
- suffix_alias( be, &nbase );
-
#ifdef LDAP_SLAPI
attrs = anlist2charray( an );
pb = initSearchPlugin( be, conn, op, &pbase,
#endif /* LDAP_SLAPI */
return_results:;
+
#ifdef LDAP_CLIENT_UPDATE
- if ( !( op->o_clientupdate_type & SLAP_LCUP_PERSIST ) )
-#endif /* LDAP_CLIENT_UPDATE */
- {
- if( pbase.bv_val != NULL) free( pbase.bv_val );
- if( nbase.bv_val != NULL) free( nbase.bv_val );
+ if ( ( op->o_clientupdate_type & SLAP_LCUP_PERSIST ) )
+ return rc;
+#endif
+#if defined(LDAP_CLIENT_UPDATE) && defined(LDAP_SYNC)
+ else
+#endif
+#ifdef LDAP_SYNC
+ if ( ( op->o_sync_mode & SLAP_SYNC_PERSIST ) )
+ return rc;
+#endif
+
+ if( pbase.bv_val != NULL) free( pbase.bv_val );
+ if( nbase.bv_val != NULL) free( nbase.bv_val );
- if( fstr.bv_val != NULL) free( fstr.bv_val );
- if( filter != NULL) filter_free( filter );
- if( an != NULL ) free( an );
+ if( fstr.bv_val != NULL) free( fstr.bv_val );
+ if( filter != NULL) filter_free( filter );
+ if( an != NULL ) free( an );
#ifdef LDAP_SLAPI
- if( attrs != NULL) ch_free( attrs );
+ if( attrs != NULL) ch_free( attrs );
#endif /* LDAP_SLAPI */
- }
return rc;
}
return LDAP_SUCCESS;
}
-static int doPostSearchPluginFNs( Backend *be, Slapi_PBlock *pb )
+static void doPostSearchPluginFNs( Backend *be, Slapi_PBlock *pb )
{
if ( doPluginFNs( be, SLAPI_PLUGIN_POST_SEARCH_FN, pb ) != 0 ) {
#ifdef NEW_LOGGING
"failed.\n", 0, 0, 0);
#endif
}
-
- return LDAP_SUCCESS;
}
void dummy(void)