Change AFS*_LINUXnn_ENV to AFS*_LINUX_ENV The minimum Linux kernel that is now supported is linux-2.6.18. The Linux versioned preprocessor macros AFS_*LINUXnn_ENV are no longer needed to distinguish the different levels of Linux and can be merged into just a single set of macros. Perform a global change of _LINUX\d+_ENV to _LINUX_ENV. e.g. AFS_LINUX24_ENV -> AFS_LINUX_ENV AFS_USR_LINUX24_ENV -> AFS_USR_LINUX_ENV AFS_AMD64_LINUX20_ENV -> AFS_AMD64_LINUX_ENV Replace the multiple definitions for the versioned 'AFS*_LINUXnn_ENV' with just single non-version definitions 'AFS*_LINUX_ENV'. Apart from replacing the now-redundant #define directives and tidying up a few comments at the close of a preprocessor block to match their current form, this commit was done using a mechanical change of the variable names and did not reduce preprocessor statements that could now be combined or eliminated. Nor does this commit remove dead code. A follow-up commit (Cleanup AFS_*LINUX_ENV usage) will handle these changes. The updates should have no functional changes. Change-Id: I71e32ca9818d28f82b4f23679868d1b9a62c44bd Reviewed-on: https://gerrit.openafs.org/14387 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
kauth: Add support for updated audit facility New functionality was added to the audit facility that allows multiple audit logs. The updated audit interfaces require a specific calling sequence even if multiple audit logs are not used. Support for multiple auditlogs is not supported for kauth. Since kauth does not use libcmd for processing the command line, and adding support for multiple audit log instances requires additional effort, that is not warranted. Update kauth to follow the proper calling sequences for the audit facility. Update help message and manpage entries for -auditlog and -audit-interface. Make note that multiple -auditlogs are not supported. Change-Id: I98111b1e399e6687fde235bc2eadf0a28fa8acf4 Reviewed-on: https://gerrit.openafs.org/13782 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Log binding ip address and port during startup Many daemons currently have the ability to bind to a specific ip address using the -rxbind parameter. The behavior can be a little unintuitive, however, since we only bind to the ip address we find via NetInfo/NetRestrict processing, and only if we end up with a single ip address. Since that processing involves examining the set of ip addresses available, this can have confusing results if, for instance, a daemon starts up while an administrator is changing the local ip configuration. If a daemon binds to a different ip address than the administrator expects, this can be very confusing, especially since for most daemons we don't log our bound ip anywhere. To help alleviate this, change the startup code for all of our daemons to log what ip we are trying to bind to (or "0.0.0.0" if none), along with our local port. Change-Id: I18d3647c4d134177a0a17c6a64583d444558a9f6 Reviewed-on: https://gerrit.openafs.org/13272 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Call rx_InitHost once during daemon startup Currently, a few daemons calls rx_InitHost in different places, and under different conditions. For example, vlserver calls rx_InitHost only when we -rxbind to a specific ip address, and then also makes an additional rx_Init call. Other daemons always call rx_InitHost, or just call rx_InitHost sometimes and don't make an extra rx_Init call. To try to make the various daemons behave a little more consistently, change the startup code to always call rx_InitHost, and to only call it once. Note that rx_InitHost is the same as calling rx_Init with INADDR_ANY as the ip address, and calling rx_Init* after a previous rx_Init* call is effectively a no-op. Change-Id: Ifd15175349a7b4695e684ca82deb8a8af5063073 Reviewed-on: https://gerrit.openafs.org/13271 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Remove server logging globals Remove the global variables used to setup server logging and replace with an argument to OpenLog. Keep the LogLevel variable as a global for use by the logging macros, but provide an inline function for applications which check the log level to dump more information when the log level is increased. Provide consistency by adding syslog tags to processes that did not previously set one (salvageserver, salvager, and volserver). [kaduk@mit.edu: update commit message, use old-style log rotation for kalog, minor commenting fixes] Change-Id: I11cffbdd1418304d33f0be02dd7e600955c4a8bb Reviewed-on: https://gerrit.openafs.org/12168 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
Allocate pathname buffers dynamically This change reworks numerous places which formerly used potentially large on-stack buffers (of size AFSDIR_PATH_MAX) for constructing or storing pathnames. Instead, these buffers are now allocated from the heap, either by using asprintf() to build a pathname in a correctly sized buffer or, where necessary, using malloc() to allocate a buffer of size AFSDIR_PATH_MAX. A few occurrances of AFSDIR_PATH_MAX-sized buffers are not changed; these are generally either globals or are contained within another data structure that is already allocated on the heap. [kaduk@mit.edu convert to cleanup-handler memory management where appropriate] Change-Id: Ib1986187a1c467e867d50280aaf1d8a86d9108c8 Reviewed-on: http://gerrit.openafs.org/9985 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Use the RX_SECIDX_* enums in more places Add symbols for security indices 1 (rxvab, unused) and 3 (rxkad with always-encrypt, maybe-used). kauth and bubasics defined macros for RX_SCINDEX_*; replace those with the common core rx enums as well. Use the global symbols instead of custom defines like BULK_NULL and SAMPLE_NULL, which can now be removed. Reformat a comment to match current style, since we're changing it anyway. Change-Id: I82bbb0016a5c3129dfd18ff7dc77ff7839501ad8 Reviewed-on: http://gerrit.openafs.org/10526 Reviewed-by: Perry Ruiter <pruiter@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: D Brashear <shadow@your-file-system.com>
Do not hide -enable_{peer,process}_stats Both afsd and kaserver accepted the -enable_peer_stats and -enable_process_stats options, but they did not include the options in their usage message. We already document these flags in the manpages, so also include them in the usage message; they are not a secret. Change-Id: Ic1ff0e8c0dcd07e2721676b09a53c30a3db3ee9d Reviewed-on: http://gerrit.openafs.org/10419 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
kauth: Don't overflow cellinfo hostAddrs array The hostaddrs array has MAXHOSTSPERCELL (8) available elements. The ubik connections list has MAXSERVERS (20) elements - when copying from the ubik list into the cellinfo hostaddrs list, be careful not to overflow it. Caught by coverity (#985577) Change-Id: Ie51cb939a6e3381a285787ad125342ca7a9e7cbb Reviewed-on: http://gerrit.openafs.org/9323 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com> Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
kauth: Don't ignore GetExtendedCellInfo failures Don't ignore a failure from afsconf_GetExtendedCellInfo, as it will leave buffers that we later read uninitialised. Caught by clang-analyzer Change-Id: Ia0c2675a3083385d011fd340f36bf13373f89feb Reviewed-on: http://gerrit.openafs.org/9180 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@your-file-system.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
auth: Relocate NetRestrict support functions Pull the NetRestrict and NetInfo support functions out of libutil, and into libauth. This starts to concentrate all of our configuration file parsing functions into the same place. It also gets rid of a circular dependency. NetRestrict parsing relies on functions from rx, so with this in libutil, we had the dependency chain util->rx->util Change-Id: I250d4d8264da8db61f603a06d1b7fdab44384cd3 Reviewed-on: http://gerrit.openafs.org/8027 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
strcompose: NULL must always be cast when passed to a variadic function The C standard allows NULL to be defined as a bare "0", which will be passed to variadic functions as an int. If the function expects a pointer type, demons fly out of your nose. strcompose() is such a function, so make sure that all of its callers cast NULL appropriately. (None of them did.) This may be an opportune time to change all of the callers to spell it opr_strcompose() as well, and avoid using a reserved identifier, but this change does not do so. Change-Id: Ia9007a48102da4d0a85a48b41a44e83102304b49 Reviewed-on: http://gerrit.openafs.org/7805 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
Call rx_SetNoJumbo earlier For ubik server processes, rx_SetNoJumbo needs to be called before ubik initialization for it to effect the communication between dbservers; otherwise, full database transfers may result in Rx jumbograms on the wire regardless of the jumbo/nojumbo setting. Move the call to rx_SetNoJumbo to before ubik initialization to avoid this. Also move the call to rx_SetNoJumbo to immediately after rx_Init* for all server processes, for consistency. Move similar calls to rx_SetMaxMTU for the same reason. Change-Id: Ic79415829601fcfb4e74e72fbf5711d0c32aaa0c Reviewed-on: http://gerrit.openafs.org/7350 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
audit: remove static local realms Remove the static list of local realms and use the auth interace to do the local realm check. A callback function is registered by the servers to avoid a circular dependency between audit and auth. Change-Id: Ic0f25cd79da7987704de68bade14054490b26c80 Reviewed-on: http://gerrit.openafs.org/6879 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
Remove redundant header includes Remove includes of system headers where roken.h already takes care of including them. This simplifies the source tree, reduces the amount of work done by the compiler, and ensures that all of our headers are included with the correct guards The list of files to edit was generated with the following script: list=`grep include external/heimdal/roken/roken.h.in \ | sed -e's/#include//g' | sort | uniq`; \ for A in `find . -name *.c | xargs grep -l roken.h \ | grep -v external/ | grep -v WINNT/`; do \ found=0; \ for B in $list; do \ if grep "$B" $A > /dev/null; then \ echo "$A : $B"; \ found=1; \ fi; \ done; \ if [ $found == 1 ] ; then mvim -f $A; fi; \ done Change-Id: I2edbda550a129709b1dc6860b17d6a8a7509af58 Reviewed-on: http://gerrit.openafs.org/5815 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com> Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementix.org>
Move string manipulation functions out of util Some functions in libafsutil depend upon the RX libraries, which means that pulling in other functions in this library can create a dependency upon RX. This is less than ideal for low-level libraries such as cmd and comerr. So, create a new low-level library (currently named 'opr') which can contain low-level functions from util, and elsewhere. This library should have no dependencies other than on system libraries and libroken. Change-Id: I703db3da4d8faf79ee82bf572af09d07152d9b25 Reviewed-on: http://gerrit.openafs.org/5363 Reviewed-by: Derrick Brashear <shadow@dementix.org> Tested-by: Derrick Brashear <shadow@dementix.org>
kauth: Tidy header includes Since we adopted libroken, we get a lot of header includes automatically from roken.h. Use these, instead of including lots of things multiple times. This adds arpa/inet.h to the list of headers that configure checks for Change-Id: I1792ede4be761238bb05567c1d763ed63f50051e Reviewed-on: http://gerrit.openafs.org/4330 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
ubik: Allow servers to have more than 3 seclayers ubik has traditionally used the afsconf_ServerAuth function to fill in a single field in a pre-allocated list of security classes. This meant that we could never have a class with an index higher than 2 (rxkad). Setting the function to call, and the rock to that function was also accomplished by playing with global variables. Rework this so that a new function is used to set the security classes, which can allocate an arbitrary sized array of classes. Move the setting of this function, and of the authentication check function into ubik_SetServerSecurityProcs() Change-Id: I7cde73b05db4d51403469e2bead1d99d5ae88043 Reviewed-on: http://gerrit.openafs.org/4202 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
ubik: Remove dependency on auth When commit 8a09c220f4c5f881ea45be585b07b793038924d5 added support for token error recovery to ubik, it introduced a dependency on afsconf. This breaks the abstraction layer that had been in place, by requiring that the SecurityRock be an afsconf_dir (if you use a different rock, ubik will segfault) This change reinstates the abstraction layer, by requiring Ubik users who want token error checking to specify a procedure that can be used to check whether tokens are up to date. Instead of yet another global variable, we replace the existing CRXSecurity* variables with a single function that can be used to set security proc, token checking proc, and rock. Change-Id: I9036cf712f02610ed2e906602d3416436f69e98b Reviewed-on: http://gerrit.openafs.org/4200 Reviewed-by: Jeffrey Altman <jaltman@openafs.org> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
libroken: Build on windows A minimal change set to get libroken to build on Windows. Sadly, libroken contains definitions for a number of platform compatibility macros which were previously scattered throughout the windows code. These scattered macros have to be removed in order to build libroken. The impact of this removal is that a very large number of files throughout the tree require the addition of "roken.h" to pick up the new compatibility code. The bulk of this change is adding these includes. In addition, some of the added includes add roken dependencies to the Unix build. So, also add libroken to the build rules in affected Unix Makefiles. Change-Id: Ifba431bd37e67b1e273fbc6f69b805a232193456 Reviewed-on: http://gerrit.openafs.org/3205 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>