@@ -2800,7 +2800,7 @@ parse_ident_line(TokenizedAuthLine *tok_line, int elevel)
2800
2800
tokens = lfirst (field );
2801
2801
IDENT_MULTI_VALUE (tokens );
2802
2802
token = linitial (tokens );
2803
- parsedline -> pg_user = pstrdup (token -> string );
2803
+ parsedline -> pg_user = copy_auth_token (token );
2804
2804
2805
2805
/*
2806
2806
* Now that the field validation is done, compile a regex from the user
@@ -2865,7 +2865,7 @@ check_ident_usermap(IdentLine *identLine, const char *usermap_name,
2865
2865
return ;
2866
2866
}
2867
2867
2868
- if ((ofs = strstr (identLine -> pg_user , "\\1" )) != NULL )
2868
+ if ((ofs = strstr (identLine -> pg_user -> string , "\\1" )) != NULL )
2869
2869
{
2870
2870
int offset ;
2871
2871
@@ -2875,7 +2875,7 @@ check_ident_usermap(IdentLine *identLine, const char *usermap_name,
2875
2875
ereport (LOG ,
2876
2876
(errcode (ERRCODE_INVALID_REGULAR_EXPRESSION ),
2877
2877
errmsg ("regular expression \"%s\" has no subexpressions as requested by backreference in \"%s\"" ,
2878
- identLine -> system_user -> string + 1 , identLine -> pg_user )));
2878
+ identLine -> system_user -> string + 1 , identLine -> pg_user -> string )));
2879
2879
* error_p = true;
2880
2880
return ;
2881
2881
}
@@ -2884,9 +2884,9 @@ check_ident_usermap(IdentLine *identLine, const char *usermap_name,
2884
2884
* length: original length minus length of \1 plus length of match
2885
2885
* plus null terminator
2886
2886
*/
2887
- expanded_pg_user = palloc0 (strlen (identLine -> pg_user ) - 2 + (matches [1 ].rm_eo - matches [1 ].rm_so ) + 1 );
2888
- offset = ofs - identLine -> pg_user ;
2889
- memcpy (expanded_pg_user , identLine -> pg_user , offset );
2887
+ expanded_pg_user = palloc0 (strlen (identLine -> pg_user -> string ) - 2 + (matches [1 ].rm_eo - matches [1 ].rm_so ) + 1 );
2888
+ offset = ofs - identLine -> pg_user -> string ;
2889
+ memcpy (expanded_pg_user , identLine -> pg_user -> string , offset );
2890
2890
memcpy (expanded_pg_user + offset ,
2891
2891
system_user + matches [1 ].rm_so ,
2892
2892
matches [1 ].rm_eo - matches [1 ].rm_so );
@@ -2895,7 +2895,7 @@ check_ident_usermap(IdentLine *identLine, const char *usermap_name,
2895
2895
else
2896
2896
{
2897
2897
/* no substitution, so copy the match */
2898
- expanded_pg_user = pstrdup (identLine -> pg_user );
2898
+ expanded_pg_user = pstrdup (identLine -> pg_user -> string );
2899
2899
}
2900
2900
2901
2901
/*
@@ -2921,13 +2921,13 @@ check_ident_usermap(IdentLine *identLine, const char *usermap_name,
2921
2921
/* Not regular expression, so make complete match */
2922
2922
if (case_insensitive )
2923
2923
{
2924
- if (pg_strcasecmp (identLine -> pg_user , pg_user ) == 0 &&
2924
+ if (pg_strcasecmp (identLine -> pg_user -> string , pg_user ) == 0 &&
2925
2925
pg_strcasecmp (identLine -> system_user -> string , system_user ) == 0 )
2926
2926
* found_p = true;
2927
2927
}
2928
2928
else
2929
2929
{
2930
- if (strcmp (identLine -> pg_user , pg_user ) == 0 &&
2930
+ if (strcmp (identLine -> pg_user -> string , pg_user ) == 0 &&
2931
2931
strcmp (identLine -> system_user -> string , system_user ) == 0 )
2932
2932
* found_p = true;
2933
2933
}
@@ -3074,6 +3074,7 @@ load_ident(void)
3074
3074
{
3075
3075
newline = (IdentLine * ) lfirst (parsed_line_cell );
3076
3076
free_auth_token (newline -> system_user );
3077
+ free_auth_token (newline -> pg_user );
3077
3078
}
3078
3079
MemoryContextDelete (ident_context );
3079
3080
return false;
@@ -3086,6 +3087,7 @@ load_ident(void)
3086
3087
{
3087
3088
newline = (IdentLine * ) lfirst (parsed_line_cell );
3088
3089
free_auth_token (newline -> system_user );
3090
+ free_auth_token (newline -> pg_user );
3089
3091
}
3090
3092
}
3091
3093
if (parsed_ident_context != NULL )
0 commit comments