openafs.git
12 years agoaklog: heimdal kvno is unsigned
Derrick Brashear [Thu, 12 Apr 2012 21:35:27 +0000]
aklog: heimdal kvno is unsigned

heimdal's kvno is unsigned. comply.

Change-Id: I5960ec33dccb10ae2bbc121e231b6aa58fa17993
Reviewed-on: http://gerrit.openafs.org/7201
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoRemove redundant header includes
Simon Wilkinson [Thu, 8 Sep 2011 10:26:39 +0000]
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>

12 years agovolscan: index offset output column
Michael Meffie [Tue, 27 Mar 2012 04:33:26 +0000]
volscan: index offset output column

Add index offset as a possible volscan output column.

Change-Id: I1bf6e8dc3c506a2ee013536e19141ddb214879a6
Reviewed-on: http://gerrit.openafs.org/6980
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agovolscan: option to ignore dir vnode magic
Michael Meffie [Tue, 27 Mar 2012 00:20:28 +0000]
volscan: option to ignore dir vnode magic

Option to ignore directory vnode magic when looking
up the path names. Print which vnode failed when
doing the checks.

Change-Id: Id4b74ee9f139305025b849a007a4534b8ed04dbf
Reviewed-on: http://gerrit.openafs.org/6979
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agoWindows: missing brace in RDR_CleanupFileEntry
Jeffrey Altman [Wed, 11 Apr 2012 15:59:17 +0000]
Windows: missing brace in RDR_CleanupFileEntry

Fix 46d76d8821f4c8476499757d509ce1a6bab764b1

Change-Id: I6c6cf5e1dec431544963f6a4c283e2ae0d52a7d9
Reviewed-on: http://gerrit.openafs.org/7189
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agosalvager: Trust inode-based special data over OGM
Andrew Deason [Thu, 22 Mar 2012 22:54:12 +0000]
salvager: Trust inode-based special data over OGM

Currently the salvaging code looks for special inodes, and infers the
volume id and inode type from the OGM data in each special inode file.
However, we can already derive this information from the inode number
itself for the special inode, so if they disagree, use the values
based off of the inode number and correct the OGM data.

The inode number should be more likely to be correct, since that is
how we look up the special inode from the header when attaching the
volume. It is also impossible to get special inode files with the same
name, so this ensures we don't get duplicates. And for people that go
snooping around /vicepX/AFSIDat even though we tell them not to, it
seems more likely that they go around 'chmod'ing or 'chown'ing rather
than 'mv'ing.

This change avoids an abort in the salvaging code when the OGM data is
wrong. If we trust the OGM data when it is incorrect, we assume the
special inode file is for a different volume. So when we go to
recreate one of the special files for the volume we're actually
working with, the IH_CREATE fails (from EEXIST) and so we abort.

Change-Id: Ibfaa1bfb27d190c5fec6fc673d88df366268e302
Reviewed-on: http://gerrit.openafs.org/6946
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agonamei: Abstract out OGM functions a bit more
Andrew Deason [Fri, 23 Mar 2012 18:02:22 +0000]
namei: Abstract out OGM functions a bit more

Add GetWinOGM and SetWinOGM for getting and setting the
Windows-equivalent of the Unix OGM data. Make those and CheckOGM use
GetFileTime/SetFileTime so we can operate just via an FD_t, without
needing the full pathname. Modify the NT namei_icreate to use
SetWinOGM.

Change-Id: I5077911d8473d44ad9ba1d17d3b6deec3a12ba39
Reviewed-on: http://gerrit.openafs.org/6945
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agolibafs: dont handle outstatus on write error
Derrick Brashear [Wed, 15 Feb 2012 02:58:09 +0000]
libafs: dont handle outstatus on write error

if a write errored, we can't trust the OutStatus we got. don't.

Change-Id: I74934c32426c6f25aace06f6ee59c1c1b547af90
Reviewed-on: http://gerrit.openafs.org/6714
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoBuild: link libaudit before util
Michael Meffie [Wed, 29 Feb 2012 14:40:14 +0000]
Build: link libaudit before util

libaudit depends on util symbols, so link it first to avoid
unresolved symbols.  Include libaudit in the list of libs
instead of making it a special case.

Change-Id: Ide6d5f7e3ce8fd76b504088dcae3110872a87092
Reviewed-on: http://gerrit.openafs.org/6847
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoviced: fix log message for MapName_r
Michael Meffie [Sat, 3 Mar 2012 15:05:01 +0000]
viced: fix log message for MapName_r

Do not log a code of zero if the name plus instance length exceeds
the max pr name buffer.

Change-Id: I8b8f970213c0beb35a728bcc2158796f84120a3b
Reviewed-on: http://gerrit.openafs.org/6861
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agodoc: distributed files are under dest
Michael Meffie [Tue, 10 Apr 2012 20:07:37 +0000]
doc: distributed files are under dest

Add the dest path component in the quick start guide instructions for
copying files from a binary OpenAFS distribution file.

Change-Id: I5c39ac0426ef2eab89ae5d3df260628e949dc21e
Reviewed-on: http://gerrit.openafs.org/7187
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoafsd: Move to newer cmd syntax
Simon Wilkinson [Tue, 13 Sep 2011 06:17:27 +0000]
afsd: Move to newer cmd syntax

Move afsd over to using the newer cmd functions, and avoid using
direct array access, and fixed offsets.

Change-Id: I6e09823d764cbe6109c9a72700239d814b91db0c
Reviewed-on: http://gerrit.openafs.org/7137
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: Do not delete in CleanupFile if error
Jeffrey Altman [Wed, 11 Apr 2012 04:29:03 +0000]
Windows: Do not delete in CleanupFile if error

If an error was detected when processing RDR_CleanupFileEntry()
do not perform the file deletion.  Just return the error as
attempting the deletion could result in an exception.

Change-Id: I57b17a15d1bdda4d0890dbe59f9e2432d465250f
Reviewed-on: http://gerrit.openafs.org/7186
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agolibafs: log error code when marking server down
Michael Meffie [Mon, 9 Apr 2012 19:49:50 +0000]
libafs: log error code when marking server down

Log the error code when marking the server down due
to server/networks issues.

Change-Id: Ib3d57562642ca564dcfeaa775de66f54d08f23af
Reviewed-on: http://gerrit.openafs.org/7138
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoRework the ugen_* interface
Simon Wilkinson [Sun, 23 Oct 2011 15:21:52 +0000]
Rework the ugen_* interface

Remodel the ugen_* ubik initialisation interface so that more complex
sets of security flags can be passed through it. A number of new
functions are provided, all of which take the AFSCONF_* security flags
defined in libauth:

