gksu.c

gksu.c — GKSu - Authorization library with a UI

Synopsis




gboolean    gksu_init                       (gint argc,
                                             gchar **argv);
void        gksu_secure_free                (gchar *string);
gchar*      gksu_ask_password               ();
void        gksu_free_conf                  ();
gboolean    gksu_run                        (gchar *command);
gboolean    gksu_sudo_run                   (gchar *command);
void        gksu_set_user                   (gchar *username);
const gchar* gksu_get_user                  (void);
void        gksu_set_title                  (gchar *title);
const gchar* gksu_get_title                 (void);
void        gksu_set_message                (gchar *message);
const gchar* gksu_get_message               ();
void        gksu_set_icon                   (gchar *icon);
const gchar* gksu_get_icon                  (void);
void        gksu_set_login_shell            (gboolean value);
gboolean    gksu_get_login_shell            ();
void        gksu_set_keep_env               (gboolean value);
gboolean    gksu_get_keep_env               ();
void        gksu_set_grab                   (gboolean value);
gboolean    gksu_get_grab                   ();
void        gksu_set_debug                  (gboolean value);
gboolean    gksu_get_debug                  ();
void        gksu_set_ssh_fwd                (gboolean value);
gboolean    gksu_get_ssh_fwd                ();

Description

This is a library to help with authorization to run priviledged applications from within graphical programs.

Details

gksu_init ()

gboolean    gksu_init                       (gint argc,
                                             gchar **argv);

Inits the main configuration struct, a GkConf, and also inits the Gtk+ engine. You need to call this before doing anything.

argc : argc to be passed to gtk_init, mainly - or zero
argv : argv to be passed to gtk_init, or NULL
Returns : 0 if it suceeds, 1 if it fails.

gksu_secure_free ()

void        gksu_secure_free                (gchar *string);

Clears variables filling them with 0's previously

string : string to be freed securely

gksu_ask_password ()

gchar*      gksu_ask_password               ();

This is one of the main functions in gksu. It asks the user for the password of the target user.

Returns : a newly allocated gchar containing the password or NULL if an error happens or the user cancels the action

gksu_free_conf ()

void        gksu_free_conf                  ();


gksu_run ()

gboolean    gksu_run                        (gchar *command);

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 target user's password.

command : string containing the command to be run
Returns : TRUE(1) if failed, FALSE(0) if succeeded.

gksu_sudo_run ()

gboolean    gksu_sudo_run                   (gchar *command);

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.

command : string containing the command to be run
Returns : TRUE(1) if failed, FALSE(0) if succeeded.

gksu_set_user ()

void        gksu_set_user                   (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.

username : the target username

gksu_get_user ()

const gchar* gksu_get_user                  (void);

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

Returns : a pointer to the string containing the username.

gksu_set_title ()

void        gksu_set_title                  (gchar *title);

title :

gksu_get_title ()

const gchar* gksu_get_title                 (void);

Gets what is the current title that the windows that asks for the password will show.

Returns : a string with the current title

gksu_set_message ()

void        gksu_set_message                (gchar *message);

message :

gksu_get_message ()

const gchar* gksu_get_message               ();

Returns :

gksu_set_icon ()

void        gksu_set_icon                   (gchar *icon);

icon :

gksu_get_icon ()

const gchar* gksu_get_icon                  (void);

Returns :

gksu_set_login_shell ()

void        gksu_set_login_shell            (gboolean value);

value :

gksu_get_login_shell ()

gboolean    gksu_get_login_shell            ();

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

Returns : TRUE if the shell will be a login shell, FALSE otherwise.

gksu_set_keep_env ()

void        gksu_set_keep_env               (gboolean value);

value :

gksu_get_keep_env ()

gboolean    gksu_get_keep_env               ();

Returns :

gksu_set_grab ()

void        gksu_set_grab                   (gboolean value);

value :

gksu_get_grab ()

gboolean    gksu_get_grab                   ();

Returns :

gksu_set_debug ()

void        gksu_set_debug                  (gboolean value);

value :

gksu_get_debug ()

gboolean    gksu_get_debug                  ();

Returns :

gksu_set_ssh_fwd ()

void        gksu_set_ssh_fwd                (gboolean value);

value :

gksu_get_ssh_fwd ()

gboolean    gksu_get_ssh_fwd                ();

Returns :