Exemplo n.º 1
0
S3Status S3_convert_acl(char *aclXml, char *ownerId, char *ownerDisplayName,
                        int *aclGrantCountReturn, S3AclGrant *aclGrants)
{
    ConvertAclData data;

    data.ownerId = ownerId;
    data.ownerIdLen = 0;
    data.ownerId[0] = 0;
    data.ownerDisplayName = ownerDisplayName;
    data.ownerDisplayNameLen = 0;
    data.ownerDisplayName[0] = 0;
    data.aclGrantCountReturn = aclGrantCountReturn;
    data.aclGrants = aclGrants;
    *aclGrantCountReturn = 0;
    string_buffer_initialize(data.emailAddress);
    string_buffer_initialize(data.userId);
    string_buffer_initialize(data.userDisplayName);
    string_buffer_initialize(data.groupUri);
    string_buffer_initialize(data.permission);

    // Use a simplexml parser
    SimpleXml simpleXml;
    simplexml_initialize(&simpleXml, &convertAclXmlCallback, &data);

    S3Status status = simplexml_add(&simpleXml, aclXml, strlen(aclXml));

    simplexml_deinitialize(&simpleXml);
                                          
    return status;
}
Exemplo n.º 2
0
static S3Status convert_bls(char *blsXml, char *targetBucketReturn,
                            char *targetPrefixReturn, int *aclGrantCountReturn,
                            S3AclGrant *aclGrants)
{
    ConvertBlsData data;

    data.targetBucketReturn = targetBucketReturn;
    data.targetBucketReturn[0] = 0;
    data.targetBucketReturnLen = 0;
    data.targetPrefixReturn = targetPrefixReturn;
    data.targetPrefixReturn[0] = 0;
    data.targetPrefixReturnLen = 0;
    data.aclGrantCountReturn = aclGrantCountReturn;
    data.aclGrants = aclGrants;
    *aclGrantCountReturn = 0;
    string_buffer_initialize(data.emailAddress);
    string_buffer_initialize(data.userId);
    string_buffer_initialize(data.userDisplayName);
    string_buffer_initialize(data.groupUri);
    string_buffer_initialize(data.permission);

    // Use a simplexml parser
    SimpleXml simpleXml;
    simplexml_initialize(&simpleXml, &convertBlsXmlCallback, &data);

    S3Status status = simplexml_add(&simpleXml, blsXml, strlen(blsXml));

    simplexml_deinitialize(&simpleXml);
                                          
    return status;
}
Exemplo n.º 3
0
Arquivo: service.c Projeto: wido/libs3
static void completeCallback(S3Status requestStatus,
                             const S3ErrorDetails *s3ErrorDetails,
                             void *callbackData)
{
    XmlCallbackData *cbData = (XmlCallbackData *) callbackData;

    (*(cbData->responseCompleteCallback))
        (requestStatus, s3ErrorDetails, cbData->callbackData);

    simplexml_deinitialize(&(cbData->simpleXml));

    free(cbData);
}
Exemplo n.º 4
0
static void commitMultipartCompleteCallback
    (S3Status requestStatus, const S3ErrorDetails *s3ErrorDetails, 
     void *callbackData) 
{
    CommitMultiPartData *data = (CommitMultiPartData*) callbackData;
    if (data->handler->responseHandler.completeCallback) {
        (*(data->handler->responseHandler.completeCallback))
            (requestStatus, s3ErrorDetails, data->userdata);
    }
    if (data->handler->responseXmlCallback) {
        (*data->handler->responseXmlCallback)(data->location, data->etag,
                                              data->userdata);
    }
    simplexml_deinitialize(&(data->simplexml));
    free(data);
}
Exemplo n.º 5
0
static void testBucketCompleteCallback(S3Status requestStatus, 
                                       const S3ErrorDetails *s3ErrorDetails,
                                       void *callbackData)
{
    TestBucketData *tbData = (TestBucketData *) callbackData;

    // Copy the location constraint into the return buffer
    snprintf(tbData->locationConstraintReturn, 
             tbData->locationConstraintReturnSize, "%s", 
             tbData->locationConstraint);

    (*(tbData->responseCompleteCallback))
        (requestStatus, s3ErrorDetails, tbData->callbackData);

    simplexml_deinitialize(&(tbData->simpleXml));

    free(tbData);
}
Exemplo n.º 6
0
static void listBucketCompleteCallback(S3Status requestStatus, 
                                       const S3ErrorDetails *s3ErrorDetails,
                                       void *callbackData)
{
    ListBucketData *lbData = (ListBucketData *) callbackData;

    // Make the callback if there is anything
    if (lbData->contentsCount || lbData->commonPrefixesCount) {
        make_list_bucket_callback(lbData);
    }

    (*(lbData->responseCompleteCallback))
        (requestStatus, s3ErrorDetails, lbData->callbackData);

    simplexml_deinitialize(&(lbData->simpleXml));

    free(lbData);
}
Exemplo n.º 7
0
static void listPartsCompleteCallback(S3Status requestStatus, 
                                      const S3ErrorDetails *s3ErrorDetails,
                                      void *callbackData)
{
    ListPartsData *lpData = (ListPartsData *) callbackData;

    // Make the callback if there is anything
    if (lpData->partsCount) {
        make_list_parts_callback(lpData);
    }

    (*(lpData->responseCompleteCallback))
        (requestStatus, s3ErrorDetails, lpData->callbackData);

    simplexml_deinitialize(&(lpData->simpleXml));

    free(lpData);
}
Exemplo n.º 8
0
static void InitialMultipartCompleteCallback
    (S3Status requestStatus, const S3ErrorDetails *s3ErrorDetails,
     void *callbackData) 
{
    InitialMultipartData *mdata = (InitialMultipartData *) callbackData;

    if (mdata->handler->responseHandler.completeCallback) {
        (*mdata->handler->responseHandler.completeCallback)
            (requestStatus, s3ErrorDetails, mdata->userdata);
    }

    if (mdata->handler->responseXmlCallback) {
        (*mdata->handler->responseXmlCallback)
            (mdata->upload_id, mdata->userdata);
    }    

    simplexml_deinitialize(&(mdata->simpleXml));
    free(mdata);
}    
Exemplo n.º 9
0
static void copyObjectCompleteCallback(S3Status requestStatus,
                                       const S3ErrorDetails *s3ErrorDetails,
                                       void *callbackData)
{
    CopyObjectData *coData = (CopyObjectData *) callbackData;

    if (coData->lastModifiedReturn) {
        time_t lastModified = -1;
        if (coData->lastModifiedLen) {
            lastModified = parseIso8601Time(coData->lastModified);
        }

        *(coData->lastModifiedReturn) = lastModified;
    }

    (*(coData->responseCompleteCallback))
    (requestStatus, s3ErrorDetails, coData->callbackData);

    simplexml_deinitialize(&(coData->simpleXml));

    free(coData);
}