*) ugen_ClientInitCell is used to initialise a ubik client structure
   when the caller already has afsconf_dir and afsconf_cell
   structures for the cell being contacted
*) ugen_ClientInitServer is used to initialise a client which will
   contact a specific server within a given cell, rather than
   selecting one from the pool
*) ugen_ClientInitFlags is used to initialise a client given a
   cellname, and a path to a configuration directory. It is is
   closest to the legacy ugen_ClientInit function.

All of the in tree callers are updated to use this new interface

Change-Id: I6a438aa70d94114c8b6626fa1396b7580ab07c07
Reviewed-on: http://gerrit.openafs.org/7131
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoviced: Make Update_TargetVnodeStatus usable by replication code
Marc Dionne [Sun, 22 Jan 2012 15:03:43 +0000]
viced: Make Update_TargetVnodeStatus usable by replication code

Add a remote flag, skip rights related code for the remote case.

This will need to be revisited later; in the case that what ends
up on disk is slightly different than the InStatus passed in, the
changes should be preserved to pass to the replicas.

Change-Id: I596698ba00174efbdc6a170a24f86ea88554f9af
Reviewed-on: http://gerrit.openafs.org/6675
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoviced: Make GetVolumePackageWithCall usable by replication code
Marc Dionne [Sun, 22 Jan 2012 14:34:28 +0000]
viced: Make GetVolumePackageWithCall usable by replication code

Add a remote flag to GetVolumePackageWithCall to make it usable for
remote replication RPCs.  For the remote case the checks related
to access rights are skipped.

Change-Id: I81db0bb1ae90c5f98cf4e59d9ba28466b312c763
Reviewed-on: http://gerrit.openafs.org/6673
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agovol: Allow VAllocVnode of specific vnodes
Marc Dionne [Sat, 21 Jan 2012 19:42:01 +0000]
vol: Allow VAllocVnode of specific vnodes

Add parameters to VAllocVnode to allow the caller to specifiy the
vnode and unique numbers to use.  This will be used by the RW
replication code to keep vnode numbers in sync between the master
volume and the replicas.

Adapted from code by Vishal Powar and Derrick Brashear.

Change-Id: Ibaf79aad2b3e7a52802f5e01f7e4c7730c3f5090
Reviewed-on: http://gerrit.openafs.org/6672
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agoWindows: AFSValidateProcessEntry, ullProcessId 64-bit
Jeffrey Altman [Tue, 10 Apr 2012 14:17:51 +0000]
Windows: AFSValidateProcessEntry, ullProcessId 64-bit

In AFSValidateProcessEntry(), ullProcessId is 64-bit and must be
printed as an %I64X in AFSDbgLogMsg() formats.

Change-Id: I0e1cd45383c4512eb271c294674bbfe3f0f39bef
Reviewed-on: http://gerrit.openafs.org/7172
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoroken: Add rk_getprogname to Windows mapfile
Simon Wilkinson [Mon, 9 Apr 2012 22:13:28 +0000]
roken: Add rk_getprogname to Windows mapfile

Add the rk_getprogname symbol to the Windows mapfile so it can be
used by roken consumers.

Change-Id: I77c7db3fcd9136d36e2b17b6250bfcfa6327b0e5
Reviewed-on: http://gerrit.openafs.org/7139
Tested-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agorxkad: Remove DES include from header file
Simon Wilkinson [Thu, 5 Apr 2012 20:00:32 +0000]
rxkad: Remove DES include from header file

Remove the hcrypto/des.h include directory from the rxkad_prototypes
header file. We ship rxkad_prototypes.h, but we don't ship the hcrypto
headers. Having an installed header depend upon an uninstalled one is
a pain when building out-of-tree code like perl-AFS.

Change-Id: Idac93ba834c84f6f9e2e49361f88d0e357a328d6
Reviewed-on: http://gerrit.openafs.org/7068
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agorxkad: Move conversion functions to own file
Simon Wilkinson [Thu, 5 Apr 2012 19:58:11 +0000]
rxkad: Move conversion functions to own file

