Problems with rpcclient on FreeBSD

Rudolf Cejka cejkar at fit.vutbr.cz
Mon May 17 14:54:11 GMT 2004


Hello,
  I'm trying to report a bug in samba over bugzilla interface (bugzilla is
very good thing, how to daunt many bug reporters including me until now...),
but it seems that it does not work (still waiting on account registration
- I have reported it to bugzilla-maintenance at samba.org too), so I'm trying
samba-technical at samba.org for this bug report with patch:

There is a comment about getopt() reinitialization in rpcclient/cmd_reg.c:
/* TODO: test if this hack works on other systems too --simo */
As far as I know, it does not work atleast on FreeBSD, where optreset
has to be used instead of just setting optind. The same problem seems to
be in 2.2.9 and in 3.0.4. Please apply following or similar patch in Samba,
so that rpcclient -c "command -parameter" could work on FreeBSD. I think
that other BSDs could have the same problem.

Thanks you very much.

--- 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)
 	{

-- 
Rudolf Cejka <cejkar at fit.vutbr.cz> http://www.fit.vutbr.cz/~cejkar
Brno University of Technology, Faculty of Information Technology
Bozetechova 2, 612 66  Brno, Czech Republic


More information about the samba-technical mailing list