3 * Random client utilities.
5 * Copyright (C) 1999 by the Massachusetts Institute of Technology
6 * For copying and distribution information, please see the file
10 #include <mit-copyright.h>
24 int mrcl_connect(char *server, char *client, int version, int auth)
29 status = mr_connect(server);
32 com_err(whoami, status, "while connecting to Moira");
36 status = mr_motd(&motd);
40 com_err(whoami, status, "while checking server status");
45 fprintf(stderr, "The Moira server is currently unavailable:\n%s\n",
51 status = mr_version(version);
54 if (status == MR_UNKNOWN_PROC)
57 status == MR_VERSION_HIGH;
62 if (status == MR_VERSION_HIGH)
64 com_err(whoami, 0, "Warning: This client is running newer code than the server.");
65 com_err(whoami, 0, "Some operations may not work.");
67 else if (status != MR_VERSION_LOW)
69 com_err(whoami, status, "while setting query version number.");
77 status = mr_auth(client);
80 com_err(whoami, status, "while authenticating to Moira.");
82 return MRCL_AUTH_ERROR;
89 char *mrcl_krb_user(void)
92 static char pname[ANAME_SZ];
94 status = tf_init(TKT_FILE, R_TKT_FIL);
95 if (status == KSUCCESS)
97 status = tf_get_pname(pname);
101 if (status != KSUCCESS)
103 /* In case mr_init hasn't been called yet. */
104 initialize_krb_error_table();
105 com_err(whoami, status, "reading Kerberos ticket file.");