summaryrefslogtreecommitdiffstats
path: root/contrib/amd/hlfsd
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/amd/hlfsd')
-rw-r--r--contrib/amd/hlfsd/hlfsd.82
-rw-r--r--contrib/amd/hlfsd/hlfsd.c80
-rw-r--r--contrib/amd/hlfsd/hlfsd.h6
-rw-r--r--contrib/amd/hlfsd/homedir.c10
-rw-r--r--contrib/amd/hlfsd/nfs_prot_svc.c4
-rw-r--r--contrib/amd/hlfsd/stubs.c12
6 files changed, 61 insertions, 53 deletions
diff --git a/contrib/amd/hlfsd/hlfsd.8 b/contrib/amd/hlfsd/hlfsd.8
index ecc7e3a..0d98302 100644
--- a/contrib/amd/hlfsd/hlfsd.8
+++ b/contrib/amd/hlfsd/hlfsd.8
@@ -36,7 +36,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: hlfsd.8,v 1.2 1993/09/14 22:29:10 ezk Exp ezk $
+.\" $Id: hlfsd.8,v 1.1.1.1 1998/11/05 02:04:55 ezk Exp $
.\"
.\" HLFSD was written at Columbia University Computer Science Department, by
.\" Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@smarts.com>
diff --git a/contrib/amd/hlfsd/hlfsd.c b/contrib/amd/hlfsd/hlfsd.c
index ba88237..83b0b8d 100644
--- a/contrib/amd/hlfsd/hlfsd.c
+++ b/contrib/amd/hlfsd/hlfsd.c
@@ -17,7 +17,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
+ * must display the following acknowledgment:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
@@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
- * $Id: hlfsd.c,v 1.11 1994/11/06 00:19:52 ezk Exp ezk $
+ * $Id: hlfsd.c,v 1.2 1998/12/27 06:25:22 ezk Exp $
*
* HLFSD was written at Columbia University Computer Science Department, by
* Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@cs.columbia.edu>
@@ -83,18 +83,22 @@ char *alt_spooldir = ALT_SPOOLDIR;
char *home_subdir = HOME_SUBDIR;
char *logfile = DEFAULT_LOGFILE;
char *passwdfile = NULL; /* alternate passwd file to use */
+#if 0
char *progname;
+int foreground = 1; /* This is the top-level server */
+#endif
char *slinkname = 0;
char hostname[MAXHOSTNAMELEN + 1] = "localhost";
int cache_interval = DEFAULT_CACHE_INTERVAL;
-int foreground = 1; /* This is the top-level server */
gid_t hlfs_gid = (gid_t) INVALIDID;
int masterpid = 0;
int noverify = 0;
-int orig_umask;
+int orig_umask = 022;
int serverpid = 0;
nfstime startup;
+#if 0
pid_t mypid; /* Current process id */
+#endif
serv_state amd_state;
u_short nfs_port;
@@ -105,9 +109,11 @@ char *mnttab_file_name = MNTTAB_FILE_NAME;
char *mnttab_file_name = NULL;
#endif /* not MOUNT_TABLE_ON_FILE */
+#if 0
#ifdef DEBUG
int debug_flags = 0;
#endif /* DEBUG */
+#endif
/* forward declarations */
void hlfsd_going_down(int rc);
@@ -118,7 +124,7 @@ usage(void)
{
fprintf(stderr,
"Usage: %s [-Cfhnpv] [-a altdir] [-c cache-interval] [-g group]\n",
- progname);
+ am_get_progname());
fprintf(stderr, "\t[-i interval] [-l logfile] [-o mntopts] [-P passwdfile]\n");
show_opts('x', xlog_opt);
#ifdef DEBUG
@@ -137,6 +143,7 @@ main(int argc, char *argv[])
char hostpid_fs[MAXHOSTNAMELEN + 1 + 16]; /* room for ":(pid###)" */
char progpid_fs[PROGNAMESZ + 1 + 11]; /* room for ":pid" */
char preopts[128];
+ char *progname;
int forcecache = 0;
int forcefast = 0;
int genflags = 0;
@@ -171,14 +178,15 @@ main(int argc, char *argv[])
progname = argv[0];
if ((int) strlen(progname) > PROGNAMESZ) /* truncate to reasonable size */
progname[PROGNAMESZ] = '\0';
+ am_set_progname(progname);
- while ((opt = getopt(argc, argv, "a:c:CD:fg:hi:l:no:pP:x:v")) != EOF)
+ while ((opt = getopt(argc, argv, "a:c:CD:fg:hi:l:no:pP:x:v")) != -1)
switch (opt) {
case 'a':
if (!optarg || optarg[0] != '/') {
printf("%s: invalid directory for -a: %s\n",
- progname, optarg);
+ am_get_progname(), optarg);
exit(3);
}
alt_spooldir = optarg;
@@ -187,7 +195,7 @@ main(int argc, char *argv[])
case 'c':
if (!atoi(optarg)) {
printf("%s: invalid interval for -c: %s\n",
- progname, optarg);
+ am_get_progname(), optarg);
exit(3);
}
cache_interval = atoi(optarg);
@@ -208,7 +216,7 @@ main(int argc, char *argv[])
case 'i':
if (!atoi(optarg)) {
printf("%s: invalid interval for -i: %s\n",
- progname, optarg);
+ am_get_progname(), optarg);
exit(3);
}
reloadinterval.it_interval.tv_sec = atoi(optarg);
@@ -247,7 +255,7 @@ main(int argc, char *argv[])
#ifdef DEBUG
opterrs += debug_option(optarg);
#else /* not DEBUG */
- fprintf(stderr, "%s: not compiled with DEBUG -- sorry.\n", progname);
+ fprintf(stderr, "%s: not compiled with DEBUG -- sorry.\n", am_get_progname());
#endif /* not DEBUG */
break;
@@ -260,7 +268,7 @@ main(int argc, char *argv[])
if (xlog_level_init == ~0)
switch_option("");
/* need my pid before any dlog/plog */
- mypid = getpid();
+ am_set_mypid();
#ifdef DEBUG
switch_option("debug");
#endif /* DEBUG */
@@ -271,7 +279,7 @@ main(int argc, char *argv[])
*/
#if !defined(MNT2_NFS_OPT_ACREGMIN) && !defined(MNT2_NFS_OPT_NOAC) && !defined(HAVE_FIELD_NFS_ARGS_T_ACREGMIN)
if (!forcecache) {
- fprintf(stderr, "%s: will not be able to turn off attribute caches.\n", progname);
+ fprintf(stderr, "%s: will not be able to turn off attribute caches.\n", am_get_progname());
exit(1);
}
#endif /* !defined(MNT2_NFS_OPT_ACREGMIN) && !defined(MNT2_NFS_OPT_NOAC) && !defined(HAVE_FIELD_NFS_ARGS_T_ACREGMIN) */
@@ -302,7 +310,7 @@ main(int argc, char *argv[])
/* find gid for hlfs_group */
if ((grp = getgrnam(hlfs_group)) == (struct group *) NULL) {
fprintf(stderr, "%s: cannot get gid for group \"%s\".\n",
- progname, hlfs_group);
+ am_get_progname(), hlfs_group);
} else {
hlfs_gid = grp->gr_gid;
}
@@ -312,9 +320,9 @@ main(int argc, char *argv[])
hostname[sizeof(hostname) - 1] = '\0';
if ((dot = strchr(hostname, '.')) != NULL)
*dot = '\0';
- if (logfile)
- switch_to_logfile(logfile);
orig_umask = umask(0);
+ if (logfile)
+ switch_to_logfile(logfile, orig_umask);
#if defined(DEBUG) && !defined(MOUNT_TABLE_ON_FILE)
if (debug_flags & D_MTAB)
@@ -339,7 +347,7 @@ main(int argc, char *argv[])
if (slinkname)
*--slinkname = '/';
printf("%s: invalid mount directory/link %s\n",
- progname, dir_name);
+ am_get_progname(), dir_name);
exit(3);
}
@@ -354,7 +362,7 @@ main(int argc, char *argv[])
if ((stmodes.st_mode & 0555) != 0555) {
fprintf(stderr, "%s: directory %s not read/executable\n",
- progname, dir_name);
+ am_get_progname(), dir_name);
plog(XLOG_WARNING, "directory %s not read/executable",
dir_name);
}
@@ -372,7 +380,7 @@ main(int argc, char *argv[])
if (direntry != NULL) {
fprintf(stderr, "%s: %s/%s will be hidden by mount\n",
- progname, dir_name, direntry->d_name);
+ am_get_progname(), dir_name, direntry->d_name);
plog(XLOG_WARNING, "%s/%s will be hidden by mount\n",
dir_name, direntry->d_name);
}
@@ -381,7 +389,7 @@ main(int argc, char *argv[])
/* make sure alternate spool dir exists */
if ((errno = mkdirs(alt_spooldir, OPEN_SPOOLMODE))) {
fprintf(stderr, "%s: cannot create alternate dir ",
- progname);
+ am_get_progname());
perror(alt_spooldir);
plog(XLOG_ERROR, "cannot create alternate dir %s: %m",
alt_spooldir);
@@ -393,7 +401,7 @@ main(int argc, char *argv[])
if (lstat(dir_name, &stmodes) == 0 &&
(stmodes.st_mode & S_IFMT) != S_IFLNK) {
fprintf(stderr, "%s: failsafe %s not a symlink\n",
- progname, dir_name);
+ am_get_progname(), dir_name);
plog(XLOG_WARNING, "failsafe %s not a symlink\n",
dir_name);
} else {
@@ -402,7 +410,7 @@ main(int argc, char *argv[])
if (symlink(alt_spooldir, dir_name) < 0) {
fprintf(stderr,
"%s: cannot create failsafe symlink %s -> ",
- progname, dir_name);
+ am_get_progname(), dir_name);
perror(alt_spooldir);
plog(XLOG_WARNING,
"cannot create failsafe symlink %s -> %s: %m",
@@ -517,7 +525,7 @@ main(int argc, char *argv[])
* Update hostname field.
* Make some name prog:pid (i.e., hlfsd:174) for hostname
*/
- sprintf(progpid_fs, "%s:%d", progname, masterpid);
+ sprintf(progpid_fs, "%s:%d", am_get_progname(), masterpid);
/* Most kernels have a name length restriction. */
if ((int) strlen(progpid_fs) >= (int) MAXHOSTNAMELEN)
@@ -593,7 +601,7 @@ main(int argc, char *argv[])
fatal("nfsmount: %m");
} else { /* asked for -D nodaemon */
if (fork() == 0) { /* child runs mount */
- mypid = getpid();
+ am_set_mypid();
foreground = 0;
plog(XLOG_INFO, "child NFS mounting hlfsd service points");
if (mount_fs(&mnt, genflags, (caddr_t) &nfs_args, retry, type, 0, NULL, mnttab_file_name) < 0) {
@@ -670,7 +678,7 @@ hlfsd_init(void)
if (child != 0) { /* parent process - save child pid */
masterpid = child;
- mypid = getpid(); /* for logging routines */
+ am_set_mypid(); /* for logging routines */
return;
}
@@ -683,7 +691,7 @@ hlfsd_init(void)
plt_init(); /* initialize database */
plog(XLOG_INFO, "home directory database initialized");
- masterpid = serverpid = mypid = getpid(); /* for logging routines */
+ masterpid = serverpid = am_set_mypid(); /* for logging routines */
/*
* SIGALRM/SIGHUP: reload password database if timer expired
@@ -716,7 +724,7 @@ hlfsd_init(void)
#endif /* not HAVE_SIGACTION */
/*
- * SIGCHLD: interlock sycronization and testing
+ * SIGCHLD: interlock synchronization and testing
*/
#ifdef HAVE_SIGACTION
sa.sa_handler = interlock;
@@ -807,7 +815,7 @@ reload(int signum)
* can be rotated)
*/
if (signum == SIGHUP && logfile)
- switch_to_logfile(logfile);
+ switch_to_logfile(logfile, orig_umask);
/*
* parent performs the reload, while the child continues to serve
@@ -815,7 +823,7 @@ reload(int signum)
*/
if ((child = fork()) > 0) {
serverpid = child; /* parent runs here */
- mypid = getpid();
+ am_set_mypid();
plt_init();
@@ -839,7 +847,7 @@ reload(int signum)
} else {
/* let child handle requests while we reload */
serverpid = getpid();
- mypid = getpid();
+ am_set_mypid();
}
}
@@ -863,10 +871,10 @@ cleanup(int signum)
#endif /* DEBUG */
if (fork() != 0) {
masterpid = 0;
- mypid = getpid();
+ am_set_mypid();
return;
}
- mypid = getpid();
+ am_set_mypid();
for (;;) {
while ((umount_result = UMOUNT_FS(dir_name, mnttab_file_name)) == EBUSY) {
@@ -878,7 +886,7 @@ cleanup(int signum)
if (stat(dir_name, &stbuf) == 0 && stbuf.st_ino == ROOTID) {
plog(XLOG_ERROR, "unable to unmount %s", dir_name);
plog(XLOG_ERROR, "suspending, unmount before terminating");
- kill(mypid, SIGSTOP);
+ kill(am_mypid, SIGSTOP);
continue; /* retry unmount */
}
break;
@@ -914,7 +922,7 @@ reaper(int signum)
void
hlfsd_going_down(int rc)
{
- int mypid = getpid();
+ int mypid = getpid(); /* XXX: should this be the global am_mypid */
if (mypid == masterpid)
cleanup(0);
@@ -935,17 +943,17 @@ fatal(char *mess)
messlen = strlen(mess);
if (!STREQ(&mess[messlen + 1 - sizeof(ERRM)], ERRM))
- fprintf(stderr, "%s: %s\n", progname, mess);
+ fprintf(stderr, "%s: %s\n", am_get_progname(), mess);
else {
strcpy(lessmess, mess);
lessmess[messlen - 4] = '\0';
if (errno < sys_nerr)
- fprintf(stderr, "%s: %s: %s\n", progname,
+ fprintf(stderr, "%s: %s: %s\n", am_get_progname(),
lessmess, sys_errlist[errno]);
else
fprintf(stderr, "%s: %s: Error %d\n",
- progname, lessmess, errno);
+ am_get_progname(), lessmess, errno);
}
}
plog(XLOG_FATAL, mess);
diff --git a/contrib/amd/hlfsd/hlfsd.h b/contrib/amd/hlfsd/hlfsd.h
index dec5d91..2c17792 100644
--- a/contrib/amd/hlfsd/hlfsd.h
+++ b/contrib/amd/hlfsd/hlfsd.h
@@ -17,7 +17,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
+ * must display the following acknowledgment:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
@@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
- * $Id: hlfs.h,v 1.9 1993/09/13 15:11:00 ezk Exp $
+ * $Id: hlfsd.h,v 1.1.1.1 1998/11/05 02:04:55 ezk Exp $
*
* HLFSD was written at Columbia University Computer Science Department, by
* Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@cs.columbia.edu>
@@ -110,7 +110,7 @@
(fatal (strcat (strnsave ((str), strlen ((str)) + sizeof (ERRM) - 1), ERRM)))
/*
- * TYPDEFS:
+ * TYPEDEFS:
*/
typedef struct uid2home_t uid2home_t;
typedef struct username2uid_t username2uid_t;
diff --git a/contrib/amd/hlfsd/homedir.c b/contrib/amd/hlfsd/homedir.c
index d6df58e..427c2c1 100644
--- a/contrib/amd/hlfsd/homedir.c
+++ b/contrib/amd/hlfsd/homedir.c
@@ -17,7 +17,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
+ * must display the following acknowledgment:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
@@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
- * $Id: homedir.c,v 1.16 1993/09/13 15:11:00 ezk Exp $
+ * $Id: homedir.c,v 1.2 1998/12/27 06:25:22 ezk Exp $
*
* HLFSD was written at Columbia University Computer Science Department, by
* Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@cs.columbia.edu>
@@ -66,7 +66,7 @@ static struct passwd passwd_ent;
static uid2home_t *lastchild;
static uid2home_t *pwtab;
static void delay(uid2home_t *, int);
-static void table_add(int, char *, char *);
+static void table_add(int, const char *, const char *);
/* GLOBAL FUNCTIONS */
char *homeof(char *username);
@@ -182,7 +182,7 @@ homedir(int userid)
* to the parent upon SIGCHLD in interlock().
*
*/
- mypid = getpid(); /* for logging routines */
+ am_set_mypid(); /* for logging routines */
if (seteuid(userid) < 0) {
plog(XLOG_WARNING, "could not seteuid to %d: %m", userid);
return linkval;
@@ -619,7 +619,7 @@ plt_reset(void)
* n: user ID name
*/
static void
-table_add(int u, char *h, char *n)
+table_add(int u, const char *h, const char *n)
{
int i;
diff --git a/contrib/amd/hlfsd/nfs_prot_svc.c b/contrib/amd/hlfsd/nfs_prot_svc.c
index fc2e663..8efe211 100644
--- a/contrib/amd/hlfsd/nfs_prot_svc.c
+++ b/contrib/amd/hlfsd/nfs_prot_svc.c
@@ -17,7 +17,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
+ * must display the following acknowledgment:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
@@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
- * $Id: nfs_prot_svc.c,v 5.2.2.1 1992/02/09 15:09:30 jsp beta $
+ * $Id: nfs_prot_svc.c,v 1.1.1.1 1998/11/05 02:04:55 ezk Exp $
*
*/
diff --git a/contrib/amd/hlfsd/stubs.c b/contrib/amd/hlfsd/stubs.c
index ac97c0b..637bf09 100644
--- a/contrib/amd/hlfsd/stubs.c
+++ b/contrib/amd/hlfsd/stubs.c
@@ -17,7 +17,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
+ * must display the following acknowledgment:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
@@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
- * $Id: stubs.c,v 1.10 1993/09/13 15:11:00 ezk Exp $
+ * $Id: stubs.c,v 1.1.1.1 1998/11/05 02:04:55 ezk Exp $
*
* HLFSD was written at Columbia University Computer Science Department, by
* Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@cs.columbia.edu>
@@ -132,7 +132,7 @@ nfsproc_getattr_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
#ifndef MNT2_NFS_OPT_SYMTTL
/*
* This code is needed to defeat Solaris 2.4's (and newer) symlink
- * values cache. It forces the last-modifed time of the symlink to be
+ * values cache. It forces the last-modified time of the symlink to be
* current. It is not needed if the O/S has an nfs flag to turn off the
* symlink-cache at mount time (such as Irix 5.x and 6.x). -Erez.
*/
@@ -158,7 +158,7 @@ nfsproc_getattr_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
un_fattr.na_fileid = uid;
res.ns_u.ns_attr_u = un_fattr;
#ifdef DEBUG
- dlog("nfs_getattr: succesful search for uid=%d, gid=%d", uid, gid);
+ dlog("nfs_getattr: successful search for uid=%d, gid=%d", uid, gid);
#endif /* DEBUG */
} else { /* not found */
res.ns_status = NFSERR_STALE;
@@ -233,7 +233,7 @@ nfsproc_lookup_2_svc(nfsdiropargs *argp, struct svc_req *rqstp)
return &res;
}
- /* if get's here, gid == hlfs_gid */
+ /* if gets here, gid == hlfs_gid */
if ((idx = untab_index(argp->da_name)) < 0) {
res.dr_status = NFSERR_NOENT;
return &res;
@@ -248,7 +248,7 @@ nfsproc_lookup_2_svc(nfsdiropargs *argp, struct svc_req *rqstp)
res.dr_u.dr_drok_u.drok_fhandle = un_fhandle;
res.dr_status = NFS_OK;
#ifdef DEBUG
- dlog("nfs_lookup: succesful lookup for uid=%d, gid=%d: username=%s",
+ dlog("nfs_lookup: successful lookup for uid=%d, gid=%d: username=%s",
uid, gid, untab[idx].username);
#endif /* DEBUG */
return &res;
OpenPOWER on IntegriCloud