summaryrefslogtreecommitdiff
path: root/usr.sbin/amd/rpcx
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-01-21 08:24:42 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-01-21 08:24:42 +0000
commit6940a6bb6b4138cdf3ab0376eb8cd926b8637d3b (patch)
tree40cca83314d2e5fc9cba75b238a54348a5500d0a /usr.sbin/amd/rpcx
parentcbd81d83646bab2761557075c6c163a0d4ade90d (diff)
Regenerate the amq RPC stubs with a -current rpcgen, with some
post-processing of the server stub to match previous local changes. This corrects the type handling of mt_mounttime, so "amq /mountpoint" doesn't segv trying to treat a time_t as a pointer. With the file (re)generation fixed, we can more easily update the protocol to support 64bit time_t...
Diffstat (limited to 'usr.sbin/amd/rpcx')
-rw-r--r--usr.sbin/amd/rpcx/Makefile20
-rw-r--r--usr.sbin/amd/rpcx/amq.h224
-rw-r--r--usr.sbin/amd/rpcx/amq_clnt.c138
-rw-r--r--usr.sbin/amd/rpcx/amq_svc.c141
-rw-r--r--usr.sbin/amd/rpcx/amq_svc.extra11
-rw-r--r--usr.sbin/amd/rpcx/amq_xdr.c158
6 files changed, 354 insertions, 338 deletions
diff --git a/usr.sbin/amd/rpcx/Makefile b/usr.sbin/amd/rpcx/Makefile
new file mode 100644
index 00000000000..a9c4e77f74c
--- /dev/null
+++ b/usr.sbin/amd/rpcx/Makefile
@@ -0,0 +1,20 @@
+
+RPCGEN = rpcgen -C
+
+AMQ_SVC_EXTRA = amq_svc.extra
+
+all: amq.h amq_clnt.c amq_svc.c amq_xdr.c
+
+amq.h: amq.x
+ ${RPCGEN} -o $@ -h amq.x
+amq_xdr.c: amq.x
+ ${RPCGEN} -o $@ -c -i 100 amq.x
+amq_clnt.c: amq.x
+ ${RPCGEN} -o $@ -l amq.x
+amq_svc.c: amq.x ${AMQ_SVC_EXTRA} Makefile
+ ${RPCGEN} -o $@.tmp -m amq.x
+ printf '/"amq.h"/a\n#include "am.h"\n#include <arpa/inet.h>\n.\n/_msgout(/-1,/^}/d\n/local/r %s\n/_msgout/\n.,+1c\n\t\tplog(XLOG_FATAL, "unable to free rpc arguments in amqprog");\n\t\tgoing_down(1);\n.\ng/_rpcsvcdirty/d\nwq\n' ${AMQ_SVC_EXTRA} | \
+ ed -s $@.tmp >/dev/null
+ mv $@.tmp $@
+
+
diff --git a/usr.sbin/amd/rpcx/amq.h b/usr.sbin/amd/rpcx/amq.h
index 820db4cb246..484c3b1f717 100644
--- a/usr.sbin/amd/rpcx/amq.h
+++ b/usr.sbin/amd/rpcx/amq.h
@@ -1,49 +1,35 @@
/*
- * Copyright (c) 1990 Jan-Simon Pendry
- * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jan-Simon Pendry at Imperial College, London.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)amq.h 8.1 (Berkeley) 6/6/93
- * $Id: amq.h,v 1.5 2014/10/26 03:03:34 guenther Exp $
- *
+ * Please do not edit this file.
+ * It was generated using rpcgen.
*/
+#ifndef _AMQ_H_RPCGEN
+#define _AMQ_H_RPCGEN
+
+#define RPCGEN_VERSION 199506
+
+#include <rpc/rpc.h>
+
#define AMQ_STRLEN 1024
typedef char *amq_string;
-bool_t xdr_amq_string(XDR *, amq_string *);
+#ifdef __cplusplus
+extern "C" bool_t xdr_amq_string(XDR *, amq_string *);
+#elif defined(__STDC__)
+extern bool_t xdr_amq_string(XDR *, amq_string *);
+#else /* Old Style C */
+bool_t xdr_amq_string();
+#endif /* Old Style C */
-typedef int *time_type;
-bool_t xdr_time_type(XDR *, time_type *);
+typedef int time_type;
+#ifdef __cplusplus
+extern "C" bool_t xdr_time_type(XDR *, time_type *);
+#elif defined(__STDC__)
+extern bool_t xdr_time_type(XDR *, time_type *);
+#else /* Old Style C */
+bool_t xdr_time_type();
+#endif /* Old Style C */
struct amq_mount_tree {
@@ -62,11 +48,23 @@ struct amq_mount_tree {
struct amq_mount_tree *mt_child;
};
typedef struct amq_mount_tree amq_mount_tree;
-bool_t xdr_amq_mount_tree(XDR *, amq_mount_tree *);
+#ifdef __cplusplus
+extern "C" bool_t xdr_amq_mount_tree(XDR *, amq_mount_tree *);
+#elif defined(__STDC__)
+extern bool_t xdr_amq_mount_tree(XDR *, amq_mount_tree *);
+#else /* Old Style C */
+bool_t xdr_amq_mount_tree();
+#endif /* Old Style C */
typedef amq_mount_tree *amq_mount_tree_p;
-bool_t xdr_amq_mount_tree_p(XDR *, amq_mount_tree_p *);
+#ifdef __cplusplus
+extern "C" bool_t xdr_amq_mount_tree_p(XDR *, amq_mount_tree_p *);
+#elif defined(__STDC__)
+extern bool_t xdr_amq_mount_tree_p(XDR *, amq_mount_tree_p *);
+#else /* Old Style C */
+bool_t xdr_amq_mount_tree_p();
+#endif /* Old Style C */
struct amq_mount_info {
@@ -79,21 +77,39 @@ struct amq_mount_info {
int mi_up;
};
typedef struct amq_mount_info amq_mount_info;
-bool_t xdr_amq_mount_info(XDR *, amq_mount_info *);
+#ifdef __cplusplus
+extern "C" bool_t xdr_amq_mount_info(XDR *, amq_mount_info *);
+#elif defined(__STDC__)
+extern bool_t xdr_amq_mount_info(XDR *, amq_mount_info *);
+#else /* Old Style C */
+bool_t xdr_amq_mount_info();
+#endif /* Old Style C */
typedef struct {
u_int amq_mount_info_list_len;
amq_mount_info *amq_mount_info_list_val;
} amq_mount_info_list;
-bool_t xdr_amq_mount_info_list(XDR *, amq_mount_info_list *);
+#ifdef __cplusplus
+extern "C" bool_t xdr_amq_mount_info_list(XDR *, amq_mount_info_list *);
+#elif defined(__STDC__)
+extern bool_t xdr_amq_mount_info_list(XDR *, amq_mount_info_list *);
+#else /* Old Style C */
+bool_t xdr_amq_mount_info_list();
+#endif /* Old Style C */
typedef struct {
u_int amq_mount_tree_list_len;
amq_mount_tree_p *amq_mount_tree_list_val;
} amq_mount_tree_list;
-bool_t xdr_amq_mount_tree_list(XDR *, amq_mount_tree_list *);
+#ifdef __cplusplus
+extern "C" bool_t xdr_amq_mount_tree_list(XDR *, amq_mount_tree_list *);
+#elif defined(__STDC__)
+extern bool_t xdr_amq_mount_tree_list(XDR *, amq_mount_tree_list *);
+#else /* Old Style C */
+bool_t xdr_amq_mount_tree_list();
+#endif /* Old Style C */
struct amq_mount_stats {
@@ -104,7 +120,13 @@ struct amq_mount_stats {
int as_uerr;
};
typedef struct amq_mount_stats amq_mount_stats;
-bool_t xdr_amq_mount_stats(XDR *, amq_mount_stats *);
+#ifdef __cplusplus
+extern "C" bool_t xdr_amq_mount_stats(XDR *, amq_mount_stats *);
+#elif defined(__STDC__)
+extern bool_t xdr_amq_mount_stats(XDR *, amq_mount_stats *);
+#else /* Old Style C */
+bool_t xdr_amq_mount_stats();
+#endif /* Old Style C */
enum amq_opt {
@@ -114,7 +136,13 @@ enum amq_opt {
AMOPT_FLUSHMAPC = 3
};
typedef enum amq_opt amq_opt;
-bool_t xdr_amq_opt(XDR *, amq_opt *);
+#ifdef __cplusplus
+extern "C" bool_t xdr_amq_opt(XDR *, amq_opt *);
+#elif defined(__STDC__)
+extern bool_t xdr_amq_opt(XDR *, amq_opt *);
+#else /* Old Style C */
+bool_t xdr_amq_opt();
+#endif /* Old Style C */
struct amq_setopt {
@@ -122,36 +150,104 @@ struct amq_setopt {
amq_string as_str;
};
typedef struct amq_setopt amq_setopt;
-bool_t xdr_amq_setopt(XDR *, amq_setopt *);
+#ifdef __cplusplus
+extern "C" bool_t xdr_amq_setopt(XDR *, amq_setopt *);
+#elif defined(__STDC__)
+extern bool_t xdr_amq_setopt(XDR *, amq_setopt *);
+#else /* Old Style C */
+bool_t xdr_amq_setopt();
+#endif /* Old Style C */
#define AMQ_PROGRAM ((u_long)300019)
#define AMQ_VERSION ((u_long)1)
+
+#ifdef __cplusplus
+#define AMQPROC_NULL ((u_long)0)
+extern "C" void * amqproc_null_1(void *, CLIENT *);
+extern "C" void * amqproc_null_1_svc(void *, struct svc_req *);
+#define AMQPROC_MNTTREE ((u_long)1)
+extern "C" amq_mount_tree_p * amqproc_mnttree_1(amq_string *, CLIENT *);
+extern "C" amq_mount_tree_p * amqproc_mnttree_1_svc(amq_string *, struct svc_req *);
+#define AMQPROC_UMNT ((u_long)2)
+extern "C" void * amqproc_umnt_1(amq_string *, CLIENT *);
+extern "C" void * amqproc_umnt_1_svc(amq_string *, struct svc_req *);
+#define AMQPROC_STATS ((u_long)3)
+extern "C" amq_mount_stats * amqproc_stats_1(void *, CLIENT *);
+extern "C" amq_mount_stats * amqproc_stats_1_svc(void *, struct svc_req *);
+#define AMQPROC_EXPORT ((u_long)4)
+extern "C" amq_mount_tree_list * amqproc_export_1(void *, CLIENT *);
+extern "C" amq_mount_tree_list * amqproc_export_1_svc(void *, struct svc_req *);
+#define AMQPROC_SETOPT ((u_long)5)
+extern "C" int * amqproc_setopt_1(amq_setopt *, CLIENT *);
+extern "C" int * amqproc_setopt_1_svc(amq_setopt *, struct svc_req *);
+#define AMQPROC_GETMNTFS ((u_long)6)
+extern "C" amq_mount_info_list * amqproc_getmntfs_1(void *, CLIENT *);
+extern "C" amq_mount_info_list * amqproc_getmntfs_1_svc(void *, struct svc_req *);
+#define AMQPROC_MOUNT ((u_long)7)
+extern "C" int * amqproc_mount_1(amq_string *, CLIENT *);
+extern "C" int * amqproc_mount_1_svc(amq_string *, struct svc_req *);
+#define AMQPROC_GETVERS ((u_long)8)
+extern "C" amq_string * amqproc_getvers_1(void *, CLIENT *);
+extern "C" amq_string * amqproc_getvers_1_svc(void *, struct svc_req *);
+
+#elif defined(__STDC__)
+#define AMQPROC_NULL ((u_long)0)
+extern void * amqproc_null_1(void *, CLIENT *);
+extern void * amqproc_null_1_svc(void *, struct svc_req *);
+#define AMQPROC_MNTTREE ((u_long)1)
+extern amq_mount_tree_p * amqproc_mnttree_1(amq_string *, CLIENT *);
+extern amq_mount_tree_p * amqproc_mnttree_1_svc(amq_string *, struct svc_req *);
+#define AMQPROC_UMNT ((u_long)2)
+extern void * amqproc_umnt_1(amq_string *, CLIENT *);
+extern void * amqproc_umnt_1_svc(amq_string *, struct svc_req *);
+#define AMQPROC_STATS ((u_long)3)
+extern amq_mount_stats * amqproc_stats_1(void *, CLIENT *);
+extern amq_mount_stats * amqproc_stats_1_svc(void *, struct svc_req *);
+#define AMQPROC_EXPORT ((u_long)4)
+extern amq_mount_tree_list * amqproc_export_1(void *, CLIENT *);
+extern amq_mount_tree_list * amqproc_export_1_svc(void *, struct svc_req *);
+#define AMQPROC_SETOPT ((u_long)5)
+extern int * amqproc_setopt_1(amq_setopt *, CLIENT *);
+extern int * amqproc_setopt_1_svc(amq_setopt *, struct svc_req *);
+#define AMQPROC_GETMNTFS ((u_long)6)
+extern amq_mount_info_list * amqproc_getmntfs_1(void *, CLIENT *);
+extern amq_mount_info_list * amqproc_getmntfs_1_svc(void *, struct svc_req *);
+#define AMQPROC_MOUNT ((u_long)7)
+extern int * amqproc_mount_1(amq_string *, CLIENT *);
+extern int * amqproc_mount_1_svc(amq_string *, struct svc_req *);
+#define AMQPROC_GETVERS ((u_long)8)
+extern amq_string * amqproc_getvers_1(void *, CLIENT *);
+extern amq_string * amqproc_getvers_1_svc(void *, struct svc_req *);
+
+#else /* Old Style C */
#define AMQPROC_NULL ((u_long)0)
-extern void *amqproc_null_1(void *, CLIENT *);
-extern void *amqproc_null_1_svc(void *, struct svc_req *);
+extern void * amqproc_null_1();
+extern void * amqproc_null_1_svc();
#define AMQPROC_MNTTREE ((u_long)1)
-extern amq_mount_tree_p *amqproc_mnttree_1(void *, CLIENT *);
-extern amq_mount_tree_p *amqproc_mnttree_1_svc(void *, struct svc_req *);
+extern amq_mount_tree_p * amqproc_mnttree_1();
+extern amq_mount_tree_p * amqproc_mnttree_1_svc();
#define AMQPROC_UMNT ((u_long)2)
-extern void *amqproc_umnt_1(void *, CLIENT *);
-extern void *amqproc_umnt_1_svc(void *, struct svc_req *);
+extern void * amqproc_umnt_1();
+extern void * amqproc_umnt_1_svc();
#define AMQPROC_STATS ((u_long)3)
-extern amq_mount_stats *amqproc_stats_1(void *, CLIENT *);
-extern amq_mount_stats *amqproc_stats_1_svc(void *, struct svc_req *);
+extern amq_mount_stats * amqproc_stats_1();
+extern amq_mount_stats * amqproc_stats_1_svc();
#define AMQPROC_EXPORT ((u_long)4)
-extern amq_mount_tree_list *amqproc_export_1(void *, CLIENT *);
-extern amq_mount_tree_list *amqproc_export_1_svc(void *, struct svc_req *);
+extern amq_mount_tree_list * amqproc_export_1();
+extern amq_mount_tree_list * amqproc_export_1_svc();
#define AMQPROC_SETOPT ((u_long)5)
-extern int *amqproc_setopt_1(void *, CLIENT *);
-extern int *amqproc_setopt_1_svc(void *, struct svc_req *);
+extern int * amqproc_setopt_1();
+extern int * amqproc_setopt_1_svc();
#define AMQPROC_GETMNTFS ((u_long)6)
-extern amq_mount_info_list *amqproc_getmntfs_1(void *, CLIENT *);
-extern amq_mount_info_list *amqproc_getmntfs_1_svc(void *, struct svc_req *);
+extern amq_mount_info_list * amqproc_getmntfs_1();
+extern amq_mount_info_list * amqproc_getmntfs_1_svc();
#define AMQPROC_MOUNT ((u_long)7)
-extern int *amqproc_mount_1(void *, CLIENT *);
-extern int *amqproc_mount_1_svc(void *, struct svc_req *);
+extern int * amqproc_mount_1();
+extern int * amqproc_mount_1_svc();
#define AMQPROC_GETVERS ((u_long)8)
-extern amq_string *amqproc_getvers_1(void *, CLIENT *);
-extern amq_string *amqproc_getvers_1_svc(void *, struct svc_req *);
+extern amq_string * amqproc_getvers_1();
+extern amq_string * amqproc_getvers_1_svc();
+#endif /* Old Style C */
+#endif /* !_AMQ_H_RPCGEN */
diff --git a/usr.sbin/amd/rpcx/amq_clnt.c b/usr.sbin/amd/rpcx/amq_clnt.c
index c54daa7ea75..65988e0ea6e 100644
--- a/usr.sbin/amd/rpcx/amq_clnt.c
+++ b/usr.sbin/amd/rpcx/amq_clnt.c
@@ -1,166 +1,118 @@
/*
- * Copyright (c) 1990 Jan-Simon Pendry
- * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jan-Simon Pendry at Imperial College, London.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)amq_clnt.c 8.1 (Berkeley) 6/6/93
- * $Id: amq_clnt.c,v 1.6 2014/10/26 03:03:34 guenther Exp $
- *
+ * Please do not edit this file.
+ * It was generated using rpcgen.
*/
-#include "am.h"
+#include <memory.h> /* for memset */
#include "amq.h"
-static struct timeval TIMEOUT = { ALLOWED_MOUNT_TIME, 0 };
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
void *
amqproc_null_1(void *argp, CLIENT *clnt)
{
- static char res;
+ static char clnt_res;
- bzero((char *)&res, sizeof(res));
- if (clnt_call(clnt, AMQPROC_NULL, xdr_void, argp, xdr_void,
- &res, TIMEOUT) != RPC_SUCCESS) {
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+ if (clnt_call(clnt, AMQPROC_NULL, xdr_void, argp, xdr_void, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
- return ((void *)&res);
+ return ((void *)&clnt_res);
}
-
amq_mount_tree_p *
-amqproc_mnttree_1(void *argp, CLIENT *clnt)
+amqproc_mnttree_1(amq_string *argp, CLIENT *clnt)
{
- static amq_mount_tree_p res;
+ static amq_mount_tree_p clnt_res;
- bzero((char *)&res, sizeof(res));
- if (clnt_call(clnt, AMQPROC_MNTTREE, xdr_amq_string, argp,
- xdr_amq_mount_tree_p, &res, TIMEOUT) != RPC_SUCCESS) {
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+ if (clnt_call(clnt, AMQPROC_MNTTREE, xdr_amq_string, argp, xdr_amq_mount_tree_p, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
- return (&res);
+ return (&clnt_res);
}
-
void *
-amqproc_umnt_1(void *argp, CLIENT *clnt)
+amqproc_umnt_1(amq_string *argp, CLIENT *clnt)
{
- static char res;
+ static char clnt_res;
- bzero((char *)&res, sizeof(res));
- if (clnt_call(clnt, AMQPROC_UMNT, xdr_amq_string, argp,
- xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+ if (clnt_call(clnt, AMQPROC_UMNT, xdr_amq_string, argp, xdr_void, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
- return ((void *)&res);
+ return ((void *)&clnt_res);
}
-
amq_mount_stats *
amqproc_stats_1(void *argp, CLIENT *clnt)
{
- static amq_mount_stats res;
+ static amq_mount_stats clnt_res;
- bzero((char *)&res, sizeof(res));
- if (clnt_call(clnt, AMQPROC_STATS, xdr_void, argp,
- xdr_amq_mount_stats, &res, TIMEOUT) != RPC_SUCCESS) {
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+ if (clnt_call(clnt, AMQPROC_STATS, xdr_void, argp, xdr_amq_mount_stats, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
- return (&res);
+ return (&clnt_res);
}
-
amq_mount_tree_list *
amqproc_export_1(void *argp, CLIENT *clnt)
{
- static amq_mount_tree_list res;
+ static amq_mount_tree_list clnt_res;
- bzero((char *)&res, sizeof(res));
- if (clnt_call(clnt, AMQPROC_EXPORT, xdr_void, argp,
- xdr_amq_mount_tree_list, &res, TIMEOUT) != RPC_SUCCESS) {
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+ if (clnt_call(clnt, AMQPROC_EXPORT, xdr_void, argp, xdr_amq_mount_tree_list, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
- return (&res);
+ return (&clnt_res);
}
int *
-amqproc_setopt_1(void *argp, CLIENT *clnt)
+amqproc_setopt_1(amq_setopt *argp, CLIENT *clnt)
{
- static int res;
+ static int clnt_res;
- bzero((char *)&res, sizeof(res));
- if (clnt_call(clnt, AMQPROC_SETOPT, xdr_amq_setopt, argp,
- xdr_int, &res, TIMEOUT) != RPC_SUCCESS) {
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+ if (clnt_call(clnt, AMQPROC_SETOPT, xdr_amq_setopt, argp, xdr_int, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
- return (&res);
+ return (&clnt_res);
}
-
amq_mount_info_list *
amqproc_getmntfs_1(void *argp, CLIENT *clnt)
{
- static amq_mount_info_list res;
+ static amq_mount_info_list clnt_res;
- bzero((char *)&res, sizeof(res));
- if (clnt_call(clnt, AMQPROC_GETMNTFS, xdr_void, argp,
- xdr_amq_mount_info_list, &res, TIMEOUT) != RPC_SUCCESS) {
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+ if (clnt_call(clnt, AMQPROC_GETMNTFS, xdr_void, argp, xdr_amq_mount_info_list, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
- return (&res);
+ return (&clnt_res);
}
-
int *
-amqproc_mount_1(void *argp, CLIENT *clnt)
+amqproc_mount_1(amq_string *argp, CLIENT *clnt)
{
- static int res;
+ static int clnt_res;
- bzero((char *)&res, sizeof(res));
- if (clnt_call(clnt, AMQPROC_MOUNT, xdr_amq_string, argp,
- xdr_int, &res, TIMEOUT) != RPC_SUCCESS) {
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+ if (clnt_call(clnt, AMQPROC_MOUNT, xdr_amq_string, argp, xdr_int, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
- return (&res);
+ return (&clnt_res);
}
-
amq_string *
amqproc_getvers_1(void *argp, CLIENT *clnt)
{
- static amq_string res;
+ static amq_string clnt_res;
- bzero((char *)&res, sizeof(res));
- if (clnt_call(clnt, AMQPROC_GETVERS, xdr_void, argp,
- xdr_amq_string, &res, TIMEOUT) != RPC_SUCCESS) {
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+ if (clnt_call(clnt, AMQPROC_GETVERS, xdr_void, argp, xdr_amq_string, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
- return (&res);
+ return (&clnt_res);
}
diff --git a/usr.sbin/amd/rpcx/amq_svc.c b/usr.sbin/amd/rpcx/amq_svc.c
index d9d3a98b61c..fff6090fd08 100644
--- a/usr.sbin/amd/rpcx/amq_svc.c
+++ b/usr.sbin/amd/rpcx/amq_svc.c
@@ -1,50 +1,42 @@
/*
- * Copyright (c) 1990 Jan-Simon Pendry
- * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jan-Simon Pendry at Imperial College, London.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)amq_svc.c 8.1 (Berkeley) 6/6/93
- * $Id: amq_svc.c,v 1.8 2014/10/26 03:03:34 guenther Exp $
- *
+ * Please do not edit this file.
+ * It was generated using rpcgen.
*/
-#include <sys/types.h>
+#include "amq.h"
+#include "am.h"
+#include <arpa/inet.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>/* getenv, exit */
+#include <rpc/pmap_clnt.h> /* for pmap_unset */
+#include <string.h> /* strcmp */
+#include <netdb.h>
+#include <signal.h>
+#include <sys/ttycom.h>/* TIOCNOTTY */
+#ifdef __cplusplus
+#include <sysent.h> /* getdtablesize, open */
+#endif /* __cplusplus */
+#include <memory.h>
#include <sys/socket.h>
#include <netinet/in.h>
-#include <arpa/inet.h>
#include <syslog.h>
+#include <errno.h>
-#include "am.h"
-#include "amq.h"
-extern bool_t xdr_amq_mount_info_qelem();
+#ifdef __STDC__
+#define SIG_PF void(*)(int)
+#endif
+
+#ifdef DEBUG
+#define RPC_SVC_FG
+#endif
+
+#define _RPCSVC_CLOSEDOWN 120
+extern int _rpcpmstart; /* Started by a port monitor ? */
+extern int _rpcfdtype; /* Whether Stream or Datagram ? */
+
+
+void amq_program_1(struct svc_req *rqstp, SVCXPRT *transp);
void
amq_program_1(struct svc_req *rqstp, SVCXPRT *transp)
@@ -56,8 +48,8 @@ amq_program_1(struct svc_req *rqstp, SVCXPRT *transp)
amq_string amqproc_mount_1_arg;
} argument;
char *result;
- bool_t (*xdr_argument)(), (*xdr_result)();
- char *(*local)();
+ xdrproc_t xdr_argument, xdr_result;
+ char *(*local)(char *, struct svc_req *);
extern SVCXPRT *lamqp;
if (transp != lamqp) {
@@ -72,74 +64,75 @@ amq_program_1(struct svc_req *rqstp, SVCXPRT *transp)
switch (rqstp->rq_proc) {
case AMQPROC_NULL:
- xdr_argument = xdr_void;
- xdr_result = xdr_void;
- local = (char *(*)()) amqproc_null_1_svc;
+ xdr_argument = (xdrproc_t) xdr_void;
+ xdr_result = (xdrproc_t) xdr_void;
+ local = (char *(*)(char *, struct svc_req *)) amqproc_null_1_svc;
break;
case AMQPROC_MNTTREE:
- xdr_argument = xdr_amq_string;
- xdr_result = xdr_amq_mount_tree_p;
- local = (char *(*)()) amqproc_mnttree_1_svc;
+ xdr_argument = (xdrproc_t) xdr_amq_string;
+ xdr_result = (xdrproc_t) xdr_amq_mount_tree_p;
+ local = (char *(*)(char *, struct svc_req *)) amqproc_mnttree_1_svc;
break;
case AMQPROC_UMNT:
- xdr_argument = xdr_amq_string;
- xdr_result = xdr_void;
- local = (char *(*)()) amqproc_umnt_1_svc;
+ xdr_argument = (xdrproc_t) xdr_amq_string;
+ xdr_result = (xdrproc_t) xdr_void;
+ local = (char *(*)(char *, struct svc_req *)) amqproc_umnt_1_svc;
break;
case AMQPROC_STATS:
- xdr_argument = xdr_void;
- xdr_result = xdr_amq_mount_stats;
- local = (char *(*)()) amqproc_stats_1_svc;
+ xdr_argument = (xdrproc_t) xdr_void;
+ xdr_result = (xdrproc_t) xdr_amq_mount_stats;
+ local = (char *(*)(char *, struct svc_req *)) amqproc_stats_1_svc;
break;
case AMQPROC_EXPORT:
- xdr_argument = xdr_void;
- xdr_result = xdr_amq_mount_tree_list;
- local = (char *(*)()) amqproc_export_1_svc;
+ xdr_argument = (xdrproc_t) xdr_void;
+ xdr_result = (xdrproc_t) xdr_amq_mount_tree_list;
+ local = (char *(*)(char *, struct svc_req *)) amqproc_export_1_svc;
break;
case AMQPROC_SETOPT:
- xdr_argument = xdr_amq_setopt;
- xdr_result = xdr_int;
- local = (char *(*)()) amqproc_setopt_1_svc;
+ xdr_argument = (xdrproc_t) xdr_amq_setopt;
+ xdr_result = (xdrproc_t) xdr_int;
+ local = (char *(*)(char *, struct svc_req *)) amqproc_setopt_1_svc;
break;
case AMQPROC_GETMNTFS:
- xdr_argument = xdr_void;
- xdr_result = xdr_amq_mount_info_qelem;
- local = (char *(*)()) amqproc_getmntfs_1_svc;
+ xdr_argument = (xdrproc_t) xdr_void;
+ xdr_result = (xdrproc_t) xdr_amq_mount_info_list;
+ local = (char *(*)(char *, struct svc_req *)) amqproc_getmntfs_1_svc;
break;
case AMQPROC_MOUNT:
- xdr_argument = xdr_amq_string;
- xdr_result = xdr_int;
- local = (char *(*)()) amqproc_mount_1_svc;
+ xdr_argument = (xdrproc_t) xdr_amq_string;
+ xdr_result = (xdrproc_t) xdr_int;
+ local = (char *(*)(char *, struct svc_req *)) amqproc_mount_1_svc;
break;
case AMQPROC_GETVERS:
- xdr_argument = xdr_void;
- xdr_result = xdr_amq_string;
- local = (char *(*)()) amqproc_getvers_1_svc;
+ xdr_argument = (xdrproc_t) xdr_void;
+ xdr_result = (xdrproc_t) xdr_amq_string;
+ local = (char *(*)(char *, struct svc_req *)) amqproc_getvers_1_svc;
break;
default:
svcerr_noproc(transp);
return;
}
- bzero((char *)&argument, sizeof(argument));
- if (!svc_getargs(transp, xdr_argument, (char *)&argument)) {
+ (void) memset((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
svcerr_decode(transp);
return;
}
- result = (*local)(&argument, rqstp);
+ result = (*local)((char *)&argument, rqstp);
if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
svcerr_systemerr(transp);
}
- if (!svc_freeargs(transp, xdr_argument, (char *)&argument)) {
- plog(XLOG_FATAL, "unable to free rpc arguments in amqprog_1");
+ if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
+ plog(XLOG_FATAL, "unable to free rpc arguments in amqprog");
going_down(1);
}
+ return;
}
diff --git a/usr.sbin/amd/rpcx/amq_svc.extra b/usr.sbin/amd/rpcx/amq_svc.extra
new file mode 100644
index 00000000000..8c42663ce31
--- /dev/null
+++ b/usr.sbin/amd/rpcx/amq_svc.extra
@@ -0,0 +1,11 @@
+ extern SVCXPRT *lamqp;
+
+ if (transp != lamqp) {
+ struct sockaddr_in *fromsin = svc_getcaller(transp);
+
+ syslog(LOG_WARNING,
+ "non-local amq attempt (might be from %s)",
+ inet_ntoa(fromsin->sin_addr));
+ svcerr_noproc(transp);
+ return;
+ }
diff --git a/usr.sbin/amd/rpcx/amq_xdr.c b/usr.sbin/amd/rpcx/amq_xdr.c
index d3c6204272a..1f054da2d1c 100644
--- a/usr.sbin/amd/rpcx/amq_xdr.c
+++ b/usr.sbin/amd/rpcx/amq_xdr.c
@@ -1,206 +1,150 @@
/*
- * Copyright (c) 1990 Jan-Simon Pendry
- * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jan-Simon Pendry at Imperial College, London.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)amq_xdr.c 8.1 (Berkeley) 6/6/93
- * $Id: amq_xdr.c,v 1.5 2003/06/02 23:36:52 millert Exp $
- *
+ * Please do not edit this file.
+ * It was generated using rpcgen.
*/
-#include "am.h"
#include "amq.h"
bool_t
xdr_amq_string(XDR *xdrs, amq_string *objp)
{
- if (!xdr_string(xdrs, objp, AMQ_STRLEN)) {
+
+ if (!xdr_string(xdrs, objp, AMQ_STRLEN))
return (FALSE);
- }
return (TRUE);
}
bool_t
xdr_time_type(XDR *xdrs, time_type *objp)
{
- if (!xdr_int(xdrs, (int *) objp)) {
+
+ if (!xdr_int(xdrs, objp))
return (FALSE);
- }
return (TRUE);
}
bool_t
xdr_amq_mount_tree(XDR *xdrs, amq_mount_tree *objp)
{
- if (!xdr_amq_string(xdrs, &objp->mt_mountinfo)) {
+
+
+ if (!xdr_amq_string(xdrs, &objp->mt_mountinfo))
return (FALSE);
- }
- if (!xdr_amq_string(xdrs, &objp->mt_directory)) {
+ if (!xdr_amq_string(xdrs, &objp->mt_directory))
return (FALSE);
- }
- if (!xdr_amq_string(xdrs, &objp->mt_mountpoint)) {
+ if (!xdr_amq_string(xdrs, &objp->mt_mountpoint))
return (FALSE);
- }
- if (!xdr_amq_string(xdrs, &objp->mt_type)) {
+ if (!xdr_amq_string(xdrs, &objp->mt_type))
return (FALSE);
- }
- if (!xdr_time_type(xdrs, &objp->mt_mounttime)) {
+ if (!xdr_time_type(xdrs, &objp->mt_mounttime))
return (FALSE);
- }
- if (!xdr_u_short(xdrs, &objp->mt_mountuid)) {
+ if (!xdr_u_short(xdrs, &objp->mt_mountuid))
return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->mt_getattr)) {
+ if (!xdr_int(xdrs, &objp->mt_getattr))
return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->mt_lookup)) {
+ if (!xdr_int(xdrs, &objp->mt_lookup))
return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->mt_readdir)) {
+ if (!xdr_int(xdrs, &objp->mt_readdir))
return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->mt_readlink)) {
+ if (!xdr_int(xdrs, &objp->mt_readlink))
return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->mt_statfs)) {
+ if (!xdr_int(xdrs, &objp->mt_statfs))
return (FALSE);
- }
- if (!xdr_pointer(xdrs, (char **)&objp->mt_next,
- sizeof(amq_mount_tree), xdr_amq_mount_tree)) {
+ if (!xdr_pointer(xdrs, (char **)&objp->mt_next, sizeof(amq_mount_tree), (xdrproc_t)xdr_amq_mount_tree))
return (FALSE);
- }
- if (!xdr_pointer(xdrs, (char **)&objp->mt_child,
- sizeof(amq_mount_tree), xdr_amq_mount_tree)) {
+ if (!xdr_pointer(xdrs, (char **)&objp->mt_child, sizeof(amq_mount_tree), (xdrproc_t)xdr_amq_mount_tree))
return (FALSE);
- }
return (TRUE);
}
bool_t
xdr_amq_mount_tree_p(XDR *xdrs, amq_mount_tree_p *objp)
{
- if (!xdr_pointer(xdrs, (char **)objp, sizeof(amq_mount_tree),
- xdr_amq_mount_tree)) {
+
+ if (!xdr_pointer(xdrs, (char **)objp, sizeof(amq_mount_tree), (xdrproc_t)xdr_amq_mount_tree))
return (FALSE);
- }
return (TRUE);
}
bool_t
xdr_amq_mount_info(XDR *xdrs, amq_mount_info *objp)
{
- if (!xdr_amq_string(xdrs, &objp->mi_type)) {
+
+
+ if (!xdr_amq_string(xdrs, &objp->mi_type))
return (FALSE);
- }
- if (!xdr_amq_string(xdrs, &objp->mi_mountpt)) {
+ if (!xdr_amq_string(xdrs, &objp->mi_mountpt))
return (FALSE);
- }
- if (!xdr_amq_string(xdrs, &objp->mi_mountinfo)) {
+ if (!xdr_amq_string(xdrs, &objp->mi_mountinfo))
return (FALSE);
- }
- if (!xdr_amq_string(xdrs, &objp->mi_fserver)) {
+ if (!xdr_amq_string(xdrs, &objp->mi_fserver))
return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->mi_error)) {
+ if (!xdr_int(xdrs, &objp->mi_error))
return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->mi_refc)) {
+ if (!xdr_int(xdrs, &objp->mi_refc))
return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->mi_up)) {
+ if (!xdr_int(xdrs, &objp->mi_up))
return (FALSE);
- }
return (TRUE);
}
bool_t
xdr_amq_mount_info_list(XDR *xdrs, amq_mount_info_list *objp)
{
+
if (!xdr_array(xdrs, (char **)&objp->amq_mount_info_list_val,
- (u_int *)&objp->amq_mount_info_list_len, ~0,
- sizeof(amq_mount_info), xdr_amq_mount_info)) {
+ (u_int *)&objp->amq_mount_info_list_len,
+ ~0, sizeof(amq_mount_info), (xdrproc_t)xdr_amq_mount_info))
return (FALSE);
- }
return (TRUE);
}
bool_t
xdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp)
{
+
if (!xdr_array(xdrs, (char **)&objp->amq_mount_tree_list_val,
- (u_int *)&objp->amq_mount_tree_list_len, ~0,
- sizeof(amq_mount_tree_p), xdr_amq_mount_tree_p)) {
+ (u_int *)&objp->amq_mount_tree_list_len,
+ ~0, sizeof(amq_mount_tree_p), (xdrproc_t)xdr_amq_mount_tree_p))
return (FALSE);
- }
return (TRUE);
}
bool_t
xdr_amq_mount_stats(XDR *xdrs, amq_mount_stats *objp)
{
- if (!xdr_int(xdrs, &objp->as_drops)) {
+
+
+ if (!xdr_int(xdrs, &objp->as_drops))
return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->as_stale)) {
+ if (!xdr_int(xdrs, &objp->as_stale))
return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->as_mok)) {
+ if (!xdr_int(xdrs, &objp->as_mok))
return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->as_merr)) {
+ if (!xdr_int(xdrs, &objp->as_merr))
return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->as_uerr)) {
+ if (!xdr_int(xdrs, &objp->as_uerr))
return (FALSE);
- }
return (TRUE);
}
bool_t
xdr_amq_opt(XDR *xdrs, amq_opt *objp)
{
- if (!xdr_enum(xdrs, (enum_t *)objp)) {
+
+ if (!xdr_enum(xdrs, (enum_t *)objp))
return (FALSE);
- }
return (TRUE);
}
bool_t
xdr_amq_setopt(XDR *xdrs, amq_setopt *objp)
{
- if (!xdr_amq_opt(xdrs, &objp->as_opt)) {
+
+
+ if (!xdr_amq_opt(xdrs, &objp->as_opt))
return (FALSE);
- }
- if (!xdr_amq_string(xdrs, &objp->as_str)) {
+ if (!xdr_amq_string(xdrs, &objp->as_str))
return (FALSE);
- }
return (TRUE);
}