Added info log output when a new key is added to known_hosts file.
authorJameson Graef Rollins <jrollins@finestructure.net>
Sun, 16 Nov 2008 01:49:27 +0000 (20:49 -0500)
committerJameson Graef Rollins <jrollins@finestructure.net>
Sun, 16 Nov 2008 01:49:27 +0000 (20:49 -0500)
packaging/debian/changelog
src/common

index 62f021e4b0adbc4ae256551f54a04015edefefb6..f1db03712835595ba24c3e05897e0948fff5a1cd 100644 (file)
@@ -1,3 +1,10 @@
+monkeysphere (0.22-1) UNRELEASED; urgency=low
+
+  * New upstream release:
+    - Added info log output when a new key is added to known_hosts file.
+
+ -- Jameson Graef Rollins <jrollins@finestructure.net>  Sat, 15 Nov 2008 20:49:13 -0500
+
 monkeysphere (0.21-2) unstable; urgency=low
 
   * actually rmdir /var/lib/monkeysphere-* during prerm if possible.
index 297e7f344c9d39686c94c1097ee587a142e51455..efee9bd69bc1c2389937b1fd66077b887a94a81d 100644 (file)
@@ -742,6 +742,7 @@ process_user_id() {
 process_host_known_hosts() {
     local host
     local userID
+    local noKey=
     local nKeys
     local nKeysOK
     local ok
@@ -768,8 +769,9 @@ process_host_known_hosts() {
             continue
         fi
 
-       # remove the old host key line, and note if removed
-       remove_line "$KNOWN_HOSTS" "$sshKey"
+       # remove any old host key line, and note if removed nothing is
+       # removed
+       remove_line "$KNOWN_HOSTS" "$sshKey" || noKey=true
 
        # if key OK, add new host line
        if [ "$ok" -eq '0' ] ; then
@@ -788,6 +790,11 @@ process_host_known_hosts() {
            else
                ssh2known_hosts "$host" "$sshKey" >> "$KNOWN_HOSTS"
            fi
+
+           # log if this is a new key to the known_hosts file
+           if [ "$noKey" ] ; then
+               log info "* new key for $host added to known_hosts file."
+           fi
        fi
     done