equal
deleted
inserted
replaced
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"); |