Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I run vlc like:

vlc -I http

I open up users to browse my whole system directory structure. This is too much.

For example at the page http://localhost:8080/vlm.html I can click Edit on the Input field, then click Browse. On the pop-up I can continue to click '..'.

I want to open this server up so that I can access it remotely, but I do not want to expose my whole system directory structure.

How can I restrict the browse functionality to a specific sub-tree?

share|improve this question
add comment

2 Answers 2

Edit %ProgramFiles(x86)%\VideoLAN\VLC\http\requests\browse.xml as Admin (you don't have to restart VLC) like below. Add the 3 lines that are marked by a + (which you should no include).

 <root>
 <vlc id="if" param1="url_param 1 =" />
   <vlc id="rpn" param1="'dir' url_extract" />
+  <element type="directory" size="" date="" path="X:\\SomeFolder" name="Media Root" extension="" />
   <vlc id="foreach" param1="file" param2="directory" />
+    <vlc id="if" param1="file.name value 'X:\\SomeFolder' 13 strncmp 0 =" />
     <vlc id="if" param1="file.basename value '.' 1 strncmp 0 != file.basename value '..' 2 strncmp 0 = |" />
       <element type="<vlc id="value" param1="file.type" />" size="<vlc id="value" param1="file.size" />" date="<vlc id="value"  param1="file.date" />" path="<vlc id="value" param1="file.name value xml_encode" />" name="<vlc id="value" param1="file. basename value xml_encode" />" extension="<vlc id="value" param1="file.ext value xml_encode" />" />
     <vlc id="end" />
+    <vlc id="end" />
   <vlc id="end" />
 <vlc id="end" />
 </root>

Note that 'X:\\SomeFolder' 13 the 13 if the length of the string X:\SomeFolder (so as to compare only the beginning of the path.

The original post comes from http://forum.videolan.org/viewtopic.php?f=2&t=84663

share|improve this answer
    
That's the same as the answer I arrived at. And your source is me again (as Lafcadio). But thanks for posting a Windows version. It's important to note, also that 13 in the 2nd + line is the length of the path (in your case X:\SomeFolder). –  Geoff Nov 1 '12 at 0:49
add comment
up vote 0 down vote accepted

As suggested by a developer in this forum, I have modified browse.xml to give the desired behavior.

I added a predicate to the browse.xml file to check if the current directory starts with /library/ (the path I want to make the root).

<vlc id="if" param1="file.name value '/library/' 9 strncmp 0 =" />
...
<vlc id="end" />

Where 9 is the length of the path (in my case '/library/'. Also, added an entry to every directory listing to link back to this desired root.

<element type="directory" size="" date="" path="/library/" name="Media Root" extension="" />

The full browse.xml file is now:

<vlc id="end" />

<root>
<vlc id="if" param1="url_param 1 =" />
  <vlc id="rpn" param1="'dir' url_extract" />
  <element type="directory" size="" date="" path="/library/" name="Media Root" extension="" />
  <vlc id="foreach" param1="file" param2="directory" />
    <vlc id="if" param1="file.name value '/library/' 9 strncmp 0 =" />
      <vlc id="if" param1="file.basename value '.' 1 strncmp 0 != file.basename value '..' 2 strncmp 0 = |" />
        <element type="<vlc id="value" param1="file.type" />" size="<vlc id="value" param1="file.size" />" date="<vlc id="value" param1="file.date" />" path="<vlc id="value" param1="file.name value xml_encode" />" name="<vlc id="value" param1="file.basename value xml_encode" />" extension="<vlc id="value" param1="file.ext value xml_encode" />" />
      <vlc id="end" />
    <vlc id="end" />
  <vlc id="end" />
<vlc id="end" />
</root>

If you have a better way, please suggest it. Another option for security is to edit the .hosts file so that only local traffic can interact with the VLC server. You can then setup point to point VPN server to encrypt, and password protect access. (Details are outside the scope of this answer.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.