Package ghidra.features.bsim.query
Class ServerConfig
java.lang.Object
ghidra.features.bsim.query.ServerConfig
Class for modifying the PostgreSQL configuration files describing
   the main server settings (postgresql.conf)
   the connection settings  (pg_hba.conf)
   the identification map   (pg_ident.conf)
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd a key/value pair directly into the configuration fileRetrieve the value associated with a particular key from a (parsed) configuration filevoidpatchConfig(File inFile, File outFile) Given a set of key/value pairs, established via restoreXml or manually entered via addKey, read in an existing configuration file, and write out an altered form, where: 1) Keys matching something in the keyValue map have their value altered to match the map 2) Keys that don't match anything in the map, are output unaltered 3) Comments, both entire line and those coming after key/value pairs, are preservedvoidpatchConnect(File inFile, File outFile) Read in a connection file and write out an altered version of the file where: 1) Any entry that matches something in connectSet, has its authentication method altered 2) Any entry that does not match into connectSet is commented out in the output 3) Entire line comments are preservedstatic voidpatchIdent(File inFile, File outFile, String mapName, String systemName, String roleName, boolean addUser) Add/remove an identify entry to pg_ident.confvoidrestoreXml(XmlPullParser parser) Read a set of key/value pairs and connection entries to use for patching, from an XML filevoidscanConfig(File inFile) Parse a configuration filevoidscanConnect(File inFile) Read in all the entries of the connection filevoidsetHostAuthentication(String val, String options) voidsetLocalAuthentication(String val, String options) 
- 
Constructor Details- 
ServerConfigpublic ServerConfig()
 
- 
- 
Method Details- 
restoreXmlRead a set of key/value pairs and connection entries to use for patching, from an XML file- Parameters:
- parser- the XML parser
 
- 
patchConfigGiven a set of key/value pairs, established via restoreXml or manually entered via addKey, read in an existing configuration file, and write out an altered form, where: 1) Keys matching something in the keyValue map have their value altered to match the map 2) Keys that don't match anything in the map, are output unaltered 3) Comments, both entire line and those coming after key/value pairs, are preserved- Parameters:
- inFile- the file to read
- outFile- the new file to write
- Throws:
- IOException- if the files cannot be read from or written to
 
- 
patchConnectRead in a connection file and write out an altered version of the file where: 1) Any entry that matches something in connectSet, has its authentication method altered 2) Any entry that does not match into connectSet is commented out in the output 3) Entire line comments are preserved- Parameters:
- inFile- the file to read
- outFile- the new file to write
- Throws:
- IOException- if the files cannot be read from or written to
 
- 
patchIdentpublic static void patchIdent(File inFile, File outFile, String mapName, String systemName, String roleName, boolean addUser) throws IOException Add/remove an identify entry to pg_ident.conf- Parameters:
- inFile- is a copy of pg_ident.conf to modify
- outFile- becomes the modified copy of pg_ident.conf
- mapName- is the map being modified
- systemName- is the system name (map from)
- roleName- is the database role (map to)
- addUser- is true if the map entry is to be added, false if the entry should be removed
- Throws:
- IOException- if the file cannot be read from or written to
 
- 
addKeyAdd a key/value pair directly into the configuration file- Parameters:
- key- the key to add/update
- value- the value to insert
 
- 
getValueRetrieve the value associated with a particular key from a (parsed) configuration file- Parameters:
- key- identifies the value to return
- Returns:
- the value
 
- 
scanConfigParse a configuration file- Parameters:
- inFile- is the path to the file
- Throws:
- IOException- if the file cannot be read
 
- 
scanConnectRead in all the entries of the connection file- Parameters:
- inFile- the file to read in
- Throws:
- IOException- if the file cannot be read/parsed
 
- 
getLocalAuthentication
- 
setLocalAuthentication
- 
getHostAuthentication
- 
setHostAuthentication
 
-