Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
40ab90fa
Commit
40ab90fa
authored
May 15, 2000
by
Kurt Zeilenga
Browse files
SLAPD_SCHEMA_NOT_COMPAT: Rework caching of internal schema
parent
7b14e130
Changes
6
Hide whitespace changes
Inline
Side-by-side
servers/slapd/attr.c
View file @
40ab90fa
...
...
@@ -178,7 +178,11 @@ attr_merge_fast(
int
attr_merge
(
Entry
*
e
,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription
*
desc
,
#else
const
char
*
type
,
#endif
struct
berval
**
vals
)
{
Attribute
**
a
;
...
...
servers/slapd/proto-slap.h
View file @
40ab90fa
...
...
@@ -11,8 +11,7 @@
LDAP_BEGIN_DECL
#ifdef SLAPD_SCHEMA_NOT_COMPAT
LIBSLAPD_F
(
AttributeDescription
*
)
slap_ad_entry
;
LIBSLAPD_F
(
AttributeDescription
*
)
slap_ad_children
;
LIBSLAPD_F
(
struct
slap_internal_schema
)
slap_schema
;
LIBSLAPD_F
(
int
)
slap_str2ad
LDAP_P
((
const
char
*
,
...
...
@@ -117,14 +116,17 @@ LIBSLAPD_F (char *) attr_normalize LDAP_P(( char *s ));
LIBSLAPD_F
(
int
)
attr_merge_fast
LDAP_P
((
Entry
*
e
,
const
char
*
type
,
struct
berval
**
vals
,
int
nvals
,
int
naddvals
,
int
*
maxvals
,
Attribute
***
a
));
LIBSLAPD_F
(
int
)
attr_merge
LDAP_P
((
Entry
*
e
,
const
char
*
type
,
struct
berval
**
vals
));
#ifdef SLAPD_SCHEMA_NOT_COMPAT
LIBSLAPD_F
(
int
)
attr_merge
LDAP_P
((
Entry
*
e
,
AttributeDescription
*
desc
,
struct
berval
**
vals
));
LIBSLAPD_F
(
Attribute
*
)
attrs_find
LDAP_P
((
Attribute
*
a
,
AttributeDescription
*
desc
));
LIBSLAPD_F
(
Attribute
*
)
attr_find
LDAP_P
((
Attribute
*
a
,
AttributeDescription
*
desc
));
LIBSLAPD_F
(
int
)
attr_delete
LDAP_P
((
Attribute
**
attrs
,
AttributeDescription
*
desc
));
#else
LIBSLAPD_F
(
int
)
attr_merge
LDAP_P
((
Entry
*
e
,
const
char
*
type
,
struct
berval
**
vals
));
LIBSLAPD_F
(
Attribute
*
)
attr_find
LDAP_P
((
Attribute
*
a
,
const
char
*
type
));
LIBSLAPD_F
(
int
)
attr_delete
LDAP_P
((
Attribute
**
attrs
,
const
char
*
type
));
LIBSLAPD_F
(
int
)
attr_syntax
LDAP_P
((
const
char
*
type
));
...
...
servers/slapd/result.c
View file @
40ab90fa
...
...
@@ -629,7 +629,7 @@ send_search_entry(
int
opattrs
;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription
*
entry
=
slap_ad_entry
;
AttributeDescription
*
entry
=
slap_
schema
.
si_
ad_entry
;
#else
static
const
char
*
entry
=
"entry"
;
#endif
...
...
servers/slapd/root_dse.c
View file @
40ab90fa
...
...
@@ -41,7 +41,7 @@ root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
for
(
j
=
0
;
backends
[
i
].
be_suffix
[
j
]
!=
NULL
;
j
++
)
{
val
.
bv_val
=
backends
[
i
].
be_suffix
[
j
];
val
.
bv_len
=
strlen
(
val
.
bv_val
);
attr_merge
(
e
,
"
namingContexts
"
,
vals
);
attr_merge
(
e
,
slap_schema
.
si_ad_
namingContexts
,
vals
);
}
}
...
...
@@ -51,13 +51,13 @@ root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
for
(
i
=
0
;
supportedControls
[
i
]
!=
NULL
;
i
++
)
{
val
.
bv_val
=
supportedControls
[
i
];
val
.
bv_len
=
strlen
(
val
.
bv_val
);
attr_merge
(
e
,
"
supportedControl
"
,
vals
);
attr_merge
(
e
,
slap_schema
.
si_ad_
supportedControl
,
vals
);
}
/* supportedExtension */
for
(
i
=
0
;
(
val
.
bv_val
=
get_supported_extop
(
i
))
!=
NULL
;
i
++
)
{
val
.
bv_len
=
strlen
(
val
.
bv_val
);
attr_merge
(
e
,
"
supportedExtension
"
,
vals
);
attr_merge
(
e
,
slap_schema
.
si_ad_
supportedExtension
,
vals
);
}
/* supportedLDAPVersion */
...
...
@@ -65,7 +65,7 @@ root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
sprintf
(
buf
,
"%d"
,
i
);
val
.
bv_val
=
buf
;
val
.
bv_len
=
strlen
(
val
.
bv_val
);
attr_merge
(
e
,
"
supportedLDAPVersion
"
,
vals
);
attr_merge
(
e
,
slap_schema
.
si_ad_
supportedLDAPVersion
,
vals
);
}
/* supportedSASLMechanism */
...
...
@@ -73,7 +73,7 @@ root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
for
(
i
=
0
;
supportedSASLMechanisms
[
i
]
!=
NULL
;
i
++
)
{
val
.
bv_val
=
supportedSASLMechanisms
[
i
];
val
.
bv_len
=
strlen
(
val
.
bv_val
);
attr_merge
(
e
,
"
supportedSASLMechanisms
"
,
vals
);
attr_merge
(
e
,
slap_schema
.
si_ad_
supportedSASLMechanisms
,
vals
);
}
}
...
...
@@ -81,21 +81,21 @@ root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
/* supportedACIMechanisms */
for
(
i
=
0
;
(
val
.
bv_val
=
get_supported_acimech
(
i
))
!=
NULL
;
i
++
)
{
val
.
bv_len
=
strlen
(
val
.
bv_val
);
attr_merge
(
e
,
"
supported
ACI
Mechanisms
"
,
vals
);
attr_merge
(
e
,
slap_schema
.
si_ad_
supported
SASL
Mechanisms
,
vals
);
}
#endif
if
(
default_referral
!=
NULL
)
{
attr_merge
(
e
,
"
ref
"
,
default_referral
);
attr_merge
(
e
,
slap_schema
.
si_ad_
ref
,
default_referral
);
}
val
.
bv_val
=
"top"
;
val
.
bv_len
=
sizeof
(
"top"
)
-
1
;
attr_merge
(
e
,
"
objectClass
"
,
vals
);
attr_merge
(
e
,
slap_schema
.
si_ad_
objectClass
,
vals
);
val
.
bv_val
=
"LDAProotDSE"
;
val
.
bv_len
=
sizeof
(
"LDAProotDSE"
)
-
1
;
attr_merge
(
e
,
"
objectClass
"
,
vals
);
attr_merge
(
e
,
slap_schema
.
si_ad_
objectClass
,
vals
);
send_search_entry
(
&
backends
[
0
],
conn
,
op
,
e
,
attrs
,
attrsonly
,
NULL
);
...
...
servers/slapd/schema_init.c
View file @
40ab90fa
...
...
@@ -618,31 +618,69 @@ schema_init( void )
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription
*
slap_ad_entry
=
NULL
;
AttributeDescription
*
slap_ad_children
=
NULL
;
struct
slap_internal_schema
slap_schema
;
struct
slap_schema_ad_map
{
char
*
ssm_type
;
size_t
ssm_offset
;
}
ad_map
[]
=
{
{
"objectClass"
,
offsetof
(
struct
slap_internal_schema
,
si_ad_objectClass
)
},
{
"creatorsName"
,
offsetof
(
struct
slap_internal_schema
,
si_ad_creatorsName
)
},
{
"createTimestamp"
,
offsetof
(
struct
slap_internal_schema
,
si_ad_createTimestamp
)
},
{
"modifiersName"
,
offsetof
(
struct
slap_internal_schema
,
si_ad_modifiersName
)
},
{
"modifyTimestamp"
,
offsetof
(
struct
slap_internal_schema
,
si_ad_modifyTimestamp
)
},
{
"namingContexts"
,
offsetof
(
struct
slap_internal_schema
,
si_ad_namingContexts
)
},
{
"supportedControl"
,
offsetof
(
struct
slap_internal_schema
,
si_ad_supportedControl
)
},
{
"supportedExtension"
,
offsetof
(
struct
slap_internal_schema
,
si_ad_supportedExtension
)
},
{
"supportedLDAPVersion"
,
offsetof
(
struct
slap_internal_schema
,
si_ad_supportedLDAPVersion
)
},
{
"supportedSASLMechanisms"
,
offsetof
(
struct
slap_internal_schema
,
si_ad_supportedSASLMechanisms
)
},
{
"ref"
,
offsetof
(
struct
slap_internal_schema
,
si_ad_ref
)
},
{
"entry"
,
offsetof
(
struct
slap_internal_schema
,
si_ad_entry
)
},
{
"children"
,
offsetof
(
struct
slap_internal_schema
,
si_ad_children
)
},
{
NULL
,
NULL
}
};
#endif
int
schema_prep
(
void
)
{
#ifdef SLAPD_SCHEMA_NOT_COMPAT
int
rc
;
int
i
;
char
*
text
;
#endif
/* we should only be called once after schema_init() was called */
assert
(
schema_init_done
==
1
);
#ifdef SLAPD_SCHEMA_NOT_COMPAT
rc
=
slap_str2ad
(
"entry"
,
&
slap_ad_entry
,
&
text
);
i
f
(
rc
!
=
LDAP_SUCCESS
)
{
fprintf
(
stderr
,
"No attribute
\"
entry
\"
defined in schema
\n
"
);
return
rc
;
}
for
(
i
=
0
;
ad_map
[
i
].
ssm_type
;
i
++
)
{
i
nt
rc
=
slap_str2ad
(
ad_map
[
i
].
ssm_type
,
(
AttributeDescription
**
)
&
(((
char
*
)
&
slap_schema
)[
ad_map
[
i
].
ssm_offset
]),
&
text
);
rc
=
slap_str2ad
(
"children"
,
&
slap_ad_children
,
&
text
);
if
(
rc
!=
LDAP_SUCCESS
)
{
fprintf
(
stderr
,
"No attribute
\"
children
\"
defined in schema
\n
"
);
return
rc
;
if
(
rc
!=
LDAP_SUCCESS
)
{
fprintf
(
stderr
,
"No attribute
\"
%s
\"
defined in schema
\n
"
,
ad_map
[
i
].
ssm_type
);
return
rc
;
}
}
#endif
...
...
servers/slapd/slap.h
View file @
40ab90fa
...
...
@@ -291,6 +291,46 @@ typedef struct slap_attr_desc {
#define SLAP_DESC_BINARY 0x1U
}
AttributeDescription
;
/*
* pointers to schema elements used internally
*/
struct
slap_internal_schema
{
/* objectClass attribute */
AttributeDescription
*
si_ad_objectClass
;
/* operational attributes */
AttributeDescription
*
si_ad_creatorsName
;
AttributeDescription
*
si_ad_createTimestamp
;
AttributeDescription
*
si_ad_modifiersName
;
AttributeDescription
*
si_ad_modifyTimestamp
;
AttributeDescription
*
si_ad_subschemaSubentry
;
/* root DSE attributes */
AttributeDescription
*
si_ad_namingContexts
;
AttributeDescription
*
si_ad_supportedControl
;
AttributeDescription
*
si_ad_supportedExtension
;
AttributeDescription
*
si_ad_supportedLDAPVersion
;
AttributeDescription
*
si_ad_supportedSASLMechanisms
;
/* subschema subentry attributes */
AttributeDescription
*
si_ad_objectClasses
;
AttributeDescription
*
si_ad_attributeTypes
;
AttributeDescription
*
si_ad_ldapSyntaxes
;
AttributeDescription
*
si_ad_matchingRules
;
AttributeDescription
*
si_ad_matchingRulesUse
;
/* Aliases & Referrals */
AttributeDescription
*
si_ad_aliasedObjectName
;
AttributeDescription
*
si_ad_ref
;
/* ACL Internals */
AttributeDescription
*
si_ad_entry
;
AttributeDescription
*
si_ad_children
;
/* Other */
AttributeDescription
*
si_ad_userPassword
;
};
typedef
struct
slap_attr_assertion
{
AttributeDescription
*
aa_desc
;
struct
berval
*
aa_value
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment