Skip to content

Commit

Permalink
Added SCRAM stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Jan 26, 2010
1 parent eb07c0b commit 84163fd
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 63 deletions.
10 changes: 9 additions & 1 deletion Host/Source/Host.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
AdditionalIncludeDirectories="$(IntDir);../kfw-3.2.2-final/inc/krb5/"
AdditionalIncludeDirectories="$(IntDir)"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_MT;i386"
StringPooling="true"
ExceptionHandling="1"
Expand Down Expand Up @@ -465,6 +465,14 @@
RelativePath=".\SASL.h"
>
</File>
<File
RelativePath=".\SCRAM.cpp"
>
</File>
<File
RelativePath=".\SCRAM.h"
>
</File>
<File
RelativePath=".\SSPI.cpp"
>
Expand Down
12 changes: 10 additions & 2 deletions Host/Source/Pandion.idl
Original file line number Diff line number Diff line change
Expand Up @@ -443,17 +443,25 @@ library PandionLib
[in] BSTR nc,
[in] BSTR qop,
[out,retval] BSTR* strDigest);
[propget] HRESULT SCRAM([out, retval] VARIANT* pDispatch);
[propget] HRESULT SSPI([out, retval] VARIANT* pDispatch);
[propget] HRESULT GSSAPI([out, retval] VARIANT* pDispatch);
}
[uuid(D589A536-0A43-11DF-97E6-DDC756D89593)]
interface ISCRAM : IDispatch
{
HRESULT GenerateResponse(
[in] BSTR Challenge,
[out, retval] BSTR* Response);
}
[uuid(D4C00020-E57A-434e-9289-937C53CC07ED)]
interface ISSPI : IDispatch
{
HRESULT Reset();
HRESULT GenerateResponse(
[in] BSTR Challenge,
[out] BOOL* Continue,
[out,retval] BSTR* Response);
[out, retval] BSTR* Response);
}
[uuid(5FA5AC97-F9E0-4ea0-A1BD-2957A331FF47)]
interface IGSSAPI : IDispatch
Expand All @@ -462,7 +470,7 @@ library PandionLib
HRESULT GenerateResponse(
[in] BSTR ServerName,
[in] BSTR Challenge,
[out,retval] BSTR* Response);
[out, retval] BSTR* Response);
}
[uuid(3AA4A7CE-829F-4b24-BB86-D96A23084F51)]
interface IShortcut : IDispatch
Expand Down
5 changes: 5 additions & 0 deletions Host/Source/SASL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ STDMETHODIMP SASL::DigestGenerateResponse(BSTR username, BSTR realm,

return S_OK;
}
STDMETHODIMP SASL::get_SCRAM(VARIANT* pDispatch)
{
pDispatch->vt = VT_DISPATCH;
return m_SCRAM.QueryInterface(IID_IDispatch, (void**)&pDispatch->pdispVal);
}
STDMETHODIMP SASL::get_SSPI(VARIANT* pDispatch)
{
pDispatch->vt = VT_DISPATCH;
Expand Down
3 changes: 3 additions & 0 deletions Host/Source/SASL.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
*/
#pragma once
#include "DispInterfaceImpl.h"
#include "SCRAM.h"
#include "SSPI.h"
#include "GSSAPI.h"

class SASL :
public DispInterfaceImpl<ISASL>
{
private:
SCRAM m_SCRAM;
SSPI m_SSPI;
GSSAPI m_GSSAPI;
public:
Expand All @@ -39,6 +41,7 @@ class SASL :
STDMETHOD(DigestGenerateResponse)(
BSTR username, BSTR realm, BSTR password, BSTR nonce,
BSTR cnonce, BSTR digest_uri, BSTR nc, BSTR qop, BSTR *strDigest);
STDMETHOD(get_SCRAM)(VARIANT* pDispatch);
STDMETHOD(get_SSPI)(VARIANT* pDispatch);
STDMETHOD(get_GSSAPI)(VARIANT* pDispatch);

Expand Down
53 changes: 53 additions & 0 deletions Host/Source/SCRAM.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* This file is part of Pandion.
*
* Pandion is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pandion 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Pandion. If not, see <http://www.gnu.org/licenses/>.
*
* Filename: SCRAM.cpp
* Author(s): Dries Staelens
* Copyright: Copyright (c) 2009 Dries Staelens
* Description: This file implements some helper methods for authenticating
* using the Salted Challenge Response (SCRAM) SASL mechanism.
* See http://tools.ietf.org/html/draft-ietf-sasl-scram-10
*/
#include "stdafx.h"
#include "SCRAM.h"
#include "Base64.h"
#include "UTF8.h"

SCRAM::SCRAM()
{
}
SCRAM::~SCRAM()
{
}
STDMETHODIMP SCRAM::GenerateResponse(BSTR Challenge, BSTR *Response)
{
return E_NOTIMPL;
}
void SCRAM::Error(LPWSTR Where, LPWSTR WhenCalling, DWORD ErrorCode)
{
LPTSTR ErrorMessage;
::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK,
NULL, ErrorCode, 0, (LPTSTR)&ErrorMessage, 0, NULL);
std::wostringstream dbgMsg;
dbgMsg << L"SCRAM error in " << Where <<
L" when calling " << WhenCalling <<
std::hex << std::setw(8) << std::setfill(L'0') <<
L": (ERROR 0x" << ErrorCode << L") " <<
ErrorMessage << std::endl;
OutputDebugString(dbgMsg.str().c_str());
::LocalFree(ErrorMessage);
}
38 changes: 38 additions & 0 deletions Host/Source/SCRAM.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* This file is part of Pandion.
*
* Pandion is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pandion 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Pandion. If not, see <http://www.gnu.org/licenses/>.
*
* Filename: SCRAM.h
* Author(s): Dries Staelens
* Copyright: Copyright (c) 2010 Dries Staelens
* Description: This header defines some helper methods for authenticating
* using the Salted Challenge Response (SCRAM) SASL mechanism.
* See http://tools.ietf.org/html/draft-ietf-sasl-scram-10
*/

#pragma once
#include "DispInterfaceImpl.h"

class SCRAM :
public DispInterfaceImpl<ISCRAM>
{
public:
SCRAM();
~SCRAM();

STDMETHOD(GenerateResponse)(BSTR Challenge, BSTR *Response);
private:
void Error(LPWSTR Where, LPWSTR WhenCalling, DWORD ErrorCode);
};
Binary file removed Host/zlib-1.2.3.win32/lib/zdll.exp
Binary file not shown.
Binary file removed Host/zlib-1.2.3.win32/lib/zdll.lib
Binary file not shown.
60 changes: 0 additions & 60 deletions Host/zlib-1.2.3.win32/lib/zlib.def

This file was deleted.

Binary file removed Host/zlib-1.2.3.win32/lib/zlib.lib
Binary file not shown.
Binary file removed Host/zlib-1.2.3.win32/test/example_d.exe
Binary file not shown.
Binary file removed Host/zlib-1.2.3.win32/test/foo.gz
Binary file not shown.
Binary file removed Host/zlib-1.2.3.win32/test/minigzip_d.exe
Binary file not shown.
Binary file removed Host/zlib-1.2.3.win32/test/testzlib_d.exe
Binary file not shown.
Binary file removed Host/zlib-1.2.3.win32/test/untgz_d.exe
Binary file not shown.
Binary file removed Host/zlib-1.2.3.win32/zlib1.dll
Binary file not shown.

0 comments on commit 84163fd

Please sign in to comment.