#include #include #include "rpc-mount.h" #include "xdr.h" #include "util.h" #include "vars.h" #define PROC_NULL 0 #define PROC_MNT 1 #define PROC_DUMP 2 #define PROC_UMNT 3 #define PROC_UMNTALL 4 #define PROC_EXPORT 5 #define PROC_EXPORTALL 6 #define FHSIZE 32 static void dump_xdr_fhstatus(const char *tag) { unsigned status; need(4,"status"); printx(pkt,4); status = get32(0); consume(4); printf("%sstatus = %u",tag,status); if (status == 0) { printf(" [success]\n"); need(FHSIZE,"file handle"); printx(pkt,FHSIZE); printf("%sfile handle\n",tag); consume(FHSIZE); } else { printf(" [%s]\n",strerror(status)); } } void *dumprpc_mount(RPCDUMP_ARGS) { switch (op) { case DO_CALL: printx(pkt,0); switch (proc) { case PROC_NULL: printf("mount NULL request\n"); break; case PROC_MNT: printf("mount MNT request\n"); dump_xdr_string("dirpath "); break; case PROC_DUMP: printf("mount DUMP request\n"); break; case PROC_UMNT: printf("mount UMNT request\n"); break; case PROC_UMNTALL: printf("mount UMNTALL request\n"); break; case PROC_EXPORT: printf("mount EXPORT request\n"); break; case PROC_EXPORTALL: printf("mount EXPORTALL request\n"); break; default: printf("mount request, unknown proc %u\n",proc); break; } return(0); break; case DO_REPLY: printx(pkt,0); switch (proc) { case PROC_NULL: printf("mount NULL reply\n"); break; case PROC_MNT: printf("mount MNT reply\n"); dump_xdr_fhstatus(""); break; case PROC_DUMP: printf("mount DUMP reply\n"); break; case PROC_UMNT: printf("mount UMNT reply\n"); break; case PROC_UMNTALL: printf("mount UMNTALL reply\n"); break; case PROC_EXPORT: printf("mount EXPORT reply\n"); break; case PROC_EXPORTALL: printf("mount EXPORTALL reply\n"); break; default: printf("mount reply, unknown proc %u\n",proc); break; } break; case DO_FREE: break; } return(0); } #if 0 /* * The type name is used for arbitrary names (hostnames, groupnames) */ typedef string name; /* * A list of who has what mounted */ typedef struct mountbody *mountlist; struct mountbody { name ml_hostname; dirpath ml_directory; mountlist ml_next; }; /* * A list of netgroups */ typedef struct groupnode *groups; struct groupnode { name gr_name; groups gr_next; }; /* * A list of what is exported and to whom */ typedef struct exportnode *exports; struct exportnode { dirpath ex_dir; groups ex_groups; exports ex_next; }; /* * Returns the list of remotely mounted filesystems. The * mountlist contains one entry for each hostname and * directory pair. */ mountlist MOUNTPROC_DUMP(void) = 2; /* * Removes the mount list entry for the directory * Unix authentication required. */ void MOUNTPROC_UMNT(dirpath) = 3; /* * Removes all of the mount list entries for this client * Unix authentication required. */ void MOUNTPROC_UMNTALL(void) = 4; /* * Returns a list of all the exported filesystems, and which * machines are allowed to import it. */ exports MOUNTPROC_EXPORT(void) = 5; /* * Identical to MOUNTPROC_EXPORT above */ exports MOUNTPROC_EXPORTALL(void) = 6; } = 1; } = 100005; #endif