Move the various key conversion functions into thir own header file,
rather than rxkad_prototypes.h. This means we can isolate the dependency
on the hcrypto DES headers (which we don't install)

Change-Id: I8efcbf97b6794d9573f35eec9d4a32e9ff4cf352
Reviewed-on: http://gerrit.openafs.org/7067
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoshlibafsauthent: Add a load more objects
Simon Wilkinson [Fri, 6 Apr 2012 22:56:30 +0000]
shlibafsauthent: Add a load more objects

The perl-AFS module needs to link against a pthreaded, PIC, library
that contains all of the routines that it provides perl shims for.
At the moment, libafsrpc_pic and libafsauthent_pic are the only such
libraries that OpenAFS provides.

Add all of the necessary objects to libafsauthent_pic such that the
2.6.2 version of perl-AFS can build with a minimal set of patches.
Minimise the damage by only making these available through the static
version of the libafsauthent_pic library.

Change-Id: I5a2aa5f5fbcfbe15aa7a23c3ab57b34b979ab2f3
Reviewed-on: http://gerrit.openafs.org/7070
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoopr: Install the queue.h header
Simon Wilkinson [Fri, 6 Apr 2012 22:54:10 +0000]
opr: Install the queue.h header

The opr queue definition is required by a structure in the installed
cellconfig.h header. So that header can still be used by out-of-tree
applications, install the queue.h header too.

Change-Id: Ifaf49d59df24275ff50c215de6a0f40fc2bd2230
Reviewed-on: http://gerrit.openafs.org/7069
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: report error on panic
Jeffrey Altman [Tue, 10 Apr 2012 05:05:14 +0000]
Windows: report error on panic

If afsd_notifier() is called the service is going to exit(1).
Report to the service manager that the service exited with an
error as well.

Change-Id: I88bb2f315016ab17a526d1eab162ccde8beb0dd0
Reviewed-on: http://gerrit.openafs.org/7148
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoWindows: correct afsredir log entries
Jeffrey Altman [Tue, 10 Apr 2012 03:24:07 +0000]
Windows: correct afsredir log entries

AFSVerifyEntry != AFSValidateEntry

Change-Id: I5b138e121f66724afddde9eadce4c11009ec6ec4
Reviewed-on: http://gerrit.openafs.org/7147
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoWindows: Refactor AFSValidateEntry
Jeffrey Altman [Mon, 9 Apr 2012 22:41:13 +0000]
Windows: Refactor AFSValidateEntry

Refactor AFSValidateEntry to avoid obtaining the
ObjectInformation->Fcb->Resource when it isn't necessary.
This will avoid contention and improve performance.

The only time that the Fcb->Resource is required is when
the object requires verification, the object is a FILE,
and the object was successfully evaluated.

Even with this reorganization there is a small window
of opportunity for a deadlock to occur if a CcPurgeCacheSection()
which is called with the Fcb->Resource held triggers a filter
driver to issue a CreateFile and in between the two operations
an invalidate object is received.

Change-Id: Iddf64f030c6a608ac29a10b7a9a7e130ae6c4249
Reviewed-on: http://gerrit.openafs.org/7143
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoGeneralise the new background daemon code
Simon Wilkinson [Fri, 9 Sep 2011 06:46:01 +0000]
Generalise the new background daemon code

Move the new background daemon code out from under the AFS_DARWIN80_ENV
ifdef into its own AFS_NEW_BKG define. This lets us use it for things
other than the Darwin mv helper, on other platforms.

Based on code originally written by Derrick Brashear

Change-Id: Iba9431f5dc4bbbe10222b25a595cdd1ea2f592f4
Reviewed-on: http://gerrit.openafs.org/7136
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agovos: Do not try to remove backup volume id 0
Andrew Deason [Mon, 9 Apr 2012 22:16:42 +0000]
vos: Do not try to remove backup volume id 0

Currently we always try to delete a BK volume if we're deleting the
RW. If the BK volume id is 0, this is never going to do anything, so
don't try to delete it.

Change-Id: I0c003040cface9999944d61637077fce1736445e
Reviewed-on: http://gerrit.openafs.org/7140
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agoImport the expand_path.c file from Heimdal
Simon Wilkinson [Mon, 9 Apr 2012 23:35:43 +0000]
Import the expand_path.c file from Heimdal

Import expand_path.c from Heimdal so that it can be used for path
parsing with the Windows version of the INI file parser.

Change-Id: I764ea10edb8bb63bd45216c912c0f67597c4467a
Reviewed-on: http://gerrit.openafs.org/7144
Tested-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoImport of code from heimdal
Heimdal Developers [Mon, 9 Apr 2012 23:37:07 +0000]
Import of code from heimdal

This commit updates the code imported from heimdal to
ee7340860a22f81fb869cc431efc1fd4e5c77d34 (switch-from-svn-to-git-2542-gee73408)

New files are:
krb5/expand_path.c

Change-Id: Ib4093b72257f9a0d1a49edb0fe6779908a78cd83
Reviewed-on: http://gerrit.openafs.org/7145
Tested-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agorx: Remove packet burst elements from peer struct
Simon Wilkinson [Sun, 1 Apr 2012 16:27:04 +0000]
rx: Remove packet burst elements from peer struct

The peer structure contains a number of elements left over from an
earlier, burst based, congestion control strategy. As OpenAFS has
never implemented this strategy, just remove these elements from
the structure, and store 0 values for these elements in the debug
packets.

Change-Id: Ib50a8ac587890efb483d3c2640ead615d170db34
Reviewed-on: http://gerrit.openafs.org/7006
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agorx: Remove the unused packet skew code
Simon Wilkinson [Fri, 25 Nov 2011 20:51:40 +0000]
rx: Remove the unused packet skew code

We don't (and haven't, since the release of OpenAFS) use the packet
skew calculations for anything. However, maintaining them requires
taking locks in some critical parts of the transmission code path.
For both speed, and maintainability, reasons remove the skew code
from the tree - it's in git if we ever want to go back to it.

Change-Id: Idc6dc80fb06ca959ad02a85f2c536a94ca3d5c02
Reviewed-on: http://gerrit.openafs.org/7004
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agorx: Hide internal packet functions
Simon Wilkinson [Tue, 6 Dec 2011 14:06:05 +0000]
rx: Hide internal packet functions

Hide functions in rx_packet.c which are only used by that file by
making them static.

Change-Id: I22d4be2130cc4a46183254d3ba36c61644891852
Reviewed-on: http://gerrit.openafs.org/7003
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agorx: Hide struct rx_peer from the rest of the tree
Simon Wilkinson [Mon, 5 Dec 2011 18:56:03 +0000]
rx: Hide struct rx_peer from the rest of the tree

The peer structure is an internal RX structure, so it shouldn't
be contained in public header files, or used by non-rx modules.

Hide the structure definition in rx_peer.h, and convert the
rx_HostOf and rx_PortOf accessors from macros into functions. This
will also help with adding support for non-IPv4 addresses to RX.

Change-Id: I790fa3193bfa629a2872fc5395d0146e76a2de9e
Reviewed-on: http://gerrit.openafs.org/7002
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agotests: remove unused variable in tests/util/ktime-t.c
Marc Dionne [Mon, 9 Apr 2012 23:00:36 +0000]
tests: remove unused variable in tests/util/ktime-t.c

errors is set but not used - remove it.

Change-Id: I00c99ac8b9c61ab2667aecbdf0fd04401d018bf8
Reviewed-on: http://gerrit.openafs.org/7142
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoMove configuration parsing into libcmd
Simon Wilkinson [Sun, 25 Sep 2011 20:30:02 +0000]
Move configuration parsing into libcmd

Rework the API for directly parsing configuration files and move it
out of util/ and into libcmd, where we can actually make use of it.

This is a raw API - it provides direct access to the parser. The
eventual intent is that this will predominantly be contained within
libcmd itself, which will then wrap this with the more general purpose
Option functions

Change-Id: I9f4a9c373c4123023120f69e595068ead6160507
Reviewed-on: http://gerrit.openafs.org/7132
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agorxperf: Build again
Simon Wilkinson [Sun, 1 Apr 2012 19:40:24 +0000]
rxperf: Build again

Fix rxperf so that it builds again

Change-Id: I9747bc1b3fedb96d5bc317acde69f35b1dc6efb8
Reviewed-on: http://gerrit.openafs.org/7011
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoroken: Prefix getopt and getprogname
Simon Wilkinson [Sun, 1 Apr 2012 19:15:35 +0000]
roken: Prefix getopt and getprogname

The roken symbols for getopt and getprogname are now prefixed with
'rk_'. Fix the map file so it lists the correct symbols.

Change-Id: I61adba7d5bec3e86b8e29d1eefda23df4ef91988
Reviewed-on: http://gerrit.openafs.org/7010
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoall needs to be first rule in the Makefile
Simon Wilkinson [Sun, 1 Apr 2012 19:09:57 +0000]
all needs to be first rule in the Makefile

Just running 'make' in a subdirectory will fire the first rule in that
directory's Makefile. When the buildtools rules were added to roken and
crypto, they were put at the start of the file, meaning that they fire
in perference to 'all'

Swap the ordering back so that 'make' does what would be expected

Change-Id: I598a183f42c150a5da724b7403e91f89f74a0109
Reviewed-on: http://gerrit.openafs.org/7009
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agobos: Change to using char casts for ka functions
Simon Wilkinson [Thu, 5 Apr 2012 19:50:35 +0000]
bos: Change to using char casts for ka functions

