Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
976c6ff3
Commit
976c6ff3
authored
Nov 03, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Nov 04, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Correct reference counting when deleting contexts from collections.
parent
92324ab3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
6 deletions
+50
-6
collectionstore.c
dlls/crypt32/collectionstore.c
+28
-6
store.c
dlls/crypt32/tests/store.c
+22
-0
No files found.
dlls/crypt32/collectionstore.c
View file @
976c6ff3
...
...
@@ -255,11 +255,19 @@ static BOOL CRYPT_CollectionDeleteCert(PWINECRYPT_CERTSTORE store,
void
*
pCertContext
)
{
BOOL
ret
;
PCCERT_CONTEXT
linked
;
TRACE
(
"(%p, %p)
\n
"
,
store
,
pCertContext
);
ret
=
CertDeleteCertificateFromStore
(
Context_GetLinkedContext
(
pCertContext
,
sizeof
(
CERT_CONTEXT
)));
/* Deleting the linked context results in its ref count getting
* decreased, but the caller of this (CertDeleteCertificateFromStore) also
* decreases pCertContext's ref count, by calling
* CertFreeCertificateContext. Increase ref count of linked context to
* compensate.
*/
linked
=
Context_GetLinkedContext
(
pCertContext
,
sizeof
(
CERT_CONTEXT
));
CertDuplicateCertificateContext
(
linked
);
ret
=
CertDeleteCertificateFromStore
(
linked
);
return
ret
;
}
...
...
@@ -333,11 +341,18 @@ static BOOL CRYPT_CollectionDeleteCRL(PWINECRYPT_CERTSTORE store,
void
*
pCrlContext
)
{
BOOL
ret
;
PCCRL_CONTEXT
linked
;
TRACE
(
"(%p, %p)
\n
"
,
store
,
pCrlContext
);
ret
=
CertDeleteCRLFromStore
(
Context_GetLinkedContext
(
pCrlContext
,
sizeof
(
CRL_CONTEXT
)));
/* Deleting the linked context results in its ref count getting
* decreased, but the caller of this (CertDeleteCRLFromStore) also
* decreases pCrlContext's ref count, by calling CertFreeCRLContext.
* Increase ref count of linked context to compensate.
*/
linked
=
Context_GetLinkedContext
(
pCrlContext
,
sizeof
(
CRL_CONTEXT
));
CertDuplicateCRLContext
(
linked
);
ret
=
CertDeleteCRLFromStore
(
linked
);
return
ret
;
}
...
...
@@ -411,11 +426,18 @@ static BOOL CRYPT_CollectionDeleteCTL(PWINECRYPT_CERTSTORE store,
void
*
pCtlContext
)
{
BOOL
ret
;
PCCTL_CONTEXT
linked
;
TRACE
(
"(%p, %p)
\n
"
,
store
,
pCtlContext
);
ret
=
CertDeleteCTLFromStore
(
Context_GetLinkedContext
(
pCtlContext
,
sizeof
(
CTL_CONTEXT
)));
/* Deleting the linked context results in its ref count getting
* decreased, but the caller of this (CertDeleteCTLFromStore) also
* decreases pCtlContext's ref count, by calling CertFreeCTLContext.
* Increase ref count of linked context to compensate.
*/
linked
=
Context_GetLinkedContext
(
pCtlContext
,
sizeof
(
CTL_CONTEXT
));
CertDuplicateCTLContext
(
linked
);
ret
=
CertDeleteCTLFromStore
(
linked
);
return
ret
;
}
...
...
dlls/crypt32/tests/store.c
View file @
976c6ff3
...
...
@@ -574,6 +574,28 @@ static void testCollectionStore(void)
CertCloseStore
(
collection
,
0
);
CertCloseStore
(
store2
,
0
);
CertCloseStore
(
store1
,
0
);
/* Test adding certificates to and deleting certificates from collections.
*/
store1
=
CertOpenSystemStoreA
(
0
,
"My"
);
collection
=
CertOpenStore
(
CERT_STORE_PROV_COLLECTION
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
ret
=
CertAddEncodedCertificateToStore
(
store1
,
X509_ASN_ENCODING
,
bigCert
,
sizeof
(
bigCert
),
CERT_STORE_ADD_ALWAYS
,
&
context
);
ok
(
ret
,
"CertAddEncodedCertificateToStore failed: %08x
\n
"
,
GetLastError
());
CertDeleteCertificateFromStore
(
context
);
CertAddStoreToCollection
(
collection
,
store1
,
CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG
,
0
);
ret
=
CertAddEncodedCertificateToStore
(
collection
,
X509_ASN_ENCODING
,
bigCert
,
sizeof
(
bigCert
),
CERT_STORE_ADD_ALWAYS
,
&
context
);
ok
(
ret
,
"CertAddEncodedCertificateToStore failed: %08x
\n
"
,
GetLastError
());
CertDeleteCertificateFromStore
(
context
);
CertCloseStore
(
collection
,
0
);
CertCloseStore
(
store1
,
0
);
}
/* Looks for the property with ID propID in the buffer buf. Returns a pointer
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment