Bug 7970 - smbclient ignores -I option
Summary: smbclient ignores -I option
Alias: None
Product: Samba 3.5
Classification: Unclassified
Component: Client Tools (show other bugs)
Version: 3.5.6
Hardware: Other Other
: P3 major
Target Milestone: ---
Assignee: Volker Lendecke
QA Contact: Samba QA Contact
URL: http://bugs.debian.org/cgi-bin/bugrep...
Depends on:
Reported: 2011-02-23 09:05 UTC by Sebastian Kricner
Modified: 2013-10-22 22:10 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Kricner 2011-02-23 09:05:01 UTC

it seems to be a logical mistake in smbclient.

popt first retrieves the arguments, setting in case of the "-L" option
the query_host variable. popt also retrieves in case of the "-I" option
the argument and sets a boolean variable have_ip.

In some operations of the smbclient there is the have_ip used like so:

                cli = cli_cm_open(talloc_tos(), NULL,
                                have_ip ? dest_ss_str : desthost,
                                service, auth_info,
                                true, smb_encrypt,
                                max_protocol, port, name_type);

But in do_host_query it is done in that way:

        cli = cli_cm_open(talloc_tos(), NULL,
                        query_host, "IPC$", auth_info, true,
        smb_encrypt, max_protocol, port, name_type);

In this case smbclient just takes the argument of the "-L" parameter
and tries to open that host, which also is successful, but failing
because the ressource name is wrong:

session request to *SMBSERVER failed (Called name not present)

This is because do_host_query uses the ip address to connect to and as
the netbios name of the remote server. The ip address does not match
with the netbios name.

Thus it is to confirm that smbclient ignores the -I option.

cli_cm_open would need to have an extra parameter with the netbios
name, so that it is possible to connect to an ip address but have set
the correct ressource name.
Comment 1 Jelmer Vernooij 2013-10-22 22:10:15 UTC
This appears to have been fixed some time in or before 2011. -L now uses the same logic as elsewhere.