authrhosts.c 747 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include <plan9.h>
  2. #include <fcall.h>
  3. #include <u9fs.h>
  4. /*
  5. * return whether the user is authenticated.
  6. * uses berkeley-style rhosts ``authentication''.
  7. * this is only a good idea behind a firewall,
  8. * where you trust your network, and even then
  9. * not such a great idea. it's grandfathered.
  10. */
  11. static char*
  12. rhostsauth(Fcall *rx, Fcall *tx)
  13. {
  14. USED(rx);
  15. USED(tx);
  16. return "u9fs rhostsauth: no authentication required";
  17. }
  18. static char*
  19. rhostsattach(Fcall *rx, Fcall *tx)
  20. {
  21. USED(tx);
  22. if(ruserok(remotehostname, 0, rx->uname, rx->uname) < 0){
  23. fprint(2, "ruserok(%s, %s) not okay\n", remotehostname, rx->uname);
  24. return "u9fs: rhosts authentication failed";
  25. }
  26. return 0;
  27. }
  28. Auth authrhosts = {
  29. "rhosts",
  30. rhostsauth,
  31. rhostsattach,
  32. };