summaryrefslogtreecommitdiffstats
path: root/utils/gssd/write_bytes.h
diff options
context:
space:
mode:
authorneilbrown <neilbrown>2005-08-26 01:20:12 +0000
committerneilbrown <neilbrown>2005-08-26 01:20:12 +0000
commitc5ea2fbc9ab9d142aa867da594a66f4097df03d1 (patch)
treecd490f0e2dd0d087233f42b27ada3d9c9a44cda0 /utils/gssd/write_bytes.h
parent74a9c55e518cbd4ece01a2c57104222d9b675fb0 (diff)
downloadnfs-utils-c5ea2fbc9ab9d142aa867da594a66f4097df03d1.tar.gz
nfs-utils-c5ea2fbc9ab9d142aa867da594a66f4097df03d1.tar.xz
nfs-utils-c5ea2fbc9ab9d142aa867da594a66f4097df03d1.zip
2005-08-26 Kevin Coffman <kwc@citi.umich.edu>
* configure.in etc Consolidate some of the Kerberos checking instead of repeating the same things for MIT and Heimdal. Also adds more checks to distinguish 32-bit from 64-bit (mainly for gssapi.h) Fix svcgssd Makefile so make TOP=../../ works correctly there. Enable running a modern autoheader. * utils/gssd/gss_oids.c: Use correct OID value for SPKM-3 * utils/gssd/gss_util.c: Fix build with older MIT releases that do not define GSS_C_NT_HOSTBASED_SERVICE * utils/gssd/write_bytes.h, support/include/gssapi/gssapi.h: Length of gss_buffer_desc is a size_t which is 64-bits on a 64-bit machine. Kernel code expects 32-bit integer for length. Coerce length value into a 32-bit value when reading from or writing to the kernel. Change gssapi.h to use datatype size values obtained from configure rather than hard-coded values. * utils/idmapd/idmapd.c: The EV_INIT check here was wrong, and was causing idmapd to become unresponsive to server requests after receiving a sighup. * utils/idmapd/idmapd.c: Idmapd should flush the server id<->name caches when its started.
Diffstat (limited to 'utils/gssd/write_bytes.h')
-rw-r--r--utils/gssd/write_bytes.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/utils/gssd/write_bytes.h b/utils/gssd/write_bytes.h
index ba00598..f166148 100644
--- a/utils/gssd/write_bytes.h
+++ b/utils/gssd/write_bytes.h
@@ -53,12 +53,13 @@ write_bytes(char **ptr, const char *end, const void *arg, int arg_len)
inline static int
write_buffer(char **p, char *end, gss_buffer_desc *arg)
{
- if (WRITE_BYTES(p, end, arg->length))
+ int len = (int)arg->length; /* make an int out of size_t */
+ if (WRITE_BYTES(p, end, len))
return -1;
if (*p + arg->length > end)
return -1;
- memcpy(*p, arg->value, arg->length);
- *p += arg->length;
+ memcpy(*p, arg->value, len);
+ *p += len;
return 0;
}
@@ -80,8 +81,10 @@ get_buffer(char **ptr, const char *end, gss_buffer_desc *res)
{
char *p, *q;
p = *ptr;
- if (get_bytes(&p, end, &res->length, sizeof(res->length)))
+ int len;
+ if (get_bytes(&p, end, &len, sizeof(len)))
return -1;
+ res->length = len; /* promote to size_t if necessary */
q = p + res->length;
if (q > end || q < p)
return -1;
@@ -105,9 +108,11 @@ static inline int
xdr_get_buffer(u_int32_t **ptr, const u_int32_t *end, gss_buffer_desc *res)
{
u_int32_t *p, *q;
+ u_int32_t len;
p = *ptr;
- if (xdr_get_u32(&p, end, &res->length))
+ if (xdr_get_u32(&p, end, &len))
return -1;
+ res->length = len;
q = p + ((res->length + 3) >> 2);
if (q > end || q < p)
return -1;
@@ -130,7 +135,8 @@ xdr_write_u32(u_int32_t **ptr, const u_int32_t *end, u_int32_t arg)
static inline int
xdr_write_buffer(u_int32_t **ptr, const u_int32_t *end, gss_buffer_desc *arg)
{
- if (xdr_write_u32(ptr, end, arg->length))
+ int len = arg->length;
+ if (xdr_write_u32(ptr, end, len))
return -1;
return write_bytes((char **)ptr, (char *)end, arg->value,
(arg->length + 3) & ~3);