SD Core for Windows WC2.0-0

SDNet: The Administration Group and Remote Files, Read Only

The sdfilesadmin group, and what a program may do with a remote file it can only read.

This page continues SDNet: The Files-only Route.

The administration group: sdfilesadmin#

QMNet's remote administration, behind a third permission that is off for everyone. A files-only login that is in both sdfileswrite and the Windows group sdfilesadmin may, on that server and for the account it enters there, do the things below. They are requests 68 to 71 of the API, and they are the only door a files-only login has to them.

68, 69 WRITE and WRITEU ... CREATING.SEQKEY: the file's own counter on this server gives the id
70 a verb run on this server for the login: analyze.file, configure.file, create.index, build.index, delete.index, disable.index, create.file, delete.file
71 FCONTROL(file, key {, value})

The client. The SDNet client logs in with the stored login (made by set.netlogin) and uses only the requests this route allows, so that it needs no more than sdfiles, plus sdfileswrite for a server defined write. Opening a remote file through an N pointer is the client. set.netlogin itself makes the login exchange as it always did, which does not depend on the route: the server decides the route at the end of the exchange. A set.netlogin made against a user who is only in sdfiles succeeds, and remote reads and queries work for that user; writes and locks work once it is also in sdfileswrite.

On the machine being reached: the groups sdfiles, sdfileswrite and sdfilesadmin are made, empty, by the installer beside sdssh and sdapi. An uninstall that keeps the database and the Windows accounts keeps them, with the members each had; they are removed with the accounts or where no database is left (a silent uninstall leaves all of the groups, and the next install that finds no database empties them). The API listener has to be on (remote.api, see Remote Access and the Machine), as for any API login.

Remote files, read only#

A VOC entry whose first field is N names a file on another SD server. It has two more fields: the server's name as defined with set.server (field 2) and the file's name on that server (field 3). Names are lower case; the server name is a letter and up to 15 letters or digits, the file name up to 63 letters, digits and . _ - $. Anything else is refused.

N
nfa
customers

Opening it with OPEN 'customers' TO f (using the VOC name) gives a file variable that READ, MATREAD, READV, SELECT, SELECTV, SSELECT, FILEINFO and CLOSE work on, and GETLOCKS() (the local view, see "Writing and locking" below). RECORDLOCKED() is not on this list: it needs a write definition and the write group like a lock (see "Writing and locking" below). OPEN 'DICT', 'customers' TO d opens the dictionary of the remote file, from the same server, and the same statements work on it. (The request the client sends for a dictionary is dict customers in lower case; the server opens dict and a name, in any case, as a dictionary. A server that does not answer this request leaves LIST, COUNT, SORT and SELECT on a remote file stopped at "Cannot open dictionary".) Nothing else does. Every other statement given the file variable (writes, deletes, CLEARFILE, locks including FILELOCK and FILEUNLOCK, AKREAD...) stops with message 12506 (or, with ON ERROR, sets STATUS() and goes on), and nothing is sent to the other server. OPENPATH, OPENTEMP, OPENSEQ and CALL "file program" never see such a pointer.

Queries. LIST, COUNT, SORT, SELECT, SSELECT, LIST.ITEM and LIST DICT work on the VOC name, with the dictionary read from the server. A SELECT takes every record id of the remote file in one reply and turns it into an ordinary select list; each record a query needs is then one request to the server, so a query that reads every record of a big file costs one round trip per record, and a WITH clause reads each record. An id list given on the command line (LIST customers 'c2') selects nothing and reads only those records. INDICES(f) and the index query statements (SELECTINDEX, SETLEFT, SETRIGHT, SELECTLEFT, SELECTRIGHT) go to the server, so a WITH clause on a field the server has an index for asks the server's index (one request for the ids of a value, or a scan from one key to the next) and reads only the records it names; a file with no index is read as before. A remote file answers FILEINFO(f, FL$TYPE) with 7 (FL$TYPE.NET) and counts as case-insensitive, as every file on a current server is.

Who may open one, checked in this order before anything is dialled: the account holds the NET switch (or is SDSYS), the server is defined, the account is in the definition's accounts list, the user has a stored login (set.netlogin) and the server's key still matches the pin, and the limits (10 servers, 100 open remote files per process) hold. An $internal program is not exempt. Each failure has its own message and an audit line, netfile refused server=... reason=...; a success writes netfile open server=... file=....

Who may write the pointer. The VOC is protected by the voc.edit switch, which is off for an ordinary account, so only SDSYS or an account SDSYS has given voc.edit can make one. The switch that matters for using it is the NET switch of whoever opens the file.

The login to the other server is the stored one of the person running the program, made with set.netlogin; the connection is the other server's API port, TLS 1.3, with the pinned key checked before a byte is sent. A connection that dies is noticed on the next use and reported; it is never quietly remade in the middle of an operation. All of a process's connections end when the process does, and at LOGTO: going into another account, and coming back, closes every connection and invalidates every remote file variable opened before (a READ on one is an error), so a remote file never follows a person into an account that was not asked whether it may use it. A new OPEN dials again.

The record cache. To save requests, a process keeps the last 64 records it READ from remote files for 2 seconds, and the fact that the server did not have a record. A second READ of the same record from the same file variable in that time is answered from memory. This means a READ can show a record up to 2 seconds old: a program that waits for another user's change to a remote record sees it up to 2 seconds late. A record over 32,768 bytes is not kept, READV is not cached, and the entries of a file go when it is closed, when it is SELECTed again, and at LOGTO. Ids are kept as given, so READs of JACK and jack are two entries. The cache roughly halves the requests of a SORT; it does little for a LIST that reads every record once.

What is not here yet: saved lists on the remote side.

COUNT, LIST, LIST DICT and SORT work on a remote file, as does the opening of its dictionary. A read-only definition refuses a write, and a definition whose pin the stored login was not made for is refused before anything is sent.

Which remote files work#

A remote file is whatever the remote account's VOC names, opened by the server with its ordinary OPEN, so the rules are the server's. What the client adds is on this page: the name is 63 characters or fewer, an id is 1 to 63 characters (anything longer is refused on the client before it is sent), and what a program receives is the record the server sends, with the marks as the server holds them. The User set's page 42, Programming with a Remote File, has the table of ids, directory files and the case of ids.

Continued in#

SDNet: Writing and Locking — the write mode and locking.