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:nsmbrc001
  30 #
  31 # DESCRIPTION:
  32 #        Verify minauth can work in default
  33 #
  34 # STRATEGY:
  35 #       1. create a .nsmbrc file include default section
  36 #          minauth=kerberos
  37 #       2. run "smbutil view user@server and get the failure"
  38 #       3. create a .nsmbrc file include server section minauth=kerberos
  39 #       4. run "smbutil view user@server and get the failure"
  40 #
  41 
  42 . $STF_SUITE/include/libtest.ksh
  43 
  44 set -x
  45 
  46 tc_id="nsmbrc001"
  47 tc_desc="Verify minauth can work in default"
  48 print_test_case $tc_id" - "$tc_desc
  49 
  50 if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
  51         [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
  52     set -x
  53 fi
  54 
  55 server=$(server_name) || return
  56 
  57 cti_execute_cmd "rm -f ~/.nsmbrc"
  58 echo "[default]
  59 minauth=kerberos" > ~/.nsmbrc
  60 
  61 # kill any existing session first
  62 cti_execute_cmd "smbutil discon //$TUSER@$server"
  63 sleep 1
  64 
  65 # this should fail
  66 cmd="smbutil view -N //$TUSER:$TPASS@$server"
  67 cti_execute -i '' PASS $cmd
  68 if [[ $? == 0 ]]; then
  69         cti_execute_cmd "echo '::nsmb_vc' |sudo -n mdb -k"
  70         cti_fail "FAIL: can pass authentication by minauth=kerberos"
  71         return
  72 else
  73         cti_report "PASS: can't pass authentication by minauth=kerberos"
  74 fi
  75 
  76 cti_execute_cmd "rm -f ~/.nsmbrc"
  77 
  78 cti_pass "${tc_id}: PASS"