Annotation of src/usr.bin/sudo/PORTING, Revision 1.2
1.1 millert 1: Sudo porting hints
2: ==================
3:
4: Before trying to port sudo to a new architecture, please join the
5: sudo-workers mailing list (see the README file) and ask if anyone
6: has a port working or in-progress. Sudo should be fairly easy to
1.2 ! millert 7: port. Since it uses a configure script, most of the work is often
! 8: done for you. As long as your operating system is reasonably POSIX
! 9: compliant porting should be easy. If your operating system has a
! 10: separate library for POSIX compatibility you may need to add it by
! 11: using configure's --with-libraries option.
1.1 millert 12:
13: If your OS is an SVR4 derivative (or some approximation thereof), it may
14: be sufficient to tell configure you are runnng SVR4, something like:
15: configure foo-bar-sysv4
16: where foo is the hardware architecture and bar is the vendor.
17:
18: A possible pitfall is getdtablesize(2) which is used to get the
19: maximum number of open files the process can have. If an OS has
20: the POSIX sysconf(2) it will be used instead of getdtablesize(2).
21: ulimit(2) or getrlimit(2) can also be used on some OS's. If all
22: else fails you can use the value of NOFILE in <sys/param.h>.
23:
1.2 ! millert 24: Sudo tries to clear the environment of dangerous environment variables
! 25: such as LD_* to prevent shared library spoofing. If you are porting
! 26: sudo to a new OS that has shared libraries you'll want to mask out
! 27: the variables that allow one to change the shared library path.
! 28: See initial_badenv_table() in env.c to see how this is done for
! 29: various operating systems.
1.1 millert 30:
31: It is possible that on a really weird system, tgetpass() may not
32: compile. (The most common cause for this is that the "fd_set" type
33: is not defined in a place that sudo expects it to be. If you can
34: find the header file where "fd_set" is typedef'd, have tgetpass.c
35: include it and send in a bug report.)
36: Alternately, tgetpass.c may compile but not work (nothing happens
37: at the Password: prompt). It is possible that your C library
38: contains a broken or unusable crypt() function--try linking with
39: -lcrypt if that exists. Another possibility is that select() is
40: not fully functional; running configure with --with-password-timeout=0
1.2 ! millert 41: will disable the use of select(). If sudo prompts you for a
! 42: password but never accepts it, see below.
! 43:
! 44: Sudo detects and recognizes most common shadow password schemes
! 45: automatically. If you find that sudo is not accepting your password
! 46: and you are sure that it has been typed in correctly there are two
! 47: likely problems. One possibility is that your C library has a
! 48: broken crypt() function (see above). The other is that your operating
! 49: system is using shadow passwords and sudo has not detected that
! 50: fact. Look in config.h to see what, if any, shadow password scheme
! 51: was detected. The most common are SVR4 (HAVE_GETSPNAM will be
! 52: defined) and SecureWare (HAVE_GETPRPWNAM will be defined). Check
! 53: the manual pages on your system for "getspnam" and "getprpwnam".
! 54: If one of those exist but the appropriate define does not exist in
! 55: config.h then the problem is most likely that those routines live
! 56: in a library that sudo does not know to link against. The manual
! 57: page should tell you what library this is. You can then use the
! 58: --with-libraries option to configure to tell sudo to link with the
! 59: library in question. For example:
! 60: --with-libraries='-lgen'
! 61: would cause sudo to link in libgen which contains "getspnam" on SCO
! 62: systems.
1.1 millert 63:
64: If you are trying to port to a system without standard Berkeley
65: networking you may find that interfaces.c will not compile. This
1.2 ! millert 66: is most likely on OS's with STREAMS-based networking. It should
! 67: be possible to make it work by modifying the ISC streams support
1.1 millert 68: (see the _ISC #ifdef's). However, if you don't care about ip address
69: and network address support, you can just run configure with the
1.2 ! millert 70: --without-interfaces flag to get a do-nothing load_interfaces()
! 71: stub function.
! 72:
! 73: Sudo wants POSIX signals (sigaction and friends). If your system
! 74: lacks sigaction but has the 4.3BSD sigvec() function, sigvec() will
! 75: be used instead via the wrapper functions in sigaction.c. It is
! 76: not currently possible to use the old SVR3 and 4.2BSD signals, but
! 77: this is due more to my lack of a test machine than anything else.
1.1 millert 78:
79: If you port sudo to a new architecture, please send the output of
80: "configure", the config.log file and your changes to:
81: sudo@courtesan.com
82:
83: If you are unable to get sudo working, and you are willing to
84: give me an account on a machine, send mail to sudo@courtesan.com.
85: Note, however, that I can't make any promises.