Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Commit

Permalink
Remove sslverify again, since it's been removed from libpq after 8.4b…
Browse files Browse the repository at this point in the history
…eta1

git-svn-id: svn://svn.pgadmin.org/trunk@7819 a7884b65-44f6-0310-8a51-81a127f17b15
  • Loading branch information
mhagander committed Apr 24, 2009
1 parent b17acae commit ec6d4cd
Show file tree
Hide file tree
Showing 22 changed files with 480 additions and 668 deletions.
35 changes: 2 additions & 33 deletions pgadmin/db/pgConn.cpp
Expand Up @@ -48,7 +48,7 @@ static void pgNoticeProcessor(void *arg, const char *message)
((pgConn*)arg)->Notice(message);
}

pgConn::pgConn(const wxString& server, const wxString& database, const wxString& username, const wxString& password, int port, int sslmode, int sslverifymode, OID oid)
pgConn::pgConn(const wxString& server, const wxString& database, const wxString& username, const wxString& password, int port, int sslmode, OID oid)
{
wxString msg, hostip, hostname;

Expand All @@ -58,7 +58,6 @@ pgConn::pgConn(const wxString& server, const wxString& database, const wxString&
save_password = password;
save_port = port;
save_sslmode = sslmode;
save_sslverifymode = sslverifymode;
save_oid = oid;

memset(features, 0, sizeof(features));
Expand Down Expand Up @@ -161,15 +160,6 @@ pgConn::pgConn(const wxString& server, const wxString& database, const wxString&
case 2: connstr.Append(wxT(" requiressl=0")); break;
}
}
if (libpqVersion >= 8.4)
{
switch (sslverifymode)
{
case 1: connstr.Append(wxT(" sslverify=cn")); break;
case 2: connstr.Append(wxT(" sslverify=cert")); break;
case 3: connstr.Append(wxT(" sslverify=none")); break;
}
}
connstr.Trim(false);

// Open the connection
Expand Down Expand Up @@ -262,7 +252,7 @@ void pgConn::Close()

pgConn *pgConn::Duplicate()
{
return new pgConn(wxString(save_server), wxString(save_database), wxString(save_username), wxString(save_password), save_port, save_sslmode, save_sslverifymode, save_oid);
return new pgConn(wxString(save_server), wxString(save_database), wxString(save_username), wxString(save_password), save_port, save_sslmode, save_oid);
}

// Return the SSL mode name
Expand All @@ -283,22 +273,6 @@ wxString pgConn::GetSslModeName()
}
}

// Return the SSL verify mode name
wxString pgConn::GetSslVerifyModeName()
{
switch (save_sslverifymode)
{
case 1:
return wxT("cn");
case 2:
return wxT("cert");
case 3:
return wxT("none");
default:
return wxT("cn");
}
}

bool pgConn::GetIsEdb()
{
// to retrieve edb flag
Expand Down Expand Up @@ -505,11 +479,6 @@ void pgConn::ExamineLibpqVersion()
if (libpqVersion < 7.4)
libpqVersion=7.4;
}
if (!strcmp(co->keyword, "sslverify"))
{
if (libpqVersion < 8.4)
libpqVersion=8.4;
}
co++;
}
PQconninfoFree(cio);
Expand Down
26 changes: 4 additions & 22 deletions pgadmin/debugger/dbgPgConn.cpp
Expand Up @@ -42,19 +42,19 @@
//
// The constructor creates a new thread and connects to the specified server

dbgPgConn::dbgPgConn(frmDebugger *frame, const wxString &server, const wxString &database, const wxString &userName, const wxString &password, const wxString &port, int sslmode, int sslverify )
dbgPgConn::dbgPgConn(frmDebugger *frame, const wxString &server, const wxString &database, const wxString &userName, const wxString &password, const wxString &port, int sslmode)
: m_frame(frame)
{
Init( server, database, userName, password, port, sslmode, sslverify, true );
Init( server, database, userName, password, port, sslmode, true );
}

dbgPgConn::dbgPgConn(frmDebugger *frame, const dbgConnProp & props, bool startThread )
: m_frame(frame)
{
Init( props.m_host, props.m_database, props.m_userName, props.m_password, props.m_port, props.m_sslMode, props.m_sslVerify, startThread );
Init( props.m_host, props.m_database, props.m_userName, props.m_password, props.m_port, props.m_sslMode, startThread );
}

