GksuContext

GksuContext —

Synopsis




#define     GKSU_TYPE_CONTEXT
#define     GKSU_CONTEXT                    (obj)
#define     GKSU_CONTEXT_CLASS              (klass)
#define     GKSU_IS_CONTEXT                 (obj)
#define     GKSU_CONTEXT_GET_CLASS          (obj)
GksuContext* gksu_context_new               ();
void        gksu_context_free               (GksuContext *context);
void        gksu_context_set_user           (GksuContext *context,
                                             gchar *username);
const gchar* gksu_context_get_user          (GksuContext *context);
void        gksu_context_set_command        (GksuContext *context,
                                             gchar *command);
const gchar* gksu_context_get_command       (GksuContext *context);
void        gksu_context_set_password       (GksuContext *context,
                                             gchar *password);
const gchar* gksu_context_get_password      (GksuContext *context);
void        gksu_context_set_login_shell    (GksuContext *context,
                                             gboolean value);
gboolean    gksu_context_get_login_shell    (GksuContext *context);
void        gksu_context_set_keep_env       (GksuContext *context,
                                             gboolean value);
gboolean    gksu_context_get_keep_env       (GksuContext *context);
void        gksu_context_set_debug          (GksuContext *context,
                                             gboolean value);
gboolean    gksu_context_get_debug          (GksuContext *context);
void        gksu_context_set_ssh_fwd        (GksuContext *context,
                                             gboolean value);
gboolean    gksu_context_get_ssh_fwd        (GksuContext *context);
GType       gksu_context_get_type           (void);
gboolean    gksu_context_run                (GksuContext *context,
                                             GError **error);
gboolean    gksu_context_sudo_run           (GksuContext *context,
                                             GError **error);

Description

Details

GKSU_TYPE_CONTEXT

#define GKSU_TYPE_CONTEXT (gksu_context_get_type ())


GKSU_CONTEXT()

#define GKSU_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GKSU_TYPE_CONTEXT, GksuContext))

obj :

GKSU_CONTEXT_CLASS()

#define GKSU_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GKSU_TYPE_CONTEXT, GksuContextClass))

klass :

GKSU_IS_CONTEXT()

#define GKSU_IS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GKSU_TYPE_CONTEXT))

obj :

GKSU_CONTEXT_GET_CLASS()

#define GKSU_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GKSU_TYPE_CONTEXT, GksuContextClass))

obj :

gksu_context_new ()

GksuContext* gksu_context_new               ();

Creates a new context to use gksu with. You must manually free the context with gksu_context_free after use.

Returns : a new GksuContext.

gksu_context_free ()

void        gksu_context_free               (GksuContext *context);

context :

gksu_context_set_user ()

void        gksu_context_set_user           (GksuContext *context,
                                             gchar *username);

Sets up what user the command will be run as. The default is root, but you can run the command as any user.

context : the GksuContext you want to modify
username : the target username

gksu_context_get_user ()

const gchar* gksu_context_get_user          (GksuContext *context);

Gets the user the command will be run as, as set by gksu_context_set_user.

context : the GksuContext from which to grab the information
Returns : a pointer to the string containing the username.

gksu_context_set_command ()

void        gksu_context_set_command        (GksuContext *context,
                                             gchar *command);

Sets up what command will run with the target user.

context : the GksuContext you want to modify
command : the command that shall be ran

gksu_context_get_command ()

const gchar* gksu_context_get_command       (GksuContext *context);

Gets the command that will be run, as set by gksu_context_set_command.

context : the GksuContext from which to grab the information
Returns : a pointer to the string containing the command.

gksu_context_set_password ()

void        gksu_context_set_password       (GksuContext *context,
                                             gchar *password);

Sets up what is the password to be passed to su/sudo. *

context : the GksuContext you want to modify
password : the password

gksu_context_get_password ()

const gchar* gksu_context_get_password      (GksuContext *context);

Gets the password that is set for calling the su/sudo programs.

context : the GksuContext from which to grab the information
Returns : a pointer to the string containing the password.

gksu_context_set_login_shell ()

void        gksu_context_set_login_shell    (GksuContext *context,
                                             gboolean value);

Should the shell in which the command will be run be a login shell?

context : the GksuContext you want to modify
value : TRUE or FALSE

gksu_context_get_login_shell ()

gboolean    gksu_context_get_login_shell    (GksuContext *context);

Finds out if the shell created by the underlying su process will be a login shell.

context : the GksuContext from which to grab the information
Returns : TRUE if the shell will be a login shell, FALSE otherwise.

gksu_context_set_keep_env ()

void        gksu_context_set_keep_env       (GksuContext *context,
                                             gboolean value);

Should the environment be kept as it is? Defaults to TRUE. Notice that setting this to FALSE may cause the X authorization stuff to fail.

context : the GksuContext you want to modify
value : TRUE or FALSE

gksu_context_get_keep_env ()

gboolean    gksu_context_get_keep_env       (GksuContext *context);

Finds out if the environment in which the program will be run will be reset.

context : the GksuContext from which to grab the information
Returns : TRUE if the environment is going to be kept, FALSE otherwise.

gksu_context_set_debug ()

void        gksu_context_set_debug          (GksuContext *context,
                                             gboolean value);

Set up if debuging information should be printed.

context : the GksuContext you want to modify
value : TRUE or FALSE

gksu_context_get_debug ()

gboolean    gksu_context_get_debug          (GksuContext *context);

Finds out if the library is configured to print debuging information.

context : the GksuContext from which to grab the information
Returns : TRUE if it is, FALSE otherwise.

gksu_context_set_ssh_fwd ()

void        gksu_context_set_ssh_fwd        (GksuContext *context,
                                             gboolean value);

Set up if we are running inside a sshd forwarding session. That's because the X authorization semantics differ a bit.

context : the GksuContext you want to modify
value : TRUE or FALSE

gksu_context_get_ssh_fwd ()

gboolean    gksu_context_get_ssh_fwd        (GksuContext *context);

Finds out if the library is configured as being run inside a ssh X11 forwarding tunnel.

context : the GksuContext from which to grab the information
Returns : TRUE if it is, FALSE otherwise.

gksu_context_get_type ()

GType       gksu_context_get_type           (void);

Returns :

gksu_context_run ()

gboolean    gksu_context_run                (GksuContext *context,
                                             GError **error);

This could be considered one of the main functions in GKSu. it is responsible for doing the 'user changing' magic.

context : a GksuContext
error : a GError object to be filled with the error code or NULL
Returns : the child's error status, 0 if all went fine, -1 if failed

gksu_context_sudo_run ()

gboolean    gksu_context_sudo_run           (GksuContext *context,
                                             GError **error);

This could be considered one of the main functions in GKSu. it is responsible for doing the 'user changing' magic by calling gksu_ask_password() if it needs the user's password it behaves like sudo.

context : a GksuContext
error : a GError object to be filled with the error code or NULL
Returns : the child's error status, 0 if all went fine, -1 if failed