Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/nss-pam-ldapd: Add LCLASS Support
PR: 220379 Submitted by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
- Loading branch information
Showing
5 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
net/nss-pam-ldapd/files/lclass-patches/patch-nslcd__attmap.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- nslcd/attmap.c.orig 2019-11-02 16:23:45.000000000 +0100 | ||
+++ nslcd/attmap.c 2023-05-29 19:22:02.233300000 +0200 | ||
@@ -176,6 +176,7 @@ | ||
if (strcasecmp(name, "gecos") == 0) return &attmap_passwd_gecos; | ||
if (strcasecmp(name, "homeDirectory") == 0) return &attmap_passwd_homeDirectory; | ||
if (strcasecmp(name, "loginShell") == 0) return &attmap_passwd_loginShell; | ||
+ if (strcasecmp(name, "loginClass") ==0) return &attmap_passwd_loginClass; | ||
} | ||
else if (map == LM_PROTOCOLS) | ||
{ | ||
@@ -230,6 +231,7 @@ | ||
(var != &attmap_shadow_shadowWarning) && | ||
(var != &attmap_shadow_shadowInactive) && | ||
(var != &attmap_shadow_shadowExpire) && | ||
+ (var != &attmap_passwd_loginClass) && | ||
(var != &attmap_shadow_shadowFlag)) | ||
return NULL; | ||
/* the member attribute may only be set to an empty string */ |
10 changes: 10 additions & 0 deletions
10
net/nss-pam-ldapd/files/lclass-patches/patch-nslcd__attmap.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- nslcd/attmap.h.orig 2021-11-15 20:40:49.000000000 +0100 | ||
+++ nslcd/attmap.h 2023-05-29 19:22:02.233912000 +0200 | ||
@@ -67,6 +67,7 @@ | ||
extern const char *attmap_shadow_shadowInactive; | ||
extern const char *attmap_shadow_shadowExpire; | ||
extern const char *attmap_shadow_shadowFlag; | ||
+extern const char *attmap_passwd_loginClass; | ||
|
||
/* return a reference to the map specific base variable */ | ||
const char **base_get_var(enum ldap_map_selector map); |
43 changes: 43 additions & 0 deletions
43
net/nss-pam-ldapd/files/lclass-patches/patch-nslcd__passwd.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- nslcd/passwd.c.orig 2021-11-15 20:40:49.000000000 +0100 | ||
+++ nslcd/passwd.c 2023-05-29 19:22:02.234797000 +0200 | ||
@@ -63,6 +63,7 @@ | ||
const char *attmap_passwd_gecos = "\"${gecos:-$cn}\""; | ||
const char *attmap_passwd_homeDirectory = "homeDirectory"; | ||
const char *attmap_passwd_loginShell = "loginShell"; | ||
+const char *attmap_passwd_loginClass = "loginClass"; | ||
|
||
/* special properties for objectSid-based searches | ||
(these are already LDAP-escaped strings) */ | ||
@@ -150,6 +151,7 @@ | ||
attmap_add_attributes(set, attmap_passwd_gecos); | ||
attmap_add_attributes(set, attmap_passwd_homeDirectory); | ||
attmap_add_attributes(set, attmap_passwd_loginShell); | ||
+ attmap_add_attributes(set, attmap_passwd_loginClass); | ||
passwd_attrs = set_tolist(set); | ||
if (passwd_attrs == NULL) | ||
{ | ||
@@ -428,6 +430,7 @@ | ||
char gecos[1024]; | ||
char homedir[256]; | ||
char shell[64]; | ||
+ char lclass[256]; | ||
char passbuffer[BUFLEN_PASSWORDHASH]; | ||
int i, j; | ||
/* get the usernames for this entry */ | ||
@@ -541,6 +544,8 @@ | ||
myldap_get_dn(entry), attmap_passwd_homeDirectory); | ||
/* get the shell for this entry */ | ||
attmap_get_value(entry, attmap_passwd_loginShell, shell, sizeof(shell)); | ||
+ /* get the login class for this entry */ | ||
+ attmap_get_value(entry, attmap_passwd_loginClass, lclass, sizeof(lclass)); | ||
/* write the entries */ | ||
for (i = 0; usernames[i] != NULL; i++) | ||
{ | ||
@@ -565,6 +570,7 @@ | ||
WRITE_STRING(fp, gecos); | ||
WRITE_STRING(fp, homedir); | ||
WRITE_STRING(fp, shell); | ||
+ WRITE_STRING(fp, lclass); | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
net/nss-pam-ldapd/files/lclass-patches/patch-nss__passwd.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- nss/passwd.c.orig 2019-11-02 16:23:46.000000000 +0100 | ||
+++ nss/passwd.c 2023-05-29 19:22:02.235416000 +0200 | ||
@@ -45,8 +45,8 @@ | ||
READ_BUF_STRING(fp, result->pw_dir); | ||
READ_BUF_STRING(fp, result->pw_shell); | ||
#ifdef HAVE_STRUCT_PASSWD_PW_CLASS | ||
- /* set the user access class to an empty string */ | ||
- result->pw_class = result->pw_name + strlen(result->pw_name); | ||
+ /* set the user access class to an empty string only if empty */ | ||
+ READ_BUF_STRING(fp, result->pw_class); | ||
#endif /* HAVE_STRUCT_PASSWD_PW_CLASS */ | ||
return NSS_STATUS_SUCCESS; | ||
} |