Subject: [netatalk-admins] PAP documentation

From: Bob Krzaczek <[email-masked]>
Date: Sun, 28 Nov 1999 22:34:02 -0500

Slightly offtopic, I'm afraid, but...

Where might someone go to find documentation on the PAP protocol?  I
see references to "Inside Appletalk", but all I can find on the Apple
Developer's Connection is "Inside Networking", which isn't quite
getting down to any real protocol details.  I'm sure I'm missing the
obvious link, but I just can't seem to find something that describes
the actual information being exchanged during a PAP session.

I'm investigating the netatalk PAP daemon and psf filter, with an eye
towards speeding them up, optionally turning off the blasted CR->NL
conversion, and handling PostScript binary/binary-tagged data correctly
(our users don't always remember to select "ASCII" in their printer
setups, and changing the PPD's language level to "1" doesn't always do
the trick for some programs, unfortunately).

As I make changes in exploring papd, I certainly would find reference
material on what papd is *supposed* to be doing quite helpful...

Thanks in advance; I'll post back any answers I get to the list.

-- 
// Bob Krzaczek, RIT Center for Imaging Science  <[email-masked]>

---

From: [email-masked]
Date: Mon, 29 Nov 1999 00:44:41 -0500

> From:    Bob Krzaczek <[email-masked]>
> To:      [email-masked]

> getting down to any real protocol details.

Well, searching for "Inside_AppleTalk.pdf", I found several copies.
Here's one:

    http://www.ece.ucdavis.edu/~tmetz/Apple/

It's also contained in the AppleShare IP 6.1 SDK (and probably
others).  I seem to recall that Inside AppleTalk v1 was a little better
in some regards than v2, but v1 is probably hard to find these days.

> material on what papd is *supposed* to be doing quite helpful...

You should also get a bunch of docs from Adobe.  Not only did they
write most of Apple's drivers and protocol stacks for many printers,
I'm pretty sure they were involved in writing the specs.

    http://partners.adobe.com/asn/developer/PDFS/TN/5001.DSC_Spec_v3.0.pdf

or even better:

    http://partners.adobe.com/asn/developer/technotes.html

Have fun!

:wes

---

From: Piotr Waskiewicz <[email-masked]>
Date: Thu, 02 Dec 1999 15:37:47 +0200

> the trick for some programs, unfortunately).

