* $Source: /usr/src/kerberosIV/krb/RCS/kname_parse.c,v $
* Copyright 1987, 1988 by the Massachusetts Institute of Technology.
* For copying and distribution information, please see the file
static char rcsid_kname_parse_c
[] =
"$Header: /usr/src/kerberosIV/krb/RCS/kname_parse.c,v 4.5 90/06/25 20:56:35 kfall Exp $";
#include <mit-copyright.h>
/* max size of full name */
#define FULL_SZ (ANAME_SZ + INST_SZ + REALM_SZ)
#define NAME 0 /* which field are we in? */
extern char *krb_err_txt
[];
* This file contains four routines for handling Kerberos names.
* kname_parse() breaks a Kerberos name into its name, instance,
* k_isname(), k_isinst(), and k_isrealm() check a given string to see if
* it's a syntactically legitimate respective part of a Kerberos name,
* returning 1 if it is, 0 if it isn't.
* Definition of "syntactically legitimate" names is according to
* the Project Athena Technical Plan Section E.2.1, page 7 "Specifying
* names", version dated 21 Dec 1987.
* kname_parse() takes a Kerberos name "fullname" of the form:
* username[.instance][@realm]
* and returns the three components ("name", "instance", and "realm"
* in the example above) in the given arguments "np", "ip", and "rp".
* If successful, it returns KSUCCESS. If there was an error,
kname_parse(np
, ip
, rp
, fullname
)
char *np
, *ip
, *rp
, *fullname
;
static char buf
[FULL_SZ
];
char *rnext
, *wnext
; /* next char to read, write */
if (strlen(fullname
) > FULL_SZ
)
(void) strcpy(buf
, fullname
);
fprintf(stderr
, "unknown field value\n");
fprintf(stderr
, "unknown field value\n");
if ((strlen(np
) > ANAME_SZ
- 1) ||
(strlen(ip
) > INST_SZ
- 1) ||
(strlen(rp
) > REALM_SZ
- 1))
* k_isname() returns 1 if the given name is a syntactically legitimate
* Kerberos name; returns 0 if it's not.
if (strlen(s
) > ANAME_SZ
- 1)
* k_isinst() returns 1 if the given name is a syntactically legitimate
* Kerberos instance; returns 0 if it's not.
if (strlen(s
) > INST_SZ
- 1)
* k_isrealm() returns 1 if the given name is a syntactically legitimate
* Kerberos realm; returns 0 if it's not.
if (strlen(s
) > REALM_SZ
- 1)