Пример #1
0
static void
auth_ok(void *data)
{
	struct dialog *dlg = (struct dialog *)data;
	struct auth_entry *entry = (struct auth_entry *)dlg->udata2;
	struct session *ses = (struct session *)dlg->udata;

	entry->blocked = 0;
	entry->valid = auth_entry_has_userinfo(entry);

#ifdef CONFIG_FORMHIST
	if (get_opt_bool((const unsigned char *)"document.browse.forms.show_formhist", ses)) {
		unsigned char *url = get_uri_string(entry->uri, URI_HTTP_AUTH);

		if (url) {
			struct form form = {};

			form.action = url;
			INIT_LIST_OF(struct submitted_value, submit);
			struct submitted_value *user, *password;

			user = init_submitted_value((unsigned char *)"user", entry->user, FC_TEXT, NULL, 0);
			if (user) {
				add_to_list(submit, user);
			}
			password = init_submitted_value((unsigned char *)"password", entry->password, FC_PASSWORD, NULL, 0);
			if (password) {
				add_to_list(submit, password);
			}

			memorize_form(ses, &submit, &form);
			done_submitted_value_list(&submit);
			mem_free(url);
		}
	}
#endif

	if (entry->valid && have_location(ses)) {
		struct location *loc = cur_loc(ses);
		struct uri *uri = loc->vs.uri;

		/* Make a 'fake' redirect to a URI without user/password so that
		 * the user/password from the URI will not override what the
		 * user just entered in the dialog. */
		if ((uri->userlen && strlcmp(entry->user, -1, uri->user, uri->userlen))
		    || (uri->password && strlcmp(entry->password, -1, uri->password, uri->passwordlen))) {

			uri = get_composed_uri(uri, URI_HTTP_AUTH | URI_DATA | URI_POST);
			if (uri) {
				goto_uri_frame(ses, uri, NULL, CACHE_MODE_INCREMENT);
				done_uri(uri);
				return;
			}
		}
	}

	reload(ses, CACHE_MODE_INCREMENT);
}
Пример #2
0
static void
delayed_goto(void *data)
{
	struct delayed_goto *deg = data;

	assert(deg);
	if (deg->vs->doc_view
	    && deg->vs->doc_view == deg->vs->doc_view->session->doc_view) {
		goto_uri_frame(deg->vs->doc_view->session, deg->uri,
		               deg->vs->doc_view->name,
			       CACHE_MODE_NORMAL);
	}
	done_uri(deg->uri);
	mem_free(deg);
}
Пример #3
0
void auth_ok( void *data )
{
  int edx;
  struct auth_entry *entry = &((int*)data)[2];
  struct session *ses = &((int*)data)[1];
  ((int*)data)[2] = ((int*)data)[2] & -2;
  entry->bits_at_112/*.1_1of4*/ = ( (int)entry->bits_at_112/*.1_1of4*/ & -2 & -3 ) | ( ( entry->user[0] == 0 ? 1 : entry->password[0] != 0 ) * 2 );
  if ( ( ( (unsigned char)( ( (int)entry->bits_at_112/*.1_1of4*/ & -2 & -3 ) | ( ( entry->password[0] != 0 ) * 2 ) ) & 2 ) & 255 ) && ses->history.current )
  {
    struct uri *uri = ses->history.current->vs.uri;
    if ( uri->bits_at_40/*.3_4of4*/ )
    {
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/auth/dialogs.c";
      errline = 45;
      if ( elinks_strlcmp( &entry->user[0], -1, uri->user, uri->bits_at_40/*.3_4of4*/ ) )
      {
        uri = get_composed_uri( &uri[0], -32077 );
        if ( get_composed_uri( &uri[0], -32077 ) )
        {
          goto_uri_frame( &ses[0], get_composed_uri( &uri[0], -32077 ), 0, CACHE_MODE_INCREMENT );
          data = (void*)uri[0].string;
        }
      }
    }
    if ( uri->password )
    {
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/auth/dialogs.c";
      errline = 46;
      if ( elinks_strlcmp( entry->password[0] + 72, -1, uri->password, (int)uri->bits_at_44/*.1_2of4*/ ) )
      {
        uri = get_composed_uri( &uri[0], -32077 );
      }
    }
  }
  reload( &ses[0], CACHE_MODE_INCREMENT );
  return;
}