* Copyright (C) 1987 by the Massachusetts Institute of Technology
*
* $Log$
- * Revision 1.1 1987-05-20 03:11:18 wesommer
- * Initial revision
+ * Revision 1.7 1988-06-21 13:46:05 mar
+ * changed name of kerberos call
*
+ * Revision 1.6 88/06/01 15:31:53 mar
+ * make auth do the right thing for version 2 of the protocol
+ *
+ * Revision 1.5 88/04/19 12:40:29 mar
+ * pass version number on queries
+ *
+ * Revision 1.4 87/10/20 15:09:22 mar
+ * replace hardcoded ATHENA realm with call to get_krbrlm();
+ *
+ * Revision 1.3 87/06/16 17:47:20 wesommer
+ * Clean up memory allocation, indenting.
+ *
+ * Revision 1.2 87/05/31 22:03:23 wesommer
+ * It's working better.
+ *
+ * Revision 1.1 87/05/20 03:11:18 wesommer
+ * Initial revision
+ *
*
* Handles the client side of the sending of authenticators to
* the sms server.
#include "sms_private.h"
#include <krb.h>
-int sms_auth()
+extern int krb_err_base;
+
+/* Authenticate this client with the SMS server. prog is the name of the
+ * client program, and will be recorded in the database.
+ */
+
+int sms_auth(prog)
+char *prog;
{
- int status;
- struct sms_params aparms;
+ register int status;
+ sms_params params_st;
+ char *args[2];
+ int argl[2];
+ char realm[REALM_SZ];
+
+ register sms_params *params = ¶ms_st;
+ sms_params *reply = NULL;
+ KTEXT_ST auth;
+
+ CHECK_CONNECTED;
- if (!_sms_conn) {
- return SMS_NOT_CONNECTED;
- }
+ /*
+ * Build a Kerberos authenticator.
+ * The "service" and "instance" should not be hardcoded here.
+ */
- /*
- * Build a Kerberos authenticator.
- */
+ if ((status = get_krbrlm(realm, 1)) != KSUCCESS) {
+ return status;
+ }
+ status = krb_mk_req(&auth, "sms", "sms", realm, 0);
+ if (status != KSUCCESS) {
+ status += krb_err_base;
+ return status;
+ }
+ params->sms_version_no = sending_version_no;
+ params->sms_procno = SMS_AUTH;
+ params->sms_argc = 2;
+ params->sms_argv = args;
+ params->sms_argl = argl;
+ params->sms_argv[0] = (char *)auth.dat;
+ params->sms_argl[0] = auth.length;
+ params->sms_argv[1] = prog;
+ params->sms_argl[1] = strlen(prog) + 1;
- status = mk_ap_req(&auth, "sms", "sms", "ATHENA.MIT.EDU", 0);
- if (status != KSUCCESS) {
- status += krb_err_base;
- goto punt;
- }
+ if (sending_version_no == SMS_VERSION_1)
+ params->sms_argc = 1;
- if (!sms_call_op)
- sms_call_op = create_operation();
+ if ((status = sms_do_call(params, &reply)) == 0)
+ status = reply->sms_status;
+ sms_destroy_reply(reply);
-
-
-
-
+ return status;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-indent-level: 4
+ * c-continued-statement-offset: 4
+ * c-brace-offset: -4
+ * c-argdecl-indent: 4
+ * c-label-offset: -4
+ * End:
+ */