diff options
author | Jameson Graef Rollins <jrollins@phys.columbia.edu> | 2008-07-10 16:50:05 -0400 |
---|---|---|
committer | Jameson Graef Rollins <jrollins@phys.columbia.edu> | 2008-07-10 16:50:05 -0400 |
commit | 13298a58b39438ae9892194578b8b8f3d3b6013a (patch) | |
tree | 946b6de773d2f167824783d01910d47a2df6a243 /src/monkeysphere | |
parent | 5fadec09dcd44c4dcad657a0f3d96878b592b77b (diff) |
Added file permission check function, and fixed bug in key writing for
untranslated keys.
Diffstat (limited to 'src/monkeysphere')
-rwxr-xr-x | src/monkeysphere | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/monkeysphere b/src/monkeysphere index a25fd6a..cfd5735 100755 --- a/src/monkeysphere +++ b/src/monkeysphere @@ -24,6 +24,9 @@ unset GREP_OPTIONS # default return code RETURN=0 +# set the file creation mask to be only owner rw +umask 077 + ######################################################################## # FUNCTIONS ######################################################################## @@ -204,6 +207,10 @@ case $COMMAND in 'update-known_hosts'|'update-known-hosts'|'k') MODE='known_hosts' + if ! check_key_file_permissions "$USER" "$KNOWN_HOSTS" ; then + failure "Improper permissions on known_hosts file." + fi + # if hosts are specified on the command line, process just # those hosts if [ "$1" ] ; then @@ -227,7 +234,11 @@ case $COMMAND in # fail if the authorized_user_ids file is empty if [ ! -s "$AUTHORIZED_USER_IDS" ] ; then - failure "$AUTHORIZED_USER_IDS is empty or does not exist." + failure "authorized_user_ids file '$AUTHORIZED_USER_IDS' is empty or does not exist." + fi + + if ! check_key_file_permissions "$USER" "$AUTHORIZED_USER_IDS" ; then + failure "Improper permissions on authorized_user_ids file." fi # process authorized_user_ids file |