#include "sudo_plugin.h"
#include "sudo_plugin_int.h"
-#ifndef RTLD_LOCAL
-# define RTLD_LOCAL 0
+#ifndef RTLD_GLOBAL
+# define RTLD_GLOBAL 0
#endif
+#ifdef _PATH_SUDO_NOEXEC
const char *noexec_path = _PATH_SUDO_NOEXEC;
+#endif
/*
* Read in /etc/sudo.conf
}
if (strcasecmp(name, "askpass") == 0)
askpass_path = estrdup(path);
+#ifdef _PATH_SUDO_NOEXEC
else if (strcasecmp(name, "noexec") == 0)
noexec_path = estrdup(path);
+#endif
continue;
}
tq_foreach_fwd(plugin_list, info) {
if (info->path[0] == '/') {
if (strlcpy(path, info->path, sizeof(path)) >= sizeof(path)) {
- warningx("%s: %s", info->path, strerror(ENAMETOOLONG));
+ warningx(_("%s: %s"), info->path, strerror(ENAMETOOLONG));
goto done;
}
} else {
if (snprintf(path, sizeof(path), "%s%s", _PATH_SUDO_PLUGIN_DIR,
info->path) >= sizeof(path)) {
- warningx("%s%s: %s", _PATH_SUDO_PLUGIN_DIR, info->path,
+ warningx(_("%s%s: %s"), _PATH_SUDO_PLUGIN_DIR, info->path,
strerror(ENAMETOOLONG));
goto done;
}
goto done;
}
if (sb.st_uid != ROOT_UID) {
- warningx("%s must be owned by uid %d", path, ROOT_UID);
+ warningx(_("%s must be owned by uid %d"), path, ROOT_UID);
goto done;
}
if ((sb.st_mode & (S_IWGRP|S_IWOTH)) != 0) {
- warningx("%s must be only be writable by owner", path);
+ warningx(_("%s must be only be writable by owner"), path);
goto done;
}
/* Open plugin and map in symbol */
- handle = dlopen(path, RTLD_LAZY|RTLD_LOCAL);
+ handle = dlopen(path, RTLD_LAZY|RTLD_GLOBAL);
if (!handle) {
- warningx("unable to dlopen %s: %s", path, dlerror());
+ warningx(_("unable to dlopen %s: %s"), path, dlerror());
goto done;
}
plugin = dlsym(handle, info->symbol_name);
if (!plugin) {
- warningx("unable to find symbol %s in %s", info->symbol_name, path);
+ warningx(_("%s: unable to find symbol %s"), path,
+ info->symbol_name);
goto done;
}
if (plugin->type != SUDO_POLICY_PLUGIN && plugin->type != SUDO_IO_PLUGIN) {
- warningx("%s: unknown policy type %d", path, plugin->type);
+ warningx(_("%s: unknown policy type %d"), path, plugin->type);
goto done;
}
if (SUDO_API_VERSION_GET_MAJOR(plugin->version) != SUDO_API_VERSION_MAJOR) {
- warningx("%s: incompatible policy major version %d, expected %d",
+ warningx(_("%s: incompatible policy major version %d, expected %d"),
path, SUDO_API_VERSION_GET_MAJOR(plugin->version),
SUDO_API_VERSION_MAJOR);
goto done;
}
if (plugin->type == SUDO_POLICY_PLUGIN) {
if (policy_plugin->handle) {
- warningx("only a single policy plugin may be loaded");
+ warningx(_("%s: only a single policy plugin may be loaded"),
+ conf_file);
goto done;
}
policy_plugin->handle = handle;
}
}
if (policy_plugin->handle == NULL) {
- warningx("%s: at least one policy plugin must be specified", conf_file);
+ warningx(_("%s: at least one policy plugin must be specified"),
+ conf_file);
goto done;
}
if (policy_plugin->u.policy->check_policy == NULL) {
- warningx("policy plugin %s does not include a check_policy method",
+ warningx(_("policy plugin %s does not include a check_policy method"),
policy_plugin->name);
goto done;
}