From c559cc0ee18702e0d0206dfba19543cdb36915f2 Mon Sep 17 00:00:00 2001 From: Juan Carlos Luciani Date: Fri, 18 May 2007 22:13:32 +0000 Subject: [PATCH] Changed so that Proxy Credentials be deleted when the ATS is disabled. --- .../yast2-casa-ats/src/CasaAts.ycp | 54 +++++++++---------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/CASA-auth-token/yast2-casa-ats/src/CasaAts.ycp b/CASA-auth-token/yast2-casa-ats/src/CasaAts.ycp index f9482ce5..0c524839 100644 --- a/CASA-auth-token/yast2-casa-ats/src/CasaAts.ycp +++ b/CASA-auth-token/yast2-casa-ats/src/CasaAts.ycp @@ -481,15 +481,15 @@ global boolean Write() { SCR::Execute(.target.bash, "/bin/cp "+trustedServerConfigFile+" "+trustedServerConfigFile+".YaST2save"); // Update the trusted server config - any ret = false; + any anyRet = false; list trustedServerList = Settings["CONFIG_CASAATS_TRUSTED"]:[]; string trustedServerListString = ""; if (trustedServerList != []) { // Merge all of the addresses onto the string trustedServerListString = mergestring(trustedServerList, "\n"); } - ret = SCR::Write(.target.string, trustedServerConfigFile, trustedServerListString); - if (ret != true) + anyRet = SCR::Write(.target.string, trustedServerConfigFile, trustedServerListString); + if (anyRet != true) y2error("Failed to write to " + trustedServerConfigFile); // Write the /etc/sysconfig/casa-ats settings @@ -501,15 +501,35 @@ global boolean Write() { if (false) Report::Error (_("Cannot sysconfig settings.")); sleep(sl); + // Try to obtain the uid of casaatsd + string uid = ""; + map ret = (map) SCR::Execute(.target.bash_output, "id -u casaatsd"); + integer exit = ret["exit"]:-1; + if (exit == 0) + { + string cmd_output = ret["stdout"]:""; + list uidComponents = splitstring(cmd_output, "\n"); + uid = uidComponents[0]:""; + y2milestone("casaatsd uid = " + uid); + + // Clear out the credentials that may have been saved in miCASA + // for this user. + string cmd = sformat("CASAcli -r -u %1", uid); + ret = (map) SCR::Execute(.target.bash_output, cmd); + exit = ret["exit"]:-1; + if (exit != 0) + y2error("Failed to remove casaatsd credentials"); + } + // Check if we need to save the server configuration if ((Settings["CONFIG_CASAATS_ENABLE"]:false) == true) { // Create svc.settings file string cmd = "rm -f " + svcSettingsFile; - map ret = (map) SCR::Execute(.target.bash_output, cmd); + ret = (map) SCR::Execute(.target.bash_output, cmd); cmd = svcSettingsEditor + " -create -file " + svcSettingsFile; ret = (map) SCR::Execute(.target.bash_output, cmd); - integer exit = ret["exit"]:-1; + exit = ret["exit"]:-1; if (exit != 0) y2error("Failed to create " + svcSettingsFile); @@ -541,30 +561,6 @@ global boolean Write() { if (exit != 0) y2error("Failed to create " + iaRealmsFile); - // Obtain the uid of casaatsd - string uid = ""; - ret = (map) SCR::Execute(.target.bash_output, "id -u casaatsd"); - exit = ret["exit"]:-1; - if (exit == 0) - { - string cmd_output = ret["stdout"]:""; - list uidComponents = splitstring(cmd_output, "\n"); - uid = uidComponents[0]:""; - y2milestone("casaatsd uid = " + uid); - - // Clear out the credentials that may have been saved in miCASA - // for this user. - cmd = sformat("CASAcli -r -u %1", uid); - ret = (map) SCR::Execute(.target.bash_output, cmd); - exit = ret["exit"]:-1; - if (exit != 0) - y2error("Failed to remove casaatsd credentials"); - } - else - { - y2error("Failed to obtain casaatsd uid"); - } - // Add the real information to auth.policy and iaRealms.xml files map realms = (map) CasaAts::Settings["CONFIG_CASAATS_REALMS"]:$[]; foreach (string key, map realm, realms, {