openafs.git
8 years agoUpdate .gitignore files
Simon Wilkinson [Wed, 18 Apr 2012 08:10:36 +0000]
Update .gitignore files

Update (and create) .gitignore files across the tree

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

8 years agotests: Explicitly include DES in superuser test
Simon Wilkinson [Wed, 18 Apr 2012 11:44:43 +0000]
tests: Explicitly include DES in superuser test

When the hcrypto/des header was removed from our installed headers, it
wasn't added back in to the superuser test. Add it now, so that the test
can build.

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

8 years agoMac OS: Fixed shared library symbol issues
Simon Wilkinson [Wed, 18 Apr 2012 11:35:10 +0000]
Mac OS: Fixed shared library symbol issues

Some of our shared libraries (in particular, roken) build with different
symbols in them depending on the exact configuration options for a
particular platform. This means that not all of the symbols in the map
file may be present within the library. On Mac OS X we have been working
around this by using the "-flat_namespace,-undefined,suppress" linker
options.

However, with Lion this no longer works, as the linker still expects to
find the symbol in the library whose mapfile indicated that it was
present. So, for example, we end up with errors like:

dyld: Symbol not found: _errx
  Referenced from: openafs.git/tests/rx/../../src/tools/rxperf/rxperf
  Expected in: openafs.git/lib/librokenafs.dylib.1.1

... despite errx actually being provided by the system libraries.

The fix to this is to use the default two level namespace, and change
our behaviour for undefined symbols to 'dynamic_lookup', rather than
'suppress'

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

8 years agotools: Move dumpscan into its own directory
Simon Wilkinson [Tue, 17 Apr 2012 21:28:14 +0000]
tools: Move dumpscan into its own directory

Move dumpscan into its own directory, so that it's Makefile rules can
be better contained, and not pollute the whole 'tools/' namespace

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

8 years agoaudit: remove static local realms
Michael Meffie [Mon, 5 Mar 2012 15:47:45 +0000]
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>

8 years agoviced: remove static local realms
Michael Meffie [Mon, 5 Mar 2012 13:27:55 +0000]
viced: remove static local realms

Use the new auth function to do the local realm match
check instead of static local realms lists.

Override the krb.conf file with the -realms command line
option.

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

8 years agoptserver: remove static local realms
Michael Meffie [Wed, 29 Feb 2012 03:31:45 +0000]
ptserver: remove static local realms

Use the new auth function to do the local realm match
check instead of static local realms lists.

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

8 years agoauth: remove static local realms
Michael Meffie [Tue, 28 Feb 2012 14:19:11 +0000]
auth: remove static local realms

Remove the static list of local realms and use the auth
interface to perform the local realm match check.

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

8 years agorx: Use native 64bit data counters
Simon Wilkinson [Fri, 13 Apr 2012 13:49:59 +0000]
rx: Use native 64bit data counters

Modify the peer, call and rpc_stats structures to use native 64 bit
types for the bytesSent and bytesRcvd data counters. All of our
platforms support native 64bit quantities now, so there's absolutely
no value in rolling our own.

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

8 years agoaklog: heimdal kvno is rapidly changing
Derrick Brashear [Tue, 17 Apr 2012 12:55:45 +0000]
aklog: heimdal kvno is rapidly changing

in 1.6 it's unsigned. in 1.5 it's signed.
it's 32 bits. i don't care. just copy the darn thing.

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

8 years agoWindows: Drop Fcb Resource across SetEOF and SetAllocation
Jeffrey Altman [Mon, 16 Apr 2012 19:22:35 +0000]
Windows: Drop Fcb Resource across SetEOF and SetAllocation

If the file size or allocation is being altered, we must hold
the PagingResource and drop the Fcb Resource.  Dropping the
Fcb resource is necessary to avoid a deadlock with TrendMicro's
filter if the size is set to zero and acquiring the PagingResource
is necessary to prevent races now that the Fcb Resource is no
longer held.

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

8 years agoWindows: Hold PagingResource across ExtendingWrite
Jeffrey Altman [Mon, 16 Apr 2012 18:47:38 +0000]
Windows: Hold PagingResource across ExtendingWrite

When the file allocation size changes the PagingResource must
be held exclusively to prevent races.

Change-Id: I6ff3a2061563dbb858bb284b463913f6d3b33e7a
Reviewed-on: http://gerrit.openafs.org/7223
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

8 years agoWindows: AFSProcessOverwriteSupersede CcSetFileSizes
Peter Scott [Mon, 16 Apr 2012 16:25:01 +0000]
Windows: AFSProcessOverwriteSupersede CcSetFileSizes

Instead of calling CcPurgeCacheSection() in AFSProcessOverwriteSupersede()
as part of the file length truncation to zero, call CcSetFileSizes().

Wait to call CcSetFileSizes() until after the Fcb->Resource has been
dropped but while the Fcb->Header.PagingIoResource is still held.
Make sure that file sizes are restored in the Fcb->Header if the
afsd_service rejects the file update.

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

8 years agoauth: local realms configuration
Michael Meffie [Tue, 28 Feb 2012 13:50:33 +0000]
auth: local realms configuration

Add krb.conf and krb.excl support to the auth cell configuration
library.  Provide a function to determine if the user is local to the
cell.  Provide a function to set the local realms during application
initialization.  These changes are intended to replace the functions
afs_krb_get_lrealm and afs_is_foreign_ticket_name.

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

8 years agorx: Remove surplus call to FindPeer
Simon Wilkinson [Fri, 13 Apr 2012 18:14:44 +0000]
rx: Remove surplus call to FindPeer

When stats are enabled, rxi_ReadPacket calls FindPeer immediately
the packet is received from the wire. The peer structure that it
gets is used solely to increment a counter, and then thrown away.
Given that FindPeer requires a lock, and a hash lookup, this is
really inefficent.

Instead, delay the compilation of statistics until rxi_ReceivePacket.
Call FindPeer for version and debug packets which have no associated
connection otherwise wait until we have found the packet's connection,
and use the peer which is linked from there.

Change-Id: Ic2eb08e52b97d6b033b9d3de59da9346e012d70d
Reviewed-on: http://gerrit.openafs.org/7206
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

8 years agorx: dec rx_nWaiting on clearing RX_CALL_WAIT_PROC
Andrew Deason [Thu, 29 Mar 2012 15:30:47 +0000]
rx: dec rx_nWaiting on clearing RX_CALL_WAIT_PROC

Currently, a couple of callers (rxi_ResetCall, and
rxi_AttachServerProc) will decrement rx_nWaiting only if
RX_CALL_WAIT_PROC is set for a call, and the call is on a queue
(presumably rx_incomingCallQueue). This can cause an imbalance in
rx_nWaiting if these code paths are reached when, in another thread,
rx_GetCall has removed the call from its queue, but it has not yet
cleared RX_CALL_WAIT_PROC (this can happen while it is waiting for
call->lock). In this situation, rx_GetCall will remove the call from
its queue, wait, and e.g. rxi_ResetCall will clear RX_CALL_WAIT_PROC;
neither will decrement rx_nWaiting.

This is possible if a new call is started on a call channel with an
extant call that is waiting for a thread; we will rxi_ResetCall in
rxi_ReceivePacket, but rx_GetCall may be running at the same time.
This race may also be possible via rxi_AttachServerProc via
rxi_UpdatePeerReach -> TryAttach -> rxi_AttachServerProc while
rx_GetCall is running, but I'm not sure.

To avoid this, decrement rx_nWaiting based on RX_CALL_WAIT_PROC alone,
regardless of whether or not the call is on a queue. This mirrors the
incrementing rx_nWaiting behavior, where rx_nWaiting is only
incremented if RX_CALL_WAIT_PROC is unset for a call, so this should
guarantee that rx_nWaiting does not become unbalanced.

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

8 years agorx: conn_call_lock leak
Jeffrey Altman [Sun, 15 Apr 2012 21:40:03 +0000]
rx: conn_call_lock leak

