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
18198247
Commit
18198247
authored
18 years ago
by
Howard Chu
Browse files
Options
Downloads
Patches
Plain Diff
Reject malformed LDIF - missing modops, or mismatched attributes
parent
ead61fbf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
clients/tools/ldapmodify.c
+24
-9
24 additions, 9 deletions
clients/tools/ldapmodify.c
with
24 additions
and
9 deletions
clients/tools/ldapmodify.c
+
24
−
9
View file @
18198247
...
...
@@ -3,6 +3,7 @@
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2006 The OpenLDAP Foundation.
* Portions Copyright 2006 Howard Chu.
* Portions Copyright 1998-2003 Kurt D. Zeilenga.
* Portions Copyright 1998-2001 Net Boolean Incorporated.
* Portions Copyright 2001-2003 IBM Corporation.
...
...
@@ -32,6 +33,7 @@
* include:
* Kurt D. Zeilenga
* Norbert Klasen
* Howard Chu
*/
#include
"portable.h"
...
...
@@ -578,7 +580,7 @@ short_input:
goto
short_input
;
if
(
BVICMP
(
btype
+
i
,
&
BV_NEWRDN
))
{
fprintf
(
stderr
,
_
(
"%s: expecting
\"
%s:
\"
but saw"
"
\"
%s:
\"
(line %d
of
entry
\"
%s
\"
)
\n
"
),
"
\"
%s:
\"
(line %d
,
entry
\"
%s
\"
)
\n
"
),
prog
,
BV_NEWRDN
.
bv_val
,
btype
[
i
].
bv_val
,
linenum
+
i
,
dn
);
rc
=
LDAP_PARAM_ERROR
;
goto
leave
;
...
...
@@ -589,7 +591,7 @@ short_input:
goto
short_input
;
if
(
BVICMP
(
btype
+
i
,
&
BV_DELETEOLDRDN
))
{
fprintf
(
stderr
,
_
(
"%s: expecting
\"
%s:
\"
but saw"
"
\"
%s:
\"
(line %d
of
entry
\"
%s
\"
)
\n
"
),
"
\"
%s:
\"
(line %d
,
entry
\"
%s
\"
)
\n
"
),
prog
,
BV_DELETEOLDRDN
.
bv_val
,
btype
[
i
].
bv_val
,
linenum
+
i
,
dn
);
rc
=
LDAP_PARAM_ERROR
;
goto
leave
;
...
...
@@ -599,7 +601,7 @@ short_input:
if
(
i
<
lines
)
{
if
(
BVICMP
(
btype
+
i
,
&
BV_NEWSUP
))
{
fprintf
(
stderr
,
_
(
"%s: expecting
\"
%s:
\"
but saw"
"
\"
%s:
\"
(line %d
of
entry
\"
%s
\"
)
\n
"
),
"
\"
%s:
\"
(line %d
,
entry
\"
%s
\"
)
\n
"
),
prog
,
BV_NEWSUP
.
bv_val
,
btype
[
i
].
bv_val
,
linenum
+
i
,
dn
);
rc
=
LDAP_PARAM_ERROR
;
goto
leave
;
...
...
@@ -628,7 +630,7 @@ short_input:
if
(
got_all
)
{
if
(
i
<
lines
)
{
fprintf
(
stderr
,
_
(
"%s: extra lines at end (line %d
of
entry
\"
%s
\"
)
\n
"
),
_
(
"%s: extra lines at end (line %d
,
entry
\"
%s
\"
)
\n
"
),
prog
,
linenum
+
i
,
dn
);
rc
=
LDAP_PARAM_ERROR
;
goto
leave
;
...
...
@@ -716,8 +718,8 @@ short_input:
if
(
++
icnt
!=
vals
[
i
].
bv_len
)
{
fprintf
(
stderr
,
_
(
"%s: illegal trailing space after"
"
\"
%s: %s
\"
trimmed (line %d
of
entry
\"
%s
\"
)
\n
"
),
prog
,
type
,
vals
[
i
].
bv_val
,
linenum
,
dn
);
"
\"
%s: %s
\"
trimmed (line %d
,
entry
\"
%s
\"
)
\n
"
),
prog
,
type
,
vals
[
i
].
bv_val
,
linenum
+
i
,
dn
);
vals
[
i
].
bv_val
[
icnt
]
=
'\0'
;
}
#endif
/* LIBERAL_CHANGETYPE_MODOP */
...
...
@@ -745,16 +747,27 @@ short_input:
modop
=
LDAP_MOD_INCREMENT
;
mops
[
i
]
=
M_SEP
;
nmods
--
;
}
else
{
/* no modify op: use default */
modop
=
ldapadd
?
LDAP_MOD_ADD
:
LDAP_MOD_REPLACE
;
mops
[
i
]
=
modop
;
}
else
{
/* no modify op: invalid LDIF */
fprintf
(
stderr
,
_
(
"%s: modify operation type is missing at"
" line %d, entry
\"
%s
\"\n
"
),
prog
,
linenum
+
i
,
dn
);
rc
=
LDAP_PARAM_ERROR
;
goto
leave
;
}
bv
=
vals
[
i
];
}
else
if
(
expect_sep
&&
BER_BVISEMPTY
(
btype
+
i
))
{
mops
[
i
]
=
M_SEP
;
expect_sep
=
0
;
expect_modop
=
1
;
nmods
--
;
}
else
{
if
(
BVICMP
(
btype
+
i
,
&
bv
))
{
fprintf
(
stderr
,
_
(
"%s: wrong attributeType at"
" line %d, entry
\"
%s
\"\n
"
),
prog
,
linenum
+
i
,
dn
);
rc
=
LDAP_PARAM_ERROR
;
goto
leave
;
}
mops
[
i
]
=
modop
;
/* If prev op was deferred and matches this type,
* clear the flag
...
...
@@ -767,6 +780,7 @@ short_input:
}
}
#if 0 /* we should faithfully encode the LDIF, not combine */
/* Make sure all modops with multiple values are contiguous */
for (i=idn; i<lines; i++) {
if ( mops[i] == M_SEP )
...
...
@@ -801,6 +815,7 @@ short_input:
}
}
}
#endif
/* Allocate space for array of mods, array of pointers to mods,
* and array of pointers to values, allowing for NULL terminators
...
...
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