nwconn: document and guard NCP 13 get station number
All checks were successful
Source release / source-package (push) Successful in 48s

Replace the old "Get connection ??" TODO for NCP function 0x13 with the
documented old Get Station Number semantics.

This simple legacy call returns the current station/connection number as a
single byte and is used by old DOS requesters before the richer NCP 23
connection services. Keep the existing one-byte reply for normal connections,
but reject invalid or unrepresentable connection numbers instead of silently
truncating them.

No queue or file service behavior change.
This commit is contained in:
Mario Fetka
2026-05-29 18:16:03 +02:00
parent 55be945c02
commit e825a8d2e7

View File

@@ -579,10 +579,22 @@ static int handle_ncp_serv(void)
}
break;
case 0x13 : { /* Get connection ?? */
/* TODO !!!!!!! */
*responsedata=(uint8) act_connection;
data_len = 1;
case 0x13 : { /* Get Station Number */
/*
* This is the old one-byte connection number call used by
* DOS requesters before the richer NCP 23 connection services.
* The SDK describes the client-visible API as
* NWGetConnectionNumber(); older low-level documentation names the
* underlying simple NCP 0x13 "Get Station Number".
*/
if (act_connection > 0 && act_connection < 256) {
*responsedata=(uint8) act_connection;
data_len = 1;
} else {
XDPRINTF((1, 0, "Get Station Number failed, conn=%d",
act_connection));
completition = 0xff;
}
}
break;