亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? authentication.cpp

?? funambol windows mobile plugin source code, the source code is taken from the funambol site
?? CPP
字號:
/*
 * Copyright (C) 2003-2007 Funambol, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 * 02111-1307  USA
 */


#include "syncml/core/Authentication.h"
#include "syncml/core/Constants.h"
#include "syncml/core/Cred.h"


Authentication::Authentication() {

    initialize();
}

Authentication::~Authentication() {

     if (data)      {delete [] data; data = NULL; }
     if (username)  {delete [] username; username = NULL; }
     if (password)  {delete [] password; password = NULL; }
     if (deviceId)  {delete [] deviceId; deviceId = NULL; }
     if (syncMLVerProto) {delete [] syncMLVerProto; syncMLVerProto = NULL; }
     if (principalId)    {delete [] principalId; principalId = NULL; }
     if (meta)           {delete  meta; meta = NULL; }

     encode = FALSE;

}

Authentication::Authentication(Authentication* auth) {

    initialize();
    this->data            = stringdup(auth->getData());
    this->username        = stringdup(auth->getUsername());
    this->password        = stringdup(auth->getPassword());
    this->encode          = auth->encode;
    this->deviceId        = stringdup(auth->getDeviceId());
    this->syncMLVerProto  = stringdup(auth->getSyncMLVerProto());
    this->principalId     = stringdup(auth->getPrincipalId());
    this->meta            = auth->getMeta()->clone();

}


void Authentication::initialize() {
    this->data            = NULL;
    this->username        = NULL;
    this->password        = NULL;
    this->encode          = FALSE;
    this->deviceId        = NULL ;
    this->syncMLVerProto  = NULL ;
    this->principalId     = NULL;
    this->meta            = NULL;
}


/**
 * Creates a new Authentication object with the given data
 *
 * @param meta the Meta object with authentication type and format
 * @param data the data of authentication
 *
 */
Authentication::Authentication(Meta* meta, const char* data){
    initialize();

    this->meta = meta->clone();
    createAuthentication(meta->getType(), data);

}

/**
 * Creates a new Authentication object with the given data
 *
 * @param type the authentication type
 * @param data the data of authentication
 *
 */
Authentication::Authentication(const char* type, const char* data) {
    initialize();

    createAuthentication(type, data);
}

/**
 * Creates a new Authentication object with the given data
 *
 * @param type the authentication type
 * @param data the data of authentication
 * @param encode true if data is encoded, false otherwise
 *
 */
Authentication::Authentication(const char* type,
                               const char* data,
                               BOOL encode) {


    initialize();

    this->encode = encode;
    createAuthentication(type, data);
}


/**
 * Creates a new Authentication object with the given data
 *
 * @param type the authentication type
 * @param username the username
 * @param password the password
 *
 */
Authentication::Authentication(const char* type,
                               const char* username,
                               const char* password) {


    initialize();

    if (username == NULL || password == NULL) {
           // tbd
    }

    encode = TRUE;
    char auth[DIM_512];
    sprintf(auth, "%s:%s", username, password);
    createAuthentication(type, auth);

}

void Authentication::createAuthentication(const char* type, const char* data) {

    const char* realtype;

    if (strstr(AUTH_SUPPORTED_TYPES, type) == NULL) {
        // invalid parameter? fall back to basic authentication
        realtype = AUTH_TYPE_BASIC;
    } else {
        realtype = type;
    }

    if (strcmp(realtype, AUTH_TYPE_BASIC) == 0) {
        this->setType(AUTH_TYPE_BASIC);
        this->setFormat(FORMAT_B64);
        this->setData(data);
    } else if (strcmp(realtype, AUTH_TYPE_MD5) == 0) {
        this->setType(AUTH_TYPE_MD5);
        this->setData(data);
    }
}

 /**
 * Gets the type property
 *
 * @return the type property
 */
const char* Authentication::getType() {

    if (meta == NULL) {
        return NULL;
    }
    return meta->getType();
}

/**
 * Sets the type property
 *
 * @param type the type property
 */
void Authentication::setType(const char*type) {
    if (meta == NULL) {
        meta = new Meta();
    }
    meta->setType(type);

}

/**
 * Gets the format property
 *
 * @return the format property
 */
const char* Authentication::getFormat() {
    if (meta == NULL) {
        return NULL;
    }
    return meta->getFormat();

}

/**
 * Sets the format property
 *
 * @param format the format property
 */
