Menu

#8 files w/o adouble -> afpd dies

closed
nobody
None
5
2012-08-27
2001-03-13
Anonymous
No

When copying some files from a netatalk share in the
Finder to the local disk,
the server sometimes unexpectedly disconnects (the afpd
segfaults).

I managed to track this down to the following sequence
of events. This
depends on the file in question having no .AppleDouble
entry. Try copying
the same file twice, without doing anything in between.

afp_openfork() is called on the data fork
afp_openfork() is called on the resource fork
-- the actual .AppleDouble file couldn't be opened,
but
-- the call succeeds anyway to imitate an empty
resource fork
afp_closefork() is called on the data fork returned
above
this call frees the struct adouble that's shared
by the
ofork entry. This happens because the file
descriptor for the
** data and resource forks are both now set to -1.

a subsequent call to getforkparams() on the still open
resource fork
is now referencing an invalid memory location in the
stale struct adouble.

I'm not sure what the best fix for this situation is,
but I made a temporary
fix by adding a simple reference count to struct
adouble which is maintained
by the code in afpd/ofork.c. I also ensure that the
memory allocated
for the struct adouble in of_alloc is memset() to 0 to
ensure absolutely
that ad_open initialises the structure (and the
refcount) correctly.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    oh well -- attach file isn't working.

    patch posted to netatalk-devel list (I don't think long
    lines will fit in here)

     
  • Andrew J Morgan

    Andrew J Morgan - 2002-02-01

    Logged In: YES
    user_id=55096

    Has this bug been fixed yet or not? I can't figure out from
    the cvs logs...

     
  • Patrick Bihan-Faou

    Logged In: YES
    user_id=653

    where is the patch ?

     
  • Andrew J Morgan

    Andrew J Morgan - 2002-02-15

    Logged In: YES
    user_id=55096

    Too old. Repost patch if bug is still present.

     

Log in to post a comment.