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 
  44 tc_id="smbmount012"
  45 tc_desc="dirperms=xxx worked well "
  46 print_test_case $tc_id - $tc_desc
  47 
  48 if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
  49         [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
  50     set -x
  51 fi
  52 
  53 server=$(server_name) || return
  54 
  55 testdir_init $TDIR
  56 smbmount_clean $TMNT
  57 smbmount_init $TMNT
  58 
  59 cmd="mount -F smbfs -o noprompt,noacl,dirperms=540
  60  //$AUSER:$APASS@$server/public $TMNT"
  61 cti_execute -i '' FAIL $cmd
  62 if [[ $? != 0 ]]; then
  63         cti_fail "FAIL: smbmount can't mount the public share"
  64         return
  65 else
  66         cti_report "PASS: smbmount can mount the public share"
  67 fi
  68 
  69 perm=$(ls -ld $TMNT |awk '{ print $1}')
  70 if [[ $perm != "dr-xr-----" && $perm != "dr-xr-----+" ]]; then
  71         cti_fail "FAIL: the expect result is get 540 permission, but get $perm"
  72         return
  73 else
  74         cti_report "PASS: the expect result is right"
  75 fi
  76 cti_execute_cmd "rm -rf $TMNT/a"
  77 
  78 cmd="umount $TMNT"
  79 cti_execute_cmd $cmd
  80 if [[ $? != 0 ]]; then
  81         cti_fail "FAIL: failed to umount the $TMNT"
  82         return
  83 else
  84         cti_report "PASS: umount the $TMNT successfully"
  85 fi
  86 
  87 smbmount_clean $TMNT
  88 
  89 cti_pass "${tc_id}: PASS"