mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-05-17 11:54:16 +00:00
Fix xcatprobe TFTP check failure with restrictive umask
The is_tftp_ready() function creates test files that inherit the shell's umask. With umask 027, files get 640 permissions and the TFTP daemon (running as nobody/tftp) cannot read them, causing a false negative even when TFTP service is healthy. Temporarily set umask to 022 during test file creation so files are world-readable (644), then restore the original umask. Fixes: https://github.com/xcat2/xcat-core/issues/7487
This commit is contained in:
@@ -552,12 +552,14 @@ sub is_tftp_ready {
|
||||
$mnip = shift if (($mnip) && ($mnip =~ /probe_utils/));
|
||||
my $tftpdir = shift;
|
||||
my $test_dir = $tftpdir . "/tftptest/";
|
||||
my $old_umask = umask(022);
|
||||
system("mkdir -p $test_dir");
|
||||
|
||||
rename("/$test_dir/tftptestt.tmp", "/$test_dir/tftptestt.tmp.old") if (-e "/$test_dir/tftptestt.tmp");
|
||||
rename("./tftptestt.tmp", "./tftptestt.tmp.old") if (-e "./tftptestt.tmp");
|
||||
|
||||
system("date > /$test_dir/tftptestt.tmp");
|
||||
umask($old_umask);
|
||||
my $output = `tftp -4 -v $mnip -c get /tftptest/tftptestt.tmp 2>&1`;
|
||||
if ((!$?) && (-s "./tftptestt.tmp")) {
|
||||
unlink("./tftptestt.tmp");
|
||||
|
||||
Reference in New Issue
Block a user