diff --git a/src/libtirpc.map b/src/libtirpc.map index 449b769..13bc20a 100644 --- a/src/libtirpc.map +++ b/src/libtirpc.map @@ -321,6 +321,7 @@ TIRPC_0.3.3 { __key_decryptsession_pk_LOCAL; __key_encryptsession_pk_LOCAL; __key_gendes_LOCAL; + authdes_pk_create; } TIRPC_0.3.2; TIRPC_PRIVATE { diff --git a/src/rpc_soc.c b/src/rpc_soc.c index e146ed4..03bc0d4 100644 --- a/src/rpc_soc.c +++ b/src/rpc_soc.c @@ -61,6 +61,7 @@ #include #include #include +#include #include "rpc_com.h" @@ -553,6 +554,46 @@ fallback: } /* + * Create the client des authentication object. Obsoleted by + * authdes_pk_seccreate(). + */ +extern AUTH *authdes_pk_seccreate(const char *, netobj *, u_int, const char *, + const des_block *, nis_server *); + +AUTH * +authdes_pk_create(servername, pkey, window, syncaddr, ckey) + char *servername; /* network name of server */ + netobj *pkey; /* public key */ + u_int window; /* time to live */ + struct sockaddr *syncaddr; /* optional hostaddr to sync with */ + des_block *ckey; /* optional conversation key to use */ +{ + AUTH *nauth; + char hostname[NI_MAXHOST]; + + if (syncaddr) { + /* + * Change addr to hostname, because that is the way + * new interface takes it. + */ + switch (syncaddr->sa_family) { + case AF_INET: + if (getnameinfo(syncaddr, sizeof(struct sockaddr_in), hostname, + sizeof hostname, NULL, 0, 0) != 0) + goto fallback; + break; + default: + goto fallback; + } + nauth = authdes_pk_seccreate(servername, pkey, window, hostname, ckey, NULL); + return (nauth); + } +fallback: + return authdes_pk_seccreate(servername, pkey, window, NULL, ckey, NULL); +} + + +/* * Create a client handle for a unix connection. Obsoleted by clnt_vc_create() */ CLIENT * diff --git a/tirpc/rpc/auth.h b/tirpc/rpc/auth.h index 3e44863..e67779c 100644 --- a/tirpc/rpc/auth.h +++ b/tirpc/rpc/auth.h @@ -313,6 +313,8 @@ extern AUTH *authnone_create(void); /* takes no parameters */ extern "C" { #endif extern AUTH *authdes_create (char *, u_int, struct sockaddr *, des_block *); +extern AUTH *authdes_pk_create (char *, netobj *, u_int, + struct sockaddr *, des_block *); extern AUTH *authdes_seccreate (const char *, const u_int, const char *, const des_block *); #ifdef __cplusplus