Kodi Community Forum
How exactly does passwords.xml work? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: How exactly does passwords.xml work? (/showthread.php?tid=351217)



How exactly does passwords.xml work? - redec - 2020-01-24

I'd like to understand exactly how the substitutions in passwords.xml are applied, because I am moving my media library to a new server, and I can't figure out how my old/current one works at all Smile. Strangely, passwords.xml is hardly even mentioned in the wiki, and it's suspiciously absent from the userdata page.

Do the substitutions have to match exactly? Like a straight string replacement? Or is there some fuzzy/advanced logic? If multiple passwords.xml paths match, how does it choose which one to use?

The reason I'm confused is all my media has their paths set like "smb://ipaddr/path/to/media.mkv" in the db. I have a record in passwords.xml that prefix-matches it exactly, (<from>smb://ipaddr/path</from>) but the <to> value actually has an invalid path in it...so if it was using that one it wouldn't be able to find any of my media. There is another record in the form of <from>smb://hostname</from> (where hostname resolves to ipaddr) which has a valid <to> path, so I assume it must be using that record...but I don't know how it figured out to use that one instead. Anyone have any insights? Thanks!


RE: How exactly does passwords.xml work? - redec - 2020-01-28

So...for anyone else who is curious, here is what I found out by looking at the source code:
  • To decide which record to use:
    1. first, it will try an exact match of protocol://host/first-directory-only in the <from> tag
    2. if no match is found, it will look for any record that starts with protocol://host in the <from> tag, and it will use the *last* one it finds (based on the order of the records in the file)
  • Once it finds the record to use, it only grabs the username and password from the <to> field - it doesn't care about the rest of the url at all, nothing else is substituted



RE: How exactly does passwords.xml work? - deep square leg - 2021-02-28

Thanks heaps for this, with the SMB changes in Matrix (Android) I wanted to use the passwords.xml file to start faking a password (so that I didn't have to update all of my network links). Searched everywhere to determine how it worked, this was perfect.