521 lines
14 KiB
C#
521 lines
14 KiB
C#
/***********************************************************************
|
|
*
|
|
* Copyright (C) 2005-2006 Novell, Inc. 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.
|
|
*
|
|
***********************************************************************/
|
|
|
|
using System;
|
|
|
|
namespace Novell.CASA
|
|
{
|
|
/// <summary>
|
|
/// Summary description for MiCasaException.
|
|
/// </summary>
|
|
public class miCasaException:Exception
|
|
{
|
|
|
|
int m_iException = 0;
|
|
|
|
public const int NSSCS_E_OBJECT_NOT_FOUND = -800; //0xFFFFFCE0; /* -800 */
|
|
|
|
/**
|
|
* NICI operations have failed.
|
|
*/
|
|
public const int NSSCS_E_NICI_FAILURE = -801;
|
|
|
|
/**
|
|
* Secret ID is not in the User Secret Store.
|
|
*/
|
|
public const int NSSCS_E_INVALID_SECRET_ID = -802;
|
|
|
|
/**
|
|
* Some internal operating system services have not been available.
|
|
*/
|
|
public const int NSSCS_E_SYSTEM_FAILURE = -803;
|
|
|
|
/**
|
|
* Access to the target SecretStore has been denied.
|
|
*/
|
|
public const int NSSCS_E_ACCESS_DENIED = -804;
|
|
|
|
/**
|
|
* Some internal NDS services have not been available.
|
|
*/
|
|
public const int NSSCS_E_NDS_INTERNAL_FAILURE = -805;
|
|
|
|
/**
|
|
* Secret has not been initialized with a write.
|
|
*/
|
|
public const int NSSCS_E_SECRET_UNINITIALIZED = -806;
|
|
|
|
/**
|
|
* Size of the buffer is not in a nominal range between minimum and maximum.
|
|
*/
|
|
public const int NSSCS_E_BUFFER_LEN = -807;
|
|
|
|
/**
|
|
* Client and server components are not of the compatible versions.
|
|
*/
|
|
public const int NSSCS_E_INCOMPATIBLE_VERSION = -808;
|
|
|
|
/**
|
|
* SecretStore data on the server has been corrupted.
|
|
*/
|
|
public const int NSSCS_E_CORRUPTED_STORE = -809;
|
|
|
|
/**
|
|
* Secret ID already exists in the Secret Store.
|
|
*/
|
|
public const int NSSCS_E_SECRET_ID_EXISTS = -810;
|
|
|
|
/**
|
|
* User NDS password has been changed by the administrator.
|
|
*/
|
|
public const int NSSCS_E_NDS_PWORD_CHANGED = -811;
|
|
|
|
/**
|
|
* Target NDS User object not found.
|
|
*/
|
|
public const int NSSCS_E_INVALID_TARGET_OBJECT = -812;
|
|
|
|
/**
|
|
* Target NDS User object does not have a SecretStore.
|
|
*/
|
|
public const int NSSCS_E_STORE_NOT_FOUND = -813;
|
|
|
|
/**
|
|
* SecretStore not on the Network.
|
|
*/
|
|
public const int NSSCS_E_SERVICE_NOT_FOUND = -814;
|
|
|
|
/**
|
|
* Length of the Secret ID buffer exceeds the limit.
|
|
*/
|
|
public const int NSSCS_E_SECRET_ID_TOO_LONG = -815;
|
|
|
|
/**
|
|
* Length of the Enumeration buffer too int.
|
|
*/
|
|
public const int NSSCS_E_ENUM_BUFF_TOO_SHORT = -816;
|
|
|
|
/**
|
|
* User not authenticated.
|
|
*/
|
|
public const int NSSCS_E_NOT_AUTHENTICATED = -817;
|
|
|
|
/**
|
|
* Not supported operations.
|
|
*/
|
|
public const int NSSCS_E_NOT_SUPPORTED = -818;
|
|
|
|
/**
|
|
* Typed in NDS password not valid.
|
|
*/
|
|
public const int NSSCS_E_NDS_PWORD_INVALID = -819;
|
|
|
|
/**
|
|
* Session keys of the client and server NICI are out of sync.
|
|
*/
|
|
public const int NSSCS_E_NICI_OUTOF_SYNC = -820;
|
|
|
|
/**
|
|
* Requested service not supported yet.
|
|
*/
|
|
public const int NSSCS_E_SERVICE_NOT_SUPPORTED = -821;
|
|
|
|
/**
|
|
* NDS authentication type not supported.
|
|
*/
|
|
public const int NSSCS_E_TOKEN_NOT_SUPPORTED = -822;
|
|
|
|
/**
|
|
* Unicode text conversion operation failed.
|
|
*/
|
|
public const int NSSCS_E_UNICODE_OP_FAILURE = -823;
|
|
|
|
/**
|
|
* Connection to server is lost.
|
|
*/
|
|
public const int NSSCS_E_TRANSPORT_FAILURE = -824;
|
|
|
|
/**
|
|
* Cryptographic operation failed.
|
|
*/
|
|
public const int NSSCS_E_CRYPTO_OP_FAILURE = -825;
|
|
|
|
/**
|
|
* Opening a connection to the server failed.
|
|
*/
|
|
public const int NSSCS_E_SERVER_CONN_FAILURE = -826;
|
|
|
|
/**
|
|
* Access to server connection failed.
|
|
*/
|
|
public const int NSSCS_E_CONN_ACCESS_FAILURE = -827;
|
|
|
|
/**
|
|
* Size of the enumeration buffer exceeds the limit.
|
|
*/
|
|
public const int NSSCS_E_ENUM_BUFF_TOO_LONG = -828;
|
|
|
|
/**
|
|
* Size of the Secret buffer exceeds the limit.
|
|
*/
|
|
public const int NSSCS_E_SECRET_BUFF_TOO_LONG = -829;
|
|
|
|
/**
|
|
* Length of the Secret ID should be greater than zero.
|
|
*/
|
|
public const int NSSCS_E_SECRET_ID_TOO_SHORT = -830;
|
|
|
|
/**
|
|
* Protocol data corrupted on the wire.
|
|
*/
|
|
public const int NSSCS_E_CORRUPTED_PACKET_DATA = -831;
|
|
|
|
/**
|
|
* EP password validation failed. Access to the secret denied!
|
|
*/
|
|
public const int NSSCS_E_EP_ACCESS_DENIED = -832;
|
|
|
|
/**
|
|
* Schema is not extended to support SecreStore on the target tree.
|
|
*/
|
|
public const int NSSCS_E_SCHEMA_NOT_EXTENDED = -833;
|
|
|
|
/**
|
|
* One of the optional service attributes is not instantiated.
|
|
*/
|
|
public const int NSSCS_E_ATTR_NOT_FOUND = -834;
|
|
|
|
/**
|
|
* Server has been upgraded and user SecretStore should be updated.
|
|
*/
|
|
public const int NSSCS_E_MIGRATION_NEEDED = -835;
|
|
|
|
/**
|
|
* Master password could not be verified to read or unlock the secrets.
|
|
*/
|
|
public const int NSSCS_E_MP_PWORD_INVALID = -836;
|
|
|
|
/**
|
|
* Master password has not been set on the SecretStore.
|
|
*/
|
|
public const int NSSCS_E_MP_PWORD_NOT_SET = -837;
|
|
|
|
/**
|
|
* Ability to use master password has been disabled.
|
|
*/
|
|
public const int NSSCS_E_MP_PWORD_NOT_ALLOWED = -838;
|
|
|
|
/**
|
|
* Not a writeable replica of NDS.
|
|
*/
|
|
public const int NSSCS_E_WRONG_REPLICA_TYPE = -839;
|
|
|
|
/**
|
|
* Target attribute is not instantiated in NDS.
|
|
*
|
|
* @since 3.0
|
|
*/
|
|
public const int NSSCS_E_ATTR_VAL_NOT_FOUND = -840;
|
|
|
|
/**
|
|
* API parameter is not initialized.
|
|
*
|
|
* @since 3.0
|
|
*/
|
|
public const int NSSCS_E_INVALID_PARAM = -841;
|
|
|
|
/**
|
|
* Connection to SecretStore needs to be over SSL.
|
|
*
|
|
* @since 3.0
|
|
*/
|
|
public const int NSSCS_E_NEED_SECURE_CHANNEL = -842;
|
|
|
|
/**
|
|
* No server to support the given override configuration is found.
|
|
*
|
|
* @since 3.02
|
|
*/
|
|
public const int NSSCS_E_CONFIG_NOT_SUPPORTED = -843;
|
|
|
|
/**
|
|
* Attempt to unlock SecretStore failed because the store is not locked.
|
|
*
|
|
* @since 3.02
|
|
*/
|
|
public const int NSSCS_E_STORE_NOT_LOCKED = -844;
|
|
|
|
/**
|
|
* NDS Replica on the server that holds SecretStore is out of sync with the replica ring.
|
|
*
|
|
* @since 3.2
|
|
*/
|
|
public const int NSSCS_E_TIME_OUT_OF_SYNC = -845;
|
|
|
|
/**
|
|
* Versions of the client dlls don't match.
|
|
*
|
|
* @since 3.2
|
|
*/
|
|
public const int NSSCS_E_VERSION_MISMATCH = -846;
|
|
|
|
/**
|
|
* Buffer supplied for the secret is too short.
|
|
*
|
|
* @since 3.2
|
|
*/
|
|
public const int NSSCS_E_SECRET_BUFF_TOO_SHORT = -847;
|
|
|
|
/**
|
|
* Shared Secret processing and operations failed.
|
|
*
|
|
* @since 3.2
|
|
*/
|
|
public const int NSSCS_E_SH_SECRET_FAILURE = -848;
|
|
|
|
/**
|
|
* Shared Secret parser operations failed.
|
|
*
|
|
* @since 3.2
|
|
*/
|
|
public const int NSSCS_E_PARSER_FAILURE = -849;
|
|
|
|
/**
|
|
* Utf8 string operations failed.
|
|
*
|
|
* @since 3.2
|
|
*/
|
|
public const int NSSCS_E_UTF8_OP_FAILURE = -850;
|
|
|
|
/**
|
|
* Contextless name for LDAP bind does not resolve to a unique DN.
|
|
*
|
|
* @since 3.2
|
|
*/
|
|
public const int NSSCS_E_CTX_LESS_CN_NOT_UNIQUE = -851;
|
|
|
|
/**
|
|
* Feature not implemented yet.
|
|
*/
|
|
public const int NSSCS_E_NOT_IMPLEMENTED = -888;
|
|
|
|
/**
|
|
* Product's BETA life has expired! Official release copy should be purchased.
|
|
*/
|
|
public const int NSSCS_E_BETA_EXPIRED = -899;
|
|
|
|
|
|
public miCasaException()
|
|
{
|
|
//
|
|
// TODO: Add constructor logic here
|
|
//
|
|
}
|
|
|
|
public miCasaException(int iException)
|
|
{
|
|
m_iException = iException;
|
|
}
|
|
|
|
public string getMessage()
|
|
{
|
|
return getMessage(m_iException);
|
|
}
|
|
|
|
public int getErrorCode()
|
|
{
|
|
return m_iException;
|
|
}
|
|
|
|
public string getMessage(int iException)
|
|
{
|
|
switch (iException)
|
|
{
|
|
case NSSCS_E_OBJECT_NOT_FOUND:
|
|
return "Can't find the target object DN in NDS";
|
|
|
|
case NSSCS_E_NICI_FAILURE:
|
|
return "NICI operations have failed";
|
|
|
|
case NSSCS_E_INVALID_SECRET_ID:
|
|
return "Secret ID is not in the User Secret Store";
|
|
|
|
case NSSCS_E_SYSTEM_FAILURE:
|
|
return "Some internal operating system services have not been available";
|
|
|
|
case NSSCS_E_ACCESS_DENIED:
|
|
return "Access to the target SecretStore has been denied";
|
|
|
|
case NSSCS_E_NDS_INTERNAL_FAILURE:
|
|
return "Some internal NDS services have not been available";
|
|
|
|
case NSSCS_E_SECRET_UNINITIALIZED:
|
|
return "Secret has not been initialized with a write";
|
|
|
|
case NSSCS_E_BUFFER_LEN:
|
|
return "Size of the buffer is not in a nominal range between minimum and maximum";
|
|
|
|
case NSSCS_E_INCOMPATIBLE_VERSION:
|
|
return "Client and server components are not of the compatible versions";
|
|
|
|
case NSSCS_E_CORRUPTED_STORE:
|
|
return "SecretStore data on the server has been corrupted";
|
|
|
|
case NSSCS_E_SECRET_ID_EXISTS:
|
|
return "Secret ID is already in SecretStore";
|
|
|
|
case NSSCS_E_NDS_PWORD_CHANGED:
|
|
return "User NDS password has been changed by the administrator";
|
|
|
|
case NSSCS_E_INVALID_TARGET_OBJECT:
|
|
return "Target NDS User object not found";
|
|
|
|
case NSSCS_E_STORE_NOT_FOUND:
|
|
return "Target NDS User object does not have a SecretStore";
|
|
|
|
case NSSCS_E_SERVICE_NOT_FOUND:
|
|
return "SecretStore not on the Network";
|
|
|
|
case NSSCS_E_SECRET_ID_TOO_LONG:
|
|
return "Length of the Secret ID buffer exceeds the limit";
|
|
|
|
case NSSCS_E_ENUM_BUFF_TOO_SHORT:
|
|
return "Length of the Enumeration buffer too short";
|
|
|
|
case NSSCS_E_NOT_AUTHENTICATED:
|
|
return "User not authenticated";
|
|
|
|
case NSSCS_E_NOT_SUPPORTED:
|
|
return "Not supported operations";
|
|
|
|
case NSSCS_E_NDS_PWORD_INVALID:
|
|
return "Typed in NDS password not valid";
|
|
|
|
case NSSCS_E_NICI_OUTOF_SYNC:
|
|
return "Session keys of the client and server NICI are out of sync";
|
|
|
|
case NSSCS_E_SERVICE_NOT_SUPPORTED:
|
|
return "Requested service not supported yet";
|
|
|
|
case NSSCS_E_TOKEN_NOT_SUPPORTED:
|
|
return "NDS authentication type not supported";
|
|
|
|
case NSSCS_E_UNICODE_OP_FAILURE:
|
|
return "Unicode text conversion operation failed";
|
|
|
|
case NSSCS_E_TRANSPORT_FAILURE:
|
|
return "Connection to server is lost";
|
|
|
|
case NSSCS_E_CRYPTO_OP_FAILURE:
|
|
return "Cryptographic operation failed";
|
|
|
|
case NSSCS_E_SERVER_CONN_FAILURE:
|
|
return "Opening a connection to the server failed";
|
|
|
|
case NSSCS_E_CONN_ACCESS_FAILURE:
|
|
return "Access to server connection failed";
|
|
|
|
case NSSCS_E_ENUM_BUFF_TOO_LONG:
|
|
return "Size of the enumeration buffer exceeds the limit";
|
|
|
|
case NSSCS_E_SECRET_BUFF_TOO_LONG:
|
|
return "Size of the Secret buffer exceeds the limit";
|
|
|
|
case NSSCS_E_SECRET_ID_TOO_SHORT:
|
|
return "Length of the Secret ID should be greater than zero";
|
|
|
|
case NSSCS_E_CORRUPTED_PACKET_DATA:
|
|
return "Protocol data corrupted on the wire";
|
|
|
|
case NSSCS_E_EP_ACCESS_DENIED:
|
|
return "EP password validation failed. Access to the secret denied";
|
|
|
|
case NSSCS_E_SCHEMA_NOT_EXTENDED:
|
|
return "Schema is not extended to support SecreStore on the target tree";
|
|
|
|
case NSSCS_E_ATTR_NOT_FOUND:
|
|
return "One of the optional service attributes is not instantiated";
|
|
|
|
case NSSCS_E_MIGRATION_NEEDED:
|
|
return "Server has been upgraded and user SecretStore should be updated";
|
|
|
|
case NSSCS_E_MP_PWORD_INVALID:
|
|
return "Master password could not be verified to read or unlock the secrets";
|
|
|
|
case NSSCS_E_MP_PWORD_NOT_SET:
|
|
return "Master password has not been set on the SecretStore";
|
|
|
|
case NSSCS_E_MP_PWORD_NOT_ALLOWED:
|
|
return "Ability to use master password has been disabled";
|
|
|
|
case NSSCS_E_WRONG_REPLICA_TYPE:
|
|
return "Not a writeable replica of NDS";
|
|
|
|
case NSSCS_E_ATTR_VAL_NOT_FOUND:
|
|
return "Target attribute is not instantiated in NDS";
|
|
|
|
case NSSCS_E_INVALID_PARAM:
|
|
return "API parameter is not initialized";
|
|
|
|
case NSSCS_E_NEED_SECURE_CHANNEL:
|
|
return "Connection to SecretStore needs to be over SSL";
|
|
|
|
case NSSCS_E_CONFIG_NOT_SUPPORTED:
|
|
return "No server to support the given override configuration is found";
|
|
|
|
case NSSCS_E_STORE_NOT_LOCKED:
|
|
return "Attempt to unlock SecretStore failed because the store is not locked";
|
|
|
|
case NSSCS_E_TIME_OUT_OF_SYNC:
|
|
return "NDS Replica on the server that holds SecretStore is out of sync with the replica ring";
|
|
|
|
case NSSCS_E_VERSION_MISMATCH:
|
|
return "Versions of the client dlls don't match";
|
|
|
|
case NSSCS_E_SECRET_BUFF_TOO_SHORT:
|
|
return "Buffer supplied for the secret is too short";
|
|
|
|
case NSSCS_E_SH_SECRET_FAILURE:
|
|
return "Shared Secret processing and operations failed";
|
|
|
|
case NSSCS_E_PARSER_FAILURE:
|
|
return "Shared Secret parser operations failed";
|
|
|
|
case NSSCS_E_UTF8_OP_FAILURE:
|
|
return "Utf8 string operations failed";
|
|
|
|
case NSSCS_E_CTX_LESS_CN_NOT_UNIQUE:
|
|
return "Contextless name for LDAP bind does not resolve to a unique DN";
|
|
|
|
case NSSCS_E_NOT_IMPLEMENTED:
|
|
return "Feature not implemented yet";
|
|
|
|
case NSSCS_E_BETA_EXPIRED:
|
|
return "Product's BETA life has expired! Official release copy should be purchased";
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
}
|
|
}
|