tsp@wlcrjs.UUCP (Tom Poindexter) (06/28/85)
Some of you using PC-Xenix 1.0 know about the 1mb file size limit
imposed by {ibm,microsoft}. I have written a small hack around
this. The attached programs are intended to be the login shell,
invoked at login time. They really just act as a wedge, setting
a larger ulimit(), and invoking the real shell. The small trick
is that the real uid has to be root uid for ulimit to set a
larger size, so the routine gets the real uid, sets root uid, then
sets the real id after the ulimit call. Two programs are provided:
bigsh.c as a wedge for /bin/sh, and bigcsh.c as a wedge for /bin/csh.
I didn't bother writting one for vsh. You probably want to test
this on a single uid first before changing all users.
(this is not in shar format).
Feel free to set the USIZE define to whatever trips your trigger.
Tom Poindexter
-------------------bigsh.c------------------
/*
* bigsh.c - sets a larger ulimit (USIZE) and invokes /bin/sh.
*
* use this program as the shell in /etc/passwd.
* this program should be installed in /bin:
* cc -i -o bigsh bigsh.c
* chmod 4711 bigsh
* chown root bigsh; chgrp root bigsh
*
* see bigcsh.c for csh
*/
/* define ulimit size, in 512 byte chunks */
#define USIZE 40960L /* yields 20mb, who's counting anyway? */
#include <sys/ulimit.h>
main(argc,argv)
int argc;
char *argv[];
{
int user;
long ulimit();
user = getuid(); /* get real user id */
setuid(0); /* set root id for ulimit call */
ulimit(UL_SFILLIM,USIZE); /* set the new limit */
setuid(user); /* reset the user id */
execl("/bin/sh","-sh",(char *) 0); /* invoke sh as login shell */
}
-------------------bigcsh.c------------------
/*
* bigcsh.c - sets a larger ulimit (USIZE) and invokes /bin/csh.
*
* use this program as the shell in /etc/passwd.
* this program should be installed in /bin:
* cc -i -o bigcsh bigcsh.c
* chmod 4711 bigcsh
* chown root bigcsh; chgrp root bigcsh
*
* see bigsh.c for sh
*/
/* define ulimit size, in 512 byte chunks */
#define USIZE 40960L /* yields 20mb, who's counting anyway? */
#include <sys/ulimit.h>
main(argc,argv)
int argc;
char *argv[];
{
int user;
long ulimit();
user = getuid(); /* get real user id */
setuid(0); /* set root id for ulimit call */
ulimit(UL_SFILLIM,USIZE); /* set the new limit */
setuid(user); /* reset the user id */
execl("/bin/csh","-csh",(char *) 0); /* invoke csh as login shell */
}
---------------------------------------------
--
Tom Poindexter UUCP: ihnp4!wlcrjs!tsp
Compuserve: 70040,1223
Source: STW526
Dialcom: 44:SFP008