void Authentication::setFormat(const char*format) {
    if (meta == NULL) {
        meta = new Meta();
    }
    meta->setFormat(format);
}

/**
 * Gets the data property
 *
 * @return the data property
 */
const char* Authentication::getData() {

    return data;
}

/**
 * Sets the data property
 *
 * @param data the data property
 *
 */
void Authentication::setData(const char*data) {

    if (data == NULL) {
        // TBD
        return;
    }

    const char* type = this->getType();

    if (strcmp(type,AUTH_TYPE_BASIC) == 0) {
        char* clearData = NULL;

        if (encode) {
            unsigned long len = 0;
            len = strlen(data);
            char* tmp = stringdup(data);
            char* b64tmp2 = new char[(len/3+1)<<2];
            len = b64_encode(b64tmp2, tmp, len);
            char* b64tmp = new char[len + 1];
            memset(b64tmp, 0, len + 1);
            strncpy(b64tmp, b64tmp2, len);
            if (this->data) {
                delete [] this->data; this->data = NULL;
            }
            this->data = stringdup(b64tmp);

            clearData = new char[strlen(data) + 1];
            sprintf(clearData, data);

            if (b64tmp2) {
                delete [] b64tmp2; b64tmp2 = NULL;
            }
            if (b64tmp) {
                delete [] b64tmp; b64tmp = NULL;
            }
            if (tmp) {
                delete [] tmp; tmp = NULL;
            }

        } else {
            unsigned long len = 0;
            len = strlen(data);
            char* tmp = stringdup(data);
            char* b64tmp = new char[len];
            len = b64_decode(b64tmp, tmp);

            clearData = stringdup(b64tmp);
            if (this->data) {
                delete [] this->data; this->data = NULL;
            }
            //this->data = new char[strlen(clearData) + 1];
            //sprintf(this->data, clearData);
            this->data = stringdup(data);

            if (tmp) {
                delete [] tmp; tmp = NULL;
            }
            if (b64tmp) {
                delete [] b64tmp; b64tmp = NULL;
            }
        }

        unsigned int len = strlen(clearData);
        char* p1 = clearData;
        BOOL charFound = FALSE;
        for (unsigned int k = 0; k < len; k++) {
            if (*p1 == 0) {
                break;
            }
            else if (*p1 == ':') {
                charFound = TRUE;
                p1 = p1 + 1;
                break;
            }
            p1 = p1 + 1;
        }

        if (charFound == FALSE) {
            this->setUsername(clearData);
            this->setPassword(NULL);
        } else {
            char* p2 = p1 - 1;
            *p2 = 0;
            if (strlen(clearData) > 0 ) {
                this->setUsername(clearData);
            } else {
                this->setUsername("");
            }
            if (strlen(p1) > 0) {
                this->setPassword(p1);
            } else {
                this->setPassword("");
            }

        }
        if (clearData) { delete [] clearData; clearData = NULL; }
    }

    if (strcmp(type, AUTH_TYPE_MD5) == 0) {
        if (meta->getFormat() == NULL) {
            this->setFormat(FORMAT_B64);
        }
        this->setUsername(data);
        this->data     = stringdup(data);
    }
}


/**
* Gets username property
*
* @return the username property
*/
const char* Authentication::getUsername() {
    return username;
}

/**
* Sets the username property
*
* @param username the username property
*/
void Authentication::setUsername(const char*username) {
    if (this->username) {
        delete [] this->username; this->username = NULL;
    }
    this->username = stringdup(username);
}

/**
* Gets password property
*
* @return the password property
*/
const char* Authentication::getPassword() {
    return password;
}

/**
* Sets the password property
*
* @param password the password property
*/
void Authentication::setPassword(const char*password) {
    if (this->password) {
        delete [] this->password; this->password = NULL;
    }
    this->password = stringdup(password);
}

/* Gets the nextNonce property
 *
 * @return nextNonce the nextNonce property
 */
NextNonce* Authentication::getNextNonce() {
    if (meta == NULL) {
        return NULL;
    }
    return meta->getNextNonce();

}

/**
 * Sets the nextNonce property
 *
 * @param nextNonce the nextNonce property
 *
 */
void Authentication::setNextNonce(NextNonce* nextNonce) {
     if (meta == NULL)  {
        meta = new Meta();
     }
     meta->setNextNonce(nextNonce);
}

/**
 * Gets the meta property
 *
 * @return meta the meta property
 */
Meta* Authentication::getMeta() {
    return meta;
}

