From 665c2736c2ca67e28110da12f292c5393eb0e937 Mon Sep 17 00:00:00 2001 From: Rod Widdowson Date: Sun, 30 Sep 2012 18:13:42 +0000 Subject: [PATCH] clear out VBScripts which are no longer used --- msi/scripts/shib_edit_catalog.vbs | 53 -------- msi/scripts/shib_install_isapi_filter.vbs | 172 ------------------------ msi/scripts/shib_keygen.vbs | 17 --- msi/scripts/shib_uninstall_isapi_filter.vbs | 134 ------------------- msi/scripts/shib_uninstall_old_versions.vbs | 199 ---------------------------- msi/scripts/shib_upgrade_check.vbs | 26 ---- 6 files changed, 601 deletions(-) delete mode 100644 msi/scripts/shib_edit_catalog.vbs delete mode 100644 msi/scripts/shib_install_isapi_filter.vbs delete mode 100644 msi/scripts/shib_keygen.vbs delete mode 100644 msi/scripts/shib_uninstall_isapi_filter.vbs delete mode 100644 msi/scripts/shib_uninstall_old_versions.vbs delete mode 100644 msi/scripts/shib_upgrade_check.vbs diff --git a/msi/scripts/shib_edit_catalog.vbs b/msi/scripts/shib_edit_catalog.vbs deleted file mode 100644 index 2b21bf5..0000000 --- a/msi/scripts/shib_edit_catalog.vbs +++ /dev/null @@ -1,53 +0,0 @@ -Function ReadFile( filePath ) - Dim theFile - - 'OpenTextFile args: , 1 = ForReading - 'If you read an empty file, VBScript throws an error for some reason - if (FileSystemObj.FileExists(filePath)) then - Set theFile = FileSystemObj.GetFile(filePath) - if (theFile.size > 0) then - Set theFile = FileSystemObj.OpenTextFile(filePath, 1) - ReadFile = theFile.ReadAll - else - ReadFile = "" - end if - else - ReadFile = "" - end if -End Function - -Sub WriteFile( filePath, contents ) - Dim theFile - - 'OpenTextFile args: , 2 = ForWriting, True = create if not exist - Set theFile = FileSystemObj.OpenTextFile(filePath, 2, True) - theFile.Write contents -End Sub - -Sub ReplaceInFile( filePath, lookForStr, replaceWithStr ) - Dim buffer - - buffer = ReadFile(filePath) - if (buffer <> "") then - buffer = Replace(buffer, lookForStr, replaceWithStr) - WriteFile filePath, buffer - end if -End Sub - - -Dim FileSystemObj, ConfigFile, ConfigFileName, XMLDir, WshShell - -on error resume next -Set FileSystemObj = CreateObject("Scripting.FileSystemObject") -if (Err = 0) then - - 'Get the parameters via CustomActionData - customData = Session.Property("CustomActionData") - msiProperties = split(customData,";@;") - XMLDir = msiProperties(0) ' \programdata\shibboleth\sp\xml\opensaml\ - ConfigFile = msiProperties(1) 'catalog - - ReplaceInFile ConfigFile, "@-PKGXMLDIR-@/", XMLDir - -'Last End If -End If \ No newline at end of file diff --git a/msi/scripts/shib_install_isapi_filter.vbs b/msi/scripts/shib_install_isapi_filter.vbs deleted file mode 100644 index 25e4211..0000000 --- a/msi/scripts/shib_install_isapi_filter.vbs +++ /dev/null @@ -1,172 +0,0 @@ -Dim FiltersObj -Dim FilterObj -Dim LoadOrder -Dim FilterName -Dim FilterPath -Dim FilterDesc -Dim WebObj, WebSite, WebSiteRoot -Dim existsFlag -Dim ScriptMaps -Dim newScriptLine -Dim line, lineArray, lineIndex -Dim WebSvcExts -Dim newWebSvcExtLine -Dim customData, msiProperties, InstallDir, ShibFileExtension - -On Error Resume Next -Set WebObj = GetObject("IIS://LocalHost/W3SVC") -if (Err = 0) then - - 'Get the INSTALLDIR and SHIB_FILE_EXTENSION values via CustomActionData - customData = Session.Property("CustomActionData") - msiProperties = split(customData,";@;") - InstallDir = msiProperties(0) - ShibFileExtension = msiProperties(1) - - 'Remove all trailing backslashes to normalize - do while (mid(InstallDir,Len(InstallDir),1) = "\") - InstallDir = mid(InstallDir,1,Len(InstallDir)-1) - loop - ShibISAPIPath = InstallDir & "\lib\shibboleth\isapi_shib.dll" - 'Make sure ShibFileExtension is in proper format - 'First, strip any preceding periods - do while (mid(ShibFileExtension,1,1) = ".") - ShibFileExtension = mid(ShibFileExtension,2,Len(ShibFileExtension)-1) - loop - 'If there is nothing left (or was nothing to begin with), use the default - if (ShibFileExtension = "") then - ShibFileExtension = ".sso" - else - 'Add preceding period - ShibFileExtension = "." & ShibFileExtension - end if - - 'Specify other ISAPI Filter details - FilterName = "Shibboleth" - FilterPath = ShibISAPIPath - FilterDesc = "" - - Set FiltersObj = GetObject("IIS://LocalHost/W3SVC/Filters") - LoadOrder = FiltersObj.FilterLoadOrder - 'Check to see if 'Shibboleth' is already sequenced - existsFlag = "not_exist" - lineArray = split(LoadOrder, ",") - for each line in lineArray - if (line = FilterName) then - existsFlag = "exists" - end if - next - if (existsFlag = "not_exist") then - If LoadOrder <> "" Then - LoadOrder = LoadOrder & "," - End If - LoadOrder = LoadOrder & FilterName - FiltersObj.FilterLoadOrder = LoadOrder - FiltersObj.SetInfo - else - 'msgbox "Shib Filter already sequenced" - end if - - Set FilterObj = FiltersObj.Create("IIsFilter", FilterName) - If (Err <> 0) then - 'Open existing filter for updating - Err = 0 - Set FilterObj = GetObject("IIS://LocalHost/W3SVC/Filters/" & FilterName) - End If - FilterObj.FilterPath = FilterPath - FilterObj.FilterDescription = FilterDesc - FilterObj.SetInfo - - 'Create file extension mapping to ISAPI filter - newScriptLine = ShibFileExtension & "," & ShibISAPIPath & ",1" - ScriptMaps = WebObj.ScriptMaps - 'Check if exists - existsFlag = "not_exist" - lineIndex = 0 - for each line in ScriptMaps - lineArray = split(line,",") - if (lineArray(0) = ShibFileExtension) then - existsFlag = "exists" - Exit For - end if - lineIndex = lineIndex + 1 - next - if (existsFlag = "not_exist") then - redim preserve ScriptMaps(UBound(ScriptMaps)+1) - ScriptMaps(UBound(ScriptMaps)) = newScriptLine - WebObj.ScriptMaps = ScriptMaps - WebObj.SetInfo - else - 'msgbox ".sso already exists: " & lineIndex - 'We already warned user in dialog that this value would be updated - ScriptMaps(lineIndex) = newScriptLine - WebObj.ScriptMaps = ScriptMaps - WebObj.SetInfo - end if - - 'Create file extension mapping to filter on each web site root - For Each WebSite in WebObj - Set WebSiteRoot = GetObject(WebSite.ADsPath & "/ROOT") - if (Err = 0) then - ScriptMaps = WebSiteRoot.ScriptMaps - 'Check if exists - existsFlag = "not_exist" - lineIndex = 0 - for each line in ScriptMaps - lineArray = split(line,",") - if (lineArray(0) = ShibFileExtension) then - existsFlag = "exists" - Exit For - end if - lineIndex = lineIndex + 1 - next - if (existsFlag = "not_exist") then - redim preserve ScriptMaps(UBound(ScriptMaps)+1) - ScriptMaps(UBound(ScriptMaps)) = newScriptLine - WebSiteRoot.ScriptMaps = ScriptMaps - WebSiteRoot.SetInfo - else - 'msgbox ".sso already exists: " & lineIndex - 'We already warned user in dialog that this value would be updated - ScriptMaps(lineIndex) = newScriptLine - WebSiteRoot.ScriptMaps = ScriptMaps - WebSiteRoot.SetInfo - end if - End If - Next - - - 'Web Services Extension - Err = 0 - WebSvcExts = WebObj.WebSvcExtRestrictionList - if (Err = 0) then - newWebSvcExtLine = "1," & ShibISAPIPath & ",1,ShibGroup,Shibboleth Web Service Extension" - - existsFlag = "not_exist" - lineIndex = 0 - for each line in WebSvcExts - lineArray = split(line,",") - if (lineArray(1) = ShibISAPIPath) then - existsFlag = "exists" - Exit For - end if - lineIndex = lineIndex + 1 - next - - if (existsFlag = "not_exist") then - redim preserve WebSvcExts(UBound(WebSvcExts)+1) - WebSvcExts(UBound(WebSVCExts)) = newWebSvcExtLine - WebObj.WebSvcExtRestrictionList = WebSvcExts - WebObj.SetInfo - else - 'msgbox "Shibboleth Web Services Extension already exists: " & lineIndex - 'We already warned user in dialog that this value would be updated - WebSvcExts(lineIndex) = newWebSvcExtLine - WebObj.WebSvcExtRestrictionList = WebSvcExts - WebObj.SetInfo - end if - - end if - -'final end if -end if \ No newline at end of file diff --git a/msi/scripts/shib_keygen.vbs b/msi/scripts/shib_keygen.vbs deleted file mode 100644 index ccc4a16..0000000 --- a/msi/scripts/shib_keygen.vbs +++ /dev/null @@ -1,17 +0,0 @@ -Dim ConvertedDir, InstallDir, ScriptName, WshShell - -On Error Resume Next -Set WshShell = CreateObject("WScript.Shell") -If (Err = 0) then - 'Get the INSTALLDIR value via CustomActionData - InstallDir = Session.Property("CustomActionData") - - 'Remove all trailing backslashes to normalize - Do While (Mid(InstallDir,Len(InstallDir),1) = "\") - InstallDir = mid(InstallDir,1,Len(InstallDir)-1) - Loop - ConvertedDir = Replace(InstallDir, "\", "/") - ScriptName = ConvertedDir & "\etc\shibboleth\keygen.bat" - - WshShell.Exec(ScriptName) -End If diff --git a/msi/scripts/shib_uninstall_isapi_filter.vbs b/msi/scripts/shib_uninstall_isapi_filter.vbs deleted file mode 100644 index c009e2a..0000000 --- a/msi/scripts/shib_uninstall_isapi_filter.vbs +++ /dev/null @@ -1,134 +0,0 @@ -Sub DeleteISAPIFilters(IISPath,dllPath) - - Dim filter, FiltersObj, LoadOrder, FilterArray, FilterItem - - Set FiltersObj = GetObject(IISPath & "/Filters") - LoadOrder = FiltersObj.FilterLoadOrder - - for each filter in FiltersObj - if (filter.Class = "IIsFilter") then - if (filter.FilterPath = dllPath) then - - 'Delete the found filter here - 'If there's anything to potentially delete... - if (LoadOrder <> "") then - FilterArray = split(LoadOrder,",") - LoadOrder = "" - for each FilterItem in FilterArray - if (FilterItem <> filter.Name) then - LoadOrder = LoadOrder & FilterItem & "," - end if - next - 'Remove trailing comma if any filters were kept - if (LoadOrder <> "") then - LoadOrder = mid(LoadOrder,1,len(LoadOrder)-1) - end if - - 'Set the Load Order to the new shibboleth-less order - if (FiltersObj.FilterLoadOrder <> LoadOrder) then - FiltersObj.FilterLoadOrder = LoadOrder - FiltersObj.SetInfo - end if - end if - - 'Delete the actual IISFilter object - FiltersObj.Delete "IIsFilter",filter.Name - - end if - end if - next - -End Sub - - -Sub DeleteFileExtensions(siteObj, dllPath) - -Dim ScriptMaps, newScriptMaps -Dim line, lineArray, lineIndex -Dim fileExtension -Dim existsFlag - - ScriptMaps = siteObj.ScriptMaps - redim newScriptMaps(0) - lineIndex = 0 - 'copy each entry from the old ScriptMaps to newScriptMaps - 'unless it is for dllPath - for each line in ScriptMaps - lineArray = split(line,",") - if (lineArray(1) <> dllPath) then - redim preserve newScriptMaps(lineIndex) - newScriptMaps(lineIndex) = line - lineIndex = lineIndex + 1 - else - existsFlag = "exists" - end if - next - 'If we found dllPath, then use the newScriptMaps instead - if (existsFlag = "exists") then - siteObj.ScriptMaps = newScriptMaps - siteObj.SetInfo - end if - -End Sub - - -'*** Begin Main Code *** -Dim WebObj -Dim InstallDir -Dim ShibISAPIPath -Dim site, siteObj, sitePath - -' First of all look for the FileExtension -Set WshShell = CreateObject("WScript.Shell") -On Error Resume Next -regValue = WshShell.RegRead("HKLM\SOFTWARE\Shibboleth\FileExtension") -if (Err = 0) then - ' Registry key is still there - this is an upgrade, so exit - -else - ' Key is gone - a pure uninstall - - 'Don't show errors, we'll handle anything important - On Error Resume Next - - 'Attempt to get W3SVC. If failure, end script (e.g. IIS isn't available) - Set WebObj = GetObject("IIS://LocalHost/W3SVC") - if (Err = 0) then - - 'Get the INSTALLDIR value via CustomActionData - InstallDir = Session.Property("CustomActionData") - - 'Remove all trailing backslashes to normalize - do while (mid(InstallDir,Len(InstallDir),1) = "\") - InstallDir = mid(InstallDir,1,Len(InstallDir)-1) - loop - ShibISAPIPath = InstallDir & "\lib\shibboleth\isapi_shib.dll" - - 'Delete ISAPI Filter - 'First do the master service - DeleteISAPIFilters "IIS://LocalHost/W3SVC",ShibISAPIPath - 'Now do the websites - for each site in WebObj - if (site.Class = "IIsWebServer") then - sitePath = "IIS://LocalHost/W3SVC/" & site.Name - DeleteISAPIFilters sitePath,ShibISAPIPath - end if - next - - 'Delete File Extensions - 'First do the master service - DeleteFileExtensions WebObj,ShibISAPIPath - 'Now do the websites - for each site in WebObj - if (site.Class = "IIsWebServer") then - set siteObj = GetObject("IIS://LocalHost/W3SVC/" & site.Name & "/ROOT") - DeleteFileExtensions siteObj,ShibISAPIPath - end if - next - - 'Delete Web Services Extension (universal, no need to do for each site) - WebObj.DeleteExtensionFileRecord ShibISAPIPath - ' Got the IIS Object - End If -' Sense whether this is an upgrade -end if \ No newline at end of file diff --git a/msi/scripts/shib_uninstall_old_versions.vbs b/msi/scripts/shib_uninstall_old_versions.vbs deleted file mode 100644 index 6a7d366..0000000 --- a/msi/scripts/shib_uninstall_old_versions.vbs +++ /dev/null @@ -1,199 +0,0 @@ -'In order to get the list of versions to uninstall during deferred mode, -'We need to set UninstallOldShibVersions property during the Immediate -'Execution sequence. We can then read the value via CustomActionData. -'To accomplish this, create a CA as follows: -' Action: SetShibVersionsImmediate -' Source: UninstallOldShibVersions -' Type: 51 -' Target: [OLDSHIBVERSIONSFOUND] -'Sequence this action near the beginning of InstallExecuteSequence with -' Condition: (NOT Installed) AND (OLDSHIBVERSIONSFOUND <> "") AND (OLDSHIBPERFORMUNINSTALL = "TRUE") - - -'********************************* -'* This code is the entire body of shib_uninstall_isapi_filter.vbs -'* The only exception is that the main function of that code is made -'* a Sub in this code so we can call it, and we pass it the InstallDir -'* from the Uninst.isu string instead of pulling it from the MSI. -'********************************* - -Sub DeleteISAPIFilters(IISPath,dllPath) - - Dim filter, FiltersObj, LoadOrder, FilterArray, FilterItem - - Set FiltersObj = GetObject(IISPath & "/Filters") - LoadOrder = FiltersObj.FilterLoadOrder - - for each filter in FiltersObj - if (filter.Class = "IIsFilter") then - if (filter.FilterPath = dllPath) then - - 'Delete the found filter here - 'If there's anything to potentially delete... - if (LoadOrder <> "") then - FilterArray = split(LoadOrder,",") - LoadOrder = "" - for each FilterItem in FilterArray - if (FilterItem <> filter.Name) then - LoadOrder = LoadOrder & FilterItem & "," - end if - next - 'Remove trailing comma if any filters were kept - if (LoadOrder <> "") then - LoadOrder = mid(LoadOrder,1,len(LoadOrder)-1) - end if - - 'Set the Load Order to the new shibboleth-less order - if (FiltersObj.FilterLoadOrder <> LoadOrder) then - FiltersObj.FilterLoadOrder = LoadOrder - FiltersObj.SetInfo - end if - end if - - 'Delete the actual IISFilter object - FiltersObj.Delete "IIsFilter",filter.Name - - end if - end if - next - -End Sub - - -Sub DeleteFileExtensions(siteObj, dllPath) - -Dim ScriptMaps, newScriptMaps -Dim line, lineArray, lineIndex -Dim fileExtension -Dim existsFlag - - ScriptMaps = siteObj.ScriptMaps - redim newScriptMaps(0) - lineIndex = 0 - 'copy each entry from the old ScriptMaps to newScriptMaps - 'unless it is for dllPath - for each line in ScriptMaps - lineArray = split(line,",") - if (lineArray(1) <> dllPath) then - redim preserve newScriptMaps(lineIndex) - newScriptMaps(lineIndex) = line - lineIndex = lineIndex + 1 - else - existsFlag = "exists" - end if - next - 'If we found dllPath, then use the newScriptMaps instead - if (existsFlag = "exists") then - siteObj.ScriptMaps = newScriptMaps - siteObj.SetInfo - end if - -End Sub - - -Sub CleanUpISAPI(InstallDir) - -Dim WebObj -'Dim InstallDir -Dim ShibISAPIPath -Dim site, siteObj, sitePath - - -'Don't show errors, we'll handle anything important -On Error Resume Next - -'Attempt to get W3SVC. If failure, end script (e.g. IIS isn't available) -Set WebObj = GetObject("IIS://LocalHost/W3SVC") -if (Err = 0) then - - 'Get the INSTALLDIR value via CustomActionData - 'Commented out for embedding in this .vbs, passed instead -' InstallDir = Session.Property("CustomActionData") - - 'Remove all trailing backslashes to normalize - do while (mid(InstallDir,Len(InstallDir),1) = "\") - InstallDir = mid(InstallDir,1,Len(InstallDir)-1) - loop - 'Set dll Path - ShibISAPIPath = InstallDir & "\libexec\isapi_shib.dll" - - 'Delete ISAPI Filter - 'First do the master service - DeleteISAPIFilters "IIS://LocalHost/W3SVC",ShibISAPIPath - 'Now do the websites - for each site in WebObj - if (site.Class = "IIsWebServer") then - sitePath = "IIS://LocalHost/W3SVC/" & site.Name - DeleteISAPIFilters sitePath,ShibISAPIPath - end if - next - - 'Delete File Extensions - 'First do the master service - DeleteFileExtensions WebObj,ShibISAPIPath - 'Now do the websites - for each site in WebObj - if (site.Class = "IIsWebServer") then - set siteObj = GetObject("IIS://LocalHost/W3SVC/" & site.Name & "/ROOT") - DeleteFileExtensions siteObj,ShibISAPIPath - end if - next - - - 'Delete Web Services Extension (universal, no need to do for each site) - WebObj.DeleteExtensionFileRecord ShibISAPIPath - -'Last end if -end if - -End Sub - - -'******** Begin Main Code *************** - -Dim WshShell, WshEnv, versionArray, versionElement, versionNumbers, regValue, UninstallArray, uninstallStr, UninstIsuArray, path, pathArray, NewPathEnv - -on error resume next -Set WshShell = CreateObject("WScript.Shell") - -versionNumbers = Session.Property("CustomActionData") - -versionArray = split( versionNumbers, vbCRLF ) - -for each versionElement in versionArray - if (versionElement<>"") then - - 'if RegRead fails, it won't set regValue, and it will hold the last value instead. Make sure the 'last' value is "" - regValue = "" - on error resume next - regValue=WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & versionElement & "\UninstallString") - if (regValue<>"") then - UninstallArray = split( regValue, " -f") - 'Save off the INSTALLDIR path for later use - UninstIsuArray = split(UninstallArray(1),"Uninst.isu") - InstallDir = UninstIsuArray(0) - - 'Now create the silent uninstall string and execute it - uninstallStr=UninstallArray(0) & " -y -a -f" & UninstallArray(1) - WshShell.Run( uninstallStr ) - - 'Remove entry from path environment variable - Set WshEnv = WshShell.Environment("SYSTEM") - PathEnv = WshEnv("PATH") - NewPathEnv = "" - PathArray = split(PathEnv,";") - for each path in PathArray - if ((path<>InstallDir & "lib\") AND (path<>InstallDir & "lib")) then - NewPathEnv = NewPathEnv & path & ";" - end if - next - NewPathEnv = mid(NewPathEnv,1,len(NewPathEnv)-1) - WshEnv("PATH") = NewPathEnv - - 'Clean up all the ISAPI filters and file extension - CleanUpISAPI InstallDir - - end if - - end if -next \ No newline at end of file diff --git a/msi/scripts/shib_upgrade_check.vbs b/msi/scripts/shib_upgrade_check.vbs deleted file mode 100644 index 427032c..0000000 --- a/msi/scripts/shib_upgrade_check.vbs +++ /dev/null @@ -1,26 +0,0 @@ -Dim WshShell, versionArray, versionElement, versionNumbers, regValue, foundVersionsStr -Set WshShell = CreateObject("WScript.Shell") - -versionNumbers = Session.Property("OLDSHIBVERSIONSTOUNINSTALL") - -versionArray = split( versionNumbers, ";" ) - -foundVersionsStr = "" - -for each versionElement in versionArray - if (versionElement<>"") then - - 'if RegRead fails, it won't set regValue, and it will hold the last value instead. Make sure the 'last' value is "" - regValue = "" - on error resume next - regValue=WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Shibboleth " & versionElement & "\UninstallString") - if (regValue<>"") then - foundVersionsStr = foundVersionsStr & "Shibboleth " & versionElement & vbCRLF - end if - - end if -next - -if (foundVersionsStr<>"") then - Session.Property("OLDSHIBVERSIONSFOUND") = foundVersionsStr -end if \ No newline at end of file -- 2.1.4