moved the empty dn static entry into a global const object

This commit is contained in:
Pierangelo Masarati 2001-11-16 17:05:32 +00:00
parent 4c283cfe65
commit d51dc13a0b
10 changed files with 19 additions and 22 deletions

View file

@ -196,9 +196,8 @@ retry: rc = txn_abort( ltid );
*/
if ( !be_isroot( be, op->o_ndn )) {
if ( be_issuffix( be, "" ) || be_isupdate( be, op->o_ndn ) ) {
static const Entry rootp = { NOID, "", "", NULL, NULL };
p = (Entry *)&rootp;
p = (Entry *)&slap_entry_root;
/* check parent for "children" acl */
rc = access_allowed( be, conn, op, p,

View file

@ -164,9 +164,7 @@ retry: /* transaction retry */
/* no parent, must be root to delete */
if( ! be_isroot( be, op->o_ndn ) ) {
if ( be_issuffix( be, "" ) || be_isupdate( be, op->o_ndn ) ) {
static const Entry rootp = { NOID, "", "", NULL, NULL };
p = (Entry *)&rootp;
p = (Entry *)&slap_entry_root;
/* check parent for "children" acl */
rc = access_allowed( be, conn, op, p,

View file

@ -30,7 +30,6 @@ bdb_modrdn(
char *p_dn = NULL, *p_ndn = NULL;
char *new_dn = NULL, *new_ndn = NULL;
int isroot = -1;
const static Entry roote = { NOID, "", "", NULL, NULL };
Entry *e, *p = NULL;
Entry *matched;
int rc;
@ -214,7 +213,7 @@ retry: /* transaction retry */
if ( ! isroot ) {
if ( be_issuffix( be, "" ) || be_isupdate( be, op->o_ndn ) ) {
p = (Entry *)&roote;
p = (Entry *)&slap_entry_root;
/* check parent for "children" acl */
rc = access_allowed( be, conn, op, p,
@ -335,7 +334,7 @@ retry: /* transaction retry */
if ( ! isroot ) {
if ( be_issuffix( be, "" ) || be_isupdate( be, op->o_ndn ) ) {
np = (Entry *)&roote;
np = (Entry *)&slap_entry_root;
/* check parent for "children" acl */
rc = access_allowed( be, conn, op, np,

View file

@ -51,7 +51,6 @@ bdb_search(
ID id, cursor;
ID candidates[BDB_IDL_UM_SIZE];
Entry *e = NULL;
const static Entry roote = { NOID, "", "", NULL, NULL };
struct berval **v2refs = NULL;
Entry *matched = NULL;
char *realbase = NULL;
@ -68,7 +67,7 @@ bdb_search(
if ( *nbase == '\0' ) {
/* DIT root special case */
e = (Entry *) &roote;
e = (Entry *) &slap_entry_root;
rc = 0;
} else
#ifdef BDB_ALIASES
@ -128,7 +127,7 @@ bdb_search(
return rc;
}
if (!manageDSAit && e != &roote && is_entry_referral( e ) ) {
if (!manageDSAit && e != &slap_entry_root && is_entry_referral( e ) ) {
/* entry is a referral, don't allow add */
char *matched_dn = ch_strdup( e->e_dn );
struct berval **erefs = get_entry_referrals( be,
@ -243,7 +242,7 @@ bdb_search(
* FIXME: hack to make "" base work */
cursor = e->e_id == NOID ? 1 : e->e_id;
if ( e != &roote ) {
if ( e != &slap_entry_root ) {
bdb_entry_return( be, e );
}
e = NULL;

View file

@ -212,8 +212,7 @@ ldbm_back_add(
if ( !be_isroot( be, op->o_ndn ) ) {
if ( be_issuffix( be, "" )
|| be_isupdate( be, op->o_ndn ) ) {
static const Entry rootp = { NOID, "", "", NULL, NULL };
p = (Entry *)&rootp;
p = (Entry *)&slap_entry_root;
rc = access_allowed( be, conn, op, p,
children, NULL, ACL_WRITE );

View file

@ -156,8 +156,7 @@ ldbm_back_delete(
if( ! be_isroot( be, op->o_ndn ) ) {
if ( be_issuffix( be, "" )
|| be_isupdate( be, op->o_ndn ) ) {
static const Entry rootp = { NOID, "", "", NULL, NULL };
p = (Entry *)&rootp;
p = (Entry *)&slap_entry_root;
rc = access_allowed( be, conn, op, p,
children, NULL, ACL_WRITE );

View file

@ -210,8 +210,7 @@ ldbm_back_modrdn(
if ( ! be_isroot ) {
if ( be_issuffix( be, "" )
|| be_isupdate( be, op->o_ndn ) ) {
static const Entry rootp = { NOID, "", "", NULL, NULL };
p = (Entry *)&rootp;
p = (Entry *)&slap_entry_root;
rc = access_allowed( be, conn, op, p,
children, NULL, ACL_WRITE );
@ -390,8 +389,7 @@ ldbm_back_modrdn(
if ( ! be_isroot ) {
if ( be_issuffix( be, "" )
|| be_isupdate( be, op->o_ndn ) ) {
static const Entry rootp = { NOID, "", "", NULL, NULL };
np = (Entry *)&rootp;
np = (Entry *)&slap_entry_root;
rc = access_allowed( be, conn, op, np,
children, NULL, ACL_WRITE );

View file

@ -67,8 +67,7 @@ ldbm_back_search(
if ( *nbase == '\0' ) {
/* DIT root special case */
static const Entry root = { NOID, "", "", NULL, NULL };
e = (Entry *) &root;
e = (Entry *) &slap_entry_root;
/* need normalized dn below */
realbase = ch_strdup( e->e_ndn );

View file

@ -21,6 +21,11 @@ static unsigned char *ebuf; /* buf returned by entry2str */
static unsigned char *ecur; /* pointer to end of currently used ebuf */
static int emaxsize;/* max size of ebuf */
/*
* Empty root entry
*/
const Entry slap_entry_root = { NOID, "", "", NULL, NULL };
int entry_destroy(void)
{
free( ebuf );

View file

@ -333,6 +333,8 @@ LDAP_SLAPD_F (void) build_new_dn LDAP_P(( char ** new_dn,
* entry.c
*/
extern const Entry slap_entry_root;
LDAP_SLAPD_F (int) entry_destroy LDAP_P((void));
LDAP_SLAPD_F (Entry *) str2entry LDAP_P(( char *s ));