/**
 * Sets the meta property
 *
 * @param meta the meta property
 *
 */
void Authentication::setMeta(Meta* meta) {
    if (this->meta) {
		delete  this->meta; this->meta = NULL;
	}
    this->meta = meta->clone();
}

/**
 * Gets the device id
 *
 * @return deviceId the device identificator
 */
const char* Authentication::getDeviceId() {
    return deviceId;
}

/**
 * Sets the device identificator
 *
 * @param deviceId the device identificator
 */
void Authentication::setDeviceId(const char*deviceId) {
    if (this->deviceId) {
        delete [] this->deviceId; this->deviceId = NULL;
    }
    this->deviceId = stringdup(deviceId);
}

/**
 * Gets the SyncML Protocol version. It is useful to decide how calculate
 * the digest with MD5 authentication.
 *
 * @return syncMLVerProto the SyncML Protocol version.
 */
const char* Authentication::getSyncMLVerProto() {
    return syncMLVerProto;
}

/**
 * Sets the SyncML Protocol version. It is useful to decide how calculate
 * the digest with MD5 authentication.
 *
 * @param syncMLVerProto the SyncML Protocol version.
 *
 */
void Authentication::setSyncMLVerProto(const char*syncMLVerProto) {
    if (this->syncMLVerProto) {
        delete [] this->syncMLVerProto; this->syncMLVerProto = NULL;
    }
    this->syncMLVerProto = stringdup(syncMLVerProto);
}

/**
 * Gets the principal id
 *
 * @return principalId the principal identificator
 */
const char* Authentication::getPrincipalId() {
    return principalId;
}
/**
 * Sets the principal identificator
 *
 * @param principalId the principal identificator
 */
void Authentication::setPrincipalId(const char*principalId) {
     if (this->principalId) {
        delete [] this->principalId; this->principalId = NULL;
    }
    this->principalId = stringdup(principalId);
}


