Changes due to continued development effort.

This commit is contained in:
Juan Carlos Luciani 2006-04-28 20:57:31 +00:00
parent 47f4dbb6b7
commit ad7eea8933
4 changed files with 75 additions and 28 deletions

View File

@ -61,7 +61,7 @@ BOOL APIENTRY DllMain(
if (InitializeLibrary() != 0)
{
// Failed to initialize the library
OutputDebugString("CASA_PW_MECH -DllMain- Library initialization failed\n");
OutputDebugString("CASA_KRB5_MECH -DllMain- Library initialization failed\n");
retStatus = FALSE;
}
break;

View File

@ -85,16 +85,16 @@ AuthTokenIf_GetAuthToken(
// Description:
// Get authentication token to authenticate user to specified service.
//
// L0
// L2
//=======================================================================--
{
CasaStatus retStatus;
char *pKrbServiceName = pMechInfo;
CasaStatus retStatus;
char *pKrbServiceName = pMechInfo;
SECURITY_STATUS secStatus;
TimeStamp expiry;
CredHandle hCredentials = {0};
DbgTrace(1, "-AuthTokenIf_GetAuthToken- Start\n", 0);
// Validate input parameters
@ -161,7 +161,6 @@ AuthTokenIf_GetAuthToken(
int encodedTokenLen;
// The security context was initialized, now return it to the caller after base64 encoding it.
// The token has been assembled, now encode it.
retStatus = EncodeData(sendTok.pvBuffer,
(const int) sendTok.cbBuffer,
&pEncodedToken,
@ -172,8 +171,6 @@ AuthTokenIf_GetAuthToken(
if (encodedTokenLen > *pTokenBufLen)
{
// The buffer is not big enough
DbgTrace(1, "-AuthTokenIf_GetAuthToken- Insufficient buffer space provided\n", 0);
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
CASA_FACILITY_KRB5TOKEN,
CASA_STATUS_BUFFER_OVERFLOW);
@ -199,9 +196,8 @@ AuthTokenIf_GetAuthToken(
}
else
{
DbgTrace(1, "-AuthTokenIf_GetAuthToken- Failed to obtain the credentials handle, error = %08X\n", secStatus);
DbgTrace(0, "-AuthTokenIf_GetAuthToken- Failed to initialize the security context, error = %08X\n", secStatus);
// tdb - Set retStatus based on secStatus
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
CASA_FACILITY_KRB5TOKEN,
CASA_STATUS_UNSUCCESSFUL);
@ -219,11 +215,20 @@ AuthTokenIf_GetAuthToken(
{
DbgTrace(1, "-AuthTokenIf_GetAuthToken- Failed to obtain the credentials handle, error = %08X\n", secStatus);
// tdb - Set retStatus based on secStatus
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
CASA_FACILITY_KRB5TOKEN,
CASA_STATUS_NO_CREDENTIALS);
// Set retStatus based on secStatus
if (secStatus == SEC_E_NOT_OWNER
|| secStatus == SEC_E_NO_CREDENTIALS)
{
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
CASA_FACILITY_KRB5TOKEN,
CASA_STATUS_NO_CREDENTIALS);
}
else
{
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
CASA_FACILITY_KRB5TOKEN,
CASA_STATUS_UNSUCCESSFUL);
}
}
exit:
@ -246,13 +251,14 @@ InitializeLibrary(void)
//
// Notes:
//
// L0
// L2
//=======================================================================--
{
int retStatus = 0;
DbgTrace(1, "-InitializeLibrary- Start\n", 0);
// Nothing to do at this time.
DbgTrace(1, "-InitializeLibrary- End, retStatus = %08X\n", retStatus);

View File

@ -0,0 +1,35 @@
/***********************************************************************
*
* Copyright (C) 2006 Novell, Inc. All Rights Reserved.
*
* 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; version 2.1
* of the License.
*
* 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
* Library 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, Novell, Inc.
*
* To contact Novell about this file by physical or electronic mail,
* you may find current contact information at www.novell.com.
*
* Author: Juan Carlos Luciani <jluciani@novell.com>
*
***********************************************************************/
//===[ Include files ]=====================================================
#include "internal.h"
//===[ Type definitions ]==================================================
//===[ Function prototypes ]===============================================
//===[ Global variables ]==================================================

View File

@ -44,18 +44,24 @@
//
// DbgTrace macro define
//
#define DbgTrace(LEVEL, X, Y) { \
char printBuff[256]; \
if (LEVEL == 0) \
{ \
_snprintf(printBuff, sizeof(printBuff), X, Y); \
printf("Krb5Mech %s", printBuff); \
} \
else if (DebugLevel >= LEVEL) \
{ \
_snprintf(printBuff, sizeof(printBuff), X, Y); \
printf("Krb5Mech %s", printBuff); \
} \
//#define DbgTrace(LEVEL, X, Y) { \
//char printBuff[256]; \
// if (LEVEL == 0 || DebugLevel >= LEVEL) \
// { \
// _snprintf(printBuff, sizeof(printBuff), X, Y); \
// printf("Krb5Mech %s", printBuff); \
// } \
//}
#define DbgTrace(LEVEL, X, Y) { \
char formatBuff[128]; \
char printBuff[256]; \
if (LEVEL == 0 || DebugLevel >= LEVEL) \
{ \
strcpy(formatBuff, "Krb5Mech "); \
strncat(formatBuff, X, sizeof(formatBuff) - 9); \
_snprintf(printBuff, sizeof(printBuff), formatBuff, Y); \
OutputDebugString(printBuff); \
} \
}
#define bool BOOLEAN