]> granicus.if.org Git - postgresql/commitdiff
libpq: issue clear error message for nested service files
authorBruce Momjian <bruce@momjian.us>
Wed, 8 Apr 2015 14:26:21 +0000 (10:26 -0400)
committerBruce Momjian <bruce@momjian.us>
Wed, 8 Apr 2015 14:26:58 +0000 (10:26 -0400)
Previously an odd error message was generated.  Nested service files are
not supported.

Report by David Johnston

src/interfaces/libpq/fe-connect.c

index fa8a33f40a713e3b0c2de544a5658efba126f8f5..e7c7a256e63c448410e8fece3a6318b2b9d6a39e 100644 (file)
@@ -4061,6 +4061,16 @@ parseServiceFile(const char *serviceFile,
                                }
                                *val++ = '\0';
 
+                               if (strcmp(key, "service") == 0)
+                               {
+                                       printfPQExpBuffer(errorMessage,
+                                                                         libpq_gettext("nested service specifications not supported in service file \"%s\", line %d\n"),
+                                                                         serviceFile,
+                                                                         linenr);
+                                       fclose(f);
+                                       return 3;
+                               }
+
                                /*
                                 * Set the parameter --- but don't override any previous
                                 * explicit setting.