mirror of
git://anongit.mindrot.org/openssh.git
synced 2025-01-03 00:02:05 +00:00
- (dtucker) [M auth-chall.c auth-krb5.c auth-pam.c cipher-aes.c cipher-ctr.c
groupaccess.c loginrec.c monitor.c monitor_wrap.c session.c sshd.c sshlogin.c uidswap.c openbsd-compat/bsd-cygwin_util.c openbsd-compat/getrrsetbyname-ldns.c openbsd-compat/port-aix.c openbsd-compat/port-linux.c] Replace portable-specific instances of xfree with the equivalent calls to free.
This commit is contained in:
parent
12f6533215
commit
f60845fde2
@ -48,6 +48,12 @@
|
|||||||
[scp.c sftp-client.c]
|
[scp.c sftp-client.c]
|
||||||
Replace S_IWRITE, which isn't standardized, with S_IWUSR, which is. Patch
|
Replace S_IWRITE, which isn't standardized, with S_IWUSR, which is. Patch
|
||||||
from Nathan Osman via bz#2085. ok deraadt.
|
from Nathan Osman via bz#2085. ok deraadt.
|
||||||
|
- (dtucker) [M auth-chall.c auth-krb5.c auth-pam.c cipher-aes.c cipher-ctr.c
|
||||||
|
groupaccess.c loginrec.c monitor.c monitor_wrap.c session.c sshd.c
|
||||||
|
sshlogin.c uidswap.c openbsd-compat/bsd-cygwin_util.c
|
||||||
|
openbsd-compat/getrrsetbyname-ldns.c openbsd-compat/port-aix.c
|
||||||
|
openbsd-compat/port-linux.c] Replace portable-specific instances of xfree
|
||||||
|
with the equivalent calls to free.
|
||||||
|
|
||||||
20130529
|
20130529
|
||||||
- (dtucker) [configure.ac openbsd-compat/bsd-misc.h] bz#2087: Add a null
|
- (dtucker) [configure.ac openbsd-compat/bsd-misc.h] bz#2087: Add a null
|
||||||
|
10
auth-chall.c
10
auth-chall.c
@ -102,11 +102,11 @@ verify_response(Authctxt *authctxt, const char *response)
|
|||||||
authenticated = 1;
|
authenticated = 1;
|
||||||
|
|
||||||
for (i = 0; i < numprompts; i++)
|
for (i = 0; i < numprompts; i++)
|
||||||
xfree(prompts[i]);
|
free(prompts[i]);
|
||||||
xfree(prompts);
|
free(prompts);
|
||||||
xfree(name);
|
free(name);
|
||||||
xfree(echo_on);
|
free(echo_on);
|
||||||
xfree(info);
|
free(info);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
device->free_ctx(authctxt->kbdintctxt);
|
device->free_ctx(authctxt->kbdintctxt);
|
||||||
|
@ -181,8 +181,7 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
|
|||||||
out:
|
out:
|
||||||
restore_uid();
|
restore_uid();
|
||||||
|
|
||||||
if (platform_client != NULL)
|
free(platform_client);
|
||||||
xfree(platform_client);
|
|
||||||
|
|
||||||
if (problem) {
|
if (problem) {
|
||||||
if (ccache)
|
if (ccache)
|
||||||
|
44
auth-pam.c
44
auth-pam.c
@ -412,10 +412,9 @@ sshpam_thread_conv(int n, sshpam_const struct pam_message **msg,
|
|||||||
|
|
||||||
fail:
|
fail:
|
||||||
for(i = 0; i < n; i++) {
|
for(i = 0; i < n; i++) {
|
||||||
if (reply[i].resp != NULL)
|
free(reply[i].resp);
|
||||||
xfree(reply[i].resp);
|
|
||||||
}
|
}
|
||||||
xfree(reply);
|
free(reply);
|
||||||
buffer_free(&buffer);
|
buffer_free(&buffer);
|
||||||
return (PAM_CONV_ERR);
|
return (PAM_CONV_ERR);
|
||||||
}
|
}
|
||||||
@ -586,10 +585,9 @@ sshpam_store_conv(int n, sshpam_const struct pam_message **msg,
|
|||||||
|
|
||||||
fail:
|
fail:
|
||||||
for(i = 0; i < n; i++) {
|
for(i = 0; i < n; i++) {
|
||||||
if (reply[i].resp != NULL)
|
free(reply[i].resp);
|
||||||
xfree(reply[i].resp);
|
|
||||||
}
|
}
|
||||||
xfree(reply);
|
free(reply);
|
||||||
return (PAM_CONV_ERR);
|
return (PAM_CONV_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,7 +691,7 @@ sshpam_init_ctx(Authctxt *authctxt)
|
|||||||
/* Start the authentication thread */
|
/* Start the authentication thread */
|
||||||
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, socks) == -1) {
|
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, socks) == -1) {
|
||||||
error("PAM: failed create sockets: %s", strerror(errno));
|
error("PAM: failed create sockets: %s", strerror(errno));
|
||||||
xfree(ctxt);
|
free(ctxt);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
ctxt->pam_psock = socks[0];
|
ctxt->pam_psock = socks[0];
|
||||||
@ -703,7 +701,7 @@ sshpam_init_ctx(Authctxt *authctxt)
|
|||||||
strerror(errno));
|
strerror(errno));
|
||||||
close(socks[0]);
|
close(socks[0]);
|
||||||
close(socks[1]);
|
close(socks[1]);
|
||||||
xfree(ctxt);
|
free(ctxt);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
cleanup_ctxt = ctxt;
|
cleanup_ctxt = ctxt;
|
||||||
@ -742,7 +740,7 @@ sshpam_query(void *ctx, char **name, char **info,
|
|||||||
strlcpy(**prompts + plen, msg, len - plen);
|
strlcpy(**prompts + plen, msg, len - plen);
|
||||||
plen += mlen;
|
plen += mlen;
|
||||||
**echo_on = (type == PAM_PROMPT_ECHO_ON);
|
**echo_on = (type == PAM_PROMPT_ECHO_ON);
|
||||||
xfree(msg);
|
free(msg);
|
||||||
return (0);
|
return (0);
|
||||||
case PAM_ERROR_MSG:
|
case PAM_ERROR_MSG:
|
||||||
case PAM_TEXT_INFO:
|
case PAM_TEXT_INFO:
|
||||||
@ -753,7 +751,7 @@ sshpam_query(void *ctx, char **name, char **info,
|
|||||||
plen += mlen;
|
plen += mlen;
|
||||||
strlcat(**prompts + plen, "\n", len - plen);
|
strlcat(**prompts + plen, "\n", len - plen);
|
||||||
plen++;
|
plen++;
|
||||||
xfree(msg);
|
free(msg);
|
||||||
break;
|
break;
|
||||||
case PAM_ACCT_EXPIRED:
|
case PAM_ACCT_EXPIRED:
|
||||||
sshpam_account_status = 0;
|
sshpam_account_status = 0;
|
||||||
@ -766,7 +764,7 @@ sshpam_query(void *ctx, char **name, char **info,
|
|||||||
*num = 0;
|
*num = 0;
|
||||||
**echo_on = 0;
|
**echo_on = 0;
|
||||||
ctxt->pam_done = -1;
|
ctxt->pam_done = -1;
|
||||||
xfree(msg);
|
free(msg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
@ -776,7 +774,7 @@ sshpam_query(void *ctx, char **name, char **info,
|
|||||||
debug("PAM: %s", **prompts);
|
debug("PAM: %s", **prompts);
|
||||||
buffer_append(&loginmsg, **prompts,
|
buffer_append(&loginmsg, **prompts,
|
||||||
strlen(**prompts));
|
strlen(**prompts));
|
||||||
xfree(**prompts);
|
free(**prompts);
|
||||||
**prompts = NULL;
|
**prompts = NULL;
|
||||||
}
|
}
|
||||||
if (type == PAM_SUCCESS) {
|
if (type == PAM_SUCCESS) {
|
||||||
@ -790,7 +788,7 @@ sshpam_query(void *ctx, char **name, char **info,
|
|||||||
*num = 0;
|
*num = 0;
|
||||||
**echo_on = 0;
|
**echo_on = 0;
|
||||||
ctxt->pam_done = 1;
|
ctxt->pam_done = 1;
|
||||||
xfree(msg);
|
free(msg);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
error("PAM: %s for %s%.100s from %.100s", msg,
|
error("PAM: %s for %s%.100s from %.100s", msg,
|
||||||
@ -801,7 +799,7 @@ sshpam_query(void *ctx, char **name, char **info,
|
|||||||
default:
|
default:
|
||||||
*num = 0;
|
*num = 0;
|
||||||
**echo_on = 0;
|
**echo_on = 0;
|
||||||
xfree(msg);
|
free(msg);
|
||||||
ctxt->pam_done = -1;
|
ctxt->pam_done = -1;
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -852,7 +850,7 @@ sshpam_free_ctx(void *ctxtp)
|
|||||||
|
|
||||||
debug3("PAM: %s entering", __func__);
|
debug3("PAM: %s entering", __func__);
|
||||||
sshpam_thread_cleanup();
|
sshpam_thread_cleanup();
|
||||||
xfree(ctxt);
|
free(ctxt);
|
||||||
/*
|
/*
|
||||||
* We don't call sshpam_cleanup() here because we may need the PAM
|
* We don't call sshpam_cleanup() here because we may need the PAM
|
||||||
* handle at a later stage, e.g. when setting up a session. It's
|
* handle at a later stage, e.g. when setting up a session. It's
|
||||||
@ -1006,10 +1004,9 @@ sshpam_tty_conv(int n, sshpam_const struct pam_message **msg,
|
|||||||
|
|
||||||
fail:
|
fail:
|
||||||
for(i = 0; i < n; i++) {
|
for(i = 0; i < n; i++) {
|
||||||
if (reply[i].resp != NULL)
|
free(reply[i].resp);
|
||||||
xfree(reply[i].resp);
|
|
||||||
}
|
}
|
||||||
xfree(reply);
|
free(reply);
|
||||||
return (PAM_CONV_ERR);
|
return (PAM_CONV_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1081,7 +1078,7 @@ do_pam_putenv(char *name, char *value)
|
|||||||
|
|
||||||
snprintf(compound, len, "%s=%s", name, value);
|
snprintf(compound, len, "%s=%s", name, value);
|
||||||
ret = pam_putenv(sshpam_handle, compound);
|
ret = pam_putenv(sshpam_handle, compound);
|
||||||
xfree(compound);
|
free(compound);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
@ -1108,8 +1105,8 @@ free_pam_environment(char **env)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (envp = env; *envp; envp++)
|
for (envp = env; *envp; envp++)
|
||||||
xfree(*envp);
|
free(*envp);
|
||||||
xfree(env);
|
free(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1165,10 +1162,9 @@ sshpam_passwd_conv(int n, sshpam_const struct pam_message **msg,
|
|||||||
|
|
||||||
fail:
|
fail:
|
||||||
for(i = 0; i < n; i++) {
|
for(i = 0; i < n; i++) {
|
||||||
if (reply[i].resp != NULL)
|
free(reply[i].resp);
|
||||||
xfree(reply[i].resp);
|
|
||||||
}
|
}
|
||||||
xfree(reply);
|
free(reply);
|
||||||
return (PAM_CONV_ERR);
|
return (PAM_CONV_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ ssh_rijndael_cleanup(EVP_CIPHER_CTX *ctx)
|
|||||||
|
|
||||||
if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) != NULL) {
|
if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) != NULL) {
|
||||||
memset(c, 0, sizeof(*c));
|
memset(c, 0, sizeof(*c));
|
||||||
xfree(c);
|
free(c);
|
||||||
EVP_CIPHER_CTX_set_app_data(ctx, NULL);
|
EVP_CIPHER_CTX_set_app_data(ctx, NULL);
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
|
@ -104,7 +104,7 @@ ssh_aes_ctr_cleanup(EVP_CIPHER_CTX *ctx)
|
|||||||
|
|
||||||
if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) != NULL) {
|
if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) != NULL) {
|
||||||
memset(c, 0, sizeof(*c));
|
memset(c, 0, sizeof(*c));
|
||||||
xfree(c);
|
free(c);
|
||||||
EVP_CIPHER_CTX_set_app_data(ctx, NULL);
|
EVP_CIPHER_CTX_set_app_data(ctx, NULL);
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
|
@ -69,7 +69,7 @@ ga_init(const char *user, gid_t base)
|
|||||||
for (i = 0, j = 0; i < ngroups; i++)
|
for (i = 0, j = 0; i < ngroups; i++)
|
||||||
if ((gr = getgrgid(groups_bygid[i])) != NULL)
|
if ((gr = getgrgid(groups_bygid[i])) != NULL)
|
||||||
groups_byname[j++] = xstrdup(gr->gr_name);
|
groups_byname[j++] = xstrdup(gr->gr_name);
|
||||||
xfree(groups_bygid);
|
free(groups_bygid);
|
||||||
return (ngroups = j);
|
return (ngroups = j);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,6 +125,6 @@ ga_free(void)
|
|||||||
for (i = 0; i < ngroups; i++)
|
for (i = 0; i < ngroups; i++)
|
||||||
free(groups_byname[i]);
|
free(groups_byname[i]);
|
||||||
ngroups = 0;
|
ngroups = 0;
|
||||||
xfree(groups_byname);
|
free(groups_byname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ logininfo *login_alloc_entry(pid_t pid, const char *username,
|
|||||||
void
|
void
|
||||||
login_free_entry(struct logininfo *li)
|
login_free_entry(struct logininfo *li)
|
||||||
{
|
{
|
||||||
xfree(li);
|
free(li);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
20
monitor.c
20
monitor.c
@ -988,7 +988,7 @@ mm_answer_skeyrespond(int sock, Buffer *m)
|
|||||||
skey_haskey(authctxt->pw->pw_name) == 0 &&
|
skey_haskey(authctxt->pw->pw_name) == 0 &&
|
||||||
skey_passcheck(authctxt->pw->pw_name, response) != -1);
|
skey_passcheck(authctxt->pw->pw_name, response) != -1);
|
||||||
|
|
||||||
xfree(response);
|
free(response);
|
||||||
|
|
||||||
buffer_clear(m);
|
buffer_clear(m);
|
||||||
buffer_put_int(m, authok);
|
buffer_put_int(m, authok);
|
||||||
@ -1073,19 +1073,17 @@ mm_answer_pam_query(int sock, Buffer *m)
|
|||||||
buffer_clear(m);
|
buffer_clear(m);
|
||||||
buffer_put_int(m, ret);
|
buffer_put_int(m, ret);
|
||||||
buffer_put_cstring(m, name);
|
buffer_put_cstring(m, name);
|
||||||
xfree(name);
|
free(name);
|
||||||
buffer_put_cstring(m, info);
|
buffer_put_cstring(m, info);
|
||||||
xfree(info);
|
free(info);
|
||||||
buffer_put_int(m, num);
|
buffer_put_int(m, num);
|
||||||
for (i = 0; i < num; ++i) {
|
for (i = 0; i < num; ++i) {
|
||||||
buffer_put_cstring(m, prompts[i]);
|
buffer_put_cstring(m, prompts[i]);
|
||||||
xfree(prompts[i]);
|
free(prompts[i]);
|
||||||
buffer_put_int(m, echo_on[i]);
|
buffer_put_int(m, echo_on[i]);
|
||||||
}
|
}
|
||||||
if (prompts != NULL)
|
free(prompts);
|
||||||
xfree(prompts);
|
free(echo_on);
|
||||||
if (echo_on != NULL)
|
|
||||||
xfree(echo_on);
|
|
||||||
auth_method = "keyboard-interactive";
|
auth_method = "keyboard-interactive";
|
||||||
auth_submethod = "pam";
|
auth_submethod = "pam";
|
||||||
mm_request_send(sock, MONITOR_ANS_PAM_QUERY, m);
|
mm_request_send(sock, MONITOR_ANS_PAM_QUERY, m);
|
||||||
@ -1108,8 +1106,8 @@ mm_answer_pam_respond(int sock, Buffer *m)
|
|||||||
resp[i] = buffer_get_string(m, NULL);
|
resp[i] = buffer_get_string(m, NULL);
|
||||||
ret = (sshpam_device.respond)(sshpam_ctxt, num, resp);
|
ret = (sshpam_device.respond)(sshpam_ctxt, num, resp);
|
||||||
for (i = 0; i < num; ++i)
|
for (i = 0; i < num; ++i)
|
||||||
xfree(resp[i]);
|
free(resp[i]);
|
||||||
xfree(resp);
|
free(resp);
|
||||||
} else {
|
} else {
|
||||||
ret = (sshpam_device.respond)(sshpam_ctxt, num, NULL);
|
ret = (sshpam_device.respond)(sshpam_ctxt, num, NULL);
|
||||||
}
|
}
|
||||||
@ -1764,7 +1762,7 @@ mm_answer_audit_command(int socket, Buffer *m)
|
|||||||
cmd = buffer_get_string(m, &len);
|
cmd = buffer_get_string(m, &len);
|
||||||
/* sanity check command, if so how? */
|
/* sanity check command, if so how? */
|
||||||
audit_run_command(cmd);
|
audit_run_command(cmd);
|
||||||
xfree(cmd);
|
free(cmd);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
#endif /* SSH_AUDIT_EVENTS */
|
#endif /* SSH_AUDIT_EVENTS */
|
||||||
|
@ -805,7 +805,7 @@ mm_do_pam_account(void)
|
|||||||
ret = buffer_get_int(&m);
|
ret = buffer_get_int(&m);
|
||||||
msg = buffer_get_string(&m, NULL);
|
msg = buffer_get_string(&m, NULL);
|
||||||
buffer_append(&loginmsg, msg, strlen(msg));
|
buffer_append(&loginmsg, msg, strlen(msg));
|
||||||
xfree(msg);
|
free(msg);
|
||||||
|
|
||||||
buffer_free(&m);
|
buffer_free(&m);
|
||||||
|
|
||||||
@ -1035,7 +1035,7 @@ mm_skey_query(void *ctx, char **name, char **infotxt,
|
|||||||
mm_chall_setup(name, infotxt, numprompts, prompts, echo_on);
|
mm_chall_setup(name, infotxt, numprompts, prompts, echo_on);
|
||||||
|
|
||||||
xasprintf(*prompts, "%s%s", challenge, SKEY_PROMPT);
|
xasprintf(*prompts, "%s%s", challenge, SKEY_PROMPT);
|
||||||
xfree(challenge);
|
free(challenge);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ fetch_windows_environment(void)
|
|||||||
void
|
void
|
||||||
free_windows_environment(char **p)
|
free_windows_environment(char **p)
|
||||||
{
|
{
|
||||||
xfree(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_CYGWIN */
|
#endif /* HAVE_CYGWIN */
|
||||||
|
@ -58,7 +58,6 @@
|
|||||||
|
|
||||||
#define malloc(x) (xmalloc(x))
|
#define malloc(x) (xmalloc(x))
|
||||||
#define calloc(x, y) (xcalloc((x),(y)))
|
#define calloc(x, y) (xcalloc((x),(y)))
|
||||||
#define free(x) (xfree(x))
|
|
||||||
|
|
||||||
int
|
int
|
||||||
getrrsetbyname(const char *hostname, unsigned int rdclass,
|
getrrsetbyname(const char *hostname, unsigned int rdclass,
|
||||||
|
@ -86,7 +86,7 @@ aix_usrinfo(struct passwd *pw)
|
|||||||
fatal("Couldn't set usrinfo: %s", strerror(errno));
|
fatal("Couldn't set usrinfo: %s", strerror(errno));
|
||||||
debug3("AIX/UsrInfo: set len %d", i);
|
debug3("AIX/UsrInfo: set len %d", i);
|
||||||
|
|
||||||
xfree(cp);
|
free(cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef WITH_AIXAUTHENTICATE
|
# ifdef WITH_AIXAUTHENTICATE
|
||||||
@ -215,16 +215,14 @@ sys_auth_passwd(Authctxt *ctxt, const char *password)
|
|||||||
default: /* user can't change(2) or other error (-1) */
|
default: /* user can't change(2) or other error (-1) */
|
||||||
logit("Password can't be changed for user %s: %.100s",
|
logit("Password can't be changed for user %s: %.100s",
|
||||||
name, msg);
|
name, msg);
|
||||||
if (msg)
|
free(msg);
|
||||||
xfree(msg);
|
|
||||||
authsuccess = 0;
|
authsuccess = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
aix_restoreauthdb();
|
aix_restoreauthdb();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authmsg != NULL)
|
free(authmsg);
|
||||||
xfree(authmsg);
|
|
||||||
|
|
||||||
return authsuccess;
|
return authsuccess;
|
||||||
}
|
}
|
||||||
@ -269,7 +267,7 @@ sys_auth_allowed_user(struct passwd *pw, Buffer *loginmsg)
|
|||||||
|
|
||||||
if (!permitted)
|
if (!permitted)
|
||||||
logit("Login restricted for %s: %.100s", pw->pw_name, msg);
|
logit("Login restricted for %s: %.100s", pw->pw_name, msg);
|
||||||
xfree(msg);
|
free(msg);
|
||||||
return permitted;
|
return permitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: port-linux.c,v 1.17 2012/03/08 23:25:18 djm Exp $ */
|
/* $Id: port-linux.c,v 1.18 2013/06/01 22:07:32 dtucker Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005 Daniel Walsh <dwalsh@redhat.com>
|
* Copyright (c) 2005 Daniel Walsh <dwalsh@redhat.com>
|
||||||
@ -96,10 +96,8 @@ ssh_selinux_getctxbyname(char *pwname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GETSEUSERBYNAME
|
#ifdef HAVE_GETSEUSERBYNAME
|
||||||
if (sename != NULL)
|
free(sename);
|
||||||
xfree(sename);
|
free(lvl);
|
||||||
if (lvl != NULL)
|
|
||||||
xfree(lvl);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return sc;
|
return sc;
|
||||||
@ -217,8 +215,8 @@ ssh_selinux_change_context(const char *newname)
|
|||||||
if (setcon(newctx) < 0)
|
if (setcon(newctx) < 0)
|
||||||
switchlog("%s: setcon %s from %s failed with %s", __func__,
|
switchlog("%s: setcon %s from %s failed with %s", __func__,
|
||||||
newctx, oldctx, strerror(errno));
|
newctx, oldctx, strerror(errno));
|
||||||
xfree(oldctx);
|
free(oldctx);
|
||||||
xfree(newctx);
|
free(newctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1092,8 +1092,8 @@ read_etc_default_login(char ***env, u_int *envsize, uid_t uid)
|
|||||||
umask((mode_t)mask);
|
umask((mode_t)mask);
|
||||||
|
|
||||||
for (i = 0; tmpenv[i] != NULL; i++)
|
for (i = 0; tmpenv[i] != NULL; i++)
|
||||||
xfree(tmpenv[i]);
|
free(tmpenv[i]);
|
||||||
xfree(tmpenv);
|
free(tmpenv);
|
||||||
}
|
}
|
||||||
#endif /* HAVE_ETC_DEFAULT_LOGIN */
|
#endif /* HAVE_ETC_DEFAULT_LOGIN */
|
||||||
|
|
||||||
@ -1109,7 +1109,7 @@ copy_environment(char **source, char ***env, u_int *envsize)
|
|||||||
for(i = 0; source[i] != NULL; i++) {
|
for(i = 0; source[i] != NULL; i++) {
|
||||||
var_name = xstrdup(source[i]);
|
var_name = xstrdup(source[i]);
|
||||||
if ((var_val = strstr(var_name, "=")) == NULL) {
|
if ((var_val = strstr(var_name, "=")) == NULL) {
|
||||||
xfree(var_name);
|
free(var_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*var_val++ = '\0';
|
*var_val++ = '\0';
|
||||||
@ -1117,7 +1117,7 @@ copy_environment(char **source, char ***env, u_int *envsize)
|
|||||||
debug3("Copy environment: %s=%s", var_name, var_val);
|
debug3("Copy environment: %s=%s", var_name, var_val);
|
||||||
child_set_env(env, envsize, var_name, var_val);
|
child_set_env(env, envsize, var_name, var_val);
|
||||||
|
|
||||||
xfree(var_name);
|
free(var_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
sshd.c
2
sshd.c
@ -1616,7 +1616,7 @@ main(int ac, char **av)
|
|||||||
} else {
|
} else {
|
||||||
memset(privsep_pw->pw_passwd, 0, strlen(privsep_pw->pw_passwd));
|
memset(privsep_pw->pw_passwd, 0, strlen(privsep_pw->pw_passwd));
|
||||||
privsep_pw = pwcopy(privsep_pw);
|
privsep_pw = pwcopy(privsep_pw);
|
||||||
xfree(privsep_pw->pw_passwd);
|
free(privsep_pw->pw_passwd);
|
||||||
privsep_pw->pw_passwd = xstrdup("*");
|
privsep_pw->pw_passwd = xstrdup("*");
|
||||||
}
|
}
|
||||||
endpwent();
|
endpwent();
|
||||||
|
@ -97,7 +97,7 @@ store_lastlog_message(const char *user, uid_t uid)
|
|||||||
time_string = sys_auth_get_lastlogin_msg(user, uid);
|
time_string = sys_auth_get_lastlogin_msg(user, uid);
|
||||||
if (time_string != NULL) {
|
if (time_string != NULL) {
|
||||||
buffer_append(&loginmsg, time_string, strlen(time_string));
|
buffer_append(&loginmsg, time_string, strlen(time_string));
|
||||||
xfree(time_string);
|
free(time_string);
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
last_login_time = get_last_login_time(uid, user, hostname,
|
last_login_time = get_last_login_time(uid, user, hostname,
|
||||||
|
@ -90,8 +90,7 @@ temporarily_use_uid(struct passwd *pw)
|
|||||||
if (getgroups(saved_egroupslen, saved_egroups) < 0)
|
if (getgroups(saved_egroupslen, saved_egroups) < 0)
|
||||||
fatal("getgroups: %.100s", strerror(errno));
|
fatal("getgroups: %.100s", strerror(errno));
|
||||||
} else { /* saved_egroupslen == 0 */
|
} else { /* saved_egroupslen == 0 */
|
||||||
if (saved_egroups != NULL)
|
free(saved_egroups);
|
||||||
xfree(saved_egroups);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set and save the user's groups */
|
/* set and save the user's groups */
|
||||||
@ -109,8 +108,7 @@ temporarily_use_uid(struct passwd *pw)
|
|||||||
if (getgroups(user_groupslen, user_groups) < 0)
|
if (getgroups(user_groupslen, user_groups) < 0)
|
||||||
fatal("getgroups: %.100s", strerror(errno));
|
fatal("getgroups: %.100s", strerror(errno));
|
||||||
} else { /* user_groupslen == 0 */
|
} else { /* user_groupslen == 0 */
|
||||||
if (user_groups)
|
free(user_groups);
|
||||||
xfree(user_groups);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Set the effective uid to the given (unprivileged) uid. */
|
/* Set the effective uid to the given (unprivileged) uid. */
|
||||||
|
Loading…
Reference in New Issue
Block a user