The ka_IsZero and ka_PrintBytes function just use char strings. Cast
directly, rather than going via a helper functions to simplify this
code.

The helper functions add complexity, and additional dependencies which
cause problems with some uses of this code.

Change-Id: I831ff0f8fbecec602d8c2b9112675938facfb06b
Reviewed-on: http://gerrit.openafs.org/7066
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoshlibafsrpc: Add additional XDR functions
Simon Wilkinson [Thu, 5 Apr 2012 19:43:23 +0000]
shlibafsrpc: Add additional XDR functions

Export the afs_xdr_pointer and afs_xdr_u_char functions so that
shlibafsauthent can make use of them.

Change-Id: I16cf3f69904bffb3a034fd4052117845c1067a2c
Reviewed-on: http://gerrit.openafs.org/7065
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agorx: remove peer burst elements from rx/test
Jeffrey Altman [Mon, 9 Apr 2012 11:18:32 +0000]
rx: remove peer burst elements from rx/test

Subsequent patchsets will turn rx_peer into an opaque object
and remove the burst elements entirely from the tree.  For
now remove them from rx/test

Change-Id: I728f7b74497701c0ef965009dff5550e1b153696
Reviewed-on: http://gerrit.openafs.org/7130
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agorx: rxi_AckAll isn't an event handler
Simon Wilkinson [Wed, 7 Dec 2011 18:30:00 +0000]
rx: rxi_AckAll isn't an event handler

rxi_AckAll is coded as if it is an event handler, yet the only
call site is a direct call from rx.c. So, rework the function to
remove all of the event handling code, change its arguments to match,
and make it static.

Change-Id: I947c02bf91bf5a3f42d2a389f9393e68f3ccee4b
Reviewed-on: http://gerrit.openafs.org/6999
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agorx: Tidy up function scope in rx.c
Simon Wilkinson [Wed, 7 Dec 2011 19:14:03 +0000]
rx: Tidy up function scope in rx.c

Rework headers to more clearly indicate which functions in rx.c
are considered part of the 'public' rx interface, and which are for
internal use only.

Move internal functions either to be static in rx.c
(if they are used only within that file), or defined in
rx_internal.h.

Remove entirely the unused function rxi_NatKeepAliveOn()

Change-Id: I878374dc137f4c7e204de4b2d9ca17fa1c5db628
Reviewed-on: http://gerrit.openafs.org/6998
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agorx: Remove trailing else from RX_KERNEL_TRACE
Simon Wilkinson [Mon, 14 Nov 2011 10:28:38 +0000]
rx: Remove trailing else from RX_KERNEL_TRACE

The RX_KERNEL_TRACE ifdefs all contain a trailing else, which makes
no logicial sense given the rest of the code. The only effect of this
trailing else is to cause packets to not be sent when tracing is
enabled, which probably isn't the desired behaviour.

Change-Id: I2175b1d8270cd096361f349a467245b49efabf6b
Reviewed-on: http://gerrit.openafs.org/7001
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agokas: Don't require config for help
Simon Wilkinson [Sun, 8 Apr 2012 22:31:31 +0000]
kas: Don't require config for help

Modify the call to ka_Init in kas, so that a fully configured client
isn't required in order to generate help output. In particular, permit
kas -help, kas -version and kas apropos to run without initialising the
ka library.

This fixes a problem with running 'make check' on systems that don't
have an AFS client installed (or where the AFS client is installed in
a different location)

Change-Id: I5edd10a319ed6aee163723f99c4f37183f572b2f
Reviewed-on: http://gerrit.openafs.org/7129
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agotools: return error code in xfclose
Marc Dionne [Sat, 7 Apr 2012 14:11:14 +0000]
tools: return error code in xfclose

The code variable takes the return code from do_close, but
is then unused.  Return its value instead of systematically
returning 0, avoiding an unused variable warning.

Change-Id: I831b5b81721400ee08106d2ecdbf2b7b8e126348
Reviewed-on: http://gerrit.openafs.org/7123
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>

12 years agorx: Remove unused ACKHACK macro
Simon Wilkinson [Sat, 25 Jun 2011 17:29:27 +0000]
rx: Remove unused ACKHACK macro

rx_globals.h had a macro called ACKHACK which at one point looks like
it was used to determine whether to send an ACK or not. We now have a
more sophisticate mechanism for determining this, and the old macro
doesn't seem to have been used in a long time. So, remove it to avoid
confusion.

Change-Id: I9b17cdca69c903c7a952489791088f2899ac7e60
Reviewed-on: http://gerrit.openafs.org/7000
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agotests: waitpid requires sys/wait.h
Simon Wilkinson [Sun, 8 Apr 2012 22:31:25 +0000]
tests: waitpid requires sys/wait.h

Calling waitpid requires the sys/wait.h header to be included to
guarantee that the prototype is enabled.

Change-Id: I2d845236347d1be46cd750c2e766b305a64cde53
Reviewed-on: http://gerrit.openafs.org/7128
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agotests: rx needs roken
Simon Wilkinson [Sun, 8 Apr 2012 22:31:15 +0000]
tests: rx needs roken

On Linux, the RX library has a dependency on libroken for the rk_socket
function. Add this dependency to the RX tests.

Change-Id: I306e846524232bc136cd969ab1b8664d1c570e2d
Reviewed-on: http://gerrit.openafs.org/7127
Tested-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agocmd: Don't leak memory when constructing help string
Simon Wilkinson [Sat, 31 Mar 2012 19:27:53 +0000]
cmd: Don't leak memory when constructing help string

It's not critical, because we'll be exiting soon afterwards, but just
to be nice, don't leak the name of every command option whilst we're
constructing the help string.

Caught by clang-analyzer

Change-Id: I87fdb2030c6a7c5ad810f2a06820c08cbe2fb18e
Reviewed-on: http://gerrit.openafs.org/7107
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoktime: Don't leak token list
Simon Wilkinson [Sat, 31 Mar 2012 19:23:22 +0000]
ktime: Don't leak token list

ktime_ParsePeriodic generates a malloc'd token list when it parses
the time string passed to it. Make sure that we free this list before
exiting from the function.

Change-Id: I6edacc6504aeec06ede5b5ae36c22f69b0d6cea0
Reviewed-on: http://gerrit.openafs.org/7106
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agobudb: Don't leak memory
Simon Wilkinson [Sat, 31 Mar 2012 19:16:16 +0000]
budb: Don't leak memory

Don't leak the malloc'd path variable everytime we call truncateDatabase

Caught by clang-analyzer

