]> granicus.if.org Git - sudo/commitdiff
Add function name to "unable to allocate memory" warnings.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 19 Jun 2015 20:51:17 +0000 (14:51 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 19 Jun 2015 20:51:17 +0000 (14:51 -0600)
37 files changed:
lib/util/aix.c
lib/util/gidlist.c
lib/util/sudo_conf.c
plugins/sudoers/auth/pam.c
plugins/sudoers/auth/rfc1938.c
plugins/sudoers/defaults.c
plugins/sudoers/editor.c
plugins/sudoers/env.c
plugins/sudoers/gram.c
plugins/sudoers/gram.y
plugins/sudoers/group_plugin.c
plugins/sudoers/iolog.c
plugins/sudoers/iolog_path.c
plugins/sudoers/ldap.c
plugins/sudoers/linux_audit.c
plugins/sudoers/logging.c
plugins/sudoers/match.c
plugins/sudoers/parse.c
plugins/sudoers/policy.c
plugins/sudoers/prompt.c
plugins/sudoers/sssd.c
plugins/sudoers/sudoers.c
plugins/sudoers/sudoers_debug.c
plugins/sudoers/sudoreplay.c
plugins/sudoers/testsudoers.c
plugins/sudoers/visudo.c
src/conversation.c
src/exec.c
src/exec_common.c
src/exec_pty.c
src/load_plugins.c
src/parse_args.c
src/preserve_fds.c
src/selinux.c
src/sesh.c
src/sudo.c
src/sudo_edit.c

index 9ff06d921b6b81664843d5dc260c75e1447aaddb..c8966bbdc90be1e1ae9e9a78f41a155adcbbe212 100644 (file)
@@ -202,7 +202,7 @@ aix_prep_user_v1(char *user, const char *tty)
     len = asprintf(&info, "NAME=%s%cLOGIN=%s%cLOGNAME=%s%cTTY=%s%c",
        user, '\0', user, '\0', user, '\0', tty ? tty : "", '\0');
     if (len == -1) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_int(-1);
     }
     (void)usrinfo(SETUINFO, info, len);
