{"record":{"id":"e8892f02ff9a8b9f","repo":"NationalSecurityAgency/ghidra","slug":"bad-map-field-in-pg-ident-conf-entry","errorCode":null,"errorMessage":"Bad map field in pg_ident.conf entry","messagePattern":"Bad map field in pg_ident\\.conf entry","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ServerConfig.java","lineNumber":378,"sourceCode":"\t\tpublic boolean matchRole(String mName, String rName) {\n\t\t\treturn mapName.equals(mName) && roleName.equals(rName);\n\t\t}\n\n\t\t/**\n\t\t * Parse a single line from the pg_ident.conf file and recover the\n\t\t * map name, system name, and role\n\t\t * @param line is the incoming of text\n\t\t * @return true if the line is an ident entry, false if it is a comment\n\t\t * @throws IOException if the text cannot be parsed\n\t\t */\n\t\tpublic boolean parse(String line) throws IOException {\n\t\t\tint pos = 0;\n\t\t\tpos = skipWhiteSpace(pos, line);\n\t\t\tif (pos >= line.length()) {\n\t\t\t\treturn false;\t\t\t// Blank line, treat as comment\n\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","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ServerConfig.java#L360-L396","documentation":"Thrown by ServerConfig.IdentEntry.parse when the first non-whitespace character of a pg_ident.conf line is a double-quote. The map-name field must be an unquoted token; a leading quote is treated as malformed because the parser expects a bare map name here.","triggerScenarios":"Parsing a pg_ident.conf entry line whose map-name field begins with '\"' (e.g. '\"mymap\" system user'). The parser rejects quoting on the first field.","commonSituations":"Over-quoting fields when editing pg_ident.conf by hand. Copying a quoted format from another config style into pg_ident.conf. Misunderstanding which fields may be quoted in this file.","solutions":["Remove the leading quote from the map-name field; the map name must be an unquoted token.","Use the form: mapname systemname username (only system-name and role may be quoted if they contain spaces).","Validate that the first field does not start with '\"' before saving the file."],"exampleFix":"// before (pg_ident.conf line)\n\"mymap\"   myuser   myrole\n// after\nmymap   myuser   myrole","handlingStrategy":"validation","validationCode":"// Reject a quoted map-name before parsing pg_ident.conf entry\nString trimmed = line.trim();\nint i = 0;\nwhile (i < trimmed.length() && Character.isWhitespace(trimmed.charAt(i))) i++;\nif (i < trimmed.length() && trimmed.charAt(i) == '\"') {\n    throw new IllegalArgumentException(\n        \"pg_ident.conf map-name must be unquoted: \" + line);\n}\nidentEntry.parse(line);","typeGuard":null,"tryCatchPattern":"try {\n    identEntry.parse(line);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"Bad map field\")) {\n        log.error(\"pg_ident.conf map-name must not be quoted: '{}'\", line);\n    }\n    throw e;\n}","preventionTips":["Keep the map-name field in pg_ident.conf as a bare unquoted token.","Only the system-name and role fields may be quoted (and only when they contain spaces).","Lint pg_ident.conf entries for unexpected leading 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"}