lsamode.c 5.65 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
/*
 * LSA-mode functions of the SChannel security provider
 *
 * Copyright 2007 Yuval Fledel
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#include <stdarg.h>

#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "sspi.h"
#include "ntsecapi.h"
#include "ntsecpkg.h"
#include "schannel.h"

#include "wine/debug.h"

WINE_DEFAULT_DEBUG_CHANNEL(schannel);

/***********************************************************************
 *              SpGetInfoUnified
 */
static NTSTATUS WINAPI SpGetInfoUnified(PSecPkgInfoW PackageInfo)
{
    TRACE("(%p)\n", PackageInfo);

    PackageInfo->fCapabilities = SECPKG_FLAG_MUTUAL_AUTH |
        SECPKG_FLAG_INTEGRITY | SECPKG_FLAG_PRIVACY |
        SECPKG_FLAG_CONNECTION | SECPKG_FLAG_MULTI_REQUIRED |
        SECPKG_FLAG_EXTENDED_ERROR | SECPKG_FLAG_IMPERSONATION |
        SECPKG_FLAG_ACCEPT_WIN32_NAME | SECPKG_FLAG_STREAM;
    PackageInfo->wVersion   = 1;
    PackageInfo->wRPCID     = UNISP_RPC_ID;
    PackageInfo->cbMaxToken = 0x4000;
    PackageInfo->Name       = (LPWSTR)UNISP_NAME_W;
    PackageInfo->Comment    = (LPWSTR)UNISP_NAME_W;

    return STATUS_SUCCESS;
}

static SEC_WCHAR schannelCommentW[] = { 'S','c','h','a','n','n','e','l',
     ' ','S','e','c','u','r','i','t','y',' ','P','a','c','k','a','g','e',0 };

/***********************************************************************
 *              SpGetInfoSChannel
 */
static NTSTATUS WINAPI SpGetInfoSChannel(PSecPkgInfoW PackageInfo)
{
    TRACE("(%p)\n", PackageInfo);

    PackageInfo->fCapabilities = SECPKG_FLAG_MUTUAL_AUTH |
        SECPKG_FLAG_INTEGRITY | SECPKG_FLAG_PRIVACY |
        SECPKG_FLAG_CONNECTION | SECPKG_FLAG_MULTI_REQUIRED |
        SECPKG_FLAG_EXTENDED_ERROR | SECPKG_FLAG_IMPERSONATION |
        SECPKG_FLAG_ACCEPT_WIN32_NAME | SECPKG_FLAG_STREAM;
    PackageInfo->wVersion   = 1;
    PackageInfo->wRPCID     = UNISP_RPC_ID;
    PackageInfo->cbMaxToken = 0x4000;
    PackageInfo->Name       = (LPWSTR)SCHANNEL_NAME_W;
    PackageInfo->Comment    = schannelCommentW;

    return STATUS_SUCCESS;
}

static SECPKG_FUNCTION_TABLE secPkgFunctionTable[2] =
{ {
    NULL, /* InitializePackage */
    NULL, /* LsaLogonUser */
    NULL, /* CallPackage */
    NULL, /* LogonTerminated */
    NULL, /* CallPackageUntrusted */
    NULL, /* CallPackagePassthrough */
    NULL, /* LogonUserEx */
    NULL, /* LogonUserEx2 */
    NULL, /* Initialize */
    NULL, /* Shutdown */
    SpGetInfoUnified,
    NULL, /* AcceptCredentials */
    NULL, /* SpAcquireCredentialsHandle */
    NULL, /* SpQueryCredentialsAttributes */
    NULL, /* FreeCredentialsHandle */
    NULL, /* SaveCredentials */
    NULL, /* GetCredentials */
    NULL, /* DeleteCredentials */
    NULL, /* InitLsaModeContext */
    NULL, /* AcceptLsaModeContext */
    NULL, /* DeleteContext */
    NULL, /* ApplyControlToken */
    NULL, /* GetUserInfo */
    NULL, /* GetExtendedInformation */
    NULL, /* SpQueryContextAttributes */
    NULL, /* SpAddCredentials */
    NULL, /* SetExtendedInformation */
110
    NULL, /* SetContextAttributes */
111
    NULL, /* SetCredentialsAttributes */
112 113 114 115 116 117
    NULL, /* ChangeAccountPassword */
    NULL, /* QueryMetaData */
    NULL, /* ExchangeMetaData */
    NULL, /* GetCredUIContext */
    NULL, /* UpdateCredentials */
    NULL, /* ValidateTargetInfo */
118
    NULL, /* PostLogonUser */
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
  }, {
    NULL, /* InitializePackage */
    NULL, /* LsaLogonUser */
    NULL, /* CallPackage */
    NULL, /* LogonTerminated */
    NULL, /* CallPackageUntrusted */
    NULL, /* CallPackagePassthrough */
    NULL, /* LogonUserEx */
    NULL, /* LogonUserEx2 */
    NULL, /* Initialize */
    NULL, /* Shutdown */
    SpGetInfoSChannel,
    NULL, /* AcceptCredentials */
    NULL, /* SpAcquireCredentialsHandle */
    NULL, /* SpQueryCredentialsAttributes */
    NULL, /* FreeCredentialsHandle */
    NULL, /* SaveCredentials */
    NULL, /* GetCredentials */
    NULL, /* DeleteCredentials */
    NULL, /* InitLsaModeContext */
    NULL, /* AcceptLsaModeContext */
    NULL, /* DeleteContext */
    NULL, /* ApplyControlToken */
    NULL, /* GetUserInfo */
    NULL, /* GetExtendedInformation */
    NULL, /* SpQueryContextAttributes */
    NULL, /* SpAddCredentials */
    NULL, /* SetExtendedInformation */
147
    NULL, /* SetContextAttributes */
148
    NULL, /* SetCredentialsAttributes */
149 150 151 152 153 154
    NULL, /* ChangeAccountPassword */
    NULL, /* QueryMetaData */
    NULL, /* ExchangeMetaData */
    NULL, /* GetCredUIContext */
    NULL, /* UpdateCredentials */
    NULL, /* ValidateTargetInfo */
155
    NULL, /* PostLogonUser */
156 157 158 159 160 161 162 163 164 165 166
  }
};

/***********************************************************************
 *              SpLsaModeInitialize (SCHANNEL.@)
 */
NTSTATUS WINAPI SpLsaModeInitialize(ULONG LsaVersion, PULONG PackageVersion,
                                    PSECPKG_FUNCTION_TABLE *ppTables, PULONG pcTables)
{
    TRACE("(%u, %p, %p, %p)\n", LsaVersion, PackageVersion, ppTables, pcTables);

167
    *PackageVersion = SECPKG_INTERFACE_VERSION_7;
168 169 170 171 172
    *pcTables = 2;
    *ppTables = secPkgFunctionTable;

    return STATUS_SUCCESS;
}