idled principals interfaces and some fixes to caps manager...

This commit is contained in:
arielb%netscape.com 1999-07-16 20:31:18 +00:00
parent f0eaea2e63
commit 587d04c222
26 changed files with 229 additions and 463 deletions

6
caps/idl/MANIFEST Normal file
View File

@ -0,0 +1,6 @@
nsIPrincipal.idl
nsICodebasePrincipal.idl
nsICertificatePrincipal.idl
nsICodeSourcePrincipal.idl
nsIScriptSecurityManager.idl
nsICapsSecurityCallbacks.idl

View File

@ -28,6 +28,9 @@ XPIDLSRCS = \
nsIScriptSecurityManager.idl \
nsICapsSecurityCallbacks.idl \
nsIPrincipal.idl \
nsICodebasePrincipal.idl \
nsICertificatePrincipal.idl \
nsICodeSourcePrincipal.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -23,8 +23,9 @@ XPIDLSRCS= \
.\nsIScriptSecurityManager.idl \
.\nsICapsSecurityCallbacks.idl \
.\nsIPrincipal.idl \
# .\nsICertificatePrincipal.idl \
# .\nsICodebasePrincipal.idl \
.\nsICertificatePrincipal.idl \
.\nsICodebasePrincipal.idl \
.\nsICodeSourcePrincipal.idl \
$(NULL)
include <$(DEPTH)\config\rules.mak>

View File

@ -0,0 +1,30 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsIPrincipal.idl"
[uuid(ebfefcd0-25e1-11d2-8160-006008119d7a)]
interface nsICertificatePrincipal : nsIPrincipal {
void GetPublicKey(out string publicKey, out unsigned long publicKeySize);
void GetCompanyName(out string ppCompanyName);
void GetCertificateAuthority(out string ppCertAuthority);
void GetSerialNumber(out string ppSerialNumber);
void GetExpirationDate(out string ppExpDate);
void GetFingerPrint(out string ppFingerPrint);
};

View File

@ -16,30 +16,14 @@
* Reserved.
*/
#ifndef nsICodebasePrincipal_h___
#define nsICodebasePrincipal_h___
#include "nsIPrincipal.h"
class nsICodebasePrincipal : public nsIPrincipal {
public:
/**
* Returns the codebase URL of the principal.
*
* @param result - the resulting codebase URL
*/
NS_IMETHOD
GetURL(const char **ppCodeBaseURL) = 0;
#include "nsIPrincipal.idl"
[uuid(68cb0890-436a-11d2-b940-00805f52351a)]
interface nsICodeSourcePrincipal : nsIPrincipal {
void GetPublicKey(out string publicKey, out unsigned long publicKeySize);
void GetCompanyName(out string ppCompanyName);
void GetCertificateAuthority(out string ppCertAuthority);
void GetSerialNumber(out string ppSerialNumber);
void GetExpirationDate(out string ppExpDate);
void GetFingerPrint(out string ppFingerPrint);
void GetURL(out string ppCodeBaseURL);
};
#define NS_ICODEBASEPRINCIPAL_IID \
{ /* c29fe440-25e1-11d2-8160-006008119d7a */ \
0xc29fe440, \
0x25e1, \
0x11d2, \
{0x81, 0x60, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
}
#endif // nsICodebasePrincipal_h___

View File

@ -0,0 +1,23 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsIPrincipal.idl"
[uuid(c29fe440-25e1-11d2-8160-006008119d7a)]
interface nsICodebasePrincipal : nsIPrincipal {
void GetURL(out string ppCodeBaseURL);
};

View File

@ -19,6 +19,6 @@
#include "nsISupports.idl"
[uuid(ff9313d0-25e1-11d2-8160-006008119d7a)]
interface nsIPrincipal : nsISupports {
void IsTrusted(in string scope, out boolean pbIsTrusted);
void IsTrusted([const] in string scope, out boolean pbIsTrusted);
};

View File

@ -15,6 +15,6 @@ nsCaps.h
nsCapsEnums.h
nsCCapsManager.h
nsCCapsManagerFactory.h
nsCCertPrincipal.h
nsCCodebasePrincipal.h
nsCertificatePrincipal.h
nsCodebasePrincipal.h
nsCCodeSourcePrincipal.h

View File

@ -23,10 +23,26 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
EXPORTS = nsZip.h nsZig.h nsLoadZig.h nsPrincipal.h nsPrivilege.h nsPrivilegeManager.h nsPrivilegeTable.h nsSystemPrivilegeTable.h nsTarget.h nsUserTarget.h jpermission.h nsUserDialogHelper.h admin.h nsCaps.h nsCapsEnums.h nsCCapsManagerFactory.h nsCCapsManager.h \
nsCCertPrincipal.h \
nsCCodebasePrincipal.h \
nsCCodeSourcePrincipal.h
EXPORTS = nsZip.h \
nsZig.h \
nsLoadZig.h \
nsPrincipal.h \
nsPrivilege.h \
nsPrivilegeManager.h \
nsPrivilegeTable.h \
nsSystemPrivilegeTable.h \
nsTarget.h \
nsUserTarget.h \
jpermission.h \
nsUserDialogHelper.h \
admin.h \
nsCaps.h \
nsCapsEnums.h \
nsCCapsManagerFactory.h \
nsCCapsManager.h \
nsCertificatePrincipal.h \
nsCodebasePrincipal.h \
nsCCodeSourcePrincipal.h
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))

View File

