blob: f2d2520aa417f4f11c6c147c28995eb3d1d0e6e7 [file] [log] [blame]
Yuri Pankov96c84832018-04-11 16:16:11 -04001#!/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:nsmbrc006
30#
31# DESCRIPTION:
32# Verify user and domain can work in .nsmbrc
33#
34# STRATEGY:
35# 1. create a .nsmbrc file
36# 2. run "smbutil view //$server"
37# 3. run "mount -F smbfs //$server/public $TMNT"
38# 4. smbutil and mount can get the right message
39#
40
41. $STF_SUITE/include/libtest.ksh
42
43tc_id="nsmbrc006"
44tc_desc=" Verify user and domain in sever section can work"
45print_test_case $tc_id - $tc_desc
46
47if [[ $STC_CIFS_CLIENT_DEBUG == 1 ]] || \
48 [[ *:${STC_CIFS_CLIENT_DEBUG}:* == *:$tc_id:* ]]; then
49 set -x
50fi
51
52server=$(server_name) || return
53
54cti_execute_cmd "rm -f ~/.nsmbrc"
55smbmount_clean $TMNT
56smbmount_init $TMNT
57
58pass=$(smbutil crypt $TPASS)
59SERVER=$(echo $server | tr "[:lower:]" "[:upper:]")
60echo "[$SERVER]" > ~/.nsmbrc
61echo "password=$pass" >> ~/.nsmbrc
62echo "user=$TUSER" >> ~/.nsmbrc
63echo "domain=mydomain" >> ~/.nsmbrc
64cti_execute_cmd chmod 600 ~/.nsmbrc
65
66cmd="smbutil view //$server"
67cti_execute -i '' FAIL $cmd
68if [[ $? != 0 ]]; then
69 cti_fail "FAIL: user and domain properties in default SERVER section" \
70 "don't work"
71 return
72else
73 cti_report "PASS: user and domain properties in default SERVER section" \
74 "work"
75fi
76
77cmd="mount -F smbfs //$server/public $TMNT"
78cti_execute -i '' FAIL $cmd
79if [[ $? != 0 ]]; then
80 cti_fail "FAIL: user and domain properties in default SERVER section" \
81 "don't work"
82 return
83else
84 cti_report "PASS: user and domain properties in default SERVER section" \
85 "work"
86fi
87
88smbmount_check $TMNT
89if [[ $? != 0 ]]; then
90 smbmount_clean $TMNT
91 return
92fi
93
94cti_execute_cmd "rm -f ~/.nsmbrc"
95smbmount_clean $TMNT
96
97cti_pass "${tc_id}: PASS"