Yuri Pankov | 96c8483 | 2018-04-11 16:16:11 -0400 | [diff] [blame^] | 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_011 |
| 29 | # |
| 30 | # DESCRIPTION: |
| 31 | # -o fileperms affects both file and dir permissions |
| 32 | # |
| 33 | # STRATEGY: |
| 34 | # 1. create a smb public share on sever |
| 35 | # 2. run "mount -F smbfs -o fileperms=744 //server/share |
| 36 | # /mnt" on client |
| 37 | # 3. cd /mnt; touch a; ls -l a get 744 permisson |
| 38 | # 4. cd /mnt; mkdir d; ls -l a get 755 permisson |
| 39 | # |
| 40 | |
| 41 | . $STF_SUITE/include/libtest.ksh |
| 42 | |
| 43 | tc_id="smbmount011" |
| 44 | tc_desc="fileperm=xxx worked well " |
| 45 | print_test_case $tc_id - $tc_desc |
| 46 | |
| 47 | if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \ |
| 48 | [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then |
| 49 | set -x |
| 50 | fi |
| 51 | |
| 52 | server=$(server_name) || return |
| 53 | |
| 54 | testdir_init $TDIR |
| 55 | smbmount_clean $TMNT |
| 56 | smbmount_init $TMNT |
| 57 | |
| 58 | cmd="mount -F smbfs -o noprompt,noacl,fileperms=744 |
| 59 | //$TUSER:$TPASS@$server/public $TMNT" |
| 60 | cti_execute -i '' FAIL $cmd |
| 61 | |
| 62 | cti_execute_cmd "touch $TMNT/a" |
| 63 | perm=$(cd $TMNT; ls -l a|awk '{ print $1}') |
| 64 | if [[ $perm != "-rwxr--r--" && $perm != "-rwxr--r--+" ]]; then |
| 65 | tet_infoline "ls expect get 744 permission, but get $perm" |
| 66 | smbmount_clean $TMNT |
| 67 | tet_result FAIL |
| 68 | return |
| 69 | fi |
| 70 | |
| 71 | cti_execute_cmd "rm -f $TMNT/a" |
| 72 | cti_execute_cmd "mkdir $TMNT/d" |
| 73 | |
| 74 | perm=$(cd $TMNT; ls -ld d|awk '{ print $1}') |
| 75 | if [[ $perm != "drwxr-xr-x" && $perm != "drwxr-xr-x+" ]]; then |
| 76 | tet_infoline "ls expect get 755 permission, but get $perm" |
| 77 | smbmount_clean $TMNT |
| 78 | tet_result FAIL |
| 79 | return |
| 80 | fi |
| 81 | cti_execute_cmd "rm -rf $TMNT/d" |
| 82 | |
| 83 | cmd="umount $TMNT" |
| 84 | cti_execute_cmd $cmd |
| 85 | if [[ $? != 0 ]]; then |
| 86 | cti_fail "FAIL: failed to umount the $TMNT" |
| 87 | return |
| 88 | else |
| 89 | cti_report "PASS: failed to umount the $TMNT" |
| 90 | fi |
| 91 | |
| 92 | smbmount_clean $TMNT |
| 93 | |
| 94 | cti_pass "${tc_id}: PASS" |