Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: source/PassphraseAuthenticator.cpp
- Revision:
- 24:c92984bede9c
- Parent:
- 13:9edad7677211
diff -r 5852c0884714 -r c92984bede9c source/PassphraseAuthenticator.cpp
--- a/source/PassphraseAuthenticator.cpp Sat Jun 11 02:34:34 2016 +0000
+++ b/source/PassphraseAuthenticator.cpp Sun Jun 12 02:49:50 2016 +0000
@@ -40,12 +40,12 @@
// basic (trivial passphrase authentication)
bool PassphraseAuthenticator::authenticate(void *challenge) {
-#if defined (HAS_EXECUTE_PARAMS)
// use simple, trivial passphrase based comparison as the check...
char *passphrase = (char *)this->m_secret;
char *input_passphrase = NULL;
- // unmarshall the challenge... its a simple string
+#if defined (HAS_EXECUTE_PARAMS)
+ // ExecParam mbed-client: un-marshall the ExecuteParameter to get the simple string...
M2MResource::M2MExecuteParameter* param = (M2MResource::M2MExecuteParameter*)challenge;
if (param != NULL) {
// use parameters to extract the passphrase
@@ -55,6 +55,10 @@
string value = this->coapDataToString(param->get_argument_value(),param->get_argument_value_length());
input_passphrase = (char *)value.c_str();
}
+#else
+ // Non-ExecParam mbed-client: use the parameter directly...
+ input_passphrase = (char *)challenge;
+#endif
// DEBUG
//this->m_logger->log("Authenticator(passphrase): passphrase: [%s] challenge: [%s]",passphrase,input_passphrase);
@@ -73,11 +77,6 @@
// authentication failure
return false;
-#else
- // DEBUG
- this->m_logger->log("Authenticator(passphrase): OLD mbed-client detected. Authentication OK (passthru)");
- return true;
-#endif
}
// convenience method to get the URI from its buffer field...