void dbgPgConn::Init( const wxString &server, const wxString &database, const wxString &username, const wxString &password, const wxString &port, int sslmode, int sslverify, bool startThread )
void dbgPgConn::Init( const wxString &server, const wxString &database, const wxString &username, const wxString &password, const wxString &port, int sslmode, bool startThread )
{
m_pgConn = NULL;
m_majorVersion = 0;
Expand Down Expand Up @@ -193,24 +193,6 @@ void dbgPgConn::Init( const wxString &server, const wxString &database, const wx
break;
}

switch (sslverify)
{
case 1:
connectParams.Append(wxT(" sslverify=cn"));
break;

case 2:
connectParams.Append(wxT(" sslverify=cert"));
break;

case 3:
connectParams.Append(wxT(" sslverify=none"));
break;

default:
break;
}

connectParams.Trim(true);
connectParams.Trim(false);

Expand Down
8 changes: 0 additions & 8 deletions pgadmin/debugger/debugger.cpp
Expand Up @@ -70,10 +70,6 @@ wxWindow *debuggerFactory::StartDialog(frmMain *form, pgObject *obj)
cp.m_port = NumToStr((long)obj->GetServer()->GetPort());
cp.m_sslMode = obj->GetServer()->GetSSL();
cp.m_userName = obj->GetServer()->GetUsername();
if (obj->GetServer()->GetConnection()->BackendMinimumVersion(8,4))
cp.m_sslVerify = obj->GetServer()->GetSSLverify();
else
cp.m_sslVerify = 0;

// Setup the debugging session
dlgDirectDbg *directDebugger = NULL;
Expand Down Expand Up @@ -210,10 +206,6 @@ wxWindow *breakpointFactory::StartDialog(frmMain *form, pgObject *obj)
cp.m_port = NumToStr((long)obj->GetServer()->GetPort());
cp.m_sslMode = obj->GetServer()->GetSSL();
cp.m_userName = obj->GetServer()->GetUsername();
if (obj->GetServer()->GetConnection()->BackendMinimumVersion(8,4))
cp.m_sslVerify = obj->GetServer()->GetSSLverify();
else
cp.m_sslVerify = 0;

// Setup the debugging session
ctlCodeWindow *globalDebugger = NULL;
Expand Down
6 changes: 3 additions & 3 deletions pgadmin/dlg/dlgSelectConnection.cpp
Expand Up @@ -203,10 +203,10 @@ pgConn *dlgSelectConnection::CreateConn()
}
}

