(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.
2005-04-12 G. Allen Morris III <gam3@gam3.net>
-/* This is the gssapi.h prologue. */
-/* It contains some choice pieces of autoconf.h */
-#define SIZEOF_INT 4
-#define SIZEOF_LONG 4
-#define SIZEOF_SHORT 2
-#define HAVE_STDARG_H 1
-/* #undef HAVE_VARARGS_H */
-/* #undef HAVE_MACSOCK_H */
-#define HAVE_NETINET_IN_H 1
-#define HAVE_STDDEF_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STRING_H 1
-#define HAVE_SYS_FILE_H 1
-#define HAVE_SYS_PARAM_H 1
-#define HAVE_SYS_SOCKET_H 1
-#define HAVE_SYS_STAT_H 1
-#define HAVE_SYS_TIME_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_UNISTD_H 1
-/* #undef HAVE_XOM_H */
-#define USE_DIRENT_H 1
-/* End of gssapi.h prologue. */
/*
* Copyright 1993 by OpenVision Technologies, Inc.
*
#ifndef _GSSAPI_H_
#define _GSSAPI_H_
+#include "config.h"
+
/*
* Determine platform-dependent configuration.
*/
#endif /* HAVE_XOM_H */
/*
- * $Id: gssapi.h,v 1.1 2004/10/19 00:22:57 neilbrown Exp $
+ * $Id: gssapi.h,v 1.2 2005/08/26 01:20:12 neilbrown Exp $
*/
/*
{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"};
#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"
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;
}
{
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;
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;
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);
/* Used by cfg.c */
char *conf_path;
+static int
+flush_nfsd_cache(char *path, time_t now)
+{
+ int fd;
+ char stime[20];
+
+ sprintf(stime, "%ld\n", now);
+ fd = open(path, O_RDWR);
+ if (fd == -1)
+ return -1;
+ write(fd, stime, strlen(stime));
+ close(fd);
+ return 0;
+}
+
+static int
+flush_nfsd_idmap_cache(void)
+{
+ time_t now = time(NULL);
+ int ret;
+
+ ret = flush_nfsd_cache("/proc/net/rpc/nfs4.idtoname/flush", now);
+ if (ret)
+ return ret;
+ ret = flush_nfsd_cache("/proc/net/rpc/nfs4.nametoid/flush", now);
+ return ret;
+}
+
int
main(int argc, char **argv)
{
struct stat sb;
char *xpipefsdir = NULL;
int serverstart = 1, clientstart = 1;
+ int ret;
conf_path = _PATH_IDMAPDCONF;
nobodyuser = NFS4NOBODY_USER;
event_init();
- if (serverstart)
+ if (serverstart) {
nfsdret = nfsdopen(NFSD_DIR);
+ if (nfsdret == 0) {
+ ret = flush_nfsd_idmap_cache();
+ if (ret)
+ errx(1, "Failed to flush nfsd idmap cache\n");
+ }
+ }
if (clientstart) {
struct timeval now = {
if (ic->ic_fd != -1)
close(ic->ic_fd);
ic->ic_event.ev_fd = ic->ic_fd = fd;
- if ((ic->ic_event.ev_flags & EVLIST_INIT) == 0) {
- event_set(&ic->ic_event, ic->ic_fd, EV_READ, nfsdcb, ic);
- event_add(&ic->ic_event, NULL);
- }
+ event_set(&ic->ic_event, ic->ic_fd, EV_READ, nfsdcb, ic);
+ event_add(&ic->ic_event, NULL);
} else {
warnx("nfsdreopen: Opening '%s' failed: errno %d (%s)",
ic->ic_path, errno, strerror(errno));