Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
6d97ce95
Commit
6d97ce95
authored
Jan 28, 2021
by
Denis Filatov
Committed by
v0-e
Nov 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix WITH DESCENDANTS; tests for WITH DESCENDANTS
parent
d3faf7fc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
25 deletions
+51
-25
libasn1fix/asn1fix_retrieve.c
libasn1fix/asn1fix_retrieve.c
+9
-2
libasn1parser/asn1p_oid.c
libasn1parser/asn1p_oid.c
+0
-15
libasn1parser/asn1p_oid.h
libasn1parser/asn1p_oid.h
+0
-5
libasn1parser/asn1p_xports.h
libasn1parser/asn1p_xports.h
+4
-1
libasn1parser/asn1p_y.y
libasn1parser/asn1p_y.y
+2
-2
tests/tests-asn1c-compiler/163-imports-with-descendants-OK.asn1
...tests-asn1c-compiler/163-imports-with-descendants-OK.asn1
+36
-0
No files found.
libasn1fix/asn1fix_retrieve.c
View file @
6d97ce95
...
...
@@ -149,8 +149,15 @@ asn1f_lookup_module(arg_t *arg, const char *module_name, const asn1p_oid_t *oid,
TQ_FOR
(
mod
,
&
(
arg
->
asn
->
modules
),
mod_next
)
{
if
(
oid
)
{
if
(
mod
->
module_oid
)
{
if
(
0
==
asn1p_oid_compare_opt
(
oid
,
mod
->
module_oid
,
oid_option
))
{
int
r
=
asn1p_oid_compare
(
oid
,
mod
->
module_oid
);
if
(
oid_option
==
XPT_WITH_SUCCESSORS
)
{
if
(
r
==
oid
->
arcs_count
&&
r
==
mod
->
module_oid
->
arcs_count
)
/* positive and last arc */
r
=
0
;
}
else
if
(
oid_option
==
XPT_WITH_DESCENDANTS
)
{
if
(
oid
->
arcs_count
==
(
-
1
-
r
))
r
=
0
;
}
if
(
0
==
r
)
{
/* Match! Even if name doesn't. */
oid
=
mod
->
module_oid
;
ret
=
mod
;
...
...
libasn1parser/asn1p_oid.c
View file @
6d97ce95
...
...
@@ -109,18 +109,3 @@ asn1p_oid_compare(const asn1p_oid_t *a, const asn1p_oid_t *b) {
return
1
+
i
;
}
}
int
asn1p_oid_compare_opt
(
const
asn1p_oid_t
*
a
,
const
asn1p_oid_t
*
b
,
int
oid_options
)
{
int
r
=
asn1p_oid_compare
(
a
,
b
);
if
(
oid_options
==
OID_WITH_SUCCESSORS
)
{
if
(
r
==
a
->
arcs_count
&&
r
==
b
->
arcs_count
)
/* positive and last arc */
r
=
0
;
}
else
if
(
oid_options
==
OID_WITH_DESCENDANTS
)
{
if
(
a
->
arcs_count
==
(
0
-
r
))
r
=
0
;
}
return
r
;
}
libasn1parser/asn1p_oid.h
View file @
6d97ce95
...
...
@@ -63,9 +63,4 @@ void asn1p_oid_free(asn1p_oid_t *);
*/
int
asn1p_oid_compare
(
const
asn1p_oid_t
*
a
,
const
asn1p_oid_t
*
b
);
#define OID_WITH_SUCCESSORS 1
#define OID_WITH_DESCENDANTS 2
int
asn1p_oid_compare_opt
(
const
asn1p_oid_t
*
a
,
const
asn1p_oid_t
*
b
,
int
oid_option
);
#endif
/* ASN1_PARSER_OID_H */
libasn1parser/asn1p_xports.h
View file @
6d97ce95
...
...
@@ -23,7 +23,10 @@ typedef struct asn1p_xports_s {
asn1p_value_t
*
value
;
/* DefinedValue */
}
identifier
;
int
option
;
/* (0) | WITH SUCCESSORS (1) | WITH DESCENDANTS (2) */
enum
asn1p_import_option
{
XPT_WITH_SUCCESSORS
=
1
,
XPT_WITH_DESCENDANTS
}
option
;
/*
* Number of entities to import.
...
...
libasn1parser/asn1p_y.y
View file @
6d97ce95
...
...
@@ -769,10 +769,10 @@ ImportsElement:
ImportSelectionOption:
TOK_WITH TOK_SUCCESSORS {
$$ =
OID
_WITH_SUCCESSORS;
$$ =
XPT
_WITH_SUCCESSORS;
}
| TOK_WITH TOK_DESCENDANTS {
$$ =
OID
_WITH_DESCENDANTS;
$$ =
XPT
_WITH_DESCENDANTS;
}
;
...
...
tests/tests-asn1c-compiler/163-imports-with-descendants-OK.asn1
0 → 100755
View file @
6d97ce95
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .121
ModuleIMPORTS
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 161 }
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
IMPORTS ImportedType
FROM ImportedModule1
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 163 major-version-1(1) }
WITH DESCENDANTS
;
Type ::= ImportedType
END
ImportedModule1
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 163 major-version-1(1) super-minor-version(1) super-minor-version(1)}
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
IMPORTS -- nothing --;
ImportedType ::= INTEGER
END
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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