exclude_file_name_regexp--sc_prohibit_dirent_d_type = \
^(src/util/vircgroup.c)$
+
+exclude_file_name_regexp--sc_prohibit_strcmp = \
+ ^(tools/nss/libvirt_nss.*\.c)
-I$(top_srcdir) \
$(NULL)
+# We do not want to accidentally include stuff from gnulib
+# or the main src/ dir or public API dir. Specific files can
+# still be included via their path relative to the root if
+# needed
+STANDALONE_CPPFLAGS = -I$(top_srcdir)
+
WARN_CFLAGS += $(STRICT_FRAME_LIMIT_CFLAGS)
AM_CFLAGS = \
virt_login_shell_SOURCES = \
virt-login-shell.c
+virt_login_shell_CPPFLAGS = $(STANDALONE_CPPFLAGS)
+
virt_login_shell_helper_SOURCES = \
virt-login-shell-helper.c
nss_libnss_libvirt_impl_la_SOURCES = \
$(LIBVIRT_NSS_SOURCES)
+nss_libnss_libvirt_impl_la_CPPFLAGS = $(STANDALONE_CPPFLAGS)
nss_libnss_libvirt_impl_la_CFLAGS = \
-DLIBVIRT_NSS \
$(YAJL_CFLAGS) \
nss/libvirt_nss_macs.c \
$(NULL)
+nss_libnss_libvirt_guest_impl_la_CPPFLAGS = $(STANDALONE_CPPFLAGS)
nss_libnss_libvirt_guest_impl_la_CFLAGS = \
-DLIBVIRT_NSS \
-DLIBVIRT_NSS_GUEST \
#include <dirent.h>
#include <arpa/inet.h>
#include <stdlib.h>
+#include <stdbool.h>
+#include <errno.h>
#include <string.h>
#include <time.h>
# include <nsswitch.h>
#endif
-#include "configmake.h"
+/*
+ * This gnulib files is used for its macros only,
+ * so doesn't introduce a link time dep, which we
+ * must avoid
+ */
+#include "gnulib/lib/configmake.h"
#include "libvirt_nss_leases.h"
char *path;
size_t dlen = strlen(entry->d_name);
- if (dlen >= 7 && STREQ(entry->d_name + dlen - 7, ".status")) {
+ if (dlen >= 7 && !strcmp(entry->d_name + dlen - 7, ".status")) {
char **tmpLease;
if (asprintf(&path, "%s/%s", leaseDir, entry->d_name) < 0)
goto cleanup;
leaseFiles = tmpLease;
leaseFiles[nleaseFiles++] = path;
#if defined(LIBVIRT_NSS_GUEST)
- } else if (dlen >= 5 && STREQ(entry->d_name + dlen - 5, ".macs")) {
+ } else if (dlen >= 5 && !strcmp(entry->d_name + dlen - 5, ".macs")) {
if (asprintf(&path, "%s/%s", leaseDir, entry->d_name) < 0)
goto cleanup;
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <fcntl.h>
#include <yajl/yajl_gen.h>
static int
-appendAddr(const char *name ATTRIBUTE_UNUSED,
+appendAddr(const char *name __attribute__((unused)),
leaseAddress **tmpAddress,
size_t *ntmpAddress,
const char *ipAddr,
return 0;
if (parser->state == FIND_LEASES_STATE_ENTRY) {
- if (STRNEQ(parser->key, "expiry-time"))
+ if (strcmp(parser->key, "expiry-time"))
return 0;
parser->entry.expiry = val;
return 0;
if (parser->state == FIND_LEASES_STATE_ENTRY) {
- if (STREQ(parser->key, "ip-address")) {
+ if (!strcmp(parser->key, "ip-address")) {
if (!(parser->entry.ipaddr = strndup((char *)stringVal, stringLen)))
return 0;
- } else if (STREQ(parser->key, "mac-address")) {
+ } else if (!strcmp(parser->key, "mac-address")) {
if (!(parser->entry.macaddr = strndup((char *)stringVal, stringLen)))
return 0;
- } else if (STREQ(parser->key, "hostname")) {
+ } else if (!strcmp(parser->key, "hostname")) {
if (!(parser->entry.hostname = strndup((char *)stringVal, stringLen)))
return 0;
} else {
DEBUG("Check %zu macs", parser->nmacs);
for (i = 0; i < parser->nmacs && !found; i++) {
DEBUG("Check mac '%s' vs '%s'", parser->macs[i], NULLSTR(parser->entry.macaddr));
- if (STREQ_NULLABLE(parser->macs[i], parser->entry.macaddr))
+ if (parser->entry.macaddr && !strcmp(parser->macs[i], parser->entry.macaddr))
found = true;
}
} else {
DEBUG("Check name '%s' vs '%s'", parser->name, NULLSTR(parser->entry.hostname));
- if (STREQ_NULLABLE(parser->name, parser->entry.hostname))
+ if (parser->entry.hostname && !strcmp(parser->name, parser->entry.hostname))
found = true;
}
DEBUG("Found %d", found);
#pragma once
-#include "internal.h"
+#include <sys/types.h>
typedef struct {
unsigned char addr[16];
return 0;
if (parser->state == FIND_MACS_STATE_ENTRY) {
- if (STRNEQ(parser->key, "domain"))
+ if (strcmp(parser->key, "domain"))
return 0;
free(parser->entry.name);
return 0;
} else if (parser->state == FIND_MACS_STATE_ENTRY_MACS) {
char **macs;
- if (STRNEQ(parser->key, "macs"))
+ if (strcmp(parser->key, "macs"))
return 0;
if (!(macs = realloc(parser->entry.macs,
if (parser->state != FIND_MACS_STATE_ENTRY)
return 0;
- if (STREQ(parser->entry.name, parser->name)) {
+ if (!strcmp(parser->entry.name, parser->name)) {
char **macs = realloc(*parser->macs,
sizeof(char *) * ((*parser->nmacs) + parser->entry.nmacs));
if (!macs)
#pragma once
-#include "internal.h"
+#include <sys/types.h>
int
findMACs(const char *file,
#include <errno.h>
#include <string.h>
-#include "configmake.h"
-#include "intprops.h"
+/*
+ * These gnulib files are used for their macros only,
+ * so don't introduce a link time dep, which we must avoid
+ */
+#include "gnulib/lib/configmake.h"
+#include "gnulib/lib/intprops.h"
int main(int argc, char **argv) {
char uidstr[INT_BUFSIZE_BOUND(uid_t)];