]> andersk Git - moira.git/blobdiff - clients/moira/namespace.c
Need to fill in the "user" variable with mrcl_krb_user().
[moira.git] / clients / moira / namespace.c
index a383aa351d0ddd05dc3314f24a53a143c823b59c..9bc6bfe9003e537b3efa29fd9c9b235154aa2706 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <mit-copyright.h>
 #include <moira.h>
+#include <mrclient.h>
 #include "defs.h"
 #include "f_defs.h"
 #include "globals.h"
@@ -185,6 +186,10 @@ int main(int argc, char **argv)
   program_name = strdup(program_name);
   whoami = strdup(program_name); /* used by menu.c,  ugh !!! */
 
+  user = mrcl_krb_user();
+  if (!user)
+    exit(1);
+
   verbose = TRUE;
   arg = argv;
   moira_server = NULL;
@@ -223,30 +228,9 @@ int main(int argc, char **argv)
        }
     }
 
-  if ((status = mr_connect(moira_server)))
-    ErrorExit("\nConnection to Moira server failed", status);
-
-  /* do this now since calling mr_connect initialized the krb error table
-   * for us.
-   */
-  if ((status = tf_init(TKT_FILE, R_TKT_FIL)) ||
-      (status = tf_get_pname(pname)))
-    {
-      com_err(whoami, status, "cannot find your ticket file");
-      exit(1);
-    }
-  tf_close();
-  user = strdup(pname);
-
-  if ((status = mr_motd(&motd)))
-    ErrorExit("\nUnable to check server status", status);
-  if (motd)
-    {
-      fprintf(stderr, "The Moira server is currently unavailable:\n%s\n",
-             motd);
-      mr_disconnect();
-      exit(1);
-    }
+  if (mrcl_connect(moira_server, program_name, QUERY_VERSION, 0)
+      != MRCL_SUCCESS)
+    exit(1);
 
   if ((status = mr_auth(program_name)))
     {
This page took 0.040028 seconds and 4 git commands to generate.