Ticket #659: 0001-if-no-auth-file-checks-if-that-user-has-log-in-capab.patch

File 0001-if-no-auth-file-checks-if-that-user-has-log-in-capab.patch, 1.3 KB (added by scientes, 15 years ago)

add simple pam fallback to daemon auth

  • deluge/core/authmanager.py

    From 5195b668cdf00c8ae03b182fde24e1ddaa082995 Mon Sep 17 00:00:00 2001
    From: scientes <instigatorirc@gmail.com>
    Date: Sun, 21 Dec 2008 07:45:30 -0800
    Subject: [PATCH] if no auth file checks if that user has log in capabilities against pam on server machine
     requires gem at http://atlee.ca/software/pam/
    
    ---
     deluge/core/authmanager.py |    7 ++++++-
     1 files changed, 6 insertions(+), 1 deletions(-)
    
    diff --git a/deluge/core/authmanager.py b/deluge/core/authmanager.py
    index 6b6347e..1b4eeb7 100644
    a b  
    2525import os.path 
    2626import random 
    2727import stat 
     28from pam import authenticate as pam_authenticate 
    2829 
    2930import deluge.component as component 
    3031import deluge.configmanager as configmanager 
    class AuthManager(component.Component): 
    5859            # Let's try to re-load the file.. Maybe it's been updated 
    5960            self.__load_auth_file() 
    6061            if username not in self.auth: 
    61                 return False 
     62                if username == os.getlogin(): 
     63                    if pam_authenticate(os.getlogin(), password, service='login'): 
     64                        return True 
     65                else: 
     66                    return False 
    6267 
    6368        if self.auth[username] == password: 
    6469            return True