| GKSu Developers Manual |
|---|
gksu.c — Main File for the GKSu application.
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 ();
This file holds the main() function for GKSu, as well as the main definitions and some "global" functions.
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? |
void gksu_secure_free (gchar *string);
Clears variables filling them with 0's previously
| string: | string to be freed securely |
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 |
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. |
| << Library Reference |