libtirpc/009-authdes_pk_create.patch
Marcus Meissner 25987c29d1 Accepting request 315658 from home:kukuk:NIS
- Add 012-xp_sock.patch: add sunrpc compatibility define

- Update 009-authdes_pk_create.patch (fix syncaddr handling)
- Add 011-authdes_create.patch (fix syncaddr handling)

- Add 010-xdr_sizeof.patch (enable xdr_sizeof)

- Add 009-authdes_pk_create.patch (missing SunRPC compat function)

OBS-URL: https://build.opensuse.org/request/show/315658
OBS-URL: https://build.opensuse.org/package/show/Base:System/libtirpc?expand=0&rev=51
2015-07-10 10:28:23 +00:00

85 lines
2.3 KiB
Diff

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 <string.h>
#include <unistd.h>
#include <fcntl.h>
+#include <rpcsvc/nis.h>
#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