Ejemplo n.º 1
0
void setCookies(Document* /*document*/, const KURL& url, const String& value)
{
    // FIXME: Deal with document->firstPartyForCookies().
    String str = url.string();
    String val = value;
    InternetSetCookie(str.charactersWithNullTermination(), 0, val.charactersWithNullTermination());
}
Ejemplo n.º 2
0
static void
hippo_platform_impl_delete_login_cookie(HippoPlatform *platform)
{
    HippoBSTR authUrl;
    getAuthUrl(platform, &authUrl);
    InternetSetCookie(authUrl, NULL,  L"auth=; Path=/");
}
Ejemplo n.º 3
0
void delete_winmo_session(const char *url_string) {
  BOOL bReturn;
  // Delete the session cookie.
  LPTSTR url = wce_mbtowc(url_string);
  bReturn = InternetSetCookie(url, NULL, L"");
  free(url);
}
Ejemplo n.º 4
0
void setCookies(const KURL& url, const KURL& policyURL, const String& value)
{
#if USE(CFNETWORK)
    CFHTTPCookieStorageRef defaultCookieStorage = wkGetDefaultHTTPCookieStorage();
    if (!defaultCookieStorage)
        return;

    RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
    RetainPtr<CFURLRef> policyURLCF(AdoptCF, policyURL.createCFURL());

    // <http://bugzilla.opendarwin.org/show_bug.cgi?id=6531>, <rdar://4409034>
    // cookiesWithResponseHeaderFields doesn't parse cookies without a value
    String cookieString = value.contains('=') ? value : value + "=";

    RetainPtr<CFStringRef> cookieStringCF(AdoptCF, cookieString.createCFString());
    RetainPtr<CFDictionaryRef> headerFieldsCF(AdoptCF, CFDictionaryCreate(kCFAllocatorDefault, (const void**)&s_setCookieKeyCF, 
        (const void**)&cookieStringCF, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));

    RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieCreateWithResponseHeaderFields(kCFAllocatorDefault,
        headerFieldsCF.get(), urlCF.get()));

    CFHTTPCookieStorageSetCookies(defaultCookieStorage, cookiesCF.get(), urlCF.get(), policyURLCF.get());
#else
    // FIXME: Deal with the policy URL.
    DeprecatedString str = url.url();
    str.append((UChar)'\0');
    DeprecatedString val = value.deprecatedString();
    val.append((UChar)'\0');
    InternetSetCookie((UChar*)str.unicode(), 0, (UChar*)val.unicode());
