Commit Graph

10168 Commits

Author SHA1 Message Date
Simon Wilkinson
cc06d00b21 Move configuration parsing into libcmd
Rework the API for directly parsing configuration files and move it
out of util/ and into libcmd, where we can actually make use of it.

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

Change-Id: I9f4a9c373c4123023120f69e595068ead6160507
Reviewed-on: http://gerrit.openafs.org/7132
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-09 15:36:41 -07:00
Simon Wilkinson
e4430d9d48 rxperf: Build again
Fix rxperf so that it builds again

Change-Id: I9747bc1b3fedb96d5bc317acde69f35b1dc6efb8
Reviewed-on: http://gerrit.openafs.org/7011
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-04-09 13:39:21 -07:00
Simon Wilkinson
91303604f6 roken: Prefix getopt and getprogname
The roken symbols for getopt and getprogname are now prefixed with
'rk_'. Fix the map file so it lists the correct symbols.

Change-Id: I61adba7d5bec3e86b8e29d1eefda23df4ef91988
Reviewed-on: http://gerrit.openafs.org/7010
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-04-09 13:39:04 -07:00
Simon Wilkinson
80ec5db21d all needs to be first rule in the Makefile
Just running 'make' in a subdirectory will fire the first rule in that
directory's Makefile. When the buildtools rules were added to roken and
crypto, they were put at the start of the file, meaning that they fire
in perference to 'all'

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

Change-Id: I598a183f42c150a5da724b7403e91f89f74a0109
Reviewed-on: http://gerrit.openafs.org/7009
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-04-09 13:38:43 -07:00
Simon Wilkinson
46c5aabfc6 bos: Change to using char casts for ka functions
The ka_IsZero and ka_PrintBytes function just use char strings. Cast
directly, rather than going via a helper functions to simplify this
code.

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

Change-Id: I831ff0f8fbecec602d8c2b9112675938facfb06b
Reviewed-on: http://gerrit.openafs.org/7066
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-09 10:04:32 -07:00
Simon Wilkinson
00992c6697 shlibafsrpc: Add additional XDR functions
Export the afs_xdr_pointer and afs_xdr_u_char functions so that
shlibafsauthent can make use of them.

Change-Id: I16cf3f69904bffb3a034fd4052117845c1067a2c
Reviewed-on: http://gerrit.openafs.org/7065
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-09 10:04:20 -07:00
Jeffrey Altman
578cdc35e6 rx: remove peer burst elements from rx/test
Subsequent patchsets will turn rx_peer into an opaque object
and remove the burst elements entirely from the tree.  For
now remove them from rx/test

Change-Id: I728f7b74497701c0ef965009dff5550e1b153696
Reviewed-on: http://gerrit.openafs.org/7130
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-04-09 06:03:13 -07:00
Simon Wilkinson
01a1b79288 rx: rxi_AckAll isn't an event handler
rxi_AckAll is coded as if it is an event handler, yet the only
call site is a direct call from rx.c. So, rework the function to
remove all of the event handling code, change its arguments to match,
and make it static.

Change-Id: I947c02bf91bf5a3f42d2a389f9393e68f3ccee4b
Reviewed-on: http://gerrit.openafs.org/6999
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-04-09 05:20:31 -07:00
Simon Wilkinson
a20c489367 rx: Tidy up function scope in rx.c
Rework headers to more clearly indicate which functions in rx.c
are considered part of the 'public' rx interface, and which are for
internal use only.

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

Remove entirely the unused function rxi_NatKeepAliveOn()

Change-Id: I878374dc137f4c7e204de4b2d9ca17fa1c5db628
Reviewed-on: http://gerrit.openafs.org/6998
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2012-04-09 04:54:44 -07:00
Simon Wilkinson
084c2c1687 rx: Remove trailing else from RX_KERNEL_TRACE
The RX_KERNEL_TRACE ifdefs all contain a trailing else, which makes
no logicial sense given the rest of the code. The only effect of this
trailing else is to cause packets to not be sent when tracing is
enabled, which probably isn't the desired behaviour.

