mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Fix even more lurking bogons - why do I never find these until the last
possible minute? :-)
This commit is contained in:
parent
cf1647cd2f
commit
de4342fa44
19 changed files with 104 additions and 204 deletions
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dist.c,v 1.59 1996/06/13 13:45:16 jkh Exp $
|
||||
* $Id: dist.c,v 1.60 1996/07/02 01:03:37 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -379,7 +379,7 @@ distExtract(char *parent, Distribution *me)
|
|||
mediaDevice->close(mediaDevice, fd);
|
||||
goto done;
|
||||
}
|
||||
else if (fd == -2) { /* Hard error, can't continue */
|
||||
else if (fd == IO_ERROR) { /* Hard error, can't continue */
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
status = FALSE;
|
||||
goto done;
|
||||
|
|
@ -411,7 +411,7 @@ distExtract(char *parent, Distribution *me)
|
|||
safe_free(dist_attr);
|
||||
mediaDevice->close(mediaDevice, fd);
|
||||
}
|
||||
else if (fd == -2) { /* Hard error, can't continue */
|
||||
else if (fd == IO_ERROR) { /* Hard error, can't continue */
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
status = FALSE;
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: ftp.c,v 1.15 1995/12/07 10:33:47 peter Exp $
|
||||
* $Id: ftp.c,v 1.16 1996/04/28 20:53:56 jkh Exp $
|
||||
*
|
||||
* Return values have been sanitized:
|
||||
* -1 error, but you (still) have a session.
|
||||
|
|
@ -65,7 +65,7 @@ writes(int fd, char *s)
|
|||
{
|
||||
int i = strlen(s);
|
||||
if (i != write(fd, s, i))
|
||||
return -2;
|
||||
return IO_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ get_a_number(FTP_t ftp, char **q)
|
|||
while(1) {
|
||||
p = get_a_line(ftp);
|
||||
if (!p)
|
||||
return -2;
|
||||
return IO_ERROR;
|
||||
if (!(isdigit(p[0]) && isdigit(p[1]) && isdigit(p[2])))
|
||||
continue;
|
||||
if (i == -1 && p[3] == '-') {
|
||||
|
|
@ -131,14 +131,14 @@ zap(FTP_t ftp)
|
|||
close(ftp->fd_ctrl); ftp->fd_ctrl = -1;
|
||||
close(ftp->fd_xfer); ftp->fd_xfer = -1;
|
||||
ftp->state = init;
|
||||
return -2;
|
||||
return IO_ERROR;
|
||||
}
|
||||
|
||||
static int
|
||||
botch(FTP_t ftp, char *func, char *state)
|
||||
{
|
||||
debug(ftp, "Botch: %s called outside state %s\n",func,state);
|
||||
return -2;
|
||||
return IO_ERROR;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -155,7 +155,7 @@ cmd(FTP_t ftp, const char *fmt, ...)
|
|||
debug(ftp, "send <%s>\n", p);
|
||||
strcat(p,"\r\n");
|
||||
if (writes(ftp->fd_ctrl, p))
|
||||
return -2;
|
||||
return IO_ERROR;
|
||||
i = get_a_number(ftp, 0);
|
||||
return i;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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: ftp_strat.c,v 1.19 1996/06/17 21:48:26 jkh Exp $
|
||||
* $Id: ftp_strat.c,v 1.20 1996/07/06 02:03:47 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -51,63 +51,10 @@ extern int FtpPort;
|
|||
|
||||
static char *lastRequest;
|
||||
|
||||
static Boolean
|
||||
get_new_host(Device *dev, Boolean probe)
|
||||
{
|
||||
Boolean i;
|
||||
int j;
|
||||
char *oldTitle = MenuMediaFTP.title;
|
||||
char *cp = variable_get(VAR_FTP_ONERROR);
|
||||
|
||||
if (probe || (cp && strcmp(cp, "reselect")))
|
||||
i = TRUE;
|
||||
else {
|
||||
i = FALSE;
|
||||
msgConfirm("The %s file failed to load from the FTP site you\n"
|
||||
"selected. Please select another one from the FTP menu.", lastRequest ? lastRequest : "requested");
|
||||
MenuMediaFTP.title = "Request failed - please select another site";
|
||||
j = mediaSetFTP(NULL);
|
||||
MenuMediaFTP.title = oldTitle;
|
||||
if (DITEM_STATUS(j) == DITEM_SUCCESS) {
|
||||
/* Bounce the link if necessary */
|
||||
if (ftpInitted) {
|
||||
msgDebug("Bouncing FTP connection before reselecting new host.\n");
|
||||
dev->shutdown(dev);
|
||||
i = dev->init(dev);
|
||||
}
|
||||
}
|
||||
else {
|
||||
msgDebug("User elected not to reselect, shutting down open connection.\n");
|
||||
dev->shutdown(dev);
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Should we throw in the towel? */
|
||||
static Boolean
|
||||
ftpShouldAbort(Device *dev, int retries)
|
||||
{
|
||||
char *cp, *cp2;
|
||||
int maxretries, rval = FALSE;
|
||||
|
||||
cp = variable_get(VAR_FTP_ONERROR);
|
||||
cp2 = variable_get(VAR_FTP_RETRIES);
|
||||
maxretries = atoi(cp2);
|
||||
if (retries > maxretries || (cp && !strcmp(cp, "abort"))) {
|
||||
rval = TRUE;
|
||||
if (isDebug())
|
||||
msgDebug("Aborting FTP connection.\n");
|
||||
dev->shutdown(dev);
|
||||
(void)dev->init(dev);
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
Boolean
|
||||
mediaInitFTP(Device *dev)
|
||||
{
|
||||
int i, retries;
|
||||
int i;
|
||||
char *cp, *rel, *hostname, *dir;
|
||||
char *user, *login_name, password[80];
|
||||
|
||||
|
|
@ -144,30 +91,21 @@ mediaInitFTP(Device *dev)
|
|||
strcpy(password, variable_get(VAR_FTP_PASS));
|
||||
else
|
||||
sprintf(password, "%s@%s", login_name, hostname);
|
||||
retries = 0;
|
||||
retry:
|
||||
msgNotify("Logging in as %s..", login_name);
|
||||
if (FtpOpen(ftp, hostname, login_name, password) != 0) {
|
||||
if (variable_get(VAR_NO_CONFIRM))
|
||||
msgNotify("Couldn't open FTP connection to %s", hostname);
|
||||
else
|
||||
msgConfirm("Couldn't open FTP connection to %s", hostname);
|
||||
if (ftpShouldAbort(dev, ++retries) || !get_new_host(dev, FALSE))
|
||||
return FALSE;
|
||||
goto retry;
|
||||
goto punt;
|
||||
}
|
||||
|
||||
FtpPassive(ftp, !strcmp(variable_get(VAR_FTP_STATE), "passive"));
|
||||
FtpBinary(ftp, 1);
|
||||
if (dir && *dir != '\0') {
|
||||
msgDebug("Attempt to chdir to distribution in %s\n", dir);
|
||||
if ((i = FtpChdir(ftp, dir)) != 0) {
|
||||
if (i == -2 || ftpShouldAbort(dev, ++retries))
|
||||
goto punt;
|
||||
else if (get_new_host(dev, FALSE))
|
||||
retries = 0;
|
||||
goto retry;
|
||||
}
|
||||
if (FtpChdir(ftp, dir) == IO_ERROR)
|
||||
goto punt;
|
||||
}
|
||||
|
||||
/* Give it a shot - can't hurt to try and zoom in if we can, unless the release is set to __RELEASE which signifies that it's not set */
|
||||
|
|
@ -176,14 +114,14 @@ retry:
|
|||
i = FtpChdir(ftp, rel);
|
||||
else
|
||||
i = 0;
|
||||
if (i == -2)
|
||||
goto punt;
|
||||
else if (i == -1)
|
||||
if (i == -1)
|
||||
msgConfirm("Warning: Can't CD to `%s' distribution on this\n"
|
||||
"FTP server. You may need to visit the Options menu\n"
|
||||
"to set the release name explicitly if this FTP server\n"
|
||||
"isn't exporting a CD (or some other custom release) at\n"
|
||||
"the top level as a release tree.", rel);
|
||||
else if (i == IO_ERROR)
|
||||
goto punt;
|
||||
|
||||
if (isDebug())
|
||||
msgDebug("mediaInitFTP was successful (logged in and chdir'd)\n");
|
||||
|
|
@ -212,14 +150,14 @@ mediaGetFTP(Device *dev, char *file, Boolean probe)
|
|||
lastRequest = file;
|
||||
while ((fd = FtpGet(ftp, fp)) < 0) {
|
||||
/* If a hard fail, try to "bounce" the ftp server to clear it */
|
||||
if (fd == -2 && ++nretries < atoi(variable_get(VAR_FTP_RETRIES))) {
|
||||
if (fd == IO_ERROR) {
|
||||
dev->shutdown(dev);
|
||||
/* If we can't re-initialize, just forget it */
|
||||
if (!dev->init(dev))
|
||||
return -2;
|
||||
return IO_ERROR;
|
||||
}
|
||||
else if (probe || ftpShouldAbort(dev, ++nretries))
|
||||
return -1;
|
||||
else if (probe)
|
||||
return EOF;
|
||||
else {
|
||||
/* Try some alternatives */
|
||||
switch (nretries) {
|
||||
|
|
@ -240,12 +178,7 @@ mediaGetFTP(Device *dev, char *file, Boolean probe)
|
|||
|
||||
case 4:
|
||||
fp = file;
|
||||
if (get_new_host(dev, probe)) {
|
||||
nretries = 0;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: install.c,v 1.108 1996/07/05 08:35:56 jkh Exp $
|
||||
* $Id: install.c,v 1.109 1996/07/08 08:54:27 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -801,8 +801,6 @@ installVarDefaults(dialogMenuItem *self)
|
|||
variable_set2(VAR_BROWSER_PACKAGE, "lynx-2.5FM");
|
||||
variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/lynx");
|
||||
variable_set2(VAR_FTP_STATE, "passive");
|
||||
variable_set2(VAR_FTP_ONERROR, "abort");
|
||||
variable_set2(VAR_FTP_RETRIES, MAX_FTP_RETRIES);
|
||||
variable_set2(VAR_PKG_TMPDIR, "/usr/tmp");
|
||||
if (getpid() != 1)
|
||||
variable_set2(SYSTEM_STATE, "update");
|
||||
|
|
|
|||
|
|
@ -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: media.c,v 1.45 1996/07/05 08:35:58 jkh Exp $
|
||||
* $Id: media.c,v 1.46 1996/07/08 08:54:29 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -312,6 +312,7 @@ mediaSetFTP(dialogMenuItem *self)
|
|||
if ((gethostbyname(hostname) == NULL) && (inet_addr(hostname) == INADDR_NONE)) {
|
||||
msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n"
|
||||
"name server, gateway and network interface are correctly configured?", hostname);
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
return DITEM_FAILURE | DITEM_RECREATE;
|
||||
}
|
||||
variable_set2(VAR_FTP_HOST, hostname);
|
||||
|
|
@ -579,27 +580,6 @@ mediaVerify(void)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set FTP error behavior */
|
||||
int
|
||||
mediaSetFtpOnError(dialogMenuItem *self)
|
||||
{
|
||||
char *cp = variable_get(VAR_FTP_ONERROR);
|
||||
|
||||
if (!cp) {
|
||||
msgConfirm("FTP error handling is not set to anything!");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
else {
|
||||
if (!strcmp(cp, "abort"))
|
||||
variable_set2(VAR_FTP_ONERROR, "retry");
|
||||
else if (!strcmp(cp, "retry"))
|
||||
variable_set2(VAR_FTP_ONERROR, "reselect");
|
||||
else /* must be "reselect" - wrap around */
|
||||
variable_set2(VAR_FTP_ONERROR, "abort");
|
||||
}
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Set the FTP username and password fields */
|
||||
int
|
||||
mediaSetFtpUserPass(dialogMenuItem *self)
|
||||
|
|
|
|||
|
|
@ -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: network.c,v 1.13 1996/06/12 17:09:34 jkh Exp $
|
||||
* $Id: network.c,v 1.14 1996/07/08 08:54:30 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -76,6 +76,7 @@ mediaInitNetwork(Device *dev)
|
|||
char *val;
|
||||
char attach[256];
|
||||
|
||||
dialog_clear();
|
||||
/* Cheesy slip attach */
|
||||
snprintf(attach, 256, "slattach -a -h -l -s 9600 %s", dev->devname);
|
||||
val = msgGetInput(attach,
|
||||
|
|
@ -179,6 +180,7 @@ startPPP(Device *devp)
|
|||
Mkdir("/var/spool/lock");
|
||||
Mkdir("/etc/ppp");
|
||||
|
||||
dialog_clear();
|
||||
if (!variable_get(VAR_SERIAL_SPEED))
|
||||
variable_set2(VAR_SERIAL_SPEED, "115200");
|
||||
/* Get any important user values */
|
||||
|
|
@ -199,7 +201,10 @@ startPPP(Device *devp)
|
|||
else
|
||||
strcpy(myaddr, "0");
|
||||
|
||||
fp = fopen("/etc/ppp/ppp.linkup", "w");
|
||||
if (!Fake)
|
||||
fp = fopen("/etc/ppp/ppp.linkup", "w");
|
||||
else
|
||||
fp = fopen("/dev/stderr", "w");
|
||||
if (fp != NULL) {
|
||||
fprintf(fp, "MYADDR:\n");
|
||||
fprintf(fp, " delete ALL\n");
|
||||
|
|
@ -207,12 +212,18 @@ startPPP(Device *devp)
|
|||
fchmod(fileno(fp), 0755);
|
||||
fclose(fp);
|
||||
}
|
||||
fd2 = open("/etc/ppp/ppp.secret", O_CREAT);
|
||||
if (!Fake)
|
||||
fd2 = open("/etc/ppp/ppp.secret", O_CREAT);
|
||||
else
|
||||
fd2 = -1;
|
||||
if (fd2 != -1) {
|
||||
fchmod(fd2, 0700);
|
||||
close(fd2);
|
||||
}
|
||||
fp = fopen("/etc/ppp/ppp.conf", "w");
|
||||
if (!Fake)
|
||||
fp = fopen("/etc/ppp/ppp.conf", "w");
|
||||
else
|
||||
fp = fopen("/dev/stderr", "w");
|
||||
if (!fp) {
|
||||
msgConfirm("Couldn't open /etc/ppp/ppp.conf file! This isn't going to work");
|
||||
return 0;
|
||||
|
|
@ -223,7 +234,7 @@ startPPP(Device *devp)
|
|||
fprintf(fp, " set ifaddr %s %s\n", myaddr, provider);
|
||||
fclose(fp);
|
||||
|
||||
if (!file_readable("/dev/tun0") && mknod("/dev/tun0", 0600 | S_IFCHR, makedev(52, 0))) {
|
||||
if (!Fake && !file_readable("/dev/tun0") && mknod("/dev/tun0", 0600 | S_IFCHR, makedev(52, 0))) {
|
||||
msgConfirm("Warning: No /dev/tun0 device. PPP will not work!");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -256,13 +267,14 @@ startPPP(Device *devp)
|
|||
exit(1);
|
||||
}
|
||||
else {
|
||||
msgConfirm("The PPP command is now started on VTY3 (type ALT-F3 to\n"
|
||||
msgConfirm("NOTICE: The PPP command is now started on VTY3 (type ALT-F3 to\n"
|
||||
"interact with it, ALT-F1 to switch back here). The only command\n"
|
||||
"you'll probably want or need to use is the \"term\" command\n"
|
||||
"which starts a terminal emulator you can use to talk to your\n"
|
||||
"modem and dial the service provider. Once you're connected,\n"
|
||||
"come back to this screen and press return. DO NOT PRESS [ENTER]\n"
|
||||
"HERE UNTIL THE CONNECTION IS FULLY ESTABLISHED!");
|
||||
"come back to this screen and press return.\n\n"
|
||||
"DO NOT PRESS [ENTER] HERE UNTIL THE CONNECTION IS FULLY\n"
|
||||
"ESTABLISHED!");
|
||||
}
|
||||
return pid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: options.c,v 1.38 1996/06/08 09:08:45 jkh Exp $
|
||||
* $Id: options.c,v 1.39 1996/06/14 14:33:58 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -98,7 +98,6 @@ mediaCheck(Option opt)
|
|||
#define BPKG_PROMPT "Please specify the name of the HTML browser package:"
|
||||
#define BBIN_PROMPT "Please specify a full pathname to the HTML browser binary:"
|
||||
#define EDITOR_PROMPT "Please specify the name of the text editor you wish to use:"
|
||||
#define RETRY_PROMPT "Please specify the number of times to retry an FTP request:"
|
||||
#define PKG_PROMPT "Please specify a temporary directory with lots of free space:"
|
||||
|
||||
static Option Options[] = {
|
||||
|
|
@ -110,10 +109,6 @@ static Option Options[] = {
|
|||
OPT_IS_VAR, NULL, VAR_DEBUG, varCheck },
|
||||
{ "Yes to All", "Assume \"Yes\" answers to all non-critical dialogs",
|
||||
OPT_IS_VAR, NULL, VAR_NO_CONFIRM, varCheck },
|
||||
{ "FTP OnError", "What to do when FTP requests fail: abort, retry, reselect.",
|
||||
OPT_IS_FUNC, mediaSetFtpOnError, VAR_FTP_ONERROR, varCheck },
|
||||
{ "FTP Retries", "If FTP OnError == retry, this is the number of times to try.",
|
||||
OPT_IS_VAR, RETRY_PROMPT, VAR_FTP_RETRIES, varCheck },
|
||||
{ "FTP username", "Username and password to use instead of anonymous",
|
||||
OPT_IS_FUNC, mediaSetFtpUserPass, VAR_FTP_USER, varCheck },
|
||||
{ "Editor", "Which text editor to use during installation",
|
||||
|
|
|
|||
|
|
@ -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: sysinstall.h,v 1.71 1996/07/05 08:36:00 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.72 1996/07/08 08:54:33 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
#define DEV_NAME_MAX 64 /* The maximum length of a device name */
|
||||
#define DEV_MAX 100 /* The maximum number of devices we'll deal with */
|
||||
#define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */
|
||||
#define MAX_FTP_RETRIES "4" /* How many times to beat our heads against the wall */
|
||||
#define IO_ERROR -2 /* Status code for I/O error rather than normal EOF */
|
||||
|
||||
/*
|
||||
* I make some pretty gross assumptions about having a max of 50 chunks
|
||||
|
|
@ -90,11 +90,9 @@
|
|||
#define VAR_EDITOR "editor"
|
||||
#define VAR_EXTRAS "ifconfig_"
|
||||
#define VAR_FTP_DIR "ftpDirectory"
|
||||
#define VAR_FTP_ONERROR "ftpOnError"
|
||||
#define VAR_FTP_PASS "ftpPass"
|
||||
#define VAR_FTP_PATH "ftp"
|
||||
#define VAR_FTP_PORT "ftpPort"
|
||||
#define VAR_FTP_RETRIES "ftpRetryCount"
|
||||
#define VAR_FTP_STATE "ftpState"
|
||||
#define VAR_FTP_USER "ftpUser"
|
||||
#define VAR_FTP_HOST "ftpHost"
|
||||
|
|
@ -507,7 +505,6 @@ extern int mediaSetFTPActive(dialogMenuItem *self);
|
|||
extern int mediaSetFTPPassive(dialogMenuItem *self);
|
||||
extern int mediaSetUFS(dialogMenuItem *self);
|
||||
extern int mediaSetNFS(dialogMenuItem *self);
|
||||
extern int mediaSetFtpOnError(dialogMenuItem *self);
|
||||
extern int mediaSetFtpUserPass(dialogMenuItem *self);
|
||||
extern int mediaSetCPIOVerbosity(dialogMenuItem *self);
|
||||
extern int mediaGetType(dialogMenuItem *self);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Id: tcpip.c,v 1.42 1996/06/17 23:04:24 jkh Exp $
|
||||
* $Id: tcpip.c,v 1.43 1996/07/02 01:03:55 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Gary J Palmer. All rights reserved.
|
||||
|
|
@ -522,8 +522,10 @@ netHook(dialogMenuItem *self)
|
|||
|
||||
devs = deviceFind(self->prompt, DEVICE_TYPE_NETWORK);
|
||||
if (devs) {
|
||||
tcpOpenDialog(devs[0]);
|
||||
mediaDevice = devs[0];
|
||||
if (DITEM_STATUS(tcpOpenDialog(devs[0])) != DITEM_FAILURE)
|
||||
mediaDevice = devs[0];
|
||||
else
|
||||
devs = NULL;
|
||||
}
|
||||
return devs ? DITEM_LEAVE_MENU : DITEM_FAILURE;
|
||||
}
|
||||
|
|
@ -545,8 +547,10 @@ tcpDeviceSelect(void)
|
|||
}
|
||||
else if (cnt == 1 || (!RunningAsInit && !Fake)) {
|
||||
/* If we're running in user mode, assume network already up */
|
||||
if (RunningAsInit)
|
||||
tcpOpenDialog(devs[0]);
|
||||
if (RunningAsInit) {
|
||||
if (DITEM_STATUS(tcpOpenDialog(devs[0]) == DITEM_FAILURE))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
msgDebug("Running multi-user, assuming that the network is already up\n");
|
||||
mediaDevice = devs[0];
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: install.c,v 1.108 1996/07/05 08:35:56 jkh Exp $
|
||||
* $Id: install.c,v 1.109 1996/07/08 08:54:27 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -801,8 +801,6 @@ installVarDefaults(dialogMenuItem *self)
|
|||
variable_set2(VAR_BROWSER_PACKAGE, "lynx-2.5FM");
|
||||
variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/lynx");
|
||||
variable_set2(VAR_FTP_STATE, "passive");
|
||||
variable_set2(VAR_FTP_ONERROR, "abort");
|
||||
variable_set2(VAR_FTP_RETRIES, MAX_FTP_RETRIES);
|
||||
variable_set2(VAR_PKG_TMPDIR, "/usr/tmp");
|
||||
if (getpid() != 1)
|
||||
variable_set2(SYSTEM_STATE, "update");
|
||||
|
|
|
|||
|
|
@ -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: sysinstall.h,v 1.71 1996/07/05 08:36:00 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.72 1996/07/08 08:54:33 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
#define DEV_NAME_MAX 64 /* The maximum length of a device name */
|
||||
#define DEV_MAX 100 /* The maximum number of devices we'll deal with */
|
||||
#define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */
|
||||
#define MAX_FTP_RETRIES "4" /* How many times to beat our heads against the wall */
|
||||
#define IO_ERROR -2 /* Status code for I/O error rather than normal EOF */
|
||||
|
||||
/*
|
||||
* I make some pretty gross assumptions about having a max of 50 chunks
|
||||
|
|
@ -90,11 +90,9 @@
|
|||
#define VAR_EDITOR "editor"
|
||||
#define VAR_EXTRAS "ifconfig_"
|
||||
#define VAR_FTP_DIR "ftpDirectory"
|
||||
#define VAR_FTP_ONERROR "ftpOnError"
|
||||
#define VAR_FTP_PASS "ftpPass"
|
||||
#define VAR_FTP_PATH "ftp"
|
||||
#define VAR_FTP_PORT "ftpPort"
|
||||
#define VAR_FTP_RETRIES "ftpRetryCount"
|
||||
#define VAR_FTP_STATE "ftpState"
|
||||
#define VAR_FTP_USER "ftpUser"
|
||||
#define VAR_FTP_HOST "ftpHost"
|
||||
|
|
@ -507,7 +505,6 @@ extern int mediaSetFTPActive(dialogMenuItem *self);
|
|||
extern int mediaSetFTPPassive(dialogMenuItem *self);
|
||||
extern int mediaSetUFS(dialogMenuItem *self);
|
||||
extern int mediaSetNFS(dialogMenuItem *self);
|
||||
extern int mediaSetFtpOnError(dialogMenuItem *self);
|
||||
extern int mediaSetFtpUserPass(dialogMenuItem *self);
|
||||
extern int mediaSetCPIOVerbosity(dialogMenuItem *self);
|
||||
extern int mediaGetType(dialogMenuItem *self);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dist.c,v 1.59 1996/06/13 13:45:16 jkh Exp $
|
||||
* $Id: dist.c,v 1.60 1996/07/02 01:03:37 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -379,7 +379,7 @@ distExtract(char *parent, Distribution *me)
|
|||
mediaDevice->close(mediaDevice, fd);
|
||||
goto done;
|
||||
}
|
||||
else if (fd == -2) { /* Hard error, can't continue */
|
||||
else if (fd == IO_ERROR) { /* Hard error, can't continue */
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
status = FALSE;
|
||||
goto done;
|
||||
|
|
@ -411,7 +411,7 @@ distExtract(char *parent, Distribution *me)
|
|||
safe_free(dist_attr);
|
||||
mediaDevice->close(mediaDevice, fd);
|
||||
}
|
||||
else if (fd == -2) { /* Hard error, can't continue */
|
||||
else if (fd == IO_ERROR) { /* Hard error, can't continue */
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
status = FALSE;
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: ftp.c,v 1.15 1995/12/07 10:33:47 peter Exp $
|
||||
* $Id: ftp.c,v 1.16 1996/04/28 20:53:56 jkh Exp $
|
||||
*
|
||||
* Return values have been sanitized:
|
||||
* -1 error, but you (still) have a session.
|
||||
|
|
@ -65,7 +65,7 @@ writes(int fd, char *s)
|
|||
{
|
||||
int i = strlen(s);
|
||||
if (i != write(fd, s, i))
|
||||
return -2;
|
||||
return IO_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ get_a_number(FTP_t ftp, char **q)
|
|||
while(1) {
|
||||
p = get_a_line(ftp);
|
||||
if (!p)
|
||||
return -2;
|
||||
return IO_ERROR;
|
||||
if (!(isdigit(p[0]) && isdigit(p[1]) && isdigit(p[2])))
|
||||
continue;
|
||||
if (i == -1 && p[3] == '-') {
|
||||
|
|
@ -131,14 +131,14 @@ zap(FTP_t ftp)
|
|||
close(ftp->fd_ctrl); ftp->fd_ctrl = -1;
|
||||
close(ftp->fd_xfer); ftp->fd_xfer = -1;
|
||||
ftp->state = init;
|
||||
return -2;
|
||||
return IO_ERROR;
|
||||
}
|
||||
|
||||
static int
|
||||
botch(FTP_t ftp, char *func, char *state)
|
||||
{
|
||||
debug(ftp, "Botch: %s called outside state %s\n",func,state);
|
||||
return -2;
|
||||
return IO_ERROR;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -155,7 +155,7 @@ cmd(FTP_t ftp, const char *fmt, ...)
|
|||
debug(ftp, "send <%s>\n", p);
|
||||
strcat(p,"\r\n");
|
||||
if (writes(ftp->fd_ctrl, p))
|
||||
return -2;
|
||||
return IO_ERROR;
|
||||
i = get_a_number(ftp, 0);
|
||||
return i;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: install.c,v 1.108 1996/07/05 08:35:56 jkh Exp $
|
||||
* $Id: install.c,v 1.109 1996/07/08 08:54:27 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -801,8 +801,6 @@ installVarDefaults(dialogMenuItem *self)
|
|||
variable_set2(VAR_BROWSER_PACKAGE, "lynx-2.5FM");
|
||||
variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/lynx");
|
||||
variable_set2(VAR_FTP_STATE, "passive");
|
||||
variable_set2(VAR_FTP_ONERROR, "abort");
|
||||
variable_set2(VAR_FTP_RETRIES, MAX_FTP_RETRIES);
|
||||
variable_set2(VAR_PKG_TMPDIR, "/usr/tmp");
|
||||
if (getpid() != 1)
|
||||
variable_set2(SYSTEM_STATE, "update");
|
||||
|
|
|
|||
|
|
@ -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: media.c,v 1.45 1996/07/05 08:35:58 jkh Exp $
|
||||
* $Id: media.c,v 1.46 1996/07/08 08:54:29 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -312,6 +312,7 @@ mediaSetFTP(dialogMenuItem *self)
|
|||
if ((gethostbyname(hostname) == NULL) && (inet_addr(hostname) == INADDR_NONE)) {
|
||||
msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n"
|
||||
"name server, gateway and network interface are correctly configured?", hostname);
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
return DITEM_FAILURE | DITEM_RECREATE;
|
||||
}
|
||||
variable_set2(VAR_FTP_HOST, hostname);
|
||||
|
|
@ -579,27 +580,6 @@ mediaVerify(void)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* Set FTP error behavior */
|
||||
int
|
||||
mediaSetFtpOnError(dialogMenuItem *self)
|
||||
{
|
||||
char *cp = variable_get(VAR_FTP_ONERROR);
|
||||
|
||||
if (!cp) {
|
||||
msgConfirm("FTP error handling is not set to anything!");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
else {
|
||||
if (!strcmp(cp, "abort"))
|
||||
variable_set2(VAR_FTP_ONERROR, "retry");
|
||||
else if (!strcmp(cp, "retry"))
|
||||
variable_set2(VAR_FTP_ONERROR, "reselect");
|
||||
else /* must be "reselect" - wrap around */
|
||||
variable_set2(VAR_FTP_ONERROR, "abort");
|
||||
}
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Set the FTP username and password fields */
|
||||
int
|
||||
mediaSetFtpUserPass(dialogMenuItem *self)
|
||||
|
|
|
|||
|
|
@ -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: network.c,v 1.13 1996/06/12 17:09:34 jkh Exp $
|
||||
* $Id: network.c,v 1.14 1996/07/08 08:54:30 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -76,6 +76,7 @@ mediaInitNetwork(Device *dev)
|
|||
char *val;
|
||||
char attach[256];
|
||||
|
||||
dialog_clear();
|
||||
/* Cheesy slip attach */
|
||||
snprintf(attach, 256, "slattach -a -h -l -s 9600 %s", dev->devname);
|
||||
val = msgGetInput(attach,
|
||||
|
|
@ -179,6 +180,7 @@ startPPP(Device *devp)
|
|||
Mkdir("/var/spool/lock");
|
||||
Mkdir("/etc/ppp");
|
||||
|
||||
dialog_clear();
|
||||
if (!variable_get(VAR_SERIAL_SPEED))
|
||||
variable_set2(VAR_SERIAL_SPEED, "115200");
|
||||
/* Get any important user values */
|
||||
|
|
@ -199,7 +201,10 @@ startPPP(Device *devp)
|
|||
else
|
||||
strcpy(myaddr, "0");
|
||||
|
||||
fp = fopen("/etc/ppp/ppp.linkup", "w");
|
||||
if (!Fake)
|
||||
fp = fopen("/etc/ppp/ppp.linkup", "w");
|
||||
else
|
||||
fp = fopen("/dev/stderr", "w");
|
||||
if (fp != NULL) {
|
||||
fprintf(fp, "MYADDR:\n");
|
||||
fprintf(fp, " delete ALL\n");
|
||||
|
|
@ -207,12 +212,18 @@ startPPP(Device *devp)
|
|||
fchmod(fileno(fp), 0755);
|
||||
fclose(fp);
|
||||
}
|
||||
fd2 = open("/etc/ppp/ppp.secret", O_CREAT);
|
||||
if (!Fake)
|
||||
fd2 = open("/etc/ppp/ppp.secret", O_CREAT);
|
||||
else
|
||||
fd2 = -1;
|
||||
if (fd2 != -1) {
|
||||
fchmod(fd2, 0700);
|
||||
close(fd2);
|
||||
}
|
||||
fp = fopen("/etc/ppp/ppp.conf", "w");
|
||||
if (!Fake)
|
||||
fp = fopen("/etc/ppp/ppp.conf", "w");
|
||||
else
|
||||
fp = fopen("/dev/stderr", "w");
|
||||
if (!fp) {
|
||||
msgConfirm("Couldn't open /etc/ppp/ppp.conf file! This isn't going to work");
|
||||
return 0;
|
||||
|
|
@ -223,7 +234,7 @@ startPPP(Device *devp)
|
|||
fprintf(fp, " set ifaddr %s %s\n", myaddr, provider);
|
||||
fclose(fp);
|
||||
|
||||
if (!file_readable("/dev/tun0") && mknod("/dev/tun0", 0600 | S_IFCHR, makedev(52, 0))) {
|
||||
if (!Fake && !file_readable("/dev/tun0") && mknod("/dev/tun0", 0600 | S_IFCHR, makedev(52, 0))) {
|
||||
msgConfirm("Warning: No /dev/tun0 device. PPP will not work!");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -256,13 +267,14 @@ startPPP(Device *devp)
|
|||
exit(1);
|
||||
}
|
||||
else {
|
||||
msgConfirm("The PPP command is now started on VTY3 (type ALT-F3 to\n"
|
||||
msgConfirm("NOTICE: The PPP command is now started on VTY3 (type ALT-F3 to\n"
|
||||
"interact with it, ALT-F1 to switch back here). The only command\n"
|
||||
"you'll probably want or need to use is the \"term\" command\n"
|
||||
"which starts a terminal emulator you can use to talk to your\n"
|
||||
"modem and dial the service provider. Once you're connected,\n"
|
||||
"come back to this screen and press return. DO NOT PRESS [ENTER]\n"
|
||||
"HERE UNTIL THE CONNECTION IS FULLY ESTABLISHED!");
|
||||
"come back to this screen and press return.\n\n"
|
||||
"DO NOT PRESS [ENTER] HERE UNTIL THE CONNECTION IS FULLY\n"
|
||||
"ESTABLISHED!");
|
||||
}
|
||||
return pid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: options.c,v 1.38 1996/06/08 09:08:45 jkh Exp $
|
||||
* $Id: options.c,v 1.39 1996/06/14 14:33:58 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -98,7 +98,6 @@ mediaCheck(Option opt)
|
|||
#define BPKG_PROMPT "Please specify the name of the HTML browser package:"
|
||||
#define BBIN_PROMPT "Please specify a full pathname to the HTML browser binary:"
|
||||
#define EDITOR_PROMPT "Please specify the name of the text editor you wish to use:"
|
||||
#define RETRY_PROMPT "Please specify the number of times to retry an FTP request:"
|
||||
#define PKG_PROMPT "Please specify a temporary directory with lots of free space:"
|
||||
|
||||
static Option Options[] = {
|
||||
|
|
@ -110,10 +109,6 @@ static Option Options[] = {
|
|||
OPT_IS_VAR, NULL, VAR_DEBUG, varCheck },
|
||||
{ "Yes to All", "Assume \"Yes\" answers to all non-critical dialogs",
|
||||
OPT_IS_VAR, NULL, VAR_NO_CONFIRM, varCheck },
|
||||
{ "FTP OnError", "What to do when FTP requests fail: abort, retry, reselect.",
|
||||
OPT_IS_FUNC, mediaSetFtpOnError, VAR_FTP_ONERROR, varCheck },
|
||||
{ "FTP Retries", "If FTP OnError == retry, this is the number of times to try.",
|
||||
OPT_IS_VAR, RETRY_PROMPT, VAR_FTP_RETRIES, varCheck },
|
||||
{ "FTP username", "Username and password to use instead of anonymous",
|
||||
OPT_IS_FUNC, mediaSetFtpUserPass, VAR_FTP_USER, varCheck },
|
||||
{ "Editor", "Which text editor to use during installation",
|
||||
|
|
|
|||
|
|
@ -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: sysinstall.h,v 1.71 1996/07/05 08:36:00 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.72 1996/07/08 08:54:33 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
#define DEV_NAME_MAX 64 /* The maximum length of a device name */
|
||||
#define DEV_MAX 100 /* The maximum number of devices we'll deal with */
|
||||
#define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */
|
||||
#define MAX_FTP_RETRIES "4" /* How many times to beat our heads against the wall */
|
||||
#define IO_ERROR -2 /* Status code for I/O error rather than normal EOF */
|
||||
|
||||
/*
|
||||
* I make some pretty gross assumptions about having a max of 50 chunks
|
||||
|
|
@ -90,11 +90,9 @@
|
|||
#define VAR_EDITOR "editor"
|
||||
#define VAR_EXTRAS "ifconfig_"
|
||||
#define VAR_FTP_DIR "ftpDirectory"
|
||||
#define VAR_FTP_ONERROR "ftpOnError"
|
||||
#define VAR_FTP_PASS "ftpPass"
|
||||
#define VAR_FTP_PATH "ftp"
|
||||
#define VAR_FTP_PORT "ftpPort"
|
||||
#define VAR_FTP_RETRIES "ftpRetryCount"
|
||||
#define VAR_FTP_STATE "ftpState"
|
||||
#define VAR_FTP_USER "ftpUser"
|
||||
#define VAR_FTP_HOST "ftpHost"
|
||||
|
|
@ -507,7 +505,6 @@ extern int mediaSetFTPActive(dialogMenuItem *self);
|
|||
extern int mediaSetFTPPassive(dialogMenuItem *self);
|
||||
extern int mediaSetUFS(dialogMenuItem *self);
|
||||
extern int mediaSetNFS(dialogMenuItem *self);
|
||||
extern int mediaSetFtpOnError(dialogMenuItem *self);
|
||||
extern int mediaSetFtpUserPass(dialogMenuItem *self);
|
||||
extern int mediaSetCPIOVerbosity(dialogMenuItem *self);
|
||||
extern int mediaGetType(dialogMenuItem *self);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Id: tcpip.c,v 1.42 1996/06/17 23:04:24 jkh Exp $
|
||||
* $Id: tcpip.c,v 1.43 1996/07/02 01:03:55 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Gary J Palmer. All rights reserved.
|
||||
|
|
@ -522,8 +522,10 @@ netHook(dialogMenuItem *self)
|
|||
|
||||
devs = deviceFind(self->prompt, DEVICE_TYPE_NETWORK);
|
||||
if (devs) {
|
||||
tcpOpenDialog(devs[0]);
|
||||
mediaDevice = devs[0];
|
||||
if (DITEM_STATUS(tcpOpenDialog(devs[0])) != DITEM_FAILURE)
|
||||
mediaDevice = devs[0];
|
||||
else
|
||||
devs = NULL;
|
||||
}
|
||||
return devs ? DITEM_LEAVE_MENU : DITEM_FAILURE;
|
||||
}
|
||||
|
|
@ -545,8 +547,10 @@ tcpDeviceSelect(void)
|
|||
}
|
||||
else if (cnt == 1 || (!RunningAsInit && !Fake)) {
|
||||
/* If we're running in user mode, assume network already up */
|
||||
if (RunningAsInit)
|
||||
tcpOpenDialog(devs[0]);
|
||||
if (RunningAsInit) {
|
||||
if (DITEM_STATUS(tcpOpenDialog(devs[0]) == DITEM_FAILURE))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
msgDebug("Running multi-user, assuming that the network is already up\n");
|
||||
mediaDevice = devs[0];
|
||||
|
|
|
|||
Loading…
Reference in a new issue