Ejemplo n.º 1
0
     $File_response = makeSoapedFailureResponse($error_message, $errorcode);
     writeTimeFile($_SESSION['idfile'] . "--Repository: File error");
     $file_input = $idfile . "-file_failure_response-" . $idfile;
     writeTmpFiles($File_response, $file_input);
     SendResponse($File_response);
     exit;
 }
 ##############################################À
 ### SALVATAGGIO DELL'ALLEGATO SU FILESYSTEM
 ##################################################################
 #### MI ASSICURO CHE URI,SIZE ED HASH NON SIANO GIA' SPECIFICATE NEL METADATA
 $mod = modifiable($ExtrinsicObject_node);
 $datetime = "CURRENT_TIMESTAMP";
 $insert_into_DOCUMENTS = "INSERT INTO DOCUMENTS (XDSDOCUMENTENTRY_UNIQUEID,DATA,URI,MIMETYPE,CRYPT) VALUES ('" . $UniqueId_valid_array[1][$o] . "'," . $datetime . ",'" . $document_URI2 . "','" . $AllegatiExtrinsicObject[2][$o] . "','" . $REP_crypt . "')";
 //writeTimeFile($idfile."--Repository: INSERT INTO DOCUMENTS".$insert_into_DOCUMENTS);
 $ris = query_execute2($insert_into_DOCUMENTS, $connessione);
 //FINO A QUA OK!!!
 $selectTOKEN = "SELECT KEY_PROG FROM DOCUMENTS WHERE XDSDOCUMENTENTRY_UNIQUEID = '" . $UniqueId_valid_array[1][$o] . "'";
 //writeTimeFile($idfile."--Repository: uniqueid".$selectTOKEN);
 //$selectTOKEN= "SELECT MAX(TOKEN_ID) AS TOKEN_ID FROM TOKEN";
 $res_token = query_select2($selectTOKEN, $connessione);
 $next_token = $res_token[0][0];
 $document_token = $www_REP_path . "getDocument.php?token=" . $next_token;
 //writeTimeFile($idfile."--Repository: document_token".$document_token);
 ###### Calcolo URI
 if ($rep_protocol == "NORMAL") {
     $Document_URI_token = $normal_protocol . $rep_host . ":" . $rep_port . $document_token;
 } else {
     if ($rep_protocol == "TLS") {
         $Document_URI_token = $tls_protocol . $rep_host . ":" . $rep_port . $document_token;
     }
Ejemplo n.º 2
0
writeTimeFile($_SESSION['idfile'] . "--Repository: Spazio disponibile: {$spaziolibero}");
if ($spaziolibero < $Storage_size && $Storage_number != 0) {
    $Storage_number++;
    $storage_directory = "./Submitted_Documents/disk-" . $Storage_number;
    if (!is_dir($storage_directory) && strpos($_SERVER['PHP_SELF'], "repository.php")) {
        $errorcode[] = "XDSRepositoryError";
        $error_message[] = "Repository disk is FULL ";
        $File_response = makeSoapedFailureResponse($error_message, $errorcode);
        writeTimeFile($_SESSION['idfile'] . "--Repository: Disk error");
        $file_input = $idfile . "-disk_failure_response-" . $idfile;
        writeTmpFiles($File_response, $file_input);
        SendResponse($File_response);
        exit;
    }
    $updateconfig = "UPDATE CONFIG SET STORAGE = {$Storage_number}";
    $updateconfig_res = query_execute2($updateconfig, $connessione);
}
if ($Storage_number == '0') {
    $relative_docs_path = "./Submitted_Documents/" . date("Y") . "/" . date("m") . "/" . date("d") . "/";
    // come sopra
    $relative_docs_path_2 = "Submitted_Documents/" . date("Y") . "/" . date("m") . "/" . date("d") . "/";
    //PER COMPORRE L'URI
} else {
    $relative_docs_path = "./Submitted_Documents/disk-" . $Storage_number . "/" . date("Y") . "/" . date("m") . "/" . date("d") . "/";
    // come sopra
    $relative_docs_path_2 = "Submitted_Documents/disk-" . $Storage_number . "/" . date("Y") . "/" . date("m") . "/" . date("d") . "/";
    //PER COMPORRE L'URI
}
$www_docs_path = $www_REP_path . $relative_docs_path_2;
//PER COMPORRE L'URI
#### LOGS
Ejemplo n.º 3
0
$registry_response = $registry_response_arr[0];
if ($save_files) {
    #### N.B. NELLA RISPOSTA DAL REGISTRY HO HEADERS + BODY
    ## 5- scrivo in locale la RISPOSTA DAL REGISTRY
    writeTmpFiles($registry_response, $idfile . "-da_registry-" . $idfile);
    //============= END OF FORWARDING AL REGISTRY del NIST ===============//
}
// Se la risposta del registry è errata cancello il documento creato nel repository
if (strpos(strtoupper($registry_response), "ERROR") || strpos(strtoupper($registry_response), "FAILURE")) {
    if ($windows > 0) {
        exec('del ' . $document_URI2 . ' /q');
    } else {
        exec('rm -f ' . $document_URI2);
    }
    $deleteDocument = "DELETE FROM DOCUMENTS WHERE KEY_PROG = {$next_token}";
    $res_delete = query_execute2($deleteDocument, $connessione);
}
#### XML RICEVUTO IN RISPOSTA DAL REGISTRY
if (preg_match('([^\\t\\n\\r\\f\\v";][:]*+ENVELOPE)', strtoupper($registry_response))) {
    writeTimeFile($idfile . "--Repository: Ho trovato SOAPENV:ENVELOPE");
    preg_match('(<([^\\t\\n\\r\\f\\v";<]+:)?(ENVELOPE))', strtoupper($registry_response), $matches_reg);
    $presoap_reg = $matches_reg[1];
    writeTimeFile($idfile . "--Repository: Ho trovato {$presoap}");
    $body = substr($registry_response, strpos(strtoupper($registry_response), "<" . $presoap_reg . "ENVELOPE"));
}
//File da scrivere!!!!!
writeTmpFiles($body, $idfile . "-body_response-" . $idfile);
header("HTTP/1.1 200 OK");
header("Content-Type: text/xml;charset=UTF-8");
header("Content-Length: " . (string) filesize($tmp_path . $idfile . "-body_response-" . $idfile));
##### PULISCO IL BUFFER DI USCITA
Ejemplo n.º 4
0
$REG_delete = query_execute2($deleteREG, $connessione);
$insertREG = "INSERT INTO REGISTRY_A (ID,HOST,PORT,PATH,ACTIVE,HTTP,SERVICE,DESCRIPTION) VALUES ('1','{$REG_host_post}','{$REG_port_post}','{$REG_path_post}','A','{$REG_http_post}','SUBMISSION','REGISTRY')";
//echo $insertREG;
$REG_insert = query_execute2($insertREG, $connessione);
$REP_host_post = $_POST['repository_host'];
$REP_port_post = $_POST['repository_port'];
$REP_http_post = $_POST['repository_http'];
$deleteREP = "DELETE FROM REPOSITORY";
$REP_delete = query_execute2($deleteREP, $connessione);
$insertREP = "INSERT INTO REPOSITORY (ID,HOST,PORT,SERVICE,ACTIVE,HTTP) VALUES ('1','{$REP_host_post}','{$REP_port_post}','SUBMISSION','A','{$REP_http_post}')";
//echo $insertREP;
$REP_insert = query_execute2($insertREP, $connessione);
$REP_www_post = $_POST['repository_www'];
$REP_log_post = $_POST['repository_log'];
$REP_cache_post = $_POST['repository_cache'];
$REP_files_post = $_POST['repository_files'];
$REP_status = $_POST['repository_status'];
$deleteREP_config = "DELETE FROM CONFIG_A";
$REP_delete_config = query_execute2($deleteREP_config, $connessione);
$insertREP_config = "INSERT INTO CONFIG_A (WWW,LOG,CACHE,FILES,STATUS) VALUES ('{$REP_www_post}','{$REP_log_post}','{$REP_cache_post}','{$REP_files_post}','{$REP_status}')";
//echo $insertREP_config;
$REP_insert_config = query_execute2($insertREP_config, $connessione);
$ATNA_status = $_POST['repository_atna_status'];
$ATNA_host = $_POST['repository_atna_host'];
$ATNA_port = $_POST['repository_atna_port'];
$deleteATNA = "DELETE FROM ATNA";
$ATNA_delete = query_execute2($deleteATNA, $connessione);
$insertATNA = "INSERT INTO ATNA (ID,HOST,PORT,ACTIVE,DESCRIPTION) VALUES ('1','{$ATNA_host}','{$ATNA_port}','{$ATNA_status}','ATNA NODE')";
//echo $insertREP;
$ATNA_insert = query_execute2($insertATNA, $connessione);
header('location: setup.php');