diff options
| author | John Kohl <jtkohl@mit.edu> | 1991-02-25 15:17:50 +0000 |
|---|---|---|
| committer | John Kohl <jtkohl@mit.edu> | 1991-02-25 15:17:50 +0000 |
| commit | b9912f1997eb66efa26a7c840596aa5b8ee0be41 (patch) | |
| tree | 466ef6d566936e2dcc42490fa29957e643387c75 /src | |
| parent | f3af6a6a4daf7a09ac43ef6ae785a46cdaeb9c11 (diff) | |
| download | krb5-b9912f1997eb66efa26a7c840596aa5b8ee0be41.tar.gz krb5-b9912f1997eb66efa26a7c840596aa5b8ee0be41.tar.xz krb5-b9912f1997eb66efa26a7c840596aa5b8ee0be41.zip | |
*** empty log message ***
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1776 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/krb5/os/gen_port.c | 44 | ||||
| -rw-r--r-- | src/lib/krb5/os/gen_rname.c | 61 |
2 files changed, 105 insertions, 0 deletions
diff --git a/src/lib/krb5/os/gen_port.c b/src/lib/krb5/os/gen_port.c new file mode 100644 index 000000000..b2915cf17 --- /dev/null +++ b/src/lib/krb5/os/gen_port.c @@ -0,0 +1,44 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1991 by the Massachusetts Institute of Technology. + * All Rights Reserved. + * + * For copying and distribution information, please see the file + * <krb5/copyright.h>. + * + * Take an IP addr & port and generate a full IP address. + */ + +#if !defined(lint) && !defined(SABER) +static char rcsid_gen_port_c[] = +"$Id$"; +#endif /* !lint & !SABER */ + +#include <krb5/krb5.h> +#include <krb5/osconf.h> +#include <krb5/ext-proto.h> +#include <krb5/libos-proto.h> +#include "os-proto.h" + +krb5_error_code +krb5_gen_portaddr(addr, ptr, outaddr) +krb5_address *addr; +krb5_pointer ptr; +krb5_address **outaddr; +{ +#ifdef KRB5_USE_INET + krb5_int32 adr; + krb5_int16 port; + + if (addr->addrtype != ADDRTYPE_INET) + return KRB5_PROG_ATYPE_NOSUPP; + port = *(krb5_int16 *)ptr; + + memcpy((char *)&adr, (char *)addr->contents, sizeof(adr)); + return krb5_make_full_ipaddr(adr, port, outaddr); +#else + return KRB5_PROG_ATYPE_NOSUPP; +#endif +} diff --git a/src/lib/krb5/os/gen_rname.c b/src/lib/krb5/os/gen_rname.c new file mode 100644 index 000000000..ad5b6f217 --- /dev/null +++ b/src/lib/krb5/os/gen_rname.c @@ -0,0 +1,61 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1991 by the Massachusetts Institute of Technology. + * All Rights Reserved. + * + * For copying and distribution information, please see the file + * <krb5/copyright.h>. + * + * take a port-style address and unique string, and return + * a replay cache tag string. + */ + +#if !defined(lint) && !defined(SABER) +static char rcsid_gen_rname_c[] = +"$Id$"; +#endif /* !lint & !SABER */ + +#include <krb5/krb5.h> +#include <krb5/osconf.h> + +#include <krb5/ext-proto.h> +#include <krb5/libos-proto.h> +#include "os-proto.h" +#ifdef KRB5_USE_INET +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#endif + +krb5_error_code +krb5_gen_replay_name(address, uniq, string) +krb5_address *address; +const char *uniq; +char **string; +{ +#ifdef KRB5_USE_INET + krb5_int16 port; + krb5_int32 addr; + register krb5_error_code retval; + register char *tmp, *tmp2; + struct in_addr inaddr; + + if (retval = krb5_unpack_full_ipaddr(address, &addr, &port)) + return retval; + inaddr.s_addr = addr; + + tmp = inet_ntoa(inaddr); + tmp2 = malloc(strlen(uniq)+strlen(tmp)+1+1+5); /* 1 for NUL, + 1 for /, + 5 for digits (65535 is max) */ + if (!tmp2) + return ENOMEM; + (void) sprintf(tmp2, "%s%s/%u",uniq,tmp,ntohs(port)); + *string = tmp2; + return 0; +#else + return KRB5_PROG_ATYPE_NOSUPP; +#endif +} |
