1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3:libsmb: Fix printing the session setup information

This fixes a regression and prints the session setup on connect again:

Domain=[SAMBA-TEST] OS=[Windows 6.1] Server=[Samba 4.7.0pre1-DEVELOPERBUILD]
smb: \>

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12824

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Andreas Schneider 2017-06-06 17:29:16 +02:00 committed by Jeremy Allison
parent a4efe647c5
commit b6f87af427
4 changed files with 30 additions and 22 deletions

View File

@ -1122,7 +1122,8 @@ static void cli_session_setup_gensec_ready(struct tevent_req *req)
server_domain = gensec_ntlmssp_server_domain(
state->auth_generic->gensec_security);
if (state->cli->server_domain[0] == '\0' && server_domain != NULL) {
if ((state->cli->server_domain == NULL ||
state->cli->server_domain[0] == '\0') && server_domain != NULL) {
TALLOC_FREE(state->cli->server_domain);
state->cli->server_domain = talloc_strdup(state->cli,
server_domain);

View File

@ -259,13 +259,31 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
return status;
}
if ( show_sessetup ) {
if (*c->server_domain) {
DEBUG(0,("Domain=[%s] OS=[%s] Server=[%s]\n",
c->server_domain,c->server_os,c->server_type));
} else if (*c->server_os || *c->server_type) {
DEBUG(0,("OS=[%s] Server=[%s]\n",
c->server_os,c->server_type));
if (show_sessetup) {
const char *server_os = "unknown";
const char *server_type = "unknown";
bool do_print = false;
if (c->server_os != NULL && c->server_os[0] != '\0') {
server_os = c->server_os;
do_print = true;
}
if (c->server_type != NULL && c->server_type[0] != '\0') {
server_type = c->server_type;
do_print = true;
}
if (c->server_domain != NULL && c->server_domain[0] != '\0') {
DEBUG(0, ("Domain=[%s] OS=[%s] Server=[%s]\n",
c->server_domain,
server_os,
server_type));
} else {
if (do_print) {
DEBUG(0, ("OS=[%s] Server=[%s]\n",
server_os,
server_type));
}
}
}
DEBUG(4,(" session setup ok\n"));

View File

@ -104,19 +104,6 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
return NULL;
}
cli->server_domain = talloc_strdup(cli, "");
if (!cli->server_domain) {
goto error;
}
cli->server_os = talloc_strdup(cli, "");
if (!cli->server_os) {
goto error;
}
cli->server_type = talloc_strdup(cli, "");
if (!cli->server_type) {
goto error;
}
cli->dfs_mountpoint = talloc_strdup(cli, "");
if (!cli->dfs_mountpoint) {
goto error;

View File

@ -212,7 +212,9 @@ static struct cli_state *connect_one(char *share)
* mode to turn these on/off ? JRA.
*/
if (*c->server_domain || *c->server_os || *c->server_type)
if (c->server_domain != NULL ||
c->server_os != NULL ||
c->server_type != NULL)
DEBUG(1,("Domain=[%s] OS=[%s] Server=[%s]\n",
c->server_domain,c->server_os,c->server_type));