PGSQL INTERFACES PGADMIN HACKERS 21 PG HBA CONF CAN T WRITE
From: saito@no-spam ("Hiroshi Saito")
Subject: pg_hba.conf can't write
Date: Tue, 14 Dec 2004 03:14:34 +0900


Hi Andreas.

Strange action?

<-----dlgHbaConfig.cpp------->

void dlgHbaConfig::OnOK(wxCommandEvent& ev)
{
line->isComment = !chkEnabled->GetValue();
line->connectType = (pgHbaConfigLine::pgHbaConnectType)cbType->GetSelection();

line->database = database;
line->user = user;
line->ipaddress = txtIPaddress->GetValue();
line->method = (pgHbaConfigLine::pgHbaMethod)cbMethod->GetSelection();
line->option = txtOption->GetValue();

wxMessageBox(txtIPaddress->GetValue()); //The input of the change (A) -- Debug Message
wxMessageBox(line->text); //strange result (B) -- Debug Message

EndModal(wxID_OK);
}

The value of (A) isn't taken over in (B).? Then, a result isn't kept. It is strange.
Is this countermeasure possible for you? Or, do I have misunderstanding?

regards,
Hiroshi Saito
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@no-spam

From: saito@no-spam ("Hiroshi Saito")
Subject: Re: pg_hba.conf can't write
Date: Wed, 15 Dec 2004 13:16:53 +0900

Hi Andreas.

Please check it.
This seems to succeed.

regards,
Hiroshi Saito
--- src/ui/dlgHbaConfig.cpp.orig Fri Dec 10 02:30:09 2004
+++ src/ui/dlgHbaConfig.cpp Wed Dec 15 13:08:35 2004
@@no-spam -308,6 +309,14 @@no-spam line->ipaddress =3D txtIPaddress->GetValue();
line->method =3D (pgHbaConfigLine::pgHbaMethod)cbMethod->GetSelection(=
);
line->option =3D txtOption->GetValue();
+
+ line->text =3D line->isComment ? wxT("#\t "):wxT("");
+ line->text +=3D line->GetConnectType();
+ line->text +=3D wxT("\t ") + line->database + wxT("\t ");
+ line->text +=3D line->user + wxT("\t ");
+ line->text +=3D line->ipaddress + wxT("\t ");
+ line->text +=3D line->GetMethod();
+ line->text +=3D wxT("\t ") + line->option + wxT("\t ");
=20
EndModal(wxID_OK);
}
--- src/ui/frmHbaConfig.cpp.orig Thu Dec 9 10:04:15 2004
+++ src/ui/frmHbaConfig.cpp Wed Dec 15 13:16:12 2004
@@no-spam -179,7 +179,7 @@no-spam wxString str;
size_t i;
for (i=3D0 ; i < lines.GetCount()-1 ; i++)
- str.Append(lines.Item(i).GetText() + wxT("\n"));
+ str.Append(lines.Item(i).text + wxT("\n"));
=20
if (DoWriteFile(str, conn))
{
--- src/utils/pgconfig.cpp.orig Fri Dec 10 11:20:06 2004
+++ src/utils/pgconfig.cpp Wed Dec 15 13:06:21 2004
@@no-spam -426,7 +426,7 @@no-spam =20
while (*p2)
{
- if (wxStrchr(wxT("\n "), *p2) && !quoted)
+ if (wxStrchr(wxT("\t "), *p2) && !quoted)
break;
if (*p2 =3D=3D '"')
quoted ^=3D quoted;
@@no-spam -442,7 +442,7 @@no-spam quoted=3Dfalse;
while (*p3)
{
- if (wxStrchr(wxT("\n "), *p3) && !quoted)
+ if (wxStrchr(wxT("\t "), *p3) && !quoted)
break;
if (*p3 =3D=3D '"')
quoted ^=3D quoted;
@@no-spam -462,7 +462,7 @@no-spam else {
bool hasCidr=3Dfalse;
- while (*p4 && !wxStrchr(wxT("\n "), *p4))
+ while (*p4 && !wxStrchr(wxT("\t "), *p4))
{
if (*p4 =3D=3D '/')
hasCidr=3Dtrue;
@@no-spam -516,11 +516,10 @@no-spam =20
wxString pgHbaConfigLine::GetText()
{
- if (!DidChange())
+ if (DidChange())
return text;
=20
- wxString str;
- return str;
+ return wxEmptyString;
}
=20
=20
@@no-spam -528,5 +527,5 @@no-spam {
if (isComment)
return false;
- return false;
+ return true;
}

[qptext pg_hba_patch.txt]

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

From: pgadmin@no-spam (Andreas Pflug)
Subject: Re: pg_hba.conf can't write
Date: Wed, 15 Dec 2004 12:56:39 +0000

Hiroshi Saito wrote:

> > wxMessageBox(txtIPaddress->GetValue()); //The input of the change (A) -- Debug Message
> wxMessageBox(line->text); //strange result (B) -- Debug Message
> > EndModal(wxID_OK);
> }
> > The value of (A) isn't taken over in (B).?
This is correct. Actually, pgHbaConfigLine::GetText wasn't fully implemented; done now.

Regards,
Andreas
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

From: saito@no-spam ("Hiroshi Saito")
Subject: Re: pg_hba.conf can't write
Date: Thu, 16 Dec 2004 02:37:14 +0900

Hi Andreas.

From: "Andreas Pflug" (pgadmin@no-spam)
> > The value of (A) isn't taken over in (B).? > > This is correct. Actually, pgHbaConfigLine::GetText wasn't fully > implemented; done now.

Thank you very much.!:-)

However, It can't change into the comment line.
Please apply it.

One more strange..
OK button of the save is tough, and it doesn't become quiet.
This is investigate.

regards,
Hiroshi Saito --- src/ui/dlgHbaConfig.cpp.orig Thu Dec 16 02:07:11 2004
+++ src/ui/dlgHbaConfig.cpp Thu Dec 16 02:07:39 2004
@@no-spam -297,7 +297,7 @@no-spam =20
}
btnOK->Enable(cbType->GetSelection() >=3D 0 && !database.IsEmpty() && =
!user.IsEmpty() &&=20
- cbMethod->GetSelection() >=3D 0 && ipValid);
+ cbMethod->GetSelection() >=3D 0);
}
=20
=20

[qptext dlgHbaConfig_patch.txt.1103132234.838524257]

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

From: pgadmin@no-spam (Andreas Pflug)
Subject: Re: pg_hba.conf can't write
Date: Thu, 16 Dec 2004 16:14:30 +0000

Hiroshi Saito wrote:

> > However, It can't change into the comment line.
> Please apply it.
>
> ------------------------------------------------------------------------
> > --- src/ui/dlgHbaConfig.cpp.orig Thu Dec 16 02:07:11 2004
> +++ src/ui/dlgHbaConfig.cpp Thu Dec 16 02:07:39 2004
> @@no-spam -297,7 +297,7 @@no-spam > > }
> btnOK->Enable(cbType->GetSelection() >= 0 && !database.IsEmpty() && !user.IsEmpty() &&
> - cbMethod->GetSelection() >= 0 && ipValid);
> + cbMethod->GetSelection() >= 0);

I don't like this fix. The check is ok, but ipValid is wrong; preliminarily fixed.
Maybe you find the time to implement the checking code in line 298ff for IPV4 an IPV6 and both flavours of netmasks.

Regards,
Andreas
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org