openafs.git
10 years agoFix aklog segfault
Ben Kaduk [Thu, 17 Jun 2010 04:27:51 +0000]
Fix aklog segfault

In auth_to_cell(), we only strdup() into the linkedcell argument
if there is a linkedCell in the current cellconf.  However, in
main(), we free linkedcell if it is non-NULL, but it is allocated
on the stack and could contain garbage.  free() chokes on such
garbage, causing aklog to abort().
If we copy nothing into linkedcell, set it to NULL so that we
do not attempt to free the bogus pointer.

Change-Id: I92905a5f17021ce1bc41909f5ceb1b0344456d93
Reviewed-on: http://gerrit.openafs.org/2213
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

10 years agoLinux: Remove the BKL
Simon Wilkinson [Fri, 23 Apr 2010 17:39:14 +0000]
Linux: Remove the BKL

Recent investigations suggest that we no long require the BKL on
Linux. As an experiment, remove it.

Change-Id: I764fe1f6e9761ada5a0a86ba59450c0615bb1e78
Reviewed-on: http://gerrit.openafs.org/1823
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

10 years agoRemove configure remnants of Digital UNIX / Tru64 client
Russ Allbery [Wed, 16 Jun 2010 01:59:22 +0000]
Remove configure remnants of Digital UNIX / Tru64 client

Remove the configure flag to specify the location of the Digital
UNIX kernel headers and some setup for the kernel module build.
Note in README that Digital UNIX / Tru64 is supported for servers
only.

Change-Id: I983f74068b1a1ae76d9a2b2549a8a141dba4e075
Reviewed-on: http://gerrit.openafs.org/2207
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoIRIX: Implement makesname()
Chaz Chandler [Mon, 14 Jun 2010 04:21:50 +0000]
IRIX: Implement makesname()

makesname() make a semaphore name for use in <sys/sema.h>-type routines on
IRIX.  It takes as input a pointer to an allocated string buffer (sname) of
size METER_NAMSZ, a string prefix (prefix), and a vnode number (v_number).
When complete, sname is returned, pointing to the beginning of a
NULL-terminated string containing the new name, with a maximum of
(METER_NAMSZ-1) characters plus the NULL.  The name is a concatenation of
the string at 'prefix' and the ASCII representation of the number in
'v_number'.

Note: Due to IRIX's use of uint64 to represent vnumber_t and a maximum
semaphore name length of 15 (METER_NAMSZ-1), this function cannot be
guaranteed to produce a name which uniquely describes a vnode.

makesname() is already called from afs_vcache.c but not (or no longer)
available / implemented elsewhere.

Change-Id: I4331c161b68b39a4c067691c97363b637d13ff15
Change-Id: Ia0a615426dc05e01a98e53e89ec3bae3726cac34
Reviewed-on: http://gerrit.openafs.org/2155
Reviewed-by: Chaz Chandler <clc31@inbox.com>
Tested-by: Chaz Chandler <clc31@inbox.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

10 years agoIRIX code cleanup
Chaz Chandler [Mon, 14 Jun 2010 04:18:29 +0000]
IRIX code cleanup

Fixes a few small errors in IRIX-specific code sections

Change-Id: I83e0ca1510eb2d122b9b001f5793f63dabc6ddf1
Reviewed-on: http://gerrit.openafs.org/2154
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Chaz Chandler <clc31@inbox.com>
Tested-by: Chaz Chandler <clc31@inbox.com>

10 years agoDo not assume non-valid addrs in addr hash table
Andrew Deason [Tue, 15 Jun 2010 17:19:25 +0000]
Do not assume non-valid addrs in addr hash table

As part of host state verification, we were calling
h_stateVerifyAddrHash to verify that all addresses for a host were in
the address hash table. The problem with this is that interface
addresses that are not marked as 'valid' are intentionally not in the
addr hash table. So, any time there was a non-'valid' interface
address in the host state, we stood a very good chance to fail to
verify the state.

Instead, if we have a non-'valid' address, try to verify that it is
_not_ in the addr hash table (or at least, is not pointing at the host
with the non-'valid' interface addr), since they're not supposed to be
in there.

Change-Id: I02fb0f516fa3ef384471d19bb1b970cfd8aff874
Reviewed-on: http://gerrit.openafs.org/2205
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoMake h_stateVerifyAddrHash log port on errors
Andrew Deason [Tue, 15 Jun 2010 15:58:58 +0000]
Make h_stateVerifyAddrHash log port on errors

When h_stateVerifyAddrHash logs that an error in state verification
occurs, it was only logging the address of the host causing the
problem. Log the port, too, since there could be multiple hosts with
the same address.

Change-Id: Ideee34f075948a0cb7cc1014920be5e120bdc6ef
Reviewed-on: http://gerrit.openafs.org/2204
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoFix aklog warnings when building with Heimdal
Russ Allbery [Fri, 4 Jun 2010 02:50:14 +0000]
Fix aklog warnings when building with Heimdal

Fix various warnings in the aklog and klog code when building with
Heimdal.  Use krb5_get_init_creds_opt_alloc if it's available rather
than allocating the struct off the stack, since the _opt_init
function is deprecated.

Change-Id: Ieff986121de9078e9402b0a51a8855655330caba
Reviewed-on: http://gerrit.openafs.org/2082
Tested-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoRework the Kerberos Autoconf probes
Russ Allbery [Wed, 26 May 2010 03:19:14 +0000]
Rework the Kerberos Autoconf probes

Previously, building with Kerberos support required either passing a
flag to configure giving the location of a krb5-config script, or
manually setting variables specifying the Kerberos libraries and
header path.  Replace that code with code that checks for Kerberos
libraries automatically and builds the Kerberos code if any were
found, with support for doing direct library probing if there is no
krb5-config script.

Add several platform-specific overrides directly into the configure
support, so we should be able to build out of the box on Mac OS X 10.3,
HP-UX, and AIX Kerberos with the new probes.

The Kerberos Autoconf macros are now the versions that come with
rra-c-util and are tested with multiple other packages, so both
OpenAFS and those packages will be able to benefit from further
portability improvements.

Update README for the new building instructions, documenting how to
configure the Kerberos probes if they can't automatically figure out
the location and flags for Kerberos on your system.

Change-Id: Ia35bb0dbc6b94c6b4dfe8165388447dbfcb31a29
Reviewed-on: http://gerrit.openafs.org/2026
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoGetVolume: do not wait for offlining volumes
Andrew Deason [Tue, 8 Jun 2010 22:28:39 +0000]
GetVolume: do not wait for offlining volumes

In non-DAFS GetVolume, previously we waited for a volume with
vp->goingOffline set to go offline before we return. However, the
fileserver afsfileprocs.c case can treat the "going offline" case and
the "is offline" case identically, so there is no reason to wait. So
make the fileserver call a new GetVolume variant that does not wait.

Without this, all of the threads in the fileserver can potentially be
tied up by waiting for a volume to go offline, if the volume is taking
a long time to go offline due to an offline request following a client
slowly accessing the volume.

