summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@kodafritt.se>2012-10-11 17:59:16 +0200
committerSamuel Lidén Borell <samuel@kodafritt.se>2012-10-11 17:59:16 +0200
commit1a7053b4ead04a4a3191cdda9dae96f365d214c5 (patch)
tree61451feb0baa8672118d1bd93f2b03d877e7ce90
parent3df8588976dbfa6683d8bc0b377e724cbf71a6e9 (diff)
downloadfribid-1a7053b4ead04a4a3191cdda9dae96f365d214c5.tar.gz
fribid-1a7053b4ead04a4a3191cdda9dae96f365d214c5.tar.bz2
fribid-1a7053b4ead04a4a3191cdda9dae96f365d214c5.zip
Accept but ignore OnlyAcceptMRU parameter
-rw-r--r--common/biderror.h1
-rw-r--r--plugin/plugin.c23
-rw-r--r--plugin/plugin.h4
-rw-r--r--tests/test-authsig.html11
4 files changed, 37 insertions, 2 deletions
diff --git a/common/biderror.h b/common/biderror.h
index 92c9285..a4a9df8 100644
--- a/common/biderror.h
+++ b/common/biderror.h
@@ -31,6 +31,7 @@ typedef enum {
BIDERR_UserCancel = 8002,
BIDERR_InvalidParameter = 8004,
BIDERR_InvalidAction = 8008,
+ BIDERR_InvalidBoolean = 8012,
BIDERR_InvalidPIN = 8013,
BIDERR_InvalidValue = 8014,
BIDERR_NotSSL = 8015,
diff --git a/plugin/plugin.c b/plugin/plugin.c
index 2dfea2d..091a2bd 100644
--- a/plugin/plugin.c
+++ b/plugin/plugin.c
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2009-2011 Samuel Lidén Borell <samuel@kodafritt.se>
+ Copyright (c) 2009-2012 Samuel Lidén Borell <samuel@kodafritt.se>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -183,6 +183,11 @@ char *sign_getParam(Plugin *plugin, const char *name) {
return s;
}
+ // OnlyAcceptMRU (show only last used cert in list)
+ if (authOrSign && !g_ascii_strcasecmp(name, "OnlyAcceptMRU")) {
+ return strdup(plugin->info.auth.onlyAcceptMRU ? "true" : "false");
+ }
+
// Handle string parameters
char **valuePtr = getParamPointer(plugin, name);
@@ -223,6 +228,22 @@ bool sign_setParam(Plugin *plugin, const char *name, const char *value) {
return true;
}
+ // OnlyAcceptMRU: boolean value
+ if (authOrSign && !g_ascii_strcasecmp(name, "OnlyAcceptMRU")) {
+ plugin->lastError = BIDERR_OK;
+
+ if (!g_ascii_strcasecmp(value, "true")) {
+ plugin->info.auth.onlyAcceptMRU = true;
+ return true;
+ } else if (!g_ascii_strcasecmp(value, "false")) {
+ plugin->info.auth.onlyAcceptMRU = false;
+ return true;
+ }
+
+ plugin->lastError = BIDERR_InvalidBoolean;
+ return false;
+ }
+
// TextCharacterEncoding: Only the values "UTF-8" and "ISO-88591-1"
// are allowed (case-sensitive). This value is NOT escaped in the XML
// signature.
diff --git a/plugin/plugin.h b/plugin/plugin.h
index 4271dd2..03ca494 100644
--- a/plugin/plugin.h
+++ b/plugin/plugin.h
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2009-2011 Samuel Lidén Borell <samuel@kodafritt.se>
+ Copyright (c) 2009-2012 Samuel Lidén Borell <samuel@kodafritt.se>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -55,6 +55,7 @@ typedef struct {
int32_t serverTime;
char *policys;
char *subjectFilter;
+ bool onlyAcceptMRU;
void *dummy0, *dummy1; // To be compatible with .sign below
/* Output parameters */
char *signature;
@@ -65,6 +66,7 @@ typedef struct {
int32_t serverTime;
char *policys;
char *subjectFilter;
+ bool onlyAcceptMRU;
char *messageEncoding;
char *message;
char *invisibleMessage;
diff --git a/tests/test-authsig.html b/tests/test-authsig.html
index b50d612..b7bffe2 100644
--- a/tests/test-authsig.html
+++ b/tests/test-authsig.html
@@ -56,6 +56,17 @@ function test(sign, visibleText, nonVisibleText) {
setPar("NonVisibleData", nonVisibleText);
setPar("ServerTime", "1290536889");
setPar("Policys", "MS4yLjc1Mi43OC4xLjE7MS4yLjc1Mi43OC4xLjI7MS4yLjMuNC41OzEuMi4zLjQuMTA=");
+ setPar("OnlyAcceptMRU", "true");
+ setPar("OnlyAcceptMRU", "True");
+ setPar("OnlyAcceptMRU", "TRUE");
+/* setPar("OnlyAcceptMRU", "true ");
+ setPar("OnlyAcceptMRU", " TrUe ");
+ setPar("OnlyAcceptMRU", "1");
+ setPar("OnlyAcceptMRU", "2");
+ setPar("OnlyAcceptMRU", "-1");
+ setPar("OnlyAcceptMRU", " 1 ");
+ setPar("OnlyAcceptMRU", "true");*/
+ setPar("OnlyAcceptMRU", "false");
output.value += "\n";
var params = [