Comparison

prosodyctl @ 9543:92bfb12684b0

prosodyctl: Allow cert dir to not be owned by root (fixes #1075)
author Kim Alvefur <zash@zash.se>
date Wed, 24 Oct 2018 17:04:17 +0200
parent 8947:f12cc1d7aa65
child 9544:cbd3b9d4c60b
comparison
equal deleted inserted replaced
9502:09e7b0048ebe 9543:92bfb12684b0
942 local cert_dir_attrs = lfs.attributes(cert_basedir); 942 local cert_dir_attrs = lfs.attributes(cert_basedir);
943 if not cert_dir_attrs then 943 if not cert_dir_attrs then
944 show_warning("The directory "..cert_basedir.." does not exist"); 944 show_warning("The directory "..cert_basedir.." does not exist");
945 return 1; -- TODO Should we create it? 945 return 1; -- TODO Should we create it?
946 end 946 end
947 if pposix.getuid() ~= cert_dir_attrs.uid then 947 local uid = pposix.getuid();
948 if uid ~= 0 and uid ~= cert_dir_attrs.uid then
948 show_warning("The directory "..cert_basedir.." is not owned by the current user, won't be able to write files to it"); 949 show_warning("The directory "..cert_basedir.." is not owned by the current user, won't be able to write files to it");
949 return 1; 950 return 1;
950 elseif not cert_dir_attrs.permissions then -- COMPAT with LuaFilesystem < 1.6.2 (hey CentOS!) 951 elseif not cert_dir_attrs.permissions then -- COMPAT with LuaFilesystem < 1.6.2 (hey CentOS!)
951 show_message("Unable to check permissions on "..cert_basedir.." (LuaFilesystem 1.6.2+ required)"); 952 show_message("Unable to check permissions on "..cert_basedir.." (LuaFilesystem 1.6.2+ required)");
952 show_message("Please confirm that Prosody (and only Prosody) can write to this directory)"); 953 show_message("Please confirm that Prosody (and only Prosody) can write to this directory)");