X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fshare%2Fcommon;h=76b539f4ab89dc9ddd8d585a751f64ed4f514430;hb=ba3ca3e10f4975510dfeedcb6dfe8e2374ca3097;hp=11e7969952f2b8dfb2cca4f1f87cd4959ca38f89;hpb=c2a85da2be8f884cb7e96f05d8a37dcb6ddd80b5;p=monkeysphere.git diff --git a/src/share/common b/src/share/common index 11e7969..76b539f 100644 --- a/src/share/common +++ b/src/share/common @@ -425,6 +425,12 @@ check_key_file_permissions() { log debug "checking path permission '$path'..." + # rewrite path if it points to a symlink + if [ -h "$path" ] ; then + path=$(readlink -f "$path") + log debug "checking path symlink '$path'..." + fi + # return 255 if cannot stat file if ! stat=$(ls -ld "$path" 2>/dev/null) ; then log error "could not stat path '$path'." @@ -477,6 +483,12 @@ get_homedir() { eval "echo ~${uname}" } +# return the primary group of a user +get_primary_group() { + local uname=${1:-`whoami`} + groups "$uname" | sed 's/^..* : //' | awk '{ print $1 }' +} + ### CONVERSION UTILITIES # output the ssh key for a given key ID