From nobody@FreeBSD.org  Sat Oct  5 16:40:42 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id D90FF406
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  5 Oct 2013 16:40:42 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id C6FC02AB0
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  5 Oct 2013 16:40:42 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r95Geg3A085264
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 5 Oct 2013 16:40:42 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r95GegkK085246;
	Sat, 5 Oct 2013 16:40:42 GMT
	(envelope-from nobody)
Message-Id: <201310051640.r95GegkK085246@oldred.freebsd.org>
Date: Sat, 5 Oct 2013 16:40:42 GMT
From: Scott Burns <scott@bqinternet.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] camcontrol(8) security command can't set master password
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         182703
>Category:       bin
>Synopsis:       [patch] camcontrol(8) security command can't set master password
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    markj
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 05 16:50:00 UTC 2013
>Closed-Date:    Sun Oct 20 02:50:37 UTC 2013
>Last-Modified:  Sun Oct 20 02:50:37 UTC 2013
>Originator:     Scott Burns
>Release:        9.2-RELEASE
>Organization:
BQ Internet Corporation
>Environment:
FreeBSD backup19.bqinternet.com 9.2-RELEASE FreeBSD 9.2-RELEASE #2: Sat Oct  5 11:25:27 UTC 2013     root@backup19.bqinternet.com:/usr/obj/usr/src/sys/BACKUP19  amd64
>Description:
FreeBSD 9.2 introduced support for ATA security settings in camcontrol(8).  The released version of camcontrol is unable to set a master password due to a bug in the command-line option parsing.
>How-To-Repeat:
# camcontrol security da18 -U master -s 0000
camcontrol: -U argument 'master' is invalid (must be 'user' or 'master')
>Fix:
See attached patch.

Patch attached with submission follows:

--- sbin/camcontrol/camcontrol.c.orig	2013-10-05 16:19:28.000000000 +0000
+++ sbin/camcontrol/camcontrol.c	2013-10-05 16:22:49.477413000 +0000
@@ -2748,7 +2748,7 @@
 			if (strcasecmp(optarg, "user") == 0) {
 				pwd.ctrl |= ATA_SECURITY_PASSWORD_USER;
 				pwd.ctrl &= ~ATA_SECURITY_PASSWORD_MASTER;
-			} else if (strcasecmp(optarg, "master") != 0) {
+			} else if (strcasecmp(optarg, "master") == 0) {
 				pwd.ctrl |= ATA_SECURITY_PASSWORD_MASTER;
 				pwd.ctrl &= ~ATA_SECURITY_PASSWORD_USER;
 			} else {


>Release-Note:
>Audit-Trail:

From: Mark Johnston <markj@freebsd.org>
To: Scott Burns <scott@bqinternet.com>, bug-followup@freebsd.org
Cc:  
Subject: Re: bin/182703: [patch] camcontrol(8) security command can't set
 master password
Date: Tue, 8 Oct 2013 00:05:00 -0400

 If I'm not mistaken, the -U option is optional and defaults to master in
 this case, so it should still be possible to do what you want by
 omitting -U entirely.
 
 -Mark
State-Changed-From-To: open->patched 
State-Changed-By: markj 
State-Changed-When: Tue Oct 8 04:18:26 UTC 2013 
State-Changed-Why:  
Fixed in r256133. 


Responsible-Changed-From-To: freebsd-bugs->markj 
Responsible-Changed-By: markj 
Responsible-Changed-When: Tue Oct 8 04:18:26 UTC 2013 
Responsible-Changed-Why:  
Fixed in r256133. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=182703 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/182703: commit references a PR
Date: Tue,  8 Oct 2013 04:16:34 +0000 (UTC)

 Author: markj
 Date: Tue Oct  8 04:16:22 2013
 New Revision: 256133
 URL: http://svnweb.freebsd.org/changeset/base/256133
 
 Log:
   Fix an inverted check for the master user in "camcontrol security -U".
   
   PR:		bin/182703
   Submitted by:	Scott Burns <scott@bqinternet.com>
   Approved by:	re (gjb)
   MFC after:	3 days
 
 Modified:
   head/sbin/camcontrol/camcontrol.c
 
 Modified: head/sbin/camcontrol/camcontrol.c
 ==============================================================================
 --- head/sbin/camcontrol/camcontrol.c	Tue Oct  8 01:38:24 2013	(r256132)
 +++ head/sbin/camcontrol/camcontrol.c	Tue Oct  8 04:16:22 2013	(r256133)
 @@ -2748,7 +2748,7 @@ atasecurity(struct cam_device *device, i
  			if (strcasecmp(optarg, "user") == 0) {
  				pwd.ctrl |= ATA_SECURITY_PASSWORD_USER;
  				pwd.ctrl &= ~ATA_SECURITY_PASSWORD_MASTER;
 -			} else if (strcasecmp(optarg, "master") != 0) {
 +			} else if (strcasecmp(optarg, "master") == 0) {
  				pwd.ctrl |= ATA_SECURITY_PASSWORD_MASTER;
  				pwd.ctrl &= ~ATA_SECURITY_PASSWORD_USER;
  			} else {
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: markj 
State-Changed-When: Sun Oct 20 02:50:36 UTC 2013 
State-Changed-Why:  
The fix was merged to stable/9 and stable/8 in r256578 and r256579. 
Thanks for the PR. 

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