| LibGKSu Reference Manual |
|---|
GksuContext —
#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);
#define GKSU_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GKSU_TYPE_CONTEXT, GksuContext))
| obj : |
#define GKSU_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GKSU_TYPE_CONTEXT, GksuContextClass))
| klass : |
#define GKSU_IS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GKSU_TYPE_CONTEXT))
| obj : |
#define GKSU_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GKSU_TYPE_CONTEXT, GksuContextClass))
| obj : |
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. |
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 |
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. |
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 |
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. |
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 |
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. |
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 |
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. |
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 |
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. |
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 |
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. |
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 |
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. |
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 |
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 |
| << Main Reference |