Sfoglia il codice sorgente

allow escape characters in password

version-14
Anand Doshi 14 anni fa
parent
commit
25609d0b25
2 ha cambiato i file con 9 aggiunte e 2 eliminazioni
  1. +4
    -1
      cgi-bin/webnotes/model/db_schema.py
  2. +5
    -1
      cgi-bin/webnotes/utils/__init__.py

+ 4
- 1
cgi-bin/webnotes/model/db_schema.py Vedi File

@@ -357,8 +357,11 @@ class DbManager:
mysql_path = getattr(webnotes.defs, 'mysql_path', None)
mysql = mysql_path and os.path.join(mysql_path, 'mysql') or 'mysql'
from webnotes.utils import make_esc
esc = make_esc('$ ')
try:
ret = os.system("%s -u root -p%s %s < %s"%(mysql, root_password.replace(" ", "\ "), target.replace("$", "\$"), source))
ret = os.system("%s -u root -p%s %s < %s"%(mysql, esc(root_password), esc(target), source))
except Exception,e:
raise e



+ 5
- 1
cgi-bin/webnotes/utils/__init__.py Vedi File

@@ -636,6 +636,10 @@ def get_file_timestamp(fn):
else:
return None


def make_esc(esc_chars):
"""
Function generator for Escaping special characters
"""
return lambda s: ''.join(['\\' + c if c in esc_chars else c for c in s])


Caricamento…
Annulla
Salva