mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-27 15:54:22 +02:00
Cleanup L3 Compiler Warnings (#538)
This commit is contained in:
parent
942e993fac
commit
2bbcffac6e
@ -686,7 +686,7 @@ fileio_write_wrapper(struct w32_io* pio, const void* buf, size_t bytes_to_copy)
|
|||||||
void* chunk_buf = NULL;
|
void* chunk_buf = NULL;
|
||||||
int chunk_count = 0;
|
int chunk_count = 0;
|
||||||
int bytes_copied = -1;
|
int bytes_copied = -1;
|
||||||
int chunk_size = 0;
|
size_t chunk_size = 0;
|
||||||
|
|
||||||
for (int i = 0; i < bytes_to_copy; i += WRITE_BUFFER_SIZE, chunk_count++) {
|
for (int i = 0; i < bytes_to_copy; i += WRITE_BUFFER_SIZE, chunk_count++) {
|
||||||
chunk_buf = (BYTE*)buf + chunk_count * WRITE_BUFFER_SIZE;
|
chunk_buf = (BYTE*)buf + chunk_count * WRITE_BUFFER_SIZE;
|
||||||
|
@ -257,7 +257,6 @@ get_con_client_info(struct agent_connection* con)
|
|||||||
DWORD reg_dom_len = 0, info_len = 0, sid_size;
|
DWORD reg_dom_len = 0, info_len = 0, sid_size;
|
||||||
DWORD sshd_sid_len = 0;
|
DWORD sshd_sid_len = 0;
|
||||||
PSID sshd_sid = NULL;
|
PSID sshd_sid = NULL;
|
||||||
SID_NAME_USE nuse;
|
|
||||||
HANDLE client_primary_token = NULL, client_impersonation_token = NULL, client_process_handle = NULL;
|
HANDLE client_primary_token = NULL, client_impersonation_token = NULL, client_process_handle = NULL;
|
||||||
TOKEN_USER* info = NULL;
|
TOKEN_USER* info = NULL;
|
||||||
BOOL isMember = FALSE;
|
BOOL isMember = FALSE;
|
||||||
|
@ -94,7 +94,6 @@ ssh_tty_make_modes(struct ssh *ssh, int fd, struct termios *tiop)
|
|||||||
#undef TTYCHAR
|
#undef TTYCHAR
|
||||||
#undef TTYMODE
|
#undef TTYMODE
|
||||||
|
|
||||||
end :
|
|
||||||
/* Mark end of mode data. */
|
/* Mark end of mode data. */
|
||||||
if ((r = sshbuf_put_u8(buf, TTY_OP_END)) != 0 ||
|
if ((r = sshbuf_put_u8(buf, TTY_OP_END)) != 0 ||
|
||||||
(r = sshpkt_put_stringb(ssh, buf)) != 0)
|
(r = sshpkt_put_stringb(ssh, buf)) != 0)
|
||||||
@ -112,7 +111,7 @@ ssh_tty_parse_modes(struct ssh *ssh, int fd)
|
|||||||
struct sshbuf *buf;
|
struct sshbuf *buf;
|
||||||
const u_char *data;
|
const u_char *data;
|
||||||
u_char opcode;
|
u_char opcode;
|
||||||
u_int baud, u;
|
u_int baud;
|
||||||
int r, failure = 0;
|
int r, failure = 0;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
/* import */
|
/* import */
|
||||||
extern ServerOptions options;
|
extern ServerOptions options;
|
||||||
extern struct sshauthopt *auth_opts;
|
extern struct sshauthopt *auth_opts;
|
||||||
|
int get_in_chroot();
|
||||||
char **
|
char **
|
||||||
do_setup_env_proxy(struct ssh *, Session *, const char *);
|
do_setup_env_proxy(struct ssh *, Session *, const char *);
|
||||||
|
|
||||||
@ -175,7 +176,7 @@ setup_session_env(struct ssh *ssh, Session* s)
|
|||||||
char *env_name = NULL, *env_value = NULL, *t = NULL, **env = NULL, *path_env_val = NULL;
|
char *env_name = NULL, *env_value = NULL, *t = NULL, **env = NULL, *path_env_val = NULL;
|
||||||
char buf[1024] = { 0 };
|
char buf[1024] = { 0 };
|
||||||
wchar_t *env_name_w = NULL, *env_value_w = NULL, *pw_dir_w = NULL, *tmp = NULL, wbuf[1024] = { 0, };
|
wchar_t *env_name_w = NULL, *env_value_w = NULL, *pw_dir_w = NULL, *tmp = NULL, wbuf[1024] = { 0, };
|
||||||
char *laddr, *c;
|
char *c;
|
||||||
|
|
||||||
UTF8_TO_UTF16_WITH_CLEANUP(pw_dir_w, s->pw->pw_dir);
|
UTF8_TO_UTF16_WITH_CLEANUP(pw_dir_w, s->pw->pw_dir);
|
||||||
/* skip domain part (if present) while setting USERNAME */
|
/* skip domain part (if present) while setting USERNAME */
|
||||||
@ -238,7 +239,7 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int do_exec_windows(struct ssh *ssh, Session *s, const char *command, int pty) {
|
int do_exec_windows(struct ssh *ssh, Session *s, const char *command, int pty) {
|
||||||
int pipein[2], pipeout[2], pipeerr[2], r, ret = -1;
|
int pipein[2], pipeout[2], pipeerr[2], ret = -1;
|
||||||
char *exec_command = NULL, *posix_cmd_input = NULL, *shell = NULL;
|
char *exec_command = NULL, *posix_cmd_input = NULL, *shell = NULL;
|
||||||
HANDLE job = NULL, process_handle;
|
HANDLE job = NULL, process_handle;
|
||||||
extern char* shell_command_option;
|
extern char* shell_command_option;
|
||||||
@ -285,7 +286,7 @@ int do_exec_windows(struct ssh *ssh, Session *s, const char *command, int pty) {
|
|||||||
HANDLE job_dup;
|
HANDLE job_dup;
|
||||||
pid_t pid = -1;
|
pid_t pid = -1;
|
||||||
char * shell_command_option_local = NULL;
|
char * shell_command_option_local = NULL;
|
||||||
int shell_len = 0;
|
size_t shell_len = 0;
|
||||||
/*account for the quotes and null*/
|
/*account for the quotes and null*/
|
||||||
shell_len = strlen(s->pw->pw_shell) + 2 + 1;
|
shell_len = strlen(s->pw->pw_shell) + 2 + 1;
|
||||||
if ((shell = malloc(shell_len)) == NULL) {
|
if ((shell = malloc(shell_len)) == NULL) {
|
||||||
@ -369,7 +370,7 @@ int do_exec_windows(struct ssh *ssh, Session *s, const char *command, int pty) {
|
|||||||
* in registry; pass shell, shell option, and quoted command as cmd path
|
* in registry; pass shell, shell option, and quoted command as cmd path
|
||||||
* of posix_spawn to avoid escaping
|
* of posix_spawn to avoid escaping
|
||||||
*/
|
*/
|
||||||
int posix_cmd_input_len = strlen(shell) + 1;
|
size_t posix_cmd_input_len = strlen(shell) + 1;
|
||||||
|
|
||||||
/* account for " around and null */
|
/* account for " around and null */
|
||||||
if (exec_command) {
|
if (exec_command) {
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <Ntsecapi.h>
|
#include <Ntsecapi.h>
|
||||||
#include <security.h>
|
#include <security.h>
|
||||||
#include <ntstatus.h>
|
#include <ntstatus.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#define __attribute__(a)
|
#define __attribute__(a)
|
||||||
#include "inc/sys/types.h"
|
#include "inc/sys/types.h"
|
||||||
|
@ -33,7 +33,7 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, size_t namebuflen)
|
|||||||
unset_nonblock(p[1]);
|
unset_nonblock(p[1]);
|
||||||
*ttyfd = p[0];
|
*ttyfd = p[0];
|
||||||
*ptyfd = p[1];
|
*ptyfd = p[1];
|
||||||
strlcpy(namebuf, "windows-pty", namebuflen);
|
strcpy_s(namebuf, namebuflen, "windows-pty");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <Lm.h>
|
#include <Lm.h>
|
||||||
#include <sddl.h>
|
#include <sddl.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "inc\utf.h"
|
#include "inc\utf.h"
|
||||||
#include "misc_internal.h"
|
#include "misc_internal.h"
|
||||||
@ -135,7 +136,7 @@ create_prgdata_ssh_folder()
|
|||||||
wcscpy_s(ssh_cfg_dir, _countof(ssh_cfg_dir), __wprogdata);
|
wcscpy_s(ssh_cfg_dir, _countof(ssh_cfg_dir), __wprogdata);
|
||||||
wcscat_s(ssh_cfg_dir, _countof(ssh_cfg_dir), L"\\ssh");
|
wcscat_s(ssh_cfg_dir, _countof(ssh_cfg_dir), L"\\ssh");
|
||||||
if (create_directory_withsddl(ssh_cfg_dir, L"O:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;0x1200a9;;;AU)") < 0) {
|
if (create_directory_withsddl(ssh_cfg_dir, L"O:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;0x1200a9;;;AU)") < 0) {
|
||||||
printf("failed to create %s", ssh_cfg_dir);
|
printf("failed to create %S", ssh_cfg_dir);
|
||||||
exit(255);
|
exit(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +145,7 @@ create_prgdata_ssh_folder()
|
|||||||
wcscat_s(logs_dir, _countof(logs_dir), ssh_cfg_dir);
|
wcscat_s(logs_dir, _countof(logs_dir), ssh_cfg_dir);
|
||||||
wcscat_s(logs_dir, _countof(logs_dir), L"\\logs");
|
wcscat_s(logs_dir, _countof(logs_dir), L"\\logs");
|
||||||
if (create_directory_withsddl(logs_dir, L"O:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)") < 0) {
|
if (create_directory_withsddl(logs_dir, L"O:BAD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)") < 0) {
|
||||||
printf("failed to create %s", logs_dir);
|
printf("failed to create %S", logs_dir);
|
||||||
exit(255);
|
exit(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +158,7 @@ create_prgdata_ssh_folder()
|
|||||||
swprintf_s(sshd_config_default_path, PATH_MAX, L"%S\\%s", __progdir, L"sshd_config_default");
|
swprintf_s(sshd_config_default_path, PATH_MAX, L"%S\\%s", __progdir, L"sshd_config_default");
|
||||||
|
|
||||||
if (CopyFileW(sshd_config_default_path, sshd_config_path, TRUE) == 0) {
|
if (CopyFileW(sshd_config_default_path, sshd_config_path, TRUE) == 0) {
|
||||||
printf("Failed to copy %s to %s, error:%d", sshd_config_default_path, sshd_config_path, GetLastError());
|
printf("Failed to copy %S to %S, error:%d", sshd_config_default_path, sshd_config_path, GetLastError());
|
||||||
exit(255);
|
exit(255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user