mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
SMUtils.pm: version 1.24.0
git-svn-id: https://svn.fhem.de/fhem/trunk@26183 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c2a0c86d08
commit
0581620a83
@ -26,6 +26,7 @@
|
|||||||
#########################################################################################################################
|
#########################################################################################################################
|
||||||
|
|
||||||
# Version History
|
# Version History
|
||||||
|
# 1.24.0 new sub encodeSpecChars
|
||||||
# 1.23.1 correct version format
|
# 1.23.1 correct version format
|
||||||
# 1.23.0 new sub evalDecodeJSON
|
# 1.23.0 new sub evalDecodeJSON
|
||||||
# 1.22.0 new sub addCHANGED
|
# 1.22.0 new sub addCHANGED
|
||||||
@ -44,7 +45,7 @@ eval "use JSON;1;" or my $nojsonmod = 1; ## no
|
|||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use Encode;
|
use Encode;
|
||||||
|
|
||||||
# use lib qw(/opt/fhem/FHEM /opt/fhem/lib); # für Syntaxcheck mit: perl -c /opt/fhem/lib/FHEM/SynoModules/SMUtils.pm
|
use lib qw(/opt/fhem/FHEM /opt/fhem/lib); # für Syntaxcheck mit: perl -c /opt/fhem/lib/FHEM/SynoModules/SMUtils.pm
|
||||||
|
|
||||||
use FHEM::SynoModules::ErrCodes qw(:all); # Error Code Modul
|
use FHEM::SynoModules::ErrCodes qw(:all); # Error Code Modul
|
||||||
use GPUtils qw( GP_Import GP_Export );
|
use GPUtils qw( GP_Import GP_Export );
|
||||||
@ -102,6 +103,7 @@ BEGIN {
|
|||||||
attr
|
attr
|
||||||
AttrVal
|
AttrVal
|
||||||
asyncOutput
|
asyncOutput
|
||||||
|
Log
|
||||||
Log3
|
Log3
|
||||||
data
|
data
|
||||||
defs
|
defs
|
||||||
@ -977,7 +979,7 @@ sub _readCredOnBoot {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
my ($username, $passwd) = split "$sep", decode_base64( _descramble($credstr) );
|
my ($username, $passwd) = split "$sep", decode_base64( _descramble($credstr) ), 2;
|
||||||
|
|
||||||
if(!$username || !$passwd) {
|
if(!$username || !$passwd) {
|
||||||
($err,$sc) = _getCredentialsFromHash ($hash, $ctc); # nur Error und Credetials Shortcut lesen !
|
($err,$sc) = _getCredentialsFromHash ($hash, $ctc); # nur Error und Credetials Shortcut lesen !
|
||||||
@ -1038,7 +1040,7 @@ sub _readCredFromCache {
|
|||||||
return (1, $token);
|
return (1, $token);
|
||||||
}
|
}
|
||||||
|
|
||||||
my ($username, $passwd) = split "$sep", decode_base64( _descramble($credstr) );
|
my ($username, $passwd) = split "$sep", decode_base64( _descramble($credstr) ), 2;
|
||||||
|
|
||||||
if(!$username || !$passwd) {
|
if(!$username || !$passwd) {
|
||||||
$err = qq{possible problem in splitting with separator "$sep"};
|
$err = qq{possible problem in splitting with separator "$sep"};
|
||||||
@ -1054,10 +1056,24 @@ sub _readCredFromCache {
|
|||||||
my $logpw = AttrVal($name, "showPassInLog", 0) ? $passwd // "" : "********";
|
my $logpw = AttrVal($name, "showPassInLog", 0) ? $passwd // "" : "********";
|
||||||
|
|
||||||
Log3($name, 4, "$name - ".$sc." read from RAM: $username $logpw");
|
Log3($name, 4, "$name - ".$sc." read from RAM: $username $logpw");
|
||||||
|
|
||||||
|
$passwd = encodeSpecChars ($passwd);
|
||||||
|
|
||||||
return (1, $username, $passwd);
|
return (1, $username, $passwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################################################################
|
||||||
|
# UrlEncode spezielle Zeichen im Passwort u.ä.
|
||||||
|
# see https://help.fanruan.com/finereport-en/doc-view-1136.html
|
||||||
|
# substitute Chars: + / ? % # & =
|
||||||
|
######################################################################################
|
||||||
|
sub encodeSpecChars {
|
||||||
|
my $s = shift;
|
||||||
|
$s =~ s/([\x25 \x23 \x26 \x2B \x2F \x3D \x3F])/sprintf "%%%02x", ord($1)/eg;
|
||||||
|
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# entpackt einen mit _enscramble behandelten String
|
# entpackt einen mit _enscramble behandelten String
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -1229,7 +1245,7 @@ sub login {
|
|||||||
Log3($name, 4, "$name - --- Begin Function login ---");
|
Log3($name, 4, "$name - --- Begin Function login ---");
|
||||||
|
|
||||||
my ($success, $username, $password) = getCredentials($hash,0,"credentials",$sep); # Credentials abrufen
|
my ($success, $username, $password) = getCredentials($hash,0,"credentials",$sep); # Credentials abrufen
|
||||||
|
|
||||||
if (!$success) {
|
if (!$success) {
|
||||||
Log3($name, 2, qq{$name - Credentials couldn't be retrieved successfully - make sure you've set it with "set $name credentials <username> <password>"});
|
Log3($name, 2, qq{$name - Credentials couldn't be retrieved successfully - make sure you've set it with "set $name credentials <username> <password>"});
|
||||||
delActiveToken($hash) if($type eq "SSCam");
|
delActiveToken($hash) if($type eq "SSCam");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user