From c49187b579f634721447c6351cf6a896fc67c41a Mon Sep 17 00:00:00 2001 From: Jochen Eisinger Date: Sat, 10 Mar 2001 15:31:46 +0000 Subject: [PATCH] 2001-03-10 Jochen Eisinger * frontend/saned.c: fixed bug that allowed access to a scanner without being prompted for a password --- frontend/saned.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/frontend/saned.c b/frontend/saned.c index 4eea526f6..d748af786 100644 --- a/frontend/saned.c +++ b/frontend/saned.c @@ -740,6 +740,32 @@ process_request (Wire * w) can_authorize = 1; resource = strdup (name); + + if (strlen(resource) == 0) { + + SANE_Device **device_list; + + free (resource); + + if ((i = sane_get_devices (&device_list, SANE_TRUE)) != SANE_STATUS_GOOD) { + + memset (&reply, 0, sizeof (reply)); + reply.status = i; + sanei_w_reply (w, (WireCodecFunc) sanei_w_open_reply, &reply); + + } + + if ((device_list == NULL) || (device_list[0] == NULL)) { + + memset (&reply, 0, sizeof (reply)); + reply.status = SANE_STATUS_INVAL; + sanei_w_reply (w, (WireCodecFunc) sanei_w_open_reply, &reply); + + } + + resource = strdup (device_list[0]->name); + + } if (strchr (resource, ':')) *(strchr (resource, ':')) = 0;