/*
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1985 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#include "lint.h"
#include <ctype.h>
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
#include "libc.h"
#include <unistd.h>
/*
*
* Do not add restricted shells:
* Shells returned by getusershell traditionally allow:
* - users to change away from (i.e., if you have an rksh in
* getusershell(), then users can change their shell to ksh)
* - by default, ftp in is allowed only for shells returned by
* getusershell(); since FTP has no restrictions on directory
* movement, adding rksh to getusershell() would defeat that
* protection.
*/
/* The three entries:
*
*
* are included in the array below, to allow compatibility
* with older systems, where, for example, the shell defined
*/
const char *okshells[] = {
};
static char **curshell;
static char **initshells(void);
/*
* Get a list of shells from SHELLS, if it exists.
*/
char *
getusershell(void)
{
char *ret;
curshell = initshells();
curshell++;
return (ret);
}
void
endusershell(void)
{
}
void
setusershell(void)
{
curshell = initshells();
}
static char **
initshells(void)
{
return ((char **)okshells);
/*
* The +1 in the malloc() below is needed to handle the final
* fgets() NULL terminator. From fgets(3S):
*
* char *fgets(char *s, int n, FILE *stream);
*
* The fgets() function reads characters from the stream into
* the array pointed to by s, until n-1 characters are read, or
* a newline character is read and transferred to s, or an end-
* of-file condition is encountered. The string is then termi-
* nated with a null character.
*/
return ((char **)okshells);
}
return ((char **)okshells);
}
cp++;
continue;
cp++;
*cp++ = '\0';
}
*sp = (char *)0;
return (shells);
}