Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/kdc/kdc.c

    r740 r988  
    3333#include "param/param.h"
    3434#include "kdc/kdc-glue.h"
     35#include "kdc/pac-glue.h"
    3536#include "dsdb/samdb/samdb.h"
    3637#include "auth/session.h"
     38#include "libds/common/roles.h"
     39
     40NTSTATUS server_service_kdc_init(void);
    3741
    3842extern struct krb5plugin_windc_ftable windc_plugin_table;
    39 extern struct hdb_method hdb_samba4;
    4043
    4144static NTSTATUS kdc_proxy_unavailable_error(struct kdc_server *kdc,
     
    616619        struct kdc_udp_call *call = tevent_req_callback_data(subreq,
    617620                                       struct kdc_udp_call);
    618         ssize_t ret;
    619621        int sys_errno;
    620622
    621         ret = tdgram_sendto_queue_recv(subreq, &sys_errno);
     623        tdgram_sendto_queue_recv(subreq, &sys_errno);
    622624
    623625        /* We don't care about errors */
     
    653655                                                &kdc_socket->local_address);
    654656        if (ret != 0) {
    655                 status = map_nt_error_from_unix(errno);
     657                status = map_nt_error_from_unix_common(errno);
    656658                return status;
    657659        }
     
    684686                                     &kdc_udp_socket->dgram);
    685687        if (ret != 0) {
    686                 status = map_nt_error_from_unix(errno);
     688                status = map_nt_error_from_unix_common(errno);
    687689                DEBUG(0,("Failed to bind to %s:%u UDP - %s\n",
    688690                         address, port, nt_errstr(status)));
     
    728730        }
    729731
    730         num_interfaces = iface_count(ifaces);
     732        num_interfaces = iface_list_count(ifaces);
    731733
    732734        /* if we are allowing incoming packets from any address, then
    733735           we need to bind to the wildcard address */
    734736        if (!lpcfg_bind_interfaces_only(lp_ctx)) {
    735                 if (kdc_port) {
    736                         status = kdc_add_socket(kdc, model_ops,
    737                                                 "kdc", "0.0.0.0", kdc_port,
    738                                                 kdc_process, false);
    739                         NT_STATUS_NOT_OK_RETURN(status);
    740                 }
    741 
    742                 if (kpasswd_port) {
    743                         status = kdc_add_socket(kdc, model_ops,
    744                                                 "kpasswd", "0.0.0.0", kpasswd_port,
    745                                                 kpasswdd_process, false);
    746                         NT_STATUS_NOT_OK_RETURN(status);
     737                int num_binds = 0;
     738                char **wcard = iface_list_wildcard(kdc);
     739                NT_STATUS_HAVE_NO_MEMORY(wcard);
     740                for (i=0; wcard[i]; i++) {
     741                        if (kdc_port) {
     742                                status = kdc_add_socket(kdc, model_ops,
     743                                                        "kdc", wcard[i], kdc_port,
     744                                                        kdc_process, false);
     745                                if (NT_STATUS_IS_OK(status)) {
     746                                        num_binds++;
     747                                }
     748                        }
     749
     750                        if (kpasswd_port) {
     751                                status = kdc_add_socket(kdc, model_ops,
     752                                                        "kpasswd", wcard[i], kpasswd_port,
     753                                                        kpasswdd_process, false);
     754                                if (NT_STATUS_IS_OK(status)) {
     755                                        num_binds++;
     756                                }
     757                        }
     758                }
     759                talloc_free(wcard);
     760                if (num_binds == 0) {
     761                        return NT_STATUS_INVALID_PARAMETER_MIX;
    747762                }
    748763                done_wildcard = true;
     
    750765
    751766        for (i=0; i<num_interfaces; i++) {
    752                 const char *address = talloc_strdup(tmp_ctx, iface_n_ip(ifaces, i));
     767                const char *address = talloc_strdup(tmp_ctx, iface_list_n_ip(ifaces, i));
    753768
    754769                if (kdc_port) {
     
    772787}
    773788
    774 
    775789static NTSTATUS kdc_check_generic_kerberos(struct irpc_message *msg,
    776790                                 struct kdc_check_generic_kerberos *r)
     
    781795        struct kdc_server *kdc = talloc_get_type(msg->private_data, struct kdc_server);
    782796        enum ndr_err_code ndr_err;
    783         krb5_enctype etype;
    784797        int ret;
    785798        hdb_entry_ex ent;
    786799        krb5_principal principal;
    787         krb5_keyblock keyblock;
    788         Key *key;
    789800
    790801        /* There is no reply to this request */
     
    797808        }
    798809
    799         if (pac_validate.MessageType != 3) {
     810        if (pac_validate.MessageType != NETLOGON_GENERIC_KRB5_PAC_VALIDATE) {
    800811                /* We don't implement any other message types - such as certificate validation - yet */
    801812                return NT_STATUS_INVALID_PARAMETER;
     
    810821        srv_sig = data_blob_const(pac_validate.ChecksumAndSignature.data,
    811822                                  pac_validate.ChecksumLength);
    812 
    813         if (pac_validate.SignatureType == CKSUMTYPE_HMAC_MD5) {
    814                 etype = ETYPE_ARCFOUR_HMAC_MD5;
    815         } else {
    816                 ret = krb5_cksumtype_to_enctype(kdc->smb_krb5_context->krb5_context, pac_validate.SignatureType,
    817                                                 &etype);
    818                 if (ret != 0) {
    819                         return NT_STATUS_LOGON_FAILURE;
    820                 }
    821         }
    822823
    823824        ret = krb5_make_principal(kdc->smb_krb5_context->krb5_context, &principal,
     
    844845        }
    845846
    846         ret = hdb_enctype2key(kdc->smb_krb5_context->krb5_context, &ent.entry, etype, &key);
    847 
    848         if (ret != 0) {
    849                 hdb_free_entry(kdc->smb_krb5_context->krb5_context, &ent);
    850                 krb5_free_principal(kdc->smb_krb5_context->krb5_context, principal);
    851                 return NT_STATUS_LOGON_FAILURE;
    852         }
    853 
    854         keyblock = key->key;
    855 
    856847        kdc_sig.type = pac_validate.SignatureType;
    857848        kdc_sig.signature = data_blob_const(&pac_validate.ChecksumAndSignature.data[pac_validate.ChecksumLength],
    858849                                            pac_validate.SignatureLength);
    859         ret = check_pac_checksum(msg, srv_sig, &kdc_sig,
    860                            kdc->smb_krb5_context->krb5_context, &keyblock);
     850
     851        ret = kdc_check_pac(kdc->smb_krb5_context->krb5_context, srv_sig, &kdc_sig, &ent);
    861852
    862853        hdb_free_entry(kdc->smb_krb5_context->krb5_context, &ent);
     
    889880                task_server_terminate(task, "kdc: no KDC required in member server configuration", false);
    890881                return;
    891         case ROLE_DOMAIN_CONTROLLER:
     882        case ROLE_DOMAIN_PDC:
     883        case ROLE_DOMAIN_BDC:
     884                task_server_terminate(task, "Cannot start KDC as a 'classic Samba' DC", true);
     885                return;
     886        case ROLE_ACTIVE_DIRECTORY_DC:
    892887                /* Yes, we want a KDC */
    893888                break;
    894889        }
    895890
    896         load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
    897 
    898         if (iface_count(ifaces) == 0) {
     891        load_interface_list(task, task->lp_ctx, &ifaces);
     892
     893        if (iface_list_count(ifaces) == 0) {
    899894                task_server_terminate(task, "kdc: no network interfaces configured", false);
    900895                return;
     
    933928        initialize_krb5_error_table();
    934929
    935         ret = smb_krb5_init_context(kdc, task->event_ctx, task->lp_ctx, &kdc->smb_krb5_context);
     930        ret = smb_krb5_init_context(kdc, task->lp_ctx, &kdc->smb_krb5_context);
    936931        if (ret) {
    937932                DEBUG(1,("kdc_task_init: krb5_init_context failed (%s)\n",
     
    950945        }
    951946
    952         kdc->config->logf = kdc->smb_krb5_context->logf;
     947        kdc->config->logf = (krb5_log_facility *)kdc->smb_krb5_context->pvt_log_data;
    953948        kdc->config->db = talloc(kdc, struct HDB *);
    954949        if (!kdc->config->db) {
     
    957952        }
    958953        kdc->config->num_db = 1;
     954
     955        /*
     956         * This restores the behavior before
     957         * commit 255e3e18e00f717d99f3bc57c8a8895ff624f3c3
     958         * s4:heimdal: import lorikeet-heimdal-201107150856
     959         * (commit 48936803fae4a2fb362c79365d31f420c917b85b)
     960         *
     961         * as_use_strongest_session_key,preauth_use_strongest_session_key
     962         * and tgs_use_strongest_session_key are input to the
     963         * _kdc_find_etype() function. The old bahavior is in
     964         * the use_strongest_session_key=FALSE code path.
     965         * (The only remaining difference in _kdc_find_etype()
     966         *  is the is_preauth parameter.)
     967         *
     968         * The old behavior in the _kdc_get_preferred_key()
     969         * function is use_strongest_server_key=TRUE.
     970         */
     971        kdc->config->as_use_strongest_session_key = false;
     972        kdc->config->preauth_use_strongest_session_key = false;
     973        kdc->config->tgs_use_strongest_session_key = false;
     974        kdc->config->use_strongest_server_key = true;
    959975
    960976        /* Register hdb-samba4 hooks for use as a keytab */
     
    979995        ret = krb5_plugin_register(kdc->smb_krb5_context->krb5_context,
    980996                                   PLUGIN_TYPE_DATA, "hdb",
    981                                    &hdb_samba4);
     997                                   &hdb_samba4_interface);
    982998        if(ret) {
    983999                task_server_terminate(task, "kdc: failed to register hdb plugin", true);
Note: See TracChangeset for help on using the changeset viewer.