Index: pgadmin/dlg/dlgHbaConfig.cpp
===================================================================
--- pgadmin/dlg/dlgHbaConfig.cpp	(revision 7767)
+++ pgadmin/dlg/dlgHbaConfig.cpp	(working copy)
@@ -52,12 +52,14 @@
 #define stOption            CTRL_STATIC("stOption")
 
 
-dlgHbaConfig::dlgHbaConfig(pgFrame *parent, pgHbaConfigLine *_line, pgConn *conn) : 
+dlgHbaConfig::dlgHbaConfig(pgFrame *parent, pgHbaConfigLine *_line, pgConn *_conn) : 
 DialogWithHelp((frmMain*)parent)
 {
     wxWindowBase::SetFont(settings->GetSystemFont());
     LoadResource((wxWindow*)parent, wxT("dlgHbaConfig"));
 
+    conn = _conn;
+
     userAdding = databaseAdding = false;
 
     // Icon
@@ -90,6 +92,27 @@
 
     if (conn)
     {
+        // LDAP is supported from 8.2
+        if (conn->BackendMinimumVersion(8, 2))
+            cbMethod->Append(wxT("ldap"));
+
+        // GSS/SSPI are supported form 8.3
+        if (conn->BackendMinimumVersion(8, 3))
+        {
+            cbMethod->Append(wxT("gss"));
+            cbMethod->Append(wxT("sspi"));
+        }
+    }
+    else
+    {
+        // Add all version-dependent methods if we don't know what version we have.
+        cbMethod->Append(wxT("ldap"));
+        cbMethod->Append(wxT("gss"));
+        cbMethod->Append(wxT("sspi"));
+    }
+
+    if (conn)
+    {
         pgSet *set=conn->ExecuteSet(wxT("SELECT datname FROM pg_database"));
         if (set)
         {
@@ -284,7 +307,27 @@
     stIPaddress->Enable(needIp);
     txtIPaddress->Enable(needIp);
 
-    bool needOption = (cbMethod->GetCurrentSelection() >= pgHbaConfigLine::PGC_IDENT);
+    bool needOption = false;
+    // IDENT and LDAP always take an option
+    if (cbMethod->GetCurrentSelection() == pgHbaConfigLine::PGC_IDENT ||
+        cbMethod->GetCurrentSelection() == pgHbaConfigLine::PGC_LDAP)
+    {
+        needOption = true;
+    }
+    else if (cbMethod->GetCurrentSelection() == pgHbaConfigLine::PGC_GSS ||
+             cbMethod->GetCurrentSelection() == pgHbaConfigLine::PGC_SSPI)
+    {
+        // GSS/SSPI take options from 8.4 onwards. If we don't know the version
+        // then allow the option to be specified.
+        if (conn)
+        {
+            if (conn->BackendMinimumVersion(8, 4))
+                needOption = true;
+        }
+        else
+            needOption = true;
+    }
+
     stOption->Enable(needOption);
     txtOption->Enable(needOption);
 
@@ -307,7 +350,10 @@
     line->user = user;
     line->ipaddress = txtIPaddress->GetValue();
     line->method = (pgHbaConfigLine::pgHbaMethod)cbMethod->GetCurrentSelection();
-    line->option = txtOption->GetValue();
+    if (txtOption->IsEnabled())
+        line->option = txtOption->GetValue();
+    else
+        line->option = wxEmptyString;
     line->changed = true;
 
     EndModal(wxID_OK);
Index: pgadmin/include/dlg/dlgHbaConfig.h
===================================================================
--- pgadmin/include/dlg/dlgHbaConfig.h	(revision 7767)
+++ pgadmin/include/dlg/dlgHbaConfig.h	(working copy)
@@ -19,7 +19,7 @@
 class dlgHbaConfig : public DialogWithHelp
 {
 public:
-    dlgHbaConfig(pgFrame *parent, pgHbaConfigLine *line, pgConn *conn);
+    dlgHbaConfig(pgFrame *parent, pgHbaConfigLine *line, pgConn *_conn);
     ~dlgHbaConfig();
     wxString GetHelpPage() const;
 
@@ -39,6 +39,8 @@
 
     bool databaseAdding, userAdding;
 
+    pgConn *conn;
+
     DECLARE_EVENT_TABLE()
 };
 
Index: pgadmin/include/utils/pgconfig.h
===================================================================
--- pgadmin/include/utils/pgconfig.h	(revision 7767)
+++ pgadmin/include/utils/pgconfig.h	(working copy)
@@ -76,6 +76,9 @@
         PGC_KRB5,
         PGC_IDENT,
         PGC_PAM,
+        PGC_LDAP,
+        PGC_GSS,
+        PGC_SSPI,
         PGC_INVALIDMETHOD
     };
 
Index: pgadmin/utils/pgconfig.cpp
===================================================================
--- pgadmin/utils/pgconfig.cpp	(revision 7767)
+++ pgadmin/utils/pgconfig.cpp	(working copy)
@@ -354,6 +354,9 @@
     wxT("krb5"),
     wxT("ident"),
     wxT("pam"),
+    wxT("ldap"),
+    wxT("gss"),
+    wxT("sspi"),
     0
 };
 