Commit Graph

11249 Commits

Author SHA1 Message Date
Jeffrey Altman
9d4f7ca48c 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>
2013-02-28 02:56:15 -08:00
Jeffrey Altman
e2ef4ce23d 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>
2013-02-28 02:54:24 -08:00
Jeffrey Altman
d6cfcf46a8 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>
2013-02-28 02:54:09 -08:00
Simon Wilkinson
44e806431b 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>
2013-02-27 12:45:18 -08:00
Simon Wilkinson
816b0c7673 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>
2013-02-27 12:44:34 -08:00
Simon Wilkinson
ce20f1f151 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>
2013-02-27 12:43:59 -08:00
Simon Wilkinson
12ced70c95 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>
2013-02-27 12:43:08 -08:00
Simon Wilkinson
62a10e063b 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>
2013-02-27 12:42:24 -08:00
Simon Wilkinson
a332ce9d0e 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>
2013-02-27 12:42:01 -08:00
Simon Wilkinson
a5324a6bb6 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>
2013-02-27 12:41:20 -08:00
Simon Wilkinson
41d9ea697b 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>
2013-02-27 12:40:09 -08:00
Simon Wilkinson
debf43714b 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>
2013-02-27 12:39:23 -08:00
Simon Wilkinson
ddc3704335 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>
2013-02-27 12:37:48 -08:00
Simon Wilkinson
caabad9823 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>
2013-02-27 12:36:58 -08:00
Simon Wilkinson
5a61e826fa 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>
2013-02-27 12:36:23 -08:00
Simon Wilkinson
c04de52da4 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>
2013-02-27 12:35:48 -08:00
Nickolai Zeldovich
c705a815a8 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>
2013-02-27 06:55:13 -08:00
Simon Wilkinson
cc703d9562 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>
2013-02-26 17:19:49 -08:00
Simon Wilkinson
96131593b3 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>
2013-02-26 17:19:40 -08:00
Mark Vitale
5d42398298 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>
2013-02-26 14:04:56 -08:00
Simon Wilkinson
daed548f70 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>
2013-02-26 14:00:47 -08:00
Simon Wilkinson
4587ddc130 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>
2013-02-26 13:58:17 -08:00
Simon Wilkinson
8192554e36 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>
2013-02-26 13:57:30 -08:00
Chas Williams (CONTRACTOR)
fb483acf62 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>
2013-02-26 13:55:22 -08:00
Simon Wilkinson
d8fa251a14 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>
2013-02-26 08:49:01 -08:00
Simon Wilkinson
e191cb889c 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>
2013-02-26 08:44:06 -08:00
Simon Wilkinson
3ad7ba106d 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>
2013-02-26 07:22:31 -08:00
Simon Wilkinson
9992948851 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>
2013-02-26 07:22:07 -08:00
Simon Wilkinson
2ddec07598 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>
2013-02-26 03:51:15 -08:00
Heimdal Developers
a9fd0810d2 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>
2013-02-26 03:50:57 -08:00
Simon Wilkinson
961fcc6364 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>
2013-02-26 03:49:58 -08:00
Simon Wilkinson
0060117962 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>
2013-02-26 03:49:44 -08:00
Simon Wilkinson
2d4c9c08ea 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>
2013-02-25 13:29:10 -08:00
Simon Wilkinson
e2f4f60e3e 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>
2013-02-25 13:28:46 -08:00
Simon Wilkinson
5474e1ccd7 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>
2013-02-25 13:28:26 -08:00
Simon Wilkinson
f63f7b90eb 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>
2013-02-25 13:27:24 -08:00
Simon Wilkinson
ec5ec48956 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>
2013-02-25 13:27:00 -08:00
Simon Wilkinson
92011f4e93 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>
2013-02-25 10:42:45 -08:00
Simon Wilkinson
356bdc8ca7 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>
2013-02-25 10:42:39 -08:00
Simon Wilkinson
dce2d8206e budb: Store dumper information correctly
Change f498c18a6f 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>
2013-02-25 10:42:33 -08:00
Simon Wilkinson
2a2cae72d6 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>
2013-02-25 09:59:52 -08:00
Simon Wilkinson
d09b300a96 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>
2013-02-25 09:59:45 -08:00
Simon Wilkinson
9894b0ded9 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>
2013-02-25 09:12:47 -08:00
Simon Wilkinson
82b3760c4f 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>
2013-02-25 08:38:11 -08:00
Simon Wilkinson
3fbdc609dc 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>
2013-02-25 08:38:05 -08:00
Simon Wilkinson
ca6d6bb9b0 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>
2013-02-25 08:38:00 -08:00
Simon Wilkinson
e4862e2848 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>
2013-02-25 08:37:54 -08:00
Simon Wilkinson
0cb0d44da3 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>
2013-02-25 08:37:48 -08:00
Jeffrey Altman
a10e96b3aa Windows: Test NameArrayReferenceCount before deletion
In commit c753d398f2 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>
2013-02-25 08:03:29 -08:00
Simon Wilkinson
50a9933856 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>
2013-02-24 11:48:58 -08:00