![]() | ![]() | ![]() | GKSu Developers Manual | ![]() |
---|
gksu.c — GKSu - Authorization library with a UI
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 ();
This is a library to help with authorization to run priviledged applications from within graphical programs.
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. |
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 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. |
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. |
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 |
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. |
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 |
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. |
<< Authorization with GKSu | GKSu Hackers Internals Guide >> |