Fix network creds

Convert backslash to ; for domain\username
This commit is contained in:
angelblue05 2017-07-27 18:07:00 -05:00
parent 37a7ea47d7
commit 299a0bd8f9
1 changed files with 4 additions and 3 deletions

View File

@ -320,19 +320,20 @@ def passwordsXML():
for path in root.findall('.//path'): for path in root.findall('.//path'):
if path.find('.//from').text.lower() == "smb://%s/" % server.lower(): if path.find('.//from').text.lower() == "smb://%s/" % server.lower():
# Found the server, rewrite credentials # Found the server, rewrite credentials
path.find('.//to').text = "smb://%s:%s@%s/" % (user, password, server) topath = "smb://%s:%s@%s/" % (user, password, server)
path.find('.//to').text = topath.replace("\\", ";")
break break
else: else:
# Server not found, add it. # Server not found, add it.
path = etree.SubElement(root, 'path') path = etree.SubElement(root, 'path')
etree.SubElement(path, 'from', attrib={'pathversion': "1"}).text = "smb://%s/" % server etree.SubElement(path, 'from', attrib={'pathversion': "1"}).text = "smb://%s/" % server
topath = "smb://%s:%s@%s/" % (user, password, server) topath = "smb://%s:%s@%s/" % (user, password, server)
etree.SubElement(path, 'to', attrib={'pathversion': "1"}).text = topath etree.SubElement(path, 'to', attrib={'pathversion': "1"}).text = topath.replace("\\", ";")
# Force Kodi to see the credentials without restarting # Force Kodi to see the credentials without restarting
xbmcvfs.exists(topath) xbmcvfs.exists(topath)
# Add credentials # Add credentials
settings('networkCreds', value="%s" % server) settings('networkCreds', value=server)
log.info("Added server: %s to passwords.xml" % server) log.info("Added server: %s to passwords.xml" % server)
# Prettify and write to file # Prettify and write to file
try: try: