Kaynağa Gözat

Changing expect to be case insensitive in SFTP

In some cases the sftp command will ask for Password rather than
password which is breaking both backups and adding an SFTP host.

This change uses the -nocase flag with expect to ensure case is ignored
during login and the host can be added and then used.
Rob Lazzurs 5 yıl önce
ebeveyn
işleme
8e3ca013c5
2 değiştirilmiş dosya ile 3 ekleme ve 3 silme
  1. 1 1
      bin/v-add-backup-host
  2. 2 2
      func/backup.sh

+ 1 - 1
bin/v-add-backup-host

@@ -49,7 +49,7 @@ sftpc() {
         set count 0
         spawn /usr/bin/sftp -o StrictHostKeyChecking=no -o Port=$port $user@$host
         expect {
-            "password:" {
+            -nocase "password:" {
                 send "$password\r"
                 exp_continue
             }

+ 2 - 2
func/backup.sh

@@ -194,7 +194,7 @@ sftpc() {
         spawn /usr/bin/sftp -o StrictHostKeyChecking=no \
             -o Port=$PORT $USERNAME@$HOST
         expect {
-            "password:" {
+            -nocase "password:" {
                 send "$PASSWORD\r"
                 exp_continue
             }
@@ -457,4 +457,4 @@ b2_backup() {
             b2 delete-file-version $backup > /dev/null 2>&1
         done
     fi
-}
+}