Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:acdc:sp5-rebuild
openCryptoki.23571
ocki-3.15.1-pkcstok_migrate-Rework-string-quoti...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ocki-3.15.1-pkcstok_migrate-Rework-string-quoting-for-opencrypto.patch of Package openCryptoki.23571
From d2f137cce5e6efb123842509352c7c49f889c67f Mon Sep 17 00:00:00 2001 From: Ingo Franzki <ifranzki@linux.ibm.com> Date: Thu, 22 Jul 2021 15:55:02 +0200 Subject: [PATCH] pkcstok_migrate: Rework string quoting for opencryptoki.conf migration Due to the way the parser works, a slot description like 'description = "slot"' works, but not without quotes ('description = slot'). The word 'slot' is treated as a keyword if not quoted (besides other keywords, too), so if the word 'slot' would appear in an unquoted string, the configuration file would fail to parse. Always quote the value of 'description' and 'manufacturer'. Quote the value of 'stdll', 'confname', and 'tokname' if it contains spaces, and never quote the value of 'hwversion', 'firmwareversion', and 'tokversion'. Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> --- usr/sbin/pkcstok_migrate/pkcstok_migrate.c | 33 +++++++++++++++------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/usr/sbin/pkcstok_migrate/pkcstok_migrate.c b/usr/sbin/pkcstok_migrate/pkcstok_migrate.c index a29dc8f7..853986e8 100644 --- a/usr/sbin/pkcstok_migrate/pkcstok_migrate.c +++ b/usr/sbin/pkcstok_migrate/pkcstok_migrate.c @@ -2060,7 +2060,7 @@ done: */ static int parseupdate_ockversion(void *private, const char *version) { - struct parseupdate *u = (struct parseupdate *)private; + struct parseupdate *u = (struct parseupdate *)private; fprintf(u->f, "version %s", version); return 0; @@ -2068,14 +2068,14 @@ static void parseupdate_disab_event_supp(void *private) static void parseupdate_eol(void *private) { - struct parseupdate *u = (struct parseupdate *)private; + struct parseupdate *u = (struct parseupdate *)private; fputc('\n', u->f); } static int parseupdate_begin_slot(void *private, int slot, int nl_before_begin) { - struct parseupdate *u = (struct parseupdate *)private; + struct parseupdate *u = (struct parseupdate *)private; u->activeslot = (slot == u->slotnum); if (nl_before_begin) @@ -2087,7 +2087,7 @@ static int parseupdate_begin_slot(void *private, int slot, int nl_before_begin) static int parseupdate_end_slot(void *private) { - struct parseupdate *u = (struct parseupdate *)private; + struct parseupdate *u = (struct parseupdate *)private; if (u->activeslot) fprintf(u->f, " tokversion = 3.12\n"); @@ -2098,19 +2098,32 @@ static int parseupdate_end_slot(void *private) static int parseupdate_key_str(void *private, int tok, const char *val) { - struct parseupdate *u = (struct parseupdate *)private; + struct parseupdate *u = (struct parseupdate *)private; - if (tok != KW_HWVERSION && tok != KW_FWVERSION && - strchr(val, ' ') != NULL) + switch (tok) { + case KW_SLOTDESC: + case KW_MANUFID: fprintf(u->f, " %s = \"%s\"", keyword_token_to_str(tok), val); - else if (tok != KW_TOKVERSION) + break; + case KW_STDLL: + case KW_CONFNAME: + case KW_TOKNAME: + if (strchr(val, ' ') != NULL) + fprintf(u->f, " %s = \"%s\"", keyword_token_to_str(tok), val); + else + fprintf(u->f, " %s = %s", keyword_token_to_str(tok), val); + break; + case KW_HWVERSION: + case KW_FWVERSION: fprintf(u->f, " %s = %s", keyword_token_to_str(tok), val); + break; + } return 0; } static int parseupdate_key_vers(void *private, int tok, unsigned int vers) { - struct parseupdate *u = (struct parseupdate *)private; + struct parseupdate *u = (struct parseupdate *)private; if (tok == KW_TOKVERSION && !u->activeslot) fprintf(u->f, " %s = %d.%d", keyword_token_to_str(tok), @@ -2120,7 +2133,7 @@ static int parseupdate_key_vers(void *private, int tok, unsigned int vers) static void parseupdate_eolcomment(void *private, const char *comment) { - struct parseupdate *u = (struct parseupdate *)private; + struct parseupdate *u = (struct parseupdate *)private; fprintf(u->f, "#%s", comment); } -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor