use an "unknown" listener name/url when faking connections

This commit is contained in:
Pierangelo Masarati 2003-03-11 18:25:51 +00:00
parent fc87692576
commit 1277616c40
3 changed files with 21 additions and 9 deletions

View File

@ -17,4 +17,5 @@
*/
const struct berval slap_empty_bv = { 0, "" };
const struct berval slap_unknown_bv = { sizeof("unknown") - 1, "unknown" };

View File

@ -387,8 +387,6 @@ LDAP_SLAPD_F (void) slapd_clr_read LDAP_P((ber_socket_t s, int wake));
#define dn_match(dn1, dn2) ( ber_bvcmp((dn1), (dn2)) == 0 )
#define bvmatch(bv1, bv2) ( ((bv1)->bv_len == (bv2)->bv_len) && (memcmp((bv1)->bv_val, (bv2)->bv_val, (bv1)->bv_len) == 0) )
LDAP_SLAPD_V( const struct berval ) slap_empty_bv;
LDAP_SLAPD_F (int) dnValidate LDAP_P((
Syntax *syntax,
struct berval *val ));
@ -548,6 +546,13 @@ LDAP_SLAPD_F (int) test_filter LDAP_P((
Backend *be, Connection *conn, Operation *op,
Entry *e, Filter *f ));
/*
* globals.c
*/
LDAP_SLAPD_V( const struct berval ) slap_empty_bv;
LDAP_SLAPD_V( const struct berval ) slap_unknown_bv;
/*
* index.c
*/

View File

@ -11,11 +11,19 @@
*/
#include "portable.h"
//#include "../../../libraries/liblber/lber-int.h"
#include <slap.h>
#include <lber_pvt.h>
#include <slapi.h>
#include <lber.h>
#include "../../../libraries/liblber/lber-int.h"
/*
* use a fake listener when faking a connection,
* so it can be used in ACLs
*/
static struct slap_listener slap_unknown_listener = {
BER_BVC("unknown"), /* FIXME: use a URI form? */
BER_BVC("UNKNOWN")
};
int bvptr2obj( struct berval **bvptr, struct berval **bvobj );
@ -184,11 +192,9 @@ fakeConnection(
c->c_ndn.bv_len = 0;
c->c_groups = NULL;
c->c_listener = NULL;
c->c_peer_domain.bv_val = NULL;
c->c_peer_domain.bv_len = 0;
c->c_peer_name.bv_val = NULL;
c->c_peer_name.bv_len = 0;
c->c_listener = &slap_unknown_listener;
ber_dupbv( &c->c_peer_domain, (struct berval *)&slap_unknown_bv );
ber_dupbv( &c->c_peer_name, (struct berval *)&slap_unknown_bv );
LDAP_STAILQ_INIT( &c->c_ops );