xref: /illumos-gate/usr/src/test/smbclient-tests/tests/nsmbrc/tp_nsmbrc_004.ksh (revision 1a2d662a91cee3bf82f41cd47c7ae6f3825d9db2)
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
42tc_id="nsmbrc004"
43tc_desc=" Verify minauth can work on SERVER section"
44print_test_case $tc_id - $tc_desc
45
46if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
47	[[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
48    set -x
49fi
50
51server=$(server_name) || return
52
53cti_execute_cmd "rm -f ~/.nsmbrc"
54
55SERVER=$(echo $server | tr "[:lower:]" "[:upper:]")
56echo "[$SERVER]" > ~/.nsmbrc
57echo "addr=$server" >> ~/.nsmbrc
58echo "minauth=kerberos" >> ~/.nsmbrc
59
60# get rid of our connection
61cti_execute_cmd "smbutil discon //$TUSER@$server"
62sleep 1
63
64cti_report "expect failure next"
65cmd="smbutil view //$TUSER:$TPASS@$server"
66cti_execute -i '' PASS $cmd
67if [[ $? == 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
71else
72	cti_report "PASS: minauth property in SERVER section works"
73fi
74
75cti_execute_cmd "rm -f ~/.nsmbrc"
76
77cti_pass "${tc_id}: PASS"
78