In rxi_ReceivePacket, if the packet is for a client connection
and there is no call allocated, the conn->conn_call_lock was
leaked.  Introduced by 95c38dff3740d7e24971ceb5875c06e7abfce102.

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

8 years agoauth: get local cell internal function
Michael Meffie [Mon, 20 Feb 2012 20:26:09 +0000]
auth: get local cell internal function

Add an internal function to retrieve the local cell
name when the auth mutex is already held. Implement
afsconf_GetLocalCell in terms of the new internal
function.

Change-Id: I2f021a9966129e8e256b61d5219e7315b904ac0e
Reviewed-on: http://gerrit.openafs.org/6875
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agoTESTS: Add the libwrap script to "make check" to handle library paths
Jason Edgecombe [Fri, 13 Apr 2012 01:30:47 +0000]
TESTS: Add the libwrap script to "make check" to handle library paths

LICENSE MIT

Change-Id: I5f77d8703a163b8b9224f64010b9e008bb386c59
Reviewed-on: http://gerrit.openafs.org/7202
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agoWindows: pioctl use GetFileAttributes
Jeffrey Altman [Sat, 14 Apr 2012 13:43:48 +0000]
Windows: pioctl use GetFileAttributes

Instead of attempting to CreateFile(OPEN_EXISTING) the _._AFS_IOCTL_._
file, try using GetFileAttributes() to obtain the attributes of the
file.  The file doesn't exist in the directory listing but the
afs redirector and the afs smb server will respond to the request.
Perhaps the SMB servers in the broken printers will fail it.

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

8 years agoWindows: _._AFS_IOCTL_._ hidden and system
Jeffrey Altman [Sat, 14 Apr 2012 15:06:58 +0000]
Windows: _._AFS_IOCTL_._ hidden and system

Query file attributes returned only the system attribute
and not the hidden attribute.  Must return both.

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

8 years agoWindows: Remove PurgeContent param AFSVerifyEntry
Jeffrey Altman [Sat, 14 Apr 2012 03:16:56 +0000]
Windows: Remove PurgeContent param AFSVerifyEntry

When verifying a directory entry we must update the metadata
for a file therefore we must also purge the data if the version
number changed.  This is not optional.

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

8 years agoWindows: Flush data and then drop locks
Jeffrey Altman [Sat, 14 Apr 2012 00:17:48 +0000]
Windows: Flush data and then drop locks

The redirector must flush the data to the file server
and then drop the file locks.  Doing it the other way
creates races.

Change-Id: Ic3a48546ee9e0066df9d228fc4e57f52b43587c2
Reviewed-on: http://gerrit.openafs.org/7207
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>

8 years agoBuild: check for gencat
Michael Meffie [Fri, 13 Apr 2012 15:58:02 +0000]
Build: check for gencat

Check for the gencat program and give a missing warning if
not present.

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

8 years agoBuild: error if solariscc is not found
Michael Meffie [Fri, 13 Apr 2012 17:01:05 +0000]
Build: error if solariscc is not found

Fail configure if the solariscc is not found and give the builder
a message to cope with non-standard installation paths for
sunstudio.

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

8 years agorx: Rework code which pulls packet from recv queue
Simon Wilkinson [Sun, 8 Jan 2012 11:45:57 +0000]
rx: Rework code which pulls packet from recv queue

Both rxi_ReadProc and rxi_FillReadVector contained copies of the
same code to pull a packet out of the receive queue, and turn it
into the call's currentPacket. Abstract this out into a single common
function, so we're not maintaining the same code in two different
places.

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

8 years agorx: Tidy up currentPacket handling
Simon Wilkinson [Fri, 6 Jan 2012 10:12:26 +0000]
rx: Tidy up currentPacket handling

Instead of making a copy of the call->currentPacket variable in our
read/write routines, reference it directly. Make it clear that
currentPacket is used solely by the application thread, and remove
a number of mistaken comments that suggest otherwise.

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

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>

8 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>