From 268008e499f2fe0043f80a0882d7ac366123bf9e Mon Sep 17 00:00:00 2001 From: Viktor Dragomiretskyy Date: Fri, 3 Jul 2020 10:33:58 +1200 Subject: [PATCH] Revert "Use root as a default username when clients do not specify any" This reverts commit 4f8c061f533e4d9a75cdaeaac7f0378f2597dcf4. --- dbus-service.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/dbus-service.py b/dbus-service.py index f382cb6..054bd3c 100644 --- a/dbus-service.py +++ b/dbus-service.py @@ -12,8 +12,6 @@ import pwd print("Starting up") -default_username='root' - loop = GLib.MainLoop() usb.quit = lambda e: loop.quit() @@ -23,7 +21,7 @@ def uname2identity(uname): # For some reason Gnome enrollment UI does not send the user name # (it also ignores our num-enroll-stages attribute). I probably should upgrade Gnome print('No username specified. ') - uname = default_username + uname = 'unicorn' pw=pwd.getpwnam(uname) sidstr='S-1-5-21-111111111-1111111111-1111111111-%d' % pw.pw_uid return sid_from_string(sidstr) @@ -41,12 +39,10 @@ class Device(): def Claim(self, usr): print('In Claim %s' % usr) - self.claim_user = usr def Release(self): print('In Release') self.caimed = False - self.claim_user = None def ListEnrolledFingers(self, usr): try: @@ -99,13 +95,11 @@ class Device(): db.del_record(usr.dbid) - def do_enroll(self, finger_name, user): + def do_enroll(self, finger_name): # it is pointless to try and remember username passed in claim as Gnome does not seem to be passing anything useful anyway try: - if not user: - print('Warning: Username was not passed, using a hardcoded username "%s"' % user) - # TODO Convert fingername to WINBIO finger id e.g 0xf5 - z=enroll(uname2identity(user), 0xf5) + # hardcode the username and finger for now + z=enroll(uname2identity('unicorn'), 0xf5) print('Enroll was successfull') self.EnrollStatus('enroll-completed', True) except Exception as e: @@ -115,7 +109,7 @@ class Device(): def EnrollStart(self, finger_name): print('In EnrollStart %s' % finger_name) - Thread(target=lambda: self.do_enroll(finger_name, self.claim_user)).start() + Thread(target=lambda: self.do_enroll(finger_name)).start() def EnrollStop(self):