>From 988f00c2c635a4ce48999dc219dd4edab75c8846 Mon Sep 17 00:00:00 2001
From: Karol Lewandowski <[email protected]>
Date: Thu, 14 Oct 2010 16:58:36 +0200
Subject: [PATCH 1/3] slp2: Make file pointed by $SSH_AUTH_SOCK available despite of other mapping rules

Change-Id: I5beb34c87e21a539500a3a069f2992d19e21b2c7
---
 lua_scripts/mapping.lua                     |   28 +++++++++++++++++++++++++++
 lua_scripts/pathmaps/emulate/00_default.lua |    5 ++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/lua_scripts/mapping.lua b/lua_scripts/mapping.lua
index f783232..1d0ca36 100644
--- a/lua_scripts/mapping.lua
+++ b/lua_scripts/mapping.lua
@@ -110,6 +110,33 @@ function get_active_exec_policy()
 	return active_exec_policy_ptr
 end
 
+-- Override mapping rules from override_nomap table
+--  Each entry from table override_nomap should specify path that shouldn't be remapped
+--  Entries from this table will be searched before all other rules
+function override_export_chains()
+	if (not override_nomap) then
+		return export_chains
+	end
+
+	override_chain = {
+		next_chain = export_chains[1],
+		binary = nil,
+		rules = { },
+	}
+
+	for i, key in pairs(override_nomap) do
+		if (key) then
+			table.insert(override_chain.rules, {path = key, use_orig_path = true})
+		end
+	end
+
+	local new_chain = { override_chain, }
+	for i, key in pairs(export_chains) do
+		table.insert(new_chain, key)
+	end
+	return new_chain
+end
+
 -- Load mode-specific rules.
 -- A mode file must define three variables:
 --  1. rule_file_interface_version (string) is checked and must match,
@@ -188,6 +215,7 @@ function load_and_check_rules()
 	local current_rule_interface_version = "25"
 
 	do_file(rule_file_path)
+	export_chains = override_export_chains()
 
 	-- fail and die if interface version is incorrect
 	if (rule_file_interface_version == nil) or 
diff --git a/lua_scripts/pathmaps/emulate/00_default.lua b/lua_scripts/pathmaps/emulate/00_default.lua
index 91101d2..1bf9f06 100644
--- a/lua_scripts/pathmaps/emulate/00_default.lua
+++ b/lua_scripts/pathmaps/emulate/00_default.lua
@@ -220,6 +220,11 @@ local pwd_chain = {
 	},
 }
 
+-- do not try to remap files from this table at all
+override_nomap = {
+	os.getenv("SSH_AUTH_SOCK"),
+}
+
 export_chains = {
 	dpkg_chain,
 	pwd_chain,
-- 
1.7.0.4

_______________________________________________
Scratchbox-devel mailing list
[email protected]
http://lists.scratchbox.org/cgi-bin/mailman/listinfo/scratchbox-devel

Reply via email to