[14097] in Athena Bugs
Re: sun4 7.7U: attach
daemon@ATHENA.MIT.EDU (Greg Hudson)
Fri Jan 5 02:09:28 1996
Date: Fri, 5 Jan 1996 02:09:21 -0500
From: Greg Hudson <ghudson@MIT.EDU>
To: Abbe J Cohen <abbe@MIT.EDU>
Cc: bugs@MIT.EDU
In-Reply-To: "[14096] in Athena Bugs"
The current attach code does zephyr subscriptions in try_attach(),
which of course doesn't happen if the locker is attached. Following
is a patch to make attach.c do zephyr subscriptions when lockers are
already attached. It also eliminates some dead code in try_attach()
which tries to get subscriptions for AFS filesystems (AFS isn't listed
as a "remote" filesystem in attach's database, so that code is never
reached). The patch is a little complicated, mostly because attach,
in an effort to use aklog only once, uses different code paths for
various operations for AFS attaches than it does for other kinds of
attaches.
*** attach.c.orig Fri Mar 25 10:57:14 1994
--- attach.c Fri Jan 5 01:53:57 1996
***************
*** 14,19 ****
--- 14,22 ----
#include <signal.h>
extern int mul_attach();
+ #ifdef ZEPHYR
+ static void attach_zsubs();
+ #endif
/*
* Attempt to attach a filesystem. Lookup the name with Hesiod as
***************
*** 99,104 ****
--- 102,110 ----
if (atp->fs->type == TYPE_MUL)
return mul_attach(atp, (struct mntopts *)0, 0);
+ #ifdef ZEPHYR
+ attach_zsubs(atp);
+ #endif
if (print_path)
printf("%s\n", atp->mntpt);
else if(verbose)
***************
*** 125,131 ****
if (map_anyway && atp->mode != 'n' && atp->fs->type == TYPE_AFS) {
if (verbose && !print_path)
printf(" (authenticating)\n");
! return(afs_auth(atp->hesiodname, atp->hostdir));
}
#endif
if (verbose && !print_path)
--- 131,138 ----
if (map_anyway && atp->mode != 'n' && atp->fs->type == TYPE_AFS) {
if (verbose && !print_path)
printf(" (authenticating)\n");
! return(afs_auth(atp->hesiodname, atp->hostdir,
! use_zephyr));
}
#endif
if (verbose && !print_path)
***************
*** 227,235 ****
struct _attachtab at, *atp;
int status;
int attach_suid;
- #ifdef ZEPHYR
- char instbfr[BUFSIZ];
- #endif
struct mntopts mopt;
char *default_options;
--- 234,239 ----
***************
*** 351,369 ****
attachtab_replace(&at);
put_attachtab();
unlock_attachtab();
- /*
- * Do Zephyr stuff as necessary
- */
#ifdef ZEPHYR
! if (use_zephyr && at.fs->flags & AT_FS_REMOTE) {
! if(at.fs->type == TYPE_AFS) {
! afs_zinit(at.hesiodname, at.hostdir);
! } else {
! sprintf(instbfr, "%s:%s", at.host, at.hostdir);
! zephyr_addsub(instbfr);
! zephyr_addsub(at.host);
! }
! }
#endif
free_attachtab();
} else
--- 355,362 ----
attachtab_replace(&at);
put_attachtab();
unlock_attachtab();
#ifdef ZEPHYR
! attach_zsubs(&at);
#endif
free_attachtab();
} else
***************
*** 372,377 ****
--- 365,383 ----
return (status);
}
+ #ifdef ZEPHYR
+ static void attach_zsubs(atp)
+ struct _attachtab *atp;
+ {
+ char instbfr[BUFSIZ];
+
+ if (use_zephyr && atp->fs->flags & AT_FS_REMOTE) {
+ sprintf(instbfr, "%s:%s", atp->host, atp->hostdir);
+ zephyr_addsub(instbfr);
+ zephyr_addsub(atp->host);
+ }
+ }
+ #endif
char *attach_list_format = "%-22s %-22s %c%-18s%s\n";
*** afs.c.orig Fri Jan 5 01:54:33 1996
--- afs.c Fri Jan 5 01:55:23 1996
***************
*** 284,293 ****
return(SUCCESS);
}
! int afs_auth(hesname, afsdir)
const char *hesname, *afsdir;
{
! return(afs_auth_internal(hesname, afsdir, 0, AFSAUTH_DOAUTH));
}
/*
--- 284,298 ----
return(SUCCESS);
}
! int afs_auth(hesname, afsdir, zsubs)
const char *hesname, *afsdir;
+ int zsubs;
{
! int flags = AFSAUTH_DOAUTH;
!
! if (zsubs)
! flags |= AFSAUTH_DOZEPHYR;
! return(afs_auth_internal(hesname, afsdir, 0, flags));
}
/*
*** main.c.orig Fri Jan 5 01:54:36 1996
--- main.c Fri Jan 5 01:55:36 1996
***************
*** 352,358 ****
op == MOUNTPROC_KUIDMAP) {
/* We only support map operations on AFS */
if (atp->mode != 'n' &&
! (afs_auth(atp->hesiodname, atp->hostdir)
== SUCCESS) && verbose)
printf("%s: %s %s\n", progname,
atp->hesiodname, ops);
--- 352,358 ----
op == MOUNTPROC_KUIDMAP) {
/* We only support map operations on AFS */
if (atp->mode != 'n' &&
! (afs_auth(atp->hesiodname, atp->hostdir, 0)
== SUCCESS) && verbose)
printf("%s: %s %s\n", progname,
atp->hesiodname, ops);
***************
*** 462,468 ****
#ifdef AFS
} else if (atp->fs->type == TYPE_AFS) {
if (op == MOUNTPROC_KUIDMAP &&
! (afs_auth(atp->hesiodname, atp->hostdir) == SUCCESS)
&& verbose)
printf("%s: %s %s\n", progname, filsys, ops);
#endif
--- 462,468 ----
#ifdef AFS
} else if (atp->fs->type == TYPE_AFS) {
if (op == MOUNTPROC_KUIDMAP &&
! (afs_auth(atp->hesiodname, atp->hostdir, 0) == SUCCESS)
&& verbose)
printf("%s: %s %s\n", progname, filsys, ops);
#endif
*** attach.h.orig Fri Jan 5 01:54:30 1996
--- attach.h Fri Jan 5 01:55:00 1996
***************
*** 324,330 ****
/* AFS */
#ifdef AFS
#ifdef __STDC__
! extern int afs_auth(const char *, const char *), afs_auth_to_cell(const char *);
extern int afs_zinit(const char *, const char *);
#else
extern int afs_auth(), afs_auth_to_cell();
--- 324,331 ----
/* AFS */
#ifdef AFS
#ifdef __STDC__
! extern int afs_auth(const char *, const char *, int);
! extern int afs_auth_to_cell(const char *);
extern int afs_zinit(const char *, const char *);
#else
extern int afs_auth(), afs_auth_to_cell();