summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-01-21 09:51:24 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-01-21 09:51:24 +0000
commit04fb38d777e51cc86b816f377e283538723438dc (patch)
tree579440356173b93718c7334db0619f48733a4fb4
parent445d64b5f457d391ed0fd6ddc034ebc45aa1aea6 (diff)
Pass times as int64_t and eliminate the (long disabled) mount request.
ABI change, so roll the RPC protocol version; how about 57 for OpenBSD 5.7?
-rw-r--r--usr.sbin/amd/amd/amq_subr.c106
-rw-r--r--usr.sbin/amd/amd/nfs_start.c4
-rw-r--r--usr.sbin/amd/amq/amq.c48
-rw-r--r--usr.sbin/amd/include/am.h4
-rw-r--r--usr.sbin/amd/rpcx/amq.x15
5 files changed, 31 insertions, 146 deletions
diff --git a/usr.sbin/amd/amd/amq_subr.c b/usr.sbin/amd/amd/amq_subr.c
index 63407903c2d..575bacf1602 100644
--- a/usr.sbin/amd/amd/amq_subr.c
+++ b/usr.sbin/amd/amd/amq_subr.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)amq_subr.c 8.1 (Berkeley) 6/6/93
- * $Id: amq_subr.c,v 1.17 2015/01/21 08:24:41 guenther Exp $
+ * $Id: amq_subr.c,v 1.18 2015/01/21 09:50:25 guenther Exp $
*/
/*
@@ -46,7 +46,7 @@
bool_t xdr_amq_mount_info_list(XDR *, amq_mount_info_list *);
void *
-amqproc_null_1_svc(void *argp, struct svc_req *rqstp)
+amqproc_null_57_svc(void *argp, struct svc_req *rqstp)
{
static char res;
@@ -57,7 +57,7 @@ amqproc_null_1_svc(void *argp, struct svc_req *rqstp)
* Return a sub-tree of mounts
*/
amq_mount_tree_p *
-amqproc_mnttree_1_svc(amq_string *argp, struct svc_req *rqstp)
+amqproc_mnttree_57_svc(amq_string *argp, struct svc_req *rqstp)
{
static am_node *mp;
@@ -69,7 +69,7 @@ amqproc_mnttree_1_svc(amq_string *argp, struct svc_req *rqstp)
* Unmount a single node
*/
void *
-amqproc_umnt_1_svc(amq_string *argp, struct svc_req *rqstp)
+amqproc_umnt_57_svc(amq_string *argp, struct svc_req *rqstp)
{
static char res;
@@ -84,7 +84,7 @@ amqproc_umnt_1_svc(amq_string *argp, struct svc_req *rqstp)
* Return global statistics
*/
amq_mount_stats *
-amqproc_stats_1_svc(void *argp, struct svc_req *rqstp)
+amqproc_stats_57_svc(void *argp, struct svc_req *rqstp)
{
return (amq_mount_stats *) &amd_stats;
}
@@ -93,7 +93,7 @@ amqproc_stats_1_svc(void *argp, struct svc_req *rqstp)
* Return the entire tree of mount nodes
*/
amq_mount_tree_list *
-amqproc_export_1_svc(void *argp, struct svc_req *rqstp)
+amqproc_export_57_svc(void *argp, struct svc_req *rqstp)
{
static amq_mount_tree_list aml;
@@ -104,7 +104,7 @@ amqproc_export_1_svc(void *argp, struct svc_req *rqstp)
}
int *
-amqproc_setopt_1_svc(amq_setopt *argp, struct svc_req *rqstp)
+amqproc_setopt_57_svc(amq_setopt *argp, struct svc_req *rqstp)
{
static int rc;
@@ -146,98 +146,14 @@ amqproc_setopt_1_svc(amq_setopt *argp, struct svc_req *rqstp)
}
amq_mount_info_list *
-amqproc_getmntfs_1_svc(void *argp, struct svc_req *rqstp)
+amqproc_getmntfs_57_svc(void *argp, struct svc_req *rqstp)
{
extern qelem mfhead;
return (amq_mount_info_list *) &mfhead; /* XXX */
}
-#if 0
-/*
- * amd does not allocate a separate socket to distinguish local
- * connects so this "security" check is useless.
- */
-static int ok_security(rqstp)
-struct svc_req *rqstp;
-{
- struct sockaddr_in *sin;
-
- sin = svc_getcaller(rqstp->rq_xprt);
- if (ntohs(sin->sin_port) >= 1024 ||
- !(sin->sin_addr.s_addr == htonl(0x7f000001) ||
- sin->sin_addr.s_addr == myipaddr.s_addr)) {
- char dq[20];
- plog(XLOG_INFO, "AMQ request from %s.%d DENIED",
- inet_dquad(dq, sizeof(dq), sin->sin_addr.s_addr),
- ntohs(sin->sin_port));
- return(0);
- }
- return(1);
-}
-
-int *
-amqproc_mount_1_svc(amq_string *argp, struct svc_req *rqstp)
-{
- static int rc;
- char *s = *argp;
- char *cp;
-
- plog(XLOG_INFO, "amq requested mount of %s", s);
-
- /*
- * Minimalist (read useless) security check.
- */
- if (!ok_security(rqstp)) {
- rc = EACCES;
- return &rc;
- }
-
- /*
- * Find end of key
- */
- for (cp = (char *) s;
- *cp&&(!isascii((unsigned char)*cp) || !isspace((unsigned char)*cp));
- cp++)
- ;
-
- if (!*cp) {
- plog(XLOG_INFO, "amqproc_mount: Invalid arguments");
- rc = EINVAL;
- return &rc;
- }
- *cp++ = '\0';
-
- /*
- * Find start of value
- */
- while (isascii((unsigned char)*cp) && isspace((unsigned char)*cp))
- cp++;
-
- root_newmap(s, cp, (char *) 0);
- rc = mount_auto_node(s, root_node);
- if (rc < 0)
- return 0;
- return &rc;
-}
-#else
-/*
- * Disable "amq -M" functionality since it is inherently insecure.
- */
-int *
-amqproc_mount_1_svc(amq_string *argp, struct svc_req *rqstp)
-{
- static int rc;
- char *s = *argp;
-
- plog(XLOG_ERROR, "amq requested mount of %s, but code is disabled", s);
-
- rc = EACCES;
- return &rc;
-}
-#endif
-
amq_string *
-amqproc_getvers_1_svc(void *argp, struct svc_req *rqstp)
+amqproc_getvers_57_svc(void *argp, struct svc_req *rqstp)
{
static amq_string res;
@@ -276,6 +192,7 @@ static bool_t
xdr_amq_mount_tree_node(XDR *xdrs, amq_mount_tree *objp)
{
am_node *mp = (am_node *) objp;
+ long long mounttime = mp->am_stats.s_mtime;
if (!xdr_amq_string(xdrs, &mp->am_mnt->mf_info)) {
return (FALSE);
@@ -289,8 +206,7 @@ xdr_amq_mount_tree_node(XDR *xdrs, amq_mount_tree *objp)
if (!xdr_amq_string(xdrs, &mp->am_mnt->mf_ops->fs_type)) {
return (FALSE);
}
- /* XXX really a time_t, but need to transmit a 32-bit integer */
- if (!xdr_int(xdrs, (int *)&mp->am_stats.s_mtime)) {
+ if (!xdr_int64_t(xdrs, &mounttime)) {
return (FALSE);
}
if (!xdr_u_short(xdrs, &mp->am_stats.s_uid)) {
diff --git a/usr.sbin/amd/amd/nfs_start.c b/usr.sbin/amd/amd/nfs_start.c
index c91f8996bda..96054c0c9c0 100644
--- a/usr.sbin/amd/amd/nfs_start.c
+++ b/usr.sbin/amd/amd/nfs_start.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)nfs_start.c 8.1 (Berkeley) 6/6/93
- * $Id: nfs_start.c,v 1.18 2014/10/26 03:03:34 guenther Exp $
+ * $Id: nfs_start.c,v 1.19 2015/01/21 09:50:25 guenther Exp $
*/
#include "am.h"
@@ -442,7 +442,7 @@ mount_automounter(pid_t ppid)
*/
unregister_amq();
- if (!svc_register(amqp, AMQ_PROGRAM, AMQ_VERSION, amq_program_1, IPPROTO_UDP)) {
+ if (!svc_register(amqp, AMQ_PROGRAM, AMQ_VERSION, amq_program_57, IPPROTO_UDP)) {
plog(XLOG_FATAL, "unable to register (AMQ_PROGRAM, AMQ_VERSION, udp)");
return 3;
}
diff --git a/usr.sbin/amd/amq/amq.c b/usr.sbin/amd/amq/amq.c
index a28a23dc0b2..640c617a523 100644
--- a/usr.sbin/amd/amq/amq.c
+++ b/usr.sbin/amd/amq/amq.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)amq.c 8.1 (Berkeley) 6/7/93
- * $Id: amq.c,v 1.17 2015/01/21 08:24:41 guenther Exp $
+ * $Id: amq.c,v 1.18 2015/01/21 09:50:25 guenther Exp $
*/
/*
@@ -55,7 +55,6 @@ static int stats_flag;
static int getvers_flag;
static char *debug_opts;
static char *logfile;
-static char *mount_map;
static char *xlog_optstr;
static char localhost[] = "localhost";
static char *def_server = localhost;
@@ -231,7 +230,7 @@ main(int argc, char *argv[])
/*
* Parse arguments
*/
- while ((opt_ch = getopt(argc, argv, "fh:l:msuvx:D:M:")) != -1)
+ while ((opt_ch = getopt(argc, argv, "fh:l:msuvx:D:")) != -1)
switch (opt_ch) {
case 'f':
flush_flag = 1;
@@ -277,11 +276,6 @@ main(int argc, char *argv[])
nodefault = 1;
break;
- case 'M':
- mount_map = optarg;
- nodefault = 1;
- break;
-
default:
errs = 1;
break;
@@ -343,7 +337,7 @@ show_usage:
amq_setopt opt;
opt.as_opt = AMOPT_DEBUG;
opt.as_str = debug_opts;
- rc = amqproc_setopt_1(&opt, clnt);
+ rc = amqproc_setopt_57(&opt, clnt);
if (rc && *rc < 0) {
fprintf(stderr,
"%s: daemon not compiled for debug", __progname);
@@ -364,7 +358,7 @@ show_usage:
amq_setopt opt;
opt.as_opt = AMOPT_XLOG;
opt.as_str = xlog_optstr;
- rc = amqproc_setopt_1(&opt, clnt);
+ rc = amqproc_setopt_57(&opt, clnt);
if (!rc || *rc) {
fprintf(stderr, "%s: setting log level to \"%s\" failed\n",
__progname, xlog_optstr);
@@ -380,7 +374,7 @@ show_usage:
amq_setopt opt;
opt.as_opt = AMOPT_LOGFILE;
opt.as_str = logfile;
- rc = amqproc_setopt_1(&opt, clnt);
+ rc = amqproc_setopt_57(&opt, clnt);
if (!rc || *rc) {
fprintf(stderr, "%s: setting logfile to \"%s\" failed\n",
__progname, logfile);
@@ -396,7 +390,7 @@ show_usage:
amq_setopt opt;
opt.as_opt = AMOPT_FLUSHMAPC;
opt.as_str = "";
- rc = amqproc_setopt_1(&opt, clnt);
+ rc = amqproc_setopt_57(&opt, clnt);
if (!rc || *rc) {
fprintf(stderr,
"%s: amd on %s cannot flush the map cache\n",
@@ -410,7 +404,7 @@ show_usage:
*/
if (minfo_flag) {
int dummy;
- amq_mount_info_list *ml = amqproc_getmntfs_1(&dummy, clnt);
+ amq_mount_info_list *ml = amqproc_getmntfs_57(&dummy, clnt);
if (ml) {
int mwid = 0, dwid = 0, twid = 0;
show_mi(ml, Calc, &mwid, &dwid, &twid);
@@ -423,28 +417,10 @@ show_usage:
}
/*
- * Mount map
- */
- if (mount_map) {
- int *rc;
- do {
- rc = amqproc_mount_1(&mount_map, clnt);
- } while (rc && *rc < 0);
- if (!rc || *rc > 0) {
- if (rc)
- errno = *rc;
- else
- errno = ETIMEDOUT;
- fprintf(stderr, "%s: could not start new ", __progname);
- perror("autmount point");
- }
- }
-
- /*
* Get Version
*/
if (getvers_flag) {
- amq_string *spp = amqproc_getvers_1(NULL, clnt);
+ amq_string *spp = amqproc_getvers_57(NULL, clnt);
if (spp && *spp) {
printf("%s.\n", *spp);
free(*spp);
@@ -465,12 +441,12 @@ show_usage:
/*
* Unmount request
*/
- amqproc_umnt_1(&fs, clnt);
+ amqproc_umnt_57(&fs, clnt);
} else {
/*
* Stats request
*/
- amq_mount_tree_p *mtp = amqproc_mnttree_1(&fs, clnt);
+ amq_mount_tree_p *mtp = amqproc_mnttree_57(&fs, clnt);
if (mtp) {
amq_mount_tree *mt = *mtp;
if (mt) {
@@ -502,7 +478,7 @@ show_usage:
} else if (unmount_flag) {
goto show_usage;
} else if (stats_flag) {
- amq_mount_stats *ms = amqproc_stats_1(NULL, clnt);
+ amq_mount_stats *ms = amqproc_stats_57(NULL, clnt);
if (ms) {
show_ms(ms);
} else {
@@ -511,7 +487,7 @@ show_usage:
errs = 1;
}
} else if (!nodefault) {
- amq_mount_tree_list *mlp = amqproc_export_1(NULL, clnt);
+ amq_mount_tree_list *mlp = amqproc_export_57(NULL, clnt);
if (mlp) {
enum show_opt e = Calc;
int mwid = 0, dwid = 0, pwid = 0;
diff --git a/usr.sbin/amd/include/am.h b/usr.sbin/amd/include/am.h
index 46d5bedb584..1dca9b0056c 100644
--- a/usr.sbin/amd/include/am.h
+++ b/usr.sbin/amd/include/am.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: am.h,v 1.16 2014/10/26 03:03:34 guenther Exp $ */
+/* $OpenBSD: am.h,v 1.17 2015/01/21 09:51:23 guenther Exp $ */
/*
* Copyright (c) 1990 Jan-Simon Pendry
@@ -209,7 +209,7 @@ struct fhstatus;
*/
extern void am_mounted(am_node *);
extern void am_unmounted(am_node *);
-extern void amq_program_1(struct svc_req *, SVCXPRT *);
+extern void amq_program_57(struct svc_req *, SVCXPRT *);
extern pid_t background(void);
extern int bind_resv_port(int, unsigned short *);
extern int compute_mount_flags(struct mntent *);
diff --git a/usr.sbin/amd/rpcx/amq.x b/usr.sbin/amd/rpcx/amq.x
index 832e661a329..716b35f7ae8 100644
--- a/usr.sbin/amd/rpcx/amq.x
+++ b/usr.sbin/amd/rpcx/amq.x
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)amq.x 8.1 (Berkeley) 6/6/93
- * $Id: amq.x,v 1.5 2003/11/08 19:17:29 jmc Exp $
+ * $Id: amq.x,v 1.6 2015/01/21 09:49:37 guenther Exp $
*
*/
@@ -49,9 +49,8 @@ typedef string amq_string<AMQ_STRLEN>;
/*
* The type time_type should correspond to the system time_t
- * XXX int/long time_t garbage; this needs to be a 32-bit integer
*/
-typedef int time_type;
+typedef int64_t time_type;
/*
* A tree of what is mounted
@@ -167,15 +166,9 @@ program AMQ_PROGRAM {
AMQPROC_GETMNTFS(void) = 6;
/*
- * Mount a filesystem
- */
- int
- AMQPROC_MOUNT(amq_string) = 7;
-
- /*
* Get version info
*/
amq_string
- AMQPROC_GETVERS(void) = 8;
- } = 1;
+ AMQPROC_GETVERS(void) = 7;
+ } = 57;
} = 300019; /* Allocated by Sun, 89/8/29 */