299 Commits

Author SHA1 Message Date
Simon Wilkinson
d812716408 readpwd: Make sure user supplies a passwdfile
If the user supplies enough command line arguments, but doesn't
provide a passwdfile, then we can end up trying to open whatever
garbage is on the stack.

Once we've finished parsing the command line arguments, make sure
that a filename was supplied.

Caught by coverity (#986009)

Change-Id: Ice2fca16458a90d73ae6b5fadb0efa22ed0b185a
Reviewed-on: http://gerrit.openafs.org/9441
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-03-07 08:08:16 -08:00
Simon Wilkinson
3c564444cf readgroup: Make sure user supplies a groupfile
If the user supplies enough command line arguments, but doesn't
provide a groupfile, then we can end up trying to open whatever
garbage is on the stack.

Once we've finished parsing the command line arguments, make sure
that a filename was supplied.

Caught by coverity (#986008)

Change-Id: Iaea60027cf4bd81f9af04e995ce5c395275be833
Reviewed-on: http://gerrit.openafs.org/9440
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-03-07 08:06:25 -08:00
Simon Wilkinson
bc70828f07 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>
2013-02-28 16:13:48 -08:00
Simon Wilkinson
a80cb27ae8 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>
2013-02-28 16:12:01 -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
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
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
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
860c34ba93 ptserver: Don't ignore ubik_Write failures
If we can't write to the ubik database, then that's a bad thing.
Don't ignore it.

Caught by clang-analyzer

Change-Id: I08b57a74405cc563c6141251fd3d433b2904ea0e
Reviewed-on: http://gerrit.openafs.org/9176
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-22 06:16:45 -08:00
Simon Wilkinson
df0b2d6775 ptserver: Tidy malloc handling in readpwd
Tidy up the malloc handling in readpwd, so that we don't leak memory
if the user specifies multiple -c arguments. Also avoid assuming that
free(NULL) will always work.

Change-Id: I95f3fe908572cb5be2d30345ccae0a2858622bd5
Reviewed-on: http://gerrit.openafs.org/9178
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-21 22:20:05 -08:00
Simon Wilkinson
7f9f54c919 ptserver: Remove some unnecessary assignments
Remove some assignments where we do nothing with the results

Caught by clang-analyzer

Change-Id: I6990a6b21ced10500275176af3f85b7f1cabd334
Reviewed-on: http://gerrit.openafs.org/9177
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-21 22:19:27 -08:00
Simon Wilkinson
2ee578d800 ptserver: Use correct structure type in malloc
prentries is a list of 'struct prlistentries' objects, not a list of
'struct prentry'. Use the correct type in our call to malloc.

Caught by clang analyzer

Change-Id: I6c36e4b875eafb8aff6506cf800d47b45a79825d
Reviewed-on: http://gerrit.openafs.org/9150
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-21 09:09:01 -08:00
Simon Wilkinson
0f46f6b333 ptserver: Simplify malloc assignment to shut up clang
Using a temporary variable of type (char *) to store the results
of malloc and realloc, and then casting the tmp variable to the
real type causes clang-analyzer to complain. Just simplify this
code by always using the real type in order to shut it up.

Change-Id: I607bb36d1899dc617fdbd9e09e18ff10c9fa9ce9
Reviewed-on: http://gerrit.openafs.org/9148
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2013-02-20 12:30:08 -08:00
Andrew Deason
527f2ba00c ptserver: Avoid inet_ntoa
The ptserver uses inet_ntoa in a few places, such as for calculating
host CPS. This isn't safe in pthreaded environments, so use
afs_inet_ntoa_r instead.

Change-Id: I84cdf606ffd44d2d87c0db509af0950a6547364e
Reviewed-on: http://gerrit.openafs.org/8287
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-10-30 05:32:51 -07:00
Chas Williams (CONTRACTOR)
33ca19acbd afs: casting NULL is generally unnecessary
Casting NULL shouldn't be necessary in most cases.  Eliminate this
in favor of shorter lines and consistency.  Function pointers, variadic
arguments should still be cast.

Change-Id: Ibcd67378556e45c2b24f7aa85a4d73c72cd88e02
Reviewed-on: http://gerrit.openafs.org/8151
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-09-27 11:03:07 -07:00
Simon Wilkinson
88fc3c6f42 Split up libtool support into LWP and pthread
Currently, the type of library you build is determined by whether
the library is build in a pthread, or an lwp build directory. However,
this prevents building an LWP library in a directory that builds
pthreaded clients and servers.

As we want to continue to provide LWP libraries for backwards
compatibility, but move over to pthreaded binaries, this causes
some issues.

So, split up the libtool logic, so we have Makefile.libtool, which
you include if you want to build a pthreaded libtool library, and
Makefile.lwptool, for building a library which supports LWP and
pthreaded use. These only affect how .lo files are built - so the
.o files used for non-library objects are managed with the
Makefile.pthread and Makefile.lwp includes as before.

Change-Id: Ib1af48342253230abab9056eb15a3f79bd77a6de
Reviewed-on: http://gerrit.openafs.org/8126
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-09-16 13:34:57 -07:00
Simon Wilkinson
3c3d209a4f libafsauthent: Build with libtool
Construct the libafsauthent library with libtool. All libraries
contributing to libafsauthent provide a libauthent_<library>.la
convenience library, which we use libtool to combine into shared
and static versions of libafsauthent.

Change-Id: I76fa61eb027862eab730c4c86ab74a7b7e03c13b
Reviewed-on: http://gerrit.openafs.org/8097
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: Derrick Brashear <shadow@your-file-system.com>
2012-09-12 06:48:00 -07:00
Simon Wilkinson
6300728282 ptserver: Fix parallel builds
It's not safe to have libtool building a blah.lo at the same time as
gcc is building blah.o. A Makefile must exclusively use either the .lo
or the .o form.

Fix ptserver so that ptint.xdr.lo is the only one referenced, and just
explicitly pull in the LWP object for the ptserver.

Change-Id: I2e868d2d318c84e20bcccc0ffc462c87e4b7a2f2
Reviewed-on: http://gerrit.openafs.org/8100
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-09-12 05:40:48 -07:00
Simon Wilkinson
1e7de65899 ptserver: Use libtool to build a pthreaded libprot
Use libtool to build a pthreaded version of libprot in src/ptserver.
Make the tptserver directory just build pthreaded versions of the
client and server, and link these against libprot

Change-Id: Idc43de8c548f38584e78b35f9f1ecba3eb4b74d2
Reviewed-on: http://gerrit.openafs.org/8091
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-09-11 14:42:06 -07:00
Simon Wilkinson
ab977738b1 Further rationalise our usage of assert()
This patch futher improves our usage of assert() and friends. The
intention is to bring clarity to which forms of assert are used in
which situations, and to solve the problem of assert(X), or
osi_Assert(X) being used in a situation where X has side-effects.

It introduces two new assertion macros opr_Assert() and opr_Verify(),
and clarifies the usage of osi_Assert() and assert().

*) opr_Assert is a direct equivalent of assert(), with the exception
   that its output can be redirected to a log file when used in server
   code. It is the preferred version of assert for libraries, and server
   side code. Note that whilst opr_Assert doesn't currently become a
   no-op when NDEBUG is defined, the intention is that it will do so at
   some point in the future.
*) opr_Verify(X) asserts if the value of X is false. Unlike assert()
   it will always run X, regardless of whether the value is checked or
   not. The eventual intention is that when NDEBUG is defined,
   opr_Verify(X) => X
