#include <string.h>
#include <krb.h>
+#include <krb5.h>
#include <update.h>
RCSID("$Header$");
-static char *srvtab = KEYFILE; /* default == /etc/srvtab */
static char realm[REALM_SZ];
static char master[INST_SZ] = "sms";
static char service[ANAME_SZ] = "rcmd";
des_cblock session;
+krb5_context context = NULL;
static int get_mr_tgt(void);
+int get_mr_krb5_update_ticket(char *host, krb5_data auth)
+{
+ krb5_auth_context auth_con = NULL;
+ krb5_ccache ccache = NULL;
+ krb5_error_code code;
+
+ code = krb5_init_context(&context);
+ if (code)
+ goto out;
+
+ code = krb5_auth_con_init(context, &auth_con);
+ if (code)
+ goto out;
+
+ krb5_init_ets(context);
+
+ code = krb5_cc_default(context, &ccache);
+ if (code)
+ goto out;
+
+ code = krb5_mk_req(context, &auth_con, NULL, "host", host, NULL, ccache,
+ &auth);
+
+ out:
+ if (ccache)
+ krb5_cc_close(context, ccache);
+ if (auth_con)
+ krb5_auth_con_free(context, auth_con);
+ return code;
+}
+
int get_mr_update_ticket(char *host, KTEXT ticket)
{
int code, pass;
linst[0] = '\0';
strcpy(kinst, "krbtgt");
code = krb_get_svc_in_tkt(master, linst, realm, kinst, realm,
- DEFAULT_TKT_LIFE, srvtab);
+ DEFAULT_TKT_LIFE, KEYFILE);
if (!code)
return 0;
else