This page continues SDNet: Your Login on a Server.
The files-only route on a server#
This section is about the server being reached, the one whose administrator is giving somebody a login. (The same machine is that server for others and the client for its own people, so both halves can be yours.)
The way to log in to a server's API is membership of the Windows
group sdapi, which gives everything the API offers: execute commands, call
subroutines, enter other accounts with logto, work with sequential files and files.
A stored SDNet login on that route, taken from a machine, would give whoever took it
all of that. So there is a second route, the Windows group sdfiles: a login that is
in sdusers and sdfiles and not in sdapi is let in "files only". The rest of
the rules, the table of what is allowed and refused and why, the words and the
messages are in Accounts and Security; in short:
sdapiwins. A remote user who is in both groups has the whole API.- A user in neither group is refused, as before. Both groups are empty for a new
account until the administrator of that server adds the person
(
modify.accountnamefiles-on, orfiles-onwhen the account is made). - A files-only session may open and close files; read records; select, read the next
id and read and save lists; ask about locks and release them; use indices; ask for
file information; and set its account once, which is the entry after login.
With the write group as well (next section) it may also write and delete
records, take record and file locks (and read with a lock), and clear a file.
It may not call a
subroutine, execute a command or answer its prompts, enter another account,
use sequential files, read variables, run
system(),trans()or an evaluation or conversion, run a transaction, or open an SDNet file on a third server. Any other request, and any request number SD does not know, is refused: the table is an allow list. - A refused request is not carried out. It is answered with "This login is for files only: request n is not allowed" and written to the audit trail; the connection stays up.
- Everything else about the session is as for any other API login: the account has to
be entered, its switches (OS access, the edit switches, NET) apply,
SDCLIENTstill applies, and SDSYS is never made files-only. - It is a read-only route unless the remote user is also in
sdfileswrite(next section). The table above is whatsdfilesalone allows: the writes, deletes, locks and clear are in it only for a login that also has the write group.
How the Windows API serves it. The API listener runs as LocalSystem and hands a
signed-in connection to a new session that already has the person's identity. That
session works out for itself, from the Windows groups and live, whether it is files
only and whether it has the write group: sdapi first (it wins), then sdfiles, then
sdfileswrite. A person in neither sdapi nor sdfiles, or whose groups cannot be
read, is refused and never reaches the request loop. A group that cannot be read at
all counts as not a member, so a doubt never grants write.
The write group: sdfileswrite#
A login on the target server may change something only if the target's administrator allows it. That is the rule, and it is why a write server definition on a client is no longer enough by itself: the definition says what the client is willing to do, the write group says what the target is willing to let that login do.
- The Windows group
sdfileswriteis made, empty, by the installer besidesdfiles. SDSYS gives it to one person at a time on the server being reached:modify.accountnamefiles-write-on, taken away withfiles-write-off, andfiles-write-onafterfiles-onincreate.account user. It is off for a new account. files-write-onneedsfiles-onfirst. The group alone gives nothing (the login route issdfiles), so for a person who is not insdfilesit is refused: "Account name does not have files access, so it cannot be given files-write: use files-on first" (message 12528).create.account usernamefiles-write-onwithoutfiles-onis refused the same way before anything is made. A group or other account is refused as forfiles-on.files-offtakes the person out ofsdfileswritetoo, and first, so a laterfiles-ondoes not hand the write back without you saying so. It removes the write group, reads it back, then removessdfilesand reads that back, and it does the work for a person who is in only one of the two: a person who is insdfileswriteand not insdfiles(a removal that stopped half way, or a change made by hand) is taken out of it, so a membership left in place cannot become write access at the nextfiles-on. If a removal fails the command says so ("Unable to change remote access for name, status: n") and stops: a failure of the write group's removal leaves the person exactly as they were, and a failure of the second removal leaves them insdfilesalone, with read access and never write access without read. In that second case the command says what did happen before it says it failed: it printsAccount fred has files-write noand writes the audit linemodify.account files-write-off account=fredfor the removal that worked (the audit line forfiles-offitself is written only when both removals worked), so the screen and the trail agree with the group. When the write group went and the command went on to succeed, the same lineAccount fred has files-write nocomes beforeAccount fred has files no.files-onremoves a leftoversdfileswritemembership before it addssdfiles, and stops with the same failure message if it cannot; if the leftover went and the add ofsdfilesthen fails, the person is left in neither group, and the command says so in the same way (files-write noline,files-write-offaudit line, then the failure).- What it changes. Without it a files-only login is refused: write (16), writeu (17),
delete (18), deleteu (19), lock record (30), clearfile (31), file lock (32) and file
unlock (33), a test of a lock (34, which is what
RECORDLOCKED()sends), the four locking reads (7 to 10), and aREADVwith a lock flag. They are answered "This login cannot change or lock files here: ask the administrator for files-write-on (request n)" (message 12526) and nothing is carried out. Reads, selects,READVwithout a lock, file information, the indices andRELEASEstill work. (A test of a lock names the holder by his user number on this server, which a login that cannot lock has no business with.) sdapiis not touched. A remote user insdapihas the whole API as before, with or without the write group, and SDSYS is never made files-only.- The refusal is in the audit trail of the target, in lower case:
api refused request=16 route=sdfiles write=off admin=off user=name, and a login by this route is writtenapi login route=sdfiles write=on admin=off user=name(write=offfor a login without the group; theadmin=word is the administration group, next section). The person at the client is told why: a program that does not trap the error withON ERRORstops with message 12505, "Server name answered write with an error: This login cannot change or lock files here: ask the administrator for files-write-on (request 16)". (The client shows the text of anyON ERRORreply that has one, cut at 100 characters; a reply with no text still shows "status n".) A program that traps the error withON ERRORseesSTATUS()7000, as before. The audit trail on the target also has the request number. - The group is read at login, from the Windows groups, so a change takes effect at the person's next login on that server, and a refusal to read the groups refuses the login with its own reason.
- A machine without the groups has neither until the installer is run again; until then
files-onandfiles-write-onsay that the group does not exist and change nothing, andcreate.accountrefuses to make a user it was asked to give the route. - A server defined
writeon a client writes only when the remote user has been given the group on the target (onemodify.accountword there). Reads are unaffected.
Continued in#
SDNet: The Administration Group and Remote Files, Read Only — the sdfilesadmin group and remote files, read only.