Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/mountd/mountd.c
Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | struct exportlist { | ||||
int ex_numsecflavors; | int ex_numsecflavors; | ||||
int ex_secflavors[MAXSECFLAVORS]; | int ex_secflavors[MAXSECFLAVORS]; | ||||
int ex_defnumsecflavors; | int ex_defnumsecflavors; | ||||
int ex_defsecflavors[MAXSECFLAVORS]; | int ex_defsecflavors[MAXSECFLAVORS]; | ||||
SLIST_ENTRY(exportlist) entries; | SLIST_ENTRY(exportlist) entries; | ||||
}; | }; | ||||
/* ex_flag bits */ | /* ex_flag bits */ | ||||
#define EX_LINKED 0x1 | #define EX_LINKED 0x01 | ||||
#define EX_DONE 0x2 | #define EX_DONE 0x02 | ||||
#define EX_DEFSET 0x4 | #define EX_DEFSET 0x04 | ||||
#define EX_PUBLICFH 0x8 | #define EX_PUBLICFH 0x08 | ||||
#define EX_ADMINWARN 0x10 | |||||
SLIST_HEAD(exportlisthead, exportlist); | SLIST_HEAD(exportlisthead, exportlist); | ||||
struct netmsk { | struct netmsk { | ||||
struct sockaddr_storage nt_net; | struct sockaddr_storage nt_net; | ||||
struct sockaddr_storage nt_mask; | struct sockaddr_storage nt_mask; | ||||
char *nt_name; | char *nt_name; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | |||||
static struct exportlisthead *exphead = NULL; | static struct exportlisthead *exphead = NULL; | ||||
static struct exportlisthead *oldexphead = NULL; | static struct exportlisthead *oldexphead = NULL; | ||||
static int exphashsize = 0; | static int exphashsize = 0; | ||||
static SLIST_HEAD(, mountlist) mlhead = SLIST_HEAD_INITIALIZER(&mlhead); | static SLIST_HEAD(, mountlist) mlhead = SLIST_HEAD_INITIALIZER(&mlhead); | ||||
static char *exnames_default[2] = { _PATH_EXPORTS, NULL }; | static char *exnames_default[2] = { _PATH_EXPORTS, NULL }; | ||||
static char **exnames; | static char **exnames; | ||||
static char **hosts = NULL; | static char **hosts = NULL; | ||||
static int force_v2 = 0; | static int force_v2 = 0; | ||||
static int warn_admin = 1; | |||||
emaste: we could start sneaking C99 in, if you're so inclined
`static bool warn_admin = true` | |||||
Done Inline ActionsSun RPC has its own bool definition that rmacklem: Sun RPC has its own bool definition that
is not compatible with stdbool.h.
(There is probably… | |||||
static int resvport_only = 1; | static int resvport_only = 1; | ||||
static int nhosts = 0; | static int nhosts = 0; | ||||
static int dir_only = 1; | static int dir_only = 1; | ||||
static int dolog = 0; | static int dolog = 0; | ||||
static _Atomic(int) got_sighup = 0; | static _Atomic(int) got_sighup = 0; | ||||
static int xcreated = 0; | static int xcreated = 0; | ||||
static char *svcport_str = NULL; | static char *svcport_str = NULL; | ||||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | main(int argc, char **argv) | ||||
} | } | ||||
s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); | s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); | ||||
if (s < 0) | if (s < 0) | ||||
have_v6 = 0; | have_v6 = 0; | ||||
else | else | ||||
close(s); | close(s); | ||||
while ((c = getopt(argc, argv, "2deh:lnp:RrS")) != -1) | while ((c = getopt(argc, argv, "2Adeh:lnp:RrS")) != -1) | ||||
switch (c) { | switch (c) { | ||||
case '2': | case '2': | ||||
force_v2 = 1; | force_v2 = 1; | ||||
break; | break; | ||||
case 'A': | |||||
warn_admin = 0; | |||||
break; | |||||
case 'e': | case 'e': | ||||
/* now a no-op, since this is the default */ | /* now a no-op, since this is the default */ | ||||
break; | break; | ||||
case 'n': | case 'n': | ||||
resvport_only = 0; | resvport_only = 0; | ||||
break; | break; | ||||
case 'R': | case 'R': | ||||
/* Do not support Mount protocol */ | /* Do not support Mount protocol */ | ||||
▲ Show 20 Lines • Show All 1,239 Lines • ▼ Show 20 Lines | while (len > 0) { | ||||
warnx( | warnx( | ||||
"making new ep fs=0x%x,0x%x", | "making new ep fs=0x%x,0x%x", | ||||
fsb.f_fsid.val[0], | fsb.f_fsid.val[0], | ||||
fsb.f_fsid.val[1]); | fsb.f_fsid.val[1]); | ||||
} else if (debug) | } else if (debug) | ||||
warnx("found ep fs=0x%x,0x%x", | warnx("found ep fs=0x%x,0x%x", | ||||
fsb.f_fsid.val[0], | fsb.f_fsid.val[0], | ||||
fsb.f_fsid.val[1]); | fsb.f_fsid.val[1]); | ||||
} | |||||
if (warn_admin != 0 && | |||||
(ep->ex_flag & EX_ADMINWARN) == 0 && | |||||
strcmp(unvis_dir, fsb.f_mntonname) != | |||||
0) { | |||||
if (debug) | |||||
warnx("exporting %s exports entire " | |||||
"%s file system", unvis_dir, | |||||
fsb.f_mntonname); | |||||
syslog(LOG_ERR, "Warning: exporting %s " | |||||
"exports entire %s file system", | |||||
unvis_dir, fsb.f_mntonname); | |||||
ep->ex_flag |= EX_ADMINWARN; | |||||
} | } | ||||
/* | /* | ||||
* Add dirpath to export mount point. | * Add dirpath to export mount point. | ||||
*/ | */ | ||||
dirp = add_expdir(&dirhead, unvis_dir, | dirp = add_expdir(&dirhead, unvis_dir, | ||||
unvis_len); | unvis_len); | ||||
dirplen = unvis_len; | dirplen = unvis_len; | ||||
▲ Show 20 Lines • Show All 2,316 Lines • Show Last 20 Lines |
we could start sneaking C99 in, if you're so inclined
static bool warn_admin = true