group: introduce type auth_type, extend for PAM module

This commit is contained in:
Peter Bieringer
2026-07-19 14:35:18 +02:00
parent 912ea717a8
commit d9a0284996
7 changed files with 22 additions and 14 deletions

View File

@@ -106,7 +106,7 @@ class AuthContext:
class BaseAuth:
_ldap_groups: Set[str] = set([])
_groups: Set[str] = set([])
_urldecode_username: bool
_lc_username: bool
_uc_username: bool

View File

@@ -381,8 +381,8 @@ class Auth(auth.BaseAuth):
tmp.append(rdns[0][1])
except Exception:
tmp.append(g)
self._ldap_groups = set(tmp)
logger.debug("_login3 LDAP groups of user: %s", ",".join(self._ldap_groups))
self._groups = set(tmp)
logger.debug("_login3 LDAP groups of user: %s", ",".join(self._groups))
if self._ldap_user_attr:
if user_entry['attributes'][self._ldap_user_attr]:

View File

@@ -97,6 +97,11 @@ class Auth(auth.BaseAuth):
else:
logger.debug("PAM user %r belongs to the required group: %r" % (login, self._group_membership))
# add groups
members.append(primary_group)
self._groups = set(members)
logger.debug("PAM groups of user: %s", ",".join(self._groups))
# Check the password
if self.pam_authenticate(login, password, service=self._service):
return login