The branch, master has been updated
       via  4360c5b Patch for bug #8156 - net ads join fails to use the user's 
kerberos ticket.
       via  e0b2f6b The "workgroup" parameter is not used at all in 
cli_session_setup_kerberos(). Remove it.
      from  9f14d10 Fix bug #8157 - std_pcap_cache_reload() fails to parse a 
cups printcap file correctly.

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


- Log -----------------------------------------------------------------
commit 4360c5bf276aa958864254ee22b3a3d4a4560381
Author: Jeremy Allison <[email protected]>
Date:   Fri May 20 14:43:50 2011 -0700

    Patch for bug #8156 - net ads join fails to use the user's kerberos ticket.
    
    If kerberos_get_realm_from_hostname() or 
kerberos_get_default_realm_from_ccache() fails due to
     a misconfigured krb5.conf, try the "realm =" from smb.conf as a fallcback 
before going back to
     NTLMSSP (which we'll do anyway).
    
    Autobuild-User: Jeremy Allison <[email protected]>
    Autobuild-Date: Sat May 21 00:58:09 CEST 2011 on sn-devel-104

commit e0b2f6bd267e19986d31275ff3bf88600eaaeaf3
Author: Jeremy Allison <[email protected]>
Date:   Fri May 20 14:34:18 2011 -0700

    The "workgroup" parameter is not used at all in 
cli_session_setup_kerberos(). Remove it.

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

Summary of changes:
 source3/libsmb/cliconnect.c |   48 +++++++++++++++++++++++++++---------------
 1 files changed, 31 insertions(+), 17 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 374dd97..69d5ce6 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -1412,7 +1412,7 @@ static void cli_session_setup_kerberos_done(struct 
tevent_req *subreq);
 
 static struct tevent_req *cli_session_setup_kerberos_send(
        TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli,
-       const char *principal, const char *workgroup)
+       const char *principal)
 {
        struct tevent_req *req, *subreq;
        struct cli_session_setup_kerberos_state *state;
@@ -1500,8 +1500,7 @@ static ADS_STATUS cli_session_setup_kerberos_recv(struct 
tevent_req *req)
 }
 
 static ADS_STATUS cli_session_setup_kerberos(struct cli_state *cli,
-                                            const char *principal,
-                                            const char *workgroup)
+                                            const char *principal)
 {
        struct tevent_context *ev;
        struct tevent_req *req;
@@ -1514,8 +1513,7 @@ static ADS_STATUS cli_session_setup_kerberos(struct 
cli_state *cli,
        if (ev == NULL) {
                goto fail;
        }
-       req = cli_session_setup_kerberos_send(ev, ev, cli, principal,
-                                             workgroup);
+       req = cli_session_setup_kerberos_send(ev, ev, cli, principal);
        if (req == NULL) {
                goto fail;
        }
@@ -1873,6 +1871,9 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state 
*cli, const char *user,
                        host = strchr_m(cli->desthost, '.');
                        if (dest_realm) {
                                realm = SMB_STRDUP(dest_realm);
+                               if (!realm) {
+                                       return 
ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
+                               }
                                strupper_m(realm);
                        } else {
                                if (host) {
@@ -1884,25 +1885,38 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state 
*cli, const char *user,
                                }
                        }
 
-                       if (realm && *realm) {
-                               principal = talloc_asprintf(talloc_tos(),
-                                                           "cifs/%s@%s",
-                                                           cli->desthost,
-                                                           realm);
-                               if (!principal) {
-                                       SAFE_FREE(realm);
+                       if (realm == NULL || *realm == '\0') {
+                               realm = SMB_STRDUP(lp_realm());
+                               if (!realm) {
                                        return 
ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
                                }
-                               DEBUG(3,("cli_session_setup_spnego: guessed "
-                                       "server principal=%s\n",
-                                       principal ? principal : "<null>"));
+                               strupper_m(realm);
+                               DEBUG(3,("cli_session_setup_spnego: cannot "
+                                       "get realm from dest_realm %s, "
+                                       "desthost %s. Using default "
+                                       "smb.conf realm %s\n",
+                                       dest_realm ? dest_realm : "<null>",
+                                       cli->desthost,
+                                       realm));
                        }
+
+                       principal = talloc_asprintf(talloc_tos(),
+                                                   "cifs/%s@%s",
+                                                   cli->desthost,
+                                                   realm);
+                       if (!principal) {
+                               SAFE_FREE(realm);
+                               return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
+                       }
+                       DEBUG(3,("cli_session_setup_spnego: guessed "
+                               "server principal=%s\n",
+                               principal ? principal : "<null>"));
+
                        SAFE_FREE(realm);
                }
 
                if (principal) {
-                       rc = cli_session_setup_kerberos(cli, principal,
-                               dest_realm);
+                       rc = cli_session_setup_kerberos(cli, principal);
                        if (ADS_ERR_OK(rc) || !cli->fallback_after_kerberos) {
                                TALLOC_FREE(principal);
                                return rc;


-- 
Samba Shared Repository

Reply via email to