*) osi_Assert is an assertion macro intended for use in kernel code,
   or in mixed kernel/userland code. When code is built for userspace,
   osi_Assert(X) => opr_Assert(X)
*) assert is the system's own assert macro. It should only be used
   in client code. Whilst a header (opr_assert.h) is provided to map
   assert() to opr_Assert(), its use is discouraged

Change-Id: Ie6d61305686bdc7193cc8690e6f4fbe363211faf
Reviewed-on: http://gerrit.openafs.org/5395
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-09-04 06:53:16 -07:00
Simon Wilkinson
1e76c59ea5 auth: Relocate NetRestrict support functions
Pull the NetRestrict and NetInfo support functions out of libutil,
and into libauth. This starts to concentrate all of our configuration
file parsing functions into the same place.

It also gets rid of a circular dependency. NetRestrict parsing relies
on functions from rx, so with this in libutil, we had the dependency
chain util->rx->util

Change-Id: I250d4d8264da8db61f603a06d1b7fdab44384cd3
Reviewed-on: http://gerrit.openafs.org/8027
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-08-31 10:39:59 -07:00
Derrick Brashear
e3cf97b5b5 krb5 profile config support
create openafs-client.conf and openafs-server.conf in respective ETC
dirs. enable afsd, ptserver, vlserver and fileserver option parsing from it

