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
#
#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

@ -737,6 +737,7 @@ InitializeLibrary(void)
int retStatus = -1;
int getConfigStatus = -1;
ConfigIf *pClientConfigIf;
char *pDebugLevelSetting;
char *pATSPortSetting;
char *pDisableSecureConnections;
char *pAllowInvalidCerts;
@ -751,6 +752,19 @@ InitializeLibrary(void)
if (CASA_SUCCESS(getConfigStatus)
&& 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
g_pATSHostName = pClientConfigIf->getEntryValue(pClientConfigIf, "ATS-hostname");
if (g_pATSHostName != NULL)

View File

@ -149,7 +149,7 @@ GET_AUTH_TOKEN_INTERFACE_RTN(
{
CasaStatus retStatus;
AuthTokenIfInstance *pAuthTokenIfInstance;
char *pDebugLevelSetting;
DbgTrace(1, "-GetAuthTokenInterface- Start\n", 0);
@ -165,6 +165,19 @@ GET_AUTH_TOKEN_INTERFACE_RTN(
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
pAuthTokenIfInstance = malloc(sizeof(*pAuthTokenIfInstance));
if (pAuthTokenIfInstance)

View File

@ -86,6 +86,11 @@ DecodeData(
INOUT void **ppData,
INOUT int32_t *pDataLen);
extern
int
dtoul(
IN const char *cp,
IN const int len);
//=========================================================================

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
#
# 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;
AuthTokenIfInstance *pAuthTokenIfInstance;
char *pDebugLevelSetting;
DbgTrace(1, "-GetAuthTokenInterface- Start\n", 0);
@ -165,6 +165,19 @@ GET_AUTH_TOKEN_INTERFACE_RTN(
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
pAuthTokenIfInstance = malloc(sizeof(*pAuthTokenIfInstance));
if (pAuthTokenIfInstance)

View File

@ -84,6 +84,12 @@ DecodeData(
INOUT void **ppData,
INOUT int32_t *pDataLen);
extern
int
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
#
# 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