Change-Id: I583d81b136113820dab00a6eb35ca8e1aeec2cd1
Reviewed-on: http://gerrit.openafs.org/7105
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agovol-dump: Don't leak memory
Simon Wilkinson [Sat, 31 Mar 2012 19:13:49 +0000]
vol-dump: Don't leak memory

Don't leak a Volume structure everytime we call HandleVolume

Caught by clang-analyzer

Change-Id: Id8cf79dd2178b8647d88f0765ec4ad9d327a23ae
Reviewed-on: http://gerrit.openafs.org/7104
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agovol-dump: Make static things static
Simon Wilkinson [Sat, 31 Mar 2012 19:11:10 +0000]
vol-dump: Make static things static

vol-dump is a self contained object. Make everything in it static to
make clear that these functions are not being used by other objects in
the tree.

Change-Id: I0345c884167ed322fdf7a6e83b77b0ae261b9d8f
Reviewed-on: http://gerrit.openafs.org/7103
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoauth: Don't leak key on file parse error
Simon Wilkinson [Sat, 31 Mar 2012 18:59:47 +0000]
auth: Don't leak key on file parse error

If we fail for any reason whilst parsing the keyfile from disk, don't
leak the key structure which we allocated to store the results of the
parse.

Change-Id: I21a27723f96af9428465134cfb975c83e10da535
Reviewed-on: http://gerrit.openafs.org/7102
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoopr: Flag assertion error handles as noreturn
Simon Wilkinson [Sat, 31 Mar 2012 18:52:58 +0000]
opr: Flag assertion error handles as noreturn

Flag both of our assertion error handlers as being AFS_NORETURN, so
that static analysers can truncate their decision trees, and avoid
false positives, based on assertion statements.

Change-Id: I511c9c19a714cd3eaa5a886bf9561f577244360e
Reviewed-on: http://gerrit.openafs.org/7101
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agopts: Don't malloc(0) when there's nothing to do
Simon Wilkinson [Sat, 31 Mar 2012 18:42:39 +0000]
pts: Don't malloc(0) when there's nothing to do

If GetNameOrId is called with no work to do, then don't attempt to
malloc a load of 0 length strings. Instead just return an empty array
to the caller.

Change-Id: I245cfde71d65b8a3b6df4217b90dad81e9e60a58
Reviewed-on: http://gerrit.openafs.org/7100
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agobucoord: Don't malloc(0) if there's no work to do
Simon Wilkinson [Sat, 31 Mar 2012 18:37:04 +0000]
bucoord: Don't malloc(0) if there's no work to do

If there's no work to do, then don't attempt to malloc 0 bytes, and
just return success to the user

Change-Id: I060852a247acb8309c75f3670577561b5a9af591
Reviewed-on: http://gerrit.openafs.org/7099
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoauth: Handle empty lists of keys
Simon Wilkinson [Sat, 31 Mar 2012 18:33:33 +0000]
auth: Handle empty lists of keys

Handle the case where a list of keys may be empty - don't attempt
to calloc a 0 length array, and have Put handle the case where the
array being freed has no elements.

Caught by clang-analyzer

Change-Id: I665035cb00a8da411710a71a17ae66545702127f
Reviewed-on: http://gerrit.openafs.org/7098
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoUnix CM: We're disconnected if RW disconnected too
Simon Wilkinson [Sat, 31 Mar 2012 18:23:18 +0000]
Unix CM: We're disconnected if RW disconnected too

At the moment, the Unix CM doesn't support entering a purely RO
disconnected mode (the historical AFS_IS_DISCONNECTED mode). If we
go disconnected, or reconnect we always toggle RW discon at the same
time as we toggle RO. Arguably, the RO disconnected mode should just
be removed, as it is now superceded.

For the moment, make it clear to the compiler that RW disconnected
implies RO disconnected, so that static analysis can make more sensible
decisions about code paths.

Change-Id: I7e2d04d2cf67740c6b6285950874c6a4eaeb0537
Reviewed-on: http://gerrit.openafs.org/7097
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoauth: Make sure we get AF_INET addresses from DNS
Simon Wilkinson [Sat, 31 Mar 2012 16:20:25 +0000]
auth: Make sure we get AF_INET addresses from DNS

The routines which do AFSDB and SRV lookups copy the results of
gethostbyname directly into an afs_int32, and use the size of the
result to limit the copy. If, for any reason, they get a result that
isn't an int, then they will overflow this value.

Check that the result we get from gethostbyname is in the INET
address family, and also limit the size of the copy by the size of the
destination, rather than that of the source.

Caught by clang-analyzer

Change-Id: Icf1426e090bc1ed382212d5de6c291d0816fb2c9
Reviewed-on: http://gerrit.openafs.org/7096
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agovos: Initialise total counters
Simon Wilkinson [Sat, 31 Mar 2012 15:59:16 +0000]
vos: Initialise total counters

When VolumeStats_int calls DisplayFormat, it isn't interested in
the total counters it provides. So, it doesn't both initialising the
variables it passes in to hold these counters - garbage in, garbage out.

However, this shows up as an uninitialises variable warning, so set them
all to 0 to keep clang happy.

Caught by clang-analyzer

Change-Id: Ia3e1eadde6eac6fa924a4ff9ad566c5c50f9ff40
Reviewed-on: http://gerrit.openafs.org/7095
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agovol: Don't return an uninited val from LookupNode
Simon Wilkinson [Sat, 31 Mar 2012 15:51:19 +0000]
vol: Don't return an uninited val from LookupNode

If the SalvageHashTable for a particular node is empty, then LookupNode
can return an uninitialised value to the caller. It isn't clear from a
broader code inspection whether LookupNode can ever be called with an
empty SalvageHashTable, but returning a NULL vsp does seem like the
correct thing to do in this situation.

Caught by clang-analyzer

Change-Id: Ibee79e6acf7d3bdbc2995ef924338ade4de77d08
Reviewed-on: http://gerrit.openafs.org/7094
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agofs: Fix bad frees
Simon Wilkinson [Sat, 31 Mar 2012 11:01:46 +0000]
fs: Fix bad frees

On an error GetLastComponent was freeing completely the wrong thing.
Fix this so it frees the memory it has allocated, and not some random
stack pointer.

Caught by clang-analyzer

Change-Id: I8b65f7ab36647b876fae5cbe59d82fd8d38ce0b7
Reviewed-on: http://gerrit.openafs.org/7093
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agocmd: Use strl* rather than strn* to avoid overrun
Simon Wilkinson [Sat, 31 Mar 2012 10:58:01 +0000]
cmd: Use strl* rather than strn* to avoid overrun

The NName function was using strncat(a, b, sizeof(a)), which doesn't
work as you would expect if 'a' already contains data. To avoid the
potential buffer overflow, switch to just using strlcat.

