Now that I've got my source tree sorted out, bring all the things

I've been committing into 2.2 directly all this time.
This commit is contained in:
Jordan K. Hubbard 1996-12-14 23:09:10 +00:00
parent d3bb9749e6
commit 507372af02
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=20484
20 changed files with 346 additions and 135 deletions

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: config.c,v 1.63 1996/12/11 09:34:55 jkh Exp $
* $Id: config.c,v 1.64 1996/12/12 22:38:38 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -47,6 +47,7 @@
static Chunk *chunk_list[MAX_CHUNKS];
static int nchunks;
static int rootdev_is_od;
/* arg to sort */
static int
@ -85,6 +86,21 @@ chunk_sort(void)
}
}
static void
check_rootdev(Chunk **list, int n)
{
int i;
Chunk *c;
rootdev_is_od = 0;
for (i = 0; i < n; i++) {
c = *list++;
if (c->type == part && (c->flags & CHUNK_IS_ROOT)
&& strncmp(c->disk->name, "od", 2) == 0)
rootdev_is_od = 1;
}
}
static char *
name_of(Chunk *c1)
{
@ -127,21 +143,33 @@ static char *
fstype_short(Chunk *c1)
{
if (c1->type == part) {
if (c1->subtype != FS_SWAP)
return "rw";
if (c1->subtype != FS_SWAP) {
if (rootdev_is_od == 0 && strncmp(c1->name, "od", 2) == 0)
return "rw,noauto";
else
return "rw";
}
else
return "sw";
}
else if (c1->type == fat)
return "ro";
else if (c1->type == fat) {
if (strncmp(c1->name, "od", 2) == 0)
return "ro,noauto";
else
return "ro";
}
return "bog";
}
static int
seq_num(Chunk *c1)
{
if (c1->type == part && c1->subtype != FS_SWAP)
return 1;
if (c1->type == part && c1->subtype != FS_SWAP) {
if (rootdev_is_od == 0 && strncmp(c1->name, "od", 2) == 0)
return 0;
else
return 1;
}
return 0;
}
@ -199,6 +227,8 @@ configFstab(void)
return DITEM_FAILURE;
}
check_rootdev(chunk_list, nchunks);
/* Go for the burn */
msgDebug("Generating /etc/fstab file\n");
for (i = 0; i < nchunks; i++)

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: devices.c,v 1.53 1996/12/09 08:22:11 jkh Exp $
* $Id: devices.c,v 1.54 1996/12/11 09:34:55 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -41,6 +41,7 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <net/if.h>
#include <net/if_dl.h>
@ -68,8 +69,10 @@ static struct {
{ DEVICE_TYPE_TAPE, "rwt0", "Wangtek tape drive" },
{ DEVICE_TYPE_DISK, "sd", "SCSI disk device" },
{ DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" },
{ DEVICE_TYPE_DISK, "od", "SCSI optical disk device" },
{ DEVICE_TYPE_FLOPPY, "fd0", "floppy drive unit A" },
{ DEVICE_TYPE_FLOPPY, "fd1", "floppy drive unit B" },
{ DEVICE_TYPE_FLOPPY, "od0", "SCSI optical disk/floppy format" },
{ DEVICE_TYPE_NETWORK, "cuaa0", "%s on serial port 0 (COM1)" },
{ DEVICE_TYPE_NETWORK, "cuaa1", "%s on serial port 1 (COM2)" },
{ DEVICE_TYPE_NETWORK, "cuaa2", "%s on serial port 2 (COM3)" },

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: dispatch.c,v 1.5 1996/10/01 12:13:10 jkh Exp $
* $Id: dispatch.c,v 1.6 1996/11/04 12:56:20 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -83,6 +83,8 @@ static struct _word {
{ "mediaSetCPIOVerbosity", mediaSetCPIOVerbosity },
{ "mediaGetType", mediaGetType },
{ "optionsEditor", optionsEditor },
{ "addGroup", userAddGroup },
{ "addUser", userAddUser },
{ NULL, NULL },
};

View File

@ -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.82 1996/12/11 18:23:17 jkh Exp $
* $Id: dist.c,v 1.83 1996/12/12 08:33:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -411,7 +411,7 @@ distExtract(char *parent, Distribution *me)
}
else {
/* Try to get the distribution as a single file */
snprintf(buf, 512, "%s/%s.tgz", path, dist);
snprintf(buf, sizeof buf, "%s/%s.tgz", path, dist);
/*
* Passing TRUE as 3rd parm to get routine makes this a "probing" get, for which errors
* are not considered too significant.
@ -421,7 +421,7 @@ distExtract(char *parent, Distribution *me)
char *dir = root_bias(me[i].my_dir);
msgNotify("Extracting %s into %s directory...", dist, dir);
status = mediaExtractDist(dir, fp);
status = mediaExtractDist(dir, dist, fp);
fclose(fp);
goto done;
}
@ -452,7 +452,7 @@ distExtract(char *parent, Distribution *me)
last_msg = 0;
snprintf(buf, 512, "%s/%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
snprintf(buf, sizeof buf, "%s/%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
if (isDebug())
msgDebug("trying for piece %d of %d: %s\n", chunk + 1, numchunks, buf);
fp = mediaDevice->get(mediaDevice, buf, FALSE);
@ -461,7 +461,7 @@ distExtract(char *parent, Distribution *me)
"Aborting the transfer", buf);
goto punt;
}
snprintf(prompt, 80, "Extracting %s into %s directory...", dist, root_bias(me[i].my_dir));
snprintf(prompt, sizeof prompt, "Extracting %s into %s directory...", dist, root_bias(me[i].my_dir));
dialog_gauge("Progress", prompt, 8, 15, 6, 50, (int)((float)(chunk + 1) / numchunks * 100));
while (1) {
int seconds;

View File

@ -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.67 1996/12/11 09:35:03 jkh Exp $
* $Id: media.c,v 1.68 1996/12/12 08:36:25 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -520,29 +520,36 @@ mediaExtractDistEnd(int zpid, int cpid)
Boolean
mediaExtractDist(char *dir, FILE *fp)
mediaExtractDist(char *dir, char *dist, FILE *fp)
{
int i, j, zpid, cpid, pfd[2];
int i, j, total, seconds, zpid, cpid, pfd[2], qfd[2];
char buf[BUFSIZ];
struct timeval start, stop;
if (!dir)
dir = "/";
Mkdir(dir);
chdir(dir);
pipe(pfd);
pipe(pfd); /* read end */
pipe(qfd); /* write end */
zpid = fork();
if (!zpid) {
char *gunzip = RunningAsInit ? "/stand/gunzip" : "/usr/bin/gunzip";
dup2(fileno(fp), 0); fclose(fp);
fclose(fp);
close(qfd[1]);
dup2(qfd[0], 0); close(qfd[0]);
close(pfd[0]);
dup2(pfd[1], 1); close(pfd[1]);
if (DebugFD != -1)
dup2(DebugFD, 2);
else {
close(2);
open("/dev/null", O_WRONLY);
}
close(pfd[0]);
i = execl(gunzip, gunzip, 0);
if (isDebug())
msgDebug("%s command returns %d status\n", gunzip, i);
@ -552,15 +559,16 @@ mediaExtractDist(char *dir, FILE *fp)
if (!cpid) {
char *cpio = RunningAsInit ? "/stand/cpio" : "/usr/bin/cpio";
dup2(pfd[0], 0); close(pfd[0]);
fclose(fp);
close(pfd[1]);
dup2(pfd[0], 0); close(pfd[0]);
close (qfd[0]); close(qfd[1]);
fclose(fp);
if (DebugFD != -1) {
dup2(DebugFD, 1);
dup2(DebugFD, 2);
}
else {
close(1); open("/dev/null", O_WRONLY);
dup2(open("/dev/null", O_WRONLY), 1);
dup2(1, 2);
}
if (strlen(cpioVerbosity()))
@ -571,8 +579,32 @@ mediaExtractDist(char *dir, FILE *fp)
msgDebug("%s command returns %d status\n", cpio, i);
exit(i);
}
close(pfd[0]);
close(pfd[1]);
close(pfd[0]); close(pfd[1]);
close(qfd[0]);
total = 0;
(void)gettimeofday(&start, (struct timezone *)0);
while ((i = fread(buf, 1, BUFSIZ, fp)) > 0) {
if (write(qfd[1], buf, i) != i) {
msgDebug("Write error on transfer to cpio process, try of %d bytes\n", i);
break;
}
else {
(void)gettimeofday(&stop, (struct timezone *)0);
stop.tv_sec = stop.tv_sec - start.tv_sec;
stop.tv_usec = stop.tv_usec - start.tv_usec;
if (stop.tv_usec < 0)
stop.tv_sec--, stop.tv_usec += 1000000;
seconds = stop.tv_sec + (stop.tv_usec / 1000000.0);
if (!seconds)
seconds = 1;
total += i;
msgInfo("%10d bytes read from %s dist @ %.1f KB/sec.",
total, dist, (total / seconds) / 1024.0);
}
}
close(qfd[1]);
i = waitpid(zpid, &j, 0);
/* Don't check exit status - gunzip seems to return a bogus one! */
@ -620,7 +652,9 @@ mediaSetFTPUserPass(dialogMenuItem *self)
dialog_clear_norefresh();
if (variable_get_value(VAR_FTP_USER, "Please enter the username you wish to login as:")) {
dialog_clear_norefresh();
DialogInputAttrs |= DITEM_NO_ECHO;
pass = variable_get_value(VAR_FTP_PASS, "Please enter the password for this user:");
DialogInputAttrs &= ~DITEM_NO_ECHO;
}
else
pass = NULL;

View File

@ -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.92 1996/12/11 18:23:19 jkh Exp $
* $Id: sysinstall.h,v 1.93 1996/12/12 08:33:38 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -532,7 +532,7 @@ extern int mediaSetNFS(dialogMenuItem *self);
extern int mediaSetFTPUserPass(dialogMenuItem *self);
extern int mediaSetCPIOVerbosity(dialogMenuItem *self);
extern int mediaGetType(dialogMenuItem *self);
extern Boolean mediaExtractDist(char *dir, FILE *fp);
extern Boolean mediaExtractDist(char *dir, char *dist, FILE *fp);
extern Boolean mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpic);
extern Boolean mediaExtractDistEnd(int zpid, int cpid);
extern Boolean mediaVerify(void);

View File

@ -1,5 +1,5 @@
/*
* $Id: tcpip.c,v 1.51 1996/12/09 08:22:18 jkh Exp $
* $Id: tcpip.c,v 1.52 1996/12/12 22:44:22 jkh Exp $
*
* Copyright (c) 1995
* Gary J Palmer. All rights reserved.
@ -79,47 +79,47 @@ typedef struct _layout {
} Layout;
static Layout layout[] = {
#define LAYOUT_HOSTNAME 0
{ 1, 2, 25, HOSTNAME_FIELD_LEN - 1,
"Host:", "Your fully-qualified hostname, e.g. foo.bar.com",
hostname, STRINGOBJ, NULL },
#define LAYOUT_HOSTNAME 0
#define LAYOUT_DOMAINNAME 1
{ 1, 35, 20, HOSTNAME_FIELD_LEN - 1,
"Domain:",
"The name of the domain that your machine is in, e.g. bar.com",
domainname, STRINGOBJ, NULL },
#define LAYOUT_DOMAINNAME 1
#define LAYOUT_GATEWAY 2
{ 5, 2, 18, IPADDR_FIELD_LEN - 1,
"Gateway:",
"IP address of host forwarding packets to non-local destinations",
gateway, STRINGOBJ, NULL },
#define LAYOUT_GATEWAY 2
#define LAYOUT_NAMESERVER 3
{ 5, 35, 18, IPADDR_FIELD_LEN - 1,
"Name server:", "IP address of your local DNS server",
nameserver, STRINGOBJ, NULL },
#define LAYOUT_NAMESERVER 3
#define LAYOUT_IPADDR 4
{ 10, 10, 18, IPADDR_FIELD_LEN - 1,
"IP Address:",
"The IP address to be used for this interface",
ipaddr, STRINGOBJ, NULL },
#define LAYOUT_IPADDR 4
#define LAYOUT_NETMASK 5
{ 10, 35, 18, IPADDR_FIELD_LEN - 1,
"Netmask:",
"The netmask for this interface, e.g. 0xffffff00 for a class C network",
netmask, STRINGOBJ, NULL },
#define LAYOUT_NETMASK 5
#define LAYOUT_EXTRAS 6
{ 14, 10, 37, HOSTNAME_FIELD_LEN - 1,
"Extra options to ifconfig:",
"Any interface-specific options to ifconfig you would like to add",
extras, STRINGOBJ, NULL },
#define LAYOUT_EXTRAS 6
#define LAYOUT_OKBUTTON 7
{ 19, 15, 0, 0,
"OK", "Select this if you are happy with these settings",
&okbutton, BUTTONOBJ, NULL },
#define LAYOUT_OKBUTTON 7
#define LAYOUT_CANCELBUTTON 8
{ 19, 35, 0, 0,
"CANCEL", "Select this if you wish to cancel this screen",
&cancelbutton, BUTTONOBJ, NULL },
#define LAYOUT_CANCELBUTTON 8
{ NULL },
};
@ -314,7 +314,7 @@ tcpOpenDialog(Device *devp)
if (n == LAYOUT_HOSTNAME) {
/* We are in the Hostname field - calculate the domainname */
if ((tmp = index(hostname, '.')) != NULL) {
sstrncpy(domainname, tmp + 1, strlen(tmp + 1));
sstrncpy(domainname, tmp + 1, strlen(tmp));
RefreshStringObj(layout[LAYOUT_DOMAINNAME].obj);
}
}

View File

@ -1,5 +1,5 @@
/*
* $Id: user.c,v 1.2 1996/12/09 14:08:26 joerg Exp $
* $Id: user.c,v 1.3 1996/12/10 02:15:54 joerg Exp $
*
* Copyright (c) 1996
* Jörg Wunsch. All rights reserved.
@ -36,6 +36,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <utmp.h>
#include <sys/param.h>
#include <string.h>
#include <sysexits.h>
@ -54,20 +55,21 @@
#define GID_FIELD_LEN 10
#define GMEMB_FIELD_LEN 64
#define UNAME_FIELD_LEN 32
#define UID_FIELD_LEN 10
#define UGROUP_FIELD_LEN GNAME_FIELD_LEN
#define GECOS_FIELD_LEN 64
#define UMEMB_FIELD_LEN GMEMB_FIELD_LEN
#define HOMEDIR_FIELD_LEN 48
#define SHELL_FIELD_LEN 48
#define PASSWD_FIELD_LEN 32
/* These are nasty, but they make the layout structure a lot easier ... */
static char gname[GNAME_FIELD_LEN],
gid[GID_FIELD_LEN],
gmemb[GMEMB_FIELD_LEN],
uname[UNAME_FIELD_LEN],
uname[UT_NAMESIZE + 1],
passwd[PASSWD_FIELD_LEN],
uid[UID_FIELD_LEN],
ugroup[UGROUP_FIELD_LEN],
gecos[GECOS_FIELD_LEN],
@ -100,69 +102,71 @@ typedef struct _layout {
/* The group configuration menu. */
static Layout groupLayout[] = {
#define LAYOUT_GNAME 0
{ 4, 10, 20, GNAME_FIELD_LEN - 1,
"Group name:", "The alphanumeric name of the new group (mandatory)",
gname, STRINGOBJ, NULL },
#define LAYOUT_GNAME 0
#define LAYOUT_GID 1
{ 4, 38, 10, GID_FIELD_LEN - 1,
"GID:", "The numerical ID for this group (leave blank for automatic choice)",
gid, STRINGOBJ, NULL },
#define LAYOUT_GID 1
#define LAYOUT_GMEMB 2
{ 11, 10, 40, GMEMB_FIELD_LEN - 1,
"Group members:", "Who belongs to this group (i.e., gets access rights for it)",
gmemb, STRINGOBJ, NULL },
#define LAYOUT_GMEMB 2
#define LAYOUT_OKBUTTON 3
{ 18, 15, 0, 0,
"OK", "Select this if you are happy with these settings",
&okbutton, BUTTONOBJ, NULL },
#define LAYOUT_OKBUTTON 3
#define LAYOUT_CANCELBUTTON 4
{ 18, 35, 0, 0,
"CANCEL", "Select this if you wish to cancel this screen",
&cancelbutton, BUTTONOBJ, NULL },
#define LAYOUT_CANCELBUTTON 4
{ NULL },
};
/* The user configuration menu. */
static Layout userLayout[] = {
{ 3, 6, 20, UNAME_FIELD_LEN - 1,
#define LAYOUT_UNAME 0
{ 3, 6, UT_NAMESIZE, UT_NAMESIZE + 4,
"Login ID:", "The login name of the new user (mandatory)",
uname, STRINGOBJ, NULL },
#define LAYOUT_UNAME 0
{ 3, 29, 10, UID_FIELD_LEN - 1,
#define LAYOUT_UID 1
{ 3, 23, 8, UID_FIELD_LEN - 1,
"UID:", "The numerical ID for this user (leave blank for automatic choice)",
uid, STRINGOBJ, NULL },
#define LAYOUT_UID 1
{ 3, 43, 15, UGROUP_FIELD_LEN - 1,
#define LAYOUT_UGROUP 2
{ 3, 33, 8, UGROUP_FIELD_LEN - 1,
"Group:", "The login group name for this user (leave blank for automatic choice)",
ugroup, STRINGOBJ, NULL },
#define LAYOUT_UGROUP 2
#define LAYOUT_PASSWD 3
{ 3, 43, 15, PASSWD_FIELD_LEN - 1,
"Password:", "The password for this user (enter this field with care!)",
passwd, STRINGOBJ, NULL },
#define LAYOUT_GECOS 4
{ 8, 6, 33, GECOS_FIELD_LEN - 1,
"Full name:", "The user's full name (comment)",
gecos, STRINGOBJ, NULL },
#define LAYOUT_GECOS 3
#define LAYOUT_UMEMB 5
{ 8, 43, 15, UMEMB_FIELD_LEN - 1,
"Member groups:", "The groups this user belongs to (i.e. gets access rights for)",
umemb, STRINGOBJ, NULL },
#define LAYOUT_UMEMB 4
#define LAYOUT_HOMEDIR 6
{ 13, 6, 20, HOMEDIR_FIELD_LEN - 1,
"Home directory:", "The user's home directory (leave blank for default)",
homedir, STRINGOBJ, NULL },
#define LAYOUT_HOMEDIR 5
#define LAYOUT_SHELL 7
{ 13, 29, 29, SHELL_FIELD_LEN - 1,
"Login shell:", "The user's login shell (leave blank for default)",
shell, STRINGOBJ, NULL },
#define LAYOUT_SHELL 6
#define LAYOUT_U_OKBUTTON 8
{ 18, 15, 0, 0,
"OK", "Select this if you are happy with these settings",
&okbutton, BUTTONOBJ, NULL },
#define LAYOUT_U_OKBUTTON 7
#define LAYOUT_U_CANCELBUTTON 9
{ 18, 35, 0, 0,
"CANCEL", "Select this if you wish to cancel this screen",
&cancelbutton, BUTTONOBJ, NULL },
#define LAYOUT_U_CANCELBUTTON 8
{ NULL },
};
@ -661,7 +665,7 @@ static void
addUser(WINDOW *ds_win)
{
char tmp[256], *msg;
int pfd[2], i, j;
int pfd[2], ipfd[2], i, j;
ssize_t l;
size_t amnt;
pid_t pid;
@ -678,9 +682,11 @@ addUser(WINDOW *ds_win)
msgNotify("Adding user \"%s\"...", uname);
pipe (pfd);
pipe (ipfd);
if ((pid = fork()) == 0)
{
/* The kiddy. */
dup2(ipfd[0], 0);
dup2(pfd[1], 1);
dup2(pfd[1], 2);
for (i = getdtablesize(); i > 2; i--)
@ -695,6 +701,10 @@ addUser(WINDOW *ds_win)
ADDVEC(homedir, "-d");
ADDVEC(shell, "-s");
ADDVEC(umemb, "-G");
if (passwd[0]) {
vec[i++] = "-h";
vec[i++] = "0";
}
vec[i] = 0;
chroot(variable_get(VAR_INSTALL_ROOT));
@ -706,6 +716,11 @@ addUser(WINDOW *ds_win)
{
/* The oldie. */
close(pfd[1]);
close(ipfd[0]);
if (passwd[0])
write(ipfd[1], passwd, strlen(passwd));
close(ipfd[1]);
amnt = sizeof tmp;
i = 0;
while((l = read(pfd[0], &tmp[i], amnt)) > 0)
@ -746,7 +761,7 @@ addUser(WINDOW *ds_win)
msgConfirm(msg, j);
}
}
else
else if (!passwd[0])
msgConfirm("You will need to enter a password for this user\n"
"later, using the passwd(1) command from the shell.\n\n"
"The account for `%s' is currently still disabled.",
@ -795,6 +810,7 @@ userAddUser(dialogMenuItem *self)
CLEAR(uid);
CLEAR(ugroup);
CLEAR(gecos);
CLEAR(passwd);
CLEAR(umemb);
CLEAR(homedir);
CLEAR(shell);
@ -804,6 +820,8 @@ userAddUser(dialogMenuItem *self)
n = 0;
#define lt userLayout[n]
while (lt.help != NULL) {
if (n == LAYOUT_PASSWD)
DialogInputAttrs = DITEM_NO_ECHO; /* This will affect the new string object if set */
switch (lt.type) {
case STRINGOBJ:
lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
@ -820,6 +838,7 @@ userAddUser(dialogMenuItem *self)
msgFatal("Don't support this object yet!");
}
AddObj(&obj, lt.type, (void *) lt.obj);
DialogInputAttrs = 0;
n++;
}
max = n - 1;

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: config.c,v 1.63 1996/12/11 09:34:55 jkh Exp $
* $Id: config.c,v 1.64 1996/12/12 22:38:38 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -47,6 +47,7 @@
static Chunk *chunk_list[MAX_CHUNKS];
static int nchunks;
static int rootdev_is_od;
/* arg to sort */
static int
@ -85,6 +86,21 @@ chunk_sort(void)
}
}
static void
check_rootdev(Chunk **list, int n)
{
int i;
Chunk *c;
rootdev_is_od = 0;
for (i = 0; i < n; i++) {
c = *list++;
if (c->type == part && (c->flags & CHUNK_IS_ROOT)
&& strncmp(c->disk->name, "od", 2) == 0)
rootdev_is_od = 1;
}
}
static char *
name_of(Chunk *c1)
{
@ -127,21 +143,33 @@ static char *
fstype_short(Chunk *c1)
{
if (c1->type == part) {
if (c1->subtype != FS_SWAP)
return "rw";
if (c1->subtype != FS_SWAP) {
if (rootdev_is_od == 0 && strncmp(c1->name, "od", 2) == 0)
return "rw,noauto";
else
return "rw";
}
else
return "sw";
}
else if (c1->type == fat)
return "ro";
else if (c1->type == fat) {
if (strncmp(c1->name, "od", 2) == 0)
return "ro,noauto";
else
return "ro";
}
return "bog";
}
static int
seq_num(Chunk *c1)
{
if (c1->type == part && c1->subtype != FS_SWAP)
return 1;
if (c1->type == part && c1->subtype != FS_SWAP) {
if (rootdev_is_od == 0 && strncmp(c1->name, "od", 2) == 0)
return 0;
else
return 1;
}
return 0;
}
@ -199,6 +227,8 @@ configFstab(void)
return DITEM_FAILURE;
}
check_rootdev(chunk_list, nchunks);
/* Go for the burn */
msgDebug("Generating /etc/fstab file\n");
for (i = 0; i < nchunks; i++)

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: devices.c,v 1.53 1996/12/09 08:22:11 jkh Exp $
* $Id: devices.c,v 1.54 1996/12/11 09:34:55 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -41,6 +41,7 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <net/if.h>
#include <net/if_dl.h>
@ -68,8 +69,10 @@ static struct {
{ DEVICE_TYPE_TAPE, "rwt0", "Wangtek tape drive" },
{ DEVICE_TYPE_DISK, "sd", "SCSI disk device" },
{ DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" },
{ DEVICE_TYPE_DISK, "od", "SCSI optical disk device" },
{ DEVICE_TYPE_FLOPPY, "fd0", "floppy drive unit A" },
{ DEVICE_TYPE_FLOPPY, "fd1", "floppy drive unit B" },
{ DEVICE_TYPE_FLOPPY, "od0", "SCSI optical disk/floppy format" },
{ DEVICE_TYPE_NETWORK, "cuaa0", "%s on serial port 0 (COM1)" },
{ DEVICE_TYPE_NETWORK, "cuaa1", "%s on serial port 1 (COM2)" },
{ DEVICE_TYPE_NETWORK, "cuaa2", "%s on serial port 2 (COM3)" },

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: dispatch.c,v 1.5 1996/10/01 12:13:10 jkh Exp $
* $Id: dispatch.c,v 1.6 1996/11/04 12:56:20 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -83,6 +83,8 @@ static struct _word {
{ "mediaSetCPIOVerbosity", mediaSetCPIOVerbosity },
{ "mediaGetType", mediaGetType },
{ "optionsEditor", optionsEditor },
{ "addGroup", userAddGroup },
{ "addUser", userAddUser },
{ NULL, NULL },
};

View File

@ -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.92 1996/12/11 18:23:19 jkh Exp $
* $Id: sysinstall.h,v 1.93 1996/12/12 08:33:38 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -532,7 +532,7 @@ extern int mediaSetNFS(dialogMenuItem *self);
extern int mediaSetFTPUserPass(dialogMenuItem *self);
extern int mediaSetCPIOVerbosity(dialogMenuItem *self);
extern int mediaGetType(dialogMenuItem *self);
extern Boolean mediaExtractDist(char *dir, FILE *fp);
extern Boolean mediaExtractDist(char *dir, char *dist, FILE *fp);
extern Boolean mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpic);
extern Boolean mediaExtractDistEnd(int zpid, int cpid);
extern Boolean mediaVerify(void);

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: config.c,v 1.63 1996/12/11 09:34:55 jkh Exp $
* $Id: config.c,v 1.64 1996/12/12 22:38:38 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -47,6 +47,7 @@
static Chunk *chunk_list[MAX_CHUNKS];
static int nchunks;
static int rootdev_is_od;
/* arg to sort */
static int
@ -85,6 +86,21 @@ chunk_sort(void)
}
}
static void
check_rootdev(Chunk **list, int n)
{
int i;
Chunk *c;
rootdev_is_od = 0;
for (i = 0; i < n; i++) {
c = *list++;
if (c->type == part && (c->flags & CHUNK_IS_ROOT)
&& strncmp(c->disk->name, "od", 2) == 0)
rootdev_is_od = 1;
}
}
static char *
name_of(Chunk *c1)
{
@ -127,21 +143,33 @@ static char *
fstype_short(Chunk *c1)
{
if (c1->type == part) {
if (c1->subtype != FS_SWAP)
return "rw";
if (c1->subtype != FS_SWAP) {
if (rootdev_is_od == 0 && strncmp(c1->name, "od", 2) == 0)
return "rw,noauto";
else
return "rw";
}
else
return "sw";
}
else if (c1->type == fat)
return "ro";
else if (c1->type == fat) {
if (strncmp(c1->name, "od", 2) == 0)
return "ro,noauto";
else
return "ro";
}
return "bog";
}
static int
seq_num(Chunk *c1)
{
if (c1->type == part && c1->subtype != FS_SWAP)
return 1;
if (c1->type == part && c1->subtype != FS_SWAP) {
if (rootdev_is_od == 0 && strncmp(c1->name, "od", 2) == 0)
return 0;
else
return 1;
}
return 0;
}
@ -199,6 +227,8 @@ configFstab(void)
return DITEM_FAILURE;
}
check_rootdev(chunk_list, nchunks);
/* Go for the burn */
msgDebug("Generating /etc/fstab file\n");
for (i = 0; i < nchunks; i++)

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: devices.c,v 1.53 1996/12/09 08:22:11 jkh Exp $
* $Id: devices.c,v 1.54 1996/12/11 09:34:55 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -41,6 +41,7 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <net/if.h>
#include <net/if_dl.h>
@ -68,8 +69,10 @@ static struct {
{ DEVICE_TYPE_TAPE, "rwt0", "Wangtek tape drive" },
{ DEVICE_TYPE_DISK, "sd", "SCSI disk device" },
{ DEVICE_TYPE_DISK, "wd", "IDE/ESDI/MFM/ST506 disk device" },
{ DEVICE_TYPE_DISK, "od", "SCSI optical disk device" },
{ DEVICE_TYPE_FLOPPY, "fd0", "floppy drive unit A" },
{ DEVICE_TYPE_FLOPPY, "fd1", "floppy drive unit B" },
{ DEVICE_TYPE_FLOPPY, "od0", "SCSI optical disk/floppy format" },
{ DEVICE_TYPE_NETWORK, "cuaa0", "%s on serial port 0 (COM1)" },
{ DEVICE_TYPE_NETWORK, "cuaa1", "%s on serial port 1 (COM2)" },
{ DEVICE_TYPE_NETWORK, "cuaa2", "%s on serial port 2 (COM3)" },

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: dispatch.c,v 1.5 1996/10/01 12:13:10 jkh Exp $
* $Id: dispatch.c,v 1.6 1996/11/04 12:56:20 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -83,6 +83,8 @@ static struct _word {
{ "mediaSetCPIOVerbosity", mediaSetCPIOVerbosity },
{ "mediaGetType", mediaGetType },
{ "optionsEditor", optionsEditor },
{ "addGroup", userAddGroup },
{ "addUser", userAddUser },
{ NULL, NULL },
};

View File

@ -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.82 1996/12/11 18:23:17 jkh Exp $
* $Id: dist.c,v 1.83 1996/12/12 08:33:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -411,7 +411,7 @@ distExtract(char *parent, Distribution *me)
}
else {
/* Try to get the distribution as a single file */
snprintf(buf, 512, "%s/%s.tgz", path, dist);
snprintf(buf, sizeof buf, "%s/%s.tgz", path, dist);
/*
* Passing TRUE as 3rd parm to get routine makes this a "probing" get, for which errors
* are not considered too significant.
@ -421,7 +421,7 @@ distExtract(char *parent, Distribution *me)
char *dir = root_bias(me[i].my_dir);
msgNotify("Extracting %s into %s directory...", dist, dir);
status = mediaExtractDist(dir, fp);
status = mediaExtractDist(dir, dist, fp);
fclose(fp);
goto done;
}
@ -452,7 +452,7 @@ distExtract(char *parent, Distribution *me)
last_msg = 0;
snprintf(buf, 512, "%s/%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
snprintf(buf, sizeof buf, "%s/%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a');
if (isDebug())
msgDebug("trying for piece %d of %d: %s\n", chunk + 1, numchunks, buf);
fp = mediaDevice->get(mediaDevice, buf, FALSE);
@ -461,7 +461,7 @@ distExtract(char *parent, Distribution *me)
"Aborting the transfer", buf);
goto punt;
}
snprintf(prompt, 80, "Extracting %s into %s directory...", dist, root_bias(me[i].my_dir));
snprintf(prompt, sizeof prompt, "Extracting %s into %s directory...", dist, root_bias(me[i].my_dir));
dialog_gauge("Progress", prompt, 8, 15, 6, 50, (int)((float)(chunk + 1) / numchunks * 100));
while (1) {
int seconds;

View File

@ -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.67 1996/12/11 09:35:03 jkh Exp $
* $Id: media.c,v 1.68 1996/12/12 08:36:25 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -520,29 +520,36 @@ mediaExtractDistEnd(int zpid, int cpid)
Boolean
mediaExtractDist(char *dir, FILE *fp)
mediaExtractDist(char *dir, char *dist, FILE *fp)
{
int i, j, zpid, cpid, pfd[2];
int i, j, total, seconds, zpid, cpid, pfd[2], qfd[2];
char buf[BUFSIZ];
struct timeval start, stop;
if (!dir)
dir = "/";
Mkdir(dir);
chdir(dir);
pipe(pfd);
pipe(pfd); /* read end */
pipe(qfd); /* write end */
zpid = fork();
if (!zpid) {
char *gunzip = RunningAsInit ? "/stand/gunzip" : "/usr/bin/gunzip";
dup2(fileno(fp), 0); fclose(fp);
fclose(fp);
close(qfd[1]);
dup2(qfd[0], 0); close(qfd[0]);
close(pfd[0]);
dup2(pfd[1], 1); close(pfd[1]);
if (DebugFD != -1)
dup2(DebugFD, 2);
else {
close(2);
open("/dev/null", O_WRONLY);
}
close(pfd[0]);
i = execl(gunzip, gunzip, 0);
if (isDebug())
msgDebug("%s command returns %d status\n", gunzip, i);
@ -552,15 +559,16 @@ mediaExtractDist(char *dir, FILE *fp)
if (!cpid) {
char *cpio = RunningAsInit ? "/stand/cpio" : "/usr/bin/cpio";
dup2(pfd[0], 0); close(pfd[0]);
fclose(fp);
close(pfd[1]);
dup2(pfd[0], 0); close(pfd[0]);
close (qfd[0]); close(qfd[1]);
fclose(fp);
if (DebugFD != -1) {
dup2(DebugFD, 1);
dup2(DebugFD, 2);
}
else {
close(1); open("/dev/null", O_WRONLY);
dup2(open("/dev/null", O_WRONLY), 1);
dup2(1, 2);
}
if (strlen(cpioVerbosity()))
@ -571,8 +579,32 @@ mediaExtractDist(char *dir, FILE *fp)
msgDebug("%s command returns %d status\n", cpio, i);
exit(i);
}
close(pfd[0]);
close(pfd[1]);
close(pfd[0]); close(pfd[1]);
close(qfd[0]);
total = 0;
(void)gettimeofday(&start, (struct timezone *)0);
while ((i = fread(buf, 1, BUFSIZ, fp)) > 0) {
if (write(qfd[1], buf, i) != i) {
msgDebug("Write error on transfer to cpio process, try of %d bytes\n", i);
break;
}
else {
(void)gettimeofday(&stop, (struct timezone *)0);
stop.tv_sec = stop.tv_sec - start.tv_sec;
stop.tv_usec = stop.tv_usec - start.tv_usec;
if (stop.tv_usec < 0)
stop.tv_sec--, stop.tv_usec += 1000000;
seconds = stop.tv_sec + (stop.tv_usec / 1000000.0);
if (!seconds)
seconds = 1;
total += i;
msgInfo("%10d bytes read from %s dist @ %.1f KB/sec.",
total, dist, (total / seconds) / 1024.0);
}
}
close(qfd[1]);
i = waitpid(zpid, &j, 0);
/* Don't check exit status - gunzip seems to return a bogus one! */
@ -620,7 +652,9 @@ mediaSetFTPUserPass(dialogMenuItem *self)
dialog_clear_norefresh();
if (variable_get_value(VAR_FTP_USER, "Please enter the username you wish to login as:")) {
dialog_clear_norefresh();
DialogInputAttrs |= DITEM_NO_ECHO;
pass = variable_get_value(VAR_FTP_PASS, "Please enter the password for this user:");
DialogInputAttrs &= ~DITEM_NO_ECHO;
}
else
pass = NULL;

View File

@ -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.92 1996/12/11 18:23:19 jkh Exp $
* $Id: sysinstall.h,v 1.93 1996/12/12 08:33:38 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -532,7 +532,7 @@ extern int mediaSetNFS(dialogMenuItem *self);
extern int mediaSetFTPUserPass(dialogMenuItem *self);
extern int mediaSetCPIOVerbosity(dialogMenuItem *self);
extern int mediaGetType(dialogMenuItem *self);
extern Boolean mediaExtractDist(char *dir, FILE *fp);
extern Boolean mediaExtractDist(char *dir, char *dist, FILE *fp);
extern Boolean mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpic);
extern Boolean mediaExtractDistEnd(int zpid, int cpid);
extern Boolean mediaVerify(void);

View File

@ -1,5 +1,5 @@
/*
* $Id: tcpip.c,v 1.51 1996/12/09 08:22:18 jkh Exp $
* $Id: tcpip.c,v 1.52 1996/12/12 22:44:22 jkh Exp $
*
* Copyright (c) 1995
* Gary J Palmer. All rights reserved.
@ -79,47 +79,47 @@ typedef struct _layout {
} Layout;
static Layout layout[] = {
#define LAYOUT_HOSTNAME 0
{ 1, 2, 25, HOSTNAME_FIELD_LEN - 1,
"Host:", "Your fully-qualified hostname, e.g. foo.bar.com",
hostname, STRINGOBJ, NULL },
#define LAYOUT_HOSTNAME 0
#define LAYOUT_DOMAINNAME 1
{ 1, 35, 20, HOSTNAME_FIELD_LEN - 1,
"Domain:",
"The name of the domain that your machine is in, e.g. bar.com",
domainname, STRINGOBJ, NULL },
#define LAYOUT_DOMAINNAME 1
#define LAYOUT_GATEWAY 2
{ 5, 2, 18, IPADDR_FIELD_LEN - 1,
"Gateway:",
"IP address of host forwarding packets to non-local destinations",
gateway, STRINGOBJ, NULL },
#define LAYOUT_GATEWAY 2
#define LAYOUT_NAMESERVER 3
{ 5, 35, 18, IPADDR_FIELD_LEN - 1,
"Name server:", "IP address of your local DNS server",
nameserver, STRINGOBJ, NULL },
#define LAYOUT_NAMESERVER 3
#define LAYOUT_IPADDR 4
{ 10, 10, 18, IPADDR_FIELD_LEN - 1,
"IP Address:",
"The IP address to be used for this interface",
ipaddr, STRINGOBJ, NULL },
#define LAYOUT_IPADDR 4
#define LAYOUT_NETMASK 5
{ 10, 35, 18, IPADDR_FIELD_LEN - 1,
"Netmask:",
"The netmask for this interface, e.g. 0xffffff00 for a class C network",
netmask, STRINGOBJ, NULL },
#define LAYOUT_NETMASK 5
#define LAYOUT_EXTRAS 6
{ 14, 10, 37, HOSTNAME_FIELD_LEN - 1,
"Extra options to ifconfig:",
"Any interface-specific options to ifconfig you would like to add",
extras, STRINGOBJ, NULL },
#define LAYOUT_EXTRAS 6
#define LAYOUT_OKBUTTON 7
{ 19, 15, 0, 0,
"OK", "Select this if you are happy with these settings",
&okbutton, BUTTONOBJ, NULL },
#define LAYOUT_OKBUTTON 7
#define LAYOUT_CANCELBUTTON 8
{ 19, 35, 0, 0,
"CANCEL", "Select this if you wish to cancel this screen",
&cancelbutton, BUTTONOBJ, NULL },
#define LAYOUT_CANCELBUTTON 8
{ NULL },
};
@ -314,7 +314,7 @@ tcpOpenDialog(Device *devp)
if (n == LAYOUT_HOSTNAME) {
/* We are in the Hostname field - calculate the domainname */
if ((tmp = index(hostname, '.')) != NULL) {
sstrncpy(domainname, tmp + 1, strlen(tmp + 1));
sstrncpy(domainname, tmp + 1, strlen(tmp));
RefreshStringObj(layout[LAYOUT_DOMAINNAME].obj);
}
}

View File

@ -1,5 +1,5 @@
/*
* $Id: user.c,v 1.2 1996/12/09 14:08:26 joerg Exp $
* $Id: user.c,v 1.3 1996/12/10 02:15:54 joerg Exp $
*
* Copyright (c) 1996
* Jörg Wunsch. All rights reserved.
@ -36,6 +36,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <utmp.h>
#include <sys/param.h>
#include <string.h>
#include <sysexits.h>
@ -54,20 +55,21 @@
#define GID_FIELD_LEN 10
#define GMEMB_FIELD_LEN 64
#define UNAME_FIELD_LEN 32
#define UID_FIELD_LEN 10
#define UGROUP_FIELD_LEN GNAME_FIELD_LEN
#define GECOS_FIELD_LEN 64
#define UMEMB_FIELD_LEN GMEMB_FIELD_LEN
#define HOMEDIR_FIELD_LEN 48
#define SHELL_FIELD_LEN 48
#define PASSWD_FIELD_LEN 32
/* These are nasty, but they make the layout structure a lot easier ... */
static char gname[GNAME_FIELD_LEN],
gid[GID_FIELD_LEN],
gmemb[GMEMB_FIELD_LEN],
uname[UNAME_FIELD_LEN],
uname[UT_NAMESIZE + 1],
passwd[PASSWD_FIELD_LEN],
uid[UID_FIELD_LEN],
ugroup[UGROUP_FIELD_LEN],
gecos[GECOS_FIELD_LEN],
@ -100,69 +102,71 @@ typedef struct _layout {
/* The group configuration menu. */
static Layout groupLayout[] = {
#define LAYOUT_GNAME 0
{ 4, 10, 20, GNAME_FIELD_LEN - 1,
"Group name:", "The alphanumeric name of the new group (mandatory)",
gname, STRINGOBJ, NULL },
#define LAYOUT_GNAME 0
#define LAYOUT_GID 1
{ 4, 38, 10, GID_FIELD_LEN - 1,
"GID:", "The numerical ID for this group (leave blank for automatic choice)",
gid, STRINGOBJ, NULL },
#define LAYOUT_GID 1
#define LAYOUT_GMEMB 2
{ 11, 10, 40, GMEMB_FIELD_LEN - 1,
"Group members:", "Who belongs to this group (i.e., gets access rights for it)",
gmemb, STRINGOBJ, NULL },
#define LAYOUT_GMEMB 2
#define LAYOUT_OKBUTTON 3
{ 18, 15, 0, 0,
"OK", "Select this if you are happy with these settings",
&okbutton, BUTTONOBJ, NULL },
#define LAYOUT_OKBUTTON 3
#define LAYOUT_CANCELBUTTON 4
{ 18, 35, 0, 0,
"CANCEL", "Select this if you wish to cancel this screen",
&cancelbutton, BUTTONOBJ, NULL },
#define LAYOUT_CANCELBUTTON 4
{ NULL },
};
/* The user configuration menu. */
static Layout userLayout[] = {
{ 3, 6, 20, UNAME_FIELD_LEN - 1,
#define LAYOUT_UNAME 0
{ 3, 6, UT_NAMESIZE, UT_NAMESIZE + 4,
"Login ID:", "The login name of the new user (mandatory)",
uname, STRINGOBJ, NULL },
#define LAYOUT_UNAME 0
{ 3, 29, 10, UID_FIELD_LEN - 1,
#define LAYOUT_UID 1
{ 3, 23, 8, UID_FIELD_LEN - 1,
"UID:", "The numerical ID for this user (leave blank for automatic choice)",
uid, STRINGOBJ, NULL },
#define LAYOUT_UID 1
{ 3, 43, 15, UGROUP_FIELD_LEN - 1,
#define LAYOUT_UGROUP 2
{ 3, 33, 8, UGROUP_FIELD_LEN - 1,
"Group:", "The login group name for this user (leave blank for automatic choice)",
ugroup, STRINGOBJ, NULL },
#define LAYOUT_UGROUP 2
#define LAYOUT_PASSWD 3
{ 3, 43, 15, PASSWD_FIELD_LEN - 1,
"Password:", "The password for this user (enter this field with care!)",
passwd, STRINGOBJ, NULL },
#define LAYOUT_GECOS 4
{ 8, 6, 33, GECOS_FIELD_LEN - 1,
"Full name:", "The user's full name (comment)",
gecos, STRINGOBJ, NULL },
#define LAYOUT_GECOS 3
#define LAYOUT_UMEMB 5
{ 8, 43, 15, UMEMB_FIELD_LEN - 1,
"Member groups:", "The groups this user belongs to (i.e. gets access rights for)",
umemb, STRINGOBJ, NULL },
#define LAYOUT_UMEMB 4
#define LAYOUT_HOMEDIR 6
{ 13, 6, 20, HOMEDIR_FIELD_LEN - 1,
"Home directory:", "The user's home directory (leave blank for default)",
homedir, STRINGOBJ, NULL },
#define LAYOUT_HOMEDIR 5
#define LAYOUT_SHELL 7
{ 13, 29, 29, SHELL_FIELD_LEN - 1,
"Login shell:", "The user's login shell (leave blank for default)",
shell, STRINGOBJ, NULL },
#define LAYOUT_SHELL 6
#define LAYOUT_U_OKBUTTON 8
{ 18, 15, 0, 0,
"OK", "Select this if you are happy with these settings",
&okbutton, BUTTONOBJ, NULL },
#define LAYOUT_U_OKBUTTON 7
#define LAYOUT_U_CANCELBUTTON 9
{ 18, 35, 0, 0,
"CANCEL", "Select this if you wish to cancel this screen",
&cancelbutton, BUTTONOBJ, NULL },
#define LAYOUT_U_CANCELBUTTON 8
{ NULL },
};
@ -661,7 +665,7 @@ static void
addUser(WINDOW *ds_win)
{
char tmp[256], *msg;
int pfd[2], i, j;
int pfd[2], ipfd[2], i, j;
ssize_t l;
size_t amnt;
pid_t pid;
@ -678,9 +682,11 @@ addUser(WINDOW *ds_win)
msgNotify("Adding user \"%s\"...", uname);
pipe (pfd);
pipe (ipfd);
if ((pid = fork()) == 0)
{
/* The kiddy. */
dup2(ipfd[0], 0);
dup2(pfd[1], 1);
dup2(pfd[1], 2);
for (i = getdtablesize(); i > 2; i--)
@ -695,6 +701,10 @@ addUser(WINDOW *ds_win)
ADDVEC(homedir, "-d");
ADDVEC(shell, "-s");
ADDVEC(umemb, "-G");
if (passwd[0]) {
vec[i++] = "-h";
vec[i++] = "0";
}
vec[i] = 0;
chroot(variable_get(VAR_INSTALL_ROOT));
@ -706,6 +716,11 @@ addUser(WINDOW *ds_win)
{
/* The oldie. */
close(pfd[1]);
close(ipfd[0]);
if (passwd[0])
write(ipfd[1], passwd, strlen(passwd));
close(ipfd[1]);
amnt = sizeof tmp;
i = 0;
while((l = read(pfd[0], &tmp[i], amnt)) > 0)
@ -746,7 +761,7 @@ addUser(WINDOW *ds_win)
msgConfirm(msg, j);
}
}
else
else if (!passwd[0])
msgConfirm("You will need to enter a password for this user\n"
"later, using the passwd(1) command from the shell.\n\n"
"The account for `%s' is currently still disabled.",
@ -795,6 +810,7 @@ userAddUser(dialogMenuItem *self)
CLEAR(uid);
CLEAR(ugroup);
CLEAR(gecos);
CLEAR(passwd);
CLEAR(umemb);
CLEAR(homedir);
CLEAR(shell);
@ -804,6 +820,8 @@ userAddUser(dialogMenuItem *self)
n = 0;
#define lt userLayout[n]
while (lt.help != NULL) {
if (n == LAYOUT_PASSWD)
DialogInputAttrs = DITEM_NO_ECHO; /* This will affect the new string object if set */
switch (lt.type) {
case STRINGOBJ:
lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
@ -820,6 +838,7 @@ userAddUser(dialogMenuItem *self)
msgFatal("Don't support this object yet!");
}
AddObj(&obj, lt.type, (void *) lt.obj);
DialogInputAttrs = 0;
n++;
}
max = n - 1;