sysutils/sftp-backup : fix identity comparison for https://github.com/opnsense/plugins/issues/4582

This commit is contained in:
Ad Schellevis
2025-03-14 13:44:38 +01:00
parent 99d22e1691
commit 50c9cb095a
@@ -177,8 +177,9 @@ class Sftp extends Base implements IBackupProvider
if (!is_dir($confdir)) {
mkdir($confdir);
}
if (!is_file($identfile) || file_get_contents($identfile) != $this->model->privkey) {
File::file_put_contents($identfile, trim(str_replace("\r", "", $this->model->privkey)) . "\n", 0600);
$this_key = trim(str_replace("\r", "", $this->model->privkey)) . "\n";
if (!is_file($identfile) || file_get_contents($identfile) != $this_key) {
File::file_put_contents($identfile, $this_key, 0600);
}
return $identfile;
}