[Keymanager] Fix alias tokenizing 43/294443/1 accepted/tizen/7.0/unified/20230620.164237
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:32:45 +0000 (10:32 +0000)
commit80f5e1f2bf80272f849d75f1a5fcfcc7d910fb2b
tree03ba5a6e3b3c2bf4127f284ce29976198d8aefee
parentfb0e799a1f2d17fd7b7fdc90d4ef63344b62258e
[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