* and check to make sure we have a valid set of volume servers
* this function must be called with a Write Lock on cm_cellLock
*/
-static cm_cell_t *cm_UpdateCell(cm_cell_t * cp, afs_uint32 flags)
+cm_cell_t *cm_UpdateCell(cm_cell_t * cp, afs_uint32 flags)
{
long code = 0;
cm_cell_rock_t rock;
return code ? NULL : cp;
}
-/* load up a cell structure from the cell database, afsdcell.ini */
+/* load up a cell structure from the cell database, AFS_CELLSERVDB */
cm_cell_t *cm_GetCell(char *namep, afs_uint32 flags)
{
return cm_GetCell_Gen(namep, NULL, flags);
{
cm_cell_t *cp, *cp2;
long code;
- char fullname[200]="";
+ char fullname[CELL_MAXNAMELEN]="";
int hasWriteLock = 0;
afs_uint32 hash;
cm_cell_rock_t rock;
lock_ObtainRead(&cm_cellLock);
for (cp = cm_data.cellNameHashTablep[hash]; cp; cp=cp->nameNextp) {
- if (stricmp(namep, cp->name) == 0) {
- strcpy(fullname, cp->name);
+ if (cm_stricmp_utf8(namep, cp->name) == 0) {
+ strncpy(fullname, cp->name, CELL_MAXNAMELEN);
+ fullname[CELL_MAXNAMELEN-1] = '\0';
break;
}
}
if (!cp) {
for (cp = cm_data.allCellsp; cp; cp=cp->allNextp) {
if (strnicmp(namep, cp->name, strlen(namep)) == 0) {
- strcpy(fullname, cp->name);
+ strncpy(fullname, cp->name, CELL_MAXNAMELEN);
+ fullname[CELL_MAXNAMELEN-1] = '\0';
break;
}
}
* to the list so check again while holding the write lock
*/
for (cp = cm_data.cellNameHashTablep[hash]; cp; cp=cp->nameNextp) {
- if (stricmp(namep, cp->name) == 0) {
- strcpy(fullname, cp->name);
+ if (cm_stricmp_utf8(namep, cp->name) == 0) {
+ strncpy(fullname, cp->name, CELL_MAXNAMELEN);
+ fullname[CELL_MAXNAMELEN-1] = '\0';
break;
}
}
for (cp = cm_data.allCellsp; cp; cp=cp->allNextp) {
if (strnicmp(namep, cp->name, strlen(namep)) == 0) {
- strcpy(fullname, cp->name);
+ strncpy(fullname, cp->name, CELL_MAXNAMELEN);
+ fullname[CELL_MAXNAMELEN-1] = '\0';
break;
}
}
*/
hash = CM_CELL_NAME_HASH(fullname);
for (cp2 = cm_data.cellNameHashTablep[hash]; cp2; cp2=cp2->nameNextp) {
- if (stricmp(fullname, cp2->name) == 0) {
+ if (cm_stricmp_utf8(fullname, cp2->name) == 0) {
break;
}
}
lock_ReleaseWrite(&cm_cellLock);
/* fullname is not valid if cp == NULL */
- if (cp && newnamep)
- strcpy(newnamep, fullname);
-
+ if (cp && newnamep) {
+ strncpy(newnamep, fullname, CELL_MAXNAMELEN);
+ newnamep[CELL_MAXNAMELEN-1]='\0';
+ }
return cp;
}
/* copy in name */
strncpy(cellp->name, "Freelance.Local.Cell", CELL_MAXNAMELEN); /*safe*/
+ cellp->name[CELL_MAXNAMELEN-1] = '\0';
/* thread on global list */
cellp->allNextp = cm_data.allCellsp;
for (cellp = cm_data.allCellsp; cellp; cellp=cellp->allNextp) {
lock_InitializeMutex(&cellp->mx, "cm_cell_t mutex");
cellp->vlServersp = NULL;
+ cellp->flags |= CM_CELLFLAG_VLSERVER_INVALID;
}
}
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
for (cellp = cm_data.allCellsp; cellp; cellp=cellp->allNextp) {
- sprintf(output, "%s cellp=0x%p,name=%s ID=%d flags=0x%x\r\n",
- cookie, cellp, cellp->name, cellp->cellID, cellp->flags);
+ sprintf(output, "%s cellp=0x%p,name=%s ID=%d flags=0x%x timeout=%I64u\r\n",
+ cookie, cellp, cellp->name, cellp->cellID, cellp->flags, cellp->timeout);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
}