MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / accept

Method accept

src/auth/trusted/AuthSspi.cpp:292–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290}
291
292bool AuthSspi::accept(AuthSspi::DataHolder& data)
293{
294 if (! hasCredentials)
295 {
296 data.clear();
297 return false;
298 }
299
300 TimeStamp timeOut;
301
302 char s[BUFSIZE];
303 SecBuffer outputBuffer, inputBuffer;
304 SecBufferDesc outputDesc, inputDesc;
305 makeDesc(outputDesc, outputBuffer, sizeof(s), s);
306 makeDesc(inputDesc, inputBuffer, data.getCount(), data.begin());
307
308 ULONG fContextAttr = 0;
309 SecPkgContext_Names name;
310 SecPkgContext_SessionKey key;
311 SECURITY_STATUS x = fAcceptSecurityContext(
312 &secHndl, hasContext ? &ctxtHndl : 0, &inputDesc, 0,
313 SECURITY_NATIVE_DREP, &ctxtHndl, &outputDesc,
314 &fContextAttr, &timeOut);
315
316 switch (x)
317 {
318 case SEC_E_OK:
319 if (fQueryContextAttributes(&ctxtHndl, SECPKG_ATTR_NAMES, &name) == SEC_E_OK)
320 {
321 ctName = name.sUserName;
322 ctName.upper();
323 fFreeContextBuffer(name.sUserName);
324 wheel = checkAdminPrivilege();
325 }
326
327 if (fQueryContextAttributes(&ctxtHndl, SECPKG_ATTR_SESSION_KEY, &key) == SEC_E_OK)
328 sessionKey.assign(key.SessionKey, key.SessionKeyLength);
329
330 fDeleteSecurityContext(&ctxtHndl);
331 hasContext = false;
332 break;
333
334 case SEC_I_CONTINUE_NEEDED:
335 hasContext = true;
336 break;
337
338 default:
339 if (hasContext)
340 {
341 fDeleteSecurityContext(&ctxtHndl);
342 }
343 hasContext = false;
344 data.clear();
345 return false;
346 }
347
348 if (outputBuffer.cbBuffer)
349 {

Callers 1

authenticateMethod · 0.45

Calls 7

makeDescFunction · 0.85
upperMethod · 0.80
clearMethod · 0.45
getCountMethod · 0.45
beginMethod · 0.45
assignMethod · 0.45
getBufferMethod · 0.45

Tested by

no test coverage detected