Caught by clang-analyzer

Change-Id: Idd2c630c07a93b27e8d629339589aa6686290eae
Reviewed-on: http://gerrit.openafs.org/7092
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoautoconf: One CC to rule them all
Simon Wilkinson [Fri, 30 Mar 2012 19:36:56 +0000]
autoconf: One CC to rule them all

(well, in userspace at least)

We have 3 different ways of specifying the C compiler - CC, CCOBJ and
MT_CC. On most platforms these are set to identical values by the
configure script. However, this causes problems for a user who wants
to override the default complier choice by doing
    make CC=my-favorite-compiler
as this doesn't catch all of the ways we specify the compiler [1]

So, change the specification of CCOBJ and MT_CC so that, by default,
they reference CC, rather than copying its value. This means that on
platforms where CC is the appropriate compiler to use in all situations,
a user need only change CC to modify their compiler choice.

[1] - it might be argued that the correct place to substitue the
      compiler is in configure's environment, which does currently work.
      However, this doesn't work with special things, like static
      analysers, that can build the source tree, but not the configure
      tests.

Change-Id: Ib95e2ac00b36f33c3cb2491feacd6c898f8f61dc
Reviewed-on: http://gerrit.openafs.org/7091
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoafs: Handle reading past the end of a file
Simon Wilkinson [Fri, 30 Mar 2012 18:41:17 +0000]
afs: Handle reading past the end of a file

... except that this change doesn't actually handle this, it just
stops clang from throwing an error about the bogus code that's already
in there. This needs fixed properly ...

Change-Id: Ifbf190a86037fced8104ed0843dd1e7aa0b999a7
Reviewed-on: http://gerrit.openafs.org/7090
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoxdr: Len can never be negative
Simon Wilkinson [Fri, 30 Mar 2012 18:40:30 +0000]
xdr: Len can never be negative

The len parameter to xdr_len is unsigned, so can never be negative.
Don't bother testing to see if it is negative, so that clang likes us
again.

Change-Id: Iad5f8b1b2d20ec55846bc1ef7b7499a30956e17f
Reviewed-on: http://gerrit.openafs.org/7089
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agorx: Remove needless braces
Simon Wilkinson [Fri, 30 Mar 2012 18:39:51 +0000]
rx: Remove needless braces

Doing if ((a==b)) is unecessary. It's also potentially dangerous, as
that's the syntax required to do assignment within an if statement.
clang now issues warnings (errors in -Werror mode) when it encounters
these.

Remove pointless braces from the Unix CM to make clang happy.

Change-Id: I031db80c3f85c0e4c4db365b1c36b5d4b4a7cb48
Reviewed-on: http://gerrit.openafs.org/7088
Tested-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agorx: Handle negative returns on packet reads
Simon Wilkinson [Fri, 30 Mar 2012 18:37:36 +0000]
rx: Handle negative returns on packet reads

rxi_RecvMsg returns an int, because it can return a negative value upon
error. Don't store its return value as an unsigned int, because this may
hide the potential errors.

Modify the error handling loop so that errors get to where they are
intended.

Change-Id: I212e5881f83a2a95c177c23dbc2da2583155f1aa
Reviewed-on: http://gerrit.openafs.org/7087
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agovenus: Make clang happy with strlcpy use
Simon Wilkinson [Fri, 30 Mar 2012 18:35:51 +0000]
venus: Make clang happy with strlcpy use

clang now expects that strlcpy will always be used to prevent overflow
of the destination string, and gives a warning if the size parameter is
based solely on the length of the source string.

Modify the BreakUpPath function so that it takes the size of the
destination string as an argument, and uses this to limit the amount of
data pasted into it.

Change-Id: I86f68dd2013ca8bc4c88ade78d27c4d416a9ae94
Reviewed-on: http://gerrit.openafs.org/7086
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoviced: Remove pointless braces
Simon Wilkinson [Fri, 30 Mar 2012 18:34:53 +0000]
viced: Remove pointless braces

Doing if ((a==b)) is unecessary. It's also potentially dangerous, as
that's the syntax required to do assignment within an if statement.
clang now issues warnings (errors in -Werror mode) when it encounters
these.

Remove pointless braces from viced to make clang happy.

Change-Id: Iee8c1d60cc2296fefd0e7f82127821dcefb931ec
Reviewed-on: http://gerrit.openafs.org/7085
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agovlserver: unsigned values are always >0
Simon Wilkinson [Fri, 30 Mar 2012 18:33:55 +0000]
vlserver: unsigned values are always >0

Maxvolidbump is defined as an unisgned int, and thus can never be less
than 0. Remove the pointless check, as it just makes clang sad.

Change-Id: I78a2c8f6fcaee17196e37183256e6935cdca183b
Reviewed-on: http://gerrit.openafs.org/7084
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agovol: Call memset with the correct size
Simon Wilkinson [Fri, 30 Mar 2012 18:31:10 +0000]
vol: Call memset with the correct size

Call memset with the size of the structure we're initialising to 0,
and not the size of the pointer to that structure.

Caught by clang's new warnings.

Change-Id: I8cded7bed4e289e9603778e06873f94fd3924aa8
Reviewed-on: http://gerrit.openafs.org/7083
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agorxgen: Tidy up server side freeing
Simon Wilkinson [Thu, 5 Jan 2012 10:51:06 +0000]
rxgen: Tidy up server side freeing

The way in which rxgen handles freeing of objects allocated by the RPC
stub has evolved over the years. Originally, there appears to have been
a "somefrees" parameter which was used to track whether objects required
freeing or not. However, this parameter has fallen in to disuse, as
support for typedefs and unions were added, and which parameters
require freed is now tracked within the description structures
themselves. So, get rid of somefrees, as it is now just confusing.

The generated code to free a set of RPC arguments currently looks
something like:

fail:
        z_xdrs->x_op = XDR_FREE;
        if (!xdr_string(z_xdrs, &Name, AFSNAMEMAX)) goto fail1;
        if (!xdr_string(z_xdrs, &OfflineMsg, AFSOPAQUEMAX)) goto fail1;
        if (!xdr_string(z_xdrs, &Motd, AFSOPAQUEMAX)) goto fail1;
        if (rx_enable_stats) {
            rx_RecordCallStatistics(z_call, RXAFS_STATINDEX,
                19, RXAFS_NO_OF_STAT_FUNCS, 0);
        }

        return z_result;
fail1:
        if (rx_enable_stats) {
            rx_RecordCallStatistics(z_call, RXAFS_STATINDEX,
                19, RXAFS_NO_OF_STAT_FUNCS, 0);
        }

        return RXGEN_SS_XDRFREE;

Which isn't very efficient, or easy to modify. So, change the code
generator to produce code that looks like:

