Project

General

Profile

Bug #16964 » 16964.patch

Jim Pingle, 07/21/2026 07:46 PM

View differences:

src/etc/inc/pfsense-utils.inc
logger(LOG_CRIT, localize_text("Alias archive is a .tar/tgz file which cannot be decompressed because utility is missing!"));
return false;
}
$temp_dir = "{$temp_filename}/aliasdata/";
mkdir($temp_dir);
rename("{$temp_filename}/aliases", "{$temp_filename}/aliases.tgz");
mwexec("/usr/bin/tar xzf {$temp_filename}/aliases.tgz -C {$temp_filename}/aliases/");
mwexec("/usr/bin/tar xzf {$temp_filename}/aliases.tgz -C {$temp_dir}");
unlink("{$temp_filename}/aliases.tgz");
$files_to_process = return_dir_as_array("{$temp_filename}/");
$files_to_process = return_dir_as_array($temp_dir);
/* foreach through all extracted files and build up aliases file */
$fd = @fopen("{$temp_filename}/aliases", "w");
if (!$fd) {
......
return false;
}
foreach ($files_to_process as $f2p) {
/* Entries in this array should not have a directory path,
* but be safe and add the expected path to the basename. */
$f2p = $temp_dir . basename($f2p);
/* Do not process links or items which are not files */
if (is_link($f2p) ||
!is_file($f2p)) {
logger(LOG_ERR, localize_text('The following entry from the archive is not a regular file: %1$s', $f2p));
continue;
}
$tmpfd = @fopen($f2p, 'r');
if (!$tmpfd) {
logger(LOG_ERR, localize_text('The following file could not be read %1$s from %2$s', $f2p, $temp_filename));
continue;
}
while (($tmpbuf = fread($tmpfd, 65536)) !== FALSE) {
while ($tmpbuf = fgets($tmpfd)) {
fwrite($fd, $tmpbuf);
}
fclose($tmpfd);
unlink($f2p);
@unlink($f2p);
}
fclose($fd);
unset($tmpbuf);
@rmdir_recursive($tmp_dir);
return true;
}
(1-1/2)