8000 Add a test using ldapbindpasswd in pg_hba.conf · postgres/postgres@8f6577c · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"commit":{"oid":"8f6577c06a8437f6b8a371f29cb613708f91b094","url":"/postgres/postgres/commit/8f6577c06a8437f6b8a371f29cb613708f91b094","authoredDate":"2023-01-23T08:40:18.000-05:00","committedDate":"2024-04-07T21:08:38.000Z","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eAdd a test using ldapbindpasswd in pg_hba.conf\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"This feature has not been covered in tests up to now.\n\nJohn Naylor and Andrew Dunstan\n\nDiscussion: \u003ca href=\"https://postgr.es/m/06005bfb-0fd7-9d08-e0e5-440f277b73b4@dunslane.net\" rel=\"nofollow\"\u003ehttps://postgr.es/m/06005bfb-0fd7-9d08-e0e5-440f277b73b4@dunslane.net\u003c/a\u003e","authors":[{"login":"adunstan","displayName":"Andrew Dunstan","avatarUrl":"https://avatars.githubusercontent.com/u/241593?v=4","path":"/adunstan","isGitHub":false}],"committerAttribution":true,"committer":{"login":"pull[bot]","displayName":"pull[bot]","avatarUrl":"https://avatars.githubusercontent.com/in/12910?v=4","path":"/apps/pull","isGitHub":false},"pusher":null,"pushedDate":null,"parents":["17da09311bddd68d8a596fae5cc38e91617fe389"],"globalRelayId":"C_kwDOAA4m0toAKDhmNjU3N2MwNmE4NDM3ZjZiOGEzNzFmMjljYjYxMzcwOGY5MWIwOTQ","sha1":"17da09311bddd68d8a596fae5cc38e91617fe389","sha2":"8f6577c06a8437f6b8a371f29cb613708f91b094"},"currentUser":null,"repo":{"id":927442,"defaultBranch":"master","name":"postgres","ownerLogin":"postgres","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2010-09-21T11:35:45.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/177543?v=4","public":true,"private":false,"isOrgOwned":true},"diffEntryData":[{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":6,"text":"@@ -7,6 +7,7 @@ tests += {","html":"@@ -7,6 +7,7 @@ tests += {","displayNoNewLineWarning":false,"position":0,"left":6,"right":6},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":7,"text":" 'tap': {","html":" \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003etap\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e: {","displayNoNewLineWarning":false,"position":1,"left":7,"right":7},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":8,"text":" 'tests': [","html":" \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003etests\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e: [","displayNoNewLineWarning":false,"position":2,"left":8,"right":8},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":9,"text":" 't/001_auth.pl',","html":" \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003et/001_auth.pl\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e,","displayNoNewLineWarning":false,"position":3,"left":9,"right":9},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":10,"text":"+ 't/002_bindpasswd.pl',","html":"+ \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003et/002_bindpasswd.pl\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e,","displayNoNewLineWarning":false,"position":4,"left":9,"right":10},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":11,"text":" ],","html":" ],","displayNoNewLineWarning":false,"position":5,"left":10,"right":11},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":12,"text":" 'env': {","html":" \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eenv\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e: {","displayNoNewLineWarning":false,"position":6,"left":11,"right":12},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":13,"text":" 'with_ldap': ldap.found() ? 'yes' : 'no',","html":" \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003ewith_ldap\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e: ldap.found() ? \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eyes\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e : \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eno\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e,","displayNoNewLineWarning":false,"position":7,"left":12,"right":13}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":16,"linesChanged":1,"newTreeEntry":{"lineCount":16,"path":"src/test/ldap/meson.build","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/test/ldap/meson.build","mode":100644},"linesAdded":1,"linesDeleted":0,"path":"src/test/ldap/meson.build","pathDigest":"dae2d3268e33305c711ac68f166851971ff00d340244c82ae7bd55f14366eafb","status":"MODIFIED","truncatedReason":null,"oldOid":"17da09311bddd68d8a596fae5cc38e91617fe389","newOid":"8f6577c06a8437f6b8a371f29cb613708f91b094","copilotChatReference":null,"deletedSha":"17da09311bddd68d8a596fae5cc38e91617fe389","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":0,"text":"@@ -0,0 +1,95 @@","html":"@@ -0,0 +1,95 @@","displayNoNewLineWarning":false,"position":0,"left":null,"right":0},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1,"text":"+","html":"+","displayNoNewLineWarning":false,"position":1,"left":null,"right":1},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":2,"text":"+# Copyright (c) 2023, PostgreSQL Global Development Group","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e Copyright (c) 2023, PostgreSQL Global Development Group\u003c/span\u003e","displayNoNewLineWarning":false,"position":2,"left":null,"right":2},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":3,"text":"+","html":"+","displayNoNewLineWarning":false,"position":3,"left":null,"right":3},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":4,"text":"+use strict;","html":"+\u003cspan class=\"pl-k\"\u003euse\u003c/span\u003e strict;","displayNoNewLineWarning":false,"position":4,"left":null,"right":4},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":5,"text":"+use warnings;","html":"+\u003cspan class=\"pl-k\"\u003euse\u003c/span\u003e warnings;","displayNoNewLineWarning":false,"position":5,"left":null,"right":5},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":6,"text":"+","html":"+","displayNoNewLineWarning":false,"position":6,"left":null,"right":6},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":7,"text":"+use FindBin;","html":"+\u003cspan class=\"pl-k\"\u003euse\u003c/span\u003e FindBin;","displayNoNewLineWarning":false,"position":7,"left":null,"right":7},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":8,"text":"+use lib \"$FindBin::RealBin/..\";","html":"+\u003cspan class=\"pl-k\"\u003euse\u003c/span\u003e lib \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003cspan class=\"pl-smi\"\u003e$FindBin::RealBin\u003c/span\u003e/..\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":8,"left":null,"right":8},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":9,"text":"+","html":"+","displayNoNewLineWarning":false,"position":9,"left":null,"right":9},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":10,"text":"+use File::Copy;","html":"+\u003cspan class=\"pl-k\"\u003euse\u003c/span\u003e File::Copy;","displayNoNewLineWarning":false,"position":10,"left":null,"right":10},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":11,"text":"+use File::Basename;","html":"+\u003cspan class=\"pl-k\"\u003euse\u003c/span\u003e File::Basename;","displayNoNewLineWarning":false,"position":11,"left":null,"right":11},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":12,"text":"+use LdapServer;","html":"+\u003cspan class=\"pl-k\"\u003euse\u003c/span\u003e LdapServer;","displayNoNewLineWarning":false,"position":12,"left":null,"right":12},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":13,"text":"+use PostgreSQL::Test::Utils;","html":"+\u003cspan class=\"pl-k\"\u003euse\u003c/span\u003e PostgreSQL::Test::Utils;","displayNoNewLineWarning":false,"position":13,"left":null,"right":13},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":14,"text":"+use PostgreSQL::Test::Cluster;","html":"+\u003cspan class=\"pl-k\"\u003euse\u003c/span\u003e PostgreSQL::Test::Cluster;","displayNoNewLineWarning":false,"position":14,"left":null,"right":14},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":15,"text":"+use Test::More;","html":"+\u003cspan class=\"pl-k\"\u003euse\u003c/span\u003e Test::More;","displayNoNewLineWarning":false,"position":15,"left":null,"right":15},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":16,"text":"+","html":"+","displayNoNewLineWarning":false,"position":16,"left":null,"right":16},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":17,"text":"+if ($ENV{with_ldap} ne 'yes')","html":"+\u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (\u003cspan class=\"pl-smi\"\u003e$ENV\u003c/span\u003e{\u003cspan class=\"pl-c1\"\u003ewith_ldap\u003c/span\u003e} \u003cspan class=\"pl-c1\"\u003ene\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eyes\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e)","displayNoNewLineWarning":false,"position":17,"left":null,"right":17},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":18,"text":"+{","html":"+{","displayNoNewLineWarning":false,"position":18,"left":null,"right":18},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":19,"text":"+\tplan skip_all =\u003e 'LDAP not supported by this build';","html":"+\tplan \u003cspan class=\"pl-c1\"\u003eskip_all\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e=\u0026gt;\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eLDAP not supported by this build\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":19,"left":null,"right":19},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":20,"text":"+}","html":"+}","displayNoNewLineWarning":false,"position":20,"left":null,"right":20},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":21,"text":"+elsif ($ENV{PG_TEST_EXTRA} !~ /\\bldap\\b/)","html":"+\u003cspan class=\"pl-k\"\u003eelsif\u003c/span\u003e (\u003cspan class=\"pl-smi\"\u003e$ENV\u003c/span\u003e{\u003cspan class=\"pl-c1\"\u003ePG_TEST_EXTRA\u003c/span\u003e} !~ \u003cspan class=\"pl-sr\"\u003e\u003cspan class=\"pl-pds\"\u003e/\u003c/span\u003e\u003cspan class=\"pl-cce\"\u003e\\b\u003c/span\u003eldap\u003cspan class=\"pl-cce\"\u003e\\b\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e/\u003c/span\u003e\u003c/span\u003e)","displayNoNewLineWarning":false,"position":21,"left":null,"right":21},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":22,"text":"+{","html":"+{","displayNoNewLineWarning":false,"position":22,"left":null,"right":22},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":23,"text":"+\tplan skip_all =\u003e","html":"+\tplan \u003cspan class=\"pl-c1\"\u003eskip_all\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e=\u0026gt;\u003c/span\u003e","displayNoNewLineWarning":false,"position":23,"left":null,"right":23},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":24,"text":"+\t 'Potentially unsafe test LDAP not enabled in PG_TEST_EXTRA';","html":"+\t \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003ePotentially unsafe test LDAP not enabled in PG_TEST_EXTRA\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":24,"left":null,"right":24},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":25,"text":"+}","html":"+}","displayNoNewLineWarning":false,"position":25,"left":null,"right":25},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":26,"text":"+elsif (!$LdapServer::setup)","html":"+\u003cspan class=\"pl-k\"\u003eelsif\u003c/span\u003e (!\u003cspan class=\"pl-smi\"\u003e$LdapServer::setup\u003c/span\u003e)","displayNoNewLineWarning":false,"position":26,"left":null,"right":26},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":27,"text":"+{","html":"+{","displayNoNewLineWarning":false,"position":27,"left":null,"right":27},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":28,"text":"+\tplan skip_all =\u003e","html":"+\tplan \u003cspan class=\"pl-c1\"\u003eskip_all\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e=\u0026gt;\u003c/span\u003e","displayNoNewLineWarning":false,"position":28,"left":null,"right":28},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":29,"text":"+\t \"ldap tests not supported on $^O or dependencies not installed\";","html":"+\t \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003eldap tests not supported on $^O or dependencies not installed\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":29,"left":null,"right":29},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":30,"text":"+}","html":"+}","displayNoNewLineWarning":false,"position":30,"left":null,"right":30},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":31,"text":"+","html":"+","displayNoNewLineWarning":false,"position":31,"left":null,"right":31},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":32,"text":"+note \"setting up LDAP server\";","html":"+note \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003esetting up LDAP server\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":32,"left":null,"right":32},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":33,"text":"+","html":"+","displayNoNewLineWarning":false,"position":33,"left":null,"right":33},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":34,"text":"+my $ldap_rootpw = 'secret';","html":"+\u003cspan class=\"pl-k\"\u003emy\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003e$ldap_rootpw\u003c/span\u003e = \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003esecret\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":34,"left":null,"right":34},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":35,"text":"+my $ldap = LdapServer-\u003enew($ldap_rootpw, 'users'); # no anonymous auth","html":"+\u003cspan class=\"pl-k\"\u003emy\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003e$ldap\u003c/span\u003e = LdapServer\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003enew(\u003cspan class=\"pl-smi\"\u003e$ldap_rootpw\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eusers\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e no anonymous auth\u003c/span\u003e","displayNoNewLineWarning":false,"position":35,"left":null,"right":35},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":36,"text":"+$ldap-\u003eldapadd_file('authdata.ldif');","html":"+\u003cspan class=\"pl-smi\"\u003e$ldap\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003eldapadd_file(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eauthdata.ldif\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e);","displayNoNewLineWarning":false,"position":36,"left":null,"right":36},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":37,"text":"+$ldap-\u003eldapsetpw('uid=test1,dc=example,dc=net', 'secret1');","html":"+\u003cspan class=\"pl-smi\"\u003e$ldap\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003eldapsetpw(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003euid=test1,dc=example,dc=net\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003esecret1\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e);","displayNoNewLineWarning":false,"position":37,"left":null,"right":37},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":38,"text":"+$ldap-\u003eldapsetpw('uid=test2,dc=example,dc=net', 'secret2');","html":"+\u003cspan class=\"pl-smi\"\u003e$ldap\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003eldapsetpw(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003euid=test2,dc=example,dc=net\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003esecret2\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e);","displayNoNewLineWarning":false,"position":38,"left":null,"right":38},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":39,"text":"+","html":"+","displayNoNewLineWarning":false,"position":39,"left":null,"right":39},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":40,"text":"+my ($ldap_server, $ldap_port, $ldap_basedn, $ldap_rootdn) =","html":"+\u003cspan class=\"pl-k\"\u003emy\u003c/span\u003e (\u003cspan class=\"pl-smi\"\u003e$ldap_server\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003e$ldap_port\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003e$ldap_basedn\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003e$ldap_rootdn\u003c/span\u003e) =","displayNoNewLineWarning":false,"position":40,"left":null,"right":40},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":41,"text":"+ $ldap-\u003eprop(qw(server port basedn rootdn));","html":"+ \u003cspan class=\"pl-smi\"\u003e$ldap\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003eprop(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003eqw(\u003c/span\u003eserver port basedn rootdn\u003cspan class=\"pl-pds\"\u003e)\u003c/span\u003e\u003c/span\u003e);","displayNoNewLineWarning":false,"position":41,"left":null,"right":41},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":42,"text":"+","html":"+","displayNoNewLineWarning":false,"position":42,"left":null,"right":42},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":43,"text":"+note \"setting up PostgreSQL instance\";","html":"+note \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003esetting up PostgreSQL instance\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":43,"left":null,"right":43},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":44,"text":"+","html":"+","displayNoNewLineWarning":false,"position":44,"left":null,"right":44},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":45,"text":"+my $node = PostgreSQL::Test::Cluster-\u003enew('node');","html":"+\u003cspan class=\"pl-k\"\u003emy\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e = PostgreSQL::Test::Cluster\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003enew(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003enode\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e);","displayNoNewLineWarning":false,"position":45,"left":null,"right":45},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":46,"text":"+$node-\u003einit;","html":"+\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003einit;","displayNoNewLineWarning":false,"position":46,"left":null,"right":46},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":47,"text":"+$node-\u003eappend_conf('postgresql.conf', \"log_connections = on\\n\");","html":"+\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003eappend_conf(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003epostgresql.conf\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003elog_connections = on\u003cspan class=\"pl-cce\"\u003e\\n\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e);","displayNoNewLineWarning":false,"position":47,"left":null,"right":47},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":48,"text":"+$node-\u003estart;","html":"+\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003estart;","displayNoNewLineWarning":false,"position":48,"left":null,"right":48},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":49,"text":"+","html":"+","displayNoNewLineWarning":false,"position":49,"left":null,"right":49},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":50,"text":"+$node-\u003esafe_psql('postgres', 'CREATE USER test0;');","html":"+\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003esafe_psql(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003epostgres\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eCREATE USER test0;\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e);","displayNoNewLineWarning":false,"position":50,"left":null,"right":50},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":51,"text":"+$node-\u003esafe_psql('postgres', 'CREATE USER test1;');","html":"+\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003esafe_psql(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003epostgres\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eCREATE USER test1;\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e);","displayNoNewLineWarning":false,"position":51,"left":null,"right":51},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":52,"text":"+$node-\u003esafe_psql('postgres', 'CREATE USER \"test2@example.net\";');","html":"+\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003esafe_psql(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003epostgres\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003eCREATE USER \u0026quot;test2@example.net\u0026quot;;\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e);","displayNoNewLineWarning":false,"position":52,"left":null,"right":52},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":53,"text":"+","html":"+","displayNoNewLineWarning":false,"position":53,"left":null,"right":53},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":54,"text":"+note \"running tests\";","html":"+note \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003erunning tests\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":54,"left":null,"right":54},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":55,"text":"+","html":"+","displayNoNewLineWarning":false,"position":55,"left":null,"right":55},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":56,"text":"+sub test_access","html":"+\u003cspan class=\"pl-k\"\u003esub\u003c/span\u003e \u003cspan class=\"pl-en\"\u003etest_access\u003c/span\u003e","displayNoNewLineWarning":false,"position":56,"left":null,"right":56},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":57,"text":"+{","html":"+{","displayNoNewLineWarning":false,"position":57,"left":null,"right":57},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":58,"text":"+\tlocal $Test::Builder::Level = $Test::Builder::Level + 1;","html":"+\t\u003cspan class=\"pl-k\"\u003elocal\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003e$Test::Builder::Level\u003c/span\u003e = \u003cspan class=\"pl-smi\"\u003e$Test::Builder::Level\u003c/span\u003e + 1;","displayNoNewLineWarning":false,"position":58,"left":null,"right":58},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":59,"text":"+","html":"+","displayNoNewLineWarning":false,"position":59,"left":null,"right":59},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":60,"text":"+\tmy ($node, $role, $expected_res, $test_name, %params) = @_;","html":"+\t\u003cspan class=\"pl-k\"\u003emy\u003c/span\u003e (\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003e$role\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003e$expected_res\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003e$test_name\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003e%params\u003c/span\u003e) = \u003cspan class=\"pl-smi\"\u003e@_\u003c/span\u003e;","displayNoNewLineWarning":false,"position":60,"left":null,"right":60},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":61,"text":"+\tmy $connstr = \"user=$role\";","html":"+\t\u003cspan class=\"pl-k\"\u003emy\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003e$connstr\u003c/span\u003e = \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003euser=\u003cspan class=\"pl-smi\"\u003e$role\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":61,"left":null,"right":61},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":62,"text":"+","html":"+","displayNoNewLineWarning":false,"position":62,"left":null,"right":62},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":63,"text":"+\tif ($expected_res eq 0)","html":"+\t\u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (\u003cspan class=\"pl-smi\"\u003e$expected_res\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eeq\u003c/span\u003e 0)","displayNoNewLineWarning":false,"position":63,"left":null,"right":63},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":64,"text":"+\t{","html":"+\t{","displayNoNewLineWarning":false,"position":64,"left":null,"right":64},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":65,"text":"+\t\t$node-\u003econnect_ok($connstr, $test_name, %params);","html":"+\t\t\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003econnect_ok(\u003cspan class=\"pl-smi\"\u003e$connstr\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003e$test_name\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003e%params\u003c/span\u003e);","displayNoNewLineWarning":false,"position":65,"left":null,"right":65},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":66,"text":"+\t}","html":"+\t}","displayNoNewLineWarning":false,"position":66,"left":null,"right":66},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":67,"text":"+\telse","html":"+\t\u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e","displayNoNewLineWarning":false,"position":67,"left":null,"right":67},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":68,"text":"+\t{","html":"+\t{","displayNoNewLineWarning":false,"position":68,"left":null,"right":68},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":69,"text":"+\t\t# No checks of the error message, only the status code.","html":"+\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e#\u003c/span\u003e No checks of the error message, only the status code.\u003c/span\u003e","displayNoNewLineWarning":false,"position":69,"left":null,"right":69},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":70,"text":"+\t\t$node-\u003econnect_fails($connstr, $test_name, %params);","html":"+\t\t\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003econnect_fails(\u003cspan class=\"pl-smi\"\u003e$connstr\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003e$test_name\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003e%params\u003c/span\u003e);","displayNoNewLineWarning":false,"position":70,"left":null,"right":70},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":71,"text":"+\t}","html":"+\t}","displayNoNewLineWarning":false,"position":71,"left":null,"right":71},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":72,"text":"+}","html":"+}","displayNoNewLineWarning":false,"position":72,"left":null,"right":72},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":73,"text":"+","html":"+","displayNoNewLineWarning":false,"position":73,"left":null,"right":73},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":74,"text":"+note \"use ldapbindpasswd\";","html":"+note \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003euse ldapbindpasswd\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":74,"left":null,"right":74},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":75,"text":"+","html":"+","displayNoNewLineWarning":false,"position":75,"left":null,"right":75},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":76,"text":"+unlink($node-\u003edata_dir . '/pg_hba.conf');","html":"+\u003cspan class=\"pl-c1\"\u003eunlink\u003c/span\u003e(\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003edata_dir . \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e/pg_hba.conf\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e);","displayNoNewLineWarning":false,"position":76,"left":null,"right":76},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":77,"text":"+$node-\u003eappend_conf('pg_hba.conf',","html":"+\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003eappend_conf(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003epg_hba.conf\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e,","displayNoNewLineWarning":false,"position":77,"left":null,"right":77},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":78,"text":"+\tqq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn=\"$ldap_basedn\" ldapbinddn=\"$ldap_rootdn ldapbindpasswd=wrong}","html":"+\t\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003eqq{\u003c/span\u003elocal all all ldap ldapserver=\u003cspan class=\"pl-smi\"\u003e$ldap_server\u003c/span\u003e ldapport=\u003cspan class=\"pl-smi\"\u003e$ldap_port\u003c/span\u003e ldapbasedn=\u0026quot;\u003cspan class=\"pl-smi\"\u003e$ldap_basedn\u003c/span\u003e\u0026quot; ldapbinddn=\u0026quot;\u003cspan class=\"pl-smi\"\u003e$ldap_rootdn\u003c/span\u003e ldapbindpasswd=wrong\u003cspan class=\"pl-pds\"\u003e}\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":78,"left":null,"right":78},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":79,"text":"+);","html":"+);","displayNoNewLineWarning":false,"position":79,"left":null,"right":79},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":80,"text":"+$node-\u003erestart;","html":"+\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003erestart;","displayNoNewLineWarning":false,"position":80,"left":null,"right":80},{"stylingDirective":null,"type":"ADDITION","blobLineNumber 8000 ":81,"text":"+","html":"+","displayNoNewLineWarning":false,"position":81,"left":null,"right":81},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":82,"text":"+$ENV{\"PGPASSWORD\"} = 'secret1';","html":"+\u003cspan class=\"pl-smi\"\u003e$ENV\u003c/span\u003e{\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003ePGPASSWORD\u003cspan class=\"pl-pds\"\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e} = \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003esecret1\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e;","displayNoNewLineWarning":false,"position":82,"left":null,"right":82},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":83,"text":"+test_access($node, 'test1', 2,","html":"+test_access(\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003etest1\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, 2,","displayNoNewLineWarning":false,"position":83,"left":null,"right":83},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":84,"text":"+\t'search+bind authentication fails with wrong ldapbindpasswd');","html":"+\t\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003esearch+bind authentication fails with wrong ldapbindpasswd\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e);","displayNoNewLineWarning":false,"position":84,"left":null,"right":84},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":85,"text":"+","html":"+","displayNoNewLineWarning":false,"position":85,"left":null,"right":85},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":86,"text":"+unlink($node-\u003edata_dir . '/pg_hba.conf');","html":"+\u003cspan class=\"pl-c1\"\u003eunlink\u003c/span\u003e(\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003edata_dir . \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e/pg_hba.conf\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e);","displayNoNewLineWarning":false,"position":86,"left":null,"right":86},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":87,"text":"+$node-\u003eappend_conf('pg_hba.conf',","html":"+\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003eappend_conf(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003epg_hba.conf\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e,","displayNoNewLineWarning":false,"position":87,"left":null,"right":87},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":88,"text":"+\tqq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn=\"$ldap_basedn\" ldapbinddn=\"$ldap_rootdn\" ldapbindpasswd=\"$ldap_rootpw\"}","html":"+\t\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003eqq{\u003c/span\u003elocal all all ldap ldapserver=\u003cspan class=\"pl-smi\"\u003e$ldap_server\u003c/span\u003e ldapport=\u003cspan class=\"pl-smi\"\u003e$ldap_port\u003c/span\u003e ldapbasedn=\u0026quot;\u003cspan class=\"pl-smi\"\u003e$ldap_basedn\u003c/span\u003e\u0026quot; ldapbinddn=\u0026quot;\u003cspan class=\"pl-smi\"\u003e$ldap_rootdn\u003c/span\u003e\u0026quot; ldapbindpasswd=\u0026quot;\u003cspan class=\"pl-smi\"\u003e$ldap_rootpw\u003c/span\u003e\u0026quot;\u003cspan class=\"pl-pds\"\u003e}\u003c/span\u003e\u003c/span\u003e","displayNoNewLineWarning":false,"position":88,"left":null,"right":88},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":89,"text":"+);","html":"+);","displayNoNewLineWarning":false,"position":89,"left":null,"right":89},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":90,"text":"+$node-\u003erestart;","html":"+\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e-\u0026gt;\u003c/span\u003erestart;","displayNoNewLineWarning":false,"position":90,"left":null,"right":90},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":91,"text":"+","html":"+","displayNoNewLineWarning":false,"position":91,"left":null,"right":91},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":92,"text":"+test_access($node, 'test1', 0,","html":"+test_access(\u003cspan class=\"pl-smi\"\u003e$node\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003etest1\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e, 0,","displayNoNewLineWarning":false,"position":92,"left":null,"right":92},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":93,"text":"+\t'search+bind authentication succeeds with ldapbindpasswd');","html":"+\t\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003esearch+bind authentication succeeds with ldapbindpasswd\u003cspan class=\"pl-pds\"\u003e\u0026#39;\u003c/span\u003e\u003c/span\u003e);","displayNoNewLineWarning":false,"position":93,"left":null,"right":93},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":94,"text":"+","html":"+","displayNoNewLineWarning":false,"position":94,"left":null,"right":94},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":95,"text":"+done_testing();","html":"+done_testing();","displayNoNewLineWarning":false,"position":95,"left":null,"right":95}],"diffNumber":1,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":95,"linesChanged":95,"newTreeEntry":{"lineCount":95,"path":"src/test/ldap/t/002_bindpasswd.pl","mode":100644,"isGenerated":false},"oldTreeEntry":null,"linesAdded":95,"linesDeleted":0,"path":"src/test/ldap/t/002_bindpasswd.pl","pathDigest":"bdf6da6765d5e4af890522fb79b649549bff9d4bc435e697fd43cdbaaf7387f0","status":"ADDED","truncatedReason":null,"oldOid":"17da09311bddd68d8a596fae5cc38e91617fe389","newOid":"8f6577c06a8437f6b8a371f29cb613708f91b094","copilotChatReference":null,"deletedSha":"17da09311bddd68d8a596fae5cc38e91617fe389","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null}],"splitViewPreference":"unified","ignoreWhitespace":false,"repoOwnerGlobalRelayId":"MDEyOk9yZ2FuaXphdGlvbjE3NzU0Mw==","commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/postgres/postgres/commit/8f6577c06a8437f6b8a371f29cb613708f91b094","fileTreeExpanded":true,"headerInfo":{"additions":96,"deletions":0,"filesChanged":2,"filesChangedString":"2"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":2,"truncated":false,"byteCount":2791,"lineShownCount":104},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"cruGXEckg9kYMEzODwxMmW-eejiZR0n67YBh-pdetSpzxs8I-FEMJS5t1vcQziwmxHd9GWXC-17vExo95hCSmA"},"/users/diffview?diff=unified":{"post":"nuOCZSmbilqg-0PCBG4NNgbkd5FXexok136j-jdtcLyfnssxlu4Fppam2fsbrG2JrQ1wsKv-qIDV7dg9RiNXDg"},"/notifications/thread":{"post":"Vct-jL9J8hAQdaMRZeEmBVD3YZqmFY3_es8UOE7eCMJO5-kmeEKdGJT4ksIuq_RNOZZEcDrFjmlBk7XI9Awp3Q"}}},"title":"Add a test using ldapbindpasswd in pg_hba.conf · postgres/postgres@8f6577c","appPayload":{"helpUrl":"https://docs.github.com","findInDiffWorkerPath":"/assets-cdn/worker/find-in-diff-worker-2bfe39677d14.js","enabled_features":{"diff_ux_refresh_beta":false,"diff_file_tree_item_aria_label":false,"diff_inline_comments":true,"diff_ux_refresh_ssr_five":false,"diff_ux_refresh_ssr_ten":false,"show_pusher_on_commit_detail":false}}}