Authentication* Authentication::clone() {

    Authentication* ret = new Authentication(this);
    return ret;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产69精品久久久久毛片| 3d成人h动漫网站入口| 欧美日韩中文一区| 久久综合九色综合97_久久久| 国产精品看片你懂得| 免费av网站大全久久| 色婷婷亚洲精品| 国产偷国产偷精品高清尤物| 午夜精品福利久久久| aaa欧美大片| 久久亚洲二区三区| 亚洲成人在线免费| 色婷婷国产精品| 中文字幕第一区综合| 另类综合日韩欧美亚洲| 色综合久久中文综合久久97| 国产精品国产精品国产专区不片 | 国内成+人亚洲+欧美+综合在线| 色综合婷婷久久| 国产精品久久久久一区| 精品制服美女丁香| 91精品国产综合久久婷婷香蕉| 亚洲欧美一区二区三区孕妇| 大美女一区二区三区| 欧美精品一区二区三区视频| 日韩av中文字幕一区二区三区| 色悠悠亚洲一区二区| **性色生活片久久毛片| 国产69精品久久久久毛片| 久久综合九色综合久久久精品综合| 午夜激情综合网| 欧美日韩在线播放三区| 亚洲一区免费观看| 欧美性猛片xxxx免费看久爱| 一区二区三区不卡视频| 欧美日韩一区久久| 肉肉av福利一精品导航| 91精品国产一区二区人妖| 日韩专区中文字幕一区二区| 91精品国产综合久久久久久久久久| 亚洲电影欧美电影有声小说| 欧美日韩国产在线播放网站| 日韩国产精品91| 日韩一区二区三区av| 久久99国产精品久久99果冻传媒| 制服丝袜激情欧洲亚洲| 麻豆成人在线观看| 久久久av毛片精品| 成人黄色小视频在线观看| 1000部国产精品成人观看| 99久久综合国产精品| 亚洲人成亚洲人成在线观看图片| 在线亚洲一区二区| 日日夜夜精品视频天天综合网| 欧美一级爆毛片| 国产一区二区三区日韩| 国产精品家庭影院| 欧美日韩高清一区| 国产酒店精品激情| 亚洲日本护士毛茸茸| 欧洲精品中文字幕| 理论片日本一区| 国产精品天天摸av网| 欧美亚洲综合色| 国产毛片精品一区| 一区二区三区免费观看| 日韩精品资源二区在线| 9i看片成人免费高清| 日韩电影在线观看网站| 国产日韩一级二级三级| 色偷偷成人一区二区三区91| 裸体在线国模精品偷拍| 136国产福利精品导航| 日韩欧美一区电影| 91亚洲资源网| 久久成人麻豆午夜电影| 亚洲人成网站色在线观看| 欧美va天堂va视频va在线| 在线中文字幕一区二区| 国产乱子轮精品视频| 婷婷国产v国产偷v亚洲高清| 国产精品久线在线观看| 日韩视频中午一区| 91国偷自产一区二区开放时间 | 亚洲人成电影网站色mp4| 制服.丝袜.亚洲.另类.中文 | 国产清纯美女被跳蛋高潮一区二区久久w| 成人一区二区三区视频在线观看 | 国产精品网站在线观看| 日韩欧美国产精品一区| 在线观看不卡一区| 成人黄色a**站在线观看| 午夜免费久久看| 亚洲日本护士毛茸茸| 国产亚洲精品久| 精品国产乱码久久久久久蜜臀| 欧美性大战久久久久久久蜜臀| 粉嫩aⅴ一区二区三区四区五区| 美国毛片一区二区| 亚洲成人av中文| 亚洲欧美偷拍另类a∨色屁股| 久久这里只精品最新地址| 51久久夜色精品国产麻豆| 欧美在线|欧美| 91亚洲精品久久久蜜桃网站| 丁香桃色午夜亚洲一区二区三区| 蜜臀av在线播放一区二区三区| 亚洲成人在线网站| 亚洲成av人片一区二区梦乃| 一区二区三区免费网站| 亚洲欧洲av一区二区三区久久| 久久精品一二三| 久久一区二区三区四区| 欧美精品一区二区三区蜜桃| 日韩欧美另类在线| 日韩三级视频中文字幕| 日韩欧美国产一二三区| 欧美v国产在线一区二区三区| 日韩一区二区电影在线| 日韩一区二区在线观看| 日韩午夜在线观看| 欧美变态tickling挠脚心| 久久天堂av综合合色蜜桃网| 日韩欧美国产午夜精品| 久久久亚洲午夜电影| 久久五月婷婷丁香社区| 久久久久久久久久久久久女国产乱 | 国产麻豆成人精品| 国产精品18久久久| 成人精品免费看| 99精品视频在线观看| 色综合欧美在线视频区| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 91麻豆免费视频| 欧美性videosxxxxx| 在线成人av网站| 日韩午夜av一区| 久久先锋影音av| 亚洲欧美韩国综合色| 亚洲成人精品影院| 精品中文字幕一区二区小辣椒 | 日本怡春院一区二区| 韩国精品一区二区| 99久久精品免费看| 在线视频一区二区免费| 日韩一区国产二区欧美三区| 国产日韩欧美一区二区三区乱码 | 日韩不卡一区二区三区 | 美女爽到高潮91| 国产91在线观看丝袜| 欧美丝袜丝nylons| 久久久激情视频| 亚洲国产色一区| 国产精品一卡二| 欧美三片在线视频观看| 久久精品夜色噜噜亚洲a∨| 一区二区三区精品视频在线| 狠狠v欧美v日韩v亚洲ⅴ| av在线不卡电影| 精品国产伦一区二区三区免费| 亚洲成av人片一区二区梦乃| 国产美女精品在线| 欧美视频自拍偷拍| 中文字幕乱码日本亚洲一区二区 | 亚洲同性同志一二三专区| 亚洲午夜电影网| 国产馆精品极品| 欧美日产在线观看| 亚洲欧美一区二区三区极速播放| 久久成人久久鬼色| 欧亚一区二区三区| 中文字幕国产精品一区二区| 日韩高清一区在线| 色婷婷综合激情| 国产精品午夜电影| 狠狠色丁香九九婷婷综合五月| 欧美日韩卡一卡二| 1024精品合集| 成人18视频在线播放| 国产性天天综合网| 久久疯狂做爰流白浆xx| 欧美日本国产视频| 亚洲一区二区三区精品在线| 91在线播放网址| 国产目拍亚洲精品99久久精品| 玖玖九九国产精品| 7777精品伊人久久久大香线蕉最新版 | 欧美精选午夜久久久乱码6080| 国产欧美日本一区二区三区| 美女性感视频久久| 337p亚洲精品色噜噜狠狠| 亚洲成人黄色影院| 色婷婷狠狠综合| 亚洲精品高清视频在线观看| 成人av午夜电影| 中文字幕亚洲不卡| 91丝袜高跟美女视频| 一区二区三区不卡视频| 一本到不卡精品视频在线观看 | 91在线免费看|