extern struct afsconf_dir *tdir;
extern int DoPreserveVolumeStats;
extern int restrictedQueryLevel;
+extern enum vol_s2s_crypt doCrypt;
extern void LogError(afs_int32 errcode);
struct destServer *destination, afs_int32,
struct restoreCookie *cookie);
static afs_int32 VolDump(struct rx_call *, afs_int32, afs_int32, afs_int32);
-static afs_int32 VolRestore(struct rx_call *, afs_int32, afs_int32,
- struct restoreCookie *);
+static afs_int32 VolRestore(struct rx_call *, afs_int32, struct restoreCookie *);
static afs_int32 VolEndTrans(struct rx_call *, afs_int32, afs_int32 *);
static afs_int32 VolSetForwarding(struct rx_call *, afs_int32, afs_int32);
static afs_int32 VolGetStatus(struct rx_call *, afs_int32,
return code;
}
-/* get partition id from a name */
-afs_int32
-PartitionID(char *aname)
-{
- char tc;
- int code = 0;
- char ascii[3];
-
- tc = *aname;
- if (tc == 0)
- return -1; /* unknown */
-
- /* otherwise check for vicepa or /vicepa, or just plain "a" */
- ascii[2] = 0;
- if (!strncmp(aname, "/vicep", 6)) {
- strncpy(ascii, aname + 6, 2);
- } else
- return -1; /* bad partition name */
- /* now partitions are named /vicepa ... /vicepz, /vicepaa, /vicepab, .../vicepzz, and are numbered
- * from 0. Do the appropriate conversion */
- if (ascii[1] == 0) {
- /* one char name, 0..25 */
- if (ascii[0] < 'a' || ascii[0] > 'z')
- return -1; /* wrongo */
- return ascii[0] - 'a';
- } else {
- /* two char name, 26 .. <whatever> */
- if (ascii[0] < 'a' || ascii[0] > 'z')
- return -1; /* wrongo */
- if (ascii[1] < 'a' || ascii[1] > 'z')
- return -1; /* just as bad */
- code = (ascii[0] - 'a') * 26 + (ascii[1] - 'a') + 26;
- if (code > VOLMAXPARTS)
- return -1;
- return code;
- }
-}
-
static int
ConvertVolume(VolumeId avol, char *aname, afs_int32 asize)
{
afs_int32 code;
struct diskPartition64 *dp = malloc(sizeof(struct diskPartition64));
+ memset(partition, 0, sizeof(*partition));
code = VolPartitionInfo(acid, pname, dp);
if (!code) {
strncpy(partition->name, dp->name, 32);
{
afs_int32 code;
+ memset(partition, 0, sizeof(*partition));
code = VolPartitionInfo(acid, pname, partition);
osi_auditU(acid, VS_ParInfEvent, code, AUD_STR, pname, AUD_END);
return code;
goto fail;
}
if (newType == readonlyVolume) {
- AssignVolumeName(&V_disk(newvp), V_name(originalvp), ".readonly");
V_type(newvp) = readonlyVolume;
} else if (newType == backupVolume) {
- AssignVolumeName(&V_disk(newvp), V_name(originalvp), ".backup");
V_type(newvp) = backupVolume;
V_backupId(originalvp) = newId;
}
return code;
}
+static_inline afs_int32
+MakeClient(struct rx_call *acid, struct rx_securityClass **securityObject,
+ afs_int32 *securityIndex)
+{
+ rxkad_level enc_level = rxkad_clear;
+ int docrypt;
+ int code;
+
+ switch (doCrypt) {
+ case VS2SC_ALWAYS:
+ docrypt = 1;
+ break;
+ case VS2SC_INHERIT:
+ rxkad_GetServerInfo(rx_ConnectionOf(acid), &enc_level, 0, 0, 0, 0, 0);
+ docrypt = (enc_level == rxkad_crypt ? 1 : 0);
+ break;
+ case VS2SC_NEVER:
+ docrypt = 0;
+ break;
+ default:
+ opr_Assert(0 && "doCrypt corrupt?");
+ }
+ if (docrypt)
+ code = afsconf_ClientAuthSecure(tdir, securityObject, securityIndex);
+ else
+ code = afsconf_ClientAuth(tdir, securityObject, securityIndex);
+ return code;
+}
+
static afs_int32
VolForward(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate,
struct destServer *destination, afs_int32 destTrans,
TSetRxCall(tt, NULL, "Forward");
/* get auth info for the this connection (uses afs from ticket file) */
- code = afsconf_ClientAuth(tdir, &securityObject, &securityIndex);
+ code = MakeClient(acid, &securityObject, &securityIndex);
if (code) {
TRELE(tt);
return code;
}
/* get auth info for this connection (uses afs from ticket file) */
- code = afsconf_ClientAuth(tdir, &securityObject, &securityIndex);
+ code = MakeClient(acid, &securityObject, &securityIndex);
if (code) {
goto fail; /* in order to audit each failure */
}
{
afs_int32 code;
- code = VolRestore(acid, atrans, aflags, cookie);
+ code = VolRestore(acid, atrans, cookie);
osi_auditU(acid, VS_RestoreEvent, code, AUD_LONG, atrans, AUD_END);
return code;
}
static afs_int32
-VolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags,
- struct restoreCookie *cookie)
+VolRestore(struct rx_call *acid, afs_int32 atrans, struct restoreCookie *cookie)
{
struct volser_trans *tt;
afs_int32 code, tcode;
DFlushVolume(V_parentId(tt->volume)); /* Ensure dir buffers get dropped */
- code = RestoreVolume(acid, tt->volume, (aflags & 1), cookie); /* last is incrementalp */
+ code = RestoreVolume(acid, tt->volume, cookie);
FSYNC_VolOp(tt->volid, NULL, FSYNC_VOL_BREAKCBKS, 0l, NULL);
TClearRxCall(tt);
tcode = TRELE(tt);
case VOL_INFO_LIST_SINGLE:
Log("1 Volser: GetVolInfo: Volume %" AFS_VOLID_FMT " (%s:%s) will be destroyed on next salvage\n",
afs_printable_VolumeId_lu(volumeId), pname, volname);
+ goto drop;
default:
goto drop;
{
transDebugInfo *pntr;
afs_int32 allocSize = 50;
+ afs_int32 code = 0;
struct volser_trans *tt, *nt, *allTrans;
if (!afsconf_CheckRestrictedQuery(tdir, acid, restrictedQueryLevel))
goto done; /*no active transactions */
for (tt = allTrans; tt; tt = nt) { /*copy relevant info into pntr */
nt = tt->next;
+ memset(pntr, 0, sizeof(*pntr));
VTRANS_OBJ_LOCK(tt);
pntr->tid = tt->tid;
pntr->time = tt->time;
pntr->callValid = 0;
if (tt->rxCallPtr) { /*record call related info */
pntr->callValid = 1;
-#if 0
- pntr->readNext = tt->rxCallPtr->rnext;
- pntr->transmitNext = tt->rxCallPtr->tnext;
- pntr->lastSendTime = tt->rxCallPtr->lastSendTime;
- pntr->lastReceiveTime = tt->rxCallPtr->lastReceiveTime;
-#endif
+ rx_GetCallStatus(tt->rxCallPtr, &(pntr->readNext), &(pntr->transmitNext),
+ &(pntr->lastSendTime), &(pntr->lastReceiveTime));
}
VTRANS_OBJ_UNLOCK(tt);
pntr++;
allocSize = (allocSize * 3) / 2;
pntr = realloc(transInfo->transDebugEntries_val,
allocSize * sizeof(transDebugInfo));
+ if (pntr == NULL) {
+ code = ENOMEM;
+ goto done;
+ }
transInfo->transDebugEntries_val = pntr;
pntr =
transInfo->transDebugEntries_val +
done:
VTRANS_UNLOCK;
- return 0;
+ return code;
}
afs_int32
#endif
ttc = NewTrans(volumeId, partId);
if (!ttc) {
- return VOLSERVOLBUSY;
+ ret = VOLSERVOLBUSY;
+ goto done;
}
#ifdef AFS_NAMEI_ENV
ret = namei_ConvertROtoRWvolume(pname, volumeId);
break;
}
}
-
+ done:
if (ttc)
DeleteTrans(ttc, 1);