From dbc79381a87269e8ca0631e001aebb064ab4851b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 22 Feb 2009 11:53:50 +0100 Subject: Convert name_mangle() to use talloc --- source3/libsmb/cliconnect.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'source3/libsmb/cliconnect.c') diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index dabfc398ce..ad11ee0ed4 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -1642,6 +1642,7 @@ bool cli_session_request(struct cli_state *cli, { char *p; int len = 4; + char *tmp; /* 445 doesn't have session request */ if (cli->port == 445) @@ -1651,14 +1652,30 @@ bool cli_session_request(struct cli_state *cli, memcpy(&(cli->called ), called , sizeof(*called )); /* put in the destination name */ + + tmp = name_mangle(talloc_tos(), cli->called.name, + cli->called.name_type); + if (tmp == NULL) { + return false; + } + p = cli->outbuf+len; - name_mangle(cli->called .name, p, cli->called .name_type); - len += name_len(p); + memcpy(p, tmp, name_len(tmp)); + len += name_len(tmp); + TALLOC_FREE(tmp); /* and my name */ + + tmp = name_mangle(talloc_tos(), cli->calling.name, + cli->calling.name_type); + if (tmp == NULL) { + return false; + } + p = cli->outbuf+len; - name_mangle(cli->calling.name, p, cli->calling.name_type); - len += name_len(p); + memcpy(p, tmp, name_len(tmp)); + len += name_len(tmp); + TALLOC_FREE(tmp); /* send a session request (RFC 1002) */ /* setup the packet length -- cgit