Index: amd/afs_ops.c =================================================================== RCS file: /usr/cvs/PdTools/amd/amd/afs_ops.c,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 afs_ops.c --- 1.1.102.1 1995/04/20 12:49:42 +++ afs_ops.c 1995/05/31 13:11:21 @@ -2060,7 +2060,11 @@ afs_umount, 0, afs_lookuppn, +#ifdef NEW_TOPLVL_READDIR + new_afs_readdir, +#else afs_readdir, +#endif /* NEW_TOPLVL_READDIR */ 0, /* afs_readlink */ 0, /* afs_mounted */ afs_umounted, Index: amd/cdfs_ops.c =================================================================== RCS file: /usr/cvs/PdTools/amd/amd/cdfs_ops.c,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 cdfs_ops.c --- 1.1.102.1 1995/04/20 12:49:52 +++ cdfs_ops.c 1995/05/31 13:36:45 @@ -91,11 +91,7 @@ /* * Figure out the name of the file system type. */ -#ifdef M_NEWTYPE - char *type = MOUNT_TYPE_CDFS; -#else - int type = MOUNT_TYPE_CDFS; -#endif /* M_NEWTYPE */ + MTYPE_TYPE type = MOUNT_TYPE_CDFS; bzero((voidp) &cdfs_args, sizeof(cdfs_args)); /* Paranoid */ @@ -104,11 +100,7 @@ */ mnt.mnt_dir = dir; mnt.mnt_fsname = fs_name; -#ifdef MTAB_TYPE_CDFS mnt.mnt_type = MTAB_TYPE_CDFS; -#else - mnt.mnt_type = "cdfs"; -#endif /* MTAB_TYPE_CDFS */ mnt.mnt_opts = opts; mnt.mnt_freq = 0; mnt.mnt_passno = 0; @@ -153,11 +145,7 @@ * Ops structure */ am_ops cdfs_ops = { -#ifdef MTAB_TYPE_CDFS MTAB_TYPE_CDFS, -#else - "cdfs", -#endif /* MTAB_TYPE_CDFS */ cdfs_match, 0, /* cdfs_init */ auto_fmount, Index: amd/info_passwd.c =================================================================== RCS file: /usr/cvs/PdTools/amd/amd/info_passwd.c,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 info_passwd.c --- 1.1.102.1 1995/04/20 12:49:44 +++ info_passwd.c 1995/05/31 13:11:22 @@ -64,7 +64,18 @@ time_t *tp; { *tp = 0; - return strcmp(map, PASSWD_MAP) == 0 ? 0 : ENOENT; + /* + * Recognize the old format "PASSWD_MAP" + * Uses default return string + * "type:=nfs;rfs:=/${var0}/${var1};rhost:=${var1};sublink:=${var2};fs:=${autodir}${var3}" + */ + if (!strcmp(map, PASSWD_MAP)) return 0; + /* + * Recognize the new format "PASSWD_MAP:pval-format" + */ + if (strncmp(map, PASSWD_MAP, sizeof(PASSWD_MAP)-1)) return ENOENT; + if (map[sizeof(PASSWD_MAP)-1] != ':') return ENOENT; + return 0; } @@ -93,8 +104,11 @@ * We chop the home directory up as follows: * /anydir/dom1/dom2/dom3/user * - * and return - * rfs:=/anydir/dom3;rhost:=dom3.dom2.dom1;sublink:=user + * and now have + * var0:=pw-prefix:=anydir + * var1:=pw-rhost:=dom3.dom2.dom1 + * var2:=pw-user:=user + * var3:=pw-home:=/anydir/dom1/dom2/dom3/user * * This allows cross-domain entries in your passwd file. * ... but forget about security! @@ -145,8 +159,15 @@ q = strchr(rhost, '.'); if (q) *q = '\0'; - sprintf(val, "rfs:=%s/%s;rhost:=%s;sublink:=%s;fs:=${autodir}%s", - dir, rhost, rhost, user, pw->pw_dir); + if (p = strchr(map, ':')) + p++; + else + p = "type:=nfs;rfs:=/${var0}/${var1};rhost:=${var1};sublink:=${var2};fs:=${autodir}${var3}"; + sprintf(val, "var0:=%s;var1:=%s;var2:=%s;var3:=%s;%s", + dir+1, rhost, user, pw->pw_dir, p); +#ifdef DEBUG + dlog("passwd_search: map=%s key=%s -> %s", map, key, val); +#endif if (q) *q = '.'; *pval = strdup(val); Index: amd/lofs_ops.c =================================================================== RCS file: /usr/cvs/PdTools/amd/amd/lofs_ops.c,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 lofs_ops.c --- 1.1.102.1 1995/04/20 12:49:52 +++ lofs_ops.c 1995/05/31 13:11:22 @@ -91,11 +91,7 @@ /* * Figure out the name of the file system type. */ -#ifdef M_NEWTYPE - char *type = MOUNT_TYPE_LOFS; -#else - int type = MOUNT_TYPE_LOFS; -#endif /* M_NEWTYPE */ + MTYPE_TYPE type = MOUNT_TYPE_LOFS; bzero((voidp) &lofs_args, sizeof(lofs_args)); /* Paranoid */ Index: amd/mapc.c =================================================================== RCS file: /usr/cvs/PdTools/amd/amd/mapc.c,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 mapc.c --- 1.1.102.1 1995/04/20 12:49:45 +++ mapc.c 1995/05/31 13:11:22 @@ -951,6 +951,9 @@ int num_entries = 0; entry *retval = (entry *) NULL; mntfs *mf; + char *key; + int preflen = 0; + if (!mp) { plog(XLOG_DEBUG, "make_entry_chain: mp is (NULL)\n"); @@ -957,24 +960,38 @@ return retval; } mf = mp->am_mnt; + if (mp->am_pref) preflen = strlen(mp->am_pref); if (mf) { mnt_map *mmp = (mnt_map *) mf->mf_private; if (mmp) { /* iterate over keys */ register int i; for (i = 0; i < NKVHASH; i++) { - kv *k = mmp->kvhash[i]; - while (k) { + kv *k; + for (k = mmp->kvhash[i]; k; k = k->next) { /* * Skip unwanted entries which are either not real entries or * very difficult to interpret (wildcards...) This test needs * lots of improvement. Any takers? */ - if (k->key && (strchr(k->key, '*') || - strchr(k->key, '/') || - key_already_in_chain(k->key, current_chain))) { - k = k->next; - continue; + key = k->key; + if (!key) continue; + /* Skip '*' */ + if (strchr(key, '*')) continue; + /* + * If the map has a prefix-string then check and the key starts with this + * string, and if it does, skip over this prefix. + */ + if (preflen) { + if (strncmp(key, mp->am_pref, preflen)) continue; + key += preflen; } + /* + * No more '/' are allowed. + */ + if (strchr(key, '/') || + key_already_in_chain(key, current_chain)) + continue; + /* fill in a cell and link the entry */ if (num_entries >= max_entries) { /* out of luck. send what you've got */ @@ -986,12 +1003,11 @@ chain[num_entries].fileid = (u_int) last_cookie; *(unsigned int *) chain[num_entries].cookie = (unsigned int) last_cookie; - chain[num_entries].name = k->key; + chain[num_entries].name = key; if (num_entries < max_entries-1) { /* link to next one */ chain[num_entries].nextentry = &chain[num_entries+1]; } ++num_entries; - k = k->next; } /* end of "while (k)" */ } /* end of "for (i ... NKVHASH ..." */ } else { @@ -1003,9 +1019,10 @@ return retval; } /* terminate chain */ - if (num_entries > 0) + if (num_entries > 0) { chain[num_entries - 1].nextentry = 0; - retval = &chain[0]; + retval = &chain[0]; + } return retval; } #endif /* NEW_TOPLVL_READDIR */ Index: amd/pcfs_ops.c =================================================================== RCS file: /usr/cvs/PdTools/amd/amd/pcfs_ops.c,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 pcfs_ops.c --- 1.1.102.1 1995/04/20 12:49:52 +++ pcfs_ops.c 1995/05/31 13:11:22 @@ -91,11 +91,7 @@ /* * Figure out the name of the file system type. */ -#ifdef M_NEWTYPE - char *type = MOUNT_TYPE_PCFS; -#else - int type = MOUNT_TYPE_PCFS; -#endif /* M_NEWTYPE */ + MTYPE_TYPE type = MOUNT_TYPE_PCFS; bzero((voidp) &pcfs_args, sizeof(pcfs_args)); /* Paranoid */ Index: amd/restart.c =================================================================== RCS file: /usr/cvs/PdTools/amd/amd/restart.c,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 restart.c --- 1.1.102.1 1995/04/20 12:49:47 +++ restart.c 1995/05/31 13:28:23 @@ -86,25 +86,25 @@ } else { fs_ops = &nfs_ops; } -#ifdef MTAB_TYPE_LOFS +#ifdef HAS_LOFS } else if (STREQ(me->mnt_type, MTAB_TYPE_LOFS)) { fs_ops = &lofs_ops; -#endif /* MTAB_TYPE_LOFS */ -#ifdef MTAB_TYPE_CDFS +#endif /* HAS_LOFS */ +#ifdef HAS_CDFS } else if (STREQ(me->mnt_type, MTAB_TYPE_CDFS)) { fs_ops = &cdfs_ops; -#endif /* MTAB_TYPE_CDFS */ -#ifdef MTAB_TYPE_PCFS +#endif /* HAS_CDFS */ +#ifdef HAS_PCFS } else if (STREQ(me->mnt_type, MTAB_TYPE_PCFS)) { fs_ops = &pcfs_ops; -#endif /* MTAB_TYPE_PCFS */ -#ifdef MTAB_TYPE_MFS +#endif /* HAS_PCFS */ +#ifdef HAS_MFS } else if (STREQ(me->mnt_type, MTAB_TYPE_MFS)) { /* * MFS entry. Fake with a symlink. */ fs_ops = &sfs_ops; -#endif /* MTAB_TYPE_MFS */ +#endif /* HAS_MFS */ } else { /* * Catch everything else with symlinks to Index: config/os-bsd44.h =================================================================== RCS file: /usr/cvs/PdTools/amd/config/os-bsd44.h,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 os-bsd44.h --- 1.1.102.1 1995/04/20 12:50:02 +++ os-bsd44.h 1995/05/31 14:14:05 @@ -89,7 +89,6 @@ #define MOUNT_TYPE_UFS MOUNT_UFS #undef MTAB_TYPE_UFS #define MTAB_TYPE_UFS "ufs" -#define MTAB_TYPE_MFS "mfs" /* * How to unmount filesystems Index: config/os-bsdi11.h =================================================================== RCS file: /usr/cvs/PdTools/amd/config/os-bsdi11.h,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 os-bsdi11.h --- 1.1.102.1 1995/04/20 12:50:15 +++ os-bsdi11.h 1995/05/31 14:14:04 @@ -93,7 +93,6 @@ #define MOUNT_TYPE_UFS MOUNT_UFS #undef MTAB_TYPE_UFS #define MTAB_TYPE_UFS "ufs" -#define MTAB_TYPE_MFS "mfs" /* * How to unmount filesystems Index: config/os-defaults.h =================================================================== RCS file: /usr/cvs/PdTools/amd/config/os-defaults.h,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 os-defaults.h --- 1.1.102.1 1995/04/20 12:50:03 +++ os-defaults.h 1995/05/31 14:14:06 @@ -90,6 +90,8 @@ */ #define MTAB_TYPE_NFS "nfs" #define MTAB_TYPE_UFS "4.2" +#define MTAB_TYPE_CDFS "cdfs" +#define MTAB_TYPE_MFS "mfs" /* * Name of mount & unmount system calls Index: config/os-linux.h =================================================================== RCS file: /usr/cvs/PdTools/amd/config/os-linux.h,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 os-linux.h --- 1.1.102.1 1995/04/20 12:50:14 +++ os-linux.h 1995/05/31 13:11:23 @@ -51,11 +51,6 @@ */ #define _STDLIB_H -/* This is to say that Linux uses names (i.e. char *) - * in it's types parameter to mount() - */ -#define M_NEWTYPE - #define FNDELAY O_NDELAY #define NFS_FHSIZE 32 struct nfs_fh { Index: config/os-osf1.h =================================================================== RCS file: /usr/cvs/PdTools/amd/config/os-osf1.h,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 os-osf1.h --- 1.1.102.1 1995/04/20 12:50:06 +++ os-osf1.h 1995/05/31 14:14:01 @@ -73,9 +73,10 @@ */ #define MOUNT_TYPE_NFS MOUNT_NFS #define MOUNT_TYPE_UFS MOUNT_UFS +#define MOUNT_TYPE_CDFS MOUNT_CDFS +#define MOUNT_TYPE_MFS MOUNT_MFS #undef MTAB_TYPE_UFS #define MTAB_TYPE_UFS "ufs" -#define MTAB_TYPE_MFS "mfs" /* * How to unmount filesystems @@ -113,11 +114,6 @@ #define MNTMAXSTR 128 -#define MNTTYPE_UFS "ufs" /* Un*x file system */ -#define MNTTYPE_NFS "nfs" /* network file system */ -#define MNTTYPE_MFS "mfs" /* memory file system */ -#define MNTTYPE_IGNORE "ignore" /* No type specified, ignore this entry */ - #define MNTOPT_SOFT "soft" /* soft mount */ #define MNTOPT_INTR "intr" /* interrupts allowed */ #define MNTOPT_NOCONN "noconn" /* accept any responder */ @@ -135,7 +131,11 @@ * Type of a file handle */ #undef NFS_FH_TYPE +#ifdef MOUNT_NFS3 +#define NFS_FH_TYPE caddr_t +#else #define NFS_FH_TYPE nfsv2fh_t * +#endif /* * How to get a mount list Index: config/os-sos4.h =================================================================== RCS file: /usr/cvs/PdTools/amd/config/os-sos4.h,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 os-sos4.h --- 1.1.102.1 1995/04/20 12:50:07 +++ os-sos4.h 1995/05/31 13:38:19 @@ -100,6 +100,7 @@ /* High Sierra FS (CD-ROM) */ #define HAS_CDFS +#undef MTAB_TYPE_CDFS #define MTAB_TYPE_CDFS "hsfs" #define MOUNT_TYPE_CDFS MTAB_TYPE_CDFS struct cdfs_args { /* arguments passed to mount(2) for cd-rom F/S */ Index: config/os-sos5.h =================================================================== RCS file: /usr/cvs/PdTools/amd/config/os-sos5.h,v retrieving revision 1.1.102.1 diff -u -r1.1.102.1 os-sos5.h --- 1.1.102.1 1995/04/20 12:50:15 +++ os-sos5.h 1995/05/31 13:38:18 @@ -152,6 +152,7 @@ }; #define HAS_CDFS +#undef MTAB_TYPE_CDFS #define MTAB_TYPE_CDFS MNTTYPE_HSFS #define MOUNT_TYPE_CDFS sysfs(GETFSIND, "hsfs") struct cdfs_args { /* arguments passed to mount(2) for cd-rom F/S */ =================================================================== *** config/mount_linux.c.orig Sun Nov 6 03:28:41 1994 --- config/mount_linux.c Mon Sep 2 15:03:07 1996 *************** *** 121,126 **** --- 121,127 ---- char *extra_opts = NULL; char *tmp_opts = NULL; char *sub_type = NULL; + int tcp = 0 ; int noauto = 0; int errorcode; *************** *** 136,151 **** if (!mnt_data->timeo) mnt_data->timeo=7; if (!mnt_data->retrans) mnt_data->retrans=3; ! /* These are the only two reliable values currently */ ! if (!mnt_data->rsize) mnt_data->rsize=1024; ! if (!mnt_data->wsize) mnt_data->wsize=1024; if (((mnt_data->fd=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))< 0 )|| (bindresvport(mnt_data->fd, 0) < 0) || ! (connect(mnt_data->fd, (struct sockaddr *) &mnt_data->addr, ! sizeof (mnt_data->addr)) < 0)) { ! perror("Can't create socket for kernel"); ! errorcode=1; ! goto fail; } #ifdef Linux_DEBUG plog(XLOG_INFO, "linux mount: type %s\n",type); --- 137,151 ---- if (!mnt_data->timeo) mnt_data->timeo=7; if (!mnt_data->retrans) mnt_data->retrans=3; ! if (!mnt_data->rsize) mnt_data->rsize=8192; ! if (!mnt_data->wsize) mnt_data->wsize=8192; if (((mnt_data->fd=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))< 0 )|| (bindresvport(mnt_data->fd, 0) < 0) || ! (tcp && connect(mnt_data->fd, (struct sockaddr *) &mnt_data->addr, ! sizeof (mnt_data->addr)) < 0)) { ! perror("Can't create socket for kernel"); ! errorcode=1; ! goto fail; } #ifdef Linux_DEBUG plog(XLOG_INFO, "linux mount: type %s\n",type);