{"record":{"id":"4d66a3c45abb0116","repo":"NationalSecurityAgency/ghidra","slug":"entry-missing-ending-quote-in-pg-ident-conf","errorCode":null,"errorMessage":"Entry missing ending quote in pg_ident.conf","messagePattern":"Entry missing ending quote in pg_ident\\.conf","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ServerConfig.java","lineNumber":394,"sourceCode":"\t\t\t}\n\t\t\tif (line.charAt(pos) == '\"') {\n\t\t\t\tthrow new IOException(\"Bad map field in pg_ident.conf entry\");\n\t\t\t}\n\t\t\tif (line.charAt(pos) == '#') {\n\t\t\t\treturn false;\t\t\t// Return false to indicate comment\n\t\t\t}\n\t\t\tint endpos = parseField(pos, line);\n\t\t\tmapName = line.substring(pos, endpos);\n\n\t\t\tpos = skipWhiteSpace(endpos, line);\n\t\t\tif (pos >= line.length()) {\n\t\t\t\tthrow new IOException(\"Missing system-name in pg_ident.conf entry\");\n\t\t\t}\n\t\t\telse if (line.charAt(pos) == '\"') {\n\t\t\t\tsystemNameIsQuoted = true;\n\t\t\t\tendpos = parseDoubleQuote(pos, line);\n\t\t\t\tif (line.charAt(endpos - 1) != '\"') {\n\t\t\t\t\tthrow new IOException(\"Entry missing ending quote in pg_ident.conf\");\n\t\t\t\t}\n\t\t\t\tsystemName = line.substring(pos + 1, endpos - 1);\t\t// Strip quotes\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsystemNameIsQuoted = false;\n\t\t\t\tendpos = parseField(pos, line);\n\t\t\t\tsystemName = line.substring(pos, endpos);\n\t\t\t}\n\n\t\t\tpos = skipWhiteSpace(endpos, line);\n\t\t\tif (pos >= line.length()) {\n\t\t\t\tthrow new IOException(\"Missing role in pg_ident.conf entry\");\n\t\t\t}\n\t\t\telse if (line.charAt(pos) == '\"') {\n\t\t\t\troleNameIsQuoted = true;\n\t\t\t\tendpos = parseDoubleQuote(pos, line);\n\t\t\t\tif (line.charAt(endpos - 1) != '\"') {\n\t\t\t\t\tthrow new IOException(\"Entry missing ending quote in pg_ident.conf\");","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ServerConfig.java#L376-L412","documentation":"Thrown by ServerConfig.IdentEntry.parse when the system-name field is quoted (starts with '\"') but the closing quote is missing. parseDoubleQuote scans to end-of-line; if the last character is not a quote, the entry is malformed. Quoting is allowed on the system-name field only when properly closed.","triggerScenarios":"Parsing a pg_ident.conf line where the system-name begins with '\"' but has no matching closing '\"', e.g. 'mymap \"myuser myrole' or 'mymap \"myuser'.","commonSituations":"Hand-editing pg_ident.conf and forgetting the closing quote. A field with an embedded space was quoted but the quote was accidentally deleted. Encoding/copy issues that dropped a character.","solutions":["Add the missing closing double-quote to the system-name field.","If the field has no embedded spaces, remove the opening quote and use an unquoted token instead.","Validate quoted fields are balanced before saving the file."],"exampleFix":"// before (pg_ident.conf line)\nmymap   \"my user   myrole\n// after\nmymap   \"my user\"   myrole","handlingStrategy":"validation","validationCode":"// Check that a quoted system-name field is properly closed\nString[] parts = line.trim().split(\"\\\\s+\", 3);\nif (parts.length >= 2 && parts[1].startsWith(\"\\\"\")) {\n    // count quotes in the system-name token region; must be even\n    String sysField = parts[1];\n    if (!sysField.endsWith(\"\\\"\") || sysField.length() < 2) {\n        throw new IllegalArgumentException(\n            \"pg_ident.conf system-name quoted field missing closing quote: \" + line);\n    }\n}\nidentEntry.parse(line);","typeGuard":null,"tryCatchPattern":"try {\n    identEntry.parse(line);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"missing ending quote\")) {\n        log.error(\"pg_ident.conf quoted field is missing its closing quote: '{}'\", line);\n    }\n    throw e;\n}","preventionTips":["Always close quoted fields in pg_ident.conf.","Prefer unquoted tokens when the value has no embedded spaces.","Lint the file for balanced double-quotes."],"tags":["bsim","server-config","config-parsing","postgresql","pg-ident"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}