VERSION = 1
PATCHLEVEL = 1
-SUBLEVEL = 43
+SUBLEVEL = 44
all: Version zImage
{
struct fparm {
unsigned char track,head,sect,size;
- } *here = (void *)floppy_track_buffer;
+ } *here = (struct fparm *)floppy_track_buffer;
int ssize,il,n;
int count,head_shift,track_shift;
id.cyls*id.heads*id.sectors/2048, id.buf_size/2,
hd_info[dev].cyl, hd_info[dev].head, hd_info[dev].sect, id.max_multsect);
/* save drive info for later query via HDIO_GETIDENTITY */
- if (NULL != (hd_ident_info[dev] = kmalloc(sizeof(id),GFP_ATOMIC)))
+ if (NULL != (hd_ident_info[dev] = (struct hd_driveid *)kmalloc(sizeof(id),GFP_ATOMIC)))
*hd_ident_info[dev] = id;
/* flush remaining 384 (reserved/undefined) ID bytes: */
{
int c, n = 0;
unsigned int currcons;
- struct vt_struct *vt = tty->driver_data;
+ struct vt_struct *vt = (struct vt_struct *)tty->driver_data;
currcons = vt->vc_num;
if (currcons >= NR_CONSOLES) {
static void highlight_pointer(const int currcons, const int where)
{
unsigned char *p;
- static char *prev=NULL;
+ static unsigned char *prev=NULL;
if (where==-1) /* remove the pointer */
{
*/
static void rs_stop(struct tty_struct *tty)
{
- struct async_struct *info = tty->driver_data;
+ struct async_struct *info = (struct async_struct *)tty->driver_data;
unsigned long flags;
if (serial_paranoia_check(info, tty->device, "rs_stop"))
static void rs_start(struct tty_struct *tty)
{
- struct async_struct *info = tty->driver_data;
+ struct async_struct *info = (struct async_struct *)tty->driver_data;
unsigned long flags;
if (serial_paranoia_check(info, tty->device, "rs_start"))
run_task_queue(&tq_serial);
}
-static void do_softint(void *private)
+static void do_softint(void *private_)
{
- struct async_struct *info = (struct async_struct *) private;
+ struct async_struct *info = (struct async_struct *) private_;
struct tty_struct *tty;
tty = info->tty;
static void rs_put_char(struct tty_struct *tty, unsigned char ch)
{
- struct async_struct *info = tty->driver_data;
+ struct async_struct *info = (struct async_struct *)tty->driver_data;
unsigned long flags;
if (serial_paranoia_check(info, tty->device, "rs_put_char"))
static void rs_flush_chars(struct tty_struct *tty)
{
- struct async_struct *info = tty->driver_data;
+ struct async_struct *info = (struct async_struct *)tty->driver_data;
unsigned long flags;
if (serial_paranoia_check(info, tty->device, "rs_flush_chars"))
unsigned char *buf, int count)
{
int c, total = 0;
- struct async_struct *info = tty->driver_data;
+ struct async_struct *info = (struct async_struct *)tty->driver_data;
unsigned long flags;
if (serial_paranoia_check(info, tty->device, "rs_write"))
static int rs_write_room(struct tty_struct *tty)
{
- struct async_struct *info = tty->driver_data;
+ struct async_struct *info = (struct async_struct *)tty->driver_data;
int ret;
if (serial_paranoia_check(info, tty->device, "rs_write_room"))
static int rs_chars_in_buffer(struct tty_struct *tty)
{
- struct async_struct *info = tty->driver_data;
+ struct async_struct *info = (struct async_struct *)tty->driver_data;
if (serial_paranoia_check(info, tty->device, "rs_chars_in_buffer"))
return 0;
static void rs_flush_buffer(struct tty_struct *tty)
{
- struct async_struct *info = tty->driver_data;
+ struct async_struct *info = (struct async_struct *)tty->driver_data;
if (serial_paranoia_check(info, tty->device, "rs_flush_buffer"))
return;
*/
static void rs_throttle(struct tty_struct * tty)
{
- struct async_struct *info = tty->driver_data;
+ struct async_struct *info = (struct async_struct *)tty->driver_data;
#ifdef SERIAL_DEBUG_THROTTLE
char buf[64];
static void rs_unthrottle(struct tty_struct * tty)
{
- struct async_struct *info = tty->driver_data;
+ struct async_struct *info = (struct async_struct *)tty->driver_data;
#ifdef SERIAL_DEBUG_THROTTLE
char buf[64];
unsigned int cmd, unsigned long arg)
{
int error;
- struct async_struct * info = tty->driver_data;
+ struct async_struct * info = (struct async_struct *)tty->driver_data;
int retval;
if (serial_paranoia_check(info, tty->device, "rs_ioctl"))
static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios)
{
- struct async_struct *info = tty->driver_data;
+ struct async_struct *info = (struct async_struct *)tty->driver_data;
if (tty->termios->c_cflag == old_termios->c_cflag)
return;
*/
static void rs_close(struct tty_struct *tty, struct file * filp)
{
- struct async_struct * info = tty->driver_data;
+ struct async_struct * info = (struct async_struct *)tty->driver_data;
if (!info || serial_paranoia_check(info, tty->device, "rs_close"))
return;
*/
void rs_hangup(struct tty_struct *tty)
{
- struct async_struct * info = tty->driver_data;
+ struct async_struct * info = (struct async_struct *)tty->driver_data;
if (serial_paranoia_check(info, tty->device, "rs_hangup"))
return;
*/
/* get IRQ */
- if (request_irq(QIC02_TAPE_IRQ, qic02_tape_interrupt, SA_INTERRUP, "QIC-02")) {
+ if (request_irq(QIC02_TAPE_IRQ, qic02_tape_interrupt, SA_INTERRUPT, "QIC-02")) {
printk(TPQIC02_NAME ": can't allocate IRQ%d for QIC-02 tape\n",
QIC02_TAPE_IRQ);
status_zombie = YES;
int i;
struct tty_struct * tty;
- tty = file->private_data;
+ tty = (struct tty_struct *)file->private_data;
if (tty_paranoia_check(tty, inode->i_rdev, "tty_read"))
return -EIO;
if (!tty || (tty->flags & (1 << TTY_IO_ERROR)))
if (is_console && redirect)
tty = redirect;
else
- tty = file->private_data;
+ tty = (struct tty_struct *)file->private_data;
if (tty_paranoia_check(tty, inode->i_rdev, "tty_write"))
return -EIO;
if (!tty || !tty->driver.write || (tty->flags & (1 << TTY_IO_ERROR)))
int idx;
- tty = filp->private_data;
+ tty = (struct tty_struct *)filp->private_data;
if (tty_paranoia_check(tty, filp->f_inode->i_rdev, "release_dev"))
return;
{
struct tty_struct * tty;
- tty = filp->private_data;
+ tty = (struct tty_struct *)filp->private_data;
if (tty_paranoia_check(tty, inode->i_rdev, "tty_select"))
return 0;
struct tty_struct * tty;
struct fasync_struct *fa, *prev;
- tty = filp->private_data;
+ tty = (struct tty_struct *)filp->private_data;
if (tty_paranoia_check(tty, inode->i_rdev, "tty_fasync"))
return 0;
if (on) {
if (fa)
return 0;
- fa = kmalloc(sizeof(struct fasync_struct), GFP_KERNEL);
+ fa = (struct fasync_struct *)kmalloc(sizeof(struct fasync_struct), GFP_KERNEL);
if (!fa)
return -ENOMEM;
fa->magic = FASYNC_MAGIC;
unsigned char ch;
char mbz = 0;
- tty = file->private_data;
+ tty = (struct tty_struct *)file->private_data;
if (tty_paranoia_check(tty, inode->i_rdev, "tty_ioctl"))
return -EINVAL;
* This routine is called out of the software interrupt to flush data
* from the flip buffer to the line discipline.
*/
-static void flush_to_ldisc(void *private)
+static void flush_to_ldisc(void *private_)
{
- struct tty_struct *tty = private;
+ struct tty_struct *tty = (struct tty_struct *) private_;
unsigned char *cp;
char *fp;
int count;
int console, i;
unsigned char ucval;
struct kbd_struct * kbd;
- struct vt_struct *vt = tty->driver_data;
+ struct vt_struct *vt = (struct vt_struct *)tty->driver_data;
console = vt->vc_num;
the board has died and kick it. */
if (dev->tbusy) { /* Do timeouts, just like the 8003 driver. */
- int txsr = inb(e8390_base+EN0_TSR), isr, cmd;
+ int txsr = inb(e8390_base+EN0_TSR), isr;
int tickssofar = jiffies - dev->trans_start;
if (tickssofar < 10 || (tickssofar < 15 && ! (txsr & ENTSR_PTX))) {
return 1;
}
isr = inb(e8390_base+EN0_ISR);
- cmd = inb(e8390_base+E8390_CMD) & (E8390_STOP|E8390_START);
- if ((cmd == 0) || (cmd == (E8390_STOP|E8390_START)))
- return 1;
printk(KERN_DEBUG "%s: transmit timed out, TX status %#2x, ISR %#2x.\n",
dev->name, txsr, isr);
/* Does the 8390 thinks it has posted an interrupt? */
int irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2);
struct device *dev = (struct device *)(irq2dev_map[irq]);
int e8390_base;
- int interrupts, cmd, boguscount = 0;
+ int interrupts, boguscount = 0;
struct ei_device *ei_local;
if (dev == NULL) {
/* !!Assumption!! -- we stay in page 0. Don't break this. */
while ((interrupts = inb_p(e8390_base + EN0_ISR)) != 0
&& ++boguscount < 9) {
- cmd = inb(e8390_base+E8390_CMD) & (E8390_STOP|E8390_START);
- if ((cmd == 0) || (cmd == (E8390_STOP|E8390_START))) {
- printk("%s: card not present\n", dev->name);
- interrupts = 0;
- break;
- }
if (interrupts & ENISR_RDC) {
/* Ack meaningless DMA complete. */
outb_p(ENISR_RDC, e8390_base + EN0_ISR);
dev->priv = kmalloc(sizeof (struct net_local), GFP_KERNEL);
memset(dev->priv, 0, sizeof(struct net_local));
- pl=dev->priv;
+ pl = (struct net_local *) dev->priv;
pl->trigger_us = PLIP_TRIGGER_WAIT;
pl->nibble_us = PLIP_NIBBLE_WAIT;
plip_interrupt(int reg_ptr)
{
int irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2);
- struct device *dev = irq2dev_map[irq];
+ struct device *dev = (struct device *) irq2dev_map[irq];
struct net_local *lp = (struct net_local *)dev->priv;
struct plip_local *rcv = &lp->rcv_data;
struct plip_local *snd = &lp->snd_data;
}
/* Allocate a user-level receive buffer */
- ppp->us_rbuff = kmalloc (RBUFSIZE, GFP_KERNEL);
+ ppp->us_rbuff = (unsigned char *) kmalloc (RBUFSIZE, GFP_KERNEL);
if (ppp->us_rbuff == NULL) {
PRINTKN (1,(KERN_ERR "ppp: no space for user receive buffer\n"));
ppp_release (ppp);
set_fs (seg);
- if (name != (char *) NULL)
+ if (name != NULL)
PRINTK ((KERN_DEBUG "ppp: %s, count = %d\n", name, count));
while (count > 8) {
/* Allow stty to read, but not set, the serial port */
case TCGETS:
case TCGETA:
- return n_tty_ioctl(tty, file, cmd, (unsigned long) arg);
+ return n_tty_ioctl(tty, (struct file *) file, cmd, (unsigned long) arg);
default:
return -ENOIOCTLCMD;
struct Scsi_Host * scsi_register(Scsi_Host_Template * tpnt, int j){
struct Scsi_Host * retval, *shpnt;
- retval = scsi_init_malloc(sizeof(struct Scsi_Host) + j);
+ retval = (struct Scsi_Host *)scsi_init_malloc(sizeof(struct Scsi_Host) + j);
retval->host_busy = 0;
if(j > 0xffff) panic("Too many extra bytes requested\n");
retval->extra_bytes = j;
cylinders = capacity / temp;/* Compute number of cylinders */
}
}
- if (cylinders == 0) rv=-1; /* Give error if 0 cylinders */
+ if (cylinders == 0) rv=(unsigned)-1;/* Give error if 0 cylinders */
*cyls = (unsigned int) cylinders; /* Stuff return values */
*secs = (unsigned int) sectors;
{
int retcode;
- retcode = request_irq(interrupt_level, &hndlr,
+ retcode = request_irq(interrupt_level, hndlr,
#ifdef SND_SA_INTERRUPT
SA_INTERRUPT,
#else
struct wait_queue * wait;
wait = ((volatile struct buffer_head *) bh)->b_wait;
- memset((void *) bh,0,sizeof(*bh));
+ memset(bh,0,sizeof(*bh));
((volatile struct buffer_head *) bh)->b_wait = wait;
bh->b_next_free = unused_list;
unused_list = bh;
}
i = bprm.inode->i_mode;
if (IS_NOSUID(bprm.inode) && (((i & S_ISUID) && bprm.inode->i_uid != current->
- euid) || ((i & S_ISGID) && !in_group_p(bprm.inode->i_gid))) &&
- !suser()) {
+ euid) || ((i & S_ISGID) && !in_group_p(bprm.inode->i_gid))) && !suser()) {
retval = -EPERM;
goto exec_error2;
}
(current->mm->start_code = N_TXTADDR(ex)))));
current->mm->rss = 0;
current->mm->mmap = NULL;
- current->suid = current->euid = bprm->e_uid;
- current->sgid = current->egid = bprm->e_gid;
+ current->suid = current->euid = current->fsuid = bprm->e_uid;
+ current->sgid = current->egid = current->fsgid = bprm->e_gid;
if (N_MAGIC(ex) == OMAGIC) {
do_mmap(NULL, 0, ex.a_text+ex.a_data,
PROT_READ|PROT_WRITE|PROT_EXEC,
inode->i_count = 1;
inode->i_nlink = 1;
inode->i_dev = sb->s_dev;
- inode->i_uid = current->euid;
- inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->egid;
+ inode->i_uid = current->fsuid;
+ inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
inode->i_dirt = 1;
inode->i_ino = j;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
iput(dir);
return -ENOSPC;
}
- inode->i_uid = current->euid;
+ inode->i_uid = current->fsuid;
inode->i_mode = mode;
inode->i_op = NULL;
if (S_ISREG(inode->i_mode))
retval = -EPERM;
if (!(inode = iget(dir->i_sb, de->inode)))
goto end_rmdir;
- if ((dir->i_mode & S_ISVTX) && !suser() &&
- current->euid != inode->i_uid &&
- current->euid != dir->i_uid)
+ if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+ current->fsuid != inode->i_uid &&
+ current->fsuid != dir->i_uid)
goto end_rmdir;
if (inode->i_dev != dir->i_dev)
goto end_rmdir;
if (!(inode = iget(dir->i_sb, de->inode)))
goto end_unlink;
retval = -EPERM;
- if ((dir->i_mode & S_ISVTX) && !suser() &&
- current->euid != inode->i_uid &&
- current->euid != dir->i_uid)
+ if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+ current->fsuid != inode->i_uid &&
+ current->fsuid != dir->i_uid)
goto end_unlink;
if (S_ISDIR(inode->i_mode))
goto end_unlink;
goto end_rename;
retval = -EPERM;
if ((old_dir->i_mode & S_ISVTX) &&
- current->euid != old_inode->i_uid &&
- current->euid != old_dir->i_uid && !suser())
+ current->fsuid != old_inode->i_uid &&
+ current->fsuid != old_dir->i_uid && !fsuser())
goto end_rename;
new_bh = ext_find_entry(new_dir,new_name,new_len,&new_de,NULL,NULL);
if (new_bh) {
}
retval = -EPERM;
if (new_inode && (new_dir->i_mode & S_ISVTX) &&
- current->euid != new_inode->i_uid &&
- current->euid != new_dir->i_uid && !suser())
+ current->fsuid != new_inode->i_uid &&
+ current->fsuid != new_dir->i_uid && !fsuser())
goto end_rename;
if (S_ISDIR(old_inode->i_mode)) {
retval = -EEXIST;
/*
* Special case, access is always granted for root
*/
- if (suser ())
+ if (fsuser())
return 1;
/*
* If no ACL, checks using the file mode
*/
- else if (current->euid == inode->i_uid)
+ else if (current->fsuid == inode->i_uid)
mode >>= 6;
else if (in_group_p (inode->i_gid))
mode >>= 3;
}
lock_super (sb);
es = sb->u.ext2_sb.s_es;
- if (es->s_free_blocks_count <= es->s_r_blocks_count && !suser()) {
+ if (es->s_free_blocks_count <= es->s_r_blocks_count && !fsuser()) {
unlock_super (sb);
return 0;
}
inode->i_count = 1;
inode->i_nlink = 1;
inode->i_dev = sb->s_dev;
- inode->i_uid = current->euid;
+ inode->i_uid = current->fsuid;
if (test_opt (sb, GRPID))
inode->i_gid = dir->i_gid;
else if (dir->i_mode & S_ISGID) {
if (S_ISDIR(mode))
mode |= S_ISGID;
} else
- inode->i_gid = current->egid;
+ inode->i_gid = current->fsgid;
inode->i_dirt = 1;
inode->i_ino = j;
inode->i_blksize = sb->s_blocksize;
put_fs_long (inode->u.ext2_i.i_flags, (long *) arg);
return 0;
case EXT2_IOC_SETFLAGS:
- if ((current->euid != inode->i_uid) && !suser())
+ if ((current->fsuid != inode->i_uid) && !fsuser())
return -EPERM;
if (IS_RDONLY(inode))
return -EROFS;
put_fs_long (inode->u.ext2_i.i_version, (long *) arg);
return 0;
case EXT2_IOC_SETVERSION:
- if ((current->euid != inode->i_uid) && !suser())
+ if ((current->fsuid != inode->i_uid) && !fsuser())
return -EPERM;
if (IS_RDONLY(inode))
return -EROFS;
iput (dir);
return -ENOSPC;
}
- inode->i_uid = current->euid;
+ inode->i_uid = current->fsuid;
inode->i_mode = mode;
inode->i_op = NULL;
if (S_ISREG(inode->i_mode))
schedule();
goto repeat;
}
- if ((dir->i_mode & S_ISVTX) && !suser() &&
- current->euid != inode->i_uid &&
- current->euid != dir->i_uid)
+ if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+ current->fsuid != inode->i_uid &&
+ current->fsuid != dir->i_uid)
goto end_rmdir;
if (inode == dir) /* we may not delete ".", but "../dir" is ok */
goto end_rmdir;
schedule();
goto repeat;
}
- if ((dir->i_mode & S_ISVTX) && !suser() &&
- current->euid != inode->i_uid &&
- current->euid != dir->i_uid)
+ if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+ current->fsuid != inode->i_uid &&
+ current->fsuid != dir->i_uid)
goto end_unlink;
if (!inode->i_nlink) {
ext2_warning (inode->i_sb, "ext2_unlink",
goto end_rename;
retval = -EPERM;
if ((old_dir->i_mode & S_ISVTX) &&
- current->euid != old_inode->i_uid &&
- current->euid != old_dir->i_uid && !suser())
+ current->fsuid != old_inode->i_uid &&
+ current->fsuid != old_dir->i_uid && !fsuser())
goto end_rename;
new_bh = ext2_find_entry (new_dir, new_name, new_len, &new_de);
if (new_bh) {
}
retval = -EPERM;
if (new_inode && (new_dir->i_mode & S_ISVTX) &&
- current->euid != new_inode->i_uid &&
- current->euid != new_dir->i_uid && !suser())
+ current->fsuid != new_inode->i_uid &&
+ current->fsuid != new_dir->i_uid && !fsuser())
goto end_rename;
if (S_ISDIR(old_inode->i_mode)) {
retval = -ENOTDIR;
PIPE_LOCK(*inode) = 0;
inode->i_pipe = 1;
inode->i_mode |= S_IFIFO | S_IRUSR | S_IWUSR;
- inode->i_uid = current->euid;
- inode->i_gid = current->egid;
+ inode->i_uid = current->fsuid;
+ inode->i_gid = current->fsgid;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
return inode;
}
inode->i_count = 1;
inode->i_nlink = 1;
inode->i_dev = sb->s_dev;
- inode->i_uid = current->euid;
- inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->egid;
+ inode->i_uid = current->fsuid;
+ inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
inode->i_dirt = 1;
inode->i_ino = j;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
iput(dir);
return -ENOSPC;
}
- inode->i_uid = current->euid;
+ inode->i_uid = current->fsuid;
inode->i_mode = mode;
inode->i_op = NULL;
if (S_ISREG(inode->i_mode))
retval = -EPERM;
if (!(inode = iget(dir->i_sb, de->inode)))
goto end_rmdir;
- if ((dir->i_mode & S_ISVTX) && !suser() &&
- current->euid != inode->i_uid &&
- current->euid != dir->i_uid)
+ if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+ current->fsuid != inode->i_uid &&
+ current->fsuid != dir->i_uid)
goto end_rmdir;
if (inode->i_dev != dir->i_dev)
goto end_rmdir;
schedule();
goto repeat;
}
- if ((dir->i_mode & S_ISVTX) && !suser() &&
- current->euid != inode->i_uid &&
- current->euid != dir->i_uid)
+ if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+ current->fsuid != inode->i_uid &&
+ current->fsuid != dir->i_uid)
goto end_unlink;
if (de->inode != inode->i_ino) {
retval = -ENOENT;
goto end_rename;
retval = -EPERM;
if ((old_dir->i_mode & S_ISVTX) &&
- current->euid != old_inode->i_uid &&
- current->euid != old_dir->i_uid && !suser())
+ current->fsuid != old_inode->i_uid &&
+ current->fsuid != old_dir->i_uid && !fsuser())
goto end_rename;
new_bh = minix_find_entry(new_dir,new_name,new_len,&new_de);
if (new_bh) {
}
retval = -EPERM;
if (new_inode && (new_dir->i_mode & S_ISVTX) &&
- current->euid != new_inode->i_uid &&
- current->euid != new_dir->i_uid && !suser())
+ current->fsuid != new_inode->i_uid &&
+ current->fsuid != new_dir->i_uid && !fsuser())
goto end_rename;
if (S_ISDIR(old_inode->i_mode)) {
retval = -ENOTDIR;
* permission()
*
* is used to check for read/write/execute permissions on a file.
- * I don't know if we should look at just the euid or both euid and
- * uid, but that should be easily changed.
+ * We use "fsuid" for this, letting us set arbitrary permissions
+ * permissions for filesystem access without changing the "normal"
+ * uids which are used for other things..
*/
int permission(struct inode * inode,int mask)
{
if (inode->i_op && inode->i_op->permission)
return inode->i_op->permission(inode, mask);
- else if (current->euid == inode->i_uid)
+ else if (current->fsuid == inode->i_uid)
mode >>= 6;
else if (in_group_p(inode->i_gid))
mode >>= 3;
- if (((mode & mask & 0007) == mask) || suser())
+ if (((mode & mask & 0007) == mask) || fsuser())
return 1;
return 0;
}
int error;
char * tmp;
- if (S_ISDIR(mode) || (!S_ISFIFO(mode) && !suser()))
+ if (S_ISDIR(mode) || (!S_ISFIFO(mode) && !fsuser()))
return -EPERM;
switch (mode & S_IFMT) {
case 0:
PRINTK("NFS reply getattr\n");
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
PRINTK("NFS reply setattr\n");
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
PRINTK("NFS reply lookup\n");
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
PRINTK("NFS reply readlink %s\n", res);
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
PRINTK("NFS reply read %d\n", len);
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
PRINTK("NFS reply write\n");
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
PRINTK("NFS reply create\n");
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
PRINTK("NFS reply remove\n");
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
PRINTK("NFS reply rename\n");
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
PRINTK("NFS reply link\n");
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
PRINTK("NFS reply symlink\n");
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
PRINTK("NFS reply mkdir\n");
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
PRINTK("NFS reply rmdir\n");
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
}
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
PRINTK("NFS reply statfs\n");
}
else {
- if (!ruid && current->euid == 0 && current->uid != 0) {
+ if (!ruid && current->fsuid == 0 && current->uid != 0) {
ruid = 1;
goto retry;
}
p1 = p++;
*p++ = htonl(CURRENT_TIME); /* traditional, could be anything */
p = xdr_encode_string(p, (char *) sys);
- *p++ = htonl(ruid ? current->uid : current->euid);
+ *p++ = htonl(ruid ? current->uid : current->fsuid);
*p++ = htonl(current->egid);
p2 = p++;
for (i = 0; i < 16 && i < NGROUPS && current->groups[i] != NOGROUP; i++)
return -EROFS;
}
if (times) {
- if ((current->euid != inode->i_uid) && !suser()) {
+ if ((current->fsuid != inode->i_uid) && !fsuser()) {
iput(inode);
return -EPERM;
}
modtime = get_fs_long((unsigned long *) ×->modtime);
inode->i_ctime = CURRENT_TIME;
} else {
- if ((current->euid != inode->i_uid) &&
+ if ((current->fsuid != inode->i_uid) &&
!permission(inode,MAY_WRITE)) {
iput(inode);
return -EACCES;
}
/*
- * XXX we should use the real ids for checking _all_ components of the
- * path. Now we only use them for the final component of the path.
+ * access() needs to use the real uid/gid, not the effective uid/gid.
+ * We do this by temporarily setting fsuid/fsgid to the wanted values
*/
-asmlinkage int sys_access(const char * filename,int mode)
+asmlinkage int sys_access(const char * filename, int mode)
{
struct inode * inode;
- int res, i_mode;
+ int old_fsuid, old_fsgid;
+ int res;
if (mode != (mode & S_IRWXO)) /* where's F_OK, X_OK, W_OK, R_OK? */
return -EINVAL;
+ old_fsuid = current->fsuid;
+ old_fsgid = current->fsgid;
+ current->fsuid = current->uid;
+ current->fsgid = current->gid;
res = namei(filename,&inode);
- if (res)
- return res;
- i_mode = inode->i_mode;
- res = i_mode & S_IRWXUGO;
- if (current->uid == inode->i_uid)
- res >>= 6; /* needs cleaning? */
- else if (in_group_p(inode->i_gid))
- res >>= 3; /* needs cleaning? */
- iput(inode);
- if ((res & mode) == mode)
- return 0;
- /*
- * XXX we are doing this test last because we really should be
- * swapping the effective with the real user id (temporarily),
- * and then calling suser() routine. If we do call the
- * suser() routine, it needs to be called last.
- *
- * XXX nope. suser() is inappropriate and swapping the ids while
- * decomposing the path would be racy.
- */
- if ((!current->uid) &&
- (S_ISDIR(i_mode) || !(mode & S_IXOTH) || (i_mode & S_IXUGO)))
- return 0;
- return -EACCES;
+ if (!res) {
+ if (!permission(inode, mode))
+ res = -EACCES;
+ iput(inode);
+ }
+ current->fsuid = old_fsuid;
+ current->fsgid = old_fsgid;
+ return res;
}
asmlinkage int sys_chdir(const char * filename)
iput(inode);
return -ENOTDIR;
}
- if (!suser()) {
+ if (!fsuser()) {
iput(inode);
return -EPERM;
}
return -EBADF;
if (!(inode = file->f_inode))
return -ENOENT;
- if ((current->euid != inode->i_uid) && !suser())
+ if ((current->fsuid != inode->i_uid) && !fsuser())
return -EPERM;
if (IS_RDONLY(inode))
return -EROFS;
if (mode == (mode_t) -1)
mode = inode->i_mode;
inode->i_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
- if (!suser() && !in_group_p(inode->i_gid))
+ if (!fsuser() && !in_group_p(inode->i_gid))
inode->i_mode &= ~S_ISGID;
inode->i_ctime = CURRENT_TIME;
inode->i_dirt = 1;
error = namei(filename,&inode);
if (error)
return error;
- if ((current->euid != inode->i_uid) && !suser()) {
+ if ((current->fsuid != inode->i_uid) && !fsuser()) {
iput(inode);
return -EPERM;
}
if (mode == (mode_t) -1)
mode = inode->i_mode;
inode->i_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
- if (!suser() && !in_group_p(inode->i_gid))
+ if (!fsuser() && !in_group_p(inode->i_gid))
inode->i_mode &= ~S_ISGID;
inode->i_ctime = CURRENT_TIME;
inode->i_dirt = 1;
user = inode->i_uid;
if (group == (gid_t) -1)
group = inode->i_gid;
- if ((current->euid == inode->i_uid && user == inode->i_uid &&
+ if ((current->fsuid == inode->i_uid && user == inode->i_uid &&
(in_group_p(group) || group == inode->i_gid)) ||
- suser()) {
+ fsuser()) {
inode->i_uid = user;
inode->i_gid = group;
inode->i_ctime = CURRENT_TIME;
user = inode->i_uid;
if (group == (gid_t) -1)
group = inode->i_gid;
- if ((current->euid == inode->i_uid && user == inode->i_uid &&
+ if ((current->fsuid == inode->i_uid && user == inode->i_uid &&
(in_group_p(group) || group == inode->i_gid)) ||
- suser()) {
+ fsuser()) {
inode->i_uid = user;
inode->i_gid = group;
inode->i_ctime = CURRENT_TIME;
inode->i_count = 1;
inode->i_nlink = 1;
inode->i_dev = sb->s_dev;
- inode->i_uid = current->euid;
- inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->egid;
+ inode->i_uid = current->fsuid;
+ inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
inode->i_dirt = 1;
inode->i_ino = ino;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
iput(dir);
return -ENOSPC;
}
- inode->i_uid = current->euid;
+ inode->i_uid = current->fsuid;
inode->i_mode = mode;
inode->i_op = NULL;
if (S_ISREG(inode->i_mode))
retval = -EPERM;
if (!(inode = iget(dir->i_sb, de->inode)))
goto end_rmdir;
- if ((dir->i_mode & S_ISVTX) && !suser() &&
- current->euid != inode->i_uid &&
- current->euid != dir->i_uid)
+ if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+ current->fsuid != inode->i_uid &&
+ current->fsuid != dir->i_uid)
goto end_rmdir;
if (inode->i_dev != dir->i_dev)
goto end_rmdir;
schedule();
goto repeat;
}
- if ((dir->i_mode & S_ISVTX) && !suser() &&
- current->euid != inode->i_uid &&
- current->euid != dir->i_uid)
+ if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+ current->fsuid != inode->i_uid &&
+ current->fsuid != dir->i_uid)
goto end_unlink;
if (de->inode != inode->i_ino) {
retval = -ENOENT;
goto end_rename;
retval = -EPERM;
if ((old_dir->i_mode & S_ISVTX) &&
- current->euid != old_inode->i_uid &&
- current->euid != old_dir->i_uid && !suser())
+ current->fsuid != old_inode->i_uid &&
+ current->fsuid != old_dir->i_uid && !fsuser())
goto end_rename;
new_bh = sysv_find_entry(new_dir,new_name,new_len,&new_de);
if (new_bh) {
}
retval = -EPERM;
if (new_inode && (new_dir->i_mode & S_ISVTX) &&
- current->euid != new_inode->i_uid &&
- current->euid != new_dir->i_uid && !suser())
+ current->fsuid != new_inode->i_uid &&
+ current->fsuid != new_dir->i_uid && !fsuser())
goto end_rename;
if (S_ISDIR(old_inode->i_mode)) {
retval = -ENOTDIR;
info.entry.mode = mode;
info.entry.rdev = rdev;
info.entry.flags = flags;
- info.entry.uid = current->euid;
+ info.entry.uid = current->fsuid;
info.entry.gid = (dir->i_mode & S_ISGID)
- ? dir->i_gid : current->egid;
+ ? dir->i_gid : current->fsgid;
info.entry.ctime = info.entry.atime = info.entry.mtime
= CURRENT_TIME;
info.entry.nlink = 1;
if (ret == 0){
info.entry.mode = mode | S_IFDIR;
info.entry.rdev = 0;
- info.entry.uid = current->euid;
+ info.entry.uid = current->fsuid;
info.entry.gid = (dir->i_mode & S_ISGID)
- ? dir->i_gid : current->egid;
+ ? dir->i_gid : current->fsgid;
info.entry.ctime = info.entry.atime = info.entry.mtime
= CURRENT_TIME;
info.entry.flags = 0;
inode->i_count = 1;
inode->i_nlink = 1;
inode->i_dev = sb->s_dev;
- inode->i_uid = current->euid;
- inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->egid;
+ inode->i_uid = current->fsuid;
+ inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
inode->i_dirt = 1;
inode->i_ino = tmp;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
iput(dir);
return -ENOSPC;
}
- inode->i_uid = current->euid;
+ inode->i_uid = current->fsuid;
inode->i_mode = mode;
inode->i_op = NULL;
if (S_ISREG(inode->i_mode))
retval = -EPERM;
if (!(inode = iget(dir->i_sb, de->d_ino)))
goto end_rmdir;
- if ((dir->i_mode & S_ISVTX) && !suser() &&
- current->euid != inode->i_uid &&
- current->euid != dir->i_uid)
+ if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+ current->fsuid != inode->i_uid &&
+ current->fsuid != dir->i_uid)
goto end_rmdir;
if (inode->i_dev != dir->i_dev)
goto end_rmdir;
schedule();
goto repeat;
}
- if ((dir->i_mode & S_ISVTX) && !suser() &&
- current->euid != inode->i_uid &&
- current->euid != dir->i_uid)
+ if ((dir->i_mode & S_ISVTX) && !fsuser() &&
+ current->fsuid != inode->i_uid &&
+ current->fsuid != dir->i_uid)
goto end_unlink;
if (!inode->i_nlink) {
printk("XIA-FS: Deleting nonexistent file (%s %d)\n", WHERE_ERR);
goto end_rename;
retval = -EPERM;
if ((old_dir->i_mode & S_ISVTX) &&
- current->euid != old_inode->i_uid &&
- current->euid != old_dir->i_uid && !suser())
+ current->fsuid != old_inode->i_uid &&
+ current->fsuid != old_dir->i_uid && !fsuser())
goto end_rename;
new_bh = xiafs_find_entry(new_dir, new_name, new_len, &new_de, NULL);
if (new_bh) {
}
retval = -EPERM;
if (new_inode && (new_dir->i_mode & S_ISVTX) &&
- current->euid != new_inode->i_uid &&
- current->euid != new_dir->i_uid && !suser())
+ current->fsuid != new_inode->i_uid &&
+ current->fsuid != new_dir->i_uid && !fsuser())
goto end_rename;
if (S_ISDIR(old_inode->i_mode)) {
retval = -EEXIST;
return;
case 3:
*(short *) to = get_user_word((const short *) from);
- *(char *) to = get_user_byte(2+(const char *) from);
+ *((char *) to + 2) = get_user_byte(2+(const char *) from);
return;
case 4:
*(int *) to = get_user_long((const int *) from);
* BSD-style accounting where the process is flagged if it uses root
* privs). The implication of this is that you should do normal
* permissions checks first, and check suser() last.
+ *
+ * "suser()" checks against the effective user id, while "fsuser()"
+ * is used for file permission checking and checks against the fsuid..
*/
#define suser() (current->euid == 0)
+#define fsuser() (current->fsuid == 0)
+
extern int splx (int new_ipl);
#endif /* __KERNEL__ */
*/
struct task_struct *p_opptr, *p_pptr, *p_cptr, *p_ysptr, *p_osptr;
struct wait_queue *wait_chldexit; /* for wait4() */
- unsigned short uid,euid,suid;
- unsigned short gid,egid,sgid;
+ unsigned short uid,euid,suid,fsuid;
+ unsigned short gid,egid,sgid,fsgid;
unsigned long timeout;
unsigned long it_real_value, it_prof_value, it_virt_value;
unsigned long it_real_incr, it_prof_incr, it_virt_incr;
/* pid etc.. */ 0,0,0,0, \
/* suppl grps*/ {NOGROUP,}, \
/* proc links*/ &init_task,&init_task,NULL,NULL,NULL,NULL, \
-/* uid etc */ 0,0,0,0,0,0, \
+/* uid etc */ 0,0,0,0,0,0,0,0, \
/* timeout */ 0,0,0,0,0,0,0,0,0,0,0,0, \
/* rlimits */ { {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
{LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
volatile unsigned long when; /* used to compute rtt's */
struct timeval stamp;
struct device *dev;
- void *mem_addr;
+ struct sk_buff *mem_addr;
union {
struct tcphdr *th;
struct ethhdr *eth;
extern "C" {
#endif
+#ifdef i386
+
#include <asm/string.h> /* inline functions for i386.. */
+#else
+
extern char * strcpy(char *, const char *);
extern char * strncpy(char *, const char *, size_t);
extern char * strcat(char *, const char *);
extern void * memchr(const void *, char, size_t);
extern void * memset(void *, char, size_t);
+#endif
+
#ifdef __cplusplus
}
#endif
#define __NR_sysfs 135
#define __NR_personality 136
#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
+#define __NR_setfsuid 138
+#define __NR_setfsgid 139
extern int errno;
if (rgid != (gid_t) -1 ||
(egid != (gid_t) -1 && egid != old_rgid))
current->sgid = current->egid;
+ current->fsgid = current->egid;
return 0;
}
asmlinkage int sys_setgid(gid_t gid)
{
if (suser())
- current->gid = current->egid = current->sgid = gid;
+ current->gid = current->egid = current->sgid = current->fsgid = gid;
else if ((gid == current->gid) || (gid == current->sgid))
- current->egid = gid;
+ current->egid = current->fsgid = gid;
else
return -EPERM;
return 0;
if (ruid != (uid_t) -1 ||
(euid != (uid_t) -1 && euid != old_ruid))
current->suid = current->euid;
+ current->fsuid = euid;
return 0;
}
asmlinkage int sys_setuid(uid_t uid)
{
if (suser())
- current->uid = current->euid = current->suid = uid;
+ current->uid = current->euid = current->suid = current->fsuid = uid;
else if ((uid == current->uid) || (uid == current->suid))
- current->euid = uid;
+ current->fsuid = current->euid = uid;
else
return -EPERM;
return(0);
}
+/*
+ * "setfsuid()" sets the fsuid - the uid used for filesystem checks. This
+ * is used for "access()" and for the NFS deamon (letting nfsd stay at
+ * whatever uid it wants to). It normally shadows "euid", except when
+ * explicitly set by setfsuid() or for access..
+ */
+asmlinkage int sys_setfsuid(uid_t uid)
+{
+ int old_fsuid = current->fsuid;
+
+ if (uid == current->uid || uid == current->euid ||
+ uid == current->suid || uid == current->fsuid || suser())
+ current->fsuid = uid;
+ return old_fsuid;
+}
+
+/*
+ * Samma på svenska..
+ */
+asmlinkage int sys_setfsgid(gid_t gid)
+{
+ int old_fsgid = current->fsgid;
+
+ if (gid == current->gid || gid == current->egid ||
+ gid == current->sgid || gid == current->fsgid || suser())
+ current->fsgid = gid;
+ return old_fsgid;
+}
+
asmlinkage int sys_times(struct tms * tbuf)
{
if (tbuf) {
{
int i;
- if (grp == current->egid)
+ if (grp == current->fsgid)
return 1;
for (i = 0; i < NGROUPS; i++) {
.long _sys_sysfs /* 135 */
.long _sys_personality
.long 0 /* for afs_syscall */
+ .long _sys_setfsuid
+ .long _sys_setfsgid
.space (NR_syscalls-137)*4
else
mask |= PAGE_SHARED;
- vma = kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL);
+ vma = (struct vm_area_struct *)kmalloc(sizeof(struct vm_area_struct),
+ GFP_KERNEL);
if (!vma)
return -ENOMEM;
unsigned long end,
int newflags, int prot)
{
- struct vm_area_struct * new;
+ struct vm_area_struct * n;
- new = kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL);
- if (!new)
+ n = (struct vm_area_struct *) kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL);
+ if (!n)
return -ENOMEM;
- *new = *vma;
+ *n = *vma;
vma->vm_start = end;
- new->vm_end = end;
- vma->vm_offset += vma->vm_start - new->vm_start;
- new->vm_flags = newflags;
- new->vm_page_prot = prot;
- if (new->vm_inode)
- new->vm_inode->i_count++;
- insert_vm_struct(current, new);
+ n->vm_end = end;
+ vma->vm_offset += vma->vm_start - n->vm_start;
+ n->vm_flags = newflags;
+ n->vm_page_prot = prot;
+ if (n->vm_inode)
+ n->vm_inode->i_count++;
+ insert_vm_struct(current, n);
merge_segments(current->mm->mmap);
return 0;
}
unsigned long start,
int newflags, int prot)
{
- struct vm_area_struct * new;
+ struct vm_area_struct * n;
- new = kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL);
- if (!new)
+ n = (struct vm_area_struct *) kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL);
+ if (!n)
return -ENOMEM;
- *new = *vma;
+ *n = *vma;
vma->vm_end = start;
- new->vm_start = start;
- new->vm_offset += new->vm_start - vma->vm_start;
- new->vm_flags = newflags;
- new->vm_page_prot = prot;
- if (new->vm_inode)
- new->vm_inode->i_count++;
- insert_vm_struct(current, new);
+ n->vm_start = start;
+ n->vm_offset += n->vm_start - vma->vm_start;
+ n->vm_flags = newflags;
+ n->vm_page_prot = prot;
+ if (n->vm_inode)
+ n->vm_inode->i_count++;
+ insert_vm_struct(current, n);
merge_segments(current->mm->mmap);
return 0;
}
unsigned short eth_type_trans(struct sk_buff *skb, struct device *dev)
{
struct ethhdr *eth = (struct ethhdr *) skb->data;
- char *rawp;
+ unsigned char *rawp;
if(*eth->h_dest&1)
{