generated from NethServer/ns8-kickstart
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build install and configure the password checker plugin. It checks that the password contains at least - one digit, - one uppercase letter, - one lowercase letter.
- Loading branch information
1 parent
aa41b13
commit b09cd9b
Showing
9 changed files
with
101 additions
and
14 deletions.
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
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
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
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
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
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,20 @@ | ||
# | ||
# Copyright (C) 2023 Nethesis S.r.l. | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# | ||
|
||
CC=gcc | ||
|
||
all: ppcheck.so | ||
|
||
ppcheck.o: ppcheck.c | ||
$(CC) -O2 -fpic -Wall -I./openldap/include -I./openldap/servers/slapd -c ppcheck.c | ||
|
||
ppcheck.so: ppcheck.o | ||
$(CC) -shared -o ppcheck.so ppcheck.o | ||
|
||
install: ppcheck.so | ||
install -m 0755 ppcheck.so /usr/lib/openldap | ||
|
||
clean: | ||
rm -f ppcheck.so ppcheck.o |
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,32 @@ | ||
/* | ||
* Copyright (C) 2023 Nethesis S.r.l. | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
#include <portable.h> | ||
#include <slap.h> | ||
|
||
int check_password (char *pPasswd, struct berval *pErrmsg, Entry *pEntry, struct berval *pArg); | ||
|
||
int check_password (char *pPasswd, struct berval *pErrmsg, Entry *pEntry, struct berval *pArg) { | ||
int match_digit = 0, | ||
match_lowercase = 0, | ||
match_uppercase = 0; | ||
|
||
for (int i=0; i<strlen(pPasswd); i++) { | ||
if (LDAP_RANGE(pPasswd[i], '0', '9')) { | ||
match_digit = 1; | ||
} else if (LDAP_RANGE(pPasswd[i], 'a', 'z')) { | ||
match_lowercase = 1; | ||
} else if (LDAP_RANGE(pPasswd[i], 'A', 'Z')) { | ||
match_uppercase = 1; | ||
} | ||
} | ||
|
||
// Password requirement: at least one char for each group | ||
if(match_digit + match_lowercase + match_uppercase == 3) { | ||
return(LDAP_SUCCESS); | ||
} | ||
|
||
return(LDAP_OTHER); | ||
} |
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
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