110d63b7Richard Lowe/*
210d63b7Richard Lowe * CDDL HEADER START
310d63b7Richard Lowe *
410d63b7Richard Lowe * The contents of this file are subject to the terms of the
510d63b7Richard Lowe * Common Development and Distribution License (the "License").
610d63b7Richard Lowe * You may not use this file except in compliance with the License.
710d63b7Richard Lowe *
810d63b7Richard Lowe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
910d63b7Richard Lowe * or http://www.opensolaris.org/os/licensing.
1010d63b7Richard Lowe * See the License for the specific language governing permissions
1110d63b7Richard Lowe * and limitations under the License.
1210d63b7Richard Lowe *
1310d63b7Richard Lowe * When distributing Covered Code, include this CDDL HEADER in each
1410d63b7Richard Lowe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1510d63b7Richard Lowe * If applicable, add the following below this CDDL HEADER, with the
1610d63b7Richard Lowe * fields enclosed by brackets "[]" replaced with your own identifying
1710d63b7Richard Lowe * information: Portions Copyright [yyyy] [name of copyright owner]
1810d63b7Richard Lowe *
1910d63b7Richard Lowe * CDDL HEADER END
2010d63b7Richard Lowe */
2110d63b7Richard Lowe/*
2210d63b7Richard Lowe * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
2310d63b7Richard Lowe * Use is subject to license terms.
2410d63b7Richard Lowe */
2510d63b7Richard Lowe
2610d63b7Richard Lowe
2710d63b7Richard Lowe#include <unistd.h>
2810d63b7Richard Lowe#include <sys/types.h>
2910d63b7Richard Lowe
3010d63b7Richard Loweextern int chown(const char *path, uid_t owner, gid_t group);
3110d63b7Richard Lowe
3210d63b7Richard Lowe#include <vroot/vroot.h>
3310d63b7Richard Lowe#include <vroot/args.h>
3410d63b7Richard Lowe
3510d63b7Richard Lowestatic int	chown_thunk(char *path)
3610d63b7Richard Lowe{
3710d63b7Richard Lowe	vroot_result= chown(path, vroot_args.chown.user, vroot_args.chown.group);
3810d63b7Richard Lowe	return(vroot_result == 0);
3910d63b7Richard Lowe}
4010d63b7Richard Lowe
4110d63b7Richard Loweint	chown_vroot(char *path, int user, int group, pathpt vroot_path, pathpt vroot_vroot)
4210d63b7Richard Lowe{
4310d63b7Richard Lowe	vroot_args.chown.user= user;
4410d63b7Richard Lowe	vroot_args.chown.group= group;
4510d63b7Richard Lowe	translate_with_thunk(path, chown_thunk, vroot_path, vroot_vroot, rw_read);
4610d63b7Richard Lowe	return(vroot_result);
4710d63b7Richard Lowe}