* 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 $
*/
/*
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;
* 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;
* 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;
* 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;
}
* 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;
}
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;
}
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;
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);
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)) {
* 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 $
*/
/*
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;
/*
* 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;
nodefault = 1;
break;
- case 'M':
- mount_map = optarg;
- nodefault = 1;
- break;
-
default:
errs = 1;
break;
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);
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);
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);
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",
*/
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);
}
}
- /*
- * 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);
/*
* 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) {
} 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 {
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;