Exemple #1
0
struct auth_entry *find_auth( struct uri *uri )
{
  int eax;
  struct auth_entry *entry;
  &entry[0] = find_auth_entry( uri, 0 );
  if ( ( entry[0].next & 65535 ) || uri->bits_at_44/*.1_2of4*/ )
  {
    if ( entry[0].next )
    {
      if ( uri->bits_at_40/*.3_4of4*/ & 65535 )
      {
        errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/auth/auth.c";
        errline = 249;
        if ( elinks_strlcmp( &entry->user[0], -1, uri->user, uri->bits_at_40/*.3_4of4*/ ) == 0 )
        {
          if ( uri->password == 0 )
            &entry[0] = &entry[0];
            if ( ( ( entry->bits_at_112/*.1_1of4*/ & 1 ) & 255 ) == 0 )
            {
              if ( entry->user[0] == 0 && entry->password[0] == 0 )
              {
                del_auth_entry( &entry[0] );
                &entry[0] = &entry[0];
              }
              return &entry[0];
            }
            return 0;
        }
      }
      else
      if ( uri->password == 0 )
        continue;
      errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/auth/auth.c";
      errline = 250;
      if ( elinks_strlcmp( &entry->password[0], -1, uri->password, (int)uri->bits_at_44/*.1_2of4*/ ) == 0 )
        continue;
    }
    &entry[0] = add_auth_entry( &uri[0], 0, 0, 0, 0 );
  }
  if ( entry[0].next )
    continue;
  else
  {
    return &entry[0];
  }
}
Exemple #2
0
/* It returns a base 64 encoded user + pass suitable to use in Authorization
 * header, or NULL on failure. */
struct auth_entry *
find_auth(struct uri *uri)
{
	struct auth_entry *entry = NULL;

#ifdef DEBUG_HTTP_AUTH
	DBG("find_auth: newurl=%s uri=%p", newurl, uri);
#endif

	entry = find_auth_entry(uri, NULL);
	/* Check is user/pass info is in url. */
	if (uri->userlen || uri->passwordlen) {
		/* Add a new entry either to save the user/password info from the URI
		 * so it is available if we later get redirected to a URI with
		 * the user/password stripped. Else if update with entry with
		 * the user/password from the URI. */
		if (!entry
		    || (uri->userlen && strlcmp(entry->user, -1, uri->user, uri->userlen))
		    || (uri->password && strlcmp(entry->password, -1, uri->password, uri->passwordlen))) {

			entry = add_auth_entry(uri, NULL, NULL, NULL, 0);
		}
	}

	/* No entry found or waiting for user/password in dialog. */
	if (!entry || entry->blocked)
		return NULL;

	/* Sanity check. */
	if (!auth_entry_has_userinfo(entry)) {
		del_auth_entry(entry);
		return NULL;
	}

	return entry;
}
Exemple #3
0
/* Kill the current connection and ask for a username/password for the next
 * try. */
static void
prompt_username_pw(struct connection *conn)
{
	add_auth_entry(conn->uri, "Samba", NULL, NULL, 0);
	abort_connection(conn, connection_state(S_OK));
}