* Original version written by Jeffery I. Schiller, January 1987
* Completely gutted and rewritten by Bill Sommerfeld, August 1987
*
- * $Log$
- * Revision 1.4 1987-09-09 14:59:06 wesommer
- * Allocate a new socket each time rather than keeping one around,
- * due to protocol problems.
- *
- * Revision 1.3 87/09/04 22:30:34 wesommer
- * Un-crock the KDC host (oops -- this one got distributed!!).
- *
- * Revision 1.2 87/08/22 17:13:59 wesommer
- * Make admin_errmsg external rather than static.
- * Crock up KDC host.
- *
- * Revision 1.1 87/08/07 13:50:37 wesommer
- * Initial revision
- *
*/
#ifndef lint
#include <netdb.h>
#include <strings.h>
+#include <ctype.h>
#include <stdio.h>
#include "admin_err.h"
static int my_addr_len; /* size of above address. */
static char krbrlm[REALM_SZ]; /* Local kerberos realm */
+static char krbhost[BUFSIZ]; /* Name of server for local realm */
char admin_errmsg[BUFSIZ]; /* Server error message */
/*
* Locate server.
*/
- hp = gethostbyname(KERB_HOST);
+ if (status = get_krbhst(krbhost, krbrlm, 1)) {
+ status += krb_err_base;
+ goto punt;
+ }
+ hp = gethostbyname(krbhost);
if (!hp) {
status = ADMIN_UNKNOWN_HOST;
goto punt;
bcopy((char *)hp->h_addr, (char *)&admin_addr.sin_addr, hp->h_length);
admin_addr.sin_port = sp->s_port;
+ /* lowercase & truncate hostname becuase it will be used as an
+ * instance name.
+ */
+ {
+ char *s;
+ for (s = krbhost; *s && *s != '.'; s++)
+ if (isupper(*s))
+ *s = tolower(*s);
+ *s = 0;
+ }
inited = 1;
}
return 0;
* find our session key.
*/
- if (status = get_credentials("changepw", "kerberos", krbrlm, &cred)) {
+ if (status = krb_get_cred("changepw", krbhost, krbrlm, &cred)) {
status += krb_err_base;
goto bad;
}
* Since this contains passwords, it must be kept from prying eyes.
*/
- sealed_len = mk_private_msg(pvt_buf, sealed_buf, pvt_len,
+ sealed_len = krb_mk_priv(pvt_buf, sealed_buf, pvt_len,
sess_sched, sess_key, &my_addr,
&admin_addr);
if (sealed_len < 0) {
* and know who we are.
*/
- if (status = mk_ap_req(&authent, "changepw", "kerberos", krbrlm,
+ if (status = krb_mk_req(&authent, "changepw", krbhost, krbrlm,
checksum)) {
status += krb_err_base;
goto bad;
goto bad;
}
}
- status = rd_private_msg(reply.dat, reply.length,
+ status = krb_rd_priv(reply.dat, reply.length,
sess_sched, sess_key,
&admin_addr, &my_addr,
&msg_data);