pam/pam-1.1.4-access-split.patch

36 lines
1.2 KiB
Diff

commit 61f4f06abc9b8fcb3c478fa430b52499fd2ca300
Author: Tomas Mraz <tmraz@fedoraproject.org>
Date: Thu Aug 25 15:48:51 2011 +0200
Fix the split on @ in the user field. (Red Hat Bug #732081)
diff --git a/ChangeLog b/ChangeLog
index 7563098..b4f1ef8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-25 Tomas Mraz <tm@t8m.info>
+
+ * modules/pam_access/pam_access.c (user_match): Fix the split
+ on @ in the user field. (Red Hat Bug #732081)
+
2011-08-23 Tomas Mraz <tm@t8m.info>
* modules/pam_env/pam_env.c (_pam_parse): Fix missing dereference.
diff --git a/modules/pam_access/pam_access.c b/modules/pam_access/pam_access.c
index 0eb1e8c..472116c 100644
--- a/modules/pam_access/pam_access.c
+++ b/modules/pam_access/pam_access.c
@@ -521,7 +521,10 @@ user_match (pam_handle_t *pamh, char *tok, struct login_info *item)
* name of the user's primary group.
*/
- if (tok[0] != '@' && (at = strchr(tok + 1, '@')) != 0) {
+ /* Try to split on a pattern (@*[^@]+)(@+.*) */
+ for (at = tok; *at == '@'; ++at);
+
+ if ((at = strchr(at, '@')) != NULL) {
/* split user@host pattern */
if (item->hostname == NULL)
return NO;