1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2010 Sun Microsystems, Inc. All rights reserved. 25# 26 27# 28# ID: smbmount_013 29# 30# DESCRIPTION: 31# -o uid work well 32# 33# STRATEGY: 34# 1. run "mount -F smbfs -o uid=xxx //$TUSER:$TPASS@... 35# 2. ls -ld /mnt get owner xxx 36# 37 38. $STF_SUITE/include/libtest.ksh 39 40tc_id="smbmount013" 41tc_desc="uid=xxx worked well" 42print_test_case $tc_id - $tc_desc 43 44if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ 45 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then 46 set -x 47fi 48 49server=$(server_name) || return 50 51# SKIP for now (mount -uid needs privs) 52no_tested || return 53 54testdir_init $TDIR 55smbmount_clean $TMNT 56smbmount_init $TMNT 57 58# XXX: Should get this user from config 59tc_uid="listen" 60 61cmd="mount -F smbfs -o noprompt,noacl,uid=$tc_uid \ 62 //$TUSER:$TPASS@$server/public $TMNT" 63cti_execute -i '' FAIL sudo -n $cmd 64if [[ $? != 0 ]]; then 65 cti_fail "FAIL: $cmd" 66 return 67fi 68 69usr=$(ls -ld $TMNT|awk '{ print $3}') 70 71if [[ $usr != "$tc_uid" ]]; then 72 cti_fail "FAIL: ls -ld, expected $tc_uid, got $usr" 73 smbmount_clean $TMNT 74 return 75fi 76 77cti_execute_cmd "touch $TMNT/a" 78usr=$(ls -l a|awk '{ print $3}') 79if [[ $usr != "$tc_uid" ]]; then 80 cti_fail "FAIL: touch a, expected $tc_uid usr, got $usr" 81 smbmount_clean $TMNT 82 return 83fi 84 85cti_execute_cmd "rm -rf $TMNT/b" 86cti_execute_cmd "mkdir $TMNT/b" 87usr=$(ls -ld b|awk '{ print $3}') 88if [[ $usr != "$tc_uid" ]]; then 89 cti_fail "FAIL: mkdir b, expected $tc_uid usr, got $usr" 90 smbmount_clean $TMNT 91 return 92fi 93 94cti_execute_cmd "rm -rf $TMNT/*" 95 96cmd="umount $TMNT" 97cti_execute_cmd $cmd 98if [[ $? != 0 ]]; then 99 cti_fail "FAIL: failed to umount the $TMNT" 100 return 101fi 102 103smbmount_clean $TMNT 104 105cti_pass "${tc_id}: PASS" 106