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_013
  29 #
  30 # DESCRIPTION:
  31 #        -o uid work well
  32 #
  33 # STRATEGY:
  34 #        1. run "mount -F smbfs -o uid=xxx //$TUSER:$TPASS@...
  35 #        2. ls -ld /mnt get owner xxx
  36 #
  37 
  38 . $STF_SUITE/include/libtest.ksh
  39 
  40 tc_id="smbmount013"
  41 tc_desc="uid=xxx worked well"
  42 print_test_case $tc_id - $tc_desc
  43 
  44 if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
  45         [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
  46     set -x
  47 fi
  48 
  49 server=$(server_name) || return
  50 
  51 # SKIP for now (mount -uid needs privs)
  52 no_tested || return
  53 
  54 testdir_init $TDIR
  55 smbmount_clean $TMNT
  56 smbmount_init $TMNT
  57 
  58 # XXX: Should get this user from config
  59 tc_uid="smmsp"
  60 
  61 cmd="mount -F smbfs -o noprompt,noacl,uid=$tc_uid \
  62  //$TUSER:$TPASS@$server/public $TMNT"
  63 cti_execute -i '' FAIL sudo -n $cmd
  64 if [[ $? != 0 ]]; then
  65         cti_fail "FAIL: $cmd"
  66         return
  67 fi
  68 
  69 usr=$(ls -ld $TMNT|awk '{ print $3}')
  70 
  71 if [[ $usr != "$tc_uid" ]]; then
  72         cti_fail "FAIL: ls -ld, expected $tc_uid, got $usr"
  73         smbmount_clean $TMNT
  74         return
  75 fi
  76 
  77 cti_execute_cmd "touch $TMNT/a"
  78 usr=$(ls -l a|awk '{ print $3}')
  79 if [[ $usr != "$tc_uid" ]]; then
  80         cti_fail "FAIL: touch a, expected $tc_uid usr, got $usr"
  81         smbmount_clean $TMNT
  82         return
  83 fi
  84 
  85 cti_execute_cmd "rm -rf $TMNT/b"
  86 cti_execute_cmd "mkdir $TMNT/b"
  87 usr=$(ls -ld b|awk '{ print $3}')
  88 if [[ $usr != "$tc_uid" ]]; then
  89         cti_fail "FAIL: mkdir b, expected $tc_uid usr, got $usr"
  90         smbmount_clean $TMNT
  91         return
  92 fi
  93 
  94 cti_execute_cmd "rm -rf $TMNT/*"
  95 
  96 cmd="umount $TMNT"
  97 cti_execute_cmd $cmd
  98 if [[ $? != 0 ]]; then
  99         cti_fail "FAIL: failed to umount the $TMNT"
 100         return
 101 fi
 102 
 103 smbmount_clean $TMNT
 104 
 105 cti_pass "${tc_id}: PASS"