explicity set the USER variable, since it's needed for checking file permissions...
authorJameson Graef Rollins <jrollins@finestructure.net>
Sun, 1 Mar 2009 20:27:36 +0000 (15:27 -0500)
committerJameson Graef Rollins <jrollins@finestructure.net>
Sun, 1 Mar 2009 20:27:36 +0000 (15:27 -0500)
src/monkeysphere
src/share/common
src/share/ma/update_users

index 8d59d08870727d99f07784241470d838c8d50f2f..aa9276cc426ece8925f55f475db789d704deeb3a 100755 (executable)
@@ -189,6 +189,9 @@ export GNUPGHOME
 mkdir -p -m 0700 "$GNUPGHOME"
 export LOG_LEVEL
 
+# explicitly set the USER variable, for checking file permissions
+export USER=$(whoami)
+
 # get subcommand
 COMMAND="$1"
 [ "$COMMAND" ] || failure "Type '$PGRM help' for usage."
index 1cdd54943d2909f9aaee7a87a33cf6d18e21e7c8..c6d6b8e66e46097753b6a40323de0411367588f4 100644 (file)
@@ -427,13 +427,15 @@ check_key_file_permissions() {
 
     # return 1 if path has invalid owner
     if [ "$owner" != "$uname" -a "$owner" != 'root' ] ; then
-       log error "improper ownership on path '$path'."
+       log error "improper ownership on path '$path':"
+       log error " $owner != ($uname|root)"
        return 1
     fi
 
     # return 2 if path has group or other writability
     if is_write "$gAccess" || is_write "$oAccess" ; then
-       log error "improper group or other writability on path '$path'."
+       log error "improper group or other writability on path '$path':"
+       log error " group: $gAccess, other: $oAcess"
        return 2
     fi
 
@@ -667,14 +669,14 @@ process_user_id() {
                if [ "$keyOK" -a "$uidOK" -a "$lastKeyOK" ] ; then
                    log verbose "  * acceptable primary key."
                    if [ -z "$sshKey" ] ; then
-                       log error "    ! primary key could not be translated (not RSA or DSA?)."
+                       log error "    ! primary key could not be translated (not RSA?)."
                    else
                        echo "0:${sshKey}"
                    fi
                else
                    log debug "  - unacceptable primary key."
                    if [ -z "$sshKey" ] ; then
-                       log debug "    ! primary key could not be translated (not RSA or DSA?)."
+                       log debug "    ! primary key could not be translated (not RSA?)."
                    else
                        echo "1:${sshKey}"
                    fi
@@ -725,14 +727,14 @@ process_user_id() {
                if [ "$keyOK" -a "$uidOK" -a "$lastKeyOK" ] ; then
                    log verbose "  * acceptable sub key."
                    if [ -z "$sshKey" ] ; then
-                       log error "    ! sub key could not be translated (not RSA or DSA?)."
+                       log error "    ! sub key could not be translated (not RSA?)."
                    else
                        echo "0:${sshKey}"
                    fi
                else
                    log debug "  - unacceptable sub key."
                    if [ -z "$sshKey" ] ; then
-                       log debug "    ! sub key could not be translated (not RSA or DSA?)."
+                       log debug "    ! sub key could not be translated (not RSA?)."
                    else
                        echo "1:${sshKey}"
                    fi
index 3a5c006e8f560f6ba2a58130bdb59bf47af659d4..195e9828f8c49a937647963b9a4dbab567a86559 100644 (file)
@@ -88,6 +88,7 @@ for uname in $unames ; do
            cat "$authorizedUserIDs" > "$TMP_AUTHORIZED_USER_IDS"
 
            # export needed variables
+           export USER="$uname"
            export AUTHORIZED_KEYS
            export TMP_AUTHORIZED_USER_IDS