tp->nplus = tp->nminus = 0;
tp->pluslist = tp->minuslist = 0;
tp->dfs = 0;
- sscanf(astr, "%d dfs:%d %s", &junk, &tp->dfs, tp->cell);
+ sscanf(astr, "%d dfs:%d %1024s", &junk, &tp->dfs, tp->cell);
return tp;
}
ta = malloc(sizeof(struct Acl));
assert(ta);
ta->dfs = 0;
- sscanf(astr, "%d dfs:%d %s", &ta->nplus, &ta->dfs, ta->cell);
+ sscanf(astr, "%d dfs:%d %1024s", &ta->nplus, &ta->dfs, ta->cell);
astr = SkipLine(astr);
sscanf(astr, "%d", &ta->nminus);
astr = SkipLine(astr);
last = 0;
first = 0;
for (i = 0; i < nplus; i++) {
- sscanf(astr, "%100s %d", tname, &trights);
+ sscanf(astr, "%99s %d", tname, &trights);
astr = SkipLine(astr);
tl = malloc(sizeof(struct AclEntry));
assert(tl);
last = 0;
first = 0;
for (i = 0; i < nminus; i++) {
- sscanf(astr, "%100s %d", tname, &trights);
+ sscanf(astr, "%99s %d", tname, &trights);
astr = SkipLine(astr);
tl = malloc(sizeof(struct AclEntry));
assert(tl);
GetLastComponent(const char *data, char **outdir, char **outbase,
int *thru_symlink)
{
- char orig_name[1024]; /*Original name, may be modified */
- char true_name[1024]; /*``True'' dirname (e.g., symlink target) */
+ char orig_name[MAXPATHLEN]; /*Original name, may be modified */
+ char true_name[MAXPATHLEN]; /*``True'' dirname (e.g., symlink target) */
char *lastSlash;
struct stat statbuff; /*Buffer for status info */
int link_chars_read; /*Num chars read in readlink() */
if (thru_symlink)
*thru_symlink = 1;
- /* Read name of resolved file */
- link_chars_read = readlink(orig_name, true_name, 1024);
+ /* Read name of resolved file (leave space for NULL!) */
+ link_chars_read = readlink(orig_name, true_name, MAXPATHLEN-1);
if (link_chars_read <= 0) {
fprintf(stderr,
"%s: Can't read target name for '%s' symbolic link!\n",
blob.in_size = 0;
blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.out = space;
- pioctl(Parent(as->parms[0].items->data), VIOC_FILE_CELL_NAME,
- &blob, 1);
+ code = pioctl(Parent(as->parms[0].items->data), VIOC_FILE_CELL_NAME,
+ &blob, 1);
+ if (code) {
+ fprintf(stderr,
+ "%s: couldn't get cell name for file's parent\n", pn);
+ return 1;
+ }
}
dir = afsconf_Open(AFSDIR_CLIENT_ETC_DIRPATH);
"%s: You do not have the required rights to do this operation\n",
pn);
break;
+ case ESRCH: /* hack: pioctls stole ESRCH for cell name not available errors. */
+ fprintf(stderr, "%s: Cell name not recognized.\n", pn);
+ break;
default:
if (filename)
fprintf(stderr, "%s:'%s'", pn, filename);