*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
-#include "config.h"
+
#include <sys/param.h>
#include <rpc/rpc.h>
#include <sys/stat.h>
#include "gssd.h"
#include "err_util.h"
#include "gss_util.h"
-#include "gss_oids.h"
#include "krb5_util.h"
#include "context.h"
read_service_info(char *info_file_name, char **servicename, char **servername,
int *prog, int *vers, char **protocol, int *port) {
#define INFOBUFLEN 256
- char buf[INFOBUFLEN];
+ char buf[INFOBUFLEN + 1];
static char dummy[128];
int nbytes;
static char service[128];
if ((nbytes = read(fd, buf, INFOBUFLEN)) == -1)
goto fail;
close(fd);
+ buf[nbytes] = '\0';
numfields = sscanf(buf,"RPC server: %127s\n"
"service: %127s %15s version %15s\n"
fail:
printerr(0, "ERROR: failed to read service info\n");
if (fd != -1) close(fd);
- if (*servername) free(*servername);
- if (*servicename) free(*servicename);
- if (*protocol) free(*protocol);
+ free(*servername);
+ free(*servicename);
+ free(*protocol);
+ *servicename = *servername = *protocol = NULL;
return -1;
}
if (clp->dir_fd != -1) close(clp->dir_fd);
if (clp->krb5_fd != -1) close(clp->krb5_fd);
if (clp->spkm3_fd != -1) close(clp->spkm3_fd);
- if (clp->dirname) free(clp->dirname);
- if (clp->servicename) free(clp->servicename);
- if (clp->servername) free(clp->servername);
- if (clp->protocol) free(clp->protocol);
+ free(clp->dirname);
+ free(clp->servicename);
+ free(clp->servername);
+ free(clp->protocol);
free(clp);
}
out:
if (token.value)
free(token.value);
+#ifndef HAVE_LIBTIRPC
if (pd.pd_ctx_hndl.length != 0)
authgss_free_private_data(&pd);
+#endif
if (auth)
AUTH_DESTROY(auth);
if (rpc_clnt)