Added the capability to modify the DebugLevel by changing the various .conf files.

This commit is contained in:
Juan Carlos Luciani 2006-11-18 12:33:14 +00:00
parent f08172971e
commit 66903e98a0
10 changed files with 367 additions and 188 deletions

View File

@ -86,3 +86,18 @@ AllowInvalidCerts true
# THIS FUNCTIONALITY HAS NOT BEEN IMPLEMENTED # THIS FUNCTIONALITY HAS NOT BEEN IMPLEMENTED
# #
#UsersCannotAllowInvalidCerts true #UsersCannotAllowInvalidCerts true
#
# DebugLevel setting.
#
# Description: Used to specify the level of logging utilized for debugging
# purposes. A level of zero being the lowest debugging level.
#
# If this parameter is not set, the client defaults
# to use a debug level of zero.
#
# Note: Debug statements can be viewed under Windows by using
# tools such as DbgView. Under Linux, debug statements are logged
# to /var/log/messages.
#
#DebugLevel 0

View File

@ -480,18 +480,18 @@ ObtainAuthTokenInt(
// fails because the buffer pointed at by pAuthTokenBuf is // fails because the buffer pointed at by pAuthTokenBuf is
// not large enough. // not large enough.
// //
// pCredStoreScope - // pCredStoreScope -
// Pointer to CASA structure for scoping credential store access // Pointer to CASA structure for scoping credential store access
// to specific users. This can only be leveraged by applications // to specific users. This can only be leveraged by applications
// running in the context of System. // running in the context of System.
// Returns: // Returns:
// Casa Status // Casa Status
// //
// Description: // Description:
// Get authentication token to authenticate user to specified // Get authentication token to authenticate user to specified
// service at host. The user is scoped using the info associated // service at host. The user is scoped using the info associated
// with the magic cookie. // with the magic cookie.
// //
// L2 // L2
//=======================================================================-- //=======================================================================--
@ -737,6 +737,7 @@ InitializeLibrary(void)
int retStatus = -1; int retStatus = -1;
int getConfigStatus = -1; int getConfigStatus = -1;
ConfigIf *pClientConfigIf; ConfigIf *pClientConfigIf;
char *pDebugLevelSetting;
char *pATSPortSetting; char *pATSPortSetting;
char *pDisableSecureConnections; char *pDisableSecureConnections;
char *pAllowInvalidCerts; char *pAllowInvalidCerts;
@ -751,6 +752,19 @@ InitializeLibrary(void)
if (CASA_SUCCESS(getConfigStatus) if (CASA_SUCCESS(getConfigStatus)
&& CasaStatusCode(getConfigStatus) != CASA_STATUS_OBJECT_NOT_FOUND) && CasaStatusCode(getConfigStatus) != CASA_STATUS_OBJECT_NOT_FOUND)
{ {
// Check if a DebugLevel has been configured
pDebugLevelSetting = pClientConfigIf->getEntryValue(pClientConfigIf, "DebugLevel");
if (pDebugLevelSetting != NULL)
{
DbgTrace(0, "-InitializeLibrary- DebugLevel configured = %s\n", pDebugLevelSetting);
// Convert the number to hex
DebugLevel = (int) dtoul(pDebugLevelSetting, strlen(pDebugLevelSetting));
// Free the buffer holding the debug level
free(pDebugLevelSetting);
}
// Check if an ATS hostname has been configured // Check if an ATS hostname has been configured
g_pATSHostName = pClientConfigIf->getEntryValue(pClientConfigIf, "ATS-hostname"); g_pATSHostName = pClientConfigIf->getEntryValue(pClientConfigIf, "ATS-hostname");
if (g_pATSHostName != NULL) if (g_pATSHostName != NULL)

View File

@ -149,7 +149,7 @@ GET_AUTH_TOKEN_INTERFACE_RTN(
{ {
CasaStatus retStatus; CasaStatus retStatus;
AuthTokenIfInstance *pAuthTokenIfInstance; AuthTokenIfInstance *pAuthTokenIfInstance;
char *pDebugLevelSetting;
DbgTrace(1, "-GetAuthTokenInterface- Start\n", 0); DbgTrace(1, "-GetAuthTokenInterface- Start\n", 0);
@ -165,6 +165,19 @@ GET_AUTH_TOKEN_INTERFACE_RTN(
goto exit; goto exit;
} }
// Check if a DebugLevel has been configured
pDebugLevelSetting = pModuleConfigIf->getEntryValue(pModuleConfigIf, "DebugLevel");
if (pDebugLevelSetting != NULL)
{
DbgTrace(0, "-GetAuthTokenInterface- DebugLevel configured = %s\n", pDebugLevelSetting);
// Convert the number to hex
DebugLevel = (int) dtoul(pDebugLevelSetting, strlen(pDebugLevelSetting));
// Free the buffer holding the debug level
free(pDebugLevelSetting);
}
// Allocate space for the interface instance // Allocate space for the interface instance
pAuthTokenIfInstance = malloc(sizeof(*pAuthTokenIfInstance)); pAuthTokenIfInstance = malloc(sizeof(*pAuthTokenIfInstance));
if (pAuthTokenIfInstance) if (pAuthTokenIfInstance)

View File

@ -1,92 +1,97 @@
/*********************************************************************** /***********************************************************************
* *
* Copyright (C) 2006 Novell, Inc. All Rights Reserved. * Copyright (C) 2006 Novell, Inc. All Rights Reserved.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; version 2.1 * License as published by the Free Software Foundation; version 2.1
* of the License. * of the License.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library Lesser General Public License for more details. * Library Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, Novell, Inc. * License along with this library; if not, Novell, Inc.
* *
* To contact Novell about this file by physical or electronic mail, * To contact Novell about this file by physical or electronic mail,
* you may find current contact information at www.novell.com. * you may find current contact information at www.novell.com.
* *
* Author: Juan Carlos Luciani <jluciani@novell.com> * Author: Juan Carlos Luciani <jluciani@novell.com>
* *
***********************************************************************/ ***********************************************************************/
#ifndef _INTERNAL_H_ #ifndef _INTERNAL_H_
#define _INTERNAL_H_ #define _INTERNAL_H_
//===[ Include files ]===================================================== //===[ Include files ]=====================================================
#include "platform.h" #include "platform.h"
#include <micasa_types.h> #include <micasa_types.h>
#include <casa_status.h> #include <casa_status.h>
#include "config_if.h" #include "config_if.h"
#include "mech_if.h" #include "mech_if.h"
//===[ Type definitions ]================================================== //===[ Type definitions ]==================================================
//===[ Inlines functions ]=============================================== //===[ Inlines functions ]===============================================
//===[ Function prototypes ]=============================================== //===[ Function prototypes ]===============================================
//===[ Global variables ]================================================== //===[ Global variables ]==================================================
//===[ Global externals ]================================================== //===[ Global externals ]==================================================
extern int DebugLevel; extern int DebugLevel;
//===[ External prototypes ]=============================================== //===[ External prototypes ]===============================================
// //
// Defined in get.c // Defined in get.c
// //
extern extern
CasaStatus SSCS_CALL CasaStatus SSCS_CALL
AuthTokenIf_GetAuthToken( AuthTokenIf_GetAuthToken(
IN const void *pIfInstance, IN const void *pIfInstance,
IN const char *pContext, IN const char *pContext,
IN const char *pMechInfo, IN const char *pMechInfo,
IN const char *pHostName, IN const char *pHostName,
IN void *pCredStoreScope, IN void *pCredStoreScope,
INOUT char *pTokenBuf, INOUT char *pTokenBuf,
INOUT int *pTokenBufLen); INOUT int *pTokenBufLen);
extern extern
int
InitializeLibrary(void);
//
// Defined in utils.c
//
extern
CasaStatus
EncodeData(
IN const void *pData,
IN const int32_t dataLen,
INOUT char **ppEncodedData,
INOUT int32_t *pEncodedDataLen);
extern
CasaStatus
DecodeData(
IN const char *pEncodedData,
IN const int32_t encodedDataLen, // Does not include NULL terminator
INOUT void **ppData,
INOUT int32_t *pDataLen);
extern
int int
InitializeLibrary(void); dtoul(
IN const char *cp,
// IN const int len);
// Defined in utils.c
// //=========================================================================
extern #endif // _INTERNAL_H_
CasaStatus
EncodeData(
IN const void *pData,
IN const int32_t dataLen,
INOUT char **ppEncodedData,
INOUT int32_t *pEncodedDataLen);
extern
CasaStatus
DecodeData(
IN const char *pEncodedData,
IN const int32_t encodedDataLen, // Does not include NULL terminator
INOUT void **ppData,
INOUT int32_t *pDataLen);
//=========================================================================
#endif // _INTERNAL_H_

View File

@ -276,6 +276,48 @@ DecodeData(
} }
//++=======================================================================
int
dtoul(
IN const char *cp,
IN const int len)
//
// Arguments:
//
// Returns:
//
// Abstract:
//
// Notes:
//
// L2
//=======================================================================--
{
int n = 0;
int i;
DbgTrace(2, "-dtoul- Start\n", 0);
for (i = 0; i < len; i++, cp++)
{
// Verify that we are dealing with a valid digit
if (*cp >= '0' && *cp <= '9')
{
n = 10 * n + (*cp - '0');
}
else
{
DbgTrace(0, "-dtoul- Found invalid digit\n", 0);
break;
}
}
DbgTrace(2, "-dtoul- End, result = %d\n", n);
return n;
}
//++======================================================================= //++=======================================================================
//++======================================================================= //++=======================================================================
//++======================================================================= //++=======================================================================

View File

@ -9,4 +9,19 @@
LibraryName \Program Files\novell\casa\lib\krb5mech.dll LibraryName \Program Files\novell\casa\lib\krb5mech.dll
#
# DebugLevel setting.
#
# Description: Used to specify the level of logging utilized for debugging
# purposes. A level of zero being the lowest debugging level.
#
# If this parameter is not set, the client defaults
# to use a debug level of zero.
#
# Note: Debug statements can be viewed under Windows by using
# tools such as DbgView. Under Linux, debug statements are logged
# to /var/log/messages.
#
#DebugLevel 0

View File

@ -149,7 +149,7 @@ GET_AUTH_TOKEN_INTERFACE_RTN(
{ {
CasaStatus retStatus; CasaStatus retStatus;
AuthTokenIfInstance *pAuthTokenIfInstance; AuthTokenIfInstance *pAuthTokenIfInstance;
char *pDebugLevelSetting;
DbgTrace(1, "-GetAuthTokenInterface- Start\n", 0); DbgTrace(1, "-GetAuthTokenInterface- Start\n", 0);
@ -165,6 +165,19 @@ GET_AUTH_TOKEN_INTERFACE_RTN(
goto exit; goto exit;
} }
// Check if a DebugLevel has been configured
pDebugLevelSetting = pModuleConfigIf->getEntryValue(pModuleConfigIf, "DebugLevel");
if (pDebugLevelSetting != NULL)
{
DbgTrace(0, "-GetAuthTokenInterface- DebugLevel configured = %s\n", pDebugLevelSetting);
// Convert the number to hex
DebugLevel = (int) dtoul(pDebugLevelSetting, strlen(pDebugLevelSetting));
// Free the buffer holding the debug level
free(pDebugLevelSetting);
}
// Allocate space for the interface instance // Allocate space for the interface instance
pAuthTokenIfInstance = malloc(sizeof(*pAuthTokenIfInstance)); pAuthTokenIfInstance = malloc(sizeof(*pAuthTokenIfInstance));
if (pAuthTokenIfInstance) if (pAuthTokenIfInstance)

View File

@ -1,90 +1,96 @@
/*********************************************************************** /***********************************************************************
* *
* Copyright (C) 2006 Novell, Inc. All Rights Reserved. * Copyright (C) 2006 Novell, Inc. All Rights Reserved.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; version 2.1 * License as published by the Free Software Foundation; version 2.1
* of the License. * of the License.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library Lesser General Public License for more details. * Library Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, Novell, Inc. * License along with this library; if not, Novell, Inc.
* *
* To contact Novell about this file by physical or electronic mail, * To contact Novell about this file by physical or electronic mail,
* you may find current contact information at www.novell.com. * you may find current contact information at www.novell.com.
* *
* Author: Juan Carlos Luciani <jluciani@novell.com> * Author: Juan Carlos Luciani <jluciani@novell.com>
* *
***********************************************************************/ ***********************************************************************/
#ifndef _INTERNAL_H_ #ifndef _INTERNAL_H_
#define _INTERNAL_H_ #define _INTERNAL_H_
//===[ Include files ]===================================================== //===[ Include files ]=====================================================
#include "platform.h" #include "platform.h"
#include <micasa_types.h> #include <micasa_types.h>
#include <micasa_mgmd.h> #include <micasa_mgmd.h>
#include <sscs_utf8.h> #include <sscs_utf8.h>
#include <casa_status.h> #include <casa_status.h>
#include "config_if.h" #include "config_if.h"
#include "mech_if.h" #include "mech_if.h"
//===[ Type definitions ]================================================== //===[ Type definitions ]==================================================
//===[ Inlines functions ]=============================================== //===[ Inlines functions ]===============================================
//===[ Function prototypes ]=============================================== //===[ Function prototypes ]===============================================
//===[ Global variables ]================================================== //===[ Global variables ]==================================================
//===[ Global externals ]================================================== //===[ Global externals ]==================================================
extern int DebugLevel; extern int DebugLevel;
//===[ External prototypes ]=============================================== //===[ External prototypes ]===============================================
// //
// Defined in get.c // Defined in get.c
// //
extern extern
CasaStatus SSCS_CALL CasaStatus SSCS_CALL
AuthTokenIf_GetAuthToken( AuthTokenIf_GetAuthToken(
IN const void *pIfInstance, IN const void *pIfInstance,
IN const char *pContext, IN const char *pContext,
IN const char *pMechInfo, IN const char *pMechInfo,
IN const char *pHostName, IN const char *pHostName,
IN void *pCredStoreScope, IN void *pCredStoreScope,
INOUT char *pTokenBuf, INOUT char *pTokenBuf,
INOUT int *pTokenBufLen); INOUT int *pTokenBufLen);
// //
// Defined in utils.c // Defined in utils.c
// //
extern extern
CasaStatus CasaStatus
EncodeData( EncodeData(
IN const void *pData, IN const void *pData,
IN const int32_t dataLen, IN const int32_t dataLen,
INOUT char **ppEncodedData, INOUT char **ppEncodedData,
INOUT int32_t *pEncodedDataLen); INOUT int32_t *pEncodedDataLen);
extern extern
CasaStatus CasaStatus
DecodeData( DecodeData(
IN const char *pEncodedData, IN const char *pEncodedData,
IN const int32_t encodedDataLen, // Does not include NULL terminator IN const int32_t encodedDataLen, // Does not include NULL terminator
INOUT void **ppData, INOUT void **ppData,
INOUT int32_t *pDataLen); INOUT int32_t *pDataLen);
//========================================================================= extern
int
#endif // _INTERNAL_H_ dtoul(
IN const char *cp,
IN const int len);
//=========================================================================
#endif // _INTERNAL_H_

View File

@ -276,6 +276,48 @@ DecodeData(
} }
//++=======================================================================
int
dtoul(
IN const char *cp,
IN const int len)
//
// Arguments:
//
// Returns:
//
// Abstract:
//
// Notes:
//
// L2
//=======================================================================--
{
int n = 0;
int i;
DbgTrace(2, "-dtoul- Start\n", 0);
for (i = 0; i < len; i++, cp++)
{
// Verify that we are dealing with a valid digit
if (*cp >= '0' && *cp <= '9')
{
n = 10 * n + (*cp - '0');
}
else
{
DbgTrace(0, "-dtoul- Found invalid digit\n", 0);
break;
}
}
DbgTrace(2, "-dtoul- End, result = %d\n", n);
return n;
}
//++======================================================================= //++=======================================================================
//++======================================================================= //++=======================================================================
//++======================================================================= //++=======================================================================

View File

@ -9,4 +9,18 @@
LibraryName \Program Files\novell\casa\lib\pwmech.dll LibraryName \Program Files\novell\casa\lib\pwmech.dll
#
# DebugLevel setting.
#
# Description: Used to specify the level of logging utilized for debugging
# purposes. A level of zero being the lowest debugging level.
#
# If this parameter is not set, the client defaults
# to use a debug level of zero.
#
# Note: Debug statements can be viewed under Windows by using
# tools such as DbgView. Under Linux, debug statements are logged
# to /var/log/messages.
#
#DebugLevel 0