Page MenuHomeFreeBSD

rusers: Add version 3 of rusers
Needs ReviewPublic

Authored by yanhaowang on Jul 17 2024, 3:10 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 26, 9:09 AM
Unknown Object (File)
Wed, Dec 25, 7:52 PM
Unknown Object (File)
Wed, Dec 25, 3:48 PM
Unknown Object (File)
Mon, Dec 23, 7:06 AM
Unknown Object (File)
Mon, Dec 23, 7:05 AM
Unknown Object (File)
Mon, Dec 23, 7:04 AM
Unknown Object (File)
Sun, Dec 22, 6:09 PM
Unknown Object (File)
Sat, Dec 14, 3:06 PM
Subscribers

Details

Reviewers
hrs
lwhsu
Summary

rpc.rusersd

Originally, rusersd used version 1 and 2 of rusers (via the rusers_service function) only on UDP.

I made the following changes:

  1. If started from inetd, use getnetconfig with a while loop to register rusersd on all networks.
  2. If not started from inetd, use svc_create with the “netpath” parameter to register on all networks.

Then, I added a version 3 handler in the rusers_service function for version 3 of rusers and registered it as described above.

rusers

I used netbuf to store the host address information and added a version 3 function, rusers_reply_3. I employed rpc_broadcastl and clnt_create with the “netpath” parameter.

Comparison between Version 3 and Version 2:

ut_user = ut_name
ut_line = ut_line
ut_host = ut_host
ut_type (New attribute, type of entry)
ut_time = ut_time
ut_idle = ut_idle

Compile

  1. cd /usr/src/libexec/rpc.ruserd/ && make all install
  2. cd /usr/src/usr.bin/rusers/ && make all install
Test Plan

I have test bot the rpc.ruserd and rusers on localhost, including version 3 and 2 (RPC_PROGVERSMISMATCH), from inetd or run directly. And I also test the broadcast by create a jail under same subnet and it work too.

kola@freebsd:/usr/src/libexec/rpc.rusersd $ sudo rusers localhost // Version 3
localhost            kola kola kola kola kola kola 
kola@freebsd:/usr/src/libexec/rpc.rusersd $ sudo rusers localhost // Version 2
RPC_PROGVERSMISMATCH // debug log
localhost            kola kola kola kola kola kola

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 58934
Build 55821: arc lint + arc unit

Event Timeline

usr.bin/rusers/rusers.c
99

If use __unused I will meet [clang] (-Wc2x-extensions) Omitting the parameter name in a function definition is a C2x extension. So I use _unused and cast it to void below, not sure if this is suitable.

Add clnt_call function for version 3

yanhaowang edited the test plan for this revision. (Show Details)