ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

xsltCheckRead: : the security options : an XSLT transformation context : the resource to be read

Check if the resource is allowed to be read

Return 1 if read is allowed, 0 if not and -1 in case or error.

Definition at line 433 of file security.c.

Referenced by xsltLoadDocument(), xsltLoadStyleDocument(), xsltParseStylesheetFile(), and xsltParseStylesheetImport().

                                                            {
    int ret;
    xmlURIPtr uri;
    xsltSecurityCheck check;

    uri = xmlParseURI((const char *)URL);
    if (uri == NULL) {
    xsltTransformError(ctxt, NULL, NULL,
     "xsltCheckRead: URL parsing failed for %s\n",
             URL);
    return(-1);
    }
    if ((uri->scheme == NULL) ||
    (xmlStrEqual(BAD_CAST uri->scheme, BAD_CAST "file"))) {

    /*
     * Check if we are allowed to read this file
     */
    check = xsltGetSecurityPrefs(sec, XSLT_SECPREF_READ_FILE);
    if (check != NULL) {
        ret = check(sec, ctxt, uri->path);
        if (ret == 0) {
        xsltTransformError(ctxt, NULL, NULL,
                 "Local file read for %s refused\n", URL);
        xmlFreeURI(uri);
        return(0);
        }
    }
    } else {
    /*
     * Check if we are allowed to write this network resource
     */
    check = xsltGetSecurityPrefs(sec, XSLT_SECPREF_READ_NETWORK);
    if (check != NULL) {
        ret = check(sec, ctxt, (const char *)URL);
        if (ret == 0) {
        xsltTransformError(ctxt, NULL, NULL,
                 "Network file read for %s refused\n", URL);
        xmlFreeURI(uri);
        return(0);
        }
    }
    }
    xmlFreeURI(uri);
    return(1);
}

Generated on Sun May 27 2012 04:43:37 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.