Change-Id: I58ae11e585852130154389d8df0567432cd0c2df
Reviewed-on: http://gerrit.openafs.org/2124
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoafscp: Correctly advertise local addresses
Andrew Deason [Tue, 15 Jun 2010 17:33:48 +0000]
afscp: Correctly advertise local addresses

afscp was reporting its local address list in net-byte order, and then
giving that list as a response to RXAFSCB_WhoAreYou. Instead, convert
the addresses to host-byte order, since XDR takes care of endianness
foo.

Change-Id: I5d7d57f811ccaeada235e694ec5f343c1ac535b7
Reviewed-on: http://gerrit.openafs.org/2206
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agomkvers.c - remove afsconfig.h, afs/param.h and assert.h
Jeffrey Altman [Tue, 15 Jun 2010 11:32:11 +0000]
mkvers.c - remove afsconfig.h, afs/param.h and assert.h

assert() is not used within mkvers.c.

afsconfig.h and afs/param.h have dependency problems in
src/config/

Change-Id: I2012a01c87cbd993a70df76ee3384b43ff037b29
Reviewed-on: http://gerrit.openafs.org/2203
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoFix tptserver and tvlserver install rules
Andrew Deason [Mon, 14 Jun 2010 18:28:37 +0000]
Fix tptserver and tvlserver install rules

Commit 00c37e8634b97dba3431804cea467a046be525d5 introduced a few
usages of 'ifeq' in cross-platform Makefiles, breaking the build when
not using GNU make. Fix this by making the tptserver and tvlserver
'install' and 'dest' targets behave more like the 'ptserver' and
'vlserver' ones, and correct the ptserver 'install' target while we
are here.

Change-Id: Ia3fd9149c0f18a96a9899a5dfde41e53a45102b7
Reviewed-on: http://gerrit.openafs.org/2160
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoCleanup and doxygen-ify the comments for GetVolume
Andrew Deason [Tue, 8 Jun 2010 22:19:46 +0000]
Cleanup and doxygen-ify the comments for GetVolume

Change-Id: I54788acd83779b986e78575bde11347952293be6
Reviewed-on: http://gerrit.openafs.org/2123
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoBuild util tests properly with make check
Russ Allbery [Mon, 14 Jun 2010 22:28:20 +0000]
Build util tests properly with make check

If one runs make check without previously running make at the top
level first, it didn't build the util test programs properly.
Recurse into subdirectories for make check as well, and add the
check, test, and tests targets to tests/util/Makefile.in

Change-Id: Idc2caf4cf83a48da350e724aba2ac1228795085d
Reviewed-on: http://gerrit.openafs.org/2162
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoWindows: ensure that afsconfig.h and afs/param.h are included
Jeffrey Altman [Mon, 14 Jun 2010 18:13:11 +0000]
Windows: ensure that afsconfig.h and afs/param.h are included

The recent addition of AFS_NORETURN broke the Windows build
because afsconfig.h and afs/param.h were not included everywhere.
Make sure that they are.

Change-Id: I5962fe1178f73273f5b3c1d269b1a125fba2d2c6
Reviewed-on: http://gerrit.openafs.org/2159
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoWindows: fix definition of lstat() macro
Jeffrey Altman [Mon, 14 Jun 2010 17:36:32 +0000]
Windows: fix definition of lstat() macro

The lstat() macro definition has to take into account
the version of the compiler and the size of time_t.

Change-Id: Id7ad8c3956bba9832cc028db628cfabe58a1d8d9
Reviewed-on: http://gerrit.openafs.org/2158
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoWindows: define errno_t on compilers older than 1400
Jeffrey Altman [Mon, 14 Jun 2010 17:35:12 +0000]
Windows: define errno_t on compilers older than 1400

Visual Studio older than 1400 (VS8) does not define errno_t.

LICENSE MIT

Change-Id: I27c0892d8ba4a371417f635b0d6e5677fa655422
Reviewed-on: http://gerrit.openafs.org/2157
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoubik: add interface for reading during write locks
Andrew Deason [Thu, 20 May 2010 20:22:11 +0000]
ubik: add interface for reading during write locks

Add ubik_BeginTransReadAnyWrite, which allows for reading from the
database, even while there is a conflicting ubik write lock. Reads are
still blocked while the local database is updating due to a write
transaction commit.

Change-Id: I5604fa3cc8a334606f5e3535aed6f6cedcb5f167
Reviewed-on: http://gerrit.openafs.org/2103
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoarm darwin port
Derrick Brashear [Mon, 14 Jun 2010 02:05:27 +0000]
arm darwin port

make things buildable on arm darwin

Change-Id: I88af2b82e9ed356fd57aa8f05dfee71d7fa6cd8a
Reviewed-on: http://gerrit.openafs.org/2153
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoktc newpag stub when environ is not supported
Derrick Brashear [Sun, 13 Jun 2010 15:03:25 +0000]
ktc newpag stub when environ is not supported

on macos systems where we can't get the environment,
just return from ktc_newpag

Change-Id: I9a169d0bf035c40d727a386bb3d2070eea225ed4
Reviewed-on: http://gerrit.openafs.org/2150
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agodarwin afsd include cleanup
Derrick Brashear [Sun, 13 Jun 2010 14:57:38 +0000]
darwin afsd include cleanup

remove mach port stuff from non-kernel version (it's for DiskArb)

remove sysconf, iokit, corefoundation, dns_sd from kernel version.

Change-Id: Ibdf9d8a71f5f0fee659d0c05eea4811617c2b34f
Reviewed-on: http://gerrit.openafs.org/2149
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoLinux: Fix RCU_READ_LOCK test
Marc Dionne [Sat, 12 Jun 2010 23:43:05 +0000]
Linux: Fix RCU_READ_LOCK test

The names of some configure defines changed with the recent autoconf
cleanups.  This one was missed and was left with the old value.

Change-Id: Ibce5e36b8ae6becdfa61bf6e9c440b3d9a6fa272
Reviewed-on: http://gerrit.openafs.org/2130
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoafsd mill dup sys/mount.h include
Derrick Brashear [Sun, 13 Jun 2010 14:54:50 +0000]
afsd mill dup sys/mount.h include

we include sys/mount.h twice. don't.

Change-Id: Ifc872488086a00d32b564d60a5f9a8b374e8f752
Reviewed-on: http://gerrit.openafs.org/2148
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

10 years agogenerated file target
Derrick Brashear [Sun, 13 Jun 2010 13:49:32 +0000]
generated file target

in order to cross compile, allow a way to generate generated files on the host

Change-Id: I9639f350b179dbeb3d45802e8685da88a3b06c83
Reviewed-on: http://gerrit.openafs.org/2147
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

10 years agobuildtools target
Derrick Brashear [Sun, 13 Jun 2010 05:51:30 +0000]
buildtools target

if you wish to cross compile, you want these things. arrange to
be able to build just them

Change-Id: I6bee40b61a16722c402832bba39d2e88dcabec25
Reviewed-on: http://gerrit.openafs.org/2145
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agounix cm activate mtu pings
Derrick Brashear [Thu, 10 Jun 2010 18:47:24 +0000]
unix cm activate mtu pings

set an error code so idle dead time is enforced on sending. needed
in order that MTU pings be activated.

Change-Id: I8cf1ca81e6519b440fc679e85f327f338400c29a
Reviewed-on: http://gerrit.openafs.org/2116
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agorx mtu ping handling
Derrick Brashear [Thu, 10 Jun 2010 18:37:39 +0000]
rx mtu ping handling

engage mtu pings. only occur while a call is active but results are
cached per-peer. requires idle dead time to be in use, or does not
activate. (needed to time out the call, otherwise, keepalives will
succeed and the call will thus not hit regular "down server" timeout)

Change-Id: Ic29b1b5713fb6debde14f4adfd5019ee80cc9e3c
Reviewed-on: http://gerrit.openafs.org/2115
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agopath mtu don't track nonsequenced packets
Derrick Brashear [Thu, 10 Jun 2010 15:41:23 +0000]
path mtu don't track nonsequenced packets

for the purpose of mtu discovery, we need a sequence number to
correlate if a large packet is acked. don't track sequence number
0 packets. a later change adds the mechanics needed for MTU pings

Change-Id: I83d4466115bbd45acdc2777bfbef0ff393dd5a3f
Reviewed-on: http://gerrit.openafs.org/2114
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

10 years agorx checkcall kill extra indirection on call for conn
Derrick Brashear [Thu, 10 Jun 2010 15:37:35 +0000]
rx checkcall kill extra indirection on call for conn

we already set a local variable, conn, to call->conn. use it instead
of dereferencing call->conn repeatedly

Change-Id: I5d38edc1d3507a717598140393094b1ba22ced46
Reviewed-on: http://gerrit.openafs.org/2113
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoidle dead time track less
Derrick Brashear [Thu, 10 Jun 2010 15:34:39 +0000]
idle dead time track less

retransmits don't count as sends for idle "send time" purposes.
neither do ping acks. disallow both in computations.

Change-Id: I599bb1111189efd21580d357c31c043f2315f910
Reviewed-on: http://gerrit.openafs.org/2112
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agounix cm log path mtu warning when retrying
Derrick Brashear [Thu, 10 Jun 2010 15:24:09 +0000]
unix cm log path mtu warning when retrying

if RX_MSGSIZE is analyzed and we'd retry, so indicate to our users

Change-Id: I77aba5dffd4280e0ee43383cadb34aca4042cbd6
Reviewed-on: http://gerrit.openafs.org/2117
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

10 years agomcas fix gc_get_tag return type
Matt Benjamin [Sun, 13 Jun 2010 22:16:37 +0000]
mcas fix gc_get_tag return type

The return type from gc_get_tag is char *

LICENSE BSD

Change-Id: If15259858b84f71d969f1e7713371f3de4e0c3a5
Reviewed-on: http://gerrit.openafs.org/2151
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agomcas cleanup inc/dec macros
Matt Benjamin [Sun, 13 Jun 2010 22:24:48 +0000]
mcas cleanup inc/dec macros

fix type of intermediate value used in CAS operations, and reformat slightly.

LICENSE BSD

Change-Id: If49be8e020e0f735d67290440b1a74caccf90bf0
Reviewed-on: http://gerrit.openafs.org/2152
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agolibadmin: Don't dereference NULL pointer in cmd
Simon Wilkinson [Sat, 12 Jun 2010 09:42:43 +0000]
libadmin: Don't dereference NULL pointer in cmd

If DoBosHostList ends up being called without the -server argument
in its command structure, then a printf will attempt to dereference
a NULL pointer to the -server field.

Caught by clang-analyzer

Change-Id: I1114406d03b265f4d780efd8e84fea53013cb51c
Reviewed-on: http://gerrit.openafs.org/2143
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agofs: Can't use store behind data if pioctl errored
Simon Wilkinson [Sat, 12 Jun 2010 09:35:34 +0000]
fs: Can't use store behind data if pioctl errored

If the call to a pioctl returns an error, it's possible to reach
the end of the storebehind function and try and print an old, or
bogus, value from the pioctl data block.

Caught by clang-analyzer

Change-Id: I1209c0c24730273510fbad98a75a429917836605
Reviewed-on: http://gerrit.openafs.org/2142
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoviced: CopyOnWrite2 shouldn't return undefined val
Simon Wilkinson [Sat, 12 Jun 2010 09:26:09 +0000]
viced: CopyOnWrite2 shouldn't return undefined val

Unless CopyOnWrite2 encounters the condition where
(rdlen != length) || (wrlen !=length) it will never set a value
for the 'rc' return code, and so return with an undefined value.

Looking at the code, it looks like rc should be 0 in all other
situations, so this patch provides a default value.

Caught by clang-analyzer

Change-Id: If3e528f3d66abb3dde6da2304084f7698c05b863
Reviewed-on: http://gerrit.openafs.org/2141
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoFormatting fixes
Simon Wilkinson [Sat, 12 Jun 2010 09:25:07 +0000]
Formatting fixes

Reformat the CopyOnWrite2 function to match our current coding style

Change-Id: I9483c2d391932d675c6c76d6edbb2b8f519b2568
Reviewed-on: http://gerrit.openafs.org/2140
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agovol: open() needs mode if called with O_CREAT
Simon Wilkinson [Fri, 11 Jun 2010 23:23:22 +0000]
vol: open() needs mode if called with O_CREAT

If open() is called with a the O_CREAT flag, then it requires a
3rd argument, containing the mode with which to create the file.
On DARWIN (when we always use O_CREAT), and on other platforms
where the first call to open returned E_NOENT, we weren't doing this,
and so were presumably getting a random mode of whatever garbage was
on the stack.

Caught by clang-analyzer

Change-Id: Ic173e582e0d46f6d4cf8801dc7a6b4b393db5063
Reviewed-on: http://gerrit.openafs.org/2139
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoaudit: result is only used on AIX
Simon Wilkinson [Fri, 11 Jun 2010 23:16:11 +0000]
audit: result is only used on AIX

The 'result' variable is only used on AIX - only bother assigning
it when we're building there.

Caught by clang-analyzer

Change-Id: I06848837282ff3f318474f55f2ee013255ad37c8
Reviewed-on: http://gerrit.openafs.org/2138
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoAvoid off-by-one error when saving the password in klog
Russ Allbery [Sat, 12 Jun 2010 23:07:52 +0000]
Avoid off-by-one error when saving the password in klog

When klog saved the password entered by the user to allow attempts
at multiple AFS principals without reprompting, it copied the whole
buffer according to the declared reply length into local storage.
This was done without regard to the local allocated storage size,
and was then nul-terminated without regard to the allocated storage
size.  Both klog and Heimdal use a size of BUFSIZ for the reply
buffer by default, which meant that klog on Heimdal was writing past
the end of the allocated structure when nul-terminating the password.

Store our allocated buffer size in the struct and only copy at most
one fewer than that many characters, and then nul-terminate
accordingly.

(The assumption that BUFSIZ is always long enough is still bogus,
but that's larger surgery.)

Change-Id: Ic8d4357aad2f8dfa0fffe9849d2546a88ecd246a
Reviewed-on: http://gerrit.openafs.org/2129
Tested-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoLinux s390x: replace AFS_64BIT_KERNEL with AFS_LINUX_64BIT_KERNEL
Marc Dionne [Sun, 13 Jun 2010 00:43:25 +0000]
Linux s390x: replace AFS_64BIT_KERNEL with AFS_LINUX_64BIT_KERNEL

The s390x param.h file defines AFS_64BIT_KERNEL, but this looks to
be AIX specific, and some Linux headers expect AFS_LINUX_64BIT_KERNEL.
This causes many errors because we end up trying to use struct flock64
instead of struct flock.

Change-Id: I39a4a94fa895143172c1ee75ff71c2015232156f
Reviewed-on: http://gerrit.openafs.org/2131
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agobucoord: Use mkstemp properly
Simon Wilkinson [Sun, 13 Jun 2010 00:44:27 +0000]
bucoord: Use mkstemp properly

Use mkstemp wherever we have it available, to silence warnings
about mktemp's safety.

When we do use mkstemp, use it properly. It doesn't return void,
it returns an open filehandle. Convert this filehandle into a FILE *,
rather than throwing it away, and leaking an open file descriptor.

Caught by clang-analyzer

Change-Id: Ib5864f684c6d5a8686e0a872364a645c90a29390
Reviewed-on: http://gerrit.openafs.org/2144
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agocomerr: Don't leak CFStringRef
Simon Wilkinson [Fri, 11 Jun 2010 22:59:49 +0000]
comerr: Don't leak CFStringRef

If str is NULL on entry to _intlize, than it will leak the
CFStringRef that it constructed a few lines earlier. Fix this.

Caught with clang-analyzer

Change-Id: I6d62e7792918da95e4fed1c676d14ad9124d93fa
Reviewed-on: http://gerrit.openafs.org/2137
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agolibadmin: Don't use undefined value
Simon Wilkinson [Fri, 11 Jun 2010 22:50:29 +0000]
libadmin: Don't use undefined value

If IsValidCellHandle returns false, then we can jump to
fail_pts_GroupMemberRemove, and end up using a value for
ids.idlist_val which hasn't been defined. Fix this.

Caught by clang-analyzer.

Change-Id: I030d155f9ad2481250e84c31d4d7d26cb39a9c61
Reviewed-on: http://gerrit.openafs.org/2136
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoAdd support for clang compiler attributes
Simon Wilkinson [Fri, 11 Jun 2010 22:49:34 +0000]
Add support for clang compiler attributes

Rearrange the way that we define compiler attributes so that we
can define them for clang, too. Don't assume that clang will support
all of the attributes that gcc does, so split them up into separate
sections.

Change-Id: Ic6233f5c63a07b3ef99a85ae3be9e45e28387127
Reviewed-on: http://gerrit.openafs.org/2135
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoAdd AFS_NORETURN macro and use it
Simon Wilkinson [Fri, 11 Jun 2010 22:46:29 +0000]
Add AFS_NORETURN macro and use it

Add the AFS_NORETURN macro which can be used with gcc compatible
compilers to indicate that a particular funciton prototype will
not return control to the caller. This both improves code quality,
and helps with static analysis.

Use this to flag afsmon_Exit, db_panic, osi_Panic, Abort, Exit
and the error handlers for osi_Assert and our local assert fn
all as being noreturn.

Change-Id: Ic6c4ae319af3d6f7665c9ee5072b556c01850982
Reviewed-on: http://gerrit.openafs.org/2134
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agorxgen: Remove inlist from autogenerated code
Simon Wilkinson [Fri, 11 Jun 2010 22:33:07 +0000]
rxgen: Remove inlist from autogenerated code

The 'inlist' variable is only used by code that is #if 0, and never
emitted by the rxgen source. Remove the definition, and assignment,
to this variable.

Caught by clang-analyzer

Change-Id: Ife162d392a47c48e1eebd75fe2c0af9524cd758a
Reviewed-on: http://gerrit.openafs.org/2133
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoChanges to build with clang on Mac OS 10.5
Simon Wilkinson [Fri, 11 Jun 2010 21:25:35 +0000]
Changes to build with clang on Mac OS 10.5

clang defines __x86_64__ and doesn't define __i386__ when building
on a 64bit Leopard machine. Change the defines in param.h so we
can build on this platform.

Change-Id: Icfc16ca83162e8148d4261207c05d90d12cbabc2
Reviewed-on: http://gerrit.openafs.org/2132
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoDocument vos listaddrs -host and -uuid
Russ Allbery [Thu, 27 May 2010 22:17:43 +0000]
Document vos listaddrs -host and -uuid

Document the -host and -uuid flags to vos listaddrs.  They were mentioned
in the SYNOPSIS, but not in the OPTIONS section of the manual page.

Change-Id: I96e6b67b7239d9455060fd0c76b8d44f41a010a2
Reviewed-on: http://gerrit.openafs.org/2083
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>

10 years agoLinux: Fix set_cr_group_info and cr_group_info
Simon Wilkinson [Sat, 12 Jun 2010 21:59:23 +0000]
Linux: Fix set_cr_group_info and cr_group_info

Commit dc85abca renamed set_cr_group_info to afs_set_cr_group_info
and cr_group_info to afs_cr_group_info, but didn't catch all call
sites. In particular, those in the NFS translator, in non-keyring
code paths, and in the 2.4 code, were missed.

Thanks to Adam Megacz for the bug report on openafs-info.

Change-Id: I71f8cc27d499c98d164d05e02f7d5b2c5d4c1933
Reviewed-on: http://gerrit.openafs.org/2127
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoDo not set inUse for non-fileserver non-DAFS
Andrew Deason [Thu, 10 Jun 2010 16:51:57 +0000]
Do not set inUse for non-fileserver non-DAFS

Setting inUse in a volume header to anything besides 1 is a
DAFS-specific change. For non-DAFS, non-fileserver programs do not
touch inUse. Since inUse is not cleared for non-fileserver non-DAFS,
make sure not to set it for non-fileserver non-DAFS.

Change-Id: I4d50299d4dc4fd8757906ba493d182b386dd9b1b
Reviewed-on: http://gerrit.openafs.org/2122
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agovlclient: work with non-space whitespace
Andrew Deason [Fri, 11 Jun 2010 21:51:02 +0000]
vlclient: work with non-space whitespace

Make vlclient work with non-space whitespace separating arguments.
This also makes it cope with a trailing newline that fgets() gives us,
making this more intuitive to use.

Change-Id: Ida4da9f997ac073a5afa6c95e1b3cec180c18e1a
Reviewed-on: http://gerrit.openafs.org/2126
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

10 years agodafs state analyzer shouldn't require trailing spaces in commands
Derrick Brashear [Fri, 11 Jun 2010 19:06:24 +0000]
dafs state analyzer shouldn't require trailing spaces in commands

the tokenizer didn't null out \n, but the strcmps for commands didn't deal,
so this basically works badly interactively. all commands not recognized.

Change-Id: Ifa7f8c0204a83d27f8876af8de94cb338499cdc0
Reviewed-on: http://gerrit.openafs.org/2125
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoRemove afsio warnings and errors
Andrew Deason [Thu, 10 Jun 2010 15:29:39 +0000]
Remove afsio warnings and errors

Fix a few warnings and errors in afsio, so it can compile:

 - inlcude rx/rx_prototypes.h, not rx_prototypes.h

 - only declare 'code' in SRXAFSCB_TellMeAboutYourself, and the global
   rx_mtu in AFS_NT40_ENV, since they're only used on NT40

 - remove declarations of the unused variables 'host' in
   HandleLocalAuth, 'i' in readFile, and 'i' in writeFile

Change-Id: If39420cca791669200ccb4d3f46aa5ac7eb89c7d
Reviewed-on: http://gerrit.openafs.org/2121
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agowindows cm_BeginDirOp add flags (nobuildtree)
Matt Benjamin [Thu, 27 May 2010 23:14:20 +0000]
windows  cm_BeginDirOp add flags (nobuildtree)

Add a flags argument to cm_BeginDirOp, and define a flag
CM_DIROP_FLAG_NOBUILDTREE which asserts that the operation
being synchronized does not require scp->dirPlus to be
constructed.

Change-Id: Ibc4345574da3c1e7717c83b64a83260f70a3b06c
Reviewed-on: http://gerrit.openafs.org/2053
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Asanka Herath <asanka@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoRX: Can't assert a void result
Simon Wilkinson [Fri, 11 Jun 2010 09:48:37 +0000]
RX: Can't assert a void result

We can't assert(MUTEX_DESTROY(blah) == 0) when the MUTEX_DESTROY
macro already returns void (and asserts), as it does in the
pthread case. This fixes the build failure introduced by
53c9258cd7300c03be3f3e50003cad3dfc59baf3

Change-Id: I0b7a30e785de3437f0c1e264b4a63c87f63b6783
Reviewed-on: http://gerrit.openafs.org/2120
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years agorx service specific data
Matt Benjamin [Tue, 8 Jun 2010 22:29:13 +0000]
rx service specific data

Adds rx_GetServiceSpecific and rx_SetServiceSpecific to the rx_service interface,
conforming to the equivalent calls in the rx_connection interface.
For consistency, the implementation strategy is the same.  The intended
use is to more cleanly support server multiplexing within an RPC-based
test dispatch library.

Change-Id: I6a8968484efe2c858857008321996e67328bb75c
Reviewed-on: http://gerrit.openafs.org/2097
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoBreak origin's callback for RXAFS_Rename target
Andrew Deason [Thu, 22 Oct 2009 03:16:38 +0000]
Break origin's callback for RXAFS_Rename target

When we RXAFS_Rename something, the status of the renamed FID can
sometimes change, and thus we break callbacks on it. Currently, however,
we do not break the callback for the originating client, even though the
status of the target changes and we do not return an AFSFetchStatus to
the caller.

Since the callback is not always broken for the target, it may not be
immediately obvious to client implementations to implicitly break the
target's callback. Since we do not have an explicit protocol
specification saying that the callback is implicitly broken, break the
callback for the origin client as well, to be safe.

Change-Id: I97d90518a240f852013d1d63fccef663c8b0e998
Reviewed-on: http://gerrit.openafs.org/709
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoAvoid unnecessarily updating .. in SAFSS_Rename
Andrew Deason [Wed, 9 Sep 2009 20:56:26 +0000]
Avoid unnecessarily updating .. in SAFSS_Rename

Currently the .. entry for a directory is always recreated on a Rename
operation, even if the parent directory does not change. Now, avoid
altering the directory at all (including no COW nor DV bump nor vnode
modify time update) when we don't need to.

Change-Id: I53478ec05e2fc6362836043476ff67e2c41b7feb
Reviewed-on: http://gerrit.openafs.org/436
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoWindows: Revise SMB QuerySecurityInfo for MS10-020
Jeffrey Altman [Wed, 9 Jun 2010 17:55:14 +0000]
Windows: Revise SMB QuerySecurityInfo for MS10-020

MS10-020 (http://support.microsoft.com/kb/980232) has caused
many problems for implementors of SMB 1.0 servers and applications
that call GetFileSecurity() without checking the return code to
determine if the call succeeded.  The gist of the vulnerability
was that the SMB redirector would pass any buffer it received
to the application regardless of whether or not it was valid.
MS10-020 protects the applications by strictly validating the
SMB response data structure and the data in the security descriptor
that is returned.

The problem for SMB 1.0 server implementors is that there have
been at least three different protocol descriptions for
NT_TRANSACT_QUERY_SECURITY_DESC published over the last decade
and all of them are incomplete.  Therefore, just about no one but
Microsoft has an SMB 1.0 server implementation that produces the
exact out that they are expecting to validate.

The end result is that in an attempt to protect applications from
crashing due to invalid input being passed in directly caused
dozens of applications to crash by not returning any security
descriptor data at all.  Even when the applications didn't crash
they might not have been able to save their data.  Cisco WAAS
and NetApp DataOnTap systems were most adversely affected and
they have had CIFS protocol licenses for many many years.

To fix OpenAFS here is what needed to be done:

1. Instead of returning a security descriptor that gives ownership
   to the NUL SID, give it to the Everyone SID and set the flag
   that states that everyone has full access.

2. Validate the input parameters.  In particular, check to ensure
   that the SMB file descriptor is valid and the file has not
   been deleted.

3. Enforce the maximum output data and parameter counts.

4. Handle buffer overflow and buffertoosmall conditions
   in the manner that Microsoft expects them to be handled.
   In particular, note that the parameter data which is returned
   in the SMB Data Region is not counted in the Data Count.
   Even if MaxData is 0, we can still return parameters values
   as long as MaxParm is large enough.

LICENSE MIT

Change-Id: I95034bc6f24a282decc507edcffb93bc58b986be
Reviewed-on: http://gerrit.openafs.org/2110
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Asanka Herath <asanka@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

10 years agofurther constrict nat pings
Derrick Brashear [Mon, 7 Jun 2010 04:29:06 +0000]
further constrict nat pings

one more constrainment of nat pings on unix

Change-Id: I8b3db989b0e16a79cd63795147145c5e0ab55e6e
Reviewed-on: http://gerrit.openafs.org/2091
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoAdd additional documentation for the new test suite
Russ Allbery [Wed, 9 Jun 2010 21:12:49 +0000]
Add additional documentation for the new test suite

Add a copy of docs/writing-tests from C TAP Harness as HOWTO and add
a README with some additional explanations more specific to OpenAFS.

Change-Id: Ic5b04805db6b00bcb82862ad8d2ebe466f2c266b
Reviewed-on: http://gerrit.openafs.org/2109
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>

10 years agoInstall pthreaded ptserver and vlserver
Andrew Deason [Fri, 21 May 2010 16:47:42 +0000]
Install pthreaded ptserver and vlserver

When --enable-pthreaded-ubik is specified, install the pthreaded
versions of ptserver and vlserver instead of the non-pthreaded
versions. Previously, the pthreaded versions were getting built but
not installed with 'make dest' or 'make install'.

Change-Id: If2f08342df4c94c1cce3001614d9e050222bf0f6
Reviewed-on: http://gerrit.openafs.org/2102
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoMove FreeBlock prototype to vlserver_internal.h
Andrew Deason [Fri, 21 May 2010 16:19:53 +0000]
Move FreeBlock prototype to vlserver_internal.h

FreeBlock is only used in internal vlserver code and should not be
called by anything else; it should not be prototyped in a public
header. Move its prototype to go along with the other vlserver
internal prototypes.

Change-Id: Id66f046c76a9d4c454bbd6fd6e65c75dbeccf68e
Reviewed-on: http://gerrit.openafs.org/2101
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoDefine updateUbikNetworkAddress static
Andrew Deason [Wed, 2 Jun 2010 20:06:51 +0000]
Define updateUbikNetworkAddress static

updateUbikNetworkAddress is static, and its prototype says so. The
actual implementation of the function lacks 'static', though. Add it.

Change-Id: Ida8e54cecabfffb2adbeb5f12d233668897893f8
Reviewed-on: http://gerrit.openafs.org/2100
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoFix the trailing #endif comment in tests/tap/basic.h
Russ Allbery [Wed, 9 Jun 2010 01:51:16 +0000]
Fix the trailing #endif comment in tests/tap/basic.h

Change-Id: I3a7dbda8d2792229365df4266ca43cbb4bc815bf
Reviewed-on: http://gerrit.openafs.org/2099
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoAdd okv function to the TAP test library
Russ Allbery [Wed, 9 Jun 2010 01:40:11 +0000]
Add okv function to the TAP test library

Add an okv() varient of the ok() function that takes the arguments as
a va_list instead of as a variable argument list.  This makes it easier
to reuse ok() when writing other tests.

Change-Id: Icaeaaf9d6bd9d54bfd886a75961d98367ee0fb9a
Reviewed-on: http://gerrit.openafs.org/2098
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoWindows: Detect if AFSCache is memory mapped to a new address
Jeffrey Altman [Mon, 7 Jun 2010 22:18:39 +0000]
Windows: Detect if AFSCache is memory mapped to a new address

The Windows AFSCache paging file contains pointer addresses
that are only valid if the file is memory mapped at a specific
memory address.  If the file is mapped at a new address, the
pointer values will be invalid and the service will crash with
an invalid memory access.

Check for address consistency and force the cache to be rebuilt
if the consistency is lost.

LICENSE MIT

Change-Id: Ie7fb64659f808f09279445f47c2f1385be0a53f0
Reviewed-on: http://gerrit.openafs.org/2095
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoSolaris: lookup "" like "."
Andrew Deason [Tue, 8 Jun 2010 15:38:07 +0000]
Solaris: lookup "" like "."

At least on some versions of solaris, we can get passed an empty
string to afs_lookup, if the root directory is in AFS (e.g. after a
chroot). Interpret this as the same as looking up the "." entry;
otherwise we return ENOENT, implying that the "/" directory does not
exist, even if its subdirectories do.

FIXES 127356

Change-Id: I84283e78fbf33b946afaf3c80ef4a1a679e8fc93
Reviewed-on: http://gerrit.openafs.org/2096
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agolibafs: consistently hold vnode refs
Andrew Deason [Tue, 18 May 2010 16:39:21 +0000]
libafs: consistently hold vnode refs

Make all common libafs code call AFS_FAST_HOLD to hold an afs vnode
reference, instead of sometimes calling VN_HOLD(AFSTOV(tvc)) directly.
Make AFS_FAST_HOLD always call osi_vnhold, and have each platform
define osi_vnhold for their platform-specific quirks (as it was doing
before).

This way, if a platform has an osi_vnhold that is special somehow (on
solaris, we bump a VFS refcount if the vnode refcount goes from 0->1),
it will always be called on vnode references.

Change-Id: I7bb2b5ac116c8e86f6c6c0d40f414523870275a3
Reviewed-on: http://gerrit.openafs.org/1987
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoAIX: make osi_procname a stub
Andrew Deason [Mon, 7 Jun 2010 16:42:02 +0000]
AIX: make osi_procname a stub

'curproc', 'curthread', or other such conveniences do not exist on
AIX, so the current osi_procname implementation breaks the build.

Determining the current process name on AIX is, while possible,
difficult and error-prone. Since we only need the process name for
informational messages to users, don't bother trying to determine it,
and just return the empty string so we can build.

Change-Id: I452a9786d809c3dee3da519cd3d6ca053f8d7ab8
Reviewed-on: http://gerrit.openafs.org/2094
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoMake lib/afs.exp in sys_depinstall
Andrew Deason [Mon, 7 Jun 2010 17:18:53 +0000]
Make lib/afs.exp in sys_depinstall

The AIX libafs uses lib/afs.exp to build, and libafs depends on
sys_depinstall. So, make lib/afs.exp in addition to
include/afs/afs.exp in sys_depinstall.

Change-Id: I8788a49cd4a5e7545f0f1f45572cdfb0f014c3db
Reviewed-on: http://gerrit.openafs.org/2093
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoAIX: declare code in osi_TryEvictVCache
Andrew Deason [Mon, 7 Jun 2010 17:13:11 +0000]
AIX: declare code in osi_TryEvictVCache

osi_TryEvictVCache was missing 'code's declaration. Declare 'code'.

Change-Id: Ife5b9bfaea4d6a88bcbd82b862e26afcee1c149f
Reviewed-on: http://gerrit.openafs.org/2092
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoWindows: remove src/NTMakefile
Jeffrey Altman [Sat, 5 Jun 2010 23:34:29 +0000]
Windows: remove src/NTMakefile

NTMakefile was moved from src to the top level.
A second copy in src just gets out of sync.

Change-Id: I9474fab56cee46c3acb1758aee62729c1cfadd7b
Reviewed-on: http://gerrit.openafs.org/2088
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoWindows: Cleanup .exp .res .manifest and others
Jeffrey Altman [Sat, 5 Jun 2010 23:29:59 +0000]
Windows: Cleanup .exp .res .manifest and others

Fix the cleanup procedure to work when the tree has not previously
been built.

Delete .exp, .res, and .manifest files from the $(OBJ) tree.

Perform cleanup on all language directories.

Change-Id: I2a24c69293066f012cb869fe67dbacb5ffdc2d43
Reviewed-on: http://gerrit.openafs.org/2087
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoWindows: Update fs newcell and add VIOCNEWCELL2
Jeffrey Altman [Thu, 3 Jun 2010 16:04:15 +0000]
Windows: Update fs newcell and add VIOCNEWCELL2

The Windows version of "fs newcell" did not accept any parameters
and behaved quite differently from the Unix version.  Instead of
permitting new cell information to be added, the Windows version
simply forced the existing cell information to be reacquired.

This update adds a new pioctl, VIOCNEWCELL2, to support the
implementation of a Unix-style "fs newcell".  The functionality
added here differs from the Unix version in the following ways:

 1. "fs newcell" with no arguments is still accepted
    in order to maintain compatibility with prior Windows
    behavior.

 2. "fs newcell -cell <cell> -dns" instructs the cache manager
    to add the new cell but obtain the vldb server info from
    DNS.

 3. "fs newcell -cell <cell> ... -registry" instructs the cache
    manager to add the new cell and also save the cell configuration
    data in the registry for use the next time the service restarts.

 4. The -vlport and -fsport options are accepted although the
    -fsport value is currently unsupported by the cache manager.

LICENSE MIT

Change-Id: If62cc8e1c6cc8ba2defb4cd72dae8a87b4d915e0
Reviewed-on: http://gerrit.openafs.org/2080
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoWindows: Freelance Import CellServDB
Jeffrey Altman [Thu, 3 Jun 2010 15:59:45 +0000]
Windows: Freelance Import CellServDB

Add a new registry option that permits automatic generation of
Freelance mountpoints for every cell listed in the CellServDB info
(file and registry).  "FreelanceImportCellServDB".  This functionality
is only triggered when the afsd_service is started.   The operation
is performed in the background by the daemon thread after the firewall
configuration is set.

LICENSE MIT

Change-Id: Ic6cc0738f8c185d77f9cf69d4997b8044522e50e
Reviewed-on: http://gerrit.openafs.org/2079
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoWindows: engage path mtu discovery for rx
Jeffrey Altman [Fri, 4 Jun 2010 04:46:39 +0000]
Windows: engage path mtu discovery for rx

Change-Id: Ice32ca652dfcf1c14577c696eaca074f61a62675
Reviewed-on: http://gerrit.openafs.org/2085
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoWindows: enable circular buffer management for rx socket input
Jeffrey Altman [Fri, 4 Jun 2010 04:45:21 +0000]
Windows: enable circular buffer management for rx socket input

LICENSE BSD

Change-Id: Ibbcb6171738b4f6adfb267b5782b53ae7170b0e9
Reviewed-on: http://gerrit.openafs.org/2084
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoComprehensive edit of Admin Guide chapter two (first 20%)
Russ Allbery [Sat, 29 May 2010 21:45:04 +0000]
Comprehensive edit of Admin Guide chapter two (first 20%)

Update and revise chapter two (Issues in Cell Configuration and
Administration) of the Administration Guide for current AFS and current
computing concepts.

Remove references to an AFS-provided login utility and discuss local login
configuration for Kerberos more generically.  Further clarify the role of
ssh in ensuring the user has access to files in AFS during remote login.
Improve the inode and namei discussion slightly.  Update the setuid
discussion for the new default of disabling setuid for cells and for the
known security flaws in enabling setuid.  Modernize terminology for DNS
around cell naming and remove the descriptions of TLDs.  We can now assume
our target audience knows this stuff.

Move index terms into the appropriate section for what's being indexed in
a few more cases.

Lots of other, more minor wording changes and updates.

Change-Id: Id8b1ace5afca6b8b7b2082a9a0779a4b91c89dcd
Reviewed-on: http://gerrit.openafs.org/2065
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years agorx mtu discovery constrainment code
Derrick Brashear [Tue, 1 Jun 2010 17:10:32 +0000]
rx mtu discovery constrainment code

this code makes us work in the face of a sub1500 mtu network.
a subsequent commit is needed to make it more effective: attempts
to grow the mtu must be scheduled so we aren't forced to heavily
brute-force on failure to discover the exact mtu immediately;
for performance, we do want to grow to the real mtu.

Change-Id: If876c134efd4b0952035193ef00a6e780f7adc64
Reviewed-on: http://gerrit.openafs.org/2069
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoWindows: convert cm_config.c to use strsafe library
Simona Poilinca [Fri, 4 Jun 2010 04:42:38 +0000]
Windows: convert cm_config.c to use strsafe library

Replaced the unsafe string functions with the safe versions
available in microsoft's strsafe library.

Change-Id: Id9e9acf7eaa1b045d91b972b37a411c7a94ed3ac
Change-Id: I377fe4e2e5bac904f5dd28916f1244262e1933c2
Reviewed-on: http://gerrit.openafs.org/1778
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Asanka Herath <asanka@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoWindows: Support building a lite-client installer
Asanka Herath [Fri, 4 Jun 2010 03:58:42 +0000]
Windows: Support building a lite-client installer

If LITECLIENT is defined when invoking the WiX based MSI installer
build, we will build a light-weight client installer MSI.  This
minimizes the size of the installer for users who only need client
functionality from OpenAFS.

The light-weight client excludes:

  - Server components
  - Control center components
  - Administration utilities
  - Debug symbols

Lite-client installer can also be built by invoking target wix-lite
from the root NTMakefile.

Change-Id: I544cdb7170d17358eb235f3c476c468dbae62776
Reviewed-on: http://gerrit.openafs.org/2034
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years ago"fs checkservers" during cache creation can crash client
Rainer Toebbicke [Wed, 2 Jun 2010 16:12:36 +0000]
"fs checkservers" during cache creation can crash client

Many pioctl calls pass as soon as the afs_resourceinit_flag is set,
which happens relatively early, alas before the cell name is set.
PCheckServers and others need the latter and dereference NULL.

Easiest: set the cell name as soon as it is known and the dynroot initialisation
piggy-backed to it can be done.

Change-Id: I9985f2c4a0afddfed04b85338108b3d6e97b64e6
Reviewed-on: http://gerrit.openafs.org/2072
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoDocument in SalvageLog(5) the per-partition salvager logs
Russ Allbery [Wed, 26 May 2010 18:15:30 +0000]
Document in SalvageLog(5) the per-partition salvager logs

Document that salvager creates separate logs per partition when doing
a full server salvage and then appends them all to SalvageLog when it
completes.

Change-Id: I2ffa8c79ef83b590f90bb014fc318559deae7113
Reviewed-on: http://gerrit.openafs.org/2035
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>

10 years agoWindows: Fix usage of cm_FreeServerList
Jeffrey Altman [Thu, 3 Jun 2010 15:54:04 +0000]
Windows: Fix usage of cm_FreeServerList

cm_FreeServerList will set the input variable to NULL if the
contents of the list could in fact be freed.  If they could not
be freed, the individual entries are marked for deletion and will
not be subsequently used.  Do not set the list variable to NULL
after calling cm_FreeServerList otherwise memory can be leaked.

LICENSE MIT

Change-Id: Ia3cacd760d7395a2dd6b063643a8aa86f9e468b9
Reviewed-on: http://gerrit.openafs.org/2078
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoWindows: Reduce number of Nat Ping Connections
Jeffrey Altman [Thu, 3 Jun 2010 15:51:17 +0000]
Windows: Reduce number of Nat Ping Connections

Instruct rx library to only perform NAT pings on file server
connections that are actively in use and which are anonymous.

LICENSE MIT

Change-Id: I6b74e8070f2c522ed13e0c06ea7a304cce525ab9
Reviewed-on: http://gerrit.openafs.org/2077
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

10 years agoWindows: Fix cm_IoctlSkipQueryOptions buffer management
Jeffrey Altman [Thu, 3 Jun 2010 15:49:14 +0000]
Windows: Fix cm_IoctlSkipQueryOptions buffer management

When cm_IoctlSkipQueryOptions advances the input buffer
pointer it must also reduce the available input length.

LICENSE MIT

Change-Id: I4e0d673e3ff5d8621e715d33d73616a22211a8a9
Reviewed-on: http://gerrit.openafs.org/2076
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoWindows: do not request KEY_WRITE privilege if not required
Jeffrey Altman [Thu, 3 Jun 2010 15:47:46 +0000]
Windows: do not request KEY_WRITE privilege if not required

When querying the registry cellservdb info the KEY_WRITE privilege
is not required, therefore do not request it.

LICENSE MIT

Change-Id: I050717be3afb5df979897ffbef65987160a65149
Reviewed-on: http://gerrit.openafs.org/2075
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

10 years agoWindows: warning removal
Jeffrey Altman [Thu, 3 Jun 2010 15:44:33 +0000]
Windows: warning removal

cast away size_t larger than afs_uint32 warnings

use variables with the proper signed vs unsigned state in order
to avoid signed vs unsigned comparison warnings

disable deprecated string function warnings

LICENSE MIT

Change-Id: I78a3786a0766979c8d83cc5dbd06f91e70b0ee47
Reviewed-on: http://gerrit.openafs.org/2074
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

10 years agodarwin notify don't recurse on vcache lock
Derrick Brashear [Thu, 3 Jun 2010 19:50:46 +0000]
darwin notify don't recurse on vcache lock

afs_vop_access->afs_VerifyVCache2->afs_GetVCache->afs_FetchStatus->
afs_Analyze->afs_NotifyUser can recurse and try to notify us. Don't
worry about it; we're best-effort.

we lack a lock primitive to see if we own this lock.

Change-Id: Ibc0c8a8164a95f0d268e5f1f42a62c3a28c4ab9d
Reviewed-on: http://gerrit.openafs.org/2081
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoup: refuse multicharacter arguments
Andrew Deason [Thu, 3 Jun 2010 14:54:28 +0000]
up: refuse multicharacter arguments

The 'up' command currently silently accepts and discards extra
characters when specifying arguments. This can produce rather
confusing behavior such as mistyping '-v -1' as '-v-1' resulting in
the '-v' switch being honored, but the '-1' being ignored. The same
thing occurs for specifying '-v1', even though the usage message
implies that you can combine arguments.

So instead, report an error message for any arguments specified that
are longer than 2 characters, since they are never valid.

Change-Id: I64846b53248ea1d06d03b6ac1fdb4317ba04b03b
Reviewed-on: http://gerrit.openafs.org/2073
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

10 years agoWindows: Fix midl options for generating stub code
Asanka Herath [Wed, 26 May 2010 16:34:08 +0000]
Windows: Fix midl options for generating stub code

MIDL is used to generate server stub code for implementing SMB RPC.
Fix the invocation of MIDL so that MIDL can locate include files and
respect AFSDEV_AUXMIDLFLAGS.

Change-Id: I31e90897c8f0d8db6746dbc94a3fe4de53aab060
Reviewed-on: http://gerrit.openafs.org/2033
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

10 years agorx allow setpeermtu to take a peer
Derrick Brashear [Tue, 1 Jun 2010 16:13:42 +0000]
rx allow setpeermtu to take a peer

modify setpeermtu to work when a peer is passed in. modify existing
callers. note solaris caches a whole host's pmtu, so use that
on all peers at the host.

Change-Id: Iba05fffd47a7c7b63742d6c539be4fe248336fb7
Reviewed-on: http://gerrit.openafs.org/2068
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agorx setpeermtu should handle a host correctly
Derrick Brashear [Tue, 1 Jun 2010 16:08:57 +0000]
rx setpeermtu should handle a host correctly

right now, when no port is passed, we don't correctly tweak
the mtu for all peers on a host. do that here.

Change-Id: Ia07f592bf001415d8a76bd3326f2dc6aa0641809
Reviewed-on: http://gerrit.openafs.org/2067
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoaklog no krb524 kill warnings
Derrick Brashear [Tue, 1 Jun 2010 16:04:43 +0000]
aklog no krb524 kill warnings

if you're disabling krb524, these variables are unused. make them
not be part of such a compile

Change-Id: Ib10e8fc82614b7a821daa7c77540ce246551cb0a
Reviewed-on: http://gerrit.openafs.org/2066
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoAdd warnings for Authentication Server commands
Russ Allbery [Thu, 27 May 2010 21:40:21 +0000]
Add warnings for Authentication Server commands

For each command only useful with the Authentication Server, add
warnings that the Authentication Server is obsolete and will be
removed in a future version of OpenAFS.  Encourage people who care
to update uss to work with a modern Kerberos KDC, recommend kinit
and aklog or klog.krb5 over klog, and warn that klog will be of
limited use without an Authentication Server.

Change-Id: Idc78ba548134b83ac1eea0fb81a5bc38a431bb38
Reviewed-on: http://gerrit.openafs.org/2052
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoprune further list of connections we natping on
Derrick Brashear [Fri, 28 May 2010 12:49:37 +0000]
prune further list of connections we natping on

if it had tokens before, again, still not worth a nat ping.
nor for the vlserver.

Change-Id: I30281801b604b67b418b8a54a1889c54c8f6e4db
Reviewed-on: http://gerrit.openafs.org/2058
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

10 years agoRewrite vldb_check -fix
Rod Widdowson [Thu, 20 May 2010 17:27:11 +0000]
Rewrite vldb_check -fix

vldb_check -fix was very 'topical' in nature.  It showed signs that
each sucessive corruption had been treated as a one off needing a
specific fix.  This made the code difficult to understand and
incomplete: for instance a single volume on the wrong hash only was
not corrected.  Further there was some rather unfortunately code which
would under certain circumstances stamp the last volume at various
places across the file.

This checkin removes all the old code and replaces it with a
'systematic' fix.  During the last scan across all the volumes, all
four of the hash chains are rebuild from the ground up.  We can then
get rid of the outer 'Mung Until Now Good' iteration and further we
benefit from a linear run time.

Tested by building several different forms of broken-ness in all three
chains and then fixing it.

Now with improved logging and correct non insertion of nonexistant elements
and clean compiled with extra warning.

Change-Id: Id39d806c9c90f67c6967bd99460ba9842a043158
Reviewed-on: http://gerrit.openafs.org/1991
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>