From nobody@FreeBSD.org  Sat Sep 17 16:10:52 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id F09B716A41F
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 17 Sep 2005 16:10:52 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id A437043D46
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 17 Sep 2005 16:10:52 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j8HGAqco050693
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 17 Sep 2005 16:10:52 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j8HGAq8T050692;
	Sat, 17 Sep 2005 16:10:52 GMT
	(envelope-from nobody)
Message-Id: <200509171610.j8HGAq8T050692@www.freebsd.org>
Date: Sat, 17 Sep 2005 16:10:52 GMT
From: thierry herbelot <thierry@herbelot.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: the weak_mountd_authentication flag from /etc/rc.conf is not taken into account
X-Send-Pr-Version: www-2.3

>Number:         86260
>Category:       conf
>Synopsis:       the weak_mountd_authentication flag from /etc/rc.conf is not taken into account
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    rodrigc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 17 16:20:05 GMT 2005
>Closed-Date:    Wed Sep 21 20:28:50 GMT 2005
>Last-Modified:  Wed Sep 21 20:28:50 GMT 2005
>Originator:     thierry herbelot
>Release:        FreeBSD 6.0-BETA4
>Organization:
>Environment:
FreeBSD XXX 6.0-BETA4 FreeBSD 6.0-BETA4 #3: Wed Sep 14 16:50:32 CEST 2005     YYYY@XXX:/usr/obj/usr/src/sys/GENERIC  i386 
>Description:
I am trying to mount as a user an NFS partition exported from a 6.0-BETA4 server. the client is also running 6.0-BETA4 (GENERIC).

I have set "sysctl vfs.usermount=1" on the client, but I get :
% mount server:/share ~/mnt
[udp] server:/share: RPCPROG_MNT: RPC: Authentication error; why = Client credential too weak

on the server, /etc/rc.conf contains :
nfs_reserved_port_only="NO"
weak_mountd_authentication="YES"
rpcbind_enable="YES"
nfs_server_enable="YES"
mountd_enable="YES"
rpcbind_enable="YES"

with these flags, mountd should be started with "-n -r", but a debug trace of "sh -x /etc/rc.d/mountd start" gives :
..
+ checkyesno weak_mountd_authentication
+ eval _value=$weak_mountd_authentication
+ _value=YES
+ debug checkyesno: weak_mountd_authentication is set to YES.
+ return 0
+ mountd_flags=-r -n
+ rm -f /var/db/mountdtab
+ umask 022
+
+ return 0
+ _return=0
+ [ 0 -ne 0 ]
+ echo Starting mountd.
Starting mountd.
+ [ -n  ]
+ _doit=/usr/sbin/mountd -r
+ [ -n  ]
+ debug run_rc_command: _doit: /usr/sbin/mountd -r
+ eval /usr/sbin/mountd -r
+ /usr/sbin/mountd -r
+ _return=0
+ [ 0 -ne 0 ]
+ [ -n  ]
+ return 0

If I understanding the startup process : in the /etc/rc.d/mountd script, mountd_precmd() correctly configures the "-n" and "-r" flags, but the subsequent call to load_rc_config() resets the flags to the default value set in /etc/defauls/rc.conf (or /etc/rc.conf)

A workaround is obviously to set mountd_flags="-r -n" in /etc/rc.conf
>How-To-Repeat:
(as in the full description)
>Fix:
(perhaps set the flags after the call to load_rc_config() - but it voids the in the interest of using mountd_precmd() - I have checked with the /etc/rc.d/mountd script in NetBSD, but this is simpler : it does not use rc.conf variables to set the mountd flags)
>Release-Note:
>Audit-Trail:

From: Thierry Herbelot <thierry@herbelot.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: conf/86260: the weak_mountd_authentication flag from /etc/rc.conf is not taken into account
Date: Sun, 18 Sep 2005 10:49:28 +0200

 the following diff (inspired by /etc/rc.d/named) solves the problem :
 32c32
 <   mountd_flags="${mountd_flags} -n"
 ---
 >  rc_flags="${rc_flags} -n"
 36c36
 <  checkyesno weak_mountd_authentication && mountd_flags="-n"
 ---
 >  checkyesno weak_mountd_authentication && rc_flags="${rc_flags} -n"
 
 the point is to use the correct "rc_flags" variable instead of "mountd_flags" 
 which is later overwritten.
 
 	TfH
State-Changed-From-To: open->patched 
State-Changed-By: rodrigc 
State-Changed-When: Sun Sep 18 16:59:16 GMT 2005 
State-Changed-Why:  
Patched in -CURRENT.  MFC reminder. 


Responsible-Changed-From-To: freebsd-bugs->rodrigc 
Responsible-Changed-By: rodrigc 
Responsible-Changed-When: Sun Sep 18 16:59:16 GMT 2005 
Responsible-Changed-Why:  
Patched in CURRENT.  MFC reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=86260 
State-Changed-From-To: patched->closed 
State-Changed-By: rodrigc 
State-Changed-When: Wed Sep 21 20:28:28 GMT 2005 
State-Changed-Why:  
Committed to RELENG_6 

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