]> granicus.if.org Git - pgbouncer/commitdiff
When auth_mode=any, allow anybody in as admin.
authorMarko Kreen <markokr@gmail.com>
Mon, 6 Jul 2009 13:10:11 +0000 (13:10 +0000)
committerMarko Kreen <markokr@gmail.com>
Mon, 6 Jul 2009 13:10:11 +0000 (13:10 +0000)
Because auth_mode=any does not store original username,
the usual username based checks (admin_users/stats_users)
do not work.

src/admin.c

index ae15c760c9e95f0759c4ec56197059f1e63f6979..25e0d47b364a10dc54b6d5030c80f64be26d6ad0 100644 (file)
@@ -1109,6 +1109,17 @@ bool admin_pre_login(PgSocket *client)
                }
        }
 
+       /*
+        * auth_mode=any does not keep original username around,
+        * so username based checks do not work.
+        */
+       if (cf_auth_type == AUTH_ANY) {
+               if (cf_log_connections)
+                       slog_info(client, "auth_mode=any: allowing anybody in as admin");
+               client->admin_user = 1;
+               return true;
+       }
+
        if (strlist_contains(cf_admin_users, username)) {
                client->admin_user = 1;
                return true;