Change-Id: I2175b1d8270cd096361f349a467245b49efabf6b
Reviewed-on: http://gerrit.openafs.org/7001
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2012-04-09 03:51:22 -07:00
Simon Wilkinson
49ddcc3b3e kas: Don't require config for help
Modify the call to ka_Init in kas, so that a fully configured client
isn't required in order to generate help output. In particular, permit
kas -help, kas -version and kas apropos to run without initialising the
ka library.

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

Change-Id: I5edd10a319ed6aee163723f99c4f37183f572b2f
Reviewed-on: http://gerrit.openafs.org/7129
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 21:43:50 -07:00
Marc Dionne
9037358b6a tools: return error code in xfclose
The code variable takes the return code from do_close, but
is then unused.  Return its value instead of systematically
returning 0, avoiding an unused variable warning.

Change-Id: I831b5b81721400ee08106d2ecdbf2b7b8e126348
Reviewed-on: http://gerrit.openafs.org/7123
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
2012-04-08 21:14:12 -07:00
Simon Wilkinson
2427cb000c rx: Remove unused ACKHACK macro
rx_globals.h had a macro called ACKHACK which at one point looks like
it was used to determine whether to send an ACK or not. We now have a
more sophisticate mechanism for determining this, and the old macro
doesn't seem to have been used in a long time. So, remove it to avoid
confusion.

Change-Id: I9b17cdca69c903c7a952489791088f2899ac7e60
Reviewed-on: http://gerrit.openafs.org/7000
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-04-08 21:05:39 -07:00
Simon Wilkinson
2c0ed7ace6 tests: waitpid requires sys/wait.h
Calling waitpid requires the sys/wait.h header to be included to
guarantee that the prototype is enabled.

Change-Id: I2d845236347d1be46cd750c2e766b305a64cde53
Reviewed-on: http://gerrit.openafs.org/7128
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:24:58 -07:00
Simon Wilkinson
02f470e99d tests: rx needs roken
On Linux, the RX library has a dependency on libroken for the rk_socket
function. Add this dependency to the RX tests.

Change-Id: I306e846524232bc136cd969ab1b8664d1c570e2d
Reviewed-on: http://gerrit.openafs.org/7127
Tested-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:24:20 -07:00
Simon Wilkinson
bdca02dfe7 cmd: Don't leak memory when constructing help string
It's not critical, because we'll be exiting soon afterwards, but just
to be nice, don't leak the name of every command option whilst we're
constructing the help string.

Caught by clang-analyzer

Change-Id: I87fdb2030c6a7c5ad810f2a06820c08cbe2fb18e
Reviewed-on: http://gerrit.openafs.org/7107
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:23:49 -07:00
Simon Wilkinson
4dc40bade4 ktime: Don't leak token list
ktime_ParsePeriodic generates a malloc'd token list when it parses
the time string passed to it. Make sure that we free this list before
exiting from the function.

Change-Id: I6edacc6504aeec06ede5b5ae36c22f69b0d6cea0
Reviewed-on: http://gerrit.openafs.org/7106
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:23:32 -07:00
Simon Wilkinson
63f7b0a205 budb: Don't leak memory
Don't leak the malloc'd path variable everytime we call truncateDatabase

Caught by clang-analyzer

Change-Id: I583d81b136113820dab00a6eb35ca8e1aeec2cd1
Reviewed-on: http://gerrit.openafs.org/7105
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:23:07 -07:00
Simon Wilkinson
39bdcebad7 vol-dump: Don't leak memory
Don't leak a Volume structure everytime we call HandleVolume

Caught by clang-analyzer

Change-Id: Id8cf79dd2178b8647d88f0765ec4ad9d327a23ae
Reviewed-on: http://gerrit.openafs.org/7104
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:22:50 -07:00
Simon Wilkinson
1b4d2b53cc vol-dump: Make static things static
vol-dump is a self contained object. Make everything in it static to
make clear that these functions are not being used by other objects in
the tree.

Change-Id: I0345c884167ed322fdf7a6e83b77b0ae261b9d8f
Reviewed-on: http://gerrit.openafs.org/7103
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:22:26 -07:00
Simon Wilkinson
be8d8b7c78 auth: Don't leak key on file parse error
If we fail for any reason whilst parsing the keyfile from disk, don't
leak the key structure which we allocated to store the results of the
parse.

