Return value in cli_initialise wrong?

Joe Doran joed at interlude.eu.org
Thu Jun 14 00:07:37 GMT 2001


On my hunt to find sspool hanging, memory problems I have been poking
around in name resolution functions eg namequery.c, I have come across
cli_intialise call in client connect. The function is requiring a
boolean false, however the function itself or at least the only
reference I can find returns NULL.

Is this correct or should it be checking for NULL on return?
and if NULL should functions below also be so.

eg...

/*********************************************************
 Connect to the client machine.
**********************************************************/

BOOL spoolss_connect_to_client( struct cli_state *cli, char
*remote_machine)
{
        ZERO_STRUCTP(cli);
        if(cli_initialise(cli) == False) {
                DEBUG(0,("connect_to_client: unable to initialize client
connect
ion.\n"));
                return False;
        }

        if(!resolve_name( remote_machine, &cli->dest_ip, 0x20)) {
                DEBUG(0,("connect_to_client: Can't resolve address for
%s\n", re
mote_machine));
                cli_shutdown(cli);
        return False;
        }

The only reference to this is in a struct in libsmb/clientgen.c
/****************************************************************************

initialise a client structure
****************************************************************************/

struct cli_state *cli_initialise(struct cli_state *cli)
{
        if (!cli) {
                cli = (struct cli_state *)malloc(sizeof(*cli));
                if (!cli)
                        return NULL;
                ZERO_STRUCTP(cli);
        }

        if (cli->initialised) {
                cli_shutdown(cli);
        }

This function is called in the following.
./client/smbmount.c
./client/smbspool.c
./libsmb/cli_lsarpc.c
./libsmb/cli_netlogon.c
./libsmb/cli_samr.c
./libsmb/cli_spoolss.c
./libsmb/cli_srvsvc.c
./libsmb/cliconnect.c
./libsmb/clientgen.c
./libsmb/libsmbclient.c
./libsmb/passchange.c
./nmbd/nmbd_synclists.c
./rpc_client/cli_netlogon.c
./rpc_client/cli_spoolss_notify.c
./rpc_client/cli_use.c
./rpcclient/rpcclient.c
./smbd/password.c
./smbwrapper/smbw.c
./utils/locktest.c
./utils/locktest2.c
./utils/masktest.c
./utils/rpctorture.c
./utils/smbcacls.c
./utils/torture.c

Joe.





More information about the samba-technical mailing list