[Samba] rpcclient man page and "--help"

Nick Pietraniec nickp at campbellco.com
Wed Mar 13 11:06:03 GMT 2002


There seems to be some discrepancy between rpcclient's man page and
"rpcclient --help" in regards to the servername.

It seems that the proper usage of rpcclient is 

rpcclient [options] server 

this is the format that is specified in "rpcclient --help."  rpcclient's
man page, however specifies that the servername should come directly
after rpcclient.  I.E. "rpcclient server [options]"  which doesn't seem
to work because rpcclient does not process any further options after
encountering the host.


Most of the investigation on this was done by Robin Blanchard
(robin_blanchard at gactr.uga.edu) and Mike Sweet (mike at easysw.com)  I've
attached a previous E-mail below.  We were trying to investigate why the
command "cupsaddsmb" in the cups package wasn't working correctly.


-Nick Pietraniec

___________________________________________________




> ...the construct of cupsaddsmb's rpcclient calls are incorrect.

> > ...

> 
> Hmm, the executable reports the server at the end, but the code
> specifically grabs the server name from the first argument on the
> command line:
> 
> if (strncmp("//", argv[1], 2) == 0 || strncmp("\\\\", argv[1], 2) ==
0)
> argv[1] += 2;
> 
> >>> pstrcpy(server, argv[1]);
> 
> argv++;
> argc--;
> 
> You might want to post this message to the SAMBA mailing list; also,
> are you compiling from source or using a premade RPM from RedHat,
etc.?



This in on FreeBSD 4.5-STABLE, cups-1.1.14 and samba-2.2.3a compiled
from source. 

The code in question appears to be
cups-1.1.14/systemv/cupsaddsmb.c:
    143     snprintf(temp, sizeof(temp), "%s -N -U\'%s%%%s\' -c \'%s\'",
    144              command, cupsUser(), p, subcmd);

"command" thus apparently becomes "rpcclient localhost" which fails as
rpcclient does not process any further options after encountering host.
Therefore "subcmd" never gets processed.

rpcclient certainly requires host to be final as evinced by:
Failure (contructed a la cupsaddsmb):
# rpcclient localhost -N -U'stuffhere' -c 'adddriver "Windows NT x86"
"itoj95:ADOBEPS5.DLL:itoj95.PPD:ADOBEPSU.DLL:ADOBEPSU.HLP:NULL:RAW:NULL"'

Success (hostname as final argument):
# rpcclient -N -U'stuffhere' -c 'adddriver "Windows NT x86"
"itoj95:ADOBEPS5.DLL:itoj95.PPD:ADOBEPSU.DLL:ADOBEPSU.HLP:NULL:RAW:NULL"'
localhost

This is corroborated by:
# rpcclient --help
Usage: rpcclient [options] server
        -A authfile           file containing user credentials
        -c "command string"   execute semicolon separated cmds
        -d debuglevel         set the debuglevel
        -l logfile            name of logfile to use as opposed to
stdout
        -h                    Print this help message.
        -N                    don't ask for a password
        -s configfile         specify an alternative config file
        -U username           set the network username
        -W domain             set the domain name for user account

Unfortunately, the man page for rpcclient maintains the host should be
the first argument. I am not on the SAMBA mailing list. Perhaps someone
could notify the SAMBA team that the help and man pages for rpcclient
are out of sync?

In the meantime, it would seem that cupsaddsmb should be modified
appropriately so as to pass the appropriate flags to rpcclient as it
expects them.


-- ------------------------------------ Robin P. Blanchard IT Program
Specialist Georgia Center for Continuing Ed. fon: 706.542.2404 fax:
706.542.6546 email: Robin_Blanchard at gactr.uga.edu
------------------------------------ 






More information about the samba mailing list