| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: mountd.c,v 1.126 2014/04/04 12:45:59 gson Exp $ */ | | 1 | /* $NetBSD: mountd.c,v 1.126.4.1 2015/08/06 21:59:04 snj Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1989, 1993 | | 4 | * Copyright (c) 1989, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Herb Hasler and Rick Macklem at The University of Guelph. | | 8 | * Herb Hasler and Rick Macklem at The University of Guelph. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -32,27 +32,27 @@ | | | @@ -32,27 +32,27 @@ |
32 | * SUCH DAMAGE. | | 32 | * SUCH DAMAGE. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | #include <sys/cdefs.h> | | 35 | #include <sys/cdefs.h> |
36 | #ifndef lint | | 36 | #ifndef lint |
37 | __COPYRIGHT("@(#) Copyright (c) 1989, 1993\ | | 37 | __COPYRIGHT("@(#) Copyright (c) 1989, 1993\ |
38 | The Regents of the University of California. All rights reserved."); | | 38 | The Regents of the University of California. All rights reserved."); |
39 | #endif /* not lint */ | | 39 | #endif /* not lint */ |
40 | | | 40 | |
41 | #ifndef lint | | 41 | #ifndef lint |
42 | #if 0 | | 42 | #if 0 |
43 | static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95"; | | 43 | static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95"; |
44 | #else | | 44 | #else |
45 | __RCSID("$NetBSD: mountd.c,v 1.126 2014/04/04 12:45:59 gson Exp $"); | | 45 | __RCSID("$NetBSD: mountd.c,v 1.126.4.1 2015/08/06 21:59:04 snj Exp $"); |
46 | #endif | | 46 | #endif |
47 | #endif /* not lint */ | | 47 | #endif /* not lint */ |
48 | | | 48 | |
49 | #include <sys/param.h> | | 49 | #include <sys/param.h> |
50 | #include <sys/file.h> | | 50 | #include <sys/file.h> |
51 | #include <sys/ioctl.h> | | 51 | #include <sys/ioctl.h> |
52 | #include <sys/mount.h> | | 52 | #include <sys/mount.h> |
53 | #include <sys/socket.h> | | 53 | #include <sys/socket.h> |
54 | #include <sys/stat.h> | | 54 | #include <sys/stat.h> |
55 | #include <syslog.h> | | 55 | #include <syslog.h> |
56 | #include <sys/ucred.h> | | 56 | #include <sys/ucred.h> |
57 | | | 57 | |
58 | #include <rpc/rpc.h> | | 58 | #include <rpc/rpc.h> |
| @@ -326,27 +326,26 @@ main(int argc, char **argv) | | | @@ -326,27 +326,26 @@ main(int argc, char **argv) |
326 | else | | 326 | else |
327 | close(s); | | 327 | close(s); |
328 | | | 328 | |
329 | if (debug) | | 329 | if (debug) |
330 | (void)fprintf(stderr, "Getting export list.\n"); | | 330 | (void)fprintf(stderr, "Getting export list.\n"); |
331 | get_exportlist(0); | | 331 | get_exportlist(0); |
332 | if (debug) | | 332 | if (debug) |
333 | (void)fprintf(stderr, "Getting mount list.\n"); | | 333 | (void)fprintf(stderr, "Getting mount list.\n"); |
334 | get_mountlist(); | | 334 | get_mountlist(); |
335 | if (debug) | | 335 | if (debug) |
336 | (void)fprintf(stderr, "Here we go.\n"); | | 336 | (void)fprintf(stderr, "Here we go.\n"); |
337 | (void)signal(SIGHUP, get_exportlist); | | 337 | (void)signal(SIGHUP, get_exportlist); |
338 | (void)signal(SIGTERM, send_umntall); | | 338 | (void)signal(SIGTERM, send_umntall); |
339 | pidfile(NULL); | | | |
340 | | | 339 | |
341 | rpcb_unset(RPCPROG_MNT, RPCMNT_VER1, NULL); | | 340 | rpcb_unset(RPCPROG_MNT, RPCMNT_VER1, NULL); |
342 | rpcb_unset(RPCPROG_MNT, RPCMNT_VER3, NULL); | | 341 | rpcb_unset(RPCPROG_MNT, RPCMNT_VER3, NULL); |
343 | | | 342 | |
344 | udpsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); | | 343 | udpsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); |
345 | tcpsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); | | 344 | tcpsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); |
346 | udp6sock = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); | | 345 | udp6sock = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); |
347 | tcp6sock = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP); | | 346 | tcp6sock = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP); |
348 | | | 347 | |
349 | /* | | 348 | /* |
350 | * We're doing host-based access checks here, so don't allow | | 349 | * We're doing host-based access checks here, so don't allow |
351 | * v4-in-v6 to confuse things. The kernel will disable it | | 350 | * v4-in-v6 to confuse things. The kernel will disable it |
352 | * by default on NFS sockets too. | | 351 | * by default on NFS sockets too. |
| @@ -453,26 +452,27 @@ main(int argc, char **argv) | | | @@ -453,26 +452,27 @@ main(int argc, char **argv) |
453 | | | 452 | |
454 | } | | 453 | } |
455 | | | 454 | |
456 | if (xcreated == 0) { | | 455 | if (xcreated == 0) { |
457 | syslog(LOG_ERR, "could not create any services"); | | 456 | syslog(LOG_ERR, "could not create any services"); |
458 | exit(1); | | 457 | exit(1); |
459 | } | | 458 | } |
460 | | | 459 | |
461 | if (debug == 0) { | | 460 | if (debug == 0) { |
462 | daemon(0, 0); | | 461 | daemon(0, 0); |
463 | (void)signal(SIGINT, SIG_IGN); | | 462 | (void)signal(SIGINT, SIG_IGN); |
464 | (void)signal(SIGQUIT, SIG_IGN); | | 463 | (void)signal(SIGQUIT, SIG_IGN); |
465 | } | | 464 | } |
| | | 465 | pidfile(NULL); |
466 | svc_run(); | | 466 | svc_run(); |
467 | syslog(LOG_ERR, "Mountd died"); | | 467 | syslog(LOG_ERR, "Mountd died"); |
468 | exit(1); | | 468 | exit(1); |
469 | } | | 469 | } |
470 | | | 470 | |
471 | /* | | 471 | /* |
472 | * The mount rpc service | | 472 | * The mount rpc service |
473 | */ | | 473 | */ |
474 | void | | 474 | void |
475 | mntsrv(struct svc_req *rqstp, SVCXPRT *transp) | | 475 | mntsrv(struct svc_req *rqstp, SVCXPRT *transp) |
476 | { | | 476 | { |
477 | struct exportlist *ep; | | 477 | struct exportlist *ep; |
478 | struct dirlist *dp; | | 478 | struct dirlist *dp; |