mountmgr: Add ioctl to delete host credentials on macOS.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
98a3986c7d
commit
26daece790
|
@ -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 );
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue