The options "valid users", "rolist" and others use the function
accessvol() for parsing the options string. accessfull uses
a static buffer limited to MAXPATHLEN which limits the maximum
length of these options.
Fix this by using a strdup()ed buffer instead.
Fixes bug #473.
*/
static int accessvol(const AFPObj *obj, const char *args, const char *name)
{
*/
static int accessvol(const AFPObj *obj, const char *args, const char *name)
{
- char buf[MAXPATHLEN + 1], *p;
+ EC_INIT;
+ char *names = NULL, *p;
struct group *gr;
if (!args)
struct group *gr;
if (!args)
- strlcpy(buf, args, sizeof(buf));
- if ((p = strtok(buf, ",")) == NULL) /* nothing, return okay */
- return -1;
+ EC_NULL_LOG( names = strdup(args) );
+
+ if ((p = strtok(names, ",")) == NULL) /* nothing, return okay */
+ EC_EXIT_STATUS(-1);
while (p) {
if (*p == '@') { /* it's a group */
if ((gr = getgrnam(p + 1)) && gmem(gr->gr_gid, obj->ngroups, obj->groups))
while (p) {
if (*p == '@') { /* it's a group */
if ((gr = getgrnam(p + 1)) && gmem(gr->gr_gid, obj->ngroups, obj->groups))
} else if (strcasecmp(p, name) == 0) /* it's a user name */
} else if (strcasecmp(p, name) == 0) /* it's a user name */
p = strtok(NULL, ", ");
}
p = strtok(NULL, ", ");
}
+EC_CLEANUP:
+ if (names)
+ free(names);
+ EC_EXIT;
}
static int hostaccessvol(const AFPObj *obj, const char *volname, const char *args)
}
static int hostaccessvol(const AFPObj *obj, const char *volname, const char *args)