This patch series consists of minor fixes and cleanups I made during update to openssh V_4_6 branch. openssh/auth-pam.c | 9 ++++----- openssh/auth2.c | 2 -- openssh/readconf.c | 7 ++++--- openssh/servconf.c | 14 ++++++++------ openssh/sftp-server.c | 9 ++++++--- openssh/sshd.c | 2 +- 6 files changed, 23 insertions(+), 20 deletions(-) -- ldv -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20070411/4412560c/attachment.bin
---
openssh/auth2.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
--- a/openssh/auth2.c
+++ b/openssh/auth2.c
@@ -281,8 +281,6 @@ userauth_finish(Authctxt *authctxt, int authenticated, char
*method)
}
}
-#define DELIM ","
-
static char *
authmethods_get(void)
{
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :
http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20070411/2a3e7e80/attachment-0001.bin
Dmitry V. Levin
2007-Apr-10 23:39 UTC
[PATCH 2/6] auth-pam.c (sshpam_tty_conv): Check fgets() return code
--- openssh/auth-pam.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) --- a/openssh/auth-pam.c +++ b/openssh/auth-pam.c @@ -985,7 +985,8 @@ sshpam_tty_conv(int n, sshpam_const struct pam_message **msg, break; case PAM_PROMPT_ECHO_ON: fprintf(stderr, "%s\n", PAM_MSG_MEMBER(msg, i, msg)); - fgets(input, sizeof input, stdin); + if (fgets(input, sizeof input, stdin) == NULL) + input[0] = '\0'; if ((reply[i].resp = strdup(input)) == NULL) goto fail; reply[i].resp_retcode = PAM_SUCCESS; -- ldv -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20070411/4e1a92ff/attachment.bin
Dmitry V. Levin
2007-Apr-10 23:39 UTC
[PATCH 3/6] auth-pam.c: Replace malloc+memset with calloc
---
openssh/auth-pam.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
--- a/openssh/auth-pam.c
+++ b/openssh/auth-pam.c
@@ -686,8 +686,7 @@ sshpam_init_ctx(Authctxt *authctxt)
return (NULL);
}
- ctxt = xmalloc(sizeof *ctxt);
- memset(ctxt, 0, sizeof(*ctxt));
+ ctxt = xcalloc(1, sizeof *ctxt);
/* Start the authentication thread */
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, socks) == -1) {
@@ -1131,9 +1130,8 @@ sshpam_passwd_conv(int n, sshpam_const struct pam_message
**msg,
if (n <= 0 || n > PAM_MAX_NUM_MSG)
return (PAM_CONV_ERR);
- if ((reply = malloc(n * sizeof(*reply))) == NULL)
+ if ((reply = calloc(n, sizeof(*reply))) == NULL)
return (PAM_CONV_ERR);
- memset(reply, 0, n * sizeof(*reply));
for (i = 0; i < n; ++i) {
switch (PAM_MSG_MEMBER(msg, i, msg_style)) {
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :
http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20070411/d34ef7b6/attachment.bin
Dmitry V. Levin
2007-Apr-10 23:40 UTC
[PATCH 4/6] Fix pointer arithmetics to avoid breaking gcc strict-aliasing rules
---
openssh/readconf.c | 7 ++++---
openssh/servconf.c | 14 ++++++++------
2 files changed, 12 insertions(+), 9 deletions(-)
--- a/openssh/readconf.c
+++ b/openssh/readconf.c
@@ -326,6 +326,7 @@ process_config_line(Options *options, const char *host,
{
char *s, **charptr, *endofnumber, *keyword, *arg, *arg2, fwdarg[256];
int opcode, *intptr, value, value2, scale;
+ LogLevel *log_level_ptr;
long long orig, val64;
size_t len;
Forward fwd;
@@ -692,14 +693,14 @@ parse_int:
break;
case oLogLevel:
- intptr = (int *) &options->log_level;
+ log_level_ptr = &options->log_level;
arg = strdelim(&s);
value = log_level_number(arg);
if (value == SYSLOG_LEVEL_NOT_SET)
fatal("%.200s line %d: unsupported log level '%s'",
filename, linenum, arg ? arg : "<NONE>");
- if (*activep && (LogLevel) *intptr == SYSLOG_LEVEL_NOT_SET)
- *intptr = (LogLevel) value;
+ if (*activep && *log_level_ptr == SYSLOG_LEVEL_NOT_SET)
+ *log_level_ptr = (LogLevel) value;
break;
case oLocalForward:
--- a/openssh/servconf.c
+++ b/openssh/servconf.c
@@ -622,6 +622,8 @@ process_server_config_line(ServerOptions *options, char
*line,
{
char *cp, **charptr, *arg, *p;
int cmdline = 0, *intptr, value, n;
+ SyslogFacility *log_facility_ptr;
+ LogLevel *log_level_ptr;
ServerOpCodes opcode;
u_short port;
u_int i, flags = 0;
@@ -977,25 +979,25 @@ parse_flag:
goto parse_flag;
case sLogFacility:
- intptr = (int *) &options->log_facility;
+ log_facility_ptr = &options->log_facility;
arg = strdelim(&cp);
value = log_facility_number(arg);
if (value == SYSLOG_FACILITY_NOT_SET)
fatal("%.200s line %d: unsupported log facility '%s'",
filename, linenum, arg ? arg : "<NONE>");
- if (*intptr == -1)
- *intptr = (SyslogFacility) value;
+ if (*log_facility_ptr == -1)
+ *log_facility_ptr = (SyslogFacility) value;
break;
case sLogLevel:
- intptr = (int *) &options->log_level;
+ log_level_ptr = &options->log_level;
arg = strdelim(&cp);
value = log_level_number(arg);
if (value == SYSLOG_LEVEL_NOT_SET)
fatal("%.200s line %d: unsupported log level '%s'",
filename, linenum, arg ? arg : "<NONE>");
- if (*intptr == -1)
- *intptr = (LogLevel) value;
+ if (*log_level_ptr == -1)
+ *log_level_ptr = (LogLevel) value;
break;
case sAllowTcpForwarding:
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :
http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20070411/5175dde9/attachment-0001.bin
Dmitry V. Levin
2007-Apr-10 23:40 UTC
[PATCH 5/6] Fix "format '%llu' expects type 'long long unsigned int'" warnings
---
openssh/sftp-server.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
--- a/openssh/sftp-server.c
+++ b/openssh/sftp-server.c
@@ -319,7 +319,8 @@ handle_log_close(int handle, char *emsg)
logit("%s%sclose \"%s\" bytes read %llu written %llu",
emsg == NULL ? "" : emsg, emsg == NULL ? "" : "
",
handle_to_name(handle),
- handle_bytes_read(handle), handle_bytes_write(handle));
+ (unsigned long long) handle_bytes_read(handle),
+ (unsigned long long) handle_bytes_write(handle));
} else {
logit("%s%sclosedir \"%s\"",
emsg == NULL ? "" : emsg, emsg == NULL ? "" : "
",
@@ -702,7 +703,8 @@ process_setstat(void)
a = get_attrib();
debug("request %u: setstat name \"%s\"", id, name);
if (a->flags & SSH2_FILEXFER_ATTR_SIZE) {
- logit("set \"%s\" size %llu", name, a->size);
+ logit("set \"%s\" size %llu",
+ name, (unsigned long long) a->size);
ret = truncate(name, a->size);
if (ret == -1)
status = errno_to_portable(errno);
@@ -754,7 +756,8 @@ process_fsetstat(void)
char *name = handle_to_name(handle);
if (a->flags & SSH2_FILEXFER_ATTR_SIZE) {
- logit("set \"%s\" size %llu", name, a->size);
+ logit("set \"%s\" size %llu",
+ name, (unsigned long long) a->size);
ret = ftruncate(fd, a->size);
if (ret == -1)
status = errno_to_portable(errno);
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :
http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20070411/568ca93b/attachment.bin
Dmitry V. Levin
2007-Apr-10 23:40 UTC
[PATCH 6/6] sshd.c (main): Clear rexec_flag in test mode
---
openssh/sshd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
--- a/openssh/sshd.c
+++ b/openssh/sshd.c
@@ -1365,7 +1365,7 @@ main(int ac, char **av)
break;
}
}
- if (rexeced_flag || inetd_flag)
+ if (rexeced_flag || inetd_flag || test_flag)
rexec_flag = 0;
if (rexec_flag && (av[0] == NULL || *av[0] != '/'))
fatal("sshd re-exec requires execution with an absolute path");
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :
http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20070411/1f48eaf0/attachment.bin
Apparently Analagous Threads
- [PATCH RESEND 0/2] Permit %L and %L percent escapes in Include
- [PATCH RESEND 0/2] Permit %L and %l percent escapes in Include
- [PATCH v3 1/2] Permit %L and %l percent escapes in ssh Include
- multiple definition of `optind'
- [PATCH] Enable ssh_config to set LogPath option (-E)