~ubuntu-branches/ubuntu/lucid/seamonkey/lucid-security

« back to all changes in this revision

Viewing changes to security/nss-fips/lib/ckfw/dbm/object.c

  • Committer: Bazaar Package Importer
  • Author(s): Fabien Tassin
  • Date: 2008-07-29 21:29:02 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080729212902-spm9kpvchp9udwbw
Tags: 1.1.11+nobinonly-0ubuntu1
* New security upstream release: 1.1.11 (LP: #218534)
  Fixes USN-602-1, USN-619-1, USN-623-1 and USN-629-1
* Refresh diverged patch:
  - update debian/patches/80_security_build.patch
* Fix FTBFS with missing -lfontconfig
  - add debian/patches/11_fix_ftbfs_with_fontconfig.patch
  - update debian/patches/series
* Build with default gcc (hardy: 4.2, intrepid: 4.3)
  - update debian/rules
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ***** BEGIN LICENSE BLOCK *****
 
2
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
3
 *
 
4
 * The contents of this file are subject to the Mozilla Public License Version
 
5
 * 1.1 (the "License"); you may not use this file except in compliance with
 
6
 * the License. You may obtain a copy of the License at
 
7
 * http://www.mozilla.org/MPL/
 
8
 *
 
9
 * Software distributed under the License is distributed on an "AS IS" basis,
 
10
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
11
 * for the specific language governing rights and limitations under the
 
12
 * License.
 
13
 *
 
14
 * The Original Code is the Netscape security libraries.
 
15
 *
 
16
 * The Initial Developer of the Original Code is
 
17
 * Netscape Communications Corporation.
 
18
 * Portions created by the Initial Developer are Copyright (C) 1994-2000
 
19
 * the Initial Developer. All Rights Reserved.
 
20
 *
 
21
 * Contributor(s):
 
22
 *
 
23
 * Alternatively, the contents of this file may be used under the terms of
 
24
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 
25
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
26
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
27
 * of those above. If you wish to allow use of your version of this file only
 
28
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
29
 * use your version of this file under the terms of the MPL, indicate your
 
30
 * decision by deleting the provisions above and replace them with the notice
 
31
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
32
 * the provisions above, a recipient may use your version of this file under
 
33
 * the terms of any one of the MPL, the GPL or the LGPL.
 
34
 *
 
35
 * ***** END LICENSE BLOCK ***** */
 
36
 
 
37
#ifdef DEBUG
 
38
static const char CVS_ID[] = "@(#) $RCSfile: object.c,v $ $Revision: 1.2.28.1 $ $Date: 2006/03/02 22:45:14 $";
 
39
#endif /* DEBUG */
 
40
 
 
41
#include "ckdbm.h"
 
42
 
 
43
static void
 
44
nss_dbm_mdObject_Finalize
 
45
(
 
46
  NSSCKMDObject *mdObject,
 
47
  NSSCKFWObject *fwObject,
 
48
  NSSCKMDSession *mdSession,
 
49
  NSSCKFWSession *fwSession,
 
50
  NSSCKMDToken *mdToken,
 
51
  NSSCKFWToken *fwToken,
 
52
  NSSCKMDInstance *mdInstance,
 
53
  NSSCKFWInstance *fwInstance
 
54
)
 
55
{
 
56
  ;
 
57
}
 
58
 
 
59
static CK_RV
 
60
nss_dbm_mdObject_Destroy
 
61
(
 
62
  NSSCKMDObject *mdObject,
 
63
  NSSCKFWObject *fwObject,
 
64
  NSSCKMDSession *mdSession,
 
65
  NSSCKFWSession *fwSession,
 
66
  NSSCKMDToken *mdToken,
 
67
  NSSCKFWToken *fwToken,
 
68
  NSSCKMDInstance *mdInstance,
 
69
  NSSCKFWInstance *fwInstance
 
70
)
 
71
{
 
72
  nss_dbm_object_t *object = (nss_dbm_object_t *)mdObject->etc;
 
73
  return nss_dbm_db_delete_object(object->handle);
 
74
}
 
75
 
 
76
static CK_ULONG
 
77
nss_dbm_mdObject_GetAttributeCount
 
78
(
 
79
  NSSCKMDObject *mdObject,
 
80
  NSSCKFWObject *fwObject,
 
81
  NSSCKMDSession *mdSession,
 
82
  NSSCKFWSession *fwSession,
 
83
  NSSCKMDToken *mdToken,
 
84
  NSSCKFWToken *fwToken,
 
85
  NSSCKMDInstance *mdInstance,
 
86
  NSSCKFWInstance *fwInstance,
 
87
  CK_RV *pError
 
88
)
 
89
{
 
90
  nss_dbm_object_t *object = (nss_dbm_object_t *)mdObject->etc;
 
91
  nss_dbm_session_t *session = (nss_dbm_session_t *)mdSession->etc;
 
92
  return nss_dbm_db_get_object_attribute_count(object->handle, pError, 
 
93
                                               &session->deviceError);
 
94
}
 
95
 
 
96
static CK_RV
 
97
nss_dbm_mdObject_GetAttributeTypes
 
98
(
 
99
  NSSCKMDObject *mdObject,
 
100
  NSSCKFWObject *fwObject,
 
101
  NSSCKMDSession *mdSession,
 
102
  NSSCKFWSession *fwSession,
 
103
  NSSCKMDToken *mdToken,
 
104
  NSSCKFWToken *fwToken,
 
105
  NSSCKMDInstance *mdInstance,
 
106
  NSSCKFWInstance *fwInstance,
 
107
  CK_ATTRIBUTE_TYPE_PTR typeArray,
 
108
  CK_ULONG ulCount
 
109
)
 
110
{
 
111
  nss_dbm_object_t *object = (nss_dbm_object_t *)mdObject->etc;
 
112
  nss_dbm_session_t *session = (nss_dbm_session_t *)mdSession->etc;
 
113
  return nss_dbm_db_get_object_attribute_types(object->handle, typeArray,
 
114
                                               ulCount, &session->deviceError);
 
115
}
 
116
 
 
117
static CK_ULONG
 
118
nss_dbm_mdObject_GetAttributeSize
 
119
(
 
120
  NSSCKMDObject *mdObject,
 
121
  NSSCKFWObject *fwObject,
 
122
  NSSCKMDSession *mdSession,
 
123
  NSSCKFWSession *fwSession,
 
124
  NSSCKMDToken *mdToken,
 
125
  NSSCKFWToken *fwToken,
 
126
  NSSCKMDInstance *mdInstance,
 
127
  NSSCKFWInstance *fwInstance,
 
128
  CK_ATTRIBUTE_TYPE attribute,
 
129
  CK_RV *pError
 
130
)
 
131
{
 
132
  nss_dbm_object_t *object = (nss_dbm_object_t *)mdObject->etc;
 
133
  nss_dbm_session_t *session = (nss_dbm_session_t *)mdSession->etc;
 
134
  return nss_dbm_db_get_object_attribute_size(object->handle, attribute, pError, 
 
135
                                              &session->deviceError);
 
136
}
 
137
 
 
138
static NSSItem *
 
139
nss_dbm_mdObject_GetAttribute
 
140
(
 
141
  NSSCKMDObject *mdObject,
 
142
  NSSCKFWObject *fwObject,
 
143
  NSSCKMDSession *mdSession,
 
144
  NSSCKFWSession *fwSession,
 
145
  NSSCKMDToken *mdToken,
 
146
  NSSCKFWToken *fwToken,
 
147
  NSSCKMDInstance *mdInstance,
 
148
  NSSCKFWInstance *fwInstance,
 
149
  CK_ATTRIBUTE_TYPE attribute,
 
150
  CK_RV *pError
 
151
)
 
152
{
 
153
  nss_dbm_object_t *object = (nss_dbm_object_t *)mdObject->etc;
 
154
  nss_dbm_session_t *session = (nss_dbm_session_t *)mdSession->etc;
 
155
  return nss_dbm_db_get_object_attribute(object->handle, object->arena, attribute,
 
156
                                         pError, &session->deviceError);
 
157
}
 
158
 
 
159
static CK_RV
 
160
nss_dbm_mdObject_SetAttribute
 
161
(
 
162
  NSSCKMDObject *mdObject,
 
163
  NSSCKFWObject *fwObject,
 
164
  NSSCKMDSession *mdSession,
 
165
  NSSCKFWSession *fwSession,
 
166
  NSSCKMDToken *mdToken,
 
167
  NSSCKFWToken *fwToken,
 
168
  NSSCKMDInstance *mdInstance,
 
169
  NSSCKFWInstance *fwInstance,
 
170
  CK_ATTRIBUTE_TYPE attribute,
 
171
  NSSItem *value
 
172
)
 
173
{
 
174
  nss_dbm_object_t *object = (nss_dbm_object_t *)mdObject->etc;
 
175
  nss_dbm_session_t *session = (nss_dbm_session_t *)mdSession->etc;
 
176
  return nss_dbm_db_set_object_attribute(object->handle, attribute, value,
 
177
                                         &session->deviceError);
 
178
}
 
179
 
 
180
NSS_IMPLEMENT NSSCKMDObject *
 
181
nss_dbm_mdObject_factory
 
182
(
 
183
  nss_dbm_object_t *object,
 
184
  CK_RV *pError
 
185
)
 
186
{
 
187
  NSSCKMDObject *rv;
 
188
 
 
189
  rv = nss_ZNEW(object->arena, NSSCKMDObject);
 
190
  if( (NSSCKMDObject *)NULL == rv ) {
 
191
    *pError = CKR_HOST_MEMORY;
 
192
    return (NSSCKMDObject *)NULL;
 
193
  }
 
194
 
 
195
  rv->etc = (void *)object;
 
196
  rv->Finalize = nss_dbm_mdObject_Finalize;
 
197
  rv->Destroy = nss_dbm_mdObject_Destroy;
 
198
  /*  IsTokenObject can be deferred */
 
199
  rv->GetAttributeCount = nss_dbm_mdObject_GetAttributeCount;
 
200
  rv->GetAttributeTypes = nss_dbm_mdObject_GetAttributeTypes;
 
201
  rv->GetAttributeSize = nss_dbm_mdObject_GetAttributeSize;
 
202
  rv->GetAttribute = nss_dbm_mdObject_GetAttribute;
 
203
  rv->SetAttribute = nss_dbm_mdObject_SetAttribute;
 
204
  /*  GetObjectSize can be deferred */
 
205
 
 
206
  return rv;
 
207
}