Change-Id: I21a27723f96af9428465134cfb975c83e10da535
Reviewed-on: http://gerrit.openafs.org/7102
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:22:08 -07:00
Simon Wilkinson
8f39150b27 opr: Flag assertion error handles as noreturn
Flag both of our assertion error handlers as being AFS_NORETURN, so
that static analysers can truncate their decision trees, and avoid
false positives, based on assertion statements.

Change-Id: I511c9c19a714cd3eaa5a886bf9561f577244360e
Reviewed-on: http://gerrit.openafs.org/7101
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:21:47 -07:00
Simon Wilkinson
d55a5d7080 pts: Don't malloc(0) when there's nothing to do
If GetNameOrId is called with no work to do, then don't attempt to
malloc a load of 0 length strings. Instead just return an empty array
to the caller.

Change-Id: I245cfde71d65b8a3b6df4217b90dad81e9e60a58
Reviewed-on: http://gerrit.openafs.org/7100
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:21:25 -07:00
Simon Wilkinson
8d497e575c bucoord: Don't malloc(0) if there's no work to do
If there's no work to do, then don't attempt to malloc 0 bytes, and
just return success to the user

Change-Id: I060852a247acb8309c75f3670577561b5a9af591
Reviewed-on: http://gerrit.openafs.org/7099
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:20:55 -07:00
Simon Wilkinson
54ca22a905 auth: Handle empty lists of keys
Handle the case where a list of keys may be empty - don't attempt
to calloc a 0 length array, and have Put handle the case where the
array being freed has no elements.

Caught by clang-analyzer

Change-Id: I665035cb00a8da411710a71a17ae66545702127f
Reviewed-on: http://gerrit.openafs.org/7098
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:20:38 -07:00
Simon Wilkinson
5815c5ffb0 Unix CM: We're disconnected if RW disconnected too
At the moment, the Unix CM doesn't support entering a purely RO
disconnected mode (the historical AFS_IS_DISCONNECTED mode). If we
go disconnected, or reconnect we always toggle RW discon at the same
time as we toggle RO. Arguably, the RO disconnected mode should just
be removed, as it is now superceded.

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

Change-Id: I7e2d04d2cf67740c6b6285950874c6a4eaeb0537
Reviewed-on: http://gerrit.openafs.org/7097
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:20:15 -07:00
Simon Wilkinson
de94f97649 auth: Make sure we get AF_INET addresses from DNS
The routines which do AFSDB and SRV lookups copy the results of
gethostbyname directly into an afs_int32, and use the size of the
result to limit the copy. If, for any reason, they get a result that
isn't an int, then they will overflow this value.

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

Caught by clang-analyzer

Change-Id: Icf1426e090bc1ed382212d5de6c291d0816fb2c9
Reviewed-on: http://gerrit.openafs.org/7096
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:19:57 -07:00
Simon Wilkinson
20265ddd78 vos: Initialise total counters
When VolumeStats_int calls DisplayFormat, it isn't interested in
the total counters it provides. So, it doesn't both initialising the
variables it passes in to hold these counters - garbage in, garbage out.

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

Caught by clang-analyzer

Change-Id: Ia3e1eadde6eac6fa924a4ff9ad566c5c50f9ff40
Reviewed-on: http://gerrit.openafs.org/7095
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:19:31 -07:00
Simon Wilkinson
6c1a7e68c4 vol: Don't return an uninited val from LookupNode
If the SalvageHashTable for a particular node is empty, then LookupNode
can return an uninitialised value to the caller. It isn't clear from a
broader code inspection whether LookupNode can ever be called with an
empty SalvageHashTable, but returning a NULL vsp does seem like the
correct thing to do in this situation.

Caught by clang-analyzer

Change-Id: Ibee79e6acf7d3bdbc2995ef924338ade4de77d08
Reviewed-on: http://gerrit.openafs.org/7094
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:19:14 -07:00
Simon Wilkinson
9cbc3b77db fs: Fix bad frees
On an error GetLastComponent was freeing completely the wrong thing.
Fix this so it frees the memory it has allocated, and not some random
stack pointer.

Caught by clang-analyzer

