#include <des.h>
#endif /* KRB4 */
#ifdef KRB5
+#include <krb5/los-proto.h>
#include <com_err.h>
#include <ctype.h>
#endif /* KRB5 */
#endif /* KRB4 */
#ifdef KRB5
krb5_error_code retval;
- char **hrealms;
- krb5_data aserver[3], *server[4];
krb5_ccache ccdef;
- krb5_principal client;
+ krb5_principal client, server;
krb5_error *err_ret;
- char *remote_host;
register char *cp;
#endif /* KRB5 */
#endif /* KERBEROS */
goto krb5error;
}
- /* copy the hostname into non-volatile storage */
- remote_host = malloc(strlen(hp->h_name) + 1);
- (void) strcpy(remote_host, hp->h_name);
-
- if (retval = krb5_get_host_realm(remote_host, &hrealms)) {
- goto krb5error;
- }
-
/* lower-case to get name for "instance" part of service name */
- for (cp = remote_host; *cp; cp++)
+ for (cp = hp->h_name; *cp; cp++)
if (isupper(*cp))
*cp = tolower(*cp);
- aserver[0].length = strlen(hrealms[0]);
- aserver[0].data = hrealms[0];
- aserver[1].length = strlen(POP_SERVICE);
- aserver[1].data = POP_SERVICE;
- aserver[2].length = strlen(remote_host);
- aserver[2].data = remote_host;
- server[0] = &aserver[0];
- server[1] = &aserver[1];
- server[2] = &aserver[2];
- server[3] = 0;
+ if (retval = krb5_sname_to_principal(hp->h_name, POP_SERVICE,
+ FALSE, /* FALSE means don't
+ canonicalize hostname
+ (we already have...) */
+ &server)) {
+ goto krb5error;
+ }
retval = krb5_sendauth((krb5_pointer) &s, "KPOPV1.0", client, server,
AP_OPTS_MUTUAL_REQUIRED,