qga: Implement SSH commands for Windows

Signed-off-by: Aidan Leuck <aidan_leuck@selinc.com>
Tested-by: Dehan Meng <demeng@redhat.com>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Link: https://lore.kernel.org/r/20240424144029.30665-3-aidan_leuck@selinc.com
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
This commit is contained in:
aidaleuc
2024-05-01 10:35:45 +03:00
committed by Konstantin Kostiuk
parent 1cc9932700
commit 6b9296ba7a
4 changed files with 749 additions and 11 deletions
File diff suppressed because it is too large Load Diff
+26
View File
@@ -0,0 +1,26 @@
/*
* Header file for commands-windows-ssh.c
*
* Copyright Schweitzer Engineering Laboratories. 2024
*
* Authors:
* Aidan Leuck <aidan_leuck@selinc.com>
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#include <glib/gstrfuncs.h>
#include <stdbool.h>
typedef struct WindowsUserInfo {
char *sshDirectory;
char *authorizedKeyFile;
char *username;
char *SSID;
bool isAdmin;
} WindowsUserInfo;
typedef WindowsUserInfo *PWindowsUserInfo;
void free_userInfo(PWindowsUserInfo info);
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(PWindowsUserInfo, free_userInfo, NULL);
+3 -2
View File
@@ -73,7 +73,8 @@ if host_os == 'windows'
'channel-win32.c',
'commands-win32.c',
'service-win32.c',
'vss-win32.c'
'vss-win32.c',
'commands-windows-ssh.c'
))
else
qga_ss.add(files(
@@ -94,7 +95,7 @@ gen_tlb = []
qga_libs = []
if host_os == 'windows'
qga_libs += ['-lws2_32', '-lwinmm', '-lpowrprof', '-lwtsapi32', '-lwininet', '-liphlpapi', '-lnetapi32',
'-lsetupapi', '-lcfgmgr32']
'-lsetupapi', '-lcfgmgr32', '-luserenv']
if have_qga_vss
qga_libs += ['-lole32', '-loleaut32', '-lshlwapi', '-lstdc++', '-Wl,--enable-stdcall-fixup']
subdir('vss-win32')
+8 -9
View File
@@ -1570,9 +1570,8 @@
{ 'struct': 'GuestAuthorizedKeys',
'data': {
'keys': ['str']
},
'if': 'CONFIG_POSIX' }
}
}
##
# @guest-ssh-get-authorized-keys:
@@ -1588,8 +1587,8 @@
##
{ 'command': 'guest-ssh-get-authorized-keys',
'data': { 'username': 'str' },
'returns': 'GuestAuthorizedKeys',
'if': 'CONFIG_POSIX' }
'returns': 'GuestAuthorizedKeys'
}
##
# @guest-ssh-add-authorized-keys:
@@ -1607,8 +1606,8 @@
# Since: 5.2
##
{ 'command': 'guest-ssh-add-authorized-keys',
'data': { 'username': 'str', 'keys': ['str'], '*reset': 'bool' },
'if': 'CONFIG_POSIX' }
'data': { 'username': 'str', 'keys': ['str'], '*reset': 'bool' }
}
##
# @guest-ssh-remove-authorized-keys:
@@ -1625,8 +1624,8 @@
# Since: 5.2
##
{ 'command': 'guest-ssh-remove-authorized-keys',
'data': { 'username': 'str', 'keys': ['str'] },
'if': 'CONFIG_POSIX' }
'data': { 'username': 'str', 'keys': ['str'] }
}
##
# @GuestDiskStats: