* $Header$
*
* Copyright (C) 1987 by the Massachusetts Institute of Technology
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
*
- * $Log$
- * Revision 1.3 1987-06-21 16:40:10 wesommer
- * Performance work, rearrangement of include files.
- *
- * Revision 1.2 87/06/04 01:34:35 wesommer
- * Added logging of arguments for some perverse reason.
- *
- * Revision 1.1 87/06/02 20:06:57 wesommer
- * Initial revision
- *
*/
#ifndef lint
#endif lint
extern int krb_err_base;
-#include <krb.h>
+#include <mit-copyright.h>
#include <strings.h>
#include "sms_server.h"
int status;
char buf[REALM_SZ+INST_SZ+ANAME_SZ];
extern int krb_err_base;
+ static char *unknown = "???";
+
+ if (cl->clname) {
+ free(cl->clname);
+ cl->clname = 0;
+ cl->users_id = 0;
+ bzero(&cl->kname, sizeof(cl->kname));
+ }
+ if (cl->entity && cl->entity != unknown) {
+ free(cl->entity);
+ cl->entity = 0;
+ }
- com_err(whoami, 0, "Processing auth: ");
- log_args(cl->args->sms_argc, cl->args->sms_argv);
-
auth.length = cl->args->sms_argl[0];
-
bcopy(cl->args->sms_argv[0], (char *)auth.dat, auth.length);
auth.mbz = 0;
- if ((status = rd_ap_req (&auth, "sms", "sms", cl->haddr.sin_addr,
+ if ((status = krb_rd_req (&auth, "sms", "sms", cl->haddr.sin_addr,
&ad, "")) != KSUCCESS) {
status += krb_err_base;
cl->reply.sms_status = status;
- com_err(whoami, status, "(authentication failed)");
+ if (log_flags & LOG_RES)
+ com_err(whoami, status, "(authentication failed)");
return;
}
+ bcopy(ad.pname, cl->kname.name, ANAME_SZ);
+ bcopy(ad.pinst, cl->kname.inst, INST_SZ);
+ bcopy(ad.prealm, cl->kname.realm, REALM_SZ);
+
(void) strcpy(buf, ad.pname);
if(ad.pinst[0]) {
(void) strcat(buf, ".");
cl->clname = (char *)malloc((unsigned)(strlen(buf)+1));
(void) strcpy(cl->clname, buf);
- (void) sprintf(buf1, "Authenticated to %s", cl->clname);
- com_err(whoami, 0, buf1);
+ bzero(&ad, sizeof(ad)); /* Clean up session key, etc. */
+
+ cl->users_id = get_users_id(cl->kname.name);
+
+ if (cl->args->sms_version_no == SMS_VERSION_2) {
+ unsigned len = strlen(cl->args->sms_argv[1]) + 1;
+
+ cl->entity = (char *)malloc(len);
+ bcopy(cl->args->sms_argv[1], cl->entity, len+1);
+ } else {
+ cl->entity = unknown;
+ }
+
+ if (log_flags & LOG_RES)
+ com_err(whoami, 0, "Authenticated to %s using %s, id %d",
+ cl->clname, cl->entity, cl->users_id);
+ if (cl->users_id == 0)
+ cl->reply.sms_status = SMS_USER_AUTH;
}