H From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 30-MAR-1993 22:16:11.97 To:	Info-VAX@KL.SRI.COM  CC:	7 Subj:	Re: Operator terminals - global data structures?y   f In article <1993Mar30.120304.4913@ucsvc.ucs.unimelb.edu.au>, jonathan@ucsvc.ucs.unimelb.edu.au writes:K > I am wanting to programatically examine and modify the operator status of P > operator terminals.  It is straightforward to determine which terminals on theP > local node are operator terminals using $DEVICE_SCAN and $GETDVI.  One can useP > $SNDOPR to enable/disable operator classes and to display operator status, butK > this does not return information to the program and (presumably) produces  > associated OPCOM messages. >  > Questions: > ; > 1.  What global data structures can be used to determine: ' >     . all enabled operator terminals   > D > 2.  What global data structures can be used to examine and modify:4 >     . operator classes enabled on a given terminal: >     . temporary or permanent status of operator terminal > J > 3.  Can any of this be done on a cluster-wide basis from the local node,' >     presumably using system services?  >   > Code examples would be useful. >   N I attacked this problem some time ago as a self-set exercise - I think when myD site was running V5.0 of VMS.  Basically, all of the operator statusM information (including a lot more that it records but doesn't display to you, L including the operator's UIC and enabled privileges at the time the terminalK was enabled) are stored in P0 space for the OPCOM process.  In other words, ? the only way to access it is via tricky privileged programming.   J I wrote a program to report all of the operators enabled, their usernames,N UICs, privileges and enabled classes cluster-wide.  Cluster-wide was made easyO by the fact that all OPCOM processes communicate to each other and all let each M other know about their operator friends on each node.  So any operator on any F node will have info about him/her in P0 of every OPCOM in the cluster.  N To get this info, my program delivered an AST to OPCOM telling it to run a bitJ of code that I wanted it to.  This code got it to traverse it's OPCOM dataL structures and write selected info about each operator to a global section IO had created.  I then picked the info out of the global section and dumped it on  the screen.   O There was only one problem with the program, and the problem is more with OPCOM I than my code.  OPCOM has to allow for the fact that some operators do not H "disable" their terminal before logging out, and for the fact that theirN processes might die before they disable a terminal.  So it is possible that anL operator that OPCOM thinks is there has gone away.  When OPCOM tries to talkJ (ie. broadcast) to an operator and finds that he/she has gone home withoutH telling it, OPCOM deletes the operator from it's database (effectively aH "reply/disable").  To cope with this, before my code dumps info about anH operator to the screen, it checks that the enabled terminal still exists6 (using $GETDVI) (yes I'm talking about LAT terminals).  J Naturally it was not possible to use $GETDVI to check terminals on another4 node, even though OPCOM held info about other nodes.   FLAME ONI I think OPCOM is brain dead.  Your statement that "one can use $SNDOPR to M enable/disable operator classes and to display operator status, but this does J not return information to the program and (presumably) produces associatedK OPCOM messages" is correct.  $SNDOPR can return no info to the caller about N enabled operators and in fact *does* send a broadcast message about the statusJ of *your* request to the *other* terminal.  In other words, if you requestK status information about any terminal, the result of that request will be a N broadcast message to the terminal that the info was requested about !  No info! is returned to you - the caller !   L A number of our unprivileged users found this out and used it to annoy otherK users and operators, and there is no way of finding out who they are.  It's H even easier with DCL.  REPLY gives you no opportunity to specify anotherM terminal like $SNDOPR does, but it uses SYS$COMMAND.  Just define SYS$COMMAND I to be some other terminal and you can send rubbish to that terminal, even # without OPER privilege.  Try this :    $ define/user sys$command opa0:  $ reply/status  K Any unprivileged user can do this and send OPA0's operator status to OPA0.  K This might be the OPCOM banner followed by "an illegal operator request was M made" or it might be "CARDS,CENTRAL,SECURITY,TAPES" etc.  Try this specifying O any terminal and repeat it a large number of times (eg. in a command procedure) P to virtually make ANY terminal useless by bombarding it with OPCOM messages.  AsK a system or security manager, try finding out who is doing it - no can do !   O I reported this to Telephone Support as a problem and the response was "sorry - , log an SPR", which I did, but still no fix !	 FLAME OFF   N To answer your questions, you can get operator information from OPCOM, but youL need to be able to write code that delivers an AST to it asking it to returnF the information to you.  You also need to know the internal OPCOM dataM structure layouts.  This can be determined from the VMS source listings under N the heading OPCOM.  I had to change my program for at least one release of VMSG and I haven't run it for a while.  It may not work under my current VMS M version (5.5-2), but it's fun keeping up with the changes and seeing what DEC  change each time.   O I suppose you could use similar techniques to *modify* operator status, or even O add or remove operators, but I would recommend sticking to $SNDOPR for changes, J even if $SNDOPR's and OPCOM's functionality is typical of version 1 (field" test) of a cheap software product.  # If you want a copy of my code, ask.   
 Craig McGill.  VMS System Programmer. Canberra, Australia.  P [The opinions expressed in this note are not necessarily those of anyone but me]  