The branch, master has been updated
       via  debaf40 s3: Add set_socket_options to cli_connect_sock()
       via  7d47e65 s3: Use cli_connect_nb in nmbd sync_child
       via  5676f81 s3: Remove unused attempt_netbios_session_request
       via  3f8621b s3: Use cli_connect_nb in do_connect
      from  0969c33 s3: Use the correct guest_login field in auth_server

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit debaf40e99c6d82c03f00ba10e43ab4bb81d8e41
Author: Volker Lendecke <[email protected]>
Date:   Sun May 29 13:40:03 2011 +0200

    s3: Add set_socket_options to cli_connect_sock()
    
    A leftover of stuff that cli_connect() does
    
    Autobuild-User: Volker Lendecke <[email protected]>
    Autobuild-Date: Sun May 29 15:47:17 CEST 2011 on sn-devel-104

commit 7d47e65e326b5327f013bf2b4f448ee37172407d
Author: Volker Lendecke <[email protected]>
Date:   Sun May 29 13:38:20 2011 +0200

    s3: Use cli_connect_nb in nmbd sync_child

commit 5676f817c747feb1b2e4e100e5083e2ad75ce421
Author: Volker Lendecke <[email protected]>
Date:   Sun May 29 13:33:49 2011 +0200

    s3: Remove unused attempt_netbios_session_request

commit 3f8621b5d396920f1756df17445ad8e675a606f5
Author: Volker Lendecke <[email protected]>
Date:   Sun May 29 13:17:23 2011 +0200

    s3: Use cli_connect_nb in do_connect

-----------------------------------------------------------------------

