Hans Leidekker : mountmgr: Add ioctl to delete host credentials on macOS.
Alexandre Julliard
julliard at winehq.org
Thu Sep 3 15:26:46 CDT 2020
Module: wine
Branch: master
Commit: 26daece790988d1cdaed9af4e0ec550f968cd1c8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=26daece790988d1cdaed9af4e0ec550f968cd1c8
Author: Hans Leidekker <hans at codeweavers.com>
Date: Thu Sep 3 14:59:06 2020 +0200
mountmgr: Add ioctl to delete host credentials on macOS.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mountmgr.sys/mountmgr.c | 28 ++++++++++++++++++++++++++++
include/ddk/mountmgr.h | 1 +
2 files changed, 29 insertions(+)
diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c
index c3b9135ce1..95b11d864a 100644
--- a/dlls/mountmgr.sys/mountmgr.c
+++ b/dlls/mountmgr.sys/mountmgr.c
@@ -819,6 +819,23 @@ error:
RtlFreeHeap( GetProcessHeap(), 0, password );
return ret;
}
+
+static NTSTATUS delete_credential( void *buff, SIZE_T insize, SIZE_T outsize, IO_STATUS_BLOCK *iosb )
+{
+ const struct mountmgr_credential *cred = buff;
+ const WCHAR *targetname;
+ SecKeychainItemRef item;
+
+ if (!check_credential_string( buff, insize, cred->targetname_size, cred->targetname_offset ))
+ return STATUS_INVALID_PARAMETER;
+ targetname = (const WCHAR *)((const char *)cred + cred->targetname_offset);
+
+ if (!(item = find_credential( targetname ))) return STATUS_NOT_FOUND;
+
+ SecKeychainItemDelete( item );
+ CFRelease( item );
+ return STATUS_SUCCESS;
+}
#endif /* __APPLE__ */
/* handler for ioctls on the mount manager device */
@@ -909,6 +926,17 @@ static NTSTATUS WINAPI mountmgr_ioctl( DEVICE_OBJECT *device, IRP *irp )
irpsp->Parameters.DeviceIoControl.OutputBufferLength,
&irp->IoStatus );
break;
+ case IOCTL_MOUNTMGR_DELETE_CREDENTIAL:
+ if (irpsp->Parameters.DeviceIoControl.InputBufferLength < sizeof(struct mountmgr_credential))
+ {
+ irp->IoStatus.u.Status = STATUS_INVALID_PARAMETER;
+ break;
+ }
+ irp->IoStatus.u.Status = delete_credential( irp->AssociatedIrp.SystemBuffer,
+ irpsp->Parameters.DeviceIoControl.InputBufferLength,
+ irpsp->Parameters.DeviceIoControl.OutputBufferLength,
+ &irp->IoStatus );
+ break;
#endif
default:
FIXME( "ioctl %x not supported\n", irpsp->Parameters.DeviceIoControl.IoControlCode );
diff --git a/include/ddk/mountmgr.h b/include/ddk/mountmgr.h
index 162bbf7107..a5aae2a085 100644
--- a/include/ddk/mountmgr.h
+++ b/include/ddk/mountmgr.h
@@ -76,6 +76,7 @@ struct mountmgr_unix_drive
#define IOCTL_MOUNTMGR_READ_CREDENTIAL CTL_CODE(MOUNTMGRCONTROLTYPE, 48, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_MOUNTMGR_WRITE_CREDENTIAL CTL_CODE(MOUNTMGRCONTROLTYPE, 49, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+#define IOCTL_MOUNTMGR_DELETE_CREDENTIAL CTL_CODE(MOUNTMGRCONTROLTYPE, 50, METHOD_BUFFERED, FILE_WRITE_ACCESS)
struct mountmgr_credential
{
More information about the wine-cvs
mailing list