[1618] in Moira

home help back first fref pref prev next nref lref last post

fix up asvc, gsvc, dsvc

daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Sun Aug 6 00:54:08 2000

Message-Id: <200008060454.AAA02170@riff-raff.mit.edu>
To: moiradev@MIT.EDU
Date: Sun, 06 Aug 2000 00:54:04 -0400
From: Garry Zacheiss <zacheiss@MIT.EDU>

	Right now, moira uniquifies entries in the services table based
only on their names, i.e., you can only have one of moira_ureg/tcp and
moira_ureg/udp in the table, despite it being allowed to have both of
them in /etc/services.  This fixes that.  The arguments to asvc haven't
changed at all, but gsvc and dsvc both now take (name, protocol) instead
of just (name).

	I haven't bumped the version of any of the queries because
there's currently no way of accessing them from a client other than
mrtest, and doesn't appear to ever have been.

Garry

Index: mr_server.h
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/mr_server.h,v
retrieving revision 1.52
diff -c -r1.52 mr_server.h
*** mr_server.h	2000/06/29 18:22:54	1.52
--- mr_server.h	2000/08/06 02:37:14
***************
*** 199,204 ****
--- 199,205 ----
  int set_nfsphys_modtime(struct query *q, char *argv[], client *cl);
  int set_filesys_modtime(struct query *q, char *argv[], client *cl);
  int set_zephyr_modtime(struct query *q, char *argv[], client *cl);
+ int set_service_modtime(struct query *q, char *argv[], client *cl);
  int _sdl_followup(struct query *q, char *argv[], client *cl);
  int trigger_dcm(struct query *q, char *argv[], client *cl);
  
Index: qfollow.pc
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/qfollow.pc,v
retrieving revision 2.16
diff -c -r2.16 qfollow.pc
*** qfollow.pc	2000/04/21 19:47:40	2.16
--- qfollow.pc	2000/08/06 03:03:30
***************
*** 280,285 ****
--- 280,307 ----
    return MR_SUCCESS;
  }
  
+ /* sets the modtime on an entry in services table, where argv[0] contains
+  * the service name.
+  */
+ 
+ int set_service_modtime(struct query *q, char *argv[], client *cl)
+ {
+   EXEC SQL BEGIN DECLARE SECTION;
+   char *service, *protocol, *entity;
+   int who;
+   EXEC SQL END DECLARE SECTION;
+ 
+   entity = cl->entity;
+   who = cl->client_id; 
+ 
+   service = argv[0];
+   protocol = argv[1];
+ 
+   EXEC SQL UPDATE services SET modtime = SYSDATE, modby = :who,
+     modwith = :entity WHERE name = :service AND protocol = :protocol;
+ 
+   return MR_SUCCESS;
+ }
  
  /* fixes the modby field.  This will be the second to last thing in the
   * argv, the argv length is determined from the query structure.  It is
Index: queries2.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/queries2.c,v
retrieving revision 2.73
diff -c -r2.73 queries2.c
*** queries2.c	2000/06/29 18:22:54	2.73
--- queries2.c	2000/08/06 04:42:01
***************
*** 2438,2444 ****
  };
  
  static char *gsvc_fields[] = {
!   "service",
    "service", "protocol", "port", "description", "modtime", "modby", "modwith",
  };
  
--- 2438,2444 ----
  };
  
  static char *gsvc_fields[] = {
!   "service", "protocol",
    "service", "protocol", "port", "description", "modtime", "modby", "modwith",
  };
  
***************
*** 2446,2451 ****
--- 2446,2455 ----
    "service", "protocol", "port", "description",
  };
  
+ static char *dsvc_fields[] = {
+   "service", "protocol",
+ };
+ 
  static struct valobj asvc_valobj[] = {
    {V_CHAR, 0, SERVICES_TABLE, "name"},
    {V_CHAR, 1, SERVICES_TABLE, "protocol"},
***************
*** 2457,2470 ****
    asvc_valobj,
    4,
    "name",
!   "name = '%s'",
!   1,
    0,
    0,
    0,
!   set_modtime,
  };
  
  static char *gprn_fields[] = {
    "name",
    "name", "type", "hwtype", "duplexname", "hostname",
--- 2461,2486 ----
    asvc_valobj,
    4,
    "name",
!   "name = '%s' AND protocol = '%s'",
!   2,
    0,
    0,
    0,
!   set_service_modtime,
  };
  
+ static struct validate dsvc_validate = {
+   asvc_valobj,
+   2,
+   "name",
+   "name = '%s' AND protocol = '%s'",
+   2,
+   0,
+   0,
+   0,
+   0,
+ };
+ 
  static char *gprn_fields[] = {
    "name",
    "name", "type", "hwtype", "duplexname", "hostname",
***************
*** 5406,5413 ****
      "name, protocol, port, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM services",
      gsvc_fields,
      7,
!     "name LIKE '%s'",
!     1,
      "name",
      &VDfix_modby,
    },
--- 5422,5429 ----
      "name, protocol, port, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM services",
      gsvc_fields,
      7,
!     "name LIKE '%s' AND protocol LIKE '%s'",
!     2,
      "name",
      &VDfix_modby,
    },
***************
*** 5438,5449 ****
      "ss",
      SERVICES_TABLE,
      0,
!     asvc_fields,
      0,
!     "name = '%s'",
!     1,
      NULL,
!     &asvc_validate,
    },
  
    {
--- 5454,5465 ----
      "ss",
      SERVICES_TABLE,
      0,
!     dsvc_fields,
      0,
!     "name = '%s' AND protocol = '%s'",
!     2,
      NULL,
!     &dsvc_validate,
    },
  
    {


home help back first fref pref prev next nref lref last post