Change-Id: I8b65f7ab36647b876fae5cbe59d82fd8d38ce0b7
Reviewed-on: http://gerrit.openafs.org/7093
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:18:59 -07:00
Simon Wilkinson
9a007a9df4 cmd: Use strl* rather than strn* to avoid overrun
The NName function was using strncat(a, b, sizeof(a)), which doesn't
work as you would expect if 'a' already contains data. To avoid the
potential buffer overflow, switch to just using strlcat.

Caught by clang-analyzer

Change-Id: Idd2c630c07a93b27e8d629339589aa6686290eae
Reviewed-on: http://gerrit.openafs.org/7092
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:18:48 -07:00
Simon Wilkinson
b5ebfec329 autoconf: One CC to rule them all
(well, in userspace at least)

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

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

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

Change-Id: Ib95e2ac00b36f33c3cb2491feacd6c898f8f61dc
Reviewed-on: http://gerrit.openafs.org/7091
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:18:35 -07:00
Simon Wilkinson
3198cef8cc afs: Handle reading past the end of a file
... except that this change doesn't actually handle this, it just
stops clang from throwing an error about the bogus code that's already
in there. This needs fixed properly ...

Change-Id: Ifbf190a86037fced8104ed0843dd1e7aa0b999a7
Reviewed-on: http://gerrit.openafs.org/7090
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:17:58 -07:00
Simon Wilkinson
f1842bcb87 xdr: Len can never be negative
The len parameter to xdr_len is unsigned, so can never be negative.
Don't bother testing to see if it is negative, so that clang likes us
again.

Change-Id: Iad5f8b1b2d20ec55846bc1ef7b7499a30956e17f
Reviewed-on: http://gerrit.openafs.org/7089
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:17:40 -07:00
Simon Wilkinson
5e107724f3 rx: Remove needless braces
Doing if ((a==b)) is unecessary. It's also potentially dangerous, as
that's the syntax required to do assignment within an if statement.
clang now issues warnings (errors in -Werror mode) when it encounters
these.

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

Change-Id: I031db80c3f85c0e4c4db365b1c36b5d4b4a7cb48
Reviewed-on: http://gerrit.openafs.org/7088
Tested-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:17:16 -07:00
Simon Wilkinson
438d6ba63c rx: Handle negative returns on packet reads
rxi_RecvMsg returns an int, because it can return a negative value upon
error. Don't store its return value as an unsigned int, because this may
hide the potential errors.

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

Change-Id: I212e5881f83a2a95c177c23dbc2da2583155f1aa
Reviewed-on: http://gerrit.openafs.org/7087
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:16:59 -07:00
Simon Wilkinson
4e68282e26 venus: Make clang happy with strlcpy use
clang now expects that strlcpy will always be used to prevent overflow
of the destination string, and gives a warning if the size parameter is
based solely on the length of the source string.

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

Change-Id: I86f68dd2013ca8bc4c88ade78d27c4d416a9ae94
Reviewed-on: http://gerrit.openafs.org/7086
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:16:29 -07:00
Simon Wilkinson
6d83b33324 viced: Remove pointless braces
Doing if ((a==b)) is unecessary. It's also potentially dangerous, as
that's the syntax required to do assignment within an if statement.
clang now issues warnings (errors in -Werror mode) when it encounters
these.

Remove pointless braces from viced to make clang happy.

Change-Id: Iee8c1d60cc2296fefd0e7f82127821dcefb931ec
Reviewed-on: http://gerrit.openafs.org/7085
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:16:12 -07:00
Simon Wilkinson
350b5d5877 vlserver: unsigned values are always >0
Maxvolidbump is defined as an unisgned int, and thus can never be less
than 0. Remove the pointless check, as it just makes clang sad.

Change-Id: I78a2c8f6fcaee17196e37183256e6935cdca183b
Reviewed-on: http://gerrit.openafs.org/7084
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:15:21 -07:00
Simon Wilkinson
408afc5690 vol: Call memset with the correct size
Call memset with the size of the structure we're initialising to 0,
and not the size of the pointer to that structure.

Caught by clang's new warnings.

Change-Id: I8cded7bed4e289e9603778e06873f94fd3924aa8
Reviewed-on: http://gerrit.openafs.org/7083
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:14:56 -07:00
Simon Wilkinson
e202822b8e rxgen: Tidy up server side freeing
The way in which rxgen handles freeing of objects allocated by the RPC
stub has evolved over the years. Originally, there appears to have been
a "somefrees" parameter which was used to track whether objects required
freeing or not. However, this parameter has fallen in to disuse, as
support for typedefs and unions were added, and which parameters
require freed is now tracked within the description structures
themselves. So, get rid of somefrees, as it is now just confusing.

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

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

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

        return RXGEN_SS_XDRFREE;

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

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

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

        return z_result;

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

