[vlc-commits] Lua http: remove ACL in favor of the password

Rémi Denis-Courmont git at videolan.org
Sun Apr 1 22:18:09 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr  1 22:47:30 2012 +0300| [fe31e42032f3e14d55eb57c73ab7070e5aafcce6] | committer: Rémi Denis-Courmont

Lua http: remove ACL in favor of the password

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fe31e42032f3e14d55eb57c73ab7070e5aafcce6
---

 share/Makefile.am             |    2 --
 share/lua/http/.hosts         |   24 ------------------------
 share/lua/http/dialogs/.hosts |    2 --
 share/lua/intf/http.lua       |   36 ++++++++++++------------------------
 4 files changed, 12 insertions(+), 52 deletions(-)

diff --git a/share/Makefile.am b/share/Makefile.am
index 0794c7f..cc00c68 100644
--- a/share/Makefile.am
+++ b/share/Makefile.am
@@ -283,7 +283,6 @@ DIST_http_lua = \
 	lua/http/dialogs/batch_window.html \
 	lua/http/dialogs/error_window.html \
 	lua/http/dialogs/browse_window.html \
-	lua/http/dialogs/.hosts \
 	lua/http/dialogs/stream_window.html \
 	lua/http/dialogs/offset_window.html \
 	lua/http/dialogs/stream_config_window.html \
@@ -346,7 +345,6 @@ DIST_http_lua = \
 	lua/http/mobile_browse.html \
 	lua/http/favicon.ico \
 	lua/http/mobile_view.html \
-	lua/http/.hosts \
 	lua/http/requests/playlist.xml \
 	lua/http/requests/playlist.json \
 	lua/http/requests/README.txt \
diff --git a/share/lua/http/.hosts b/share/lua/http/.hosts
deleted file mode 100644
index 6f54ae0..0000000
--- a/share/lua/http/.hosts
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Access-list for VLC HTTP interface
-# $Id$
-#
-
-# localhost
-::1
-127.0.0.1
-
-# link-local addresses
-#fe80::/64
-
-# private addresses
-#fc00::/7
-#fec0::/10
-#10.0.0.0/8
-#172.16.0.0/12
-#192.168.0.0/16
-#169.254.0.0/16
-
-# The world (uncommenting these 2 lines is not quite safe)
-#::/0
-#0.0.0.0/0
-
diff --git a/share/lua/http/dialogs/.hosts b/share/lua/http/dialogs/.hosts
deleted file mode 100644
index bec63ac..0000000
--- a/share/lua/http/dialogs/.hosts
+++ /dev/null
@@ -1,2 +0,0 @@
-# This file is an empty access list. Leave it as is.
-# You are not supposed to access files from this directory directly.
diff --git a/share/lua/intf/http.lua b/share/lua/intf/http.lua
index aa0f156..dc7d5d3 100644
--- a/share/lua/intf/http.lua
+++ b/share/lua/intf/http.lua
@@ -116,7 +116,7 @@ function callback_error(path,url,msg)
 </html>]]
 end
 
-function dirlisting(url,listing,acl_)
+function dirlisting(url,listing)
     local list = {}
     for _,f in ipairs(listing) do
         if not string.match(f,"^%.") then
@@ -134,7 +134,7 @@ function dirlisting(url,listing,acl_)
 </body>
 </html>]]
     end
-    return h:file(url,"text/html",nil,password,acl_,callback,nil)
+    return h:file(url,"text/html",nil,password,nil,callback,nil)
 end
 
 -- FIXME: Experimental art support. Needs some cleaning up.
@@ -181,7 +181,7 @@ Error
     return content
 end
 
-function file(h,path,url,acl_,mime)
+function file(h,path,url,mime)
     local generate_page = process(path)
     local callback = function(data,request)
         -- FIXME: I'm sure that we could define a real sandbox
@@ -207,10 +207,10 @@ function file(h,path,url,acl_,mime)
         end
         return table.concat(page)
     end
-    return h:file(url or path,mime,nil,password,acl_,callback,nil)
+    return h:file(url or path,mime,nil,password,nil,callback,nil)
 end
 
-function rawfile(h,path,url,acl_)
+function rawfile(h,path,url)
     local filename = path
     local mtime = 0    -- vlc.net.stat(filename).modification_time
     local page = false -- io.open(filename):read("*a")
@@ -228,7 +228,7 @@ function rawfile(h,path,url,acl_)
         end
         return page
     end
-    return h:file(url or path,nil,nil,password,acl_,callback,nil)
+    return h:file(url or path,nil,nil,password,nil,callback,nil)
 end
 
 function parse_url_request(request)
@@ -278,19 +278,9 @@ do
     package.path = oldpath
 end
 local files = {}
-local function load_dir(dir,root,parent_acl)
+local function load_dir(dir,root)
     local root = root or "/"
     local has_index = false
-    local my_acl = parent_acl
-    do
-        local af = dir.."/.hosts"
-        local s = vlc.net.stat(af)
-        if s and s.type == "file" then
-            -- We found an acl
-            my_acl = vlc.acl(false)
-            my_acl:load_file(af)
-        end
-    end
     local d = vlc.net.opendir(dir)
     for _,f in ipairs(d) do
         if not string.match(f,"^%.") then
@@ -307,20 +297,19 @@ local function load_dir(dir,root,parent_acl)
                 local mime = mimes[ext]
                 -- print(url,mime)
                 if mime and string.match(mime,"^text/") then
-                    table.insert(files,file(h,dir.."/"..f,url,my_acl,mime))
+                    table.insert(files,file(h,dir.."/"..f,url,mime))
                 else
-                    table.insert(files,rawfile(h,dir.."/"..f,url,my_acl))
+                    table.insert(files,rawfile(h,dir.."/"..f,url))
                 end
             elseif s.type == "dir" then
-                load_dir(dir.."/"..f,root..f.."/",my_acl)
+                load_dir(dir.."/"..f,root..f.."/")
             end
         end
     end
     if not has_index and not config.no_index then
         -- print("Adding index for", root)
-        table.insert(files,dirlisting(root,d,my_acl))
+        table.insert(files,dirlisting(root,d))
     end
-    return my_acl
 end
 
 if config.host then
@@ -331,5 +320,4 @@ end
 
 password = vlc.var.inherit(nil,"http-password")
 h = vlc.httpd()
-local root_acl = load_dir( http_dir )
-local a = h:handler("/art",nil,password,root_acl,callback_art,nil)
+local a = h:handler("/art",nil,password,nil,callback_art,nil)



More information about the vlc-commits mailing list