fail:
        z_xdrs->x_op = XDR_FREE;
        if ((!xdr_string(z_xdrs, &Name, AFSNAMEMAX))
            || (!xdr_string(z_xdrs, &OfflineMsg, AFSOPAQUEMAX))
            || (!xdr_string(z_xdrs, &Motd, AFSOPAQUEMAX)))
                z_result = RXGEN_SS_XDRFREE;

        if (rx_enable_stats) {
            rx_RecordCallStatistics(z_call, RXAFS_STATINDEX,
                19, RXAFS_NO_OF_STAT_FUNCS, 0);
        }

        return z_result;

This does the same thing, but is easier to read and is more consistent
with the way that we structure marshalling and unmarshalling.

Change-Id: I8b56f320c05c5d4270daf409d57514cbe8d076f5
Reviewed-on: http://gerrit.openafs.org/7005
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agofileserver: Fix NeverAttach support
Simon Wilkinson [Sun, 8 Apr 2012 12:58:25 +0000]
fileserver: Fix NeverAttach support

Commit 35becabed870d4bfe49abaa499d99a3ffb0a2d31 added support for
the /vicepXX/NeverAttach. However this code only appears to work on
Linux. It fails build testing on (at least) Mac OS X, FreeBSD, and AIX.
Modify the code so that the NeverAttach call uses the same variable to
locate the path of the partition as the AlwaysAttach call does.

Change-Id: Ic87e112f362ac6d23376fb0a263d021c29c0b06e
Reviewed-on: http://gerrit.openafs.org/7125
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoDOC: Factored common text out of the vos_backup and vos_dump man pages
Jason Edgecombe [Sun, 8 Apr 2012 16:10:58 +0000]
DOC: Factored common text out of the vos_backup and vos_dump man pages

Change-Id: I84bd722834297778ab2e719996b2f8528d8706d6
Reviewed-on: http://gerrit.openafs.org/7126
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Tested-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agovol: Remove unneeded braces
Simon Wilkinson [Fri, 30 Mar 2012 18:30:18 +0000]
vol: Remove unneeded braces

Doing if ((a==b)) is unecessary. It's also potentially dangerous, as
that's the syntax required to do assignment within an if statement.
clang now issues warnings (errors in -Werror mode) when it encounters
these.

Remove pointless braces from vol to make clang happy.

Change-Id: I805c52fd76de4d028741ae4382b747917581d2f2
Reviewed-on: http://gerrit.openafs.org/7082
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agovice & vol: Cast FDH_SYNC results to void
Simon Wilkinson [Fri, 30 Mar 2012 18:27:30 +0000]
vice & vol: Cast FDH_SYNC results to void

FDH_SYNC is a macro which returns a result. This leads to clang
complaining about an unused expression when the macro is expanded.
Avoid this by just casting the macro result to (void) when we aren't
interested in it.

Change-Id: I99eaac7432211d6b0cab10c3e1af0c6d4e2092a8
Reviewed-on: http://gerrit.openafs.org/7081
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agoptserver: Remove redundant braces
Simon Wilkinson [Fri, 30 Mar 2012 18:24:23 +0000]
ptserver: Remove redundant braces

Doing if ((a==b)) is unecessary. It's also potentially dangerous, as
that's the syntax required to do assignment within an if statement.
clang now issues warnings (errors in -Werror mode) when it encounters
these.

Remove pointless braces from ptserver to make clang happy.

Change-Id: I1bf1698b1d12f8228e0456d3d2dff4439879cfba
Reviewed-on: http://gerrit.openafs.org/7080
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agopam: Don't check if unsigned is < 0
Simon Wilkinson [Fri, 30 Mar 2012 18:23:24 +0000]
pam: Don't check if unsigned is < 0

uid_t is unsigned, so checking to see if it is less than 0 is a bit
redundant.

Remove the checks to silence a warning from clang.

Change-Id: I5ae429247d328b3320063b4c035f6e5bb101620b
Reviewed-on: http://gerrit.openafs.org/7079
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agopam: Use &, not && for bitwise operations
Simon Wilkinson [Fri, 30 Mar 2012 18:21:41 +0000]
pam: Use &, not && for bitwise operations

All of the LOG_MASK() checks are performing bitwise operations, and so
should be using '&', not && (which will always be true, providing
logmask is non-zero)

Caught by clang's new error messages

Change-Id: Idce9229b7351adc6c15279c94e1cc1e7fc45596e
Reviewed-on: http://gerrit.openafs.org/7078
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agotools: Use native 64 bit integer
Simon Wilkinson [Sat, 7 Apr 2012 11:44:17 +0000]
tools: Use native 64 bit integer

Modify the tools directory to use a native 64 bit integer type, rather
than rolling its own.

Change-Id: Ib2545b43aa3bf34e8917a4ae7ae4ee3f4be6d1c0
Reviewed-on: http://gerrit.openafs.org/7118
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoubik: utst needs opr for assert in util
Derrick Brashear [Sat, 7 Apr 2012 12:12:48 +0000]
ubik: utst needs opr for assert in util

add libopr after libafsutil so assert can be satisfied

Change-Id: I77494dc529f21246ae84f6522a578b14a803b6a9
Reviewed-on: http://gerrit.openafs.org/7116
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoFileserver: Add the /vicepXX/NeverAttach flag to skip mounting a partition
Jason Edgecombe [Sat, 7 Apr 2012 00:58:13 +0000]
Fileserver: Add the /vicepXX/NeverAttach flag to skip mounting a partition

FIXES 130561

LICENSE MIT

Change-Id: Ib465a978d08238d83c4c0a03813f5ec240f9bd9b
Reviewed-on: http://gerrit.openafs.org/7108
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Jason Edgecombe <jason@rampaginggeek.com>

12 years agotools: Add roken.h to afsdump
Simon Wilkinson [Sat, 7 Apr 2012 12:26:25 +0000]
tools: Add roken.h to afsdump

On AIX, building afsdump currently produces the following warnings:

"afsdump_scan.c", line 34.10: 1506-296 (S) #include file <sys/fcntl.h> not found.
"afsdump_scan.c", line 275.32: 1506-045 (S) Undeclared identifier O_RDWR.
"afsdump_scan.c", line 275.41: 1506-045 (S) Undeclared identifier O_CREAT.
"afsdump_scan.c", line 275.51: 1506-045 (S) Undeclared identifier O_TRUNC.
"afsdump_scan.c", line 305.29: 1506-045 (S) Undeclared identifier O_RDONLY.

Rather than including more platform specific goo, just add a roken.h
include to the various files to pull in the necessary headers.

