add an entry in nsswitch.conf and remove on purge for the sudo-ldap package
[debian/sudo] / src / load_plugins.c
index 68be4237db05d4b513d7a97d3c22f1be8690e16e..6bee3f8471dd7f46b6e48e5c24fcc9e3ea07fef3 100644 (file)
 #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
@@ -83,8 +85,10 @@ sudo_read_conf(const char *conf_file)
            }
            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;
        }
 
@@ -151,13 +155,13 @@ sudo_load_plugins(const char *conf_file,
     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;
            }
@@ -167,39 +171,41 @@ sudo_load_plugins(const char *conf_file,
            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;
@@ -216,11 +222,12 @@ sudo_load_plugins(const char *conf_file,
        }
     }
     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;
     }