From 1e41fab681454464a45a2eed4ef0350df413c701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Thu, 17 Jan 2008 11:13:37 +0000 Subject: [PATCH] Add option app-fatal to control if softtoken should abort() on erroneous input from applications. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22470 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hx509/softp11.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/hx509/softp11.c b/lib/hx509/softp11.c index b44666ea1..fdecbd9a8 100644 --- a/lib/hx509/softp11.c +++ b/lib/hx509/softp11.c @@ -769,6 +769,22 @@ read_conf_file(const char *fn, CK_USER_TYPE userType, const char *pin) if (soft_token.logfile == NULL) st_logf("failed to open file: %s\n", name); + } else if (strcasecmp("app-fatal", type) == 0) { + char *name; + + name = strtok_r(NULL, "\t", &s); + if (name == NULL) { + st_logf("argument to app-fatal\n"); + continue; + } + + if (strcmp(name, "true") == 0 || strcmp(name, "on") == 0) + soft_token.flags.app_error_fatal = 1; + else if (strcmp(name, "false") == 0 || strcmp(name, "off") == 0) + soft_token.flags.app_error_fatal = 0; + else + st_logf("unknown app-fatal: %s\n", name); + } else { st_logf("unknown type: %s\n", type); }