SbuildAuthConv

SbuildAuthConv — authentication conversation interface

Synopsis




            SbuildAuthConv;
            SbuildAuthConvInterface;
time_t      (*SbuildAuthConvGetWarningTimeoutFunc)
                                            (SbuildAuthConv *auth_conv);
void        (*SbuildAuthConvSetWarningTimeoutFunc)
                                            (SbuildAuthConv *auth_conv,
                                             time_t timeout);
time_t      (*SbuildAuthConvGetFatalTimeoutFunc)
                                            (SbuildAuthConv *auth_conv);
void        (*SbuildAuthConvSetFatalTimeoutFunc)
                                            (SbuildAuthConv *auth_conv,
                                             time_t timeout);
gboolean    (*SbuildAuthConvConversationFunc)
                                            (SbuildAuthConv *auth_conv,
                                             guint num_messages,
                                             SbuildAuthMessageVector *messages);
time_t      sbuild_auth_conv_get_warning_timeout
                                            (SbuildAuthConv *auth_conv);
void        sbuild_auth_conv_set_warning_timeout
                                            (SbuildAuthConv *auth_conv,
                                             time_t timeout);
time_t      sbuild_auth_conv_get_fatal_timeout
                                            (SbuildAuthConv *auth_conv);
void        sbuild_auth_conv_set_fatal_timeout
                                            (SbuildAuthConv *auth_conv,
                                             time_t timeout);
gboolean    sbuild_auth_conv_conversation   (SbuildAuthConv *auth_conv,
                                             guint num_messages,
                                             SbuildAuthMessageVector *messages);

Object Hierarchy


  GInterface
   +----SbuildAuthConv

Prerequisites

SbuildAuthConv requires GObject.

Known Implementations

SbuildAuthConv is implemented by SbuildAuthConvTty.

Properties


  "fatal-timeout"        gint                  : Read / Write
  "warning-timeout"      gint                  : Read / Write

Signal Prototypes


"conversation"
            gboolean    user_function      (SbuildAuthConv *sbuildauthconv,
                                            guint arg1,
                                            SbuildAuthMessageVector *arg2,
                                            gpointer user_data);

Description

SbuildAuthConv is an interface which should be implemented by objects which handle interaction with the user during authentication.

This is a wrapper around the struct pam_conv PAM conversation interface, and is used by SbuildAuth when interacting with the user during authentication.

A simple implementation is provided in the form of SbuildAuthConvTty. However, more complex implementations might hook into the GLib main loop, or implement it in a GtkWidget.

The interface allows the setting of optional warning timeout and fatal timeout values, which default to 0 (not enabled). This is an absolute time after which a warning is displayed or the conversation ends with an error.

Details

SbuildAuthConv

typedef struct _SbuildAuthConv SbuildAuthConv;

SbuildAuthConv interface.


SbuildAuthConvInterface

typedef struct {
  GTypeInterface                      parent;
  SbuildAuthConvGetWarningTimeoutFunc get_warning_timeout;
  SbuildAuthConvSetWarningTimeoutFunc set_warning_timeout;
  SbuildAuthConvGetFatalTimeoutFunc   get_fatal_timeout;
  SbuildAuthConvSetFatalTimeoutFunc   set_fatal_timeout;
  SbuildAuthConvConversationFunc      conversation;
} SbuildAuthConvInterface;

SbuildAuthConv interface.

GTypeInterface parent; parent GInterface
SbuildAuthConvGetWarningTimeoutFunc get_warning_timeout; get the warning timeout
SbuildAuthConvSetWarningTimeoutFunc set_warning_timeout; set the warning timeout
SbuildAuthConvGetFatalTimeoutFunc get_fatal_timeout; get the fatal timeout
SbuildAuthConvSetFatalTimeoutFunc set_fatal_timeout; set the fatal timeout
SbuildAuthConvConversationFunc conversation; hold a conversation with the user

SbuildAuthConvGetWarningTimeoutFunc ()

time_t      (*SbuildAuthConvGetWarningTimeoutFunc)
                                            (SbuildAuthConv *auth_conv);

Get the warning timeout.

auth_conv : an SbuildAuthConv.
Returns : the warning timeout.

