aggiunto supporto per autenticazione su socket server
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
## 0.3.2 - xx/xx/2017
|
||||
## 0.4.0 - xx/xx/2017
|
||||
Add credentials support to socket server (define TCPSERVER_USER and TCPSERVER_PWD in your config file)
|
||||
Add management lock/unlock for prevent concurrente call to open/close solenoid
|
||||
|
||||
## 0.3.1 - 13/05/2017
|
||||
|
||||
@@ -114,3 +114,6 @@ NOT_IRRIGATE_IF_RAIN_SENSOR=86400
|
||||
TCPSERVER_IP="127.0.0.1"
|
||||
TCPSERVER_PORT="8084"
|
||||
|
||||
# Utente e password che i clients devono utilizzare per stabilire una connessione tramite socket server
|
||||
TCPSERVER_USER=""
|
||||
TCPSERVER_PWD=""
|
||||
|
||||
19
piGarden.sh
19
piGarden.sh
@@ -1211,6 +1211,21 @@ function socket_server_command {
|
||||
RUN_FROM_TCPSERVER=1
|
||||
|
||||
local line=""
|
||||
|
||||
if [ ! -z "$TCPSERVER_USER" ] && [ ! -z "$TCPSERVER_PWD" ]; then
|
||||
local user=""
|
||||
local password=""
|
||||
read -t 3 user
|
||||
read -t 3 password
|
||||
user=$(echo "$user" | $TR -d '[\r\n]')
|
||||
password=$(echo "$password" | $TR -d '[\r\n]')
|
||||
if [ "$user" != "$TCPSERVER_USER" ] || [ "$password" != "$TCPSERVER_PWD" ]; then
|
||||
log_write "socket connection from: $TCPREMOTEIP - Bad socket server credentials - user:$user"
|
||||
json_error 0 "Bad socket server credentials"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
read line
|
||||
line=$(echo "$line " | $TR -d '[\r\n]')
|
||||
arg1=$(echo "$line " | $CUT -d ' ' -f1)
|
||||
@@ -1432,8 +1447,8 @@ function debug2 {
|
||||
}
|
||||
|
||||
VERSION=0
|
||||
SUB_VERSION=3
|
||||
RELEASE_VERSION=2
|
||||
SUB_VERSION=4
|
||||
RELEASE_VERSION=0
|
||||
|
||||
DIR_SCRIPT=`dirname $0`
|
||||
NAME_SCRIPT=${0##*/}
|
||||
|
||||
Reference in New Issue
Block a user