1*96c8483aSYuri Pankov#!/bin/ksh -p 2*96c8483aSYuri Pankov# 3*96c8483aSYuri Pankov# CDDL HEADER START 4*96c8483aSYuri Pankov# 5*96c8483aSYuri Pankov# The contents of this file are subject to the terms of the 6*96c8483aSYuri Pankov# Common Development and Distribution License (the "License"). 7*96c8483aSYuri Pankov# You may not use this file except in compliance with the License. 8*96c8483aSYuri Pankov# 9*96c8483aSYuri Pankov# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*96c8483aSYuri Pankov# or http://www.opensolaris.org/os/licensing. 11*96c8483aSYuri Pankov# See the License for the specific language governing permissions 12*96c8483aSYuri Pankov# and limitations under the License. 13*96c8483aSYuri Pankov# 14*96c8483aSYuri Pankov# When distributing Covered Code, include this CDDL HEADER in each 15*96c8483aSYuri Pankov# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*96c8483aSYuri Pankov# If applicable, add the following below this CDDL HEADER, with the 17*96c8483aSYuri Pankov# fields enclosed by brackets "[]" replaced with your own identifying 18*96c8483aSYuri Pankov# information: Portions Copyright [yyyy] [name of copyright owner] 19*96c8483aSYuri Pankov# 20*96c8483aSYuri Pankov# CDDL HEADER END 21*96c8483aSYuri Pankov# 22*96c8483aSYuri Pankov 23*96c8483aSYuri Pankov# 24*96c8483aSYuri Pankov# Copyright 2010 Sun Microsystems, Inc. All rights reserved. 25*96c8483aSYuri Pankov# 26*96c8483aSYuri Pankov 27*96c8483aSYuri Pankov# 28*96c8483aSYuri Pankov# ID: smbmount_009 29*96c8483aSYuri Pankov# 30*96c8483aSYuri Pankov# DESCRIPTION: 31*96c8483aSYuri Pankov# Verify normal smbmount can mount private shares 32*96c8483aSYuri Pankov# 33*96c8483aSYuri Pankov# STRATEGY: 34*96c8483aSYuri Pankov# 1. run "mount -F smbfs //$AUSER:$APASS@$server/$AUSER $TMNT" 35*96c8483aSYuri Pankov# 2. mount successfully 36*96c8483aSYuri Pankov# 3. rm and cp can get right message 37*96c8483aSYuri Pankov# 38*96c8483aSYuri Pankov 39*96c8483aSYuri Pankov. $STF_SUITE/include/libtest.ksh 40*96c8483aSYuri Pankov 41*96c8483aSYuri Pankovtc_id="smbmount009" 42*96c8483aSYuri Pankovtc_desc="Verify normal smbmount can mount private shares" 43*96c8483aSYuri Pankovprint_test_case $tc_id - $tc_desc 44*96c8483aSYuri Pankov 45*96c8483aSYuri Pankovif [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ 46*96c8483aSYuri Pankov [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then 47*96c8483aSYuri Pankov set -x 48*96c8483aSYuri Pankovfi 49*96c8483aSYuri Pankov 50*96c8483aSYuri Pankovserver=$(server_name) || return 51*96c8483aSYuri Pankov 52*96c8483aSYuri Pankovtestdir_init $TDIR 53*96c8483aSYuri Pankovsmbmount_clean $TMNT 54*96c8483aSYuri Pankovsmbmount_init $TMNT 55*96c8483aSYuri Pankov 56*96c8483aSYuri Pankovsudo -n chown $AUSER $TMNT 57*96c8483aSYuri Pankov 58*96c8483aSYuri Pankovcmd="mount -F smbfs -o noprompt //$AUSER:$APASS@$server/a_share $TMNT" 59*96c8483aSYuri Pankovcti_execute -i '' FAIL sudo -n -u $AUSER "$cmd" 60*96c8483aSYuri Pankovif [[ $? != 0 ]]; then 61*96c8483aSYuri Pankov cti_fail "FAIL: the normal user can't mount the share a_share" 62*96c8483aSYuri Pankov return 63*96c8483aSYuri Pankovelse 64*96c8483aSYuri Pankov cti_report "PASS: the normal user can mount the share a_share" 65*96c8483aSYuri Pankovfi 66*96c8483aSYuri Pankov 67*96c8483aSYuri Pankovsmbmount_check $TMNT || return 68*96c8483aSYuri Pankov 69*96c8483aSYuri Pankovcti_execute_cmd "rm -rf $TMNT/*" 70*96c8483aSYuri Pankov 71*96c8483aSYuri Pankovcmd="cp /usr/bin/ls $TMNT/ls_file" 72*96c8483aSYuri Pankovcti_execute FAIL sudo -n -u $AUSER $cmd 73*96c8483aSYuri Pankovif [[ $? != 0 ]]; then 74*96c8483aSYuri Pankov cti_fail "FAIL: cp the file /usr/bin/ls is failed" 75*96c8483aSYuri Pankov return 76*96c8483aSYuri Pankovelse 77*96c8483aSYuri Pankov cti_report "PASS: cp the file /usr/bin/ls successfully" 78*96c8483aSYuri Pankovfi 79*96c8483aSYuri Pankov 80*96c8483aSYuri Pankovcmd="diff /usr/bin/ls $TMNT/ls_file" 81*96c8483aSYuri Pankovcti_execute_cmd sudo -n -u $AUSER $cmd 82*96c8483aSYuri Pankovif [[ $? != 0 ]]; then 83*96c8483aSYuri Pankov cti_fail "FAIL: the file /usr/bin/ls is different with the file ls_file" 84*96c8483aSYuri Pankov return 85*96c8483aSYuri Pankovelse 86*96c8483aSYuri Pankov cti_report "PASS: the file /usr/bin/ls is same to the file ls_file" 87*96c8483aSYuri Pankovfi 88*96c8483aSYuri Pankov 89*96c8483aSYuri Pankovcti_execute_cmd "rm ls_file" 90*96c8483aSYuri Pankov 91*96c8483aSYuri Pankovcmd="umount $TMNT" 92*96c8483aSYuri Pankovcti_execute_cmd sudo -n -u $AUSER $cmd 93*96c8483aSYuri Pankovif [[ $? != 0 ]]; then 94*96c8483aSYuri Pankov cti_fail "FAIL: the normal user failed to umount the $TMNT" 95*96c8483aSYuri Pankov return 96*96c8483aSYuri Pankovelse 97*96c8483aSYuri Pankov cti_report "PASS: the normal user umount the $TMNT successfully" 98*96c8483aSYuri Pankovfi 99*96c8483aSYuri Pankov 100*96c8483aSYuri Pankovsmbmount_clean $TMNT 101*96c8483aSYuri Pankovcti_pass "${tc_id}: PASS" 102