1#!/bin/bash 2#********************************************************************************# 3#* *# 4#* Copyright (c) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil *# 5#* *# 6#* This program is free software; you can redistribute it and#or modify *# 7#* it under the terms of the GNU General Public License as published by *# 8#* the Free Software Foundation; either version 2 of the License, or *# 9#* (at your option) any later version. *# 10#* *# 11#* This program is distributed in the hope that it will be useful, *# 12#* but WITHOUT ANY WARRANTY; without even the implied warranty of *# 13#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See *# 14#* the GNU General Public License for more details. *# 15#* *# 16#* You should have received a copy of the GNU General Public License *# 17#* along with this program; if not, write to the Free Software *# 18#* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *# 19#* *# 20#********************************************************************************# 21 22#********************************************************************************# 23#* *# 24#* File: remove_password.sh *# 25#* *# 26#* Description: used to remove the password from a card previously unlocked. *# 27#* *# 28#* *# 29#* Total Tests: 1 *# 30#* *# 31#* Author: Anderson Briglia <anderson.briglia@indt.org.br> *# 32#* Anderson Lizardo <anderson.lizardo@indt.org.br> *# 33#* Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br> *# 34#* *# 35#* *# 36#* *# 37#********************************************************************************# 38remove_password() 39{ 40 export TST_TOTAL=1 # Total number of test cases in this file. 41 # Set up LTPTMP (temporary directory used by the tests). 42 LTPTMP=${TMP} # Temporary directory to create files, etc. 43 export TCID="remove_password" # Test case identifier 44 export TST_COUNT=0 # Set up is initialized as test 0 45 RC=0 # Exit values of system commands used 46 47 echo "=== Remove MMC Password ===" 48 keyid=$(keyctl request mmc "mmc:key") 49 if [ -z "$keyid" ]; then 50 echo "*** No protected and unlocked MMC was found. The password cannot be removed." 51 exit 1 52 fi 53 54 echo remove > /sys/bus/mmc/devices/mmc0\:*/lockable || \ 55 { echo "*** Password reset failed."; exit 1 ;} 56 57 # Clear session keyring 58 # FIXME: It assumes we have only the MMC key there 59 keyctl clear -3 60 61 echo "Password removed." 62} 63 64remove_password || exit $RC 65