]> andersk Git - moira.git/blobdiff - server/mr_main.c
implement an authenticator replay cache
[moira.git] / server / mr_main.c
index 2b11724e03b4e092e2f96f66762f3bbb434d948e..f8aa5ba389fbc9277e134e37ff3d603549938872 100644 (file)
@@ -53,6 +53,8 @@ extern FILE *journal;
 
 extern time_t now;
 
+char hostbuf[BUFSIZ], *host;
+
 int do_listen(char *port);
 void do_reset_listen(void);
 void clist_append(client *cp);
@@ -75,7 +77,7 @@ int main(argc, argv)
 {
        int status, i;
        time_t tardy;
-       char *port;
+       char *port, *p;
        extern char *database;
        struct stat stbuf;
        
@@ -133,6 +135,19 @@ int main(argc, argv)
        
        sanity_check_queries();
 
+       /*
+        * Get moira server hostname for authentication
+        */
+       if (gethostname(hostbuf, sizeof(hostbuf)) < 0) {
+         com_err(whoami, errno, "Unable to get local hostname");
+         exit(1);
+       }
+       host = canonicalize_hostname(strsave(hostbuf));
+       for (p = host; *p && *p != '.'; p++)
+         if (isupper(*p))
+           *p = tolower(*p);
+       *p = 0;
+
        /*
         * Set up client array handler.
         */
This page took 0.032687 seconds and 4 git commands to generate.