[commit] r2367 - trunk/Tests/svngui
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Fri Sep 27 13:49:15 CDT 2013
Author: volgy
Date: Fri Sep 27 13:49:15 2013
New Revision: 2367
Log:
Auth callbacks are ready. Giving up on finding memory problems in serf.
Added:
trunk/Tests/svngui/SVNDialogLogin.cpp
trunk/Tests/svngui/SVNDialogLogin.h
Modified:
trunk/Tests/svngui/Resource.h
trunk/Tests/svngui/SVNClient.cpp
trunk/Tests/svngui/SVNClient.h
trunk/Tests/svngui/SVNDialogSSLServerTrust.cpp
trunk/Tests/svngui/svngui.rc
trunk/Tests/svngui/svngui.vcxproj
trunk/Tests/svngui/svngui.vcxproj.filters
Modified: trunk/Tests/svngui/Resource.h
==============================================================================
Binary files trunk/Tests/svngui/Resource.h Thu Sep 26 17:32:05 2013 (r2366) and trunk/Tests/svngui/Resource.h Fri Sep 27 13:49:15 2013 (r2367) differ
Modified: trunk/Tests/svngui/SVNClient.cpp
==============================================================================
--- trunk/Tests/svngui/SVNClient.cpp Thu Sep 26 17:32:05 2013 (r2366)
+++ trunk/Tests/svngui/SVNClient.cpp Fri Sep 27 13:49:15 2013 (r2367)
@@ -3,7 +3,6 @@
#include "svngui.h"
#include "SVNClient.h"
-#include "svn_pools.h"
#include "svn_dso.h"
#include "svn_utf.h"
#include "svn_nls.h"
@@ -14,6 +13,7 @@
#include "SVNDialogCommit.h"
#include "SVNDialogPlaintext.h"
#include "SVNDialogSSLServerTrust.h"
+#include "SVNDialogLogin.h"
#pragma comment(lib, "advapi32.lib")
#pragma comment(lib, "shfolder.lib")
@@ -88,6 +88,28 @@
}
///////////////////////////////////////////////////////////////////////
+// SVN Pool
+///////////////////////////////////////////////////////////////////////
+CSVNPool::CSVNPool(apr_pool_t* parentPool)
+{
+ pool = svn_pool_create(parentPool);
+}
+
+CSVNPool::~CSVNPool()
+{
+ if (pool) {
+ svn_pool_destroy(pool);
+ pool = NULL;
+ }
+}
+
+CSVNPool::operator apr_pool_ptr() const
+{
+ return pool;
+}
+
+
+///////////////////////////////////////////////////////////////////////
// SVN Client
///////////////////////////////////////////////////////////////////////
CSVNClient::CSVNClient()
@@ -103,7 +125,10 @@
while (p) {
delete svnFiles.GetNext(p);
}
-
+ // NOTE: there is a memory allocation problem in serf
+ // it causes problems when SSL certificates are rejected during conn. setup
+ // svn_pool_destroy mitigates this problem (memory leaks "only" instead of accessing freed memory)
+ svn_pool_destroy(pool);
apr_terminate();
}
@@ -138,7 +163,7 @@
pool = svn_pool_create(NULL);
/* Initialize the FS library. */
- SVNTHROW(svn_fs_initialize(pool));
+ //SVNTHROW(svn_fs_initialize(pool));
/* Initialize the RA library. */
SVNTHROW(svn_ra_initialize(pool));
@@ -149,15 +174,17 @@
/* All clients need to fill out a client_ctx object. */
{
+ apr_hash_t *cfg_hash;
svn_config_t *cfg_config;
- /* Initialize and allocate the client_ctx object. */
- SVNTHROW(svn_client_create_context (&ctx, pool));
-
/* Load the run-time config file into a hash */
- SVNTHROW(svn_config_get_config (&(ctx->config), NULL, pool));
+ SVNTHROW(svn_config_get_config (&cfg_hash, NULL, pool));
+
+ cfg_config = (svn_config_t *)svn_hash_gets(cfg_hash, SVN_CONFIG_CATEGORY_CONFIG);
+
+ /* Initialize and allocate the client_ctx object. */
+ SVNTHROW(svn_client_create_context2(&ctx, cfg_hash, pool));
- cfg_config = (svn_config_t *)svn_hash_gets(ctx->config, SVN_CONFIG_CATEGORY_CONFIG);
/* Set the working copy administrative directory name. */
if (getenv ("SVN_ASP_DOT_NET_HACK"))
@@ -380,12 +407,23 @@
svn_boolean_t may_save,
apr_pool_t *pool)
{
- //TODO: implement this
- svn_auth_cred_simple_t *ret = (svn_auth_cred_simple_t *)apr_pcalloc(pool, sizeof(*ret));
- ret->username = "volgy";
- ret->password = "7torpe";
- ret->may_save = may_save;
- *cred = ret;
+ CSVNDialogLogin dlg;
+ dlg.realm = realm;
+ dlg.passwordEnabled = TRUE;
+ dlg.permanentEnabled = may_save;
+
+ if (dlg.DoModal() == IDOK) {
+ svn_auth_cred_simple_t *ret = (svn_auth_cred_simple_t *)apr_pcalloc(pool, sizeof(*ret));
+ svn_string_t* username_s = svn_string_create(CStringA(dlg.username), pool);
+ ret->username = username_s ? username_s->data : NULL;
+ svn_string_t* password_s = svn_string_create(CStringA(dlg.password), pool);
+ ret->password = password_s ? password_s->data : NULL;
+ ret->may_save = dlg.permanent;
+ *cred = ret;
+ }
+ else {
+ *cred = NULL;
+ }
return SVN_NO_ERROR;
}
@@ -396,10 +434,21 @@
svn_boolean_t may_save,
apr_pool_t *pool)
{
- //TODO: implement this
- svn_auth_cred_username_t *ret = (svn_auth_cred_username_t *)apr_pcalloc(pool, sizeof(*ret));
- ret->username = NULL;
- ret->may_save = may_save;
+ CSVNDialogLogin dlg;
+ dlg.realm = realm;
+ dlg.passwordEnabled = FALSE;
+ dlg.permanentEnabled = may_save;
+
+ if (dlg.DoModal() == IDOK) {
+ svn_auth_cred_username_t *ret = (svn_auth_cred_username_t *)apr_pcalloc(pool, sizeof(*ret));
+ svn_string_t* username_s = svn_string_create(CStringA(dlg.username), pool);
+ ret->username = username_s ? username_s->data : NULL;
+ ret->may_save = dlg.permanent;
+ *cred = ret;
+ }
+ else {
+ *cred = NULL;
+ }
return SVN_NO_ERROR;
}
@@ -412,7 +461,6 @@
svn_boolean_t may_save,
apr_pool_t *pool)
{
- /*
CSVNDialogSSLServerTrust dlg;
dlg.host = cert_info->hostname;
dlg.fingerprint = cert_info->fingerprint;
@@ -444,12 +492,7 @@
else {
*cred = NULL;
}
- */
-svn_auth_cred_ssl_server_trust_t *ret = (svn_auth_cred_ssl_server_trust_t *)apr_pcalloc(pool, sizeof(*ret));
-ret->accepted_failures = failures;
-ret->may_save = FALSE;
-*cred = ret;
return SVN_NO_ERROR;
}
@@ -460,10 +503,8 @@
svn_boolean_t may_save,
apr_pool_t *pool)
{
- //TODO: implement this
- svn_auth_cred_ssl_client_cert_pw_t *ret = (svn_auth_cred_ssl_client_cert_pw_t *)apr_pcalloc(pool, sizeof(*ret));
- ret->password = NULL;
- ret->may_save = may_save;
+ // Unsupported
+ *cred = NULL;
return SVN_NO_ERROR;
}
@@ -474,10 +515,8 @@
svn_boolean_t may_save,
apr_pool_t *pool)
{
- //TODO: implement this
- svn_auth_cred_ssl_client_cert_t *ret = (svn_auth_cred_ssl_client_cert_t *)apr_pcalloc(pool, sizeof(*ret));
- ret->cert_file = NULL;
- ret->may_save = may_save;
+ // Unsupported
+ *cred = NULL;
return SVN_NO_ERROR;
}
@@ -499,15 +538,13 @@
svn_error_t* e;
if (client->isInitialized) {
- apr_pool_t* scratch_pool = svn_pool_create(client->pool);
+ CSVNPool scratch_pool(client->pool);
svn_opt_revision_t revision = {svn_opt_revision_head, {0}};
e = svn_client_status5(NULL, client->ctx, CStringA(filePath),
&revision, svn_depth_immediates, TRUE, checkServer ? TRUE : FALSE,
FALSE, FALSE, TRUE, NULL, cbStatus, this, scratch_pool);
-apr_terminate();
- svn_pool_clear(scratch_pool);
if (e && e->apr_err == SVN_ERR_WC_NOT_WORKING_COPY) {
versioned = tracked = owned = latest = false;
@@ -547,7 +584,7 @@
{
CStringA filePathA(filePath);
const char* target = filePathA;
- apr_pool_t* scratch_pool = svn_pool_create(client->pool);
+ CSVNPool scratch_pool(client->pool);
apr_array_header_t* targets = apr_array_make(scratch_pool, 1, sizeof(target));
APR_ARRAY_PUSH(targets, const char*) = target;
@@ -556,8 +593,6 @@
SVNTHROW(svn_client_update4(NULL, targets, &revision, svn_depth_files, FALSE, FALSE, FALSE,
TRUE, FALSE, client->ctx, scratch_pool));
- svn_pool_clear(scratch_pool);
-
return (client->lastNotifyAction == svn_wc_notify_update_completed);
}
@@ -565,13 +600,11 @@
{
CStringA filePathA(filePath);
const char* target = filePathA;
- apr_pool_t* scratch_pool = svn_pool_create(client->pool);
+ CSVNPool scratch_pool(client->pool);
apr_array_header_t* targets = apr_array_make(scratch_pool, 1, sizeof(target));
APR_ARRAY_PUSH(targets, const char*) = target;
SVNTHROW(svn_client_lock(targets, "GME auto-locking", FALSE, client->ctx, scratch_pool));
-
- svn_pool_clear(scratch_pool);
return (client->lastNotifyAction == svn_wc_notify_locked);
}
@@ -580,7 +613,7 @@
{
CStringA filePathA(filePath);
const char* target = filePathA;
- apr_pool_t* scratch_pool = svn_pool_create(client->pool);
+ CSVNPool scratch_pool(client->pool);
apr_array_header_t* targets = apr_array_make(scratch_pool, 1, sizeof(target));
APR_ARRAY_PUSH(targets, const char*) = target;
@@ -596,8 +629,6 @@
}
}
- svn_pool_clear(scratch_pool);
-
return !client->canceledOperation;
}
Modified: trunk/Tests/svngui/SVNClient.h
==============================================================================
--- trunk/Tests/svngui/SVNClient.h Thu Sep 26 17:32:05 2013 (r2366)
+++ trunk/Tests/svngui/SVNClient.h Fri Sep 27 13:49:15 2013 (r2367)
@@ -2,6 +2,7 @@
#include "svn_client.h"
#include "svn_config.h"
+#include "svn_pools.h"
class CSVNClient;
@@ -14,6 +15,7 @@
private:
CSVNError(svn_error_t* e);
+ CSVNError(const CSVNError&) {ASSERT(("Copying CVSNError objects are not supported", false));}
public:
virtual ~CSVNError();
@@ -23,6 +25,19 @@
svn_error_t *svnError;
};
+class CSVNPool
+{
+ typedef apr_pool_t* apr_pool_ptr;
+public:
+ CSVNPool(apr_pool_t* parentPool);
+ CSVNPool(const CSVNPool&) {ASSERT(("Copying CSVNPool objects are not supported", false));}
+ virtual ~CSVNPool();
+
+ operator apr_pool_ptr() const;
+
+private:
+ apr_pool_ptr pool;
+};
class CSVNFile
{
Added: trunk/Tests/svngui/SVNDialogLogin.cpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/svngui/SVNDialogLogin.cpp Fri Sep 27 13:49:15 2013 (r2367)
@@ -0,0 +1,60 @@
+// SVNDialogLogin.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "svngui.h"
+#include "SVNDialogLogin.h"
+#include "afxdialogex.h"
+
+
+// CSVNDialogLogin dialog
+
+IMPLEMENT_DYNAMIC(CSVNDialogLogin, CDialogEx)
+
+CSVNDialogLogin::CSVNDialogLogin(CWnd* pParent /*=NULL*/)
+ : CDialogEx(CSVNDialogLogin::IDD, pParent)
+ , realm(_T(""))
+ , username(_T(""))
+ , password(_T(""))
+{
+
+}
+
+CSVNDialogLogin::~CSVNDialogLogin()
+{
+}
+
+void CSVNDialogLogin::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+ DDX_Check(pDX, IDC_CHECK_PERMANENT, permanent);
+ DDX_Text(pDX, IDC_EDIT_REALM, realm);
+ DDX_Text(pDX, IDC_EDIT_USERNAME, username);
+ DDX_Text(pDX, IDC_EDIT_PASSWORD, password);
+}
+
+
+BEGIN_MESSAGE_MAP(CSVNDialogLogin, CDialogEx)
+// ON_BN_CLICKED(IDC_CHECK_SAVECREDS, &CSVNDialogLogin::OnBnClickedCheckSavecreds)
+END_MESSAGE_MAP()
+
+
+// CSVNDialogLogin message handlers
+
+
+//void CSVNDialogLogin::OnBnClickedCheckSavecreds()
+//{
+// // TODO: Add your control notification handler code here
+//}
+
+
+BOOL CSVNDialogLogin::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+
+ GetDlgItem(IDC_CHECK_PERMANENT)->EnableWindow(permanentEnabled);
+ GetDlgItem(IDC_EDIT_PASSWORD)->EnableWindow(passwordEnabled);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
Added: trunk/Tests/svngui/SVNDialogLogin.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/svngui/SVNDialogLogin.h Fri Sep 27 13:49:15 2013 (r2367)
@@ -0,0 +1,30 @@
+#pragma once
+
+
+// CSVNDialogLogin dialog
+
+class CSVNDialogLogin : public CDialogEx
+{
+ DECLARE_DYNAMIC(CSVNDialogLogin)
+
+public:
+ CSVNDialogLogin(CWnd* pParent = NULL); // standard constructor
+ virtual ~CSVNDialogLogin();
+
+// Dialog Data
+ enum { IDD = IDD_DIALOG_SVNLOGIN };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+public:
+// afx_msg void OnBnClickedCheckSavecreds();
+ BOOL permanent;
+ CString realm;
+ CString username;
+ CString password;
+ BOOL permanentEnabled;
+ BOOL passwordEnabled;
+ virtual BOOL OnInitDialog();
+};
Modified: trunk/Tests/svngui/SVNDialogSSLServerTrust.cpp
==============================================================================
--- trunk/Tests/svngui/SVNDialogSSLServerTrust.cpp Thu Sep 26 17:32:05 2013 (r2366)
+++ trunk/Tests/svngui/SVNDialogSSLServerTrust.cpp Fri Sep 27 13:49:15 2013 (r2367)
@@ -30,11 +30,11 @@
void CSVNDialogSSLServerTrust::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
- DDX_Text(pDX, IDC_EDIT1, host);
- DDX_Text(pDX, IDC_EDIT2, fingerprint);
- DDX_Text(pDX, IDC_EDIT3, issuer);
- DDX_Text(pDX, IDC_EDIT4, problems);
- DDX_Check(pDX, IDC_CHECK1, permanent);
+ DDX_Text(pDX, IDC_EDIT_HOST, host);
+ DDX_Text(pDX, IDC_EDIT_FINGERPRINT, fingerprint);
+ DDX_Text(pDX, IDC_EDIT_ISSUER, issuer);
+ DDX_Text(pDX, IDC_EDIT_PROBLEMS, problems);
+ DDX_Check(pDX, IDC_CHECK_PERMANENT, permanent);
}
Modified: trunk/Tests/svngui/svngui.rc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: trunk/Tests/svngui/svngui.vcxproj
==============================================================================
--- trunk/Tests/svngui/svngui.vcxproj Thu Sep 26 17:32:05 2013 (r2366)
+++ trunk/Tests/svngui/svngui.vcxproj Fri Sep 27 13:49:15 2013 (r2367)
@@ -144,6 +144,7 @@
<ClInclude Include="stdafx.h" />
<ClInclude Include="SVNClient.h" />
<ClInclude Include="SVNDialogCommit.h" />
+ <ClInclude Include="SVNDialogLogin.h" />
<ClInclude Include="SVNDialogPlaintext.h" />
<ClInclude Include="SVNDialogSSLServerTrust.h" />
<ClInclude Include="svngui.h" />
@@ -160,6 +161,7 @@
</ClCompile>
<ClCompile Include="SVNClient.cpp" />
<ClCompile Include="SVNDialogCommit.cpp" />
+ <ClCompile Include="SVNDialogLogin.cpp" />
<ClCompile Include="SVNDialogPlaintext.cpp" />
<ClCompile Include="SVNDialogSSLServerTrust.cpp" />
<ClCompile Include="svngui.cpp" />
Modified: trunk/Tests/svngui/svngui.vcxproj.filters
==============================================================================
--- trunk/Tests/svngui/svngui.vcxproj.filters Thu Sep 26 17:32:05 2013 (r2366)
+++ trunk/Tests/svngui/svngui.vcxproj.filters Fri Sep 27 13:49:15 2013 (r2367)
@@ -79,6 +79,9 @@
<ClInclude Include="SVNDialogSSLServerTrust.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="SVNDialogLogin.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="svngui.cpp">
@@ -111,6 +114,9 @@
<ClCompile Include="SVNDialogSSLServerTrust.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="SVNDialogLogin.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="svngui.rc">
More information about the gme-commit
mailing list