From cejkar@fit.vutbr.cz  Mon May 17 07:22:19 2004
Return-Path: <cejkar@fit.vutbr.cz>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 81BE616A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 17 May 2004 07:22:19 -0700 (PDT)
Received: from kazi.fit.vutbr.cz (kazi.fit.vutbr.cz [147.229.8.12])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 50A2343D48
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 17 May 2004 07:22:18 -0700 (PDT)
	(envelope-from cejkar@fit.vutbr.cz)
Received: from kazi.fit.vutbr.cz (localhost [127.0.0.1])
	by kazi.fit.vutbr.cz (8.12.11/8.12.11) with ESMTP id i4HEMFR7036678
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 17 May 2004 16:22:15 +0200 (CEST)
Received: (from cejkar@localhost)
	by kazi.fit.vutbr.cz (8.12.11/8.12.5/Submit) id i4HEMEmn036676;
	Mon, 17 May 2004 16:22:14 +0200 (CEST)
Message-Id: <200405171422.i4HEMEmn036676@kazi.fit.vutbr.cz>
Date: Mon, 17 May 2004 16:22:14 +0200 (CEST)
From: Rudolf Cejka <cejkar@fit.vutbr.cz>
Reply-To: Rudolf Cejka <cejkar@fit.vutbr.cz>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: net/samba: rpcclient does not recognize parameters in -c ...
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         66746
>Category:       ports
>Synopsis:       net/samba: rpcclient does not recognize parameters in -c ...
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 17 07:30:25 PDT 2004
>Closed-Date:    Tue May 25 01:18:02 PDT 2004
>Last-Modified:  Tue May 25 01:18:02 PDT 2004
>Originator:     Rudolf Cejka
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
FIT, Brno University of Technology, Czech Republic
>Environment:
>Description:

rpcclient from net/samba (and it seems that from net/samba-devel too)
does not recognize parameters in -c <command> correctly.

>How-To-Repeat:

Try to run rpcclient -c "shutdown -r" <host> - it shutdowns computer
instead of rebooting, because it does not recognize -r parameter in
command after -c. Please add following patch to our ports until samba
team understand, that they should solve their hack more correctly
(I reported it in the past already, but obviously without any effect :o|).

>Fix:

--- CUT HERE (BEGIN)
--- source/rpcclient/cmd_reg.c.orig	Thu Nov 27 12:17:08 2003
+++ source/rpcclient/cmd_reg.c	Thu Nov 27 12:19:24 2003
@@ -900,6 +900,9 @@
 {
 	extern char *optarg;
 	extern int optind;
+#if	defined(__FreeBSD__)
+	extern int optreset;
+#endif
 	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
 	fstring msg;
 	uint32 timeout = 20;
@@ -907,7 +910,11 @@
 	int opt;
 
 	*msg = 0;
+#if	defined(__FreeBSD__)
+	optreset = optind = 1;
+#else
 	optind = 0; /* TODO: test if this hack works on other systems too --simo */
+#endif
 
 	while ((opt = getopt(argc, argv, "m:t:rf")) != EOF)
 	{
--- CUT HERE (END)

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: pav 
State-Changed-When: Tue May 25 01:17:54 PDT 2004 
State-Changed-Why:  
Committed, thanks! 

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