the VC++ 2003 Toolkit is missing some important libraries.
remove it from the README-NT file
====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================
update docs
====================
simplify the freelance import from afs_freelance.ini code. don't generate
an new file if the old one does not exist.
begin conversion from old string functions to new strsafe functions.
this will need to be done for all of the afsd_service.exe source
modules before we can regularly use VS .NET 2005
Add support for VL_GetEntryByNameN. Still need to figure out what needs
to be done for VL_GetEntryByNameU. (multi-homed support)
====================
fix a deadlock situation if an Obtain Tokens dialog is produced
by an expiration event and the user chooses to cancel instead of
obtain new credentials.
of storage depending on which compilers are selected. The following
versions are supported:
- Microsoft Visual .NET
+ Microsoft Visual Studio .NET
available via a MSDN subscription
- Microsoft Visual .NET 2003 (recommended)
+ Microsoft Visual Studio .NET 2003 (recommended)
available via a MSDN subscription
- Microsoft Visual C++ Toolkit 2003 (same as .NET 2003)
- http://msdn.microsoft.com/visualc/vctoolkit2003/
+ Microsoft Visual Studio .NET 2005 (do not use for production)
+ available via a MSDN subscription
The following Microsoft SDK is required:
STEP B. Install compiler and development tools.
-Install a copy of Microsoft Visual .NET, Visual .NET 2003, Visual C++
-Toolkit 2003. The "Typical" install setting is sufficient.
+Install a copy of Microsoft Visual Studio .NET, Visual Studio .NET 2003,
+or Visual Studio .NET 2005. The "Typical" install setting is sufficient.
(1) You can reduce the installation size by selecting "Custom" install
and remove all but the following Options:
must be defined to match your configuration:
AFSVER_CL: Set to 1200 if using MS Visual C++ 6.0
- Set to 1300 if using MS Visual .NET
- Set to 1310 if using MS Visual .NET 2003
- Set to 1400 if using MS Visual .NET 2005
+ Set to 1300 if using MS Visual Studio .NET
+ Set to 1310 if using MS Visual Studio .NET 2003
+ Set to 1400 if using MS Visual Studio .NET 2005
MSVCDIR: Set to the short name version of the directory into which
the visual C++ compiler was installed regardless of version
+Since 1.3.74:
+ * Added support for VL_GetEntryByNameN(). Still need to add
+ support for VL_GetEntryByNameU() for multi-homed support.
+
+ * Fix a deadlock situation in afscreds.exe when canceling an
+ auto-generated Obtain Tokens dialog
+
Since 1.3.72/73:
* Fix the locking of objects during Directory Searches in the
SMB/CIFS server. The failure to properly lock the reference
or by the new AFS Client Service Administration tool when executed
by an authorized user.
+(31) Add support for multi-homed servers
+
+
-------------------------------------------------------------------------
List of unfunded projects:
24. Add support for storing Extended Attributes on files
25. Add support for storing Windows ACLs on files
26. Remove submount creation as a side effect of drive creation
+ 27. Finish conversion from string.h to strsafe.h
+ 28. Add support for multi-homed servers
DWORD dwType;
DWORD dwSize;
DWORD dwValue;
- PBYTE pHostNames = NULL, pName;
+ PBYTE pHostNames = NULL, pName = NULL;
BOOL bNameFound = FALSE;
if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE,
}
if ( !bNameFound ) {
+ int size = strlen(cm_NetbiosName) + 2;
if ( !pHostNames ) {
- pName = pHostNames = malloc(strlen(cm_NetbiosName) + 2);
+ pHostNames = malloc(size);
dwSize = 1;
}
- strcpy(pName, cm_NetbiosName);
- pName += strlen(cm_NetbiosName) + 1;
+ pName = pHostNames;
+ StringCbCopyA(pName, size, strlen(cm_NetbiosName));
+ pName += size - 1;
*pName = '\0'; /* add a second nul terminator */
dwType = REG_MULTI_SZ;
INetFwOpenPort * fwPort = NULL;
HRESULT hr;
HRESULT rhr = S_OK; /* return value */
+ int i = 0;
hr = fwProfile->get_GloballyOpenPorts(&fwPorts);
if (FAILED(hr)) {
}
// go through the supplied ports
- for (int i=0; i<nPorts; i++) {
+ for (i=0; i<nPorts; i++) {
VARIANT_BOOL vbEnabled;
BSTR bstName = NULL;
BOOL bCreate = FALSE;
lock_ObtainRead(&buf_globalLock);
- sprintf(output, "%s - dumping buf_HashTable - buf_hashSize=%d\n", cookie, buf_hashSize);
+ StringCbPrintfA(output, sizeof(output), "%s - dumping buf_HashTable - buf_hashSize=%d\n", cookie, buf_hashSize);
WriteFile(outputFile, output, strlen(output), &zilch, NULL);
for (i = 0; i < buf_hashSize; i++)
{
- for(bp = buf_hashTablepp[i]; bp; bp=bp->hashp)
+ for (bp = buf_hashTablepp[i]; bp; bp=bp->hashp)
{
if (bp->refCount)
{
- sprintf(output, "%s bp=0x%08X, hash=%d, fid (cell=%d, volume=%d,"
- "vnode=%d, unique=%d), size=%d refCount=%d\n",
+ StringCbPrintfA(output, sizeof(output), "vnode=%d, unique=%d), size=%d refCount=%d\n",
cookie, (void *)bp, i, bp->fid.cell, bp->fid.volume,
bp->fid.vnode, bp->fid.unique, bp->size, bp->refCount);
WriteFile(outputFile, output, strlen(output), &zilch, NULL);
}
}
- sprintf(output, "%s - Done dumping buf_HashTable.\n", cookie);
+ StringCbPrintfA(output, sizeof(output), "%s - Done dumping buf_HashTable.\n", cookie);
WriteFile(outputFile, output, strlen(output), &zilch, NULL);
lock_ReleaseRead(&buf_globalLock);
// open the ini file for reading
fp = fopen(hdir, "r");
- // if we fail to open the file, create an empty one
- if (!fp) {
- fp = fopen(hdir, "w");
- code = cm_GetRootCellName(rootCellName);
- if (code == 0) {
- fputs("1\n", fp);
- fprintf(fp,"%s#%s:root.cell.\n",rootCellName,rootCellName);
- fprintf(fp,".%s%%%s:root.cell.\n",rootCellName,rootCellName);
- fclose(fp);
- fp = fopen(hdir, "r");
- } else {
- fputs("0\n", fp);
- fclose(fp);
- return 0; /* success */
- }
- }
-
- // we successfully opened the file
- osi_Log0(afsd_logp,"opened afs_freelance.ini");
-
#if !defined(DJGPP)
RegCreateKeyEx( HKEY_LOCAL_MACHINE,
"SOFTWARE\\OpenAFS\\Client\\Freelance",
dwIndex = 0;
#endif
+ if (!fp) {
+#if !defined(DJGPP);
+ RegCloseKey(hkFreelance);
+#endif
+ rootCellName[0] = '.';
+ code = cm_GetRootCellName(&rootCellName[1]);
+ if (code == 0) {
+ cm_FreelanceAddMount(&rootCellName[1], &rootCellName[1], "root.cell", 0, NULL);
+ cm_FreelanceAddMount(rootCellName, &rootCellName[1], "root.cell", 1, NULL);
+ }
+ return 0;
+ }
+
+ // we successfully opened the file
+ osi_Log0(afsd_logp,"opened afs_freelance.ini");
+
// now we read the first line to see how many entries
// there are
fgets(line, sizeof(line), fp);
// that we read
cm_noLocalMountPoints = atoi(line);
- // create space to store the local mount points
- cm_localMountPoints = malloc(sizeof(cm_localMountPoint_t) * cm_noLocalMountPoints);
- aLocalMountPoint = cm_localMountPoints;
+ if (cm_noLocalMountPoints > 0) {
+ // create space to store the local mount points
+ cm_localMountPoints = malloc(sizeof(cm_localMountPoint_t) * cm_noLocalMountPoints);
+ aLocalMountPoint = cm_localMountPoints;
+ }
// now we read n lines and parse them into local mount points
// where n is the number of local mount points there are, as
return -1;
}
+ /* find the trailing dot; null terminate after it */
+ t2 = strrchr(line, '.');
+ if (t2)
+ *(t2+1) = '\0';
+
#if !defined(DJGPP)
if ( hkFreelance ) {
char szIndex[16];
*(aLocalMountPoint->namep + (t-line)) = 0;
aLocalMountPoint->mountPointStringp=malloc(strlen(line) - (t-line) + 1);
- memcpy(aLocalMountPoint->mountPointStringp, t, strlen(line)-(t-line)-2);
- *(aLocalMountPoint->mountPointStringp + (strlen(line)-(t-line)-2)) = 0;
+ memcpy(aLocalMountPoint->mountPointStringp, t, strlen(line)-(t-line)-1);
+ *(aLocalMountPoint->mountPointStringp + (strlen(line)-(t-line)-1)) = 0;
osi_Log2(afsd_logp,"found mount point: name %s, string %s",
aLocalMountPoint->namep,
RegSetValueEx( hkFreelance, szIndex, 0, dwType, line, dwSize);
break;
} else {
- int len = strlen(filename);
- if ( dwType == REG_SZ && !strncmp(filename, szMount, len) &&
- (szMount[len] == '%' || szMount[len] == '#')) {
+ int len = strlen(filename);
+ if ( dwType == REG_SZ && !strncmp(filename, szMount, len) &&
+ (szMount[len] == '%' || szMount[len] == '#')) {
/* Replace the existing value */
dwType = REG_SZ;
dwSize = strlen(line) + 1;
* easier (because we can always jump past the initial "/afs" to find
* the AFS path that should be written into afsdsbmt.ini).
*/
-void cm_NormalizeAfsPath (char *outpathp, char *inpathp)
+void cm_NormalizeAfsPath(char *outpathp, long outlen, char *inpathp)
{
char *cp;
char bslash_mountRoot[256];
bslash_mountRoot[0] = '\\';
if (!strnicmp (inpathp, cm_mountRoot, strlen(cm_mountRoot)))
- lstrcpy (outpathp, inpathp);
+ StringCbCopy(outpathp, outlen, inpathp);
else if (!strnicmp (inpathp, bslash_mountRoot, strlen(bslash_mountRoot)))
- lstrcpy (outpathp, inpathp);
+ StringCbCopy(outpathp, outlen, inpathp);
else if ((inpathp[0] == '/') || (inpathp[0] == '\\'))
- sprintf (outpathp, "%s%s", cm_mountRoot, inpathp);
+ StringCbPrintfA(outpathp, outlen, "%s%s", cm_mountRoot, inpathp);
else // inpathp looks like "<cell>/usr"
- sprintf (outpathp, "%s/%s", cm_mountRoot, inpathp);
+ StringCbPrintfA(outpathp, outlen, "%s/%s", cm_mountRoot, inpathp);
for (cp = outpathp; *cp != 0; ++cp) {
if (*cp == '\\')
}
if (!strcmpi (outpathp, cm_mountRoot)) {
- strcpy (outpathp, cm_mountRoot);
+ StringCbCopy(outpathp, outlen, cm_mountRoot);
}
}
+#define LEAF_SIZE 256
/* parse the passed-in file name and do a namei on its parent. If we fail,
* return an error code, otherwise return the vnode located in *scpp.
*/
char *tp, *jp;
cm_scache_t *substRootp;
- strcpy(tbuffer, ioctlp->inDatap);
+ StringCbCopyA(tbuffer, sizeof(tbuffer), ioctlp->inDatap);
tp = strrchr(tbuffer, '\\');
jp = strrchr(tbuffer, '/');
if (!tp)
else if (jp && (tp - tbuffer) < (jp - tbuffer))
tp = jp;
if (!tp) {
- strcpy(tbuffer, "\\");
+ StringCbCopyA(tbuffer, sizeof(tbuffer), "\\");
if (leafp)
- strcpy(leafp, ioctlp->inDatap);
+ StringCbCopyA(leafp, LEAF_SIZE, ioctlp->inDatap);
}
else {
*tp = 0;
if (leafp)
- strcpy(leafp, tp+1);
+ StringCbCopyA(leafp, LEAF_SIZE, tp+1);
}
if (tbuffer[0] == tbuffer[1] &&
scp->fid.cell==AFS_FAKE_ROOT_CELL_ID &&
scp->fid.volume==AFS_FAKE_ROOT_VOL_ID &&
scp->fid.vnode==0x1 && scp->fid.unique==0x1 ) {
- strcpy(ioctlp->outDatap, "Freelance.Local.Root");
+ StringCbCopyA(ioctlp->outDatap, 999999, "Freelance.Local.Root");
ioctlp->outDatap += strlen(ioctlp->outDatap) + 1;
code = 0;
} else
{
cellp = cm_FindCellByID(scp->fid.cell);
if (cellp) {
- strcpy(ioctlp->outDatap, cellp->namep);
+ StringCbCopyA(ioctlp->outDatap, 999999, cellp->namep);
ioctlp->outDatap += strlen(ioctlp->outDatap) + 1;
code = 0;
}
cp = ioctlp->inDatap;
memcpy((char *)&volStat, cp, sizeof(AFSFetchVolumeStatus));
cp += sizeof(AFSFetchVolumeStatus);
- strcpy(volName, cp);
+ StringCbCopyA(volName, sizeof(volName), cp);
cp += strlen(volName)+1;
- strcpy(offLineMsg, cp);
+ StringCbCopyA(offLineMsg, sizeof(offLineMsg), cp);
cp += strlen(offLineMsg)+1;
- strcpy(motd, cp);
+ StringCbCopyA(motd, sizeof(motd), cp);
storeStat.Mask = 0;
if (volStat.MinQuota != -1) {
storeStat.MinQuota = volStat.MinQuota;
cp = ioctlp->outDatap;
memcpy(cp, (char *)&volStat, sizeof(VolumeStatus));
cp += sizeof(VolumeStatus);
- strcpy(cp, volName);
+ StringCbCopyA(cp, 999999, volName);
cp += strlen(volName)+1;
- strcpy(cp, offLineMsg);
+ StringCbCopyA(cp, 999999, offLineMsg);
cp += strlen(offLineMsg)+1;
- strcpy(cp, motd);
+ StringCbCopyA(cp, 999999, motd);
cp += strlen(motd)+1;
/* now return updated return data pointer */
cp = ioctlp->outDatap;
memcpy(cp, (char *)&volStat, sizeof(AFSFetchVolumeStatus));
cp += sizeof(AFSFetchVolumeStatus);
- strcpy(cp, volName);
+ StringCbCopyA(cp, 999999, volName);
cp += strlen(volName)+1;
- strcpy(cp, offLineMsg);
+ StringCbCopyA(cp, 999999, offLineMsg);
cp += strlen(offLineMsg)+1;
- strcpy(cp, motd);
+ StringCbCopyA(cp, 999999, motd);
cp += strlen(motd)+1;
/* return new size */
code = cm_ReadMountPoint(scp, userp, &req);
if (code == 0) {
cp = ioctlp->outDatap;
- strcpy(cp, scp->mountPointStringp);
+ StringCbCopyA(cp, 999999, scp->mountPointStringp);
cp += strlen(cp) + 1;
ioctlp->outDatap = cp;
}
}
lock_ReleaseRead(&cm_serverLock);
cp = basep + max * sizeof(afs_int32);
- strcpy(cp, tcellp->namep);
+ StringCbCopyA(cp, 999999, tcellp->namep);
cp += strlen(tcellp->namep)+1;
ioctlp->outDatap = cp;
}
}
/* return the default cellname to the caller */
- strcpy(ioctlp->outDatap, cm_rootCellp->namep);
+ StringCbCopyA(ioctlp->outDatap, 999999, cm_rootCellp->namep);
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
/* done: success */
osi_panic("cm_IoctlSysName: !cm_sysName\n", __FILE__, __LINE__);
if (!setSysName) { /* user just wants the info */
- strcpy(outname, cm_sysName);
+ StringCbCopyA(outname, sizeof(outname), cm_sysName);
foundname = cm_sysNameCount;
*sysnamelist = cm_sysNameList;
} else {
/* clear @sys entries from the dnlc, once afs_lookup can
* do lookups of @sys entries and thinks it can trust them */
/* privs ok, store the entry, ... */
- strcpy(cm_sysName, inname);
- strcpy(cm_sysNameList[0], inname);
+ StringCbCopyA(cm_sysName, sizeof(cm_sysName), inname);
+ StringCbCopyA(cm_sysNameList[0], MAXSYSNAME, inname);
if (setSysName > 1) { /* ... or list */
cp = ioctlp->inDatap;
for (count = 1; count < setSysName; ++count) {
osi_panic("cm_IoctlSysName: no cm_sysNameList entry to write\n",
__FILE__, __LINE__);
t = strlen(cp);
- strcpy(cm_sysNameList[count], cp);
+ StringCbCopyA(cm_sysNameList[count], MAXSYSNAME, cp);
cp += t + 1;
}
}
memcpy(cp, (char *)&foundname, sizeof(afs_int32));
cp += sizeof(afs_int32); /* skip found flag */
if (foundname) {
- strcpy(cp, outname);
+ StringCbCopyA(cp, 999999, outname);
cp += strlen(outname) + 1; /* skip name and terminating null char */
for ( count=1; count < foundname ; ++count) { /* ... or list */
if ( !(*sysnamelist)[count] )
if (t >= MAXSYSNAME)
osi_panic("cm_IoctlSysName: sysname entry garbled\n",
__FILE__, __LINE__);
- strcpy(cp, (*sysnamelist)[count]);
+ StringCbCopyA(cp, 999999, (*sysnamelist)[count]);
cp += t + 1;
}
}
long cm_IoctlCreateMountPoint(struct smb_ioctl *ioctlp, struct cm_user *userp)
{
- char leaf[256];
+ char leaf[LEAF_SIZE];
long code;
cm_scache_t *dscp;
cm_attr_t tattr;
*/
/* Extract the possibly partial cell name */
- strcpy(cell, ioctlp->inDatap + 1); /* Skip the mp type character */
+ StringCbCopyA(cell, sizeof(cell), ioctlp->inDatap + 1); /* Skip the mp type character */
if (cp = strchr(cell, ':')) {
/* Extract the volume name */
*cp = 0;
- strcpy(volume, cp + 1);
+ StringCbCopyA(volume, sizeof(volume), cp + 1);
/* Get the full name for this cell */
code = cm_SearchCellFile(cell, fullCell, 0, 0);
if (code)
return CM_ERROR_NOSUCHCELL;
- sprintf(mpInfo, "%c%s:%s", *ioctlp->inDatap, fullCell, volume);
+ StringCbPrintfA(mpInfo, sizeof(mpInfo), "%c%s:%s", *ioctlp->inDatap, fullCell, volume);
} else {
/* No cell name specified */
- strcpy(mpInfo, ioctlp->inDatap);
+ StringCbCopyA(mpInfo, sizeof(mpInfo), ioctlp->inDatap);
}
#ifdef AFS_FREELANCE_CLIENT
long cm_IoctlSymlink(struct smb_ioctl *ioctlp, struct cm_user *userp)
{
- char leaf[256];
+ char leaf[LEAF_SIZE];
long code;
cm_scache_t *dscp;
cm_attr_t tattr;
if (code == 0) {
cp = ioctlp->outDatap;
if (newRootScp != NULL) {
- strcpy(cp, cm_mountRoot);
- strcat(cp, "/");
+ StringCbCopyA(cp, 999999, cm_mountRoot);
+ StringCbCatA(cp, 999999, "/");
cp += strlen(cp);
}
- strcpy(cp, spacep->data);
+ StringCbCopyA(cp, 999999, spacep->data);
cp += strlen(cp) + 1;
ioctlp->outDatap = cp;
cm_FreeSpace(spacep);
ucellp->kvno = ct.AuthHandle;
ucellp->expirationTime = ct.EndTimestamp;
ucellp->gen++;
- if (uname) strcpy(ucellp->userName, uname);
+ if (uname)
+ StringCbCopyA(ucellp->userName, MAXKTCNAMELEN, uname);
ucellp->flags |= CM_UCELLFLAG_RXKAD;
lock_ReleaseMutex(&userp->mx);
cp += sizeof(temp);
/* cell name */
- strcpy(cp, ucellp->cellp->namep);
+ StringCbCopyA(cp, 999999, ucellp->cellp->namep);
cp += strlen(cp) + 1;
/* user name */
- strcpy(cp, ucellp->userName);
+ StringCbCopyA(cp, 999999, ucellp->userName);
cp += strlen(cp) + 1;
ioctlp->outDatap = cp;
cp += sizeof(temp);
/* cell name */
- strcpy(cp, ucellp->cellp->namep);
+ StringCbCopyA(cp, 999999, ucellp->cellp->namep);
cp += strlen(cp) + 1;
/* user name */
- strcpy(cp, ucellp->userName);
+ StringCbCopyA(cp, 999999, ucellp->userName);
cp += strlen(cp) + 1;
ioctlp->outDatap = cp;
/* Parse the input parameters--first the required afs path,
* then the requested submount name (which may be "").
*/
- cm_NormalizeAfsPath (afspath, ioctlp->inDatap);
+ cm_NormalizeAfsPath (afspath, sizeof(afspath), ioctlp->inDatap);
submountreqp = ioctlp->inDatap + (strlen(ioctlp->inDatap)+1);
/* If the caller supplied a suggested submount name, see if
strlen(&afspath[strlen(cm_mountRoot)])+1:2);
RegCloseKey( hkSubmounts );
- strcpy(ioctlp->outDatap, submountreqp);
- ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
- lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
+ StringCbCopyA(ioctlp->outDatap, 999999, submountreqp);
+ ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
+ lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
return 0;
}
* supplied path matches the submount's path, we can still
* use the suggested submount name.
*/
- cm_NormalizeAfsPath (submountPathNormalized, submountPath);
+ cm_NormalizeAfsPath (submountPathNormalized, sizeof(submountPathNormalized), submountPath);
if (!strcmp (submountPathNormalized, afspath)) {
- strcpy(ioctlp->outDatap, submountreqp);
+ StringCbCopyA(ioctlp->outDatap, 999999, submountreqp);
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
RegCloseKey( hkSubmounts );
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
* that our caller specified. If so, we can return
* this submount.
*/
- cm_NormalizeAfsPath (submountPathNormalized, submountPath);
+ cm_NormalizeAfsPath (submountPathNormalized, sizeof(submountPathNormalized), submountPath);
if (!strcmp (submountPathNormalized, afspath)) {
- strcpy(ioctlp->outDatap, submountName);
+ StringCbCopyA(ioctlp->outDatap, 999999, submountName);
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
RegCloseKey(hkSubmounts);
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
* when writing out the submount.
*/
- sprintf(ioctlp->outDatap, "auto%ld", nextAutoSubmount);
+ StringCbPrintfA(ioctlp->outDatap, 999999, "auto%ld", nextAutoSubmount);
RegSetValueEx( hkSubmounts,
ioctlp->outDatap,
lock_ObtainWrite(&cm_scacheLock);
for (scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
if (cm_FidCmp(fidp, &scp->fid) == 0) {
- /*scp->refCount++;*/
- /*cm_AdjustLRU(scp);*/
lock_ReleaseWrite(&cm_scacheLock);
return scp->fileType;
}
/*
* Update a volume. Caller holds volume's lock (volp->mx).
+ *
+ *
+ * shadow / openafs / jhutz@CS.CMU.EDU {ANDREW.CMU.EDU} 01:38 (JHutz)
+ * Yes, we support multihomed fileservers.
+ * Since before we got the code from IBM.
+ * But to find out about multiple addresses on a multihomed server, you need
+ * to use VL_GetEntryByNameU and VL_GetAddrsU. If you use
+ * VL_GetEntryByNameO or VL_GetEntryByNameN, the vlserver just gives you one
+ * address per server.
+ * shadow / openafs / jhutz@CS.CMU.EDU {ANDREW.CMU.EDU} 01:39 (JHutz)
+ * see src/afs/afs_volume.c, paying particular attention to
+ * afs_NewVolumeByName, afs_SetupVolume, and InstallUVolumeEntry
+ * shadow / openafs / jaltman {ANDREW.CMU.EDU} 01:40 (Jeffrey Altman)
+ * thanks. The windows client calls the 0 versions.
+ * shadow / openafs / jhutz@CS.CMU.EDU {ANDREW.CMU.EDU} 01:51 (JHutz)
+ * Oh. Ew.
+ * By not using the N versions, you only get up to 8 sites instead of 13.
+ * By not using the U versions, you don't get to know about multihomed serve
+ * shadow / openafs / jhutz@CS.CMU.EDU {ANDREW.CMU.EDU} 01:52 (JHutz)
+ * Of course, you probably want to support the older versions for backward
+ * compatibility. If you do that, you need to call the newest interface
+ * first, and fall back to successively older versions if you get
+ * RXGEN_OPCODE.
*/
long cm_UpdateVolume(struct cm_cell *cellp, cm_user_t *userp, cm_req_t *reqp,
cm_volume_t *volp)
{
cm_conn_t *connp;
int i;
- cm_serverRef_t *tsrp;
+ cm_serverRef_t *tsrp;
cm_server_t *tsp;
struct sockaddr_in tsockAddr;
long tflags;
u_long tempAddr;
- struct vldbentry vldbEntry; /* don't use NVLDB yet; they're not common */
- int ROcount = 0;
- long code;
+ struct vldbentry vldbEntry;
+ struct nvldbentry nvldbEntry;
+#ifdef MULTIHOMED
+ struct uvldbentry uvldbEntry;
+#endif
+ int type = -1;
+ int ROcount = 0;
+ long code;
- /* clear out old bindings */
+ /* clear out old bindings */
cm_FreeServerList(&volp->rwServersp);
cm_FreeServerList(&volp->roServersp);
cm_FreeServerList(&volp->bkServersp);
/* now we have volume structure locked and held; make RPC to fill it */
do {
- code = cm_ConnByMServers(cellp->vlServersp, userp, reqp,
- &connp);
- if (code) continue;
- osi_Log1(afsd_logp, "CALL VL_GetEntryByNameO name %s",
- volp->namep);
- code = VL_GetEntryByNameO(connp->callp, volp->namep, &vldbEntry);
- } while (cm_Analyze(connp, userp, reqp, NULL, NULL, cellp->vlServersp, NULL, code));
+ code = cm_ConnByMServers(cellp->vlServersp, userp, reqp, &connp);
+ if (code)
+ continue;
+ osi_Log1(afsd_logp, "CALL VL_GetEntryByName{UNO} name %s", volp->namep);
+#ifdef MULTIHOMED
+ code = VL_GetEntryByNameU(connp->callp, volp->namep, &uvldbEntry);
+ if ( code == RXGEN_OPCODE )
+#endif
+ {
+ code = VL_GetEntryByNameN(connp->callp, volp->namep, &nvldbEntry);
+ type = 1;
+ }
+ if ( code == RXGEN_OPCODE ) {
+ code = VL_GetEntryByNameO(connp->callp, volp->namep, &vldbEntry);
+ type = 0;
+ }
+ } while (cm_Analyze(connp, userp, reqp, NULL, NULL, cellp->vlServersp, NULL, code));
code = cm_MapVLRPCError(code, reqp);
if (code == 0) {
- /* decode the response */
- lock_ObtainWrite(&cm_volumeLock);
- if (vldbEntry.flags & VLF_RWEXISTS)
- volp->rwID = vldbEntry.volumeId[0];
- else
+ afs_int32 flags;
+ afs_int32 nServers;
+ afs_int32 rwID;
+ afs_int32 roID;
+ afs_int32 bkID;
+ afs_int32 serverNumber[NMAXNSERVERS];
+ afs_int32 serverFlags[NMAXNSERVERS];
+
+ switch ( type ) {
+ case 0:
+ flags = vldbEntry.flags;
+ nServers = vldbEntry.nServers;
+ rwID = vldbEntry.volumeId[0];
+ roID = vldbEntry.volumeId[1];
+ bkID = vldbEntry.volumeId[2];
+ for ( i=0; i<nServers; i++ ) {
+ serverFlags[i] = vldbEntry.serverFlags[i];
+ serverNumber[i] = vldbEntry.serverNumber[i];
+ }
+ break;
+ case 1:
+ flags = nvldbEntry.flags;
+ nServers = nvldbEntry.nServers;
+ rwID = nvldbEntry.volumeId[0];
+ roID = nvldbEntry.volumeId[1];
+ bkID = nvldbEntry.volumeId[2];
+ for ( i=0; i<nServers; i++ ) {
+ serverFlags[i] = nvldbEntry.serverFlags[i];
+ serverNumber[i] = nvldbEntry.serverNumber[i];
+ }
+ break;
+#ifdef MULTIHOMED
+ case 2:
+ flags = uvldbEntry.flags;
+ nServers = uvldbEntry.nServers;
+ rwID = uvldbEntry.volumeId[0];
+ roID = uvldbEntry.volumeId[1];
+ bkID = uvldbEntry.volumeId[2];
+ for ( i=0; i<nServers; i++ ) {
+ serverFlags[i] = uvldbEntry.serverFlags[i];
+ if ( !(flags & VLSERVER_FLAG_UUID) )
+ serverNumber[i] = uvldbEntry.serverNumber[i].time_low;
+ else {
+ /* see afs/afs_volume.c InstallUVolumeEntry(). We need to
+ * implement an equivalent to afs_FindServer() and afs_GetServer()
+ * which support multiple addresses.
+ */
+ }
+ }
+ break;
+#endif
+ }
+
+ /* decode the response */
+ lock_ObtainWrite(&cm_volumeLock);
+ if (flags & VLF_RWEXISTS)
+ volp->rwID = rwID;
+ else
volp->rwID = 0;
- if (vldbEntry.flags & VLF_ROEXISTS)
- volp->roID = vldbEntry.volumeId[1];
+ if (flags & VLF_ROEXISTS)
+ volp->roID = roID;
else
volp->roID = 0;
- if (vldbEntry.flags & VLF_BACKEXISTS)
- volp->bkID = vldbEntry.volumeId[2];
- else
+ if (flags & VLF_BACKEXISTS)
+ volp->bkID = bkID;
+ else
volp->bkID = 0;
- lock_ReleaseWrite(&cm_volumeLock);
- for(i=0; i<vldbEntry.nServers; i++) {
- /* create a server entry */
- tflags = vldbEntry.serverFlags[i];
- if (tflags & VLSF_DONTUSE) continue;
- tsockAddr.sin_family = AF_INET;
- tempAddr = htonl(vldbEntry.serverNumber[i]);
- tsockAddr.sin_addr.s_addr = tempAddr;
- tsp = cm_FindServer(&tsockAddr, CM_SERVER_FILE);
- if (!tsp)
+ lock_ReleaseWrite(&cm_volumeLock);
+ for (i=0; i<nServers; i++) {
+ /* create a server entry */
+ tflags = serverFlags[i];
+ if (tflags & VLSF_DONTUSE)
+ continue;
+ tsockAddr.sin_family = AF_INET;
+ tempAddr = htonl(serverNumber[i]);
+ tsockAddr.sin_addr.s_addr = tempAddr;
+ tsp = cm_FindServer(&tsockAddr, CM_SERVER_FILE);
+ if (!tsp)
tsp = cm_NewServer(&tsockAddr, CM_SERVER_FILE,
cellp);
- /* if this server was created by fs setserverprefs */
- if ( !tsp->cellp )
- tsp->cellp = cellp;
+ /* if this server was created by fs setserverprefs */
+ if ( !tsp->cellp )
+ tsp->cellp = cellp;
osi_assert(tsp != NULL);
/* and add it to the list(s). */
- /*
+ /*
* Each call to cm_NewServerRef() increments the
* ref count of tsp. These reference will be dropped,
- * if and when the volume is reset; see reset code
- * earlier in this function.
- */
- if ((tflags & VLSF_RWVOL)
- && (vldbEntry.flags & VLF_RWEXISTS)) {
- tsrp = cm_NewServerRef(tsp);
+ * if and when the volume is reset; see reset code
+ * earlier in this function.
+ */
+ if ((tflags & VLSF_RWVOL) && (flags & VLF_RWEXISTS)) {
+ tsrp = cm_NewServerRef(tsp);
cm_InsertServerList(&volp->rwServersp, tsrp);
lock_ObtainWrite(&cm_serverLock);
tsrp->refCount--; /* drop allocation reference */
lock_ReleaseWrite(&cm_serverLock);
- }
- if ((tflags & VLSF_ROVOL)
- && (vldbEntry.flags & VLF_ROEXISTS)) {
- tsrp = cm_NewServerRef(tsp);
- cm_InsertServerList(&volp->roServersp, tsrp);
+ }
+ if ((tflags & VLSF_ROVOL) && (flags & VLF_ROEXISTS)) {
+ tsrp = cm_NewServerRef(tsp);
+ cm_InsertServerList(&volp->roServersp, tsrp);
lock_ObtainWrite(&cm_serverLock);
tsrp->refCount--; /* drop allocation reference */
lock_ReleaseWrite(&cm_serverLock);
- ROcount++;
+ ROcount++;
}
- /* We don't use VLSF_BACKVOL !?! */
- if ((tflags & VLSF_RWVOL)
- && (vldbEntry.flags & VLF_BACKEXISTS)) {
- tsrp = cm_NewServerRef(tsp);
+ /* We don't use VLSF_BACKVOL !?! */
+ if ((tflags & VLSF_RWVOL) && (flags & VLF_BACKEXISTS)) {
+ tsrp = cm_NewServerRef(tsp);
cm_InsertServerList(&volp->bkServersp, tsrp);
lock_ObtainWrite(&cm_serverLock);
tsrp->refCount--; /* drop allocation reference */
lock_ReleaseWrite(&cm_serverLock);
- }
- /* Drop the reference obtained by cm_FindServer() */
- cm_PutServer(tsp);
+ }
+ /* Drop the reference obtained by cm_FindServer() */
+ cm_PutServer(tsp);
+ }
+
+ /*
+ * Randomize RO list
+ *
+ * If the first n servers have the same ipRank, then we
+ * randomly pick one among them and move it to the beginning.
+ * We don't bother to re-order the whole list because
+ * the rest of the list is used only if the first server is
+ * down. We only do this for the RO list; we assume the other
+ * lists are length 1.
+ */
+ if (ROcount > 1) {
+ cm_RandomizeServer(&volp->roServersp);
}
-
- /*
- * Randomize RO list
- *
- * If the first n servers have the same ipRank, then we
- * randomly pick one among them and move it to the beginning.
- * We don't bother to re-order the whole list because
- * the rest of the list is used only if the first server is
- * down. We only do this for the RO list; we assume the other
- * lists are length 1.
- */
- if (ROcount > 1) {
- cm_RandomizeServer(&volp->roServersp);
- }
- }
- return code;
+ }
+ return code;
}
long cm_GetVolumeByID(cm_cell_t *cellp, long volumeID, cm_user_t *userp,
#include <string.h>
#include <stdio.h>
#include <time.h>
-
#include <osi.h>
#include "afsd.h"
}
else if (IsServiceRunning())
{
- char szCellA[ 256 ] = "";
+ char szCellA[ cchRESOURCE ] = "";
int rc;
HKEY hk;
} else {
rc = 0;
}
- if (rc == 0)
- CopyAnsiToString(pszCell, szCellA);
+ if (rc == 0)
+ CopyAnsiToString(pszCell, szCellA);
}
return rc;
}
pszCell = (LPTSTR)GetWindowLong (hDlg, DWL_USER);
if (pszCell)
{
+ HWND hTab = GetDlgItem (g.hMain, IDC_TABS);
+ LPTSTR pszTab = (LPTSTR)GetTabParam (hTab, TabCtrl_GetCurSel(hTab));
+ HWND hChildDlg = NULL;
+
lock_ObtainMutex(&g.credsLock);
for (size_t iCreds = 0; iCreds < g.cCreds; ++iCreds)
{
// Check the active tab, and fix its checkbox if necessary
//
- HWND hTab = GetDlgItem (g.hMain, IDC_TABS);
- LPTSTR pszTab = (LPTSTR)GetTabParam (hTab, TabCtrl_GetCurSel(hTab));
if (pszTab && HIWORD(pszTab) && (!lstrcmpi (pszTab, pszCell)))
{
- HWND hDlg = GetTabChild (hTab);
- if (hDlg)
- CheckDlgButton (hDlg, IDC_CREDS_REMIND, FALSE);
+ hChildDlg = GetTabChild (hTab);
}
}
}
lock_ReleaseMutex(&g.credsLock);
- }
+
+ if (hChildDlg)
+ CheckDlgButton (hChildDlg, IDC_CREDS_REMIND, FALSE);
+ }
}