[afsd]
            dynroot = true
            dcache = 800
            cachedir = /var/db/openafs/cache

Change-Id: I4bae437d7c8f54daa5dadfaeb875cdd185809d61
Reviewed-on: http://gerrit.openafs.org/7903
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-31 12:27:24 -07:00
Garrett Wollman
d0db811939 pruser: AFS_NONNULL annotations for functions that deserve it
Change-Id: I68e74affcb3235d93e684a04a56ef44798a42406
Reviewed-on: http://gerrit.openafs.org/7861
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-26 10:53:03 -07:00
Garrett Wollman
97146a8ed8 ptuser: avoid implementation-defined behavior in CreateIdList()
CreateIdList() is an internal subroutine of pr_IDListExpandedMembers(),
used to flatten a hash table of protection IDs into an array that can
be passed to pr_IdToName().  If for some reason the hash table had no
entries, it would call malloc(0) and, depending on how the
the implementation defines this, either return a PRNOMEM error (wrong!)
or else allocate a minimum-sized buffer which pr_IdListExpandedMembers
would then promptly leak.  Compromise between the two behaviors by
not allocating any memory in this case but returning success, and in
the caller check for an empty list and avoid the pointless RPC to
translate no IDs into no names.  pr_IDListExpandedMembers() will return
success, as it previously did in the non-PRNOMEM case.

Change-Id: I8a042bde3e98f5cf248358f37f2e875d6b5b298d
Reviewed-on: http://gerrit.openafs.org/7863
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-25 13:29:41 -07:00
Garrett Wollman
21878c61dd ptuser: use the "prname" typedef rather than "char[PR_MAXNAMELEN]"
There's a typedef for this type, so use it in function prototypes
rather than the more complicated declarator.

Change-Id: I75a9b4e72201e6b2072dba14185579f9c4aa61be
Reviewed-on: http://gerrit.openafs.org/7858
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-24 05:22:29 -07:00
Garrett Wollman
a738c8dcff ptuser: pr_SNameToId/SIdToName: if RPC response empty, force error
If the prserver returns an empty response to ubik_PR_NameToID
or ubik_PR_IDToName, but doesn't otherwise give an error,
force a PRINTERNAL error return so that the client knows that the
the return parameter was not updated.  Existing callers seem to
expect this, as pr_SNameToId is often called without initializing
the variable which receives the result and checking only for the
error code.

PRINTERNAL is a new error code.

Change-Id: I3e598a22deb39792a0f208ac09b3c1991d6f1e58
Reviewed-on: http://gerrit.openafs.org/7836
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-23 20:26:43 -07:00
Simon Wilkinson
5dce817d40 ptserver: Make ptclient build again
Make the ptclient utility build again, and add it to the ptserver
Makefile so that it is built by default and, hopefully, won't
bitrot again.

Change-Id: I888a9d4392b62ecb2d7556694400a2853658052a
Reviewed-on: http://gerrit.openafs.org/7841
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-07-23 09:31:03 -07:00
Garrett Wollman
e39d6ca55a strcompose: NULL must always be cast when passed to a variadic function
The C standard allows NULL to be defined as a bare "0", which will
be passed to variadic functions as an int.  If the function expects
a pointer type, demons fly out of your nose.  strcompose() is such
a function, so make sure that all of its callers cast NULL appropriately.
(None of them did.)  This may be an opportune time to change all of
the callers to spell it opr_strcompose() as well, and avoid using a
reserved identifier, but this change does not do so.

Change-Id: Ia9007a48102da4d0a85a48b41a44e83102304b49
Reviewed-on: http://gerrit.openafs.org/7805
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-22 05:22:08 -07:00
Jeffrey Altman
9be78ab820 ptserver: unused by set variable 'eid_s'
Third declaration of 'eid_s' in WalkNextChain() set but unused.
[-Werror=unused-but-set-variable]

Change-Id: I7a4e2ea3dea3d58379e31d3c6cb4b3169a882bce
Reviewed-on: http://gerrit.openafs.org/7737
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-05 23:47:53 -07:00
Michael Meffie
7b35b409a4 fix audit init in vl and pr servers
Correct error introduced in commit
0dd7c980acda0756150f11992a0d2236f340e0c2

