3 * Provide a copy of kname_parse() from krb4 for when krb4 is no
6 * Copyright (C) 2009 by the Massachusetts Institute of Technology
7 * For copying and distribution information, please see the file
11 #include <mit-copyright.h>
21 #define KRBET_KNAME_FMT (39525457L)
22 #define KNAME_FMT (KRBET_KNAME_FMT - ERROR_TABLE_BASE_krb)
27 #define NAME 0 /* which field are we in? */
31 int mr_kname_parse(char *np, char *ip, char *rp, char *fullname)
33 char buf[MAX_K_NAME_SZ];
34 char *rnext, *wnext; /* next char to read, write */
44 if (strlen(fullname) > MAX_K_NAME_SZ)
46 (void) strcpy(buf, fullname);
48 while ((c = *rnext++)) {
67 case INST: /* We now allow period in instance */
97 * Paranoia: check length each time through to ensure that we
98 * don't overwrite things.
102 if (wnext - np >= ANAME_SZ)
106 if (wnext - ip >= INST_SZ)
110 if (wnext - rp >= REALM_SZ)