Changes due to rename of platutils.c to platform.c.
This commit is contained in:
parent
4f9fa1a152
commit
47f4dbb6b7
@ -58,7 +58,7 @@ GetUserCredentials(
|
|||||||
// Description:
|
// Description:
|
||||||
// Get authentication credentials for the specified realm.
|
// Get authentication credentials for the specified realm.
|
||||||
//
|
//
|
||||||
// L0
|
// L2
|
||||||
//=======================================================================--
|
//=======================================================================--
|
||||||
{
|
{
|
||||||
CasaStatus retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
|
CasaStatus retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
|
||||||
@ -66,12 +66,13 @@ GetUserCredentials(
|
|||||||
CASA_STATUS_UNSUCCESSFUL);
|
CASA_STATUS_UNSUCCESSFUL);
|
||||||
char *pUsername;
|
char *pUsername;
|
||||||
char *pPassword;
|
char *pPassword;
|
||||||
int rcode = NSSCS_E_OBJECT_NOT_FOUND;
|
int rcode = NSSCS_E_OBJECT_NOT_FOUND;
|
||||||
int32_t credtype = SSCS_CRED_TYPE_BASIC_F;
|
int32_t credtype = SSCS_CRED_TYPE_BASIC_F;
|
||||||
SSCS_BASIC_CREDENTIAL credential = {0};
|
SSCS_BASIC_CREDENTIAL credential = {0};
|
||||||
SSCS_SECRET_ID_T secretId = {0};
|
SSCS_SECRET_ID_T secretId = {0};
|
||||||
SSCS_SECRET_ID_T sharedSecretId = {0};
|
SSCS_SECRET_ID_T sharedSecretId = {0};
|
||||||
|
|
||||||
|
|
||||||
DbgTrace(1, "-GetUserCredentials- Start\n", 0);
|
DbgTrace(1, "-GetUserCredentials- Start\n", 0);
|
||||||
|
|
||||||
// Initialize output parameters
|
// Initialize output parameters
|
||||||
@ -80,49 +81,49 @@ GetUserCredentials(
|
|||||||
|
|
||||||
// Get the length of the realm string into the secret id structure
|
// Get the length of the realm string into the secret id structure
|
||||||
// and verify thatr it is not too long.
|
// and verify thatr it is not too long.
|
||||||
secretId.len = sscs_Utf8Strlen(pRealm) + 1;
|
secretId.len = sscs_Utf8Strlen(pRealm) + 1;
|
||||||
if (secretId.len <= NSSCS_MAX_SECRET_ID_LEN)
|
if (secretId.len <= NSSCS_MAX_SECRET_ID_LEN)
|
||||||
{
|
{
|
||||||
// Set the secret id in the structure
|
// Set the secret id in the structure
|
||||||
sscs_Utf8Strcpy(secretId.id, pRealm);
|
sscs_Utf8Strcpy(secretId.id, pRealm);
|
||||||
|
|
||||||
// Specify that we want the common name
|
// Specify that we want the common name
|
||||||
credential.unFlags = USERNAME_TYPE_CN_F;
|
credential.unFlags = USERNAME_TYPE_CN_F;
|
||||||
|
|
||||||
// Now try to get the credentials
|
// Now try to get the credentials
|
||||||
rcode = miCASAGetCredential(0,
|
rcode = miCASAGetCredential(0,
|
||||||
&secretId,
|
&secretId,
|
||||||
NULL,
|
NULL,
|
||||||
&credtype, //SSCS_CRED_TYPE_BASIC_F,
|
&credtype,
|
||||||
&credential,
|
&credential,
|
||||||
NULL);
|
NULL);
|
||||||
if (rcode != NSSCS_SUCCESS)
|
if (rcode != NSSCS_SUCCESS)
|
||||||
{
|
{
|
||||||
// There were no credentials for the realm, now try to obtain the
|
// There were no credentials for the realm, now try to obtain the
|
||||||
// desktop credentials.
|
// desktop credentials.
|
||||||
secretId.len = sscs_Utf8Strlen("Desktop") + 1;
|
secretId.len = sscs_Utf8Strlen("Desktop") + 1;
|
||||||
sscs_Utf8Strcpy(secretId.id, "Desktop");
|
sscs_Utf8Strcpy(secretId.id, "Desktop");
|
||||||
rcode = miCASAGetCredential(0,
|
rcode = miCASAGetCredential(0,
|
||||||
&secretId,
|
&secretId,
|
||||||
NULL,
|
NULL,
|
||||||
&credtype, //SSCS_CRED_TYPE_BASIC_F,
|
&credtype,
|
||||||
&credential,
|
&credential,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DbgTrace(0, "-GetUserCredentials- Realm name too long\n", 0);
|
DbgTrace(0, "-GetUserCredentials- Realm name too long\n", 0);
|
||||||
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
|
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
|
||||||
CASA_FACILITY_PWTOKEN,
|
CASA_FACILITY_PWTOKEN,
|
||||||
CASA_STATUS_UNSUCCESSFUL);
|
CASA_STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proceed based on the result of the operatiosn above
|
// Proceed based on the result of the operatiosn above
|
||||||
if (rcode == NSSCS_SUCCESS
|
if (rcode == NSSCS_SUCCESS
|
||||||
&& credential.username != NULL
|
&& credential.username != NULL
|
||||||
&& credential.password != NULL)
|
&& credential.password != NULL)
|
||||||
{
|
{
|
||||||
// Allocate a buffer to return the username
|
// Allocate a buffer to return the username
|
||||||
pUsername = (char*) malloc(strlen(credential.username) + 1);
|
pUsername = (char*) malloc(strlen(credential.username) + 1);
|
||||||
if (pUsername)
|
if (pUsername)
|
||||||
@ -144,8 +145,8 @@ GetUserCredentials(
|
|||||||
{
|
{
|
||||||
DbgTrace(0, "-GetUserCredentials- Buffer allocation error\n", 0);
|
DbgTrace(0, "-GetUserCredentials- Buffer allocation error\n", 0);
|
||||||
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
|
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
|
||||||
CASA_FACILITY_PWTOKEN,
|
CASA_FACILITY_PWTOKEN,
|
||||||
CASA_STATUS_INSUFFICIENT_RESOURCES);
|
CASA_STATUS_INSUFFICIENT_RESOURCES);
|
||||||
|
|
||||||
// Free the buffer allocated for the username
|
// Free the buffer allocated for the username
|
||||||
free(pUsername);
|
free(pUsername);
|
||||||
@ -155,10 +156,10 @@ GetUserCredentials(
|
|||||||
{
|
{
|
||||||
DbgTrace(0, "-GetUserCredentials- Buffer allocation error\n", 0);
|
DbgTrace(0, "-GetUserCredentials- Buffer allocation error\n", 0);
|
||||||
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
|
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
|
||||||
CASA_FACILITY_PWTOKEN,
|
CASA_FACILITY_PWTOKEN,
|
||||||
CASA_STATUS_INSUFFICIENT_RESOURCES);
|
CASA_STATUS_INSUFFICIENT_RESOURCES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the buffers to the caller if successful
|
// Return the buffers to the caller if successful
|
||||||
if (CASA_SUCCESS(retStatus))
|
if (CASA_SUCCESS(retStatus))
|
||||||
@ -224,7 +225,7 @@ AuthTokenIf_GetAuthToken(
|
|||||||
// Description:
|
// Description:
|
||||||
// Get authentication token to authenticate user to specified service.
|
// Get authentication token to authenticate user to specified service.
|
||||||
//
|
//
|
||||||
// L0
|
// L2
|
||||||
//=======================================================================--
|
//=======================================================================--
|
||||||
{
|
{
|
||||||
CasaStatus retStatus;
|
CasaStatus retStatus;
|
||||||
@ -277,8 +278,6 @@ AuthTokenIf_GetAuthToken(
|
|||||||
if (encodedTokenLen > *pTokenBufLen)
|
if (encodedTokenLen > *pTokenBufLen)
|
||||||
{
|
{
|
||||||
// The buffer is not big enough
|
// The buffer is not big enough
|
||||||
DbgTrace(1, "-AuthTokenIf_GetAuthToken- Insufficient buffer space provided\n", 0);
|
|
||||||
|
|
||||||
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
|
retStatus = CasaStatusBuild(CASA_SEVERITY_ERROR,
|
||||||
CASA_FACILITY_PWTOKEN,
|
CASA_FACILITY_PWTOKEN,
|
||||||
CASA_STATUS_BUFFER_OVERFLOW);
|
CASA_STATUS_BUFFER_OVERFLOW);
|
||||||
@ -339,13 +338,14 @@ InitializeLibrary(void)
|
|||||||
//
|
//
|
||||||
// Notes:
|
// Notes:
|
||||||
//
|
//
|
||||||
// L0
|
// L2
|
||||||
//=======================================================================--
|
//=======================================================================--
|
||||||
{
|
{
|
||||||
int retStatus = 0;
|
int retStatus = 0;
|
||||||
|
|
||||||
DbgTrace(1, "-InitializeLibrary- Start\n", 0);
|
DbgTrace(1, "-InitializeLibrary- Start\n", 0);
|
||||||
|
|
||||||
|
// Nothing to do at this time.
|
||||||
|
|
||||||
DbgTrace(1, "-InitializeLibrary- End, retStatus = %08X\n", retStatus);
|
DbgTrace(1, "-InitializeLibrary- End, retStatus = %08X\n", retStatus);
|
||||||
|
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
/***********************************************************************
|
|
||||||
*
|
|
||||||
* 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 ]==================================================
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user