pgConn *dlgSelectConnection::CreateConn(wxString& server, wxString& dbname, wxString& username, int port, int sslmode, int sslverify, bool writeMRU)
pgConn *dlgSelectConnection::CreateConn(wxString& server, wxString& dbname, wxString& username, int port, int sslmode, bool writeMRU)
{
pgConn *newconn;
newconn = new pgConn(server, dbname, username, wxT(""), port, sslmode, sslverify);
newconn = new pgConn(server, dbname, username, wxT(""), port, sslmode);
if (newconn->GetStatus() != PGCONN_OK &&
newconn->GetLastError().Cmp(wxString(PQnoPasswordSupplied, wxConvUTF8)) == 0)
{
Expand All @@ -220,7 +220,7 @@ pgConn *dlgSelectConnection::CreateConn(wxString& server, wxString& dbname, wxSt
if (dlg.Go() != wxID_OK)
return NULL;

newconn = new pgConn(server, dbname, username, dlg.GetPassword(), port, sslmode, sslverify);
newconn = new pgConn(server, dbname, username, dlg.GetPassword(), port, sslmode);
}

if (newconn)
Expand Down
21 changes: 1 addition & 20 deletions pgadmin/dlg/dlgServer.cpp
Expand Up @@ -29,7 +29,6 @@
#define cbDatabase CTRL_COMBOBOX("cbDatabase")
#define txtPort CTRL_TEXT("txtPort")
#define cbSSL CTRL_COMBOBOX("cbSSL")
#define cbSSLverify CTRL_COMBOBOX("cbSSLverify")
#define txtUsername CTRL_TEXT("txtUsername")
#define stTryConnect CTRL_STATIC("stTryConnect")
#define chkTryConnect CTRL_CHECKBOX("chkTryConnect")
Expand All @@ -54,7 +53,6 @@ BEGIN_EVENT_TABLE(dlgServer, dlgProperty)
EVT_TEXT(XRCID("txtUsername"), dlgProperty::OnChange)
EVT_TEXT(XRCID("txtDbRestriction"), dlgServer::OnChangeRestr)
EVT_COMBOBOX(XRCID("cbSSL"), dlgProperty::OnChange)
EVT_COMBOBOX(XRCID("cbSSLverify"), dlgProperty::OnChange)
EVT_CHECKBOX(XRCID("chkStorePwd"), dlgProperty::OnChange)
EVT_CHECKBOX(XRCID("chkRestore"), dlgProperty::OnChange)
EVT_CHECKBOX(XRCID("chkTryConnect"), dlgServer::OnChangeTryConnect)
Expand Down Expand Up @@ -87,8 +85,6 @@ dlgServer::dlgServer(pgaFactory *f, frmMain *frame, pgServer *node)
txtPort->SetValue(NumToStr((long)settings->GetLastPort()));
if (!cbSSL->IsEmpty())
cbSSL->SetSelection(settings->GetLastSSL());
if (!cbSSLverify->IsEmpty())
cbSSLverify->SetSelection(settings->GetLastSSLverify());
txtUsername->SetValue(settings->GetLastUsername());

chkTryConnect->SetValue(true);
Expand All @@ -109,7 +105,6 @@ dlgServer::~dlgServer()
settings->SetLastDatabase(cbDatabase->GetValue());
settings->SetLastPort(StrToLong(txtPort->GetValue()));
settings->SetLastSSL(cbSSL->GetCurrentSelection());
settings->SetLastSSLverify(cbSSLverify->GetCurrentSelection());
settings->SetLastUsername(txtUsername->GetValue());
}
}
Expand Down Expand Up @@ -147,7 +142,6 @@ void dlgServer::OnOK(wxCommandEvent &ev)
}
server->iSetPort(StrToLong(txtPort->GetValue()));
server->iSetSSL(cbSSL->GetCurrentSelection());
server->iSetSSLverify(cbSSLverify->GetCurrentSelection());
server->iSetDatabase(cbDatabase->GetValue());
server->iSetUsername(txtUsername->GetValue());
server->iSetStorePwd(chkStorePwd->GetValue());
Expand Down Expand Up @@ -231,7 +225,6 @@ int dlgServer::GoNew()
int dlgServer::Go(bool modal)
{
cbSSL->Append(wxT(" "));
cbSSLverify->Append(wxT(" "));

#ifdef SSL
cbSSL->Append(_("require"));
Expand All @@ -242,13 +235,6 @@ int dlgServer::Go(bool modal)
cbSSL->Append(_("allow"));
cbSSL->Append(_("disable"));
}

if (pgConn::GetLibpqVersion() >= 8.4)
{
cbSSLverify->Append(_("Full verification"));
cbSSLverify->Append(_("Certificate only"));
cbSSLverify->Append(_("No verification"));
}
#endif

if (server)
Expand All @@ -259,7 +245,6 @@ int dlgServer::Go(bool modal)
txtService->SetValue(server->GetServiceID());
txtPort->SetValue(NumToStr((long)server->GetPort()));
cbSSL->SetSelection(server->GetSSL());
cbSSLverify->SetSelection(server->GetSSLverify());
cbDatabase->SetValue(server->GetDatabaseName());
txtUsername->SetValue(server->GetUsername());
chkStorePwd->SetValue(server->GetStorePwd());
Expand All @@ -275,7 +260,6 @@ int dlgServer::Go(bool modal)
cbDatabase->Disable();
txtPort->Disable();
cbSSL->Disable();
cbSSLverify->Disable();
txtUsername->Disable();
chkStorePwd->Disable();
}
Expand Down Expand Up @@ -308,8 +292,7 @@ pgObject *dlgServer::CreateObject(pgCollection *collection)
pgObject *obj=new pgServer(GetName(), txtDescription->GetValue(), cbDatabase->GetValue(),
txtUsername->GetValue(), StrToLong(txtPort->GetValue()),
chkTryConnect->GetValue() && chkStorePwd->GetValue(),
chkRestore->GetValue(), cbSSL->GetCurrentSelection(),
cbSSLverify->GetCurrentSelection(), txtColour->GetValue());
chkRestore->GetValue(), cbSSL->GetCurrentSelection());

