Home | History | Annotate | Download | only in sssd
      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 (at] cn.fujitsu.com>
     21 # History:      2012/02/08 - Created.
     22 #
     23 
     24 . ./sssd-lib.sh || exit 1
     25 
     26 sssd_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 
     59 export TST_TOTAL=1
     60 export TST_COUNT=1
     61 export TCID=sssd02
     62 
     63 TFAILCNT=0
     64 username="sssd_test_user"
     65 
     66 make_config_file
     67 # make sure config file is OK
     68 sleep 1
     69 restart_sssd_daemon
     70 sss_useradd $username
     71 
     72 sssd_case1
     73 
     74 sss_userdel $username
     75 cleanup ${TFAILCNT:=0}
     76