Subject: Re: [netatalk-admins] asun 2.1.2-2 on FreeBSD 2.2.6 and MacOS 8.5.1

From: [email-masked] (Bob Smith, Hammett & Edison, Inc.)
Date: Wed, 13 Jan 1999 21:23:40 -0800

On Tue, Jan 12, 1999, 05:40:02 Brian Reid wrote:

>and the AppleDouble looks like this.
>
>6# od -b 'Growing Cubes'
>0000000  000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000
>0000020  000 000 000 000 000 000 000 000 000 005 000 000 000 002 000 000

This AppleDouble file has a bad magic number.  I don't recall off the top of
my head what it should be, but it shouldn't be all 0's!  Let me take a stab in
the dark - did you upgrade from netatalk 1.4b2 to an asun version at some
point in the past?  If so, I can make a pretty good guess about the problem.

The afpd code in 1.4b2 has a bug which trashes an AD file's magic number.  It
never mattered in the past because the old code never _verified_ the number. 
Even asun versions up through at least 2.0a18.2 did not verify the number,
although they did have the bug itself fixed.  But asun has been making many
improvements to the AD code, so it would not surprise me to learn that asun-
2.1.2 now checks the AD file magic number, and returns some error if it is
bad.  This would mean that any file created back when you were running 1.4b2
will cause problems with asun-2.1.2, however files created after upgrading to
any asun version will be OK.  Does this explanation fit with what you are
experiencing?

Adrian can answer this for certain, of course; I may be way off.  I can't
check it myself because I'm actually still running 1.4b2, for complicated
reasons I won't bore you with (I fixed the magic number bug, however, which is
why I know about it).

Hope this helps!

Bob Smith
Hammett & Edison, Inc.
[email-masked]

---

From: Brian Reid <[email-masked]>
Date: Wed, 13 Jan 99 22:12:39 -0800

>   Let me take a stab in the dark - did you upgrade from netatalk
>   1.4b2 to an asun version at some point in the past?  

Yes. I ran netatalk 1.4b2 for a long time, creating tens of thousands of
files, before upgrading to asun2.1.2-2. Only a few dozen of them have
this problem, though.

Is this proposed -v1compat switch something that I will have to run
with forever, or will I be able to do a one-time-only conversion of all
of my files?

Besides my home server, where I experiment, I run netatalk in a large
public school system where we have hundreds of thousands of files, and
many many thousands of student users, and I sure don't want to have
problems like this suddenly show up in the middle of the school year..

I am at this moment in another window rdisting about 400,000 files from
an old Ultrix machine to a new FreeBSD machine at the school. I deduce
from tonight's exchange that it would be a bad idea for me to turn the
students loose on it just yet....

Too bad there's no "find -magic" option to let me survey the damage.

---

From: "Steven N. Hirsch" <[email-masked]>
Date: Thu, 14 Jan 1999 07:42:33 -0500 (EST)

> Too bad there's no "find -magic" option to let me survey the damage.

I ran into the same thing, in fact it was my report to Adrian that
motivated the -v1compat switch :-).  I whipped up this little Perl program
to fix the adouble files (make SURE you have a backup before using any
utility with such global effects!!).  Run it at the top of the apple
volume on the server and it recurses down through every .AppleDouble
directory found:

-------------------------------------------------

:	# -*-perl-*-
eval 'exec perl -w -S $0 ${1+"$@"}'
    if 0;

use strict;
use POSIX qw(fcntl_h);
use IO::File;
use File::Find;
use Cwd;

# Traverse desired filesystems

my $magic = pack "C4", 0x00, 0x05, 0x16, 0x07; 
my $adVersion = pack "C4", 0x00, 0x01, 0x00, 0x00;

sub fixADFiles {
  my $curdir = cwd();
  chdir('.AppleDouble');
  foreach ( glob '*' ) {
    my $fh = new IO::File;
    print "$_\n";
    $fh->open($_, O_WRONLY) || die "Can't open $File::Find::name: $!\n";
    $fh->print($magic);
    $fh->print($adVersion);
    $fh->close;
  }
  chdir($curdir);
}

