Subject: Re: netatalk bugfix: this can't be right
To: B. James Phillippe <bryanxms@ecst.csuchico.edu>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-users
Date: 01/13/2002 15:05:14
On Sat, Jan 12, 2002 at 08:04:02PM -0800, B. James Phillippe wrote:
> Hello,
> 
> I am a relatively new NetBSD user, running 1.5.2 on an Alpha.  I'm using
> the system as a fileserver, and would like to be able to share volumes to
> an Apple iMac using Appletalk.  I installed netatalk in October of last
> year, and had problems getting it to work.  I posted to netbsd-help and was
> not able to find anyone else with my problem, nor was I able to find a
> solution.  The problem was that any time I tried to create a directory on
> the server from the client (or copy a directory), I would get an error on
> the Mac console about insufficient permission, and the following entry in
> my server syslog:
> 
> Jan 12 18:28:05 jupiter afpd[10741]: setdirmode: chmod .AppleDouble: Operation not permitted

And what does 'ls -lo' show about this file ?

> 
> Even though this error was reported on both the client and server, an empty
> directory would be created anyway.  If I was copying a folder, the folder
> would be created but without any files.  I could then copy files into the
> folder without a problem.
> 
> I gave up for a few months, and came back to this problem today.
> Determined to find the cause (and solution), I downloaded the source code
> and quickly identified the trouble spot.  This diff illustrates where the
> problem happens and what works around it:
> 
> --- etc/afpd/unix.c.orig	Sat Jan 12 19:43:00 2002
> +++ etc/afpd/unix.c	Sat Jan 12 19:43:21 2002
> @@ -588,17 +588,21 @@
>      /* XXX: use special bits to tag directory permissions */
> 
>      /* XXX: need to preserve special modes */
> +#if 0
>      if ( chmod( ".AppleDouble",  DIRBITS | mode ) < 0 ) {
>  	syslog( LOG_ERR, "setdirmode: chmod .AppleDouble: %m" );
>  	return( -1 );
>      }
> +#endif

Would also be good to know what value "DIRBITS | mode" is ...

> 
>  setdirmode_noadouble:
>      /* XXX: need to preserve special modes */
> +#if 0
>      if ( chmod( ".",  DIRBITS | mode ) < 0 ) {
>  	syslog( LOG_ERR, "setdirmode: chmod .: %m" );
>  	return( -1 );
>      }
> +#endif
>      return( 0 );
>  }
> 
> 
> The chmod() call in both those places is failing with "Operation not
> permitted", and I can't figure out why (the permissions are fine).  #if'ing
> out these routines solves the problem and seems to have no ill side-effects
> (I copied Gigs of data with this change w/out trouble).  My question now
> is, "why was this only happening to me", and "what is the proper solution"?
> 
> This is netatalk-asun-2.1.3nb4, and I am in securelevel 1 multiuser.  The
> Mac client is connecting as guest.

Hum, maybe that's the problem ... to what UID is mapped guest ?

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
--