vold_proc.c revision 18c2aff776a775d34a4c9893a4c72e0434d68e36
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <string.h>
#include <rpc/auth_unix.h>
#include <rpcsvc/nfs_prot.h>
#include "vold.h"
/*
* These are the possible accesses that may be requested to an
* object -- note that they map to the st_mode bits -- this is not
* accidental.
*/
#define PERM_WRITE S_IWUSR
#define PERM_STICKY S_ISVTX
/* extern routines */
/* local routines */
struct authsys_parms *, uint_t);
/*
* add up sizeof (valid + fileid + name + cookie) - strlen(name)
*/
/*
* sizeof (status + eof)
*/
/*ARGSUSED*/
attrstat *
{
return (&astat);
}
return (&astat);
}
attrstat *
{
struct authsys_parms *aup;
return (&astat);
}
/*LINTED: alignment ok*/
return (&astat);
}
}
}
}
}
}
}
return (&astat);
}
/*ARGSUSED*/
void *
{
return (NULL);
}
diropres *
{
return (&res);
}
return (&res);
}
/*LINTED: alignment ok*/
return (&res);
}
return (&res);
}
return (&res);
}
/*ARGSUSED*/
{
static readlinkres res;
return (&res);
}
return (&res);
}
/*ARGSUSED*/
readres *
{
return (&res);
}
/*ARGSUSED*/
void *
{
return (NULL);
}
/*ARGSUSED*/
attrstat *
{
return (&res);
}
/*ARGSUSED*/
diropres *
{
return (&res);
}
return (&res);
}
/*
* For our file system, create is just a lookup. That's
* why we just check for read access.
*/
/*LINTED: alignment ok*/
return (&res);
}
return (&res);
}
/*
* the file exists -- check to see if we have write permission
* if not, return EACCES
* this is done in accord with the man page of creat(2)
* (without this check anyone can open with O_CREAT a volume
* that belongs to someone else)
*/
/*LINTED: alignment ok*/
return (&res);
}
return (&res);
}
/*ARGSUSED*/
nfsstat *
{
return (&status);
}
return (&status);
}
/* need write permission into the directory we are moving to */
/*LINTED: alignment ok*/
return (&status);
}
return (&status);
}
/* need write permission in the directory we are moving from */
/*LINTED: alignment ok*/
return (&status);
}
/*
* Tried to move something out of a "twinned" directory.
* We don't allow this.
*/
return (&status);
}
/*
* Tried to rename a partition. Sorry, not supported yet.
*/
return (&status);
}
return (&status);
}
return (&status);
}
/*ARGSUSED*/
nfsstat *
{
struct authsys_parms *aup;
/*LINTED: alignment ok*/
return (&status);
}
return (&status);
}
return (&status);
}
/*
* The names here are a bit confusing... we're creating
* a new name (args->to.name) in dvn that points at "fvn".
*/
return (&status);
}
return (&status);
}
/*ARGSUSED*/
nfsstat *
{
struct authunix_parms *cred;
return (&status);
}
/*LINTED: alignment ok*/
return (&status);
}
/*
* We do this because NFS doesn't seem to pass in the
* uid or gid as part of the attributes.
*/
/*LINTED: alignment ok*/
} else {
}
return (&status);
}
/*ARGSUSED*/
diropres *
{
struct authunix_parms *cred;
return (&res);
}
/*LINTED: alignment ok*/
return (&res);
}
/*LINTED: alignment ok*/
} else {
}
} else {
}
} else {
}
} else {
}
} else {
}
if (err) {
#ifdef notdef
/* XXXXX: there's in mkobj where we can't do this yet */
#endif
/* only possibility here is that it is already there */
return (&res);
}
return (&res);
}
/*ARGSUSED*/
nfsstat *
{
return (&status);
}
return (&status);
}
return (&status);
}
return (&status);
}
return (&status);
}
/*LINTED: alignment ok*/
return (&status);
}
if (err) {
return (&status);
}
return (&status);
}
/*ARGSUSED*/
nfsstat *
{
return (&status);
}
return (&status);
}
return (&status);
}
return (&status);
}
/*LINTED: alignment ok*/
return (&status);
}
if (err) {
return (&status);
}
return (&status);
}
{
static readdirres res;
int count;
int entrycount;
/*LINTED: alignment ok*/
/*
* Free up old stuff
*/
while (e != NULL) {
free((char *)e);
e = nexte;
}
return (&res);
}
return (&res);
}
/*LINTED: alignment ok*/
return (&res);
}
entrycount = 2;
if (cookie == 0) {
/*LINTED: alignment ok*/
/*LINTED: alignment ok*/
}
break; /* we are full */
}
if (entrycount++ < cookie) {
continue;
}
/*LINTED: alignment ok*/
}
} else {
}
return (&res);
}
/*ARGSUSED*/
{
return (&res);
}
static bool_t
{
/* root can do anything */
return (TRUE);
}
/*
* This checks for "sticky" directories.
* The semantic being implemented is that users are allowed
* to create and remove their own things, but they can't
* remove things owned by other people. PERM_STICKY is only
* specified by the "remove" and "move" functions.
*/
if ((acc & PERM_STICKY) &&
return (FALSE);
}
}
/*
* This algorighm is taken from UFS. It assumes that
* the permissions for user are broadest, then group,
* then other. In other words, if you are the owner
* of the file and it doesn't have read permission for
* owner, but does for group, you're out of luck. I
* only do it this way, because UFS does...
*/
acc &= ~PERM_STICKY;
acc >>= 3;
acc >>= 3;
}
}
return (TRUE);
}
return (FALSE);
}
static bool_t
{
int i;
return (TRUE);
return (FALSE);
}