xref: /netbsd-src/tests/usr.sbin/useradd/t_useradd.sh (revision c7358053efffe59e85347cf7c95527f0529bd73f)
1*c7358053Sjruoho# $NetBSD: t_useradd.sh,v 1.1 2012/04/19 18:51:36 jruoho Exp $
2*c7358053Sjruoho#
3*c7358053Sjruoho# Copyright (c) 2012 The NetBSD Foundation, Inc.
4*c7358053Sjruoho# All rights reserved.
5*c7358053Sjruoho#
6*c7358053Sjruoho# This code is derived from software contributed to The NetBSD Foundation
7*c7358053Sjruoho# by Jukka Ruohonen.
8*c7358053Sjruoho#
9*c7358053Sjruoho# Redistribution and use in source and binary forms, with or without
10*c7358053Sjruoho# modification, are permitted provided that the following conditions
11*c7358053Sjruoho# are met:
12*c7358053Sjruoho# 1. Redistributions of source code must retain the above copyright
13*c7358053Sjruoho#    notice, this list of conditions and the following disclaimer.
14*c7358053Sjruoho# 2. Redistributions in binary form must reproduce the above copyright
15*c7358053Sjruoho#    notice, this list of conditions and the following disclaimer in the
16*c7358053Sjruoho#    documentation and/or other materials provided with the distribution.
17*c7358053Sjruoho#
18*c7358053Sjruoho# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19*c7358053Sjruoho# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20*c7358053Sjruoho# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21*c7358053Sjruoho# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22*c7358053Sjruoho# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23*c7358053Sjruoho# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24*c7358053Sjruoho# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25*c7358053Sjruoho# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26*c7358053Sjruoho# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27*c7358053Sjruoho# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28*c7358053Sjruoho# POSSIBILITY OF SUCH DAMAGE.
29*c7358053Sjruoho#
30*c7358053Sjruohousername="test5678901234567"
31*c7358053Sjruoho
32*c7358053Sjruohoatf_test_case longname cleanup
33*c7358053Sjruoholongname_head() {
34*c7358053Sjruoho	atf_set "require.user" "root"
35*c7358053Sjruoho	atf_set "descr" "Test that usernames longer than 16 " \
36*c7358053Sjruoho			"characters are allowed (PR bin/39546)"
37*c7358053Sjruoho}
38*c7358053Sjruoho
39*c7358053Sjruoholongname_body() {
40*c7358053Sjruoho	atf_expect_fail "PR bin/39546"
41*c7358053Sjruoho	atf_check -s exit:0 -o ignore -e ignore -x "useradd $username"
42*c7358053Sjruoho}
43*c7358053Sjruoho
44*c7358053Sjruoholongname_cleanup() {
45*c7358053Sjruoho	atf_check -s ignore -o ignore -e ignore -x "userdel $username"
46*c7358053Sjruoho}
47*c7358053Sjruoho
48*c7358053Sjruohoatf_init_test_cases() {
49*c7358053Sjruoho	atf_add_test_case longname
50*c7358053Sjruoho}
51