AUTHSRV(3)
π AUTHSRV(3) β routines for communicating with authentication servers π
okay so welcome to AUTHSRV(3) from the Library Functions Manual β this is the whole βtalking to auth serversβ situation, and weβre keeping every single deet. no cap. letβs get into it, bestie π«Άβ¨
β¨ NAME β¨
authdial, passtokey, nvcsum, readnvram, convT2M, convM2T, convTR2M, convM2TR, convA2M, convM2A, convPR2M, convM2PR, _asgetticket, and _asrdresp β routines for communicating with authentication servers.
π¦ SYNOPSIS π¦
includes first, bestie:
#include <u.h>
#include <libc.h>
#include <authsrv.h>
and the prototypes, exactly as printed (yes, with the quirky punctuation β copying the manpage, not fixing it π):
int authdial(char *netroot, char *ad);
int passtokey(char key[DESKEYLEN], char *password)
uchar nvcsum(void *mem, int len)
int readnvram(Nvrsafe *nv, int flag); int convT2M(Ticket *t,
char *msg, char *key)
void convM2T(char *msg, Ticket *t, char *key)
int convA2M(Authenticator *a, char *msg, char *key)
void convM2A(char *msg, Authenticator *a, char *key)
int convTR2M(Ticketreq *tr, char *msg)
void convM2TR(char *msg, Ticketreq *tr)
int convPR2M(Passwordreq *pr, char *msg, char *key)
void convM2PR(char *msg, Passwordreq *pr, char *key)
int _asgetticket(int fd, char *trbuf, char *tbuf);
int _asrdresp(int fd, char *buf, int len);
π DESCRIPTION π
π authdial
authdial dials an authentication server over the network rooted at net, default /net. The authentication domain, ad, specifies which server to call.
If ad is non-nil, the network database (see ndb(1)) is queried for an entry which contains authdom=ad or dom=ad, the former having precedence, and which also contains an auth attribute. The string dialed is then netroot!server!ticket where server is the value of the auth attribute.
If no entry is found, the error string is set to no authentication server found and -1 is returned.
If authdom is nil, the string netroot!$auth!ticket is used to make the call.
yes, the manpage flips betweenadandauthdomin this paragraph β Iβm just repeating it, bestie π
π passtokey
passtokey converts password into a DES key and stores the result in key. It returns 0 if password could not be converted, and 1 otherwise.
π readnvram
readnvram reads authentication information into the structure:
struct Nvrsafe
{
char machkey[DESKEYLEN];
uchar machsum;
char authkey[DESKEYLEN];
uchar authsum;
char config[CONFIGLEN];
uchar configsum;
char authid[ANAMELEN];
uchar authidsum;
char authdom[DOMLEN];
uchar authdomsum;
};
On Sparc, MIPS, and SGI machines this information is in non-volatile ram, accessible in the file #r/nvram.
On x86s and Alphas readnvram successively opens the following areas stopping with the first to succeed:
- the partition named by the
$nvramenvironment variable - the partition
#S/sdC0/nvram - a file called
plan9.nvrin the partition#S/sdC0/9fat - the partition
#S/sd00/nvram - a file called
plan9.nvrin the partition#S/sd00/9fat - a file called
plan9.nvron a DOS floppy in drive 0 - a file called
plan9.nvron a DOS floppy in drive 1
The nvcsums of the fields machkey, authid, and authdom must match their respective checksum or that field is zeroed.
If flag is NVwrite or at least one checksum fails and flag is NVwriteonerr, readnvram will prompt for new values on #c/cons and then write them back to the storage area.
π the conv* crew
convT2M, convA2M, convTR2M, and convPR2M convert tickets, authenticators, ticket requests, and password change request structures into transmittable messages.
convM2T, convM2A, convM2TR, and convM2PR are used to convert them back.
key is used for encrypting the message before transmission and decrypting after reception.
π¨ _asgetresp and _asgetticket
heads up: the synopsis lists_asrdresp, and the prose below calls it_asgetrespβ Iβm keeping both exactly because thatβs what the page says, bestie π
The routine _asgetresp receives either a character array or an error string. On error, it sets errstr and returns -1. If successful, it returns the number of bytes received.
The routine _asgetticket sends a ticket request message and then uses _asgetresp to recieve an answer.
βrecieveβ is the manpageβs spelling, not mine π
π¦ SOURCE π¦
/src/libauthsrv
π SEE ALSO π
π©Ί DIAGNOSTICS π©Ί
These routines set errstr. Integer-valued functions return -1 on error.
π thatβs the whole page, bestie. sign-off vibes: AUTHSRV(3), Library Functions Manual β no extra date printed on this page, so Iβm not inventing one. stay encrypted and hydrated ππ¦
π¦ where this page comes from
- alpine 3.24: plan9port-doc 0_git20260208-r0 Β· LPL-1.02
- arch rolling: plan9port 20261021-2 Β· custom
- nixos 26.05: plan9port 0-unstable-2025-11-10
- nixos 26.05: plan9port-wayland 0-unstable-2025-11-26
- nixpkgs unstable: plan9port 0-unstable-2025-11-10
- nixpkgs unstable: plan9port-wayland 0-unstable-2025-11-26
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms