]> andersk Git - moira.git/commitdiff
deal with query versioning
authordanw <danw>
Thu, 30 Dec 1999 17:30:27 +0000 (17:30 +0000)
committerdanw <danw>
Thu, 30 Dec 1999 17:30:27 +0000 (17:30 +0000)
clients/addusr/addusr.c
clients/blanche/blanche.c
clients/mailmaint/mailmaint.c
clients/moira/main.c
clients/mrcheck/mrcheck.c
clients/mrtest/mrtest.c
clients/passwd/chfn.c
clients/passwd/chpobox.c
clients/passwd/chsh.c

index 96f18f3fd3c230116421ce15c70d234647437185..1fd8f702264231042dde837f6d4a67ca99eaa5a4 100644 (file)
@@ -155,7 +155,7 @@ int main(int argc, char **argv)
     }
 
   /* fire up Moira */
-  if (mrcl_connect(server, "addusr", 1) != MRCL_SUCCESS)
+  if (mrcl_connect(server, "addusr", 2, 1) != MRCL_SUCCESS)
     exit(2);
 
   qargv[U_NAME] = UNIQUE_LOGIN;
index 2ea681787ab059eca2996a6f259e3a4c2e4a876c..69e7f7f135e1888a0fdbe60e1ac18f655dbd686a 100644 (file)
@@ -278,7 +278,7 @@ int main(int argc, char **argv)
     showusers = showstrings = showlists = showkerberos = 1;
 
   /* fire up Moira */
-  status = mrcl_connect(server, "blanche", !noauth);
+  status = mrcl_connect(server, "blanche", 2, !noauth);
   if (status == MRCL_AUTH_ERROR)
     {
       com_err(whoami, 0, "Try the -noauth flag if you don't "
index ea850103b43bb7341cf0ad3c1d2d3708870a2568..cc6bbb9b2a3b66be7deeb83b95e6fcbc611a0880 100644 (file)
@@ -145,7 +145,7 @@ int main(int argc, char *argv[])
 
   printf("Connecting to database for %s...please hold on.\n", username);
 
-  if (mrcl_connect(NULL, "mailmaint", 1))
+  if (mrcl_connect(NULL, "mailmaint", 2, 1))
     exit(2);
 
   initscr();
index b8f61b54ae56c7593178d8c31cc3e0f7685e4070..df7be37ce34a67b38f3193aa30445260ca0a5903 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"
@@ -53,20 +54,9 @@ int main(int argc, char **argv)
 {
   int status;
   Menu *menu;
-  char *motd, **arg, pname[ANAME_SZ];
+  char **arg, pname[ANAME_SZ];
   struct sigaction act;
 
-  if ((status = tf_init(TKT_FILE, R_TKT_FIL)) ||
-      (status = tf_get_pname(pname)))
-    {
-      initialize_krb_error_table();
-      com_err(whoami, status + ERROR_TABLE_BASE_krb,
-             "reading Kerberos ticket file");
-      exit(1);
-    }
-  tf_close();
-  user = pname;
-
   if (!(program_name = strrchr(argv[0], '/')))
     program_name = argv[0];
   else
@@ -74,6 +64,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;
@@ -113,18 +107,8 @@ int main(int argc, char **argv)
        }
     }
 
-  if ((status = mr_connect(moira_server)))
-    ErrorExit("\nConnection to Moira server failed", status);
-
-  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, 2, 0) != MRCL_SUCCESS)
+    exit(1);
 
   if ((status = mr_auth(program_name)))
     {
index d996eda049a67e4368582ae1e2746571dca28844..8d64a42fabf7e620b20f0845f6e821fd1c707f58 100644 (file)
@@ -178,7 +178,7 @@ int main(int argc, char *argv[])
   else if (argc > 1)
     usage();
 
-  if (mrcl_connect(NULL, NULL, 0) != MRCL_SUCCESS)
+  if (mrcl_connect(NULL, NULL, 2, 0) != MRCL_SUCCESS)
     exit(2);
   status = mr_auth("mrcheck");
   if (status && auth_required)
index 01f006f9b420715f58c6ff2aab4fb07b262067f2..268d784da2beb60bbe68a948730b62b82507111d 100644 (file)
@@ -50,6 +50,7 @@ void test_access(int argc, char **argv);
 void test_dcm(void);
 void test_script(int argc, char **argv);
 void test_list_requests(void);
+void test_version(int argc, char **argv);
 
 int main(int argc, char **argv)
 {
@@ -174,6 +175,8 @@ void execute_line(char *cmdbuf)
     test_list_requests();
   else if (!strcmp(argv[0], "quit") || !strcmp(argv[0], "Q"))
     quit = 1;
+  else if (!strcmp(argv[0], "version") || !strcmp(argv[0], "v"))
+    test_version(argc, argv);
   else
     {
       fprintf(stderr, "moira: Unknown request \"%s\".  "
@@ -261,6 +264,7 @@ void test_connect(int argc, char *argv[])
   status = mr_connect(server);
   if (status)
     com_err("moira (connect)", status, "");
+  mr_version(-1);
 }
 
 void test_disconnect(void)
@@ -502,3 +506,17 @@ void test_list_requests(void)
   printf("list_requests, lr, ?\tList available commands.\n");
   printf("quit, Q\t\t\tLeave the subsystem.\n");
 }
+
+void test_version(int argc, char **argv)
+{
+  int status;
+
+  if (argc != 2)
+    {
+      com_err("moira (version)", 0, "Usage: version versionnumber");
+      return;
+    }
+  status = mr_version(atoi(argv[1]));
+  if (status)
+    com_err("moira (version)", status, "");
+}
index 1dd6d918d911531892fcad5087d0d382af2ca5e5..5d6ac26093ec68726eb7f7f0fa4b4dfa503a7395 100644 (file)
@@ -81,7 +81,7 @@ int chfn(char *uname)
   struct finger_info old_info;
   struct finger_info new_info;
 
-  if (mrcl_connect(NULL, "chsh", 1) != MRCL_SUCCESS)
+  if (mrcl_connect(NULL, "chsh", 2, 1) != MRCL_SUCCESS)
     exit(1);
 
   /* First, do an access check. */
index 823423e3362189a7042ee3d1d495e01a919688c6..6f95786f38d30eed5d20b93a54bc3c18e101e20e 100644 (file)
@@ -96,7 +96,7 @@ int main(int argc, char *argv[])
     }
   mrarg[0] = uname;
 
-  if (mrcl_connect(NULL, "chpobox", 1) != MRCL_SUCCESS)
+  if (mrcl_connect(NULL, "chpobox", 2, 1) != MRCL_SUCCESS)
     exit(1);
 
   if (setflag)
index d5fed8a6bed566babf584c83b26ec918049c5982..872d110822689ff5e9837ebe478e41da5ce9f6df 100644 (file)
@@ -71,7 +71,7 @@ int chsh(char *uname)
   int got_one = 0;             /* have we got a new shell yet? */
   char shell[BUFSIZ];          /* the new shell */
 
-  if (mrcl_connect(NULL, "chsh", 1) != MRCL_SUCCESS)
+  if (mrcl_connect(NULL, "chsh", 2, 1) != MRCL_SUCCESS)
     exit(1);
 
   /* First, do an access check */
This page took 0.056992 seconds and 5 git commands to generate.