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

Function DenyOtherSession

cppcryptfs/dokan/cryptdokan.cpp:173–209  ·  view source on GitHub ↗

deny other users based on SessionId

Source from the content-addressed store, hash-verified

171
172// deny other users based on SessionId
173static bool DenyOtherSession(const CryptContext* con, PDOKAN_FILE_INFO DokanFileInfo)
174{
175 if (!con->m_denyOtherSessions && !con->m_denyServices) {
176 return false;
177 } else {
178 DWORD theirSessionId = 0xffffffff;
179 if (!GetSessionIdFromDokanFileInfo(DokanFileInfo, theirSessionId)) {
180 const DWORD lastErr = GetLastError();
181 DbgPrint(L"Unable to get sessionId for remote process, LastErr = %u\n", lastErr);
182 return true;
183 }
184
185 // session id 0 is for services like AV
186 if (theirSessionId == 0) {
187 const auto result = con->m_denyServices;
188 if (result) {
189 DbgPrint(L"Denied access by a service\n");
190 }
191 return result;
192 }
193
194 if (!con->m_denyOtherSessions) {
195 return false;
196 }
197
198 if (g_GotSessionId) {
199 const auto result = theirSessionId != g_SessionId;
200 if (result) {
201 DbgPrint(L"Denied access by other session\n");
202 }
203 return result;
204 } else {
205 DbgPrint(L"Denied access because deny other sessions in effect but were unable to obtain our session id\n");
206 return true;
207 }
208 }
209}
210
211static void PrintUserName(PDOKAN_FILE_INFO DokanFileInfo) {
212

Callers 1

Calls 2

DbgPrintFunction · 0.85

Tested by

no test coverage detected