diff options
Diffstat (limited to 'server/responder/pam/pamsrv_util.c')
-rw-r--r-- | server/responder/pam/pamsrv_util.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/server/responder/pam/pamsrv_util.c b/server/responder/pam/pamsrv_util.c index f43783a6..fb82cdcb 100644 --- a/server/responder/pam/pamsrv_util.c +++ b/server/responder/pam/pamsrv_util.c @@ -33,3 +33,78 @@ int pam_add_response(struct pam_data *pd, enum response_type type, return EOK; } + +int dp_pack_pam_request(DBusMessage *msg, struct pam_data *pd) +{ + int ret; + + ret = dbus_message_append_args(msg, + DBUS_TYPE_INT32, &(pd->cmd), + DBUS_TYPE_STRING, &(pd->domain), + DBUS_TYPE_STRING, &(pd->user), + DBUS_TYPE_STRING, &(pd->service), + DBUS_TYPE_STRING, &(pd->tty), + DBUS_TYPE_STRING, &(pd->ruser), + DBUS_TYPE_STRING, &(pd->rhost), + DBUS_TYPE_INT32, &(pd->authtok_type), + DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, + &(pd->authtok), + (pd->authtok_size), + DBUS_TYPE_INT32, &(pd->newauthtok_type), + DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, + &(pd->newauthtok), + pd->newauthtok_size, + DBUS_TYPE_INVALID); + + return ret; +} + +int dp_unpack_pam_request(DBusMessage *msg, struct pam_data *pd, DBusError *dbus_error) +{ + int ret; + + ret = dbus_message_get_args(msg, dbus_error, + DBUS_TYPE_INT32, &(pd->cmd), + DBUS_TYPE_STRING, &(pd->domain), + DBUS_TYPE_STRING, &(pd->user), + DBUS_TYPE_STRING, &(pd->service), + DBUS_TYPE_STRING, &(pd->tty), + DBUS_TYPE_STRING, &(pd->ruser), + DBUS_TYPE_STRING, &(pd->rhost), + DBUS_TYPE_INT32, &(pd->authtok_type), + DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, + &(pd->authtok), + &(pd->authtok_size), + DBUS_TYPE_INT32, &(pd->newauthtok_type), + DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, + &(pd->newauthtok), + &(pd->newauthtok_size), + DBUS_TYPE_INVALID); + + return ret; +} + +int dp_pack_pam_response(DBusMessage *msg, struct pam_data *pd) +{ + int ret; + + ret = dbus_message_append_args(msg, + DBUS_TYPE_UINT32, &(pd->pam_status), + DBUS_TYPE_STRING, &(pd->domain), + DBUS_TYPE_INVALID); + + return ret; +} + +int dp_unpack_pam_response(DBusMessage *msg, struct pam_data *pd, DBusError *dbus_error) +{ + int ret; + + ret = dbus_message_get_args(msg, dbus_error, + DBUS_TYPE_UINT32, &(pd->pam_status), + DBUS_TYPE_STRING, &(pd->domain), + DBUS_TYPE_INVALID); + + return ret; +} + |