summaryrefslogtreecommitdiff
path: root/checkpasswd/checkpassword.c
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-14 23:19:44 (GMT)
committerJohn Denker <jsd@av8n.com>2012-07-14 23:19:44 (GMT)
commite53f6eb20d90fd96e43dc2f52249856485522a61 (patch)
treeb4a7d68c9ec19614cfdc2392e270a0f43b856bb6 /checkpasswd/checkpassword.c
parent96906a8d4c0b9942d94c6bf01c68b05de827e947 (diff)
From login-name, strip suffixes starting with '@' or'%'
Diffstat (limited to 'checkpasswd/checkpassword.c')
-rw-r--r--checkpasswd/checkpassword.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/checkpasswd/checkpassword.c b/checkpasswd/checkpassword.c
index 0ca5eee..106889b 100644
--- a/checkpasswd/checkpassword.c
+++ b/checkpasswd/checkpassword.c
@@ -35,6 +35,7 @@ main(int argc,char **argv)
char *stored;
int r;
int i;
+ char ch;
int unit = 3;
char* unit_str = getenv("CHECKPASSWORD_UNIT");
@@ -62,6 +63,18 @@ main(int argc,char **argv)
if (i >= uplen) _exit(2);
while (up[i++]) if (i >= uplen) _exit(2);
+#ifndef KEEP_SUFFIXES
+// remove from the login any suffix starting with '@' or '%'
+ for (i=0; ; i++){
+ ch = login[i];
+ if (ch == 0) break;
+ if (ch == '@' || ch == '%') {
+ login[i] = 0;
+ break;
+ }
+ }
+#endif
+
#ifdef NASTY_DEBUG
fprintf(stderr, "checkpassw called with '%s' '%s'\n",
login, password);