"Object timeout",
"object timeout",
0,
- G_MAXINT,
+ G_MAXUINT,
0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
gchar *query = NULL;
gint flags = 0;
guint32 type;
- gint id;
+ gint64 id;
const gchar *caption= NULL, *username = NULL;
gboolean ret = FALSE;
GSignondSecurityContext *sec_context;
GList *sessions;
/* signal handler ids */
- guint info_updated_handler_id;
- guint verify_user_handler_id;
- guint verify_secret_handler_id;
- guint credentials_update_handler_id;
+ gulong info_updated_handler_id;
+ gulong verify_user_handler_id;
+ gulong verify_secret_handler_id;
+ gulong credentials_update_handler_id;
};
G_DEFINE_TYPE (GSignondDbusIdentityAdapter, gsignond_dbus_identity_adapter, GSIGNOND_TYPE_DISPOSABLE)
const gchar *reference,
gpointer user_data)
{
- gint32 id = 0;
+ guint32 id = 0;
GError *error = NULL;
g_return_val_if_fail (self && GSIGNOND_IS_DBUS_IDENTITY_ADAPTER (self), FALSE);
const gchar *reference,
gpointer user_data)
{
- gint32 id = 0;
+ guint32 id = 0;
GError *error = NULL;
g_return_val_if_fail (self && GSIGNOND_IS_DBUS_IDENTITY_ADAPTER (self), FALSE);
gboolean is_plugind_up;
/* Signals */
- guint signal_response;
- guint signal_response_final;
- guint signal_store;
- guint signal_error;
- guint signal_user_action_required;
- guint signal_refreshed;
- guint signal_status_changed;
+ gulong signal_response;
+ gulong signal_response_final;
+ gulong signal_store;
+ gulong signal_error;
+ gulong signal_user_action_required;
+ gulong signal_refreshed;
+ gulong signal_status_changed;
};
G_END_DECLS
NULL, &cpid, &cin_fd, &cout_fd, &cerr_fd, &error);
g_strfreev (argv);
if (ret == FALSE || (kill(cpid, 0) != 0)) {
- DBG ("failed to start plugind: error %s(%d)", error->message, ret);
+ DBG ("failed to start plugind: error %s(%d)",
+ error ? error->message : "(null)", ret);
if (error) g_error_free (error);
return NULL;
}
GOptionContext *opt_context = NULL;
gchar **plugin_args = NULL;
gint up_signal = -1;
+ gint in_fd = 0, out_fd = 1, err_fd = 2;
GOptionEntry opt_entries[] = {
{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &plugin_args,
"Plugin Args", NULL},
* to /dev/null to avoid anyone writing to descriptors before initial
* "plugind-is-ready" notification is sent to gsignond
* */
- gint in_fd = dup(0);
+ in_fd = dup(0);
+ if (in_fd == -1) {
+ WARN ("Failed to dup stdin : %s(%d)", strerror(errno), errno);
+ in_fd = 0;
+ }
if (!freopen("/dev/null", "r+", stdin)) {
WARN ("Unable to redirect stdin to /dev/null");
}
- gint out_fd = dup(1);
+ out_fd = dup(1);
+ if (out_fd == -1) {
+ WARN ("Failed to dup stdout : %s(%d)", strerror(errno), errno);
+ out_fd = 1;
+ }
if(!freopen("/dev/null", "r+", stdout)) {
WARN ("Unable to redirect stdout to /dev/null");
}
- gint err_fd = dup(2);
+ err_fd = dup(2);
+ if (err_fd == -1) {
+ WARN ("Failed to dup stderr : %s(%d)", strerror(errno), errno);
+ err_fd = 2;
+ }
if (!freopen("/dev/null", "r+", stderr)) {
WARN ("Unable to redirect stderr to /dev/null");
}
opt_context = g_option_context_new ("<plugin_path> <plugin_name>");
g_option_context_set_summary (opt_context, "gSSO helper plugin daemon");
g_option_context_add_main_entries (opt_context, opt_entries, NULL);
+ g_option_context_set_ignore_unknown_options (opt_context, TRUE);
g_option_context_parse (opt_context, &argc, &argv, &error);
g_option_context_free (opt_context);
- if (error || !plugin_args || !plugin_args[0] || !plugin_args[1]) {
- close (in_fd);
- close (out_fd);
- close (err_fd);
- if (error) g_error_free (error);
+ if (error) {
+ WARN ("Error in arguments parsing: %s", error->message);
+ g_error_free (error);
+ }
+ if (!plugin_args || !plugin_args[0] || !plugin_args[1]) {
+ WARN ("plugin path or plugin type missing");
+ if (in_fd != 0) close (in_fd);
+ if (out_fd != 1) close (out_fd);
+ if (err_fd != 2) close (err_fd);
if (plugin_args) g_strfreev(plugin_args);
return -1;
}
out_fd);
g_strfreev(plugin_args);
if (_daemon == NULL) {
- close (in_fd);
- close (out_fd);
- close (err_fd);
+ if (in_fd != 0) close (in_fd);
+ if (out_fd != 1) close (out_fd);
+ if (err_fd != 2) close (err_fd);
return -1;
}
if(_daemon) {
g_object_unref (_daemon);
}
-
+
if (main_loop) {
g_main_loop_unref (main_loop);
}
g_checksum_update (a2, TO_GUCHAR(method), strlen(method));
g_checksum_update (a2, TO_GUCHAR(":"), 1);
g_checksum_update (a2, TO_GUCHAR(digest_uri), strlen(digest_uri));
- if (qop && g_strcmp0 (qop, "auth-int") == 0) {
+ if (qop && g_strcmp0 (qop, "auth-int") == 0 && hentity) {
g_checksum_update (a2, TO_GUCHAR(":"), 1);
g_checksum_update (a2, TO_GUCHAR(hentity), strlen(hentity));
}
const gchar* hentity = gsignond_dictionary_get_string (session_data,
"HEntity");
gchar *cnonce = _gsignond_digest_plugin_generate_nonce (priv);
+
+ if ((!realm || !algo || !nonce || !method || !digest_uri)
+ || (qop && g_strcmp0 (qop, "auth-int") == 0 && !hentity)
+ || (qop && !nonce_count)) {
+ GError* error = g_error_new (GSIGNOND_ERROR,
+ GSIGNOND_ERROR_MISSING_DATA, "Missing Session Data");
+ gsignond_plugin_error (plugin, error);
+ g_error_free (error);
+ return;
+ }
gchar *digest = _gsignond_digest_plugin_compute_md5_digest(algo,
username,realm, secret, nonce, nonce_count, cnonce, qop, method,
digest_uri, hentity);