uint16_t flags;
const char *val;
char *p, *q;
+ bstring dbpath = NULL;
+ bstring global_path_tmp = NULL;
strlcpy(path, path_in, MAXPATHLEN);
if(tmpname[i] == '/') tmpname[i] = ':';
- if (!atalk_iniparser_getboolean(obj->iniconfig, INISEC_GLOBAL, "vol dbnest", 0)) {
- bstring dbpath;
- EC_NULL( val = atalk_iniparser_getstring(obj->iniconfig, INISEC_GLOBAL, "vol dbpath", _PATH_STATEDIR "CNID/") );
- EC_NULL( dbpath = bformat("%s/%s/", val, tmpname) );
- EC_NULL( volume->v_dbpath = strdup(cfrombstr(dbpath)) );
- bdestroy(dbpath);
- } else {
+ if (atalk_iniparser_getboolean(obj->iniconfig, INISEC_GLOBAL, "vol dbnest", 0)) {
EC_NULL( volume->v_dbpath = strdup(path) );
+ } else {
+ char *global_path;
+ val = getoption(obj->iniconfig, section, "vol dbpath", preset, NULL);
+ if (val == NULL) {
+ /* check global option */
+ global_path = atalk_iniparser_getstring(obj->iniconfig,
+ INISEC_GLOBAL,
+ "vol dbpath",
+ NULL);
+ if (global_path) {
+ /* check for pre 3.1.1 behaviour without variable */
+ if (strchr(global_path, '$') == NULL) {
+ global_path_tmp = bformat("%s/%s/", global_path, tmpname);
+ val = cfrombstr(global_path_tmp);
+ } else {
+ val = global_path;
+ }
+ }
+ }
+
+ if (val == NULL) {
+ EC_NULL( dbpath = bformat("%s/%s/", _PATH_STATEDIR "CNID/", tmpname) );
+ } else {
+ EC_NULL( dbpath = bfromcstr(val));
+ }
+ EC_NULL( volume->v_dbpath = volxlate(obj, NULL, MAXPATHLEN + 1,
+ cfrombstr(dbpath), pwd, NULL, tmpname) );
}
if ((val = getoption(obj->iniconfig, section, "cnid scheme", preset, NULL)))
EC_CLEANUP:
LOG(log_debug, logtype_afpd, "createvol: END: %d", ret);
+ if (dbpath)
+ bdestroy(dbpath);
+ if (global_path_tmp)
+ bdestroy(global_path_tmp);
if (ret != 0) {
if (volume)
volume_free(volume);
|| strcmp(obj->username, obj->options.guest) == 0)
/* not an AFP session, but cnid daemon, dbd or ad util, or guest login */
continue;
- if (pwent->pw_dir == NULL || STRCMP("", ==, pwent->pw_dir))
- /* no user home */
+ if (pwent->pw_dir == NULL || STRCMP("", ==, pwent->pw_dir)) {
+ LOG(log_debug, logtype_afpd, "readvolfile: pwent->pw_dir: NULL or \"\" - no user home");
continue;
+ }
+ LOG(log_debug, logtype_afpd, "readvolfile: pwent->pw_dir: '%s'", pwent->pw_dir);
- if ((realpath(pwent->pw_dir, tmp)) == NULL)
+ if ((realpath(pwent->pw_dir, tmp)) == NULL) {
+ LOG(log_debug, logtype_afpd, "readvolfile: Cannot get realpath '%s' (%s).", pwent->pw_dir, strerror(errno));
continue;
+ }
+ LOG(log_debug, logtype_afpd, "readvolfile: realpath pwent->pw_dir: '%s'", tmp);
/* check if user home matches our "basedir regex" */
if ((basedir = atalk_iniparser_getstring(obj->iniconfig, INISEC_HOMES, "basedir regex", NULL)) == NULL) {
/*!
* Initialize volumes and load ini configfile
*
- * Depending on the value of obj->uid either access checks are done (!=0) or skipped (=0)
- *
- * @param obj (r) handle
- * @param delvol_fn (r) callback called for deleted volumes
+ * @param obj (r) handle
+ * @param flags (r) flags controlling volume load behaviour
*/
-int load_volumes(AFPObj *obj)
+int load_volumes(AFPObj *obj, lv_flags_t flags)
{
EC_INIT;
EC_NULL( pwbuf = malloc(bufsize) );
}
- if (obj->uid) {
+ if (!(flags & lv_all) && obj->uid) {
ret = getpwuid_r(obj->uid, &pwent, pwbuf, bufsize, &pwresult);
if (pwresult == NULL) {
LOG(log_error, logtype_afpd, "load_volumes: getpwuid_r: %s", strerror(errno));
options->flags |= OPTION_SERVERNOTIF;
if (!atalk_iniparser_getboolean(config, INISEC_GLOBAL, "use sendfile", 1))
options->flags |= OPTION_NOSENDFILE;
+ if (atalk_iniparser_getboolean(config, INISEC_GLOBAL, "recvfile", 0))
+ options->flags |= OPTION_RECVFILE;
if (atalk_iniparser_getboolean(config, INISEC_GLOBAL, "solaris share reservations", 1))
options->flags |= OPTION_SHARE_RESERV;
if (atalk_iniparser_getboolean(config, INISEC_GLOBAL, "afpstats", 0))
options->mimicmodel = atalk_iniparser_getstrdup(config, INISEC_GLOBAL, "mimic model", NULL);
options->adminauthuser = atalk_iniparser_getstrdup(config, INISEC_GLOBAL, "admin auth user",NULL);
options->ignored_attr = atalk_iniparser_getstrdup(config, INISEC_GLOBAL, "ignored attributes", NULL);
+ options->cnid_mysql_host = atalk_iniparser_getstrdup(config, INISEC_GLOBAL, "cnid mysql host", NULL);
+ options->cnid_mysql_user = atalk_iniparser_getstrdup(config, INISEC_GLOBAL, "cnid mysql user", NULL);
+ options->cnid_mysql_pw = atalk_iniparser_getstrdup(config, INISEC_GLOBAL, "cnid mysql pw", NULL);
+ options->cnid_mysql_db = atalk_iniparser_getstrdup(config, INISEC_GLOBAL, "cnid mysql db", NULL);
options->connections = atalk_iniparser_getint (config, INISEC_GLOBAL, "max connections",200);
options->passwdminlen = atalk_iniparser_getint (config, INISEC_GLOBAL, "passwd minlen", 0);
options->tickleval = atalk_iniparser_getint (config, INISEC_GLOBAL, "tickleval", 30);
options->fce_fmodwait = atalk_iniparser_getint (config, INISEC_GLOBAL, "fce holdfmod", 60);
options->sleep = atalk_iniparser_getint (config, INISEC_GLOBAL, "sleep time", 10);
options->disconnected = atalk_iniparser_getint (config, INISEC_GLOBAL, "disconnect time",24);
+ options->splice_size = atalk_iniparser_getint (config, INISEC_GLOBAL, "splice size", 64*1024);
p = atalk_iniparser_getstring(config, INISEC_GLOBAL, "map acls", "rights");
if (STRCMP(p, ==, "rights"))