made the check on the result from PrivacyIDEA less sensitive for whitespaces being added / removed as this broke the script in PrivacyIDEA 2.1x.

This commit is contained in:
jfl
2016-09-15 10:47:20 +02:00
parent 8b481a2f89
commit c8ebadfd78
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -4,12 +4,12 @@ privacyidea-checkotp
Shell script implementing the [PrivacyIDEA](http://www.privacyidea.org) OTP (One Shell script implementing the [PrivacyIDEA](http://www.privacyidea.org) OTP (One
Time Password) check to integrate with [FreeRadius](http://www.freeradius.org) Time Password) check to integrate with [FreeRadius](http://www.freeradius.org)
in environments where the FreeRadius Perl plugin is not available to use the in environments where the FreeRadius Perl plugin is not available to use the
standard check script (e.g. on OS X 10.9). standard check script (e.g. on OS X).
**Version 1.0**, latest version, documentation and bugtracker available on my **Version 1.0a**, latest version, documentation and bugtracker available on my
[GitLab instance](https://gitlab.lindenaar.net/scripts/privacyidea-checkotp) [GitLab instance](https://gitlab.lindenaar.net/scripts/privacyidea-checkotp)
Copyright (c) 2015 Frederik Lindenaar. free for distribution under the GNU Copyright (c) 2015 - 2016 Frederik Lindenaar. free for distribution under the GNU
License, see [below](#license) License, see [below](#license)
Executable → Regular
+1 -1
View File
@@ -49,7 +49,7 @@ fi
otpresult=`/usr/bin/curl -s "$URL" --data-urlencode "user=$LOGIN" --data-urlencode "pass=$PASSWORD" --data-urlencode "client=$NAS"` otpresult=`/usr/bin/curl -s "$URL" --data-urlencode "user=$LOGIN" --data-urlencode "pass=$PASSWORD" --data-urlencode "client=$NAS"`
# Extract the status of the request from the returned JSON # Extract the status of the request from the returned JSON
otpstatus=`echo $otpresult | sed 's/^{.*"result": { "status": true, "value": \(.*\) },.*}/\1/'` otpstatus=`echo $otpresult | sed 's/^{.*"result": *{ *"status": *true, *"value": *\(.*\) *},.*}/\1/'`
if [ "$otpstatus" = "true" ]; then if [ "$otpstatus" = "true" ]; then
# echo $LOGIN did authenticate $otpresult # echo $LOGIN did authenticate $otpresult