-/*
- * $Source$
- * $Author$
- * $Header$
- *
- * Copyright (C) 1987 by the Massachusetts Institute of Technology
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Moira server process.
+/* $Id$
*
- * Most of this is stolen from ../gdb/tsr.c
+ * Moira server process.
*
- * You are in a maze of twisty little finite automata, all different.
- * Let the reader beware.
+ * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
*
*/
-static char *rcsid_mr_main_c = "$Header$";
-
#include <mit-copyright.h>
-#include <string.h>
-#include <stdio.h>
+#include "mr_server.h"
+
+#include <sys/socket.h>
+#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/errno.h>
-#include <sys/signal.h>
+#include <sys/utsname.h>
#include <sys/wait.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <signal.h>
-#include "mr_server.h"
-#include <krb_et.h>
-#include <gdss_et.h>
+
+#include <netinet/in.h>
#include <arpa/inet.h>
+#include <ctype.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+RCSID("$Header$");
+
+extern char *krb_get_lrealm(char *, int);
+
extern CONNECTION newconn, listencon;
extern int nclients;
extern char *whoami;
extern char buf1[BUFSIZ];
extern char *takedown;
-extern int errno;
extern FILE *journal;
extern time_t now;
-char hostbuf[BUFSIZ], *host;
+char *host;
+void reapchild(int x);
+void godormant(int x);
+void gowakeup(int x);
int do_listen(char *port);
void do_reset_listen(void);
void clist_append(client *cp);
char *port, *p;
extern char *database;
struct stat stbuf;
+ struct utsname uts;
whoami = argv[0];
/*
/*
* Get moira server hostname for authentication
*/
- if (gethostname(hostbuf, sizeof(hostbuf)) < 0)
+ if (uname(&uts) < 0)
{
com_err(whoami, errno, "Unable to get local hostname");
exit(1);
}
- host = canonicalize_hostname(strsave(hostbuf));
+ host = canonicalize_hostname(strdup(uts.nodename));
for (p = host; *p && *p != '.'; p++)
{
if (isupper(*p))
op_list = create_list_of_operations(1, listenop);
com_err(whoami, 0, "started (pid %d)", getpid());
- com_err(whoami, 0, rcsid_mr_main_c);
+ com_err(whoami, 0, rcsid);
if (dormant != ASLEEP)
send_zgram("MOIRA", "server started");
else
cp->con = newconn;
cp->id = counter++;
cp->args = NULL;
- cp->clname[0] = NULL;
+ cp->clname[0] = '\0';
cp->reply.mr_argv = NULL;
cp->first = NULL;
cp->last = NULL;