Summary of changes:
 source3/libsmb/cliconnect.c   |   66 +----------------------------------------
 source3/libsmb/clidfs.c       |   51 ++++----------------------------
 source3/libsmb/proto.h        |    2 -
 source3/nmbd/nmbd_synclists.c |   22 ++-----------
 4 files changed, 11 insertions(+), 130 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index bc22028..5f6488d 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -3154,6 +3154,7 @@ static NTSTATUS cli_connect_sock(const char *host, int 
name_type,
        if (!NT_STATUS_IS_OK(status)) {
                goto fail;
        }
+       set_socket_options(fd, lp_socket_options());
 done:
        *pfd = fd;
        *pport = port;
@@ -3362,71 +3363,6 @@ NTSTATUS cli_full_connection(struct cli_state 
**output_cli,
 }
 
 /****************************************************************************
- Attempt a NetBIOS session request, falling back to *SMBSERVER if needed.
-****************************************************************************/
-
-bool attempt_netbios_session_request(struct cli_state **ppcli, const char 
*srchost, const char *desthost,
-                                     struct sockaddr_storage *pdest_ss)
-{
-       struct nmb_name calling, called;
-
-       make_nmb_name(&calling, srchost, 0x0);
-
-       /*
-        * If the called name is an IP address
-        * then use *SMBSERVER immediately.
-        */
-
-       if(is_ipaddress(desthost)) {
-               make_nmb_name(&called, STAR_SMBSERVER, 0x20);
-       } else {
-               make_nmb_name(&called, desthost, 0x20);
-       }
-
-       if (!cli_session_request(*ppcli, &calling, &called)) {
-               NTSTATUS status;
-               struct nmb_name smbservername;
-
-               make_nmb_name(&smbservername, STAR_SMBSERVER, 0x20);
-
-               /*
-                * If the name wasn't *SMBSERVER then
-                * try with *SMBSERVER if the first name fails.
-                */
-
-               if (nmb_name_equal(&called, &smbservername)) {
-
-                       /*
-                        * The name used was *SMBSERVER, don't bother with 
another name.
-                        */
-
-                       DEBUG(0,("attempt_netbios_session_request: %s rejected 
the session for name *SMBSERVER \
-with error %s.\n", desthost, cli_errstr(*ppcli) ));
-                       return False;
-               }
-
-               /* Try again... */
-               cli_shutdown(*ppcli);
-
-               *ppcli = cli_initialise();
-               if (!*ppcli) {
-                       /* Out of memory... */
-                       return False;
-               }
-
-               status = cli_connect(*ppcli, desthost, pdest_ss);
-               if (!NT_STATUS_IS_OK(status) ||
-                               !cli_session_request(*ppcli, &calling, 
&smbservername)) {
-                       DEBUG(0,("attempt_netbios_session_request: %s rejected 
the session for \
-name *SMBSERVER with error %s\n", desthost, cli_errstr(*ppcli) ));
-                       return False;
-               }
-       }
-
-       return True;
-}
-
-/****************************************************************************
  Send an old style tcon.
 ****************************************************************************/
 NTSTATUS cli_raw_tcon(struct cli_state *cli, 
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index 89dcf94..5c5257f 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -88,10 +88,6 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
                                        int name_type)
 {
        struct cli_state *c = NULL;
-       struct nmb_name called, calling;
-       const char *called_str;
-       const char *server_n;
-       struct sockaddr_storage ss;
        char *servicename;
        char *sharename;
        char *newserver, *newshare;
@@ -107,7 +103,6 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
        sharename = servicename;
        if (*sharename == '\\') {
                sharename += 2;
-               called_str = sharename;
                if (server == NULL) {
                        server = sharename;
                }
@@ -117,36 +112,19 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
                }
                *sharename = 0;
                sharename++;
-       } else {
-               called_str = server;
        }
-
-       server_n = server;
-
-       zero_sockaddr(&ss);
-
-       make_nmb_name(&calling, global_myname(), 0x0);
-       make_nmb_name(&called , called_str, name_type);
-
- again:
-       zero_sockaddr(&ss);
-
-       /* have to open a new connection */
-       c = cli_initialise_ex(get_cmdline_auth_info_signing_state(auth_info));
-       if (c == NULL) {
-               d_printf("Connection to %s failed\n", server_n);
+       if (server == NULL) {
                return NULL;
        }
-       if (port) {
-               cli_set_port(c, port);
-       }
 
-       status = cli_connect(c, server_n, &ss);
+       status = cli_connect_nb(
+               server, NULL, port, name_type, NULL,
+               get_cmdline_auth_info_signing_state(auth_info), &c);
+
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("Connection to %s failed (Error %s)\n",
-                               server_n,
+                               server,
                                nt_errstr(status));
-               cli_shutdown(c);
                return NULL;
        }
 
@@ -159,23 +137,6 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
                get_cmdline_auth_info_fallback_after_kerberos(auth_info);
        c->use_ccache = get_cmdline_auth_info_use_ccache(auth_info);
 
-       if (!cli_session_request(c, &calling, &called)) {
-               char *p;
-               d_printf("session request to %s failed (%s)\n",
-                        called.name, cli_errstr(c));
-               cli_shutdown(c);
-               c = NULL;
-               if ((p=strchr_m(called.name, '.'))) {
-                       *p = 0;
-                       goto again;
-               }
-               if (strcmp(called.name, "*SMBSERVER")) {
-                       make_nmb_name(&called , "*SMBSERVER", 0x20);
-                       goto again;
-               }
-               return NULL;
-       }
-
        DEBUG(4,(" session request ok\n"));
 
        status = cli_negprot(c);
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index 7a8f567..2eb6374 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -89,8 +89,6 @@ NTSTATUS cli_full_connection(struct cli_state **output_cli,
                             const char *user, const char *domain,
                             const char *password, int flags,
                             int signing_state);
-bool attempt_netbios_session_request(struct cli_state **ppcli, const char 
*srchost, const char *desthost,
-                                     struct sockaddr_storage *pdest_ss);
 NTSTATUS cli_raw_tcon(struct cli_state *cli,
                      const char *service, const char *pass, const char *dev,
                      uint16 *max_xmit, uint16 *tid);
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index 243222b..964975e 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -72,7 +72,6 @@ static void sync_child(char *name, int nm_type,
        fstring unix_workgroup;
        struct cli_state *cli;
        uint32 local_type = local ? SV_TYPE_LOCAL_LIST_ONLY : 0;
-       struct nmb_name called, calling;
        struct sockaddr_storage ss;
        NTSTATUS status;
 
@@ -80,25 +79,12 @@ static void sync_child(char *name, int nm_type,
         * Patch from Andy Levine [email protected].
         */
 
-       cli = cli_initialise();
-       if (!cli) {
-               return;
-       }
-
-       cli_set_port(cli, 139);
-
        in_addr_to_sockaddr_storage(&ss, ip);
-       status = cli_connect(cli, name, &ss);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_shutdown(cli);
-               return;
-       }
-
-       make_nmb_name(&calling, get_local_machine_name(), 0x0);
-       make_nmb_name(&called , name, nm_type);
 
-       if (!cli_session_request(cli, &calling, &called)) {
-               cli_shutdown(cli);
+       status = cli_connect_nb(name, &ss, 139, nm_type,
+                               get_local_machine_name(), Undefined,
+                               &cli);
+       if (!NT_STATUS_IS_OK(status)) {
                return;
        }
 


-- 
Samba Shared Repository

Reply via email to