summaryrefslogtreecommitdiffstats
path: root/utils/gssd
diff options
context:
space:
mode:
Diffstat (limited to 'utils/gssd')
-rw-r--r--utils/gssd/gss_oids.c2
-rw-r--r--utils/gssd/gss_util.c4
-rw-r--r--utils/gssd/write_bytes.h18
3 files changed, 17 insertions, 7 deletions
diff --git a/utils/gssd/gss_oids.c b/utils/gssd/gss_oids.c
index e800115..c569b0c 100644
--- a/utils/gssd/gss_oids.c
+++ b/utils/gssd/gss_oids.c
@@ -36,4 +36,4 @@ gss_OID_desc krb5oid =
{9, "\052\206\110\206\367\022\001\002\002"};
gss_OID_desc spkm3oid =
- {7, "\052\006\001\005\005\001\003"};
+ {7, "\053\006\001\005\005\001\003"};
diff --git a/utils/gssd/gss_util.c b/utils/gssd/gss_util.c
index 3493280..cf240ac 100644
--- a/utils/gssd/gss_util.c
+++ b/utils/gssd/gss_util.c
@@ -73,6 +73,10 @@
#include <netdb.h>
#include <fcntl.h>
#include <gssapi/gssapi.h>
+#if defined(HAVE_KRB5) && !defined(GSS_C_NT_HOSTBASED_SERVICE)
+#include <gssapi/gssapi_generic.h>
+#define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
+#endif
#include "gss_util.h"
#include "err_util.h"
#include "gssd.h"
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);