From 9655bb564adaebf121d760f789eca4bbbbdcfba7 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Thu, 7 Sep 2017 09:05:15 +0500 Subject: [PATCH] Driver: Force reauth on conf changes. --- src/driver/fortdrv.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/driver/fortdrv.c b/src/driver/fortdrv.c index dc794995..f1990135 100644 --- a/src/driver/fortdrv.c +++ b/src/driver/fortdrv.c @@ -304,6 +304,26 @@ fort_callout_remove (void) g_device->active = FALSE; } +static NTSTATUS +fort_callout_force_reauth (PDEVICE_OBJECT device) +{ + NTSTATUS status; + + // Unregister + fort_callout_remove(); + fort_prov_unregister(); + + // Register + status = fort_prov_register(!g_device->prov_temporary, + g_device->prov_boot, NULL, NULL); + + if (status == STATUS_SUCCESS) { + status = fort_callout_install(device); + } + + return status; +} + static NTSTATUS fort_device_create (PDEVICE_OBJECT device, PIRP irp) { @@ -375,7 +395,7 @@ fort_device_control (PDEVICE_OBJECT device, PIRP irp) status = STATUS_INSUFFICIENT_RESOURCES; } else { fort_conf_ref_set(conf_ref); - status = STATUS_SUCCESS; + status = fort_callout_force_reauth(device); } } break; @@ -386,7 +406,7 @@ fort_device_control (PDEVICE_OBJECT device, PIRP irp) if (len == sizeof(FORT_CONF_FLAGS)) { fort_conf_ref_flags_set(conf_flags); - status = STATUS_SUCCESS; + status = fort_callout_force_reauth(device); } break; }