sub wanted {
  my $globalSave = $_;

    (my ($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
    -d _ &&
    /^\.AppleDouble$/ &&
    fixADFiles();

  $_ = $globalSave;
}

@ARGV == 1 || die "Usage: fixad <dir>\n";

my $dir = shift;

find(\&wanted, $dir);

exit;

---

From: "Steven N. Hirsch" <[email-masked]>
Date: Thu, 14 Jan 1999 07:45:41 -0500 (EST)

> Too bad there's no "find -magic" option to let me survey the damage.

Does anyone have a thought as to why my elderly Mac SE/30 reports all the
file sizes on an asun-2.1.2 server as large negative numbers?  I have
built the server _without_ large volume support AND have not used
optimization to compile volume.c.  According to the Mac, the volume size
is < 2Gig.  Get Info tells me that there is a huge number "On disk" (??),
with nnn bytes actually used (where 'nnn' is the true size of the file in
question.)

What heuristic does the Finder use to when displaying a listing by Name?

Steve

---

From: a sun <[email-masked]>
Date: Wed, 13 Jan 1999 21:53:17 -0800 (PST)

This AppleDouble file has a bad magic number.  I don't recall off
   the top of my head what it should be, but it shouldn't be all 0's!
   Let me take a stab in the dark - did you upgrade from netatalk
   1.4b2 to an asun version at some point in the past?  If so, I can
   make a pretty good guess about the problem.

that's what the problem is. the next pre-asun2.1.2 i release will have
that check turned into a "hey. your ad header is bad. i'm accepting it
now, but you'll need to run 'adv1tov2 -v1compat' when you upgrade to
asun2.2.0." right now, i currently have things set up so that the
differences between asun2.2.0 and asun2.1.2 will pretty much get
toggled by a #define. in the future, i'll remove that as it does tend
to add a bunch of #ifdefs to the code.

what i want to do now is make sure i fix a bunch of on-disk things as
we migrate from ad v1 to ad v2. here's what i currently handle:
	1) file dates to ad header epoch (on the fly)
	2) 0-magic/0-version headers (only via adv1tov2 -v1compat)
	3) Icon^M -> Icon:0d (via adv1tov2)
	4) v1 -> v2 (duh)

am i missing anything?

-a

---

From: a sun <[email-masked]>
Date: Wed, 13 Jan 1999 23:31:58 -0800 (PST)

adv1tov2 is a program that descends down a directory tree and changes
all the files into appledouble v2 files. the -v1compat flag just tells
it that it should treat files with a magic/version of 0 as v1 files.

so, to answer your question, it will be a one-time deal. 

-a

---

From: "Scott Kveton" <[email-masked]>
Date: Wed, 10 Mar 1999 11:16:38 -0800

Hello all,

I know there has been much discussion about this but I've
got more angry Freehand users than you can shake a stick
at (and believe you me; I'm having to shake it a lot).

The dilemma is the same one as you all recall.  If the
user does a save directly to their network directory from
Freehand it ends up munging it beyond recognition.  The
biggest problem with this is that even if I educate my
users to do their work on the desktop and then *copy*
their work to their network volume they cannot do it.  Let's
just say its an uphill battle.

I know of the fix to get around this (with recompiling
with the CRLF disabled) but I am wondering if this is going
to cause problems for other programs.  I'm thinking mainly
of Office, Photoshop, and PageMaker.

Also, is there a way to tell netatalk about Freehand
documents in such a way that they will be saved correctly?
I've tried this with every version of Freehand I can find
and no matter what it gets munged.

Does anyone have anything they can share with me on this?
I want to make this as seamless for as many of my users as
I can without breaking things.

Anything would be appreciated,

Scott :-)

---

From: Anthony Johnston <[email-masked]>
Date: Wed, 10 Mar 1999 15:28:30 -0500 (EST)

What operating system version? If 8.5 use a folder action to copy to the
file server. Seems like a good place to use some AppleScript wizardry.

Just a thought, let me know if you would need a hand doing this.

ant

