Beispiel #1
0
/* Delete an entry from auth list. */
void
del_auth_entry(struct auth_entry *entry)
{
#ifdef DEBUG_HTTP_AUTH
	DBG("del_auth_entry: url=%s realm=%s user=%p",
	      entry->url, entry->realm, entry->user);
#endif

	del_from_list(entry);

	done_auth_entry(entry);
}
Beispiel #2
0
static struct auth_entry *
init_auth_entry(struct uri *uri, unsigned char *realm)
{
	struct auth_entry *entry;

#ifdef DEBUG_HTTP_AUTH
	DBG("init_auth_entry: auth_url=%s realm=%s uri=%p", auth_url, realm, uri);
#endif

	entry = mem_calloc(1, sizeof(*entry));
	if (!entry) return NULL;

	entry->uri = get_uri_reference(uri);

	if (realm) {
		/* Copy realm value. */
		entry->realm = stracpy(realm);
		if (!entry->realm) {
			mem_free(entry);
			return NULL;
		}
	}

	/* Copy user and pass info passed url if any else NULL terminate. */

	set_auth_user(entry, uri);
	set_auth_password(entry, uri);

	entry->box_item = add_listbox_leaf(&auth_browser, NULL, entry);
	if (!entry->box_item) {
		done_auth_entry(entry);
		return NULL;
	}

	return entry;
}
Beispiel #3
0
struct auth_entry *add_auth_entry( struct uri *uri, unsigned char *realm, unsigned char *nonce, unsigned char *opaque, unsigned int digest )
{
  int eax;
  int edx;
  struct auth_entry *entry;
  if ( find_auth_entry( uri, realm ) == 0 )
  {
    entry = (struct auth_entry*)mem_calloc( 1, 116 );
    if ( mem_calloc( 1, 116 ) == 0 )
    {
      return &entry[0];
    }
    uri->object.refcount = uri->object.refcount;
    *(int*)(mem_calloc( 1, 116 ) + 12) = uri[0];
    if ( realm )
    {
      *(int*)(mem_calloc( 1, 116 ) + 16) = stracpy( realm );
      if ( mem_calloc( 1, 116 ) + 16 == 0 )
      {
        mem_free( &ecx );
        return &entry[0];
      }
    }
    set_auth_user( &ecx, &uri[0] );
    set_auth_password( ebp_28, &uri[0] );
    *(int*)(ebp_28 + 28) = eax;
    if ( ebp_28 + 28 == 0 )
    {
      done_auth_entry( &ecx );
      return &entry[0];
    }
    *(int*)(ecx + 4) = auth_entry_list.next;
    ecx = auth_entry_list.next;
    auth_entry_list.next = &ecx;
    *(int*)(ecx + 4) = ecx;
    if ( nonce )
    {
      auth_entry_list.next[6] = stracpy( nonce );
      if ( auth_entry_list.next + 4 + 20 == 0 )
      {
        del_auth_entry( &ecx );
        return &entry[0];
      }
    }
    if ( opaque )
    {
      *(int*)(ebp_28 + 24) = stracpy( opaque );
      if ( ebp_28 + 24 == 0 )
      {
        del_auth_entry( &ecx );
        return &entry[0];
      }
    }
    auth_entry_list.next[29] = ( *(char*)(auth_entry_list.next + 4 + 112) & -5 ) | ( ( (int)digest/*.1_1of4*/ & 1 ) << 2 );
  }
  else
  {
    if ( ( ( *(char*)(find_auth_entry( uri, realm ) + 112) & 1 ) & 255 ) == 0 )
    {
      if ( (unsigned char)( realm != 0 ) == ( *(int*)(entry[0].next + 16) != 0 ) )
      {
        if ( ( ( realm != 0 ) & 255 ) && ebp_41 && stracpy( opaque ) )
          entry->realm[0] = entry->realm;
        else
        {
          if ( entry->user[0] && uri->user && uri->bits_at_40/*.3_4of4*/ )
          {
            errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/auth/auth.c";
            errline = 185;
            if ( elinks_strlcmp( &entry->user[0], -1, uri->user, uri->bits_at_40/*.3_4of4*/ ) == 0 )
            {
              if ( entry->password[0] && uri->password && uri->bits_at_44/*.1_2of4*/ )
              {
                errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/auth/auth.c";
                errline = 192;
                if ( elinks_strlcmp( &entry->password[0], -1, uri->password, (int)uri->bits_at_44/*.1_2of4*/ ) )
                  goto B36;
              }
B36:              entry->bits_at_112/*.1_1of4*/ &= 253;
              set_auth_password( &entry[0], &uri[0] );
            }
          }
          entry->bits_at_112/*.1_1of4*/ &= 253;
          set_auth_user( &entry[0], &uri[0] );
        }
      }
      entry->bits_at_112/*.1_1of4*/ = (int)entry->bits_at_112/*.1_1of4*/ & -3;
      if ( entry->realm )
        mem_free( (void*)entry->realm );
      entry->realm = 0;
      if ( ( realm != 0 ) & 255 )
      {
        entry->realm = stracpy( realm );
        if ( entry->realm )
        {
          if ( nonce )
          {
            if ( entry->nonce )
              mem_free( (void*)entry->nonce );
            entry->nonce = stracpy( nonce );
            if ( entry->nonce == 0 )
              goto B23;
          }
          if ( opaque )
          {
            if ( entry->opaque )
              mem_free( (void*)entry->opaque );
            entry->opaque = stracpy( opaque );
            if ( entry->opaque == 0 )
            {
              del_auth_entry( &entry[0] );
              uri = &uri[0];
              return 0;
            }
          }
          entry->bits_at_112/*.1_1of4*/ = ( *(char*)(entry[0].next + 112) & -5 ) | ( ( (int)digest/*.1_1of4*/ & 1 ) << 2 );
        }
B23:        &entry[0] = 0;
        del_auth_entry( &entry[0] );
        return &entry[0];
      }
    }
    else
    {
      return 0;
    }
  }
  if ( !( ( entry->bits_at_112/*.1_1of4*/ & 2 ) & 255 ) && entry->realm )
  {
    add_questions_entry( &do_auth_dialog, (void*)entry[0].next );
    return &entry[0];
  }
  return &entry[0];
}