#include <atalk/netatalk_conf.h>
#define VOLPASSLEN 8
+#ifndef UUID_PRINTABLE_STRING_LENGTH
+#define UUID_PRINTABLE_STRING_LENGTH 37
+#endif
#define IS_VAR(a, b) (strncmp((a), (b), 2) == 0)
mktemp(eaname);
-// become_root();
+ become_root();
if ((sys_setxattr(vol->v_path, eaname, eacontent, 4, 0)) == 0) {
sys_removexattr(vol->v_path, eaname);
haseas = 0;
}
-// unbecome_root();
+ unbecome_root();
return haseas;
}
struct sockaddr_storage client;
const DSI *dsi = obj->dsi;
- if (!args)
+ if (!args || !dsi)
return -1;
strlcpy(buf, args, sizeof(buf));
EC_NULL( volume->v_password = strdup(val) );
if (val = getoption(obj->iniconfig, section, "veto", preset))
- EC_NULL( volume->v_password = strdup(val) );
+ EC_NULL( volume->v_veto = strdup(val) );
if (val = getoption(obj->iniconfig, section, "volcharset", preset))
EC_NULL( volume->v_volcodepage = strdup(val) );
continue;
if (STRCMP(secname, ==, INISEC_HOMES)) {
have_uservol = 1;
- if (!obj->uid)
- /* not an AFP session, but cnid daemon, dbd or ad util */
+ if (obj->username[0] == 0
+ || strcmp(obj->username, obj->options.guest) == 0)
+ /* not an AFP session, but cnid daemon, dbd or ad util, or guest login */
continue;
strlcpy(tmp, pwent->pw_dir, MAXPATHLEN);
strlcat(tmp, "/", MAXPATHLEN);
* (1) Search "normal" volume list
* (2) Check if theres a [Homes] section, load_volumes() remembers this for us
* (3) If there is, match "path" with "basedir regex" to get the user home parent dir
- * (4) The next path element then is the username
- * (5) Built user home path by appending the basedir matched in (3) and appending the username
+ * (4) Built user home path by appending the basedir matched in (3) and appending the username
+ * (5) The next path element then is the username
* (6) Append [Homes]->path subdirectory if defined
- * (6) Create volume
+ * (7) Create volume
*
* @param obj (rw) handle
* @param path (r) path, may be relative or absolute
if (match[0].rm_eo - match[0].rm_so > MAXPATHLEN)
EC_FAIL_LOG("getvolbypath(\"%s\"): path too long", path);
+ /* (4) */
strncpy(tmpbuf, path + match[0].rm_so, match[0].rm_eo - match[0].rm_so);
tmpbuf[match[0].rm_eo - match[0].rm_so] = 0;
strlcat(tmpbuf, "/", MAXPATHLEN);
- /* (4) */
+ /* (5) */
p = path + strlen(basedir);
while (*p == '/')
p++;
if (prw != 0)
subpath = prw;
+ strlcpy(obj->username, user, MAXUSERLEN);
strlcat(tmpbuf, user, MAXPATHLEN);
strlcat(tmpbuf, "/", MAXPATHLEN);
- /* (5) */
+ /* (6) */
if (subpathconfig = iniparser_getstring(obj->iniconfig, INISEC_HOMES, "path", NULL)) {
if (!subpath || strncmp(subpathconfig, subpath, strlen(subpathconfig)) != 0) {
EC_FAIL;
}
+ strlcat(tmpbuf, subpathconfig, MAXPATHLEN);
+ strlcat(tmpbuf, "/", MAXPATHLEN);
}
- strlcat(tmpbuf, subpathconfig, MAXPATHLEN);
- strlcat(tmpbuf, "/", MAXPATHLEN);
/* (7) */
if (volxlate(obj, volpath, sizeof(volpath) - 1, tmpbuf, pw, NULL, NULL) == NULL)
options->logfile = iniparser_getstrdup(config, INISEC_GLOBAL, "logfile", NULL);
/* [AFP] "options" options wo values */
- if (p = iniparser_getstrdup(config, INISEC_GLOBAL, "options", NULL)) {
+ if (q = iniparser_getstrdup(config, INISEC_GLOBAL, "options", NULL)) {
if (p = strtok(q, ", ")) {
while (p) {
if (strcasecmp(p, "nozeroconf"))
p = strtok(NULL, ", ");
}
}
+ free(q);
}
/* figure out options w values */