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?

link|improve this question
feedback

1 Answer

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" />

And 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 home.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.)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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