summaryrefslogtreecommitdiff
path: root/pam-extensions
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2017-07-26 13:28:50 -0400
committerRay Strode <rstrode@redhat.com>2017-10-20 14:14:17 -0400
commitd39ed7b722761e5110e26c8e937782ecb24b7315 (patch)
tree3fe23217bbe7f8af8c83535bb8866e0397ef52c9 /pam-extensions
parentd5280a38761a558c32c32e1e277ebd26f63af5c7 (diff)
downloadgdm-d39ed7b722761e5110e26c8e937782ecb24b7315.tar.gz
daemon: add ChoiceList PAM extension
This commit adds one PAM extension, a "Choice List" using the new PAM_BINARY_PROMPT protocol added in the previous commit. The PAM module sends a list of (key, row text) pairs, and GDM ferries the request to gnome-shell using a new user verifier sub-interface. gnome-shell should present the list to the user and pass back the corresponding key, which GDM ferries back to the PAM module. Note this commit is only the daemon side. A subsequent commit will add the libgdm API needed for gnome-shell to actually deal with this new PAM extension. https://bugzilla.gnome.org/show_bug.cgi?id=788851
Diffstat (limited to 'pam-extensions')
-rw-r--r--pam-extensions/gdm-pam-extensions.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/pam-extensions/gdm-pam-extensions.h b/pam-extensions/gdm-pam-extensions.h
index eff2f40a..cecb7422 100644
--- a/pam-extensions/gdm-pam-extensions.h
+++ b/pam-extensions/gdm-pam-extensions.h
@@ -130,4 +130,49 @@ typedef struct {
#define GDM_PAM_EXTENSION_SUPPORTED(name) GDM_PAM_EXTENSION_LOOK_UP_TYPE(name, (unsigned char *) NULL)
+typedef struct {
+ const char *key;
+ const char *text;
+} GdmChoiceListItems;
+
+typedef struct {
+ size_t number_of_items;
+ GdmChoiceListItems items[];
+} GdmChoiceList;
+
+typedef struct {
+ GdmPamExtensionMessage header;
+
+ char *prompt_message;
+ GdmChoiceList list;
+} GdmPamExtensionChoiceListRequest;
+
+typedef struct {
+ GdmPamExtensionMessage header;
+
+ char *key;
+} GdmPamExtensionChoiceListResponse;
+
+#define GDM_PAM_EXTENSION_CHOICE_LIST "org.gnome.DisplayManager.UserVerifier.ChoiceList"
+
+#define GDM_CHOICE_LIST_SIZE(num_items) (offsetof(GdmChoiceList, items) + (num_items) * sizeof (GdmChoiceListItems))
+#define GDM_PAM_EXTENSION_CHOICE_LIST_REQUEST_SIZE(num_items) (offsetof(GdmPamExtensionChoiceListRequest, list) + GDM_CHOICE_LIST_SIZE((num_items)))
+#define GDM_PAM_EXTENSION_CHOICE_LIST_REQUEST_INIT(request, title, num_items) \
+{ \
+ int _n = num_items; \
+ GDM_PAM_EXTENSION_LOOK_UP_TYPE (GDM_PAM_EXTENSION_CHOICE_LIST, &request->header.type); \
+ request->header.length = htobe32 (GDM_PAM_EXTENSION_CHOICE_LIST_REQUEST_SIZE(_n)); \
+ request->prompt_message = title; \
+ request->list.number_of_items = _n; \
+}
+
+#define GDM_PAM_EXTENSION_CHOICE_LIST_RESPONSE_SIZE sizeof (GdmPamExtensionChoiceListResponse)
+#define GDM_PAM_EXTENSION_CHOICE_LIST_RESPONSE_INIT(response) \
+{ \
+ GDM_PAM_EXTENSION_LOOK_UP_TYPE (GDM_PAM_EXTENSION_CHOICE_LIST, &response->header.type); \
+ response->header.length = htobe32 (GDM_PAM_EXTENSION_CHOICE_LIST_RESPONSE_SIZE); \
+ response->key = NULL; \
+}
+#define GDM_PAM_EXTENSION_REPLY_TO_CHOICE_LIST_RESPONSE(reply) ((GdmPamExtensionChoiceListResponse *) (void *) reply->resp)
+
#endif