• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2
3#  Copyright (c) 2012 FUJITSU LIMITED
4#
5#  This program is free software;  you can redistribute it and/or modify
6#  it under the terms of the GNU General Public License as published by
7#  the Free Software Foundation; either version 2 of the License, or
8#  (at your option) any later version.
9#
10#  This program is distributed in the hope that it will be useful,
11#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
12#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13#  the GNU General Public License for more details.
14#
15#  You should have received a copy of the GNU General Public License
16#  along with this program;  if not, write to the Free Software
17#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18#
19# Description:  Test override_gid in the configuration file.
20# Author:       Peng Haitao <penght@cn.fujitsu.com>
21# History:      2012/02/08 - Created.
22#
23
24. ./sssd-lib.sh || exit 1
25
26sssd_case1()
27{
28	tst_resm TINFO "test override_gid with gid+1 in [domain/LOCAL]"
29
30	# Create the configuration file specific to this test case.
31	make_config_file
32	gid=`id -g $username`
33	gid_add_one=$(( gid+1 ))
34	sed -i -e "/\[domain\/LOCAL\]/ a\override_gid = $gid_add_one" \
35		$CONFIG_FILE
36	sleep 1
37
38	getent passwd $username@LOCAL | grep "$gid_add_one" >/dev/null 2>&1
39	if [ $? -eq 0 ]; then
40		tst_resm TFAIL "sssd: user GID should be not $gid_add_one."
41		: $(( TFAILCNT += 1 ))
42		return $TFAILCNT
43	fi
44
45	restart_sssd_daemon
46
47	getent passwd $username@LOCAL | grep "$gid_add_one" >/dev/null 2>&1
48	if [ $? -eq 0 ]; then
49		tst_resm TPASS "sssd: user GID is $gid_add_one."
50	else
51		tst_resm TFAIL "sssd: user GID should be $gid_add_one."
52		: $(( TFAILCNT += 1 ))
53		return $TFAILCNT
54	fi
55
56	return 0
57}
58
59export TST_TOTAL=1
60export TST_COUNT=1
61export TCID=sssd02
62
63TFAILCNT=0
64username="sssd_test_user"
65
66make_config_file
67# make sure config file is OK
68sleep 1
69restart_sssd_daemon
70sss_useradd $username
71
72sssd_case1
73
74sss_userdel $username
75cleanup ${TFAILCNT:=0}
76