Change-Id: I46db92511c804cfc9b5d67b97cd3596480d306d6
Reviewed-on: http://gerrit.openafs.org/7117
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agotools: Rename u_int64 to solve AIX problem
Simon Wilkinson [Sat, 7 Apr 2012 11:36:54 +0000]
tools: Rename u_int64 to solve AIX problem

AIX's system headers define u_int64. Rename our local 64 bit integer
representation as dt_uint64 to avoid this collision.

Change-Id: I997e3ff89df369a5f0643921a846a759bf8fa90b
Reviewed-on: http://gerrit.openafs.org/7115
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agolibafscp: Use strdup, rather than rolling our own
Simon Wilkinson [Fri, 30 Mar 2012 18:18:47 +0000]
libafscp: Use strdup, rather than rolling our own

   A = malloc(strlen(B)+ 1);
   memset(A, 0, strlen(B) + 1);
   strlcpy(A, B, strlen(B) + 1);
can be more simply written as
   A = strdup(B);

Doing so also avoids a warning from clang that strlcpy isn't checking
for A overflowing.

Change-Id: I0e21f86eda7bdc0ce869e651c5ceb23d7494e1e2
Reviewed-on: http://gerrit.openafs.org/7077
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agolibadmin: Clear structures according to their size.
Simon Wilkinson [Fri, 30 Mar 2012 18:16:50 +0000]
libadmin: Clear structures according to their size.

memset(a, 0, sizeof(a)) is rarely correct, unless a is an error. Use the
size of the destination structure, rather than the size of a pointer to it
when deciding how much memory to clear.

Caught by clang's new error messages

Change-Id: Ia6c566534efae2f67f1b9bd22198d352238a987c
Reviewed-on: http://gerrit.openafs.org/7076
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agolibadmin: read returns an ssize_t, not a size_t
Simon Wilkinson [Fri, 30 Mar 2012 18:14:38 +0000]
libadmin: read returns an ssize_t, not a size_t

size_t is unsigned, and therefore can never be less than 0. Using it as
a return code from read() means that we never catch read errors. read()
is defined as returning ssize_t, so just use this to capture its return
code.

Caught by clang's new error messages

Change-Id: Ibf61119dec2c64fd4b1e16e6ef02178e427116f0
Reviewed-on: http://gerrit.openafs.org/7075
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agoUnix CM: Purge needless brackets
Simon Wilkinson [Fri, 30 Mar 2012 18:12:37 +0000]
Unix CM: Purge needless brackets

Doing if ((a==b)) is unecessary. It's also potentially dangerous, as
that's the syntax required to do assignment within an if statement.
clang now issues warnings (errors in -Werror mode) when it encounters
these.

Remove pointless braces from the Unix CM to make clang happy.

Change-Id: I0f1558b42a487e1de722b77f8423500365a20eee
Reviewed-on: http://gerrit.openafs.org/7074
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agoDARWIN: Make crfree() an inline function
Simon Wilkinson [Fri, 30 Mar 2012 18:09:36 +0000]
DARWIN: Make crfree() an inline function

On Darwin 100, we have
   #define crfree(X) kauth_cred_unref(&X)
which expands in one place to
   kauth_cred_unref(&(afs_ucred_t *)avc->linkData)

clang warns about this in -Werror mode, because arguments to the
address-of operator must be lvalues.

To fix this make crfree an inline function, which will then let us do
the indirection required.

Change-Id: Ic5adb63dcdc11e04c1e428c32e85f33a987fcf42
Reviewed-on: http://gerrit.openafs.org/7073
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agoutil: LogCommandLine has to have a command line
Simon Wilkinson [Sun, 7 Aug 2011 18:41:51 +0000]
util: LogCommandLine has to have a command line

Add an assert() to LogCommandLine to catch the case where it is
called without a command line to log.

Change-Id: Ia1be28b3a1d1d4e144626976f0f82b9675809c0a
Reviewed-on: http://gerrit.openafs.org/7072
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agoSalvager: Don't use garbage vnodes when Testing
Simon Wilkinson [Tue, 15 Jun 2010 18:20:50 +0000]
Salvager: Don't use garbage vnodes when Testing

If Testing is true, and the salvage wants to repair the '.' file,
then it will end up using a garbage value as the location of the
repaired file (vnodeNumber gets set to fid.Vnode, but fid.Vnode is
uninitialised)

Fix this by making it behave as if no repair is necessary when running
in Testing mode. It's unclear that this is entirely the correct answer,
but it's definitely better than the current behaviour.

Caught by clang-analyzer

Change-Id: I1bddd889b3350cf31fe6384573e49e82159c7095
Reviewed-on: http://gerrit.openafs.org/7071
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

12 years agoWindows: Disk Full errors instead of Quota Exceeded
Jeffrey Altman [Sat, 7 Apr 2012 02:30:41 +0000]
Windows: Disk Full errors instead of Quota Exceeded

The AFS Redirector does not support the Windows quota interface
therefore return STATUS_DISK_FULL for all over quota conditions.

Change-Id: Idd8755b26ab65e423330eeb6cb0e1806dd6306c9
Reviewed-on: http://gerrit.openafs.org/7111
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: AFSCheckCellName one level of indirection
Jeffrey Altman [Sat, 7 Apr 2012 02:18:59 +0000]
Windows: AFSCheckCellName one level of indirection

The parameter 'CellName' is a UNICODE_STRING *.  No need to
take the pointer of it to pass to AFSDbgLogMsg().

Change-Id: Id49f95058541a1a0ddaa0db9cb2c5ef0e5a32c64
Reviewed-on: http://gerrit.openafs.org/7109
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: CleanACLEnt requires cm_scache write locked
Jeffrey Altman [Thu, 5 Apr 2012 11:38:47 +0000]
Windows: CleanACLEnt requires cm_scache write locked

Therefore, cm_FindACLCache() must be called with the cm_scache_t
write-locked and therefore cm_HaveAccessRights() must obtain a
write-lock and not a read-lock on 'aclScp'.

Change-Id: I884cd5a70a793d893999bf750264e76d436f40a2
Reviewed-on: http://gerrit.openafs.org/7049
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: Name Array store mount point and volume root
Jeffrey Altman [Mon, 2 Apr 2012 22:10:07 +0000]
Windows: Name Array store mount point and volume root

Modify the Name Array processing to store both the mount point
object and the volume root directory object in the array.  This
is necessary for proper operation of
AFSPopulateNameArrayFromRelatedArray when the DirectoryCB parameter
is a mount point object.

Modify AFSBackupEntry to remove two entries if a volume root
directory entry is being removed.

Remove AFSReplaceCurrentElement() as it is no longer used.

Change-Id: Iaa0a4effc3448351d04bcdd72be9ee726ffe4e9a
Reviewed-on: http://gerrit.openafs.org/7021
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>