s4-kdc: Give information on how long the password history is
[Samba/gbeck.git] / source4 / kdc / kpasswdd.c
blobc05ea82318b25832b56f42f6d202d38310a01457
1 /*
2 Unix SMB/CIFS implementation.
4 kpasswd Server implementation
6 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005
7 Copyright (C) Andrew Tridgell 2005
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "includes.h"
24 #include "smbd/service_task.h"
25 #include "auth/gensec/gensec.h"
26 #include "auth/credentials/credentials.h"
27 #include "auth/auth.h"
28 #include "dsdb/samdb/samdb.h"
29 #include "../lib/util/util_ldb.h"
30 #include "libcli/security/security.h"
31 #include "param/param.h"
32 #include "kdc/kdc-glue.h"
33 #include "dsdb/common/util.h"
35 /* Return true if there is a valid error packet formed in the error_blob */
36 static bool kpasswdd_make_error_reply(struct kdc_server *kdc,
37 TALLOC_CTX *mem_ctx,
38 uint16_t result_code,
39 const char *error_string,
40 DATA_BLOB *error_blob)
42 char *error_string_utf8;
43 size_t len;
45 DEBUG(result_code ? 3 : 10, ("kpasswdd: %s\n", error_string));
47 if (!push_utf8_talloc(mem_ctx, &error_string_utf8, error_string, &len)) {
48 return false;
51 *error_blob = data_blob_talloc(mem_ctx, NULL, 2 + len + 1);
52 if (!error_blob->data) {
53 return false;
55 RSSVAL(error_blob->data, 0, result_code);
56 memcpy(error_blob->data + 2, error_string_utf8, len + 1);
57 return true;
60 /* Return true if there is a valid error packet formed in the error_blob */
61 static bool kpasswdd_make_unauth_error_reply(struct kdc_server *kdc,
62 TALLOC_CTX *mem_ctx,
63 uint16_t result_code,
64 const char *error_string,
65 DATA_BLOB *error_blob)
67 bool ret;
68 int kret;
69 DATA_BLOB error_bytes;
70 krb5_data k5_error_bytes, k5_error_blob;
71 ret = kpasswdd_make_error_reply(kdc, mem_ctx, result_code, error_string,
72 &error_bytes);
73 if (!ret) {
74 return false;
76 k5_error_bytes.data = error_bytes.data;
77 k5_error_bytes.length = error_bytes.length;
78 kret = krb5_mk_error(kdc->smb_krb5_context->krb5_context,
79 result_code, NULL, &k5_error_bytes,
80 NULL, NULL, NULL, NULL, &k5_error_blob);
81 if (kret) {
82 return false;
84 *error_blob = data_blob_talloc(mem_ctx, k5_error_blob.data, k5_error_blob.length);
85 krb5_data_free(&k5_error_blob);
86 if (!error_blob->data) {
87 return false;
89 return true;
92 static bool kpasswd_make_pwchange_reply(struct kdc_server *kdc,
93 TALLOC_CTX *mem_ctx,
94 NTSTATUS status,
95 enum samPwdChangeReason reject_reason,
96 struct samr_DomInfo1 *dominfo,
97 DATA_BLOB *error_blob)
99 if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
100 return kpasswdd_make_error_reply(kdc, mem_ctx,
101 KRB5_KPASSWD_ACCESSDENIED,
102 "No such user when changing password",
103 error_blob);
105 if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
106 return kpasswdd_make_error_reply(kdc, mem_ctx,
107 KRB5_KPASSWD_ACCESSDENIED,
108 "Not permitted to change password",
109 error_blob);
111 if (dominfo && NT_STATUS_EQUAL(status, NT_STATUS_PASSWORD_RESTRICTION)) {
112 const char *reject_string;
113 switch (reject_reason) {
114 case SAM_PWD_CHANGE_PASSWORD_TOO_SHORT:
115 reject_string = talloc_asprintf(mem_ctx, "Password too short, password must be at least %d characters long",
116 dominfo->min_password_length);
117 break;
118 case SAM_PWD_CHANGE_NOT_COMPLEX:
119 reject_string = "Password does not meet complexity requirements";
120 break;
121 case SAM_PWD_CHANGE_PWD_IN_HISTORY:
122 reject_string = talloc_asprintf(mem_ctx, "Password is already in password history, cannot match any of your %d passwords",
123 dominfo->password_history_length);
124 break;
125 default:
126 reject_string = talloc_asprintf(mem_ctx, "Password must be at least %d characters long, and cannot match any of your %d previous passwords",
127 dominfo->min_password_length, dominfo->password_history_length);
128 break;
130 return kpasswdd_make_error_reply(kdc, mem_ctx,
131 KRB5_KPASSWD_SOFTERROR,
132 reject_string,
133 error_blob);
135 if (!NT_STATUS_IS_OK(status)) {
136 return kpasswdd_make_error_reply(kdc, mem_ctx,
137 KRB5_KPASSWD_HARDERROR,
138 talloc_asprintf(mem_ctx, "failed to set password: %s", nt_errstr(status)),
139 error_blob);
142 return kpasswdd_make_error_reply(kdc, mem_ctx, KRB5_KPASSWD_SUCCESS,
143 "Password changed",
144 error_blob);
148 A user password change
150 Return true if there is a valid error packet (or success) formed in
151 the error_blob
153 static bool kpasswdd_change_password(struct kdc_server *kdc,
154 TALLOC_CTX *mem_ctx,
155 struct auth_session_info *session_info,
156 const DATA_BLOB *password,
157 DATA_BLOB *reply)
159 NTSTATUS status;
160 enum samPwdChangeReason reject_reason;
161 struct samr_DomInfo1 *dominfo;
162 struct samr_Password *oldLmHash, *oldNtHash;
163 struct ldb_context *samdb;
164 const char * const attrs[] = { "dBCSPwd", "unicodePwd", NULL };
165 struct ldb_message *msg;
166 int ret;
168 /* Fetch the old hashes to get the old password in order to perform
169 * the password change operation. Naturally it would be much better to
170 * have a password hash from an authentication around but this doesn't
171 * seem to be the case here. */
172 ret = dsdb_search_one(kdc->samdb, mem_ctx, &msg, ldb_get_default_basedn(kdc->samdb),
173 LDB_SCOPE_SUBTREE,
174 attrs,
175 DSDB_SEARCH_NO_GLOBAL_CATALOG,
176 "(&(objectClass=user)(sAMAccountName=%s))",
177 session_info->info->account_name);
178 if (ret != LDB_SUCCESS) {
179 return kpasswdd_make_error_reply(kdc, mem_ctx,
180 KRB5_KPASSWD_ACCESSDENIED,
181 "No such user when changing password",
182 reply);
185 status = samdb_result_passwords(mem_ctx, kdc->task->lp_ctx, msg,
186 &oldLmHash, &oldNtHash);
187 if (!NT_STATUS_IS_OK(status)) {
188 return kpasswdd_make_error_reply(kdc, mem_ctx,
189 KRB5_KPASSWD_ACCESSDENIED,
190 "Not permitted to change password",
191 reply);
194 /* Start a SAM with user privileges for the password change */
195 samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, kdc->task->lp_ctx,
196 session_info, 0);
197 if (!samdb) {
198 return kpasswdd_make_error_reply(kdc, mem_ctx,
199 KRB5_KPASSWD_HARDERROR,
200 "Failed to open samdb",
201 reply);
204 DEBUG(3, ("Changing password of %s\\%s (%s)\n",
205 session_info->info->domain_name,
206 session_info->info->account_name,
207 dom_sid_string(mem_ctx, &session_info->security_token->sids[PRIMARY_USER_SID_INDEX])));
209 /* Performs the password change */
210 status = samdb_set_password_sid(samdb, mem_ctx,
211 &session_info->security_token->sids[PRIMARY_USER_SID_INDEX],
212 password, NULL, NULL,
213 oldLmHash, oldNtHash, /* this is a user password change */
214 &reject_reason,
215 &dominfo);
216 return kpasswd_make_pwchange_reply(kdc, mem_ctx,
217 status,
218 reject_reason,
219 dominfo,
220 reply);
224 static bool kpasswd_process_request(struct kdc_server *kdc,
225 TALLOC_CTX *mem_ctx,
226 struct gensec_security *gensec_security,
227 uint16_t version,
228 DATA_BLOB *input,
229 DATA_BLOB *reply)
231 struct auth_session_info *session_info;
232 size_t pw_len;
234 if (!NT_STATUS_IS_OK(gensec_session_info(gensec_security,
235 mem_ctx,
236 &session_info))) {
237 return kpasswdd_make_error_reply(kdc, mem_ctx,
238 KRB5_KPASSWD_HARDERROR,
239 "gensec_session_info failed!",
240 reply);
243 switch (version) {
244 case KRB5_KPASSWD_VERS_CHANGEPW:
246 DATA_BLOB password;
247 if (!convert_string_talloc_handle(mem_ctx, lpcfg_iconv_handle(kdc->task->lp_ctx),
248 CH_UTF8, CH_UTF16,
249 (const char *)input->data,
250 input->length,
251 (void **)&password.data, &pw_len)) {
252 return false;
254 password.length = pw_len;
256 return kpasswdd_change_password(kdc, mem_ctx, session_info,
257 &password, reply);
259 case KRB5_KPASSWD_VERS_SETPW:
261 NTSTATUS status;
262 enum samPwdChangeReason reject_reason = SAM_PWD_CHANGE_NO_ERROR;
263 struct samr_DomInfo1 *dominfo = NULL;
264 struct ldb_context *samdb;
265 krb5_context context = kdc->smb_krb5_context->krb5_context;
267 ChangePasswdDataMS chpw;
268 DATA_BLOB password;
270 krb5_principal principal;
271 char *set_password_on_princ;
272 struct ldb_dn *set_password_on_dn;
273 bool service_principal_name = false;
275 size_t len;
276 int ret;
278 ret = decode_ChangePasswdDataMS(input->data, input->length,
279 &chpw, &len);
280 if (ret) {
281 return kpasswdd_make_error_reply(kdc, mem_ctx,
282 KRB5_KPASSWD_MALFORMED,
283 "failed to decode password change structure",
284 reply);
287 if (!convert_string_talloc_handle(mem_ctx, lpcfg_iconv_handle(kdc->task->lp_ctx),
288 CH_UTF8, CH_UTF16,
289 (const char *)chpw.newpasswd.data,
290 chpw.newpasswd.length,
291 (void **)&password.data, &pw_len)) {
292 free_ChangePasswdDataMS(&chpw);
293 return false;
296 password.length = pw_len;
298 if ((chpw.targname && !chpw.targrealm)
299 || (!chpw.targname && chpw.targrealm)) {
300 free_ChangePasswdDataMS(&chpw);
301 return kpasswdd_make_error_reply(kdc, mem_ctx,
302 KRB5_KPASSWD_MALFORMED,
303 "Realm and principal must be both present, or neither present",
304 reply);
306 if (chpw.targname && chpw.targrealm) {
307 ret = krb5_build_principal_ext(kdc->smb_krb5_context->krb5_context,
308 &principal,
309 strlen(*chpw.targrealm),
310 *chpw.targrealm, 0);
311 if (ret) {
312 free_ChangePasswdDataMS(&chpw);
313 return kpasswdd_make_error_reply(kdc, mem_ctx,
314 KRB5_KPASSWD_MALFORMED,
315 "failed to get principal",
316 reply);
318 if (copy_PrincipalName(chpw.targname, &principal->name)) {
319 free_ChangePasswdDataMS(&chpw);
320 krb5_free_principal(context, principal);
321 return kpasswdd_make_error_reply(kdc, mem_ctx,
322 KRB5_KPASSWD_MALFORMED,
323 "failed to extract principal to set",
324 reply);
326 } else {
327 free_ChangePasswdDataMS(&chpw);
328 return kpasswdd_change_password(kdc, mem_ctx, session_info,
329 &password, reply);
331 free_ChangePasswdDataMS(&chpw);
333 if (principal->name.name_string.len >= 2) {
334 service_principal_name = true;
336 /* We use this, rather than 'no realm' flag,
337 * as we don't want to accept a password
338 * change on a principal from another realm */
340 if (krb5_unparse_name_short(context, principal, &set_password_on_princ) != 0) {
341 krb5_free_principal(context, principal);
342 return kpasswdd_make_error_reply(kdc, mem_ctx,
343 KRB5_KPASSWD_MALFORMED,
344 "krb5_unparse_name failed!",
345 reply);
347 } else {
348 if (krb5_unparse_name(context, principal, &set_password_on_princ) != 0) {
349 krb5_free_principal(context, principal);
350 return kpasswdd_make_error_reply(kdc, mem_ctx,
351 KRB5_KPASSWD_MALFORMED,
352 "krb5_unparse_name failed!",
353 reply);
356 krb5_free_principal(context, principal);
358 samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, kdc->task->lp_ctx, session_info, 0);
359 if (!samdb) {
360 free(set_password_on_princ);
361 return kpasswdd_make_error_reply(kdc, mem_ctx,
362 KRB5_KPASSWD_HARDERROR,
363 "Unable to open database!",
364 reply);
367 DEBUG(3, ("%s\\%s (%s) is changing password of %s\n",
368 session_info->info->domain_name,
369 session_info->info->account_name,
370 dom_sid_string(mem_ctx, &session_info->security_token->sids[PRIMARY_USER_SID_INDEX]),
371 set_password_on_princ));
372 ret = ldb_transaction_start(samdb);
373 if (ret != LDB_SUCCESS) {
374 free(set_password_on_princ);
375 status = NT_STATUS_TRANSACTION_ABORTED;
376 return kpasswd_make_pwchange_reply(kdc, mem_ctx,
377 status,
378 SAM_PWD_CHANGE_NO_ERROR,
379 NULL,
380 reply);
383 if (service_principal_name) {
384 status = crack_service_principal_name(samdb, mem_ctx,
385 set_password_on_princ,
386 &set_password_on_dn, NULL);
387 } else {
388 status = crack_user_principal_name(samdb, mem_ctx,
389 set_password_on_princ,
390 &set_password_on_dn, NULL);
392 free(set_password_on_princ);
393 if (!NT_STATUS_IS_OK(status)) {
394 ldb_transaction_cancel(samdb);
395 return kpasswd_make_pwchange_reply(kdc, mem_ctx,
396 status,
397 SAM_PWD_CHANGE_NO_ERROR,
398 NULL,
399 reply);
402 if (NT_STATUS_IS_OK(status)) {
403 /* Admin password set */
404 status = samdb_set_password(samdb, mem_ctx,
405 set_password_on_dn, NULL,
406 &password, NULL, NULL,
407 NULL, NULL, /* this is not a user password change */
408 &reject_reason, &dominfo);
411 if (NT_STATUS_IS_OK(status)) {
412 ret = ldb_transaction_commit(samdb);
413 if (ret != LDB_SUCCESS) {
414 DEBUG(1,("Failed to commit transaction to set password on %s: %s\n",
415 ldb_dn_get_linearized(set_password_on_dn),
416 ldb_errstring(samdb)));
417 status = NT_STATUS_TRANSACTION_ABORTED;
419 } else {
420 ldb_transaction_cancel(samdb);
422 return kpasswd_make_pwchange_reply(kdc, mem_ctx,
423 status,
424 reject_reason,
425 dominfo,
426 reply);
428 default:
429 return kpasswdd_make_error_reply(kdc, mem_ctx,
430 KRB5_KPASSWD_BAD_VERSION,
431 talloc_asprintf(mem_ctx,
432 "Protocol version %u not supported",
433 version),
434 reply);
438 enum kdc_process_ret kpasswdd_process(struct kdc_server *kdc,
439 TALLOC_CTX *mem_ctx,
440 DATA_BLOB *input,
441 DATA_BLOB *reply,
442 struct tsocket_address *peer_addr,
443 struct tsocket_address *my_addr,
444 int datagram_reply)
446 bool ret;
447 const uint16_t header_len = 6;
448 uint16_t len;
449 uint16_t ap_req_len;
450 uint16_t krb_priv_len;
451 uint16_t version;
452 NTSTATUS nt_status;
453 DATA_BLOB ap_req, krb_priv_req;
454 DATA_BLOB krb_priv_rep = data_blob(NULL, 0);
455 DATA_BLOB ap_rep = data_blob(NULL, 0);
456 DATA_BLOB kpasswd_req, kpasswd_rep;
457 struct cli_credentials *server_credentials;
458 struct gensec_security *gensec_security;
459 TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
461 char *keytab_name;
463 if (!tmp_ctx) {
464 return KDC_PROCESS_FAILED;
467 if (kdc->am_rodc) {
468 talloc_free(tmp_ctx);
469 return KDC_PROCESS_PROXY;
472 /* Be parinoid. We need to ensure we don't just let the
473 * caller lead us into a buffer overflow */
474 if (input->length <= header_len) {
475 talloc_free(tmp_ctx);
476 return KDC_PROCESS_FAILED;
479 len = RSVAL(input->data, 0);
480 if (input->length != len) {
481 talloc_free(tmp_ctx);
482 return KDC_PROCESS_FAILED;
485 /* There are two different versions of this protocol so far,
486 * plus others in the standards pipe. Fortunetly they all
487 * take a very similar framing */
488 version = RSVAL(input->data, 2);
489 ap_req_len = RSVAL(input->data, 4);
490 if ((ap_req_len >= len) || (ap_req_len + header_len) >= len) {
491 talloc_free(tmp_ctx);
492 return KDC_PROCESS_FAILED;
495 krb_priv_len = len - ap_req_len;
496 ap_req = data_blob_const(&input->data[header_len], ap_req_len);
497 krb_priv_req = data_blob_const(&input->data[header_len + ap_req_len], krb_priv_len);
499 server_credentials = cli_credentials_init(tmp_ctx);
500 if (!server_credentials) {
501 DEBUG(1, ("Failed to init server credentials\n"));
502 talloc_free(tmp_ctx);
503 return KDC_PROCESS_FAILED;
506 /* We want the credentials subsystem to use the krb5 context
507 * we already have, rather than a new context */
508 cli_credentials_set_krb5_context(server_credentials, kdc->smb_krb5_context);
509 cli_credentials_set_conf(server_credentials, kdc->task->lp_ctx);
511 keytab_name = talloc_asprintf(server_credentials, "HDB:samba4&%p", kdc->base_ctx);
513 cli_credentials_set_username(server_credentials, "kadmin/changepw", CRED_SPECIFIED);
514 ret = cli_credentials_set_keytab_name(server_credentials, kdc->task->lp_ctx, keytab_name, CRED_SPECIFIED);
515 if (ret != 0) {
516 ret = kpasswdd_make_unauth_error_reply(kdc, mem_ctx,
517 KRB5_KPASSWD_HARDERROR,
518 talloc_asprintf(mem_ctx,
519 "Failed to obtain server credentials for kadmin/changepw!"),
520 &krb_priv_rep);
521 ap_rep.length = 0;
522 if (ret) {
523 goto reply;
525 talloc_free(tmp_ctx);
526 return ret;
529 /* We don't strictly need to call this wrapper, and could call
530 * gensec_server_start directly, as we have no need for NTLM
531 * and we have a PAC, but this ensures that the wrapper can be
532 * safely extended for other helpful things in future */
533 nt_status = samba_server_gensec_start(tmp_ctx, kdc->task->event_ctx,
534 kdc->task->msg_ctx,
535 kdc->task->lp_ctx,
536 server_credentials,
537 "kpasswd",
538 &gensec_security);
539 if (!NT_STATUS_IS_OK(nt_status)) {
540 talloc_free(tmp_ctx);
541 return KDC_PROCESS_FAILED;
544 /* The kerberos PRIV packets include these addresses. MIT
545 * clients check that they are present */
546 #if 0
547 /* Skip this part for now, it breaks with a NetAPP filer and
548 * in any case where the client address is behind NAT. If
549 * older MIT clients need this, we might have to insert more
550 * complex code */
552 nt_status = gensec_set_local_address(gensec_security, peer_addr);
553 if (!NT_STATUS_IS_OK(nt_status)) {
554 talloc_free(tmp_ctx);
555 return KDC_PROCESS_FAILED;
557 #endif
559 nt_status = gensec_set_local_address(gensec_security, my_addr);
560 if (!NT_STATUS_IS_OK(nt_status)) {
561 talloc_free(tmp_ctx);
562 return KDC_PROCESS_FAILED;
565 /* We want the GENSEC wrap calls to generate PRIV tokens */
566 gensec_want_feature(gensec_security, GENSEC_FEATURE_SEAL);
568 nt_status = gensec_start_mech_by_name(gensec_security, "krb5");
569 if (!NT_STATUS_IS_OK(nt_status)) {
570 talloc_free(tmp_ctx);
571 return KDC_PROCESS_FAILED;
574 /* Accept the AP-REQ and generate teh AP-REP we need for the reply */
575 nt_status = gensec_update(gensec_security, tmp_ctx, kdc->task->event_ctx, ap_req, &ap_rep);
576 if (!NT_STATUS_IS_OK(nt_status) && !NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
578 ret = kpasswdd_make_unauth_error_reply(kdc, mem_ctx,
579 KRB5_KPASSWD_HARDERROR,
580 talloc_asprintf(mem_ctx,
581 "gensec_update failed: %s",
582 nt_errstr(nt_status)),
583 &krb_priv_rep);
584 ap_rep.length = 0;
585 if (ret) {
586 goto reply;
588 talloc_free(tmp_ctx);
589 return KDC_PROCESS_FAILED;
592 /* Extract the data from the KRB-PRIV half of the message */
593 nt_status = gensec_unwrap(gensec_security, tmp_ctx, &krb_priv_req, &kpasswd_req);
594 if (!NT_STATUS_IS_OK(nt_status)) {
595 ret = kpasswdd_make_unauth_error_reply(kdc, mem_ctx,
596 KRB5_KPASSWD_HARDERROR,
597 talloc_asprintf(mem_ctx,
598 "gensec_unwrap failed: %s",
599 nt_errstr(nt_status)),
600 &krb_priv_rep);
601 ap_rep.length = 0;
602 if (ret) {
603 goto reply;
605 talloc_free(tmp_ctx);
606 return KDC_PROCESS_FAILED;
609 /* Figure out something to do with it (probably changing a password...) */
610 ret = kpasswd_process_request(kdc, tmp_ctx,
611 gensec_security,
612 version,
613 &kpasswd_req, &kpasswd_rep);
614 if (!ret) {
615 /* Argh! */
616 talloc_free(tmp_ctx);
617 return KDC_PROCESS_FAILED;
620 /* And wrap up the reply: This ensures that the error message
621 * or success can be verified by the client */
622 nt_status = gensec_wrap(gensec_security, tmp_ctx,
623 &kpasswd_rep, &krb_priv_rep);
624 if (!NT_STATUS_IS_OK(nt_status)) {
625 ret = kpasswdd_make_unauth_error_reply(kdc, mem_ctx,
626 KRB5_KPASSWD_HARDERROR,
627 talloc_asprintf(mem_ctx,
628 "gensec_wrap failed: %s",
629 nt_errstr(nt_status)),
630 &krb_priv_rep);
631 ap_rep.length = 0;
632 if (ret) {
633 goto reply;
635 talloc_free(tmp_ctx);
636 return KDC_PROCESS_FAILED;
639 reply:
640 *reply = data_blob_talloc(mem_ctx, NULL, krb_priv_rep.length + ap_rep.length + header_len);
641 if (!reply->data) {
642 talloc_free(tmp_ctx);
643 return KDC_PROCESS_FAILED;
646 RSSVAL(reply->data, 0, reply->length);
647 RSSVAL(reply->data, 2, 1); /* This is a version 1 reply, MS change/set or otherwise */
648 RSSVAL(reply->data, 4, ap_rep.length);
649 memcpy(reply->data + header_len,
650 ap_rep.data,
651 ap_rep.length);
652 memcpy(reply->data + header_len + ap_rep.length,
653 krb_priv_rep.data,
654 krb_priv_rep.length);
656 talloc_free(tmp_ctx);
657 return KDC_PROCESS_OK;