Simon Wilkinson [Fri, 1 Mar 2013 11:22:26 +0000]
kauth: Don't overflow cellinfo hostAddrs array
The hostaddrs array has MAXHOSTSPERCELL (8) available elements.
The ubik connections list has MAXSERVERS (20) elements - when copying
from the ubik list into the cellinfo hostaddrs list, be careful not
to overflow it.
Caught by coverity (#985577)
Change-Id: Ie51cb939a6e3381a285787ad125342ca7a9e7cbb
Reviewed-on: http://gerrit.openafs.org/9323
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Simon Wilkinson [Fri, 1 Mar 2013 11:09:04 +0000]
bucoord: Remove theoretical overflow of ubik array
The ubik connections array is NULL terminated, so we have to
ensure that there is enough space for the trailing NULL. As the
array is MAXSERVERS elements long, this means that we can only
store MAXSERVERS-1 connections in it.
This problem will never be encountered by the correct code, as
the number of hosts returned from afsconf_Open is capped at
MAXHOSTSPERCELL (currently 8). MAXSERVERS is currently 20. However,
fix the bug in case we increase MAXHOSTSPERCELL at some point in
the future.
Caught by coverity (#985576)
Change-Id: Icd3f4afe929cbf05522e44132f055a3955c4d23c
Reviewed-on: http://gerrit.openafs.org/9322
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Simon Wilkinson [Fri, 1 Mar 2013 10:54:07 +0000]
Unix CM: Fix stray semicolon
Commit
d2437d02a6f59d972dd0690f7eb1c46cf7cc4b85 introduced a
stray semicolon in the osidnlc code. Fix it.
Caught by coverity (#989030)
Change-Id: I1f68b6149bb4325995c96d8599c45565c4979f16
Reviewed-on: http://gerrit.openafs.org/9321
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Simon Wilkinson [Fri, 1 Mar 2013 10:52:32 +0000]
xstat: Add the residency RPC to the list of fs ops
Include the ResidencyRpc in the list of fs operation numbers that
can be display by xstat_cm_test.
Caught by coverity (#989029)
Change-Id: Ib8059fe53e5254d212722db59c05a0f0822883e2
Reviewed-on: http://gerrit.openafs.org/9320
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Marc Dionne [Sat, 2 Mar 2013 15:06:47 +0000]
crypto: make krb5_enomem a static inline function
With the recent update to the imported heimdal code, krb5_enomem
is used in a few places as a simple statement that doesn't make
use of the value. With the current definition, this triggers
compiler warnings because the statement has no effect.
Replace the definition with a static inline function that returns
the expected value.
Change-Id: I799022b69a43ab635560a1a5ea8f67f0a8f7230a
Reviewed-on: http://gerrit.openafs.org/9335
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Jeffrey Altman [Thu, 28 Feb 2013 22:11:57 +0000]
Windows: afslogon !KA_USERAUTH_AUTHENT_LOGON
Patchset
305133cde60fec7fb1050caf60a4319cdcf88a27 halted the practice
of calling ka_UserAuthenticateGeneral2() with the alternate smbName.
It should have halted the practice of passing flag
KA_USERAUTH_AUTHENT_LOGON which indicates that the smbName parameter
has been provided. Passing KA_USERAUTH_AUTHENT_LOGON without the smbName
field results in a KTC_INVAL error.
This error only impacts sites that still use kaserver or Kerberos v4 for
authentication.
Change-Id: I9eb7adc4fdb7b3ffa0aedca377e2f91bc01b30ea
Reviewed-on: http://gerrit.openafs.org/9318
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 28 Feb 2013 22:07:12 +0000]
libadmin: Don't free garbage
Make sure that we initialise the nbulkentries structure to 0 before
we start work, so that if the failure handler is called, it doesn't
try to free garbage.
Caught by coverity (#985980)
Change-Id: If55faadd44f7bbc80abbdcd7842603d586db7581
Reviewed-on: http://gerrit.openafs.org/9317
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 28 Feb 2013 17:14:20 +0000]
afsmonitor: Fix multiple NUM_CM_STAT_ENTRIES overflows
If an array is n elements long, accessing element array[n] is an
overflow. Fix various places where we apply loop bounds incorrectly
using the NUM_CM_STAT_ENTRIES constant.
Caught by coverity (#985571, #985573)
Change-Id: I24a53e8044d3d5d39d070909400329a82f22b6b9
Reviewed-on: http://gerrit.openafs.org/9316
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 28 Feb 2013 17:14:20 +0000]
afsmonitor: Fix multiple NUM_FS_STAT_ENTRIES overflows
If an array is n elements long, accessing element array[n] is an
overflow. Fix various places where we apply loop bounds incorrectly
using the NUM_FS_STAT_ENTRIES constant.
Caught by coverity (#985570, #985571, #985572)
Change-Id: I8a28f06059771f91415ebc989714929cfd09f296
Reviewed-on: http://gerrit.openafs.org/9315
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 28 Feb 2013 17:07:31 +0000]
afsmonitor: Add missing items to fsOpNames array
The Lookup and Residency fs stats counters were missing from the
fsOpNames array. Add them in - Lookup has been missing since the
IBM release, Residency was missed when the MR-AFS code was merged.
This is still rather fragile, as there's no guarantee that
AFS_STATS_NUM_FS_RPC_OPS matches the number of elements in this
array. However, this is now correct until someone breaks it again...
Caught by coverity (#985569)
Change-Id: I22496050d5e786276a6646aa763d036449a3660d
Reviewed-on: http://gerrit.openafs.org/9314
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 28 Feb 2013 17:05:29 +0000]
Unix CM: Update AFS_STATS_NUM_FS_RPC_OPS
There are actually 30 elements in the AFS_STATS_FS array. When the
ResidencyRpcs counter was added, the total number of operations
wasn't updated.
Fix this so that it is correct, although this still remains rather
fragile.
Change-Id: I92a0d2bf3741bc7aaeae837d6dcbcd30616e17ae
Reviewed-on: http://gerrit.openafs.org/9313
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 28 Feb 2013 15:26:15 +0000]
Unix CM: Fix hash table overflow in dnlc code
In GetMeAnEntry, we can end up overflowing the nameHash array by one
element if the stars are particularly badly aligned.
nameptr is a static across function calls, so nameptr and j are not
equal. If nameptr is increment to NHSIZE in the same loop iteration
as j reaches NHSIZE + 2, the loop will terminate. We'll then
lookup nameHash[NHSIZE], which is 1 element passed the end of the
array.
Add an if statement which loops nameptr outside the loop (in the
same way as the if statement in the loop)
Caught by coverity (#985568)
Change-Id: I47075f363fad10e8c19276359699566755779cca
Reviewed-on: http://gerrit.openafs.org/9312
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 28 Feb 2013 13:45:00 +0000]
Unix CM: Don't overflow ICL logs array
When checking whether a user supplied index into the ICL logs array
is out of bounds, we need to check whether it is greater or equal
to the maxmimum number of elements. Otherwise we can access one
more than the number of elements in the array.
Caught by coverity (#985567)
Change-Id: Id90f02eae1d5689b9b2c9a82bce0e503941387da
Reviewed-on: http://gerrit.openafs.org/9311
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 28 Feb 2013 12:15:29 +0000]
dumptool: Remove newlines safely
The code currently does
fgets(cmdbuf, ... );
cmdbuf[strlen(cmdbuf - 1)] = '\0';
in order to remove new lines from cmdbuf. Coverity thinks there's
a danger of strlen(cmdbuf) being 0, and thus the strlen being negative.
That shouldn't happen, but if fgets hits EOF midway through a line, we
might get a string that doesn't have a trailing '\n', and end up
removing the wrong character. Tidy this up by checking that the string
isn't 0 length, and that the character we're zapping is a newline.
Caught by coverity (#985430)
Change-Id: I8dae925debdc2473a6a51db021ce843e957a1557
Reviewed-on: http://gerrit.openafs.org/9310
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 28 Feb 2013 10:22:43 +0000]
ptuser: Clear return value from pr_ListMembers
Make sure that lnames is zero'd on entry to pr_ListMembers, so that
an early error return doesn't also return garbage.
Change-Id: I78c35f0c18d9c7ec3f638c8e80609ac28d362925
Reviewed-on: http://gerrit.openafs.org/9309
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 28 Feb 2013 10:20:22 +0000]
readgroup: Don't use results if error occurs
If pr_ListMembers returns an error, don't try and use the results
it provides, as they could be garbage.
Caught by coverity (#92119)
Change-Id: Idcfb464953dcdec68cba988d3fb1ab6ddad08340
Reviewed-on: http://gerrit.openafs.org/9308
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Ken Dreyer [Fri, 11 Jan 2013 18:38:58 +0000]
RedHat: fix makesrpm.pl version discovery
We stopped defining the OpenAFS version in AM_INIT_AUTOMAKE a while
back. Use git-version script instead.
Change-Id: I56ef9792cf653921161e177a7c6f143a4b41ace2
Reviewed-on: http://gerrit.openafs.org/8908
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Jeffrey Altman [Wed, 27 Feb 2013 20:21:56 +0000]
Windows: Build libafsauthent.dll against mtafsubik.lib
Instead of building a private copy of the ubik objects, link
against mtafsubik.lib.
Change-Id: Ic72e0ea963ddb870d082f7a3746f978ba785bbbc
Reviewed-on: http://gerrit.openafs.org/9302
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Jeffrey Altman [Wed, 27 Feb 2013 20:19:41 +0000]
Windows: afsio reduce library link list
When linking afsio many of the libraries specified in the EXELIB3
list were unnecessary. The only lib in the list that is required
is libcmd.lib. Rename EXELIB3 to LIBCMD and prune the rest.
Change-Id: I87bf0583f312d7b3dadc5581c08fedaa6b754c77
Reviewed-on: http://gerrit.openafs.org/9301
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Jeffrey Altman [Wed, 27 Feb 2013 20:07:57 +0000]
Windows: Remove RXAFS* from afsrpc.dll
afsrpc.dll is supposed to be the multi-threaded dynamic loadable
version of the RX package. It has also included the RXAFS and
RXAFSCB client functions from src/fsint. Including the RXAFS* is
nice in theory but in practice the afsd_service.exe must link to
afsint.lib anyway in order to obtain access to RXAFSCB_ExecuteRequest()
which is part of the server portion. Linking to both results in
multiple instances of the same symbols in which case afsint.lib
must be linked to first and the dynamic version of the functions
are ignored.
The only other module that used RXAFS* functions from afsrpc.dll
is the adminutil library from the libadmin package. adminutil
doesn't implement the server functions but it can just as easily
link against afsint.lib.
Removing RXAFS* from afsrpc.dll results in a library that only
contains RX, RXSTATS, core xdr and rxkad.
This patchset also fixes some minor bugs:
1. $(UTILOBJS) were not being linked to the library due to
a typo.
2. Always use multi-thread safe versions of afsutil.lib
Change-Id: I5cc6d485a763d5a17735abd35d193fb7b0d280e5
Reviewed-on: http://gerrit.openafs.org/9300
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Jeffrey Altman [Thu, 28 Feb 2013 03:16:33 +0000]
Windows: Move grmutex, etc. to afspthread.dll
afsauthent.dll exported:
pthread_recursive_mutex_lock
pthread_recursive_mutex_unlock
grmutex (DATA)
even though a dedicated afspthread.dll existed and all pthreaded
modules must link to afspthread.dll and not all link to
afsauthent.dll. Move these functions and the global mutex variable
to afspthread.dll to ensure that only one instance of the variable
is present in any binary.
Also remove from src/libafsauthent/NTMakefile the local building
of src/util object files and link to mtafsutil.lib.
Change-Id: I9f8e76165f9c1b1be7ed1a90cdaac03b629d9591
Reviewed-on: http://gerrit.openafs.org/9303
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Wed, 27 Feb 2013 10:34:59 +0000]
ubik: Avoid unlinking garbage
If SDISK_SendFail fails before the pathname to the temporary file
has been constructed, then the failure handler will unlink stack
garbage, with variable results.
Initialise the string, and check to see if it has contents before
calling unlink
Change-Id: I1de898d5f0f0dc608e9c9c62dc66e6b4b9fdc5bf
Reviewed-on: http://gerrit.openafs.org/9299
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Wed, 27 Feb 2013 10:28:05 +0000]
Unix CM: Don't free cell, then release lock on it
If afs_NewCell fails, then we can end up releasing a lock on a
section of memory that we have already freed. As this only happens
if the memory we're operating on is newly allocated and not yet
visible to anyone else, it is safe to release the lock before
starting to tidy things up.
Caught by coverity (#986054)
Change-Id: Ie8651c61790d57a9fd7bbbafcaf78e37b8222bae
Reviewed-on: http://gerrit.openafs.org/9298
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Wed, 27 Feb 2013 10:11:21 +0000]
libafscp: Can't unlock something we've freed
When we call _StatCleanup on a stored statent structure, it
deletes the mutex, and frees the structure itself. This means it
can't be called with a locked structure as the mutex deletion
will fail, and then we'll try to reference freed memory when we
later unlock that mutex.
Fix this by unlocking the mutex before calling _StatCleanup. This
is safe because the only reference to the structure visible to other
threads must have been deleted by the time we reach this point.
Caught by coverity (#986058, #986059)
Change-Id: I346d4c8a7cd478db044af919662c1cf1c093e205
Reviewed-on: http://gerrit.openafs.org/9297
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Wed, 27 Feb 2013 09:23:07 +0000]
pt_util: Protect against corrupt input files
If we have an input file which contains a group membership line
(with a leading space) before any group definitions occur, pt_util
would use stack garbage as the group to create these members in.
Avoid this by requiring the presence of a group line before any
membership lines.
Caught by coverity (#92180, #986000, #92248)
Change-Id: I536f089d67041dbf90f35b6dfeed5ba3303318a8
Reviewed-on: http://gerrit.openafs.org/9296
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Wed, 27 Feb 2013 09:21:30 +0000]
pt_util: Catch sscanf failures
If there isn't sufficient data in the input line to satisfy sscanf,
fail with an error, rather than continuing with potentially corrupt
data.
Change-Id: I5f963b5623176ac7631693b093d23cf9f0405edc
Reviewed-on: http://gerrit.openafs.org/9295
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 26 Feb 2013 22:40:04 +0000]
kauth: Fix overflow when writing ticket file
krb_write_ticket_file uses a fixed length buffer to store the name
of the ticket file, but copies into this from an environment variable.
Remove the fixed length buffer, and use a mixture of the variable
itself, and dynamically allocated strings.
Caught by coverity (#985909)
Change-Id: I997fd1812c45e730db39497a27a5e168f102fee5
Reviewed-on: http://gerrit.openafs.org/9294
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 26 Feb 2013 22:31:49 +0000]
auth: Refactor afsconf_Open failure handler
Refactor the code which returns a failure from afsconf_Open into
a single section, rather than having multiple copies through out
the routine.
Change-Id: I70b3fec98321bf89e6d59055545d5d4193026d28
Reviewed-on: http://gerrit.openafs.org/9293
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 26 Feb 2013 22:27:25 +0000]
auth: Fix buffer overflow in afsconf_Open
If we fallback to the .AFSCONF file in the user's homedirectory,
the results of getenv("HOME") are copied into a fixed length string,
without checking for overflows.
Instead of risking this, just use asprintf to dynamically construct
a string, and free it when we are done.
Caught by coverity (#985905)
Change-Id: Id8769ede841165d3ff3104143e55767d550d6f87
Reviewed-on: http://gerrit.openafs.org/9292
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 26 Feb 2013 21:30:20 +0000]
bos_util: Fix buffer overflow
Get rid of a buffer overflow in the bos_util utility, by just
printing the key from the 'tbuffer' string, rather than copying
it into 'x' which is too small for it.
Change-Id: Ia364fb63edb9e40a887e77aad833689a99b4ea7c
Reviewed-on: http://gerrit.openafs.org/9291
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 26 Feb 2013 21:28:52 +0000]
volser: Fix bad readlink usage
readlink fills the buffer passed to it with a non-terminated string.
It can legitimately fill the whole of this buffer. So, if we require
a string to be NUL terminated, we must give readlink one less than
the string length so that the termination character can be safely
appended.
Caught by coverity (#985611)
Change-Id: Ie6c651a9c0fd94d83bd05395204341d71e353146
Reviewed-on: http://gerrit.openafs.org/9290
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 26 Feb 2013 20:52:47 +0000]
afsmonitor: Use NULL, rather than (struct foo *)0
Change-Id: Ib011da471465dae056d47f5bbaad5a27b5c85966
Reviewed-on: http://gerrit.openafs.org/9285
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 26 Feb 2013 20:51:34 +0000]
afsmonitor: Check correct variable is non-NULL
Before freeing curr_fsData, check that it is non-NULL, rather than
checking prev_fsData in error.
Caught by coverity (#985289)
Change-Id: I8fb74ce0c4e447de65924f2afb6075213d839760
Reviewed-on: http://gerrit.openafs.org/9284
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 26 Feb 2013 12:10:17 +0000]
bosserver: Return error if key is bad
If a key is bad, have SBOZO_ListKeys return an error, rather than
silently ignoring the result from ka_KeyCheckSum.
Caught by coverity (#988413)
Change-Id: Ifacc9bac654d2632bd31731995795b786d485327
Reviewed-on: http://gerrit.openafs.org/9270
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Nickolai Zeldovich [Wed, 27 Feb 2013 10:08:40 +0000]
ptserver/testpt.c: remove dead code in ListUsedIds
A part of the current ListUsedIds code is:
range = abs(startId - maxId);
if (range < 0)
range = -range;
The only way abs() could return a negative value would be if its
argument was INT_MIN (-
2147483648) to begin with, because -INT_MIN
cannot be represented in two's complement. However, calling
abs(INT_MIN) is undefined behavior in C [see C99 7.20.6.1], and for
that matter, so would be computing -range (-INT_MIN) in that case,
so we could still be left with a negative range value.
Luckily, (startId - maxId) can never be INT_MIN. If startId < 0,
then maxId <= startId, so in the worst case, when maxId = INT_MIN
and startId = -1, (startId-maxId)=INT_MAX. If startId >= 0, then
maxId >= startId, so in the worst case, when maxId = INT_MAX and
startId = 0, (startId-maxId)=-INT_MAX=INT_MIN+1.
This patch removes the useless if statement.
Change-Id: Ia754fcf3e59354afb40dbbbb95623e27285a5f82
Reviewed-on: http://gerrit.openafs.org/9289
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Simon Wilkinson [Tue, 26 Feb 2013 12:38:59 +0000]
volser: Catch EOFs when reading dumps
When reading a standard tag, make sure and catch an EOF error
from iod_getc. Otherwise we'll end up trying to parse 0xFF as a
tag length.
Caught by coverity (#985603)
Change-Id: Iae0b1bf71ed495b4f454975a1bfe3aef8fca3e9e
Reviewed-on: http://gerrit.openafs.org/9275
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Simon Wilkinson [Tue, 26 Feb 2013 12:30:00 +0000]
ptserver: Zero ubik header before writing to it
When using pt_util's ubik shim, if we're creating a new ubik label
make sure to zero the whole structure before writing it out to disk.
Otherwise we get a shorts worth of stack garbage in the resulting
file.
Caught by coverity (#986010)
Change-Id: I0abb8b7968d4f25c97dc0927d63dd01099b829b7
Reviewed-on: http://gerrit.openafs.org/9274
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Mark Vitale [Tue, 26 Feb 2013 14:31:43 +0000]
vos: Unrecognized or ambiguous switch '-c'
The documented abbreviation '-c' for '-cell' no longer works since
the -config option was added. Add a parm alias '-c' to restore
compatibility with previous syntax.
Change-Id: Ie98e470d204ea2186a95668bba2581cf3e88f729
Reviewed-on: http://gerrit.openafs.org/9276
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 26 Feb 2013 12:26:36 +0000]
ptserver: Rename ubik.c as ptubik.c
Coverity gets confused between ubik/ubik.c and ptserver/ubik.c,
and produces a load of false positives. Rename the ptserver ubik
shim (which is only used by pt_util) in order to reduce this
confusion.
Change-Id: Ida606fccebcb4edfed706405424ff3ee4858020f
Reviewed-on: http://gerrit.openafs.org/9273
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 26 Feb 2013 12:06:15 +0000]
bosserver: Catch failures to create daemon thread
If we can't create the bozo daemon thread, then don't keep going
regardless. Just warn the user and exit.
Caught by coverity (#988414)
Change-Id: I46445b1744f7c3c944e917b33a6fc6fb669df002
Reviewed-on: http://gerrit.openafs.org/9269
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 26 Feb 2013 11:59:56 +0000]
libadmin: Catch VL_GetNewVolumeId failures
If ubik_VL_GetVolumeId fails in the vos ProcessEntries routine,
report the failure and give up, rather than continuing with a
0 maxVolid
Caught by coverity (#988417)
Change-Id: I281e1c518813f9d7fab46e4f87a091fac6b3a754
Reviewed-on: http://gerrit.openafs.org/9268
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Chas Williams (CONTRACTOR) [Mon, 11 Feb 2013 22:05:34 +0000]
afs: removing trailing semicolons
Remove spurious trailing semicolons from macros.
Change-Id: I26550a4ca8e8fe5232dad4cdb2c42a5f44a28f32
Reviewed-on: http://gerrit.openafs.org/9092
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Simon Wilkinson [Tue, 26 Feb 2013 12:21:59 +0000]
ubik: Zero header before writing to disk
The ubik disk header contains a padding field, which is never
zeroed before being written out to disk. This means that there is
a shorts worth of stack garbage in every ubik label!
Just zero the whole structure with memset before we populate it.
Caught by coverity (#986011)
Change-Id: Ib9f8b45111a83178372409c717c30ccb6a1044f4
Reviewed-on: http://gerrit.openafs.org/9272
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Simon Wilkinson [Tue, 26 Feb 2013 12:17:29 +0000]
viced: Don't write out garbage when extending file
When we extend a file, we write a single byte of data to it - tlen
is used as a source for this single byte. However, in the current
code, tlen is used uninitialised. Set it to 0, so we don't write a
byte of stack garbage.
Caught by coverity (#986015)
Change-Id: I11480a5ba0a5544437e18a6b314ff98ba6256df0
Reviewed-on: http://gerrit.openafs.org/9271
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Simon Wilkinson [Tue, 26 Feb 2013 11:55:32 +0000]
fs: Catch pioctl failure in mkmount
If the VIOC_FILE_CELL_NAME pioctl fails in fs mkmount, return an
error to the caller, instead of ploughing on with potentially bad
data.
Caught by coverity (#988418)
Change-Id: I68df5dd26d955db860dd016c76109f7d262bad17
Reviewed-on: http://gerrit.openafs.org/9267
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Simon Wilkinson [Tue, 26 Feb 2013 11:52:01 +0000]
libafscp: NULL return value not pointer
When afscp_FindCallBack sets its return-by-reference value to NULL,
it should do so to the value itself, not the pointer to it.
Caught by coverity (#988419)
Change-Id: I6b227465d7aa945d871b2db1cc4d1357cae493d3
Reviewed-on: http://gerrit.openafs.org/9266
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Simon Wilkinson [Mon, 25 Feb 2013 23:13:47 +0000]
Add krb5_enomem for config parser & kernel crypto
The imported code form Heimdal that forms our config file parser
and kernel rfc3961 library now makes use of krb5_enomem. Provide
an implementation so we build again ...
Change-Id: Ie7162d73aa97e6f7594c0e7c68ed6939f57ae884
Reviewed-on: http://gerrit.openafs.org/9265
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Heimdal Developers [Mon, 25 Feb 2013 23:00:46 +0000]
Import of code from heimdal
This commit updates the code imported from heimdal to
66f4c441e9e0de68fbcf81763642779ac5c33631 (git2svn-syncpoint-master-199-g66f4c44)
Upstream changes are:
Kumar Thangavelu (1):
unning "kinit --fast-armor-cache=xxx" against a Win2K3 domain resulted in a crash with the attached backtrace. FAST is not supported with RC4 keys which are used in Win2K3. The code already handles this but the error code is not propagated up the stack.
Love Hornquist Astrand (1):
add socket_set_nonblocking
Roland C. Dowdeswell (3):
Optimise _krb5_n_fold() a bit.
Use krb5_enomem() more consistently in lib/krb5.
Further improvements to lib/krb5/n-fold.c:
Change-Id: I3b652e3ea3c84a939c4988bc8c24b3edee06446f
Reviewed-on: http://gerrit.openafs.org/9264
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: Derrick Brashear <shadow@your-file-system.com>
Simon Wilkinson [Thu, 21 Feb 2013 16:18:26 +0000]
crypto: _afscrypto_strdup must copy trailing NUL
The _afscrypto_strdup helper function was failing to alloc enough
space for the string's trailing NUL, and to copy that NUL over.
Caught by coverity (#985580)
Change-Id: I61c9a96275a79682a9521846ab52615ea5bc061d
Reviewed-on: http://gerrit.openafs.org/9263
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Simon Wilkinson [Wed, 20 Feb 2013 14:54:55 +0000]
volser: Make it clear what's copied from partList
XVolListPartitions uses partList to maintain a list of partition
IDs - it does not use the partFlags field. Make it clear when we
populate the partEntries field that we are only copying the
partition list.
Caught by coverity (#986030)
Change-Id: I8c46ee5c220f0cb2b65943ad5faa80877ca46685
Reviewed-on: http://gerrit.openafs.org/9262
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Simon Wilkinson [Mon, 25 Feb 2013 10:32:22 +0000]
bucoord: Remove dead assignments in cmd init
Don't assign command syntax objects to 'ts' if we're not going
to add any parameters to them
Change-Id: I69f6e090fc115ab213c1f20dc46da81f2878e0a3
Reviewed-on: http://gerrit.openafs.org/9260
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Mon, 25 Feb 2013 10:28:31 +0000]
butc: Remove dead initialisation
The 'bytesread' variable is set by all code paths, so don't bother
assigning a default value each time we pass through the loop
Caught by clang-analyzer
Change-Id: I8b79bc888ba23e2bcfa9befb5bf034db8f3ca3f8
Reviewed-on: http://gerrit.openafs.org/9259
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Mon, 25 Feb 2013 10:26:33 +0000]
volser: Don't catch errors in cleanup
We can't do anything if cleaning up the clone volume fails, so
don't bother storing the error code.
Caught by clang-analyzer
Change-Id: I5249dbad9a1bb732aba73e7a09f74c83e606b45d
Reviewed-on: http://gerrit.openafs.org/9258
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Mon, 25 Feb 2013 10:24:53 +0000]
bucoord: Remove dead initialisation
matchLength is set regardless of what the separator is, so we don't need
to provide a default value.
Caught by clang-analyzer
Change-Id: Iac8fe8db8832cf2b3347ec1bdacc7245bddf542b
Reviewed-on: http://gerrit.openafs.org/9257
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Mon, 25 Feb 2013 10:15:10 +0000]
butc: Remove dead initialisation
code is set to a real value on every code path, so don't bother
initialising it to 0 midway through the function.
Change-Id: I334286f2ae854c57df781af8df78e5a1bf8e9b2b
Reviewed-on: http://gerrit.openafs.org/9256
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Sun, 24 Feb 2013 13:05:13 +0000]
volser: Remove redundant success flag
In UV_RestoreVolume2, there is a success flag whose only use is ...
success = 0
[ ... ]
success = 1
if (success) {
[ ... ]
}
It's pointless, so just remove it, and one clang warning
Caught by clang-analyzer
Change-Id: I7d57531c4dfb8955b813d534ad3b72b182fdbc76
Reviewed-on: http://gerrit.openafs.org/9255
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Simon Wilkinson [Sun, 24 Feb 2013 13:02:19 +0000]
budb: Don't double initialise iterator
The blockaddr iterator is initialised as part of the for loop.
Don't also initialise it immediately before.
Caught by clang-analyzer
Change-Id: I97e7ced15fe204b3b2d797abbdce8b3f9a2b0c8d
Reviewed-on: http://gerrit.openafs.org/9253
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Simon Wilkinson [Sun, 24 Feb 2013 12:53:59 +0000]
budb: Store dumper information correctly
Change
f498c18a6f7300eb89ca3b9d9b85c4d461fa8474 attempted to fix
a problem with using an inappropriate function to copy the
ktc_principal value 'principal' into the d.dumper structure element.
Originally the code read:
principal_hton(&principal, &d.dumper)
which copies the 'host' principal principal into the 'net' structure
d.dumper. However, this was changed to
principal = d.dumper
Which populates 'principal' with whatever garbage is in the d.dumper
structure.
Fix this so that the assignment is done the right way around.
Caught by clang-analyzer
Change-Id: Id9865a36b5a9351d013c695ed301b627ddc4a915
Reviewed-on: http://gerrit.openafs.org/9252
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Simon Wilkinson [Sun, 24 Feb 2013 12:43:27 +0000]
budb: Simplify scanHashTableBlock
We don't need to maintain two copies (entryAddr and nextEntryAddr)
of the entry address - rework the while loop so we just use one,
and make clang a little happier
Caught by clang-analyzer
Change-Id: I6f5d76e114ad09a4fd3fc36b4d64f63daa9e1e78
Reviewed-on: http://gerrit.openafs.org/9251
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Simon Wilkinson [Sun, 24 Feb 2013 12:36:02 +0000]
viced: Unused sentinel in h_stateVerifyUuuidHash
The 'found' sentinel in h_stateVerifyUuidHash is unused, because
as soon as we set it, we jump out to the 'done' label. Simplify the
function's logic, and remove a static analysis warning, by just
removing the variable.
Caught by clang-analyzer
Change-Id: I02e5ccf857f5d84cd24975b7a1b9d516624ecd64
Reviewed-on: http://gerrit.openafs.org/9250
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Simon Wilkinson [Sun, 24 Feb 2013 10:48:14 +0000]
bucoord: Remove dead initialisation
offset is simply used as a copy of nextOffset for the GetText
function call. We don't need to initialise it to 0 at the start of
the loop (and arguably, as it is passed to the function by value,
we could just remove the copy entirely)
Caught by clang-analyzer
Change-Id: I137ea3ba1ff44d94b90287d9735db69d6ff8717d
Reviewed-on: http://gerrit.openafs.org/9249
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Simon Wilkinson [Sun, 24 Feb 2013 10:45:41 +0000]
butc: Remove dead assignment
We never use the value of mvFlag once the string has been restored,
so don't bother reseting it.
Caught by clang-analyzer
Change-Id: I12db6957c9b8ec3bb9c43f10d9e9754d4afa3ed7
Reviewed-on: http://gerrit.openafs.org/9248
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Simon Wilkinson [Sun, 24 Feb 2013 10:43:52 +0000]
budb: Fail if afsconf_GetExtendedCellInfo does
Rather than silently ignoring the failure of
afsconf_GetExtendedCellInfo, and then using garbage cell
configuration, just fail to start if afsconf can't parse the
config directory.
Change-Id: Ib3d26bc67844de10f7eb8c2ef555c5e607e4bf61
Reviewed-on: http://gerrit.openafs.org/9247
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Simon Wilkinson [Sun, 24 Feb 2013 10:42:00 +0000]
volser: Remove dead assignment
Don't initialise code immediately before we assign a real value
to it various UV_ functions
Caught by clang-analyzer
Change-Id: I91d9300715d44fafd73b1a61be548589468e3209
Reviewed-on: http://gerrit.openafs.org/9246
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Simon Wilkinson [Sun, 24 Feb 2013 10:39:53 +0000]
butc: Catch failures to start keep alive thread
If we can't start the keep alive thread, in either the LWP or
pthread versions of a code, report an error and exit instead of
carrying on regardless.
Caught by clang-analyzer
Change-Id: I0a25a236aadeedf10d3c0c129d716b1397c9a4e3
Reviewed-on: http://gerrit.openafs.org/9245
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Simon Wilkinson [Sun, 24 Feb 2013 10:36:57 +0000]
butc: Remove dead loop pointer allocations
All of these *Ptr values are reset upon each iteration of the
while loop, so we don't need to NULL them immediately before
we go around again.
Caught by clang-analyzer
Change-Id: Iaa5ff6c7b154072e23eae272031919b424568eff
Reviewed-on: http://gerrit.openafs.org/9244
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Jeffrey Altman [Mon, 25 Feb 2013 05:17:46 +0000]
Windows: Test NameArrayReferenceCount before deletion
In commit
c753d398f2005c886932f20b49af15efc489a829 the
AFSDirectoryCB.DirOpenReferenceCount was split and the
NameArrayReferenceCount field was added. However, it failed to modify all
of the DirOpenReferenceCount checks prior to calling AFSDeleteDirEntry()
to include a check on the NameArrayReferenceCount. This patchset corrects
that oversight.
Change-Id: I8db1a68e5240088bcfeb226bd1eafac0c83a0b69
Reviewed-on: http://gerrit.openafs.org/9254
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 19 Feb 2013 15:25:12 +0000]
kauth: realm can't be NULL when calling CellToRealm
Despite what the static analyzer thinks, ka_CellToRealm can't be
called with a NULL realm. Just add an assert to close down that
code path, and stop it from producing an error.
Change-Id: Ifc8cf7e5dca5ae29eaaa91c5b238a97197d89ee3
Reviewed-on: http://gerrit.openafs.org/9174
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Jeffrey Altman [Sun, 24 Feb 2013 19:01:28 +0000]
Windows: no side effects from AFSDbgLogMsg calls
Do not perform assignments or call side-effect resulting functions
as parameters to AFSDbgLogMsg.
Change-Id: I76eca3a82377543f4148d03af51a07886127b385
Reviewed-on: http://gerrit.openafs.org/9242
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Fri, 22 Feb 2013 10:23:43 +0000]
viced: Allow GetCapabilities to return an error
At the moment, the GetCapabilities RPC handler ignors errors from
CallPreamble or CallPostamble. Instead of silently swallowing these,
and potentially reutnring a bogus capabilities structure, make
it possible for the RPC to return failure to the caller.
Caught by clang-analyzer
Change-Id: Ic36e59e8cce8be4920f041a86d5636d54668d887
Reviewed-on: http://gerrit.openafs.org/9241
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Fri, 22 Feb 2013 10:20:58 +0000]
viced: Catch GetCellInfo failure
If GetCellInfo returns a non-zero result, catch the error, rather
than just carrying on regardless.
Caught by clang-analyzer
Change-Id: I6b9ca91c8cea2ff0d68873913abdc0daadcc0e27
Reviewed-on: http://gerrit.openafs.org/9240
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Fri, 22 Feb 2013 10:16:10 +0000]
viced: Don't store rc from IH_DEC on error path
If CopyOnWrite has already failed, and is taking the volume offline
for salvage we can't (and don't) do anything with further errors from
IH_DEC. Instead of assigning these to 'rc', just ignore them.
Caught by clang-analyzer
Change-Id: I7bcd82f124740e3ca3d11cb2b079aa7ea5751cf9
Reviewed-on: http://gerrit.openafs.org/9239
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Fri, 22 Feb 2013 10:09:39 +0000]
scout: Fix a lot of dead assignments
In lots of places scout takes the return value of a graphics
function, then decides it doesn't actually care about the result.
Get rid of the assignments, as they provide a false sense of
security.
Caught by clang-analyzer
Change-Id: I1ea8514b969777f1276b4e8f8ab946a4d36a870c
Reviewed-on: http://gerrit.openafs.org/9238
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Fri, 22 Feb 2013 10:35:48 +0000]
gtx: Return failure if gtx_Init can't start thread
If LWP_CreateProcess fails in gtx_Init return NULL, rather than
silently swallowing the failure.
Caught by clang-analyzer
Change-Id: I5db5667f9dae3f405e88cf9c57e6b8a069ea28a3
Reviewed-on: http://gerrit.openafs.org/9236
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Fri, 22 Feb 2013 10:30:56 +0000]
afsmonitor: Allow CBSTATS collection to work
The switch which selects the collection number was missing a
'break', so selecting the CBSTATS collection would always fall
through to the default, error, case.
Caught by clang-analyzer
Change-Id: I354873d711c5f49ddad51f1b9fb332af91a6d13a
Reviewed-on: http://gerrit.openafs.org/9235
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 21 Feb 2013 21:57:56 +0000]
bosserver: Don't store result when renaming core file
The bosserver doesn't do anything if the core file rename fails, so
don't bother storing the result code.
Caught by clang-analyzer
Change-Id: I9b1b7d77404b0fd560c7735646e5afe1fbcc0752
Reviewed-on: http://gerrit.openafs.org/9232
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 21 Feb 2013 21:44:43 +0000]
bosserver: Remove dead assignment
In the Restart RPC handler, don't assign a value to code
immediately before we use it to hold the return value of
bozo_WaitStatus.
Caught by clang-analyzer
Change-Id: I0781c57c87088cb3ba6170ca1e5c8d5053cf9001
Reviewed-on: http://gerrit.openafs.org/9231
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 21 Feb 2013 20:53:02 +0000]
bosserver: Remove dead assignment in SaveOldFiles
We don't care about whether the renames succeed in SaveOldFiles,
so don't bother assigning their results to a variable
Caught by clang-analyzer
Change-Id: I0605fc71d243ef0f587706f9f3856aa4d722fb82
Reviewed-on: http://gerrit.openafs.org/9207
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 21 Feb 2013 20:50:07 +0000]
Unix CM: Remove dead assignment in readdir
len is zeroed at the start of the next block, so don't bother assigning
tlen to it if we're not going to do anything with it.
Caught by clang-analyzer
Change-Id: Ie1cd5a4d9dd96920018f054b6edfc18c569c9807
Reviewed-on: http://gerrit.openafs.org/9206
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 21 Feb 2013 20:36:19 +0000]
libadmin: Fix a lot of dead assignments in vsprocs
Tidy up a lot of places where we initialise a variable, then
immediately assign a proper value to it, or store a return value
that we don't actually care about.
Caught by clang-analyzer
Change-Id: Icf0ec713dac6f2c4f0a60e8ead52a8d3e19381f0
Reviewed-on: http://gerrit.openafs.org/9205
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 21 Feb 2013 20:12:35 +0000]
gtx: Remove pointless assignments from gtxtest
Remove assignments to 'code' when we're not going to pay attention
to them.
Caught by clang-analyzer
Change-Id: Ib2f8c20c0bc741d0bb1b8ed4fdb46ea61511fc95
Reviewed-on: http://gerrit.openafs.org/9204
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Thu, 21 Feb 2013 19:34:47 +0000]
Unix CM: Catch ICL initialisation failures
If afs_icl_CreateLog fails, don't still call afS_icl_CreateSet.
If afs_icl_CreateSetWithFlags fails, don't ignore its error code.
Caught by clang-analyzer
Change-Id: I245f4391bbbf183492e8c13fb8f091b339cea80a
Reviewed-on: http://gerrit.openafs.org/9203
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 12 Feb 2013 13:04:01 +0000]
rx: Fix wrong loop iterator in rx_clearProcessRPCStats
Fix the use of an incorrect variable as loop iterator which would have
resulted in a crash.
Caught by clang analyzer.
Change-Id: I785d06b9be0915bc540c37b43d1001a562a7cde4
Reviewed-on: http://gerrit.openafs.org/9202
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Wed, 20 Feb 2013 11:18:28 +0000]
volser: Fix a couple of assigned but not read errors
Fix a couple more errors where we assign to a variable, but never
read the result back out.
Caught by clang-analyzer
Change-Id: I78f8f1403d166c4231b0abdb607de77e9ed62a27
Reviewed-on: http://gerrit.openafs.org/9201
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Wed, 20 Feb 2013 11:17:41 +0000]
volser: Don't assign code when we don't care
When we're cleaning up temporary volumes, we don't care whether
it succeeds or not. Don't assign code to the results of these
volume deletions, only to then discard it.
Caught by clang-analyzer
Change-Id: I81583cc82e78db38de8aad92c7c7d0c2f44eb33d
Reviewed-on: http://gerrit.openafs.org/9200
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Wed, 20 Feb 2013 11:16:25 +0000]
volser: Don't NULL conn right before assigning it
Don't do
conn = NULL;
conn = rx_newConnection();
and similar, equally pointless things.
Caught by clang-analyzer
Change-Id: I54d9ccd9f3910624b3289ce067a27622e29e4a34
Reviewed-on: http://gerrit.openafs.org/9199
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 19 Feb 2013 17:25:46 +0000]
fs: Remove redundant variable assignments
Remove a number of redundant variable assignments that clang warns
about.
Caught by clang-analyzer
Change-Id: I248e0e3a9f9241084436604532424d6e4b900e31
Reviewed-on: http://gerrit.openafs.org/9194
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 19 Feb 2013 17:22:08 +0000]
fs: Free parent_dir later in lsmount and flushmount
If lsmount or flushmount encounter an error, then they may include
the contents of parent_dir in their error message. However, in both
cases, this was freed a couple of lines earlier.
Just move the free() later, so that the contents of this variable
are still available.
Caught by clang-analyzer
Change-Id: Ideba52b7ba98f034baf923194007239a6cf0221f
Reviewed-on: http://gerrit.openafs.org/9193
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 19 Feb 2013 17:19:53 +0000]
up: Notice errors on both file handles
Report errors on both filehandles in up's Copy routine, rather
than just on the second one that we close.
Caught by clang-analyzer
Change-Id: Ia3aa9be91ccfca2993a4f27c291332e0b0d350f5
Reviewed-on: http://gerrit.openafs.org/9192
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 19 Feb 2013 17:18:13 +0000]
fstrace: Remove redundant variable assignment
Don't reset the value of 'code' when nothing else references it.
Caught by clang-analyzer
Change-Id: Ifd361ed6eb8c6b8740466f6c1a337669160874f4
Reviewed-on: http://gerrit.openafs.org/9191
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 19 Feb 2013 17:15:42 +0000]
fstrace: Avoid accessing icl log after zapping it
The for loop in icl_EnumerateLogs looks up the next pointer in the
current entry after zapping it. Depending on reference counts, this
may result in us looking up freed memory.
Take a copy of the next point before zapping the current entry, just
in case.
Caught by clang-analyzer
Change-Id: If38f0af2b01c5b8ea00e68e4432c6ad5517578c8
Reviewed-on: http://gerrit.openafs.org/9190
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 19 Feb 2013 16:56:38 +0000]
xstat: Ignore return value from xstat_*_Cleanup
We're about to exit anyway, so we don't care whether Cleanup
succeeds or not
Caught by clang-analyzer
Change-Id: I6350d60e6a5d29b8aaa272a54cf9ead47fdb5fad
Reviewed-on: http://gerrit.openafs.org/9186
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 19 Feb 2013 16:45:39 +0000]
afsmonitor: Ignore return codes as appropriate
When we're not interested in the return value of a function, don't
assign it to a variable.
Caught by clang-analyzer
Change-Id: I5b576f312376780c98c2dbe4f9b85e00d529ddd8
Reviewed-on: http://gerrit.openafs.org/9185
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 19 Feb 2013 16:34:14 +0000]
sys: Flag rmt_Quit as AFS_NORETURN
Help out the static analyzer by telling it that rmt_Quit never returns
Change-Id: I5ee0d2ea444706e68af5a1298fd638e7d0d7f41d
Reviewed-on: http://gerrit.openafs.org/9184
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 19 Feb 2013 16:31:28 +0000]
rxkad: Remove redundant checkCksum initialisation
checkCksum is assigned to by both sides of the if() expression, so
there's no need to initialise it to 0.
Caught by clang-analyzer
Change-Id: Id0e286943e11b6948231577085cdb0ce96bb0b97
Reviewed-on: http://gerrit.openafs.org/9183
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 19 Feb 2013 16:15:29 +0000]
ubik: Don't leak memory if mutex init fails
If we can't initialise the ubik_client mutex, don't leak the
structure when returning an error.
Caught by clang-analyzer
Change-Id: Ib36d2ddf585a31b628e56dce1f33ee859fc835bc
Reviewed-on: http://gerrit.openafs.org/9182
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 19 Feb 2013 16:13:34 +0000]
ubik: Don't record result of select()
We never do anything with the return value from select(), so don't
bother storing it into code.
Caught by clang-analyzer
Change-Id: I6e0352b74f0e90b62ad32a3ef1a9d0173bf307ee
Reviewed-on: http://gerrit.openafs.org/9181
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Fri, 22 Feb 2013 09:51:24 +0000]
kauth: Don't ignore GetExtendedCellInfo failures
Don't ignore a failure from afsconf_GetExtendedCellInfo, as it will
leave buffers that we later read uninitialised.
Caught by clang-analyzer
Change-Id: Ia0c2675a3083385d011fd340f36bf13373f89feb
Reviewed-on: http://gerrit.openafs.org/9180
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Fri, 22 Feb 2013 09:47:57 +0000]
kauth: Catch ka_KeyCheckSum failures
If ka_KeyCheckSum fails, typically because the key being used is bad,
catch the failure rather than just silently ignoring it.
Caught by clang-analyzer
Change-Id: Id51174fdf94356db10961690808670da372bc60e
Reviewed-on: http://gerrit.openafs.org/9179
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Simon Wilkinson [Tue, 19 Feb 2013 15:15:42 +0000]
kauth: Fix some unnecessary variable assignments
Remove various places where a variable is assigned to, and then the
result never read.
Caught by clang-analyzer
Change-Id: Id8b7aeb6c54b7c93093ad44df5a9fe01575f2fbe
Reviewed-on: http://gerrit.openafs.org/9172
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>