monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] net.venge.monotone: 30eb25d40766813d72fde9f68b


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone: 30eb25d40766813d72fde9f68b3ff1ab8581f2d0
Date: Fri, 18 Feb 2011 20:54:38 +0100 (CET)

revision:            30eb25d40766813d72fde9f68b3ff1ab8581f2d0
date:                2011-02-15T06:10:40
author:              Richard Levitte <address@hidden>
branch:              net.venge.monotone
changelog:
* contrib/authorize_remote_automate.lua: Moved ...
* extra/mtn-hooks/authorize_remote_automate.lua: ... here.  This hook
  grants access to the 'automate remote' and 'automate remote_stdio'
  commands on basis of a key (through identity in
  {confdir}/remote-automate-permissions) or the commands being safe
  (defined by the lua variable ARA_safe_commands, which is set up
  elsewhere, before loading this file).
* test/extra/authorize-remote-automate/__driver__.lua: New test for the
  script above.

manifest:
format_version "1"

new_manifest [1e804ee672ac159e0223005b48c967ad7ad6475b]

old_revision [238c48f5697cd34d450ae6171af120da293baf08]

rename "contrib/authorize_remote_automate.lua"
    to "extra/mtn-hooks/authorize_remote_automate.lua"

add_dir "test/extra/authorize-remote-automate"

add_file "test/extra/authorize-remote-automate/__driver__.lua"
 content [6fb281d67d778b720282319d07515d810382c3a4]
============================================================
--- /dev/null	
+++ test/extra/authorize-remote-automate/__driver__.lua	6fb281d67d778b720282319d07515d810382c3a4
@@ -0,0 +1,42 @@
+includecommon("netsync.lua")
+
+mtn_setup()
+
+mkdir("hooks.d")
+check(copy(srcdir.."/../extra/mtn-hooks/authorize_remote_automate.lua",
+	   "hooks.d/authorize_remote_automate.lua"))
+
+netsync.setup()
+append("netsync.lua", "\
+\
+includedirpattern(get_confdir() .. \"/hooks.d\",\"*.conf\")\
+includedirpattern(get_confdir() .. \"/hooks.d\",\"*.lua\")\
+")
+
+-- We serve test2.db in all the tests.  However, the monotone server needs
+-- to be restarted for every individual test since we're changing the
+-- configuration between them.
+
+-- Try with no permissions.  This should fail.
+srv = netsync.start(2)
+check(mtn("automate","remote","--remote-stdio-host",srv.address,
+	  "interface_version"), 1, false, false)
+srv:stop()
+
+-- Try with 'interface_version' declared safe for anonymous use.
+writefile("hooks.d/authorize_remote_automate.conf",
+	  "ARA_safe_commands = { \"interface_version\" }\n")
+srv = netsync.start(2)
+check(mtn("automate","remote","--remote-stdio-host",srv.address,
+	  "interface_version"), 0, true, false)
+check(qgrep("^[0-9]+\\.[0-9]+$", "stdout"))
+srv:stop()
+remove("hooks.d/authorize_remote_automate.conf")
+
+-- Try with permissions for the normal key
+writefile("remote-automate-permissions","address@hidden")
+srv = netsync.start(2)
+check(mtn("automate","remote","--remote-stdio-host",srv.address,
+	  "interface_version"), 0, true, false)
+check(qgrep("^[0-9]+\\.[0-9]+$", "stdout"))
+srv:stop()

reply via email to

[Prev in Thread] Current Thread [Next in Thread]