xref: /illumos-gate/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_013.ksh (revision 1db1721aaa637f7c122058e7fe330468a966e760)
196c8483aSYuri Pankov#!/bin/ksh -p
296c8483aSYuri Pankov#
396c8483aSYuri Pankov# CDDL HEADER START
496c8483aSYuri Pankov#
596c8483aSYuri Pankov# The contents of this file are subject to the terms of the
696c8483aSYuri Pankov# Common Development and Distribution License (the "License").
796c8483aSYuri Pankov# You may not use this file except in compliance with the License.
896c8483aSYuri Pankov#
996c8483aSYuri Pankov# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1096c8483aSYuri Pankov# or http://www.opensolaris.org/os/licensing.
1196c8483aSYuri Pankov# See the License for the specific language governing permissions
1296c8483aSYuri Pankov# and limitations under the License.
1396c8483aSYuri Pankov#
1496c8483aSYuri Pankov# When distributing Covered Code, include this CDDL HEADER in each
1596c8483aSYuri Pankov# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1696c8483aSYuri Pankov# If applicable, add the following below this CDDL HEADER, with the
1796c8483aSYuri Pankov# fields enclosed by brackets "[]" replaced with your own identifying
1896c8483aSYuri Pankov# information: Portions Copyright [yyyy] [name of copyright owner]
1996c8483aSYuri Pankov#
2096c8483aSYuri Pankov# CDDL HEADER END
2196c8483aSYuri Pankov#
2296c8483aSYuri Pankov
2396c8483aSYuri Pankov#
2496c8483aSYuri Pankov# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
2596c8483aSYuri Pankov#
2696c8483aSYuri Pankov
2796c8483aSYuri Pankov#
2896c8483aSYuri Pankov# ID: smbmount_013
2996c8483aSYuri Pankov#
3096c8483aSYuri Pankov# DESCRIPTION:
3196c8483aSYuri Pankov#	 -o uid work well
3296c8483aSYuri Pankov#
3396c8483aSYuri Pankov# STRATEGY:
3496c8483aSYuri Pankov#        1. run "mount -F smbfs -o uid=xxx //$TUSER:$TPASS@...
3596c8483aSYuri Pankov#        2. ls -ld /mnt get owner xxx
3696c8483aSYuri Pankov#
3796c8483aSYuri Pankov
3896c8483aSYuri Pankov. $STF_SUITE/include/libtest.ksh
3996c8483aSYuri Pankov
4096c8483aSYuri Pankovtc_id="smbmount013"
4196c8483aSYuri Pankovtc_desc="uid=xxx worked well"
4296c8483aSYuri Pankovprint_test_case $tc_id - $tc_desc
4396c8483aSYuri Pankov
4496c8483aSYuri Pankovif [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
4596c8483aSYuri Pankov	[[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
4696c8483aSYuri Pankov    set -x
4796c8483aSYuri Pankovfi
4896c8483aSYuri Pankov
4996c8483aSYuri Pankovserver=$(server_name) || return
5096c8483aSYuri Pankov
5196c8483aSYuri Pankov# SKIP for now (mount -uid needs privs)
5296c8483aSYuri Pankovno_tested || return
5396c8483aSYuri Pankov
5496c8483aSYuri Pankovtestdir_init $TDIR
5596c8483aSYuri Pankovsmbmount_clean $TMNT
5696c8483aSYuri Pankovsmbmount_init $TMNT
5796c8483aSYuri Pankov
5896c8483aSYuri Pankov# XXX: Should get this user from config
59*1db1721aSAndy Fiddamantc_uid="listen"
6096c8483aSYuri Pankov
6196c8483aSYuri Pankovcmd="mount -F smbfs -o noprompt,noacl,uid=$tc_uid \
6296c8483aSYuri Pankov //$TUSER:$TPASS@$server/public $TMNT"
6396c8483aSYuri Pankovcti_execute -i '' FAIL sudo -n $cmd
6496c8483aSYuri Pankovif [[ $? != 0 ]]; then
6596c8483aSYuri Pankov	cti_fail "FAIL: $cmd"
6696c8483aSYuri Pankov	return
6796c8483aSYuri Pankovfi
6896c8483aSYuri Pankov
6996c8483aSYuri Pankovusr=$(ls -ld $TMNT|awk '{ print $3}')
7096c8483aSYuri Pankov
7196c8483aSYuri Pankovif [[ $usr != "$tc_uid" ]]; then
7296c8483aSYuri Pankov	cti_fail "FAIL: ls -ld, expected $tc_uid, got $usr"
7396c8483aSYuri Pankov	smbmount_clean $TMNT
7496c8483aSYuri Pankov	return
7596c8483aSYuri Pankovfi
7696c8483aSYuri Pankov
7796c8483aSYuri Pankovcti_execute_cmd "touch $TMNT/a"
7896c8483aSYuri Pankovusr=$(ls -l a|awk '{ print $3}')
7996c8483aSYuri Pankovif [[ $usr != "$tc_uid" ]]; then
8096c8483aSYuri Pankov	cti_fail "FAIL: touch a, expected $tc_uid usr, got $usr"
8196c8483aSYuri Pankov	smbmount_clean $TMNT
8296c8483aSYuri Pankov	return
8396c8483aSYuri Pankovfi
8496c8483aSYuri Pankov
8596c8483aSYuri Pankovcti_execute_cmd "rm -rf $TMNT/b"
8696c8483aSYuri Pankovcti_execute_cmd "mkdir $TMNT/b"
8796c8483aSYuri Pankovusr=$(ls -ld b|awk '{ print $3}')
8896c8483aSYuri Pankovif [[ $usr != "$tc_uid" ]]; then
8996c8483aSYuri Pankov	cti_fail "FAIL: mkdir b, expected $tc_uid usr, got $usr"
9096c8483aSYuri Pankov	smbmount_clean $TMNT
9196c8483aSYuri Pankov	return
9296c8483aSYuri Pankovfi
9396c8483aSYuri Pankov
9496c8483aSYuri Pankovcti_execute_cmd "rm -rf $TMNT/*"
9596c8483aSYuri Pankov
9696c8483aSYuri Pankovcmd="umount $TMNT"
9796c8483aSYuri Pankovcti_execute_cmd $cmd
9896c8483aSYuri Pankovif [[ $? != 0 ]]; then
9996c8483aSYuri Pankov	cti_fail "FAIL: failed to umount the $TMNT"
10096c8483aSYuri Pankov	return
10196c8483aSYuri Pankovfi
10296c8483aSYuri Pankov
10396c8483aSYuri Pankovsmbmount_clean $TMNT
10496c8483aSYuri Pankov
10596c8483aSYuri Pankovcti_pass "${tc_id}: PASS"
106