Hi!
I'm working in DTP studio. We take many PS jobs to print on our imagesetter.
Several jobs printed through linux/netatalk spooler aren't go well because
of cr/lf mangling doing by papd. So I maded patch that preventing papd to
change line ending and several other things like removing ctrl-d char after
EOF. This patch include better handling of large binary jobs done by one
person in this mailinglist (sorry, but forget his name). I'm using it over
a year so assume its quite stable :) and I don't seen any job refusing print
by papd.
See attachment.
-- 
.-.  .-.----.----.----.    ---         ,               ---
| |/\| | -- | ---| -- |    --- Piotr Waskiewicz * WasP ---
|  /\  | ,. |--- | ,--'    ---     UIN: 5654159        ---
`-'  `-'-'`-'----'-'       ---   [email-masked]   ---

diff -udr netatalk.orig/etc/papd/file.c netatalk/etc/papd/file.c
--- netatalk.orig/etc/papd/file.c	Thu Nov  5 08:59:56 1998
+++ netatalk/etc/papd/file.c	Sun Nov 15 09:55:27 1998
@@ -24,6 +24,7 @@
     /* get a line */
     for ( p = pf->pf_cur; p < pf->pf_end; p++ ) {
-	if ( *p == '\n' || *p == '\r' ) {
+ 	if ( *p == '\n' || *p == '\r' || ((p - pf->pf_cur)>4096) ) {
+	    if ( *(p+1) == '\n' ) p++;
 	    break;
 	}
     }
diff -udr netatalk.orig/etc/papd/headers.c netatalk/etc/papd/headers.c
--- netatalk.orig/etc/papd/headers.c	Fri May 30 02:29:48 1997
+++ netatalk/etc/papd/headers.c	Tue Nov 17 15:39:06 1998
@@ -26,31 +26,31 @@
 
     for ( p = start; p < stop; p++ ) {
 	if ( *p == ':' ) {
-	    break;
+	    p++; break;
 	}
     }
 
     for ( ; p < stop; p++ ) {
-	if ( *p == '(' ) {
+	if ( *p == '(' || *p > ' ') {
 	    break;
 	}
     }
 
     for ( q = p; q < stop; q++ ) {
-	if ( *q == ')' ) {
+	if ( *q == ')' || *q < ' ') {
 	    break;
 	}
     }
 
     if ( q < stop && p < stop ) {
-	p++;
+	if ( *p == '(' ) p++;
 	c = *q;
 	*q = '\0';
 	lp_job( p );
 	*q = c;
     }
 
-    *stop = '\n';
+/*    *stop = '\n'; */
     lp_write( start, stop - start + 1 );
     compop();
     consumetomark( start, stop, in );
diff -udr netatalk.orig/etc/papd/lp.c netatalk/etc/papd/lp.c
--- netatalk.orig/etc/papd/lp.c	Thu Jun 26 22:48:43 1997
+++ netatalk/etc/papd/lp.c	Tue Nov 17 15:34:04 1998
@@ -150,7 +150,8 @@
     char	*p, *q;
 
     if ( lp.lp_job != NULL ) {
-	free( lp.lp_job );
+	/*free( lp.lp_job );*/
+	return;
     }
     if (( lp.lp_job = (char *)malloc( strlen( job ) + 1 )) == NULL ) {
 	syslog( LOG_ERR, "malloc: %m" );
diff -udr netatalk.orig/etc/papd/magics.c netatalk/etc/papd/magics.c
--- netatalk.orig/etc/papd/magics.c	Fri May 30 02:28:03 1997
+++ netatalk/etc/papd/magics.c	Thu Nov 12 14:56:26 1998
@@ -57,7 +57,7 @@
 	    }
 
 	    /* write to file */
-	    *stop = '\n';
+	    /* *stop = '\n'; */
 	    lp_write( start, stop - start + 1 );
 	    consumetomark( start, stop, infile );
 	}
@@ -126,7 +126,7 @@
 	    }
 	}
 
-	*stop = '\n';
+	/* *stop = '\n'; */
 	lp_write( start, stop - start + 1 );
 	consumetomark( start, stop, in );
     }
diff -udr netatalk.orig/etc/papd/session.c netatalk/etc/papd/session.c
--- netatalk.orig/etc/papd/session.c	Thu Nov  5 08:56:55 1998
+++ netatalk/etc/papd/session.c	Tue Nov 17 13:10:58 1998
@@ -162,10 +162,10 @@
 		 * If we're in the middle of a file, clean up.
 		 */
 		if (( infile.pf_state & PF_BOT ) ||
-			( PF_BUFSIZ( &infile ) == 0 &&
-			( infile.pf_state & PF_EOF ))) {
-		    lp_print();
-		} else {
+		((PF_BUFSIZ(&infile) == 0 || PF_BUFSIZ(&infile) == 1) && 
+			( infile.pf_state & PF_EOF ))) { /* this 1 is added */
+		    lp_print();				 /*to handle ctrl-d */
+		} else {				 /*after %%EOF      */
 		    lp_cancel();
 		}
 
diff -udr netatalk.orig/etc/psf/psf.c netatalk/etc/psf/psf.c
--- netatalk.orig/etc/psf/psf.c	Wed Apr  8 19:43:31 1998
+++ netatalk/etc/psf/psf.c	Sun Nov 15 18:24:44 1998
@@ -252,6 +252,10 @@
 	} else if ( inlen >= 2 && inbuf[ 0 ] == '\033' && inbuf[ 1 ] == '%' ) {
 	    syslog( LOG_INFO, "PostScript w/PJL" );
 	    rc = copyio();      /* PostScript */
+	} else if ( inlen >= 2 && inbuf[ 0 ] == '\004' && inbuf[ 1 ] == '%' ) {
+	    inbuf[ 0 ] = ' ';
+	    syslog( LOG_INFO, "PostScript. Ctrl-d removed!" );
+	    rc = copyio();      /* PostScript */
 	} else {
 	    syslog( LOG_INFO, "straight text" );
 	    rc = textps();	/* straight text */

---

From: "Alex Yu" <[email-masked]>
Date: Thu, 2 Dec 1999 17:44:40 -0500

Dear,

Would someone post the setting for smb.conf again that will auto hide/delete
resource folders?

Thanks,
ayu

---

From: ME <[email-masked]>
Date: Thu, 02 Dec 1999 16:01:38 -0800 (PST)

On Thu, 2 Dec 1999, Alex Yu wrote:
> Subject: [netatalk-admins] smb.conf

One that is useful:
   hide dot files = yes

Others:
   veto files = /.htaccess/.AppleDesktop/.AppleDouble/Network Trash
Folder/
   delete veto files = yes

(without "delete veto files = yes" set, recursive deletes of folders with
resource forks etc, may stay...)

(Be careful with the force mail line-wrapping for the "veto files =" entry
above...)

---

From: ME <[email-masked]>
Date: Thu, 02 Dec 1999 16:09:04 -0800 (PST)

> Would someone post the setting for smb.conf again that will auto hide/delete

Also, Samba is supposed to support the netatalk .AppleDouble resource
forks when a SMB mounted share include a request to rename a file that has
a paired resource file with the same name.
Meaning a windows user changing a name of a Mac saved file for a shared
(samba/netatalk) will also change the name of the resource file in the
AppleDouble dir if there is a match.

When you go to DL samba, and run ./configure fro the source directory, try
including "--with-netatalk" as an arguement/flag
A longer list of configure options with samba can be found when doing a:
./configure --help

Have not experimented with it to see how well it works... i have not had
time...

-ME

--------------------------------------------------------------------------
Systems Department Operating Systems Analyst for the Ruben Salazar Library
              of California State University at Sonoma.
  /UNIX(/BSD/SysV)\N_NW[.]VMS\WNTS\WNTW\W95\W311\WFWG\DOS:MacOS/NeXTSTEP  
--------------------------------------------------------------------------