Changeset 938


Ignore:
Timestamp:
2012-06-28T12:17:58+02:00 (3 years ago)
Author:
moo
Message:

finished sandbox rewrite

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/disassembler.c

    r937 r938  
    3333    ALLOC_INIT_ZVAL(list);
    3434    array_init(list);
    35     for (b = xc_sandbox_user_function_begin(); b; b = b->pListNext) {
     35    for (b = xc_sandbox_user_function_begin(TSRMLS_C); b; b = b->pListNext) {
    3636        int keysize, keyLength;
    3737
     
    6969    ALLOC_INIT_ZVAL(list);
    7070    array_init(list);
    71     for (b = xc_sandbox_user_class_begin(); b; b = b->pListNext) {
     71    for (b = xc_sandbox_user_class_begin(TSRMLS_C); b; b = b->pListNext) {
    7272        int keysize, keyLength;
    7373
  • trunk/utils.c

    r937 r938  
    765765#endif
    766766
    767 xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, ZEND_24(NOTHING, const) char *filename TSRMLS_DC) /* {{{ */
     767static xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, ZEND_24(NOTHING, const) char *filename TSRMLS_DC) /* {{{ */
    768768{
    769769    HashTable *h;
     
    930930}
    931931/* }}} */
    932 void xc_sandbox_free(xc_sandbox_t *sandbox, zend_op_array *op_array TSRMLS_DC) /* {{{ */
     932static void xc_sandbox_free(xc_sandbox_t *sandbox, zend_op_array *op_array TSRMLS_DC) /* {{{ */
    933933{
    934934    XG(sandbox) = NULL;
     
    998998}
    999999/* }}} */
    1000 const Bucket *xc_sandbox_user_function_begin() /* {{{ */
     1000zend_op_array *xc_sandbox(xc_sandboxed_func_t sandboxed_func, void *data, ZEND_24(NOTHING, const) char *filename TSRMLS_DC) /* {{{ */
     1001{
     1002    xc_sandbox_t sandbox;
     1003    zend_op_array *op_array = NULL;
     1004    zend_bool catched = 0;
     1005
     1006    memset(&sandbox, 0, sizeof(sandbox));
     1007    zend_try {
     1008        xc_sandbox_init(&sandbox, filename TSRMLS_CC);
     1009        op_array = sandboxed_func(data TSRMLS_CC);
     1010    } zend_catch {
     1011        catched = 1;
     1012    } zend_end_try();
     1013
     1014    xc_sandbox_free(&sandbox, op_array TSRMLS_CC);
     1015    if (catched) {
     1016        zend_bailout();
     1017    }
     1018    return op_array;
     1019}
     1020/* {{{ */
     1021const Bucket *xc_sandbox_user_function_begin(TSRMLS_D) /* {{{ */
    10011022{
    10021023    xc_sandbox_t *sandbox = (xc_sandbox_t *) XG(sandbox);
    10031024    assert(sandbox);
    10041025    return TG(internal_function_tail) ? TG(internal_function_tail)->pListNext : TG(function_table).pListHead;
    1005 } /* {{{ */
    1006 const Bucket *xc_sandbox_user_class_begin() /* {{{ */
     1026}
     1027/* {{{ */
     1028const Bucket *xc_sandbox_user_class_begin(TSRMLS_D) /* {{{ */
    10071029{
    10081030    xc_sandbox_t *sandbox = (xc_sandbox_t *) XG(sandbox);
    10091031    assert(sandbox);
    10101032    return TG(internal_class_tail) ? TG(internal_class_tail)->pListNext : TG(class_table).pListHead;
    1011 } /* {{{ */
     1033}
     1034/* {{{ */
    10121035#ifdef XCACHE_ERROR_CACHING
    1013 xc_compilererror_t *xc_sandbox_compilererrors() /* {{{ */
     1036xc_compilererror_t *xc_sandbox_compilererrors(TSRMLS_D) /* {{{ */
    10141037{
    10151038    xc_sandbox_t *sandbox = (xc_sandbox_t *) XG(sandbox);
    10161039    assert(sandbox);
    10171040    return sandbox->compilererrors;
    1018 } /* }}} */
    1019 zend_uint xc_sandbox_compilererror_cnt() /* {{{ */
     1041}
     1042/* }}} */
     1043zend_uint xc_sandbox_compilererror_cnt(TSRMLS_D) /* {{{ */
    10201044{
    10211045    xc_sandbox_t *sandbox = (xc_sandbox_t *) XG(sandbox);
    10221046    assert(sandbox);
    10231047    return sandbox->compilererror_cnt;
    1024 } /* }}} */
    1025 #endif
    1026 
     1048}
     1049/* }}} */
     1050#endif
    10271051
    10281052int xc_vtrace(const char *fmt, va_list args) /* {{{ */
  • trunk/utils.h

    r937 r938  
    8383typedef zend_op_array *(*xc_sandboxed_func_t)(void *data TSRMLS_DC);
    8484zend_op_array *xc_sandbox(xc_sandboxed_func_t sandboxed_func, void *data, ZEND_24(NOTHING, const) char *filename TSRMLS_DC);
    85 const Bucket *xc_sandbox_user_function_begin();
    86 const Bucket *xc_sandbox_user_class_begin();
    87 zend_uint xc_sandbox_compilererror_cnt();
     85const Bucket *xc_sandbox_user_function_begin(TSRMLS_D);
     86const Bucket *xc_sandbox_user_class_begin(TSRMLS_D);
     87zend_uint xc_sandbox_compilererror_cnt(TSRMLS_D);
    8888#ifdef XCACHE_ERROR_CACHING
    89 xc_compilererror_t *xc_sandbox_compilererrors();
    90 zend_uint xc_sandbox_compilererror_cnt();
     89xc_compilererror_t *xc_sandbox_compilererrors(TSRMLS_D);
     90zend_uint xc_sandbox_compilererror_cnt(TSRMLS_D);
    9191#endif
    9292
  • trunk/xcache.c

    r937 r938  
    18101810    /* }}} */
    18111811#ifdef XCACHE_ERROR_CACHING
    1812     compiler->new_php.compilererrors = xc_sandbox_compilererrors();
    1813     compiler->new_php.compilererror_cnt = xc_sandbox_compilererror_cnt();
     1812    compiler->new_php.compilererrors = xc_sandbox_compilererrors(TSRMLS_C);
     1813    compiler->new_php.compilererror_cnt = xc_sandbox_compilererror_cnt(TSRMLS_C);
    18141814#endif
    18151815#ifndef ZEND_COMPILE_DELAYED_BINDING
Note: See TracChangeset for help on using the changeset viewer.