SbuildAuthConvSetWarningTimeoutFunc ()

void        (*SbuildAuthConvSetWarningTimeoutFunc)
                                            (SbuildAuthConv *auth_conv,
                                             time_t timeout);

Set the warning timeout.

auth_conv : an SbuildAuthConv.
timeout : the timeout to set.

SbuildAuthConvGetFatalTimeoutFunc ()

time_t      (*SbuildAuthConvGetFatalTimeoutFunc)
                                            (SbuildAuthConv *auth_conv);

Get the fatal timeout.

auth_conv : an SbuildAuthConv.
Returns : the fatal timeout.

SbuildAuthConvSetFatalTimeoutFunc ()

void        (*SbuildAuthConvSetFatalTimeoutFunc)
                                            (SbuildAuthConv *auth_conv,
                                             time_t timeout);

Set the fatal timeout.

auth_conv : An SbuildAuthConv.
timeout : the timeout to set.

SbuildAuthConvConversationFunc ()

gboolean    (*SbuildAuthConvConversationFunc)
                                            (SbuildAuthConv *auth_conv,
                                             guint num_messages,
                                             SbuildAuthMessageVector *messages);

Hold a conversation with the user.

auth_conv : An SbuildAuthConv.
num_messages : the number of messages.
messages : the messages.
Returns : TRUE on success, FALSE on failure.

sbuild_auth_conv_get_warning_timeout ()

time_t      sbuild_auth_conv_get_warning_timeout
                                            (SbuildAuthConv *auth_conv);

Get the warning timeout for auth_conv.

auth_conv : an SbuildAuthConv.
Returns : the timeout.

sbuild_auth_conv_set_warning_timeout ()

void        sbuild_auth_conv_set_warning_timeout
                                            (SbuildAuthConv *auth_conv,
                                             time_t timeout);

Set the warning timeout for auth_conv.

auth_conv : an SbuildAuthConv.
timeout : the timeout to set.

sbuild_auth_conv_get_fatal_timeout ()

time_t      sbuild_auth_conv_get_fatal_timeout
                                            (SbuildAuthConv *auth_conv);

Get the fatal timeout for auth_conv.

auth_conv : an SbuildAuthConv.
Returns : the timeout.

sbuild_auth_conv_set_fatal_timeout ()

void        sbuild_auth_conv_set_fatal_timeout
                                            (SbuildAuthConv *auth_conv,
                                             time_t timeout);

Set the fatal timeout for auth_conv.

auth_conv : an SbuildAuthConv.
timeout : the timeout to set.

sbuild_auth_conv_conversation ()

gboolean    sbuild_auth_conv_conversation   (SbuildAuthConv *auth_conv,
                                             guint num_messages,
                                             SbuildAuthMessageVector *messages);

Hold a conversation with the user.

Each of the messages detailed in messages should be displayed to the user, asking for input where required. The type of message is indicated in the type field of the SbuildAuthMessage. The response field of the message vector SbuildAuthMessage should be filled in if input is required. This will be automatically freed on success or failure. The user_data field of SbuildAuthMessage is for the use of SbuildAuthConv implementations, and will be otherwise ignored.

auth_conv : an SbuildAuthConv.
num_messages : the number of messages
messages : the messages to display to the user
Returns : TRUE on success, FALSE on failure.

Properties

The "fatal-timeout" property

  "fatal-timeout"        gint                  : Read / Write

The time to wait until aborting.

Allowed values: >= 0

Default value: 0


The "warning-timeout" property

  "warning-timeout"      gint                  : Read / Write

The time to wait until warning the user.

Allowed values: >= 0

Default value: 0

Signals

The "conversation" signal

gboolean    user_function                  (SbuildAuthConv *sbuildauthconv,
                                            guint arg1,
                                            SbuildAuthMessageVector *arg2,
                                            gpointer user_data);

Hold a conversation with the user. Note that for security, only the first registered signal handler will be run, so that the user will not be asked for the same information by multiple handlers.

sbuildauthconv : the object which received the signal.
arg1 : the number of messages
arg2 : the message vector containing the messages and responses
user_data : user data set when the signal handler was connected.
Returns : TRUE on success, FALSE on failure.