Change-Id: I929bb35a6a7070d637f1b332dae50cd182aaf9c5
Reviewed-on: http://gerrit.openafs.org/7447
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-05-24 09:28:38 -07:00
Simon Wilkinson
cbdf31d9ff dbservers: Don't cast returns from malloc()
malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

Change-Id: I5a7c800e2836e7401f5f8bccf1aa2a1b223100b7
Reviewed-on: http://gerrit.openafs.org/7463
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-05-24 08:57:51 -07:00
Simon Wilkinson
bdd8187c04 Don't cast the return from realloc()
realloc takes, and returns a (void *) argument. So we don't need to
cast these parameters into, or out of, realloc. Doing so is just
noise, so don't bother.

Change-Id: I64e721703536515b2e315e3b033eb2be14f7e18c
Reviewed-on: http://gerrit.openafs.org/7455
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-05-24 08:52:11 -07:00
Simon Wilkinson
9efc255ab8 Use calloc, rather than malloc/memset
Rather than doing
	a = malloc(sizeof(me));
	memset(a, 0, sizeof(me));

Just use
        a = calloc(1, sizeof(me));

This is simpler, shorter, and removes the potential for the size of
the memset not matching the size of the malloc (or the target of the
memset being wrong!)

Where the size is of the form (n * sizeof(me)), we also use
calloc(n, sizeof(me));

Change-Id: Ia0f75665c1031fd2982eee0e1d8c8ebe23d7fbc0
Reviewed-on: http://gerrit.openafs.org/7454
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-05-24 08:49:28 -07:00
Simon Wilkinson
d142c8f97a Don't cast arguments to free()
free(3) is defined as:

    void free(void *ptr);

so there is no need to cast the pointer argument being past to it to
(char *), (void *), or whatever other randomness happened to be floating
through the author's mind. Remove all such casts, as they are just
noise.

Change-Id: Ib7c8c259d53e9ce74fc486cb0997360044795395
Reviewed-on: http://gerrit.openafs.org/7453
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-05-24 08:49:09 -07:00
Simon Wilkinson
044785d587 Use asprintf for string construction
Rather than using something along the lines of

    strOut = malloc(strlen(strA) + strlen(strB) + strlen(strC) + 1);
    strcpy(strOut, strA);
    strcat(strOut, strB);
    strcat(strOut, strC);

use asprintf for string construction, so we can just write

    asprintf(&strOut, "%s%s%s", strA, strB, strC);

roken provides an implementation of asprintf for platforms which are
missing one.

Change-Id: Ieef9f4b65f72260c0d372cdf3865daab98733ad9
Reviewed-on: http://gerrit.openafs.org/7451
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-05-24 08:48:35 -07:00
Andrew Deason
0debf2d227 Call rx_SetNoJumbo earlier
For ubik server processes, rx_SetNoJumbo needs to be called before
ubik initialization for it to effect the communication between
dbservers; otherwise, full database transfers may result in Rx
jumbograms on the wire regardless of the jumbo/nojumbo setting. Move
the call to rx_SetNoJumbo to before ubik initialization to avoid this.

Also move the call to rx_SetNoJumbo to immediately after rx_Init* for
all server processes, for consistency. Move similar calls to
rx_SetMaxMTU for the same reason.

Change-Id: Ic79415829601fcfb4e74e72fbf5711d0c32aaa0c
Reviewed-on: http://gerrit.openafs.org/7350
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-05-11 17:20:05 -07:00
Simon Wilkinson
3029ed4003 ptserver: Complete pr_realmName removal
Commit 9ddf9eca56e02be978ff7d065ee16c85de2cfb06 changed the mechanism
by which the local realm is determined such that pr_realmName is
no longer required.

Tidy things up by removing the unecessary variable.

Change-Id: I9b21340a8ecd38fbb8326dbed276882c9f0e9a62
Reviewed-on: http://gerrit.openafs.org/7266
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-04-22 11:47:42 -07:00
Simon Wilkinson
a6d64d7007 ptserver: Refactor per-call ubik initialisation
The way in which the ubik database is initialised is identical for
all read transactions, and for all write transactions. Rather than
duplicating this code in each call handler, pull it out into two
helper functions - ReadPreamble and WritePreamble.

