Software /
code /
prosody
Comparison
prosodyctl @ 9545:9dc7280dd8dc
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 24 Oct 2018 17:18:34 +0200 |
parent | 9231:3d12b4f41b23 |
parent | 9544:cbd3b9d4c60b |
child | 9709:f31ed70c993a |
comparison
equal
deleted
inserted
replaced
9542:b8bfcfbe5126 | 9545:9dc7280dd8dc |
---|---|
655 while data and output:write(data) do | 655 while data and output:write(data) do |
656 data = input:read(2^11); | 656 data = input:read(2^11); |
657 end | 657 end |
658 assert(input:close()); | 658 assert(input:close()); |
659 assert(output:close()); | 659 assert(output:close()); |
660 if owner and group then | 660 if not prosody.installed then |
661 -- FIXME this is possibly specific to GNU chown | |
662 os.execute(("chown -c --reference=%s %s"):format(sh_esc(cert_basedir), sh_esc(to))); | |
663 elseif owner and group then | |
661 local ok = os.execute(("chown %s:%s %s"):format(sh_esc(owner), sh_esc(group), sh_esc(to))); | 664 local ok = os.execute(("chown %s:%s %s"):format(sh_esc(owner), sh_esc(group), sh_esc(to))); |
662 assert(ok == true or ok == 0, "Failed to change ownership of "..to); | 665 assert(ok == true or ok == 0, "Failed to change ownership of "..to); |
663 end | 666 end |
664 if old_umask then pposix.umask(old_umask); end | 667 if old_umask then pposix.umask(old_umask); end |
665 return true; | 668 return true; |
732 local cert_dir_attrs = lfs.attributes(cert_basedir); | 735 local cert_dir_attrs = lfs.attributes(cert_basedir); |
733 if not cert_dir_attrs then | 736 if not cert_dir_attrs then |
734 show_warning("The directory "..cert_basedir.." does not exist"); | 737 show_warning("The directory "..cert_basedir.." does not exist"); |
735 return 1; -- TODO Should we create it? | 738 return 1; -- TODO Should we create it? |
736 end | 739 end |
737 if pposix.getuid() ~= cert_dir_attrs.uid then | 740 local uid = pposix.getuid(); |
741 if uid ~= 0 and uid ~= cert_dir_attrs.uid then | |
738 show_warning("The directory "..cert_basedir.." is not owned by the current user, won't be able to write files to it"); | 742 show_warning("The directory "..cert_basedir.." is not owned by the current user, won't be able to write files to it"); |
739 return 1; | 743 return 1; |
740 elseif not cert_dir_attrs.permissions then -- COMPAT with LuaFilesystem < 1.6.2 (hey CentOS!) | 744 elseif not cert_dir_attrs.permissions then -- COMPAT with LuaFilesystem < 1.6.2 (hey CentOS!) |
741 show_message("Unable to check permissions on "..cert_basedir.." (LuaFilesystem 1.6.2+ required)"); | 745 show_message("Unable to check permissions on "..cert_basedir.." (LuaFilesystem 1.6.2+ required)"); |
742 show_message("Please confirm that Prosody (and only Prosody) can write to this directory)"); | 746 show_message("Please confirm that Prosody (and only Prosody) can write to this directory)"); |