diff options
author | Christian Hesse <mail@eworm.de> | 2023-08-30 09:01:46 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2023-08-30 09:30:25 +0200 |
commit | 1e247542a51749175bcd73bb0ea07513848c6442 (patch) | |
tree | 6c5504ddbad46f19ad0f5a726e57aedce9808ea1 /backup-email.rsc | |
parent | f86cf27aa3cbfccf67d47f640b4ad0df64be09ae (diff) |
backup-email: check configuration size before writing file
Diffstat (limited to 'backup-email.rsc')
-rw-r--r-- | backup-email.rsc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/backup-email.rsc b/backup-email.rsc index 3dce2ca..3beb730 100644 --- a/backup-email.rsc +++ b/backup-email.rsc @@ -83,15 +83,16 @@ $WaitFullyConnected; # global-config-overlay :if ($BackupSendGlobalConfig = true) do={ :local Config [ /system/script/get global-config-overlay source ]; - /file/add name=($FilePath . ".conf") contents=$Config; - $WaitForFile ($FilePath . ".conf"); - :local Size [ :len $Config ]; - :if ([ /file/get ($FilePath . ".conf") size ] = $Size) do={ + + :if ($Size <= 4095) { + /file/add name=($FilePath . ".conf") contents=$Config; + $WaitForFile ($FilePath . ".conf"); :set ConfigFile ($FileName . ".conf"); :set Attach ($Attach, ($FilePath . ".conf")); } else={ - $LogPrintExit2 warning $0 ("Creating config file failed. Size should be " . $Size . " bytes, but is not.") false; + $LogPrintExit2 warning $0 ("Creating config file not possible. Limit is 4kB, configuration has " . \ + $Size . " bytes.") false; :set ConfigFile "failed"; :set Failed 1; } |