summaryrefslogtreecommitdiff
path: root/acls.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2014-04-17 14:11:28 +0200
committerAxel Beckert <abe@deuxchevaux.org>2014-04-17 14:11:28 +0200
commitc3927cc39106d6b7cd746109784b6e8af203ec6b (patch)
treec7e4f517ca9a07c0cd8c809da7af0251e8cec6a7 /acls.c
parent28a2487f484d19f570280f391f606aeb7fb3fb4a (diff)
downloadscreen-c3927cc39106d6b7cd746109784b6e8af203ec6b.tar.gz
Imported Upstream version 4.2.0upstream/4.2.0
Diffstat (limited to 'acls.c')
-rw-r--r--acls.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/acls.c b/acls.c
index e728bb8..7521cc2 100644
--- a/acls.c
+++ b/acls.c
@@ -455,6 +455,16 @@ int recursive;
return gp; /* *gp is NULL */
}
+static int
+PasswordMatches(pw, password)
+const char *pw, *password;
+{
+ if (!*password)
+ return 0;
+ char *buf = crypt((char *)pw, (char *)password);
+ return (buf && !strcmp(buf, password));
+}
+
/*
* Returns nonzero if failed or already linked.
* Both users are created on demand.
@@ -544,8 +554,7 @@ char *name, *pw1, *pw2;
if (pw2 && *pw2 && *pw2 != '\377') /* provided a system password */
{
- if (!*pass || /* but needed none */
- strcmp(crypt(pw2, pass), pass))
+ if (!PasswordMatches(pw2, pass))
{
debug("System password mismatch\n");
sorry++;
@@ -554,11 +563,10 @@ char *name, *pw1, *pw2;
else /* no pasword provided */
if (*pass) /* but need one */
sorry++;
-#endif
+#endif /* CHECKLOGIN */
if (pw1 && *pw1 && *pw1 != '\377') /* provided a screen password */
{
- if (!*u->u_password || /* but needed none */
- strcmp(crypt(pw1, u->u_password), u->u_password))
+ if (!PasswordMatches(pw1, u->u_password))
{
debug("screen password mismatch\n");
sorry++;