Revert "s3:libsmb: Fix printing the session setup information"
authorAndreas Schneider <asn@samba.org>
Thu, 8 Jun 2017 14:08:54 +0000 (16:08 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 9 Jun 2017 11:00:11 +0000 (13:00 +0200)
This reverts commit b6f87af427a1fa2bd397668d9f14cb0cf8ec5015.

A different fix will follow.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/libsmb/cliconnect.c
source3/libsmb/clidfs.c
source3/libsmb/clientgen.c
source3/torture/masktest.c

index 0862722662936fe86d9e4bd26bfcf83b1dc7f240..a28a5824dc2764ebc29c8d331a2e110f028606d9 100644 (file)
@@ -1122,8 +1122,7 @@ 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 == NULL ||
-            state->cli->server_domain[0] == '\0') && server_domain != NULL) {
+       if (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);
index 09e21ac7f8d6e5e11e1d0db421ba9a5440abef51..c477d7c6a46c5cb1d6c95485c04b1b49a961fcbc 100644 (file)
@@ -259,31 +259,13 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
                return status;
        }
 
-       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));
-                       }
+       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));
                }
        }
        DEBUG(4,(" session setup ok\n"));
index 2c0b8c5f081417aa20643848d9ab461187cbfeb8..bc5c1b1ce3cd79347a991586c1311f7dc6aa3b0f 100644 (file)
@@ -104,6 +104,19 @@ 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;
index 57607b069a818cad68e04acdd785cd588324b240..95e0b04b04006e0c316c0757f1163ed31a4baed0 100644 (file)
@@ -212,9 +212,7 @@ static struct cli_state *connect_one(char *share)
         * mode to turn these on/off ? JRA.
         */
 
-       if (c->server_domain != NULL ||
-           c->server_os != NULL ||
-           c->server_type != NULL)
+       if (*c->server_domain || *c->server_os || *c->server_type)
                DEBUG(1,("Domain=[%s] OS=[%s] Server=[%s]\n",
                        c->server_domain,c->server_os,c->server_type));