Change-Id: I8b56f320c05c5d4270daf409d57514cbe8d076f5
Reviewed-on: http://gerrit.openafs.org/7005
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:13:33 -07:00
Simon Wilkinson
709a6358e1 fileserver: Fix NeverAttach support
Commit 35becabed8 added support for
the /vicepXX/NeverAttach. However this code only appears to work on
Linux. It fails build testing on (at least) Mac OS X, FreeBSD, and AIX.
Modify the code so that the NeverAttach call uses the same variable to
locate the path of the partition as the AlwaysAttach call does.

Change-Id: Ic87e112f362ac6d23376fb0a263d021c29c0b06e
Reviewed-on: http://gerrit.openafs.org/7125
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-08 18:12:52 -07:00
Jason Edgecombe
f263309046 DOC: Factored common text out of the vos_backup and vos_dump man pages
Change-Id: I84bd722834297778ab2e719996b2f8528d8706d6
Reviewed-on: http://gerrit.openafs.org/7126
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Tested-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-04-08 11:59:21 -07:00
Simon Wilkinson
58be19d792 vol: Remove unneeded braces
Doing if ((a==b)) is unecessary. It's also potentially dangerous, as
that's the syntax required to do assignment within an if statement.
clang now issues warnings (errors in -Werror mode) when it encounters
these.

Remove pointless braces from vol to make clang happy.

Change-Id: I805c52fd76de4d028741ae4382b747917581d2f2
Reviewed-on: http://gerrit.openafs.org/7082
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-04-07 18:29:51 -07:00
Simon Wilkinson
a0af50a9dc vice & vol: Cast FDH_SYNC results to void
FDH_SYNC is a macro which returns a result. This leads to clang
complaining about an unused expression when the macro is expanded.
Avoid this by just casting the macro result to (void) when we aren't
interested in it.

Change-Id: I99eaac7432211d6b0cab10c3e1af0c6d4e2092a8
Reviewed-on: http://gerrit.openafs.org/7081
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-04-07 18:28:23 -07:00
Simon Wilkinson
4d4e4dde7c ptserver: Remove redundant braces
Doing if ((a==b)) is unecessary. It's also potentially dangerous, as
that's the syntax required to do assignment within an if statement.
clang now issues warnings (errors in -Werror mode) when it encounters
these.

Remove pointless braces from ptserver to make clang happy.

Change-Id: I1bf1698b1d12f8228e0456d3d2dff4439879cfba
Reviewed-on: http://gerrit.openafs.org/7080
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-04-07 18:28:06 -07:00
Simon Wilkinson
10a02e70c3 pam: Don't check if unsigned is < 0
uid_t is unsigned, so checking to see if it is less than 0 is a bit
redundant.

Remove the checks to silence a warning from clang.

Change-Id: I5ae429247d328b3320063b4c035f6e5bb101620b
Reviewed-on: http://gerrit.openafs.org/7079
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-04-07 18:27:54 -07:00
Simon Wilkinson
0d2c2b454b pam: Use &, not && for bitwise operations
All of the LOG_MASK() checks are performing bitwise operations, and so
should be using '&', not && (which will always be true, providing
logmask is non-zero)

Caught by clang's new error messages

Change-Id: Idce9229b7351adc6c15279c94e1cc1e7fc45596e
Reviewed-on: http://gerrit.openafs.org/7078
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-04-07 18:27:27 -07:00
Simon Wilkinson
ca9fa87543 tools: Use native 64 bit integer
Modify the tools directory to use a native 64 bit integer type, rather
than rolling its own.

Change-Id: Ib2545b43aa3bf34e8917a4ae7ae4ee3f4be6d1c0
Reviewed-on: http://gerrit.openafs.org/7118
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-07 18:27:01 -07:00
Derrick Brashear
cc489b880c ubik: utst needs opr for assert in util
add libopr after libafsutil so assert can be satisfied

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