mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 18:08:23 +00:00
Add function name to "unable to allocate memory" warnings.
This commit is contained in:
parent
dc883f2454
commit
c36415417f
@ -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",
|
len = asprintf(&info, "NAME=%s%cLOGIN=%s%cLOGNAME=%s%cTTY=%s%c",
|
||||||
user, '\0', user, '\0', user, '\0', tty ? tty : "", '\0');
|
user, '\0', user, '\0', user, '\0', tty ? tty : "", '\0');
|
||||||
if (len == -1) {
|
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);
|
debug_return_int(-1);
|
||||||
}
|
}
|
||||||
(void)usrinfo(SETUINFO, info, len);
|
(void)usrinfo(SETUINFO, info, len);
|
||||||
|
@ -62,7 +62,7 @@ sudo_parse_gids_v1(const char *gidstr, const gid_t *basegid, GETGROUPS_T **gidsp
|
|||||||
if (ngids != 0) {
|
if (ngids != 0) {
|
||||||
gids = reallocarray(NULL, ngids, sizeof(GETGROUPS_T));
|
gids = reallocarray(NULL, ngids, sizeof(GETGROUPS_T));
|
||||||
if (gids == NULL) {
|
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);
|
debug_return_int(-1);
|
||||||
}
|
}
|
||||||
ngids = 0;
|
ngids = 0;
|
||||||
|
@ -185,7 +185,7 @@ parse_path(const char *entry, const char *conf_file, unsigned int lineno)
|
|||||||
if (namelen == cur->pnamelen &&
|
if (namelen == cur->pnamelen &&
|
||||||
strncasecmp(name, cur->pname, cur->pnamelen) == 0) {
|
strncasecmp(name, cur->pname, cur->pnamelen) == 0) {
|
||||||
if ((cur->pval = strdup(path)) == NULL) {
|
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);
|
debug_return_int(-1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ parse_debug(const char *entry, const char *conf_file, unsigned int lineno)
|
|||||||
|
|
||||||
debug_return_int(true);
|
debug_return_int(true);
|
||||||
oom:
|
oom:
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
if (debug_file != NULL) {
|
if (debug_file != NULL) {
|
||||||
free(debug_file->debug_file);
|
free(debug_file->debug_file);
|
||||||
free(debug_file->debug_flags);
|
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);
|
debug_return_int(true);
|
||||||
oom:
|
oom:
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
if (options != NULL) {
|
if (options != NULL) {
|
||||||
while (nopts--)
|
while (nopts--)
|
||||||
free(options[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));
|
prev_locale = strdup(setlocale(LC_ALL, NULL));
|
||||||
if (prev_locale == 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);
|
debug_return_int(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ converse(int num_msg, PAM_CONST struct pam_message **msg,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if ((pr->resp = strdup(pass)) == NULL) {
|
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;
|
ret = PAM_BUF_ERR;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ sudo_rfc1938_setup(struct passwd *pw, char **promptp, sudo_auth *auth)
|
|||||||
if (np_size < op_len + challenge_len + 7) {
|
if (np_size < op_len + challenge_len + 7) {
|
||||||
char *p = realloc(new_prompt, op_len + challenge_len + 7);
|
char *p = realloc(new_prompt, op_len + challenge_len + 7);
|
||||||
if (p == NULL) {
|
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);
|
debug_return_int(AUTH_FATAL);
|
||||||
}
|
}
|
||||||
np_size = op_len + challenge_len + 7;
|
np_size = op_len + challenge_len + 7;
|
||||||
|
@ -516,7 +516,7 @@ init_defaults(void)
|
|||||||
|
|
||||||
debug_return_bool(true);
|
debug_return_bool(true);
|
||||||
oom:
|
oom:
|
||||||
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(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -720,7 +720,7 @@ store_str(char *val, struct sudo_defs_types *def, int op)
|
|||||||
def->sd_un.str = NULL;
|
def->sd_un.str = NULL;
|
||||||
} else {
|
} else {
|
||||||
if ((def->sd_un.str = strdup(val)) == NULL) {
|
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);
|
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) {
|
if (op == add) {
|
||||||
cur = calloc(1, sizeof(struct list_member));
|
cur = calloc(1, sizeof(struct list_member));
|
||||||
if (cur == NULL || (cur->value = strndup(val, len)) == NULL) {
|
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);
|
free(cur);
|
||||||
debug_return_bool(false);
|
debug_return_bool(false);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ resolve_editor(const char *ed, size_t edlen, int nfiles, char **files,
|
|||||||
debug_return_str(NULL);
|
debug_return_str(NULL);
|
||||||
editor = strndup(cp, (size_t)(ep - cp));
|
editor = strndup(cp, (size_t)(ep - cp));
|
||||||
if (editor == NULL) {
|
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);
|
debug_return_str(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ resolve_editor(const char *ed, size_t edlen, int nfiles, char **files,
|
|||||||
nargc += nfiles + 1;
|
nargc += nfiles + 1;
|
||||||
nargv = reallocarray(NULL, nargc + 1, sizeof(char *));
|
nargv = reallocarray(NULL, nargc + 1, sizeof(char *));
|
||||||
if (nargv == NULL) {
|
if (nargv == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
free(editor);
|
free(editor);
|
||||||
debug_return_str(NULL);
|
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++) {
|
for (nargc = 1; (cp = sudo_strsplit(NULL, edend, " \t", &ep)) != NULL; nargc++) {
|
||||||
nargv[nargc] = strndup(cp, (size_t)(ep - cp));
|
nargv[nargc] = strndup(cp, (size_t)(ep - cp));
|
||||||
if (nargv[nargc] == NULL) {
|
if (nargv[nargc] == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
while (nargc--)
|
while (nargc--)
|
||||||
free(nargv[nargc]);
|
free(nargv[nargc]);
|
||||||
debug_return_str(NULL);
|
debug_return_str(NULL);
|
||||||
|
@ -233,7 +233,7 @@ env_init(char * const envp[])
|
|||||||
if (env.envp == NULL) {
|
if (env.envp == NULL) {
|
||||||
env.env_size = 0;
|
env.env_size = 0;
|
||||||
env.env_len = 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);
|
debug_return_bool(false);
|
||||||
}
|
}
|
||||||
#ifdef ENV_DEBUG
|
#ifdef ENV_DEBUG
|
||||||
|
@ -964,14 +964,14 @@ init_parser(const char *path, bool quiet)
|
|||||||
init_lexer();
|
init_lexer();
|
||||||
|
|
||||||
if (!init_aliases()) {
|
if (!init_aliases()) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
rval = false;
|
rval = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(sudoers);
|
free(sudoers);
|
||||||
if (path != NULL) {
|
if (path != NULL) {
|
||||||
if ((sudoers = strdup(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;
|
rval = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1109,14 +1109,14 @@ init_parser(const char *path, bool quiet)
|
|||||||
init_lexer();
|
init_lexer();
|
||||||
|
|
||||||
if (!init_aliases()) {
|
if (!init_aliases()) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
rval = false;
|
rval = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(sudoers);
|
free(sudoers);
|
||||||
if (path != NULL) {
|
if (path != NULL) {
|
||||||
if ((sudoers = strdup(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;
|
rval = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -131,7 +131,7 @@ group_plugin_load(char *plugin_info)
|
|||||||
if (ac != 0) {
|
if (ac != 0) {
|
||||||
argv = reallocarray(NULL, ac, sizeof(char *));
|
argv = reallocarray(NULL, ac, sizeof(char *));
|
||||||
if (argv == NULL) {
|
if (argv == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
ac = 0;
|
ac = 0;
|
||||||
|
@ -582,7 +582,7 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
|
|||||||
bindtextdomain("sudoers", LOCALEDIR);
|
bindtextdomain("sudoers", LOCALEDIR);
|
||||||
|
|
||||||
if (sudo_setpwent() == -1 || sudo_setgrent() == -1) {
|
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);
|
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. */
|
/* Get next session ID and convert it into a path. */
|
||||||
tofree = malloc(sizeof(_PATH_SUDO_IO_LOGDIR) + sizeof(sessid) + 2);
|
tofree = malloc(sizeof(_PATH_SUDO_IO_LOGDIR) + sizeof(sessid) + 2);
|
||||||
if (tofree == NULL) {
|
if (tofree == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
memcpy(tofree, _PATH_SUDO_IO_LOGDIR, sizeof(_PATH_SUDO_IO_LOGDIR));
|
memcpy(tofree, _PATH_SUDO_IO_LOGDIR, sizeof(_PATH_SUDO_IO_LOGDIR));
|
||||||
|
@ -165,7 +165,7 @@ expand_iolog_path(const char *prefix, const char *dir, const char *file,
|
|||||||
prelen = strlen(prefix);
|
prelen = strlen(prefix);
|
||||||
dst = path = malloc(prelen + PATH_MAX);
|
dst = path = malloc(prelen + PATH_MAX);
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
*path = '\0';
|
*path = '\0';
|
||||||
|
@ -445,7 +445,7 @@ sudo_ldap_conf_add_ports(void)
|
|||||||
|
|
||||||
free(ldap_conf.host);
|
free(ldap_conf.host);
|
||||||
if ((ldap_conf.host = strdup(hostbuf)) == NULL)
|
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);
|
debug_return_bool(ldap_conf.host != NULL);
|
||||||
|
|
||||||
overflow:
|
overflow:
|
||||||
@ -476,7 +476,7 @@ sudo_ldap_parse_uri(const struct ldap_config_str_list *uri_list)
|
|||||||
|
|
||||||
buf = strdup(entry->val);
|
buf = strdup(entry->val);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
for ((uri = strtok_r(buf, " \t", &last)); uri != NULL; (uri = strtok_r(NULL, " \t", &last))) {
|
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(). */
|
/* Store parsed URI(s) in host for ldap_create() or ldap_init(). */
|
||||||
free(ldap_conf.host);
|
free(ldap_conf.host);
|
||||||
if ((ldap_conf.host = strdup(hostbuf)) == NULL) {
|
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;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,7 +561,7 @@ sudo_ldap_join_uri(struct ldap_config_str_list *uri_list)
|
|||||||
len += strlen(uri->val) + 1;
|
len += strlen(uri->val) + 1;
|
||||||
}
|
}
|
||||||
if (len == 0 || (buf = malloc(len)) == NULL) {
|
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 {
|
} else {
|
||||||
char *cp = buf;
|
char *cp = buf;
|
||||||
|
|
||||||
@ -913,7 +913,7 @@ sudo_ldap_extract_digest(char **cmnd, struct sudo_digest *digest)
|
|||||||
digest->digest_type = digest_type;
|
digest->digest_type = digest_type;
|
||||||
digest->digest_str = strndup(cp, (size_t)(ep - cp));
|
digest->digest_str = strndup(cp, (size_t)(ep - cp));
|
||||||
if (digest->digest_str == NULL) {
|
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);
|
debug_return_ptr(NULL);
|
||||||
}
|
}
|
||||||
cp = ep + 1;
|
cp = ep + 1;
|
||||||
@ -1059,7 +1059,7 @@ sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry)
|
|||||||
/* walk through options */
|
/* walk through options */
|
||||||
for (p = bv; *p != NULL; p++) {
|
for (p = bv; *p != NULL; p++) {
|
||||||
if ((var = strdup((*p)->bv_val)) == NULL) {
|
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;
|
goto done;
|
||||||
}
|
}
|
||||||
DPRINTF2("ldap sudoOption: '%s'", var);
|
DPRINTF2("ldap sudoOption: '%s'", var);
|
||||||
@ -1338,7 +1338,7 @@ sudo_netgroup_lookup_nested(LDAP *ld, char *base, struct timeval *timeout,
|
|||||||
|
|
||||||
debug_return_bool(true);
|
debug_return_bool(true);
|
||||||
oom:
|
oom:
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
if (result)
|
if (result)
|
||||||
ldap_msgfree(result);
|
ldap_msgfree(result);
|
||||||
debug_return_bool(false);
|
debug_return_bool(false);
|
||||||
@ -1511,7 +1511,7 @@ sudo_netgroup_lookup(LDAP *ld, struct passwd *pw,
|
|||||||
}
|
}
|
||||||
debug_return_bool(true);
|
debug_return_bool(true);
|
||||||
oom:
|
oom:
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
ldap_msgfree(result);
|
ldap_msgfree(result);
|
||||||
debug_return_bool(false);
|
debug_return_bool(false);
|
||||||
overflow:
|
overflow:
|
||||||
@ -1587,7 +1587,7 @@ sudo_ldap_build_pass1(LDAP *ld, struct passwd *pw)
|
|||||||
if (ldap_conf.timed)
|
if (ldap_conf.timed)
|
||||||
sz += TIMEFILTER_LENGTH;
|
sz += TIMEFILTER_LENGTH;
|
||||||
if ((buf = malloc(sz)) == NULL) {
|
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);
|
debug_return_str(NULL);
|
||||||
}
|
}
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
@ -1723,7 +1723,7 @@ sudo_ldap_build_pass2(void)
|
|||||||
(ldap_conf.timed || ldap_conf.search_filter) ? ")" : "");
|
(ldap_conf.timed || ldap_conf.search_filter) ? ")" : "");
|
||||||
}
|
}
|
||||||
if (len == -1)
|
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);
|
debug_return_str(filt);
|
||||||
}
|
}
|
||||||
@ -1747,7 +1747,7 @@ sudo_ldap_decode_secret(const char *secret)
|
|||||||
reslen = ((strlen(secret) + 3) / 4 * 3);
|
reslen = ((strlen(secret) + 3) / 4 * 3);
|
||||||
result = malloc(reslen + 1);
|
result = malloc(reslen + 1);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
} else {
|
} else {
|
||||||
len = base64_decode(secret, result, reslen);
|
len = base64_decode(secret, result, reslen);
|
||||||
if (len == (size_t)-1) {
|
if (len == (size_t)-1) {
|
||||||
@ -1777,7 +1777,7 @@ sudo_ldap_read_secret(const char *path)
|
|||||||
ldap_conf.bindpw = sudo_ldap_decode_secret(buf);
|
ldap_conf.bindpw = sudo_ldap_decode_secret(buf);
|
||||||
if (ldap_conf.bindpw == NULL) {
|
if (ldap_conf.bindpw == NULL) {
|
||||||
if ((ldap_conf.bindpw = strdup(buf)) == 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);
|
free(ldap_conf.binddn);
|
||||||
ldap_conf.binddn = ldap_conf.rootbinddn;
|
ldap_conf.binddn = ldap_conf.rootbinddn;
|
||||||
@ -1830,7 +1830,7 @@ sudo_ldap_parse_keyword(const char *keyword, const char *value,
|
|||||||
|
|
||||||
free(*(char **)(cur->valp));
|
free(*(char **)(cur->valp));
|
||||||
if (*value && (cp = strdup(value)) == NULL) {
|
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);
|
debug_return_bool(false);
|
||||||
}
|
}
|
||||||
*(char **)(cur->valp) = cp;
|
*(char **)(cur->valp) = cp;
|
||||||
@ -1845,7 +1845,7 @@ sudo_ldap_parse_keyword(const char *keyword, const char *value,
|
|||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
head = (struct ldap_config_str_list *)cur->valp;
|
head = (struct ldap_config_str_list *)cur->valp;
|
||||||
if ((str = malloc(sizeof(*str) + len)) == NULL) {
|
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);
|
debug_return_bool(false);
|
||||||
}
|
}
|
||||||
memcpy(str->val, value, len + 1);
|
memcpy(str->val, value, len + 1);
|
||||||
@ -1941,7 +1941,7 @@ sudo_ldap_read_config(void)
|
|||||||
STAILQ_INIT(&ldap_conf.netgroup_base);
|
STAILQ_INIT(&ldap_conf.netgroup_base);
|
||||||
|
|
||||||
if (ldap_conf.search_filter == NULL || ldap_conf.netgroup_search_filter == NULL) {
|
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);
|
debug_return_bool(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1974,7 +1974,7 @@ sudo_ldap_read_config(void)
|
|||||||
if (!ldap_conf.host) {
|
if (!ldap_conf.host) {
|
||||||
ldap_conf.host = strdup("localhost");
|
ldap_conf.host = strdup("localhost");
|
||||||
if (ldap_conf.host == NULL) {
|
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);
|
debug_return_bool(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2127,7 +2127,7 @@ sudo_ldap_read_config(void)
|
|||||||
cp = ldap_conf.search_filter;
|
cp = ldap_conf.search_filter;
|
||||||
ldap_conf.search_filter = malloc(len + 3);
|
ldap_conf.search_filter = malloc(len + 3);
|
||||||
if (ldap_conf.search_filter == NULL) {
|
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);
|
debug_return_bool(false);
|
||||||
}
|
}
|
||||||
ldap_conf.search_filter[0] = '(';
|
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();
|
filt = sudo_ldap_build_default_filter();
|
||||||
if (filt == NULL) {
|
if (filt == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
STAILQ_FOREACH(base, &ldap_conf.base, entries) {
|
STAILQ_FOREACH(base, &ldap_conf.base, entries) {
|
||||||
@ -3021,7 +3021,7 @@ sudo_ldap_open(struct sudo_nss *nss)
|
|||||||
/* Create a handle container. */
|
/* Create a handle container. */
|
||||||
handle = calloc(1, sizeof(struct sudo_ldap_handle));
|
handle = calloc(1, sizeof(struct sudo_ldap_handle));
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -3054,7 +3054,7 @@ sudo_ldap_setdefs(struct sudo_nss *nss)
|
|||||||
|
|
||||||
filt = sudo_ldap_build_default_filter();
|
filt = sudo_ldap_build_default_filter();
|
||||||
if (filt == NULL) {
|
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);
|
debug_return_int(-1);
|
||||||
}
|
}
|
||||||
DPRINTF1("Looking for cn=defaults: %s", filt);
|
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();
|
lres = sudo_ldap_result_alloc();
|
||||||
if (lres == NULL) {
|
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);
|
debug_return_ptr(NULL);
|
||||||
}
|
}
|
||||||
for (pass = 0; pass < 2; pass++) {
|
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. */
|
/* Add the seach result to list of search results. */
|
||||||
DPRINTF1("adding search result");
|
DPRINTF1("adding search result");
|
||||||
if (sudo_ldap_result_add_search(lres, ld, result) == NULL) {
|
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);
|
free(filt);
|
||||||
sudo_ldap_result_free(lres);
|
sudo_ldap_result_free(lres);
|
||||||
debug_return_ptr(NULL);
|
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)) {
|
sudo_ldap_check_host(ld, entry)) {
|
||||||
lres->host_matches = true;
|
lres->host_matches = true;
|
||||||
if (sudo_ldap_result_add_entry(lres, entry) == NULL) {
|
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);
|
free(filt);
|
||||||
sudo_ldap_result_free(lres);
|
sudo_ldap_result_free(lres);
|
||||||
debug_return_ptr(NULL);
|
debug_return_ptr(NULL);
|
||||||
@ -3494,7 +3494,7 @@ sudo_ldap_result_from_search(LDAP *ldap, LDAPMessage *searchresult)
|
|||||||
*/
|
*/
|
||||||
result = sudo_ldap_result_alloc();
|
result = sudo_ldap_result_alloc();
|
||||||
if (result == NULL) {
|
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);
|
debug_return_ptr(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3510,7 +3510,7 @@ sudo_ldap_result_from_search(LDAP *ldap, LDAPMessage *searchresult)
|
|||||||
*/
|
*/
|
||||||
LDAP_FOREACH(entry, last->ldap, last->searchresult) {
|
LDAP_FOREACH(entry, last->ldap, last->searchresult) {
|
||||||
if (sudo_ldap_result_add_entry(result, entry) == NULL) {
|
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);
|
sudo_ldap_result_free(result);
|
||||||
result = NULL;
|
result = NULL;
|
||||||
break;
|
break;
|
||||||
|
@ -74,7 +74,7 @@ linux_audit_command(char *argv[], int result)
|
|||||||
size += strlen(*av) + 1;
|
size += strlen(*av) + 1;
|
||||||
command = cp = malloc(size);
|
command = cp = malloc(size);
|
||||||
if (command == NULL) {
|
if (command == NULL) {
|
||||||
sudo_warn(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
for (av = argv; *av != NULL; av++) {
|
for (av = argv; *av != NULL; av++) {
|
||||||
|
@ -188,7 +188,7 @@ do_logfile(const char *msg)
|
|||||||
if (!ferror(fp))
|
if (!ferror(fp))
|
||||||
rval = true;
|
rval = true;
|
||||||
} else {
|
} else {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
}
|
}
|
||||||
(void) fclose(fp);
|
(void) fclose(fp);
|
||||||
}
|
}
|
||||||
@ -912,7 +912,7 @@ new_logline(const char *message, int serrno)
|
|||||||
debug_return_str(line);
|
debug_return_str(line);
|
||||||
oom:
|
oom:
|
||||||
free(evstr);
|
free(evstr);
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
debug_return_str(NULL);
|
debug_return_str(NULL);
|
||||||
toobig:
|
toobig:
|
||||||
free(evstr);
|
free(evstr);
|
||||||
|
@ -516,7 +516,7 @@ command_matches_glob(const char *sudoers_cmnd, const char *sudoers_args)
|
|||||||
user_stat->st_ino == sudoers_stat.st_ino)) {
|
user_stat->st_ino == sudoers_stat.st_ino)) {
|
||||||
free(safe_cmnd);
|
free(safe_cmnd);
|
||||||
if ((safe_cmnd = strdup(cp)) == NULL) {
|
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 */
|
cp = NULL; /* fail closed */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -552,7 +552,7 @@ command_matches_normal(const char *sudoers_cmnd, const char *sudoers_args, const
|
|||||||
free(safe_cmnd);
|
free(safe_cmnd);
|
||||||
if ((safe_cmnd = strdup(sudoers_cmnd)) != NULL)
|
if ((safe_cmnd = strdup(sudoers_cmnd)) != NULL)
|
||||||
debug_return_bool(true);
|
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);
|
debug_return_bool(false);
|
||||||
@ -710,7 +710,7 @@ command_matches_normal(const char *sudoers_cmnd, const char *sudoers_args, const
|
|||||||
}
|
}
|
||||||
free(safe_cmnd);
|
free(safe_cmnd);
|
||||||
if ((safe_cmnd = strdup(sudoers_cmnd)) == NULL) {
|
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(false);
|
||||||
}
|
}
|
||||||
debug_return_bool(true);
|
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)) {
|
user_stat->st_ino == sudoers_stat.st_ino)) {
|
||||||
free(safe_cmnd);
|
free(safe_cmnd);
|
||||||
if ((safe_cmnd = strdup(buf)) == NULL) {
|
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;
|
dent = NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -235,7 +235,7 @@ sudo_file_lookup(struct sudo_nss *nss, int validated, int pwflag)
|
|||||||
if (cs->role != NULL) {
|
if (cs->role != NULL) {
|
||||||
user_role = strdup(cs->role);
|
user_role = strdup(cs->role);
|
||||||
if (user_role == NULL) {
|
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);
|
SET(validated, VALIDATE_ERROR);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -247,7 +247,7 @@ sudo_file_lookup(struct sudo_nss *nss, int validated, int pwflag)
|
|||||||
if (cs->type != NULL) {
|
if (cs->type != NULL) {
|
||||||
user_type = strdup(cs->type);
|
user_type = strdup(cs->type);
|
||||||
if (user_type == NULL) {
|
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);
|
SET(validated, VALIDATE_ERROR);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -262,7 +262,7 @@ sudo_file_lookup(struct sudo_nss *nss, int validated, int pwflag)
|
|||||||
if (cs->privs != NULL) {
|
if (cs->privs != NULL) {
|
||||||
runas_privs = strdup(cs->privs);
|
runas_privs = strdup(cs->privs);
|
||||||
if (runas_privs == NULL) {
|
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);
|
SET(validated, VALIDATE_ERROR);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -274,7 +274,7 @@ sudo_file_lookup(struct sudo_nss *nss, int validated, int pwflag)
|
|||||||
if (cs->limitprivs != NULL) {
|
if (cs->limitprivs != NULL) {
|
||||||
runas_limitprivs = strdup(cs->limitprivs);
|
runas_limitprivs = strdup(cs->limitprivs);
|
||||||
if (runas_limitprivs == NULL) {
|
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);
|
SET(validated, VALIDATE_ERROR);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
|
|||||||
debug_return_int(flags);
|
debug_return_int(flags);
|
||||||
|
|
||||||
oom:
|
oom:
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
bad:
|
bad:
|
||||||
debug_return_int(MODE_ERROR);
|
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);
|
debug_return_int(true);
|
||||||
|
|
||||||
oom:
|
oom:
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
bad:
|
bad:
|
||||||
while (info_len--)
|
while (info_len--)
|
||||||
free(command_info[info_len]);
|
free(command_info[info_len]);
|
||||||
|
@ -91,7 +91,7 @@ expand_prompt(const char *old_prompt, const char *auth_user)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((new_prompt = malloc(++len)) == NULL) {
|
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);
|
debug_return_str(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ sudo_sss_attrcpy(struct sss_sudo_attr *dst, const struct sss_sudo_attr *src)
|
|||||||
|
|
||||||
debug_return_bool(true);
|
debug_return_bool(true);
|
||||||
oom:
|
oom:
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
sudo_sss_attrfree(dst);
|
sudo_sss_attrfree(dst);
|
||||||
debug_return_bool(false);
|
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->num_attrs = 0;
|
||||||
dst->attrs = reallocarray(NULL, src->num_attrs, sizeof(struct sss_sudo_attr));
|
dst->attrs = reallocarray(NULL, src->num_attrs, sizeof(struct sss_sudo_attr));
|
||||||
if (dst->attrs == NULL) {
|
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);
|
debug_return_bool(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < src->num_attrs; ++i) {
|
for (i = 0; i < src->num_attrs; ++i) {
|
||||||
if (!sudo_sss_attrcpy(dst->attrs + i, src->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;
|
dst->num_attrs = i;
|
||||||
sudo_sss_rulefree(dst);
|
sudo_sss_rulefree(dst);
|
||||||
debug_return_bool(false);
|
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);
|
sudo_debug_printf(SUDO_DEBUG_DEBUG, "malloc: cnt=%d", in_res->num_rules);
|
||||||
|
|
||||||
if ((out_res = calloc(1, sizeof(struct sss_sudo_result))) == NULL) {
|
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);
|
debug_return_ptr(NULL);
|
||||||
}
|
}
|
||||||
if (in_res->num_rules > 0) {
|
if (in_res->num_rules > 0) {
|
||||||
out_res->rules =
|
out_res->rules =
|
||||||
reallocarray(NULL, in_res->num_rules, sizeof(struct sss_sudo_rule));
|
reallocarray(NULL, in_res->num_rules, sizeof(struct sss_sudo_rule));
|
||||||
if (out_res->rules == NULL) {
|
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);
|
free(out_res);
|
||||||
debug_return_ptr(NULL);
|
debug_return_ptr(NULL);
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ sudo_sss_filter_result(struct sudo_sss_handle *handle,
|
|||||||
struct sss_sudo_rule *rules =
|
struct sss_sudo_rule *rules =
|
||||||
reallocarray(out_res->rules, l, sizeof(struct sss_sudo_rule));
|
reallocarray(out_res->rules, l, sizeof(struct sss_sudo_rule));
|
||||||
if (out_res->rules == NULL) {
|
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--) {
|
while (l--) {
|
||||||
sudo_sss_rulefree(out_res->rules + l);
|
sudo_sss_rulefree(out_res->rules + l);
|
||||||
}
|
}
|
||||||
@ -324,7 +324,7 @@ sudo_sss_open(struct sudo_nss *nss)
|
|||||||
/* Create a handle container. */
|
/* Create a handle container. */
|
||||||
handle = malloc(sizeof(struct sudo_sss_handle));
|
handle = malloc(sizeof(struct sudo_sss_handle));
|
||||||
if (handle == NULL) {
|
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);
|
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_type = digest_type;
|
||||||
digest->digest_str = strndup(cp, (size_t)(ep - cp));
|
digest->digest_str = strndup(cp, (size_t)(ep - cp));
|
||||||
if (digest->digest_str == NULL) {
|
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);
|
debug_return_ptr(NULL);
|
||||||
}
|
}
|
||||||
cp = ep + 1;
|
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'",
|
sudo_debug_printf(SUDO_DEBUG_INFO, "sssd/ldap sudoOption: '%s'",
|
||||||
val_array[i]);
|
val_array[i]);
|
||||||
if ((v = strdup(val_array[i])) == NULL) {
|
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;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ sudoers_policy_init(void *info, char * const envp[])
|
|||||||
bindtextdomain("sudoers", LOCALEDIR);
|
bindtextdomain("sudoers", LOCALEDIR);
|
||||||
|
|
||||||
if (sudo_setpwent() == -1 || sudo_setgrent() == -1) {
|
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);
|
debug_return_int(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
|
|||||||
NewArgc = 1;
|
NewArgc = 1;
|
||||||
NewArgv = reallocarray(NULL, NewArgc + 1, sizeof(char *));
|
NewArgv = reallocarray(NULL, NewArgc + 1, sizeof(char *));
|
||||||
if (NewArgv == NULL) {
|
if (NewArgv == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
rval = -1;
|
rval = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -305,7 +305,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
|
|||||||
NewArgc = argc;
|
NewArgc = argc;
|
||||||
NewArgv = reallocarray(NULL, NewArgc + 2, sizeof(char *));
|
NewArgv = reallocarray(NULL, NewArgc + 2, sizeof(char *));
|
||||||
if (NewArgv == NULL) {
|
if (NewArgv == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
rval = -1;
|
rval = -1;
|
||||||
goto done;
|
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) {
|
if (ISSET(sudo_mode, MODE_LOGIN_SHELL) && runas_pw != NULL) {
|
||||||
NewArgv[0] = strdup(runas_pw->pw_shell);
|
NewArgv[0] = strdup(runas_pw->pw_shell);
|
||||||
if (NewArgv[0] == NULL) {
|
if (NewArgv[0] == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
free(NewArgv);
|
free(NewArgv);
|
||||||
rval = -1;
|
rval = -1;
|
||||||
goto done;
|
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 == NULL) {
|
||||||
if ((safe_cmnd = strdup(user_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;
|
rval = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -645,7 +645,7 @@ init_vars(char * const envp[])
|
|||||||
debug_decl(init_vars, SUDOERS_DEBUG_PLUGIN)
|
debug_decl(init_vars, SUDOERS_DEBUG_PLUGIN)
|
||||||
|
|
||||||
if (!sudoers_initlocale(setlocale(LC_ALL, NULL), def_sudoers_locale)) {
|
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);
|
debug_return_bool(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -731,7 +731,7 @@ set_cmnd(void)
|
|||||||
/* Allocate user_stat for find_path() and match functions. */
|
/* Allocate user_stat for find_path() and match functions. */
|
||||||
user_stat = calloc(1, sizeof(struct stat));
|
user_stat = calloc(1, sizeof(struct stat));
|
||||||
if (user_stat == NULL) {
|
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);
|
debug_return_int(NOT_FOUND_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -775,7 +775,7 @@ set_cmnd(void)
|
|||||||
for (size = 0, av = NewArgv + 1; *av; av++)
|
for (size = 0, av = NewArgv + 1; *av; av++)
|
||||||
size += strlen(*av) + 1;
|
size += strlen(*av) + 1;
|
||||||
if (size == 0 || (user_args = malloc(size)) == NULL) {
|
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);
|
debug_return_int(-1);
|
||||||
}
|
}
|
||||||
if (ISSET(sudo_mode, MODE_SHELL|MODE_LOGIN_SHELL)) {
|
if (ISSET(sudo_mode, MODE_SHELL|MODE_LOGIN_SHELL)) {
|
||||||
|
@ -106,7 +106,8 @@ oom:
|
|||||||
free(debug_file->debug_flags);
|
free(debug_file->debug_flags);
|
||||||
free(debug_file);
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ replay_session(const double max_wait, const char *decimal)
|
|||||||
reallocarray(iov, iovmax <<= 1, sizeof(*iov)) :
|
reallocarray(iov, iovmax <<= 1, sizeof(*iov)) :
|
||||||
reallocarray(NULL, iovmax = 32, sizeof(*iov));
|
reallocarray(NULL, iovmax = 32, sizeof(*iov));
|
||||||
if (iov == NULL)
|
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;
|
linelen = (size_t)(nl - line) + 1;
|
||||||
iov[iovcnt].iov_base = line;
|
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 */
|
/* Allocate new search node */
|
||||||
if ((sn = calloc(1, sizeof(*sn))) == NULL)
|
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->type = type;
|
||||||
sn->or = or;
|
sn->or = or;
|
||||||
sn->negated = not;
|
sn->negated = not;
|
||||||
@ -794,7 +794,7 @@ parse_logfile(char *logfile)
|
|||||||
* 3) command with args
|
* 3) command with args
|
||||||
*/
|
*/
|
||||||
if ((li = calloc(1, sizeof(*li))) == NULL)
|
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 ||
|
if (getline(&buf, &bufsize, fp) == -1 ||
|
||||||
getline(&li->cwd, &cwdsize, fp) == -1 ||
|
getline(&li->cwd, &cwdsize, fp) == -1 ||
|
||||||
getline(&li->cmd, &cmdsize, fp) == -1) {
|
getline(&li->cmd, &cmdsize, fp) == -1) {
|
||||||
@ -834,7 +834,7 @@ parse_logfile(char *logfile)
|
|||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
if ((li->user = strndup(cp, (size_t)(ep - cp))) == NULL)
|
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 */
|
/* runas user */
|
||||||
cp = ep + 1;
|
cp = ep + 1;
|
||||||
@ -843,7 +843,7 @@ parse_logfile(char *logfile)
|
|||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
if ((li->runas_user = strndup(cp, (size_t)(ep - cp))) == NULL)
|
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 */
|
/* runas group */
|
||||||
cp = ep + 1;
|
cp = ep + 1;
|
||||||
@ -853,7 +853,7 @@ parse_logfile(char *logfile)
|
|||||||
}
|
}
|
||||||
if (cp != ep) {
|
if (cp != ep) {
|
||||||
if ((li->runas_group = strndup(cp, (size_t)(ep - cp))) == NULL)
|
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 */
|
/* tty, followed by optional rows + columns */
|
||||||
@ -861,11 +861,11 @@ parse_logfile(char *logfile)
|
|||||||
if ((ep = strchr(cp, ':')) == NULL) {
|
if ((ep = strchr(cp, ':')) == NULL) {
|
||||||
/* just the tty */
|
/* just the tty */
|
||||||
if ((li->tty = strdup(cp)) == NULL)
|
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 {
|
} else {
|
||||||
/* tty followed by rows + columns */
|
/* tty followed by rows + columns */
|
||||||
if ((li->tty = strndup(cp, (size_t)(ep - cp))) == NULL)
|
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;
|
cp = ep + 1;
|
||||||
/* need to NULL out separator to use strtonum() */
|
/* need to NULL out separator to use strtonum() */
|
||||||
if ((ep = strchr(cp, ':')) != NULL) {
|
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_size = 36 * 36 / 2;
|
||||||
sessions = reallocarray(sessions, sessions_size, 2 * sizeof(char *));
|
sessions = reallocarray(sessions, sessions_size, 2 * sizeof(char *));
|
||||||
if (sessions == NULL)
|
if (sessions == NULL)
|
||||||
sudo_fatalx(U_("unable to allocate memory"));
|
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
sessions_size *= 2;
|
sessions_size *= 2;
|
||||||
}
|
}
|
||||||
if ((sessions[sessions_len] = strdup(dp->d_name)) == NULL)
|
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++;
|
sessions_len++;
|
||||||
}
|
}
|
||||||
closedir(d);
|
closedir(d);
|
||||||
|
@ -130,7 +130,7 @@ main(int argc, char *argv[])
|
|||||||
initprogname(argc > 0 ? argv[0] : "testsudoers");
|
initprogname(argc > 0 ? argv[0] : "testsudoers");
|
||||||
|
|
||||||
if (!sudoers_initlocale(setlocale(LC_ALL, ""), def_sudoers_locale))
|
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 */
|
bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have own domain */
|
||||||
textdomain("sudoers");
|
textdomain("sudoers");
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ main(int argc, char *argv[])
|
|||||||
if (pwfile)
|
if (pwfile)
|
||||||
setpwfile(pwfile);
|
setpwfile(pwfile);
|
||||||
if (sudo_setpwent() == -1 || sudo_setgrent() == -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"));
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
if (!dflag)
|
if (!dflag)
|
||||||
@ -214,7 +214,7 @@ main(int argc, char *argv[])
|
|||||||
if ((p = strchr(user_host, '.'))) {
|
if ((p = strchr(user_host, '.'))) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if ((user_shost = strdup(user_host)) == NULL)
|
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 = '.';
|
*p = '.';
|
||||||
} else {
|
} else {
|
||||||
user_shost = user_host;
|
user_shost = user_host;
|
||||||
@ -231,7 +231,7 @@ main(int argc, char *argv[])
|
|||||||
size += strlen(*from) + 1;
|
size += strlen(*from) + 1;
|
||||||
|
|
||||||
if ((user_args = malloc(size)) == NULL)
|
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++) {
|
for (to = user_args, from = argv; *from; from++) {
|
||||||
n = strlcpy(to, *from, size - (to - user_args));
|
n = strlcpy(to, *from, size - (to - user_args));
|
||||||
if (n >= size - (to - user_args))
|
if (n >= size - (to - user_args))
|
||||||
|
@ -155,7 +155,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
initprogname(argc > 0 ? argv[0] : "visudo");
|
initprogname(argc > 0 ? argv[0] : "visudo");
|
||||||
if (!sudoers_initlocale(setlocale(LC_ALL, ""), def_sudoers_locale))
|
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 */
|
bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have visudo domain */
|
||||||
textdomain("sudoers");
|
textdomain("sudoers");
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ main(int argc, char *argv[])
|
|||||||
usage(1);
|
usage(1);
|
||||||
|
|
||||||
if (sudo_setpwent() == -1 || sudo_setgrent() == -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. */
|
/* Mock up a fake sudo_user struct. */
|
||||||
user_cmnd = user_base = "";
|
user_cmnd = user_base = "";
|
||||||
@ -299,13 +299,13 @@ get_editor(int *editor_argc, char ***editor_argv)
|
|||||||
}
|
}
|
||||||
whitelist = reallocarray(NULL, whitelist_len + 1, sizeof(char *));
|
whitelist = reallocarray(NULL, whitelist_len + 1, sizeof(char *));
|
||||||
if (whitelist == NULL)
|
if (whitelist == NULL)
|
||||||
sudo_fatalx(U_("unable to allocate memory"));
|
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
whitelist_len = 0;
|
whitelist_len = 0;
|
||||||
for (cp = sudo_strsplit(def_editor, def_editor_end, ":", &ep);
|
for (cp = sudo_strsplit(def_editor, def_editor_end, ":", &ep);
|
||||||
cp != NULL; cp = sudo_strsplit(NULL, def_editor_end, ":", &ep)) {
|
cp != NULL; cp = sudo_strsplit(NULL, def_editor_end, ":", &ep)) {
|
||||||
whitelist[whitelist_len] = strndup(cp, (size_t)(ep - cp));
|
whitelist[whitelist_len] = strndup(cp, (size_t)(ep - cp));
|
||||||
if (whitelist[whitelist_len] == NULL)
|
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_len++;
|
||||||
}
|
}
|
||||||
whitelist[whitelist_len] = NULL;
|
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. */
|
/* Create the temp file if needed and set timestamp. */
|
||||||
if (sp->tpath == NULL) {
|
if (sp->tpath == NULL) {
|
||||||
if (asprintf(&sp->tpath, "%s.tmp", sp->path) == -1)
|
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);
|
tfd = open(sp->tpath, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
||||||
if (tfd < 0)
|
if (tfd < 0)
|
||||||
sudo_fatal("%s", sp->tpath);
|
sudo_fatal("%s", sp->tpath);
|
||||||
@ -971,7 +971,7 @@ open_sudoers(const char *path, bool doedit, bool *keepopen)
|
|||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
entry = calloc(1, sizeof(*entry));
|
entry = calloc(1, sizeof(*entry));
|
||||||
if (entry == NULL || (entry->path = strdup(path)) == NULL)
|
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->modified = 0; */
|
||||||
entry->fd = open(entry->path, open_flags, sudoers_mode);
|
entry->fd = open(entry->path, open_flags, sudoers_mode);
|
||||||
/* entry->tpath = NULL; */
|
/* entry->tpath = NULL; */
|
||||||
@ -1015,7 +1015,7 @@ get_hostname(void)
|
|||||||
if ((p = strchr(user_host, '.'))) {
|
if ((p = strchr(user_host, '.'))) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if ((user_shost = strdup(user_host)) == NULL)
|
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 = '.';
|
*p = '.';
|
||||||
} else {
|
} else {
|
||||||
user_shost = user_host;
|
user_shost = user_host;
|
||||||
@ -1111,7 +1111,7 @@ check_aliases(bool strict, bool quiet)
|
|||||||
|
|
||||||
alias_freelist = rbcreate(alias_compare);
|
alias_freelist = rbcreate(alias_compare);
|
||||||
if (alias_freelist == NULL) {
|
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);
|
debug_return_int(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,8 +71,10 @@ sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[],
|
|||||||
pass = tgetpass(msg->msg, msg->timeout, flags);
|
pass = tgetpass(msg->msg, msg->timeout, flags);
|
||||||
if (pass == NULL)
|
if (pass == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
if ((repl->reply = strdup(pass)) == NULL)
|
if ((repl->reply = strdup(pass)) == NULL) {
|
||||||
sudo_fatalx_nodebug(U_("unable to allocate memory"));
|
sudo_fatalx_nodebug(U_("%s: %s"), "sudo_conversation",
|
||||||
|
U_("unable to allocate memory"));
|
||||||
|
}
|
||||||
memset_s(pass, SUDO_CONV_REPL_MAX, 0, strlen(pass));
|
memset_s(pass, SUDO_CONV_REPL_MAX, 0, strlen(pass));
|
||||||
break;
|
break;
|
||||||
case SUDO_CONV_INFO_MSG:
|
case SUDO_CONV_INFO_MSG:
|
||||||
|
@ -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);
|
sudo_debug_printf(SUDO_DEBUG_DIAG, "scheduled SIG%s for child", signame);
|
||||||
|
|
||||||
if ((sigfwd = calloc(1, sizeof(*sigfwd))) == NULL)
|
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;
|
sigfwd->signo = signo;
|
||||||
TAILQ_INSERT_TAIL(&sigfwd_list, sigfwd, entries);
|
TAILQ_INSERT_TAIL(&sigfwd_list, sigfwd, entries);
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ disable_execute(char *const envp[])
|
|||||||
#endif
|
#endif
|
||||||
nenvp = reallocarray(NULL, env_size, sizeof(*envp));
|
nenvp = reallocarray(NULL, env_size, sizeof(*envp));
|
||||||
if (nenvp == NULL)
|
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));
|
memcpy(nenvp, envp, env_len * sizeof(*envp));
|
||||||
nenvp[env_len] = NULL;
|
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());
|
preload = sudo_new_key_val(RTLD_PRELOAD_VAR, sudo_conf_noexec_path());
|
||||||
# endif
|
# endif
|
||||||
if (preload == NULL)
|
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++] = preload;
|
||||||
nenvp[env_len] = NULL;
|
nenvp[env_len] = NULL;
|
||||||
} else {
|
} else {
|
||||||
int len = asprintf(&preload, "%s=%s%s%s", RTLD_PRELOAD_VAR,
|
int len = asprintf(&preload, "%s=%s%s%s", RTLD_PRELOAD_VAR,
|
||||||
sudo_conf_noexec_path(), RTLD_PRELOAD_DELIM, nenvp[preload_idx]);
|
sudo_conf_noexec_path(), RTLD_PRELOAD_DELIM, nenvp[preload_idx]);
|
||||||
if (len == -1)
|
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;
|
nenvp[preload_idx] = preload;
|
||||||
}
|
}
|
||||||
# ifdef RTLD_PRELOAD_ENABLE_VAR
|
# ifdef RTLD_PRELOAD_ENABLE_VAR
|
||||||
|
@ -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. */
|
/* Allocate and add to head of list. */
|
||||||
if ((iob = malloc(sizeof(*iob))) == NULL)
|
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->revent = sudo_ev_alloc(rfd, SUDO_EV_READ, io_callback, iob);
|
||||||
iob->wevent = sudo_ev_alloc(wfd, SUDO_EV_WRITE, io_callback, iob);
|
iob->wevent = sudo_ev_alloc(wfd, SUDO_EV_WRITE, io_callback, iob);
|
||||||
iob->len = 0;
|
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->action = action;
|
||||||
iob->buf[0] = '\0';
|
iob->buf[0] = '\0';
|
||||||
if (iob->revent == NULL || iob->wevent == NULL)
|
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);
|
SLIST_INSERT_HEAD(head, iob, entries);
|
||||||
|
|
||||||
debug_return;
|
debug_return;
|
||||||
|
@ -206,7 +206,7 @@ sudo_load_plugin(struct plugin_container *policy_plugin,
|
|||||||
policy_plugin->handle = handle;
|
policy_plugin->handle = handle;
|
||||||
policy_plugin->path = strdup(path);
|
policy_plugin->path = strdup(path);
|
||||||
if (policy_plugin->path == NULL) {
|
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;
|
goto bad;
|
||||||
}
|
}
|
||||||
policy_plugin->name = info->symbol_name;
|
policy_plugin->name = info->symbol_name;
|
||||||
@ -229,7 +229,7 @@ sudo_load_plugin(struct plugin_container *policy_plugin,
|
|||||||
if (handle != NULL) {
|
if (handle != NULL) {
|
||||||
container = calloc(1, sizeof(*container));
|
container = calloc(1, sizeof(*container));
|
||||||
if (container == NULL || (container->path = strdup(path)) == NULL) {
|
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;
|
goto bad;
|
||||||
}
|
}
|
||||||
container->handle = handle;
|
container->handle = handle;
|
||||||
@ -294,7 +294,7 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
|
|||||||
/* Default policy plugin */
|
/* Default policy plugin */
|
||||||
info = calloc(1, sizeof(*info));
|
info = calloc(1, sizeof(*info));
|
||||||
if (info == NULL) {
|
if (info == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
info->symbol_name = "sudoers_policy";
|
info->symbol_name = "sudoers_policy";
|
||||||
@ -309,7 +309,7 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
|
|||||||
if (TAILQ_EMPTY(io_plugins)) {
|
if (TAILQ_EMPTY(io_plugins)) {
|
||||||
info = calloc(1, sizeof(*info));
|
info = calloc(1, sizeof(*info));
|
||||||
if (info == NULL) {
|
if (info == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
info->symbol_name = "sudoers_io";
|
info->symbol_name = "sudoers_io";
|
||||||
|
@ -180,7 +180,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv,
|
|||||||
|
|
||||||
env_add = reallocarray(NULL, env_size, sizeof(char *));
|
env_add = reallocarray(NULL, env_size, sizeof(char *));
|
||||||
if (env_add == NULL)
|
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() */
|
/* Pass progname to plugin so it can call initprogname() */
|
||||||
progname = getprogname();
|
progname = getprogname();
|
||||||
@ -202,7 +202,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv,
|
|||||||
i = sudo_conf_max_groups();
|
i = sudo_conf_max_groups();
|
||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
if (asprintf(&cp, "%d", 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;
|
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 *));
|
tmp = reallocarray(env_add, env_size, 2 * sizeof(char *));
|
||||||
if (tmp == NULL)
|
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_add = tmp;
|
||||||
env_size *= 2;
|
env_size *= 2;
|
||||||
}
|
}
|
||||||
@ -466,7 +466,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv,
|
|||||||
|
|
||||||
cmnd = dst = reallocarray(NULL, cmnd_size, 2);
|
cmnd = dst = reallocarray(NULL, cmnd_size, 2);
|
||||||
if (cmnd == NULL)
|
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 (av = argv; *av != NULL; av++) {
|
||||||
for (src = *av; *src != '\0'; src++) {
|
for (src = *av; *src != '\0'; src++) {
|
||||||
/* quote potential meta characters */
|
/* 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 *));
|
av = reallocarray(NULL, ac + 1, sizeof(char *));
|
||||||
if (av == NULL)
|
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 */
|
av[0] = (char *)user_details.shell; /* plugin may override shell */
|
||||||
if (cmnd != NULL) {
|
if (cmnd != NULL) {
|
||||||
av[1] = "-c";
|
av[1] = "-c";
|
||||||
|
@ -52,7 +52,7 @@ add_preserved_fd(struct preserved_fd_list *pfds, int fd)
|
|||||||
|
|
||||||
pfd_new = malloc(sizeof(*pfd));
|
pfd_new = malloc(sizeof(*pfd));
|
||||||
if (pfd_new == NULL)
|
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->lowfd = fd;
|
||||||
pfd_new->highfd = fd;
|
pfd_new->highfd = fd;
|
||||||
pfd_new->flags = fcntl(fd, F_GETFD);
|
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. */
|
/* Create bitmap of preserved (relocated) fds. */
|
||||||
fdsp = calloc(howmany(lastfd + 1, NFDBITS), sizeof(fd_mask));
|
fdsp = calloc(howmany(lastfd + 1, NFDBITS), sizeof(fd_mask));
|
||||||
if (fdsp == NULL)
|
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) {
|
TAILQ_FOREACH(pfd, pfds, entries) {
|
||||||
FD_SET(pfd->lowfd, fdsp);
|
FD_SET(pfd->lowfd, fdsp);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ audit_role_change(const security_context_t old_context,
|
|||||||
rc = asprintf(&message, "newrole: old-context=%s new-context=%s",
|
rc = asprintf(&message, "newrole: old-context=%s new-context=%s",
|
||||||
old_context, new_context);
|
old_context, new_context);
|
||||||
if (rc == -1)
|
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,
|
rc = audit_log_user_message(au_fd, AUDIT_USER_ROLE_CHANGE,
|
||||||
message, NULL, NULL, ttyn, result);
|
message, NULL, NULL, ttyn, result);
|
||||||
if (rc <= 0)
|
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.
|
* Convert "context" back into a string and verify it.
|
||||||
*/
|
*/
|
||||||
if ((new_context = strdup(context_str(context))) == NULL) {
|
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;
|
goto bad;
|
||||||
}
|
}
|
||||||
if (security_check_context(new_context) < 0) {
|
if (security_check_context(new_context) < 0) {
|
||||||
@ -412,7 +412,7 @@ selinux_execve(const char *path, char *const argv[], char *const envp[],
|
|||||||
continue;
|
continue;
|
||||||
nargv = reallocarray(NULL, argc + 2, sizeof(char *));
|
nargv = reallocarray(NULL, argc + 2, sizeof(char *));
|
||||||
if (nargv == NULL) {
|
if (nargv == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
debug_return;
|
debug_return;
|
||||||
}
|
}
|
||||||
if (noexec)
|
if (noexec)
|
||||||
|
@ -98,7 +98,7 @@ main(int argc, char *argv[], char *envp[])
|
|||||||
argv++;
|
argv++;
|
||||||
argc--;
|
argc--;
|
||||||
if ((cmnd = strdup(argv[0])) == NULL)
|
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 invoked as a login shell, modify argv[0] accordingly. */
|
||||||
if (login_shell) {
|
if (login_shell) {
|
||||||
|
@ -181,7 +181,7 @@ main(int argc, char *argv[], char *envp[])
|
|||||||
|
|
||||||
/* Fill in user_info with user name, uid, cwd, etc. */
|
/* Fill in user_info with user name, uid, cwd, etc. */
|
||||||
if ((user_info = get_user_info(&user_details)) == NULL)
|
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 core dumps if not enabled in sudo.conf. */
|
||||||
disable_coredumps();
|
disable_coredumps();
|
||||||
@ -358,7 +358,7 @@ fill_group_list(struct user_details *ud, int system_maxgroups)
|
|||||||
if (ud->ngroups > 0) {
|
if (ud->ngroups > 0) {
|
||||||
ud->groups = reallocarray(NULL, ud->ngroups, sizeof(GETGROUPS_T));
|
ud->groups = reallocarray(NULL, ud->ngroups, sizeof(GETGROUPS_T));
|
||||||
if (ud->groups == NULL) {
|
if (ud->groups == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* No error on insufficient space if user specified max_groups. */
|
/* 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);
|
free(ud->groups);
|
||||||
ud->groups = reallocarray(NULL, ud->ngroups, sizeof(GETGROUPS_T));
|
ud->groups = reallocarray(NULL, ud->ngroups, sizeof(GETGROUPS_T));
|
||||||
if (ud->groups == NULL) {
|
if (ud->groups == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
rval = getgrouplist(ud->username, ud->gid, ud->groups, &ud->ngroups);
|
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);
|
debug_return_str(gid_list);
|
||||||
oom:
|
oom:
|
||||||
sudo_fatalx(U_("unable to allocate memory"));
|
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -153,7 +153,7 @@ sudo_edit_mktemp(const char *ofile, char **tfile)
|
|||||||
len = asprintf(tfile, "%s/%s.XXXXXXXX", edit_tmpdir, cp);
|
len = asprintf(tfile, "%s/%s.XXXXXXXX", edit_tmpdir, cp);
|
||||||
}
|
}
|
||||||
if (len == -1)
|
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);
|
tfd = mkstemps(*tfile, suff ? strlen(suff) : 0);
|
||||||
sudo_debug_printf(SUDO_DEBUG_INFO|SUDO_DEBUG_LINENO,
|
sudo_debug_printf(SUDO_DEBUG_INFO|SUDO_DEBUG_LINENO,
|
||||||
"%s -> %s, fd %d", ofile, *tfile, tfd);
|
"%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_nargs = 3 + (nfiles * 2) + 1;
|
||||||
sesh_args = sesh_ap = reallocarray(NULL, sesh_nargs, sizeof(char *));
|
sesh_args = sesh_ap = reallocarray(NULL, sesh_nargs, sizeof(char *));
|
||||||
if (sesh_args == NULL) {
|
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);
|
debug_return_int(-1);
|
||||||
}
|
}
|
||||||
*sesh_ap++ = "sesh";
|
*sesh_ap++ = "sesh";
|
||||||
@ -469,7 +469,7 @@ selinux_edit_copy_tfiles(struct command_details *command_details,
|
|||||||
sesh_nargs = 3 + (nfiles * 2) + 1;
|
sesh_nargs = 3 + (nfiles * 2) + 1;
|
||||||
sesh_args = sesh_ap = reallocarray(NULL, sesh_nargs, sizeof(char *));
|
sesh_args = sesh_ap = reallocarray(NULL, sesh_nargs, sizeof(char *));
|
||||||
if (sesh_args == NULL) {
|
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);
|
debug_return_int(-1);
|
||||||
}
|
}
|
||||||
*sesh_ap++ = "sesh";
|
*sesh_ap++ = "sesh";
|
||||||
@ -581,7 +581,7 @@ sudo_edit(struct command_details *command_details)
|
|||||||
/* Copy editor files to temporaries. */
|
/* Copy editor files to temporaries. */
|
||||||
tf = calloc(nfiles, sizeof(*tf));
|
tf = calloc(nfiles, sizeof(*tf));
|
||||||
if (tf == NULL) {
|
if (tf == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_SELINUX
|
#ifdef HAVE_SELINUX
|
||||||
@ -601,7 +601,7 @@ sudo_edit(struct command_details *command_details)
|
|||||||
nargc = editor_argc + nfiles;
|
nargc = editor_argc + nfiles;
|
||||||
nargv = reallocarray(NULL, nargc + 1, sizeof(char *));
|
nargv = reallocarray(NULL, nargc + 1, sizeof(char *));
|
||||||
if (nargv == NULL) {
|
if (nargv == NULL) {
|
||||||
sudo_warnx(U_("unable to allocate memory"));
|
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
for (ac = 0; ac < editor_argc; ac++)
|
for (ac = 0; ac < editor_argc; ac++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user