From 9f7537ddc474ffb1b6b42de4f0e7cc15ed4b06b0 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 26 Apr 2015 13:16:55 -0700 Subject: [PATCH] shlib.sh: make sure a sane umask is in effect Any operations that Girocco performs will need to leave the user permissions and group permissions unmasked. Rather than having to remember to explicitly set the umask everywhere, we do it in shlib.sh and Config.pm so that a sane value is ensured. Signed-off-by: Kyle J. McKay --- Girocco/Config.pm | 4 ++++ shlib.sh | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Girocco/Config.pm b/Girocco/Config.pm index 4a5f8a8..5e06278 100644 --- a/Girocco/Config.pm +++ b/Girocco/Config.pm @@ -632,4 +632,8 @@ $ENV{'GIT_USER_AGENT'} = $git_client_ua if defined($git_client_ua); delete $ENV{'GIT_HTTP_USER_AGENT'}; $ENV{'GIT_HTTP_USER_AGENT'} = $git_client_ua if defined($git_client_ua); +# Guarantee a sane umask for Girocco + +umask(umask() & ~0770); + 1; diff --git a/shlib.sh b/shlib.sh index a8eb512..202f515 100644 --- a/shlib.sh +++ b/shlib.sh @@ -11,6 +11,9 @@ octet20="$octet4$octet4$octet4$octet4$octet4" # tab tab="$(printf '\t')" +# set a sane umask that never excludes any user or group permissions +umask $(printf '0%03o' $(( $(umask) & ~0770 )) ) + vcmp() { # Compare $1 to $2 each of which must match \d+(\.\d+)* # An empty string ('') for $1 or $2 is treated like 0 -- 2.11.4.GIT