> at (and believe you me; I'm having to shake it a lot).
[..]

---

From: Devin Reade <[email-masked]>
Date: Wed, 10 Mar 1999 13:24:05 -0700 (MST)

> I can without breaking things.

Would it be feasible to set up a second server that is running
with a CRLF-disabled netatalk?  Then tell your users, "if you're
running program A, B or C, make sure you directory X for your data
files.  If you're running program D or E, you have to use directory
Y for your data files.  All other programs can use either directory
X or Y.".

It's not exactly optimal, but it's an idea.  I don't run Macs on my
home network (just Apple IIgses), so I have no experience with the
problems you're describing.

Devin
-- 
Freedom begins when you tell Mrs. Grundy to go fly a kite.
							- Robert Heinlein

---

From: [email-masked]
Date: Wed, 10 Mar 1999 15:25:50 -0500

> From:    "Scott Kveton" <[email-masked]>
> To:      <[email-masked]>

> If the
> Freehand it ends up munging it beyond recognition.

> to cause problems for other programs.

This is presumably because Freehand saves files as type TEXT and then
changes the type once the file is on the server.  As far as I know, the
only solution to this problem is to disable CRLF translation.  Doing so
presents a problem only if your users are mostly interested in files
that are created on Unix.

:wes

---

From: "Andrew Snell" <[email-masked]>
Date: Wed, 10 Mar 1999 15:29:36 -0500

Hey all, I have been having problems getting the 2-way password encryption
to work. perhaps one of you can see something I've overlooked.

I'm running netatalk-1.4b2+asun2.1.3 on a sparc solaris 2.6 machine. I am
using libdes 4.01, tcpwrappers 7.6, building with gnu make and egcs 1.1.1.

	I was able to build everything just fine, added the required
entries in /etc/services, installed the driver in the kernel (actually it
was already there from the previous install, which I moved to atalk.old
directory...). Also edited inetd.conf so that tcpwrappers would work. I
placed 'le0' in the atalkd.conf file, as per the README.SOLARIS, and added
the required ddp line in /etc/netconfig.

	I used the following entry in my afpd.conf file:

"Staging Server" -noguest -tcp -savepassword -setpassword -rand2num

	Then, I tried to connect. Didn't work. OK, so I set up TCP wrappers
to let my IP address in. Still no go. So, I follow the directions of folks
on the list, and have a ~/.passwd file, mode 000, with the proper password
cleartext. The message in the logs about not being able to read that file
goes away, but I still can't connect.
	At this point, I decided to simplify a bit. I removed the
-setpassword directive, and sure enough, the 'Change Password...' button is
grayed out from the mac. So at least changes in the afpd.conf file were
taking effect.
	Then, I removed the -rand2num directive. Everything worked without
a hitch -- afpd picked up the vol list from ~/AppleVolumes.

	So, the functionality is beautiful -- this does everything I want.
BUT, cleartext passwords make me nervous, especially on a largely flat
campus network such as this. Does anyone see anything that is preventing me
from using the 2-way encryption feature? Any information that you all could
provide would be greatly appreciated.  Thanks for your time,

- Andrew

---

From: Jim Zajkowski <[email-masked]>
Date: Wed, 10 Mar 1999 15:49:12 -0500 (EST)

} on the list, and have a ~/.passwd file, mode 000, with the proper password

Umm, I thought it was mode 600, and set user and gid to be that user.

Jim

---

From: Alex Yu <[email-masked]>
Date: Wed, 10 Mar 1999 15:58:12 -0500

>using libdes 4.01, tcpwrappers 7.6, building with gnu make and egcs 1.1.1.

You need to have a .passwd file in your user's directory.  For example, 

/home/snell/.passwd

If you enable 2-way encrypted passwords, then it will read ~/.passwd
instead of /etc/passwd, and .passwd must be cleartext without return key.

Alex

---

From: Alex Yu <[email-masked]>
Date: Wed, 10 Mar 1999 15:59:51 -0500

Hello,

How would I setup so that I can disable "Network Trash Folder" completely?

Alex

---

From: "Andrew Snell" <[email-masked]>
Date: Wed, 10 Mar 1999 16:58:27 -0500

>Umm, I thought it was mode 600, and set user and gid to be that user.

	Doh! Sorry for wasting everyone's time -- I made a mistake on this
users group ID...Once I set the gid properly (also mode 600), everything
works just great. Thanks to all who took the time to reply, and to those
who are developing this great software!

- Andrew

---

From: "Robert B. Bell" <[email-masked]>
Date: Wed, 10 Mar 1999 17:12:07 -0800

Remove the "Network Trash Folder" directory.
  Robert Bell.