Commit 8f6577c

Browse files
adunstanpull[bot]
authored andcommitted
Add a test using ldapbindpasswd in pg_hba.conf
This feature has not been covered in tests up to now. John Naylor and Andrew Dunstan Discussion: https://postgr.es/m/06005bfb-0fd7-9d08-e0e5-440f277b73b4@dunslane.net
1 parent 17da093 commit 8f6577c

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

src/test/ldap/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ tests += {
77
'tap': {
88
'tests': [
99
't/001_auth.pl',
10+
't/002_bindpasswd.pl',
1011
],
1112
'env': {
1213
'with_ldap': ldap.found() ? 'yes' : 'no',

src/test/ldap/t/002_bindpasswd.pl

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
2+
# Copyright (c) 2023, PostgreSQL Global Development Group
3+
4+
use strict;
5+
use warnings;
6+
7+
use FindBin;
8+
use lib "$FindBin::RealBin/..";
9+
10+
use File::Copy;
11+
use File::Basename;
12+
use LdapServer;
13+
use PostgreSQL::Test::Utils;
14+
use PostgreSQL::Test::Cluster;
15+
use Test::More;
16+
17+
if ($ENV{with_ldap} ne 'yes')
18+
{
19+
plan skip_all => 'LDAP not supported by this build';
20+
}
21+
elsif ($ENV{PG_TEST_EXTRA} !~ /\bldap\b/)
22+
{
23+
plan skip_all =>
24+
'Potentially unsafe test LDAP not enabled in PG_TEST_EXTRA';
25+
}
26+
elsif (!$LdapServer::setup)
27+
{
28+
plan skip_all =>
29+
"ldap tests not supported on $^O or dependencies not installed";
30+
}
31+
32+
note "setting up LDAP server";
33+
34+
my $ldap_rootpw = 'secret';
35+
my $ldap = LdapServer->new($ldap_rootpw, 'users'); # no anonymous auth
36+
$ldap->ldapadd_file('authdata.ldif');
37+
$ldap->ldapsetpw('uid=test1,dc=example,dc=net', 'secret1');
38+
$ldap->ldapsetpw('uid=test2,dc=example,dc=net', 'secret2');
39+
40+
my ($ldap_server, $ldap_port, $ldap_basedn, $ldap_rootdn) =
41+
$ldap->prop(qw(server port basedn rootdn));
42+
43+
note "setting up PostgreSQL instance";
44+
45+
my $node = PostgreSQL::Test::Cluster->new('node');
46+
$node->init;
47+
$node->append_conf('postgresql.conf', "log_connections = on\n");
48+
$node->start;
49+
50+
$node->safe_psql('postgres', 'CREATE USER test0;');
51+
$node->safe_psql('postgres', 'CREATE USER test1;');
52+
$node->safe_psql('postgres', 'CREATE USER "test2@example.net";');
53+
54+
note "running tests";
55+
56+
sub test_access
57+
{
58+
local $Test::Builder::Level = $Test::Builder::Level + 1;
59+
60+
my ($node, $role, $expected_res, $test_name, %params) = @_;
61+
my $connstr = "user=$role";
62+
63+
if ($expected_res eq 0)
64+
{
65+
$node->connect_ok($connstr, $test_name, %params);
66+
}
67+
else
68+
{
69+
# No checks of the error message, only the status code.
70+
$node->connect_fails($connstr, $test_name, %params);
71+
}
72+
}
73+
74+
note "use ldapbindpasswd";
75+
76+
unlink($node->data_dir . '/pg_hba.conf');
77+
$node->append_conf('pg_hba.conf',
78+
qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn" ldapbinddn="$ldap_rootdn ldapbindpasswd=wrong}
79+
);
80+
$node->restart;
81+
82+
$ENV{"PGPASSWORD"} = 'secret1';
83+
test_access($node, 'test1', 2,
84+
'search+bind authentication fails with wrong ldapbindpasswd');
85+
86+
unlink($node->data_dir . '/pg_hba.conf');
87+
$node->append_conf('pg_hba.conf',
88+
qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn" ldapbinddn="$ldap_rootdn" ldapbindpasswd="$ldap_rootpw"}
89+
);
90+
$node->restart;
91+
92+
test_access($node, 'test1', 0,
93+
'search+bind authentication succeeds with ldapbindpasswd');
94+
95+
done_testing();

0 commit comments

Comments
 (0)
0