Return-Path: linux-nfs-owner@vger.kernel.org Received: from mx12.netapp.com ([216.240.18.77]:14541 "EHLO mx12.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759879Ab3CHSdz (ORCPT ); Fri, 8 Mar 2013 13:33:55 -0500 From: "Myklebust, Trond" To: Dave Chiluk CC: "linux-nfs@vger.kernel.org" Subject: Re: NFSv4 setattr null-terminates strings Date: Fri, 8 Mar 2013 18:33:52 +0000 Message-ID: <4FA345DA4F4AE44899BD2B03EEEC2FA9286B6F80@sacexcmbx05-prd.hq.netapp.com> References: <513A1BD1.6060709@canonical.com> In-Reply-To: <513A1BD1.6060709@canonical.com> Content-Type: multipart/mixed; boundary="_002_4FA345DA4F4AE44899BD2B03EEEC2FA9286B6F80sacexcmbx05prdh_" MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org List-ID: --_002_4FA345DA4F4AE44899BD2B03EEEC2FA9286B6F80sacexcmbx05prdh_ Content-Type: text/plain; charset="iso-8859-1" Content-ID: <6D0E7787835462428B2DDFF96004DC09@tahoe.netapp.com> Content-Transfer-Encoding: quoted-printable On Fri, 2013-03-08 at 11:11 -0600, Dave Chiluk wrote: > As of commit 57e62324e469e092ecc6c94a7a86fe4bd6ac5172, the SETATTR nfsv4 > command now null terminates fattr_owner and fattr_owner_group. >=20 > Here is an example excerpt from a tcpdump > Opcode: SETATTR (34) > stateid > [StateID Hash: 0xafa9] > seqid: 0x00000000 > Data: 000000000000000000000000 > obj_attributes > attrmask > recc_attr: FATTR4_OWNER_GROUP (37) > fattr4_owner_group: groupname@domainname.com > length: 25 >=20 > This means that even though there are actually 24 characters in > groupname@domainname.com, we now send 24 characters + 1 null character. > Hence the total length of 25. Previously the client would send just the > 24 characters and set length to 24. >=20 > This isn't an issue for communication with other Linux machines, but it > is an issue for interaction with AIX machines. As is discussed here. > https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1101292 >=20 > I attempted to read the RFC available here > http://tools.ietf.org/html/rfc5661, but have not been able to find a > statement instructing one way or the other. >=20 > So the question becomes, is it correct for linux to be sending this null > terminator when read against the RFC, or is it AIX's responsibility to > handle null-terminated strings? The client is definitely in error here according to RFC3530. Please check if the attached patch fixes the issue for you. Cheers Trond --=20 Trond Myklebust Linux NFS client maintainer NetApp Trond.Myklebust@netapp.com www.netapp.com --_002_4FA345DA4F4AE44899BD2B03EEEC2FA9286B6F80sacexcmbx05prdh_ Content-Type: text/x-patch; name="0001-NFSv4-Fix-the-string-length-returned-by-the-idmapper.patch" Content-Description: 0001-NFSv4-Fix-the-string-length-returned-by-the-idmapper.patch Content-Disposition: attachment; filename="0001-NFSv4-Fix-the-string-length-returned-by-the-idmapper.patch"; size=2303; creation-date="Fri, 08 Mar 2013 18:33:52 GMT"; modification-date="Fri, 08 Mar 2013 18:33:52 GMT" Content-ID: Content-Transfer-Encoding: base64 RnJvbSA5MGVhYmM1ZGZkZTU4ZGU1YzM3ZGUzODY2ZjQyN2RhMDJlODZjZTE3IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQ0KRnJvbTogVHJvbmQgTXlrbGVidXN0IDxUcm9uZC5NeWtsZWJ1c3RAbmV0 YXBwLmNvbT4NCkRhdGU6IEZyaSwgOCBNYXIgMjAxMyAxMjo1NjozNyAtMDUwMA0KU3ViamVjdDog W1BBVENIXSBORlN2NDogRml4IHRoZSBzdHJpbmcgbGVuZ3RoIHJldHVybmVkIGJ5IHRoZSBpZG1h cHBlcg0KDQpGdW5jdGlvbnMgbGlrZSBuZnNfbWFwX3VpZF90b19uYW1lKCkgYW5kIG5mc19tYXBf Z2lkX3RvX2dyb3VwKCkgYXJlDQpleHBlY3RlZCB0byByZXR1cm4gYSBzdHJpbmcgd2l0aG91dCBh bnkgdGVybWluYXRpbmcgTlVMIGNoYXJhY3Rlci4NClJlZ3Jlc3Npb24gaW50cm9kdWNlZCBieSBj b21taXQgNTdlNjIzMjRlNDY5ZTA5MmVjYzZjOTRhN2E4NmZlNGJkNmFjNTE3Mg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