[Keymanager] Fix alias tokenizing 42/294442/2 accepted/tizen/unified/20230621.023231
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 19 Jun 2023 07:34:16 +0000 (09:34 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 19 Jun 2023 10:28:44 +0000 (10:28 +0000)
commitcae0103abec406bc0dbef4a11b9465ce49cb9f4b
treea4b302fe2e98f3c856a82ceefea51d04b3dd1288
parent3c5a2fbb0e498d181f7582b20082836e0c962260
[Keymanager] Fix alias tokenizing

There are 2 problems with key-manager alias tokenizing code:
1. strtok_r() used for tokenizing affects internal/opaque key-manager's
   structure ckmc_alias_info_s by modifying the string pointed by the
   pointer returned from ckmc_alias_info_get_alias(). As a result, the
   following call to ckmc_alias_info_is_password_protected(), that uses
   this structure, fails.
2. strtok_r() splits the string when *any* of characters passed in
   'delim' argument is found. However, the ckmc_owner_id_separator is
   in fact a string, not a set of delimiting characters. It's current
   value is ' ' which happens to work well with strtok_r() but this is
   also a part of internal key-manager's code and may be changed in
   future.

Fix above by locating a complete ckmc_owner_id_separator substring and
tokenizing it without modifying the original string.

Change-Id: I86a4dcbb36dad98219acf32a69d9bbb4164c83b4
src/keymanager/keymanager_instance.cc