Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iotivity-lite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
41
Issues
41
List
Boards
Labels
Service Desk
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
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
IoTivity
iotivity-lite
Commits
cff623dd
Commit
cff623dd
authored
Apr 15, 2020
by
Kishen Maloor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oc_obt:check errors in get ACL and creds handlers
Signed-off-by:
Kishen Maloor
<
kishen.maloor@intel.com
>
parent
897e215a
Pipeline
#687
passed with stage
in 8 minutes and 22 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
29 deletions
+40
-29
onboarding_tool/obtmain.c
onboarding_tool/obtmain.c
+1
-0
security/oc_obt.c
security/oc_obt.c
+31
-25
security/oc_tls.c
security/oc_tls.c
+8
-4
No files found.
onboarding_tool/obtmain.c
View file @
cff623dd
...
...
@@ -1543,6 +1543,7 @@ read_pem(const char *file_path, char *buffer, size_t *buffer_len)
return
-
1
;
}
fclose
(
fp
);
buffer
[
pem_len
]
=
'\0'
;
*
buffer_len
=
(
size_t
)
pem_len
;
return
0
;
}
...
...
security/oc_obt.c
View file @
cff623dd
...
...
@@ -2094,19 +2094,22 @@ cred_rsrc(oc_client_response_t *data)
return
;
}
oc_list_remove
(
oc_credret_ctx_l
,
ctx
);
oc_sec_creds_t
*
creds
=
(
oc_sec_creds_t
*
)
oc_memb_alloc
(
&
oc_creds_m
);
if
(
creds
)
{
OC_LIST_STRUCT_INIT
(
creds
,
creds
);
if
(
decode_cred
(
data
->
payload
,
creds
))
{
OC_DBG
(
"oc_obt:decoded /oic/sec/cred payload"
);
}
else
{
OC_DBG
(
"oc_obt:error decoding /oic/sec/cred payload"
);
}
if
(
oc_list_length
(
creds
->
creds
)
>
0
)
{
ctx
->
cb
(
creds
,
ctx
->
data
);
}
else
{
oc_memb_free
(
&
oc_creds_m
,
creds
);
creds
=
NULL
;
oc_sec_creds_t
*
creds
=
NULL
;
if
(
data
->
code
<
OC_STATUS_BAD_REQUEST
)
{
creds
=
(
oc_sec_creds_t
*
)
oc_memb_alloc
(
&
oc_creds_m
);
if
(
creds
)
{
OC_LIST_STRUCT_INIT
(
creds
,
creds
);
if
(
decode_cred
(
data
->
payload
,
creds
))
{
OC_DBG
(
"oc_obt:decoded /oic/sec/cred payload"
);
}
else
{
OC_DBG
(
"oc_obt:error decoding /oic/sec/cred payload"
);
}
if
(
oc_list_length
(
creds
->
creds
)
>
0
)
{
ctx
->
cb
(
creds
,
ctx
->
data
);
}
else
{
oc_memb_free
(
&
oc_creds_m
,
creds
);
creds
=
NULL
;
}
}
}
if
(
!
creds
)
{
...
...
@@ -2421,18 +2424,21 @@ acl2_rsrc(oc_client_response_t *data)
return
;
}
oc_list_remove
(
oc_aclret_ctx_l
,
ctx
);
oc_sec_acl_t
*
acl
=
(
oc_sec_acl_t
*
)
oc_memb_alloc
(
&
oc_acl_m
);
if
(
acl
)
{
if
(
decode_acl
(
data
->
payload
,
acl
))
{
OC_DBG
(
"oc_obt:decoded /oic/sec/acl2 payload"
);
}
else
{
OC_DBG
(
"oc_obt:error decoding /oic/sec/acl2 payload"
);
}
if
(
oc_list_length
(
acl
->
subjects
)
>
0
)
{
ctx
->
cb
(
acl
,
ctx
->
data
);
}
else
{
oc_memb_free
(
&
oc_acl_m
,
acl
);
acl
=
NULL
;
oc_sec_acl_t
*
acl
=
NULL
;
if
(
data
->
code
<
OC_STATUS_BAD_REQUEST
)
{
acl
=
(
oc_sec_acl_t
*
)
oc_memb_alloc
(
&
oc_acl_m
);
if
(
acl
)
{
if
(
decode_acl
(
data
->
payload
,
acl
))
{
OC_DBG
(
"oc_obt:decoded /oic/sec/acl2 payload"
);
}
else
{
OC_DBG
(
"oc_obt:error decoding /oic/sec/acl2 payload"
);
}
if
(
oc_list_length
(
acl
->
subjects
)
>
0
)
{
ctx
->
cb
(
acl
,
ctx
->
data
);
}
else
{
oc_memb_free
(
&
oc_acl_m
,
acl
);
acl
=
NULL
;
}
}
}
if
(
!
acl
)
{
...
...
security/oc_tls.c
View file @
cff623dd
...
...
@@ -1203,8 +1203,12 @@ oc_tls_add_peer(oc_endpoint_t *endpoint, int role)
?
MBEDTLS_SSL_TRANSPORT_STREAM
:
MBEDTLS_SSL_TRANSPORT_DATAGRAM
;
oc_tls_populate_ssl_config
(
&
peer
->
ssl_conf
,
endpoint
->
device
,
role
,
transport_type
);
if
(
oc_tls_populate_ssl_config
(
&
peer
->
ssl_conf
,
endpoint
->
device
,
role
,
transport_type
)
<
0
)
{
OC_ERR
(
"oc_tls: error in tls_populate_ssl_config"
);
oc_tls_free_peer
(
peer
,
false
);
return
NULL
;
}
#ifdef OC_PKI
#if defined(OC_CLOUD) && defined(OC_CLIENT)
...
...
@@ -1222,7 +1226,7 @@ oc_tls_add_peer(oc_endpoint_t *endpoint, int role)
if
(
err
!=
0
)
{
OC_ERR
(
"oc_tls: error in mbedtls_ssl_setup: %d"
,
err
);
oc_
memb_free
(
&
tls_peers_s
,
peer
);
oc_
tls_free_peer
(
peer
,
false
);
return
NULL
;
}
...
...
@@ -1232,7 +1236,7 @@ oc_tls_add_peer(oc_endpoint_t *endpoint, int role)
mbedtls_ssl_set_client_transport_id
(
&
peer
->
ssl_ctx
,
(
const
unsigned
char
*
)
&
endpoint
->
addr
,
sizeof
(
endpoint
->
addr
))
!=
0
)
{
oc_
memb_free
(
&
tls_peers_s
,
peer
);
oc_
tls_free_peer
(
peer
,
false
);
return
NULL
;
}
oc_list_add
(
tls_peers
,
peer
);
...
...
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