Change-Id: I40f2d8d609bc4e6e8e3e0fc8851da86978c77818
Reviewed-on: http://gerrit.openafs.org/7256
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-22 06:16:38 -07:00
Simon Wilkinson
25a5c423a0 ptserver: Remove PR_REMEMBER_TIMES
The #define PR_REMEMBER_TIMES is always true, so remove the #define,
and all of the #ifdefs that it triggers

Change-Id: I445a2cd8f5e5b2570e6ef1311cc6bb3d66592fdc
Reviewed-on: http://gerrit.openafs.org/7264
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-22 06:15:39 -07:00
Michael Meffie
0dd7c980ac audit: remove static local realms
Remove the static list of local realms and use the
auth interace to do the local realm check. A callback
function is registered by the servers to avoid a circular
dependency between audit and auth.

Change-Id: Ic0f25cd79da7987704de68bade14054490b26c80
Reviewed-on: http://gerrit.openafs.org/6879
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-18 11:12:40 -07:00
Michael Meffie
9ddf9eca56 ptserver: remove static local realms
Use the new auth function to do the local realm match
check instead of static local realms lists.

Change-Id: I8b509188103916bdd2e575e5e9a14e3671b81e65
Reviewed-on: http://gerrit.openafs.org/6877
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-18 11:10:47 -07:00
Simon Wilkinson
83b76f564b Remove redundant header includes
Remove includes of system headers where roken.h already takes care of
including them. This simplifies the source tree, reduces the amount of
work done by the compiler, and ensures that all of our headers are
included with the correct guards

The list of files to edit was generated with the following script:

list=`grep include external/heimdal/roken/roken.h.in                \
         | sed -e's/#include//g' | sort | uniq`;                    \
for A in `find . -name *.c | xargs grep -l roken.h                  \
             | grep -v external/ | grep -v WINNT/`; do              \
     found=0;                                                       \
     for B in $list; do                                             \
         if grep "$B" $A > /dev/null; then                          \
              echo "$A : $B";                                       \
              found=1;                                              \
         fi;                                                        \
     done;                                                          \
     if [ $found == 1 ] ; then mvim -f $A; fi;                      \
done

Change-Id: I2edbda550a129709b1dc6860b17d6a8a7509af58
Reviewed-on: http://gerrit.openafs.org/5815
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-12 14:14:14 -07:00
Michael Meffie
7a650025c5 Build: link libaudit before util
libaudit depends on util symbols, so link it first to avoid
unresolved symbols.  Include libaudit in the list of libs
instead of making it a special case.

Change-Id: Ide6d5f7e3ce8fd76b504088dcae3110872a87092
Reviewed-on: http://gerrit.openafs.org/6847
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-04-11 09:03:32 -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
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
Michael Meffie
79665a251d remove athena env conditionals
Remove the conditionals AFS_ATHENA_STDENV, AFS_ATHENA_ENV
and AFS_KERBREALM_ENV.

Change-Id: If58743acd7d71dd3ed05e76316ff3efd475ca123
Reviewed-on: http://gerrit.openafs.org/6963
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-03-27 18:55:54 -07:00
Simon Wilkinson
64b00c3a1a rx: Hide the rx_packet.h
Hide the rx_packet.h, and hence the rx_packet structure from
application view. rx_packet.h is currently still installed, and is
included directly by RX security classes, to reduce the per-packet
overhead there.

Change-Id: I269ccf4405a8f83cab4b0392b830bc1f36471c29
Reviewed-on: http://gerrit.openafs.org/6182
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2011-12-03 20:45:09 -08:00
Simon Wilkinson
d3eaa39da3 rx: Make the rx_call structure private
Hide the rx_call structure for public view. Provide accessors for
those elements which are currently accessed by applications.

Note that this change as it currently stands removes the visibility
of the last sent time, and sequence number information, from the
VolMonitor function.

Change-Id: Ib25ab5635126f893ae43acb684d92a78278d6ca6
Reviewed-on: http://gerrit.openafs.org/6181
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2011-12-03 20:44:39 -08:00
Simon Wilkinson
1c4cd44660 rx: Refactor MaxMTU error checking
The error checking on the rxMaxMTU parameter was done individually by
every server that sets it, using "internal" RX #defines to do so.
Instead, do the error checking within the function that actually sets
the MTU, reducing both the amount of code duplication, and the amount
of RX knowledge held within the servers.

Change-Id: Ic2cdd9425d5344a5137f76f66f711f4dee91a7b6
Reviewed-on: http://gerrit.openafs.org/6091
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2011-12-03 06:15:59 -08:00