Software /
code /
prosody
Comparison
prosodyctl @ 8108:939ccedb509d
prosodyctl: Verify that directory certs are written to exists
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 21 Apr 2017 14:34:53 +0200 |
parent | 8107:83d776b344ad |
child | 8109:2f214c4db170 |
comparison
equal
deleted
inserted
replaced
8107:83d776b344ad | 8108:939ccedb509d |
---|---|
829 function commands.cert(arg) | 829 function commands.cert(arg) |
830 if #arg >= 1 and arg[1] ~= "--help" then | 830 if #arg >= 1 and arg[1] ~= "--help" then |
831 openssl = require "util.openssl"; | 831 openssl = require "util.openssl"; |
832 lfs = require "lfs"; | 832 lfs = require "lfs"; |
833 local cert_dir_attrs = lfs.attributes(cert_basedir); | 833 local cert_dir_attrs = lfs.attributes(cert_basedir); |
834 if not cert_dir_attrs then | |
835 show_warning("The directory "..cert_basedir.." does not exist"); | |
836 return 1; -- TODO Should we create it? | |
837 end | |
834 if pposix.getuid() ~= cert_dir_attrs.uid then | 838 if pposix.getuid() ~= cert_dir_attrs.uid then |
835 show_warning("The directory "..cert_basedir.." is not owned by the current user, won't be able to write files to it"); | 839 show_warning("The directory "..cert_basedir.." is not owned by the current user, won't be able to write files to it"); |
836 return 1; | 840 return 1; |
837 elseif cert_dir_attrs.permissions:match("^%.w..%-..%-.$") then | 841 elseif cert_dir_attrs.permissions:match("^%.w..%-..%-.$") then |
838 show_warning("The directory "..cert_basedir.." not only writable by its owner"); | 842 show_warning("The directory "..cert_basedir.." not only writable by its owner"); |