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_007
  29 #
  30 # DESCRIPTION:
  31 #        Verify mutil user mount success with -O
  32 #
  33 # STRATEGY:
  34 #       1. create users "$AUSER", "$BUSER" and their passwords
  35 #       2. create $AUSER smb private share for user "$AUSER"
  36 #       3. run "mount -F smbfs //$AUSER:$APASS@server/public /export/mnt"
  37 #       4. mount successfully
  38 #       5. run "mount -F smbfs -O //$BUSER:$BPASS@server/public /export/mnt"
  39 #       6. mount successfully
  40 #
  41 
  42 . $STF_SUITE/include/libtest.ksh
  43 
  44 tc_id="smbmount007"
  45 tc_desc=" Verify mutil user mount success with -o O"
  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 # SKIP for now (mount -O needs privs)
  56 no_tested || return
  57 
  58 testdir_init $TDIR
  59 smbmount_clean $TMNT
  60 smbmount_init $TMNT
  61 
  62 cmd="mount -F smbfs -o noprompt //$AUSER:$APASS@$server/public $TMNT"
  63 cti_execute -i '' FAIL $cmd
  64 if [[ $? != 0 ]]; then
  65         cti_fail "FAIL: smbmount can't mount the public share"
  66         return
  67 else
  68         cti_report "PASS: smbmount mount the public share successfully"
  69 fi
  70 
  71 smbmount_check $TMNT || return
  72 
  73 cmd="cp /usr/bin/ls $TMNT/$AUSER"
  74 cti_execute_cmd $cmd
  75 if [[ $? != 0 ]]; then
  76         cti_fail "FAIL: failed to create the file by $AUSER"
  77         return
  78 else
  79         cti_report "PASS: create the file by $AUSER successfully"
  80 fi
  81 
  82 cmd="rm -rf $TMNT/$AUSER"
  83 cti_execute_cmd $cmd
  84 
  85 cmd="mount -F smbfs -O -o noprompt //$BUSER:$BPASS@$server/public $TMNT"
  86 cti_execute -i '' FAIL $cmd
  87 if [[ $? != 0 ]]; then
  88         cti_fail "FAIL: the second mount with $BUSER failed"
  89         return
  90 else
  91         cti_report "PASS: the second mount with $BUSER successfully"
  92 fi
  93 
  94 smbmount_check $TMNT || return
  95 
  96 cmd="cp /usr/bin/ls  $TMNT/$BUSER"
  97 cti_execute_cmd $cmd
  98 if [[ $? != 0 ]]; then
  99         cti_fail "FAIL: failed to create the file by the $BUSER"
 100         return
 101 else
 102         cti_report "PASS: create the file by the $BUSER successfully"
 103 fi
 104 
 105 cmd="rm -rf $TMNT/$BUSER"
 106 cti_execute_cmd $cmd
 107 
 108 cmd="umount $TMNT"
 109 cti_execute_cmd $cmd
 110 if [[ $? != 0 ]]; then
 111         cti_fail "FAIL: failed to umount the $TMNT"
 112         return
 113 else
 114         cti_report "PASS: umount the $TMNT successfully"
 115 fi
 116 
 117 cmd="umount $TMNT"
 118 cti_execute_cmd $cmd
 119 if [[ $? != 0 ]]; then
 120         cti_fail "FAIL: the second umount the $TMNT failed"
 121         return
 122 else
 123         cti_report "PASS: the second umount the $TMNT successfully"
 124 fi
 125 
 126 smbmount_clean $TMNT
 127 cti_pass "${tc_id}: PASS"