[Keymanager] Fix alias tokenizing 45/294445/1 accepted/tizen_6.0_unified accepted/tizen/6.0/unified/20230621.004736
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:33:08 +0000 (10:33 +0000)
commit9d07d34cf5793c393fea3fb538c8652e2a90656e
tree3d55f4be7b4d4b0c560d94bf5722bef2489401eb
parentf9b5af080e38e5ecd23693ecb5a2155fadcd4706
[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