rpc.umntall.c (146664) | rpc.umntall.c (194880) |
---|---|
1/* 2 * Copyright (c) 1999 Martin Blapp 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#ifndef lint 29static const char rcsid[] = | 1/* 2 * Copyright (c) 1999 Martin Blapp 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#ifndef lint 29static const char rcsid[] = |
30 "$FreeBSD: head/usr.sbin/rpc.umntall/rpc.umntall.c 146664 2005-05-27 00:05:16Z mux $"; | 30 "$FreeBSD: head/usr.sbin/rpc.umntall/rpc.umntall.c 194880 2009-06-24 18:42:21Z dfr $"; |
31#endif /* not lint */ 32 33#include <sys/param.h> 34#include <sys/ucred.h> 35#include <sys/mount.h> 36 37#include <rpc/rpc.h> | 31#endif /* not lint */ 32 33#include <sys/param.h> 34#include <sys/ucred.h> 35#include <sys/mount.h> 36 37#include <rpc/rpc.h> |
38#include <nfs/rpcv2.h> | 38#include <rpcsvc/mount.h> |
39 40#include <err.h> 41#include <netdb.h> 42#include <stdio.h> 43#include <stdlib.h> 44#include <string.h> 45#include <unistd.h> 46 --- 124 unchanged lines hidden (view full) --- 171int 172do_umntall(char *hostname) { 173 enum clnt_stat clnt_stat; 174 struct timeval try; 175 CLIENT *clp; 176 177 try.tv_sec = 3; 178 try.tv_usec = 0; | 39 40#include <err.h> 41#include <netdb.h> 42#include <stdio.h> 43#include <stdlib.h> 44#include <string.h> 45#include <unistd.h> 46 --- 124 unchanged lines hidden (view full) --- 171int 172do_umntall(char *hostname) { 173 enum clnt_stat clnt_stat; 174 struct timeval try; 175 CLIENT *clp; 176 177 try.tv_sec = 3; 178 try.tv_usec = 0; |
179 clp = clnt_create_timed(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp", | 179 clp = clnt_create_timed(hostname, MOUNTPROG, MOUNTVERS, "udp", |
180 &try); 181 if (clp == NULL) { | 180 &try); 181 if (clp == NULL) { |
182 warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT")); | 182 warnx("%s: %s", hostname, clnt_spcreateerror("MOUNTPROG")); |
183 return (0); 184 } 185 clp->cl_auth = authunix_create_default(); | 183 return (0); 184 } 185 clp->cl_auth = authunix_create_default(); |
186 clnt_stat = clnt_call(clp, RPCMNT_UMNTALL, | 186 clnt_stat = clnt_call(clp, MOUNTPROC_UMNTALL, |
187 (xdrproc_t)xdr_void, (caddr_t)0, 188 (xdrproc_t)xdr_void, (caddr_t)0, try); 189 if (clnt_stat != RPC_SUCCESS) | 187 (xdrproc_t)xdr_void, (caddr_t)0, 188 (xdrproc_t)xdr_void, (caddr_t)0, try); 189 if (clnt_stat != RPC_SUCCESS) |
190 warnx("%s: %s", hostname, clnt_sperror(clp, "RPCMNT_UMNTALL")); | 190 warnx("%s: %s", hostname, clnt_sperror(clp, "MOUNTPROC_UMNTALL")); |
191 auth_destroy(clp->cl_auth); 192 clnt_destroy(clp); 193 return (clnt_stat == RPC_SUCCESS); 194} 195 196/* 197 * Send a RPC_MNT UMOUNT request for dirp to hostname. 198 */ 199int 200do_umount(char *hostname, char *dirp) { 201 enum clnt_stat clnt_stat; 202 struct timeval try; 203 CLIENT *clp; 204 205 try.tv_sec = 3; 206 try.tv_usec = 0; | 191 auth_destroy(clp->cl_auth); 192 clnt_destroy(clp); 193 return (clnt_stat == RPC_SUCCESS); 194} 195 196/* 197 * Send a RPC_MNT UMOUNT request for dirp to hostname. 198 */ 199int 200do_umount(char *hostname, char *dirp) { 201 enum clnt_stat clnt_stat; 202 struct timeval try; 203 CLIENT *clp; 204 205 try.tv_sec = 3; 206 try.tv_usec = 0; |
207 clp = clnt_create_timed(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp", | 207 clp = clnt_create_timed(hostname, MOUNTPROG, MOUNTVERS, "udp", |
208 &try); 209 if (clp == NULL) { | 208 &try); 209 if (clp == NULL) { |
210 warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT")); | 210 warnx("%s: %s", hostname, clnt_spcreateerror("MOUNTPROG")); |
211 return (0); 212 } 213 clp->cl_auth = authsys_create_default(); | 211 return (0); 212 } 213 clp->cl_auth = authsys_create_default(); |
214 clnt_stat = clnt_call(clp, RPCMNT_UMOUNT, (xdrproc_t)xdr_dir, dirp, | 214 clnt_stat = clnt_call(clp, MOUNTPROC_UMNT, (xdrproc_t)xdr_dir, dirp, |
215 (xdrproc_t)xdr_void, (caddr_t)0, try); 216 if (clnt_stat != RPC_SUCCESS) | 215 (xdrproc_t)xdr_void, (caddr_t)0, try); 216 if (clnt_stat != RPC_SUCCESS) |
217 warnx("%s: %s", hostname, clnt_sperror(clp, "RPCMNT_UMOUNT")); | 217 warnx("%s: %s", hostname, clnt_sperror(clp, "MOUNTPROC_UMNT")); |
218 auth_destroy(clp->cl_auth); 219 clnt_destroy(clp); 220 return (clnt_stat == RPC_SUCCESS); 221} 222 223/* 224 * Check if the entry is still/already mounted. 225 */ --- 24 unchanged lines hidden (view full) --- 250 return (0); 251} 252 253/* 254 * xdr routines for mount rpc's 255 */ 256int 257xdr_dir(XDR *xdrsp, char *dirp) { | 218 auth_destroy(clp->cl_auth); 219 clnt_destroy(clp); 220 return (clnt_stat == RPC_SUCCESS); 221} 222 223/* 224 * Check if the entry is still/already mounted. 225 */ --- 24 unchanged lines hidden (view full) --- 250 return (0); 251} 252 253/* 254 * xdr routines for mount rpc's 255 */ 256int 257xdr_dir(XDR *xdrsp, char *dirp) { |
258 return (xdr_string(xdrsp, &dirp, RPCMNT_PATHLEN)); | 258 return (xdr_string(xdrsp, &dirp, MNTPATHLEN)); |
259} 260 261static void 262usage() { 263 (void)fprintf(stderr, "%s\n", 264 "usage: rpc.umntall [-kv] [-e expire] [-h host] [-p path]"); 265 exit(1); 266} | 259} 260 261static void 262usage() { 263 (void)fprintf(stderr, "%s\n", 264 "usage: rpc.umntall [-kv] [-e expire] [-h host] [-p path]"); 265 exit(1); 266} |