diff options
author | Marc Horowitz <marc@mit.edu> | 1998-10-30 02:56:35 +0000 |
---|---|---|
committer | Marc Horowitz <marc@mit.edu> | 1998-10-30 02:56:35 +0000 |
commit | 1440ab035ba04550ddbbfbff1ee9b5571e3d95db (patch) | |
tree | 9d5e8d2e151a930e044c7d0f7c64053d244577a0 /src/slave | |
parent | 61ddbf948ba6ee70c1bc049268c3dfa73bc9983e (diff) | |
download | krb5-1440ab035ba04550ddbbfbff1ee9b5571e3d95db.tar.gz krb5-1440ab035ba04550ddbbfbff1ee9b5571e3d95db.tar.xz krb5-1440ab035ba04550ddbbfbff1ee9b5571e3d95db.zip |
pull up 3des implementation from the marc-3des branch
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11001 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/slave')
-rw-r--r-- | src/slave/ChangeLog | 5 | ||||
-rw-r--r-- | src/slave/kpropd.c | 80 |
2 files changed, 77 insertions, 8 deletions
diff --git a/src/slave/ChangeLog b/src/slave/ChangeLog index 9f285d41c..79107f86c 100644 --- a/src/slave/ChangeLog +++ b/src/slave/ChangeLog @@ -1,3 +1,8 @@ +1998-10-27 Marc Horowitz <marc@mit.edu> + + * kpropd.c (authorized_principal): make the acl file contain + etypes, and use that in the authorization process. + Wed Feb 18 16:27:28 1998 Tom Yu <tlyu@mit.edu> * Makefile.in (thisconfigdir): Remove trailing slash. diff --git a/src/slave/kpropd.c b/src/slave/kpropd.c index 3db4d0bb7..70f07b369 100644 --- a/src/slave/kpropd.c +++ b/src/slave/kpropd.c @@ -1,4 +1,30 @@ /* + * Copyright (C) 1998 by the FundsXpress, INC. + * + * All rights reserved. + * + * Export of this software from the United States of America may require + * a specific license from the United States Government. It is the + * responsibility of any person or organization contemplating export to + * obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of FundsXpress. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. FundsXpress makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* * slave/kpropd.c * * Copyright 1990,1991 by the Massachusetts Institute of Technology. @@ -91,10 +117,12 @@ void kerberos_authenticate PROTOTYPE((krb5_context, int, krb5_principal *, + krb5_enctype *, struct sockaddr_in)); krb5_boolean authorized_principal PROTOTYPE((krb5_context, - krb5_principal)); + krb5_principal, + krb5_enctype)); void recv_database PROTOTYPE((krb5_context, int, @@ -237,6 +265,7 @@ void doit(fd) krb5_data confmsg; int lock_fd; int omask; + krb5_enctype etype; fromlen = sizeof (from); if (getpeername(fd, (struct sockaddr *) &from, &fromlen) < 0) { @@ -266,8 +295,9 @@ void doit(fd) /* * Now do the authentication */ - kerberos_authenticate(kpropd_context, fd, &client, from); - if (!authorized_principal(kpropd_context, client)) { + kerberos_authenticate(kpropd_context, fd, &client, &etype, from); + + if (!authorized_principal(kpropd_context, client, etype)) { char *name; if (retval = krb5_unparse_name(kpropd_context, client, &name)) { @@ -495,10 +525,11 @@ void PRS(argv) * Figure out who's calling on the other end of the connection.... */ void -kerberos_authenticate(context, fd, clientp, sin) +kerberos_authenticate(context, fd, clientp, etype, sin) krb5_context context; int fd; krb5_principal * clientp; + krb5_enctype * etype; struct sockaddr_in sin; { krb5_error_code retval; @@ -577,29 +608,42 @@ kerberos_authenticate(context, fd, clientp, sin) exit(1); } + *etype = ticket->enc_part.enctype; + if (debug) { char * name; + char etypebuf[100]; if (retval = krb5_unparse_name(context, *clientp, &name)) { com_err(progname, retval, "While unparsing client name"); exit(1); } - printf("authenticated client: %s\n", name); + + if (retval = krb5_enctype_to_string(*etype, etypebuf, + sizeof(etypebuf))) { + com_err(progname, retval, "While unparsing ticket etype"); + exit(1); + } + + printf("authenticated client: %s (etype == %s)\n", name, etypebuf); free(name); } + krb5_free_ticket(context, ticket); } krb5_boolean -authorized_principal(context, p) +authorized_principal(context, p, auth_etype) krb5_context context; krb5_principal p; + krb5_enctype auth_etype; { - char *name; + char *name, *ptr; char buf[1024]; krb5_error_code retval; FILE *acl_file; int end; + krb5_enctype acl_etype; retval = krb5_unparse_name(context, p, &name); if (retval) @@ -615,7 +659,27 @@ authorized_principal(context, p) end = strlen(buf) - 1; if (buf[end] == '\n') buf[end] = '\0'; - if (!strcmp(name, buf)) { + if (!strncmp(name, buf, strlen(name))) { + ptr = buf+strlen(name); + + /* if the next character is not whitespace or nul, then + the match is only partial. continue on to new lines. */ + if (*ptr && !isspace(*ptr)) + continue; + + /* otherwise, skip trailing whitespace */ + for (; *ptr && isspace(*ptr); ptr++) ; + + /* now, look for an etype string. if there isn't one, + return true. if there is an invalid string, continue. + If there is a valid string, return true only if it + matches the etype passed in, otherwise continue */ + + if ((*ptr) && + ((retval = krb5_string_to_enctype(ptr, &acl_etype)) || + (acl_etype != auth_etype))) + continue; + free(name); fclose(acl_file); return TRUE; |