summaryrefslogtreecommitdiffstats
path: root/libexec/ftpd
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1996-10-18 17:09:26 +0000
committerache <ache@FreeBSD.org>1996-10-18 17:09:26 +0000
commit591c888b2abec0576497dc5d0c6c987aa485c772 (patch)
tree53c01b8e87b0279ea3eb23cc967b54b0d597a4a3 /libexec/ftpd
parentbbb4755eb58279613ded5dab75419ab87b148e0a (diff)
downloadFreeBSD-src-591c888b2abec0576497dc5d0c6c987aa485c772.zip
FreeBSD-src-591c888b2abec0576497dc5d0c6c987aa485c772.tar.gz
Implement alternative strategy if it is impossible to confirm
password: ask for it, but don't tell that S/key password required. It looks like non-s/key system from outside. Additionally tell that s/key required when it is so for normal case
Diffstat (limited to 'libexec/ftpd')
-rw-r--r--libexec/ftpd/extern.h2
-rw-r--r--libexec/ftpd/ftpd.c13
-rw-r--r--libexec/ftpd/skey-stuff.c16
3 files changed, 9 insertions, 22 deletions
diff --git a/libexec/ftpd/extern.h b/libexec/ftpd/extern.h
index bdfed86..f587866 100644
--- a/libexec/ftpd/extern.h
+++ b/libexec/ftpd/extern.h
@@ -68,5 +68,5 @@ void user __P((char *));
void yyerror __P((char *));
int yyparse __P((void));
#if defined(SKEY) && defined(_PWD_H_) /* XXX evil */
-char *skey_challenge __P((char *, struct passwd *, int, int *));
+char *skey_challenge __P((char *, struct passwd *, int));
#endif
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 42f49b0..2c698f3 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -182,7 +182,6 @@ char proctitle[LINE_MAX]; /* initial part of title */
#ifdef SKEY
int pwok = 0;
-int sflag;
char addr_string[20]; /* XXX */
#endif
@@ -628,17 +627,7 @@ user(name)
strncpy(curname, name, sizeof(curname)-1);
#ifdef SKEY
pwok = skeyaccess(name, NULL, remotehost, addr_string);
- cp = skey_challenge(name, pw, pwok, &sflag);
- if (!pwok && sflag) {
- reply(530, cp);
- if (logging)
- syslog(LOG_NOTICE,
- "FTP LOGIN REFUSED FROM %s, %s",
- remotehost, name);
- pw = (struct passwd *) NULL;
- return;
- }
- reply(331, cp);
+ reply(331, "%s", skey_challenge(name, pw, pwok));
#else
reply(331, "Password required for %s.", name);
#endif
diff --git a/libexec/ftpd/skey-stuff.c b/libexec/ftpd/skey-stuff.c
index 2fe3f56..98542e1 100644
--- a/libexec/ftpd/skey-stuff.c
+++ b/libexec/ftpd/skey-stuff.c
@@ -1,6 +1,6 @@
/* Author: Wietse Venema, Eindhoven University of Technology.
*
- * $Id: skey-stuff.c,v 1.4 1996/10/17 17:06:04 ache Exp $
+ * $Id: skey-stuff.c,v 1.3 1996/09/22 21:53:34 wosch Exp $
*/
#include <stdio.h>
@@ -10,21 +10,19 @@
/* skey_challenge - additional password prompt stuff */
-char *skey_challenge(name, pwd, pwok, sflag)
+char *skey_challenge(name, pwd, pwok)
char *name;
struct passwd *pwd;
-int pwok;
-int *sflag;
+int pwok;
{
static char buf[128];
struct skey skey;
- char *username = pwd ? pwd->pw_name : ":";
/* Display s/key challenge where appropriate. */
- *sflag = skeychallenge(&skey, username, buf);
- if (*sflag)
- sprintf(buf, "%s required for %s.",
- pwok ? "Password" : "S/Key password", name);
+ if (pwd == NULL || skeychallenge(&skey, pwd->pw_name, buf))
+ sprintf(buf, "Password required for %s.", name);
+ else if (!pwok)
+ strcat(buf, " (s/key required)");
return (buf);
}
OpenPOWER on IntegriCloud