]> diplodocus.org Git - nmh/commitdiff
Alter netrc permissions error message to match code. Add test.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sat, 22 Oct 2016 18:18:15 +0000 (19:18 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sat, 22 Oct 2016 18:18:15 +0000 (19:18 +0100)
The code wants `go=', but the error message, and FAQ, said to clear read
permission from group and other.  Add test to inc/test-pop as that is
the existing netrc test location, but it might be better in its own test
file as other tests for netrc parsing could be added.

docs/FAQ
sbr/ruserpass.c
test/inc/test-pop

index ce12eaa..066fbb9 100644 (file)
--- a/docs/FAQ
+++ b/docs/FAQ
@@ -2008,8 +2008,8 @@ Date: Mon, 1 May 1995 00:00:00 -0800
 
     inc: -noaudit -norpop -noapop -host cuckoo
 
-  Add the following to ~/.netrc and ensure it is readable only by you
-  (e.g., chmod 600 .netrc):
+  Add the following to ~/.netrc and ensure it [grants no permissions to
+  group or other] (e.g., chmod 600 .netrc):
 
     machine cuckoo.domain.name login joeuser password secret
 
index f5fc6bd..43784d5 100644 (file)
@@ -107,8 +107,8 @@ ruserpass(const char *host, char **aname, char **apass, int flags)
                            (stb.st_mode & 077) != 0) {
                            /* We make this a fatal error to force the
                               user to correct it. */
-                           advise(NULL, "Error - file %s must not be world or "
-                                  "group readable.", credentials_file);
+                            advise(NULL, "group or other permissions, %#o, "
+                                "forbidden: %s", stb.st_mode, credentials_file);
                            adios(NULL, "Remove password or correct file "
                                  "permissions.");
                        }
index 0ae8029..db21c31 100755 (executable)
@@ -70,6 +70,14 @@ Date: Tuesday, 19 Dec 2006 4:15:16 -0500
 Dude, nmh is totally brutal.
 EOM
 
+# Check netrc's permissions test
+pid=`"${MH_OBJ_DIR}/test/fakepop" "$testport" '' '' "$testmessage"`
+chmod g=w,o=x $netrc
+run_test "inc -user ${TESTUSER} -host 127.0.0.1 -port $testport" \
+        "inc: group or other permissions, 0100621, forbidden: $netrc
+inc: Remove password or correct file permissions."
+chmod go= $netrc
+
 pid=`"${MH_OBJ_DIR}/test/fakepop" "$testport" \
                        "$TESTUSER" "$TESTPASS" "$testmessage"`