/* NT client CellServDB has different file name than NT server or Unix */
if (_afsconf_IsClientConfigDirectory(adir->name)) {
if (!afssw_GetClientCellServDBDir(&p)) {
- asprintf(path, "%s/%s", p, AFSDIR_CELLSERVDB_FILE_NTCLIENT);
+ if (asprintf(path, "%s/%s", p, AFSDIR_CELLSERVDB_FILE_NTCLIENT) < 0)
+ *path = NULL;
free(p);
} else {
- asprintf(path, "%s/%s", adir->name, AFSDIR_CELLSERVDB_FILE_NTCLIENT);
+ if (asprintf(path, "%s/%s", adir->name,
+ AFSDIR_CELLSERVDB_FILE_NTCLIENT) < 0)
+ *path = NULL;
}
} else {
- asprintf(path, "%s/%s", adir->name, AFSDIR_CELLSERVDB_FILE);
+ if (asprintf(path, "%s/%s", adir->name, AFSDIR_CELLSERVDB_FILE) < 0)
+ *path = NULL;
}
return;
}
static void
_afsconf_CellServDBPath(struct afsconf_dir *adir, char **path)
{
- asprintf(path, "%s/%s", adir->name, AFSDIR_CELLSERVDB_FILE);
+ if (asprintf(path, "%s/%s", adir->name, AFSDIR_CELLSERVDB_FILE) < 0)
+ *path = NULL;
}
#endif /* AFS_NT40_ENV */
char *home_dir;
afsconf_FILE *fp;
size_t len;
+ int r;
if (!(home_dir = getenv("HOME"))) {
/* Our last chance is the "/.AFSCONF" file */
} else {
char *pathname = NULL;
- asprintf(&pathname, "%s/%s", home_dir, ".AFSCONF");
- if (pathname == NULL)
+ r = asprintf(&pathname, "%s/%s", home_dir, ".AFSCONF");
+ if (r < 0 || pathname == NULL)
goto fail;
fp = fopen(pathname, "r");
int *numServers, int *ttl, char **arealCellName)
{
int code = 0;
+ int r;
int len;
unsigned char answer[4096];
unsigned char *p;
#endif
retryafsdb:
+ r = -1;
switch (pass) {
case 0:
dnstype = T_SRV;
- asprintf(&dotcellname, "_%s._%s.%s.", IANAname, protocol, cellName);
+ r = asprintf(&dotcellname, "_%s._%s.%s.", IANAname, protocol, cellName);
break;
case 1:
dnstype = T_AFSDB;
- asprintf(&dotcellname, "%s.", cellName);
+ r = asprintf(&dotcellname, "%s.", cellName);
break;
case 2:
dnstype = T_SRV;
- asprintf(&dotcellname, "_%s._%s.%s", IANAname, protocol, cellName);
+ r = asprintf(&dotcellname, "_%s._%s.%s", IANAname, protocol, cellName);
break;
case 3:
dnstype = T_AFSDB;
- asprintf(&dotcellname, "%s", cellName);
+ r = asprintf(&dotcellname, "%s", cellName);
break;
}
- if (dotcellname == NULL)
+ if (r < 0 || dotcellname == NULL)
goto findservererror;
LOCK_GLOBAL_MUTEX;