1*47ec9542SBill Sommerfeld#!/bin/ksh 2*47ec9542SBill Sommerfeld# 3*47ec9542SBill Sommerfeld# This file and its contents are supplied under the terms of the 4*47ec9542SBill Sommerfeld# Common Development and Distribution License ("CDDL"), version 1.0. 5*47ec9542SBill Sommerfeld# You may only use this file in accordance with the terms of version 6*47ec9542SBill Sommerfeld# 1.0 of the CDDL. 7*47ec9542SBill Sommerfeld# 8*47ec9542SBill Sommerfeld# A full copy of the text of the CDDL should have accompanied this 9*47ec9542SBill Sommerfeld# source. A copy of the CDDL is also available via the Internet at 10*47ec9542SBill Sommerfeld# http://www.illumos.org/license/CDDL. 11*47ec9542SBill Sommerfeld# 12*47ec9542SBill Sommerfeld# Copyright 2024 Bill Sommerfeld <sommerfeld@hamachi.org> 13*47ec9542SBill Sommerfeld# 14*47ec9542SBill Sommerfeld 15*47ec9542SBill Sommerfeld# 16*47ec9542SBill Sommerfeld# Tests for find(1) that exercise file ownership tests and thus need 17*47ec9542SBill Sommerfeld# to run as root to set up the test 18*47ec9542SBill Sommerfeld# 19*47ec9542SBill Sommerfeld 20*47ec9542SBill Sommerfeld# Regression test for SID operations 21*47ec9542SBill Sommerfeld 22*47ec9542SBill Sommerfeld. "$(dirname $0)/find.kshlib" 23*47ec9542SBill Sommerfeld 24*47ec9542SBill Sommerfeldif [ $(svcs -H -o state svc:/system/idmap) != "online" ]; then 25*47ec9542SBill Sommerfeld echo "svc:/system/idmap not enabled and online; can't do SID-to-UID mapping" >&2 26*47ec9542SBill Sommerfeld exit 4 27*47ec9542SBill Sommerfeldfi 28*47ec9542SBill Sommerfeld 29*47ec9542SBill Sommerfeldsida=S-1-5-21-11111111-22222222-33333333 30*47ec9542SBill Sommerfeldsidb=S-1-5-21-44444444-55555555-66666666 31*47ec9542SBill Sommerfeld 32*47ec9542SBill Sommerfeldmkdir -p $find_dir/a 33*47ec9542SBill Sommerfeldmkdir -p $find_dir/b 34*47ec9542SBill Sommerfeld 35*47ec9542SBill Sommerfeld# Functional test for -usid and -gsid 36*47ec9542SBill Sommerfeld 37*47ec9542SBill Sommerfeldchown -s $sida $find_dir/a 38*47ec9542SBill Sommerfeldchgrp -s $sidb $find_dir/b 39*47ec9542SBill Sommerfeld 40*47ec9542SBill Sommerfeldcd $find_dir 41*47ec9542SBill Sommerfeld 42*47ec9542SBill Sommerfeldtestfind "./a", $find_prog . -usid ${sida} 43*47ec9542SBill Sommerfeldtestfind "./b", $find_prog . -gsid ${sidb} 44*47ec9542SBill Sommerfeld 45*47ec9542SBill Sommerfeld# Functional test for -usidacl and -gsidacl 46*47ec9542SBill Sommerfeld 47*47ec9542SBill Sommerfeldchmod A+groupsid:${sidb}:read_set:allow $find_dir/a 48*47ec9542SBill Sommerfeldchmod A+usersid:${sida}:read_set:allow $find_dir/b 49*47ec9542SBill Sommerfeld 50*47ec9542SBill Sommerfeldtestfind "./a", $find_prog . -gsidacl ${sidb} 51*47ec9542SBill Sommerfeldtestfind "./b", $find_prog . -usidacl ${sida} 52*47ec9542SBill Sommerfeld 53*47ec9542SBill Sommerfeld# Functional test for -sidacl 54*47ec9542SBill Sommerfeld 55*47ec9542SBill Sommerfeldmkdir $find_dir/c 56*47ec9542SBill Sommerfeldmkdir $find_dir/d 57*47ec9542SBill Sommerfeld 58*47ec9542SBill Sommerfeldchmod A+groupsid:${sida}:read_set:allow $find_dir/c 59*47ec9542SBill Sommerfeldchmod A+usersid:${sidb}:read_set:allow $find_dir/d 60*47ec9542SBill Sommerfeld 61*47ec9542SBill Sommerfeldtestfind "./b,./c," $find_prog . -sidacl ${sida} 62*47ec9542SBill Sommerfeldtestfind "./a,./d," $find_prog . -sidacl ${sidb} 63*47ec9542SBill Sommerfeld 64*47ec9542SBill Sommerfeldcd - 65*47ec9542SBill Sommerfeldrm -rf $find_dir 66*47ec9542SBill Sommerfeld 67*47ec9542SBill Sommerfeldexit $find_exit 68