X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fshare%2Fcommon;h=76b539f4ab89dc9ddd8d585a751f64ed4f514430;hb=ba3ca3e10f4975510dfeedcb6dfe8e2374ca3097;hp=f954bb94a071d6d78891878d526be950bbe488b1;hpb=c514677a32ef4a3264898a389902ac973ebc3507;p=monkeysphere.git diff --git a/src/share/common b/src/share/common index f954bb9..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'." @@ -466,6 +472,8 @@ list_users() { elif type dscl &>/dev/null ; then # for Darwin systems dscl localhost -list /Search/Users + else + failure "Neither getent or dscl is in the path! Could not determine list of users." fi } @@ -475,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