Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher Ng
OpenLDAP
Commits
6b9b0660
Commit
6b9b0660
authored
23 years ago
by
Howard Chu
Browse files
Options
Downloads
Patches
Plain Diff
Fix ITS#1213, OID macro parsing in attributetypes
parent
7a18352c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/ldap_schema.h
+2
-1
2 additions, 1 deletion
include/ldap_schema.h
libraries/libldap/schema.c
+24
-4
24 additions, 4 deletions
libraries/libldap/schema.c
servers/slapd/schemaparse.c
+14
-29
14 additions, 29 deletions
servers/slapd/schemaparse.c
with
40 additions
and
34 deletions
include/ldap_schema.h
+
2
−
1
View file @
6b9b0660
...
...
@@ -116,7 +116,8 @@ typedef struct ldap_objectclass {
#define LDAP_SCHEMA_ALLOW_QUOTED 0x02
/* Allow bogus extra quotes */
#define LDAP_SCHEMA_ALLOW_DESCR 0x04
/* Allow descr instead of OID */
#define LDAP_SCHEMA_ALLOW_DESCR_PREFIX 0x08
/* Allow descr as OID prefix */
#define LDAP_SCHEMA_ALLOW_ALL 0x0f
/* Be very liberal in parsing */
#define LDAP_SCHEMA_ALLOW_OID_MACRO 0x10
/* Allow OID macros in slapd */
#define LDAP_SCHEMA_ALLOW_ALL 0x1f
/* Be very liberal in parsing */
LDAP_F
(
LDAP_CONST
char
*
)
ldap_syntax2name
LDAP_P
((
...
...
This diff is collapsed.
Click to expand it.
libraries/libldap/schema.c
+
24
−
4
View file @
6b9b0660
...
...
@@ -1658,7 +1658,8 @@ ldap_str2attributetype( const char * s, int * code, const char ** errp, const in
savepos
=
ss
;
at
->
at_oid
=
parse_numericoid
(
&
ss
,
code
,
0
);
if
(
!
at
->
at_oid
)
{
if
(
flags
&
LDAP_SCHEMA_ALLOW_NO_OID
)
{
if
(
flags
&
(
LDAP_SCHEMA_ALLOW_NO_OID
|
LDAP_SCHEMA_ALLOW_OID_MACRO
)
)
{
/* Backtracking */
ss
=
savepos
;
kind
=
get_token
(
&
ss
,
&
sval
);
...
...
@@ -1678,8 +1679,13 @@ ldap_str2attributetype( const char * s, int * code, const char ** errp, const in
!
strncmp
(
sval
,
"X-"
,
2
)
)
{
/* Missing OID, backtrack */
ss
=
savepos
;
}
else
{
/* Non-numerical OID, ignore */
}
else
if
(
flags
&
LDAP_SCHEMA_ALLOW_OID_MACRO
)
{
/* Non-numerical OID ... */
int
len
=
ss
-
savepos
;
at
->
at_oid
=
LDAP_MALLOC
(
len
+
1
);
strncpy
(
at
->
at_oid
,
savepos
,
len
);
at
->
at_oid
[
len
]
=
0
;
}
}
LDAP_FREE
(
sval
);
...
...
@@ -1824,15 +1830,24 @@ ldap_str2attributetype( const char * s, int * code, const char ** errp, const in
}
seen_syntax
=
1
;
parse_whsp
(
&
ss
);
savepos
=
ss
;
at
->
at_syntax_oid
=
parse_noidlen
(
&
ss
,
code
,
&
at
->
at_syntax_len
,
flags
);
if
(
!
at
->
at_syntax_oid
)
{
if
(
flags
&
LDAP_SCHEMA_ALLOW_OID_MACRO
)
{
int
len
=
ss
-
savepos
;
at
->
at_syntax_oid
=
LDAP_MALLOC
(
len
+
1
);
strncpy
(
at
->
at_syntax_oid
,
savepos
,
len
);
at
->
at_syntax_oid
[
len
]
=
0
;
}
else
{
*
errp
=
ss
;
ldap_attributetype_free
(
at
);
return
NULL
;
}
}
parse_whsp
(
&
ss
);
}
else
if
(
!
strcmp
(
sval
,
"SINGLE-VALUE"
)
)
{
...
...
@@ -2018,8 +2033,13 @@ ldap_str2objectclass( const char * s, int * code, const char ** errp, const int
!
strncmp
(
sval
,
"X-"
,
2
)
)
{
/* Missing OID, backtrack */
ss
=
savepos
;
}
else
{
}
else
if
(
flags
&
LDAP_SCHEMA_ALLOW_OID_MACRO
)
{
/* Non-numerical OID, ignore */
int
len
=
ss
-
savepos
;
oc
->
oc_oid
=
LDAP_MALLOC
(
len
+
1
);
strncpy
(
oc
->
oc_oid
,
savepos
,
len
);
oc
->
oc_oid
[
len
]
=
0
;
}
}
LDAP_FREE
(
sval
);
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/schemaparse.c
+
14
−
29
View file @
6b9b0660
...
...
@@ -290,32 +290,6 @@ parse_at(
char
*
oid
=
NULL
;
char
*
soid
=
NULL
;
/* Kludge for OIDmacros for syntaxes. If the syntax field starts
* nonnumeric, look for and expand a macro. The macro's place in
* the input line will be replaced with a field of '0's to keep
* ldap_str2attributetype happy. The actual oid will be swapped
* into place afterwards.
*/
for
(;
argv
[
3
];
argv
++
)
{
/* Allow numeric OIDs to be wrapped in single quotes */
if
(
!
strcasecmp
(
argv
[
3
],
"syntax"
)
&&
argv
[
4
]
!=
NULL
&&
!
OID_LEADCHAR
(
argv
[
4
][
argv
[
4
][
0
]
==
'\''
?
1
:
0
]))
{
int
slen
;
Syntax
*
syn
;
syn
=
syn_find_desc
(
argv
[
4
],
&
slen
);
if
(
!
syn
)
{
fprintf
(
stderr
,
"%s: line %d: OID %s not found
\n
"
,
fname
,
lineno
,
argv
[
4
]);
return
1
;
}
memset
(
strstr
(
line
,
argv
[
4
]),
'0'
,
slen
);
soid
=
ch_strdup
(
syn
->
ssyn_syn
.
syn_oid
);
break
;
}
}
at
=
ldap_str2attributetype
(
line
,
&
code
,
&
err
,
LDAP_SCHEMA_ALLOW_ALL
);
if
(
!
at
)
{
fprintf
(
stderr
,
"%s: line %d: %s before %s
\n
"
,
...
...
@@ -340,9 +314,20 @@ parse_at(
}
}
/* at->at_oid == NULL will be an error someday */
if
(
soid
)
{
ldap_memfree
(
at
->
at_syntax_oid
);
at
->
at_syntax_oid
=
soid
;
if
(
at
->
at_syntax_oid
&&
!
OID_LEADCHAR
(
at
->
at_syntax_oid
[
0
]
))
{
/* Expand OID macros */
oid
=
find_oidm
(
at
->
at_syntax_oid
);
if
(
!
oid
)
{
fprintf
(
stderr
,
"%s: line %d: OID %s not recognized
\n
"
,
fname
,
lineno
,
at
->
at_syntax_oid
);
return
1
;
}
if
(
oid
!=
at
->
at_syntax_oid
)
{
ldap_memfree
(
at
->
at_syntax_oid
);
at
->
at_syntax_oid
=
oid
;
}
}
code
=
at_add
(
at
,
&
err
);
if
(
code
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment