502 TRACE(
"%p %p %s 0x%08x %d %d %p %d %p %p %p %p\n", phCredential, phContext,
504 Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
521 TRACE(
"Setting SECURITY_NETWORK_DREP\n");
527 if((phContext ==
NULL) && (pInput ==
NULL))
529 static char helper_protocol[] =
"--helper-protocol=ntlmssp-client-1";
530 static CHAR credentials_argv[] =
"--use-cached-creds";
534 TRACE(
"First time in ISC()\n");
548 TRACE(
"Cred mode = %d\n", ntlm_cred->
mode);
554 client_argv[1] = helper_protocol;
597 client_argv[4] =
NULL;
610 TRACE(
"using cached credentials\n");
613 client_argv[3] = credentials_argv;
614 client_argv[4] =
NULL;
621 client_argv[4] =
NULL;
642 TRACE(
"Converting password to unicode.\n");
650 password ? pwlen : ntlm_cred->
pwlen, unicode_password, passwd_lenW);
665 if(want_flags ==
NULL)
674 if(
strstr(want_flags,
"NTLMSSP_FEATURE_SEAL") ==
NULL)
675 lstrcatA(want_flags,
" NTLMSSP_FEATURE_SEAL");
683 if(
strstr(want_flags,
"NTLMSSP_FEATURE_SIGN") ==
NULL)
684 lstrcatA(want_flags,
" NTLMSSP_FEATURE_SIGN");
690 if(
strstr(want_flags,
"NTLMSSP_FEATURE_SIGN") ==
NULL)
691 lstrcatA(want_flags,
" NTLMSSP_FEATURE_SIGN");
695 if(
strstr(want_flags,
"NTLMSSP_FEATURE_SIGN") ==
NULL)
696 lstrcatA(want_flags,
" NTLMSSP_FEATURE_SIGN");
699 FIXME(
"ISC_REQ_STREAM\n");
718 TRACE(
"Using cached credentials failed.\n");
729 max_len-3, &buffer_len)) !=
SEC_E_OK)
757 ERR(
"Helper doesn't understand new command set. Expect more things to fail.\n");
787 phNewContext->
dwUpper = ctxt_attr;
816 TRACE(
"Helper mode = %d\n", helper->
mode);
821 if (!pInput->pBuffers[input_token_idx].pvBuffer)
827 if(pInput->pBuffers[input_token_idx].cbBuffer > max_len)
829 TRACE(
"pInput->pBuffers[%d].cbBuffer is: %d\n",
831 pInput->pBuffers[input_token_idx].cbBuffer);
836 bin_len = pInput->pBuffers[input_token_idx].cbBuffer;
838 memcpy(
bin, pInput->pBuffers[input_token_idx].pvBuffer, bin_len);
843 max_len-3, &buffer_len)) !=
SEC_E_OK)
869 phNewContext->
dwUpper = ctxt_attr;
879 TRACE(
"no SECBUFFER_TOKEN buffer could be found\n");
881 if ((phContext ==
NULL) && (pInput ==
NULL))
893 pOutput->pBuffers[token_idx].cbBuffer = bin_len;
895 else if (pOutput->pBuffers[token_idx].cbBuffer < bin_len)
897 TRACE(
"out buffer is NULL or has not enough space\n");
899 if ((phContext ==
NULL) && (pInput ==
NULL))
908 if (!pOutput->pBuffers[token_idx].pvBuffer)
910 TRACE(
"out buffer is NULL\n");
912 if ((phContext ==
NULL) && (pInput ==
NULL))
921 pOutput->pBuffers[token_idx].cbBuffer = bin_len;
922 memcpy(pOutput->pBuffers[token_idx].pvBuffer,
bin, bin_len);
926 TRACE(
"Getting negotiated flags\n");
933 TRACE(
"No flags negotiated.\n");
943 TRACE(
"Getting session key\n");
949 TRACE(
"No key negotiated.\n");
955 TRACE(
"Failed to decode session key\n");
970 helper->
crypt.ntlm.seq_num = 0
l;
975 helper->
crypt.ntlm2.send_seal_key, 16);
977 helper->
crypt.ntlm2.recv_seal_key, 16);
978 helper->
crypt.ntlm2.send_seq_no = 0
l;
979 helper->
crypt.ntlm2.recv_seq_no = 0
l;
#define ISC_REQ_SEQUENCE_DETECT
#define SEC_E_INTERNAL_ERROR
arc4_info * SECUR32_arc4Alloc(void)
#define WideCharToMultiByte
struct _NegoHelper * PNegoHelper
struct _NegoHelper::@534 crypt
#define ISC_REQ_EXTENDED_ERROR
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
char * strstr(char *String1, char *String2)
static int ntlm_GetTokenBufferIndex(PSecBufferDesc pMessage)
SECURITY_STATUS encodeBase64(PBYTE in_buf, int in_len, char *out_buf, int max_len, int *out_len)
void cleanup_helper(PNegoHelper helper)
SECURITY_STATUS SECUR32_CreateNTLM2SubKeys(PNegoHelper helper) DECLSPEC_HIDDEN
#define ISC_RET_CONNECTION
#define SEC_E_INSUFFICIENT_MEMORY
static char * ntlm_GetUsernameArg(LPCWSTR userW, INT userW_length)
static char * ntlm_GetDomainArg(LPCWSTR domainW, INT domainW_length)
struct _NtlmCredentials * PNtlmCredentials
SECURITY_STATUS decodeBase64(char *in_buf, int in_len, PBYTE out_buf, int max_len, int *out_len)
#define SEC_I_CONTINUE_NEEDED
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
static BOOL ntlm_GetCachedCredential(const SEC_WCHAR *pszTargetName, PCREDENTIALW *cred)
#define ISC_REQ_INTEGRITY
NET_API_STATUS WINAPI NetWkstaUserGetInfo(LMSTR reserved, DWORD level, PBYTE *bufptr)
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
VOID WINAPI CredFree(PVOID Buffer)
#define ISC_RET_EXTENDED_ERROR
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
#define WC_NO_BEST_FIT_CHARS
#define ISC_RET_MUTUAL_AUTH
#define SEC_E_INVALID_HANDLE
#define ISC_REQ_ALLOCATE_MEMORY
T1_FIELD_DICT_PRIVATE password
#define SEC_E_INVALID_TOKEN
#define memcpy(s1, s2, n)
#define ISC_REQ_USE_DCE_STYLE
#define SECURITY_NETWORK_DREP
#define ISC_REQ_CONNECTION
int WINAPI lstrlenA(LPCSTR lpString)
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
SECURITY_STATUS SECUR32_CreateNTLM1SessionKey(PBYTE password, int len, PBYTE session_key) DECLSPEC_HIDDEN
SECURITY_STATUS run_helper(PNegoHelper helper, char *buffer, unsigned int max_buflen, int *buflen)
#define ISC_RET_USED_DCE_STYLE
#define ISC_REQ_MUTUAL_AUTH
#define SEC_E_BUFFER_TOO_SMALL
#define MultiByteToWideChar
static struct _PeImage bin
int no_cached_credentials
#define ISC_REQ_CONFIDENTIALITY
#define SEC_E_NO_CREDENTIALS
#define ISC_REQ_REPLAY_DETECT
void SECUR32_arc4Init(arc4_info *a4i, const BYTE *key, unsigned int keyLen)
static SERVICE_STATUS status
SECURITY_STATUS fork_helper(PNegoHelper *new_helper, const char *prog, char *const argv[])
#define HeapFree(x, y, z)