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: sharectl_005
  29 #
  30 # DESCRIPTION:
  31 #        Verify user and domain work in sharctl "default" section
  32 #
  33 # STRATEGY:
  34 #       1. run "sharectl set -p section=default -p password=$pass smbfs"
  35 #       2. run "sharectl set -p section=default -p user=$TUSER smbfs"
  36 #       3. run "sharectl set -p section=default -p domain=mydomain smbf"
  37 #       2. run "mount -F smbfs //$server/public $TMNT"
  38 #       3. sharectl and mount can get right message
  39 #
  40 
  41 . $STF_SUITE/include/libtest.ksh
  42 
  43 tc_id="sharectl005"
  44 tc_desc="Test user and domain in sharctl [default] section."
  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 smbmount_clean $TMNT
  55 smbmount_init $TMNT
  56 
  57 pass=$(smbutil crypt $TPASS)
  58 cmd="sharectl set -p section=default -p password=\$pass smbfs"
  59 cti_execute_cmd $cmd
  60 if [[ $? != 0 ]]; then
  61         cti_fail "FAIL: sharectl set password in default section failed"
  62         return
  63 else
  64         cti_report "PASS: sharectl set password in default section succeeded"
  65 fi
  66 cmd="sharectl set -p section=default -p user=$TUSER smbfs"
  67 cti_execute_cmd $cmd
  68 if [[ $? != 0 ]]; then
  69         cti_fail "sharectl set user in default section failed"
  70         sharectl delsect default smbfs
  71         return
  72 else
  73         cti_report "PASS: sharectl set user in default section succeeded"
  74 fi
  75 cmd="sharectl set -p section=default -p domain=mydomain smbfs"
  76 cti_execute_cmd $cmd
  77 if [[ $? != 0 ]]; then
  78         cti_fail "sharectl set domain in default section failed"
  79         sharectl delsect default smbfs
  80         return
  81 else
  82         cti_report "PASS sharectl set domain in default section succeeded"
  83 fi
  84 
  85 cmd="smbutil view //$server"
  86 cti_execute -i '' FAIL $cmd
  87 if [[ $? != 0 ]]; then
  88         cti_fail "FAIL: smbutil view failed for user and domain properity"
  89         sharectl delsect default smbfs
  90         return
  91 else
  92         cti_report "PASS: smbutil view suceeded for user and domain properity"
  93 fi
  94 
  95 cmd="mount -F smbfs //$server/public $TMNT"
  96 cti_execute -i '' FAIL $cmd
  97 if [[ $? != 0 ]]; then
  98         cti_fail "FAIL: smbmount can't mount the public share"
  99         sharectl delsect default smbfs
 100         return
 101 else
 102         cti_report "PASS: smbmount can mount the public share"
 103 fi
 104 
 105 smbmount_check $TMNT
 106 if [[ $? != 0 ]]; then
 107         sharectl delsect default smbfs
 108         smbmount_clean $TMNT
 109         return
 110 fi
 111 
 112 smbmount_clean $TMNT
 113 sharectl delsect default smbfs
 114 
 115 cti_pass "${tc_id}: PASS"