Changeset 745 for trunk/server/source4/auth/gensec/schannel.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source4/auth/gensec/schannel.c
r414 r745 28 28 #include "auth/gensec/gensec_proto.h" 29 29 #include "../libcli/auth/schannel.h" 30 #include "auth/gensec/schannel_state.h"31 30 #include "librpc/rpc/dcerpc.h" 32 31 #include "param/param.h" 33 #include "auth/session_proto.h"34 32 35 33 static size_t schannel_sig_size(struct gensec_security *gensec_security, size_t data_size) 36 34 { 37 return 32; 35 struct schannel_state *state = (struct schannel_state *)gensec_security->private_data; 36 uint32_t sig_size; 37 38 sig_size = netsec_outgoing_sig_size(state); 39 40 return sig_size; 38 41 } 39 42 … … 53 56 struct NL_AUTH_MESSAGE bind_schannel_ack; 54 57 struct netlogon_creds_CredentialState *creds; 55 struct ldb_context *schannel_ldb;56 58 const char *workstation; 57 59 const char *domain; 58 uint32_t required_flags;59 60 60 61 *out = data_blob(NULL, 0); … … 91 92 #endif 92 93 93 ndr_err = ndr_push_struct_blob(out, out_mem_ctx, 94 gensec_security->settings->iconv_convenience, &bind_schannel, 94 ndr_err = ndr_push_struct_blob(out, out_mem_ctx, &bind_schannel, 95 95 (ndr_push_flags_fn_t)ndr_push_NL_AUTH_MESSAGE); 96 96 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 106 106 case GENSEC_SERVER: 107 107 108 required_flags = NL_FLAG_OEM_NETBIOS_COMPUTER_NAME |109 NL_FLAG_OEM_NETBIOS_DOMAIN_NAME;110 111 108 if (state->state != SCHANNEL_STATE_START) { 112 109 /* no third leg on this protocol */ … … 115 112 116 113 /* parse the schannel startup blob */ 117 ndr_err = ndr_pull_struct_blob(&in, out_mem_ctx, 118 gensec_security->settings->iconv_convenience, 119 &bind_schannel, 114 ndr_err = ndr_pull_struct_blob(&in, out_mem_ctx, &bind_schannel, 120 115 (ndr_pull_flags_fn_t)ndr_pull_NL_AUTH_MESSAGE); 121 116 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 126 121 } 127 122 128 if (!(required_flags == (bind_schannel.Flags & required_flags))) { 129 return NT_STATUS_INVALID_PARAMETER; 130 } 131 132 workstation = bind_schannel.oem_netbios_computer.a; 133 domain = bind_schannel.oem_netbios_domain.a; 134 135 if (strcasecmp_m(domain, lp_workgroup(gensec_security->settings->lp_ctx)) != 0) { 136 DEBUG(3, ("Request for schannel to incorrect domain: %s != our domain %s\n", 137 domain, lp_workgroup(gensec_security->settings->lp_ctx))); 138 123 if (bind_schannel.Flags & NL_FLAG_OEM_NETBIOS_DOMAIN_NAME) { 124 domain = bind_schannel.oem_netbios_domain.a; 125 if (strcasecmp_m(domain, lpcfg_workgroup(gensec_security->settings->lp_ctx)) != 0) { 126 DEBUG(3, ("Request for schannel to incorrect domain: %s != our domain %s\n", 127 domain, lpcfg_workgroup(gensec_security->settings->lp_ctx))); 128 return NT_STATUS_LOGON_FAILURE; 129 } 130 } else if (bind_schannel.Flags & NL_FLAG_UTF8_DNS_DOMAIN_NAME) { 131 domain = bind_schannel.utf8_dns_domain.u; 132 if (strcasecmp_m(domain, lpcfg_dnsdomain(gensec_security->settings->lp_ctx)) != 0) { 133 DEBUG(3, ("Request for schannel to incorrect domain: %s != our domain %s\n", 134 domain, lpcfg_dnsdomain(gensec_security->settings->lp_ctx))); 135 return NT_STATUS_LOGON_FAILURE; 136 } 137 } else { 138 DEBUG(3, ("Request for schannel to without domain\n")); 139 139 return NT_STATUS_LOGON_FAILURE; 140 140 } 141 141 142 schannel_ldb = schannel_db_connect(out_mem_ctx, gensec_security->event_ctx, 143 gensec_security->settings->lp_ctx); 144 if (!schannel_ldb) { 145 return NT_STATUS_ACCESS_DENIED; 146 } 147 /* pull the session key for this client */ 148 status = schannel_fetch_session_key_ldb(schannel_ldb, 149 out_mem_ctx, workstation, &creds); 150 talloc_free(schannel_ldb); 142 if (bind_schannel.Flags & NL_FLAG_OEM_NETBIOS_COMPUTER_NAME) { 143 workstation = bind_schannel.oem_netbios_computer.a; 144 } else if (bind_schannel.Flags & NL_FLAG_UTF8_NETBIOS_COMPUTER_NAME) { 145 workstation = bind_schannel.utf8_netbios_computer.u; 146 } else { 147 DEBUG(3, ("Request for schannel to without netbios workstation\n")); 148 return NT_STATUS_LOGON_FAILURE; 149 } 150 151 status = schannel_get_creds_state(out_mem_ctx, 152 lpcfg_private_dir(gensec_security->settings->lp_ctx), 153 workstation, &creds); 151 154 if (!NT_STATUS_IS_OK(status)) { 152 155 DEBUG(3, ("Could not find session key for attempted schannel connection from %s: %s\n", … … 158 161 } 159 162 160 state->creds = talloc_ reference(state, creds);163 state->creds = talloc_steal(state, creds); 161 164 162 165 bind_schannel_ack.MessageType = NL_NEGOTIATE_RESPONSE; … … 167 170 * - gd */ 168 171 169 ndr_err = ndr_push_struct_blob(out, out_mem_ctx, 170 gensec_security->settings->iconv_convenience, &bind_schannel_ack, 172 ndr_err = ndr_push_struct_blob(out, out_mem_ctx, &bind_schannel_ack, 171 173 (ndr_push_flags_fn_t)ndr_push_NL_AUTH_MESSAGE); 172 174 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 215 217 { 216 218 struct schannel_state *state = talloc_get_type(gensec_security->private_data, struct schannel_state); 217 return auth_anonymous_session_info(state, gensec_security-> event_ctx, gensec_security->settings->lp_ctx, _session_info);219 return auth_anonymous_session_info(state, gensec_security->settings->lp_ctx, _session_info); 218 220 } 219 221
Note:
See TracChangeset
for help on using the changeset viewer.