Exemple #1
0
SmlPcdataPtr_t create_chal_meta(dmclt_authType_t type,
                                buffer_t * nonceP)
{
    SmlMetInfMetInfPtr_t metInfP;
    SmlPcdataPtr_t metaP;

    metInfP = smlAllocMetInfMetInf();
    if (!metInfP) return NULL;

    metInfP->type = smlString2Pcdata(auth_type_as_string(type));
    metInfP->format = smlString2Pcdata("b64");
    if (nonceP)
    {
        char * tmp = encode_b64(*nonceP);
        metInfP->nextnonce = smlString2Pcdata(tmp);
        free(tmp);
    }

    metaP = smlAllocPcdata();
    if (!metaP)
    {
        smlFreeMetinfMetinf(metInfP);
        return NULL;
    }
    metaP->contentType = SML_PCDATA_EXTENSION;
    metaP->extension = SML_EXT_METINF;
    metaP->length = 0;
    metaP->content = metInfP;

    return metaP;
 }
Exemple #2
0
SmlPcdataPtr_t convert_to_meta(char * format,
                               char * type)
{
    SmlPcdataPtr_t metaP = NULL;
    SmlMetInfMetInfPtr_t metInfP;

    if (format == NULL && type == NULL)
    {
        return NULL;
    }

    metInfP = smlAllocMetInfMetInf();
    if (!metInfP) return NULL;

    if (type) metInfP->type = smlString2Pcdata(type);
    if (format) metInfP->format = smlString2Pcdata(format);

    metaP = smlAllocPcdata();
    if (!metaP)
    {
        smlFreeMetinfMetinf(metInfP);
        return NULL;
    }
    metaP->contentType = SML_PCDATA_EXTENSION;
    metaP->extension = SML_EXT_METINF;
    metaP->length = 0;
    metaP->content = metInfP;

    return metaP;
}
static SmlSyncHdrPtr_t prvGetHeader(internals_t * internP)
{
    SmlSyncHdrPtr_t headerP;

    headerP = smlAllocSyncHdr();
    if (headerP)
    {
        set_pcdata_string(headerP->version, "1.2");
        set_pcdata_string(headerP->proto, "DM/1.2");
        set_pcdata_hex(headerP->sessionID, internP->session_id);
        set_pcdata_int(headerP->msgID, internP->message_id);
        set_pcdata_int(headerP->msgID, internP->message_id);
        set_pcdata_string(headerP->target->locURI, internP->account->server_uri);
        set_pcdata_string(headerP->source->locURI, internP->account->id);
        if (OMADM_SYNCML_ERROR_AUTHENTICATION_ACCEPTED != internP->clt_auth)
        {
            headerP->cred = get_credentials(internP->account->toServerCred);
        }
        headerP->meta = smlAllocPcdata();
        if (headerP->meta)
        {
            SmlMetInfMetInfPtr_t metInfP;

            metInfP = smlAllocMetInfMetInf();
            if (metInfP)
            {
                metInfP->maxmsgsize = smlString2Pcdata(PRV_MAX_MESSAGE_SIZE);
                headerP->meta->contentType = SML_PCDATA_EXTENSION;
                headerP->meta->extension = SML_EXT_METINF;
                headerP->meta->length = 0;
                headerP->meta->content = metInfP;
            }
            else
            {
                smlFreePcdata(headerP->meta);
                headerP->meta = NULL;
            }
        }

    }

    return headerP;
}