* FIX: afpd: fix for possible crash in case more then one server is
configured in afpd.conf.
* FIX: afpd: ExtendedAttributes in FreeBSD
-
+* FIX: afpd: sharing home folders corrupted the per volume umask.
+* UPD: afpd: umask for home folders is no longer taken from startup umask.
+* UPD: afpd: dont and permissions with parent folder when creating new
+ directories on "upriv" volumes.
+
Changes in 2.1.1
================
* as uid 0, that's the wrong user for volume's prexec_close scripts if any,
* restore our login user
*/
- if (seteuid( obj->uid ) < 0) {
- LOG(log_error, logtype_afpd, "can't seteuid back %s", strerror(errno));
- exit(EXITERR_SYS);
+ if (geteuid() != obj->uid) {
+ if (seteuid( obj->uid ) < 0) {
+ LOG(log_error, logtype_afpd, "can't seteuid(%u) back %s: uid: %u, euid: %u",
+ obj->uid, strerror(errno), getuid(), geteuid());
+ exit(EXITERR_SYS);
+ }
}
+
close_all_vol();
if (obj->logout)
(*obj->logout)();
/* -------------------------
appledouble mkdir afp error code.
*/
-static int netatalk_mkdir(const char *name)
+static int netatalk_mkdir(const struct vol *vol, const char *name)
{
- if (ad_mkdir(name, DIRBITS | 0777) < 0) {
+ int ret;
+ struct stat st;
+
+ if (vol->v_flags & AFPVOL_UNIX_PRIV) {
+ if (lstat(".", &st) < 0)
+ return AFPERR_MISC;
+ int mode = (DIRBITS & (~S_ISGID & st.st_mode)) | (0777 & ~vol->v_umask);
+ LOG(log_maxdebug, logtype_afpd, "netatalk_mkdir(\"%s\") {parent mode: %04o, vol umask: %04o}",
+ name, st.st_mode, vol->v_umask);
+
+ ret = mkdir(name, mode);
+ } else {
+ ret = ad_mkdir(name, DIRBITS | 0777);
+ }
+
+ if (ret < 0) {
switch ( errno ) {
case ENOENT :
return( AFPERR_NOOBJ );
return AFPERR_PARAM;
/* try to create the destination directory */
- if (AFP_OK != (err = netatalk_mkdir(dst)) ) {
+ if (AFP_OK != (err = netatalk_mkdir(vol, dst)) ) {
closedir(dp);
return err;
}
upath = s_path->u_name;
- if (AFP_OK != (err = netatalk_mkdir( upath))) {
+ if (AFP_OK != (err = netatalk_mkdir(vol, upath))) {
return err;
}
/*
- * $Id$
- *
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*/
/* Enable some default options for all volumes */
save_options[VOLOPT_FLAGS].i_value |= AFPVOL_CACHE;
save_options[VOLOPT_EA_VFS].i_value = AFPVOL_EA_AUTO;
+ LOG(log_maxdebug, logtype_afpd, "readvolfile: seeding default umask: %04o",
+ obj->options.umask);
+ save_options[VOLOPT_UMASK].i_value = obj->options.umask;
while ( myfgets( buf, sizeof( buf ), fp ) != NULL ) {
initline( strlen( buf ), buf );
strcat( tmp, "/" );
strcat( tmp, p );
}
- /* Tag a user's home directory with their umask. Note, this will
- * be overwritten if the user actually specifies a umask: option
- * for a '~' volume. */
- save_options[VOLOPT_UMASK].i_value = obj->options.save_mask;
/* fall through */
case '/' :