Fixes various akallabeth remarks

This commit is contained in:
David Fort
2022-02-02 10:59:05 +01:00
committed by akallabeth
parent 6a5521bb84
commit 44c82cd929
9 changed files with 20 additions and 20 deletions

View File

@@ -30,7 +30,8 @@ set(${MODULE_PREFIX}_SRCS
client_rails.c
cmdline.c
file.c
geometry.c)
geometry.c
smartcard_cli.c)
foreach(FREERDP_CHANNELS_CLIENT_SRC ${FREERDP_CHANNELS_CLIENT_SRCS})
get_filename_component(NINC ${FREERDP_CHANNELS_CLIENT_SRC} PATH)

View File

@@ -480,7 +480,6 @@ BOOL freerdp_client_print_command_line_help_ex(int argc, char** argv,
printf("\n");
printf("Drive Redirection: /drive:home,/home/user\n");
printf("Smartcard Redirection: /smartcard:<device>\n");
printf("Smartcard logon with rdp only: /smartcard-logon [/sec:rdp]\n");
printf("Smartcard logon with Kerberos authentication: /smartcard-logon /sec:nla\n");
printf("Those options are only accepted with /smartcard-logon:\n");
printf(" PIN code: /pin:<PIN code>\n");

View File

@@ -17,7 +17,7 @@
* limitations under the License.
*/
#include <freerdp/utils/smartcard_cli.h>
#include "../core/smartcardlogon.h"
#include "../../libfreerdp/core/smartcardlogon.h"
BOOL freerdp_smartcard_list(rdpSettings* settings)
{

View File

@@ -140,7 +140,7 @@ struct rdp_nla
LPTSTR ServicePrincipalName;
void* identityPtr;
SEC_WINNT_AUTH_IDENTITY* identity;
SEC_WINNT_AUTH_IDENTITY_EXW identityEx;
SEC_WINNT_AUTH_IDENTITY_EXA identityEx;
SEC_WINNT_AUTH_IDENTITY_WINPRA identityWinPr;
SEC_WINPR_KERBEROS_SETTINGS kerberosSettings;
PSecurityFunctionTable table;
@@ -687,15 +687,15 @@ static BOOL nla_client_setup_identity(rdpNla* nla)
{
#ifdef _WIN32
{
SEC_WINNT_AUTH_IDENTITY_EXW* identityEx;
SEC_WINNT_AUTH_IDENTITY_EXA* identityEx;
CERT_CREDENTIAL_INFO certInfo = { sizeof(CERT_CREDENTIAL_INFO), { 0 } };
LPWSTR marshalledCredentials;
LPSTR marshalledCredentials;
identityEx = &nla->identityEx;
memcpy(certInfo.rgbHashOfCert, nla->kerberosSettings.certSha1,
sizeof(certInfo.rgbHashOfCert));
if (!CredMarshalCredentialW(CertCredential, &certInfo, &marshalledCredentials))
if (!CredMarshalCredentialA(CertCredential, &certInfo, &marshalledCredentials))
{
WLog_ERR(TAG, "error marshalling cert credentials");
return FALSE;
@@ -703,9 +703,9 @@ static BOOL nla_client_setup_identity(rdpNla* nla)
identityEx->Version = SEC_WINNT_AUTH_IDENTITY_VERSION;
identityEx->Length = sizeof(*identityEx);
identityEx->User = (PUSHORT)marshalledCredentials;
identityEx->UserLength = _wcslen(marshalledCredentials);
if (ConvertToUnicode(CP_UTF8, 0, settings->Pin, -1, &identityEx->Password, 0) <= 0)
identityEx->User = (BYTE*)marshalledCredentials;
identityEx->UserLength = strlen(marshalledCredentials);
if (!(identityEx->Password = (BYTE*)strdup(settings->Pin)))
return FALSE;
identityEx->PasswordLength = strlen(settings->Pin);
identityEx->Domain = NULL;
@@ -1911,7 +1911,6 @@ fail:
return ret;
}
/**
* Encode TSCredentials structure.
* @param credssp

View File

@@ -132,11 +132,12 @@ static BOOL build_pkinit_args(rdpSettings* settings, SmartcardCert* scCert)
/* pkinit args only under windows
* PKCS11:module_name=opensc-pkcs11.so
*/
size_t sz = strlen("PKCS11:module_name=:slotid=XXXXX");
size_t sz;
const char* pkModule = settings->Pkcs11Module ? settings->Pkcs11Module : "opensc-pkcs11.so";
sz += strlen(pkModule) + 1;
sz = _snprintf(NULL, 0, "PKCS11:module_name=%s:slotid=%" PRIu16, pkModule,
(UINT16)scCert->slotId) +
1;
scCert->pkinitArgs = malloc(sz);
if (!scCert->pkinitArgs)
return FALSE;

View File

@@ -22,7 +22,7 @@
#include <freerdp/settings.h>
#include <freerdp/crypto/crypto.h>
typedef struct
struct _SmartcardCert
{
LPWSTR reader;
CryptoCert certificate;
@@ -37,11 +37,12 @@ typedef struct
BYTE atr[256];
DWORD atrLength;
BYTE sha1Hash[20];
} SmartcardCert;
};
typedef struct _SmartcardCert SmartcardCert;
void smartcardCert_Free(SmartcardCert* scCert);
FREERDP_API void smartcardCert_Free(SmartcardCert* scCert);
BOOL smartcard_enumerateCerts(rdpSettings* settings, SmartcardCert* scCert, DWORD count,
DWORD* retCount);
FREERDP_API BOOL smartcard_enumerateCerts(rdpSettings* settings, SmartcardCert* scCert, DWORD count,
DWORD* retCount);
#endif /* LIBFREERDP_CORE_SMARTCARDLOGON_H */

View File

@@ -28,7 +28,6 @@ set(${MODULE_PREFIX}_SRCS
smartcard_operations.c
smartcard_pack.c
smartcard_call.c
smartcard_cli.c
stopwatch.c)
freerdp_module_add(${${MODULE_PREFIX}_SRCS})