#endif
}
Ejemplo n.º 5
0
void setCookiesFromDOM(const NetworkStorageSession&, const URL&, const URL& url, const String& value)
{
    // FIXME: Deal with firstParty argument.
    String str = url.string();
    String val = value;
    InternetSetCookie(str.charactersWithNullTermination().data(), 0, val.charactersWithNullTermination().data());
}
Ejemplo n.º 6
0
void setCookies(const KURL& url, const KURL& policyURL, const String& value)
{
    // FIXME: Deal with the policy URL.
    DeprecatedString str = url.url();
    str.append((UChar)'\0');
    DeprecatedString val = value.deprecatedString();
    val.append((UChar)'\0');
    InternetSetCookie((UChar*)str.unicode(), 0, (UChar*)val.unicode());
}
Ejemplo n.º 7
0
void
hippo_platform_impl_windows_migrate_cookie(const char *from_web_host,
                                           const char *to_web_host)
{
    char *username;
    char *password;

    // See if we already have a cookie from the new host
    if (read_ie_login_cookie(to_web_host, &username, &password)) {
        g_free(username);
        g_free(password);

        return;
    }

    if (!read_ie_login_cookie(from_web_host, &username, &password))
        return;

    GDate *date = g_date_new();
    GTimeVal timeval;
    g_get_current_time(&timeval);
    g_date_set_time_val(date, &timeval);
    g_date_add_days(date, 5 * 365); // 5 years, more or less

    // Can't use g_date_strftime, since that would be unpredictably located
    // while we need fixed english-locale DAY, DD-MMM-YYYY HH:MM:SS GMT

    static const char *days[] = {
        "Mon", "Tue", "Wed", "The", "Fri", "Sat", "Sun"
    };

    static const char * const months[] = {
        "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
    };

    char *cookieUTF8 = g_strdup_printf("auth=host=%s&name=%s&password=%s; Path=/; expires = %s, %02d-%s-%04d 00:00:00 GMT", 
                                       to_web_host, 
                                       username, 
                                       password, 
                                       days[(int)g_date_get_weekday(date) - 1],
                                       g_date_get_day(date),
                                       months[(int)g_date_get_month(date) - 1],
                                       g_date_get_year(date));
    g_date_free(date);

    HippoBSTR cookie;
    cookie.setUTF8(cookieUTF8, -1);
    g_free(cookieUTF8);
    
    HippoBSTR authUrl;
    makeAuthUrl(to_web_host, &authUrl);
    InternetSetCookie(authUrl, NULL, cookie);

    g_free(username);
    g_free(password);
}
Ejemplo n.º 8
0
void CpeepmBrowser::SaveCookie(const wchar_t* host, const char* name, UINT nameLength, const char* value, UINT valueLength)
{
    wchar_t* n = CpeepmUtil::CharToWideChar(name, nameLength);
    wchar_t* v = CpeepmUtil::CharToWideChar(value, valueLength);

    if (n != NULL && v != NULL)
        InternetSetCookie(host, n, v);

    ReleaseArray(n);
    ReleaseArray(v);
}
Ejemplo n.º 9
0
static void
store_ie_login_cookie(const char  *web_host,
                      int          web_port,
                      const char  *username,
                      const char  *password)
{
    HippoBSTR authUrl;
    
    makeAuthUrl(web_host, &authUrl);

    char *value = g_strdup_printf("host=%s&name=%s&password=%s; expires=Thu, 31-Dec-2020 23:59:59 GMT; path=/",
                                  web_host, username, password);
    HippoBSTR valueW = HippoBSTR::fromUTF8(value);
    g_free(value);

    InternetSetCookie(authUrl.m_str, L"auth", valueW.m_str);
}
Ejemplo n.º 10
0
void
logoutYahooJapan( char *buffer )
{
    char    *p, *q;
    char    cookie[MAX_COOKIE_LEN + 1];

    _httpGetIC( "http://www.yahoo.co.jp/", buffer, FALSE, TRUE );
    p = strstr( buffer, sjis2euc("ログアウト</a>") );
    if ( p ) {
        while ( (p > buffer) && (strncmpi( p, " href=\"", 7 ) != 0) )
            p--;
        if ( !strncmpi( p, " href=\"", 7 ) ) {
            p += 7;
            q = strchr( p, '"' );
            if ( q ) {
                char    url[BUFSIZ * 2];

                strncpy( url, p, q - p );
                url[q - p] = NUL;
                if ( url[0] == '/' ) {
                    char    buf[BUFSIZ];

                    sprintf( buf, "http://www.yahoo.co.jp%s", url );
                    strcpy( url, buf );
                }

                // Yahoo! Japan からログアウトする
                _httpGetIC( url, buffer, FALSE, TRUE );

                // クッキーを削除
                cookie[0] = NUL;
                InternetSetCookie( "http://www.yahoo.co.jp/", NULL, cookie );

                _httpGetIC( "http://www.yahoo.co.jp/", buffer, FALSE, TRUE );
                p = strstr( buffer, sjis2euc("ログイン</a>") );
                if ( !p )
                    logoutYahooJapan( buffer );
            }
        }
    }
}
Ejemplo n.º 11
0
BOOL
_loginEcNaviOnBBAuth(
        const char *username,   // (I)   ユーザ名 (Yahoo! Japan ID)
        const char *password,   // (I)   パスワード
        char       *cookie,     // (I/O) クッキー
        size_t     *cookieSize  // (I/O) クッキー文字列長
    )
{
    BOOL        ret     = FALSE;
    const char  *target = "http://buzzurl.jp/";
    char        address[MAX_WEBPAGENAME];
    char        *p;
    char        *buffer = (char *)malloc( MAX_CONTENT_SIZE * 16 );

    *cookie = NUL;
    if ( !buffer )
        return ( ret );

    // proxy 情報取得
    setConfirmProxyInfoFunc( (CONF_FUNC)(-1) );
    proxyInfoForBBAuth.useProxy         = FALSE;
    proxyInfoForBBAuth.proxyServer[0]   = NUL;
    proxyInfoForBBAuth.proxyPort        = 0;
    proxyInfoForBBAuth.proxyUserName[0] = NUL;
    proxyInfoForBBAuth.proxyPassword[0] = NUL;
    getProxyInfo( &(proxyInfoForBBAuth.useProxy),
                  proxyInfoForBBAuth.proxyServer,
                  &(proxyInfoForBBAuth.proxyPort),
                  proxyInfoForBBAuth.proxyUserName,
                  proxyInfoForBBAuth.proxyPassword );

    // 複数ユーザで同一PCを使っている場合もあり得るので、ログイン状態であれば
    // 念のためにいったんログアウトしておく
    _httpGetIC( target, buffer, FALSE, TRUE );
    p = strstr( buffer, "/config/logout" );
    if ( p ) {
        // Buzzurl からログアウトする
        _httpGetIC( "http://buzzurl.jp/config/logout", buffer, FALSE, TRUE );

        // クッキーを削除
        cookie[0] = NUL;
        InternetSetCookie( target, NULL, cookie );
    }

    // Yahoo! Japan からログアウトする
    logoutYahooJapan( buffer );

    // Buzzurl向けBBAuth開始URLを取得
    getLoginAddressOnYahooJapan( "https://buzzurl.jp/config/login?"
                                 "done=http%3A%2F%2Fbuzzurl.jp%2F",
                                 buffer, address, TRUE );

    // BBAuth 開始
    _httpGetIC( address, buffer, FALSE, TRUE );
    if ( *buffer ) {
        doYahooStep1( buffer, target, username, password,
                      cookie, cookieSize );
        if ( *cookie )
            ret = TRUE;
    }
    translateURL( NULL );
    free( buffer );

    return ( ret );
}