# # # patch "ChangeLog" # from [deb04eb13ed244f6a5db9a8607cef6f8177956d4] # to [3ee3b087ec76af929e5b0cd397f2149723b7d6c1] # # patch "lua.cc" # from [8deb54acf04866ce9efc90c7c7c3f250eb55efe2] # to [b2a3ac1c0d97220cf47871563c46be7b6e27a1fe] # # patch "std_hooks.lua" # from [c0c275a2e2dcefebf0acf6e27de9c3fb86e4481e] # to [f9dbc7677955dc51c63b98691eff0a297967b37d] # ============================================================ --- ChangeLog deb04eb13ed244f6a5db9a8607cef6f8177956d4 +++ ChangeLog 3ee3b087ec76af929e5b0cd397f2149723b7d6c1 @@ -1,3 +1,12 @@ +2006-01-10 Richard Levitte + + * lua.cc (monotone_parse_basic_io_for_lua): Don't trust the + returned value from lua_tostring() to stick around. Instead, copy + it into a regular std::string. + * std_hooks.lua (get_netsync_read_permissions, + get_netsync_write_permissions): Make sure to properly close the + permission files. + 2006-01-09 Richard Levitte * contrib/usher.cc, monotone.1, monotone.cc, po/fr.po, po/ja.po, ============================================================ --- lua.cc 8deb54acf04866ce9efc90c7c7c3f250eb55efe2 +++ lua.cc b2a3ac1c0d97220cf47871563c46be7b6e27a1fe @@ -684,7 +684,7 @@ monotone_parse_basic_io_for_lua(lua_State *L) { vector > > res; - const char *str = lua_tostring(L, -1); + const string str(lua_tostring(L, -1), lua_strlen(L, -1)); basic_io::input_source in(str, "monotone_parse_basic_io_for_lua"); basic_io::tokenizer tok(in); try ============================================================ --- std_hooks.lua c0c275a2e2dcefebf0acf6e27de9c3fb86e4481e +++ std_hooks.lua f9dbc7677955dc51c63b98691eff0a297967b37d @@ -810,6 +810,7 @@ local permfile = io.open(get_confdir() .. "/read-permissions", "r") if (permfile == nil) then return false end local dat = permfile:read("*a") + io.close(permfile) local res = parse_basic_io(dat) if res == nil then io.stderr:write("file read-permissions cannot be parsed\n") @@ -853,13 +854,14 @@ if (permfile == nil) then return false end + local matches = false local line = permfile:read() - while (line ~= nil) do + while (not matches and line ~= nil) do local _, _, ln = string.find(line, "%s*([^%s]*)%s*") - if ln == "*" then return true end - if globish_match(ln, ident) then return true end + if ln == "*" then matches = true end + if globish_match(ln, ident) then matches = true end line = permfile:read() end io.close(permfile) - return false + return matches end