gksu.c

gksu.c — Main File for the GKSu application.

Synopsis




struct      GkConf;
gboolean    gksu_init                       (gint argc,
                                             gchar **argv);
void        gksu_secure_free                (gchar *string);
gchar*      gksu_ask_password               ();
gboolean    gksu_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 file holds the main() function for GKSu, as well as the main definitions and some "global" functions.

Details

struct GkConf

struct GkConf {

  gchar *xauth;

  gchar *display;

  gchar *title;
  gchar *message;
  gchar *icon;

  gchar *user;

  gchar *command;

  gboolean login_shell;
  gboolean keep_env;
  gboolean grab;

  gboolean debug;
  gboolean ssh_fwd;
};

Structure to hold all configuration information, some important environment variables and some meta-information about mainly x authentication.

gchar *xauth the X authorization token
gchar *display storage for the DISPLAY environment variable
gchar *title the title of the window which asks for password
gchar *message the label to be put at the window which asks for password
gchar *icon path for the icon the window will use
gchar *user user gksu will switch to
gchar *command which command to run with su
gboolean login_shell should run a login shell?
gboolean keep_env should the current environment be kept?
gboolean grab should gksu try to gra X keyboard and mouse?
gboolean debug show debug information?
gboolean ssh_fwd are we running inside a ssh X11 forwarding tunnel?

gksu_init ()

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

argc:
argv:
Returns :

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_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 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_set_user ()

void        gksu_set_user                   (gchar *username);

username:

gksu_get_user ()

const gchar* gksu_get_user                  (void);

Returns :

gksu_set_title ()

void        gksu_set_title                  (gchar *title);

title:

gksu_get_title ()

const gchar* gksu_get_title                 (void);

Returns :

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            ();

Returns :

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 :