xref: /illumos-gate/usr/src/test/smbclient-tests/tests/smbmount/tp_smbmount_012.ksh (revision 8a2b682e57a046b828f37bcde1776f131ef4629f)
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_012
29#
30# DESCRIPTION:
31#         -o fileperms work well
32#
33# STRATEGY:
34#        1. create a smb public share for user "$AUSER" on sever
35#        2. run "mount -F smbfs -o dirperms=540 //a@server/share
36#        /mnt" on client
37#        3. ls -ld /mnt get 540 permisson
38#        4. smbutil login //a@server
39#        5. cd /PUBLIC get permisson deny
40#
41
42. $STF_SUITE/include/libtest.ksh
43
44tc_id="smbmount012"
45tc_desc="dirperms=xxx worked well "
46print_test_case $tc_id - $tc_desc
47
48if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
49	[[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
50    set -x
51fi
52
53server=$(server_name) || return
54
55testdir_init $TDIR
56smbmount_clean $TMNT
57smbmount_init $TMNT
58
59cmd="mount -F smbfs -o noprompt,noacl,dirperms=540
60 //$AUSER:$APASS@$server/public $TMNT"
61cti_execute -i '' FAIL $cmd
62if [[ $? != 0 ]]; then
63	cti_fail "FAIL: smbmount can't mount the public share"
64	return
65else
66	cti_report "PASS: smbmount can mount the public share"
67fi
68
69perm=$(ls -ld $TMNT |awk '{ print $1}')
70if [[ $perm != "dr-xr-----" && $perm != "dr-xr-----+" ]]; then
71	cti_fail "FAIL: the expect result is get 540 permission, but get $perm"
72	return
73else
74	cti_report "PASS: the expect result is right"
75fi
76cti_execute_cmd "rm -rf $TMNT/a"
77
78cmd="umount $TMNT"
79cti_execute_cmd $cmd
80if [[ $? != 0 ]]; then
81	cti_fail "FAIL: failed to umount the $TMNT"
82	return
83else
84	cti_report "PASS: umount the $TMNT successfully"
85fi
86
87smbmount_clean $TMNT
88
89cti_pass "${tc_id}: PASS"
90