return obj;
}
Expand Down Expand Up @@ -353,7 +336,6 @@ void dlgServer::CheckChange()
|| cbDatabase->GetValue() != server->GetDatabaseName()
|| txtUsername->GetValue() != server->GetUsername()
|| cbSSL->GetCurrentSelection() != server->GetSSL()
|| cbSSLverify->GetCurrentSelection() != server->GetSSLverify()
|| chkStorePwd->GetValue() != server->GetStorePwd()
|| chkRestore->GetValue() != server->GetRestore()
|| txtDbRestriction->GetValue() != server->GetDbRestriction()
Expand All @@ -366,7 +348,6 @@ void dlgServer::CheckChange()
#else
bool isPipe = (name.IsEmpty() || name.StartsWith(wxT("/")));
cbSSL->Enable(!isPipe);
cbSSLverify->Enable(!isPipe);
#endif
CheckValid(enable, !txtDescription->GetValue().IsEmpty(), _("Please specify description."));
CheckValid(enable, StrToLong(txtPort->GetValue()) > 0, _("Please specify port."));
Expand Down
1 change: 0 additions & 1 deletion pgadmin/frm/frmBackup.cpp
Expand Up @@ -80,7 +80,6 @@ frmBackup::frmBackup(frmMain *form, pgObject *obj) : ExternProcessDialog(form)

// Pass the SSL mode via the environment
environment.Add(wxT("PGSSLMODE=") + object->GetServer()->GetConnection()->GetSslModeName());
environment.Add(wxT("PGSSLVERIFY=") + object->GetServer()->GetConnection()->GetSslVerifyModeName());

// Icon
SetIcon(wxIcon(backup_xpm));
Expand Down
2 changes: 0 additions & 2 deletions pgadmin/frm/frmBackupGlobals.cpp
Expand Up @@ -62,7 +62,6 @@ frmBackupGlobals::frmBackupGlobals(frmMain *form, pgObject *obj) : ExternProcess

// Pass the SSL mode via the environment
environment.Add(wxT("PGSSLMODE=") + ((pgServer *)object)->GetConnection()->GetSslModeName());
environment.Add(wxT("PGSSLVERIFY=") + ((pgServer *)object)->GetConnection()->GetSslVerifyModeName());
}
else
{
Expand All @@ -71,7 +70,6 @@ frmBackupGlobals::frmBackupGlobals(frmMain *form, pgObject *obj) : ExternProcess

// Pass the SSL mode via the environment
environment.Add(wxT("PGSSLMODE=") + object->GetServer()->GetConnection()->GetSslModeName());
environment.Add(wxT("PGSSLVERIFY=") + object->GetServer()->GetConnection()->GetSslVerifyModeName());
}

// Icon
Expand Down
1 change: 0 additions & 1 deletion pgadmin/frm/frmBackupServer.cpp
Expand Up @@ -60,7 +60,6 @@ frmBackupServer::frmBackupServer(frmMain *form, pgObject *obj) : ExternProcessDi

// Pass the SSL mode via the environment
environment.Add(wxT("PGSSLMODE=") + ((pgServer *)object)->GetConnection()->GetSslModeName());
environment.Add(wxT("PGSSLVERIFY=") + ((pgServer *)object)->GetConnection()->GetSslVerifyModeName());

// Icon
SetIcon(wxIcon(backup_xpm));
Expand Down
1 change: 0 additions & 1 deletion pgadmin/frm/frmMain.cpp
Expand Up @@ -1049,7 +1049,6 @@ void frmMain::StoreServers()
settings->Write(key + wxT("DbRestriction"), server->GetDbRestriction());
settings->Write(key + wxT("Colour"), server->GetColour());
settings->Write(key + wxT("SSL"), server->GetSSL());
settings->Write(key + wxT("SSLverify"), server->GetSSLverify());

