prosodyctl
changeset 9546 92bfb12684b0
parent 8950 f12cc1d7aa65
child 9547 cbd3b9d4c60b
equal deleted inserted replaced
9505:09e7b0048ebe 9546: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)");