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 # Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  26 #
  27 
  28 #
  29 # ID:nsmbrc004
  30 #
  31 # DESCRIPTION:
  32 #        Verify minauth can work on SERVER section
  33 #
  34 # STRATEGY:
  35 #       1. create a .nsmbrc file
  36 #       2. run "smbutil view //$TUSER:$TPASS@$server"
  37 #       3. smbutil can get right messages
  38 #
  39 
  40 . $STF_SUITE/include/libtest.ksh
  41 
  42 tc_id="nsmbrc004"
  43 tc_desc=" Verify minauth can work on SERVER section"
  44 print_test_case $tc_id - $tc_desc
  45 
  46 if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
  47         [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
  48     set -x
  49 fi
  50 
  51 server=$(server_name) || return
  52 
  53 cti_execute_cmd "rm -f ~/.nsmbrc"
  54 
  55 SERVER=$(echo $server | tr "[:lower:]" "[:upper:]")
  56 echo "[$SERVER]" > ~/.nsmbrc
  57 echo "addr=$server" >> ~/.nsmbrc
  58 echo "minauth=kerberos" >> ~/.nsmbrc
  59 
  60 # get rid of our connection
  61 cti_execute_cmd "smbutil discon //$TUSER@$server"
  62 sleep 1
  63 
  64 cti_report "expect failure next"
  65 cmd="smbutil view //$TUSER:$TPASS@$server"
  66 cti_execute -i '' PASS $cmd
  67 if [[ $? == 0 ]]; then
  68         cti_execute_cmd "echo '::nsmb_vc' |sudo -n mdb -k"
  69         cti_fail "FAIL: minauth property in SERVER section doesn't work"
  70         return
  71 else
  72         cti_report "PASS: minauth property in SERVER section works"
  73 fi
  74 
  75 cti_execute_cmd "rm -f ~/.nsmbrc"
  76 
  77 cti_pass "${tc_id}: PASS"