6 * Copyright (C) 1987 by the Massachusetts Institute of Technology
9 * Revision 1.1 1987-06-02 20:06:57 wesommer
15 static char *rcsid_sms_sauth_c = "$Header$";
18 extern int krb_err_base;
21 #include "sms_private.h"
22 #include "sms_server.h"
26 extern char *malloc();
29 * Handle a SMS_AUTH RPC request.
31 * argv[0] is a kerberos authenticator. Decompose it, and if
32 * successful, store the name the user authenticated to in
43 char buf[REALM_SZ+INST_SZ+ANAME_SZ];
44 extern int krb_err_base;
46 auth.length = cl->args->sms_argl[0];
47 bcopy(cl->args->sms_argv[0], (char *)auth.dat, auth.length);
50 if ((status = rd_ap_req (&auth, "sms", "sms", cl->haddr.sin_addr,
51 &ad, "")) != KSUCCESS) {
52 status += krb_err_base;
53 cl->reply.sms_status = status;
54 com_err(whoami, status, "(authentication failed)");
57 (void) strcpy(buf, ad.pname);
59 (void) strcat(buf, ".");
60 (void) strcat(buf, ad.pinst);
62 (void) strcat(buf, "@");
63 (void) strcat(buf, ad.prealm);
64 if (cl->clname) free((char *)cl->clname);
66 cl->clname = (char *)malloc((unsigned)(strlen(buf)+1));
67 (void) strcpy(cl->clname, buf);
68 (void) sprintf(buf1, "Authenticated to %s", cl->clname);
69 com_err(whoami, 0, buf1);