pgCollection *coll=browser->FindCollection(databaseFactory, server->GetId());
if (coll)
Expand Down
1 change: 0 additions & 1 deletion pgadmin/frm/frmRestore.cpp
Expand Up @@ -115,7 +115,6 @@ frmRestore::frmRestore(frmMain *_form, pgObject *obj) : ExternProcessDialog(form

// Pass the SSL mode via the environment
environment.Add(wxT("PGSSLMODE=") + server->GetConnection()->GetSslModeName());
environment.Add(wxT("PGSSLVERIFY=") + server->GetConnection()->GetSslVerifyModeName());

wxCommandEvent ev;
OnChangeName(ev);
Expand Down
2 changes: 0 additions & 2 deletions pgadmin/frm/plugins.cpp
Expand Up @@ -244,7 +244,6 @@ wxWindow *pluginUtilityFactory::StartDialog(frmMain *form, pgObject *obj)

// Pass the SSL mode via the environment
wxSetEnv(wxT("PGSSLMODE"), obj->GetConnection()->GetSslModeName());
wxSetEnv(wxT("PGSSLVERIFY"), obj->GetConnection()->GetSslVerifyModeName());
}
else
{
Expand All @@ -253,7 +252,6 @@ wxWindow *pluginUtilityFactory::StartDialog(frmMain *form, pgObject *obj)
execCmd.Replace(wxT("$$HOSTADDR"), wxEmptyString);
execCmd.Replace(wxT("$$PORT"), wxEmptyString);
execCmd.Replace(wxT("$$SSLMODE"), wxEmptyString);
execCmd.Replace(wxT("$$SSLVERIFY"), wxEmptyString);
execCmd.Replace(wxT("$$DATABASE"), wxEmptyString);
execCmd.Replace(wxT("$$USERNAME"), wxEmptyString);
execCmd.Replace(wxT("$$PASSWORD"), wxEmptyString);
Expand Down
6 changes: 2 additions & 4 deletions pgadmin/include/db/pgConn.h
Expand Up @@ -81,7 +81,7 @@ typedef struct pgError {
class pgConn
{
public:
pgConn(const wxString& server = wxT(""), const wxString& database = wxT(""), const wxString& username = wxT(""), const wxString& password = wxT(""), int port = 5432, int sslmode=0, int sslverify=0, OID oid=0);
pgConn(const wxString& server = wxT(""), const wxString& database = wxT(""), const wxString& username = wxT(""), const wxString& password = wxT(""), int port = 5432, int sslmode=0, OID oid=0);
~pgConn();

bool HasPrivilege(const wxString &objTyp, const wxString &objName, const wxString &priv);
Expand Down Expand Up @@ -117,9 +117,7 @@ class pgConn
wxString GetTTY() const { return wxString(PQtty(conn), *conv); }
wxString GetOptions() const { return wxString(PQoptions(conn), *conv); }
int GetSslMode() const { return save_sslmode; }
int GetSslVerifyMode() const { return save_sslverifymode;}
wxString GetSslModeName();
wxString GetSslVerifyModeName();
int GetBackendPID() const { return PQbackendPID(conn); }
int GetStatus() const;
int GetLastResultStatus() const { return lastResultStatus; }
Expand Down Expand Up @@ -174,7 +172,7 @@ class pgConn
wxString reservedNamespaces;

wxString save_server, save_database, save_username, save_password;
int save_port, save_sslmode, save_sslverifymode;
int save_port, save_sslmode;
OID save_oid;
};

Expand Down
1 change: 0 additions & 1 deletion pgadmin/include/debugger/dbgConnProp.h
Expand Up @@ -32,7 +32,6 @@ class dbgConnProp
wxString m_port; // Port number
wxString m_debugPort; // Port number for debugger connection
int m_sslMode; // SSL Mode
int m_sslVerify; // SSL Certificate Verify Mode
};

#endif
5 changes: 2 additions & 3 deletions pgadmin/include/debugger/dbgPgConn.h
Expand Up @@ -57,8 +57,7 @@ class dbgPgConn
const wxString &username = wxT( "" ),
const wxString &password = wxT( "" ),
const wxString &port = wxT( "5432" ),
int sslmode = 0,
int sslverify = 0 );
int sslmode = 0 );

dbgPgConn( frmDebugger *frame, const dbgConnProp & props, bool startThread = true );

Expand All @@ -84,7 +83,7 @@ class dbgPgConn

private:

void Init( const wxString &server, const wxString &database, const wxString &userName, const wxString &password, const wxString &port, int sslmode, int sslverify, bool startThread );
void Init( const wxString &server, const wxString &database, const wxString &userName, const wxString &password, const wxString &port, int sslmode, bool startThread );

PGconn *m_pgConn; // libpq connection handler
dbgPgThread *m_workerThread; // Worker thread (this thread interacts with the server)
Expand Down

0 comments on commit ec6d4cd

Please sign in to comment.