MCPcopy Create free account
hub / github.com/mhammond/pywin32 / GetAnonymousToken

Method GetAnonymousToken

isapi/src/PyExtensionObjects.cpp:681–710  ·  view source on GitHub ↗

@pymethod int|EXTENSION_CONTROL_BLOCK|GetAnonymousToken|Calls ServerSupportFunction with HSE_REQ_GET_ANONYMOUS_TOKEN or HSE_REQ_GET_UNICODE_ANONYMOUS_TOKEN

Source from the content-addressed store, hash-verified

679
680// @pymethod int|EXTENSION_CONTROL_BLOCK|GetAnonymousToken|Calls ServerSupportFunction with HSE_REQ_GET_ANONYMOUS_TOKEN or HSE_REQ_GET_UNICODE_ANONYMOUS_TOKEN
681PyObject * PyECB::GetAnonymousToken(PyObject *self, PyObject *args)
682{
683 PyECB * pecb = (PyECB *) self;
684 if (!pecb || !pecb->Check()) return NULL;
685 EXTENSION_CONTROL_BLOCK *ecb = pecb->m_pcb->GetECB();
686
687 PyObject *obStr;
688 // @pyparm string/unicode|metabase_path||
689 if (!PyArg_ParseTuple(args, "O:GetImpersonationToken", &obStr))
690 return NULL;
691 HANDLE handle;
692 BOOL bRes;
693 if (PyString_Check(obStr)) {
694 Py_BEGIN_ALLOW_THREADS
695 bRes = ecb->ServerSupportFunction(ecb->ConnID, HSE_REQ_GET_ANONYMOUS_TOKEN,
696 PyString_AS_STRING(obStr),
697 (DWORD *)&handle,NULL);
698 Py_END_ALLOW_THREADS
699 } else if (PyUnicode_Check(obStr)) {
700 Py_BEGIN_ALLOW_THREADS
701 bRes = ecb->ServerSupportFunction(ecb->ConnID, HSE_REQ_GET_UNICODE_ANONYMOUS_TOKEN,
702 PyUnicode_AS_UNICODE(obStr),
703 (DWORD *)&handle,NULL);
704 Py_END_ALLOW_THREADS
705 } else
706 return PyErr_Format(PyExc_TypeError, "must pass a string or unicode object (got %s)", obStr->ob_type->tp_name);
707 if (!bRes)
708 return SetPyECBError("ServerSupportFunction(HSE_REQ_GET_IMPERSONATION_TOKEN)");
709 return PyLong_FromVoidPtr(handle);
710}
711
712// @pymethod int|EXTENSION_CONTROL_BLOCK|IsKeepConn|Calls ServerSupportFunction with HSE_REQ_IS_KEEP_CONN
713PyObject * PyECB::IsKeepConn(PyObject *self, PyObject *args)

Callers

nothing calls this directly

Calls 4

SetPyECBErrorFunction · 0.85
GetECBMethod · 0.80
ServerSupportFunctionMethod · 0.80
CheckMethod · 0.45

Tested by

no test coverage detected