summaryrefslogtreecommitdiffstats
path: root/release
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-10-03 03:32:03 +0000
committerjkh <jkh@FreeBSD.org>1997-10-03 03:32:03 +0000
commit05731aab54e11da5b84e162d5d116f149e750dbd (patch)
tree7b2de462e781c899b6b96db0b11eeb83222f1203 /release
parent94445bb41c1fc9b5689b483878e33abe10abe67a (diff)
downloadFreeBSD-src-05731aab54e11da5b84e162d5d116f149e750dbd.zip
FreeBSD-src-05731aab54e11da5b84e162d5d116f149e750dbd.tar.gz
For people running paranoid ftpds, use the real username to log in
with when running multi-user and we actually have one. Suggested by: Joao Carlos Mendes Luis <jonny@coppe.ufrj.br>
Diffstat (limited to 'release')
-rw-r--r--release/sysinstall/ftp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/release/sysinstall/ftp.c b/release/sysinstall/ftp.c
index 0f9baa9..74fd593 100644
--- a/release/sysinstall/ftp.c
+++ b/release/sysinstall/ftp.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id$
+ * $Id: ftp.c,v 1.32 1997/02/22 14:11:42 peter Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -41,6 +41,7 @@
#include <sys/param.h>
#include <sys/wait.h>
#include <netdb.h>
+#include <pwd.h>
#include <ftpio.h>
Boolean ftpInitted = FALSE;
@@ -113,8 +114,16 @@ try:
if (variable_get(VAR_FTP_PASS))
SAFE_STRCPY(password, variable_get(VAR_FTP_PASS));
- else
+ else if (RunningAsInit)
sprintf(password, "installer@%s", variable_get(VAR_HOSTNAME));
+ else {
+ struct passwd *pw;
+ char *user;
+
+ pw = getpwuid(getuid());
+ user = pw ? pw->pw_name : "ftp";
+ sprintf(password, "%s@%s", user, variable_get(VAR_HOSTNAME));
+ }
msgNotify("Logging in to %s@%s..", login_name, hostname);
if ((OpenConn = ftpLogin(hostname, login_name, password, FtpPort, isDebug(), &code)) == NULL) {
msgConfirm("Couldn't open FTP connection to %s:\n %s.", hostname, ftpErrString(code));
OpenPOWER on IntegriCloud