WebInterface: Add experimental browser based stream player. Test it on your local...
[enigma2-plugins.git] / webinterface / src / auth.py
1 # Password verfication stuff
2 from crypt import crypt
3 from pwd import getpwnam
4 from spwd import getspnam
5
6 def check_passwd(name, passwd):
7         cryptedpass = None
8         try:
9                 cryptedpass = getpwnam(name)[1]
10         except:
11                 return False
12
13         #shadowed or not, that's the questions here
14         if cryptedpass == 'x' or cryptedpass == '*':
15                 try:
16                         cryptedpass = getspnam(name)[1]
17                 except:
18                         return False
19
20         if cryptedpass == '':
21                 return True
22
23         return crypt(passwd, cryptedpass) == cryptedpass