@ -28,12 +28,26 @@ IGNORE_MANIFEST=1
MODULE=caps
DEPTH=..\..
EXPORTS=nsZip.h nsZig.h nsLoadZig.h nsPrincipal.h nsPrivilege.h nsPrivilegeManager.h nsPrivilegeTable.h nsSystemPrivilegeTable.h nsTarget.h nsUserTarget.h jpermission.h nsUserDialogHelper.h admin.h nsCaps.h nsCapsEnums.h \
nsCCapsManager.h \
nsCCertPrincipal.h \
nsCCodebasePrincipal.h \
nsCCapsManagerFactory.h \
nsCCodeSourcePrincipal.h
EXPORTS=nsZip.h \
nsZig.h \
nsLoadZig.h \
nsPrincipal.h \
nsPrivilege.h \
nsPrivilegeManager.h \
nsPrivilegeTable.h \
nsSystemPrivilegeTable.h \
nsTarget.h \
nsUserTarget.h \
jpermission.h \
nsUserDialogHelper.h \
admin.h \
nsCaps.h \
nsCapsEnums.h \
nsCCapsManager.h \
nsCertificatePrincipal.h \
nsCodebasePrincipal.h \
nsCCapsManagerFactory.h \
nsCCodeSourcePrincipal.h
include <$(DEPTH)/config/rules.mak>

View File

@ -18,7 +18,8 @@
#ifndef nsCCodeSourcePrincipal_h___
#define nsCCodeSourcePrincipal_h___
#include "nsICodebasePrincipal.h"
#include "nsICertificatePrincipal.h"
#include "nsICodeSourcePrincipal.h"
#include "nsPrincipal.h"
@ -39,19 +40,6 @@ public:
////////////////////////////////////////////////////////////////////////////
// from nsICodeSourcePrincipal:
/**
* returns the certificate's data that is passes in via Initialize method.
*
* @param certChain - An array of pointers, with each pointer
* pointing to a certificate data.
* @param certChainLengths - An array of intergers. Each integer indicates
* the length of the cert that is in CertChain
* parametr.
* @param noOfCerts - the number of certifcates that are in the certChain array
*/
NS_IMETHOD
GetCertData(const unsigned char ***certChain, PRUint32 **certChainLengths, PRUint32 *noOfCerts);
/**
* Returns the public key of the certificate.
*
@ -60,7 +48,7 @@ public:
* parameter.
*/
NS_IMETHOD
GetPublicKey(unsigned char **publicKey, PRUint32 *publicKeySize);
GetPublicKey(char **publicKey, PRUint32 *publicKeySize);
/**
* Returns the company name of the ceritificate (OU etc parameters of certificate)
@ -68,7 +56,7 @@ public:
* @param result - the certificate details about the signer.
*/
NS_IMETHOD
GetCompanyName(const char **ppCompanyName);
GetCompanyName(char **ppCompanyName);
/**
* Returns the certificate issuer's data (OU etc parameters of certificate)
@ -76,7 +64,7 @@ public:
* @param result - the details about the issuer
*/
NS_IMETHOD
GetCertificateAuthority(const char **ppCertAuthority);
GetCertificateAuthority(char **ppCertAuthority);
/**
* Returns the serial number of certificate
@ -84,7 +72,7 @@ public:
* @param result - Returns the serial number of certificate
*/
NS_IMETHOD
GetSerialNumber(const char **ppSerialNumber);
GetSerialNumber(char **ppSerialNumber);
/**
* Returns the expiration date of certificate
@ -92,7 +80,7 @@ public:
* @param result - Returns the expiration date of certificate
*/
NS_IMETHOD
GetExpirationDate(const char **ppExpDate);
GetExpirationDate(char **ppExpDate);
/**
* Returns the finger print of certificate
@ -100,7 +88,7 @@ public:
* @param result - Returns the finger print of certificate
*/
NS_IMETHOD
GetFingerPrint(const char **ppFingerPrint);
GetFingerPrint(char **ppFingerPrint);
/**
* Returns the codebase URL of the principal.
@ -108,17 +96,17 @@ public:
* @param result - the resulting codebase URL
*/
NS_IMETHOD
GetURL(const char **ppCodeBaseURL);
GetURL(char **ppCodeBaseURL);
////////////////////////////////////////////////////////////////////////////
// from nsCCodeSourcePrincipal:
nsCCodeSourcePrincipal(const unsigned char **certChain, PRUint32 *certChainLengths, PRUint32 noOfCerts, const char *codebaseURL, nsresult *result);
virtual ~nsCCodeSourcePrincipal(void);
nsICertPrincipal *GetCertPrincipal() { return m_pNSICertPrincipal;}
nsICertificatePrincipal *GetCertPrincipal() { return m_pNSICertPrincipal;}
nsICodebasePrincipal *GetCodebasePrincipal() { return m_pNSICodebasePrincipal; }
protected:
nsICertPrincipal *m_pNSICertPrincipal;
nsICertificatePrincipal *m_pNSICertPrincipal;
nsICodebasePrincipal *m_pNSICodebasePrincipal;
};

View File

