[10/10] secur32: Implement QueryContextAttributes for Kerberos.
Hans Leidekker
hans at codeweavers.com
Mon Oct 23 04:09:25 CDT 2017
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
dlls/secur32/kerberos.c | 179 ++++++++++++++++++++++++++++++++++--------------
1 file changed, 127 insertions(+), 52 deletions(-)
diff --git a/dlls/secur32/kerberos.c b/dlls/secur32/kerberos.c
index 6180830653..91bdfb4dec 100644
--- a/dlls/secur32/kerberos.c
+++ b/dlls/secur32/kerberos.c
@@ -594,21 +594,144 @@ static SECURITY_STATUS SEC_ENTRY kerberos_DeleteSecurityContext( CtxtHandle *phC
#endif
}
+#define KERBEROS_MAX_BUF 12000
+
+#define KERBEROS_COMMENT \
+ {'M','i','c','r','o','s','o','f','t',' ','K','e','r','b','e','r','o','s',' ','V','1','.','0',0}
+static CHAR kerberos_comment_A[] = KERBEROS_COMMENT;
+static WCHAR kerberos_comment_W[] = KERBEROS_COMMENT;
+
+#define KERBEROS_NAME {'K','e','r','b','e','r','o','s',0}
+static char kerberos_name_A[] = KERBEROS_NAME;
+static WCHAR kerberos_name_W[] = KERBEROS_NAME;
+
+#define KERBEROS_CAPS \
+ ( SECPKG_FLAG_INTEGRITY \
+ | SECPKG_FLAG_PRIVACY \
+ | SECPKG_FLAG_TOKEN_ONLY \
+ | SECPKG_FLAG_DATAGRAM \
+ | SECPKG_FLAG_CONNECTION \
+ | SECPKG_FLAG_MULTI_REQUIRED \
+ | SECPKG_FLAG_EXTENDED_ERROR \
+ | SECPKG_FLAG_IMPERSONATION \
+ | SECPKG_FLAG_ACCEPT_WIN32_NAME \
+ | SECPKG_FLAG_NEGOTIABLE \
+ | SECPKG_FLAG_GSS_COMPATIBLE \
+ | SECPKG_FLAG_LOGON \
+ | SECPKG_FLAG_MUTUAL_AUTH \
+ | SECPKG_FLAG_DELEGATION \
+ | SECPKG_FLAG_READONLY_WITH_CHECKSUM \
+ | SECPKG_FLAG_RESTRICTED_TOKENS)
+
+static const SecPkgInfoW infoW =
+{
+ KERBEROS_CAPS,
+ 1,
+ RPC_C_AUTHN_GSS_KERBEROS,
+ KERBEROS_MAX_BUF,
+ kerberos_name_W,
+ kerberos_comment_W
+};
+
+static const SecPkgInfoA infoA =
+{
+ KERBEROS_CAPS,
+ 1,
+ RPC_C_AUTHN_GSS_KERBEROS,
+ KERBEROS_MAX_BUF,
+ kerberos_name_A,
+ kerberos_comment_A
+};
+
/***********************************************************************
* QueryContextAttributesW
*/
-static SECURITY_STATUS SEC_ENTRY kerberos_QueryContextAttributesW(CtxtHandle *phContext, ULONG ulAttribute, void *pBuffer)
+static SECURITY_STATUS SEC_ENTRY kerberos_QueryContextAttributesW( CtxtHandle *phContext, ULONG ulAttribute,
+ void *pBuffer )
{
- FIXME("(%p %d %p)\n", phContext, ulAttribute, pBuffer);
+ TRACE( "(%p %u %p)\n", phContext, ulAttribute, pBuffer );
+
+ if (!phContext) return SEC_E_INVALID_HANDLE;
+
+ switch(ulAttribute)
+ {
+#define X(x) case (x) : FIXME(#x" stub\n"); break
+ X(SECPKG_ATTR_ACCESS_TOKEN);
+ X(SECPKG_ATTR_AUTHORITY);
+ X(SECPKG_ATTR_DCE_INFO);
+ X(SECPKG_ATTR_KEY_INFO);
+ X(SECPKG_ATTR_LIFESPAN);
+ X(SECPKG_ATTR_NAMES);
+ X(SECPKG_ATTR_NATIVE_NAMES);
+ X(SECPKG_ATTR_PACKAGE_INFO);
+ X(SECPKG_ATTR_PASSWORD_EXPIRY);
+ X(SECPKG_ATTR_SESSION_KEY);
+ X(SECPKG_ATTR_STREAM_SIZES);
+ X(SECPKG_ATTR_TARGET_INFORMATION);
+ case SECPKG_ATTR_SIZES:
+ {
+ SecPkgContext_Sizes *sizes = (SecPkgContext_Sizes*)pBuffer;
+ sizes->cbMaxToken = KERBEROS_MAX_BUF;
+ sizes->cbMaxSignature = 37;
+ sizes->cbBlockSize = 1;
+ sizes->cbSecurityTrailer = 49;
+ return SEC_E_OK;
+ }
+ case SECPKG_ATTR_NEGOTIATION_INFO:
+ {
+ SecPkgContext_NegotiationInfoW *info = (SecPkgContext_NegotiationInfoW *)pBuffer;
+ info->PackageInfo = (SecPkgInfoW *)&infoW;
+ info->NegotiationState = SECPKG_NEGOTIATION_COMPLETE;
+ return SEC_E_OK;
+ }
+#undef X
+ default:
+ FIXME( "unknown attribute %u\n", ulAttribute );
+ break;
+ }
+
return SEC_E_UNSUPPORTED_FUNCTION;
}
/***********************************************************************
* QueryContextAttributesA
*/
-static SECURITY_STATUS SEC_ENTRY kerberos_QueryContextAttributesA(CtxtHandle *phContext, ULONG ulAttribute, void *pBuffer)
+static SECURITY_STATUS SEC_ENTRY kerberos_QueryContextAttributesA( CtxtHandle *phContext, ULONG ulAttribute,
+ void *pBuffer )
{
- FIXME("(%p %d %p)\n", phContext, ulAttribute, pBuffer);
+ TRACE( "(%p %u %p)\n", phContext, ulAttribute, pBuffer );
+
+ if (!phContext) return SEC_E_INVALID_HANDLE;
+
+ switch(ulAttribute)
+ {
+#define X(x) case (x) : FIXME(#x" stub\n"); break
+ X(SECPKG_ATTR_ACCESS_TOKEN);
+ X(SECPKG_ATTR_AUTHORITY);
+ X(SECPKG_ATTR_DCE_INFO);
+ X(SECPKG_ATTR_KEY_INFO);
+ X(SECPKG_ATTR_LIFESPAN);
+ X(SECPKG_ATTR_NAMES);
+ X(SECPKG_ATTR_NATIVE_NAMES);
+ X(SECPKG_ATTR_PACKAGE_INFO);
+ X(SECPKG_ATTR_PASSWORD_EXPIRY);
+ X(SECPKG_ATTR_SESSION_KEY);
+ X(SECPKG_ATTR_STREAM_SIZES);
+ X(SECPKG_ATTR_TARGET_INFORMATION);
+ case SECPKG_ATTR_SIZES: return kerberos_QueryContextAttributesW( phContext, ulAttribute, pBuffer );
+ case SECPKG_ATTR_NEGOTIATION_INFO:
+ {
+ SecPkgContext_NegotiationInfoA *info = (SecPkgContext_NegotiationInfoA *)pBuffer;
+ info->PackageInfo = (SecPkgInfoA *)&infoA;
+ info->NegotiationState = SECPKG_NEGOTIATION_COMPLETE;
+ return SEC_E_OK;
+ }
+#undef X
+ default:
+ FIXME( "unknown attribute %u\n", ulAttribute );
+ break;
+ }
+
return SEC_E_UNSUPPORTED_FUNCTION;
}
@@ -911,54 +1034,6 @@ static const SecurityFunctionTableW kerberosTableW = {
NULL, /* SetContextAttributesW */
};
-#define KERBEROS_MAX_BUF 12000
-
-#define KERBEROS_COMMENT \
- {'M','i','c','r','o','s','o','f','t',' ','K','e','r','b','e','r','o','s',' ','V','1','.','0',0}
-static CHAR kerberos_comment_A[] = KERBEROS_COMMENT;
-static WCHAR kerberos_comment_W[] = KERBEROS_COMMENT;
-
-#define KERBEROS_NAME {'K','e','r','b','e','r','o','s',0}
-static char kerberos_name_A[] = KERBEROS_NAME;
-static WCHAR kerberos_name_W[] = KERBEROS_NAME;
-
-#define CAPS \
- ( SECPKG_FLAG_INTEGRITY \
- | SECPKG_FLAG_PRIVACY \
- | SECPKG_FLAG_TOKEN_ONLY \
- | SECPKG_FLAG_DATAGRAM \
- | SECPKG_FLAG_CONNECTION \
- | SECPKG_FLAG_MULTI_REQUIRED \
- | SECPKG_FLAG_EXTENDED_ERROR \
- | SECPKG_FLAG_IMPERSONATION \
- | SECPKG_FLAG_ACCEPT_WIN32_NAME \
- | SECPKG_FLAG_NEGOTIABLE \
- | SECPKG_FLAG_GSS_COMPATIBLE \
- | SECPKG_FLAG_LOGON \
- | SECPKG_FLAG_MUTUAL_AUTH \
- | SECPKG_FLAG_DELEGATION \
- | SECPKG_FLAG_READONLY_WITH_CHECKSUM \
- | SECPKG_FLAG_RESTRICTED_TOKENS \
- | SECPKG_FLAG_APPCONTAINER_CHECKS)
-
-static const SecPkgInfoW infoW = {
- CAPS,
- 1,
- RPC_C_AUTHN_GSS_KERBEROS,
- KERBEROS_MAX_BUF,
- kerberos_name_W,
- kerberos_comment_W
-};
-
-static const SecPkgInfoA infoA = {
- CAPS,
- 1,
- RPC_C_AUTHN_GSS_KERBEROS,
- KERBEROS_MAX_BUF,
- kerberos_name_A,
- kerberos_comment_A
-};
-
void SECUR32_deinitKerberosSP(void)
{
#ifdef SONAME_LIBGSSAPI_KRB5
--
2.11.0
More information about the wine-patches
mailing list