Hi,

I worked a bit this morning on this bug. The editor was made in a way
that invalid configuration lines are not displayed which is wrong
because you can't fix a line if you stored it wrong once.

So I did the change to allow the change of an invalid configuration
line, and that works well.

But I now have many other lines that aren't supposed to appear:

# local      DATABASE  USER  METHOD  [OPTIONS]
# host       DATABASE  USER  ADDRESS  METHOD  [OPTIONS]
# hostssl    DATABASE  USER  ADDRESS  METHOD  [OPTIONS]
# hostnossl  DATABASE  USER  ADDRESS  METHOD  [OPTIONS]
# host name, or it is

All are considered comments, and all have a valid first column, so all
are displayed. Which is a bit disturbing because they are part of the
comments in pg_hba.conf, they are not supposed to be "actual" lines.

So, they match our process of identifiying lines, and so they are
displayed. Do you have any idea how we could not display these? I mean,
I can simply add a check on the line string to see if they are equal to
the one of the five strings above, but it seems quite a ugly hack.

Or do we simply choose to not care? we prefer to have the bugfix even if
it means to show some not "actual" config lines?

Another related question: peer, radius are not available in the method.
As we are in beta, I won't add them to 1.14 branch, will I?

PS: current patch attached.


-- 
Guillaume
  http://blog.guillaume.lelarge.info
  http://www.dalibo.com
diff --git a/pgadmin/dlg/dlgHbaConfig.cpp b/pgadmin/dlg/dlgHbaConfig.cpp
index 2cca14c..8846354 100644
--- a/pgadmin/dlg/dlgHbaConfig.cpp
+++ b/pgadmin/dlg/dlgHbaConfig.cpp
@@ -149,7 +185,7 @@ dlgHbaConfig::dlgHbaConfig(pgFrame *parent, pgHbaConfigLine *_line, pgConn *_con
 	// Setup the default values
 
 	chkEnabled->SetValue(!line->isComment);
-	if(line->connectType != pgHbaConfigLine::PGC_INVALIDCONF)
+	if(line->connectType != pgHbaConfigLine::PGC_INVALIDCONNECTTYPE)
 	{
 		database = line->database;
 		user = line->user;
diff --git a/pgadmin/include/utils/pgconfig.h b/pgadmin/include/utils/pgconfig.h
index 25d5e43..576171c 100644
--- a/pgadmin/include/utils/pgconfig.h
+++ b/pgadmin/include/utils/pgconfig.h
@@ -70,7 +70,7 @@ public:
 		PGC_HOST,
 		PGC_HOSTSSL,
 		PGC_HOSTNOSSL,
-		PGC_INVALIDCONF
+		PGC_INVALIDCONNECTTYPE
 	};
 	enum pgHbaMethod
 	{
@@ -97,6 +99,7 @@ public:
 
 	long item;
 
+	bool isvalid;
 	bool isComment;
 	bool changed;
 };
diff --git a/pgadmin/utils/pgconfig.cpp b/pgadmin/utils/pgconfig.cpp
index c397ef5..b6934a5 100644
--- a/pgadmin/utils/pgconfig.cpp
+++ b/pgadmin/utils/pgconfig.cpp
@@ -384,7 +384,8 @@ void SkipNonspace(const wxChar* &ptr, const wxChar *spaceChars = wxT("\t "))
 pgHbaConfigLine::pgHbaConfigLine(const wxString &line)
 {
 	item = -1;
-	connectType = PGC_INVALIDCONF;
+	isvalid = false;
+	connectType = PGC_INVALIDCONNECTTYPE;
 	method = PGC_INVALIDMETHOD;
 	Init(line);
 }
@@ -392,7 +393,7 @@ pgHbaConfigLine::pgHbaConfigLine(const wxString &line)
 
 void pgHbaConfigLine::Init(const wxString &line)
 {
-	connectType = PGC_INVALIDCONF;
+	isvalid = true;
 	changed = false;
 
 	if (line.IsEmpty())
@@ -423,8 +424,8 @@ void pgHbaConfigLine::Init(const wxString &line)
 		connectType = (pgHbaConnectType)i;
 	else
 	{
-		connectType = PGC_INVALIDCONF;
-		isComment = true;
+		connectType = PGC_INVALIDCONNECTTYPE;
+		isvalid = false;
 		return;
 	}
 
@@ -498,8 +499,7 @@ void pgHbaConfigLine::Init(const wxString &line)
 		method = (pgHbaMethod)i;
 	else
 	{
-		connectType = PGC_INVALIDCONF;
-		isComment = true;
+		isvalid = false;
 		return;
 	}
 	SkipSpace(p5);
@@ -509,7 +509,7 @@ void pgHbaConfigLine::Init(const wxString &line)
 
 const wxChar *pgHbaConfigLine::GetConnectType()
 {
-	if (connectType >= 0 && connectType < PGC_INVALIDCONF)
+	if (connectType >= 0 && connectType < PGC_INVALIDCONNECTTYPE)
 		return pgHbaConnectTypeStrings[connectType];
 	return 0;
 }
-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to