@ -16,20 +16,17 @@
* Reserved.
*/
#ifndef nsCCertPrincipal_h___
#define nsCCertPrincipal_h___
#ifndef nsCertificatePrincipal_h___
#define nsCertificatePrincipal_h___
#include "nsICertPrincipal.h"
#include "nsICertificatePrincipal.h"
#include "nsPrincipal.h"
class nsCCertPrincipal : public nsICertPrincipal {
class nsCertificatePrincipal : public nsICertificatePrincipal {
public:
////////////////////////////////////////////////////////////////////////////
// from nsISupports:
NS_DECL_ISUPPORTS
////////////////////////////////////////////////////////////////////////////
// from nsIPrincipal:
@ -37,21 +34,7 @@ public:
IsTrusted(const char* scope, PRBool *pbIsTrusted);
////////////////////////////////////////////////////////////////////////////
// from nsICertPrincipal:
/**
* returns the certificate's data that is passes in via Initialize method.
*
* @param certChain - An array of pointers, with each pointer
* pointing to a certificate data.
* @param certChainLengths - An array of intergers. Each integer indicates
* the length of the cert that is in CertChain
* parametr.
* @param noOfCerts - the number of certifcates that are in the certChain array
*/
NS_IMETHOD
GetCertData(const unsigned char ***certChain, PRUint32 **certChainLengths, PRUint32 *noOfCerts);
// from nsICertificatePrincipal:
/**
* Returns the public key of the certificate.
*
@ -60,7 +43,7 @@ public:
* parameter.
*/
NS_IMETHOD
GetPublicKey(unsigned char **publicKey, PRUint32 *publicKeySize);
GetPublicKey(char **publicKey, PRUint32 *publicKeySize);
/**
* Returns the company name of the ceritificate (OU etc parameters of certificate)
@ -68,7 +51,7 @@ public:
* @param result - the certificate details about the signer.
*/
NS_IMETHOD
GetCompanyName(const char **ppCompanyName);
GetCompanyName(char **ppCompanyName);
/**
* Returns the certificate issuer's data (OU etc parameters of certificate)
@ -76,7 +59,7 @@ public:
* @param result - the details about the issuer
*/
NS_IMETHOD
GetCertificateAuthority(const char **ppCertAuthority);
GetCertificateAuthority(char **ppCertAuthority);
/**
* Returns the serial number of certificate
@ -84,7 +67,7 @@ public:
* @param result - Returns the serial number of certificate
*/
NS_IMETHOD
GetSerialNumber(const char **ppSerialNumber);
GetSerialNumber(char **ppSerialNumber);
/**
* Returns the expiration date of certificate
@ -92,7 +75,7 @@ public:
* @param result - Returns the expiration date of certificate
*/
NS_IMETHOD
GetExpirationDate(const char **ppExpDate);
GetExpirationDate(char **ppExpDate);
/**
* Returns the finger print of certificate
@ -100,18 +83,18 @@ public:
* @param result - Returns the finger print of certificate
*/
NS_IMETHOD
GetFingerPrint(const char **ppFingerPrint);
GetFingerPrint(char **ppFingerPrint);
////////////////////////////////////////////////////////////////////////////
// from nsCCertPrincipal:
nsCCertPrincipal(const unsigned char **certChain, PRUint32 *certChainLengths, PRUint32 noOfCerts, nsresult *result);
nsCCertPrincipal(nsPrincipal *pNSPrincipal);
// from nsCertificatePrincipal:
nsCertificatePrincipal(const unsigned char **certChain, PRUint32 *certChainLengths, PRUint32 noOfCerts, nsresult *result);
nsCertificatePrincipal(nsPrincipal *pNSPrincipal);
virtual ~nsCCertPrincipal(void);
virtual ~nsCertificatePrincipal(void);
nsPrincipal *GetPeer(void);
protected:
nsPrincipal *m_pNSPrincipal;
};
#endif // nsCCertPrincipal_h___
#endif // nsCCertificatePrincipal_h___

View File

@ -16,13 +16,13 @@
* Reserved.
*/
#ifndef nsCCodebasePrincipal_h___
#define nsCCodebasePrincipal_h___
#ifndef nsCodebasePrincipal_h___
#define nsCodebasePrincipal_h___
#include "nsICodebasePrincipal.h"
#include "nsPrincipal.h"
class nsCCodebasePrincipal : public nsICodebasePrincipal {
class nsCodebasePrincipal : public nsICodebasePrincipal {
public:
////////////////////////////////////////////////////////////////////////////
// from nsISupports:
@ -45,15 +45,15 @@ public:
* @param result - the resulting codebase URL
*/
NS_IMETHOD
GetURL(const char **ppCodeBaseURL);
GetURL(char **ppCodeBaseURL);
////////////////////////////////////////////////////////////////////////////
// from nsCCodebasePrincipal:
nsCCodebasePrincipal(const char *codebaseURL, nsresult *result);
nsCCodebasePrincipal(nsPrincipal *pNSPrincipal);
nsCodebasePrincipal(const char *codebaseURL, nsresult *result);
nsCodebasePrincipal(nsPrincipal *pNSPrincipal);
virtual ~nsCCodebasePrincipal(void);
virtual ~nsCodebasePrincipal(void);
nsPrincipal *GetPeer(void);
protected:

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,3 @@
nsICapsManager.h
nsICertPrincipal.h
nsICodebasePrincipal.h
nsICodeSourcePrincipal.h
nsCapsPublicEnums.h

View File

@ -24,10 +24,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
EXPORTS = \
nsICodebasePrincipal.h \
nsICertPrincipal.h \
nsICapsManager.h \
nsICodeSourcePrincipal.h \
nsCapsPublicEnums.h \
$(NULL)

View File

@ -29,10 +29,7 @@ IGNORE_MANIFEST=1
MODULE=caps
DEPTH=..\..
EXPORTS= \
nsICodebasePrincipal.h \
nsICertPrincipal.h \
nsICapsManager.h \
nsICodeSourcePrincipal.h \
nsCapsPublicEnums.h

View File

@ -1,103 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsICertPrincipal_h___
#define nsICertPrincipal_h___
#include "nsIPrincipal.h"
enum { nsFingerPrint_Size = 16 };
typedef unsigned char nsFingerPrint[nsFingerPrint_Size];
class nsICertPrincipal : public nsIPrincipal {
public:
/**
* returns the certificate's data that is passes in via Initialize method.
*
* @param certChain - An array of pointers, with each pointer
* pointing to a certificate data.
* @param certChainLengths - An array of intergers. Each integer indicates
* the length of the cert that is in CertChain
* parametr.
* @param noOfCerts - the number of certifcates that are in the certChain array
*/
NS_IMETHOD
GetCertData(const unsigned char ***certChain, PRUint32 **certChainLengths, PRUint32 *noOfCerts) = 0;
/**
* Returns the public key of the certificate.
*
* @param publicKey - the Public Key data will be returned in this field.
* @param publicKeySize - the length of public key data is returned in this
* parameter.
*/
NS_IMETHOD
GetPublicKey(unsigned char **publicKey, PRUint32 *publicKeySize) = 0;
/**
* Returns the company name of the ceritificate (OU etc parameters of certificate)
*
* @param result - the certificate details about the signer.
*/
NS_IMETHOD
GetCompanyName(const char **ppCompanyName) = 0;
/**
* Returns the certificate issuer's data (OU etc parameters of certificate)
*
* @param result - the details about the issuer
*/
NS_IMETHOD
GetCertificateAuthority(const char **ppCertAuthority) = 0;
/**
* Returns the serial number of certificate
*
* @param result - Returns the serial number of certificate
*/
NS_IMETHOD
GetSerialNumber(const char **ppSerialNumber) = 0;
/**
* Returns the expiration date of certificate
*
* @param result - Returns the expiration date of certificate
*/
NS_IMETHOD
GetExpirationDate(const char **ppExpDate) = 0;
/**
* Returns the finger print of certificate
*
* @param result - Returns the finger print of certificate
*/
NS_IMETHOD
GetFingerPrint(const char **ppFingerPrint) = 0;
};
#define NS_ICERTPRINCIPAL_IID \
{ /* ebfefcd0-25e1-11d2-8160-006008119d7a */ \
0xebfefcd0, \
0x25e1, \
0x11d2, \
{0x81, 0x60, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
}
#endif // nsICertPrincipal_h___

View File

@ -1,110 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsICodeSourcePrincipal_h___
#define nsICodeSourcePrincipal_h___
#include "nsIPrincipal.h"
#include "nsICertPrincipal.h"
#include "nsICodebasePrincipal.h"
class nsICodeSourcePrincipal : public nsIPrincipal {
/**
* returns the certificate's data that is passes in via Initialize method.
*
* @param certChain - An array of pointers, with each pointer
* pointing to a certificate data.
* @param certChainLengths - An array of intergers. Each integer indicates
* the length of the cert that is in CertChain
* parametr.
* @param noOfCerts - the number of certifcates that are in the certChain array
*/
NS_IMETHOD
GetCertData(const unsigned char ***certChain, PRUint32 **certChainLengths, PRUint32 *noOfCerts) = 0;
/**
* Returns the public key of the certificate.
*
* @param publicKey - the Public Key data will be returned in this field.
* @param publicKeySize - the length of public key data is returned in this
* parameter.
*/
NS_IMETHOD
GetPublicKey(unsigned char **publicKey, PRUint32 *publicKeySize) = 0;
/**
* Returns the company name of the ceritificate (OU etc parameters of certificate)
*
* @param result - the certificate details about the signer.
*/
NS_IMETHOD
GetCompanyName(const char **ppCompanyName) = 0;
/**
* Returns the certificate issuer's data (OU etc parameters of certificate)
*
* @param result - the details about the issuer
*/
NS_IMETHOD
GetCertificateAuthority(const char **ppCertAuthority) = 0;
/**
* Returns the serial number of certificate
*
* @param result - Returns the serial number of certificate
*/
NS_IMETHOD
GetSerialNumber(const char **ppSerialNumber) = 0;
/**
* Returns the expiration date of certificate
*
* @param result - Returns the expiration date of certificate
*/
NS_IMETHOD
GetExpirationDate(const char **ppExpDate) = 0;
/**
* Returns the finger print of certificate
*
* @param result - Returns the finger print of certificate
*/
NS_IMETHOD
GetFingerPrint(const char **ppFingerPrint) = 0;
/**
* Returns the codebase URL of the principal.
*
* @param result - the resulting codebase URL
*/
NS_IMETHOD
GetURL(const char **ppCodeBaseURL) = 0;
};
#define NS_ICODESOURCEPRINCIPAL_IID \
{ /* 68cb0890-436a-11d2-b940-00805f52351a */ \
0x68cb0890, \
0x436a, \
0x11d2, \
{0xb9, 0x40, 0x00, 0x80, 0x5f, 0x52, 0x35, 0x1a} \
}
#endif // nsICodeSourcePrincipal_h___

View File

@ -40,8 +40,8 @@ CPPSRCS = \
admin.cpp \
nsCaps.cpp \
nsCCapsManager.cpp \
nsCCertPrincipal.cpp \
nsCCodebasePrincipal.cpp \
nsCertificatePrincipal.cpp \
nsCodebasePrincipal.cpp \
nsCCapsManagerFactory.cpp \
nsCCodeSourcePrincipal.cpp \
$(NULL)

View File

@ -68,8 +68,8 @@ CPP_OBJS= \
.\$(OBJDIR)\admin.obj \
.\$(OBJDIR)\nsCaps.obj \
.\$(OBJDIR)\nsCCapsManager.obj \
.\$(OBJDIR)\nsCCertPrincipal.obj \
.\$(OBJDIR)\nsCCodebasePrincipal.obj \
.\$(OBJDIR)\nsCertificatePrincipal.obj \
.\$(OBJDIR)\nsCodebasePrincipal.obj \
.\$(OBJDIR)\nsCCapsManagerFactory.obj \
.\$(OBJDIR)\nsCCodeSourcePrincipal.obj \
$(NULL)

View File

@ -12,16 +12,16 @@
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsIComponentManager.h"
#include "nsCapsEnums.h"
#include "nsCCapsManager.h"
#include "nsICodebasePrincipal.h"
#include "nsICertPrincipal.h"
#include "nsCCodebasePrincipal.h"
#include "nsCCertPrincipal.h"
#include "nsICertificatePrincipal.h"
#include "nsCodebasePrincipal.h"
#include "nsCertificatePrincipal.h"
#include "nsCCodeSourcePrincipal.h"
#include "nsCaps.h"
#include "nsICapsSecurityCallbacks.h"
@ -72,8 +72,8 @@ nsCCapsManager::CreateCodebasePrincipal(const char *codebaseURL,
nsIPrincipal** prin)
{
nsresult result = NS_OK;
nsCCodebasePrincipal *pNSCCodebasePrincipal =
new nsCCodebasePrincipal(codebaseURL, &result);
nsCodebasePrincipal *pNSCCodebasePrincipal =
new nsCodebasePrincipal(codebaseURL, &result);
if (pNSCCodebasePrincipal == NULL)
{
return NS_ERROR_OUT_OF_MEMORY;
@ -90,8 +90,8 @@ nsCCapsManager::CreateCertPrincipal(const unsigned char **certChain,
nsIPrincipal** prin)
{
nsresult result = NS_OK;
nsCCertPrincipal *pNSCCertPrincipal =
new nsCCertPrincipal(certChain, certChainLengths, noOfCerts, &result);
nsCertificatePrincipal *pNSCCertPrincipal =
new nsCertificatePrincipal(certChain, certChainLengths, noOfCerts, &result);
if (pNSCCertPrincipal == NULL)
{
return NS_ERROR_OUT_OF_MEMORY;
@ -480,9 +480,9 @@ nsCCapsManager::NewPrincipal(nsPrincipalType type, void* key, PRUint32 key_len,
nsIPrincipal* pNSIPrincipal;
nsPrincipal *pNSPrincipal = new nsPrincipal(type, key, key_len, zig);
if (pNSPrincipal->isCodebase()) {
pNSIPrincipal = (nsIPrincipal*)new nsCCodebasePrincipal(pNSPrincipal);
pNSIPrincipal = (nsIPrincipal*)new nsCodebasePrincipal(pNSPrincipal);
} else {
pNSIPrincipal = (nsIPrincipal*)new nsCCertPrincipal(pNSPrincipal);
pNSIPrincipal = (nsIPrincipal*)new nsCertificatePrincipal(pNSPrincipal);
}
*ret_val = pNSIPrincipal;
return NS_OK;
@ -642,9 +642,9 @@ nsCCapsManager::GetPrincipalArrayElement(void *prinArrayArg, PRUint32 index, nsI
nsIPrincipal* pNSIPrincipal;
nsPrincipal *pNSPrincipal = (nsPrincipal *)nsCapsGetPrincipalArrayElement(prinArrayArg, index);
if (pNSPrincipal->isCodebase()) {
pNSIPrincipal = (nsIPrincipal*)new nsCCodebasePrincipal(pNSPrincipal);
pNSIPrincipal = (nsIPrincipal*)new nsCodebasePrincipal(pNSPrincipal);
} else {
pNSIPrincipal = (nsIPrincipal*)new nsCCertPrincipal(pNSPrincipal);
pNSIPrincipal = (nsIPrincipal*)new nsCertificatePrincipal(pNSPrincipal);
}
*ret_val = pNSIPrincipal;
return NS_OK;
@ -729,9 +729,9 @@ nsCCapsManager::CreateNSPrincipalArray(nsPrincipalArray* prinArray,
for (PRUint32 index = 0; index < count; index++) {
pNSPrincipal = (nsPrincipal *)prinArray->Get(index);
if (pNSPrincipal->isCodebase()) {
pNSIPrincipal = (nsIPrincipal*)new nsCCodebasePrincipal(pNSPrincipal);
pNSIPrincipal = (nsIPrincipal*)new nsCodebasePrincipal(pNSPrincipal);
} else {
pNSIPrincipal = (nsIPrincipal*)new nsCCertPrincipal(pNSPrincipal);
pNSIPrincipal = (nsIPrincipal*)new nsCertificatePrincipal(pNSPrincipal);
}
newPrinArray->Set(index, pNSIPrincipal);
}
@ -779,7 +779,7 @@ nsCCapsManager::GetNSPrincipal(nsIPrincipal* pNSIPrincipal,
return NS_ERROR_NULL_POINTER;
}
NS_DEFINE_IID(kICertPrincipalIID, NS_ICERTPRINCIPAL_IID);
NS_DEFINE_IID(kICertificatePrincipalIID, NS_ICERTIFICATEPRINCIPAL_IID);
NS_DEFINE_IID(kICodebasePrincipalIID, NS_ICODEBASEPRINCIPAL_IID);
NS_DEFINE_IID(kICodeSourcePrincipalIID, NS_ICODESOURCEPRINCIPAL_IID);
@ -787,7 +787,7 @@ nsCCapsManager::GetNSPrincipal(nsIPrincipal* pNSIPrincipal,
(void**)&pNSISupports) == NS_OK)
{
nsCCodeSourcePrincipal *pNSCCodeSourcePrincipal = (nsCCodeSourcePrincipal *)pNSIPrincipal;
nsICertPrincipal *pNSICertPrincipal = pNSCCodeSourcePrincipal->GetCertPrincipal();
nsICertificatePrincipal *pNSICertPrincipal = pNSCCodeSourcePrincipal->GetCertPrincipal();
nsICodebasePrincipal *pNSICodebasePrincipal = pNSCCodeSourcePrincipal->GetCodebasePrincipal();
PRBool bIsTrusted = PR_FALSE;
if(pNSICertPrincipal != NULL )
@ -796,14 +796,14 @@ nsCCapsManager::GetNSPrincipal(nsIPrincipal* pNSIPrincipal,
}
if (bIsTrusted)
{
nsCCertPrincipal *pNSCCertPrincipal = (nsCCertPrincipal *)pNSICertPrincipal;
nsCertificatePrincipal *pNSCCertPrincipal = (nsCertificatePrincipal *)pNSICertPrincipal;
pNSPrincipal = pNSCCertPrincipal->GetPeer();
pNSCCertPrincipal->Release();
}
else
if(pNSICodebasePrincipal != NULL )
{
nsCCodebasePrincipal *pNSCCodebasePrincipal = (nsCCodebasePrincipal *)pNSICodebasePrincipal;
nsCodebasePrincipal *pNSCCodebasePrincipal = (nsCodebasePrincipal *)pNSICodebasePrincipal;
pNSPrincipal = pNSCCodebasePrincipal->GetPeer();
pNSCCodebasePrincipal->Release();
}
@ -813,10 +813,10 @@ nsCCapsManager::GetNSPrincipal(nsIPrincipal* pNSIPrincipal,
}
}
else
if (pNSIPrincipal->QueryInterface(kICertPrincipalIID,
if (pNSIPrincipal->QueryInterface(kICertificatePrincipalIID,
(void**)&pNSISupports) == NS_OK)
{
nsCCertPrincipal *pNSCCertPrincipal = (nsCCertPrincipal *)pNSIPrincipal;
nsCertificatePrincipal *pNSCCertPrincipal = (nsCertificatePrincipal *)pNSIPrincipal;
pNSPrincipal = pNSCCertPrincipal->GetPeer();
pNSCCertPrincipal->Release();
}
@ -824,8 +824,8 @@ nsCCapsManager::GetNSPrincipal(nsIPrincipal* pNSIPrincipal,
if (pNSIPrincipal->QueryInterface(kICodebasePrincipalIID,
(void**)&pNSISupports) == NS_OK)
{
nsCCodebasePrincipal *pNSCCodebasePrincipal =
(nsCCodebasePrincipal *)pNSIPrincipal;
nsCodebasePrincipal *pNSCCodebasePrincipal =
(nsCodebasePrincipal *)pNSIPrincipal;
pNSPrincipal = pNSCCodebasePrincipal->GetPeer();
pNSCCodebasePrincipal->Release();
}

View File

@ -17,8 +17,8 @@
*/
#include "nsCCodeSourcePrincipal.h"
#include "nsCCodebasePrincipal.h"
#include "nsCCertPrincipal.h"
#include "nsCodebasePrincipal.h"
#include "nsCertificatePrincipal.h"
#include "nsPrincipal.h"
NS_DEFINE_IID(kICodeSourcePrincipalIID, NS_ICODESOURCEPRINCIPAL_IID);
@ -29,9 +29,7 @@ NS_DEFINE_IID(kICodeSourcePrincipalIID, NS_ICODESOURCEPRINCIPAL_IID);
// These macros produce simple version of QueryInterface and AddRef.
// See the nsISupports.h header file for DETAILS.
NS_IMPL_ADDREF(nsCCodeSourcePrincipal)
NS_IMPL_RELEASE(nsCCodeSourcePrincipal)
NS_IMPL_QUERY_INTERFACE(nsCCodeSourcePrincipal, kICodeSourcePrincipalIID);
NS_IMPL_ISUPPORTS(nsCCodeSourcePrincipal,kICodeSourcePrincipalIID);
////////////////////////////////////////////////////////////////////////////
// from nsIPrincipal:
@ -57,28 +55,6 @@ nsCCodeSourcePrincipal::IsTrusted(const char* scope, PRBool *pbIsTrusted)
////////////////////////////////////////////////////////////////////////////
// from nsICodeSourcePrincipal:
/**
* returns the certificate's data that is passes in via Initialize method.
*
* @param certByteData - The ceritificate's byte array data including the chain.
* @param certByteDataSize - the length of certificate byte array.
*/
NS_METHOD
nsCCodeSourcePrincipal::GetCertData(const unsigned char ***certChain,
PRUint32 **certChainLengths,
PRUint32 *noOfCerts)
{
*certChain = NULL;
*certChainLengths = 0;
*noOfCerts = 0;
if(m_pNSICertPrincipal == NULL)
{
return NS_ERROR_ILLEGAL_VALUE;
}
/* XXX: Raman fix it. Return the correct data */
return NS_OK;
}
/**
* Returns the public key of the certificate.
*
@ -87,7 +63,7 @@ nsCCodeSourcePrincipal::GetCertData(const unsigned char ***certChain,
* parameter.
*/
NS_METHOD
nsCCodeSourcePrincipal::GetPublicKey(unsigned char **publicKey,
nsCCodeSourcePrincipal::GetPublicKey(char **publicKey,
PRUint32 *publicKeySize)
{
if(m_pNSICertPrincipal == NULL)
@ -105,7 +81,7 @@ nsCCodeSourcePrincipal::GetPublicKey(unsigned char **publicKey,
* @param result - the certificate details about the signer.
*/
NS_METHOD
nsCCodeSourcePrincipal::GetCompanyName(const char **ppCompanyName)
nsCCodeSourcePrincipal::GetCompanyName(char **ppCompanyName)
{
if(m_pNSICertPrincipal == NULL)
{
@ -121,7 +97,7 @@ nsCCodeSourcePrincipal::GetCompanyName(const char **ppCompanyName)
* @param result - the details about the issuer
*/
NS_METHOD
nsCCodeSourcePrincipal::GetCertificateAuthority(const char **ppCertAuthority)
nsCCodeSourcePrincipal::GetCertificateAuthority(char **ppCertAuthority)
{
if(m_pNSICertPrincipal == NULL)
{
@ -137,7 +113,7 @@ nsCCodeSourcePrincipal::GetCertificateAuthority(const char **ppCertAuthority)
* @param result - Returns the serial number of certificate
*/
NS_METHOD
nsCCodeSourcePrincipal::GetSerialNumber(const char **ppSerialNumber)
nsCCodeSourcePrincipal::GetSerialNumber(char **ppSerialNumber)
{
if(m_pNSICertPrincipal == NULL)
{
@ -153,7 +129,7 @@ nsCCodeSourcePrincipal::GetSerialNumber(const char **ppSerialNumber)
* @param result - Returns the expiration date of certificate
*/
NS_METHOD
nsCCodeSourcePrincipal::GetExpirationDate(const char **ppExpDate)
nsCCodeSourcePrincipal::GetExpirationDate(char **ppExpDate)
{
if(m_pNSICertPrincipal == NULL)
{
@ -169,7 +145,7 @@ nsCCodeSourcePrincipal::GetExpirationDate(const char **ppExpDate)
* @param result - Returns the finger print of certificate
*/
NS_METHOD
nsCCodeSourcePrincipal::GetFingerPrint(const char **ppFingerPrint)
nsCCodeSourcePrincipal::GetFingerPrint(char **ppFingerPrint)
{
if(m_pNSICertPrincipal == NULL)
{
@ -186,7 +162,7 @@ nsCCodeSourcePrincipal::GetFingerPrint(const char **ppFingerPrint)
* @param result - the resulting codebase URL
*/
NS_METHOD
nsCCodeSourcePrincipal::GetURL(const char **ppCodeBaseURL)
nsCCodeSourcePrincipal::GetURL(char **ppCodeBaseURL)
{
if(m_pNSICodebasePrincipal == NULL)
{
@ -207,18 +183,18 @@ nsCCodeSourcePrincipal::nsCCodeSourcePrincipal(const unsigned char **certChain,
nsresult *result)
{
*result = NS_OK;
nsCCertPrincipal *pNSCCertPrincipal =
new nsCCertPrincipal(certChain, certChainLengths, noOfCerts, result);
nsCertificatePrincipal *pNSCCertPrincipal =
new nsCertificatePrincipal(certChain, certChainLengths, noOfCerts, result);
if (pNSCCertPrincipal == NULL)
{
return;
}
m_pNSICertPrincipal = (nsICertPrincipal *)pNSCCertPrincipal;
m_pNSICertPrincipal = (nsICertificatePrincipal *)pNSCCertPrincipal;
m_pNSICertPrincipal->AddRef();
nsCCodebasePrincipal *pNSCCodebasePrincipal =
new nsCCodebasePrincipal(codebaseURL, result);
nsCodebasePrincipal *pNSCCodebasePrincipal =
new nsCodebasePrincipal(codebaseURL, result);
if (pNSCCodebasePrincipal == NULL)
{
return;
@ -232,7 +208,4 @@ nsCCodeSourcePrincipal::~nsCCodeSourcePrincipal(void)
{
m_pNSICertPrincipal->Release();
m_pNSICodebasePrincipal->Release();
}
}

View File

@ -16,10 +16,10 @@
* Reserved.
*/
#include "nsCCertPrincipal.h"
#include "nsCertificatePrincipal.h"
#include "nsPrincipal.h"
NS_DEFINE_IID(kICertPrincipalIID, NS_ICERTPRINCIPAL_IID);
static NS_DEFINE_IID(kICertificatePrincipalIID, NS_ICERTIFICATEPRINCIPAL_IID);
////////////////////////////////////////////////////////////////////////////
// from nsISupports:
@ -27,15 +27,13 @@ NS_DEFINE_IID(kICertPrincipalIID, NS_ICERTPRINCIPAL_IID);
// These macros produce simple version of QueryInterface and AddRef.
// See the nsISupports.h header file for DETAILS.
NS_IMPL_ADDREF(nsCCertPrincipal)
NS_IMPL_RELEASE(nsCCertPrincipal)
NS_IMPL_QUERY_INTERFACE(nsCCertPrincipal, kICertPrincipalIID);
NS_IMPL_ISUPPORTS(nsCertificatePrincipal,kICertificatePrincipalIID);
////////////////////////////////////////////////////////////////////////////
// from nsIPrincipal:
NS_METHOD
nsCCertPrincipal::IsTrusted(const char* scope, PRBool *pbIsTrusted)
NS_IMETHODIMP
nsCertificatePrincipal::IsTrusted(const char* scope, PRBool *pbIsTrusted)
{
if(m_pNSPrincipal == NULL)
{
@ -47,34 +45,7 @@ nsCCertPrincipal::IsTrusted(const char* scope, PRBool *pbIsTrusted)
}
////////////////////////////////////////////////////////////////////////////
// from nsICertPrincipal:
/**
* returns the certificate's data that is passes in via Initialize method.
*
* @param certChain - An array of pointers, with each pointer
* pointing to a certificate data.
* @param certChainLengths - An array of intergers. Each integer indicates
* the length of the cert that is in CertChain
* parametr.
* @param noOfCerts - the number of certifcates that are in the certChain array
*/
NS_METHOD
nsCCertPrincipal::GetCertData(const unsigned char ***certChain,
PRUint32 **certChainLengths,
PRUint32 *noOfCerts)
{
*certChain = NULL;
*certChainLengths = 0;
*noOfCerts = 0;
if (m_pNSPrincipal == NULL)
{
return NS_ERROR_ILLEGAL_VALUE;
}
/* XXX: Raman fix it. Return the correct data */
return NS_OK;
}
// from nsICertificatePrincipal:
/**
* Returns the public key of the certificate.
*
@ -82,8 +53,8 @@ nsCCertPrincipal::GetCertData(const unsigned char ***certChain,
* @param publicKeySize - the length of public key data is returned in this
* parameter.
*/
NS_METHOD
nsCCertPrincipal::GetPublicKey(unsigned char **publicKey, PRUint32 *publicKeySize)
NS_IMETHODIMP
nsCertificatePrincipal::GetPublicKey(char **publicKey, PRUint32 *publicKeySize)
{
// XXX raman: fix it.
PR_ASSERT(PR_FALSE);
@ -95,8 +66,8 @@ nsCCertPrincipal::GetPublicKey(unsigned char **publicKey, PRUint32 *publicKeySiz
*
* @param result - the certificate details about the signer.
*/
NS_METHOD
nsCCertPrincipal::GetCompanyName(const char **ppCompanyName)
NS_IMETHODIMP
nsCertificatePrincipal::GetCompanyName(char **ppCompanyName)
{
if(m_pNSPrincipal == NULL)
{
@ -112,8 +83,8 @@ nsCCertPrincipal::GetCompanyName(const char **ppCompanyName)
*
* @param result - the details about the issuer
*/
NS_METHOD
nsCCertPrincipal::GetCertificateAuthority(const char **ppCertAuthority)
NS_IMETHODIMP
nsCertificatePrincipal::GetCertificateAuthority(char **ppCertAuthority)
{
if(m_pNSPrincipal == NULL)
{
@ -129,8 +100,8 @@ nsCCertPrincipal::GetCertificateAuthority(const char **ppCertAuthority)
*
* @param result - Returns the serial number of certificate
*/
NS_METHOD
nsCCertPrincipal::GetSerialNumber(const char **ppSerialNumber)
NS_IMETHODIMP
nsCertificatePrincipal::GetSerialNumber(char **ppSerialNumber)
{
if(m_pNSPrincipal == NULL)
{
@ -146,8 +117,8 @@ nsCCertPrincipal::GetSerialNumber(const char **ppSerialNumber)
*
* @param result - Returns the expiration date of certificate
*/
NS_METHOD
nsCCertPrincipal::GetExpirationDate(const char **ppExpDate)
NS_IMETHODIMP
nsCertificatePrincipal::GetExpirationDate(char **ppExpDate)
{
if(m_pNSPrincipal == NULL)
{
@ -163,8 +134,8 @@ nsCCertPrincipal::GetExpirationDate(const char **ppExpDate)
*
* @param result - Returns the finger print of certificate
*/
NS_METHOD
nsCCertPrincipal::GetFingerPrint(const char **ppFingerPrint)
NS_IMETHODIMP
nsCertificatePrincipal::GetFingerPrint(char **ppFingerPrint)
{
if(m_pNSPrincipal == NULL)
{
@ -176,9 +147,9 @@ nsCCertPrincipal::GetFingerPrint(const char **ppFingerPrint)
}
////////////////////////////////////////////////////////////////////////////
// from nsCCertPrincipal:
// from nsCertificatePrincipal:
nsCCertPrincipal::nsCCertPrincipal(const unsigned char **certChain,
nsCertificatePrincipal::nsCertificatePrincipal(const unsigned char **certChain,
PRUint32 *certChainLengths,
PRUint32 noOfCerts,
nsresult *result)
@ -193,20 +164,18 @@ nsCCertPrincipal::nsCCertPrincipal(const unsigned char **certChain,
*result = NS_OK;
}
nsCCertPrincipal::nsCCertPrincipal(nsPrincipal *pNSPrincipal)
nsCertificatePrincipal::nsCertificatePrincipal(nsPrincipal *pNSPrincipal)
{
m_pNSPrincipal = pNSPrincipal;
}
nsCCertPrincipal::~nsCCertPrincipal(void)
nsCertificatePrincipal::~nsCertificatePrincipal(void)
{
delete m_pNSPrincipal;
}
nsPrincipal*
nsCCertPrincipal::GetPeer(void)
nsCertificatePrincipal::GetPeer(void)
{
return m_pNSPrincipal;
}
}

View File

@ -16,26 +16,24 @@
* Reserved.
*/
#include "nsCCodebasePrincipal.h"
#include "nsCodebasePrincipal.h"
#include "nsPrincipal.h"
#include "xp.h"
NS_DEFINE_IID(kICodebasePrincipalIID, NS_ICODEBASEPRINCIPAL_IID);
static NS_DEFINE_IID(kICodebasePrincipalIID, NS_ICODEBASEPRINCIPAL_IID);
////////////////////////////////////////////////////////////////////////////
// from nsISupports:
// These macros produce simple version of QueryInterface and AddRef.
// See the nsISupports.h header file for DETAILS.
NS_IMPL_ADDREF(nsCCodebasePrincipal)
NS_IMPL_RELEASE(nsCCodebasePrincipal)
NS_IMPL_QUERY_INTERFACE(nsCCodebasePrincipal, kICodebasePrincipalIID);
NS_IMPL_ISUPPORTS(nsCodebasePrincipal, kICodebasePrincipalIID);
////////////////////////////////////////////////////////////////////////////
// from nsIPrincipal:
NS_METHOD
nsCCodebasePrincipal::IsTrusted(const char* scope, PRBool *pbIsTrusted)
NS_IMETHODIMP
nsCodebasePrincipal::IsTrusted(const char* scope, PRBool *pbIsTrusted)
{
if(m_pNSPrincipal == NULL)
{
@ -53,8 +51,8 @@ nsCCodebasePrincipal::IsTrusted(const char* scope, PRBool *pbIsTrusted)
*
* @param result - the resulting codebase URL
*/
NS_METHOD
nsCCodebasePrincipal::GetURL(const char **ppCodeBaseURL)
NS_IMETHODIMP
nsCodebasePrincipal::GetURL(char **ppCodeBaseURL)
{
if(m_pNSPrincipal == NULL)
{
@ -68,7 +66,7 @@ nsCCodebasePrincipal::GetURL(const char **ppCodeBaseURL)
////////////////////////////////////////////////////////////////////////////
// from nsCCodebasePrincipal:
nsCCodebasePrincipal::nsCCodebasePrincipal(const char *codebaseURL,
nsCodebasePrincipal::nsCodebasePrincipal(const char *codebaseURL,
nsresult *result)
{
m_pNSPrincipal = new nsPrincipal(nsPrincipalType_CodebaseExact,
@ -82,18 +80,18 @@ nsCCodebasePrincipal::nsCCodebasePrincipal(const char *codebaseURL,
*result = NS_OK;
}
nsCCodebasePrincipal::nsCCodebasePrincipal(nsPrincipal *pNSPrincipal)
nsCodebasePrincipal::nsCodebasePrincipal(nsPrincipal *pNSPrincipal)
{
m_pNSPrincipal = pNSPrincipal;
}
nsCCodebasePrincipal::~nsCCodebasePrincipal(void)
nsCodebasePrincipal::~nsCodebasePrincipal(void)
{
delete m_pNSPrincipal;
}
nsPrincipal*
nsCCodebasePrincipal::GetPeer(void)
nsCodebasePrincipal::GetPeer(void)
{
return m_pNSPrincipal;
}