MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / ValidateNamedPipeConnection

Function ValidateNamedPipeConnection

libipc/certutil.cpp:241–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241bool ValidateNamedPipeConnection(DWORD remote_pid)
242{
243 wstring exePathSelf;
244
245 if (!GetExePathFromProcessId(GetCurrentProcessId(), exePathSelf)) {
246 return false;
247 }
248
249 if (!VerifyEmbeddedSignature(exePathSelf.c_str())) {
250 // if we aren't signed, then allow the other end to not be signed
251 return true;
252 }
253
254 wstring cnSelf;
255
256 if (GetCommonName(exePathSelf.c_str(), cnSelf) != 0) {
257 return false;
258 }
259
260 if (cnSelf.length() < 1) {
261 return false;
262 }
263
264 wstring exePathRemote;
265
266 if (!GetExePathFromProcessId(remote_pid, exePathRemote)) {
267 return false;
268 }
269
270 if (!VerifyEmbeddedSignature(exePathRemote.c_str())) {
271 return false;
272 }
273
274 wstring cnRemote;
275
276 if (GetCommonName(exePathRemote.c_str(), cnRemote) != 0) {
277 return false;
278 }
279
280 return cnRemote == cnSelf;
281}
282

Callers 2

OnCopyDataMethod · 0.85

Calls 3

GetExePathFromProcessIdFunction · 0.85
GetCommonNameFunction · 0.85
VerifyEmbeddedSignatureFunction · 0.70

Tested by

no test coverage detected