Ignore:
Timestamp:
Jul 11, 2008, 1:13:42 AM (17 years ago)
Author:
Paul Smedley
Message:

Update branch to 3.0.31 release

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/libsmb/cliconnect.c

    r134 r140  
    788788/****************************************************************************
    789789 Do a spnego encrypted session setup.
     790
     791 user_domain: The shortname of the domain the user/machine is a member of.
     792 dest_realm: The realm we're connecting to, if NULL we use our default realm.
    790793****************************************************************************/
    791794
    792795ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
    793                               const char *pass, const char *domain)
    794 {
    795         char *principal;
     796                              const char *pass, const char *user_domain,
     797                              const char * dest_realm)
     798{
     799        char *principal = NULL;
    796800        char *OIDs[ASN1_MAX_OIDS];
    797801        int i;
     
    814818        blob = data_blob(cli->secblob.data+16, cli->secblob.length-16);
    815819
    816         /* the server sent us the first part of the SPNEGO exchange in the negprot
    817            reply */
     820        /* The server sent us the first part of the SPNEGO exchange in the
     821         * negprot reply. It is WRONG to depend on the principal sent in the
     822         * negprot reply, but right now we do it. If we don't receive one,
     823         * we try to best guess, then fall back to NTLM.  */
    818824        if (!spnego_parse_negTokenInit(blob, OIDs, &principal)) {
    819825                data_blob_free(&blob);
     
    833839
    834840        DEBUG(3,("got principal=%s\n", principal ? principal : "<null>"));
    835 
    836         if (got_kerberos_mechanism && (principal == NULL)) {
    837                 /*
    838                  * It is WRONG to depend on the principal sent in the negprot
    839                  * reply, but right now we do it. So for safety (don't
    840                  * segfault later) disable Kerberos when no principal was
    841                  * sent. -- VL
    842                  */
    843                 DEBUG(1, ("Kerberos mech was offered, but no principal was "
    844                           "sent, disabling Kerberos\n"));
    845                 cli->use_kerberos = False;
    846         }
    847841
    848842        fstrcpy(cli->user_name, user);
     
    897891                        }
    898892
    899                         realm = kerberos_get_default_realm_from_ccache();
     893                        if (dest_realm) {
     894                                realm = SMB_STRDUP(dest_realm);
     895                                strupper_m(realm);
     896                        } else {
     897                                realm = kerberos_get_default_realm_from_ccache();
     898                        }
    900899                        if (realm && *realm) {
    901900                                if (asprintf(&principal, "%s$@%s",
     
    914913
    915914                if (principal) {
    916                         rc = cli_session_setup_kerberos(cli, principal, domain);
     915                        rc = cli_session_setup_kerberos(cli, principal,
     916                                dest_realm);
    917917                        if (ADS_ERR_OK(rc) || !cli->fallback_after_kerberos) {
    918918                                SAFE_FREE(principal);
     
    927927ntlmssp:
    928928
    929         return ADS_ERROR_NT(cli_session_setup_ntlmssp(cli, user, pass, domain));
     929        return ADS_ERROR_NT(cli_session_setup_ntlmssp(cli, user, pass,
     930                user_domain));
    930931}
    931932
     
    10101011
    10111012        if (cli->capabilities & CAP_EXTENDED_SECURITY) {
    1012                 ADS_STATUS status = cli_session_setup_spnego(cli, user, pass, workgroup);
     1013                ADS_STATUS status = cli_session_setup_spnego(cli, user, pass,
     1014                                                             workgroup, NULL);
    10131015                if (!ADS_ERR_OK(status)) {
    10141016                        DEBUG(3, ("SPNEGO login failed: %s\n", ads_errstr(status)));
     
    13291331                        SAFE_FREE(cli->outbuf);
    13301332                        SAFE_FREE(cli->inbuf);
    1331                         cli->outbuf = (char *)SMB_MALLOC(CLI_SAMBA_MAX_LARGE_READX_SIZE+SAFETY_MARGIN);
    1332                         cli->inbuf = (char *)SMB_MALLOC(CLI_SAMBA_MAX_LARGE_READX_SIZE+SAFETY_MARGIN);
    1333                         cli->bufsize = CLI_SAMBA_MAX_LARGE_READX_SIZE;
     1333                        cli->outbuf = (char *)SMB_MALLOC(CLI_SAMBA_MAX_LARGE_READX_SIZE+LARGE_WRITEX_HDR_SIZE+SAFETY_MARGIN);
     1334                        cli->inbuf = (char *)SMB_MALLOC(CLI_SAMBA_MAX_LARGE_READX_SIZE+LARGE_WRITEX_HDR_SIZE+SAFETY_MARGIN);
     1335                        cli->bufsize = CLI_SAMBA_MAX_LARGE_READX_SIZE + LARGE_WRITEX_HDR_SIZE;
    13341336                }
    13351337
Note: See TracChangeset for help on using the changeset viewer.