From: Pierangelo Masarati Date: Tue, 11 Mar 2003 18:25:51 +0000 (+0000) Subject: use an "unknown" listener name/url when faking connections X-Git-Tag: NO_SLAP_OP_BLOCKS~143 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1277616c404aa720fcbe6ea934b08b5df5ed6095;p=openldap use an "unknown" listener name/url when faking connections --- diff --git a/servers/slapd/globals.c b/servers/slapd/globals.c index 68eda098a1..557d8d464d 100644 --- a/servers/slapd/globals.c +++ b/servers/slapd/globals.c @@ -17,4 +17,5 @@ */ const struct berval slap_empty_bv = { 0, "" }; +const struct berval slap_unknown_bv = { sizeof("unknown") - 1, "unknown" }; diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 9396fa5e67..a3b75fd305 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -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 */ diff --git a/servers/slapd/slapi/slapi_ops.c b/servers/slapd/slapi/slapi_ops.c index 8e59193b41..b3fed4b35c 100644 --- a/servers/slapd/slapi/slapi_ops.c +++ b/servers/slapd/slapi/slapi_ops.c @@ -11,11 +11,19 @@ */ #include "portable.h" +//#include "../../../libraries/liblber/lber-int.h" #include +#include #include -#include -#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 );