|
Lines 651-657
cert_san_matches_upn_check (struct modul
Link Here
|
| 651 |
int rc; |
651 |
int rc; |
| 652 |
PRBool ret; |
652 |
PRBool ret; |
| 653 |
char **realms; |
653 |
char **realms; |
| 654 |
char ms_upn_host[1024]; |
654 |
char *ms_upn_host; |
| 655 |
int len; |
655 |
int len; |
| 656 |
|
656 |
|
| 657 |
/* And it matches, then we're okay. */ |
657 |
/* And it matches, then we're okay. */ |
|
Lines 683-705
cert_san_matches_upn_check (struct modul
Link Here
|
| 683 |
} |
683 |
} |
| 684 |
|
684 |
|
| 685 |
len = ms_upn_name->len - ms_upn_tmp.len; |
685 |
len = ms_upn_name->len - ms_upn_tmp.len; |
| 686 |
if (len > 1023) { |
686 |
ms_upn_host = malloc (len + 2); /* dot and nil */ |
| 687 |
len = 1023; |
687 |
if (!ms_upn_host) { |
|
|
688 |
pkinit_debug (mcontext, 2, |
| 689 |
"Could not alloc upn_host: length was %d.\n", |
| 690 |
len); |
| 691 |
return PR_FALSE; |
| 688 |
} |
692 |
} |
| 689 |
|
693 |
|
| 690 |
/* ms_upn_domain isn't NULL terminated, so we need to copy it |
694 |
/* ms_upn_domain isn't NULL terminated, so we need to copy it |
| 691 |
* out... */ |
695 |
* out... */ |
| 692 |
strncpy (ms_upn_host, (char *)ms_upn_domain, len); |
696 |
ms_upn_host[0] = '.'; |
| 693 |
ms_upn_host[len] = '\0'; |
697 |
strncpy (ms_upn_host + 1, (char *)ms_upn_domain, len); |
|
|
698 |
ms_upn_host[len + 1] = '\0'; |
| 694 |
rc = krb5_get_host_realm (kcontext, ms_upn_host, &realms); |
699 |
rc = krb5_get_host_realm (kcontext, ms_upn_host, &realms); |
|
|
700 |
free (ms_upn_host); |
| 701 |
ms_upn_host = NULL; |
| 695 |
if (rc != 0) { |
702 |
if (rc != 0) { |
| 696 |
pkinit_debug (mcontext, 2, |
703 |
pkinit_debug (mcontext, 2, |
| 697 |
"Could not get host realm for %s: %d.\n", |
704 |
"Could not get host realm for .%s: %d.\n", |
| 698 |
ms_upn_domain, rc); |
705 |
ms_upn_domain, rc); |
| 699 |
return PR_FALSE; |
706 |
return PR_FALSE; |
| 700 |
} else { |
707 |
} else { |
| 701 |
pkinit_debug (mcontext, 2, |
708 |
pkinit_debug (mcontext, 2, |
| 702 |
"Found domain \"%.*s\" mapped to realm \"%s\".\n", |
709 |
"Found domain \".%.*s\" mapped to realm \"%s\".\n", |
| 703 |
len, ms_upn_domain, realms[0]); |
710 |
len, ms_upn_domain, realms[0]); |
| 704 |
} |
711 |
} |
| 705 |
|
712 |
|