#include <mit-copyright.h>
#include <moira.h>
+#include <mrclient.h>
#include "defs.h"
#include "f_defs.h"
#include "globals.h"
#include <stdio.h>
#include <string.h>
-#include <krb.h>
-
RCSID("$Header$");
static void ErrorExit(char *buf, int status);
int status;
Menu *menu;
char *motd, **arg;
- char pname[ANAME_SZ];
struct sigaction act;
if (!(program_name = strrchr(argv[0], '/')))
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;
}
}
- if ((status = mr_connect(moira_server)))
- ErrorExit("\nConnection to Moira server failed", status);
+ if (mrcl_connect(moira_server, program_name, QUERY_VERSION, 0)
+ != MRCL_SUCCESS)
+ exit(1);
- /* 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)))
+ if ((status = mr_krb5_auth(program_name)))
{
- com_err(whoami, status, "cannot find your ticket file");
- exit(1);
- }
- tf_close();
- user = strdup(pname);
+ if (status == MR_UNKNOWN_PROC)
+ status = mr_auth(program_name);
- 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 ((status = mr_auth(program_name)))
- {
- if (status == MR_USER_AUTH)
+ if (status)
{
- char buf[BUFSIZ];
- com_err(program_name, status, "\nPress [RETURN] to continue");
- fgets(buf, BUFSIZ, stdin);
+ if (status == MR_USER_AUTH)
+ {
+ char buf[BUFSIZ];
+ com_err(program_name, status, "\nPress [RETURN] to continue");
+ fgets(buf, BUFSIZ, stdin);
+ }
+ else
+ ErrorExit("\nAuthorization failed -- please run kinit", status);
}
- else
- ErrorExit("\nAuthorization failed -- please run kinit", status);
}
/*