index e108cacd9c8b51206d1e0ba640579924e112c517..cd30e79cfee35483f267f32db04bc0f83878472c 100644 (file)
@@ -62,7 +62,7 @@ sudo_parse_gids_v1(const char *gidstr, const gid_t *basegid, GETGROUPS_T **gidsp
     if (ngids != 0) {
        gids = reallocarray(NULL, ngids, sizeof(GETGROUPS_T));
        if (gids == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            debug_return_int(-1);
        }
        ngids = 0;
index 9e8961178f4fd51949b4c7a15f10de0f49817b71..d02eb7be23d1b4a94976989b1ba0739656d844dc 100644 (file)
@@ -185,7 +185,7 @@ parse_path(const char *entry, const char *conf_file, unsigned int lineno)
        if (namelen == cur->pnamelen &&
            strncasecmp(name, cur->pname, cur->pnamelen) == 0) {
            if ((cur->pval = strdup(path)) == NULL) {
-               sudo_warnx(U_("unable to allocate memory"));
+               sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                debug_return_int(-1);
                break;
            }
@@ -265,7 +265,7 @@ parse_debug(const char *entry, const char *conf_file, unsigned int lineno)
 
     debug_return_int(true);
 oom:
-    sudo_warnx(U_("unable to allocate memory"));
+    sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     if (debug_file != NULL) {
        free(debug_file->debug_file);
        free(debug_file->debug_flags);
@@ -342,7 +342,7 @@ parse_plugin(const char *entry, const char *conf_file, unsigned int lineno)
 
     debug_return_int(true);
 oom:
-    sudo_warnx(U_("unable to allocate memory"));
+    sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     if (options != NULL) {
        while (nopts--)
            free(options[nopts]);
@@ -541,7 +541,7 @@ sudo_conf_read_v1(const char *conf_file, int conf_types)
 
     prev_locale = strdup(setlocale(LC_ALL, NULL));
     if (prev_locale == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_int(-1);
     }
 
index 79b3a4d85088ee6de89aeffadb59f45aecb10f30..d1bfc97327d308bf19f83134a18f3bbc0211bb57 100644 (file)
@@ -370,7 +370,7 @@ converse(int num_msg, PAM_CONST struct pam_message **msg,
                    goto done;
                }
                if ((pr->resp = strdup(pass)) == NULL) {
-                   sudo_warnx(U_("unable to allocate memory"));
+                   sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                    ret = PAM_BUF_ERR;
                    goto done;
                }
index f39a76520ca74ae313930350baa60a8117e5c748..f336a7c0be3083c6a33e349fa02d8a07baed8f64 100644 (file)
@@ -109,7 +109,7 @@ sudo_rfc1938_setup(struct passwd *pw, char **promptp, sudo_auth *auth)
     if (np_size < op_len + challenge_len + 7) {
        char *p = realloc(new_prompt, op_len + challenge_len + 7);
        if (p == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            debug_return_int(AUTH_FATAL);
        }
        np_size = op_len + challenge_len + 7;
index 723d4b1bb66391428ad128119caea39c62a493e7..0e2bf355578ce3c1175a97364437853789163eaa 100644 (file)
@@ -516,7 +516,7 @@ init_defaults(void)
 
     debug_return_bool(true);
 oom:
-    sudo_warnx(U_("unable to allocate memory"));
+    sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     debug_return_bool(false);
 }
 
@@ -720,7 +720,7 @@ store_str(char *val, struct sudo_defs_types *def, int op)
        def->sd_un.str = NULL;
     } else {
        if ((def->sd_un.str = strdup(val)) == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            debug_return_int(-1);
        }
     }
@@ -880,7 +880,7 @@ list_op(char *val, size_t len, struct sudo_defs_types *def, enum list_ops op)
     if (op == add) {
        cur = calloc(1, sizeof(struct list_member));
        if (cur == NULL || (cur->value = strndup(val, len)) == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            free(cur);
            debug_return_bool(false);
        }
index 9bb2f9d5308898a85c4ea4e015dba77d328f96db..25c1196e51ab35593542a255634c3fc5a5824793 100644 (file)
@@ -64,7 +64,7 @@ resolve_editor(const char *ed, size_t edlen, int nfiles, char **files,
        debug_return_str(NULL);
     editor = strndup(cp, (size_t)(ep - cp));
     if (editor == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_str(NULL);
     }
 
@@ -82,7 +82,7 @@ resolve_editor(const char *ed, size_t edlen, int nfiles, char **files,
        nargc += nfiles + 1;
     nargv = reallocarray(NULL, nargc + 1, sizeof(char *));
     if (nargv == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        free(editor);
        debug_return_str(NULL);
     }
@@ -92,7 +92,7 @@ resolve_editor(const char *ed, size_t edlen, int nfiles, char **files,
     for (nargc = 1; (cp = sudo_strsplit(NULL, edend, " \t", &ep)) != NULL; nargc++) {
        nargv[nargc] = strndup(cp, (size_t)(ep - cp));
        if (nargv[nargc] == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            while (nargc--)
                free(nargv[nargc]);
            debug_return_str(NULL);
index 8bbe6590af5054978bf68273f9ee079b09fcba17..24273f0d00e6ca9dad186002138c022d761ed12d 100644 (file)
@@ -233,7 +233,7 @@ env_init(char * const envp[])
        if (env.envp == NULL) {
            env.env_size = 0;
            env.env_len = 0;
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            debug_return_bool(false);
        }
 #ifdef ENV_DEBUG
index 36dd38c2f9e9071cdc123cee42e24617449f4f6f..fbacdad7bebeaa7370c80057c26feea288e6dbea 100644 (file)
@@ -964,14 +964,14 @@ init_parser(const char *path, bool quiet)
     init_lexer();
 
     if (!init_aliases()) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        rval = false;
     }
 
     free(sudoers);
     if (path != NULL) {
        if ((sudoers = strdup(path)) == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            rval = false;
        }
     } else {
index 9855acc2bf027c3d1b6821255efc6729054e3c91..ad336f4758c9855bb978a2fa4601d36cb966e567 100644 (file)
@@ -1109,14 +1109,14 @@ init_parser(const char *path, bool quiet)
     init_lexer();
 
     if (!init_aliases()) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        rval = false;
     }
 
     free(sudoers);
     if (path != NULL) {
        if ((sudoers = strdup(path)) == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            rval = false;
        }
     } else {
index 705f520870437af6fcfed05ec4bc29539fc97add..2d1395cc7224f0afa7003715d3f322422512c1aa 100644 (file)
@@ -131,7 +131,7 @@ group_plugin_load(char *plugin_info)
        if (ac != 0) {
            argv = reallocarray(NULL, ac, sizeof(char *));
            if (argv == NULL) {
-               sudo_warnx(U_("unable to allocate memory"));
+               sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                goto done;
            }
            ac = 0;
index eec727d18a99b3e4c4c6ad0a471d0bfddfeaa66b..af32dc69ca6ae2ffbe7c9b27d125aaad5f21a841 100644 (file)
@@ -582,7 +582,7 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
     bindtextdomain("sudoers", LOCALEDIR);
 
     if (sudo_setpwent() == -1 || sudo_setgrent() == -1) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_int(-1);
     }
 
@@ -614,7 +614,7 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
        /* Get next session ID and convert it into a path. */
        tofree = malloc(sizeof(_PATH_SUDO_IO_LOGDIR) + sizeof(sessid) + 2);
        if (tofree == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            goto done;
        }
        memcpy(tofree, _PATH_SUDO_IO_LOGDIR, sizeof(_PATH_SUDO_IO_LOGDIR));
index e391462d4342b3b0b557327fedcab6957304b243..3fed9544587dfd771ec56966038b9579f0cd2afe 100644 (file)
@@ -165,7 +165,7 @@ expand_iolog_path(const char *prefix, const char *dir, const char *file,
        prelen = strlen(prefix);
     dst = path = malloc(prelen + PATH_MAX);
     if (path == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        goto bad;
     }
     *path = '\0';
index 2cdaffe8740e4b637c76a0eef3751da076bede38..e074dd99fec5ec20e09a76482eb773818c798259 100644 (file)
@@ -445,7 +445,7 @@ sudo_ldap_conf_add_ports(void)
 
     free(ldap_conf.host);
     if ((ldap_conf.host = strdup(hostbuf)) == NULL)
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     debug_return_bool(ldap_conf.host != NULL);
 
 overflow:
@@ -476,7 +476,7 @@ sudo_ldap_parse_uri(const struct ldap_config_str_list *uri_list)
 
        buf = strdup(entry->val);
        if (buf == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            goto done;
        }
        for ((uri = strtok_r(buf, " \t", &last)); uri != NULL; (uri = strtok_r(NULL, " \t", &last))) {
@@ -528,7 +528,7 @@ sudo_ldap_parse_uri(const struct ldap_config_str_list *uri_list)
     /* Store parsed URI(s) in host for ldap_create() or ldap_init(). */
     free(ldap_conf.host);
     if ((ldap_conf.host = strdup(hostbuf)) == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        goto done;
     }
 
@@ -561,7 +561,7 @@ sudo_ldap_join_uri(struct ldap_config_str_list *uri_list)
        len += strlen(uri->val) + 1;
     }
     if (len == 0 || (buf = malloc(len)) == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     } else {
        char *cp = buf;
 
@@ -913,7 +913,7 @@ sudo_ldap_extract_digest(char **cmnd, struct sudo_digest *digest)
                    digest->digest_type = digest_type;
                    digest->digest_str = strndup(cp, (size_t)(ep - cp));
                    if (digest->digest_str == NULL) {
-                       sudo_warnx(U_("unable to allocate memory"));
+                       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                        debug_return_ptr(NULL);
                    }
                    cp = ep + 1;
@@ -1059,7 +1059,7 @@ sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry)
     /* walk through options */
     for (p = bv; *p != NULL; p++) {
        if ((var = strdup((*p)->bv_val)) == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            goto done;
        }
        DPRINTF2("ldap sudoOption: '%s'", var);
@@ -1338,7 +1338,7 @@ sudo_netgroup_lookup_nested(LDAP *ld, char *base, struct timeval *timeout,
 
     debug_return_bool(true);
 oom:
-    sudo_warnx(U_("unable to allocate memory"));
+    sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     if (result)
        ldap_msgfree(result);
     debug_return_bool(false);
@@ -1511,7 +1511,7 @@ sudo_netgroup_lookup(LDAP *ld, struct passwd *pw,
     }
     debug_return_bool(true);
 oom:
-    sudo_warnx(U_("unable to allocate memory"));
+    sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     ldap_msgfree(result);
     debug_return_bool(false);
 overflow:
@@ -1587,7 +1587,7 @@ sudo_ldap_build_pass1(LDAP *ld, struct passwd *pw)
     if (ldap_conf.timed)
        sz += TIMEFILTER_LENGTH;
     if ((buf = malloc(sz)) == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_str(NULL);
     }
     *buf = '\0';
@@ -1723,7 +1723,7 @@ sudo_ldap_build_pass2(void)
            (ldap_conf.timed || ldap_conf.search_filter) ? ")" : "");
     }
     if (len == -1)
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
 
     debug_return_str(filt);
 }
@@ -1747,7 +1747,7 @@ sudo_ldap_decode_secret(const char *secret)
        reslen = ((strlen(secret) + 3) / 4 * 3);
        result = malloc(reslen + 1);
        if (result == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        } else {
            len = base64_decode(secret, result, reslen);
            if (len == (size_t)-1) {
@@ -1777,7 +1777,7 @@ sudo_ldap_read_secret(const char *path)
            ldap_conf.bindpw = sudo_ldap_decode_secret(buf);
            if (ldap_conf.bindpw == NULL) {
                if ((ldap_conf.bindpw = strdup(buf)) == NULL)
-                   sudo_warnx(U_("unable to allocate memory"));
+                   sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            }
            free(ldap_conf.binddn);
            ldap_conf.binddn = ldap_conf.rootbinddn;
@@ -1830,7 +1830,7 @@ sudo_ldap_parse_keyword(const char *keyword, const char *value,
 
                    free(*(char **)(cur->valp));
                    if (*value && (cp = strdup(value)) == NULL) {
-                       sudo_warnx(U_("unable to allocate memory"));
+                       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                        debug_return_bool(false);
                    }
                    *(char **)(cur->valp) = cp;
@@ -1845,7 +1845,7 @@ sudo_ldap_parse_keyword(const char *keyword, const char *value,
                    if (len > 0) {
                        head = (struct ldap_config_str_list *)cur->valp;
                        if ((str = malloc(sizeof(*str) + len)) == NULL) {
-                           sudo_warnx(U_("unable to allocate memory"));
+                           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                            debug_return_bool(false);
                        }
                        memcpy(str->val, value, len + 1);
@@ -1941,7 +1941,7 @@ sudo_ldap_read_config(void)
     STAILQ_INIT(&ldap_conf.netgroup_base);
 
     if (ldap_conf.search_filter == NULL || ldap_conf.netgroup_search_filter == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_bool(false);
     }
 
@@ -1974,7 +1974,7 @@ sudo_ldap_read_config(void)
     if (!ldap_conf.host) {
        ldap_conf.host = strdup("localhost");
        if (ldap_conf.host == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            debug_return_bool(false);
        }
     }
@@ -2127,7 +2127,7 @@ sudo_ldap_read_config(void)
        cp = ldap_conf.search_filter;
        ldap_conf.search_filter = malloc(len + 3);
        if (ldap_conf.search_filter == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            debug_return_bool(false);
        }
        ldap_conf.search_filter[0] = '(';
@@ -2224,7 +2224,7 @@ sudo_ldap_display_defaults(struct sudo_nss *nss, struct passwd *pw,
 
     filt = sudo_ldap_build_default_filter();
     if (filt == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        goto done;
     }
     STAILQ_FOREACH(base, &ldap_conf.base, entries) {
@@ -3021,7 +3021,7 @@ sudo_ldap_open(struct sudo_nss *nss)
     /* Create a handle container. */
     handle = calloc(1, sizeof(struct sudo_ldap_handle));
     if (handle == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        rc = -1;
        goto done;
     }
@@ -3054,7 +3054,7 @@ sudo_ldap_setdefs(struct sudo_nss *nss)
 
     filt = sudo_ldap_build_default_filter();
     if (filt == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_int(-1);
     }
     DPRINTF1("Looking for cn=defaults: %s", filt);
@@ -3367,7 +3367,7 @@ sudo_ldap_result_get(struct sudo_nss *nss, struct passwd *pw)
      */
     lres = sudo_ldap_result_alloc();
     if (lres == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_ptr(NULL);
     }
     for (pass = 0; pass < 2; pass++) {
@@ -3395,7 +3395,7 @@ sudo_ldap_result_get(struct sudo_nss *nss, struct passwd *pw)
                /* Add the seach result to list of search results. */
                DPRINTF1("adding search result");
                if (sudo_ldap_result_add_search(lres, ld, result) == NULL) {
-                   sudo_warnx(U_("unable to allocate memory"));
+                   sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                    free(filt);
                    sudo_ldap_result_free(lres);
                    debug_return_ptr(NULL);
@@ -3406,7 +3406,7 @@ sudo_ldap_result_get(struct sudo_nss *nss, struct passwd *pw)
                        sudo_ldap_check_host(ld, entry)) {
                        lres->host_matches = true;
                        if (sudo_ldap_result_add_entry(lres, entry) == NULL) {
-                           sudo_warnx(U_("unable to allocate memory"));
+                           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                            free(filt);
                            sudo_ldap_result_free(lres);
                            debug_return_ptr(NULL);
@@ -3494,7 +3494,7 @@ sudo_ldap_result_from_search(LDAP *ldap, LDAPMessage *searchresult)
      */
     result = sudo_ldap_result_alloc();
     if (result == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_ptr(NULL);
     }
 
@@ -3510,7 +3510,7 @@ sudo_ldap_result_from_search(LDAP *ldap, LDAPMessage *searchresult)
      */
     LDAP_FOREACH(entry, last->ldap, last->searchresult) {
        if (sudo_ldap_result_add_entry(result, entry) == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            sudo_ldap_result_free(result);
            result = NULL;
            break;
index 187d46a587ee60b063131129c65e74a1b007c30f..1b068f6e2272cbc07f23db1dea61fd68f4afb271 100644 (file)
@@ -74,7 +74,7 @@ linux_audit_command(char *argv[], int result)
        size += strlen(*av) + 1;
     command = cp = malloc(size);
     if (command == NULL) {
-       sudo_warn(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        goto done;
     }
     for (av = argv; *av != NULL; av++) {
index c637c5ab769764bddb1d837e31815a93e897c002..fa57207be071abc22ae42268f85300c2dc1f4ed6 100644 (file)
@@ -188,7 +188,7 @@ do_logfile(const char *msg)
            if (!ferror(fp))
                rval = true;
        } else {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        }
        (void) fclose(fp);
     }
@@ -912,7 +912,7 @@ new_logline(const char *message, int serrno)
     debug_return_str(line);
 oom:
     free(evstr);
-    sudo_warnx(U_("unable to allocate memory"));
+    sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     debug_return_str(NULL);
 toobig:
     free(evstr);
index 4804e91a1162773e5b0e043291103bea696c2d58..1c0d400be4fd956dec9c5b43482a5f0d019e8a54 100644 (file)
@@ -516,7 +516,7 @@ command_matches_glob(const char *sudoers_cmnd, const char *sudoers_args)
            user_stat->st_ino == sudoers_stat.st_ino)) {
            free(safe_cmnd);
            if ((safe_cmnd = strdup(cp)) == NULL) {
-               sudo_warnx(U_("unable to allocate memory"));
+               sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                cp = NULL;              /* fail closed */
            }
            break;
@@ -552,7 +552,7 @@ command_matches_normal(const char *sudoers_cmnd, const char *sudoers_args, const
            free(safe_cmnd);
            if ((safe_cmnd = strdup(sudoers_cmnd)) != NULL)
                debug_return_bool(true);
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        }
     }
     debug_return_bool(false);
@@ -710,7 +710,7 @@ command_matches_normal(const char *sudoers_cmnd, const char *sudoers_args, const
     }
     free(safe_cmnd);
     if ((safe_cmnd = strdup(sudoers_cmnd)) == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_bool(false);
     }
     debug_return_bool(true);
@@ -767,7 +767,7 @@ command_matches_dir(const char *sudoers_dir, size_t dlen)
            user_stat->st_ino == sudoers_stat.st_ino)) {
            free(safe_cmnd);
            if ((safe_cmnd = strdup(buf)) == NULL) {
-               sudo_warnx(U_("unable to allocate memory"));
+               sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                dent = NULL;
            }
            break;
index d8162dc104fa94976ab9b193891048347363a896..2cb424e849eb2006495bfc8d2f2161f10163c029 100644 (file)
@@ -235,7 +235,7 @@ sudo_file_lookup(struct sudo_nss *nss, int validated, int pwflag)
                            if (cs->role != NULL) {
                                user_role = strdup(cs->role);
                                if (user_role == NULL) {
-                                   sudo_warnx(U_("unable to allocate memory"));
+                                   sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                                    SET(validated, VALIDATE_ERROR);
                                    goto done;
                                }
@@ -247,7 +247,7 @@ sudo_file_lookup(struct sudo_nss *nss, int validated, int pwflag)
                            if (cs->type != NULL) {
                                user_type = strdup(cs->type);
                                if (user_type == NULL) {
-                                   sudo_warnx(U_("unable to allocate memory"));
+                                   sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                                    SET(validated, VALIDATE_ERROR);
                                    goto done;
                                }
@@ -262,7 +262,7 @@ sudo_file_lookup(struct sudo_nss *nss, int validated, int pwflag)
                            if (cs->privs != NULL) {
                                runas_privs = strdup(cs->privs);
                                if (runas_privs == NULL) {
-                                   sudo_warnx(U_("unable to allocate memory"));
+                                   sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                                    SET(validated, VALIDATE_ERROR);
                                    goto done;
                                }
@@ -274,7 +274,7 @@ sudo_file_lookup(struct sudo_nss *nss, int validated, int pwflag)
                            if (cs->limitprivs != NULL) {
                                runas_limitprivs = strdup(cs->limitprivs);
                                if (runas_limitprivs == NULL) {
-                                   sudo_warnx(U_("unable to allocate memory"));
+                                   sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                                    SET(validated, VALIDATE_ERROR);
                                    goto done;
                                }
index ecb9838bad15c53ab55a018eb4dbf4fdb664b1cc..d7aa9b3aea89ccfb15cec114d2ee785f87282e95 100644 (file)
@@ -384,7 +384,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
     debug_return_int(flags);
 
 oom:
-    sudo_warnx(U_("unable to allocate memory"));
+    sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
 bad:
     debug_return_int(MODE_ERROR);
 }
@@ -575,7 +575,7 @@ sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask,
     debug_return_int(true);
 
 oom:
-    sudo_warnx(U_("unable to allocate memory"));
+    sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
 bad:
     while (info_len--)
        free(command_info[info_len]);
index 749fac50b5281cdf2f7e3d79ea332f623a55f999..3e76d5e9a3e22efae766b54b7dfafda9f831a3d1 100644 (file)
@@ -91,7 +91,7 @@ expand_prompt(const char *old_prompt, const char *auth_user)
     }
 
     if ((new_prompt = malloc(++len)) == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_str(NULL);
     }
 
index 3931fc1174c136ccebb0d08a016ae1b672d4b6da..017b14623e73de4d314f56e57e6342d9809bd6de 100644 (file)
@@ -160,7 +160,7 @@ sudo_sss_attrcpy(struct sss_sudo_attr *dst, const struct sss_sudo_attr *src)
 
     debug_return_bool(true);
 oom:
-    sudo_warnx(U_("unable to allocate memory"));
+    sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     sudo_sss_attrfree(dst);
     debug_return_bool(false);
 }
@@ -192,13 +192,13 @@ sudo_sss_rulecpy(struct sss_sudo_rule *dst, const struct sss_sudo_rule *src)
     dst->num_attrs = 0;
     dst->attrs = reallocarray(NULL, src->num_attrs, sizeof(struct sss_sudo_attr));
     if (dst->attrs == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_bool(false);
     }
 
     for (i = 0; i < src->num_attrs; ++i) {
        if (!sudo_sss_attrcpy(dst->attrs + i, src->attrs + i)) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            dst->num_attrs = i;
            sudo_sss_rulefree(dst);
            debug_return_bool(false);
@@ -236,14 +236,14 @@ sudo_sss_filter_result(struct sudo_sss_handle *handle,
     sudo_debug_printf(SUDO_DEBUG_DEBUG, "malloc: cnt=%d", in_res->num_rules);
 
     if ((out_res = calloc(1, sizeof(struct sss_sudo_result))) == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_ptr(NULL);
     }
     if (in_res->num_rules > 0) {
        out_res->rules =
            reallocarray(NULL, in_res->num_rules, sizeof(struct sss_sudo_rule));
        if (out_res->rules == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            free(out_res);
            debug_return_ptr(NULL);
        }
@@ -279,7 +279,7 @@ sudo_sss_filter_result(struct sudo_sss_handle *handle,
            struct sss_sudo_rule *rules =
                reallocarray(out_res->rules, l, sizeof(struct sss_sudo_rule));
            if (out_res->rules == NULL) {
-               sudo_warnx(U_("unable to allocate memory"));
+               sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                while (l--) {
                    sudo_sss_rulefree(out_res->rules + l);
                }
@@ -324,7 +324,7 @@ sudo_sss_open(struct sudo_nss *nss)
     /* Create a handle container. */
     handle = malloc(sizeof(struct sudo_sss_handle));
     if (handle == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_int(ENOMEM);
     }
 
@@ -916,7 +916,7 @@ sudo_sss_extract_digest(char **cmnd, struct sudo_digest *digest)
                    digest->digest_type = digest_type;
                    digest->digest_str = strndup(cp, (size_t)(ep - cp));
                    if (digest->digest_str == NULL) {
-                       sudo_warnx(U_("unable to allocate memory"));
+                       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                        debug_return_ptr(NULL);
                    }
                    cp = ep + 1;
@@ -1049,7 +1049,7 @@ sudo_sss_parse_options(struct sudo_sss_handle *handle, struct sss_sudo_rule *rul
        sudo_debug_printf(SUDO_DEBUG_INFO, "sssd/ldap sudoOption: '%s'",
         val_array[i]);
        if ((v = strdup(val_array[i])) == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            goto done;
        }
 
index 68ff7fa33de2448e8325bd0432653af0117f2fca..be16eb95bfb77fb894cd54dda96c8bdb08770f49 100644 (file)
@@ -159,7 +159,7 @@ sudoers_policy_init(void *info, char * const envp[])
     bindtextdomain("sudoers", LOCALEDIR);
 
     if (sudo_setpwent() == -1 || sudo_setgrent() == -1) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_int(-1);
     }
 
@@ -294,7 +294,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
        NewArgc = 1;
        NewArgv = reallocarray(NULL, NewArgc + 1, sizeof(char *));
        if (NewArgv == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            rval = -1;
            goto done;
        }
@@ -305,7 +305,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
        NewArgc = argc;
        NewArgv = reallocarray(NULL, NewArgc + 2, sizeof(char *));
        if (NewArgv == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            rval = -1;
            goto done;
        }
@@ -314,7 +314,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
        if (ISSET(sudo_mode, MODE_LOGIN_SHELL) && runas_pw != NULL) {
            NewArgv[0] = strdup(runas_pw->pw_shell);
            if (NewArgv[0] == NULL) {
-               sudo_warnx(U_("unable to allocate memory"));
+               sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                free(NewArgv);
                rval = -1;
                goto done;
@@ -371,7 +371,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
 
     if (safe_cmnd == NULL) {
        if ((safe_cmnd = strdup(user_cmnd)) == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            rval = -1;
            goto done;
        }
@@ -645,7 +645,7 @@ init_vars(char * const envp[])
     debug_decl(init_vars, SUDOERS_DEBUG_PLUGIN)
 
     if (!sudoers_initlocale(setlocale(LC_ALL, NULL), def_sudoers_locale)) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_bool(false);
     }
 
@@ -731,7 +731,7 @@ set_cmnd(void)
     /* Allocate user_stat for find_path() and match functions. */
     user_stat = calloc(1, sizeof(struct stat));
     if (user_stat == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_int(NOT_FOUND_ERROR);
     }
 
@@ -775,7 +775,7 @@ set_cmnd(void)
            for (size = 0, av = NewArgv + 1; *av; av++)
                size += strlen(*av) + 1;
            if (size == 0 || (user_args = malloc(size)) == NULL) {
-               sudo_warnx(U_("unable to allocate memory"));
+               sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                debug_return_int(-1);
            }
            if (ISSET(sudo_mode, MODE_SHELL|MODE_LOGIN_SHELL)) {
index c1781313650751d7499c26f3411466d43314cf67..f9b34981fb980e5d5e121c9f099efd6eb7fd2c65 100644 (file)
@@ -106,7 +106,8 @@ oom:
        free(debug_file->debug_flags);
        free(debug_file);
     }
-    sudo_warnx_nodebug(U_("unable to allocate memory"));
+    sudo_warnx_nodebug(U_("%s: %s"), "sudoers_debug_parse_flags",
+       U_("unable to allocate memory"));
     return false;
 }
 
index 04f42fafe661875fa4edca40cbb62a43bc168a46..f39d7be6ca5c7838ec8206f393f3f590399d6892 100644 (file)
@@ -486,7 +486,7 @@ replay_session(const double max_wait, const char *decimal)
                            reallocarray(iov, iovmax <<= 1, sizeof(*iov)) :
                            reallocarray(NULL, iovmax = 32, sizeof(*iov));
                        if (iov == NULL)
-                           sudo_fatalx(U_("unable to allocate memory"));
+                           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                    }
                    linelen = (size_t)(nl - line) + 1;
                    iov[iovcnt].iov_base = line;
@@ -682,7 +682,7 @@ parse_expr(struct search_node_list *head, char *argv[], bool sub_expr)
 
        /* Allocate new search node */
        if ((sn = calloc(1, sizeof(*sn))) == NULL)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        sn->type = type;
        sn->or = or;
        sn->negated = not;
@@ -794,7 +794,7 @@ parse_logfile(char *logfile)
      *  3) command with args
      */
     if ((li = calloc(1, sizeof(*li))) == NULL)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     if (getline(&buf, &bufsize, fp) == -1 ||
        getline(&li->cwd, &cwdsize, fp) == -1 ||
        getline(&li->cmd, &cmdsize, fp) == -1) {
@@ -834,7 +834,7 @@ parse_logfile(char *logfile)
        goto bad;
     }
     if ((li->user = strndup(cp, (size_t)(ep - cp))) == NULL)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
 
     /* runas user */
     cp = ep + 1;
@@ -843,7 +843,7 @@ parse_logfile(char *logfile)
        goto bad;
     }
     if ((li->runas_user = strndup(cp, (size_t)(ep - cp))) == NULL)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
 
     /* runas group */
     cp = ep + 1;
@@ -853,7 +853,7 @@ parse_logfile(char *logfile)
     }
     if (cp != ep) {
        if ((li->runas_group = strndup(cp, (size_t)(ep - cp))) == NULL)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     }
 
     /* tty, followed by optional rows + columns */
@@ -861,11 +861,11 @@ parse_logfile(char *logfile)
     if ((ep = strchr(cp, ':')) == NULL) {
        /* just the tty */
        if ((li->tty = strdup(cp)) == NULL)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     } else {
        /* tty followed by rows + columns */
        if ((li->tty = strndup(cp, (size_t)(ep - cp))) == NULL)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        cp = ep + 1;
        /* need to NULL out separator to use strtonum() */
        if ((ep = strchr(cp, ':')) != NULL) {
@@ -1021,11 +1021,11 @@ find_sessions(const char *dir, regex_t *re, const char *user, const char *tty)
                sessions_size = 36 * 36 / 2;
            sessions = reallocarray(sessions, sessions_size, 2 * sizeof(char *));
            if (sessions == NULL)
-               sudo_fatalx(U_("unable to allocate memory"));
+               sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            sessions_size *= 2;
        }
        if ((sessions[sessions_len] = strdup(dp->d_name)) == NULL)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        sessions_len++;
     }
     closedir(d);
index 4cbc9ee3e585f821d11061232d2b2961b10aab49..13fb074ed93c477e037bba6a66f90422e1762bcc 100644 (file)
@@ -130,7 +130,7 @@ main(int argc, char *argv[])
     initprogname(argc > 0 ? argv[0] : "testsudoers");
 
     if (!sudoers_initlocale(setlocale(LC_ALL, ""), def_sudoers_locale))
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have own domain */
     textdomain("sudoers");
 
@@ -187,7 +187,7 @@ main(int argc, char *argv[])
     if (pwfile)
        setpwfile(pwfile);
     if (sudo_setpwent() == -1 || sudo_setgrent() == -1)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
 
     if (argc < 2) {
        if (!dflag)
@@ -214,7 +214,7 @@ main(int argc, char *argv[])
     if ((p = strchr(user_host, '.'))) {
        *p = '\0';
        if ((user_shost = strdup(user_host)) == NULL)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        *p = '.';
     } else {
        user_shost = user_host;
@@ -231,7 +231,7 @@ main(int argc, char *argv[])
            size += strlen(*from) + 1;
 
        if ((user_args = malloc(size)) == NULL)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        for (to = user_args, from = argv; *from; from++) {
            n = strlcpy(to, *from, size - (to - user_args));
            if (n >= size - (to - user_args))
index 35533b2739314ffd1671cafb1dec34a789e5885f..42c63b0e12deb9ed828e6acd8230eefb453d2a60 100644 (file)
@@ -155,7 +155,7 @@ main(int argc, char *argv[])
 
     initprogname(argc > 0 ? argv[0] : "visudo");
     if (!sudoers_initlocale(setlocale(LC_ALL, ""), def_sudoers_locale))
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have visudo domain */
     textdomain("sudoers");
 
@@ -215,7 +215,7 @@ main(int argc, char *argv[])
        usage(1);
 
     if (sudo_setpwent() == -1 || sudo_setgrent() == -1)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
 
     /* Mock up a fake sudo_user struct. */
     user_cmnd = user_base = "";
@@ -299,13 +299,13 @@ get_editor(int *editor_argc, char ***editor_argv)
        }
        whitelist = reallocarray(NULL, whitelist_len + 1, sizeof(char *));
        if (whitelist == NULL)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        whitelist_len = 0;
        for (cp = sudo_strsplit(def_editor, def_editor_end, ":", &ep);
            cp != NULL; cp = sudo_strsplit(NULL, def_editor_end, ":", &ep)) {
            whitelist[whitelist_len] = strndup(cp, (size_t)(ep - cp));
            if (whitelist[whitelist_len] == NULL)
-               sudo_fatalx(U_("unable to allocate memory"));
+               sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            whitelist_len++;
        }
        whitelist[whitelist_len] = NULL;
@@ -435,7 +435,7 @@ edit_sudoers(struct sudoersfile *sp, char *editor, int editor_argc,
     /* Create the temp file if needed and set timestamp. */
     if (sp->tpath == NULL) {
        if (asprintf(&sp->tpath, "%s.tmp", sp->path) == -1)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        tfd = open(sp->tpath, O_WRONLY | O_CREAT | O_TRUNC, 0600);
        if (tfd < 0)
            sudo_fatal("%s", sp->tpath);
@@ -971,7 +971,7 @@ open_sudoers(const char *path, bool doedit, bool *keepopen)
     if (entry == NULL) {
        entry = calloc(1, sizeof(*entry));
        if (entry == NULL || (entry->path = strdup(path)) == NULL)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        /* entry->modified = 0; */
        entry->fd = open(entry->path, open_flags, sudoers_mode);
        /* entry->tpath = NULL; */
@@ -1015,7 +1015,7 @@ get_hostname(void)
        if ((p = strchr(user_host, '.'))) {
            *p = '\0';
            if ((user_shost = strdup(user_host)) == NULL)
-               sudo_fatalx(U_("unable to allocate memory"));
+               sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            *p = '.';
        } else {
            user_shost = user_host;
@@ -1111,7 +1111,7 @@ check_aliases(bool strict, bool quiet)
 
     alias_freelist = rbcreate(alias_compare);
     if (alias_freelist == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_int(-1);
     }
 
index 3fa6f1fe8535e3e2fd3342bb465ae93d7f9797d3..a82f1f099fd1e16f2557ce43a05278595908858a 100644 (file)
@@ -71,8 +71,10 @@ sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[],
                pass = tgetpass(msg->msg, msg->timeout, flags);
                if (pass == NULL)
                    goto err;
-               if ((repl->reply = strdup(pass)) == NULL)
-                   sudo_fatalx_nodebug(U_("unable to allocate memory"));
+               if ((repl->reply = strdup(pass)) == NULL) {
+                   sudo_fatalx_nodebug(U_("%s: %s"), "sudo_conversation",
+                       U_("unable to allocate memory"));
+               }
                memset_s(pass, SUDO_CONV_REPL_MAX, 0, strlen(pass));
                break;
            case SUDO_CONV_INFO_MSG:
index 440755c32066e6b599201a5bc331e351a8b3d6aa..be248a004082ae3170bca24fb9f124a51f314f6a 100644 (file)
@@ -864,7 +864,7 @@ schedule_signal(struct sudo_event_base *evbase, int signo)
     sudo_debug_printf(SUDO_DEBUG_DIAG, "scheduled SIG%s for child", signame);
 
     if ((sigfwd = calloc(1, sizeof(*sigfwd))) == NULL)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     sigfwd->signo = signo;
     TAILQ_INSERT_TAIL(&sigfwd_list, sigfwd, entries);
 
index a532901575e303d6ca1969988ac7d1d6a45b84c8..939e62d2cd302f2b7d441a2959c94046f90c3af4 100644 (file)
@@ -96,7 +96,7 @@ disable_execute(char *const envp[])
 #endif
     nenvp = reallocarray(NULL, env_size, sizeof(*envp));
     if (nenvp == NULL)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     memcpy(nenvp, envp, env_len * sizeof(*envp));
     nenvp[env_len] = NULL;
 
@@ -108,14 +108,14 @@ disable_execute(char *const envp[])
        preload = sudo_new_key_val(RTLD_PRELOAD_VAR, sudo_conf_noexec_path());
 # endif
        if (preload == NULL)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        nenvp[env_len++] = preload;
        nenvp[env_len] = NULL;
     } else {
        int len = asprintf(&preload, "%s=%s%s%s", RTLD_PRELOAD_VAR,
            sudo_conf_noexec_path(), RTLD_PRELOAD_DELIM, nenvp[preload_idx]);
        if (len == -1)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        nenvp[preload_idx] = preload;
     }
 # ifdef RTLD_PRELOAD_ENABLE_VAR
index 558434e389c682e56adffcc1d8e79e00111cb7ad..f2999c2029aed055b10f05c9383bd5851d9d662d 100644 (file)
@@ -687,7 +687,7 @@ io_buf_new(int rfd, int wfd, bool (*action)(const char *, unsigned int, struct i
 
     /* Allocate and add to head of list. */
     if ((iob = malloc(sizeof(*iob))) == NULL)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     iob->revent = sudo_ev_alloc(rfd, SUDO_EV_READ, io_callback, iob);
     iob->wevent = sudo_ev_alloc(wfd, SUDO_EV_WRITE, io_callback, iob);
     iob->len = 0;
@@ -695,7 +695,7 @@ io_buf_new(int rfd, int wfd, bool (*action)(const char *, unsigned int, struct i
     iob->action = action;
     iob->buf[0] = '\0';
     if (iob->revent == NULL || iob->wevent == NULL)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     SLIST_INSERT_HEAD(head, iob, entries);
 
     debug_return;
index 40655f33a369e2f3600c0454f349be593575d482..11b0da12a914d15290b1602b97286cb3907d71c1 100644 (file)
@@ -206,7 +206,7 @@ sudo_load_plugin(struct plugin_container *policy_plugin,
            policy_plugin->handle = handle;
            policy_plugin->path = strdup(path);
            if (policy_plugin->path == NULL) {
-               sudo_warnx(U_("unable to allocate memory"));
+               sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                goto bad;
            }
            policy_plugin->name = info->symbol_name;
@@ -229,7 +229,7 @@ sudo_load_plugin(struct plugin_container *policy_plugin,
        if (handle != NULL) {
            container = calloc(1, sizeof(*container));
            if (container == NULL || (container->path = strdup(path)) == NULL) {
-               sudo_warnx(U_("unable to allocate memory"));
+               sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                goto bad;
            }
            container->handle = handle;
@@ -294,7 +294,7 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
        /* Default policy plugin */
        info = calloc(1, sizeof(*info));
        if (info == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            goto done;
        }
        info->symbol_name = "sudoers_policy";
@@ -309,7 +309,7 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
        if (TAILQ_EMPTY(io_plugins)) {
            info = calloc(1, sizeof(*info));
            if (info == NULL) {
-               sudo_warnx(U_("unable to allocate memory"));
+               sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                goto done;
            }
            info->symbol_name = "sudoers_io";
index b4d3ab57605af214fab153110aaf7a1b9133bdfb..c0a2ba507708c0677f97dc262a24b77a8740ca99 100644 (file)
@@ -180,7 +180,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv,
 
     env_add = reallocarray(NULL, env_size, sizeof(char *));
     if (env_add == NULL)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
 
     /* Pass progname to plugin so it can call initprogname() */
     progname = getprogname();
@@ -202,7 +202,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv,
     i = sudo_conf_max_groups();
     if (i != -1) {
        if (asprintf(&cp, "%d", i) == -1)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        sudo_settings[ARG_MAX_GROUPS].value = cp;
     }
 
@@ -370,7 +370,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv,
 
                tmp = reallocarray(env_add, env_size, 2 * sizeof(char *));
                if (tmp == NULL)
-                   sudo_fatalx(U_("unable to allocate memory"));
+                   sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                env_add = tmp;
                env_size *= 2;
            }
@@ -466,7 +466,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv,
 
            cmnd = dst = reallocarray(NULL, cmnd_size, 2);
            if (cmnd == NULL)
-               sudo_fatalx(U_("unable to allocate memory"));
+               sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            for (av = argv; *av != NULL; av++) {
                for (src = *av; *src != '\0'; src++) {
                    /* quote potential meta characters */
@@ -485,7 +485,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv,
 
        av = reallocarray(NULL, ac + 1, sizeof(char *));
        if (av == NULL)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        av[0] = (char *)user_details.shell; /* plugin may override shell */
        if (cmnd != NULL) {
            av[1] = "-c";
index 924f84ce2abe2e82d771c0d367dce8a8d4779fec..5926deb0b1f32990b8bfd0f63ae200130efcea0a 100644 (file)
@@ -52,7 +52,7 @@ add_preserved_fd(struct preserved_fd_list *pfds, int fd)
 
     pfd_new = malloc(sizeof(*pfd));
     if (pfd_new == NULL)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     pfd_new->lowfd = fd;
     pfd_new->highfd = fd;
     pfd_new->flags = fcntl(fd, F_GETFD);
@@ -135,7 +135,7 @@ closefrom_except(int startfd, struct preserved_fd_list *pfds)
     /* Create bitmap of preserved (relocated) fds.  */
     fdsp = calloc(howmany(lastfd + 1, NFDBITS), sizeof(fd_mask));
     if (fdsp == NULL)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     TAILQ_FOREACH(pfd, pfds, entries) {
        FD_SET(pfd->lowfd, fdsp);
     }
index a017f4456f067ff23853b80eefd089b871ada484..76d25acb02186dba0dc3e319ac10f3c148373d47 100644 (file)
@@ -82,7 +82,7 @@ audit_role_change(const security_context_t old_context,
        rc = asprintf(&message, "newrole: old-context=%s new-context=%s",
            old_context, new_context);
        if (rc == -1)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        rc = audit_log_user_message(au_fd, AUDIT_USER_ROLE_CHANGE,
            message, NULL, NULL, ttyn, result);
        if (rc <= 0)
@@ -289,7 +289,7 @@ get_exec_context(security_context_t old_context, const char *role, const char *t
      * Convert "context" back into a string and verify it.
      */
     if ((new_context = strdup(context_str(context))) == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        goto bad;
     }
     if (security_check_context(new_context) < 0) {
@@ -412,7 +412,7 @@ selinux_execve(const char *path, char *const argv[], char *const envp[],
        continue;
     nargv = reallocarray(NULL, argc + 2, sizeof(char *));
     if (nargv == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return;
     }
     if (noexec)
index 3e2932c20ede982c16b772c8350741ee53890fac..7069a1fc8b2e55f28a768a9f390b643e9e22abaa 100644 (file)
@@ -98,7 +98,7 @@ main(int argc, char *argv[], char *envp[])
        argv++;
        argc--;
        if ((cmnd = strdup(argv[0])) == NULL)
-           sudo_fatalx(U_("unable to allocate memory"));
+           sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
 
        /* If invoked as a login shell, modify argv[0] accordingly. */
        if (login_shell) {
index 634700df7d7bb099c9a743a52844c72698af0b86..8dd708454df169fbcdee29b5eb4dd39980131948 100644 (file)
@@ -181,7 +181,7 @@ main(int argc, char *argv[], char *envp[])
 
     /* Fill in user_info with user name, uid, cwd, etc. */
     if ((user_info = get_user_info(&user_details)) == NULL)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
 
     /* Disable core dumps if not enabled in sudo.conf. */
     disable_coredumps();
@@ -358,7 +358,7 @@ fill_group_list(struct user_details *ud, int system_maxgroups)
     if (ud->ngroups > 0) {
        ud->groups = reallocarray(NULL, ud->ngroups, sizeof(GETGROUPS_T));
        if (ud->groups == NULL) {
-           sudo_warnx(U_("unable to allocate memory"));
+           sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
            goto done;
        }
        /* No error on insufficient space if user specified max_groups. */
@@ -377,7 +377,7 @@ fill_group_list(struct user_details *ud, int system_maxgroups)
            free(ud->groups);
            ud->groups = reallocarray(NULL, ud->ngroups, sizeof(GETGROUPS_T));
            if (ud->groups == NULL) {
-               sudo_warnx(U_("unable to allocate memory"));
+               sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
                goto done;
            }
            rval = getgrouplist(ud->username, ud->gid, ud->groups, &ud->ngroups);
@@ -443,7 +443,7 @@ get_user_groups(struct user_details *ud)
     }
     debug_return_str(gid_list);
 oom:
-    sudo_fatalx(U_("unable to allocate memory"));
+    sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
 }
 
 /*
index 8d700a3d1720bb67c802a61f9bb28f6b6cd65ee1..d20d3c956a3cc1e7256d9890bdc9eede51182df9 100644 (file)
@@ -153,7 +153,7 @@ sudo_edit_mktemp(const char *ofile, char **tfile)
        len = asprintf(tfile, "%s/%s.XXXXXXXX", edit_tmpdir, cp);
     }
     if (len == -1)
-       sudo_fatalx(U_("unable to allocate memory"));
+       sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
     tfd = mkstemps(*tfile, suff ? strlen(suff) : 0);
     sudo_debug_printf(SUDO_DEBUG_INFO|SUDO_DEBUG_LINENO,
        "%s -> %s, fd %d", ofile, *tfile, tfd);
@@ -374,7 +374,7 @@ selinux_edit_create_tfiles(struct command_details *command_details,
     sesh_nargs = 3 + (nfiles * 2) + 1;
     sesh_args = sesh_ap = reallocarray(NULL, sesh_nargs, sizeof(char *));
     if (sesh_args == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_int(-1);
     }
     *sesh_ap++ = "sesh";
@@ -469,7 +469,7 @@ selinux_edit_copy_tfiles(struct command_details *command_details,
     sesh_nargs = 3 + (nfiles * 2) + 1;
     sesh_args = sesh_ap = reallocarray(NULL, sesh_nargs, sizeof(char *));
     if (sesh_args == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        debug_return_int(-1);
     }
     *sesh_ap++ = "sesh";
@@ -581,7 +581,7 @@ sudo_edit(struct command_details *command_details)
     /* Copy editor files to temporaries. */
     tf = calloc(nfiles, sizeof(*tf));
     if (tf == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        goto cleanup;
     }
 #ifdef HAVE_SELINUX
@@ -601,7 +601,7 @@ sudo_edit(struct command_details *command_details)
     nargc = editor_argc + nfiles;
     nargv = reallocarray(NULL, nargc + 1, sizeof(char *));
     if (nargv == NULL) {
-       sudo_warnx(U_("unable to allocate memory"));
+       sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
        goto cleanup;
     }
     for (ac = 0; ac < editor_argc; ac++)