#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
+#include <roken.h>
#include "vosutils.h"
#include "vsprocs.h"
#include "lockprocs.h"
#include <afs/afs_AdminErrors.h>
-#ifdef HAVE_STRING_H
#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
/*
* VLDB entry conversion routines.
OldVLDB_to_NewVLDB(struct vldbentry *source, struct nvldbentry *dest,
afs_status_p st)
{
- register int i;
+ int i;
int rc = 0;
afs_status_t tst = 0;
NewVLDB_to_OldVLDB(struct nvldbentry *source, struct vldbentry *dest,
afs_status_p st)
{
- register int i;
+ int i;
afs_status_t tst = 0;
int rc = 0;
do {
if (cellHandle->vos_new) {
- tst = ubik_Call(VL_CreateEntryN, cellHandle->vos, 0, entryp);
+ tst = ubik_VL_CreateEntryN(cellHandle->vos, 0, entryp);
if (tst) {
if (tst == RXGEN_OPCODE) {
cellHandle->vos_new = 0;
}
} else {
if (NewVLDB_to_OldVLDB(entryp, &oentry, &tst)) {
- tst = ubik_Call(VL_CreateEntry, cellHandle->vos, 0, &oentry);
+ tst = ubik_VL_CreateEntry(cellHandle->vos, 0, &oentry);
if (!tst) {
rc = 1;
}
}
int
-aVLDB_GetEntryByID(afs_cell_handle_p cellHandle, afs_int32 volid,
+aVLDB_GetEntryByID(afs_cell_handle_p cellHandle, afs_uint32 volid,
afs_int32 voltype, struct nvldbentry *entryp,
afs_status_p st)
{
do {
if (cellHandle->vos_new) {
tst =
- ubik_Call(VL_GetEntryByIDN, cellHandle->vos, 0, volid,
+ ubik_VL_GetEntryByIDN(cellHandle->vos, 0, volid,
voltype, entryp);
if (tst) {
if (tst == RXGEN_OPCODE) {
}
} else {
tst =
- ubik_Call(VL_GetEntryByID, cellHandle->vos, 0, volid, voltype,
+ ubik_VL_GetEntryByID(cellHandle->vos, 0, volid, voltype,
&oentry);
if (tst == 0) {
rc = OldVLDB_to_NewVLDB(&oentry, entryp, &tst);
}
int
-aVLDB_GetEntryByName(afs_cell_handle_p cellHandle, const char *namep,
+aVLDB_GetEntryByName(afs_cell_handle_p cellHandle, char *namep,
struct nvldbentry *entryp, afs_status_p st)
{
struct vldbentry oentry;
do {
if (cellHandle->vos_new) {
tst =
- ubik_Call(VL_GetEntryByNameN, cellHandle->vos, 0, namep,
+ ubik_VL_GetEntryByNameN(cellHandle->vos, 0, namep,
entryp);
if (tst) {
if (tst == RXGEN_OPCODE) {
}
} else {
tst =
- ubik_Call(VL_GetEntryByNameO, cellHandle->vos, 0, namep,
+ ubik_VL_GetEntryByNameO(cellHandle->vos, 0, namep,
&oentry);
if (tst == 0) {
rc = OldVLDB_to_NewVLDB(&oentry, entryp, &tst);
}
int
-VLDB_ReplaceEntry(afs_cell_handle_p cellHandle, afs_int32 volid,
+VLDB_ReplaceEntry(afs_cell_handle_p cellHandle, afs_uint32 volid,
afs_int32 voltype, struct nvldbentry *entryp,
afs_int32 releasetype, afs_status_p st)
{
do {
if (cellHandle->vos_new) {
tst =
- ubik_Call(VL_ReplaceEntryN, cellHandle->vos, 0, volid,
+ ubik_VL_ReplaceEntryN(cellHandle->vos, 0, volid,
voltype, entryp, releasetype);
if (tst) {
if (tst == RXGEN_OPCODE) {
} else {
if (NewVLDB_to_OldVLDB(entryp, &oentry, &tst)) {
tst =
- ubik_Call(VL_ReplaceEntry, cellHandle->vos, 0, volid,
+ ubik_VL_ReplaceEntry(cellHandle->vos, 0, volid,
voltype, &oentry, releasetype);
if (!tst) {
rc = 1;
do {
if (cellHandle->vos_new) {
tst =
- ubik_Call(VL_ListAttributesN, cellHandle->vos, 0, attrp,
+ ubik_VL_ListAttributesN(cellHandle->vos, 0, attrp,
entriesp, blkentriesp);
if (tst) {
if (tst == RXGEN_OPCODE) {
cellHandle->vos_new = 0;
}
} else {
+ if (*entriesp < 0)
+ *entriesp = 0;
+ if (*entriesp > blkentriesp->nbulkentries_len)
+ *entriesp = blkentriesp->nbulkentries_len;
rc = 1;
}
} else {
memset((void *)&arrayEntries, 0, sizeof(arrayEntries));
tst =
- ubik_Call(VL_ListAttributes, cellHandle->vos, 0, attrp,
- entriesp, arrayEntries);
+ ubik_VL_ListAttributes(cellHandle->vos, 0, attrp,
+ entriesp, &arrayEntries);
if (tst == 0) {
+
+ if (*entriesp < 0)
+ *entriesp = 0;
+ if (*entriesp > arrayEntries.bulkentries_len)
+ *entriesp = arrayEntries.bulkentries_len;
+
blkentriesp->nbulkentries_val =
(nvldbentry *) malloc(*entriesp * sizeof(*blkentriesp));
if (blkentriesp->nbulkentries_val != NULL) {
if (arrayEntries.bulkentries_val) {
free(arrayEntries.bulkentries_val);
}
+
rc = 1;
}
}
afs_status_t tst = 0;
tst =
- ubik_Call(VL_ListAttributesN2, cellHandle->vos, 0, attrp,
+ ubik_VL_ListAttributesN2(cellHandle->vos, 0, attrp,
(name ? name : ""), thisindex, nentriesp, blkentriesp,
nextindexp);
if (!tst) {
ListAddrByAttributes attrs;
bulkaddrs addrs;
- afs_uint32 *addrp, nentries, unique, i;
+ afs_uint32 *addrp;
+ afs_int32 nentries, unique, i;
afsUUID uuid;
*equal = 0;
memset(&addrs, 0, sizeof(addrs));
memset(&uuid, 0, sizeof(uuid));
tst =
- ubik_Call(VL_GetAddrsU, cellHandle->vos, 0, &attrs, &uuid, &unique,
+ ubik_VL_GetAddrsU(cellHandle->vos, 0, &attrs, &uuid, &unique,
&nentries, &addrs);
if (tst) {
*equal = 0;
*/
int
-GetVolumeInfo(afs_cell_handle_p cellHandle, unsigned int volid,
+GetVolumeInfo(afs_cell_handle_p cellHandle, afs_uint32 volid,
struct nvldbentry *rentry, afs_int32 * server,
afs_int32 * partition, afs_int32 * voltype, afs_status_p st)
{
char sname[32];
size_t total;
- strcpy(sname, name);
+ strncpy(sname, name, 32);
+ sname[31] ='\0';
total = strlen(sname);
if ((total > 9) && (!strcmp(&sname[total - 9], ".readonly"))) {
/*discard the last 8 chars */
#ifdef AFS_NT40_ENV
-#define cszREG_IGNORE_KEY "Software\\TransarcCorporation\\AFS Control Center"
+#define cszREG_IGNORE_KEY "Software\\OpenAFS\\AFS Control Center"
#define cszREG_IGNORE_VALUE "IgnoreBadAddrs"
/*