source: trunk/third/moira/lib/mr_access.c @ 24319

Revision 24319, 1.1 KB checked in by broder, 15 years ago (diff)
New Moira snapshot from SVN.
Line 
1/* $Id: mr_access.c 3956 2010-01-05 20:56:56Z zacheiss $
2 *
3 * Check access to a Moira query
4 *
5 * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
6 * For copying and distribution information, please see the file
7 * <mit-copyright.h>.
8 */
9
10#include <mit-copyright.h>
11#include <moira.h>
12#include "mr_private.h"
13
14#include <errno.h>
15#include <stdlib.h>
16#include <string.h>
17
18RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/lib/mr_access.c $ $Id: mr_access.c 3956 2010-01-05 20:56:56Z zacheiss $");
19
20/*
21 * Check access to a named query.
22 */
23int mr_access(char *name, int argc, char **argv)
24{
25  mr_params params, reply;
26  int status;
27
28  CHECK_CONNECTED;
29
30  params.u.mr_procno = MR_ACCESS;
31  params.mr_argc = argc + 1;
32  params.mr_argv = malloc(sizeof(char *) * (argc + 1));
33  if (!params.mr_argv)
34    return ENOMEM;
35  params.mr_argv[0] = name;
36  memcpy(params.mr_argv + 1, argv, sizeof(char *) * argc);
37  params.mr_argl = NULL;
38
39  if ((status = mr_do_call(&params, &reply)) == MR_SUCCESS)
40    status = reply.u.mr_status;
41
42  mr_destroy_reply(reply);
43  free(params.mr_argv);
44
45  return status;
46}
Note: See TracBrowser for help on using the repository browser.