From nobody@FreeBSD.org  Thu Jan 10 03:36:05 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
	by hub.freebsd.org (Postfix) with ESMTP id 9E9EDE81
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 10 Jan 2013 03:36:05 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 86096100
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 10 Jan 2013 03:36:05 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r0A3a5xK035936
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 10 Jan 2013 03:36:05 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id r0A3a51W035935;
	Thu, 10 Jan 2013 03:36:05 GMT
	(envelope-from nobody)
Message-Id: <201301100336.r0A3a51W035935@red.freebsd.org>
Date: Thu, 10 Jan 2013 03:36:05 GMT
From: "Chad J. Milios" <cropcirclesystems@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] netatalk3 
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         175173
>Category:       ports
>Synopsis:       [PATCH] net/netatalk3: backport fix from development git
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    marcus
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 10 03:40:00 UTC 2013
>Closed-Date:    Tue Jan 22 01:33:27 UTC 2013
>Last-Modified:  Tue Jan 22 01:33:27 UTC 2013
>Originator:     Chad J. Milios
>Release:        9.1-RELEASE
>Organization:
Crop Circle Systems, Inc.
>Environment:
FreeBSD seed.ccsys.com 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r245163: Tue Jan  8 13:35:18 UTC 2013     root@seed.ccsys.com:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
To be clear, I have a 100% ZFS system, root /boot /home, everything ZFS,
this may only affect ZFS, I don't know, I didn't try this on UFS or on
Linux. I fixed it for myself and moved on. The fix was small and innocent-
looking enough, I don't think it should adversely affect anyone. In my
googling I found at least two other people having exactly the same problem,
both on FreeBSD 9.0 and ZFS. I backported this small fix from the
Netatalk 3.0.2 development repository with no modification, but by their
comments, it doesn't seem like they know this patch fixes this problem,
or are aware of this problem. Apparently it also fixes a memory leak,
according to their changelog.

So, I built netatalk-3.0.1,1 from ports with default options, configured
a [Homes] section to point to /home (a zfs dataset), logged in from a
MacOS 10.8.2 machine and got this error:

"Something wrong with the volume's CNID DB, using temporary CNID DB instead.
Check server messages for details! Switching to read-only mode."

/var/log/messages then contained the lines:

Jan  7 03:45:38 seed afpd[1734]: AFP3.3 Login by joe
Jan  7 03:45:38 seed afpd[1734]: Cannot find module named [] in registered module list!
Jan  7 03:45:38 seed afpd[1734]: Can't open volume "/home/joe" CNID backend ""
Jan  7 03:45:38 seed afpd[1734]: Reopen volume /home/joe using in memory temporary CNID DB.

>How-To-Repeat:
Install netatalk-3.0.1,1, configure and log in. May need FreeBSD 9.x,
9.1, or ZFS /home on 9.x to trigger the problem for all I know.
>Fix:
Put the attached patchfile into the files directory of the netatalk3
port. This is grabbed from
https://github.com/franklahm/Netatalk/commit/1fa0166843eac60947d08f92c90a686fc8bcbff5

Patch attached with submission follows:

--- ./libatalk/util/netatalk_conf.c.orig	2013-01-07 12:21:30.309544508 +0000
+++ ./libatalk/util/netatalk_conf.c	2013-01-07 12:23:22.360529479 +0000
@@ -563,7 +563,7 @@
     EC_INIT;
     struct vol  *volume = NULL;
     int         i, suffixlen, vlen, tmpvlen, u8mvlen, macvlen;
-    char        *tmpname;
+    char        tmpname[AFPVOL_U8MNAMELEN+1];
     ucs2_t      u8mtmpname[(AFPVOL_U8MNAMELEN+1)*2], mactmpname[(AFPVOL_MACNAMELEN+1)*2];
     char        suffix[6]; /* max is #FFFF */
     uint16_t    flags;
@@ -643,7 +643,7 @@
     EC_NULL( volume->v_maccodepage = strdup(obj->options.maccodepage) );
 
     vlen = strlen(name);
-    tmpname = strdup(name);
+    strlcpy(tmpname, name, sizeof(tmpname));
     for(i = 0; i < vlen; i++)
         if(tmpname[i] == '/') tmpname[i] = ':';
 


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->marcus 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Thu Jan 10 04:58:58 UTC 2013 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=175173 
State-Changed-From-To: open->closed 
State-Changed-By: marcus 
State-Changed-When: Tue Jan 22 01:33:16 UTC 2013 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=175173 
>Unformatted:
