3 # Output info about NFS exports
5 require './file-lib.pl';
6 print "Content-type: text/plain\n\n";
8 # User has no access to NFS
13 &read_acl(\%acl, undef);
14 %einfo = &get_module_info("exports");
15 %dinfo = &get_module_info("dfsadmin");
16 #%binfo = &get_module_info("bsdexports"); # too hard
18 if (%einfo && &check_os_support(\%einfo)) {
20 &module_check("exports");
21 if (!&has_command("rpc.nfsd") && !&has_command("nfsd")) {
26 &foreign_require("exports", "exports-lib.pl");
27 foreach $e (&foreign_call("exports", "list_exports")) {
28 push(@{$exp{$e->{'dir'}}}, $e)
29 if ($e->{'dir'} !~ /:/ && $e->{'host'} !~ /:/);
31 foreach $d (keys %exp) {
33 foreach $e (@{$exp{$d}}) {
34 local $o = $e->{'options'};
35 $host .= sprintf ":%s:%d:%d",
36 $e->{'host'} ? $e->{'host'} : '*',
38 defined($o->{'all_squash'}) ? 0 :
39 defined($o->{'no_root_squash'}) ? 2 : 1;
41 print &make_chroot($d),$host,"\n";
44 elsif (%dinfo && &check_os_support(\%dinfo)) {
46 &module_check("dfsadmin");
48 &foreign_require("dfsadmin", "dfs-lib.pl");
49 foreach $s (&foreign_call("dfsadmin", "list_shares")) {
50 $opts = &foreign_call("dfsadmin", "parse_options",$s->{'opts'});
51 $opts->{'ro'} = '-' if (!defined($opts->{'ro'}));
52 $opts->{'ro'} =~ s/:/ /g;
53 $opts->{'rw'} = '-' if (!defined($opts->{'rw'}));
54 $opts->{'rw'} =~ s/:/ /g;
55 $opts->{'root'} = '-' if (!defined($opts->{'root'}));
56 $opts->{'root'} =~ s/:/ /g;
57 printf "%s:%s:%s:%s:%s\n",
58 &make_chroot($s->{'dir'}), $opts->{'ro'}, $opts->{'rw'},
59 $opts->{'root'}, $s->{'desc'};
62 elsif (%binfo && &check_os_support(\%binfo)) {
64 &module_check("bsdexports");
66 &foreign_require("bsdexports", "bsdexports-lib.pl");
67 foreach $e (&foreign_call("bsdexports", "list_exports")) {
68 foreach $d (@{$e->{'dirs'}}) {
69 printf "%s:%s", $d, $e->{'ro'} ? 1 : 0;
70 if ($e->{'network'}) {
72 $e->{'network'}, $e->{'mask'};
75 foreach $h (@{$e->{'hosts'}}) {
84 # No NFS modules installed or supported
90 if (!$acl{$base_remote_user,$_[0]}) {