}
/* 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;
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 "
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();
#include <mit-copyright.h>
#include <moira.h>
+#include <mrclient.h>
#include "defs.h"
#include "f_defs.h"
#include "globals.h"
{
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
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 ((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)))
{
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)
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)
{
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\". "
status = mr_connect(server);
if (status)
com_err("moira (connect)", status, "");
+ mr_version(-1);
}
void test_disconnect(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, "");
+}
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. */
}
mrarg[0] = uname;
- if (mrcl_connect(NULL, "chpobox", 1) != MRCL_SUCCESS)
+ if (mrcl_connect(NULL, "chpobox", 2, 1) != MRCL_SUCCESS)
exit(1);
if (setflag)
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 */