The branch, v3-4-test has been updated
       via  a0fbf06... s3: Fix crash in pam_winbind, another reference to freed 
memory.
       via  587ca74... Fix bug 6829 - smbclient does not show special 
characters properly. All successful calls to cli_session_setup() *must* be 
followed by calls to cli_init_creds() to stash the credentials we successfully 
connected with. There were 2 codepaths where this was missing. This caused 
smbclient to be unable to open the \srvsvc pipe to do an RPC netserverenum, and 
cause it to fall back to a RAP netserverenum, which uses DOS codepage 
conversion rather than the full UCS2 of RPC, so the returned characters were 
not correct (unless the DOS codepage was set correctly). Phew. That was fun to 
track down :-). Includes logic simplification in libsmb_server.c Jeremy.
      from  a572c28... Fix bug 6828 - infinite timeout occurs when byte lock 
held outside of samba Jeremy.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-4-test


- Log -----------------------------------------------------------------
commit a0fbf067011ae50d63c6ed2a79f1ff00c2ce2d11
Author: Bo Yang <boy...@samba.org>
Date:   Sat Oct 24 09:20:00 2009 +0800

    s3: Fix crash in pam_winbind, another reference to freed memory.
    
    Fix bug #6840.
    
    Signed-off-by: Bo Yang <boy...@samba.org>
    (cherry picked from commit b9a3f1dd85d168c15df846dba525f4f882d1acf8)

commit 587ca743bf1491e97c984ce4bec5a9bd0a1ae69a
Author: Jeremy Allison <j...@samba.org>
Date:   Thu Oct 22 15:30:47 2009 -0700

    Fix bug 6829 - smbclient does not show special characters properly. All 
successful calls to cli_session_setup() *must* be followed by calls to 
cli_init_creds() to stash the credentials we successfully connected with. There 
were 2 codepaths where this was missing. This caused smbclient to be unable to 
open the \srvsvc pipe to do an RPC netserverenum, and cause it to fall back to 
a RAP netserverenum, which uses DOS codepage conversion rather than the full 
UCS2 of RPC, so the returned characters were not correct (unless the DOS 
codepage was set correctly). Phew. That was fun to track down :-). Includes 
logic simplification in libsmb_server.c Jeremy.

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

Summary of changes:
 nsswitch/pam_winbind.c         |   10 +++++++---
 source3/libsmb/clidfs.c        |    9 +++++++++
 source3/libsmb/libsmb_server.c |    8 ++++++++
 3 files changed, 24 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index ab22c7c..ec05f75 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -1784,7 +1784,7 @@ static int winbind_auth_request(struct pwb_context *ctx,
        if (logon.blobs) {
                wbcFreeMemory(logon.blobs);
        }
-       if (info && info->blobs) {
+       if (info && info->blobs && !p_info) {
                wbcFreeMemory(info->blobs);
        }
        if (error && !p_error) {
@@ -3138,10 +3138,14 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
                                        free(username_ret);
                                }
 
-                               wbcFreeMemory(info);
-                               wbcFreeMemory(policy);
                        }
 
+                       if (info && info->blobs) {
+                               wbcFreeMemory(info->blobs);
+                       }
+                       wbcFreeMemory(info);
+                       wbcFreeMemory(policy);
+
                        goto out;
                }
        } else {
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index 5e944f1..53dc6d7 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -216,6 +216,15 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
                        return NULL;
                }
                d_printf("Anonymous login successful\n");
+               status = cli_init_creds(c, "", lp_workgroup(), "");
+       } else {
+               status = cli_init_creds(c, username, lp_workgroup(), password);
+       }
+
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(10,("cli_init_creds() failed: %s\n", nt_errstr(status)));
+               cli_shutdown(c);
+               return NULL;
        }
 
        if ( show_sessetup ) {
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 60849c8..cf2d1d5 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -500,6 +500,14 @@ again:
                 }
        }
 
+       status = cli_init_creds(c, username_used,
+                       *pp_workgroup, *pp_password);
+       if (!NT_STATUS_IS_OK(status)) {
+               errno = map_errno_from_nt_status(status);
+               cli_shutdown(c);
+               return NULL;
+       }
+
        DEBUG(4,(" session setup ok\n"));
 
        status = cli_tcon_andx(c, share, "?????", *pp_password,


-- 
Samba Shared Repository

Reply via email to