Sprout from master 2005-10-15 13:08:00 UTC Aleš Křenek <ljocha@ics.muni.cz> 'version pushed to 1.0.0 for release'
Cherrypick from glite-lb-client_branch_2_1_0_2_pre_cares 2006-08-14 14:19:02 UTC Aleš Křenek <ljocha@ics.muni.cz> 'push version':
org.glite.lb.client/Makefile
org.glite.lb.client/examples/export.sh
org.glite.lb.client/examples/flood_proxy.c
org.glite.lb.client/examples/gen_begin
org.glite.lb.client/examples/job_reg.c
org.glite.lb.client/examples/lbmon-db.c
org.glite.lb.client/examples/lbmon.c
org.glite.lb.client/examples/resubmission.l
org.glite.lb.client/examples/shallow_and_full_resub.l
org.glite.lb.client/examples/shallow_resub_complex.l
org.glite.lb.client/examples/shallow_resub_simple.l
org.glite.lb.client/examples/shallow_resub_simple2.l
org.glite.lb.client/examples/stresslog.c
org.glite.lb.client/project/build.number
org.glite.lb.client/project/configure.properties.xml
org.glite.lb.client/project/version.properties
org.glite.lb.client/src/connection.c
org.glite.lb.client/src/connection.h
org.glite.lb.client/src/lb_dump_exporter.c
org.glite.lb.client/src/logevent.c.T
org.glite.lb.client/src/notification.c
org.glite.lb.client/src/prod_proto.c
org.glite.lb.client/src/producer.c
org.glite.lb.client/test/producer_test.cpp
Cherrypick from glite-lb-server_branch_1_3_0_2_pre_cares 2006-08-14 14:48:41 UTC Daniel Kouřil <kouril@ics.muni.cz> 'Use edg_wll_NotifIdDup() to copy the whole notification structure. Fixes bug':
org.glite.lb.server/Makefile
org.glite.lb.server/config/startup
org.glite.lb.server/project/build.number
org.glite.lb.server/project/configure.properties.xml
org.glite.lb.server/project/version.properties
org.glite.lb.server/src/bkserverd.c
org.glite.lb.server/src/db_store.c
org.glite.lb.server/src/il_lbproxy.c
org.glite.lb.server/src/il_notification.c
org.glite.lb.server/src/jobstat.h
org.glite.lb.server/src/jobstat_supp.c
org.glite.lb.server/src/lbs_db.c
org.glite.lb.server/src/process_event.c
org.glite.lb.server/src/query.c
org.glite.lb.server/src/request.c
org.glite.lb.server/src/store.c.T
org.glite.lb.server/src/stored_master.c
Cherrypick from glite-lb-common_branch_3_0_0_2_pre_cares 2006-08-14 14:46:53 UTC Daniel Kouřil <kouril@ics.muni.cz> 'Added new call edg_wll_NotifIdDup()':
org.glite.lb.common/Makefile
org.glite.lb.common/interface/context-int.h
org.glite.lb.common/project/build.number
org.glite.lb.common/project/version.properties
org.glite.lb.common/src/context.c
org.glite.lb.common/src/il_msg.c
org.glite.lb.common/src/lb_plain_io.c
org.glite.lb.common/src/log_msg.c
org.glite.lb.common/src/mini_http.c
org.glite.lb.common/src/notifid.c
org.glite.lb.common/src/ulm_parse.c
Cherrypick from glite-lb-proxy_branch_1_2_0_2_pre_cares 2006-05-18 11:54:06 UTC Aleš Křenek <ljocha@ics.muni.cz> 'push version':
org.glite.lb.proxy/Makefile
org.glite.lb.proxy/config/startup
org.glite.lb.proxy/project/build.number
org.glite.lb.proxy/project/version.properties
org.glite.lb.proxy/src/lbproxy.c
Cherrypick from glite-lb_branch_1_2_0_3_pre_cares 2006-08-14 14:23:19 UTC Aleš Křenek <ljocha@ics.muni.cz> 'restore branch':
org.glite.lb/build.xml
org.glite.lb/project/build.number
org.glite.lb/project/dependencies.properties
org.glite.lb/project/glite.lb.csf.xml
org.glite.lb/project/version.properties
Cherrypick from glite-security-gsoap-plugin_branch_1_2_1_pre_cares 2006-07-17 07:39:49 UTC Aleš Křenek <ljocha@ics.muni.cz> 'push version':
org.glite.security.gsoap-plugin/Makefile
org.glite.security.gsoap-plugin/project/build.number
org.glite.security.gsoap-plugin/project/version.properties
org.glite.security.gsoap-plugin/src/glite_gsplugin.c
org.glite.security.gsoap-plugin/src/glite_gss.c
Cherrypick from glite-lb-client-interface_branch_2_1_0_2_pre_cares 2006-08-14 14:46:54 UTC Daniel Kouřil <kouril@ics.muni.cz> 'Added new call edg_wll_NotifIdDup()':
org.glite.lb.client-interface/interface/context.h
org.glite.lb.client-interface/interface/notifid.h
org.glite.lb.client-interface/project/build.number
org.glite.lb.client-interface/project/version.properties
Cherrypick from glite-lb-logger_branch_1_2_0_2_pre_cares 2006-03-17 03:51:08 UTC Master Builder <glbuilder@cern.ch> 'Incremented build number [GLBUILDER]':
org.glite.lb.logger/Makefile
org.glite.lb.logger/project/build.number
org.glite.lb.logger/project/version.properties
org.glite.lb.logger/src/send_event.c
Cherrypick from glite-lb-server-bones_branch_2_1_0_2_pre_cares 2006-05-18 11:47:54 UTC Aleš Křenek <ljocha@ics.muni.cz> 'push version':
org.glite.lb.server-bones/examples/cnt_example.c
org.glite.lb.server-bones/project/build.number
org.glite.lb.server-bones/project/version.properties
org.glite.lb.server-bones/src/srvbones.c
Cherrypick from glite-lb-utils_branch_1_0_0_1_pre_cares 2006-03-17 03:55:39 UTC Master Builder <glbuilder@cern.ch> 'Incremented build number [GLBUILDER]':
org.glite.lb.utils/project/build.number
Cherrypick from glite-lb-ws-interface_branch_2_1_0_2_pre_cares 2006-03-17 03:49:27 UTC Master Builder <glbuilder@cern.ch> 'Incremented build number [GLBUILDER]':
org.glite.lb.ws-interface/project/build.number
Cherrypick from glite-lb-ws-interface_branch_3_0_0_RC15 2005-10-18 15:35:44 UTC Aleš Křenek <ljocha@ics.muni.cz> 'pull back incorrectly increased version number':
org.glite.lb.ws-interface/project/version.properties
Cherrypick from glite-security-gsoap-plugin_branch_1_2_0 2005-10-18 07:16:35 UTC Aleš Křenek <ljocha@ics.muni.cz> 'use gsoap 2.7.6b too':
org.glite.security.gsoap-plugin/build.xml
Delete:
org.glite.deployment.lb/.cvsignore
org.glite.deployment.lb/CHANGELOG
org.glite.deployment.lb/LICENSE
org.glite.deployment.lb/build.xml
org.glite.deployment.lb/config/scripts/glite-lb-config.py
org.glite.deployment.lb/config/scripts/remove_all_rpms.sh
org.glite.deployment.lb/config/templates/glite-lb.cfg.xml
org.glite.deployment.lb/doc/release_notes/release_notes.doc
org.glite.deployment.lb/doc/release_notes/release_notes.html
org.glite.deployment.lb/doc/release_notes/release_notes.pdf
org.glite.deployment.lb/project/.cvsignore
org.glite.deployment.lb/project/build.number
org.glite.deployment.lb/project/build.properties
org.glite.deployment.lb/project/glite-lb.sdf.xml.template
org.glite.deployment.lb/project/lxscript-rpm.xsl
org.glite.deployment.lb/project/lxscript-tgz.xsl
org.glite.deployment.lb/project/properties.xml
org.glite.deployment.lb/project/quattor-template.xsl
org.glite.deployment.lb/project/version.properties
org.glite.jp.client/.cvsignore
org.glite.jp.client/Makefile
org.glite.jp.client/build.xml
org.glite.jp.client/doc/README.jpimporter
org.glite.jp.client/examples/jpps_upload_files.c
org.glite.jp.client/interface/jp_client.h
org.glite.jp.client/interface/jpcl_ctx_int.h
org.glite.jp.client/interface/jpimporter.h
org.glite.jp.client/project/build.number
org.glite.jp.client/project/build.properties
org.glite.jp.client/project/configure.properties.xml
org.glite.jp.client/project/properties.xml
org.glite.jp.client/project/tar_exclude
org.glite.jp.client/project/version.properties
org.glite.jp.client/src/jpcl_ctx.c
org.glite.jp.client/src/jpimp_lib.c
org.glite.jp.client/src/jpimporter.c
org.glite.jp.client/src/jptype_map.h
org.glite.jp.client/src/typemap.dat
org.glite.jp.common/.cvsignore
org.glite.jp.common/Makefile
org.glite.jp.common/build.xml
org.glite.jp.common/interface/attr.h
org.glite.jp.common/interface/context.h
org.glite.jp.common/interface/escape.h
org.glite.jp.common/interface/known_attr.h
org.glite.jp.common/interface/strmd5.h
org.glite.jp.common/interface/trio.h
org.glite.jp.common/interface/type_plugin.h
org.glite.jp.common/interface/types.h
org.glite.jp.common/project/build.number
org.glite.jp.common/project/build.properties
org.glite.jp.common/project/configure.properties.xml
org.glite.jp.common/project/properties.xml
org.glite.jp.common/project/tar_exclude
org.glite.jp.common/project/version.properties
org.glite.jp.common/src/attr.c
org.glite.jp.common/src/context.c
org.glite.jp.common/src/escape.c
org.glite.jp.common/src/stdtypes.c
org.glite.jp.common/src/strio.c
org.glite.jp.common/src/strio.h
org.glite.jp.common/src/strmd5.c
org.glite.jp.common/src/trio.c
org.glite.jp.common/src/triop.h
org.glite.jp.index/.cvsignore
org.glite.jp.index/Makefile
org.glite.jp.index/build.xml
org.glite.jp.index/config/dbsetup.sh
org.glite.jp.index/config/glite-jp-index-dbsetup.sql
org.glite.jp.index/config/startup
org.glite.jp.index/doc/README
org.glite.jp.index/examples/jpis-db-internal.c
org.glite.jp.index/examples/jpis-test.c
org.glite.jp.index/project/build.number
org.glite.jp.index/project/build.properties
org.glite.jp.index/project/configure.properties.xml
org.glite.jp.index/project/properties.xml
org.glite.jp.index/project/tar_exclude
org.glite.jp.index/project/version.properties
org.glite.jp.index/src/bones_server.c
org.glite.jp.index/src/conf.c
org.glite.jp.index/src/conf.h
org.glite.jp.index/src/context.c
org.glite.jp.index/src/context.h
org.glite.jp.index/src/db_ops.c
org.glite.jp.index/src/db_ops.h
org.glite.jp.index/src/simple_server.c
org.glite.jp.index/src/soap_ops.c
org.glite.jp.index/src/soap_ps_calls.c
org.glite.jp.index/src/soap_ps_calls.h
org.glite.jp.index/src/typemap.dat
org.glite.jp.index/src/ws_is_typeref.c
org.glite.jp.index/src/ws_is_typeref.h
org.glite.jp.index/src/ws_ps_typeref.c
org.glite.jp.index/src/ws_ps_typeref.h
org.glite.jp.index/src/ws_typemap.h
org.glite.jp.primary/.cvsignore
org.glite.jp.primary/Makefile
org.glite.jp.primary/build.xml
org.glite.jp.primary/config/glite-jp-primary-dbsetup.sql
org.glite.jp.primary/config/startup
org.glite.jp.primary/examples/README.test
org.glite.jp.primary/examples/jpps-test.c
org.glite.jp.primary/interface/file_plugin.h
org.glite.jp.primary/project/build.number
org.glite.jp.primary/project/build.properties
org.glite.jp.primary/project/configure.properties.xml
org.glite.jp.primary/project/properties.xml
org.glite.jp.primary/project/tar_exclude
org.glite.jp.primary/project/version.properties
org.glite.jp.primary/src/attrs.c
org.glite.jp.primary/src/attrs.h
org.glite.jp.primary/src/authz.c
org.glite.jp.primary/src/authz.h
org.glite.jp.primary/src/backend.h
org.glite.jp.primary/src/bones_server.c
org.glite.jp.primary/src/builtin_plugins.h
org.glite.jp.primary/src/db.h
org.glite.jp.primary/src/feed.c
org.glite.jp.primary/src/feed.h
org.glite.jp.primary/src/file_plugin.c
org.glite.jp.primary/src/ftp_backend.c
org.glite.jp.primary/src/ftpd_auth.c
org.glite.jp.primary/src/is_client.c
org.glite.jp.primary/src/is_client.h
org.glite.jp.primary/src/jptype_map.h
org.glite.jp.primary/src/mysql.c
org.glite.jp.primary/src/new_ftp_backend.c
org.glite.jp.primary/src/simple_server.c
org.glite.jp.primary/src/soap_ops.c
org.glite.jp.primary/src/soap_util.c
org.glite.jp.primary/src/tags.c
org.glite.jp.primary/src/tags.h
org.glite.jp.primary/src/tags_plugin.c
org.glite.jp.primary/src/typemap.dat
org.glite.jp.server-common/Makefile
org.glite.jp.server-common/build.xml
org.glite.jp.server-common/examples/db-test-int.c
org.glite.jp.server-common/interface/db.h
org.glite.jp.server-common/project/build.number
org.glite.jp.server-common/project/configure.properties.xml
org.glite.jp.server-common/project/properties.xml
org.glite.jp.server-common/project/tar_exclude
org.glite.jp.server-common/project/version.properties
org.glite.jp.server-common/src/db.c
org.glite.jp.ws-interface/.cvsignore
org.glite.jp.ws-interface/LICENSE
org.glite.jp.ws-interface/Makefile
org.glite.jp.ws-interface/build.xml
org.glite.jp.ws-interface/project/build.number
org.glite.jp.ws-interface/project/build.properties
org.glite.jp.ws-interface/project/configure.properties.xml
org.glite.jp.ws-interface/project/glite-jp-ws-interface.spec
org.glite.jp.ws-interface/project/properties.xml
org.glite.jp.ws-interface/project/tar_exclude
org.glite.jp.ws-interface/project/version.properties
org.glite.jp.ws-interface/src/JobProvenanceIS.xml
org.glite.jp.ws-interface/src/JobProvenancePS.xml
org.glite.jp.ws-interface/src/JobProvenanceTypes.xml
org.glite.jp.ws-interface/src/doc.xml
org.glite.jp.ws-interface/src/puke-ug.xsl
org.glite.jp.ws-interface/src/puke-wsdl.xsl
org.glite.jp/.cvsignore
org.glite.jp/build.xml
org.glite.jp/project/build.number
org.glite.jp/project/build.properties
org.glite.jp/project/dependencies.properties
org.glite.jp/project/glite.jp.csf.xml
org.glite.jp/project/properties.xml
org.glite.jp/project/run-workspace
org.glite.jp/project/taskdefs.xml
org.glite.jp/project/version.properties
org.glite.security.proxyrenewal/.cvsignore
org.glite.security.proxyrenewal/LICENSE
org.glite.security.proxyrenewal/Makefile
org.glite.security.proxyrenewal/build.xml
org.glite.security.proxyrenewal/config/startup
org.glite.security.proxyrenewal/interface/renewal.h
org.glite.security.proxyrenewal/project/build.number
org.glite.security.proxyrenewal/project/build.properties
org.glite.security.proxyrenewal/project/configure.properties.xml
org.glite.security.proxyrenewal/project/properties.xml
org.glite.security.proxyrenewal/project/tar_exclude
org.glite.security.proxyrenewal/project/taskdefs.xml
org.glite.security.proxyrenewal/project/version.properties
org.glite.security.proxyrenewal/src/api.c
org.glite.security.proxyrenewal/src/client.c
org.glite.security.proxyrenewal/src/commands.c
org.glite.security.proxyrenewal/src/common.c
org.glite.security.proxyrenewal/src/renew.c
org.glite.security.proxyrenewal/src/renewal_locl.h
org.glite.security.proxyrenewal/src/renewd.c
org.glite.security.proxyrenewal/src/renewd_locl.h
org.glite.security.proxyrenewal/src/voms.c
org.glite.wms-utils.exception/.cvsignore
org.glite.wms-utils.exception/LICENSE
org.glite.wms-utils.exception/Makefile.am
org.glite.wms-utils.exception/bootstrap
org.glite.wms-utils.exception/build.xml
org.glite.wms-utils.exception/configure.ac
org.glite.wms-utils.exception/interface/Makefile.am
org.glite.wms-utils.exception/interface/glite/wmsutils/exception/Exception.h
org.glite.wms-utils.exception/interface/glite/wmsutils/exception/exception_codes.h
org.glite.wms-utils.exception/project/build.number
org.glite.wms-utils.exception/project/build.properties
org.glite.wms-utils.exception/project/configure.properties.xml
org.glite.wms-utils.exception/project/properties.xml
org.glite.wms-utils.exception/project/version.properties
org.glite.wms-utils.exception/src/Exception.cpp
org.glite.wms-utils.exception/src/Makefile.am
org.glite.wms-utils.exception/test/Makefile.am
org.glite.wms-utils.exception/test/exception_cu_main.cpp
org.glite.wms-utils.exception/test/exception_cu_suite.cpp
org.glite.wms-utils.exception/test/exception_cu_suite.h
org.glite.wms-utils.jobid/.cvsignore
org.glite.wms-utils.jobid/LICENSE
org.glite.wms-utils.jobid/Makefile.am
org.glite.wms-utils.jobid/bootstrap
org.glite.wms-utils.jobid/build.xml
org.glite.wms-utils.jobid/configure.ac
org.glite.wms-utils.jobid/examples/Makefile.am
org.glite.wms-utils.jobid/examples/testjobid.c
org.glite.wms-utils.jobid/interface/Makefile.am
org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/JobId.h
org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/JobIdExceptions.h
org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/cjobid.h
org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/manipulation.h
org.glite.wms-utils.jobid/project/build.number
org.glite.wms-utils.jobid/project/build.properties
org.glite.wms-utils.jobid/project/configure.properties.xml
org.glite.wms-utils.jobid/project/properties.xml
org.glite.wms-utils.jobid/project/version.properties
org.glite.wms-utils.jobid/src/Makefile.am
org.glite.wms-utils.jobid/src/jobid/JobId.cpp
org.glite.wms-utils.jobid/src/jobid/JobIdExceptions.cpp
org.glite.wms-utils.jobid/src/jobid/Makefile.am
org.glite.wms-utils.jobid/src/jobid/cjobid.c
org.glite.wms-utils.jobid/src/jobid/manipulation.cpp
org.glite.wms-utils.jobid/src/jobid/strmd5.c
org.glite.wms-utils.jobid/src/jobid/strmd5.h
org.glite.wms-utils.jobid/test/Makefile.am
org.glite.wms-utils.jobid/test/jobid_cu_main.cpp
org.glite.wms-utils.jobid/test/jobid_cu_suite.cpp
org.glite.wms-utils.jobid/test/jobid_cu_suite.h
org.glite.wms-utils.jobid/test/manipulation_cu_main.cpp
org.glite.wms-utils.jobid/test/manipulation_cu_suite.cpp
org.glite.wms-utils.jobid/test/manipulation_cu_suite.h
org.gridsite.core/.cvsignore
org.gridsite.core/CHANGES
org.gridsite.core/INSTALL
org.gridsite.core/LICENSE
org.gridsite.core/README
org.gridsite.core/VERSION
org.gridsite.core/build.xml
org.gridsite.core/doc/README.htcp-bin
org.gridsite.core/doc/build-apache2.sh
org.gridsite.core/doc/delegation-1.wsdl
org.gridsite.core/doc/findproxyfile.1
org.gridsite.core/doc/gsexec.8
org.gridsite.core/doc/htcp.1
org.gridsite.core/doc/htfind.1
org.gridsite.core/doc/htll.1
org.gridsite.core/doc/htls.1
org.gridsite.core/doc/htmkdir.1
org.gridsite.core/doc/htmv.1
org.gridsite.core/doc/htping.1
org.gridsite.core/doc/htrm.1
org.gridsite.core/doc/httpd-fileserver.conf
org.gridsite.core/doc/httpd-webserver.conf
org.gridsite.core/doc/index.html
org.gridsite.core/doc/mod_gridsite.8
org.gridsite.core/doc/urlencode.1
org.gridsite.core/interface/gridsite-gacl.h
org.gridsite.core/interface/gridsite.h
org.gridsite.core/project/build.number
org.gridsite.core/project/build.properties
org.gridsite.core/project/configure.properties.xml
org.gridsite.core/project/dependencies.properties
org.gridsite.core/project/gridsite.core.csf.xml
org.gridsite.core/project/properties.xml
org.gridsite.core/project/taskdefs.xml
org.gridsite.core/project/version.properties
org.gridsite.core/src/Doxyfile
org.gridsite.core/src/Makefile
org.gridsite.core/src/delegation.h
org.gridsite.core/src/doxygen.css
org.gridsite.core/src/doxyheader.html
org.gridsite.core/src/findproxyfile.c
org.gridsite.core/src/gaclexample.c
org.gridsite.core/src/gridsite.spec
org.gridsite.core/src/grst-delegation.c
org.gridsite.core/src/grst_admin.h
org.gridsite.core/src/grst_admin_file.c
org.gridsite.core/src/grst_admin_gacl.c
org.gridsite.core/src/grst_admin_main.c
org.gridsite.core/src/grst_asn1.c
org.gridsite.core/src/grst_gacl.c
org.gridsite.core/src/grst_htcp.c
org.gridsite.core/src/grst_http.c
org.gridsite.core/src/grst_x509.c
org.gridsite.core/src/grst_xacml.c
org.gridsite.core/src/gsexec.c
org.gridsite.core/src/gsexec.h
org.gridsite.core/src/htcp.c
org.gridsite.core/src/htproxyput.c
org.gridsite.core/src/mod_gridsite.c
org.gridsite.core/src/mod_ssl-private.h
org.gridsite.core/src/proxyput-example.c
org.gridsite.core/src/roffit
org.gridsite.core/src/showx509exts.c
org.gridsite.core/src/urlencode.c
org.gridsite.core/src/xacmlexample.c
+++ /dev/null
-DATE: 08-07-2005 15:20\r
-[dimeglio] Merged from branch 1.2.2\r
-\r
-DATE: 25-05-2005 20:00\r
-[dimeglio] Merged from branch 1.2.2\r
-\r
-DATE: 21-03-2005 17:21\r
-[dimeglio] Implemented status method\r
-\r
-DATE: 21-03-2005 00:32\r
-[dimeglio] Added PERL5LIB env var\r
-\r
-DATE: 17-03-2005 17:33\r
-[gdiez] Stopping and starting the database before the index creation (just after the database is created and the user granted)\r
-\r
-DATE: 09-03-2005 23:05\r
-[dimeglio] Moved creation of indices inside database creation (if database\r
- exists indices are not recreated)\r
-\r
-DATE: 02-03-2005 11:05\r
-[dimeglio] Started CHANGELOG\r
-[dimeglio] Fixed formatting, improved display of message using glib.printXxxMessage functions\r
-[dimeglio] Fixed some problems when starting/stopping services\r
-[dimeglio] GLITE_USER parameter not exposed anymore in config file, use same user parameters\r
- as WMS to allow installation on same node\r
-[dimeglio] Increased module version number to 1.2.0
\ No newline at end of file
+++ /dev/null
-LICENSE file for EGEE Middleware\r
-================================\r
-\r
-Copyright (c) 2004 on behalf of the EU EGEE Project: \r
-The European Organization for Nuclear Research (CERN), \r
-Istituto Nazionale di Fisica Nucleare (INFN), Italy\r
-Datamat Spa, Italy\r
-Centre National de la Recherche Scientifique (CNRS), France\r
-CS Systeme d'Information (CSSI), France\r
-Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden\r
-Universiteit van Amsterdam (UvA), Netherlands\r
-University of Helsinki (UH.HIP), Finlan\r
-University of Bergen (UiB), Norway\r
-Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom\r
-\r
-Redistribution and use in source and binary forms, with or without\r
-modification, are permitted provided that the following conditions are\r
-met: \r
-\r
-1. Redistributions of source code must retain the above copyright\r
-notice, this list of conditions and the following disclaimer.\r
-\r
-2. Redistributions in binary form must reproduce the above copyright\r
-notice, this list of conditions and the following disclaimer in the\r
-documentation and/or other materials provided with the distribution.\r
-\r
-3. The end-user documentation included with the redistribution, if\r
-any, must include the following acknowledgment: "This product includes\r
-software developed by The EU EGEE Project (http://cern.ch/eu-egee/)."\r
-Alternatively, this acknowledgment may appear in the software itself, if\r
-and wherever such third-party acknowledgments normally appear.\r
-\r
-4. The names EGEE and the EU EGEE Project must not be\r
-used to endorse or promote products derived from this software without\r
-prior written permission. For written permission, please contact\r
-<email address>.\r
-\r
-5. You are under no obligation whatsoever to provide anyone with any\r
-bug fixes, patches, or upgrades to the features, functionality or\r
-performance of the Software ("Enhancements") that you may develop over\r
-time; however, if you choose to provide your Enhancements to The EU\r
-EGEE Project, or if you choose to otherwise publish or distribute your\r
-Enhancements, in source code form without contemporaneously requiring\r
-end users of The EU EGEE Proejct to enter into a separate written license\r
-agreement for such Enhancements, then you hereby grant The EU EGEE Project\r
-a non-exclusive, royalty-free perpetual license to install, use, copy,\r
-modify, prepare derivative works, incorporate into the EGEE Middleware\r
-or any other computer software, distribute, and sublicense your\r
-Enhancements or derivative works thereof, in binary and source code\r
-form (if any), whether developed by The EU EGEE Project or third parties.\r
-\r
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED\r
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
-DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE\r
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\r
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\r
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-\r
-This software consists of voluntary contributions made by many\r
-individuals on behalf of the EU EGEE Prject. For more information on The\r
-EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on\r
-EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/\r
-\r
-\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Build file for the gLite LB Server Deployment Unit
-
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
-
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.5 2004/10/17 22:34:39 dimeglio
- Use new installer script format
- Use global filters
- Use RH standard expat rpm in sdf template
-
- Revision 1.4 2004/10/14 16:07:53 dimeglio
- Removed wms.thirdparty-globus-ssl-utils
-
- Revision 1.3 2004/10/14 11:50:22 dimeglio
- Fixed some name and formatting issues
-
- Revision 1.2 2004/10/06 11:42:02 harakaly
- first fill-up
-
- Revision 1.1 2004/10/06 09:19:24 dimeglio
- First version of this file
-
--->
-
-<project name="deployment-lb" default="dist">
-
- <!-- =========================================
- Builds the gLite LB Server Deployment Unit
- ========================================= -->
-
- <!-- =========================================
- Import properties (order is important)
- ========================================= -->
-
- <!-- import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- import component build properties,
- component properties &
- component common properties -->
- <import file="./project/properties.xml"/>
-
- <!-- import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="${subsystem.properties.file}"/>
-
- <!-- import global build properties &
- global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependency property files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${component.dependencies.file}" />
- <property file="${subsystem.dependencies.file}" />
- <property file="${global.dependencies.file}"/>
-
-
- <!-- =========================================
- Import task definitions (order is important)
- ========================================= -->
- <import file="${subsystem.taskdefs.file}" />
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Load configure options
- ========================================= -->
- <property file="${global.configure.options.file}"/>
-
- <!-- =========================================
- Load common targets
- ========================================= -->
- <import file="${global.targets-external-dependencies.file}"/>
- <import file="${global.targets-deploy.file}" />
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ==============================================
- Local private targets
- ============================================== -->
-
- <target name="localinit"
- description="Module specific initialization tasks">
- </target>
-
- <target name="localcompile"
- description="Module specific compilation tasks">
- </target>
-
- <target name="localclean"
- description="Module specific cleaning tasks">
- </target>
-
-</project>
+++ /dev/null
-#!/usr/bin/env python
-################################################################################
-#
-# Copyright (c) Members of the EGEE Collaboration. 2004.
-# See http://eu-egee.org/partners/ for details on the copyright holders.
-# For license conditions see the license file or http://eu-egee.org/license.html
-#
-################################################################################
-# glite-lb-config v. 1.3.0
-#
-# Post-installation script for configuring the gLite Logging and Bookkeping Server
-# Robert Harakaly < robert.harakaly@cern.ch >
-# Diana Bosio <Diana.Bosio@cern.ch>
-# Leanne Guy <leanne.guy@cern.ch>
-#
-# Version info: $Id$
-#
-# Usage: python glite-lb-config [-c|-v|-h|--help]
-# -c print configuration
-# -v print version
-# -h,--help print usage info
-#
-# Return codes: 0 - Ok
-# 1 - Configuration failed
-#
-################################################################################
-
-import os,string,pwd
-import sys, posix, getopt,time
-
-sys.path.append(".")
-from gLiteInstallerLib import gLib
-from gliteRgmaServicetool import gliteRgmaServicetool
-import mysql as MySQL
-
-# Set global variables here
-global params # all config values from the XML file
-global rgmaServicetool
-
-class glite_lb:
-
- def __init__(self):
- self.mysql = MySQL.Mysql()
- self.verbose = 0
- self.version = "1.3.0"
- self.name = "glite-lb"
- self.friendly_name = "gLite Logging and Bookkeeping"
- params['module.version'] = self.version
-
- #-------------------------------------------------------------------------------
- # Banner
- #-------------------------------------------------------------------------------
-
- def banner(self):
-
- print "\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
- print "Configuring the %s" % self.friendly_name
- print "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
-
- #-------------------------------------------------------------------------------
- # Copyright
- #-------------------------------------------------------------------------------
-
- def copyright(self):
-
- print '\nCopyright (c) Members of the EGEE Collaboration. 2004'
- print 'See http://eu-egee.org/partners/ for details on the copyright holders'
- print 'For license conditions see the license file or http://eu-egee.org/license.html'
-
- #-------------------------------------------------------------------------------
- # Version
- #-------------------------------------------------------------------------------
-
- def showVersion(self):
-
- print '\n%s-config v. %s\n' % (self.name,self.version)
-
- #-------------------------------------------------------------------------------
- # Usage
- #-------------------------------------------------------------------------------
-
- def usage(self,msg = ""):
-
- if msg:
- print "\n%s" % (msg)
-
- self.copyright()
- self.showVersion()
-
- print """Usage: \n
-Edit the configuration file %s.cfg.xml in
-%s/etc.config/templates\n
-save it as %s/etc/config/%s.cfg.xml
-and run the script as follows\n
-python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \
- os.environ['GLITE_LOCATION'], self.name, self.name)
-
- print ' -c, --checkconf print the service configuration'
- print ' -v, --version print the version of the configuration script'
- print ' -h, --help print this usage information'
- print ' --start start the service'
- print ' --stop stop the service'
- print ' --status check service status'
- print '\n'
-
- #-------------------------------------------------------------------------------
- # All the configuration code goes here
- #-------------------------------------------------------------------------------
-
- def start(self):
-
- self.mysql.start()
- time.sleep(5)
-
- if not os.path.exists('/tmp/mysql.sock'):
- os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock')
-
- pid = glib.getPID('bkserverd')
- if pid != 0:
- print 'The gLite LB Server service is already running. Restarting...'
- os.system('%s/etc/init.d/glite-lb-bkserverd stop' % os.environ['GLITE_LOCATION'])
- else:
- print 'Starting the gLite LB Server service...'
-
- os.system('%s/etc/init.d/glite-lb-bkserverd start' % os.environ['GLITE_LOCATION'])
-
- pid = glib.getPID('bkserverd')
-
- if (pid != 0):
- print "The gLite LB Server service has been started ",
- glib.printOkMessage()
- else:
- glib.printErrorMessage("Could not start the gLite LB Server service")
- glib.printErrorMessage("Please verify and re-run the script "),
- glib.printFailedMessage()
- return 1
-
- #-------------------------------------------------------------------
- # Start Servicetool
- #-------------------------------------------------------------------
-
- pid = glib.getPID('rgma-servicetool')
- if (pid != 0):
- print 'The gLite R-GMA Servicetool service is already running. Restarting...'
- rgmaServicetool.stop()
- else:
- print "Starting the gLite R-GMA Servicetool service"
-
- rgmaServicetool.start()
-
-
- # Check that the daemon is running
-
- pid = glib.getPID('rgma-servicetool')
-
- if (pid != 0):
- print "The gLite R-GMA Servicetool service has been started ",
- glib.printOkMessage()
- else:
- glib.printErrorMessage("Could not start the gLite R-GMA Servicetool service")
- glib.printErrorMessage("Please verify and re-run the script "),
- glib.printFailedMessage()
- return 1
-
- return 0
-
- def stop(self):
-
- pid = glib.getPID('bkserverd')
- if (pid != 0):
- os.system('%s/etc/init.d/glite-lb-bkserverd stop' % os.environ['GLITE_LOCATION'])
-
- pid = glib.getPID('bkserverd')
- if (pid != 0):
- print 'Could not stop the LB Server service ',
- glib.printFailedMessage()
- else:
- print 'The LB Server service has been stopped ',
- glib.printOkMessage()
-
- self.mysql.stop()
-
- #-------------------------------------------------------------------
- # Stop the servicetool
- #-------------------------------------------------------------------
-
- pid = glib.getPID('rgma-servicetool')
- if (pid != 0):
- rgmaServicetool.stop()
-
- pid = glib.getPID('rgma-servicetool')
- if (pid != 0):
- print 'Could not stop the R-GMA Servicetool service ',
- glib.printFailedMessage()
- else:
- print 'The R-GMA Servicetool service has been stopped ',
- glib.printOkMessage()
-
- return 0
-
- def status(self):
-
- error_level = 0
-
- retval = os.system('%s/etc/init.d/glite-lb-bkserverd status' % os.environ['GLITE_LOCATION'])
- if retval != 0:
- error_level = 1
-
- return error_level
-
- def configure(self):
-
- #--------------------------------------------------------
- # Installs the Security Utilities
- #--------------------------------------------------------
-
- if os.system("python %s/glite-security-utils-config.py --subservice" % glib.getScriptPath()):
- print "\nInstalling gLite Security Utilities ",
- glib.printFailedMessage()
- return 1
-
- print "\nInstalling gLite Security Utilities ",
- glib.printOkMessage()
-
- # Create the GLITE_USER if it doesn't exists
- print "\nCreating/Verifying the GLITE_USER account %s" % os.environ['GLITE_USER']
- (uid,gid) = glib.get_user_info(os.environ['GLITE_USER'])
- glib.check_dir(os.environ['GLITE_LOCATION_VAR'],0755, uid, gid)
- lb_cert_path = pwd.getpwnam(os.environ['GLITE_USER'])[5] + "/" + params['user.certificate.path']
- glib.check_dir(lb_cert_path ,0755, uid, gid)
- glib.printOkMessage()
-
- # Create all directories needed
- print "\nVerify CA certificates directory ",
- glib.check_dir(os.environ['GLITE_CERT_DIR'])
- glib.printOkMessage()
-
- # Copy certificates
- print "\nCopy host certificates to GLITE_USER home directory as service certificates",
- os.system("cp %s %s %s/" % (params['host.certificate.file'], params['host.key.file'], lb_cert_path))
- os.chown("%s/hostcert.pem" % lb_cert_path, uid,gid)
- os.chmod("%s/hostcert.pem" % lb_cert_path, 0644)
- os.chown("%s/hostkey.pem" % lb_cert_path, uid,gid)
- os.chmod("%s/hostkey.pem" % lb_cert_path, 0400)
- glib.printOkMessage()
-
- # Create the MySQL database
- print "\nCreate/Verify the %s database" % params['lb.database.name']
- self.mysql.stop()
- time.sleep(5)
- self.mysql.start()
-
- if not os.path.exists('/tmp/mysql.sock'):
- os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock')
-
- # Check if database exists
- if self.mysql.existsDB(params['lb.database.name']) != 0:
- # Create database
- print ('\n==> Creating MySQL %s database\n' % params['lb.database.name'])
-
- if os.path.exists('/bin/rm /tmp/mysql_ct'):
- os.remove('/tmp/mysql_ct')
-
- file = open('/tmp/mysql_ct', 'w')
- text = ['CREATE DATABASE %s;\n' % params['lb.database.name'],
- 'GRANT ALL PRIVILEGES ON %s.* TO %s@localhost IDENTIFIED BY "";\n' \
- % (params['lb.database.name'],params['lb.database.username']),
- 'USE %s;\n' % params['lb.database.name'],
- '\. %s/etc/glite-lb-dbsetup.sql\n' % os.environ['GLITE_LOCATION']]
-
- file.writelines(text)
- file.close()
- os.system('/usr/bin/mysql < /tmp/mysql_ct')
- os.system('/bin/rm /tmp/mysql_ct')
-
- #Starting and stopping the database before the index creation
- self.mysql.stop()
- time.sleep(5)
- self.mysql.start()
-
- #Creating the indexes
- print 'Creating the index configuration file %s/etc/glite-lb-index.conf ' % os.environ['GLITE_LOCATION'],
- path = "%s/etc/glite-lb-index.conf" % os.environ['GLITE_LOCATION']
- pathBak = "%s/etc/glite-lb-index.conf.bak" % os.environ['GLITE_LOCATION']
-
- if os.path.exists(pathBak):
- os.remove(pathBak)
- if os.path.exists(path):
- os.rename(path,pathBak)
- file = open(path, 'w')
- file.write("[\n")
- file.write(" JobIndices = {\n")
- for index in params['lb.index.list']:
- file.write(" [ type = \"system\"; name = \"%s\" ],\n" % index)
- file.write(" }\n")
- file.write("]\n")
- file.close()
- glib.printOkMessage()
-
- print "Running glite-lb-bkindex ",
- if os.system('%s/bin/glite-lb-bkindex -r %s/etc/glite-lb-index.conf' % (os.environ['GLITE_LOCATION'],os.environ['GLITE_LOCATION'])):
- glib.printFailedMessage()
- return 1
- else:
- glib.printOkMessage()
-
- else:
- print "\n==> MySQL database %s already exist\n" % params['lb.database.name']
-
- self.mysql.stop()
-
- #-------------------------------------------------------------------
- # RGMA servicetool: configure servicetool
- #-------------------------------------------------------------------
-
- print "Configuring the R-GMA Servicetool..."
-
- if rgmaServicetool.configure(glib):
- # error in configuring services
- print "Configuring the R-GMA Servicetool... ",
- glib.printFailedMessage()
- return 1
-
- print "Configuring the R-GMA Servicetool... ",
- glib.printOkMessage()
-
- return 0
-
-#-------------------------------------------------------------------------------
-# Set all environment variables
-#-------------------------------------------------------------------------------
-
-def set_env():
-
- # gLite
- glib.export('GLITE_LOCATION');
- glib.export('GLITE_LOCATION_VAR');
- if not os.path.exists(os.environ['GLITE_LOCATION_VAR']):
- os.mkdir(os.environ['GLITE_LOCATION_VAR'],0755)
- glib.export('GLITE_LOCATION_LOG');
- if not os.path.exists(os.environ['GLITE_LOCATION_LOG']):
- os.mkdir(os.environ['GLITE_LOCATION_LOG'],0755)
- glib.export('GLITE_LOCATION_TMP');
- if not os.path.exists(os.environ['GLITE_LOCATION_TMP']):
- os.mkdir(os.environ['GLITE_LOCATION_TMP'],0755)
-
- if not params.has_key('glite.user.group'):
- params['glite.user.group'] = ''
- (uid,gid) = glib.add_user(params['glite.user.name'],params['glite.user.group'])
- glib.export('GLITE_USER',params['glite.user.name'])
- lb_cert_path = pwd.getpwnam(os.environ['GLITE_USER'])[5] + "/" + params['user.certificate.path']
- glib.export('GLITE_HOST_CERT',"%s/hostcert.pem" % lb_cert_path)
- glib.export('GLITE_HOST_KEY',"%s/hostkey.pem" % lb_cert_path)
- glib.export('GLITE_CERT_DIR',params['ca.certificates.dir'])
-
- glib.export('GLOBUS_LOCATION',params['GLOBUS_LOCATION'])
- glib.export('GPT_LOCATION',params['GPT_LOCATION'])
-
- glib.export('JAVA_HOME')
-
- # bin and lib paths
- glib.addEnvPath("PATH","/usr/bin/:%s/bin:%s/bin:%s/externals/bin:%s/bin" \
- % (os.environ['JAVA_HOME'],os.environ['GLOBUS_LOCATION'],os.environ['GLITE_LOCATION'],os.environ['GLITE_LOCATION']))
- glib.addEnvPath("LD_LIBRARY_PATH","/usr/lib:%s/lib:%s/externals/lib:%s/lib" % (os.environ['GLOBUS_LOCATION'], os.environ['GLITE_LOCATION'],os.environ['GLITE_LOCATION']))
-
- # Perl
- glib.addEnvPath("PERL5LIB", "%s/lib/perl:%s/lib/perl5" % (os.environ['GPT_LOCATION'],os.environ['GLITE_LOCATION']))
-
- # Set environment
- glib.setUserEnv()
-
-#-------------------------------------------------------------------------------
-# Main program begins here
-#-------------------------------------------------------------------------------
-
-if __name__ == '__main__':
-
- # The script must be run as root
- if not os.geteuid()==0:
- print '"\nThis script must be run as root\n'
- sys.exit(1)
-
- # Get an instance of the library class
- glib = gLib()
-
- # Load parameters
- params = {}
- try:
- opts, args = getopt.getopt(sys.argv[1:], '', ['siteconfig='])
- for o, a in opts:
- if o == "--siteconfig":
- params['site.config.url'] = a
- break
- except getopt.GetoptError:
- pass
- if glib.loadConfiguration("%s/../glite-lb.cfg.xml" % glib.getScriptPath(),params):
- print "An error occurred while configuring the service"
- sys.exit(1)
-
- verbose = 0
- if params.has_key('glite.installer.verbose'):
- if params['glite.installer.verbose'] == "true":
- verbose = 1
- glib.verbose = verbose
-
- # Set up the environment
- set_env()
-
- # Instantiate the service classes
- service = glite_lb()
- service.verbose = verbose
- # Instantiate the rgma servicetool class
- rgmaServicetool = gliteRgmaServicetool()
- rgmaServicetool.verbose = verbose
-
- # Command line opts if any
- try:
- opts, args = getopt.getopt(sys.argv[1:], 'chv', ['checkconf', 'help', 'version','stop','start','status','siteconfig='])
- except getopt.GetoptError:
- service.usage(msg = "Unknown options(s)")
- sys.exit(1)
-
- # Check cli options
- for o, a in opts:
- if o in ("-h", "--help"):
- service.usage()
- sys.exit(0)
- if o in ("-v", "--version"):
- service.showVersion()
- sys.exit(0)
- if o in ("-c", "--checkconf"):
- service.copyright()
- service.showVersion()
- glib.print_params(params)
- sys.exit(0)
- if o in ("stop", "--stop"):
- service.stop()
- sys.exit(0)
- if o in ("start", "--start"):
- service.start()
- sys.exit(0)
- if o == "--status":
- sys.exit(service.status())
-
-
- # Check certificates
- if params.has_key('glite.installer.checkcerts'):
- if params['glite.installer.checkcerts'] == "true":
- if glib.check_certs(params) != 0:
- print "An error occurred while configuring the %s service" \
- % service.friendly_name
- sys.exit(1)
-
- # Print configuration parameters
- if verbose:
- glib.print_params(params)
-
- service.copyright()
- service.showVersion()
- service.banner()
-
- # Configure the service
- if service.configure() == 0:
- print "\n%s configuration successfully completed " % service.friendly_name,
- glib.printOkMessage()
- glib.registerService()
- else:
- print "\nAn error occurred while configuring the %s " % service.friendly_name,
- glib.printFailedMessage()
- sys.exit(1)
-
- # Start the service
- if service.start() == 0:
- print "\nThe %s was successfully started " % service.friendly_name,
- glib.printOkMessage()
- else:
- print "\nAn error occurred while starting the %s " % service.friendly_name,
- glib.printFailedMessage()
- sys.exit(1)
-
+++ /dev/null
-
-#!/bin/sh
-
-rpm -e edg-fetch-crl-1.0.0-EGEE \
-ca_ArmeSFo-0.23-1 \
-ca_ASGCCA-0.23-1 \
-ca_BEGrid-0.23-1 \
-ca_CERN-0.23-1 \
-ca_CESNET-0.23-1 \
-ca_CNRS-0.23-1 \
-ca_CNRS-DataGrid-0.23-1 \
-ca_CNRS-Projets-0.23-1 \
-ca_CyGrid-0.23-1 \
-ca_DOEGrids-0.23-1 \
-ca_DOESG-Root-0.23-1 \
-ca_ESnet-0.23-1 \
-ca_FNAL-0.23-1 \
-ca_FNAL_KCA-0.23-1 \
-ca_GermanGrid-0.23-1 \
-ca_Grid-Ireland-0.23-1 \
-ca_GridCanada-0.23-1 \
-ca_HellasGrid-0.23-1 \
-ca_INFN-0.23-1 \
-ca_IUCC-0.23-1 \
-ca_LIP-0.23-1 \
-ca_NIKHEF-0.23-1 \
-ca_NorduGrid-0.23-1 \
-ca_PK-Grid-0.23-1 \
-ca_PolishGrid-0.23-1 \
-ca_Russia-0.23-1 \
-ca_SlovakGrid-0.23-1 \
-ca_Spain-0.23-1 \
-ca_UKeScience-0.23-1 \
-glite-wms-utils-exception-0.1.0-0 \
-glite-wms-utils-jobid-0.1.0-0 \
-glite-lb-client-interface-0.2.0-0 \
-glite-lb-server-bones-0.0.0-0 \
-glite-lb-common-0.2.0-0 \
-glite-lb-logger-0.2.0-0 \
-glite-lb-server-0.3.0-0 \
-glite-security-proxyrenewal-0.1.0-1 \
-ares-1.1.1-EGEE \
-gpt-VDT1.2.0rh9-1 \
-vdt_globus_essentials-VDT1.2.0rh9-1 \
-perl-Expect.pm-1.01-9 \
-myproxy-1.14-EGEE \
-MySQL-client-4.0.20-0 \
-MySQL-server-4.0.20-0
-
+++ /dev/null
-<!-- Parameters for configuring the org.glite.data.io-daemon service -->
-<config>
- <parameters>
-
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
- <!-- User-defined parameters - Please change them -->
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
-
- <!-- gLite services user accounts -->
- <glite.user.name
- description="Name of the user account used to run the gLite services
- on this LB node"
- value="changeme"/>
-
- <glite.user.group
- description="Group of the user specified in the 'glite.user.name'
- parameter. Leave it empty of comment it out to use the same as 'glite.user.name'"
- value="changeme"/>
-
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
- <!-- Advanced parameters - Change them if you know what you're doing -->
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
-
- <!-- Installer configuration -->
- <glite.installer.verbose
- description="Enable verbose output"
- value="true"/>
-
- <glite.installer.checkcerts
- description="Enable check of host certificates"
- value="true"/>
-
- <!-- MySQL DB -->
- <lb.database.name
- description="The mySQL database name to create for storing LB data
- In this version it must be set to the given value"
- value="lbserver20"/>
-
- <lb.index.list
- description="Definitions of indices on all the currently supported indexed system attributes">
-
- <value>owner</value>
- <value>location</value>
- <value>destination</value>
-
- </lb.index.list>
-
- <lb.database.username
- description="The username to be used to access the local mySQL server
- In this version it must be set to the given value"
- value="lbserver"/>
-
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
- <!-- System parameters - You should leave these alone -->
- <!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
-
- </parameters>
-
- <!--RGMA service publishing: log server -->
- <instance name="lb.rgma" service="rgma-servicetool">
- <parameters>
-
- <rgma.servicetool.enable
- description="Publish log server via RGMA servicetool. If this variable is set to 'false': the other
- values of this instance are not taken into account.[Example: 'true'] [Type: 'boolean']"
-
- value="true"/>
-
- <rgma.servicetool.name
- description="Name of the service. This should be globally unique.
- Example: your.host.name_Logging_Bookkeeping_Server
- [Type: 'String']"
- value="${HOSTNAME}_Logging_Bookkeeping_Server"/>
-
- <rgma.servicetool.url_endpoint
- description="URL to contact the service at.
- This should be unique for each service. Use example and adapt host.
- Example: http://your.host.name/LB/LBServer
- [Type: 'string']"
- value="http://${HOSTNAME}/LB/LBServer"/>
-
- <rgma.servicetool.service_type
- description="The service type. This should be uniquely defined for
- each service type. Currently two methods of type naming are recommended:
- (1) The targetNamespace from the WSDL document,
- followed by a space and then the service name.
- (2) A URL owned by the body or individual who defines the service type.
- Example: Logging and Bookkeeping Server
- [Type: 'string']"
- value="Logging and Bookkeeping Server"/>
-
- <rgma.servicetool.service_version
- description="Service version in the form 'major.minor.patch'
- Example: 1.2.3
- [Type: 'string']"
- value="${module.version}"/>
-
- <rgma.servicetool.publish_interval
- description="How often to check and publish service information.
- Example: 3600 [Type: 'string'] [Unit: 'seconds']"
- value="3600"/>
-
- <rgma.servicetool.status_script
- description="Script to run when determining the service status.
- This script should return an exit code of 0 to indicate the service is OK, other values
- should indicate an error. The first line of the standard output should be a brief message
- describing the service status (e.g. 'Accepting connections')
- Example: ${GLITE_LOCATION}/etc/init.d/glite-lb-bkserverd status
- [Type: 'string']"
- value="${GLITE_LOCATION}/etc/init.d/glite-lb-bkserverd status"/>
-
- <rgma.servicetool.status_interval
- description="How often to check and publish service status.
- Example: 60 [Type: 'string'] [Unit: 'seconds']"
- value="60"/>
-
- <rgma.servicetool.url_wsdl
- description="URL of a WSDL document for the service (leave blank if the
- service has no WSDL).
- Example: http://example.rl.ac.uk/service?WSDL
- [Type: 'string']"
- value="n/a"/>
-
- <rgma.servicetool.url_semantics
- description="URL of a document containing a detailed description of the service
- and how it should be used.
- Example: http://example.rl.ac.uk/service/semantics.html
- [Type: 'string']"
- value="n/a"/>
-
- </parameters>
- </instance>
-
-</config>
+++ /dev/null
-<html>
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=Generator content="Microsoft Word 11 (filtered)">
-<title>gLite LB Server Release Notes</title>
-<style>
-<!--
- /* Font Definitions */
- @font-face
- {font-family:Helvetica;
- panose-1:2 11 6 4 2 2 2 2 2 4;}
-@font-face
- {font-family:Wingdings;
- panose-1:5 0 0 0 0 0 0 0 0 0;}
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;}
-@font-face
- {font-family:Times;
- panose-1:2 2 6 3 5 4 5 2 3 4;}
-@font-face
- {font-family:"Univers \(W1\)";}
- /* Style Definitions */
- p.MsoNormal, li.MsoNormal, div.MsoNormal
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:0mm;
- text-align:justify;
- font-size:11.0pt;
- font-family:"Times New Roman";}
-h1
- {margin-top:12.0pt;
- margin-right:0mm;
- margin-bottom:3.0pt;
- margin-left:21.6pt;
- text-align:justify;
- text-indent:-21.6pt;
- font-size:12.0pt;
- font-family:Arial;
- text-transform:uppercase;
- layout-grid-mode:line;
- font-weight:bold;}
-h2
- {margin-top:12.0pt;
- margin-right:0mm;
- margin-bottom:3.0pt;
- margin-left:28.8pt;
- text-align:justify;
- text-indent:-28.8pt;
- font-size:11.0pt;
- font-family:Arial;
- text-transform:uppercase;
- font-weight:bold;}
-h3
- {margin-top:10.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:36.0pt;
- text-align:justify;
- text-indent:-36.0pt;
- font-size:11.0pt;
- font-family:Arial;
- font-weight:bold;}
-h4
- {margin-top:10.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:43.2pt;
- text-align:justify;
- text-indent:-43.2pt;
- page-break-after:avoid;
- font-size:11.0pt;
- font-family:Arial;
- font-weight:bold;
- font-style:italic;}
-h5
- {margin-top:12.0pt;
- margin-right:0mm;
- margin-bottom:3.0pt;
- margin-left:50.4pt;
- text-align:justify;
- text-indent:-50.4pt;
- font-size:11.0pt;
- font-family:"Times New Roman";
- font-weight:normal;}
-h6
- {margin-top:12.0pt;
- margin-right:0mm;
- margin-bottom:3.0pt;
- margin-left:57.6pt;
- text-align:justify;
- text-indent:-57.6pt;
- font-size:11.0pt;
- font-family:"Times New Roman";
- font-weight:normal;
- font-style:italic;}
-p.MsoHeading7, li.MsoHeading7, div.MsoHeading7
- {margin-top:12.0pt;
- margin-right:0mm;
- margin-bottom:3.0pt;
- margin-left:64.8pt;
- text-align:justify;
- text-indent:-64.8pt;
- font-size:11.0pt;
- font-family:Arial;}
-p.MsoHeading8, li.MsoHeading8, div.MsoHeading8
- {margin-top:12.0pt;
- margin-right:0mm;
- margin-bottom:3.0pt;
- margin-left:72.0pt;
- text-align:justify;
- text-indent:-72.0pt;
- font-size:11.0pt;
- font-family:Arial;
- font-style:italic;}
-p.MsoHeading9, li.MsoHeading9, div.MsoHeading9
- {margin-top:12.0pt;
- margin-right:0mm;
- margin-bottom:3.0pt;
- margin-left:79.2pt;
- text-align:justify;
- text-indent:-79.2pt;
- font-size:9.0pt;
- font-family:Arial;
- font-weight:bold;
- font-style:italic;}
-p.MsoIndex1, li.MsoIndex1, div.MsoIndex1
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:12.0pt;
- margin-left:0mm;
- text-align:justify;
- font-size:12.0pt;
- font-family:"Times New Roman";}
-p.MsoToc1, li.MsoToc1, div.MsoToc1
- {margin-top:6.0pt;
- margin-right:0mm;
- margin-bottom:6.0pt;
- margin-left:0mm;
- text-align:justify;
- font-size:10.0pt;
- font-family:"Times New Roman";
- text-transform:uppercase;
- font-weight:bold;}
-p.MsoToc2, li.MsoToc2, div.MsoToc2
- {margin-top:0mm;
- margin-right:0mm;
- margin-bottom:0mm;
- margin-left:11.0pt;
- margin-bottom:.0001pt;
- text-align:justify;
- font-size:10.0pt;
- font-family:"Times New Roman";
- font-variant:small-caps;}
-p.MsoToc3, li.MsoToc3, div.MsoToc3
- {margin-top:0mm;
- margin-right:0mm;
- margin-bottom:0mm;
- margin-left:22.0pt;
- margin-bottom:.0001pt;
- text-align:justify;
- font-size:10.0pt;
- font-family:"Times New Roman";
- font-style:italic;}
-p.MsoToc4, li.MsoToc4, div.MsoToc4
- {margin-top:0mm;
- margin-right:0mm;
- margin-bottom:0mm;
- margin-left:33.0pt;
- margin-bottom:.0001pt;
- text-align:justify;
- font-size:9.0pt;
- font-family:"Times New Roman";}
-p.MsoToc5, li.MsoToc5, div.MsoToc5
- {margin-top:0mm;
- margin-right:0mm;
- margin-bottom:0mm;
- margin-left:44.0pt;
- margin-bottom:.0001pt;
- text-align:justify;
- font-size:9.0pt;
- font-family:"Times New Roman";}
-p.MsoToc6, li.MsoToc6, div.MsoToc6
- {margin-top:0mm;
- margin-right:0mm;
- margin-bottom:0mm;
- margin-left:55.0pt;
- margin-bottom:.0001pt;
- text-align:justify;
- font-size:9.0pt;
- font-family:"Times New Roman";}
-p.MsoToc7, li.MsoToc7, div.MsoToc7
- {margin-top:0mm;
- margin-right:0mm;
- margin-bottom:0mm;
- margin-left:66.0pt;
- margin-bottom:.0001pt;
- text-align:justify;
- font-size:9.0pt;
- font-family:"Times New Roman";}
-p.MsoToc8, li.MsoToc8, div.MsoToc8
- {margin-top:0mm;
- margin-right:0mm;
- margin-bottom:0mm;
- margin-left:77.0pt;
- margin-bottom:.0001pt;
- text-align:justify;
- font-size:9.0pt;
- font-family:"Times New Roman";}
-p.MsoToc9, li.MsoToc9, div.MsoToc9
- {margin-top:0mm;
- margin-right:0mm;
- margin-bottom:0mm;
- margin-left:88.0pt;
- margin-bottom:.0001pt;
- text-align:justify;
- font-size:9.0pt;
- font-family:"Times New Roman";}
-p.MsoNormalIndent, li.MsoNormalIndent, div.MsoNormalIndent
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:12.0pt;
- margin-left:35.4pt;
- text-align:justify;
- text-indent:-7.0pt;
- font-size:12.0pt;
- font-family:Times;}
-p.MsoFootnoteText, li.MsoFootnoteText, div.MsoFootnoteText
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:0mm;
- text-align:justify;
- font-size:11.0pt;
- font-family:"Times New Roman";}
-p.MsoCommentText, li.MsoCommentText, div.MsoCommentText
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:6.0pt;
- margin-left:0mm;
- text-align:justify;
- font-size:8.0pt;
- font-family:"Times New Roman";}
-p.MsoHeader, li.MsoHeader, div.MsoHeader
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:0mm;
- text-align:justify;
- font-size:11.0pt;
- font-family:"Times New Roman";}
-p.MsoFooter, li.MsoFooter, div.MsoFooter
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:0mm;
- text-align:justify;
- font-size:11.0pt;
- font-family:"Times New Roman";}
-p.MsoCaption, li.MsoCaption, div.MsoCaption
- {margin-top:6.0pt;
- margin-right:0mm;
- margin-bottom:6.0pt;
- margin-left:0mm;
- text-align:justify;
- font-size:11.0pt;
- font-family:"Times New Roman";
- font-weight:bold;}
-span.MsoFootnoteReference
- {vertical-align:super;}
-p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
- {margin-top:3.0pt;
- margin-right:0mm;
- margin-bottom:3.0pt;
- margin-left:0mm;
- text-align:justify;
- font-size:11.0pt;
- font-family:"Times New Roman";}
-p.MsoBodyText3, li.MsoBodyText3, div.MsoBodyText3
- {margin-top:2.5pt;
- margin-right:0mm;
- margin-bottom:2.5pt;
- margin-left:0mm;
- text-align:justify;
- page-break-after:avoid;
- font-size:10.0pt;
- font-family:Arial;}
-p.MsoBlockText, li.MsoBlockText, div.MsoBlockText
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:0mm;
- text-align:justify;
- text-indent:17.0pt;
- font-size:11.0pt;
- font-family:"Times New Roman";}
-a:link, span.MsoHyperlink
- {color:blue;
- text-decoration:underline;}
-a:visited, span.MsoHyperlinkFollowed
- {color:purple;
- text-decoration:underline;}
-p.MsoDocumentMap, li.MsoDocumentMap, div.MsoDocumentMap
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:0mm;
- text-align:justify;
- background:navy;
- font-size:11.0pt;
- font-family:Tahoma;}
-p
- {margin-top:5.0pt;
- margin-right:0mm;
- margin-bottom:5.0pt;
- margin-left:0mm;
- text-align:justify;
- font-size:12.0pt;
- font-family:"Times New Roman";}
-tt
- {font-family:"Courier New";}
-p.3eretraitnormal, li.3eretraitnormal, div.3eretraitnormal
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:3.0pt;
- margin-left:102.9pt;
- text-align:justify;
- text-indent:-17.85pt;
- font-size:12.0pt;
- font-family:"Times New Roman";}
-p.2eretraitjustifi, li.2eretraitjustifi, div.2eretraitjustifi
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:3.0pt;
- margin-left:40.0mm;
- text-align:justify;
- text-indent:-7.1pt;
- line-height:12.0pt;
- font-size:11.0pt;
- font-family:"Times New Roman";}
-p.2eretraitnormal, li.2eretraitnormal, div.2eretraitnormal
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:3.0pt;
- margin-left:18.0pt;
- text-align:justify;
- text-indent:-18.0pt;
- font-size:12.0pt;
- font-family:"Times New Roman";}
-p.1erretraitnormal, li.1erretraitnormal, div.1erretraitnormal
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:12.0pt;
- margin-left:0mm;
- text-align:justify;
- font-size:12.0pt;
- font-family:"Times New Roman";}
-p.titrebloc, li.titrebloc, div.titrebloc
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:0mm;
- text-align:justify;
- font-size:11.0pt;
- font-family:Arial;
- font-weight:bold;}
-p.TitreTable, li.TitreTable, div.TitreTable
- {margin-top:6.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:0mm;
- text-align:center;
- font-size:12.0pt;
- font-family:Arial;
- font-weight:bold;}
-p.form, li.form, div.form
- {margin-top:6.0pt;
- margin-right:7.05pt;
- margin-bottom:0mm;
- margin-left:0mm;
- margin-bottom:.0001pt;
- text-align:justify;
- background:black;
- border:none;
- padding:0mm;
- font-size:14.0pt;
- font-family:"Univers \(W1\)";
- color:white;
- text-transform:uppercase;
- font-weight:bold;}
-p.HB, li.HB, div.HB
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:12.0pt;
- margin-left:0mm;
- text-align:justify;
- page-break-after:avoid;
- font-size:12.0pt;
- font-family:"Times New Roman";
- color:black;
- font-weight:bold;}
-p.reference, li.reference, div.reference
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:0mm;
- text-align:justify;
- page-break-after:avoid;
- font-size:9.0pt;
- font-family:Arial;}
-p.1erretraitjustifi, li.1erretraitjustifi, div.1erretraitjustifi
- {margin-top:6.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:14.2pt;
- text-align:justify;
- text-indent:-14.2pt;
- font-size:11.0pt;
- font-family:"Times New Roman";}
-p.ZonetatEnTte, li.ZonetatEnTte, div.ZonetatEnTte
- {margin-top:2.0pt;
- margin-right:2.85pt;
- margin-bottom:2.0pt;
- margin-left:2.85pt;
- text-align:center;
- page-break-after:avoid;
- font-size:36.0pt;
- font-family:Arial;
- text-transform:uppercase;
- font-weight:bold;}
-p.DocTitle, li.DocTitle, div.DocTitle
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:0mm;
- text-align:center;
- font-size:22.0pt;
- font-family:Arial;
- font-variant:small-caps;
- color:gray;
- letter-spacing:4.0pt;
- font-weight:bold;}
-p.DocDate, li.DocDate, div.DocDate
- {margin-top:6.0pt;
- margin-right:0mm;
- margin-bottom:6.0pt;
- margin-left:0mm;
- text-align:justify;
- font-size:11.0pt;
- font-family:Arial;
- layout-grid-mode:line;
- font-weight:bold;}
-p.DocSubTitle, li.DocSubTitle, div.DocSubTitle
- {margin-top:2.0pt;
- margin-right:0mm;
- margin-bottom:2.0pt;
- margin-left:0mm;
- text-align:center;
- line-height:12.0pt;
- font-size:12.0pt;
- font-family:Arial;
- font-variant:small-caps;
- color:gray;
- letter-spacing:4.0pt;
- font-weight:bold;}
- /* Page Definitions */
- @page Section1
- {size:595.3pt 841.9pt;
- margin:70.85pt 70.85pt 70.85pt 70.85pt;}
-div.Section1
- {page:Section1;}
- /* List Definitions */
- ol
- {margin-bottom:0mm;}
-ul
- {margin-bottom:0mm;}
--->
-</style>
-
-</head>
-
-<body lang=EN-GB link=blue vlink=purple>
-
-<div class=Section1>
-
-<p class=DocTitle><span lang=FR style='font-variant:normal !important;
-text-transform:uppercase'>gLite Logging & Bookkeeping Server</span></p>
-
-<h1><span lang=FR>1. </span><span lang=FR>Release Description</span></h1>
-
-<p class=MsoNormal>This release contains the gLite Logging & Bookkeeping
-Server module v. 1.2.3. The following sections provide additional information about
-the release content, the module dependencies, the know bugs and issues and a
-list of bugs closed since the previous release. For information about
-installing and using the gLite Logging & Bookkeeping Server, please refer
-to the gLite Installation and User Guides. </p>
-
-<h1><span lang=FR>2. </span><span lang=FR>Changes in this Release</span></h1>
-
-<p class=MsoNormal>This release introduces the following changes:</p>
-
-<p class=MsoNormal> </p>
-
-<ul style='margin-top:0mm' type=disc>
- <li class=MsoNormal style='text-align:left'>All R-GMA service publishing
- instances in the configuration template now have default values</li>
- <li class=MsoNormal>Bug fixes (see below for the complete lists)</li>
-</ul>
-
-<h1>3. Release contents</h1>
-
-<p class=MsoNormal>The gLite Logging & Bookkeeping Server v. 1.2.3 is
-composed of the following gLite components:</p>
-
-<p class=MsoNormal> </p>
-
-<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 width=621
- style='width:466.1pt;border-collapse:collapse;border:none'>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>Component name</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>Version</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>File</span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>org.glite.deployment.lb</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.2.3</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/installers/glite-lb_installer.sh">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/installers/glite-lb_installer.sh</a>
- </span></p>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/noarch/RPMS/glite-lb-config-1.2.3-1.noarch.rpm">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/noarch/RPMS/glite-lb-config-1.2.3-1.noarch.rpm</a></span></span></p>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt;color:windowtext;text-decoration:none'>apt-get install
- glite-lb-config</span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>org.glite.deployment.config</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.1.1</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/noarch/RPMS/glite-config-1.1.1-3.noarch.rpm">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/noarch/RPMS/glite-config-1.1.1-3.noarch.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>org.glite.lb.client-interface</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.3</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/i386/RPMS/glite-lb-client-interface-1.0.3-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/i386/RPMS/glite-lb-client-interface-1.0.3-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.lb.</span><span
- lang=EN-US style='font-size:8.0pt'>common</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.1.4</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-common-1.1.4-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/i386/RPMS/glite-lb-common-1.1.4-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.lb.</span><span
- lang=EN-US style='font-size:8.0pt'>logger</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.1</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=IT style='font-size:
- 8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-logger-1.0.1-1.i386.rpm"><span
- lang=FR>http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/i386/RPMS/glite-lb-logger-1.0.1-1.i386.rpm</span></a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.lb.server</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>1.0.1</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=FR style='font-size:
- 8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-server-1.0.1-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/i386/RPMS/glite-lb-server-1.0.1-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.lb.</span><span
- lang=EN-US style='font-size:8.0pt'>server-bones</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.0</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-server-bones-1.0.0-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/i386/RPMS/glite-lb-server-bones-1.0.0-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.lb.</span><span
- lang=EN-US style='font-size:8.0pt'>ws-interface</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.1</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-ws-interface-1.0.1-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/i386/RPMS/glite-lb-ws-interface-1.0.1-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>org.glite.security.proxyrenewal</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.13</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/i386/RPMS/glite-security-proxyrenewal-1.0.13-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/i386/RPMS/glite-security-proxyrenewal-1.0.13-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.wms-utils.exception</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.1</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-wms-utils-exception-1.0.1-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/i386/RPMS/glite-wms-utils-exception-1.0.1-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>org.glite.wms-utils.jobid</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.0</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-wms-utils-jobid-1.0.0-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/i386/RPMS/glite-wms-utils-jobid-1.0.0-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.security.voms</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.2.32</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-security-voms-1.2.32-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/i386/RPMS/glite-security-voms-1.2.32-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>org.gridsite.core</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.1.5</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/gridsite-1.1.5-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/bin/rhel30/i386/RPMS/gridsite-1.1.5-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
-</table>
-
-<p class=MsoNormal><span lang=EN-US> </span></p>
-
-<h1>4. Dependencies</h1>
-
-<p class=MsoNormal>The gLite Logging & Bookkeeping Server v. 1.2.2 module
-has the following dependencies:</p>
-
-<p class=MsoNormal> </p>
-
-<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 width=621
- style='width:466.1pt;border-collapse:collapse;border:none'>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>Component name</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>Version</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>RPM file name</span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US
- style='font-size:8.0pt'>gLite Security Utilities</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.1</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/installers/glite-security-utils_installer.sh">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/installers/glite-security-utils_installer.sh</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US
- style='font-size:8.0pt'>gLite </span><span style='font-size:8.0pt'>R-GMA </span><span
- lang=EN-US style='font-size:8.0pt'>Service Publisher</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>4.2.0</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/installers/glite-rgma-servicetool_installer.sh">http://glite.web.cern.ch/glite/packages/R1.1/R20050430/installers/glite-rgma-servicetool_installer.sh</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>GPT</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>VDT 1.2.2</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/gpt-VDT1.2.2rh9-1.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/gpt-<span
- lang=EN-GB>VDT1.2.2rh9</span>-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>VDT Globus Essentials</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>VDT 1.2.2</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/vdt_globus_essentials-VDT1.2.2rh9-1.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/vdt_globus_essentials-<span
- lang=EN-GB>VDT1.2.2rh9</span>-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>MySQL-server</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>4.0.20</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/MySQL-server-4.0.20-0.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/MySQL-server-<span
- lang=EN-GB>4.0.20</span>-0.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>MySQL-client</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>4.0.20</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/MySQL-client-4.0.20-0.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/MySQL-client-<span
- lang=EN-GB>4.0.20</span>-0.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>ares</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>1.1.1</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/ares-1.1.1-EGEE.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/ares-<span
- lang=EN-GB>1.1.1</span>-EGEE.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>myproxy</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>1.14</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/myproxy-1.14-EGEE.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/myproxy-<span
- lang=EN-GB>1.14</span>-EGEE.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>perl-Expect.pm</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>1.01</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/per-Expect.pm-1.01-9.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/per-Expect.pm-<span
- lang=EN-GB>1.01</span>-9.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>Java SDK/JRE</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>1.4.2</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'>http://java.sun.com/j2se/1.4.2/download.html</span></span></p>
- </td>
- </tr>
-</table>
-
-<p class=MsoNormal> </p>
-
-<h1>5. Known bugs and issues</h1>
-
-<p class=MsoNormal align=left style='text-align:left'>This release has the
-following bugs and issues. Bug numbers refer to the gLite Bug Tracking system
-database hosted on the CERN Savannah system at <a
-href="https://savannah.cern.ch/bugs/?group=jra1mdw">https://savannah.cern.ch/bugs/?group=jra1mdw</a>
-.</p>
-
-<p class=MsoNormal align=left style='text-align:left'> </p>
-
-<ul style='margin-top:0mm' type=disc>
- <li class=MsoNormal style='text-align:left'>If the mysql root password is set
- and it is not specified in the mysql.conf file, the configuration script
- fails. This bug will be fixed in the next release</li>
- <li class=MsoNormal style='text-align:left'>No removal procedure is provided
- with this release apart from the removal of the RPMS. Any account, group
- or other resource created during the module configuration must be manually
- cleaned.</li>
-</ul>
-
-<p class=MsoNormal align=left style='text-align:left'> </p>
-
-<p class=MsoNormal align=left style='text-align:left'>Known open bugs:</p>
-
-<p class=MsoNormal align=left style='text-align:left'> </p>
-
-<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
- style='border-collapse:collapse;border:none'>
- <tr>
- <td width=59 valign=top style='width:44.35pt;border:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'>Bug number</span></p>
- </td>
- <td width=543 valign=top style='width:407.6pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'>Description</span></p>
- </td>
- <td width=17 valign=top style='width:12.45pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7053"><span
- style='color:windowtext;text-decoration:none'> #7053</span></a></span></p>
- </td>
- <td width=543 valign=top style='width:407.6pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7053"><span
- style='color:windowtext;text-decoration:none'>LB configuration fails if the
- mysql root pwd is set</span></a> </span></p>
- </td>
- <td width=17 valign=top style='width:12.45pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7237"><span
- style='color:windowtext;text-decoration:none'> #7237</span></a></span></p>
- </td>
- <td width=543 valign=top style='width:407.6pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7237"><span
- style='color:windowtext;text-decoration:none'>Intermittent errors with job
- submission</span></a> </span></p>
- </td>
- <td width=17 valign=top style='width:12.45pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7300"><span
- style='color:windowtext;text-decoration:none'> #7300</span></a></span></p>
- </td>
- <td width=543 valign=top style='width:407.6pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7300"><span
- style='color:windowtext;text-decoration:none'>update of the lb instructions
- at the end of the installer script </span></a> </span></p>
- </td>
- <td width=17 valign=top style='width:12.45pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7305"><span
- style='color:windowtext;text-decoration:none'> #7305</span></a></span></p>
- </td>
- <td width=543 valign=top style='width:407.6pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7305"><span
- style='color:windowtext;text-decoration:none'>lb.database.username paramenter
- in config file</span></a> </span></p>
- </td>
- <td width=17 valign=top style='width:12.45pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7307"><span
- style='color:windowtext;text-decoration:none'> #7307</span></a></span></p>
- </td>
- <td width=543 valign=top style='width:407.6pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7307"><span
- style='color:windowtext;text-decoration:none'>lb config script does _not_
- fail if mysql root password is set</span></a> </span></p>
- </td>
- <td width=17 valign=top style='width:12.45pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7324"><span
- style='color:windowtext;text-decoration:none'> #7324</span></a></span></p>
- </td>
- <td width=543 valign=top style='width:407.6pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7324"><span
- style='color:windowtext;text-decoration:none'>lb-bkserver is running with no
- pid</span></a> </span></p>
- </td>
- <td width=17 valign=top style='width:12.45pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7389"><span
- style='color:windowtext;text-decoration:none'> #7389</span></a></span></p>
- </td>
- <td width=543 valign=top style='width:407.6pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7389"><span
- style='color:windowtext;text-decoration:none'>LB server and WMS local logger
- related issues</span></a> </span></p>
- </td>
- <td width=17 valign=top style='width:12.45pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
-</table>
-
-<p class=MsoNormal> </p>
-
-<p class=MsoNormal>Bugs fixed in this or previous releases, but not yet officially
-tested:</p>
-
-<p class=MsoNormal> </p>
-
-<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
- style='border-collapse:collapse;border:none'>
- <tr>
- <td width=57 valign=top style='width:43.05pt;border:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'>Bug number</span></p>
- </td>
- <td width=536 valign=top style='width:401.8pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'>Description</span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6412"><span
- style='color:windowtext;text-decoration:none'> #6412</span></a></span></p>
- </td>
- <td width=536 valign=top style='width:401.8pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6412"><span
- style='color:windowtext;text-decoration:none'>--start and --stop options not
- documented in glite-ce-config.py, glite-lb-config.py</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6722"><span
- style='color:windowtext;text-decoration:none'> #6722</span></a></span></p>
- </td>
- <td width=536 valign=top style='width:401.8pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6722"><span
- style='color:windowtext;text-decoration:none'>glite-job-status -all doesn't
- work</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7151"><span
- style='color:windowtext;text-decoration:none'> #7151</span></a></span></p>
- </td>
- <td width=536 valign=top style='width:401.8pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7151"><span
- style='color:windowtext;text-decoration:none'>There are conflicts when
- installing WMS and LB on the same node</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7180"><span
- style='color:windowtext;text-decoration:none'> #7180</span></a></span></p>
- </td>
- <td width=536 valign=top style='width:401.8pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7180"><span
- style='color:windowtext;text-decoration:none'>Logging & Bookkeping UI </span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7321"><span
- style='color:windowtext;text-decoration:none'> #7321</span></a></span></p>
- </td>
- <td width=536 valign=top style='width:401.8pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7321"><span
- style='color:windowtext;text-decoration:none'>creation of indices fails
- randomly</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7884"><span
- style='color:windowtext;text-decoration:none'> #7884</span></a></span></p>
- </td>
- <td width=536 valign=top style='width:401.8pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7884"><span
- style='color:windowtext;text-decoration:none'>local header files distributed
- in RPMs. </span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7910"><span
- style='color:windowtext;text-decoration:none'> #7910</span></a></span></p>
- </td>
- <td width=536 valign=top style='width:401.8pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7910"><span
- style='color:windowtext;text-decoration:none'>Duplicate apostroph in MySQL
- calls</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
-</table>
-
-<p class=MsoNormal align=left style='margin:0mm;margin-bottom:.0001pt;
-text-align:left;text-autospace:none'><span lang=EN-US style='font-size:10.0pt;
-font-family:"Courier New"'> </span></p>
-
-<h1>6. Bugs closed since last release</h1>
-
-<p class=MsoNormal align=left style='text-align:left'>This release fixes the
-following bugs and issues. Bug numbers refer to the gLite Bug Tracking system
-database hosted on the CERN Savannah system at <a
-href="https://savannah.cern.ch/bugs/?group=jra1mdw">https://savannah.cern.ch/bugs/?group=jra1mdw</a>
- </p>
-
-<p class=MsoNormal align=left style='text-align:left'> </p>
-
-<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
- style='border-collapse:collapse;border:none'>
- <tr>
- <td width=87 valign=top style='width:64.95pt;border:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'>Bug number</span></p>
- </td>
- <td width=533 valign=top style='width:399.45pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'>Description</span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5850"><span
- style='color:windowtext;text-decoration:none'> #5850</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5850"><span
- style='color:windowtext;text-decoration:none'>glite-lb-config.py has
- glite.location and globus.location not set in params[]</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td width=87 valign=top style='width:64.95pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5901"><span
- style='color:windowtext;text-decoration:none'> #5901</span></a></span></p>
- </td>
- <td width=533 valign=top style='width:399.45pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5901"><span
- style='color:windowtext;text-decoration:none'>mysqlaccess command fails with
- Broken pipe if mysql socket file is in /tmp </span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5908"><span
- style='color:windowtext;text-decoration:none'> #5908</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5908"><span
- style='color:windowtext;text-decoration:none'>Environment variables set via
- the configuration script are not passed to daemon startup scripts</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6057"><span
- style='color:windowtext;text-decoration:none'> #6057</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6057"><span
- style='color:windowtext;text-decoration:none'>glite-lb configuration scripts
- has missing dependency (CGI.pm)</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6075"><span
- style='color:windowtext;text-decoration:none'> #6075</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6075"><span
- style='color:windowtext;text-decoration:none'>glite-lb-config.py crashes with
- KeyError: GLITE_CERT_DIR</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6190"><span
- style='color:windowtext;text-decoration:none'> #6190</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6190"><span
- style='color:windowtext;text-decoration:none'>LB local logger doesn't start
- on the CE node</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6366"><span
- style='color:windowtext;text-decoration:none'> #6366</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6366"><span
- style='color:windowtext;text-decoration:none'>LB install script:: Fails but
- no error reported</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6415"><span
- style='color:windowtext;text-decoration:none'> #6415</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6415"><span
- style='color:windowtext;text-decoration:none'>glite-lb-bkserver does not
- start and blocks execution of glite-lb-config.py</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7296"><span
- style='color:windowtext;text-decoration:none'> #7296</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7296"><span
- style='color:windowtext;text-decoration:none'>glite-lb-config.py crashes with
- a TypeError exception</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7753"><span
- style='color:windowtext;text-decoration:none'> #7753</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7753"><span
- style='color:windowtext;text-decoration:none'>glite-lb-config.py fails with
- an indentation error</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7976"><span
- style='color:windowtext;text-decoration:none'> #7976</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7976"><span
- style='color:windowtext;text-decoration:none'>edg-job-status not working with
- voms proxies</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=8094"><span
- style='color:windowtext;text-decoration:none'> #8094</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=8094"><span
- style='color:windowtext;text-decoration:none'>interlogd on the WMS doesn't
- restart</span></a> </span></p>
- </td>
- </tr>
-</table>
-
-<p class=MsoNormal align=left style='text-align:left'> </p>
-
-<b><span style='font-size:12.0pt;font-family:Arial;text-transform:uppercase;
-layout-grid-mode:line'><br clear=all style='page-break-before:always'>
-</span></b>
-
-<h1>7. Previous Releases</h1>
-
-<h2>7.1. Release 1.2.2</h2>
-
-<h3><span lang=FR>7.1.1. </span><span lang=FR>Release Description</span></h3>
-
-<p class=MsoNormal>This release contains the gLite Logging & Bookkeeping
-Server module v. 1.2.2. The following sections provide additional information
-about the release content, the module dependencies, the know bugs and issues
-and a list of bugs closed since the previous release. For information about
-installing and using the gLite Logging & Bookkeeping Server, please refer
-to the gLite Installation and User Guides. </p>
-
-<h3><span lang=FR>7.1.2. </span><span lang=FR>Changes in this Release</span></h3>
-
-<p class=MsoNormal>This release introduces the following changes:</p>
-
-<p class=MsoNormal> </p>
-
-<ul style='margin-top:0mm' type=disc>
- <li class=MsoNormal>Implemented status method</li>
- <li class=MsoNormal>Added definition of PERL5LIB env var</li>
- <li class=MsoNormal>Stopping and starting the database before the index
- creation (just after the database is created and the user granted) to fix
- access denied error</li>
- <li class=MsoNormal>Moved creation of indices inside database creation (if
- database exists indices must not be recreated)</li>
- <li class=MsoNormal>GLITE_USER parameter is not exposed anymore in the
- configuration file; instead the module uses the same user parameters as
- WMS to allow installation on same node</li>
- <li class=MsoNormal>LB admin tools are now installed in sbin, not in bin</li>
- <li class=MsoNormal>Bug fixes (see below for the complete lists)</li>
-</ul>
-
-<h3>7.1.3. Release contents</h3>
-
-<p class=MsoNormal>The gLite Logging & Bookkeeping Server v. 1.2.2 is
-composed of the following gLite components:</p>
-
-<p class=MsoNormal> </p>
-
-<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 width=621
- style='width:466.1pt;border-collapse:collapse;border:none'>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>Component name</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>Version</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>File</span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>org.glite.deployment.lb</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.2.2</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/installers/glite-lb_installer.sh">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/installers/glite-lb_installer.sh</a>
- </span></p>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/noarch/RPMS/glite-lb-config-1.2.2-1.noarch.rpm">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/noarch/RPMS/glite-lb-config-1.2.2-1.noarch.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>org.glite.deployment.config</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.0</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/noarch/RPMS/glite-config-1.0.0-1.noarch.rpm">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/noarch/RPMS/glite-config-1.0.0-1.noarch.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.lb.client-interface</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.2</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-client-interface-1.0.2-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-client-interface-1.0.2-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.lb.</span><span
- lang=EN-US style='font-size:8.0pt'>common</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.1.4</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-common-1.1.4-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-common-1.1.4-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.lb.</span><span
- lang=EN-US style='font-size:8.0pt'>logger</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.1</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=IT style='font-size:
- 8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-logger-1.0.1-1.i386.rpm"><span
- lang=FR>http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-logger-1.0.1-1.i386.rpm</span></a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.lb.server</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>1.0.1</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=FR style='font-size:
- 8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-server-1.0.1-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-server-1.0.1-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.lb.</span><span
- lang=EN-US style='font-size:8.0pt'>server-bones</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.0</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-server-bones-1.0.0-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-server-bones-1.0.0-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.lb.</span><span
- lang=EN-US style='font-size:8.0pt'>ws-interface</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.1</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-ws-interface-1.0.1-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-lb-ws-interface-1.0.1-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>org.glite.security.proxyrenewal</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.11</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-security-proxyrenewal-1.0.11-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-security-proxyrenewal-1.0.11-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.wms-utils.exception</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.1</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-wms-utils-exception-1.0.1-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-wms-utils-exception-1.0.1-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>org.glite.wms-utils.jobid</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.0</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-wms-utils-jobid-1.0.0-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-wms-utils-jobid-1.0.0-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=FR style='font-size:8.0pt'>org.glite.security.voms</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.2.32</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-security-voms-1.2.32-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/glite-security-voms-1.2.32-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=153 valign=top style='width:115.0pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>org.gridsite.core</span></p>
- </td>
- <td width=54 valign=top style='width:40.15pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.1.5</span></p>
- </td>
- <td width=415 valign=top style='width:310.95pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/gridsite-1.1.5-1.i386.rpm">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/bin/rhel30/i386/RPMS/gridsite-1.1.5-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
-</table>
-
-<p class=MsoNormal><span lang=EN-US> </span></p>
-
-<h3>7.1.4. Dependencies</h3>
-
-<p class=MsoNormal>The gLite Logging & Bookkeeping Server v. 1.2.2 module
-has the following dependencies:</p>
-
-<p class=MsoNormal> </p>
-
-<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 width=621
- style='width:466.1pt;border-collapse:collapse;border:none'>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>Component name</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>Version</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>RPM file name</span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US
- style='font-size:8.0pt'>gLite Security Utilities</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>1.0.0</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/installers/glite-security-utils_installer.sh">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/installers/glite-security-utils_installer.sh</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span lang=EN-US
- style='font-size:8.0pt'>gLite </span><span style='font-size:8.0pt'>R-GMA </span><span
- lang=EN-US style='font-size:8.0pt'>Service Publisher</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=EN-US style='font-size:8.0pt'>4.1.5</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/R1.0/R20050331/installers/glite-rgma-servicetool_installer.sh">http://glite.web.cern.ch/glite/packages/R1.0/R20050331/installers/glite-rgma-servicetool_installer.sh</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>GPT</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>VDT 1.2.2</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/gpt-VDT1.2.2rh9-1.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/gpt-<span
- lang=EN-GB>VDT1.2.2rh9</span>-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>VDT Globus Essentials</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>VDT 1.2.2</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/vdt_globus_essentials-VDT1.2.2rh9-1.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/vdt_globus_essentials-<span
- lang=EN-GB>VDT1.2.2rh9</span>-1.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>MySQL-server</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>4.0.20</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/MySQL-server-4.0.20-0.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/MySQL-server-<span
- lang=EN-GB>4.0.20</span>-0.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>MySQL-client</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>4.0.20</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/MySQL-client-4.0.20-0.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/MySQL-client-<span
- lang=EN-GB>4.0.20</span>-0.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>ares</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>1.1.1</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/ares-1.1.1-EGEE.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/ares-<span
- lang=EN-GB>1.1.1</span>-EGEE.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>myproxy</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>1.14</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/myproxy-1.14-EGEE.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/myproxy-<span
- lang=EN-GB>1.14</span>-EGEE.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>perl-Expect.pm</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>1.01</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'><a
- href="http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/per-Expect.pm-1.01-9.i386.rpm">http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/per-Expect.pm-<span
- lang=EN-GB>1.01</span>-9.i386.rpm</a></span></span></p>
- </td>
- </tr>
- <tr>
- <td width=158 valign=top style='width:118.6pt;border:solid windowtext 1.0pt;
- border-top:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal align=left style='text-align:left'><span style='font-size:
- 8.0pt'>Java SDK/JRE</span></p>
- </td>
- <td width=66 valign=top style='width:49.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:8.0pt'>1.4.2</span></p>
- </td>
- <td width=398 valign=top style='width:298.25pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span class=MsoHyperlink><span lang=EN-US
- style='font-size:8.0pt'>http://java.sun.com/j2se/1.4.2/download.html</span></span></p>
- </td>
- </tr>
-</table>
-
-<p class=MsoNormal> </p>
-
-<h3>7.1.5. Known bugs and issues</h3>
-
-<p class=MsoNormal align=left style='text-align:left'>This release has the
-following bugs and issues. Bug numbers refer to the gLite Bug Tracking system
-database hosted on the CERN Savannah system at <a
-href="https://savannah.cern.ch/bugs/?group=jra1mdw">https://savannah.cern.ch/bugs/?group=jra1mdw</a>
-.</p>
-
-<p class=MsoNormal align=left style='text-align:left'> </p>
-
-<ul style='margin-top:0mm' type=disc>
- <li class=MsoNormal style='text-align:left'>No removal procedure is provided
- with this release apart from the removal of the RPMS. Any account, group
- or other resource created during the module configuration must be manually
- cleaned.</li>
-</ul>
-
-<p class=MsoNormal align=left style='text-align:left'> </p>
-
-<p class=MsoNormal align=left style='text-align:left'>Known open bugs:</p>
-
-<p class=MsoNormal align=left style='text-align:left'> </p>
-
-<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
- style='border-collapse:collapse;border:none'>
- <tr>
- <td width=59 valign=top style='width:44.05pt;border:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'>Bug number</span></p>
- </td>
- <td width=534 valign=top style='width:400.8pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'>Description</span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6412"><span
- style='color:windowtext;text-decoration:none'> #6412</span></a></span></p>
- </td>
- <td width=534 valign=top style='width:400.8pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6412"><span
- style='color:windowtext;text-decoration:none'>--start and --stop options not
- documented in glite-ce-config.py, glite-lb-config.py</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7053"><span
- style='color:windowtext;text-decoration:none'> #7053</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7053"><span
- style='color:windowtext;text-decoration:none'>LB configuration fails if the
- mysql root pwd is set</span></a> </span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7180"><span
- style='color:windowtext;text-decoration:none'> #7180</span></a></span></p>
- </td>
- <td width=534 valign=top style='width:400.8pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7180"><span
- style='color:windowtext;text-decoration:none'>Logging & Bookkeping UI </span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7237"><span
- style='color:windowtext;text-decoration:none'> #7237</span></a></span></p>
- </td>
- <td width=534 valign=top style='width:400.8pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7237"><span
- style='color:windowtext;text-decoration:none'>Intermittent errors with job
- submission</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7300"><span
- style='color:windowtext;text-decoration:none'> #7300</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7300"><span
- style='color:windowtext;text-decoration:none'>update of the lb instructions
- at the end of the installer script </span></a> </span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7305"><span
- style='color:windowtext;text-decoration:none'> #7305</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7305"><span
- lang=IT style='color:windowtext;text-decoration:none'>lb.database.username
- paramenter in config file</span></a></span><span lang=IT style='font-size:
- 10.0pt'> </span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span lang=IT style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7307"><span
- lang=IT style='color:windowtext;text-decoration:none'> </span><span
- style='color:windowtext;text-decoration:none'>#7307</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7307"><span
- style='color:windowtext;text-decoration:none'>lb config script does _not_
- fail if mysql root password is set</span></a> </span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7321"><span
- style='color:windowtext;text-decoration:none'> #7321</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7321"><span
- style='color:windowtext;text-decoration:none'>creation of indices fails
- randomly</span></a> </span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7324"><span
- style='color:windowtext;text-decoration:none'> #7324</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7324"><span
- style='color:windowtext;text-decoration:none'>lb-bkserver is running with no
- pid</span></a> </span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7389"><span
- style='color:windowtext;text-decoration:none'> #7389</span></a></span></p>
- </td>
- <td width=534 valign=top style='width:400.8pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7389"><span
- style='color:windowtext;text-decoration:none'>LB server and WMS local logger
- related issues</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
-</table>
-
-<p class=MsoNormal> </p>
-
-<p class=MsoNormal>Bugs fixed in this or previous releases, but not yet
-officially tested:</p>
-
-<p class=MsoNormal> </p>
-
-<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
- style='border-collapse:collapse;border:none'>
- <tr>
- <td width=58 valign=top style='width:43.3pt;border:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'>Bug number</span></p>
- </td>
- <td width=535 valign=top style='width:401.55pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'>Description</span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5850"><span
- style='color:windowtext;text-decoration:none'> #5850</span></a></span></p>
- </td>
- <td width=535 valign=top style='width:401.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5850"><span
- style='color:windowtext;text-decoration:none'>glite-lb-config.py has
- glite.location and globus.location not set in params[]</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5908"><span
- style='color:windowtext;text-decoration:none'> #5908</span></a></span></p>
- </td>
- <td width=535 valign=top style='width:401.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5908"><span
- style='color:windowtext;text-decoration:none'>Environment variables set via
- the configuration script are not passed to daemon startup scripts</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6075"><span
- style='color:windowtext;text-decoration:none'> #6075</span></a></span></p>
- </td>
- <td width=535 valign=top style='width:401.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6075"><span
- style='color:windowtext;text-decoration:none'>glite-lb-config.py crashes with
- KeyError: GLITE_CERT_DIR</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6366"><span
- style='color:windowtext;text-decoration:none'> #6366</span></a></span></p>
- </td>
- <td width=535 valign=top style='width:401.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6366"><span
- style='color:windowtext;text-decoration:none'>LB install script:: Fails but
- no error reported</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6415"><span
- style='color:windowtext;text-decoration:none'> #6415</span></a></span></p>
- </td>
- <td width=535 valign=top style='width:401.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6415"><span
- style='color:windowtext;text-decoration:none'>glite-lb-bkserver does not
- start and blocks execution of glite-lb-config.py</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6689"><span
- style='color:windowtext;text-decoration:none'> #6689</span></a></span></p>
- </td>
- <td width=535 valign=top style='width:401.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6689"><span
- style='color:windowtext;text-decoration:none'>glite-proxy-renewd starts the
- daemon glite-proxy-renewd as GLITE_USER which is glite-lb i.e. wrong</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6722"><span
- style='color:windowtext;text-decoration:none'> #6722</span></a></span></p>
- </td>
- <td width=535 valign=top style='width:401.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6722"><span
- style='color:windowtext;text-decoration:none'>glite-job-status -all doesn't
- work</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7296"><span
- style='color:windowtext;text-decoration:none'> #7296</span></a></span></p>
- </td>
- <td width=535 valign=top style='width:401.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7296"><span
- style='color:windowtext;text-decoration:none'>glite-lb-config.py crashes with
- a TypeError exception</span></a> </span></p>
- </td>
- <td width=26 valign=top style='width:19.55pt;border-top:none;border-left:
- none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'> </span></p>
- </td>
- </tr>
-</table>
-
-<p class=MsoNormal align=left style='margin:0mm;margin-bottom:.0001pt;
-text-align:left;text-autospace:none'><span lang=EN-US style='font-size:10.0pt;
-font-family:"Courier New"'> </span></p>
-
-<h3>7.1.6. Bugs closed since last release</h3>
-
-<p class=MsoNormal align=left style='text-align:left'>This release fixes the
-following bugs and issues. Bug numbers refer to the gLite Bug Tracking system
-database hosted on the CERN Savannah system at <a
-href="https://savannah.cern.ch/bugs/?group=jra1mdw">https://savannah.cern.ch/bugs/?group=jra1mdw</a>
- </p>
-
-<p class=MsoNormal align=left style='text-align:left'> </p>
-
-<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
- style='border-collapse:collapse;border:none'>
- <tr>
- <td width=103 valign=top style='width:77.45pt;border:solid windowtext 1.0pt;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'>Bug number</span></p>
- </td>
- <td width=516 valign=top style='width:386.95pt;border:solid windowtext 1.0pt;
- border-left:none;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'>Description</span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5833"><span
- style='color:windowtext;text-decoration:none'> #5833</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5833"><span
- style='color:windowtext;text-decoration:none'>all jobs in SUBMITTED after a
- job storm</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5897"><span
- style='color:windowtext;text-decoration:none'> #5897</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5897"><span
- style='color:windowtext;text-decoration:none'>I20041203 LB installation
- script has a missing dependency </span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5910"><span
- style='color:windowtext;text-decoration:none'> #5910</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5910"><span
- style='color:windowtext;text-decoration:none'>glite-lb configuration scripts
- don't set GLITE_USER environment</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5925"><span
- style='color:windowtext;text-decoration:none'> #5925</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=5925"><span
- style='color:windowtext;text-decoration:none'>Running glite-lb script removes
- mysql.sock file </span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6416"><span
- style='color:windowtext;text-decoration:none'> #6416</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=6416"><span
- style='color:windowtext;text-decoration:none'>the BKserver on the LB machine
- needs a symlink and the script doesn't check for it</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7032"><span
- style='color:windowtext;text-decoration:none'> #7032</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7032"><span
- style='color:windowtext;text-decoration:none'>The LB installer fails with an
- RPM not found message</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7152"><span
- style='color:windowtext;text-decoration:none'> #7152</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7152"><span
- style='color:windowtext;text-decoration:none'>The LB installer tries to
- install gridsite with a wrong rpm name</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7351"><span
- style='color:windowtext;text-decoration:none'> #7351</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7351"><span
- style='color:windowtext;text-decoration:none'>Star/restart of LB services </span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7401"><span
- style='color:windowtext;text-decoration:none'> #7401</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7401"><span
- style='color:windowtext;text-decoration:none'>The first time the LB config
- script is run it fails creating the db indices</span></a> </span></p>
- </td>
- </tr>
- <tr>
- <td valign=top style='border:solid windowtext 1.0pt;border-top:none;
- padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7423"><span
- style='color:windowtext;text-decoration:none'> #7423</span></a></span></p>
- </td>
- <td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;
- border-right:solid windowtext 1.0pt;padding:0mm 5.4pt 0mm 5.4pt'>
- <p class=MsoNormal><span style='font-size:10.0pt'><a
- href="https://savannah.cern.ch/bugs/?func=detailitem&item_id=7423"><span
- style='color:windowtext;text-decoration:none'>'/etc/rc.d/init.d/gLite status'
- not working correctly in LB</span></a> </span></p>
- </td>
- </tr>
-</table>
-
-<p class=MsoNormal align=left style='text-align:left'> </p>
-
-<p class=MsoNormal> </p>
-
-</div>
-
-</body>
-
-</html>
+++ /dev/null
-glite-lb.sdf.xml
+++ /dev/null
-#Wed Apr 13 09:36:57 CEST 2005
-module.build=232
+++ /dev/null
-<?xml version ="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
--->
-
-<node name="glite-lb-node" version="@module.version@">
- <services>
- <service name="glite-lb-service">
- <components>
- <component name="glite-config"
- version="@org.glite.deployment.config.info.version@"
- age="@org.glite.deployment.config.info.age@"
- build="@org.glite.deployment.config.info.build@"
- arch="noarch"/>
-
- <component name="glite-lb-config"
- version="@module.version@"
- age="@module.age@"
- build="@module.build@"
- arch="noarch"/>
-
- <component name="glite-lb-client-interface"
- version="@org.glite.lb.client-interface.info.version@"
- age="@org.glite.lb.client-interface.info.age@"
- build="@org.glite.lb.client-interface.info.build@"
- arch="i386"/>
-
- <component name="glite-lb-ws-interface"
- version="@org.glite.lb.ws-interface.info.version@"
- age="@org.glite.lb.ws-interface.info.age@"
- build="@org.glite.lb.ws-interface.info.build@"
- arch="i386"/>
-
- <component name="glite-lb-logger"
- version="@org.glite.lb.logger.info.version@"
- age="@org.glite.lb.logger.info.age@"
- build="@org.glite.lb.logger.info.build@"
- arch="i386"/>
-
- <component name="glite-lb-common"
- version="@org.glite.lb.common.info.version@"
- age="@org.glite.lb.common.info.age@"
- build="@org.glite.lb.common.info.build@"
- arch="i386"/>
-
- <component name="glite-lb-server"
- version="@org.glite.lb.server.info.version@"
- age="@org.glite.lb.server.info.age@"
- build="@org.glite.lb.server.info.build@"
- arch="i386"/>
-
- <component name="glite-lb-server-bones"
- version="@org.glite.lb.server-bones.info.version@"
- age="@org.glite.lb.server-bones.info.age@"
- build="@org.glite.lb.server-bones.info.build@"
- arch="i386"/>
-
- <component name="glite-wms-utils-jobid"
- version="@org.glite.wms-utils.jobid.info.version@"
- age="@org.glite.wms-utils.jobid.info.age@"
- build="@org.glite.wms-utils.jobid.info.build@"
- arch="i386"/>
-
- <component name="glite-wms-utils-exception"
- version="@org.glite.wms-utils.exception.info.version@"
- age="@org.glite.wms-utils.exception.info.age@"
- build="@org.glite.wms-utils.exception.info.build@"
- arch="i386"/>
-
- <component name="glite-security-proxyrenewal"
- version="@org.glite.security.proxyrenewal.info.version@"
- age="@org.glite.security.proxyrenewal.info.age@"
- build="@org.glite.security.proxyrenewal.info.build@"
- arch="i386"/>
- <component name="glite-security-voms"
- version="@org.glite.security.voms.info.version@"
- age="@org.glite.security.voms.info.age@"
- build="@org.glite.security.voms.info.build@"
- arch="i386"/>
- <component name="gridsite"
- version="@org.gridsite.core.info.version@"
- age="@org.gridsite.core.info.age@"
- build="@org.gridsite.core.info.build@"
- arch="i386"/>
- </components>
- <dependencies>
- <external name="@ext.mysql-server.rpm.name@"
- version="@ext.mysql-server.version@"
- age="@ext.mysql-server.rpm.age@"
- arch="@ext.mysql-server.platform@"/>
- <external name="@ext.mysql-client.rpm.name@"
- version="@ext.mysql-client.version@"
- age="@ext.mysql-client.rpm.age@"
- arch="@ext.mysql-client.platform@"/>
- <external name="@ext.ares.rpm.name@"
- version="@ext.ares.version@"
- age="@ext.ares.rpm.age@"
- arch="@ext.ares.platform@"/>
- <external name="@ext.globus-essentials.rpm.name@"
- version="@ext.globus-essentials.rpm.version@"
- age="@ext.globus-essentials.rpm.age@"
- arch="@ext.globus-essentials.platform@"/>
- <external name="@ext.gpt.rpm.name@"
- version="@ext.gpt.rpm.version@"
- age="@ext.gpt.rpm.age@"
- arch="@ext.gpt.rpm.platform@"/>
- <external name="@ext.myproxy.rpm.name@"
- version="@ext.myproxy.rpm.version@"
- age="@ext.myproxy.rpm.age@"
- arch="@ext.myproxy.rpm.platform@"/>
- <external name="@ext.perl-expect-pm.rpm.name@"
- version="@ext.perl-expect-pm.version@"
- age="@ext.perl-expect-pm.rpm.age@"
- arch="@ext.perl-expect-pm.platform@"/>
- </dependencies>
- </service>
-
- <!-- Security Utilities -->
- <service name="glite-security-utils">
- <subservice name="glite-security-utils"/>
- </service>
- <!-- RGMA servicetool -->
- <service name="glite-rgma-servicetool">
- <subservice name="glite-rgma-servicetool"/>
- </service>
- </services>
- <dependencies>
- </dependencies>
-</node>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
- <xsl:output method="xml"
- indent="yes"
- encoding="UTF-8"
- omit-xml-declaration="yes"/>
-
- <!-- Definition of variables and parameters -->
- <xsl:param name="installers"/>
- <xsl:param name="repository"/>
- <xsl:param name="ext-repository"/>
-
- <!-- global processing -->
- <xsl:template match="/">
-#!/bin/sh
-
-# Copyright (c) Members of the EGEE Collaboration. 2004
-# See http://eu-egee.org/partners/ for details on the copyright holders
-# For license conditions see the license file or http://eu-egee.org/license.html
-
-# glite-lb_installer v. <xsl:value-of select="/node/@version"/>
-#
-# The glite-lb_installer installs the gLite Logging and Bookkeeping Server
-#
-# Usage: glite-lb_installer [-u|-v|--help]
-# -u uninstall
-# -v print version
-# --help print script usage info
-# Return codes: 0 - Ok
-# 1 - if a file could not be downloaded
-
-###############################################################################
-
-#Parse the RPMLIST to strip out the RPMS that are already installed
-function parseRPMList()
-{
- newRPMLIST=""
- localRPMLIST=`rpm -qa`
- for i in $RPMLIST
- do
- g=`echo $i | sed -e 's/\.i386\.rpm//g'`
- g=`echo $g | sed -e 's/\.noarch\.rpm//g'`
- if [ -z "`echo $localRPMLIST | grep $g`" ]; then
- newRPMLIST="${newRPMLIST} $i"
- else
- echo "$i is already installed. It will be skipped."
- fi
- done
-
- RPMLIST=$newRPMLIST
-}
-
-#Parse the SCRIPTLIST to execute all scripts
-function parseScriptList()
-{
- for i in $SCRIPTLIST
- do
- if [ "$INSTALL" = "true" ]; then
- $i
- else
- $i -u
- fi
- done
-}
-
-#Downloads and install the module RPMS
-function install()
-{
-
- INSTALL=true
- version
- echo
- echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- echo x Please wait, downloading the gLite Logging and Bookkeeping Server... x
- echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- echo
-
- mkdir -p glite-lb
- cd glite-lb
-
- # Download global dependencies
- <xsl:for-each select="node/dependencies">
- <xsl:apply-templates>
- <xsl:with-param name="install">true</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
-
- <xsl:for-each select="node/services/service">
-
- # Download <xsl:value-of select="@name"/> scripts from repository
- <xsl:for-each select=".">
- <xsl:apply-templates select="subservice">
- <xsl:with-param name="install">true</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
-
-
- # Download <xsl:value-of select="@name"/> dependencies RPMS from repository
- <xsl:for-each select="dependencies">
- <xsl:apply-templates>
- <xsl:with-param name="install">true</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
-
- # Download <xsl:value-of select="@name"/> RPMS from repository
- <xsl:for-each select="components">
- <xsl:apply-templates>
- <xsl:with-param name="install">true</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
-
- </xsl:for-each>
-
- # Download and install subservices
- parseScriptList
-
-
- # Install all RPMS
- echo
- echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- echo x Please wait, installing the gLite Logging and Bookkeeping Server... x
- echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- echo
- parseRPMList
- if [ ! -z "$RPMLIST" ]; then
- rpm -Uvh $RPMLIST
- rpm_return=$?
- else
- echo All required RPMS are already installed
- rpm_return=0
- fi
- if [ "$rpm_return" == "0" ]; then
- echo
- echo Done!
- echo
- echo Before using the gLite LB, please create or update the configuration
- echo file /opt/glite/etc/config/glite-lb.cfg.xml
- echo and run the configuration script
- echo /opt/glite/etc/config/scripts/glite-lb-config.py.
- echo A template is provided in
- echo /opt/glite/etc/config/templates/glite-lb.cfg.xml
- else
- echo
- echo An error occurred while installing the LB RPMS.
- echo Most likely one or more of the RPMS to be installed require
- echo additional dependencies or are older than already installed packages.
- echo Please refer to the rpm error message above for more details.
- fi
- echo
- echo For more information refer to the gLite Installation and User Guides
- echo or to the gLite web site \(http:\/\/www.glite.org\)
- echo Please report problems and comments to the gLite Team at
- echo project-eu-egee-glite-bugs@cern.ch
-
- cd ..
-}
-
-###############################################################################
-function uninstall()
-{
- version
-
- # Global dependencies
- <xsl:for-each select="node/dependencies">
- <xsl:apply-templates>
- <xsl:with-param name="install">false</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
-
- <xsl:for-each select="node/services/service">
-
- # <xsl:value-of select="@name"/> dependencies RPMS from repository
- <xsl:for-each select="dependencies">
- <xsl:apply-templates>
- <xsl:with-param name="install">false</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
-
- # <xsl:value-of select="@name"/> RPMS from repository
- <xsl:for-each select="components">
- <xsl:apply-templates>
- <xsl:with-param name="install">false</xsl:with-param>
- </xsl:apply-templates>
- </xsl:for-each>
-
- </xsl:for-each>
-
- # Uninstall all RPMS
- echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- echo x Please wait, uninstalling the gLite Logging and Bookkeeping Server... x
- echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- echo
- rpm -ev $RPMLIST
- if [ "$?" == "0" ]; then
- echo
- echo Done!
- else
- echo
- echo An error occurred while removing the LB RPMS.
- echo Most likely one or more of the RPMS to be removed have
- echo dependent packages.
- echo Please refer to the rpm error message above for more details.
- fi
-}
-
-###############################################################################
-function usage()
-{
- echo
- echo Copyright \(c\) Members of the EGEE Collaboration. 2004
- echo See http://eu-egee.org/partners/ for details on the copyright holders
- echo For license conditions see the license file or http://eu-egee.org/license.html
- echo
- echo glite-lb_installer v. <xsl:value-of select="/node/@version"/>
- echo
- echo The glite-lb_installer installs the gLite Logging and Bookkeeping Server
- echo
- echo Usage: glite-lb_installer \[-u\|-v\|--help\]
- echo -u uninstall
- echo -v print version
- echo --help print script usage info
- echo
- echo Return codes:
- echo 0 - Ok
- echo 1 - if a file could not be downloaded
- echo
-}
-
-###############################################################################
-function version
-{
- echo
- echo Copyright \(c\) Members of the EGEE Collaboration. 2004
- echo See http://eu-egee.org/partners/ for details on the copyright holders
- echo For license conditions see the license file or http://eu-egee.org/license.html
- echo
- echo glite-lb_installer v. <xsl:value-of select="/node/@version"/>
- echo
-}
-
-
-RPMLIST=
-
-###############################################################################
-# Main
-
-while getopts uvh opt
-do
- case $opt in
- 'u') uninstall
- exit 0
- ;;
- 'v') version
- exit 0
- ;;
- 'h') usage
- exit 0
- ;;
- esac
-done
-
-install
-
-exit 0
- </xsl:template>
-
- <xsl:template name="subservices" match="subservice">
- <xsl:param name="install"/>
- <xsl:variable name="package"><xsl:value-of select="@name"/>_installer.sh</xsl:variable>
- <xsl:choose>
- <xsl:when test="$install = 'true'">
-wget -N --non-verbose <xsl:value-of select="$installers"/><xsl:value-of select="$package"/>
-if [ ! -f "<xsl:value-of select="$package"/>" ]
-then
- echo
- echo ERROR: <xsl:value-of select="$package"/> could not be downloaded!
- exit 1
-fi
-chmod u+x <xsl:value-of select="$package"/>
-SCRIPTLIST="$SCRIPTLIST ./<xsl:value-of select="$package"/>"
- </xsl:when>
- <xsl:otherwise>
-SCRIPTLISTUn="$SCRIPTLISTUn ./<xsl:value-of select="$package"/> -u "
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <xsl:template name="dependencies" match="external">
- <xsl:param name="install"/>
- <xsl:variable name="package"><xsl:value-of select="@name"/>-<xsl:value-of select="@version"/>-<xsl:value-of select="@age"/>.<xsl:value-of select="@arch"/>.rpm</xsl:variable>
- <xsl:variable name="package.name"><xsl:value-of select="@name"/>-<xsl:value-of select="@version"/>-<xsl:value-of select="@age"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="$install = 'true'">
-wget -N --non-verbose <xsl:value-of select="$ext-repository"/><xsl:value-of select="$package"/>
-if [ ! -f "<xsl:value-of select="$package"/>" ]
-then
- echo
- echo ERROR: <xsl:value-of select="$package"/> could not be downloaded!
- exit 1
-fi
-RPMLIST="$RPMLIST <xsl:value-of select="$package"/>"
- </xsl:when>
- <xsl:otherwise>
-RPMLIST="$RPMLIST <xsl:value-of select="$package.name"/>"
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="components" match="component">
- <xsl:param name="install"/>
- <xsl:variable name="package"><xsl:value-of select="@name"/>-<xsl:value-of select="@version"/>-<xsl:value-of select="@age"/>.<xsl:value-of select="@arch"/>.rpm</xsl:variable>
- <xsl:variable name="package.name"><xsl:value-of select="@name"/>-<xsl:value-of select="@version"/>-<xsl:value-of select="@age"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="$install='true'">
-wget -N --non-verbose <xsl:value-of select="$repository"/><xsl:value-of select="@arch"/>/RPMS/<xsl:value-of select="$package"/>
-if [ ! -f "<xsl:value-of select="$package"/>" ]
-then
- echo
- echo ERROR: <xsl:value-of select="$package"/> could not be downloaded!
- exit 1
-fi
-RPMLIST="$RPMLIST <xsl:value-of select="$package"/>"
- </xsl:when>
- <xsl:otherwise>
-RPMLIST="$RPMLIST <xsl:value-of select="$package.name"/>"
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
- <xsl:output method="xml"
- indent="yes"
- encoding="UTF-8"
- omit-xml-declaration="yes"/>
-
- <!-- Definition of variables and parameters -->
- <xsl:param name="repository"/>
- <xsl:param name="ext-repository"/>
-
- <!-- global processing -->
- <xsl:template match="/">
-#!/bin/sh
-#
-# glite-lb_tgz_installer
-# usage: glite-lb_tgz_installer [-u]
-# -u uninstall
-#
-# glite-lb_tgz_installer installs the gLite <xsl:value-of select="/node/@name"/> Deployment Unit from biniary tarballs
-#
-<!-- Put here pre-install instructions -->
-PREFIX=/opt/glite
-
-###############################################################################
-# Download global dependencies
- <xsl:for-each select="node/dependencies">
- <xsl:apply-templates/>
- </xsl:for-each>
-###############################################################################
-
- <xsl:for-each select="node/services/service">
-###############################################################################
-# Download <xsl:value-of select="@name"/> dependencies RPMS from repository
- <xsl:for-each select="dependencies">
- <xsl:apply-templates/>
- </xsl:for-each>
-###############################################################################
-# Download <xsl:value-of select="@name"/> RPMS from repository
- <xsl:for-each select="components">
- <xsl:apply-templates/>
- </xsl:for-each>
-###############################################################################
- </xsl:for-each>
-
- </xsl:template>
-
- <xsl:template name="dependencies" match="external">
- <xsl:variable name="package"><xsl:value-of select="@name"/>-<xsl:value-of select="@version"/>-<xsl:value-of select="@age"/>.<xsl:value-of select="@arch"/>.rpm</xsl:variable>
-wget <xsl:value-of select="$ext-repository"/><xsl:value-of select="$package"/>
- </xsl:template>
-
- <xsl:template name="components" match="component">
- <xsl:variable name="package"><xsl:value-of select="@name"/>-<xsl:value-of select="@version"/>_bin.tar.gz</xsl:variable>
-wget <xsl:value-of select="$repository"/>i386/tgz/<xsl:value-of select="$package"/>
-tar -xzf <xsl:value-of select="$package"/> $PREFIX
- </xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Common build properties file for the gLite LB Server Node Deployment Unit
-
- Author: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.1 2004/10/06 09:19:24 dimeglio
- First version of this file
-
--->
-
-<project name="gLite LB Server Deployment Unit common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property file="project/build.properties" />
-
- <!-- ======================================================
- Define corresponding subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${deployment.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${deployment.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define component properties
- ====================================================== -->
-
- <!-- Component name prefix -->
- <property name="component.prefix" value="lb" />
-
- <!-- ======================================================
- Define general component properties
- ====================================================== -->
-
- <import file="${component.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <property name="build.package.summary" value="gLite Logging and Bookkeeping node configuration files" />
- <property name="build.package.description" value="gLite Logging and Bookkeeping node configuration files" />
- <property name="build.package.files" value="
-%attr(755,root,root) %{prefix}/etc/config/scripts/glite-lb-config.py\n
-%attr(644,root,root) %{prefix}/etc/config/templates/glite-lb.cfg.xml\n
-%attr(644,root,root) %{prefix}/share/doc/glite-lb/release_notes/release_notes.doc\n
-%attr(644,root,root) %{prefix}/share/doc/glite-lb/release_notes/release_notes.pdf\n
-%attr(644,root,root) %{prefix}/share/doc/glite-lb/release_notes/release_notes.html\n"
- />
-
-</project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
- <xsl:output method="xml"
- indent="yes"
- encoding="UTF-8"
- omit-xml-declaration="yes"/>
-
- <!-- Definition of variables and parameters -->
-
- <!-- global processing -->
- <xsl:template match="/">
-template pro_software_glite_lb;
-
-#
-# Copyright (c) Members of the EGEE Collaboration. 2004
-# See http://eu-egee.org/partners/ for details on the copyright holders
-# For license conditions see the license file or http://eu-egee.org/license.html
-#
-# glite-lb Quattor template v. <xsl:value-of select="/node/@version"/>
-#
-
-# Global dependencies
- <xsl:for-each select="node/dependencies">
- <xsl:apply-templates/>
- </xsl:for-each>
-
- <xsl:for-each select="node/services/service">
-
-# <xsl:value-of select="@name"/> dependencies
- <xsl:for-each select="dependencies">
- <xsl:apply-templates/>
- </xsl:for-each>
-
-# <xsl:value-of select="@name"/> RPMS
- <xsl:for-each select="components">
- <xsl:apply-templates/>
- </xsl:for-each>
-
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="dependencies" match="external">
-"/software/packages"=pkg_repl("<xsl:value-of select="@name"/>","<xsl:value-of select="@version"/>-<xsl:value-of select="@age"/>","<xsl:value-of select="@arch"/>");
- </xsl:template>
-
- <xsl:template name="components" match="component">
-"/software/packages"=pkg_repl("<xsl:value-of select="@name"/>","<xsl:value-of select="@version"/>-<xsl:value-of select="@age"/>","<xsl:value-of select="@arch"/>");
- </xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-
-module.version = 1.3.0
-module.age = 1
-
\ No newline at end of file
+++ /dev/null
-# defaults
-top_srcdir=.
-builddir=build
-top_builddir=${top_srcdir}/${builddir}
-stagedir=.
-distdir=.
-globalprefix=glite
-jpprefix=jp
-package=glite-jp-client
-version=0.0.0
-PREFIX=/opt/glite
-
-glite_location=/opt/glite
-globus_prefix=/opt/globus
-nothrflavour=gcc32
-thrflavour=gcc32pthr
-expat_prefix=/opt/expat
-ares_prefix=/opt/ares
-gsoap_prefix=/software/gsoap-2.6
-
-CC=gcc
-
--include Makefile.inc
-
-STAGETO=include/${globalprefix}/${jpprefix}
-
-VPATH=${top_srcdir}/src:${top_srcdir}/examples:${top_srcdir}/project$:${top_srcdir}/interface:${stagedir}/interface:${top_srcdir}/build
-
-GLOBUS_LIBS:=-L${globus_prefix}/lib \
- -lglobus_common_${nothrflavour} \
- -lglobus_gssapi_gsi_${nothrflavour} \
- -lglobus_ftp_client_gcc32dbg \
- -lglobus_ftp_control_gcc32dbg
-
-GLOBUS_CFLAGS:=-I${globus_prefix}/include/${nothrflavour}
-
-DEBUG:=-g -O0 -DDEBUG
-
-CFLAGS:=${DEBUG} -I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${gsoap_prefix}/include -I${gsoap_prefix} -I${stagedir}/include ${GLOBUS_CFLAGS} -I${libtar}/include
-LDFLAGS:=-L${stagedir}/lib -L${libtar}/lib
-
-LINK:=libtool --mode=link ${CC} ${LDFLAGS}
-LTCOMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
-LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS}
-INSTALL:=libtool --mode=install install
-
-STAGE_HDRS:=jpcl_ctx_int.h
-HDRS:=jp_client.h jpimporter.h
-
-EXAMPLES:=jpps_upload_files
-
-LIBOBJS:=jpcl_ctx.o jpimp_lib.o
-LIBTHROBJS:=${LIBOBJS:.o=.thr.o}
-LIBLOBJS:=${LIBOBJS:.o=.lo}
-
-LIB:=libglite_jp_importer_${nothrflavour}.la
-THRLIB:=libglite_jp_importer_${thrflavour}.la
-
-daemon:=glite-jp-importer
-
-wsprefix:=jpps_
-
-SRCS:=jpimporter.c ${wsprefix}ClientLib.c ${wsprefix}C.c
-OBJS:=${SRCS:.c=.o}
-
-gsoap_bin_prefix:=${shell if [ -x ${gsoap_prefix}/bin/soapcpp2 ]; then echo ${gsoap_prefix}/bin; else echo ${gsoap_prefix}; fi }
-dotless_gsoap_ver:=${shell echo ${gsoap_version} | tr -d . }
-GSOAPLIB:=-lglite_security_gsoap_plugin_${dotless_gsoap_ver}_${nothrflavour}
-
-LBMAILDIRLIB:=-lglite_lb_maildir
-
-offset=0
-version_info:=-version-info ${shell \
- perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' }
-
-
-default all: compile
-
-compile: ${daemon} ${LIB} ${EXAMPLES}
-
-examples: ${EXAMPLES}
-
-${LIB}: ${LIBOBJS}
- ${LINK} ${version_info} -o $@ ${LIBLOBJS} -rpath ${glite_location}/lib ${LBMAILDIRLIB} -ltar
-
-${daemon}: ${OBJS}
- ${LINK} -o $@ ${OBJS} ${LBMAILDIRLIB} ${GSOAPLIB} ${GLOBUS_LIBS}
-
-${EXAMPLES}: ${LIB}
-${EXAMPLES}: %: %.o
- ${LINK} -o $@ $< ${LIB} ${LBMAILDIRLIB}
-
-
-
-JobProvenancePS.xh: %.xh: %.wsdl JobProvenanceTypes.wsdl typemap.dat
- cp ${stagedir}/interface/JobProvenanceTypes.wsdl .
- ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ $<
- rm -f JobProvenanceTypes.wsdl
-
-${wsprefix}Client.c ${wsprefix}ClientLib.c \
-${wsprefix}C.c ${wsprefix}H.h: JobProvenancePS.xh
- ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${wsprefix} JobProvenancePS.xh
-
-env_C.c env_Server.c:
- touch env.xh
- cp ${jpproject}/JobProvenanceTypes.wsdl .
- ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o env.xh JobProvenanceTypes.wsdl
- rm -f JobProvenanceTypes.wsdl
- ${gsoap_bin_prefix}/soapcpp2 -w -c -p env_ env.xh
-
-${OBJS}: ${wsprefix}H.h soap_version.h
-
-soap_version.h:
- ${gsoap_bin_prefix}/soapcpp2 /dev/null
- perl -ne '$$. == 2 && /.*([0-9])\.([0-9])\.([0-9]).*/ && printf "#define GSOAP_VERSION %d%02d%02d\n",$$1,$$2,$$3' soapH.h >$@
- -rm soapC.cpp soapH.h soapStub.h soapClient.cpp soapServer.cpp soapClientLib.cpp soapServerLib.cpp
-
-
-
-
-check:
- -echo nothing yet
-
-doc:
-
-stage: compile
- ${MAKE} PREFIX=${stagedir} DOSTAGE=yes install
-
-dist: distsrc distbin
-
-distsrc:
- mkdir -p ${top_srcdir}/${package}-${version}
- cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version}
- cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version}
- rm -rf ${top_srcdir}/${package}-${version}
-
-distbin:
- $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir}
- save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir
- rm -rf tmpbuilddir
-
-install:
- -mkdir -p ${PREFIX}/${STAGETO}
- -mkdir -p ${PREFIX}/bin
- -mkdir -p ${PREFIX}/examples
- ${INSTALL} -m 755 ${daemon} ${PREFIX}/bin
- ${INSTALL} -m 644 ${LIB} ${PREFIX}/lib
- ${INSTALL} -m 644 jpps_upload_files ${PREFIX}/examples/glite-jp-primary-upload_files
- cd ${top_srcdir}/interface && ${INSTALL} -m 644 ${HDRS} ${PREFIX}/${STAGETO}
- if [ x${DOSTAGE} = xyes ]; then \
- cd ${top_srcdir}/interface && ${INSTALL} -m 644 ${STAGE_HDRS} ${PREFIX}/${STAGETO} ; \
- fi
-
-
-clean:
-
-# we have no real config.h but have to force gSoap not to use
-# linux ftime with broken (aka obsolete) DST information
-stdsoap2.o: ${gsoap_prefix}/devel/stdsoap2.c
- test -f config.h || touch config.h
- @echo 'The following warning "time_t (de)serialization is not MT safe on this platform" is harmless'
- ${CC} -o $@ -c -DWITH_NONAMESPACES -DHAVE_CONFIG_H ${CFLAGS} ${gsoap_prefix}/devel/stdsoap2.c
-
-
-%.lo: %.c
- ${LTCOMPILE} -o $@ -c $<
-
-%.o: %.c
- ${LTCOMPILE} -o $@ -c $<
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Build file for the GLite JP Primary module
--->
-
-<project name="client" default="dist">
-
- <!-- =========================================
- Builds the gLite JP Primary Module
- ========================================= -->
-
- <!-- =========================================
- Import properties (order is important)
- ========================================= -->
-
- <!-- import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- import component build properties,
- component properties &
- component common properties -->
- <import file="./project/properties.xml"/>
-
- <!-- import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="${subsystem.properties.file}"/>
-
- <!-- import global build properties &
- global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependency property files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${component.dependencies.file}" />
- <property file="${subsystem.dependencies.file}" />
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options (order is important)
- ========================================= -->
- <import file="${global.configure.options.file}"/>
- <import file="${component.configure.options.file}"/>
-
- <!-- =========================================
- Import task definitions (order is important)
- ========================================= -->
- <import file="${subsystem.taskdefs.file}" />
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Load common targets
- ========================================= -->
- <import file="${global.targets-simple_make.file}" />
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ==============================================
- Local private targets
- ============================================== -->
-
- <target name="localinit"
- description="Module specific initialization tasks">
-
- <antcall target="lbmakefiles" />
- </target>
-
- <target name="localcompile"
- description="Module specific compile tasks">
- </target>
-
- <target name="localclean"
- description="Module specific cleaning tasks">
- </target>
-
-</project>
+++ /dev/null
-jpimporter is a daemon which take care of all job registration from particular
-LB server, forwarding them to the JP primary service and also file uploads, which
-means sending LB dumps, sendbox files etc. to ftp server dedicated by JP PS.
-
-The daemon runs two proceses, one for registrations and another for file uploads.
-Both processes reads the local directory which has a given structure and are
-handled by glite-lb-maildir library calls.
-
-</TODO add lb_maildir docs/>
-
-Namely for the registrations, LB server creates the message describing job, its
-owner and JP primary server address and stores it into given maildir location
-(i.e. /tmp/lb_server_jpreg/). The jpimporter daemon which is running on the same
-host is periodicaly scanning this directory and whenever new messages appears,
-attempts to register this described job to JP PS.
-
-For the file upload is the jpimporter behavior almost the same except the
-message has different structure and a file to deliver must be placed in the
-filesystem.
-
-For LB dumps, there is another utility, which parses common LB dump files
-(created when purging the LB server), creates one file per every job and stores
-message describing the location, destination etc. to local directory. This
-message directory should be obviously monitored by the jpimporter again.
-
-lb_dump_exporter utility usage: lt-lb_dump_exporter [option]
- -h, --help Shows this screen.
- -d, --dump <file> Dump file location.
- File generated by the glite-lb-purge
- -s, --store <prefix> New dump files storage.
- Directory, where to store all dump files
- -j, --jpps <host:port> Target JPPS.
- jpps where should the file be uploaded
- -m, --lbmaildir <path> LB maildir path.
- Directory, where should be stored the message
- describing the file upload (read by jpimporter)
-
-jpimporter daemon usage: glite-jp-importer [option]
- -h, --help displays this screen
- -k, --key private key file
- -c, --cert certificate file
- -C, --CAdir trusted certificates directory
- -g, --debug don't run as daemon, additional diagnostics
- -p, --jpps JP primary service server
- this JPPS server is used by default, when user/lb/...
- does not specifies one
- -r, --reg-mdir path to the 'LB maildir' subtree for registrations
- This directory is scanned for the job registration
- messages.
- -d, --dump-mdir path to the 'LB maildir' subtree for LB dumps
- This directory is scanned for the file upload msgs.
- -i, --pidfile file to store master pid
- -t, --poll maildir polling interval (in seconds)
- Specifies the time interval for which the process
- JobRegistration/FileUpload sleeps after the unsuccessful
- scan (find no new messages)
-Examples:
-
-So, for the job registration and dump upload from the LB server, you should run the
-LB server like this:
-./glite_lb_bkserverd -c <hostcert> -k <hostkey> -S /var/tmp/purge -D /var/tmp/dump -J /tmp/lb_server_jpreg
-
-(Whenever the job is registered to the LB server, the message for jpimporter
-is stored in the /tmp/lb_server_jpreg directory.)
-
-Then you should run the jpimporter daemon on the same host:
-./glite-jp-importer -k <hostcert> -k <hostkey> -p jpps.server.address:8900 -r /tmp/lb_server_jpreg -d /tmp/lb_server_jpdump
-
-(Every job registration anounced in /tmp/lb_server_jpreg directory will be sent
-to the JP PS at the address jpps.server.address:8900.)
-
-According the dump files - on the same host should be periodicaly ran the
-glite-lb-purge utility. (Usually started by cron) Let say, that it stores the
-LB dump file /var/tmp/purge/dump_file.
-
-Then you should run (most likely in the same cron job)
-./lb_dump_exporter -d /var/tmp/purge/dump_file -s /var/tmp/dumps_per_job -j jpps.server.address:8900 -m /tmp/lb_server_jpdump
-
-(Then there is created a set of LB dump file - one per job - and according to them
-lb_dump_exporter will also notify the glite-jp-importer)
-
-
-
-
-For the sandbox files, you should use the JP client API to create messages for
-jpimporter. The function glite_jpimporter_upload_files() do the job. It takes
-one ore more files and create one tarball. Then everything works like with
-LB dumps.
-
-There is an example utility in org.glite.jp.client/examples/jpps_upload_files.c
-(staged as glite-jp-primary-upload_files).
-
-The glite_jpimporter_upload_files funftion prototype:
-
-int glite_jpimporter_upload_files(
- /* JP client context.
- * stores the error code/description
- * user can set default JP PS address there and
- * LB directory for jpimporter announcements
- */
- glite_jpcl_context_t ctx,
-
- /* JobId
- */
- const char *jobid,
- /* File list. Stored in the array of string.
- * Last item has to be NULL
- */
- const char **files,
- /* Location of the user proxy file
- */
- const char *proxy);
-
-
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include "jp_client.h"
-#include "jpimporter.h"
-
-static char *myname;
-
-void usage(void)
-{
- fprintf(stderr,
- "Usage: %s [-h][-p user_proxy][-j jobid] file [file ...]\n"
- " -h show this help\n"
- " -p <file> path to the proxy filename\n"
- " -j <jobid> jobid string\n"
- " -m <dir> location of the lb maildir structure\n"
- " -s <addr:port> JP PS server address and port\n"
- , myname);
-}
-
-int main(int argc, char **argv)
-{
- glite_jpcl_context_t ctx;
- char **files,
- *jobid,
- *proxy,
- *lbmd = NULL,
- *jpps = NULL;
- int i, j;
-
-
- myname = strrchr(argv[0],'/');
- if ( myname ) myname++; else myname = argv[0];
-
- if ( argc < 2 ) { usage(); return 1; }
- for ( i = 1; i < argc; i++ ) {
- if ( argv[i][0] != '-' ) break;
- if ( argv[i][1] == 'j' ) jobid = argv[++i];
- else if ( argv[i][1] == 'p' ) proxy = argv[++i];
- else if ( argv[i][1] == 'm' ) lbmd = argv[++i];
- else if ( argv[i][1] == 's' ) jpps = argv[++i];
- else if ( argv[i][1] == 'h' || argv[i][1] == '?' ) {usage();return 0;}
- else {usage();return 1;}
- }
-
- if ( i >= argc ) { usage(); return 1; }
-
- if ( !(files = calloc(argc-i+1, sizeof(*files))) ) {
- perror("calloc()");
- return 1;
- }
- j = 0;
- while ( i < argc ) files[j++] = argv[i++];
-
- if ( glite_jpcl_InitContext(&ctx) ) {
- perror("glite_jpcl_InitContext()");
- return 1;
- }
-
- if ( lbmd ) glite_jpcl_SetParam(ctx, GLITE_JPCL_PARAM_LBMAILDIR, lbmd);
- if ( jpps ) glite_jpcl_SetParam(ctx, GLITE_JPCL_PARAM_JPPS, jpps);
-
- if ( glite_jpimporter_upload_files(ctx, jobid, files, proxy) ) {
- char *errt, *errd;
-
- glite_jpcl_Error(ctx, &errt, &errd);
- printf("Error calling glite_jpimporter_upload_files()\n\t%s: %s\n",
- errt, errd);
- glite_jpcl_FreeContext(ctx);
- return 1;
- }
-
- glite_jpcl_FreeContext(ctx);
- return 0;
-}
+++ /dev/null
-#ifndef __GLITE_JP_CLIENT__
-#define __GLITE_JP_CLIENT__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _glite_jpcl_context_t *glite_jpcl_context_t;
-
-typedef enum _glite_jpcl_ctx_param_t {
- GLITE_JPCL_PARAM_JPPS,
- GLITE_JPCL_PARAM_LBMAILDIR
-} glite_jpcl_ctx_param_t;
-
-extern int glite_jpcl_InitContext(glite_jpcl_context_t *);
-extern void glite_jpcl_FreeContext(glite_jpcl_context_t);
-
-extern int glite_jpcl_SetParam(
- glite_jpcl_context_t ctx,
- int param, ... );
-
-extern int glite_jpcl_Error(
- glite_jpcl_context_t ctx,
- char **errt,
- char **errd);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-#ifndef __GLITE_JPCLIENT_CONTEXT_INT
-#define __GLITE_JPCLIENT_CONTEXT_INT
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct _glite_jpcl_context_t {
- int errCode;
- char *errDesc;
-
- char *jpps;
- char *lbmd_dir;
-};
-
-extern int glite_jpcl_SetError(glite_jpcl_context_t, int, const char *);
-extern int glite_jpcl_ResetError(glite_jpcl_context_t);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-#ifndef __GLITE_JPIMPORTER__
-#define __GLITE_JPIMPORTER__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern int glite_jpimporter_upload_files(
- glite_jpcl_context_t ctx,
- const char *jobid,
- const char **files,
- const char *proxy);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-module.build=0
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Configuration options for the gLite JP client module
--->
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <project name="LB Common configuration options">
- <target name="lbmakefiles">
- <exec executable="ln" failonerror="true">
- <arg line="-fs ${component.dir}/Makefile ${module.build.dir}/Makefile"/>
- </exec>
- <echo file="${module.build.dir}/Makefile.inc">
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-lbprefix=${subsystem.prefix}
-package=${module.package.name}
-PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
-globus_prefix=${with.globus.prefix}
-expat_prefix=${with.expat.prefix}
-ares_prefix=${with.ares.prefix}
-gsoap_prefix=${with.gsoap.prefix}
-gsoap_version=${ext.gsoap.version}
-mysql_prefix=${with.mysql.prefix}
-mysql_version=${ext.mysql.version}
-libtar=${with.libtar.prefix}
-thrflavour=${with.globus.thr.flavor}
-nothrflavour=${with.globus.nothr.flavor}
-cppunit=${with.cppunit.prefix}
-jpproject=${subsystem.project.dir}
-project=${component.project.dir}
- </echo>
- </target>
- </project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Common build properties file for the gLite JP Client component
--->
-
-<project name="JP Client component common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property file="project/build.properties" />
-
- <!-- ======================================================
- Define corresponding subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${jp.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${jp.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define component properties
- ====================================================== -->
-
- <!-- Component name prefix -->
- <property name="component.prefix" value="client" />
-
- <!-- ======================================================
- Define general component properties
- ====================================================== -->
-
- <import file="${component.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
-
-</project>
+++ /dev/null
-tar_exclude
-CVS
-build.xml
-build
-build.properties
-properties.xml
-configure.properties.xml
-.cvsignore
-.project
-.cdtproject
+++ /dev/null
-module.version=1.0.0
-module.age=1
+++ /dev/null
-#include <stdlib.h>
-#include <errno.h>
-#include <assert.h>
-#include <stdarg.h>
-#include <string.h>
-
-#include "jp_client.h"
-#include "jpcl_ctx_int.h"
-#include "jpimporter.h"
-
-
-int glite_jpcl_InitContext(glite_jpcl_context_t *ctx)
-{
- glite_jpcl_context_t out = (glite_jpcl_context_t) malloc(sizeof(*out));
- if (!out) return ENOMEM;
- memset(out, 0, sizeof(*out));
- assert(out->errDesc == NULL);
-
- *ctx = out;
- return 0;
-}
-
-void glite_jpcl_FreeContext(glite_jpcl_context_t ctx)
-{
- free(ctx->jpps);
- free(ctx->lbmd_dir);
-}
-
-int glite_jpcl_SetParam(glite_jpcl_context_t ctx, int param, ...)
-{
- va_list ap;
-
- va_start(ap, param);
- switch ( param ) {
- case GLITE_JPCL_PARAM_JPPS:
- if ( ctx->jpps ) free(ctx->jpps);
- ctx->jpps = va_arg(ap, char *);
- ctx->jpps = strdup(ctx->jpps);
- break;
- case GLITE_JPCL_PARAM_LBMAILDIR:
- if ( ctx->lbmd_dir ) free(ctx->lbmd_dir);
- ctx->lbmd_dir = strdup(va_arg(ap, char *));
- break;
- default:
- return glite_jpcl_SetError(ctx, EINVAL, "unknown parameter");
- }
-
- return 0;
-}
-
-int glite_jpcl_Error( glite_jpcl_context_t ctx, char **errt, char **errd)
-{
- if ( errt ) *errt = strdup(strerror(ctx->errCode));
- if ( errd ) *errd = (ctx->errDesc)? strdup(ctx->errDesc): NULL;
- return ctx->errCode;
-}
-
-int glite_jpcl_SetError(glite_jpcl_context_t ctx, int code, const char *desc)
-{
- glite_jpcl_ResetError(ctx);
- if ( code ) {
- ctx->errCode = code;
- if ( desc ) ctx->errDesc = (char *) strdup(desc);
- }
-
- return ctx->errCode;
-}
-
-int glite_jpcl_ResetError(glite_jpcl_context_t ctx)
-{
- if ( ctx->errDesc ) free(ctx->errDesc);
- ctx->errDesc = NULL;
- ctx->errCode = 0;
-
- return ctx->errCode;
-}
+++ /dev/null
-#include <sys/types.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <dirent.h>
-
-
-#define COMPILE_WITH_LIBTAR
-#ifdef COMPILE_WITH_LIBTAR
-# include <libtar.h>
-#endif
-
-#include "glite/lb/lb_maildir.h"
-
-#include "jp_client.h"
-#include "jpimporter.h"
-#include "jpcl_ctx_int.h"
-
-#define TEMP_FILE_PREFIX "/tmp/jpimporter"
-
-int glite_jpimporter_upload_files(
- glite_jpcl_context_t ctx,
- const char *jobid,
- const char **files,
- const char *proxy)
-{
-#ifdef COMPILE_WITH_LIBTAR
- TAR *t = NULL;
-#endif
- char *msg = NULL,
- *errs = NULL;
- char archive[PATH_MAX];
- int fd = -1,
- rv = 0,
- i;
-
-
- assert((files != NULL) && (files[0] != NULL));
- assert(jobid != NULL);
- /* TODO: get the user proxy if it is not specified and find its location */
- assert(proxy != NULL);
-
- if ( edg_wll_MaildirInit(ctx->lbmd_dir) ) {
- asprintf(&errs, "edg_wll_MaildirInit(): %s", lbm_errdesc);
- glite_jpcl_SetError(ctx, errno, errs);
- free(errs);
- return -1;
- }
-
- i = 0;
- do {
- if ( ++i > 10 ) {
- glite_jpcl_SetError(ctx, ECANCELED, "Can't create temporary tar file");
- return -1;
- }
- snprintf(archive, PATH_MAX, "%s_%ld_%ld.tar",
- TEMP_FILE_PREFIX, getpid(), time(NULL));
- if ( (fd = open(archive, O_CREAT|O_EXCL|O_WRONLY, 00600)) < 0 ) {
- if ( errno == EEXIST ) { sleep(2); continue; }
- asprintf(&errs, "Can't create tar file %s", archive);
- glite_jpcl_SetError(ctx, ECANCELED, errs);
- free(errs);
- return -1;
- }
- } while ( fd < 0 );
-
-#ifdef COMPILE_WITH_LIBTAR
- if ( tar_fdopen(&t, fd, archive, NULL, O_WRONLY, 0, TAR_GNU) < 0 ) {
- asprintf(&errs, "Can't create tar archive %s", archive);
- glite_jpcl_SetError(ctx, errno, errs);
- rv = -1;
- goto cleanup;
- }
-
- for ( i = 0; files[i]; i++ ) {
- char *s = (char *)files[i];
- if ( tar_append_file(t, s, (s[0]=='/')? s+1: s) < 0 ) {
- asprintf(&errs, "Can't append file into tar archive %s", archive);
- glite_jpcl_SetError(ctx, errno, errs);
- rv = -1;
- goto cleanup;
- }
- }
-#endif
-
- if ( ctx->jpps )
- asprintf(&msg, "jobid\t%s\nfile\t%s\nproxy\t%s\njpps\t%s\n",
- jobid, archive, proxy, ctx->jpps);
- else
- asprintf(&msg, "jobid\t%s\nfile\t%s\nproxy\t%s\n",
- jobid, archive, proxy);
-
- if ( edg_wll_MaildirStoreMsg(ctx->lbmd_dir, "localhost", msg) ) {
- asprintf(&errs, "edg_wll_MaildirStoreMsg(): %s", lbm_errdesc);
- glite_jpcl_SetError(ctx, errno, errs);
- rv = -1;
- goto cleanup;
- }
-
-
-cleanup:
-#ifdef COMPILE_WITH_LIBTAR
- if ( t ) tar_close(t);
- else close(fd);
-#else
- close(fd);
-#endif
- if ( rv ) unlink(archive);
- free(errs);
- free(msg);
-
- return rv;
-}
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <signal.h>
-#include <string.h>
-#include <assert.h>
-#include <linux/limits.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <syslog.h>
-#include <fcntl.h>
-
-#include "glite/lb/lb_maildir.h"
-#include "glite/security/glite_gsplugin.h"
-
-#include "jpps_H.h"
-#include "jpps_.nsmap"
-
-#include "jptype_map.h"
-
-#include "globus_ftp_client.h"
-
-#include "soap_version.h"
-#if GSOAP_VERSION <= 20602
-#define soap_call___jpsrv__RegisterJob soap_call___ns1__RegisterJob
-#endif
-
-
-typedef struct {
- char *key;
- char *val;
-} msg_pattern_t;
-
-
-#ifndef dprintf
-#define dprintf(x) { if (debug) printf x; }
-#endif
-
-#ifndef GLITE_JPIMPORTER_PIDFILE
-#define GLITE_JPIMPORTER_PIDFILE "/var/run/glite-jpimporter.pid"
-#endif
-
-#ifndef GLITE_REG_IMPORTER_MDIR
-#define GLITE_REG_IMPORTER_MDIR "/tmp/jpreg"
-#endif
-
-#ifndef GLITE_DUMP_IMPORTER_MDIR
-#define GLITE_DUMP_IMPORTER_MDIR "/tmp/jpdump"
-#endif
-
-#ifndef GLITE_JPPS
-#define GLITE_JPPS "http://localhost:8901"
-#endif
-
-
-#define MAX_REG_CONNS 500
-
-static int debug = 0;
-static int die = 0;
-static int child_died = 0;
-static int poll = 2;
-static char *name;
-static char *jpps = GLITE_JPPS;
-static char reg_mdir[PATH_MAX] = GLITE_REG_IMPORTER_MDIR;
-static char dump_mdir[PATH_MAX] = GLITE_DUMP_IMPORTER_MDIR;
-static struct soap *soap;
-
-static time_t cert_mtime;
-static char *server_cert = NULL,
- *server_key = NULL,
- *cadir;
-static gss_cred_id_t mycred = GSS_C_NO_CREDENTIAL;
-static char *mysubj;
-
-
-static struct option opts[] = {
- { "help", 0, NULL, 'h'},
- { "cert", 1, NULL, 'c'},
- { "key", 1, NULL, 'k'},
- { "CAdir", 1, NULL, 'C'},
- { "debug", 0, NULL, 'g'},
- { "jpps", 1, NULL, 'p'},
- { "reg-mdir", 1, NULL, 'r'},
- { "dump-mdir", 1, NULL, 'd'},
- { "pidfile", 1, NULL, 'i'},
- { "poll", 1, NULL, 't'},
- { NULL, 0, NULL, 0}
-};
-
-static const char *get_opt_string = "hgp:r:d:i:t:c:k:C:";
-
-static void usage(char *me)
-{
- fprintf(stderr,"usage: %s [option]\n"
- "\t-h, --help displays this screen\n"
- "\t-k, --key private key file\n"
- "\t-c, --cert certificate file\n"
- "\t-C, --CAdir trusted certificates directory\n"
- "\t-g, --debug don't run as daemon, additional diagnostics\n"
- "\t-p, --jpps JP primary service server\n"
- "\t-r, --reg-mdir path to the 'LB maildir' subtree for registrations\n"
- "\t-d, --dump-mdir path to the 'LB maildir' subtree for LB dumps\n"
- "\t-i, --pidfile file to store master pid\n"
- "\t-t, --poll maildir polling interval (in seconds)\n",
- me);
-}
-
-static void catchsig(int sig)
-{
- die = sig;
-}
-
-static void catch_chld(int sig)
-{
- child_died = 1;
-}
-
-
-static int slave(int (*)(void), const char *);
-static int check_soap_fault(struct soap *, int);
-static int reg_importer(void);
-static int dump_importer(void);
-static int parse_msg(char *, msg_pattern_t []);
-static int gftp_put_file(const char *, int);
-
-
-
-int main(int argc, char *argv[])
-{
- edg_wll_GssStatus gss_code;
- struct sigaction sa;
- sigset_t sset;
- FILE *fpid;
- pid_t reg_pid, dump_pid;
- int opt;
- char *name,
- pidfile[PATH_MAX] = GLITE_JPIMPORTER_PIDFILE;
-
-
- name = strrchr(argv[0],'/');
- if (name) name++; else name = argv[0];
-
- if ( geteuid() )
- snprintf(pidfile, sizeof pidfile, "%s/glite_jpimporter.pid", getenv("HOME"));
-
- while ( (opt = getopt_long(argc, argv, get_opt_string, opts, NULL)) != EOF )
- switch ( opt ) {
- case 'g': debug = 1; break;
- case 'h': usage(name); return 0;
- case 'c': server_cert = optarg; break;
- case 'k': server_key = optarg; break;
- case 'C': cadir = optarg; break;
- case 'p': jpps = optarg; break;
- case 't': poll = atoi(optarg); break;
- case 'r': strcpy(reg_mdir, optarg); break;
- case 'd': strcpy(dump_mdir, optarg); break;
- case 'i': strcpy(pidfile, optarg); break;
- case '?': usage(name); return 1;
- }
- if ( optind < argc ) { usage(name); return 1; }
-
- setlinebuf(stdout);
- setlinebuf(stderr);
-
- fpid = fopen(pidfile,"r");
- if ( fpid ) {
- int opid = -1;
-
- if ( fscanf(fpid,"%d",&opid) == 1 ) {
- if ( !kill(opid,0) ) {
- fprintf(stderr,"%s: another instance running, pid = %d\n",argv[0],opid);
- return 1;
- }
- else if (errno != ESRCH) { perror("kill()"); return 1; }
- }
- fclose(fpid);
- } else if (errno != ENOENT) { perror(pidfile); return 1; }
- fpid = fopen(pidfile, "w");
- if ( !fpid ) { perror(pidfile); return 1; }
- fprintf(fpid, "%d", getpid());
- fclose(fpid);
-
- edg_wll_MaildirInit(reg_mdir);
- edg_wll_MaildirInit(dump_mdir);
-
- if ( !debug ) {
- if ( daemon(1,0) == -1 ) { perror("deamon()"); exit(1); }
-
- fpid = fopen(pidfile,"w");
- if ( !fpid ) { perror(pidfile); return 1; }
- fprintf(fpid, "%d", getpid());
- fclose(fpid);
- openlog(name, LOG_PID, LOG_DAEMON);
- } else { setpgid(0, getpid()); }
-
- dprintf(("Master pid %d\n", getpid()));
-
- if ( globus_module_activate(GLOBUS_FTP_CLIENT_MODULE) != GLOBUS_SUCCESS ) {
- dprintf(("[master] Could not activate ftp client module\n"));
- if (!debug) syslog(LOG_INFO, "Could not activate ftp client module\n");
- exit(1);
- } else dprintf(("[master] Ftp client module activated\n"));
-
- if ( !server_cert || !server_key )
- fprintf(stderr, "%s: key or certificate file not specified"
- " - unable to watch them for changes!\n", argv[0]);
- if ( cadir ) setenv("X509_CERT_DIR", cadir, 1);
- edg_wll_gss_watch_creds(server_cert, &cert_mtime);
- if ( !edg_wll_gss_acquire_cred_gsi(server_cert, server_key, &mycred, &mysubj, &gss_code) ) {
- dprintf(("[master] Server identity: %s\n", mysubj));
- } else {
- char *errmsg;
- edg_wll_gss_get_error(&gss_code, "edg_wll_gss_acquire_cred_gsi()", &errmsg);
- dprintf(("[master] %s\n", errmsg));
- free(errmsg);
- dprintf(("[master] Running unauthenticated\n"));
- }
-
- memset(&sa, 0, sizeof(sa)); assert(sa.sa_handler == NULL);
- sa.sa_handler = catchsig;
- sigaction(SIGINT, &sa, NULL);
- sigaction(SIGTERM, &sa, NULL);
-
- sa.sa_handler = catch_chld;
- sigaction(SIGCHLD, &sa, NULL);
-
- sa.sa_handler = SIG_IGN;
- sigaction(SIGUSR1, &sa, NULL);
-
- sigemptyset(&sset);
- sigaddset(&sset, SIGCHLD);
- sigaddset(&sset, SIGTERM);
- sigaddset(&sset, SIGINT);
- sigprocmask(SIG_BLOCK, &sset, NULL);
-
- soap = soap_new();
- soap_init(soap);
- soap_set_namespaces(soap, jpps__namespaces);
- soap_register_plugin(soap, glite_gsplugin);
-
- if ( (reg_pid = slave(reg_importer, "reg-imp")) < 0 ) {
- perror("starting reg importer slave");
- exit(1);
- }
- if ( (dump_pid = slave(dump_importer, "dump-imp")) < 0 ) {
- perror("starting dump importer slave");
- exit(1);
- }
-
- while ( !die ) {
-
- sigprocmask(SIG_UNBLOCK, &sset, NULL);
- sleep(5);
- sigprocmask(SIG_BLOCK, &sset, NULL);
-
- if ( child_died ) {
- int pid;
-
- while ( (pid = waitpid(-1, NULL, WNOHANG)) > 0 ) {
- if ( !die ) {
- if ( pid == reg_pid ) {
- dprintf(("[master] reg importer slave died [%d]\n", pid));
- if (!debug) syslog(LOG_INFO, "reg importer slave died [%d]\n", die);
- if ( (reg_pid = slave(reg_importer, "reg-imp")) < 0 ) {
- perror("starting reg importer slave");
- kill(0, SIGINT);
- exit(1);
- }
- dprintf(("[master] reg importer slave restarted [%d]\n", reg_pid));
- } else if ( pid == dump_pid ) {
- dprintf(("[master] dump importer slave died [%d]\n", pid));
- if (!debug) syslog(LOG_INFO, "dump importer slave died [%d]\n", die);
- if ( (dump_pid = slave(dump_importer, "dump-imp")) < 0 ) {
- perror("starting dump importer slave");
- kill(0, SIGINT);
- exit(1);
- }
- dprintf(("[master] dump importer slave restarted [%d]\n", dump_pid));
- }
- }
- }
- child_died = 0;
- continue;
- }
- }
-
- dprintf(("[master] Terminating on signal %d\n", die));
- if (!debug) syslog(LOG_INFO, "Terminating on signal %d\n", die);
- kill(0, die);
-
- globus_module_deactivate_all();
- unlink(pidfile);
-
- return 0;
-}
-
-static int slave(int (*fn)(void), const char *nm)
-{
- struct sigaction sa;
- sigset_t sset;
- int pid,
- conn_cnt = 0;
-
-
- if ( (pid = fork()) ) return pid;
-
- name = (char *)nm;
- memset(&sa, 0, sizeof(sa)); assert(sa.sa_handler == NULL);
- sa.sa_handler = catchsig;
- sigaction(SIGUSR1, &sa, NULL);
-
- sigemptyset(&sset);
- sigaddset(&sset, SIGTERM);
- sigaddset(&sset, SIGINT);
- sigaddset(&sset, SIGUSR1);
- sigprocmask(SIG_BLOCK, &sset, NULL);
-
- dprintf(("[%s] slave started - pid [%d]\n", name, getpid()));
-
- while ( !die && conn_cnt < MAX_REG_CONNS ) {
- int ret = fn();
-
- if ( ret > 0 ) conn_cnt++;
- else if ( ret < 0 ) exit(1);
- else if ( ret == 0 ) {
- sigprocmask(SIG_UNBLOCK, &sset, NULL);
- sleep(poll);
- sigprocmask(SIG_BLOCK, &sset, NULL);
- }
- }
-
- if ( die ) {
- dprintf(("[%s] Terminating on signal %d\n", name, getpid(), die));
- if ( !debug ) syslog(LOG_INFO, "Terminating on signal %d", die);
- }
- dprintf(("[%s] Terminating after %d connections\n", name, conn_cnt));
- if ( !debug ) syslog(LOG_INFO, "Terminating after %d connections", conn_cnt);
-
- exit(0);
-}
-
-
-static int reg_importer(void)
-{
- struct _jpelem__RegisterJob in;
- struct _jpelem__RegisterJobResponse empty;
- int ret;
- char *msg = NULL,
- *fname = NULL,
- *aux;
-
-
- ret = edg_wll_MaildirTransStart(reg_mdir, &msg, &fname);
- if ( ret < 0 ) {
- dprintf(("[%s] edg_wll_MaildirTransStart: %s (%s)\n", name, strerror(errno), lbm_errdesc));
- if ( !debug ) syslog(LOG_ERR, "edg_wll_MaildirTransStart: %s (%s)", strerror(errno), lbm_errdesc);
- return -1;
- } else if ( ret > 0 ) {
- dprintf(("[%s] JP registration request received\n", name));
- if ( !debug ) syslog(LOG_INFO, "JP registration request received\n");
-
- ret = 0;
- if ( !(aux = strchr(msg, '\n')) ) {
- dprintf(("[%s] Wrong format of message!\n", name));
- if ( !debug ) syslog(LOG_ERR, "Wrong format of message\n");
- ret = 0;
- } else do {
- *aux++ = '\0';
- in.job = msg;
- in.owner = aux;
- dprintf(("[%s] Registering '%s'\n", name, msg));
- if ( !debug ) syslog(LOG_INFO, "Registering '%s'\n", msg);
- ret = soap_call___jpsrv__RegisterJob(soap, jpps, "", &in, &empty);
- if ( (ret = check_soap_fault(soap, ret)) ) break;
- } while (0);
- edg_wll_MaildirTransEnd(reg_mdir, fname, ret? LBMD_TRANS_FAILED: LBMD_TRANS_OK);
- free(fname);
- free(msg);
- return 1;
- }
-
- return 0;
-}
-
-static int dump_importer(void)
-{
- struct _jpelem__StartUpload su_in;
- struct _jpelem__StartUploadResponse su_out;
- struct _jpelem__CommitUpload cu_in;
- struct _jpelem__CommitUploadResponse empty;
- static int readnew = 1;
- char *msg = NULL,
- *fname = NULL,
- *aux;
- int ret;
- int fhnd;
- msg_pattern_t tab[] = {
- {"jobid", NULL},
- {"file", NULL},
- {"jpps", NULL},
- {"proxy", NULL},
- {NULL, NULL}};
-#define _job 0
-#define _file 1
-#define _jpps 2
-#define _proxy 3
-
-
- if ( readnew ) ret = edg_wll_MaildirTransStart(dump_mdir, &msg, &fname);
- else ret = edg_wll_MaildirRetryTransStart(dump_mdir, (time_t)60, &msg, &fname);
- if ( !ret ) {
- readnew = ~readnew;
- if ( readnew ) ret = edg_wll_MaildirTransStart(dump_mdir, &msg, &fname);
- else ret = edg_wll_MaildirRetryTransStart(dump_mdir, (time_t)60, &msg, &fname);
- if ( !ret ) {
- readnew = ~readnew;
- return 0;
- }
- }
-
- if ( ret < 0 ) {
- dprintf(("[%s] edg_wll_MaildirTransStart: %s (%s)\n", name, strerror(errno), lbm_errdesc));
- if ( !debug ) syslog(LOG_ERR, "edg_wll_MaildirTransStart: %s (%s)", strerror(errno), lbm_errdesc);
- return -1;
- }
-
- dprintf(("[%s] dump JP import request received\n", name));
- if ( !debug ) syslog(LOG_INFO, "dump JP import request received");
-
- ret = 0;
- if ( parse_msg(msg, tab) < 0 ) {
- dprintf(("[%s] Wrong format of message!\n", name));
- if ( !debug ) syslog(LOG_ERR, "Wrong format of message");
- ret = 0;
- } else do {
- su_in.job = tab[_job].val;
- su_in.class_ = "urn:org.glite.jp.primary:lb";
- su_in.name = tab[_file].val;
- su_in.commitBefore = 1000 + time(NULL);
- su_in.contentType = "text/lb";
- dprintf(("[%s] Importing LB dump file '%s'\n", name, tab[_file].val));
- if ( !debug ) syslog(LOG_INFO, "Importing LB dump file '%s'\n", msg);
- ret = soap_call___jpsrv__StartUpload(soap, tab[_jpps].val?:jpps, "", &su_in, &su_out);
- ret = check_soap_fault(soap, ret);
- /* XXX: grrrrrrr! test it!!!
- if ( (ret = check_soap_fault(soap, ret)) ) break;
- dprintf(("[%s] Destination: %s\n\tCommit before: %s\n", su_out.destination, ctime(&su_out.commitBefore)));
- */
-
- if ( (fhnd = open(tab[_file].val, O_RDONLY)) < 0 ) {
- dprintf(("[%s] Can't open dump file: %s\n", name, tab[_file].val));
- if ( !debug ) syslog(LOG_ERR, "Can't open dump file: %s", tab[_file].val);
- ret = 1;
- break;
- }
- /* XXX: grrrrrrr! remove next line!!! */
- su_out.destination = "gsiftp://nain.ics.muni.cz:5678/tmp/gsiftp-dump-tst-file";
- if ( (ret = gftp_put_file(su_out.destination, fhnd)) ) break;
- close(fhnd);
- dprintf(("[%s] File sent, commiting the upload\n", name));
- cu_in.destination = su_out.destination;
- ret = soap_call___jpsrv__CommitUpload(soap, tab[_jpps].val?:jpps, "", &cu_in, &empty);
- if ( (ret = check_soap_fault(soap, ret)) ) break;
- dprintf(("[%s] Dump upload succesfull\n", name));
- } while (0);
-
- edg_wll_MaildirTransEnd(dump_mdir, fname, ret? LBMD_TRANS_FAILED_RETRY: LBMD_TRANS_OK);
- free(fname);
- free(msg);
-
- return 1;
-}
-
-
-static int check_soap_fault(struct soap *soap, int err)
-{
- struct SOAP_ENV__Detail *detail;
- struct jptype__genericFault *f;
- char *reason,
- indent[200] = " ";
-
-
- switch ( err ) {
- case SOAP_OK:
- dprintf(("[%s] ok\n", name));
- break;
-
- case SOAP_FAULT:
- case SOAP_SVR_FAULT:
- if (soap->version == 2) {
- detail = soap->fault->SOAP_ENV__Detail;
- reason = soap->fault->SOAP_ENV__Reason;
- } else {
- detail = soap->fault->detail;
- reason = soap->fault->faultstring;
- }
- dprintf(("[%s] %s\n", name, reason));
- if ( !debug ) syslog(LOG_ERR, "%s", reason);
- assert(detail->__type == SOAP_TYPE__genericFault);
-#if GSOAP_VERSION >=20700
- f = ((struct _genericFault *) detail->fault) -> jpelem__genericFault;
-#else
- f = ((struct _genericFault *) detail->value) -> jpelem__genericFault;
-#endif
- while (f) {
- dprintf(("[%s] %s%s: %s (%s)\n",
- name, indent,
- f->source, f->text, f->description));
- if ( !debug ) syslog(LOG_ERR, "%s%s: %s (%s)",
- reason, f->source, f->text, f->description);
- f = f->reason;
- strcat(indent, " ");
- }
- return -1;
-
- default: soap_print_fault(soap,stderr);
- return -1;
- }
-
- return 0;
-}
-
-/** Parses every line looking for pattern string and stores the value into
- * the given variable
- *
- * line format is: key[space(s)]+val
- */
-int parse_msg(char *msg, msg_pattern_t tab[])
-{
- char *eol = msg,
- *key, *val;
-
- while ( eol && *eol != '\0' ) {
- int i;
-
- key = eol;
- if ( (eol = strchr(key, '\n')) ) *eol++ = '\0';
- while ( isblank(*key) ) key++;
- if ( *key == '\0' ) continue;
- val = key;
- while ( !isblank(*val) ) val++;
- if ( *val == '\0' ) return -1;
- *val++ = '\0';
- while ( isblank(*val) ) val++;
- if ( *val == '\0' ) return -1;
-
- for ( i = 0; tab[i].key; i++ ) {
- if ( !strcmp(tab[i].key, key) ) {
- tab[i].val = val;
- break;
- }
- }
- }
-
- return 0;
-}
-
-
-#define BUFSZ 1024
-
-static globus_mutex_t gLock;
-static globus_cond_t gCond;
-static globus_bool_t gDone;
-static globus_bool_t gError = GLOBUS_FALSE;
-static globus_byte_t gBuffer[BUFSZ];
-static int gOffset;
-
-
-static void gftp_done_cb(
- void *user_arg,
- globus_ftp_client_handle_t *handle,
- globus_object_t *err)
-{
- if ( err != GLOBUS_SUCCESS ) {
- char *tmp = globus_object_printable_to_string(err);
- dprintf(("[%s] Error in callback: %s\n", name, tmp));
- if ( !debug ) syslog(LOG_ERR, "Error in callback: %s", tmp);
- gError = GLOBUS_TRUE;
- globus_libc_free(tmp);
- }
- globus_mutex_lock(&gLock);
- gDone = GLOBUS_TRUE;
- globus_cond_signal(&gCond);
- globus_mutex_unlock(&gLock);
-}
-
-static void gftp_data_cb(
- void *user_arg,
- globus_ftp_client_handle_t *handle,
- globus_object_t *error,
- globus_byte_t *buffer,
- globus_size_t length,
- globus_off_t offset,
- globus_bool_t eof)
-{
- if ( !eof ) {
- int rc;
- globus_mutex_lock(&gLock);
- if ( (rc = read(*((int *)user_arg), gBuffer, BUFSZ)) < 0 ) {
- dprintf(("[%s] Error reading dump file\n", name));
- if ( !debug ) syslog(LOG_ERR, "Error reading dump file");
- gDone = GLOBUS_TRUE;
- gError = GLOBUS_TRUE;
- globus_cond_signal(&gCond);
- } else {
- globus_ftp_client_register_write(
- handle, gBuffer, rc, gOffset, rc == 0, gftp_data_cb, user_arg);
- gOffset += rc;
- }
- globus_mutex_unlock(&gLock);
- }
-}
-
-static int gftp_put_file(const char *url, int fhnd)
-{
- globus_ftp_client_handle_t hnd;
- globus_ftp_client_operationattr_t op_attr;
- globus_ftp_client_handleattr_t hnd_attr;
-
-#define put_file_err(errs) { \
- dprintf(("[%s] %s\n", name, errs)); \
- if ( !debug ) syslog(LOG_ERR, errs); \
- return 1; \
-}
- if ( globus_ftp_client_handleattr_init(&hnd_attr) != GLOBUS_SUCCESS )
- put_file_err("Could not initialise handle attributes");
-
- if ( globus_ftp_client_operationattr_init(&op_attr) != GLOBUS_SUCCESS )
- put_file_err("Could not initialise operation attributes");
-
- if ( globus_ftp_client_operationattr_set_authorization(
- &op_attr, server_cert? mycred: GSS_C_NO_CREDENTIAL,
- NULL, "", 0, NULL) != GLOBUS_SUCCESS )
- put_file_err("Could not set authorization procedure");
-
- if ( globus_ftp_client_handle_init(&hnd, &hnd_attr) != GLOBUS_SUCCESS )
- put_file_err("Could not initialise ftp client handle");
-#undef put_file_err
-
- globus_mutex_init(&gLock, GLOBUS_NULL);
- globus_cond_init(&gCond, GLOBUS_NULL);
-
- gDone = GLOBUS_FALSE;
-
- /* do the op */
- if ( globus_ftp_client_put(
- &hnd, url, &op_attr,
- GLOBUS_NULL, gftp_done_cb, (void *)&fhnd) != GLOBUS_SUCCESS) {
- dprintf(("[%s] Could not start file put\n", name));
- if ( !debug ) syslog(LOG_ERR, "Could not start file put");
- gError = GLOBUS_TRUE;
- gDone = GLOBUS_TRUE;
- } else {
- int rc;
- globus_mutex_lock(&gLock);
- if ( (rc = read(fhnd, gBuffer, BUFSZ)) < 0 ) {
- dprintf(("[%s] Error reading dump file\n", name));
- if ( !debug ) syslog(LOG_ERR, "Error reading dump file");
- gDone = GLOBUS_TRUE;
- gError = GLOBUS_TRUE;
- globus_cond_signal(&gCond);
- } else {
- globus_ftp_client_register_write(&hnd,
- gBuffer, rc, gOffset, rc == 0, gftp_data_cb, (void *)&fhnd);
- gOffset += rc;
- }
- globus_mutex_unlock(&gLock);
- }
-
- globus_mutex_lock(&gLock);
- while ( !gDone ) globus_cond_wait(&gCond, &gLock);
- globus_mutex_unlock(&gLock);
-
- globus_ftp_client_handle_destroy(&hnd);
-
-
- return (gError == GLOBUS_TRUE)? 1: 0;
-}
-
-/* XXX: we don't use it */
-SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} };
-
+++ /dev/null
-#include "soap_version.h"
-
-#if GSOAP_VERSION >= 20700
-#define INPUT_SANDBOX jptype__UploadClass__INPUT_SANDBOX
-#define OUTPUT_SANDBOX jptype__UploadClass__OUTPUT_SANDBOX
-#define JOB_LOG jptype__UploadClass__JOB_LOG
-
-#define OWNER jptype__AttributeType__OWNER
-#define TIME jptype__AttributeType__TIME
-#define TAG jptype__AttributeType__TAG
-
-#define EQUAL jptype__queryOp__EQUAL
-#define UNEQUAL jptype__queryOp__UNEQUAL
-#define LESS jptype__queryOp__LESS
-#define GREATER jptype__queryOp__GREATER
-#define WITHIN jptype__queryOp__WITHIN
-#endif
-
+++ /dev/null
-jpsrv = http://glite.org/wsdl/services/jp
-jptype = http://glite.org/wsdl/types/jp
-jpelem = http://glite.org/wsdl/elements/jp
+++ /dev/null
-# defaults
-top_srcdir=.
-builddir=build
-top_builddir=${top_srcdir}/${builddir}
-stagedir=.
-distdir=.
-globalprefix=glite
-lbprefix=lb
-package=glite-jp-common
-version=0.0.0
-PREFIX=/opt/glite
-
-glite_location=/opt/glite
-globus_prefix=/opt/globus
-nothrflavour=gcc32
-thrflavour=gcc32pthr
-expat_prefix=/opt/expat
-ares_prefix=/opt/ares
-gsoap_prefix=/software/gsoap-2.6
-
-CC=gcc
-
--include Makefile.inc
-
-
-VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/project:${jpproject}
-
-GLOBUSINC:= -I${globus_prefix}/include/${nothrflavour}
-
-
-DEBUG:=-g -O0
-CFLAGS:=${DEBUG} -I. -I${top_srcdir}/interface -I${stagedir}/include \
- ${GLOBUSINC}
-
-LINK:=libtool --mode=link ${CC} ${LDFLAGS} -rpath ${stagedir}/lib
-LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS}
-INSTALL:=libtool --mode=install install
-COMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
-
-HDRS:=types.h context.h strmd5.h attr.h known_attr.h trio.h escape.h
-
-SRCS:=context.c strmd5.c attr.c
-OBJS:=${SRCS:.c=.lo}
-
-commonlib:= libglite_jp_common.la
-
-
-TRIO_OBJS:=escape.o trio.o strio.o
-TRIO_LIB:=libglite_jp_trio.la
-TRIO_LOBJS:=${TRIO_OBJS:.o=.lo}
-
-default all: compile
-
-compile: ${commonlib} ${TRIO_LIB}
-
-${commonlib}: ${OBJS}
- ${LINK} -o $@ ${OBJS}
-
-${TRIO_LIB}: ${TRIO_LOBJS}
- ${LINK} ${version_info} -o $@ ${TRIO_LOBJS} -lm
-
-check:
- -echo nothing yet
-
-doc:
-
-stage: compile
- $(MAKE) install PREFIX=${stagedir}
-
-install:
- -mkdir -p ${PREFIX}/include/${globalprefix}/${jpprefix}
- cd ${top_srcdir}/interface && install -m 644 ${HDRS} ${PREFIX}/include/${globalprefix}/${jpprefix}
- -mkdir -p ${PREFIX}/lib
- ${INSTALL} -m 755 ${commonlib} ${TRIO_LIB} ${PREFIX}/lib
-
-dist: distsrc distbin
-
-# FIXME: just copied from LB
-distsrc:
- mkdir -p ${top_srcdir}/${package}-${version}
- cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version}
- cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version}
- rm -rf ${top_srcdir}/${package}-${version}
-
-distbin:
- $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir}
- save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir
- rm -rf tmpbuilddir
-
-clean:
-
-%.lo: %.c
- ${COMPILE} -o $@ -c $<
-
-${TRIO_LOBJS}: %.lo: %.c
- ${COMPILE} -o $@ -c -DDATAGRID_EXTENSION $<
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Build file for the GLite JP Common module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.2 2004/11/22 13:36:42 dimeglio
- First version of this file
-
- Revision 1.1.1.1 2004/10/15 09:49:02 akrenek
--->
-
-<project name="common" default="dist">
-
- <!-- =========================================
- Builds the GLite JP Primary Module
- ========================================= -->
-
- <!-- =========================================
- Import properties (order is important)
- ========================================= -->
-
- <!-- import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- import component build properties,
- component properties &
- component common properties -->
- <import file="./project/properties.xml"/>
-
- <!-- import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="${subsystem.properties.file}"/>
-
- <!-- import global build properties &
- global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependency property files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${component.dependencies.file}" />
- <property file="${subsystem.dependencies.file}" />
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options (order is important)
- ========================================= -->
- <import file="${global.configure.options.file}"/>
- <import file="${component.configure.options.file}"/>
-
- <!-- =========================================
- Import task definitions (order is important)
- ========================================= -->
- <import file="${subsystem.taskdefs.file}" />
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Load common targets
- ========================================= -->
- <import file="${global.targets-simple_make.file}" />
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ==============================================
- Local private targets
- ============================================== -->
-
- <target name="localinit"
- description="Module specific initialization tasks">
-
- <antcall target="lbmakefiles" />
- </target>
-
- <target name="localcompile"
- description="Module specific compile tasks">
- </target>
-
- <target name="localclean"
- description="Module specific cleaning tasks">
- </target>
-
-</project>
+++ /dev/null
-#ifndef __GLITE_JP_ATTR
-#define __GLITE_JP_ATTR
-
-void glite_jp_attrval_free(glite_jp_attrval_t *,int);
-void glite_jp_attrval_copy(glite_jp_attrval_t *,const glite_jp_attrval_t *);
-
-/* Search through registered type plugins and call appropriate plugin method.
- * See type_plugin.h for detailed description.
- */
-
-int glite_jp_attrval_cmp(glite_jp_context_t ctx,const glite_jp_attrval_t *a,const glite_jp_attrval_t *b,int *result);
-
-char *glite_jp_attrval_to_db_full(glite_jp_context_t ctx,const glite_jp_attrval_t *attr);
-char *glite_jp_attrval_to_db_index(glite_jp_context_t ctx,const glite_jp_attrval_t *attr,int len);
-
-int glite_jp_attrval_from_db(glite_jp_context_t ctx,const char *str,glite_jp_attrval_t *attr);
-const char *glite_jp_attrval_db_type_full(glite_jp_context_t ctx,const char *attr);
-const char *glite_jp_attrval_db_type_index(glite_jp_context_t ctx,const char *attr,int len);
-
-time_t glite_jp_attr2time(const char *);
-char * glite_jp_time2attr(time_t);
-
-
-#endif
+++ /dev/null
-#ifndef __GLITE_JP_CONTEXT
-#define __GLITE_JP_CONTEXT
-
-int glite_jp_init_context(glite_jp_context_t *);
-void glite_jp_free_context(glite_jp_context_t);
-void glite_jp_free_query_rec(glite_jp_query_rec_t *);
-
-char *glite_jp_peer_name(glite_jp_context_t);
-char *glite_jp_error_chain(glite_jp_context_t);
-
-int glite_jp_stack_error(glite_jp_context_t, const glite_jp_error_t *);
-int glite_jp_clear_error(glite_jp_context_t);
-
-int glite_jp_add_deferred(glite_jp_context_t,int (*)(glite_jp_context_t,void *),void *);
-int glite_jp_run_deferred(glite_jp_context_t);
-
-
-#endif
+++ /dev/null
-#ifndef __EDG_WORKLOAD_LOGGING_COMMON_ESCAPE_H__
-#define __EDG_WORKLOAD_LOGGING_COMMON_ESCAPE_H__
-/*!
- * \file Client/escape.h
- * \brief Prototypes for Client/escape.c
- */
-
-#ident "$Header$"
-
-
-/*!
- * \fn char *edg_wll_LogEscape(const char *str)
- * \param str a string to escape
- * \return new (allocated) escaped string
- * \brief in given string (ULM) escape all ULM_QM, ULM_BS and ULM_LF by ULM_BS
- */
-
-char *edg_wll_LogEscape(const char *);
-
-
-/*!
- * \fn char *edg_wll_LogUnescape(const char *str)
- * \param str a string to unescape
- * \return new (allocated) unescaped string
- * \brief in given string (ULM) unescape all escaped ULM_QM, ULM_BS and ULM_LF
- */
-
-char *edg_wll_LogUnescape(const char *);
-
-
-/*!
- * \fn char *edg_wll_EscapeXML(const char *str);
- * \param str a string to escape
- * \return new (allocated) escaped string
- * \brief in given string (XML) escape all unwanted characters
- */
-
-char *edg_wll_EscapeXML(const char *);
-
-
-/*!
- * \fn char *edg_wll_UnescapeXML(const char *str)
- * \param str a string to unescape
- * \return new (allocated) unescaped string
- * \brief in given string (XML) unescape all escaped characters
- */
-
-char *edg_wll_UnescapeXML(const char *);
-
-
-/*!
- * \fn char *edg_wll_EscapeSQL(const char *str)
- * \param str a string to escape
- * \return new (allocated) escaped string
- * \briefin given string (SQL) escape all unwanted characters
- */
-
-char *edg_wll_EscapeSQL(const char *);
-
-#endif /* __EDG_WORKLOAD_LOGGING_COMMON_ESCAPE_H__ */
+++ /dev/null
-#ifndef __GLITE_JP_KNOWN_ATTR
-#define __GLITE_JP_KNOWN_ATTR
-
-/** Namespace of JP system attributes */
-#define GLITE_JP_SYSTEM_NS "http://egee.cesnet.cz/en/Schema/JP/System"
-
-/** Job owner, as specified with RegisterJob JPPS operation */
-#define GLITE_JP_ATTR_OWNER GLITE_JP_SYSTEM_NS ":owner"
-
-/** JobId */
-#define GLITE_JP_ATTR_JOBID GLITE_JP_SYSTEM_NS ":jobId"
-
-/** Timestamp of job registration in JP.
- * Should be almost the same time as registration with LB. */
-#define GLITE_JP_ATTR_REGTIME GLITE_JP_SYSTEM_NS ":regtime"
-
-/** Attributes derived from LB system data
- * \see jp_job_attrs.h */
-
-/** Namespace for LB user tags, schemaless, all values are strings */
-#define GLITE_JP_LBTAG_NS "http://egee.cesnet.cz/en/WSDL/jp-lbtag"
-
-#endif
+++ /dev/null
-#ifndef _GLITE_STRMD5_H
-#define _GLITE_STRMD5_H
-
-#ident "$Header$"
-
-/* Compute MD5 sum of the first argument.
- * The sum is returned in the 16-byte array pointed to by 2nd argument
- * (if not NULL)
- *
- * Return value: ASCII string of the sum, i.e. 32 characters [0-9a-f]
- * (pointer to static area, changed by subsequent calls)
- */
-
-char *strmd5(const char *src, unsigned char *dst);
-
-/**
- * Returns: allocated 32bytes long ASCII string with md5 sum
- * of the first argument
- */
-char *str2md5(const char *src);
-
-/**
- * Returns: allocated 22bytes long ASCII string with md5 sum in base64
- * format of the source argument
- */
-char *str2md5base64(const char *src);
-
-int base64_encode(const void *enc, int enc_size, char *out, int out_max_size);
-int base64_decode(const char *enc,char *out,int out_size);
-
-
-#endif /* _GLITE_STRMD5_H */
+++ /dev/null
-/*************************************************************************
- *
- * $Id$
- *
- * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- ************************************************************************/
-
-#ifndef TRIO_TRIO_H
-#define TRIO_TRIO_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* make utility and C++ compiler in Windows NT fails to find this symbol */
-#if defined(WIN32) && !defined(isascii)
-# define isascii ((unsigned)(x) < 0x80)
-#endif
-
-/*
- * Error codes.
- *
- * Remember to add a textual description to trio_strerror.
- */
-enum {
- TRIO_EOF = 1,
- TRIO_EINVAL = 2,
- TRIO_ETOOMANY = 3,
- TRIO_EDBLREF = 4,
- TRIO_EGAP = 5,
- TRIO_ENOMEM = 6,
- TRIO_ERANGE = 7
-};
-
-/* Error macros */
-#define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF)
-#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8)
-#define TRIO_ERROR_NAME(x) trio_strerror(x)
-
-const char *trio_strerror(int);
-
-/*************************************************************************
- * Print Functions
- */
-
-int trio_printf(const char *format, ...);
-int trio_vprintf(const char *format, va_list args);
-int trio_printfv(const char *format, void **args);
-
-int trio_fprintf(FILE *file, const char *format, ...);
-int trio_vfprintf(FILE *file, const char *format, va_list args);
-int trio_fprintfv(FILE *file, const char *format, void **args);
-
-int trio_dprintf(int fd, const char *format, ...);
-int trio_vdprintf(int fd, const char *format, va_list args);
-int trio_dprintfv(int fd, const char *format, void **args);
-
-/* trio_sprintf(target, format, ...)
- * trio_snprintf(target, maxsize, format, ...)
- *
- * Build 'target' according to 'format' and succesive
- * arguments. This is equal to the sprintf() and
- * snprintf() functions.
- */
-int trio_sprintf(char *buffer, const char *format, ...);
-int trio_vsprintf(char *buffer, const char *format, va_list args);
-int trio_sprintfv(char *buffer, const char *format, void **args);
-
-int trio_snprintf(char *buffer, size_t max, const char *format, ...);
-int trio_vsnprintf(char *buffer, size_t bufferSize, const char *format,
- va_list args);
-int trio_snprintfv(char *buffer, size_t bufferSize, const char *format,
- void **args);
-
-int trio_snprintfcat(char *buffer, size_t max, const char *format, ...);
-int trio_vsnprintfcat(char *buffer, size_t bufferSize, const char *format,
- va_list args);
-
-char *trio_aprintf(const char *format, ...);
-char *trio_vaprintf(const char *format, va_list args);
-
-int trio_asprintf(char **ret, const char *format, ...);
-int trio_vasprintf(char **ret, const char *format, va_list args);
-
-/*************************************************************************
- * Scan Functions
- */
-int trio_scanf(const char *format, ...);
-int trio_vscanf(const char *format, va_list args);
-int trio_scanfv(const char *format, void **args);
-
-int trio_fscanf(FILE *file, const char *format, ...);
-int trio_vfscanf(FILE *file, const char *format, va_list args);
-int trio_fscanfv(FILE *file, const char *format, void **args);
-
-int trio_dscanf(int fd, const char *format, ...);
-int trio_vdscanf(int fd, const char *format, va_list args);
-int trio_dscanfv(int fd, const char *format, void **args);
-
-int trio_sscanf(const char *buffer, const char *format, ...);
-int trio_vsscanf(const char *buffer, const char *format, va_list args);
-int trio_sscanfv(const char *buffer, const char *format, void **args);
-
-/*************************************************************************
- * Renaming
- */
-#ifdef TRIO_REPLACE_STDIO
-/* Replace the <stdio.h> functions */
-#ifndef HAVE_PRINTF
-# define printf trio_printf
-#endif
-#ifndef HAVE_VPRINTF
-# define vprintf trio_vprintf
-#endif
-#ifndef HAVE_FPRINTF
-# define fprintf trio_fprintf
-#endif
-#ifndef HAVE_VFPRINTF
-# define vfprintf trio_vfprintf
-#endif
-#ifndef HAVE_SPRINTF
-# define sprintf trio_sprintf
-#endif
-#ifndef HAVE_VSPRINTF
-# define vsprintf trio_vsprintf
-#endif
-#ifndef HAVE_SNPRINTF
-# define snprintf trio_snprintf
-#endif
-#ifndef HAVE_VSNPRINTF
-# define vsnprintf trio_vsnprintf
-#endif
-#ifndef HAVE_SCANF
-# define scanf trio_scanf
-#endif
-#ifndef HAVE_VSCANF
-# define vscanf trio_vscanf
-#endif
-#ifndef HAVE_FSCANF
-# define fscanf trio_fscanf
-#endif
-#ifndef HAVE_VFSCANF
-# define vfscanf trio_vfscanf
-#endif
-#ifndef HAVE_SSCANF
-# define sscanf trio_sscanf
-#endif
-#ifndef HAVE_VSSCANF
-# define vsscanf trio_vsscanf
-#endif
-/* These aren't stdio functions, but we make them look similar */
-#define dprintf trio_dprintf
-#define vdprintf trio_vdprintf
-#define aprintf trio_aprintf
-#define vaprintf trio_vaprintf
-#define asprintf trio_asprintf
-#define vasprintf trio_vasprintf
-#define dscanf trio_dscanf
-#define vdscanf trio_vdscanf
-#endif
-
-/* strio compatible names */
-#define StrScan trio_sscanf
-#define StrFormat trio_sprintf
-#define StrFormatMax trio_snprintf
-#define StrFormatAlloc trio_aprintf
-#define StrFormatAppendMax trio_snprintfcat
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* TRIO_TRIO_H */
+++ /dev/null
-#ifndef __GLITE_JP_TYPEPLUGIN
-#define __GLITE_JP_TYPEPLUGIN
-
-typedef struct _glite_jp_tplug_data_t {
-
- char *namespace;
- void *pctx;
-
-/** Compare attribute values.
- * \param[in] a value to compare
- * \param[in] b value to compare
- * \param[out] result like strcmp()
- * \param[out] err set if the values cannot be compared
- * \retval 0 OK
- * \retval other error
- */
- int (*cmp)(
- void *ctx,
- const glite_jp_attrval_t *a,
- const glite_jp_attrval_t *b,
- int *result);
-
-/** Convert to database string representation.
- * It is guaranteed the returned value can be converted back with
- * from_db().
- * The resulting value may not be suitable for indexing with db engine.
- *
- * \param[in] attr the attribute value to convert
- * \retval NULL can't be converted
- * \retval other the string representation.
- * */
- char * (*to_db_full)(void *ctx,const glite_jp_attrval_t *attr);
-
-/** Convert to a database string representation suitable for indexing.
- * The function is non-decreasing (wrt. cmp() above and strcmp()), however it
- * is not guaranteed to be one-to-one.
- *
- * \param[in] attr the value to convert
- * \param[in] len maximum length of the converted value.
- * \retval NULL can't be converted
- * \retval other the string representation
- */
- char * (*to_db_index)(void *ctx,const glite_jp_attrval_t *attr,int len);
-
-/** Convert from the database format.
- * \param[in] str the string value
- * \param[inout] attr name contains the name of the attribute to be converted
- * the rest of attr is filled in.
- */
- int (*from_db)(void *ctx,const char *str,glite_jp_attrval_t *attr);
-
-/** Query for database types suitable to store values returned by
- * to_db_full() and to_db_index().
- * Useful for db column dynamic creation etc.
- * Return pointer to internal static data, non-reentrant.
- */
- const char * (*db_type_full)(void *ctx,const char *attr);
- const char * (*db_type_index)(void *ctx,const char *attr,int len);
-
-} glite_jp_tplug_data_t;
-
-/** Plugin init function.
- Must be called init, supposed to be called as many times as required
- for different param's (e.g. xsd files).
- Registers the plugin in ctx.
- */
-
-typedef int (*glite_jp_tplug_init_t)(
- glite_jp_context_t ctx,
- const char *param,
- glite_jp_tplug_data_t *plugin_data
-);
-
-#endif
+++ /dev/null
-#ifndef __GLITE_JP_TYPES
-#define __GLITE_JP_TYPES
-
-#include <sys/time.h>
-
-typedef struct _glite_jp_error_t {
- int code;
- const char *desc;
- const char *source;
- struct _glite_jp_error_t *reason;
-} glite_jp_error_t;
-
-typedef struct _glite_jp_context {
- glite_jp_error_t *error;
- int (**deferred_func)(struct _glite_jp_context *,void *);
- void **deferred_arg;
- void *feeds;
- struct soap *other_soap;
- char *peer;
- void **plugins;
- void **type_plugins;
- void *dbhandle;
- char **trusted_peers;
- char *myURL;
-} *glite_jp_context_t;
-
-typedef enum {
- GLITE_JP_ATTR_ORIG_ANY, /**< for queries: don't care about origin */
- GLITE_JP_ATTR_ORIG_SYSTEM, /**< JP internal, e.g. job owner */
- GLITE_JP_ATTR_ORIG_USER, /**< inserted by user explicitely */
- GLITE_JP_ATTR_ORIG_FILE /**< coming from uploaded file */
-} glite_jp_attr_orig_t;
-
-typedef struct {
- char *name; /**< including namespace */
- char *value;
- int binary; /**< value is binary */
- size_t size; /**< in case of binary value */
- glite_jp_attr_orig_t origin;
- char *origin_detail; /**< where it came from, i.e. file URI:name */
- time_t timestamp;
-} glite_jp_attrval_t;
-
-
-typedef enum {
- GLITE_JP_QUERYOP_UNDEF,
- GLITE_JP_QUERYOP_EQUAL,
- GLITE_JP_QUERYOP_UNEQUAL,
- GLITE_JP_QUERYOP_LESS,
- GLITE_JP_QUERYOP_GREATER,
- GLITE_JP_QUERYOP_WITHIN,
- GLITE_JP_QUERYOP_EXISTS,
- GLITE_JP_QUERYOP__LAST,
-} glite_jp_queryop_t;
-
-typedef struct {
- char *attr;
- glite_jp_queryop_t op;
- char *value, *value2;
- int binary;
- size_t size,size2;
- glite_jp_attr_orig_t origin;
-} glite_jp_query_rec_t;
-
-#endif
+++ /dev/null
-#Sat Oct 15 06:48:33 CEST 2005
-module.build=39
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Configuration options for the gLite JP Common module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.2 2004/11/22 13:36:42 dimeglio
- First version of this file
-
- Revision 1.1.1.1 2004/10/15 09:49:02 akrenek
--->
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <project name="JP Common configuration options">
- <target name="lbmakefiles">
- <exec executable="ln" failonerror="true">
- <arg line="-fs ${component.dir}/Makefile ${module.build.dir}/Makefile"/>
- </exec>
- <echo file="${module.build.dir}/Makefile.inc">
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-jpprefix=${subsystem.prefix}
-package=${module.package.name}
-PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
-globus_prefix=${with.globus.prefix}
-expat_prefix=${with.expat.prefix}
-gsoap_prefix=${with.gsoap.prefix}
-ares_prefix=${with.ares.prefix}
-thrflavour=${with.globus.thr.flavor}
-nothrflavour=${with.globus.nothr.flavor}
-cppunit=${with.cppunit.prefix}
-jpproject=${subsystem.project.dir}
-project=${component.project.dir}
- </echo>
- </target>
- </project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Common build properties file for the gLite JP Common component
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.1.1.1 2004/10/15 09:49:02 akrenek
--->
-
-<project name="JP Common component common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property file="project/build.properties" />
-
- <!-- ======================================================
- Define corresponding subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${jp.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${jp.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define component properties
- ====================================================== -->
-
- <!-- Component name prefix -->
- <property name="component.prefix" value="common" />
-
- <!-- ======================================================
- Define general component properties
- ====================================================== -->
-
- <import file="${component.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
-
-</project>
+++ /dev/null
-tar_exclude
-CVS
-build.xml
-build
-build.properties
-properties.xml
-configure.properties.xml
-.cvsignore
-.project
-.cdtproject
+++ /dev/null
-module.version=1.0.0
-module.age=1
+++ /dev/null
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#include "strmd5.h"
-#include "types.h"
-#include "attr.h"
-#include "type_plugin.h"
-
-void glite_jp_attrval_free(glite_jp_attrval_t *a,int f)
-{
- free(a->name);
- free(a->value);
- free(a->origin_detail);
- if (f) free(a);
-}
-
-void glite_jp_attrval_copy(glite_jp_attrval_t *dst,const glite_jp_attrval_t *src)
-{
- dst->name = strdup(src->name);
- dst->origin = src->origin;
- dst->size = src->size;
- dst->timestamp = src->timestamp;
- dst->origin_detail = src->origin_detail ?
- strdup(src->origin_detail) : NULL;
- if (dst->binary = src->binary) {
- dst->value = malloc(src->size);
- memcpy(dst->value,src->value,src->size);
- }
- else dst->value = strdup(src->value);
-}
-
-
-#define min(x,y) ((x) > (y) ? (y) : (x))
-
-static int fb_cmp(void *ctx,const glite_jp_attrval_t *a,const glite_jp_attrval_t *b,int *result)
-{
- if (a->binary != b->binary) return EINVAL;
- if (a->binary) {
- *result = memcmp(a->value,b->value,min(a->size,b->size));
- if (!*result && a->size != b->size)
- *result = a->size > b->size ? 1 : -1;
- }
- else *result = strcmp(a->value,b->value);
- return 0;
-}
-
-static char * fb_to_db_full(void *ctx,const glite_jp_attrval_t *attr)
-{
- char *db;
- if (attr->binary) {
- int osize = attr->size * 4/3 + 6;
- db = malloc(osize);
- db[0] = 'B'; db[1] = ':';
- osize = base64_encode(attr->value,attr->size,db+2,osize-3);
- assert(osize >= 0);
- db[osize] = 0;
- }
- else {
- db = malloc(strlen(attr->value)+3);
- db[0] = 'S'; db[1] = ':';
- strcpy(db+2,attr->value);
- }
- return db;
-}
-
-static char * fb_to_db_index(void *ctx,const glite_jp_attrval_t *attr,int len)
-{
- char *db = fb_to_db_full(ctx,attr);
- if (len < strlen(db)) db[len] = 0;
- return db;
-}
-
-int fb_from_db(void *ctx,const char *str,glite_jp_attrval_t *attr)
-{
- int osize;
- switch (str[0]) {
- case 'B':
- attr->value = malloc(osize = strlen(str) * 3/4 + 4);
- attr->size = base64_decode(str,str+2,osize);
- assert(attr->size >= 0);
- attr->binary = 1;
- break;
- case 'S':
- attr->value = strdup(str + 2);
- attr->size = 0;
- attr->binary = 0;
- break;
- default: return EINVAL;
- }
- return 0;
-}
-
-static const char * fb_type_full(void *ctx,const char *attr)
-{
- return "mediumblob";
-}
-
-static const char * fb_type_index(void *ctx,const char *attr,int len)
-{
- static char tbuf[100];
- sprintf(tbuf,"varchar(%d)",len);
- return tbuf;
-}
-
-
-
-static glite_jp_tplug_data_t fallback_plugin = {
- "",
- NULL,
- fb_cmp,
- fb_to_db_full,
- fb_to_db_index,
- fb_from_db,
- fb_type_full,
- fb_type_index,
-};
-
-static glite_jp_tplug_data_t *get_plugin(glite_jp_context_t ctx,const char *aname)
-{
- void **cp = ctx->type_plugins;
- char *colon,*ns;
-
- if (!cp) return &fallback_plugin;
- glite_jp_clear_error(ctx);
- ns = strdup(aname);
- colon = strrchr(ns,':');
- if (colon) *colon = 0; else *ns = 0;
-
- while (*cp) {
- glite_jp_tplug_data_t *p = *cp;
- if (!strcmp(ns,p->namespace)) {
- free(ns);
- return p;
- }
- }
- free(ns);
- return &fallback_plugin; /* XXX: is it always desirable? */
-}
-
-int glite_jp_attrval_cmp(glite_jp_context_t ctx,const glite_jp_attrval_t *a,const glite_jp_attrval_t *b,int *result)
-{
- glite_jp_tplug_data_t *ap = get_plugin(ctx,a->name);
- glite_jp_error_t err;
-
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
- glite_jp_clear_error(ctx);
-
- if (strcmp(a->name,b->name)) {
- err.code = EINVAL;
- err.desc = "Can't compare different attributes";
- return glite_jp_stack_error(ctx,&err);
- }
-
- return ap->cmp(ap->pctx,a,b,result);
-}
-
-char *glite_jp_attrval_to_db_full(glite_jp_context_t ctx,const glite_jp_attrval_t *attr)
-{
- glite_jp_tplug_data_t *ap = get_plugin(ctx,attr->name);
-
- glite_jp_clear_error(ctx);
- return ap->to_db_full(ap->pctx,attr);
-}
-
-char *glite_jp_attrval_to_db_index(glite_jp_context_t ctx,const glite_jp_attrval_t *attr,int len)
-{
- glite_jp_tplug_data_t *ap = get_plugin(ctx,attr->name);
-
- glite_jp_clear_error(ctx);
- return ap->to_db_index(ap->pctx,attr,len);
-}
-
-
-int glite_jp_attrval_from_db(glite_jp_context_t ctx,const char *str,glite_jp_attrval_t *attr)
-{
- glite_jp_tplug_data_t *ap = get_plugin(ctx,attr->name);
-
- glite_jp_clear_error(ctx);
- return ap->from_db(ap->pctx,str,attr);
-}
-
-const char *glite_jp_attrval_db_type_full(glite_jp_context_t ctx,const char *attr)
-{
- glite_jp_tplug_data_t *ap = get_plugin(ctx,attr);
-
- glite_jp_clear_error(ctx);
- return ap->db_type_full(ap->pctx,attr);
-}
-
-const char *glite_jp_attrval_db_type_index(glite_jp_context_t ctx,const char *attr,int len)
-{
- glite_jp_tplug_data_t *ap = get_plugin(ctx,attr);
-
- glite_jp_clear_error(ctx);
- return ap->db_type_index(ap->pctx,attr,len);
-}
-
-/* XXX: UNIX time, should be ISO blahblah */
-time_t glite_jp_attr2time(const char *a)
-{
- long t;
-
- sscanf(a,"%ld",&t);
- return t;
-}
-
-/* XXX: UNIX time, should be ISO blahblah */
-char * glite_jp_time2attr(time_t t)
-{
- char *r;
-
- trio_asprintf(&r,"%ld",(long) t);
- return r;
-}
-
+++ /dev/null
-#include <string.h>
-#include <stdlib.h>
-
-#include "types.h"
-#include "context.h"
-
-int glite_jp_init_context(glite_jp_context_t *ctx)
-{
- return (*ctx = calloc(1,sizeof **ctx)) != NULL;
-}
-
-void glite_jp_free_context(glite_jp_context_t ctx)
-{
- glite_jp_clear_error(ctx);
- free(ctx);
-}
-
-char *glite_jp_peer_name(glite_jp_context_t ctx)
-{
- return strdup(ctx->peer ? ctx->peer : "unknown");
-}
-
-char *glite_jp_error_chain(glite_jp_context_t ctx)
-{
- char *ret = NULL,indent[300] = "";
- int len = 0,add;
- char buf[2000];
-
- glite_jp_error_t *ep = ctx->error;
-
- do {
- add = snprintf(buf,sizeof buf,"%s%s: %s (%s)\n",
- indent,
- ep->source,
- strerror(ep->code),
- ep->desc ? ep->desc : "");
- ret = realloc(ret,len + add + 1);
- strncpy(ret + len,buf,add); ret[len += add] = 0;
- strcat(indent," ");
- } while (ep = ep->reason);
-
- return ret;
-}
-
-int glite_jp_stack_error(glite_jp_context_t ctx, const glite_jp_error_t *err)
-{
- glite_jp_error_t *reason = ctx->error;
-
- ctx->error = calloc(1,sizeof *ctx->error);
- ctx->error->code = err->code;
- ctx->error->desc = err->desc ? strdup(err->desc) : NULL;
- ctx->error->source = err->source ? strdup(err->source) : NULL;
- ctx->error->reason = reason;
-
- return err->code;
-}
-
-int glite_jp_clear_error(glite_jp_context_t ctx)
-{
- glite_jp_error_t *e = ctx->error, *r;
-
- while (e) {
- r = e->reason;
- free((char *) e->source);
- free((char *) e->desc);
- free(e);
- e = r;
- }
- ctx->error = NULL;
- return 0;
-}
-
-
-void glite_jp_free_query_rec(glite_jp_query_rec_t *q)
-{
- free(q->attr);
- free(q->value);
- free(q->value2);
- memset(q,0,sizeof *q);
-}
-
-int glite_jp_queryrec_copy(glite_jp_query_rec_t *dst, const glite_jp_query_rec_t *src)
-{
- memcpy(dst,src,sizeof *src);
- if (src->attr) dst->attr = strdup(src->attr);
- if (src->value) dst->value = strdup(src->value);
- if (src->value2) dst->value2 = strdup(src->value2);
- return 0;
-}
-
-int glite_jp_run_deferred(glite_jp_context_t ctx)
-{
- int i,cnt,ret;
-
- if (!ctx->deferred_func) return 0;
-
- glite_jp_clear_error(ctx);
- for (cnt=0;ctx->deferred_func[cnt];cnt++);
- for (i=0; i<cnt; i++) {
- if (ret = (*ctx->deferred_func)(ctx,*ctx->deferred_arg)) {
- glite_jp_error_t err;
- char desc[100];
-
- sprintf(desc,"calling func #%d, %p",i,*ctx->deferred_func);
- err.code = ret;
- err.desc = desc;
- err.source = "glite_jp_run_deferred()";
-
- glite_jp_stack_error(ctx,&err);
- return ret;
- }
- else {
- memmove(ctx->deferred_func,ctx->deferred_func+1,
- (cnt-i) * sizeof *ctx->deferred_func);
- memmove(ctx->deferred_arg,ctx->deferred_arg+1,
- (cnt-i) * sizeof *ctx->deferred_arg);
- }
- }
- free(ctx->deferred_func); ctx->deferred_func = NULL;
- free(ctx->deferred_arg); ctx->deferred_arg = NULL;
- return 0;
-}
-
-int glite_jp_add_deferred(
- glite_jp_context_t ctx,
- int (*func)(glite_jp_context_t, void *),
- void *arg
-)
-{
- int (**v)(glite_jp_context_t, void *) = ctx->deferred_func;
- int i;
-
- for (i=0; v && v[i]; i++);
-
- ctx->deferred_func = realloc(ctx->deferred_func, (i+2) * sizeof *ctx->deferred_func);
- ctx->deferred_func[i] = func;
- ctx->deferred_func[i+1] = NULL;
-
- ctx->deferred_arg = realloc(ctx->deferred_arg,(i+2) * sizeof *ctx->deferred_arg);
- ctx->deferred_arg[i] = arg;
- ctx->deferred_arg[i+1] = NULL;
-
- return 0;
-}
+++ /dev/null
-#ident "$Header$"
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-
-#include "escape.h"
-
-#define ULM_QM '"'
-#define ULM_BS '\\'
-#define ULM_LF '\n'
-
-
-/*
- *----------------------------------------------------------------------
- *
- * \fn char *edg_wll_LogEscape(const char *str)
- * \param str a string to escape
- * \return new (allocated) escaped string
- * \brief in given string escape all ULM_QM, ULM_BS and ULM_LF by ULM_BS
- *
- * Calls: malloc, strlen
- *
- * Algorithm: array lookup
- * - the new string will be allocated
- *
- *----------------------------------------------------------------------
- */
-
-char *edg_wll_LogEscape(const char *str)
-{
-unsigned int i,j;
-size_t size;
-char *ret;
-
-if (str == NULL) return NULL;
-if ((size = strlen(str)) == 0) return strdup("");
-
-ret = (char*) malloc(1+2*size*sizeof(char));
-
-j = 0;
-for (i=0; i<size; i++) {
- if ((str[i] != ULM_BS) && (str[i] != ULM_QM) && (str[i] != ULM_LF)) {
- ret[j] = str[i];
- j++;
- }
- else {
- ret[j] = ULM_BS;
- if (str[i] == ULM_LF) {
- ret[j+1] = 'n';
- }
- else {
- ret[j+1] = str[i];
- }
- j += 2;
- }
-} /* for */
-
-ret[j] = 0;
-
-return ret;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * \fn char *edg_wll_LogUnescape(const char *str)
- * \param str a string to unescape
- * \return new (allocated) unescaped string
- * \brief in given string unescape all escaped ULM_QM, ULM_BS and ULM_LF
- *
- * Calls: malloc, strlen
- *
- * Algorithm: array lookup
- * - the new string will be allocated
- *
- *----------------------------------------------------------------------
- */
-
-char *edg_wll_LogUnescape(const char *str)
-{
-unsigned int i,j;
-size_t size;
-char *ret;
-
-if (str == NULL) return NULL;
-
-size = strlen(str);
-ret = (char*) malloc(1+size*sizeof(char));
-
-/*
-j = 0;
-for (i=0; i<size; i++) {
- if ( (str[i] != ULM_BS) ||
- ((str[i] == ULM_BS) && ((str[i+1] != ULM_BS) && (str[i+1] != ULM_QM) && (str[i+1] != 'n'))) )
- {
- if (str[i] == ULM_LF) { ret[j] = 'n'; }
- else { ret[j] = str[i]; }
- j++;
- }
-}
-*/
-for (i=j=0; i<size; i++,j++)
- if (str[i] == ULM_BS) switch(str[++i]) {
- case 'n': ret[j] = ULM_LF; break;
- default: ret[j] = str[i]; break;
- } else { ret[j] = str[i]; }
-
-ret[j] = '\0';
-
-return ret;
-}
-
-static const struct {
- const char c,*e;
-} xml_etab[] = {
- { '<',"lt" },
- { '>',"gt" },
- { '&',"amp" },
- { '"',"quot" },
- { '\'',"apos" },
- { 0, NULL }
-};
-
-#define XML_ESCAPE_SET "<>&\"'"
-
-char *edg_wll_EscapeXML(const char *in)
-{
- const char* tmp_in;
- char *out;
- int cnt,i,j,k;
-
- if (!in) return NULL;
-
- for (cnt = 0, tmp_in = in; *tmp_in != '\0'; ++tmp_in) {
- if (strchr(XML_ESCAPE_SET, *tmp_in) ||
- (*tmp_in & 0x7f) < 0x20 /* control character */ ||
- (*tmp_in == '%')) cnt++;
- }
-
- out = malloc(strlen(in)+1+cnt*5);
-
- for (i=j=0; in[i]; i++) {
- for (k=0; xml_etab[k].c && xml_etab[k].c != in[i]; k++);
- if (xml_etab[k].c) {
- int l;
-
- out[j++] = '&';
- memcpy(out+j,xml_etab[k].e,l=strlen(xml_etab[k].e));
- j += l;
- out[j++] = ';';
- } else if ((in[i] & 0x7f) < 0x20 || in[i] == '%') {
- sprintf(out+j, "%%%02x", (unsigned char)in[i]);
- j+=3;
- } else {
- out[j++] = in[i];
- }
- }
- out[j] = 0;
- return out;
-}
-
-char *edg_wll_UnescapeXML(const char *in)
-{
- char *out;
- int i,j,k;
- char xtmp[3];
- unsigned char origchar;
-
- if (!in) return NULL;
- out = malloc(strlen(in)+1);
-
- for (i=j=0; in[i]; j++) if (in[i] == '&') {
- char *s = strchr(in+i,';');
- if (s) {
- int l = s-in-i+1;
- for (k=0; xml_etab[k].c && strncasecmp(in+i+1,xml_etab[k].e,l-2); k++);
- if (xml_etab[k].c) {
- out[j] = xml_etab[k].c;
- i += l;
- } else out[j] = in[i++];
- } else out[j] = in[i++];
- } else if (in[i] == '%') {
- if (isxdigit(xtmp[0]=in[i+1]) && isxdigit(xtmp[1]=in[i+2])) {
- xtmp[2] = '\0';
- origchar = (unsigned char) strtol(xtmp, NULL, 16);
- if ((origchar & 0x7f) < 0x20 || origchar == '%') {
- out[j] = origchar;
- i += 3;
- } else out[j] = in[i++];
- } else out[j] = in[i++];
- } else {
- out[j] = in[i++];
- }
- out[j] = 0;
- return out;
-}
-
-char *edg_wll_EscapeSQL(const char *in)
-{
- const char* tmp_in;
- char *out = NULL;
- int i,j,cnt;
-
- if (!in) return NULL;
-
- for (cnt = 0, tmp_in = in; (tmp_in = strchr(tmp_in,'\'')) != NULL; ++tmp_in) {
- ++cnt;
- }
- for (tmp_in = in; (tmp_in = strchr(tmp_in,'\\')) != NULL; ++tmp_in) {
- ++cnt;
- }
-
- out = malloc(strlen(in)+1+cnt);
-
- for (i=j=0; in[i]; i++) {
- if (in[i] == '\\') out[j++] = '\\';
- if (in[i] == '\'') out[j++] = '\'';
- out[j++] = in[i];
- }
- out[j] = 0;
-
- return out;
-}
+++ /dev/null
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "lb/trio.h"
-
-#include "types.h"
-#include "type_plugin.h"
-
-static char *namespace = "http://glite.org/wsdl/types/jp_std_attr";
-
-static int check_namespace(const glite_jp_attr_t *a)
-{
- if (a->namespace && strcmp(a->namespace,namespace)) return -1;
- return 0;
-}
-
-static int *cmp(
- void *ctx,
- const glite_jp_attrval_t *a,
- const glite_jp_attrval_t *b,
- int *result
-{
- struct timeval t;
- int r;
-
- if (check_namespace(&a->attr) || check_namespace(&b->attr)) return -1;
- if (glite_jp_attr_cmp(&a->attr,&b->attr)) return -1;
-
- switch (a->attr.type) {
- case GLITE_JP_ATTR_OWNER:
- r = strcmp(a->value.s,b->value.s);
- break;
- case GLITE_JP_ATTR_TIME:
- t = a->value.time;
- t.tv_sec -= b->value.time.tv_sec;
- if ((t.tv_usec -= b->value.time.tv_usec) < 0) {
- t.tv_usec += 1000000;
- t.tv_sec--;
- }
- r = t.tv_sec ? t.tv_sec : t.tv_usec;
- if (r) r = r > 0 ? 1 : -1;
- break;
- case GLITE_JP_ATTR_TAG:
- if (a->value.tag.binary != b->value.tag.binary) return -1;
- if (a->value.tag.binary) {
- /* FIXME: I'm lazy. */
- abort();
- }
- else r = strcmp(a->value.tag.value,b->value.tag.value);
- default: return -1;
- }
- *result = r;
- return 0;
-}
-
-static char *to_xml(void *ctx,const glite_jp_attrval_t *a)
-{
- char *out = NULL;
-
- if (check_namespace(a)) return NULL;
-
- switch (a->attr.type) {
- case GLITE_JP_ATTR_OWNER:
- trio_asprintf(&out,"%|Xs",a->value.s);
- break;
- case GLITE_JP_ATTR_TIME:
- /* XXX */
- trio_asprintf(&out,"%ld.06%ld",a->value.time.tv_sec,
- a->value.time.tv_usec);
- break;
- case GLITE_JP_ATTR_TAG:
- /* FIXME */ assert(!a->value.tag.binary);
-
- trio_asprintf(&out,"<seq>%d</seq><timestamp>%ld></timestamp>%|Xs",a->value.tag.sequence,a->value.tag.timestamp,a->value.tag.value);
- break;
- default:
- break;
- }
- return out;
-}
-
-static glite_jp_attrval_t *from_xml(void *ctx,const char *name,const char *val)
-{
- /* FIXME: I'm lazy. */
- abort();
-}
-
-static char *to_db(void *ctx,const glite_jp_attrval_t *a)
-{
- /* FIXME: I'm lazy. */
- abort();
-}
-
-static glite_jp_attrval_t *from_db(void *ctx,const char *a)
-{
- /* FIXME: I'm lazy. */
- abort();
-}
-
-static const char *db_type(void *ctx,const glite_jp_attr_t *a)
-{
- if check_namespace(a) return NULL;
- switch (a->type) {
- case GLITE_JP_ATTR_OWNER: return "varchar(250) binary";
- case GLITE_JP_ATTR_TIME: return "datetime";
- case GLITE_JP_ATTR_TAG: return "mediumblob";
- default: return NULL;
- }
-}
-
-int init(
- glite_jp_context_t ctx,
- const char *param,
- glite_jp_tplug_data *pd
-)
-{
- pd->namespace = namespace;
- pd->cmp = cmp;
- pd->to_xml = to_xml;
- pd->from_xml = from_xml;
- pd->to_db = to_db;
- pd->from_db = from_db;
- pd->db_type = db_type;
- pd->pctx = ctx;
-}
-
+++ /dev/null
-/*************************************************************************
- *
- * $Id$
- *
- * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- ************************************************************************/
-
-/*
- * TODO
- * - StrToLongDouble
- */
-
-static const char rcsid[] = "@(#)$Id$";
-
-#if defined(unix) || defined(__xlC__) || defined(__QNX__)
-# define PLATFORM_UNIX
-#elif defined(WIN32) || defined(_WIN32)
-# define PLATFORM_WIN32
-#elif defined(AMIGA) && defined(__GNUC__)
-# define PLATFORM_UNIX
-#endif
-
-#if defined(__STDC__) && (__STDC_VERSION__ >= 199901L)
-# define TRIO_C99
-#endif
-
-#include "strio.h"
-#include <string.h>
-#include <locale.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include <time.h>
-#include <math.h>
-#ifndef DEBUG
-# define NDEBUG
-#endif
-#include <assert.h>
-
-#ifndef NULL
-# define NULL 0
-#endif
-#define NIL ((char)0)
-#ifndef FALSE
-# define FALSE (1 == 0)
-# define TRUE (! FALSE)
-#endif
-
-#define VALID(x) (NULL != (x))
-#define INVALID(x) (NULL == (x))
-
-#if defined(PLATFORM_UNIX)
-# define USE_STRCASECMP
-# define USE_STRNCASECMP
-# define USE_STRERROR
-# if defined(__QNX__)
-# define strcasecmp(x,y) stricmp(x,y)
-# define strncasecmp(x,y,n) strnicmp(x,y,n)
-# endif
-#elif defined(PLATFORM_WIN32)
-# define USE_STRCASECMP
-# define strcasecmp(x,y) strcmpi(x,y)
-#endif
-
-/*************************************************************************
- * StrAppendMax
- */
-char *StrAppendMax(char *target, size_t max, const char *source)
-{
- assert(VALID(target));
- assert(VALID(source));
- assert(max > 0);
-
- max -= StrLength(target) + 1;
- return (max > 0) ? strncat(target, source, max) : target;
-}
-
-/*************************************************************************
- * StrCopyMax
- */
-char *StrCopyMax(char *target, size_t max, const char *source)
-{
- assert(VALID(target));
- assert(VALID(source));
- assert(max > 0); /* Includes != 0 */
-
- target = strncpy(target, source, max - 1);
- target[max - 1] = (char)0;
- return target;
-}
-
-/*************************************************************************
- * StrDuplicate
- */
-char *StrDuplicate(const char *source)
-{
- char *target;
-
- assert(VALID(source));
-
- target = StrAlloc(StrLength(source) + 1);
- if (target)
- {
- StrCopy(target, source);
- }
- return target;
-}
-
-/*************************************************************************
- * StrDuplicateMax
- */
-char *StrDuplicateMax(const char *source, size_t max)
-{
- char *target;
- size_t len;
-
- assert(VALID(source));
- assert(max > 0);
-
- /* Make room for string plus a terminating zero */
- len = StrLength(source) + 1;
- if (len > max)
- {
- len = max;
- }
- target = StrAlloc(len);
- if (target)
- {
- StrCopyMax(target, len, source);
- }
- return target;
-}
-
-/*************************************************************************
- * StrEqual
- */
-int StrEqual(const char *first, const char *second)
-{
- assert(VALID(first));
- assert(VALID(second));
-
- if (VALID(first) && VALID(second))
- {
-#if defined(USE_STRCASECMP)
- return (0 == strcasecmp(first, second));
-#else
- while ((*first != NIL) && (*second != NIL))
- {
- if (toupper(*first) != toupper(*second))
- {
- break;
- }
- first++;
- second++;
- }
- return ((*first == NIL) && (*second == NIL));
-#endif
- }
- return FALSE;
-}
-
-/*************************************************************************
- * StrEqualCase
- */
-int StrEqualCase(const char *first, const char *second)
-{
- assert(VALID(first));
- assert(VALID(second));
-
- if (VALID(first) && VALID(second))
- {
- return (0 == strcmp(first, second));
- }
- return FALSE;
-}
-
-/*************************************************************************
- * StrEqualCaseMax
- */
-int StrEqualCaseMax(const char *first, size_t max, const char *second)
-{
- assert(VALID(first));
- assert(VALID(second));
-
- if (VALID(first) && VALID(second))
- {
- return (0 == strncmp(first, second, max));
- }
- return FALSE;
-}
-
-/*************************************************************************
- * StrEqualLocale
- */
-int StrEqualLocale(const char *first, const char *second)
-{
- assert(VALID(first));
- assert(VALID(second));
-
-#if defined(LC_COLLATE)
- return (strcoll(first, second) == 0);
-#else
- return StrEqual(first, second);
-#endif
-}
-
-/*************************************************************************
- * StrEqualMax
- */
-int StrEqualMax(const char *first, size_t max, const char *second)
-{
- assert(VALID(first));
- assert(VALID(second));
-
- if (VALID(first) && VALID(second))
- {
-#if defined(USE_STRNCASECMP)
- return (0 == strncasecmp(first, second, max));
-#else
- /* Not adequately tested yet */
- size_t cnt = 0;
- while ((*first != NIL) && (*second != NIL) && (cnt <= max))
- {
- if (toupper(*first) != toupper(*second))
- {
- break;
- }
- first++;
- second++;
- cnt++;
- }
- return ((cnt == max) || ((*first == NIL) && (*second == NIL)));
-#endif
- }
- return FALSE;
-}
-
-/*************************************************************************
- * StrError
- */
-const char *StrError(int errorNumber)
-{
-#if defined(USE_STRERROR)
- return strerror(errorNumber);
-#else
- return "unknown";
-#endif
-}
-
-/*************************************************************************
- * StrFormatDate
- */
-size_t StrFormatDateMax(char *target,
- size_t max,
- const char *format,
- const struct tm *datetime)
-{
- assert(VALID(target));
- assert(VALID(format));
- assert(VALID(datetime));
- assert(max > 0);
-
- return strftime(target, max, format, datetime);
-}
-
-/*************************************************************************
- * StrHash
- */
-unsigned long StrHash(const char *string, int type)
-{
- unsigned long value = 0L;
- char ch;
-
- assert(VALID(string));
-
- switch (type)
- {
- case STRIO_HASH_PLAIN:
- while ( (ch = *string++) != NIL )
- {
- value *= 31;
- value += (unsigned long)ch;
- }
- break;
- default:
- assert(FALSE);
- break;
- }
- return value;
-}
-
-/*************************************************************************
- * StrMatch
- */
-int StrMatch(char *string, char *pattern)
-{
- assert(VALID(string));
- assert(VALID(pattern));
-
- for (; ('*' != *pattern); ++pattern, ++string)
- {
- if (NIL == *string)
- {
- return (NIL == *pattern);
- }
- if ((toupper((int)*string) != toupper((int)*pattern))
- && ('?' != *pattern))
- {
- return FALSE;
- }
- }
- /* two-line patch to prevent *too* much recursiveness: */
- while ('*' == pattern[1])
- pattern++;
-
- do
- {
- if ( StrMatch(string, &pattern[1]) )
- {
- return TRUE;
- }
- }
- while (*string++);
-
- return FALSE;
-}
-
-/*************************************************************************
- * StrMatchCase
- */
-int StrMatchCase(char *string, char *pattern)
-{
- assert(VALID(string));
- assert(VALID(pattern));
-
- for (; ('*' != *pattern); ++pattern, ++string)
- {
- if (NIL == *string)
- {
- return (NIL == *pattern);
- }
- if ((*string != *pattern)
- && ('?' != *pattern))
- {
- return FALSE;
- }
- }
- /* two-line patch to prevent *too* much recursiveness: */
- while ('*' == pattern[1])
- pattern++;
-
- do
- {
- if ( StrMatchCase(string, &pattern[1]) )
- {
- return TRUE;
- }
- }
- while (*string++);
-
- return FALSE;
-}
-
-/*************************************************************************
- * StrSpanFunction
- *
- * Untested
- */
-size_t StrSpanFunction(char *source, int (*Function)(int))
-{
- size_t count = 0;
-
- assert(VALID(source));
- assert(VALID(Function));
-
- while (*source != NIL)
- {
- if (Function(*source))
- break; /* while */
- source++;
- count++;
- }
- return count;
-}
-
-/*************************************************************************
- * StrSubstringMax
- */
-char *StrSubstringMax(const char *string, size_t max, const char *find)
-{
- size_t count;
- size_t size;
- char *result = NULL;
-
- assert(VALID(string));
- assert(VALID(find));
-
- size = StrLength(find);
- if (size <= max)
- {
- for (count = 0; count <= max - size; count++)
- {
- if (StrEqualMax(find, size, &string[count]))
- {
- result = (char *)&string[count];
- break;
- }
- }
- }
- return result;
-}
-
-/*************************************************************************
- * StrToDouble
- *
- * double ::= [ <sign> ]
- * ( <number> |
- * <number> <decimal_point> <number> |
- * <decimal_point> <number> )
- * [ <exponential> [ <sign> ] <number> ]
- * number ::= 1*( <digit> )
- * digit ::= ( '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' )
- * exponential ::= ( 'e' | 'E' )
- * sign ::= ( '-' | '+' )
- * decimal_point ::= '.'
- */
-double StrToDouble(const char *source, const char **endp)
-{
-#if defined(TRIO_C99)
- return strtod(source, endp);
-#else
- /* Preliminary code */
- int isNegative = FALSE;
- int isExponentNegative = FALSE;
- unsigned long integer = 0;
- unsigned long fraction = 0;
- unsigned long fracdiv = 1;
- unsigned long exponent = 0;
- double value = 0.0;
-
- /* First try hex-floats */
- if ((source[0] == '0') && ((source[1] == 'x') || (source[1] == 'X')))
- {
- source += 2;
- while (isxdigit((int)*source))
- {
- integer *= 16;
- integer += (isdigit((int)*source)
- ? (*source - '0')
- : 10 + (toupper((int)*source) - 'A'));
- source++;
- }
- if (*source == '.')
- {
- source++;
- while (isxdigit((int)*source))
- {
- fraction *= 16;
- fraction += (isdigit((int)*source)
- ? (*source - '0')
- : 10 + (toupper((int)*source) - 'A'));
- fracdiv *= 16;
- source++;
- }
- if ((*source == 'p') || (*source == 'P'))
- {
- source++;
- if ((*source == '+') || (*source == '-'))
- {
- isExponentNegative = (*source == '-');
- source++;
- }
- while (isdigit((int)*source))
- {
- exponent *= 10;
- exponent += (*source - '0');
- source++;
- }
- }
- }
- }
- else /* Then try normal decimal floats */
- {
- isNegative = (*source == '-');
- /* Skip sign */
- if ((*source == '+') || (*source == '-'))
- source++;
-
- /* Integer part */
- while (isdigit((int)*source))
- {
- integer *= 10;
- integer += (*source - '0');
- source++;
- }
-
- if (*source == '.')
- {
- source++; /* skip decimal point */
- while (isdigit((int)*source))
- {
- fraction *= 10;
- fraction += (*source - '0');
- fracdiv *= 10;
- source++;
- }
- }
- if ((*source == 'e') || (*source == 'E'))
- {
- source++; /* Skip exponential indicator */
- isExponentNegative = (*source == '-');
- if ((*source == '+') || (*source == '-'))
- source++;
- while (isdigit((int)*source))
- {
- exponent *= 10;
- exponent += (*source - '0');
- source++;
- }
- }
- }
-
- value = (double)integer;
- if (fraction != 0)
- {
- value += (double)fraction / (double)fracdiv;
- }
- if (exponent != 0)
- {
- if (isExponentNegative)
- value /= pow((double)10, (double)exponent);
- else
- value *= pow((double)10, (double)exponent);
- }
- if (isNegative)
- value = -value;
-
- if (endp)
- *endp = source;
- return value;
-#endif
-}
-
-/*************************************************************************
- * StrToFloat
- */
-float StrToFloat(const char *source, const char **endp)
-{
-#if defined(TRIO_C99)
- return strtof(source, endp);
-#else
- return (float)StrToDouble(source, endp);
-#endif
-}
-
-/*************************************************************************
- * StrToUpper
- */
-int StrToUpper(char *target)
-{
- int i = 0;
-
- assert(VALID(target));
-
- while (NIL != *target)
- {
- *target = toupper((int)*target);
- target++;
- i++;
- }
- return i;
-}
+++ /dev/null
-/*************************************************************************
- *
- * $Id$
- *
- * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- ************************************************************************/
-
-#ifndef TRIO_STRIO_H
-#define TRIO_STRIO_H
-
-#if !(defined(DEBUG) || defined(NDEBUG))
-# define NDEBUG
-#endif
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#ifndef STRIO_MALLOC
-# define STRIO_MALLOC(n) malloc(n)
-#endif
-#ifndef STRIO_FREE
-# define STRIO_FREE(x) free(x)
-#endif
-
-/*
- * StrAppend(target, source)
- * StrAppendMax(target, maxsize, source)
- *
- * Append 'source' to 'target'
- *
- * target = StrAlloc(size)
- *
- * Allocate a new string
- *
- * StrContains(target, substring)
- *
- * Find out if the string 'substring' is
- * contained in the string 'target'
- *
- * StrCopy(target, source)
- * StrCopyMax(target, maxsize, source)
- *
- * Copy 'source' to 'target'
- *
- * target = StrDuplicate(source)
- * target = StrDuplicateMax(source, maxsize)
- *
- * Allocate and copy 'source' to 'target'
- *
- * StrEqual(first, second)
- * StrEqualMax(first, maxsize, second)
- *
- * Compare if 'first' is equal to 'second'.
- * Case-independent.
- *
- * StrEqualCase(first, second)
- * StrEqualCaseMax(first, maxsize, second)
- *
- * Compare if 'first' is equal to 'second'
- * Case-dependent. Please note that the use of the
- * word 'case' has the opposite meaning as that of
- * strcasecmp().
- *
- * StrFormat(target, format, ...)
- * StrFormatMax(target, maxsize, format, ...)
- *
- * Build 'target' according to 'format' and succesive
- * arguments. This is equal to the sprintf() and
- * snprintf() functions.
- *
- * StrFormatDate(target, format, ...)
- *
- * StrFree(target)
- *
- * De-allocates a string
- *
- * StrHash(string, type)
- *
- * Calculates the hash value of 'string' based on the
- * 'type'.
- *
- * StrIndex(target, character)
- * StrIndexLast(target, character)
- *
- * Find the first/last occurrence of 'character' in
- * 'target'
- *
- * StrLength(target)
- *
- * Return the length of 'target'
- *
- * StrMatch(string, pattern)
- * StrMatchCase(string, pattern)
- *
- * Find 'pattern' within 'string'. 'pattern' may contain
- * wildcards such as * (asterics) and ? (question mark)
- * which matches zero or more characters and exactly
- * on character respectively
- *
- * StrScan(source, format, ...)
- *
- * Equal to sscanf()
- *
- * StrSubstring(target, substring)
- *
- * Find the first occurrence of the string 'substring'
- * within the string 'target'
- *
- * StrTokenize(target, list)
- *
- * Split 'target' into the first token delimited by
- * one of the characters in 'list'. If 'target' is
- * NULL then next token will be returned.
- *
- * StrToUpper(target)
- *
- * Convert all lower case characters in 'target' into
- * upper case characters.
- */
-
-enum {
- STRIO_HASH_NONE = 0,
- STRIO_HASH_PLAIN,
- STRIO_HASH_TWOSIGNED
-};
-
-#if !defined(DEBUG) || defined(__DECC)
-#define StrAlloc(n) (char *)STRIO_MALLOC(n)
-#define StrAppend(x,y) strcat((x), (y))
-#define StrContains(x,y) (0 != strstr((x), (y)))
-#define StrCopy(x,y) strcpy((x), (y))
-#define StrIndex(x,y) strchr((x), (y))
-#define StrIndexLast(x,y) strrchr((x), (y))
-#define StrFree(x) STRIO_FREE(x)
-#define StrLength(x) strlen((x))
-#define StrSubstring(x,y) strstr((x), (y))
-#define StrTokenize(x,y) strtok((x), (y))
-#define StrToLong(x,y,n) strtol((x), (y), (n))
-#define StrToUnsignedLong(x,y,n) strtoul((x), (y), (n))
-#else /* DEBUG */
- /*
- * To be able to use these macros everywhere, including in
- * if() sentences, the assertions are put first in a comma
- * seperated list.
- *
- * Unfortunately the DECC compiler does not seem to like this
- * so it will use the un-asserted functions above for the
- * debugging case too.
- */
-#define StrAlloc(n) \
- (assert((n) > 0),\
- (char *)STRIO_MALLOC(n))
-#define StrAppend(x,y) \
- (assert((x) != NULL),\
- assert((y) != NULL),\
- strcat((x), (y)))
-#define StrContains(x,y) \
- (assert((x) != NULL),\
- assert((y) != NULL),\
- (0 != strstr((x), (y))))
-#define StrCopy(x,y) \
- (assert((x) != NULL),\
- assert((y) != NULL),\
- strcpy((x), (y)))
-#define StrIndex(x,c) \
- (assert((x) != NULL),\
- strchr((x), (c)))
-#define StrIndexLast(x,c) \
- (assert((x) != NULL),\
- strrchr((x), (c)))
-#define StrFree(x) \
- (assert((x) != NULL),\
- STRIO_FREE(x))
-#define StrLength(x) \
- (assert((x) != NULL),\
- strlen((x)))
-#define StrSubstring(x,y) \
- (assert((x) != NULL),\
- assert((y) != NULL),\
- strstr((x), (y)))
-#define StrTokenize(x,y) \
- (assert((y) != NULL),\
- strtok((x), (y)))
-#define StrToLong(x,y,n) \
- (assert((x) != NULL),\
- assert((y) != NULL),\
- assert((n) >= 2 && (n) <= 36),\
- strtol((x), (y), (n)))
-#define StrToUnsignedLong(x,y,n) \
- (assert((x) != NULL),\
- assert((y) != NULL),\
- assert((n) >= 2 && (n) <= 36),\
- strtoul((x), (y), (n)))
-#endif /* DEBUG */
-
-char *StrAppendMax(char *target, size_t max, const char *source);
-char *StrCopyMax(char *target, size_t max, const char *source);
-char *StrDuplicate(const char *source);
-char *StrDuplicateMax(const char *source, size_t max);
-int StrEqual(const char *first, const char *second);
-int StrEqualCase(const char *first, const char *second);
-int StrEqualCaseMax(const char *first, size_t max, const char *second);
-int StrEqualLocale(const char *first, const char *second);
-int StrEqualMax(const char *first, size_t max, const char *second);
-const char *StrError(int);
-size_t StrFormatDateMax(char *target, size_t max, const char *format, const struct tm *datetime);
-unsigned long StrHash(const char *string, int type);
-int StrMatch(char *string, char *pattern);
-int StrMatchCase(char *string, char *pattern);
-size_t StrSpanFunction(char *source, int (*Function)(int));
-char *StrSubstringMax(const char *string, size_t max, const char *find);
-float StrToFloat(const char *source, const char **target);
-double StrToDouble(const char *source, const char **target);
-int StrToUpper(char *target);
-
-#endif /* TRIO_STRIO_H */
+++ /dev/null
-#include <openssl/md5.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "strmd5.h"
-
-static char mbuf[33];
-
-static const char* b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
-
-static char *b64r;
-
-int base64_encode(const void *enc, int enc_size, char *out, int out_max_size)
-{
-
- unsigned char* enc_buf = (unsigned char*)enc;
- int out_size = 0;
- unsigned int bits = 0;
- unsigned int shift = 0;
-
- while ( out_size < out_max_size ) {
- if ( enc_size>0 ) {
- // Shift in byte
- bits <<= 8;
- bits |= *enc_buf;
- shift += 8;
- // Next byte
- enc_buf++;
- enc_size--;
- } else if ( shift>0 ) {
- // Pad last bits to 6 bits - will end next loop
- bits <<= 6 - shift;
- shift = 6;
- } else {
- // Terminate with Mime style '='
- *out = '=';
- out_size++;
-
- return out_size;
- }
-
- // Encode 6 bit segments
- while ( shift>=6 ) {
- shift -= 6;
- *out = b64[ (bits >> shift) & 0x3F ];
- out++;
- out_size++;
- }
- }
-
- // Output overflow
- return -1;
-}
-
-int base64_decode(const char *enc,char *out,int max_out_size)
-{
- unsigned int bits = 0;
- int shift = 0;
- int out_size = 0;
-
- if (!b64r) {
- int i;
- b64r = calloc(128,1);
-
- for (i=0; b64[i]; i++) b64r[b64[i]] = i;
- }
-
- while (*enc && *enc != '=') {
- bits << 6;
- bits |= b64r[*enc++];
- shift += 6;
-
- while (shift >= 8) {
- if (out_size >= max_out_size) return -1;
- shift -= 8;
- *out++ = (bits >> shift) & 0xff;
- out_size++;
- }
- }
-
- /* XXX: will it ever happen? */
- if (shift) {
- if (out_size >= max_out_size) return -1;
- bits <<= 8-shift;
- *out = bits & 0xff;
- out_size++;
- }
-
- return out_size;
-}
-
-char *strmd5(const char *s, unsigned char *digest)
-{
- MD5_CTX md5;
- unsigned char d[16];
- int i;
-
- MD5_Init(&md5);
- MD5_Update(&md5,s,strlen(s));
- MD5_Final(d,&md5);
-
- if (digest) memcpy(digest,d,sizeof(d));
-
- for (i=0; i<16; i++) {
- int dd = d[i] & 0x0f;
- mbuf[2*i+1] = dd<10 ? dd+'0' : dd-10+'a';
- dd = d[i] >> 4;
- mbuf[2*i] = dd<10 ? dd+'0' : dd-10+'a';
- }
- mbuf[32] = 0;
- return (char *) mbuf;
-}
-
-char *str2md5(const char *s)
-{
- MD5_CTX md5;
- unsigned char d[16];
- char* ret = malloc(33);
- int i;
-
- if (!ret)
- return NULL;
-
- MD5_Init(&md5);
- MD5_Update(&md5, s, strlen(s));
- MD5_Final(d, &md5);
-
- for (i=0; i<16; i++) {
- int dd = d[i] & 0x0f;
- ret[2*i+1] = dd<10 ? dd+'0' : dd-10+'a';
- dd = d[i] >> 4;
- ret[2*i] = dd<10 ? dd+'0' : dd-10+'a';
- }
- ret[32] = 0;
- return ret;
-}
-
-char *str2md5base64(const char *s)
-{
- MD5_CTX md5;
- unsigned char d[16];
- char buf[50];
- int l;
-
- MD5_Init(&md5);
- MD5_Update(&md5, s, strlen(s));
- MD5_Final(d, &md5);
-
- l = base64_encode(d, 16, buf, sizeof(buf) - 1);
- if (l < 1)
- return NULL;
- buf[l - 1] = 0;
- return strdup(buf);
-}
+++ /dev/null
-
-/*************************************************************************
- *
- * $Id$
- *
- * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- *************************************************************************
- *
- * A note to trio contributors:
- *
- * Avoid heap allocation at all costs to ensure that the trio functions
- * are async-safe. The exceptions are the printf/fprintf functions, which
- * uses fputc, and the asprintf functions and the <alloc> modifier, which
- * by design are required to allocate form the heap.
- *
- ************************************************************************/
-
-/*
- * TODO:
- * - Scan is probably too permissive about its modifiers.
- * - C escapes in %#[] ?
- * - C99 support has not been properly tested.
- * - Multibyte characters (done for format parsing, except scan groups)
- * - Complex numbers? (C99 _Complex)
- * - Boolean values? (C99 _Bool)
- * - C99 NaN(n-char-sequence) missing
- * - Should we support the GNU %a alloc modifier? GNU has an ugly hack
- * for %a, because C99 used %a for other purposes. If specified as
- * %as or %a[ it is interpreted as the alloc modifier, otherwise as
- * the C99 hex-float. This means that you cannot scan %as as a hex-float
- * immediately followed by an 's'.
- * - Scanning of collating symbols.
- */
-
-static const char rcsid[] = "@(#)$Id$";
-
-/*************************************************************************
- * Trio include files
- */
-#include "trio.h"
-#include "triop.h"
-#include "strio.h"
-
-#ifdef DATAGRID_EXTENSION
-#include "glite/lb/events.h"
-#include "escape.h"
-//#include "edg/workload/thirdparty/trio/events.h"
-#endif
-
-/*
- * Encode the error code and the position. This is decoded
- * with TRIO_ERROR_CODE and TRIO_ERROR_POSITION.
- */
-#if TRIO_ERRORS
-# define TRIO_ERROR_RETURN(x,y) (- ((x) + ((y) << 8)))
-#else
-# define TRIO_ERROR_RETURN(x,y) (-1)
-#endif
-
-
-/*************************************************************************
- * Platform and compiler support detection
- */
-#if defined(unix) || defined(__xlC__) || defined(_AIX) || defined(__QNX__)
-# define PLATFORM_UNIX
-#elif defined(AMIGA) && defined(__GNUC__)
-# define PLATFORM_UNIX
-#elif defined(WIN32) || defined(_WIN32) || defined(_MSC_VER)
-# define PLATFORM_WIN32
-# define TRIO_MSVC_5 1100
-#endif
-
-#if defined(__STDC__) && defined(__STDC_VERSION__)
-# if (__STDC_VERSION__ >= 199409L)
-# define TRIO_COMPILER_SUPPORTS_ISO94
-# endif
-# if (__STDC_VERSION__ >= 199901L)
-# define TRIO_COMPILER_SUPPORTS_C99
-# endif
-#endif
-
-#if defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)
-# define TRIO_COMPILER_SUPPORTS_UNIX98
-#endif
-
-#if defined(__STDC_ISO_10646__) || defined(MB_LEN_MAX) || defined(USE_MULTIBYTE) || TRIO_WIDECHAR
-# define TRIO_COMPILER_SUPPORTS_MULTIBYTE
-# if !defined(MB_LEN_MAX)
-# define MB_LEN_MAX 6
-# endif
-#endif
-
-
-/*************************************************************************
- * Generic definitions
- */
-
-#if !(defined(DEBUG) || defined(NDEBUG))
-# define NDEBUG
-#endif
-#include <assert.h>
-#include <ctype.h>
-#if !defined(TRIO_COMPILER_SUPPORTS_C99) && !defined(isblank)
-# define isblank(x) (((x)==32) || ((x)==9))
-#endif
-#include <math.h>
-#include <limits.h>
-#include <float.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <errno.h>
-
-#ifndef NULL
-# define NULL 0
-#endif
-#define NIL ((char)0)
-#ifndef FALSE
-# define FALSE (1 == 0)
-# define TRUE (! FALSE)
-#endif
-#define BOOLEAN_T int
-
-/* mincore() can be used for debugging purposes */
-#define VALID(x) (NULL != (x))
-
-/* xlC crashes on log10(0) */
-#define guarded_log10(x) (((x) == 0.0) ? -HUGE_VAL : log10(x))
-#define guarded_log16(x) (guarded_log10(x) / log10(16.0))
-
-
-/*************************************************************************
- * Platform specific definitions
- */
-#if defined(PLATFORM_UNIX)
-# include <unistd.h>
-# include <signal.h>
-# include <locale.h>
-# define USE_LOCALE
-#endif /* PLATFORM_UNIX */
-#if defined(PLATFORM_WIN32)
-# include <io.h>
-# define read _read
-# define write _write
-#endif /* PLATFORM_WIN32 */
-
-#if TRIO_WIDECHAR
-# if defined(TRIO_COMPILER_SUPPORTS_ISO94)
-# include <wchar.h>
-# include <wctype.h>
-# else
-typedef char wchar_t;
-typedef int wint_t;
-# define WEOF EOF
-# define iswalnum(x) isalnum(x)
-# define iswalpha(x) isalpha(x)
-# define iswblank(x) isblank(x)
-# define iswcntrl(x) iscntrl(x)
-# define iswdigit(x) isdigit(x)
-# define iswgraph(x) isgraph(x)
-# define iswlower(x) islower(x)
-# define iswprint(x) isprint(x)
-# define iswpunct(x) ispunct(x)
-# define iswspace(x) isspace(x)
-# define iswupper(x) isupper(x)
-# define iswxdigit(x) isxdigit(x)
-# endif
-#endif
-
-
-/*************************************************************************
- * Compiler dependent definitions
- */
-
-/* Support for long long */
-#ifndef __cplusplus
-# if !defined(USE_LONGLONG)
-# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-# define USE_LONGLONG
-# elif defined(__SUNPRO_C)
-# define USE_LONGLONG
-# elif defined(_LONG_LONG) || defined(_LONGLONG)
-# define USE_LONGLONG
-# endif
-# endif
-#endif
-
-/* The extra long numbers */
-#if defined(USE_LONGLONG)
-typedef signed long long int trio_longlong_t;
-typedef unsigned long long int trio_ulonglong_t;
-#elif defined(_MSC_VER)
-# if (_MSC_VER >= TRIO_MSVC_5)
-typedef signed __int64 trio_longlong_t;
-typedef unsigned __int64 trio_ulonglong_t;
-# else
-typedef signed long int trio_longlong_t;
-typedef unsigned long int trio_ulonglong_t;
-# endif
-#else
-typedef signed long int trio_longlong_t;
-typedef unsigned long int trio_ulonglong_t;
-#endif
-
-/* Maximal and fixed integer types */
-#if defined(TRIO_COMPILER_SUPPORTS_C99)
-# include <stdint.h>
-typedef intmax_t trio_intmax_t;
-typedef uintmax_t trio_uintmax_t;
-typedef int8_t trio_int8_t;
-typedef int16_t trio_int16_t;
-typedef int32_t trio_int32_t;
-typedef int64_t trio_int64_t;
-#elif defined(TRIO_COMPILER_SUPPORTS_UNIX98)
-# include <inttypes.h>
-typedef intmax_t trio_intmax_t;
-typedef uintmax_t trio_uintmax_t;
-typedef int8_t trio_int8_t;
-typedef int16_t trio_int16_t;
-typedef int32_t trio_int32_t;
-typedef int64_t trio_int64_t;
-#elif defined(_MSC_VER) && (_MSC_VER >= TRIO_MSVC_5)
-typedef trio_longlong_t trio_intmax_t;
-typedef trio_ulonglong_t trio_uintmax_t;
-typedef __int8 trio_int8_t;
-typedef __int16 trio_int16_t;
-typedef __int32 trio_int32_t;
-typedef __int64 trio_int64_t;
-#else
-typedef trio_longlong_t trio_intmax_t;
-typedef trio_ulonglong_t trio_uintmax_t;
-# if defined(TRIO_INT8_T)
-typedef TRIO_INT8_T trio_int8_t;
-# else
-typedef signed char trio_int8_t;
-# endif
-# if defined(TRIO_INT16_T)
-typedef TRIO_INT16_T trio_int16_t;
-# else
-typedef signed short trio_int16_t;
-# endif
-# if defined(TRIO_INT32_T)
-typedef TRIO_INT32_T trio_int32_t;
-# else
-typedef signed int trio_int32_t;
-# endif
-# if defined(TRIO_INT64_T)
-typedef TRIO_INT64_T trio_int64_t;
-# else
-typedef trio_longlong_t trio_int64_t;
-# endif
-#endif
-
-
-/*************************************************************************
- * Internal definitions
- */
-
-/* Long double sizes */
-#ifdef LDBL_DIG
-# define MAX_MANTISSA_DIGITS LDBL_DIG
-# define MAX_EXPONENT_DIGITS 4
-#else
-# define MAX_MANTISSA_DIGITS DBL_DIG
-# define MAX_EXPONENT_DIGITS 3
-#endif
-
-/* The maximal number of digits is for base 2 */
-#define MAX_CHARS_IN(x) (sizeof(x) * CHAR_BIT)
-/* The width of a pointer. The number of bits in a hex digit is 4 */
-#define POINTER_WIDTH ((sizeof("0x") - 1) + sizeof(void *) * CHAR_BIT / 4)
-
-/* Infinite and Not-A-Number for floating-point */
-#define INFINITE_LOWER "inf"
-#define INFINITE_UPPER "INF"
-#define LONG_INFINITE_LOWER "infinite"
-#define LONG_INFINITE_UPPER "INFINITE"
-#define NAN_LOWER "nan"
-#define NAN_UPPER "NAN"
-
-/* Various constants */
-enum {
- TYPE_PRINT = 1,
- TYPE_SCAN = 2,
-
- /* Flags. Use maximum 32 */
- FLAGS_NEW = 0,
- FLAGS_STICKY = 1,
- FLAGS_SPACE = 2 * FLAGS_STICKY,
- FLAGS_SHOWSIGN = 2 * FLAGS_SPACE,
- FLAGS_LEFTADJUST = 2 * FLAGS_SHOWSIGN,
- FLAGS_ALTERNATIVE = 2 * FLAGS_LEFTADJUST,
- FLAGS_SHORT = 2 * FLAGS_ALTERNATIVE,
- FLAGS_SHORTSHORT = 2 * FLAGS_SHORT,
- FLAGS_LONG = 2 * FLAGS_SHORTSHORT,
- FLAGS_QUAD = 2 * FLAGS_LONG,
- FLAGS_LONGDOUBLE = 2 * FLAGS_QUAD,
- FLAGS_SIZE_T = 2 * FLAGS_LONGDOUBLE,
- FLAGS_PTRDIFF_T = 2 * FLAGS_SIZE_T,
- FLAGS_INTMAX_T = 2 * FLAGS_PTRDIFF_T,
- FLAGS_NILPADDING = 2 * FLAGS_INTMAX_T,
- FLAGS_UNSIGNED = 2 * FLAGS_NILPADDING,
- FLAGS_UPPER = 2 * FLAGS_UNSIGNED,
- FLAGS_WIDTH = 2 * FLAGS_UPPER,
- FLAGS_WIDTH_PARAMETER = 2 * FLAGS_WIDTH,
- FLAGS_PRECISION = 2 * FLAGS_WIDTH_PARAMETER,
- FLAGS_PRECISION_PARAMETER = 2 * FLAGS_PRECISION,
- FLAGS_BASE = 2 * FLAGS_PRECISION_PARAMETER,
- FLAGS_BASE_PARAMETER = 2 * FLAGS_BASE,
- FLAGS_FLOAT_E = 2 * FLAGS_BASE_PARAMETER,
- FLAGS_FLOAT_G = 2 * FLAGS_FLOAT_E,
- FLAGS_QUOTE = 2 * FLAGS_FLOAT_G,
- FLAGS_WIDECHAR = 2 * FLAGS_QUOTE,
- FLAGS_ALLOC = 2 * FLAGS_WIDECHAR,
- FLAGS_IGNORE = 2 * FLAGS_ALLOC,
- FLAGS_IGNORE_PARAMETER = 2 * FLAGS_IGNORE,
- FLAGS_VARSIZE_PARAMETER = 2 * FLAGS_IGNORE_PARAMETER,
- FLAGS_FIXED_SIZE = 2 * FLAGS_VARSIZE_PARAMETER,
- /* Reused flags */
- FLAGS_EXCLUDE = FLAGS_SHORT,
- FLAGS_USER_DEFINED = FLAGS_IGNORE,
- /* Compounded flags */
- FLAGS_ALL_VARSIZES = FLAGS_LONG | FLAGS_QUAD | FLAGS_INTMAX_T | FLAGS_PTRDIFF_T | FLAGS_SIZE_T,
- FLAGS_ALL_SIZES = FLAGS_ALL_VARSIZES | FLAGS_SHORTSHORT | FLAGS_SHORT,
-
- NO_POSITION = -1,
- NO_WIDTH = 0,
- NO_PRECISION = -1,
- NO_SIZE = -1,
-
- NO_BASE = -1,
- MIN_BASE = 2,
- MAX_BASE = 36,
- BASE_BINARY = 2,
- BASE_OCTAL = 8,
- BASE_DECIMAL = 10,
- BASE_HEX = 16,
-
- /* Maximal number of allowed parameters */
- MAX_PARAMETERS = 64,
- /* Maximal number of characters in class */
- MAX_CHARACTER_CLASS = UCHAR_MAX,
-
- /* Maximal string lengths for user-defined specifiers */
- MAX_USER_NAME = 64,
- MAX_USER_DATA = 256,
-
- /* Maximal length of locale separator strings */
- MAX_LOCALE_SEPARATOR_LENGTH = MB_LEN_MAX,
- /* Maximal number of integers in grouping */
- MAX_LOCALE_GROUPS = 64
-};
-
-#define NO_GROUPING ((int)CHAR_MAX)
-
-/* Fundamental formatting parameter types */
-#define FORMAT_UNKNOWN 0
-#define FORMAT_INT 1
-#define FORMAT_DOUBLE 2
-#define FORMAT_CHAR 3
-#define FORMAT_STRING 4
-#define FORMAT_POINTER 5
-#define FORMAT_COUNT 6
-#define FORMAT_PARAMETER 7
-#define FORMAT_GROUP 8
-#if TRIO_GNU
-# define FORMAT_ERRNO 9
-#endif
-#if TRIO_EXTENSION
-# define FORMAT_USER_DEFINED 10
-#endif
-
-/* Character constants */
-#define CHAR_IDENTIFIER '%'
-#define CHAR_BACKSLASH '\\'
-#define CHAR_QUOTE '\"'
-#define CHAR_ADJUST ' '
-
-/* Character class expressions */
-#define CLASS_ALNUM ":alnum:"
-#define CLASS_ALPHA ":alpha:"
-#define CLASS_CNTRL ":cntrl:"
-#define CLASS_DIGIT ":digit:"
-#define CLASS_GRAPH ":graph:"
-#define CLASS_LOWER ":lower:"
-#define CLASS_PRINT ":print:"
-#define CLASS_PUNCT ":punct:"
-#define CLASS_SPACE ":space:"
-#define CLASS_UPPER ":upper:"
-#define CLASS_XDIGIT ":xdigit:"
-
-/*
- * SPECIFIERS:
- *
- *
- * a Hex-float
- * A Hex-float
- * c Character
- * C Widechar character (wint_t)
- * d Decimal
- * e Float
- * E Float
- * F Float
- * F Float
- * g Float
- * G Float
- * i Integer
- * m Error message
- * n Count
- * o Octal
- * p Pointer
- * s String
- * S Widechar string (wchar_t *)
- * u Unsigned
- * x Hex
- * X Hex
- * [] Group
- * <> User-defined
- *
- * Reserved:
- *
- * D Binary Coded Decimal %D(length,precision) (OS/390)
- */
-#define SPECIFIER_CHAR 'c'
-#define SPECIFIER_STRING 's'
-#define SPECIFIER_DECIMAL 'd'
-#define SPECIFIER_INTEGER 'i'
-#define SPECIFIER_UNSIGNED 'u'
-#define SPECIFIER_OCTAL 'o'
-#define SPECIFIER_HEX 'x'
-#define SPECIFIER_HEX_UPPER 'X'
-#define SPECIFIER_FLOAT_E 'e'
-#define SPECIFIER_FLOAT_E_UPPER 'E'
-#define SPECIFIER_FLOAT_F 'f'
-#define SPECIFIER_FLOAT_F_UPPER 'F'
-#define SPECIFIER_FLOAT_G 'g'
-#define SPECIFIER_FLOAT_G_UPPER 'G'
-#define SPECIFIER_POINTER 'p'
-#define SPECIFIER_GROUP '['
-#define SPECIFIER_UNGROUP ']'
-#define SPECIFIER_COUNT 'n'
-#if TRIO_UNIX98
-# define SPECIFIER_CHAR_UPPER 'C'
-# define SPECIFIER_STRING_UPPER 'S'
-#endif
-#if TRIO_C99
-# define SPECIFIER_HEXFLOAT 'a'
-# define SPECIFIER_HEXFLOAT_UPPER 'A'
-#endif
-#if TRIO_GNU
-# define SPECIFIER_ERRNO 'm'
-#endif
-#if TRIO_EXTENSION
-# define SPECIFIER_BINARY 'b'
-# define SPECIFIER_BINARY_UPPER 'B'
-# define SPECIFIER_USER_DEFINED_BEGIN '<'
-# define SPECIFIER_USER_DEFINED_END '>'
-# define SPECIFIER_USER_DEFINED_SEPARATOR ':'
-#endif
-
-/*
- * QUALIFIERS:
- *
- *
- * Numbers = d,i,o,u,x,X
- * Float = a,A,e,E,f,F,g,G
- * String = s
- * Char = c
- *
- *
- * 9$ Position
- * Use the 9th parameter. 9 can be any number between 1 and
- * the maximal argument
- *
- * 9 Width
- * Set width to 9. 9 can be any number, but must not be postfixed
- * by '$'
- *
- * h Short
- * Numbers:
- * (unsigned) short int
- *
- * hh Short short
- * Numbers:
- * (unsigned) char
- *
- * l Long
- * Numbers:
- * (unsigned) long int
- * String:
- * as the S specifier
- * Char:
- * as the C specifier
- *
- * ll Long Long
- * Numbers:
- * (unsigned) long long int
- *
- * L Long Double
- * Float
- * long double
- *
- * # Alternative
- * Float:
- * Decimal-point is always present
- * String:
- * non-printable characters are handled as \number
- *
- * Spacing
- *
- * + Sign
- *
- * - Alignment
- *
- * . Precision
- *
- * * Parameter
- * print: use parameter
- * scan: no parameter (ignore)
- *
- * q Quad
- *
- * Z size_t
- *
- * w Widechar
- *
- * ' Thousands/quote
- * Numbers:
- * Integer part grouped in thousands
- * Binary numbers:
- * Number grouped in nibbles (4 bits)
- * String:
- * Quoted string
- *
- * j intmax_t
- * t prtdiff_t
- * z size_t
- *
- * ! Sticky
- * @ Parameter (for both print and scan)
- *
- * I n-bit Integer
- * Numbers:
- * The following options exists
- * I8 = 8-bit integer
- * I16 = 16-bit integer
- * I32 = 32-bit integer
- * I64 = 64-bit integer
- */
-#define QUALIFIER_POSITION '$'
-#define QUALIFIER_SHORT 'h'
-#define QUALIFIER_LONG 'l'
-#define QUALIFIER_LONG_UPPER 'L'
-#define QUALIFIER_ALTERNATIVE '#'
-#define QUALIFIER_SPACE ' '
-#define QUALIFIER_PLUS '+'
-#define QUALIFIER_MINUS '-'
-#define QUALIFIER_DOT '.'
-#define QUALIFIER_STAR '*'
-#define QUALIFIER_CIRCUMFLEX '^'
-#if TRIO_C99
-# define QUALIFIER_SIZE_T 'z'
-# define QUALIFIER_PTRDIFF_T 't'
-# define QUALIFIER_INTMAX_T 'j'
-#endif
-#if TRIO_BSD || TRIO_GNU
-# define QUALIFIER_QUAD 'q'
-#endif
-#if TRIO_GNU
-# define QUALIFIER_SIZE_T_UPPER 'Z'
-#endif
-#if TRIO_MISC
-# define QUALIFIER_WIDECHAR 'w'
-#endif
-#if TRIO_MICROSOFT
-# define QUALIFIER_FIXED_SIZE 'I'
-#endif
-#if TRIO_EXTENSION
-# define QUALIFIER_QUOTE '\''
-# define QUALIFIER_STICKY '!'
-# define QUALIFIER_VARSIZE '&' /* This should remain undocumented */
-# define QUALIFIER_PARAM '@' /* Experimental */
-# define QUALIFIER_COLON ':' /* For scanlists */
-# define QUALIFIER_EQUAL '=' /* For scanlists */
-#endif
-#if DATAGRID_EXTENSION
-# define QUALIFIER_ESCAPE '|'
-#endif
-
-
-/*************************************************************************
- * Internal structures
- */
-
-/* Parameters */
-typedef struct {
- int type;
- unsigned long flags;
- int width;
- int precision;
- int base;
- int varsize;
-#ifdef QUALIFIER_ESCAPE
- enum dg_escape { ESCAPE_NONE, ESCAPE_ULM, ESCAPE_XML, ESCAPE_SQL } escape;
-#endif
- int indexAfterSpecifier;
- union {
- char *string;
-#if TRIO_WIDECHAR
- wchar_t *wstring;
-#endif
- void *pointer;
- union {
- trio_uintmax_t as_signed;
- trio_intmax_t as_unsigned;
- } number;
- double doubleNumber;
- double *doublePointer;
- long double longdoubleNumber;
- long double *longdoublePointer;
- int errorNumber;
- } data;
- /* For the user-defined specifier */
- char user_name[MAX_USER_NAME];
- char user_data[MAX_USER_DATA];
-} parameter_T;
-
-/* General trio "class" */
-typedef struct _trio_T {
- void *location;
- void (*OutStream)(struct _trio_T *, int);
- void (*InStream)(struct _trio_T *, int *);
- /*
- * The number of characters that would have been written/read if
- * there had been sufficient space.
- */
- int processed;
- /*
- * The number of characters that are actually written/read.
- * Processed and committed with only differ for the *nprintf
- * and *nscanf functions.
- */
- int committed;
- int max;
- int current;
-} trio_T;
-
-/* References (for user-defined callbacks) */
-typedef struct _reference_T {
- trio_T *data;
- parameter_T *parameter;
-} reference_T;
-
-/* Registered entries (for user-defined callbacks) */
-typedef struct _userdef_T {
- struct _userdef_T *next;
- trio_callback_t callback;
- char *name;
-} userdef_T;
-
-
-/*************************************************************************
- * Internal variables
- */
-
-static const char null[] = "(nil)";
-
-#if defined(USE_LOCALE)
-static struct lconv *internalLocaleValues = NULL;
-#endif
-
-/*
- * UNIX98 says "in a locale where the radix character is not defined,
- * the radix character defaults to a period (.)"
- */
-static char internalDecimalPoint[MAX_LOCALE_SEPARATOR_LENGTH + 1] = ".";
-static char internalThousandSeparator[MAX_LOCALE_SEPARATOR_LENGTH + 1] = ",";
-static char internalGrouping[MAX_LOCALE_GROUPS] = { (char)NO_GROUPING };
-
-static const char internalDigitsLower[] = "0123456789abcdefghijklmnopqrstuvwxyz";
-static const char internalDigitsUpper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-static BOOLEAN_T internalDigitsUnconverted = TRUE;
-static int internalDigitArray[128];
-#if TRIO_EXTENSION
-static BOOLEAN_T internalCollationUnconverted = TRUE;
-static char internalCollationArray[MAX_CHARACTER_CLASS][MAX_CHARACTER_CLASS];
-#endif
-
-static volatile trio_callback_t internalEnterCriticalRegion = NULL;
-static volatile trio_callback_t internalLeaveCriticalRegion = NULL;
-static userdef_T *internalUserDef = NULL;
-
-
-/*************************************************************************
- * trio_strerror [public]
- */
-const char *trio_strerror(int errorcode)
-{
- /* Textual versions of the error codes */
- switch (TRIO_ERROR_CODE(errorcode))
- {
- case TRIO_EOF:
- return "End of file";
- case TRIO_EINVAL:
- return "Invalid argument";
- case TRIO_ETOOMANY:
- return "Too many arguments";
- case TRIO_EDBLREF:
- return "Double reference";
- case TRIO_EGAP:
- return "Reference gap";
- case TRIO_ENOMEM:
- return "Out of memory";
- case TRIO_ERANGE:
- return "Invalid range";
- default:
- return "Unknown";
- }
-}
-
-/*************************************************************************
- * TrioIsQualifier [private]
- *
- * Description:
- * Remember to add all new qualifiers to this function.
- * QUALIFIER_POSITION must not be added.
- */
-static BOOLEAN_T
-TrioIsQualifier(const char ch)
-{
- /* QUALIFIER_POSITION is not included */
- switch (ch)
- {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- case QUALIFIER_PLUS:
- case QUALIFIER_MINUS:
- case QUALIFIER_SPACE:
- case QUALIFIER_DOT:
- case QUALIFIER_STAR:
- case QUALIFIER_ALTERNATIVE:
- case QUALIFIER_SHORT:
- case QUALIFIER_LONG:
- case QUALIFIER_LONG_UPPER:
- case QUALIFIER_CIRCUMFLEX:
-#if defined(QUALIFIER_SIZE_T)
- case QUALIFIER_SIZE_T:
-#endif
-#if defined(QUALIFIER_PTRDIFF_T)
- case QUALIFIER_PTRDIFF_T:
-#endif
-#if defined(QUALIFIER_INTMAX_T)
- case QUALIFIER_INTMAX_T:
-#endif
-#if defined(QUALIFIER_QUAD)
- case QUALIFIER_QUAD:
-#endif
-#if defined(QUALIFIER_SIZE_T_UPPER)
- case QUALIFIER_SIZE_T_UPPER:
-#endif
-#if defined(QUALIFIER_WIDECHAR)
- case QUALIFIER_WIDECHAR:
-#endif
-#if defined(QUALIFIER_QUOTE)
- case QUALIFIER_QUOTE:
-#endif
-#if defined(QUALIFIER_STICKY)
- case QUALIFIER_STICKY:
-#endif
-#if defined(QUALIFIER_VARSIZE)
- case QUALIFIER_VARSIZE:
-#endif
-#if defined(QUALIFIER_PARAM)
- case QUALIFIER_PARAM:
-#endif
-#if defined(QUALIFIER_FIXED_SIZE)
- case QUALIFIER_FIXED_SIZE:
-#endif
-#ifdef QUALIFIER_ESCAPE
- case QUALIFIER_ESCAPE:
-#endif
- return TRUE;
- default:
- return FALSE;
- }
-}
-
-/*************************************************************************
- * TrioGenerateNan [private]
- *
- * Calculating NaN portably is difficult. Some compilers will emit
- * warnings about divide by zero, and others will simply fail to
- * generate a NaN.
- */
-static double
-TrioGenerateNaN(void)
-{
-#if defined(TRIO_COMPILER_SUPPORTS_C99)
- return nan(NULL);
-#elif defined(DBL_QNAN)
- return DBL_QNAN;
-#elif defined(PLATFORM_UNIX)
- double value;
- void (*signal_handler)(int);
-
- signal_handler = signal(SIGFPE, SIG_IGN);
- value = 0.0 / 0.0;
- signal(SIGFPE, signal_handler);
- return value;
-#else
- return 0.0 / 0.0;
-#endif
-}
-
-/*************************************************************************
- * TrioIsNan [private]
- */
-static int
-TrioIsNan(double number)
-{
-#ifdef isnan
- /* C99 defines isnan() as a macro */
- return isnan(number);
-#else
- double integral, fraction;
-
- return (/* NaN is the only number which does not compare to itself */
- (number != number) ||
- /* Fallback solution if NaN compares to NaN */
- ((number != 0.0) &&
- (fraction = modf(number, &integral),
- integral == fraction)));
-#endif
-}
-
-/*************************************************************************
- * TrioIsInfinite [private]
- */
-static int
-TrioIsInfinite(double number)
-{
-#ifdef isinf
- /* C99 defines isinf() as a macro */
- return isinf(number);
-#else
- return ((number == HUGE_VAL) ? 1 : ((number == -HUGE_VAL) ? -1 : 0));
-#endif
-}
-
-/*************************************************************************
- * TrioSetLocale [private]
- */
-#if defined(USE_LOCALE)
-static void
-TrioSetLocale(void)
-{
- internalLocaleValues = (struct lconv *)localeconv();
- if (internalLocaleValues)
- {
- if ((internalLocaleValues->decimal_point) &&
- (internalLocaleValues->decimal_point[0] != NIL))
- {
- StrCopyMax(internalDecimalPoint,
- sizeof(internalDecimalPoint),
- internalLocaleValues->decimal_point);
- }
- if ((internalLocaleValues->thousands_sep) &&
- (internalLocaleValues->thousands_sep[0] != NIL))
- {
- StrCopyMax(internalThousandSeparator,
- sizeof(internalThousandSeparator),
- internalLocaleValues->thousands_sep);
- }
- if ((internalLocaleValues->grouping) &&
- (internalLocaleValues->grouping[0] != NIL))
- {
- StrCopyMax(internalGrouping,
- sizeof(internalGrouping),
- internalLocaleValues->grouping);
- }
- }
-}
-#endif /* defined(USE_LOCALE) */
-
-/*************************************************************************
- * TrioGetPosition [private]
- *
- * Get the %n$ position.
- */
-static int
-TrioGetPosition(const char *format,
- int *indexPointer)
-{
- char *tmpformat;
- int number = 0;
- int index = *indexPointer;
-
- number = (int)StrToLong(&format[index], &tmpformat, BASE_DECIMAL);
- index = (int)(tmpformat - format);
- if ((number != 0) && (QUALIFIER_POSITION == format[index++]))
- {
- *indexPointer = index;
- /*
- * number is decreased by 1, because n$ starts from 1, whereas
- * the array it is indexing starts from 0.
- */
- return number - 1;
- }
- return NO_POSITION;
-}
-
-/*************************************************************************
- * TrioFindNamespace [private]
- *
- * Find registered user-defined specifier.
- * The prev argument is used for optimisation only.
- */
-static userdef_T *
-TrioFindNamespace(const char *name, userdef_T **prev)
-{
- userdef_T *def;
-
- if (internalEnterCriticalRegion)
- (void)internalEnterCriticalRegion(NULL);
-
- for (def = internalUserDef; def; def = def->next)
- {
- /* Case-sensitive string comparison */
- if (StrEqualCase(def->name, name))
- break;
-
- if (prev)
- *prev = def;
- }
-
- if (internalLeaveCriticalRegion)
- (void)internalLeaveCriticalRegion(NULL);
-
- return def;
-}
-
-/*************************************************************************
- * TrioPreprocess [private]
- *
- * Description:
- * Parse the format string
- */
-static int
-TrioPreprocess(int type,
- const char *format,
- parameter_T *parameters,
- va_list arglist,
- void **argarray)
-{
-#if TRIO_ERRORS
- /* Count the number of times a parameter is referenced */
- unsigned short usedEntries[MAX_PARAMETERS];
-#endif
- /* Parameter counters */
- int parameterPosition;
- int currentParam;
- int maxParam = -1;
- /* Utility variables */
- unsigned long flags;
- int width;
- int precision;
- int varsize;
-#ifdef QUALIFIER_ESCAPE
- enum dg_escape escape;
-#endif
- int base;
- int index; /* Index into formatting string */
- int dots; /* Count number of dots in modifier part */
- BOOLEAN_T positional; /* Does the specifier have a positional? */
- BOOLEAN_T got_sticky = FALSE; /* Are there any sticky modifiers at all? */
- /*
- * indices specifies the order in which the parameters must be
- * read from the va_args (this is necessary to handle positionals)
- */
- int indices[MAX_PARAMETERS];
- int pos = 0;
- /* Various variables */
- char ch;
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- int charlen;
-#endif
- int i = -1;
- int num;
- char *tmpformat;
-
-
-#if TRIO_ERRORS
- /*
- * The 'parameters' array is not initialized, but we need to
- * know which entries we have used.
- */
- memset(usedEntries, 0, sizeof(usedEntries));
-#endif
-
- index = 0;
- parameterPosition = 0;
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- mblen(NULL, 0);
-#endif
-
- while (format[index])
- {
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- if (! isascii(format[index]))
- {
- /*
- * Multibyte characters cannot be legal specifiers or
- * modifiers, so we skip over them.
- */
- charlen = mblen(&format[index], MB_LEN_MAX);
- index += (charlen > 0) ? charlen : 1;
- continue; /* while */
- }
-#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */
- if (CHAR_IDENTIFIER == format[index++])
- {
- if (CHAR_IDENTIFIER == format[index])
- {
- index++;
- continue; /* while */
- }
-
- flags = FLAGS_NEW;
- dots = 0;
- currentParam = TrioGetPosition(format, &index);
- positional = (NO_POSITION != currentParam);
- if (!positional)
- {
- /* We have no positional, get the next counter */
- currentParam = parameterPosition;
- }
- if(currentParam >= MAX_PARAMETERS)
- {
- /* Bail out completely to make the error more obvious */
- return TRIO_ERROR_RETURN(TRIO_ETOOMANY, index);
- }
-
- if (currentParam > maxParam)
- maxParam = currentParam;
-
- /* Default values */
- width = NO_WIDTH;
- precision = NO_PRECISION;
- base = NO_BASE;
- varsize = NO_SIZE;
-#ifdef QUALIFIER_ESCAPE
- escape = ESCAPE_NONE;
-#endif
-
- while (TrioIsQualifier(format[index]))
- {
- ch = format[index++];
-
- switch (ch)
- {
- case QUALIFIER_SPACE:
- flags |= FLAGS_SPACE;
- break;
-
- case QUALIFIER_PLUS:
- flags |= FLAGS_SHOWSIGN;
- break;
-
- case QUALIFIER_MINUS:
- flags |= FLAGS_LEFTADJUST;
- flags &= ~FLAGS_NILPADDING;
- break;
-
- case QUALIFIER_ALTERNATIVE:
- flags |= FLAGS_ALTERNATIVE;
- break;
-
- case QUALIFIER_DOT:
- if (dots == 0) /* Precision */
- {
- dots++;
-
- /* Skip if no precision */
- if (QUALIFIER_DOT == format[index])
- break;
-
- /* After the first dot we have the precision */
- flags |= FLAGS_PRECISION;
- if ((QUALIFIER_STAR == format[index]) ||
- (QUALIFIER_PARAM == format[index]))
- {
- index++;
- flags |= FLAGS_PRECISION_PARAMETER;
-
- precision = TrioGetPosition(format, &index);
- if (precision == NO_POSITION)
- {
- parameterPosition++;
- if (positional)
- precision = parameterPosition;
- else
- {
- precision = currentParam;
- currentParam = precision + 1;
- }
- }
- else
- {
- if (! positional)
- currentParam = precision + 1;
- if (width > maxParam)
- maxParam = precision;
- }
- if (currentParam > maxParam)
- maxParam = currentParam;
- }
- else
- {
- precision = StrToLong(&format[index], &tmpformat, BASE_DECIMAL);
- index = (int)(tmpformat - format);
- }
- }
- else if (dots == 1) /* Base */
- {
- dots++;
-
- /* After the second dot we have the base */
- flags |= FLAGS_BASE;
- if ((QUALIFIER_STAR == format[index]) ||
- (QUALIFIER_PARAM == format[index]))
- {
- index++;
- flags |= FLAGS_BASE_PARAMETER;
- base = TrioGetPosition(format, &index);
- if (base == NO_POSITION)
- {
- parameterPosition++;
- if (positional)
- base = parameterPosition;
- else
- {
- base = currentParam;
- currentParam = base + 1;
- }
- }
- else
- {
- if (! positional)
- currentParam = base + 1;
- if (base > maxParam)
- maxParam = base;
- }
- if (currentParam > maxParam)
- maxParam = currentParam;
- }
- else
- {
- base = StrToLong(&format[index], &tmpformat, BASE_DECIMAL);
- if (base > MAX_BASE)
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- index = (int)(tmpformat - format);
- }
- }
- else
- {
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
- break; /* QUALIFIER_DOT */
-
- case QUALIFIER_PARAM:
- type = TYPE_PRINT;
- /* FALLTHROUGH */
- case QUALIFIER_STAR:
- /* This has different meanings for print and scan */
- if (TYPE_PRINT == type)
- {
- /* Read with from parameter */
- flags |= (FLAGS_WIDTH | FLAGS_WIDTH_PARAMETER);
- width = TrioGetPosition(format, &index);
- if (width == NO_POSITION)
- {
- parameterPosition++;
- if (positional)
- width = parameterPosition;
- else
- {
- width = currentParam;
- currentParam = width + 1;
- }
- }
- else
- {
- if (! positional)
- currentParam = width + 1;
- if (width > maxParam)
- maxParam = width;
- }
- if (currentParam > maxParam)
- maxParam = currentParam;
- }
- else
- {
- /* Scan, but do not store result */
- flags |= FLAGS_IGNORE;
- }
-
- break; /* QUALIFIER_STAR */
-
- case '0':
- if (! (flags & FLAGS_LEFTADJUST))
- flags |= FLAGS_NILPADDING;
- /* FALLTHROUGH */
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- flags |= FLAGS_WIDTH;
- /* &format[index - 1] is used to "rewind" the read
- * character from format
- */
- width = StrToLong(&format[index - 1], &tmpformat, BASE_DECIMAL);
- index = (int)(tmpformat - format);
- break;
-
- case QUALIFIER_SHORT:
- if (flags & FLAGS_SHORTSHORT)
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- else if (flags & FLAGS_SHORT)
- flags |= FLAGS_SHORTSHORT;
- else
- flags |= FLAGS_SHORT;
- break;
-
- case QUALIFIER_LONG:
- if (flags & FLAGS_QUAD)
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- else if (flags & FLAGS_LONG)
- flags |= FLAGS_QUAD;
- else
- flags |= FLAGS_LONG;
- break;
-
- case QUALIFIER_LONG_UPPER:
- flags |= FLAGS_LONGDOUBLE;
- break;
-
-#if defined(QUALIFIER_SIZE_T)
- case QUALIFIER_SIZE_T:
- flags |= FLAGS_SIZE_T;
- /* Modify flags for later truncation of number */
- if (sizeof(size_t) == sizeof(trio_ulonglong_t))
- flags |= FLAGS_QUAD;
- else if (sizeof(size_t) == sizeof(long))
- flags |= FLAGS_LONG;
- break;
-#endif
-
-#if defined(QUALIFIER_PTRDIFF_T)
- case QUALIFIER_PTRDIFF_T:
- flags |= FLAGS_PTRDIFF_T;
- if (sizeof(ptrdiff_t) == sizeof(trio_ulonglong_t))
- flags |= FLAGS_QUAD;
- else if (sizeof(ptrdiff_t) == sizeof(long))
- flags |= FLAGS_LONG;
- break;
-#endif
-
-#if defined(QUALIFIER_INTMAX_T)
- case QUALIFIER_INTMAX_T:
- flags |= FLAGS_INTMAX_T;
- if (sizeof(trio_intmax_t) == sizeof(trio_ulonglong_t))
- flags |= FLAGS_QUAD;
- else if (sizeof(trio_intmax_t) == sizeof(long))
- flags |= FLAGS_LONG;
- break;
-#endif
-
-#if defined(QUALIFIER_QUAD)
- case QUALIFIER_QUAD:
- flags |= FLAGS_QUAD;
- break;
-#endif
-
-#if defined(QUALIFIER_FIXED_SIZE)
- case QUALIFIER_FIXED_SIZE:
- if (flags & FLAGS_FIXED_SIZE)
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
-
- if (flags & (FLAGS_ALL_SIZES | FLAGS_LONGDOUBLE |
- FLAGS_WIDECHAR | FLAGS_VARSIZE_PARAMETER))
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
-
- if ((format[index] == '6') &&
- (format[index + 1] == '4'))
- {
- varsize = sizeof(trio_int64_t);
- index += 2;
- }
- else if ((format[index] == '3') &&
- (format[index + 1] == '2'))
- {
- varsize = sizeof(trio_int32_t);
- index += 2;
- }
- else if ((format[index] == '1') &&
- (format[index + 1] == '6'))
- {
- varsize = sizeof(trio_int16_t);
- index += 2;
- }
- else if (format[index] == '8')
- {
- varsize = sizeof(trio_int8_t);
- index++;
- }
- else
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
-
- flags |= FLAGS_FIXED_SIZE;
- break;
-#endif
-
-#ifdef QUALIFIER_ESCAPE
- case QUALIFIER_ESCAPE:
- switch (format[index++]) {
- case 'U': escape = ESCAPE_ULM; break;
- case 'X': escape = ESCAPE_XML; break;
- case 'S': escape = ESCAPE_SQL; break;
- default: return TRIO_ERROR_RETURN(TRIO_EINVAL,index);
- }
- break;
-#endif
-
-
-#if defined(QUALIFIER_WIDECHAR)
- case QUALIFIER_WIDECHAR:
- flags |= FLAGS_WIDECHAR;
- break;
-#endif
-
-#if defined(QUALIFIER_SIZE_T_UPPER)
- case QUALIFIER_SIZE_T_UPPER:
- break;
-#endif
-
-#if defined(QUALIFIER_QUOTE)
- case QUALIFIER_QUOTE:
- flags |= FLAGS_QUOTE;
- break;
-#endif
-
-#if defined(QUALIFIER_STICKY)
- case QUALIFIER_STICKY:
- flags |= FLAGS_STICKY;
- got_sticky = TRUE;
- break;
-#endif
-
-#if defined(QUALIFIER_VARSIZE)
- case QUALIFIER_VARSIZE:
- flags |= FLAGS_VARSIZE_PARAMETER;
- parameterPosition++;
- if (positional)
- varsize = parameterPosition;
- else
- {
- varsize = currentParam;
- currentParam = varsize + 1;
- }
- if (currentParam > maxParam)
- maxParam = currentParam;
- break;
-#endif
-
- default:
- /* Bail out completely to make the error more obvious */
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
- } /* while qualifier */
-
- /*
- * Parameters only need the type and value. The value is
- * read later.
- */
- if (flags & FLAGS_WIDTH_PARAMETER)
- {
-#if TRIO_ERRORS
- usedEntries[width] += 1;
-#endif
- parameters[pos].type = FORMAT_PARAMETER;
- indices[width] = pos;
- width = pos++;
- }
- if (flags & FLAGS_PRECISION_PARAMETER)
- {
-#if TRIO_ERRORS
- usedEntries[precision] += 1;
-#endif
- parameters[pos].type = FORMAT_PARAMETER;
- indices[precision] = pos;
- precision = pos++;
- }
- if (flags & FLAGS_BASE_PARAMETER)
- {
-#if TRIO_ERRORS
- usedEntries[base] += 1;
-#endif
- parameters[pos].type = FORMAT_PARAMETER;
- indices[base] = pos;
- base = pos++;
- }
- if (flags & FLAGS_VARSIZE_PARAMETER)
- {
-#if TRIO_ERRORS
- usedEntries[varsize] += 1;
-#endif
- parameters[pos].type = FORMAT_PARAMETER;
- indices[varsize] = pos;
- varsize = pos++;
- }
-
- indices[currentParam] = pos;
-
- switch (format[index++])
- {
-#if defined(SPECIFIER_CHAR_UPPER)
- case SPECIFIER_CHAR_UPPER:
- flags |= FLAGS_WIDECHAR;
- /* FALLTHROUGH */
-#endif
- case SPECIFIER_CHAR:
- if (flags & FLAGS_LONG)
- flags |= FLAGS_WIDECHAR;
- else if (flags & FLAGS_SHORT)
- flags &= ~FLAGS_WIDECHAR;
- parameters[pos].type = FORMAT_CHAR;
- break;
-
-#if defined(SPECIFIER_STRING_UPPER)
- case SPECIFIER_STRING_UPPER:
- flags |= FLAGS_WIDECHAR;
- /* FALLTHROUGH */
-#endif
- case SPECIFIER_STRING:
- if (flags & FLAGS_LONG)
- flags |= FLAGS_WIDECHAR;
- else if (flags & FLAGS_SHORT)
- flags &= ~FLAGS_WIDECHAR;
- parameters[pos].type = FORMAT_STRING;
- break;
-
-
- case SPECIFIER_GROUP:
- if (TYPE_SCAN == type)
- {
- int depth = 1;
- parameters[pos].type = FORMAT_GROUP;
- if (format[index] == QUALIFIER_CIRCUMFLEX)
- index++;
- if (format[index] == SPECIFIER_UNGROUP)
- index++;
- if (format[index] == QUALIFIER_MINUS)
- index++;
- /* Skip nested brackets */
- while (format[index] != NIL)
- {
- if (format[index] == SPECIFIER_GROUP)
- {
- depth++;
- }
- else if (format[index] == SPECIFIER_UNGROUP)
- {
- if (--depth <= 0)
- {
- index++;
- break;
- }
- }
- index++;
- }
- }
- break;
-
- case SPECIFIER_INTEGER:
- parameters[pos].type = FORMAT_INT;
- break;
-
- case SPECIFIER_UNSIGNED:
- flags |= FLAGS_UNSIGNED;
- parameters[pos].type = FORMAT_INT;
- break;
-
- case SPECIFIER_DECIMAL:
- /* Disable base modifier */
- flags &= ~FLAGS_BASE_PARAMETER;
- base = BASE_DECIMAL;
- parameters[pos].type = FORMAT_INT;
- break;
-
- case SPECIFIER_OCTAL:
- flags &= ~FLAGS_BASE_PARAMETER;
- base = BASE_OCTAL;
- parameters[pos].type = FORMAT_INT;
- break;
-
-#if defined(SPECIFIER_BINARY)
- case SPECIFIER_BINARY_UPPER:
- flags |= FLAGS_UPPER;
- /* FALLTHROUGH */
- case SPECIFIER_BINARY:
- flags |= FLAGS_NILPADDING;
- flags &= ~FLAGS_BASE_PARAMETER;
- base = BASE_BINARY;
- parameters[pos].type = FORMAT_INT;
- break;
-#endif
-
- case SPECIFIER_HEX_UPPER:
- flags |= FLAGS_UPPER;
- /* FALLTHROUGH */
- case SPECIFIER_HEX:
- flags |= FLAGS_UNSIGNED;
- flags &= ~FLAGS_BASE_PARAMETER;
- base = BASE_HEX;
- parameters[pos].type = FORMAT_INT;
- break;
-
- case SPECIFIER_FLOAT_E_UPPER:
- flags |= FLAGS_UPPER;
- /* FALLTHROUGH */
- case SPECIFIER_FLOAT_E:
- flags |= FLAGS_FLOAT_E;
- parameters[pos].type = FORMAT_DOUBLE;
- break;
-
- case SPECIFIER_FLOAT_G_UPPER:
- flags |= FLAGS_UPPER;
- /* FALLTHROUGH */
- case SPECIFIER_FLOAT_G:
- flags |= FLAGS_FLOAT_G;
- parameters[pos].type = FORMAT_DOUBLE;
- break;
-
- case SPECIFIER_FLOAT_F_UPPER:
- flags |= FLAGS_UPPER;
- /* FALLTHROUGH */
- case SPECIFIER_FLOAT_F:
- parameters[pos].type = FORMAT_DOUBLE;
- break;
-
- case SPECIFIER_POINTER:
- parameters[pos].type = FORMAT_POINTER;
- break;
-
- case SPECIFIER_COUNT:
- parameters[pos].type = FORMAT_COUNT;
- break;
-
-#if defined(SPECIFIER_HEXFLOAT)
-# if defined(SPECIFIER_HEXFLOAT_UPPER)
- case SPECIFIER_HEXFLOAT_UPPER:
- flags |= FLAGS_UPPER;
- /* FALLTHROUGH */
-# endif
- case SPECIFIER_HEXFLOAT:
- base = BASE_HEX;
- parameters[pos].type = FORMAT_DOUBLE;
- break;
-#endif
-
-#if defined(FORMAT_ERRNO)
- case SPECIFIER_ERRNO:
- parameters[pos].type = FORMAT_ERRNO;
- break;
-#endif
-
-#if defined(SPECIFIER_USER_DEFINED_BEGIN)
- case SPECIFIER_USER_DEFINED_BEGIN:
- {
- unsigned int max;
- int without_namespace = TRUE;
-
- parameters[pos].type = FORMAT_USER_DEFINED;
- parameters[pos].user_name[0] = NIL;
- tmpformat = (char *)&format[index];
-
- while ((ch = format[index]))
- {
- index++;
- if (ch == SPECIFIER_USER_DEFINED_END)
- {
- if (without_namespace)
- {
- /* We must get the handle first */
- parameters[pos].type = FORMAT_PARAMETER;
- parameters[pos].indexAfterSpecifier = index;
- parameters[pos].flags = FLAGS_USER_DEFINED;
- /* Adjust parameters for insertion of new one */
- pos++;
-# if TRIO_ERRORS
- usedEntries[currentParam] += 1;
-# endif
- parameters[pos].type = FORMAT_USER_DEFINED;
- currentParam++;
- indices[currentParam] = pos;
- if (currentParam > maxParam)
- maxParam = currentParam;
- }
- /* Copy the user data */
- max = (unsigned int)(&format[index] - tmpformat);
- if (max > MAX_USER_DATA)
- max = MAX_USER_DATA;
- StrCopyMax(parameters[pos].user_data,
- max,
- tmpformat);
- break; /* while */
- }
- if (ch == SPECIFIER_USER_DEFINED_SEPARATOR)
- {
- without_namespace = FALSE;
- /* Copy the namespace for later looking-up */
- max = (int)(&format[index] - tmpformat);
- if (max > MAX_USER_NAME)
- max = MAX_USER_NAME;
- StrCopyMax(parameters[pos].user_name,
- max,
- tmpformat);
- tmpformat = (char *)&format[index];
- }
- }
- if (ch != SPECIFIER_USER_DEFINED_END)
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
- break;
-#endif /* defined(SPECIFIER_USER_DEFINED_BEGIN) */
-
- default:
- /* Bail out completely to make the error more obvious */
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
-
-#if TRIO_ERRORS
- /* Count the number of times this entry has been used */
- usedEntries[currentParam] += 1;
-#endif
-
- /* Find last sticky parameters */
- if (got_sticky && !(flags & FLAGS_STICKY))
- {
- for (i = pos - 1; i >= 0; i--)
- {
- if (parameters[i].type == FORMAT_PARAMETER)
- continue;
- if ((parameters[i].flags & FLAGS_STICKY) &&
- (parameters[i].type == parameters[pos].type))
- {
- /* Do not overwrite current qualifiers */
- flags |= (parameters[i].flags & (unsigned long)~FLAGS_STICKY);
- if (width == NO_WIDTH)
- width = parameters[i].width;
- if (precision == NO_PRECISION)
- precision = parameters[i].precision;
- if (base == NO_BASE)
- base = parameters[i].base;
- break;
- }
- }
- }
-
- parameters[pos].indexAfterSpecifier = index;
- parameters[pos].flags = flags;
- parameters[pos].width = width;
- parameters[pos].precision = precision;
- parameters[pos].base = (base == NO_BASE) ? BASE_DECIMAL : base;
- parameters[pos].varsize = varsize;
-#ifdef QUALIFIER_ESCAPE
- parameters[pos].escape = escape;
-#endif
- pos++;
-
- if (! positional)
- parameterPosition++;
-
- } /* if identifier */
-
- } /* while format characters left */
-
- for (num = 0; num <= maxParam; num++)
- {
-#if TRIO_ERRORS
- if (usedEntries[num] != 1)
- {
- if (usedEntries[num] == 0) /* gap detected */
- return TRIO_ERROR_RETURN(TRIO_EGAP, num);
- else /* double references detected */
- return TRIO_ERROR_RETURN(TRIO_EDBLREF, num);
- }
-#endif
-
- i = indices[num];
-
- /*
- * FORMAT_PARAMETERS are only present if they must be read,
- * so it makes no sense to check the ignore flag (besides,
- * the flags variable is not set for that particular type)
- */
- if ((parameters[i].type != FORMAT_PARAMETER) &&
- (parameters[i].flags & FLAGS_IGNORE))
- continue; /* for all arguments */
-
- /*
- * The stack arguments are read according to ANSI C89
- * default argument promotions:
- *
- * char = int
- * short = int
- * unsigned char = unsigned int
- * unsigned short = unsigned int
- * float = double
- *
- * In addition to the ANSI C89 these types are read (the
- * default argument promotions of C99 has not been
- * considered yet)
- *
- * long long
- * long double
- * size_t
- * ptrdiff_t
- * intmax_t
- */
- switch (parameters[i].type)
- {
- case FORMAT_GROUP:
- case FORMAT_STRING:
-#if TRIO_WIDECHAR
- if (flags & FLAGS_WIDECHAR)
- {
- parameters[i].data.wstring = (argarray == NULL)
- ? va_arg(arglist, wchar_t *)
- : (wchar_t *)(argarray[num]);
- }
- else
-#endif
- {
- parameters[i].data.string = (argarray == NULL)
- ? va_arg(arglist, char *)
- : (char *)(argarray[num]);
- }
- break;
-
- case FORMAT_POINTER:
- case FORMAT_COUNT:
- case FORMAT_USER_DEFINED:
- case FORMAT_UNKNOWN:
- parameters[i].data.pointer = (argarray == NULL)
- ? va_arg(arglist, void *)
- : argarray[num];
- break;
-
- case FORMAT_CHAR:
- case FORMAT_INT:
- if (TYPE_SCAN == type)
- {
- if (argarray == NULL)
- parameters[i].data.pointer =
- (trio_uintmax_t *)va_arg(arglist, void *);
- else
- {
- if (parameters[i].type == FORMAT_CHAR)
- parameters[i].data.pointer =
- (trio_uintmax_t *)((char *)argarray[num]);
- else if (parameters[i].flags & FLAGS_SHORT)
- parameters[i].data.pointer =
- (trio_uintmax_t *)((short *)argarray[num]);
- else
- parameters[i].data.pointer =
- (trio_uintmax_t *)((int *)argarray[num]);
- }
- }
- else
- {
-#if defined(QUALIFIER_VARSIZE) || defined(QUALIFIER_FIXED_SIZE)
- if ((parameters[i].flags & FLAGS_VARSIZE_PARAMETER) ||
- (parameters[i].flags & FLAGS_FIXED_SIZE))
- {
- if (parameters[i].flags & FLAGS_VARSIZE_PARAMETER)
- {
- /*
- * Variable sizes are mapped onto the fixed sizes, in
- * accordance with integer promotion.
- *
- * Please note that this may not be portable, as we
- * only guess the size, not the layout of the numbers.
- * For example, if int is little-endian, and long is
- * big-endian, then this will fail.
- */
- varsize = (int)parameters[parameters[i].varsize].data.number.as_unsigned;
- }
- else
- {
- /* Used for the I<bits> modifiers */
- varsize = parameters[i].varsize;
- }
- parameters[i].flags &= ~FLAGS_ALL_VARSIZES;
-
- if (varsize <= (int)sizeof(int))
- ;
- else if (varsize <= (int)sizeof(long))
- parameters[i].flags |= FLAGS_LONG;
-#if defined(QUALIFIER_INTMAX_T)
- else if (varsize <= (int)sizeof(trio_longlong_t))
- parameters[i].flags |= FLAGS_QUAD;
- else
- parameters[i].flags |= FLAGS_INTMAX_T;
-#else
- else
- parameters[i].flags |= FLAGS_QUAD;
-#endif
- }
-#endif /* defined(QUALIFIER_VARSIZE) */
-#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER)
- if (parameters[i].flags & FLAGS_SIZE_T)
- parameters[i].data.number.as_unsigned = (argarray == NULL)
- ? (trio_uintmax_t)va_arg(arglist, size_t)
- : (trio_uintmax_t)(*((size_t *)argarray[num]));
- else
-#endif
-#if defined(QUALIFIER_PTRDIFF_T)
- if (parameters[i].flags & FLAGS_PTRDIFF_T)
- parameters[i].data.number.as_unsigned = (argarray == NULL)
- ? (trio_uintmax_t)va_arg(arglist, ptrdiff_t)
- : (trio_uintmax_t)(*((ptrdiff_t *)argarray[num]));
- else
-#endif
-#if defined(QUALIFIER_INTMAX_T)
- if (parameters[i].flags & FLAGS_INTMAX_T)
- parameters[i].data.number.as_unsigned = (argarray == NULL)
- ? (trio_uintmax_t)va_arg(arglist, trio_intmax_t)
- : (trio_uintmax_t)(*((trio_intmax_t *)argarray[num]));
- else
-#endif
- if (parameters[i].flags & FLAGS_QUAD)
- parameters[i].data.number.as_unsigned = (argarray == NULL)
- ? (trio_uintmax_t)va_arg(arglist, trio_ulonglong_t)
- : (trio_uintmax_t)(*((trio_ulonglong_t *)argarray[num]));
- else if (parameters[i].flags & FLAGS_LONG)
- parameters[i].data.number.as_unsigned = (argarray == NULL)
- ? (trio_uintmax_t)va_arg(arglist, long)
- : (trio_uintmax_t)(*((long *)argarray[num]));
- else
- {
- if (argarray == NULL)
- parameters[i].data.number.as_unsigned = (trio_uintmax_t)va_arg(arglist, int);
- else
- {
- if (parameters[i].type == FORMAT_CHAR)
- parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((char *)argarray[num]));
- else if (parameters[i].flags & FLAGS_SHORT)
- parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((short *)argarray[num]));
- else
- parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((int *)argarray[num]));
- }
- }
- }
- break;
-
- case FORMAT_PARAMETER:
- /*
- * The parameter for the user-defined specifier is a pointer,
- * whereas the rest (width, precision, base) uses an integer.
- */
- if (parameters[i].flags & FLAGS_USER_DEFINED)
- parameters[i].data.pointer = (argarray == NULL)
- ? va_arg(arglist, void *)
- : argarray[num];
- else
- parameters[i].data.number.as_unsigned = (argarray == NULL)
- ? (trio_uintmax_t)va_arg(arglist, int)
- : (trio_uintmax_t)(*((int *)argarray[num]));
- break;
-
- case FORMAT_DOUBLE:
- if (TYPE_SCAN == type)
- {
- if (parameters[i].flags & FLAGS_LONG)
- parameters[i].data.longdoublePointer = (argarray == NULL)
- ? va_arg(arglist, long double *)
- : (long double *)((long double *)argarray[num]);
- else
- {
- if (argarray == NULL)
- parameters[i].data.doublePointer =
- va_arg(arglist, double *);
- else
- {
- if (parameters[i].flags & FLAGS_SHORT)
- parameters[i].data.doublePointer =
- (double *)((float *)argarray[num]);
- else
- parameters[i].data.doublePointer =
- (double *)((double *)argarray[num]);
- }
- }
- }
- else
- {
- if (parameters[i].flags & FLAGS_LONG)
- parameters[i].data.longdoubleNumber = (argarray == NULL)
- ? va_arg(arglist, long double)
- : (long double)(*((long double *)argarray[num]));
- else
- {
- if (argarray == NULL)
- parameters[i].data.longdoubleNumber = (long double)va_arg(arglist, double);
- else
- {
- if (parameters[i].flags & FLAGS_SHORT)
- parameters[i].data.longdoubleNumber = (long double)(*((float *)argarray[num]));
- else
- parameters[i].data.longdoubleNumber = (long double)(long double)(*((double *)argarray[num]));
- }
- }
- }
- break;
-
-#if defined(FORMAT_ERRNO)
- case FORMAT_ERRNO:
- parameters[i].data.errorNumber = errno;
- break;
-#endif
-
- default:
- break;
- }
- } /* for all specifiers */
- return num;
-}
-
-
-/*************************************************************************
- *
- * @FORMATTING
- *
- ************************************************************************/
-
-
-/*************************************************************************
- * TrioWriteNumber [private]
- *
- * Description:
- * Output a number.
- * The complexity of this function is a result of the complexity
- * of the dependencies of the flags.
- */
-static void
-TrioWriteNumber(trio_T *self,
- trio_uintmax_t number,
- unsigned long flags,
- int width,
- int precision,
- int base)
-{
- BOOLEAN_T isNegative;
- char buffer[MAX_CHARS_IN(trio_uintmax_t) * (1 + MAX_LOCALE_SEPARATOR_LENGTH) + 1];
- char *bufferend;
- char *pointer;
- const char *digits;
- int i;
- int length;
- char *p;
- int charsPerThousand;
- int groupingIndex;
- int count;
-
- assert(VALID(self));
- assert(VALID(self->OutStream));
- assert((base >= MIN_BASE && base <= MAX_BASE) || (base == NO_BASE));
-
- digits = (flags & FLAGS_UPPER) ? internalDigitsUpper : internalDigitsLower;
-
- isNegative = (flags & FLAGS_UNSIGNED)
- ? FALSE
- : ((trio_intmax_t)number < 0);
- if (isNegative)
- number = -number;
-
- if (flags & FLAGS_QUAD)
- number &= (trio_ulonglong_t)-1;
- else if (flags & FLAGS_LONG)
- number &= (unsigned long)-1;
- else
- number &= (unsigned int)-1;
-
- /* Build number */
- pointer = bufferend = &buffer[sizeof(buffer) - 1];
- *pointer-- = NIL;
- charsPerThousand = (int)internalGrouping[0];
- groupingIndex = 1;
- for (i = 1; i < (int)sizeof(buffer); i++)
- {
- *pointer-- = digits[number % base];
- number /= base;
- if (number == 0)
- break;
-
- if ((flags & FLAGS_QUOTE)
- && (charsPerThousand != NO_GROUPING)
- && (i % charsPerThousand == 0))
- {
- /*
- * We are building the number from the least significant
- * to the most significant digit, so we have to copy the
- * thousand separator backwards
- */
- length = StrLength(internalThousandSeparator);
- if (((int)(pointer - buffer) - length) > 0)
- {
- p = &internalThousandSeparator[length - 1];
- while (length-- > 0)
- *pointer-- = *p--;
- }
-
- /* Advance to next grouping number */
- switch (internalGrouping[groupingIndex])
- {
- case CHAR_MAX: /* Disable grouping */
- charsPerThousand = NO_GROUPING;
- break;
- case 0: /* Repeat last group */
- break;
- default:
- charsPerThousand = (int)internalGrouping[groupingIndex++];
- break;
- }
- }
- }
-
- /* Adjust width */
- width -= (bufferend - pointer) - 1;
-
- /* Adjust precision */
- if (NO_PRECISION != precision)
- {
- precision -= (bufferend - pointer) - 1;
- if (precision < 0)
- precision = 0;
- flags |= FLAGS_NILPADDING;
- }
-
- /* Adjust width further */
- if (isNegative || (flags & FLAGS_SHOWSIGN) || (flags & FLAGS_SPACE))
- width--;
- if (flags & FLAGS_ALTERNATIVE)
- {
- switch (base)
- {
- case BASE_BINARY:
- case BASE_HEX:
- width -= 2;
- break;
- case BASE_OCTAL:
- width--;
- break;
- default:
- break;
- }
- }
-
- /* Output prefixes spaces if needed */
- if (! ((flags & FLAGS_LEFTADJUST) ||
- ((flags & FLAGS_NILPADDING) && (precision == NO_PRECISION))))
- {
- count = (precision == NO_PRECISION) ? 0 : precision;
- while (width-- > count)
- self->OutStream(self, CHAR_ADJUST);
- }
-
- /* width has been adjusted for signs and alternatives */
- if (isNegative)
- self->OutStream(self, '-');
- else if (flags & FLAGS_SHOWSIGN)
- self->OutStream(self, '+');
- else if (flags & FLAGS_SPACE)
- self->OutStream(self, ' ');
-
- if (flags & FLAGS_ALTERNATIVE)
- {
- switch (base)
- {
- case BASE_BINARY:
- self->OutStream(self, '0');
- self->OutStream(self, (flags & FLAGS_UPPER) ? 'B' : 'b');
- break;
-
- case BASE_OCTAL:
- self->OutStream(self, '0');
- break;
-
- case BASE_HEX:
- self->OutStream(self, '0');
- self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x');
- break;
-
- default:
- break;
- } /* switch base */
- }
-
- /* Output prefixed zero padding if needed */
- if (flags & FLAGS_NILPADDING)
- {
- if (precision == NO_PRECISION)
- precision = width;
- while (precision-- > 0)
- {
- self->OutStream(self, '0');
- width--;
- }
- }
-
- /* Output the number itself */
- while (*(++pointer))
- {
- self->OutStream(self, *pointer);
- }
-
- /* Output trailing spaces if needed */
- if (flags & FLAGS_LEFTADJUST)
- {
- while (width-- > 0)
- self->OutStream(self, CHAR_ADJUST);
- }
-}
-
-/*************************************************************************
- * TrioWriteStringCharacter [private]
- *
- * Description:
- * Output a single character of a string
- */
-static void
-TrioWriteStringCharacter(trio_T *self,
- int ch,
- unsigned long flags)
-{
- if (flags & FLAGS_ALTERNATIVE)
- {
- if (! (isprint(ch) || isspace(ch)))
- {
- /*
- * Non-printable characters are converted to C escapes or
- * \number, if no C escape exists.
- */
- self->OutStream(self, CHAR_BACKSLASH);
- switch (ch)
- {
- case '\007': self->OutStream(self, 'a'); break;
- case '\b': self->OutStream(self, 'b'); break;
- case '\f': self->OutStream(self, 'f'); break;
- case '\n': self->OutStream(self, 'n'); break;
- case '\r': self->OutStream(self, 'r'); break;
- case '\t': self->OutStream(self, 't'); break;
- case '\v': self->OutStream(self, 'v'); break;
- case '\\': self->OutStream(self, '\\'); break;
- default:
- self->OutStream(self, 'x');
- TrioWriteNumber(self, (trio_intmax_t)ch,
- FLAGS_UNSIGNED | FLAGS_NILPADDING,
- 2, 2, BASE_HEX);
- break;
- }
- }
- else if (ch == CHAR_BACKSLASH)
- {
- self->OutStream(self, CHAR_BACKSLASH);
- self->OutStream(self, CHAR_BACKSLASH);
- }
- else
- {
- self->OutStream(self, ch);
- }
- }
- else
- {
- self->OutStream(self, ch);
- }
-}
-
-/*************************************************************************
- * TrioWriteString [private]
- *
- * Description:
- * Output a string
- */
-static void
-TrioWriteString(trio_T *self,
- const char *string,
- unsigned long flags,
- int width,
- int precision)
-{
- int length;
- int ch;
-
- assert(VALID(self));
- assert(VALID(self->OutStream));
-
- if (string == NULL)
- {
- string = null;
- length = sizeof(null) - 1;
- /* Disable quoting for the null pointer */
- flags &= (~FLAGS_QUOTE);
- width = 0;
- }
- else
- {
- length = StrLength(string);
- }
- if ((NO_PRECISION != precision) &&
- (precision < length))
- {
- length = precision;
- }
- width -= length;
-
- if (flags & FLAGS_QUOTE)
- self->OutStream(self, CHAR_QUOTE);
-
- if (! (flags & FLAGS_LEFTADJUST))
- {
- while (width-- > 0)
- self->OutStream(self, CHAR_ADJUST);
- }
-
- while (length-- > 0)
- {
- /* The ctype parameters must be an unsigned char (or EOF) */
- ch = (int)((unsigned char)(*string++));
- TrioWriteStringCharacter(self, ch, flags);
- }
-
- if (flags & FLAGS_LEFTADJUST)
- {
- while (width-- > 0)
- self->OutStream(self, CHAR_ADJUST);
- }
- if (flags & FLAGS_QUOTE)
- self->OutStream(self, CHAR_QUOTE);
-}
-
-/*************************************************************************
- * TrioWriteWideStringCharacter [private]
- *
- * Description:
- * Output a wide string as a multi-byte sequence
- */
-#if TRIO_WIDECHAR
-static int
-TrioWriteWideStringCharacter(trio_T *self,
- wchar_t wch,
- unsigned long flags,
- int width)
-{
- int size;
- int i;
- int ch;
- char *string;
- char buffer[MB_LEN_MAX + 1];
-
- if (width == NO_WIDTH)
- width = sizeof(buffer);
-
- size = wctomb(buffer, wch);
- if ((size <= 0) || (size > width) || (buffer[0] == NIL))
- return 0;
-
- string = buffer;
- i = size;
- while ((width >= i) && (width-- > 0) && (i-- > 0))
- {
- /* The ctype parameters must be an unsigned char (or EOF) */
- ch = (int)((unsigned char)(*string++));
- TrioWriteStringCharacter(self, ch, flags);
- }
- return size;
-}
-#endif /* TRIO_WIDECHAR */
-
-/*************************************************************************
- * TrioWriteString [private]
- *
- * Description:
- * Output a wide character string as a multi-byte string
- */
-#if TRIO_WIDECHAR
-static void
-TrioWriteWideString(trio_T *self,
- const wchar_t *wstring,
- unsigned long flags,
- int width,
- int precision)
-{
- int length;
- int size;
-
- assert(VALID(self));
- assert(VALID(self->OutStream));
-
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- mblen(NULL, 0);
-#endif
-
- if (wstring == NULL)
- {
- TrioWriteString(self, NULL, flags, width, precision);
- return;
- }
-
- if (NO_PRECISION == precision)
- {
- length = INT_MAX;
- }
- else
- {
- length = precision;
- width -= length;
- }
-
- if (flags & FLAGS_QUOTE)
- self->OutStream(self, CHAR_QUOTE);
-
- if (! (flags & FLAGS_LEFTADJUST))
- {
- while (width-- > 0)
- self->OutStream(self, CHAR_ADJUST);
- }
-
- while (length > 0)
- {
- size = TrioWriteWideStringCharacter(self, *wstring++, flags, length);
- if (size == 0)
- break; /* while */
- length -= size;
- }
-
- if (flags & FLAGS_LEFTADJUST)
- {
- while (width-- > 0)
- self->OutStream(self, CHAR_ADJUST);
- }
- if (flags & FLAGS_QUOTE)
- self->OutStream(self, CHAR_QUOTE);
-}
-#endif /* TRIO_WIDECHAR */
-
-/*************************************************************************
- * TrioWriteDouble [private]
- */
-static void
-TrioWriteDouble(trio_T *self,
- long double longdoubleNumber,
- unsigned long flags,
- int width,
- int precision,
- int base)
-{
- int charsPerThousand;
- int length;
- double number;
- double workNumber;
- int integerDigits;
- int fractionDigits;
- int exponentDigits;
- int expectedWidth;
- int exponent;
- unsigned int uExponent = 0;
- double dblBase;
- BOOLEAN_T isNegative;
- BOOLEAN_T isExponentNegative = FALSE;
- BOOLEAN_T isHex;
- const char *digits;
- char numberBuffer[MAX_MANTISSA_DIGITS
- * (1 + MAX_LOCALE_SEPARATOR_LENGTH) + 1];
- char *numberPointer;
- char exponentBuffer[MAX_EXPONENT_DIGITS + 1];
- char *exponentPointer = NULL;
- int groupingIndex;
- char *work;
- int i;
- BOOLEAN_T onlyzero;
- int zeroes = 0;
-
- assert(VALID(self));
- assert(VALID(self->OutStream));
- assert(base == BASE_DECIMAL || base == BASE_HEX);
-
- number = (double)longdoubleNumber;
-
- /* Look for infinite numbers and non-a-number first */
- switch (TrioIsInfinite(number))
- {
- case 1:
- /* Positive infinity */
- TrioWriteString(self,
- (flags & FLAGS_UPPER)
- ? INFINITE_UPPER
- : INFINITE_LOWER,
- flags, width, precision);
- return;
-
- case -1:
- /* Negative infinity */
- TrioWriteString(self,
- (flags & FLAGS_UPPER)
- ? "-" INFINITE_UPPER
- : "-" INFINITE_LOWER,
- flags, width, precision);
- return;
-
- default:
- /* Finitude */
- break;
- }
- if (TrioIsNan(number))
- {
- TrioWriteString(self,
- (flags & FLAGS_UPPER)
- ? NAN_UPPER
- : NAN_LOWER,
- flags, width, precision);
- return;
- }
-
- /* Normal numbers */
- digits = (flags & FLAGS_UPPER) ? internalDigitsUpper : internalDigitsLower;
- isHex = (base == BASE_HEX);
- dblBase = (double)base;
-
- if (precision == NO_PRECISION)
- precision = FLT_DIG;
-
- isNegative = (number < 0.0);
- if (isNegative)
- number = -number;
-
- if ((flags & FLAGS_FLOAT_G) || isHex)
- {
- if (precision == 0)
- precision = 1;
-
- if ((number < 1.0e-4) || (number > pow(10.0, (double)precision)))
- {
- /* Use scientific notation */
- flags |= FLAGS_FLOAT_E;
- }
- else if (number < 1.0)
- {
- /*
- * Use normal notation. If the integer part of the number is
- * zero, then adjust the precision to include leading fractional
- * zeros.
- */
- workNumber = fabs(guarded_log10(number));
- if (workNumber - floor(workNumber) < 0.001)
- workNumber--;
- zeroes = (int)floor(workNumber);
- }
- }
-
- if (flags & FLAGS_FLOAT_E)
- {
- /* Scale the number */
- workNumber = guarded_log10(number);
- if (workNumber == -HUGE_VAL)
- {
- exponent = 0;
- /* Undo setting */
- if (flags & FLAGS_FLOAT_G)
- flags &= ~FLAGS_FLOAT_E;
- }
- else
- {
- exponent = (int)floor(workNumber);
- number /= pow(10.0, (double)exponent);
- isExponentNegative = (exponent < 0);
- uExponent = (isExponentNegative) ? -exponent : exponent;
- /* No thousand separators */
- flags &= ~FLAGS_QUOTE;
- }
- }
-
- /*
- * Truncated number.
- *
- * precision is number of significant digits for FLOAT_G
- * and number of fractional digits for others
- */
- integerDigits = (floor(number) > DBL_EPSILON)
- ? 1 + (int)guarded_log10(floor(number))
- : 1;
- fractionDigits = ((flags & FLAGS_FLOAT_G) && (zeroes == 0))
- ? precision - integerDigits
- : zeroes + precision;
-
- number = floor(0.5 + number * pow(dblBase, (double)fractionDigits));
- workNumber = (isHex
- ? guarded_log16(0.5 + number)
- : guarded_log10(0.5 + number));
- if ((int)workNumber + 1 > integerDigits + fractionDigits)
- {
- if (flags & FLAGS_FLOAT_E)
- {
- /* Adjust if number was rounded up one digit (ie. 0.99 to 1.00) */
- exponent--;
- uExponent -= (isExponentNegative) ? 1 : -1;
- number /= dblBase;
- }
- else
- {
- /* Adjust if number was rounded up one digit (ie. 99 to 100) */
- integerDigits++;
- }
- }
-
- /* Build the fraction part */
- numberPointer = &numberBuffer[sizeof(numberBuffer) - 1];
- *numberPointer = NIL;
- onlyzero = TRUE;
- for (i = 0; i < fractionDigits; i++)
- {
- *(--numberPointer) = digits[(int)fmod(number, dblBase)];
- number = floor(number / dblBase);
-
- if ((flags & FLAGS_FLOAT_G) && !(flags & FLAGS_ALTERNATIVE))
- {
- /* Prune trailing zeroes */
- if (numberPointer[0] != digits[0])
- onlyzero = FALSE;
- else if (onlyzero && (numberPointer[0] == digits[0]))
- numberPointer++;
- }
- else
- onlyzero = FALSE;
- }
-
- /* Insert decimal point */
- if ((flags & FLAGS_ALTERNATIVE) || ((fractionDigits > 0) && !onlyzero))
- {
- i = StrLength(internalDecimalPoint);
- while (i> 0)
- {
- *(--numberPointer) = internalDecimalPoint[--i];
- }
- }
- /* Insert the integer part and thousand separators */
- charsPerThousand = (int)internalGrouping[0];
- groupingIndex = 1;
- for (i = 1; i < integerDigits + 1; i++)
- {
- *(--numberPointer) = digits[(int)fmod(number, dblBase)];
- number = floor(number / dblBase);
- if (number < DBL_EPSILON)
- break;
-
- if ((i > 0)
- && ((flags & (FLAGS_FLOAT_E | FLAGS_QUOTE)) == FLAGS_QUOTE)
- && (charsPerThousand != NO_GROUPING)
- && (i % charsPerThousand == 0))
- {
- /*
- * We are building the number from the least significant
- * to the most significant digit, so we have to copy the
- * thousand separator backwards
- */
- length = StrLength(internalThousandSeparator);
- integerDigits += length;
- if (((int)(numberPointer - numberBuffer) - length) > 0)
- {
- work = &internalThousandSeparator[length - 1];
- while (length-- > 0)
- *(--numberPointer) = *work--;
- }
-
- /* Advance to next grouping number */
- if (charsPerThousand != NO_GROUPING)
- {
- switch (internalGrouping[groupingIndex])
- {
- case CHAR_MAX: /* Disable grouping */
- charsPerThousand = NO_GROUPING;
- break;
- case 0: /* Repeat last group */
- break;
- default:
- charsPerThousand = (int)internalGrouping[groupingIndex++];
- break;
- }
- }
- }
- }
-
- /* Build the exponent */
- exponentDigits = 0;
- if (flags & FLAGS_FLOAT_E)
- {
- exponentPointer = &exponentBuffer[sizeof(exponentBuffer) - 1];
- *exponentPointer-- = NIL;
- do {
- *exponentPointer-- = digits[uExponent % base];
- uExponent /= base;
- exponentDigits++;
- } while (uExponent);
- }
-
- /*
- * Calculate expected width.
- * sign + integer part + thousands separators + decimal point
- * + fraction + exponent
- */
- expectedWidth = StrLength(numberPointer);
- if (isNegative || (flags & FLAGS_SHOWSIGN))
- expectedWidth += sizeof("-") - 1;
- if (exponentDigits > 0)
- expectedWidth += exponentDigits +
- ((exponentDigits > 1) ? sizeof("E+") : sizeof("E+0")) - 1;
- if (isHex)
- expectedWidth += sizeof("0X") - 1;
-
- /* Output prefixing */
- if (flags & FLAGS_NILPADDING)
- {
- /* Leading zeros must be after sign */
- if (isNegative)
- self->OutStream(self, '-');
- else if (flags & FLAGS_SHOWSIGN)
- self->OutStream(self, '+');
- if (isHex)
- {
- self->OutStream(self, '0');
- self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x');
- }
- if (!(flags & FLAGS_LEFTADJUST))
- {
- for (i = expectedWidth; i < width; i++)
- {
- self->OutStream(self, '0');
- }
- }
- }
- else
- {
- /* Leading spaces must be before sign */
- if (!(flags & FLAGS_LEFTADJUST))
- {
- for (i = expectedWidth; i < width; i++)
- {
- self->OutStream(self, CHAR_ADJUST);
- }
- }
- if (isNegative)
- self->OutStream(self, '-');
- else if (flags & FLAGS_SHOWSIGN)
- self->OutStream(self, '+');
- if (isHex)
- {
- self->OutStream(self, '0');
- self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x');
- }
- }
- /* Output number */
- for (i = 0; numberPointer[i]; i++)
- {
- self->OutStream(self, numberPointer[i]);
- }
- /* Output exponent */
- if (exponentDigits > 0)
- {
- self->OutStream(self,
- isHex
- ? ((flags & FLAGS_UPPER) ? 'P' : 'p')
- : ((flags & FLAGS_UPPER) ? 'E' : 'e'));
- self->OutStream(self, (isExponentNegative) ? '-' : '+');
-
- /* The exponent must contain at least two digits */
- if (exponentDigits == 1)
- self->OutStream(self, '0');
-
- for (i = 0; i < exponentDigits; i++)
- {
- self->OutStream(self, exponentPointer[i + 1]);
- }
- }
- /* Output trailing spaces */
- if (flags & FLAGS_LEFTADJUST)
- {
- for (i = expectedWidth; i < width; i++)
- {
- self->OutStream(self, CHAR_ADJUST);
- }
- }
-}
-
-/*************************************************************************
- * TrioFormatProcess [private]
- */
-static int
-TrioFormatProcess(trio_T *data,
- const char *format,
- parameter_T *parameters)
-
-{
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- int charlen;
-#endif
- int i;
- const char *string;
- void *pointer;
- unsigned long flags;
- int width;
- int precision;
- int base;
- int index;
-
- index = 0;
- i = 0;
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- mblen(NULL, 0);
-#endif
-
- while (format[index])
- {
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- if (! isascii(format[index]))
- {
- charlen = mblen(&format[index], MB_LEN_MAX);
- while (charlen-- > 0)
- {
- data->OutStream(data, format[index++]);
- }
- continue; /* while */
- }
-#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */
- if (CHAR_IDENTIFIER == format[index])
- {
- if (CHAR_IDENTIFIER == format[index + 1])
- {
- data->OutStream(data, CHAR_IDENTIFIER);
- index += 2;
- }
- else
- {
- /* Skip the parameter entries */
- while (parameters[i].type == FORMAT_PARAMETER)
- i++;
-
- flags = parameters[i].flags;
-
- /* Find width */
- width = parameters[i].width;
- if (flags & FLAGS_WIDTH_PARAMETER)
- {
- /* Get width from parameter list */
- width = (int)parameters[width].data.number.as_signed;
- }
-
- /* Find precision */
- if (flags & FLAGS_PRECISION)
- {
- precision = parameters[i].precision;
- if (flags & FLAGS_PRECISION_PARAMETER)
- {
- /* Get precision from parameter list */
- precision = (int)parameters[precision].data.number.as_signed;
- }
- }
- else
- {
- precision = NO_PRECISION;
- }
-
- /* Find base */
- base = parameters[i].base;
- if (flags & FLAGS_BASE_PARAMETER)
- {
- /* Get base from parameter list */
- base = (int)parameters[base].data.number.as_signed;
- }
-
- switch (parameters[i].type)
- {
- case FORMAT_CHAR:
- if (flags & FLAGS_QUOTE)
- data->OutStream(data, CHAR_QUOTE);
- if (! (flags & FLAGS_LEFTADJUST))
- {
- while (--width > 0)
- data->OutStream(data, CHAR_ADJUST);
- }
-#if TRIO_WIDECHAR
- if (flags & FLAGS_WIDECHAR)
- {
- TrioWriteWideStringCharacter(data,
- (wchar_t)parameters[i].data.number.as_signed,
- flags,
- NO_WIDTH);
- }
- else
-#endif
- TrioWriteStringCharacter(data,
- (int)parameters[i].data.number.as_signed,
- flags);
-
- if (flags & FLAGS_LEFTADJUST)
- {
- while(--width > 0)
- data->OutStream(data, CHAR_ADJUST);
- }
- if (flags & FLAGS_QUOTE)
- data->OutStream(data, CHAR_QUOTE);
-
- break; /* FORMAT_CHAR */
-
- case FORMAT_INT:
- if (base == NO_BASE)
- base = BASE_DECIMAL;
-
- TrioWriteNumber(data,
- parameters[i].data.number.as_signed,
- flags,
- width,
- precision,
- base);
-
- break; /* FORMAT_INT */
-
- case FORMAT_DOUBLE:
- TrioWriteDouble(data,
- parameters[i].data.longdoubleNumber,
- flags,
- width,
- precision,
- base);
- break; /* FORMAT_DOUBLE */
-
- case FORMAT_STRING:
-#if TRIO_WIDECHAR
- if (flags & FLAGS_WIDECHAR)
- {
- TrioWriteWideString(data,
- parameters[i].data.wstring,
- flags,
- width,
- precision);
- }
- else
-#endif
-#ifdef QUALIFIER_ESCAPE
- {
- char *s = NULL;
- static const char* empty = "(null)";
- switch (parameters[i].escape)
- {
- case ESCAPE_ULM:
- s = edg_wll_LogEscape(parameters[i].data.string);
- break;
- case ESCAPE_XML:
- s = edg_wll_EscapeXML(parameters[i].data.string);
- break;
- case ESCAPE_SQL:
- s = edg_wll_EscapeSQL(parameters[i].data.string);
- break;
- case ESCAPE_NONE:
- s = strdup(parameters[i].data.string ? parameters[i].data.string : empty);
- break;
- }
- TrioWriteString(data,s,flags,width,precision);
- free(s);
- }
-#else
- {
- TrioWriteString(data,
- parameters[i].data.string,
- flags,
- width,
- precision);
- }
-#endif
- break; /* FORMAT_STRING */
-
- case FORMAT_POINTER:
- {
- reference_T reference;
-
- reference.data = data;
- reference.parameter = ¶meters[i];
- trio_print_pointer(&reference, parameters[i].data.pointer);
- }
- break; /* FORMAT_POINTER */
-
- case FORMAT_COUNT:
- pointer = parameters[i].data.pointer;
- if (NULL != pointer)
- {
- /*
- * C99 paragraph 7.19.6.1.8 says "the number of
- * characters written to the output stream so far by
- * this call", which is data->committed
- */
-#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER)
- if (flags & FLAGS_SIZE_T)
- *(size_t *)pointer = (size_t)data->committed;
- else
-#endif
-#if defined(QUALIFIER_PTRDIFF_T)
- if (flags & FLAGS_PTRDIFF_T)
- *(ptrdiff_t *)pointer = (ptrdiff_t)data->committed;
- else
-#endif
-#if defined(QUALIFIER_INTMAX_T)
- if (flags & FLAGS_INTMAX_T)
- *(trio_intmax_t *)pointer = (trio_intmax_t)data->committed;
- else
-#endif
- if (flags & FLAGS_QUAD)
- {
- *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)data->committed;
- }
- else if (flags & FLAGS_LONG)
- {
- *(long int *)pointer = (long int)data->committed;
- }
- else if (flags & FLAGS_SHORT)
- {
- *(short int *)pointer = (short int)data->committed;
- }
- else
- {
- *(int *)pointer = (int)data->committed;
- }
- }
- break; /* FORMAT_COUNT */
-
- case FORMAT_PARAMETER:
- break; /* FORMAT_PARAMETER */
-
-#if defined(FORMAT_ERRNO)
- case FORMAT_ERRNO:
- string = StrError(parameters[i].data.errorNumber);
- if (string)
- {
- TrioWriteString(data,
- string,
- flags,
- width,
- precision);
- }
- else
- {
- data->OutStream(data, '#');
- TrioWriteNumber(data,
- (trio_intmax_t)parameters[i].data.errorNumber,
- flags,
- width,
- precision,
- BASE_DECIMAL);
- }
- break; /* FORMAT_ERRNO */
-#endif /* defined(FORMAT_ERRNO) */
-
-#if defined(FORMAT_USER_DEFINED)
- case FORMAT_USER_DEFINED:
- {
- reference_T reference;
- userdef_T *def = NULL;
-
- if (parameters[i].user_name[0] == NIL)
- {
- /* Use handle */
- if ((i > 0) ||
- (parameters[i - 1].type == FORMAT_PARAMETER))
- def = (userdef_T *)parameters[i - 1].data.pointer;
- }
- else
- {
- /* Look up namespace */
- def = TrioFindNamespace(parameters[i].user_name, NULL);
- }
- if (def) {
- reference.data = data;
- reference.parameter = ¶meters[i];
- def->callback(&reference);
- }
- }
- break;
-#endif /* defined(FORMAT_USER_DEFINED) */
-
- default:
- break;
- } /* switch parameter type */
-
- /* Prepare for next */
- index = parameters[i].indexAfterSpecifier;
- i++;
- }
- }
- else /* not identifier */
- {
- data->OutStream(data, format[index++]);
- }
- }
- return data->processed;
-}
-
-/*************************************************************************
- * TrioFormatRef [private]
- */
-static int
-TrioFormatRef(reference_T *reference,
- const char *format,
- va_list arglist,
- void **argarray)
-{
- int status;
- parameter_T parameters[MAX_PARAMETERS];
-
- status = TrioPreprocess(TYPE_PRINT, format, parameters, arglist, argarray);
- if (status < 0)
- return status;
-
- return TrioFormatProcess(reference->data, format, parameters);
-}
-
-/*************************************************************************
- * TrioFormat [private]
- *
- * Description:
- * This is the main engine for formatting output
- */
-static int
-TrioFormat(void *destination,
- size_t destinationSize,
- void (*OutStream)(trio_T *, int),
- const char *format,
- va_list arglist,
- void **argarray)
-{
- int status;
- trio_T data;
- parameter_T parameters[MAX_PARAMETERS];
-
- assert(VALID(OutStream));
- assert(VALID(format));
-
- memset(&data, 0, sizeof(data));
- data.OutStream = OutStream;
- data.location = destination;
- data.max = destinationSize;
-
-#if defined(USE_LOCALE)
- if (NULL == internalLocaleValues)
- {
- TrioSetLocale();
- }
-#endif
-
- status = TrioPreprocess(TYPE_PRINT, format, parameters, arglist, argarray);
- if (status < 0)
- return status;
-
- return TrioFormatProcess(&data, format, parameters);
-}
-
-/*************************************************************************
- * TrioOutStreamFile [private]
- */
-static void
-TrioOutStreamFile(trio_T *self,
- int output)
-{
- FILE *file = (FILE *)self->location;
-
- assert(VALID(self));
- assert(VALID(file));
-
- self->processed++;
- self->committed++;
- (void)fputc(output, file);
-}
-
-/*************************************************************************
- * TrioOutStreamFileDescriptor [private]
- */
-static void
-TrioOutStreamFileDescriptor(trio_T *self,
- int output)
-{
- int fd = *((int *)self->location);
- char ch;
-
- assert(VALID(self));
-
- ch = (char)output;
- (void)write(fd, &ch, sizeof(char));
- self->processed++;
- self->committed++;
-}
-
-/*************************************************************************
- * TrioOutStreamString [private]
- */
-static void
-TrioOutStreamString(trio_T *self,
- int output)
-{
- char **buffer = (char **)self->location;
-
- assert(VALID(self));
- assert(VALID(buffer));
-
- **buffer = (char)output;
- (*buffer)++;
- self->processed++;
- self->committed++;
-}
-
-/*************************************************************************
- * TrioOutStreamStringMax [private]
- */
-static void
-TrioOutStreamStringMax(trio_T *self,
- int output)
-{
- char **buffer;
-
- assert(VALID(self));
- buffer = (char **)self->location;
- assert(VALID(buffer));
-
- if (self->processed < self->max)
- {
- **buffer = (char)output;
- (*buffer)++;
- self->committed++;
- }
- self->processed++;
-}
-
-/*************************************************************************
- * TrioOutStreamStringDynamic [private]
- */
-#define DYNAMIC_START_SIZE 32
-struct dynamicBuffer {
- char *buffer;
- size_t length;
- size_t allocated;
-};
-
-static void
-TrioOutStreamStringDynamic(trio_T *self,
- int output)
-{
- struct dynamicBuffer *infop;
-
- assert(VALID(self));
- assert(VALID(self->location));
-
- infop = (struct dynamicBuffer *)self->location;
-
- if (infop->buffer == NULL)
- {
- /* Start with a reasonable size */
- infop->buffer = (char *)TRIO_MALLOC(DYNAMIC_START_SIZE);
- if (infop->buffer == NULL)
- return; /* fail */
-
- infop->allocated = DYNAMIC_START_SIZE;
- self->processed = 0;
- self->committed = 0;
- }
- else if (self->committed + sizeof(NIL) >= infop->allocated)
- {
- char *newptr;
-
- /* Allocate increasing chunks */
- newptr = (char *)TRIO_REALLOC(infop->buffer, infop->allocated * 2);
-
- if (newptr == NULL)
- return;
-
- infop->buffer = newptr;
- infop->allocated *= 2;
- }
-
- infop->buffer[self->committed] = (char)output;
- self->committed++;
- self->processed++;
-
- infop->length = self->committed;
-}
-
-/*************************************************************************
- * printf
- */
-int
-trio_printf(const char *format,
- ...)
-{
- int status;
- va_list args;
-
- assert(VALID(format));
-
- va_start(args, format);
- status = TrioFormat(stdout, 0, TrioOutStreamFile, format, args, NULL);
- va_end(args);
- return status;
-}
-
-int
-trio_vprintf(const char *format,
- va_list args)
-{
- assert(VALID(format));
-
- return TrioFormat(stdout, 0, TrioOutStreamFile, format, args, NULL);
-}
-
-#ifdef __GNUC__
-#define UNUSED_VAR __attribute__((unused))
-#else
-#define UNUSED_VAR
-#endif
-
-static void shutup_unitialized(va_list *dummy UNUSED_VAR) {
-}
-
-int
-trio_printfv(const char *format,
- void ** args)
-{
- va_list dummy;
- shutup_unitialized(&dummy);
-
- assert(VALID(format));
-
- return TrioFormat(stdout, 0, TrioOutStreamFile, format, dummy, args);
-}
-
-/*************************************************************************
- * fprintf
- */
-int
-trio_fprintf(FILE *file,
- const char *format,
- ...)
-{
- int status;
- va_list args;
-
- assert(VALID(file));
- assert(VALID(format));
-
- va_start(args, format);
- status = TrioFormat(file, 0, TrioOutStreamFile, format, args, NULL);
- va_end(args);
- return status;
-}
-
-int
-trio_vfprintf(FILE *file,
- const char *format,
- va_list args)
-{
- assert(VALID(file));
- assert(VALID(format));
-
- return TrioFormat(file, 0, TrioOutStreamFile, format, args, NULL);
-}
-
-int
-trio_fprintfv(FILE *file,
- const char *format,
- void ** args)
-{
- va_list dummy;
- shutup_unitialized(&dummy);
-
- assert(VALID(file));
- assert(VALID(format));
-
- return TrioFormat(file, 0, TrioOutStreamFile, format, dummy, args);
-}
-
-/*************************************************************************
- * dprintf
- */
-int
-trio_dprintf(int fd,
- const char *format,
- ...)
-{
- int status;
- va_list args;
-
- assert(VALID(format));
-
- va_start(args, format);
- status = TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, args, NULL);
- va_end(args);
- return status;
-}
-
-int
-trio_vdprintf(int fd,
- const char *format,
- va_list args)
-{
- assert(VALID(format));
-
- return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, args, NULL);
-}
-
-int
-trio_dprintfv(int fd,
- const char *format,
- void **args)
-{
- va_list dummy;
- shutup_unitialized(&dummy);
-
- assert(VALID(format));
-
- return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, dummy, args);
-}
-
-/*************************************************************************
- * sprintf
- */
-int
-trio_sprintf(char *buffer,
- const char *format,
- ...)
-{
- int status;
- va_list args;
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- va_start(args, format);
- status = TrioFormat(&buffer, 0, TrioOutStreamString, format, args, NULL);
- *buffer = NIL; /* Terminate with NIL character */
- va_end(args);
- return status;
-}
-
-int
-trio_vsprintf(char *buffer,
- const char *format,
- va_list args)
-{
- int status;
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- status = TrioFormat(&buffer, 0, TrioOutStreamString, format, args, NULL);
- *buffer = NIL;
- return status;
-}
-
-int
-trio_sprintfv(char *buffer,
- const char *format,
- void **args)
-{
- int status;
- va_list dummy;
- shutup_unitialized(&dummy);
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- status = TrioFormat(&buffer, 0, TrioOutStreamString, format, dummy, args);
- *buffer = NIL;
- return status;
-}
-
-/*************************************************************************
- * snprintf
- */
-int
-trio_snprintf(char *buffer,
- size_t bufferSize,
- const char *format,
- ...)
-{
- int status;
- va_list args;
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- va_start(args, format);
- status = TrioFormat(&buffer, bufferSize > 0 ? bufferSize - 1 : 0,
- TrioOutStreamStringMax, format, args, NULL);
- if (bufferSize > 0)
- *buffer = NIL;
- va_end(args);
- return status;
-}
-
-int
-trio_vsnprintf(char *buffer,
- size_t bufferSize,
- const char *format,
- va_list args)
-{
- int status;
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- status = TrioFormat(&buffer, bufferSize > 0 ? bufferSize - 1 : 0,
- TrioOutStreamStringMax, format, args, NULL);
- if (bufferSize > 0)
- *buffer = NIL;
- return status;
-}
-
-int
-trio_snprintfv(char *buffer,
- size_t bufferSize,
- const char *format,
- void **args)
-{
- int status;
- va_list dummy;
- shutup_unitialized(&dummy);
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- status = TrioFormat(&buffer, bufferSize > 0 ? bufferSize - 1 : 0,
- TrioOutStreamStringMax, format, dummy, args);
- if (bufferSize > 0)
- *buffer = NIL;
- return status;
-}
-
-/*************************************************************************
- * snprintfcat
- * Appends the new string to the buffer string overwriting the '\0'
- * character at the end of buffer.
- */
-int
-trio_snprintfcat(char *buffer,
- size_t bufferSize,
- const char *format,
- ...)
-{
- int status;
- va_list args;
- size_t buf_len;
-
- va_start(args, format);
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- buf_len = strlen(buffer);
- buffer = &buffer[buf_len];
-
- status = TrioFormat(&buffer, bufferSize - 1 - buf_len,
- TrioOutStreamStringMax, format, args, NULL);
- va_end(args);
- *buffer = NIL;
- return status;
-}
-
-int
-trio_vsnprintfcat(char *buffer,
- size_t bufferSize,
- const char *format,
- va_list args)
-{
- int status;
- size_t buf_len;
- assert(VALID(buffer));
- assert(VALID(format));
-
- buf_len = strlen(buffer);
- buffer = &buffer[buf_len];
- status = TrioFormat(&buffer, bufferSize - 1 - buf_len,
- TrioOutStreamStringMax, format, args, NULL);
- *buffer = NIL;
- return status;
-}
-
-/*************************************************************************
- * trio_aprintf
- */
-
-/* Deprecated */
-char *
-trio_aprintf(const char *format,
- ...)
-{
- va_list args;
- struct dynamicBuffer info;
-
- assert(VALID(format));
-
- info.buffer = NULL;
- info.length = 0;
- info.allocated = 0;
-
- va_start(args, format);
- (void)TrioFormat(&info, 0, TrioOutStreamStringDynamic, format, args, NULL);
- va_end(args);
- if (info.length) {
- info.buffer[info.length] = NIL; /* we terminate this with a zero byte */
- return info.buffer;
- }
- else
- return NULL;
-}
-
-/* Deprecated */
-char *
-trio_vaprintf(const char *format,
- va_list args)
-{
- struct dynamicBuffer info;
-
- assert(VALID(format));
-
- info.buffer = NULL;
- info.length = 0;
- info.allocated = 0;
-
- (void)TrioFormat(&info, 0, TrioOutStreamStringDynamic, format, args, NULL);
- if (info.length) {
- info.buffer[info.length] = NIL; /* we terminate this with a zero byte */
- return info.buffer;
- }
- else
- return NULL;
-}
-
-int
-trio_asprintf(char **result,
- const char *format,
- ...)
-{
- va_list args;
- int status;
- struct dynamicBuffer info;
-
- assert(VALID(format));
-
- info.buffer = NULL;
- info.length = 0;
- info.allocated = 0;
-
- va_start(args, format);
- status = TrioFormat(&info, 0, TrioOutStreamStringDynamic, format, args, NULL);
- va_end(args);
- if (status < 0) {
- *result = NULL;
- return status;
- }
- if (info.length == 0) {
- /*
- * If the length is zero, no characters have been written and therefore
- * no memory has been allocated, but we must to allocate and return an
- * empty string.
- */
- info.buffer = (char *)TRIO_MALLOC(sizeof(char));
- if (info.buffer == NULL) {
- *result = NULL;
- return TRIO_ERROR_RETURN(TRIO_ENOMEM, 0);
- }
- }
- info.buffer[info.length] = NIL; /* we terminate this with a zero byte */
- *result = info.buffer;
-
- return status;
-}
-
-int
-trio_vasprintf(char **result,
- const char *format,
- va_list args)
-{
- int status;
- struct dynamicBuffer info;
-
- assert(VALID(format));
-
- info.buffer = NULL;
- info.length = 0;
- info.allocated = 0;
-
- status = TrioFormat(&info, 0, TrioOutStreamStringDynamic, format, args, NULL);
- if (status < 0) {
- *result = NULL;
- return status;
- }
- if (info.length == 0) {
- info.buffer = (char *)TRIO_MALLOC(sizeof(char));
- if (info.buffer == NULL) {
- *result = NULL;
- return TRIO_ERROR_RETURN(TRIO_ENOMEM, 0);
- }
- }
- info.buffer[info.length] = NIL; /* we terminate this with a zero byte */
- *result = info.buffer;
-
- return status;
-}
-
-
-/*************************************************************************
- *
- * @CALLBACK
- *
- ************************************************************************/
-
-
-/*************************************************************************
- * trio_register [public]
- */
-void *
-trio_register(trio_callback_t callback,
- const char *name)
-{
- userdef_T *def;
- userdef_T *prev = NULL;
-
- if (callback == NULL)
- return NULL;
-
- if (name)
- {
- /* Handle built-in namespaces */
- if (name[0] == ':')
- {
- if (StrEqual(name, ":enter"))
- {
- internalEnterCriticalRegion = callback;
- }
- else if (StrEqual(name, ":leave"))
- {
- internalLeaveCriticalRegion = callback;
- }
- return NULL;
- }
-
- /* Bail out if namespace is too long */
- if (StrLength(name) >= MAX_USER_NAME)
- return NULL;
-
- /* Bail out if namespace already is registered */
- def = TrioFindNamespace(name, &prev);
- if (def)
- return NULL;
- }
-
- def = (userdef_T *)TRIO_MALLOC(sizeof(userdef_T));
- if (def)
- {
- if (internalEnterCriticalRegion)
- (void)internalEnterCriticalRegion(NULL);
-
- if (name)
- {
- /* Link into internal list */
- if (prev == NULL)
- internalUserDef = def;
- else
- prev->next = def;
- }
- /* Initialize */
- def->callback = callback;
- def->name = (name == NULL)
- ? NULL
- : StrDuplicate(name);
- def->next = NULL;
-
- if (internalLeaveCriticalRegion)
- (void)internalLeaveCriticalRegion(NULL);
- }
- return def;
-}
-
-/*************************************************************************
- * trio_unregister [public]
- */
-void
-trio_unregister(void *handle)
-{
- userdef_T *self = (userdef_T *)handle;
- userdef_T *def;
- userdef_T *prev = NULL;
-
- assert(VALID(self));
-
- if (self->name)
- {
- def = TrioFindNamespace(self->name, &prev);
- if (def)
- {
- if (internalEnterCriticalRegion)
- (void)internalEnterCriticalRegion(NULL);
-
- if (prev == NULL)
- internalUserDef = NULL;
- else
- prev->next = def->next;
-
- if (internalLeaveCriticalRegion)
- (void)internalLeaveCriticalRegion(NULL);
- }
- StrFree(self->name);
- }
- TRIO_FREE(self);
-}
-
-/*************************************************************************
- * trio_get_format [public]
- */
-const char *
-trio_get_format(void *ref)
-{
- assert(((reference_T *)ref)->parameter->type == FORMAT_USER_DEFINED);
-
- return (((reference_T *)ref)->parameter->user_data);
-}
-
-/*************************************************************************
- * trio_get_argument [public]
- */
-void *
-trio_get_argument(void *ref)
-{
- assert(((reference_T *)ref)->parameter->type == FORMAT_USER_DEFINED);
-
- return ((reference_T *)ref)->parameter->data.pointer;
-}
-
-/*************************************************************************
- * trio_get_width / trio_set_width [public]
- */
-int
-trio_get_width(void *ref)
-{
- return ((reference_T *)ref)->parameter->width;
-}
-
-void
-trio_set_width(void *ref,
- int width)
-{
- ((reference_T *)ref)->parameter->width = width;
-}
-
-/*************************************************************************
- * trio_get_precision / trio_set_precision [public]
- */
-int
-trio_get_precision(void *ref)
-{
- return (((reference_T *)ref)->parameter->precision);
-}
-
-void
-trio_set_precision(void *ref,
- int precision)
-{
- ((reference_T *)ref)->parameter->precision = precision;
-}
-
-/*************************************************************************
- * trio_get_base / trio_set_base [public]
- */
-int
-trio_get_base(void *ref)
-{
- return (((reference_T *)ref)->parameter->base);
-}
-
-void
-trio_set_base(void *ref,
- int base)
-{
- ((reference_T *)ref)->parameter->base = base;
-}
-
-/*************************************************************************
- * trio_get_long / trio_set_long [public]
- */
-int
-trio_get_long(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_LONG);
-}
-
-void
-trio_set_long(void *ref,
- int is_long)
-{
- if (is_long)
- ((reference_T *)ref)->parameter->flags |= FLAGS_LONG;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_LONG;
-}
-
-/*************************************************************************
- * trio_get_longlong / trio_set_longlong [public]
- */
-int
-trio_get_longlong(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_QUAD);
-}
-
-void
-trio_set_longlong(void *ref,
- int is_longlong)
-{
- if (is_longlong)
- ((reference_T *)ref)->parameter->flags |= FLAGS_QUAD;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_QUAD;
-}
-
-/*************************************************************************
- * trio_get_longdouble / trio_set_longdouble [public]
- */
-int
-trio_get_longdouble(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_LONGDOUBLE);
-}
-
-void
-trio_set_longdouble(void *ref,
- int is_longdouble)
-{
- if (is_longdouble)
- ((reference_T *)ref)->parameter->flags |= FLAGS_LONGDOUBLE;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_LONGDOUBLE;
-}
-
-/*************************************************************************
- * trio_get_short / trio_set_short [public]
- */
-int
-trio_get_short(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_SHORT);
-}
-
-void
-trio_set_short(void *ref,
- int is_short)
-{
- if (is_short)
- ((reference_T *)ref)->parameter->flags |= FLAGS_SHORT;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_SHORT;
-}
-
-/*************************************************************************
- * trio_get_shortshort / trio_set_shortshort [public]
- */
-int
-trio_get_shortshort(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_SHORTSHORT);
-}
-
-void
-trio_set_shortshort(void *ref,
- int is_shortshort)
-{
- if (is_shortshort)
- ((reference_T *)ref)->parameter->flags |= FLAGS_SHORTSHORT;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_SHORTSHORT;
-}
-
-/*************************************************************************
- * trio_get_alternative / trio_set_alternative [public]
- */
-int
-trio_get_alternative(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_ALTERNATIVE);
-}
-
-void
-trio_set_alternative(void *ref,
- int is_alternative)
-{
- if (is_alternative)
- ((reference_T *)ref)->parameter->flags |= FLAGS_ALTERNATIVE;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_ALTERNATIVE;
-}
-
-/*************************************************************************
- * trio_get_alignment / trio_set_alignment [public]
- */
-int
-trio_get_alignment(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_LEFTADJUST);
-}
-
-void
-trio_set_alignment(void *ref,
- int is_leftaligned)
-{
- if (is_leftaligned)
- ((reference_T *)ref)->parameter->flags |= FLAGS_LEFTADJUST;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_LEFTADJUST;
-}
-
-/*************************************************************************
- * trio_get_spacing /trio_set_spacing [public]
- */
-int
-trio_get_spacing(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_SPACE);
-}
-
-void
-trio_set_spacing(void *ref,
- int is_space)
-{
- if (is_space)
- ((reference_T *)ref)->parameter->flags |= FLAGS_SPACE;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_SPACE;
-}
-
-/*************************************************************************
- * trio_get_sign / trio_set_sign [public]
- */
-int
-trio_get_sign(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_SHOWSIGN);
-}
-
-void
-trio_set_sign(void *ref,
- int is_sign)
-{
- if (is_sign)
- ((reference_T *)ref)->parameter->flags |= FLAGS_SHOWSIGN;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_SHOWSIGN;
-}
-
-/*************************************************************************
- * trio_get_padding / trio_set_padding [public]
- */
-int
-trio_get_padding(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_NILPADDING);
-}
-
-void
-trio_set_padding(void *ref,
- int is_padding)
-{
- if (is_padding)
- ((reference_T *)ref)->parameter->flags |= FLAGS_NILPADDING;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_NILPADDING;
-}
-
-/*************************************************************************
- * trio_get_quote / trio_set_quote [public]
- */
-int
-trio_get_quote(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_QUOTE);
-}
-
-void
-trio_set_quote(void *ref,
- int is_quote)
-{
- if (is_quote)
- ((reference_T *)ref)->parameter->flags |= FLAGS_QUOTE;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_QUOTE;
-}
-
-/*************************************************************************
- * trio_get_upper / trio_set_upper [public]
- */
-int
-trio_get_upper(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_UPPER);
-}
-
-void
-trio_set_upper(void *ref,
- int is_upper)
-{
- if (is_upper)
- ((reference_T *)ref)->parameter->flags |= FLAGS_UPPER;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_UPPER;
-}
-
-/*************************************************************************
- * trio_get_largest / trio_set_largest [public]
- */
-#if TRIO_C99
-int
-trio_get_largest(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_INTMAX_T);
-}
-
-void
-trio_set_largest(void *ref,
- int is_largest)
-{
- if (is_largest)
- ((reference_T *)ref)->parameter->flags |= FLAGS_INTMAX_T;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_INTMAX_T;
-}
-#endif
-
-/*************************************************************************
- * trio_get_ptrdiff / trio_set_ptrdiff [public]
- */
-int
-trio_get_ptrdiff(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_PTRDIFF_T);
-}
-
-void
-trio_set_ptrdiff(void *ref,
- int is_ptrdiff)
-{
- if (is_ptrdiff)
- ((reference_T *)ref)->parameter->flags |= FLAGS_PTRDIFF_T;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_PTRDIFF_T;
-}
-
-/*************************************************************************
- * trio_get_size / trio_set_size [public]
- */
-#if TRIO_C99
-int
-trio_get_size(void *ref)
-{
- return (((reference_T *)ref)->parameter->flags & FLAGS_SIZE_T);
-}
-
-void
-trio_set_size(void *ref,
- int is_size)
-{
- if (is_size)
- ((reference_T *)ref)->parameter->flags |= FLAGS_SIZE_T;
- else
- ((reference_T *)ref)->parameter->flags &= ~FLAGS_SIZE_T;
-}
-#endif
-
-/*************************************************************************
- * trio_print_int [public]
- */
-void
-trio_print_int(void *ref,
- int number)
-{
- reference_T *self = (reference_T *)ref;
-
- TrioWriteNumber(self->data,
- (trio_intmax_t)number,
- self->parameter->flags,
- self->parameter->width,
- self->parameter->precision,
- self->parameter->base);
-}
-
-/*************************************************************************
- * trio_print_uint [public]
- */
-void
-trio_print_uint(void *ref,
- unsigned int number)
-{
- reference_T *self = (reference_T *)ref;
-
- TrioWriteNumber(self->data,
- (trio_intmax_t)number,
- self->parameter->flags | FLAGS_UNSIGNED,
- self->parameter->width,
- self->parameter->precision,
- self->parameter->base);
-}
-
-/*************************************************************************
- * trio_print_double [public]
- */
-void
-trio_print_double(void *ref,
- double number)
-{
- reference_T *self = (reference_T *)ref;
-
- TrioWriteDouble(self->data,
- number,
- self->parameter->flags,
- self->parameter->width,
- self->parameter->precision,
- self->parameter->base);
-}
-
-/*************************************************************************
- * trio_print_string [public]
- */
-void
-trio_print_string(void *ref,
- char *string)
-{
- reference_T *self = (reference_T *)ref;
-
- TrioWriteString(self->data,
- string,
- self->parameter->flags,
- self->parameter->width,
- self->parameter->precision);
-}
-
-/*************************************************************************
- * trio_print_pointer [public]
- */
-void
-trio_print_pointer(void *ref,
- void *pointer)
-{
- reference_T *self = (reference_T *)ref;
- unsigned long flags;
- trio_uintmax_t number;
-
- if (NULL == pointer)
- {
- const char *string = null;
- while (*string)
- self->data->OutStream(self->data, *string++);
- }
- else
- {
- /*
- * The subtraction of the null pointer is a workaround
- * to avoid a compiler warning. The performance overhead
- * is negligible (and likely to be removed by an
- * optimising compiler). The (char *) casting is done
- * to please ANSI C++.
- */
- number = (trio_uintmax_t)((char *)pointer - (char *)0);
- /* Shrink to size of pointer */
- number &= (trio_uintmax_t)-1;
- flags = self->parameter->flags;
- flags |= (FLAGS_UNSIGNED | FLAGS_ALTERNATIVE |
- FLAGS_NILPADDING);
- TrioWriteNumber(self->data,
- (trio_intmax_t)number,
- flags,
- POINTER_WIDTH,
- NO_PRECISION,
- BASE_HEX);
- }
-}
-
-/*************************************************************************
- * trio_print_ref [public]
- */
-int
-trio_print_ref(void *ref,
- const char *format,
- ...)
-{
- int status;
- va_list arglist;
-
- assert(VALID(format));
-
- va_start(arglist, format);
- status = TrioFormatRef((reference_T *)ref, format, arglist, NULL);
- va_end(arglist);
- return status;
-}
-
-/*************************************************************************
- * trio_vprint_ref [public]
- */
-int
-trio_vprint_ref(void *ref,
- const char *format,
- va_list arglist)
-{
- assert(VALID(format));
-
- return TrioFormatRef((reference_T *)ref, format, arglist, NULL);
-}
-
-/*************************************************************************
- * trio_printv_ref [public]
- */
-int
-trio_printv_ref(void *ref,
- const char *format,
- void **argarray)
-{
- va_list dummy;
- shutup_unitialized(&dummy);
-
- assert(VALID(format));
-
- return TrioFormatRef((reference_T *)ref, format, dummy, argarray);
-}
-
-
-/*************************************************************************
- *
- * @SCANNING
- *
- ************************************************************************/
-
-
-/*************************************************************************
- * TrioSkipWhitespaces [private]
- */
-static int
-TrioSkipWhitespaces(trio_T *self)
-{
- int ch;
-
- ch = self->current;
- while (isspace(ch))
- {
- self->InStream(self, &ch);
- }
- return ch;
-}
-
-/*************************************************************************
- * TrioGetCollation [private]
- */
-#if TRIO_EXTENSION
-static void
-TrioGetCollation()
-{
- int i;
- int j;
- int k;
- char first[2];
- char second[2];
-
- /* This is computational expensive */
- first[1] = NIL;
- second[1] = NIL;
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- {
- k = 0;
- first[0] = (char)i;
- for (j = 0; j < MAX_CHARACTER_CLASS; j++)
- {
- second[0] = (char)j;
- if (StrEqualLocale(first, second))
- internalCollationArray[i][k++] = (char)j;
- }
- internalCollationArray[i][k] = NIL;
- }
-}
-#endif
-
-/*************************************************************************
- * TrioGetCharacterClass [private]
- *
- * FIXME:
- * multibyte
- */
-static int
-TrioGetCharacterClass(const char *format,
- int *indexPointer,
- unsigned long *flagsPointer,
- int *characterclass)
-{
- int index = *indexPointer;
- int i;
- char ch;
- char range_begin;
- char range_end;
-
- *flagsPointer &= ~FLAGS_EXCLUDE;
-
- if (format[index] == QUALIFIER_CIRCUMFLEX)
- {
- *flagsPointer |= FLAGS_EXCLUDE;
- index++;
- }
- /*
- * If the ungroup character is at the beginning of the scanlist,
- * it will be part of the class, and a second ungroup character
- * must follow to end the group.
- */
- if (format[index] == SPECIFIER_UNGROUP)
- {
- characterclass[(int)SPECIFIER_UNGROUP]++;
- index++;
- }
- /*
- * Minus is used to specify ranges. To include minus in the class,
- * it must be at the beginning of the list
- */
- if (format[index] == QUALIFIER_MINUS)
- {
- characterclass[(int)QUALIFIER_MINUS]++;
- index++;
- }
- /* Collect characters */
- for (ch = format[index];
- (ch != SPECIFIER_UNGROUP) && (ch != NIL);
- ch = format[++index])
- {
- switch (ch)
- {
- case QUALIFIER_MINUS: /* Scanlist ranges */
-
- /*
- * Both C99 and UNIX98 describes ranges as implementation-
- * defined.
- *
- * We support the following behaviour (although this may
- * change as we become wiser)
- * - only increasing ranges, ie. [a-b] but not [b-a]
- * - transitive ranges, ie. [a-b-c] == [a-c]
- * - trailing minus, ie. [a-] is interpreted as an 'a'
- * and a '-'
- * - duplicates (although we can easily convert these
- * into errors)
- */
- range_begin = format[index - 1];
- range_end = format[++index];
- if (range_end == SPECIFIER_UNGROUP)
- {
- /* Trailing minus is included */
- characterclass[(int)ch]++;
- ch = range_end;
- break; /* for */
- }
- if (range_end == NIL)
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- if (range_begin > range_end)
- return TRIO_ERROR_RETURN(TRIO_ERANGE, index);
-
- for (i = (int)range_begin; i <= (int)range_end; i++)
- characterclass[i]++;
-
- ch = range_end;
- break;
-
-#if TRIO_EXTENSION
-
- case SPECIFIER_GROUP:
-
- switch (format[index + 1])
- {
- case QUALIFIER_DOT: /* Collating symbol */
- /*
- * FIXME: This will be easier to implement when multibyte
- * characters have been implemented. Until now, we ignore
- * this feature.
- */
- for (i = index + 2; ; i++)
- {
- if (format[i] == NIL)
- /* Error in syntax */
- return -1;
- else if (format[i] == QUALIFIER_DOT)
- break; /* for */
- }
- if (format[++i] != SPECIFIER_UNGROUP)
- return -1;
-
- index = i;
- break;
-
- case QUALIFIER_EQUAL: /* Equivalence class expressions */
- {
- unsigned int j;
- unsigned int k;
-
- if (internalCollationUnconverted)
- {
- /* Lazy evalutation of collation array */
- TrioGetCollation();
- internalCollationUnconverted = FALSE;
- }
- for (i = index + 2; ; i++)
- {
- if (format[i] == NIL)
- /* Error in syntax */
- return -1;
- else if (format[i] == QUALIFIER_EQUAL)
- break; /* for */
- else
- {
- /* Mark any equivalent character */
- k = (unsigned int)format[i];
- for (j = 0; internalCollationArray[k][j] != NIL; j++)
- characterclass[(int)internalCollationArray[k][j]]++;
- }
- }
- if (format[++i] != SPECIFIER_UNGROUP)
- return -1;
-
- index = i;
- }
- break;
-
- case QUALIFIER_COLON: /* Character class expressions */
-
- if (StrEqualMax(CLASS_ALNUM, sizeof(CLASS_ALNUM) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isalnum(i))
- characterclass[i]++;
- index += sizeof(CLASS_ALNUM) - 1;
- }
- else if (StrEqualMax(CLASS_ALPHA, sizeof(CLASS_ALPHA) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isalpha(i))
- characterclass[i]++;
- index += sizeof(CLASS_ALPHA) - 1;
- }
- else if (StrEqualMax(CLASS_CNTRL, sizeof(CLASS_CNTRL) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (iscntrl(i))
- characterclass[i]++;
- index += sizeof(CLASS_CNTRL) - 1;
- }
- else if (StrEqualMax(CLASS_DIGIT, sizeof(CLASS_DIGIT) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isdigit(i))
- characterclass[i]++;
- index += sizeof(CLASS_DIGIT) - 1;
- }
- else if (StrEqualMax(CLASS_GRAPH, sizeof(CLASS_GRAPH) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isgraph(i))
- characterclass[i]++;
- index += sizeof(CLASS_GRAPH) - 1;
- }
- else if (StrEqualMax(CLASS_LOWER, sizeof(CLASS_LOWER) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (islower(i))
- characterclass[i]++;
- index += sizeof(CLASS_LOWER) - 1;
- }
- else if (StrEqualMax(CLASS_PRINT, sizeof(CLASS_PRINT) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isprint(i))
- characterclass[i]++;
- index += sizeof(CLASS_PRINT) - 1;
- }
- else if (StrEqualMax(CLASS_PUNCT, sizeof(CLASS_PUNCT) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (ispunct(i))
- characterclass[i]++;
- index += sizeof(CLASS_PUNCT) - 1;
- }
- else if (StrEqualMax(CLASS_SPACE, sizeof(CLASS_SPACE) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isspace(i))
- characterclass[i]++;
- index += sizeof(CLASS_SPACE) - 1;
- }
- else if (StrEqualMax(CLASS_UPPER, sizeof(CLASS_UPPER) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isupper(i))
- characterclass[i]++;
- index += sizeof(CLASS_UPPER) - 1;
- }
- else if (StrEqualMax(CLASS_XDIGIT, sizeof(CLASS_XDIGIT) - 1,
- &format[index]))
- {
- for (i = 0; i < MAX_CHARACTER_CLASS; i++)
- if (isxdigit(i))
- characterclass[i]++;
- index += sizeof(CLASS_XDIGIT) - 1;
- }
- else
- {
- characterclass[(int)ch]++;
- }
- break;
-
- default:
- characterclass[(int)ch]++;
- break;
- }
- break;
-
-#endif /* TRIO_EXTENSION */
-
- default:
- characterclass[(int)ch]++;
- break;
- }
- }
- return 0;
-}
-
-/*************************************************************************
- * TrioReadNumber [private]
- *
- * We implement our own number conversion in preference of strtol and
- * strtoul, because we must handle 'long long' and thousand separators.
- */
-static BOOLEAN_T
-TrioReadNumber(trio_T *self,
- trio_uintmax_t *target,
- unsigned long flags,
- int width,
- int base)
-{
- trio_uintmax_t number = 0;
- int digit;
- int count;
- BOOLEAN_T isNegative = FALSE;
- int j;
-
- assert(VALID(self));
- assert(VALID(self->InStream));
- assert((base >= MIN_BASE && base <= MAX_BASE) || (base == NO_BASE));
-
- if (internalDigitsUnconverted)
- {
- /* Lazy evaluation of digits array */
- memset(internalDigitArray, -1, sizeof(internalDigitArray));
- for (j = 0; j < (int)sizeof(internalDigitsLower) - 1; j++)
- {
- internalDigitArray[(int)internalDigitsLower[j]] = j;
- internalDigitArray[(int)internalDigitsUpper[j]] = j;
- }
- internalDigitsUnconverted = FALSE;
- }
-
- TrioSkipWhitespaces(self);
-
- if (!(flags & FLAGS_UNSIGNED))
- {
- /* Leading sign */
- if (self->current == '+')
- {
- self->InStream(self, NULL);
- }
- else if (self->current == '-')
- {
- self->InStream(self, NULL);
- isNegative = TRUE;
- }
- }
-
- count = self->processed;
-
- if (flags & FLAGS_ALTERNATIVE)
- {
- switch (base)
- {
- case NO_BASE:
- case BASE_OCTAL:
- case BASE_HEX:
- case BASE_BINARY:
- if (self->current == '0')
- {
- self->InStream(self, NULL);
- if (self->current)
- {
- if ((base == BASE_HEX) &&
- (toupper(self->current) == 'X'))
- {
- self->InStream(self, NULL);
- }
- else if ((base == BASE_BINARY) &&
- (toupper(self->current) == 'B'))
- {
- self->InStream(self, NULL);
- }
- }
- }
- else
- return FALSE;
- break;
- default:
- break;
- }
- }
-
- while (((width == NO_WIDTH) || (self->processed - count < width)) &&
- (! ((self->current == EOF) || isspace(self->current))))
- {
- if (isascii(self->current))
- {
- digit = internalDigitArray[self->current];
- /* Abort if digit is not allowed in the specified base */
- if ((digit == -1) || (digit >= base))
- break;
- }
- else if (flags & FLAGS_QUOTE)
- {
- /* Compare with thousands separator */
- for (j = 0; internalThousandSeparator[j] && self->current; j++)
- {
- if (internalThousandSeparator[j] != self->current)
- break;
-
- self->InStream(self, NULL);
- }
- if (internalThousandSeparator[j])
- break; /* Mismatch */
- else
- continue; /* Match */
- }
- else
- break;
-
- number *= base;
- number += digit;
-
- self->InStream(self, NULL);
- }
-
- /* Was anything read at all? */
- if (self->processed == count)
- return FALSE;
-
- if (target)
- *target = (isNegative) ? -number : number;
- return TRUE;
-}
-
-/*************************************************************************
- * TrioReadChar [private]
- */
-static int
-TrioReadChar(trio_T *self,
- char *target,
- unsigned long flags,
- int width)
-{
- int i;
- char ch;
- trio_uintmax_t number;
-
- assert(VALID(self));
- assert(VALID(self->InStream));
-
- for (i = 0;
- (self->current != EOF) && (i < width);
- i++)
- {
- ch = (char)self->current;
- self->InStream(self, NULL);
- if ((flags & FLAGS_ALTERNATIVE) && (ch == CHAR_BACKSLASH))
- {
- switch (self->current)
- {
- case '\\': ch = '\\'; break;
- case 'a': ch = '\007'; break;
- case 'b': ch = '\b'; break;
- case 'f': ch = '\f'; break;
- case 'n': ch = '\n'; break;
- case 'r': ch = '\r'; break;
- case 't': ch = '\t'; break;
- case 'v': ch = '\v'; break;
- default:
- if (isdigit(self->current))
- {
- /* Read octal number */
- if (!TrioReadNumber(self, &number, 0, 3, BASE_OCTAL))
- return 0;
- ch = (char)number;
- }
- else if (toupper(self->current) == 'X')
- {
- /* Read hexadecimal number */
- self->InStream(self, NULL);
- if (!TrioReadNumber(self, &number, 0, 2, BASE_HEX))
- return 0;
- ch = (char)number;
- }
- else
- {
- ch = (char)self->current;
- }
- break;
- }
- }
-
- if (target)
- target[i] = ch;
- }
- return i + 1;
-}
-
-/*************************************************************************
- * TrioReadString [private]
- */
-static BOOLEAN_T
-TrioReadString(trio_T *self,
- char *target,
- unsigned long flags,
- int width)
-{
- int i;
-
- assert(VALID(self));
- assert(VALID(self->InStream));
-
- TrioSkipWhitespaces(self);
-
- /*
- * Continue until end of string is reached, a whitespace is encountered,
- * or width is exceeded
- */
- for (i = 0;
- ((width == NO_WIDTH) || (i < width)) &&
- (! ((self->current == EOF) || isspace(self->current)));
- i++)
- {
- if (TrioReadChar(self, &target[i], flags, 1) == 0)
- break; /* for */
- }
- if (target)
- target[i] = NIL;
- return TRUE;
-}
-
-/*************************************************************************
- * TrioReadWideChar [private]
- */
-#if TRIO_WIDECHAR
-static int
-TrioReadWideChar(trio_T *self,
- wchar_t *target,
- unsigned long flags,
- int width)
-{
- int i;
- int j;
- int size;
- int amount = 0;
- wchar_t wch;
- char buffer[MB_LEN_MAX + 1];
-
- assert(VALID(self));
- assert(VALID(self->InStream));
-
- for (i = 0;
- (self->current != EOF) && (i < width);
- i++)
- {
- if (isascii(self->current))
- {
- if (TrioReadChar(self, buffer, flags, 1) == 0)
- return 0;
- buffer[1] = NIL;
- }
- else
- {
- /*
- * Collect a multibyte character, by enlarging buffer until
- * it contains a fully legal multibyte character, or the
- * buffer is full.
- */
- j = 0;
- do
- {
- buffer[j++] = (char)self->current;
- buffer[j] = NIL;
- self->InStream(self, NULL);
- }
- while ((j < (int)sizeof(buffer)) && (mblen(buffer, (size_t)j) != j));
- }
- if (target)
- {
- size = mbtowc(&wch, buffer, sizeof(buffer));
- if (size > 0)
- target[i] = wch;
- }
- amount += size;
- self->InStream(self, NULL);
- }
- return amount;
-}
-#endif /* TRIO_WIDECHAR */
-
-/*************************************************************************
- * TrioReadWideString [private]
- */
-#if TRIO_WIDECHAR
-static BOOLEAN_T
-TrioReadWideString(trio_T *self,
- wchar_t *target,
- unsigned long flags,
- int width)
-{
- int i;
- int size;
-
- assert(VALID(self));
- assert(VALID(self->InStream));
-
- TrioSkipWhitespaces(self);
-
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- mblen(NULL, 0);
-#endif
-
- /*
- * Continue until end of string is reached, a whitespace is encountered,
- * or width is exceeded
- */
- for (i = 0;
- ((width == NO_WIDTH) || (i < width)) &&
- (! ((self->current == EOF) || isspace(self->current)));
- )
- {
- size = TrioReadWideChar(self, &target[i], flags, 1);
- if (size == 0)
- break; /* for */
-
- i += size;
- }
- if (target)
- target[i] = L'\0';
- return TRUE;
-}
-#endif /* TRIO_WIDECHAR */
-
-/*************************************************************************
- * TrioReadGroup [private]
- *
- * FIXME: characterclass does not work with multibyte characters
- */
-static BOOLEAN_T
-TrioReadGroup(trio_T *self,
- char *target,
- int *characterclass,
- unsigned long flags,
- int width)
-{
- int ch;
- int i;
-
- assert(VALID(self));
- assert(VALID(self->InStream));
-
- ch = self->current;
- for (i = 0;
- ((width == NO_WIDTH) || (i < width)) &&
- (! ((ch == EOF) ||
- (((flags & FLAGS_EXCLUDE) != 0) ^ (characterclass[ch] == 0))));
- i++)
- {
- if (target)
- target[i] = (char)ch;
- self->InStream(self, &ch);
- }
-
- if (target)
- target[i] = NIL;
- return TRUE;
-}
-
-/*************************************************************************
- * TrioReadDouble [private]
- *
- * FIXME:
- * add long double
- */
-static BOOLEAN_T
-TrioReadDouble(trio_T *self,
- double *target,
- unsigned long flags,
- int width)
-{
- int ch;
- char doubleString[512] = "";
- int index = 0;
- int start;
- int j;
- BOOLEAN_T isHex = FALSE;
-
- if ((width == NO_WIDTH) || (width > (int)sizeof(doubleString) - 1))
- width = sizeof(doubleString) - 1;
-
- TrioSkipWhitespaces(self);
-
- /*
- * Read entire double number from stream. StrToDouble requires a
- * string as input, but InStream can be anything, so we have to
- * collect all characters.
- */
- ch = self->current;
- if ((ch == '+') || (ch == '-'))
- {
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- width--;
- }
-
- start = index;
- switch (ch)
- {
- case 'n':
- case 'N':
- /* Not-a-number */
- if (index != 0)
- break;
- /* FALLTHROUGH */
- case 'i':
- case 'I':
- /* Infinity */
- while (isalpha(ch) && (index - start < width))
- {
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- }
- doubleString[index] = NIL;
-
- /* Case insensitive string comparison */
- if (StrEqual(&doubleString[start], INFINITE_UPPER) ||
- StrEqual(&doubleString[start], LONG_INFINITE_UPPER))
- {
- *target = ((start == 1 && doubleString[0] == '-'))
- ? -HUGE_VAL
- : HUGE_VAL;
- return TRUE;
- }
- if (StrEqual(doubleString, NAN_LOWER))
- {
- /* NaN must not have a preceeding + nor - */
- *target = TrioGenerateNaN();
- return TRUE;
- }
- return FALSE;
-
- default:
- break;
- }
-
- if (ch == '0')
- {
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- if (toupper(ch) == 'X')
- {
- isHex = TRUE;
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- }
- }
- while ((ch != EOF) && (index - start < width))
- {
- /* Integer part */
- if (isHex ? isxdigit(ch) : isdigit(ch))
- {
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- }
- else if (flags & FLAGS_QUOTE)
- {
- /* Compare with thousands separator */
- for (j = 0; internalThousandSeparator[j] && self->current; j++)
- {
- if (internalThousandSeparator[j] != self->current)
- break;
-
- self->InStream(self, &ch);
- }
- if (internalThousandSeparator[j])
- break; /* Mismatch */
- else
- continue; /* Match */
- }
- else
- break; /* while */
- }
- if (ch == '.')
- {
- /* Decimal part */
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- while ((isHex ? isxdigit(ch) : isdigit(ch)) &&
- (index - start < width))
- {
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- }
- if (isHex ? (toupper(ch) == 'P') : (toupper(ch) == 'E'))
- {
- /* Exponent */
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- if ((ch == '+') || (ch == '-'))
- {
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- }
- while ((isHex ? isxdigit(ch) : isdigit(ch)) &&
- (index - start < width))
- {
- doubleString[index++] = (char)ch;
- self->InStream(self, &ch);
- }
- }
- }
-
- if ((index == start) || (*doubleString == NIL))
- return FALSE;
-
- if (flags & FLAGS_LONGDOUBLE)
-/* *longdoublePointer = StrToLongDouble()*/
- return FALSE; /* FIXME: Remove when long double is implemented */
- else
- {
- *target = StrToDouble(doubleString, NULL);
- }
- return TRUE;
-}
-
-/*************************************************************************
- * TrioReadPointer [private]
- */
-static BOOLEAN_T
-TrioReadPointer(trio_T *self,
- void **target,
- unsigned long flags)
-{
- trio_uintmax_t number;
- char buffer[sizeof(null)];
-
- flags |= (FLAGS_UNSIGNED | FLAGS_ALTERNATIVE | FLAGS_NILPADDING);
-
- if (TrioReadNumber(self,
- &number,
- flags,
- POINTER_WIDTH,
- BASE_HEX))
- {
- /*
- * The strange assignment of number is a workaround for a compiler
- * warning
- */
- if (target)
- *target = (char *)0 + number;
- return TRUE;
- }
- else if (TrioReadString(self,
- (flags & FLAGS_IGNORE)
- ? NULL
- : buffer,
- 0,
- sizeof(null) - 1))
- {
- if (StrEqualCase(buffer, null))
- {
- if (target)
- *target = NULL;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/*************************************************************************
- * TrioScan [private]
- */
-static int
-TrioScan(const void *source,
- size_t sourceSize,
- void (*InStream)(trio_T *, int *),
- const char *format,
- va_list arglist,
- void **argarray)
-{
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- int charlen;
-#endif
- int status;
- int assignment;
- parameter_T parameters[MAX_PARAMETERS];
- trio_T internalData;
- trio_T *data;
- int ch;
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- int cnt;
-#endif
- int index; /* Index of format string */
- int i; /* Index of current parameter */
- unsigned long flags;
- int width;
- int base;
- void *pointer;
-
- assert(VALID(InStream));
- assert(VALID(format));
-
- memset(&internalData, 0, sizeof(internalData));
- data = &internalData;
- data->InStream = InStream;
- data->location = (void *)source;
- data->max = sourceSize;
-
-#if defined(USE_LOCALE)
- if (NULL == internalLocaleValues)
- {
- TrioSetLocale();
- }
-#endif
-
- status = TrioPreprocess(TYPE_SCAN, format, parameters, arglist, argarray);
- if (status < 0)
- return status;
-
- assignment = 0;
- i = 0;
- index = 0;
- data->InStream(data, &ch);
-
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- mblen(NULL, 0);
-#endif
-
- while (format[index])
- {
-#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
- if (! isascii(format[index]))
- {
- charlen = mblen(&format[index], MB_LEN_MAX);
- /* Compare multibyte characters in format string */
- for (cnt = 0; cnt < charlen - 1; cnt++)
- {
- if (ch != format[index + cnt])
- {
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
- data->InStream(data, &ch);
- }
- continue; /* while */
- }
-#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */
- if (EOF == ch)
- return EOF;
-
- if (CHAR_IDENTIFIER == format[index])
- {
- if (CHAR_IDENTIFIER == format[index + 1])
- {
- /* Two % in format matches one % in input stream */
- if (CHAR_IDENTIFIER == ch)
- {
- data->InStream(data, &ch);
- index += 2;
- continue; /* while format chars left */
- }
- else
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
-
- /* Skip the parameter entries */
- while (parameters[i].type == FORMAT_PARAMETER)
- i++;
-
- flags = parameters[i].flags;
- /* Find width */
- width = parameters[i].width;
- if (flags & FLAGS_WIDTH_PARAMETER)
- {
- /* Get width from parameter list */
- width = (int)parameters[width].data.number.as_signed;
- }
- /* Find base */
- base = parameters[i].base;
- if (flags & FLAGS_BASE_PARAMETER)
- {
- /* Get base from parameter list */
- base = (int)parameters[base].data.number.as_signed;
- }
-
- switch (parameters[i].type)
- {
- case FORMAT_INT:
- {
- trio_uintmax_t number;
-
- if (0 == base)
- base = BASE_DECIMAL;
-
- if (!TrioReadNumber(data,
- &number,
- flags,
- width,
- base))
- return assignment;
- assignment++;
-
- if (!(flags & FLAGS_IGNORE))
- {
- pointer = parameters[i].data.pointer;
-#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER)
- if (flags & FLAGS_SIZE_T)
- *(size_t *)pointer = (size_t)number;
- else
-#endif
-#if defined(QUALIFIER_PTRDIFF_T)
- if (flags & FLAGS_PTRDIFF_T)
- *(ptrdiff_t *)pointer = (ptrdiff_t)number;
- else
-#endif
-#if defined(QUALIFIER_INTMAX_T)
- if (flags & FLAGS_INTMAX_T)
- *(trio_intmax_t *)pointer = (trio_intmax_t)number;
- else
-#endif
- if (flags & FLAGS_QUAD)
- *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)number;
- else if (flags & FLAGS_LONG)
- *(long int *)pointer = (long int)number;
- else if (flags & FLAGS_SHORT)
- *(short int *)pointer = (short int)number;
- else
- *(int *)pointer = (int)number;
- }
- }
- break; /* FORMAT_INT */
-
- case FORMAT_STRING:
-#if TRIO_WIDECHAR
- if (flags & FLAGS_WIDECHAR)
- {
- if (!TrioReadWideString(data,
- (flags & FLAGS_IGNORE)
- ? NULL
- : parameters[i].data.wstring,
- flags,
- width))
- return assignment;
- }
- else
-#endif
- {
- if (!TrioReadString(data,
- (flags & FLAGS_IGNORE)
- ? NULL
- : parameters[i].data.string,
- flags,
- width))
- return assignment;
- }
- assignment++;
- break; /* FORMAT_STRING */
-
- case FORMAT_DOUBLE:
- if (!TrioReadDouble(data,
- (flags & FLAGS_IGNORE)
- ? NULL
- : parameters[i].data.doublePointer,
- flags,
- width))
- return assignment;
- assignment++;
- break; /* FORMAT_DOUBLE */
-
- case FORMAT_GROUP:
- {
- int characterclass[MAX_CHARACTER_CLASS + 1];
- int rc;
-
- /* Skip over modifiers */
- while (format[index] != SPECIFIER_GROUP)
- {
- index++;
- }
- /* Skip over group specifier */
- index++;
-
- memset(characterclass, 0, sizeof(characterclass));
- rc = TrioGetCharacterClass(format,
- &index,
- &flags,
- characterclass);
- if (rc < 0)
- return rc;
-
- if (!TrioReadGroup(data,
- (flags & FLAGS_IGNORE)
- ? NULL
- : parameters[i].data.string,
- characterclass,
- flags,
- parameters[i].width))
- return assignment;
- assignment++;
- }
- break; /* FORMAT_GROUP */
-
- case FORMAT_COUNT:
- pointer = parameters[i].data.pointer;
- if (NULL != pointer)
- {
-#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER)
- if (flags & FLAGS_SIZE_T)
- *(size_t *)pointer = (size_t)data->committed;
- else
-#endif
-#if defined(QUALIFIER_PTRDIFF_T)
- if (flags & FLAGS_PTRDIFF_T)
- *(ptrdiff_t *)pointer = (ptrdiff_t)data->committed;
- else
-#endif
-#if defined(QUALIFIER_INTMAX_T)
- if (flags & FLAGS_INTMAX_T)
- *(trio_intmax_t *)pointer = (trio_intmax_t)data->committed;
- else
-#endif
- if (flags & FLAGS_QUAD)
- {
- *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)data->committed;
- }
- else if (flags & FLAGS_LONG)
- {
- *(long int *)pointer = (long int)data->committed;
- }
- else if (flags & FLAGS_SHORT)
- {
- *(short int *)pointer = (short int)data->committed;
- }
- else
- {
- *(int *)pointer = (int)data->committed;
- }
- }
- break; /* FORMAT_COUNT */
-
- case FORMAT_CHAR:
-#if TRIO_WIDECHAR
- if (flags & FLAGS_WIDECHAR)
- {
- if (TrioReadWideChar(data,
- (flags & FLAGS_IGNORE)
- ? NULL
- : parameters[i].data.wstring,
- flags,
- (width == NO_WIDTH) ? 1 : width) > 0)
- return assignment;
- }
- else
-#endif
- {
- if (TrioReadChar(data,
- (flags & FLAGS_IGNORE)
- ? NULL
- : parameters[i].data.string,
- flags,
- (width == NO_WIDTH) ? 1 : width) > 0)
- return assignment;
- }
- assignment++;
- break; /* FORMAT_CHAR */
-
- case FORMAT_POINTER:
- if (!TrioReadPointer(data,
- (flags & FLAGS_IGNORE)
- ? NULL
- : (void **)parameters[i].data.pointer,
- flags))
- return assignment;
- assignment++;
- break; /* FORMAT_POINTER */
-
- case FORMAT_PARAMETER:
- break; /* FORMAT_PARAMETER */
-
- default:
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
- }
- ch = data->current;
- index = parameters[i].indexAfterSpecifier;
- i++;
- }
- else /* Not an % identifier */
- {
- if (isspace((int)format[index]))
- {
- /* Whitespaces may match any amount of whitespaces */
- ch = TrioSkipWhitespaces(data);
- }
- else if (ch == format[index])
- {
- data->InStream(data, &ch);
- }
- else
- return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
-
- index++;
- }
- }
- return assignment;
-}
-
-/*************************************************************************
- * TrioInStreamFile [private]
- */
-static void
-TrioInStreamFile(trio_T *self,
- int *intPointer)
-{
- FILE *file = (FILE *)self->location;
-
- assert(VALID(self));
- assert(VALID(file));
-
- self->current = fgetc(file);
- self->processed++;
- self->committed++;
-
- if (VALID(intPointer))
- {
- *intPointer = self->current;
- }
-}
-
-/*************************************************************************
- * TrioInStreamFileDescriptor [private]
- */
-static void
-TrioInStreamFileDescriptor(trio_T *self,
- int *intPointer)
-{
- int fd = *((int *)self->location);
- int size;
- unsigned char input;
-
- assert(VALID(self));
-
- size = read(fd, &input, sizeof(char));
- self->current = (size == 0) ? EOF : input;
- self->processed++;
- self->committed++;
-
- if (VALID(intPointer))
- {
- *intPointer = self->current;
- }
-}
-
-/*************************************************************************
- * TrioInStreamString [private]
- */
-static void
-TrioInStreamString(trio_T *self,
- int *intPointer)
-{
- unsigned char **buffer;
-
- assert(VALID(self));
- assert(VALID(self->InStream));
- assert(VALID(self->location));
-
- buffer = (unsigned char **)self->location;
- self->current = (*buffer)[0];
- if (self->current == NIL)
- self->current = EOF;
- (*buffer)++;
- self->processed++;
- self->committed++;
-
- if (VALID(intPointer))
- {
- *intPointer = self->current;
- }
-}
-
-/*************************************************************************
- * scanf
- */
-int
-trio_scanf(const char *format,
- ...)
-{
- int status;
- va_list args;
-
- assert(VALID(format));
-
- va_start(args, format);
- status = TrioScan(stdin, 0, TrioInStreamFile, format, args, NULL);
- va_end(args);
- return status;
-}
-
-int
-trio_vscanf(const char *format,
- va_list args)
-{
- assert(VALID(format));
-
- return TrioScan(stdin, 0, TrioInStreamFile, format, args, NULL);
-}
-
-int
-trio_scanfv(const char *format,
- void **args)
-{
- va_list dummy;
- shutup_unitialized(&dummy);
-
- assert(VALID(format));
-
- return TrioScan(stdin, 0, TrioInStreamFile, format, dummy, args);
-}
-
-/*************************************************************************
- * fscanf
- */
-int
-trio_fscanf(FILE *file,
- const char *format,
- ...)
-{
- int status;
- va_list args;
-
- assert(VALID(file));
- assert(VALID(format));
-
- va_start(args, format);
- status = TrioScan(file, 0, TrioInStreamFile, format, args, NULL);
- va_end(args);
- return status;
-}
-
-int
-trio_vfscanf(FILE *file,
- const char *format,
- va_list args)
-{
- assert(VALID(file));
- assert(VALID(format));
-
- return TrioScan(file, 0, TrioInStreamFile, format, args, NULL);
-}
-
-int
-trio_fscanfv(FILE *file,
- const char *format,
- void **args)
-{
- va_list dummy;
- shutup_unitialized(&dummy);
-
- assert(VALID(file));
- assert(VALID(format));
-
- return TrioScan(file, 0, TrioInStreamFile, format, dummy, args);
-}
-
-/*************************************************************************
- * dscanf
- */
-int
-trio_dscanf(int fd,
- const char *format,
- ...)
-{
- int status;
- va_list args;
-
- assert(VALID(format));
-
- va_start(args, format);
- status = TrioScan(&fd, 0, TrioInStreamFileDescriptor, format, args, NULL);
- va_end(args);
- return status;
-}
-
-int
-trio_vdscanf(int fd,
- const char *format,
- va_list args)
-{
- assert(VALID(format));
-
- return TrioScan(&fd, 0, TrioInStreamFileDescriptor, format, args, NULL);
-}
-
-int
-trio_dscanfv(int fd,
- const char *format,
- void **args)
-{
- va_list dummy;
- shutup_unitialized(&dummy);
-
- assert(VALID(format));
-
- return TrioScan(&fd, 0, TrioInStreamFileDescriptor, format, dummy, args);
-}
-
-/*************************************************************************
- * sscanf
- */
-int
-trio_sscanf(const char *buffer,
- const char *format,
- ...)
-{
- int status;
- va_list args;
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- va_start(args, format);
- status = TrioScan(&buffer, 0, TrioInStreamString, format, args, NULL);
- va_end(args);
- return status;
-}
-
-int
-trio_vsscanf(const char *buffer,
- const char *format,
- va_list args)
-{
- assert(VALID(buffer));
- assert(VALID(format));
-
- return TrioScan(&buffer, 0, TrioInStreamString, format, args, NULL);
-}
-
-int
-trio_sscanfv(const char *buffer,
- const char *format,
- void **args)
-{
- va_list dummy;
- shutup_unitialized(&dummy);
-
- assert(VALID(buffer));
- assert(VALID(format));
-
- return TrioScan(&buffer, 0, TrioInStreamString, format, dummy, args);
-}
-
+++ /dev/null
-/*************************************************************************
- *
- * $Id$
- *
- * Copyright (C) 2000 Bjorn Reese and Daniel Stenberg.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
- *
- ************************************************************************
- *
- * Private functions, types, etc. used for callback functions.
- *
- * The ref pointer is an opaque type and should remain as such.
- * Private data must only be accessible through the getter and
- * setter functions.
- *
- ************************************************************************/
-
-#ifndef TRIO_TRIOP_H
-#define TRIO_TRIOP_H
-
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef TRIO_C99
-# define TRIO_C99 1
-#endif
-#ifndef TRIO_BSD
-# define TRIO_BSD 1
-#endif
-#ifndef TRIO_GNU
-# define TRIO_GNU 1
-#endif
-#ifndef TRIO_MISC
-# define TRIO_MISC 1
-#endif
-#ifndef TRIO_UNIX98
-# define TRIO_UNIX98 1
-#endif
-#ifndef TRIO_MICROSOFT
-# define TRIO_MICROSOFT 1
-#endif
-#ifndef TRIO_EXTENSION
-# define TRIO_EXTENSION 1
-#endif
-#ifndef TRIO_WIDECHAR
-# define TRIO_WIDECHAR 0
-#endif
-#ifndef TRIO_ERRORS
-# define TRIO_ERRORS 1
-#endif
-
-#ifndef TRIO_MALLOC
-# define TRIO_MALLOC(n) malloc(n)
-#endif
-#ifndef TRIO_REALLOC
-# define TRIO_REALLOC(x,n) realloc((x),(n))
-#endif
-#ifndef TRIO_FREE
-# define TRIO_FREE(x) free(x)
-#endif
-
-typedef int (*trio_callback_t)(void *ref);
-
-void *trio_register(trio_callback_t callback, const char *name);
-void trio_unregister(void *handle);
-
-const char *trio_get_format(void *ref);
-void *trio_get_argument(void *ref);
-
-/* Modifiers */
-int trio_get_width(void *ref);
-void trio_set_width(void *ref, int width);
-int trio_get_precision(void *ref);
-void trio_set_precision(void *ref, int precision);
-int trio_get_base(void *ref);
-void trio_set_base(void *ref, int base);
-int trio_get_padding(void *ref);
-void trio_set_padding(void *ref, int is_padding);
-int trio_get_short(void *ref); /* h */
-void trio_set_shortshort(void *ref, int is_shortshort);
-int trio_get_shortshort(void *ref); /* hh */
-void trio_set_short(void *ref, int is_short);
-int trio_get_long(void *ref); /* l */
-void trio_set_long(void *ref, int is_long);
-int trio_get_longlong(void *ref); /* ll */
-void trio_set_longlong(void *ref, int is_longlong);
-int trio_get_longdouble(void *ref); /* L */
-void trio_set_longdouble(void *ref, int is_longdouble);
-int trio_get_alternative(void *ref); /* # */
-void trio_set_alternative(void *ref, int is_alternative);
-int trio_get_alignment(void *ref); /* - */
-void trio_set_alignment(void *ref, int is_leftaligned);
-int trio_get_spacing(void *ref); /* (space) */
-void trio_set_spacing(void *ref, int is_space);
-int trio_get_sign(void *ref); /* + */
-void trio_set_sign(void *ref, int is_showsign);
-int trio_get_quote(void *ref); /* ' */
-void trio_set_quote(void *ref, int is_quote);
-int trio_get_upper(void *ref);
-void trio_set_upper(void *ref, int is_upper);
-#if TRIO_C99
-int trio_get_largest(void *ref); /* j */
-void trio_set_largest(void *ref, int is_largest);
-int trio_get_ptrdiff(void *ref); /* t */
-void trio_set_ptrdiff(void *ref, int is_ptrdiff);
-int trio_get_size(void *ref); /* z / Z */
-void trio_set_size(void *ref, int is_size);
-#endif
-
-/* Printing */
-int trio_print_ref(void *ref, const char *format, ...);
-int trio_vprint_ref(void *ref, const char *format, va_list args);
-int trio_printv_ref(void *ref, const char *format, void **args);
-
-void trio_print_int(void *ref, int number);
-void trio_print_uint(void *ref, unsigned int number);
-/* void trio_print_long(void *ref, long number); */
-/* void trio_print_ulong(void *ref, unsigned long number); */
-void trio_print_double(void *ref, double number);
-void trio_print_string(void *ref, char *string);
-void trio_print_pointer(void *ref, void *pointer);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* TRIO_TRIOP_H */
+++ /dev/null
-# defaults
-top_srcdir=.
-builddir=build
-top_builddir=${top_srcdir}/${builddir}
-stagedir=.
-distdir=.
-globalprefix=glite
-lbprefix=lb
-package=glite-lb-server
-version=0.0.0
-PREFIX=/opt/glite
-
-glite_location=/opt/glite
-globus_prefix=/opt/globus
-nothrflavour=gcc32
-thrflavour=gcc32pthr
-expat_prefix=/opt/expat
-ares_prefix=/opt/ares
-gsoap_prefix=/software/gsoap-2.6
-
-CC=gcc
-
--include Makefile.inc
-
-
-VPATH=${top_srcdir}/src:${top_srcdir}/examples:${top_srcdir}/test:${top_srcdir}/project:${jpproject}:${stagedir}/interface
-
-GLOBUS_LIBS:=-L${globus_prefix}/lib \
- -lglobus_common_${nothrflavour} \
- -lglobus_gssapi_gsi_${nothrflavour}
-
-GLOBUS_CFLAGS:=-I${globus_prefix}/include/${nothrflavour}
-
-CPPFLAGS:=-DDEBUG -D_GNU_SOURCE
-DEBUG:=-W -Wall -Wno-unused-parameter -Wno-unused-function -g -O0
-
-dotless_soap_ver:=${shell echo ${gsoap_version} | tr -d . }
-GSOAPLIB:=-L${stagedir}/lib -lglite_security_gsoap_plugin_${dotless_soap_ver}_${nothrflavour} -L${ares_prefix}/lib -lares
-
-gsoap_bin_prefix:=${shell if [ -x ${gsoap_prefix}/bin/soapcpp2 ]; then echo ${gsoap_prefix}/bin; else echo ${gsoap_prefix}; fi }
-
-CFLAGS:=${CPPFLAGS} ${DEBUG} -I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${gsoap_prefix}/include -I${gsoap_prefix} -I${stagedir}/include ${GLOBUS_CFLAGS} -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql
-LDFLAGS:=-L${stagedir}/lib
-
-LINK:=libtool --mode=link ${CC} ${LDFLAGS}
-LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS}
-INSTALL:=libtool --mode=install install
-
-
-daemon:=glite-jp-indexd
-example:=glite-jpis-test
-is_prefix:=jpis_
-ps_prefix:=jpps_
-
-SRCS:= conf.c bones_server.c soap_ops.c soap_ps_calls.c \
- ws_ps_typeref.c ws_is_typeref.c db_ops.c context.c \
- ${is_prefix}ServerLib.c \
- ${ps_prefix}ClientLib.c ${ps_prefix}C.c \
-
-EXA_SRCS:=jpis-test.c ${is_prefix}C.c ${is_prefix}Client.c context.c db_ops.c conf.c
-
-OBJS:=${SRCS:.c=.o}
-EXA_OBJS:=${EXA_SRCS:.c=.o}
-
-
-COMMONLIB:=-lglite_jp_common
-SRVCOMMONLIB:=-lglite_jp_server_common
-BONESLIB:=-lglite_lb_server_bones
-TRIOLIB:=-lglite_jp_trio
-
-ifneq (${mysql_prefix},/usr)
- ifeq ($(shell echo ${mysql_version} | cut -d. -f1,2),4.1)
- MYSQLIB := -L${mysql_prefix}/lib/mysql -lmysqlclient
- else
- MYSQLIB := -L${mysql_prefix}/lib -lmysqlclient
- endif
-else
- MYSQLIB := -lmysqlclient
-endif
-
-
-default all: compile
-
-compile: ${daemon} ${example}
-
-${daemon}: ${OBJS}
- ${LINK} -o $@ -export-dynamic ${OBJS} ${BONESLIB} ${TRIOLIB} ${COMMONLIB} ${GSOAPLIB} ${GLOBUS_LIBS} ${MYSQLIB} ${SRVCOMMONLIB}
-
-${example}: ${EXA_OBJS}
- ${LINK} -o $@ ${EXA_OBJS} ${GSOAPLIB} ${GLOBUS_LIBS} ${COMMONLIB} ${TRIOLIB} ${MYSQLIB} ${SRVCOMMONLIB}
-
-jpis-db-internal: jpis-db-internal.o db_ops.o conf.o context.o
- ${LINK} -o $@ $+ ${COMMONLIB} ${SRVCOMMONLIB} ${GLOBUS_LIBS}
-
-JobProvenanceIS.xh: JobProvenanceIS.wsdl JobProvenanceTypes.wsdl typemap.dat
- cp ${stagedir}/interface/JobProvenanceTypes.wsdl .
- ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ $<
- rm -f JobProvenanceTypes.wsdl
-
-JobProvenancePS.xh: %.xh: %.wsdl JobProvenanceTypes.wsdl typemap.dat
- cp ${stagedir}/interface/JobProvenanceTypes.wsdl .
- ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ $<
- rm -f JobProvenanceTypes.wsdl
-
-${is_prefix}ClientLib.c ${is_prefix}Client.c \
-${is_prefix}Server.c ${is_prefix}ServerLib.c \
-${is_prefix}C.c ${is_prefix}H.h: JobProvenanceIS.xh
- ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${is_prefix} JobProvenanceIS.xh
-
-${ps_prefix}Client.c ${ps_prefix}ClientLib.c \
-${ps_prefix}C.c ${ps_prefix}H.h: JobProvenancePS.xh
- ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${ps_prefix} JobProvenancePS.xh
-
-
-#env_C.c env_Server.c:
-# touch env.xh
-# cp ${stagedir}/interface/JobProvenanceTypes.wsdl .
-# ${gsoap_prefix}/bin/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o env.xh JobProvenanceTypes.wsdl
-# rm -f JobProvenanceTypes.wsdl
-# ${gsoap_prefix}/bin/soapcpp2 -w -c -p env_ env.xh
-
-check:
- -echo nothing yet
-
-doc:
-
-stage: compile
- ${INSTALL} -m 755 ${daemon} ${stagedir}/bin
- ${INSTALL} -m 755 ${example} ${stagedir}/bin
-
-dist: distsrc distbin
-
-distsrc:
- mkdir -p ${top_srcdir}/${package}-${version}
- cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version}
- cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version}
- rm -rf ${top_srcdir}/${package}-${version}
-
-distbin:
- $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir}
- save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir
- rm -rf tmpbuilddir
-
-install:
- -mkdir -p ${PREFIX}/bin ${PREFIX}/etc ${PREFIX}/etc/init.d
- -mkdir -p ${PREFIX}/share/doc/${package}-${version}
- ${INSTALL} -m 755 glite-jp-indexd ${PREFIX}/bin; \
- ${INSTALL} -m 755 glite-jpis-test ${PREFIX}/bin; \
-
- ${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-jp-indexd
- ${INSTALL} -m 644 ${top_srcdir}/doc/README ${PREFIX}/share/doc/${package}-${version}
-
-clean:
-
-soap_ops.o bones_server.o simple_server.o: ${is_prefix}H.h ${ps_prefix}H.h
-
-soap_ops.o bones_server.o: soap_version.h
-
-soap_version.h:
- ${gsoap_bin_prefix}/soapcpp2 /dev/null
- perl -ne '$$. == 2 && /.*([0-9])\.([0-9])\.([0-9]).*/ && printf "#define GSOAP_VERSION %d%02d%02d\n",$$1,$$2,$$3' soapH.h >$@
- -rm soapC.cpp soapH.h soapStub.h soapClient.cpp soapServer.cpp soapClientLib.cpp soapServerLib.cpp
-
-db_ops.h: context.h
-context.h: conf.h
-db_ops.o: db_ops.c conf.h context.h db_ops.h
-context.o: context.c conf.h context.h
-soap_ps_calls.o: soap_ps_calls.c jpps_H.h jpps_.nsmap soap_version.h conf.h db_ops.h ws_ps_typeref.h context.h
-soap_ops.o: soap_ops.c jpis_H.h jpis_.nsmap soap_version.h db_ops.h ws_ps_typeref.h ws_is_typeref.h context.h
-ws_ps_typeref.o: ws_ps_typeref.c jpis_H.h ws_typemap.h ws_ps_typeref.h
-ws_is_typeref.o: ws_is_typeref.c jpis_H.h ws_typemap.h ws_is_typeref.h
-
-.PHONY: default all compile check doc stage dist distsrc distbin install clean
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Build file for the gLite JP Index module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.2 2004/11/22 14:00:37 dimeglio
- Updated to use standard files
- Fixed names (was using common instead of real module name)
-
- Revision 1.1.1.1 2004/10/15 09:49:13 akrenek
--->
-
-<project name="index" default="dist">
-
- <!-- =========================================
- Builds the GLite JP Index Module
- ========================================= -->
-
- <!-- =========================================
- Import properties (order is important)
- ========================================= -->
-
- <!-- import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- import component build properties,
- component properties &
- component common properties -->
- <import file="./project/properties.xml"/>
-
- <!-- import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="${subsystem.properties.file}"/>
-
- <!-- import global build properties &
- global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependency property files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${component.dependencies.file}" />
- <property file="${subsystem.dependencies.file}" />
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options (order is important)
- ========================================= -->
- <import file="${global.configure.options.file}"/>
- <import file="${component.configure.options.file}"/>
-
- <!-- =========================================
- Import task definitions (order is important)
- ========================================= -->
- <import file="${subsystem.taskdefs.file}" />
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Load common targets
- ========================================= -->
- <import file="${global.targets-simple_make.file}" />
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ==============================================
- Local private targets
- ============================================== -->
-
- <target name="localinit"
- description="Module specific initialization tasks">
-
- <antcall target="lbmakefiles" />
- </target>
-
- <target name="localcompile"
- description="Module specific compile tasks">
- </target>
-
- <target name="localclean"
- description="Module specific cleaning tasks">
- </target>
-
-</project>
+++ /dev/null
-#! /bin/sh
-
-#
-# Shell example of preparing the database for JP Index Server
-#
-
-# database
-mysqladmin -u root -p create jpis1
-
-# user
-mysql -u root -p -e 'GRANT ALL on jpis1.* to jpis@localhost'
-
-# tables
-mysql -u jpis jpis1 < `dirname $0`/glite-jp-index-dbsetup.sql
+++ /dev/null
-create table jobs (
- jobid char(32) binary not null,
- dg_jobid varchar(255) binary not null,
- ownerid char(32) binary not null,
- aclid char(32) binary null,
- ps varchar(255) not null,
-
- primary key (jobid),
- unique (dg_jobid),
- index (jobid),
- index (dg_jobid)
-);
-
-create table attrs (
- attrid char(32) binary not null,
- name varchar(255) binary not null,
- indexed int not null,
- type char(32) binary null,
-
- primary key (attrid),
- index (attrid),
- index (name)
-);
-
-create table feeds (
- uniqueid int auto_increment not null,
- feedid char(32) binary unique,
- state int not null,
- locked int not null,
- source varchar(255) not null,
- expires datetime,
- condition mediumblob null,
-
- primary key (uniqueid),
- index (uniqueid),
- index (feedid),
- index (state)
-);
-
-create table acls (
- aclid char(32) binary not null,
- value mediumblob not null,
- refcnt int not null,
-
- primary key (aclid)
-);
-
-create table users (
- userid char(32) binary not null,
- cert_subj varchar(255) binary not null,
-
- primary key (userid),
- unique (cert_subj)
-);
-
-
-# data tables - created one for each configured attribute, index on
-# value is created only for attributes configured to be indexed
-#
-#create table attr_<attrid> (
-# jobid char(32) binary not null,
-# value varchar(255) binary not null,
-# full_value mediumblob not null,
-#
-# index (jobid),
-# index (value)
-#);
-
+++ /dev/null
-#! /bin/sh
-
-#
-# startup script for JP index server
-#
-# environment:
-# GLITE_JPIS_PS - required JP PrimaryStorage server
-# (for example http://umbar.ics.muni.cz:8901)
-# GLITE_JPIS_PORT - used port (default 8902)
-# GLITE_JPIS_DB - connection string (default jpis/@localhost:jpis1)
-#
-
-GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite}
-GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-${GLITE_LOCATION}/var}
-
-[ -f /etc/glite.conf ] && . /etc/glite.conf
-[ -f $GLITE_LOCATION/etc/glite-wms.conf ] && . $GLITE_LOCATION/etc/glite-wms.conf
-[ -f $HOME/.glite.conf ] && . $HOME/.glite.conf
-
-[ -f $GLITE_LOCATION/etc/jpis.conf ] && . $GLITE_LOCATION/etc/jpis.conf
-[ -f $GLITE_LOCATION_VAR/etc/jpis.conf ] && . $GLITE_LOCATION_VAR/etc/jpis.conf
-
-[ -n "$GLITE_JPIS_SERVER_PIDFILE" ] && pidfile=$GLITE_JPIS_SERVER_PIDFILE ||
- pidfile=$GLITE_LOCATION_VAR/glite-jp-indexd.pid
-
-unset creds port
-
-start()
-{
- echo -n Starting glite-jp-indexd ...
- $GLITE_LOCATION/bin/glite-jp-indexd > $GLITE_LOCATION_VAR/log/glite-jp-index.log 2>&1 &
- echo " done"
-}
-
-stop()
-{
- echo -n Stopping glite-jp-indexd ...
- if [ -f $pidfile ]; then
- pid=`cat $pidfile`
- kill $pid
- echo -n Stopping glite-jp-indexd \($pid\) ...
- try=0
- while ps p $pid >/dev/null 2>&1; do
- sleep 1;
- try=`expr $try + 1`
- if [ $try = 20 ]; then
- echo " giving up after $try retries"
- return 1
- fi
- done
- echo " done"
- rm -f $pidfile
- else
- killall glite-jp-indexd
-# echo $pidfile does not exist - glite-jp-indexd not running? >&2
- fi
- echo done
-}
-
-status()
-{
- if [ -f $pidfile ]; then
- pid=`cat $pidfile`
- if ps p $pid >/dev/null 2>&1; then
- echo glite-jp-indexd running as $pid
- return 0
- fi
- else
- ps xa | grep "glite-jp-indexd" > /dev/null
- if [ "$?" = 0 ]; then
- echo glite-jp-indexd running
- return 0
- fi
- fi
-
- echo glite-jp-indexd not running
- return 1
-}
-
-case x$1 in
- xstart) start;;
- xstop) stop;;
- xrestart) stop; start;;
- xstatus) status;;
- x*) echo usage: $0 start,stop,restart,status >&2
- exit 1;;
-esac
+++ /dev/null
-Job provenance Index server README
-==================================
-
-($Header$)
-
-Job provenance and its components
----------------------------------
-
-This file contains basic administrator's documentation for Job
-provenance (JP) Index server (IS). For Job provenance architecture and
-functionality description please see: EGEE architecture document
-DJRA1.4 - https://edms.cern.ch/document/594698/ chapter 8.4.
-Job provenance interfaces are documented on http://egee.cesnet.cz/en/WSDL/
-page.
-
-Source code, executables, dependences
--------------------------------------
-
-JP-IS CVS module name is org.glite.jp.index. It depends on common JP libraries
-(module org.glite.jp.common, org.glite.jp.server-common) and implements
-interfaces defined in org.glite.jp.ws-interface. It is also based on
-org.glite.lb.server-bones.
-
-JP-IS consist from one stand-alone daemon (glite-jp-indexd) which is
-using MySQL database. Default db name is jpis1, all access is granted to
-user jpis.
-
-JP-IS interactions:
-
-- JP primary storage - feedins data from primary storage to the IS according
- to particular IS instance administrator needs (expressed by IS configuration)
-
-- IS user query interface - implements IS service for end users
-
-- admin interface - intended for admin tools (management and
- on-the-fly configuration changes)
-
-
-Release notes
--------------
-
-- In this release configuration of JP-IS is rather limited. Parts of
- configuration are hard-coded (src/conf.c)
-
-- Debug outputs are on and directed to /opt/glite/var/log/glite-jp-index.log
- file.
-
-- No admin tools are implemented yet.
-
-
-Installation
-------------
-
-- database setup
-
- The JP-IS server daemon assume prior creation of its database. Simple tool
- for database creation is org.glite.jp.index/config/dbsetup.sh
-
-- customize startup script /etc/init.d/glite-jp-indexd (see below)
- and set up service startup using this script
-
-
-Configuration
--------------
-
-Currently configuration is done by environment variables (see also
-startup script template):
-
-GLITE_JPIS_PS - location of JP-PS server (required parameter)
- (for example http://umbar.ics.muni.cz:8901)
-
-GLITE_JPIS_PORT - used port (default 8902)
-
-GLITE_JPIS_DB - database connection string (default jpis/@localhost:jpis1)
-
-
-Other parameters will be configurable in close future. Its
-current hard-coded values are in org.glite.jp.index/src/conf.[ch]
-
-
-Testing
--------
-
-For testing purposes, simple program is included. It is located in
-examples/jpis-test.c and is installed in RPM. It works in three
-steps:
-
-1) it simulates response from primary storage, making appropriate
- changes in database. (inserts feedid).
-
-2) it calls updateJobs wsdl call, normally invoked by JP-PS, and
- send some data to JP-IS which stores them im database.
-
-3) it calls queryJobs wsdl call, normally called by user program,
- obtaining previously inserted data.
-
-Test query has form (status=Done OR status=Ready) AND (user!=God).
+++ /dev/null
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-
-#include <glite/jp/db.h>
-
-#include "db_ops.h"
-
-
-static void print_err(glite_jp_context_t ctx) {
- glite_jp_error_t *e;
-
- e = ctx->error;
- while(e) {
- printf("%s (%s)\n", e->desc, e->source);
- e = e->reason;
- }
- printf("\n");
-}
-
-
-int glite_jpis_db_queries_serialize(void **blob, size_t *len, glite_jp_query_rec_t **queries);
-int glite_jpis_db_queries_deserialize(glite_jp_query_rec_t ***queries, void *blob, size_t blob_size);
-
-int main(int argc, char *argv[]) {
-#if 1
- glite_jp_context_t jpctx;
- glite_jp_is_conf *conf;
- glite_jpis_context_t isctx;
- int ret;
- long int uniqueid;
- char *ps, *feedid;
-
- jpctx = NULL;
- isctx = NULL;
- conf = NULL;
- glite_jp_init_context(&jpctx);
- if (glite_jp_get_conf(argc, argv, NULL, &conf) != 0) goto fail;
- if (glite_jpis_init_context(&isctx, jpctx, conf) != 0) goto fail;
- if (glite_jpis_init_db(isctx) != 0) goto fail;
-
- printf("dropping...\n");
- if (glite_jpis_dropDatabase(isctx) != 0) goto faildb;
-
- printf("initializing...\n");
- if (glite_jpis_initDatabase(isctx) != 0) goto faildb;
-
- printf("locking...\n");
- do {
- if ((ret = glite_jpis_lockUninitializedFeed(isctx, &uniqueid, &ps)) == ENOLCK) goto faildb;
- if (ret == 0) {
- printf("locked: uniqueid=%li, ps=%s\n", uniqueid, ps);
- free(ps);
-
- asprintf(&feedid, "feed://%lu", uniqueid + 3);
- if (glite_jpis_initFeed(isctx, uniqueid, feedid, (time_t)10000) != 0) {
- free(feedid);
- goto faildb;
- }
- free(feedid);
-
- if (glite_jpis_unlockFeed(isctx, uniqueid) != 0) goto faildb;
- }
- } while (ret == 0);
-
- if (glite_jpis_tryReconnectFeed(isctx, uniqueid, time(NULL) + 10) != 0) goto faildb;
-
- glite_jpis_free_db(isctx);
- glite_jpis_free_context(isctx);
- glite_jp_free_conf(conf);
- glite_jp_free_context(jpctx);
-
- return 0;
-
-faildb:
- glite_jpis_free_db(isctx);
-fail:
- printf("failed\n");
- glite_jpis_free_context(isctx);
- glite_jp_free_conf(conf);
- if (jpctx) {
- print_err(jpctx);
- glite_jp_free_context(jpctx);
- }
-
- return 1;
-#endif
-#if 0
- glite_jp_context_t ctx;
- glite_jp_is_conf *conf;
- void *blob;
- size_t len;
- int ret, i;
- glite_jp_query_rec_t **queries;
-
- ret = 0;
- glite_jp_init_context(&ctx);
-
- if (glite_jp_get_conf(argc, argv, NULL, &conf) != 0) goto fail_ctx;
- if ((ret = glite_jpis_db_queries_serialize(&blob, &len, conf->feeds[0]->query)) != 0) goto fail;
-
- if (write(1, blob, len) != len) {
- ret = errno;
- free(blob);
- goto fail;
- }
-
- if ((ret = glite_jpis_db_queries_deserialize(&queries, blob, len)) != 0) goto fail_blob;
- i = 0;
- while (queries[i] && queries[i]->attr) {
- printf("query: attr=%s, op=%d, value=%s, value2=%s, bin=%d\n", queries[i]->attr, queries[i]->op, queries[i]->value, queries[i]->value2, queries[i]->binary);
- free(queries[i]->attr);
- free(queries[i]->value);
- free(queries[i]->value2);
- free(queries[i]);
- i++;
- }
- free(queries);
-
- free(blob);
- glite_jp_free_context(ctx);
- return 0;
-
-fail_blob:
- free(blob);
-fail:
- fprintf(stderr, "fail: %s\n", strerror(ret));
-fail_ctx:
- glite_jp_free_context(ctx);
- return 1;
-#endif
-}
+++ /dev/null
-#include <stdio.h>
-#include <sysexits.h>
-#include <string.h>
-#include <assert.h>
-
-#include <glite/security/glite_gsplugin.h>
-#include "glite/jp/strmd5.h"
-
-#include "jpis_H.h"
-#include "jpis_.nsmap"
-#include "db_ops.h"
-#include "conf.h"
-
-
-#include "soap_version.h"
-#if GSOAP_VERSION <= 20602
-#define soap_call___jpsrv__UpdateJobs soap_call___ns1__UpdateJobs
-#define soap_call___jpsrv__QueryJobs soap_call___ns1__QueryJobs
-#endif
-
-
-/* insert simulating FeedIndex call */
-#define INSERT "insert into feeds value ('93', '12345', '8', '0' , 'http://localhost:8901', '2005-10-14 10:48:27', 'COND2');"
-
-static int check_fault(struct soap *soap,int err);
-
-
-
-int main(int argc,char *argv[])
-{
- char *server = "http://localhost:8902";
- struct soap *soap = soap_new();
-
- soap_init(soap);
- soap_set_namespaces(soap, jpis__namespaces);
- soap_register_plugin(soap,glite_gsplugin);
-
-/*---------------------------------------------------------------------------*/
- // simulate FeedIndex PS response
- {
- glite_jp_db_stmt_t stmt;
- glite_jp_context_t ctx;
- glite_jpis_context_t isctx;
- glite_jp_is_conf *conf;
-
-
- glite_jp_init_context(&ctx);
- glite_jp_get_conf(0, NULL, NULL, &conf);
- glite_jpis_init_context(&isctx, ctx, conf);
- if (glite_jpis_init_db(isctx) != 0) {
- fprintf(stderr, "Connect DB failed: %s (%s)\n",
- ctx->error->desc, ctx->error->source);
- goto end;
- }
-
- if (glite_jp_db_execstmt(ctx,
- INSERT, &stmt) < 0) goto end;
- end:
- glite_jpis_free_context(isctx);
- glite_jp_free_context(ctx);
- glite_jp_free_conf(conf);
- }
-
-/*---------------------------------------------------------------------------*/
- // test calls of server functions
- // this call is issued by JPPS
- {
- struct jptype__jobRecord *rec;
- struct _jpelem__UpdateJobs in;
- struct _jpelem__UpdateJobsResponse out;
-
- memset(&in, 0, sizeof(in));
- memset(&out, 0, sizeof(out));
-
- //XXX : need to register feed with feedid in.feedId in DB
- // this one work only because such feed in conf.c (umbar)
-
- //in.feedId = soap_strdup(soap, str2md5("http://localhost:8901"));
- in.feedId = soap_strdup(soap, "12345");
- in.feedDone = false_;
- in.__sizejobAttributes = 1;
- in.jobAttributes = soap_malloc(soap,
- in.__sizejobAttributes * sizeof(*(in.jobAttributes)));
- {
- rec = soap_malloc(soap, sizeof(*rec));
- rec->jobid = soap_strdup(soap, "https://localhost:7846/pokus");
- rec->owner = soap_strdup(soap, "OwnerName");
- rec->__sizeprimaryStorage = 0;
- rec->primaryStorage = NULL;
- rec->__sizeattributes = 2;
- rec->attributes = soap_malloc(soap,
- rec->__sizeattributes * sizeof(*(rec->attributes)));
- rec->attributes[0] = soap_malloc(soap, sizeof(*(rec->attributes[0])));
- rec->attributes[0]->name = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:user");
- rec->attributes[0]->value = soap_malloc(soap, sizeof(*(rec->attributes[0]->value)));
- rec->attributes[0]->value->string = soap_strdup(soap, "CertSubj");
- rec->attributes[0]->value->blob = NULL;
- rec->attributes[0]->timestamp = 333;
- rec->attributes[0]->origin = jptype__attrOrig__SYSTEM;
- rec->attributes[0]->originDetail = NULL;
-
- rec->attributes[1] = soap_malloc(soap, sizeof(*(rec->attributes[1])));
- rec->attributes[1]->name = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus");
- rec->attributes[1]->value = soap_malloc(soap, sizeof(*(rec->attributes[0]->value)));
- rec->attributes[1]->value->string = soap_strdup(soap, "Done");
- rec->attributes[1]->value->blob = NULL;
- rec->attributes[1]->timestamp = 333;
- rec->attributes[1]->origin = jptype__attrOrig__SYSTEM;
- rec->attributes[1]->originDetail = NULL;
-
- }
- in.jobAttributes[0] = rec;
-
-
- check_fault(soap,
- soap_call___jpsrv__UpdateJobs(soap,server,"",&in,&out));
- }
-
-/*---------------------------------------------------------------------------*/
- // this query call issued by user
- {
- struct _jpelem__QueryJobs in;
- struct jptype__indexQuery *cond;
- struct jptype__indexQueryRecord *rec;
- struct _jpelem__QueryJobsResponse out;
- int i, j;
-
-
- in.__sizeconditions = 2;
- in.conditions = soap_malloc(soap,
- in.__sizeconditions *
- sizeof(*(in.conditions)));
-
- // query status
- cond = soap_malloc(soap, sizeof(*cond));
- memset(cond, 0, sizeof(*cond));
- cond->attr = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus");
- cond->origin = NULL;
- cond->__sizerecord = 2;
- cond->record = soap_malloc(soap, cond->__sizerecord * sizeof(*(cond->record)));
-
- // equal to Done
- rec = soap_malloc(soap, sizeof(*rec));
- memset(rec, 0, sizeof(*rec));
- rec->op = jptype__queryOp__EQUAL;
- rec->value = soap_malloc(soap, sizeof(*(rec->value)));
- rec->value->string = soap_strdup(soap, "Done");
- rec->value->blob = NULL;
- cond->record[0] = rec;
-
- // OR equal to Ready
- rec = soap_malloc(soap, sizeof(*rec));
- memset(rec, 0, sizeof(*rec));
- rec->op = jptype__queryOp__EQUAL;
- rec->value = soap_malloc(soap, sizeof(*(rec->value)));
- rec->value->string = soap_strdup(soap, "Ready");
- rec->value->blob = NULL;
- cond->record[1] = rec;
-
- in.conditions[0] = cond;
-
- // AND
- // owner
- cond = soap_malloc(soap, sizeof(*cond));
- memset(cond, 0, sizeof(*cond));
- cond->attr = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:user");
- cond->origin = NULL;
- cond->__sizerecord = 1;
- cond->record = soap_malloc(soap, cond->__sizerecord * sizeof(*(cond->record)));
-
- // not equal to CertSubj
- rec = soap_malloc(soap, sizeof(*rec));
- memset(rec, 0, sizeof(*rec));
- rec->op = jptype__queryOp__UNEQUAL;
- rec->value = soap_malloc(soap, sizeof(*(rec->value)));
- rec->value->string = soap_strdup(soap, "God");
- rec->value->blob = NULL;
- cond->record[0] = rec;
-
- in.conditions[1] = cond;
-
-
- in.__sizeattributes = 4;
- in.attributes = soap_malloc(soap,
- in.__sizeattributes *
- sizeof(*(in.attributes)));
- in.attributes[0] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/JP/System:owner");
- in.attributes[1] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/JP/System:jobId");
- in.attributes[2] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus");
- in.attributes[3] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:user");
-
- memset(&out, 0, sizeof(out));
-
- check_fault(soap,
- soap_call___jpsrv__QueryJobs(soap, server, "",&in,&out));
-
- for (j=0; j<out.__sizejobs; j++) {
- printf("jobid = %s\n",out.jobs[j]->jobid);
- for (i=0; i<out.jobs[j]->__sizeattributes; i++) {
- printf("\t%s = %s\n",
- out.jobs[j]->attributes[i]->name,
- out.jobs[j]->attributes[i]->value->string);
- }
- }
- }
-
- return 0;
-}
-
-
-static int check_fault(struct soap *soap,int err) {
- struct SOAP_ENV__Detail *detail;
- struct jptype__genericFault *f;
- char *reason,indent[200] = " ";
-
- switch(err) {
- case SOAP_OK: puts("OK");
- break;
- case SOAP_FAULT:
- case SOAP_SVR_FAULT:
- if (soap->version == 2) {
- detail = soap->fault->SOAP_ENV__Detail;
- reason = soap->fault->SOAP_ENV__Reason;
- }
- else {
- detail = soap->fault->detail;
- reason = soap->fault->faultstring;
- }
- fputs(reason,stderr);
- putc('\n',stderr);
- assert(detail->__type == SOAP_TYPE__genericFault);
-#if GSOAP_VERSION >=20700
- f = ((struct _genericFault *) detail->fault)
-#else
- f = ((struct _genericFault *) detail->value)
-#endif
- -> jpelem__genericFault;
-
- while (f) {
- fprintf(stderr,"%s%s: %s (%s)\n",indent,
- f->source,f->text,f->description);
- f = f->reason;
- strcat(indent," ");
- }
- return -1;
-
- default: soap_print_fault(soap,stderr);
- return -1;
- }
- return 0;
-}
-
-
-
-/* XXX: we don't use it */
-SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} };
+++ /dev/null
-#Fri Oct 14 15:22:37 CEST 2005
-module.build=12
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Configuration options for the gLite JP Index module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.4 2005/08/12 10:56:25 mmulac
- void IS server
- - seems compiling
-
- Revision 1.3 2004/12/01 18:45:38 zsalvet
- *** empty log message ***
-
- Revision 1.2 2004/11/22 14:00:37 dimeglio
- Updated to use standard files
- Fixed names (was using common instead of real module name)
-
- Revision 1.1.1.1 2004/10/15 09:49:13 akrenek
--->
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <project name="JP Common configuration options">
- <target name="lbmakefiles">
- <exec executable="ln" failonerror="true">
- <arg line="-fs ${component.dir}/Makefile ${module.build.dir}/Makefile"/>
- </exec>
- <echo file="${module.build.dir}/Makefile.inc">
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-lbprefix=${subsystem.prefix}
-package=${module.package.name}
-PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
-globus_prefix=${with.globus.prefix}
-expat_prefix=${with.expat.prefix}
-gsoap_prefix=${with.gsoap.prefix}
-gsoap_version=${ext.gsoap.version}
-ares_prefix=${with.ares.prefix}
-mysql_prefix=${with.mysql.prefix}
-mysql_version=${ext.mysql.version}
-thrflavour=${with.globus.thr.flavor}
-nothrflavour=${with.globus.nothr.flavor}
-cppunit=${with.cppunit.prefix}
-jpproject=${subsystem.project.dir}
-project=${component.project.dir}
- </echo>
- </target>
- </project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Common build properties file for the gLite JP Index component
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.1.1.1 2004/10/15 09:49:13 akrenek
--->
-
-<project name="JP Index component common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property file="project/build.properties" />
-
- <!-- ======================================================
- Define corresponding subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${jp.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${jp.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define component properties
- ====================================================== -->
-
- <!-- Component name prefix -->
- <property name="component.prefix" value="index" />
-
- <!-- ======================================================
- Define general component properties
- ====================================================== -->
-
- <import file="${component.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
-
-</project>
+++ /dev/null
-tar_exclude
-CVS
-build.xml
-build
-build.properties
-properties.xml
-configure.properties.xml
-.cvsignore
-.project
-.cdtproject
+++ /dev/null
-module.version=1.0.0
-module.age=1
+++ /dev/null
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <unistd.h>
-#include <time.h>
-
-#include <glite/jp/types.h>
-#include <glite/jp/context.h>
-
-#include <glite/lb/srvbones.h>
-#include <glite/security/glite_gss.h>
-
-#include <stdsoap2.h>
-#include <glite/security/glite_gsplugin.h>
-
-#include "conf.h"
-#include "db_ops.h"
-#include "soap_ps_calls.h"
-#include "context.h"
-
-#include "soap_version.h"
-#include "jpis_H.h"
-
-#if GSOAP_VERSION <= 20602
-#define soap_call___jpsrv__FeedIndex soap_call___ns1__FeedIndex
-#define soap_call___jpsrv__FeedIndexRefresh soap_call___ns1__FeedIndexRefresh
-#endif
-
-#define CONN_QUEUE 20
-#define MAX_SLAVES_NUM 20 // max. of slaves to be spawned
-#define USER_QUERY_SLAVES_NUM 2 // # of slaves reserved for user queries if
- // # PS to conntact is << MAX_SLAVES_NUM
-
-#define RECONNECT_TIME 60*20 // when try reconnect to PS in case of error (in sec)
-
-
-extern SOAP_NMAC struct Namespace jpis__namespaces[],jpps__namespaces[];
-extern SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} };
-// namespaces[] not used here, but need to prevent linker to complain...
-
-int newconn(int,struct timeval *,void *);
-int request(int,struct timeval *,void *);
-static int reject(int);
-static int disconn(int,struct timeval *,void *);
-int data_init(void **data);
-
-static struct glite_srvbones_service stab = {
- "JP Index Server", -1, newconn, request, reject, disconn
-};
-
-/*
-typedef struct {
- glite_jpis_context_t ctx;
- glite_jp_is_conf *conf;
- struct soap *soap;
-} slave_data_t;
-*/
-
-static time_t cert_mtime;
-static char *server_cert, *server_key, *cadir;
-static gss_cred_id_t mycred = GSS_C_NO_CREDENTIAL;
-static char *mysubj;
-
-static char *port = GLITE_JPIS_DEFAULT_PORT_STR;
-static int debug = 1;
-
-static glite_jp_context_t ctx;
-static char *glite_jp_default_namespace;
-static glite_jp_is_conf *conf; // Let's make configuration visible to all slaves
-
-
-int main(int argc, char *argv[])
-{
- int one = 1,i;
- edg_wll_GssStatus gss_code;
- struct sockaddr_in a;
- char *config_file;
- glite_jpis_context_t isctx;
-
-
- glite_jp_init_context(&ctx);
-
- /* Read config options/file */
- // XXX: need add something meaningfull to src/conf.c !
- config_file = NULL;
- glite_jp_get_conf(argc, argv, config_file, &conf);
- glite_jpis_init_context(&isctx, ctx, conf);
-
- /* connect to DB */
- if (glite_jpis_init_db(isctx) != 0) {
- fprintf(stderr, "Connect DB failed: %s (%s)\n", ctx->error->desc, ctx->error->source);
- glite_jpis_free_context(isctx);
- glite_jp_free_context(ctx);
- glite_jp_free_conf(conf);
- return 1;
- }
-
- /* XXX preliminary support for plugins
- for (i=0; conf->plugins[i]; i++)
- glite_jp_typeplugin_load(ctx,conf->plugins[i]);
- */
-
-
- if (glite_jpis_dropDatabase(isctx) != 0) {
- fprintf(stderr, "Drop DB failed: %s (%s)\n", ctx->error->desc, ctx->error->source);
- glite_jpis_free_db(isctx);
- glite_jpis_free_context(isctx);
- glite_jp_free_context(ctx);
- glite_jp_free_conf(conf);
- return 1;
- }
-
- if (glite_jpis_initDatabase(isctx) != 0) {
- fprintf(stderr, "Init DB failed: %s (%s)\n", ctx->error->desc, ctx->error->source);
- glite_jpis_free_db(isctx);
- glite_jpis_free_context(isctx);
- glite_jp_free_context(ctx);
- glite_jp_free_conf(conf);
- return 1;
- }
-
-
-#if GSOAP_VERSION <= 20602
- for (i=0; jpis__namespaces[i].id && strcmp(jpis__namespaces[i].id,"ns1"); i++);
-#else
- for (i=0; jpis__namespaces[i].id && strcmp(jpis__namespaces[i].id,"jpsrv"); i++);
-#endif
- assert(jpis__namespaces[i].id);
- glite_jp_default_namespace = jpis__namespaces[i].ns;
-
- stab.conn = socket(PF_INET, SOCK_STREAM, 0);
- if (stab.conn < 0) {
- perror("socket");
- return 1;
- }
-
- setsockopt(stab.conn,SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
-
- if (conf->port) port = conf->port;
- a.sin_family = AF_INET;
- a.sin_addr.s_addr = INADDR_ANY;
- a.sin_port = htons(atoi(port));
- if (bind(stab.conn,(struct sockaddr *) &a, sizeof(a)) ) {
- char buf[200];
-
- snprintf(buf,sizeof(buf),"bind(%d)",atoi(port));
- perror(buf);
- return 1;
- }
-
- if (listen(stab.conn,CONN_QUEUE)) {
- perror("listen()");
- return 1;
- }
-
- if (!server_cert || !server_key)
- fprintf(stderr, "%s: WARNING: key or certificate file not specified, "
- "can't watch them for changes\n",
- argv[0]);
-
- if ( cadir ) setenv("X509_CERT_DIR", cadir, 1);
- edg_wll_gss_watch_creds(server_cert, &cert_mtime);
-
- if ( !edg_wll_gss_acquire_cred_gsi(server_cert, server_key, &mycred, &mysubj, &gss_code))
- fprintf(stderr,"Server idenity: %s\n",mysubj);
- else fputs("WARNING: Running unauthenticated\n",stderr);
-
- /* daemonise */
-
- /* XXX: uncomment after testing phase
- for (i=0; conf->PS_list[i]; i++); // count PS we need to contact
- i += USER_QUERY_SLAVES_NUM; // add some slaves for user queries
- if (i > MAX_SLAVES_NUM)
- glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT, MAX_SLAVES_NUM);
- else
- glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT, i);
- */
- /* for dbg - one slave OK */ glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT,1);
- glite_srvbones_run(data_init,&stab,1 /* XXX: entries in stab */,debug);
-
-
- glite_jpis_free_db(isctx);
- glite_jp_free_conf(conf);
- glite_jpis_free_context(isctx);
- glite_jp_free_context(ctx);
-
- return 0;
-}
-
-/* slave's init comes here */
-int data_init(void **data)
-{
- slave_data_t *private;
- long int uniqueid;
- char *PS_URL = NULL;
-
- private = calloc(sizeof(*private), 1);
- glite_jpis_init_context(&private->ctx, ctx, conf);
- if (glite_jpis_init_db(private->ctx) != 0) {
- printf("[%d] slave_init(): DB error: %s (%s)\n",getpid(),ctx->error->desc,ctx->error->source);
- return -1;
- }
-
- private->soap = soap_new();
- printf("[%d] slave started\n",getpid());
-
- /* ask PS server for data */
- do {
- switch (glite_jpis_lockUninitializedFeed(private->ctx,&uniqueid,&PS_URL)) {
- case 0:
- // contact PS server, ask for data, save feedId and expiration
- // to DB and unlock feed
- if (MyFeedIndex(private->ctx, conf, uniqueid, PS_URL) != 0) {
- printf("[%d] slave_init(): %s (%s), reconnecting later\n", getpid(), ctx->error->desc, ctx->error->source);
- // error when connecting to PS
- glite_jpis_tryReconnectFeed(private->ctx, uniqueid,
- time(NULL) + RECONNECT_TIME);
- }
- free(PS_URL);
- PS_URL = NULL;
- break;
- case ENOENT:
- // no more feeds to initialize
- *data = (void *) private;
- return 0;
- default:
- // error during locking
- printf("[%d] slave_init(): Locking error.\n",getpid());
- free(PS_URL);
- glite_jpis_free_db(private->ctx);
- glite_jpis_free_context(private->ctx);
- return -1;
- }
- } while (1);
-}
-
-int newconn(int conn,struct timeval *to,void *data)
-{
- slave_data_t *private = (slave_data_t *)data;
- struct soap *soap = private->soap;
- glite_jp_context_t ctx = private->ctx->jpctx;
- glite_gsplugin_Context plugin_ctx;
-
- gss_cred_id_t newcred = GSS_C_NO_CREDENTIAL;
- edg_wll_GssStatus gss_code;
- gss_name_t client_name = GSS_C_NO_NAME;
- gss_buffer_desc token = GSS_C_EMPTY_BUFFER;
- OM_uint32 maj_stat,min_stat;
- int ret = 0;
-
-
- soap_init2(soap,SOAP_IO_KEEPALIVE,SOAP_IO_KEEPALIVE);
- soap_set_namespaces(soap,jpis__namespaces);
- soap->user = (void *) private;
-
- glite_gsplugin_init_context(&plugin_ctx);
- plugin_ctx->connection = calloc(1,sizeof *plugin_ctx->connection);
-
- switch (edg_wll_gss_watch_creds(server_cert,&cert_mtime)) {
- case 0: break;
- case 1: if (!edg_wll_gss_acquire_cred_gsi(server_cert,server_key,
- &newcred,NULL,&gss_code))
- {
-
- printf("[%d] reloading credentials\n",getpid()); /* XXX: log */
- gss_release_cred(&min_stat,&mycred);
- mycred = newcred;
- }
- break;
- case -1:
- printf("[%d] edg_wll_gss_watch_creds failed\n", getpid()); /* XXX: log */
- break;
- }
-
- /* TODO: DNS paranoia etc. */
-
- if (edg_wll_gss_accept(mycred,conn,to,plugin_ctx->connection,&gss_code)) {
- char *et;
-
- edg_wll_gss_get_error(&gss_code,"",&et);
-
- fprintf(stderr,"[%d] GSS connection accept failed: %s\nClosing connection.\n",getpid(),et);
- free(et);
- ret = 1;
- goto cleanup;
- }
-
- maj_stat = gss_inquire_context(&min_stat,plugin_ctx->connection->context,
- &client_name, NULL, NULL, NULL, NULL, NULL, NULL);
-
- if (!GSS_ERROR(maj_stat))
- maj_stat = gss_display_name(&min_stat,client_name,&token,NULL);
-
- if (ctx->peer) free(ctx->peer);
- if (!GSS_ERROR(maj_stat)) {
- printf("[%d] client DN: %s\n",getpid(),(char *) token.value); /* XXX: log */
-
- ctx->peer = strdup(token.value);
- memset(&token, 0, sizeof(token));
- }
- else {
- printf("[%d] annonymous client\n",getpid());
- ctx->peer = NULL;
- }
-
- if (client_name != GSS_C_NO_NAME) gss_release_name(&min_stat, &client_name);
- if (token.value) gss_release_buffer(&min_stat, &token);
-
- soap_register_plugin_arg(soap,glite_gsplugin,plugin_ctx);
-
- return 0;
-
-cleanup:
-/*
- - done in disconnect
- glite_jpis_free_db(private->ctx);
- glite_jpis_free_context(private->ctx);
-*/
- glite_gsplugin_free_context(plugin_ctx);
- soap_end(soap);
-
- return ret;
-}
-
-int request(int conn,struct timeval *to,void *data)
-{
- slave_data_t *private = (slave_data_t *)data;
- struct soap *soap = private->soap;
- glite_jp_context_t ctx = private->ctx->jpctx;
-
- glite_gsplugin_set_timeout(glite_gsplugin_get_context(soap),to);
-
- soap->max_keep_alive = 1; /* XXX: prevent gsoap to close connection */
- soap_begin(soap);
- if (soap_begin_recv(soap)) {
- if (soap->error < SOAP_STOP) {
- soap_send_fault(soap);
- return EIO;
- }
- return ENOTCONN;
- }
-
- soap->keep_alive = 1;
- if (soap_envelope_begin_in(soap)
- || soap_recv_header(soap)
- || soap_body_begin_in(soap)
- || jpis__serve_request(soap)
-#if GSOAP_VERSION >= 20700
- || (soap->fserveloop && soap->fserveloop(soap))
-#endif
- )
- {
- soap_send_fault(soap);
- if (ctx->error) {
- /* XXX: shall we die on some errors? */
- int err = ctx->error->code;
- glite_jp_clear_error(ctx);
- return err;
- }
- return 0;
- }
-
- glite_jp_run_deferred(ctx);
- return 0;
-}
-
-static int reject(int conn)
-{
- int flags = fcntl(conn, F_GETFL, 0);
-
- fcntl(conn,F_SETFL,flags | O_NONBLOCK);
- edg_wll_gss_reject(conn);
-
- return 0;
-}
-
-static int disconn(int conn,struct timeval *to,void *data)
-{
- slave_data_t *private = (slave_data_t *)data;
- struct soap *soap = private->soap;
-
- glite_jpis_free_db(private->ctx);
- glite_jpis_free_context(private->ctx);
- soap_end(soap); // clean up everything and close socket
-
- return 0;
-}
-
-
+++ /dev/null
-/* Module for obtaining configuration for Index Server */
-
-#ident "$Header$"
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <glite/jp/types.h>
-#include <glite/jp/context.h>
-#include "conf.h"
-
-
-int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf **configuration)
-{
- char *ps = NULL;
-
- // read comman line options and configuration file
- // XXX: use EGEE global configure tools in future...
-
- glite_jp_is_conf *conf;
-
-
- conf = calloc(1, sizeof(*conf));
-
- // configuration from environment
- conf->cs = getenv("GLITE_JPIS_DB");
- conf->port = getenv("GLITE_JPIS_PORT");
-
- // prefixes & attributes defined in:
- // lb.server/build/jp_job_attrs.h (created when build plugin)
- // jp.common/interfaces/known_attr.h
-
- conf->attrs = calloc(19, sizeof(*conf->attrs));
- conf->attrs[0] = strdup("http://egee.cesnet.cz/en/Schema/JP/System:owner");
- conf->attrs[1] = strdup("http://egee.cesnet.cz/en/Schema/JP/System:jobId");
- conf->attrs[2] = strdup("http://egee.cesnet.cz/en/Schema/JP/System::regtime");
- conf->attrs[3] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:user");
- conf->attrs[4] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:aTag");
- conf->attrs[5] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:eNodes");
- conf->attrs[6] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:RB");
- conf->attrs[7] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:CE");
- conf->attrs[8] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:UIHost");
- conf->attrs[9] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:CPUTime");
- conf->attrs[10] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:NProc");
- conf->attrs[11] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus");
- conf->attrs[12] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusDate");
- conf->attrs[13] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:retryCount");
- conf->attrs[14] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:jobType");
- conf->attrs[15] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:nsubjobs");
- conf->attrs[16] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:lastStatusHistory");
- conf->attrs[17] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:fullStatusHistory");
-
- conf->indexed_attrs = calloc(8, sizeof(*conf->indexed_attrs));
- conf->indexed_attrs[0] = strdup("http://egee.cesnet.cz/en/Schema/JP/System:owner");
- conf->indexed_attrs[1] = strdup("http://egee.cesnet.cz/en/Schema/JP/System:jobId");
- conf->indexed_attrs[2] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:user");
- conf->indexed_attrs[3] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus");
- conf->indexed_attrs[4] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:UIHost");
- conf->indexed_attrs[5] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:CE");
- conf->indexed_attrs[6] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:RB");
-
- // XXX: some plugin names should come here in future
- conf->plugins = NULL;
-
-// ps = "http://umbar.ics.muni.cz:8901";
- if (!ps && ((ps = getenv("GLITE_JPIS_PS")) == NULL)) {
- printf("No JP PrimaryStrorage server specified in $GLITE_JPIS_PS, default feeds skipped.\n");
- conf->feeds = calloc(1, sizeof(*(conf->feeds)));
- *configuration = conf;
- return 0;
- }
-
- /* ask for one feed */
- conf->feeds = calloc(2, sizeof(*(conf->feeds)));
-
- conf->feeds[0] = calloc(1, sizeof(**(conf->feeds)));
- conf->feeds[0]->PS_URL = strdup(ps);
-
- // all job since Epoche
- conf->feeds[0]->query = calloc(2,sizeof(*conf->feeds[0]->query));
- conf->feeds[0]->query[0] = calloc(2,sizeof(**conf->feeds[0]->query));
- conf->feeds[0]->query[0][0].attr = strdup("http://egee.cesnet.cz/en/Schema/JP/System:regtime");
- conf->feeds[0]->query[0][0].op = GLITE_JP_QUERYOP_GREATER;
- conf->feeds[0]->query[0][0].value = strdup("0");
-
- conf->feeds[0]->history = 1;
- conf->feeds[0]->continuous = 0;
-
- conf->feeds[1] = NULL;
-
- *configuration = conf;
-
- return 0;
-}
-
-
-void glite_jp_free_conf(glite_jp_is_conf *conf)
-{
- size_t i, j, k;
- glite_jp_is_feed *feed;
-
- if (!conf) return;
-
- if (conf->attrs) for (i = 0; conf->attrs[i]; i++) free(conf->attrs[i]);
- if (conf->indexed_attrs) for (i = 0; conf->indexed_attrs[i]; i++) free(conf->indexed_attrs[i]);
- if (conf->plugins) for (i = 0; conf->plugins[i]; i++) free(conf->plugins[i]);
- if (conf->feeds) for (i = 0; conf->feeds[i]; i++) {
- feed = conf->feeds[i];
- free(feed->PS_URL);
- for (j = 0; feed->query[j]; j++) {
- for (k = 0; feed->query[j][k].attr; k++) glite_jp_free_query_rec(&feed->query[j][k]);
- free(feed->query[j]);
- }
- free(feed->query);
- free(feed);
- }
- free(conf->attrs);
- free(conf->indexed_attrs);
- free(conf->plugins);
- free(conf->feeds);
- free(conf);
-}
+++ /dev/null
-#ident "$Header$"
-
-#ifndef _CONF_H
-#define _CONF_H
-
-
-#include <glite/jp/types.h>
-
-#define GLITE_JPIS_DEFAULT_PORT_STR "8902"
-
-//#define lprintf
-#define lprintf printf
-
-typedef struct _glite_jp_is_feed {
- char *PS_URL; //URLs of Primary Storage servers
- glite_jp_query_rec_t **query; // query to Primary Server (aka filter)
- int history, // type of query
- continuous;
-} glite_jp_is_feed;
-
-
-typedef struct _glite_jp_is_conf {
- // all I need to get from comman line options and configuration file
-
- // arrays are zero-terminated
- char **attrs; // atributes to obtain
- char **indexed_attrs; // list of indexed atributes
- char **plugins; // list of plugin.so's
-
- glite_jp_is_feed **feeds; // null terminated list of feeds
-
- char *cs, *port;
-} glite_jp_is_conf;
-
-
-
-// read commad line options and configuration file
-int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf **configuration);
-void glite_jp_free_conf(glite_jp_is_conf *conf);
-
-#endif
+++ /dev/null
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-
-#include <globus_common.h>
-
-#include "conf.h"
-#include "context.h"
-
-
-int glite_jpis_init_context(glite_jpis_context_t *isctx, glite_jp_context_t jpctx, glite_jp_is_conf *conf) {
- char hname[512];
-
- if ((*isctx = calloc(sizeof(**isctx), 1)) != NULL) {
- (*isctx)->jpctx = jpctx;
- (*isctx)->conf = conf;
- globus_libc_gethostname(hname, sizeof hname);
- asprintf(&(*isctx)->hname, "https://%s:%s", hname, (conf && conf->port) ? conf->port : GLITE_JPIS_DEFAULT_PORT_STR);
- return 0;
- } else return ENOMEM;
-}
-
-
-void glite_jpis_free_context(glite_jpis_context_t ctx) {
- free(ctx->hname);
- free(ctx);
-}
+++ /dev/null
-#ifndef GLITE_JP_IS_CONTEXT_H
-#define GLITE_JP_IS_CONTEXT_H
-
-#include <glite/jp/types.h>
-#include <glite/jp/context.h>
-#include <glite/jp/db.h>
-#include "conf.h"
-
-
-typedef struct _glite_jpis_context {
- glite_jp_context_t jpctx;
- glite_jp_is_conf *conf;
- glite_jp_db_stmt_t select_unlocked_feed_stmt, lock_feed_stmt, init_feed_stmt, unlock_feed_stmt, select_info_feed_stmt, update_state_feed_stmt, update_error_feed_stmt, select_info_attrs_indexed, select_jobid_stmt, select_user_stmt, insert_job_stmt, insert_user_stmt;
- long int param_uniqueid, param_state;
- char param_feedid[33], param_ps[256], param_indexed[256], param_jobid[33], param_dg_jobid[256], param_ownerid[33], param_cert[256];
- unsigned long param_ps_len, param_feedid_len, param_indexed_len, param_jobid_len, param_dg_jobid_len, param_ownerid_len, param_cert_len;
- void *param_expires;
-
- char *hname;
-} *glite_jpis_context_t;
-
-typedef struct _slave_data_t{
- glite_jpis_context_t ctx;
- glite_jp_is_conf *conf;
- struct soap *soap;
-} slave_data_t;
-
-int glite_jpis_init_context(glite_jpis_context_t *isctx, glite_jp_context_t jpctx, glite_jp_is_conf *conf);
-void glite_jpis_free_context(glite_jpis_context_t ctx);
-#endif
+++ /dev/null
-#ident "$Header$"
-
-#include <time.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
-
-#include <glite/jp/types.h>
-#include <glite/jp/context.h>
-#include <glite/jp/db.h>
-#include <glite/jp/attr.h>
-#include <glite/jp/strmd5.h>
-
-#include "conf.h"
-#include "context.h"
-#include "db_ops.h"
-
-
-#define TABLE_PREFIX_DATA "attr_"
-#define SQLCMD_DROP_DATA_TABLE "DROP TABLE " TABLE_PREFIX_DATA "%s"
-#define SQLCMD_CREATE_DATA_TABLE "CREATE TABLE " TABLE_PREFIX_DATA "%s (\n\
- jobid CHAR(32) BINARY NOT NULL,\n\
- value %s BINARY NOT NULL,\n\
- full_value %s NOT NULL,\n\
-\n\
- INDEX (jobid),\n\
- INDEX (value)\n\
-);"
-#define SQLCMD_INSERT_ATTRVAL "INSERT INTO " TABLE_PREFIX_DATA "%s (jobid, value, full_value) VALUES (\n\
- '%s',\n\
- '%s',\n\
- '%s'\n\
-)"
-#define INDEX_LENGTH 255
-
-#define WORD_SWAP(X) ((((X) >> 8) & 0xFF) | (((X) & 0xFF) << 8))
-#define LONG_SWAP(X) (WORD_SWAP(((X) >> 16) & 0xFFFF) | ((WORD_SWAP(X) & 0xFFFF) << 16))
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define LONG_LE(X) (X)
-#else
-#define LONG_LE(X) LONG_SWAP(X)
-#endif
-
-#define COND_MAGIC 0x444E4F43
-
-static int is_indexed(glite_jp_is_conf *conf, const char *attr) {
- size_t i;
-
- i = 0;
- while (conf->indexed_attrs[i]) {
- if (strcasecmp(attr, conf->indexed_attrs[i]) == 0) return 1;
- i++;
- }
- return 0;
-}
-
-
-static size_t db_arg2_length(glite_jp_query_rec_t *query) {
- size_t len;
-
- assert(query->op > GLITE_JP_QUERYOP_UNDEF && query->op <= GLITE_JP_QUERYOP__LAST);
- len = 0;
- switch (query->op) {
- case GLITE_JP_QUERYOP_WITHIN:
- len = query->binary ? query->size2 : strlen(query->value2) + 1;
- case GLITE_JP_QUERYOP_UNDEF:
- case GLITE_JP_QUERYOP_EQUAL:
- case GLITE_JP_QUERYOP_UNEQUAL:
- case GLITE_JP_QUERYOP_LESS:
- case GLITE_JP_QUERYOP_GREATER:
- case GLITE_JP_QUERYOP_EXISTS:
- case GLITE_JP_QUERYOP__LAST:
- len = 0;
- }
-
- return len;
-}
-
-
-static int array_init(void **data, size_t *len, size_t *maxlen, size_t initial_len) {
- *len = 0;
- if ((*data = malloc(initial_len)) != NULL) {
- *maxlen = initial_len;
- return 0;
- } else {
- *maxlen = 0;
- return ENOMEM;
- }
-}
-
-
-static int array_add(void **data, size_t *len, size_t *maxlen, void *new_data, size_t new_data_len) {
- void *tmp;
- size_t ptr;
-
- ptr = *len;
- (*len) += new_data_len;
- if (*len > *maxlen) {
- do {
- (*maxlen) *= 2;
- } while (*len > *maxlen);
- if ((tmp = realloc(*data, *maxlen)) == NULL) return ENOMEM;
- *data = tmp;
- }
- memcpy(((char *)(*data)) + ptr, new_data, new_data_len);
-
- return 0;
-}
-
-
-static int array_add_long(void **data, size_t *len, size_t *maxlen, uint32_t l) {
- uint32_t lel;
-
- lel = LONG_LE(l);
- return array_add(data, len, maxlen, &lel, sizeof(uint32_t));
-}
-
-
-static uint32_t array_get_long(void **data) {
- uint32_t *lel;
-
- lel = (uint32_t *)*data;
- *data = ((char *)*data) + sizeof(uint32_t);
-
- return LONG_LE(*lel);
-}
-
-
-static void *array_get(void **data, size_t data_len) {
- void *res;
-
- res = *data;
- *data = ((char *)*data) + data_len;
-
- return res;
-}
-
-
-static int glite_jpis_db_queries_serialize(void **blob, size_t *len, glite_jp_query_rec_t **queries) {
- size_t maxlen;
- glite_jp_query_rec_t *query;
- int ret;
- size_t datalen;
-
- if ((ret = array_init(blob, len, &maxlen, 1024)) != 0) return ret;
- query = *queries;
- while(query && query->attr) {
- if ((ret = array_add_long(blob, len, &maxlen, COND_MAGIC)) != 0) goto fail;
- datalen = strlen(query->attr) + 1;
- if ((ret = array_add_long(blob, len, &maxlen, datalen)) != 0) goto fail;
- if ((ret = array_add(blob, len, &maxlen, query->attr, datalen)) != 0) goto fail;
- if ((ret = array_add_long(blob, len, &maxlen, query->op)) != 0) goto fail;
- if ((ret = array_add_long(blob, len, &maxlen, query->binary ? 1 : 0)) != 0) goto fail;
-
- datalen = query->binary ? query->size : strlen(query->value) + 1;
- if ((ret = array_add_long(blob, len, &maxlen, datalen)) != 0) goto fail;
- if (datalen)
- if ((ret = array_add(blob, len, &maxlen, query->value, datalen)) != 0) goto fail;
-
- datalen = db_arg2_length(query);
- if ((ret = array_add_long(blob, len, &maxlen, datalen)) != 0) goto fail;
- if (datalen)
- if ((ret = array_add(blob, len, &maxlen, query->value2, datalen)) != 0) goto fail;
-
- query++;
- }
-
- return 0;
-fail:
- free(*blob);
- *len = 0;
- return ret;
-}
-
-
-static int glite_jpis_db_queries_deserialize(glite_jp_query_rec_t ***queries, void *blob, size_t blob_size) {
- size_t maxlen, len, datalen;
- void *blob_ptr, *blob_end;
- int ret;
- uint32_t l;
- glite_jp_query_rec_t *query;
- int i;
-
- if ((ret = array_init((void **)queries, &len, &maxlen, 512)) != 0) return ret;
- blob_ptr = blob;
- blob_end = (char *)blob + blob_size;
- while (blob_end > blob_ptr) {
- ret = ENOMEM;
- if ((query = calloc(sizeof(*query), 1)) == NULL) goto fail;
- l = array_get_long(&blob_ptr);
- if (l != COND_MAGIC) {
- lprintf("blob=%p, blob_ptr=%p, 0x%08" PRIX32 "\n", blob, blob_ptr, l);
- ret = EINVAL;
- goto fail_query;
- }
-
- datalen = array_get_long(&blob_ptr);
- if (datalen) {
- if ((query->attr = malloc(datalen)) == NULL) goto fail_query;
- memcpy(query->attr, array_get(&blob_ptr, datalen), datalen);
- } else query->attr = NULL;
-
- query->op = array_get_long(&blob_ptr);
- query->binary = array_get_long(&blob_ptr);
-
- datalen = array_get_long(&blob_ptr);
- if (datalen) {
- if ((query->value = malloc(datalen)) == NULL) goto fail_query;
- memcpy(query->value, array_get(&blob_ptr, datalen), datalen);
- } else query->value = NULL;
- query->size = datalen;
-
- datalen = array_get_long(&blob_ptr);
- if (datalen) {
- if ((query->value2 = malloc(datalen)) == NULL) goto fail_query;
- memcpy(query->value2, array_get(&blob_ptr, datalen), datalen);
- } else query->value2 = NULL;
- query->size2 = datalen;
-
- if ((ret = array_add((void **)queries, &len, &maxlen, &query, sizeof(query))) != 0) goto fail_query;
- }
- assert(blob_end == blob_ptr);
-
- query = NULL;
- if ((ret = array_add((void **)queries, &len, &maxlen, &query, sizeof(query))) != 0) goto fail;
-
- return 0;
-
-fail_query:
- free(query);
-fail:
- i = 0;
- query = (*queries)[i];
- while (query && query->attr) {
- free(query->attr);
- free(query->value);
- free(query->value2);
- free(query);
- i++;
- query = (*queries)[i];
- }
- free(*queries);
- return ret;
-}
-
-
-/**
- * Convert attribute name to attribute id.
- */
-char *glite_jpis_attr_name2id(const char *name) {
- return str2md5(name);
-}
-
-
-/* Init the database.
- *
- * \retval 0 OK
- * \retval non-zero JP error code
- */
-
-int glite_jpis_initDatabase(glite_jpis_context_t ctx) {
- char **attrs, *tmp;
- const char *type_index, *type_full;
- size_t i;
- void *param;
- unsigned long attrid_len, name_len, type_len, source_len, dbconds_len;
- char attrid[33], name[256], type[33], source[256], dbconds[1024];
- int indexed, state, locked;
- size_t conds_len;
- char sql[512];
- glite_jp_is_feed **feeds;
- void *conds;
- glite_jp_context_t jpctx = ctx->jpctx;
- glite_jp_db_stmt_t stmt = NULL;
-
- jpctx = ctx->jpctx;
- glite_jp_db_create_params(¶m, 4,
- GLITE_JP_DB_TYPE_VARCHAR, attrid, &attrid_len,
- GLITE_JP_DB_TYPE_VARCHAR, name, &name_len,
- GLITE_JP_DB_TYPE_INT, &indexed,
- GLITE_JP_DB_TYPE_VARCHAR, type, &type_len);
- if (glite_jp_db_prepare(jpctx, "INSERT INTO attrs (attrid, name, indexed, type) VALUES (?, ?, ?, ?)", &stmt, param, NULL) != 0) goto fail;
-
- // attrs table and attrid_* tables
- attrs = ctx->conf->attrs;
- i = 0;
- while (attrs[i]) {
- type_full = glite_jp_attrval_db_type_full(jpctx, attrs[i]);
- type_index = glite_jp_attrval_db_type_index(jpctx, attrs[i], INDEX_LENGTH);
-
- // attrid column
- tmp = glite_jpis_attr_name2id(attrs[i]);
- GLITE_JPIS_PARAM(attrid, attrid_len, tmp);
- free(tmp);
- GLITE_JPIS_PARAM(name, name_len, attrs[i]);
- // indexed column
- indexed = is_indexed(ctx->conf, name);
- // type column
- GLITE_JPIS_PARAM(type, type_len, type_full);
- // insert
- if (glite_jp_db_execute(stmt) == -1) goto fail;
-
- snprintf(sql, sizeof(sql), SQLCMD_CREATE_DATA_TABLE, attrid, type_index, type_full);
- lprintf("creating table: '%s'\n", sql);
- if ((glite_jp_db_execstmt(jpctx, sql, NULL)) == -1) goto fail;
-
- i++;
- }
- glite_jp_db_freestmt(&stmt);
-
- // feeds table
- glite_jp_db_create_params(¶m, 4,
- GLITE_JP_DB_TYPE_INT, &state,
- GLITE_JP_DB_TYPE_INT, &locked,
- GLITE_JP_DB_TYPE_VARCHAR, source, &source_len,
- GLITE_JP_DB_TYPE_MEDIUMBLOB, dbconds, &dbconds_len);
- if (glite_jp_db_prepare(jpctx, "INSERT INTO feeds (state, locked, source, condition) VALUES (?, ?, ?, ?)", &stmt, param, NULL) != 0) goto fail;
- feeds = ctx->conf->feeds;
- i = 0;
- while (feeds[i]) {
- state = (feeds[i]->history ? GLITE_JP_IS_STATE_HIST : 0) |
- (feeds[i]->continuous ? GLITE_JP_IS_STATE_CONT : 0);
- locked = 0;
- GLITE_JPIS_PARAM(source, source_len, feeds[i]->PS_URL);
- assert(glite_jpis_db_queries_serialize(&conds, &conds_len, feeds[i]->query) == 0);
- assert(conds_len <= sizeof(dbconds));
- dbconds_len = conds_len;
- memcpy(dbconds, conds, conds_len);
- free(conds);
- if (glite_jp_db_execute(stmt) == -1) goto fail_conds;
-
- i++;
- }
- glite_jp_db_freestmt(&stmt);
-
- return 0;
-
-fail_conds:
- free(conds);
-fail:
- glite_jp_db_freestmt(&stmt);
- return jpctx->error->code;
-}
-
-
-/* Drop the whole database.
- *
- * \retval 0 OK
- * \retval non-zero JP error code
- */
-
-int glite_jpis_dropDatabase(glite_jpis_context_t ctx) {
- void *res;
- char attrid[33], sql[256];
- unsigned long len;
- int ret;
- glite_jp_context_t jpctx = ctx->jpctx;
- glite_jp_db_stmt_t stmt_tabs = NULL;
-
- // search data tables and drop them
- glite_jp_db_create_results(&res, 1, GLITE_JP_DB_TYPE_CHAR, NULL, attrid, sizeof(attrid), &len);
- if (glite_jp_db_prepare(jpctx, "SELECT attrid FROM attrs", &stmt_tabs, NULL, res) != 0) goto fail;
- if (glite_jp_db_execute(stmt_tabs) == -1) goto fail;
- while ((ret = glite_jp_db_fetch(stmt_tabs)) == 0) {
- snprintf(sql, sizeof(sql), SQLCMD_DROP_DATA_TABLE, attrid);
- lprintf("dropping '%s' ==> '%s'\n", attrid, sql);
- if (glite_jp_db_execstmt(jpctx, sql, NULL) == -1) printf("warning: can't drop table '" TABLE_PREFIX_DATA "%s': %s (%s)\n", attrid, jpctx->error->desc, jpctx->error->source);
- }
- if (ret != ENODATA) goto fail;
- glite_jp_db_freestmt(&stmt_tabs);
-
- // drop feeds and atributes
- if (glite_jp_db_execstmt(jpctx, "DELETE FROM attrs", NULL) == -1) goto fail;
- if (glite_jp_db_execstmt(jpctx, "DELETE FROM feeds", NULL) == -1) goto fail;
- if (glite_jp_db_execstmt(jpctx, "DELETE FROM jobs", NULL) == -1) goto fail;
- if (glite_jp_db_execstmt(jpctx, "DELETE FROM users", NULL) == -1) goto fail;
- if (glite_jp_db_execstmt(jpctx, "DELETE FROM acls", NULL) == -1) goto fail;
-
- return 0;
-
-fail:
- glite_jp_db_freestmt(&stmt_tabs);
- return jpctx->error->code;
-}
-
-
-int glite_jpis_init_db(glite_jpis_context_t isctx) {
- int ret;
- void *myparam;
- void *myres;
- const char *cs;
- glite_jp_context_t jpctx;
-
- jpctx = isctx->jpctx;
- if ((cs = isctx->conf->cs) == NULL) cs = GLITE_JP_IS_DEFAULTCS;
- if ((ret = glite_jp_db_connect(jpctx, cs)) != 0) goto fail;
-
- // sql command: select an uninitialized unlocked feed
- glite_jp_db_create_params(&myparam, 1, GLITE_JP_DB_TYPE_DATETIME, &isctx->param_expires);
- glite_jp_db_create_results(&myres, 2,
- GLITE_JP_DB_TYPE_INT, NULL, &(isctx->param_uniqueid),
- GLITE_JP_DB_TYPE_VARCHAR, NULL, isctx->param_ps, sizeof(isctx->param_ps), &isctx->param_ps_len);
- if ((ret = glite_jp_db_prepare(jpctx, "SELECT uniqueid, source FROM feeds WHERE (locked=0) AND (feedid IS NULL) AND ((state <> " GLITE_JP_IS_STATE_ERROR_STR ") OR (expires <= ?))", &isctx->select_unlocked_feed_stmt, myparam, myres)) != 0) goto fail;
-
- // sql command: lock the feed (via uniqueid)
- glite_jp_db_create_params(&myparam, 1, GLITE_JP_DB_TYPE_INT, &isctx->param_uniqueid);
- if ((ret = glite_jp_db_prepare(jpctx, "UPDATE feeds SET locked=1 WHERE (locked = 0) AND (uniqueid = ?)", &isctx->lock_feed_stmt, myparam, NULL)) != 0) goto fail;
-
- // sql command: assign the feed (via uniqueid)
- glite_jp_db_create_params(&myparam, 3,
- GLITE_JP_DB_TYPE_CHAR, isctx->param_feedid, &isctx->param_feedid_len,
- GLITE_JP_DB_TYPE_DATETIME, &isctx->param_expires,
- GLITE_JP_DB_TYPE_INT, &isctx->param_uniqueid);
- if ((ret = glite_jp_db_prepare(jpctx, "UPDATE feeds SET feedid=?, expires=? WHERE (uniqueid=?)", &isctx->init_feed_stmt, myparam, NULL)) != 0) goto fail;
-
- // sql command: unlock the feed (via uniqueid)
- glite_jp_db_create_params(&myparam, 1, GLITE_JP_DB_TYPE_INT, &isctx->param_uniqueid);
- if ((ret = glite_jp_db_prepare(jpctx, "UPDATE feeds SET locked=0 WHERE (uniqueid=?)", &isctx->unlock_feed_stmt, myparam, NULL)) != 0) goto fail;
-
- // sql command: get info about the feed (via feedid)
- glite_jp_db_create_params(&myparam, 1, GLITE_JP_DB_TYPE_CHAR, isctx->param_feedid, &isctx->param_feedid_len);
- glite_jp_db_create_results(&myres, 2,
- GLITE_JP_DB_TYPE_INT, NULL, &isctx->param_uniqueid,
- GLITE_JP_DB_TYPE_INT, NULL, &isctx->param_state);
- if ((ret = glite_jp_db_prepare(jpctx, "SELECT uniqueid, state FROM feeds WHERE (feedid=?)", &isctx->select_info_feed_stmt, myparam, myres)) != 0) goto fail;
-
- // sql command: update state of the feed (via uniqueid)
- glite_jp_db_create_params(&myparam, 2,
- GLITE_JP_DB_TYPE_INT, &isctx->param_state,
- GLITE_JP_DB_TYPE_INT, &isctx->param_uniqueid);
- if ((ret = glite_jp_db_prepare(jpctx, "UPDATE feeds SET state=? WHERE (uniqueid=?)", &isctx->update_state_feed_stmt, myparam, NULL)) != 0) goto fail;
-
- // sql command: set the error on feed
- glite_jp_db_create_params(&myparam, 3,
- GLITE_JP_DB_TYPE_INT, &isctx->param_state,
- GLITE_JP_DB_TYPE_DATETIME, &isctx->param_expires,
- GLITE_JP_DB_TYPE_INT, &isctx->param_uniqueid);
- if ((ret = glite_jp_db_prepare(jpctx, "UPDATE feeds SET state=?, expires=? WHERE (uniqueid=?)", &isctx->update_error_feed_stmt, myparam, NULL)) != 0) goto fail;
-
- // sql command: get info about indexed attributes
- glite_jp_db_create_results(&myres, 1,
- GLITE_JP_DB_TYPE_VARCHAR, NULL, isctx->param_indexed, sizeof(isctx->param_indexed), &isctx->param_indexed_len);
- if ((ret = glite_jp_db_prepare(jpctx, "SELECT name FROM attrs WHERE (indexed=1)", &isctx->select_info_attrs_indexed, NULL, myres)) != 0) goto fail;
-
- // sql command: check for job with jobid
- glite_jp_db_create_params(&myparam, 1,
- GLITE_JP_DB_TYPE_CHAR, isctx->param_jobid, &isctx->param_jobid_len);
- if ((glite_jp_db_prepare(jpctx, "SELECT jobid FROM jobs WHERE jobid=?", &isctx->select_jobid_stmt, myparam, NULL)) != 0) goto fail;
-
- // sql command: insert the job
- glite_jp_db_create_params(&myparam, 4,
- GLITE_JP_DB_TYPE_CHAR, isctx->param_jobid, &isctx->param_jobid_len,
- GLITE_JP_DB_TYPE_VARCHAR, isctx->param_dg_jobid, &isctx->param_dg_jobid_len,
- GLITE_JP_DB_TYPE_CHAR, isctx->param_ownerid, &isctx->param_ownerid_len,
- GLITE_JP_DB_TYPE_CHAR, isctx->param_feedid, &isctx->param_feedid_len);
- if ((glite_jp_db_prepare(jpctx, "INSERT INTO jobs (jobid, dg_jobid, ownerid, ps) VALUES (?, ?, ?, (SELECT source FROM feeds WHERE feedid=?))", &isctx->insert_job_stmt, myparam, NULL)) != 0) goto fail;
-
- // sql command: check the user
- glite_jp_db_create_params(&myparam, 1,
- GLITE_JP_DB_TYPE_CHAR, isctx->param_ownerid, &isctx->param_ownerid_len);
- if ((glite_jp_db_prepare(jpctx, "SELECT userid FROM users WHERE userid=?", &isctx->select_user_stmt, myparam, NULL)) != 0) goto fail;
-
- // sql command: insert the user
- glite_jp_db_create_params(&myparam, 2,
- GLITE_JP_DB_TYPE_CHAR, isctx->param_ownerid, &isctx->param_ownerid_len,
- GLITE_JP_DB_TYPE_VARCHAR, isctx->param_cert, &isctx->param_cert_len);
- if ((glite_jp_db_prepare(jpctx, "INSERT INTO users (userid, cert_subj) VALUES (?, ?)", &isctx->insert_user_stmt, myparam, NULL)) != 0) goto fail;
-
- return 0;
-
-fail:
- glite_jpis_free_db(isctx);
- return ret;
-}
-
-
-void glite_jpis_free_db(glite_jpis_context_t ctx) {
- glite_jp_db_freestmt(&ctx->select_unlocked_feed_stmt);
- glite_jp_db_freestmt(&ctx->lock_feed_stmt);
- glite_jp_db_freestmt(&ctx->init_feed_stmt);
- glite_jp_db_freestmt(&ctx->unlock_feed_stmt);
- glite_jp_db_freestmt(&ctx->select_info_feed_stmt);
- glite_jp_db_freestmt(&ctx->update_state_feed_stmt);
- glite_jp_db_freestmt(&ctx->update_error_feed_stmt);
- glite_jp_db_freestmt(&ctx->select_info_attrs_indexed);
- glite_jp_db_freestmt(&ctx->select_jobid_stmt);
- glite_jp_db_freestmt(&ctx->select_user_stmt);
- glite_jp_db_freestmt(&ctx->insert_job_stmt);
- glite_jp_db_freestmt(&ctx->insert_user_stmt);
- glite_jp_db_close(ctx->jpctx);
-}
-
-
-/* Find first unitialized feed, lock it and return URL of corresponding PS
- *
- * Return value:
- * 0 - OK
- * ENOENT - no more feeds to initialize
- * ENOLCK - error during locking */
-
-int glite_jpis_lockUninitializedFeed(glite_jpis_context_t ctx, long int *uniqueid, char **PS_URL)
-{
- int ret;
- time_t now;
-
- now = time(NULL);
- glite_jp_db_set_time(ctx->param_expires, now);
- do {
- switch (glite_jp_db_execute(ctx->select_unlocked_feed_stmt)) {
- case -1: lprintf("error selecting unlocked feed\n"); return ENOLCK;
- case 0: lprintf("no more uninit. feeds unlocked\n"); return ENOENT;
- default: break;
- }
- if (glite_jp_db_fetch(ctx->select_unlocked_feed_stmt) != 0) return ENOLCK;
- lprintf("selected uninit. feed %ld\n", ctx->param_uniqueid);
-
- ret = glite_jp_db_execute(ctx->lock_feed_stmt);
- lprintf("locked %d feeds (uniqueid=%ld, time=%ld)\n", ret, ctx->param_uniqueid, now);
- } while (ret != 1);
-
- *uniqueid = ctx->param_uniqueid;
- if (PS_URL) *PS_URL = strdup(ctx->param_ps);
-
- return 0;
-}
-
-
-/* Store feed ID and expiration time returned by PS for locked feed. */
-
-int glite_jpis_initFeed(glite_jpis_context_t ctx, long int uniqueid, char *feedId, time_t feedExpires)
-{
- int ret;
-
- GLITE_JPIS_PARAM(ctx->param_feedid, ctx->param_feedid_len, feedId);
- glite_jp_db_set_time(ctx->param_expires, feedExpires);
- ctx->param_uniqueid = uniqueid;
-
- ret = glite_jp_db_execute(ctx->init_feed_stmt);
- lprintf("initializing feed, uniqueid=%li, result=%d\n", uniqueid, ret);
-
- return ret == 1 ? 0 : ENOLCK;
-}
-
-
-/* Unlock given feed */
-
-int glite_jpis_unlockFeed(glite_jpis_context_t ctx, long int uniqueid) {
- int ret;
-
- ctx->param_uniqueid = uniqueid;
- ret = glite_jp_db_execute(ctx->unlock_feed_stmt);
- lprintf("unlocking feed, uniqueid=%li, result=%d\n", uniqueid, ret);
-
- return ret == 1 ? 0 : ENOLCK;
-}
-
-
-/* Saves TTL (when to reconnect if error occured) for given feed */
-
-int glite_jpis_tryReconnectFeed(glite_jpis_context_t ctx, long int uniqueid, time_t reconn_time) {
- lprintf("reconnect, un=%ld, %ld\n", uniqueid, reconn_time);
- ctx->param_uniqueid = uniqueid;
- ctx->param_state = GLITE_JP_IS_STATE_ERROR;
- glite_jp_db_set_time(ctx->param_expires, reconn_time);
- if (glite_jp_db_execute(ctx->update_error_feed_stmt) == -1) return ctx->jpctx->error->code;
- return 0;
-}
-
-
-int glite_jpis_insertAttrVal(glite_jpis_context_t ctx, const char *jobid, glite_jp_attrval_t *av) {
- char *sql, *table, *value, *full_value, *md5_jobid;
-
- table = glite_jpis_attr_name2id(av->name);
- value = glite_jp_attrval_to_db_index(ctx->jpctx, av, INDEX_LENGTH);
- full_value = glite_jp_attrval_to_db_full(ctx->jpctx, av);
- md5_jobid = str2md5(jobid);
- asprintf(&sql, SQLCMD_INSERT_ATTRVAL, table, md5_jobid, value, full_value);
- free(md5_jobid);
- free(table);
- free(value);
- free(full_value);
- lprintf("%s(%s): sql=%s\n", __FUNCTION__, av->name, sql);
- if (glite_jp_db_execstmt(ctx->jpctx, sql, NULL) != 1) {
- free(sql);
- return ctx->jpctx->error->code;
- }
- free(sql);
-
- return 0;
-}
-
-
-int glite_jpis_lazyInsertJob(glite_jpis_context_t ctx, const char *feedid, const char *jobid, const char *owner) {
- int ret;
- char *md5_jobid = NULL, *md5_cert = NULL;
-
- lprintf("%s\n", __FUNCTION__);
-
- md5_jobid = str2md5(jobid);
- GLITE_JPIS_PARAM(ctx->param_jobid, ctx->param_jobid_len, md5_jobid);
-
- switch (ret = glite_jp_db_execute(ctx->select_jobid_stmt)) {
- case 1: lprintf("jobid '%s' found\n", jobid); goto ok0;
- case 0:
- lprintf("%s:inserting jobid %s (%s)\n", __FUNCTION__, jobid, md5_jobid);
- GLITE_JPIS_PARAM(ctx->param_dg_jobid, ctx->param_dg_jobid_len, jobid);
- GLITE_JPIS_PARAM(ctx->param_feedid, ctx->param_feedid_len, feedid);
- if (glite_jp_db_execute(ctx->insert_job_stmt) != 1) goto fail;
- break;
- default: assert(ret != 1); break;
- }
-ok0:
-
- md5_cert = str2md5(owner);
- GLITE_JPIS_PARAM(ctx->param_ownerid, ctx->param_ownerid_len, md5_cert);
-
- switch (ret = glite_jp_db_execute(ctx->select_user_stmt)) {
- case 1: lprintf("%s:jobid '%s' found\n", __FUNCTION__, jobid); goto ok;
- case 0:
- lprintf("%s:inserting user %s (%s)\n", __FUNCTION__, owner, md5_cert);
- GLITE_JPIS_PARAM(ctx->param_cert, ctx->param_cert_len, owner);
- if (glite_jp_db_execute(ctx->insert_user_stmt) != 1) goto fail;
- break;
- default: assert(ret != 1); break;
- }
-
-ok:
- free(md5_jobid);
- free(md5_cert);
- return 0;
-fail:
- free(md5_jobid);
- free(md5_cert);
- return ctx->jpctx->error->code;
-}
+++ /dev/null
-#ident "$Header$"
-
-#ifndef _DB_OPS_H
-#define _DB_OPS_H
-
-
-#include <glite/jp/types.h>
-#include <glite/jp/context.h>
-#include "context.h"
-
-
-#define GLITE_JP_IS_DEFAULTCS "jpis/@localhost:jpis1"
-
-#define GLITE_JP_IS_STATE_HIST 1
-#define GLITE_JP_IS_STATE_CONT 2
-#define GLITE_JP_IS_STATE_DONE 4
-#define GLITE_JP_IS_STATE_ERROR 8
-#define GLITE_JP_IS_STATE_ERROR_STR "8"
-
-#define GLITE_JPIS_PARAM(DEST, DEST_LEN, SRC) do { \
- (DEST)[sizeof((DEST)) - 1] = '\0'; \
- strncpy((DEST), (SRC), sizeof((DEST)) - 1); \
- (DEST_LEN) = strlen((SRC)); \
-} while(0)
-
-
-char *glite_jpis_attr_name2id(const char *name);
-
-int glite_jpis_initDatabase(glite_jpis_context_t ctx);
-int glite_jpis_dropDatabase(glite_jpis_context_t ctx);
-
-int glite_jpis_init_db(glite_jpis_context_t isctx);
-void glite_jpis_free_db(glite_jpis_context_t ctx);
-
-int glite_jpis_lockUninitializedFeed(glite_jpis_context_t ctx, long int *uinqueid, char **PS_URL);
-int glite_jpis_initFeed(glite_jpis_context_t ctx, long int uniqueid, char *feedId, time_t feedExpires);
-int glite_jpis_unlockFeed(glite_jpis_context_t ctx, long int uniqueid);
-int glite_jpis_tryReconnectFeed(glite_jpis_context_t ctx, long int uniqueid, time_t reconn_time);
-
-int glite_jpis_insertAttrVal(glite_jpis_context_t ctx, const char *jobid, glite_jp_attrval_t *av);
-
-int glite_jpis_lazyInsertJob(glite_jpis_context_t ctx, const char *feedid, const char *jobid, const char *owner);
-
-#endif
+++ /dev/null
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "jpis_H.h"
-
-int main() {
- struct soap soap;
- int i, m, s; // master and slave sockets
-
- glite_jp_context_t ctx;
-
- soap_init(&soap);
- glite_jp_init_context(&ctx);
- soap.user = (void *) ctx;
-
- srand48(time(NULL)); /* feed id generation */
-
- m = soap_bind(&soap, NULL, 8902, 100);
- if (m < 0)
- soap_print_fault(&soap, stderr);
- else
- {
- fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
- for (i = 1; ; i++) {
- s = soap_accept(&soap);
- if (s < 0) {
- soap_print_fault(&soap, stderr);
- break;
- }
- soap_serve(&soap); // process RPC request
- soap_destroy(&soap); // clean up class instances
- soap_end(&soap); // clean up everything and close socket
- glite_jp_run_deferred(ctx);
- }
- }
- soap_done(&soap); // close master socket
-
- return 0;
-}
+++ /dev/null
-#include <stdio.h>
-#include <fcntl.h>
-#include <assert.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-#include "glite/jp/strmd5.h"
-#include "glite/jp/attr.h"
-#include "glite/lb/trio.h"
-
-#include "jpis_H.h"
-#include "jpis_.nsmap"
-#include "soap_version.h"
-#include "db_ops.h"
-// XXX: avoid 2 wsdl collisions - work only because ws_ps_typeref.h
-// uses common types from jpis_H.h (awful)
-#include "ws_ps_typeref.h"
-#include "ws_is_typeref.h"
-#include "context.h"
-
-#define INDEXED_STRIDE 2 // how often realloc indexed attr result
- // XXX: 2 is only for debugging, replace with e.g. 100
-#define JOBIDS_STRIDE 2 // how often realloc matched jobids result
-
-/*------------------*/
-/* Helper functions */
-/*------------------*/
-
-
-static struct jptype__genericFault *jp2s_error(struct soap *soap,
- const glite_jp_error_t *err)
-{
- struct jptype__genericFault *ret = NULL;
- if (err) {
- ret = soap_malloc(soap,sizeof *ret);
- memset(ret,0,sizeof *ret);
- ret->code = err->code;
- ret->source = soap_strdup(soap,err->source);
- ret->text = soap_strdup(soap,strerror(err->code));
- ret->description = soap_strdup(soap,err->desc);
- ret->reason = jp2s_error(soap,err->reason);
- }
- return ret;
-}
-
-static void err2fault(const glite_jp_context_t ctx,struct soap *soap)
-{
- struct SOAP_ENV__Detail *detail = soap_malloc(soap,sizeof *detail);
- struct _genericFault *f = soap_malloc(soap,sizeof *f);
-
-
- f->jpelem__genericFault = jp2s_error(soap,ctx->error);
-
- detail->__type = SOAP_TYPE__genericFault;
-#if GSOAP_VERSION >= 20700
- detail->fault = f;
-#else
- detail->value = f;
-#endif
- detail->__any = NULL;
-
- soap_receiver_fault(soap,"Oh, shit!",NULL);
- if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail;
- else soap->fault->detail = detail;
-}
-
-
-
-
-
-/*-----------------------------------------*/
-/* IS WSDL server function implementations */
-/*-----------------------------------------*/
-
-
-#define CONTEXT_FROM_SOAP(soap,ctx) glite_jpis_context_t ctx = (glite_jpis_context_t) ((slave_data_t *) (soap->user))->ctx
-
-
-static int updateJob(glite_jpis_context_t ctx, const char *feedid, struct jptype__jobRecord *jobAttrs) {
- glite_jp_attrval_t av;
- struct jptype__attrValue *attr;
- int ret, iattrs;
-
- lprintf("%s: jobid='%s', attrs=%d\n", __FUNCTION__, jobAttrs->jobid, jobAttrs->__sizeattributes);
-
- if (jobAttrs->remove) assert(*(jobAttrs->remove) == 0);
-
- if ((ret = glite_jpis_lazyInsertJob(ctx, feedid, jobAttrs->jobid, jobAttrs->owner)) != 0) return ret;
- for (iattrs = 0; iattrs < jobAttrs->__sizeattributes; iattrs++) {
- attr = jobAttrs->attributes[iattrs];
- glite_jpis_SoapToAttrVal(&av, attr);
- if ((ret = glite_jpis_insertAttrVal(ctx, jobAttrs->jobid, &av)) != 0) return ret;
- }
-
- return 0;
-}
-
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__UpdateJobs(
- struct soap *soap,
- struct _jpelem__UpdateJobs *jpelem__UpdateJobs,
- struct _jpelem__UpdateJobsResponse *jpelem__UpdateJobsResponse)
-{
- int ret, ijobs;
- const char *feedid;
- int status, done;
- CONTEXT_FROM_SOAP(soap, ctx);
- glite_jp_context_t jpctx = ctx->jpctx;
- char *err;
-
- // XXX: test client in examples/jpis-test
- // sends to this function some data for testing
- puts(__FUNCTION__);
-
- // get info about the feed
- feedid = jpelem__UpdateJobs->feedId;
- GLITE_JPIS_PARAM(ctx->param_feedid, ctx->param_feedid_len, feedid);
- if ((ret = glite_jp_db_execute(ctx->select_info_feed_stmt)) != 1) {
- fprintf(stderr, "can't get info about '%s', returned %d records: %s (%s)\n", feedid, ret, jpctx->error->desc, jpctx->error->source);
- goto fail;
- }
- // update status, if needed (only oring)
- status = ctx->param_state;
- done = jpelem__UpdateJobs->feedDone ? GLITE_JP_IS_STATE_DONE : 0;
- if ((done != (status & GLITE_JP_IS_STATE_DONE)) && done) {
- ctx->param_state |= done;
- if ((ret = glite_jp_db_execute(ctx->update_state_feed_stmt)) != 1) {
- fprintf(stderr, "can't update state of '%s', returned %d records: %s (%s)\n", feedid, ret, jpctx->error->desc, jpctx->error->source);
- goto fail;
- }
- }
-
- // insert all attributes
- for (ijobs = 0; ijobs < jpelem__UpdateJobs->__sizejobAttributes; ijobs++) {
- if (updateJob(ctx, feedid, jpelem__UpdateJobs->jobAttributes[ijobs]) != 0) goto fail;
- }
-
- return SOAP_OK;
-
-fail:
-// TODO: bubble up
- err = glite_jp_error_chain(ctx->jpctx);
- fprintf(stderr, "%s:%s\n", __FUNCTION__, err);
- free(err);
- return SOAP_FAULT;
-}
-
-
-static int checkIndexedConditions(glite_jpis_context_t ctx, struct _jpelem__QueryJobs *in)
-{
- char **indexed_attrs = NULL, *res;
- int i, j, k, ret;
- glite_jp_db_stmt_t stmt;
-
-
- if ((ret = glite_jp_db_execstmt(ctx->jpctx,
- "SELECT name FROM attrs WHERE (indexed=1)", &stmt)) < 0) goto end;
-
- i = 0;
- while ( (ret = glite_jp_db_fetchrow(stmt, &res)) > 0 ) {
- if (!(i % INDEXED_STRIDE)) {
- indexed_attrs = realloc(indexed_attrs,
- ((i / INDEXED_STRIDE + 1) * INDEXED_STRIDE)
- * sizeof(*indexed_attrs));
- }
- indexed_attrs[i++] = strdup(res);
- free(res);
- }
- if ( ret < 0 ) goto end;
-
- for (k=0; k < in->__sizeconditions; k++) {
- for (j=0; j < i; j++) {
- if (!strcmp(in->conditions[k]->attr, indexed_attrs[j])) {
- ret = 0;
- goto end;
- }
- }
- }
- ret = 1;
-
-end:
- for (j=0; j < i; j++) free(indexed_attrs[j]);
- free(indexed_attrs);
-
- return(ret);
-}
-
-
-/* adds attr table name to the list (null terminated) , iff unigue */
-static void add_attr_table(char *new, char ***attr_tables)
-{
- int i;
-
- for (i=0; (*attr_tables && (*attr_tables)[i]); i++) {
- if (!strcmp((*attr_tables)[i], new)) return;
- }
-
- *attr_tables = realloc((*attr_tables), (i+2) * sizeof(**attr_tables));
- (*attr_tables)[i] = strdup(new);
- (*attr_tables)[i+1] = NULL;
-}
-
-/* transform soap enum queryOp to mysql quivalent */
-static int get_op(const enum jptype__queryOp in, char **out)
-{
- char *qop;
- glite_jp_queryop_t op;
-
- glite_jpis_SoapToQueryOp(in, &op);
- switch (op) {
- case GLITE_JP_QUERYOP_EQUAL:
- qop = strdup("=");
- break;
- case GLITE_JP_QUERYOP_UNEQUAL:
- qop = strdup("!=");
- break;
- default:
- // unsupported query operator
- return(1);
- break;
- }
-
- *out = qop;
- return(0);
-}
-
-static int get_jobids(struct soap *soap, glite_jpis_context_t ctx, struct _jpelem__QueryJobs *in, char ***jobids, char *** ps_list)
-{
- char *qa = NULL, *qb = NULL, *qop = NULL, *attr_md5,
- *qwhere = NULL, *query = NULL, *res[2],
- **jids = NULL, **pss = NULL, **attr_tables = NULL;
- int i, j, ret;
- glite_jp_db_stmt_t stmt;
- glite_jp_attrval_t attr;
-
-
- qwhere = strdup("");
- for (i=0; i < in->__sizeconditions; i++) {
- attr_md5 = str2md5(in->conditions[i]->attr);
- trio_asprintf(&qa,"%s jobs.jobid = attr_%|Ss.jobid AND (",
- (i ? "AND" : ""), attr_md5);
-
- for (j=0; j < in->conditions[i]->__sizerecord; j++) {
- if (get_op(in->conditions[i]->record[j]->op, &qop)) goto err;
- add_attr_table(attr_md5, &attr_tables);
-
- if (in->conditions[i]->record[j]->value->string) {
- attr.name = in->conditions[i]->attr;
- attr.value = in->conditions[i]->record[j]->value->string;
- attr.binary = 0;
- glite_jpis_SoapToAttrOrig(soap,
- in->conditions[i]->origin, &(attr.origin));
- trio_asprintf(&qb,"%s%sattr_%|Ss.value %s \"%|Ss\"",
- qa, (j ? " OR " : ""), attr_md5, qop,
- glite_jp_attrval_to_db_index(ctx->jpctx, &attr, 255));
- free(qop);
- free(qa); qa = qb; qb = NULL;
- }
- else {
- attr.name = in->conditions[i]->attr;
- attr.value = in->conditions[i]->record[j]->value->blob->__ptr;
- attr.binary = 1;
- attr.size = in->conditions[i]->record[j]->value->blob->__size;
- glite_jpis_SoapToAttrOrig(soap,
- in->conditions[i]->origin, &(attr.origin));
- trio_asprintf(&qb,"%s %s attr_%|Ss.value %s \"%|Ss\"",
- qa, (j ? "OR" : ""), attr_md5, qop,
- glite_jp_attrval_to_db_index(ctx->jpctx, &attr, 255));
- free(qop);
- free(qa); qa = qb; qb = NULL;
- }
- }
- trio_asprintf(&qb,"%s %s)", qwhere, qa);
- free(qa); qwhere = qb; qb = NULL; qa = NULL;
- free(attr_md5);
- }
-
- qa = strdup("");
-
- for (i=0; (attr_tables && attr_tables[i]); i++) {
- trio_asprintf(&qb,"%s, attr_%s", qa, attr_tables[i]);
- free(qa); qa = qb; qb = NULL;
- }
-
- trio_asprintf(&query, "SELECT dg_jobid,ps FROM jobs%s WHERE %s;", qa, qwhere);
- printf("Incomming QUERY:\n %s\n", query);
- free(qwhere);
- free(qa);
-
- // XXX: add where's for attr origin (not clear now whether stored in separate column
- // or obtained via glite_jp_attrval_from_db...
-
- if ((ret = glite_jp_db_execstmt(ctx->jpctx, query, &stmt)) < 0) goto err;
- free(query);
-
- i = 0;
- while ( (ret = glite_jp_db_fetchrow(stmt, res)) > 0 ) {
- if (!(i % JOBIDS_STRIDE)) {
- jids = realloc(jids,
- ((i / JOBIDS_STRIDE + 1) * JOBIDS_STRIDE + 1)
- * sizeof(*jids));
- }
- if (!(i % JOBIDS_STRIDE)) {
- pss = realloc(pss,
- ((i / JOBIDS_STRIDE + 1) * JOBIDS_STRIDE + 1)
- * sizeof(*pss));
- }
- jids[i] = res[0];
- jids[i+1] = NULL;
- pss[i] = res[1];
- pss[i+1] = NULL;
- i++;
- }
-
- if ( ret < 0 ) goto err;
-
- glite_jp_db_freestmt(&stmt);
-
- *jobids = jids;
- *ps_list = pss;
-
- return 0;
-
-err:
- free(query);
- for (i=0; (pss && pss[i]); i++) free(pss[i]);
- free(pss);
- for (i=0; (jids && jids[i]); i++) free(jids[i]);
- free(jids);
- glite_jp_db_freestmt(&stmt);
-
- return ret;
-}
-
-static void freeAttval_t(glite_jp_attrval_t jav)
-{
- free(jav.name);
- free(jav.value);
- free(jav.origin_detail);
-}
-
-
-/* get all values of a given attribute for a job with a given jobid */
-/* all values are soap_malloc-ated, exept of av (due to absence of */
-/* soap_realloc) */
-/* Needs to be reallocated with soap_malloc in calling function! */
-
-static int get_attr(struct soap *soap, glite_jpis_context_t ctx, char *jobid, char *attr_name, struct jptype__jobRecord *out)
-{
- glite_jp_attrval_t jav;
- struct jptype__attrValue **av = NULL;;
- //enum jptype__attrOrig *origin;
- char *query, *fv, *jobid_md5, *attr_md5;
- int i, ret;
- glite_jp_db_stmt_t stmt;
-
-
- jobid_md5 = str2md5(jobid);
- attr_md5 = str2md5(attr_name);
- trio_asprintf(&query,"SELECT full_value FROM attr_%|Ss WHERE jobid = \"%s\"",
- attr_md5, jobid_md5);
- free(attr_md5);
- free(jobid_md5);
-
- if ((ret = glite_jp_db_execstmt(ctx->jpctx, query, &stmt)) < 0) goto err;
- free(query);
-
- i = 0;
- while ( (ret = glite_jp_db_fetchrow(stmt, &fv)) > 0 ) {
- av = realloc(av, (i+1) * sizeof(*av));
- av[i] = soap_malloc(soap, sizeof(**av));
- memset(av[i], 0, sizeof(**av));
-
- memset(&jav,0,sizeof(jav));
- if (glite_jp_attrval_from_db(ctx->jpctx, fv, &jav)) goto err;
- av[i]->name = soap_strdup(soap, attr_name);
- av[i]->value = soap_malloc(soap, sizeof(*(av[i]->value)));
- memset(av[i]->value, 0, sizeof(*(av[i]->value)));
- if (jav.binary) {
- av[i]->value->blob = soap_malloc(soap, sizeof(*(av[i]->value->blob)));
- memset(av[i]->value->blob, 0, sizeof(*(av[i]->value->blob)));
- av[i]->value->blob->__ptr = soap_malloc(soap, jav.size);
- memcpy(av[i]->value->blob->__ptr, jav.value, jav.size);
- av[i]->value->blob->__size = jav.size;
- // XXX: id, type, option - how to handle?
- }
- else {
- av[i]->value->string = soap_strdup(soap, jav.value);
- }
-// XXX: load timestamp and origin from DB
-// need to add columns to DB
-// av[i]->timestamp = jav.timestamp;
-// glite_jpis_AttrOrigToSoap(soap, jav.origin, &origin);
-// av[i]->origin = *origin; free(origin);
-// av[i]->originDetail = soap_strdup(soap, jav.origin_detail);
-
- i++;
- freeAttval_t(jav);
- }
- if (ret < 0) goto err;
-
- glite_jp_db_freestmt(&stmt);
- (*out).__sizeattributes = i;
- (*out).attributes = av;
-
- return 0;
-
-err:
- glite_jp_db_freestmt(&stmt);
- freeAttval_t(jav);
- return 1;
-}
-
-
-/* fills structure jobRecord for a given jobid*/
-static int get_attrs(struct soap *soap, glite_jpis_context_t ctx, char *jobid, struct _jpelem__QueryJobs *in, struct jptype__jobRecord **out)
-{
- struct jptype__jobRecord jr;
- struct jptype__attrValue **av = NULL;
- int j, size;
-
-
- assert(out);
- *out = soap_malloc(soap, sizeof(**out));
- memset(*out, 0, sizeof(**out));
-
- /* jobid */
- (*out)->jobid = soap_strdup(soap, jobid);
-
- /* sizeattributes & attributes */
- size = 0;
- for (j=0; j < in->__sizeattributes; j++) {
- if (get_attr(soap, ctx, jobid, in->attributes[j], &jr) ) goto err;
- if (jr.__sizeattributes > 0) {
- av = realloc(av, (size + jr.__sizeattributes) * sizeof(*av));
- memcpy(&av[size], jr.attributes, jr.__sizeattributes * sizeof(*(jr.attributes)));
- size += jr.__sizeattributes;
- free(jr.attributes);
- }
- }
- (*out)->__sizeattributes = size;
- (*out)->attributes = soap_malloc( soap, size *sizeof(*((*out)->attributes)) );
- memcpy((*out)->attributes, av, size * sizeof(*((*out)->attributes)) );
- free(av);
-
- return 0;
-
-err:
- return 1;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__QueryJobs(
- struct soap *soap,
- struct _jpelem__QueryJobs *in,
- struct _jpelem__QueryJobsResponse *out)
-{
- CONTEXT_FROM_SOAP(soap, ctx);
- struct jptype__jobRecord **jr = NULL;
- char **jobids = NULL, **ps_list = NULL;
- int i, size;
-
-
- puts(__FUNCTION__);
- memset(out, 0, sizeof(*out));
-
- if ( checkIndexedConditions(ctx, in) ) {
- fprintf(stderr, "No indexed attribute in query\n");
- return SOAP_ERR;
- }
-
- if ( get_jobids(soap, ctx, in, &jobids, &ps_list) ) {
- return SOAP_ERR;
- }
-
- for (i=0; (jobids && jobids[i]); i++);
- size = i;
- jr = soap_malloc(soap, size * sizeof(*jr));
- for (i=0; (jobids && jobids[i]); i++) {
- if ( get_attrs(soap, ctx, jobids[i], in, &(jr[i])) ) {
- return SOAP_ERR;
- }
- // XXX: in prototype we return only first value of PS URL
- // in future database shoul contain one more table with URLs
- jr[i]->__sizeprimaryStorage = 1;
- jr[i]->primaryStorage = soap_malloc(soap, sizeof(*(jr[i]->primaryStorage)));
- jr[i]->primaryStorage[0] = soap_strdup(soap, ps_list[i]);
- free(ps_list[i]);
- free(jobids[i]);
- }
- free(jobids);
- free(ps_list);
-
- (*out).__sizejobs = size;
- (*out).jobs = jr;
-
- return SOAP_OK;
-}
-
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__AddFeed(
- struct soap *soap,
- struct _jpelem__AddFeed *in,
- struct _jpelem__AddFeedResponse *out)
-{
- // XXX: test client in examples/jpis-test
- // sends to this function some data for testing
- puts(__FUNCTION__);
- return SOAP_OK;
-}
-
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetFeedIDs(
- struct soap *soap,
- struct _jpelem__GetFeedIDs *in,
- struct _jpelem__GetFeedIDsResponse *out)
-{
- // XXX: test client in examples/jpis-test
- // sends to this function some data for testing
- puts(__FUNCTION__);
- return SOAP_OK;
-}
-
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__DeleteFeed(
- struct soap *soap,
- struct _jpelem__DeleteFeed *in,
- struct _jpelem__DeleteFeedResponse *out)
-{
- // XXX: test client in examples/jpis-test
- // sends to this function some data for testing
- puts(__FUNCTION__);
- return SOAP_OK;
-}
-
+++ /dev/null
-#include <stdio.h>
-#include <fcntl.h>
-#include <assert.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-#include "glite/security/glite_gsplugin.h"
-
-#include "jpps_H.h"
-#include "jpps_.nsmap"
-#include "soap_version.h"
-
-#include "conf.h"
-#include "db_ops.h"
-#include "ws_ps_typeref.h"
-#include "context.h"
-
-#include "stdsoap2.h"
-
-
-/*------------------*/
-/* Helper functions */
-/*------------------*/
-
-
-static struct jptype__genericFault *jp2s_error(struct soap *soap,
- const glite_jp_error_t *err)
-{
- struct jptype__genericFault *ret = NULL;
- if (err) {
- ret = soap_malloc(soap,sizeof *ret);
- memset(ret,0,sizeof *ret);
- ret->code = err->code;
- ret->source = soap_strdup(soap,err->source);
- ret->text = soap_strdup(soap,strerror(err->code));
- ret->description = soap_strdup(soap,err->desc);
- ret->reason = jp2s_error(soap,err->reason);
- }
- return ret;
-}
-
-static void err2fault(const glite_jp_context_t ctx,struct soap *soap)
-{
- struct SOAP_ENV__Detail *detail = soap_malloc(soap,sizeof *detail);
- struct _genericFault *f = soap_malloc(soap,sizeof *f);
-
-
- f->jpelem__genericFault = jp2s_error(soap,ctx->error);
-
- detail->__type = SOAP_TYPE__genericFault;
-#if GSOAP_VERSION >= 20700
- detail->fault = f;
-#else
- detail->value = f;
-#endif
- detail->__any = NULL;
-
- soap_receiver_fault(soap,"Oh, shit!",NULL);
- if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail;
- else soap->fault->detail = detail;
-}
-
-
-static int check_fault(struct soap *soap,int err) {
- struct SOAP_ENV__Detail *detail;
- struct jptype__genericFault *f;
- char *reason,indent[200] = " ";
-
- switch(err) {
- case SOAP_OK: puts("OK");
- break;
- case SOAP_FAULT:
- case SOAP_SVR_FAULT:
- if (soap->version == 2) {
- detail = soap->fault->SOAP_ENV__Detail;
- reason = soap->fault->SOAP_ENV__Reason;
- }
- else {
- detail = soap->fault->detail;
- reason = soap->fault->faultstring;
- }
- fputs(reason,stderr);
- putc('\n',stderr);
- assert(detail->__type == SOAP_TYPE__genericFault);
-#if GSOAP_VERSION >=20700
- f = ((struct _genericFault *) detail->fault)
-#else
- f = ((struct _genericFault *) detail->value)
-#endif
- -> jpelem__genericFault;
-
- while (f) {
- fprintf(stderr,"%s%s: %s (%s)\n",indent,
- f->source,f->text,f->description);
- f = f->reason;
- strcat(indent," ");
- }
- return -1;
-
- default: soap_print_fault(soap,stderr);
- return -1;
- }
- return 0;
-}
-
-
-/*----------------------*/
-/* PS WSDL client calls */
-/*----------------------*/
-
-static int find_dest_index(glite_jp_is_conf *conf, char *dest)
-{
- int i;
-
- for (i=0; conf->feeds[i]; i++)
- if (!strcmp(dest, conf->feeds[i]->PS_URL)) return(i);
-
- return -1;
-}
-
-
-// call PS FeedIndex for a given destination
-int MyFeedIndex(glite_jpis_context_t ctx, glite_jp_is_conf *conf, long int uniqueid, char *dest)
-{
- struct _jpelem__FeedIndex in;
- struct _jpelem__FeedIndexResponse out;
-// struct jptype__primaryQuery query;
-// struct jptype__stringOrBlob value;
-// struct xsd__base64Binary blob;
- int i, dest_index;
- struct soap *soap = soap_new();
- glite_jp_error_t err;
- char *src, hname[512];
-
-lprintf("MyFeedIndex for %s called\n", dest);
-
- soap_init(soap);
- soap_set_namespaces(soap,jpps__namespaces);
-// TODO
- soap_register_plugin(soap,glite_gsplugin);
-
- memset(&in, 0, sizeof(in));
- memset(&err, 0, sizeof(err));
-
- for (i=0; conf->attrs[i]; i++) ;
- in.__sizeattributes = i;
- in.attributes = conf->attrs;
-
- if ((dest_index = find_dest_index(conf, dest)) < 0) goto err;
-
- for (i=0; conf->feeds[dest_index]->query[i]; i++);
- in.__sizeconditions = i;
- in.conditions = soap_malloc(soap, in.__sizeconditions * sizeof(*in.conditions));
-
- for (i=0; conf->feeds[dest_index]->query[i]; i++) {
- if (glite_jpis_QueryCondToSoap(soap, conf->feeds[dest_index]->query[i],
- &(in.conditions[i])) != SOAP_OK) {
- err.code = EINVAL;
- err.desc = "error during conds conversion";
- asprintf(&src, "%s/%s():%d", __FILE__, __FUNCTION__, __LINE__);
- fprintf(stderr, "%s\n", src);
- goto err;
- }
- }
-
- in.history = conf->feeds[dest_index]->history;
- in.continuous = conf->feeds[dest_index]->continuous;
- in.destination = ctx->hname;
- fprintf(stderr, "%s:%s\n", __FUNCTION__, ctx->hname);
-
- if (check_fault(soap,soap_call___jpsrv__FeedIndex(soap,dest,"", &in, &out)) != 0) {
- fprintf(stderr, "\n");
- glite_jpis_unlockFeed(ctx, uniqueid);
- err.code = EIO;
- err.desc = "soap_call___jpsrv__FeedIndex() returned error";
- asprintf(&src, "%s/%s():%d", __FILE__, __FUNCTION__, __LINE__);
- fprintf(stderr, "%s\n", err.desc);
- goto err;
- }
- else {
- lprintf("FeedId: %s\nExpires: %s\n",out.feedId,ctime(&out.feedExpires));
- glite_jpis_initFeed(ctx, uniqueid, out.feedId, out.feedExpires);
- glite_jpis_unlockFeed(ctx, uniqueid);
- }
-
- return 0;
-err:
- err.source = src;
- glite_jp_stack_error(ctx->jpctx, &err);
- free(src);
- soap_end(soap);
- return err.code;
-}
-
+++ /dev/null
-#ident "$Header$"
-
-#ifndef _SOAP_PS_CALLS_H
-#define _SOAP_PS_CALLS_H
-
-#include "context.h"
-#include "conf.h"
-
-int MyFeedIndex(glite_jpis_context_t ctx, glite_jp_is_conf *conf, long int uniqueid, char *dest);
-
-#endif
+++ /dev/null
-jpsrv = http://glite.org/wsdl/services/jp
-jptype = http://glite.org/wsdl/types/jp
-jpelem = http://glite.org/wsdl/elements/jp
+++ /dev/null
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdsoap2.h>
-
-#include <glite/jp/types.h>
-
-#include "jpis_H.h"
-#include "ws_typemap.h"
-#include "ws_is_typeref.h"
-
-
-void glite_jpis_SoapToQueryOp(const enum jptype__queryOp in, glite_jp_queryop_t *out)
-{
- switch ( in )
- {
- case EQUAL: *out = GLITE_JP_QUERYOP_EQUAL; break;
- case UNEQUAL: *out = GLITE_JP_QUERYOP_UNEQUAL; break;
- case LESS: *out = GLITE_JP_QUERYOP_LESS; break;
- case GREATER: *out = GLITE_JP_QUERYOP_GREATER; break;
- case WITHIN: *out = GLITE_JP_QUERYOP_WITHIN; break;
- case EXISTS: *out = GLITE_JP_QUERYOP_EXISTS; break;
- default: assert(0); break;
- }
-}
-
-void glite_jpis_SoapToAttrOrig(struct soap *soap, const enum jptype__attrOrig *in, glite_jp_attr_orig_t *out)
-{
- assert(out);
-
- // XXX: shlouldn't be ANY in WSDL??
- if (!in) {
- *out = GLITE_JP_ATTR_ORIG_ANY;
- return;
- }
-
- switch ( *in )
- {
-// case NULL: *out = GLITE_JP_ATTR_ORIG_ANY; break;
- case SYSTEM: *out = GLITE_JP_ATTR_ORIG_SYSTEM; break;
- case USER: *out = GLITE_JP_ATTR_ORIG_USER; break;
- case FILE_: *out = GLITE_JP_ATTR_ORIG_FILE; break;
- default: assert(0); break;
- }
-}
-
-static int SoapToQueryRecordVal(
- struct soap *soap,
- struct jptype__stringOrBlob *in,
- int *binary,
- size_t *size,
- char **value)
-{
-
- assert(in);
- if (in->string) {
- *binary = 0;
- *size = 0;
- *value = strdup(in->string);
-
- return 0;
- }
- else if (in->blob) {
- *binary = 1;
- *size = in->blob->__size;
- memcpy(*value, in->blob->__ptr, in->blob->__size);
- // XXX how to handle id, type, option?
-
- return 0;
- }
- else
- // malformed value
- return 1;
-}
-
-
-static int SoapToQueryCond(
- struct soap *soap,
- struct jptype__indexQuery *in,
- glite_jp_query_rec_t **out)
-{
- glite_jp_query_rec_t *qr;
- int i;
-
-
- assert(in); assert(out);
- qr = calloc(in->__sizerecord, sizeof(*qr));
-
- for (i=0; i < in->__sizerecord; i++) {
- qr[i].attr = strdup(in->attr);
- glite_jpis_SoapToQueryOp(in->record[i]->op, &(qr[i].op));
-
- switch (qr[i].op) {
- case GLITE_JP_QUERYOP_EXISTS:
- break;
-
- case GLITE_JP_QUERYOP_WITHIN:
- SoapToQueryRecordVal(soap, in->record[i]->value2, &(qr[i].binary),
- &(qr[i].size2), &(qr[i].value2));
- // fall through
- default:
- if ( SoapToQueryRecordVal(soap, in->record[i]->value, &(qr[i].binary),
- &(qr[i].size), &(qr[i].value)) ) {
- *out = NULL;
- return 1;
- }
- break;
- }
-
- glite_jpis_SoapToAttrOrig(soap, in->origin, &(qr[i].origin) );
- }
-
- *out = qr;
-
- return 0;
-}
-
-/**
- * Translate JP query conditions from soap to C query_rec
- *
- * \param IN Soap structure
- * \param OUT array of glite_jp_query_rec_t query records
- */
-int glite_jpis_SoapToQueryConds(
- struct soap *soap,
- int size,
- struct jptype__indexQuery **in,
- glite_jp_query_rec_t ***out)
-{
- glite_jp_query_rec_t **qr;
- int i;
-
- assert(in); assert(out);
- qr = calloc(size+1, sizeof(*qr));
-
- for (i=0; i<size; i++) {
- if ( SoapToQueryCond(soap, in[i], &(qr[i])) ) {
- *out = NULL;
- return 1;
- }
- }
-
- *out = qr;
-
- return 0;
-}
+++ /dev/null
-#ifndef GLITE_JPIS_IS_TYPEREF_H
-#define GLITE_JPIS_IS_TYPEREF_H
-
-void glite_jpis_SoapToQueryOp(const enum jptype__queryOp in, glite_jp_queryop_t *out);
-void glite_jpis_SoapToAttrOrig(struct soap *soap, const enum jptype__attrOrig *in, glite_jp_attr_orig_t *out);
-int glite_jpis_SoapToQueryConds(struct soap *soap, int size, struct jptype__indexQuery **in, glite_jp_query_rec_t ***out);
-
-#endif
+++ /dev/null
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdsoap2.h>
-
-#include <glite/jp/types.h>
-
-#include "jpps_H.h"
-#include "ws_typemap.h"
-#include "ws_ps_typeref.h"
-
-
-static void QueryOpToSoap(const glite_jp_queryop_t in, enum jptype__queryOp *out)
-{
- switch ( in )
- {
- case GLITE_JP_QUERYOP_EQUAL: *out = EQUAL; break;
- case GLITE_JP_QUERYOP_UNEQUAL: *out = UNEQUAL; break;
- case GLITE_JP_QUERYOP_LESS: *out = LESS; break;
- case GLITE_JP_QUERYOP_GREATER: *out = GREATER; break;
- case GLITE_JP_QUERYOP_WITHIN: *out = WITHIN; break;
- case GLITE_JP_QUERYOP_EXISTS: *out = EXISTS; break;
- default: assert(0); break;
- }
-}
-
-void glite_jpis_AttrOrigToSoap(struct soap *soap, const glite_jp_attr_orig_t in, enum jptype__attrOrig **out)
-{
- enum jptype__attrOrig *o = soap_malloc(soap, sizeof(*o));
-
- switch ( in )
- {
- case GLITE_JP_ATTR_ORIG_ANY: o = NULL; break;
- case GLITE_JP_ATTR_ORIG_SYSTEM: *o = SYSTEM; break;
- case GLITE_JP_ATTR_ORIG_USER: *o = USER; break;
- case GLITE_JP_ATTR_ORIG_FILE: *o = FILE_; break;
- default: assert(0); break;
- }
-
- *out = o;
-}
-
-static int QueryRecordValToSoap(
- struct soap *soap,
- int binary,
- size_t size,
- char *in,
- struct jptype__stringOrBlob **out)
-{
- struct jptype__stringOrBlob *val;
-
-
- assert(out);
- if ( !(val = soap_malloc(soap, sizeof(*val))) ) return SOAP_FAULT;
- memset(val, 0, sizeof(*val) );
-
- if (binary) {
- val->string = NULL;
- if ( !(val->blob = soap_malloc(soap, sizeof(*val->blob))) ) return SOAP_FAULT;
- val->blob->__size = size;
- if ( !(val->blob->__ptr = soap_malloc(soap, val->blob->__size)) ) return SOAP_FAULT;
- memcpy(val->blob->__ptr, in, val->blob->__size);
- // XXX how to handle id, type, option?
- }
- else {
- val->blob = NULL;
- if ( !(val->string = soap_strdup(soap, in)) ) return SOAP_FAULT;
- }
-
- *out = val;
-
- return SOAP_OK;
-}
-
-/**
- * Translate JP query condition from C query_rec to Soap
- *
- * \param IN in glite_jp_query_rec_t query record
- * \param OUT Soap structure
- */
-int glite_jpis_QueryCondToSoap(
- struct soap *soap,
- glite_jp_query_rec_t *in,
- struct jptype__primaryQuery **out)
-{
- struct jptype__primaryQuery *qr;
-
- assert(in); assert(out);
- if ( !(qr = soap_malloc(soap, sizeof(*qr))) ) return SOAP_FAULT;
- memset(qr, 0, sizeof(*qr));
-
- if ( !(qr->attr = soap_strdup(soap, in->attr)) ) return SOAP_FAULT;
- QueryOpToSoap(in->op, &(qr->op));
- glite_jpis_AttrOrigToSoap(soap, in->origin, &(qr->origin));
-
- switch ( in->op ) {
- case GLITE_JP_QUERYOP_WITHIN:
- if (QueryRecordValToSoap(soap, in->binary, in->size2, in->value2, &qr->value2))
- return SOAP_FAULT;
- default:
- if (QueryRecordValToSoap(soap, in->binary, in->size, in->value, &qr->value))
- return SOAP_FAULT;
- break;
- }
-
- *out = qr;
-
- return SOAP_OK;
-}
-
-static void SoapToAttrOrig(glite_jp_attr_orig_t *out, const enum jptype__attrOrig in)
-{
- switch ( in )
- {
- case jptype__attrOrig__SYSTEM: *out = GLITE_JP_ATTR_ORIG_SYSTEM; break;
- case jptype__attrOrig__USER: *out = GLITE_JP_ATTR_ORIG_USER; break;
- case jptype__attrOrig__FILE_: *out = GLITE_JP_ATTR_ORIG_FILE; break;
- default: assert(0); break;
- }
-}
-
-void glite_jpis_SoapToAttrVal(glite_jp_attrval_t *av, const struct jptype__attrValue *attr) {
- memset(av, 0, sizeof(*av));
- av->name = attr->name;
- av->binary = attr->value->blob ? 1 : 0;
- assert(av->binary || attr->value->string);
- if (av->binary) {
- av->value = attr->value->blob->__ptr;
- av->size =attr->value->blob->__size ;
- } else {
- av->size = -1;
- av->value = attr->value->string;
- }
- SoapToAttrOrig(&av->origin, attr->origin);
- av->origin_detail = attr->originDetail;
- av->timestamp = attr->timestamp;
-}
+++ /dev/null
-#ifndef GLITE_JPIS_TYPEREF_H
-#define GLITE_JPIS_TYPEREF_H
-
-int glite_jpis_QueryCondToSoap(struct soap *soap, glite_jp_query_rec_t *in, struct jptype__primaryQuery **out);
-
-void glite_jpis_AttrOrigToSoap(struct soap *soap, const glite_jp_attr_orig_t in, enum jptype__attrOrig **out);
-
-void glite_jpis_SoapToAttrVal(glite_jp_attrval_t *av, const struct jptype__attrValue *attr);
-
-#endif
+++ /dev/null
-// XXX: may be glued with org.glite.jp.primary/src/jptype_map.h?
-
-#include "soap_version.h"
-
-#if GSOAP_VERSION >= 20700
-
-#define SYSTEM jptype__attrOrig__SYSTEM
-#define USER jptype__attrOrig__USER
-#define FILE_ jptype__attrOrig__FILE_
-
-#define EQUAL jptype__queryOp__EQUAL
-#define UNEQUAL jptype__queryOp__UNEQUAL
-#define LESS jptype__queryOp__LESS
-#define GREATER jptype__queryOp__GREATER
-#define WITHIN jptype__queryOp__WITHIN
-#define EXISTS jptype__queryOp__EXISTS
-
-#else
-
-#define __jpsrv__UpdateJobs __ns1__UpdateJobs
-#define __jpsrv__QueryJobs __ns1__QueryJobs
-#define __jpsrv__AddFeed __ns1__AddFeed
-#define __jpsrv__GetFeeds __ns1__getFeedIDs
-#define __jpsrv__DeleteFeed __ns1__DeleteFeed
-
-#endif
-
+++ /dev/null
-# defaults
-top_srcdir=.
-builddir=build
-top_builddir=${top_srcdir}/${builddir}
-stagedir=.
-distdir=.
-globalprefix=glite
-jpprefix=jp
-package=glite-jp-primary
-version=0.0.0
-PREFIX=/opt/glite
-
-glite_location=/opt/glite
-globus_prefix=/opt/globus
-nothrflavour=gcc32
-thrflavour=gcc32pthr
-expat_prefix=/opt/expat
-ares_prefix=/opt/ares
-gsoap_prefix=/software/gsoap-2.6
-
-CC=gcc
-
--include Makefile.inc
-
-
-VPATH=${top_srcdir}/src:${top_srcdir}/examples:${top_srcdir}/test:${top_srcdir}/project:${stagedir}/interface
-
-GLOBUS_LIBS:=-L${globus_prefix}/lib \
- -lglobus_common_${nothrflavour} \
- -lglobus_gssapi_gsi_${nothrflavour}
-
-GLOBUS_CFLAGS:=-I${globus_prefix}/include/${nothrflavour}
-
-DEBUG:=-g -O0 -DDEBUG
-
-CFLAGS:=${DEBUG} -I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${gsoap_prefix}/include -I${gsoap_prefix} -I${stagedir}/include ${GLOBUS_CFLAGS} -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql
-LDFLAGS:=-L${stagedir}/lib
-
-LINK:=libtool --mode=link ${CC} ${LDFLAGS}
-LTCOMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
-SOLINK:=libtool --mode=link ${CC} -module ${LDFLAGS} -rpath ${stagedir}/lib
-LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS}
-INSTALL:=libtool --mode=install install
-
-daemon:=glite-jp-primarystoraged
-example:=jpps-test
-ps_prefix:=jpps_
-is_prefix:=jpis_
-
-plugins:=glite-jp-tags.la glite-jp-ftpdauth.la
-
-HDRS_I=file_plugin.h
-HDRS_S=builtin_plugins.h backend.h
-
-SRCS:= bones_server.c soap_ops.c \
- new_ftp_backend.c mysql.c file_plugin.c \
- feed.c authz.c attrs.c\
- is_client.c \
- env_C.c
-
-# ${ps_prefix}ServerLib.c \
-# ${is_prefix}ClientLib.c jpps_C.c
-
-EXA_SRCS:=jpps-test.c ${ps_prefix}C.c ${ps_prefix}Client.c
-
-gsoap_bin_prefix:=${shell if [ -x ${gsoap_prefix}/bin/soapcpp2 ]; then echo ${gsoap_prefix}/bin; else echo ${gsoap_prefix}; fi }
-
-OBJS:=${SRCS:.c=.o}
-EXA_OBJS:=${EXA_SRCS:.c=.o}
-
-dotless_soap_ver:=${shell echo ${gsoap_version} | tr -d . }
-COMMONLIB:=-lglite_jp_common
-BONESLIB:=-lglite_lb_server_bones
-GSOAPLIB:=-L${stagedir}/lib -lglite_security_gsoap_plugin_${dotless_soap_ver}_${nothrflavour}
-TRIOLIB:=-lglite_jp_trio
-
-ifneq (${mysql_prefix},/usr)
- ifeq ($(shell echo ${mysql_version} | cut -d. -f1,2),4.1)
- MYSQLIB := -L${mysql_prefix}/lib/mysql -lmysqlclient
- else
- MYSQLIB := -L${mysql_prefix}/lib -lmysqlclient
- endif
-else
- MYSQLIB := -lmysqlclient
-endif
-
-default all: compile
-
-compile: ${daemon} ${example} ${plugins}
-
-${daemon}: ${OBJS}
- ${LINK} -o $@ -export-dynamic ${OBJS} ${BONESLIB} ${TRIOLIB} ${COMMONLIB} ${GSOAPLIB} ${GLOBUS_LIBS} ${MYSQLIB}
-
-${example}: ${EXA_OBJS}
- ${LINK} -o $@ ${EXA_OBJS} ${GSOAPLIB} ${GLOBUS_LIBS}
-
-JobProvenancePS.xh: %.xh: %.wsdl JobProvenanceTypes.wsdl typemap.dat
- cp ${stagedir}/interface/JobProvenanceTypes.wsdl .
- ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ $<
- rm -f JobProvenanceTypes.wsdl
-
-JobProvenanceIS.xh: %.xh: %.wsdl JobProvenanceTypes.wsdl typemap.dat
- cp ${stagedir}/interface/JobProvenanceTypes.wsdl .
- ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ $<
- rm -f JobProvenanceTypes.wsdl
-
-
-${ps_prefix}Client.c ${ps_prefix}ClientLib.c \
-${ps_prefix}Server.c ${ps_prefix}ServerLib.c \
-${ps_prefix}C.c ${ps_prefix}H.h: JobProvenancePS.xh
- ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${ps_prefix} JobProvenancePS.xh
-
-${is_prefix}ClientLib.c ${is_prefix}Client.c \
-${is_prefix}C.c ${is_prefix}H.h: JobProvenanceIS.xh
- ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${is_prefix} JobProvenanceIS.xh
-
-soap_ops.o: ${ps_prefix}ServerLib.c soap_util.c
-
-is_client.o: ${is_prefix}ClientLib.c soap_util.c
-
-env_C.c env_Server.c:
- touch env.xh
- ${gsoap_bin_prefix}/soapcpp2 -w -c -p env_ env.xh
-
-#$(SOAP_PREFIX)H.h $(SOAP_PREFIX)C.c: LB.xh
-# $(GSOAP_BIN_PATH)/soapcpp2 -w -c -p $(SOAP_PREFIX) LB.xh
-#
-#LB.xh: LB.wsdl typemap.dat
-# $(GSOAP_BIN_PATH)/wsdl2h -c -o $@ LB.wsdl
-#
-
-
-bones_server.o simple_server.o: ${is_prefix}H.h ${ps_prefix}H.h
-
-check:
- -echo nothing yet
-
-doc:
-
-stage: compile
- ${MAKE} PREFIX=${stagedir} DOSTAGE=yes install
-
-dist: distsrc distbin
-
-distsrc:
- mkdir -p ${top_srcdir}/${package}-${version}
- cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version}
- cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version}
- rm -rf ${top_srcdir}/${package}-${version}
-
-distbin:
- $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir}
- save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir
- rm -rf tmpbuilddir
-
-install:
- -mkdir -p ${PREFIX}/bin ${PREFIX}/etc ${PREFIX}/examples ${PREFIX}/etc/init.d
- ${INSTALL} -m 755 ${daemon} ${PREFIX}/bin
- ${INSTALL} -m 755 jpps-test ${PREFIX}/examples/glite-jp-primary-test
- if [ x${DOSTAGE} = xyes ]; then \
- mkdir -p ${PREFIX}/include/${globalprefix}/${jpprefix} ; \
- (cd ${top_srcdir}/interface && install -m 644 ${HDRS_I} ${PREFIX}/include/${globalprefix}/${jpprefix}) ; \
- (cd ${top_srcdir}/src && install -m 644 ${HDRS_S} ${PREFIX}/include/${globalprefix}/${jpprefix}) ; \
- fi
- for plugin in ${plugins}; do \
- ${INSTALL} -m 755 $$plugin ${PREFIX}/lib; \
- done
- ${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-jp-primary
-
-clean:
-
-simple_server.o soap_ops.o jpps-test.o: ${ps_prefix}H.h
-
-# we have no real config.h but have to force gSoap not to use
-# linux ftime with broken (aka obsolete) DST information
-
-# stdsoap2.o: ${gsoap_prefix}/devel/stdsoap2.c
-# test -f config.h || touch config.h
-# @echo 'The following warning "time_t (de)serialization is not MT safe on this platform" is harmless'
-# ${CC} -o $@ -c -DWITH_NONAMESPACES -DHAVE_CONFIG_H ${CFLAGS} ${gsoap_prefix}/devel/stdsoap2.c
-#
-
-glite-jp-tags.la: tags_plugin.lo
- ${SOLINK} -o $@ tags_plugin.lo
-
-glite-jp-ftpdauth.la: ftpd_auth.lo mysql.lo
- ${SOLINK} -o $@ ftpd_auth.lo mysql.lo ${COMMONLIB} ${TRIOLIB} ${MYSQLIB}
-
-%.lo: %.c
- ${LTCOMPILE} -o $@ -c $<
-
-soap_ops.o bones_server.o: soap_version.h
-
-soap_version.h:
- ${gsoap_bin_prefix}/soapcpp2 /dev/null
- perl -ne '$$. == 2 && /.*([0-9])\.([0-9])\.([0-9]).*/ && printf "#define GSOAP_VERSION %d%02d%02d\n",$$1,$$2,$$3' soapH.h >$@
- -rm soapC.cpp soapH.h soapStub.h soapClient.cpp soapServer.cpp soapClientLib.cpp soapServerLib.cpp
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Build file for the GLite JP Primary module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.3 2004/11/22 14:00:19 dimeglio
- Updated to use standard files
- Fixed names (was using common instead of real module name)
-
- Revision 1.2 2004/11/22 13:55:30 dimeglio
- First version of this file
- Use central subsystem definition
-
- Revision 1.1.1.1 2004/10/15 09:49:24 akrenek
--->
-
-<project name="primary" default="dist">
-
- <!-- =========================================
- Builds the gLite JP Primary Module
- ========================================= -->
-
- <!-- =========================================
- Import properties (order is important)
- ========================================= -->
-
- <!-- import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- import component build properties,
- component properties &
- component common properties -->
- <import file="./project/properties.xml"/>
-
- <!-- import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="${subsystem.properties.file}"/>
-
- <!-- import global build properties &
- global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependency property files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${component.dependencies.file}" />
- <property file="${subsystem.dependencies.file}" />
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options (order is important)
- ========================================= -->
- <import file="${global.configure.options.file}"/>
- <import file="${component.configure.options.file}"/>
-
- <!-- =========================================
- Import task definitions (order is important)
- ========================================= -->
- <import file="${subsystem.taskdefs.file}" />
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Load common targets
- ========================================= -->
- <import file="${global.targets-simple_make.file}" />
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ==============================================
- Local private targets
- ============================================== -->
-
- <target name="localinit"
- description="Module specific initialization tasks">
-
- <antcall target="lbmakefiles" />
- </target>
-
- <target name="localcompile"
- description="Module specific compile tasks">
- </target>
-
- <target name="localclean"
- description="Module specific cleaning tasks">
- </target>
-
-</project>
+++ /dev/null
-create table jobs (
- jobid char(32) binary not null,
- dg_jobid varchar(255) binary not null,
- owner char(32) binary not null,
-
- reg_time datetime not null,
-
- primary key (jobid),
- unique (dg_jobid),
- index (owner),
- index (owner,reg_time)
-);
-
-create table files (
- jobid char(32) binary not null,
- filename varchar(255) binary not null,
- int_path mediumblob null,
- ext_url mediumblob null,
-
- state char(32) binary not null,
- deadline datetime null,
- ul_userid char(32) binary not null,
-
- primary key (jobid,filename),
- index (ext_url(255))
-);
-
-create table attrs (
- jobid char(32) binary not null,
- name varchar(255) binary not null,
- value mediumblob null,
-
- primary key (jobid,name)
-);
-
-create table users (
- userid char(32) binary not null,
- cert_subj varchar(255) binary not null,
-
- primary key (userid),
- unique (cert_subj)
-);
-
-create table backend_info (
- version char(32) binary not null
-);
-
-create table feeds (
- feedid char(32) binary not null,
- destination varchar(255) binary not null,
- expires datetime not null,
- cols mediumblob not null,
- query mediumblob not null,
-
- primary key (feedid)
-);
-
-create table fed_jobs (
- feedid char(32) binary not null,
- jobid char(32) binary not null,
-
- primary key (jobid,feedid)
-);
+++ /dev/null
-#!/bin/sh
-
-GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite}
-GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-${GLITE_LOCATION}/var}
-
-[ -f /etc/glite.conf ] && . /etc/glite.conf
-[ -f $GLITE_LOCATION/etc/glite-wms.conf ] && . $GLITE_LOCATION/etc/glite-wms.conf
-
-[ -f $GLITE_LOCATION/etc/jp.conf ] && . $GLITE_LOCATION/etc/jp.conf
-[ -f $GLITE_LOCATION_VAR/etc/jp.conf ] && . $GLITE_LOCATION_VAR/etc/jp.conf
-
-[ -f $HOME/.glite.conf ] && . $HOME/.glite.conf
-
-[ -n "$GLITE_JP_PRIMARY_PIDFILE" ] && pidfile=$GLITE_JP_PRIMARY_PIDFILE ||
- pidfile="$GLITE_LOCATION_VAR/glite-jp-primarystoraged.pid"
-
-unset creds
-
-GLITE_JP_PRIMARY_PORT=8901
-
-start()
-{
- if test -z "$GLITE_USER" ;then
- echo 'Error: GLITE_USER is not set'
- echo FAILED
- return 1
- fi
- if test -z "$GLOBUS_LOCATION" ;then
- echo 'Error: GLOBUS_LOCATION is not set'
- echo FAILED
- return 1
- fi
- if test -z "$GLITE_JP_PRIMARY_FTP_PORT" -o \
- -z "$GLITE_JP_PRIMARY_INTERNAL" -o -z "$GLITE_JP_PRIMARY_EXTERNAL" ;then
- echo 'Error: incomplete configuration (GLITE_JP_PRIMARY_FTP_PORT,' \
- 'GLITE_JP_PRIMARY_INTERNAL, or GLITE_JP_PRIMARY_EXTERNAL is not set'
- echo FAILED
- return 1
- fi
-
- if [ -n "$GLITE_HOST_CERT" -a -n "$GLITE_HOST_KEY" ] ;then
- creds="-c '$GLITE_HOST_CERT' -k '$GLITE_HOST_KEY'"
- X509_USER_CERT="$GLITE_HOST_CERT"
- X509_USER_KEY="$GLITE_HOST_KEY"
- fi
-
- if test -z "$creds"; then
- if su - $GLITE_USER -c "test -r /etc/grid-security/hostkey.pem -a -r /etc/grid-security/hostcert.pem"; then
- echo "$0: WARNING: /etc/grid-security/hostkey.pem readable by $GLITE_USER"
- creds="-c /etc/grid-security/hostcert.pem -k /etc/grid-security/hostkey.pem"
- X509_USER_CERT=/etc/grid-security/hostcert.pem
- X509_USER_KEY=/etc/grid-security/hostkey.pem
- fi
- fi
-
-
- [ -z "$creds" ] && echo $0: WARNING: No credentials specified. Using default lookup which is dangerous. >&2
-
- unset GLITE_JP_PRIMARY_DBCS_OPTION
- if test -n "$GLITE_JP_PRIMARY_DBCS"; then
- GLITE_JP_PRIMARY_DBCS_OPTION="-BD,'$GLITE_JP_PRIMARY_DBCS'"
- fi
-
- echo -n Starting glite-jp-primarystoraged ...
- su - $GLITE_USER -c " $GLITE_LOCATION/bin/glite-jp-primarystoraged \
- $creds -i '$pidfile'
- -BI,'$GLITE_JP_PRIMARY_INTERNAL' -BE,'$GLITE_JP_PRIMARY_EXTERNAL' \
- ${GLITE_JP_PRIMARY_DBCS_OPTION} " && echo " done" || echo " FAILED"
-
- echo -n Starting JP gridftp server ...
- su - $GLITE_USER -c "X509_USER_CERT=\"$X509_USER_CERT\" \
- X509_USER_KEY=\"$X509_USER_KEY\" \
- LD_PRELOAD=$GLITE_LOCATION/lib/glite-jp-ftpdauth.so \
- $GLOBUS_LOCATION/sbin/in.ftpd -a -S -p $GLITE_JP_PRIMARY_FTP_PORT & \
- pid=\$!; sleep 2; kill -0 \$pid" && echo " done" || echo " FAILED"
-}
-
-stop()
-{
- if [ -f "$pidfile" ]; then
- pid=`cat "$pidfile"`
- kill $pid
- echo -n Stopping glite-jp-primarystoraged \($pid\) ...
- try=0
- while ps p $pid >/dev/null 2>&1; do
- sleep 1;
- try=`expr $try + 1`
- if [ $try = 20 ]; then
- echo " giving up after $try retries"
- return 1
- fi
- done
- echo " done"
- rm -f "$pidfile"
- else
- echo "$pidfile" does not exist - glite-jp-primarystoraged not running? >&2
- return 1
- fi
-}
-
- # XXX
- echo >&2 'stopping JP gridftp server not implemented yet'
- return 1
-}
-
-status()
-{
- # XXX pidfile
- if netstat -an --inet | grep "^tcp .* 0.0.0.0:${GLITE_JP_PRIMARY_PORT} .*LISTEN" >/dev/null 2>&1 ;then
- echo glite-jp-primarystoraged running
- else
- echo glite-jp-primarystoraged not running
- return 1
- fi
-
- if netstat -an --inet | grep "^tcp .* 0.0.0.0:${GLITE_JP_PRIMARY_FTP_PORT} .*LISTEN" >/dev/null 2>&1 ;then
- echo JP gridftp server running
- else
- echo JP gridftp server not running
- return 1
- fi
-
- return 0
-}
-
-case x$1 in
- xstart) start;;
- xstop) stop;;
- xrestart) stop; start;;
- xstatus) status;;
- x*) echo usage: $0 start,stop,restart,status >&2
- exit 1;;
-esac
+++ /dev/null
-Create database:
-----------------
-
-$ mysqladmin -u root -p create jpps
-$ mysql -u root -p
-mysql> grant all privileges on jpps.* to jpps@localhost identified by '';
-
-$ mysql -p -u jpps jpps <config/glite-jp-primary-dbsetup.sql
-
-
-Start server:
--------------
-
-$ glite-jp-primarystoraged -P .libs/glite-jp-tags.so -P/wherever/it/is/glite_lb_plugin.so \
- -BI,/INTERNAL/PATH -BE,gsiftp://`hostname`/EXT/PREFIX -a trusted_peers
-
-$ LD_PRELOAD=.libs/glite-jp-ftpdauth.so GLITE_USER=ljocha X509_USER_PROXY=/home/ljocha/umbar.pem \
- FTPBE_INT_PREFIX=/INTERNAL/PATH \
- ${GLOBUS_LOCATION}/sbin/in.ftpd -a -s -p 8902 -v
-
-/INTENAL/PATH points to the directory where JP files are stored
-
-/EXT/PREFIX prefix in URLs to manipulate with these files -- ftp should be
-configured to map ftp://`hostname`/EXT/PREFIX/file to /INTERNAL/PATH/file
-
-trusted_peers line-by-line list of X509 subjects to be considered "trusted",
- i.e. services (like LB) we accept data from
-
-
-
-Register job:
--------------
-
-$ jpps-test RegisterJob JOBID OWNER
-
-Returns:
-- OK
-- File exists (Job already registered)
-- Operation not permitted (you are not a trusted peer)
-
-
-Check system attributes known from job registration:
-
-$ ./jpps-test GetJobAttr JOBID http://egee.cesnet.cz/en/WSDL/jp-system:owner
-$ ./jpps-test GetJobAttr JOBID http://egee.cesnet.cz/en/WSDL/jp-system:regtime
-
-
-Record JP tag:
---------------
-
-$ jpps-test RecordTag JPBID TagA 1 blah
-
-
-TODO
-
-
-Upload
-------
-
-Normal way:
-
-$ ./jpps-test startupload JOBID urn:org.glite.jp.primary:lb 1234 text/plain
-
-OK
-Destination: gsiftp://the.jp.server/EXT/PREFIX/some/strange/path
-Commit before: Fri Sep 8 14:38:53 2006
-
-$ globus-url-copy file://where/the/file/is/lb-dump-JOBID gsiftp://the.jp.server/EXT/PREFIX/some/strange/path
-$ ./jpps-test commitupload gsiftp://the.jp.server/EXT/PREFIX/some/strange/path
-OK
-
-Attacks:
-XX - upload something without startupload
-OK - repeated startupload
-XX - get uncommitted file
-XX - get file with different credentials
-XX - upload again comitted file
-
-
-
-
-
-Register feed
-
-$ jpps-test FeedIndex
-
-registers predefined feed, seen in database (table feeds), slaves should
-restart
-
-
-
-Batch feed
-
-$ jpps-test FeedIndex yes
+++ /dev/null
-#include <stdio.h>
-#include <sysexits.h>
-#include <string.h>
-#include <assert.h>
-
-#include "glite/security/glite_gsplugin.h"
-
-#include "jpps_H.h"
-#include "jpps_.nsmap"
-
-#include "jptype_map.h"
-
-#include "soap_version.h"
-#if GSOAP_VERSION <= 20602
-#define soap_call___jpsrv__RegisterJob soap_call___ns1__RegisterJob
-#define soap_call___jpsrv__StartUpload soap_call___ns1__StartUpload
-#define soap_call___jpsrv__CommitUpload soap_call___ns1__CommitUpload
-#define soap_call___jpsrv__RecordTag soap_call___ns1__RecordTag
-#define soap_call___jpsrv__FeedIndex soap_call___ns1__FeedIndex
-#define soap_call___jpsrv__FeedIndexRefresh soap_call___ns1__FeedIndexRefresh
-#define soap_call___jpsrv__GetJob soap_call___ns1__GetJob
-#endif
-
-
-static void usage(const char *me)
-{
- fprintf(stderr,"%s: [-s server-url] operation args \n\n"
- " operations are:\n"
- " RegisterJob jobid owner\n"
- " StartUpload jobid class commit_before mimetype\n"
- " CommitUpload destination\n"
- " RecordTag jobid tagname stringvalue\n"
- " GetJobFiles jobid\n"
- " GetJobAttr jobid attr\n"
- " FeedIndex [yes (history)]\n"
- " FeedIndexRefresh feedid\n"
- ,me);
-
- exit (EX_USAGE);
-}
-
-static int check_fault(struct soap *soap,int err) {
- struct SOAP_ENV__Detail *detail;
- struct jptype__genericFault *f;
- char *reason,indent[200] = " ";
-
- switch(err) {
- case SOAP_OK: puts("OK");
- break;
- case SOAP_FAULT:
- case SOAP_SVR_FAULT:
- if (soap->version == 2) {
- detail = soap->fault->SOAP_ENV__Detail;
- reason = soap->fault->SOAP_ENV__Reason;
- }
- else {
- detail = soap->fault->detail;
- reason = soap->fault->faultstring;
- }
- fputs(reason,stderr);
- putc('\n',stderr);
- assert(detail->__type == SOAP_TYPE__genericFault);
-#if GSOAP_VERSION >=20700
- f = ((struct _genericFault *) detail->fault)
-#else
- f = ((struct _genericFault *) detail->value)
-#endif
- -> jpelem__genericFault;
-
- while (f) {
- fprintf(stderr,"%s%s: %s (%s)\n",indent,
- f->source,f->text,f->description);
- f = f->reason;
- strcat(indent," ");
- }
- return -1;
-
- default: soap_print_fault(soap,stderr);
- return -1;
- }
- return 0;
-}
-
-/* FIXME: new wsdl */
-#if 0
-static struct jptype__Attribute sample_attr[] = {
- { OWNER, NULL },
- { TIME, "submitted" },
- { TAG, "test" },
-};
-
-static struct jptype__PrimaryQueryElement sample_query[][5] = {
- {
- { sample_attr+OWNER, EQUAL, "unknown", NULL },
- { NULL, 0, NULL, NULL }
- },
-};
-#endif
-
-static const char *orig2str(enum jptype__attrOrig orig)
-{
- switch (orig) {
- case jptype__attrOrig__SYSTEM: return "SYSTEM";
- case jptype__attrOrig__USER: return "USER";
- case jptype__attrOrig__FILE_: return "FILE";
- default: return "unknown";
- }
-}
-
-int main(int argc,char *argv[])
-{
- char *server = NULL;
- int opt;
- struct soap *soap = soap_new();
-
- if (argc < 2) usage(argv[0]);
-
- soap_init(soap);
- soap_set_namespaces(soap, jpps__namespaces);
-
- soap_register_plugin(soap,glite_gsplugin);
-
- while ((opt = getopt(argc,argv,"s:")) >= 0) switch (opt) {
- case 's': server = optarg;
- break;
- case '?': usage(argv[0]);
- }
-
- if (server) {
- argv += 2;
- argc -= 2;
- }
- else server = "http://localhost:8901";
-
- if (!strcasecmp(argv[1],"RegisterJob")) {
- struct _jpelem__RegisterJob in;
- struct _jpelem__RegisterJobResponse empty;
-
- if (argc != 4) usage(argv[0]);
- in.job = argv[2];
- in.owner = argv[3];
- check_fault(soap,
- soap_call___jpsrv__RegisterJob(soap,server,"",&in,&empty));
- } else if (!strcasecmp(argv[1], "StartUpload")) {
- struct _jpelem__StartUpload in;
- struct _jpelem__StartUploadResponse out;
-
- in.job = argv[2];
- in.class_ = argv[3];
- in.name = NULL;
- in.commitBefore = atoi(argv[4]) + time(NULL);
- in.contentType = argv[5];
-
- if (argc != 6) usage(argv[0]);
- if (!check_fault(soap,
- soap_call___jpsrv__StartUpload(soap, server, "",&in,&out)))
- {
- printf("Destination: %s\nCommit before: %s\n", out.destination, ctime(&out.commitBefore));
- }
- } else if (!strcasecmp(argv[1], "CommitUpload")) {
- struct _jpelem__CommitUpload in;
- struct _jpelem__CommitUploadResponse empty;
-
- in.destination = argv[2];
-
- if (argc != 3) usage(argv[0]);
- if (!check_fault(soap,
- soap_call___jpsrv__CommitUpload(soap, server, "",&in,&empty))) {
- /* OK */
- }
- } else if (!strcasecmp(argv[1], "RecordTag")) {
- struct _jpelem__RecordTag in;
- struct _jpelem__RecordTagResponse empty;
- struct jptype__tagValue tagval;
- struct jptype__stringOrBlob val;
-
- int seq = 0;
-
- if (argc != 5) usage(argv[0]);
-
- in.jobid = argv[2];
- in.tag = &tagval;
- tagval.name = argv[3];
- tagval.value = &val;
- val.string = argv[4];
- val.blob = NULL;
-
- if (!check_fault(soap,
- soap_call___jpsrv__RecordTag(soap, server, "",&in, &empty))) {
- /* OK */
- }
- }
- else if (!strcasecmp(argv[1],"FeedIndex")) {
- char *ap[2] = {
- "http://egee.cesnet.cz/en/Schema/LB/Attributes:RB",
- "http://egee.cesnet.cz/en/Schema/JP/System:owner"
- };
-
- struct jptype__stringOrBlob vals[] = {
- { "/O=CESNET/O=Masaryk University/CN=Ales Krenek", NULL },
- { "Done", NULL }
- };
-
- struct jptype__primaryQuery q[] = {
- {
- "http://egee.cesnet.cz/en/Schema/JP/System:owner",
- jptype__queryOp__EQUAL,
- NULL, vals, NULL
- },
- {
- "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus",
- jptype__queryOp__UNEQUAL,
- NULL, vals+1, NULL
- }
- }, *qp[] = { q, q+1 };
- struct _jpelem__FeedIndex in = {
- "http://some.index//",
- 2,ap,
- 2,qp,
- 0,
- 1
- };
- struct _jpelem__FeedIndexResponse out;
-
- in.history = argc >= 3 && !strcasecmp(argv[2],"yes");
-
- if (!check_fault(soap,soap_call___jpsrv__FeedIndex(soap,server,"",&in,&out)))
- {
- printf("FeedId: %s\nExpires: %s\n",out.feedId,ctime(&out.feedExpires));
- }
- }
-/* FIXME: new wsdl */
-#if 0
- } else if (!strcasecmp(argv[1], "FeedIndexRefresh")) {
- struct jpsrv__FeedIndexRefreshResponse r;
-
- if (argc != 3) usage(argv[0]);
- if (!check_fault(soap,
- soap_call_jpsrv__FeedIndexRefresh(soap, server, "",
- argv[2], &r))) {
- printf("FeedId: %s\nExpires: %s\n",r.feedId,ctime(&r.expires));
- }
- }
-#endif
- else if (!strcasecmp(argv[1],"GetJobFiles")) {
- struct _jpelem__GetJobFiles in;
- struct _jpelem__GetJobFilesResponse out;
-
- if (argc != 3) usage(argv[0]);
- in.jobid = argv[2];
-
- if (!check_fault(soap,soap_call___jpsrv__GetJobFiles(soap,server,"",
- &in,&out)))
- {
- int i;
-
- printf("JobFiles:\n");
-
- for (i=0; i<out.__sizefiles;i++) {
- printf("\tclass = %s, name = %s, url = %s\n",
- out.files[i]->class_,
- out.files[i]->name,
- out.files[i]->url);
- }
- }
-
- }
- else if (!strcasecmp(argv[1],"GetJobAttr")) {
- struct _jpelem__GetJobAttributes in;
- struct _jpelem__GetJobAttributesResponse out;
-
- if (argc != 4) usage(argv[0]);
- in.jobid = argv[2];
- in.__sizeattributes = 1;
- in.attributes = &argv[3];
-
- if (!check_fault(soap,soap_call___jpsrv__GetJobAttributes(soap,server,"",&in,&out)))
- {
- int i;
-
- puts("Attribute values:");
- for (i=0; i<out.__sizeattrValues; i++)
- printf("\t%s\t%s\t%s",
- out.attrValues[i]->value->string ?
- out.attrValues[i]->value->string :
- "binary",
- orig2str(out.attrValues[i]->origin),
- ctime(&out.attrValues[i]->timestamp));
-
- }
-
- }
- else usage(argv[0]);
-
- return 0;
-}
-
-
-/* XXX: we don't use it */
-SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} };
+++ /dev/null
-#ifndef __GLITE_JP_FILEPLUGIN
-#define __GLITE_JP_FILEPLUGIN
-
-/** Methods of the file plugin. */
-
-typedef struct _glite_jpps_fplug_op_t {
-
-/** Open a file.
-\param[in] fpctx Context of the plugin, returned by its init.
-\param[in] bhandle Handle of the file via JPPS backend.
-\param[in] uri URI (type) of the opened file.
-\param[out] handle Handle to the opened file structure, to be passed to other plugin functions.
-*/
- int (*open)(void *fpctx,void *bhandle,const char *uri,void **handle);
-
-/** Close the file. Free data associated to a handle */
- int (*close)(void *fpctx,void *handle);
-
-/** Retrieve value(s) of an attribute.
-\param[in] fpctx Plugin context.
-\param[in] handle Handle of the opened file.
-\param[in] attr Queried attribute.
-\param[out] attrval GLITE_JP_ATTR_UNDEF-terminated list of value(s) of the attribute.
- If there are more and there is an interpretation of their order
- they must be sorted, eg. current value of tag is the last one.
-\retval 0 success
-\retval ENOSYS this attribute is not defined by this type of file
-\retval ENOENT no value is present
-*/
- int (*attr)(void *fpctx,void *handle,const char *attr,glite_jp_attrval_t **attrval);
-
-/** File type specific operation.
-\param[in] fpctx Plugin context.
-\param[in] handle Handle of the opened file.
-\param[in] oper Code of the operation, specific for a concrete plugin.
-*/
- int (*generic)(void *fpctx,void *handle,int oper,...);
-
-} glite_jpps_fplug_op_t;
-
-/** Data describing a plugin. */
-typedef struct _glite_jpps_fplug_data_t {
- void *fpctx; /**< Context passed to plugin operations. */
- char **uris; /**< NULL-terminated list of file types (URIs)
- handled by the plugin. */
- char **classes; /**< The same as uris but filesystem-friendly
- (can be used to construct file names).*/
- char **namespaces; /**< Which attribute namespaces this plugin handles. */
-
- glite_jpps_fplug_op_t ops; /**< Plugin operations. */
-} glite_jpps_fplug_data_t;
-
-/** Initialisation function of the plugin.
- Called after dlopen(), must be named "init".
-\param[in] ctx JPPS context
-\param[out] data filled-in plugin data
-*/
-
-typedef int (*glite_jpps_fplug_init_t)(
- glite_jp_context_t ctx,
- glite_jpps_fplug_data_t *plugin_data
-);
-
-
-
-
-/* XXX: not really public interface follows */
-
-int glite_jpps_fplug_load(glite_jp_context_t ctx,int argc,char **argv);
-int glite_jpps_fplug_lookup(glite_jp_context_t ctx,const char *uri, glite_jpps_fplug_data_t ***plugin_data);
-int glite_jpps_fplug_lookup_byclass(glite_jp_context_t, const char *class,glite_jpps_fplug_data_t ***plugin_data,char **uri);
-
-#endif
+++ /dev/null
-#Sat Oct 15 06:52:14 CEST 2005
-module.build=39
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Configuration options for the gLite JP Primary module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.4 2005/06/03 11:56:49 akrenek
- make it build with the new ftp backend
-
- Revision 1.3 2004/11/22 13:55:30 dimeglio
- First version of this file
- Use central subsystem definition
-
- Revision 1.2 2004/10/15 12:19:28 akrenek
- build with gsoap 2.7 too
-
- Revision 1.1.1.1 2004/10/15 09:49:24 akrenek
--->
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <project name="LB Common configuration options">
- <target name="lbmakefiles">
- <exec executable="ln" failonerror="true">
- <arg line="-fs ${component.dir}/Makefile ${module.build.dir}/Makefile"/>
- </exec>
- <echo file="${module.build.dir}/Makefile.inc">
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-lbprefix=${subsystem.prefix}
-package=${module.package.name}
-PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
-globus_prefix=${with.globus.prefix}
-expat_prefix=${with.expat.prefix}
-ares_prefix=${with.ares.prefix}
-gsoap_prefix=${with.gsoap.prefix}
-gsoap_version=${ext.gsoap.version}
-mysql_prefix=${with.mysql.prefix}
-mysql_version=${ext.mysql.version}
-thrflavour=${with.globus.thr.flavor}
-nothrflavour=${with.globus.nothr.flavor}
-cppunit=${with.cppunit.prefix}
-jpproject=${subsystem.project.dir}
-project=${component.project.dir}
- </echo>
- </target>
- </project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Common build properties file for the gLite JP Primary component
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
--->
-
-<project name="JP Primary component common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property file="project/build.properties" />
-
- <!-- ======================================================
- Define corresponding subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${jp.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${jp.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define component properties
- ====================================================== -->
-
- <!-- Component name prefix -->
- <property name="component.prefix" value="primary" />
-
- <!-- ======================================================
- Define general component properties
- ====================================================== -->
-
- <import file="${component.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
-
-</project>
+++ /dev/null
-tar_exclude
-CVS
-build.xml
-build
-build.properties
-properties.xml
-configure.properties.xml
-.cvsignore
-.project
-.cdtproject
+++ /dev/null
-module.version=1.0.0
-module.age=1
+++ /dev/null
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <fcntl.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/attr.h"
-
-#include "feed.h"
-#include "backend.h"
-#include "attrs.h"
-#include "file_plugin.h"
-#include "builtin_plugins.h"
-
-static struct {
- char *class,*uri;
- glite_jpps_fplug_data_t **plugins;
- int nplugins;
-} *known_classes;
-
-static int tags_index;
-
-
-static void scan_classes(glite_jp_context_t ctx)
-{
- int i,j,k;
- glite_jpps_fplug_data_t *pd;
-
- if (!ctx->plugins) return;
- for (i=0; ctx->plugins[i]; i++) {
- pd = ctx->plugins[i];
-
- for (j=0; pd->classes[j]; j++) {
- for (k=0; known_classes && known_classes[k].class
- && strcmp(pd->classes[j],known_classes[k].class);
- k++);
- if (known_classes && known_classes[k].class) {
- known_classes[k].plugins = realloc(known_classes[k].plugins,
- (known_classes[k].nplugins + 2) * sizeof(glite_jpps_fplug_data_t *));
- known_classes[k].plugins[known_classes[k].nplugins++] = pd;
- known_classes[k].plugins[known_classes[k].nplugins] = NULL;
- }
- else {
- known_classes = realloc(known_classes,(k+2) * sizeof *known_classes);
- known_classes[k].class = pd->classes[j];
- known_classes[k].uri = pd->uris[j];
- known_classes[k].plugins = malloc(2 * sizeof(glite_jpps_fplug_data_t *));
- known_classes[k].plugins[0] = pd;
- known_classes[k].plugins[1] = NULL;
- known_classes[k].nplugins = 1;
- memset(known_classes+k+1,0,sizeof *known_classes);
- if (!strcmp(known_classes[k].uri,GLITE_JP_FILETYPE_TAGS)) tags_index = k;
- }
- }
- }
-}
-
-static int merge_attrvals(glite_jp_attrval_t **out,int nout,const glite_jp_attrval_t *in)
-{
- int nin;
-
- if (!in) return nout;
-
- for (nin=0; in[nin].name; nin++);
- *out = realloc(*out,(nout+nin+1) * sizeof **out);
- memcpy(*out + nout,in,(nin+1) * sizeof **out);
- return nout+nin;
-}
-
-glite_jpps_get_attrs(glite_jp_context_t ctx,const char *job,char **attr,int nattr,glite_jp_attrval_t **attrs_out)
-{
- glite_jp_attrval_t *meta = NULL,*out = NULL;
- char const **other = NULL;
- int i,j,nmeta,nother,err = 0,nout = 0;
-
- struct { int class_idx;
- char *name;
- } *files = NULL;
- int nfiles = 0;
-
- nmeta = nother = 0;
- glite_jp_clear_error(ctx);
-
-/* sort the queried attributes to backend metadata and others -- retrived by plugins
- * XXX: assumes unique values for metadata.
- */
- for (i=0; i<nattr; i++) {
- if (glite_jppsbe_is_metadata(ctx,attr[i])) {
- meta = realloc(meta,(nmeta+2) * sizeof *meta);
- memset(meta+nmeta,0,2 * sizeof *meta);
- meta[nmeta].name = strdup(attr[i]);
- nmeta++;
- }
- else {
- other = realloc(other,(nother+2) * sizeof *other);
- other[nother++] = attr[i]; /* XXX: not strdupped */
- other[nother] = NULL;
- }
- }
-
-/* retrieve the metadata */
- if (meta && (err = glite_jppsbe_get_job_metadata(ctx,job,meta))) goto cleanup;
-
- if (!known_classes) scan_classes(ctx);
-
-/* build a list of available files for this job */
- files = malloc(sizeof *files);
- files->class_idx = tags_index;
- files->name = NULL;
- nfiles = 1;
-
- for (i=0; known_classes[i].class; i++) {
- char **names = NULL;
- int nnames =
- glite_jppsbe_get_names(ctx,job,known_classes[i].class,&names);
- if (nnames < 0) continue; /* XXX: error ignored */
-
- if (nnames > 0) {
- files = realloc(files,(nfiles+nnames+1) * sizeof *files);
- for (j=0; j<nnames; j++) {
- files[nfiles].class_idx = i;
- files[nfiles++].name = names[j];
- }
- }
- free(names);
- }
-
-/* loop over the files */
- for (i=0; i<nfiles; i++) {
- void *beh;
- int ci;
-
- /* XXX: ignore error */
- if (!glite_jppsbe_open_file(ctx,job,
- known_classes[ci = files[i].class_idx].class,
- files[i].name,O_RDONLY,&beh))
- {
- for (j=0; j<known_classes[ci].nplugins; j++) {
- void *ph;
-
- glite_jpps_fplug_data_t *p =
- known_classes[ci].plugins[j];
- /* XXX: ignore error */
- if (!p->ops.open(p->fpctx,beh,known_classes[ci].uri,&ph)) {
-
- for (j=0; j<nother; j++) {
- glite_jp_attrval_t *myattr;
- /* XXX: ignore errors */
- if (!p->ops.attr(p->fpctx,ph,other[j],&myattr)) {
- int k;
- for (k=0; myattr[k].name; k++) {
- myattr[k].origin = GLITE_JP_ATTR_ORIG_FILE;
- trio_asprintf(&myattr[k].origin_detail,"%s %s",
- known_classes[ci].uri,
- files[i].name ? files[i].name : "");
- }
- nout = merge_attrvals(&out,nout,myattr);
- free(myattr);
- }
-
- }
- p->ops.close(p->fpctx,ph);
- }
- }
-
- glite_jppsbe_close_file(ctx,beh);
- }
- }
-
- nout = merge_attrvals(&out,nout,meta);
- free(meta); meta = NULL;
-
- if (nout) {
- *attrs_out = out;
- err = 0;
- }
- else {
- glite_jp_error_t e;
- e.code = ENOENT;
- e.source = __FUNCTION__;
- e.desc = "no attributes found";
- err = glite_jp_stack_error(ctx,&e);
- }
-
-cleanup:
- if (meta) for (i=0; i<nmeta; i++) glite_jp_attrval_free(meta+i,0);
- free(meta);
-
- free(other);
-
- if (files) for (i=0; i<nfiles; i++) free(files[i].name);
- free(files);
-
- return err;
-}
+++ /dev/null
-int glite_jpps_get_attrs(glite_jp_context_t,const char *,char **,int,glite_jp_attrval_t **);
+++ /dev/null
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <assert.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "jpps_H.h"
-#include "jptype_map.h"
-
-int glite_jpps_authz(glite_jp_context_t ctx,int op,const char *job,const char *owner)
-{
- glite_jp_error_t err;
- char buf[200];
- int i;
-
- memset(&err,0,sizeof err);
- glite_jp_clear_error(ctx);
- err.source = __FUNCTION__;
- err.code = EPERM;
-
- switch (op) {
- case SOAP_TYPE___jpsrv__RegisterJob:
- case SOAP_TYPE___jpsrv__StartUpload:
- case SOAP_TYPE___jpsrv__CommitUpload:
- for (i=0; ctx->trusted_peers && ctx->trusted_peers[i]; i++)
- if (!strcmp(ctx->trusted_peers[i],ctx->peer)) return 0;
- err.desc = "you are not a trusted peer";
- return glite_jp_stack_error(ctx,&err);
-
- case SOAP_TYPE___jpsrv__GetJobFiles:
- case SOAP_TYPE___jpsrv__GetJobAttributes:
- assert(owner);
- return strcmp(owner,ctx->peer) ? glite_jp_stack_error(ctx,&err) : 0;
- break;
-
- default:
- snprintf(buf,sizeof buf,"%d: unknown operation",op);
- err.desc = buf;
- err.code = EINVAL;
- return glite_jp_stack_error(ctx,&err);
- }
-}
-
-int glite_jpps_readauth(glite_jp_context_t ctx,const char *file)
-{
- FILE *f = fopen(file,"r");
- glite_jp_error_t err;
- int cnt = 0;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
- if (!f) {
- err.code = errno;
- err.desc = file;
- return glite_jp_stack_error(ctx,&err);
- }
-
- ctx->trusted_peers = NULL;
- while (!feof(f)) {
- char buf[BUFSIZ];
-
- if (fscanf(f,"%[^\n]\n",buf) != 1) {
- err.code = EINVAL;
- err.desc = file;
- fclose(f);
- return glite_jp_stack_error(ctx,&err);
- }
-
- ctx->trusted_peers = realloc(ctx->trusted_peers, (cnt+2) * sizeof *ctx->trusted_peers);
- ctx->trusted_peers[cnt++] = strdup(buf);
- ctx->trusted_peers[cnt] = NULL;
- }
- fclose(f);
- return 0;
-}
+++ /dev/null
-/**
- * Check authorisation of JPPS operation on job.
- *
- * \param[in] ctx JP context including peer name & other credentials (VOMS etc.)
- * \param[in] op operation, one of SOAP_TYPE___jpsrv__*
- * \param[in] job jobid of the job to decide upon
- * \param[in] owner current known owner of the job (may be NULL), shortcut to avoid
- * unnecessary database query.
- *
- * \retval 0 OK, operation permitted
- * \retval EPERM denied
- * \retval other error
- */
-
-int glite_jpps_authz(glite_jp_context_t ctx,int op,const char *job,const char *owner);
-
-int glite_jpps_readauth(glite_jp_context_t ctx,const char *file);
-
+++ /dev/null
-#ifndef __GLITE_JP_BACKEND
-#define __GLITE_JP_BACKEND
-
-#include <sys/types.h>
-#include <unistd.h>
-
-int glite_jppsbe_init(
- glite_jp_context_t ctx,
- int argc,
- char *argv[]
-);
-
-int glite_jppsbe_init_slave(
- glite_jp_context_t ctx
-);
-
-int glite_jppsbe_register_job(
- glite_jp_context_t ctx,
- const char *job,
- const char *owner
-);
-
-int glite_jppsbe_start_upload(
- glite_jp_context_t ctx,
- const char *job,
- const char *class, /* must be filesystem-friendly */
- const char *name, /* optional name within the class */
- const char *content_type,
- char **destination_out,
- time_t *commit_before_inout
-);
-
-int glite_jppsbe_commit_upload(
- glite_jp_context_t ctx,
- const char *destination
-);
-
-int glite_jppsbe_get_names(
- glite_jp_context_t ctx,
- const char *job,
- const char *class,
- char ***names_out
-);
-
-int glite_jppsbe_destination_info(
- glite_jp_context_t ctx,
- const char *destination,
- char **job_out,
- char **class_out,
- char **name_out
-);
-
-int glite_jppsbe_get_job_url(
- glite_jp_context_t ctx,
- const char *job,
- const char *class,
- const char *name, /* optional within class */
- char **url_out
-);
-
-int glite_jppsbe_open_file(
- glite_jp_context_t ctx,
- const char *job,
- const char *class,
- const char *name, /* optional within class */
- int mode,
- void **handle_out
-);
-
-int glite_jppsbe_close_file(
- glite_jp_context_t ctx,
- void *handle
-);
-
-int glite_jppsbe_pread(
- glite_jp_context_t ctx,
- void *handle,
- void *buf,
- size_t nbytes,
- off_t offset,
- ssize_t *nbytes_ret
-);
-
-int glite_jppsbe_pwrite(
- glite_jp_context_t ctx,
- void *handle,
- void *buf,
- size_t nbytes,
- off_t offset
-);
-
-int glite_jppsbe_append(
- glite_jp_context_t ctx,
- void *handle,
- void *buf,
- size_t nbytes
-);
-
-int glite_jppsbe_is_metadata(
- glite_jp_context_t ctx,
- const char *attr
-);
-
-int glite_jppsbe_get_job_metadata(
- glite_jp_context_t ctx,
- const char *job,
- glite_jp_attrval_t attrs_inout[]
-);
-
-int glite_jppsbe_query(
- glite_jp_context_t ctx,
- const glite_jp_query_rec_t query[],
- char *attrs[],
- void *arg,
- int (*callback)(
- glite_jp_context_t ctx,
- const char *job,
- const glite_jp_attrval_t metadata[],
- void *arg
- )
-);
-
-/** mark the job as sent to this feed */
-int glite_jppsbe_set_fed(
- glite_jp_context_t ctx,
- const char *feed,
- const char *job
-);
-
-/** check whether the job has been already sent to this feed */
-int glite_jppsbe_check_fed(
- glite_jp_context_t ctx,
- const char *feed,
- const char *job,
- int *result
-);
-
-/** store the feed to database */
-int glite_jppsbe_store_feed(
- glite_jp_context_t ctx,
- struct jpfeed *feed
-);
-
-/** purge expired feeds */
-int glite_jppsbe_purge_feeds(
- glite_jp_context_t ctx
-);
-
-/** read stored feed into context */
-int glite_jppsbe_read_feeds(
- glite_jp_context_t ctx
-);
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "glite/lb/srvbones.h"
-#include "glite/security/glite_gss.h"
-
-#include <stdsoap2.h>
-#include "glite/security/glite_gsplugin.h"
-
-#include "feed.h"
-#include "backend.h"
-#include "file_plugin.h"
-
-#include "soap_version.h"
-#include "jpps_H.h"
-
-#define CONN_QUEUE 20
-
-extern SOAP_NMAC struct Namespace jpis__namespaces[],jpps__namespaces[];
-
-static int newconn(int,struct timeval *,void *);
-static int request(int,struct timeval *,void *);
-static int reject(int);
-static int disconn(int,struct timeval *,void *);
-static int data_init(void **data);
-
-static struct glite_srvbones_service stab = {
- "JP Primary Storage", -1, newconn, request, reject, disconn
-};
-
-static time_t cert_mtime;
-char *server_cert, *server_key, *cadir;
-gss_cred_id_t mycred = GSS_C_NO_CREDENTIAL;
-static char *mysubj;
-
-static char *port = "8901";
-static int debug = 0;
-
-static glite_jp_context_t ctx;
-
-static int call_opts(glite_jp_context_t,char *,char *,int (*)(glite_jp_context_t,int,char **));
-
-const char *glite_jp_default_namespace;
-
-pid_t master;
-
-int main(int argc, char *argv[])
-{
- int one = 1,opt,i;
- edg_wll_GssStatus gss_code;
- struct sockaddr_in a;
- char *b_argv[20] = { "backend" },*p_argv[20] = { "plugins" },*com;
- int b_argc,p_argc;
- char buf[1000];
- int slaves = 10;
- char *logfile = "/dev/null";
- char pidfile[PATH_MAX] = "/var/run/glite-jp-primarystoraged.pid";
- FILE *fpid;
-
- glite_jp_init_context(&ctx);
- globus_libc_gethostname(buf,sizeof buf);
- buf[999] = 0;
- ctx->myURL = buf;
-
- if (geteuid()) snprintf(pidfile,sizeof pidfile,"%s/glite-jp-primarystoraged.pid",getenv("HOME"));
-
- b_argc = p_argc = 1;
-
- while ((opt = getopt(argc,argv,"B:P:a:p:s:dl:i:c:k:")) != EOF) switch (opt) {
- case 'B':
- assert(b_argc < 20);
- if (com = strchr(optarg,',')) *com = 0;
-
- /* XXX: memleak -- who cares for once */
- asprintf(&b_argv[b_argc++],"-%s",optarg);
- if (com) b_argv[b_argc++] = com+1;
-
- break;
- case 'P':
- assert(p_argc < 20);
- p_argv[p_argc++] = optarg;
-
- break;
- case 'a':
- if (glite_jpps_readauth(ctx,optarg)) {
- fprintf(stderr,"%s: %s\n",argv[0],glite_jp_error_chain(ctx));
- exit (1);
- }
- break;
- case 'p':
- port = optarg;
- break;
- case 'd': debug = 1; break;
- case 's': slaves = atoi(optarg);
- if (slaves <= 0) {
- fprintf(stderr,"%s: -s %s: invalid number\n",argv[0],optarg);
- exit(1);
- }
- break;
- case 'l': logfile = optarg; break;
- case 'i': strncpy(pidfile,optarg,PATH_MAX); pidfile[PATH_MAX-1] = 0; break;
- case 'c': server_cert = optarg; break;
- case 'k': server_key = optarg; break;
- case '?': fprintf(stderr,"usage: %s: -Bb,val ... -Pplugin.so ...\n"
- "b is backend option\n",argv[0]);
- exit (1);
- }
-
- if (b_argc == 1) {
- fputs("-B required\n",stderr);
- exit (1);
- }
-
- optind = 0; /* XXX: getopt used internally */
- if (glite_jppsbe_init(ctx,b_argc,b_argv)) {
- fputs(glite_jp_error_chain(ctx), stderr);
- exit(1);
- }
-
- optind = 0; /* XXX: getopt used internally */
- if (b_argc > 1 && glite_jpps_fplug_load(ctx,p_argc,p_argv)) {
- fputs(glite_jp_error_chain(ctx), stderr);
- exit(1);
- }
-
- srand48(time(NULL)); /* feed id generation */
-
-#if GSOAP_VERSION <= 20602
- for (i=0; jpps__namespaces[i].id && strcmp(jpps__namespaces[i].id,"ns1"); i++);
-#else
- for (i=0; jpps__namespaces[i].id && strcmp(jpps__namespaces[i].id,"jpsrv"); i++);
-#endif
- assert(jpps__namespaces[i].id);
- glite_jp_default_namespace = jpps__namespaces[i].ns;
-
- stab.conn = socket(PF_INET, SOCK_STREAM, 0);
- if (stab.conn < 0) {
- perror("socket");
- return 1;
- }
-
- setsockopt(stab.conn,SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
-
- a.sin_family = AF_INET;
- a.sin_addr.s_addr = INADDR_ANY;
- a.sin_port = htons(atoi(port));
- if (bind(stab.conn,(struct sockaddr *) &a, sizeof(a)) ) {
- char buf[200];
-
- snprintf(buf,sizeof(buf),"bind(%d)",atoi(port));
- perror(buf);
- return 1;
- }
-
- if (listen(stab.conn,CONN_QUEUE)) {
- perror("listen()");
- return 1;
- }
-
- if (!server_cert || !server_key)
- fprintf(stderr, "%s: WARNING: key or certificate file not specified, "
- "can't watch them for changes\n",
- argv[0]);
-
- if ( cadir ) setenv("X509_CERT_DIR", cadir, 1);
- edg_wll_gss_watch_creds(server_cert, &cert_mtime);
-
- if ( !edg_wll_gss_acquire_cred_gsi(server_cert, server_key, &mycred, &mysubj, &gss_code))
- fprintf(stderr,"Server idenity: %s\n",mysubj);
- else fputs("WARNING: Running unauthenticated\n",stderr);
-
- /* XXX: daemonise */
-
- if (!debug) {
- int lfd = open(logfile,O_CREAT|O_TRUNC|O_WRONLY,0600);
- if (lfd < 0) {
- fprintf(stderr,"%s: %s: %s\n",argv[0],logfile,strerror(errno));
- exit(1);
- }
- daemon(0,1);
- dup2(lfd,1);
- dup2(lfd,2);
- }
-
- setpgrp(); /* needs for signalling */
- master = getpid();
- fpid = fopen(pidfile,"r");
- if ( fpid )
- {
- int opid = -1;
-
- if ( fscanf(fpid,"%d",&opid) == 1 )
- {
- if ( !kill(opid,0) )
- {
- fprintf(stderr,"%s: another instance running, pid = %d\n",argv[0],opid);
- return 1;
- }
- else if (errno != ESRCH) { perror("kill()"); return 1; }
- }
- fclose(fpid);
- } else if (errno != ENOENT) { perror(pidfile); return 1; }
-
- fpid = fopen(pidfile, "w");
- if (!fpid) { perror(pidfile); return 1; }
- fprintf(fpid, "%d", getpid());
- fclose(fpid);
-
- glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT,slaves);
- glite_srvbones_run(data_init,&stab,1 /* XXX: entries in stab */,debug);
-
- return 0;
-}
-
-static int data_init(void **data)
-{
- *data = (void *) soap_new();
-
- printf("[%d] slave started\n",getpid());
- glite_jppsbe_init_slave(ctx); /* XXX: global but slave's */
- sleep(10);
- if (glite_jppsbe_read_feeds(ctx)) fputs(glite_jp_error_chain(ctx),stderr);
- printf("[%d] slave init done\n",getpid());
-
- return 0;
-}
-
-static int newconn(int conn,struct timeval *to,void *data)
-{
- struct soap *soap = (struct soap *) data;
- glite_gsplugin_Context plugin_ctx;
-
- gss_cred_id_t newcred = GSS_C_NO_CREDENTIAL;
- edg_wll_GssStatus gss_code;
- gss_name_t client_name = GSS_C_NO_NAME;
- gss_buffer_desc token = GSS_C_EMPTY_BUFFER;
- OM_uint32 maj_stat,min_stat;
-
-
- int ret = 0;
-
- soap_init2(soap,SOAP_IO_KEEPALIVE,SOAP_IO_KEEPALIVE);
- soap_set_namespaces(soap,jpps__namespaces);
- soap->user = (void *) ctx; /* XXX: one instance per slave */
-
- glite_gsplugin_init_context(&plugin_ctx);
- plugin_ctx->connection = calloc(1,sizeof *plugin_ctx->connection);
-
- switch (edg_wll_gss_watch_creds(server_cert,&cert_mtime)) {
- case 0: break;
- case 1: if (!edg_wll_gss_acquire_cred_gsi(server_cert,server_key,
- &newcred,NULL,&gss_code))
- {
-
- printf("[%d] reloading credentials\n",getpid()); /* XXX: log */
- gss_release_cred(&min_stat,&mycred);
- mycred = newcred;
-
- /* drop it too, it is recreated and reloads creds when necessary */
- if (ctx->other_soap) {
- soap_end(ctx->other_soap);
- soap_free(ctx->other_soap);
- ctx->other_soap = NULL;
- }
- }
- break;
- case -1:
- printf("[%d] edg_wll_gss_watch_creds failed\n", getpid()); /* XXX: log */
- break;
- }
-
- /* TODO: DNS paranoia etc. */
-
- if (edg_wll_gss_accept(mycred,conn,to,plugin_ctx->connection,&gss_code)) {
- char *et;
-
- edg_wll_gss_get_error(&gss_code,"",&et);
-
- fprintf(stderr,"[%d] GSS connection accept failed: %s\nClosing connection.\n",getpid(),et);
- free(et);
- ret = 1;
- goto cleanup;
- }
-
- maj_stat = gss_inquire_context(&min_stat,plugin_ctx->connection->context,
- &client_name, NULL, NULL, NULL, NULL, NULL, NULL);
-
- if (!GSS_ERROR(maj_stat))
- maj_stat = gss_display_name(&min_stat,client_name,&token,NULL);
-
- if (ctx->peer) free(ctx->peer);
- if (!GSS_ERROR(maj_stat)) {
- printf("[%d] client DN: %s\n",getpid(),(char *) token.value); /* XXX: log */
-
- ctx->peer = strdup(token.value);
- memset(&token, 0, sizeof(token));
- }
- else {
- printf("[%d] annonymous client\n",getpid());
- ctx->peer = NULL;
- }
-
- if (client_name != GSS_C_NO_NAME) gss_release_name(&min_stat, &client_name);
- if (token.value) gss_release_buffer(&min_stat, &token);
-
- soap_register_plugin_arg(soap,glite_gsplugin,plugin_ctx);
- return 0;
-
-cleanup:
- glite_gsplugin_free_context(plugin_ctx); plugin_ctx = NULL;
- soap_end(soap);
-
- return ret;
-}
-
-static int request(int conn,struct timeval *to,void *data)
-{
- struct soap *soap = data;
- glite_jp_context_t ctx = soap->user;
-
- glite_gsplugin_set_timeout(glite_gsplugin_get_context(soap),to);
-
- soap->max_keep_alive = 1; /* XXX: prevent gsoap to close connection */
- soap_begin(soap);
- if (soap_begin_recv(soap)) {
- if (soap->error < SOAP_STOP) {
- soap_send_fault(soap);
- return EIO;
- }
- return ENOTCONN;
- }
-
- soap->keep_alive = 1;
- if (soap_envelope_begin_in(soap)
- || soap_recv_header(soap)
- || soap_body_begin_in(soap)
- || jpps__serve_request(soap)
-#if GSOAP_VERSION >= 20700
- || (soap->fserveloop && soap->fserveloop(soap))
-#endif
- )
- {
- soap_send_fault(soap);
- if (ctx->error) {
- /* XXX: shall we die on some errors? */
- int err = ctx->error->code;
- glite_jp_clear_error(ctx);
- return err;
- }
- return 0;
- }
-
- if (glite_jp_run_deferred(ctx)) {
- char *e;
- fprintf(stderr,"[%d] %s\n",getpid(),e = glite_jp_error_chain(ctx));
- free(e);
- }
- return 0;
-}
-
-static int reject(int conn)
-{
- int flags = fcntl(conn, F_GETFL, 0);
-
- fcntl(conn,F_SETFL,flags | O_NONBLOCK);
- edg_wll_gss_reject(conn);
-
- return 0;
-}
-
-static int disconn(int conn,struct timeval *to,void *data)
-{
- struct soap *soap = (struct soap *) data;
- glite_jp_context_t ctx = soap->user;
-
- soap_end(soap); // clean up everything and close socket
- if (ctx->other_soap) {
- soap_end(ctx->other_soap);
- soap_free(ctx->other_soap);
- ctx->other_soap = NULL;
- }
-
- return 0;
-}
-
-#define WSPACE "\t\n "
-
-static int call_opts(glite_jp_context_t ctx,char *opt,char *name,int (*f)(glite_jp_context_t,int,char **))
-{
- int ac = 1,ret,my_optind;
- char **av = malloc(sizeof *av),*ap;
-
- *av = name;
- for (ap = strtok(opt,WSPACE); ap; ap = strtok(NULL,WSPACE)) {
- av = realloc(av,(ac+1) * sizeof *av);
- av[ac++] = ap;
- }
-
- my_optind = optind;
- optind = 0;
- ret = f(ctx,ac,av);
- optind = my_optind;
- free(av);
- return ret;
-}
-
-
-/* XXX: we don't use it */
-SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} };
+++ /dev/null
-
-#define GLITE_JP_FILETYPE_TAGS "urn:org.glite.jp.primary:tags"
-#define GLITE_JP_FILETYPE_LB "urn:org.glite.jp.primary:lb"
-#define GLITE_JP_FILETYPE_ISB "urn:org.glite.jp.primary:isb"
-#define GLITE_JP_FILETYPE_OSB "urn:org.glite.jp.primary:osb"
-
-#define GLITE_JP_FPLUG_TAGS_APPEND 0
+++ /dev/null
-#ifndef _DB_H
-#define _DB_H
-
-#ident "$Header$"
-
-#include <sys/types.h>
-#include <sys/time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-typedef struct _glite_jp_db_stmt_t *glite_jp_db_stmt_t;
-
-int glite_jp_db_connect(
- glite_jp_context_t, /* INOUT: */
- char * /* IN: connect string user/password@host:database */
-);
-
-void glite_jp_db_close(glite_jp_context_t);
-
-
-/* Parse and execute SQL statement. Returns number of rows selected, created
- * or affected by update, or -1 on error */
-
-int glite_jp_db_execstmt(
- glite_jp_context_t, /* INOUT: */
- char *, /* IN: SQL statement */
- glite_jp_db_stmt_t * /* OUT: statement handle. Usable for
- select only */
-);
-
-
-/* Fetch next row of select statement.
- * All columns are returned as fresh allocated strings
- *
- * return values:
- * >0 - number of fields of the retrieved row
- * 0 - no more rows
- * -1 - error
- *
- * Errors are stored in context passed to previous glite_jp_db_execstmt() */
-
-int glite_jp_db_fetchrow(
- glite_jp_db_stmt_t, /* IN: statement */
- char ** /* OUT: array of fetched values.
- * As number of columns is fixed and known,
- * expects allocated array of pointers here */
-);
-
-/* Retrieve column names of a query statement */
-
-int glite_jp_db_querycolumns(
- glite_jp_db_stmt_t, /* IN: statement */
- char ** /* OUT: result set column names. Expects allocated array. */
-);
-
-/* Free the statement structure */
-
-void glite_jp_db_freestmt(
- glite_jp_db_stmt_t * /* INOUT: statement */
-);
-
-
-/* convert time_t into database-specific time string
- * returns pointer to static area that is changed by subsequent calls */
-
-char *glite_jp_db_timetodb(time_t);
-time_t glite_jp_db_dbtotime(char *);
-
-
-/**
- * Check database version.
- */
-int glite_jp_db_dbcheckversion(glite_jp_context_t);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-#include <stdio.h>
-#include <time.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <signal.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-#include "glite/jp/strmd5.h"
-#include "glite/jp/known_attr.h"
-#include "feed.h"
-#include "file_plugin.h"
-#include "builtin_plugins.h"
-#include "is_client.h"
-#include "backend.h"
-
-extern pid_t master;
-
-/*
- * seconds before feed expires: should be
- * XXX: should be configurable, default for real deployment sort of 1 hour
- */
-#define FEED_TTL 3600
-
-/* XXX: configurable */
-#define BATCH_FEED_SIZE 200
-
-static int check_qry_item(
- glite_jp_context_t ctx,
- const glite_jp_query_rec_t *qry,
- const glite_jp_attrval_t *attr
-)
-{
- int cmp,cmp2;
- long scmp,ucmp;
- glite_jp_attrval_t qattr;
-
- if (strcmp(qry->attr,attr->name)) return 0;
-
- if (qry->origin != GLITE_JP_ATTR_ORIG_ANY && qry->origin != attr->origin) return 0;
-
- memset(&qattr,0,sizeof qattr);
- qattr.name = qry->attr;
- qattr.value = qry->value;
- qattr.binary = qry->binary;
- qattr.size = qry->size;
- qattr.origin = qry->origin;
-
- /* XXX: don't assert */
- assert(glite_jp_attrval_cmp(ctx,attr,&qattr,&cmp) == 0);
-
- switch (qry->op) {
- case GLITE_JP_QUERYOP_EQUAL: return !cmp;
- case GLITE_JP_QUERYOP_UNEQUAL: return cmp;
- case GLITE_JP_QUERYOP_LESS: return cmp < 0;
- case GLITE_JP_QUERYOP_GREATER: return cmp > 0;
-
- case GLITE_JP_QUERYOP_WITHIN:
- qattr.value = qry->value2;
- qattr.size = qry->size2;
- /* XXX: assert */
- assert(glite_jp_attrval_cmp(ctx,attr,&qattr,&cmp2) == 0);
- return cmp >= 0 && cmp2 <= 0;
- }
-}
-
-/* retrieve all attributes for a feed */
-int full_feed(
- glite_jp_context_t ctx,
- const struct jpfeed *feed,
- const char *job,
- glite_jp_attrval_t **attrs)
-{
- int i,ret;
- char **ma;
-
- for (i=0; feed->attrs[i]; i++);
- ma = malloc((i+2) * sizeof *ma);
- ma[0] = GLITE_JP_ATTR_OWNER;
- memcpy(ma+1,feed->attrs,(i+1) * sizeof *ma);
- ret = glite_jpps_get_attrs(ctx,job,ma,i+1,attrs);
- free(ma);
- return ret;
-}
-
-/* XXX: limit on query size -- I'm lazy to malloc() */
-#define QUERY_MAX 100
-
-static int match_feed(
- glite_jp_context_t ctx,
- const struct jpfeed *feed,
- const char *job,
-
-/* XXX: not checked for correctness,
- assuming single occurence only */
- const glite_jp_attrval_t attrs[]
-)
-{
- int i,fed;
- int qi[QUERY_MAX];
- char *owner = NULL;
- glite_jp_attrval_t meta[QUERY_MAX+1];
- glite_jp_attrval_t *newattr = NULL;
-
- glite_jp_clear_error(ctx);
- memset(meta,0,sizeof meta);
-
- if (feed->qry) {
- int j,complete = 1;
-
- memset(qi,0,sizeof qi);
- for (i=0; feed->qry[i].attr; i++) {
- int sat = 0;
- assert(i<QUERY_MAX);
- for (j=0; !sat && attrs[j].name; j++)
- if (!strcmp(attrs[j].name,feed->qry[i].attr)) {
- if (check_qry_item(ctx,feed->qry+i,attrs+j)) {
- qi[i] = 1;
- sat = 1; /* matched, needn't loop further */
- }
- else return 0; /* can't be satisfied either */
- }
-
- if (!sat) complete = 0;
- }
-
- /* not all attributes in query are known from input
- * we have to retrieve job metadata from the backend
- *
- * XXX: It is not optimal to retrieve it here without sharing
- * over multiple invocations of match_feed() for the same job.
- */
- if (!complete) {
- int qi2[QUERY_MAX];
-
- memset(meta,0,sizeof meta);
- j=0;
- for (i=0; feed->qry[i].attr; i++) if (!qi[i]) {
- assert(j<QUERY_MAX);
- meta[j].name = feed->qry[i].attr;
- qi2[j] = i;
- j++;
- }
-
- if (glite_jppsbe_get_job_metadata(ctx,job,meta)) {
- glite_jp_error_t err;
- memset(&err,0,sizeof err);
- err.code = EIO;
- err.source = __FUNCTION__;
- err.desc = "complete query";
- return glite_jp_stack_error(ctx,&err);
- }
-
- for (i=0; meta[i].name; i++) {
- if (!check_qry_item(ctx,feed->qry+qi2[i],meta+i))
- return 0;
- if (!strcmp(meta[i].name,GLITE_JP_ATTR_OWNER)) owner = meta[i].value;
- }
- }
- }
-
- /* matched completely */
- glite_jppsbe_check_fed(ctx,feed->id,job,&fed);
- if (!fed) {
- glite_jp_attrval_t *a;
- full_feed(ctx,feed,job,&a);
- for (i=0; a[i].name && strcmp(a[i].name,GLITE_JP_ATTR_OWNER); i++);
- owner = a[i].value;
-
- glite_jpps_single_feed(ctx,feed->id,0,feed->destination,job,owner,a);
- for (i=0; a[i].name; i++) glite_jp_attrval_free(a+i,0);
- free(a);
- }
- else {
- if (!owner) {
- glite_jppsbe_get_job_metadata(ctx,job,meta);
- for (i=0; meta[i].name && strcmp(meta[i].name,GLITE_JP_ATTR_OWNER); i++);
- }
- glite_jpps_single_feed(ctx,feed->id,0,feed->destination,job,owner,attrs);
- }
- for (i=0; meta[i].name; i++) glite_jp_attrval_free(meta+i,0);
- return 0;
-}
-
-/* TODO: overit, ze do dalsich atributu se leze az kdyz matchuji metadata
- * kdyby ne, stejne se to nepovede ;
- * totez pro match_file */
-
-int glite_jpps_match_attr(
- glite_jp_context_t ctx,
- const char *job,
- const glite_jp_attrval_t attrs[]
-)
-{
- struct jpfeed *f = (struct jpfeed *) ctx->feeds;
- int i,j,doit;
-
- for (;f; f = f->next) {
- doit = 0;
-
- for (i=0; !doit && f->attrs[i]; i++)
- for (j=0; !doit && attrs[j].name; j++)
- if (!strcmp(f->attrs[i],attrs[j].name)) doit = 1;
-
- /* XXX: ignore any errors */
- if (doit) match_feed(ctx,f,job,attrs);
- }
-
- return glite_jp_clear_error(ctx);
-}
-
-static int attr_void_cmp(const void *a, const void *b)
-{
- char const * const *ca = (char const * const *) a;
- char const * const *cb = (char const * const *) b;
- return strcmp(*ca,*cb);
-}
-
-static void attr_union(char **a, char **b, char ***c)
-{
- int ca = 0,cb = 0,cnt,i,j;
- char **out;
-
- if (a) for (ca = 0; a[ca]; ca++);
- if (b) for (cb = 0; b[cb]; cb++);
- out = malloc((ca+cb+1) * sizeof *out);
- if (a) memcpy(out,a,ca * sizeof *out);
- if (b) memcpy(out+ca,b,cb * sizeof *out);
- out[cnt = ca+cb] = NULL;
- qsort(out,cnt,sizeof *out,attr_void_cmp);
-
- for (i=0; i<cnt; i++) {
- for (j=i; j<cnt && !strcmp(out[i],out[j]); j++);
- if (j < cnt && j > i+1) memmove(out+i+1,out+j,(cnt-j) * sizeof *out);
- cnt -= j-i-1;
- }
-
- *c = out;
-}
-
-int glite_jpps_match_file(
- glite_jp_context_t ctx,
- const char *job,
- const char *class,
- const char *name
-)
-{
- glite_jpps_fplug_data_t **pd = NULL;
- int pi;
- void *bh = NULL;
- int ret;
- struct jpfeed *f = ctx->feeds;
- glite_jp_attrval_t meta[QUERY_MAX+1];
-
- int nvals = 0,j,i;
- char **attrs = NULL, **attrs2;
- glite_jp_attrval_t *vals = NULL,*oneval;
-
- fprintf(stderr,"%s: %s %s %s\n",__FUNCTION__,job,class,name);
-
-
- switch (glite_jpps_fplug_lookup(ctx,class,&pd)) {
- case ENOENT: return 0; /* XXX: shall we complain? */
- case 0: break;
- default: return -1;
- }
-
- for (;f;f=f->next) {
- attr_union(attrs,f->attrs,&attrs2);
- free(attrs);
- attrs = attrs2;
- }
-
- for (pi=0; pd[pi]; pi++) {
- int ci;
- for (ci=0; pd[pi]->uris[ci]; ci++) if (!strcmp(pd[pi]->uris[ci],class)) {
- void *ph;
-
- if (!bh && (ret = glite_jppsbe_open_file(ctx,job,pd[pi]->classes[ci],name,O_RDONLY,&bh))) {
- free(pd);
- return ret;
- }
-
- if (pd[pi]->ops.open(pd[pi]->fpctx,bh,class,&ph)) {
- /* XXX: complain more visibly */
- fputs("plugin open failed\n",stderr);
- continue;
- }
-
- for (i=0; attrs[i]; i++)
- if (!pd[pi]->ops.attr(pd[pi]->fpctx,ph,attrs[i],&oneval)) {
- /* XXX: ignore error */
- for (j=0; oneval[j].name; j++);
- vals = realloc(vals,(nvals+j+1) * sizeof *vals);
- memcpy(vals+nvals,oneval,(j+1) * sizeof *vals);
- nvals += j;
- free(oneval);
- }
-
- pd[pi]->ops.close(pd[pi]->fpctx,ph);
- }
- }
-
- free(attrs);
-
- if (bh) glite_jppsbe_close_file(ctx,bh);
- free(pd);
-
- for (f = ctx->feeds; f; f=f->next) {
- int k,fed;
- glite_jp_attrval_t * fattr;
-
- glite_jppsbe_check_fed(ctx,f->id,job,&fed);
- if (!fed) full_feed(ctx,f,job,&fattr);
- else {
- fattr = malloc((nvals+1) * sizeof *fattr);
-
- j = 0;
- for (i=0; i<nvals; i++) for (k=0; f->attrs[k]; k++)
- if (!strcmp(f->attrs[k],vals[i].name))
- memcpy(fattr+j++,vals+i,sizeof *fattr);
-
- memset(fattr+j,0,sizeof *fattr);
-
- }
- glite_jppsbe_get_job_metadata(ctx,job,meta);
- for (i=0; meta[i].name && strcmp(meta[i].name,GLITE_JP_ATTR_OWNER); i++);
- glite_jpps_single_feed(ctx,f->id,0,f->destination,job,meta[i].value,fattr);
- for (i=0; meta[i].name; i++) glite_jp_attrval_free(meta+i,0);
- if (!fed) for (i=0; fattr[i].name; i++) glite_jp_attrval_free(fattr+i,0);
- free(fattr);
- }
-
- for (i=0; vals[i].name; i++) glite_jp_attrval_free(vals+i,0);
- free(vals);
-
- return 0;
-}
-
-static char *generate_feedid(void)
-{
- char hname[200],buf[1000];
-
- gethostname(hname,sizeof hname);
- snprintf(buf,sizeof buf,"%s%d%ld",hname,getpid(),lrand48());
- buf[sizeof buf-1] = 0;
- return str2md5base64(buf);
-}
-
-static struct jpfeed *make_jpfeed(
- const char *destination,
- char const *const *attrs,
- const glite_jp_query_rec_t *qry,
- char *id,
- time_t expires)
-{
- int i;
- struct jpfeed *f = calloc(1,sizeof *f);
-
- f->id = id ? strdup(id) : NULL;
- f->destination = strdup(destination);
- f->expires = expires;
- for (i=0; attrs[i]; i++) {
- f->attrs = realloc(f->attrs,(i+2) * sizeof *f->attrs);
- f->attrs[i] = strdup(attrs[i]);
- f->attrs[i+1] = NULL;
- }
- for (i=0; qry[i].attr; i++) {
- f->qry = realloc(f->qry,(i+2) * sizeof *f->qry);
- glite_jp_queryrec_copy(f->qry+i,qry+i);
- memset(f->qry+i+1,0,sizeof *f->qry);
- }
-
- return f;
-}
-
-void jpfeed_free(struct jpfeed *f)
-{
- int i;
-
- assert(f->njobs == 0); /* XXX: we shouldn't do this */
-
- free(f->id);
- free(f->destination);
- if (f->attrs) {
- for (i=0; f->attrs[i]; i++) free(f->attrs[i]);
- free(f->attrs);
- }
- for (i=0; i<f->nmeta_attr; i++) free(f->meta_attr[i]);
- free(f->meta_attr);
- for (i=0; i<f->nother_attr; i++) free(f->other_attr[i]);
- free(f->other_attr);
-
- if (f->qry) {
- for (i=0; f->qry[i].attr; i++) glite_jp_free_query_rec(f->qry+i);
- free(f->qry);
- }
-
- for (i=0; i<f->nmeta_qry; i++) glite_jp_free_query_rec(f->meta_qry+i);
- free(f->meta_qry);
- for (i=0; i<f->nother_qry; i++) glite_jp_free_query_rec(f->other_qry+i);
- free(f->other_qry);
-
- /* XXX: no next */
-
- free(f);
-}
-
-static void drop_jobs(struct jpfeed *f)
-{
- int i,j;
- for (i=0; i<f->njobs; i++) {
- for (j=0; f->job_attrs[i][j].name; j++)
- glite_jp_attrval_free(&f->job_attrs[i][j],0);
- free(f->job_attrs[i]);
- free(f->jobs[i]);
- free(f->owners[i]);
- }
- free(f->job_attrs);
- free(f->jobs);
- free(f->owners);
- f->job_attrs = NULL;
- f->jobs = NULL;
- f->njobs = 0;
-}
-
-static int drain_feed(glite_jp_context_t ctx, struct jpfeed *f,int done)
-{
- int ret = 0;
- glite_jp_clear_error(ctx);
- if (f->njobs) {
- ret = glite_jpps_multi_feed(ctx,f->id,done,f->njobs,f->destination,f->jobs,f->owners,f->job_attrs);
- drop_jobs(f);
- }
- return ret;
-}
-
-static int feed_query_callback(
- glite_jp_context_t ctx,
- const char *job,
- const glite_jp_attrval_t meta[],
- void *arg)
-{
- int i,j,nout = 0,ec;
- glite_jp_error_t err;
- struct jpfeed *f = arg;
- glite_jp_attrval_t *other = NULL,*out = NULL;
-
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
- glite_jp_clear_error(ctx);
-
-/* retrieve other attributes */
- ec = glite_jpps_get_attrs(ctx,job,f->other_attr,f->nother_attr,&other);
- switch (ec) {
- case 0: break;
- case ENOENT: glite_jp_clear_error(ctx); break;
- default:
- err.code = EIO;
- err.desc = "retrieve job attributes";
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
-
-/* no attributes known -- can't match */
- if (!other) goto cleanup;
-
-/* filter on non-meta query items */
- for (i=0; i<f->nother_qry; i++) {
- for (j=0; other[j].name; j++)
- if (check_qry_item(ctx,f->other_qry+i,other+j)) break;
- if (!other[j].name) goto cleanup; /* no match is not an error */
- }
-
-/* extract attributes to be fed, stack the job for a batch feed */
- for (i=0; meta && meta[i].name; i++)
- for (j=0; j<f->nmeta_attr; j++)
- if (!strcmp(meta[i].name,f->meta_attr[j])) {
- out = realloc(out,(nout+2) * sizeof *out);
- glite_jp_attrval_copy(out+nout,meta+i);
- nout++;
- }
-
- for (i=0; other[i].name; i++)
- for (j=0; j<f->int_other_attr; j++)
- if (!strcmp(other[i].name,f->other_attr[j])) {
- out = realloc(out,(nout+2) * sizeof *out);
- glite_jp_attrval_copy(out+nout,other+i);
- nout++;
- }
-
- if (nout) {
- int oi;
-
- memset(out+nout,0,sizeof *out);
- f->jobs = realloc(f->jobs,(f->njobs+1)*sizeof *f->jobs);
- f->jobs[f->njobs] = strdup(job);
- f->job_attrs = realloc(f->job_attrs,(f->njobs+1)*sizeof *f->job_attrs);
- f->job_attrs[f->njobs] = out;
- out = NULL;
-
- for (oi=0; strcmp(meta[oi].name,GLITE_JP_ATTR_OWNER); oi++);
- assert(meta[oi].name);
- f->owners = realloc(f->owners,(f->njobs+1)*sizeof *f->owners);
- f->owners[f->njobs] = strdup(meta[oi].value);
-
- f->njobs++;
- }
-
-/* run the feed eventually */
- if (f->njobs >= BATCH_FEED_SIZE && drain_feed(ctx,f,0)) {
- err.code = EIO;
- err.desc = "sending batch feed";
- glite_jp_stack_error(ctx,&err);
- }
-
-cleanup:
- for (i=0; other && other[i].name; i++) glite_jp_attrval_free(other+i,0);
- free(other);
-
- return err.code;
-}
-
-
-static int run_feed_deferred(glite_jp_context_t ctx,void *feed)
-{
- struct jpfeed *f = feed;
- int i,m,o,cnt,ret = 0;
- char **meta;
-
- glite_jp_clear_error(ctx);
-/* count "meta" attributes */
- cnt = 0;
- for (i=0; f->attrs[i]; i++)
- if (glite_jppsbe_is_metadata(ctx,f->attrs[i])) cnt++;
-
- f->meta_attr = cnt ? malloc((cnt+1) * sizeof *f->meta_attr) : NULL;
- f->nmeta_attr = cnt;
-
- f->other_attr = i-cnt ? malloc((i-cnt+1) * sizeof *f->other_attr) : NULL;
- f->nother_attr = i-cnt;
-
-/* sort attributes to "meta" and others */
- m = o = 0;
- for (i=0; f->attrs[i]; i++)
- if (glite_jppsbe_is_metadata(ctx,f->attrs[i]))
- if (!strcmp(f->attrs[i],GLITE_JP_ATTR_OWNER)) {
- free(f->attrs[i]);
- f->nmeta_attr--;
- }
- else f->meta_attr[m++] = f->attrs[i];
- else {
- /* XXX: jobid and owner are sent anyway */
- if (!strcmp(f->attrs[i],GLITE_JP_ATTR_JOBID)) {
- free(f->attrs[i]);
- f->nother_attr--;
- }
- else f->other_attr[o++] = f->attrs[i];
- }
-
- if (f->nmeta_attr == 0) { free(f->meta_attr); f->meta_attr = NULL; }
- if (f->nother_attr == 0) { free(f->other_attr); f->other_attr = NULL; }
-
- if (f->meta_attr) f->meta_attr[m] = NULL;
- if (f->other_attr) f->other_attr[o] = NULL;
-
-
-/* the same for query records */
- cnt = 0;
- for (i=0; f->qry[i].attr; i++)
- if (glite_jppsbe_is_metadata(ctx,f->qry[i].attr)) cnt++;
-
- f->meta_qry = cnt ? malloc((cnt+1) * sizeof *f->meta_qry) : NULL;
- if (f->meta_qry) memset(f->meta_qry+cnt,0,sizeof *f->meta_qry);
- f->nmeta_qry = cnt;
- f->other_qry = i-cnt ? malloc((i-cnt+1) * sizeof *f->other_qry) : NULL;
- f->nother_qry = i-cnt;
-
- m = o = 0;
- for (i=0; f->qry[i].attr; i++)
- if (glite_jppsbe_is_metadata(ctx,f->qry[i].attr)) memcpy(f->meta_qry+m++,f->qry+i,sizeof *f->meta_qry);
- else memcpy(f->other_qry+o++,f->qry+i,sizeof *f->other_qry);
-
- free(f->attrs); free(f->qry);
- f->attrs = NULL;
- f->qry = NULL;
-
- if (f->meta_qry) memset(f->meta_qry+m,0,sizeof *f->meta_qry);
- else {
- glite_jp_error_t err;
- err.code = EINVAL;
- err.source = __FUNCTION__;
- err.desc = "at least one metadata query item required";
- ret = glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
-
- if (f->other_qry) memset(f->other_qry+o,0,sizeof *f->other_qry);
-
-/* extract other_qry items that are not present in other_attr */
- f->int_other_attr = o = f->nother_attr;
- for (i=0; i<f->nother_qry; i++) {
- int j;
- for (j=0; j<f->int_other_attr && strcmp(f->other_attr[j],f->other_qry[i].attr); j++);
- if (j == f->int_other_attr) {
- f->other_attr = realloc(f->other_attr,(o+2) * sizeof *f->other_attr);
- f->other_attr[o++] = strdup(f->other_qry[i].attr);
- }
- }
- if (f->other_attr) f->other_attr[o] = NULL;
- f->nother_attr = o;
-
- meta = calloc(f->nmeta_attr+2,sizeof *meta);
- meta[0] = GLITE_JP_ATTR_OWNER;
- if (f->meta_attr) memcpy(meta+1,f->meta_attr,(f->nmeta_attr+1) * sizeof *meta);
- else meta[1] = NULL;
-
- ret = glite_jppsbe_query(ctx,f->meta_qry,meta,f,feed_query_callback);
- if (!ret) ret = drain_feed(ctx,f,1);
- else drop_jobs(f);
-
-cleanup:
-
- jpfeed_free(f);
- return ret;
-}
-
-int glite_jpps_run_feed(
- glite_jp_context_t ctx,
- const char *destination,
- char const * const *attrs,
- const glite_jp_query_rec_t *qry,
- char **feed_id)
-{
- struct jpfeed *f;
-
- fprintf(stderr,"%s: \n",__FUNCTION__);
- if (!*feed_id) *feed_id = generate_feedid();
-
- f = make_jpfeed(destination,attrs,qry,*feed_id,(time_t) 0);
- glite_jp_add_deferred(ctx,run_feed_deferred,f);
-
- return 0;
-}
-
-static int register_feed_deferred(glite_jp_context_t ctx,void *feed)
-{
- struct jpfeed *f = feed;
-
-/* FIXME:
- * - volatile implementation: should store the registrations in a file
- * and recover after restart
- * - should communicate the data among all server slaves
-
- f->next = ctx->feeds;
- ctx->feeds = f;
- */
-
- if (glite_jppsbe_store_feed(ctx,f)) fputs(glite_jp_error_chain(ctx),stderr);
- else kill(-master,SIGUSR1); /* gracefully terminate slaves
- and let master restart them */
-
- return 0;
-}
-
-
-int glite_jpps_register_feed(
- glite_jp_context_t ctx,
- const char *destination,
- char const *const *attrs,
- const glite_jp_query_rec_t *qry,
- char **feed_id,
- time_t *expires)
-{
- struct jpfeed *f;
-
- if (!*feed_id) *feed_id = generate_feedid();
- time(expires); *expires += FEED_TTL;
-
- f = make_jpfeed(destination,attrs,qry,*feed_id,*expires);
- glite_jp_add_deferred(ctx,register_feed_deferred,f);
-
- return 0;
-}
-
+++ /dev/null
-#ifndef __GLITE_JP_FEED
-#define __GLITE_JP_FEED
-
-
-struct jpfeed {
-/* feed data */
- char *id,*destination;
- time_t expires;
-
-/* complete and split query and attribute list */
- char **attrs,**meta_attr,**other_attr;
- int int_other_attr; /* index from where other_attr is extended
- with attributes from other_query */
-
- int nother_attr, nmeta_attr, nmeta_qry, nother_qry;
- glite_jp_query_rec_t *qry,*meta_qry,*other_qry;
-
-/* jobs stacked for feed */
- int njobs;
- char **jobs;
- char **owners;
- glite_jp_attrval_t **job_attrs;
-
-/* next feed */
- struct jpfeed *next;
-};
-
-
-int glite_jpps_match_attr(glite_jp_context_t,const char *,const glite_jp_attrval_t[]);
-int glite_jpps_match_file(glite_jp_context_t,const char *,const char *,const char *);
-int glite_jpps_match_tag(glite_jp_context_t,const char *,const char *,const char *);
-int glite_jpps_run_feed(glite_jp_context_t,const char *,char const * const *,const glite_jp_query_rec_t *,char **);
-int glite_jpps_register_feed(glite_jp_context_t,const char *,char const * const *,const glite_jp_query_rec_t *,char **,time_t *);
-
-#endif
-
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <dlfcn.h>
-#include <errno.h>
-
-#include <glite/jp/types.h>
-#include "file_plugin.h"
-
-static struct option opts[] = {
- { "plugin", 1, NULL, 'p' },
- { NULL }
-};
-
-static int loadit(glite_jp_context_t ctx,const char *so)
-{
-/* XXX: not stored but we never dlclose() yet */
- void *dl_handle = dlopen(so,RTLD_NOW);
-
- glite_jp_error_t err;
- const char *e;
- glite_jpps_fplug_data_t *data,*dp;
- int i;
-
- glite_jpps_fplug_init_t init;
- memset(&err,0,sizeof err);
-
- if (!dl_handle) {
- err.source = "dlopen()";
- err.code = EINVAL;
- err.desc = dlerror();
- return glite_jp_stack_error(ctx,&err);
- }
-
- dlerror();
- init = dlsym(dl_handle,"init");
- e = dlerror();
- if (e) {
- char buf[300];
- snprintf(buf,sizeof buf,"dlsym(\"%s\",\"init\")",so);
- buf[299] = 0;
- err.source = buf;
- err.code = ENOENT;
- err.desc = e;
- return glite_jp_stack_error(ctx,&err);
- }
-
- data = calloc(1,sizeof *data);
-
- if (init(ctx,data)) return -1;
-
- i = 0;
- if (ctx->plugins) for (i=0; ctx->plugins[i]; i++);
- ctx->plugins = realloc(ctx->plugins, (i+2) * sizeof *ctx->plugins);
- ctx->plugins[i] = data;
- ctx->plugins[i+1] = NULL;
-
- /* TODO: check consistency of uri+class pairs wrt. previous plugins */
-
- return 0;
-}
-
-int glite_jpps_fplug_load(glite_jp_context_t ctx,int argc,char **argv)
-{
- int i;
-
- for (i=1; i<argc; i++) if (loadit(ctx,argv[i])) {
- glite_jp_error_t err;
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
- err.code = EINVAL;
- err.desc = argv[i];
- return glite_jp_stack_error(ctx,&err);
- }
-
- return 0;
-}
-
-int glite_jpps_fplug_lookup(glite_jp_context_t ctx,const char *uri, glite_jpps_fplug_data_t ***plugin_data)
-{
- int i;
-
- glite_jpps_fplug_data_t **out = NULL;
- int matches = 0;
-
- glite_jp_error_t err;
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
- err.code = ENOENT;
- err.desc = (char *) uri; /* XXX: we don't modify it, believe me, gcc! */
-
- glite_jp_clear_error(ctx);
- if (!ctx->plugins) {
- return glite_jp_stack_error(ctx,&err);
- }
-
- for (i = 0; ctx->plugins[i]; i++) {
- int j;
- glite_jpps_fplug_data_t *p = ctx->plugins[i];
-
- for (j=0; p->uris && p->uris[j]; j++)
- if (!strcmp(p->uris[j],uri)) {
- out = realloc(out, (matches+2) * sizeof *out);
- out[matches++] = p;
- out[matches] = NULL;
- }
- }
-
- if (matches) {
- *plugin_data = out;
- return 0;
- }
- else return glite_jp_stack_error(ctx,&err);
-}
-
+++ /dev/null
-#ident "$Header$"
-
-#include <getopt.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <assert.h>
-#include <limits.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-#include "glite/jp/strmd5.h"
-
-#include "tags.h"
-#include "backend.h"
-
-#define UPLOAD_SUFFIX ".upload"
-#define LOCK_SUFFIX ".lock"
-
-struct ftpbe_config {
- char *internal_path;
- char *external_path;
- char *gridmap;
- char *logname;
-};
-
-static struct ftpbe_config *config = NULL;
-
-struct fhandle_rec {
- int fd;
- int fd_append;
-};
-typedef struct fhandle_rec *fhandle;
-
-static struct option ftpbe_opts[] = {
- { "ftp-internal-path", 1, NULL, 'I' },
- { "ftp-external-path", 1, NULL, 'E' },
- { "ftp-gridmap", 1, NULL, 'G' },
- { NULL, 0, NULL, 0 }
-};
-
-/* obsolete */
-#if 0
-static struct {
- glite_jp_fileclass_t type;
- char * fname;
- } class_to_fname_tab[] = {
- { GLITE_JP_FILECLASS_INPUT, "input" },
- { GLITE_JP_FILECLASS_OUTPUT, "output" },
- { GLITE_JP_FILECLASS_LBLOG, "lblog" },
- { GLITE_JP_FILECLASS_TAGS, "tags" },
- { GLITE_JP_FILECLASS_UNDEF, NULL }
- };
-
-static char *class_to_fname(glite_jp_fileclass_t type)
-{
- int i;
-
- for (i = 0; class_to_fname_tab[i].type != GLITE_JP_FILECLASS_UNDEF; i++)
- if (type == class_to_fname_tab[i].type)
- return class_to_fname_tab[i].fname;
-
- return NULL;
-}
-
-static glite_jp_fileclass_t fname_to_class(char* fname)
-{
- int i;
-
- for (i = 0; class_to_fname_tab[i].type != GLITE_JP_FILECLASS_UNDEF; i++)
- if (!strcmp(fname, class_to_fname_tab[i].fname))
- return class_to_fname_tab[i].type;
-
- return GLITE_JP_FILECLASS_UNDEF;
-}
-#endif
-
-static int config_check(
- glite_jp_context_t ctx,
- struct ftpbe_config *config)
-{
- return config == NULL ||
- config->internal_path == NULL ||
- config->external_path == NULL ||
- config->gridmap == NULL ||
- config->logname == NULL;
-
- /* XXX check reality */
-}
-
-static int jobid_unique_pathname(glite_jp_context_t ctx, const char *job,
- char **unique, char **ju_path, int get_path)
-{
- char *p;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- p = strrchr(job, '/');
- if (!p) {
- err.code = EINVAL;
- err.desc = "Malformed jobid";
- return glite_jp_stack_error(ctx,&err);
- }
- /* XXX thorough checks */
- if (!(*unique = strdup(p+1))) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- if (get_path) {
- if (!(*ju_path = strdup(p+1))) {
- free(*unique);
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- *(*ju_path + 10) = '\0';
- }
- return 0;
-}
-
-static int mkdirpath(const char* path, int prefixlen)
-{
- char *wpath, *p;
- int goout, ret;
-
- wpath = strdup(path);
- if (!wpath) {
- errno = ENOMEM;
- return -1;
- }
-
- p = wpath + prefixlen;
- goout = 0;
- while (!goout) {
- while (*p == '/') p++;
- while (*p != '/' && *p != '\0') p++;
- goout = (*p == '\0');
- *p = '\0';
- ret = mkdir(wpath, S_IRUSR | S_IWUSR | S_IXUSR);
- if (ret < 0 && errno != EEXIST) break;
- *p = '/';
- }
- free(wpath);
- return goout ? 0 : ret;
-}
-
-static long regtime_trunc(long tv_sec)
-{
- return tv_sec / (86400*7);
-}
-
-static long regtime_ceil(long tv_sec)
-{
- return (tv_sec % (86400*7)) ? tv_sec/(86400*7)+1 : tv_sec/(86400*7) ;
-}
-
-/********************************************************************************/
-int glite_jppsbe_init(
- glite_jp_context_t ctx,
- int argc,
- char *argv[]
-)
-{
- glite_jp_error_t err;
- int opt;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- config = (struct ftpbe_config *) calloc(1, sizeof *config);
- if (!config) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
-
- config->logname = getlogin();
-
- while ((opt = getopt_long(argc, argv, "I:E:G:", ftpbe_opts, NULL)) != EOF) {
- switch (opt) {
- case 'I': config->internal_path = optarg; break;
- case 'E': config->external_path = optarg; break;
- case 'G': config->gridmap = optarg; break;
- default: break;
- }
- }
-
- if (config_check(ctx, config)) {
- err.code = EINVAL;
- err.desc = "Invalid FTP backend configuration";
- return glite_jp_stack_error(ctx,&err);
- }
-
- return 0;
-}
-
-int glite_jppsbe_init_slave(
- glite_jp_context_t ctx
-)
-{
- /* Nothing to do */
-}
-
-int glite_jppsbe_register_job(
- glite_jp_context_t ctx,
- const char *job,
- const char *owner
-)
-{
- glite_jp_error_t err;
- char *int_dir = NULL;
- char *int_fname = NULL;
- char *data_dir = NULL;
- char *data_fname = NULL;
- char *ju = NULL;
- char *ju_path = NULL;
- char *ownerhash = NULL;
- FILE *regfile = NULL;
- struct timeval reg_tv;
- long reg_tv_trunc;
- struct stat statbuf;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- assert(job != NULL);
- assert(owner != NULL);
-
- gettimeofday(®_tv, NULL);
- reg_tv_trunc = regtime_trunc(reg_tv.tv_sec);
-
- if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
- err.code = ctx->error->code;
- err.desc = "Cannot obtain jobid unique path/name";
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (asprintf(&int_dir, "%s/regs/%s",
- config->internal_path, ju_path) == -1) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (mkdirpath(int_dir, strlen(config->internal_path)) < 0 &&
- errno != EEXIST) {
- free(int_dir);
- err.code = errno;
- err.desc = "Cannot mkdir jobs's reg directory";
- return glite_jp_stack_error(ctx,&err);
- }
- free(int_dir);
-
- if (asprintf(&int_fname, "%s/regs/%s/%s.info",
- config->internal_path, ju_path, ju) == -1) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (stat(int_fname, &statbuf) < 0) {
- if (errno != ENOENT) {
- err.code = errno;
- err.desc = "Cannot stat jobs's reg info file";
- goto error_out;
- }
- } else {
- err.code = EEXIST;
- err.desc = "Job already registered";
- goto error_out;
- }
-
- regfile = fopen(int_fname, "w");
- if (regfile == NULL) {
- err.code = errno;
- err.desc = "Cannot open jobs's reg info file";
- goto error_out;
- }
-
- ownerhash = str2md5(owner); /* static buffer */
-
- if (fprintf(regfile, "%d %ld.%06ld %s %s %d %s\n", 1,
- (long)reg_tv.tv_sec, (long)reg_tv.tv_usec, job,
- ownerhash, strlen(owner), owner) < 1 || ferror(regfile)) {
- fclose(regfile);
- err.code = errno;
- err.desc = "Cannot write jobs's reg info file";
- goto error_out;
- }
- if (fclose(regfile) != 0 ) {
- err.code = errno;
- err.desc = "Cannot close(write) jobs's reg info file";
- goto error_out;
- }
-
- if (asprintf(&data_dir, "%s/data/%s/%d/%s",
- config->internal_path, ownerhash, regtime_trunc(reg_tv.tv_sec), ju) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- if (asprintf(&data_fname, "%s/_info", data_dir) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- if (mkdirpath(data_dir, strlen(config->internal_path)) < 0 &&
- errno != EEXIST) {
- err.code = errno;
- err.desc = "Cannot mkdir jobs's data directory";
- goto error_out;
- }
-
- if (link(int_fname, data_fname) < 0) {
- err.code = errno;
- err.desc = "Cannot link job's reg and data info files";
- goto error_out;
- }
-
-error_out:
- free(int_fname);
- free(data_fname);
- if (err.code && data_dir) rmdir(data_dir);
- free(data_dir);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-static int add_to_gridmap(glite_jp_context_t ctx, const char *dn)
-{
- FILE *gridmap = NULL;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- gridmap = fopen(config->gridmap, "a");
- if (!gridmap) {
- err.code = errno;
- err.desc = "Cannot open gridmap file";
- return glite_jp_stack_error(ctx,&err);
- }
- if (fprintf(gridmap, "\"%s\" %s\n", dn, config->logname) < 6 ||
- ferror(gridmap)) {
- err.code = EIO;
- err.desc = "Cannot write to gridmap file";
- fclose(gridmap);
- return glite_jp_stack_error(ctx,&err);
- }
- fclose(gridmap);
- return 0;
-}
-
-static int remove_from_gridmap(glite_jp_context_t ctx, const char *dn)
-{
- FILE *gridmap = NULL;
- char *temp_name = NULL;
- FILE *temp_file = NULL;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- /* XXX */
- return 0;
-}
-
-int glite_jppsbe_start_upload(
- glite_jp_context_t ctx,
- const char *job,
- const char *class,
- const char *name, /* TODO */
- const char *content_type,
- char **destination_out,
- time_t *commit_before_inout
-)
-{
- char *int_fname = NULL;
- char *lock_fname = NULL;
- FILE *lockfile = NULL;
- FILE *regfile = NULL;
- char *data_dir = NULL;
- char *data_lock = NULL;
- char *ju = NULL;
- char *ju_path = NULL;
- char *peername = NULL;
- int info_version;
- long reg_time;
- char ownerhash[33];
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- assert(job!=NULL);
- assert(destination_out!=NULL);
-
- assert(class!=NULL);
-
- if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
- err.code = ctx->error->code;
- err.desc = "Cannot obtain jobid unique path/name";
- return glite_jp_stack_error(ctx,&err);
- }
-
- peername = glite_jp_peer_name(ctx);
-
- if (asprintf(&int_fname, "%s/regs/%s/%s.info",
- config->internal_path, ju_path, ju) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- regfile = fopen(int_fname, "r");
- if (regfile == NULL) {
- err.code = errno;
- if (errno == ENOENT)
- err.desc = "Job not registered";
- else
- err.desc = "Cannot open jobs's reg info file";
- goto error_out;
- }
- if (fscanf(regfile, "%d %ld.%*ld %*s %s ", &info_version,
- ®_time, ownerhash) < 3 || ferror(regfile)) {
- fclose(regfile);
- err.code = errno;
- err.desc = "Cannot read jobs's reg info file";
- goto error_out;
- }
- fclose(regfile);
-
- /* XXX authorization */
-
- if (asprintf(&data_dir, "%s/data/%s/%d/%s",
- config->internal_path, ownerhash, regtime_trunc(reg_time), ju) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if (asprintf(&lock_fname, "%s/%s" LOCK_SUFFIX,
- data_dir, class) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if (commit_before_inout != NULL)
- *commit_before_inout = (time_t) LONG_MAX; /* XXX no timeout enforced */
-
- lockfile = fopen(lock_fname, "w");
- if (lockfile == NULL) {
- err.code = errno;
- err.desc = "Cannot open uploads's lock file";
- goto error_out;
- }
-
- if (fprintf(lockfile, "%ld %d %s\n", (long)*commit_before_inout,
- peername ? peername : 0,
- peername ? peername : "") < 1 || ferror(regfile)) {
- fclose(lockfile);
- err.code = errno;
- err.desc = "Cannot write upload's lock file";
- goto error_out;
- }
- if (fclose(lockfile) != 0 ) {
- err.code = errno;
- err.desc = "Cannot close(write) upload's lock file";
- goto error_out;
- }
-
- if (asprintf(destination_out, "%s/data/%s/%d/%s/%s" UPLOAD_SUFFIX,
- config->external_path, ownerhash, regtime_trunc(reg_time), ju, class) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if (add_to_gridmap(ctx, peername)) {
- err.code = EIO;
- err.desc = "Cannot add peer DN to ftp server authorization file";
- goto error_out;
- }
-
-error_out:
- free(int_fname);
- free(data_dir);
- if (err.code && data_lock) unlink(data_lock);
- free(data_lock);
- free(ju); free(ju_path);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-int glite_jppsbe_commit_upload(
- glite_jp_context_t ctx,
- const char *destination
-)
-{
- size_t dest_len;
- size_t suff_len;
- size_t extp_len;
- long commit_before;
- int lockpeerlen;
- char *lockpeername = NULL;
- char *peername = NULL;
- char *dest_rw = NULL;
- char *dest_rw_suff = NULL;
- char *dest_rw_lock = NULL;
- FILE *lockfile = NULL;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- assert(destination != NULL);
-
- suff_len = strlen(UPLOAD_SUFFIX);
- dest_len = strlen(destination);
- extp_len = strlen(config->external_path);
-
- if (dest_len < suff_len ||
- strcmp(UPLOAD_SUFFIX, destination + (dest_len - suff_len)) ||
- strncmp(destination, config->external_path, extp_len)) {
- err.code = EINVAL;
- err.desc = "Forged destination path";
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (asprintf(&dest_rw_suff, "%s%s", config->internal_path,
- destination + extp_len) == -1) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- dest_rw = strdup(dest_rw_suff);
- if (!dest_rw) {
- err.code = ENOMEM;
- goto error_out;
- }
- *(dest_rw + (strlen(dest_rw_suff) - suff_len)) = '\0';
-
- if (asprintf(&dest_rw_lock, "%s" LOCK_SUFFIX, dest_rw) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- lockfile = fopen(dest_rw_lock, "r");
- if (lockfile == NULL) {
- err.code = errno;
- err.desc = "Cannot open upload's lock file";
- goto error_out;
- }
- if (fscanf(lockfile, "%ld %d ", &commit_before, &lockpeerlen) < 2 || ferror(lockfile)) {
- fclose(lockfile);
- err.code = errno;
- err.desc = "Cannot read upload's lock file";
- goto error_out;
- }
- if (lockpeerlen) {
- lockpeername = (char*) calloc(1, lockpeerlen+1);
- if (!lockpeername) {
- err.code = ENOMEM;
- goto error_out;
- }
- if (fgets(lockpeername, lockpeerlen+1, lockfile) == NULL) {
- fclose(lockfile);
- err.code = errno;
- err.desc = "Cannot read upload's lock file";
- goto error_out;
- }
- }
- fclose(lockfile);
-
- peername = glite_jp_peer_name(ctx);
- if (lockpeername && (!peername || strcmp(lockpeername, peername))) {
- err.code = EPERM;
- err.desc = "Upload started by client of different identity";
- goto error_out;
- }
-
- if (rename(dest_rw_suff, dest_rw) < 0) {
- err.code = errno;
- err.desc = "Cannot move upload file to the final place";
- goto error_out;
- }
-
- if (unlink(dest_rw_lock) < 0) {
- err.code = errno;
- err.desc = "Cannot unlink upload's lock file";
- goto error_out;
- }
-
-error_out:
- free(dest_rw);
- free(dest_rw_suff);
- free(dest_rw_lock);
- free(peername);
- free(lockpeername);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-int glite_jppsbe_destination_info(
- glite_jp_context_t ctx,
- const char *destination,
- char **job,
- char **class,
- char **name
-)
-{
- size_t dest_len;
- size_t suff_len;
- size_t extp_len;
- char *dest_rw = NULL;
- char *dest_rw_suff = NULL;
- char *dest_rw_info = NULL;
- FILE *infofile = NULL;
- char *classname = NULL;
- char jobstr[256+1];
- glite_jp_error_t err;
-
- assert(destination != NULL);
- assert(job != NULL);
- assert(class != NULL);
- assert(name != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- suff_len = strlen(UPLOAD_SUFFIX);
- dest_len = strlen(destination);
- extp_len = strlen(config->external_path);
-
- if (dest_len < suff_len ||
- strcmp(UPLOAD_SUFFIX, destination + (dest_len - suff_len)) ||
- strncmp(destination, config->external_path, extp_len)) {
- err.code = EINVAL;
- err.desc = "Forged destination path";
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (asprintf(&dest_rw_suff, "%s%s", config->internal_path,
- destination + extp_len) == -1) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- dest_rw = strdup(dest_rw_suff);
- if (!dest_rw) {
- err.code = ENOMEM;
- goto error_out;
- }
- *(dest_rw + (strlen(dest_rw_suff) - suff_len)) = '\0';
-
- classname = strrchr(dest_rw,'/');
- if (classname == NULL) {
- err.code = EINVAL;
- err.desc = "Forged destination path";
- goto error_out;
- }
- *classname++ ='\0';
- *class = strdup(classname);
-
-/* XXX: do we need similar check?
- if (!class == GLITE_JP_FILECLASS_UNDEF) {
- err.code = EINVAL;
- err.desc = "Forged destination path";
- goto error_out;
- }
-*/
-
- /* TODO: */
- *name = NULL;
-
- if (asprintf(&dest_rw_info, "%s/_info", dest_rw) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- infofile = fopen(dest_rw_info, "r");
- if (infofile == NULL) {
- err.code = errno;
- err.desc = "Cannot open _info file";
- goto error_out;
- }
- if (fscanf(infofile, "%*d %*ld.%*ld %256s ", jobstr) < 1 || ferror(infofile)) {
- fclose(infofile);
- err.code = errno;
- err.desc = "Cannot read _info file";
- goto error_out;
- }
- *job = strdup(jobstr);
- fclose(infofile);
-
-error_out:
- free(dest_rw);
- free(dest_rw_suff);
- free(dest_rw_info);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-
-int glite_jppsbe_get_job_url(
- glite_jp_context_t ctx,
- const char *job,
- const char *class,
- const char *name, /* TODO */
- char **url_out
-)
-{
- FILE *regfile = NULL;
- char *int_fname = NULL;
- char *ju = NULL;
- char *ju_path = NULL;
- int info_version;
- long reg_time;
- char ownerhash[33];
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- assert(job!=NULL);
- assert(url_out != NULL);
-
- assert(class!=NULL);
-
- if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
- err.code = ctx->error->code;
- err.desc = "Cannot obtain jobid unique path/name";
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (asprintf(&int_fname, "%s/regs/%s/%s.info",
- config->internal_path, ju_path, ju) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- regfile = fopen(int_fname, "r");
- if (regfile == NULL) {
- err.code = errno;
- if (errno == ENOENT)
- err.desc = "Job not registered";
- else
- err.desc = "Cannot open jobs's reg info file";
- goto error_out;
- }
- if (fscanf(regfile, "%d %ld.%*ld %*s %s", &info_version,
- ®_time, ownerhash) < 3 || ferror(regfile)) {
- fclose(regfile);
- err.code = errno;
- err.desc = "Cannot read jobs's reg info file";
- goto error_out;
- }
- fclose(regfile);
-
- if (asprintf(url_out, "%s/data/%s/%d/%s/%s",
- config->external_path, ownerhash, regtime_trunc(reg_time), ju, class) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
-
-error_out:
- free(int_fname);
- free(ju); free(ju_path);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-static int get_job_fname(
- glite_jp_context_t ctx,
- const char *job,
- const char *class,
- const char *name, /* TODO */
- char **fname_out
-)
-{
- FILE *regfile = NULL;
- char *int_fname = NULL;
- char *ju = NULL;
- char *ju_path = NULL;
- int info_version;
- long reg_time;
- char ownerhash[33];
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- assert(job!=NULL);
- assert(fname_out != NULL);
-
- assert(class!=NULL);
-
- if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
- err.code = ctx->error->code;
- err.desc = "Cannot obtain jobid unique path/name";
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (asprintf(&int_fname, "%s/regs/%s/%s.info",
- config->internal_path, ju_path, ju) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- regfile = fopen(int_fname, "r");
- if (regfile == NULL) {
- err.code = errno;
- if (errno == ENOENT)
- err.desc = "Job not registered";
- else
- err.desc = "Cannot open jobs's reg info file";
- goto error_out;
- }
- if (fscanf(regfile, "%d %ld.%*ld %*s %s", &info_version,
- ®_time, ownerhash) < 3 || ferror(regfile)) {
- fclose(regfile);
- err.code = errno;
- err.desc = "Cannot read jobs's reg info file";
- goto error_out;
- }
- fclose(regfile);
-
- if (asprintf(fname_out, "%s/data/%s/%d/%s/%s",
- config->internal_path, ownerhash, regtime_trunc(reg_time), ju, class) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
-
-error_out:
- free(int_fname);
- free(ju); free(ju_path);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-int glite_jppsbe_open_file(
- glite_jp_context_t ctx,
- const char *job,
- const char *class,
- const char *name, /* TODO */
- int mode,
- void **handle_out
-)
-{
- fhandle handle = NULL;
- char* fname = NULL;
- glite_jp_error_t err;
-
- assert(handle_out != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (get_job_fname(ctx, job, class, name, &fname)) {
- err.code = ctx->error->code;
- err.desc = "Cannot construct internal filename";
- return glite_jp_stack_error(ctx,&err);
- }
-
- handle = (fhandle) calloc(1,sizeof(*handle));
- if (handle == NULL) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- handle->fd = open(fname, mode, S_IRUSR | S_IWUSR);
- if (handle->fd < 0) {
- err.code = errno;
- err.desc = "Cannot open requested file";
- free(handle);
- goto error_out;
- }
- handle->fd_append = open(fname, mode | O_APPEND, S_IRUSR | S_IWUSR);
- if (handle->fd_append < 0) {
- err.code = errno;
- err.desc = "Cannot open requested file for append";
- close(handle->fd);
- free(handle);
- goto error_out;
- }
- *handle_out = (void*) handle;
-
-error_out:
- free(fname);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-int glite_jppsbe_close_file(
- glite_jp_context_t ctx,
- void *handle
-)
-{
- glite_jp_error_t err;
-
- assert(handle != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (close(((fhandle)handle)->fd_append) < 0) {
- err.code = errno;
- err.desc = "Error closing file descriptor (fd_append)";
- goto error_out;
- }
- if (close(((fhandle)handle)->fd) < 0) {
- err.code = errno;
- err.desc = "Error closing file descriptor";
- goto error_out;
- }
-
-error_out:
- free(handle);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-int glite_jppsbe_pread(
- glite_jp_context_t ctx,
- void *handle,
- void *buf,
- size_t nbytes,
- off_t offset,
- ssize_t *nbytes_ret
-)
-{
- ssize_t ret;
- glite_jp_error_t err;
-
- assert(handle != NULL);
- assert(buf != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if ((ret = pread(((fhandle)handle)->fd, buf, nbytes, offset)) < 0) {
- err.code = errno;
- err.desc = "Error in pread()";
- return glite_jp_stack_error(ctx,&err);
- }
- *nbytes_ret = ret;
-
- return 0;
-}
-
-int glite_jppsbe_pwrite(
- glite_jp_context_t ctx,
- void *handle,
- void *buf,
- size_t nbytes,
- off_t offset
-)
-{
- glite_jp_error_t err;
-
- assert(handle != NULL);
- assert(buf != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (pwrite(((fhandle)handle)->fd, buf, nbytes, offset) < 0) {
- err.code = errno;
- err.desc = "Error in pwrite()";
- return glite_jp_stack_error(ctx,&err);
- }
-
- return 0;
-}
-
-int glite_jppsbe_append(
- glite_jp_context_t ctx,
- void *handle,
- void *buf,
- size_t nbytes
-)
-{
- glite_jp_error_t err;
-
- assert(handle != NULL);
- assert(buf != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (write(((fhandle)handle)->fd_append, buf, nbytes) < 0) {
- err.code = errno;
- err.desc = "Error in write()";
- return glite_jp_stack_error(ctx,&err);
- }
-
- return 0;
-}
-
-static int get_job_info(
- glite_jp_context_t ctx,
- const char *job,
- char **owner,
- struct timeval *tv_reg
-)
-{
- char *ju = NULL;
- char *ju_path = NULL;
- FILE *regfile = NULL;
- long reg_time_sec;
- long reg_time_usec;
- int ownerlen = 0;
- int info_version;
- char *int_fname = NULL;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
- err.code = ctx->error->code;
- err.desc = "Cannot obtain jobid unique path/name";
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (asprintf(&int_fname, "%s/regs/%s/%s.info",
- config->internal_path, ju_path, ju) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- regfile = fopen(int_fname, "r");
- if (regfile == NULL) {
- err.code = errno;
- if (errno == ENOENT)
- err.desc = "Job not registered";
- else
- err.desc = "Cannot open jobs's reg info file";
- goto error_out;
- }
- if (fscanf(regfile, "%d %ld.%ld %*s %*s %d ", &info_version,
- ®_time_sec, ®_time_usec, &ownerlen) < 4 || ferror(regfile)) {
- fclose(regfile);
- err.code = errno;
- err.desc = "Cannot read jobs's reg info file";
- goto error_out;
- }
- if (ownerlen) {
- *owner = (char *) calloc(1, ownerlen+1);
- if (!*owner) {
- err.code = ENOMEM;
- goto error_out;
- }
- if (fgets(*owner, ownerlen+1, regfile) == NULL) {
- fclose(regfile);
- free(*owner);
- err.code = errno;
- err.desc = "Cannot read jobs's reg info file";
- goto error_out;
- }
- }
- fclose(regfile);
-
- tv_reg->tv_sec = reg_time_sec;
- tv_reg->tv_usec = reg_time_usec;
-
-error_out:
- free(int_fname);
- free(ju);
- free(ju_path);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-static int get_job_info_int(
- glite_jp_context_t ctx,
- const char *int_fname,
- char **jobid,
- char **owner,
- struct timeval *tv_reg
-)
-{
- FILE *regfile = NULL;
- long reg_time_sec;
- long reg_time_usec;
- int ownerlen = 0;
- int info_version;
- char jobid_buf[256];
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- regfile = fopen(int_fname, "r");
- if (regfile == NULL) {
- err.code = errno;
- err.desc = "Cannot open jobs's reg info file";
- goto error_out;
- }
- if (fscanf(regfile, "%d %ld.%ld %s %*s %d ", &info_version,
- ®_time_sec, ®_time_usec, jobid_buf, &ownerlen) < 5 || ferror(regfile)) {
- fclose(regfile);
- err.code = errno;
- err.desc = "Cannot read jobs's reg info file";
- goto error_out;
- }
- *jobid = strdup(jobid_buf);
- if (ownerlen) {
- *owner = (char *) calloc(1, ownerlen+1);
- if (!*owner) {
- err.code = ENOMEM;
- goto error_out;
- }
- if (fgets(*owner, ownerlen+1, regfile) == NULL) {
- fclose(regfile);
- free(*owner);
- err.code = errno;
- err.desc = "Cannot read jobs's reg info file";
- goto error_out;
- }
- }
- fclose(regfile);
-
- tv_reg->tv_sec = reg_time_sec;
- tv_reg->tv_usec = reg_time_usec;
-
-error_out:
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-int glite_jppsbe_get_job_metadata(
- glite_jp_context_t ctx,
- const char *job,
- glite_jp_attrval_t attrs_inout[]
-)
-{
- int got_info = 0;
- struct timeval tv_reg;
- char *owner = NULL;
- int got_tags = 0;
- void *tags_handle = NULL;
- glite_jp_tagval_t* tags = NULL;
- int i,j;
- glite_jp_error_t err;
-
- assert(job != NULL);
- assert(attrs_inout != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- for (i = 0; attrs_inout[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
- switch (attrs_inout[i].attr.type) {
- case GLITE_JP_ATTR_OWNER:
-
-/* must be implemented via filetype plugin
- case GLITE_JP_ATTR_TIME:
-*/
- if (!got_info) {
- if (get_job_info(ctx, job, &owner, &tv_reg)) {
- err.code = ctx->error->code;
- err.desc = "Cannot retrieve job info";
- goto error_out;
- }
- got_info = 1;
- }
- break;
-
-/* must be implemented via filetype plugin
- case GLITE_JP_ATTR_TAG:
- if (!got_tags) {
- if (glite_jppsbe_open_file(ctx, job, GLITE_JP_FILECLASS_TAGS,
- O_RDONLY, &tags_handle)) {
- err.code = ctx->error->code;
- err.desc = "Cannot open tag file";
- goto error_out;
- }
- if (glite_jpps_tag_readall(ctx, tags_handle, &tags)) {
- err.code = ctx->error->code;
- err.desc = "Cannot read tags";
- glite_jppsbe_close_file(ctx, tags_handle);
- goto error_out;
- }
- glite_jppsbe_close_file(ctx, tags_handle);
- got_tags = 1;
- }
- break;
-*/
- default:
- err.code = EINVAL;
- err.desc = "Invalid attribute type";
- goto error_out;
- break;
- }
-
- switch (attrs_inout[i].attr.type) {
- case GLITE_JP_ATTR_OWNER:
- attrs_inout[i].value.s = strdup(owner);
- if (!attrs_inout[i].value.s) {
- err.code = ENOMEM;
- err.desc = "Cannot copy owner string";
- goto error_out;
- }
- break;
- case GLITE_JP_ATTR_TIME:
- attrs_inout[i].value.time = tv_reg;
- break;
-
-/* must be implemented via filetype plugin
- case GLITE_JP_ATTR_TAG:
- for (j = 0; tags[j].name != NULL; j++) {
- if (!strcmp(tags[j].name, attrs_inout[i].attr.name)) {
- if (glite_jpps_tagval_copy(ctx, &tags[j],
- &attrs_inout[i].value.tag)) {
- err.code = ENOMEM;
- err.desc = "Cannot copy tag value";
- goto error_out;
- }
- break;
- }
- }
- if (!tags[j].name) attrs_inout[i].value.tag.name = NULL;
- break;
-*/
- default:
- break;
- }
- }
-
-error_out:
- free(owner);
- if (tags) for (j = 0; tags[j].name != NULL; j++) {
- free(tags[j].name);
- free(tags[j].value);
- }
- free(tags);
-
- if (err.code) {
- while (i > 0) {
- i--;
- switch (attrs_inout[i].attr.type) {
- case GLITE_JP_ATTR_OWNER:
- free(attrs_inout[i].value.s);
- break;
- case GLITE_JP_ATTR_TAG:
- free(attrs_inout[i].value.tag.name);
- free(attrs_inout[i].value.tag.value);
- default:
- break;
- }
- }
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-static int compare_timeval(struct timeval a, struct timeval b)
-{
- if (a.tv_sec < b.tv_sec) return -1;
- if (a.tv_sec > b.tv_sec) return 1;
- if (a.tv_usec < b.tv_usec) return -1;
- if (a.tv_usec > b.tv_usec) return 1;
- return 0;
-}
-
-
-/* FIXME: disabled -- clarification wrt. filetype plugin needed */
-
-#if 0
-
-static int query_phase2(
- glite_jp_context_t ctx,
- const char *ownerhash,
- long regtime_tr,
- int q_tags,
- int md_tags,
- const glite_jp_query_rec_t query[],
- glite_jp_attrval_t metadata[],
- int (*callback)(
- glite_jp_context_t ctx,
- const char *job,
- const glite_jp_attrval_t metadata[]
- )
-);
-
-static int query_phase2(
- glite_jp_context_t ctx,
- const char *ownerhash,
- long regtime_tr,
- int q_tags,
- int md_tags,
- const glite_jp_query_rec_t query[],
- glite_jp_attrval_t metadata[],
- int (*callback)(
- glite_jp_context_t ctx,
- const char *job,
- const glite_jp_attrval_t metadata[]
- )
-)
-{
- char *time_dirname = NULL;
- DIR *time_dirp = NULL;
- struct dirent *jobent;
- char *info_fname = NULL;
- char *jobid = NULL;
- char *owner = NULL;
- struct timeval tv_reg;
- void *tags_handle = NULL;
- int matching;
- int i, j;
- glite_jp_tagval_t* tags = NULL;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (asprintf(&time_dirname, "%s/data/%s/%d", config->internal_path,
- ownerhash, regtime_tr) == -1) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- time_dirp = opendir(time_dirname);
- if (!time_dirp) {
- free(time_dirname);
- return 0; /* found nothing */
- }
- while ((jobent = readdir(time_dirp)) != NULL) {
- if (!strcmp(jobent->d_name, ".")) continue;
- if (!strcmp(jobent->d_name, "..")) continue;
- if (asprintf(&info_fname, "%s/%s/_info", time_dirname,
- jobent->d_name) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- if (get_job_info_int(ctx, info_fname, &jobid, &owner, &tv_reg)) {
- err.code = EIO;
- err.desc = "Cannot retrieve job info";
- goto error_out;
- }
- if (q_tags || md_tags) {
- if (glite_jppsbe_open_file(ctx, jobid, GLITE_JP_FILECLASS_TAGS,
- O_RDONLY, &tags_handle)) {
- err.code = ctx->error->code;
- err.desc = "Cannot open tag file";
- goto error_out;
- }
- if (glite_jpps_tag_readall(ctx, tags_handle, &tags)) {
- err.code = ctx->error->code;
- err.desc = "Cannot read tags";
- glite_jppsbe_close_file(ctx, tags_handle);
- goto error_out;
- }
- glite_jppsbe_close_file(ctx, tags_handle);
- tags_handle = NULL;
- }
-
- matching = 1;
- for (i = 0; matching && query[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
- switch (query[i].attr.type) {
- case GLITE_JP_ATTR_OWNER:
- if (query[i].value.s == NULL ||
- strcmp(query[i].value.s, owner)) matching = 0;
- break;
- case GLITE_JP_ATTR_TIME:
- switch (query[i].op) {
- case GLITE_JP_QUERYOP_EQUAL:
- matching = !compare_timeval(tv_reg, query[i].value.time);
- break;
- case GLITE_JP_QUERYOP_UNEQUAL:
- matching = compare_timeval(tv_reg, query[i].value.time);
- break;
- case GLITE_JP_QUERYOP_LESS:
- matching = compare_timeval(tv_reg, query[i].value.time) < 0;
- break;
- case GLITE_JP_QUERYOP_GREATER:
- matching = compare_timeval(tv_reg, query[i].value.time) > 0;
- break;
- case GLITE_JP_QUERYOP_WITHIN:
- matching = compare_timeval(tv_reg, query[i].value.time) >= 0
- && compare_timeval(tv_reg, query[i].value2.time) <= 0;
- break;
- }
- break;
- case GLITE_JP_ATTR_TAG:
- if (!tags) {
- matching = 0;
- break;
- }
- for (j = 0; tags[j].name != NULL; j++) {
- if (!strcmp(tags[j].name, query[i].attr.name)) {
- switch (query[i].op) {
- case GLITE_JP_QUERYOP_EQUAL:
- matching = !strcmp(tags[j].value, query[i].value.s);
- break;
- case GLITE_JP_QUERYOP_UNEQUAL:
- matching = strcmp(tags[j].value, query[i].value.s);
- break;
- case GLITE_JP_QUERYOP_LESS:
- matching = strcmp(tags[j].value, query[i].value.s) < 0;
- break;
- case GLITE_JP_QUERYOP_GREATER:
- matching = strcmp(tags[j].value, query[i].value.s) > 0;
- break;
- case GLITE_JP_QUERYOP_WITHIN:
- matching = strcmp(tags[j].value, query[i].value.s) >= 0 \
- && strcmp(tags[j].value, query[i].value2.s) <= 0 ;
- break;
- default:
- break;
- }
- }
- }
- break;
- default:
- break;
- }
- }
- if (!matching) {
- free(info_fname); info_fname = NULL;
- free(jobid); jobid = NULL;
- if (tags) for (j = 0; tags[j].name != NULL; j++) {
- free(tags[j].name);
- free(tags[j].value);
- }
- free(tags); tags = NULL;
- continue;
- }
-
- for (i = 0; metadata[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
- switch (metadata[i].attr.type) {
- case GLITE_JP_ATTR_OWNER:
- metadata[i].value.s = owner;
- break;
- case GLITE_JP_ATTR_TIME:
- metadata[i].value.time = tv_reg;
- break;
- case GLITE_JP_ATTR_TAG:
- for (j = 0; tags[j].name != NULL; j++) {
- if (!strcmp(tags[j].name, metadata[i].attr.name)) {
- if (glite_jpps_tagval_copy(ctx, &tags[j],
- &metadata[i].value.tag)) {
- err.code = ENOMEM;
- err.desc = "Cannot copy tag value";
- goto error_out;
- }
- break;
- }
- }
- if (!tags[j].name) {
- metadata[i].value.tag.name = NULL;
- metadata[i].value.tag.value = NULL;
- }
- break;
- default:
- break;
- }
- }
- (*callback)(ctx, jobid, metadata);
- free(jobid); jobid = NULL;
- while (i > 0) {
- i--;
- switch (metadata[i].attr.type) {
- case GLITE_JP_ATTR_TAG:
- free(metadata[i].value.tag.name);
- free(metadata[i].value.tag.value);
- default:
- break;
- }
- }
- }
-
-error_out:
- if (tags) for (j = 0; tags[j].name != NULL; j++) {
- free(tags[j].name);
- free(tags[j].value);
- }
- if (tags_handle) glite_jppsbe_close_file(ctx, tags_handle);
- free(info_fname);
- free(owner);
- free(jobid);
- closedir(time_dirp);
- free(time_dirname);
- if (err.code) {
- while (i > 0) {
- i--;
- switch (metadata[i].attr.type) {
- case GLITE_JP_ATTR_TAG:
- free(metadata[i].value.tag.name);
- free(metadata[i].value.tag.value);
- default:
- break;
- }
- }
- return glite_jp_stack_error(ctx,&err);
- } else
- return 0;
-}
-
-int glite_jppsbe_query(
- glite_jp_context_t ctx,
- const glite_jp_query_rec_t query[],
- const glite_jp_attrval_t metadata[],
- int (*callback)(
- glite_jp_context_t ctx,
- const char *job,
- const glite_jp_attrval_t metadata[]
- )
-)
-{
- /* XXX clone metadata */
- int i;
- char *q_exact_owner = NULL;
- char *ownerhash = NULL;
- long q_min_time = 0;
- long q_max_time = LONG_MAX;
- long q_min_time_tr;
- long q_max_time_tr;
- int q_with_tags = 0;
- int md_info = 0;
- int md_tags = 0;
- char *owner_dirname = NULL;
- DIR *owner_dirp = NULL;
- struct dirent *ttimeent;
- char *data_dirname = NULL;
- DIR *data_dirp = NULL;
- struct dirent *ownerent;
- long ttime = 0;
- glite_jp_attrval_t *metadata_templ = NULL;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- for (i = 0; query[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
- if (query[i].attr.type == GLITE_JP_ATTR_OWNER && query[i].op == GLITE_JP_QUERYOP_EQUAL) {
- q_exact_owner = query[i].value.s;
- }
- if (query[i].attr.type == GLITE_JP_ATTR_TIME) {
- switch (query[i].op) {
- case GLITE_JP_QUERYOP_EQUAL:
- q_min_time = query[i].value.time.tv_sec;
- q_max_time = query[i].value.time.tv_sec + 1;
- break;
- case GLITE_JP_QUERYOP_LESS:
- if (q_max_time > query[i].value.time.tv_sec + 1)
- q_max_time = query[i].value.time.tv_sec + 1;
- break;
- case GLITE_JP_QUERYOP_WITHIN:
- if (q_max_time > query[i].value2.time.tv_sec + 1)
- q_max_time = query[i].value2.time.tv_sec + 1;
- /* fallthrough */
- case GLITE_JP_QUERYOP_GREATER:
- if (q_min_time < query[i].value.time.tv_sec)
- q_min_time = query[i].value.time.tv_sec;
- break;
- default:
- err.code = EINVAL;
- err.desc = "Invalid query op";
- return glite_jp_stack_error(ctx,&err);
- break;
- }
- }
- if (query[i].attr.type == GLITE_JP_ATTR_TAG)
- q_with_tags = 1;
-
- }
-
- for (i = 0; metadata[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
- switch (metadata[i].attr.type) {
- case GLITE_JP_ATTR_OWNER:
- case GLITE_JP_ATTR_TIME:
- md_info = 1;
- break;
- case GLITE_JP_ATTR_TAG:
- md_tags = 1;
- break;
- default:
- err.code = EINVAL;
- err.desc = "Invalid attribute type in metadata parameter";
- return glite_jp_stack_error(ctx,&err);
- break;
- }
- }
- metadata_templ = (glite_jp_attrval_t *) calloc(i + 1, sizeof(glite_jp_attrval_t));
- if (!metadata_templ) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- memcpy(metadata_templ, metadata, (i + 1) * sizeof(glite_jp_attrval_t));
-
- q_min_time_tr = regtime_trunc(q_min_time);
- q_max_time_tr = regtime_ceil(q_max_time);
-
- if (q_exact_owner) {
- ownerhash = str2md5(q_exact_owner); /* static buffer */
- if (asprintf(&owner_dirname, "%s/data/%s", config->internal_path, ownerhash) == -1) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- owner_dirp = opendir(owner_dirname);
- free(owner_dirname);
- if (!owner_dirp) {
- free(metadata_templ);
- return 0; /* found nothing */
- }
- while ((ttimeent = readdir(owner_dirp)) != NULL) {
- if (!strcmp(ttimeent->d_name, ".")) continue;
- if (!strcmp(ttimeent->d_name, "..")) continue;
- ttime = atol(ttimeent->d_name);
- if (ttime >= q_min_time_tr && ttime < q_max_time_tr) {
- if (query_phase2(ctx, ownerhash, ttime, q_with_tags, md_tags,
- query, metadata_templ, callback)) {
- err.code = EIO;
- err.desc = "query_phase2() error";
- goto error_out;
- }
- }
- }
- } else { /* !q_exact_owner */
- if (asprintf(&data_dirname, "%s/data", config->internal_path) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- data_dirp = opendir(data_dirname);
- if (!data_dirp) {
- err.code = EIO;
- err.desc = "Cannot open data directory";
- goto error_out;
- }
- while ((ownerent = readdir(data_dirp)) != NULL) {
- if (!strcmp(ownerent->d_name, ".")) continue;
- if (!strcmp(ownerent->d_name, "..")) continue;
- if (asprintf(&owner_dirname, "%s/data/%s", config->internal_path,
- ownerent->d_name) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- owner_dirp = opendir(owner_dirname);
- free(owner_dirname);
- if (!owner_dirp) {
- err.code = EIO;
- err.desc = "Cannot open owner data directory";
- goto error_out;
- }
- while ((ttimeent = readdir(owner_dirp)) != NULL) {
- if (!strcmp(ttimeent->d_name, ".")) continue;
- if (!strcmp(ttimeent->d_name, "..")) continue;
- ttime = atol(ttimeent->d_name);
- if (ttime >= q_min_time_tr && ttime < q_max_time_tr) {
- if (query_phase2(ctx, ownerent->d_name, ttime, q_with_tags, md_tags,
- query, metadata_templ, callback)) {
- err.code = EIO;
- err.desc = "query_phase2() error";
- goto error_out;
- }
- }
- }
- closedir(owner_dirp); owner_dirp = NULL;
- }
- closedir(data_dirp); data_dirp = NULL;
- }
- return 0;
-
-error_out:
- if (owner_dirp) closedir(owner_dirp);
- if (data_dirp) closedir(data_dirp);
- free(data_dirname);
- free(metadata_templ);
- return glite_jp_stack_error(ctx,&err);
-}
-
-#else
-
-/* placeholder instead */
-int glite_jppsbe_query(
- glite_jp_context_t ctx,
- const glite_jp_query_rec_t query[],
- const glite_jp_attrval_t metadata[],
- int (*callback)(
- glite_jp_context_t ctx,
- const char *job,
- const glite_jp_attrval_t metadata[]
- )
-)
-{
- glite_jp_error_t err;
- err.code = ENOSYS;
- err.desc = "not implemented";
- return glite_jp_stack_error(ctx,&err);
-}
-
-#endif
-
-/* XXX:
-- no primary authorization yet
-- no concurrency control yet
-- partial success in pwrite,append
-- "unique" part of jobid is assumed to be unique across bookkeeping servers
-- repository versioning not fully implemented yet
-*/
+++ /dev/null
-#include <sys/types.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "db.h"
-
-extern void reply(int n, char *fmt,...);
-
-#define FTPBE_DEFAULT_DB_CS "jpps/@localhost:jpps"
-
-static char *user_subj = NULL;
-static char *int_prefix = NULL;
-static glite_jp_context_t ctx;
-
-static int open_db()
-{
- char *db_cs = NULL;
-
- db_cs = getenv("FTPBE_DB_CS");
- if (!db_cs) db_cs = FTPBE_DEFAULT_DB_CS;
-
- int_prefix = getenv("FTPBE_INT_PREFIX");
- if (!int_prefix) {
- reply(550, "Internal error: prefix not configured");
- return 0;
- }
-
- glite_jp_init_context(&ctx);
- if (glite_jp_db_connect(ctx, db_cs)) {
- reply(550, "Internal error: backend DB access failed");
- return 0;
- }
-
- return 1;
-}
-
-static void close_db()
-{
- glite_jp_db_close(ctx);
-}
-
-
-int globus_gss_assist_gridmap(char* globus_id, char** mapped_name)
-{
- char *logname;
-
- logname = getenv("GLITE_USER");
- if (logname) {
- *mapped_name = strdup(logname);
- user_subj = strdup(globus_id);
- if (!(*mapped_name) || !user_subj) return 1;
-
- return 0;
- } else {
- return 1;
- /*
- * Note: return value need not follow globus numbering
- * scheme in ftpd
- */
- }
-}
-
-int globus_gss_assist_userok(char*globus_id, char *account)
-{
- char *logname;
-
- logname = getenv("GLITE_USER");
- if (logname)
- return strcmp(account,strdup(logname)) ? 1 : 0;
- else
- return 1;
-}
-
-int checknoretrieve(char *name)
-{
- int result = 1; /* deny access by default */
-
- char *stmt = NULL;
- int db_retn;
- glite_jp_db_stmt_t db_res;
- char *db_row[1] = { NULL };
-
- trio_asprintf(&stmt,"select j.owner from jobs j,files f where "
- "f.ext_url='%|Ss%|Ss' and j.jobid=f.jobid",
- int_prefix, name);
- if (!stmt) {
- reply(550, "Internal error: out of memory");
- return 1;
- }
-
- if (!open_db()) return 1;
-
- if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
- if (db_retn == 0) {
- reply(553, "No such file registered");
- } else {
- reply(550, "Internal error: backend DB access failed");
- }
- goto out;
- }
-
- db_retn = glite_jp_db_fetchrow(db_res, db_row);
- if (db_retn != 1) {
- glite_jp_db_freestmt(&db_res);
- reply(550, "Internal error: backend DB access failed");
- goto out;
- }
- glite_jp_db_freestmt(&db_res);
-
- if (!strcmp(db_row[0], user_subj)) {
- result = 0;
- } else {
- reply(553, "Permission denied");
- }
-
-out:
- free(db_row[0]);
- close_db();
- free(stmt);
- return result;
-}
-
-int upl_check(char *name, uid_t * uid, gid_t * gid, int *f_mode, int *valid)
-{
- int result = -1; /* deny access by default */
-
- char *stmt = NULL;
- int db_retn;
- glite_jp_db_stmt_t db_res;
- char *db_row[1] = { NULL };
-
- *valid = 0; /* don't used uid & gid */
-
- trio_asprintf(&stmt,"select state from files "
- "where ext_url='%|Ss%|Ss' and ul_userid='%|Ss'",
- int_prefix, name, user_subj);
- if (!stmt) {
- reply(550, "Internal error: out of memory");
- return -1;
- }
-
- if (!open_db()) return -1;
-
- if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
- if (db_retn == 0) {
- reply(553, "No such upload in progress");
- } else {
- reply(550, "Internal error: backend DB access failed");
- }
- goto out;
- }
-
- db_retn = glite_jp_db_fetchrow(db_res, db_row);
- if (db_retn != 1) {
- glite_jp_db_freestmt(&db_res);
- reply(550, "Internal error: backend DB access failed");
- goto out;
- }
- glite_jp_db_freestmt(&db_res);
-
- if (!strcmp(db_row[0], "uploading")) {
- result = 1;
- } else {
- reply(553, "Permission denied");
- }
-
-out:
- free(db_row[0]);
- close_db();
- free(stmt);
- return result;
-}
-
-int del_check(char *name)
-{
- reply(553, "Deleting files not supported");
- return 0;
-}
-
-int rename(const char *f, const char * t)
-{
- errno = EPERM;
- return -1;
-}
-
-FILE *ftpd_popen(char *program, char *type, int closestderr)
-{
- errno = EPERM;
- return NULL;
-}
+++ /dev/null
-#include <stdio.h>
-#include <time.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-#include "glite/jp/types.h"
-#include "glite/security/glite_gsplugin.h"
-
-#include "feed.h"
-#include "is_client.h"
-
-#include "jpis_ClientLib.c"
-#include "jpis_.nsmap"
-
-#include "soap_util.c"
-
-extern char *server_key, *server_cert; /* XXX */
-
-static int check_other_soap(glite_jp_context_t ctx)
-{
- glite_gsplugin_Context plugin_ctx;
-
- if (!ctx->other_soap) {
- glite_gsplugin_init_context(&plugin_ctx);
- if (server_key) plugin_ctx->key_filename = strdup(server_key);
- if (server_cert) plugin_ctx->cert_filename = strdup(server_cert);
-
- ctx->other_soap = soap_new();
- soap_init(ctx->other_soap);
- soap_set_namespaces(ctx->other_soap,jpis__namespaces);
- soap_register_plugin_arg(ctx->other_soap,glite_gsplugin,plugin_ctx);
- ctx->other_soap->user = ctx;
- }
- return 0;
-}
-
-static check_fault(glite_jp_context_t ctx,struct soap *soap,int ec)
-{
- glite_jp_error_t err;
- char buf[1000] = "unknown fault";
-
- switch (ec) {
- case SOAP_OK: return 0;
- default:
- err.code = EIO;
- err.source = __FUNCTION__;
- err.desc = buf;
- if (soap->fault) snprintf(buf,sizeof buf,"%s %s\n",
- soap->fault->faultcode,
- soap->fault->faultstring);
- buf[999] = 0;
- glite_jp_stack_error(ctx,&err);
- return err.code;
- }
-}
-
-
-int glite_jpps_single_feed(
- glite_jp_context_t ctx,
- const char *feed,
- int done,
- const char *destination,
- const char *job,
- const char *owner,
- glite_jp_attrval_t const *attrs
-)
-{
- struct _jpelem__UpdateJobs in;
- struct _jpelem__UpdateJobsResponse out;
- struct jptype__jobRecord jr, *jrp = &jr;
- int i;
- enum xsd__boolean false = false_;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
-
- /* TODO: call JP Index server via interlogger */
-
- printf("feed to %s, job %s\n",destination,job);
-
- check_other_soap(ctx);
-
- in.feedId = (char *) feed; /* XXX: const */
- in.feedDone = done;
- in.__sizejobAttributes = 1;
- in.jobAttributes = &jrp;
-
- for (i=0; attrs[i].name; i++);
- jr.jobid = (char *) job; /* XXX: const */
- jr.owner = owner;
-
- jr.__sizeattributes = jp2s_attrValues(ctx->other_soap,
- (glite_jp_attrval_t *) attrs, /* XXX: const */
- &jr.attributes,0);
-
- jr.remove = &false;
- jr.__sizeprimaryStorage = 1;
- jr.primaryStorage = &ctx->myURL;
-
-
- if (soap_call___jpsrv__UpdateJobs(ctx->other_soap,destination,"",
- &in,&out
- )) {
- char buf[1000];
- err.code = EIO;
- err.source = __FUNCTION__;
- err.desc = buf;
- snprintf(buf,sizeof buf,"%s %s\n",
- ctx->other_soap->fault->faultcode,
- ctx->other_soap->fault->faultstring);
- buf[999] = 0;
- glite_jp_stack_error(ctx,&err);
- }
-
- attrValues_free(ctx->other_soap,jr.attributes,jr.__sizeattributes);
-
- return err.code;
-}
-
-int glite_jpps_multi_feed(
- glite_jp_context_t ctx,
- const char *feed,
- int done,
- int njobs,
- const char *destination,
- char **jobs,
- char **owners,
- glite_jp_attrval_t **attrs)
-{
- int i,j;
-
- struct _jpelem__UpdateJobs in;
- struct _jpelem__UpdateJobsResponse out;
- struct jptype__jobRecord *jr;
- enum xsd__boolean false = false_;
- glite_jp_error_t err;
-
- printf("multi_feed: %s\n",destination);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
-
- check_other_soap(ctx);
-
- in.feedId = (char *) feed; /* XXX: const */
- in.feedDone = done;
- in.__sizejobAttributes = njobs;
- in.jobAttributes = malloc(njobs * sizeof *in.jobAttributes);
-
- for (i=0; i<njobs; i++) {
- puts(jobs[i]);
- for (j=0; attrs[i][j].name; j++)
- printf("%s = %s\n",attrs[i][j].name,attrs[i][j].value);
- putchar(10);
-
- in.jobAttributes[i] = jr = malloc(sizeof *jr);
- jr->jobid = jobs[i];
- jr->owner = owners[i];
-
- jr->__sizeattributes = jp2s_attrValues(ctx->other_soap,
- attrs[i],
- &jr->attributes,0);
-
- jr->remove = &false;
- jr->__sizeprimaryStorage = 1;
- jr->primaryStorage = &ctx->myURL;
- }
-
- check_fault(ctx,ctx->other_soap,
- soap_call___jpsrv__UpdateJobs(ctx->other_soap,destination,"", &in,&out));
- for (i=0; i<njobs; i++) {
- jr = in.jobAttributes[i];
- attrValues_free(ctx->other_soap,jr->attributes,jr->__sizeattributes);
- free(jr);
- }
- free(in.jobAttributes);
-
- return err.code;
-}
-
+++ /dev/null
-int glite_jpps_single_feed(glite_jp_context_t,const char *,int,const char *,const char *,const char *,glite_jp_attrval_t const *);
-int glite_jpps_multi_feed(glite_jp_context_t,const char *,int,int,const char *,char **,char **,glite_jp_attrval_t **);
-
-
+++ /dev/null
-#include "soap_version.h"
-
-#if GSOAP_VERSION >= 20700
-#define INPUT_SANDBOX jptype__UploadClass__INPUT_SANDBOX
-#define OUTPUT_SANDBOX jptype__UploadClass__OUTPUT_SANDBOX
-#define JOB_LOG jptype__UploadClass__JOB_LOG
-
-#define OWNER jptype__AttributeType__OWNER
-#define TIME jptype__AttributeType__TIME
-#define TAG jptype__AttributeType__TAG
-
-#define EQUAL jptype__queryOp__EQUAL
-#define UNEQUAL jptype__queryOp__UNEQUAL
-#define LESS jptype__queryOp__LESS
-#define GREATER jptype__queryOp__GREATER
-#define WITHIN jptype__queryOp__WITHIN
-
-#else
-
-#define __jpsrv__RegisterJob __ns1__RegisterJob
-#define __jpsrv__StartUpload __ns1__StartUpload
-#define __jpsrv__CommitUpload __ns1__CommitUpload
-#define __jpsrv__RecordTag __ns1__RecordTag
-#define __jpsrv__FeedIndex __ns1__FeedIndex
-#define __jpsrv__FeedIndexRefresh __ns1__FeedIndexRefresh
-#define __jpsrv__GetJob __ns1__GetJob
-
-#define SOAP_TYPE___jpsrv__RegisterJob SOAP_TYPE___ns1__RegisterJob
-#define SOAP_TYPE___jpsrv__StartUpload SOAP_TYPE___ns1__StartUpload
-#define SOAP_TYPE___jpsrv__CommitUpload SOAP_TYPE___ns1__CommitUpload
-#define SOAP_TYPE___jpsrv__GetJob SOAP_TYPE___ns1__GetJob
-
-#endif
-
+++ /dev/null
-#ident "$Header$"
-
-#include "mysql.h" // MySql header file
-#include "mysqld_error.h"
-#include "errmsg.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <time.h>
-#include <limits.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "db.h"
-
-#define DEFAULTCS "jpps/@localhost:jpps1"
-#define GLITE_JP_LB_MYSQL_VERSION 40018
-
-static int my_err(glite_jp_context_t ctx, char *function)
-{
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = function;
- err.code = EIO; /* XXX */
- err.desc = mysql_error((MYSQL *) ctx->dbhandle);
- return glite_jp_stack_error(ctx,&err);
-}
-
-struct _glite_jp_db_stmt_t {
- MYSQL_RES *result;
- glite_jp_context_t ctx;
-};
-
-int glite_jp_db_connect(glite_jp_context_t ctx,char *cs)
-{
- char *buf = NULL;
- char *host,*user,*pw,*db;
- char *slash,*at,*colon;
-
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (!cs) cs = DEFAULTCS;
-
- if (!(ctx->dbhandle = (void *) mysql_init(NULL))) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
-
- mysql_options(ctx->dbhandle, MYSQL_READ_DEFAULT_FILE, "my");
-
- host = user = pw = db = NULL;
-
- buf = strdup(cs);
- slash = strchr(buf,'/');
- at = strrchr(buf,'@');
- colon = strrchr(buf,':');
-
- if (!slash || !at || !colon) {
- free(buf);
- err.code = EINVAL;
- err.desc = "Invalid DB connect string";
- return glite_jp_stack_error(ctx,&err);
- }
-
- *slash = *at = *colon = 0;
- host = at+1;
- user = buf;
- pw = slash+1;
- db = colon+1;
-
- if (!mysql_real_connect((MYSQL *) ctx->dbhandle,host,user,pw,db,0,NULL,CLIENT_FOUND_ROWS)) {
- free(buf);
- return my_err(ctx, __FUNCTION__);
- }
-
- free(buf);
- return 0;
-}
-
-void glite_jp_db_close(glite_jp_context_t ctx)
-{
- mysql_close((MYSQL *) ctx->dbhandle);
- ctx->dbhandle = NULL;
-}
-
-int glite_jp_db_execstmt(glite_jp_context_t ctx,char *txt,glite_jp_db_stmt_t *stmt)
-{
- int merr;
- int retry_nr = 0;
- int do_reconnect = 0;
-
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (stmt) {
- *stmt = NULL;
- }
-
- while (retry_nr == 0 || do_reconnect) {
- do_reconnect = 0;
- if (mysql_query((MYSQL *) ctx->dbhandle,txt)) {
- /* error occured */
- switch (merr = mysql_errno((MYSQL *) ctx->dbhandle)) {
- case 0:
- break;
- case ER_DUP_ENTRY:
- err.code = EEXIST;
- err.desc = mysql_error((MYSQL *) ctx->dbhandle);
- glite_jp_stack_error(ctx,&err);
- return -1;
- break;
- case CR_SERVER_LOST:
- if (retry_nr <= 0)
- do_reconnect = 1;
- break;
- default:
- my_err(ctx, __FUNCTION__);
- return -1;
- break;
- }
- }
- retry_nr++;
- }
-
- if (stmt) {
- *stmt = malloc(sizeof(**stmt));
- if (!*stmt) {
- err.code = ENOMEM;
- glite_jp_stack_error(ctx,&err);
- return -1;
- }
- memset(*stmt,0,sizeof(**stmt));
- (**stmt).ctx = ctx;
- (**stmt).result = mysql_store_result((MYSQL *) ctx->dbhandle);
- if (!(**stmt).result) {
- if (mysql_errno((MYSQL *) ctx->dbhandle)) {
- my_err(ctx, __FUNCTION__);
- return -1;
- }
- }
- } else {
- MYSQL_RES *r = mysql_store_result((MYSQL *) ctx->dbhandle);
- mysql_free_result(r);
- }
-
- return mysql_affected_rows((MYSQL *) ctx->dbhandle);
-}
-
-int glite_jp_db_fetchrow(glite_jp_db_stmt_t stmt,char **res)
-{
- MYSQL_ROW row;
- glite_jp_context_t ctx = stmt->ctx;
- int nr,i;
- unsigned long *len;
-
- glite_jp_clear_error(ctx);
-
- if (!stmt->result) return 0;
-
- if (!(row = mysql_fetch_row(stmt->result))) {
- if (mysql_errno((MYSQL *) ctx->dbhandle)) {
- my_err(ctx, __FUNCTION__);
- return -1;
- } else return 0;
- }
-
- nr = mysql_num_fields(stmt->result);
- len = mysql_fetch_lengths(stmt->result);
- for (i=0; i<nr; i++) res[i] = len[i] ? strdup(row[i]) : strdup("");
-
- return nr;
-}
-
-int glite_jp_db_querycolumns(glite_jp_db_stmt_t stmt,char **cols)
-{
- int i = 0;
- MYSQL_FIELD *f;
-
- while ((f = mysql_fetch_field(stmt->result))) cols[i++] = f->name;
- return i == 0;
-}
-
-void glite_jp_db_freestmt(glite_jp_db_stmt_t *stmt)
-{
- if (*stmt) {
- if ((**stmt).result) mysql_free_result((**stmt).result);
- free(*stmt);
- *stmt = NULL;
- }
-}
-
-
-char *glite_jp_db_timetodb(time_t t)
-{
- struct tm *tm = gmtime(&t);
- char tbuf[256];
-
- /* XXX: the very end of our days */
- if (!tm && t == (time_t) LONG_MAX) return strdup("9999-12-31 23:59:59");
-
- sprintf(tbuf,"'%4d-%02d-%02d %02d:%02d:%02d'",tm->tm_year+1900,tm->tm_mon+1,
- tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec);
-
- return strdup(tbuf);
-}
-
-time_t glite_jp_db_dbtotime(char *t)
-{
- struct tm tm;
-
- memset(&tm,0,sizeof(tm));
- setenv("TZ","UTC",1); tzset();
- sscanf(t,"%4d-%02d-%02d %02d:%02d:%02d",
- &tm.tm_year,&tm.tm_mon,&tm.tm_mday,
- &tm.tm_hour,&tm.tm_min,&tm.tm_sec);
- tm.tm_year -= 1900;
- tm.tm_mon--;
-
- return mktime(&tm);
-}
-
-int glite_jp_db_dbcheckversion(glite_jp_context_t ctx)
-{
- MYSQL *m = (MYSQL *) ctx->dbhandle;
- const char *ver_s = mysql_get_server_info(m);
- int major,minor,sub,version;
-
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (!ver_s || 3 != sscanf(ver_s,"%d.%d.%d",&major,&minor,&sub)) {
- err.code = EINVAL;
- err.desc = "problem checking MySQL version";
- return glite_jp_stack_error(ctx,&err);
- }
-
- version = 10000*major + 100*minor + sub;
-
- if (version < GLITE_JP_LB_MYSQL_VERSION) {
- char msg[300];
-
- snprintf(msg,sizeof msg,"Your MySQL version is %d. At least %d required.",version, GLITE_JP_LB_MYSQL_VERSION);
- err.code = EINVAL;
- err.desc = msg;
- return glite_jp_stack_error(ctx,&err);
- }
-
- return 0;
-}
+++ /dev/null
-#ident "$Header$"
-
-#include <getopt.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <assert.h>
-#include <limits.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-#include "glite/jp/strmd5.h"
-#include "glite/jp/known_attr.h"
-#include "glite/jp/attr.h"
-#include "glite/jp/escape.h"
-
-#include "feed.h"
-#include "tags.h"
-#include "backend.h"
-#include "db.h"
-
-#include "jpps_H.h" /* XXX: SOAP_TYPE___jpsrv__GetJob */
-
-#include "jptype_map.h"
-
-#define FTPBE_DEFAULT_DB_CS "jpps/@localhost:jpps"
-
-struct ftpbe_config {
- char *internal_path;
- char *external_path;
- char *db_cs;
-// char *gridmap;
- char *logname;
-};
-
-static struct ftpbe_config *config = NULL;
-
-struct fhandle_rec {
- int fd;
- int fd_append;
-};
-typedef struct fhandle_rec *fhandle;
-
-static struct option ftpbe_opts[] = {
- { "ftp-internal-path", 1, NULL, 'I' },
- { "ftp-external-path", 1, NULL, 'E' },
- { "ftp-db-cs", 1, NULL, 'D' },
-// { "ftp-gridmap", 1, NULL, 'G' },
- { NULL, 0, NULL, 0 }
-};
-
-/*******************************************************************************
- Internal helpers
-*******************************************************************************/
-
-
-static int config_check(
- glite_jp_context_t ctx,
- struct ftpbe_config *config)
-{
- return config == NULL ||
- config->internal_path == NULL ||
- config->external_path == NULL ||
- config->db_cs == NULL ||
-// config->gridmap == NULL ||
- config->logname == NULL;
-
- /* XXX check reality */
-}
-
-static int jobid_unique_pathname(glite_jp_context_t ctx, const char *job,
- char **unique, char **ju_path, int get_path)
-{
- char *p;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- p = strrchr(job, '/');
- if (!p) {
- err.code = EINVAL;
- err.desc = "Malformed jobid";
- return glite_jp_stack_error(ctx,&err);
- }
- /* XXX thorough checks */
- if (!(*unique = strdup(p+1))) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- if (get_path) {
- if (!(*ju_path = strdup(p+1))) {
- free(*unique);
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- *(*ju_path + 10) = '\0';
- }
- return 0;
-}
-
-static int mkdirpath(const char* path, int prefixlen)
-{
- char *wpath, *p;
- int goout, ret;
-
- wpath = strdup(path);
- if (!wpath) {
- errno = ENOMEM;
- return -1;
- }
-
- p = wpath + prefixlen;
- goout = 0;
- while (!goout) {
- while (*p == '/') p++;
- while (*p != '/' && *p != '\0') p++;
- goout = (*p == '\0');
- *p = '\0';
- ret = mkdir(wpath, S_IRUSR | S_IWUSR | S_IXUSR);
- if (ret < 0 && errno != EEXIST) break;
- *p = '/';
- }
- free(wpath);
- return goout ? 0 : ret;
-}
-
-static int store_user(glite_jp_context_t ctx, const char *userid, const char *subj)
-{
- glite_jp_error_t err;
- char *stmt;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- assert(userid != NULL);
- assert(subj != NULL);
-
- trio_asprintf(&stmt,"insert into users(userid,cert_subj) "
- "values ('%|Ss','%|Ss')",userid,subj);
- if (!stmt) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) {
- if (ctx->error->code == EEXIST)
- glite_jp_clear_error(ctx);
- else {
- free(stmt);
- err.code = EIO;
- err.desc = "DB access failed";
- return glite_jp_stack_error(ctx,&err);
- }
- }
- free(stmt);
-
- return 0;
-}
-
-static long regtime_trunc(long tv_sec)
-{
- return tv_sec / (86400*7);
-}
-
-static long regtime_ceil(long tv_sec)
-{
- return (tv_sec % (86400*7)) ? tv_sec/(86400*7)+1 : tv_sec/(86400*7) ;
-}
-
-/********************************************************************************
- Backend calls
-********************************************************************************/
-int glite_jppsbe_init(
- glite_jp_context_t ctx,
- int argc,
- char *argv[]
-)
-{
- glite_jp_error_t err;
- int opt;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- config = (struct ftpbe_config *) calloc(1, sizeof *config);
- if (!config) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
-
- config->logname = getlogin();
-
- while ((opt = getopt_long(argc, argv, "I:E:D:" /* G: */, ftpbe_opts, NULL)) != EOF) {
- switch (opt) {
- case 'I': config->internal_path = optarg; break;
- case 'E': config->external_path = optarg; break;
- case 'D': config->db_cs = optarg; break;
-// case 'G': config->gridmap = optarg; break;
- default: break;
- }
- }
-
- /* Defaults */
- if (!config->db_cs) config->db_cs = strdup(FTPBE_DEFAULT_DB_CS);
-
- if (config_check(ctx, config)) {
- err.code = EINVAL;
- err.desc = "Invalid FTP backend configuration";
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (glite_jp_db_connect(ctx, config->db_cs)) {
- err.code = EIO;
- err.desc = "Cannot access backend's database (during init)";
- return glite_jp_stack_error(ctx,&err);
- } else {
- glite_jp_db_close(ctx); /* slaves open their own connections */
- }
-
- return 0;
-}
-
-int glite_jppsbe_init_slave(
- glite_jp_context_t ctx
-)
-{
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (glite_jp_db_connect(ctx, config->db_cs)) {
- err.code = EIO;
- err.desc = "Cannot access backend's database";
- return glite_jp_stack_error(ctx,&err);
- }
-
- return 0;
-}
-
-int glite_jppsbe_register_job(
- glite_jp_context_t ctx,
- const char *job,
- const char *owner
-)
-{
- glite_jp_error_t err;
- char *data_dir = NULL;
- char *ju = NULL;
- char *ju_path = NULL;
- char *ownerhash = NULL;
- struct timeval reg_tv;
- char *stmt = NULL;
- char *dbtime = NULL;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- assert(job != NULL);
- assert(owner != NULL);
-
- gettimeofday(®_tv, NULL);
-
- if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
- err.code = ctx->error->code;
- err.desc = "Cannot obtain jobid unique path/name";
- return glite_jp_stack_error(ctx,&err);
- }
-
- ownerhash = str2md5(owner); /* static buffer */
- if (store_user(ctx, ownerhash, owner)) {
- err.code = EIO;
- err.desc = "Cannot store user entry";
- goto error_out;
- }
-
- dbtime = glite_jp_db_timetodb(reg_tv.tv_sec);
- if (!dbtime) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- trio_asprintf(&stmt,"insert into jobs(jobid,dg_jobid,owner,reg_time) "
- "values ('%|Ss','%|Ss','%|Ss', %s)",
- ju, job, ownerhash, dbtime);
- if (!stmt) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) {
- if (ctx->error->code == EEXIST) {
- err.code = EEXIST;
- err.desc = "Job already registered";
- }
- else {
- err.code = EIO;
- err.desc = "DB access failed";
- }
- goto error_out;
- }
-
- if (asprintf(&data_dir, "%s/data/%s/%d/%s",
- config->internal_path, ownerhash, regtime_trunc(reg_tv.tv_sec), ju) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- if (mkdirpath(data_dir, strlen(config->internal_path)) < 0 &&
- errno != EEXIST) {
- err.code = errno;
- err.desc = "Cannot mkdir jobs's data directory";
- goto error_out;
- }
-
-error_out:
- free(data_dir);
- free(stmt); free(dbtime);
- free(ju); free(ju_path);
-
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-#if 0
-static int add_to_gridmap(glite_jp_context_t ctx, const char *dn)
-{
- FILE *gridmap = NULL;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- gridmap = fopen(config->gridmap, "a");
- if (!gridmap) {
- err.code = errno;
- err.desc = "Cannot open gridmap file";
- return glite_jp_stack_error(ctx,&err);
- }
- if (fprintf(gridmap, "\"%s\" %s\n", dn, config->logname) < 6 ||
- ferror(gridmap)) {
- err.code = EIO;
- err.desc = "Cannot write to gridmap file";
- fclose(gridmap);
- return glite_jp_stack_error(ctx,&err);
- }
- fclose(gridmap);
- return 0;
-}
-
-static int remove_from_gridmap(glite_jp_context_t ctx, const char *dn)
-{
- FILE *gridmap = NULL;
- char *temp_name = NULL;
- FILE *temp_file = NULL;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- /* XXX */
- return 0;
-}
-#endif
-
-int glite_jppsbe_start_upload(
- glite_jp_context_t ctx,
- const char *job,
- const char *class,
- const char *name,
- const char *content_type,
- char **destination_out,
- time_t *commit_before_inout
-)
-{
- char *data_basename = NULL;
- char *data_fname = NULL;
- char *ju = NULL;
- char *ju_path = NULL;
- char *peername = NULL;
- char *peerhash = NULL;
-
- char *stmt = NULL;
- glite_jp_db_stmt_t db_res;
- int db_retn;
- char *db_row[2] = { NULL, NULL };
-
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- assert(job!=NULL);
- assert(destination_out!=NULL);
-
- assert(class!=NULL);
-
- if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
- err.code = ctx->error->code;
- err.desc = "Cannot obtain jobid unique path/name";
- return glite_jp_stack_error(ctx,&err);
- }
-
- peername = glite_jp_peer_name(ctx);
- if (peername == NULL) {
- err.code = EINVAL;
- err.desc = "Cannot obtain client certificate info";
- goto error_out;
- }
-
- trio_asprintf(&stmt, "select owner, reg_time from jobs"
- " where jobid='%|Ss'", ju);
-
- if (!stmt) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
- if (db_retn == 0) {
- err.code = ENOENT;
- err.desc = "No such job registered";
- } else {
- err.code = EIO;
- err.desc = "DB access failed";
- }
- goto error_out;
- }
-
- db_retn = glite_jp_db_fetchrow(db_res, db_row);
- if (db_retn != 2) {
- glite_jp_db_freestmt(&db_res);
- err.code = EIO;
- err.desc = "DB access failed";
- goto error_out;
- }
-
- glite_jp_db_freestmt(&db_res);
-
- /* XXX authorization done in soap_ops.c */
-
- /* XXX name length */
- if (asprintf(&data_basename, "%s%s%s", class,
- (name != NULL) ? "." : "",
- (name != NULL) ? name : "") == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if (asprintf(&data_fname, "%s/data/%s/%d/%s/%s",
- config->internal_path, db_row[0],
- regtime_trunc(glite_jp_db_dbtotime(db_row[1])),
- ju, data_basename) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- if (asprintf(destination_out, "%s/data/%s/%d/%s/%s",
- config->external_path, db_row[0],
- regtime_trunc(glite_jp_db_dbtotime(db_row[1])),
- ju, data_basename) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if (commit_before_inout != NULL)
- /* XXX no timeout enforced */
- /* XXX: gsoap does not like so much, one year should be enough
- *commit_before_inout = (time_t) LONG_MAX;
- */
- *commit_before_inout = time(NULL) + 365*24*60*60;
-
- /*
- if (add_to_gridmap(ctx, peername)) {
- err.code = EIO;
- err.desc = "Cannot add peer DN to ftp server authorization file";
- goto error_out;
- }
- */
-
- peerhash = str2md5(peername); /* static buffer */
- if (store_user(ctx, peerhash, peername)) {
- err.code = EIO;
- err.desc = "Cannot store upload user entry";
- goto error_out;
- }
-
- free(stmt); stmt = NULL;
- trio_asprintf(&stmt,"insert into files"
- "(jobid,filename,int_path,ext_url,state,deadline,ul_userid) "
- "values ('%|Ss','%|Ss','%|Ss','%|Ss','%|Ss', '%|Ss', '%|Ss')",
- ju, data_basename, data_fname, *destination_out, "uploading",
- glite_jp_db_timetodb(*commit_before_inout), peerhash);
- if (!stmt) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) {
- if (ctx->error->code == EEXIST) {
- err.code = EEXIST;
- err.desc = "File already stored or upload in progress";
- } else {
- err.code = EIO;
- err.desc = "DB access failed";
- }
- goto error_out;
- }
-
-error_out:
- free(db_row[0]); free(db_row[1]);
- free(stmt);
- free(data_basename);
- free(data_fname);
- free(ju); free(ju_path);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-int glite_jppsbe_commit_upload(
- glite_jp_context_t ctx,
- const char *destination
-)
-{
- char *peername = NULL;
- char *peerhash = NULL;
-
- char *stmt = NULL;
- glite_jp_db_stmt_t db_res;
- int db_retn;
- char *db_row[7] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
- int i;
-
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- assert(destination != NULL);
-
- trio_asprintf(&stmt, "select * from files where "
- "ext_url='%|Ss' and state='uploading'", destination);
- if (!stmt) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
- if (db_retn == 0) {
- err.code = ENOENT;
- err.desc = "No such upload in progress";
- } else {
- err.code = EIO;
- err.desc = "DB access failed";
- }
- goto error_out;
- }
-
- db_retn = glite_jp_db_fetchrow(db_res, db_row);
- if (db_retn != 7) {
- glite_jp_db_freestmt(&db_res);
- err.code = EIO;
- err.desc = "DB access failed";
- goto error_out;
- }
- glite_jp_db_freestmt(&db_res);
-
- peername = glite_jp_peer_name(ctx);
- if (peername == NULL) {
- err.code = EINVAL;
- err.desc = "Cannot obtain client certificate info";
- goto error_out;
- }
-
- peerhash = str2md5(peername); /* static buffer */
- if (strcmp(peerhash, db_row[6])) {
- err.code = EPERM;
- err.desc = "Upload started by client with different identity";
- goto error_out;
- }
-
- free(stmt);
- trio_asprintf(&stmt,"update files set state='committed', deadline=NULL "
- "where jobid='%|Ss' and filename='%|Ss'", db_row[0], db_row[1]);
-
- if (!stmt) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) {
- err.code = EIO;
- err.desc = "DB access failed";
- goto error_out;
- }
-error_out:
- for (i=0; i<7; i++) free(db_row[i]);
- free(peername);
- free(stmt);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-int glite_jppsbe_destination_info(
- glite_jp_context_t ctx,
- const char *destination,
- char **job,
- char **class,
- char **name
-)
-{
- char *stmt = NULL;
- glite_jp_db_stmt_t db_res;
- int db_retn;
- char *db_row[2] = { NULL, NULL};
- int i;
- char *cp = NULL;
-
- char *classname = NULL;
- glite_jp_error_t err;
-
- assert(destination != NULL);
- assert(job != NULL);
- assert(class != NULL);
- assert(name != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
-
- trio_asprintf(&stmt, "select j.dg_jobid,f.filename from jobs j,files f where "
- "f.ext_url='%|Ss' and j.jobid=f.jobid", destination);
- if (!stmt) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
- if (db_retn == 0) {
- err.code = ENOENT;
- err.desc = "Invalid destination string";
- } else {
- err.code = EIO;
- err.desc = "DB access failed";
- }
- goto error_out;
- }
-
- db_retn = glite_jp_db_fetchrow(db_res, db_row);
- if (db_retn != 2) {
- glite_jp_db_freestmt(&db_res);
- err.code = EIO;
- err.desc = "DB access failed";
- goto error_out;
- }
- glite_jp_db_freestmt(&db_res);
-
- *job = strdup(db_row[0]);
-
- cp = strchr(db_row[1],'.');
- if (!cp) {
- *name = NULL;
- } else {
- *cp++ = '\0';
- *name = strdup(cp);
- }
- *class = strdup(db_row[1]);
-
- if (!*job || !*class) {
- err.code = ENOMEM;
- goto error_out;
- }
-
-error_out:
- for (i=0; i<2; i++) free(db_row[i]);
- free(stmt);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-
-int glite_jppsbe_get_job_url(
- glite_jp_context_t ctx,
- const char *job,
- const char *class,
- const char *name,
- char **url_out
-)
-{
- char *data_basename = NULL;
- char *data_fname = NULL;
- char *ju = NULL;
- char *ju_path = NULL;
-
- char *stmt = NULL;
- glite_jp_db_stmt_t db_res;
- int db_retn;
- char *db_row[3] = { NULL, NULL, NULL };
-
- long reg_time;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- assert(job!=NULL);
- assert(url_out != NULL);
-
- assert(class!=NULL);
-
- if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
- err.code = ctx->error->code;
- err.desc = "Cannot obtain jobid unique path/ : ""name";
- return glite_jp_stack_error(ctx,&err);
- }
-
- trio_asprintf(&stmt, "select j.owner,reg_time,u.cert_subj from jobs j, users u "
- "where j.jobid='%|Ss' and j.owner = u.userid", ju);
-
- if (!stmt) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
- if (db_retn == 0) {
- err.code = ENOENT;
- err.desc = "No such job registered";
- } else {
- err.code = EIO;
- err.desc = "DB access failed";
- }
- goto error_out;
- }
-
- free(stmt); stmt = NULL;
-
- db_retn = glite_jp_db_fetchrow(db_res, db_row);
- if (db_retn != 3) {
- glite_jp_db_freestmt(&db_res);
- err.code = EIO;
- err.desc = "DB access failed";
- goto error_out;
- }
-
- glite_jp_db_freestmt(&db_res);
-
- if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__GetJobFiles,job,db_row[2])) {
- err.code = EPERM;
- goto error_out;
- }
-
- /* XXX name length */
- if (asprintf(&data_basename, "%s%s%s", class,
- (name != NULL) ? "." : "",
- (name != NULL) ? name : "") == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if (asprintf(url_out, "%s/data/%s/%d/%s/%s",
- config->external_path, db_row[0],
- regtime_trunc(glite_jp_db_dbtotime(db_row[1])),
- ju, data_basename) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- trio_asprintf(&stmt,"select 'x' from files where jobid='%|Ss' "
- "and ext_url = '%|Ss' "
- "and state='committed' ",ju,*url_out);
-
- if ((db_retn = glite_jp_db_execstmt(ctx,stmt,&db_res)) <= 0) {
- if (db_retn == 0) {
- err.code = ENOENT;
- err.desc = "not uploaded yet";
- }
- else {
- err.code = EIO;
- err.desc = "DB access failed";
- }
- /* goto error_out; */
- }
-
-error_out:
- free(db_row[0]); free(db_row[1]);
- free(stmt);
- free(data_basename);
- free(ju); free(ju_path);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-static int get_job_fname(
- glite_jp_context_t ctx,
- const char *job,
- const char *class,
- const char *name,
- char **fname_out
-)
-{
- char *data_basename = NULL;
- char *ju = NULL;
- char *ju_path = NULL;
-
- char *stmt = NULL;
- glite_jp_db_stmt_t db_res;
- int db_retn;
- char *db_row[2] = { NULL, NULL };
-
- long reg_time;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- assert(job!=NULL);
- assert(fname_out != NULL);
-
- assert(class!=NULL);
-
- if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) {
- err.code = ctx->error->code;
- err.desc = "Cannot obtain jobid unique path/name";
- return glite_jp_stack_error(ctx,&err);
- }
-
- trio_asprintf(&stmt, "select owner, reg_time from jobs "
- "where jobid='%|Ss'", ju);
-
- if (!stmt) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if ((db_retn = glite_jp_db_execstmt(ctx, stmt, &db_res)) <= 0) {
- if (db_retn == 0) {
- err.code = ENOENT;
- err.desc = "No such job registered";
- } else {
- err.code = EIO;
- err.desc = "DB access failed";
- }
- goto error_out;
- }
-
- db_retn = glite_jp_db_fetchrow(db_res, db_row);
- if (db_retn != 2) {
- glite_jp_db_freestmt(&db_res);
- err.code = EIO;
- err.desc = "DB access failed";
- goto error_out;
- }
-
- glite_jp_db_freestmt(&db_res);
-
- /* XXX name length */
- if (asprintf(&data_basename, "%s%s%s", class,
- (name != NULL) ? "." : "", (name != NULL) ? name : "") == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- if (asprintf(fname_out, "%s/data/%s/%d/%s/%s",
- config->internal_path, db_row[0],
- regtime_trunc(glite_jp_db_dbtotime(db_row[1])),
- ju, data_basename) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
-
-error_out:
- free(db_row[0]); free(db_row[1]);
- free(stmt);
- free(data_basename);
- free(ju); free(ju_path);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-
-int glite_jppsbe_open_file(
- glite_jp_context_t ctx,
- const char *job,
- const char *class,
- const char *name,
- int mode,
- void **handle_out
-)
-{
- fhandle handle = NULL;
- char* fname = NULL;
- glite_jp_error_t err;
-
- assert(handle_out != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (get_job_fname(ctx, job, class, name, &fname)) {
- err.code = ctx->error->code;
- err.desc = "Cannot construct internal filename";
- return glite_jp_stack_error(ctx,&err);
- }
-
- handle = (fhandle) calloc(1,sizeof(*handle));
- if (handle == NULL) {
- err.code = ENOMEM;
- goto error_out;
- }
-
- handle->fd = open(fname, mode, S_IRUSR | S_IWUSR);
- if (handle->fd < 0) {
- err.code = errno;
- err.desc = "Cannot open requested file";
- free(handle);
- goto error_out;
- }
- handle->fd_append = open(fname, mode | O_APPEND, S_IRUSR | S_IWUSR);
- if (handle->fd_append < 0) {
- err.code = errno;
- err.desc = "Cannot open requested file for append";
- close(handle->fd);
- free(handle);
- goto error_out;
- }
- *handle_out = (void*) handle;
-
-error_out:
- free(fname);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-int glite_jppsbe_close_file(
- glite_jp_context_t ctx,
- void *handle
-)
-{
- glite_jp_error_t err;
-
- assert(handle != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (close(((fhandle)handle)->fd_append) < 0) {
- err.code = errno;
- err.desc = "Error closing file descriptor (fd_append)";
- goto error_out;
- }
- if (close(((fhandle)handle)->fd) < 0) {
- err.code = errno;
- err.desc = "Error closing file descriptor";
- goto error_out;
- }
-
-error_out:
- free(handle);
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-int glite_jppsbe_pread(
- glite_jp_context_t ctx,
- void *handle,
- void *buf,
- size_t nbytes,
- off_t offset,
- ssize_t *nbytes_ret
-)
-{
- ssize_t ret;
- glite_jp_error_t err;
-
- assert(handle != NULL);
- assert(buf != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if ((ret = pread(((fhandle)handle)->fd, buf, nbytes, offset)) < 0) {
- err.code = errno;
- err.desc = "Error in pread()";
- return glite_jp_stack_error(ctx,&err);
- }
- *nbytes_ret = ret;
-
- return 0;
-}
-
-int glite_jppsbe_pwrite(
- glite_jp_context_t ctx,
- void *handle,
- void *buf,
- size_t nbytes,
- off_t offset
-)
-{
- glite_jp_error_t err;
-
- assert(handle != NULL);
- assert(buf != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (pwrite(((fhandle)handle)->fd, buf, nbytes, offset) < 0) {
- err.code = errno;
- err.desc = "Error in pwrite()";
- return glite_jp_stack_error(ctx,&err);
- }
-
- return 0;
-}
-
-int glite_jppsbe_append(
- glite_jp_context_t ctx,
- void *handle,
- void *buf,
- size_t nbytes
-)
-{
- glite_jp_error_t err;
-
- assert(handle != NULL);
- assert(buf != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (write(((fhandle)handle)->fd_append, buf, nbytes) < 0) {
- err.code = errno;
- err.desc = "Error in write()";
- return glite_jp_stack_error(ctx,&err);
- }
-
- return 0;
-}
-
-static int get_job_info(
- glite_jp_context_t ctx,
- const char *job,
- char **owner,
- struct timeval *tv_reg
-)
-{
- char *qry,*col[2];
- int rows;
- glite_jp_error_t err;
- glite_jp_db_stmt_t s = NULL;
-
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
- glite_jp_clear_error(ctx);
-
- trio_asprintf(&qry,"select u.cert_subj,j.reg_time "
- "from jobs j, users u "
- "where j.owner = u.userid "
- "and j.dg_jobid = '%|Ss'",job);
-
- if ((rows = glite_jp_db_execstmt(ctx,qry,&s)) <= 0) {
- if (rows == 0) {
- err.code = ENOENT;
- err.desc = "No records for this job";
- }
- else {
- err.code = EIO;
- err.desc = "DB call fail retrieving job files";
- }
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
-
- if (glite_jp_db_fetchrow(s,col) < 0) {
- err.code = EIO;
- err.desc = "DB call fail retrieving job files";
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
-
- *owner = col[0];
- tv_reg->tv_sec = glite_jp_db_dbtotime(col[1]);
- tv_reg->tv_usec = 0;
- free(col[1]);
-
-cleanup:
- free(qry);
- if (s) glite_jp_db_freestmt(&s);
- return err.code;
-}
-
-#if 0 /* called from query */
-static int get_job_info_int(
- glite_jp_context_t ctx,
- const char *int_fname,
- char **jobid,
- char **owner,
- struct timeval *tv_reg
-)
-{
- FILE *regfile = NULL;
- long reg_time_sec;
- long reg_time_usec;
- int ownerlen = 0;
- int info_version;
- char jobid_buf[256];
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- regfile = fopen(int_fname, "r");
- if (regfile == NULL) {
- err.code = errno;
- err.desc = "Cannot open jobs's reg info file";
- goto error_out;
- }
- if (fscanf(regfile, "%d %ld.%ld %s %*s %d ", &info_version,
- ®_time_sec, ®_time_usec, jobid_buf, &ownerlen) < 5 || ferror(regfile)) {
- fclose(regfile);
- err.code = errno;
- err.desc = "Cannot read jobs's reg info file";
- goto error_out;
- }
- *jobid = strdup(jobid_buf);
- if (ownerlen) {
- *owner = (char *) calloc(1, ownerlen+1);
- if (!*owner) {
- err.code = ENOMEM;
- goto error_out;
- }
- if (fgets(*owner, ownerlen+1, regfile) == NULL) {
- fclose(regfile);
- free(*owner);
- err.code = errno;
- err.desc = "Cannot read jobs's reg info file";
- goto error_out;
- }
- }
- fclose(regfile);
-
- tv_reg->tv_sec = reg_time_sec;
- tv_reg->tv_usec = reg_time_usec;
-
-error_out:
- if (err.code) {
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-
-#endif
-
-int glite_jppsbe_get_job_metadata(
- glite_jp_context_t ctx,
- const char *job,
- glite_jp_attrval_t attrs_inout[]
-)
-{
- int got_info = 0;
- struct timeval tv_reg;
- char *owner = NULL;
-/* do in plugin
- int got_tags = 0;
- void *tags_handle = NULL;
- glite_jp_tagval_t* tags = NULL;
-*/
- int i,j;
- glite_jp_error_t err;
-
- assert(job != NULL);
- assert(attrs_inout != NULL);
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- for (i = 0; attrs_inout[i].name; i++) {
-/* must be implemented via filetype plugin
- case GLITE_JP_ATTR_TIME:
-*/
- if (!strcmp(attrs_inout[i].name,GLITE_JP_ATTR_OWNER)
- || !strcmp(attrs_inout[i].name,GLITE_JP_ATTR_REGTIME)) {
- if (!got_info) {
- if (get_job_info(ctx, job, &owner, &tv_reg)) {
- err.code = ctx->error->code;
- err.desc = "Cannot retrieve job info";
- goto error_out;
- }
- got_info = 1;
- }
- }
-
-/* must be implemented via filetype plugin
- case GLITE_JP_ATTR_TAG:
- if (!got_tags) {
- if (glite_jppsbe_open_file(ctx, job, GLITE_JP_FILECLASS_TAGS,
- O_RDONLY, &tags_handle)) {
- err.code = ctx->error->code;
- err.desc = "Cannot open tag file";
- goto error_out;
- }
- if (glite_jpps_tag_readall(ctx, tags_handle, &tags)) {
- err.code = ctx->error->code;
- err.desc = "Cannot read tags";
- glite_jppsbe_close_file(ctx, tags_handle);
- goto error_out;
- }
- glite_jppsbe_close_file(ctx, tags_handle);
- got_tags = 1;
- }
- break;
-*/
- else {
- err.code = EINVAL;
- err.desc = "Invalid attribute type";
- goto error_out;
- break;
- }
-
- if (!strcmp(attrs_inout[i].name,GLITE_JP_ATTR_OWNER)) {
- attrs_inout[i].value = strdup(owner);
- if (!attrs_inout[i].value) {
- err.code = ENOMEM;
- err.desc = "Cannot copy owner string";
- goto error_out;
- }
- attrs_inout[i].origin = GLITE_JP_ATTR_ORIG_SYSTEM;
- attrs_inout[i].origin_detail = NULL;
-
- /* XXX */
- attrs_inout[i].timestamp = tv_reg.tv_sec;
- }
-
- if (!strcmp(attrs_inout[i].name,GLITE_JP_ATTR_REGTIME)) {
- trio_asprintf(&attrs_inout[i].value,"%ld.%06ld",tv_reg.tv_sec,tv_reg.tv_usec);
- attrs_inout[i].origin = GLITE_JP_ATTR_ORIG_SYSTEM;
- attrs_inout[i].origin_detail = NULL;
- attrs_inout[i].timestamp = tv_reg.tv_sec;
- }
-
-/* TODO:
- case GLITE_JP_ATTR_TIME:
- attrs_inout[i].value.time = tv_reg;
- break;
-*/
-
-/* must be implemented via filetype plugin
- case GLITE_JP_ATTR_TAG:
- for (j = 0; tags[j].name != NULL; j++) {
- if (!strcmp(tags[j].name, attrs_inout[i].attr.name)) {
- if (glite_jpps_tagval_copy(ctx, &tags[j],
- &attrs_inout[i].value.tag)) {
- err.code = ENOMEM;
- err.desc = "Cannot copy tag value";
- goto error_out;
- }
- break;
- }
- }
- if (!tags[j].name) attrs_inout[i].value.tag.name = NULL;
- break;
-*/
- }
-
-error_out:
- free(owner);
-/* plugin
- if (tags) for (j = 0; tags[j].name != NULL; j++) {
- free(tags[j].name);
- free(tags[j].value);
- }
- free(tags);
-*/
-
- if (err.code) {
- while (i > 0) {
- i--;
- glite_jp_attrval_free(attrs_inout+i,0);
- }
- return glite_jp_stack_error(ctx,&err);
- } else {
- return 0;
- }
-}
-static int compare_timeval(struct timeval a, struct timeval b)
-{
- if (a.tv_sec < b.tv_sec) return -1;
- if (a.tv_sec > b.tv_sec) return 1;
- if (a.tv_usec < b.tv_usec) return -1;
- if (a.tv_usec > b.tv_usec) return 1;
- return 0;
-}
-
-
-/* FIXME: disabled -- clarification wrt. filetype plugin needed */
-
-#if 0
-
-static int query_phase2(
- glite_jp_context_t ctx,
- const char *ownerhash,
- long regtime_tr,
- int q_tags,
- int md_tags,
- const glite_jp_query_rec_t query[],
- glite_jp_attrval_t metadata[],
- int (*callback)(
- glite_jp_context_t ctx,
- const char *job,
- const glite_jp_attrval_t metadata[]
- )
-);
-
-static int query_phase2(
- glite_jp_context_t ctx,
- const char *ownerhash,
- long regtime_tr,
- int q_tags,
- int md_tags,
- const glite_jp_query_rec_t query[],
- glite_jp_attrval_t metadata[],
- int (*callback)(
- glite_jp_context_t ctx,
- const char *job,
- const glite_jp_attrval_t metadata[]
- )
-)
-{
- char *time_dirname = NULL;
- DIR *time_dirp = NULL;
- struct dirent *jobent;
- char *info_fname = NULL;
- char *jobid = NULL;
- char *owner = NULL;
- struct timeval tv_reg;
- void *tags_handle = NULL;
- int matching;
- int i, j;
- glite_jp_tagval_t* tags = NULL;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (asprintf(&time_dirname, "%s/data/%s/%d", config->internal_path,
- ownerhash, regtime_tr) == -1) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- time_dirp = opendir(time_dirname);
- if (!time_dirp) {
- free(time_dirname);
- return 0; /* found nothing */
- }
- while ((jobent = readdir(time_dirp)) != NULL) {
- if (!strcmp(jobent->d_name, ".")) continue;
- if (!strcmp(jobent->d_name, "..")) continue;
- if (asprintf(&info_fname, "%s/%s/_info", time_dirname,
- jobent->d_name) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- if (get_job_info_int(ctx, info_fname, &jobid, &owner, &tv_reg)) {
- err.code = EIO;
- err.desc = "Cannot retrieve job info";
- goto error_out;
- }
- if (q_tags || md_tags) {
- if (glite_jppsbe_open_file(ctx, jobid, GLITE_JP_FILECLASS_TAGS,
- O_RDONLY, &tags_handle)) {
- err.code = ctx->error->code;
- err.desc = "Cannot open tag file";
- goto error_out;
- }
- if (glite_jpps_tag_readall(ctx, tags_handle, &tags)) {
- err.code = ctx->error->code;
- err.desc = "Cannot read tags";
- glite_jppsbe_close_file(ctx, tags_handle);
- goto error_out;
- }
- glite_jppsbe_close_file(ctx, tags_handle);
- tags_handle = NULL;
- }
-
- matching = 1;
- for (i = 0; matching && query[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
- switch (query[i].attr.type) {
- case GLITE_JP_ATTR_OWNER:
- if (query[i].value.s == NULL ||
- strcmp(query[i].value.s, owner)) matching = 0;
- break;
- case GLITE_JP_ATTR_TIME:
- switch (query[i].op) {
- case GLITE_JP_QUERYOP_EQUAL:
- matching = !compare_timeval(tv_reg, query[i].value.time);
- break;
- case GLITE_JP_QUERYOP_UNEQUAL:
- matching = compare_timeval(tv_reg, query[i].value.time);
- break;
- case GLITE_JP_QUERYOP_LESS:
- matching = compare_timeval(tv_reg, query[i].value.time) < 0;
- break;
- case GLITE_JP_QUERYOP_GREATER:
- matching = compare_timeval(tv_reg, query[i].value.time) > 0;
- break;
- case GLITE_JP_QUERYOP_WITHIN:
- matching = compare_timeval(tv_reg, query[i].value.time) >= 0
- && compare_timeval(tv_reg, query[i].value2.time) <= 0;
- break;
- }
- break;
- case GLITE_JP_ATTR_TAG:
- if (!tags) {
- matching = 0;
- break;
- }
- for (j = 0; tags[j].name != NULL; j++) {
- if (!strcmp(tags[j].name, query[i].attr.name)) {
- switch (query[i].op) {
- case GLITE_JP_QUERYOP_EQUAL:
- matching = !strcmp(tags[j].value, query[i].value.s);
- break;
- case GLITE_JP_QUERYOP_UNEQUAL:
- matching = strcmp(tags[j].value, query[i].value.s);
- break;
- case GLITE_JP_QUERYOP_LESS:
- matching = strcmp(tags[j].value, query[i].value.s) < 0;
- break;
- case GLITE_JP_QUERYOP_GREATER:
- matching = strcmp(tags[j].value, query[i].value.s) > 0;
- break;
- case GLITE_JP_QUERYOP_WITHIN:
- matching = strcmp(tags[j].value, query[i].value.s) >= 0 \
- && strcmp(tags[j].value, query[i].value2.s) <= 0 ;
- break;
- default:
- break;
- }
- }
- }
- break;
- default:
- break;
- }
- }
- if (!matching) {
- free(info_fname); info_fname = NULL;
- free(jobid); jobid = NULL;
- if (tags) for (j = 0; tags[j].name != NULL; j++) {
- free(tags[j].name);
- free(tags[j].value);
- }
- free(tags); tags = NULL;
- continue;
- }
-
- for (i = 0; metadata[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
- switch (metadata[i].attr.type) {
- case GLITE_JP_ATTR_OWNER:
- metadata[i].value.s = owner;
- break;
- case GLITE_JP_ATTR_TIME:
- metadata[i].value.time = tv_reg;
- break;
- case GLITE_JP_ATTR_TAG:
- for (j = 0; tags[j].name != NULL; j++) {
- if (!strcmp(tags[j].name, metadata[i].attr.name)) {
- if (glite_jpps_tagval_copy(ctx, &tags[j],
- &metadata[i].value.tag)) {
- err.code = ENOMEM;
- err.desc = "Cannot copy tag value";
- goto error_out;
- }
- break;
- }
- }
- if (!tags[j].name) {
- metadata[i].value.tag.name = NULL;
- metadata[i].value.tag.value = NULL;
- }
- break;
- default:
- break;
- }
- }
- (*callback)(ctx, jobid, metadata);
- free(jobid); jobid = NULL;
- while (i > 0) {
- i--;
- switch (metadata[i].attr.type) {
- case GLITE_JP_ATTR_TAG:
- free(metadata[i].value.tag.name);
- free(metadata[i].value.tag.value);
- default:
- break;
- }
- }
- }
-
-error_out:
- if (tags) for (j = 0; tags[j].name != NULL; j++) {
- free(tags[j].name);
- free(tags[j].value);
- }
- if (tags_handle) glite_jppsbe_close_file(ctx, tags_handle);
- free(info_fname);
- free(owner);
- free(jobid);
- closedir(time_dirp);
- free(time_dirname);
- if (err.code) {
- while (i > 0) {
- i--;
- switch (metadata[i].attr.type) {
- case GLITE_JP_ATTR_TAG:
- free(metadata[i].value.tag.name);
- free(metadata[i].value.tag.value);
- default:
- break;
- }
- }
- return glite_jp_stack_error(ctx,&err);
- } else
- return 0;
-}
-
-int glite_jppsbe_query(
- glite_jp_context_t ctx,
- const glite_jp_query_rec_t query[],
- const glite_jp_attrval_t metadata[],
- void *arg,
- int (*callback)(
- glite_jp_context_t ctx,
- const char *job,
- const glite_jp_attrval_t metadata[],
- void *arg
- )
-)
-{
- /* XXX clone metadata */
- int i;
- char *q_exact_owner = NULL;
- char *ownerhash = NULL;
- long q_min_time = 0;
- long q_max_time = LONG_MAX;
- long q_min_time_tr;
- long q_max_time_tr;
- int q_with_tags = 0;
- int md_info = 0;
- int md_tags = 0;
- char *owner_dirname = NULL;
- DIR *owner_dirp = NULL;
- struct dirent *ttimeent;
- char *data_dirname = NULL;
- DIR *data_dirp = NULL;
- struct dirent *ownerent;
- long ttime = 0;
- glite_jp_attrval_t *metadata_templ = NULL;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- for (i = 0; query[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
- if (query[i].attr.type == GLITE_JP_ATTR_OWNER && query[i].op == GLITE_JP_QUERYOP_EQUAL) {
- q_exact_owner = query[i].value.s;
- }
- if (query[i].attr.type == GLITE_JP_ATTR_TIME) {
- switch (query[i].op) {
- case GLITE_JP_QUERYOP_EQUAL:
- q_min_time = query[i].value.time.tv_sec;
- q_max_time = query[i].value.time.tv_sec + 1;
- break;
- case GLITE_JP_QUERYOP_LESS:
- if (q_max_time > query[i].value.time.tv_sec + 1)
- q_max_time = query[i].value.time.tv_sec + 1;
- break;
- case GLITE_JP_QUERYOP_WITHIN:
- if (q_max_time > query[i].value2.time.tv_sec + 1)
- q_max_time = query[i].value2.time.tv_sec + 1;
- /* fallthrough */
- case GLITE_JP_QUERYOP_GREATER:
- if (q_min_time < query[i].value.time.tv_sec)
- q_min_time = query[i].value.time.tv_sec;
- break;
- default:
- err.code = EINVAL;
- err.desc = "Invalid query op";
- return glite_jp_stack_error(ctx,&err);
- break;
- }
- }
- if (query[i].attr.type == GLITE_JP_ATTR_TAG)
- q_with_tags = 1;
-
- }
-
- for (i = 0; metadata[i].attr.type != GLITE_JP_ATTR_UNDEF; i++) {
- switch (metadata[i].attr.type) {
- case GLITE_JP_ATTR_OWNER:
- case GLITE_JP_ATTR_TIME:
- md_info = 1;
- break;
- case GLITE_JP_ATTR_TAG:
- md_tags = 1;
- break;
- default:
- err.code = EINVAL;
- err.desc = "Invalid attribute type in metadata parameter";
- return glite_jp_stack_error(ctx,&err);
- break;
- }
- }
- metadata_templ = (glite_jp_attrval_t *) calloc(i + 1, sizeof(glite_jp_attrval_t));
- if (!metadata_templ) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- memcpy(metadata_templ, metadata, (i + 1) * sizeof(glite_jp_attrval_t));
-
- q_min_time_tr = regtime_trunc(q_min_time);
- q_max_time_tr = regtime_ceil(q_max_time);
-
- if (q_exact_owner) {
- ownerhash = str2md5(q_exact_owner); /* static buffer */
- if (asprintf(&owner_dirname, "%s/data/%s", config->internal_path, ownerhash) == -1) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- owner_dirp = opendir(owner_dirname);
- free(owner_dirname);
- if (!owner_dirp) {
- free(metadata_templ);
- return 0; /* found nothing */
- }
- while ((ttimeent = readdir(owner_dirp)) != NULL) {
- if (!strcmp(ttimeent->d_name, ".")) continue;
- if (!strcmp(ttimeent->d_name, "..")) continue;
- ttime = atol(ttimeent->d_name);
- if (ttime >= q_min_time_tr && ttime < q_max_time_tr) {
- if (query_phase2(ctx, ownerhash, ttime, q_with_tags, md_tags,
- query, metadata_templ, callback)) {
- err.code = EIO;
- err.desc = "query_phase2() error";
- goto error_out;
- }
- }
- }
- } else { /* !q_exact_owner */
- if (asprintf(&data_dirname, "%s/data", config->internal_path) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- data_dirp = opendir(data_dirname);
- if (!data_dirp) {
- err.code = EIO;
- err.desc = "Cannot open data directory";
- goto error_out;
- }
- while ((ownerent = readdir(data_dirp)) != NULL) {
- if (!strcmp(ownerent->d_name, ".")) continue;
- if (!strcmp(ownerent->d_name, "..")) continue;
- if (asprintf(&owner_dirname, "%s/data/%s", config->internal_path,
- ownerent->d_name) == -1) {
- err.code = ENOMEM;
- goto error_out;
- }
- owner_dirp = opendir(owner_dirname);
- free(owner_dirname);
- if (!owner_dirp) {
- err.code = EIO;
- err.desc = "Cannot open owner data directory";
- goto error_out;
- }
- while ((ttimeent = readdir(owner_dirp)) != NULL) {
- if (!strcmp(ttimeent->d_name, ".")) continue;
- if (!strcmp(ttimeent->d_name, "..")) continue;
- ttime = atol(ttimeent->d_name);
- if (ttime >= q_min_time_tr && ttime < q_max_time_tr) {
- if (query_phase2(ctx, ownerent->d_name, ttime, q_with_tags, md_tags,
- query, metadata_templ, callback)) {
- err.code = EIO;
- err.desc = "query_phase2() error";
- goto error_out;
- }
- }
- }
- closedir(owner_dirp); owner_dirp = NULL;
- }
- closedir(data_dirp); data_dirp = NULL;
- }
- return 0;
-
-error_out:
- if (owner_dirp) closedir(owner_dirp);
- if (data_dirp) closedir(data_dirp);
- free(data_dirname);
- free(metadata_templ);
- return glite_jp_stack_error(ctx,&err);
-}
-
-#else
-
-int glite_jppsbe_query(
- glite_jp_context_t ctx,
- const glite_jp_query_rec_t query[],
- char * attrs[],
- void *arg,
- int (*callback)(
- glite_jp_context_t ctx,
- const char *job,
- const glite_jp_attrval_t metadata[],
- void *arg
- )
-)
-{
- glite_jp_error_t err;
- int i,ret;
- int quser = 0, muser = -1, mtime = -1;
- char *where = NULL,*stmt = NULL,*aux = NULL, *cols = NULL;
- char *qres[3] = { NULL, NULL, NULL };
- int cmask = 0, owner_idx = -1, reg_idx = -1;
- glite_jp_db_stmt_t q;
- glite_jp_attrval_t metadata[2];
-
- memset(&err,0,sizeof err);
- glite_jp_clear_error(ctx);
- err.source = __FUNCTION__;
-
- /* XXX: assuming not more than 2 */
- memset(metadata,0,sizeof metadata);
-
- /* XXX: const discarding is OK */
- for (i=0;attrs[i]; i++) metadata[i].name = (char *) attrs[i];
-
- for (i=0; query[i].attr; i++) {
- char *qitem;
-
- /* XXX: don't assert() */
- assert(!query[i].binary);
-
- if (!strcmp(query[i].attr,GLITE_JP_ATTR_OWNER)) {
- switch (query[i].op) {
- case GLITE_JP_QUERYOP_EQUAL:
- quser = 1;
- trio_asprintf(&qitem,"u.cert_subj = '%|Ss'",query[i].value);
- break;
- default:
- err.code = EINVAL;
- err.desc = "only = allowed for owner queries";
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
- }
- else if (!strcmp(query[i].attr,GLITE_JP_ATTR_REGTIME)) {
- time_t t = glite_jp_attr2time(query[i].value);
- char *t1 = glite_jp_db_timetodb(t),*t2 = NULL;
-
- switch (query[i].op) {
- case GLITE_JP_QUERYOP_EQUAL:
- trio_asprintf(&qitem,"j.reg_time = %s",t1);
- break;
- case GLITE_JP_QUERYOP_UNEQUAL:
- trio_asprintf(&qitem,"j.reg_time != %s",t1);
- break;
- case GLITE_JP_QUERYOP_LESS:
- trio_asprintf(&qitem,"j.reg_time < %s",t1);
- break;
- case GLITE_JP_QUERYOP_GREATER:
- trio_asprintf(&qitem,"j.reg_time > %s",t1);
- break;
- case GLITE_JP_QUERYOP_WITHIN:
- free(t2);
- trio_asprintf(&qitem,"j.reg_time >= %s and j.reg_time <= %s",
- t1,t2 = glite_jp_db_timetodb(glite_jp_attr2time(query[i].value2)+1));
- break;
- default:
- err.code = EINVAL;
- err.desc = "invalid query op";
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
- free(t1);
- free(t2);
- }
- trio_asprintf(&aux,"%s%s%s",where ? where : "",where ? " and " : "", qitem);
- free(where);
- free(qitem);
- where = aux;
- aux = NULL;
- }
-
- for (i=0; metadata[i].name; i++) {
- assert (i<2); /* XXX: should never happen */
-
- if (!strcmp(metadata[i].name,GLITE_JP_ATTR_OWNER)) {
- quser = 1;
- cmask |= 1;
- owner_idx = i;
- }
- else if (!strcmp(metadata[i].name,GLITE_JP_ATTR_REGTIME)) {
- cmask |= 2;
- reg_idx = i;
- }
- else {
- err.code = EINVAL;
- err.desc = "invalid query column";
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
- }
- switch (cmask) {
- case 1: cols = "j.dg_jobid,u.cert_subj"; break;
- case 2: cols = "j.dg_jobid,j.reg_time"; break;
- case 3: cols = "j.dg_jobid,u.cert_subj,j.reg_time"; break;
- }
-
- trio_asprintf(&stmt,"select %s from jobs j%s where %s %s",
- cols,
- quser ? ",users u" : "",
- where,
- cmask & 1 ? "and u.userid = j.owner" : "");
-
- if (glite_jp_db_execstmt(ctx,stmt,&q) <= 0) {
- err.code = EIO;
- err.desc = "DB call fail";
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
-
- while ((ret = glite_jp_db_fetchrow(q,qres)) > 0) {
- if (cmask & 1) {
- /* XXX: owner always first */
- metadata[owner_idx].value = qres[1];
- metadata[owner_idx].origin = GLITE_JP_ATTR_ORIG_SYSTEM;
- qres[1] = NULL;
- }
- if (cmask & 2) {
- int qi = cmask == 2 ? 1 : 2;
- time_t t = glite_jp_db_dbtotime(qres[qi]);
- metadata[reg_idx].value = glite_jp_time2attr(t);
- metadata[reg_idx].origin = GLITE_JP_ATTR_ORIG_SYSTEM;
- free(qres[qi]);
- qres[qi] = NULL;
- }
- if (callback(ctx,qres[0],metadata,arg)) {
- err.code = EIO;
- err.desc = qres[0];
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
-
- free(qres[0]);
- free(metadata[0].value);
- free(metadata[1].value);
- qres[0] = metadata[0].value = metadata[1].value = NULL;
- }
-
-
- if (ret < 0) {
- err.code = EIO;
- err.desc = "DB call fail";
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
-
-cleanup:
- free(where);
- free(aux);
- free(stmt);
- free(qres[0]); free(qres[1]); free(qres[2]);
- free(metadata[0].value); free(metadata[1].value);
- if (q) glite_jp_db_freestmt(&q);
-
- return err.code;
-}
-
-#endif
-
-
-int glite_jppsbe_is_metadata(glite_jp_context_t ctx,const char *attr)
-{
- /* XXX: should be more */
- if (!strcmp(attr,GLITE_JP_ATTR_OWNER)) return 1;
- if (!strcmp(attr,GLITE_JP_ATTR_REGTIME)) return 1;
-
- return 0;
-}
-
-
-int glite_jppsbe_get_names(
- glite_jp_context_t ctx,
- const char *job,
- const char *class,
- char ***names_out
-)
-{
- char *qry = NULL,*file = NULL,*dot;
- char **out = NULL;
- glite_jp_db_stmt_t s = NULL;
- int rows,nout = 0;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- trio_asprintf(&qry,"select filename from files f,jobs j "
- "where j.dg_jobid = '%|Ss' and j.jobid = f.jobid and f.state = 'committed'",job);
-
- if ((rows = glite_jp_db_execstmt(ctx,qry,&s)) <= 0) {
- if (rows == 0) {
- err.code = ENOENT;
- err.desc = "No files for this job";
- }
- else {
- err.code = EIO;
- err.desc = "DB call fail retrieving job files";
- }
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
-
- while ((rows = glite_jp_db_fetchrow(s,&file))) {
- int l;
-
- if (rows < 0) {
- err.code = EIO;
- err.desc = "DB call fail retrieving job files";
- goto cleanup;
- }
-
- dot = strchr(file,'.'); /* XXX: can class contain dot? */
-
- if (dot) *dot = 0;
- out = realloc(out,(nout+1) * sizeof *out);
- if (!strcmp(file,class)) out[nout++] = dot ? dot+1 : NULL;
-
- free(file);
- file = NULL;
- }
-
-cleanup:
- if (s) glite_jp_db_freestmt(&s);
- free(qry);
- free(file);
-
- if (ctx->error) {
- int i;
- for (i=0; out && out[i]; i++) free(out[i]);
- free(out);
- return -ctx->error->code;
- }
-
- if (nout) *names_out = out;
- return nout;
-}
-
-
-/** mark the job as sent to this feed */
-int glite_jppsbe_set_fed(
- glite_jp_context_t ctx,
- const char *feed,
- const char *job
-)
-{
- char *stmt = NULL;
- int rows;
- glite_jp_error_t err;
- memset(&err,0,sizeof err);
-
- trio_asprintf(&stmt,"insert into fed_job(feedid,jobid) "
- "values ('%|Ss','%|Ss')", feed,job);
-
- if ((rows = glite_jp_db_execstmt(ctx,stmt,NULL)) < 0) {
- err.source = __FUNCTION__;
- err.code = EIO;
- err.desc = "insert into fed_jobs";
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
-
- if (rows != 1) {
- err.source = __FUNCTION__;
- err.code = EIO;
- err.desc = "inserted rows != 1";
- glite_jp_stack_error(ctx,&err);
- }
-
-cleanup:
- free(stmt);
- return err.code;
-}
-
-
-/** check whether the job has been already sent to this feed */
-int glite_jppsbe_check_fed(
- glite_jp_context_t ctx,
- const char *feed,
- const char *job,
- int *result
-)
-{
- char *stmt = NULL;
- int rows;
- glite_jp_error_t err;
- memset(&err,0,sizeof err);
- trio_asprintf(&stmt,"select 'x' from fed_jobs "
- "where jobid = '%|Ss' and feedid = '%|Ss'",
- job,feed);
-
- if ((rows = glite_jp_db_execstmt(ctx,stmt,NULL)) < 0) {
- err.source = __FUNCTION__;
- err.code = EIO;
- err.desc = "select from fed_jobs";
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
-
- *result = rows;
-
-cleanup:
- free(stmt);
- return err.code;
-}
-
-
-/** store the feed to database */
-int glite_jppsbe_store_feed(
- glite_jp_context_t ctx,
- struct jpfeed *feed
-)
-{
- char *stmt,*aux,*alist,*qlist,*e;
- int i,rows;
- glite_jp_error_t err;
-
- memset(&err,0,sizeof err);
-
- qlist = alist = stmt = aux = e = NULL;
-
- for (i=0; feed->attrs[i]; i++) {
- char *e;
- trio_asprintf(&aux,"%s%s%s",
- alist ? alist : "",
- alist ? "\n" : "",
- e = edg_wll_LogEscape(feed->attrs[i]));
- free(e);
- free(alist);
- alist = aux;
- aux = NULL;
- }
-
- for (i=0; feed->qry[i].attr; i++) {
- char op,*e1,*e2 = NULL;
-
- /* XXX */
- assert(!feed->qry[i].binary);
-
- switch (feed->qry[i].op) {
- case GLITE_JP_QUERYOP_EQUAL: op = '='; break;
- case GLITE_JP_QUERYOP_UNEQUAL: op = '!'; break;
- case GLITE_JP_QUERYOP_LESS: op = '<'; break;
- case GLITE_JP_QUERYOP_GREATER: op = '>'; break;
- case GLITE_JP_QUERYOP_EXISTS: op = 'E'; break;
- default: abort(); /* XXX */
- }
-
- trio_asprintf(&aux,"%s%s%s\n%c\n%s",
- qlist ? qlist : "",
- qlist ? "\n" : "",
- e1 = edg_wll_LogEscape(feed->qry[i].attr),
- op,
- op != 'E' ? e2 = edg_wll_LogEscape(feed->qry[i].value) : "E");
- free(e1); free(e2);
-
- free(qlist);
- qlist = aux;
- aux = NULL;
- }
-
- trio_asprintf(&stmt,"insert into feeds(feedid,destination,expires,cols,query) "
- "values ('%|Ss','%|Ss',%s,'%|Ss','%|Ss')",
- feed->id,feed->destination,
- e = glite_jp_db_timetodb(feed->expires),
- alist,qlist);
-
- free(alist); free(qlist); free(e);
-
- if ((rows = glite_jp_db_execstmt(ctx,stmt,NULL)) < 0) {
- err.source = __FUNCTION__;
- err.code = EIO;
- err.desc = "insert into fed_jobs";
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
-
- if (rows != 1) {
- err.source = __FUNCTION__;
- err.code = EIO;
- err.desc = "inserted rows != 1";
- glite_jp_stack_error(ctx,&err);
- }
-
-cleanup:
- free(stmt);
- return err.code;
-
-}
-
-
-/** purge expired feeds */
-int glite_jppsbe_purge_feeds(
- glite_jp_context_t ctx
-)
-{
- /* TODO */
- abort();
-}
-
-
-/** read stored feed into context */
-int glite_jppsbe_read_feeds(
- glite_jp_context_t ctx
-)
-{
- char *stmt,*res[5],*expires;
- glite_jp_error_t err;
- glite_jp_db_stmt_t q = NULL;
- int rows;
-
- stmt = expires = NULL;
- memset(&err,0,sizeof err);
- memset(&res,0,sizeof res);
- err.source = __FUNCTION__;
-
- expires = glite_jp_db_timetodb(time(NULL));
- trio_asprintf(&stmt,"select feedid,destination,expires,cols,query "
- "from feeds "
- "where expires > %s",expires);
- free(expires); expires = NULL;
-
- if ((rows = glite_jp_db_execstmt(ctx, stmt, &q)) < 0) {
- err.code = EIO;
- err.desc = "select from feeds";
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
-
- while ((rows = glite_jp_db_fetchrow(q,res)) > 0) {
- struct jpfeed *f = calloc(1,sizeof *f);
- int n;
- char *p;
-
- f->id = res[0]; res[0] = NULL;
- f->destination = res[1]; res[1] = NULL;
- f->expires = glite_jp_db_dbtotime(res[2]); free(res[2]); res[2] = NULL;
-
- n = 0;
- for (p = strtok(res[3],"\n"); p; p = strtok(NULL,"\n")) {
- f->attrs = realloc(f->attrs,(n+2) * sizeof *f->attrs);
- f->attrs[n] = edg_wll_LogUnescape(p);
- f->attrs[++n] = NULL;
- }
-
- n = 0;
- for (p = strtok(res[4],"\n"); p; p = strtok(NULL,"\n")) {
- f->qry = realloc(f->qry,(n+2) * sizeof *f->qry);
- memset(&f->qry[n],0,sizeof *f->qry);
- f->qry[n].attr = edg_wll_LogUnescape(p);
- p = strtok(NULL,"\n");
- switch (*p) {
- case '=': f->qry[n].op = GLITE_JP_QUERYOP_EQUAL; break;
- case '<': f->qry[n].op = GLITE_JP_QUERYOP_LESS; break;
- case '>': f->qry[n].op = GLITE_JP_QUERYOP_GREATER; break;
- case '!': f->qry[n].op = GLITE_JP_QUERYOP_UNEQUAL; break;
- case 'E': f->qry[n].op = GLITE_JP_QUERYOP_EXISTS; break;
- default: abort(); /* XXX: internal inconsistency */
- }
- p = strtok(NULL,"\n");
- if (f->qry[n].op != GLITE_JP_QUERYOP_EXISTS)
- f->qry[n].value = edg_wll_LogUnescape(p);
-
- memset(&f->qry[++n],0,sizeof *f->qry);
- }
- f->next = ctx->feeds;
- ctx->feeds = f;
- }
-
- if (rows < 0) {
- err.code = EIO;
- err.desc = "fetch from feeds";
- glite_jp_stack_error(ctx,&err);
- goto cleanup;
- }
-
-cleanup:
- glite_jp_db_freestmt(&q);
- free(res[0]); free(res[1]); free(res[2]); free(res[3]); free(res[4]);
- return err.code;
-}
-
-
-
-
-/* XXX:
-- no primary authorization yet
-- no concurrency control yet
-- partial success in pwrite,append
-- "unique" part of jobid is assumed to be unique across bookkeeping servers
-- repository versioning not fully implemented yet
-*/
+++ /dev/null
-#include <stdio.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "jpps_H.h"
-
-extern SOAP_NMAC struct Namespace jpis__namespaces[],jpps__namespaces[];
-
-int main(int argc, char *argv[]) {
- struct soap soap;
- int i, m, s; // master and slave sockets
-
- glite_jp_context_t ctx;
-
- soap_init(&soap);
- soap_set_namespaces(&soap, jpps__namespaces);
-
- glite_jp_init_context(&ctx);
-
- if (glite_jppsbe_init(ctx, &argc, argv)) {
- /* XXX log */
- fputs(glite_jp_error_chain(ctx), stderr);
- exit(1);
- }
-
- soap.user = (void *) ctx;
-
- ctx->other_soap = soap_new();
- soap_init(ctx->other_soap);
- soap_set_namespaces(ctx->other_soap,jpis__namespaces);
-
- srand48(time(NULL)); /* feed id generation */
-
- m = soap_bind(&soap, NULL, 8901, 100);
- if (m < 0)
- soap_print_fault(&soap, stderr);
- else
- {
- fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
- for (i = 1; ; i++) {
- s = soap_accept(&soap);
- if (s < 0) {
- soap_print_fault(&soap, stderr);
- break;
- }
- jpps__serve(&soap); // process RPC request
- soap_destroy(&soap); // clean up class instances
- soap_end(&soap); // clean up everything and close socket
- glite_jp_run_deferred(ctx);
- }
- }
- soap_done(&soap); // close master socket
-
- return 0;
-}
-
-/* XXX: we don't use it */
-SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} };
+++ /dev/null
-#include <stdio.h>
-#include <fcntl.h>
-#include <assert.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-#include "glite/jp/attr.h"
-#include "glite/jp/known_attr.h"
-
-#include "feed.h"
-#include "attrs.h"
-
-#include "jptype_map.h"
-
-#include "file_plugin.h"
-#include "builtin_plugins.h"
-
-#include "jpps_ServerLib.c"
-#include "jpps_.nsmap"
-
-#include "soap_util.c"
-
-static struct jptype__genericFault *jp2s_error(struct soap *soap,
- const glite_jp_error_t *err)
-{
- struct jptype__genericFault *ret = NULL;
- if (err) {
- ret = soap_malloc(soap,sizeof *ret);
- memset(ret,0,sizeof *ret);
- ret->code = err->code;
- ret->source = soap_strdup(soap,err->source);
- ret->text = soap_strdup(soap,strerror(err->code));
- ret->description = soap_strdup(soap,err->desc);
- ret->reason = jp2s_error(soap,err->reason);
- }
- return ret;
-}
-
-static void err2fault(const glite_jp_context_t ctx,struct soap *soap)
-{
- char *et;
- struct SOAP_ENV__Detail *detail = soap_malloc(soap,sizeof *detail);
- struct _genericFault *f = soap_malloc(soap,sizeof *f);
-
-
- f->jpelem__genericFault = jp2s_error(soap,ctx->error);
-
- detail->__type = SOAP_TYPE__genericFault;
-#if GSOAP_VERSION >= 20700
- detail->fault = f;
-#else
- detail->value = f;
-#endif
- detail->__any = NULL;
-
- soap_receiver_fault(soap,"Oh, shit!",NULL);
- if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail;
- else soap->fault->detail = detail;
-}
-
-#define CONTEXT_FROM_SOAP(soap,ctx) glite_jp_context_t ctx = (glite_jp_context_t) ((soap)->user)
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RegisterJob(
- struct soap *soap,
- struct _jpelem__RegisterJob *in,
- struct _jpelem__RegisterJobResponse *empty)
-{
- CONTEXT_FROM_SOAP(soap,ctx);
- glite_jp_attrval_t owner_val[2];
-
- printf("%s %s %s\n",__FUNCTION__,in->job,in->owner);
- if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__RegisterJob,in->job,in->owner) ||
- glite_jppsbe_register_job(ctx,in->job,in->owner))
- {
- err2fault(ctx,soap);
- return SOAP_FAULT;
- }
-
- owner_val[0].name = GLITE_JP_ATTR_OWNER;
- owner_val[0].value = in->owner;
- owner_val[0].origin = GLITE_JP_ATTR_ORIG_SYSTEM;
- owner_val[0].timestamp = time(NULL);
- owner_val[0].origin_detail = NULL;
- owner_val[1].name = NULL;
-
-/* XXX: errrors should be ingored but not silently */
- glite_jpps_match_attr(ctx,in->job,owner_val);
-
- return SOAP_OK;
-}
-
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__StartUpload(
- struct soap *soap,
- struct _jpelem__StartUpload *in,
- struct _jpelem__StartUploadResponse *out)
-{
- CONTEXT_FROM_SOAP(soap,ctx);
- char *destination;
- time_t commit_before = in->commitBefore;
- glite_jp_error_t err;
- glite_jpps_fplug_data_t **pd = NULL;
- int i;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
-
- if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__StartUpload,NULL,NULL)) {
- err2fault(ctx,soap);
- return SOAP_FAULT;
- }
-
- switch (glite_jpps_fplug_lookup(ctx,in->class_,&pd)) {
- case ENOENT:
- err.code = ENOENT;
- err.source = __FUNCTION__;
- err.desc = "unknown file class";
- glite_jp_stack_error(ctx,&err);
- err2fault(ctx,soap);
- return SOAP_FAULT;
- case 0: break;
- default:
- err2fault(ctx,soap);
- return SOAP_FAULT;
- }
-
- for (i=0; pd[0]->uris[i] && strcmp(pd[0]->uris[i],in->class_); i++);
- assert(pd[0]->uris[i]);
-
- if (glite_jppsbe_start_upload(ctx,in->job,pd[0]->classes[i],in->name,in->contentType,
- &destination,&commit_before))
- {
- err2fault(ctx,soap);
- free(pd);
- return SOAP_FAULT;
- }
-
- out->destination = soap_strdup(soap,destination);
- free(destination);
- out->commitBefore = commit_before;
-
- free(pd);
- return SOAP_OK;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__CommitUpload(
- struct soap *soap,
- struct _jpelem__CommitUpload *in,
- struct _jpelem__CommitUploadResponse *out)
-{
- CONTEXT_FROM_SOAP(soap,ctx);
- char *job,*class,*name;
-
- job = class = name = NULL;
-
- if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__CommitUpload,NULL,NULL) ||
- glite_jppsbe_commit_upload(ctx,in->destination))
- {
- err2fault(ctx,soap);
- return SOAP_FAULT;
- }
-
- /* XXX: should not fail when commit_upload was OK */
- assert(glite_jppsbe_destination_info(ctx,in->destination,&job,&class,&name) == 0);
-
- /* XXX: ignore errors but don't fail silenty */
- glite_jpps_match_file(ctx,job,class,name);
-
- free(job); free(class); free(name);
-
- return SOAP_OK;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RecordTag(
- struct soap *soap,
- struct _jpelem__RecordTag *in,
- struct _jpelem__RecordTagResponse *out)
-{
- CONTEXT_FROM_SOAP(soap,ctx);
- void *file_be,*file_p;
- glite_jpps_fplug_data_t **pd = NULL;
- glite_jp_attrval_t attr[2];
-
- file_be = file_p = NULL;
-
- attr[0].name = in->tag->name;
- if (in->tag->value->string) {
- attr[0].value = in->tag->value->string;
- attr[0].binary = 0;
- }
- else {
- attr[0].value = in->tag->value->blob->__ptr;
- attr[0].size = in->tag->value->blob->__size;
- attr[0].binary = 1;
- }
- attr[0].origin = GLITE_JP_ATTR_ORIG_USER;
- attr[0].timestamp = time(NULL);
- attr[0].origin_detail = NULL; /* XXX */
- attr[1].name = NULL;
-
- /* XXX: we assume just one plugin and also that TAGS plugin handles
- * just one uri/class */
-
- if (glite_jpps_fplug_lookup(ctx,GLITE_JP_FILETYPE_TAGS,&pd)
- || glite_jppsbe_open_file(ctx,in->jobid,pd[0]->classes[0],NULL,
- O_RDWR|O_CREAT,&file_be)
- /* XXX: tags need reading to check magic number */
- ) {
- free(pd);
- err2fault(ctx,soap);
- return SOAP_FAULT;
- }
-
- /* XXX: assuming tag plugin handles just one type */
- if (pd[0]->ops.open(pd[0]->fpctx,file_be,GLITE_JP_FILETYPE_TAGS,&file_p)
- || pd[0]->ops.generic(pd[0]->fpctx,file_p,GLITE_JP_FPLUG_TAGS_APPEND,attr))
- {
- err2fault(ctx,soap);
- if (file_p) pd[0]->ops.close(pd[0]->fpctx,file_p);
- glite_jppsbe_close_file(ctx,file_be);
- free(pd);
- return SOAP_FAULT;
- }
-
- if (pd[0]->ops.close(pd[0]->fpctx,file_p)
- || glite_jppsbe_close_file(ctx,file_be))
- {
- err2fault(ctx,soap);
- free(pd);
- return SOAP_FAULT;
- }
-
- /* XXX: ignore errors but don't fail silenty */
- glite_jpps_match_attr(ctx,in->jobid,attr);
-
- free(pd);
- return SOAP_OK;
-}
-
-static void s2jp_qval(const struct jptype__stringOrBlob *in, char **value, int *binary, size_t *size)
-{
- if (in->string) {
- *value = in->string;
- *binary = 0;
- *size = 0;
- }
- else {
- assert(in->blob); /* XXX: should report error instead */
- *value = in->blob->__ptr;
- *binary = 1;
- *size = in->blob->__size;
- }
-}
-
-static void s2jp_query(const struct jptype__primaryQuery *in, glite_jp_query_rec_t *out)
-{
- int b;
-
- out->attr = in->attr;
-
- s2jp_qval(in->value,&out->value,&out->binary,&out->size);
- switch (in->op) {
- case EQUAL: out->op = GLITE_JP_QUERYOP_EQUAL; break;
- case UNEQUAL: out->op = GLITE_JP_QUERYOP_UNEQUAL; break;
- case LESS: out->op = GLITE_JP_QUERYOP_LESS; break;
- case GREATER: out->op = GLITE_JP_QUERYOP_GREATER; break;
- case WITHIN:
- out->op = GLITE_JP_QUERYOP_WITHIN;
- s2jp_qval(in->value2,&out->value2,&b,&out->size2);
- assert(out->binary == b); /* XXX: report error instead */
-
- break;
- }
-
- if (in->origin) switch (*in->origin) {
- case jptype__attrOrig__SYSTEM: out->origin = GLITE_JP_ATTR_ORIG_SYSTEM; break;
- case jptype__attrOrig__USER: out->origin = GLITE_JP_ATTR_ORIG_USER; break;
- case jptype__attrOrig__FILE_: out->origin = GLITE_JP_ATTR_ORIG_FILE; break;
- }
- else out->origin = GLITE_JP_ATTR_ORIG_ANY;
-}
-
-
-static int check_sane_feed(glite_jp_context_t ctx,struct _jpelem__FeedIndex *in)
-{
- glite_jp_error_t err;
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
- err.code = EINVAL;
-
- if (!in->destination) {
- err.desc = "destination required";
- return glite_jp_stack_error(ctx,&err);
- }
-
- return 0;
-}
-
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__FeedIndex(
- struct soap *soap,
- struct _jpelem__FeedIndex *in,
- struct _jpelem__FeedIndexResponse *out)
-{
-
-/* deferred processing: return feed_id to the index server first,
- * start feeding it afterwards -- not before the index server actually
- * knows feed_id and is ready to accept the feed.
- *
- * Has to be done within the same server slave,
- * passed through the context */
-
- CONTEXT_FROM_SOAP(soap,ctx);
- char *feed_id = NULL;
- time_t expires = 0;
- int ret = SOAP_OK;
-
- char const **attrs = calloc(in->__sizeattributes+1,sizeof *attrs);
- glite_jp_query_rec_t *qry = calloc(in->__sizeconditions+1,sizeof *qry);
- int i;
-
- glite_jp_clear_error(ctx);
-
- if (check_sane_feed(ctx,in)) {
- err2fault(ctx,soap);
- ret = SOAP_FAULT;
- goto cleanup;
- }
-
- memcpy(attrs,in->attributes,sizeof *attrs * in->__sizeattributes);
- for (i = 0; i<in->__sizeconditions; i++) s2jp_query(in->conditions[i],qry+i);
-
- if (in->history) {
- if (glite_jpps_run_feed(ctx,in->destination,attrs,qry,&feed_id)) {
- err2fault(ctx,soap);
- ret = SOAP_FAULT;
- goto cleanup;
- }
- }
-
- if (in->continuous) {
- if (glite_jpps_register_feed(ctx,in->destination,attrs,qry,&feed_id,&expires)) {
- err2fault(ctx,soap);
- ret = SOAP_FAULT;
- goto cleanup;
- }
- }
-
- if (!in->history && !in->continuous) {
- glite_jp_error_t err;
- memset(&err,0,sizeof err);
- err.code = EINVAL;
- err.source = __FUNCTION__;
- err.desc = "at least one of <history> and <continous> must be true";
- glite_jp_stack_error(ctx,&err);
- err2fault(ctx,soap);
- ret = SOAP_FAULT;
- goto cleanup;
- }
-
- out->feedExpires = expires;
- out->feedId = soap_strdup(soap,feed_id);
-
-cleanup:
- free(feed_id);
- free(attrs);
- free(qry);
-
- return ret;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__FeedIndexRefresh(
- struct soap *soap,
- struct _jpelem__FeedIndexRefresh *in,
- struct _jpelem__FeedIndexRefreshResponse *out)
-{
- fprintf(stderr,"%s: not implemented\n",__FUNCTION__);
- abort();
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobFiles(
- struct soap *soap,
- struct _jpelem__GetJobFiles *in,
- struct _jpelem__GetJobFilesResponse *out)
-{
- CONTEXT_FROM_SOAP(soap,ctx);
- char *url;
-
- int i,n;
- glite_jp_error_t err;
- void **pd;
- struct jptype__jppsFile **f = NULL;
-
- memset(&err,0,sizeof err);
- out->__sizefiles = 0;
-
- for (pd = ctx->plugins; *pd; pd++) {
- glite_jpps_fplug_data_t *plugin = *pd;
-
- for (i=0; plugin->uris[i]; i++) {
- glite_jp_clear_error(ctx);
- switch (glite_jppsbe_get_job_url(ctx,in->jobid,plugin->classes[i],NULL,&url)) {
- case 0: n = out->__sizefiles++;
- f = realloc(f,out->__sizefiles * sizeof *f);
- f[n] = soap_malloc(soap, sizeof **f);
- f[n]->class_ = soap_strdup(soap,plugin->uris[i]);
- f[n]->name = NULL;
- f[n]->url = soap_strdup(soap,url);
- free(url);
- break;
- case ENOENT:
- break;
- default:
- err.code = ctx->error->code;
- err.source = "jpsrv__GetJob()";
- err.desc = plugin->uris[i];
- glite_jp_stack_error(ctx,&err);
- err2fault(ctx,soap);
- glite_jp_clear_error(ctx);
- return SOAP_FAULT;
- }
- }
- }
-
- if (!out->__sizefiles) {
- glite_jp_clear_error(ctx);
- err.code = ENOENT;
- err.source = __FUNCTION__;
- err.desc = "No file found for this job";
- glite_jp_stack_error(ctx,&err);
- err2fault(ctx,soap);
-// glite_jp_clear_error(ctx);
- return SOAP_FAULT;
- }
-
- out->files = soap_malloc(soap,out->__sizefiles * sizeof *f);
- memcpy(out->files,f,out->__sizefiles * sizeof *f);
-
- return SOAP_OK;
-}
-
-SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobAttributes(
- struct soap *soap,
- struct _jpelem__GetJobAttributes *in,
- struct _jpelem__GetJobAttributesResponse *out)
-{
- glite_jp_attrval_t *attr;
- int i,n;
-
- CONTEXT_FROM_SOAP(soap,ctx);
-
- if (glite_jpps_get_attrs(ctx,in->jobid,
- in->attributes,
- in->__sizeattributes,&attr)) {
- err2fault(ctx,soap);
- return SOAP_FAULT;
- }
-
- for (i=0; attr[i].name; i++);
- out->__sizeattrValues = jp2s_attrValues(soap,attr,&out->attrValues,1);
-
- return SOAP_OK;
-}
+++ /dev/null
-static enum jptype__attrOrig jp2s_origin(glite_jp_attr_orig_t o)
-{
- switch (o) {
- case GLITE_JP_ATTR_ORIG_SYSTEM: return jptype__attrOrig__SYSTEM;
- case GLITE_JP_ATTR_ORIG_USER: return jptype__attrOrig__USER;
- case GLITE_JP_ATTR_ORIG_FILE: return jptype__attrOrig__FILE_;
- default: abort(); /* XXX */
- }
-}
-
-static int jp2s_attrValues(
- struct soap *soap,
- glite_jp_attrval_t *in,
- struct jptype__attrValue ***outp,
- int freeit)
-{
- struct jptype__attrValue **out;
- int i,cnt;
-
- for (cnt=0; in[cnt].name; cnt++);
-
- out = soap_malloc(soap,cnt * sizeof *out);
- for (i=0; in[i].name; i++) {
- struct jptype__attrValue *a = soap_malloc(soap,sizeof *a);
- out[i] = a;
-
- a->name = soap_strdup(soap,in[i].name);
- if (freeit) free(in[i].name);
- a->value = soap_malloc(soap,sizeof *a->value);
- if (in[i].binary) {
- a->value->blob = soap_malloc(soap,sizeof *a->value->blob);
- memset(a->value->blob,0,sizeof *a->value->blob);
- a->value->blob->__ptr = soap_malloc(soap,in[i].size);
- a->value->blob->__size = in[i].size;
- memcpy(a->value->blob->__ptr,in[i].value,in[i].size);
-
- a->value->string = NULL;
- }
- else {
- a->value->string = soap_strdup(soap,in[i].value);
- a->value->blob = NULL;
- }
- if (freeit) free(in[i].value);
- a->origin = jp2s_origin(in[i].origin);
- a->originDetail = in[i].origin_detail ? soap_strdup(soap,in[i].origin_detail) : NULL;
- if (freeit) free(in[i].origin_detail);
- a->timestamp = in[i].timestamp;
- }
- if (freeit) free(in);
-
- *outp = out;
- return cnt;
-}
-
-static void attrValues_free(
- struct soap *soap,
- struct jptype__attrValue **a,
- int na)
-{
- int i;
-
- for (i=0; i<na; i++) {
- soap_dealloc(soap,a[i]->name);
- if (a[i]->value->string) soap_dealloc(soap,a[i]->value->string);
- if (a[i]->value->blob) {
- soap_dealloc(soap,a[i]->value->blob->__ptr);
- soap_dealloc(soap,a[i]->value->blob);
- }
- soap_dealloc(soap,a[i]->value);
- if (a[i]->originDetail) soap_dealloc(soap,a[i]->originDetail);
- soap_dealloc(soap,a[i]);
- }
- soap_dealloc(soap,a);
-}
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#include <glite/jp/types.h>
-#include "tags.h"
-#include "backend.h"
-
-/* magic name_len value_len binary sequence timestamp */
-#define HEADER "JP#TAG# %05u %012lu %c %05u %012lu#"
-#define HEADER_SIZE 48
-
-int glite_jpps_tag_append(
- glite_jp_context_t ctx,
- void *handle,
- const glite_jp_tagval_t *tag
-)
-{
- char hdr[HEADER_SIZE+1];
- glite_jp_error_t err;
-
- unsigned long vlen = tag->binary ? tag->size :
- (tag->value ? strlen(tag->value) : 0);
- int nlen;
-
- memset(&err,0,sizeof err);
- err.source = "glite_jpps_tag_append()";
-
- if (!tag->name) {
- err.code = EINVAL;
- err.desc = "tag name";
- return glite_jp_stack_error(ctx,&err);
- }
-
- nlen = strlen(tag->name);
-
- assert(sprintf(hdr,HEADER,nlen,vlen,
- tag->binary ? "B" : "S",
- tag->sequence, tag->timestamp) == HEADER_SIZE);
-
- if (glite_jppsbe_append(ctx,handle,hdr,HEADER_SIZE)) {
- err.code = EIO;
- err.desc = "write tag header";
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (glite_jppsbe_append(ctx,handle,tag->name,nlen)) {
- err.code = EIO;
- err.desc = "write tag name";
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (glite_jppsbe_append(ctx,handle,tag->value,vlen)) {
- err.code = EIO;
- err.desc = "write tag value";
- return glite_jp_stack_error(ctx,&err);
- }
-
- return 0;
-}
-
-int glite_jpps_tagval_copy(
- glite_jp_context_t ctx,
- glite_jp_tagval_t *from,
- glite_jp_tagval_t *to
-)
-{
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- to->name = strdup(from->name);
- if (!to->name) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- to->sequence = from->sequence;
- to->timestamp = from->timestamp;
- to->binary = from->binary;
- to->size = from->size;
- to->value = (char *) malloc(to->size);
- if (!to->value) {
- free(to->name);
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- memcpy(from->value, to->value, to->size);
-
- return 0;
-}
-
-int glite_jpps_tag_read(
- glite_jp_context_t ctx,
- void *handle,
- off_t offset,
- glite_jp_tagval_t *tagvalue,
- size_t *shift
-)
-{
- char hdr[HEADER_SIZE+1];
- unsigned int nlen;
- unsigned long vlen;
- char binary;
- unsigned sequence;
- unsigned timestamp;
- char * name = NULL;
- char * value = NULL;
- ssize_t ret;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- hdr[HEADER_SIZE] = '\0';
- if (glite_jppsbe_pread(ctx, handle, hdr, HEADER_SIZE, offset, &ret)) {
- err.code = EIO;
- err.desc = "Cannot read tag header";
- goto error_out;
- }
- if (ret == 0) {
- err.code = ENOENT;
- err.desc = "No more tags in the file";
- goto error_out;
- }
- /* #define HEADER "JP#TAG# %05u %012lu %c %05u %012lu#" */
- if (sscanf(hdr, HEADER, &nlen, &vlen, &binary, &sequence, ×tamp) < 5) {
- err.code = EILSEQ;
- err.desc = "Incorrect tag header format";
- goto error_out;
- }
- name = (char*) malloc(nlen + 1);
- if (!name) {
- err.code = ENOMEM;
- goto error_out;
- }
- name[nlen] = '\0';
- value = (char*) malloc(vlen + 1);
- if (!value) {
- err.code = ENOMEM;
- goto error_out;
- }
- value[vlen] = '\0';
- if (glite_jppsbe_pread(ctx, handle, name, nlen, offset + HEADER_SIZE, &ret)) {
- err.code = EIO;
- err.desc = "Cannot read tag name";
- goto error_out;
- }
- if (glite_jppsbe_pread(ctx, handle, value, vlen, offset + HEADER_SIZE + nlen, &ret)) {
- err.code = EIO;
- err.desc = "Cannot read tag value";
- goto error_out;
- }
-
- tagvalue->name = name;
- tagvalue->sequence = sequence;
- tagvalue->timestamp = timestamp;
- tagvalue->binary = (binary == 'B') ? 1 : 0;
- tagvalue->size = vlen;
- tagvalue->value = value;
-
- *shift = HEADER_SIZE + nlen + vlen;
-
- return 0;
-error_out:
- free(name);
- free(value);
- return glite_jp_stack_error(ctx,&err);
-}
-
-/*
-int glite_jpps_tag_read(glite_jp_context_t, void *, off_t, glite_jp_tagval_t *, size_t);
-int glite_jpps_tag_readall(glite_jp_context_t, void *, glite_jp_tagval_t **);
-*/
-
-int glite_jpps_tag_readall(
- glite_jp_context_t ctx,
- void *handle,
- glite_jp_tagval_t **tags_out
-)
-{
- glite_jp_tagval_t * tags = NULL;
- void * newspace;
- int ntags = 0;
- int ntagspace = 0;
- off_t offset = 0;
- int ret;
- size_t shift;
- glite_jp_error_t err;
-
- glite_jp_clear_error(ctx);
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- ntagspace = 1;
- tags = (glite_jp_tagval_t *) calloc(ntagspace + 1, sizeof(*tags));
- if (!tags) {
- err.code = ENOMEM;
- return glite_jp_stack_error(ctx,&err);
- }
- while (!(ret = glite_jpps_tag_read(ctx, handle, offset, &tags[ntags], &shift))) {
- offset += shift;
- ntags++;
- if (ntagspace <= ntags) {
- ntagspace += 1;
- newspace = realloc(tags, (ntagspace + 1) * sizeof(*tags));
- if (!newspace) {
- err.code = ENOMEM;
- goto error_out;
- }
- tags = (glite_jp_tagval_t *) newspace;
- }
- }
- if (ret == ENOENT) {
- *tags_out = tags;
- return 0;
- } else {
- err.code = EIO;
- err.desc = "Error reading tag value";
- }
-
-error_out:
- for (; ntags-- ;) {
- free(tags[ntags].name);
- free(tags[ntags].value);
- }
- free(tags);
- return glite_jp_stack_error(ctx,&err);
-}
+++ /dev/null
-int glite_jpps_tag_append(glite_jp_context_t,void *,const char *, const char *);
+++ /dev/null
-#include <stdlib.h>
-#include <assert.h>
-#include <stdarg.h>
-#include <string.h>
-#include <errno.h>
-#include <stdint.h>
-
-#include <glite/jp/types.h>
-
-#include "file_plugin.h"
-#include "builtin_plugins.h"
-#include "backend.h"
-
-static int tagappend(void *,void *,int,...);
-static int tagopen(void *,void *,const char *uri,void **);
-static int tagclose(void *,void *);
-static int tagattr(void *,void *,const char *,glite_jp_attrval_t **);
-
-struct tags_handle {
- void *bhandle;
- int n;
- glite_jp_attrval_t *tags;
-};
-
-static int tagsread(void *,struct tags_handle *);
-
-#define TAGS_MAGIC 0x74c016f2 /* two middle digits encode version, i.e. 01 */
-
-static int tagdummy()
-{
- puts("tagdummy()");
- return -1;
-}
-
-int init(glite_jp_context_t ctx, glite_jpps_fplug_data_t *data)
-{
- data->fpctx = ctx;
-
- data->uris = calloc(2,sizeof *data->uris);
- data->uris[0] = strdup(GLITE_JP_FILETYPE_TAGS);
-
- data->classes = calloc(2,sizeof *data->classes);
- data->classes[0] = strdup("tags");
-
- data->ops.open = tagopen;
- data->ops.close = tagclose;
- data->ops.attr = tagattr;
- data->ops.generic = tagappend;
-
- printf("tags_plugin: URI: \"%s\"; magic number: 0x%08lx\n",GLITE_JP_FILETYPE_TAGS,TAGS_MAGIC);
- return 0;
-}
-
-static int tagopen(void *fpctx,void *bhandle,const char *uri,void **handle)
-{
- struct tags_handle *h = calloc(1,sizeof *h);
- h->n = 0;
- h->bhandle = bhandle;
-
- *handle = h;
-
- return 0;
-}
-
-static int tagclose(void *fpctx,void *handle)
-{
- int i;
- struct tags_handle *h = handle;
-
- for (i=0; i<h->n; i++) glite_jp_attrval_free(h->tags+i,0);
- free(h->tags);
- free(h);
-
- return 0;
-}
-
-static int tagappend(void *fpctx,void *handle,int oper,...)
-{
- glite_jp_attrval_t *tag;
- va_list ap;
- char *hdr,*rec;
- glite_jp_context_t ctx = fpctx;
- struct tags_handle *h = handle;
- uint32_t magic,hlen,rlen,rlen_n;
- size_t r;
- glite_jp_error_t err;
-
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
- glite_jp_clear_error(ctx);
-
- va_start(ap,oper);
- tag = va_arg(ap,glite_jp_attrval_t *);
- va_end(ap);
-
- printf("tagappend: %s,%s\n",tag->name,tag->value);
-
- assert(oper == GLITE_JP_FPLUG_TAGS_APPEND);
-
- if (glite_jppsbe_pread(ctx,h->bhandle,&magic,sizeof magic,0,&r)) {
- err.code = EIO;
- err.desc = "reading magic number";
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (r == 0) {
- magic = htonl(TAGS_MAGIC);
- if (glite_jppsbe_pwrite(ctx,h->bhandle,&magic,sizeof magic,0)) {
- err.code = EIO;
- err.desc = "writing magic number";
- return glite_jp_stack_error(ctx,&err);
- }
- }
- else if (r != sizeof magic) {
- err.code = EIO;
- err.desc = "can't read magic number";
- return glite_jp_stack_error(ctx,&err);
- }
- else if (magic != htonl(TAGS_MAGIC)) {
- err.code = EINVAL;
- err.desc = "invalid magic number";
- return glite_jp_stack_error(ctx,&err);
- }
-
-/* XXX: origin is always USER, not recorded */
- trio_asprintf(&hdr,"%ld %c",
- tag->timestamp,tag->binary ? 'B' : 'S');
-
- rlen = strlen(tag->name) + strlen(hdr) + 2 /* \0 after name and after hdr */ +
- (r = tag->binary ? tag->size : (tag->value ? strlen(tag->value) : 0));
-
- rlen_n = htonl(rlen);
-
- rec = malloc(rlen + sizeof rlen_n);
- *((uint32_t *) rec) = rlen_n;
- strcpy(rec + sizeof rlen_n,tag->name);
- strcpy(rec + (hlen = sizeof rlen_n + strlen(tag->name) + 1),hdr);
-
- if (r) memcpy(rec + hlen + strlen(hdr) + 1,tag->value,r);
- free(hdr);
-
-/* record format:
- * - 4B length, net byte order
- * - attr name, \0
- * - %ld %c \0 (timestamp, B/S)
- * - value
- */
- if (glite_jppsbe_append(ctx,h->bhandle,rec,rlen + sizeof rlen_n)) {
- err.code = EIO;
- err.desc = "writing tag record";
- free(rec);
- return glite_jp_stack_error(ctx,&err);
- }
-
- /* XXX: should add tag also to handle->tags, but it is never used
- * currently */
-
- return 0;
-}
-
-static int tagattr(void *fpctx,void *handle,const char *attr,glite_jp_attrval_t **attrval)
-{
- struct tags_handle *h = handle;
- glite_jp_error_t err;
- glite_jp_context_t ctx = fpctx;
- glite_jp_attrval_t *out = NULL;
- int i,nout = 0;
-
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- if (!h->tags) tagsread(fpctx,handle);
-
- if (!h->tags) {
- err.code = ENOENT;
- err.desc = "no tags for this job";
- return glite_jp_stack_error(ctx,&err);
- }
-
- for (i=0; i<h->n; i++) if (!strcmp(h->tags[i].name,attr)) {
- out = realloc(out,(nout+2) * sizeof *out);
- glite_jp_attrval_copy(out+nout,h->tags+i);
- nout++;
- memset(out+nout,0,sizeof *out);
- }
-
- if (nout) {
- *attrval = out;
- return 0;
- }
- else {
- err.code = ENOENT;
- err.desc = "no value for this tag";
- return glite_jp_stack_error(ctx,&err);
- }
-}
-
-static int tagsread(void *fpctx,struct tags_handle *h)
-{
- glite_jp_context_t ctx = fpctx;
- uint32_t magic,rlen;
- glite_jp_error_t err;
- int r;
- size_t off = sizeof rlen;
- glite_jp_attrval_t *tp;
- char *rp;
-
- memset(&err,0,sizeof err);
- err.source = __FUNCTION__;
-
- glite_jp_clear_error(ctx);
-
-/* read magic number */
- if (glite_jppsbe_pread(ctx,h->bhandle,&magic,sizeof magic,0,&r)) {
- err.code = EIO;
- err.desc = "reading magic number";
- return glite_jp_stack_error(ctx,&err);
- }
-
- if (r != sizeof magic) {
- err.code = EIO;
- err.desc = "can't read magic number";
- return glite_jp_stack_error(ctx,&err);
- }
- else if (magic != htonl(TAGS_MAGIC)) {
- err.code = EINVAL;
- err.desc = "invalid magic number";
- return glite_jp_stack_error(ctx,&err);
- }
-
-
- while (1) {
- char *rec,type;
- int rd;
-
- /* read record header */
- if (glite_jppsbe_pread(ctx,h->bhandle,&rlen,sizeof rlen,off,&r)) {
- err.code = EIO;
- err.desc = "reading record header";
- return glite_jp_stack_error(ctx,&err);
- }
- if (r == 0) break;
-
- if (r != sizeof rlen) {
- err.code = EIO;
- err.desc = "can't read record header";
- return glite_jp_stack_error(ctx,&err);
- }
-
- off += r;
- rec = malloc(rlen = ntohl(rlen));
-
- /* read whole record body thoroughly */
- for (rd=0; rd<rlen; rd+=r) /* XXX: will loop on 0 bytes read */
- if (glite_jppsbe_pread(ctx,h->bhandle,rec+rd,rlen-rd,off+rd,&r)) {
- err.code = EIO;
- err.desc = "reading record body";
- free(rec);
- return glite_jp_stack_error(ctx,&err);
- }
-
- off += rlen;
-
- /* parse the record */
- h->tags = realloc(h->tags,(h->n+2) * sizeof *h->tags);
- tp = h->tags+h->n++;
- memset(tp,0,sizeof *tp);
-
- tp->name = strdup(rec);
- rp = rec + strlen(rec) + 1;
-
- sscanf(rp,"%ld %c",&tp->timestamp,&type);
- rp += strlen(rp) + 1;
- switch (type) {
- int i;
-
- case 'B': tp->binary = 1; break;
- case 'S': tp->binary = 0; break;
- default: free(rec);
- for (i=0; i<h->n; i++)
- glite_jp_attrval_free(h->tags+i,0);
- free(h->tags);
- h->tags = NULL;
- h->n = 0;
-
- err.code = EINVAL;
- err.desc = "invalid attr type (B/S)";
- return glite_jp_stack_error(ctx,&err);
- }
- tp->value = malloc((r=rlen - (rp - rec)) + 1);
- memcpy(tp->value,rp,r);
- if (!tp->binary) tp->value[r] = 0;
- tp->origin = GLITE_JP_ATTR_ORIG_USER;
-
- free(rec);
- }
- return 0;
-}
+++ /dev/null
-jpsrv = http://glite.org/wsdl/services/jp
-jptype = http://glite.org/wsdl/types/jp
-jpelem = http://glite.org/wsdl/elements/jp
+++ /dev/null
-# defaults
-top_srcdir=.
-builddir=build
-top_builddir=${top_srcdir}/${builddir}
-stagedir=.
-distdir=.
-globalprefix=glite
-jpprefix=jp
-package=glite-jp-server-common
-version=0.0.0
-PREFIX=/opt/glite
-
-glite_location=/opt/glite
-globus_prefix=/opt/globus
-nothrflavour=gcc32
-thrflavour=gcc32pthr
-expat_prefix=/opt/expat
-ares_prefix=/opt/ares
-gsoap_prefix=/software/gsoap-2.6
-
-CC=gcc
-
--include Makefile.inc
-
-
-VPATH=${top_srcdir}/src:${top_srcdir}/examples:${top_srcdir}/test:${top_srcdir}/project:${jpproject}:${stagedir}/interface
-
-DEBUG:=-g -O0 -W -Wall -DDEBUG
-CPPFLAGS:=-I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${stagedir}/include -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql
-CFLAGS:=${DEBUG} -D_GNU_SOURCE
-LDFLAGS:=-L${stagedir}/lib
-
-COMPILE:=libtool --mode=compile ${CC} ${CPPFLAGS} ${CFLAGS}
-LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/lib ${LDFLAGS}
-INSTALL:=libtool --mode=install install
-
-GLOBUS_LIBS:=-L${globus_prefix}/lib \
- -lglobus_common_${nothrflavour} \
- -lglobus_gssapi_gsi_${nothrflavour}
-
-TRIOLIB:=-lglite_lb_trio
-
-# FIXME: to use libtool versioning correcty, we should have:
-#
-# current = major + minor + offset
-# revision = patch
-# age = minor
-#
-# where offset is a sum of maximal released minor's of all previous major's
-#
-version_info=-version-info `echo ${version} | cut -d. -f1,2 | tr . :`
-
-STATICLIB:=libglite_jp_server_common.a
-LTLIB:=libglite_jp_server_common.la
-
-
-SRCS:=db.c
-HDRS:=db.h
-OBJS:=${SRCS:.c=.o}
-LOBJS:=${OBJS:.o=.lo}
-
-ifneq (${mysql_prefix},/usr)
- ifeq ($(shell echo ${mysql_version} | cut -d. -f1,2),4.1)
- MYSQLIB := -L${mysql_prefix}/lib/mysql -lmysqlclient
- else
- MYSQLIB := -L${mysql_prefix}/lib -lmysqlclient
- endif
-else
- MYSQLIB := -lmysqlclient
-endif
-
-
-default all: compile examples
-
-compile: ${LTLIB} ${STATICLIB}
-
-${LTLIB} ${STATICLIB}: ${OBJS}
- ${LINK} ${version_info} -o $@ ${LOBJS} ${MYSQLIB}
-
-examples: db-test-int
-
-db-test-int: db-test-int.o
- ${LINK} -o $@ $+ ${STATICLIB} ${MYSQLIB} -lglite_jp_common ${TRIOLIB} ${GLOBUS_LIBS}
-
-check:
- -echo nothing yet
-
-doc:
-
-stage: compile
- $(MAKE) install PREFIX=${stagedir}
-
-dist: distsrc distbin
-
-distsrc:
- mkdir -p ${top_srcdir}/${package}-${version}
- cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version}
- cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version}
- rm -rf ${top_srcdir}/${package}-${version}
-
-distbin:
- $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir}
- save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir
- rm -rf tmpbuilddir
-
-install:
- -mkdir -p ${PREFIX}/lib ${PREFIX}/include/${globalprefix}/${jpprefix}
- ${INSTALL} -m 755 ${LTLIB} ${PREFIX}/lib
- for f in ${HDRS}; do \
- ${INSTALL} -m 644 ${top_srcdir}/interface/"$$f" ${PREFIX}/include/${globalprefix}/${jpprefix}; \
- done
-
-clean:
-
-%.o: %.c
- ${COMPILE} -c $< -o $@
-
-.PHONY: default all compile examples check doc stage dist distsrc distbin install clean
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Build file for the gLite JP Server Common module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.3 2005/05/26 15:13:28 zurek
- inserted module.build.file
-
- Revision 1.2 2004/11/22 14:00:37 dimeglio
- Updated to use standard files
- Fixed names (was using common instead of real module name)
-
- Revision 1.1.1.1 2004/10/15 09:49:13 akrenek
--->
-
-<project name="server-common" default="dist">
-
- <!-- =========================================
- Builds the GLite JP Common Server Module
- ========================================= -->
-
- <!-- =========================================
- Import properties (order is important)
- ========================================= -->
-
- <!-- import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- import component build properties,
- component properties &
- component common properties -->
- <import file="./project/properties.xml"/>
-
- <!-- import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="${subsystem.properties.file}"/>
-
- <!-- import global build properties &
- global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependency property files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${component.dependencies.file}" />
- <property file="${subsystem.dependencies.file}" />
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options (order is important)
- ========================================= -->
- <import file="${global.configure.options.file}"/>
- <import file="${component.configure.options.file}"/>
-
- <!-- =========================================
- Import task definitions (order is important)
- ========================================= -->
- <import file="${subsystem.taskdefs.file}" />
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Load common targets
- ========================================= -->
- <import file="${global.targets-simple_make.file}" />
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ==============================================
- Local private targets
- ============================================== -->
-
- <target name="localinit"
- description="Module specific initialization tasks">
-
- <antcall target="lbmakefiles" />
- </target>
-
- <target name="localcompile"
- description="Module specific compile tasks">
- </target>
-
- <target name="localclean"
- description="Module specific cleaning tasks">
- </target>
-
-</project>
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "db.h"
-
-
-static void print_err(glite_jp_context_t ctx) {
- glite_jp_error_t *e;
-
- e = ctx->error;
- while (e) {
- printf("%s(%s)\n", e->desc, e->source);
- e = e->reason;
- }
- printf("\n");
-}
-
-
-int main() {
- glite_jp_context_t ctx;
- glite_jp_db_stmt_t jpstmt;
-
- glite_jp_init_context(&ctx);
-
- printf("connecting...\n");
- if (glite_jp_db_connect(ctx, "jpis/@localhost:jpis1") != 0) goto fail;
-
- // "trio" queries
-{
- int nr, i;
- char **res;
-
- printf("selecting...\n");
- if ((glite_jp_db_execstmt(ctx, "SELECT uniqueid, feedid, state, source, condition FROM feeds", &jpstmt)) == -1) goto fail;
-
- printf("fetching...\n");
- res = calloc(4, sizeof(char *));
- while ((nr = glite_jp_db_fetchrow(jpstmt, res)) > 0) {
- printf("Result: n=%d, res=%p\n", nr, res);
- i = 0;
- if (res) while(i < nr) {printf("p=%p(%s)\n", res[i], res[i]);free(res[i]);i++;}
- }
- free(res);
- printf("closing stmt...\n");
- glite_jp_db_freestmt(&jpstmt);
-}
-
- // param queries
-{
- char res_feedid[33];
- long int res_state;
- char res_source[256];
- char res_condition[1024];
- unsigned long res_condition_length;
- long int param_state;
-
- void *my_res, *my_param;
-
- glite_jp_db_create_params(&my_param, 1, GLITE_JP_DB_TYPE_INT, ¶m_state);
- glite_jp_db_create_results(&my_res, 4,
- GLITE_JP_DB_TYPE_VARCHAR, NULL, res_feedid, sizeof(res_feedid), NULL,
- GLITE_JP_DB_TYPE_INT, NULL, &res_state,
- GLITE_JP_DB_TYPE_VARCHAR, NULL, res_source, sizeof(res_source), NULL,
- GLITE_JP_DB_TYPE_MEDIUMBLOB, NULL, res_condition, sizeof(res_condition), &res_condition_length
- );
- printf("preparing...\n");
- if ((glite_jp_db_prepare(ctx, "SELECT feedid, state, source, condition FROM feeds WHERE state = ?", &jpstmt, my_param, my_res)) != 0) goto fail_close;
-
- param_state = 1;
- printf("executing state %ld...\n", param_state);
- if (glite_jp_db_execute(jpstmt) == -1) {
- glite_jp_db_freestmt(&jpstmt);
- goto fail_stmtclose;
- }
- printf("fetching...\n");
- while (glite_jp_db_fetch(jpstmt) == 0) {
- printf("feedid:%s, state:%ld, source:%s, condition:%s\n", res_feedid, res_state, res_source, res_condition);
- }
-
- param_state = 2;
- printf("executing state %ld...\n", param_state);
- if (glite_jp_db_execute(jpstmt) == -1) {
- glite_jp_db_freestmt(&jpstmt);
- goto fail_stmtclose;
- }
- printf("fetching...\n");
- while (glite_jp_db_fetch(jpstmt) == 0) {
- printf("feedid:%s, state:%ld, source:%s, condition:%s\n", res_feedid, res_state, res_source, res_condition);
- }
-}
-
- printf("closing stmt...\n");
- glite_jp_db_freestmt(&jpstmt);
- printf("closing...\n");
- glite_jp_db_close(ctx);
-
- glite_jp_free_context(ctx);
- return 0;
-
-fail_stmtclose:
- printf("closing stmt...\n");
- glite_jp_db_freestmt(&jpstmt);
-fail_close:
- printf("closing...\n");
- glite_jp_db_close(ctx);
-fail:
- printf("failed\n");
- print_err(ctx);
- glite_jp_free_context(ctx);
-
- return 1;
-}
+++ /dev/null
-#ifndef _DB_H
-#define _DB_H
-
-#ident "$Header$"
-
-#include <sys/types.h>
-#include <sys/time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <glite/jp/types.h>
-#include <glite/jp/context.h>
-
-typedef struct _glite_jp_db_stmt_t *glite_jp_db_stmt_t;
-
-typedef enum {
- GLITE_JP_DB_TYPE_NULL = 0,
- GLITE_JP_DB_TYPE_TINYINT = 1,
- GLITE_JP_DB_TYPE_INT = 2,
- GLITE_JP_DB_TYPE_TINYBLOB = 3,
- GLITE_JP_DB_TYPE_TINYTEXT = 4,
- GLITE_JP_DB_TYPE_BLOB = 5,
- GLITE_JP_DB_TYPE_TEXT = 6,
- GLITE_JP_DB_TYPE_MEDIUMBLOB = 7,
- GLITE_JP_DB_TYPE_MEDIUMTEXT = 8,
- GLITE_JP_DB_TYPE_LONGBLOB = 9,
- GLITE_JP_DB_TYPE_LONGTEXT = 10,
- GLITE_JP_DB_TYPE_VARCHAR = 11,
- GLITE_JP_DB_TYPE_CHAR = 12,
- GLITE_JP_DB_TYPE_DATE = 13,
- GLITE_JP_DB_TYPE_TIME = 14,
- GLITE_JP_DB_TYPE_DATETIME = 15,
- GLITE_JP_DB_TYPE_TIMESTAMP = 16,
- GLITE_JP_DB_TYPE_LAST = 17
-} glite_jp_db_type_t;
-
-/**
- * Connect to the database.
- *
- * \param[inout] cxt context to work with
- * \param[in] cs connect string user/password@host:database
- *
- \return JP error code
- */
-int glite_jp_db_connect(glite_jp_context_t, const char *);
-
-
-/**
- * Close the connection to database.
- *
- * \param[inout] ctx context to work with
- */
-void glite_jp_db_close(glite_jp_context_t);
-
-
-/**
- * Parse and execute SQL statement.
- *
- * \param[inout] ctx context to work with
- * \param[in] txt SQL statement
- * \param[out] stmt statement handle, usable for select only
- *
- * \return number of rows selected, created or affected by update, or -1 on error
- */
-int glite_jp_db_execstmt(glite_jp_context_t, const char *, glite_jp_db_stmt_t *);
-
-
-/** Fetch next row of select statement.
- * All columns are returned as fresh allocated strings
- *
- * \param[inout] stmt statement from glite_jp_db_execstmt()
- * \param[out] array of fetched values.
- * As number of columns is fixed and known,
- * expects allocated array of pointers here.
- *
- * \retval >0 number of fields of the retrieved row
- * \retval 0 no more rows
- * \retval -1 error
- *
- * Errors are stored in context passed to previous glite_jp_db_execstmt()
- */
-int glite_jp_db_fetchrow(glite_jp_db_stmt_t, char **);
-
-
-/**
- * Retrieve column names of a query statement
- *
- * \param[inout] stmt statement
- * \param[out] cols result set column names. Expects allocated array.
- *
- * \return 0 if OK, nonzero on error
- */
-int glite_jp_db_querycolumns(glite_jp_db_stmt_t, char **);
-
-
-/**
- * Free the statement structure and destroy its parameters.
- *
- * \param[inout] stmt statement
- */
-void glite_jp_db_freestmt(glite_jp_db_stmt_t *);
-
-
-/**
- * Convert time_t into database-specific time string.
- *
- * \param[in] t the converted time
- * \return XXX: pointer to static area that is changed by subsequent calls
- */
-char *glite_jp_db_timetodb(time_t);
-
-
-/**
- * Convert database-specific time string into time_t.
- *
- * \param[in] t the converted string
- *
- * \return result time
- */
-time_t glite_jp_db_dbtotime(const char *);
-
-
-/**
- * Check database version.
- *
- * \param[inout] ctx context to work with
- *
- * \return JP error code
- */
-int glite_jp_db_dbcheckversion(glite_jp_context_t);
-
-
-/**
- * Create and assign parameters for mysql prepared commands.
- *
- * \param[out] params internal structure array
- *
- * Variable parameters:
- * always:
- * glite_jp_db_type_t type DB item type
- * then one of them:
- * GLITE_JP_DB_TYPE_TINYINT: char *buffer
- * GLITE_JP_DB_TYPE_INT: int *buffer
- * GLITE_JP_DB_TYPE_*BLOB/TEXT: void *buffer, unsigned long *length
- * GLITE_JP_DB_TYPE_[VAR]CHAR: char *buffer, unsigned long *length
- * GLITE_JP_DB_TYPE_DATE: void **buffer
- * GLITE_JP_DB_TYPE_TIME: void **buffer
- * GLITE_JP_DB_TYPE_DATETIME: void **buffer
- * GLITE_JP_DB_TYPE_TIMESTAMP: void **buffer
- * GLITE_JP_DB_TYPE_NULL: -
- */
-void glite_jp_db_create_params(void **params, int n, ...);
-
-/**
- * Create and assign result variables for mysql prepared commands.
- *
- * \param[inout] result mysql bind strusture array
- *
- * Variable parameters:
- * always:
- * \param[in] glite_jp_db_type_t type DB item type
- * \param[in] int *is_null pointer to is_null boolean or NULL
- * then one of them:
- * GLITE_JP_DB_TYPE_TINYINT: char *buffer
- * GLITE_JP_DB_TYPE_INT: long int *buffer
- * GLITE_JP_DB_TYPE_*BLOB/TEXT: void *buffer, unsigned long max_length, unsigned long *length
- * GLITE_JP_DB_TYPE_[VAR]CHAR: char *buffer, unsigned long max_length, unsigned long *length
- * GLITE_JP_DB_TYPE_DATE: void **buffer
- * GLITE_JP_DB_TYPE_TIME: void **buffer
- * GLITE_JP_DB_TYPE_DATETIME: void **buffer
- * GLITE_JP_DB_TYPE_TIMESTAMP: void **buffer
- */
-void glite_jp_db_create_results(void **results, int n, ...);
-
-/**
- * Destroy prepared parameters.
- */
-void glite_jp_db_destroy_params(void *params);
-
-/**
- * Destroy prepared results.
- */
-void glite_jp_db_destroy_results(void *results);
-
-#if 0
-void glite_jp_db_assign_param(MYSQL_BIND *param, enum enum_field_types type, ...);
-void glite_jp_db_assign_result(MYSQL_BIND *result, enum enum_field_types type, my_bool *is_null, ...);
-#endif
-
-/**
- * Assign time_t to buffer.
- */
-void glite_jp_db_set_time(void *buffer, const time_t time);
-
-/**
- * Get the time from buffer.
- */
-time_t glite_jp_db_get_time(const void *buffer);
-
-/**
- * Rebind the parameters and/or results.
- *
- * \param[inout] jpstmt JP SQL statement to work with
- * \param[inout] params mysql static structure with parameters or NULL
- * \param[inout] cols mysql static structure with result buffer or NULL
- *
- * \return JP error code
- */
-int glite_jp_db_rebind(glite_jp_db_stmt_t jpstmt, void *params, void *cols);
-
-/**
- * Prepare the SQL statement. Use glite_jp_db_freestmt() to free it.
- *
- * \param[inout] ctx context to work with
- * \param[in] sql SQL command
- * \param[out] jpstmt returned JP SQL statement
- * \param[inout] params mysql static structure with parameters or NULL
- * \param[inout] cols mysql static structure with result buffer or NULL
- *
- * \return JP error code
- */
-int glite_jp_db_prepare(glite_jp_context_t ctx, const char *sql, glite_jp_db_stmt_t *jpstmt, void *params, void *cols);
-
-/**
- * Execute prepared SQL statement.
- *
- * \param[inout] jpstmt JP SQL statement
- *
- * \return number of affected rows, -1 on error
- */
-int glite_jp_db_execute(glite_jp_db_stmt_t jpstmt);
-
-/**
- *
- * \param[inout] jpstmt JP SQL statement
- *
- * \return JP error code (ENODATA when no more row are available)
- */
-int glite_jp_db_fetch(glite_jp_db_stmt_t jpstmt);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-#Sat Oct 15 06:50:18 CEST 2005
-module.build=3
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Configuration options for the gLite JP Index module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.4 2005/08/12 10:56:25 mmulac
- void IS server
- - seems compiling
-
- Revision 1.3 2004/12/01 18:45:38 zsalvet
- *** empty log message ***
-
- Revision 1.2 2004/11/22 14:00:37 dimeglio
- Updated to use standard files
- Fixed names (was using common instead of real module name)
-
- Revision 1.1.1.1 2004/10/15 09:49:13 akrenek
--->
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <project name="JP Common configuration options">
- <target name="lbmakefiles">
- <exec executable="ln" failonerror="true">
- <arg line="-fs ${component.dir}/Makefile ${module.build.dir}/Makefile"/>
- </exec>
- <echo file="${module.build.dir}/Makefile.inc">
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-jpprefix=${subsystem.prefix}
-package=${module.package.name}
-PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
-globus_prefix=${with.globus.prefix}
-expat_prefix=${with.expat.prefix}
-gsoap_prefix=${with.gsoap.prefix}
-ares_prefix=${with.ares.prefix}
-mysql_prefix=${with.mysql.prefix}
-mysql_version=${ext.mysql.version}
-thrflavour=${with.globus.thr.flavor}
-nothrflavour=${with.globus.nothr.flavor}
-cppunit=${with.cppunit.prefix}
-jpproject=${subsystem.project.dir}
-project=${component.project.dir}
- </echo>
- </target>
- </project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Common build properties file for the gLite JP Common Server component
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.2 2004/11/22 14:00:37 dimeglio
- Updated to use standard files
- Fixed names (was using common instead of real module name)
-
- Revision 1.1.1.1 2004/10/15 09:49:13 akrenek
--->
-
-<project name="JP Common Server component common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property file="project/build.properties" />
-
- <!-- ======================================================
- Define corresponding subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${jp.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${jp.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define component properties
- ====================================================== -->
-
- <!-- Component name prefix -->
- <property name="component.prefix" value="server-common" />
-
- <!-- ======================================================
- Define general component properties
- ====================================================== -->
-
- <import file="${component.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
-
-</project>
+++ /dev/null
-tar_exclude
-CVS
-build.xml
-build
-build.properties
-properties.xml
-configure.properties.xml
-.cvsignore
-.project
-.cdtproject
+++ /dev/null
-module.version=1.0.0
-module.age=1
+++ /dev/null
-#ident "$Header$"
-
-#include <mysql.h>
-#include <mysqld_error.h>
-#include <errmsg.h>
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <assert.h>
-
-#include "glite/jp/types.h"
-#include "glite/jp/context.h"
-
-#include "db.h"
-
-
-#define GLITE_JP_DB_MYSQL_VERSION 40102
-
-#if !defined(MYSQL_VERSION_ID) || MYSQL_VERSION_ID < GLITE_JP_DB_MYSQL_VERSION
-#error required MySQL version 4.1.2
-#endif
-
-#define JP_ERR(CTX, CODE, DESC) jp_err((CTX), (CODE), (DESC), __FUNCTION__, __LINE__)
-#define MY_ERR(CTX) my_err((CTX), __FUNCTION__, __LINE__)
-#define MY_ERRSTMT(JPSTMT) my_errstmt((JPSTMT), __FUNCTION__, __LINE__)
-#define MY_ISOKSTMT(JPSTMT, RETRY) my_isokstmt((JPSTMT), __FUNCTION__, __LINE__, (RETRY))
-
-
-typedef struct {
- int n;
- MYSQL_BIND params[1];
-} params_t;
-
-struct _glite_jp_db_stmt_t {
- glite_jp_context_t ctx;
- MYSQL_RES *result;
- MYSQL_STMT *stmt;
- params_t *params, *results;
-};
-
-
-static int glite_to_mysql_type[] = {
- MYSQL_TYPE_NULL,
- MYSQL_TYPE_TINY,
- MYSQL_TYPE_LONG,
- MYSQL_TYPE_TINY_BLOB,
- MYSQL_TYPE_TINY_BLOB,
- MYSQL_TYPE_BLOB,
- MYSQL_TYPE_BLOB,
- MYSQL_TYPE_MEDIUM_BLOB,
- MYSQL_TYPE_MEDIUM_BLOB,
- MYSQL_TYPE_LONG_BLOB,
- MYSQL_TYPE_LONG_BLOB,
- MYSQL_TYPE_VAR_STRING,
- MYSQL_TYPE_STRING,
- MYSQL_TYPE_DATE,
- MYSQL_TYPE_TIME,
- MYSQL_TYPE_DATETIME,
- MYSQL_TYPE_TIMESTAMP,
-};
-
-
-static int jp_err(glite_jp_context_t ctx, int code, const char *desc, const char *source, int line)
-{
- glite_jp_error_t err;
- char *fullsource;
- int ret;
-
- asprintf(&fullsource, "%s:%d", source, line);
- memset(&err,0,sizeof err);
- err.code = code;
- err.source = fullsource;
- err.desc = desc;
-
- ret = glite_jp_stack_error(ctx,&err);
- free(fullsource);
- return ret;
-}
-
-
-static int my_err(glite_jp_context_t ctx, const char *source, int line)
-{
- return jp_err(ctx, EIO, mysql_error((MYSQL *)ctx->dbhandle), source, line);
-}
-
-
-static int my_errstmt(glite_jp_db_stmt_t jpstmt, const char *source, int line) {
- return jp_err(jpstmt->ctx, EIO, mysql_stmt_error(jpstmt->stmt), source, line);
-}
-
-
-/*
- * Error handle.
- *
- * \return -1 failed
- * \return 0 retry
- * \return 1 OK
- */
-static int my_isokstmt(glite_jp_db_stmt_t jpstmt, const char *source, int line, int *retry) {
- switch (mysql_stmt_errno(jpstmt->stmt)) {
- case 0:
- return 1;
- break;
- case ER_DUP_ENTRY:
- jp_err(jpstmt->ctx, EEXIST, mysql_stmt_error(jpstmt->stmt), source, line);
- return -1;
- break;
- case CR_SERVER_LOST:
- if (*retry > 0) {
- (*retry)--;
- return 0;
- } else
- return -1;
- break;
- default:
- my_errstmt(jpstmt, source, line);
- return -1;
- break;
- }
-}
-
-
-int glite_jp_db_connect(glite_jp_context_t ctx,const char *cs)
-{
- char *buf = NULL;
- char *host,*user,*pw,*db;
- char *slash,*at,*colon;
- int ret;
-
- // needed for SQL result parameters
- assert(sizeof(int) >= sizeof(my_bool));
-
- glite_jp_clear_error(ctx);
-
- if (!cs) return JP_ERR(ctx, EINVAL, "connect string not specified");
-
- if (!(ctx->dbhandle = (void *) mysql_init(NULL))) return JP_ERR(ctx, ENOMEM, NULL);
-
- mysql_options(ctx->dbhandle, MYSQL_READ_DEFAULT_FILE, "my");
-
- host = user = pw = db = NULL;
-
- buf = strdup(cs);
- slash = strchr(buf,'/');
- at = strrchr(buf,'@');
- colon = strrchr(buf,':');
-
- if (!slash || !at || !colon) {
- free(buf);
- glite_jp_db_close(ctx);
- return JP_ERR(ctx, EINVAL, "Invalid DB connect string");
- }
-
- *slash = *at = *colon = 0;
- host = at+1;
- user = buf;
- pw = slash+1;
- db = colon+1;
-
- if (!mysql_real_connect((MYSQL *) ctx->dbhandle,host,user,pw,db,0,NULL,CLIENT_FOUND_ROWS)) {
- free(buf);
- ret = MY_ERR(ctx);
- glite_jp_db_close(ctx);
- return ret;
- }
- free(buf);
-
- if ((ret = glite_jp_db_dbcheckversion(ctx)) != 0) {
- glite_jp_db_close(ctx);
- return ret;
- }
-
- return 0;
-}
-
-
-void glite_jp_db_close(glite_jp_context_t ctx)
-{
- if (ctx->dbhandle) {
- mysql_close((MYSQL *) ctx->dbhandle);
- ctx->dbhandle = NULL;
- }
-}
-
-
-int glite_jp_db_execstmt(glite_jp_context_t ctx,const char *txt,glite_jp_db_stmt_t *stmt)
-{
- int merr;
- int retry_nr = 0;
- int do_reconnect = 0;
-
- glite_jp_clear_error(ctx);
-
- if (stmt) {
- *stmt = NULL;
- }
-
- while (retry_nr == 0 || do_reconnect) {
- do_reconnect = 0;
- if (mysql_query((MYSQL *) ctx->dbhandle,txt)) {
- /* error occured */
- switch (merr = mysql_errno((MYSQL *) ctx->dbhandle)) {
- case 0:
- break;
- case ER_DUP_ENTRY:
- JP_ERR(ctx, EEXIST, mysql_error((MYSQL *) ctx->dbhandle));
- return -1;
- break;
- case CR_SERVER_LOST:
- if (retry_nr <= 0)
- do_reconnect = 1;
- break;
- default:
- MY_ERR(ctx);
- return -1;
- break;
- }
- }
- retry_nr++;
- }
-
- if (stmt) {
- *stmt = malloc(sizeof(**stmt));
- if (!*stmt) {
- JP_ERR(ctx, ENOMEM, NULL);
- return -1;
- }
- memset(*stmt,0,sizeof(**stmt));
- (**stmt).ctx = ctx;
- (**stmt).result = mysql_store_result((MYSQL *) ctx->dbhandle);
- if (!(**stmt).result) {
- if (mysql_errno((MYSQL *) ctx->dbhandle)) {
- MY_ERR(ctx);
- return -1;
- }
- }
- } else {
- MYSQL_RES *r = mysql_store_result((MYSQL *) ctx->dbhandle);
- mysql_free_result(r);
- }
-
- return mysql_affected_rows((MYSQL *) ctx->dbhandle);
-}
-
-
-int glite_jp_db_fetchrow(glite_jp_db_stmt_t stmt,char **res)
-{
- MYSQL_ROW row;
- glite_jp_context_t ctx = stmt->ctx;
- int nr,i;
- unsigned long *len;
-
- glite_jp_clear_error(ctx);
-
- if (!stmt->result) return 0;
-
- if (!(row = mysql_fetch_row(stmt->result))) {
- if (mysql_errno((MYSQL *) ctx->dbhandle)) {
- MY_ERR(ctx);
- return -1;
- } else return 0;
- }
-
- nr = mysql_num_fields(stmt->result);
- len = mysql_fetch_lengths(stmt->result);
- for (i=0; i<nr; i++) res[i] = len[i] ? strdup(row[i]) : strdup("");
-
- return nr;
-}
-
-
-int glite_jp_db_querycolumns(glite_jp_db_stmt_t stmt,char **cols)
-{
- int i = 0;
- MYSQL_FIELD *f;
-
- while ((f = mysql_fetch_field(stmt->result))) cols[i++] = f->name;
- return i == 0;
-}
-
-
-void glite_jp_db_freestmt(glite_jp_db_stmt_t *stmt)
-{
- if (*stmt) {
- if ((**stmt).result) mysql_free_result((**stmt).result);
- if ((*stmt)->stmt) mysql_stmt_close((*stmt)->stmt);
- if ((*stmt)->params) glite_jp_db_destroy_params((*stmt)->params);
- if ((*stmt)->results) glite_jp_db_destroy_results((*stmt)->results);
- free(*stmt);
- *stmt = NULL;
- }
-}
-
-
-char *glite_jp_db_timetodb(time_t t)
-{
- struct tm *tm = gmtime(&t);
- char tbuf[256];
-
- /* XXX: the very end of our days */
- if (!tm && t == (time_t) LONG_MAX) return strdup("9999-12-31 23:59:59");
-
- sprintf(tbuf,"'%4d-%02d-%02d %02d:%02d:%02d'",tm->tm_year+1900,tm->tm_mon+1,
- tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec);
-
- return strdup(tbuf);
-}
-
-
-time_t glite_jp_db_dbtotime(const char *t)
-{
- struct tm tm;
-
- memset(&tm,0,sizeof(tm));
- setenv("TZ","UTC",1); tzset();
- sscanf(t,"%4d-%02d-%02d %02d:%02d:%02d",
- &tm.tm_year,&tm.tm_mon,&tm.tm_mday,
- &tm.tm_hour,&tm.tm_min,&tm.tm_sec);
- tm.tm_year -= 1900;
- tm.tm_mon--;
-
- return mktime(&tm);
-}
-
-
-int glite_jp_db_dbcheckversion(glite_jp_context_t ctx)
-{
- MYSQL *m = (MYSQL *) ctx->dbhandle;
- const char *ver_s = mysql_get_server_info(m);
- int major,minor,sub,version;
-
- glite_jp_clear_error(ctx);
-
- if (!ver_s || 3 != sscanf(ver_s,"%d.%d.%d",&major,&minor,&sub)) {
- return JP_ERR(ctx, EINVAL, "problem checking MySQL version");
- }
-
- version = 10000*major + 100*minor + sub;
-
- if (version < GLITE_JP_DB_MYSQL_VERSION) {
- char msg[300];
-
- return JP_ERR(ctx, EINVAL, msg);
- }
-
- return 0;
-}
-
-
-void glite_jp_db_create_params(void **params, int n, ...) {
- params_t *myparams;
- MYSQL_BIND *myparam;
- MYSQL_TIME **mytime;
- int i;
- va_list ap;
- glite_jp_db_type_t type;
-
- myparams = calloc(n, sizeof(params_t) + (n - 1) * sizeof(MYSQL_BIND));
- va_start(ap, n);
-
- for (i = 0; i < n; i++) {
- myparam = myparams->params + i;
- type = va_arg(ap, glite_jp_db_type_t);
-
- switch (type) {
- case GLITE_JP_DB_TYPE_TINYINT:
- myparam->buffer = va_arg(ap, char *);
- break;
-
- case GLITE_JP_DB_TYPE_INT:
- myparam->buffer = va_arg(ap, long int *);
- break;
-
- case GLITE_JP_DB_TYPE_TINYBLOB:
- case GLITE_JP_DB_TYPE_TINYTEXT:
- case GLITE_JP_DB_TYPE_BLOB:
- case GLITE_JP_DB_TYPE_TEXT:
- case GLITE_JP_DB_TYPE_MEDIUMBLOB:
- case GLITE_JP_DB_TYPE_MEDIUMTEXT:
- case GLITE_JP_DB_TYPE_LONGBLOB:
- case GLITE_JP_DB_TYPE_LONGTEXT:
- myparam->buffer = va_arg(ap, void *);
- myparam->length = va_arg(ap, unsigned long *);
- break;
-
- case GLITE_JP_DB_TYPE_VARCHAR:
- case GLITE_JP_DB_TYPE_CHAR:
- myparam->buffer = va_arg(ap, char *);
- myparam->length = va_arg(ap, unsigned long *);
- break;
-
- case GLITE_JP_DB_TYPE_DATE:
- case GLITE_JP_DB_TYPE_TIME:
- case GLITE_JP_DB_TYPE_DATETIME:
- case GLITE_JP_DB_TYPE_TIMESTAMP:
- mytime = (MYSQL_TIME **)va_arg(ap, void **);
- *mytime = calloc(1, sizeof(MYSQL_TIME));
- myparam->buffer = *mytime;
- break;
-
- case GLITE_JP_DB_TYPE_NULL:
- break;
-
- default:
- assert("unimplemented parameter assign" == NULL);
- break;
- }
- myparam->buffer_type = glite_to_mysql_type[type];
- }
- myparams->n = n;
-
- va_end(ap);
- *params = myparams;
-}
-
-
-void glite_jp_db_create_results(void **results, int n, ...) {
- params_t *myresults;
- MYSQL_BIND *myresult;
- MYSQL_TIME **mytime;
- va_list ap;
- int i;
- glite_jp_db_type_t type;
- int *is_null;
-
- myresults = calloc(n, sizeof(params_t) + (n - 1) * sizeof(MYSQL_BIND));
- va_start(ap, n);
-
- for (i = 0; i < n; i++) {
- myresult = myresults->params + i;
- type = va_arg(ap, glite_jp_db_type_t);
- is_null = va_arg(ap, int *);
- myresult->is_null = (my_bool *)is_null;
- if (is_null) *is_null = 0;
-
- switch(type) {
- case GLITE_JP_DB_TYPE_TINYINT:
- myresult->buffer = va_arg(ap, char *);
- myresult->buffer_length = sizeof(char);
- break;
-
- case GLITE_JP_DB_TYPE_INT:
- myresult->buffer = va_arg(ap, long int *);
- myresult->buffer_length = sizeof(long int);
- break;
-
- case GLITE_JP_DB_TYPE_TINYBLOB:
- case GLITE_JP_DB_TYPE_TINYTEXT:
- case GLITE_JP_DB_TYPE_BLOB:
- case GLITE_JP_DB_TYPE_TEXT:
- case GLITE_JP_DB_TYPE_MEDIUMBLOB:
- case GLITE_JP_DB_TYPE_MEDIUMTEXT:
- case GLITE_JP_DB_TYPE_LONGBLOB:
- case GLITE_JP_DB_TYPE_LONGTEXT:
- myresult->buffer = va_arg(ap, void *);
- myresult->buffer_length = va_arg(ap, unsigned long);
- myresult->length = va_arg(ap, unsigned long *);
- break;
-
- case GLITE_JP_DB_TYPE_VARCHAR:
- case GLITE_JP_DB_TYPE_CHAR:
- myresult->buffer = va_arg(ap, char *);
- myresult->buffer_length = va_arg(ap, unsigned long);
- myresult->length = va_arg(ap, unsigned long *);
- break;
-
- case GLITE_JP_DB_TYPE_DATE:
- case GLITE_JP_DB_TYPE_TIME:
- case GLITE_JP_DB_TYPE_DATETIME:
- case GLITE_JP_DB_TYPE_TIMESTAMP:
- mytime = (MYSQL_TIME **)va_arg(ap, void **);
- *mytime = calloc(1, sizeof(MYSQL_TIME));
- myresult->buffer = *mytime;
- break;
-
- default:
- assert("unimplemented result assign" == NULL);
- }
- myresult->buffer_type = glite_to_mysql_type[type];
- if (myresult->buffer && myresult->buffer_length) memset(myresult->buffer, 0, myresult->buffer_length);
- }
- myresults->n = n;
-
- va_end(ap);
- *results = myresults;
-}
-
-
-static void glite_jp_db_destroy_respam(params_t *params) {
- MYSQL_BIND *myparam;
- int i;
- enum enum_field_types type;
-
- for (i = 0; i < params->n; i++) {
- myparam = params->params + i;
- type = myparam->buffer_type;
- if (type == MYSQL_TYPE_DATE || type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_DATETIME || type == MYSQL_TYPE_TIMESTAMP) {
- free(myparam->buffer);
- myparam->buffer = NULL;
- }
- }
- free(params);
-}
-
-
-void glite_jp_db_destroy_params(void *params) {
- glite_jp_db_destroy_respam(params);
-}
-
-
-void glite_jp_db_destroy_results(void *results) {
- glite_jp_db_destroy_respam(results);
-}
-
-
-void glite_jp_db_set_time(void *buffer, const time_t time) {
- MYSQL_TIME *mybuffer;
- struct tm tm;
-
- mybuffer = (MYSQL_TIME *)buffer;
- gmtime_r(&time, &tm);
- mybuffer->year = tm.tm_year + 1900;
- mybuffer->month = tm.tm_mon + 1;
- mybuffer->day = tm.tm_mday;
- mybuffer->hour = tm.tm_hour;
- mybuffer->minute = tm.tm_min;
- mybuffer->second = tm.tm_sec;
-}
-
-
-time_t glite_jp_db_get_time(const void *buffer) {
- MYSQL_TIME *mybuffer;
- struct tm tm;
-
- mybuffer = (MYSQL_TIME *)buffer;
- memset(&tm, 0, sizeof(tm));
- tm.tm_year = mybuffer->year - 1900;
- tm.tm_mon = mybuffer->month - 1;
- tm.tm_mday = mybuffer->day;
- tm.tm_hour = mybuffer->hour;
- tm.tm_min = mybuffer->minute;
- tm.tm_sec = mybuffer->second;
-
- return mktime(&tm);
-}
-
-
-int glite_jp_db_rebind(glite_jp_db_stmt_t jpstmt, void *params, void *cols) {
- if (jpstmt->params) {
- glite_jp_db_destroy_params(jpstmt->params);
- jpstmt->params = NULL;
- }
- if (jpstmt->results) {
- glite_jp_db_destroy_results(jpstmt->results);
- jpstmt->results = NULL;
- }
- if (params) {
- jpstmt->params = (params_t *)params;
- if (mysql_stmt_bind_param(jpstmt->stmt, jpstmt->params->params) != 0) return MY_ERRSTMT(jpstmt);
- }
- if (cols) {
- jpstmt->results = (params_t *)cols;
- if (mysql_stmt_bind_result(jpstmt->stmt, jpstmt->results->params) != 0) return MY_ERRSTMT(jpstmt);
- }
-
- return 0;
-}
-
-
-int glite_jp_db_prepare(glite_jp_context_t ctx, const char *sql, glite_jp_db_stmt_t *jpstmt, void *params, void *cols) {
- int ret, retry;
-
- glite_jp_clear_error(ctx);
-
- // init
- *jpstmt = calloc(1, sizeof(struct _glite_jp_db_stmt_t));
- (*jpstmt)->ctx = ctx;
-
- // create the SQL command
- if (((*jpstmt)->stmt = mysql_stmt_init((MYSQL *)ctx->dbhandle)) == NULL) {
- ret = MY_ERRSTMT(*jpstmt);
- goto failed;
- }
-
- // prepare the SQL command
- retry = 1;
- do {
- mysql_stmt_prepare((*jpstmt)->stmt, sql, strlen(sql));
- ret = MY_ISOKSTMT(*jpstmt, &retry);
- } while (ret == 0);
- if (ret == -1) goto failed;
-
- // parameters and results
- if ((ret = glite_jp_db_rebind(*jpstmt, params, cols)) != 0) goto failed;
-
- return 0;
-
-failed:
- if (params) glite_jp_db_destroy_params(params);
- if (cols) glite_jp_db_destroy_params(cols);
- glite_jp_db_freestmt(jpstmt);
- return ctx->error->code;
-}
-
-
-int glite_jp_db_execute(glite_jp_db_stmt_t jpstmt) {
- glite_jp_context_t ctx;
- int ret, retry;
-
- ctx = jpstmt->ctx;
- glite_jp_clear_error(ctx);
-
- // run
- retry = 1;
- do {
- mysql_stmt_execute(jpstmt->stmt);
- ret = MY_ISOKSTMT(jpstmt, &retry);
- } while (ret == 0);
- if (ret == -1) goto failed;
-
- // result
- mysql_stmt_store_result(jpstmt->stmt);
- if (mysql_stmt_errno(jpstmt->stmt)) {
- MY_ERRSTMT(jpstmt);
- goto failed;
- }
-
- return mysql_stmt_affected_rows(jpstmt->stmt);
-
-failed:
- return -1;
-}
-
-
-int glite_jp_db_fetch(glite_jp_db_stmt_t jpstmt) {
- int ret, retry;
-
- glite_jp_clear_error(jpstmt->ctx);
-
- retry = 1;
- do {
- switch(mysql_stmt_fetch(jpstmt->stmt)) {
- case 0: ret = 1; break;
- case 1: ret = MY_ISOKSTMT(jpstmt, &retry); break;
- case MYSQL_NO_DATA: JP_ERR(jpstmt->ctx, ENODATA, "no more rows"); ret = -1; break;
- default: JP_ERR(jpstmt->ctx, EIO, "other fetch error"); ret = -1; break;
- }
- } while (ret == 0);
- if (ret == -1) goto failed;
-
- return 0;
-
-failed:
- return jpstmt->ctx->error->code;
-}
+++ /dev/null
-.project
-.cdtproject
\ No newline at end of file
+++ /dev/null
-LICENSE file for EGEE Middleware
-================================
-
-Copyright (c) 2004 on behalf of the EU EGEE Project:
-The European Organization for Nuclear Research (CERN),
-Istituto Nazionale di Fisica Nucleare (INFN), Italy
-Datamat Spa, Italy
-Centre National de la Recherche Scientifique (CNRS), France
-CS Systeme d'Information (CSSI), France
-Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
-Universiteit van Amsterdam (UvA), Netherlands
-University of Helsinki (UH.HIP), Finlan
-University of Bergen (UiB), Norway
-Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-3. The end-user documentation included with the redistribution, if
-any, must include the following acknowledgment: "This product includes
-software developed by The EU EGEE Project (http://cern.ch/eu-egee/)."
-Alternatively, this acknowledgment may appear in the software itself, if
-and wherever such third-party acknowledgments normally appear.
-
-4. The names EGEE and the EU EGEE Project must not be
-used to endorse or promote products derived from this software without
-prior written permission. For written permission, please contact
-<email address>.
-
-5. You are under no obligation whatsoever to provide anyone with any
-bug fixes, patches, or upgrades to the features, functionality or
-performance of the Software ("Enhancements") that you may develop over
-time; however, if you choose to provide your Enhancements to The EU
-EGEE Project, or if you choose to otherwise publish or distribute your
-Enhancements, in source code form without contemporaneously requiring
-end users of The EU EGEE Proejct to enter into a separate written license
-agreement for such Enhancements, then you hereby grant The EU EGEE Project
-a non-exclusive, royalty-free perpetual license to install, use, copy,
-modify, prepare derivative works, incorporate into the EGEE Middleware
-or any other computer software, distribute, and sublicense your
-Enhancements or derivative works thereof, in binary and source code
-form (if any), whether developed by The EU EGEE Project or third parties.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-This software consists of voluntary contributions made by many
-individuals on behalf of the EU EGEE Prject. For more information on The
-EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on
-EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/
-
-
+++ /dev/null
-# Default values
-top_srcdir=.
-builddir=build
-top_builddir=${top_srcdir}/${builddir}
-stagedir=.
-distdir=.
-globalprefix=glite
-package=glite-jp-ws-interface
-version=0.0.0
-PREFIX=/opt/glite
-
--include Makefile.inc
-
-VPATH=${top_srcdir}/interface:${top_srcdir}/src
-STAGETO=interface
-
-XSLTPROC=xsltproc
-XMLLINT:=xmllint
-docbookxls:=http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
-
-WSDL=JobProvenancePS.wsdl JobProvenanceIS.wsdl JobProvenanceTypes.wsdl
-
-all compile: ${WSDL}
-
-check:
- @echo No unit test required for interface-only module.
-
-stage: ${WSDL}
- $(MAKE) install PREFIX=${stagedir}
-
-dist: distsrc distbin
-
-distsrc:
- mkdir -p ${top_srcdir}/${package}-${version}
- cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version}
- cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version}
- rm -rf ${top_srcdir}/${package}-${version}
-
-distbin:
- $(MAKE) install PREFIX=${top_srcdir}/tmpbuilddir
- cd ${top_srcdir}/tmpbuilddir && tar -czf ${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *
- rm -rf ${top_srcdir}/tmpbuilddir
-
-install:
- -mkdir -p ${PREFIX}/${STAGETO}
- -mkdir -p ${PREFIX}/share/doc/${package}-${version}
- install -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version}
-# cd ${top_srcdir}/interface && install -m 644 ${WSDL} ${PREFIX}/${STAGETO}
- install -m 644 ${WSDL} ${PREFIX}/${STAGETO}
-
-clean:
- rm -f *.h
-
-%.wsdl: %.xml
- ${XSLTPROC} ../src/puke-wsdl.xsl $< >$@
-
-JobProvenancePS.html: doc.xml JobProvenancePS.xml JobProvenanceTypes.xml puke-ug.xsl
- ${XSLTPROC} --novalid ../src/puke-ug.xsl $< >doc-html.xml
- ${XMLLINT} --valid --noout doc-html.xml
- ${XSLTPROC} --stringparam chapter.autolabel 0 ${docbookxls} doc-html.xml >$@
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Build file for the GLite jp ws-interface component
-
- Authors: Joachim Flammer <Joachim.Flammer@Cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.1.1.1 2004/12/10 09:32:29 akrenek
-
-
- Revision 1.5 2004/07/20 16:08:30 flammer
- Changed incorrect my_... instead of .._template entries for subsystem and component.
-
- Revision 1.4 2004/07/16 16:32:53 flammer
- Added comment where to add language target.
-
- Revision 1.3 2004/07/16 14:56:55 flammer
- Corrected input path of build.properties.
-
- Revision 1.2 2004/07/06 20:43:19 flammer
- Update of configure & targets.
-
- Revision 1.1.1.1 2004/06/18 12:40:17 flammer
- Added general component template.
-
-
--->
-
-<project name="ws-interface" default="dist">
-
- <!-- ==============================================
- Builds the GLite jp ws-interface component
- ============================================== -->
-
- <!-- =========================================
- Import properties (order is important)
- ========================================= -->
-
- <!-- Import baseline properties & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- import component build properties,
- component properties &
- component common properties -->
- <import file="./project/properties.xml"/>
-
- <!-- import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="${subsystem.properties.file}"/>
-
- <!-- import global build properties &
- global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependency property files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${component.dependencies.file}" />
- <property file="${subsystem.dependencies.file}" />
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configuration definitions (order is important)
- ========================================= -->
- <import file="${global.configure.options.file}"/>
- <import file="${component.configure.options.file}"/>
-
- <!-- =========================================
- Import task definitions (order is important)
- ========================================= -->
- <import file="${subsystem.taskdefs.file}" />
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Load common targets
- ========================================= -->
- <!-- Put your language target (java/c++-ant/c++-autotool/perl) here -->
- <import file="${global.targets-simple_make.file}" />
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ==============================================
- Local private targets
- ============================================== -->
-
- <target name="localinit"
- description="Module specific initialization tasks">
- <antcall target="lbmakefiles" />
- </target>
-
- <target name="localcompile"
- description="Module specific compile tasks">
- </target>
-
- <target name="localclean"
- description="Module specific cleaning tasks">
- </target>
-
-</project>
+++ /dev/null
-#Sat Oct 15 06:46:41 CEST 2005
-module.build=36
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Configuration build properties file for the GLite jp ws-interface component
-
- Authors: Joachim Flammer <Joachim.Flammer@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.3 2004/07/20 16:08:30 flammer
- Changed incorrect my_... instead of .._template entries for subsystem and component.
-
- Revision 1.2 2004/07/16 14:56:55 flammer
- Corrected input path of build.properties.
-
- Revision 1.1 2004/07/06 20:43:19 flammer
- Update of configure & targets.
-
-
-
--->
-<project name="jp ws-interface component configuration properties">
-
-<target name="lbmakefiles">
- <exec executable="ln" failonerror="true">
- <arg line="-fs ${component.dir}/Makefile ${module.build.dir}/Makefile"/>
- </exec>
- <echo file="${module.build.dir}/Makefile.inc">
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-jpprefix=${subsystem.prefix}
-package=${module.package.name}
-PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
- </echo>
- </target>
-</project>
+++ /dev/null
-Summary:Change me !!!
-Name:glite-jp-ws-interface
-Version:1.0.0
-Release:0_U200510112245
-Copyright:Open Source EGEE License
-Vendor:EU EGEE project
-Group:System/Application
-Prefix:/opt/glite
-BuildArch:i386
-BuildRoot:%{_builddir}/%{name}-%{version}
-Source:glite-jp-ws-interface-1.0.0_bin.tar.gz
-
-%define debug_package %{nil}
-
-%description
-Change me !!!
-
-%prep
-
-
-%setup -c
-
-%build
-
-
-%install
-
-
-%clean
-
-%pre
-%post
-%preun
-%postun
-%files
-%defattr(-,root,root)
-%{prefix}/interface/JobProvenancePS.wsdl
-%{prefix}/interface/JobProvenanceIS.wsdl
-%{prefix}/interface/JobProvenanceTypes.wsdl
-%{prefix}/share/doc/glite-jp-ws-interface-1.0.0/LICENSE
-
-%changelog
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Common build properties file for the GLite jp ws-interface component
-
- Authors: Joachim Flammer <Joachim.Flammer@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.4 2004/07/20 16:08:30 flammer
- Changed incorrect my_... instead of .._template entries for subsystem and component.
-
- Revision 1.3 2004/07/16 14:56:55 flammer
- Corrected input path of build.properties.
-
- Revision 1.2 2004/07/16 14:36:49 flammer
-
- Corrected build.properties include.
-
- Revision 1.1.1.1 2004/06/18 12:40:17 flammer
- Added general component template.
-
-
--->
-
-<project name="jp ws-interface component common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property file="project/build.properties" />
-
- <!-- ======================================================
- Define corresponding subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${jp.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${jp.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define component properties
- ====================================================== -->
-
- <!-- Component name prefix -->
- <property name="component.prefix" value="ws-interface" />
-
- <!-- ======================================================
- Define general component properties
- ====================================================== -->
-
- <import file="${component.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
-
-</project>
+++ /dev/null
-module.version=1.1.0
-module.age=0
+++ /dev/null
-<service name="JobProvenanceIS"
- ns="http://glite.org/wsdl/services/jp"
- prefix="jp"
- typeNs="http://glite.org/wsdl/types/jp"
- typePrefix="jpt"
- elemNs="http://glite.org/wsdl/elements/jp"
- elemPrefix="jpe"
- xmlns:jpt="http://glite.org/wsdl/types/jp">
-
- <version>CVS revision: <![CDATA[ $Header$ ]]></version>
-
- <import namespace="http://glite.org/wsdl/services/jp" location="JobProvenanceTypes.wsdl"/>
-
- <fault name="genericFault"/>
-
- <operations>
-
- <!-- System operations -->
- <op name="UpdateJobs">
- Called by JP primary storage as a response to FeedIndex request.
- Updates information on jobs in index server, according to what JPPS
- currently knows.
- <input name="feedId" type="xsd:string">Id of the feed, as returned by JPPS FeedIndex operation.</input>
- <input name="feedDone" type="xsd:boolean">Flag of completed batch feed.</input>
- <input name="jobAttributes" type="jobRecord" list="yes">Attributes per job.</input>
-
- <fault name="genericFault" type="genericFault">Any error.</fault>
- </op>
-
- <!-- User operations -->
- <op name="QueryJobs">
- User query to index server.
- <input name="conditions" type="indexQuery" list="yes">
- Query conditions, similar to LB.
- </input>
- <input name="attributes" type="xsd:string" list="yes" optional="yes">
- Set of attributes to be retrieved directly from index server (if any).
- </input>
- <output name="jobs" type="jobRecord" list="yes">
- List of jobs matching the query.
- </output>
- <fault name="genericFault" type="genericFault">Any error.</fault>
- </op>
-
- <!-- Admin operations -->
- <op name="AddFeed">
- Called by JP index serve admin tool to ask new primary storage server to feed it.
- Updates information on PS in index server, according to what JPPS
- currently knows.
- <input name="feed" type="feedSession">
- New feed IS URL, filter and query type.
- </input>
- <fault name="genericFault" type="genericFault">Any error.</fault>
- </op>
- <op name="GetFeedIDs">
- Called by JP index serve admin tool to find out IS open feeds
- <input name="feeds" type="feedSession" list="yes">
- List of active feeds on IS.
- </input>
- <fault name="genericFault" type="genericFault">Any error.</fault>
- </op>
- <op name="DeleteFeed">
- Called by JP index serve admin tool to remove one feed session.
- <input name="feedId" type="xsd:string">
- ID of feed to be removed.
- </input>
- <fault name="genericFault" type="genericFault">Any error.</fault>
- </op>
- </operations>
-</service>
+++ /dev/null
-<service name="JobProvenancePS"
- ns="http://glite.org/wsdl/services/jp"
- prefix="jp"
- typeNs="http://glite.org/wsdl/types/jp"
- typePrefix="jpt"
- elemNs="http://glite.org/wsdl/elements/jp"
- elemPrefix="jpe"
- xmlns:jpt="http://glite.org/wsdl/types/jp">
-
- <version>CVS revision: <![CDATA[ $Header$ ]]></version>
-
- <import namespace="http://glite.org/wsdl/services/jp" location="JobProvenanceTypes.wsdl"/>
-
- <doc>
- <para>
- The Job Provenance (JP) Primary Storage Service is responsible
- to keep the JP data
- (definition of submitted jobs, execution conditions and environment,
- and important points of the job life cycle) in a compact and
- economic form.
- </para>
-
- <para>
- The JP Primary storage, as described in section 8.4 of
- the
- <ulink url="https://edms.cern.ch/document/594698/">
- Architecture deliverable DJRA1.1
- </ulink>
- provides public interfaces for data storing,
- retrieval based on basic metadata, and registration of Index servers for
- incremental feed.
- </para>
-
- <para>
- Command interface to JP is completely covered by the WS interface covered here.
- Bulk file transfers are done via specialised protocols, currently gsiftp only.
- </para>
- </doc>
-
- <fault name="genericFault"/>
-
- <operations>
- <op name="RegisterJob">
- Register job with the JP primary storage.
- <input name="job" type="xsd:string">Jobid of the registered job.</input>
- <input name="owner" type="xsd:string">Owner of the job (DN of X509 certificate).</input>
- <fault name="genericFault" type="genericFault">Any error.</fault>
- </op>
-
- <op name="StartUpload">
- Start uploading a file.
- <input name="job" type="xsd:string">Jobid to which this file is related.</input>
- <input name="class" type="xsd:string">
- Type of the file (URI). The server must have a plugin handing this type.
- </input>
- <input name="name" type="xsd:string">Name of the file (used to distinguish among more files of the same type).</input>
- <input name="commitBefore" type="xsd:dateTime">The client promisses to finish the upload before this time.</input>
- <input name="contentType" type="xsd:string">MIME type of the file.</input>
- <output name="destination" type="xsd:string">URL where the client should upload the file.</output>
- <output name="commitBefore" type="xsd:dateTime">Server's view on when the upload must be finished.</output>
- <fault name="genericFault" type="genericFault">Any error.</fault>
- </op>
-
- <op name="CommitUpload">
- Confirm a successfully finished file apload.
- <input name="destination" type="xsd:string">Destination URL returned by StartUpload before.</input>
- <fault name="genericFault" type="genericFault">Any error.</fault>
- </op>
-
- <op name="RecordTag">
- Record an additional user tag.
- <input name="jobid" type="xsd:string">Job to which the tag is added.</input>
- <input name="tag" type="tagValue">Name and value of the tag.</input>
- <fault name="genericFault" type="genericFault">Any error.</fault>
- </op>
-
- <op name="FeedIndex">
- Request for feeding a JP Index server (issued by this server).
- <input name="destination" type="xsd:string">Endpoint of the listening index server.</input>
- <input name="attributes" type="xsd:string" list="yes">Which attributes of jobs is the index server interested in.</input>
- <input name="conditions" type="primaryQuery" list="yes">Which jobs is the server interested in.</input>
- <input name="history" type="xsd:boolean">Data on jobs stored at PS in the past are required.</input>
- <input name="continuous" type="xsd:boolean">Data on jobs that will arrive in future are required.</input>
- <output name="feedId" type="xsd:string">Unique ID of the created feed session.</output>
- <output name="feedExpires" type="xsd:dateTime">When the session expires.</output>
- <fault name="genericFault" type="genericFault">Any error.</fault>
- </op>
-
- <op name="FeedIndexRefresh">
- Refresh an existing feed session.
- <input name="feedId" type="xsd:string">Existing feed session ID to be refreshed.</input>
- <output name="feedExpires" type="xsd:dateTime">New session expiration time.</output>
- <fault name="genericFault" type="genericFault">Any error.</fault>
- </op>
-
- <op name="GetJobFiles">
- Return URL's of files for a given single job.
- <input name="jobid" type="xsd:string">The job.</input>
- <output name="files" type="jppsFile" list="yes" optional="yes">List of the stored files.</output>
- <fault name="genericFault" type="genericFault">Any error.</fault>
- </op>
-
- <op name="GetJobAttributes">
- Query concrete attributes of a given job.
- <input name="jobid" type="xsd:string">The job.</input>
- <input name="attributes" type="xsd:string" list="yes">Which attributes should be retrieved.</input>
- <output name="attrValues" type="attrValue" list="yes">Values of the queried attributes.</output>
- <fault name="genericFault" type="genericFault">Any error.</fault>
- </op>
- </operations>
-
-</service>
+++ /dev/null
-<?xml version="1.0"?>
-
-<service name="JobProvenanceTypes"
- ns="http://glite.org/wsdl/services/jp"
- typePrefix="jpt">
-
- <version>CVS revision: <![CDATA[ $Header$ ]]></version>
-
- <types ns="http://glite.org/wsdl/types/jp">
-
- <enum name="queryOp">
- Operators used in queries. Most are self-explanatory.
- <val name="EQUAL"></val>
- <val name="UNEQUAL"></val>
- <val name="LESS"></val>
- <val name="GREATER"></val>
- <val name="WITHIN">The attribute is between two specified values.</val>
- <val name="EXISTS">The attribute exists (even having a NULL value).</val>
- </enum>
-
- <struct name="tagValue">
- A single user-recorded value for a job attribute.
- <elem name="name" type="xsd:string">Name of the attribute, including namespace.</elem>
- <elem name="value" type="stringOrBlob" optional="yes">Value.</elem>
- </struct>
-
- <struct name="genericFault" fault="yes">
- <elem name="source" type="xsd:string"></elem>
- <elem name="code" type="xsd:int"></elem>
- <elem name="text" type="xsd:string"></elem>
- <elem name="description" type="xsd:string" optional="yes"></elem>
- <elem name="reason" type="genericFault" optional="yes"></elem>
- </struct>
-
- <struct name="primaryQuery">
- A single condition on job.
- <elem name="attr" type="xsd:string">Attribute name to query.</elem>
- <elem name="op" type="queryOp">Operation.</elem>
- <elem name="origin" type="attrOrig" optional="yes">Where the attribute value came from.</elem>
- <elem name="value" type="stringOrBlob">Value to compare the job attribute with.</elem>
- <elem name="value2" type="stringOrBlob" optional="yes">Another value (for op = WITHIN).</elem>
- </struct>
-
- <struct name="feedSession">
- One session between IS and PS (aka feed) charactetristics.
- <elem name="primaryServer" type="xsd:string">URL of primary server.</elem>
- <elem name="condition" type="primaryQuery" list="yes">Filter conditions.</elem>
- <elem name="history" type="xsd:int">Query type.</elem>
- <elem name="continuous" type="xsd:int">Query type</elem>
- <elem name="feedId" type="xsd:string" optional="yes">Unique ID of the feed session.</elem>
- </struct>
-
- <struct name="jppsFile">
- JP primary storage file identification.
- <elem name="class" type="xsd:string">Type of the file (as set on StartUpload).</elem>
- <elem name="name" type="xsd:string">Name of the file (if there are more of the same type per job).</elem>
- <elem name="url" type="xsd:string">Where the file is stored on JP primary storage.</elem>
- </struct>
-
- <struct name="attrValue">
- Single value of an attribute.
- <elem name="name" type="xsd:string">Name of the attribute, including namespace.</elem>
- <elem name="value" type="stringOrBlob" optional="yes">String value.</elem>
- <elem name="timestamp" type="xsd:dateTime">When this value was recorded.</elem>
- <elem name="origin" type="attrOrig">Where this value came from.</elem>
- <elem name="originDetail" type="xsd:string" optional="yes"></elem>
- </struct>
-
- <choice name="stringOrBlob">
- <elem name="string" type="xsd:string">String value.</elem>
- <elem name="blob" type="xsd:base64Binary">Binary value.</elem>
- </choice>
-
- <enum name="attrOrig">
- Specification of attribute origin.
- <val name="SYSTEM">JP system value, e.g. job owner.</val>
- <val name="USER">Explicitely stored by the user via RecordTag operation.</val>
- <val name="FILE">Coming from uploaded file.</val>
- </enum>
-
- <struct name="jobRecord">
- Information on a single job.
- Used for both feeding JP index server from primary storage
- and to answer user queries on index server.
- <elem name="jobid" type="xsd:string">ID of the job.</elem>
- <elem name="owner" type="xsd:string">Job owner.</elem>
- <elem name="attributes" type="attrValue" optional="yes" list="yes">
- Attribute values, required by query/feed and available right now.
- </elem>
- <elem name="primaryStorage" type="xsd:string" list="yes" optional="yes">
- User query only: which primary storage(s) have data on this job.
- </elem>
- <elem name="remove" type="xsd:boolean" optional="yes">
- UpdateJobs only: this job no longer belongs to the feed.
- Attribute values are those which caused the change.
- </elem>
- </struct>
-
- <struct name="indexQuery">
- Single query condition on a job.
- Similarly to LB, these outer conditions are logically ANDed.
- <elem name="attr" type="xsd:string">
- Which attribute the condition refers to.
- </elem>
- <elem name="origin" optional="yes" type="attrOrig">
- Specific attribute origin (if we do care).
- </elem>
- <elem name="record" list="yes" type="indexQueryRecord">
- List of conditions on attribute attr.
- These conditions are logically ORed.
- </elem>
- </struct>
-
- <struct name="indexQueryRecord">
- Single condition on an attribute.
- <elem name="op" type="queryOp">Query operation.</elem>
- <elem name="value" type="stringOrBlob" optional="yes">Value to compare attribute with.</elem>
- <elem name="value2" type="stringOrBlob" optional="yes">Value to compare attribute with.</elem>
- </struct>
-
- <list name="string"/>
- </types>
-
-</service>
-
+++ /dev/null
-<?xml version="1.0"?>
-<book/>
+++ /dev/null
-<?xml version="1.0"?>
-
-<!-- $Header$ -->
-
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
-<xsl:output indent="yes" doctype-public="-//OASIS//DTD DocBook XML V4.4//EN"
- doctype-system="http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"/>
-
-<xsl:template match="book">
- <chapter>
- <title><xsl:value-of select="document('JobProvenancePS.xml')/service/@name"/></title>
-
- <sect1>
- <title>Overview</title>
- <xsl:copy-of select="document('JobProvenancePS.xml')/service/doc/*"/>
- </sect1>
-
- <sect1>
- <title>Operations</title>
- <para> <emphasis><xsl:value-of select="document('JobProvenancePS.xml')/service/version"/></emphasis> </para>
- <!-- xsl:apply-templates select="operations/op" -->
- <xsl:apply-templates select="document('JobProvenancePS.xml')/service/operations/op">
- <xsl:sort select="@name"/>
- </xsl:apply-templates>
- </sect1>
-
- <sect1>
- <title>Types</title>
- <!--xsl:apply-templates select="types"/ -->
- <para> <emphasis><xsl:value-of select="document('JobProvenanceTypes.xml')/service/version"/></emphasis> </para>
- <xsl:apply-templates select="document('JobProvenanceTypes.xml')/service/types"/>
- </sect1>
- </chapter>
-</xsl:template>
-
-
-<xsl:template match="input|output|fault">
- <varlistentry>
- <term>
- <!--type-->
- <xsl:if test = "@list = 'yes'">list of </xsl:if>
- <xsl:choose>
- <xsl:when test="not(starts-with(@type,'xsd:'))">
- <link linkend="type:{@type}">
- <type><xsl:value-of select="@type "/> </type> </link>
- </xsl:when>
- <xsl:otherwise><type><xsl:value-of select="@type "/> </type> </xsl:otherwise>
- </xsl:choose>
- <!--/type-->
- <parameter> <xsl:value-of select=" @name"/></parameter>
- </term>
- <listitem>
- <simpara><xsl:value-of select="text()"/></simpara>
- </listitem>
- </varlistentry>
-</xsl:template>
-
-<xsl:template match="op" >
- <sect2 id="op:{@name}">
- <title><xsl:value-of select="@name"/></title>
- <para><xsl:value-of select="text()"/></para>
- <para>
- Inputs:
- <xsl:choose>
- <xsl:when test="count(./input)>0">
- <variablelist>
- <xsl:apply-templates select="./input"/>
- </variablelist>
- </xsl:when>
- <xsl:otherwise>N/A</xsl:otherwise>
- </xsl:choose>
- </para>
- <para>
- Outputs:
- <xsl:choose>
- <xsl:when test="count(./output)>0">
- <variablelist>
- <xsl:apply-templates select="./output"/>
- </variablelist>
- </xsl:when>
- <xsl:otherwise>N/A</xsl:otherwise>
- </xsl:choose>
- </para>
- </sect2>
-</xsl:template>
-
-<xsl:template match="types">
- <xsl:for-each select="flags|enum|struct|choice">
- <xsl:sort select="@name"/>
- <sect2 id="type:{@name}">
- <title> <xsl:value-of select="@name"/> </title>
- <para> <xsl:value-of select="text()"/> </para>
- <xsl:choose>
- <xsl:when test="name(.)='struct'">
- <para> <emphasis>Structure</emphasis> (sequence complex type in WSDL)</para>
- <para> Fields: ( <type>type </type> <structfield>name</structfield> description )</para>
- </xsl:when>
- <xsl:when test="name(.)='choice'">
- <para> <emphasis>Union</emphasis> (choice complex type in WSDL)</para>
- <para> Fields: ( <type>type </type> <structfield>name</structfield> description )</para>
- </xsl:when>
- <xsl:when test="name(.)='enum'">
- <para> <emphasis>Enumeration</emphasis> (restriction of xsd:string in WSDL),
- exactly one of the values must be specified.
- </para>
- <para> Values: </para>
- </xsl:when>
- <xsl:when test="name(.)='flags'">
- <para> <emphasis>Flags</emphasis> (sequence of restricted xsd:string in WSDL),
- any number of values can be specified together.
- </para>
- <para> Values: </para>
- </xsl:when>
- </xsl:choose>
- <variablelist>
- <xsl:for-each select="elem|val">
- <varlistentry>
- <term>
- <xsl:choose>
- <xsl:when test="name(.)='elem'">
- <xsl:if test="@list = 'yes'">list of </xsl:if>
- <xsl:choose>
- <xsl:when test="@type!='string' and @type!='int' and not(starts-with(@type,'xsd:'))">
- <link linkend="type:{@type}">
- <type><xsl:value-of select="@type "/> </type>
- </link>
- </xsl:when>
- <xsl:otherwise><type><xsl:value-of select="@type "/></type></xsl:otherwise>
- </xsl:choose>
- <!-- <type><xsl:value-of select="@type"/></type> -->
- <xsl:value-of select="' '"/>
- <structfield><xsl:value-of select="@name"/></structfield>
- </xsl:when>
- <xsl:otherwise>
- <constant><xsl:value-of select="@name"/></constant>
- </xsl:otherwise>
- </xsl:choose>
- </term>
- <listitem>
- <simpara>
- <xsl:if test="@optional = 'yes'"> (optional) </xsl:if>
- <!-- <xsl:if test="@list = 'yes'"> (multiple occurence) </xsl:if> -->
- <xsl:value-of select=" text()"/>
- </simpara>
- </listitem>
- </varlistentry>
- </xsl:for-each>
- </variablelist>
- </sect2>
- </xsl:for-each>
-</xsl:template>
-
-
-</xsl:stylesheet>
+++ /dev/null
-<?xml version="1.0"?>
-
-<xsl:stylesheet version="1.0"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
-
- xmlns:jp="http://glite.org/wsdl/services/jp"
- xmlns:jpe="http://glite.org/wsdl/elements/jp"
- xmlns:jpt="http://glite.org/wsdl/types/jp">
-
-<xsl:output indent="yes"/>
-
-<xsl:template match="/service">
- <definitions
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- name="{@name}"
- targetNamespace="{@ns}">
- <documentation>
- <xsl:value-of select="version"/>
- <xsl:value-of select="text()"/>
- </documentation>
-
- <xsl:apply-templates select="import"/>
-
- <xsl:apply-templates select="types"/>
-
-<!-- <xsl:apply-templates select="fault"/> -->
-
- <xsl:apply-templates select="operations"/>
-
- </definitions>
-</xsl:template>
-
-<xsl:template match="types">
- <wsdl:types>
- <xsd:schema targetNamespace="{@ns}"
- elementFormDefault="unqualified"
- attributeFormDefault="unqualified">
-
- <xsl:apply-templates/>
- </xsd:schema>
- </wsdl:types>
- <!-- <xsl:apply-templates select="struct[@fault='yes']" mode="message"/> -->
-</xsl:template>
-
-<!--
-<xsl:template match="simple">
- <xsd:element name="{@name}" type="xsd:{@name}"/>
- <xsd:complexType name="{@name}List">
- <xsd:sequence>
- <xsd:element name="{@name}" type="xsd:{@name}" minOccurs="0" maxOccurs="unbounded"></xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:element name="{@name}List" type="{/service/@typePrefix}:{@name}List"/>
-</xsl:template>
-
-<xsl:template match="list">
- <xsd:complexType name="{@name}List">
- <xsd:sequence>
- <xsd:element name="{@name}" type="xsd:{@name}" minOccurs="0" maxOccurs="unbounded"></xsd:element>
- </xsd:sequence>
- </xsd:complexType>
-</xsl:template>
--->
-
-<xsl:template match="enum">
- <xsd:simpleType name="{@name}">
- <xsd:restriction base="xsd:string">
- <xsl:for-each select="val"><xsd:enumeration value="{@name}"/></xsl:for-each>
- </xsd:restriction>
- </xsd:simpleType>
-<!-- <xsd:element name="{@name}" type="{/service/@typePrefix}:{@name}"/> -->
-</xsl:template>
-
-<xsl:template match="flags">
- <xsd:simpleType name="{@name}Value">
- <xsd:restriction base="xsd:string">
- <xsl:for-each select="val"><xsd:enumeration value="{@name}"/></xsl:for-each>
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:complexType name="{@name}">
- <xsd:sequence>
- <xsd:element name="flag" type="{/service/@typePrefix}:{@name}Value" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-<!-- <xsd:element name="{@name}" type="{/service/@typePrefix}:{@name}"/> -->
-</xsl:template>
-
-<xsl:template match="struct">
- <xsd:complexType name="{@name}">
- <xsd:sequence>
- <xsl:call-template name="inner-struct"/>
- </xsd:sequence>
- </xsd:complexType>
-</xsl:template>
-
-<xsl:template match="choice">
- <xsd:complexType name="{@name}">
- <xsd:choice>
- <xsl:call-template name="inner-struct"/>
- </xsd:choice>
- </xsd:complexType>
-</xsl:template>
-
-
-<xsl:template name="inner-struct">
- <xsl:variable name="nillable">
- <xsl:choose>
- <xsl:when test="local-name(.)='choice'">true</xsl:when>
- <xsl:otherwise>false</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:for-each select="elem">
- <xsl:variable name="type">
- <xsl:choose>
- <xsl:when test="contains(@type,':')">
- <xsl:value-of select="@type"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="/service/@typePrefix"/>:<xsl:value-of select="@type"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="min">
- <xsl:choose>
- <xsl:when test="@optional='yes'">0</xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="max">
- <xsl:choose>
- <xsl:when test="@list='yes'">unbounded</xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsd:element name="{@name}" type="{$type}" minOccurs="{$min}" maxOccurs="{$max}" nillable="{$nillable}"/>
- </xsl:for-each>
-<!--
- <xsd:complexType name="{@name}List">
- <xsd:sequence>
- <xsd:element name="{@name}" type="{/service/@typePrefix}:{@name}" minOccurs="0" maxOccurs="unbounded"></xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:element name="{@name}" type="{/service/@typePrefix}:{@name}"/>
- <xsd:element name="{@name}List" type="{/service/@typePrefix}:{@name}List"/>
--->
-</xsl:template>
-
-<xsl:template match="op" mode="message">
- <wsdl:message name="{@name}Request">
- <wsdl:part name="input" element="{/service/@elemPrefix}:{@name}">
- <wsdl:documentation><xsl:value-of select="text()"/></wsdl:documentation>
- </wsdl:part>
- </wsdl:message>
- <wsdl:message name="{@name}Response">
- <wsdl:part name="output" element="{/service/@elemPrefix}:{@name}Response">
- <wsdl:documentation><xsl:value-of select="text()"/></wsdl:documentation>
- </wsdl:part>
- </wsdl:message>
-</xsl:template>
-
-<xsl:template match="op" mode="element">
- <xsd:element name="{@name}">
- <xsd:complexType>
- <xsd:sequence>
- <xsl:for-each select="input">
- <xsl:variable name="prefix">
- <xsl:choose>
- <xsl:when test="starts-with(@type,'xsd:')"/>
- <xsl:otherwise><xsl:value-of select="/service/@typePrefix"/>:</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="max">
- <xsl:choose>
- <xsl:when test="@list='yes'">unbounded</xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsd:element name="{@name}" type="{$prefix}{@type}" minOccurs="1" maxOccurs="{$max}"/>
- </xsl:for-each>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="{@name}Response">
- <xsd:complexType>
- <xsd:sequence>
- <xsl:for-each select="output">
- <xsl:variable name="prefix">
- <xsl:choose>
- <xsl:when test="starts-with(@type,'xsd:')"/>
- <xsl:otherwise><xsl:value-of select="/service/@typePrefix"/>:</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="max">
- <xsl:choose>
- <xsl:when test="@list='yes'">unbounded</xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsd:element name="{@name}" type="{$prefix}{@type}" minOccurs="1" maxOccurs="{$max}"/>
- </xsl:for-each>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-</xsl:template>
-
-
-<xsl:template match="struct[@fault='yes']" mode="message">
- <wsdl:message name="{@name}">
- <wsdl:part name="{@name}" element="{/service/@typePrefix}:{@name}">
- <wsdl:documentation><xsl:value-of select="text()"/></wsdl:documentation>
- </wsdl:part>
- </wsdl:message>
-</xsl:template>
-
-<xsl:template match="op" mode="port-type">
- <wsdl:operation name="{@name}">
- <wsdl:documentation><xsl:value-of select="text()"/></wsdl:documentation>
- <wsdl:input name="i" message="{/service/@prefix}:{@name}Request"/>
- <wsdl:output name="o" message="{/service/@prefix}:{@name}Response"/>
- <wsdl:fault name="f" message="{/service/@prefix}:{fault/@name}"/>
- </wsdl:operation>
-</xsl:template>
-
-<xsl:template match="op" mode="binding">
- <wsdl:operation name="{@name}">
- <soap:operation style="document"/>
- <wsdl:input name="i">
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="o">
- <soap:body use="literal"/>
- </wsdl:output>
- <wsdl:fault name="f">
- <soap:fault name="f" use="literal"/>
- </wsdl:fault>
- </wsdl:operation>
-</xsl:template>
-
-<xsl:template match="import">
- <wsdl:import namespace="{@namespace}" location="{@location}"/>
-</xsl:template>
-
-<xsl:template match="operations">
- <wsdl:types>
- <xsd:schema targetNamespace="{/service/@elemNs}"
- elementFormDefault="unqualified"
- attributeFormDefault="unqualified">
-
- <xsl:apply-templates select="op" mode="element"/>
-
- <xsl:for-each select="/service/fault">
- <xsd:element name="{@name}" type="{/service/@typePrefix}:{@name}"/>
- </xsl:for-each>
- </xsd:schema>
- </wsdl:types>
-
- <xsl:apply-templates select="/service/fault"/>
-
- <xsl:apply-templates select="op" mode="message"/>
-
- <wsdl:portType name="{/service/@name}PortType">
- <xsl:apply-templates select="op" mode="port-type"/>
- </wsdl:portType>
-
- <binding name="{/service/@name}" type="{/service/@prefix}:{/service/@name}PortType">
- <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
- <xsl:apply-templates select="op" mode="binding"/>
- </binding>
-
- <service name="{/service/@name}">
- <documentation><xsl:value-of select="text()"/></documentation>
- <port name="{/service/@name}" binding="{/service/@prefix}:{/service/@name}">
- <soap:address location="http://test.glite.org/{/service/@prefix}:8080"/>
- </port>
-
- </service>
-
-</xsl:template>
-
-<xsl:template match="fault">
- <wsdl:message name="{@name}">
- <wsdl:part name="{@name}" element="{/service/@elemPrefix}:{@name}" />
- </wsdl:message>
-</xsl:template>
-
-
-</xsl:stylesheet>
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Build file for the GLite Middleware Job Provenance Subsystem
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.9 2005/10/11 20:37:50 akrenek
- added dependencies on lb.server-bones and security.gsoap-plugin
-
- Revision 1.8 2005/10/10 11:07:09 valtri
- Make autobuilds happy.
-
- Revision 1.7 2005/09/22 16:49:46 valtri
- More places with dependencies.
-
- Revision 1.6 2005/09/22 10:47:58 valtri
- jp.server-common dependency to build.xml too
-
- Revision 1.5 2005/05/26 15:13:22 zurek
- inserted module.build.file
-
- Revision 1.4 2004/12/17 20:26:46 dimeglio
- Removed index
-
- Revision 1.3 2004/12/10 09:46:41 akrenek
- included ws-interface
-
- Revision 1.2 2004/12/01 18:36:00 zsalvet
- Add component targets.
-
- Revision 1.1 2004/11/22 13:21:49 dimeglio
- First version of this file
-
--->
-
-<project name="jp" default="dist">
-
- <description>
- Ant build file to build the GLite Job Provenance Subsystem
- </description>
-
- <!-- =========================================
- Builds the GLite JP subsystem
- ========================================= -->
-
- <!-- Import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- Import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="./project/properties.xml" />
-
- <!-- Import global build properties and global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependencies properties files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${subsystem.dependencies.file}"/>
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options
- ========================================= -->
- <import file="${global.configure.options.file}"/>
-
- <!-- =========================================
- Import global task definitions
- ========================================= -->
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Import global compiler definitions
- ========================================= -->
- <import file="${global.compilerdefs.file}" />
-
- <!-- =========================================
- Import targets
- ========================================= -->
- <import file="${global.targets-common.file}"/>
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ===============================================
- Public common targets
- =============================================== -->
-
- <target name="localinit" depends="envcheck">
-
- <echo> Preparing directories ... </echo>
-
- <mkdir dir="${stage.bin.dir}" />
- <mkdir dir="${stage.lib.dir}" />
- <mkdir dir="${stage.java.dir}" />
- <mkdir dir="${stage.inc.dir}" />
- <mkdir dir="${stage.int.dir}" />
-
- <mkdir dir="${dist.dir}" />
-
- </target>
-
- <target name="init" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="init"/>
- </antcall>
- </target>
-
- <target name="checkstyle" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="checkstyle"/>
- </antcall>
- </target>
-
- <target name="compile" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="compile"/>
- </antcall>
- </target>
-
- <target name="compiletest" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="compiletest"/>
- </antcall>
- </target>
-
- <target name="unittest" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="unittest"/>
- </antcall>
- </target>
-
- <target name="unitcoverage" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="unitcoverage"/>
- </antcall>
- </target>
-
- <target name="stage" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="stage"/>
- </antcall>
- </target>
-
- <target name="dist" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="dist"/>
- </antcall>
- </target>
-
- <target name="install" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="install"/>
- </antcall>
- </target>
-
- <target name="doc" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="doc"/>
- </antcall>
- </target>
-
- <target name="all" depends="localinit">
- <antcall target="buildmodules">
- <param name="target" value="all"/>
- </antcall>
- </target>
-
- <target name="clean" depends="envcheck">
-
- <property name="offline.repository" value="true" />
- <antcall target="buildmodules">
- <param name="target" value="clean"/>
- </antcall>
-
- <delete dir="${module.bin.dir}" />
- <delete dir="${module.lib.dir}" />
- <delete dir="${module.autosrc.dir}" />
- <delete dir="${module.autodoc.dir}" />
- <delete dir="${module.test.reports.dir}" />
-
- </target>
-
- <target name="cleanAll" depends="clean"/>
-
- <!-- ===============================================
- Private targets
- =============================================== -->
-
- <!-- ===============================================
- Modules proxy targets
- =============================================== -->
-
- <!-- component targets definitions tag = do not remove = -->
-
- <target name="security.gsoap-plugin" unless="setenvonly" depends="envset">
- <if>
- <isset property="small.memory"/>
- <then>
- <exec dir="${security.subsystem.dir}" executable="${antExec}" failonerror="${failonerror}">
- <arg line="gsoap-plugin -Dtarget=${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
- </exec>
- </then>
- <else>
- <ant dir="${security.subsystem.dir}"
- target="gsoap-plugin"
- inheritall="false" >
- <property name="target" value="${target}"/>
- </ant>
- </else>
- </if>
- </target>
-
- <target name="lb.server-bones" unless="setenvonly" depends="envset">
- <if>
- <isset property="small.memory"/>
- <then>
- <exec dir="${lb.subsystem.dir}" executable="${antExec}" failonerror="${failonerror}">
- <arg line="server-bones -Dtarget=${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
- </exec>
- </then>
- <else>
- <ant dir="${lb.subsystem.dir}"
- target="server-bones"
- inheritall="false" >
- <property name="target" value="${target}"/>
- </ant>
- </else>
- </if>
- </target>
-
- <target name="ws-interface" unless="setenvonly" depends="envset" >
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${jp.subsystem.dir}.ws-interface" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${jp.subsystem.dir}.ws-interface"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="common" unless="setenvonly" depends="envset" >
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${jp.subsystem.dir}.common" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${jp.subsystem.dir}.common"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="index" unless="setenvonly" depends="envset, common, server-common,security.gsoap-plugin,lb.server-bones" >
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${jp.subsystem.dir}.index" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${jp.subsystem.dir}.index"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="primary" unless="setenvonly" depends="envset, ws-interface, common, server-common,security.gsoap-plugin,lb.server-bones" >
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${jp.subsystem.dir}.primary" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${jp.subsystem.dir}.primary"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="server-common" unless="setenvonly" depends="envset, common" >
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${jp.subsystem.dir}.server-common" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${jp.subsystem.dir}.server-common"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <target name="client" unless="setenvonly" depends="envset, common" >
- <if>
- <isset property="small.memory" />
- <then>
- <exec dir="${jp.subsystem.dir}.client" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
- </exec>
- </then>
- <else>
- <ant dir="${jp.subsystem.dir}.client"
- target="${target}"
- inheritall="false" />
- </else>
- </if>
- </target>
-
- <!-- Main proxy -->
- <target name="buildmodules" depends="envset,
- ws-interface,
- common,
- primary,
- server-common,
- client,
- index">
- <echo append="true" file="${global.project.dir}/cruisecontrol-stub.xml">
- <project name="${subsystem.name}" type="post-subsystem" packageName="${global.prefix}-${subsystem.prefix}"/>
- </echo>
- </target>
-
-</project>
+++ /dev/null
-#Fri Oct 14 15:24:20 CEST 2005
-module.build=38
+++ /dev/null
-ext.gsoap.version=2.7.0
+++ /dev/null
-###################################################################
-# System dependencies
-###################################################################
-
-org.glite.version = HEAD
-org.glite.jp.version = HEAD
-
-# Component dependencies tag = do not remove this line =
-org.glite.jp.ws-interface.version = HEAD
-org.glite.jp.common.version = HEAD
-org.glite.jp.server-common.version = HEAD
-org.glite.jp.index.version = HEAD
-org.glite.jp.primary.version = HEAD
+++ /dev/null
-<?xml version="1.0"?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- GLite Middleware Job Provenance Configuration Specification File
-
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.3 2004/12/10 09:46:41 akrenek
- included ws-interface
-
- Revision 1.2 2004/12/01 18:24:25 zsalvet
- common, index, and primary components defined
-
- Revision 1.1 2004/11/22 13:21:49 dimeglio
- First version of this file
-
--->
-
-
-<project name="GLite Middleware JP CSF" default="all">
-
- <!-- ===============================================
- Determine workspace directory
- =============================================== -->
-
- <!-- Relative workspace root directory -->
- <property name="workspace.dir" value="../.." />
-
- <!-- ===============================================
- Load properties
- =============================================== -->
-
- <!-- load baseline and user properties -->
- <import file="${workspace.dir}/org.glite/project/baseline.properties.xml" />
-
- <!-- define build properties file location since we are already in project dir -->
- <property name="subsystem.build.properties.file" value="./build.properties" />
-
- <!-- Load subsystem-specific property file -->
- <property file="./properties.xml"/>
-
- <!-- load global properties -->
- <import file="${global.properties.file}" />
-
- <!-- ===============================================
- Load dependencies
- =============================================== -->
-
- <!-- Load user dependencies file -->
- <property file="${user.dependencies.file}" />
-
- <!-- Load subsystem dependencies file -->
- <property file="./dependencies.properties" />
-
- <!-- Load global dependencies file -->
- <property file="${global.dependencies.file}" />
-
- <!-- ===============================================
- Load targets
- =============================================== -->
- <import file="${global.targets-envchecks.file}" />
- <import file="${global.targets-external-dependencies.file}" />
-
- <!-- ===============================================
- Evaluate CVS tags
- =============================================== -->
-
- <target name="evaluate.cvs.tags" description="Figure out if we need tagged CVS checkout">
-
- <condition property="glite.head">
- <and>
- <equals arg1="${org.glite.version}" arg2="HEAD" />
- <or>
- <istrue value="${update}" />
- <not>
- <available file="${global.dependencies.file}" type="file" />
- </not>
- </or>
- </and>
- </condition>
-
- <condition property="glite.tag">
- <and>
- <not>
- <equals arg1="${org.glite.version}" arg2="HEAD" />
- </not>
- <or>
- <istrue value="${update}" />
- <not>
- <available file="${global.dependencies.file}" type="file" />
- </not>
- </or>
- </and>
- </condition>
-
- <condition property="glite-jp.head">
- <and>
- <equals arg1="${org.glite.jp.version}" arg2="HEAD" />
- <istrue value="${update}" />
- </and>
- </condition>
-
- <condition property="glite-jp.tag">
- <and>
- <not>
- <equals arg1="${org.glite.jp.version}" arg2="HEAD" />
- </not>
- <istrue value="${update}" />
- </and>
- </condition>
-
- <!-- condition property tag = do not remove = -->
-
- <condition property="common.head">
- <equals arg1="${org.glite.jp.common.version}" arg2="HEAD" />
- </condition>
-
- <condition property="ws-interface.head">
- <equals arg1="${org.glite.jp.ws-interface.version}" arg2="HEAD" />
- </condition>
-
- <condition property="index.head">
- <equals arg1="${org.glite.jp.index.version}" arg2="HEAD" />
- </condition>
-
- <condition property="primary.head">
- <equals arg1="${org.glite.jp.primary.version}" arg2="HEAD" />
- </condition>
-
- <condition property="server-common.head">
- <equals arg1="${org.glite.jp.server-common.version}" arg2="HEAD" />
- </condition>
-
- </target>
-
- <presetdef name="cvs-co">
- <cvs command="checkout" dest="${workspace.dir}" />
- </presetdef>
-
- <!-- =====================================================
- Self-update if required
- ===================================================== -->
-
- <!-- Update main GLite module -->
- <target name="org.glite" depends="get.glite.head, get.glite.tag"/>
-
- <target name="get.glite.head" if="glite.head">
- <cvs-co package="org.glite" />
- </target>
-
- <target name="get.glite.tag" if="glite.tag">
- <cvs-co package="org.glite"
- tag="${org.glite.version}" />
- </target>
-
- <!-- Update the current module -->
- <target name="org.glite.jp" depends="get.glite-jp.head,
- get.glite-jp.tag"/>
-
- <target name="get.glite-jp.head" if="glite-jp.head">
- <cvs-co package="org.glite.jp" />
- <fail>The org.glite and org.glite.jp modules have been updated, please rerun the configuration file</fail>
- </target>
-
- <target name="get.glite-jp.tag" if="glite-jp.tag">
- <cvs-co package="org.glite.jp"
- tag="${org.glite.jp.version}" />
- <fail>The org.glite and org.glite.jp modules have been updated, please rerun the configuration file</fail>
- </target>
-
- <!-- *****************************************************-->
- <!-- Development tools -->
- <!-- *****************************************************-->
-
- <!-- All development tools -->
- <target name="devtools" depends="oscheck,
- junitcheck,
- junit,
- chkstyle,
- jalopy,
- ant-contrib,
- cpptasks,
- log4j,
- egee-ant-ext"
- description="Get development tools into repository."/>
-
- <!-- =====================================================
- External libraries
- ===================================================== -->
-
- <!-- All external libraries -->
- <target name="external"
- description="Install external packages" depends="oscheck"/>
-
- <!-- =====================================================
- GLite Middleware jp modules
- ===================================================== -->
-
- <!-- component targets tag = do not remove = -->
-
- <!-- ws-interface -->
- <target name="ws-interface" depends="evaluate.cvs.tags, get.ws-interface.head, get.ws-interface.tag"/>
- <target name="get.ws-interface.head" if="ws-interface.head">
- <cvs-co package="org.glite.jp.ws-interface" />
- </target>
- <target name="get.ws-interface.tag" unless="ws-interface.head">
- <cvs-co package="org.glite.jp.ws-interface"
- tag="${org.glite.jp.ws-interface.version}" />
- </target>
-
- <!-- common -->
- <target name="common" depends="evaluate.cvs.tags, get.common.head, get.common.tag"/>
- <target name="get.common.head" if="common.head">
- <cvs-co package="org.glite.jp.common" />
- </target>
- <target name="get.common.tag" unless="common.head">
- <cvs-co package="org.glite.jp.common"
- tag="${org.glite.jp.common.version}" />
- </target>
-
- <!-- index -->
- <target name="index" depends="evaluate.cvs.tags, get.index.head, get.index.tag"/>
- <target name="get.index.head" if="index.head">
- <cvs-co package="org.glite.jp.index" />
- </target>
- <target name="get.index.tag" unless="index.head">
- <cvs-co package="org.glite.jp.index"
- tag="${org.glite.jp.index.version}" />
- </target>
-
- <!-- primary -->
- <target name="primary" depends="evaluate.cvs.tags, get.primary.head, get.primary.tag"/>
- <target name="get.primary.head" if="primary.head">
- <cvs-co package="org.glite.jp.primary" />
- </target>
- <target name="get.primary.tag" unless="primary.head">
- <cvs-co package="org.glite.jp.primary"
- tag="${org.glite.jp.primary.version}" />
- </target>
-
- <!-- server-common -->
- <target name="server-common" depends="evaluate.cvs.tags, get.server-common.head, get.server-common.tag"/>
- <target name="get.server-common.head" if="server-common.head">
- <cvs-co package="org.glite.jp.server-common" />
- </target>
- <target name="get.server-common.tag" unless="server-common.head">
- <cvs-co package="org.glite.jp.server-common"
- tag="${org.glite.jp.server-common.version}" />
- </target>
-
- <!-- All project modules -->
- <target name="project" depends="server-common,
- ws-interface,
- common,
- index,
- primary" />
-
- <!-- ====================================================
- Checkout all
- ==================================================== -->
-
- <!-- All libraries -->
- <target name="all" depends="oscheck,
- evaluate.cvs.tags,
- defaultenvchecks,
- org.glite,
- org.glite.jp,
- devtools,
- external,
- project" />
-
- <!-- ====================================================
- Print dependecies to console
- ==================================================== -->
-
- <target name="dependencies">
- <concat>
- <fileset dir="." includes="dependencies.properties" />
- </concat>
- </target>
-
-</project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Common build properties file for the gLite JP modules
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
--->
-
-<project name="Job Provenance subsystem common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property name="subsystem.build.properties.file" value="./project/build.properties" />
- <property file="${subsystem.build.properties.file}" />
-
- <!-- ======================================================
- Define subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${jp.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${jp.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define general subsystem properties
- ====================================================== -->
-
- <!-- Include common subsystem properties -->
- <import file="${subsystem.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
-
-</project>
+++ /dev/null
-#!/bin/sh
-
-cd ../..
-
-cvs co org.glite
-cvs co org.glite.jp
-
-cd org.glite.jp/project
-ant -f glite.jp.csf.xml
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) Members of the EGEE Collaboration. 2004
- See http://eu-egee.org/partners/ for details on the copyright holders
- For license conditions see the license file or http://eu-egee.org/license.html
-
- Common Ant task definition file for the gLite Job Provenance modules
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
--->
-
-<project name="Job Provenance subsystem common tasks and types definitions">
-
- <!-- ======================================================
- Subsystem task definitions
- ====================================================== -->
-
-</project>
\ No newline at end of file
+++ /dev/null
-module.version=1.1.0
-module.age=1
EDG_WLL_ERROR_DNS, /**< DNS resolver error. See errDesc returned by edg_wll_Error(). */
EDG_WLL_ERROR_NOJOBID, /**< Attmepted call requires calling edg_wll_SetLoggingJob() first. */
EDG_WLL_ERROR_NOINDEX, /**< Query does not contain any conidion on indexed attribute. */
- EDG_WLL_IL_PROTO, /**< Interlogger to lbserver communication protocol error. */
+ EDG_WLL_IL_PROTO, /**< Lbserver (proxy) store communication protocol error. */
EDG_WLL_IL_SYS, /**< Interlogger internal error. */
EDG_WLL_IL_EVENTS_WAITING, /**< Interlogger still has events pending delivery. */
EDG_WLL_ERROR_COMPARE_EVENTS, /**< Two compared events differ. */
*/
int edg_wll_NotifIdSetUnique(edg_wll_NotifId *notifid, const char *unique);
+/**
+ * Duplicate a NotifId
+ * \param[in] src a notifid to duplicate
+ * \retval pointer to allocated memory containg the duplicated notifid
+ * \retval NULL if memory allocation fails or notifid is invalid
+ */
+edg_wll_NotifId *edg_wll_NotifIdDup(const edg_wll_NotifId src);
+
/*
*@} end of group
*/
-#Sat Oct 15 06:32:19 CEST 2005
-module.build=154
+#Fri Mar 17 04:35:59 CET 2006
+module.build=0236
#Fri Sep 02 14:16:31 CEST 2005
-module.version=3.0.0
+module.version=2.1.1
module.build=2
module.age=1
CXXFLAGS:=${CFLAGS}
-GLOBUS_LIBS:=-L${globus_prefix}/lib \
- -lglobus_common_${nothrflavour} \
- -lglobus_gssapi_gsi_${nothrflavour} \
-
-GLOBUS_THRLIBS:=-L${globus_prefix}/lib \
- -lglobus_common_${thrflavour} \
- -lglobus_gssapi_gsi_${thrflavour}
-
ifneq (${expat_prefix},/usr)
EXPAT_LIBS:=-L${expat_prefix}/lib
endif
THRPLUSLIB:=libglite_lb_clientpp_${thrflavour}.la
TOOLS:=dump load purge lb_dump_exporter
-EXAMPLES:=log_usertag_proxy job_log job_reg feed_shark notify query_ext query_seq_code stats abort_job change_acl
+EXAMPLES:=log_usertag_proxy job_log job_reg feed_shark notify query_ext query_seq_code stats abort_job change_acl lbmon flood_proxy
EXAMPLES_CL=user_jobs job_status
FAKE_EXAMPLES:=job_log_fake
${LINK} ${version_info} -o $@ ${PLUSTHRLOBJS} -rpath ${glite_location}/lib ${THRLIB}
logevent: logevent.o args.o
- ${LINK} -o $@ logevent.o args.o ${LIB} ${EXT_LIB} ${GLOBUS_LIBS}
+ ${LINK} -o $@ logevent.o args.o ${LIB} ${EXT_LIB}
${TOOLS} ${EXAMPLES}: %: %.o
- ${LINK} -o $@ $< ${LIB} ${EXT_LIB} ${GLOBUS_LIBS}
+ ${LINK} -o $@ $< ${LIB} ${EXT_LIB}
${EXAMPLES_CL}: %: %.o
- ${LINK} -o $@ $< ${LIB} ${COMMON_LIB} ${EXT_LIB} ${GLOBUS_LIBS}
+ ${LINK} -o $@ $< ${LIB} ${COMMON_LIB} ${EXT_LIB}
${FAKE_EXAMPLES}: %: %.o ${FAKELIB}
- ${LINK} -o $@ $< ${FAKELIB} ${TEST_LIBS} ${EXT_LIB} ${GLOBUS_LIBS}
+ ${LINK} -o $@ $< ${FAKELIB} ${TEST_LIBS} ${EXT_LIB}
${TOOLS}: ${LIB}
./producer_test
producer_test: producer_test.o prod_proto_test.o
- ${LINKXX} -o $@ ${LIB} ${TEST_LIBS} $+ ${EXT_LIB} ${GLOBUS_LIBS}
+ ${LINKXX} -o $@ ${LIB} ${TEST_LIBS} $+ ${EXT_LIB}
producer_test.o: %.o: %.cpp
${CXX} -c ${CXXFLAGS} ${TEST_INC} ${GLOBUSINC} $<
--- /dev/null
+#! /bin/bash
+
+#
+# script for exporing jobs from bkserver which should be periodically run
+# together with running jp-importer
+#
+# it uses configuration from enviroment ==> may require a configuration wrapper
+#
+
+#autodetect the prefix
+PREFIX=${GLITE_LOCATION:-`dirname $0`/..}
+
+# dump directory of bkserver
+GLITE_LB_EXPORT_DUMPDIR=${GLITE_LB_EXPORT_DUMPDIR:-/tmp/dump}
+GLITE_LB_EXPORT_DUMPDIR_OLD=${GLITE_LB_EXPORT_DUMPDIR_OLD:-$GLITE_LB_EXPORT_DUMPDIR.old}
+# maildir dump directory for jp importer
+GLITE_LB_EXPORT_JPDUMP_MAILDIR=${GLITE_LB_EXPORT_JPDUMP_MAILDIR:-/tmp/jpdump}
+# directory with exported data (file per job)
+GLITE_LB_EXPORT_EXPORTDIR=${GLITE_LB_EXPORT_EXPORTDIR:-/tmp/lbexport}
+# purge args (timeouts)
+GLITE_LB_EXPORT_PURGE_ARGS=${GLITE_LB_EXPORT_PURGE_ARGS:--a 1h -c 1h -n 1h -o 1d}
+# Book Keeping Server
+GLITE_LB_EXPORT_BKSERVER=${GLITE_LB_EXPORT_BKSERVER:-localhost:9000}
+
+[ -d $GLITE_LB_EXPORT_JPDUMP_MAILDIR ] || mkdir -p $GLITE_LB_EXPORT_JPDUMP_MAILDIR
+[ -d $GLITE_LB_EXPORT_DUMPDIR ] || mkdir -p $GLITE_LB_EXPORT_DUMPDIR
+[ -d $GLITE_LB_EXPORT_DUMPDIR_OLD ] || mkdir -p $GLITE_LB_EXPORT_DUMPDIR_OLD
+[ -d $GLITE_LB_EXPORT_EXPORTDIR ] || mkdir -p $GLITE_LB_EXPORT_EXPORTDIR
+
+$PREFIX/sbin/glite-lb-purge $GLITE_LB_EXPORT_PURGE_ARGS -l -m $GLITE_LB_EXPORT_BKSERVER
+
+for file in $GLITE_LB_EXPORT_DUMPDIR/*; do
+ if [ -s $file ]; then
+ $PREFIX/sbin/glite-lb-lb_dump_exporter -d $file -s $GLITE_LB_EXPORT_EXPORTDIR -m $GLITE_LB_EXPORT_JPDUMP_MAILDIR
+ mv $file $GLITE_LB_EXPORT_DUMPDIR_OLD
+ else
+ rm $file
+ fi
+done
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include "glite/lb/producer.h"
+#include "glite/wmsutils/jobid/cjobid.h"
+
+static void slave();
+
+int main(int argc,char **argv)
+{
+ int i,nproc;
+
+ if (argc != 2) {
+ fprintf(stderr,"usage: %s nproc\n",argv[0]);
+ return 1;
+ }
+
+ nproc = atoi(argv[1]);
+ if (nproc < 1) {
+ fprintf(stderr,"%s: nproc must be >= 1\n",argv[0]);
+ return 1;
+ }
+
+ for (i=0; i<nproc; i++) {
+ switch (fork()) {
+ case -1: perror("fork()"); return 1;
+ case 0: slave();
+ default: break;
+ }
+ }
+
+ while (nproc) {
+ int stat;
+ wait(&stat);
+ if (WIFEXITED(stat)) nproc--;
+ }
+
+ puts("done");
+ return 0;
+}
+
+
+static void slave()
+{
+ edg_wll_Context ctx;
+ edg_wlc_JobId job;
+ int i,pid = getpid(),noent = 0;
+
+ for (i=0; i<100; i++) {
+ int err;
+ char *et,*ed;
+
+ edg_wll_InitContext(&ctx);
+ edg_wlc_JobIdParse("https://fake.server/fakejob",&job);
+
+ if ((err = edg_wll_SetLoggingJobProxy(ctx,job,NULL,"some user",0))) edg_wll_Error(ctx,&et,&ed);
+ else et = ed = "none";
+
+ printf("[%d] %d: %s (%s)\n",pid,i,
+ err == 0 || err == ENOENT ? "OK" : et,
+ ed);
+
+ if (err == ENOENT) noent++;
+
+ edg_wll_LogUserTagProxy(ctx,"test","x");
+
+ edg_wll_FreeContext(ctx);
+ }
+ printf("[%d] done, ENOENTs %d\n",pid,noent);
+ exit(0);
+}
PREFIX=glite-lb-
fi
LOGFD=${LOGFD:-2}
-LOGEV=${LOGEV:-`dirname $0`/${PREFIX}logevent}${SUFFIX}
+if [ -d `dirname $0`/../bin ]; then
+ BINDIR=`dirname $0`/../bin
+else
+ BINDIR=`dirname $0`
+fi
+LOGEV=${LOGEV:-${BINDIR}/${PREFIX}logevent}${SUFFIX}
JOB_REG=${JOB_REG:-`dirname $0`/${PREFIX}job_reg}${SUFFIX}
EDG_JOBID=
LBPROXY=
#include <unistd.h>
#include <string.h>
#include <errno.h>
+#include <fcntl.h>
#include "glite/wmsutils/jobid/cjobid.h"
#include "glite/lb/producer.h"
int main(int argc, char *argv[])
{
- char *src = NULL,*job = NULL,*server = NULL,*seq;
+ char *src = NULL,*job = NULL,*server = NULL,*seq,*jdl = NULL;
int lbproxy = 0;
int done = 0,num_subjobs = 0,reg_subjobs = 0,i;
edg_wll_Context ctx;
opterr = 0;
do {
- switch (getopt(argc,argv,"xs:j:m:n:S")) {
+ switch (getopt(argc,argv,"xs:j:m:n:Sl:")) {
case 'x': lbproxy = 1; break;
case 's': src = (char *) strdup(optarg); break;
case 'j': job = (char *) strdup(optarg); break;
case 'm': server = strdup(optarg); break;
case 'n': num_subjobs = atoi(optarg); break;
case 'S': if (num_subjobs>0) { reg_subjobs = 1; break; }
+ case 'l': jdl = (char *) strdup(optarg); break;
case '?': usage(argv[0]); exit(EINVAL);
case -1: done = 1; break;
}
exit(1);
}
+ if (jdl) {
+ int f = open(jdl,O_RDONLY,0);
+ off_t l,p,c;
+
+ if (f<0) { perror(jdl); exit(1); }
+ l = lseek(f,0,SEEK_END);
+ lseek(f,0,SEEK_SET);
+
+ jdl = malloc(l+1);
+
+ for (p=0; p < l && (c = read(f,jdl+p,l-p)) > 0; p += c);
+ if (c<0) {
+ perror("read()");
+ exit (1);
+ }
+ jdl[p] = 0;
+ }
+
edg_wll_SetParam(ctx,EDG_WLL_PARAM_SOURCE,edg_wll_StringToSource(src));
if (lbproxy) {
if (edg_wll_RegisterJobProxy(ctx,jobid,
num_subjobs?EDG_WLL_REGJOB_DAG:EDG_WLL_REGJOB_SIMPLE,
- "blabla", "NNNSSSS",
+ jdl ? jdl : "blabla", "NNNSSSS",
num_subjobs,NULL,&subjobs))
{
char *et,*ed;
} else {
if (edg_wll_RegisterJobSync(ctx,jobid,
num_subjobs?EDG_WLL_REGJOB_DAG:EDG_WLL_REGJOB_SIMPLE,
- "blabla", "NNNSSSS",
+ jdl ? jdl : "blabla", "NNNSSSS",
num_subjobs,NULL,&subjobs))
{
char *et,*ed;
if (reg_subjobs) {
char ** jdls = (char**) malloc(num_subjobs*sizeof(char*));
- if (lbproxy) {
- fprintf(stderr,"edg_wll_RegisterSubjobsProxy(): not implemented yet.\n");
- exit(1);
- }
-
for (i=0; subjobs[i]; i++) {
asprintf(jdls+i, "JDL of subjob #%d\n", i+1);
}
- if (edg_wll_RegisterSubjobs(ctx, jobid, (const char **) jdls, NULL, subjobs)) {
- char *et,*ed;
- edg_wll_Error(ctx,&et,&ed);
- fprintf(stderr,"edg_wll_RegisterSubjobs: %s (%s)\n", et, ed);
- exit(1);
+ if (lbproxy) {
+ if (edg_wll_RegisterSubjobsProxy(ctx, jobid, (const char **) jdls, NULL, subjobs)) {
+ char *et,*ed;
+ edg_wll_Error(ctx,&et,&ed);
+ fprintf(stderr,"edg_wll_RegisterSubjobsProxy: %s (%s)\n", et, ed);
+ exit(1);
+ }
+ } else {
+ if (edg_wll_RegisterSubjobs(ctx, jobid, (const char **) jdls, NULL, subjobs)) {
+ char *et,*ed;
+ edg_wll_Error(ctx,&et,&ed);
+ fprintf(stderr,"edg_wll_RegisterSubjobs: %s (%s)\n", et, ed);
+ exit(1);
+ }
}
for (i=0; subjobs[i]; i++) free(jdls[i]);
--- /dev/null
+#ident "$Header$"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <sysexits.h>
+#include <assert.h>
+
+#include "glite/wmsutils/jobid/strmd5.h"
+#include "glite/lb/consumer.h"
+#include "glite/lb/context-int.h"
+#include "glite/lb/lbs_db.h"
+#include "glite/lb/jobstat.h"
+
+static struct option opts[] = {
+ { "mysql",1,NULL,'m' },
+ { "verbose",0,NULL,'v' },
+ { NULL, 0, NULL, 0 }
+};
+
+static void usage();
+static void do_exit(edg_wll_Context,int);
+static const char *me;
+
+int main(int argc,char **argv)
+{
+ int opt;
+ char *dbstring = getenv("LBDB");
+ int verbose = 0, rows = 0, fields = 0, jobs = 0, i;
+ edg_wll_Context ctx;
+ char *stmt = NULL, *status = NULL;
+ char *str[2];
+ edg_wll_Stmt sh;
+
+ me = strdup(argv[0]);
+
+ while ((opt = getopt_long(argc,argv,"m:v",opts,NULL)) != EOF) switch (opt) {
+ case 'm': dbstring = optarg; break;
+ case 'v': verbose++; break;
+ case '?': usage(); exit(EX_USAGE);
+ }
+
+ edg_wll_InitContext(&ctx);
+ if (edg_wll_Open(ctx,dbstring)) do_exit(ctx,EX_UNAVAILABLE);
+ if (edg_wll_DBCheckVersion(ctx)) do_exit(ctx,EX_SOFTWARE);
+ if (asprintf(&stmt,"SELECT status,count(status) FROM states GROUP BY status;") < 0) do_exit(ctx,EX_OSERR);
+ if (verbose) fprintf(stderr,"mysql query: %s\n",stmt);
+ if ((rows = edg_wll_ExecStmt(ctx,stmt,&sh)) < 0) do_exit(ctx,EX_SOFTWARE);
+ if (verbose) fprintf(stderr,"number of states returned: %d\n",rows);
+ if (rows > 0) fprintf(stdout,"Number of jobs in each state: \n");
+ for (i = 0; i < rows; i++) {
+ fields = edg_wll_FetchRow(sh, str);
+ if (fields != 2) {
+ edg_wll_FreeStmt(&sh);
+ do_exit(ctx,EX_SOFTWARE);
+ }
+ status = edg_wll_StatToString((edg_wll_JobStatCode) atoi(str[0]));
+ jobs += atoi(str[1]);
+ fprintf(stdout,"%s: %s\n",status,str[1]);
+ if (str[0]) free(str[0]);
+ if (str[1]) free(str[1]);
+ if (status) free(status);
+ }
+ fprintf(stdout,"Total number of jobs: %d\n",jobs);
+
+ if (stmt) free(stmt);
+ edg_wll_FreeStmt(&sh);
+ edg_wll_FreeContext(ctx);
+
+ return 0;
+}
+
+static void do_exit(edg_wll_Context ctx,int code)
+{
+ char *et,*ed;
+
+ edg_wll_Error(ctx,&et,&ed);
+ fprintf(stderr,"%s: %s (%s)\n",me,et,ed);
+ exit(code);
+}
+
+static void usage()
+{
+ fprintf(stderr,"usage: %s <options>\n"
+ " -m,--mysql <dbstring> use non-default database connection\n"
+ " -v,--verbose be verbose\n",
+ me);
+}
--- /dev/null
+#ident "$Header$"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <getopt.h>
+#include <time.h>
+
+#include "glite/lb/consumer.h"
+
+static void usage(char *);
+static int query_all(edg_wll_Context, int, struct timeval, edg_wll_JobStat **, edg_wlc_JobId **);
+static void dgerr(edg_wll_Context,char *);
+
+static char *myname = NULL;
+static int debug = 0, verbose = 0, lbproxy =0;
+static const char rcsid[] = "@(#)$Id$";
+
+static struct option const long_options[] = {
+ { "help", no_argument, 0, 'h' },
+ { "version", no_argument, 0, 'V' },
+ { "verbose", no_argument, 0, 'v' },
+ { "debug", no_argument, 0, 'd' },
+ { "lbproxy", required_argument, 0, 'x' },
+ { NULL, 0, NULL, 0}
+};
+
+int main(int argc,char *argv[]) {
+ edg_wll_Context ctx;
+ edg_wll_JobStat *statesOut = NULL;
+ edg_wlc_JobId *jobsOut = NULL;
+ struct timeval time_now;
+
+ int i, result, opt, nJobs;
+ i = result = opt = 0;
+ gettimeofday(&time_now,0);
+
+ myname = argv[0];
+ fprintf(stdout,"\n");
+ /* get arguments */
+ while ((opt = getopt_long(argc,argv,
+ "h" /* help */
+ "V" /* version */
+ "v" /* verbose */
+ "d" /* debug */
+ "x", /* lbproxy */
+ long_options, (int *) 0)) != EOF) {
+
+ switch (opt) {
+ case 'V': fprintf(stdout,"%s:\t%s\n",argv[0],rcsid); exit(0);
+ case 'v': verbose = 1; break;
+ case 'd': debug = 1; break;
+ case 'x': lbproxy = 1; break;
+ case 'h':
+ default:
+ usage(argv[0]); exit(0);
+ }
+ }
+ if ( edg_wll_InitContext(&ctx) ) {
+ fprintf(stderr,"%s: cannot initialize edg_wll_Context\n ",myname);
+ exit(1);
+ }
+
+ if ( (result = query_all(ctx, EDG_WLL_JOB_CLEARED, time_now, &statesOut, &jobsOut)) ) {
+ dgerr(ctx, "edg_wll_QueryJobs");
+ } else {
+ fprintf(stdout,"Number of jobs... ");
+ }
+
+ nJobs = 0;
+ if ( jobsOut ) {
+ for (i=0; jobsOut[i]; i++) edg_wlc_JobIdFree(jobsOut[i]); {
+ nJobs++;
+ free(jobsOut);
+ }
+ }
+ if ( statesOut ) {
+ for (i=0; statesOut[i].state; i++) edg_wll_FreeStatus(&statesOut[i]);
+ free(statesOut);
+ }
+ edg_wll_FreeContext(ctx);
+
+
+ return result;
+}
+
+static void
+usage(char *name) {
+ fprintf(stderr,"Usage: %s [-x]\n", name);
+}
+
+static int
+query_all(edg_wll_Context ctx, int query_status, struct timeval query_time, edg_wll_JobStat **statesOut, edg_wlc_JobId **jobsOut) {
+ edg_wll_QueryRec jc[3];
+ int ret;
+
+ memset(jc, 0, sizeof jc);
+
+ /* jobs in the state 'query_status' within last hour */
+ jc[0].attr = EDG_WLL_QUERY_ATTR_STATUS;
+ jc[0].op = EDG_WLL_QUERY_OP_EQUAL;
+ jc[0].value.i = query_status;
+ jc[1].attr = EDG_WLL_QUERY_ATTR_TIME;
+ jc[1].attr_id.state = query_status;
+ jc[1].op = EDG_WLL_QUERY_OP_WITHIN;
+ jc[1].value.t.tv_sec = query_time.tv_sec - 3600;
+ jc[1].value.t.tv_usec = query_time.tv_usec;
+ jc[1].value2.t.tv_sec = query_time.tv_sec;
+ jc[1].value2.t.tv_usec = query_time.tv_usec;
+ jc[2].attr = EDG_WLL_QUERY_ATTR_UNDEF;
+
+ if ( (ret = edg_wll_QueryJobs(ctx, jc, 0, jobsOut, statesOut)) ) {
+ if ( ret == E2BIG ) {
+ int r;
+ if ( edg_wll_GetParam(ctx, EDG_WLL_PARAM_QUERY_RESULTS, &r) ) return ret;
+ if ( r != EDG_WLL_QUERYRES_LIMITED ) return ret;
+
+ fprintf(stderr," edg_wll_QueryJobs() Warning: only limited result returned!\n");
+ return 0;
+ } else return ret;
+ }
+
+ return ret;
+}
+
+static void
+dgerr(edg_wll_Context ctx,char *where) {
+ char *etxt,*edsc;
+
+ edg_wll_Error(ctx,&etxt,&edsc);
+ fprintf(stderr,"%s: %s: %s",myname,where,etxt);
+ if (edsc) fprintf(stderr," (%s)",edsc);
+ putc('\n',stderr);
+ if(etxt) free(etxt);
+ if(edsc) free(edsc);
+}
-s LogMonitor,-e EnQueued, --queue="wm_input.fl", --job="job description in receiver language", --result=OK, --reason="detailed description of transfer"
-s WorkloadManager,-e DeQueued, --queue="wm_input.fl", --local_jobid="WM_ID"
+-s WorkloadManager, -e Resubmission, --result=${RESUB:-WILLRESUB}, --reason="let's try again", --tag=none
-s WorkloadManager,-e HelperCall, --helper_name="name of the called component",--helper_params="parameters of the call", --src_role=CALLING
-s WorkloadManager,-e Match,--dest_id="${DESTINATION:-destination CE/queue}"
-s WorkloadManager,-e HelperReturn, --helper_name="name of the called component",--retval="returned data", --src_role=CALLING
! DESTINATION=CE2/queue2
! CE_NODE=worker2
-:resubmission_shallow:
+! RESUB=SHALLOW
+:resubmission:
-s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
-s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
! DESTINATION=CE3/queue3
! CE_NODE=worker3
-:resubmission_shallow:
+! RESUB=SHALLOW
+:resubmission:
-s LogMonitor, -e ReallyRunning, --wn_seq="$EDG_WL_SEQUENCE"
! DESTINATION=CE2/queue2
! CE_NODE=worker2
-:resubmission_deep:
+! RESUB=DEEP
+:resubmission:
# payload_running=false
# destination=CE2/queue2
! DESTINATION=CE1/queue1
! CE_NODE=worker1
+! RESUB=SHALLOW
:running:
-s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
! DESTINATION=CE2/queue2
! CE_NODE=worker2
-:resubmission_shallow:
+! RESUB=SHALLOW
+:resubmission:
! BRANCH_SEQUENCE="$EDG_WL_SEQUENCE"
-s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
! DESTINATION=CE3/queue3
! CE_NODE=worker3
-:resubmission_shallow:
+! RESUB=SHALLOW
+:resubmission:
-s LogMonitor, -e ReallyRunning, --wn_seq="$BRANCH_SEQUENCE"
! DESTINATION=CE4/queue4
! CE_NODE=worker4
-:resubmission_deep:
+! RESUB=DEEP
+:resubmission:
# payload_running=false
# destination=CE4/queue4
! DESTINATION=CE2/queue2
! CE_NODE=worker2
-:resubmission_shallow:
+! RESUB=SHALLOW
+:resubmission:
-s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
-s LogMonitor, -e Resubmission, --result=WILLRESUB, --reason="let's try again", --tag=none
! DESTINATION=CE3/queue3
! CE_NODE=worker3
-:resubmission_shallow:
+! RESUB=SHALLOW
+:resubmission:
-s LogMonitor, -e ReallyRunning, --wn_seq="$EDG_WL_SEQUENCE"
! DESTINATION=CE2/queue2
! CE_NODE=worker2
-:resubmission_shallow:
+! RESUB=SHALLOW
+:resubmission:
! BRANCH_SEQUENCE="$EDG_WL_SEQUENCE"
-s LogMonitor, -e Done, --status_code=FAILED, --reason="reason for the change", --exit_code=141
! DESTINATION=CE3/queue3
! CE_NODE=worker3
-:resubmission_shallow:
+! RESUB=SHALLOW
+:resubmission:
-s LogMonitor, -e ReallyRunning, --wn_seq="$BRANCH_SEQUENCE"
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include "glite/wmsutils/jobid/cjobid.h"
+#include "glite/lb/producer.h"
+#include "glite/lb/events.h"
+
+#define MAXMSGSIZE 10240
+
+extern char *optarg;
+extern int opterr,optind;
+
+extern int edg_wll_DoLogEvent(edg_wll_Context context, edg_wll_LogLine logline);
+extern int edg_wll_DoLogEventProxy(edg_wll_Context context, edg_wll_LogLine logline);
+
+static const char *me;
+
+static void usage()
+{
+ fprintf(stderr,"usage: %s [-m bkserver] [-x] [-n jobs] [-f file_name]\n", me);
+}
+
+int main(int argc, char *argv[])
+{
+ char *job = NULL,*server = NULL,*seq = NULL,*filename = NULL;
+ char buf[MAXMSGSIZE];
+ int lbproxy = 0, num_subjobs = 0;
+ int done = 0, njobs = 1,i;
+ edg_wll_Context ctx;
+ edg_wlc_JobId jobid,*subjobs;
+ FILE *f;
+
+ edg_wll_InitContext(&ctx);
+ opterr = 0;
+
+ me = strdup(argv[0]);
+
+ do {
+ switch (getopt(argc,argv,"m:xn:f:")) {
+ case 'm': server = strdup(optarg); break;
+ case 'x': lbproxy = 1; break;
+ case 'n':
+ njobs = atoi(optarg);
+ fprintf(stderr,"WARNING: -n option not implemented yet\n");
+ break;
+ case 'f': filename = (char *) strdup(optarg); break;
+ case '?': usage(); exit(EINVAL);
+ case -1: done = 1; break;
+ }
+ } while (!done);
+
+ if (!server) {
+ fprintf(stderr,"%s: -m required\n",me);
+ usage();
+ exit(1);
+ }
+
+ if (njobs <= 0) {
+ fprintf(stderr,"%s: wrong number of jobs\n",me);
+ usage();
+ exit(1);
+ }
+
+ if (!filename) {
+ fprintf(stderr,"%s: -f required\n",me);
+ usage();
+ exit(1);
+ }
+
+ if ( (f = fopen(filename,"r")) == NULL) {
+ perror(filename);
+ exit(1);
+ }
+
+ /* create jobid */
+ if (!job) {
+ char *p = strchr(server,':');
+ if (p) *p=0;
+ edg_wlc_JobIdCreate(server,p?atoi(p+1):0,&jobid);
+ job = edg_wlc_JobIdUnparse(jobid);
+ // fprintf(stdout,"new jobid: %s\n",job);
+ }
+ else if ((errno = edg_wlc_JobIdParse(job,&jobid))) {
+ perror(job);
+ exit(1);
+ }
+
+ /* register */
+ edg_wll_SetParam(ctx,EDG_WLL_PARAM_SOURCE,EDG_WLL_SOURCE_USER_INTERFACE);
+ // edg_wll_SetParam(ctx,EDG_WLL_PARAM_SOURCE,edg_wll_StringToSource(src));
+ if (lbproxy) {
+ if (edg_wll_RegisterJobProxy(ctx,jobid,
+ num_subjobs?EDG_WLL_REGJOB_DAG:EDG_WLL_REGJOB_SIMPLE,
+ "JDL: blabla", "NNNSSSS",
+ num_subjobs,NULL,&subjobs))
+ {
+ char *et,*ed;
+ edg_wll_Error(ctx,&et,&ed);
+ fprintf(stderr,"edg_wll_RegisterJobProxy(%s): %s (%s)\n",job,et,ed);
+ exit(1);
+ }
+ } else {
+ if (edg_wll_RegisterJobSync(ctx,jobid,
+ num_subjobs?EDG_WLL_REGJOB_DAG:EDG_WLL_REGJOB_SIMPLE,
+ "JDL: blabla", "NNNSSSS",
+ num_subjobs,NULL,&subjobs))
+ {
+ char *et,*ed;
+ edg_wll_Error(ctx,&et,&ed);
+ fprintf(stderr,"edg_wll_RegisterJobSync(%s): %s (%s)\n",job,et,ed);
+ exit(1);
+ }
+ }
+
+ /* log events */
+ i = 1;
+ while (!feof(f)) {
+ edg_wll_LogLine logline;
+
+ if (!fgets(buf,sizeof(buf),f)) break;
+ if (strcmp(buf,"\n")) {
+ // fprintf(stdout,"%d: %s\n",i,buf);
+ asprintf(&logline,"DG.JOBID=\"%s\" %s",job,buf);
+ if (lbproxy) {
+ if (edg_wll_DoLogEventProxy(ctx,logline)) {
+ char *et,*ed;
+ edg_wll_Error(ctx,&et,&ed);
+ fprintf(stderr,"edg_wll_DoLogEventProxy(): %s (%s)\n",et,ed);
+ exit(1);
+ }
+ } else {
+ if (edg_wll_DoLogEvent(ctx,logline)) {
+ char *et,*ed;
+ edg_wll_Error(ctx,&et,&ed);
+ fprintf(stderr,"edg_wll_DoLogEvent(): %s (%s)\n",et,ed);
+ exit(1);
+ }
+ }
+ if (logline) free(logline);
+ }
+ i++;
+ }
+ fclose(f);
+
+ /* seq. code */
+ seq = edg_wll_GetSequenceCode(ctx);
+ fprintf(stdout,"\n%s=\"%s\"\n",num_subjobs?"EDG_WL_DAG_JOBID":"EDG_JOBID",job);
+ fprintf(stdout,"EDG_WL_SEQUENCE=\"%s\"\n",seq);
+ free(seq);
+ free(job);
+
+ if (num_subjobs) for (i=0; subjobs[i]; i++) {
+ char *job_s = edg_wlc_JobIdUnparse(subjobs[i]);
+ fprintf(stdout,"EDG_WL_SUB_JOBID[%d]=\"%s\"\n",i,job_s);
+ free(job_s);
+ }
+
+ edg_wll_FreeContext(ctx);
+
+ return 0;
+}
-#Sat Oct 15 06:41:11 CEST 2005
-module.build=153
+#Fri Mar 17 04:57:19 CET 2006
+module.build=0235
Revision history:
$Log$
+ Revision 1.3 2004/08/31 16:32:31 jpospi
+ First attempt to producer test
+
Revision 1.2 2004/07/06 20:47:11 flammer
Moved to configure.properties.xml
#Fri Sep 02 14:17:41 CEST 2005
-module.version=3.0.0
+module.version=2.1.5
module.build=2
module.age=1
#include "glite/lb/context-int.h"
#include "glite/lb/mini_http.h"
-
+#include "connection.h"
static void CloseConnection(edg_wll_Context ctx, int conn_index)
{
{
edg_wll_plain_close(&ctx->connProxy->conn);
- return edg_wll_Error(ctx, NULL, NULL);
+ return edg_wll_ResetError(ctx);
}
{
struct sockaddr_un saddr;
int flags;
-
+ int err;
+ char *ed = NULL;
+ int retries = 0;
+
+ edg_wll_ResetError(ctx);
+ if (ctx->connProxy->conn.sock > -1) {
+ // XXX: test path socket here?
+ return edg_wll_ResetError(ctx);
+ }
ctx->connProxy->conn.sock = socket(PF_UNIX, SOCK_STREAM, 0);
if (ctx->connProxy->conn.sock < 0) {
edg_wll_SetError(ctx, errno, "socket() error");
goto err;
}
- if (connect(ctx->connProxy->conn.sock, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
- edg_wll_SetError(ctx, errno, "connect()");
+ while ((err = connect(ctx->connProxy->conn.sock, (struct sockaddr *)&saddr, sizeof(saddr))) < 0 &&
+ errno == EAGAIN &&
+ ctx->p_tmp_timeout.tv_sec >= 0 && ctx->p_tmp_timeout.tv_usec >= 0 &&
+ !(ctx->p_tmp_timeout.tv_sec == 0 && ctx->p_tmp_timeout.tv_usec == 0)
+ )
+ {
+ struct timespec ns = { 0, PROXY_CONNECT_RETRY * 1000000 /* 10 ms */ },rem;
+
+ nanosleep(&ns,&rem);
+
+ ctx->p_tmp_timeout.tv_usec -= ns.tv_nsec/1000;
+ ctx->p_tmp_timeout.tv_usec += rem.tv_nsec/1000;
+
+ ctx->p_tmp_timeout.tv_sec -= ns.tv_sec;
+ ctx->p_tmp_timeout.tv_sec += rem.tv_sec;
+
+ if (ctx->p_tmp_timeout.tv_usec < 0) {
+ ctx->p_tmp_timeout.tv_usec += 1000000;
+ ctx->p_tmp_timeout.tv_sec--;
+ }
+ retries++;
+ }
+
+ /* printf("retries %d\n",retries); */
+
+ if (err) {
+ if (errno == EAGAIN) edg_wll_SetError(ctx,ETIMEDOUT, "edg_wll_open_proxy()");
+ else edg_wll_SetError(ctx, errno, "connect()");
goto err;
}
- return edg_wll_Error(ctx,NULL,NULL);
+ return 0;
err:
/* some error occured; close created connection */
+ err = edg_wll_Error(ctx,NULL,&ed);
edg_wll_close_proxy(ctx);
+ edg_wll_SetError(ctx,err,ed);
+ free(ed);
- return edg_wll_Error(ctx,NULL,NULL);
+ return err;
}
char *response)
{
- int code,len;
+ int code = HTTP_INTERNAL,len = 0;
edg_wll_ResetError(ctx);
sscanf(response,"HTTP/%*f %n%d",&len,&code);
#ifndef __EDG_WORKLOAD_LOGGING_CLIENT_CONNECTION_H__
#define __EDG_WORKLOAD_LOGGING_CLIENT_CONNECTION_H__
-#ident "$Header"
+#ident "$Header$"
int edg_wll_close(edg_wll_Context ctx);
int edg_wll_open(edg_wll_Context ctx);
int http_check_status(edg_wll_Context, char *);
+#define PROXY_CONNECT_RETRY 10 /* ms */
+
#endif /* __EDG_WORKLOAD_LOGGING_CLIENT_CONNECTION_H__ */
}
if ( !ln ) break;
+ if (*ln == 0) continue;
+
if ( edg_wll_ParseEvent(ctx, ln, &ev) != 0 ) {
cleanup(1);
}
cleanup(1);
}
snprintf(fname, PATH_MAX, "%s/%s.%ld", store_pref, unique, (long) time(NULL));
- if ( (fd = open(fname, O_CREAT|O_EXCL|O_RDWR, 00600)) < 0 ) {
+ if ( (fd = open(fname, O_CREAT|O_EXCL|O_RDWR, 00640)) < 0 ) {
if ( errno == EEXIST ) { sleep(2); continue; }
perror(fname);
cleanup(1);
char *ff = NULL, *jobid_s = NULL;
char *src_instance = NULL;
int err = 0/*,i,done = 0,fmtlen*/;
- int pri = 0;
+ int pri = 0, noinc = 0;
int use_lbproxy = 0;
char *lbproxy_user = NULL;
char *lbproxy_store_sock = NULL;
{ EDG_WLL_ARGS_BOOL, "d", "debug mode", "enable debug mode", &deb },
#ifdef ENABLE_REASON_LENGTH
{ EDG_WLL_ARGS_INT, "l", "reason-length", "extend 'reason' string to length (debug only)", &elength, 0, 1000000000 },
+ { EDG_WLL_ARGS_BOOL, "I", "dont-increment", "don't increment initial seqence code", &noinc },
#endif
@@@{
my %typetab = (
}
}
+ if (noinc) edg_wll_SetSequenceCode(ctx,code,EDG_WLL_SEQ_NORMAL);
+
#ifdef ENABLE_REASON_LENGTH
if (elength > 200000000) {
fprintf(stderr,"%s: usupported reason message length: %d\n", argv[0], elength);
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
+#include <poll.h>
#include "glite/security/glite_gss.h"
#include "glite/lb/notification.h"
#endif
/* NotifReceive */
{
- fd_set fds;
+ struct pollfd pollfds[1];
struct sockaddr_in a;
int recv_sock, alen;
edg_wll_Event *event = NULL;
}
}
- FD_ZERO(&fds);
- FD_SET(fd,&fds);
+ pollfds[0].fd = fd;
+ pollfds[0].events = POLLIN;
tv.tv_sec = timeout->tv_sec;
tv.tv_usec = timeout->tv_usec;
if (ctx->connPoolNotif[0].gss.context == GSS_C_NO_CONTEXT)
{
int ret;
- switch(select(fd+1, &fds, NULL, NULL, &tv)) {
+ switch(poll(pollfds, 1, tv.tv_sec*1000+tv.tv_usec/1000)) {
case -1:
- edg_wll_SetError(ctx, errno, "select() failed");
+ edg_wll_SetError(ctx, errno, "edg_wll_NotifReceive: poll() failed");
goto err;
case 0:
- edg_wll_SetError(ctx, ETIMEDOUT, "select() timeouted");
+ edg_wll_SetError(ctx, ETIMEDOUT, "edg_wll_NotifReceive: poll() timed out");
goto err;
default:
+ if (!(pollfds[0].revents & POLLIN)) {
+ edg_wll_SetError(ctx, errno, "edg_wll_NotifReceive: error on filedescriptor");
+ goto err;
+ }
break;
}
len = edg_wll_plain_read_full(data->conn, buffer, max_len, &data->ctx->p_tmp_timeout);
if(len < 0)
- edg_wll_SetError(data->ctx, LB_PROTO, "get_reply_plain(): error reading message data");
+ edg_wll_SetError(data->ctx, EDG_WLL_IL_PROTO, "plain_reader(): error reading message data");
return(len);
}
*/
static
int
-get_reply_plain(edg_wll_Context context, edg_wll_PlainConnection *conn, char **buf, int *code_min)
+get_reply_plain(edg_wll_Context context, edg_wll_PlainConnection *conn, char **buf, int *code_maj, int *code_min)
{
char *msg=NULL;
- int len, code;
+ int len;
struct reader_data data;
data.ctx = context;
data.conn = conn;
- code = 0;
len = read_il_data(&data, &msg, plain_reader);
if(len < 0) {
- edg_wll_SetError(context, LB_PROTO, "get_reply_plain(): error reading message");
+ edg_wll_SetError(context, EDG_WLL_IL_PROTO, "get_reply_plain(): error reading message");
goto get_reply_plain_end;
}
- if(decode_il_reply(&code, code_min, buf, msg) < 0) {
- edg_wll_SetError(context, LB_PROTO, "get_reply_plain(): error decoding message");
+ if(decode_il_reply(code_maj, code_min, buf, msg) < 0) {
+ edg_wll_SetError(context, EDG_WLL_IL_PROTO, "get_reply_plain(): error decoding message");
goto get_reply_plain_end;
}
&len, &gss_code);
if(ret < 0) {
edg_wll_log_proto_handle_gss_failures(data->ctx, ret, &gss_code, "edg_wll_gss_read_full");
- edg_wll_UpdateError(data->ctx, LB_PROTO, "get_reply_gss(): error reading message");
+ edg_wll_UpdateError(data->ctx, EDG_WLL_IL_PROTO, "gss_reader(): error reading message");
}
return(ret);
static
int
-get_reply_gss(edg_wll_Context context, edg_wll_GssConnection *conn, char **buf, int *code_min)
+get_reply_gss(edg_wll_Context context, edg_wll_GssConnection *conn, char **buf, int *code_maj, int *code_min)
{
char *msg = NULL;
int code;
data.conn = conn;
code = read_il_data(&data, &msg, gss_reader);
if(code < 0) {
- edg_wll_SetError(context, LB_PROTO, "get_reply_gss(): error reading reply");
+ edg_wll_SetError(context, EDG_WLL_IL_PROTO, "get_reply_gss(): error reading reply");
goto get_reply_gss_end;
}
- if(decode_il_reply(&code, code_min, buf, msg) < 0) {
- edg_wll_SetError(context, LB_PROTO, "get_reply_gss(): error decoding reply");
+ if(decode_il_reply(code_maj, code_min, buf, msg) < 0) {
+ edg_wll_SetError(context, EDG_WLL_IL_PROTO, "get_reply_gss(): error decoding reply");
goto get_reply_gss_end;
}
static char et[256];
int err;
int code;
+ int lbproto_code;
int count;
errno = err = code = count = 0;
+ lbproto_code = 0;
edg_wll_ResetError(context);
len = encode_il_msg(&buffer, logline);
fprintf(stderr,"log_proto_client_proxy: sending message...\n");
#endif
if (( count = edg_wll_plain_write_full(conn, buffer, len, &context->p_tmp_timeout)) < 0) {
- edg_wll_SetError(context,LB_PROTO,"edg_wll_log_proto_client_proxy(): error sending message to socket");
+ edg_wll_SetError(context, EDG_WLL_IL_PROTO,"edg_wll_log_proto_client_proxy(): error sending message to socket");
goto edg_wll_log_proto_client_proxy_end;
}
#ifdef EDG_WLL_LOG_STUB
fprintf(stderr,"log_proto_client_proxy: reading answer from server...\n");
#endif
- if ((err = get_reply_plain(context, conn, &answer, &code)) < 0 ) {
- edg_wll_SetError(context,LB_PROTO,"edg_wll_log_proto_client_proxy(): error reading answer from L&B Proxy server");
+ if ((err = get_reply_plain(context, conn, &answer, &lbproto_code, &code)) != 0 ) {
+ edg_wll_SetError(context, EDG_WLL_IL_PROTO,"edg_wll_log_proto_client_proxy(): error reading answer from L&B Proxy server");
} else {
#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"log_proto_client_proxy: read answer \"%d: %s\"\n",code,answer);
+ fprintf(stderr,"log_proto_client_proxy: read answer \"%d:%d: %s\"\n",lbproto_code,code,answer);
#endif
- snprintf(et, sizeof(et), "answer read from L&B Proxy server: %s", answer);
- edg_wll_SetError(context,code,et);
+ switch (lbproto_code) {
+ case LB_OK: break;
+ case LB_NOMEM:
+ edg_wll_SetError(context, ENOMEM, "edg_wll_log_proto_client_proxy(): proxy out of memory");
+ break;
+ case LB_PROTO:
+ edg_wll_SetError(context, EDG_WLL_IL_PROTO, "edg_wll_log_proto_client_proxy(): received protocol error response");
+ break;
+ case LB_DBERR:
+ snprintf(et, sizeof(et), "error details from L&B Proxy server: %s", answer);
+ edg_wll_SetError(context, code, et);
+ break;
+ default:
+ edg_wll_SetError(context, EDG_WLL_IL_PROTO, "edg_wll_log_proto_client_proxy(): received unknown protocol response");
+ break;
+ }
}
edg_wll_log_proto_client_proxy_end:
char *buffer,*answer = NULL;
static char et[256];
int err;
- int code;
+ int code, lbproto_code;
int count;
edg_wll_GssStatus gss_code;
count = 0;
if (( err = edg_wll_gss_write_full(con, buffer, len, &context->p_tmp_timeout, &count, &gss_code)) < 0) {
edg_wll_log_proto_handle_gss_failures(context,err,&gss_code,"edg_wll_gss_write_full()");
- edg_wll_UpdateError(context,LB_PROTO,"edg_wll_log_proto_client_direct(): error sending message");
+ edg_wll_UpdateError(context, EDG_WLL_IL_PROTO,"edg_wll_log_proto_client_direct(): error sending message");
goto edg_wll_log_proto_client_direct_end;
}
#ifdef EDG_WLL_LOG_STUB
fprintf(stderr,"log_proto_client_direct: reading answer from server...\n");
#endif
- if ((err = get_reply_gss(context, con, &answer, &code)) < 0 ) {
- edg_wll_SetError(context,LB_PROTO,"edg_wll_log_proto_client_direct(): error reading answer from L&B direct server");
+ if ((err = get_reply_gss(context, con, &answer, &lbproto_code, &code)) != 0 ) {
+ edg_wll_SetError(context, EDG_WLL_IL_PROTO,"edg_wll_log_proto_client_direct(): error reading answer from L&B direct server");
} else {
#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"log_proto_client_direct: read answer \"%d: %s\"\n",code,answer);
+ fprintf(stderr,"log_proto_client_direct: read answer \"%d:%d: %s\"\n",lbproto_code,code,answer);
#endif
- snprintf(et, sizeof(et), "answer read from bkserver: %s", answer);
- edg_wll_SetError(context,code,et);
+ switch (lbproto_code) {
+ case LB_OK: break;
+ case LB_NOMEM:
+ edg_wll_SetError(context, ENOMEM, "log_proto_client_direct(): server out of memory");
+ break;
+ case LB_PROTO:
+ edg_wll_SetError(context, EDG_WLL_IL_PROTO, "log_proto_client_direct(): received protocol error response");
+ break;
+ case LB_DBERR:
+ snprintf(et, sizeof(et), "error details from L&B server: %s", answer);
+ edg_wll_SetError(context, code, et);
+ break;
+ default:
+ edg_wll_SetError(context, EDG_WLL_IL_PROTO, "log_proto_client_direct(): received unknown protocol response");
+ break;
+ }
}
edg_wll_log_proto_client_direct_end:
#include "glite/lb/escape.h"
#include "prod_proto.h"
+#include "connection.h"
static const char* socket_path="/tmp/lb_proxy_store.sock";
* \param logline IN formated ULM string
*----------------------------------------------------------------------
*/
-static int edg_wll_DoLogEvent(
+int edg_wll_DoLogEvent(
edg_wll_Context context,
edg_wll_LogLine logline)
{
* \param logline IN formated ULM string
*----------------------------------------------------------------------
*/
-static int edg_wll_DoLogEventProxy(
+int edg_wll_DoLogEventProxy(
edg_wll_Context context,
edg_wll_LogLine logline)
{
int answer;
- int flags;
+ int flags,retries;
char *name_esc,*dguser;
struct sockaddr_un saddr;
edg_wll_PlainConnection conn;
close(conn.sock);
goto edg_wll_DoLogEventProxy_end;
}
+
+/* non-retry variant (pre bug #18994)
+ * XXX: what is the EISCONN case good for? conn.sock is created above.
+ *
if (connect(conn.sock, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
if(errno != EISCONN) {
edg_wll_SetError(context,answer = errno,"connect()");
goto edg_wll_DoLogEventProxy_end;
}
}
+*/
+
+ retries = 0;
+ while ((answer = connect(conn.sock, (struct sockaddr *)&saddr, sizeof(saddr))) < 0 &&
+ errno == EAGAIN &&
+ context->p_tmp_timeout.tv_sec >= 0 && context->p_tmp_timeout.tv_usec >= 0 &&
+ !(context->p_tmp_timeout.tv_sec == 0 && context->p_tmp_timeout.tv_usec == 0)
+ )
+ {
+ struct timespec ns = { 0, PROXY_CONNECT_RETRY * 1000000 /* 10 ms */ },rem;
+
+ nanosleep(&ns,&rem);
+
+ context->p_tmp_timeout.tv_usec -= ns.tv_nsec/1000;
+ context->p_tmp_timeout.tv_usec += rem.tv_nsec/1000;
+
+ context->p_tmp_timeout.tv_sec -= ns.tv_sec;
+ context->p_tmp_timeout.tv_sec += rem.tv_sec;
+
+ if (context->p_tmp_timeout.tv_usec < 0) {
+ context->p_tmp_timeout.tv_usec += 1000000;
+ context->p_tmp_timeout.tv_sec--;
+ }
+ retries++;
+ }
+
+ if (answer) {
+ if (errno == EAGAIN) edg_wll_SetError(context,answer = ETIMEDOUT,"edg_wll_DoLogEventProxy connect()");
+ else edg_wll_SetError(context,answer = errno,"connect()");
+ close(conn.sock);
+ goto edg_wll_DoLogEventProxy_end;
+ }
+
+/* just debug if (retries) printf("edg_wll_DoLogEventProxy connect retries %d\n",retries); */
/* add DG.USER to the message: */
name_esc = edg_wll_LogEscape(context->p_user_lbproxy);
* \param logline IN formated ULM string
*----------------------------------------------------------------------
*/
-static int edg_wll_DoLogEventDirect(
+int edg_wll_DoLogEventDirect(
edg_wll_Context context,
edg_wll_LogLine logline)
{
goto edg_wll_logeventmaster_end;
}
seq = edg_wll_GetSequenceCode(context);
- if (edg_wll_IncSequenceCode(context)) {
- ret = EINVAL;
- goto edg_wll_logeventmaster_end;
- }
+
if (trio_asprintf(&fix,EDG_WLL_FORMAT_COMMON,
date,context->p_host,lvl,priority,
source,context->p_instance ? context->p_instance : "",
if (eventName) free(eventName);
if (fullid) free(fullid);
+ if (!ret) if(edg_wll_IncSequenceCode(context)) {
+ edg_wll_SetError(context,ret = EINVAL,"edg_wll_LogEventMaster(): edg_wll_IncSequenceCode failed");
+ }
+
if (ret) edg_wll_UpdateError(context,0,"Logging library ERROR: ");
return edg_wll_Error(context,NULL,NULL);
edg_wll_SetParamString(context, EDG_WLL_PARAM_LBPROXY_USER, user);
/* query LBProxyServer for sequence code if not user-suplied */
-/* FIXME: doesn't work yet */
if (!code) {
- edg_wll_QuerySequenceCodeProxy(context, job, &code_loc);
- goto edg_wll_setloggingjobproxy_end;
+ if (edg_wll_QuerySequenceCodeProxy(context, job, &code_loc))
+ goto edg_wll_setloggingjobproxy_end;
} else {
code_loc = strdup(code);
}
const char * seed,
edg_wlc_JobId ** subjobs)
{
+#define MY_SEED "edg_wll_RegisterJobProxy()"
/* first register with bkserver */
- int ret = edg_wll_RegisterJob(context,job,type,jdl,ns,num_subjobs,seed,subjobs);
+ int ret = edg_wll_RegisterJob(context,job,type,jdl,ns,num_subjobs,seed ? seed : MY_SEED,subjobs);
if (ret) {
edg_wll_UpdateError(context,0,"edg_wll_RegisterJobProxy(): unable to register with bkserver");
return edg_wll_Error(context,NULL,NULL);
}
/* and then with L&B Proxy */
- return edg_wll_RegisterJobMaster(context,LOGFLAG_PROXY,job,type,jdl,ns,NULL,num_subjobs,seed,subjobs);
+ return edg_wll_RegisterJobMaster(context,LOGFLAG_PROXY,job,type,jdl,ns,NULL,num_subjobs,seed ? seed : MY_SEED,subjobs);
}
int edg_wll_RegisterSubjob(
edg_wlc_JobId const *psubjob;
edg_wlc_JobId oldctxjob;
char * oldctxseq;
+ int errcode = 0;
+ char * errdesc = NULL;
if (edg_wll_GetLoggingJob(ctx, &oldctxjob)) return edg_wll_Error(ctx, NULL, NULL);
oldctxseq = edg_wll_GetSequenceCode(ctx);
while (*pjdl != NULL) {
if (edg_wll_RegisterSubjob(ctx, *psubjob, EDG_WLL_REGJOB_SIMPLE, *pjdl,
- ns, parent, 0, NULL, NULL) != 0) break;
+ ns, parent, 0, NULL, NULL) != 0) {
+ errcode = edg_wll_Error(ctx, NULL, &errdesc);
+ goto edg_wll_registersubjobs_end;
+ }
pjdl++; psubjob++;
}
+edg_wll_registersubjobs_end:
edg_wll_SetLoggingJob(ctx, oldctxjob, oldctxseq, EDG_WLL_SEQ_NORMAL);
+ if (errcode) {
+ edg_wll_SetError(ctx, errcode, errdesc);
+ free(errdesc);
+ }
return edg_wll_Error(ctx, NULL, NULL);
}
edg_wlc_JobId const *psubjob;
edg_wlc_JobId oldctxjob;
char * oldctxseq;
+ int errcode = 0;
+ char * errdesc = NULL;
if (edg_wll_GetLoggingJob(ctx, &oldctxjob)) return edg_wll_Error(ctx, NULL, NULL);
oldctxseq = edg_wll_GetSequenceCode(ctx);
while (*pjdl != NULL) {
if (edg_wll_RegisterSubjobProxy(ctx, *psubjob, EDG_WLL_REGJOB_SIMPLE, *pjdl,
- ns, parent, 0, NULL, NULL) != 0) break;
+ ns, parent, 0, NULL, NULL) != 0) {
+ errcode = edg_wll_Error(ctx, NULL, &errdesc);
+ goto edg_wll_registersubjobsproxy_end;
+ }
pjdl++; psubjob++;
}
+edg_wll_registersubjobsproxy_end:
edg_wll_SetLoggingJobProxy(ctx, oldctxjob, oldctxseq, NULL, EDG_WLL_SEQ_NORMAL);
+ if (errcode) {
+ edg_wll_SetError(ctx, errcode, errdesc);
+ free(errdesc);
+ }
return edg_wll_Error(ctx, NULL, NULL);
}
void log_proto_server(int con, char *logline) {
int i;
- char b[4];
+ char b[5];
char *buf;
ssize_t size, retsize;
// read DGLOG
retsize = read(con, b, 5);
CPPUNIT_ASSERT(retsize == 5);
- CPPUNIT_ASSERT(b[0] = 'D' && b[1] == 'G' && b[2] == 'L' && b[3] == 'O' && b[4] == 'G');
+ CPPUNIT_ASSERT(b[0] == 'D' && b[1] == 'G' && b[2] == 'L' && b[3] == 'O' && b[4] == 'G');
// read size (including '\0', little endian)
for (i = 0; i < 4; i++)
# major version more frequently. This variable specifies how many steps ahead
# we are.
-VERSION_AHEAD=0
+VERSION_AHEAD=1
GLOBUS_LIBS:=-L${globus_prefix}/lib \
-lglobus_common_${nothrflavour} \
-lglobus_gssapi_gsi_${nothrflavour} \
+GLOBUS_THRLIBS:=-L${globus_prefix}/lib \
+ -lglobus_common_${thrflavour} \
+ -lglobus_gssapi_gsi_${thrflavour} \
+
GLITE_LIBS:=-L${glite_location}/lib
ifneq (${expat_prefix},/usr)
${COVERAGE_FLAGS}
EXT_LIBS:= ${EXPAT_LIBS} ${ARES_LIBS} ${GLOBUS_LIBS}
+EXT_THRLIBS:= ${EXPAT_LIBS} ${ARES_LIBS} ${GLOBUS_THRLIBS}
# breaks linking when not installed in /opt, /home/dimeglio etc.
# ${GLITE_LIBS} \
TRIO_OBJS:=escape.o trio.o strio.o
TRIO_LIB:=libglite_lb_trio.a
-MAILDIR_OBJS:=lb_maildir.o
-MAILDIR_LIB:=libglite_lb_maildir.a
+MAILDIR_OBJS:=lb_maildir.lo
+MAILDIR_LIB:=libglite_lb_maildir.la
THROBJS:=${OBJS:.o=.thr.o}
THRLOBJS:=${OBJS:.o=.thr.lo}
ranlib $@
${MAILDIR_LIB}: ${MAILDIR_OBJS}
- ar crv $@ ${MAILDIR_OBJS}
- ranlib $@
+ ${LINK} ${version_info} -o $@ ${MAILDIR_OBJS}
${THRSTATICLIB}: ${THROBJS}
ar crv $@ ${THROBJS}
${LINK} ${version_info} -o $@ ${THRLOBJS} \
-lglite_security_gss_${thrflavour} \
-lglite_wmsutils_cjobid \
- ${EXT_LIBS} \
+ ${EXT_THRLIBS} \
-lm
stage: compile
install:
mkdir -p ${PREFIX}/lib
mkdir -p ${PREFIX}/share/doc/${package}-${version}
- ${INSTALL} -m 644 ${LTLIB} ${THRLTLIB} ${PREFIX}/lib
+ ${INSTALL} -m 644 ${LTLIB} ${THRLTLIB} ${MAILDIR_LIB} ${PREFIX}/lib
${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version}
if [ x${DOSTAGE} = xyes ]; then \
mkdir -p ${PREFIX}/include/${globalprefix}/${lbprefix} ; \
(cd ${top_srcdir}/interface && install -m 644 ${HDRS} ${PREFIX}/include/${globalprefix}/${lbprefix}) ; \
- install -m 644 ${STATICLIB} ${THRSTATICLIB} ${TRIO_LIB} ${MAILDIR_LIB} ${PREFIX}/lib; \
+ install -m 644 ${STATICLIB} ${THRSTATICLIB} ${TRIO_LIB} ${PREFIX}/lib; \
fi
clean:
unsigned int c[EDG_WLL_SOURCE__LAST];
} edg_wll_SeqCode;
+#define EDG_WLL_SEQ_NULL "UI=000000:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000"
/* non-gsi one-element analogy of connPool for L&B Proxy server */
-#Sat Oct 15 06:38:31 CEST 2005
-module.build=153
+#Fri Mar 17 04:37:53 CET 2006
+module.build=0235
#Fri Sep 02 14:17:07 CEST 2005
-module.version=3.0.0
+module.version=3.0.5
module.build=2
module.age=1
static void free_voms_groups(edg_wll_VomsGroups *);
+/* uncomment to get the trace
+#define CTXTRACE "/tmp/lb-context-trace"
+*/
+
int edg_wll_InitContext(edg_wll_Context *ctx)
{
int i;
out->connPool = (edg_wll_ConnPool *) calloc(out->poolSize, sizeof(edg_wll_ConnPool));
out->connPoolNotif = (edg_wll_ConnPool *) calloc(1, sizeof(edg_wll_ConnPool));
- out->connProxy = (edg_wll_ConnPool *) calloc(1, sizeof(edg_wll_ConnProxy));
+ out->connProxy = (edg_wll_ConnProxy *) calloc(1, sizeof(edg_wll_ConnProxy));
out->connProxy->conn.sock = -1;
out->connToUse = -1;
*ctx = out;
+
+#ifdef CTXTRACE
+{
+ int trc = open(CTXTRACE,O_WRONLY|O_CREAT,0644);
+ char buf[200];
+ sprintf(buf,"%p init\n",out);
+ lseek(trc,0,SEEK_END);
+ write(trc,buf,strlen(buf));
+ close(trc);
+}
+#endif
+
return 0;
}
OM_uint32 min_stat;
if (!ctx) return;
-
+#ifdef CTXTRACE
+{
+ int trc = open(CTXTRACE,O_WRONLY|O_CREAT,0644);
+ char buf[200];
+ sprintf(buf,"%p free\n",ctx);
+ lseek(trc,0,SEEK_END);
+ write(trc,buf,strlen(buf));
+ close(trc);
+}
+#endif
if (ctx->errDesc) free(ctx->errDesc);
if (ctx->connPool) {
int i;
"DNS resolver error",
"No JobId specified in context",
"No indexed condition in query",
- "Interlogger protocol error",
+ "Lbserver (proxy) store protocol error",
"Interlogger internal error",
"Interlogger has events pending",
"Compared events differ",
char **buffer,
int (*reader)(void *, char *, const int))
{
- char buf[17];
+ char buf[17], *p;
int ret, len;
/* read 17 byte header */
if(len < 0) {
goto err;
}
+
+ /* perform some sanity checks on the received header */
+ if(buf[16] != '\n') {
+ len = -1;
+ goto err;
+ }
buf[16] = 0;
+ /* skip leading spaces */
+ for(p = buf; *p == ' '; p++);
+ /* skip digits */
+ for(; (*p >= '0') && (*p <= '9'); p++);
+ /* this must be the end of string */
+ if(*p != 0) {
+ len = -1;
+ goto err;
+ }
+
if((len=atoi(buf)) <= 0) {
len = -1;
goto err;
#include <stdio.h>
#include <fcntl.h>
#include <time.h>
+#include <signal.h>
+#include <assert.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <netdb.h>
#include <netinet/in.h>
#include <errno.h>
+#include <poll.h>
+#ifndef INFTIM
+#define INFTIM (-1)
+#endif
#include "lb_plain_io.h"
struct timeval *to)
{
int ct, toread = 0;
- fd_set fds;
+ struct pollfd pollfds[1];
+ int polltime = 0;
struct timeval timeout, before, after;
toread = 0;
do {
- FD_ZERO(&fds);
- FD_SET(conn->sock, &fds);
- switch (select(conn->sock+1, &fds, NULL, NULL, to ? &timeout : NULL)) {
- case 0: errno = ETIMEDOUT; goto cleanup; break;
- case -1: goto cleanup; break;
+ pollfds[0].fd = conn->sock;
+ pollfds[0].events = POLLIN;
+ polltime = to ? (timeout.tv_sec*1000+timeout.tv_usec/1000) : INFTIM;
+ switch (poll(pollfds, 1, polltime)) {
+ case 0: errno = ETIMEDOUT; goto cleanup; break;
+ case -1: goto cleanup; break;
+ default: if (!(pollfds[0].revents & POLLIN)) {
+ errno = EIO;
+ goto cleanup; break;
+ }
}
if ( conn->bufUse == conn->bufSize ) {
if ( to->tv_sec < 0 ) to->tv_sec = to->tv_usec = 0;
}
+ if ( errno == ECONNRESET) errno = ENOTCONN;
if ( errno ) return -1;
if ( conn->bufUse > 0 ) {
{
size_t written = 0;
int ct = -1;
- fd_set fds;
+ struct pollfd pollfds[1];
+ int polltime = 0;
struct timeval timeout, before, after;
+ struct sigaction sa,osa;
+ memset(&sa,0,sizeof(sa)); assert(sa.sa_handler == NULL);
+ sa.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE,&sa,&osa);
if ( to ) {
memcpy(&timeout, to, sizeof(timeout));
errno = 0;
while ( written < bufsz ) {
- FD_ZERO(&fds);
- FD_SET(conn->sock, &fds);
- switch ( select(conn->sock+1, NULL, &fds, NULL, to? &timeout: NULL) ) {
+ pollfds[0].fd = conn->sock;
+ pollfds[0].events = POLLOUT;
+ polltime = to ? (timeout.tv_sec*1000+timeout.tv_usec/1000) : INFTIM;
+
+ switch (poll(pollfds, 1, polltime)) {
case 0: errno = ETIMEDOUT; goto end; break;
case -1: goto end; break;
+ default: if (!(pollfds[0].revents & POLLOUT)) {
+ errno = ENOTCONN;
+ goto end; break;
+ }
}
if ( (ct=write(conn->sock, ((char*)buf)+written, bufsz-written)) < 0 ) {
if ( errno == EINTR ) { errno = 0; continue; }
if (to->tv_sec < 0) to->tv_sec = to->tv_usec = 0;
}
+ sigaction(SIGPIPE,&osa,NULL);
+ if (errno == EPIPE) errno = ENOTCONN;
return (errno)? -1: written;
}
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <pwd.h>
#include <sys/un.h>
#include <stdio.h>
#include <math.h>
case EAGAIN:
case EACCES:
case EINTR:
- sleep(fcntl_timeout);
+ if ((i+1) < fcntl_attempts) sleep(fcntl_timeout);
break;
default:
edg_wll_SetError(ctx, errno, "fcntl()");
}
} else break;
}
+ if (i == fcntl_attempts) {
+ edg_wll_SetError(ctx, ETIMEDOUT, "timed out trying to lock event file");
+ goto cleanup;
+ }
if ( fseek(outfile, 0, SEEK_END) == -1 ) {
edg_wll_SetError(ctx, errno, "fseek()");
edg_wll_SetErrorGss(ctx, "receving HTTP request", &gss_code);
goto error;
case EDG_WLL_GSS_ERROR_ERRNO:
+ if (errno == ECONNRESET) errno = ENOTCONN;
edg_wll_SetError(ctx,errno,"edg_wll_gss_read()");
goto error;
case EDG_WLL_GSS_ERROR_TIMEOUT:
free(id);
return NULL;
}
+
+edg_wll_NotifId *
+edg_wll_NotifIdDup(const edg_wll_NotifId src)
+{
+ char *str;
+ edg_wll_NotifId id = NULL;
+ int ret;
+
+ str = edg_wll_NotifIdUnparse(src);
+ if (str == NULL)
+ return NULL;
+
+ ret = edg_wll_NotifIdParse((const char *)str, &id);
+ free(str);
+
+ return id;
+}
int edg_wll_ULMTimevalToDate( long sec, long usec, char *dstr )
{
char *func = "edg_wll_ULMTimevalToDate";
+ struct tm tms;
struct tm *tp;
int len;
if ( sec < 0 || usec < 0 || usec > 999999 )
return 1;
- tp = gmtime( (const time_t *) &sec );
+ tp = gmtime_r( (const time_t *) &sec, &tms );
if ( tp == NULL )
return 1;
il_test.o
glite_lb_logd: ${LOGD_OBJS}
- ${LINK} -o $@ ${LOGD_OBJS} ${COMMON_LIB}_${nothrflavour} ${GLITE_GSS_LIB}_${nothrflavour} ${EXT_LIBS} ${GLOBUS_LIBS}
+ ${LINK} -o $@ ${LOGD_OBJS} ${COMMON_LIB}_${nothrflavour}
glite_lb_interlogd: ${INTERLOG_OBJS}
${LINK} -o $@ ${INTERLOG_OBJS} \
- ${COMMON_LIB}_${thrflavour} \
- ${GLITE_GSS_LIB}_${nothrflavour} \
- ${EXT_LIBS} ${GLOBUS_THRLIBS} -lpthread
+ ${COMMON_LIB}_${thrflavour}
glite_lb_notif_interlogd: ${INTERLOG_NOBJS}
${LINK} -o $@ ${INTERLOG_NOBJS} \
- ${COMMON_LIB}_${thrflavour} \
- ${GLITE_GSS_LIB}_${nothrflavour} \
- ${EXT_LIBS} ${GLOBUS_THRLIBS} -lpthread
+ ${COMMON_LIB}_${thrflavour}
default: all
-echo commented out -- fix needed
check.il: ${INTERLOG_TEST_OBJS}
- ${LINKXX} -o $@ ${COMMON_LIB}_${thrflavour} ${GLITE_GSS_LIB}_${nothrflavour} ${EXT_LIBS} ${GLOBUS_THRLIBS} ${TEST_LIBS} -lpthread $+
+ ${LINKXX} -o $@ ${COMMON_LIB}_${thrflavour} ${GLITE_GSS_LIB}_${nothrflavour} ${TEST_LIBS} -lpthread $+
dist: distsrc distbin
-#Sat Oct 15 06:54:17 CEST 2005
-module.build=153
+#Fri Mar 17 04:51:05 CET 2006
+module.build=0235
#Fri Sep 02 14:18:17 CEST 2005
-module.version=1.2.0
+module.version=1.2.2
module.build=2
module.age=1
{
char *msg=NULL;
int ret, code;
- size_t len, l;
+ int len, l;
struct timeval tv;
struct reader_data data;
SRVBONES_LIB:= -L${stagedir}/lib -lglite_lb_server_bones
-LB_SERVER_SHARE_LIB:= -L${stagedir}/lib -lglite_lb_bkserver
+LB_SERVER_SHARE_LIB:=${stagedir}/lib/libglite_lb_bkserver.a
LB_PROXY_COMMON_LIB:= -L${stagedir}/lib -lglite_lb_common_${nothrflavour}
COMMON_LIBS:= -L${stagedir}/lib -lglite_lb_common_${nothrflavour} -lglite_security_gss_${nothrflavour}
GRIDSITE_LIBS = -lgridsite_globus `xml2-config --libs`
-glite_lb_proxy: lbproxy.o
+glite_lb_proxy: lbproxy.o ${LB_SERVER_SHARE_LIB}
@echo DEBUG: mysql_version=${mysql_version} mysql_prefix=${mysql_prefix}
@echo DEBUG: shell: x$(shell echo ${mysql_version} | cut -d. -f1,2)x
${LINK} -o $@ lbproxy.o ${LB_PROXY_LIBS}
${INSTALL} -m 755 glite_lb_proxy ${PREFIX}/bin/glite-lb-proxy
${INSTALL} -m 644 ${top_srcdir}/config/glite-lb-dbsetup-proxy.sql ${PREFIX}/etc
${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-lb-proxy
- if [ x${DOSTAGE} != xyes ]; then \
- ${INSTALL} -m 755 ${stagedir}/bin/glite-lb-interlogd ${PREFIX}/bin; \
- fi
+
+# don't do it due to RPM conflict
+# if [ x${DOSTAGE} != xyes ]; then \
+# ${INSTALL} -m 755 ${stagedir}/bin/glite-lb-interlogd ${PREFIX}/bin; \
+# fi
clean:
#!/bin/sh
GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite}
-GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-${GLITE_LOCATION}/var}
+GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/var/glite}
[ -f /etc/glite.conf ] && . /etc/glite.conf
[ -f $GLITE_LOCATION/etc/glite-wms.conf ] && . $GLITE_LOCATION/etc/glite-wms.conf
-#Sat Oct 15 06:58:34 CEST 2005
-module.build=10
+#Fri Mar 17 05:00:52 CET 2006
+module.build=0092
#Fri Sep 02 14:18:53 CEST 2005
-module.version=1.2.0
+module.version=1.2.7
module.build=2
module.age=0
#define DEFAULTCS "lbserver/@localhost:lbproxy"
-#define CON_QUEUE 20 /* accept() */
+#define CON_QUEUE 20 /* accept() */
#define SLAVE_OVERLOAD 10 /* queue items per slave */
-#define CLNT_TIMEOUT 10 /* keep idle connection that many seconds */
-#define TOTAL_CLNT_TIMEOUT 60 /* one client may ask one slave multiple times */
- /* but only limited time to avoid DoS attacks */
-#define CLNT_REJECT_TIMEOUT 100000 /* time limit for client rejection in !usec! */
-#define DNS_TIMEOUT 5 /* how long wait for DNS lookup */
+#define IDLE_TIMEOUT 10 /* keep idle connection that many seconds */
+#define REQUEST_TIMEOUT 120 /* one client may ask one slave multiple times */
#define SLAVE_CONNS_MAX 500 /* commit suicide after that many connections */
-#define MASTER_TIMEOUT 30 /* maximal time of one-round of master network communication */
-#define SLAVE_TIMEOUT 30 /* maximal time of one-round of slave network communication */
/* file to store pid and generate semaphores key
*/
sock_serve[PATH_MAX];
static int slaves = 10,
semaphores = -1,
+ con_queue = CON_QUEUE,
semset;
static char host[300];
static char * port;
static struct option opts[] = {
{"port", 1, NULL, 'p'},
+ {"con-queue", 1, NULL, 'c'},
{"debug", 0, NULL, 'd'},
{"mysql", 1, NULL, 'm'},
{"slaves", 1, NULL, 's'},
{NULL,0,NULL,0}
};
-static const char *get_opt_string = "p:dm:s:l:i:X:Y:";
+static const char *get_opt_string = "p:c:dm:s:l:i:X:Y:";
static void usage(char *me)
{
fprintf(stderr,"usage: %s [option]\n"
"\t-p, --sock\t path-name to the local socket\n"
+ "\t-c, --con-queue\t size of the connection queue (accept)\n"
"\t-m, --mysql\t database connect string\n"
"\t-d, --debug\t don't run as daemon, additional diagnostics\n"
"\t-s, --slaves\t number of slave servers to fork\n"
while ((opt = getopt_long(argc, argv, get_opt_string, opts, NULL)) != EOF) switch (opt) {
case 'p': strcpy(socket_path_prefix, optarg); break;
+ case 'c': con_queue = atoi(optarg); break;
case 'd': debug = 1; break;
case 'm': dbstring = optarg; break;
case 's': slaves = atoi(optarg); break;
gethostname(host, sizeof host);
host[sizeof host - 1] = 0;
asprintf(&port, "%d", GLITE_WMSC_JOBID_DEFAULT_PORT);
- dprintf(("server address: %s:%d\n", host, port));
+ dprintf(("server address: %s:%s\n", host, port));
service_table[SRV_SERVE].conn = socket(PF_UNIX, SOCK_STREAM, 0);
if ( service_table[SRV_SERVE].conn < 0 ) { perror("socket()"); return 1; }
return 1;
}
- if ( listen(service_table[SRV_SERVE].conn, CON_QUEUE) ) { perror("listen()"); return 1; }
+ if ( listen(service_table[SRV_SERVE].conn, con_queue) ) { perror("listen()"); return 1; }
service_table[SRV_STORE].conn = socket(PF_UNIX, SOCK_STREAM, 0);
if ( service_table[SRV_STORE].conn < 0 ) { perror("socket()"); return 1; }
perror(buf);
return 1;
}
- if ( listen(service_table[SRV_STORE].conn, CON_QUEUE) ) { perror("listen()"); return 1; }
+ if ( listen(service_table[SRV_STORE].conn, con_queue) ) { perror("listen()"); return 1; }
dprintf(("Listening at %s, %s ...\n", sock_store, sock_serve));
glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT, slaves);
glite_srvbones_set_param(GLITE_SBPARAM_SLAVE_OVERLOAD, SLAVE_OVERLOAD);
glite_srvbones_set_param(GLITE_SBPARAM_SLAVE_CONNS_MAX, SLAVE_CONNS_MAX);
- to = (struct timeval){CLNT_TIMEOUT, 0};
- glite_srvbones_set_param(GLITE_SBPARAM_CONNECT_TIMEOUT, &to);
- to = (struct timeval){CLNT_TIMEOUT, 0};
+ to = (struct timeval){REQUEST_TIMEOUT, 0};
glite_srvbones_set_param(GLITE_SBPARAM_REQUEST_TIMEOUT, &to);
- to = (struct timeval){TOTAL_CLNT_TIMEOUT, 0};
+ to = (struct timeval){IDLE_TIMEOUT, 0};
glite_srvbones_set_param(GLITE_SBPARAM_IDLE_TIMEOUT, &to);
glite_srvbones_run(clnt_data_init, service_table, sizofa(service_table), debug);
{
struct clnt_data_t *cdata = (struct clnt_data_t *)data;
edg_wll_Context ctx;
- struct timeval total_to = { TOTAL_CLNT_TIMEOUT,0 },
- conn_start, now;
+ struct timeval conn_start, now;
- if ( !(ctx = (edg_wll_Context) calloc(1, sizeof(*ctx))) ) {
+ if ( edg_wll_InitContext(&ctx) ) {
fprintf(stderr, "Couldn't create context");
return -1;
}
ctx->semset = semset;
ctx->semaphores = semaphores;
- ctx->p_tmp_timeout.tv_sec = SLAVE_TIMEOUT;
- ctx->p_tmp_timeout.tv_usec = 0;
- if ( total_to.tv_sec < ctx->p_tmp_timeout.tv_sec ) {
- ctx->p_tmp_timeout.tv_sec = total_to.tv_sec;
- ctx->p_tmp_timeout.tv_usec = total_to.tv_usec;
- }
-
ctx->srvName = strdup(host);
ctx->srvPort = atoi(port);
{ "debug", no_argument, NULL, 'd'},
{ "msg", required_argument, NULL, 'm'},
{ "port", required_argument, NULL, 'p'},
+ { "repeat", required_argument, NULL, 'r'},
};
int debug = 0;
int opt,
sock,
n;
-
+ int repeat = 1;
me = strrchr(argv[0], '/');
if ( me ) me++; else me = argv[0];
- while ( (opt = getopt_long(argc, argv,"p:m:hd", opts, NULL)) != EOF )
+ while ( (opt = getopt_long(argc, argv,"p:m:hdr:", opts, NULL)) != EOF )
{
switch ( opt )
{
port = atoi(optarg);
break;
case 'd': debug = 1; break;
+ case 'r': repeat = atoi(optarg); break;
case 'h': usage(me); return 0;
case '?': usage(me); return 1;
}
exit(1);
}
n = strlen(msg? msg: DEF_MSG);
- if ( writen(sock, msg? msg: DEF_MSG, n) != n )
- {
- dprintf(("error writing message\n"));
- exit(1);
- }
- printf("reply: "); fflush(stdout);
- n = readln(sock, buff);
- if ( n < 0 )
- {
- perror("read() reply error");
- return 1;
+ for (;repeat; repeat--) {
+ if ( writen(sock, msg? msg: DEF_MSG, n) != n )
+ {
+ dprintf(("error writing message\n"));
+ exit(1);
+ }
+ printf("reply: "); fflush(stdout);
+ n = readln(sock, buff);
+ if ( n < 0 )
+ {
+ perror("read() reply error");
+ return 1;
+ }
+ writen(0, buff, n);
}
- writen(0, buff, n);
close(sock);
return 0;
-#Sat Oct 15 06:44:59 CEST 2005
-module.build=111
+#Fri Mar 17 04:45:35 CET 2006
+module.build=0193
#Fri Sep 02 14:17:59 CEST 2005
-module.version=2.1.0
+module.version=2.1.4
module.build=2
module.age=1
#define SLAVES_COUNT 5 /* default number of slaves */
#define SLAVE_OVERLOAD 10 /* queue items per slave */
-#define SLAVE_CONNS_MAX 500 /* commit suicide after that many connections */
+#define SLAVE_REQS_MAX 500 /* commit suicide after that many connections */
#define IDLE_TIMEOUT 30 /* keep idle connection that many seconds */
#define CONNECT_TIMEOUT 5 /* timeout for establishing a connection */
#define REQUEST_TIMEOUT 10 /* timeout for a single request */
+#define NEW_CLIENT_DURATION 10 /* how long a client is considered new, i.e. busy
+ connection is not closed to serve other clients */
#ifndef dprintf
#define dprintf(x) { if (debug) printf x; }
static int set_slaves_ct = SLAVES_COUNT;
static int set_slave_overload = SLAVE_OVERLOAD;
-static int set_slave_conns_max = SLAVE_CONNS_MAX;
+static int set_slave_reqs_max = SLAVE_REQS_MAX;
static struct timeval set_idle_to = {IDLE_TIMEOUT, 0};
static struct timeval set_connect_to = {CONNECT_TIMEOUT, 0};
static struct timeval set_request_to = {REQUEST_TIMEOUT, 0};
else
{
services[sidx].on_reject_hnd(conn);
- dprintf(("[master] Reject due to overload\n"));
+ dprintf(("[master] Rejected new connection due to overload\n"));
+ if ( !debug ) syslog(LOG_ERR, "Rejected new connection due to overload\n");
}
close(conn);
sigset_t sset;
struct sigaction sa;
struct timeval client_done,
- client_start;
+ client_start,
+ new_client_duration = { NEW_CLIENT_DURATION, 0 };
void *clnt_data = NULL;
int conn = -1,
srv = -1,
- conn_cnt = 0,
+ req_cnt = 0,
sockflags,
h_errno,
pid, i,
- first_request = 0;
+ first_request = 0; /* 1 -> first request from connected client expected */
*/
exit(1);
- while ( !die && (conn_cnt < set_slave_conns_max || conn >= 0) )
+ while ( !die && (req_cnt < set_slave_reqs_max || (conn >= 0 && first_request)))
{
fd_set fds;
int max = sock,
connflags,
newconn = -1,
- newsrv = -1,
- kick_client = 0;
+ newsrv = -1;
+
+ enum { KICK_DONT = 0, KICK_IDLE, KICK_LOAD, KICK_HANDLER, KICK_COUNT }
+ kick_client = KICK_DONT;
+
static char * kicks[] = {
"don't kick",
"idle client",
"high load",
- "no request handler"
+ "no request handler",
+ "request count limit reached",
};
unsigned long seq;
struct timeval now,to;
sigprocmask(SIG_BLOCK, &sset, NULL);
gettimeofday(&now,NULL);
- if (conn >= 0 && check_timeout(set_idle_to, client_done, now)) kick_client = 1;
- if ( conn >= 0 && !kick_client && FD_ISSET(conn, &fds) )
+ if ( conn >= 0 && FD_ISSET(conn, &fds) )
{
/*
* serve the request
int rv;
dprintf(("[%d] incoming request\n", getpid()));
+
if ( !services[srv].on_request_hnd )
{
- kick_client = 3;
+ kick_client = KICK_HANDLER;
} else {
-
+ req_cnt++;
first_request = 0;
to = set_request_to;
if ((rv = services[srv].on_request_hnd(conn,to.tv_sec>=0 ? &to : NULL,clnt_data)) == ENOTCONN) {
gettimeofday(&client_done, NULL);
}
- continue;
+ if (!check_timeout(new_client_duration,client_start,now)) continue;
}
+ } else {
+ if (conn >= 0 && check_timeout(set_idle_to, client_done, now))
+ kick_client = KICK_IDLE;
}
- if ( !first_request && FD_ISSET(sock, &fds) && conn_cnt < set_slave_conns_max )
+ if ( (conn < 0 || !first_request) && FD_ISSET(sock, &fds) && req_cnt < set_slave_reqs_max )
{
- if ( conn >= 0 ) usleep(100000 + 1000 * (random() % 200));
+ /* Prefer slaves with no connection, then kick idle clients,
+ * active ones last. Wait less if we have serviced a request in the meantime.
+ * Tuned for HZ=100 timer. */
+ if ( conn >= 0 ) usleep( kick_client || FD_ISSET(conn, &fds) ? 11000 : 21000);
if ( do_recvmsg(sock, &newconn, &seq, &newsrv) ) switch ( errno )
{
case EINTR: /* XXX: signals are blocked */
if (!debug) syslog(LOG_CRIT,"recvmsg(): %m\n");
exit(1);
}
- kick_client = 2;
+ kick_client = KICK_LOAD;
}
+ if (req_cnt >= set_slave_reqs_max && !first_request) kick_client = KICK_COUNT;
+
if ( kick_client && conn >= 0 )
{
if ( services[srv].on_disconnect_hnd )
conn = newconn;
srv = newsrv;
gettimeofday(&client_start, NULL);
- client_done.tv_sec = client_start.tv_sec;
- client_done.tv_usec = client_start.tv_usec;
switch ( send(sock, &seq, sizeof(seq), 0) )
{
exit(1);
}
- conn_cnt++;
+ req_cnt++;
dprintf(("[%d] serving %s connection %lu\n", getpid(),
services[srv].id? services[srv].id: "", seq));
conn = srv = -1;
continue;
}
+ gettimeofday(&client_done, NULL);
first_request = 1;
}
}
dprintf(("[%d] Terminating on signal %d\n", getpid(), die));
if ( !debug ) syslog(LOG_INFO, "Terminating on signal %d", die);
}
- dprintf(("[%d] Terminating after %d connections\n", getpid(), conn_cnt));
- if ( !debug ) syslog(LOG_INFO, "Terminating after %d connections", conn_cnt);
+
+ if (conn >= 0 && services[srv].on_disconnect_hnd )
+ services[srv].on_disconnect_hnd(conn, NULL, clnt_data);
+
+ dprintf(("[%d] Terminating after %d requests\n", getpid(), req_cnt));
+ if ( !debug ) syslog(LOG_INFO, "Terminating after %d requests", req_cnt);
exit(0);
static void glite_srvbones_set_slave_conns_max(int n)
{
- set_slave_conns_max = (n == -1)? SLAVE_CONNS_MAX: n;
+ set_slave_reqs_max = (n == -1)? SLAVE_REQS_MAX: n;
}
static void set_timeout(struct timeval *to, struct timeval *val)
#!/bin/sh
GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite}
-GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-${GLITE_LOCATION}/var}
+GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/var/glite}
[ -f /etc/glite.conf ] && . /etc/glite.conf
[ -f $GLITE_LOCATION/etc/glite-wms.conf ] && . $GLITE_LOCATION/etc/glite-wms.conf
status()
{
+ retval=0
+
if netstat -an --unix | grep "^unix .* LISTEN.* /tmp/glite-lb-notif.sock$" >/dev/null 2>&1 ;then
echo glite-lb-notif-interlogd running
else
echo glite-lb-notif-interlogd not running
- return 1
+ retval=1
fi
if [ -f $pidfile ]; then
pid=`cat $pidfile`
if ps p $pid >/dev/null 2>&1; then
echo glite-lb-bkserverd running as $pid
- return 0
+ else
+ echo glite-lb-bkserverd not running
+ retval=1
fi
+ else
+ echo glite-lb-bkserverd not running
+ retval=1
fi
- echo glite-lb-bkserverd not running
- return 1
+ return $retval
}
case x$1 in
-#Sat Oct 15 06:56:05 CEST 2005
-module.build=154
+#Fri Mar 17 04:52:54 CET 2006
+module.build=0237
Revision history:
$Log$
+ Revision 1.8 2005/09/19 15:24:20 akrenek
+ "The gigantic merge"; from release 1.4 branch to HEAD
+
Revision 1.7.2.1 2005/08/09 15:02:10 jskrabal
- build with broken gsoap 2.7.0 repository package
#Fri Sep 02 14:18:35 CEST 2005
-module.version=1.3.0
+module.version=1.3.8
module.build=2
module.age=1
#include "glite/lb/context.h"
#include "glite/lb/mini_http.h"
#include "glite/lb/context-int.h"
+#include "glite/lb/lb_maildir.h"
#include "lb_http.h"
#include "lb_proto.h"
#define CON_QUEUE 20 /* accept() */
#define SLAVE_OVERLOAD 10 /* queue items per slave */
-#define CLNT_TIMEOUT 10 /* keep idle connection that many seconds */
-#define TOTAL_CLNT_TIMEOUT 60 /* one client may ask one slave multiple times */
+#define CONNECT_TIMEOUT 30
+#define IDLE_TIMEOUT 10 /* keep idle connection that many seconds */
+#define REQUEST_TIMEOUT 120 /* one client may ask one slave multiple times */
/* but only limited time to avoid DoS attacks */
-#define CLNT_REJECT_TIMEOUT 100000 /* time limit for client rejection in !usec! */
#define DNS_TIMEOUT 5 /* how long wait for DNS lookup */
#define SLAVE_CONNS_MAX 500 /* commit suicide after that many connections */
-#define MASTER_TIMEOUT 30 /* maximal time of one-round of master network communication */
-#define SLAVE_TIMEOUT 30 /* maximal time of one-round of slave network communication */
#ifndef EDG_PURGE_STORAGE
#define EDG_PURGE_STORAGE "/tmp/purge"
int opt;
char pidfile[PATH_MAX] = EDG_BKSERVERD_PIDFILE,
*port,
- *name,
- *tmps;
+ *name;
#ifdef GLITE_LB_SERVER_WITH_WS
char *ws_port;
#endif /* GLITE_LB_SERVER_WITH_WS */
if (check_mkdir(dumpStorage)) exit(1);
if (check_mkdir(purgeStorage)) exit(1);
if ( jpreg ) {
- if ( edg_wll_MaildirInit(jpregDir, &tmps) ) {
- dprintf(("[%d] %s\n", getpid(), tmps));
- if (!debug) syslog(LOG_CRIT, tmps);
+ if ( edg_wll_MaildirInit(jpregDir) ) {
+ dprintf(("[%d] edg_wll_MaildirInit failed: %s\n", getpid(), lbm_errdesc));
+ if (!debug) syslog(LOG_CRIT, "edg_wll_MaildirInit failed: %s", lbm_errdesc);
exit(1);
}
}
glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT, slaves);
glite_srvbones_set_param(GLITE_SBPARAM_SLAVE_OVERLOAD, SLAVE_OVERLOAD);
glite_srvbones_set_param(GLITE_SBPARAM_SLAVE_CONNS_MAX, SLAVE_CONNS_MAX);
- /* XXX
- * not final version - yet!
- */
- to = (struct timeval){CLNT_TIMEOUT, 0};
+
+ to = (struct timeval){CONNECT_TIMEOUT, 0};
glite_srvbones_set_param(GLITE_SBPARAM_CONNECT_TIMEOUT, &to);
- to = (struct timeval){CLNT_TIMEOUT, 0};
+ to = (struct timeval){REQUEST_TIMEOUT, 0};
glite_srvbones_set_param(GLITE_SBPARAM_REQUEST_TIMEOUT, &to);
- to = (struct timeval){TOTAL_CLNT_TIMEOUT, 0};
+ to = (struct timeval){IDLE_TIMEOUT, 0};
glite_srvbones_set_param(GLITE_SBPARAM_IDLE_TIMEOUT, &to);
glite_srvbones_run(bk_clnt_data_init, service_table, sizofa(service_table), debug);
OM_uint32 min_stat,
maj_stat;
struct timeval dns_to = {DNS_TIMEOUT, 0},
- total_to = { TOTAL_CLNT_TIMEOUT,0 },
conn_start, now;
struct sockaddr_in a;
int alen;
ctx->rgma_export = rgma_export;
memcpy(ctx->purge_timeout, purge_timeout, sizeof(ctx->purge_timeout));
- ctx->p_tmp_timeout.tv_sec = SLAVE_TIMEOUT;
- ctx->p_tmp_timeout.tv_usec = 0;
- if ( total_to.tv_sec < ctx->p_tmp_timeout.tv_sec )
- {
- ctx->p_tmp_timeout.tv_sec = total_to.tv_sec;
- ctx->p_tmp_timeout.tv_usec = total_to.tv_usec;
- }
+ ctx->p_tmp_timeout.tv_sec = timeout->tv_sec;
+ ctx->p_tmp_timeout.tv_usec = timeout->tv_usec;
ctx->poolSize = 1;
ctx->connPool = calloc(1, sizeof(edg_wll_ConnPool));
gettimeofday(&conn_start, 0);
- /* not a critical operation, do not waste all SLAVE_TIMEOUT */
h_errno = asyn_gethostbyaddr(&name, (char *)&a.sin_addr.s_addr,sizeof(a.sin_addr.s_addr), AF_INET, &dns_to);
switch ( h_errno )
{
case ETIMEDOUT:
case EDG_WLL_ERROR_GSS:
case EPIPE:
+ case EIO:
dprintf(("[%d] %s (%s)\n", getpid(), errt, errd));
if (!debug) syslog(LOG_ERR,"%s (%s)", errt, errd);
/* fallthrough
}
if ( err ) {
- char *errt, *errd;
- int ret;
-
-
- errt = errd = NULL;
- switch ( (ret = edg_wll_Error(ctx, &errt, &errd)) ) {
- case ETIMEDOUT:
- case EDG_WLL_ERROR_GSS:
- case EPIPE:
- dprintf(("[%d] %s (%s)\n", getpid(), errt, errd));
- if (!debug) syslog(LOG_ERR,"%s (%s)", errt, errd);
- /* "recoverable" error - return (>0)
- * fallthrough
- */
- case ENOTCONN:
- /* "recoverable" error - return (>0)
- * return ENOTCONN to tell bones to clean up
- */
- free(errt); free(errd);
- return ret;
- break;
-
- case ENOENT:
- case EINVAL:
- case EPERM:
- case EEXIST:
- case EDG_WLL_ERROR_NOINDEX:
- case E2BIG:
- dprintf(("[%d] %s (%s)\n", getpid(), errt, errd));
- if ( !debug ) syslog(LOG_ERR,"%s (%s)", errt, errd);
- /*
- * no action for non-fatal errors
- */
- break;
-
- default:
- dprintf(("[%d] %s (%s)\n", getpid(), errt, errd));
- if (!debug) syslog(LOG_CRIT,"%s (%s)",errt,errd);
- /*
- * unknown error - do rather return (<0) (slave will be killed)
- */
- return -1;
- }
- free(errt); free(errd);
- return 1;
+ // soap_print_fault(struct soap *soap, FILE *fd) maybe useful here
+ dprintf(("[%d] SOAP error (bk_accept_ws) \n", getpid()));
+ if (!debug) syslog(LOG_CRIT,"SOAP error (bk_accept_ws)");
+ return ECANCELED;
}
return 0;
/*
* send event to the proper BK server
*/
- if ( ev->any.type != EDG_WLL_EVENT_REGJOB
- && edg_wll_EventSendProxy(ctx, ev->any.jobId, event) ) goto err;
+ /* XXX: RegJob events, which were logged also directly, are duplicated at server,
+ but it should not harm */
+
+ if (edg_wll_EventSendProxy(ctx, ev->any.jobId, event) ) {
+ edg_wll_SetError(ctx, EDG_WLL_IL_PROTO, "edg_wll_EventSendProxy() error.");
+ goto err;
+ }
/* LB proxy purge
* XXX: Set propper set of states!
switch ( ev->any.type ) {
case EDG_WLL_EVENT_CLEAR:
case EDG_WLL_EVENT_ABORT:
- case EDG_WLL_EVENT_CANCEL:
- case EDG_WLL_EVENT_DONE:
edg_wll_PurgeServerProxy(ctx, ev->any.jobId);
break;
+ case EDG_WLL_EVENT_CANCEL:
+ if (ev->cancel.status_code == EDG_WLL_CANCEL_DONE)
+ edg_wll_PurgeServerProxy(ctx, ev->any.jobId);
+ break;
default: break;
}
} else {
const edg_wlc_JobId jobid,
const char *event)
{
- struct timeval timeout;
long filepos;
char *jobid_s,
*event_file = NULL;
edg_wll_ResetError(ctx);
- timeout.tv_sec = EDG_WLL_LOG_TIMEOUT_MAX;
- timeout.tv_usec = 0;
-
jobid_s = edg_wlc_JobIdGetUnique(jobid);
if ( !jobid_s ) {
edg_wll_SetError(ctx, ENOMEM, "edg_wlc_JobIdGetUnique()");
}
if ( edg_wll_log_event_write(ctx, event_file, event,
- FCNTL_ATTEMPTS, FCNTL_TIMEOUT, &filepos) ) {
+ (ctx->p_tmp_timeout.tv_sec > FCNTL_ATTEMPTS ?
+ ctx->p_tmp_timeout.tv_sec : FCNTL_ATTEMPTS),
+ FCNTL_TIMEOUT, &filepos) ) {
+
edg_wll_UpdateError(ctx, 0, "edg_wll_log_event_write()");
_err(1);
}
if ( edg_wll_log_event_send(ctx, lbproxy_ilog_socket_path, filepos,
- event, strlen(event), 1, &timeout) ) {
+ event, strlen(event), 1, &ctx->p_tmp_timeout) ) {
edg_wll_UpdateError(ctx, 0, "edg_wll_log_event_send()");
_err(-1);
}
event->any.level = context->p_level;
event->any.source = context->p_source;
if (context->p_instance) event->notification.src_instance = strdup(context->p_instance);
- event->notification.notifId = reg_id;
+ event->notification.notifId = edg_wll_NotifIdDup(reg_id);
if (owner) event->notification.owner = strdup(owner);
if (host) event->notification.dest_host = strdup(host);
event->notification.dest_port = port;
int before_deep_resubmission(const char *, const char *);
int same_branch(const char *, const char *);
int component_seqcode(const char *a, edg_wll_Source index);
+char * set_component_seqcode(char *s,edg_wll_Source index,int val);
int processEvent(intJobStat *, edg_wll_Event *, int, int, char **);
int add_stringlist(char ***, const char *);
int edg_wll_compare_seq(const char *, const char *);
void init_intJobStat(intJobStat *p);
+
return(c[index]);
}
+char * set_component_seqcode(char *s,edg_wll_Source index,int val)
+{
+ unsigned int c[EDG_WLL_SOURCE__LAST];
+ int res;
+ char *ret;
+
+ res = sscanf(s, "UI=%d:NS=%d:WM=%d:BH=%d:JSS=%d:LM=%d:LRMS=%d:APP=%d",
+ &c[EDG_WLL_SOURCE_USER_INTERFACE],
+ &c[EDG_WLL_SOURCE_NETWORK_SERVER],
+ &c[EDG_WLL_SOURCE_WORKLOAD_MANAGER],
+ &c[EDG_WLL_SOURCE_BIG_HELPER],
+ &c[EDG_WLL_SOURCE_JOB_SUBMISSION],
+ &c[EDG_WLL_SOURCE_LOG_MONITOR],
+ &c[EDG_WLL_SOURCE_LRMS],
+ &c[EDG_WLL_SOURCE_APPLICATION]);
+ if (res != EDG_WLL_SOURCE__LAST-1) {
+ syslog(LOG_ERR, "unparsable sequence code %s\n", s);
+ fprintf(stderr, "unparsable sequence code %s\n", s);
+ return NULL;
+ }
+
+ c[index] = val;
+ trio_asprintf(&ret,"UI=%06d:NS=%010d:WM=%06d:BH=%010d:JSS=%06d"
+ ":LM=%06d:LRMS=%06d:APP=%06d",
+ c[EDG_WLL_SOURCE_USER_INTERFACE],
+ c[EDG_WLL_SOURCE_NETWORK_SERVER],
+ c[EDG_WLL_SOURCE_WORKLOAD_MANAGER],
+ c[EDG_WLL_SOURCE_BIG_HELPER],
+ c[EDG_WLL_SOURCE_JOB_SUBMISSION],
+ c[EDG_WLL_SOURCE_LOG_MONITOR],
+ c[EDG_WLL_SOURCE_LRMS],
+ c[EDG_WLL_SOURCE_APPLICATION]);
+ return ret;
+}
+
int before_deep_resubmission(const char *a, const char *b)
{
if (component_seqcode(a, EDG_WLL_SOURCE_WORKLOAD_MANAGER) <
{
const edg_wll_Event *e = (edg_wll_Event *)a;
const edg_wll_Event *f = (edg_wll_Event *)b;
+ int ret;
- return edg_wll_compare_seq(e->any.seqcode, f->any.seqcode);
+ ret = edg_wll_compare_seq(e->any.seqcode, f->any.seqcode);
+ if (ret) return ret;
+
+ if (e->any.timestamp.tv_sec < f->any.timestamp.tv_sec) return -1;
+ if (e->any.timestamp.tv_sec > f->any.timestamp.tv_sec) return 1;
+ if (e->any.timestamp.tv_usec < f->any.timestamp.tv_usec) return -1;
+ if (e->any.timestamp.tv_usec > f->any.timestamp.tv_usec) return 1;
+ return 0;
}
void edg_wll_SortEvents(edg_wll_Event *e)
int err;
int retry_nr = 0;
int do_reconnect = 0;
+ struct timeval start,end;
+ int pid;
edg_wll_ResetError(ctx);
*stmt = NULL;
}
+#ifdef LBS_DB_PROFILE
+ gettimeofday(&start,NULL);
+#endif
+
while (retry_nr == 0 || do_reconnect) {
do_reconnect = 0;
if (mysql_query((MYSQL *) ctx->mysql,txt)) {
MYSQL_RES *r = mysql_store_result((MYSQL *) ctx->mysql);
mysql_free_result(r);
}
+#ifdef LBS_DB_PROFILE
+ gettimeofday(&end,NULL);
+ end.tv_usec -= start.tv_usec;
+ end.tv_sec -= start.tv_sec;
+ if (end.tv_usec < 0) { end.tv_sec--; end.tv_usec += 1000000; }
+
+ pid = getpid();
+ fprintf(stderr,"[%d] %s\n[%d] %3ld.%06ld\n",pid,txt,pid,end.tv_sec,end.tv_usec);
+#endif
return mysql_affected_rows((MYSQL *) ctx->mysql);
}
+#ident "$Header$"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
+#include <syslog.h>
#include "glite/lb/producer.h"
#include "glite/lb/context-int.h"
}
}
+// clear branches (deep resub. or abort)
+static void reset_branch(intJobStat *js, edg_wll_Event *e)
+{
+ js->resubmit_type = EDG_WLL_RESUBMISSION_WILLRESUB;
+ free_stringlist(&js->pub.possible_destinations);
+ free_stringlist(&js->pub.possible_ce_nodes);
+ free_branch_state(&js->branch_states);
+ js->pub.payload_running = 0;
+ rep(js->branch_tag_seqcode, NULL);
+ rep(js->deep_resubmit_seqcode, e->any.seqcode);
+}
static char* location_string(const char *source, const char *host, const char *instance)
{
return ret;
}
+static int after_enter_wm(const char *es,const char *js)
+{
+ return component_seqcode(es,EDG_WLL_SOURCE_NETWORK_SERVER) >
+ component_seqcode(js,EDG_WLL_SOURCE_NETWORK_SERVER);
+}
+
static int badEvent(intJobStat *js UNUSED_VAR, edg_wll_Event *e, int ev_seq UNUSED_VAR)
{
return RET_FATAL;
}
+// (?) || (0 && 1) => true if (res == RET_OK)
#define USABLE(res,strict) ((res) == RET_OK || ( (res) == RET_SOON && !strict))
+
+// (?) || (1 && 1) => always true
#define USABLE_DATA(res,strict) ((res) == RET_OK || ( (res) != RET_FATAL && !strict))
+
#define USABLE_BRANCH(fine_res) ((fine_res) != RET_TOOOLD && (fine_res) != RET_BADBRANCH)
#define LRMS_STATE(state) ((state) == EDG_WLL_JOB_RUNNING || (state) == EDG_WLL_JOB_DONE)
-
+#define PARSABLE_SEQCODE(code) (component_seqcode((code),0) >= 0)
int processEvent(intJobStat *js, edg_wll_Event *e, int ev_seq, int strict, char **errstring)
{
int res = RET_OK,
fine_res = RET_OK;
-
+ int lm_favour_lrms = 0;
if (old_state == EDG_WLL_JOB_ABORTED ||
old_state == EDG_WLL_JOB_CANCELLED ||
res = RET_LATE;
}
+/* new event coming from NS => forget about any resubmission loops */
+ if (e->type != EDG_WLL_EVENT_CANCEL &&
+ js->last_seqcode &&
+ after_enter_wm(e->any.seqcode,js->last_seqcode))
+ {
+ rep(js->branch_tag_seqcode,NULL);
+ rep(js->deep_resubmit_seqcode,NULL);
+ rep(js->last_branch_seqcode,NULL);
+ }
if (js->deep_resubmit_seqcode &&
before_deep_resubmission(e->any.seqcode, js->deep_resubmit_seqcode)) {
}
else if (js->branch_tag_seqcode) { // ReallyRunning ev. arrived
if (same_branch(e->any.seqcode, js->branch_tag_seqcode)) {
- if ((js->last_seqcode != NULL) &&
+ if ((js->last_branch_seqcode != NULL) &&
edg_wll_compare_seq(e->any.seqcode, js->last_branch_seqcode) < 0) {
res = RET_LATE;
}
e->any.timestamp.tv_sec;
res = RET_LATE;
}
- new_state = EDG_WLL_JOB_SCHEDULED; break;
+ new_state = EDG_WLL_JOB_SCHEDULED;
+ lm_favour_lrms = 1;
+ break;
default:
goto bad_event; break;
}
new_state = EDG_WLL_JOB_WAITING; break;
case EDG_WLL_SOURCE_LOG_MONITOR:
if (LRMS_STATE(old_state)) res = RET_LATE;
- new_state = EDG_WLL_JOB_READY; break;
+ new_state = EDG_WLL_JOB_READY;
+ lm_favour_lrms = 1;
+ break;
case EDG_WLL_SOURCE_LRMS:
new_state = EDG_WLL_JOB_SCHEDULED; break;
default:
if (USABLE_BRANCH(fine_res)) {
rep(js->pub.ce_node, e->running.node);
}
- if (e->any.source == EDG_WLL_SOURCE_LOG_MONITOR) {
+ /* why? if (e->any.source == EDG_WLL_SOURCE_LOG_MONITOR) { */
if (e->running.node) {
update_branch_state(e->any.seqcode, NULL,
e->running.node, NULL, &js->branch_states);
add_stringlist(&js->pub.possible_ce_nodes,
e->running.node);
}
- }
+ /* } */
}
break;
case EDG_WLL_EVENT_REALLYRUNNING:
+ /* consistence check -- should not receive two contradicting ReallyRunning's within single
+ deep resub cycle */
+ if (fine_res == RET_BADBRANCH) {
+ syslog(LOG_ERR,"ReallyRunning on bad branch %s",
+ e->any.source == EDG_WLL_SOURCE_LOG_MONITOR ? e->reallyRunning.wn_seq : e->any.seqcode);
+ break;
+ }
+ /* select the branch unless TOOOLD, i.e. before deep resubmission */
+ if (!(res == RET_LATE && fine_res == RET_TOOOLD)) {
+ if (e->any.source == EDG_WLL_SOURCE_LRMS) {
+ rep(js->branch_tag_seqcode, e->any.seqcode);
+ if (res == RET_OK) {
+ rep(js->last_branch_seqcode, e->any.seqcode);
+ js->pub.state = EDG_WLL_JOB_RUNNING;
+ }
+ }
+ if (e->any.source == EDG_WLL_SOURCE_LOG_MONITOR) {
+ if (!js->branch_tag_seqcode) {
+ if (PARSABLE_SEQCODE(e->reallyRunning.wn_seq)) {
+ rep(js->branch_tag_seqcode, e->reallyRunning.wn_seq);
+ } else
+ goto bad_event;
+ }
+ if (!js->last_branch_seqcode) {
+ if (PARSABLE_SEQCODE(e->reallyRunning.wn_seq)) {
+ if (res == RET_OK) {
+ rep(js->last_branch_seqcode, e->reallyRunning.wn_seq);
+ js->pub.state = EDG_WLL_JOB_RUNNING;
+ }
+ } else
+ goto bad_event;
+ }
+ }
+
+ /* XXX: best effort -- if we are lucky, ReallyRunning is on the last shallow cycle,
+ so we take in account events processed so far */
+ if (res == RET_LATE && !js->last_branch_seqcode) {
+ if (same_branch(js->last_seqcode,js->branch_tag_seqcode))
+ rep(js->last_branch_seqcode,js->last_seqcode);
+ }
+
+ js->pub.payload_running = 1;
+ load_branch_state(js);
+ }
+#if 0
if (USABLE_DATA(res, strict)) {
js->pub.state = EDG_WLL_JOB_RUNNING;
free(js->pub.location);
rep(js->last_branch_seqcode, e->any.seqcode);
}
if (e->any.source == EDG_WLL_SOURCE_LOG_MONITOR) {
- rep(js->branch_tag_seqcode, e->reallyRunning.wn_seq);
- rep(js->last_branch_seqcode, e->reallyRunning.wn_seq);
+ if (!js->branch_tag_seqcode) {
+ if (PARSABLE_SEQCODE(e->reallyRunning.wn_seq)) {
+ rep(js->branch_tag_seqcode, e->reallyRunning.wn_seq);
+ } else
+ goto bad_event;
+ }
+ if (!js->last_branch_seqcode) {
+ if (PARSABLE_SEQCODE(e->reallyRunning.wn_seq)) {
+ rep(js->last_branch_seqcode, e->reallyRunning.wn_seq);
+ } else
+ goto bad_event;
+ }
}
-
load_branch_state(js);
}
+#endif
break;
case EDG_WLL_EVENT_RESUBMISSION:
if (USABLE(res, strict)) {
else
if (e->resubmission.result == EDG_WLL_RESUBMISSION_WILLRESUB &&
e->any.source == EDG_WLL_SOURCE_WORKLOAD_MANAGER) {
- js->resubmit_type = EDG_WLL_RESUBMISSION_WILLRESUB;
- free_stringlist(&js->pub.possible_destinations);
- free_stringlist(&js->pub.possible_ce_nodes);
- free_branch_state(&js->branch_states);
- js->pub.payload_running = 0;
- rep(js->branch_tag_seqcode, NULL);
- rep(js->deep_resubmit_seqcode, e->any.seqcode);
+ reset_branch(js, e);
}
else
if (e->resubmission.result == EDG_WLL_RESUBMISSION_SHALLOW) {
js->resubmit_type = EDG_WLL_RESUBMISSION_SHALLOW;
- rep(js->deep_resubmit_seqcode, NULL);
+ // deep resubmit stays forever deadline for events
+ // rep(js->deep_resubmit_seqcode, NULL);
}
}
break;
}
break;
case EDG_WLL_EVENT_ABORT:
+ // XXX: accept Abort from WM in every case
+ // setting res make USABLE macro true (awful !!)
+ if (e->any.source == EDG_WLL_SOURCE_WORKLOAD_MANAGER) res = RET_OK;
if (USABLE(res, strict)) {
js->pub.state = EDG_WLL_JOB_ABORTED;
rep(js->pub.reason, e->abort.reason);
rep(js->pub.location, "none");
- js->pub.payload_running = 0;
+
+ reset_branch(js, e);
}
break;
js->pub.stateEnterTimes[1 + js->pub.state]
= (int)js->pub.lastUpdateTime.tv_sec;
}
+ if (e->any.type == EDG_WLL_EVENT_CANCEL) {
+ rep(js->last_cancel_seqcode, e->any.seqcode);
+ } else {
+
+/* the first set of LM events (Accept, Transfer/* -> LRMS)
+ should not should shift the state (to Ready, Scheduled) but NOT to
+ update js->last_seqcode completely, in order not to block following
+ LRMS events which are likely to arrive later but should still affect
+ job state (as there may be no more LM events due to the Condor bug).
+ However, don't ignore the incoming seqcode completely, to catch up
+ with possibly delayed WM/JSS events */
+
+ if (lm_favour_lrms) {
+ free(js->last_seqcode);
+ js->last_seqcode = set_component_seqcode(e->any.seqcode,EDG_WLL_SOURCE_LOG_MONITOR,0);
+ }
+ else rep(js->last_seqcode, e->any.seqcode);
+ }
+
+ if (fine_res == RET_GOODBRANCH) {
+ rep(js->last_branch_seqcode, e->any.seqcode);
+ }
}
if (USABLE_DATA(res,strict)) {
}
}
- if (e->any.type == EDG_WLL_EVENT_CANCEL) {
- rep(js->last_cancel_seqcode, e->any.seqcode);
- } else {
- rep(js->last_seqcode, e->any.seqcode);
- }
-
- if (fine_res == RET_GOODBRANCH) {
- rep(js->last_branch_seqcode, e->any.seqcode);
- }
-
return res;
bad_event:
goto cleanup;
if (event_conditions && *event_conditions && (*event_conditions)->attr &&
- !(event_where = ec_to_head_where(ctx,event_conditions)))
+ !(event_where = ec_to_head_where(ctx,event_conditions)) &&
+ edg_wll_Error(ctx,NULL,NULL) != 0)
goto cleanup;
if ( job_conditions && *job_conditions && (*job_conditions)->attr &&
trio_asprintf(&out, "%s OR (e.time_stamp >= %s AND e.time_stamp <= %s)", conds, aux, dbt);
free(aux);
}
+ else if (ec[m][n].op == EDG_WLL_QUERY_OP_EQUAL) {
+ trio_asprintf(&out, "%s OR (e.time_stamp = %s AND e.usec = %d)",
+ conds, dbt, ec[m][n].value.t.tv_usec);
+ }
else
trio_asprintf(&out, "%s OR e.time_stamp %s %s", conds, opToString(ec[m][n].op), dbt);
free(conds);
trio_asprintf(&conds, "(e.time_stamp >= %s AND e.time_stamp <= %s)", aux, dbt);
free(aux);
}
+ else if (ec[m][n].op == EDG_WLL_QUERY_OP_EQUAL) {
+ trio_asprintf(&conds, "(e.time_stamp = %s AND e.usec = %d)",
+ dbt, ec[m][n].value.t.tv_usec);
+ }
else
trio_asprintf(&conds, "e.time_stamp %s %s", opToString(ec[m][n].op), dbt);
break;
free(aux);
}
else
- trio_asprintf(&tmps, "%s OR s.%s %s s.%s", conds, cname, opToString(jc[m][n].op), dbt);
+ trio_asprintf(&tmps, "%s OR s.%s %s %s", conds, cname, opToString(jc[m][n].op), dbt);
free(conds);
conds = tmps;
{
trio_asprintf(&aux, "%s", dbt);
dbt = edg_wll_TimeToDB(jc[m][n].value2.t.tv_sec);
- trio_asprintf(&conds, "(%s >= s.%s AND s.%s <= %s)", cname, aux, cname, dbt);
+ trio_asprintf(&conds, "(s.%s >= %s AND s.%s <= %s)", cname, aux, cname, dbt);
free(aux);
}
else
ret = decode_il_msg(&event, buf);
if(ret < 0) {
- edg_wll_SetError(ctx,EDG_WLL_IL_PROTO,"reading event string");
+ edg_wll_SetError(ctx,EDG_WLL_IL_PROTO,"decoding event string failed");
return EDG_WLL_IL_PROTO;
}
free(stmt);
}
- free(stmt);
+ free(stmt); stmt = NULL;
if ((err = store_seq(ctx,e,next)) ||
(err = store_flesh(ctx,e,jobid,next))) {
/* attempt to cleanup, ignore new errors */
for (i=0; i<sizeof(f)/sizeof(f[0]); i++) free(f[i].val);
/* XXX: hardcoded, no other suitable place to store it */
- trio_asprintf(&stmt,"insert into short_fields(jobid,event,name,value) "
- "values ('%|Ss',%d,'SRC_INSTANCE','%|Ss')",
- jobid,no,e->any.src_instance);
- if (edg_wll_ExecStmt(ctx,stmt,NULL) < 0) err = edg_wll_Error(ctx,NULL,NULL);
- free(stmt);
+ if (!err) {
+ trio_asprintf(&stmt,"insert into short_fields(jobid,event,name,value) "
+ "values ('%|Ss',%d,'SRC_INSTANCE','%|Ss')",
+ jobid,no,e->any.src_instance);
+ if (edg_wll_ExecStmt(ctx,stmt,NULL) < 0) err = edg_wll_Error(ctx,NULL,NULL);
+ free(stmt);
+ }
return err;
}
gettimeofday(&now,NULL);
+/* XXX: increase the overall request timeout. */
+ ctx->p_tmp_timeout.tv_sec += e->nsubjobs;
+ if (ctx->p_tmp_timeout.tv_sec > 86400) ctx->p_tmp_timeout.tv_sec = 86400;
+
for (i=0; i<e->nsubjobs; i++) {
edg_wll_Event e2;
int seq;
e2.any.host = strdup(ctx->srvName);
e2.any.level = e->level;
e2.any.priority = e->priority;
- e2.any.seqcode = NULL; /* XXX: I'm not sure :-( */
+ e2.any.seqcode = strdup(EDG_WLL_SEQ_NULL);
e2.any.user = strdup(e->user);
e2.any.source = e->source;
+ e2.any.src_instance = strdup(ctx->isProxy ?
+ "L&B proxy" : "L&B server");
e2.regJob.ns = strdup(e->ns);
edg_wlc_JobIdDup(e->jobId,&e2.regJob.parent);
e2.regJob.jobtype = EDG_WLL_REGJOB_SIMPLE;
edg_wll_ResetError(ctx);
ret = read_il_data(ctx, &buf, gss_reader);
+ if (ret == EDG_WLL_GSS_ERROR_EOF)
+ return edg_wll_SetError(ctx,ENOTCONN,"client side");
if(ret < 0)
- return(ret);
+ return edg_wll_SetError(ctx,EIO,"interlogger protocol");
handle_request(ctx,buf);
free(buf);
-module.build = 0\r
+#Fri Mar 17 04:55:37 CET 2006
+module.build=0082
-#Sat Oct 15 06:34:10 CEST 2005
-module.build=54
+#Fri Mar 17 04:49:24 CET 2006
+module.build=0136
#Fri Sep 02 14:16:49 CEST 2005
-module.version=3.0.0
+module.version=2.1.0
module.build=2
module.age=1
Revision history:
$Log$
+ Revision 1.36.4.5 2005/12/02 11:15:33 akrenek
+ resolved logger dependency conflict
+
+ Revision 1.36.4.4 2005/12/02 10:04:14 jpospi
+ server depends on logger
+
+ Revision 1.36.4.3 2005/11/28 10:39:08 akrenek
+ merge bug #13928 fix on the pre_cares branch
+
+ Revision 1.36.4.2 2005/11/24 12:59:36 akrenek
+ server depends on bones
+
+ Revision 1.36.4.1 2005/11/24 12:32:02 akrenek
+ merged in "lbonly"
+
+ Revision 1.39 2005/11/27 21:51:18 eronchie
+ Applied fix for bug 13928
+
+ Revision 1.38 2005/11/22 12:13:47 eronchie
+ Removed one utils
+
+ Revision 1.37 2005/11/04 14:39:20 akrenek
+ merge in the "lbonly" hack
+
+ Revision 1.36 2005/10/15 13:36:26 akrenek
+ added lb.utils
+
+ Revision 1.35 2005/10/14 17:19:08 akrenek
+ build also lb.utils
+
Revision 1.34 2005/10/14 11:02:06 akrenek
depends on jp.primary
Revision 1.33 2005/09/19 15:23:45 akrenek
"The gigantic merge"; from release 1.4 branch to HEAD
+ Revision 1.32.2.2 2005/10/31 12:45:10 akrenek
+ conditional disabling of cross-subsystem builds via "lbonly" property
+
+ Revision 1.32.2.1 2005/08/18 10:36:05 eronchie
+ Added cross-subsystem dependencies feature in org.glite.lb subsystem.
+ Added wms-utils.jobid and security.gsoap-plugin among common dependencies.
+ Added security.voms among server dependencies.
+ At the moment I have not consider gridsite.core component.
+ Once built gridsiste component, run ant in org.glite.lb to build the whole lb
+ and its external gLite dependencies.
+
Revision 1.32 2005/08/03 11:58:25 akrenek
Merged the release 1.0 branch
<!-- component targets definitions tag = do not remove = -->
- <target name="security.gsoap-plugin" unless="setenvonly" depends="envset">
+ <target name="security.gsoap-plugin" unless="lbonly" depends="envset">
<if>
<isset property="small.memory"/>
<then>
</if>
</target>
- <target name="security.voms" unless="setenvonly" depends="envset">
+ <target name="security.voms-api-c" unless="lbonly" depends="envset">
<if>
<isset property="small.memory"/>
<then>
<exec dir="${security.subsystem.dir}" executable="${antExec}" failonerror="${failonerror}">
- <arg line="voms -Dtarget=${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
+ <arg line="voms-api-c -Dtarget=${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
</exec>
</then>
<else>
<ant dir="${security.subsystem.dir}"
- target="voms"
+ target="voms-api-c"
inheritall="false" >
<property name="target" value="${target}"/>
</ant>
</if>
</target>
- <target name="wms-utils.jobid" unless="setenvonly" depends="envset">
+ <target name="wms-utils.jobid" unless="lbonly" depends="envset">
<if>
<isset property="small.memory"/>
<then>
</if>
</target>
- <target name="jp.primary" unless="setenvonly" depends="envset">
+ <target name="jp.primary" unless="lbonly" depends="envset">
<if>
<isset property="small.memory"/>
<then>
</if>
</target>
+ <if>
+ <isset property="setenvonly"/>
+ <then>
+ <property name="lbonly" value="yes"/>
+ </then>
+ </if>
+
<target name="client-interface" unless="setenvonly" depends="envset">
<if>
<isset property="small.memory" />
</if>
</target>
- <target name="client" unless="setenvonly" depends="envset, globus,expat,ares,client-interface,common">
+ <target name="client" unless="setenvonly" depends="envset, globus, expat, ares, client-interface, common">
<if>
<isset property="small.memory" />
<then>
</if>
</target>
- <target name="server" unless="setenvonly" depends="envset, globus, expat, ares, mysql, gsoap, security.voms, jp.primary, client-interface, ws-interface, common, logger">
+ <target name="server" unless="setenvonly" depends="envset, globus, expat, ares, mysql, gsoap, security.voms-api-c, jp.primary, client-interface, ws-interface, common, server-bones, logger">
<if>
<isset property="small.memory" />
<then>
</if>
</target>
- <target name="utils" unless="setenvonly" depends="envset, globus, expat, ares, common, server">
+ <target name="proxy" unless="setenvonly" depends="envset, globus, expat, ares, client-interface, common, server, logger">
<if>
<isset property="small.memory" />
<then>
- <exec dir="${lb.subsystem.dir}.utils" executable="${antExec}" failonerror="${failonerror}">
+ <exec dir="${lb.subsystem.dir}.proxy" executable="${antExec}" failonerror="${failonerror}">
<arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
</exec>
</then>
<else>
- <ant dir="${lb.subsystem.dir}.utils"
- target="${target}"
- inheritall="false" />
+ <ant dir="${lb.subsystem.dir}.proxy"
+ target="${target}"
+ inheritall="false" />
</else>
</if>
</target>
- <target name="proxy" unless="setenvonly" depends="envset,globus,expat,ares,client-interface,common,server">
+ <target name="logger" unless="setenvonly" depends="envset, globus, expat, ares, client-interface, common">
<if>
<isset property="small.memory" />
<then>
- <exec dir="${lb.subsystem.dir}.proxy" executable="${antExec}" failonerror="${failonerror}">
+ <exec dir="${lb.subsystem.dir}.logger" executable="${antExec}" failonerror="${failonerror}">
<arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
</exec>
</then>
<else>
- <ant dir="${lb.subsystem.dir}.proxy"
+ <ant dir="${lb.subsystem.dir}.logger"
target="${target}"
inheritall="false" />
</else>
</if>
</target>
- <target name="logger" unless="setenvonly" depends="envset, globus,expat,ares,client-interface,common">
+ <target name="utils" unless="setenvonly" depends="envset, globus, expat, ares, client-interface, common, server">
<if>
- <isset property="small.memory" />
+ <isset property="small.memory"/>
<then>
- <exec dir="${lb.subsystem.dir}.logger" executable="${antExec}" failonerror="${failonerror}">
- <arg line="${target} "-Dsmall.memory=true" "-Dbootstrap=${bootstrap}" "-Dfailonerror=${failonerror}" "-Ddo.cvs.tag=${do.cvs.tag}""/>
+ <exec dir="${lb.subsystem.dir}.utils" executable="${antExec}" failonerror="${failonerror}">
+ <arg line="${target} -Dsmall.memory=true -Dbootstrap=${bootstrap} -Dfailonerror=${failonerror} -Ddo.cvs.tag=${do.cvs.tag}"/>
</exec>
</then>
<else>
- <ant dir="${lb.subsystem.dir}.logger"
- target="${target}"
- inheritall="false" />
+ <ant dir="${lb.subsystem.dir}.utils"
+ target="${target}"
+ inheritall="false" />
</else>
</if>
- </target>
+ </target>
<!-- Main proxy -->
- <target name="buildmodules" depends="envset,
+ <target name="buildmodules" depends="envset,
+ utils,
client-interface,
ws-interface,
client,
-#Fri Oct 14 12:41:13 CEST 2005
-module.build=153
+#Fri Mar 17 05:02:38 CET 2006
+module.build=0234
# System dependencies
###################################################################
-org.glite.version = HEAD
-org.glite.lb.version = HEAD
+org.glite.version = glite_R_1_5_0
+org.glite.lb.version = glite-lb_branch_1_2_0_3_pre_cares
# Component dependencies tag = do not remove this line =
-org.glite.lb.client-interface.version = HEAD
-org.glite.lb.ws-interface.version = HEAD
-org.glite.lb.common.version = HEAD
-org.glite.lb.client.version = HEAD
-org.glite.lb.server.version = HEAD
-org.glite.lb.proxy.version = HEAD
-org.glite.lb.server-bones.version = HEAD
-org.glite.lb.logger.version = HEAD
-ext.gsoap.version=2.7.0
+org.glite.lb.client-interface.version = glite-lb-client-interface_branch_2_1_0_2_pre_cares
+org.glite.lb.ws-interface.version = glite-lb-ws-interface_branch_2_1_0_2_pre_cares
+org.glite.lb.common.version = glite-lb-common_branch_3_0_0_2_pre_cares
+org.glite.lb.client.version = glite-lb-client_branch_2_1_0_2_pre_cares
+org.glite.lb.server-bones.version = glite-lb-server-bones_branch_2_1_0_2_pre_cares
+org.glite.lb.server.version = glite-lb-server_branch_1_3_0_2_pre_cares
+org.glite.lb.logger.version = glite-lb-logger_branch_1_2_0_2_pre_cares
+org.glite.lb.proxy.version = glite-lb-proxy_branch_1_2_0_2_pre_cares
+org.glite.lb.utils.version = glite-lb-utils_branch_1_0_0_1_pre_cares
+
+ext.gsoap.version = 2.7.0
Revision history:
$Log$
+ Revision 1.13.2.1 2005/10/17 16:27:48 akrenek
+ merged in the duplicate utils targed patch
+
+ Revision 1.15 2005/11/27 21:51:18 eronchie
+ Applied fix for bug 13928
+
+ Revision 1.14 2005/10/15 20:14:55 jpospi
+ remove duplicate lb.utils section
+
+ Revision 1.13 2005/10/15 13:36:26 akrenek
+ added lb.utils
+
+ Revision 1.12 2005/03/16 10:02:52 zsalvet
+ proxy component added
+
Revision 1.11 2004/12/01 18:01:55 zsalvet
LB here, not R-GMA
<!-- condition property tag = do not remove = -->
+ <condition property="utils.head">
+ <equals arg1="${org.glite.lb.utils.version}" arg2="HEAD" />
+ </condition>
+
<condition property="common.head">
<equals arg1="${org.glite.lb.common.version}" arg2="HEAD" />
</condition>
===================================================== -->
<!-- component targets tag = do not remove = -->
-
+
<!-- common -->
<target name="common" depends="evaluate.cvs.tags, get.common.head, get.common.tag"/>
<target name="get.common.head" if="common.head">
tag="${org.glite.lb.logger.version}" />
</target>
+ <!-- utils -->
+ <target name="utils" depends="get.utils.head, get.utils.tag"/>
+ <target name="get.utils.head" if="utils.head">
+ <cvs-co package="org.glite.lb.utils" />
+ </target>
+ <target name="get.utils.tag" unless="utils.head">
+ <cvs-co package="org.glite.lb.utils"
+ tag="${org.glite.lb.utils.version}" />
+ </target>
+
<!-- All project modules -->
- <target name="project" depends="client-interface,
- ws-interface,
- common,
- server-bones,
- client,
- server,
- proxy,
- logger"/>
+ <target name="project" depends="utils,
+ client-interface,
+ ws-interface,
+ common,
+ server-bones,
+ client,
+ server,
+ proxy,
+ logger"/>
<!-- ====================================================
#Fri Sep 02 14:19:10 CEST 2005
-module.version=1.2.0
+module.version=1.2.12
module.build=3
module.age=1
CC=gcc
-gsoap_versions?=2.6.2 2.7.0
+gsoap_versions?=2.6.2 2.7.0 2.7.6b
-include Makefile.inc
-include ../Makefile.inc
CFLAGS:= ${DEBUG} \
-DVERSION=\"${version}\" \
+ -DWITH_NONAMESPACES \
-I. -I${top_srcdir}/interface \
-I${stagedir}/include \
- -I${globus_prefix}/include/${nothrflavour} \
- -I${globus_prefix}/include/${nothrflavour}/openssl \
-I${ares_prefix}/include \
${COVERAGE_FLAGS} -D_GNU_SOURCE -DDATAGRID_EXTENSION
LINKXX:=libtool --mode=link ${CXX} -rpath ${stagedir}/lib ${LDFLAGS}
GLOBUS_INC:= -I${globus_prefix}/include/${nothrflavour}
+GLOBUS_THR_INC:= -I${globus_prefix}/include/${thrflavour}
+
GLOBUS_LIBS:= -L${globus_prefix}/lib \
-lglobus_common_${nothrflavour} \
-lglobus_gssapi_gsi_${nothrflavour} \
+GLOBUS_THR_LIBS:= -L${globus_prefix}/lib \
+ -lglobus_common_${thrflavour} \
+ -lglobus_gssapi_gsi_${thrflavour}
+
GSOAP_LIBS:= -L${gsoap_prefix}/lib -lgsoap
+ARES_LIBS:=-L${ares_prefix}/lib -lares
-EX_LIBS:= ${GLOBUS_LIBS} -L${ares_prefix}/lib -lares
+EX_LIBS:= ${GLOBUS_LIBS} ${ARES_LIBS}
+EX_THRLIBS := ${GLOBUS_THR_LIBS} ${ARES_LIBS}
HDRS:=glite_gss.h glite_gsplugin.h
${LINK} ${version_info} -o $@ ${GSS_LOBJS} ${EX_LIBS}
${GSS_THRLTLIB}: ${GSS_THROBJS}
- ${LINK} ${version_info} -o $@ ${GSS_THRLOBJS} ${EX_LIBS}
+ ${LINK} ${version_info} -o $@ ${GSS_THRLOBJS} ${EX_THRLIBS}
OBJS:=${GSS_OBJS} glite_gsplugin.o
${LINK} ${version_info} -o $@ ${LOBJS} ${EX_LIBS}
${THRLTLIB}: ${THROBJS}
- ${LINK} ${version_info} -o $@ ${THRLOBJS} ${EX_LIBS}
+ ${LINK} ${version_info} -o $@ ${THRLOBJS} ${EX_THRLIBS}
${STATICLIB_S}: ${OBJS_S}
ar crv $@ ${OBJS_S}
${LINK} ${version_info} -o $@ ${LOBJS_S} ${EX_LIBS}
${THRLTLIB_S}: ${THROBJS_S}
- ${LINK} ${version_info} -o $@ ${THRLOBJS_S} ${EX_LIBS}
+ ${LINK} ${version_info} -o $@ ${THRLOBJS_S} ${EX_THRLIBS}
all compile: \
${GSS_STATICLIB} ${GSS_LTLIB} ${GSS_THRSTATICLIB} ${GSS_THRLTLIB} \
${COMPILE} ${GLOBUS_THR_INC} -o $@ -c $<
test_gss.o: %.o: %.cpp
- ${CXX} -c ${CFLAGS} ${GLOBUSINC} ${TEST_INC} $<
+ ${CXX} -c ${CFLAGS} ${GLOBUS_INC} ${TEST_INC} $<
-glite_gsplugin.o: soap_version.h
+glite_gsplugin.o, glite_gsplugin.thr.o: soap_version.h
soap_version.h: stdsoap2.h
head stdsoap2.h | \
<param name="ext.gsoap.version" value="2.7.0"/>
</antcall>
+ <antcall target="gsoap" inheritAll="false">
+ <param name="ext.gsoap.version" value="2.7.6b"/>
+ <param name="ext.gsoap.platform" value="src"/>
+ </antcall>
+
<antcall target="secmakefiles" />
</target>
-module.build=0
+#Fri Mar 17 02:42:56 CET 2006
+module.build=0059
-module.version=1.2.0
+module.version=1.2.4
module.age=0
int len;
- pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_recv()\n"));
ctx = ((int_plugin_data_t *)soap_lookup_plugin(soap, plugin_id))->ctx;
if ( ctx->error_msg ) { free(ctx->error_msg); ctx->error_msg = NULL; }
/* default: fallthrough */
}
+ pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_recv() = %d\n",len));
return len;
}
int ret;
- pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_send()\n"));
ctx = ((int_plugin_data_t *)soap_lookup_plugin(soap, plugin_id))->ctx;
/* XXX: check whether ctx is initialized
* i.e. ctx->connection != NULL
sigaction(SIGPIPE, &osa, NULL);
+ pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_send(%d) = %d\n",bufsz,ret));
+
switch ( ret ) {
case EDG_WLL_GSS_OK:
break;
return ret;
}
+#define SSL_TOKEN_HEADER_LENGTH 5
+static size_t ssl_token_length(char *t, int tl) {
+ unsigned char *b = t;
+ return (((size_t)(b[3]) << 8) | b[4]) + 5;
+}
+
static int
recv_token(int sock, void **token, size_t *token_length, struct timeval *to)
{
char *t = NULL;
char *tmp;
size_t tl = 0;
+ size_t expect = 0;
fd_set fds;
struct timeval timeout,before,after;
int ret;
}
ret = 0;
+ expect = SSL_TOKEN_HEADER_LENGTH;
do {
FD_ZERO(&fds);
FD_SET(sock,&fds);
break;
}
- count = read(sock, buf, sizeof(buf));
+ count = read(sock, buf, MIN(expect - tl, sizeof(buf)));
if (count < 0) {
if (errno == EINTR)
continue;
t = tmp;
memcpy(t + tl, buf, count);
tl += count;
- } while (count == sizeof(buf));
+
+ if ((expect == SSL_TOKEN_HEADER_LENGTH) &&
+ (tl >= SSL_TOKEN_HEADER_LENGTH)) {
+ expect = ssl_token_length(t, tl);
+ }
+
+ } while (count != 0 && tl < expect);
end:
if (to) {
goto end;
}
+ len = write(out, "\n", 1);
+ if (len != 1) {
+ ret = EDG_WLL_GSS_ERROR_ERRNO;
+ goto end;
+ }
+
in = open(key_file, O_RDONLY);
if (in < 0) {
ret = EDG_WLL_GSS_ERROR_ERRNO;
+++ /dev/null
-LICENSE file for EGEE Middleware
-================================
-
-Copyright (c) 2004 on behalf of the EU EGEE Project:
-The European Organization for Nuclear Research (CERN),
-Istituto Nazionale di Fisica Nucleare (INFN), Italy
-Datamat Spa, Italy
-Centre National de la Recherche Scientifique (CNRS), France
-CS Systeme d'Information (CSSI), France
-Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
-Universiteit van Amsterdam (UvA), Netherlands
-University of Helsinki (UH.HIP), Finlan
-University of Bergen (UiB), Norway
-Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-3. The end-user documentation included with the redistribution, if
-any, must include the following acknowledgment: "This product includes
-software developed by The EU EGEE Project (http://cern.ch/eu-egee/)."
-Alternatively, this acknowledgment may appear in the software itself, if
-and wherever such third-party acknowledgments normally appear.
-
-4. The names EGEE and the EU EGEE Project must not be
-used to endorse or promote products derived from this software without
-prior written permission. For written permission, please contact
-<email address>.
-
-5. You are under no obligation whatsoever to provide anyone with any
-bug fixes, patches, or upgrades to the features, functionality or
-performance of the Software ("Enhancements") that you may develop over
-time; however, if you choose to provide your Enhancements to The EU
-EGEE Project, or if you choose to otherwise publish or distribute your
-Enhancements, in source code form without contemporaneously requiring
-end users of The EU EGEE Proejct to enter into a separate written license
-agreement for such Enhancements, then you hereby grant The EU EGEE Project
-a non-exclusive, royalty-free perpetual license to install, use, copy,
-modify, prepare derivative works, incorporate into the EGEE Middleware
-or any other computer software, distribute, and sublicense your
-Enhancements or derivative works thereof, in binary and source code
-form (if any), whether developed by The EU EGEE Project or third parties.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-This software consists of voluntary contributions made by many
-individuals on behalf of the EU EGEE Prject. For more information on The
-EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on
-EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/
-
-
+++ /dev/null
-#
-# Copyright (c) 2004 on behalf of the EU EGEE Project:
-# The European Organization for Nuclear Research (CERN),
-# Istituto Nazionale di Fisica Nucleare (INFN), Italy
-# Datamat Spa, Italy
-# Centre National de la Recherche Scientifique (CNRS), France
-# CS Systeme d'Information (CSSI), France
-# Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
-# Universiteit van Amsterdam (UvA), Netherlands
-# University of Helsinki (UH.HIP), Finland
-# University of Bergen (UiB), Norway
-# Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-#
-# Top Makefile file for the GLite Security Proxyrenewal module
-#
-# Authors: Ales Krenek <ljocha@ics.muni.cz>
-# Version info: $Id$
-# Release: $Name$
-#
-# Revision history:
-# $Log
-#
-
-# defaults
-top_srcdir=.
-builddir=build
-top_builddir=${top_srcdir}/${builddir}
-stagedir=.
-distdir=.
-globalprefix=glite
-lbprefix=lb
-package=glite-security-proxyrenewal
-version=1.0.0
-PREFIX=/opt/glite
-
-glite_location=$PREFIX
-globus_prefix=/opt/globus
-nothrflavour=gcc32
-thrflavour=gcc32pthr
-myproxy_prefix=$globus_prefix
-
--include Makefile.inc
-
-VPATH:=${top_srcdir}/src
-
-GLOBUSINC:= -I${globus_prefix}/include/${nothrflavour} \
- -I${globus_prefix}/include/${nothrflavour}/openssl
-
-GLOBUSTHRINC:= -I${globus_prefix}/include/${thrflavour} \
- -I${globus_prefix}/include/${thrflavour}/openssl
-
-MYPROXYINC:= -I${myproxy_prefix}/include/${nothrflavour}
-MYPROXYTHRINC:= -I${myproxy_prefix}/include/${thrflavour}
-
-DEBUG:=-g -O0
-
-CFLAGS:= ${DEBUG} \
- ${MYPROXYINC} \
- -I${top_srcdir}/src -I${top_srcdir}/interface \
- -I${glite_location}/include
-
-GLOBUS_LIBS:=-L${globus_prefix}/lib \
- -lglobus_common_${nothrflavour} \
- -lssl_${nothrflavour}
-
-MYPROXY_LIB:=-L${myproxy_prefix}/lib -lmyproxy_${nothrflavour}
-
-JOBIDLIB:=-L${glite_location}/lib -lglite_wmsutils_cjobid
-
-COMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
-LINK:=libtool --mode=link ${CC} ${LDFLAGS}
-INSTALL:=libtool --mode=install install
-
-DAEMONOBJ:=renewd.o renew.o common.o commands.o api.o voms.o
-LIBOBJ:=api.o common.o
-CLIENTOBJ:=client.o
-
-THRLIBOBJ:=${LIBOBJ:.o=.thr.o}
-LIBLOBJ:=${LIBOBJ:.o=.lo}
-THRLIBLOBJ:=${LIBOBJ:.o=.thr.lo}
-
-LIB:=libglite_security_proxyrenewal_${nothrflavour}.la
-THRLIB:=libglite_security_proxyrenewal_${thrflavour}.la
-
-DAEMON:=glite-proxy-renewd
-CLIENT:=glite-proxy-renew
-
-default: all
-compile all: ${LIB} ${THRLIB} ${DAEMON} ${CLIENT}
-
-${LIB}: ${LIBOBJ}
- ${LINK} -o $@ ${LIBLOBJ} -rpath ${glite_location}/lib ${JOBIDLIB}
-
-
-${THRLIB}: ${THRLIBOBJ}
- ${LINK} -o $@ ${THRLIBLOBJ} -rpath ${glite_location}/lib
-
-${DAEMON}: ${DAEMONOBJ}
- ${LINK} -o $@ ${DAEMONOBJ} ${JOBIDLIB} ${MYPROXY_LIB} -lvomsc -lglobus_gss_assist_${nothrflavour} ${GLOBUS_LIBS}
-
-${CLIENT}: ${CLIENTOBJ} ${LIB}
- ${LINK} -o $@ ${CLIENTOBJ} ${LIB} ${GLOBUS_LIBS}
-
-${THRLIBOBJ}: %.thr.o: %.c
- ${COMPILE} ${GLOBUSTHRINC} -o $@ -c $<
-
-%.o: %.c
- ${COMPILE} ${GLOBUSINC} -c $<
-
-stage: compile
- $(MAKE) install PREFIX=${stagedir}
-
-
-check:
- echo No unit tests
-
-dist: distsrc distbin
-
-distsrc:
- mkdir -p ${top_srcdir}/${package}-${version}
- cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version}
- cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version}
- rm -rf ${top_srcdir}/${package}-${version}
-
-distbin:
- $(MAKE) install PREFIX=`pwd`/tmpbuilddir
- cd tmpbuilddir && tar -czf ../${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *
- rm -rf tmpbuilddir
-
-install:
- -mkdir -p ${PREFIX}/bin ${PREFIX}/lib ${PREFIX}/include/glite/security/proxyrenewal ${PREFIX}/share/doc/${package}-${version} ${PREFIX}/etc/init.d
- ${INSTALL} -m 644 ${LIB} ${THRLIB} ${PREFIX}/lib
- ${INSTALL} -m 755 ${DAEMON} ${CLIENT} ${PREFIX}/bin
- ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version}
- cd ${top_srcdir}/interface && ${INSTALL} -m 644 renewal.h ${PREFIX}/include/glite/security/proxyrenewal
-
- ${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-proxy-renewald
-
-
-clean:
- $(RM) $(LIB) $(DAEMON) $(CLIENT) *.o core
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Build file for the GLite LB Client module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.4 2004/11/02 15:10:43 dkouril
- RPM description
-
- Revision 1.3 2004/07/30 08:31:07 dimeglio
- Changed default Ant target from compile to dist
-
- Revision 1.2 2004/07/12 16:18:37 dimeglio
- Modified to use myproxy from the repository if available
-
- Revision 1.1.1.1 2004/07/09 10:16:25 akrenek
- initial import
-
- Revision 1.2 2004/07/07 09:24:57 akrenek
- thr/nonthr flavours used correctly
-
- Revision 1.3 2004/07/06 17:45:30 flammer
- Update of classpath definitions, targets & configure file.
-
- Revision 1.2 2004/06/23 00:29:33 dimeglio
- Added standard comments and handling of support files
-
--->
-
-<project name="proxyrenewal" default="dist">
-
- <!-- =========================================
- Import properties (order is important)
- ========================================= -->
-
- <!-- import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- import component build properties,
- component properties &
- component common properties -->
- <import file="./project/properties.xml"/>
-
- <!-- import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="${subsystem.properties.file}"/>
-
- <!-- import global build properties &
- global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependency property files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${component.dependencies.file}" />
- <property file="${subsystem.dependencies.file}" />
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options (order is important)
- ========================================= -->
- <import file="${global.configure.options.file}"/>
- <import file="${component.configure.options.file}"/>
-
- <!-- =========================================
- Import task definitions (order is important)
- ========================================= -->
- <import file="${subsystem.taskdefs.file}" />
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Load common targets
- ========================================= -->
- <import file="${global.targets-simple_make.file}" />
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ==============================================
- Local private targets
- ============================================== -->
-
- <target name="localinit"
- description="Module specific initialization tasks">
- <antcall target="secmakefiles" />
- </target>
-
- <target name="localcompile"
- description="Module specific compile tasks">
- </target>
-
- <target name="localclean"
- description="Module specific cleaning tasks">
- </target>
-
- <!-- =========================================
- RPM settings
- ========================================= -->
-
- <property name="build.package.summary" value="Proxy renewal daemon" />
- <property name="build.package.description" value="The daemon is responsible for secure and controled way of periodical renewal
of users' proxy certificates. Its primary goal is to support long-time jobs
running on the grid. This package also contains a library and header file
that allow to develop C/C++ applications accessing the daemon." />
-
-</project>
+++ /dev/null
-#!/bin/sh
-
-GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite}
-GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/opt/glite/var}
-
-[ -f /etc/glite.conf ] && . /etc/glite.conf
-[ -f $GLITE_LOCATION/etc/glite-wms.conf ] && . $GLITE_LOCATION/etc/glite-wms.conf
-[ -f $HOME/.glite.conf ] && . $HOME/.glite.conf
-
-PROXY_REPOSITORY="$GLITE_LOCATION_VAR/spool/glite-renewd"
-
-unset creds
-
-start()
-{
- if test -z "$GLITE_USER" ;then
- echo 'Error: GLITE_USER is not set'
- echo FAILED
- return 1
- fi
-
- [ -n "$GLITE_HOST_CERT" -a -n "$GLITE_HOST_KEY" ] &&
- creds="-t $GLITE_HOST_CERT -k $GLITE_HOST_KEY"
-
- if test -z "$creds"; then
- if su - $GLITE_USER -c "test -r /etc/grid-security/hostkey.pem -a -r /etc/grid-security/hostcert.pem"; then
- echo "$0: WARNING: /etc/grid-security/hostkey.pem readable by $GLITE_USER"
- creds="-t /etc/grid-security/hostcert.pem -k /etc/grid-security/hostkey.pem"
- fi
- fi
-
- [ -z "$creds" ] &&
- echo $0: WARNING: No credentials specified. Using default lookup which is dangerous. >&2
-
- # workaround for VOMS_FindByVO that seems to always require user's own VOMS config file (bug #7511)
- user_voms_config=$HOME/.glite/vomses
- if [ ! -f "$user_voms_config" ]; then
- rm -f /tmp/renewal_vomses
- su - $GLITE_USER -c "touch /tmp/renewal_vomses && chmod 644 /tmp/renewal_vomses"
- user_voms_config=/tmp/renewal_vomses
- fi
-
- echo -n Starting ProxyRenewal Daemon: glite-proxy-renewd ...
-
- if [ ! -d "$PROXY_REPOSITORY" ]; then
- mkdir -p $PROXY_REPOSITORY || exit 1
- chown $GLITE_USER $PROXY_REPOSITORY
- chmod 0700 $PROXY_REPOSITORY
- fi
-
- su - $GLITE_USER -c "VOMS_USERCONF=$user_voms_config \
- $GLITE_LOCATION/bin/glite-proxy-renewd \
- -r $PROXY_REPOSITORY $creds -A" && echo " done"
-}
-
-stop()
-{
- echo -n "Stopping ProxyRenewal Daemon: glite-proxy-renewd ..."
- killall glite-proxy-renewd
- echo " done"
-}
-
-status()
-{
- if netstat -an --unix | grep "^unix .* LISTEN.* /tmp/dgpr_renew_" >/dev/null 2>&1 ;then
- echo glite-proxy-renewd running
- else
- echo glite-proxy-renewd not running
- return 1
- fi
-}
-
-case x$1 in
- xstart) start;;
- xstop) stop;;
- xrestart) stop; start;;
- xstatus) status;;
- x*) echo usage: $0 start,stop,restart,status >&2
- exit 1;;
-esac
+++ /dev/null
-/**
- * \file proxyrenewal/renewal.h
- * \author Daniel Kouril
- * \author Miroslav Ruda
- * \brief API for proxy renewal.
- * \version 2.0
- *
- * General rules:
- * - functions return 0 on success, nonzero on error, errror details can
- * be found via edg_wlpr_GetErrorText()
- */
-
-#ifndef RENEWAL_H
-#define RENEWAL_H
-
-#ident "$Header$"
-
-#include "glite/wmsutils/jobid/cjobid.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define EDG_WLPR_FLAG_UNIQUE 1
-#define EDG_WLPR_FLAG_UPDATE 2
-
-typedef enum _edg_wlpr_ErrorCode {
-/**
- * Base for proxy renewal specific code.
- * Start sufficently high not to collide with standard errno. */
- /* XXX see common/exception_codes.h */
- EDG_WLPR_ERROR_BASE = 1900,
- EDG_WLPR_ERROR_UNEXPECTED_EOF,
- EDG_WLPR_ERROR_GENERIC,
- EDG_WLPR_ERROR_PROTO_PARSE_ERROR,
- EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND,
- EDG_WLPR_ERROR_UNKNOWN_COMMAND,
- EDG_WLPR_ERROR_SSL,
- EDG_WLPR_ERROR_MYPROXY,
- EDG_WLPR_PROXY_NOT_REGISTERED,
- EDG_WLPR_PROXY_EXPIRED,
- EDG_WLPR_ERROR_VOMS,
- EDG_WLPR_ERROR_TIMEOUT,
- EDG_WLPR_ERROR_ERRNO,
-} edg_wlpr_ErrorCode;
-
-/**
- * Return a human readable string containg description of the errorcode
- * \retval char* pointer to a error description
- */
-const char *
-edg_wlpr_GetErrorText(int err_code);
-
-/**
- * This function contacts the renewal daemon and registers the specified proxy
- * for periodic renewal.
- * \param filename IN: specification of the proxy to register.
- * \param jdl IN: JDL of the job owing the proxy. The JDL is looked for a
- * myproxy server contact.
- * \param flags IN: one of EDG_WLPR_FLAG_UNIQUE or EDG_WLPR_FLAG_UPDATE, or
- * their bitwise OR.
- * \param repository_filename OUT: filename of registered proxy in repository.
- * \retval 0 success
- * \retval nonzero on error. Human readable form of the error can be get via
- * edg_wlpr_GetErrorText().
- */
-int
-edg_wlpr_RegisterProxy(
- const char * filename,
- const char *jdl,
- int flags,
- char ** repository_filename
-);
-
-/**
- * The same function as edg_wlpr_RegisterProxy() but information about the
- * myproxy server and jobid are passed as parameters instead of in JDL.
- */
-int
-edg_wlpr_RegisterProxyExt(
- const char * filename,
- const char * server,
- unsigned int port,
- edg_wlc_JobId jobid,
- int flags,
- char ** repository_filename
-);
-
-/**
- * Unregister proxy from the renewal daemon.
- * \param jobid IN: specification of job whose proxy shall be unregistered
- * \param filename IN: (optional) specification of the proxy to unregister.
- * \retval 0 success
- * \retval nonzero on error. Human readable form of the error can be get via
- * edg_wlpr_GetErrorText().
- */
-int
-edg_wlpr_UnregisterProxy(
- edg_wlc_JobId jobid,
- const char * repository_filename
-);
-
-/**
- * Get a list of registered proxies maintained by the renewal daemon.
- * \param count OUT: number of proxies
- * \param list OUT: a list of filenames separated by '\n'
- * specifying the registered proxies.
- * \warning The caller is responsible for freeing the data.
- * \retval 0 success
- * \retval nonzero on error. Human readable form of the error can be get via
- * edg_wlpr_GetErrorText().
- */
-int
-edg_wlpr_GetList(int *count, char **list);
-
-/**
- * Get a status message about a proxy.
- * The function contacts the renewal daemon and retrieve information it
- * maintains about the proxy.
- * \param filename IN: specification of the proxy to query
- * \param info OUT: status message.
- * \warning The caller is responsible for freeing the data.
- * \retval 0 success
- * \retval nonzero on error. Human readable form of the error can be get via
- * edg_wlpr_GetErrorText().
- */
-int
-edg_wlpr_GetStatus(const char *repository_filename, char **info);
-
-/**
- * For given jobid return registered proxy filename from repository
- * \param jobid IN: specification of jobid
- * \param repository_filename OUT: proxy regitered for given jobid
- * \warning The caller is responsible for freeing the data.
- * \retval 0 success
- * \retval nonzero on error. Human readable form of the error can be get via
- * edg_wlpr_GetErrorText().
- */
-int
-edg_wlpr_GetProxy(edg_wlc_JobId jobid, char **repository_filename);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* RENEWAL_H */
+++ /dev/null
-module.build=137
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Configuration options for the GLite Security Proxyrenewal module
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.3 2005/03/08 12:51:23 dkouril
- - Removed unused code
- - enabled (and partly rewritten) support for renewal of VOMS attributes
- - internal VOMS headers added - they are necessary to work with ASN.1 encoded
- VOMS attribures (hopefully new version of the VOMS API will provide better
- support)
-
- Revision 1.2 2004/07/12 16:18:37 dimeglio
- Modified to use myproxy from the repository if available
-
--->
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <project name="Security Proxyrenewal configuration options">
- <target name="secmakefiles">
- <exec executable="ln" failonerror="true">
- <arg line="-fs ${component.dir}/Makefile ${module.build.dir}/Makefile"/>
- </exec>
- <echo file="${module.build.dir}/Makefile.inc">
-top_srcdir=..
-builddir=build
-stagedir=${stage.abs.dir}
-distdir=${dist.dir}
-globalprefix=${global.prefix}
-package=${module.package.name}
-PREFIX=${install.dir}
-version=${module.version}
-glite_location=${with.glite.location}
-globus_prefix=${with.globus.prefix}
-thrflavour=${with.globus.thr.flavor}
-nothrflavour=${with.globus.nothr.flavor}
-myproxy_prefix=${with.myproxy.prefix}
- </echo>
- </target>
- </project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Common build properties file for the Glite Security Proxyrenewal component
-
- Authors: Ales Krenek <ljocha@ics.muni.cz>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.2 2004/07/12 16:18:37 dimeglio
- Modified to use myproxy from the repository if available
-
--->
-
-<project name="Security Proxyrenewal component common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property file="project/build.properties" />
-
- <!-- ======================================================
- Define corresponding subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${security.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${security.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define component properties
- ====================================================== -->
-
- <!-- Component name prefix -->
- <property name="component.prefix" value="proxyrenewal" />
-
- <!-- ======================================================
- Define general component properties
- ====================================================== -->
-
- <import file="${component.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
-
-</project>
+++ /dev/null
-tar_exclude
-CVS
-build.xml
-build
-build.properties
-properties.xml
-configure.properties.xml
-.cvsignore
-.project
-.cdtproject
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="tasks and types definitions">
-</project>
+++ /dev/null
-module.version=1.2.3
-module.age=1
+++ /dev/null
-#include "renewal.h"
-#include "renewal_locl.h"
-
-#ident "$Header$"
-
-#define SEPARATORS "\n"
-
-/* prototypes of static routines */
-static int
-encode_request(edg_wlpr_Request *request, char **msg);
-
-static int
-decode_response(const char *msg, const size_t msg_len, edg_wlpr_Response *response);
-
-static int
-do_connect(char *socket_name, struct timeval *timeout, int *sock);
-
-static int
-send_request(int sock, struct timeval *timeout, edg_wlpr_Request *request, edg_wlpr_Response *response);
-
-static int
-encode_request(edg_wlpr_Request *request, char **msg)
-{
- char *buf;
- size_t buf_len;
- int ret;
-
- buf_len = EDG_WLPR_BUF_SIZE;
- buf = malloc(buf_len);
- if (buf == NULL)
- return ENOMEM;
- buf[0] = '\0';
-
- ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_VERSION,
- EDG_WLPR_VERSION, SEPARATORS);
- if (ret)
- goto err;
-
- ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_COMMAND,
- edg_wlpr_EncodeInt(request->command),
- SEPARATORS);
- if (ret)
- goto err;
-
- if (request->myproxy_server) {
- char host[1024];
-
-#if 0
- snprintf(host, sizeof(host), "%s:%d", request->myproxy_server,
- (request->myproxy_port) ? request->myproxy_port : EDG_WLPR_MYPROXY_PORT); /* XXX let server decide ? */
-#else
- snprintf(host, sizeof(host), "%s", request->myproxy_server);
-#endif
- ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_MYPROXY_SERVER,
- host, SEPARATORS);
- if (ret)
- goto err;
- }
-
- if (request->proxy_filename) {
- ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_PROXY,
- request->proxy_filename, SEPARATORS);
- if (ret)
- goto err;
- }
-
- if (request->jobid) {
- ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_JOBID,
- request->jobid, SEPARATORS);
- if (ret)
- goto err;
- }
-
- if (request->entries) {
- char **p = request->entries;
- while (*p) {
- ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_ENTRY,
- *p, SEPARATORS);
- if (ret)
- goto err;
- p++;
- }
- }
-
- buf[strlen(buf)] = '\0';
- *msg = buf;
- return 0;
-
-err:
- free(buf);
- *msg = NULL;
- return ret;
-}
-
-static int
-decode_response(const char *msg, const size_t msg_len, edg_wlpr_Response *response)
-{
- int ret;
- char *value = NULL;
- /* char *p; */
- int i;
- int current_size = 0;
-
- /* XXX add an ending zero '\0' */
-
- assert(msg != NULL);
- assert(response != NULL);
-
- memset(response, 0, sizeof(*response));
-
- ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_VERSION, SEPARATORS,
- 0, &response->version);
- if (ret)
- goto err;
-
- ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_RESPONSE, SEPARATORS,
- 0, &value);
- if (ret)
- goto err;
-
- ret = edg_wlpr_DecodeInt(value, (int *)(&response->response_code));
- free(value);
- if (ret)
- goto err;
-
- ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_MYPROXY_SERVER,
- SEPARATORS, 0, &response->myproxy_server);
- if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND)
- goto err;
-
-#if 0
- response->myproxy_port = EDG_WLPR_MYPROXY_PORT; /* ??? */
- if (response->myproxy_server && (p = strchr(response->myproxy_server, ':'))) {
- int port;
- *p = '\0';
- port = atol(p+1); /* XXX */
- response->myproxy_port = port;
- }
-#endif
-
- ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_START_TIME, SEPARATORS,
- 0, &value);
- if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND)
- goto err;
- if (ret == 0) {
- ret = edg_wlpr_DecodeInt(value, (int *)(&response->start_time));
- free(value);
- if (ret)
- goto err;
- }
-
- ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_END_TIME, SEPARATORS,
- 0, &value);
- if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND)
- goto err;
- if (ret == 0) {
- ret = edg_wlpr_DecodeInt(value, (int *)(&response->end_time));
- free(value);
- if (ret)
- goto err;
- }
-
- ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_RENEWAL_TIME,
- SEPARATORS, 0, &value);
- if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND)
- goto err;
- if (ret == 0) {
- ret = edg_wlpr_DecodeInt(value, (int *)(&response->next_renewal_time));
- free(value);
- if (ret)
- goto err;
- }
-
- /* XXX Counter */
-
- i = 0;
- while ((ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_PROXY,
- SEPARATORS, i, &value)) == 0) {
- if (i >= current_size) {
- char **tmp;
-
- tmp = realloc(response->filenames,
- (current_size + 16 + 1) * sizeof(*tmp));
- if (tmp == NULL) {
- ret = ENOMEM;
- goto err;
- }
- response->filenames = tmp;
- current_size += 16;
- }
- response->filenames[i] = value;
- i++;
- }
- if (ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND)
- goto err;
- if (response->filenames)
- response->filenames[i] = NULL;
-
- return 0;
-
-err:
- edg_wlpr_CleanResponse(response);
-
- return ret;
-}
-
-static int
-do_connect(char *socket_name, struct timeval *timeout, int *sock)
-{
- struct sockaddr_un my_addr;
- int s;
- int ret;
- struct timeval before,after,to;
- int sock_err;
- socklen_t err_len;
-
- assert(sock != NULL);
- memset(&my_addr, 0, sizeof(my_addr));
-
- s = socket(AF_UNIX, SOCK_STREAM, 0);
- if (s == -1) {
- return errno;
- }
-
- if (timeout) {
- int flags = fcntl(s, F_GETFL, 0);
- if (fcntl(s, F_SETFL, flags | O_NONBLOCK) < 0)
- return errno;
- }
-
- my_addr.sun_family = AF_UNIX;
- strncpy(my_addr.sun_path, socket_name, sizeof(my_addr.sun_path));
-
- ret = connect(s, (struct sockaddr *) &my_addr, sizeof(my_addr));
- if (ret == -1) {
- if (errno == EINPROGRESS) {
- fd_set fds;
-
- FD_ZERO(&fds);
- FD_SET(s, &fds);
- memcpy(&to, timeout, sizeof(to));
- gettimeofday(&before,NULL);
- switch (select(s+1, NULL, &fds, NULL, &to)) {
- case -1: close(s);
- return errno;
- case 0: close(s);
- return EDG_WLPR_ERROR_TIMEOUT;
- }
- gettimeofday(&after,NULL);
- if (edg_wlpr_DecrementTimeout(timeout, before, after)) {
- close (s);
- return EDG_WLPR_ERROR_TIMEOUT;
- }
-
- err_len = sizeof sock_err;
- if (getsockopt(s,SOL_SOCKET,SO_ERROR,&sock_err,&err_len)) {
- close(s);
- return errno;
- }
- if (sock_err) {
- close(s);
- errno = sock_err;
- return errno;
- }
- } else {
- close(s);
- return errno;
- }
- }
-
- *sock = s;
- return 0;
-}
-
-static int
-send_request(int sock, struct timeval *timeout, edg_wlpr_Request *request, edg_wlpr_Response *response)
-{
- int ret;
- char *buf = NULL;
- size_t buf_len;
-
- /* timeouts ?? */
-
- ret = encode_request(request, &buf);
- if (ret)
- return ret;
-
- ret = edg_wlpr_Write(sock, timeout, buf, strlen(buf) + 1);
- free(buf);
- if (ret)
- return ret;
-
- ret = edg_wlpr_Read(sock, timeout, &buf, &buf_len);
- if (ret)
- return ret;
-
- ret = decode_response(buf, buf_len, response);
- free(buf);
- if (ret)
- return ret;
-
- return 0;
-}
-
-int
-edg_wlpr_RequestSend(edg_wlpr_Request *request, edg_wlpr_Response *response)
-{
- char sockname[1024];
- int ret;
- int sock;
- struct timeval timeout;
- const char *s = NULL;
- double d;
-
- s = getenv("GLITE_PR_TIMEOUT");
- d = s ? atof(s) : GLITE_PR_TIMEOUT_DEFAULT;
- timeout.tv_sec = (long) d;
- timeout.tv_usec = (long) ((d-timeout.tv_sec) * 1e6);
-
- snprintf(sockname, sizeof(sockname), "%s%d",
- DGPR_REG_SOCKET_NAME_ROOT, getuid());
- ret = do_connect(sockname, &timeout, &sock);
- if (ret)
- return ret;
-
- ret = send_request(sock, &timeout, request, response);
-
- close(sock);
- return ret;
-}
-
-int
-edg_wlpr_RegisterProxyExt(const char *filename, const char * server,
- unsigned int port,
- edg_wlc_JobId jobid, int flags,
- char **repository_filename)
-{
- edg_wlpr_Request request;
- edg_wlpr_Response response;
- int ret;
-
- memset(&request, 0, sizeof(request));
- memset(&response, 0, sizeof(response));
-
- request.command = EDG_WLPR_COMMAND_REG;
- request.myproxy_server = server;
- request.proxy_filename = filename;
- request.jobid = edg_wlc_JobIdUnparse(jobid);
- if (request.jobid == NULL)
- return EINVAL; /* XXX */
-
- ret = edg_wlpr_RequestSend(&request, &response);
- free(request.jobid);
- if (ret == 0 && response.response_code == 0 && repository_filename &&
- response.filenames && response.filenames[0] )
- *repository_filename = strdup(response.filenames[0]);
-
- if (ret == 0)
- ret = response.response_code;
-
- edg_wlpr_CleanResponse(&response);
-
- return ret;
-}
-
-int
-edg_wlpr_RegisterProxy(const char *filename, const char *jdl,
- int flags, char **repository_filename)
-{
- char server[1024];
- size_t server_len;
- unsigned int port = 0;
- char *p, *q;
-
- memset(server, 0, sizeof(server));
-
- /* parse JDL and find information about myproxy server */
- p = strstr(jdl, JDL_MYPROXY);
- if (p == NULL)
- return 0; /* XXX */
- q = strchr(p, '\n'); /* XXX */
- if (q)
- server_len = q - p;
- else
- server_len = jdl + strlen(jdl) - p;
- if (server_len >= sizeof(server))
- return EINVAL; /* XXX */
- strncmp(server, p, sizeof(server));
-
- return (edg_wlpr_RegisterProxyExt(filename, server, port, NULL, flags,
- repository_filename));
-}
-
-int
-edg_wlpr_UnregisterProxy(edg_wlc_JobId jobid, const char *repository_filename)
-{
- edg_wlpr_Request request;
- edg_wlpr_Response response;
- int ret;
-
- memset(&request, 0, sizeof(request));
- memset(&response, 0, sizeof(response));
-
- request.command = EDG_WLPR_COMMAND_UNREG;
- request.proxy_filename = repository_filename;
- request.jobid = edg_wlc_JobIdUnparse(jobid);
- if (request.jobid == NULL)
- return EINVAL;
-
- ret = edg_wlpr_RequestSend(&request, &response);
- free(request.jobid);
-
- if (ret == 0)
- ret = response.response_code;
- edg_wlpr_CleanResponse(&response);
-
- return ret;
-}
-
-int
-edg_wlpr_GetList(int *count, char **list)
-{
- return ENOSYS; /* XXX */
-}
-
-int
-edg_wlpr_GetStatus(const char *filename, char **info)
-{
- return ENOSYS; /* XXX */
-}
-
-static const char* const errTexts[] = {
- "Unexpected EOF from peer",
- "Generic error",
- "Protocol parse error",
- "Compulsory element not found in message",
- "Unknown protocol command",
- "SSL error",
- "Error from Myproxy server",
- "Proxy not registered",
- "Proxy expired",
- "VOMS error",
- "Operation timed out",
- "System error"
-};
-
-const char *
-edg_wlpr_GetErrorText(int code)
-{
- return code ?
- (code <= EDG_WLPR_ERROR_BASE ?
- strerror(code) :
- errTexts[code - EDG_WLPR_ERROR_BASE - 1]
- ) :
- NULL;
-}
-
-int
-edg_wlpr_GetProxy(edg_wlc_JobId jobid, char **repository_filename)
-{
- edg_wlpr_Request request;
- edg_wlpr_Response response;
- int ret;
-
- memset(&request, 0, sizeof(request));
- memset(&response, 0, sizeof(response));
-
- request.command = EDG_WLPR_COMMAND_GET;
- request.jobid = edg_wlc_JobIdUnparse(jobid);
- if (request.jobid == NULL)
- return EINVAL;
-
- ret = edg_wlpr_RequestSend(&request, &response);
- free(request.jobid);
-
- if (ret == 0 && response.response_code == 0 && repository_filename &&
- response.filenames && response.filenames[0] )
- *repository_filename = strdup(response.filenames[0]);
-
- if (ret == 0)
- ret = response.response_code;
- edg_wlpr_CleanResponse(&response);
-
- return ret;
-}
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <string.h>
-#include "renewal.h"
-
-static const char rcsid[] = "$Header$";
-
-static struct option const long_options[] = {
- { "help", no_argument, 0, 'h' },
- { "version", no_argument, 0, 'v' },
- { "server", required_argument, 0, 's' },
- { "port", required_argument, 0, 'p' },
- { "file", required_argument, 0, 'f' },
- { "jobid", required_argument, 0, 'j' },
- { NULL, 0, NULL, 0}
-};
-
-static char short_options[] = "hvs:p:f:j:";
-
-static void
-usage(exit_code)
-{
- fprintf(stdout, "Usage: edg-wl-renew [option] operation\n"
- "\t-s myproxy_server [-p port] -f filename -j jobid start |\n"
- "\t-j jobid [-f filename] stop |\n"
- "\t-j jobid get\n"
- "-h, --help display this help and exit\n"
- "-v, --version output version information and exit\n"
- "-s, --server <fqdn> address of myproxy server\n"
- "-p, --port <num> port of myproxy server\n"
- "-f, --file <file> filename with proxy\n"
- "-j, --jobid <str> datagrid jobid\n");
- exit(exit_code);
-}
-
-int
-main(int argc, char *argv[])
-{
- char *server = NULL;
- int port = 0;
- char *proxyfile = NULL;
- char *jobid_str = NULL;
- edg_wlc_JobId jobid = NULL;
- char *repository_filename = NULL;
- int ret;
- int arg;
- extern int optind;
-
- while ((arg = getopt_long(argc, argv,
- short_options, long_options, (int *) 0)) != EOF)
- switch(arg) {
- case 'h':
- usage(0); break;
- case 'v':
- fprintf(stdout, "%s:\t%s\n", argv[0], rcsid); exit(0);
- case 's':
- server = strdup(optarg); break;
- case 'p':
- port = atoi(optarg); break;
- case 'f':
- proxyfile = strdup(optarg); break;
- case 'j':
- jobid_str = strdup(optarg); break;
- default:
- usage(1); break;
- }
-
- if (optind >= argc)
- usage(1);
-
- if (jobid_str && edg_wlc_JobIdParse(jobid_str, &jobid)) {
- fprintf(stderr, "Cannot parse jobid\n");
- exit(1);
- }
-
- if (strcmp(argv[optind], "start") == 0) {
- if (proxyfile == NULL || server == NULL || jobid == NULL)
- usage(1);
- ret = edg_wlpr_RegisterProxyExt(proxyfile, server, port, jobid, 0,
- &repository_filename);
- if (ret) {
- fprintf(stderr, "Registering proxy failed: %s\n",
- edg_wlpr_GetErrorText(ret));
- exit(1);
- }
- printf("%s\n", repository_filename);
- free(repository_filename);
- exit(0);
- }
- else if (strcmp(argv[optind], "stop") == 0) {
- if (jobid == NULL)
- usage(1);
- ret = edg_wlpr_UnregisterProxy(jobid, proxyfile);
- if (ret) {
- fprintf(stderr, "Unregistering proxy failed: %s\n",
- edg_wlpr_GetErrorText(ret));
- exit(1);
- }
- }
- else if (strcmp(argv[optind], "get") == 0) {
- if (jobid == NULL)
- usage(1);
- ret = edg_wlpr_GetProxy(jobid, &proxyfile);
- if (ret) {
- fprintf(stderr, "GET request failed: %s\n",
- edg_wlpr_GetErrorText(ret));
- exit(1);
- }
- printf("%s\n", proxyfile);
- free(proxyfile);
- }
- else
- usage(1);
-
- return 0;
-}
+++ /dev/null
-#include "renewal_locl.h"
-#include "renewd_locl.h"
-
-#include "glite/security/voms/voms_apic.h"
-
-#ident "$Header$"
-
-#define SEPARATORS ",\n"
-#define RENEWAL_START_FRACTION 0.75 /* XXX */
-#define RENEWAL_MIN_LIFETIME (15 * 60)
-
-extern char *repository;
-extern time_t condor_limit;
-extern char *cadir;
-extern char *vomsdir;
-extern int voms_enabled;
-
-static char *
-strmd5(const char *s, unsigned char *digest);
-
-static int
-get_record_ext(FILE *fd, proxy_record *record, int *last_used_suffix);
-
-static int
-get_record(FILE *fd, proxy_record *record);
-
-static int
-store_record(char *basename, proxy_record *record);
-
-static int
-copy_file_content(FILE *in, FILE *out);
-
-static int
-copy_file(char *src, char *dst);
-
-static int
-get_base_filename(char *proxy_file, char **basefilename);
-
-int
-decode_record(char *line, proxy_record *record);
-
-int
-encode_record(proxy_record *record, char **line);
-
-static int
-open_metafile(char *proxy_file, FILE **fd);
-
-void
-free_record(proxy_record *record);
-
-static int
-realloc_prd_list(prd_list *list);
-
-/* make public: */
-static int
-edg_wlpr_GetTokenInt(const char *msg, const size_t msg_len,
- const char *key, const char *separators,
- int req_index, int *value);
-
-static void
-record_to_response(int status_code, proxy_record *record,
- edg_wlpr_Response *response);
-
-static int
-filename_to_response(char *filename, edg_wlpr_Response *response);
-
-
-
-
-static char *
-strmd5(const char *s, unsigned char *digest)
-{
- MD5_CTX md5;
- unsigned char d[16];
- int i;
- static char mbuf[33];
-
- MD5_Init(&md5);
- MD5_Update(&md5,s,strlen(s));
- MD5_Final(d,&md5);
-
- if (digest)
- memcpy(digest,d,sizeof(d));
- for (i=0; i<16; i++) {
- int dd = d[i] & 0x0f;
- mbuf[2*i+1] = dd<10 ? dd+'0' : dd-10+'a';
- dd = d[i] >> 4;
- mbuf[2*i] = dd<10 ? dd+'0' : dd-10+'a';
- }
- mbuf[32] = 0;
- return mbuf;
-}
-
-static int
-get_base_filename(char *proxy_file, char **basefilename)
-{
- char *subject = NULL;
- char file[FILENAME_MAX];
- int ret;
-
- assert(basefilename != NULL);
-
- ret = get_proxy_base_name(proxy_file, &subject);
- if (ret)
- goto end;
-
- snprintf(file, sizeof(file), "%s/%s", repository, strmd5(subject, NULL));
- *basefilename = strdup(file); /* XXX test ENOMEM */
- ret = 0;
-
-end:
- if (subject)
- free(subject);
- return ret;
-}
-
-static int
-copy_file_content(FILE *in, FILE *out)
-{
- char buf[1024];
- size_t num;
- int ret;
-
- while (1) {
- num = fread(buf, sizeof(*buf), sizeof(buf), in);
- if ((ret = ferror(in))) {
- edg_wlpr_Log(LOG_ERR, "Reading failed: %s", strerror(errno));
- return ret;
- }
- num = fwrite(buf, sizeof(*buf), num, out);
- if ((ret = ferror(in))) {
- edg_wlpr_Log(LOG_ERR, "Writing failed: %s", strerror(errno));
- return ret;
- }
- if (feof(in))
- return 0;
- }
-}
-
-/* return the time interval, after which the renewal should be started */
-static time_t
-get_delta(time_t current_time, time_t start_time, time_t end_time)
-{
- time_t remaining_life;
- time_t life_to_lose;
- time_t limit;
- time_t delta;
-
- if (RENEWAL_MIN_LIFETIME > condor_limit) {
- limit = RENEWAL_MIN_LIFETIME;
- } else {
- limit = condor_limit;
- }
-
- limit += RENEWAL_CLOCK_SKEW;
-
- if (current_time + limit >= end_time) {
- /* if the proxy is too short, renew it as soon as possible */
-
- if (current_time + condor_limit > end_time ) {
- edg_wlpr_Log(LOG_ERR, "Remaining proxy lifetime fell below the value of the Condor limit!");
- }
-
- return 0;
- }
-
- remaining_life = end_time - current_time;
-
- /* renewal should gain the jobs an extra lifetime of
- RENEWAL_START_FRACTION (default 3/4) of the new proxy's
- lifetime. If the time remaining on the current proxy is already
- small then the jobs may gain an extra lifetime of more than that.
-
- In any case, a renewal will be scheduled to happen before the
- lifetime limit.
-
- 'life_to_lose' is the lifetime that will be lost, ie the time that
- will still remain on the current proxy when it is renewed
- */
-
- life_to_lose = (1.0-RENEWAL_START_FRACTION)*60*60*DGPR_RETRIEVE_DEFAULT_HOURS;
-
- if (life_to_lose < limit) {
- life_to_lose = limit;
- }
-
- delta = life_to_lose - limit;
-
- while( remaining_life < (limit + delta) ) {
- delta *= (1.0-RENEWAL_START_FRACTION);
- }
-
- life_to_lose = limit + delta;
-
- return (remaining_life - life_to_lose);
-}
-
-int
-get_times(char *proxy_file, proxy_record *record)
-{
- FILE *fd;
- X509 *cert = NULL;
- ASN1_UTCTIME *asn1_time = NULL;
- int ret;
- time_t current_time, start_time, end_time;
-
- assert(record != NULL);
- assert(proxy_file != NULL);
-
- fd = fopen(proxy_file, "r");
- if (fd == NULL) {
- edg_wlpr_Log(LOG_ERR, "Opening proxy file %s failed: %s",
- proxy_file, strerror(errno));
- return errno;
- }
-
- cert = PEM_read_X509(fd, NULL, NULL, NULL);
- if (cert == NULL) {
- edg_wlpr_Log(LOG_ERR, "Cannot read X.509 certificate from %s",
- proxy_file);
- ret = -1; /* XXX SSL_ERROR */
- goto end;
- }
-
- asn1_time = ASN1_UTCTIME_new();
- X509_gmtime_adj(asn1_time,0);
- globus_gsi_cert_utils_make_time(X509_get_notAfter(cert), &end_time);
- globus_gsi_cert_utils_make_time(X509_get_notBefore(cert), &start_time);
- current_time = time(NULL);
- ASN1_UTCTIME_free(asn1_time);
- /* if (end_time - RENEWAL_CLOCK_SKEW < current_time) { Too short proxy } */
- if (end_time + RENEWAL_CLOCK_SKEW < current_time) {
- edg_wlpr_Log(LOG_ERR, "Expired proxy in %s", proxy_file);
- ret = EDG_WLPR_PROXY_EXPIRED;
- goto end;
- }
-
- /* Myproxy seems not to do check on expiration and return expired proxies
- if credentials in repository are expired */
- X509_free(cert);
- cert = NULL;
- while (1) {
- time_t tmp_end;
- /* see http://www.openssl.org/docs/crypto/pem.html section BUGS */
- cert = PEM_read_X509(fd, NULL, NULL, NULL);
- if (cert == NULL) {
- if (ERR_GET_REASON(ERR_peek_error()) == PEM_R_NO_START_LINE) {
- /* End of file reached. no error */
- ERR_clear_error();
- break;
- }
- edg_wlpr_Log(LOG_ERR, "Cannot read additional certificates from %s",
- proxy_file);
- ret = -1; /* XXX SSL_ERROR */
- goto end;
- }
- globus_gsi_cert_utils_make_time(X509_get_notAfter(cert), &tmp_end);
- if (tmp_end + RENEWAL_CLOCK_SKEW < current_time) {
- edg_wlpr_Log(LOG_ERR, "Expired proxy in %s", proxy_file);
- ret = EDG_WLPR_PROXY_EXPIRED;
- goto end;
- }
- X509_free(cert);
- cert = NULL;
- }
-
- record->next_renewal = current_time + get_delta(current_time, start_time,
- end_time);
- record->end_time = end_time;
- ret = 0;
-
-end:
- fclose(fd);
- if (cert)
- X509_free(cert);
-
- return ret;
-}
-
-static int
-copy_file(char *src, char *dst)
-{
- FILE *from = NULL;
- FILE *tmp_to = NULL;
- int tmp_fd;
- char tmpfile[FILENAME_MAX];
- int ret;
-
- if (strcmp(src, dst) == 0)
- return 0;
-
- from = fopen(src, "r");
- if (from == NULL) {
- edg_wlpr_Log(LOG_ERR, "Cannot open file %s for reading (%s)",
- src, strerror(errno));
- return errno;
- }
-
- snprintf(tmpfile, sizeof(tmpfile), "%s.XXXXXX", dst);
- tmp_fd = mkstemp(tmpfile);
- if (tmp_fd == -1) {
- edg_wlpr_Log(LOG_ERR, "Cannot create temporary file (%s)",
- strerror(errno));
- ret = errno;
- goto end;
- }
-
-
- tmp_to = fdopen(tmp_fd, "w");
- if (tmp_to == NULL) {
- edg_wlpr_Log(LOG_ERR, "Cannot associate stream with temporary file (%s)",
- strerror(errno));
- unlink(tmpfile);
- ret = errno;
- goto end;
- }
-
- ret = copy_file_content(from, tmp_to);
- fclose(tmp_to);
- if (ret) {
- goto end;
- }
-
- ret = rename(tmpfile, dst);
- if (ret) {
- edg_wlpr_Log(LOG_ERR, "Cannot replace repository file %s with temporary file (%s)",
- strerror(errno));
- unlink(tmpfile);
- ret = errno;
- goto end;
- }
- tmp_to = NULL;
-
-end:
- fclose(from);
- close(tmp_fd);
- unlink(tmpfile);
-
- return ret;
-}
-
-void
-free_record(proxy_record *record)
-{
- int i;
-
- if (record == NULL)
- return;
- if (record->myproxy_server)
- free(record->myproxy_server);
- if (record->jobids.val) {
- for (i = 0; i < record->jobids.len; i++)
- free(record->jobids.val[i]);
- free(record->jobids.val);
- }
- memset(record, 0, sizeof(*record));
-}
-
-static int
-realloc_prd_list(prd_list *list)
-{
- char **tmp;
-
- tmp = realloc(list->val, (list->len + 1) * sizeof(*list->val));
- if (tmp == NULL)
- return ENOMEM;
- list->val = tmp;
- list->len++;
- return 0;
-}
-
-static int
-get_jobids(const char *msg, const size_t msg_len, proxy_record *record)
-{
- int index = 0;
- int ret;
- char *value;
- char **tmp;
-
- memset(&record->jobids, 0, sizeof(record->jobids));
- while ((ret = edg_wlpr_GetToken(msg, msg_len, "jobid=", SEPARATORS,
- index, &value)) == 0) {
- tmp = realloc(record->jobids.val, (record->jobids.len + 1) * sizeof(*tmp));
- if (tmp == NULL) {
- ret = ENOMEM;
- break;
- }
- record->jobids.val = tmp;
- record->jobids.val[index] = value;
- record->jobids.len++;
- index++;
- }
- if (ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) {
- if (record->jobids.len)
- free(record->jobids.val);
- record->jobids.len = 0;
- record->jobids.val = NULL;
- return ret;
- }
-
- return 0;
-}
-
-static int
-edg_wlpr_GetTokenInt(const char *msg, const size_t msg_len,
- const char *key, const char *separators,
- int req_index, int *value)
-{
- int ret;
- char *str_value = NULL;
-
- ret = edg_wlpr_GetToken(msg, msg_len, key, separators, req_index, &str_value);
- if (ret)
- return ret;
-
- ret = edg_wlpr_DecodeInt(str_value, value);
- free(str_value);
- return ret;
-}
-
-int
-decode_record(char *line, proxy_record *record)
-{
- /* line must be ended with '\0' */
- int ret;
- size_t len;
-
- assert(line != NULL);
- assert(record != NULL);
-
- memset(record, 0, sizeof(*record));
-
- len = strlen(line) + 1;
-
- ret = edg_wlpr_GetTokenInt(line, len, "suffix=", SEPARATORS, 0,
- &record->suffix);
- if (ret)
- return ret;
-
-#if 0
- ret = edg_wlpr_GetTokenInt(line, len, "counter=", SEPARATORS, 0,
- &record->counter);
- if (ret)
- goto end;
-#endif
-
- ret = edg_wlpr_GetTokenInt(line, len, "unique=", SEPARATORS, 0,
- &record->unique);
- if (ret)
- goto end;
-
- ret = edg_wlpr_GetTokenInt(line, len, "voms_exts=", SEPARATORS, 0,
- &record->voms_exts);
-
- ret = edg_wlpr_GetToken(line, len, "server=", SEPARATORS, 0,
- &record->myproxy_server);
- if (ret)
- goto end;
-
- ret = edg_wlpr_GetTokenInt(line, len, "next_renewal=", SEPARATORS, 0,
- (int *)&record->next_renewal);
- if (ret)
- goto end;
-
- ret = edg_wlpr_GetTokenInt(line, len, "end_time=", SEPARATORS, 0,
- (int *)&record->end_time);
- if (ret)
- goto end;
-
- ret = get_jobids(line, len, record);
- if (ret)
- goto end;
-
-end:
- if (ret)
- free_record(record);
-
- return ret;
-}
-
-int
-encode_record(proxy_record *record, char **line)
-{
- char tmp_line[1024];
- size_t jobids_len = 0;
- int i;
-
- snprintf(tmp_line, sizeof(tmp_line), "suffix=%d, unique=%d, voms_exts=%d, server=%s, next_renewal=%ld, end_time=%ld",
- record->suffix, record->unique, record->voms_exts,
- (record->myproxy_server) ? record->myproxy_server : "",
- record->next_renewal, record->end_time);
- for (i = 0; i < record->jobids.len; i++)
- /* alloc space for string ", jobid=<jobid>" */
- jobids_len += 2 + strlen("jobid=") + strlen(record->jobids.val[i]);
-
- *line = calloc(1, strlen(tmp_line) + jobids_len + 1);
- if (*line == NULL)
- return ENOMEM;
-
- strcat(*line, tmp_line);
- memset(tmp_line, 0, sizeof(tmp_line));
-
- for (i = 0; i < record->jobids.len; i++) {
- snprintf(tmp_line, sizeof(tmp_line), ", jobid=%s", record->jobids.val[i]);
- strcat(*line, tmp_line);
- }
-
- return 0;
-}
-
-/* Get proxy record from the index file. If no suffix is defined return a free
- record with the smallest index */
-static int
-get_record_ext(FILE *fd, proxy_record *record, int *last_used_suffix)
-{
- char line[1024];
- int last_suffix = -1;
- int ret;
- char *p;
- proxy_record tmp_record;
- time_t current_time;
- int line_num = 0;
-
- assert(record != NULL);
- memset(&tmp_record, 0, sizeof(tmp_record));
-
- current_time = time(NULL);
- while (fgets(line, sizeof(line), fd) != NULL) {
- line_num++;
- free_record(&tmp_record);
- p = strchr(line, '\n');
- if (p)
- *p = '\0';
- ret = decode_record(line, &tmp_record);
- if (ret) {
- edg_wlpr_Log(LOG_ERR, "Skipping invalid entry at line %d", line_num);
- continue;
- }
- if (record->suffix >= 0) {
- if (record->suffix == tmp_record.suffix) {
- record->suffix = tmp_record.suffix;
- record->jobids.len = tmp_record.jobids.len;
- record->jobids.val = tmp_record.jobids.val;
- record->unique = tmp_record.unique;
- record->voms_exts = tmp_record.voms_exts;
- if (record->myproxy_server)
- free(record->myproxy_server);
- record->myproxy_server = tmp_record.myproxy_server;
- record->end_time = tmp_record.end_time;
- record->next_renewal = tmp_record.next_renewal;
- return 0;
- } else
- continue;
- }
- if (tmp_record.suffix > last_suffix)
- last_suffix = tmp_record.suffix;
-
- /* if no particular suffix was specified get the first free record
- available */
- if (tmp_record.jobids.len >= MAX_PROXIES || tmp_record.unique ||
- tmp_record.voms_exts)
- continue;
-
- if (tmp_record.jobids.len == 0) {
- /* no jobs registered for this record, so use it initialized with the
- * parameters (currently myproxy location) provided by user */
- record->suffix = tmp_record.suffix;
- record->next_renewal = record->end_time = 0;
- free_record(&tmp_record);
- return 0;
- }
-
- /* Proxies with VOMS attributes require a separate record, which is not
- * shared with another proxies. The same applies it the unique flag was
- * set by the caller */
- if (record->voms_exts || record->unique)
- continue;
-
- if (tmp_record.jobids.len > 0 && record->myproxy_server &&
- strcmp(record->myproxy_server, tmp_record.myproxy_server) != 0)
- continue;
-
- if (tmp_record.jobids.len > 0 &&
- current_time + condor_limit + RENEWAL_CLOCK_SKEW > tmp_record.end_time) {
-
- /* skip expired proxy (or ones that are going to expire soon),
- leaving it untouched (it will be removed after next run of the
- renewal process) */
-
- continue;
- }
-
- record->suffix = tmp_record.suffix;
- record->jobids.len = tmp_record.jobids.len;
- record->jobids.val = tmp_record.jobids.val;
- record->unique = tmp_record.unique;
- record->voms_exts = tmp_record.voms_exts;
- if (record->myproxy_server)
- free(record->myproxy_server);
- record->myproxy_server = tmp_record.myproxy_server;
- record->end_time = tmp_record.end_time;
- record->next_renewal = tmp_record.next_renewal;
- return 0;
- }
-
- if (last_used_suffix)
- *last_used_suffix = last_suffix;
-
- if (record->suffix >= 0) {
- edg_wlpr_Log(LOG_DEBUG, "Requested suffix %d not found in meta file",
- record->suffix);
- }
-
- free_record(&tmp_record);
-
- return EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND;
-}
-
-static int
-get_record(FILE *fd, proxy_record *record)
-{
- return get_record_ext(fd, record, NULL);
-}
-
-static int
-store_record(char *basename, proxy_record *record)
-{
- int stored = 0;
- FILE *fd = NULL;
- int temp;
- char line[1024];
- char *new_line = NULL;
- int ret, i;
- char *p;
- proxy_record tmp_record;
- char tmp_file[FILENAME_MAX];
- char meta_file[FILENAME_MAX];
- int line_num = 0;
-
- assert (record != NULL);
-
- memset(&tmp_record, 0, sizeof(tmp_record));
-
- snprintf(meta_file, sizeof(meta_file), "%s.data", basename);
- snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", meta_file);
-
- temp = mkstemp(tmp_file);
- if (temp < 0)
- return errno;
-
- fd = fopen(meta_file, "r");
- if (fd == NULL) {
- ret = errno;
- goto end;
- }
- while (fgets(line, sizeof(line), fd) != NULL) {
- line_num++;
- free_record(&tmp_record);
- p = strchr(line, '\n');
- if (p)
- *p = '\0';
- ret = decode_record(line, &tmp_record);
- if (ret) {
- edg_wlpr_Log(LOG_ERR, "Removing invalid entry at line %d in %s", line_num, basename);
- continue;
- }
- if (record->suffix == tmp_record.suffix &&
- record->unique == tmp_record.unique) {
- tmp_record.next_renewal = record->next_renewal;
- tmp_record.end_time = record->end_time;
- tmp_record.voms_exts = record->voms_exts;
- if (tmp_record.myproxy_server != NULL)
- free(tmp_record.myproxy_server);
- tmp_record.myproxy_server = strdup(record->myproxy_server);
- if (tmp_record.jobids.val) {
- for (i = 0; i < tmp_record.jobids.len; i++)
- free(tmp_record.jobids.val[i]);
- free(tmp_record.jobids.val);
- }
- tmp_record.jobids.len = 0;
- tmp_record.jobids.val = NULL;
- for (i = 0; i < record->jobids.len; i++) {
- realloc_prd_list(&tmp_record.jobids);
- tmp_record.jobids.val[tmp_record.jobids.len - 1] =
- strdup(record->jobids.val[i]);
- }
- stored = 1;
- }
- ret = encode_record(&tmp_record, &new_line);
- if (ret)
- goto end;
- dprintf(temp, "%s\n", new_line);
- free(new_line);
- new_line = NULL;
- }
- if (! stored) {
- ret = encode_record(record, &new_line);
- if (ret)
- goto end;
- ret = dprintf(temp, "%s\n", new_line);
- free(new_line);
- new_line = NULL;
- }
- fclose(fd); fd = NULL;
- close(temp);
-
- ret = rename(tmp_file, meta_file);
- if (ret)
- ret = errno;
-
-end:
- free_record(&tmp_record);
- if (fd)
- fclose(fd);
- close(temp);
- return ret;
-}
-
-static int
-open_metafile(char *basename, FILE **fd)
-{
- FILE *meta_fd;
- char meta_filename[FILENAME_MAX];
-
- snprintf(meta_filename, sizeof(meta_filename), "%s.data", basename);
- meta_fd = fopen(meta_filename, "a+");
- if (meta_fd == NULL) {
- edg_wlpr_Log(LOG_ERR, "Opening meta file %s failed (%s)",
- meta_filename, strerror(errno));
- return errno;
- }
- rewind(meta_fd);
- *fd = meta_fd;
- edg_wlpr_Log(LOG_DEBUG, "Using meta file %s", meta_filename);
- return 0;
-}
-
-static int
-filename_to_response(char *filename, edg_wlpr_Response *response)
-{
- response->filenames = malloc(2 * sizeof(*response->filenames));
- if (response->filenames == NULL) {
- edg_wlpr_Log(LOG_DEBUG, "Not enough memory");
- return errno;
- }
- response->filenames[0] = strdup(filename);
- if (response->filenames[0] == NULL) {
- edg_wlpr_Log(LOG_DEBUG, "Not enough memory");
- free(response->filenames);
- return errno;
- }
- response->filenames[1] = NULL;
- return 0;
-}
-
-static void
-record_to_response(int status_code, proxy_record *record,
- edg_wlpr_Response *response)
-{
- /* XXX Neni struktrura proxy_record zbytecna? Mohla by se pouzivat primo
- edg_wlpr_Response? */
- response->response_code = status_code; /* XXX chyba parsovatelna pres API */
- if (status_code)
- return;
-
- if (response->myproxy_server) {
- response->myproxy_server = strdup(record->myproxy_server);
- if (response->myproxy_server == NULL) {
- response->response_code = ENOMEM; /* XXX */
- return;
- }
- }
- response->end_time = record->end_time;
- response->next_renewal_time = record->next_renewal;
- /* XXX use jobid response->counter = record->counter; */
-}
-
-int
-check_proxyname(char *datafile, char *jobid, char **filename)
-{
- proxy_record record;
- FILE *meta_fd = NULL;
- char line[1024];
- char proxy[FILENAME_MAX];
- char *p;
- int ret, i;
-
- memset(&record, 0, sizeof(record));
-
- meta_fd = fopen(datafile, "r");
- if (meta_fd == NULL) {
- edg_wlpr_Log(LOG_ERR, "Cannot open meta file %s (%s)",
- datafile, strerror(errno));
- return errno;
- }
-
- while (fgets(line, sizeof(line), meta_fd) != NULL) {
- free_record(&record);
- p = strchr(line, '\n');
- if (p)
- *p = '\0';
- ret = decode_record(line, &record);
- if (ret)
- continue; /* XXX exit? */
- for (i = 0; i < record.jobids.len; i++) {
- if (strcmp(jobid, record.jobids.val[i]) == 0) {
- snprintf(proxy, sizeof(proxy), "%s/%s", repository, datafile);
- p = strrchr(proxy, '.');
- sprintf(p, ".%d", record.suffix);
- *filename = strdup(proxy);
- free_record(&record);
- fclose(meta_fd);
- return 0;
- }
- }
- }
- free_record(&record);
- fclose(meta_fd);
- return EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND;
-}
-
-int
-find_proxyname(char *jobid, char **filename)
-{
- DIR *dir = NULL;
- struct dirent *file;
- int ret;
-
- chdir(repository);
-
- dir = opendir(repository);
- if (dir == NULL) {
- edg_wlpr_Log(LOG_ERR, "Cannot open repository directory %s (%s)",
- repository, strerror(errno));
- return errno;
- }
-
- while ((file = readdir(dir))) {
- /* read files of format `md5sum`.data, where md5sum() is of fixed length
- 32 chars */
- if (file->d_name == NULL || strlen(file->d_name) != 37 ||
- strcmp(file->d_name + 32, ".data") != 0)
- continue;
- ret = check_proxyname(file->d_name, jobid, filename);
- if (ret == 0) {
- closedir(dir);
- return 0;
- }
- }
- closedir(dir);
- edg_wlpr_Log(LOG_ERR, "Requested proxy is not registered");
- return EDG_WLPR_PROXY_NOT_REGISTERED;
-}
-
-#ifdef NOVOMS
-int
-find_voms_cert(char *file, int *present)
-{
- *present = 0;
- return 0;
-}
-
-#else
-int
-find_voms_cert(char *file, int *present)
-{
- struct vomsdata *voms_info = NULL;
- STACK_OF(X509) *chain = NULL;
- EVP_PKEY *privkey = NULL;
- X509 *cert = NULL;
- int ret, err;
-
- *present = 0;
-
- voms_info = VOMS_Init(vomsdir, cadir);
- if (voms_info == NULL) {
- edg_wlpr_Log(LOG_ERR, "check_voms_cert(): Cannot initialize VOMS context (VOMS_Init() failed, probably voms dir was not specified)");
- return EDG_WLPR_ERROR_VOMS;
- }
-
- ret = load_proxy(file, &cert, &privkey, &chain, NULL);
- if (ret) {
- VOMS_Destroy(voms_info);
- return ret;
- }
-
- ret = VOMS_Retrieve(cert, chain, RECURSE_CHAIN, voms_info, &err);
- if (ret == 1) {
- *present = 1;
- }
-
- VOMS_Destroy(voms_info);
- X509_free(cert);
- EVP_PKEY_free(privkey);
- sk_X509_pop_free(chain, X509_free);
- return 0;
-}
-#endif
-
-void
-register_proxy(edg_wlpr_Request *request, edg_wlpr_Response *response)
-{
- proxy_record record;
- int ret;
- FILE *meta_fd = NULL;
- int last_suffix;
- char *basename = NULL;
- char filename[FILENAME_MAX];
-
- assert(request != NULL);
- assert(response != NULL);
-
- memset(&record, 0, sizeof(record));
- memset(response, 0, sizeof(*response));
- edg_wlpr_Log(LOG_DEBUG, "Registration request for %s", request->proxy_filename);
-
- if (request->proxy_filename == NULL || request->jobid == NULL) {
- edg_wlpr_Log(LOG_ERR, "Registration request doesn't contain registration information");
- return; /* EINVAL; */
- }
- umask(0177);
-
- ret = get_base_filename(request->proxy_filename, &basename);
- if (ret)
- goto end;
-
- ret = open_metafile(basename, &meta_fd);
- if (ret)
- goto end;
-
- if (voms_enabled)
- ret = find_voms_cert(request->proxy_filename, &record.voms_exts);
- /* ignore VOMS related error */
-
- /* Find first free record */
- record.suffix = -1;
- record.myproxy_server = strdup(request->myproxy_server);
- ret = get_record_ext(meta_fd, &record, &last_suffix);
- fclose(meta_fd); meta_fd = NULL;
- if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND)
- goto end;
-
- if (ret == EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND || record.jobids.len == 0 || request->unique || record.voms_exts) {
- /* create a new proxy file in the repository */
- int suffix;
-
- suffix = (record.jobids.len == 0 && record.suffix >= 0) ?
- record.suffix : last_suffix + 1;
- snprintf(filename, sizeof(filename), "%s.%d", basename, suffix);
- ret = copy_file(request->proxy_filename, filename);
- if (ret)
- goto end;
- ret = get_times(filename, &record);
- if (ret)
- goto end;
- record.suffix = suffix;
- ret = realloc_prd_list(&record.jobids);
- if (ret)
- goto end;
- record.jobids.val[record.jobids.len - 1] = strdup(request->jobid);
- record.unique = request->unique;
- edg_wlpr_Log(LOG_DEBUG, "Created a new proxy file in repository (%s)",
- filename);
- } else {
- ret = realloc_prd_list(&record.jobids);
- if (ret)
- goto end;
- record.jobids.val[record.jobids.len - 1] = strdup(request->jobid);
- snprintf(filename, sizeof(filename), "%s.%d", basename, record.suffix);
- edg_wlpr_Log(LOG_DEBUG, "Inremented counter on %s", filename);
- }
-
- ret = store_record(basename, &record);
-
-end:
- if (meta_fd) {
- fclose(meta_fd);
- }
-
- if (basename)
- free(basename);
-
- if (ret == 0)
- ret = filename_to_response(filename, response);
- record_to_response(ret, &record, response);
- free_record(&record);
-}
-
-void
-unregister_proxy(edg_wlpr_Request *request, edg_wlpr_Response *response)
-{
- proxy_record record;
- int ret, i, index;
- FILE *meta_fd = NULL;
- char *basename = NULL;
- char *p;
- struct stat stat_buf;
-
- memset(&record, 0, sizeof(record));
- edg_wlpr_Log(LOG_DEBUG, "Unregistration request for %s", request->jobid);
-
- if (request->jobid == NULL) {
- edg_wlpr_Log(LOG_ERR, "Unregistration request doesn't contain needed information");
- ret = EINVAL;
- goto end;
- }
-
- if (request->proxy_filename == NULL) {
- ret = find_proxyname(request->jobid, &request->proxy_filename);
- if (ret)
- goto end;
- }
-
- ret = get_base_filename(request->proxy_filename, &basename);
- if (ret) {
- goto end;
- }
-
- if (strncmp(request->proxy_filename, basename, strlen(basename) != 0)) {
- edg_wlpr_Log(LOG_DEBUG, "Requested proxy %s is not from repository",
- request->proxy_filename);
- ret = EDG_WLPR_PROXY_NOT_REGISTERED;
- goto end;
- }
-
- p = strrchr(request->proxy_filename, '.');
- if (p == NULL) {
- edg_wlpr_Log(LOG_DEBUG, "Requested proxy %s is not from repository",
- request->proxy_filename);
- ret = EDG_WLPR_PROXY_NOT_REGISTERED;
- goto end;
- }
-
- ret = edg_wlpr_DecodeInt(p+1, &record.suffix);
- if (ret) {
- edg_wlpr_Log(LOG_DEBUG, "Requested proxy %s is not from repository",
- request->proxy_filename);
- ret = EDG_WLPR_PROXY_NOT_REGISTERED;
- goto end;
- }
-
- ret = open_metafile(basename, &meta_fd);
- if (ret) {
- /* fill in error response */
- return;
- }
-
- ret = get_record(meta_fd, &record);
- if (ret)
- goto end;
-
- ret = EDG_WLPR_PROXY_NOT_REGISTERED;
- for (i = 0; i < record.jobids.len; i++)
- if (strcmp(request->jobid, record.jobids.val[i]) == 0) {
- ret = 0;
- break;
- }
- if (ret) {
- edg_wlpr_Log(LOG_DEBUG, "Requested proxy %s is not registered",
- request->proxy_filename);
- goto end;
- }
-
- /* remove jobid from the list */
- index = i;
- free(record.jobids.val[i]);
- record.jobids.len--;
- for (i = index; i < record.jobids.len; i++)
- record.jobids.val[i] = record.jobids.val[i+1];
-
- if (record.jobids.len == 0) {
- record.unique = 0;
- record.voms_exts = 0;
- record.end_time = 0;
- record.next_renewal = 0;
- }
-
- ret = stat(request->proxy_filename, &stat_buf);
- if (ret) {
- edg_wlpr_Log(LOG_DEBUG, "Cannot stat file %s: (%s)",
- request->proxy_filename, strerror(errno));
- ret = errno;
- goto end;
- }
-
- ret = store_record(basename, &record);
- if (ret)
- goto end;
-
- if (record.jobids.len == 0)
- unlink(request->proxy_filename);
-
-end:
- if (meta_fd) {
- fclose(meta_fd);
- }
- if (basename)
- free(basename);
-
- if (ret == 0)
- ret = filename_to_response(request->proxy_filename, response);
- record_to_response(ret, &record, response);
- free_record(&record);
-}
-
-void
-get_proxy(edg_wlpr_Request *request, edg_wlpr_Response *response)
-{
- char *filename = NULL;
- int ret;
-
- memset(response, 0, sizeof(*response));
-
- edg_wlpr_Log(LOG_DEBUG, "GET request for %s", request->jobid);
-
- if (request->jobid == NULL) {
- edg_wlpr_Log(LOG_ERR, "GET request doesn't contain jobid specification");
- ret = EINVAL;
- goto end;
- }
-
- ret = find_proxyname(request->jobid, &filename);
-
-end:
- if (ret == 0)
- ret = filename_to_response(filename, response);
- if (filename)
- free(filename);
- response->response_code = ret;
-}
-
-void
-update_db(edg_wlpr_Request *request, edg_wlpr_Response *response)
-{
- FILE *fd = NULL;
- int tmp_fd = -1;
- int suffix = -1;
- char tmp_file[FILENAME_MAX];
- char cur_proxy[FILENAME_MAX];
- char datafile[FILENAME_MAX];
- char line[1024];
- char *new_line = NULL;
- char *basename, *proxy = NULL;
- char **entry;
- proxy_record record;
- int ret;
- char *p;
- time_t current_time;
-
- memset(&record, 0, sizeof(record));
-
- edg_wlpr_Log(LOG_DEBUG, "UPDATE_DB request for %s", request->proxy_filename);
-
- chdir(repository);
- basename = request->proxy_filename;
-
- snprintf(datafile, sizeof(datafile), "%s.data", basename);
- fd = fopen(datafile, "r");
- if (fd == NULL) {
- edg_wlpr_Log(LOG_ERR, "Cannot open meta file %s (%s)",
- datafile, strerror(errno));
- ret = errno;
- return;
- }
-
- snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", datafile);
- tmp_fd = mkstemp(tmp_file);
- if (tmp_fd < 0) {
- edg_wlpr_Log(LOG_ERR, "Cannot create temporary file (%s)",
- strerror(errno));
- ret = errno;
- goto end;
- }
-
- entry = request->entries;
- if (entry) {
- p = strchr(*entry, ':');
- *p = '\0';
- suffix = atoi(*entry);
- proxy = p+1;
- }
-
- current_time = time(NULL);
-
- while (fgets(line, sizeof(line), fd) != NULL) {
- free_record(&record);
- p = strchr(line, '\n');
- if (p)
- *p = '\0';
- ret = decode_record(line, &record);
- if (ret)
- goto end;
-
- if (record.suffix > suffix && entry && *entry) {
- do {
- entry++;
- if (entry == NULL || *entry == NULL) {
- suffix = -1;
- break;
- }
-
- p = strchr(*entry, ':');
- suffix = atoi(*entry);
- proxy = p+1;
- } while (record.suffix > suffix);
- }
-
- if (record.suffix == suffix) {
- snprintf(cur_proxy, sizeof(cur_proxy), "%s.%d", basename, suffix);
- if (proxy == NULL || *proxy == '\0') {
- /* if proxy isn't specified use file registered currently and
- * reschedule renewal */
- if (record.end_time < current_time) {
- char *server;
- /* remove file with expired proxy and clean the record in db */
- unlink(cur_proxy);
- server = strdup(record.myproxy_server);
- free_record(&record);
- record.suffix = suffix;
- record.myproxy_server = server;
- edg_wlpr_Log(LOG_WARNING, "Removed expired proxy %s", cur_proxy);
- } else
- get_times(cur_proxy, &record);
- } else {
- ret = get_times(proxy, &record);
- (ret == 0) ? rename(proxy, cur_proxy) : unlink(proxy);
- }
- }
-
- ret = encode_record(&record, &new_line);
- if (ret)
- goto end;
-
- dprintf(tmp_fd, "%s\n", new_line);
- free(new_line);
- new_line = NULL;
- }
- free_record(&record);
-
- close(tmp_fd);
- fclose(fd);
-
- rename(tmp_file, datafile);
-
- return;
-
-end:
- if (fd)
- fclose(fd);
- unlink(tmp_file);
- if (tmp_fd > 0)
- close(tmp_fd);
- free_record(&record);
-
- return;
-}
+++ /dev/null
-#include "renewal_locl.h"
-
-#ident "$Header$"
-
-/* nread() and nwrite() never return partial data */
-static int
-nread(int sock, struct timeval *to, char *buf, size_t buf_len, size_t *read_len)
-{
- size_t count;
- size_t remain = buf_len;
- char *cbuf = buf;
- fd_set fds;
- struct timeval timeout,before,after;
- int ret;
-
- if (to) {
- memcpy(&timeout,to,sizeof(timeout));
- gettimeofday(&before,NULL);
- }
-
- while (remain > 0) {
- FD_ZERO(&fds);
- FD_SET(sock,&fds);
- switch (select(sock+1, &fds, NULL, NULL, to ? &timeout : NULL)) {
- case 0:
- ret = EDG_WLPR_ERROR_TIMEOUT;
- goto end;
- case -1:
- ret = EDG_WLPR_ERROR_ERRNO;
- goto end;
- }
-
- count = read(sock, cbuf, remain);
- if (count < 0) {
- if (errno == EINTR)
- continue;
- else {
- ret = EDG_WLPR_ERROR_ERRNO;
- goto end;
- }
- } else
- if (count == 0) {
- *read_len = 0;
- return 0;
- }
- cbuf += count;
- remain -= count;
- }
- *read_len = buf_len;
- ret = 0;
-
-end:
- if (to) {
- gettimeofday(&after,NULL);
- edg_wlpr_DecrementTimeout(to, before, after);
- if (to->tv_sec < 0) {
- to->tv_sec = 0;
- to->tv_usec = 0;
- }
- }
-
- return ret;
-}
-
-static size_t
-nwrite(int sock, struct timeval *to, const char *buf, size_t buf_len)
-{
- const char *cbuf = buf;
- size_t count;
- size_t remain = buf_len;
- fd_set fds;
- struct timeval timeout,before,after;
- int ret;
-
- if (to) {
- memcpy(&timeout,to,sizeof(timeout));
- gettimeofday(&before,NULL);
- }
-
- while (remain > 0) {
- FD_ZERO(&fds);
- FD_SET(sock,&fds);
- switch (select(sock+1, NULL, &fds, NULL, to ? &timeout : NULL)) {
- case 0: ret = EDG_WLPR_ERROR_TIMEOUT;
- goto end;
- case -1: ret = EDG_WLPR_ERROR_ERRNO;
- goto end;
- }
-
- count = write(sock, cbuf, remain);
- if (count < 0) {
- if (errno == EINTR)
- continue;
- else {
- ret = EDG_WLPR_ERROR_ERRNO;
- goto end;
- }
- }
- cbuf += count;
- remain -= count;
- }
- ret = buf_len;
-
-end:
- if (to) {
- gettimeofday(&after,NULL);
- edg_wlpr_DecrementTimeout(to, before, after);
- if (to->tv_sec < 0) {
- to->tv_sec = 0;
- to->tv_usec = 0;
- }
- }
-
- return ret;
-}
-
-int
-edg_wlpr_Read(int sock, struct timeval *timeout, char **buf, size_t *buf_len)
-{
- int ret;
- unsigned char length[4];
- size_t len;
-
- ret = nread(sock, timeout, length, 4, &len);
- if (ret) {
- *buf_len = 0;
- return ret;
- }
- if (len != 4) {
- *buf_len = 0;
- return EDG_WLPR_ERROR_UNEXPECTED_EOF; /* XXX vraci i kdyz peer spadne a zavre trubku */
- }
- *buf_len = (length[0] << 24) |
- (length[1] << 16) |
- (length[2] << 8 ) |
- (length[3] << 0);
-
- *buf = malloc(*buf_len);
- if (*buf == NULL)
- return ENOMEM;
-
- ret = nread(sock, timeout, *buf, *buf_len, &len);
- if (ret)
- return ret;
-
- if (len != *buf_len) {
- free(*buf);
- *buf_len = 0;
- return EDG_WLPR_ERROR_UNEXPECTED_EOF; /* XXX */
- }
-
- return 0;
-}
-
-int
-edg_wlpr_Write(int sock, struct timeval *timeout, char *buf, size_t buf_len)
-{
- unsigned char length[4];
-
- length[0] = (buf_len >> 24) & 0xFF;
- length[1] = (buf_len >> 16) & 0xFF;
- length[2] = (buf_len >> 8) & 0xFF;
- length[3] = (buf_len >> 0) & 0xFF;
-
- if (nwrite(sock, timeout, length, 4) != 4 ||
- nwrite(sock, timeout, buf, buf_len) != buf_len)
- return errno;
-
- return 0;
-}
-
-int
-edg_wlpr_GetToken(const char *msg, const size_t msg_len,
- const char *key, const char *separators,
- int req_index, char **value)
-{
- char *p;
- size_t len;
- int index;
-
- assert(separators != NULL);
-
- /* Add ending zero ? */
-
- index = 0;
- p = (char *)msg;
- while (p && (p = strstr(p, key))) {
- if (index == req_index)
- break;
- index++;
- p += strlen(key);
- }
- if (p == NULL)
- return EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND;
-
- p = strchr(p, '=');
- if (p == NULL)
- return EDG_WLPR_ERROR_PROTO_PARSE_ERROR;
-
- len = strcspn(p+1, separators);
- if (len == 0)
- return EDG_WLPR_ERROR_PROTO_PARSE_ERROR;
-
- *value = malloc(len + 1);
- if (*value == NULL)
- return ENOMEM;
-
- memcpy(*value, p+1, len);
- (*value)[len] = '\0';
-
- return 0;
-}
-
-int
-edg_wlpr_StoreToken(char **buf, size_t *buf_len, char *command,
- char *value, const char *separator)
-{
- char line[2048];
- char *tmp;
-
- assert(buf != NULL);
- assert(separator != NULL);
-
- if (strlen(command) + 1 + strlen(value) + 2 > sizeof(line))
- return ERANGE; /* XXX */
-
- snprintf(line, sizeof(line), "%s%s%s", command, value, separator);
-
- while (strlen(*buf) + strlen(line) + 1 > *buf_len) {
- tmp = realloc(*buf, *buf_len + EDG_WLPR_BUF_SIZE);
- if (tmp == NULL)
- return ENOMEM;
- *buf = tmp;
- *buf_len += EDG_WLPR_BUF_SIZE;
- }
- strcat(*buf, line);
-
- return 0;
-}
-
-void
-edg_wlpr_CleanRequest(edg_wlpr_Request *request)
-{
- assert(request != NULL);
- if (request->version)
- free(request->version);
- if (request->proxy_filename)
- free(request->proxy_filename);
- if (request->myproxy_server)
- free(request->myproxy_server);
- if (request->jobid)
- free(request->jobid);
- if (request->entries) {
- char **p = request->entries;
- char **next;
- while (*p) {
- next = p+1;
- free(*p);
- p = next;
- }
- free(request->entries);
- }
-
- memset(request, 0, sizeof(request));
-}
-
-void
-edg_wlpr_CleanResponse(edg_wlpr_Response *response)
-{
- assert(response != NULL);
- if (response->version)
- free(response->version);
- if (response->myproxy_server)
- free(response->myproxy_server);
- if (response->filenames) {
- char **p = response->filenames;
- char **next;
-
- while (*p) {
- next = p+1;
- free(*p);
- p = next;
- }
- free(response->filenames);
- }
- memset(response, 0, sizeof(*response));
-}
-
-const char *
-edg_wlpr_GetErrorString(int code)
-{
- return (code == 0) ? "OK" : "Error";
-}
-
-char *
-edg_wlpr_EncodeInt(int num) /* long? time */
-{
- static char ret[64];
-
- snprintf(ret, sizeof(ret), "%d", num);
- return ret;
-}
-
-int
-edg_wlpr_DecodeInt(char *str, int *num)
-{
- *num = atol(str); /* XXX */
- return 0;
-}
-
-int
-edg_wlpr_DecrementTimeout(struct timeval *timeout, struct timeval before, struct timeval after)
-{
- (*timeout).tv_sec = (*timeout).tv_sec - (after.tv_sec - before.tv_sec);
- (*timeout).tv_usec = (*timeout).tv_usec - (after.tv_usec - before.tv_usec);
- while ( (*timeout).tv_usec < 0) {
- (*timeout).tv_sec--;
- (*timeout).tv_usec += 1000000;
- }
-
- if ( ((*timeout).tv_sec < 0) || (((*timeout).tv_sec == 0) && ((*timeout).tv_usec == 0)) ) return(1);
- else return(0);
-}
+++ /dev/null
-#include "renewal_locl.h"
-#include "renewd_locl.h"
-
-#include "glite/security/voms/voms_apic.h"
-
-#ident "$Header$"
-
-#define RENEWAL_COUNTS_MAX 1000 /* the slave daemon exits after that many attemtps */
-
-extern char *repository;
-extern char *cadir;
-extern char *vomsdir;
-extern int voms_enabled;
-extern char *vomsconf;
-
-static int received_signal = -1, die = 0;
-
-static void
-check_renewal(char *datafile, int force_renew, int *num_renewed);
-
-static int
-renew_proxy(proxy_record *record, char *basename, char **new_proxy);
-
-static void
-register_signal(int signal);
-
-int
-load_proxy(const char *cur_file, X509 **cert, EVP_PKEY **priv_key,
- STACK_OF(X509) **chain, globus_gsi_cred_handle_t *cur_proxy)
-{
- globus_result_t result;
- globus_gsi_cred_handle_t proxy = NULL;
- int ret;
-
- result = globus_gsi_cred_handle_init(&proxy, NULL);
- if (result) {
- fprintf(stderr, "globus_gsi_cred_handle_init() failed\n");
- goto end;
- }
-
- result = globus_gsi_cred_read_proxy(proxy, cur_file);
- if (result) {
- fprintf(stderr, "globus_gsi_cred_read_proxy() failed\n");
- goto end;
- }
-
- if (cert) {
- result = globus_gsi_cred_get_cert(proxy, cert);
- if (result) {
- fprintf(stderr, "globus_gsi_cred_get_cert() failed\n");
- goto end;
- }
- }
-
- if (priv_key) {
- result = globus_gsi_cred_get_key(proxy, priv_key);
- if (result) {
- fprintf(stderr, "globus_gsi_cred_get_key() failed\n");
- goto end;
- }
- }
-
- if (chain) {
- result = globus_gsi_cred_get_cert_chain(proxy, chain);
- if (result) {
- fprintf(stderr, "globus_gsi_cred_get_cert_chain() failed\n");
- goto end;
- }
- }
-
- if (cur_proxy) {
- *cur_proxy = proxy;
- proxy = NULL;
- }
-
- ret = 0;
-
-end:
- if (proxy)
- globus_gsi_cred_handle_destroy(proxy);
- if (result)
- ret = EDG_WLPR_ERROR_GENERIC;
-
- return ret;
-}
-
-static void
-register_signal(int signal)
-{
- received_signal = signal;
- switch ((received_signal = signal)) {
- case SIGINT:
- case SIGTERM:
- case SIGQUIT:
- die = signal;
- break;
- default:
- break;
- }
-}
-
-static int
-renew_proxy(proxy_record *record, char *basename, char **new_proxy)
-{
- char tmp_proxy[FILENAME_MAX];
- int tmp_fd;
- char repository_file[FILENAME_MAX];
- int ret = -1;
- char *p;
- char *server = NULL;
- myproxy_socket_attrs_t *socket_attrs;
- myproxy_request_t *client_request;
- myproxy_response_t *server_response;
- char *renewed_proxy;
-
- socket_attrs = malloc(sizeof(*socket_attrs));
- memset(socket_attrs, 0, sizeof(*socket_attrs));
-
- client_request = malloc(sizeof(*client_request));
- memset(client_request, 0, sizeof(*client_request));
-
- server_response = malloc(sizeof(*server_response));
- memset(server_response, 0, sizeof(*server_response));
-
- myproxy_set_delegation_defaults(socket_attrs, client_request);
-
- edg_wlpr_Log(LOG_DEBUG, "Trying to renew proxy in %s.%d",
- basename, record->suffix);
-
- snprintf(tmp_proxy, sizeof(tmp_proxy), "%s.%d.myproxy.XXXXXX",
- basename, record->suffix);
- tmp_fd = mkstemp(tmp_proxy);
- if (tmp_fd == -1) {
- edg_wlpr_Log(LOG_ERR, "Cannot create temporary file (%s)",
- strerror(errno));
- return errno;
- }
-
- snprintf(repository_file, sizeof(repository_file),"%s.%d",
- basename, record->suffix);
-
- ret = get_proxy_base_name(repository_file, &client_request->username);
- if (ret)
- goto end;
-
- client_request->proxy_lifetime = 60 * 60 * DGPR_RETRIEVE_DEFAULT_HOURS;
- client_request->authzcreds = repository_file;
-
- server = (record->myproxy_server) ? record->myproxy_server :
- socket_attrs->pshost;
- if (server == NULL) {
- edg_wlpr_Log(LOG_ERR, "No myproxy server specified");
- ret = EINVAL;
- goto end;
- }
- socket_attrs->pshost = strdup(server);
-
- p = strchr(socket_attrs->pshost, ':');
- if (p) {
- *p++ = '\0';
- ret = edg_wlpr_DecodeInt(p, &socket_attrs->psport);
- if (ret)
- goto end;
- } else
- socket_attrs->psport = MYPROXY_SERVER_PORT;
-
- verror_clear();
- ret = myproxy_get_delegation(socket_attrs, client_request,
- server_response, tmp_proxy);
- if (ret == 1) {
- ret = EDG_WLPR_ERROR_MYPROXY;
- edg_wlpr_Log(LOG_ERR, "Error contacting MyProxy server for proxy %s: %s",
- repository_file, verror_get_string());
- verror_clear();
- goto end;
- }
-
- renewed_proxy = tmp_proxy;
-
- if (voms_enabled && record->voms_exts) {
- char tmp_voms_proxy[FILENAME_MAX];
- int tmp_voms_fd;
-
- snprintf(tmp_voms_proxy, sizeof(tmp_voms_proxy), "%s.%d.voms.XXXXXX",
- basename, record->suffix);
- tmp_voms_fd = mkstemp(tmp_voms_proxy);
- if (tmp_voms_fd == -1) {
- edg_wlpr_Log(LOG_ERR, "Cannot create temporary file (%s)",
- strerror(errno));
- ret = errno;
- goto end;
- }
-
- ret = renew_voms_creds(repository_file, renewed_proxy, tmp_voms_proxy);
- close(tmp_voms_fd);
- if (ret) {
- unlink(tmp_voms_proxy);
- goto end;
- }
-
- renewed_proxy = tmp_voms_proxy;
- unlink(tmp_proxy);
- }
-
- if (new_proxy)
- *new_proxy = strdup(renewed_proxy);
-
- ret = 0;
-
-end:
- if (socket_attrs->socket_fd)
- close(socket_attrs->socket_fd);
- close(tmp_fd);
- if (ret)
- unlink(tmp_proxy);
- myproxy_free(socket_attrs, client_request, server_response);
-
- return ret;
-}
-
-static void
-check_renewal(char *datafile, int force_renew, int *num_renewed)
-{
- char line[1024];
- proxy_record record;
- char *p;
- int ret, i;
- time_t current_time;
- FILE *meta_fd = NULL;
- char basename[FILENAME_MAX];
- edg_wlpr_Request request;
- edg_wlpr_Response response;
- char *new_proxy = NULL;
- char *entry = NULL;
- char **tmp;
- int num = 0;
-
- assert(datafile != NULL);
-
- *num_renewed = 0;
-
- memset(&record, 0, sizeof(record));
- memset(basename, 0, sizeof(basename));
- memset(&request, 0, sizeof(request));
- memset(&response, 0, sizeof(response));
-
- strncpy(basename, datafile, sizeof(basename) - 1);
- p = basename + strlen(basename) - strlen(".data");
- if (strcmp(p, ".data") != 0) {
- edg_wlpr_Log(LOG_ERR, "Meta filename doesn't end with '.data'");
- return;
- }
- *p = '\0';
-
- request.command = EDG_WLPR_COMMAND_UPDATE_DB;
- request.proxy_filename = strdup(basename);
-
- meta_fd = fopen(datafile, "r");
- if (meta_fd == NULL) {
- edg_wlpr_Log(LOG_ERR, "Cannot open meta file %s (%s)",
- datafile, strerror(errno));
- return;
- }
-
- current_time = time(NULL);
- edg_wlpr_Log(LOG_DEBUG, "Reading metafile %s", datafile);
-
- while (fgets(line, sizeof(line), meta_fd) != NULL) {
- free_record(&record);
- p = strchr(line, '\n');
- if (p)
- *p = '\0';
- ret = decode_record(line, &record);
- if (ret)
- continue; /* XXX exit? */
- if (record.jobids.len == 0) /* no jobid registered for this proxy */
- continue;
- if (current_time + RENEWAL_CLOCK_SKEW >= record.end_time ||
- record.next_renewal <= current_time ||
- force_renew) {
- ret = EDG_WLPR_PROXY_EXPIRED;
- if ( record.end_time + RENEWAL_CLOCK_SKEW >= current_time) {
- /* only try renewal if the proxy hasn't already expired */
- ret = renew_proxy(&record, basename, &new_proxy);
- }
-
- /* if the proxy wasn't renewed have the daemon planned another renewal */
- asprintf(&entry, "%d:%s", record.suffix, (ret == 0) ? new_proxy : "");
- if (new_proxy) {
- free(new_proxy); new_proxy = NULL;
- }
-
- tmp = realloc(request.entries, (num + 2) * sizeof(*tmp));
- if (tmp == NULL) {
- free_record(&record);
- return;
- }
- request.entries = tmp;
- request.entries[num] = entry;
- request.entries[num+1] = NULL;
- num++;
- }
- }
- free_record(&record);
-
- if (num > 0) {
- ret = edg_wlpr_RequestSend(&request, &response);
- if (ret != 0)
- edg_wlpr_Log(LOG_ERR,
- "Failed to send update request to master (%d)", ret);
- else if (response.response_code != 0)
- edg_wlpr_Log(LOG_ERR,
- "Master failed to update database (%d)", response.response_code);
-
- /* delete all tmp proxy files which may survive */
- for (i = 0; i < num; i++) {
- p = strchr(request.entries[i], ':');
- if (p+1)
- unlink(p+1);
- }
- }
- fclose(meta_fd);
-
- edg_wlpr_CleanResponse(&response);
- edg_wlpr_CleanRequest(&request);
-
- *num_renewed = num;
-
- return;
-}
-
-int renewal(int force_renew, int *num_renewed)
-{
- DIR *dir = NULL;
- struct dirent *file;
- FILE *fd;
- int num = 0;
-
- edg_wlpr_Log(LOG_DEBUG, "Starting renewal process");
-
- *num_renewed = 0;
-
- if (chdir(repository)) {
- edg_wlpr_Log(LOG_ERR, "Cannot access repository directory %s (%s)",
- repository, strerror(errno));
- return errno;
- }
-
- dir = opendir(repository);
- if (dir == NULL) {
- edg_wlpr_Log(LOG_ERR, "Cannot open repository directory %s (%s)",
- repository, strerror(errno));
- return errno;
- }
-
- while ((file = readdir(dir))) {
- /* read files of format `md5sum`.data, where md5sum() is of fixed length
- 32 chars */
- if (file->d_name == NULL || strlen(file->d_name) != 37 ||
- strcmp(file->d_name + 32, ".data") != 0)
- continue;
- fd = fopen(file->d_name, "r");
- if (fd == NULL) {
- edg_wlpr_Log(LOG_ERR, "Cannot open meta file %s (%s)",
- file->d_name, strerror(errno));
- continue;
- }
- check_renewal(file->d_name, force_renew, &num);
- *num_renewed += num;
- fclose(fd);
- }
- closedir(dir);
- edg_wlpr_Log(LOG_DEBUG, "Finishing renewal process");
- return 0;
-}
-
-void
-watchdog_start(void)
-{
- struct sigaction sa;
- int force_renewal;
- int count = 0, num;
-
- memset(&sa,0,sizeof(sa));
- sa.sa_handler = register_signal;
- sigaction(SIGUSR1, &sa, NULL);
- sigaction(SIGINT,&sa,NULL);
- sigaction(SIGQUIT,&sa,NULL);
- sigaction(SIGTERM,&sa,NULL);
- sigaction(SIGPIPE,&sa,NULL);
-
- while (count < RENEWAL_COUNTS_MAX && !die) {
- received_signal = -1;
- sleep(60 * 5);
- force_renewal = (received_signal == SIGUSR1) ? 1 : 0;
- if (die)
- break;
- /* XXX uninstall signal handler ? */
- renewal(force_renewal, &num);
- count += num;
- }
- edg_wlpr_Log(LOG_DEBUG, "Terminating after %d renewal attempts", count);
- exit(0);
-}
+++ /dev/null
-#ifndef RENEWAL_LOCL_H
-#define RENEWAL_LOCL_H
-
-#ident "$Header$"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <string.h>
-#include <time.h>
-#include <errno.h>
-#include <syslog.h>
-#include <linux/limits.h>
-#include <signal.h>
-#include <assert.h>
-#include <getopt.h>
-#include <dirent.h>
-#include <sys/un.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <sys/wait.h>
-#include <openssl/md5.h>
-#include <openssl/x509.h>
-#include <openssl/pem.h>
-#include <openssl/err.h>
-
-#include "renewal.h"
-
-#define JDL_MYPROXY "Myproxy_server="
-
-typedef enum {
- EDG_WLPR_COMMAND_NONE = 0,
- EDG_WLPR_COMMAND_REG = 1,
- EDG_WLPR_COMMAND_UNREG,
- EDG_WLPR_COMMAND_GET,
- EDG_WLPR_COMMAND_LIST,
- EDG_WLPR_COMMAND_STATUS,
- EDG_WLPR_COMMAND_UPDATE_DB,
-} edg_wlpr_Command;
-
-/* prefix neni nutny */
-#define EDG_WLPR_PROTO_VERSION "Version="
-#define EDG_WLPR_PROTO_COMMAND "Command="
-#define EDG_WLPR_PROTO_MYPROXY_SERVER "Myproxy_server="
-#define EDG_WLPR_PROTO_PROXY "Proxy_name="
-#define EDG_WLPR_PROTO_UNIQUE_PROXY "Unique=" /* XXX */
-#define EDG_WLPR_PROTO_JOBID "Jobid="
-#define EDG_WLPR_PROTO_ENTRY "Entry="
-
-#define EDG_WLPR_PROTO_RESPONSE "Response=" /* XXX result ?? */
-#define EDG_WLPR_PROTO_START_TIME "Start_time="
-#define EDG_WLPR_PROTO_END_TIME "End_time="
-#define EDG_WLPR_PROTO_RENEWAL_TIME "Renewal_time=" /* XXX Next renewal ?? */
-
-#define EDG_WLPR_MYPROXY_PORT 7512
-
-#define EDG_WLPR_REPOSITORY_ROOT "/var/spool/edg-wl-renewd"
-
-#define EDG_WLPR_BUF_SIZE 4096
-
-#define EDG_WLPR_VERSION "EDG Proxy Renewal 1.0"
-
-#define MAX_PROXIES 4 /* max. number of jobids sharing one proxy */
-
-#define RENEWAL_CLOCK_SKEW (5 * 60)
-
-#define DGPR_RETRIEVE_DEFAULT_HOURS 10
-
-#define GLITE_PR_TIMEOUT_DEFAULT 120
-
-typedef struct {
- char *version;
- edg_wlpr_Command command;
- char *myproxy_server;
- char *proxy_filename;
- int unique;
- char *jobid;
- char **entries; /* for updates from the renewal part (renew.c) */
-} edg_wlpr_Request;
-
-typedef struct {
- char *version;
- int response_code;
- time_t start_time;
- time_t end_time;
- time_t next_renewal_time;
- int counter;
- char *myproxy_server;
- char **filenames;
-} edg_wlpr_Response;
-
-#define DGPR_REG_SOCKET_NAME_ROOT "/tmp/dgpr_renew_"
-
-#if 0
-/* Errors: */
-/* XXX enum */
-#define EDG_WLPR_ERROR_EOF 1
-#define EDG_WLPR_ERROR_PARSE_NOT_FOUND 2
-#define EDG_WLPR_ERROR_PARSE_ERROR 3
-#define EDG_WLPR_ERROR_UNKNOWN_COMMAND 4
-#define EDG_WLPR_ERROR_NOTFOUND 5
-#endif
-
-int
-edg_wlpr_GetToken(const char *msg, const size_t msg_len,
- const char *key, const char *separators,
- int req_index, char **value);
-
-int
-edg_wlpr_StoreToken(char **buf, size_t *buf_len, char *command,
- char *value, const char *separator);
-
-int
-edg_wlpr_Read(int sock, struct timeval *timeout, char **buf, size_t *buf_len);
-
-int
-edg_wlpr_Write(int sock, struct timeval *timeout, char *buf, size_t buf_len);
-
-void
-edg_wlpr_CleanRequest(edg_wlpr_Request *request);
-
-void
-edg_wlpr_CleanResponse(edg_wlpr_Response *response);
-
-const char *
-edg_wlpr_GetErrorString(int err);
-
-char *
-edg_wlpr_EncodeInt(int num); /* long? time */
-
-int
-edg_wlpr_DecodeInt(char *str, int *num);
-
-int
-edg_wlpr_RequestSend(edg_wlpr_Request *request, edg_wlpr_Response *response);
-
-int
-edg_wlpr_DecrementTimeout(struct timeval *timeout, struct timeval before, struct timeval after);
-
-#endif /* RENEWAL_LOCL_H */
+++ /dev/null
-#include "renewal_locl.h"
-#include "renewd_locl.h"
-
-static const char rcsid[] = "$Header$";
-
-#define SEPARATORS "\n"
-/* GRIDMANAGER_CHECKPROXY_INTERVAL + GRIDMANAGER_MINIMUM_PROXY_TIME */
-#define CONDOR_MINIMUM_PROXY_TIME (1800)
-
-int debug = 0;
-char *repository = NULL;
-time_t condor_limit = CONDOR_MINIMUM_PROXY_TIME;
-char *cadir = NULL;
-char *vomsdir = NULL;
-int voms_enabled = 0;
-char *cert = NULL;
-char *key = NULL;
-char *vomsconf = NULL;
-
-static volatile int die = 0, child_died = 0;
-double default_timeout = 0;
-
-static struct option opts[] = {
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'v' },
- { "debug", no_argument, NULL, 'd' },
- { "repository", required_argument, NULL, 'r' },
- { "condor-limit", required_argument, NULL, 'c' },
- { "CAdir", required_argument, NULL, 'C' },
- { "VOMSdir", required_argument, NULL, 'V' },
- { "enable-voms", no_argument, NULL, 'A' },
- { "voms-config", required_argument, NULL, 'G' },
- { "cert", required_argument, NULL, 't' },
- { "key", required_argument, NULL, 'k' },
- { NULL, 0, NULL, 0 }
-};
-
-typedef struct {
- edg_wlpr_Command code;
- void (*handler) (edg_wlpr_Request *request, edg_wlpr_Response *response);
-} command_table;
-
-static command_table commands[] = {
- { EDG_WLPR_COMMAND_REG, register_proxy, },
- { EDG_WLPR_COMMAND_UNREG, unregister_proxy, },
- { EDG_WLPR_COMMAND_GET, get_proxy, },
-#if 0
- { EDG_WLPR_COMMAND_LIST, list_proxies, },
- { EDG_WLPR_COMMAND_STATUS, status_proxy, },
-#endif
- { EDG_WLPR_COMMAND_UPDATE_DB, update_db, },
- { 0, NULL },
-};
-
-/* static prototypes */
-static void
-usage(char *progname);
-
-static int
-do_listen(char *socket_name, int *sock);
-
-static int
-encode_response(edg_wlpr_Response *response, char **msg);
-
-static command_table *
-find_command(edg_wlpr_Command code);
-
-static int
-proto(int sock);
-
-static int
-doit(int sock);
-
-static int
-decode_request(const char *msg, const size_t msg_len, edg_wlpr_Request *request);
-
-int
-start_watchdog(pid_t *pid);
-
-static void
-catchsig(int sig)
-{
- switch (sig) {
- case SIGINT:
- case SIGTERM:
- case SIGQUIT:
- die = sig;
- break;
- case SIGCHLD:
- child_died = 1;
- break;
- default:
- break;
- }
-}
-
-static command_table *
-find_command(edg_wlpr_Command code)
-{
- command_table *c;
-
- for (c = commands; c->code; c++) {
- if (c->code == code)
- return c;
- }
- return NULL;
-}
-
-static int
-proto(int sock)
-{
- char *buf = NULL;
- size_t buf_len;
- int ret;
- edg_wlpr_Response response;
- edg_wlpr_Request request;
- command_table *command;
- struct timeval timeout;
-
- memset(&request, 0, sizeof(request));
- memset(&response, 0, sizeof(response));
-
- timeout.tv_sec = (long) default_timeout;
- timeout.tv_usec = (long) ((default_timeout - timeout.tv_sec) * 1e6);
-
- ret = edg_wlpr_Read(sock, &timeout, &buf, &buf_len);
- if (ret) {
- edg_wlpr_Log(LOG_ERR, "Error reading from client: %s",
- edg_wlpr_GetErrorString(ret));
- return ret;
- }
-
- ret = decode_request(buf, buf_len, &request);
- free(buf);
- if (ret)
- goto end;
-
- /* XXX check request (protocol version, ...) */
-
- command = find_command(request.command);
- if (command == NULL) {
- ret = EDG_WLPR_ERROR_UNKNOWN_COMMAND;
- edg_wlpr_Log(LOG_ERR, "Received unknown command (%d)", request.command);
- goto end;
- }
-
- edg_wlpr_Log(LOG_INFO, "Received command code %d for proxy %s and jobid %s",
- request.command,
- request.proxy_filename ? request.proxy_filename : "(unspecified)",
- request.jobid ? request.jobid : "(unspecified)");
-
- command->handler(&request, &response);
-
- ret = encode_response(&response, &buf);
- if (ret)
- goto end;
-
- ret = edg_wlpr_Write(sock, &timeout, buf, strlen(buf) + 1);
- free(buf);
- if (ret) {
- edg_wlpr_Log(LOG_ERR, "Error sending response to client: %s",
- edg_wlpr_GetErrorString(ret));
- goto end;
- }
-
-end:
- edg_wlpr_CleanRequest(&request);
- edg_wlpr_CleanResponse(&response);
-
- return ret;
-}
-
-static int
-doit(int sock)
-{
- int newsock;
- struct sockaddr_un client_addr;
- int client_addr_len = sizeof(client_addr);
- int flags;
-
- while (!die) {
-
- if (child_died) {
- int pid, newpid, ret;
-
- while ((pid=waitpid(-1,NULL,WNOHANG))>0)
- ;
- ret = start_watchdog(&newpid);
- if (ret)
- return ret;
- edg_wlpr_Log(LOG_DEBUG, "Renewal slave process re-started");
- child_died = 0;
- continue;
- }
-
- newsock = accept(sock, (struct sockaddr *) &client_addr, &client_addr_len);
- if (newsock == -1) {
- if (errno != EINTR)
- edg_wlpr_Log(LOG_ERR, "accept() failed");
- continue;
- }
- edg_wlpr_Log(LOG_DEBUG, "Got connection");
-
- flags = fcntl(newsock, F_GETFL, 0);
- if (fcntl(newsock, F_SETFL, flags | O_NONBLOCK) < 0) {
- edg_wlpr_Log(LOG_ERR, "Can't set O_NONBLOCK mode (%s), closing.\n",
- strerror(errno));
- close(newsock);
- continue;
- }
-
- proto(newsock);
-
- edg_wlpr_Log(LOG_DEBUG, "Connection closed");
- close(newsock);
- }
- edg_wlpr_Log(LOG_DEBUG, "Terminating on signal %d\n",die);
- return 0;
-}
-
-static int
-decode_request(const char *msg, const size_t msg_len, edg_wlpr_Request *request)
-{
- char *value = NULL;
-#if 0
- char *p;
- int port;
-#endif
- int ret;
- int index;
-
- /* XXX add an ending zero '\0' */
-
- assert(msg != NULL);
- assert(request != NULL);
-
- memset(request, 0, sizeof(*request));
-
- ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_VERSION, SEPARATORS,
- 0, &request->version);
- if (ret) {
- edg_wlpr_Log(LOG_ERR, "Protocol error reading protocol specification: %s",
- edg_wlpr_GetErrorString(ret));
- return ret;
- }
-
- ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_COMMAND, SEPARATORS,
- 0, &value);
- if (ret) {
- edg_wlpr_Log(LOG_ERR, "Protocol error reading command specification: %s",
- edg_wlpr_GetErrorString(ret));
- goto err;
- }
-
- ret = edg_wlpr_DecodeInt(value, (int *)(&request->command));
- if (ret) {
- edg_wlpr_Log(LOG_ERR, "Received non-numeric command specification (%s)",
- value);
- free(value);
- goto err;
- }
- free(value);
-
- if (find_command(request->command) == NULL) {
- edg_wlpr_Log(LOG_ERR, "Received unknown command (%d)", request->command);
- ret = EDG_WLPR_ERROR_UNKNOWN_COMMAND;
- goto err;
- }
-
- ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_MYPROXY_SERVER,
- SEPARATORS, 0, &request->myproxy_server);
- if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) {
- edg_wlpr_Log(LOG_ERR, "Protocol error reading myproxy server specification: %s",
- edg_wlpr_GetErrorString(ret));
- goto err;
- }
-
-#if 0
- request->myproxy_port = EDG_WLPR_MYPROXY_PORT; /* ??? */
- if (request->myproxy_server && (p = strchr(request->myproxy_server, ':'))) {
- *p = '\0';
- port = atol(p+1); /* XXX see myproxy for err check */
- request->myproxy_port = port;
- }
-#endif
-
- ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_PROXY, SEPARATORS,
- 0, &request->proxy_filename);
- if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) {
- edg_wlpr_Log(LOG_ERR, "Protocol error reading proxy specification: %s",
- edg_wlpr_GetErrorString(ret));
- goto err;
- }
-
-#if 0
- ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_UNIQUE_PROXY,
- SEPARATORS, 0, &value);
- if (ret && ret != EDG_WLPR_ERROR_PARSE_NOT_FOUND)
- goto err;
- if (ret == 0 && strcasecmp(value, "yes") == 0)
- request->unique = 1;
- free(value);
-#endif
-
- ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_JOBID, SEPARATORS,
- 0, &request->jobid);
- if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) {
- edg_wlpr_Log(LOG_ERR, "Protocol error reading JobId : %s",
- edg_wlpr_GetErrorString(ret));
- goto err;
- }
-
- index = 0;
- while ((ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_ENTRY,
- SEPARATORS, index, &value)) == 0) {
- char **tmp;
-
- tmp = realloc(request->entries, (index + 2) * sizeof(*tmp));
- if (tmp == NULL) {
- ret = ENOMEM;
- goto err;
- }
- request->entries = tmp;
- request->entries[index] = value;
- index++;
- }
- if (ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND)
- goto err;
- if (request->entries)
- request->entries[index] = NULL;
-
- return 0;
-
-err:
- edg_wlpr_CleanRequest(request);
- return ret;
-}
-
-static int
-encode_response(edg_wlpr_Response *response, char **msg)
-{
- char *buf;
- size_t buf_len;
- int ret;
-
- buf_len = EDG_WLPR_BUF_SIZE;
- buf = malloc(buf_len);
- if (buf == NULL)
- return ENOMEM;
- buf[0] = '\0';
-
- ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_VERSION,
- EDG_WLPR_VERSION, SEPARATORS);
- if (ret)
- goto err;
-
- ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_RESPONSE,
- edg_wlpr_EncodeInt(response->response_code),
- SEPARATORS);
- if (ret)
- goto err;
-
- if (response->myproxy_server) {
- char host[1024];
-
-#if 0
- snprintf(host, sizeof(host), "%s:%d", response->myproxy_server,
- (response->myproxy_port) ? response->myproxy_port : EDG_WLPR_MYPROXY_PORT);
-#endif
- ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_MYPROXY_SERVER,
- host, SEPARATORS);
- if (ret)
- goto err;
- }
-
- if (response->start_time) {
- ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_START_TIME,
- edg_wlpr_EncodeInt(response->start_time),
- SEPARATORS);
- if (ret)
- goto err;
- }
-
- if (response->end_time) {
- ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_END_TIME,
- edg_wlpr_EncodeInt(response->end_time),
- SEPARATORS);
- if (ret)
- goto err;
- }
-
- if (response->next_renewal_time) {
- ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_RENEWAL_TIME,
- edg_wlpr_EncodeInt(response->next_renewal_time),
- SEPARATORS);
- if (ret)
- goto err;
- }
-
- if (response->filenames) {
- char **p = response->filenames;
- while (*p) {
- ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_PROXY, *p,
- SEPARATORS);
- if (ret)
- goto err;
- p++;
- }
- }
-
- buf[strlen(buf)] = '\0';
- *msg = buf;
- return 0;
-
-err:
- free(buf);
- *msg = NULL;
- return ret;
-}
-
-
-static void
-usage(char *progname)
-{
- fprintf(stderr,"usage: %s [option]\n"
- "\t-h, --help display this help and exit\n"
- "\t-v, --version output version information and exit\n"
- "\t-d, --debug don't fork, print out debugging information\n"
- "\t-r, --repository repository directory\n"
- "\t-c, --condor-limit how long before expiration the proxy must be renewed\n"
- "\t-C, --CAdir trusted certificates directory\n"
- "\t-V, --VOMSdir trusted VOMS servers certificates directory\n"
- "\t-A, --enable-voms renew also VOMS certificates in proxies\n"
- "\t-G, --voms-config location of the vomses configuration file\n",
- progname);
-}
-
-static int
-do_listen(char *socket_name, int *sock)
-{
- struct sockaddr_un my_addr;
- int s;
- int ret;
-
- assert(sock != NULL);
-
- memset(&my_addr, 0, sizeof(my_addr));
- my_addr.sun_family = AF_UNIX;
- strncpy(my_addr.sun_path, socket_name, sizeof(my_addr.sun_path));
- unlink(socket_name);
- umask(0177);
-
- s = socket(AF_UNIX, SOCK_STREAM, 0);
- if (s == -1) {
- edg_wlpr_Log(LOG_ERR, "socket(): %s", strerror(errno));
- return errno;
- }
-
- ret = bind(s, (struct sockaddr *)&my_addr, sizeof(my_addr));
- if (ret == -1) {
- edg_wlpr_Log(LOG_ERR, "bind(): %s", strerror(errno));
- close(s);
- return errno;
- }
-
- ret = listen(s, 50);
- if (ret == -1) {
- edg_wlpr_Log(LOG_ERR, "listen(): %s", strerror(errno));
- close(s);
- return errno;
- }
-
- *sock = s;
- return 0;
-}
-
-void
-edg_wlpr_Log(int dbg_level, const char *format, ...)
-{
- va_list ap;
- char log_mess[1024];
-
- /* cannot handle the %m format argument specific for syslog() */
- va_start(ap, format);
- vsnprintf(log_mess, sizeof(log_mess), format, ap);
- va_end(ap);
-
- if (debug)
- printf("[%d] %s\n", getpid(), log_mess);
- else
- if (dbg_level < LOG_DEBUG) /* XXX make configurable */
- syslog(dbg_level, "%s", log_mess);
-}
-
-int
-start_watchdog(pid_t *pid)
-{
- pid_t p;
-
- switch ((p = fork())) {
- case -1:
- edg_wlpr_Log(LOG_ERR, "fork() failed: %s",
- strerror(errno));
- return errno;
- case 0:
- watchdog_start();
- exit(0);
- break;
- default:
- *pid = p;
- return 0;
- }
- /* not reachable */
- exit(0);
-}
-
-int main(int argc, char *argv[])
-{
- int sock;
- char *progname;
- int opt;
- int fd;
- char sockname[PATH_MAX];
- int ret;
- pid_t pid;
- struct sigaction sa;
- const char *s = NULL;
-
- progname = strrchr(argv[0],'/');
- if (progname) progname++;
- else progname = argv[0];
-
- repository = EDG_WLPR_REPOSITORY_ROOT;
- debug = 0;
-
- while ((opt = getopt_long(argc, argv, "hvdr:c:C:V:AG:t:k:", opts, NULL)) != EOF)
- switch (opt) {
- case 'h': usage(progname); exit(0);
- case 'v': fprintf(stdout, "%s:\t%s\n", progname, rcsid); exit(0);
- case 'd': debug = 1; break;
- case 'r': repository = optarg; break;
- case 'c': condor_limit = atoi(optarg); break;
- case 'C': cadir = optarg; break;
- case 'V': vomsdir = optarg; break;
- case 'A': voms_enabled = 1; break;
- case 'G': vomsconf = optarg; break;
- case 't': cert = optarg; break;
- case 'k': key = optarg; break;
- case '?': usage(progname); return 1;
- }
-
- if (optind < argc) {
- usage(progname);
- exit(1);
- }
-
- if (chdir(repository)) {
- edg_wlpr_Log(LOG_ERR, "Cannot access repository directory %s (%s)",
- repository, strerror(errno));
- exit(1);
- }
-
- globus_module_activate(GLOBUS_GSI_CERT_UTILS_MODULE);
- globus_module_activate(GLOBUS_GSI_PROXY_MODULE);
-
- if (!debug)
- for (fd = 3; fd < OPEN_MAX; fd++) close(fd);
-
- if (!debug) {
- /* chdir ? */
- if (daemon(1,0) == -1) {
- perror("deamon()");
- exit(1);
- }
- openlog(progname, LOG_PID, LOG_DAEMON);
- }
-
- if (cert)
- setenv("X509_USER_CERT", cert, 1);
-
- if (key)
- setenv("X509_USER_KEY", key, 1);
-
- if (cadir)
- setenv("X509_CERT_DIR", cadir, 1);
-
- s = getenv("GLITE_PR_TIMEOUT");
- default_timeout = s ? atof(s) : GLITE_PR_TIMEOUT_DEFAULT;
-
- memset(&sa,0,sizeof(sa));
- sa.sa_handler = catchsig;
- sigaction(SIGINT,&sa,NULL);
- sigaction(SIGQUIT,&sa,NULL);
- sigaction(SIGTERM,&sa,NULL);
- sigaction(SIGCHLD,&sa,NULL);
- sigaction(SIGPIPE,&sa,NULL);
-
- ret = start_watchdog(&pid);
- if (ret)
- return 1;
-
- umask(0177);
- snprintf(sockname, sizeof(sockname), "%s%d",
- DGPR_REG_SOCKET_NAME_ROOT, getuid());
- /* XXX check that the socket is not already active */
- ret = do_listen(sockname, &sock);
- if (ret)
- return 1;
- edg_wlpr_Log(LOG_DEBUG, "Listening at %s", sockname);
-
- ret = doit(sock);
-
- close(sock);
- return ret;
-}
-
-int
-get_proxy_base_name(char *file, char **name)
-{
- X509 *cert = NULL;
- EVP_PKEY *key = NULL;
- STACK_OF(X509) *chain = NULL;
- X509_NAME *subject = NULL;
- int ret;
-
- ret = load_proxy(file, &cert, &key, &chain, NULL);
- if (ret)
- return ret;
-
- subject = X509_NAME_dup(X509_get_subject_name(cert));
-
- sk_X509_insert(chain, cert, 0);
- cert = NULL;
-
- ret = globus_gsi_cert_utils_get_base_name(subject, chain);
- if (ret) {
- edg_wlpr_Log(LOG_ERR, "Cannot get subject name from proxy %s", file);
- ret = EDG_WLPR_ERROR_SSL; /* XXX ??? */
- goto end;
- }
-
- *name = X509_NAME_oneline(subject, NULL, 0);
- ret = 0;
-
-end:
- if (cert)
- X509_free(cert);
- if (key)
- EVP_PKEY_free(key);
- if (chain)
- sk_X509_pop_free(chain, X509_free);
- if (subject)
- X509_NAME_free(subject);
-
- return ret;
-}
+++ /dev/null
-#ifndef RENEWALD_LOCL_H
-#define RENEWALD_LOCL_H
-
-#ident "$Header$"
-
-#include <myproxy.h>
-#include <myproxy_delegation.h>
-#include <globus_gsi_credential.h>
-#include <globus_gsi_proxy.h>
-#include <globus_gsi_cert_utils_constants.h>
-
-#include "renewal.h"
-
-#ifdef HAVE_DMALLOC_H
-#include <dmalloc.h>
-#endif
-
-/* XXX */
-#if 0
-#define EDG_WLPR_ERROR_PARSE_NOT_FOUND EDG_WLPR_ERROR_PROTO_PARSE_ERROR
-#define EDG_WLPR_ERROR_NOTFOUND EDG_WLPR_PROXY_NOT_REGISTERED
-#endif
-
-typedef struct {
- unsigned int len;
- char **val;
-} prd_list;
-
-typedef struct {
- int suffix;
- prd_list jobids;
- int unique;
- int voms_exts;
- char *myproxy_server;
- time_t end_time;
- time_t next_renewal;
-} proxy_record;
-
-/* commands */
-void
-register_proxy(edg_wlpr_Request *request, edg_wlpr_Response *response);
-
-void
-unregister_proxy(edg_wlpr_Request *request, edg_wlpr_Response *response);
-
-void
-get_proxy(edg_wlpr_Request *request, edg_wlpr_Response *response);
-
-void
-update_db(edg_wlpr_Request *request, edg_wlpr_Response *response);
-
-int
-get_times(char *proxy_file, proxy_record *record);
-
-void
-watchdog_start(void);
-
-void
-edg_wlpr_Log(int dbg_level, const char *format, ...);
-
-int
-decode_record(char *line, proxy_record *record);
-
-int
-encode_record(proxy_record *record, char **line);
-
-void
-free_record(proxy_record *record);
-
-int
-load_proxy(const char *filename, X509 **cert, EVP_PKEY **privkey,
- STACK_OF(X509) **chain, globus_gsi_cred_handle_t *proxy);
-
-int
-get_proxy_base_name(char *file, char **subject);
-
-int
-renew_voms_creds(const char *cur_file, const char *renewed_file, const char *new_file);
-
-#endif /* RENEWALD_LOCL_H */
+++ /dev/null
-#include "renewal_locl.h"
-#include "renewd_locl.h"
-
-#include <string.h>
-#include <openssl/x509.h>
-
-#include "glite/security/voms/voms_apic.h"
-#include "glite/security/voms/newformat.h"
-
-char * Decode(const char *, int, int *);
-char **listadd(char **, char *, int);
-
-extern char *vomsconf;
-
-static int
-generate_proxy(globus_gsi_cred_handle_t cur_proxy,
- X509_EXTENSION *voms_extension, const char *new_file)
-{
- globus_result_t result;
- globus_gsi_proxy_handle_t proxy_handle = NULL;
- globus_gsi_cred_handle_t proxy = NULL;
- EVP_PKEY *cur_proxy_priv_key = NULL;
- X509 *new_cert = NULL;
- X509 *voms_cert = NULL;
- globus_gsi_cert_utils_cert_type_t proxy_type;
-
- result = globus_gsi_proxy_handle_init(&proxy_handle, NULL);
- if (result) {
- edg_wlpr_Log(LOG_ERR, "globus_gsi_proxy_handle_init() failed\n");
- goto end;
- }
-
- result = globus_gsi_cred_get_key(cur_proxy, &cur_proxy_priv_key);
- if (result) {
- edg_wlpr_Log(LOG_ERR, "globus_gsi_cred_get_key() failed\n");
- goto end;
- }
-
- /* Create and sign a new proxy */
- result = globus_gsi_cred_get_cert_type(cur_proxy, &proxy_type);
- if (result) {
- edg_wlpr_Log(LOG_ERR, "globus_gsi_cred_get_cert_type() failed\n");
- goto end;
- }
-
- result = globus_gsi_proxy_handle_set_type(proxy_handle, proxy_type);
- if (result) {
- edg_wlpr_Log(LOG_ERR, "globus_gsi_proxy_handle_set_type() failed\n");
- goto end;
- }
-
- result = globus_gsi_proxy_create_signed(proxy_handle, cur_proxy, &proxy);
- if (result) {
- edg_wlpr_Log(LOG_ERR, "globus_gsi_proxy_handle_init() failed\n");
- goto end;
- }
-
- /* Get the new proxy */
- result = globus_gsi_cred_get_cert(proxy, &new_cert);
- if (result) {
- edg_wlpr_Log(LOG_ERR, "globus_gsi_cred_get_cert() failed\n");
- goto end;
- }
-
- /* The Globus API doesn't allow to store custom X.509 extensions */
- voms_cert = X509_dup(new_cert);
- if (voms_cert->cert_info->extensions == NULL)
- voms_cert->cert_info->extensions = sk_X509_EXTENSION_new_null();
- sk_X509_EXTENSION_push(voms_cert->cert_info->extensions, voms_extension);
-
- /* Openssl ensures that memory containing old signature structures is unallocated */
-#if 0
- X509_sign(voms_cert, cur_proxy_priv_key, proxy_handle->attrs->signing_algorithm);
-#else
- X509_sign(voms_cert, cur_proxy_priv_key, EVP_md5());
-#endif
-
- /* And put the cert back, older one is unallocated by the function */
- result = globus_gsi_cred_set_cert(proxy, voms_cert);
- if (result) {
- edg_wlpr_Log(LOG_ERR, "globus_gsi_cred_set_cert() failed\n");
- goto end;
- }
-
- result = globus_gsi_cred_write_proxy(proxy, (char *)new_file);
-
-end:
-
- return 0;
-}
-
-static int
-my_VOMS_Export(void *buf, int buf_len, X509_EXTENSION **extension)
-{
- AC *ac = NULL;
- unsigned char *p, *pp;
- AC **voms_attrs = NULL;
-
- p = pp = buf;
- ac = d2i_AC(NULL, &p, buf_len+1);
- if (ac == NULL) {
- edg_wlpr_Log(LOG_ERR, "d2i_AC() failed\n");
- return 1;
- }
-
- voms_attrs = (AC **)listadd((char **)voms_attrs, (char *)ac, sizeof(AC *));
-
- *extension = X509V3_EXT_conf_nid(NULL, NULL, OBJ_txt2nid("acseq"),
- (char*)voms_attrs);
- return 0;
-}
-
-static int
-create_voms_command(struct vomsdata *vd, struct voms **voms_cert, char **command)
-{
- int voms_error, ret;
- struct data **attribs;
-
-#if 0
- VOMS_ResetOrder(vd, &voms_error);
- for (i = 2; i < argc; i++) {
- ret = VOMS_Ordering(argv[i], vd, &voms_error);
- if (ret == 0) {
- edg_wlpr_Log(LOG_ERR, "VOMS_Ordering() failed\n");
- return 1;
- }
- }
-#endif
-
- if (voms_cert == NULL || *voms_cert == NULL || (*voms_cert)->std == NULL) {
- edg_wlpr_Log(LOG_ERR, "Invalid VOMS certificate\n");
- return 1;
- }
-
- attribs = (*voms_cert)->std;
-
- if (strcmp (attribs[0]->role, "NULL") == 0 )
- ret = asprintf(command, "G%s", attribs[0]->group);
- else
- ret = asprintf(command, "B%s:%s", attribs[0]->group, attribs[0]->role);
-
-end:
-
- return 0;
-}
-
-static int
-renew_voms_cert(struct vomsdata *vd, struct voms **voms_cert,
- char **buf, size_t *buf_len)
-{
- int voms_error = 0, i, ret, voms_version;
- struct contactdata **voms_contacts = NULL;
- char *command = NULL;
-
- voms_contacts = VOMS_FindByVO(vd, (*voms_cert)->voname, vomsconf, NULL, &voms_error);
-
- if (voms_contacts == NULL) {
- edg_wlpr_Log(LOG_ERR, "VOMS_FindByVO() failed\n");
- return 1;
- }
-
- ret = create_voms_command(vd, voms_cert, &command);
-
- /* XXX iterate over all servers on the list on errors */
- ret = VOMS_ContactRaw(voms_contacts[0]->host, voms_contacts[0]->port,
- voms_contacts[0]->contact, command,
- (void**) buf, buf_len, &voms_version,
- vd, &voms_error);
- if (ret == 0) {
- edg_wlpr_Log(LOG_ERR, "VOMS_Contact() failed\n");
- return 1;
- }
-
- VOMS_DeleteContacts(voms_contacts);
-
- if (command)
- free(command);
-
- return 0;
-}
-
-static int
-renew_voms_certs(const char *cur_file, const char *renewed_file, const char *new_file)
-{
- globus_gsi_cred_handle_t cur_proxy = NULL;
- globus_gsi_cred_handle_t new_proxy = NULL;
- struct vomsdata *vd = NULL;
- struct voms **voms_cert = NULL;
- int voms_err, ret;
- X509 *cert = NULL;
- STACK_OF(X509) *chain = NULL;
- char *buf = NULL;
- size_t buf_len = 0;
- X509_EXTENSION *extension = NULL;
- char *old_env_proxy = getenv("X509_USER_PROXY");
- char *old_env_cert = getenv("X509_USER_CERT");
- char *old_env_key = getenv("X509_USER_KEY");
-
- setenv("X509_USER_PROXY", cur_file, 1);
- setenv("X509_USER_CERT", renewed_file, 1);
- setenv("X509_USER_KEY", renewed_file, 1);
-
- ret = load_proxy(cur_file, &cert, NULL, &chain, &cur_proxy);
- if (ret)
- goto end;
-
- vd = VOMS_Init(NULL, NULL);
- if (vd == NULL) {
- edg_wlpr_Log(LOG_ERR, "VOMS_Init() failed\n");
- return 1;
- }
-
- ret = VOMS_Retrieve(cert, chain, RECURSE_CHAIN, vd, &voms_err);
- if (ret == 0) {
- if (voms_err == VERR_NOEXT) {
- /* no VOMS cred, no problem; continue */
- /* XXX this part shouldn't be reachable, this call is only called
- * if the proxy does contain VOMS attributes */
- edg_wlpr_Log(LOG_ERR, "No VOMS attributes found in proxy %s\n", cur_file);
- ret = 0;
- goto end;
- } else {
- edg_wlpr_Log(LOG_ERR, "Cannot get VOMS certificate(s) from proxy");
- ret = 1;
- goto end;
- }
- }
-
- /* XXX make sure this loop can really work for multiple voms certificates
- * embedded in the proxy */
- for (voms_cert = vd->data; voms_cert && *voms_cert; voms_cert++) {
- char *tmp, *ptr;
- size_t tmp_len;
-
- ret = renew_voms_cert(vd, voms_cert, &tmp, &tmp_len);
- if (ret)
- goto end;
- ptr = realloc(buf, buf_len + tmp_len);
- if (ptr == NULL) {
- ret = ENOMEM;
- goto end;
- }
- buf = ptr;
- memcpy(buf + buf_len, tmp, tmp_len);
- buf_len += tmp_len;
- }
-
- if (buf == NULL) {
- /* no extension renewed, return */
- ret = 0;
- goto end;
- }
-
- ret = my_VOMS_Export(buf, buf_len, &extension);
- if (ret)
- goto end;
-
- ret = load_proxy(renewed_file, NULL, NULL, NULL, &new_proxy);
- if (ret)
- goto end;
-
- ret = generate_proxy(new_proxy, extension, new_file);
-
-end:
- (old_env_proxy) ? setenv("X509_USER_PROXY", old_env_proxy, 1) :
- unsetenv("X509_USER_PROXY");
- (old_env_cert) ? setenv("X509_USER_CERT", old_env_cert, 1) :
- unsetenv("X509_USER_CERT");
- (old_env_key) ? setenv("X509_USER_KEY", old_env_key, 1) :
- unsetenv("X509_USER_KEY");
-
- if (cert)
- X509_free(cert);
- if (chain)
- sk_X509_pop_free(chain, X509_free);
- if (vd)
- VOMS_Destroy(vd);
- if (cur_proxy)
- globus_gsi_cred_handle_destroy(cur_proxy);
- if (new_proxy)
- globus_gsi_cred_handle_destroy(new_proxy);
- if (buf)
- free(buf);
-
- return ret;
-}
-
-int
-renew_voms_creds(const char *cur_file, const char *renewed_file, const char *new_file)
-{
- return renew_voms_certs(cur_file, renewed_file, new_file);
-}
-
-#if 0
-int
-main(int argc, char *argv[])
-{
- int ret;
- const char *current_proxy = "/tmp/x509up_u11930";
- const char *renewed_proxy = "/tmp/proxy";
-
- if (argc > 1)
- current_proxy = argv[1];
- if (argc > 2)
- renewed_proxy = argv[2];
-
- if (globus_module_activate(GLOBUS_GSI_PROXY_MODULE) != GLOBUS_SUCCESS ||
- globus_module_activate(GLOBUS_GSI_CERT_UTILS_MODULE) != GLOBUS_SUCCESS) {
- edg_wlpr_Log(LOG_ERR, "[%d]: Unable to initialize Globus modules\n", getpid());
- return 1;
- }
-
- ret = renew_voms_certs(current_proxy, renewed_proxy);
-
- return 0;
-}
-#endif
+++ /dev/null
-.project
\ No newline at end of file
+++ /dev/null
-LICENSE file for EGEE Middleware
-================================
-
-Copyright (c) 2004 on behalf of the EU EGEE Project:
-The European Organization for Nuclear Research (CERN),
-Istituto Nazionale di Fisica Nucleare (INFN), Italy
-Datamat Spa, Italy
-Centre National de la Recherche Scientifique (CNRS), France
-CS Systeme d'Information (CSSI), France
-Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
-Universiteit van Amsterdam (UvA), Netherlands
-University of Helsinki (UH.HIP), Finlan
-University of Bergen (UiB), Norway
-Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-3. The end-user documentation included with the redistribution, if
-any, must include the following acknowledgment: "This product includes
-software developed by The EU EGEE Project (http://cern.ch/eu-egee/)."
-Alternatively, this acknowledgment may appear in the software itself, if
-and wherever such third-party acknowledgments normally appear.
-
-4. The names EGEE and the EU EGEE Project must not be
-used to endorse or promote products derived from this software without
-prior written permission. For written permission, please contact
-<email address>.
-
-5. You are under no obligation whatsoever to provide anyone with any
-bug fixes, patches, or upgrades to the features, functionality or
-performance of the Software ("Enhancements") that you may develop over
-time; however, if you choose to provide your Enhancements to The EU
-EGEE Project, or if you choose to otherwise publish or distribute your
-Enhancements, in source code form without contemporaneously requiring
-end users of The EU EGEE Proejct to enter into a separate written license
-agreement for such Enhancements, then you hereby grant The EU EGEE Project
-a non-exclusive, royalty-free perpetual license to install, use, copy,
-modify, prepare derivative works, incorporate into the EGEE Middleware
-or any other computer software, distribute, and sublicense your
-Enhancements or derivative works thereof, in binary and source code
-form (if any), whether developed by The EU EGEE Project or third parties.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-This software consists of voluntary contributions made by many
-individuals on behalf of the EU EGEE Prject. For more information on The
-EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on
-EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/
-
-
+++ /dev/null
-## *********************************************************************
-## *
-## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid.
-## * For license conditions see LICENSE file or
-## * http://www.edg.org/license.html
-## *
-## *********************************************************************
-
-## Process this file with automake to produce Makefile.in
-EXTRA_DIST = LICENSE
-
-docdir = $(datadir)/doc/@PACKAGE@-@VERSION@
-doc_DATA = LICENSE
-## Subdirectories list
-SUBDIRS = interface src
-
-## Default flags to run aclocal
-ACLOCAL_AMFLAGS = -I project
-
-stage:
- @set fnord $(MAKEFLAGS); amf=$$2; \
- dot_seen=no; \
- target="install"; \
- prefix_arg="@prefix@"; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target $$prefix_arg in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target $$prefix_arg) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" $$prefix_arg || exit 1; \
- fi; test -z "$$fail"
-
-distsrc: dist
- mv $(distdir).tar.gz $(DISTTAR)/$(distdir)_src.tar.gz
-
-distbin:
- @set fnord $(MAKEFLAGS); amf=$$2; \
- dot_seen=no; \
- target="install"; \
- tmpdistbin="$(WORKDIR)/dist_bin"; \
- prefix_arg="prefix=$$tmpdistbin"; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target $$prefix_arg in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target $$prefix_arg) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" $$prefix_arg || exit 1; \
- fi; test -z "$$fail"; \
- pushd $$tmpdistbin; \
- $(AMTAR) -zcf $(DISTTAR)/$(distdir)_bin.tar.gz .; \
- popd; \
- rm -rf $$tmpdistbin
-
+++ /dev/null
-#! /bin/sh
-
-mkdir -p src/autogen
-set -x
-aclocal -I project
-libtoolize --force
-autoheader
-automake --foreign --add-missing --copy
-autoconf
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Build file for the GLite WMS jobid module
-
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Joachim Flammer <Joachim.Flammer@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.1.1.1 2004/07/21 18:16:57 eronchie
- Moved out exception from org.glite.wms.common/src/utilitiesY
-
-
--->
-
-<project name="exception" default="dist">
-
- <!-- =========================================
- Builds the GLite WMS Utils Exception Module
- ========================================= -->
-
- <!-- =========================================
- Import properties (order is important)
- ========================================= -->
-
- <!-- import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- import component build properties,
- component properties &
- component common properties -->
- <import file="./project/properties.xml"/>
-
- <!-- import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="${subsystem.properties.file}"/>
-
- <!-- import global build properties &
- global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependency property files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${component.dependencies.file}" />
- <property file="${subsystem.dependencies.file}" />
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options (order is important)
- ========================================= -->
- <import file="${global.configure.options.file}"/>
- <import file="${component.configure.options.file}"/>
-
- <!-- =========================================
- Import task definitions (order is important)
- ========================================= -->
- <import file="${subsystem.taskdefs.file}" />
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Load common targets
- ========================================= -->
- <import file="${global.targets-make.file}" />
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ==============================================
- Local private targets
- ============================================== -->
-
- <target name="localinit"
- description="Module specific initialization tasks">
- </target>
-
- <target name="localcompile"
- description="Module specific compile tasks">
- </target>
-
- <target name="localclean"
- description="Module specific cleaning tasks">
- </target>
-
-</project>
+++ /dev/null
-#
-# Copyright (c) 2004 on behalf of the EU EGEE Project:
-# The European Organization for Nuclear Research (CERN),
-# Istituto Nazionale di Fisica Nucleare (INFN), Italy
-# Datamat Spa, Italy
-# Centre National de la Recherche Scientifique (CNRS), France
-# CS Systeme d'Information (CSSI), France
-# Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
-# Universiteit van Amsterdam (UvA), Netherlands
-# University of Helsinki (UH.HIP), Finland
-# University of Bergen (UiB), Norway
-# Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-#
-# Common configure.ac file for the GLite WMS Common module
-#
-# Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
-# Version info: $Id$
-# Release: $Name$
-#
-# Revision history:
-# $Log$
-# Revision 1.11 2005/09/20 10:20:52 eronchie
-# Started merged with 1.4
-#
-# Revision 1.10 2004/12/10 07:31:35 eronchie
-# Increased version
-#
-# Revision 1.9 2004/11/16 15:31:13 eronchie
-# Increased version
-#
-# Revision 1.8 2004/09/22 00:25:17 glbuild
-# Fixed missing parenthesis
-#
-# Revision 1.7 2004/09/21 19:21:57 glbuild
-# modified module.version
-#
-# Revision 1.6 2004/08/17 10:41:47 eronchie
-# Added optimize option
-#
-# Revision 1.5 2004/07/23 08:02:09 eronchie
-# Updated configure.ac
-#
-# Revision 1.4 2004/07/21 18:49:26 eronchie
-# Added AC_GLITE
-#
-# Revision 1.3 2004/07/21 18:47:49 eronchie
-# Removed obsolete things
-#
-# Revision 1.2 2004/07/21 18:44:22 eronchie
-# Updated header file
-#
-# Revision 1.1.1.1 2004/07/21 18:16:57 eronchie
-# Moved out exception from org.glite.wms.common/src/utilitiesY
-#
-#
-#
-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ(2.57)
-AC_INIT([GLite WMS Utils Exception], [1.0.3])
-AC_CONFIG_AUX_DIR([./project])
-AM_INIT_AUTOMAKE([1.6.3 subdir-objects])
-AC_CONFIG_SRCDIR([src/Exception.cpp])
-
-# Notices.
-AC_COPYRIGHT([Copyright (c) 2004 The EU EGEE Project
-See LICENCE file for details
-])
-AC_REVISION([$Revision$])
-
-#Environment.
-WORKDIR=`pwd`
-AC_SUBST(WORKDIR)
-
-# Checks for programs.
-AC_PROG_CC
-AC_PROG_CPP
-AC_PROG_CXX
-AC_PROG_CXXCPP
-AM_PROG_CC_C_O
-AC_PROG_LIBTOOL
-
-# Checks for libraries.
-
-# Checks for header files.
-AC_CHECK_HEADERS([fcntl.h mntent.h sys/vfs.h syslog.h unistd.h])
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_HEADER_STDBOOL
-AC_C_CONST
-AC_C_INLINE
-AC_TYPE_OFF_T
-AC_TYPE_SIZE_T
-AC_CHECK_MEMBERS([struct stat.st_rdev])
-AC_TYPE_UID_T
-AC_CHECK_TYPES([ptrdiff_t])
-
-# Checks for library functions.
-AC_HEADER_STDC
-AC_FUNC_ERROR_AT_LINE
-AC_FUNC_GETMNTENT
-AC_FUNC_MEMCMP
-AC_FUNC_STAT
-AC_FUNC_STRFTIME
-AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([bzero endpwent ftruncate getmntent memset mkdir pow strerror strtol])
-
-AC_GLITE
-
-AC_OPTIMIZE
-
-# Configuration items
-AC_PREFIX_DEFAULT([/opt/glite])
-AM_CONFIG_HEADER([src/autogen/config.h])
-AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([src/Makefile])
-AC_CONFIG_FILES([interface/Makefile])
-
-AC_OUTPUT
-
+++ /dev/null
-## *********************************************************************
-## *
-## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid.
-## * For license conditions see LICENSE file or
-## * http://www.edg.org/license.html
-## *
-## *********************************************************************
-
-exceptiondir = $(includedir)
-nobase_exception_HEADERS = \
- glite/wmsutils/exception/exception_codes.h \
- glite/wmsutils/exception/Exception.h
-
-MAINTAINERCLEANFILES = Makefile.in
+++ /dev/null
-#ifndef GLITE_WMS_UTILS_EXCEPTION_EXCEPTION_H
-#define GLITE_WMS_UTILS_EXCEPTION_EXCEPTION_H
-
-/*
- * Exception.h
- * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved.
- * Contributors are mentioned in the code where appropriate.
- */
-
-#include <fstream>
-#include <cstdlib>
-//#include <list>
-#include <syslog.h> // For logging exceptions to log file
-#include <errno.h> // list the exception codes
-#include <string>
-#include <vector>
-#include <exception> // base ancestor stl::exception
-
-
-namespace glite {
- namespace wmsutils {
- namespace exception {
-
-extern pthread_mutex_t METHOD_MUTEX; // used in order to store info into a file (rather then syslog)
-#define GLITE_STACK_TRY(method_name) std::string METHOD = method_name ; int LINE = __LINE__ ; try {
-#define GLITE_STACK_CATCH() } catch (glite::wmsutils::exception::Exception &exc){ exc.push_back ( __FILE__ , LINE, METHOD ); throw exc ; } catch (std::exception &ex){ glite::wmsutils::exception::Exception exc( __FILE__ , LINE, METHOD, 0, "Standard exception: " + std::string(ex.what()) ); throw exc; }
-
-/**
- * The Exception base classe contains attributes into which are placed exception information and provides
- * constructor that beyond the error code take parameters specifying the source file and line number
- * (e.g. through __FILE__ and __LINE__) where the error has been generated and string messages,
- * allowing an easy way of storing the origin of the exception.
- * Moreover it provides methods for getting all the exception information and for logging them either
- * in a log file or to the syslog daemon.
- * Each of the derived types may contain its private attributes describing the actual error instance in detail.
- * Moreover each exception has an attribute representing the exception identifier that is set by the
- * class constructor and allows the identification of the original exception.
- *
- * @version 0.1
- * @date 22 July 2004
- * @author Alessandro Maraschini <alessandro.maraschini@datamat.it>
-*/
-
-class Exception : public std::exception{
- public:
- /**
- * Constructor Update all mandatory fields
- * @param method the name of the method that raised the exception
- * @param source The source that raised the exception (could be the file path, the class Name, etc etc)
- * @param exc the previous exception as in the stack trace */
- Exception ( const std::string& source, const std::string& method, Exception *exc);
- /**
- * Constructor Update all mandatory fields
- * @param code the code representing the thrown exception
- * @param exception the name of the thrown exception
- * @param method the name of the method that raised the exception
- * @param source The source that raised the exception (could be the file path, the class Name, etc etc) */
- Exception ( const std::string& source, const std::string& method, int code, const std::string& exception);
-
- /**
- * Constructor Update all mandatory fields
- * @param source the path of the file that raised the exception
- * @param line_number the number of the line in the file that raised the exception
- * @param method the name of the method that raised the exception
- * @param code the code representing the thrown exception
- * @param exception the name of the thrown exception */
- Exception (const std::string& source, int line_number, const std::string& method, int code, const std::string& exception);
- /**
- * Default Destructor
- */
- virtual ~Exception() throw ();
- /**
- * Return a string debug message containing information about Exception thrown
- * Debug message contains all the attributes stored in an exception instance such as the method, the file and the line
- * that threw the exception.
- *@return the debug message string representation
- */
- virtual std::string dbgMessage();
- /**
- * Return the error code
- * @return The integer representing the code of the error that generated the exception
- */
- virtual int getCode();
-
- /**
- * return the Error Message associated to the Exception
- * @return The Exception string message representation
- */
- virtual const char* what() const throw ();
-
- /**
- * Print Exception error information into a log file
- * @param logfile the file where to log exception information
- */
- virtual void log(const std::string& logfile = "");
- /**
- * Retrieve the Exception name
- * @return the name of the Exception thrown
- */
- virtual std::string getExceptionName();
-
- /**
- * Retrieve the Stack of the exception as a list of previous generated exceptions
- *@return the string representation of the stack trace: each line correspond to an exception message
- */
- virtual std::string printStackTrace() ;
- /**
- * Return the list of methods that caused the Exception
- */
- virtual std::vector<std::string> getStackTrace() ;
- /**
- * Update stack information
- */
- virtual void push_back ( const std::string& source, int line_number, const std::string& method ) ;
- protected:
- /** Empty constructor*/
- Exception();
- /** integer error code representing the cause of the error */
- int error_code;
- /** string exception message representation*/
- std::string error_message ;
- /** line number where the exception was raised */
- int line;
- /** The name of the file where the exception was raised */
- std::string source_file;
- /** the name of the exception */
- std::string exception_name;
- /** the name of the method where the expceiton was raised */
- std::string method_name ;
- /** a string representation of the stacktrace */
- std::string stack;
- /** the actual internal stacktrace representation */
- std::vector< std::string> stack_strings ;
- /** the name of the ancestor exception */
- std::string ancestor ;
-}; //End Exception Class
-}}} // Closing namespace
-#endif
+++ /dev/null
-#ifndef GLITE_WMSUTILS_EXCEPTION_CODES_H
-#define GLITE_WMSUTILS_EXCEPTION_CODES_H
-// pure C-style code (needed by some libraries)
-#define GLITE_WMS_COMMON_ERROR_BASE 900
-#define GLITE_WMS_USERINTERFACE_ERROR_BASE 1000
-#define GLITE_WMS_NETWORKSERVER_ERROR_BASE 1200
-#define GLITE_WMS_SOCKET_ERROR_BASE 1300
-#define GLITE_WMS_LDAP_ERROR_BASE 1350
-#define GLITE_WMS_LOGGING_ERROR_BASE 1400
-#define GLITE_WMS_REQUESTAD_ERROR_BASE 1500
-#define GLITE_WMS_CHECKPOINT_ERROR_BASE 1600
-#define GLITE_WMS_CONFIGURATION_ERROR_BASE 1800
-#ifdef __cplusplus
-namespace glite {
-namespace wmsutils {
-namespace exception {
- /**
- * The Error Code
- */
- enum {
- WMS_COMMON_BASE = GLITE_WMS_COMMON_ERROR_BASE,
- THREAD_INIT , // pthread_attr_init method failed
- THREAD_DETACH , // pthread_attr_setdetachstate method failed
- THREAD_CREATE , // pthread_create method failed
- THREAD_JOIN,
- THREAD_SSL,
- WMS_FATAL_ERROR,
- WMS_UI_ERROR_BASE = GLITE_WMS_USERINTERFACE_ERROR_BASE,
- WMS_NS_ERROR_BASE = GLITE_WMS_NETWORKSERVER_ERROR_BASE,
- WMS_SOCKET_ERROR_BASE = GLITE_WMS_SOCKET_ERROR_BASE,
- WMS_LDAP_ERROR_BASE = GLITE_WMS_LDAP_ERROR_BASE,
- WMS_LB_ERROR_BASE = GLITE_WMS_LOGGING_ERROR_BASE ,
- WMS_REQUESTAD_ERROR_BASE = GLITE_WMS_REQUESTAD_ERROR_BASE,
- WMS_CHKPT_ERROR_BASE = GLITE_WMS_CHECKPOINT_ERROR_BASE,
- WMS_CONFIGURATION_ERROR_BASE = GLITE_WMS_CONFIGURATION_ERROR_BASE
- };
-} // exception namespace
-} // wmsutils namespace
-} // glite namespace
-#endif //ifdef c++
-#endif
+++ /dev/null
-#Sat Oct 15 02:08:14 CEST 2005
-module.build=154
+++ /dev/null
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <project name="configure options">
- <property name="configure.args"
- value="--prefix=${workspace.abs.dir}/stage --with-globus-prefix=${with.globus.prefix} --with-globus-thr-flavor=${with.globus.thr.flavor} --with-globus-nothr-flavor=${with.globus.nothr.flavor} --with-cppunit-prefix=${with.cppunit.prefix} --with-glite-location=${with.glite.location} --with-dist-location=${with.dist.location} --disable-optimization"/>
-
- </project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Common build properties file for the Glite WMS Common component
-
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Joachim Flammer <Joachim.Flammer@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.5 2004/08/04 07:40:02 eronchie
- Added cppunit
-
- Revision 1.4 2004/07/28 07:26:45 eronchie
- Added /
-
- Revision 1.3 2004/07/28 07:19:56 eronchie
- Added m4files.list
-
- Revision 1.2 2004/07/23 15:37:26 eronchie
- Commit
-
- Revision 1.1.1.1 2004/07/21 18:16:57 eronchie
- Moved out exception from org.glite.wms.common/src/utilitiesY
-
- Revision 1.2 2004/07/16 14:56:56 flammer
- Corrected input path of build.properties.
-
- Revision 1.1.1.1 2004/05/26 18:45:05 eronchie
- Import of wms jobid
-
-
--->
-
-<project name="WMS Utils Exception component common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property file="project/build.properties" />
-
- <!-- ======================================================
- Define corresponding subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${wms-utils.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${wms-utils.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define component properties
- ====================================================== -->
-
- <!-- Component name prefix -->
- <property name="component.prefix" value="exception" />
-
- <!-- ======================================================
- Define general component properties
- ====================================================== -->
-
- <import file="${component.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <property name="m4files.list" value="glite.m4 cppunit optimize.m4"/>
-
-</project>
+++ /dev/null
-module.version=1.0.3
-module.age=1
+++ /dev/null
-/* **************************************************************************
-* filename : Exceptions.cpp
-* author : Alessandro Maraschini <alessandro.maraschini@datamat.it>
-* copyright : (C) 2002 by DATAMAT
-***************************************************************************/
-
-#include "glite/wmsutils/exception/Exception.h"
-#include "glite/wmsutils/exception/exception_codes.h"
-
-namespace glite {
-namespace wmsutils{
-namespace exception {
-using namespace std ;
-pthread_mutex_t METHOD_MUTEX ; // This mutex is used in order to lock the file for writing log infornation
-
-/* *********************************
-* Exception Class Implementation
-************************************/
-//Constructor/Destructor
-
-Exception::Exception () {
- line = 0;
-};
-
-Exception::~Exception() throw(){ }
-
-/**
-* Exception chainig
-*/
-void Exception::push_back (const string& source, int line_number, const string& method){
- stack_strings.push_back (dbgMessage());
- ancestor = what();
- source_file = source;
- line = line_number;
- method_name = method;
- error_message = "";
- exception_name = "";
-}
-
-Exception::Exception( const std::string& file, int line_number, const std::string& method, int code, const std::string& name)
- : error_code(code), exception_name(name){
- source_file = file;
- line = line_number;
- method_name = method;
-};
-
-Exception::Exception (const string& source, const string& method, int code, const string& exception)
- : error_code(code), exception_name(exception){
- source_file = source;
- method_name = method;
- // stack= "";
- line = 0;
-};
-
-int Exception::getCode(){
- if (error_code != 0) return error_code;
- else
- return WMS_COMMON_BASE;
-};
-
-const char* Exception::what() const throw(){
- if (!ancestor.empty()) return ancestor.c_str();
-
- return error_message.c_str();
-};
-
-string Exception::getExceptionName(){
- return exception_name;
-};
-
-void Exception::log(const std::string& logfile)
-{
- if (logfile == "")
- syslog (LOG_PERROR, (char *)(dbgMessage()).c_str());
- else{
- pthread_mutex_lock( &METHOD_MUTEX); // LOCK
- //TBD : test if file exist-->>Create HEADER ??
- ofstream fout ((char *) logfile.c_str() , ios::app ); //Open the file for writing (if it doesn't exist then it will be created)
- fout << "\n" << dbgMessage() ; //write (append) the message
- fout.close(); //close the file
- pthread_mutex_unlock( &METHOD_MUTEX); // UNLOCK
- }
-};
-
-string Exception::printStackTrace(){
- string stack = "" ;
- for (unsigned int i = 0 ; i < stack_strings.size() ; i++ ){
- stack+=stack_strings[i] +"\n" ;
- }
- return stack +dbgMessage();
-};
-
-vector<string> Exception::getStackTrace(){
- // make a copy of the stack
- vector<string> stack = stack_strings ;
- stack.push_back(dbgMessage()) ;
- return stack;
-};
-
-string Exception::dbgMessage(){
- string result ;
- //Adding exception Name
- result = exception_name;
-
- //Adding error msg
- if (error_message!="") result +=": " + string(what());
-
- if (result != "") result+="\n";
-
- //Adding Source
- result +="\tat " + method_name +"[" +source_file;
-
- //Adding line number
- if (line!=0){
- char buffer [1024] ;
- sprintf (buffer, "%i" , line) ;
- result += ":" + string ( buffer );
- }
- result +="]" ;
- return result;
-}
-
-}}} // Closing namespace
-
+++ /dev/null
-## *********************************************************************
-## *
-## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid.
-## * For license conditions see LICENSE file or
-## * http://www.edg.org/license.html
-## *
-## *********************************************************************
-
-lib_LTLIBRARIES = libglite_wmsutils_exception.la
-
-libglite_wmsutils_exception_la_SOURCES = \
- Exception.cpp
-
-AM_CPPFLAGS = -I$(top_srcdir)/interface \
- -I$(top_srcdir)/src
-
-MAINTAINERCLEANFILES = Makefile.in *.*~
+++ /dev/null
-## *********************************************************************
-## *
-## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid.
-## * For license conditions see LICENSE file or
-## * http://www.edg.org/license.html
-## *
-## *********************************************************************
-
-EXCEPTION_LIBS = $(top_builddir)/src/libglite_wmsutils_exception.la
-
-TESTS = glite-wmsutils-exception
-
-check_PROGRAMS = $(TESTS)
-
-glite_wmsutils_exception_SOURCES = exception_cu_suite.cpp \
- exception_cu_suite.h \
- exception_cu_main.cpp
-
-glite_wmsutils_exception_LDADD = \
- $(GLITE_WMSUTILS_EXCEPTION_LIBS) \
- $(GLOBUS_GSS_THR_LIBS) \
- $(EXCEPTION_LIBS) \
- $(CPPUNIT_LIBS)
-
-AM_CPPFLAGS = \
- -I$(top_srcdir)/src \
- -I$(top_srcdir)/test \
- $(GLITE_CFLAGS) \
- $(GLOBUS_THR_CFLAGS) \
- $(CPPUNIT_CFLAGS)
-
-MAINTAINERCLEANFILES = Makefile.in *~
-
+++ /dev/null
-#include <iostream>
-#include <fstream>
-
-#include "exception_cu_suite.h"
-
-#include <cppunit/TestResult.h>
-#include <cppunit/TestRunner.h>
-#include <cppunit/TestResultCollector.h>
-#include <cppunit/TextOutputter.h>
-#include <cppunit/XmlOutputter.h>
-
-using namespace CppUnit;
-using namespace std;
-
-int main (int argc , char** argv)
-{
- std::ofstream xml("./cppUnit_output.xml",ios::app);
-
- CppUnit::TestResult controller;
- CppUnit::TestResultCollector result;
- controller.addListener( &result );
-
- TestRunner runner;
- runner.addTest(Exception_test::suite());
- runner.run(controller);
-
- CppUnit::XmlOutputter outputter( &result, xml );
- CppUnit::TextOutputter outputter2( &result, std::cerr );
- outputter.write();
- outputter2.write();
-
- return result.wasSuccessful() ? 0 : 1 ;
-}
+++ /dev/null
-#include "exception_cu_suite.h"
-#include "glite/wmsutils/exception/Exception.h"
-#include <string>
-#include <vector>
-
-using namespace CppUnit;
-using namespace std;
-using namespace glite::wmsutils::exception;
-
-void Exception_test::setUp()
-{}
-
-void Exception_test::tearDown()
-{}
-
-
-void Exception_test::constructor_case()
-{
-
- //constructor class name, line number, method name, code, exception name
- glite::wmsutils::exception::Exception exc_5("TEST_Class", 3, "test_method", 1, "exception_test");
-
- //constructor class name, method name, code, exception name
- glite::wmsutils::exception::Exception exc_4("TEST_Class", "test_method", 1, "exception_test");
-
- CPPUNIT_ASSERT(exc_5.getExceptionName() == "exception_test");
- CPPUNIT_ASSERT(exc_5.getCode() == 1);
-}
-
-void Exception_test::tostring_case()
-{
- cout<<"TEST TO STRING METHODS"<<endl;
- glite::wmsutils::exception::Exception exc_5("TEST_Class", 3, "test_method", 1, "exception_test");
- cout << exc_5.dbgMessage() << endl;
- cout << exc_5.printStackTrace() << endl;
- exc_5.log("exception_file");
-
- cout<<"END TEST TO STRING"<<endl;
-}
-
-void Exception_test::stackTrace_case()
-{
- glite::wmsutils::exception::Exception exc_5("TEST_Class", 3, "test_method", 1, "exception_test");
-
- exc_5.push_back("Second_Class", 5, "second_method");
-
- vector<string> msgvec = exc_5.getStackTrace();
-
- for (int i=0; i<msgvec.size(); i++)
- {
- cout << msgvec[i] << endl;
- }
-
-}
-
-
+++ /dev/null
-#include<iostream>
-#include<string>
-#include<pthread.h>
-
-#include <cppunit/extensions/HelperMacros.h>
-
-
-class Exception_test : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE(Exception_test);
- CPPUNIT_TEST(constructor_case);
- CPPUNIT_TEST(tostring_case);
- CPPUNIT_TEST(stackTrace_case);
- CPPUNIT_TEST_SUITE_END();
-
-
-public:
-
- void setUp();
- void tearDown();
-
- void constructor_case();
- void tostring_case();
- void stackTrace_case();
-
-};
-
-
-
+++ /dev/null
-.project
-.cdtproject
\ No newline at end of file
+++ /dev/null
-LICENSE file for EGEE Middleware
-================================
-
-Copyright (c) 2004 on behalf of the EU EGEE Project:
-The European Organization for Nuclear Research (CERN),
-Istituto Nazionale di Fisica Nucleare (INFN), Italy
-Datamat Spa, Italy
-Centre National de la Recherche Scientifique (CNRS), France
-CS Systeme d'Information (CSSI), France
-Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
-Universiteit van Amsterdam (UvA), Netherlands
-University of Helsinki (UH.HIP), Finlan
-University of Bergen (UiB), Norway
-Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-3. The end-user documentation included with the redistribution, if
-any, must include the following acknowledgment: "This product includes
-software developed by The EU EGEE Project (http://cern.ch/eu-egee/)."
-Alternatively, this acknowledgment may appear in the software itself, if
-and wherever such third-party acknowledgments normally appear.
-
-4. The names EGEE and the EU EGEE Project must not be
-used to endorse or promote products derived from this software without
-prior written permission. For written permission, please contact
-<email address>.
-
-5. You are under no obligation whatsoever to provide anyone with any
-bug fixes, patches, or upgrades to the features, functionality or
-performance of the Software ("Enhancements") that you may develop over
-time; however, if you choose to provide your Enhancements to The EU
-EGEE Project, or if you choose to otherwise publish or distribute your
-Enhancements, in source code form without contemporaneously requiring
-end users of The EU EGEE Proejct to enter into a separate written license
-agreement for such Enhancements, then you hereby grant The EU EGEE Project
-a non-exclusive, royalty-free perpetual license to install, use, copy,
-modify, prepare derivative works, incorporate into the EGEE Middleware
-or any other computer software, distribute, and sublicense your
-Enhancements or derivative works thereof, in binary and source code
-form (if any), whether developed by The EU EGEE Project or third parties.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-This software consists of voluntary contributions made by many
-individuals on behalf of the EU EGEE Prject. For more information on The
-EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on
-EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/
-
-
+++ /dev/null
-## *********************************************************************
-## *
-## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid.
-## * For license conditions see LICENSE file or
-## * http://www.edg.org/license.html
-## *
-## *********************************************************************
-
-## Process this file with automake to produce Makefile.in
-
-EXTRA_DIST = LICENSE
-
-docdir = $(datadir)/doc/@PACKAGE@-@VERSION@
-doc_DATA = LICENSE
-
-## Subdirectories list
-SUBDIRS = interface src examples
-
-## Default flags to run aclocal
-ACLOCAL_AMFLAGS = -I project
-
-stage:
- @set fnord $(MAKEFLAGS); amf=$$2; \
- dot_seen=no; \
- target="install"; \
- prefix_arg="@prefix@"; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target $$prefix_arg in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target $$prefix_arg) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" $$prefix_arg || exit 1; \
- fi; test -z "$$fail"
-
-distsrc: dist
- mv $(distdir).tar.gz $(DISTTAR)/$(distdir)_src.tar.gz
-
-distbin:
- @set fnord $(MAKEFLAGS); amf=$$2; \
- dot_seen=no; \
- target="install"; \
- tmpdistbin="$(WORKDIR)/dist_bin"; \
- prefix_arg="prefix=$$tmpdistbin"; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target $$prefix_arg in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target $$prefix_arg) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" $$prefix_arg || exit 1; \
- fi; test -z "$$fail"; \
- pushd $$tmpdistbin; \
- $(AMTAR) -zcf $(DISTTAR)/$(distdir)_bin.tar.gz .; \
- popd; \
- rm -rf $$tmpdistbin
-
+++ /dev/null
-#! /bin/sh
-
-mkdir -p src/autogen
-set -x
-aclocal -I project
-libtoolize --force
-autoheader
-automake --foreign --add-missing --copy
-autoconf
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Build file for the GLite WMS jobid module
-
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Joachim Flammer <Joachim.Flammer@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.4 2004/07/21 17:53:36 eronchie
- Moved out org.glite.wms.jobid from org.glite.wms and put in org.glite.wms-utils
-
-
--->
-
-<project name="jobid" default="dist">
-
- <!-- =========================================
- Builds the GLite WMS Utils Jobid Module
- ========================================= -->
-
- <!-- =========================================
- Import properties (order is important)
- ========================================= -->
-
- <!-- import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- import component build properties,
- component properties &
- component common properties -->
- <import file="./project/properties.xml"/>
-
- <!-- import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="${subsystem.properties.file}"/>
-
- <!-- import global build properties &
- global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependency property files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${component.dependencies.file}" />
- <property file="${subsystem.dependencies.file}" />
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options (order is important)
- ========================================= -->
- <import file="${global.configure.options.file}"/>
- <import file="${component.configure.options.file}"/>
-
- <!-- =========================================
- Import task definitions (order is important)
- ========================================= -->
- <import file="${subsystem.taskdefs.file}" />
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Load common targets
- ========================================= -->
- <import file="${global.targets-make.file}" />
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ==============================================
- Local private targets
- ============================================== -->
-
- <target name="localinit"
- description="Module specific initialization tasks">
- </target>
-
- <target name="localcompile"
- description="Module specific compile tasks">
- </target>
-
- <target name="localclean"
- description="Module specific cleaning tasks">
- </target>
-
-</project>
+++ /dev/null
-#
-# Copyright (c) 2004 on behalf of the EU EGEE Project:
-# The European Organization for Nuclear Research (CERN),
-# Istituto Nazionale di Fisica Nucleare (INFN), Italy
-# Datamat Spa, Italy
-# Centre National de la Recherche Scientifique (CNRS), France
-# CS Systeme d'Information (CSSI), France
-# Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
-# Universiteit van Amsterdam (UvA), Netherlands
-# University of Helsinki (UH.HIP), Finland
-# University of Bergen (UiB), Norway
-# Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-#
-# Common configure.ac file for the GLite WMS Common module
-#
-# Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
-# Version info: $Id$
-# Release: $Name$
-#
-# Revision history:
-# $Log$
-# Revision 1.17 2005/09/20 10:41:49 eronchie
-# Started merging with rc1.4
-#
-# Revision 1.16 2004/12/10 07:33:42 eronchie
-# Increased version
-#
-# Revision 1.15 2004/11/16 15:35:22 eronchie
-# Increased version
-#
-# Revision 1.14 2004/11/16 15:15:45 eronchie
-# Increased version
-#
-# Revision 1.13 2004/09/22 00:25:17 glbuild
-# Fixed missing parenthesis
-#
-# Revision 1.12 2004/09/21 19:22:09 glbuild
-# modified module.version
-#
-# Revision 1.11 2004/08/17 13:46:28 eronchie
-# Added interface
-#
-# Revision 1.10 2004/08/17 13:41:20 eronchie
-# Moved out JobIdExceptions.h cjobid.h JobId.h
-# Put in interface/glite/wmsutils/jobid
-#
-# Revision 1.9 2004/08/17 10:40:34 eronchie
-# Added optimize option
-#
-# Revision 1.8 2004/07/27 09:14:19 eronchie
-# Removed AC_WMSUTILS_EXCEPTION and AC_GLOBUS_SSL_UTILS checks
-# Set directly exception library macro
-#
-# Revision 1.7 2004/07/21 17:53:36 eronchie
-# Moved out org.glite.wms.jobid from org.glite.wms and put in org.glite.wms-utils
-#
-#
-#
-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ(2.57)
-AC_INIT([GLite WMS Utils Jobid], [1.0.2])
-AC_CONFIG_AUX_DIR([./project])
-AM_INIT_AUTOMAKE([1.6.3 subdir-objects])
-AC_CONFIG_SRCDIR([src/jobid/strmd5.h])
-
-# Notices.
-AC_COPYRIGHT([Copyright (c) 2004 The EU EGEE Project
-See LICENCE file for details
-])
-AC_REVISION([$Revision$])
-
-#Environment.
-WORKDIR=`pwd`
-AC_SUBST(WORKDIR)
-
-# Checks for programs.
-AC_PROG_CC
-AC_PROG_CPP
-AC_PROG_CXX
-AC_PROG_CXXCPP
-AM_PROG_CC_C_O
-AC_PROG_LIBTOOL
-
-# Checks for libraries.
-
-# Checks for header files.
-AC_CHECK_HEADERS([fcntl.h mntent.h sys/vfs.h syslog.h unistd.h])
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_HEADER_STDBOOL
-AC_C_CONST
-AC_C_INLINE
-AC_TYPE_OFF_T
-AC_TYPE_SIZE_T
-AC_CHECK_MEMBERS([struct stat.st_rdev])
-AC_TYPE_UID_T
-AC_CHECK_TYPES([ptrdiff_t])
-
-# Checks for library functions.
-AC_HEADER_STDC
-AC_FUNC_ERROR_AT_LINE
-AC_FUNC_GETMNTENT
-AC_FUNC_MEMCMP
-AC_FUNC_STAT
-AC_FUNC_STRFTIME
-AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([bzero endpwent ftruncate getmntent memset mkdir pow strerror strtol])
-
-have_globus=no
-
-AC_GLOBUS([], have_globus=yes, have_globus=no)
-AC_MSG_RESULT(["GLOBUS found $have_globus"])
-
-if test "$have_globus" = "no"; then
- AC_MSG_RESULT(["Please verify GLOBUS package"])
-fi
-
-if test "$have_globus" = "no"; then
- AC_MSG_ERROR([Cannot continue building])
-fi
-AC_GLITE
-
-GLITE_WMSUTILS_EXCEPTION_LIBS="-L$GLITE_LOCATION/lib -lglite_wmsutils_exception"
-
-AC_SUBST(GLITE_WMSUTILS_EXCEPTION_LIBS)
-
-AC_OPTIMIZE
-
-# Configuration items
-AC_PREFIX_DEFAULT([/opt/glite])
-AM_CONFIG_HEADER([src/autogen/config.h])
-AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([examples/Makefile])
-AC_CONFIG_FILES([interface/Makefile])
-AC_CONFIG_FILES([src/Makefile])
-AC_CONFIG_FILES([src/jobid/Makefile])
-
-AC_OUTPUT
-
+++ /dev/null
-## *********************************************************************
-## *
-## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid.
-## * For license conditions see LICENSE file or
-## * http://www.edg.org/license.html
-## *
-## *********************************************************************
-
-STDCPP = -lstdc++
-
-JOBID = $(top_builddir)/src/jobid/libglite_wmsutils_cjobid.la
-
-check_PROGRAMS = testjobid
-
-testjobid_SOURCES = testjobid.c
-testjobid_LDADD = \
- $(JOBID) \
- $(GLITE_WMSUTILS_EXCEPTION_LIBS) \
- $(GLOBUS_SSL_THR_LIBS) \
- $(STDCPP)
-
-AM_CPPFLAGS = -I$(top_srcdir)/src \
- -I$(top_srcdir)/interface \
- $(GLITE_CFLAGS) \
- $(GLOBUS_THR_CFLAGS)
-
-MAINTAINERCLEANFILES = Makefile.in *~
-
+++ /dev/null
-/* test code for jobid routines */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "glite/wmsutils/jobid/cjobid.h"
-
-int main(int argc, char* argv[])
-{
- char* ju;
- char* bkserver = "ujsa.uhjs";
-
- edg_wlc_JobId ji = 0;
- edg_wlc_JobId ji2 = 0;
-
- int r = edg_wlc_JobIdCreate(bkserver, 0, &ji);
- printf("Create: %d\n", r);
-
- ju = edg_wlc_JobIdUnparse(ji);
- printf("Unparse: %s\n", ju);
-
- edg_wlc_JobIdParse(ju, &ji2);
- free(ju);
-
- ju = edg_wlc_JobIdUnparse(ji);
- printf("Unparse2: %s\n", ju);
- free(ju);
-
- edg_wlc_JobIdFree(ji);
- edg_wlc_JobIdFree(ji2);
-
- return 0;
-}
+++ /dev/null
-## *********************************************************************
-## *
-## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid.
-## * For license conditions see LICENSE file or
-## * http://www.edg.org/license.html
-## *
-## *********************************************************************
-
-jobiddir = $(includedir)
-nobase_jobid_HEADERS = \
- glite/wmsutils/jobid/cjobid.h \
- glite/wmsutils/jobid/manipulation.h \
- glite/wmsutils/jobid/JobIdExceptions.h \
- glite/wmsutils/jobid/JobId.h
-
-MAINTAINERCLEANFILES = Makefile.in
+++ /dev/null
-#ifndef GLITE_WMSUTILS_JOBID_JOBID_H
-#define GLITE_WMSUTILS_JOBID_JOBID_H
-
-/*
- * JobId.h
- * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved.
- *
- */
-
-#include <string>
-#include <iosfwd>
-
-#include "glite/wmsutils/jobid/cjobid.h"
-
-typedef struct _edg_wlc_jobid_s* edg_wlc_jobid_t;
-
-namespace glite {
-namespace wmsutils {
-namespace jobid {
-
-/**
- * Managing Identification, checking, retreiving info from a job
- * File name: JobId.h
- * The JobId class provides a representation of the Datagrid job identifier
- * (dg_jobId) and the methods for manipulating it.
- * We remind that the format of the dg_jobId is as follows:
- * <LB address>:<LB port>/<Unique String>
- *
- * @ingroup common
- * @version 0.1
- * @date 15 April 2002
- * @author Alessandro Maraschini <alessandro.maraschini@datamat.it> */
-
-class JobId {
-public:
- /**@name Constructors/Destructor */
- //@{
- /** Instantiates an empty JobId object */
- JobId() ;
- /**
- * Instantiates a JobId object from the passed dg_jobId in string format.
- * @param job_id_string a string representig a classAd expression
- * @throws WrongIdException When a string is passed in a wrong format
- */
- JobId(const std::string& job_id_string);
- JobId(const JobId&);
- JobId(const edg_wlc_JobId&);
- /**
- * Destructor
- * Destroy the Job Id instance
- */
- ~JobId() ;
- //@}
-
- /**@name Miscellaneous */
- //@{
- /** Unsets the JobId instance. Clear all it's memebers */
- void clear() ;
- /**
- * Check wheater the jobId has been already created (true) or not (false)
- *@return true (jobId created) or false (jobId not yet created)
- */
- bool isSet() { return ( m_JobId != 0 ) ; }
- /**
- * Set the JobId instance according to the LB and RB server addresses and the unique string passed as input parameters.
- * @param lb_server Loggin and Bookkeeping server address
- * @param port Loggin and Bookkeeping port ( dafault value is 9000 )
- * @param unique A Unique identification ( automatically generatad by md5 protocol )
- * @throws WrongIdException When one parameter has been passed in a wrong format */
- void setJobId(const std::string& lb_server, int port = 0, const std::string& unique = "");
- //@}
- /**@name Get Methods */
- //@{
- /** @return the LB address into its string format
- * @throws EmptyIdException If the jobId has not been initialised yet */
- std::string getServer() const;
- /** @return the Unique string into its string format
- * @throws EmptyIdException If the jobId has not been initialised yet */
- std::string getUnique() const;
- //@}
- /** This method sets the JobId instance from the JobId in string format given
- * as input.
- * @param dg_JobId the string representing the job
- * @throws WrongIdException When a string is passed in a wrong format */
- void fromString ( const std::string& dg_JobId );
- /** Converts the jobId into a string
- @return the string representation of a JobId*/
- std::string toString() const;
- /** casting operator */
- operator const edg_wlc_JobId() const { return m_JobId; }
- /** Operator "=" create a deep copy of the JobId instance*/
- JobId & operator=(JobId const &);
- /** Operator "=" create a deep copy of the JobId instance*/
- JobId & operator=(const edg_wlc_JobId &);
- /** Retrieve the internal id reference
- *@return the JobId internal reference used by some LB methods */
- edg_wlc_JobId getId() const ;
-private:
- // This Variable stores the Job unique identification String
- edg_wlc_JobId m_JobId;
- mutable char* m_pStr;
- mutable char* m_pBkserver;
- mutable char* m_pUnique;
- /** Operator "<"*/
- friend bool operator<(JobId const& lhs, JobId const& rhs);
- /** Operator "=="*/
- friend bool operator==(JobId const& lhs, JobId const& rhs);
-};
-
-inline bool operator<(JobId const& lhs, JobId const& rhs)
-{
- return strcmp ( lhs.m_pStr , rhs.m_pStr ) <0 ;
-}
-
-inline bool operator==(JobId const& lhs, JobId const& rhs)
-{
-return strcmp ( lhs.m_pStr , rhs.m_pStr ) ==0 ;
-}
-
-std::ostream& operator<<(std::ostream& os, JobId const& id);
-
-} // namespace jobid
-} // namespace wmsutils
-} // namespace glite
-
-#endif // GLITE_WMSUTILS_JOBID_JOBID_H
+++ /dev/null
-#ifndef GLITE_WMSUTILS_JOBID_EXCEPTIONS_H
-#define GLITE_WMSUTILS_JOBID_EXCEPTIONS_H
-
-/*
- * JobIdExceptions.h
- * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved.
- */
-
-#include "glite/wmsutils/exception/Exception.h"
-
-namespace glite {
-namespace wmsutils {
-namespace jobid {
-
-/**
- * JobIdException - Exception thrown by JobId Class
- * @ingroup Common
- * @version 0.1
- * @date 15 April 2002
- * @author Alessandro Maraschini <alessandro.maraschini@datamat.it>
-*/
-
-class JobIdException : public glite::wmsutils::exception::Exception {
-public:
- /**
- * Update all mandatory Exception Information
- */
- JobIdException (const std::string& file,
- int line,
- const std::string& method,
- int code,
- const std::string& exception_name) ;
-};//End CLass JobIdException
-
-/**
-* WrongIdFieldException
-* This Exception is thrown when a Job Id syntax error is found
-* A valid Job Identification string should be made as follows:
-* <LB address>:<LB port>/ <Unique string> */
-class WrongIdException : public JobIdException {
-public:
- /**
- * Constructor
- * @param file - The source file which has generated the Exception
- * @param line - The line number in the source file where the Exception has been thrown
- * @param method - The Name of the method which has thrown the Exception
- * @param code - The Code of the Error raised
- * @param field - The wrong expression catched */
- WrongIdException(const std::string& file,
- int line,
- const std::string& method,
- int code );
-}; //End CLass WrongIdException
-/**
-* EmptyIdException
-* This Exception is thrown when the user tries to get information from a JobId
-* which has not been initialized yet, i.e tries to use the get<field name> Methods
-*/
-class EmptyIdException : public JobIdException {
-public:
- /**
- * Constructor
- * @param file - The source file which has generated the Exception
- * @param line - The line number in the source file where the Exception has been thrown
- * @param method - The Name of the method which has thrown the Exception
- * @param code - The Code of the Error raised
- * @param field - The Empty filed requested for */
- EmptyIdException::EmptyIdException(const std::string& file,
- int line,
- const std::string& method,
- int code ,
- const std::string& field );
-}; //End CLass EmptyIdException
-
-} // namespace jobid
-} // namespace wmsutils
-} // namespace glite
-
-#endif // GLITE_WMSUTILS_JOBID_EXCEPTIONS_H
-
+++ /dev/null
-#ifndef _GLITE_JOBID_H
-#define _GLITE_JOBID_H
-
-/*!
- * \file cjobid.h
- * \brief L&B consumer API
- */
-
-#ident "$Header$"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _edg_wlc_JobId *edg_wlc_JobId;
-
-#define GLITE_WMSC_JOBID_DEFAULT_PORT 9000 /**< Default port where bookkeeping server listens */
-#define GLITE_WMSC_JOBID_PROTO_PREFIX "https://" /**< JobId protocol prefix */
-
-
-/* All the pointer functions return malloc'ed objects (or NULL on error) */
-
-/**
- * Create a Job ID.
- * See the lb_draft document for details on its construction and components
- * \param bkserver book keeping server hostname
- * \param port port for the bk service
- * \param jobid new created job id
- * \ret al 0 success
- * \retval EINVAL invalid bkserver
- * \retval ENOMEM if memory allocation fails
- */
-int edg_wlc_JobIdCreate(const char * bkserver, int port, edg_wlc_JobId * jobid);
-
-/**
- * Recreate a Job ID
- * \param bkserver bookkeeping server hostname
- * \param port port for the bk service
- * \param unique string which represent created jobid (if NULL then new
- * one is created)
- * \param jobid new created job id
- * \retval 0 success
- * \retval EINVAL invalid bkserver
- * \retval ENOMEM if memory allocation fails
- */
-int edg_wlc_JobIdRecreate(const char *bkserver, int port, const char * unique, edg_wlc_JobId * jobid);
-
-/**
- * Create copy of Job ID
- * \param in jobid for duplication
- * \param jobid duplicated jobid
- * \retval 0 for success
- * \retval EINVAL invalid jobid
- * \retval ENOMEM if memory allocation fails
- */
-int edg_wlc_JobIdDup(const edg_wlc_JobId in, edg_wlc_JobId * jobid);
-
-/*
- * Free jobid structure
- * \param jobid for dealocation
- */
-void edg_wlc_JobIdFree(edg_wlc_JobId jobid);
-
-/**
- * Parse Job ID string and creates jobid structure
- * \param jobidstr string representation of jobid
- * \param jobid parsed job id
- * \retval 0 for success
- * \retval EINVAL jobidstr can't be parsed
- * \retval ENOMEM if memory allocation fails
- */
-int edg_wlc_JobIdParse(const char* jobidstr, edg_wlc_JobId * jobid);
-
-/**
- * Unparse Job ID (produce the string form of JobId).
- * \param jobid to be converted to string
- * \return allocated string which represents jobid
- */
-char* edg_wlc_JobIdUnparse(const edg_wlc_JobId jobid);
-
-/**
- * Extract bookkeeping server address (address:port)
- * \param jobid from which the bkserver address should be extracted
- * \retval pointer to allocated string with bkserver address
- * \retval NULL if jobid is 0 or memory allocation fails
- */
-char* edg_wlc_JobIdGetServer(const edg_wlc_JobId jobid);
-
-/**
- * Extract bookkeeping server address and port
- * \param jobid from which the bkserver address should be extracted
- * \param srvName pointer where to return server name
- * \param srvPort pointer where to return server port
- * */
-void edg_wlc_JobIdGetServerParts(const edg_wlc_JobId jobid, char **srvName, unsigned int *srvPort);
-
-/**
- * Extract unique string
- * \param jobid
- * \retval pointer to allocated unique string representing jobid
- * \retval NULL if jobid is 0 or memory allocation fails
- */
-char* edg_wlc_JobIdGetUnique(const edg_wlc_JobId jobid);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GLITE_JOBID_H */
+++ /dev/null
-#ifndef GLITE_WMSUTILS_JOBID_MANIPULATION_H
-#define GLITE_WMSUTILS_JOBID_MANIPULATION_H
-
-#include <string>
-
-namespace glite {
-namespace wmsutils {
-namespace jobid {
-
-class JobId;
-
-std::string get_reduced_part( const JobId &id, int level = 0 );
-std::string to_filename( const JobId &id );
-JobId from_filename( const std::string &filename );
-
-} // namespace jobid
-} // namespace wmsutils
-} // namespace glite
-
-#endif /* GLITE_WMSUTILS_JOBID_MANIPULATION_H */
-
-// Local Variables:
-// mode: c++
-// End:
+++ /dev/null
-#Sat Oct 15 02:12:40 CEST 2005
-module.build=152
+++ /dev/null
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <project name="configure options">
- <property name="configure.args"
- value="--prefix=${workspace.abs.dir}/stage --with-globus-prefix=${with.globus.prefix} --with-globus-thr-flavor=${with.globus.thr.flavor} --with-globus-nothr-flavor=${with.globus.nothr.flavor} --with-cppunit-prefix=${with.cppunit.prefix} --with-glite-location=${with.glite.location} --with-dist-location=${with.dist.location} --disable-optimization"/>
-
- </project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Common build properties file for the Glite WMS Common component
-
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Joachim Flammer <Joachim.Flammer@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.8 2004/08/04 07:42:42 eronchie
- Added cppunit.m4
-
- Revision 1.7 2004/08/04 07:38:27 eronchie
- Added cppunit
-
- Revision 1.6 2004/07/28 07:27:22 eronchie
- Added /
-
- Revision 1.5 2004/07/28 07:21:58 eronchie
- Added m4files.list property
-
- Revision 1.4 2004/07/23 14:47:01 eronchie
- Removed....
-
- Revision 1.3 2004/07/21 18:22:38 eronchie
- Changed wms in wms-utils
-
- Revision 1.2 2004/07/16 14:56:56 flammer
- Corrected input path of build.properties.
-
- Revision 1.1.1.1 2004/05/26 18:45:05 eronchie
- Import of wms jobid
-
-
--->
-
-<project name="WMS Utils jobid component common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property file="project/build.properties" />
-
- <!-- ======================================================
- Define corresponding subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${wms-utils.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${wms-utils.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define component properties
- ====================================================== -->
-
- <!-- Component name prefix -->
- <property name="component.prefix" value="jobid" />
-
- <!-- ======================================================
- Define general component properties
- ====================================================== -->
-
- <import file="${component.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <property name="m4files.list" value="globus.m4 glite.m4 cppunit.m4 optimize.m4"/>
-
-</project>
+++ /dev/null
-module.version=1.0.2
-module.age=1
+++ /dev/null
-## *********************************************************************
-## *
-## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid.
-## * For license conditions see LICENSE file or
-## * http://www.edg.org/license.html
-## *
-## *********************************************************************
-
-## Subdirectories list
-SUBDIRS = jobid
-
-MAINTAINERCLEANFILES = Makefile.in
+++ /dev/null
-/* **************************************************************************
- * filename : JobId.cpp
- * author : Alessandro Maraschini <alessandro.maraschini@datamat.it>
- * copyright : (C) 2002 by DATAMAT
- ***************************************************************************/
-
-#include "glite/wmsutils/jobid/JobId.h"
-
-#include <iostream>
-
-#include "glite/wmsutils/jobid/JobIdExceptions.h"
-
-namespace glite {
-namespace wmsutils {
-namespace jobid {
-
-using namespace std ;
-
-/******************************************************************
- Constructor / Destructor
- *******************************************************************/
-JobId::JobId() : m_JobId( 0 ), m_pStr( 0 ), m_pBkserver( 0 ), m_pUnique( 0 )
-{
-}
-
-JobId::JobId(const std::string& job_id_string )
- : m_JobId( 0 ), m_pStr( 0 ), m_pBkserver( 0 ), m_pUnique( 0 )
-{
- fromString( job_id_string ) ;
-}
-
-JobId::JobId(const JobId &old)
-{
- edg_wlc_JobIdDup(old.m_JobId,&m_JobId);
- m_pStr = old.m_pStr ? strdup(old.m_pStr) : 0;
- m_pBkserver = old.m_pBkserver ? strdup(old.m_pBkserver) : 0;
- m_pUnique = old.m_pUnique ? strdup(old.m_pUnique) : 0;
-}
-
-JobId & JobId::operator=(JobId const &old)
-{
- clear();
- edg_wlc_JobIdDup(old.m_JobId,&m_JobId);
- m_pStr = old.m_pStr ? strdup(old.m_pStr) : 0;
- m_pBkserver = old.m_pBkserver ? strdup(old.m_pBkserver) : 0;
- m_pUnique = old.m_pUnique ? strdup(old.m_pUnique) : 0;
-
- return *this;
-}
-
-
-JobId::JobId(const edg_wlc_JobId &old)
- : m_pStr(0), m_pBkserver(0), m_pUnique(0)
-{
- edg_wlc_JobIdDup(old,&m_JobId);
-}
-
-
-JobId & JobId::operator=(const edg_wlc_JobId &old)
-{
- clear();
- edg_wlc_JobIdDup(old,&m_JobId);
- m_pStr = 0;
- m_pBkserver = 0;
- m_pUnique = 0;
- return(*this);
-}
-
-JobId::~JobId()
-{
- clear();
-}
-
-/******************************************************************
- method : clear
- unsets the JobId instance.
- *******************************************************************/
-void JobId::clear()
-{
- if ( m_JobId )
- {
- edg_wlc_JobIdFree( m_JobId );
- m_JobId = 0;
- if (m_pStr)
- free(m_pStr);
- if (m_pBkserver)
- free(m_pBkserver);
- if (m_pUnique)
- free(m_pUnique);
- m_pStr = m_pBkserver = m_pUnique = NULL;
- }
-}
-
-
-/******************************************************************
- method : setJobId
- sets the JobId instance according to the LB and RB
- server addresses and the unique string passed as input parameters.
- *******************************************************************/
-void JobId::setJobId(const string& bkserver, int port, const string& unique)
-{
- int code = edg_wlc_JobIdRecreate(bkserver.c_str(), port, unique.size() ? unique.c_str() : NULL, &m_JobId) ;
- if ( code != 0 )
- throw WrongIdException(__FILE__ , __LINE__ , "setJobId(const string& bkserver, int port, const string& unique)" , code ) ;
-}
-
-
-/******************************************************************
- Protected method : fromString
- sets the JobId instance from the dg_jobId in string format given as input.
- *******************************************************************/
-void JobId::fromString (const string& dg_JobId)
-{
- clear();
- int code = edg_wlc_JobIdParse(dg_JobId.c_str(), &m_JobId) ;
- if ( code != 0 )
- throw WrongIdException(__FILE__ , __LINE__ , "fromString (const string& dg_JobId)" , code ) ;
-}
-
-/******************************************************************
- method : ToString
- converts the JobId instance into its string format.
- and put it in the dg_jobId output variable
- *******************************************************************/
-std::string JobId::toString() const
-{
- if ( m_JobId && !m_pStr )
- m_pStr = edg_wlc_JobIdUnparse(m_JobId) ;
- if ( !m_pStr )
- throw EmptyIdException (__FILE__ , __LINE__ ,"toString()" ,ENOENT , "JobId") ;
- return m_pStr;
-}
-
-/******************************************************************
- method : getServer
- return a string containing the LB server address,
- *******************************************************************/
-std::string JobId::getServer() const
-{
- if ( m_JobId && !m_pBkserver )
- m_pBkserver = edg_wlc_JobIdGetServer( m_JobId ) ;
-
- if ( !m_pBkserver )
- throw EmptyIdException (__FILE__ , __LINE__ , "getServer()", ENOENT , "LB server Address") ;
-
- return m_pBkserver;
-}
-
-/******************************************************************
- method : getUnique
- return a string containing unique jobid string
- *******************************************************************/
-std::string JobId::getUnique() const
-{
- if ( m_JobId && !m_pUnique )
- m_pUnique = edg_wlc_JobIdGetUnique( m_JobId ) ;
-
- if ( !m_pUnique )
- throw EmptyIdException (__FILE__ , __LINE__ , "getUnique()" , ENOENT , "Unique") ;
-
- return m_pUnique;
-}
-/******************************************************************
- method : getId
- return the c JobId struct representing this instance
- *******************************************************************/
-edg_wlc_JobId JobId::getId() const
-{
- edg_wlc_JobId out ;
- if ( edg_wlc_JobIdDup(m_JobId, &out) )
- throw EmptyIdException (__FILE__ , __LINE__ , "getId()" , ENOENT , "JobId") ;
- return out ;
-}
-
-std::ostream&
-operator<<(std::ostream& os, JobId const& id)
-{
- return os << id.toString();
-}
-
-} // namespace jobid
-} // namespace wmsutils
-} // namespace glite
+++ /dev/null
-/* **************************************************************************
-* filename : JobIdExecptions.cpp
-* author : Alessandro Maraschini <alessandro.maraschini@datamat.it>
-* copyright : (C) 2002 by DATAMAT
-***************************************************************************/
-
-#include "glite/wmsutils/jobid/JobIdExceptions.h"
-
-namespace glite {
-namespace wmsutils {
-namespace jobid {
-
-using namespace std;
-using namespace glite::wmsutils::exception;
-
-/*****************************
-* JobIdException
-*****************************/
-JobIdException::JobIdException (const string& file,
- int line,
- const string& method,
- int code,
- const string& exception_name)
- : Exception(file, line, method, code, exception_name)
-{
-}
-
-/*****************************
-* WrongIdException
-*****************************/
-WrongIdException::WrongIdException(const string& file,
- int line,
- const string& method,
- int code )
- : JobIdException(file, line, method, code,
- "WrongIdException")
-{
- error_message = "Wrong Field caught while parsing Job Id" ;
-}
-
-/*****************************
-* EmptyIdException
-*****************************/
-EmptyIdException::EmptyIdException(const string& file,
- int line,
- const string& method,
- int code ,
- const string& field )
- : JobIdException(file, line, method, code,
- "EmptyIdException")
-{
- error_message = "Unable to retrieve " + field + ": the instance has not been initialized yet";
-}
-
-} // namespace jobid
-} // namespace wmsutils
-} // namespace glite
-
+++ /dev/null
-## *********************************************************************
-## *
-## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid.
-## * For license conditions see LICENSE file or
-## * http://www.edg.org/license.html
-## *
-## *********************************************************************
-
-lib_LTLIBRARIES = libglite_wmsutils_jobid.la libglite_wmsutils_cjobid.la
-
-libglite_wmsutils_jobid_la_SOURCES = \
- JobId.cpp \
- JobIdExceptions.cpp \
- manipulation.cpp
-
-libglite_wmsutils_cjobid_la_SOURCES = \
- cjobid.c \
- strmd5.c
-
-jobidincludedir = $(includedir)/glite/wmsutils/jobid
-jobidinclude_HEADERS = \
- strmd5.h
-
-AM_CPPFLAGS = -I$(top_srcdir)/src \
- -I$(top_srcdir)/interface \
- $(GLITE_CFLAGS) \
- $(GLOBUS_THR_CFLAGS) \
- -D_GNU_SOURCE
-
-MAINTAINERCLEANFILES = Makefile.in
+++ /dev/null
-#ident "$Header$"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-#include <netdb.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-#include "glite/wmsutils/jobid/cjobid.h"
-#include "strmd5.h"
-
-struct _edg_wlc_JobId {
- char *id; /* unique job identification */
- /* additional information */
- char *BShost;/* bookkeeping server hostname */
- unsigned int BSport; /* bookkeeping server port */
- char *info; /* additional information (after ? in URI) */
-};
-
-int edg_wlc_JobIdCreate(const char *bkserver, int port, edg_wlc_JobId *jobId)
-{
- return edg_wlc_JobIdRecreate(bkserver, port, NULL, jobId);
-}
-
-
-int edg_wlc_JobIdRecreate(const char* bkserver, int port, const char *unique, edg_wlc_JobId *jobId)
-{
- edg_wlc_JobId out;
- char hostname[200]; /* used to hold string for encrypt */
- struct timeval tv;
- int skip;
- char* portbeg;
-
- struct hostent* he;
-
- if (!bkserver)
- return EINVAL;
-
- if (unique == NULL) {
- gethostname(hostname, 100);
- he = gethostbyname(hostname);
- assert(he->h_length > 0);
- gettimeofday(&tv, NULL);
- srandom(tv.tv_usec);
-
- skip = strlen(hostname);
- skip += sprintf(hostname + skip, "-IP:0x%x-pid:%d-rnd:%d-time:%d:%d",
- *((int*)he->h_addr_list[0]), getpid(), (int)random(),
- (int)tv.tv_sec, (int)tv.tv_usec);
- }
-
- *jobId = NULL;
- out = (edg_wlc_JobId) malloc (sizeof(*out));
- if (!out)
- return ENOMEM;
-
- memset(out, 0, sizeof(*out));
-
- /* check if it begins with prefix */
- /* unsupported */
- if (strncmp(bkserver, GLITE_WMSC_JOBID_PROTO_PREFIX, sizeof(GLITE_WMSC_JOBID_PROTO_PREFIX)-1) == 0)
- return EINVAL;
-
- out->BShost = strdup(bkserver);
- portbeg = strchr(out->BShost, ':');
- if (portbeg) {
- *portbeg = 0;
- /* try to get port number */
- if (port == 0)
- port = atoi(portbeg + 1);
- }
-
- if (port == 0)
- port = GLITE_WMSC_JOBID_DEFAULT_PORT;
-
- out->BSport = port;
-
- out->id = (unique) ? strdup(unique) : str2md5base64(hostname);
- //printf("Encrypt: %s\nBASE64 %s\n", hostname, out->id);
-
- if (!out->id || !out->BShost) {
- edg_wlc_JobIdFree(out);
- return ENOMEM;
- }
-
- *jobId = out;
- return 0;
-}
-
-
-int edg_wlc_JobIdDup(const edg_wlc_JobId in, edg_wlc_JobId *out)
-{
- edg_wlc_JobId jid;
- *out = NULL;
- if (in == NULL)
- return 0;
-
- jid = malloc(sizeof(*jid));
- if (!jid)
- return ENOMEM;
-
- memset(jid, 0,sizeof(*jid));
- jid->BShost = strdup(in->BShost);
- jid->id = strdup(in->id);
- if (in->info)
- jid->info = strdup(in->info);
-
- if (jid->BShost == NULL || jid->id == NULL) {
- edg_wlc_JobIdFree(jid);
- return ENOMEM;
- }
-
- jid->BSport = in->BSport;
- *out = jid;
- return 0;
-}
-
-
-// XXX
-// use recreate
-// parse name, port, unique
-int edg_wlc_JobIdParse(const char *idString, edg_wlc_JobId *jobId)
-{
- char *pom, *pom1, *pom2;
- edg_wlc_JobId out;
-
- *jobId = NULL;
-
- out = (edg_wlc_JobId) malloc (sizeof(*out));
- if (out == NULL )
- return ENOMEM;
-
- memset(out,0,sizeof(*out));
-
- if (strncmp(idString, GLITE_WMSC_JOBID_PROTO_PREFIX, sizeof(GLITE_WMSC_JOBID_PROTO_PREFIX) - 1)) {
- out->BShost = (char *) NULL;
- out->BSport = 0;
-
- free(out);
- return EINVAL;
- }
-
- pom = strdup(idString + sizeof(GLITE_WMSC_JOBID_PROTO_PREFIX) - 1);
- pom1 = strchr(pom, '/');
- pom2 = strchr(pom, ':');
-
- if (!pom1) { free(pom); free(out); return EINVAL; }
-
- if ( pom2 && (pom1 > pom2)) {
- pom[pom2-pom] = '\0';
- out->BShost = strdup(pom);
- pom[pom1-pom] = '\0';
- out->BSport = (unsigned int) strtoul(pom2 + 1,NULL,10);
- } else {
- pom[pom1-pom] = '\0';
- out->BShost = strdup(pom);
- out->BSport = GLITE_WMSC_JOBID_DEFAULT_PORT;
- }
-
- /* XXX: localhost not supported in jobid
- if (!strncmp(out->BShost,"localhost",9) {
- free(pom);
- free(out->BShost);
- free(out);
- return EINVAL;
- }
- */
-
- /* additional info from URI */
- pom2 = strchr(pom1+1,'?');
- if (pom2) {
- *pom2 = 0;
- out->info = strdup(pom2+1);
- }
-
- /* extract the unique part */
- out->id = strdup(pom1+1);
-
- for (pom1 = out->BShost; *pom1; pom1++)
- if (isspace(*pom1)) break;
-
- for (pom2 = out->id; *pom2; pom2++)
- if (isspace(*pom2)) break;
-
- if (*pom1 || *pom2) {
- free(pom);
- edg_wlc_JobIdFree(out);
- return EINVAL;
- }
-
- free(pom);
- *jobId = out;
- return 0;
-}
-
-
-void edg_wlc_JobIdFree(edg_wlc_JobId job)
-{
- if (job) {
- free(job->id);
- free(job->BShost);
- free(job->info);
- free(job);
- }
-}
-
-
-char* edg_wlc_JobIdUnparse(const edg_wlc_JobId jobid)
-{
- char *out, port[40];
-
- if (!jobid)
- return NULL;
-
- if (jobid->BSport)
- sprintf(port,":%d",jobid->BSport);
- else
- *port = 0;
-
- asprintf(&out, GLITE_WMSC_JOBID_PROTO_PREFIX"%s%s/%s%s%s",
- jobid->BShost,port,
- jobid->id,
- (jobid->info ? "?" : ""),
- (jobid->info ? jobid->info : ""));
-
- return out;
-}
-
-
-char* edg_wlc_JobIdGetServer(const edg_wlc_JobId jobid)
-{
- char *bs = NULL;
-
- if (jobid)
- asprintf(&bs, "%s:%u", jobid->BShost,
- jobid->BSport ? jobid->BSport : GLITE_WMSC_JOBID_DEFAULT_PORT);
-
- return bs;
-}
-
-
-void edg_wlc_JobIdGetServerParts(const edg_wlc_JobId jobid, char **srvName, unsigned int *srvPort)
-{
- if (jobid) {
- *srvName = strdup(jobid->BShost);
- *srvPort = jobid->BSport ? jobid->BSport : GLITE_WMSC_JOBID_DEFAULT_PORT;
- }
-}
-
-
-char* edg_wlc_JobIdGetUnique(const edg_wlc_JobId jobid)
-{
- return jobid ? strdup(jobid->id) : NULL;
-}
+++ /dev/null
-#include <cctype>
-
-#include <string>
-#include <algorithm>
-
-#include "glite/wmsutils/jobid/JobId.h"
-
-using namespace std;
-
-namespace glite {
-namespace wmsutils {
-namespace jobid {
-
-namespace {
-
-class HexInt {
-public:
- HexInt( unsigned int i = 0 );
- HexInt( const string &str );
- HexInt( string::const_iterator begin, string::const_iterator end );
- ~HexInt( void );
-
- inline operator unsigned int( void ) const { return this->hi_int; }
- inline operator const string &( void ) const { return this->hi_str; }
-
- static unsigned int least( void ) { return hi_s_least; }
- static void least( unsigned int least ) { hi_s_least = least; }
-
-private:
- void parseString( void );
-
- unsigned int hi_int;
- string hi_str;
-
- static unsigned int hi_s_least;
- static const char *hi_s_map;
-};
-
-class BadChar {
-public:
- BadChar( void );
- ~BadChar( void );
-
- inline bool operator()( char c )
- { return( !(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9')) ||
- (c == '.') || (c == '-') || (c == ' ')) ); }
-};
-
-unsigned int HexInt::hi_s_least = 2;
-const char *HexInt::hi_s_map = "0123456789abcdef";
-
-HexInt::HexInt( unsigned int ui ) : hi_int( ui ), hi_str( hi_s_least, '0' )
-{
- int n;
- string::reverse_iterator pos = this->hi_str.rbegin();
-
- while( ui != 0 ) {
- n = ui % 16;
- if( pos != this->hi_str.rend() ) {
- *pos = hi_s_map[n];
- pos += 1;
- }
- else this->hi_str.insert( this->hi_str.begin(), hi_s_map[n] );
-
- ui /= 16;
- }
-
- if( this->hi_str.length() < hi_s_least )
- this->hi_str.insert( this->hi_str.begin(), (hi_s_least - this->hi_str.length()), '0' );
-}
-
-HexInt::HexInt( const string &str ) : hi_int( 0 ), hi_str( str )
-{
- this->parseString();
-}
-
-HexInt::HexInt( string::const_iterator begin, string::const_iterator end ) : hi_int( 0 ), hi_str( begin, end )
-{
- this->parseString();
-}
-
-void HexInt::parseString( void )
-{
- int hexbase;
- char *pos, *end = (char *) hi_s_map + 16;
- string::reverse_iterator it;
-
- for( it = this->hi_str.rbegin(), hexbase = 1; it != this->hi_str.rend(); ++it, hexbase *= 16 ) {
- pos = find( (char *) hi_s_map, end, (char) tolower(*it) );
-
- if( pos != end ) this->hi_int += hexbase * (pos - hi_s_map);
- else {
- this->hi_int = 0;
- break;
- }
- }
-
- return;
-}
-
-HexInt::~HexInt( void ) {}
-
-BadChar::BadChar( void ) {}
-
-BadChar::~BadChar( void ) {}
-
-/*
- Helper function for the get_reduced_part(...)
-*/
-string get_reduced_part_internal( const string &unique, int level )
-{
- string::size_type length = unique.length();
- string piece( unique.substr(0, 2) ), answer;
-
- if( (level == 0) || (length <= 2) ) answer.assign( piece );
- else if( length != 0 ) {
- answer.assign( piece );
- answer.append( 1, '/' );
- answer.append( get_reduced_part_internal(unique.substr(2, length - 2), level - 1) );
- }
-
- return answer;
-}
-
-}; // Unnamed namespace
-
-string get_reduced_part( const JobId &id, int level )
-{
- return get_reduced_part_internal( id.getUnique(), level );
-}
-
-string to_filename( const JobId &id )
-{
- string sid( id.toString() ), coded;
- string::iterator last, next;
-
- last = sid.begin();
- do {
- next = find_if( last, sid.end(), BadChar() );
-
- if( next != sid.end() ) {
- if( last != next ) coded.append( last, next );
- coded.append( 1, '_' );
- coded.append( HexInt(*next) );
-
- last = next + 1;
- }
- else coded.append( last, sid.end() );
- } while( next != sid.end() );
-
- return coded;
-}
-
-JobId from_filename( const string &filename )
-{
- char c;
- string decoded;
- string::const_iterator last, next;
-
- last = filename.begin();
- do {
- next = find( last, filename.end(), '_' );
-
- if( next != filename.end() ) {
- c = HexInt( next + 1, next + 3 );
-
- if( last != next ) decoded.append( last, next );
- decoded.append( 1, c );
-
- last = next + 3;
- }
- else decoded.append( last, filename.end() );
- } while( next != filename.end() );
-
- return JobId( decoded );
-}
-
-} // namespace jobid
-} // namespace wmsutils
-} // namespace glite
+++ /dev/null
-#ident "$Header$"
-
-#include <openssl/md5.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "jobid/strmd5.h"
-
-#warning Thread unsafe!
-static char mbuf[33];
-
-static int base64_encode(const void *enc, int enc_size, char *out, int out_max_size)
-{
- static const char* b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
-
- unsigned char* enc_buf = (unsigned char*)enc;
- int out_size = 0;
- unsigned int bits = 0;
- unsigned int shift = 0;
-
- while ( out_size < out_max_size ) {
- if ( enc_size>0 ) {
- // Shift in byte
- bits <<= 8;
- bits |= *enc_buf;
- shift += 8;
- // Next byte
- enc_buf++;
- enc_size--;
- } else if ( shift>0 ) {
- // Pad last bits to 6 bits - will end next loop
- bits <<= 6 - shift;
- shift = 6;
- } else {
- // Terminate with Mime style '='
- *out = '=';
- out_size++;
-
- return out_size;
- }
-
- // Encode 6 bit segments
- while ( shift>=6 ) {
- shift -= 6;
- *out = b64[ (bits >> shift) & 0x3F ];
- out++;
- out_size++;
- }
- }
-
- // Output overflow
- return -1;
-}
-
-char *strmd5(const char *s, unsigned char *digest)
-{
- MD5_CTX md5;
- unsigned char d[16];
- int i;
-
- MD5_Init(&md5);
- MD5_Update(&md5,s,strlen(s));
- MD5_Final(d,&md5);
-
- if (digest) memcpy(digest,d,sizeof(d));
-
- for (i=0; i<16; i++) {
- int dd = d[i] & 0x0f;
- mbuf[2*i+1] = dd<10 ? dd+'0' : dd-10+'a';
- dd = d[i] >> 4;
- mbuf[2*i] = dd<10 ? dd+'0' : dd-10+'a';
- }
- mbuf[32] = 0;
- return (char *) mbuf;
-}
-
-char *str2md5(const char *s)
-{
- MD5_CTX md5;
- unsigned char d[16];
- char* ret = malloc(33);
- int i;
-
- if (!ret)
- return NULL;
-
- MD5_Init(&md5);
- MD5_Update(&md5, s, strlen(s));
- MD5_Final(d, &md5);
-
- for (i=0; i<16; i++) {
- int dd = d[i] & 0x0f;
- ret[2*i+1] = dd<10 ? dd+'0' : dd-10+'a';
- dd = d[i] >> 4;
- ret[2*i] = dd<10 ? dd+'0' : dd-10+'a';
- }
- ret[32] = 0;
- return ret;
-}
-
-char *str2md5base64(const char *s)
-{
- MD5_CTX md5;
- unsigned char d[16];
- char buf[50];
- int l;
-
- MD5_Init(&md5);
- MD5_Update(&md5, s, strlen(s));
- MD5_Final(d, &md5);
-
- l = base64_encode(d, 16, buf, sizeof(buf) - 1);
- if (l < 1)
- return NULL;
- buf[l - 1] = 0;
- return strdup(buf);
-}
+++ /dev/null
-#ifndef _GLITE_STRMD5_H
-#define _GLITE_STRMD5_H
-
-#ident "$Header$"
-
-/* Compute MD5 sum of the first argument.
- * The sum is returned in the 16-byte array pointed to by 2nd argument
- * (if not NULL)
- *
- * Return value: ASCII string of the sum, i.e. 32 characters [0-9a-f]
- * (pointer to static area, changed by subsequent calls)
- */
-
-char *strmd5(const char *src, unsigned char *dst);
-
-/**
- * Returns: allocated 32bytes long ASCII string with md5 sum
- * of the first argument
- */
-char *str2md5(const char *src);
-
-/**
- * Returns: allocated 22bytes long ASCII string with md5 sum in base64
- * format of the source argument
- */
-char *str2md5base64(const char *src);
-
-#endif /* _GLITE_STRMD5_H */
+++ /dev/null
-## *********************************************************************
-## *
-## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid.
-## * For license conditions see LICENSE file or
-## * http://www.edg.org/license.html
-## *
-## *********************************************************************
-
-JOBID_LIBS = $(top_builddir)/src/jobid/libglite_wmsutils_jobid.la
-CJOBID_LIBS = $(top_builddir)/src/jobid/libglite_wmsutils_cjobid.la
-
-TESTS = glite-wmsutils-jobid \
- glite-wmsutils-manipulation
-
-check_PROGRAMS = $(TESTS)
-
-glite_wmsutils_jobid_SOURCES = jobid_cu_suite.cpp \
- jobid_cu_suite.h \
- jobid_cu_main.cpp
-
-glite_wmsutils_jobid_LDADD = \
- $(GLITE_WMSUTILS_EXCEPTION_LIBS) \
- $(GLOBUS_GSS_THR_LIBS) \
- $(CPPUNIT_LIBS) \
- $(JOBID_LIBS) \
- $(CJOBID_LIBS)
-
-glite_wmsutils_manipulation_SOURCES = manipulation_cu_suite.cpp \
- manipulation_cu_suite.h \
- manipulation_cu_main.cpp
-
-glite_wmsutils_manipulation_LDADD = \
- $(GLITE_WMSUTILS_EXCEPTION_LIBS) \
- $(GLOBUS_GSS_THR_LIBS) \
- $(CPPUNIT_LIBS) \
- $(JOBID_LIBS) \
- $(CJOBID_LIBS)
-
-
-AM_CPPFLAGS = -I$(top_srcdir)/interface \
- -I$(top_srcdir)/src \
- -I$(top_srcdir)/test \
- $(GLITE_CFLAGS) \
- $(GLOBUS_THR_CFLAGS) \
- $(CPPUNIT_CFLAGS)
-
-MAINTAINERCLEANFILES = Makefile.in *~
-
+++ /dev/null
-#include <iostream>
-#include <fstream>
-
-#include "jobid_cu_suite.h"
-
-#include <cppunit/TestResult.h>
-#include <cppunit/TestRunner.h>
-#include <cppunit/TestResultCollector.h>
-#include <cppunit/TextOutputter.h>
-#include <cppunit/XmlOutputter.h>
-
-using namespace CppUnit;
-using namespace std;
-
-int main (int argc , char** argv)
-{
- std::ofstream xml("./cppUnit_output.xml",ios::app);
-
- CppUnit::TestResult controller;
- CppUnit::TestResultCollector result;
- controller.addListener( &result );
-
- TestRunner runner;
- runner.addTest(Jobid_test::suite());
- runner.run(controller);
-
- CppUnit::XmlOutputter outputter( &result, xml );
- CppUnit::TextOutputter outputter2( &result, std::cerr );
- outputter.write();
- outputter2.write();
-
- return result.wasSuccessful() ? 0 : 1 ;
-}
+++ /dev/null
-#include "jobid_cu_suite.h"
-
-
-using namespace CppUnit;
-using namespace std;
-using namespace glite::wmsutils::jobid;
-
-
-void Jobid_test::setUp()
-{}
-
-void Jobid_test::tearDown()
-{}
-
-void Jobid_test::Constructor_case()
-{
- //EMPTY CONSTRUCTOR
- JobId empty;
-
- CPPUNIT_ASSERT(empty.isSet()==false);
-
- //create a string with cjobid
- string bkserver="grid012g.cnaf.infn.it";
- edg_wlc_JobId jobid;
- int bkport=6000;
- int ok=edg_wlc_JobIdCreate(bkserver.c_str(), bkport, &jobid);
- CPPUNIT_ASSERT(ok == 0);
- if (ok==0)
- {
- string jobstring=edg_wlc_JobIdUnparse(jobid);
-
- //STRING CONSTRUCTOR
- JobId stringCons(jobstring);
-
- //EDG_WLC CONSTRUCTOR
- JobId edg_wlc_Cons(jobid);
-
- //test copy constructor
- JobId copycon(stringCons);
-
- CPPUNIT_ASSERT(stringCons.isSet());
- CPPUNIT_ASSERT(edg_wlc_Cons.isSet());
- CPPUNIT_ASSERT(copycon.isSet());
-
- //test =
- JobId testequal;
- testequal=stringCons;
- CPPUNIT_ASSERT(testequal.isSet());
-
- JobId testoperator;
- testoperator=jobid;
- CPPUNIT_ASSERT(testoperator.isSet());
-
- edg_wlc_JobId testget = edg_wlc_Cons.getId();
- char *server;
- unsigned int port;
- edg_wlc_JobIdGetServerParts(testget, &server, &port);
- string serverstring = server;
- CPPUNIT_ASSERT(port==bkport);
- CPPUNIT_ASSERT(serverstring==bkserver);
- }
-
- CPPUNIT_ASSERT_THROW( JobId stringwrong("grid012"), WrongIdException);
-}
-
-void Jobid_test::Clear_case()
-{
- JobId *element;
- string jobstring="https://grid012g.cnaf.infn.it:6000/qaKyEoV3G144rmoyXeW6QA";
- CPPUNIT_ASSERT_NO_THROW(element= new JobId(jobstring));
-
- CPPUNIT_ASSERT(element->isSet());
- element->clear();
- CPPUNIT_ASSERT(element->isSet()==false);
- delete element;
-}
-
-void Jobid_test::SetandGet_case()
-{
- JobId element;
- string lbserver="grid012g.cnaf.infn.it";
- int port=6000;
- string unique ="qaKyEoV3G144rmoyXeW6QA";
- element.setJobId(lbserver, port, unique);
-
- string server=element.getServer();
- lbserver=lbserver+":6000";
-
- CPPUNIT_ASSERT(server==lbserver);
- string lonely=element.getUnique();
- CPPUNIT_ASSERT(lonely==unique);
-
- string descr=element.toString();
- cout << "!!! BEGIN TEST toString() METHOD!!!"<< endl;
- cout << descr <<endl;
- cout << "!!! END TEST toString() METHOD!!!"<< endl;
-
- JobId wrongelement;
- CPPUNIT_ASSERT_THROW(string server=wrongelement.getServer(), EmptyIdException);
- CPPUNIT_ASSERT_THROW(string server=wrongelement.getUnique(), EmptyIdException);
-
-}
+++ /dev/null
-#include<iostream>
-#include<string>
-#include<pthread.h>
-
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "glite/wmsutils/jobid/JobId.h"
-#include "glite/wmsutils/jobid/cjobid.h"
-#include "glite/wmsutils/jobid/JobIdExceptions.h"
-
-class Jobid_test : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE(Jobid_test);
-
- CPPUNIT_TEST(Constructor_case);
- CPPUNIT_TEST(Clear_case);
- CPPUNIT_TEST(SetandGet_case);
-
- CPPUNIT_TEST_SUITE_END();
-
-
-public:
-
- void setUp();
- void tearDown();
-
- void Constructor_case();
- void Clear_case();
- void SetandGet_case();
-
-};
-
-
-
+++ /dev/null
-#include <iostream>
-#include <fstream>
-
-#include "manipulation_cu_suite.h"
-
-#include <cppunit/TestResult.h>
-#include <cppunit/TestRunner.h>
-#include <cppunit/TestResultCollector.h>
-#include <cppunit/TextOutputter.h>
-#include <cppunit/XmlOutputter.h>
-
-using namespace CppUnit;
-using namespace std;
-
-int main (int argc , char** argv)
-{
- std::ofstream xml("./cppUnit_output.xml",ios::app);
-
- CppUnit::TestResult controller;
- CppUnit::TestResultCollector result;
- controller.addListener( &result );
-
- TestRunner runner;
- runner.addTest(Manipulation_test::suite());
- runner.run(controller);
-
- CppUnit::XmlOutputter outputter( &result, xml );
- CppUnit::TextOutputter outputter2( &result, std::cerr );
- outputter.write();
- outputter2.write();
-
- return result.wasSuccessful() ? 0 : 1 ;
-}
+++ /dev/null
-#include "manipulation_cu_suite.h"
-
-
-using namespace CppUnit;
-using namespace std;
-using namespace glite::wmsutils::jobid;
-
-
-void Manipulation_test::setUp()
-{}
-
-void Manipulation_test::tearDown()
-{}
-
-void Manipulation_test::to_fromfile_case()
-{
- JobId element;
-
- string lbserver="grid012g.cnaf.infn.it";
- int port=6000;
- string unique ="qaKyEoV3G144rmoyXeW6QA";
- element.setJobId(lbserver, port, unique);
-
- string filename=to_filename(element);
-
- JobId newelement = from_filename(filename);
-
- string reduced = get_reduced_part(element, 7);
-
- string newreduced = get_reduced_part(newelement, 7);
-
- CPPUNIT_ASSERT(reduced==newreduced);
-}
-
+++ /dev/null
-#include<iostream>
-#include<string>
-#include<pthread.h>
-
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "glite/wmsutils/jobid/JobId.h"
-#include "glite/wmsutils/jobid/manipulation.h"
-
-class Manipulation_test : public CppUnit::TestFixture {
-
- CPPUNIT_TEST_SUITE(Manipulation_test);
-
- CPPUNIT_TEST(to_fromfile_case);
-
- CPPUNIT_TEST_SUITE_END();
-
-
-public:
-
- void setUp();
- void tearDown();
-
- void to_fromfile_case();
-
-};
-
-
-
+++ /dev/null
-.project
\ No newline at end of file
+++ /dev/null
-* Wed Oct 12 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Fix for older OpenSSL to grst_x509.c from
- Zoltan.Farkas <Zoltan.Farkas@cern.ch>
-* Wed Oct 12 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.14 ====
-* Tue Oct 11 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Modify VOMS AC parsing to handle multiple ACs inside
- the same X.509 AC extension.
-* Mon Oct 10 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.13 ====
-* Mon Oct 10 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Add target_gname patch to gsexec from
- Gerben Venekamp <venekamp@nikhef.nl>
-* Thu Oct 6 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Fix session reuse with Shared-Memory SSL Session
- Cache bug #8856 in mod_gridsite.
-- Add SiteCast support to file copying in htcp.
-* Tue Oct 4 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Move User, Config, Admin and Install guides from
- doc directory into GridSite Wiki.
-- Create/update man pages for htcp, mod_gridsite and
- gsexec to be distributed with source/binaries.
-* Mon Oct 3 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Fix to gsexec GRST_CRED_0/SSL_CLIENT_S_DN bug found
- by Ian Stokes-Rees <i.stokes-rees1@PHYSICS.OX.AC.UK>
-* Fri Sep 30 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Add SiteCast ping (NOP) support to htcp
-* Thu Sep 29 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Add SiteCast support to mod_gridsite (file location
- discovery via UDP multicast of HTCP messages.)
-* Wed Sep 21 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Add ports 777 and 488 to example httpd.conf files in
- docs. See http://www.gridsite.org/wiki/IP_Ports
-* Tue Sep 13 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.12 ====
-* Tue Sep 13 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Fix bug #10031 submitted by Fabrizio Pacini
- <fabrizio.pacini@cern.ch> (invalid free in
- GRSTgaclAclLoadFile if ACL format not valid.)
-* Mon Sep 12 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Accept GRIDHTTP_ONETIME when passed in HTTP query
- (still overridden by a GRIDHTTP_ONETIME in a cookie.)
-* Sat Sep 10 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Fix problem with attempted upgrades to GridHTTP when
- already on the HTTP virtual server.
-* Fri Sep 9 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- GRST_DESTINATION_TRANSLATED and GRST_DESTINATION_PERM
- environment variables, for use with CGI-based COPY.
-- Rework GridHTTP (ex-Downgrade) code to store method
- and URI with permission, rather than credentials.
-- Restrict use of GridSiteOnetimesDir to main server.
-* Fri Aug 26 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Fix for HTTP PUT lack-of-truncation bug found by
- Mike Jones, and support for HTTP/WebDAV MOVE.
-- Add MOVE support to htcp and update htcp manpage.
-- Unset CURLOPT_SSL_VERIFYPEER in htcp etc when using
- --noverify option.
-* Fri Jun 10 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.11 ====
-* Fri Jun 10 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Tidy up gsexec vs GridSiteDiskMode
-* Fri Jun 10 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.10 ====
-* Wed Jun 8 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Add GridSiteDiskMode Apache directive to set file
- permissions.
-- Add GridSiteExecMethod and GridSiteUserGroup to
- configure suexec or extended gsexec functionality.
-* Thu Jun 2 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- HTML improvements for Bug #4083
-- Note that GridSite currently doesn't work with SHM
- SSL session cache, in httpd-*.conf and config guide.
-- Add GridSiteExecMethod for use with gsexec
-* Thu May 26 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Include gsexec, a drop-in replacement for suexec,
- which can do suexec execution of CGI programs or
- pool-account mapping based on client DN.
-* Tue May 24 2005 Shiv Kaushal <shiv@hep.man.ac.uk>
-- Add XACML support to GACL code in libgridsite.
-* Tue May 24 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.9 ====
-* Mon Apr 25 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Avoid build problems when using pre-0.9.7 OpenSSL
- (ie with Globus compatibility.)
-* Mon Apr 25 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.8 ====
-* Mon Feb 28 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Fix to GRSTgaclUndenyPerm in gridsite.h (bug #7135)
- from Marco Sottilaro <marco.sottilaro@datamat.it>
-* Mon Feb 28 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.7 ====
-* Thu Feb 24 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Add more sanity checking (signatures, dates, issuer,)
- holder) to VOMS attribute parser.
-* Mon Feb 21 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Add bugfix for Bug #6357 from Fabrizio Pacini
- <fabrizio.pacini@cern.ch> to fix delegation proxy
- cache names in OpenSSL 0.9.7.
-* Sun Feb 20 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Add basic VOMS support (signature checking not yet
- in) for X.509 Attribute Certificates.
-* Tue Feb 8 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.6 ====
-* Tue Feb 8 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Include GRSTx509MakeProxyFileName() and
- GRSTx509StringToChain() (code to used hashes in cached
- proxy file names.) Bug #6357
-- Change ordering of output proxy file produced by
- GRSTx509CacheProxy so proxy private key is the 2nd PEM
- encoded block (rather than at the end.) Bug #6365
-- Add libgridsite_globus[.so|.a] in preparation for
- separate Globus OpenSSL and system OpenSSL versions
-* Tue Feb 8 2005 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.5 ====
-* Tue Dec 14 2004 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Patch from Daniel Kouril <kouril@ics.muni.cz> to allow
- switching Globus vs system OpenSSL libraries/headers.
-* Tue Dec 14 2004 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.4 ====
-* Mon Nov 15 2004 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Back out of (most of) redone VOMS support for committing
- to JRA1 CVS.
-* Thu Oct 19 2004 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.3 ====
-* Thu Oct 19 2004 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Fix Bug #5203 from Martijn Steenbakkers <msteenba>
- by fixing GACLparseEntry in gridsite-gacl.h
-- Change to C style comments (mostly) in gridsite.h and
- gridsite-gacl.h (fixes part of Bug #4222 from
- <aleks@fys.uio.no>)
-- Fix Bug #4225 from <aleks@fys.uio.no> in
- GRSTgaclCredsFree()
-- Add GRSTx509CachedProxyFind() and findproxyfile
- command to allow proxies to be found in proxy cache
-- Change GRSTx509StoreProxy() to GRSTx509CacheProxy() for
- consistency with this and GRSTx509CachedProxyKeyFind()
-* Wed Oct 18 2004 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.2 ====
-* Tue Oct 19 2004 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Copy code from delegation prototype into grst_x509.c
- and include htproxyput.c and grst-delegation.c
- optional targets (which depend on gSOAP.)
-* Wed Oct 13 2004 Andrew McNab <Andrew.McNab@man.ac.uk>
-- Include per-file patch to GRSTgaclFileFindAclname:
- .gacl:FILENAME controls FILENAME if it exists.
-* Tue Jul 27 2004 Andrew McNab <Andrew.McNab@man.ac.uk>
-- ==== GridSite version 1.1.1 ====
-* Tue Jul 27 2004 Andrew McNab <mcnab@hep.man.ac.uk>
-- Include HTTP Downgrade support in htcp
-* Sat Jul 24 2004 Andrew McNab <mcnab@hep.man.ac.uk>
-- Include HTTP Downgrade support in mod_gridsite.
-* Thu Jul 22 2004 Andrew McNab <mcnab@hep.man.ac.uk>
-- Begin development version 1.1.x
-* Thu Jul 22 2004 Andrew McNab <mcnab@hep.man.ac.uk>
-- ==== GridSite version 1.1.0 ====
-* Mon Jul 19 2004 Andrew McNab <mcnab@hep.man.ac.uk>
-- Changes in line with EGEE SCM - most importantly
- the top level directory becomes org.gridsite.core
-* Mon Jul 19 2004 Andrew McNab <mcnab@hep.man.ac.uk>
-- ==== GridSite version 1.0.3 ====
-* Mon Jun 28 2004 Andrew McNab <mcnab@hep.man.ac.uk>
-- In GRSTx509CheckChain() and GRSTx509CompactCreds()
- we now accept the first cert in a chain as a CA
- even if it is X509v3 but without the CA bits set.
- (On the basis that the first chain is from the
- administrator-installed CA files store.)
-* Sun Jun 27 2004 Andrew McNab <mcnab@hep.man.ac.uk>
-- ==== GridSite version 1.0.2 ====
-* Sun Jun 27 2004 Andrew McNab <mcnab@hep.man.ac.uk>
-- Fix for Bug #2860 (so can now read DN Lists over
- HTTPS when have no user certificate if relevant
- .gacl gives <read> permission but not <list>)
-- Include gridsite-gacl.h mods from Daniel Kouril
- <kouril@ics.muni.cz> to fix faulty definitions
- of GACLnewEntry() and GACLnewAcl() and to make
- a legacy non-static GACLparseEntry() wrapper.
-* Thu Jun 17 2004 Andrew McNab <mcnab@hep.man.ac.uk>
-- Changes to mod_gridsite.h for Fedora Core 2 /
- Apache 2.0.49+ mod_ssl changes (mod_ssl-private.h)
-* Wed Jun 9 2004 Andrew McNab <mcnab@hep.man.ac.uk>
-- Incorporate EGEE CVS layout changes in production
- branch.
-* Wed Jun 9 2004 Andrew McNab <mcnab@hep.man.ac.uk>
-- ==== GridSite version 1.0.1 ====
-* Sun Dec 14 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- 1.0.0 is first full production release
- (development now in 1.1.x branch)
-* Sun Dec 14 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- ==== GridSite version 1.0.0 ====
-* Sat Dec 13 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Remove need for modified mod_ssl-gridsite: now
- mod_gridsite intercepts callbacks with wrappers.
-- Add GRSTx509NameCmp() which compares string reps of
- DNs across OpenSSL version changes (ie Email=)
-* Fri Dec 12 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- ==== GridSite version 0.9.11 ====
-* Thu Dec 11 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Simplify checking of cert/proxy chain in
- mod_ssl-gridsite: rely on mod_ssl/OpenSSL more.
-* Wed Dec 2 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- ==== GridSite version 0.9.10 ====
-* Tue Dec 1 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- GACL ignores leading/trailing spaces in values.
-* Sat Nov 29 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Better directory listing in htcp.
-- htcp now built as separate binary RPM.
-- gridsite-admin.cgi upload now redirects to same
- directory after upload (Bug #1939); allows
- optional new name for file (Request / Bug #1940);
- and has better checking of ../dir/file attacks.
-* Sat Nov 29 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- ==== GridSite version 0.9.8 ====
-* Thu Nov 27 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Shiv's updated GACL editor, with redirects.
-* Wed Nov 26 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Include Daniel Stenberg's roffit script to make
- HTML man pages for htcp and urlencode.
-- Various fixes found when installing GridPP WWW.
-* Wed Nov 26 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- ==== GridSite version 0.9.7 ====
-* Thu Nov 20 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Major updates to htcp (htrm/htls/htll)
-- GACL now recurses subdirectories when examining
- the DN List directories path.
-* Sat Nov 15 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- ==== GridSite version 0.9.6 ====
-* Fri Nov 14 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Function call fixes in grst-admin.cgi
-* Thu Nov 13 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Add htcp (curl-url-get reborn)
-* Thu Nov 13 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- ==== GridSite version 0.9.5 ====
-* Thu Nov 13 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- More grst-admin.cgi GACL updates from Shiv.
-- .gacl security improvements to grst-admin.cgi from
- Shiv Kaushal and Peter Moore.
-* Tue Nov 11 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- One RPM instead of three, with version from VERSION
-- Textarea for HTML/Text editing now 80 columns
-* Mon Nov 10 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Add delegation level and GridSiteGSIProxyLimit
- support.
-- Add GridSiteAdminList handling to mod_gridsite
- and real-gridsite-admin.cgi
-* Sun Nov 9 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Add directory create/delete, and file/dir rename.
-- Add ZIP listing/unzipping via external unzip
- utility from http://www.info-zip.org/pub/infozip/
-* Mon Nov 3 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Include next version of Shiv's GACL editor.
-- Add rpm-usr target to Makefile, to make RPMs
- out-of-the-box compatible with RH9 and its Apache2
-- Use REMOTE_DOUBLE_REV for GACL hostname creds in
- mod_gridsite.c/mod_gridsite_perm_handler()
-* Sun Oct 26 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Include GACL editor in real-gridsite-admin.cgi
- from Shiv Kaushal <shiv@hep.man.ac.uk>
-* Sun Oct 26 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Reorganise into a single build tree, including
- Apache 2.0 .h files to remove circular dependency.
-* Sun Oct 26 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- ==== GridSite version 0.9.4 ====
-* Sun Oct 19 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- Include many pieces of GridSite code from 0.3.x (CGI)
- fileGridSite and mod_gridsite 0.9.0
-* Sun Oct 19 2003 Andrew McNab <mcnab@hep.man.ac.uk>
-- ==== GridSite version 0.9.3 ====
+++ /dev/null
-BUILDING/INSTALLING GRIDSITE
-============================
-
-For more detailed instructions, see the Installation and Build
-pages in the GridSite Wiki http://www.gridsite.org/wiki/
-
-GridSite is currently only supported on Linux, but should be
-trivially portable to other Unix platforms where the GNU build
-tools are available.
-
-When building from source, two routes are available: building
-with Make or with RPM.
-
-BUILDING WITH MAKE
-==================
-
-make
-make install
-
-will build all components and install them all under the default
-locations of /usr/local/[lib|bin|include|sbin] The default prefix
-/usr/local is set by the prefix variable in the top level Makefile
-
-BUILDING WITH RPM
-=================
-
-For RedHat Linux and derivatives, building with RPM is recommended.
-The command
-
-make rpm
-
-will build the gridsite and htcp binary RPMs in the directory
-../RPMTMP/RPMS/i386 relative to the working directory. A SRPM is
-put into ../RPMTMP/SRPMS
-
-Building with RPM uses the default prefix /usr, although the
-resulting RPMs are relocatable to other hierarchies.
+++ /dev/null
-Copyright (c) 2002-5, Andrew McNab and Shiv Kaushal,
-University of Manchester. All rights reserved.
-
-Redistribution and use in source and binary forms, with or
-without modification, are permitted provided that the following
-conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-
-Clearly marked portions of the published GridSite source code
-are derived from Apache httpd or its modules, and are covered
-by the Apache Software License:
-
-Copyright 2001-2005 The Apache Software Foundation
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+++ /dev/null
-See INSTALL for build and installation instructions, and the
-man pages for reference information.
-
-The GridSite Wiki at http://www.gridsite.org/wiki/ has guides
-( http://www.gridsite.org/wiki/Category:Guides ) and cookbook
-examples ( http://www.gridsite.org/wiki/Category:Cookbooks )
+++ /dev/null
-MAJOR_VERSION=1
-MINOR_VERSION=1.1
-PATCH_VERSION=1.1.14
-VERSION=$(PATCH_VERSION)
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Build file for the Gridsite Core Subsystem
-
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.11 2005/02/16 14:14:39 dimeglio
- Added patch to use globus compilation flags also in the RPMS
-
- Revision 1.10 2004/12/17 09:11:43 dimeglio
- Added local tag targets (because of special naming rules here)
-
- Revision 1.9 2004/12/17 09:02:49 dimeglio
- Removed redefinition of global.prefix
-
- Revision 1.8 2004/12/17 00:32:50 dimeglio
- Fixed global.prefix
-
- Revision 1.7 2004/12/03 14:49:59 dimeglio
- Added OPENSSL_FLAGS and _LIBS options
-
- Revision 1.6 2004/11/13 10:55:44 glbuild
- Added artifacts RPMS directory
-
- Revision 1.5 2004/10/29 22:55:07 dimeglio
- Use envset target
-
- Revision 1.4 2004/10/28 23:00:14 dimeglio
- Removed post-subsystem entry
-
- Revision 1.3 2004/10/27 11:19:17 dimeglio
- Fixed i386 instead of 1386
-
- Revision 1.2 2004/10/27 11:18:38 dimeglio
- Use os.platform instead of hard-coded rhel30
-
- Revision 1.1 2004/10/26 17:54:24 dimeglio
- First version of this file
-
--->
-
-<project name="gridsite-core" default="dist">
-
- <description>
- Ant build file to build the Gridsite Core Component
- </description>
-
- <!-- =========================================
- Import properties (order is important)
- ========================================= -->
-
- <!-- Import baseline & user properties -->
- <import file="../org.glite/project/baseline.properties.xml" />
-
- <!-- Import subsystem build properties,
- subsystem properties &
- subsystem common properties -->
- <import file="./project/properties.xml" />
-
- <!-- Import global build properties and global properties -->
- <import file="${global.properties.file}" />
-
- <!-- =========================================
- Load dependencies properties files (order is important)
- ========================================= -->
- <property file="${user.dependencies.file}"/>
- <property file="${subsystem.dependencies.file}"/>
- <property file="${global.dependencies.file}"/>
-
- <!-- =========================================
- Load configure options
- ========================================= -->
- <import file="${global.configure.options.file}"/>
- <import file="${component.configure.options.file}"/>
-
- <!-- =========================================
- Import global task definitions
- ========================================= -->
- <import file="${global.taskdefs.file}" />
-
- <!-- =========================================
- Import global compiler definitions
- ========================================= -->
- <import file="${global.compilerdefs.file}" />
-
- <!-- =========================================
- Import targets
- ========================================= -->
- <import file="${global.targets-common.file}" />
-
- <!-- =========================================
- Load version file
- ========================================= -->
- <property file="${module.version.file}"/>
- <property file="${module.build.file}"/>
-
- <!-- ===============================================
- Public common targets
- =============================================== -->
-
- <target name="localinit" depends="envcheck">
- <mkdir dir="${stage.dir}" />
- <mkdir dir="${dist.dir}" />
- </target>
-
- <target name="init" depends="localinit">
- <echo>${global.prefix}</echo>
- </target>
-
- <target name="checkstyle" depends="init">
- </target>
-
- <target name="compile" depends="checkstyle">
- <if>
- <isset property="build.make.arguments"/>
- <then>
- <!-- Call make default compile target -->
- <make target="build" dir="${module.src.dir}" failonerror="${failonerror}" args="${build.make.arguments}"/>
- </then>
- <else>
- <!-- Call make default compile target -->
- <make target="build" dir="${module.src.dir}" failonerror="${failonerror}"/>
- </else>
- </if>
- </target>
-
- <target name="compiletest" depends="compile">
- </target>
-
- <target name="unittest" depends="compiletest">
- </target>
-
- <target name="unitcoverage" depends="unittest">
- </target>
-
- <target name="doc" depends="unitcoverage">
- </target>
-
- <target name="stage" depends="doc">
- <if>
- <isset property="build.make.arguments"/>
- <then>
- <!-- Call make default compile target -->
- <make target="install" dir="${module.src.dir}" failonerror="${failonerror}" args="${build.make.arguments}"/>
- </then>
- <else>
- <!-- Call make default compile target -->
- <make target="install" dir="${module.src.dir}" failonerror="${failonerror}"/>
- </else>
- </if>
- </target>
-
- <target name="dist" depends="stage">
- <make target="rpm" dir="${module.src.dir}" failonerror="${failonerror}" args="${build.make.arguments}"/>
- <exec dir="${module.dir}/RPMTMP/BUILDROOT/usr" executable="tar">
- <arg line="-czf ${module.dir}/gridsite-${module.version}_bin.tar.gz ." />
- </exec>
- <copy file="gridsite-${module.version}_bin.tar.gz" todir="${dist.dir}"/>
- <copy file="gridsite-${module.version}.src.tar.gz" tofile="${dist.dir}/gridsite-${module.version}_src.tar.gz"/>
- <copy todir="${dist.dir}/${os.platform}/i386/RPMS">
- <fileset dir="${module.dir}/RPMTMP/RPMS/i386">
- <include name="*.rpm"/>
- </fileset>
- </copy>
- <delete dir="${module.dir}/RPMS"/>
- <mkdir dir="${module.dir}/RPMS"/>
- <copy todir="${module.dir}/RPMS">
- <fileset dir="${module.dir}/RPMTMP/RPMS/i386">
- <include name="*.rpm"/>
- </fileset>
- </copy>
- <delete>
- <fileset dir="${module.dir}">
- <include name="*.tar.gz"/>
- </fileset>
- </delete>
- <delete dir="RPMTMP"/>
- </target>
-
- <target name="install" depends="localinit">
- <make target="install" dir="${module.src.dir}" failonerror="${failonerror}"/>
- </target>
-
- <target name="all" depends="dist">
- </target>
-
- <target name="clean" depends="envcheck">
- <property name="offline.repository" value="true" />
- <make target="clean" dir="${module.src.dir}" failonerror="false"/>
- <delete dir="${module.dir}/src/doxygen"/>
- <delete>
- <fileset dir="${module.dir}/src">
- <include name="*.o"/>
- <include name="*.so"/>
- <include name="*.so.*"/>
- <include name="*.a"/>
- <include name="rm -rf urlencode"/>
- </fileset>
- </delete>
- <delete dir="${module.dir}/RPMS"/>
- </target>
-
- <target name="cleanAll" depends="clean"/>
-
- <!-- ===============================================
- Private targets
- =============================================== -->
-
- <!-- ========================================================
- tag: Tag module
- ======================================================== -->
- <target name="tag" description="Apply tag.">
-
- <property name="tag.type" value="B"/>
- <!-- Set module CVS Label -->
- <exec executable="tr" inputstring="${module.version}" outputproperty="cvs.module.version">
- <arg line=". _"/>
- </exec>
- <property name="cvs.label" value="gridsite-core_${tag.type}_${cvs.module.version}_${module.build}" />
- <echo>New tag is ${cvs.label}</echo>
-
- <!-- Apply tag -->
- <property name="failonerror" value="true"/>
- <property name="tag.switch" value="-FR"/>
- <exec dir="${workspace.abs.dir}" executable="cvs" failonerror="${failonerror}">
- <arg line="tag ${tag.switch} ${cvs.label} ${module.name}" />
- </exec>
-
- </target>
-
- <target name="component_release_tag">
-
- <!-- Set module CVS Label -->
- <exec executable="tr" inputstring="${module.version}" outputproperty="cvs.module.version">
- <arg line=". _"/>
- </exec>
- <property name="cvs.label" value="gridsite-core_R_${cvs.module.version}" />
- <echo>New tag is ${cvs.label}</echo>
-
- <!-- Apply tag -->
- <exec dir="${workspace.abs.dir}" executable="cvs" failonerror="true">
- <arg line="tag -R ${cvs.label} ${module.name}" />
- </exec>
-
- </target>
-
- <!-- ===============================================
- Modules proxy targets
- =============================================== -->
-
- <!-- component targets definitions tag = do not remove = -->
-
-
- <!-- Main proxy -->
- <target name="buildmodules" depends="envset"/>
-
-</project>
-
+++ /dev/null
-Binaries (and links) are in ./bin; man pages are in ./man/man1
-
-Install by copying binaries/links onto your path, or by copying htcp
-and making symbolic links to htcp from htls, htll, htrm and htmkdir.
-
-All the .1 man pages should be copied to a suitable ./man/man1
-directory on your man path.
-
-If you just want to install htcp in /usr/local, then unpacking this
-tgz file in /usr/local should do the trick. (Delete this README when
-you're finished!)
-
-For more about htcp see http://www.gridsite.org/
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (c) 2002-3, Andrew McNab, University of Manchester
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or
-# without modification, are permitted provided that the following
-# conditions are met:
-#
-# o Redistributions of source code must retain the above
-# copyright notice, this list of conditions and the following
-# disclaimer.
-# o Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials
-# provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-#---------------------------------------------------------------
-# For more information about GridSite: http://www.gridsite.org/
-#---------------------------------------------------------------
-#
-# This script takes an Apache .tar.gz as the single command line argument,
-# unpacks the file, modifies the httpd.spec it contains to work without
-# the "-C" option to configure (which RedHat 7.3 doesnt like) and
-# outputs source and binary RPMs in SRPMS and RPMS/i386
-
-if [ "$1" = "" ] ; then
- echo Must give a tar.gz file name
- exit
-fi
-
-export MYTOPDIR=`pwd`
-
-if [ -x /usr/bin/rpmbuild ] ; then
- export RPMCMD=rpmbuild
-else
- export RPMCMD=rpm
-fi
-
-echo "$1" | grep '\.tar\.gz$' >/dev/null 2>&1
-if [ $? = 0 ] ; then # a gzipped source tar ball
-
- rm -Rf $MYTOPDIR/BUILD $MYTOPDIR/BUILDROOT $MYTOPDIR/SOURCES
- mkdir -p $MYTOPDIR/SOURCES $MYTOPDIR/SPECS $MYTOPDIR/BUILD \
- $MYTOPDIR/SRPMS $MYTOPDIR/RPMS/i386 $MYTOPDIR/BUILDROOT
-
- shortname=`echo $1 | sed 's:^.*/::' | sed 's:\.tar\.gz$::'`
-
- cp -f $1 SOURCES
-
- tar zxvf SOURCES/$shortname.tar.gz $shortname/httpd.spec
- cp -f $shortname/httpd.spec SPECS
-
- sed -e 's/configure -C /configure /' \
- SPECS/httpd.spec >SPECS/httpd-2.spec
-
- $RPMCMD --define "_topdir $MYTOPDIR" \
- -ba --buildroot $MYTOPDIR/BUILDROOT SPECS/httpd-2.spec
-
- exit
-fi
-
-echo I dont recognise the file type (must be .tar.gz)
-
-exit
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<definitions
- targetNamespace="http://www.gridsite.org/namespaces/delegation-1"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://www.gridsite.org/namespaces/delegation-1"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <types>
- <schema
- targetNamespace="http://www.gridsite.org/namespaces/delegation-1"
- xmlns="http://www.w3.org/2001/XMLSchema">
- <complexType name="DelegationException">
- <sequence>
- <element name="message" nillable="true" type="xsd:string"/>
- </sequence>
- </complexType>
- </schema>
- </types>
-
- <message name="getProxyReqResponse">
- <part name="getProxyReqReturn" type="xsd:string"/>
- </message>
- <message name="getProxyReqRequest">
- <part name="delegationID" type="xsd:string"/>
- </message>
-
- <message name="DelegationException">
- <part name="fault" type="tns:DelegationException"/>
- </message>
-
- <message name="putProxyResponse"/>
- <message name="putProxyRequest">
- <part name="delegationID" type="xsd:string"/>
- <part name="proxy" type="xsd:string"/>
- </message>
-
- <portType name="Delegation">
- <operation name="getProxyReq" parameterOrder="delegationID">
- <documentation>
- Starts the delegation procedure by asking for a certificate
- signing request from the server. The server answers with a
- certificate signing request which includes the public key
- for the new delegated credentials. Uses PEM encoding.
- </documentation>
- <input message="tns:getProxyReqRequest" name="getProxyReqRequest"/>
- <output message="tns:getProxyReqResponse" name="getProxyReqResponse"/>
- <fault message="tns:DelegationException" name="DelegationException"/>
- </operation>
-
- <operation name="putProxy" parameterOrder="delegationID proxy">
- <documentation>
- Finishes the delegation procedure by sending the signed
- proxy certificate to the server. Uses PEM encoding.
- </documentation>
- <input message="tns:putProxyRequest" name="putProxyRequest"/>
- <output message="tns:putProxyResponse" name="putProxyResponse"/>
- <fault message="tns:DelegationException" name="DelegationException"/>
- </operation>
- </portType>
-
- <binding name="DelegationSoapBinding" type="tns:Delegation">
- <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <operation name="getProxyReq">
- <wsdlsoap:operation soapAction=""/>
- <input name="getProxyReqRequest">
- <wsdlsoap:body namespace="http://www.gridsite.org/namespaces/delegation-1" use="literal"/>
- </input>
- <output name="getProxyReqResponse">
- <wsdlsoap:body namespace="http://www.gridsite.org/namespaces/delegation-1" use="literal"/>
- </output>
- <fault name="DelegationException">
- <wsdlsoap:fault name="DelegationException" use="literal"/>
- </fault>
- </operation>
-
- <operation name="putProxy">
- <wsdlsoap:operation soapAction=""/>
- <input name="putProxyRequest">
- <wsdlsoap:body namespace="http://www.gridsite.org/namespaces/delegation-1" use="literal"/>
- </input>
- <output name="putProxyResponse">
- <wsdlsoap:body namespace="http://www.gridsite.org/namespaces/delegation-1" use="literal"/>
- </output>
- <fault name="DelegationException">
- <wsdlsoap:fault name="DelegationException" use="literal"/>
- </fault>
- </operation>
- </binding>
-
-</definitions>
+++ /dev/null
-.TH findproxyfile 1 "October 2004" "findproxyfile" "GridSite Manual"
-.SH NAME
-.B findproxyfile
-\- returns full path to GSI Proxy file
-.SH SYNOPSIS
-.B findproxyfile
-[--proxycache=PATH] [--delegation-id=ID] [--user-dn=DN] [--outsidecache]
-.SH DESCRIPTION
-.B findproxyfile
-returns full path to a GSI Proxy file, either in the proxy cache maintained
-by the GridSite G-HTTPS and delegation portType functions, or in other
-standard places.
-
-If a User DN is given
-.B findproxyfile
-uses the value of the
-.B --proxycache
-argument, the GRST_PROXY_PATH or the
-compile time default to detemine the location of the proxy cache directory.
-The directory is searched for a proxy having the given User DN and
-Delegation ID. (If no Delegation ID is specificed, then the default value is
-used.)
-
-If
-.B findproxyfile
-does not find a proxy or if a User DN is not given, but
-.B --outsidecache
-was given, then the environment variable X509_USER_PROXY and the standard
-location /tmp/x509up_uUID are searched as well.
-
-.SH OPTIONS
-
-.IP "--proxycache=PATH"
-Give the path of the proxy cache directory explicitly, overriding the
-default and the GRST_PROXY_PATH environment variable if present.
-
-.IP "--delegation-id=ID"
-The optional delegation ID is search for in the proxy cache in addition to
-the User DN. If absent, the default Delegation ID value is searched for.
-
-.IP "--user-dn=DN"
-The DN of the full user certificate associated with the proxy to be searched
-for in the proxy cache. (This is not the DN of any proxy earlier in the
-chain: it is a the DN of a certificate issued by a recognised CA.)
-
-.IP "--outsidecache"
-If a User DN is not given, or a proxy not found in the cache, then search
-for a proxy using X509_USER_PROXY environment variable and file name of
-form /tmp/x509up_uUID as well.
-
-.SH RETURN VALUE
-If a proxy is found, its full path is output on standard out.
-
-.SH EXIT CODES
-0 is returned on succcess. Non-zero otherwise.
-
-.SH BUGS
-In this version, no attempt is made to verify or validate the proxies.
-
-.SH AUTHOR
-Andrew McNab <Andrew.McNab@man.ac.uk>
-
-findproxyfile is part of GridSite: http://www.gridsite.org/
+++ /dev/null
-.TH GSEXEC 8 "October 2005" "gsexec" "GridSite Manual"
-.SH NAME
-.B gsexec
-\- Switch user before executing external programs
-
-.SH "SYNOPSIS"
-
-.BR gsexec
-[-V]
-
-.SH "SUMMARY"
-
-gsexec is used by the Apache HTTP Server to switch to another user before
-executing CGI programs\&. In order to achieve this, it must run as root\&.
-Since the HTTP daemon normally doesn't run as root, the gsexec executable
-needs the setuid bit set and must be owned by root\&. It should never be
-writable for any other person than root\&.
-
-gsexec is based on Apache's suexec, and its behaviour is controlled with
-the Apache configuration file directives
-.BR GridSiteExecMethod
-and
-.BR GridSiteUserGroup
-added to Apache by
-.BR mod_gridsite(8)
-Four execution methods are supported: nosetuid, suexec, X509DN and directory,
-and these may be set on a per-directory basis within the Apache configuration
-file.
-
-.SH "NOSETUID METHOD"
-
-This is the default behaviour, but can also be produced by giving
-.BR "GridSiteExecMethod nosetuid"
-
-CGI programs will then be executed without using gsexec, and will
-run as the Unix user given by the User and Group Apache directives (normally
-apache.apache on Red Hat derived systems.)
-
-.SH "SUEXEC METHOD"
-
-If
-.BR "GridSiteExecMethod suexec"
-is given for this virtual host or directory, then CGI programs will be
-executed using the user and group given by the
-.BR "GridSiteUserGroup user group"
-directive, which may also be set on a per-directory basis (unlike suexec's
-.BR SuexecUserGroup
-which is per-server only.) The CGI program must either be owned by root,
-the Apache user
-and group specified at gsexec build-time (normally apache.apache) or by
-the user and group given with the
-.BR GridSiteUserGroup
-directive.
-
-.SH "X509DN METHOD"
-
-If
-.BR "GridSiteExecMethod X509DN"
-is given, then the CGI program runs as a pool user, detemined using lock
-files in the exec mapping directory chosen as build time of gsexec.
-The pool user is chosen according
-to the client's full certificate X.509 DN (ie with any trailing GSI proxy
-name components stripped off.) Subsequent requests by the same X.509
-identity will be mapped to the same pool user. The CGI program must either be
-owned by root, the Apache user
-and group specified at gsexec build-time (normally apache.apache) or by
-the pool user selected.
-
-.SH "DIRECTORY METHOD"
-
-If
-.BR "GridSiteExecMethod directory"
-is given, then the CGI program runs as a pool user chosen according
-to the directory in which the CGI is located: all CGIs in that directory
-run as the same pool user. The CGI program must either be
-owned by root, the Apache user
-and group specified at gsexec build-time (normally apache.apache) or by
-the pool user selected.
-
-
-.SH "EXECMAPDIR"
-
-The default exec mapping directory is /var/www/execmapdir and this is fixed
-when the gsexec executable is built. The exec mapping directory and all
-of its lock files must be owned and only writable by root. To initialise the
-lock files, create an empty lock file for each pool user, with the pool
-username as the filename (eg user0001, user0002, ...) As the pool users are
-leased to X.509 identities or directories, they will become hard linked to
-lock files with the URL-encoded X.509 DN or full directory path.
-
-You can recycle pool users by removing the corresponding URL-encoded
-hard link.
-.BR stat(1)
-and
-.BR "ls(1)"
-with option
-.BR "-i"
-can be used to print the inodes of lock files to match up the hard links.
-
-.BR "However, you must ensure that all files and processes owned by the pool"
-.BR "user are deleted before recycling!"
-
-.SH "OPTIONS"
-
-.TP
--V
-If you are root, this option displays the compile options of gsexec\&.
-For security reasons all configuration options are changeable only at
-compile time\&.
-
-.SH "MORE INFORMATION"
-For further information about the concepts and the security model of
-the original Apache suexec
-please refer to the suexec documentation:
-
-http://httpd\&.apache\&.org/docs-2\&.0/suexec\&.html
-
-For examples using the gsexec extensions, please see the GridSite gsexec
-page:
-
-http://www.gridsite.org/wiki/Gsexec
-
-.SH AUTHORS
-
-Apache project, for original suexec
-
-Andrew McNab <Andrew.McNab@manchester.ac.uk> for gsexec modifications.
-
-gsexec is part of GridSite: http://www.gridsite.org/
-
-.SH "SEE ALSO"
-.BR httpd(8),
-.BR suexec(8),
-.BR mod_gridsite(8)
+++ /dev/null
-.TH HTCP 1 "October 2005" "htcp" "GridSite Manual"
-.SH NAME
-.B htcp, htmv, htrm, htls, htll, htmkdir, htfind, htping
-\- file transfers and queries via HTTP/HTTPS/SiteCast
-.SH SYNOPSIS
-.B htcp, htmv
-[options] Source-URL[s] Destination-URL
-
-.B htrm, htls, htll, htmkir, htfind
-[options] Target-URL[s]
-
-.B htping
-[options]
-.SH DESCRIPTION
-.B htcp
-is a client to fetch files or directory listings from remote servers using
-HTTP or HTTPS, or to put or delete files or directories onto remote servers
-using HTTPS. htcp is similar to scp(1), but uses HTTP/HTTPS rather than ssh
-as its transfer protocol. htcp can also use the HTCP protocol to query
-HTTP(S) fileservers via SiteCast.
-
-When talking to a fileserver with HTTPS, htcp can run "anonymously", with a
-standard X.509 user certificate and key, or with a GSI Proxy. This makes
-htcp very useful in Grid environments where many users have certificates
-and where jobs and users have access to GSI proxies.
-
-.SH URLs
-htcp supports the file:, http: and https: URL schemes as sources and
-destinations. If no scheme is given, the URL scheme is assumed to be file:
-and relative to the current directory if not an absolute path.
-
-If multiple sources are given during a copy, they will be used in turn and
-the destination must be a directory (directories are indicated by a trailing
-/) However, source and destination cannot both refer to remote servers.
-
-.SH OPTIONS
-.IP "-v/--verbose"
-Turn on debugging information. Used once, this option will enable htcp's
-messages to stderr. Used twice, will also enable the underlying libcurl
-messages.
-
-.IP "--delete"
-Instead of copying files, delete all the URLs given on the command line.
-Calling the program as htrm has the same effect.
-
-.IP "--list"
-Instead of copying files, output lists of files located in the URL-directories
-given on the command line. Calling the program as htls has the same effect.
-
-.IP "--long-list"
-Instead of copying files, output long listings of files located in the
-URL-directories given on the command line. If available, the size in bytes
-and modification time of each file is given. Calling the program as
-htll has the same effect.
-
-.IP "--mkdir"
-Instead of copying files, attempt to create a directory on a remote server
-with HTTP PUT. The server must support the convention that PUT to a URL with
-a trailing slash means create a directory. No file body is sent. Calling the
-program as htmkdir has the same effect.
-
-.IP "--move"
-Move/rename files on a single remote server, given the two, absolute URLs
-of the remote file names. Server must support HTTP/WebDAV MOVE. Calling the
-program as htmv has the same effect.
-
-.IP "--ping"
-Query specified multicast groups with the HTCP NOP ("No Operation") code.
-SiteCast enabled servers will respond immediately with a NOP reply, and all
-of the responses will be listed, with the round trip time in milliseconds.
-Any waiting times specified in the --groups option will be ignored. Calling
-the program as htping has the same effect.
-(--groups must be used for this option to work.)
-
-.IP "--find"
-Query specified multicast groups with the HTCP TST code. SiteCast enabled
-servers will respond with TST replies if they have the files corresponding
-to the given SiteCast target URL(s). All of the transfer URLs returned
-will be listed. Waiting times specified in the --groups option will be used
-to space out the multicast queries, but the program listens for responses
-continuously. Calling the program as htfind has the same effect.
-(--groups must be used for this option to work.)
-
-.IP "--groups <IP Groups>"
-IP multicast groups to use for SiteCast queries. IP Groups is a comma
-separated list of groups, in the format: nnn.nnn.nnn.nnn:port[:ttl[:seconds]]
-The IP number and port must be specified. The IP time-to-live, ttl, controls
-how many networks the multicast packets may pass through - the default, 1,
-limits packets to the local network. Multiple groups may be specified,
-separated by commas. If multiple groups are specified, then seconds is the
-time to wait before making the next multicast - 1 second is the default.
-
-.IP "--timeout <seconds>"
-A request timeout used for multicast ping.
-
-.IP "--anon"
-Do not attempt to use X.509 user certificates or GSI proxies to authenticate
-to the remote HTTPS server. This means you are "anonymous", but the server's
-identity may still be verified and the connection is still encrypted.
-
-.IP "--cert <X.509 cert path> and --key <X.509 key path>"
-Path to the PEM-encoded
-X.509 or GSI Proxy user certificate and key to use for HTTPS
-connections, intead of "anonymous mode." If only one of --key or --cert
-is given, then that will be tried for both. If neither is given, then the
-following order of precedence is used:
-the file name held by the variable X509_USER_PROXY; the file
-/tmp/x509up_uID (with Unix UID equal to ID); the file names held by
-X509_USER_CERT / X509_USER_KEY; the files ~/.globus/usercert.pem and
-~/.globus/userkey.pem (where ~/ is the home directory of the user.)
-
-.IP "--capath <X.509 CA root certs directory or file>"
-Path to the PEM-encoded CA root certificates to use when
-verifying remote servers' host certificates in HTTPS connections. Ideally
-this should be a directory of hash.0 files as described in the OpenSSL
-verify(1) man page, but a file may be used instead. If --capath is not
-given, the value of the environment variable X509_CERT_DIR will be tried.
-If this is not valid, then /etc/grid-security/certificates will be used.
-
-.IP "--no-verify"
-Do not use CA root certificates to verify remote servers' host certificates.
-This is useful for testing sites before their certificate is set up properly,
-but leaves you vulnerable to "man in the middle" attacks by hostile servers
-masquerading as your target.
-
-.IP "--grid-http"
-Try to use GridHTTP redirection for HTTPS URLs. Compatible servers will perform
-authentication and authorization on the HTTPS connection and then redirect
-to HTTP for the GET or PUT file transfer. htcp makes the HTTP request using
-the GRID_AUTH_ONETIME single-use passcode obtained via HTTPS. The --grid-http
-option will be ignored for directory operations or HTTP URLs. If a redirected
-transfer isn't possible, a normal HTTPS data transfer will be attempted.
-
-.IP "--sitecast"
-Try to use SiteCast to locate remote files which are to be copied (currently
-only for the
-.BR fetching
-of remote files.) If no location is found via SiteCast, then a direct request
-for the given URL is tried. (--groups must be used for this option to work.)
-
-.IP "--domain <SiteCast domain>"
-Try to use SiteCast to locate remote files which are to be copied (currently
-only for the
-.BR fetching
-of remote files)
-.BR "if the domain component of the URL matches"
-the SiteCast domain given.
-If no location is found via SiteCast, then a direct request
-for the given URL is tried. (--groups must be used for this option to work.)
-
-.SH FILES
-.IP /tmp/x509up_uID
-Default GSI Proxy file for Unix UID equal to ID.
-
-.IP /etc/grid-security/certificates
-Default location for trusted Certification Authority root certificates to use
-when checking server certificates.
-
-.IP /tmp/.ca-roots-XXXXXX
-Prior to 7.9.8, the underlying curl library did not support the CA root
-certificates directory.
-If built with an old version of libcurl, htcp will concatenate the
-certificates in the CA roots directory into a unique temporary file and use
-that.
-
-.SH ENVIRONMENT
-
-.IP X509_CERT_DIR
-Holds directory to search for Certification Authority root certificates when
-verifying server certificates. (Tried if --capath is not given on the
-command line.)
-
-.IP X509_USER_PROXY
-Holds file name of a GSI Proxy to use as user certificate. (Tried if --cert or
---key are not given on the command line.)
-
-.IP "X509_USER_CERT and X509_USER_KEY"
-Holds file name of X.509 user certificate and key. (Tried if X509_USER_PROXY
-is not valid.)
-
-.SH EXIT CODES
-0 is returned on complete success. Curl error codes are returned when
-reported by the underlying curl library, and CURLE_HTTP_RETURNED_ERROR (22)
-is returned when the HTTP(S) server returns a code outside the range 200-299.
-The manpage libcurl-errors(3) lists all the curl error codes.
-
-.SH TO DO
-Recursive copying. Server-side wildcards. Parallel streams. Better error
-recovery.
-
-.SH AUTHOR
-Andrew McNab <Andrew.McNab@manchester.ac.uk>
-
-htcp is part of GridSite: http://www.gridsite.org/
-.SH "SEE ALSO"
-.BR scp(1),
-.BR curl(1),
-.BR wget(1),
-.BR verify(1),
-.BR libcurl-errors(3)
+++ /dev/null
-.so man1/htcp.1
+++ /dev/null
-.so man1/htcp.1
+++ /dev/null
-.so man1/htcp.1
+++ /dev/null
-.so man1/htcp.1
+++ /dev/null
-.so man1/htcp.1
+++ /dev/null
-.so man1/htcp.1
+++ /dev/null
-.so man1/htcp.1
+++ /dev/null
-##############################################################################
-## GridSite httpd-fileserver.conf - Andrew McNab <Andrew.McNab@man.ac.uk>
-##
-## For GridSite documentation, see http://www.gridsite.org/
-##
-## Example configuration file for GridSite as an HTTP(S) fileserver,
-## listening on ports 80/777 (HTTP) and 443/488 (HTTPS)
-##
-## (777/488 is to allow firewalls to distinguish between Grid and
-## Web HTTP(S) traffic. See http://www.gridsite.org/wiki/IP_Ports )
-##
-## This file should be renamed /etc/httpd/conf/httpd.conf and Apache
-## restarted to use Apache2/GridSite as a simple HTTP(S) fileserver.
-##
-## You do not need to install the GridSite mod_ssl.so module if you
-## do not wish to use Globus Proxies or VOMS attributes, but you must
-## have the mod_gridsite.so in /usr/lib/httpd/modules
-##
-## We're assuming you have (a) the host's hostcert.pem and hostkey.pem
-## in /etc/grid-security/ and (b) the Certification Authorities' you
-## trust have their root certs in /etc/grid-security/certificates
-##
-## (You can get RPMs for many European and North American Grid CAs
-## from https://datagrid.in2p3.fr/distribution/datagrid/security/ )
-##
-## If you want to use DN Lists in ACLs, they should be placed/downloaded
-## in /etc/grid-security/dn-lists/
-##
-## To start serving files, make a directory /var/www/htdocs owned by
-## apache.apache, including the file .gacl containing:
-##
-## <gacl>
-## <entry>
-## <any-user/>
-## <allow><read/><list/></allow>
-## </entry>
-## </gacl>
-##
-## To enable writing, add DN List, Person or VOMS entries to the GACL
-## (see the GridSite GACL document for the syntax.) For example:
-##
-## <gacl>
-## <entry>
-## <any-user/>
-## <allow><read/><list/></allow>
-## </entry>
-## <entry>
-## <person>
-## <dn>/C=UK/O=eScience/OU=Manchester/L=HEP/CN=Andrew McNab</dn>
-## </person>
-## <allow><write/></allow>
-## </entry>
-## </gacl>
-##
-## and add the following directive to the HTTPS <Directory> section:
-##
-## GridSiteMethods GET PUT DELETE MOVE
-##
-## If you wish to accept Globus GSI Proxies as well as full X.509 user
-## certificates, set GridSiteGSIProxyLimit to the depth of proxy you
-## wish to accept.
-##
-## (As a _rough_ guide: 0=No Proxies; 1=Proxy on user's machine; 2=Proxy
-## owned by running Globus job; 3=Proxy delegated by a Globus job.)
-##
-## With this done and Apache restarted, you can upload a file with:
-##
-## curl -v --cert ~/.globus/usercert.pem --key ~/.globus/userkey.pem \
-## --capath /etc/grid-security/certificates --upload-file /tmp/tmp.txt \
-## https://INSERT.HOSTNAME.HERE/tmp.txt
-##
-## (or with --cert /tmp/x509up_u`id -u` --key /tmp/x509up_u`id -u` to use
-## a Globus GSI Proxy created with grid-proxy-init.)
-##
-##############################################################################
-
-ServerRoot "/etc/httpd"
-
-PidFile logs/httpd.pid
-
-Timeout 300
-KeepAlive On
-MaxKeepAliveRequests 100
-KeepAliveTimeout 15
-
-LoadModule log_config_module /usr/lib/httpd/modules/mod_log_config.so
-LoadModule ssl_module /usr/lib/httpd/modules/mod_ssl.so
-LoadModule gridsite_module /usr/lib/httpd/modules/mod_gridsite.so
-LoadModule mime_module /usr/lib/httpd/modules/mod_mime.so
-LoadModule dir_module /usr/lib/httpd/modules/mod_dir.so
-
-TypesConfig /etc/mime.types
-
-# User and group who will own files created by Apache
-User apache
-Group apache
-
-DocumentRoot "/var/www/htdocs"
-
-<Directory />
- AllowOverride None
-</Directory>
-
-LogLevel debug
-LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
-
-CustomLog logs/httpd-gridsite-access combined
-ErrorLog logs/httpd-gridsite-errors
-
-HostnameLookups On
-
-######################################################################
-# Plain unauthenticated HTTP on ports 80 and 777
-######################################################################
-
-Listen 80
-Listen 777
-<VirtualHost *:80 *:777>
-
-<Directory "/var/www/htdocs">
- GridSiteIndexes on
- GridSiteAuth on
- GridSiteDNlists /etc/grid-security/dn-lists/
-</Directory>
-
-</VirtualHost>
-
-######################################################################
-# Secured and possibly authenticated HTTPS on ports 443 and 488
-######################################################################
-Listen 443
-Listen 488
-SSLSessionCacheTimeout 300
-SSLSessionCache shm:/var/cache/mod_ssl/shm_cache
-
-<VirtualHost *:443 *:488>
-
-SSLEngine on
-SSLCertificateFile /etc/grid-security/hostcert.pem
-SSLCertificateKeyFile /etc/grid-security/hostkey.pem
-SSLCACertificatePath /etc/grid-security/certificates
-#SSLCARevocationPath YOUR CRL DIRECTORY WOULD GO HERE
-SSLVerifyClient optional
-SSLVerifyDepth 10
-SSLOptions +ExportCertData +StdEnvVars
-
-<Directory "/var/www/htdocs">
- GridSiteIndexes on
- GridSiteAuth on
- GridSiteDNlists /etc/grid-security/dn-lists/
- GridSiteGSIProxyLimit 0
-# GridSiteMethods GET PUT DELETE MOVE
-</Directory>
-
-</VirtualHost>
+++ /dev/null
-##############################################################################
-## GridSite httpd-webserver.conf - Andrew McNab <Andrew.McNab@man.ac.uk>
-##
-## For GridSite documentation, see http://www.gridsite.org/
-##
-## Example configuration file for GridSite as a Web Server
-## (that is, primarily for interactive use with a browser.)
-## Listening is on ports 80/777 (HTTP) and 443/488 (HTTPS).
-##
-## (777/488 is to allow firewalls to distinguish between Grid and
-## Web HTTP(S) traffic. See http://www.gridsite.org/wiki/IP_Ports )
-##
-## This file should be renamed /etc/httpd/conf/httpd.conf and Apache
-## restarted to use Apache2/GridSite as a webserver.
-##
-## You do not need to install the GridSite mod_ssl.so module if you
-## do not wish to use Globus Proxies or VOMS attributes, but you must
-## have the mod_gridsite.so in /usr/lib/httpd/modules
-##
-## We're assuming you have (a) the host's hostcert.pem and hostkey.pem
-## in /etc/grid-security/ and (b) the Certification Authorities' you
-## trust have their root certs in /etc/grid-security/certificates
-##
-## (You can get RPMs for many European and North American Grid CAs
-## from https://datagrid.in2p3.fr/distribution/datagrid/security/ )
-##
-## If you want to use DN Lists in ACLs, they should be placed/downloaded
-## in /etc/grid-security/dn-lists/ or /var/www/htdocs/dn-lists/
-## (Lists in /etc/grid-security/dn-lists/ override lists elsewhere.)
-##
-## To start serving files, make a directory /var/www/htdocs owned by
-## apache.apache, including the file .gacl containing:
-##
-## <gacl>
-## <entry>
-## <any-user/>
-## <allow><read/><list/></allow>
-## </entry>
-## </gacl>
-##
-## To enable writing, add DN List, Person or VOMS entries to the GACL
-## (see the GridSite GACL document for the syntax.) For example:
-##
-## <gacl>
-## <entry>
-## <any-user/>
-## <allow><read/><list/></allow>
-## </entry>
-## <entry>
-## <person>
-## <dn>/C=UK/O=eScience/OU=Manchester/L=HEP/CN=Andrew McNab</dn>
-## </person>
-## <allow><write/></allow>
-## </entry>
-## </gacl>
-##
-## and add the following directive to the HTTPS <Directory> section:
-##
-## GridSiteMethods GET PUT DELETE MOVE
-##
-## If you wish to accept Globus GSI Proxies as well as full X.509 user
-## certificates, set GridSiteGSIProxyLimit to the depth of proxy you
-## wish to accept.
-##
-## (As a _rough_ guide: 0=No Proxies; 1=Proxy on user's machine; 2=Proxy
-## owned by running Globus job; 3=Proxy delegated by a Globus job.)
-##
-## With this done and Apache restarted, you can upload a file with:
-##
-## curl -v --cert ~/.globus/usercert.pem --key ~/.globus/userkey.pem \
-## --capath /etc/grid-security/certificates --upload-file /tmp/tmp.txt \
-## https://INSERT.HOSTNAME.HERE/tmp.txt
-##
-## (or with --cert /tmp/x509up_u`id -u` --key /tmp/x509up_u`id -u` to use
-## a Globus GSI Proxy created with grid-proxy-init.)
-##############################################################################
-
-ServerRoot "/etc/httpd"
-
-## You MUST put your server's fully qualified domain name here
-## This, the DOMAIN part of the https://DOMAIN/... URLs you want
-ServerName FULL.SERVER.NAME
-
-PidFile logs/httpd.pid
-
-Timeout 300
-KeepAlive On
-MaxKeepAliveRequests 100
-KeepAliveTimeout 15
-
-LoadModule log_config_module /usr/lib/httpd/modules/mod_log_config.so
-LoadModule ssl_module /usr/lib/httpd/modules/mod_ssl.so
-LoadModule gridsite_module /usr/lib/httpd/modules/mod_gridsite.so
-LoadModule mime_module /usr/lib/httpd/modules/mod_mime.so
-LoadModule dir_module /usr/lib/httpd/modules/mod_dir.so
-LoadModule alias_module /usr/lib/httpd/modules/mod_alias.so
-LoadModule cgi_module /usr/lib/httpd/modules/mod_cgi.so
-
-TypesConfig /etc/mime.types
-
-# User and group who will own files created by Apache
-User apache
-Group apache
-
-DocumentRoot "/var/www/htdocs"
-
-<Directory />
- AllowOverride None
-</Directory>
-
-LogLevel debug
-LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
-
-CustomLog logs/httpd-gridsite-access combined
-ErrorLog logs/httpd-gridsite-errors
-
-HostnameLookups On
-
-######################################################################
-# Plain unauthenticated HTTP on ports 80 and 777
-######################################################################
-
-Listen 80
-Listen 777
-<VirtualHost *:80 *:777>
-
-## This is used to serve the Manage Directory links in footers,
-## and to allow you to edit files and ACLs via your browser.
-ScriptAlias /real-gridsite-admin.cgi /usr/sbin/real-gridsite-admin.cgi
-
-<Directory "/var/www/htdocs">
- ## This sets up GACL authorization for this server.
- GridSiteAuth on
-
- ## This exports various bits of info into the CGI environment
- ## variables (and is needed for gridsite-admin.cgi to work.)
- GridSiteEnvs on
-
- ## Nice GridSite directory listings (without truncating file names!)
- GridSiteIndexes on
-
- ## If this is on, GridSite will look for gridsitehead.txt and
- ## gridsitefoot.txt in the current directory or its parents, and
- ## use them to replace the <body> and </body> tags in .html files.
- GridSiteHtmlFormat on
-
- ## These directives (and the ScriptAlias above) allow authorized
- ## people to manage files, ACLs and DN Lists through their web
- ## browsers. Via HTTP, this just means extended directory listings
- ## and History pages.
- GridSiteAdminURI /real-gridsite-admin.cgi
- GridSiteAdminFile gridsite-admin.cgi
-</Directory>
-
-</VirtualHost>
-
-######################################################################
-# Secured and possibly authenticated HTTPS on ports 443 and 488
-######################################################################
-Listen 443
-Listen 488
-SSLSessionCacheTimeout 300
-SSLSessionCache shm:/var/cache/mod_ssl/shm_cache
-
-<VirtualHost *:443 *:488>
-
-SSLEngine on
-SSLCertificateFile /etc/grid-security/hostcert.pem
-SSLCertificateKeyFile /etc/grid-security/hostkey.pem
-SSLCACertificatePath /etc/grid-security/certificates
-#SSLCARevocationPath YOUR CRL DIRECTORY WOULD GO HERE
-SSLVerifyClient optional
-SSLVerifyDepth 10
-SSLOptions +ExportCertData +StdEnvVars
-
-## This is used to serve the Manage Directory links in footers,
-## and to allow you to edit files and ACLs via your browser.
-ScriptAlias /real-gridsite-admin.cgi /usr/sbin/real-gridsite-admin.cgi
-
-<Directory "/var/www/htdocs">
- ## This sets up GACL authorization for this server.
- GridSiteAuth on
-
- ## This exports various bits of info into the CGI environment
- ## variables (and is needed for gridsite-admin.cgi to work.)
- GridSiteEnvs on
-
- ## Nice GridSite directory listings (without truncating file names!)
- GridSiteIndexes on
-
- ## If this is on, GridSite will look for gridsitehead.txt and
- ## gridsitefoot.txt in the current directory or its parents, and
- ## use them to replace the <body> and </body> tags in .html files.
- GridSiteHtmlFormat on
-
- ## This is the path of directories (and all their subdirectories) for
- ## GACL to search when it encounters a dn-list credential. The DN List
- ## files are plain text, one DN per line, and must have the full url
- ## as the file name, but URL Encoded - eg with urlencode(1)
- GridSiteDNlists /etc/grid-security/dn-lists/:/var/www/htdocs/dn-lists/
-
- ## This is used to form the URL at which DN Lists "owned" by this
- ## server are exported. https://FULL.SERVER.NAME/dn-lists/file
- ## ALL FILES WITH URLs ON THIS SERVER WILL BE EXPORTED IRRESPECTIVE
- ## OF WHERE THEY ARE FOUND ON THE DN-LISTS PATH!!
- GridSiteDNlistsURI /dn-lists/
-
- ## If this is greater than zero, we will accept GSI Proxies for clients
- ## (full client certificates - eg inside web browsers - are always ok)
- GridSiteGSIProxyLimit 0
-
- ## This directive allows authorized people to write/delete files
- ## from non-browser clients - eg with htcp(1)
- GridSiteMethods GET PUT DELETE MOVE
-
- ## These directives (and the ScriptAlias above) allow authorized
- ## people to manage files, ACLs and DN Lists through their web
- ## browsers via HTTPS. The value of GridSiteAdminFile appears to
- ## exist in every directory, but is internally redirected by
- ## mod_gridsite to the value of GridSiteAdminURI (the ScriptAlias
- ## then maps that onto the real-gridsite-admin.cgi executable.)
- GridSiteAdminURI /real-gridsite-admin.cgi
- GridSiteAdminFile gridsite-admin.cgi
-</Directory>
-
-</VirtualHost>
+++ /dev/null
-<title>GridSite 1.1.x Documentation</title>
-<body>
-<h1 align=center>GridSite 1.1.x Documentation</h1>
-
-<p>
-<a href="http://www.gridsite.org/">GridSite</a>
-is a set of extensions to the Apache 2.0 webserver, which support
-Grid security based on X.509 certificates. Since GridSite applies access
-control within Apache itself, via mod_gridsite, Grid authorization and
-the associated verified credentials are available to all technologies
-supported by Apache, including static file serving, SSI, CGI, PHP, JSP and
-mod_perl.
-
-<p>
-The <a href="http://www.gridsite.org/wiki/">GridSite Wiki</a> includes
-guides and cookbook examples about using GridSite, along with up to date
-information about the APIs.
-
-<h2>Reference</h2>
-
-<p>
-The following reference documents and man pages are put in
-/usr/share/doc/gridsite-VERSION when GridSite is installed.
-
-<p>
-<dl>
-
-<dt><b><a href="htcp.1.html">htcp(1)</a></b>
-<dd>A command line tool for copying files to or from HTTP(S) servers.
-<p>
-
-<dt><b><a href="mod_gridsite.8.html">mod_gridsite(8)</a></b>
-<dd>An Apache 2.0 module which enforces access control via Grid Access
- Control Lists, and X.509, GSI or VOMS credentials. mod_gridsite also
- gives Apache built-in support for the HTTP PUT and DELETE methods, and
- formatting of HTML pages with standard headers and footers.
-<p>
-
-<dt><b><a href="gsexec.8.html">gsexec(8)</a></b>
-<dd>A modified version of suexec(8), for use with mod_gridsite(8). gsexec
- allows CGI programs to be run as pool users, depending on the client's
- X.509 identity or the directory in which the CGI is located.
-<p>
-
-<dt><b><a href="httpd-fileserver.conf">httpd-fileserver.conf</a></b> and
- <b><a href="httpd-webserver.conf">httpd-webserver.conf</a></b>
-<dd>Example configuration files for simple HTTP(S) fileservers and
- webservers, with explanatory comments.
-<p>
-
-<dt><b><a href="urlencode.1.html">urlencode(1)</a></b>
-<dd>A command for URL-encoding strings.
-<p>
-
-<dt><b><a href="findproxyfile.1.html">findproxyfile(1)</a></b>
-<dd>The finxproxyfile command returns full path to a GSI Proxy file,
- either in the proxy cache maintained by the GridSite G-HTTPS and
- delegation portType functions, or in other standard places.
-<p>
-
-<dt><b><a href="delegation-1.wsdl">delegation-1.wsdl</a></b>
-<dd>A WSDL description of a delegation Web Service including the Delegation
- portType.
-<p>
-
-<!--
-<dt><b><a href="gridsite-admin.html">gridsite-admin.cgi</a></b>
-<dd>A CGI program providing site administration functions for users with
- standard web browsers, via HTTPS. gridsite-admin.cgi includes a file
- manager, support for file uploading, and editors for HTML, text and
- Grid Access Control List files.
-<p>
--->
-
-<dt><b><a href="doxygen/gridsite_8h.html">gridsite.h API reference</a></b>
-<dd>A detailed description of the C API provided by libgridsite, generated
- from the sources by doxygen.
-<p>
-
-</dl>
-
-</body>
+++ /dev/null
-.TH MOD_GRIDSITE 8 "October 2005" "mod_gridsite" "GridSite Manual"
-.SH NAME
-.B mod_gridsite
-\- Grid extensions to Apache httpd
-.SH SYNOPSIS
-.B LoadModule gridsite_module mod_gridsite.so
-.SH DESCRIPTION
-.B mod_gridsite
-is an Apache 2.0 module which enforces access control via Grid
-Access Control Lists, and X.509, GSI or VOMS credentials. mod_gridsite also
-gives Apache built-in support for the HTTP PUT and DELETE methods, and
-formatting of HTML pages with standard headers and footers.
-
-Since mod_gridsite access
-control within Apache itself, Grid authorization and
-the associated verified credentials are available to all technologies
-supported by Apache, including static file serving, SSI, CGI, PHP, mod_perl
-and Java servlets via a connector to Tomcat.
-
-Operation of mod_gridsite can be configured using runtime directives
-in Apache's standard httpd.conf configuration file. The module must first be
-loaded with a LoadModule directive:
-
-LoadModule gridsite_module /PATH/TO/MODULES/mod_gridsite.so
-
-The module's behaviour is then controlled by GridSite... directives within
-Apache <Directory ...> sections, allowing different directories to use
-GridSite features in different ways.
-
-.SH DIRECTIVES
-
-.IP "GridSiteIndexes on|off"
-Determines whether GridSite generates HTML directory listings. These
-have some advantages over standard Apache directory listings (eg the
-displayed filenames are never truncated) and will include standard
-headers and footers if GridSiteHtmlFormat is on.
-(Default: GridSiteIndexes off)
-
-.IP "GridSiteIndexHeader file"
-If the named file is found in the directory being listed, the file
-is included verbatim at the top of the listing and excluded from
-the file-by-file listing. The file can either be HTML or plain text (in
-which case browsers will be treat it as one HTML paragraph.)
-(Default: none)
-
-.IP "GridSiteHtmlFormat on|off"
-Determines where HTML pages receive additional formatting before being
-sent to the client. This includes the "Last modified",
-"View page history", "Switch to HTTP(S)",
-"Print View" and "Built with GridSite" footer
-elements. If header and footer files are found, they will be used too.
-(Default: GridSiteHtmlFormat off)
-
-.IP "GridSiteHeadFile file"
-.IP "GridSiteFootFile file"
-Set the filenames to be searched for as standard headers and footers
-for HTML pages. For each HTML page, the directory of that page is tried
-first, and then parent directories in ascending order until a header /
-footer file is found. Header files are inserted in place of HTML
-<body[ ...]> tags; footer files in place of </body>. (These
-standard files should each include the appropriate body tag as a
-replacement.)
-(Defaults: GridSiteHeadFile gridsitehead.txt,
-GridSiteFootFile gridsitefoot.txt)
-
-.IP "GridSiteAuth on|off"
-Enables GridSite access control features, using
-GACL files. The files are named .gacl and are
-per-directory. The current directory is tried and then parent
-directories in ascending order until a .gacl file is found.
-(Default: GridSiteAuth off)
-
-.IP "GridSiteAdminList uri"
-All members of the DN List with name "uri" receive the full set
-of permissions, irrespective of per-directory .gacl files. People in
-this group have full control over the whole site.
-(Default: none)
-
-.IP "GridSiteGSIProxyLimit limit"
-When using GSI Proxy credentials,
-proxies with delegation depth greater than "limit" will
-be ignored by mod_gridsite authorization decisions. A limit of zero
-implies only full X.509
-certificates (and no proxies) will be accepted. A limit of 1 implies
-that only the initial proxy, usually created on the user's own machine,
-is acceptable. Higher levels lead to proxies on remote machines, eg
-used by running jobs, being accepted.
-(Default: GridSiteGSIProxyLimit 1)
-
-.IP "GridSiteMethods [GET] [PUT] [DELETE] [MOVE]"
-Specifies which HTTP methods are supported by GridSite. GET (and HEAD)
-are always supported. PUT and DELETE support is turned on by this
-directive, subject to a positive statement that write permission is
-allowed for the directory in question, by a GACL file.
-(Default: GridSite GET)
-
-.IP "GridSiteDNlists directory1[:directory2[:directory3]...]"
-Sets up the DN List path used by GACL for
-evaluating <dn-list> credentials. If this directive is not used,
-then GACL will use the GRST_DN_LISTS variable from Apache's own
-environment. If that is not set either, then /etc/grid-security/dn-lists
-is searched.
-(Default: none)
-
-.IP "GridSiteDNlistsURI uri"
-If GridSiteDNlistsURI is used, then the URI given appears to be
-populated with all the DN lists on the current DN lists path which
-match the current server. That is, for server https://example.org/
-with DN lists URI /dn-lists/, all DN lists with URLs starting
-https://example.org/dn-lists/ will appear to be present in /dn-lists/,
-irrespective of where in the path they are stored.
-(Default: none)
-<p>
-
-.IP "GridSiteAdminURI uri"
-GridSiteAdminURI gives the absolute URI on the server of the GridSite
-Admin CGI program, which is used for file management, HTML and GACL
-editing. This should be used in conjunction with the standard Apache
-directive ScriptAlias to map that URI to the real-gridsite-admin.cgi
-executable. For example:
-
-ScriptAlias /real-gridsite-admin.cgi /PATH/TO/real-gridsite-admin.cgi
-
-This URI is always reached by an internal redirection from the value
-set by GridSiteAdminFile, and is never visible to users.
-(Default: none)
-
-.IP "GridSiteAdminFile cgifilename"
-If GridSiteAdminURI is set, then the cgifilename of GridSiteAdminFile
-appears to be present in all directories when explicitly
-requested (it does not appear in directory listings.) Requests for these
-ghost CGI URIs are internally redirected to the value set by
-GridSiteAdminURI. (Default: GridSiteAdminFile gridsite-admin.cgi)
-
-.IP "GridSiteEnvs on|off"
-This makes mod_gridsite export several variables into the environment
-of CGI programs and other dynamic content systems. The variable names
-are listed below. For gridsite-admin.cgi mechanism to work, this switch
-must be left in its default state of on.
-(Default: GridSiteEnvs on)
-
-.IP "GridSiteEditable [ext1 [ext2 [ext3] ...]]]"
-A space-separated list of file extensions which can safely be edited
-by the GridSite Text/HTML editor. The extensions are given without the
-initial dot.
-(Default: GridSiteEditable txt shtml html htm css js php jsp)
-
-.IP "GridSiteHelpURI uri"
-If set, gives the URI to use for "Website Help" links in HTML
-page footers. (Default: none)
-
-.IP "GridSiteLink on|off"
-Turns off the link in the HTML page footers which gives credit to GridSite.
-(Default: GridSiteLink on)
-
-.IP "GridSiteUnzip path"
-If "path" is set by this directive, then real-gridsite-admin.cgi
-will offer to list the contents of .zip archives on the server.
-Users with write access are able to unpack the contents into the same
-directory as the .zip file. The value of "path" must point
-to the location of the unzip binary. (Default: none)
-
-.IP "GridSiteGridHTTP on|off"
-Enable GridHTTP for this server, virtual server or directory:
-HTTPS requests made with the header
-.BR "Upgrade: GridHTTP/1.0"
-will be redirected to an HTTP version of the file. (Default: off)
-
-.IP "GridSiteGridHTTPport port"
-Sets the port to use for the unencrypted HTTP component of GridHTTP
-HTTPS->HTTP transfers. The same setting will be used for all virtual hosts
-which support GridHTTP. (Default: 777)
-
-.IP "GridSiteOnetimesDir path"
-Location of authentication cookies directory, relative to ServerRoot.
-Used by GridHTTP to record the credentials obtained via HTTPS,
-and available to the corresponding HTTP request. (Default: /var/www/onetimes)
-
-.IP "GridSiteACLFormat GACL|XACML"
-Format to use when writing .gacl files. (Both formats are automatically
-recognised when reading.) (Default: GACL)
-
-.IP "GridSiteExecMethod nosetuid|suexec|X509DN|directory"
-Execution strategy for CGI scripts and executables. For options other
-than nosetuid, suexec (or gsexec renamed suexec) must installed. For
-X509DN and directory, gsexec must be installed, as suexec. See
-.BR "gsexec(8)"
-for an explanation of the different execution strategies.
-(Default: nosetuid)
-
-.IP "GridSiteUserGroup user group"
-Unix user and group when using suexec (or gsexec as suexec.) This
-is equivalent to the suexec SuexecUserGroup directive, but can be
-specified on a per-directory basis. (Default: none)
-
-.IP "GridSiteDiskMode GroupNone|GroupRead|GroupWrite WorldNone|WorldRead"
-The file creation permissions mode, taking two arguments to specify
-the group and other permissions. The mode always includes read and write
-permission for the CGI user itself.
-(Default: GroupNone WorldNone)
-
-.IP "GridSiteCastUniPort port"
-The
-.BR UDP
-unicast port to listen on for HTCP queries, and from which to
-send replies to HTCP unicast and multicast queries. Ideally, this should be
-a privileged port below 1024. This directive may not appear within a virtual
-server. (Default: 777)
-
-.IP "GridSiteCastGroup group[:port]"
-A UDP multicast group on which to listen for HTCP queries, plus an optional
-port. If no port is given, then 777 is used. Multiple GridSiteCastGroup
-directives can be given to cause the UDP responder to listen to more than
-one multicast group. This directive may not appear within a virtual server.
-
-.IP "GridSiteCastAlias URL-prefix path-prefix"
-Maps SiteCast generic URLs to the local filesystem. When processing
-HTCP queries, matching SiteCast URLs will have URL-prefix stripped off
-and the remaining portion of the URL added to path-prefix to construct a
-local path and filename. If a file is found with that name, a SiteCast HTCP
-response will be returned to the querying host. Otherwise the queries are
-ignored.
-This directive may appear within virtual servers, and the virtual server's
-servername and first port will determine the host and port name used to
-construct the transfer URL.
-
-.SH ENVIRONMENT
-
-The following variables are present in the environment of CGI programs and
-other dynamic content systems if the
-.BR "GridSiteEnvs on"
-directive is in effect.
-
-.IP GRST_PERM
-Numerical value of the permission bit-map obtained by comparing the
-user with the GACL in force. (These should be tested using the
-GRSTgaclPermHasXXXX functions from GACL.)
-
-.IP GRST_ADMIN_LIST
-URI of the DN List, listing people with full admin and write access
-to the whole site.
-
-.IP GRST_GSIPROXY_LIMIT
-Maximum valid delegation level for GSI Proxies.
-
-.IP GRST_DIR_PATH
-Absolute path in the local filesystem to the directory holding the
-file being requested.
-
-.IP GRST_DESTINATION_TRANSLATED
-Present if a WebDAV
-.BR "Destination:"
-header was given in the request with a local URL. Contains the translation of
-the URL given into an absolute path in the local filesystem.
-
-.IP GRST_HELP_URI
-URI of website help pages set by GridSiteHelpURI directive.
-
-.IP GRST_ADMIN_FILE
-Filename of per-directory ghost gridsite-admin.cgi program. (This is
-used by real-gridsite-admin.cgi to construct links in its pages.)
-
-.IP GRST_EDITABLE
-Space-separated list of extensions which can safely be edited with a
-Text/HTML editor.
-
-.IP "GRST_HEAD_FILE and GRST_FOOT_FILE"
-Filenames of standard header and footer files.
-
-.IP GRST_DN_LISTS
-DN lists search path.
-
-.IP GRST_DN_LISTS_URI
-Directory of virtual URIs used to publish this site's DN Lists.
-
-.IP GRST_UNZIP
-Full path to the
-.BR "unzip(1)"
-binary, used to list and unpack .zip files.
-
-.IP GRST_NO_LINK
-If set, do not include credit links to GridSite in page footers.
-
-.IP GRST_ACL_FORMAT
-Format to use when writing .gacl files: either GACL or XACML.
-
-.IP GRST_EXEC_METHOD
-Specified by
-.BR GridSiteExecMethod
-either suexec, X509DN or directory.
-
-.IP GRST_EXEC_DIRECTORY
-The directory containing the CGI script or executable (used by gsexec
-to determine which pool account to use in directory mapping mode.)
-
-.IP GRST_DISK_MODE
-The
-.BR Apache
-disk permission modes bit pattern, in hexadecimal, starting with 0x.
-(Similar to the Unix bit pattern, except with hexadecimal rather than
-octal values: eg 0x600 [Apache] vs 0600 [Unix]
-are both read/write for user only.)
-
-.SH AUTHOR
-Andrew McNab <Andrew.McNab@manchester.ac.uk>
-
-mod_gridsite is part of GridSite: http://www.gridsite.org/
-.SH "SEE ALSO"
-.BR htcp(1),
-.BR httpd(8),
-.BR gsexec(8)
+++ /dev/null
-.TH URLENCODE 1 "November 2003" "urlencode" "GridSite Manual"
-.SH NAME
-.B urlencode
-\- convert strings to or from URL-encoded form
-.SH SYNOPSIS
-.B urlencode
-[-m|-d]
-.I string [string ...]
-.SH DESCRIPTION
-.B urlencode
-encodes strings according to RFC 1738.
-
-That is, characters A-Z a-z 0-9 . _
-and - are passed through unmodified, but all other characters are
-represented as %HH, where HH is their two-digit upper-case hexadecimal ASCII
-representation.
-For example, the URL http://www.gridpp.ac.uk/ becomes
-http%3A%2F%2Fwww.gridpp.ac.uk%2F
-
-.B urlencode
-converts each character in all the strings given on the command line. If
-multiple strings are given, they are concatenated with separating spaces
-before conversion.
-
-.SH OPTIONS
-.IP "-m"
-Instead of full conversion, do GridSite "mild URL encoding" in which A-Z a-z
-0-9 . = - _ @ and / are passed through unmodified. This results in slightly
-more human-readable strings but the application must be prepared to create
-or simulate the directories implied by any slashes.
-
-.IP "-d"
-Do URL-decoding rather than encoding, according to RFC 1738. %HH and %hh
-strings are converted and other characters are passed through unmodified,
-with the exception that + is converted to space.
-
-.SH EXIT CODES
-0 is always returned.
-
-.SH AUTHOR
-Andrew McNab <Andrew.McNab@manchester.ac.uk>
-
-urlencode is part of GridSite: http://www.gridsite.org/
+++ /dev/null
-/*
- Copyright (c) 2002-4, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*---------------------------------------------------------------*
- * For more about GridSite: http://www.gridsite.org/ *
- *---------------------------------------------------------------*/
-
-#ifndef HEADER_GACL_H
-#define HEADER_GACL_H
-#endif
-
-#ifndef GACL_LIB_VERSION
-#define GACL_LIB_VERSION "x.x.x"
-#endif
-
-typedef GRSTgaclCred GACLcred;
-
-typedef int GACLaction;
-typedef unsigned int GACLperm;
-
-typedef GRSTgaclEntry GACLentry;
-
-typedef GRSTgaclAcl GACLacl;
-
-typedef GRSTgaclUser GACLuser;
-
-extern char *gacl_perm_syms[];
-extern GACLperm gacl_perm_vals[];
-
-#define GACL_PERM_NONE GRST_PERM_NONE
-#define GACL_PERM_READ GRST_PERM_READ
-#define GACL_PERM_LIST GRST_PERM_LIST
-#define GACL_PERM_WRITE GRST_PERM_WRITE
-#define GACL_PERM_ADMIN GRST_PERM_ADMIN
-
-#define GACLhasNone(perm) (perm == 0)
-#define GACLhasRead(perm) ((perm & GRST_PERM_READ) != 0)
-#define GACLhasList(perm) ((perm & GRST_PERM_LIST) != 0)
-#define GACLhasWrite(perm) ((perm & GRST_PERM_WRITE) != 0)
-#define GACLhasAdmin(perm) ((perm & GRST_PERM_ADMIN) != 0)
-
-#define GACL_ACTION_ALLOW GRST_ACTION_ALLOW
-#define GACL_ACTION_DENY GRST_ACTION_DENY
-
-#define GACL_ACL_FILE GRST_ACL_FILE
-#define GACL_DN_LISTS GRST_DN_LISTS
-
-#define GACLinit() GRSTgaclInit()
-
-#define GACLnewCred(x) GRSTgaclCredNew((x))
-/* GACLcred *GACLnewCred(char *); */
-
-#define GACLaddToCred(x,y,z) GRSTgaclCredAddValue((x),(y),(z))
-/* int GACLaddToCred(GACLcred *, char *, char *); */
-
-#define GACLfreeCred(x) GRSTgaclCredFree((x))
-/* int GACLfreeCred(GACLcred *); */
-
-#define GACLaddCred(x,y) GRSTgaclEntryAddCred((x),(y))
-/* int GACLaddCred(GACLentry *, GACLcred *); */
-
-#define GACLdelCred(x,y) GRSTgaclEntryDelCred((x),(y))
-/* int GACLdelCred(GACLentry *, GACLcred *); */
-
-#define GACLprintCred(x,y) GRSTgaclCredPrint((x),(y))
-/* int GACLprintCred(GACLcred *, FILE *); */
-
-
-#define GACLnewEntry() GRSTgaclEntryNew()
-/* GACLentry *GACLnewEntry(void); */
-
-#define GACLfreeEntry(x) GRSTgaclEntryFree((x))
-/* int GACLfreeEntry(GACLentry *); */
-
-#define GACLaddEntry(x,y) GRSTgaclAclAddEntry((x),(y))
-/* int GACLaddEntry(GACLacl *, GACLentry *); */
-
-#define GACLprintEntry(x,y) GRSTgaclEntryPrint((x),(y))
-/* int GACLprintEntry(GACLentry *, FILE *); */
-
-
-#define GACLprintPerm(x,y) GRSTgaclPermPrint((x),(y))
-/* int GACLprintPerm(GACLperm, FILE *); */
-
-#define GACLallowPerm(x,y) GRSTgaclEntryAllowPerm((x),(y))
-/* int GACLallowPerm(GACLentry *, GACLperm); */
-
-#define GACLunallowPerm(x,y) GRSTgaclEntryUnallowPerm((x),(y))
-/* int GACLunallowPerm(GACLentry *, GACLperm); */
-
-#define GACLdenyPerm(x,y) GRSTgaclEntryDenyPerm((x),(y))
-/* int GACLdenyPerm(GACLentry *, GACLperm); */
-
-#define GACLundenyPerm(x,y) GRSTgaclEntryUndenyPerm((x),(y))
-/* int GACLundenyPerm(GACLentry *, GACLperm); */
-
-#define GACLpermToChar(x) GRSTgaclPermToChar((x))
-/* char *GACLpermToChar(GACLperm); */
-
-#define GACLcharToPerm(x) GRSTgaclPermFromChar((x))
-/* GACLperm GACLcharToPerm(char *); */
-
-#define GACLnewAcl() GRSTgaclAclNew()
-/* GACLacl *GACLnewAcl(void); */
-
-#define GACLfreeAcl(x) GRSTgaclAclFree((x))
-/* int GACLfreeAcl(GACLacl *); */
-
-#define GACLprintAcl(x,y) GRSTgaclAclPrint((x),(y))
-/* int GACLprintAcl(GACLacl *, FILE *); */
-
-#define GACLsaveAcl(x,y) GRSTgaclAclSave((y),(x))
-/* int GACLsaveAcl(char *, GACLacl *); */
-
-#define GACLloadAcl(x) GRSTgaclAclLoadFile((x))
-/* GACLacl *GACLloadAcl(char *); */
-
-#define GACLfindAclForFile(x) GRSTgaclFileFindAclname((x))
-/* char *GACLfindAclForFile(char *); */
-
-#define GACLloadAclForFile(x) GRSTgaclAclLoadforFile((x))
-/* GACLacl *GACLloadAclForFile(char *); */
-
-#define GACLisAclFile(x) GRSTgaclFileIsAcl((x))
-/* int GACLisAclFile(char *); */
-
-
-#define GACLnewUser(x) GRSTgaclUserNew((x))
-/* GACLuser *GACLnewUser(GACLcred *); */
-
-#define GACLfreeUser(x) GRSTgaclUserFree((x))
-/* int GACLfreeUser(GACLuser *); */
-
-#define GACLuserAddCred(x,y) GRSTgaclUserAddCred((x),(y))
-/* int GACLuserAddCred(GACLuser *, GACLcred *); */
-
-#define GACLuserHasCred(x,y) GRSTgaclUserHasCred((x),(y))
-/* int GACLuserHasCred(GACLuser *, GACLcred *); */
-
-#define GACLuserFindCredType(x,y) GRSTgaclUserFindCredtype((x),(y))
-/* GACLcred *GACLuserFindCredType(GACLuser *, char *); */
-
-#define GACLtestDnList(x,y) GRSTgaclDNlistHasUser((x),(y))
-/* int GACLtestDnList(char *, GACLuser *); */
-
-#define GACLtestUserAcl(x,y) GRSTgaclAclTestUser((x),(y))
-/* GACLperm GACLtestUserAcl(GACLacl *, GACLuser *); */
-
-#define GACLtestExclAcl(x,y) GRSTgaclAclTestexclUser((x),(y))
-/* GACLperm GACLtestExclAcl(GACLacl *, GACLuser *); */
-
-
-#define GACLurlEncode(x) GRSThttpUrlEncode((x))
-/* char *GACLurlEncode(char *); */
-
-#define GACLmildUrlEncode(x) GRSThttpUrlMildencode((x))
-/* char *GACLmildUrlEncode(char *); */
-
-GACLentry *GRSTgaclEntryParse(xmlNodePtr cur);
-/* special function for legacy EDG LB service */
+++ /dev/null
-/*
- Copyright (c) 2002-5, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*---------------------------------------------------------------*
- * For more about GridSite: http://www.gridsite.org/ *
- *---------------------------------------------------------------*/
-
-#ifndef HEADER_SSL_H
-#include <openssl/ssl.h>
-#endif
-
-#ifndef HEADER_CRYPTO_H
-#include <openssl/crypto.h>
-#endif
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-#ifndef TRUE
-#define TRUE (!FALSE)
-#endif
-
-/// Everything ok (= OpenSSL X509_V_OK)
-#define GRST_RET_OK 0
-
-/// Failed for unspecified reason
-#define GRST_RET_FAILED 1000
-
-/// Failed to find certificate in some cert store / directory
-#define GRST_RET_CERT_NOT_FOUND 1001
-
-/// Bad signature
-#define GRST_RET_BAD_SIGNATURE 1002
-
-/// No such file or directory
-#define GRST_RET_NO_SUCH_FILE 1003
-
-typedef struct { char *name;
- char *value;
- void *next; } GRSTgaclNamevalue;
-
-typedef struct { char *type;
- int delegation;
- GRSTgaclNamevalue *firstname;
- void *next; } GRSTgaclCred;
-
-typedef int GRSTgaclAction;
-typedef unsigned int GRSTgaclPerm;
-
-typedef struct { GRSTgaclCred *firstcred;
- GRSTgaclPerm allowed;
- GRSTgaclPerm denied;
- void *next; } GRSTgaclEntry;
-
-typedef struct { GRSTgaclEntry *firstentry; } GRSTgaclAcl;
-
-typedef struct { GRSTgaclCred *firstcred;
- char *dnlists; } GRSTgaclUser;
-
-#define GRST_PERM_NONE 0
-#define GRST_PERM_READ 1
-#define GRST_PERM_EXEC 2
-#define GRST_PERM_LIST 4
-#define GRST_PERM_WRITE 8
-#define GRST_PERM_ADMIN 16
-#define GRST_PERM_ALL 31
-
-/* DO NOT USE PermIsNone!! */
-#define GRSTgaclPermIsNone(perm) (perm == 0)
-
-#define GRSTgaclPermHasNone(perm) (perm == 0)
-#define GRSTgaclPermHasRead(perm) ((perm & GRST_PERM_READ ) != 0)
-#define GRSTgaclPermHasExec(perm) ((perm & GRST_PERM_EXEC ) != 0)
-#define GRSTgaclPermHasList(perm) ((perm & GRST_PERM_LIST ) != 0)
-#define GRSTgaclPermHasWrite(perm) ((perm & GRST_PERM_WRITE) != 0)
-#define GRSTgaclPermHasAdmin(perm) ((perm & GRST_PERM_ADMIN) != 0)
-
-#define GRST_ACTION_ALLOW 0
-#define GRST_ACTION_DENY 1
-
-#define GRST_HIST_PREFIX ".grsthist"
-#define GRST_ACL_FILE ".gacl"
-#define GRST_DN_LISTS "/etc/grid-security/dn-lists"
-#define GRST_RECURS_LIMIT 9
-
-#define GRST_PROXYCERTINFO_OID "1.3.6.1.4.1.3536.1.222"
-#define GRST_VOMS_OID "1.3.6.1.4.1.8005.100.100.5"
-#define GRST_VOMS_DIR "/etc/grid-security/vomsdir"
-
-#define GRST_ASN1_MAXCOORDLEN 50
-#define GRST_ASN1_MAXTAGS 500
-
-struct GRSTasn1TagList { char treecoords[GRST_ASN1_MAXCOORDLEN+1];
- int start;
- int headerlength;
- int length;
- int tag; } ;
-
-#define GRST_HTTP_PORT 777
-#define GRST_HTTPS_PORT 488
-#define GRST_HTCP_PORT 777
-
-#define GRSThtcpNOPop 0
-#define GRSThtcpTSTop 1
-
-typedef struct { unsigned char length_msb;
- unsigned char length_lsb;
- char text[1]; } GRSThtcpCountstr;
-
-#define GRSThtcpCountstrLen(string) (256*((string)->length_msb) + (string)->length_lsb)
-
-typedef struct { unsigned char total_length_msb;
- unsigned char total_length_lsb;
- unsigned char version_msb;
- unsigned char version_lsb;
- unsigned char data_length_msb;
- unsigned char data_length_lsb;
- unsigned int response : 4;
- unsigned int opcode : 4;
- unsigned int rr : 1;
- unsigned int f1 : 1;
- unsigned int reserved : 6;
- unsigned int trans_id; /* must be 4 bytes */
- GRSThtcpCountstr *method;
- GRSThtcpCountstr *uri;
- GRSThtcpCountstr *version;
- GRSThtcpCountstr *req_hdrs;
- GRSThtcpCountstr *resp_hdrs;
- GRSThtcpCountstr *entity_hdrs;
- GRSThtcpCountstr *cache_hdrs; } GRSThtcpMessage;
-
-int GRSTgaclInit(void);
-
-/* #define GACLnewCred(x) GRSTgaclCredNew((x)) */
-GRSTgaclCred *GRSTgaclCredNew(char *);
-
-/* #define GACLaddToCred(x,y,z) GRSTgaclCredAddValue((x),(y),(z)) */
-int GRSTgaclCredAddValue(GRSTgaclCred *, char *, char *);
-
-#define GRSTgaclCredSetDelegation(cred, level) ((cred)->delegation = (level))
-#define GRSTgaclCredGetDelegation(cred) ((cred)->delegation)
-
-/* #define GACLfreeCred(x) GRSTgaclCredFree((x)) */
-int GRSTgaclCredFree(GRSTgaclCred *);
-
-/* #define GACLaddCred(x,y) GRSTgaclEntryAddCred((x),(y)) */
-int GRSTgaclEntryAddCred(GRSTgaclEntry *, GRSTgaclCred *);
-
-/* #define GACLdelCred(x,y) GRSTgaclEntryDelCred((x),(y)) */
-int GRSTgaclEntryDelCred(GRSTgaclEntry *, GRSTgaclCred *);
-
-/* #define GACLprintCred(x,y) GRSTgaclCredPrint((x),(y)) */
-int GRSTgaclCredCredPrint(GRSTgaclCred *, FILE *);
-
-
-/* #define GACLnewEntry(x) GRSTgaclEntryNew((x)) */
-GRSTgaclEntry *GRSTgaclEntryNew(void);
-
-/* #define GACLfreeEntry(x) GRSTgaclEntryFree((x)) */
-int GRSTgaclEntryFree(GRSTgaclEntry *);
-
-/* #define GACLaddEntry(x,y) GRSTgaclAclAddEntry((x),(y)) */
-int GRSTgaclAclAddEntry(GRSTgaclAcl *, GRSTgaclEntry *);
-
-/* #define GACLprintEntry(x,y) GRSTgaclEntryPrint((x),(y)) */
-int GRSTgaclEntryPrint(GRSTgaclEntry *, FILE *);
-
-
-/* #define GACLprintPerm(x,y) GRSTgaclPermPrint((x),(y)) */
-int GRSTgaclPermPrint(GRSTgaclPerm, FILE *);
-
-/* #define GACLallowPerm(x,y) GRSTgaclEntryAllowPerm((x),(y)) */
-int GRSTgaclEntryAllowPerm(GRSTgaclEntry *, GRSTgaclPerm);
-
-/* #define GACLunallowPerm(x,y) GRSTgaclEntryUnallowPerm((x),(y)) */
-int GRSTgaclEntryUnallowPerm(GRSTgaclEntry *, GRSTgaclPerm);
-
-/* #define GACLdenyPerm(x,y) GRSTgaclEntryDenyPerm((x),(y)) */
-int GRSTgaclEntryDenyPerm(GRSTgaclEntry *, GRSTgaclPerm);
-
-/* #define GACLundenyPerm(x,y) GRSTgaclEntryUndenyPerm((x),(y)) */
-int GRSTgaclEntryUndenyPerm(GRSTgaclEntry *, GRSTgaclPerm);
-
-/* #define GACLpermToChar(x) GRSTgaclPermToChar((x)) */
-char *GRSTgaclPermToChar(GRSTgaclPerm);
-
-/* #define GACLcharToPerm(x) GRSTgaclPermFromChar((x)) */
-GRSTgaclPerm GRSTgaclPermFromChar(char *);
-
-/* #define GACLnewAcl(x) GRSTgaclAclNew((x)) */
-GRSTgaclAcl *GRSTgaclAclNew(void);
-
-/* #define GACLfreeAcl(x) GRSTgaclAclFree((x)) */
-int GRSTgaclAclFree(GRSTgaclAcl *);
-
-/* #define GACLprintAcl(x,y) GRSTgaclAclPrint((x),(y)) */
-int GRSTgaclAclPrint(GRSTgaclAcl *, FILE *);
-
-/* #define GACLsaveAcl(x,y) GRSTgaclAclSave((y),(x)) */
-int GRSTgaclAclSave(GRSTgaclAcl *, char *);
-
-/* #define GACLloadAcl(x) GRSTgaclFileLoadAcl((x)) */
-GRSTgaclAcl *GRSTgaclAclLoadFile(char *);
-
-/* #define GACLfindAclForFile(x) GRSTgaclFileFindAclname((x)) */
-char *GRSTgaclFileFindAclname(char *);
-
-/* #define GACLloadAclForFile(x) GRSTgaclFileLoadAcl((x)) */
-GRSTgaclAcl *GRSTgaclAclLoadforFile(char *);
-
-/* #define GACLisAclFile(x) GRSTgaclFileIsAcl((x)) */
-int GRSTgaclFileIsAcl(char *);
-
-
-/* #define GACLnewUser(x) GRSTgaclUserNew((x)) */
-GRSTgaclUser *GRSTgaclUserNew(GRSTgaclCred *);
-
-/* #define GACLfreeUser(x) GRSTgaclUserFree((x)) */
-int GRSTgaclUserFree(GRSTgaclUser *);
-
-/* #define GACLuserAddCred(x,y) GRSTgaclUserAddCred((x),(y)) */
-int GRSTgaclUserAddCred(GRSTgaclUser *, GRSTgaclCred *);
-
-/* #define GACLuserHasCred(x,y) GRSTgaclUserHasCred((x),(y)) */
-int GRSTgaclUserHasCred(GRSTgaclUser *, GRSTgaclCred *);
-
-int GRSTgaclUserSetDNlists(GRSTgaclUser *, char *);
-
-/* #define GACLuserFindCredType(x,y) GRSTgaclUserFindCredtype((x),(y)) */
-GRSTgaclCred *GRSTgaclUserFindCredtype(GRSTgaclUser *, char *);
-
-/* #define GACLtestDnList(x,y) GRSTgaclDNlistHasUser((x),(y)) */
-int GRSTgaclDNlistHasUser(char *, GRSTgaclUser *);
-
-/* #define GACLtestUserAcl(x,y) GRSTgaclAclTestUser((x),(y)) */
-GRSTgaclPerm GRSTgaclAclTestUser(GRSTgaclAcl *, GRSTgaclUser *);
-
-/* #define GACLtestExclAcl(x,y) GRSTgaclAclTestexclUser((x),(y)) */
-GRSTgaclPerm GRSTgaclAclTestexclUser(GRSTgaclAcl *, GRSTgaclUser *);
-
-char *GRSThttpUrlDecode(char *);
-
-/* #define GACLurlEncode(x) GRSThttpUrlEncode((x)) */
-char *GRSThttpUrlEncode(char *);
-
-/* #define GACLmildUrlEncode(x) GRSThttpMildUrlEncode((x)) */
-char *GRSThttpUrlMildencode(char *);
-
-int GRSTx509NameCmp(char *, char *);
-
-int GRSTx509KnownCriticalExts(X509 *);
-
-int GRSTx509IsCA(X509 *);
-int GRSTx509CheckChain(int *, X509_STORE_CTX *);
-int GRSTx509VerifyCallback(int, X509_STORE_CTX *);
-
-int GRSTx509GetVomsCreds(int *, int, size_t, char *, X509 *, STACK_OF(X509) *, char *);
-GRSTgaclCred *GRSTx509CompactToCred(char *);
-int GRSTx509CompactCreds(int *, int, size_t, char *, STACK_OF(X509) *, char *, X509 *);
-char *GRSTx509CachedProxyFind(char *, char *, char *);
-char *GRSTx509FindProxyFileName(void);
-int GRSTx509MakeProxyCert(char **, FILE *, char *, char *, char *, int);
-char *GRSTx509CachedProxyKeyFind(char *, char *, char *);
-int GRSTx509MakeProxyRequest(char **, char *, char *, char *);
-int GRSTx509StringToChain(STACK_OF(X509) **, char *);
-char *GRSTx509MakeProxyFileName(char *, STACK_OF(X509) *);
-int GRSTx509CacheProxy(char *, char *, char *, char *);
-
-#define GRST_HEADFILE "gridsitehead.txt"
-#define GRST_FOOTFILE "gridsitefoot.txt"
-#define GRST_ADMIN_FILE "gridsite-admin.cgi"
-
-typedef struct { char *text;
- void *next; } GRSThttpCharsList;
-
-typedef struct { size_t size;
- GRSThttpCharsList *first;
- GRSThttpCharsList *last; } GRSThttpBody;
-
-void GRSThttpBodyInit(GRSThttpBody *);
-void GRSThttpPrintf(GRSThttpBody *, char *, ...);
-int GRSThttpCopy(GRSThttpBody *, char *);
-void GRSThttpWriteOut(GRSThttpBody *);
-int GRSThttpPrintHeaderFooter(GRSThttpBody *, char *, char *);
-char *GRSThttpGetCGI(char *);
-
-time_t GRSTasn1TimeToTimeT(char *, size_t);
-int GRSTasn1SearchTaglist(struct GRSTasn1TagList taglist[], int, char *);
-int GRSTasn1ParseDump(BIO *, unsigned char *, long,
- struct GRSTasn1TagList taglist[], int, int *);
-int GRSTasn1GetX509Name(char *, int, char *, char *,
- struct GRSTasn1TagList taglist[], int);
-
-int GRSThtcpNOPrequestMake(char **, int *, unsigned int);
-int GRSThtcpNOPresponseMake(char **, int *, unsigned int);
-int GRSThtcpTSTrequestMake(char **, int *, unsigned int, char *, char *, char *);
-int GRSThtcpTSTresponseMake(char **, int *, unsigned int, char *, char *, char *);
-int GRSThtcpMessageParse(GRSThtcpMessage *, char *, int);
+++ /dev/null
-#Wed Feb 23 03:19:54 CET 2005
-module.build=141
+++ /dev/null
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
- <project name="configure options">
- <property name="build.make.arguments"
- value="prefix=${stage.abs.dir} GSOAPDIR=${ext.gsoap.subdir} OPENSSL_GLOBUS_FLAGS=-I${with.globus.prefix}/include/gcc32 OPENSSL_GLOBUS_LIBS=-L${with.globus.prefix}/lib/ FLAVOR_GLOBUS_EXT=_gcc32" />
- </project>
-
+++ /dev/null
-###################################################################
-# System dependencies
-###################################################################
-
-org.glite.version = HEAD
-org.glite.core.version = HEAD
-
-# Component dependencies tag = do not remove this line =
-
+++ /dev/null
-<?xml version="1.0"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- GLite Middleware WMS Configuration Specification File
-
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Joachim Flammer <Joachim.Flammer@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
- Revision 1.3 2004/10/27 10:35:37 dimeglio
- Added missing closing target
-
- Revision 1.2 2004/10/27 10:28:29 dimeglio
- Modified to use gridsite-core
-
- Revision 1.1 2004/10/26 17:54:24 dimeglio
- First version of this file
-
- Revision 1.7 2004/10/18 23:01:18 dimeglio
- Added oscheck to various targets
-
- Revision 1.6 2004/10/12 14:21:21 eronchie
- Removed ssl_utils dependency
-
- Revision 1.5 2004/08/20 09:51:39 eronchie
- Updated buildmodules orders
-
- Revision 1.4 2004/08/04 07:30:29 eronchie
- Added cppunit
-
- Revision 1.3 2004/07/23 14:50:08 eronchie
- Added exception
-
- Revision 1.2 2004/07/23 08:27:03 eronchie
- Updated
-
-
--->
-
-<project name="Gridsite Core CSF" default="all">
-
- <!-- overwrite default workspace directory -->
- <property name="workspace.dir" value="../.." />
-
- <!-- ===============================================
- Load properties
- =============================================== -->
-
- <!-- load baseline and user properties -->
- <import file="${workspace.dir}/org.glite/project/baseline.properties.xml" />
-
- <!-- define build properties file location since we are already in project dir -->
- <property name="subsystem.build.properties.file" value="./build.properties" />
-
- <!-- Load subsytem-specific property files -->
- <import file="./properties.xml"/>
-
- <!-- load global properties -->
- <import file="${global.properties.file}" />
-
- <!-- ===============================================
- Load dependencies
- =============================================== -->
-
- <!-- Load user dependencies file -->
- <property file="${user.dependencies.file}" />
-
- <!-- Load subsystem dependencies file -->
- <property file="./dependencies.properties" />
-
- <!-- Load global dependencies file -->
- <property file="${global.dependencies.file}" />
-
- <!-- ===============================================
- Load targets
- =============================================== -->
- <import file="${global.targets-envchecks.file}" />
- <import file="${global.targets-external-dependencies.file}" />
-
- <!-- ===============================================
- Evaluate CVS tags
- =============================================== -->
-
- <target name="evaluate.cvs.tags" description="Figure out if we need tagged CVS checkout">
- <condition property="glite.head">
- <and>
- <equals arg1="${org.glite.version}" arg2="HEAD" />
- <or>
- <istrue value="${update}" />
- <not>
- <available file="${global.dependencies.file}" type="file" />
- </not>
- </or>
- </and>
- </condition>
- <condition property="glite.tag">
- <and>
- <not>
- <equals arg1="${org.glite.version}" arg2="HEAD" />
- </not>
- <or>
- <istrue value="${update}" />
- <not>
- <available file="${global.dependencies.file}" type="file" />
- </not>
- </or>
- </and>
- </condition>
- <condition property="gridsite-core.head">
- <and>
- <equals arg1="${org.gridsite-core.version}" arg2="HEAD" />
- <istrue value="${update}" />
- </and>
- </condition>
- <condition property="gridsite-core.tag">
- <and>
- <not>
- <equals arg1="${org.gridsite-core.version}" arg2="HEAD" />
- </not>
- <istrue value="${update}" />
- </and>
- </condition>
-
- </target>
-
- <!-- condition property tag = do not remove = -->
-
- <presetdef name="cvs-co">
- <cvs command="checkout" dest="${workspace.dir}" />
- </presetdef>
-
- <!-- =====================================================
- Self-update if required
- ===================================================== -->
-
- <!-- Update main GLite module -->
- <target name="org.glite" depends="get.glite.head, get.glite.tag"/>
- <target name="get.glite.head" if="glite.head">
- <cvs-co package="org.glite" />
- </target>
- <target name="get.glite.tag" if="glite.tag">
- <cvs-co package="org.glite"
- tag="${org.glite.version}" />
- </target>
-
- <!-- Update the current module -->
- <target name="org.gridsite.core" depends="get.gridsite-core.head, get.gridsite-core.tag"/>
- <target name="get.gridsite-core.head" if="gridsite-core.head">
- <cvs-co package="org.gridsite.core" />
- <fail>The org.glite and org.gridsite.core modules have been updated, please rerun the configuration file</fail>
- </target>
- <target name="get.gridsite-core.tag" if="gridsite-core.tag">
- <cvs-co package="org.gridsite.core"
- tag="${org.gridsite.core.version}" />
- <fail>The org.glite and org.gridsite.core modules have been updated, please rerun the configuration file</fail>
- </target>
-
- <!-- *****************************************************-->
- <!-- Development tools -->
- <!-- *****************************************************-->
-
- <!-- All development tools -->
- <target name="devtools" depends="oscheck,
- junitcheck,
- junit,
- chkstyle,
- jalopy,
- ant-contrib,
- cpptasks,
- egee-ant-ext"/>
-
- <!-- =====================================================
- External libraries
- ===================================================== -->
-
- <!-- All external libraries -->
- <target name="external" depends="oscheck,
- log4j"/>
-
- <!-- =====================================================
- GLite WMS modules
- ===================================================== -->
-
- <!-- component targets tag = do not remove = -->
-
- <!-- All project modules -->
- <target name="project" depends=""/>
-
-
- <!-- ====================================================
- Checkout all
- ==================================================== -->
-
- <!-- All libraries -->
- <target name="all" depends="oscheck,evaluate.cvs.tags,defaultenvchecks,org.glite,org.gridsite.core,devtools,external,project" />
-
- <!-- ====================================================
- Print dependecies to console
- ==================================================== -->
-
- <target name="dependencies">
- <concat>
- <fileset dir="." includes="dependencies.properties" />
- </concat>
- </target>
-
-</project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Common build properties file for the Gridsite Core modules
-
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
--->
-
-<project name="Gridsite Core common properties">
-
- <!-- Include build properties to allow overwriting
- of properties for subsystem -->
- <property name="subsystem.build.properties.file" value="./project/build.properties" />
- <property file="${subsystem.build.properties.file}" />
-
- <!-- ======================================================
- Define subsystem properties
- ====================================================== -->
-
- <!-- Subsystem name -->
- <property name="subsystem.name" value="${gridsite-core.subsystem.name}"/>
-
- <!-- Subsystem prefix -->
- <property name="subsystem.prefix" value="${gridsite-core.subsystem.prefix}"/>
-
- <!-- ======================================================
- Define general subsystem properties
- ====================================================== -->
-
- <!-- Include common subsystem properties -->
- <import file="${subsystem.general.properties.file}" />
-
- <!-- ======================================================
- Define extra properties here ...
- ====================================================== -->
-
-</project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2004 on behalf of the EU EGEE Project:
- The European Organization for Nuclear Research (CERN),
- Istituto Nazionale di Fisica Nucleare (INFN), Italy
- Datamat Spa, Italy
- Centre National de la Recherche Scientifique (CNRS), France
- CS Systeme d'Information (CSSI), France
- Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden
- Universiteit van Amsterdam (UvA), Netherlands
- University of Helsinki (UH.HIP), Finland
- University of Bergen (UiB), Norway
- Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom
-
- Common Ant task definition file for the Gridsite Core modules
-
- Authors: Alberto Di Meglio <alberto.di.meglio@cern.ch>
- Version info: $Id$
- Release: $Name$
-
- Revision history:
- $Log$
--->
-
-<project name="Gridsite Core common tasks and types definitions">
-
-<!-- ======================================================
- Subsystem task definitions
- ====================================================== -->
-
-</project>
\ No newline at end of file
+++ /dev/null
-module.version=1.1.14
-module.age=1
+++ /dev/null
-# Doxyfile 1.2.18
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME =
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY =
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
-# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en
-# (Japanese with english messages), Korean, Norwegian, Polish, Portuguese,
-# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish and Ukrainian.
-
-OUTPUT_LANGUAGE = English
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these class will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
-# members of a class in the documentation of that class as if those members were
-# ordinary class members. Constructors, destructors and assignment operators of
-# the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. It is allowed to use relative paths in the argument list.
-
-STRIP_FROM_PATH =
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower case letters. If set to YES upper case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# users are adviced to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explict @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# reimplements.
-
-INHERIT_DOCS = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 8
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consist of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C.
-# For instance some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
-# only. Doxygen will then generate output that is more tailored for Java.
-# For instance namespaces will be presented as packages, qualified scopes
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text.
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = . ../interface
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
-# *.h++ *.idl *.odl
-
-FILE_PATTERNS =
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
-# that are symbolic links (a Unix filesystem feature) are excluded from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-
-EXCLUDE_PATTERNS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-
-INPUT_FILTER =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = doxygen
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet
-
-HTML_STYLESHEET = doxygen.css
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output dir.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non empty doxygen will try to run
-# the html help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the Html help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = YES
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+,
-# or Internet explorer 4.0+). Note that for large projects the tree generation
-# can take a very long time. In such cases it is better to disable this feature.
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimised for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assigments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_XML = NO
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = NO
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse the
-# parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES tag can be used to specify one or more tagfiles.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or
-# super classes. Setting the tag to NO turns the diagrams off. Note that this
-# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
-# recommended to install and use dot, since it yield more powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found on the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermedate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
-
-# The CGI_NAME tag should be the name of the CGI script that
-# starts the search engine (doxysearch) with the correct parameters.
-# A script with this name will be generated by doxygen.
-
-CGI_NAME = search.cgi
-
-# The CGI_URL tag should be the absolute URL to the directory where the
-# cgi binaries are located. See the documentation of your http daemon for
-# details.
-
-CGI_URL =
-
-# The DOC_URL tag should be the absolute URL to the directory where the
-# documentation is located. If left blank the absolute path to the
-# documentation, with file:// prepended to it, will be used.
-
-DOC_URL =
-
-# The DOC_ABSPATH tag should be the absolute path to the directory where the
-# documentation is located. If left blank the directory on the local machine
-# will be used.
-
-DOC_ABSPATH =
-
-# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
-# is installed.
-
-BIN_ABSPATH = /usr/local/bin/
-
-# The EXT_DOC_PATHS tag can be used to specify one or more paths to
-# documentation generated for other projects. This allows doxysearch to search
-# the documentation for these projects as well.
-
-EXT_DOC_PATHS =
+++ /dev/null
-#
-# Andrew McNab and Shiv Kaushal, University of Manchester.
-# Copyright (c) 2002-5. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or
-# without modification, are permitted provided that the following
-# conditions are met:
-#
-# o Redistributions of source code must retain the above
-# copyright notice, this list of conditions and the following
-# disclaimer.
-# o Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials
-# provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-#---------------------------------------------------------------
-# For more information about GridSite: http://www.gridsite.org/
-#---------------------------------------------------------------
-
-include ../VERSION
-
-RPMCMD=$(shell if [ -x /usr/bin/rpmbuild ] ; then echo /usr/bin/rpmbuild; else echo rpm; fi)
-
-ifndef MYRPMDIR
-export MYRPMDIR=$(shell pwd)/../RPMTMP
-endif
-
-ifndef prefix
-export prefix=/usr/local
-endif
-
-ifndef MYCFLAGS
-export MYCFLAGS=-I. -I../interface -I/usr/include/httpd -I/usr/include/apr-0 -I/opt/glite/include
-endif
-
-ifndef MYLDFLAGS
-export MYLDFLAGS=-L.
-endif
-
-#
-# Build
-#
-
-build: apidoc \
- libgridsite.so.$(VERSION) libgridsite.a htcp mod_gridsite.so \
- urlencode findproxyfile real-gridsite-admin.cgi gsexec \
- # gridsite-delegation.cgi # htproxyput
-
-build: libgridsite_globus.so.$(VERSION) libgridsite_globus.a
-
-# First, normal versions using system OpenSSL rather than Globus OpenSSL
-
-libgridsite.so.$(VERSION): grst_x509.o grst_gacl.o grst_xacml.o grst_http.o grst_asn1.o grst_htcp.o
- gcc -shared -Wl,-soname,libgridsite.so.$(MINOR_VERSION) \
- -o libgridsite.so.$(PATCH_VERSION) grst_x509.o grst_gacl.o grst_xacml.o grst_http.o grst_asn1.o grst_htcp.o
-
-libgridsite.a: grst_x509.o grst_gacl.o grst_xacml.o grst_http.o grst_asn1.o grst_htcp.o
- ar src libgridsite.a grst_x509.o grst_gacl.o grst_xacml.o grst_http.o grst_asn1.o grst_htcp.o
-
-grst_x509.o: grst_x509.c ../interface/gridsite.h
- gcc -g $(MYCFLAGS) \
- -I/usr/kerberos/include -c grst_x509.c
-
-grst_gacl.o: grst_gacl.c ../interface/gridsite.h
- gcc -g $(MYCFLAGS) \
- -I/usr/kerberos/include `xml2-config --cflags` -c grst_gacl.c
-
-grst_xacml.o: grst_xacml.c ../interface/gridsite.h
- gcc -g $(MYCFLAGS) \
- -I/usr/kerberos/include `xml2-config --cflags` -c grst_xacml.c
-
-grst_http.o: grst_http.c ../interface/gridsite.h
- gcc -g $(MYCFLAGS) \
- -I/usr/kerberos/include -c grst_http.c
-
-grst_asn1.o: grst_asn1.c ../interface/gridsite.h
- gcc -g $(MYCFLAGS) \
- -I/usr/kerberos/include -c grst_asn1.c
-
-grst_htcp.o: grst_htcp.c ../interface/gridsite.h
- gcc -g $(MYCFLAGS) \
- -I/usr/kerberos/include -c grst_htcp.c
-
-# Then build versions using Globus OpenSSL if configured
-
-ifdef OPENSSL_GLOBUS_LIBS
-
-libgridsite_globus.so.$(VERSION): \
- grst_x509_globus.o grst_gacl_globus.o grst_http_globus.o \
- grst_asn1_globus.o grst_xacml_globus.o grst_htcp_globus.o
- gcc -shared -Wl,-soname,libgridsite_globus.so.$(MINOR_VERSION) \
- -o libgridsite_globus.so.$(PATCH_VERSION) \
- grst_x509_globus.o grst_gacl_globus.o grst_xacml_globus.o grst_http_globus.o grst_asn1_globus.o
-
-libgridsite_globus.a: grst_x509_globus.o grst_gacl_globus.o grst_http_globus.o grst_asn1_globus.o
- ar src libgridsite_globus.a \
- grst_x509_globus.o grst_gacl_globus.o grst_http_globus.o grst_asn1_globus.o
-
-grst_x509_globus.o: grst_x509.c ../interface/gridsite.h
- gcc -g $(MYCFLAGS) $(OPENSSL_GLOBUS_FLAGS) \
- -I/usr/kerberos/include -c grst_x509.c \
- -o grst_x509_globus.o
-
-grst_gacl_globus.o: grst_gacl.c ../interface/gridsite.h
- gcc -g $(MYCFLAGS) $(OPENSSL_GLOBUS_FLAGS) \
- -I/usr/kerberos/include `xml2-config --cflags` -c grst_gacl.c \
- -o grst_gacl_globus.o
-
-grst_xacml_globus.o: grst_xacml.c ../interface/gridsite.h
- gcc -g $(MYCFLAGS) $(OPENSSL_GLOBUS_FLAGS) \
- -I/usr/kerberos/include `xml2-config --cflags` -c grst_xacml.c \
- -o grst_xacml_globus.o
-
-grst_http_globus.o: grst_http.c ../interface/gridsite.h
- gcc -g $(MYCFLAGS) $(OPENSSL_GLOBUS_FLAGS) \
- -I/usr/kerberos/include -c grst_http.c \
- -o grst_http_globus.o
-
-grst_asn1_globus.o: grst_asn1.c ../interface/gridsite.h
- gcc -g $(MYCFLAGS) $(OPENSSL_GLOBUS_FLAGS) \
- -I/usr/kerberos/include -c grst_asn1.c \
- -o grst_asn1_globus.o
-
-grst_htcp_globus.o: grst_htcp.c ../interface/gridsite.h
- gcc -g $(MYCFLAGS) $(OPENSSL_GLOBUS_FLAGS) \
- -I/usr/kerberos/include -c grst_htcp.c \
- -o grst_htcp_globus.o
-
-else
-
-libgridsite_globus.so.$(VERSION): libgridsite.so.$(VERSION)
- cp -f libgridsite.so.$(VERSION) libgridsite_globus.so.$(VERSION)
-
-libgridsite_globus.a: libgridsite.a
- cp -f libgridsite.a libgridsite_globus.a
-
-endif
-
-gsexec: gsexec.c gsexec.h
- gcc -g -DVERSION=\"$(PATCH_VERSION)\" $(MYCFLAGS) \
- -o gsexec gsexec.c
-
-urlencode: urlencode.c libgridsite.a
- gcc -g -DVERSION=\"$(PATCH_VERSION)\" $(MYCFLAGS) \
- -o urlencode urlencode.c -L. \
- -I/usr/kerberos/include -lgridsite
-
-htcp: htcp.c libgridsite.a
- gcc -g -DVERSION=\"$(PATCH_VERSION)\" $(MYCFLAGS) \
- -o htcp htcp.c -L. \
- -I/usr/kerberos/include \
- `curl-config --cflags` `curl-config --libs` -lgridsite
-
-mod_gridsite.so: mod_gridsite.c mod_ssl-private.h libgridsite.a
- gcc -g $(MYCFLAGS) -shared -Wl,-soname=gridsite_module \
- -I/usr/kerberos/include \
- -I/usr/include/libxml2 \
- -DVERSION=\"$(VERSION)\" -o mod_gridsite.so \
- mod_gridsite.c $(MYLDFLAGS) -lxml2 -lm -lz -lgridsite
-
-real-gridsite-admin.cgi: grst_admin_main.c grst_admin_gacl.c \
- grst_admin_file.c grst_admin.h
- gcc -g $(MYCFLAGS) $(MYLDFLAGS) -o real-gridsite-admin.cgi \
- grst_admin_main.c \
- grst_admin_gacl.c \
- grst_admin_file.c \
- -I/usr/kerberos/include \
- -DVERSION=\"$(VERSION)\" -lgridsite -lssl -lcrypto -lxml2 -lz -lm
-
-findproxyfile: findproxyfile.c libgridsite.a
- gcc -g -DVERSION=\"$(PATCH_VERSION)\" $(MYCFLAGS) $(MYLDFLAGS) \
- -o findproxyfile findproxyfile.c -L. \
- -I/usr/kerberos/include -lgridsite \
- -lssl -lcrypto -lxml2 -lz -lm
-
-showx509exts: showx509exts.c libgridsite.a
- gcc -g -DVERSION=\"$(PATCH_VERSION)\" $(MYCFLAGS) $(MYLDFLAGS) \
- -o showx509exts showx509exts.c -L. \
- -I/usr/kerberos/include \
- -lgridsite \
- -lssl -lcrypto -lxml2 -lz -lm
-
-apidoc:
- doxygen Doxyfile
- mkdir -p ../doc/doxygen
- cp -f doxygen/*.html doxygen/*.css doxygen/*.png ../doc/doxygen
- cd ../doc ; for i in *.1 *.8 ; do ../src/roffit < $$i \
- > $$i.html ; done
-
-gaclexample: gaclexample.c libgridsite.a
- gcc -g -o gaclexample gaclexample.c -I. -L. \
- -I/usr/kerberos/include -lgridsite \
- -lssl -lcrypto -lxml2 -lz -lm
-
-xacmlexample: xacmlexample.c libgridsite.a
- gcc -g -o xacmlexample xacmlexample.c -I. -L. \
- -I/usr/kerberos/include -lgridsite \
- -lssl -lcrypto -lxml2 -lz -lm
-
-#
-# Delegation machinery, including SOAP delegation portType. To build this
-# you need to install gSOAP and set GSOAPDIR to the directory containing
-# soapcpp2 and stdsoap2.h (unless GSOAPDIR is set already)
-#
-
-ifndef GSOAPDIR
-export GSOAPDIR=/usr/local/lib/gsoap
-endif
-
-delegation.wsdl: delegation.h
- ls -lR $(GSOAPDIR)
- $(GSOAPDIR)/bin/soapcpp2 -c delegation.h
-
-libstdsoap2.a: $(GSOAPDIR)/stdsoap2.c
- gcc -g -c -DWITH_OPENSSL $(GSOAPDIR)/stdsoap2.c
- ar src libstdsoap2.a stdsoap2.o
-
-gridsite-delegation.cgi: grst-delegation.c delegation.h delegation.wsdl \
- soapC.c soapServer.c
- gcc -g $(MYCFLAGS) $(MYLDFLAGS) -o gridsite-delegation.cgi \
- grst-delegation.c \
- -I/usr/kerberos/include -I$(GSOAPDIR)/include \
- -DVERSION=\"$(VERSION)\" -L$(GSOAPDIR)/lib \
- soapC.c soapServer.c -lgsoap \
- -lgridsite -lcurl -lz -lssl -lcrypto -lxml2 -lm
-
-htproxyput: htproxyput.c delegation.h delegation.wsdl \
- soapC.c soapServer.c
- gcc -g $(MYCFLAGS) $(MYLDFLAGS) -o htproxyput \
- htproxyput.c \
- -I/usr/kerberos/include \
- -g -DVERSION=\"$(VERSION)\" \
- -I$(GSOAPDIR)/include -DWITH_OPENSSL -L$(GSOAPDIR)/lib \
- soapC.c soapClient.c -lgsoap \
- -lgridsite -lcurl -lz -lssl -lcrypto -lxml2 -lm
-
-proxyput-example: proxyput-example.c delegation.h delegation.wsdl \
- soapC.c soapServer.c
- gcc -g $(MYCFLAGS) $(MYLDFLAGS) -o proxyput-example \
- proxyput-example.c \
- -I/usr/kerberos/include \
- -g -DVERSION=\"$(VERSION)\" \
- -I$(GSOAPDIR) -DWITH_OPENSSL \
- soapC.c soapClient.c libstdsoap2.a \
- -lgridsite -lcurl -lz -lssl -lcrypto -lxml2 -lm
-
-clean:
-
-#
-# Install
-#
-
-install: apidoc
- mkdir -p $(prefix)/include \
- $(prefix)/lib \
- $(prefix)/bin \
- $(prefix)/sbin \
- $(prefix)/share/man/man1 \
- $(prefix)/share/man/man8 \
- $(prefix)/lib/httpd/modules \
- $(prefix)/share/doc/gridsite-$(PATCH_VERSION)
- cp -f ../interface/gridsite.h $(prefix)/include
- cp -f ../interface/gridsite-gacl.h $(prefix)/include
- cp -f urlencode $(prefix)/bin
- cp -f findproxyfile $(prefix)/bin
- cp -f real-gridsite-admin.cgi $(prefix)/sbin
- cp -f libgridsite.a $(prefix)/lib
- cp -f libgridsite.so.$(PATCH_VERSION) $(prefix)/lib
- ln -sf libgridsite.so.$(PATCH_VERSION) \
- $(prefix)/lib/libgridsite.so
- ln -sf libgridsite.so.$(PATCH_VERSION) \
- $(prefix)/lib/libgridsite.so.$(MAJOR_VERSION)
- ln -sf libgridsite.so.$(PATCH_VERSION) \
- $(prefix)/lib/libgridsite.so.$(MINOR_VERSION)
- cp -f libgridsite_globus.a $(prefix)/lib
- cp -f libgridsite_globus.so.$(PATCH_VERSION) $(prefix)/lib
- ln -sf libgridsite_globus.so.$(PATCH_VERSION) \
- $(prefix)/lib/libgridsite_globus.so
- ln -sf libgridsite_globus.so.$(PATCH_VERSION) \
- $(prefix)/lib/libgridsite_globus.so.$(MAJOR_VERSION)
- ln -sf libgridsite_globus.so.$(PATCH_VERSION) \
- $(prefix)/lib/libgridsite_globus.so.$(MINOR_VERSION)
- cp -f ../CHANGES ../README ../INSTALL ../LICENSE ../VERSION \
- $(prefix)/share/doc/gridsite-$(PATCH_VERSION)
- cp -f ../doc/*.html ../doc/*.conf ../doc/*.1 ../doc/*.8 ../doc/*.sh \
- ../doc/*.wsdl $(prefix)/share/doc/gridsite-$(VERSION)
- cp -f ../doc/*.1 $(prefix)/share/man/man1
- cp -f ../doc/*.8 $(prefix)/share/man/man8
- gzip -f $(prefix)/share/man/man1/*.1
- gzip -f $(prefix)/share/man/man8/*.8
- cp -f htcp $(prefix)/bin
- ln -sf htcp $(prefix)/bin/htls
- ln -sf htcp $(prefix)/bin/htll
- ln -sf htcp $(prefix)/bin/htrm
- ln -sf htcp $(prefix)/bin/htmkdir
- ln -sf htcp $(prefix)/bin/htmv
- ln -sf htcp $(prefix)/bin/htping
- ln -sf htcp $(prefix)/bin/htfind
- cp -f gsexec $(prefix)/sbin
- cp -f mod_gridsite.so $(prefix)/lib/httpd/modules
-
-#
-# Distributions
-#
-
-# source files tarball
-dist:
- mkdir -p ../gridsite-$(PATCH_VERSION)/src \
- ../gridsite-$(PATCH_VERSION)/doc \
- ../gridsite-$(PATCH_VERSION)/interface
- cp -f ../VERSION ../README ../LICENSE ../CHANGES ../INSTALL \
- ../gridsite-$(PATCH_VERSION)
- cp -f Makefile grst*.c htproxyput.c proxyput-example.c htcp.c \
- urlencode.c findproxyfile.c gaclexample.c mod_gridsite.c \
- delegation.h grst_admin.h mod_ssl-private.h \
- gsexec.c gsexec.h \
- roffit gridsite.spec \
- Doxyfile doxygen.css doxyheader.html \
- ../gridsite-$(PATCH_VERSION)/src
- cp -f ../doc/*.html ../doc/*.1 ../doc/*.8 ../doc/*.conf ../doc/*.sh \
- ../doc/*.wsdl ../gridsite-$(PATCH_VERSION)/doc
- cp -f ../interface/*.h \
- ../gridsite-$(PATCH_VERSION)/interface
- cd .. ; tar zcvf gridsite-$(PATCH_VERSION).src.tar.gz \
- gridsite-$(PATCH_VERSION)
- rm -Rf ../gridsite-$(PATCH_VERSION)
-
-
-# binary tarball distribution for htcp users
-htcp-bin: htcp
- mkdir -p ../htcp-bin-$(PATCH_VERSION)/bin \
- ../htcp-bin-$(PATCH_VERSION)/man/man1
- cp -f ../doc/README.htcp-bin ../htcp-bin-$(PATCH_VERSION)
- cp -f htcp ../htcp-bin-$(PATCH_VERSION)/bin
- cp -f ../doc/htcp.1 ../doc/htrm.1 ../doc/htls.1 ../doc/htmkdir.1 \
- ../doc/htll.1 ../doc/htmv.1 ../doc/htping.1 ../doc/htfind.1 \
- ../htcp-bin-$(PATCH_VERSION)/man/man1
- ln -sf htcp ../htcp-bin-$(PATCH_VERSION)/bin/htls
- ln -sf htcp ../htcp-bin-$(PATCH_VERSION)/bin/htll
- ln -sf htcp ../htcp-bin-$(PATCH_VERSION)/bin/htrm
- ln -sf htcp ../htcp-bin-$(PATCH_VERSION)/bin/htmkdir
- ln -sf htcp ../htcp-bin-$(PATCH_VERSION)/bin/htmv
- ln -sf htcp ../htcp-bin-$(PATCH_VERSION)/bin/htping
- ln -sf htcp ../htcp-bin-$(PATCH_VERSION)/bin/htfind
- cd ../htcp-bin-$(VERSION) ; tar zcvf ../htcp-$(VERSION).bin.tar.gz .
- rm -Rf ../htcp-bin-$(PATCH_VERSION)
-
-# RPM targets: build and RPMs go into subdirectories of ../RPMTMP/
-rpm: dist gridsite.spec
- rm -Rf $(MYRPMDIR)/BUILDROOT $(MYRPMDIR)/BUILD
- mkdir -p $(MYRPMDIR)/SOURCES $(MYRPMDIR)/SPECS $(MYRPMDIR)/BUILD \
- $(MYRPMDIR)/SRPMS $(MYRPMDIR)/RPMS/i386 $(MYRPMDIR)/BUILDROOT
- cp -f ../gridsite-$(PATCH_VERSION).src.tar.gz $(MYRPMDIR)/SOURCES
- cp -f gridsite.spec $(MYRPMDIR)/SPECS
- export MYPREFIX=/usr ; export MYVERSION=$(PATCH_VERSION) ; \
- $(RPMCMD) --define "_topdir $(MYRPMDIR)" \
- -ba --buildroot $(MYRPMDIR)/BUILDROOT gridsite.spec
-
-
-wtf:
- pwd
- printenv
- ls -l
- ls -lR /usr/local/
- ls -lR $(GSOAPDIR)
+++ /dev/null
-//gsoap ns service name: delegation
-//gsoap ns service style: rpc
-//gsoap ns service encoding: encoded
-//gsoap ns service namespace: http://www.gridsite.org/ns/delegation.wsdl
-//gsoap ns service location: http://localhost/delegserver.cgi
-
-struct ns__putProxyResponse { } ;
-
-//gsoap ns schema namespace: urn:delegation
-int ns__getProxyReq(char *delegationID, char **request);
-int ns__putProxy(char *delegationID, char *proxy,
- struct ns__putProxyResponse *unused);
+++ /dev/null
-H1 { text-align: center; }
-CAPTION { font-weight: bold }
-A.qindex {}
-A.qindexRef {}
-A.el { text-decoration: none; font-weight: bold }
-A.elRef { font-weight: bold }
-A.code { text-decoration: none; font-weight: normal; color: #4444ee }
-A.codeRef { font-weight: normal; color: #4444ee }
-A:hover { text-decoration: none; background-color: #f2f2ff }
-DL.el { margin-left: -1cm }
-DIV.fragment { width: 100%; border: none; background-color: #eeeeee }
-DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }
-TD.md { background-color: #f2f2ff; font-weight: bold; }
-TD.mdname1 { background-color: #f2f2ff; font-weight: bold; color: #602020; }
-TD.mdname { background-color: #f2f2ff; font-weight: bold; color: #602020; width: 600px; }
-DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold }
-DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller }
-XXBODY { background: white }
-TD.indexkey {
- background-color: #eeeeff;
- font-weight: bold;
- padding-right : 10px;
- padding-top : 2px;
- padding-left : 10px;
- padding-bottom : 2px;
- margin-left : 0px;
- margin-right : 0px;
- margin-top : 2px;
- margin-bottom : 2px
-}
-TD.indexvalue {
- background-color: #eeeeff;
- font-style: italic;
- padding-right : 10px;
- padding-top : 2px;
- padding-left : 10px;
- padding-bottom : 2px;
- margin-left : 0px;
- margin-right : 0px;
- margin-top : 2px;
- margin-bottom : 2px
-}
-span.keyword { color: #008000 }
-span.keywordtype { color: #604020 }
-span.keywordflow { color: #e08000 }
-span.comment { color: #800000 }
-span.preprocessor { color: #806020 }
-span.stringliteral { color: #002080 }
-span.charliteral { color: #008080 }
+++ /dev/null
-<p><a href=http://www.gridsite.org/>GridSite</a> Version 1.1.x
+++ /dev/null
-/*
- Copyright (c) 2002-4, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef VERSION
-#define VERSION "0.0.0"
-#endif
-
-#define _GNU_SOURCE
-
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <getopt.h>
-
-#include "gridsite.h"
-
-void printsyntax(char *argv0)
-{
- char *p;
-
- p = rindex(argv0, '/');
- if (p != NULL) ++p;
- else p = argv0;
-
- fprintf(stderr, "%s [--outsidecache] [--proxycache=PATH] "
- "[--delegation-id=DELEGATION-ID] [--user-dn=USER-DN]\n"
- "(Version: %s)\n", p, VERSION);
-}
-
-#define GRST_PROXY_CACHE "/var/www/proxycache"
-
-int main(int argc, char *argv[])
-{
- char *delegation_id = "_", *proxycache = "", *user_dn = "",
- *proxyfile = NULL;
- int c, outsidecache = 0, verbose = 0, option_index;
- struct option long_options[] = { {"verbose", 0, 0, 'v'},
- {"outsidecache", 0, 0, 0},
- {"proxycache", 1, 0, 0},
- {"delegation-id", 1, 0, 0},
- {"user-dn", 1, 0, 0},
- {0, 0, 0, 0} };
-
- if (argc == 1)
- {
- printsyntax(argv[0]);
- return 0;
- }
-
- while (1)
- {
- option_index = 0;
-
- c = getopt_long(argc, argv, "v", long_options, &option_index);
-
- if (c == -1) break;
- else if (c == 0)
- {
- if (option_index == 1) outsidecache = 1;
- else if (option_index == 2) proxycache = optarg;
- else if (option_index == 3) delegation_id = optarg;
- else if (option_index == 4) user_dn = optarg;
- }
- else if (c == 'v') ++verbose;
- }
-
- if (*user_dn != '\0') /* try to find in proxy cache */
- {
- if ((proxycache == NULL) || (*proxycache == '\0'))
- proxycache = getenv("GRST_PROXY_CACHE");
-
- if ((proxycache == NULL) || (*proxycache == '\0'))
- proxycache = GRST_PROXY_CACHE;
-
- proxyfile = GRSTx509CachedProxyFind(proxycache, delegation_id, user_dn);
- }
-
- if (((proxyfile == NULL) || (*proxyfile == '\0')) && outsidecache)
- {
- proxyfile = GRSTx509FindProxyFileName();
- }
-
- if ((proxyfile != NULL) && (*proxyfile != '\0'))
- {
- puts(proxyfile);
- return 0;
- }
-
- fputs("No proxy file found\n", stderr);
-
- return 1;
-}
+++ /dev/null
-/*
- Copyright (c) 2002-3, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*---------------------------------------------------------------*
- * For more about GridSite: http://www.gridsite.org/ *
- *---------------------------------------------------------------*/
-
-/*
- Example program using GACL
-
- Build with:
-
- gcc -o gaclexample gaclexample.c -L. -I. -lgridsite -lxml2 -lz -lm
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <gridsite.h>
-
-int main()
-{
- GRSTgaclCred *cred, *usercred;
- GRSTgaclEntry *entry;
- GRSTgaclAcl *acl1, *acl2;
- GRSTgaclUser *user;
- GRSTgaclPerm perm0, perm1, perm2;
- FILE *fp;
-
- /* must initialise GACL before using it */
-
- GRSTgaclInit();
-
- /* build up an ACL, starting with a credential */
-
- cred = GRSTgaclCredNew("person");
-
- GRSTgaclCredAddValue(cred, "dn", "/O=Grid/CN=Mr Grid Person");
-
- /* create an entry to put it in */
-
- entry = GRSTgaclEntryNew();
-
- /* add the credential to it */
-
- GRSTgaclEntryAddCred(entry, cred);
-
- /* add another credential */
-
- cred = GRSTgaclCredNew("dn-list");
- GRSTgaclCredAddValue(cred, "url", "example-dn-list");
- GRSTgaclEntryAddCred(entry, cred);
-
- fp = fopen("example-dn-list", "w");
- fputs("/O=Grid/CN=Mr Grid Person\n", fp);
- fclose(fp);
-
- /* associate some permissions and denials to the credential */
-
- GRSTgaclEntryAllowPerm( entry, GRST_PERM_READ);
- GRSTgaclEntryAllowPerm( entry, GRST_PERM_WRITE);
- GRSTgaclEntryAllowPerm( entry, GRST_PERM_ADMIN);
- GRSTgaclEntryDenyPerm( entry, GRST_PERM_ADMIN);
- GRSTgaclEntryDenyPerm( entry, GRST_PERM_LIST);
-
- perm0 = GRST_PERM_READ | GRST_PERM_WRITE;
-
- printf("test perm should be %d\n", perm0);
-
- /* create a new ACL and add the entry to it */
-
- acl1 = GRSTgaclAclNew();
-
- GRSTgaclAclAddEntry(acl1, entry);
-
- /* create a GRSTgaclUser to compare with the ACL */
-
- usercred = GRSTgaclCredNew("person");
-
- GRSTgaclCredAddValue(usercred, "dn", "/O=Grid/CN=Mr Grid Person");
-
- user = GRSTgaclUserNew(usercred);
-
- GRSTgaclUserSetDNlists(user, getcwd(NULL, 0));
- printf("DN Lists dir %s\n", getcwd(NULL, 0));
-
-// putenv("GRST_DN_LISTS=.");
-
- perm1 = GRSTgaclAclTestUser(acl1, user);
-
- printf("test /O=Grid/CN=Mr Grid Person in acl = %d\n", perm1);
-
- /* print and save the whole ACL */
-
- GRSTgaclAclPrint(acl1, stdout);
-
- GRSTgaclAclSave(acl1, "example.gacl");
-
- puts("gridacl.out saved");
-
- puts("");
-
- /* load the ACL back off the disk, print and test it */
-
- acl2 = GRSTgaclAclLoadFile("example.gacl");
-
- puts("gridacl.out loaded");
-
- if (acl2 != NULL) GRSTgaclAclPrint(acl2, stdout); else puts("acl2 is NULL");
-
- perm2 = GRSTgaclAclTestUser(acl2, user);
-
- printf("test /O=Grid/CN=Mr Grid Person in acl = %d\n", perm2);
-
- if (perm1 != perm0) return 1;
- if (perm2 != perm0) return 2;
-
- return 0;
-}
+++ /dev/null
-Name: gridsite
-Version: %(echo ${MYVERSION:-1.1.x})
-Release: 1
-Summary: GridSite
-Copyright: Modified BSD
-Group: System Environment/Daemons
-Source: %{name}-%{version}.src.tar.gz
-Prefix: %(echo ${MYPREFIX:-/usr})
-URL: http://www.gridsite.org/
-Vendor: GridPP
-Requires: libxml2
-#Buildrequires: libxml2-devel,curl-ssl-devel,httpd-devel
-Packager: Andrew McNab <Andrew.McNab@manchester.ac.uk>
-
-%description
-GridSite adds GSI, VOMS and GACL support to Apache 2.0 (mod_gridsite),
-a library for manipulating these technologies (libgridsite), and CGI
-programs for interactive management of HTTP(S) servers (gridsite-admin.cgi)
-
-See %(echo ${MYPREFIX:-/usr})/share/doc/gridsite-%{version} and
-http://www.gridsite.org/ for details.
-
-%package -n htcp
-Group: Applications/Internet
-Summary: HTTP(S) read/write client
-Requires: curl
-
-%description -n htcp
-htcp is a client to fetch files or directory listings from remote
-servers using HTTP or HTTPS, or to put or delete files or directories
-onto remote servers using HTTPS. htcp is similar to scp(1), but uses
-HTTP/HTTPS rather than ssh as its transfer protocol.
-
-%package gsexec
-Group: Applications/Internet
-Summary: gsexec binary for the Apache HTTP server
-
-%description gsexec
-This package includes the /usr/sbin/gsexec binary which can be installed
-to allow the Apache HTTP server to run CGI programs (and any programs
-executed by SSI pages) as a user other than the 'apache' user. gsexec
-is a drop-in replacement for suexec, with extended functionality for use
-with GridSite and Grid Security credentials.
-
-%prep
-
-%setup
-
-%build
-cd src
-make prefix=$RPM_BUILD_ROOT/%(echo ${MYPREFIX:-/usr}) \
-GSOAPDIR=$GSOAPDIR OPENSSL_FLAGS=$OPENSSL_FLAGS \
-OPENSSL_LIBS=$OPENSSL_LIBS FLAVOR_EXT=$FLAVOR_EXT
-
-%install
-cd src
-make install prefix=$RPM_BUILD_ROOT/%(echo ${MYPREFIX:-/usr}) \
-GSOAPDIR=$GSOAPDIR OPENSSL_FLAGS=$OPENSSL_FLAGS \
-OPENSSL_LIBS=$OPENSSL_LIBS FLAVOR_EXT=$FLAVOR_EXT
-
-%post
-/sbin/ldconfig
-ln -sf %(echo ${MYPREFIX:-/usr})/share/doc/gridsite-%{version} \
- %(echo ${MYPREFIX:-/usr})/share/doc/gridsite
-
-#%postun
-rm -f %(echo ${MYPREFIX:-/usr})/share/doc/gridsite
-
-%files
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/lib/libgridsite.so.%{version}
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/lib/libgridsite.so
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/lib/libgridsite_globus.so.%{version}
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/lib/libgridsite_globus.so
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/bin/urlencode
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/bin/findproxyfile
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/share/doc/gridsite-%{version}
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/share/man/man1/urlencode.1.gz
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/share/man/man1/findproxyfile.1.gz
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/share/man/man8/mod_gridsite.8.gz
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/include/gridsite.h
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/include/gridsite-gacl.h
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/lib/libgridsite.a
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/lib/libgridsite_globus.a
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/lib/httpd/modules/mod_gridsite.so
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/sbin/real-gridsite-admin.cgi
-
-%files -n htcp
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/bin/htcp
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/bin/htls
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/bin/htll
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/bin/htrm
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/bin/htmkdir
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/bin/htmv
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/bin/htping
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/bin/htfind
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/share/man/man1/htcp.1.gz
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/share/man/man1/htrm.1.gz
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/share/man/man1/htls.1.gz
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/share/man/man1/htll.1.gz
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/share/man/man1/htmkdir.1.gz
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/share/man/man1/htmv.1.gz
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/share/man/man1/htping.1.gz
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/share/man/man1/htfind.1.gz
-
-%files gsexec
-%attr(4510, root, apache) %(echo ${MYPREFIX:-/usr})/sbin/gsexec
-%attr(-, root, root) %(echo ${MYPREFIX:-/usr})/share/man/man8/gsexec.8.gz
+++ /dev/null
-/*
- Copyright (c) 2002-4, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*---------------------------------------------------------------------------*
- * This program is part of GridSite: http://www.gridpp.ac.uk/authz/gridsite/ *
- *---------------------------------------------------------------------------*/
-
-#ifndef VERSION
-#define VERSION "0.0.1"
-#endif
-
-#define _GNU_SOURCE
-#include <stdio.h>
-
-#include <time.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <openssl/rsa.h>
-#include <openssl/pem.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/bio.h>
-#include <openssl/des.h>
-#include <openssl/rand.h>
-
-#include <curl/curl.h>
-/* #include <gacl.h> */
-
-#include "gridsite.h"
-
-#include "soapH.h"
-#include "delegation.nsmap"
-
-#include <time.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <openssl/rsa.h>
-#include <openssl/pem.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/bio.h>
-#include <openssl/des.h>
-#include <openssl/rand.h>
-
-#define GRST_KEYSIZE 512
-#define GRST_PROXYCACHE "/../proxycache/"
-#define GRST_SUPPORT_G_HTTPS
-
-#ifdef GRST_SUPPORT_G_HTTPS
-void GRSThttpError(char *status)
-{
- printf("Status: %s\n", status);
- printf("Server-CGI: GridSite %s\n", VERSION);
- printf("Content-Length: %d\n", 2 * strlen(status) + 58);
- puts("Content-Type: text/html\n");
-
- printf("<head><title>%s</title></head>\n", status);
- printf("<body><h1 >%s</h1 ></body>\n", status);
-
- exit(0);
-}
-
-int GRSTmethodPutProxy(char *delegation_id, char *user_dn)
-/* return 0 on success; non-zero on error */
-{
- int c, len = 0, i;
- char *docroot, *contentlen, *contenttype, *proxychain, *proxydir;
- FILE *fp;
-
- if (((contenttype = getenv("CONTENT_TYPE")) == NULL) ||
- (strcmp(contenttype, "application/x-x509-user-cert-chain") != 0))
- return 2;
-
- contentlen = getenv("CONTENT_LENGTH");
- if (contentlen == NULL) return 2;
- len = atoi(contentlen);
-
- if ((delegation_id == NULL) || (*delegation_id == '\0'))
- delegation_id = "_";
-
- docroot = getenv("DOCUMENT_ROOT");
- asprintf(&proxydir, "%s/%s", docroot, GRST_PROXYCACHE);
-
- if ((user_dn == NULL) || (user_dn[0] == '\0') ||
- (GRSTx509CacheProxy(proxydir, delegation_id, user_dn, proxychain)
- != GRST_RET_OK))
- {
- return GRST_RET_FAILED;
- }
-
- free(proxydir);
-
- return GRST_RET_OK;
-}
-#endif
-
-int main(int argn, char *argv[])
-{
- char *docroot, *method, *request, *p, *client_dn, *user_dn,
- *delegation_id, *reqtxt, *proxydir;
- struct soap soap;
-
-chdir("/var/tmp");
-
- method = getenv("REQUEST_METHOD");
- if (strcmp(method, "POST") == 0)
- {
- soap_init(&soap);
- soap_serve(&soap); /* CGI application */
- return 0;
- }
-
-#ifdef GRST_SUPPORT_G_HTTPS
- docroot = getenv("DOCUMENT_ROOT");
-
- request = strdup(getenv("REQUEST_URI"));
- p = index(request, '?');
- if (p != NULL) *p = '\0';
-
-
- /* non HTTP POST methods - ie special G-HTTPS methods */
-
- delegation_id = getenv("HTTP_DELEGATION_ID");
- if ((delegation_id == NULL) || (*delegation_id == '\0')) delegation_id = "_";
-
- user_dn = NULL;
- client_dn = getenv("SSL_CLIENT_S_DN");
- if (client_dn != NULL)
- {
- user_dn = strdup(client_dn);
-
- /* we assume here that mod_ssl has verified proxy chain already ... */
-
- p = strstr(user_dn, "/CN=proxy");
- if (p != NULL) *p = '\0';
-
- p = strstr(user_dn, "/CN=limited proxy");
- if (p != NULL) *p = '\0';
- }
-
- if (user_dn == NULL) /* all methods require client auth */
- {
- GRSThttpError("403 Forbidden");
- }
- else if (strcmp(method, "GET-PROXY-REQ") == 0)
- {
- docroot = getenv("DOCUMENT_ROOT");
- asprintf(&proxydir, "%s/%s", docroot, GRST_PROXYCACHE);
-
- if (GRSTx509MakeProxyRequest(&reqtxt, proxydir,
- delegation_id, user_dn) == 0)
- {
- puts("Status: 200 OK");
- puts("Content-Type: application/x-x509-cert-request");
- printf("Content-Length: %d\n\n", strlen(reqtxt));
- fputs(reqtxt, stdout);
- free(proxydir);
- return 0;
- }
-
- puts("Status: 500 Internal Server Error\n");
- free(proxydir);
- return 0;
- }
- else if (strcmp(method, "PUT-PROXY-CERT") == 0)
- {
- if (GRSTmethodPutProxy(delegation_id, user_dn) == 0)
- {
- puts("Status: 200 OK\n");
- return 0;
- }
-
- puts("Status: 500 Internal Server Error\n");
- return 0;
- }
- else
- {
- GRSThttpError("501 Method Not Implemented");
- }
-#endif
-}
-
-int ns__getProxyReq(struct soap *soap, char *delegation_id,
- char **request)
-{
- char *p, *client_dn, *user_dn, *docroot, *proxydir;
-
- user_dn = NULL;
- client_dn = getenv("SSL_CLIENT_S_DN");
- if (client_dn != NULL)
- {
- user_dn = strdup(client_dn);
-
- /* we assume here that mod_ssl has verified proxy chain already ... */
-
- p = strstr(user_dn, "/CN=proxy");
- if (p != NULL) *p = '\0';
-
- p = strstr(user_dn, "/CN=limited proxy");
- if (p != NULL) *p = '\0';
- }
-
- if ((delegation_id == NULL) || (*delegation_id == '\0')) delegation_id = "_";
-
- docroot = getenv("DOCUMENT_ROOT");
- asprintf(&proxydir, "%s/%s", docroot, GRST_PROXYCACHE);
-
- if ((user_dn != NULL) && (user_dn[0] != '\0') &&
- (GRSTx509MakeProxyRequest(request, proxydir,
- delegation_id, user_dn) == 0))
- {
- return SOAP_OK;
- }
-
- return SOAP_ERR;
-}
-
-int ns__putProxy(struct soap *soap, char *delegation_id,
- char *proxy,
- struct ns__putProxyResponse *unused)
-{
- int fd, c, len = 0, i;
- char *docroot, *proxydir, *p, *client_dn, *user_dn;
-
- user_dn = NULL;
- client_dn = getenv("SSL_CLIENT_S_DN");
- if (client_dn != NULL)
- {
- user_dn = strdup(client_dn);
-
- /* we assume here that mod_ssl has verified proxy chain already ... */
-
- p = strstr(user_dn, "/CN=proxy");
- if (p != NULL) *p = '\0';
-
- p = strstr(user_dn, "/CN=limited proxy");
- if (p != NULL) *p = '\0';
- }
-
- if ((delegation_id == NULL) || (*delegation_id == '\0'))
- delegation_id = "_";
-
- docroot = getenv("DOCUMENT_ROOT");
- asprintf(&proxydir, "%s/%s", docroot, GRST_PROXYCACHE);
-
- if ((user_dn == NULL) || (user_dn[0] == '\0') ||
- (GRSTx509CacheProxy(proxydir, delegation_id, user_dn, proxy)
- != GRST_RET_OK))
- {
- return SOAP_ERR;
- }
-
- return SOAP_OK;
-}
-
+++ /dev/null
-/*
- Copyright (c) 2002-3, Andrew McNab and Shiv Kaushal,
- University of Manchester. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*------------------------------------------------------------------*
- * This program is part of GridSite: http://www.gridsite.org/ *
- *------------------------------------------------------------------*/
-
-void GRSThttpError(char *);
-void adminfooter(GRSThttpBody *, char *, char *, char *, char *);
-int GRSTstrCmpShort(char *, char *);
-char *makevfilename(char *, size_t, char *);
-
-/*CGI GACL - Edit interface functions*/
-void show_acl(int admin, GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void new_entry_form(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void new_entry(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void del_entry(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void edit_entry_form(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void edit_entry(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void add_cred_form(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void add_cred(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void del_cred(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void del_entry_sure(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void del_cred_sure(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-
-/*Functions producing messages*/
-//void error(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void admin_continue(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file, GRSThttpBody *bp);
-
+++ /dev/null
-/*
- Copyright (c) 2002-3, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*------------------------------------------------------------------*
- * This program is part of GridSite: http://www.gridsite.org/ *
- *------------------------------------------------------------------*/
-
-#ifndef VERSION
-#define VERSION "x.x.x"
-#endif
-
-#include <stdio.h>
-#include <time.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <fcntl.h>
-
-// when porting: remember that sendfile() is very OS-specific!
-#include <sys/sendfile.h>
-
-#include <gridsite.h>
-
-#include "grst_admin.h"
-
-char *storeuploadfile(char *boundary, int *bufferused)
-{
-// rewrite this to copy whole POSTed stdin HTTP body to disk then
-// mmap() and pick apart? How to deal with 100MB uploaded files, say?
-
- char *filebuffer = NULL;
- int bufferlen = 0, c, boundarylen;
-
- *bufferused = 0;
- boundarylen = strlen(boundary);
-
- while ((c = getchar()) != EOF)
- {
- if (*bufferused > 1024*1024*100) return NULL;
-
- ++(*bufferused);
-
- if (*bufferused > bufferlen)
- {
- bufferlen = bufferlen + 1000;
- filebuffer = realloc(filebuffer, (size_t) bufferlen);
- }
-
- filebuffer[*bufferused - 1] = c;
-
- if ( (*bufferused >= boundarylen + 4) &&
- (boundary[boundarylen-1] == c) &&
- (boundary[boundarylen-2] == filebuffer[*bufferused - 2]) &&
- (strncmp(boundary, &filebuffer[*bufferused - boundarylen],
- boundarylen) == 0))
- {
- *bufferused = *bufferused - boundarylen - 4;
-
- if (filebuffer == NULL) return strdup("");
- else return filebuffer;
- }
- }
-
- return NULL;
-}
-
-void uploadfile(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *dir_uri, char *admin_file)
-{
- char *boundary, *p, oneline[200], *filename = NULL,
- tmpfilename[256], *filebuffer = NULL, *filepath,
- *vfile, *dir_path_vfile;
- int mimestate, bufferused = 0, itworked = 0;
- FILE *fp;
- GRSThttpBody bp;
-
-#define MIMESTUNKNOWN 1
-#define MIMESTUPLOAD 2
-#define MIMESTFILENM 3
-
- if (!GRSTgaclPermHasWrite(perm)) GRSThttpError("403 Forbidden");
-
- p = getenv("CONTENT_TYPE");
- boundary = &p[30];
-
- mimestate = MIMESTUNKNOWN;
-
- while (fgets(oneline, sizeof(oneline), stdin) != NULL)
- {
- if (*oneline == 13) // MIME has CR/LF line breaks, CR=13
- {
- if (mimestate == MIMESTUPLOAD)
- {
- filebuffer = storeuploadfile(boundary, &bufferused);
- mimestate = MIMESTUNKNOWN;
- }
- else if (mimestate == MIMESTFILENM)
- {
- fgets(tmpfilename, sizeof(tmpfilename), stdin);
- if (*tmpfilename != 13)
- {
- p = index(tmpfilename, 13);
- *p = '\0';
- filename = strdup(tmpfilename);
- }
- mimestate = MIMESTUNKNOWN;
- }
- }
- else if (GRSTstrCmpShort(oneline,
- "Content-Disposition: form-data; name=\"uploadfile\"; filename=\"")
- == 0)
- {
- mimestate = MIMESTUPLOAD;
- if (filename == NULL)
- {
- filename = strdup(&oneline[61]);
-
- p = rindex(&oneline[61], '\\');
- if (p != NULL) { ++p ; filename = p; }
-
- p = rindex(&oneline[61], '/');
- if (p != NULL) { ++p ; filename = p; }
-
- p = index(filename, '"');
- if (p != NULL) *p = '\0';
- }
- }
- else if (GRSTstrCmpShort(oneline,
- "Content-Disposition: form-data; name=\"file\"") == 0)
- {
- mimestate = MIMESTFILENM;
- }
- }
-
- if ((filebuffer != NULL) && (bufferused >= 0))
- {
- if (filename == NULL) GRSThttpError("403 Forbidden");
- else if ((index(filename, '/') != NULL) ||
- (strcmp(filename, GRST_ACL_FILE) == 0))
- {
- puts("Status: 403 Forbidden filename\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp,"<title>Forbidden filename %s</title>\n", filename);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1 align=center>Forbidden filename %s</h1>\n",
- filename);
-
- GRSThttpPrintf(&bp,
- "<p align=center>New file names cannot include slashes "
- "or use the reserved ACL name, %s\n", GRST_ACL_FILE);
-
- GRSThttpPrintf(&bp,"<p align=center>"
- "<a href=\"%s%s?cmd=managedir\">Return to "
- "directory listing</a>\n", dir_uri, admin_file);
-
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
-
- GRSThttpWriteOut(&bp);
- return;
- }
- else
- {
- vfile = makevfilename(filename, bufferused, dn);
- asprintf(&dir_path_vfile, "%s/%s", dir_path, vfile);
-
- fp = fopen(dir_path_vfile, "w");
- if (fp != NULL)
- {
- if ((fwrite(filebuffer,
- sizeof(char), bufferused, fp) == bufferused) &&
- (fclose(fp) == 0))
- {
- asprintf(&filepath, "%s/%s", dir_path, filename);
-
- unlink(filepath); /* this can fail ok */
-
- itworked = (link(dir_path_vfile, filepath) == 0);
- }
- }
- }
-
- free((void *) filebuffer);
- }
-
- if (itworked)
- {
- printf("Status: 302 Moved Temporarily\nContent-Length: 0\n"
- "Location: %s%s?cmd=managedir\n\n", dir_uri, admin_file);
- return;
- }
-
- puts("Status: 500 Failed trying to upload\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp, "<title>Failed to upload</title>\n");
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1 align=center>Failed to upload</h1>\n");
-
- GRSThttpPrintf(&bp, "<p align=center>GridSite considers you are authorized "
- "to upload the file, but the upload failed. This is "
- "probably a web server or operating system level "
- "misconfiguration. Consult the site administrator.");
-
- GRSThttpPrintf(&bp,"<p align=center>"
- "<a href=\"%s%s?cmd=managedir\">Return to "
- "directory listing</a>\n", dir_uri, admin_file);
-
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
-
- GRSThttpWriteOut(&bp);
-}
-
-void deletefileaction(char *dn, GRSTgaclPerm perm, char *help_uri,
- char *dir_path, char *file, char *dir_uri,
- char *admin_file)
-{
- int fd, numfiles;
- char *dir_path_file, *dir_path_vfile, *p, *vfile, *dnlistsuri,
- *fulluri, *server_name, *realfile;
- struct stat statbuf;
- GRSThttpBody bp;
- struct dirent *subdirfile_ent;
- DIR *subDIR;
-
- if (((strcmp(file, GRST_ACL_FILE) != 0) && !GRSTgaclPermHasWrite(perm)) ||
- ((strcmp(file, GRST_ACL_FILE) == 0) && !GRSTgaclPermHasAdmin(perm)))
- GRSThttpError("403 Forbidden");
-
- dnlistsuri = getenv("GRST_DN_LISTS_URI");
- if (dnlistsuri == NULL) dnlistsuri = getenv("REDIRECT_GRST_DN_LISTS_URI");
-
- if ((dnlistsuri != NULL) &&
- (strncmp(dnlistsuri, dir_uri, strlen(dnlistsuri)) == 0))
- realfile = GRSThttpUrlEncode(file);
- else if (index(file, '/') != NULL) GRSThttpError("403 Forbidden");
- else realfile = file;
-
- dir_path_file = malloc(strlen(dir_path) + strlen(realfile) + 2);
-
- strcpy(dir_path_file, dir_path);
- strcat(dir_path_file, "/");
- strcat(dir_path_file, realfile);
-
- if ((stat(dir_path_file, &statbuf) == 0) && S_ISDIR(statbuf.st_mode))
- {
- subDIR = opendir(dir_path_file);
- if (subDIR == NULL) numfiles = 99; /* stop deletion */
- else
- {
- numfiles = 0;
- while ((subdirfile_ent = readdir(subDIR)) != NULL)
- if (subdirfile_ent->d_name[0] != '.') ++numfiles;
- else if (strncmp(subdirfile_ent->d_name,
- GRST_ACL_FILE,
- sizeof(GRST_ACL_FILE)) == 0) ++numfiles;
- closedir(subDIR);
- }
-
- if (numfiles == 0)
- {
- vfile = makevfilename(file, 0, dn);
- dir_path_vfile = malloc(strlen(dir_path) + strlen(vfile) + 2);
- strcpy(dir_path_vfile, dir_path);
- strcat(dir_path_vfile, "/");
- strcat(dir_path_vfile, vfile);
-
- if (rename(dir_path_file, dir_path_vfile) == 0)
- {
- printf("Status: 302 Moved Temporarily\nContent-Length: 0\n"
- "Location: %s%s?cmd=managedir\n\n", dir_uri, admin_file);
- return;
- }
- }
- }
- else if (unlink(dir_path_file) == 0)
- {
- if (strcmp(file, GRST_ACL_FILE) != 0)
- {
- vfile = makevfilename(file, 0, dn);
- dir_path_file = malloc(strlen(dir_path) + strlen(vfile) + 2);
- strcpy(dir_path_file, dir_path);
- strcat(dir_path_file, "/");
- strcat(dir_path_file, vfile);
-
- fd = open(dir_path_file, O_WRONLY | O_CREAT);
- if (fd != -1) close(fd);
- }
-
- printf("Status: 302 Moved Temporarily\nContent-Length: 0\n"
- "Location: %s%s?cmd=managedir\n\n", dir_uri, admin_file);
-
- return;
- }
-
- puts("Status: 500 Failed trying to delete\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp, "<title>Error deleting %s%s</title>\n", dir_uri, file);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1 align=center>Error deleting %s%s</h1>\n",
- dir_uri, file);
-
- GRSThttpPrintf(&bp, "<p align=center>GridSite considers you are authorized "
- "to delete %s, but the delete failed. This is "
- "probably a web server or operating system level "
- "misconfiguration. Consult the site administrator.",
- file);
-
- GRSThttpPrintf(&bp,"<p align=center>"
- "<a href=\"%s%s?cmd=managedir\">Return to "
- "directory listing</a>\n", dir_uri, admin_file);
-
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
-
- GRSThttpWriteOut(&bp);
-}
-
-void deletefileform(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *file, char *dir_uri, char *admin_file)
-{
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasWrite(perm)) GRSThttpError("403 Forbidden");
-
- puts("Status: 200 OK\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp, "<title>Delete %s</title>\n", file);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1 align=center>Delete %s</h1>\n", file);
-
- GRSThttpPrintf(&bp,"<form action=\"%s%s\" method=post>\n",dir_uri,admin_file);
- GRSThttpPrintf(&bp,"<h2 align=center>Do you really want to delete %s?", file);
- GRSThttpPrintf(&bp,"<p align=center><input type=submit value=\"Yes, delete %s\"></h2>\n", file);
- GRSThttpPrintf(&bp,"<input type=hidden name=file value=\"%s\">\n", file);
- GRSThttpPrintf(&bp,"<input type=hidden name=cmd value=deleteaction>\n");
- GRSThttpPrintf(&bp,"</form>\n");
-
- GRSThttpPrintf(&bp,"<p align=center>Or "
- "<a href=\"%s%s?cmd=managedir\">return to "
- "directory listing</a>\n", dir_uri, admin_file);
-
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
-
- GRSThttpWriteOut(&bp);
-}
-
-void renameform(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *file, char *dir_uri, char *admin_file)
-{
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasWrite(perm)) GRSThttpError("403 Forbidden");
-
- puts("Status: 200 OK\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp, "<title>Rename %s</title>\n", file);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1 align=center>Rename %s%s</h1>\n", dir_uri, file);
-
- GRSThttpPrintf(&bp,"<form action=\"%s%s\" method=post>\n",dir_uri,admin_file);
- GRSThttpPrintf(&bp,"<h2 align=center>What do you want to rename %s to?</h2>", file);
- GRSThttpPrintf(&bp,"<input type=hidden name=file value=\"%s\">\n", file);
- GRSThttpPrintf(&bp,"<p align=center>New name: <input type=text name=newfile value=\"%s\">\n", file);
- GRSThttpPrintf(&bp,"<input type=submit value=\"Rename\">\n");
- GRSThttpPrintf(&bp,"<input type=hidden name=cmd value=renameaction>\n");
- GRSThttpPrintf(&bp,"</form>\n");
-
- GRSThttpPrintf(&bp,"<p align=center>Or "
- "<a href=\"%s%s?cmd=managedir&diruri=%s\">return to "
- "directory listing</a>\n", dir_uri, admin_file, dir_uri);
-
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
-
- GRSThttpWriteOut(&bp);
-}
-
-void editfileaction(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *file, char *dir_uri, char *admin_file)
-{
- char *pagetext, *dir_path_file, *vfile, *dir_path_vfile,
- *dnlistsuri, *server_name, *fulluri, *realfile;
- FILE *fp;
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasWrite(perm) || (strcmp(file, GRST_ACL_FILE) == 0))
- GRSThttpError("403 Forbidden");
-
- dnlistsuri = getenv("GRST_DN_LISTS_URI");
- if (dnlistsuri == NULL) dnlistsuri = getenv("REDIRECT_GRST_DN_LISTS_URI");
-
- if ((dnlistsuri != NULL) &&
- (strncmp(dnlistsuri, dir_uri, strlen(dnlistsuri)) == 0))
- {
- realfile = GRSThttpUrlEncode(file);
-
- if (realfile[0] == '.') GRSThttpError("403 Forbidden");
- }
- else if (index(file, '/') != NULL) GRSThttpError("403 Forbidden");
- else realfile = file;
-
- asprintf(&dir_path_file, "%s/%s", dir_path, realfile);
-
- pagetext = GRSThttpGetCGI("pagetext");
- vfile = makevfilename(file, strlen(pagetext), dn);
- asprintf(&dir_path_vfile, "%s/%s", dir_path, vfile);
-
- fp = fopen(dir_path_vfile, "w");
- if (fp == NULL)
- {
- puts("Status: 500 Failed trying to write\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp,"<title>Error writing %s%s</title>\n", dir_uri, file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1 align=center>Error writing %s%s</h1>\n",
- dir_uri, file);
-
- GRSThttpPrintf(&bp,
- "<p align=center>GridSite considers you are authorized "
- "to write the file, but the write failed. This is "
- "probably a web server or operating system level "
- "misconfiguration. Consult the site administrator.");
-
- GRSThttpPrintf(&bp,"<p align=center>"
- "<a href=\"%s%s?cmd=managedir\">Return to "
- "directory listing</a>\n", dir_uri, admin_file);
-
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
-
- GRSThttpWriteOut(&bp);
- return;
- }
-
- fwrite(pagetext, strlen(pagetext), sizeof(char), fp);
-
- fclose(fp);
-
- unlink(dir_path_file);
-
- if (link(dir_path_vfile,dir_path_file) != 0) GRSThttpError("403 Forbidden");
-
- if ((strlen(file) > 7) && (strcmp(&file[strlen(file) - 5], ".html") == 0))
- printf("Status: 302 Moved Temporarily\nContent-Length: 0\n"
- "Location: %s%s\n\n", dir_uri, file);
- else printf("Status: 302 Moved Temporarily\nContent-Length: 0\n"
- "Location: %s%s?cmd=managedir\n\n", dir_uri, admin_file);
-}
-
-void create_acl(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *file, char *dir_uri, char *admin_file)
-{
- int fd;
- char *tmpgacl, *newgacl;
- GRSTgaclAcl *acl;
- FILE *fp;
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasAdmin(perm)) GRSThttpError("403 Forbidden");
-
- asprintf(&tmpgacl, "%s/.tmp.XXXXXX", dir_path);
- asprintf(&newgacl, "%s/%s", dir_path, GRST_ACL_FILE);
-
- if (((acl = GRSTgaclAclLoadforFile(dir_path)) != NULL) &&
- ((fd = mkstemp(tmpgacl)) != -1) &&
- ((fp = fdopen(fd, "w+")) != NULL) &&
- GRSTgaclAclPrint(acl, fp) &&
- (fclose(fp) == 0) &&
- (rename(tmpgacl, newgacl) == 0))
- {
- printf("Status: 302 Moved Temporarily\nContent-Length: 0\n"
- "Location: %s%s?cmd=managedir\n\n", dir_uri, admin_file);
-
- free(tmpgacl);
- free(newgacl);
- return;
- }
-
- puts("Status: 500 Failed trying to create\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp,"<title>Error creating %s%s</title>\n", dir_uri,
- GRST_ACL_FILE);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1 align=center>Error creating %s%s</h1>\n",
- dir_uri, GRST_ACL_FILE);
-
- GRSThttpPrintf(&bp, "<p align=center>GridSite considers you are authorized "
- "to create it, but the create failed. This is "
- "probably a web server or operating system level "
- "misconfiguration. Consult the site administrator.");
-
- GRSThttpPrintf(&bp,"<p align=center>"
- "<a href=\"%s%s?cmd=managedir\">Return to "
- "directory listing</a>\n", dir_uri, admin_file);
-
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
-
- GRSThttpWriteOut(&bp);
-
- free(tmpgacl);
- free(newgacl);
-}
-
-void renameaction(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *file, char *dir_uri, char *admin_file)
-{
- int len;
- char *dir_path_file, *vfile, *dir_path_vfile,
- *dnlistsuri, *newfile, *dir_path_newfile;
- struct stat statbuf;
- FILE *fp;
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasWrite(perm) || (strcmp(file, GRST_ACL_FILE) == 0))
- GRSThttpError("403 Forbidden");
-
- if (index(file, '/') != NULL) GRSThttpError("403 Forbidden");
-
- dir_path_file = malloc(strlen(dir_path) + strlen(file) + 2);
- strcpy(dir_path_file, dir_path);
- strcat(dir_path_file, "/");
- strcat(dir_path_file, file);
-
- if (stat(dir_path_file, &statbuf) != 0) GRSThttpError("404 Not Found");
-
- newfile = GRSThttpGetCGI("newfile");
-
- if ((strcmp(newfile, GRST_ACL_FILE) == 0) ||
- (strcmp(newfile, file) == 0)) GRSThttpError("403 Forbidden");
-
- dir_path_newfile = malloc(strlen(dir_path) + strlen(newfile) + 2);
- strcpy(dir_path_newfile, dir_path);
- strcat(dir_path_newfile, "/");
- strcat(dir_path_newfile, newfile);
-
- vfile = makevfilename(newfile, statbuf.st_size, dn);
- dir_path_vfile = malloc(strlen(dir_path) + strlen(vfile) + 2);
- strcpy(dir_path_vfile, dir_path);
- strcat(dir_path_vfile, "/");
- strcat(dir_path_vfile, vfile);
-
- unlink(dir_path_newfile); /* just in case */
-
- if ((link(dir_path_file, dir_path_vfile ) == 0) &&
- (link(dir_path_file, dir_path_newfile) == 0) &&
- (unlink(dir_path_file) == 0))
- {
- printf("Status: 302 Moved Temporarily\nContent-Length: 0\n"
- "Location: %s\n\n", dir_uri);
- return;
- }
-
- puts("Status: 500 Failed trying to rename\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp,"<title>Error renaming %s%s</title>\n", dir_uri, file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1 align=center>Error renaming %s%s</h1>\n",
- dir_uri, file);
-
- GRSThttpPrintf(&bp, "<p align=center>GridSite considers you are authorized "
- "to rename it, but the rename failed. This is "
- "probably a web server or operating system level "
- "misconfiguration. Consult the site administrator.");
-
- GRSThttpPrintf(&bp,"<p align=center>"
- "<a href=\"%s%s?cmd=managedir\">Return to "
- "directory listing</a>\n", dir_uri, admin_file);
-
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
-
- GRSThttpWriteOut(&bp);
-}
-
-void newdirectory(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *file, char *dir_uri, char *admin_file)
-{
- int len;
- char *dir_path_file, *vfile, *dir_path_vfile, *filedup;
- FILE *fp;
- GRSThttpBody bp;
-
- if ((file[0] == '\0') ||
- !GRSTgaclPermHasWrite(perm) || (strcmp(file, GRST_ACL_FILE) == 0))
- GRSThttpError("403 Forbidden");
-
- filedup = strdup(file);
- if (filedup[strlen(filedup)-1] == '/') filedup[strlen(filedup)-1] = '\0';
- if (index(filedup, '/') != NULL) GRSThttpError("403 Forbidden");
-
- dir_path_file = malloc(strlen(dir_path) + strlen(file) + 2);
- strcpy(dir_path_file, dir_path);
- strcat(dir_path_file, "/");
- strcat(dir_path_file, file);
-
- if (mkdir(dir_path_file, 0751) == 0)
- {
- printf("Status: 302 Moved Temporarily\nContent-Length: 0\n"
- "Location: %s%s?cmd=managedir\n\n", dir_uri, admin_file);
- return;
- }
-
- puts("Status: 500 Failed trying to create\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp,"<title>Error create %s%s</title>\n", dir_uri, file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1 align=center>Error creating directory %s%s</h1>\n",
- dir_uri, file);
-
- GRSThttpPrintf(&bp,
- "<p align=center>GridSite considers you are authorized "
- "to create the directory, but the creation failed. This "
- "is probably a web server or operating system level "
- "misconfiguration. Consult the site administrator.");
-
- GRSThttpPrintf(&bp,"<p align=center>"
- "<a href=\"%s%s?cmd=managedir\">Return to "
- "parent directory listing</a>\n", dir_uri, admin_file);
-
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
-
- GRSThttpWriteOut(&bp);
-}
-
-void editdnlistaction(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *file, char *dir_uri, char *admin_file)
-{
- int numdn = 0, ifd, ofd, numdnlines = 0, i, found;
- char *dir_path_file, *dir_path_tmpfile, *realfile,
- *dnlistsuri, *server_name, *fulldiruri, *p, oneline[513],
- **dnlines, name[81], *add;
- FILE *ofp;
- struct stat statbuf;
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasWrite(perm)) GRSThttpError("403 Forbidden");
-
- dnlistsuri = getenv("GRST_DN_LISTS_URI");
- if (dnlistsuri == NULL) dnlistsuri = getenv("REDIRECT_GRST_DN_LISTS_URI");
-
- server_name = getenv("SERVER_NAME");
-
- if ((server_name == NULL) ||
- (dnlistsuri == NULL) ||
- (strncmp(dnlistsuri, dir_uri, strlen(dnlistsuri)) != 0))
- GRSThttpError("403 Forbidden");
-
- asprintf(&fulldiruri, "https://%s%s", server_name, dir_uri);
-
- if ((strncmp(fulldiruri, file, strlen(fulldiruri)) != 0) &&
- ((strncmp(fulldiruri, file, strlen(fulldiruri) - 1) != 0) ||
- (strlen(fulldiruri) - 1 != strlen(file))))
- {
- puts("Status: 403 Forbidden\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp,"<title>Error writing %s</title>\n", file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1 align=center>Error writing %s to %s</h1>\n",
- file, dir_uri);
-
- GRSThttpPrintf(&bp, "<p align=center>You cannot create a DN List "
- "with that prefix in this directory. Please see the "
- "the GridSite User's Guide for an explanation.");
-
- GRSThttpPrintf(&bp,"<p align=center>"
- "<a href=\"%s%s?cmd=managedir\">Return to "
- "directory listing</a>\n", dir_uri, admin_file);
-
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
-
- GRSThttpWriteOut(&bp);
- return;
- }
-
- p = GRSThttpGetCGI("numdn");
- if ((p == NULL) || (sscanf(p, "%d", &numdn) != 1))
- GRSThttpError("500 No number of DNs");
-
- if (numdn > 0)
- {
- dnlines = malloc(sizeof(char *) * numdn);
-
- for (i=1; i <= numdn; ++i)
- {
- sprintf(name, "dn%d", i);
- p = GRSThttpGetCGI(name);
-
- if (*p != '\0')
- {
- dnlines[numdnlines] = p;
- ++numdnlines;
- }
- }
- }
-
- add = GRSThttpGetCGI("add");
-
- realfile = GRSThttpUrlEncode(file);
-
- dir_path_file = malloc(strlen(dir_path) + strlen(realfile) + 2);
- strcpy(dir_path_file, dir_path);
- strcat(dir_path_file, "/");
- strcat(dir_path_file, realfile);
-
- dir_path_tmpfile = malloc(strlen(dir_path) + 13);
- strcpy(dir_path_tmpfile, dir_path);
- strcat(dir_path_tmpfile, "/.tmp.XXXXXX");
-
- if (((ofd = mkstemp(dir_path_tmpfile)) != -1) &&
- ((ofp = fdopen(ofd, "w")) != NULL))
- {
- if (*add != '\0')
- {
- fputs(add, ofp);
- fputc('\n', ofp);
- }
-
- for (i=0; i < numdnlines; ++i)
- {
- fputs(dnlines[i], ofp);
- fputc('\n', ofp);
- }
-
- if ((fclose(ofp) == 0) &&
- ((stat(dir_path_file, &statbuf) != 0) ||
- (unlink(dir_path_file) == 0)) &&
- (rename(dir_path_tmpfile, dir_path_file) == 0))
- {
- printf("Status: 302 Moved Temporarily\nContent-Length: 0\n"
- "Location: %s%s?cmd=managedir\n\n", dir_uri, admin_file);
- return;
- }
- }
-
- puts("Status: 500 Failed trying to write\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp,"<title>Error writing %s%s</title>\n", dir_uri, file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1 align=center>Error writing %s%s</h1>\n",
- dir_uri, file);
-
- GRSThttpPrintf(&bp, "<p align=center>GridSite considers you are authorized "
- "to write the file, but the write failed. This is "
- "probably a web server or operating system level "
- "misconfiguration. Consult the site administrator.");
-
- GRSThttpPrintf(&bp,"<p align=center>"
- "<a href=\"%s%s?cmd=managedir\">Return to "
- "directory listing</a>\n", dir_uri, admin_file);
-
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
-
- GRSThttpWriteOut(&bp);
-
- /* try to clean up */
- if (stat(dir_path_tmpfile, &statbuf) == 0) unlink(dir_path_tmpfile);
-}
-
-void printfile(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *file, char *dir_uri, char *admin_file)
-{
- int fd;
- char *dir_path_file;
- struct stat statbuf;
-
- if (!GRSTgaclPermHasRead(perm)) GRSThttpError("403 Forbidden");
-
- if (index(file, '/') != NULL) GRSThttpError("403 Forbidden");
-
- dir_path_file = malloc(strlen(dir_path) + strlen(file) + 2);
-
- strcpy(dir_path_file, dir_path);
- strcat(dir_path_file, "/");
- strcat(dir_path_file, file);
-
- fd = open(dir_path_file, O_RDONLY);
- if (fd == -1) GRSThttpError("500 Internal server error");
-
- if ((fstat(fd, &statbuf) != 0) ||
- !S_ISREG(statbuf.st_mode)) GRSThttpError("403 Forbidden");
-
- printf("Status: 200 OK\nContent-Type: text/html\nContent-Length: %d\n\n",
- statbuf.st_size);
-
- fflush(stdout);
-
- sendfile(1, fd, 0, statbuf.st_size);
-}
-
-void filehistory(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *file, char *dir_uri, char *admin_file)
-{
- int fd, n, i, j, enclen, num = 0;
- char *encodedfile, *p, *dndecoded, modified[99], *vfile, *q,
- *encdn;
- time_t file_time;
- size_t file_size;
- struct stat statbuf;
- struct dirent **namelist;
- struct tm file_tm;
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasRead(perm)) GRSThttpError("403 Forbidden");
-
- if (index(file, '/') != NULL) GRSThttpError("403 Forbidden");
-
- puts("Status: 200 OK\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
- GRSThttpPrintf(&bp, "<title>History of %s%s</title>\n", dir_uri, file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
- GRSThttpPrintf(&bp,
- "<h1 align=center>History of <a href=\"%s%s\">%s%s</a></h1>\n",
- dir_uri, file, dir_uri, file);
-
- asprintf(&vfile, "%s/%s", dir_path, file);
- if (stat(vfile, &statbuf) == 0)
- {
- localtime_r((const time_t *) &(statbuf.st_mtime), &file_tm);
- strftime(modified, sizeof(modified),
- "%a %e %b %Y %k:%M", &file_tm);
-
- GRSThttpPrintf(&bp, "<p align=center>Last modified: %s\n", modified);
- }
- free(vfile);
-
- encodedfile = GRSThttpUrlEncode(file);
- for (p=encodedfile; *p != '\0'; ++p) if (*p == '%') *p = '=';
- enclen = strlen(encodedfile);
-
- n = scandir(dir_path, &namelist, 0, alphasort);
-
- if (n > 0)
- {
- for (i = n - 1; i >= 0; --i)
- {
- if ((strncmp(namelist[i]->d_name, GRST_HIST_PREFIX,
- sizeof(GRST_HIST_PREFIX) - 1) == 0) &&
- ((namelist[i]->d_name)[sizeof(GRST_HIST_PREFIX) - 1] == ':') &&
- (strncmp(&((namelist[i]->d_name)[sizeof(GRST_HIST_PREFIX)]),
- encodedfile, enclen) == 0) &&
- ((namelist[i]->d_name)[sizeof(GRST_HIST_PREFIX)+enclen] == ':'))
- {
- if (num == 0) GRSThttpPrintf(&bp,
- "<p align=center><table border=1 cellpadding=5>\n"
- "<tr><td>Date</td><td>Size after</td>"
- "<td colspan=2>Changed by</td></tr>\n");
-
- ++num;
-
- p = index(namelist[i]->d_name, ':');
- p = index(&p[1], ':');
- sscanf(&p[1], "%X:", &file_time);
- p = index(&p[1], ':'); /* skip over microseconds time */
- p = index(&p[1], ':');
- sscanf(&p[1], "%X:", &file_size);
- p = index(&p[1], ':');
-
- encdn = strdup(&p[1]);
- q = index(encdn, ':');
- if (q != NULL) *q = '\0';
-
- for (q=encdn; *q != '\0'; ++q) if (*q == '=') *q = '%';
- dndecoded = GRSThttpUrlDecode(encdn);
-
- localtime_r((const time_t *) &file_time, &file_tm);
- strftime(modified, sizeof(modified),
- "%a %e %b %Y %k:%M", &file_tm);
-
- GRSThttpPrintf(&bp,
- "<tr><td>%s</td><td align=right>%d</td><td>%s</td>\n",
- modified, file_size, dndecoded);
-
- free(dndecoded);
-
- asprintf(&vfile, "%s/%s", dir_path, namelist[i]->d_name);
- if ((stat(vfile, &statbuf) == 0) && (statbuf.st_size > 0))
- {
- GRSThttpPrintf(&bp, "<td><a href=\"");
- if (strcmp (file, GRST_ACL_FILE)==0)
- GRSThttpPrintf(&bp, "%s%s?cmd=acl_history&dir_uri=%s&file=%s\">View</a></td></tr>\n",
- dir_uri, admin_file, dir_uri, namelist[i]->d_name);
- else GRSThttpPrintf(&bp, "%s%s\">View</a></td></tr>\n",
- dir_uri, namelist[i]->d_name);
- }
- else GRSThttpPrintf(&bp, "<td> </td></tr>");
-
- free(vfile);
- }
- }
- }
-
- if (num > 0) GRSThttpPrintf(&bp, "</table>\n");
- else GRSThttpPrintf(&bp, "<p align=center>No history for this file\n");
-
- if (GRSTgaclPermHasList(perm))
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- else adminfooter(&bp, dn, help_uri, dir_uri, NULL);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
- GRSThttpWriteOut(&bp);
-}
-
-void ziplist(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *file, char *dir_uri, char *admin_file)
-{
- char *shellcmd, *unzip, oneline[129];
- FILE *fp;
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasRead(perm)) GRSThttpError("403 Forbidden");
-
- if (index(file, '/') != NULL) GRSThttpError("403 Forbidden");
-
- puts("Status: 200 OK\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
- GRSThttpPrintf(&bp, "<title>Contents of %s%s</title>\n", dir_uri, file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
- GRSThttpPrintf(&bp,
- "<h1 align=center>Contents of ZIP file <a href=\"%s%s\">%s%s</a></h1>\n",
- dir_uri, file, dir_uri, file);
-
- unzip = getenv("GRST_UNZIP");
- if (unzip == NULL) unzip = getenv("REDIRECT_GRST_UNZIP");
-
- if (unzip != NULL)
- {
- GRSThttpPrintf(&bp, "<center><table><tr><td><pre>\n");
- asprintf(&shellcmd, "cd %s ; %s -Z %s", dir_path, unzip, file);
- fp = popen(shellcmd, "r");
-
- while (fgets(oneline, sizeof(oneline), fp) != NULL)
- GRSThttpPrintf(&bp, "%s", oneline);
- pclose(fp);
- GRSThttpPrintf(&bp, "</pre></td></tr></table></center>\n");
-
- if (GRSTgaclPermHasWrite(perm))
- GRSThttpPrintf(&bp,
- "<p><center><form action=\"%s%s\" method=post>"
- "<input type=submit value=\"Unzip this file\"> in %s"
- "<input type=hidden name=cmd value=unzipfile>"
- "<input type=hidden name=file value=\"%s\"></form>"
- "<p>(All files are placed in the same directory and files "
- "beginning with "." are ignored.)</center>\n",
- dir_uri, admin_file, dir_uri, file);
- }
- else GRSThttpPrintf(&bp, "<p align=center>unzip path not defined!\n");
-
- if (GRSTgaclPermHasList(perm))
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- else adminfooter(&bp, dn, help_uri, dir_uri, NULL);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
- GRSThttpWriteOut(&bp);
-}
-
-void unzipfile(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *file, char *dir_uri, char *admin_file)
-{
- char *shellcmd, *unzip, oneline[129];
- FILE *fp;
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasWrite(perm)) GRSThttpError("403 Forbidden");
-
- if (index(file, '/') != NULL) GRSThttpError("403 Forbidden");
-
- puts("Status: 200 OK\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
- GRSThttpPrintf(&bp, "<title>Unzipping %s%s</title>\n", dir_uri, file);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
- GRSThttpPrintf(&bp,
- "<h1 align=center>Unzipping <a href=\"%s%s\">%s%s</a></h1>\n",
- dir_uri, file, dir_uri, file);
-
- unzip = getenv("GRST_UNZIP");
- if (unzip == NULL) unzip = getenv("REDIRECT_GRST_UNZIP");
-
- if (unzip != NULL)
- {
- GRSThttpPrintf(&bp, "<center><table><tr><td><pre>\n");
- asprintf(&shellcmd, "cd %s ; %s -jo %s -x '.*'", dir_path, unzip, file);
- fp = popen(shellcmd, "r");
-
- while (fgets(oneline, sizeof(oneline), fp) != NULL)
- GRSThttpPrintf(&bp, "%s", oneline);
- pclose(fp);
- GRSThttpPrintf(&bp, "</pre></td></tr></table></center>\n");
-
- if (GRSTgaclPermHasList(perm))
- GRSThttpPrintf(&bp, "<p align=center>"
- "<b><a href=\"%s%s?cmd=managedir\">Back to "
- "directory</a></b>", dir_uri, admin_file);
- }
- else GRSThttpPrintf(&bp, "<p align=center>unzip path not defined!\n");
-
- if (GRSTgaclPermHasList(perm))
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
- else adminfooter(&bp, dn, help_uri, dir_uri, NULL);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
- GRSThttpWriteOut(&bp);
-}
-
-void editfileform(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *file, char *dir_uri, char *admin_file)
-{
- int fd, rawpagesize, i, c;
- char *dir_path_file, *rawpage, *p;
- FILE *fp = NULL;
- struct stat statbuf;
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasWrite(perm)) GRSThttpError("403 Forbidden");
-
- if (index(file, '/') != NULL) GRSThttpError("403 Forbidden");
-
- dir_path_file = malloc(strlen(dir_path) + strlen(file) + 2);
-
- strcpy(dir_path_file, dir_path);
- strcat(dir_path_file, "/");
- strcat(dir_path_file, file);
-
- fd = open(dir_path_file, O_RDONLY);
- if (fd != -1)
- {
- fp = fdopen(fd, "r");
- if (fp == NULL) GRSThttpError("500 File open failed!");
-
- if ((fstat(fd, &statbuf) != 0) ||
- !S_ISREG(statbuf.st_mode)) GRSThttpError("500 Not a regular file!");
- }
-
- puts("Status: 200 OK\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp, "<title>Edit file %s</title>\n", file);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1>Edit file %s</h1>\n", file);
-
- GRSThttpPrintf(&bp,"<form action=\"%s%s\" method=post>\n",dir_uri,admin_file);
- GRSThttpPrintf(&bp,"<p><input type=submit value=\"Save changes\">\n");
- GRSThttpPrintf(&bp,"<p>File name: <input type=text name=file value=\"%s\">\n", file);
- GRSThttpPrintf(&bp,"<input type=hidden name=cmd value=editaction>\n");
- GRSThttpPrintf(&bp,"<p><textarea name=pagetext cols=80 rows=22>");
-
- if (fp != NULL)
- {
- rawpagesize = statbuf.st_size + 1000;
- rawpage = malloc(rawpagesize);
-
- i = 0;
-
- while ((c = fgetc(fp)) != EOF)
- {
- if (c == '<') { strcpy(&rawpage[i], "<");
- i += 4; }
- else if (c == '>') { strcpy(&rawpage[i], ">");
- i += 4; }
- else if (c == '&') { strcpy(&rawpage[i], "&");
- i += 5; }
- else if (c == '"') { strcpy(&rawpage[i], """);
- i += 6; }
- else { rawpage[i] = c;
- i += 1; }
-
- if (i >= rawpagesize - 7)
- {
- rawpagesize += 1000;
- rawpage = realloc(rawpage, rawpagesize);
- }
- }
-
- rawpage[i] = '\0';
-
- GRSThttpPrintf(&bp, "%s", rawpage);
- }
-
- GRSThttpPrintf(&bp, "</textarea>\n");
- GRSThttpPrintf(&bp, "<p><input type=submit value=\"Save changes\">\n");
- GRSThttpPrintf(&bp, "</form>\n");
-
- if (fp != NULL) fclose(fp);
-
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
- GRSThttpWriteOut(&bp);
-}
-
-void editdnlistform(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *file, char *dir_uri, char *admin_file)
-{
- int fd, i, c, numdn = 0;
- char *dir_path_file, *rawpage, *p, *dnlistsuri, *server_name, *fulluri,
- *realfile, oneline[513];
- FILE *fp = NULL;
- struct stat statbuf;
- GRSThttpBody bp;
-
- dnlistsuri = getenv("GRST_DN_LISTS_URI");
- if (dnlistsuri == NULL) dnlistsuri = getenv("REDIRECT_GRST_DN_LISTS_URI");
-
- if (!GRSTgaclPermHasWrite(perm) ||
- (dnlistsuri == NULL) ||
- (strncmp(dnlistsuri, dir_uri, strlen(dnlistsuri)) != 0))
- GRSThttpError("403 Forbidden");
-
- realfile = GRSThttpUrlEncode(file);
-
- dir_path_file = malloc(strlen(dir_path) + strlen(realfile) + 2);
-
- strcpy(dir_path_file, dir_path);
- strcat(dir_path_file, "/");
- strcat(dir_path_file, realfile);
-
- fd = open(dir_path_file, O_RDONLY);
- if (fd != -1) /* we dont mind open failing, but it must work if it doesnt */
- {
- fp = fdopen(fd, "r");
- if (fp == NULL) GRSThttpError("500 File open failed!");
-
- if ((fstat(fd, &statbuf) != 0) ||
- !S_ISREG(statbuf.st_mode)) GRSThttpError("500 Not a regular file!");
- }
-
- puts("Status: 200 OK\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp, "<title>Edit DN List %s</title>\n", file);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1>Edit DN List</h1>\n");
-
- GRSThttpPrintf(&bp,"<form action=\"%s%s\" method=post>\n",dir_uri,admin_file);
- GRSThttpPrintf(&bp,"<p><input type=submit value=\"Update\">\n");
- GRSThttpPrintf(&bp,"<p>List URL: <input type=text name=file value=\"%s\" "
- "size=%d>\n", file, strlen(file));
- GRSThttpPrintf(&bp,"<input type=hidden name=cmd value=editdnlistaction>\n");
-
- if (fp != NULL)
- {
- GRSThttpPrintf(&bp, "<p><table>\n<tr><th>Keep?</th>"
- "<th>Name</th></tr>\n");
-
- while (fgets(oneline, sizeof(oneline), fp) != NULL)
- {
- ++numdn;
-
- p = rindex(oneline, '\n');
- if (p != NULL) *p = '\0';
-
- GRSThttpPrintf(&bp, "<tr><td align=center><input type=checkbox "
- "name=\"dn%d\" value=\"%s\" checked></td>"
- "<td>%s</td></tr>\n", numdn, oneline, oneline);
- }
-
- GRSThttpPrintf(&bp,"</table>\n");
- }
-
- GRSThttpPrintf(&bp,"<input type=hidden name=numdn value=\"%d\">\n", numdn);
-
- GRSThttpPrintf(&bp, "<p>Add new DN: <input type=text name=add "
- "size=60 maxlength=512>\n");
-
- GRSThttpPrintf(&bp,"<p><input type=submit value=\"Update\">\n");
- GRSThttpPrintf(&bp, "</form>\n");
-
- if (fp != NULL) fclose(fp);
-
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
- GRSThttpWriteOut(&bp);
-}
-
-void managedir(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *dir_uri, char *admin_file)
-{
- int n, is_dnlists_dir = 0, enclen, numfiles, encprefixlen;
- char *d_namepath, modified[99], *absaclpath, *editable, *p, *unzip,
- *dnlistsuri, *d_name, *server_name, *fulluri, *encfulluri,
- *encprefix, *dnlistsprefix;
- GRSThttpBody bp;
- struct tm mtime_tm;
- struct stat statbuf;
- struct dirent **namelist, *subdirfile_ent;
- DIR *subDIR;
-
- if (((!GRSTgaclPermHasWrite(perm)) &&
- (!GRSTgaclPermHasList(perm))) ||
- (stat(dir_path, &statbuf) != 0) || !S_ISDIR(statbuf.st_mode))
- GRSThttpError("403 Forbidden");
-
- editable = getenv("GRST_EDITABLE");
- if (editable == NULL) editable = getenv("REDIRECT_GRST_EDITABLE");
-
- unzip = getenv("GRST_UNZIP");
- if (unzip == NULL) unzip = getenv("REDIRECT_GRST_UNZIP");
-
- dnlistsuri = getenv("GRST_DN_LISTS_URI");
- if (dnlistsuri == NULL) dnlistsuri = getenv("REDIRECT_GRST_DN_LISTS_URI");
-
- if (dnlistsuri && (strncmp(dnlistsuri, dir_uri, strlen(dnlistsuri)) == 0))
- {
- is_dnlists_dir = 1;
- server_name = getenv("SERVER_NAME");
-
- asprintf(&fulluri, "https://%s%s", server_name, dir_uri);
- encfulluri = GRSThttpUrlEncode(fulluri);
- enclen = strlen(encfulluri);
-
- asprintf(&dnlistsprefix, "https://%s%s", server_name, dnlistsuri);
- encprefix = GRSThttpUrlEncode(dnlistsprefix);
- encprefixlen = strlen(encprefix);
- }
-
- printf("Status: 200 OK\nContent-Type: text/html\n");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintf(&bp,"<title>Manage directory %s</title>\n", dir_uri);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpPrintf(&bp, "<h1>Manage directory %s</h1>\n<table>\n", dir_uri);
-
- if (dir_uri[1] != '\0')
- GRSThttpPrintf(&bp,
- "<tr><td colspan=3>[<a href=\"../%s?cmd=managedir\">Parent "
- "directory</a>]</td></tr>\n", admin_file);
-
- if (GRSTgaclPermHasList(perm) || GRSTgaclPermHasAdmin(perm))
- {
- absaclpath = malloc(strlen(dir_path) + sizeof(GRST_ACL_FILE) + 1);
- strcpy(absaclpath, dir_path);
- strcat(absaclpath, "/");
- strcat(absaclpath, GRST_ACL_FILE);
-
- if (stat(absaclpath, &statbuf) == 0) /* ACL exists in THIS directory */
- {
- localtime_r(&(statbuf.st_mtime), &mtime_tm);
- strftime(modified, sizeof(modified),
- "<td align=right>%R</td><td align=right>%e %b %y</td>",
- &mtime_tm);
-
- if (!is_dnlists_dir)
- {
- GRSThttpPrintf(&bp,
- "<tr><td><a href=\"%s\">%s</a></td>"
- "<td align=right>%ld</td>%s\n",
- GRST_ACL_FILE,
- GRST_ACL_FILE,
- statbuf.st_size, modified);
-
- GRSThttpPrintf(&bp,
- "<td><a href=\"%s%s?cmd=history&file=%s\">"
- "History</a></td>",
- dir_uri, admin_file, GRST_ACL_FILE);
- }
- else GRSThttpPrintf(&bp,
- "<tr><td>%s</td>"
- "<td align=right>%ld</td>%s\n",
- GRST_ACL_FILE,
- statbuf.st_size, modified);
-
- if (GRSTgaclPermHasAdmin(perm))
- GRSThttpPrintf(&bp,
- "<td><a href=\"%s%s?cmd=admin_acl\">Edit</a></td>"
- "<td><a href=\"%s%s?cmd=delete&file=%s\">Delete</a></td>",
- dir_uri, admin_file,
- dir_uri, admin_file, GRST_ACL_FILE);
- else if (GRSTgaclPermHasRead(perm))
- GRSThttpPrintf(&bp,
- "<td><a href=\"%s%s?cmd=show_acl\">View</a></td>"
- "<td> </td>", dir_uri, admin_file);
- else GRSThttpPrintf(&bp, "<td> </td><td> </td>\n");
-
- GRSThttpPrintf(&bp, "<td> </td></tr>\n");
- }
- else if (GRSTgaclPermHasAdmin(perm))
- GRSThttpPrintf(&bp, "<form method=post action=\"%s%s\">\n"
- "<tr><td colspan=8><input type=submit value=\"Create .gacl\"></td>\n"
- "<input type=hidden name=cmd value=\"create_acl\"></tr></form>\n",
- dir_uri, admin_file);
- }
-
- if (GRSTgaclPermHasList(perm))
- {
- n = scandir(dir_path, &namelist, 0, alphasort);
- while (n--)
- {
- if (namelist[n]->d_name[0] != '.')
- {
- d_namepath = malloc(strlen(dir_path) +
- strlen(namelist[n]->d_name) + 2);
- strcpy(d_namepath, dir_path);
- strcat(d_namepath, "/");
- strcat(d_namepath, namelist[n]->d_name);
- stat(d_namepath, &statbuf);
-
- if (S_ISDIR(statbuf.st_mode))
- {
- subDIR = opendir(d_namepath);
-
- if (subDIR == NULL) numfiles = 99; /* stop deletion */
- else
- {
- numfiles = 0;
- while ((subdirfile_ent = readdir(subDIR)) != NULL)
- if (subdirfile_ent->d_name[0] != '.') ++numfiles;
- else if (strncmp(subdirfile_ent->d_name,
- GRST_ACL_FILE,
- sizeof(GRST_ACL_FILE)) == 0) ++numfiles;
-
- closedir(subDIR);
- }
- }
-
- free(d_namepath);
-
- localtime_r(&(statbuf.st_mtime), &mtime_tm);
- strftime(modified, sizeof(modified),
- "<td align=right>%R</td><td align=right>%e %b %y</td>",
- &mtime_tm);
-
- if (S_ISDIR(statbuf.st_mode))
- {
- GRSThttpPrintf(&bp,
- "<tr><td><a href=\"%s%s/%s?cmd=managedir\">"
- "%s/</a></td>"
- "<td align=right>%ld</td>%s\n<td colspan=2> </td>",
- dir_uri, namelist[n]->d_name, admin_file,
- namelist[n]->d_name,
- statbuf.st_size, modified);
-
- if (numfiles == 0)
- GRSThttpPrintf(&bp,
- "<td><a href=\"%s%s?cmd=delete&file=%s\">"
- "Delete</a></td>\n",
- dir_uri, admin_file, namelist[n]->d_name);
- else GRSThttpPrintf(&bp, "<td> </td>\n");
-
- GRSThttpPrintf(&bp, "<td> </td></tr>\n");
- }
- else if (is_dnlists_dir)
- {
- if ((strlen(namelist[n]->d_name) <= encprefixlen) ||
- (strncmp(namelist[n]->d_name, encprefix,
- encprefixlen) != 0)) continue;
-
- d_name = GRSThttpUrlDecode(namelist[n]->d_name);
-
- GRSThttpPrintf(&bp, "<tr><td><a href=\"%s\">%s</a></td>"
- "<td align=right>%ld</td>%s"
- "<td> </td>",
- d_name, d_name,
- statbuf.st_size, modified);
-
- if (GRSTgaclPermHasWrite(perm))
- GRSThttpPrintf(&bp, "<form action=\"%s%s\" method=post>"
- "<td><input type=submit value=Edit></td>"
- "<input type=hidden name=cmd value=editdnlist>"
- "<input type=hidden name=file value=\"%s\">"
- "</form>\n",
- dir_uri, admin_file, d_name);
- else GRSThttpPrintf(&bp, "<td> </td>\n");
-
- if (GRSTgaclPermHasWrite(perm))
- GRSThttpPrintf(&bp, "<form action=\"%s%s\" method=post>"
- "<td><input type=submit value=Delete></td>"
- "<input type=hidden name=cmd value=delete>"
- "<input type=hidden name=file value=\"%s\">"
- "</form>\n",
- dir_uri, admin_file, d_name);
- else GRSThttpPrintf(&bp, "<td> </td>\n");
-
- GRSThttpPrintf(&bp, "<td> </td></tr>");
- }
- else /* regular directory, not DN Lists */
- {
- d_name = namelist[n]->d_name;
-
- GRSThttpPrintf(&bp,
- "<tr><td><a href=\"%s%s\">%s</a></td>"
- "<td align=right>%ld</td>%s",
- dir_uri, d_name,
- d_name,
- statbuf.st_size, modified);
-
- GRSThttpPrintf(&bp,
- "<td><a href=\"%s%s?cmd=history&file=%s\">"
- "History</a></td>",
- dir_uri, admin_file, d_name);
-
- p = rindex(namelist[n]->d_name, '.');
-
- if ((unzip != NULL) &&
- (p != NULL) &&
- (strcasecmp(&p[1], "zip") == 0) &&
- GRSTgaclPermHasRead(perm))
- GRSThttpPrintf(&bp,
- "<td><a href=\"%s%s?cmd=ziplist&file=%s\">"
- "List</a></td>\n",
- dir_uri, admin_file, d_name);
- else if ((p != NULL) &&
- (strstr(editable, &p[1]) != NULL) &&
- GRSTgaclPermHasWrite(perm))
- GRSThttpPrintf(&bp,
- "<td><a href=\"%s%s?cmd=edit&file=%s\">"
- "Edit</a></td>\n",
- dir_uri, admin_file, d_name);
- else GRSThttpPrintf(&bp, "<td> </td>");
-
- if (GRSTgaclPermHasWrite(perm))
- GRSThttpPrintf(&bp,
- "<td><a href=\"%s%s?cmd=delete&file=%s\">"
- "Delete</a></td>\n", dir_uri, admin_file, d_name);
- else
- GRSThttpPrintf(&bp, "<td> </td>\n");
-
- if (GRSTgaclPermHasWrite(perm))
- GRSThttpPrintf(&bp,
- "<td><a href=\"%s%s?cmd=rename&file=%s\">"
- "Rename</a></td></tr>\n", dir_uri, admin_file, d_name);
- else
- GRSThttpPrintf(&bp, "<td> </td></tr>");
- }
- }
-
- free(namelist[n]);
- }
-
- free(namelist);
- }
-
- if (GRSTgaclPermHasWrite(perm))
- {
- if (is_dnlists_dir)
- {
- GRSThttpPrintf(&bp, "<form method=post action=\"%s%s\">\n"
- "<tr><td colspan=4>New list name: "
- "<input type=text name=file value=\"%sNEW_LIST\" size=%d>\n"
- "<input type=hidden name=cmd value=editdnlist></td>"
- "<td colspan=2 align=center><input type=submit value=Create></td>\n"
- "</tr></form>\n",
- dir_uri, admin_file, fulluri, strlen(fulluri)+8);
-
- GRSThttpPrintf(&bp, "<form method=post action=\"%s%s\">\n"
- "<tr><td colspan=4>New directory: "
- "<input type=text name=file>\n"
- "<td colspan=2 align=center><input type=submit name=button value=\"Create\"></td>\n"
- "<input type=hidden name=cmd value=edit></td></tr></form>\n",
- dir_uri, admin_file);
- }
- else
- {
- GRSThttpPrintf(&bp, "<form method=post action=\"%s%s\">\n"
- "<tr><td colspan=8><hr width=\"75%\"></td></tr>\n"
- "<tr><td>New name:</td>"
- "<td colspan=3><input type=text name=file size=25>\n"
- "<td colspan=2 align=center><input type=submit name=button value=\"New file\"></td>\n"
- "<td colspan=2 align=center><input type=submit name=button value=\"New directory\"></td>\n"
- "<input type=hidden name=cmd value=edit></td></tr></form>\n",
- dir_uri, admin_file);
-
- GRSThttpPrintf(&bp,
- "<form method=post action=\"%s%s\" enctype=\"multipart/form-data\">\n"
- "<tr><td colspan=8><hr width=\"75%\"></td></tr>\n"
- "<tr><td rowspan=2>Upload file:</td>"
- "<td colspan=2>New name:</td>"
- "<td colspan=6><input type=text name=file size=25> "
- "<input type=submit value=Upload></td></tr>\n"
- "<tr><td colspan=2>Local name:</td>"
- "<td colspan=6><input type=file name=uploadfile size=25></td></tr>\n"
- "</form>\n", dir_uri, admin_file);
- }
- }
-
- GRSThttpPrintf(&bp, "</table>\n");
-
- if (!is_dnlists_dir) adminfooter(&bp, dn, help_uri, dir_uri, NULL);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
- GRSThttpWriteOut(&bp);
-}
-
+++ /dev/null
-/*
- Copyright (c) 2003-5, Shiv Kaushal, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*-----------------------------------------------------------*
-* This program is part of GridSite: http://www.gridsite.org/ *
-*------------------------------------------------------------*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gridsite.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-extern char *grst_perm_syms[];
-extern int grst_perm_vals[];
-
-#include "grst_admin.h"
-
-// CGI GACL Editor interface functions
-void show_acl(int admin, GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void new_entry_form(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void new_entry(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void del_entry(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void edit_entry_form(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void edit_entry(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void add_cred_form(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void add_cred(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void del_cred(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void del_entry_sure(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void del_cred_sure(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void admin_continue(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file, GRSThttpBody *bp);
-
-// Functions for producing HTML output
-void StartHTML(GRSThttpBody *bp, char *dir_uri, char* dir_path);
-void StartForm(GRSThttpBody *bp, char* dir_uri, char* dir_path, char* admin_file, int timestamp, char* target_function);
-void EndForm(GRSThttpBody *bp);
-void GRSTgaclCredTableStart(GRSThttpBody *bp);
-void GRSTgaclCredTableAdd(GRSTgaclUser *user, GRSTgaclEntry *entry, GRSTgaclCred *cred, GRSTgaclNamevalue *namevalue, int cred_no, int entry_no, int admin, int timestamp, GRSThttpBody *bp, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-void GRSTgaclCredTableEnd(GRSTgaclEntry* entry, int entry_no, int admin, int timestamp, GRSThttpBody *bp, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-
-// ACL Manipulation functions
-int GACLentriesInAcl(GRSTgaclAcl *acl);
-int GRSTgaclCredsInEntry(GRSTgaclEntry *entry);
-void check_acl_save(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file, GRSTgaclUser* user, GRSTgaclAcl *acl, GRSThttpBody *bp);
-void GACLeditGetPerms(GRSTgaclEntry *entry);
-GRSTgaclEntry *GACLreturnEntry(GRSTgaclAcl *acl, int entry_no);
-GRSTgaclCred *GACLreturnCred(GRSTgaclEntry *entry, int cred_no);
-
-void StringHTMLEncode (char* string, GRSThttpBody *bp);
-
-void revert_acl(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file);
-
-/*****************************************/
-/********** FUNCTIONS FOLLOW *************/
-/*****************************************/
-
-void show_acl(int admin, GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- // Shows the contents of the ACL. Gives edit 'buttons' if (int admin) == 1
- GRSTgaclAcl *acl;
- GRSTgaclEntry *entry;
- GRSTgaclCred *cred;
- GRSTgaclNamevalue *namevalue;
- int entry_no, cred_no, allow, deny,timestamp;
- GRSThttpBody bp;
- char* AclFilename;
- struct stat file_info;
- int history_mode=0;
-
- if (admin==2){
- history_mode=1;
- admin=0;
- }
-
- /*double-check access permision*/
- if (!GRSTgaclPermHasAdmin(perm)) admin=0;
-
- StartHTML(&bp, dir_uri, dir_path);
-
- /* Load ACL from file and get timestamp*/
- if (history_mode==1) {
- AclFilename=malloc(strlen(dir_path)+strlen(file)+2);
- strcpy(AclFilename, dir_path);
- strcat(AclFilename, "/");
- strcat(AclFilename, file);
- }
- else AclFilename=GRSTgaclFileFindAclname(dir_path);
-
- if (AclFilename==NULL){
- GRSThttpPrintf ( &bp,"The ACL was not found !!!<br>\n");
- admin_continue(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, &bp);
- return;
- }
-
- stat(GRSTgaclFileFindAclname(dir_path), &file_info);
- timestamp=file_info.st_mtime;
- acl = GRSTgaclAclLoadFile(AclFilename);
-
- if (acl==NULL){
- GRSThttpPrintf ( &bp,"The ACL was found but could not be loaded - it could be incorrectly formatted<br>\n");
- adminfooter(&bp, dn, help_uri, dir_uri, NULL);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
- GRSThttpWriteOut(&bp);
- return;
- }
-
- if (admin) GRSThttpPrintf (&bp,"<a href=\"%s%s?cmd=new_entry_form&diruri=%s×tamp=%d\">New Entry</a><br>\n", dir_uri, admin_file, dir_uri, timestamp );
-
- // Start with the first entry in the list and work through
- entry=acl->firstentry;
- entry_no=1;
- while (entry!=NULL){
-
- GRSThttpPrintf (&bp,"<br>Entry %d:\n", entry_no);
- if (admin){
- GRSThttpPrintf (&bp,"<a href=\"%s%s?cmd=edit_entry_form&entry_no=%d&diruri=%s×tamp=%d\">Edit Entry</a> ", dir_uri, admin_file, entry_no, dir_uri, timestamp );
- GRSThttpPrintf (&bp,"<a href=\"%s%s?cmd=del_entry_sure&entry_no=%d&diruri=%s×tamp=%d\">Delete Entry</a> ",dir_uri, admin_file, entry_no, dir_uri, timestamp );
- GRSThttpPrintf (&bp,"<p>\n");
- }
-
- GRSTgaclCredTableStart(&bp);
-
- // Start with the first credential in the entry and work through
- cred=entry->firstcred;
- cred_no=1;
- while (cred!=NULL){
- namevalue=cred->firstname;
- GRSTgaclCredTableAdd(user, entry, cred, namevalue, cred_no, entry_no, admin, timestamp, &bp, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- // Change to next credential
- cred=cred->next;
- cred_no++;
- }
-
- GRSTgaclCredTableEnd (entry, entry_no, admin, timestamp, &bp, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- // Change to next entry
- entry=entry->next;
- entry_no++;
- }
-
- if (!admin && GRSTgaclPermHasAdmin(perm) && !history_mode) //Print a link for admin mode, if not in admin mode but the user has admin permissions
- GRSThttpPrintf (&bp,"<a href=\"%s%s?cmd=admin_acl&diruri=%s×tamp=%d\">Admin Mode</a>", dir_uri, admin_file, dir_uri, timestamp );
- if (history_mode==1 && GRSTgaclDNlistHasUser(getenv("REDIRECT_GRST_ADMIN_LIST"), user)){
- StartForm(&bp, dir_uri, dir_path, admin_file, timestamp, "revert_acl");
-//GRSThttpPrintf (&bp,"<a href=\"%s%s?cmd=revert_acl&diruri=%s×tamp=%d&file=%s\">Revert to this Version</a>", dir_uri, admin_file, dir_uri, timestamp, file );
- GRSThttpPrintf (&bp, "<input type=\"hidden\" name=\"file\" value=\"%s\">\n", file);
- // Revert Button
- GRSThttpPrintf (&bp, "<p align=center><input type=\"submit\" value=\"Revert to this ACL\" name=\"B1\"></p>\n</form>\n");
- }
-
- adminfooter(&bp, dn, help_uri, dir_uri, NULL);
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE); GRSThttpWriteOut(&bp); return;
-}
-
-
-void new_entry_form(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm,char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- // Presents the user with a form asking for details required to create a new entry
- GRSThttpBody bp;
- int timestamp=atol(GRSThttpGetCGI("timestamp"));
- GRSTgaclCred* cred;
- GRSTgaclEntry *entry;
- GRSTgaclNamevalue* namevalue;
-
- if (!GRSTgaclPermHasAdmin(perm)) GRSThttpError ("403 Forbidden");
-
- StartHTML(&bp, dir_uri, dir_path);
- StartForm(&bp, dir_uri, dir_path, admin_file, timestamp, "new_entry");
- GRSThttpPrintf (&bp, "<font size=\"4\"><b>NEW ENTRY IN ACL FOR %s </b></font></p>\n", dir_uri);
-
- GRSTgaclCredTableStart(&bp);
- GRSTgaclCredTableAdd(user, entry,cred, namevalue, 0, 0, 0, timestamp, &bp, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- GRSTgaclCredTableEnd (entry, 0, 0, timestamp, &bp, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
-
- /*Submit and reset buttons - submit button sends the data in the form back to the script & new_entry() to be called*/
- EndForm(&bp);
- admin_continue(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, &bp);
- return;
-}
-
-void new_entry(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- // Processes the information entered into the form from new_entry_form() and adds a new entry to the ACL
- GRSTgaclAcl *acl;
- GRSTgaclEntry *entry;
- GRSTgaclCred *cred;
- char *type, *value;
- GRSThttpBody bp;
- if (!GRSTgaclPermHasAdmin(perm)) GRSThttpError ("403 Forbidden");
-
- // Get new credential info and perform checks
- type=GRSThttpGetCGI("type");
- value=GRSThttpGetCGI("cred0_value");
-
- if (strcmp(type, "not_chosen")==0){
- GRSThttpError ("500 Invalid input - credential type not chosen");
- return;
- }
-
- // Create the credential
- cred=GRSTgaclCredNew(type);
- if (strcmp(type, "person")==0) GRSTgaclCredAddValue(cred,"dn", value);
- else if (strcmp(type, "dn-list")==0) GRSTgaclCredAddValue(cred, "url", value);
- else if (strcmp(type, "voms")==0) GRSTgaclCredAddValue(cred, "fqan", value);
- else if (strcmp(type, "dns")==0) GRSTgaclCredAddValue(cred, "hostname", value);
- else if (strcmp(type, "any-user")==0) {} // namevalue not entered for any-user credential
- else{
- GRSThttpError ("500 Invalid input - credential type not valid");
- return;
- }
-
- // Create and empty entry, add the credential and get permissions
- entry = GRSTgaclEntryNew();
- GRSTgaclEntryAddCred(entry, cred);
- GACLeditGetPerms(entry);
-
- // Load the ACL, add the entry and save
- acl = GRSTgaclAclLoadFile(GRSTgaclFileFindAclname(dir_path));
- GRSTgaclAclAddEntry(acl, entry);
- check_acl_save(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, user, acl, &bp);
- return;
-}
-
-void del_entry(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- // Deletes the entry denoted by the GCI variable "entry_no"*/
- int entry_no;
- GRSTgaclAcl *acl;
- GRSTgaclEntry *previous, *entry;
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasAdmin(perm)) GRSThttpError ("403 Forbidden");
-
- // Load the ACL
- acl = GRSTgaclAclLoadFile(GRSTgaclFileFindAclname(dir_path));
-
- // Get the number of the entry to be deleted and check okay to delete
- entry_no=atol(GRSThttpGetCGI("entry_no"));
- if(GACLentriesInAcl(acl)<=1){
- StartHTML(&bp, dir_uri, dir_path);
- GRSThttpPrintf (&bp, "ERROR: Cannot delete all entries from the ACL<br>\n");
- admin_continue(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, &bp);
- return;
- }
-
- // Get pointer to entry and previous entry
- entry = GACLreturnEntry(acl, entry_no);
- if (entry_no!=1) previous = GACLreturnEntry(acl, entry_no-1);
-
- if(entry==NULL || entry_no<1 || entry_no>GACLentriesInAcl(acl) ){
- GRSThttpError ("500 Unable to read entry from ACL file");
- return;
- }
-
- // Perform deletion from the list by changing pointers
- if (entry_no==1) acl->firstentry=entry->next;
- else if (entry_no==GACLentriesInAcl(acl)) previous->next=NULL;
- else previous->next=entry->next;
-
- // Save ACL and exit
- check_acl_save(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, user, acl, &bp);
-
- return;
-}
-
-
-void edit_entry_form(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- // Presents the user with an editable form containing details of entry denoted by CGI variable entry_no*/
- int entry_no, cred_no, i, admin=0, timestamp=atol(GRSThttpGetCGI("timestamp"));
- GRSTgaclAcl *acl;
- GRSTgaclEntry *entry;
- GRSTgaclCred *cred;
- GRSTgaclNamevalue *namevalue;
- // struct _GACLnamevalue *namevalue;
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasAdmin(perm)) GRSThttpError ("403 Forbidden");
-
- // Load ACL from file
- acl = GRSTgaclAclLoadFile(GRSTgaclFileFindAclname(dir_path));
-
- // Get pointer to the entry and check okay
- entry_no=atol(GRSThttpGetCGI("entry_no"));
- entry = GACLreturnEntry(acl, entry_no);
- if(entry==NULL || entry_no<1 || entry_no>GACLentriesInAcl(acl) ){
- GRSThttpError ("500 Unable to read from ACL file");
- return;
- }
-
- StartHTML(&bp, dir_uri, dir_path);
- GRSThttpPrintf (&bp, "<b><font size=\"4\">EDITING ENTRY %d IN ACL FOR %s </font></b></p>\n", entry_no, dir_uri);
-
- // Start with first credential in the entry and display them in order*/
- cred=entry->firstcred;
- cred_no=1;
- StartForm(&bp, dir_uri, dir_path, admin_file, timestamp, "edit_entry");
- GRSThttpPrintf (&bp, "<input type=\"hidden\" name=\"entry_no\" value=\"%d\">\n", entry_no);
-
- GRSTgaclCredTableStart(&bp);
-
- while (cred!=NULL){
- // Start with the first namevalue in the credential
- namevalue=cred->firstname;
- GRSTgaclCredTableAdd(user, entry, cred, namevalue, cred_no, entry_no, admin, timestamp, &bp, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- // Change to next credential
- cred=cred->next;
- cred_no++;
- }
- GRSTgaclCredTableEnd (entry, entry_no, admin, timestamp, &bp, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- EndForm(&bp);
-
- admin_continue(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, &bp);
- return;
-}
-
-
-void edit_entry(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- //Processes the information entered into the form from edit_entry_form() and updates the entry corresponding to entry_no*/
- int entry_no, cred_no, i;
- GRSTgaclAcl *acl;
- GRSTgaclEntry *entry;
- GRSTgaclCred *cred;
- GRSTgaclNamevalue *namevalue;
- char variable[30];
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasAdmin(perm)) GRSThttpError ("403 Forbidden");
-
- // Load the ACL
- acl = GRSTgaclAclLoadFile(GRSTgaclFileFindAclname(dir_path));
-
- // Get pointer to the entry and perform checks
- entry_no=atol(GRSThttpGetCGI("entry_no"));
- entry = GACLreturnEntry(acl, entry_no);
- if(entry==NULL || entry_no<1 || entry_no>GACLentriesInAcl(acl) ){
- GRSThttpError ("500 Unable to read from ACL file");
- return;
- }
-
- // Start with the first credential and update each one
- cred=entry->firstcred;
- cred_no=1;
-
- while (cred!=NULL){
- if (strcmp(cred->type, "any-user")!=0){
- namevalue=cred->firstname;
- sprintf(variable, "cred%d_value", cred_no);
- namevalue->value=GRSThttpGetCGI(variable);
- }
- //Change to next credential*/
- cred=cred->next;
- cred_no++;
- }
-
- // Update permissions
- GACLeditGetPerms(entry);
- check_acl_save(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, user, acl, &bp);
- return;
-}
-
-
-void add_cred_form(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- // Presents the user with a form asking for details required to create a new credential in the entry denoted by entry_no
- GRSThttpBody bp;
- int timestamp=atol(GRSThttpGetCGI("timestamp")), entry_no=atol(GRSThttpGetCGI("entry_no"));
- GRSTgaclAcl *acl;
- GRSTgaclEntry* entry;
- GRSTgaclCred* cred;
- GRSTgaclNamevalue* namevalue;
-
- if (!GRSTgaclPermHasAdmin(perm)) GRSThttpError ("403 Forbidden");
-
- acl = GRSTgaclAclLoadFile(GRSTgaclFileFindAclname(dir_path)); // Load the ACL
-
- //Get pointer to the entry and perform checks
- entry = GACLreturnEntry(acl, entry_no);
- if(entry==NULL || entry_no<1 || entry_no>GACLentriesInAcl(acl) ){
- GRSThttpError ("500 Unable to read from ACL file");
- return;
- }
-
-
- if (strcmp(GRSThttpGetCGI("cmd"), "add_cred_form")==0){ //if not a new entry check to see if <any-user> cred exists
- cred=entry->firstcred;
- while (cred!=NULL) {
- if (strcmp (cred->type, "any-user")==0) {
- StartHTML(&bp, dir_uri, dir_path);
- GRSThttpPrintf (&bp, "ERROR: AND-ing \"any-user\" credential with other credential does not make sense <br>\n");
- admin_continue(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, &bp);
- return;
- }
- cred=cred->next;
- }
- }
-
- StartHTML(&bp, dir_uri, dir_path);
- GRSThttpPrintf (&bp, " <font size=\"4\"><b>NEW CREDENTIAL IN ENTRY %d OF ACL FOR %s</b></font></p>\n", entry_no, dir_uri);
- StartForm(&bp, dir_uri, dir_path, admin_file, timestamp, "add_cred");
-
- GRSThttpPrintf (&bp, " <input type=\"hidden\" name=\"entry_no\" value=\"%d\">\n", entry_no);
-
- GRSTgaclCredTableStart(&bp);
- GRSTgaclCredTableAdd(user, entry, cred, namevalue, 0, 0, 0, timestamp, &bp, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- GRSTgaclCredTableEnd (entry, 0, 0, timestamp, &bp, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
-
- EndForm(&bp);
- admin_continue(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, &bp);
- return;
-}
-
-
-void add_cred(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- // Processes the information entered into the form [add_cred_form()]and adds a new credential to the entry corresponding to entry_no
- int entry_no;
- GRSTgaclAcl *acl;
- GRSTgaclEntry *entry;
- GRSTgaclCred *cred;
- GRSThttpBody bp;
- char *type, *value;
-
- if (!GRSTgaclPermHasAdmin(perm)) GRSThttpError ("403 Forbidden");
-
- acl = GRSTgaclAclLoadFile(GRSTgaclFileFindAclname(dir_path));// Load the ACL
-
- // Get pointer to the entry and perform checks
- entry_no=atol(GRSThttpGetCGI("entry_no"));
- entry = GACLreturnEntry(acl, entry_no);
- if(entry==NULL || entry_no<1 || entry_no>GACLentriesInAcl(acl)){
- GRSThttpError ("500 Unable to read from ACL file");
- return;
- }
-
- // Create new credential and add it to entry
- type=GRSThttpGetCGI("type");
- value=GRSThttpGetCGI("cred0_value");
- cred=GRSTgaclCredNew(type);
- if (strcmp(type, "person") ==0) GRSTgaclCredAddValue(cred,"dn", value);
- else if (strcmp(type, "dn-list") ==0) GRSTgaclCredAddValue(cred, "url", value);
- else if (strcmp(type, "voms") ==0) GRSTgaclCredAddValue(cred, "fqan", value);
- else if (strcmp(type, "dns") ==0) GRSTgaclCredAddValue(cred, "hostname", value);
- else if (strcmp(type, "any-user")==0) {}// namevalue not entered for any-user credential
- else{
- GRSThttpError ("500 Credential type not valid");
- return;
- }
- GRSTgaclEntryAddCred(entry, cred);
-
- check_acl_save(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, user, acl, &bp);
- return;
-}
-
-
-void del_cred(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- // Deletes the credential denoted by the GCI variable "cred_no", in the entry denoted by "entry_no"
- int entry_no, cred_no;
- GRSTgaclAcl *acl;
- GRSTgaclEntry *entry;
- GRSTgaclCred *previous, *cred;
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasAdmin(perm)) GRSThttpError ("403 Forbidden");
-
- acl = GRSTgaclAclLoadFile(GRSTgaclFileFindAclname(dir_path));
-
- // Get pointer to the entry and perform checks
- entry_no=atol(GRSThttpGetCGI("entry_no"));
- entry = GACLreturnEntry(acl, entry_no);
- if(entry==NULL || entry_no<1 || entry_no>GACLentriesInAcl(acl) ){
- GRSThttpError ("500 Unable to read from ACL file");
- return;
- }
- // Get pointer the the credential and perform checks
- cred_no=atol(GRSThttpGetCGI("cred_no"));
- cred=GACLreturnCred(entry, cred_no);
- if(entry==NULL || entry_no<1 || cred_no>GRSTgaclCredsInEntry(entry)){
- GRSThttpError ("500 Unable to read from ACL file");
- return;
- }
- // Get pointer to previous credential - if needed
- if (cred_no!=1) previous = GACLreturnCred(entry, cred_no-1);
-
- // Perform deletion from the list by changing pointers
- if (cred_no==1) entry->firstcred=cred->next;
- else if (cred_no==GRSTgaclCredsInEntry(entry)) previous->next=NULL;
- else previous->next=cred->next;
-
- check_acl_save(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, user, acl, &bp);
- return;
-}
-
-void admin_continue(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file, GRSThttpBody *bp){
- // Single line printed out to forward users back to show_acl in admin mode
- // Should ALWAYS called from another function so no HTML header required
- // Should ALWAYS be the end of a page
- GRSThttpPrintf (bp, "\n<br><a href=\"%s%s?diruri=%s&cmd=admin_acl×tamp=%d\">Click Here</a> to return to the editor", dir_uri,admin_file,dir_uri, time(NULL));
- adminfooter(bp, dn, help_uri, dir_uri, NULL);
- GRSThttpPrintHeaderFooter(bp, dir_path, GRST_FOOTFILE);
- GRSThttpWriteOut(bp);
- return;
-}
-
-
-void del_entry_sure(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- // Prints out entry denoted by entry_no and asks if the user really wants to delete it
- GRSTgaclAcl *acl;
- GRSTgaclEntry *entry;
- GRSTgaclCred *cred;
- GRSTgaclNamevalue *namevalue;
- int entry_no, cred_no, allow, deny, i, timestamp;
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasAdmin(perm)) GRSThttpError ("403 Forbidden");
-
- acl = GRSTgaclAclLoadFile(GRSTgaclFileFindAclname(dir_path));// Load ACL from file
-
- if (acl==NULL){
- GRSThttpError ("500 Unable to read from ACL file");
- return;
- }
-
- // Get pointer to the entry and check okay
- entry_no=atol(GRSThttpGetCGI("entry_no"));
- entry = GACLreturnEntry(acl, entry_no);
- if(entry==NULL || entry_no<1 || entry_no>GACLentriesInAcl(acl) ){
- GRSThttpError ("500 Unable to read from ACL file");
- return;
- }
-
- StartHTML(&bp, dir_uri, dir_path);
- GRSThttpPrintf (&bp, "<h1 align=center>Do you really want to delete the following entry?</h1><br><br>\n");
- GRSThttpPrintf (&bp,"<br>Entry %d:<br>\n", entry_no);
-
- // Print the entry out
- // Start with the first credential in the entry and work through
- cred=entry->firstcred;
- cred_no=1;
-
- GRSTgaclCredTableStart(&bp);
- while (cred!=NULL){
- // Start with the first namevalue in the credential
- namevalue=cred->firstname;
- GRSTgaclCredTableAdd(user, entry, cred, namevalue, cred_no, entry_no, 0, 0, &bp, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- // Change to next credential
- cred=cred->next;
- cred_no++;
- }
-
- GRSTgaclCredTableEnd (entry, entry_no, 0, 0, &bp, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
-
- StartForm(&bp, dir_uri, dir_path, admin_file, atol(GRSThttpGetCGI("timestamp")), "del_entry");
- GRSThttpPrintf (&bp, "<input type=\"hidden\" name=\"entry_no\" value=\"%d\">\n", entry_no);
- GRSThttpPrintf (&bp, " <p align=center><input type=\"submit\" value=\"Yes\" name=\"B1\"></p>\n</form>\n");
-
- admin_continue(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, &bp);
- return;
-}
-
-void del_cred_sure(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- // Prints out credential denoted by entry_no/cred_no and asks if the user really wants to delete it
- GRSTgaclAcl *acl;
- GRSTgaclEntry *entry;
- GRSTgaclCred *cred;
- GRSTgaclNamevalue *namevalue;
- int entry_no, cred_no, allow, deny, timestamp, i;
- GRSThttpBody bp;
-
- if (!GRSTgaclPermHasAdmin(perm)) GRSThttpError ("403 Forbidden");
-
- acl = GRSTgaclAclLoadFile(GRSTgaclFileFindAclname(dir_path));// Load ACL from file
-
- if (acl==NULL){
- GRSThttpError ("500 Unable to read from ACL file");
- return;
- }
-
- // Get pointer to the entry and check okay
- entry_no=atol(GRSThttpGetCGI("entry_no"));
- entry = GACLreturnEntry(acl, entry_no);
- if(entry==NULL || entry_no<1 || entry_no>GACLentriesInAcl(acl) ){
- GRSThttpError ("500 Unable to read from ACL file");
- return;
- }
-
- // Get pointer to the credential and check okay
- cred_no=atol(GRSThttpGetCGI("cred_no"));
- cred=GACLreturnCred(entry, cred_no);
- if(entry==NULL || entry_no<1 || cred_no>GRSTgaclCredsInEntry(entry)){
- GRSThttpError ("500 Unable to read from ACL file");
- return;
- }
-
- if(GRSTgaclCredsInEntry(entry)<=1){
- del_entry_sure(user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- return;
- }
-
- StartHTML(&bp, dir_uri, dir_path);
- GRSThttpPrintf (&bp, "<h1 align=center>Do you really want to delete the following credential from entry %d?</h1><br><br>", entry_no);
-
- // Print the credential out
- GRSTgaclCredTableStart(&bp);
- GRSTgaclCredTableAdd(user, entry, cred, cred->firstname, cred_no, entry_no, 0, 0, &bp, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- GRSTgaclCredTableEnd (entry, entry_no, 0, 0, &bp, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- GRSThttpPrintf (&bp,"<br>\n");
-
- // Yes Button
- StartForm(&bp, dir_uri, dir_path, admin_file, atol(GRSThttpGetCGI("timestamp")), "del_cred");
- GRSThttpPrintf (&bp, "<input type=\"hidden\" name=\"entry_no\" value=\"%d\">\n", entry_no);
- GRSThttpPrintf (&bp, "<input type=\"hidden\" name=\"cred_no\" value=\"%d\">\n", cred_no);
- GRSThttpPrintf (&bp, " <p align=center><input type=\"submit\" value=\"Yes\" name=\"B1\"></p>\n</form>\n");
-
- admin_continue(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, &bp);
- return;
-}
-
-
-int GACLentriesInAcl(GRSTgaclAcl *acl){
- // Returns the number of entries in acl
- GRSTgaclEntry *entry;
- int number;
-
- entry=acl->firstentry;
- number=0;
-
- while (entry!=NULL)
- {
- number++;
- entry=entry->next;
- }
-
- return number;
-}
-
-int GRSTgaclCredsInEntry(GRSTgaclEntry *entry){
- // Returns the number of credentials in entry
- int number;
- GRSTgaclCred *cred;
-
- cred=entry->firstcred;
- number=0;
-
- while (cred!=NULL)
- {
- number++;
- cred=cred->next;
- }
-
- return number;
-}
-
-
-void GACLeditGetPerms(GRSTgaclEntry *entry){
- // Updates the permissions entry using permissions from a form produced using GRSTgaclCredTableEnd
- int i;
- char buf[30];
-
-
- for (i=0; grst_perm_syms[i]!=NULL; i++) /* Print the list of allowed permissions*/
- {
- sprintf (buf, "allow_%s", grst_perm_syms[i]); // Update allowed
- if (strcmp (GRSThttpGetCGI(buf), "ON") == 0 ) GRSTgaclEntryAllowPerm(entry, grst_perm_vals[i]); else GRSTgaclEntryUnallowPerm(entry, grst_perm_vals[i]);
-
- sprintf (buf, "deny_%s", grst_perm_syms[i]); // Update denied
- if (strcmp (GRSThttpGetCGI(buf), "ON") == 0 ) GRSTgaclEntryDenyPerm(entry, grst_perm_vals[i]); else GRSTgaclEntryUndenyPerm(entry, grst_perm_vals[i]);
-
- }
-
- return;
-}
-
-GRSTgaclEntry *GACLreturnEntry(GRSTgaclAcl *acl, int entry_no){
- // Returns a pointer to entry in ACL denoted by entry_no, returns NULL if not found
- int number;
- GRSTgaclEntry *entry;
-
- if (acl==NULL) return NULL;
-
- entry=acl->firstentry;
- number=1;
-
- while (entry!=NULL)
- {
- if (number==entry_no) return entry;
- number++;
- entry=entry->next;
- }
-
- return NULL;
-}
-
-
-GRSTgaclCred *GACLreturnCred(GRSTgaclEntry *entry, int cred_no){
- // Returns a pointer to credential denoted by cred_no in entry, returns NULL if not found
- int number;
- GRSTgaclCred *cred;
-
- if (entry==NULL) return NULL;
-
- cred=entry->firstcred;
- number=1;
-
- while (cred!=NULL)
- {
- if (number==cred_no) return cred;
- number++;
- cred=cred->next;
- }
-
- return NULL;
-}
-void StartHTML(GRSThttpBody *bp, char *dir_uri, char* dir_path){
- //Start HTML output and insert page title
- printf("Status: 200 OK\nContent-Type: text/html\n");
- GRSThttpBodyInit(bp);
- GRSThttpPrintf(bp, "<title>Access Control List for %s</title>\n", dir_uri);
- GRSThttpPrintHeaderFooter(bp, dir_path, GRST_HEADFILE);
- return;
-}
-void StartForm(GRSThttpBody *bp, char* dir_uri, char* dir_path, char* admin_file, int timestamp, char* target_function){
- // Starts an HTML form with gridsite admin as the target and target_function as the value of cmd.
- // Also inputs the dir_uri and the timestamp
- GRSThttpPrintf (bp, "<form method=\"POST\" action=\"%s%s?diruri=%s\">\n", dir_uri, admin_file, dir_uri);
- GRSThttpPrintf (bp, " <input type=\"hidden\" name=\"cmd\" value=\"%s\">\n", target_function);
- GRSThttpPrintf (bp, " <input type=\"hidden\" name=\"timestamp\" value=\"%d\">\n", timestamp);
- return;
-}
-
-void EndForm(GRSThttpBody *bp){
- GRSThttpPrintf (bp, " <br><input type=\"submit\" value=\"Submit\" name=\"B1\"><input type=\"reset\" value=\"Reset\" name=\"B2\"></p>\n");
- GRSThttpPrintf (bp, "</form>\n");
- return;
-}
-
-void GRSTgaclCredTableStart(GRSThttpBody *bp){
- //Starts an HTML table of credentials by setting the column widths and inputting the headings
- GRSThttpPrintf (bp,"<table border=\"1\" cellpadding=\"2\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"100%\" id=\"CredentialTable\">");
- GRSThttpPrintf (bp,"<tr><td align=center width=\"10%\"><b>Credential No.</td><td align=center width=\"15%\"><b>Type</td><td align=left width=\"75%\"><b>Value</td></tr>");
- return;
-}
-
-void GRSTgaclCredTableAdd(GRSTgaclUser *user, GRSTgaclEntry *entry, GRSTgaclCred *cred, GRSTgaclNamevalue *namevalue, int cred_no, int entry_no, int admin, int timestamp, GRSThttpBody *bp, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- // Adds the credential "cred" to a table started byGRSTgaclCredTableStart allowing the user to edit if appropriate
- char* cmd = GRSThttpGetCGI("cmd");
- int edit_values=0, new_cred=0, allow_new_person=1;
- int site_admin=GRSTgaclDNlistHasUser(getenv("REDIRECT_GRST_ADMIN_LIST"), user);
-
- if (strcmp(cmd, "new_entry_form")==0 || strcmp(cmd, "add_cred_form")==0) new_cred=1;
- if (new_cred || strcmp(cmd, "edit_entry_form")==0) edit_values=1;
-
- if (new_cred) { /*Print out type and descriptor*/
- if (strcmp(cmd, "add_cred_form")==0){ /*if not a new entry check to see if <person> cred exists.*/
- cred=entry->firstcred;
- while (cred!=NULL) {if (strcmp (cred->type, "person")==0) allow_new_person=0; cred=cred->next;}
- }
- //create dummy credential for the user to edit
- cred=GRSTgaclCredNew("new");
- GRSTgaclCredAddValue(cred, "", "");
- namevalue=cred->firstname;
- //Drop down list of types
- GRSThttpPrintf(bp,"<tr><td align=center >New</td>");
- GRSThttpPrintf(bp,"<td align=center >");
- GRSThttpPrintf (bp, " <select size=\"1\" name=\"type\">\n");
- GRSThttpPrintf (bp, " <option selected value=\"not_chosen\">(choose)</option>\n");
- if (allow_new_person) GRSThttpPrintf (bp, " <option value=\"person\">Person <dn> </dn></option>\n");
- GRSThttpPrintf (bp, " <option value=\"dn-list\">DN-List <url> </url></option>\n");
- GRSThttpPrintf (bp, " <option value=\"dns\">DNS <hostname> </hostname></option>\n");
- GRSThttpPrintf (bp, " <option value=\"voms\">VOMS <fqan> </fqan></option>\n");
- // Only alow any-user credential to be chosen if it is new entry
- if (strcmp(cmd, "new_entry_form")==0) GRSThttpPrintf (bp, " <option value=\"any-user\">Any User</option>\n");
- GRSThttpPrintf (bp, " </select></td>");
- }
-
- else { //Print out type and descriptor for existing cred
-
- GRSThttpPrintf(bp,"<tr><td align=center >%d", cred_no);
- if (admin) GRSThttpPrintf (bp,"<a href=\"%s%s?diruri=%s&cmd=del_cred_sure&entry_no=%d&cred_no=%d×tamp=%d\">(Delete)</a>", dir_uri,admin_file,dir_uri, entry_no, cred_no, timestamp);
- GRSThttpPrintf(bp, "</td><td align=center >%s ", cred->type);
- }
-
- if (strcmp(cred->type, "any-user")==0) GRSThttpPrintf (bp, "</td><td> "); /* Do not print out namevalue for any-user credential*/
- else{
- if (edit_values){ // Place namevalue in an editable box if appropriate
- GRSThttpPrintf (bp, "<td align=left><input type=\"text\" name=\"cred%d_value\"\n", cred_no);
- GRSThttpPrintf (bp, "size=\"50\" value=\"");
- StringHTMLEncode(namevalue->value, bp);
- GRSThttpPrintf (bp, "\">");
- }
- else if (strcmp(cred->type, "dn-list")==0){
- GRSThttpPrintf(bp, "<td align=left ><a href=\"");
- StringHTMLEncode(namevalue->value, bp);
- GRSThttpPrintf(bp, " \">");
- StringHTMLEncode(namevalue->value, bp);
- GRSThttpPrintf(bp, "</a>");
- }
- else { GRSThttpPrintf(bp, "<td align=left> "); StringHTMLEncode(namevalue->value, bp);}
-
- }
- //Print out warning symbol if cred being printed relates to current user - but NOT for users in site admin list
- if (GRSTgaclUserHasCred(user, cred) && !site_admin) GRSThttpPrintf(bp, "<font color=red><b> <--</b></font>");
- GRSThttpPrintf(bp, "</td></tr>");
-}
-
-void GRSTgaclCredTableEnd(GRSTgaclEntry* entry, int entry_no, int admin, int timestamp, GRSThttpBody *bp, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- // Finishes off a table of credentials by inputting "Add Credential" link and a list of premissions in the final row
- int i, blank_perms, edit_perms, show_perms;
- char* cmd = GRSThttpGetCGI("cmd");
-
- if (strcmp(cmd, "add_cred_form")==0 ||strcmp(cmd, "del_cred_sure")==0) show_perms=0; else show_perms=1;
- if (strcmp(cmd, "edit_entry_form")==0 || strcmp(cmd, "new_entry_form")==0) edit_perms=1; else edit_perms=0;
- if (strcmp(cmd, "new_entry_form")==0) blank_perms=1; else blank_perms=0;
-
- // If showing the last row is not required then exit
- if (show_perms==0){GRSThttpPrintf (bp,"</table><br>\n"); return;}
-
- GRSThttpPrintf (bp,"<tr><td align=center>");
-
- if (admin) GRSThttpPrintf (bp,"<a href=\"%s%s?diruri=%s&cmd=add_cred_form&entry_no=%d×tamp=%d\">Add Credential</a>", dir_uri,admin_file,dir_uri, entry_no, timestamp);
-
- GRSThttpPrintf (bp, "</td>\n<td> </td><td align=left>");
-
- if (blank_perms) entry->allowed=entry->denied=GRST_PERM_NONE;
-
- // Show Permissions - will produce a list or a list of check boxes depending on whether the permissions are to be edited or not
- GRSThttpPrintf (bp, "<b>Allowed:</b> ");
- for (i=0; grst_perm_syms[i]!=NULL; i++) /* Print the list of allowed permissions*/
- {
- if ( entry->allowed & grst_perm_vals[i]){
- if (edit_perms) GRSThttpPrintf (bp, "%s<input type=\"checkbox\" name=\"allow_%s\" value=\"ON\" checked> \n", grst_perm_syms[i],grst_perm_syms[i]);
- else GRSThttpPrintf(bp,"%s ", grst_perm_syms[i]); if (strcmp(grst_perm_syms[i], "none")==0) break;
- }
- else if (strcmp(grst_perm_syms[i], "none")!=0 && edit_perms) GRSThttpPrintf (bp, "%s<input type=\"checkbox\" name=\"allow_%s\" value=\"ON\" unchecked> \n", grst_perm_syms[i],grst_perm_syms[i]);
- }
-
- if (edit_perms) GRSThttpPrintf (bp, "<p>");
- GRSThttpPrintf (bp, "<b>Denied: </b>");
- for (i=0; grst_perm_syms[i]!=NULL; i++) /* Print the list of denied permissions*/
- {
- if ( entry->denied & grst_perm_vals[i])
- {
- if (edit_perms) GRSThttpPrintf (bp, "%s<input type=\"checkbox\" name=\"deny_%s\" value=\"ON\" checked> \n", grst_perm_syms[i],grst_perm_syms[i]);
- else GRSThttpPrintf(bp,"%s ", grst_perm_syms[i]);
- if (strcmp(grst_perm_syms[i], "none")==0) break;
- }
- else if (strcmp(grst_perm_syms[i], "none")!=0 && edit_perms) GRSThttpPrintf (bp, "%s<input type=\"checkbox\" name=\"deny_%s\" value=\"ON\" unchecked> \n", grst_perm_syms[i],grst_perm_syms[i]);
- }
-
- GRSThttpPrintf (bp, "</td></tr>");
- GRSThttpPrintf (bp,"</table><br>\n");
- GRSThttpPrintf (bp,"\n");
-}
-
-void check_acl_save(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file, GRSTgaclUser* user, GRSTgaclAcl *acl, GRSThttpBody *bp){
- // Checks if the acl for the current directory has been changed, check the current user's permissions.
- // If all is okay the ACl is saved -> returns 1 else returns 0
- struct stat file_info;
- GRSTgaclPerm new_perm;
- char *vfile, *dir_path_vfile, *dir_path_file;
- FILE *fp;
-
-
- /*Check ACL has not been modified*/
- stat(GRSTgaclFileFindAclname(dir_path), &file_info);
- if (atol(GRSThttpGetCGI("timestamp"))!=file_info.st_mtime){
- StartHTML(bp, dir_uri, dir_path);
- GRSThttpPrintf (bp, "ERROR: CANNOT SAVE CHANGES<p><p> The ACL has been modified since it was last viewed\n<p>");
- admin_continue(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, bp);
- return;
- }
-
- // check users permissions in the new ACL
-
- if (!GRSTgaclDNlistHasUser(getenv("REDIRECT_GRST_ADMIN_LIST"), user))
- {
- new_perm = GRSTgaclAclTestUser(acl, user);
- if (new_perm != perm){
- StartHTML(bp, dir_uri, dir_path);
- if (!GRSTgaclPermHasAdmin(new_perm)){//Check that user still has Admin permissions - if not then exit without saving the new ACL
- GRSThttpPrintf (bp, "ERROR: CANNOT SAVE CHANGES\n\n<p><p> You cannot deny yourself admin access from within the editor\n");
- admin_continue(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, bp);
- return;
- }
- //Functions to inform of other permission changes come next
- GRSThttpPrintf (bp, "WARNING: OPERATION CHANGED YOUR PERMISSIONS!\n\n<p><p> You still have Admin permissions<p>\n");
- admin_continue(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, bp);
- return;
- }
- }
- // ACL not modified, notified of permission changes - can now save
-
- dir_path_file=GRSTgaclFileFindAclname(dir_path);
- vfile=makevfilename(".gacl", file_info.st_size, dn); // Make temporary file name
- dir_path_vfile = malloc(strlen(dir_path) + strlen(vfile) + 2);
- strcpy(dir_path_vfile, dir_path);
- strcat(dir_path_vfile, "/");
- strcat(dir_path_vfile, vfile);
-
-
- // save the new ACL to the temporary file in the correct format using the GridsiteACLFormat directive
-
- if (strcasecmp(getenv("REDIRECT_GRST_ACL_FORMAT"), "XACML") ==0) GRSTxacmlAclSave(acl, dir_path_vfile);
- else if (strcasecmp(getenv("REDIRECT_GRST_ACL_FORMAT"), "GACL") ==0) GRSTgaclAclSave(acl, dir_path_vfile);
- else
- {
- GRSThttpPrintf (bp, "ERROR: ACL type not correctly specified");
- admin_continue(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, bp);
- return;
- }
-
-
- unlink(dir_path_file);
- if (link (dir_path_vfile,dir_path_file)!=0) GRSThttpError("403 Forbidden");
-
- printf ("Status: 302 Moved Temporarily\n Content Length: 0\nLocation: %s%s?cmd=admin_acl\n\n", dir_uri, admin_file);
- return;
-}
-
-void StringHTMLEncode (char* string, GRSThttpBody *bp){
-
- char* current_char;
- char* tmp;
- int n;
- tmp=malloc(2);
-
- *(tmp+1)='\0';
- current_char=string;
- while(*current_char != '\0'){
-
- if (*current_char == '<') GRSThttpPrintf (bp,"<");
- else if (*current_char == '>') GRSThttpPrintf (bp,">");
- else if (*current_char == '&') GRSThttpPrintf (bp,"&");
- else if (*current_char == '\'') GRSThttpPrintf (bp,"'");
- else if (*current_char == '"') GRSThttpPrintf (bp,""");
- else{
- *tmp=*current_char;
- GRSThttpPrintf(bp, "%s", tmp);
-
- }
- current_char++;
- }
- return;
-}
-
-void revert_acl(GRSTgaclUser *user, char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path, char *file, char *dir_uri, char *admin_file){
- char *AclFilename;
- GRSTgaclAcl *acl;
- GRSThttpBody bp;
- // Load the old ACL, add the entry and save
- AclFilename=malloc(strlen(dir_path)+strlen(file)+2);
- strcpy(AclFilename, dir_path);
- strcat(AclFilename, "/");
- strcat(AclFilename, file);
-
- acl = GRSTgaclAclLoadFile(AclFilename);
- check_acl_save(dn, perm, help_uri, dir_path, file, dir_uri, admin_file, user, acl, &bp);
- return;
-}
+++ /dev/null
-/*
- Andrew McNab and Shiv Kaushal, University of Manchester.
- Copyright (c) 2002-5. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*------------------------------------------------------------------*
- * This program is part of GridSite: http://www.gridsite.org/ *
- *------------------------------------------------------------------*/
-
-#ifndef VERSION
-#define VERSION "x.x.x"
-#endif
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <stdio.h>
-#include <time.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <fcntl.h>
-
-// when porting: remember that sendfile() is very OS-specific!
-#include <sys/sendfile.h>
-
-#include <gridsite.h>
-
-#include "grst_admin.h"
-
-/*
-
- GridSite human/interactive management interface. This should produce
- a CGI executable, usually ./sbin/real-gridsite-admin.cgi, which is
- called from HTML forms either by GET or POST methods or both (ie input
- present in both QUERY_STRING and the stdin of the CGI process.)
-
- The CGI name/value pairs used are:
-
- cmd = edit, managedir, print, history
- file = short name of file, without path
-
- If real-gridsite-admin.cgi is run by an internal redirection inside
- mod_gridsite (as should ALWAYS be the case) then the environment
- variable REDIRECT_GRST_DIR_PATH will be set to the full path of
- the directory holding the file in question. This respects any complex
- URI -> file path mapping done by Apache.
-
-*/
-
-void GRSThttpError(char *status)
-{
- printf("Status: %s\n", status);
- printf("Server-CGI: GridSite Admin %s\n", VERSION);
- printf("Content-Length: %d\n", 2 * strlen(status) + 58);
- puts("Content-Type: text/html\n");
-
- printf("<head><title>%s</title></head>\n", status);
- printf("<body><h1 >%s</h1 ></body>\n", status);
-
- exit(0);
-}
-
-void adminfooter(GRSThttpBody *bp, char *dn, char *help_uri, char *dir_uri,
- char *admin_file)
-{
- GRSThttpPrintf(bp, "<p><small>\n");
-
- if (dn != NULL) GRSThttpPrintf(bp, "<hr>You are %s<br>\n", dn);
- else GRSThttpPrintf(bp, "<hr>\n");
-
- if (admin_file != NULL)
- GRSThttpPrintf(bp, "<a href=\"%s%s?cmd=managedir\">"
- "Manage directory</a> .\n",
- dir_uri, admin_file);
- else GRSThttpPrintf(bp, "<a href=\"%s\">"
- "Back to directory</a> .\n", dir_uri);
-
- if (help_uri != NULL)
- GRSThttpPrintf(bp, "<a href=\"%s\">Website Help</a> .\n", help_uri);
-
- if ((getenv("GRST_NO_LINK") == NULL) &&
- (getenv("REDIRECT_GRST_NO_LINK") == NULL))
- GRSThttpPrintf(bp, "Built with "
- "<a href=\"http://www.gridsite.org/\">GridSite</a> %s\n",
- VERSION);
-
- GRSThttpPrintf(bp, "</small>\n");
-}
-
-int GRSTstrCmpShort(char *long_s, char *short_s)
-{
- while (*short_s != '\0')
- {
- if (*long_s > *short_s) return +1;
- if (*long_s < *short_s) return -1;
-
- ++long_s;
- ++short_s;
- }
-
- return 0;
-}
-
-char *makevfilename(char *publicname, size_t size, char *dn)
-{
- int i;
- char *ext, *vfilename, *encpublicname, *encdn, *p;
- struct timeval tv_now;
-
- gettimeofday(&tv_now, NULL);
-
- ext = rindex(publicname, '.');
- if (ext == NULL) ext = "";
-
- encpublicname = GRSThttpUrlEncode(publicname);
- for (p=encpublicname; *p != '\0'; ++p) if (*p == '%') *p = '=';
-
- encdn = GRSThttpUrlEncode(dn);
- for (p=encdn; *p != '\0'; ++p) if (*p == '%') *p = '=';
-
- /* we used zero-padding for times so
- alphanumeric sorting will sort chronologically too */
-
- asprintf(&vfilename, "%s:%s:%08X:%05X:%X:%s:%s", GRST_HIST_PREFIX,
- encpublicname, tv_now.tv_sec, tv_now.tv_usec, size, encdn, ext);
-
- return vfilename;
-}
-
-void justheader(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *dir_uri, char *admin_file)
-{
- GRSThttpBody bp;
-
- puts("Status: 200 OK\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_HEADFILE);
-
- GRSThttpWriteOut(&bp);
-}
-
-void justfooter(char *dn, GRSTgaclPerm perm, char *help_uri, char *dir_path,
- char *dir_uri, char *admin_file)
-{
- GRSThttpBody bp;
-
- puts("Status: 200 OK\nContent-Type: text/html");
-
- GRSThttpBodyInit(&bp);
-
- if (GRSTgaclPermHasList(perm) || GRSTgaclPermHasWrite(perm)
- || GRSTgaclPermHasAdmin(perm))
- adminfooter(&bp, dn, help_uri, dir_uri, admin_file);
-
- GRSThttpPrintHeaderFooter(&bp, dir_path, GRST_FOOTFILE);
-
- GRSThttpWriteOut(&bp);
-}
-
-int main()
-{
- int i, gsiproxylimit_i = 1;
- char *cmd, *dir_uri, *file, *dir_path, *admin_file, *dn = NULL,
- *help_uri, *p, *content_type, *request_uri, *button,
- *grst_cred_0, *gsiproxylimit, *dn_lists, buf[12];
- GRSTgaclCred *cred;
- GRSTgaclUser *user = NULL;
- GRSTgaclAcl *acl;
- GRSTgaclPerm perm = GRST_PERM_NONE;
-
- help_uri = getenv("REDIRECT_GRST_HELP_URI"); /* can be NULL */
- admin_file = getenv("REDIRECT_GRST_ADMIN_FILE");
- dir_path = getenv("REDIRECT_GRST_DIR_PATH");
- request_uri = getenv("REQUEST_URI");
-
- if ((dir_path == NULL) || (admin_file == NULL) || (request_uri == NULL))
- {
- puts("Status: 500 Internal Server Error\nContent-type: text/plain\n\n"
- "REDIRECT_GRST_DIR_PATH or REDIRECT_GRST_ADMIN_FILE "
- "or REQUEST_URI missing");
- return;
- }
-
- GRSTgaclInit();
-
- grst_cred_0 = getenv("GRST_CRED_0");
-
- if ((grst_cred_0 != NULL) && (cred = GRSTx509CompactToCred(grst_cred_0)))
- {
- gsiproxylimit = getenv("REDIRECT_GRST_GSIPROXY_LIMIT");
- if (gsiproxylimit != NULL) sscanf(gsiproxylimit, "%d", &gsiproxylimit_i);
-
- if (GRSTgaclCredGetDelegation(cred) <= gsiproxylimit_i)
- {
- user = GRSTgaclUserNew(cred);
-
- if ((p = index(grst_cred_0, ' ')) &&
- (p = index(++p, ' ')) &&
- (p = index(++p, ' ')) &&
- (p = index(++p, ' '))) dn = &p[1];
- }
- /* User has a cert so check for voms attributes */
- for(i=1; ; i++)
- {
- sprintf (buf, "GRST_CRED_%d", i);
-
-
- grst_cred_0 = getenv(buf);
- if (grst_cred_0==NULL) break;
-
- if (cred=GRSTx509CompactToCred(grst_cred_0))
- GRSTgaclUserAddCred(user, cred);
- }
- /* no more voms attributes found found */
- }
- else if ((dn = getenv("SSL_CLIENT_S_DN")) != NULL)
- {
- cred = GRSTgaclCredNew("person");
- GRSTgaclCredAddValue(cred, "dn", dn);
- user = GRSTgaclUserNew(cred);
- }
-
- dn_lists = getenv("REDIRECT_GRST_DN_LISTS");
- if (dn_lists == NULL) dn_lists = getenv("GRST_DN_LISTS");
- if (dn_lists != NULL) GRSTgaclUserSetDNlists(user, dn_lists);
-
- if (GRSTgaclDNlistHasUser(getenv("REDIRECT_GRST_ADMIN_LIST"),
- user)) perm = GRST_PERM_ALL;
- else
- {
- p = getenv("REMOTE_HOST");
- if (p != NULL)
- {
- cred = GRSTgaclCredNew("dns");
- GRSTgaclCredAddValue(cred, "hostname", p);
-
- if (user == NULL) user = GRSTgaclUserNew(cred);
- else GRSTgaclUserAddCred(user, cred);
- }
-
- acl = GRSTgaclAclLoadforFile(dir_path);
- if (acl != NULL) perm = GRSTgaclAclTestUser(acl, user);
- }
-
- /* we're relying on being a CGI with all this un-free()ed strdup()ing */
-
- dir_uri = strdup(request_uri);
- p = rindex(dir_uri, '?');
- if (p != NULL) *p = '\0';
- p = rindex(dir_uri, '/');
- if (p != NULL) p[1] = '\0';
-
- content_type = getenv("CONTENT_TYPE");
-
- if ((content_type != NULL) &&
- (GRSTstrCmpShort(content_type, "multipart/form-data; boundary=") == 0))
- {
- uploadfile(dn, perm, help_uri, dir_path, dir_uri, admin_file);
- return 0;
- }
-
- cmd = GRSThttpGetCGI("cmd");
- file = GRSThttpGetCGI("file");
- button = GRSThttpGetCGI("button");
-
- /* file and directory functions in grst_admin_file.c */
-
- if (strcmp(cmd, "header") == 0)
- justheader(dn, perm, help_uri, dir_path, dir_uri, admin_file);
- else if (strcmp(cmd, "footer") == 0)
- justfooter(dn, perm, help_uri, dir_path, dir_uri, admin_file);
- else if (strcmp(cmd, "managedir") == 0)
- managedir(dn, perm, help_uri, dir_path, dir_uri, admin_file);
- else if (strcmp(cmd, "print") == 0)
- printfile(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "history") == 0)
- filehistory(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "editdnlist") == 0)
- editdnlistform(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "edit") == 0)
- {
- if ((strcasecmp(button, "new directory") == 0) ||
- (strcasecmp(button, "Create") == 0))
- newdirectory(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else
- editfileform(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- }
- else if (strcmp(cmd, "editaction") == 0)
- editfileaction(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "editdnlistaction") == 0)
- editdnlistaction(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "delete") == 0)
- deletefileform(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "deleteaction") == 0)
- deletefileaction(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "rename") == 0)
- renameform(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "renameaction") == 0)
- renameaction(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "ziplist") == 0)
- ziplist(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "unzipfile") == 0)
- unzipfile(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "create_acl") == 0)
- create_acl(dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
-
- /* GACL functions in grst_admin_gacl.c */
-
- else if (strcmp(cmd, "show_acl") == 0)
- show_acl(0, user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "admin_acl") == 0)
- show_acl(1, user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "acl_history") == 0)
- show_acl(2, user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd, "revert_acl") == 0)
- revert_acl(user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- //show_acl(2, user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd,"new_entry_form")==0)
- new_entry_form(user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd,"new_entry")==0)
- new_entry(user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd,"del_entry_sure")==0)
- del_entry_sure(user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd,"del_entry")==0)
- del_entry(user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd,"edit_entry_form")==0)
- edit_entry_form(user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd,"edit_entry")==0)
- edit_entry(user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd,"add_cred_form")==0)
- add_cred_form(user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd,"add_cred")==0)
- add_cred(user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd,"del_cred_sure")==0)
- del_cred_sure(user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
- else if (strcmp(cmd,"del_cred")==0)
- del_cred(user, dn, perm, help_uri, dir_path, file, dir_uri, admin_file);
-
- /* you what? */
-
- else GRSThttpError("500 Internal Server Error");
-}
+++ /dev/null
-
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <string.h>
-
-#include <openssl/x509_vfy.h>
-#include <openssl/err.h>
-#include <openssl/pem.h>
-
-#include <openssl/buffer.h>
-#include <openssl/objects.h>
-#include <openssl/asn1.h>
-
-#include "gridsite.h"
-
-/// ASN1 time string (in a char *) to time_t
-/**
- * (Use ASN1_STRING_data() to convert ASN1_GENERALIZEDTIME to char * if
- * necessary)
- */
-
-time_t GRSTasn1TimeToTimeT(char *asn1time, size_t len)
-{
- char zone;
- struct tm time_tm;
-
- if (len == 0) len = strlen(asn1time);
-
- if ((len != 13) && (len != 15)) return 0; /* dont understand */
-
- if ((len == 13) &&
- ((sscanf(asn1time, "%02d%02d%02d%02d%02d%02d%c",
- &(time_tm.tm_year),
- &(time_tm.tm_mon),
- &(time_tm.tm_mday),
- &(time_tm.tm_hour),
- &(time_tm.tm_min),
- &(time_tm.tm_sec),
- &zone) != 7) || (zone != 'Z'))) return 0; /* dont understand */
-
- if ((len == 15) &&
- ((sscanf(asn1time, "20%02d%02d%02d%02d%02d%02d%c",
- &(time_tm.tm_year),
- &(time_tm.tm_mon),
- &(time_tm.tm_mday),
- &(time_tm.tm_hour),
- &(time_tm.tm_min),
- &(time_tm.tm_sec),
- &zone) != 7) || (zone != 'Z'))) return 0; /* dont understand */
-
- /* time format fixups */
-
- if (time_tm.tm_year < 90) time_tm.tm_year += 100;
- --(time_tm.tm_mon);
-
- return timegm(&time_tm);
-}
-
-/* this function is taken from OpenSSL without modification */
-
-static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
- int indent)
- {
- static const char fmt[]="%-18s";
- static const char fmt2[]="%2d %-15s";
- char str[128];
- const char *p,*p2=NULL;
-
- if (constructed & V_ASN1_CONSTRUCTED)
- p="cons: ";
- else
- p="prim: ";
- if (BIO_write(bp,p,6) < 6) goto err;
-#if OPENSSL_VERSION_NUMBER >= 0x0090701fL
- BIO_indent(bp,indent,128);
-#endif
-
- p=str;
- if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE)
- sprintf(str,"priv [ %d ] ",tag);
- else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC)
- sprintf(str,"cont [ %d ]",tag);
- else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION)
- sprintf(str,"appl [ %d ]",tag);
- else p = ASN1_tag2str(tag);
-
- if (p2 != NULL)
- {
- if (BIO_printf(bp,fmt2,tag,p2) <= 0) goto err;
- }
- else
- {
- if (BIO_printf(bp,fmt,p) <= 0) goto err;
- }
- return(1);
-err:
- return(0);
- }
-
-static void GRSTasn1AddToTaglist(struct GRSTasn1TagList taglist[],
- int maxtag, int *lasttag,
- char *treecoords, int start, int headerlength,
- int length, int tag)
-{
- if ((strlen(treecoords) > GRST_ASN1_MAXCOORDLEN) ||
- (*lasttag + 1 > maxtag)) return;
-
- ++(*lasttag);
-
- strncpy(taglist[*lasttag].treecoords, treecoords, GRST_ASN1_MAXCOORDLEN+1);
- taglist[*lasttag].start = start;
- taglist[*lasttag].headerlength = headerlength;
- taglist[*lasttag].length = length;
- taglist[*lasttag].tag = tag;
-}
-
-int GRSTasn1SearchTaglist(struct GRSTasn1TagList taglist[],
- int lasttag, char *treecoords)
-{
- int i;
-
- for (i=0; i <= lasttag; ++i)
- {
- if (strcmp(treecoords, taglist[i].treecoords) == 0) return i;
- }
-
- return -1;
-}
-
-static int GRSTasn1PrintPrintable(BIO *bp, char *str, int length)
-{
- int ret = 0;
- char *dup, *p;
-
- dup = strndup(str, length);
-
- for (p=dup; *p != '\0'; ++p) if ((*p < ' ') || (*p > '~')) *p = '.';
-
- if (bp != NULL) ret = BIO_write(bp, dup, strlen(dup));
-
- free(dup);
-
- return ret;
-}
-
-static int GRSTasn1Parse2(BIO *bp, unsigned char **pp, long length, int offset,
- int depth, int indent, int dump, char *treecoords,
- struct GRSTasn1TagList taglist[], int maxtag, int *lasttag)
- {
- int sibling = 0;
- char sibtreecoords[512];
-
- unsigned char *p,*ep,*tot,*op,*opp;
- long len;
- int tag,xclass,ret=0;
- int nl,hl,j,r;
- ASN1_OBJECT *o=NULL;
- ASN1_OCTET_STRING *os=NULL;
- int dump_indent;
-
-
- dump_indent = 6; /* Because we know BIO_dump_indent() */
- p= *pp;
- tot=p+length;
- op=p-1;
- while ((p < tot) && (op < p))
- {
- op=p;
- j=ASN1_get_object(&p,&len,&tag,&xclass,length);
-
- if (j & 0x80)
- {
- if ((bp != NULL) &&
- (BIO_write(bp,"Error in encoding\n",18) <= 0))
- goto end;
- ret=0;
- goto end;
- }
- hl=(p-op);
- length-=hl;
-
- ++sibling;
- sprintf(sibtreecoords, "%s-%d", treecoords, sibling);
-
- GRSTasn1AddToTaglist(taglist, maxtag, lasttag, sibtreecoords,
- (int)offset+(int)(op - *pp),
- (int) hl, len, tag);
-
- if (bp != NULL)
- {
- BIO_printf(bp, " %s %ld %ld %d %d ", sibtreecoords,
- (long)offset+(long)(op - *pp), hl, len, tag);
-
- GRSTasn1PrintPrintable(bp, p,
-// &((*pp)[(long)offset+(long)(op - *pp)+hl]),
- (len > 30) ? 30 : len);
-
- BIO_printf(bp, "\n");
- }
-
-
- /* if j == 0x21 it is a constructed indefinite length object */
- if ((bp != NULL) &&
- (BIO_printf(bp,"%5ld:",(long)offset+(long)(op- *pp))
- <= 0)) goto end;
-
- if (j != (V_ASN1_CONSTRUCTED | 1))
- {
- if ((bp != NULL) &&
- (BIO_printf(bp,"d=%-2d hl=%ld l=%4ld ",
- depth,(long)hl,len) <= 0))
- goto end;
- }
- else
- {
- if ((bp != NULL) &&
- (BIO_printf(bp,"d=%-2d hl=%ld l=inf ",
- depth,(long)hl) <= 0))
- goto end;
- }
- if ((bp != NULL) &&
- !asn1_print_info(bp,tag,xclass,j,(indent)?depth:0))
- goto end;
- if (j & V_ASN1_CONSTRUCTED)
- {
- ep=p+len;
- if ((bp != NULL) &&
- (BIO_write(bp,"\n",1) <= 0)) goto end;
- if (len > length)
- {
- if (bp != NULL) BIO_printf(bp,
- "length is greater than %ld\n",length);
- ret=0;
- goto end;
- }
- if ((j == 0x21) && (len == 0))
- {
- for (;;)
- {
- r=GRSTasn1Parse2(bp,&p,(long)(tot-p),
- offset+(p - *pp),depth+1,
- indent,dump,sibtreecoords,
- taglist, maxtag, lasttag);
- if (r == 0) { ret=0; goto end; }
- if ((r == 2) || (p >= tot)) break;
- }
- }
- else
- while (p < ep)
- {
- r=GRSTasn1Parse2(bp,&p,(long)len,
- offset+(p - *pp),depth+1,
- indent,dump,sibtreecoords,
- taglist, maxtag, lasttag);
- if (r == 0) { ret=0; goto end; }
- }
- }
- else if (xclass != 0)
- {
- p+=len;
- if ((bp != NULL) &&
- (BIO_write(bp,"\n",1) <= 0)) goto end;
- }
- else
- {
- nl=0;
- if ( (tag == V_ASN1_PRINTABLESTRING) ||
- (tag == V_ASN1_T61STRING) ||
- (tag == V_ASN1_IA5STRING) ||
- (tag == V_ASN1_VISIBLESTRING) ||
- (tag == V_ASN1_UTCTIME) ||
- (tag == V_ASN1_GENERALIZEDTIME))
- {
- if ((bp != NULL) &&
- (BIO_write(bp,":",1) <= 0)) goto end;
- if ((len > 0) && (bp != NULL) &&
- BIO_write(bp,(char *)p,(int)len)
- != (int)len)
- goto end;
- }
- else if (tag == V_ASN1_OBJECT)
- {
- opp=op;
- if (d2i_ASN1_OBJECT(&o,&opp,len+hl) != NULL)
- {
- if (bp != NULL)
- {
- if (BIO_write(bp,":",1) <= 0) goto end;
- i2a_ASN1_OBJECT(bp,o);
- }
- }
- else
- {
- if ((bp != NULL) &&
- (BIO_write(bp,":BAD OBJECT",11) <= 0))
- goto end;
- }
- }
- else if (tag == V_ASN1_BOOLEAN)
- {
- int ii;
-
- opp=op;
- ii=d2i_ASN1_BOOLEAN(NULL,&opp,len+hl);
- if (ii < 0)
- {
- if ((bp != NULL) &&
- (BIO_write(bp,"Bad boolean\n",12)))
- goto end;
- }
- if (bp != NULL) BIO_printf(bp,":%d",ii);
- }
- else if (tag == V_ASN1_BMPSTRING)
- {
- /* do the BMP thang */
- }
- else if (tag == V_ASN1_OCTET_STRING)
- {
- int i;
-
- opp=op;
- os=d2i_ASN1_OCTET_STRING(NULL,&opp,len+hl);
- if (os != NULL)
- {
- opp=os->data;
-
- if (os->length > 0)
- {
- if ((bp != NULL) &&
- (BIO_write(bp,":",1) <= 0))
- goto end;
- if ((bp != NULL) &&
- (GRSTasn1PrintPrintable(bp,
- opp,
- os->length) <= 0))
- goto end;
- }
-
- M_ASN1_OCTET_STRING_free(os);
- os=NULL;
- }
- }
- else if (tag == V_ASN1_INTEGER)
- {
- ASN1_INTEGER *bs;
- int i;
-
- opp=op;
- bs=d2i_ASN1_INTEGER(NULL,&opp,len+hl);
- if (bs != NULL)
- {
- if ((bp != NULL) &&
- (BIO_write(bp,":",1) <= 0)) goto end;
- if (bs->type == V_ASN1_NEG_INTEGER)
- if ((bp != NULL) &&
- (BIO_write(bp,"-",1) <= 0))
- goto end;
- for (i=0; i<bs->length; i++)
- {
- if ((bp != NULL) &&
- (BIO_printf(bp,"%02X",
- bs->data[i]) <= 0))
- goto end;
- }
- if (bs->length == 0)
- {
- if ((bp != NULL) &&
- (BIO_write(bp,"00",2) <= 0))
- goto end;
- }
- }
- else
- {
- if ((bp != NULL) &&
- (BIO_write(bp,"BAD INTEGER",11) <= 0))
- goto end;
- }
- M_ASN1_INTEGER_free(bs);
- }
- else if (tag == V_ASN1_ENUMERATED)
- {
- ASN1_ENUMERATED *bs;
- int i;
-
- opp=op;
- bs=d2i_ASN1_ENUMERATED(NULL,&opp,len+hl);
- if (bs != NULL)
- {
- if ((bp != NULL) &&
- (BIO_write(bp,":",1) <= 0)) goto end;
- if (bs->type == V_ASN1_NEG_ENUMERATED)
- if ((bp != NULL) &&
- (BIO_write(bp,"-",1) <= 0))
- goto end;
- for (i=0; i<bs->length; i++)
- {
- if ((bp != NULL) &&
- (BIO_printf(bp,"%02X",
- bs->data[i]) <= 0))
- goto end;
- }
- if (bs->length == 0)
- {
- if ((bp != NULL) &&
- (BIO_write(bp,"00",2) <= 0))
- goto end;
- }
- }
- else
- {
- if ((bp != NULL) &&
- (BIO_write(bp,"BAD ENUMERATED",11) <= 0))
- goto end;
- }
- M_ASN1_ENUMERATED_free(bs);
- }
- else if (len > 0 && dump)
- {
- if (!nl)
- {
- if ((bp != NULL) &&
- (BIO_write(bp,"\n",1) <= 0))
- goto end;
- }
- if ((bp != NULL) &&
- (BIO_dump_indent(bp,(char *)p,
- ((dump == -1 || dump > len)?len:dump),
- dump_indent) <= 0))
- goto end;
- nl=1;
- }
-
- if (!nl)
- {
- if ((bp != NULL) &&
- (BIO_write(bp,"\n",1) <= 0)) goto end;
- }
- p+=len;
- if ((tag == V_ASN1_EOC) && (xclass == 0))
- {
- ret=2; /* End of sequence */
- goto end;
- }
- }
-
- length-=len;
- }
- ret=1;
-end:
- if (o != NULL) ASN1_OBJECT_free(o);
- if (os != NULL) M_ASN1_OCTET_STRING_free(os);
- *pp=p;
- return(ret);
- }
-
-int GRSTasn1ParseDump(BIO *bp, unsigned char *pp, long len,
- struct GRSTasn1TagList taglist[],
- int maxtag, int *lasttag)
- {
- return(GRSTasn1Parse2(bp,&pp,len,0,0,0,0,"",
- taglist, maxtag, lasttag));
- }
-
-int GRSTasn1GetX509Name(char *x509name, int maxlength, char *coords,
- char *asn1string,
- struct GRSTasn1TagList taglist[], int lasttag)
-{
- int i, iobj, istr, n, len = 0;
- ASN1_OBJECT *obj = NULL;
- unsigned char coordstmp[81], *q;
- const unsigned char *shortname;
-
- for (i=1; ; ++i)
- {
- snprintf(coordstmp, sizeof(coordstmp), coords, i, 1);
- iobj = GRSTasn1SearchTaglist(taglist, lasttag, coordstmp);
- if (iobj < 0) break;
-
- snprintf(coordstmp, sizeof(coordstmp), coords, i, 2);
- istr = GRSTasn1SearchTaglist(taglist, lasttag, coordstmp);
- if (istr < 0) break;
-
- q = &asn1string[taglist[iobj].start];
- d2i_ASN1_OBJECT(&obj, &q, taglist[iobj].length +
- taglist[iobj].headerlength);
-
- n = OBJ_obj2nid(obj);
-// free obj now?
- shortname = OBJ_nid2sn(n);
-
- if (len + 2 + strlen(shortname) + taglist[istr].length >= maxlength)
- {
- x509name[0] = '\0';
- return GRST_RET_FAILED;
- }
-
- sprintf(&x509name[len], "/%s=%.*s", shortname,
- taglist[istr].length,
- &asn1string[taglist[istr].start+taglist[istr].headerlength]);
- len += 2 + strlen(shortname) + taglist[istr].length;
- }
-
- x509name[len] = '\0';
-
- return (x509name[0] != '\0') ? GRST_RET_OK : GRST_RET_FAILED;
-}
+++ /dev/null
-/*
- Copyright (c) 2002-3, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-/*---------------------------------------------------------------*
- * For more information about GridSite: http://www.gridsite.org/ *
- *---------------------------------------------------------------*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <dirent.h>
-#include <ctype.h>
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#include <fnmatch.h>
-
-#include <libxml/xmlmemory.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-
-#include "gridsite.h"
-
-/* *
- * Global variables, shared by all GACL functions by private to libgacl *
- * */
-
-char *grst_perm_syms[] = { "none",
- "read",
- "exec",
- "list",
- "write",
- "admin",
- NULL };
-
-GRSTgaclPerm grst_perm_vals[] = { GRST_PERM_NONE,
- GRST_PERM_READ,
- GRST_PERM_EXEC,
- GRST_PERM_LIST,
- GRST_PERM_WRITE,
- GRST_PERM_ADMIN,
- -1 };
-
-int GRSTgaclInit(void)
-{
- xmlInitParser();
-
- LIBXML_TEST_VERSION
-
- xmlKeepBlanksDefault(0);
-
- return 1;
-}
-
-/* declare these two private functions at the start */
-
-GRSTgaclAcl *GRSTgaclAclParse(xmlDocPtr, xmlNodePtr, GRSTgaclAcl *);
-GRSTgaclAcl *GRSTxacmlAclParse(xmlDocPtr, xmlNodePtr, GRSTgaclAcl *);
-
-/* *
- * Functions to manipulate GRSTgaclCred structures *
- * */
-
-GRSTgaclCred *GRSTgaclCredNew(char *type)
-/*
- GRSTgaclCredNew - allocate a new GRSTgaclCred structure, and return
- it's pointer or NULL on (malloc) error.
-*/
-{
- GRSTgaclCred *newcred;
-
- if (type == NULL) return NULL;
-
- newcred = malloc(sizeof(GRSTgaclCred));
- if (newcred == NULL) return NULL;
-
- newcred->type = strdup(type);
- newcred->delegation = 0;
- newcred->firstname = NULL;
- newcred->next = NULL;
-
- return newcred;
-}
-
-int GRSTgaclCredAddValue(GRSTgaclCred *cred, char *rawname, char *rawvalue)
-/*
- GRSTgaclCredAddValue - add a name/value pair to a GRSTgaclCred
-*/
-{
- int i;
- char *name, *value;
- GRSTgaclNamevalue *p;
-
- name = strdup(rawname);
-
- /* no leading or trailing space in value */
-
- value = rawvalue;
- while ((*value != '\0') && isspace(*value)) ++value;
-
- value = strdup(value);
-
- for (i=strlen(value) - 1; (i >= 0) && isspace(value[i]); --i) value[i]='\0';
-
- if (cred->firstname == NULL)
- {
- cred->firstname = malloc(sizeof (GRSTgaclNamevalue));
- (cred->firstname)->name = name;
- (cred->firstname)->value = value;
- (cred->firstname)->next = NULL;
- }
- else
- {
- p = cred->firstname;
-
- while (p->next != NULL) p = (GRSTgaclNamevalue *) p->next;
-
- p->next = malloc(sizeof(GRSTgaclNamevalue));
- ((GRSTgaclNamevalue *) p->next)->name = name;
- ((GRSTgaclNamevalue *) p->next)->value = value;
- ((GRSTgaclNamevalue *) p->next)->next = NULL;
- }
-
- return 1;
-}
-
-static int GRSTgaclNamevalueFree(GRSTgaclNamevalue *p)
-{
- if (p == NULL) return 1;
-
- if (p->next != NULL)
- GRSTgaclNamevalueFree((GRSTgaclNamevalue *) p->next);
- if (p->name != NULL) free(p->name);
- if (p->value != NULL) free(p->value);
- free(p);
-
- return 1;
-}
-
-int GRSTgaclCredFree(GRSTgaclCred *cred)
-/*
- GRSTgaclCredFree - free memory structures of a GRSTgaclCred,
- returning 1 always!
-*/
-{
- if (cred == NULL) return 1;
-
- GRSTgaclNamevalueFree(cred->firstname);
- if (cred->type != NULL) free(cred->type);
- free(cred);
-
- return 1;
-}
-
-static int GRSTgaclCredsFree(GRSTgaclCred *firstcred)
-/*
- GRSTgaclCredsFree - free a cred and all the creds in its *next chain
-*/
-{
- if (firstcred == NULL) return 0;
-
- if (firstcred->next != NULL) GRSTgaclCredsFree(firstcred->next);
-
- return GRSTgaclCredFree(firstcred);
-}
-
-static int GRSTgaclCredInsert(GRSTgaclCred *firstcred, GRSTgaclCred *newcred)
-/*
- GRSTgaclCredInsert - insert a cred in the *next chain of firstcred
-
- FOR THE MOMENT THIS JUST APPENDS!
-*/
-{
- if (firstcred == NULL) return 0;
-
- if (firstcred->next == NULL)
- {
- firstcred->next = newcred;
- return 1;
- }
-
- return GRSTgaclCredInsert(firstcred->next, newcred);
-}
-
-int GRSTgaclEntryAddCred(GRSTgaclEntry *entry, GRSTgaclCred *cred)
-/*
- GRSTaddCred - add a new credential to an existing entry, returning 1
- on success or 0 on error
-*/
-{
- if (entry == NULL) return 0;
-
- if (entry->firstcred == NULL)
- {
- entry->firstcred = cred;
- return 1;
- }
- else return GRSTgaclCredInsert(entry->firstcred, cred);
-}
-
-static int GRSTgaclCredRemoveCred(GRSTgaclCred *firstcred, GRSTgaclCred *oldcred)
-/*
- (Private)
-
- GRSTgaclCredRemoveCred - remove a cred in the *next chain of firstcred
- and relink the chain
-*/
-{
- if (firstcred == NULL) return 0;
-
-// yeah, I know
-}
-
-int GRSTgaclEntryDelCred(GRSTgaclEntry *entry, GRSTgaclCred *cred)
-/*
- GRSTgaclEntryDelCred - remove a new cred from an entry, returning 1
- on success (or absense) or 0 on error.
-*/
-{
- if (entry == NULL) return 0;
-
- return GRSTgaclCredRemoveCred(entry->firstcred, cred);
-}
-
-int GRSTgaclCredPrint(GRSTgaclCred *cred, FILE *fp)
-/*
- GRSTgaclCredPrint - print a credential and any name-value pairs is contains
-*/
-{
- char *q;
- GRSTgaclNamevalue *p;
-
- if (cred->firstname != NULL)
- {
- fprintf(fp, "<%s>\n", cred->type);
-
- p = cred->firstname;
-
- do {
- fprintf(fp, "<%s>", p->name);
-
- for (q=p->value; *q != '\0'; ++q)
- if (*q == '<') fputs("<", fp);
- else if (*q == '>') fputs(">", fp);
- else if (*q == '&') fputs("&" , fp);
- else if (*q == '\'') fputs("'", fp);
- else if (*q == '"') fputs(""", fp);
- else fputc(*q, fp);
-
- fprintf(fp, "</%s>\n", p->name);
-
- p = (GRSTgaclNamevalue *) p->next;
-
- } while (p != NULL);
-
- fprintf(fp, "</%s>\n", cred->type);
- }
- else fprintf(fp, "<%s/>\n", cred->type);
-
- return 1;
-}
-
-/* *
- * Functions to manipulate GRSTgaclEntry structures *
- * */
-
-GRSTgaclEntry *GRSTgaclEntryNew(void)
-/*
- GRSTgaclEntryNew - allocate space for a new entry, returning its pointer
- or NULL on failure.
-*/
-{
- GRSTgaclEntry *newentry;
-
- newentry = (GRSTgaclEntry *) malloc(sizeof(GRSTgaclEntry));
- if (newentry == NULL) return NULL;
-
- newentry->firstcred = NULL;
- newentry->allowed = 0;
- newentry->denied = 0;
- newentry->next = NULL;
-
- return newentry;
-}
-
-int GRSTgaclEntryFree(GRSTgaclEntry *entry)
-/*
- GRSTgaclEntryFree - free up space used by an entry (always returns 1)
-*/
-{
- int i;
-
- if (entry == NULL) return 1;
-
- GRSTgaclCredsFree(entry->firstcred);
-
- free(entry);
-
- return 1;
-}
-
-static int GRSTgaclEntriesFree(GRSTgaclEntry *entry)
-/*
- GRSTgaclEntriesFree - free up entry and all entries linked to in its *next
- chain
-*/
-{
- if (entry == NULL) return 0;
-
- if (entry->next != NULL) GRSTgaclEntriesFree(entry->next);
-
- return GRSTgaclEntryFree(entry);
-}
-
-static int GRSTgaclEntryInsert(GRSTgaclEntry *firstentry, GRSTgaclEntry *newentry)
-/*
- GRSTgaclEntryInsert - insert an entry in the *next chain of firstentry
-
- FOR THE MOMENT THIS JUST APPENDS
-*/
-{
- if (firstentry == NULL) return 0;
-
- if (firstentry->next == NULL)
- {
- firstentry->next = newentry;
- return 1;
- }
-
- return GRSTgaclEntryInsert(firstentry->next, newentry);
-}
-
-int GRSTgaclAclAddEntry(GRSTgaclAcl *acl, GRSTgaclEntry *entry)
-/*
- GRSTgaclAclAddEntry - add a new entry to an existing acl, returning 1
- on success or 0 on error
-*/
-{
- if (acl == NULL) return 0;
-
- if (acl->firstentry == NULL)
- {
- acl->firstentry = entry;
- return 1;
- }
- else return GRSTgaclEntryInsert(acl->firstentry, entry);
-}
-
-int GRSTgaclEntryPrint(GRSTgaclEntry *entry, FILE *fp)
-{
- GRSTgaclCred *cred;
- GRSTgaclPerm i;
-
- fputs("<entry>\n", fp);
-
- for (cred = entry->firstcred; cred != NULL; cred = cred->next)
- GRSTgaclCredPrint(cred, fp);
-
- if (entry->allowed)
- {
- fputs("<allow>", fp);
-
- for (i=GRST_PERM_READ; i <= GRST_PERM_ADMIN; ++i)
- if ((entry->allowed) & i) GRSTgaclPermPrint(i, fp);
-
- fputs("</allow>\n", fp);
- }
-
-
- if (entry->denied)
- {
- fputs("<deny>", fp);
-
- for (i=GRST_PERM_READ; i <= GRST_PERM_ADMIN; ++i)
- if (entry->denied & i) GRSTgaclPermPrint(i, fp);
-
- fputs("</deny>\n", fp);
- }
-
- fputs("</entry>\n", fp);
-
- return 1;
-}
-
-/* *
- * Functions to manipulate GRSTgaclPerm items *
- * */
-
-int GRSTgaclPermPrint(GRSTgaclPerm perm, FILE *fp)
-{
- GRSTgaclPerm i;
-
- for (i=GRST_PERM_READ; grst_perm_syms[i] != NULL; ++i)
- if (perm == grst_perm_vals[i])
- {
- fprintf(fp, "<%s/>", grst_perm_syms[i]);
- return 1;
- }
-
- return 0;
-}
-
-int GRSTgaclEntryAllowPerm(GRSTgaclEntry *entry, GRSTgaclPerm perm)
-{
- entry->allowed = entry->allowed | perm;
-
- return 1;
-}
-
-int GRSTgaclEntryUnallowPerm(GRSTgaclEntry *entry, GRSTgaclPerm perm)
-{
- entry->allowed = entry->allowed & ~perm;
-
- return 1;
-}
-
-int GRSTgaclEntryDenyPerm(GRSTgaclEntry *entry, GRSTgaclPerm perm)
-{
- entry->denied = entry->denied | perm;
-
- return 1;
-}
-
-int GRSTgaclEntryUndenyPerm(GRSTgaclEntry *entry, GRSTgaclPerm perm)
-{
- entry->denied = entry->denied & ~perm;
-
- return 1;
-}
-
-char *GRSTgaclPermToChar(GRSTgaclPerm perm)
-/*
- GRSTgaclPermToChar - return char * or NULL corresponding to most significant
- set bit of perm.
-*/
-{
- char *p = NULL;
- GRSTgaclPerm i;
-
- for (i=0; grst_perm_syms[i] != NULL; ++i)
- if (perm & grst_perm_vals[i]) p = grst_perm_syms[i];
-
- return p;
-}
-
-GRSTgaclPerm GRSTgaclPermFromChar(char *s)
-/*
- GRSTgaclPermToChar - return access perm corresponding to symbol s[]
-*/
-{
- GRSTgaclPerm i;
-
- for (i=0; grst_perm_syms[i] != NULL; ++i)
- if (strcasecmp(grst_perm_syms[i], s) == 0) return grst_perm_vals[i];
-
- return -1;
-}
-
-/* *
- * Functions to manipulate GRSTgaclAcl structures *
- * */
-
-GRSTgaclAcl *GRSTgaclAclNew(void)
-/*
- GRSTgaclAclNew - allocate a new acl and return its pointer (or NULL
- on failure.)
-*/
-{
- GRSTgaclAcl *newacl;
-
- newacl = (GRSTgaclAcl *) malloc(sizeof(GRSTgaclAcl));
- if (newacl == NULL) return NULL;
-
- newacl->firstentry = NULL;
-
- return newacl;
-}
-
-int GRSTgaclAclFree(GRSTgaclAcl *acl)
-/*
- GRSTgaclAclFree - free up space used by *acl. Always returns 1.
-*/
-{
- if (acl == NULL) return 1;
-
- GRSTgaclEntriesFree(acl->firstentry);
-
- return 1;
-}
-
-int GRSTgaclAclPrint(GRSTgaclAcl *acl, FILE *fp)
-{
- GRSTgaclEntry *entry;
-
- fputs("<gacl version=\"0.0.1\">\n", fp);
-
- for (entry = acl->firstentry; entry != NULL; entry = entry->next)
- GRSTgaclEntryPrint(entry, fp);
-
- fputs("</gacl>\n", fp);
-
- return 1;
-}
-
-int GRSTgaclAclSave(GRSTgaclAcl *acl, char *filename)
-{
- int ret;
- FILE *fp;
-
- fp = fopen(filename, "w");
- if (fp == NULL) return 0;
-
- fputs("<?xml version=\"1.0\"?>\n", fp);
-
- ret = GRSTgaclAclPrint(acl, fp);
-
- fclose(fp);
-
- return ret;
-}
-
-/* *
- * Functions for loading and parsing XML using libxml *
- * */
-
-// need to check these for libxml memory leaks? - what needs to be freed?
-
-static GRSTgaclCred *GRSTgaclCredParse(xmlNodePtr cur)
-/*
- GRSTgaclCredParse - parse a credential stored in the libxml structure cur,
- returning it as a pointer or NULL on error.
-*/
-{
- xmlNodePtr cur2;
- GRSTgaclCred *cred;
-
- cred = GRSTgaclCredNew((char *) cur->name);
-
- cred->firstname = NULL;
- cred->next = NULL;
-
- for (cur2 = cur->xmlChildrenNode; cur2 != NULL; cur2=cur2->next)
- {
- GRSTgaclCredAddValue(cred, (char *) cur2->name,
- (char *) xmlNodeGetContent(cur2));
- }
-
- return cred;
-}
-
-static GRSTgaclEntry *GRSTgaclEntryParse(xmlNodePtr cur)
-/*
- GRSTgaclEntryParse - parse an entry stored in the libxml structure cur,
- returning it as a pointer or NULL on error.
-*/
-{
- int i;
- xmlNodePtr cur2;
- GRSTgaclEntry *entry;
- GRSTgaclCred *cred;
- GRSTgaclPerm perm;
-
- if (xmlStrcmp(cur->name, (const xmlChar *) "entry") != 0) return NULL;
-
- cur = cur->xmlChildrenNode;
-
- entry = GRSTgaclEntryNew();
-
- while (cur != NULL)
- {
- if (xmlStrcmp(cur->name, (const xmlChar *) "allow") == 0)
- {
- for (cur2 = cur->xmlChildrenNode; cur2 != NULL; cur2=cur2->next)
- for (i=0; grst_perm_syms[i] != NULL; ++i)
- if (xmlStrcmp(cur2->name,
- (const xmlChar *) grst_perm_syms[i]) == 0)
- GRSTgaclEntryAllowPerm(entry, grst_perm_vals[i]);
- }
- else if (xmlStrcmp(cur->name, (const xmlChar *) "deny") == 0)
- {
- for (cur2 = cur->xmlChildrenNode; cur2 != NULL; cur2=cur2->next)
- for (i=0; grst_perm_syms[i] != NULL; ++i)
- if (xmlStrcmp(cur2->name,
- (const xmlChar *) grst_perm_syms[i]) == 0)
- GRSTgaclEntryDenyPerm(entry, grst_perm_vals[i]);
- }
- else if ((cred = GRSTgaclCredParse(cur)) != NULL)
- {
- if (!GRSTgaclEntryAddCred(entry, cred))
- {
- GRSTgaclCredFree(cred);
- GRSTgaclEntryFree(entry);
- return NULL;
- }
- }
- else /* I cannot parse this - give up rather than get it wrong */
- {
- GRSTgaclEntryFree(entry);
- return NULL;
- }
-
- cur=cur->next;
- }
-
- return entry;
-}
-
-GRSTgaclAcl *GRSTgaclAclLoadFile(char *filename)
-{
- xmlDocPtr doc;
- xmlNodePtr cur;
- GRSTgaclAcl *acl;
-
- doc = xmlParseFile(filename);
- if (doc == NULL) return NULL;
-
- cur = xmlDocGetRootElement(doc);
- if (cur == NULL)
- {
- xmlFreeDoc(doc);
- return NULL;
- }
-
- if (!xmlStrcmp(cur->name, (const xmlChar *) "Policy"))
- {
- acl=GRSTxacmlAclParse(doc, cur, acl);
- }
- else if (!xmlStrcmp(cur->name, (const xmlChar *) "gacl"))
- {
- acl=GRSTgaclAclParse(doc, cur, acl);
- }
- else /* ACL format not recognised */
- {
- xmlFreeDoc(doc);
- return NULL;
- }
-
- xmlFreeDoc(doc);
- return acl;
-}
-
-GRSTgaclAcl *GRSTgaclAclParse(xmlDocPtr doc, xmlNodePtr cur, GRSTgaclAcl *acl)
-{
- GRSTgaclEntry *entry;
-
- cur = cur->xmlChildrenNode;
-
- acl = GRSTgaclAclNew();
-
- while (cur != NULL)
- {
- entry = GRSTgaclEntryParse(cur);
- if (entry == NULL)
- {
- GRSTgaclAclFree(acl);
- xmlFreeDoc(doc);
- return NULL;
- }
-
- GRSTgaclAclAddEntry(acl, entry);
-
- cur=cur->next;
- }
-
- return acl;
-}
-int GRSTgaclFileIsAcl(char *pathandfile)
-/* Return 1 if filename in *pathandfile starts GRST_ACL_FILE
- Return 0 otherwise. */
-{
- char *filename;
-
- filename = rindex(pathandfile, '/');
- if (filename == NULL) filename = pathandfile;
- else filename++;
-
- return (strncmp(filename, GRST_ACL_FILE, sizeof(GRST_ACL_FILE) - 1) == 0);
-}
-
-char *GRSTgaclFileFindAclname(char *pathandfile)
-/* Return malloc()ed ACL filename that governs the given file or directory
- (for directories, the ACL file is in the directory itself), or NULL if none
- can be found. */
-{
- int len;
- char *path, *file, *p;
- struct stat statbuf;
-
- len = strlen(pathandfile);
- if (len == 0) return NULL;
-
- path = malloc(len + sizeof(GRST_ACL_FILE) + 2);
- strcpy(path, pathandfile);
-
- if ((stat(path, &statbuf) == 0) &&
- S_ISDIR(statbuf.st_mode) &&
- (path[len-1] != '/'))
- {
- strcat(path, "/");
- ++len;
- }
-
- if (path[len-1] != '/')
- {
- p = rindex(pathandfile, '/');
- if (p != NULL)
- {
- file = &p[1];
- p = rindex(path, '/');
- sprintf(p, "/%s:%s", GRST_ACL_FILE, file);
-
- if (stat(path, &statbuf) == 0) return path;
-
- *p = '\0'; /* otherwise strip off any filename */
- }
- }
-
- while (path[0] != '\0')
- {
- strcat(path, "/");
- strcat(path, GRST_ACL_FILE);
-
- if (stat(path, &statbuf) == 0) return path;
-
- p = rindex(path, '/');
- *p = '\0'; /* strip off the / we added for ACL */
-
- p = rindex(path, '/');
- if (p == NULL) break; /* must start without / and we there now ??? */
-
- *p = '\0'; /* strip off another layer of / */
- }
-
- free(path);
- return NULL;
-}
-
-GRSTgaclAcl *GRSTgaclAclLoadforFile(char *pathandfile)
-/* Return ACL that governs the given file or directory (for directories,
- the ACL file is in the directory itself.) */
-{
- char *path;
- GRSTgaclAcl *acl;
-
- path = GRSTgaclFileFindAclname(pathandfile);
-
- if (path != NULL)
- {
- acl = GRSTgaclAclLoadFile(path);
- free(path);
- return acl;
- }
-
- return NULL;
-}
-
-/* *
- * Functions to create and query GACLuser *
- * */
-
-GRSTgaclUser *GRSTgaclUserNew(GRSTgaclCred *cred)
-{
- GRSTgaclUser *user;
-
- if (cred == NULL) return NULL;
-
- user = malloc(sizeof(GRSTgaclUser));
-
- if (user != NULL) user->firstcred = cred;
-
- user->dnlists = NULL;
-
- return user;
-}
-
-int GRSTgaclUserFree(GRSTgaclUser *user)
-{
- if (user == NULL) return 1;
-
- if (user->firstcred != NULL) GRSTgaclCredsFree(user->firstcred);
-
- if (user->dnlists != NULL) free(user->dnlists);
-
- free(user);
-
- return 1;
-}
-
-int GRSTgaclUserAddCred(GRSTgaclUser *user, GRSTgaclCred *cred)
-{
- GRSTgaclCred *crediter;
-
- if ((user == NULL) || (cred == NULL)) return 0;
-
- if (user->firstcred == NULL)
- {
- user->firstcred = cred;
- cred->next = NULL; /* so cannot be used to add whole lists */
- return 1;
- }
-
- crediter = user->firstcred;
-
- while (crediter->next != NULL) crediter = crediter->next;
-
- crediter->next = cred;
- cred->next = NULL; /* so cannot be used to add whole lists */
-
- return 1;
-}
-
-int GRSTgaclUserHasCred(GRSTgaclUser *user, GRSTgaclCred *cred)
-/* test if the user has the given credential */
-{
- GRSTgaclCred *crediter;
- GRSTgaclNamevalue *usernamevalue, *crednamevalue;
-
-
- if (cred == NULL) return 0;
-
- if (strcmp(cred->type, "any-user") == 0) return 1;
-
- if (user == NULL) return 0;
-
- if (strcmp(cred->type, "dn-list") == 0)
- {
- if ((cred->firstname == NULL) ||
- (strcmp((cred->firstname)->name, "url") != 0) ||
- ((cred->firstname)->next != NULL)) return 0;
-
- return GRSTgaclDNlistHasUser((cred->firstname)->value, user);
- }
-
- if (strcmp(cred->type, "dns") == 0)
- {
- if ((user->firstcred == NULL) ||
- ((user->firstcred)->firstname == NULL) ||
- (cred->firstname == NULL) ||
- (strcmp((cred->firstname)->name, "hostname") != 0) ||
- ((cred->firstname)->next != NULL)) return 0;
-
- for (crediter=user->firstcred;
- crediter != NULL;
- crediter = crediter->next)
- if (strcmp(crediter->type, "dns") == 0)
- {
- if ((crediter->firstname == NULL) ||
- (strcmp((crediter->firstname)->name, "hostname") != 0)) return 0;
-
- return (fnmatch((cred->firstname)->value,
- (crediter->firstname)->value, FNM_CASEFOLD) == 0);
- }
-
-
- return 0;
- }
-
- if (strcmp(cred->type, "auth-user") == 0)
- {
- if ((user->firstcred == NULL) ||
- ((user->firstcred)->firstname == NULL)) return 0;
-
- for (crediter=user->firstcred;
- crediter != NULL;
- crediter = crediter->next)
- if (strcmp(crediter->type, "person") == 0) return 1;
-
- return 0;
- }
-
- for (crediter=user->firstcred; crediter != NULL; crediter = crediter->next)
- {
- if (strcmp(crediter->type, cred->type) != 0) continue;
-
- if ((crediter->firstname == NULL) &&
- (cred->firstname == NULL)) return 1;
-
- if ((crediter->firstname == NULL) ||
- (cred->firstname == NULL)) continue;
-
- usernamevalue = crediter->firstname;
- crednamevalue = cred->firstname;
-
- for (;;)
- {
- if (strcmp(usernamevalue->name,crednamevalue->name) != 0) break;
-
- if (strcmp(cred->type, "person") == 0)
- {
- if (GRSTx509NameCmp(usernamevalue->value,
- crednamevalue->value) != 0) break;
- }
- else if (strcmp(usernamevalue->value,
- crednamevalue->value) != 0) break;
-
- /* ok if cred list runs out before user's cred list */
- if (crednamevalue->next == NULL) return 1;
-
- /* but not ok if more names to match which user doesn't have */
- if (usernamevalue->next == NULL) break;
-
- crednamevalue = (GRSTgaclNamevalue *) crednamevalue->next;
- usernamevalue = (GRSTgaclNamevalue *) usernamevalue->next;
- }
- }
-
- return 0;
-}
-
-GRSTgaclCred *GRSTgaclUserFindCredtype(GRSTgaclUser *user, char *type)
-/* find the first credential of a given type for this user */
-{
- GRSTgaclCred *cred;
-
- if (user == NULL) return NULL;
-
- cred = user->firstcred;
-
- while (cred != NULL)
- {
- if (strcmp(cred->type, type) == 0) return cred;
-
- cred = cred->next;
- }
-
- return NULL;
-}
-
-int GRSTgaclUserSetDNlists(GRSTgaclUser *user, char *dnlists)
-{
- if ((user == NULL) || (dnlists == NULL)) return 0;
-
- if (user->dnlists != NULL) free(user->dnlists);
-
- user->dnlists = strdup(dnlists);
-
- return 1;
-}
-
-/* *
- * Functions to test for access perm of an individual *
- * */
-
-static char *recurse4file(char *dir, char *file, int recurse_level)
-/* try to find file[] in dir[]. try subdirs if not found.
- return full path to first found version or NULL on failure */
-{
- char *fullfilename, *fulldirname;
- struct stat statbuf;
- DIR *dirDIR;
- struct dirent *file_ent;
-
- /* try to find in current directory */
-
- asprintf(&fullfilename, "%s/%s", dir, file);
- if (stat(fullfilename, &statbuf) == 0) return fullfilename;
- free(fullfilename);
-
- /* maybe search in subdirectories */
-
- if (recurse_level >= GRST_RECURS_LIMIT) return NULL;
-
- dirDIR = opendir(dir);
-
- if (dirDIR == NULL) return NULL;
-
- while ((file_ent = readdir(dirDIR)) != NULL)
- {
- if (file_ent->d_name[0] == '.') continue;
-
- asprintf(&fulldirname, "%s/%s", dir, file_ent->d_name);
-
- if ((stat(fulldirname, &statbuf) == 0) &&
- S_ISDIR(statbuf.st_mode) &&
- ((fullfilename = recurse4file(fulldirname, file,
- recurse_level + 1)) != NULL))
- {
- closedir(dirDIR);
- return fullfilename;
- }
-
- free(fulldirname);
- }
-
- closedir(dirDIR);
-
- return NULL;
-}
-
-int GRSTgaclDNlistHasUser(char *listurl, GRSTgaclUser *user)
-{
- char *dn_lists_dirs, *dn_list_ptr, *enclisturl, *filename, *dirname,
- line[512], *p;
- FILE *fp;
- GRSTgaclCred *cred;
-
- if ((listurl == NULL) || (user == NULL)) return 0;
-
- enclisturl = GRSThttpUrlEncode(listurl);
-
- if (user->dnlists != NULL) p = user->dnlists;
- else p = getenv("GRST_DN_LISTS");
-
- if (p == NULL) p = GRST_DN_LISTS;
- dn_lists_dirs = strdup(p); /* we need to keep this for free() later! */
- dn_list_ptr = dn_lists_dirs; /* copy, for naughty function strsep() */
-
- while ((dirname = strsep(&dn_list_ptr, ":")) != NULL)
- {
- filename = recurse4file(dirname, enclisturl, 0);
- if (filename == NULL) continue;
-
- fp = fopen(filename, "r");
- free(filename);
-
- if (fp == NULL) continue;
-
- while (fgets(line, sizeof(line), fp) != NULL)
- {
- p = index(line, '\n');
- if (p != NULL) *p = '\0';
-
- cred = user->firstcred;
-
- while (cred != NULL)
- {
- if ((strcmp(cred->type, "person") == 0) &&
- (cred->firstname != NULL) &&
- (strcmp("dn", (cred->firstname)->name) == 0) &&
- (GRSTx509NameCmp(line, (cred->firstname)->value) == 0))
- {
- fclose(fp);
- free(dn_lists_dirs);
- free(enclisturl);
- return 1;
- }
-
- cred = cred->next;
- }
- }
-
- fclose(fp);
- }
-
- free(dn_lists_dirs);
- free(enclisturl);
-
- return 0;
-}
-
-GRSTgaclPerm GRSTgaclAclTestUser(GRSTgaclAcl *acl, GRSTgaclUser *user)
-/*
- GACLgaclAclTestUser - return bit fields depending on access perms user has
- for given acl. All zero for no access. If *user is
- NULL, matching to "any-user" will still work.
-*/
-{
- int flag, onlyanyuser;
- GRSTgaclPerm allowperms = 0, denyperms = 0, allowed;
- GRSTgaclEntry *entry;
- GRSTgaclCred *cred, *usercred;
-
- if (acl == NULL) return 0;
-
- for (entry = acl->firstentry; entry != NULL; entry = entry->next)
- {
- flag = 1; /* begin by assuming this entry applies to us */
- onlyanyuser = 1; /* begin by assuming just <any-user/> */
-
- /* now go through creds, checking they all do apply to us */
-
- for (cred = entry->firstcred; cred != NULL; cred = cred->next)
- if (!GRSTgaclUserHasCred(user, cred)) flag = 0;
- else if (strcmp(cred->type, "any-user") != 0) onlyanyuser = 0;
-
- if (!flag) continue; /* flag false if a subtest failed */
-
- /* does apply to us, so we remember this entry's perms */
-
- /* we dont allow Write or Admin on the basis of any-user alone */
-
- allowed = entry->allowed;
-
- if (onlyanyuser)
- allowed = entry->allowed & ~GRST_PERM_WRITE & ~GRST_PERM_ADMIN;
- else allowed = entry->allowed;
-
- allowperms = allowperms | allowed;
- denyperms = denyperms | entry->denied;
- }
-
- return (allowperms & (~ denyperms));
- /* for each perm type, any deny we saw kills any allow */
-}
-
-GRSTgaclPerm GRSTgaclAclTestexclUser(GRSTgaclAcl *acl, GRSTgaclUser *user)
-/*
- GRSTgaclAclTestexclUser -
- return bit fields depending on ALLOW perms OTHER users
- have for given acl. All zero if they have no access.
- (used for testing if a user has exclusive access)
-*/
-{
- int flag;
- GRSTgaclPerm perm = 0;
- GRSTgaclEntry *entry;
- GRSTgaclCred *cred;
-
- if (acl == NULL) return 0;
-
- for (entry = acl->firstentry; entry != NULL; entry = entry->next)
- {
- flag = 0; /* flag will be set if cred implies other users */
-
- for (cred = entry->firstcred; cred != NULL; cred = cred->next)
- {
- if (strcmp(cred->type, "person") != 0)
- /* if we ever add support for other person-specific credentials,
- they must also be recognised here */
- {
- flag = 1;
- break;
- }
-
- if (!GRSTgaclUserHasCred(user, cred))
- /* if user doesnt have this person credential, assume
- it refers to a different individual */
- {
- flag = 1;
- break;
- }
- }
-
- if (flag) perm = perm | entry->allowed;
- }
-
- return perm;
-}
-
-/*
- Wrapper functions for gridsite-gacl.h support of legacy API
-*/
-
-GRSTgaclEntry *GACLparseEntry(xmlNodePtr cur)
-{
- return GRSTgaclEntryParse(cur);
-}
+++ /dev/null
-/*
- Copyright (c) 2002-5, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef VERSION
-#define VERSION "x.x.x"
-#endif
-
-#define _GNU_SOURCE
-#include <stdio.h>
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include "gridsite.h"
-
-int GRSThtcpNOPrequestMake(char **request, int *request_length,
- unsigned int trans_id)
-/*
- Make a complete HTCP NOP request and return a pointer to malloc'd
- memory pointing to it.
-*/
-{
- *request_length =
- asprintf(request,"%c%c" /* place holder for total length */
- "%c%c" /* HTCP version 0.0 */
- "%c%c" /* DATA length place holder */
- "%c%c" /* OPCODE,RESPONSE,RESERVED,F1,RR */
- "%c%c%c%c" /* TRANS-ID placeholder */
- "%c%c", /* AUTH (LENGTH=2 means no AUTH) */
- 0, 0,
- 0, 0,
- 0, 0,
- GRSThtcpNOPop * 16, 2,
- 0, 0, 0, 0,
- 0, 2);
-
- if (*request_length < 0) return GRST_RET_FAILED;
-
- (*request)[0] = *request_length / 256;
- (*request)[1] = *request_length % 256;
-
- (*request)[4] = (*request_length - 6) / 256;
- (*request)[5] = (*request_length - 6) % 256;
-
- memcpy(&((*request)[8]), &trans_id, 4);
-
- return GRST_RET_OK;
-}
-
-int GRSThtcpNOPresponseMake(char **message, int *message_length,
- unsigned int trans_id)
-/*
- Make a complete HTCP NOP response for a found file and return a pointer
- to malloc'd memory pointing to it.
-*/
-{
- *message_length =
- asprintf(message,
- "%c%c" /* place holder for total length */
- "%c%c" /* HTCP version 0.0 */
- "%c%c" /* DATA length place holder */
- "%c%c" /* OPCODE,RESPONSE,RESERVED,F1,RR */
- "%c%c%c%c" /* TRANS-ID place holder */
- "%c%c", /* AUTH (LENGTH=2 means no AUTH) */
- 0, 0,
- 0, 0,
- 0, 0,
- GRSThtcpNOPop * 16, 1, /* RR=1, MO=0, RESPONSE=0 (ie found) */
- 0, 0, 0, 0,
- 0, 2);
-
- if (*message_length < 0) return GRST_RET_FAILED;
-
- (*message)[0] = *message_length / 256;
- (*message)[1] = *message_length % 256;
-
- (*message)[4] = (*message_length - 6) / 256;
- (*message)[5] = (*message_length - 6) % 256;
-
- memcpy(&((*message)[8]), &trans_id, 4);
-
- return GRST_RET_OK;
-}
-
-int GRSThtcpTSTrequestMake(char **request, int *request_length,
- unsigned int trans_id,
- char *method, char *uri, char *req_hdrs)
-/*
- Make a complete HTCP TST request and return a pointer to malloc'd
- memory pointing to it.
-*/
-{
- if ((method == NULL) || (uri == NULL) || (req_hdrs == NULL))
- return GRST_RET_FAILED;
-
- *request_length =
- asprintf(request,"%c%c" /* place holder for total length */
- "%c%c" /* HTCP version 0.0 */
- "%c%c" /* DATA length place holder */
- "%c%c" /* OPCODE,RESPONSE,RESERVED,F1,RR */
- "%c%c%c%c" /* TRANS-ID placeholder */
- "%c%c%s" /* OP-DATA: METHOD */
- "%c%c%s" /* OP-DATA: URI */
- "%c%c%s" /* OP-DATA: VERSION */
- "%c%c%s" /* OP-DATA: REQ-HDRS */
- "%c%c", /* AUTH (LENGTH=2 means no AUTH) */
- 0, 0,
- 0, 0,
- 0, 0,
- GRSThtcpTSTop * 16, 2,
- 0, 0, 0, 0,
- strlen(method) / 256, strlen(method) % 256, method,
- strlen(uri) / 256, strlen(uri) % 256, uri,
- 0, 8, "HTTP/1.1",
- strlen(req_hdrs)/256, strlen(req_hdrs) % 256, req_hdrs,
- 0, 2);
-
- if (*request_length < 0) return GRST_RET_FAILED;
-
- (*request)[0] = *request_length / 256;
- (*request)[1] = *request_length % 256;
-
- (*request)[4] = (*request_length - 6) / 256;
- (*request)[5] = (*request_length - 6) % 256;
-
- memcpy(&((*request)[8]), &trans_id, 4);
-
- return GRST_RET_OK;
-}
-
-int GRSThtcpTSTresponseMake(char **message, int *message_length,
- unsigned int trans_id,
- char *resp_hdrs, char *entity_hdrs,
- char *cache_hdrs)
-/*
- Make a complete HTCP TST response for a found file and return a pointer
- to malloc'd memory pointing to it.
-*/
-{
- if ((resp_hdrs != NULL) && (entity_hdrs != NULL) && (cache_hdrs != NULL))
- /* found file response */
- *message_length =
- asprintf(message,
- "%c%c" /* place holder for total length */
- "%c%c" /* HTCP version 0.0 */
- "%c%c" /* DATA length place holder */
- "%c%c" /* OPCODE,RESPONSE,RESERVED,F1,RR */
- "%c%c%c%c" /* TRANS-ID place holder */
- "%c%c%s" /* OP-DATA: RESP-HDRS */
- "%c%c%s" /* OP-DATA: ENTITY-HDRS */
- "%c%c%s" /* OP-DATA: CACHE-HDRS */
- "%c%c", /* AUTH (LENGTH=2 means no AUTH) */
- 0, 0,
- 0, 0,
- 0, 0,
- GRSThtcpTSTop * 16, 1, /* RR=1, MO=0, RESPONSE=0 (ie found) */
- 0, 0, 0, 0,
- strlen(resp_hdrs) / 256, strlen(resp_hdrs) % 256, resp_hdrs,
- strlen(entity_hdrs) / 256, strlen(entity_hdrs) % 256, entity_hdrs,
- strlen(cache_hdrs) / 256, strlen(cache_hdrs) % 256, cache_hdrs,
- 0, 2);
- else if (cache_hdrs != NULL)
- /* not found file response, just cache_hdrs given */
- *message_length =
- asprintf(message,
- "%c%c" /* place holder for total length */
- "%c%c" /* HTCP version 0.0 */
- "%c%c" /* DATA length place holder */
- "%c%c" /* OPCODE,RESPONSE,RESERVED,F1,RR */
- "%c%c%c%c" /* TRANS-ID */
- "%c%c%s" /* OP-DATA: CACHE-HDRS */
- "%c%c", /* AUTH (LENGTH=2 means no AUTH) */
- 0, 0,
- 0, 0,
- 0, 0,
- GRSThtcpTSTop * 16 + 1, 1, /* RR=1, MO=0, RESPONSE=1 (missing) */
- 0, 0, 0, 0,
- strlen(cache_hdrs) / 256, strlen(cache_hdrs) % 256, cache_hdrs,
- 0, 2);
- else return GRST_RET_FAILED;
-
- if (*message_length < 0) return GRST_RET_FAILED;
-
- (*message)[0] = *message_length / 256;
- (*message)[1] = *message_length % 256;
-
- (*message)[4] = (*message_length - 6) / 256;
- (*message)[5] = (*message_length - 6) % 256;
-
- memcpy(&((*message)[8]), &trans_id, 4);
-
- return GRST_RET_OK;
-}
-
-int GRSThtcpMessageParse(GRSThtcpMessage *parsed, char *raw, int length)
-{
- GRSThtcpCountstr *s;
-
- bzero(parsed, sizeof(GRSThtcpMessage));
-
- if (length < (void *) &(parsed->method)
- - (void *) &(parsed->total_length_msb) + 2)
- return GRST_RET_FAILED;
-
- memcpy(parsed, raw, (void *) &(parsed->method)
- - (void *) &(parsed->total_length_msb));
-
- if (parsed->opcode == GRSThtcpNOPop) return GRST_RET_OK;
-
- if ((parsed->opcode == GRSThtcpTSTop) && (parsed->rr == 0))
- {
- /* a TST request */
-
- /* point to start of data/auth in raw */
- s = (GRSThtcpCountstr *) &(((GRSThtcpMessage *) raw)->method);
-
- /* METHOD string */
-
- if ((void *) s + 2 + GRSThtcpCountstrLen(s) > (void *) raw + length)
- return GRST_RET_FAILED;
- parsed->method = s;
- s = (GRSThtcpCountstr *) ((void *) s + 2 + GRSThtcpCountstrLen(s));
-
- /* URI string */
-
- if ((void *) s + 2 + GRSThtcpCountstrLen(s) > (void *) raw + length)
- return GRST_RET_FAILED;
- parsed->uri = s;
- s = (GRSThtcpCountstr *) ((void *) s + 2 + GRSThtcpCountstrLen(s));
-
- /* VERSION string */
-
- if ((void *) s + 2 + GRSThtcpCountstrLen(s) > (void *) raw + length)
- return GRST_RET_FAILED;
- parsed->version = s;
- s = (GRSThtcpCountstr *) ((void *) s + 2 + GRSThtcpCountstrLen(s));
-
- /* REQ-HDRS string */
-
- if ((void *) s + 2 + GRSThtcpCountstrLen(s) > (void *) raw + length)
- return GRST_RET_FAILED;
- parsed->req_hdrs = s;
- s = (GRSThtcpCountstr *) ((void *) s + 2 + GRSThtcpCountstrLen(s));
-
- return GRST_RET_OK;
- }
-
- if ((parsed->opcode == GRSThtcpTSTop) && (parsed->rr == 1))
- {
- /* a TST response */
-
- /* point to start of data/auth in raw */
- s = (GRSThtcpCountstr *) &(((GRSThtcpMessage *) raw)->method);
-
- /* RESP-HDRS string */
-
- if ((void *) s + 2 + GRSThtcpCountstrLen(s) > (void *) raw + length)
- return GRST_RET_FAILED;
- parsed->resp_hdrs = s;
- s = (GRSThtcpCountstr *) ((void *) s + 2 + GRSThtcpCountstrLen(s));
-
- /* ENTITY-HDRS string */
-
- if ((void *) s + 2 + GRSThtcpCountstrLen(s) > (void *) raw + length)
- return GRST_RET_FAILED;
- parsed->entity_hdrs = s;
- s = (GRSThtcpCountstr *) ((void *) s + 2 + GRSThtcpCountstrLen(s));
-
- /* CACHE-HDRS string */
-
- if ((void *) s + 2 + GRSThtcpCountstrLen(s) > (void *) raw + length)
- return GRST_RET_FAILED;
- parsed->cache_hdrs = s;
- s = (GRSThtcpCountstr *) ((void *) s + 2 + GRSThtcpCountstrLen(s));
-
- return GRST_RET_OK;
- }
-
- return GRST_RET_FAILED;
-}
+++ /dev/null
-/*
- Copyright (c) 2002-3, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef VERSION
-#define VERSION "x.x.x"
-#endif
-
-#define _GNU_SOURCE
-#include <stdio.h>
-
-#include <time.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "gridsite.h"
-
-void GRSThttpBodyInit(GRSThttpBody *thisbody)
-{
- thisbody->size = 0; /* simple, but we don't expose internals to callers */
-}
-
-void GRSThttpPrintf(GRSThttpBody *thisbody, char *fmt, ...)
-/* append printf() style format and arguments to *thisbody.
- This requires vasprintf from glibc!! */
-{
- char *p;
- size_t size;
- va_list args;
-
- va_start(args, fmt);
- size = vasprintf(&p, fmt, args);
- va_end(args);
-
- if (size == 0) free(p); /* don't need to bother in this case */
- else if (size > 0)
- {
- if (thisbody->size == 0) /* need to initialise */
- {
- thisbody->first = (GRSThttpCharsList *)malloc(sizeof(GRSThttpCharsList));
- thisbody->first->text = p;
- thisbody->first->next = NULL;
-
- thisbody->last = thisbody->first;
- thisbody->size = size;
- }
- else
- {
- thisbody->last->next = (GRSThttpCharsList *)
- malloc(sizeof(GRSThttpCharsList));
- ((GRSThttpCharsList *) thisbody->last->next)->text = p;
- ((GRSThttpCharsList *) thisbody->last->next)->next = NULL;
-
- thisbody->last = thisbody->last->next;
- thisbody->size = thisbody->size + size;
- }
- }
-}
-
-int GRSThttpCopy(GRSThttpBody *thisbody, char *file)
-/*
- copy a whole file, named file[], into the body output buffer, returning
- 1 if file was found and copied ok, or 0 otherwise.
-*/
-{
- int fd, len;
- char c, *p;
- struct stat statbuf;
-
- fd = open(file, O_RDONLY);
-
- if (fd == -1) return 0;
-
- if (fstat(fd, &statbuf) != 0)
- {
- close(fd);
- return 0;
- }
-
- p = malloc(statbuf.st_size + 1);
-
- if (p == NULL)
- {
- close(fd);
- return 0;
- }
-
- len = read(fd, p, statbuf.st_size);
- p[len] = '\0';
-
- close(fd);
-
- if (thisbody->size == 0) /* need to initialise */
- {
- thisbody->first = (GRSThttpCharsList *) malloc(sizeof(GRSThttpCharsList));
- thisbody->first->text = p;
- thisbody->first->next = NULL;
-
- thisbody->last = thisbody->first;
- thisbody->size = len;
- }
- else
- {
- thisbody->last->next=(GRSThttpCharsList *)malloc(sizeof(GRSThttpCharsList));
- ((GRSThttpCharsList *) thisbody->last->next)->text = p;
- ((GRSThttpCharsList *) thisbody->last->next)->next = NULL;
-
- thisbody->last = thisbody->last->next;
- thisbody->size = thisbody->size + len;
- }
-
- return 1;
-}
-
-void GRSThttpWriteOut(GRSThttpBody *thisbody)
-/* output Content-Length header, blank line then whole of the body to
- standard output */
-{
- GRSThttpCharsList *p;
-
- printf("Content-Length: %d\n\n", thisbody->size);
-
- p = thisbody->first;
-
- while (p != NULL)
- {
- fputs(p->text, stdout);
-
- p = p->next;
- }
-}
-
-int GRSThttpPrintHeaderFooter(GRSThttpBody *bp, char *file, char *headfootname)
-/*
- try to print Header or Footer appropriate for absolute path file[],
- returning 1 rather than 0 if found.
-*/
-{
- int found = 0;
- char *pathfile, *p;
- struct stat statbuf;
-
- pathfile = malloc(strlen(file) + strlen(headfootname) + 2);
- strcpy(pathfile, file);
-
- if ((pathfile[strlen(pathfile) - 1] != '/') &&
- (stat(pathfile, &statbuf) == 0) &&
- S_ISDIR(statbuf.st_mode)) strcat(pathfile, "/");
-
- for (;;)
- {
- p = rindex(pathfile, '/');
- if (p == NULL) break;
- p[1] = '\0';
- strcat(p, headfootname);
-
- if (stat(pathfile, &statbuf) == 0)
- {
- found = GRSThttpCopy(bp, pathfile);
- break;
- }
-
- p[0] = '\0';
- }
-
- free(pathfile);
- return found;
-}
-
-char *GRSThttpGetCGI(char *name)
-/*
- Return a malloc()ed copy of CGI form parameter identified by name[],
- either received by QUERY_STRING (via GET) or on stdin (via POST).
- Caller must free() the returned string itself. If name[] is not found,
- an empty NUL-terminated malloc()ed string is returned. name[] has any
- URL-encoding reversed.
-*/
-{
- char *p, *namepattern, *valuestart, *returnvalue, *querystring;
- int c, i, j, n, contentlength = 0;
- static char *cgiposted = NULL;
- size_t size_needed;
-
- if (cgiposted == NULL) /* have to initialise cgiposted */
- {
- p = getenv("CONTENT_LENGTH");
- if (p != NULL) sscanf(p, "%d", &contentlength);
-
- querystring = getenv("REDIRECT_QUERY_STRING");
- if (querystring == NULL) querystring = getenv("QUERY_STRING");
-
- if (querystring == NULL) cgiposted = malloc(contentlength + 3);
- else cgiposted = malloc(contentlength + strlen(querystring) + 4);
-
- cgiposted[0] = '&';
-
- for (i = 1; i <= contentlength; ++i)
- {
- c = getchar();
- if (c == EOF) break;
- cgiposted[i] = c;
- }
-
- cgiposted[i] = '&';
- cgiposted[i+1] = '\0';
-
- if (querystring != NULL)
- {
- strcat(cgiposted, querystring);
- strcat(cgiposted, "&");
- }
- }
-
- namepattern = malloc(strlen(name) + 3);
- sprintf(namepattern, "&%s=", name);
-
- p = strstr(cgiposted, namepattern);
- free(namepattern);
- if (p == NULL) return strdup("");
-
- valuestart = &p[strlen(name) + 2];
-
- for (n=0; valuestart[n] != '&'; ++n) ;
-
- returnvalue = malloc(n + 1);
-
- j=0;
-
- for (i=0; i < n; ++i)
- {
- if ((i < n - 2) && (valuestart[i] == '%')) /* url encoded as %HH */
- {
- returnvalue[j] = 0;
-
- if (isdigit(valuestart[i+1]))
- returnvalue[j] += 16 * (valuestart[i+1] - '0');
- else if (isalpha(valuestart[i+1]))
- returnvalue[j] += 16 * (10 + tolower(valuestart[i+1]) - 'a');
-
- if (isdigit(valuestart[i+2]))
- returnvalue[j] += valuestart[i+2] - '0';
- else if (isalpha(valuestart[i+2]))
- returnvalue[j] += 10 + tolower(valuestart[i+2]) - 'a';
-
- i = i + 2;
- }
- else if (valuestart[i] == '+') returnvalue[j] = ' ';
- else returnvalue[j] = valuestart[i];
-
- if (returnvalue[j] == '\r') continue; /* CR/LF -> LF */
- ++j;
- }
-
- returnvalue[j] = '\0';
-
- return returnvalue;
-}
-
-/* *
- * Utility functions *
- * */
-
-char *GRSThttpUrlDecode(char *in)
-{
- int i, j, n;
- char *out;
-
- n = strlen(in);
- out = malloc(n + 1);
-
- j=0;
-
- for (i=0; i < n; ++i)
- {
- if ((i < n - 2) && (in[i] == '%')) /* url encoded as %HH */
- {
- out[j] = 0;
-
- if (isdigit(in[i+1]))
- out[j] += 16 * (in[i+1] - '0');
- else if (isalpha(in[i+1]))
- out[j] += 16 * (10 + tolower(in[i+1]) - 'a');
-
- if (isdigit(in[i+2]))
- out[j] += in[i+2] - '0';
- else if (isalpha(in[i+2]))
- out[j] += 10 + tolower(in[i+2]) - 'a';
-
- i = i + 2;
- }
- else if (in[i] == '+') out[j] = ' ';
- else out[j] = in[i];
-
- ++j;
- }
-
- out[j] = '\0';
-
- return out;
-}
-
-char *GRSThttpUrlEncode(char *in)
-/* Return a pointer to a malloc'd string holding a URL-encoded (RFC 1738)
- version of *in. Only A-Z a-z 0-9 . _ - are passed through unmodified.
- (DN's processed by GRSThttpUrlEncode can be used as valid Unix filenames,
- assuming they do not exceed restrictions on filename length.) */
-{
- char *out, *p, *q;
-
- out = malloc(3*strlen(in) + 1);
-
- p = in;
- q = out;
-
- while (*p != '\0')
- {
- if (isalnum(*p) || (*p == '.') || (*p == '_') || (*p == '-'))
- {
- *q = *p;
- ++q;
- }
- else
- {
- sprintf(q, "%%%2X", *p);
- q = &q[3];
- }
-
- ++p;
- }
-
- *q = '\0';
- return out;
-}
-
-char *GRSThttpUrlMildencode(char *in)
-/* Return a pointer to a malloc'd string holding a partially URL-encoded
- version of *in. "Partially" means that A-Z a-z 0-9 . = - _ @ and /
- are passed through unmodified. (DN's processed by GRSThttpUrlMildencode()
- can be used as valid Unix paths+filenames if you are prepared to
- create or simulate the resulting /X=xyz directories.) */
-{
- char *out, *p, *q;
-
- out = malloc(3*strlen(in) + 1);
-
- p = in;
- q = out;
-
- while (*p != '\0')
- {
- if (isalnum(*p) || (*p == '.') || (*p == '=') || (*p == '-')
- || (*p == '/') || (*p == '@') || (*p == '_'))
- {
- *q = *p;
- ++q;
- }
- else if (*p == ' ')
- {
- *q = '+';
- ++q;
- }
- else
- {
- sprintf(q, "%%%2X", *p);
- q = &q[3];
- }
-
- ++p;
- }
-
- *q = '\0';
- return out;
-}
-
-/// Return a one-time passcode string, for use with GridHTTP
-/**
- * Returns
- *
- * String is timestamp+SHA1_HASH(timestamp+":"+method+":"+URL)
- * Timestamps and hashes are in lowercase hexadecimal. Timestamps are
- * seconds since 00:00:00 on January 1, 1970 UTC.
- */
-
-/*
-char *GRSThttpMakeOneTimePasscode(time_t timestamp, char *method, char *url)
-{
- int len, i;
- char *stringtohash, hashedstring[EVP_MAX_MD_SIZE], *returnstring;
- const EVP_MD *m;
- EVP_MD_CTX ctx;
-
- m = EVP_sha1();
- if (m == NULL) return NULL;
-
- asprintf(&stringtohash, "%08x:%s:%s", timestamp, method, url);
-
- EVP_DigestInit(&ctx, m);
- EVP_DigestUpdate(&ctx, stringtohash, strlen(stringtohash));
- EVP_DigestFinal(&ctx, hashedstring, &len);
-
- returnstring = malloc(9 + len * 2);
-
- sprintf(returnstring, "%08x", timestamp);
-
- for (i=0;
-
- return returnstring;
-}
-*/
+++ /dev/null
-/*
- Copyright (c) 2002-5, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
- ---------------------------------------------------------------
- For more information about GridSite: http://www.gridsite.org/
- ---------------------------------------------------------------
-*/
-
-#define _GNU_SOURCE
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <time.h>
-#include <stdarg.h>
-#include <dirent.h>
-#include <string.h>
-#include <pwd.h>
-#include <errno.h>
-#include <getopt.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <openssl/x509.h>
-#include <openssl/x509v3.h>
-#include <openssl/err.h>
-#include <openssl/pem.h>
-
-#include <openssl/rsa.h>
-#include <openssl/pem.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/bio.h>
-#include <openssl/des.h>
-#include <openssl/rand.h>
-
-#include "gridsite.h"
-
-#define GRST_KEYSIZE 512
-#define GRST_PROXYCACHE "/../proxycache/"
-#define GRST_MAX_CHAIN_LEN 9
-
-/// Compare X509 Distinguished Name strings
-int GRSTx509NameCmp(char *a, char *b)
-/**
- * This function attempts to do with string representations what
- * would ideally be done with OIDs/values. In particular, we equate
- * "/Email=" == "/emailAddress=" to deal with this important change
- * between OpenSSL 0.9.6 and 0.9.7.
- * Other than that, it is currently the same as ordinary strcmp(3).
- */
-{
- int ret;
- char *aa, *bb, *p;
-
- aa = strdup(a);
- while ((p = strstr(aa, "/emailAddress=")) != NULL)
- {
- memmove(&p[6], &p[13], strlen(&p[13]) + 1);
- p[1] = 'E';
- }
-
- bb = strdup(b);
- while ((p = strstr(bb, "/emailAddress=")) != NULL)
- {
- memmove(&p[6], &p[13], strlen(&p[13]) + 1);
- p[1] = 'E';
- }
-
- ret = strcmp(aa, bb);
-
- free(aa);
- free(bb);
-
- return ret;
-}
-
-
-/// Check critical extensions
-/**
- * Returning GRST_RET_OK if all of extensions are known to us or
- * OpenSSL; GRST_REF_FAILED otherwise.
- *
- * Since this function relies on functionality (X509_supported_extension)
- * introduced in 0.9.7, then we do nothing and report an error
- * (GRST_RET_FAILED) if one of the associated defines
- * (X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION) is absent.
- */
-
-int GRSTx509KnownCriticalExts(X509 *cert)
-{
- int i;
- char s[80];
- X509_EXTENSION *ex;
-
-#ifdef X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION
- for (i = 0; i < X509_get_ext_count(cert); ++i)
- {
- ex = X509_get_ext(cert, i);
-
- if (X509_EXTENSION_get_critical(ex) &&
- !X509_supported_extension(ex))
- {
- OBJ_obj2txt(s, sizeof(s), X509_EXTENSION_get_object(ex), 1);
-
- if (strcmp(s, GRST_PROXYCERTINFO_OID) != 0) return GRST_RET_FAILED;
- }
- }
-
- return GRST_RET_OK;
-#else
- return GRST_RET_FAILED;
-#endif
-}
-
-/// Check if certificate can be used as a CA to sign standard X509 certs
-/*
- * Return GRST_RET_OK if true; GRST_RET_FAILED if not.
- */
-
-int GRSTx509IsCA(X509 *cert)
-{
- int idret, purpose_id;
-
- purpose_id = X509_PURPOSE_get_by_sname("sslclient");
-
- /* final argument to X509_check_purpose() is whether to check for CAness */
-
- if (X509_check_purpose(cert, purpose_id + X509_PURPOSE_MIN, 1))
- return GRST_RET_OK;
- else return GRST_RET_FAILED;
-}
-
-/// Check certificate chain for GSI proxy acceptability.
-/**
- * Returns X509_V_OK/GRST_RET_OK if valid; OpenSSL X509 errors otherwise.
- *
- * Inspired by GSIcheck written by Mike Jones, SVE, Manchester Computing,
- * The University of Manchester.
- *
- * The GridSite version handles old and new style Globus proxies, and
- * proxies derived from user certificates issued with "X509v3 Basic
- * Constraints: CA:FALSE" (eg UK e-Science CA)
- *
- * We do not check chain links between certs here: this is done by
- * GRST_check_issued/X509_check_issued in mod_ssl's ssl_engine_init.c
- *
- * TODO: we do not yet check ProxyCertInfo and ProxyCertPolicy extensions
- * (although via GRSTx509KnownCriticalExts() we can accept them.)
- */
-
-int GRSTx509CheckChain(int *first_non_ca, X509_STORE_CTX *ctx)
-{
- STACK_OF(X509) *certstack; /* Points to the client's cert chain */
- X509 *cert; /* Points to the client's cert */
- int depth; /* Depth of cert chain */
- size_t len,len2; /* Lengths of issuer and cert DN */
- int IsCA; /* Holds whether cert is allowed to sign */
- int prevIsCA; /* Holds whether previous cert in chain is
- allowed to sign */
- int prevIsLimited; /* previous cert was proxy and limited */
- int i,j; /* Iteration variables */
- char *cert_DN; /* Pointer to current-certificate-in-chain's
- DN */
- char *issuer_DN; /* Pointer to
- issuer-of-current-cert-in-chain's DN */
- char *proxy_part_DN; /* Pointer to end part of current-cert-in-chain
- maybe eg "/CN=proxy" */
- time_t now;
-
- time(&now);
-
- *first_non_ca = 0; /* set to something predictable if things fail */
-
- /* Check for context */
- if (!ctx) return X509_V_ERR_INVALID_CA;
- /* Can't GSI-verify if there is no context. Here and throughout this
- function we report all errors as X509_V_ERR_INVALID_CA. */
-
- /* Set necessary preliminary values */
- IsCA = TRUE; /* =prevIsCA - start from a CA */
- prevIsLimited = 0;
-
- /* Get the client cert chain */
- certstack = X509_STORE_CTX_get_chain(ctx); /* Get the client's chain */
- depth = sk_X509_num(certstack); /* How deep is that chain? */
-
- /* Check the client chain */
- for (i=depth-1; i >= 0; --i)
- /* loop through client-presented chain starting at CA end */
- {
- prevIsCA=IsCA;
-
- /* Check for X509 certificate and point to it with 'cert' */
- if (cert = sk_X509_value(certstack, i))
- {
- /* we check times and reject immediately if invalid */
-
- if (now <
- GRSTasn1TimeToTimeT(ASN1_STRING_data(X509_get_notBefore(cert)),0))
- return X509_V_ERR_INVALID_CA;
-
- if (now >
- GRSTasn1TimeToTimeT(ASN1_STRING_data(X509_get_notAfter(cert)),0))
- return X509_V_ERR_INVALID_CA;
-
- /* If any forebear certificate is not allowed to sign we must
- assume all decendents are proxies and cannot sign either */
- if (prevIsCA)
- {
- /* always treat the first cert (from the CA files) as a CA */
- if (i == depth-1) IsCA = TRUE;
- /* check if this cert is valid CA for signing certs */
- else IsCA = (GRSTx509IsCA(cert) == GRST_RET_OK);
-
- if (!IsCA) *first_non_ca = i;
- }
- else
- {
- IsCA = FALSE;
- /* Force proxy check next iteration. Important because I can
- sign any CA I create! */
- }
-
- cert_DN = X509_NAME_oneline(X509_get_subject_name(cert),NULL,0);
- issuer_DN = X509_NAME_oneline(X509_get_issuer_name(cert),NULL,0);
- len = strlen(cert_DN);
- len2 = strlen(issuer_DN);
-
- /* issuer didn't have CA status, so this is (at best) a proxy:
- check for bad proxy extension*/
-
- if (!prevIsCA)
- {
- if (prevIsLimited) /* we reject proxies of limited proxies! */
- return X509_V_ERR_INVALID_CA;
-
- /* User not allowed to sign shortened DN */
- if (len2 > len) return X509_V_ERR_INVALID_CA;
-
- /* Proxy subject must begin with issuer. */
- if (strncmp(cert_DN, issuer_DN, len2) != 0)
- return X509_V_ERR_INVALID_CA;
-
- /* Set pointer to end of base DN in cert_DN */
- proxy_part_DN = &cert_DN[len2];
-
- /* First attempt at support for Old and New style GSI
- proxies: /CN=anything is ok for now */
- if (strncmp(proxy_part_DN, "/CN=", 4) != 0)
- return X509_V_ERR_INVALID_CA;
-
- if ((strncmp(proxy_part_DN, "/CN=limited proxy", 17) == 0) &&
- (i > 0)) prevIsLimited = 1; /* ready for next cert ... */
- }
- }
- }
-
- /* Check cert whose private key is being used by client. If previous in
- chain is not allowed to be a CA then need to check this final cert for
- valid proxy-icity too */
- if (!prevIsCA)
- {
- if (prevIsLimited) return X509_V_ERR_INVALID_CA;
- /* we do not accept proxies signed by limited proxies */
-
- if (cert = sk_X509_value(certstack, 0))
- {
- /* Load DN & length of DN and either its issuer or the
- first-bad-issuer-in-chain */
- cert_DN = X509_NAME_oneline(X509_get_subject_name(cert), NULL, 0);
- issuer_DN = X509_NAME_oneline(X509_get_issuer_name(cert), NULL, 0);
- len = strlen(cert_DN);
- len2 = strlen(issuer_DN);
-
- /* issuer didn't have CA status, check for bad proxy extension */
-
- if (len2 > len) return X509_V_ERR_INVALID_CA;
- /* User not allowed to sign shortened DN */
-
- if (strncmp(cert_DN, issuer_DN, len2) != 0)
- return X509_V_ERR_INVALID_CA;
- /* Proxy subject must begin with issuer. */
-
- proxy_part_DN = &cert_DN[len2];
- /* Set pointer to end of DN base in cert_DN */
-
- /* Remander of subject must be either "/CN=proxy" or
- "/CN=limited proxy" (or /CN=XYZ for New style GSI) */
-
- /* First attempt at support for Old and New style GSI
- proxies: /CN=anything is ok for now. */
- if (strncmp(proxy_part_DN, "/CN=", 4) != 0)
- return X509_V_ERR_INVALID_CA;
- }
- }
-
- return X509_V_OK; /* this is also GRST_RET_OK, of course - by choice */
-}
-
-/// Example VerifyCallback routine
-
-/**
- *
- */
-
-int GRSTx509VerifyCallback (int ok, X509_STORE_CTX *ctx)
-{
- int errnum = X509_STORE_CTX_get_error(ctx);
- int errdepth = X509_STORE_CTX_get_error_depth(ctx);
- int first_non_ca;
-
-#ifndef X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION
-#define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34
-#endif
-
- if (errnum == X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION)
- {
- if (GRSTx509KnownCriticalExts(X509_STORE_CTX_get_current_cert(ctx))
- == GRST_RET_OK)
- {
- ok = TRUE;
- errnum = X509_V_OK;
- X509_STORE_CTX_set_error(ctx, errnum);
- }
- }
- else if ((errdepth == 0) &&
- (errnum == X509_V_OK) &&
- (GRSTx509CheckChain(&first_non_ca, ctx) != X509_V_OK)) ok = FALSE;
-
-
- return ok;
-
-// check this
-
-// if (ok) return GRST_RET_OK;
-// else return GRST_RET_FAILED;
-}
-
-/// Check the signature of the VOMS attributes
-/*
- * Returns GRST_RET_OK if signature is ok, other values if not.
- */
-
-static int GRSTx509VerifyVomsSig(time_t *time1_time, time_t *time2_time,
- unsigned char *asn1string,
- struct GRSTasn1TagList taglist[],
- int lasttag,
- char *vomsdir, int acnumber)
-{
-#define GRST_ASN1_COORDS_VOMS_DN "-1-1-%d-1-3-1-1-1-%%d-1-%%d"
-#define GRST_ASN1_COORDS_VOMS_INFO "-1-1-%d-1"
-#define GRST_ASN1_COORDS_VOMS_SIG "-1-1-%d-3"
- int ret, isig, iinfo;
- char *certpath, acvomsdn[200], dn_coords[200],
- info_coords[200], sig_coords[200];
- unsigned char *q;
- DIR *vomsDIR;
- struct dirent *vomsdirent;
- X509 *cert;
- EVP_PKEY *prvkey;
- FILE *fp;
- EVP_MD_CTX ctx;
- time_t voms_service_time1, voms_service_time2;
-
- if ((vomsdir == NULL) || (vomsdir[0] == '\0')) return GRST_RET_FAILED;
-
- snprintf(dn_coords, sizeof(dn_coords),
- GRST_ASN1_COORDS_VOMS_DN, acnumber);
-
- if (GRSTasn1GetX509Name(acvomsdn, sizeof(acvomsdn), dn_coords,
- asn1string, taglist, lasttag) != GRST_RET_OK) return GRST_RET_FAILED;
-
- snprintf(info_coords, sizeof(info_coords),
- GRST_ASN1_COORDS_VOMS_INFO, acnumber);
- iinfo = GRSTasn1SearchTaglist(taglist, lasttag, info_coords);
-
- snprintf(sig_coords, sizeof(sig_coords),
- GRST_ASN1_COORDS_VOMS_SIG, acnumber);
- isig = GRSTasn1SearchTaglist(taglist, lasttag, sig_coords);
-
- if ((iinfo < 0) || (isig < 0)) return GRST_RET_FAILED;
-
- vomsDIR = opendir(vomsdir);
- if (vomsDIR == NULL) return GRST_RET_FAILED;
-
- while ((vomsdirent = readdir(vomsDIR)) != NULL)
- {
- asprintf(&certpath, "%s/%s", vomsdir, vomsdirent->d_name);
- fp = fopen(certpath, "r");
- free(certpath);
- if (fp == NULL) continue;
-
- cert = PEM_read_X509(fp, NULL, NULL, NULL);
- fclose(fp);
- if (cert == NULL) continue;
-
- if (GRSTx509NameCmp(acvomsdn,
- X509_NAME_oneline(X509_get_subject_name(cert),NULL,0)) != 0)
- {
- X509_free(cert);
- continue;
- }
-
- prvkey = X509_extract_key(cert);
- if (prvkey == NULL)
- {
- X509_free(cert);
- continue;
- }
-
- OpenSSL_add_all_digests();
-#if OPENSSL_VERSION_NUMBER >= 0x0090701fL
- EVP_MD_CTX_init(&ctx);
- EVP_VerifyInit_ex(&ctx, EVP_md5(), NULL);
-#else
- EVP_VerifyInit(&ctx, EVP_md5());
-#endif
-
- EVP_VerifyUpdate(&ctx,
- &asn1string[taglist[iinfo].start+
- 0*taglist[iinfo].headerlength],
- taglist[iinfo].length+taglist[iinfo].headerlength);
-
- ret = EVP_VerifyFinal(&ctx,
- &asn1string[taglist[isig].start+
- taglist[isig].headerlength]+1,
- taglist[isig].length - 1,
- prvkey);
-
-#if OPENSSL_VERSION_NUMBER >= 0x0090701fL
- EVP_MD_CTX_cleanup(&ctx);
-#endif
- EVP_PKEY_free(prvkey);
-
- if (ret != 1) /* signature doesnt match, look for more */
- {
- continue;
- X509_free(cert);
- }
-
- voms_service_time1 =
- GRSTasn1TimeToTimeT(ASN1_STRING_data(X509_get_notBefore(cert)),0);
- if (voms_service_time1 > *time1_time)
- *time1_time = voms_service_time1;
-
- voms_service_time2 =
- GRSTasn1TimeToTimeT(ASN1_STRING_data(X509_get_notAfter(cert)),0);
- if (voms_service_time2 < *time1_time)
- *time2_time = voms_service_time2;
-
- X509_free(cert);
- closedir(vomsDIR);
- return GRST_RET_OK ; /* verified */
- }
-
- closedir(vomsDIR);
- return GRST_RET_FAILED;
-}
-
-/// Get the VOMS attributes in the given extension
-/*
- * Puts any VOMS credentials found into the Compact Creds string array
- * starting at *creds. Always returns GRST_RET_OK - even for invalid
- * credentials, which are just ignored.
- */
-
-int GRSTx509ParseVomsExt(int *lastcred, int maxcreds, size_t credlen,
- char *creds, time_t time1_time, time_t time2_time,
- X509_EXTENSION *ex, char *ucuserdn, char *vomsdir)
-{
-#define MAXTAG 500
-#define GRST_ASN1_COORDS_FQAN "-1-1-%d-1-7-1-2-1-2-%d"
-#define GRST_ASN1_COORDS_USER_DN "-1-1-%d-1-2-1-1-1-1-%%d-1-%%d"
-#define GRST_ASN1_COORDS_TIME1 "-1-1-%d-1-6-1"
-#define GRST_ASN1_COORDS_TIME2 "-1-1-%d-1-6-2"
- ASN1_OCTET_STRING *asn1data;
- char *asn1string, acuserdn[200], acvomsdn[200],
- dn_coords[200], fqan_coords[200], time1_coords[200],
- time2_coords[200];
- long asn1length;
- int lasttag=-1, itag, i, acnumber = 1;
- struct GRSTasn1TagList taglist[MAXTAG+1];
- time_t actime1, actime2, time_now;
-
- asn1data = X509_EXTENSION_get_data(ex);
- asn1string = ASN1_STRING_data(asn1data);
- asn1length = ASN1_STRING_length(asn1data);
-
- GRSTasn1ParseDump(NULL, asn1string, asn1length, taglist, MAXTAG, &lasttag);
-
- for (acnumber = 1; ; ++acnumber) /* go through ACs one by one */
- {
- snprintf(dn_coords, sizeof(dn_coords), GRST_ASN1_COORDS_USER_DN, acnumber);
- if (GRSTasn1GetX509Name(acuserdn, sizeof(acuserdn), dn_coords,
- asn1string, taglist, lasttag) != GRST_RET_OK) break;
-
- if (GRSTx509NameCmp(ucuserdn, acuserdn) != 0) continue;
-
- if (GRSTx509VerifyVomsSig(&time1_time, &time2_time,
- asn1string, taglist, lasttag, vomsdir, acnumber)
- != GRST_RET_OK) continue;
-
- snprintf(time1_coords, sizeof(time1_coords), GRST_ASN1_COORDS_TIME1, acnumber);
- itag = GRSTasn1SearchTaglist(taglist, lasttag, time1_coords);
- actime1 = GRSTasn1TimeToTimeT(&asn1string[taglist[itag].start+
- taglist[itag].headerlength],
- taglist[itag].length);
- if (actime1 > time1_time) time1_time = actime1;
-
- snprintf(time2_coords, sizeof(time2_coords), GRST_ASN1_COORDS_TIME2, acnumber);
- itag = GRSTasn1SearchTaglist(taglist, lasttag, time2_coords);
- actime2 = GRSTasn1TimeToTimeT(&asn1string[taglist[itag].start+
- taglist[itag].headerlength],
- taglist[itag].length);
- if (actime2 < time2_time) time2_time = actime2;
-
- time(&time_now);
- if ((time1_time > time_now) || (time2_time < time_now))
- continue; /* expiration isnt invalidity ...? */
-
- for (i=1; ; ++i)
- {
- snprintf(fqan_coords, sizeof(fqan_coords), GRST_ASN1_COORDS_FQAN, acnumber, i);
- itag = GRSTasn1SearchTaglist(taglist, lasttag, fqan_coords);
-
- if (itag > -1)
- {
- if (*lastcred < maxcreds - 1)
- {
- ++(*lastcred);
- snprintf(&creds[*lastcred * (credlen + 1)], credlen+1,
- "VOMS %010lu %010lu 0 %.*s",
- time1_time, time2_time,
- taglist[itag].length,
- &asn1string[taglist[itag].start+
- taglist[itag].headerlength]);
- }
- }
- else break;
- }
- }
-
- return GRST_RET_OK;
-}
-
-/// Get the VOMS attributes in the extensions to the given cert stack
-/*
- * Puts any VOMS credentials found into the Compact Creds string array
- * starting at *creds. Always returns GRST_RET_OK.
- */
-
-int GRSTx509GetVomsCreds(int *lastcred, int maxcreds, size_t credlen,
- char *creds, X509 *usercert, STACK_OF(X509) *certstack,
- char *vomsdir)
-{
- int i, j, vomsfound=0;
- char s[80];
- unsigned char *ucuser;
- X509_EXTENSION *ex;
- ASN1_STRING *asn1str;
- X509 *cert;
- time_t time1_time = 0, time2_time = 0, uctime1_time, uctime2_time;
-
- uctime1_time =
- GRSTasn1TimeToTimeT(ASN1_STRING_data(X509_get_notBefore(usercert)),0);
- uctime2_time =
- GRSTasn1TimeToTimeT(ASN1_STRING_data(X509_get_notAfter(usercert)),0);
- ucuser =
- X509_NAME_oneline(X509_get_subject_name(usercert), NULL, 0);
-
- for (j=sk_X509_num(certstack)-1; j >= 0; --j)
- {
- cert = sk_X509_value(certstack, j);
-
- time1_time =
- GRSTasn1TimeToTimeT(ASN1_STRING_data(X509_get_notBefore(cert)),0);
- uctime1_time = (time1_time > uctime1_time) ? time1_time:uctime1_time;
-
- time2_time =
- GRSTasn1TimeToTimeT(ASN1_STRING_data(X509_get_notAfter(cert)),0);
- uctime2_time = (time2_time < uctime2_time) ? time2_time:uctime2_time;
-
- for (i=0; i < X509_get_ext_count(cert); ++i)
- {
- ex = X509_get_ext(cert, i);
- OBJ_obj2txt(s, sizeof(s), X509_EXTENSION_get_object(ex), 1);
-
- if (strcmp(s, GRST_VOMS_OID) == 0) /* a VOMS extension */
- {
- vomsfound=1;
- GRSTx509ParseVomsExt(lastcred, maxcreds, credlen, creds,
- uctime1_time, uctime2_time,
- ex, ucuser, vomsdir);
- }
- }
-
- if (vomsfound) return GRST_RET_OK;
- }
-
- return GRST_RET_OK;
-}
-
-/// Turn a Compact Cred line into a GRSTgaclCred object
-/**
- * Returns pointer to created GRSTgaclCred or NULL or failure.
- */
-
-GRSTgaclCred *GRSTx509CompactToCred(char *grst_cred)
-{
- int delegation;
- char *p;
- time_t now, notbefore, notafter;
- GRSTgaclCred *cred = NULL;
-
- time(&now);
-
- if (grst_cred == NULL) return NULL; /* just in case */
-
- if (strncmp(grst_cred, "X509USER ", 9) == 0)
- {
- if ((sscanf(grst_cred, "X509USER %lu %lu %d",
- ¬before, ¬after, &delegation) == 3)
- && (now >= notbefore)
- && (now <= notafter)
- && (p = index(grst_cred, ' '))
- && (p = index(++p, ' '))
- && (p = index(++p, ' '))
- && (p = index(++p, ' ')))
- {
- cred = GRSTgaclCredNew("person");
- GRSTgaclCredSetDelegation(cred, delegation);
- GRSTgaclCredAddValue(cred, "dn", &p[1]);
- }
-
- return cred;
- }
-
- if (strncmp(grst_cred, "VOMS ", 5) == 0)
- {
- if ((sscanf(grst_cred, "VOMS %lu %lu %d",
- ¬before, ¬after, &delegation) == 3)
- && (now >= notbefore)
- && (now <= notafter)
- && (p = index(grst_cred, ' '))
- && (p = index(++p, ' '))
- && (p = index(++p, ' '))
- && (p = index(++p, ' ')))
- {
- /* include /VO/group/subgroup/Role=role/Capability=cap */
-
- if (p[1] != '/') return NULL; /* must begin with / */
-
- cred = GRSTgaclCredNew("voms");
- GRSTgaclCredSetDelegation(cred, delegation);
- GRSTgaclCredAddValue(cred, "fqan", &p[1]);
- }
-
- return cred;
- }
-
- return NULL; /* dont recognise this credential type */
-}
-
-/// Get the credentials in an X509 cert/GSI proxy, including any VOMS
-/**
- * Credentials are placed in Compact Creds string array at *creds.
- *
- * Function returns GRST_RET_OK on success, or GRST_RET_FAILED if
- * some inconsistency found in certificate.
- */
-
-int GRSTx509CompactCreds(int *lastcred, int maxcreds, size_t credlen,
- char *creds, STACK_OF(X509) *certstack, char *vomsdir,
- X509 *peercert)
-{
- int i, j, delegation = 0;
- char credtemp[credlen+1];
- X509 *cert, *usercert = NULL, *gsiproxycert = NULL;
-
- *lastcred = -1;
-
- for (i = sk_X509_num(certstack) - 1; i >= 0; --i)
- {
- cert = sk_X509_value(certstack, i);
-
- if (usercert != NULL)
- { /* found a (GSI proxy) cert after the user cert */
- gsiproxycert = cert;
- ++delegation;
- }
-
- if ((usercert == NULL) &&
- (i < sk_X509_num(certstack) - 1) &&
- (GRSTx509IsCA(cert) != GRST_RET_OK)) usercert = cert;
- /* found the 1st non-CA cert */
- }
-
- if (peercert != NULL)
- {
- if (usercert != NULL) /* found a (GSI proxy) cert after user cert */
- {
- gsiproxycert = peercert;
- ++delegation;
- }
-
- if ((usercert == NULL) &&
- (GRSTx509IsCA(peercert) != GRST_RET_OK)) usercert = peercert;
- /* found the 1st non-CA cert */
- }
-
- if ((usercert == NULL) /* if no usercert ("EEC"), we're not interested */
- ||
- (snprintf(credtemp, credlen+1, "X509USER %010lu %010lu %d %s",
- GRSTasn1TimeToTimeT(ASN1_STRING_data(X509_get_notBefore(usercert)),0),
- GRSTasn1TimeToTimeT(ASN1_STRING_data(X509_get_notAfter(usercert)),0),
- delegation,
- X509_NAME_oneline(X509_get_subject_name(usercert), NULL, 0)) >= credlen+1)
- ||
- (*lastcred >= maxcreds-1))
- {
- *lastcred = -1; /* just in case the caller looks at it */
- return GRST_RET_FAILED; /* tell caller that things didn't work out */
- }
-
- ++(*lastcred);
- strcpy(&creds[*lastcred * (credlen + 1)], credtemp);
-
- if ((gsiproxycert != NULL)
- &&
- (snprintf(credtemp, credlen+1, "GSIPROXY %010lu %010lu %d %s",
- GRSTasn1TimeToTimeT(ASN1_STRING_data(X509_get_notBefore(gsiproxycert)),0),
- GRSTasn1TimeToTimeT(ASN1_STRING_data(X509_get_notAfter(gsiproxycert)),0),
- delegation,
- X509_NAME_oneline(X509_get_subject_name(gsiproxycert), NULL, 0)) < credlen+1)
- &&
- (*lastcred < maxcreds-1))
- {
- ++(*lastcred);
- strcpy(&creds[*lastcred * (credlen + 1)], credtemp);
-
- GRSTx509GetVomsCreds(lastcred, maxcreds, credlen, creds,
- usercert, certstack, vomsdir);
-
- }
-
- return GRST_RET_OK;
-}
-
-/// Find proxy file name of the current user
-/**
- * Return a string with the proxy file name or NULL if not present.
- * This function does not check if the proxy has expired.
- */
-
-char *GRSTx509FindProxyFileName(void)
-{
- char *p;
-
- p = getenv("X509_USER_PROXY");
-
- if (p != NULL) return strdup(p);
-
- p = malloc(sizeof("/tmp/x509up_uXYYYXXXYYY"));
-
- sprintf(p, "/tmp/x509up_u%d", getuid());
-
- return p;
-}
-
-static void mpcerror(FILE *debugfp, char *msg)
-{
- if (debugfp != NULL)
- {
- fputs(msg, debugfp);
- ERR_print_errors_fp(debugfp);
- }
-}
-
-/// Make a GSI Proxy chain from a request, certificate and private key
-/**
- * The proxy chain is returned in *proxychain. If debugfp is non-NULL,
- * errors are output to that file pointer. The proxy will expired in
- * the given number of minutes starting from the current time.
- */
-
-int GRSTx509MakeProxyCert(char **proxychain, FILE *debugfp,
- char *reqtxt, char *cert, char *key, int minutes)
-{
- char *ptr, *certchain;
- int i, subjAltName_pos, ncerts;
- long serial = 2796, ptrlen;
- EVP_PKEY *pkey, *CApkey;
- const EVP_MD *digest;
- X509 *certs[GRST_MAX_CHAIN_LEN];
- X509_REQ *req;
- X509_NAME *name, *CAsubject, *newsubject;
- X509_NAME_ENTRY *ent;
- X509V3_CTX ctx;
- X509_EXTENSION *subjAltName;
- STACK_OF (X509_EXTENSION) * req_exts;
- FILE *fp;
- BIO *reqmem, *certmem;
-
- /* read in the request */
- reqmem = BIO_new(BIO_s_mem());
- BIO_puts(reqmem, reqtxt);
-
- if (!(req = PEM_read_bio_X509_REQ(reqmem, NULL, NULL, NULL)))
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error reading request from BIO memory\n");
- BIO_free(reqmem);
- return GRST_RET_FAILED;
- }
-
- BIO_free(reqmem);
-
- /* verify signature on the request */
- if (!(pkey = X509_REQ_get_pubkey (req)))
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error getting public key from request\n");
- return GRST_RET_FAILED;
- }
-
- if (X509_REQ_verify(req, pkey) != 1)
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error verifying signature on certificate\n");
- return GRST_RET_FAILED;
- }
-
- /* read in the signing certificate */
- if (!(fp = fopen(cert, "r")))
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error opening signing certificate file\n");
- return GRST_RET_FAILED;
- }
-
- for (ncerts = 1; ncerts < GRST_MAX_CHAIN_LEN; ++ncerts)
- if (!(certs[ncerts] = PEM_read_X509(fp, NULL, NULL, NULL))) break;
-
- if (ncerts == 1) /* zeroth cert with be new proxy cert */
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error reading signing certificate file\n");
- return GRST_RET_FAILED;
- }
-
- fclose(fp);
-
- CAsubject = X509_get_subject_name(certs[1]);
-
- /* read in the CA private key */
- if (!(fp = fopen(key, "r")))
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error reading signing private key file\n");
- return GRST_RET_FAILED;
- }
-
- if (!(CApkey = PEM_read_PrivateKey (fp, NULL, NULL, NULL)))
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error reading signing private key in file\n");
- return GRST_RET_FAILED;
- }
-
- fclose(fp);
-
- /* get subject name */
- if (!(name = X509_REQ_get_subject_name (req)))
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error getting subject name from request\n");
- return GRST_RET_FAILED;
- }
-
- /* create new certificate */
- if (!(certs[0] = X509_new ()))
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error creating X509 object\n");
- return GRST_RET_FAILED;
- }
-
- /* set version number for the certificate (X509v3) and the serial number
- need 3 = v4 for GSI proxy?? */
- if (X509_set_version (certs[0], 3L) != 1)
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error setting certificate version\n");
- return GRST_RET_FAILED;
- }
-
- ASN1_INTEGER_set (X509_get_serialNumber (certs[0]), serial++);
-
- if (!(name = X509_get_subject_name(certs[1])))
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error getting subject name from CA certificate\n");
- return GRST_RET_FAILED;
- }
-
- if (X509_set_issuer_name (certs[0], name) != 1)
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error setting issuer name of certificate\n");
- return GRST_RET_FAILED;
- }
-
- /* set issuer and subject name of the cert from the req and the CA */
- ent = X509_NAME_ENTRY_create_by_NID(NULL, OBJ_txt2nid("commonName"),
- MBSTRING_ASC, "proxy", -1);
-
- newsubject = X509_NAME_dup(CAsubject);
-
- X509_NAME_add_entry(newsubject, ent, -1, 0);
-
- if (X509_set_subject_name(certs[0], newsubject) != 1)
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error setting subject name of certificate\n");
- return GRST_RET_FAILED;
- }
-
- /* set public key in the certificate */
- if (X509_set_pubkey(certs[0], pkey) != 1)
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error setting public key of the certificate\n");
- return GRST_RET_FAILED;
- }
-
-// need to set validity within limits of earlier certificates in the chain
-
- /* set duration for the certificate */
- if (!(X509_gmtime_adj (X509_get_notBefore(certs[0]), 0)))
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error setting beginning time of the certificate\n");
- return GRST_RET_FAILED;
- }
-
- if (!(X509_gmtime_adj (X509_get_notAfter(certs[0]), 60 * minutes)))
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error setting ending time of the certificate\n");
- return GRST_RET_FAILED;
- }
-
- /* sign the certificate with the signing private key */
- if (EVP_PKEY_type (CApkey->type) == EVP_PKEY_RSA)
- digest = EVP_md5();
- else
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error checking signing private key for a valid digest\n");
- return GRST_RET_FAILED;
- }
-
- if (!(X509_sign (certs[0], CApkey, digest)))
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error signing certificate\n");
- return GRST_RET_FAILED;
- }
-
- /* store the completed certificate chain */
-
- certchain = strdup("");
-
- for (i=0; i < ncerts; ++i)
- {
- certmem = BIO_new(BIO_s_mem());
-
- if (PEM_write_bio_X509(certmem, certs[i]) != 1)
- {
- mpcerror(debugfp,
- "GRSTx509MakeProxyCert(): error writing certificate to memory BIO\n");
- return GRST_RET_FAILED;
- }
-
- ptrlen = BIO_get_mem_data(certmem, &ptr);
-
- certchain = realloc(certchain, strlen(certchain) + ptrlen + 1);
-
- strncat(certchain, ptr, ptrlen);
-
- BIO_free(certmem);
- }
-
- *proxychain = certchain;
-
- return GRST_RET_OK;
-}
-
-/// Find a proxy file in the proxy cache
-/**
- * Returns the full path and file name of proxy file associated
- * with given delegation ID and user DN.
- */
-
-char *GRSTx509CachedProxyFind(char *proxydir, char *delegation_id,
- char *user_dn)
-/*
- Return a pointer to a malloc'd string with the full path of the
- proxy file corresponding to the given delegation_id, or NULL
- if not found.
-*/
-{
- int ret, len;
- char *filename = NULL, *line, *p, *proxyfile = NULL;
- DIR *proxyDIR;
- FILE *fp;
- struct dirent *ent;
- struct stat entstat;
-
- if ((proxyDIR = opendir(proxydir)) == NULL) return NULL;
-
- len = strlen(delegation_id);
- if (strlen(user_dn) > len) len = strlen(user_dn);
-
- if ((line = malloc(len + 2)) == NULL) return NULL;
-
- while ((ent = readdir(proxyDIR)) != NULL)
- {
- if (ent->d_name[0] != '.') /* private keys begin with . */
- {
- if (asprintf(&filename, "%s/%s", proxydir, ent->d_name) == -1)
- break;
- if ((stat(filename, &entstat) != 0)
- || !S_ISREG(entstat.st_mode))
- {
- free(filename);
- continue;
- }
-
- fp = fopen(filename, "r");
- if (fp != NULL)
- {
- if (fgets(line, len + 2, fp) != NULL)
- {
- p = index(line, '\n');
-
- if (p != NULL)
- {
- *p = '\0';
- if (strcmp(line, delegation_id) == 0)
- {
- if (fgets(line, len + 2, fp) != NULL)
- {
- p = index(line, '\n');
-
- if (p != NULL)
- {
- *p = '\0';
-
- if (strcmp(line, user_dn) == 0)
- {
- proxyfile = filename;
- fclose(fp);
- break;
- }
- }
- }
- }
- }
- }
-
- fclose(fp);
- }
-
- free(filename);
- }
- }
-
- closedir(proxyDIR);
- free(line);
-
- return proxyfile;
-}
-
-/// Find a temporary proxy private key file in the proxy cache
-/**
- * Returns the full path and file name of the private key file associated
- * with given delegation ID and user DN.
- */
-
-char *GRSTx509CachedProxyKeyFind(char *proxydir, char *delegation_id,
- char *user_dn)
-/*
- Return a pointer to a malloc'd string with the full path of the
- private proxy key corresponding to the given delegation_id, or NULL
- if not found.
-*/
-{
- int ret, len;
- char *filename = NULL, *line, *p, *keyfile = NULL;
- DIR *proxyDIR;
- FILE *fp;
- struct dirent *ent;
- struct stat entstat;
-
- if ((proxyDIR = opendir(proxydir)) == NULL) return NULL;
-
- len = strlen(delegation_id);
- if (strlen(user_dn) > len) len = strlen(user_dn);
-
- if ((line = malloc(len + 2)) == NULL) return NULL;
-
- while ((ent = readdir(proxyDIR)) != NULL)
- {
- if (ent->d_name[0] == '.') /* private keys begin with . */
- {
- if (asprintf(&filename, "%s/%s", proxydir, ent->d_name) == -1)
- break;
- if ((stat(filename, &entstat) != 0)
- || !S_ISREG(entstat.st_mode))
- {
- free(filename);
- continue;
- }
-
- fp = fopen(filename, "r");
- if (fp != NULL)
- {
- if (fgets(line, len + 2, fp) != NULL)
- {
- p = index(line, '\n');
-
- if (p != NULL)
- {
- *p = '\0';
- if (strcmp(line, delegation_id) == 0)
- {
- if (fgets(line, len + 2, fp) != NULL)
- {
- p = index(line, '\n');
-
- if (p != NULL)
- {
- *p = '\0';
-
- if (strcmp(line, user_dn) == 0)
- {
- keyfile = filename;
- fclose(fp);
- break;
- }
- }
- }
- }
- }
- }
-
- fclose(fp);
- }
-
- free(filename);
- }
- }
-
- closedir(proxyDIR);
- free(line);
-
- return keyfile;
-}
-
-/// Make and store a X.509 request for a GSI proxy
-/**
- * Returns GRST_RET_OK on success, non-zero otherwise. Request string
- * is PEM encoded, and the key is stored in proxydir as temporary file
- * with a filename like .XXXXXX
- */
-
-int GRSTx509MakeProxyRequest(char **reqtxt, char *proxydir,
- char *delegation_id, char *user_dn)
-{
- int i, fd;
- char *docroot, *reqfile, *prvkeyfile, *ptr;
- size_t ptrlen;
- FILE *fp;
- RSA *keypair;
- X509_NAME *subject;
- X509_NAME_ENTRY *ent;
- EVP_PKEY *pkey;
- X509_REQ *certreq;
- BIO *reqmem;
- const EVP_MD *digest;
- struct stat statbuf;
-
- if ((keypair = RSA_generate_key(GRST_KEYSIZE, 65537, NULL, NULL)) == NULL)
- return 1;
- asprintf(&prvkeyfile, "%s/.XXXXXX", proxydir);
-
- fd = mkstemp(prvkeyfile);
-
- if ((fp = fdopen(fd, "w")) == NULL) return 1;
-
- fprintf(fp, "%s\n%s\n", delegation_id, user_dn);
-
- if (!PEM_write_RSAPrivateKey(fp, keypair, NULL, NULL, 0, NULL, NULL))
- return 1;
-
- if (fclose(fp) != 0) return 1;
-
- /* now create the certificate request */
-
- certreq = X509_REQ_new();
- if (certreq == NULL) return 1;
-
- OpenSSL_add_all_algorithms();
-
- pkey = EVP_PKEY_new();
- EVP_PKEY_assign_RSA(pkey, keypair);
-
- X509_REQ_set_pubkey(certreq, pkey);
-
- subject = X509_NAME_new();
- ent = X509_NAME_ENTRY_create_by_NID(NULL, OBJ_txt2nid("organizationName"),
- MBSTRING_ASC, "Dummy", -1);
- X509_NAME_add_entry (subject, ent, -1, 0);
- X509_REQ_set_subject_name (certreq, subject);
-
- digest = EVP_md5();
- X509_REQ_sign(certreq, pkey, digest);
-
- reqmem = BIO_new(BIO_s_mem());
- PEM_write_bio_X509_REQ(reqmem, certreq);
- ptrlen = BIO_get_mem_data(reqmem, &ptr);
-
- *reqtxt = malloc(ptrlen + 1);
- memcpy(*reqtxt, ptr, ptrlen);
- (*reqtxt)[ptrlen] = '\0';
-
- BIO_free(reqmem);
-
- X509_REQ_free(certreq);
-
- return 0;
-}
-
-/// Create a stack of X509 certificate from a PEM-encoded string
-/**
- * Creates a dynamically allocated stack of X509 certificate objects
- * by walking through the PEM-encoded X509 certificates.
- *
- * Returns GRST_RET_OK on success, non-zero otherwise.
- *
- */
-
-int GRSTx509StringToChain(STACK_OF(X509) **certstack, char *certstring)
-{
- STACK_OF(X509_INFO) *sk=NULL;
- BIO *certbio;
- X509_INFO *xi;
-
- *certstack = sk_X509_new_null();
- if (*certstack == NULL) return GRST_RET_FAILED;
-
- certbio = BIO_new_mem_buf(certstring, -1);
-
- if (!(sk=PEM_X509_INFO_read_bio(certbio, NULL, NULL, NULL)))
- {
- BIO_free(certbio);
- sk_X509_INFO_free(sk);
- sk_X509_free(*certstack);
- return GRST_RET_FAILED;
- }
-
- while (sk_X509_INFO_num(sk))
- {
- xi=sk_X509_INFO_shift(sk);
- if (xi->x509 != NULL)
- {
- sk_X509_push(*certstack, xi->x509);
- xi->x509=NULL;
- }
- X509_INFO_free(xi);
- }
-
- if (!sk_X509_num(*certstack))
- {
- BIO_free(certbio);
- sk_X509_INFO_free(sk);
- sk_X509_free(*certstack);
- return GRST_RET_FAILED;
- }
-
- BIO_free(certbio);
- sk_X509_INFO_free(sk);
-
- return GRST_RET_OK;
-}
-
-/// Return the short file name for the given delegation_id and user_dn
-/**
- * Returns a malloc'd string with the short file name (no paths) that
- * derived from the hashed delegation_id and user_dn
- *
- * File name is SHA1_HASH(DelegationID)+"-"+SHA1_HASH(DN) where DN
- * is DER encoded version of user_dn with any trailing CN=proxy removed
- * Hashes are the most significant 8 bytes, in lowercase hexadecimal.
- */
-
-char *GRSTx509MakeProxyFileName(char *delegation_id,
- STACK_OF(X509) *certstack)
-{
- int i, depth, prevIsCA = 1, IsCA, hash_name_len, delegation_id_len,
- der_name_len;
- unsigned char *der_name, *buf, hash_name[EVP_MAX_MD_SIZE],
- hash_delegation_id[EVP_MAX_MD_SIZE],
- filename[34];
- X509_NAME *subject_name;
- X509 *cert;
- const EVP_MD *m;
- EVP_MD_CTX ctx;
-
- depth = sk_X509_num(certstack);
-
- for (i=depth-1; i >= 0; --i)
- /* loop through the proxy chain starting at CA end */
- {
- if (cert = sk_X509_value(certstack, i))
- {
- IsCA = (GRSTx509IsCA(cert) == GRST_RET_OK);
-
- if (prevIsCA && !IsCA) /* the full certificate of the user */
- {
- break;
- }
- }
- }
-
- if (i < 0) return NULL; /* not found: something wrong with the chain */
-
- if ((subject_name = X509_get_subject_name(cert)) == NULL) return NULL;
-
- der_name_len = i2d_X509_NAME(X509_get_subject_name(cert), NULL);
- if (der_name_len == 0) return NULL;
-
- buf = OPENSSL_malloc(der_name_len);
- der_name = buf;
-
-
- if (!i2d_X509_NAME(X509_get_subject_name(cert), &der_name))
- {
- OPENSSL_free(der_name);
- return NULL;
- }
-
- OpenSSL_add_all_digests();
-
- m = EVP_sha1();
- if (m == NULL)
- {
- OPENSSL_free(der_name);
- return NULL;
- }
-
-
- EVP_DigestInit(&ctx, m);
- EVP_DigestUpdate(&ctx, delegation_id, strlen(delegation_id));
- EVP_DigestFinal(&ctx, hash_delegation_id, &delegation_id_len);
-
- /* lots of nasty hard coded numbers:
- "8bytes/16chars delegation ID" + "-" + "8bytes/16chars DN" */
-
- for (i=0; i <=7; ++i)
- sprintf(&filename[i*2], "%02x", hash_delegation_id[i]);
-
- filename[16] = '-';
-
-
-
- EVP_DigestInit(&ctx, m);
- EVP_DigestUpdate(&ctx, buf, der_name_len);
- EVP_DigestFinal(&ctx, hash_name, &hash_name_len);
-
- for (i=0; i <=7; ++i)
- sprintf(&filename[17 + i*2], "%02x", hash_name[i]);
-
- return strdup(filename);
-}
-
-/// Store a GSI proxy chain in the proxy cache, along with the private key
-/**
- * Returns GRST_RET_OK on success, non-zero otherwise. The existing
- * private key with the same delegation ID and user DN is appended to
- * make a valid proxy file, and the temporary private key file deleted.
- */
-
-int GRSTx509CacheProxy(char *proxydir, char *delegation_id,
- char *user_dn, char *proxychain)
-{
- int c, len = 0, i;
- char *upcertfile, *upcertpath, *prvkeyfile, *p, *ptr;
- FILE *ifp, *ofp;
- STACK_OF(X509) *certstack;
- BIO *certmem;
- X509 *cert;
- long ptrlen;
-
- prvkeyfile = GRSTx509CachedProxyKeyFind(proxydir, delegation_id, user_dn);
-
- if (prvkeyfile == NULL)
- {
- return GRST_RET_FAILED;
- }
-
- if ((ifp = fopen(prvkeyfile, "r")) == NULL)
- {
- free(prvkeyfile);
- return GRST_RET_FAILED;
- }
-
-// fprintf(stderr, "\n\n\n\n PROXYCHAIN = \n %s", proxychain);
- if (GRSTx509StringToChain(&certstack, proxychain) != GRST_RET_OK)
- return GRST_RET_FAILED;
-
- upcertfile = GRSTx509MakeProxyFileName(delegation_id, certstack);
-
- if (upcertfile == NULL)
- {
- free(prvkeyfile);
- sk_X509_free(certstack);
- return GRST_RET_FAILED;
- }
-
- asprintf(&upcertpath, "%s/%s", proxydir, upcertfile);
- ofp = fopen(upcertpath, "w");
- chmod(upcertpath, S_IRUSR | S_IWUSR);
- free(upcertpath);
-
- if (ofp == NULL)
- {
- fclose(ifp);
- free(prvkeyfile);
- free(upcertfile);
- return GRST_RET_FAILED;
- }
-
- fprintf(ofp, "%s\n%s\n", delegation_id, user_dn);
-
- /* write out the most recent proxy by itself */
-
- if (cert = sk_X509_value(certstack, 0))
- {
- certmem = BIO_new(BIO_s_mem());
- if (PEM_write_bio_X509(certmem, cert) == 1)
- {
- ptrlen = BIO_get_mem_data(certmem, &ptr);
- fwrite(ptr, 1, ptrlen, ofp);
- }
-
- BIO_free(certmem);
- }
-
- /* insert proxy private key */
-
- while ((c = fgetc(ifp)) != EOF) fputc(c, ofp);
- unlink(prvkeyfile);
- free(prvkeyfile);
-
- for (i=1; i <= sk_X509_num(certstack) - 1; ++i)
- /* loop through the proxy chain starting at 2nd most recent proxy */
- {
- if (cert = sk_X509_value(certstack, i))
- {
- certmem = BIO_new(BIO_s_mem());
- if (PEM_write_bio_X509(certmem, cert) == 1)
- {
- ptrlen = BIO_get_mem_data(certmem, &ptr);
- fwrite(ptr, 1, ptrlen, ofp);
- }
-
- BIO_free(certmem);
- }
- }
-
- fputs(proxychain, ofp); /* write out certificates */
-
-
- sk_X509_free(certstack);
- free(upcertfile);
-
- if (fclose(ifp) != 0) return GRST_RET_FAILED;
- if (fclose(ofp) != 0) return GRST_RET_FAILED;
-
-/* should also check validity of proxy cert to avoid suprises? */
-
- return GRST_RET_OK;
-}
+++ /dev/null
-/*
- Andrew McNab and Shiv Kaushal, University of Manchester.
- Copyright (c) 2002-3. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-/*------------------------------------------------------------------------*
- * For more information about GridSite: http://www.gridpp.ac.uk/gridsite/ *
- *------------------------------------------------------------------------*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <dirent.h>
-#include <ctype.h>
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#include <fnmatch.h>
-
-#include <libxml/xmlmemory.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-
-#include "gridsite.h"
-
-//#define XACML_DEBUG
-
-#ifdef XACML_DEBUG
- #define XACML_DEBUG_FILE "/tmp/grstxacmldebug.out"
-#endif
-
-
-/* *
- * Global variables, shared by all GACL functions by private to libgacl *
- * */
-
-extern char *grst_perm_syms[];
-extern GRSTgaclPerm grst_perm_vals[];
-
-
-FILE* debugfile;
-
-GRSTgaclAcl *GRSTgaclAclParse(xmlDocPtr, xmlNodePtr, GRSTgaclAcl *);
-GRSTgaclAcl *GRSTxacmlAclParse(xmlDocPtr, xmlNodePtr, GRSTgaclAcl *);
-
-/* *
- * Functions to read in XACML 1.1 compliant format ACL *
- * Functions based on method for opening GACL format *
- * */
-
-// need to check these for libxml memory leaks? - what needs to be freed?
-
-
-static GRSTgaclCred *GRSTxacmlCredParse(xmlNodePtr cur)
-/*
- GRSTxacmlCredParse - parse a credential stored in the libxml structure cur,
- returning it as a pointer or NULL on error.
-*/
-{
- xmlNodePtr attr_val;
- xmlNodePtr attr_des;
- GRSTgaclCred *cred;
-
- // cur points to <Subject> or <AnySubjects/>, loop done outside this function.
-
- if ( (xmlStrcmp(cur->name, (const xmlChar *) "AnySubject") == 0)) cred = GRSTgaclCredNew("any-user");
-
- else{
-
- attr_val=cur->xmlChildrenNode->xmlChildrenNode;
- attr_des=attr_val->next;
-
- cred = GRSTgaclCredNew((char *) xmlNodeGetContent(attr_des->properties->children));
-
- cred->firstname = NULL;
- cred->next = NULL;
-
- //Assumed that there is only one name/value pair per credential
- GRSTgaclCredAddValue(cred, (char *) xmlNodeGetContent(attr_des->properties->next->children),
- (char *) xmlNodeGetContent(attr_val));
- }
-
- return cred;
-}
-
-static GRSTgaclEntry *GRSTxacmlEntryParse(xmlNodePtr cur)
-/*
- GRSTxacmlEntryParse - parse an entry stored in the libxml structure cur,
- returning it as a pointer or NULL on error. Also checks to see if the following
- <Rule> tag refers to the same <Target> by checking the <RuleId> of both
-*/
-{
- int i, check=0;
- xmlDocPtr doc=cur->doc;
- xmlNodePtr cur2;
- xmlNodePtr rule_root=cur;
- GRSTgaclEntry *entry;
- GRSTgaclCred *cred;
- GRSTgaclPerm perm;
-
-
- // Next line not needed as function only called if <Rule> tag found
- // if (xmlStrcmp(cur->name, (const xmlChar *) "Rule") != 0) return NULL;
- // cur and rule_root point to the <Rule> tag
-
- cur = cur->xmlChildrenNode->xmlChildrenNode;
- // cur should now be pointing at <Subjects> tag
-#ifdef XACML_DEBUG
- fprintf (debugfile, "Starting to Parse Entry\n");
-#endif
- entry = GRSTgaclEntryNew();
-
- while (cur!=NULL){
-
- if (xmlStrcmp(cur->name, (const xmlChar *) "Subjects") == 0){
-#ifdef XACML_DEBUG
- fprintf (debugfile, "Starting to Parse Credentials\n");
-#endif
- if (check==0){
- // cur still pointing at <Subjects> tag make cur2 point to <Subject> and loop over them.
- cur2=cur->xmlChildrenNode;
- while (cur2!=NULL){
- if ( ((cred = GRSTxacmlCredParse(cur2)) != NULL) && (!GRSTgaclEntryAddCred(entry, cred))){
- GRSTgaclCredFree(cred);
- GRSTgaclEntryFree(entry);
- return NULL;
- }
- cur2=cur2->next;
- }
- }
- }
-
- else if (xmlStrcmp(cur->name, (const xmlChar *) "Actions") == 0){
-#ifdef XACML_DEBUG
- fprintf (debugfile, "Starting to Parse Permissions\n");
-#endif
- if (xmlStrcmp(xmlNodeGetContent(rule_root->properties->next->children), (const xmlChar *) "Permit") == 0 ){
-#ifdef XACML_DEBUG
- fprintf (debugfile, "\tPermit-ed actions: ");
-#endif
- for (cur2 = cur->xmlChildrenNode; cur2 != NULL; cur2=cur2->next) //cur2-><Action>
- for (i=0; grst_perm_syms[i] != NULL; ++i)
- if (xmlStrcmp(xmlNodeGetContent(cur2->xmlChildrenNode->xmlChildrenNode), (const xmlChar *) grst_perm_syms[i]) == 0)
- {
-#ifdef XACML_DEBUG
- fprintf (debugfile, "%s ", grst_perm_syms[i]);
-#endif
- GRSTgaclEntryAllowPerm(entry, grst_perm_vals[i]);
- }
- }
-
- if (xmlStrcmp(xmlNodeGetContent(rule_root->properties->next->children), (const xmlChar *) "Deny") == 0 ) {
-#ifdef XACML_DEBUG
- fprintf (debugfile, "\tDeny-ed actions: ");
-#endif
- for (cur2 = cur->xmlChildrenNode; cur2 != NULL; cur2=cur2->next) //cur2-><Action>
- for (i=0; grst_perm_syms[i] != NULL; ++i)
- if (xmlStrcmp(xmlNodeGetContent(cur2->xmlChildrenNode->xmlChildrenNode), (const xmlChar *) grst_perm_syms[i]) == 0)
- {
-
-#ifdef XACML_DEBUG
- fprintf (debugfile, "%s ", grst_perm_syms[i]);
-#endif
- GRSTgaclEntryDenyPerm(entry, grst_perm_vals[i]);
- }
- }
-
- }
- else{ // I cannot parse this - give up rather than get it wrong
-#ifdef XACML_DEBUG
- fprintf (debugfile, "OOOPSIE\n");
-#endif
- GRSTgaclEntryFree(entry);
- return NULL;
- }
-
- cur=cur->next;
-
- // Check if next Rule should be included when end of current rule reached
- // If RuleId are from the same entry (eg Entry1A and Entry1D)
- // make cur point to the next Rule's <Subjects> tag
- if (cur==NULL)
- if (check==0)
- if (rule_root->next!=NULL)
- if ( strncmp(xmlNodeGetContent(rule_root->properties->children), // RuleId of this Rule
- xmlNodeGetContent(rule_root->next->properties->children), // RuleId of next Rule
- 6) == 0){
-#ifdef XACML_DEBUG
- fprintf (debugfile, "End of perms and creds, next is %s \n", xmlNodeGetContent(rule_root->next->properties->children));
-#endif
- rule_root=rule_root->next;
- cur=rule_root->xmlChildrenNode->xmlChildrenNode;
-#ifdef XACML_DEBUG
- fprintf (debugfile, "skipped to <%s> tag of next Rule\n", cur->name);
-#endif
- check++;
- }
- }
-
- return entry;
-}
-
-GRSTgaclAcl *GRSTxacmlAclLoadFile(char *filename)
-{
-xmlDocPtr doc;
- xmlNodePtr cur;
- GRSTgaclAcl *acl;
-
- doc = xmlParseFile(filename);
- if (doc == NULL) return NULL;
-
- cur = xmlDocGetRootElement(doc);
- if (cur == NULL) return NULL;
-
- if (!xmlStrcmp(cur->name, (const xmlChar *) "Policy")) { acl=GRSTxacmlAclParse(doc, cur, acl);}
- else if (!xmlStrcmp(cur->name, (const xmlChar *) "gacl")) {acl=GRSTgaclAclParse(doc, cur, acl);}
- else /* ACL format not recognised */
- {
- free(doc);
- free(cur);
- return NULL;
- }
-
- xmlFreeDoc(doc);
- return acl;
-}
-
-GRSTgaclAcl *GRSTxacmlAclParse(xmlDocPtr doc, xmlNodePtr cur, GRSTgaclAcl *acl)
-{
- GRSTgaclEntry *entry;
-
- #ifdef XACML_DEBUG
- debugfile=fopen(XACML_DEBUG_FILE, "w");
- fprintf (debugfile, "ACL loaded..\n");
- fprintf (debugfile, "Parsing XACML\n");
- #endif
-
- // Have an XACML policy file.
- // Skip <Target> tag and set cur to first <Rule> tag
- cur = cur->xmlChildrenNode->next;
-
- acl = GRSTgaclAclNew();
-
- while (cur != NULL){
-
- if ( !xmlStrcmp(cur->name, (const xmlChar *)"Rule") )
- { // IF statement not needed?
- #ifdef XACML_DEBUG
- fprintf (debugfile, "Rule %s found\n", xmlNodeGetContent(cur->properties->children) );
- fprintf (debugfile, "Parsing Entry for this rule\n");
- #endif
- entry = GRSTxacmlEntryParse(cur);
-
- if (entry == NULL)
- {
- GRSTgaclAclFree(acl);
- xmlFreeDoc(doc);
- return NULL;
- }
- else GRSTgaclAclAddEntry(acl, entry);
-
- #ifdef XACML_DEBUG
- fprintf (debugfile, "Entry read in\n\n");
- #endif
- }
-
- // If the current and next Rules are part of the same entry then advance two Rules
- // If not then advance 1
- if (cur->next != NULL)
- {
- if ( strncmp(xmlNodeGetContent(cur->properties->children), // RuleId of this Rule
- xmlNodeGetContent(cur->next->properties->children), // RuleId of next Rule
- 6) == 0)
- {
- #ifdef XACML_DEBUG
- fprintf (debugfile, "skipping next rule %s, should have been caught previously\n\n", xmlNodeGetContent(cur->next->properties->children) );
- #endif
- cur=cur->next;
- } // Check first 6 characters i.e. Entry1**/
- }
-
- cur=cur->next;
-
- }
-
- #ifdef XACML_DEBUG
- fprintf (debugfile, "Finished loading ACL - Fanfare!\n");
- fclose(debugfile);
- #endif
-
- return acl;
-}
-
-
-int GRSTxacmlFileIsAcl(char *pathandfile)
-/* Return 1 if filename in *pathandfile starts GRST_ACL_FILE
- Return 0 otherwise. */
-{
- char *filename;
-
- filename = rindex(pathandfile, '/');
- if (filename == NULL) filename = pathandfile;
- else filename++;
-
- return (strncmp(filename, GRST_ACL_FILE, sizeof(GRST_ACL_FILE) - 1) == 0);
-}
-
-char *GRSTxacmlFileFindAclname(char *pathandfile)
-/* Return malloc()ed ACL filename that governs the given file or directory
- (for directories, the ACL file is in the directory itself), or NULL if none
- can be found. */
-{
- char *path, *p;
- struct stat statbuf;
-
- path = malloc(strlen(pathandfile) + sizeof(GRST_ACL_FILE) + 1);
- strcpy(path, pathandfile);
-
- if (stat(path, &statbuf) == 0)
- {
- if (!S_ISDIR(statbuf.st_mode)) /* can strip this / off straightaway */
- {
- p = rindex(path, '/');
- if (p != NULL) *p = '\0';
- }
- }
-
- while (path[0] != '\0')
- {
- strcat(path, "/");
- strcat(path, GRST_ACL_FILE);
-
- if (stat(path, &statbuf) == 0) return path;
-
- p = rindex(path, '/');
- *p = '\0'; /* strip off the / we added for ACL */
-
- p = rindex(path, '/');
- if (p == NULL) break; /* must start without / and we there now ??? */
-
- *p = '\0'; /* strip off another layer of / */
- }
-
- free(path);
- return NULL;
-}
-
-GRSTgaclAcl *GRSTxacmlAclLoadforFile(char *pathandfile)
-/* Return ACL that governs the given file or directory (for directories,
- the ACL file is in the directory itself.) */
-{
- char *path;
- GRSTgaclAcl *acl;
-
- path = GRSTxacmlFileFindAclname(pathandfile);
-
- if (path != NULL)
- {
- acl = GRSTxacmlAclLoadFile(path);
- free(path);
- return acl;
- }
-
- return NULL;
-}
-
-
-
-/* *
- * Functions to save ACL in XACML 1.1 compliant format *
- * Functions based on method for saving to GACL format *
- * */
-
-
-int GRSTxacmlCredPrint(GRSTgaclCred *cred, FILE *fp)
-/*
- GRSTxacmlCredPrint - print a credential and any name-value pairs is contains in XACML form
-*/
-{
- char *q;
- GRSTgaclNamevalue *p;
-
- if (cred->firstname != NULL)
- {
-
- p = cred->firstname;
-
- do {
-
- fputs("\t\t\t\t<Subject>\n", fp);
- fputs("\t\t\t\t\t<SubjectMatch MatchId=\"urn:oasis:names:tc:xacml:1.0:function:string-equal\">\n", fp);
- fputs("\t\t\t\t\t\t<AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">", fp);
- for (q=p->value; *q != '\0'; ++q)
- if (*q == '<') fputs("<", fp);
- else if (*q == '>') fputs(">", fp);
- else if (*q == '&') fputs("&" , fp);
- else if (*q == '\'') fputs("'", fp);
- else if (*q == '"') fputs(""", fp);
- else fputc(*q, fp);
-
-
- fputs("</AttributeValue>\n", fp);
-
- fputs("\t\t\t\t\t\t<SubjectAttributeDesignator\n", fp);
- fputs("\t\t\t\t\t\t\tAttributeId=", fp);
- fprintf(fp, "\"%s\"\n", cred->type);
- fputs("\t\t\t\t\t\t\tDataType=", fp);
- fprintf(fp, "\"%s\"/>\n", p->name);
- fputs("\t\t\t\t\t</SubjectMatch>\n", fp);
- fputs("\t\t\t\t</Subject>\n", fp);
- p = (GRSTgaclNamevalue *) p->next;
- } while (p != NULL);
-
- }
- else fputs("\t\t\t\t<AnySubject/>\n", fp);
-
- return 1;
-}
-
-
-int GRSTxacmlEntryPrint(GRSTgaclEntry *entry, FILE *fp, int rule_number)
-{
- GRSTgaclCred *cred;
- GRSTgaclPerm i;
-
- if (entry->allowed){
-
- fprintf(fp, "\t<Rule RuleId=\"Entry%dA\" Effect=\"Permit\">\n", rule_number);
- fputs("\t\t<Target>\n", fp);
- fputs("\t\t\t<Subjects>\n", fp);
-
- for (cred = entry->firstcred; cred != NULL; cred = cred->next)
- GRSTxacmlCredPrint(cred, fp);
-
- fputs("\t\t\t</Subjects>\n", fp);
- fputs("\t\t\t<Actions>\n", fp);
-
- for (i=GRST_PERM_READ; i <= GRST_PERM_ADMIN; ++i)
- if ((entry->allowed) & i) GRSTxacmlPermPrint(i, fp);
-
- fputs("\t\t\t</Actions>\n", fp);
- fputs("\t\t</Target>\n", fp);
- fputs("\t</Rule>\n", fp);
- }
-
- if (entry->denied){
-
- fprintf(fp, "\t<Rule RuleId=\"Entry%dD\" Effect=\"Deny\">\n", rule_number);
- fputs("\t\t<Target>\n", fp);
- fputs("\t\t\t<Subjects>\n", fp);
-
- for (cred = entry->firstcred; cred != NULL; cred = cred->next)
- GRSTxacmlCredPrint(cred, fp);
-
- fputs("\t\t\t</Subjects>\n", fp);
- fputs("\t\t\t<Actions>\n", fp);
-
- for (i=GRST_PERM_READ; i <= GRST_PERM_ADMIN; ++i)
- if (entry->denied & i) GRSTxacmlPermPrint(i, fp);
-
- fputs("\t\t\t</Actions>\n", fp);
- fputs("\t\t</Target>\n", fp);
- fputs("\t</Rule>\n", fp);
- }
- return 1;
-}
-
-
-int GRSTxacmlPermPrint(GRSTgaclPerm perm, FILE *fp)
-{
- GRSTgaclPerm i;
-
- for (i=GRST_PERM_READ; grst_perm_syms[i] != NULL; ++i)
- if (perm == grst_perm_vals[i])
- {
-
- fputs("\t\t\t\t<Action>\n", fp);
- fputs("\t\t\t\t\t<ActionMatch MatchId=\"urn:oasis:names:tc:xacml:1.0:function:string-equal\">\n", fp);
- fputs("\t\t\t\t\t\t<AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">", fp);
- fprintf(fp, "%s", grst_perm_syms[i]);
- fputs("</AttributeValue>\n", fp);
- fputs("\t\t\t\t\t\t<ActionAttributeDesignator\n", fp);
- fputs("\t\t\t\t\t\t\tAttributeId=\"urn:oasis:names:tc:xacml:1.0:action:action-id\"\n", fp);
- fputs("\t\t\t\t\t\t\tDataType=\"http://www.w3.org/2001/XMLSchema#string\"/>\n", fp);
- fputs("\t\t\t\t\t</ActionMatch>\n", fp);
- fputs("\t\t\t\t</Action>\n",fp);
-
- return 1;
- }
-
- return 0;
-}
-
-int GRSTxacmlAclPrint(GRSTgaclAcl *acl, FILE *fp, char* dir_uri)
-{
- GRSTgaclEntry *entry;
- int rule_number=1;
-
- fputs("<Policy", fp);
- fputs("\txmlns=\"urn:oasis:names:tc:xacml:1.0:policy\"\n", fp);
- fputs("\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n", fp);
- fputs("\txsi:schemaLocation=\"urn:oasis:names:tc:xacml:1.0:policy cs-xacml-schema-policy-01.xsd\"\n", fp);
- fputs("\tPolicyId=\"GridSitePolicy\"\n", fp);
- fputs("\tRuleCombiningAlgId=\"urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:deny-overrides\">\n\n", fp);
-
- fputs("\t<Target>\n\t\t<Resources>\n\t\t\t<Resource>\n", fp);
- fputs("\t\t\t\t<ResourceMatch MatchId=\"urn:oasis:names:tc:xacml:1.0:function:string-equal\">\n", fp);
- fputs("\t\t\t\t\t<AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">", fp);
- fprintf(fp, "%s", dir_uri);
- fputs("</AttributeValue>\n", fp);
- fputs("\t\t\t\t\t<ResourceAttributeDesignator\n", fp);
- fputs("\t\t\t\t\t\tAttributeId=\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\"\n", fp);
- fputs("\t\t\t\t\t\tDataType=\"http://www.w3.org/2001/XMLSchema#string\"/>\n", fp);
-
- fputs("\t\t\t\t</ResourceMatch>\n\t\t\t</Resource>\n\t\t</Resources>\n\t\t<Subjects>\n\t\t\t<AnySubject/>\n\t\t</Subjects>", fp);
- fputs("\n\t\t<Actions>\n\t\t\t<AnyAction/>\n\t\t</Actions>\n\t</Target>\n\n", fp);
-
- for (entry = acl->firstentry; entry != NULL; entry = entry->next){
-
- GRSTxacmlEntryPrint(entry, fp, rule_number);
- rule_number++;
- }
-
- fputs("</Policy>\n", fp);
-
- return 1;
-}
-
-int GRSTxacmlAclSave(GRSTgaclAcl *acl, char *filename, char* dir_uri)
-{
- int ret;
- FILE *fp;
-
- fp = fopen(filename, "w");
- if (fp == NULL) return 0;
-
- fprintf(fp,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
-
- ret = GRSTxacmlAclPrint(acl, fp, dir_uri);
-
- fclose(fp);
-
- return ret;
-}
-
-
-
-
+++ /dev/null
-/* Copyright 1999-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * suexec.c -- "Wrapper" support program for suEXEC behaviour for Apache
- *
- ***********************************************************************
- *
- * NOTE! : DO NOT edit this code!!! Unless you know what you are doing,
- * editing this code might open up your system in unexpected
- * ways to would-be crackers. Every precaution has been taken
- * to make this code as safe as possible; alter it at your own
- * risk.
- *
- ***********************************************************************
- *
- *
- */
-
-#include "apr.h"
-#include "apr_file_io.h"
-#include "ap_config.h"
-#include "gsexec.h"
-
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <string.h>
-#include <time.h>
-#if APR_HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-
-#ifdef HAVE_GRP_H
-#include <grp.h>
-#endif
-
-/*
- ***********************************************************************
- * There is no initgroups() in QNX, so I believe this is safe :-)
- * Use cc -osuexec -3 -O -mf -DQNX suexec.c to compile.
- *
- * May 17, 1997.
- * Igor N. Kovalenko -- infoh mail.wplus.net
- ***********************************************************************
- */
-
-#if defined(NEED_INITGROUPS)
-int initgroups(const char *name, gid_t basegid)
-{
- /* QNX and MPE do not appear to support supplementary groups. */
- return 0;
-}
-#endif
-
-#if defined(SUNOS4)
-extern char *sys_errlist[];
-#define strerror(x) sys_errlist[(x)]
-#endif
-
-#if defined(PATH_MAX)
-#define AP_MAXPATH PATH_MAX
-#elif defined(MAXPATHLEN)
-#define AP_MAXPATH MAXPATHLEN
-#else
-#define AP_MAXPATH 8192
-#endif
-
-#define AP_ENVBUF 256
-
-extern char **environ;
-static FILE *log = NULL;
-
-char *safe_env_lst[] =
-{
- /* variable name starts with */
- "HTTP_",
- "SSL_",
- "GRST_",
-
- /* variable name is */
- "AUTH_TYPE=",
- "CONTENT_LENGTH=",
- "CONTENT_TYPE=",
- "DATE_GMT=",
- "DATE_LOCAL=",
- "DOCUMENT_NAME=",
- "DOCUMENT_PATH_INFO=",
- "DOCUMENT_ROOT=",
- "DOCUMENT_URI=",
- "GATEWAY_INTERFACE=",
- "HTTPS=",
- "LAST_MODIFIED=",
- "PATH_INFO=",
- "PATH_TRANSLATED=",
- "QUERY_STRING=",
- "QUERY_STRING_UNESCAPED=",
- "REMOTE_ADDR=",
- "REMOTE_HOST=",
- "REMOTE_IDENT=",
- "REMOTE_PORT=",
- "REMOTE_USER=",
- "REDIRECT_HANDLER=",
- "REDIRECT_QUERY_STRING=",
- "REDIRECT_REMOTE_USER=",
- "REDIRECT_STATUS=",
- "REDIRECT_URL=",
- "REQUEST_METHOD=",
- "REQUEST_URI=",
- "SCRIPT_FILENAME=",
- "SCRIPT_NAME=",
- "SCRIPT_URI=",
- "SCRIPT_URL=",
- "SERVER_ADMIN=",
- "SERVER_NAME=",
- "SERVER_ADDR=",
- "SERVER_PORT=",
- "SERVER_PROTOCOL=",
- "SERVER_SIGNATURE=",
- "SERVER_SOFTWARE=",
- "UNIQUE_ID=",
- "USER_NAME=",
- "TZ=",
- NULL
-};
-
-
-static void err_output(int is_error, const char *fmt, va_list ap)
-{
-#ifdef AP_LOG_EXEC
- time_t timevar;
- struct tm *lt;
-
- if (!log) {
- if ((log = fopen(AP_LOG_EXEC, "a")) == NULL) {
- fprintf(stderr, "suexec failure: could not open log file\n");
- perror("fopen");
- exit(1);
- }
- }
-
- if (is_error) {
- fprintf(stderr, "suexec policy violation: see suexec log for more "
- "details\n");
- }
-
- time(&timevar);
- lt = localtime(&timevar);
-
- fprintf(log, "[%d-%.2d-%.2d %.2d:%.2d:%.2d]: ",
- lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday,
- lt->tm_hour, lt->tm_min, lt->tm_sec);
-
- vfprintf(log, fmt, ap);
-
- fflush(log);
-#endif /* AP_LOG_EXEC */
- return;
-}
-
-static void log_err(const char *fmt,...)
-{
-#ifdef AP_LOG_EXEC
- va_list ap;
-
- va_start(ap, fmt);
- err_output(1, fmt, ap); /* 1 == is_error */
- va_end(ap);
-#endif /* AP_LOG_EXEC */
- return;
-}
-
-static void log_no_err(const char *fmt,...)
-{
-#ifdef AP_LOG_EXEC
- va_list ap;
-
- va_start(ap, fmt);
- err_output(0, fmt, ap); /* 0 == !is_error */
- va_end(ap);
-#endif /* AP_LOG_EXEC */
- return;
-}
-
-static void clean_env(void)
-{
- char pathbuf[512];
- char **cleanenv;
- char **ep;
- int cidx = 0;
- int idx;
-
- /* While cleaning the environment, the environment should be clean.
- * (e.g. malloc() may get the name of a file for writing debugging info.
- * Bad news if MALLOC_DEBUG_FILE is set to /etc/passwd. Sprintf() may be
- * susceptible to bad locale settings....)
- * (from PR 2790)
- */
- char **envp = environ;
- char *empty_ptr = NULL;
-
- environ = &empty_ptr; /* VERY safe environment */
-
- if ((cleanenv = (char **) calloc(AP_ENVBUF, sizeof(char *))) == NULL) {
- log_err("failed to malloc memory for environment\n");
- exit(120);
- }
-
- sprintf(pathbuf, "PATH=%s", AP_SAFE_PATH);
- cleanenv[cidx] = strdup(pathbuf);
- cidx++;
-
- for (ep = envp; *ep && cidx < AP_ENVBUF-1; ep++) {
- for (idx = 0; safe_env_lst[idx]; idx++) {
- if (!strncmp(*ep, safe_env_lst[idx],
- strlen(safe_env_lst[idx]))) {
- cleanenv[cidx] = *ep;
- cidx++;
- break;
- }
- }
- }
-
- cleanenv[cidx] = NULL;
-
- environ = cleanenv;
-}
-
-/* Pool account functions */
-
-
-#include <utime.h>
-#include <errno.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <pwd.h>
-#include <sys/types.h>
-
-/******************************************************************************
-Function: mapdir_otherlink
-Description:
- find another link in map directory to the same inode as firstlink
- and change the modification time of firstlink to now (so that we
- always know when this pair was last used)
-
-Parameters:
- firstlink, the filename of the link we already know
-
-Returns:
- a pointer to the other link's filename (without path) or NULL if none
- found (this is malloc'd and will need freeing)
-
-******************************************************************************/
-static char *mapdir_otherlink(char *mapdir, char *firstlink)
-{
- int ret;
- char *firstlinkpath, *otherlinkdup, *otherlinkpath;
- struct dirent *mapdirentry;
- DIR *mapdirstream;
- struct stat statbuf;
- ino_t firstinode;
-
- firstlinkpath = malloc(strlen(mapdir) + 2 + strlen(firstlink));
- sprintf(firstlinkpath, "%s/%s", mapdir, firstlink);
- ret = stat(firstlinkpath, &statbuf);
- free(firstlinkpath);
- if (ret != 0) return NULL;
- if (statbuf.st_nlink != 2) return NULL;
-
- firstinode = statbuf.st_ino; /* save for comparisons */
-
- mapdirstream = opendir(mapdir);
-
- if (mapdirstream != NULL)
- {
- while ((mapdirentry = readdir(mapdirstream)) != NULL)
- {
- if (strcmp(mapdirentry->d_name, firstlink) == 0) continue;
-
- otherlinkpath = malloc(strlen(mapdir) + 2 +
- strlen(mapdirentry->d_name));
- sprintf(otherlinkpath, "%s/%s", mapdir,
- mapdirentry->d_name);
-
- ret = stat(otherlinkpath, &statbuf);
- if ((ret == 0) && (statbuf.st_ino == firstinode))
- {
- utime(otherlinkpath, (struct utimbuf *) NULL);
- free(otherlinkpath);
- otherlinkdup = strdup(mapdirentry->d_name);
- closedir(mapdirstream);
- return otherlinkdup;
- }
- else free(otherlinkpath);
- }
-
- closedir(mapdirstream);
- }
-
- return NULL;
-}
-
-/******************************************************************************
-Function: mapdir_urlencode
-Description:
- Convert string to URL encoded and return pointer to the encoded
- version, obtained through malloc. Calling routine must free
- this. Here "URL encoded" means anything other than an isalnum()
- goes to %HH where HH is its ascii value in hex; also A-Z => a-z
- This name is suitable for filenames since no / or spaces.
-
-Parameters:
- rawstring, the string to be converted
-
-Returns:
- a pointer to the encoded string or NULL if the malloc failed
-
-******************************************************************************/
-static char *mapdir_urlencode(char *rawstring)
-{
- int encodedchar = 0, rawchar = 0;
- char * encodedstring;
-
- encodedstring = (char *) malloc(3 * strlen(rawstring) + 1);
-
- if (encodedstring == NULL) return (char *) NULL;
-
- while (rawstring[rawchar] != '\0')
- {
- if (isalnum(rawstring[rawchar]))
- {
- encodedstring[encodedchar] = tolower(rawstring[rawchar]);
- ++rawchar;
- ++encodedchar;
- }
- else
- {
- sprintf(&encodedstring[encodedchar], "%%%02x",
- rawstring[rawchar]);
- ++rawchar;
- encodedchar = encodedchar + 3;
- }
- }
-
- encodedstring[encodedchar] = '\0';
-
- return encodedstring;
-}
-
-/******************************************************************************
-Function: mapdir_newlease
-Description:
- Search for an unleased local username to give to the X.509 DN or
- directory key corresponding to encodedfilename, and then lease it.
-
-Parameters:
- encodedfilename, URL-encoded X.509 DN or directory key to associate
- with an unlease pool username
-
-Returns:
- no return value
-******************************************************************************/
-
-void mapdir_newlease(char *mapdir, char *encodedkey)
-{
- int ret;
- char *userfilename, *encodedfilename;
- struct dirent *mapdirentry;
- DIR *mapdirstream;
- struct stat statbuf;
-
- encodedfilename = malloc(strlen(mapdir) + (size_t) 2 +
- strlen(encodedkey));
- sprintf(encodedfilename, "%s/%s", mapdir, encodedkey);
-
- mapdirstream = opendir(mapdir);
-
- while ((mapdirentry = readdir(mapdirstream)) != NULL)
- {
- /* we dont want any files that dont look like acceptable usernames */
- if ((*(mapdirentry->d_name) == '%') ||
- (strcmp(mapdirentry->d_name, "root") == 0)) continue;
- else if (*(mapdirentry->d_name) == '.') continue;
- else if (index(mapdirentry->d_name, '~') != NULL) continue;
-
- userfilename = malloc(strlen(mapdir) + (size_t) 2 +
- strlen(mapdirentry->d_name));
- sprintf(userfilename, "%s/%s", mapdir, mapdirentry->d_name);
- stat(userfilename, &statbuf);
-
- if (statbuf.st_nlink == 1) /* this one isnt leased yet */
- {
- ret = link(userfilename, encodedfilename);
- free(userfilename);
- if (ret != 0)
- {
- /* link failed: this is probably because a VERY lucky
- other process has obtained a lease for encodedfilename
- while we were faffing around */
- closedir(mapdirstream);
- free(encodedfilename);
- return;
- }
-
- stat(encodedfilename, &statbuf);
- if (statbuf.st_nlink > 2)
- {
- /* two keys have grabbed the same username: back off */
- unlink(encodedfilename);
- continue;
- }
-
- closedir(mapdirstream);
- free(encodedfilename);
- return; /* link worked ok, so return */
- }
- else free(userfilename); /* already in use, try next one */
- }
-
- closedir(mapdirstream);
- free(encodedfilename);
- return; /* no unleased names left: give up */
-}
-
-/******************************************************************************
-Based on gridmapdir_userid:
-
-Function: gridmapdir_userid
-Description:
- This is equivalent to globus_gss_assist_gridmap but for the dynamic
- user ids in the gridmapdir: maps a globusID to a local unix user id,
- either one already leased, or calls gridmapdir_newlease() to obtain
- a new lease. This is called by globus_gss_assist_gridmap if the
- local user id in the static gridmap file begins . (for a dynamic id)
-
-Parameters:
- globusidp, globus client name who requested authentication
- usernameprefix, prefix of the local usernames which would
- be acceptable (or "\0" )
- *userid returned userid name for local system.
-
-Returns:
-
- 0 on success
- !=0 on failure
-
-******************************************************************************/
-
-
-
-int GRSTexecGetMapping(char **target_uname, char **target_gname,
- char *mapdir, char *key)
-{
- char *encodedkey;
- struct passwd *pw = NULL;
-
- if (key[0] != '/') return 1; /* must be a proper X.509 DN or path */
-
- encodedkey = mapdir_urlencode(key);
- *target_uname = mapdir_otherlink(mapdir, encodedkey);
-
- if (*target_uname == NULL) /* maybe no lease yet */
- {
- mapdir_newlease(mapdir, encodedkey);
- /* try making a lease */
-
- *target_uname = mapdir_otherlink(mapdir, encodedkey);
- /* check if there is a now a lease - possibly made by someone else */
-
- if (*target_uname == NULL)
- {
- free(encodedkey);
- return 1; /* still no good */
- }
- }
-
- free(encodedkey);
-
- /*
- * Get the group name of target user.
- (Contributed by Gerben Venekamp venekamp@nikhef.nl )
- */
-
- if ((pw = getpwnam(*target_uname)) != NULL)
- {
- struct group grp = { NULL, NULL, -1, NULL };
- struct group *tst = NULL;
- char tmp_buf[100];
-
- /*
- * NOTE: Do not use the getgrgid() function call! Calling this function
- * will overwrite the contents of the internal buffer associated with
- * this call. Hence, further down the execution path we will run into
- * a wall, head first; simply because the guid has changed to that of
- * the targer uid. The only solution out of the situation is avoiding
- * the function call and manage the needed buffers ourselves.
- */
-
- switch (getgrgid_r(pw->pw_gid, &grp, tmp_buf, sizeof(tmp_buf), &tst))
- {
- case 0: /* no error */
- *target_gname = strdup(grp.gr_name);
- break;
- case ERANGE:
- log_err("The buffer for holding strings is too small "
- "(%d byte now)\n", sizeof(tmp_buf));
- break;
- default:
- log_err("Could not get group name for user (%s)\n",
- *target_uname);
- }
-
- /* Test if all was well. */
-
- if (target_gname == NULL)
- {
- exit(102);
- }
- }
- else
- {
- log_err("Could not get info for the target user (%s)\n",*target_uname);
- exit(102);
- }
-
- log_no_err("target group name determined (%s -> %s)\n",
- *target_uname, *target_gname);
-
- return 0;
-}
-
-void internal_server_error(void)
-{
- /* use this when its probably an httpd.conf configuration error */
-
- puts("Status: 500 Internal Server Error\n"
- "Content-Type: text/html\n\n"
- "<html><head><title>500 Internal Server Error</title></head>\n"
- "<body><h1>Internal Server Error</h1></body></html>");
-}
-
-void forbidden_error(void)
-{
- /* use this when unix file permissions/ownerships are probably wrong */
-
- puts("Status: 403 Forbidden\n"
- "Content-Type: text/html\n\n"
- "<html><head><title>403 Forbidden</title></head>\n"
- "<body><h1>Forbidden</h1></body></html>");
-}
-
-int main(int argc, char *argv[])
-{
- int userdir = 0; /* ~userdir flag */
- uid_t uid; /* user information */
- gid_t gid; /* target group placeholder */
- uid_t httpd_uid; /* uid for AP_HTTPD_USER */
- gid_t httpd_gid; /* uid for AP_HTTPD_GROUP */
- char *mapping_type; /* suexec / X509DN / directory */
- char *grst_cred_0; /* GRST_CRED_0 */
- char *map_x509dn; /* DN to use as pool acct. key */
- char *map_directory; /* directory as pool acct. key */
-
- char *diskmode_env; /* GRST_DISK_MODE as a string */
- apr_fileperms_t diskmode_apr; /* GRST_DISK_MODE as Apache perms */
- mode_t diskmode_t; /* GRST_DISK_MODE as mode_t */
-
- char *target_uname; /* target user name */
- char *target_gname; /* target group name */
- char *target_homedir; /* target home directory */
- char *actual_uname; /* actual user name */
- char *actual_gname; /* actual group name */
- char *prog; /* name of this program */
- char *cmd; /* command to be executed */
- char cwd[AP_MAXPATH]; /* current working directory */
- char dwd[AP_MAXPATH]; /* docroot working directory */
- struct passwd *pw; /* password entry holder */
- struct group *gr; /* group entry holder */
- struct stat dir_info; /* directory info holder */
- struct stat prg_info; /* program info holder */
-
- /*
- * Start with a "clean" environment
- */
- clean_env();
-
- prog = argv[0];
- /*
- * Check existence/validity of the UID of the user
- * running this program. Error out if invalid.
- */
- uid = getuid();
- if ((pw = getpwuid(uid)) == NULL) {
- log_err("crit: invalid uid: (%ld)\n", uid);
- internal_server_error();
- exit(102);
- }
- /*
- * Check existence/validity of the GID of the user
- * running this program. Error out if invalid.
- */
- gid = getgid();
- if ((gr = getgrgid(gid)) == NULL) {
- log_err("crit: invalid gid: (%ld)\n", gid);
- internal_server_error();
- exit(102);
- }
- /*
- * See if this is a 'how were you compiled' request, and
- * comply if so.
- */
- if ((argc > 1)
- && (! strcmp(argv[1], "-V"))
- && ((uid == 0)
-#ifdef _OSD_POSIX
- /* User name comparisons are case insensitive on BS2000/OSD */
- || (! strcasecmp(AP_HTTPD_USER, pw->pw_name)))
-#else /* _OSD_POSIX */
- || (! strcmp(AP_HTTPD_USER, pw->pw_name)))
-#endif /* _OSD_POSIX */
- ) {
-#ifdef AP_DOC_ROOT
- fprintf(stderr, " -D AP_DOC_ROOT=\"%s\"\n", AP_DOC_ROOT);
-#endif
-#ifdef AP_GID_MIN
- fprintf(stderr, " -D AP_GID_MIN=%d\n", AP_GID_MIN);
-#endif
-#ifdef AP_HTTPD_USER
- fprintf(stderr, " -D AP_HTTPD_USER=\"%s\"\n", AP_HTTPD_USER);
-#endif
-#ifdef AP_LOG_EXEC
- fprintf(stderr, " -D AP_LOG_EXEC=\"%s\"\n", AP_LOG_EXEC);
-#endif
-#ifdef AP_SAFE_PATH
- fprintf(stderr, " -D AP_SAFE_PATH=\"%s\"\n", AP_SAFE_PATH);
-#endif
-#ifdef AP_SUEXEC_UMASK
- fprintf(stderr, " -D AP_SUEXEC_UMASK=%03o\n", AP_SUEXEC_UMASK);
-#endif
-#ifdef AP_UID_MIN
- fprintf(stderr, " -D AP_UID_MIN=%d\n", AP_UID_MIN);
-#endif
-#ifdef AP_USERDIR_SUFFIX
- fprintf(stderr, " -D AP_USERDIR_SUFFIX=\"%s\"\n", AP_USERDIR_SUFFIX);
-#endif
- exit(0);
- }
- /*
- * If there are a proper number of arguments, set
- * all of them to variables. Otherwise, error out.
- */
- if (argc < 4) {
- log_err("too few arguments\n");
- internal_server_error();
- exit(101);
- }
-
- mapping_type = getenv("GRST_EXEC_METHOD");
- if ((mapping_type == NULL) ||
- (mapping_type[0] == '\0') ||
- (strcasecmp(mapping_type, "suexec") == 0))
- {
- target_uname = argv[1];
- target_gname = argv[2];
- mapping_type = NULL;
- }
- else if (strcasecmp(mapping_type, "X509DN") == 0)
- {
- if ((grst_cred_0 = getenv("GRST_CRED_0")) == NULL)
- map_x509dn = getenv("SSL_CLIENT_S_DN");
- else map_x509dn = index(grst_cred_0, '/');
-
- if ((map_x509dn == NULL) || (map_x509dn[0] == '\0'))
- {
- log_err("No GRST_CRED_0/SSL_CLIENT_S_DN despite X509DN mapping\n");
- forbidden_error();
- exit(151);
- }
-
- if (GRSTexecGetMapping(&target_uname, &target_gname,
- GRST_EXECMAPDIR, map_x509dn)
- != 0)
- {
- log_err("GRSTexecGetMapping() failed mapping \"%s\"\n",
- map_x509dn);
- forbidden_error();
- exit(152);
- }
- }
- else if (strcasecmp(mapping_type, "directory") == 0)
- {
- map_directory = getenv("GRST_EXEC_DIRECTORY");
- if (map_directory == NULL)
- {
- log_err("No GRST_EXEC_DIRECTORY despite directory mapping\n");
- internal_server_error();
- exit(153);
- }
-
- if (GRSTexecGetMapping(&target_uname, &target_gname,
- GRST_EXECMAPDIR, map_directory)
- != 0)
- {
- log_err("GRSTexecGetMapping() failed mapping \"%s\"\n",
- map_directory);
- internal_server_error();
- exit(154);
- }
- }
- else
- {
- log_err("mapping type \"%s\" not recognised\n", mapping_type);
- internal_server_error();
- exit(155);
- }
-
- cmd = argv[3];
-
- /*
- * Check to see if the user running this program
- * is the user allowed to do so as defined in
- * suexec.h. If not the allowed user, error out.
- */
-#ifdef _OSD_POSIX
- /* User name comparisons are case insensitive on BS2000/OSD */
- if (strcasecmp(AP_HTTPD_USER, pw->pw_name)) {
- log_err("user mismatch (%s instead of %s)\n", pw->pw_name, AP_HTTPD_USER);
- internal_server_error();
- exit(103);
- }
- /* User name comparisons are case insensitive on BS2000/OSD */
- if (strcasecmp(AP_HTTPD_GROUP, gr->gr_name)) {
- log_err("group mismatch (%s instead of %s)\n", gr->gr_name, AP_HTTPD_GROUP);
- internal_server_error();
- exit(103);
- }
-#else /*_OSD_POSIX*/
- if (strcmp(AP_HTTPD_USER, pw->pw_name)) {
- log_err("user mismatch (%s instead of %s)\n", pw->pw_name, AP_HTTPD_USER);
- internal_server_error();
- exit(103);
- }
- if (strcmp(AP_HTTPD_GROUP, gr->gr_name)) {
- log_err("group mismatch (%s instead of %s)\n", gr->gr_name, AP_HTTPD_GROUP);
- internal_server_error();
- exit(103);
- }
-#endif /*_OSD_POSIX*/
-
- /* Since they match (via name) save these for later */
-
- httpd_uid = uid;
- httpd_gid = gid;
-
- /*
- * Check for a leading '/' (absolute path) in the command to be executed,
- * or attempts to back up out of the current directory,
- * to protect against attacks. If any are
- * found, error out. Naughty naughty crackers.
- */
- if ((cmd[0] == '/') || (!strncmp(cmd, "../", 3))
- || (strstr(cmd, "/../") != NULL)) {
- log_err("invalid command (%s)\n", cmd);
- internal_server_error();
- exit(104);
- }
-
- /*
- * Check to see if this is a ~userdir request. If
- * so, set the flag, and remove the '~' from the
- * target username.
- */
- if (!strncmp("~", target_uname, 1)) {
- target_uname++;
- userdir = 1;
- }
-
- /*
- * Error out if the target username is invalid.
- */
- if (strspn(target_uname, "1234567890") != strlen(target_uname)) {
- if ((pw = getpwnam(target_uname)) == NULL) {
- log_err("invalid target user name: (%s)\n", target_uname);
- internal_server_error();
- exit(105);
- }
- }
- else {
- if ((pw = getpwuid(atoi(target_uname))) == NULL) {
- log_err("invalid target user id: (%s)\n", target_uname);
- internal_server_error();
- exit(121);
- }
- }
-
- /*
- * Error out if the target group name is invalid.
- */
- if (strspn(target_gname, "1234567890") != strlen(target_gname)) {
- if ((gr = getgrnam(target_gname)) == NULL) {
- log_err("invalid target group name: (%s)\n", target_gname);
- internal_server_error();
- exit(106);
- }
- gid = gr->gr_gid;
- actual_gname = strdup(gr->gr_name);
- }
- else {
- gid = atoi(target_gname);
- actual_gname = strdup(target_gname);
- }
-
-#ifdef _OSD_POSIX
- /*
- * Initialize BS2000 user environment
- */
- {
- pid_t pid;
- int status;
-
- switch (pid = ufork(target_uname)) {
- case -1: /* Error */
- log_err("failed to setup bs2000 environment for user %s: %s\n",
- target_uname, strerror(errno));
- internal_server_error();
- exit(150);
- case 0: /* Child */
- break;
- default: /* Father */
- while (pid != waitpid(pid, &status, 0))
- ;
- /* @@@ FIXME: should we deal with STOP signals as well? */
- if (WIFSIGNALED(status)) {
- kill (getpid(), WTERMSIG(status));
- }
- internal_server_error();
- exit(WEXITSTATUS(status));
- }
- }
-#endif /*_OSD_POSIX*/
-
- /*
- * Save these for later since initgroups will hose the struct
- */
- uid = pw->pw_uid;
- actual_uname = strdup(pw->pw_name);
- target_homedir = strdup(pw->pw_dir);
-
- /*
- * Log the transaction here to be sure we have an open log
- * before we setuid().
- */
- log_no_err("uid: (%s/%s) gid: (%s/%s) cmd: %s\n",
- target_uname, actual_uname,
- target_gname, actual_gname,
- cmd);
-
- /*
- * Error out if attempt is made to execute as root or as
- * a UID less than AP_UID_MIN. Tsk tsk.
- */
- if ((uid == 0) || (uid < AP_UID_MIN)) {
- log_err("cannot run as forbidden uid (%d/%s)\n", uid, cmd);
- internal_server_error();
- exit(107);
- }
-
- /*
- * Error out if attempt is made to execute as root group
- * or as a GID less than AP_GID_MIN. Tsk tsk.
- */
- if ((gid == 0) || (gid < AP_GID_MIN)) {
- log_err("cannot run as forbidden gid (%d/%s)\n", gid, cmd);
- internal_server_error();
- exit(108);
- }
-
- /*
- * Change UID/GID here so that the following tests work over NFS.
- *
- * Initialize the group access list for the target user,
- * and setgid() to the target group. If unsuccessful, error out.
- */
- if (((setgid(gid)) != 0) || (initgroups(actual_uname, gid) != 0)) {
- log_err("failed to setgid (%ld: %s)\n", gid, cmd);
- internal_server_error();
- exit(109);
- }
-
- /*
- * setuid() to the target user. Error out on fail.
- */
- if ((setuid(uid)) != 0) {
- log_err("failed to setuid (%ld: %s)\n", uid, cmd);
- internal_server_error();
- exit(110);
- }
-
- /*
- * Get the current working directory, as well as the proper
- * document root (dependant upon whether or not it is a
- * ~userdir request). Error out if we cannot get either one,
- * or if the current working directory is not in the docroot.
- * Use chdir()s and getcwd()s to avoid problems with symlinked
- * directories. Yuck.
- */
- if (getcwd(cwd, AP_MAXPATH) == NULL) {
- log_err("cannot get current working directory\n");
- internal_server_error();
- exit(111);
- }
-
-#if 0
- if (userdir) {
- if (((chdir(target_homedir)) != 0) ||
- ((chdir(AP_USERDIR_SUFFIX)) != 0) ||
- ((getcwd(dwd, AP_MAXPATH)) == NULL) ||
- ((chdir(cwd)) != 0)) {
- log_err("cannot get docroot information (%s)\n", target_homedir);
- internal_server_error();
- exit(112);
- }
- }
- else {
- if (((chdir(AP_DOC_ROOT)) != 0) ||
- ((getcwd(dwd, AP_MAXPATH)) == NULL) ||
- ((chdir(cwd)) != 0)) {
- log_err("cannot get docroot information (%s)\n", AP_DOC_ROOT);
- internal_server_error();
- exit(113);
- }
- }
-
- if ((strncmp(cwd, dwd, strlen(dwd))) != 0) {
- log_err("command not in docroot (%s/%s)\n", cwd, cmd);
- internal_server_error();
- exit(114);
- }
-#endif
-
- /*
- * Stat the cwd and verify it is a directory, or error out.
- */
- if (((lstat(cwd, &dir_info)) != 0) || !(S_ISDIR(dir_info.st_mode))) {
- log_err("cannot stat directory: (%s)\n", cwd);
- internal_server_error();
- exit(115);
- }
-
- /*
- * Error out if cwd is writable by others.
- */
- if ((dir_info.st_mode & S_IWOTH) || (dir_info.st_mode & S_IWGRP)) {
- log_err("directory is writable by others: (%s)\n", cwd);
- forbidden_error();
- exit(116);
- }
-
- /*
- * Error out if we cannot stat the program.
- */
- if (((lstat(cmd, &prg_info)) != 0) || (S_ISLNK(prg_info.st_mode))) {
- log_err("cannot stat program: (%s)\n", cmd);
- forbidden_error();
- exit(117);
- }
-
- /*
- * Error out if the program is writable by others.
- */
- if (prg_info.st_mode & S_IWOTH) {
- log_err("file is writable by others: (%s/%s)\n", cwd, cmd);
- forbidden_error();
- exit(118);
- }
-
- /*
- * Error out if the file is setuid or setgid.
- */
- if ((prg_info.st_mode & S_ISUID) || (prg_info.st_mode & S_ISGID)) {
- log_err("file is either setuid or setgid: (%s/%s)\n", cwd, cmd);
- forbidden_error();
- exit(119);
- }
-
- /*
- * Error out if the target name/group is different from
- * the name/group of the cwd or the program AND the name/group
- * of the cwd and program are not the AP_HTTPD_USER/AP_HTTPD_GROUP
- * AND the name/group of the cwd and program are not root
- */
- if (((uid != dir_info.st_uid) && (httpd_uid != dir_info.st_uid)
- && (0 != dir_info.st_uid)) ||
- ((gid != dir_info.st_gid) && (httpd_gid != dir_info.st_gid)
- && (0 != dir_info.st_gid)) ||
- ((uid != prg_info.st_uid) && (httpd_uid != prg_info.st_uid)
- && (0 != prg_info.st_uid)) ||
- ((gid != prg_info.st_gid) && (httpd_gid != prg_info.st_gid)
- && (0 != prg_info.st_gid)))
- {
- log_err("target (%ld/%ld) or %s (%ld/%ld) or root (0/0) uid/gid "
- "mismatch with directory (%ld/%ld) or program (%ld/%ld)\n",
- uid, gid, AP_HTTPD_USER, httpd_uid, httpd_gid,
- dir_info.st_uid, dir_info.st_gid,
- prg_info.st_uid, prg_info.st_gid);
- forbidden_error();
- exit(120);
- }
- /*
- * Error out if the program is not executable for the user.
- * Otherwise, she won't find any error in the logs except for
- * "[error] Premature end of script headers: ..."
- */
- if (!(prg_info.st_mode & S_IXUSR)) {
- log_err("file has no execute permission: (%s/%s)\n", cwd, cmd);
- forbidden_error();
- exit(121);
- }
-
- diskmode_env = getenv("GRST_DISK_MODE");
- if (diskmode_env != NULL)
- {
- diskmode_apr = 0;
- sscanf(diskmode_env, "%i", &diskmode_apr);
-
- diskmode_t = S_IRUSR | S_IWUSR;
-
- if (diskmode_apr & APR_GREAD ) diskmode_t |= S_IRGRP;
- if (diskmode_apr & APR_GWRITE) diskmode_t |= S_IWGRP;
- if (diskmode_apr & APR_WREAD ) diskmode_t |= S_IROTH;
-
- diskmode_t &= (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
-
-// log_err("diskmode_env=%s diskmode_apr=%x diskmode_t=%o ~diskmode_t=%o\n", diskmode_env, diskmode_apr, diskmode_t, ~diskmode_t);
-
- umask(~diskmode_t);
- }
-#ifdef AP_SUEXEC_UMASK
- else umask(AP_SUEXEC_UMASK);
-#else
- else umask(~(S_IRUSR | S_IWUSR));
-#endif /* AP_SUEXEC_UMASK */
-
- /*
- * Be sure to close the log file so the CGI can't
- * mess with it. If the exec fails, it will be reopened
- * automatically when log_err is called. Note that the log
- * might not actually be open if AP_LOG_EXEC isn't defined.
- * However, the "log" cell isn't ifdef'd so let's be defensive
- * and assume someone might have done something with it
- * outside an ifdef'd AP_LOG_EXEC block.
- */
- if (log != NULL) {
- fclose(log);
- log = NULL;
- }
-
- /*
- * Execute the command, replacing our image with its own.
- */
-#ifdef NEED_HASHBANG_EMUL
- /* We need the #! emulation when we want to execute scripts */
- {
- extern char **environ;
-
- ap_execve(cmd, &argv[3], environ);
- }
-#else /*NEED_HASHBANG_EMUL*/
- execv(cmd, &argv[3]);
-#endif /*NEED_HASHBANG_EMUL*/
-
- /*
- * (I can't help myself...sorry.)
- *
- * Uh oh. Still here. Where's the kaboom? There was supposed to be an
- * EARTH-shattering kaboom!
- *
- * Oh well, log the failure and error out.
- */
- log_err("(%d)%s: exec failed (%s)\n", errno, strerror(errno), cmd);
- internal_server_error();
- exit(255);
-}
+++ /dev/null
-/* Copyright 1999-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * suexec.h -- user-definable variables for the suexec wrapper code.
- * (See README.configure on how to customize these variables.)
- */
-
-
-#ifndef _SUEXEC_H
-#define _SUEXEC_H
-
-/*
- * Include ap_config_layout so we can work out where the default htdocsdir
- * and logsdir are.
- */
-#include "ap_config_layout.h"
-
-/*
- * HTTPD_USER -- Define as the username under which Apache normally
- * runs. This is the only user allowed to execute
- * this program.
- */
-#ifndef AP_HTTPD_USER
-#define AP_HTTPD_USER "apache"
-#endif
-
-/*
- * HTTPD_GROUP -- Define as the group under which Apache normally
- * runs. This is the only user allowed to execute
- * this program.
- */
-#ifndef AP_HTTPD_GROUP
-#define AP_HTTPD_GROUP "apache"
-#endif
-
-/*
- * UID_MIN -- Define this as the lowest UID allowed to be a target user
- * for suEXEC. For most systems, 500 or 100 is common, but
- * 99 will include user nobody on RedHat Linux systems.
- */
-#ifdef AP_UID_MIN
-#undef AP_UID_MIN
-#endif
-#define AP_UID_MIN 99
-
-/*
- * GID_MIN -- Define this as the lowest GID allowed to be a target group
- * for suEXEC. For most systems, 100 is common, but 99 will
- * include group nobody on RedHat Linux systems.
- */
-#ifdef AP_GID_MIN
-#undef AP_GID_MIN
-#endif
-#define AP_GID_MIN 99
-
-/*
- * USERDIR_SUFFIX -- Define to be the subdirectory under users'
- * home directories where suEXEC access should
- * be allowed. All executables under this directory
- * will be executable by suEXEC as the user so
- * they should be "safe" programs. If you are
- * using a "simple" UserDir directive (ie. one
- * without a "*" in it) this should be set to
- * the same value. suEXEC will not work properly
- * in cases where the UserDir directive points to
- * a location that is not the same as the user's
- * home directory as referenced in the passwd file.
- *
- * If you have VirtualHosts with a different
- * UserDir for each, you will need to define them to
- * all reside in one parent directory; then name that
- * parent directory here. IF THIS IS NOT DEFINED
- * PROPERLY, ~USERDIR CGI REQUESTS WILL NOT WORK!
- * See the suEXEC documentation for more detailed
- * information.
- */
-#ifndef AP_USERDIR_SUFFIX
-#define AP_USERDIR_SUFFIX "public_html"
-#endif
-
-/*
- * LOG_EXEC -- Define this as a filename if you want all suEXEC
- * transactions and errors logged for auditing and
- * debugging purposes.
- */
-#ifndef AP_LOG_EXEC
-#define AP_LOG_EXEC DEFAULT_EXP_LOGFILEDIR "/suexec_log" /* Need me? */
-#endif
-
-/*
- * DOC_ROOT -- Define as the DocumentRoot set for Apache. This
- * will be the only hierarchy (aside from UserDirs)
- * that can be used for suEXEC behavior.
- */
-#ifndef AP_DOC_ROOT
-#define AP_DOC_ROOT DEFAULT_EXP_HTDOCSDIR
-#endif
-
-/*
- * SAFE_PATH -- Define a safe PATH environment to pass to CGI executables.
- *
- */
-#ifndef AP_SAFE_PATH
-#define AP_SAFE_PATH "/usr/local/bin:/usr/bin:/bin"
-#endif
-
-/*
- * GRST_EXECMAPDIR -- Location of the gridmapdir-style directory of lock files
- *
- */
-#define GRST_EXECMAPDIR "/var/www/execmapdir"
-
-#endif /* _SUEXEC_H */
+++ /dev/null
-/*
- Copyright (c) 2002-5, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*---------------------------------------------------------------*
- * For more about GridSite: http://www.gridsite.org/ *
- *---------------------------------------------------------------*/
-
-#ifndef VERSION
-#define VERSION "0.0.0"
-#endif
-
-#define _GNU_SOURCE
-
-#include <pwd.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <string.h>
-#include <malloc.h>
-#include <dirent.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/time.h>
-#include <sys/select.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <curl/curl.h>
-
-#include "gridsite.h"
-
-/* deal with older versions of libcurl and curl.h */
-
-#ifndef CURLOPT_WRITEDATA
-#define CURLOPT_WRITEDATA CURLOPT_FILE
-#endif
-
-#ifndef CURLOPT_READDATA
-#define CURLOPT_READDATA CURLOPT_FILE
-#endif
-
-#ifndef CURLE_HTTP_RETURNED_ERROR
-#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND
-#endif
-
-#define HTCP_GET 1
-#define HTCP_PUT 2
-#define HTCP_DELETE 3
-#define HTCP_LIST 4
-#define HTCP_LONGLIST 5
-#define HTCP_MKDIR 6
-#define HTCP_MOVE 7
-#define HTCP_PING 8
-#define HTCP_FIND 9
-
-#define HTCP_SITECAST_GROUPS 32
-
-#define HTCP_HOST_CONF "/etc/htcp.conf"
-#define HTCP_USER_CONF ".htcp.conf"
-
-struct grst_stream_data { char *source;
- char *destination;
- int ishttps;
- int method;
- FILE *fp;
- char *cert;
- char *key;
- char *capath;
- char *useragent;
- char *errorbuf;
- int noverify;
- int anonymous;
- int gridhttp;
- int verbose;
- int timeout;
- char *groups;
- int sitecast;
- char *domain; } ;
-
-struct grst_index_blob { char *text;
- size_t used;
- size_t allocated; } ;
-
-struct grst_dir_list { char *filename;
- size_t length;
- int length_set;
- time_t modified;
- int modified_set; } ;
-
-struct grst_header_data { int retcode;
- char *location;
- char *gridhttponetime;
- size_t length;
- int length_set;
- time_t modified;
- int modified_set;
- struct grst_stream_data *common_data; } ;
-
-struct grst_sitecast_group { unsigned char quad1; unsigned char quad2;
- unsigned char quad3; unsigned char quad4;
- int port; int timewait; int ttl; };
-
-size_t headers_callback(void *ptr, size_t size, size_t nmemb, void *p)
-/* Find the values of the return code, Content-Length, Last-Modified
- and Location headers */
-{
- float f;
- char *s, *q;
- size_t realsize;
- struct tm modified_tm;
- struct grst_header_data *header_data;
-
- header_data = (struct grst_header_data *) p;
- realsize = size * nmemb;
- s = malloc(realsize + 1);
- memcpy(s, ptr, realsize);
- s[realsize] = '\0';
-
- if (sscanf(s, "Content-Length: %d", &(header_data->length)) == 1)
- header_data->length_set = 1;
- else if (sscanf(s, "HTTP/%f %d ", &f, &(header_data->retcode)) == 2) ;
- else if (strncmp(s, "Location: ", 10) == 0)
- {
- header_data->location = strdup(&s[10]);
-
- for (q=header_data->location; *q != '\0'; ++q)
- if ((*q == '\r') || (*q == '\n')) *q = '\0';
-
- if (header_data->common_data->verbose > 0)
- fprintf(stderr, "Received Location: %s\n", header_data->location);
- }
- else if (strncmp(s, "Set-Cookie: GRIDHTTP_ONETIME=", 29) == 0)
- {
- header_data->gridhttponetime = strdup(&s[12]);
- q = index(header_data->gridhttponetime, ';');
- if (q != NULL) *q = '\0';
-
- if (header_data->common_data->verbose > 0)
- fprintf(stderr, "Received GridHTTP Auth Cookie: %s\n",
- header_data->gridhttponetime);
- }
- else if (strncmp(s, "Last-Modified: ", 15) == 0)
- {
- /* follow RFC 2616: first try RFC 822 (kosher), then RFC 850 and
- asctime() formats too. Must be GMT whatever the format. */
-
- if (strptime(&s[15], "%a, %d %b %Y %T GMT", &modified_tm) != NULL)
- {
- header_data->modified = mktime(&modified_tm);
- header_data->modified_set = 1;
- }
- else if (strptime(&s[15], "%a, %d-%b-%y %T GMT", &modified_tm) != NULL)
- {
- header_data->modified = mktime(&modified_tm);
- header_data->modified_set = 1;
- }
- else if (strptime(&s[15], "%a %b %d %T %Y", &modified_tm) != NULL)
- {
- header_data->modified = mktime(&modified_tm);
- header_data->modified_set = 1;
- }
- }
-
- free(s);
- return realsize;
-}
-
-int set_std_opts(CURL *easyhandle, struct grst_stream_data *common_data)
-{
- struct stat statbuf;
-
- curl_easy_setopt(easyhandle, CURLOPT_FOLLOWLOCATION, 0);
-
- if ((common_data->cert != NULL) && (common_data->key != NULL))
- {
- curl_easy_setopt(easyhandle, CURLOPT_SSLENGINE, NULL);
- curl_easy_setopt(easyhandle, CURLOPT_SSLCERTTYPE, "PEM");
- curl_easy_setopt(easyhandle, CURLOPT_SSLCERT, common_data->cert);
- curl_easy_setopt(easyhandle, CURLOPT_SSLKEY, common_data->key);
- }
- else
- {
- curl_easy_setopt(easyhandle, CURLOPT_SSLENGINE, "RSA");
- curl_easy_setopt(easyhandle, CURLOPT_SSLCERTTYPE, "ENG");
- }
-
- if (common_data->capath != NULL)
- {
-#if (LIBCURL_VERSION_NUM >= 0x070908)
- if ((stat(common_data->capath, &statbuf) == 0) &&
- S_ISDIR(statbuf.st_mode))
- curl_easy_setopt(easyhandle, CURLOPT_CAPATH, common_data->capath);
- else
-#endif
- curl_easy_setopt(easyhandle, CURLOPT_CAINFO, common_data->capath);
- }
-
- if (common_data->noverify)
- {
- curl_easy_setopt(easyhandle, CURLOPT_SSL_VERIFYPEER, 0);
- curl_easy_setopt(easyhandle, CURLOPT_SSL_VERIFYHOST, 0);
- }
- else
- {
- curl_easy_setopt(easyhandle, CURLOPT_SSL_VERIFYPEER, 2);
- curl_easy_setopt(easyhandle, CURLOPT_SSL_VERIFYHOST, 2);
- }
-
- return 1;
-}
-
-int do_copies(char *sources[], char *destination,
- struct grst_stream_data *common_data)
-{
- char *p, *thisdestination;
- int isrc, anyerror = 0, thiserror, isdirdest;
- CURL *easyhandle;
- struct stat statbuf;
- struct grst_header_data header_data;
- struct curl_slist *gh_header_slist = NULL, *nogh_header_slist = NULL;
-
- easyhandle = curl_easy_init();
-
- if (common_data->gridhttp)
- {
- asprintf(&p, "Upgrade: GridHTTP/1.0");
- gh_header_slist = curl_slist_append(gh_header_slist, p);
- free(p);
-
- nogh_header_slist = curl_slist_append(nogh_header_slist, "Upgrade:");
- }
-
- curl_easy_setopt(easyhandle, CURLOPT_USERAGENT, common_data->useragent);
- if (common_data->verbose > 1)
- curl_easy_setopt(easyhandle, CURLOPT_VERBOSE, 1);
-
- curl_easy_setopt(easyhandle, CURLOPT_HEADERFUNCTION, headers_callback);
- curl_easy_setopt(easyhandle, CURLOPT_WRITEHEADER, &header_data);
-
- set_std_opts(easyhandle, common_data);
-
- curl_easy_setopt(easyhandle, CURLOPT_ERRORBUFFER, common_data->errorbuf);
-
- if (destination[strlen(destination) - 1] != '/')
- {
- isdirdest = 0;
- thisdestination = destination;
- }
- else isdirdest = 1;
-
- for (isrc=0; sources[isrc] != NULL; ++isrc)
- {
- if (isdirdest)
- {
- p = rindex(sources[isrc], '/');
- if (p == NULL) p = sources[isrc];
- else p++;
-
- asprintf(&thisdestination, "%s%s", destination, p);
- }
-
- if (common_data->verbose > 0)
- fprintf(stderr, "Copy %s -> %s\n", sources[isrc], thisdestination);
-
- if (common_data->method == HTCP_GET)
- {
- common_data->fp = fopen(thisdestination, "w");
- if (common_data->fp == NULL)
- {
- fprintf(stderr,"... failed to open destination source file %s\n",
- thisdestination);
- anyerror = 99;
- if (isdirdest) free(thisdestination);
- continue;
- }
-
- curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA, common_data->fp);
- curl_easy_setopt(easyhandle, CURLOPT_URL, sources[isrc]);
-
- if ((common_data->gridhttp) &&
- (strncmp(sources[isrc], "https://", 8) == 0))
- {
- if (common_data->verbose > 0)
- fprintf(stderr, "Add Upgrade: GridHTTP/1.0\n");
-
- curl_easy_setopt(easyhandle,CURLOPT_HTTPHEADER,gh_header_slist);
- }
- else
- curl_easy_setopt(easyhandle,CURLOPT_HTTPHEADER,nogh_header_slist);
- }
- else if (common_data->method == HTCP_PUT)
- {
- if (stat(sources[isrc], &statbuf) != 0)
- {
- fprintf(stderr, "... source file %s not found\n", sources[isrc]);
- anyerror = 99;
- if (isdirdest) free(thisdestination);
- continue;
- }
-
- common_data->fp = fopen(sources[isrc], "r");
- if (common_data->fp == NULL)
- {
- fprintf(stderr, "... failed to open source file %s\n",
- sources[isrc]);
- anyerror = 99;
- if (isdirdest) free(thisdestination);
- continue;
- }
-
- curl_easy_setopt(easyhandle, CURLOPT_READDATA, common_data->fp);
- curl_easy_setopt(easyhandle, CURLOPT_URL, thisdestination);
- curl_easy_setopt(easyhandle, CURLOPT_INFILESIZE, statbuf.st_size);
- curl_easy_setopt(easyhandle, CURLOPT_UPLOAD, 1);
-
- if ((common_data->gridhttp) &&
- (strncmp(thisdestination, "https://", 8) == 0))
- curl_easy_setopt(easyhandle,CURLOPT_HTTPHEADER,gh_header_slist);
- else
- curl_easy_setopt(easyhandle,CURLOPT_HTTPHEADER,nogh_header_slist);
- }
-
- header_data.retcode = 0;
- header_data.location = NULL;
- header_data.gridhttponetime = NULL;
- header_data.common_data = common_data;
- thiserror = curl_easy_perform(easyhandle);
-
- fclose(common_data->fp);
-
- if ((common_data->gridhttp) &&
- (thiserror == 0) &&
- (header_data.retcode == 302) &&
- (header_data.location != NULL) &&
- (strncmp(header_data.location, "http://", 7) == 0) &&
- (header_data.gridhttponetime != NULL))
- {
- if (common_data->verbose > 0)
- fprintf(stderr, "... Found (%d)\nGridHTTP redirect to %s\n",
- header_data.retcode, header_data.location);
-
- /* try again with new URL and all the previous CURL options */
-
- if (common_data->method == HTCP_GET)
- {
- common_data->fp = fopen(thisdestination, "w");
- if (common_data->fp == NULL)
- {
- fprintf(stderr, "... failed to open destination source "
- "file %s\n", thisdestination);
- anyerror = 99;
- if (isdirdest) free(thisdestination);
- continue;
- }
- }
- else if (common_data->method == HTCP_PUT)
- {
- common_data->fp = fopen(sources[isrc], "r");
- if (common_data->fp == NULL)
- {
- fprintf(stderr, "... failed to open source file %s\n",
- sources[isrc]);
- anyerror = 99;
- if (isdirdest) free(thisdestination);
- continue;
- }
- }
-
- header_data.retcode = 0;
- curl_easy_setopt(easyhandle, CURLOPT_URL, header_data.location);
- curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, nogh_header_slist);
- curl_easy_setopt(easyhandle, CURLOPT_COOKIE,
- header_data.gridhttponetime);
- thiserror = curl_easy_perform(easyhandle);
-
- fclose(common_data->fp);
- }
-
- if ((thiserror != 0) ||
- (header_data.retcode < 200) ||
- (header_data.retcode >= 300))
- {
- fprintf(stderr, "... curl error: %s (%d), HTTP error: %d\n",
- common_data->errorbuf, thiserror, header_data.retcode);
-
- if (thiserror != 0) anyerror = thiserror;
- else anyerror = header_data.retcode;
- }
- else if (common_data->verbose > 0)
- fprintf(stderr, "... OK (%d)\n", header_data.retcode);
-
- if (isdirdest) free(thisdestination);
- }
-
- curl_easy_cleanup(easyhandle);
-
- return anyerror;
-}
-
-int do_deletes(char *sources[], struct grst_stream_data *common_data)
-{
- int isrc, anyerror = 0, thiserror;
- CURL *easyhandle;
- struct grst_header_data header_data;
-
- header_data.common_data = common_data;
-
- easyhandle = curl_easy_init();
-
- curl_easy_setopt(easyhandle, CURLOPT_USERAGENT, common_data->useragent);
- if (common_data->verbose > 1)
- curl_easy_setopt(easyhandle, CURLOPT_VERBOSE, 1);
-
- curl_easy_setopt(easyhandle, CURLOPT_HEADERFUNCTION, headers_callback);
- curl_easy_setopt(easyhandle, CURLOPT_WRITEHEADER, &header_data);
-
- curl_easy_setopt(easyhandle, CURLOPT_ERRORBUFFER, common_data->errorbuf);
- curl_easy_setopt(easyhandle, CURLOPT_CUSTOMREQUEST, "DELETE");
- curl_easy_setopt(easyhandle, CURLOPT_NOBODY, 1);
-
- set_std_opts(easyhandle, common_data);
-
- for (isrc=0; sources[isrc] != NULL; ++isrc)
- {
- if (common_data->verbose > 0)
- fprintf(stderr, "Deleting %s\n", sources[isrc]);
-
- curl_easy_setopt(easyhandle, CURLOPT_URL, sources[isrc]);
-
- header_data.retcode = 0;
- thiserror = curl_easy_perform(easyhandle);
-
- if ((thiserror != 0) ||
- (header_data.retcode < 200) ||
- (header_data.retcode >= 300))
- {
- fprintf(stderr, "... curl error: %s (%d), HTTP error: %d\n",
- common_data->errorbuf, thiserror, header_data.retcode);
-
- if (thiserror != 0) anyerror = thiserror;
- else anyerror = header_data.retcode;
- }
- else if (common_data->verbose > 0)
- fprintf(stderr, "... OK (%d)\n", header_data.retcode);
- }
-
- curl_easy_cleanup(easyhandle);
-
- return anyerror;
-}
-
-int do_move(char *source, char *destination,
- struct grst_stream_data *common_data)
-{
- int anyerror = 0, thiserror;
- char *destination_header;
- CURL *easyhandle;
- struct grst_header_data header_data;
- struct curl_slist *header_slist = NULL;
-
- easyhandle = curl_easy_init();
-
- header_data.common_data = common_data;
-
- easyhandle = curl_easy_init();
-
- asprintf(&destination_header, "Destination: %s", destination);
- header_slist = curl_slist_append(header_slist, destination_header);
- curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, header_slist);
-
- curl_easy_setopt(easyhandle, CURLOPT_USERAGENT, common_data->useragent);
- if (common_data->verbose > 1)
- curl_easy_setopt(easyhandle, CURLOPT_VERBOSE, 1);
-
- curl_easy_setopt(easyhandle, CURLOPT_HEADERFUNCTION, headers_callback);
- curl_easy_setopt(easyhandle, CURLOPT_WRITEHEADER, &header_data);
-
- curl_easy_setopt(easyhandle, CURLOPT_ERRORBUFFER, common_data->errorbuf);
- curl_easy_setopt(easyhandle, CURLOPT_CUSTOMREQUEST, "MOVE");
- curl_easy_setopt(easyhandle, CURLOPT_NOBODY, 1);
-
- set_std_opts(easyhandle, common_data);
-
- if (common_data->verbose > 0)
- fprintf(stderr, "Moving %s to %s\n", source, destination);
-
- curl_easy_setopt(easyhandle, CURLOPT_URL, source);
-
- header_data.retcode = 0;
- thiserror = curl_easy_perform(easyhandle);
-
- if ((thiserror != 0) ||
- (header_data.retcode < 200) ||
- (header_data.retcode >= 300))
- {
- fprintf(stderr, "... curl error: %s (%d), HTTP error: %d\n",
- common_data->errorbuf, thiserror, header_data.retcode);
-
- if (thiserror != 0) anyerror = thiserror;
- else anyerror = header_data.retcode;
- }
- else if (common_data->verbose > 0)
- fprintf(stderr, "... OK (%d)\n", header_data.retcode);
-
- curl_easy_cleanup(easyhandle);
-
- return anyerror;
-}
-
-int do_mkdirs(char *sources[], struct grst_stream_data *common_data)
-{
- int isrc, anyerror = 0, thiserror;
- CURL *easyhandle;
- struct grst_header_data header_data;
-
- header_data.common_data = common_data;
-
- easyhandle = curl_easy_init();
-
- curl_easy_setopt(easyhandle, CURLOPT_USERAGENT, common_data->useragent);
- if (common_data->verbose > 1)
- curl_easy_setopt(easyhandle, CURLOPT_VERBOSE, 1);
-
- curl_easy_setopt(easyhandle, CURLOPT_HEADERFUNCTION, headers_callback);
- curl_easy_setopt(easyhandle, CURLOPT_WRITEHEADER, &header_data);
-
- curl_easy_setopt(easyhandle, CURLOPT_ERRORBUFFER, common_data->errorbuf);
- curl_easy_setopt(easyhandle, CURLOPT_CUSTOMREQUEST, "PUT");
- curl_easy_setopt(easyhandle, CURLOPT_NOBODY, 1);
-
- set_std_opts(easyhandle, common_data);
-
- for (isrc=0; sources[isrc] != NULL; ++isrc)
- {
- if (common_data->verbose > 0)
- fprintf(stderr, "Make directory %s\n", sources[isrc]);
-
- curl_easy_setopt(easyhandle, CURLOPT_URL, sources[isrc]);
-
- header_data.retcode = 0;
- thiserror = curl_easy_perform(easyhandle);
-
- if ((thiserror != 0) ||
- (header_data.retcode < 200) ||
- (header_data.retcode >= 300))
- {
- fprintf(stderr, "... curl error: %s (%d), HTTP error: %d\n",
- common_data->errorbuf, thiserror, header_data.retcode);
-
- if (thiserror != 0) anyerror = thiserror;
- else anyerror = header_data.retcode;
- }
- else if (common_data->verbose > 0)
- fprintf(stderr, "... OK (%d)\n", header_data.retcode);
- }
-
- curl_easy_cleanup(easyhandle);
-
- return anyerror;
-}
-
-int do_ping(struct grst_stream_data *common_data_ptr)
-{
- int request_length, response_length, i, ret, s, igroup;
- struct sockaddr_in srv, from;
- socklen_t fromlen;
-#define MAXBUF 8192
- char *request, response[MAXBUF], *p;
- GRSThtcpMessage msg;
- struct timeval start_timeval, wait_timeval, response_timeval;
- struct grst_sitecast_group sitecast_groups[HTCP_SITECAST_GROUPS];
- fd_set readsckts;
-
- /* parse common_data_ptr->groups */
-
- p = common_data_ptr->groups;
- igroup = -1;
-
- for (igroup=-1; igroup+1 < HTCP_SITECAST_GROUPS; ++igroup)
- {
- sitecast_groups[igroup+1].port = GRST_HTCP_PORT;
- sitecast_groups[igroup+1].timewait = 1;
- sitecast_groups[igroup+1].ttl = 1;
-
- ret = sscanf(p, "%d.%d.%d.%d:%d:%d:%d",
- &(sitecast_groups[igroup+1].quad1),
- &(sitecast_groups[igroup+1].quad2),
- &(sitecast_groups[igroup+1].quad3),
- &(sitecast_groups[igroup+1].quad4),
- &(sitecast_groups[igroup+1].port),
- &(sitecast_groups[igroup+1].ttl),
- &(sitecast_groups[igroup+1].timewait));
-
- if (ret == 0) break; /* end of list ? */
-
- if (ret < 5)
- {
- fprintf(stderr, "Failed to parse multicast group "
- "parameter %s\n", p);
- return CURLE_FAILED_INIT;
- }
-
- ++igroup;
-
- if ((p = index(p, ',')) == NULL) break;
- ++p;
- }
-
- if (igroup == -1)
- {
- fprintf(stderr, "Failed to parse multicast group parameter %s\n", p);
- return CURLE_FAILED_INIT;
- }
-
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- {
- fprintf(stderr, "Failed to open UDP socket\n");
- return CURLE_FAILED_INIT;
- }
-
- /* loop through multicast groups and send off the NOP pings */
-
- gettimeofday(&start_timeval, NULL);
-
- for (i=0; i <= igroup; ++i)
- {
- bzero(&srv, sizeof(srv));
- srv.sin_family = AF_INET;
- srv.sin_port = htons(sitecast_groups[i].port);
- srv.sin_addr.s_addr = htonl(sitecast_groups[i].quad1*0x1000000
- + sitecast_groups[i].quad2*0x10000
- + sitecast_groups[i].quad3*0x100
- + sitecast_groups[i].quad4);
-
- GRSThtcpNOPrequestMake(&request, &request_length,
- (int) (start_timeval.tv_usec + i));
-
- sendto(s, request, request_length, 0, (struct sockaddr *) &srv,
- sizeof(srv));
- free(request);
- }
-
- /* reusing wait_timeval is a Linux-specific feature of select() */
- wait_timeval.tv_sec = common_data_ptr->timeout
- ? common_data_ptr->timeout : 60;
- wait_timeval.tv_usec = 0;
-
- while ((wait_timeval.tv_sec > 0) || (wait_timeval.tv_usec > 0))
- {
- FD_ZERO(&readsckts);
- FD_SET(s, &readsckts);
-
- ret = select(s + 1, &readsckts, NULL, NULL, &wait_timeval);
- gettimeofday(&response_timeval, NULL);
-
- if (ret > 0)
- {
- response_length = recvfrom(s, response, MAXBUF,
- 0, &from, &fromlen);
-
- if ((GRSThtcpMessageParse(&msg, response, response_length)
- == GRST_RET_OK) &&
- (msg.opcode == GRSThtcpNOPop) && (msg.rr == 1) &&
- (msg.trans_id >= (int) start_timeval.tv_usec) &&
- (msg.trans_id <= (int) (start_timeval.tv_usec + igroup)))
- {
- printf("%s:%d %.3fms\n",
- inet_ntoa(from.sin_addr),
- ntohs(from.sin_port),
- (((long) 1000000 * response_timeval.tv_sec) +
- ((long) response_timeval.tv_usec) -
- ((long) 1000000 * start_timeval.tv_sec) -
- ((long) start_timeval.tv_usec)) / 1000.0);
- }
- }
- }
-
- return GRST_RET_OK;
-}
-
-int do_finds(char *sources[],
- struct grst_stream_data *common_data_ptr, int num)
-{
- int isrc;
-
- int request_length, response_length, i, ret, s, igroup;
- struct sockaddr_in srv, from;
- socklen_t fromlen;
-#define MAXBUF 8192
- char *request, response[MAXBUF], *p;
- GRSThtcpMessage msg;
- struct timeval start_timeval, wait_timeval;
- struct grst_sitecast_group sitecast_groups[HTCP_SITECAST_GROUPS];
- fd_set readsckts;
-
- /* parse common_data_ptr->groups */
-
- if (common_data_ptr->groups == NULL)
- {
- fprintf(stderr, "No multicast groups given\n");
- return CURLE_FAILED_INIT;
- }
-
- p = common_data_ptr->groups;
- igroup = -1;
-
- for (igroup=-1; igroup+1 < HTCP_SITECAST_GROUPS;)
- {
- sitecast_groups[igroup+1].port = GRST_HTCP_PORT;
- sitecast_groups[igroup+1].timewait = 1;
- sitecast_groups[igroup+1].ttl = 1;
-
- ret = sscanf(p, "%d.%d.%d.%d:%d:%d:%d",
- &(sitecast_groups[igroup+1].quad1),
- &(sitecast_groups[igroup+1].quad2),
- &(sitecast_groups[igroup+1].quad3),
- &(sitecast_groups[igroup+1].quad4),
- &(sitecast_groups[igroup+1].port),
- &(sitecast_groups[igroup+1].ttl),
- &(sitecast_groups[igroup+1].timewait));
-
- if (ret == 0) break; /* end of list ? */
-
- if (ret < 5)
- {
- fprintf(stderr, "Failed to parse multicast group "
- "parameter %s\n", p);
- return CURLE_FAILED_INIT;
- }
-
- ++igroup;
-
- if ((p = index(p, ',')) == NULL) break;
- ++p;
- }
-
- if (igroup == -1)
- {
- fprintf(stderr, "Failed to parse multicast group parameter %s\n", p);
- return CURLE_FAILED_INIT;
- }
-
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- {
- fprintf(stderr, "Failed to open UDP socket\n");
- return CURLE_FAILED_INIT;
- }
-
- /* loop through multicast groups since we need to take each
- ones timewait into account */
-
- gettimeofday(&start_timeval, NULL);
-
- for (i=0; i <= igroup; ++i)
- {
- if (common_data_ptr->verbose)
- fprintf(stderr, "Querying multicast group %d.%d.%d.%d:%d:%d:%d\n",
- sitecast_groups[i].quad1, sitecast_groups[i].quad2,
- sitecast_groups[i].quad3, sitecast_groups[i].quad4,
- sitecast_groups[i].port, sitecast_groups[i].ttl,
- sitecast_groups[i].timewait);
-
- bzero(&srv, sizeof(srv));
- srv.sin_family = AF_INET;
- srv.sin_port = htons(sitecast_groups[i].port);
- srv.sin_addr.s_addr = htonl(sitecast_groups[i].quad1*0x1000000
- + sitecast_groups[i].quad2*0x10000
- + sitecast_groups[i].quad3*0x100
- + sitecast_groups[i].quad4);
-
- /* send off queries, one for each source file */
-
- for (isrc=0; sources[isrc] != NULL; ++isrc)
- {
- GRSThtcpTSTrequestMake(&request, &request_length,
- (int) (start_timeval.tv_usec + isrc),
- "GET", sources[isrc], "");
-
- sendto(s, request, request_length, 0,
- (struct sockaddr *) &srv, sizeof(srv));
-
- free(request);
- }
-
- /* reusing wait_timeval is a Linux-specific feature of select() */
- wait_timeval.tv_usec = 0;
- wait_timeval.tv_sec = sitecast_groups[i].timewait;
-
- while ((wait_timeval.tv_sec > 0) || (wait_timeval.tv_usec > 0))
- {
- FD_ZERO(&readsckts);
- FD_SET(s, &readsckts);
-
- ret = select(s + 1, &readsckts, NULL, NULL, &wait_timeval);
-
- if (ret > 0)
- {
- response_length = recvfrom(s, response, MAXBUF,
- 0, &from, &fromlen);
-
- if ((GRSThtcpMessageParse(&msg, response, response_length)
- == GRST_RET_OK) &&
- (msg.opcode == GRSThtcpTSTop) && (msg.rr == 1) &&
- (msg.trans_id >= (int) start_timeval.tv_usec) &&
- (msg.trans_id < (int) (start_timeval.tv_usec + num)) &&
- (msg.resp_hdrs != NULL) &&
- (GRSThtcpCountstrLen(msg.resp_hdrs) > 12))
- {
- if (num > 1) printf("%s -> %.*s\n",
- sources[msg.trans_id - (int) start_timeval.tv_usec],
- GRSThtcpCountstrLen(msg.resp_hdrs) - 12,
- &(msg.resp_hdrs->text[10]));
- else printf("%.*s\n",
- GRSThtcpCountstrLen(msg.resp_hdrs) - 12,
- &(msg.resp_hdrs->text[10]));
- }
- }
- }
-
- }
-
- return GRST_RET_OK;
-}
-
-int translate_sitecast_url(char **source_ptr,
- struct grst_stream_data *common_data_ptr)
-{
- int request_length, response_length, i, ret, s, igroup;
- struct sockaddr_in srv, from;
- socklen_t fromlen;
-#define MAXBUF 8192
- char *request, response[MAXBUF], *p;
- GRSThtcpMessage msg;
- struct timeval start_timeval, wait_timeval;
- struct grst_sitecast_group sitecast_groups[HTCP_SITECAST_GROUPS];
- fd_set readsckts;
-
- /* parse common_data_ptr->groups */
-
- if (common_data_ptr->groups == NULL)
- {
- fprintf(stderr, "No multicast groups given\n");
- return CURLE_FAILED_INIT;
- }
-
- p = common_data_ptr->groups;
- igroup = -1;
-
- for (igroup=-1; igroup+1 < HTCP_SITECAST_GROUPS;)
- {
- sitecast_groups[igroup+1].port = GRST_HTCP_PORT;
- sitecast_groups[igroup+1].timewait = 1;
- sitecast_groups[igroup+1].ttl = 1;
-
- ret = sscanf(p, "%d.%d.%d.%d:%d:%d:%d",
- &(sitecast_groups[igroup+1].quad1),
- &(sitecast_groups[igroup+1].quad2),
- &(sitecast_groups[igroup+1].quad3),
- &(sitecast_groups[igroup+1].quad4),
- &(sitecast_groups[igroup+1].port),
- &(sitecast_groups[igroup+1].ttl),
- &(sitecast_groups[igroup+1].timewait));
-
- if (ret == 0) break; /* end of list ? */
-
- if (ret < 5)
- {
- fprintf(stderr, "Failed to parse multicast group "
- "parameter %s\n", p);
- return CURLE_FAILED_INIT;
- }
-
- ++igroup;
-
- if ((p = index(p, ',')) == NULL) break;
- ++p;
- }
-
- if (igroup == -1)
- {
- fprintf(stderr, "Failed to parse multicast group parameter %s\n", p);
- return CURLE_FAILED_INIT;
- }
-
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- {
- fprintf(stderr, "Failed to open UDP socket\n");
- return CURLE_FAILED_INIT;
- }
-
- /* loop through multicast groups since we need to take each
- ones timewait into account */
-
- gettimeofday(&start_timeval, NULL);
-
- for (i=0; i <= igroup; ++i)
- {
- if (common_data_ptr->verbose)
- fprintf(stderr, "Querying multicast group %d.%d.%d.%d:%d:%d:%d\n",
- sitecast_groups[i].quad1, sitecast_groups[i].quad2,
- sitecast_groups[i].quad3, sitecast_groups[i].quad4,
- sitecast_groups[i].port, sitecast_groups[i].ttl,
- sitecast_groups[i].timewait);
-
- bzero(&srv, sizeof(srv));
- srv.sin_family = AF_INET;
- srv.sin_port = htons(sitecast_groups[i].port);
- srv.sin_addr.s_addr = htonl(sitecast_groups[i].quad1*0x1000000
- + sitecast_groups[i].quad2*0x10000
- + sitecast_groups[i].quad3*0x100
- + sitecast_groups[i].quad4);
-
- /* send off queries, one for each source file */
-
- GRSThtcpTSTrequestMake(&request, &request_length,
- (int) (start_timeval.tv_usec),
- "GET", *source_ptr, "");
-
- sendto(s, request, request_length, 0,
- (struct sockaddr *) &srv, sizeof(srv));
-
- free(request);
-
- /* reusing wait_timeval is a Linux-specific feature of select() */
- wait_timeval.tv_usec = 0;
- wait_timeval.tv_sec = sitecast_groups[i].timewait;
-
- while ((wait_timeval.tv_sec > 0) || (wait_timeval.tv_usec > 0))
- {
- FD_ZERO(&readsckts);
- FD_SET(s, &readsckts);
-
- ret = select(s + 1, &readsckts, NULL, NULL, &wait_timeval);
-
- if (ret > 0)
- {
- response_length = recvfrom(s, response, MAXBUF,
- 0, &from, &fromlen);
-
- if ((GRSThtcpMessageParse(&msg, response, response_length)
- == GRST_RET_OK) &&
- (msg.opcode == GRSThtcpTSTop) && (msg.rr == 1) &&
- (msg.trans_id == (int) start_timeval.tv_usec) &&
- (msg.resp_hdrs != NULL) &&
- (GRSThtcpCountstrLen(msg.resp_hdrs) > 12))
- {
- /* found one */
-
- if (common_data_ptr->verbose > 0)
- fprintf(stderr, "Sitecast %s -> %.*s\n",
- *source_ptr,
- GRSThtcpCountstrLen(msg.resp_hdrs) - 12,
- &(msg.resp_hdrs->text[10]));
-
- free(*source_ptr);
-
- asprintf(source_ptr, "%.*s",
- GRSThtcpCountstrLen(msg.resp_hdrs) - 12,
- &(msg.resp_hdrs->text[10]));
-
- return GRST_RET_OK;
- }
- }
- }
-
- }
-
- return GRST_RET_OK;
-}
-
-size_t rawindex_callback(void *ptr, size_t size, size_t nmemb, void *data)
-{
- if ( ((struct grst_index_blob *) data)->used + size * nmemb >=
- ((struct grst_index_blob *) data)->allocated )
- {
- ((struct grst_index_blob *) data)->allocated =
- ((struct grst_index_blob *) data)->used + size * nmemb + 4096;
-
- ((struct grst_index_blob *) data)->text =
- realloc( ((struct grst_index_blob *) data)->text,
- ((struct grst_index_blob *) data)->allocated );
- }
-
- memcpy( &( ((struct grst_index_blob *)
- data)->text[((struct grst_index_blob *) data)->used] ),
- ptr, size * nmemb);
-
- ((struct grst_index_blob *) data)->used += size * nmemb;
-
- return size * nmemb;
-}
-
-char *canonicalise(char *link, char *source)
-{
- int i, j, srclen;
- char *s;
-
- srclen = strlen(source);
-
- if ((strncmp(link, "https://", 8) == 0) ||
- (strncmp(link, "http://", 7) == 0))
- {
- if (strncmp(link, source, srclen) != 0) return NULL; /* other site */
-
- if (link[srclen] == '\0') return NULL; /* we dont self-link! */
-
- for (i=0; link[srclen + i] != '\0'; ++i)
- if (link[srclen + i] == '/')
- {
- if (link[srclen + i + 1] != '\0') return NULL; /* no subdirs */
- else return strdup(&link[srclen]); /* resolves to this dir */
- }
- }
- else if (link[0] != '/') /* relative link - need to check for subsubdirs */
- {
- for (i=0; link[i] != '\0'; ++i)
- if ((link[i] == '/') && (link[i+1] != '\0')) return NULL;
-
- s = strdup(link);
-
- for (i=0; s[i] != '\0'; ++i)
- if (s[i] == '#')
- {
- s[i] = '\0';
- break;
- }
-
- return s;
- }
-
- /* absolute link on this server, starting / */
-
- for (i=8; source[i] != '\0'; ++i) if (source[i] == '/') break;
-
- if (strncmp(link, &source[i], srclen - i) != 0) return NULL;
-
- for (j = srclen - i; link[j] != '\0'; ++j)
- if ((link[j] == '/') && (link[j+1] != '\0')) return NULL;
-
- s = strdup(&link[srclen - i]);
-
- for (i=0; s[i] != '\0'; ++i)
- if (s[i] == '#')
- {
- s[i] = '\0';
- break;
- }
-
- if (s[0] == '\0') /* on second thoughts... */
- {
- free(s);
- return NULL;
- }
-
- return s;
-}
-
-int grst_dir_list_cmp(const void *a, const void *b)
-{
- return strcmp( ((struct grst_dir_list *) a)->filename,
- ((struct grst_dir_list *) b)->filename);
-}
-
-struct grst_dir_list *index_to_dir_list(char *text, char *source)
-{
- int taglevel = 0, wordnew = 1, i, namestart, used = 0,
- allocated = 256;
- char *p, *s;
- struct grst_dir_list *list;
-
- list = (struct grst_dir_list *)
- malloc(allocated * sizeof(struct grst_dir_list));
-
- list[0].filename = NULL;
- list[0].length = 0;
- list[0].length_set = 0;
- list[0].modified = 0;
- list[0].modified_set = 0;
-
- for (p=text; *p != '\0'; ++p)
- {
- if (*p == '<')
- {
- ++taglevel;
-
- if ((taglevel == 1) && (list[used].filename != NULL))
- {
- ++used;
- if (used >= allocated)
- {
- allocated += 256;
- list = (struct grst_dir_list *)
- realloc((void *) list,
- allocated * sizeof(struct grst_dir_list));
- }
-
- list[used].filename = NULL;
- list[used].length = 0;
- list[used].length_set = 0;
- list[used].modified = 0;
- list[used].modified_set = 0;
- }
-
- wordnew = 1;
- continue;
- }
-
- if (*p == '>')
- {
- --taglevel;
- wordnew = 1;
- continue;
- }
-
- if (isspace(*p))
- {
- wordnew = 1;
- continue;
- }
-
- if ((wordnew) && (taglevel == 1))
- {
- if (((*p == 'h') || (*p == 'H')) &&
- (strncasecmp(p, "href=", 5) == 0))
- {
- if (p[5] == '"') { namestart = 6;
- for (i=namestart; (p[i] != '\0') &&
- (p[i] != '"' ) &&
- (p[i] != '\n') &&
- (p[i] != '\t') &&
- (p[i] != '>' ) ; ++i) ; }
- else { namestart = 5;
- for (i=namestart; (p[i] != '\0') &&
- (p[i] != '"' ) &&
- (p[i] != ' ' ) &&
- (p[i] != '\n') &&
- (p[i] != '\t') &&
- (p[i] != ')' ) &&
- (p[i] != '>' ) ; ++i) ; }
- if (i > namestart)
- {
- s = malloc(1 + i - namestart);
- memcpy(s, &p[namestart], i - namestart);
- s[i - namestart] = '\0';
-
- list[used].filename = canonicalise(s, source);
- free(s);
- }
-
- p = &p[i-1]; /* -1 since continue results in ++i */
- continue;
- }
-
- if (((*p == 'c') || (*p == 'C')) &&
- (strncasecmp(p, "content-length=", 15) == 0))
- {
- list[used].length = 0;
- list[used].length_set = 1;
-
- if (p[15] == '"') list[used].length = atoi(&p[16]);
- else list[used].length = atoi(&p[15]);
-
- p = &p[15];
- continue;
- }
-
- if (((*p == 'l') || (*p == 'L')) &&
- (strncasecmp(p, "last-modified=", 14) == 0))
- {
- list[used].modified = 0;
- list[used].modified_set = 1;
-
- if (p[14] == '"') list[used].modified = atoi(&p[15]);
- else list[used].modified = atoi(&p[14]);
-
- p = &p[14];
- continue;
- }
- }
-
- wordnew = 0;
- }
-
- qsort((void *) list, used, sizeof(struct grst_dir_list), grst_dir_list_cmp);
-
- return list;
-}
-
-int do_listings(char *sources[], struct grst_stream_data *common_data,
- int islonglist)
-{
- int isrc, anyerror = 0, thiserror, i, isdir, ilast;
- CURL *easyhandle;
- const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
- char *s;
- struct grst_index_blob rawindex;
- struct grst_dir_list *list;
- struct grst_header_data header_data;
- struct tm modified_tm;
- time_t now;
-
- time(&now);
-
- header_data.common_data = common_data;
-
- easyhandle = curl_easy_init();
-
- curl_easy_setopt(easyhandle, CURLOPT_USERAGENT, common_data->useragent);
- if (common_data->verbose > 1)
- curl_easy_setopt(easyhandle, CURLOPT_VERBOSE, 1);
-
- curl_easy_setopt(easyhandle, CURLOPT_WRITEHEADER, &header_data);
- curl_easy_setopt(easyhandle, CURLOPT_HEADERFUNCTION, headers_callback);
-
- curl_easy_setopt(easyhandle, CURLOPT_ERRORBUFFER, common_data->errorbuf);
-
- set_std_opts(easyhandle, common_data);
-
- for (isrc=0; sources[isrc] != NULL; ++isrc)
- {
- if (common_data->verbose > 0)
- fprintf(stderr, "Listing %s\n", sources[isrc]);
-
- if (sources[1] != NULL) printf("\n%s:\n", sources[isrc]);
-
- curl_easy_setopt(easyhandle, CURLOPT_URL, sources[isrc]);
-
- if (sources[isrc][strlen(sources[isrc])-1] == '/')
- {
- isdir = 1;
- curl_easy_setopt(easyhandle,CURLOPT_WRITEFUNCTION,rawindex_callback);
- curl_easy_setopt(easyhandle,CURLOPT_WRITEDATA,(void *) &rawindex);
- curl_easy_setopt(easyhandle,CURLOPT_NOBODY,0);
- rawindex.text = NULL;
- rawindex.used = 0;
- rawindex.allocated = 0;
- }
- else
- {
- isdir = 0;
- curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION, NULL);
- curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA, NULL);
- curl_easy_setopt(easyhandle, CURLOPT_NOBODY, 1);
- }
-
- header_data.gridhttponetime = NULL;
- header_data.length_set = 0;
- header_data.modified_set = 0;
- header_data.retcode = 0;
- thiserror = curl_easy_perform(easyhandle);
-
- if ((thiserror != 0) ||
- (header_data.retcode < 200) ||
- (header_data.retcode >= 300))
- {
- fprintf(stderr, "... curl error: %s (%d), HTTP error: %d\n",
- common_data->errorbuf, thiserror, header_data.retcode);
-
- if (thiserror != 0) anyerror = thiserror;
- else anyerror = header_data.retcode;
- }
- else if (isdir)
- {
- if (common_data->verbose > 0)
- fprintf(stderr, "... OK (%d)\n", header_data.retcode);
-
- rawindex.text[rawindex.used] = '\0';
-
- list = index_to_dir_list(rawindex.text, sources[isrc]);
- ilast = -1;
-
- for (i=0; list[i].filename != NULL; ++i)
- {
- if (list[i].filename[0] == '.') continue;
-
- if (strncmp(list[i].filename, "mailto:", 7) == 0) continue;
-
- if ((ilast >= 0) &&
- (strcmp(list[i].filename, list[ilast].filename) == 0))
- continue;
- ilast=i;
-
- if (islonglist)
- {
- if (!list[i].length_set || !list[i].modified_set)
- {
- curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION,
- NULL);
- curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA, NULL);
- curl_easy_setopt(easyhandle, CURLOPT_NOBODY, 1);
-
- asprintf(&s, "%s%s", sources[isrc], list[i].filename);
- curl_easy_setopt(easyhandle, CURLOPT_URL, s);
-
- header_data.gridhttponetime = NULL;
- header_data.length_set = 0;
- header_data.modified_set = 0;
- header_data.retcode = 0;
- thiserror = curl_easy_perform(easyhandle);
- free(s);
-
- if ((thiserror == 0) &&
- (header_data.retcode >= 200) &&
- (header_data.retcode <= 299))
- {
- if (header_data.length_set)
- {
- list[i].length_set = 1;
- list[i].length = header_data.length;
- }
-
- if (header_data.modified_set)
- {
- list[i].modified_set = 1;
- list[i].modified = header_data.modified;
- }
- }
- }
-
- if (list[i].length_set) printf("%10ld ", list[i].length);
- else fputs(" ? ", stdout);
-
- if (list[i].modified_set)
- {
- localtime_r(&(list[i].modified), &modified_tm);
-
- if (list[i].modified < now - 15552000)
- printf("%s %2d %4d ",
- months[modified_tm.tm_mon],
- modified_tm.tm_mday,
- modified_tm.tm_year + 1900);
- else printf("%s %2d %02d:%02d ",
- months[modified_tm.tm_mon],
- modified_tm.tm_mday,
- modified_tm.tm_hour,
- modified_tm.tm_min);
- }
- else fputs(" ? ? ? ", stdout);
- }
-
- puts(list[i].filename);
- }
- }
- else
- {
- if (islonglist)
- {
- printf("%10ld ", header_data.length);
-
- localtime_r(&(header_data.modified), &modified_tm);
-
- if (header_data.modified < now - 15552000)
- printf("%s %2d %4d ",
- months[modified_tm.tm_mon],
- modified_tm.tm_mday,
- modified_tm.tm_year + 1900);
- else printf("%s %2d %02d:%02d ",
- months[modified_tm.tm_mon],
- modified_tm.tm_mday,
- modified_tm.tm_hour,
- modified_tm.tm_min);
- }
-
- puts(sources[isrc]);
- }
- }
-
- curl_easy_cleanup(easyhandle);
-
- return anyerror;
-}
-
-#if (LIBCURL_VERSION_NUM < 0x070908)
-char *make_tmp_ca_roots(char *dir)
-/* libcurl before 7.9.8 doesnt support CURLOPT_CAPATH and the directory,
- so we make a temporary file with the concatenated CA root certs: that
- is, all the files in that directory which end in .0 */
-{
- int ofd, ifd, c;
- size_t size;
- char tmp_ca_roots[] = "/tmp/.ca-roots-XXXXXX", buffer[4096], *s;
- DIR *rootsDIR;
- struct dirent *root_ent;
-
- if ((rootsDIR = opendir(dir)) == NULL) return NULL;
-
- if ((ofd = mkstemp(tmp_ca_roots)) == -1)
- {
- closedir(rootsDIR);
- return NULL;
- }
-
- while ((root_ent = readdir(rootsDIR)) != NULL)
- {
- if ((root_ent->d_name[0] != '.') &&
- (strlen(root_ent->d_name) > 2) &&
- (strncmp(&(root_ent->d_name[strlen(root_ent->d_name)-2]),
- ".0", 2) == 0))
- {
- asprintf(&s, "%s/%s", dir, root_ent->d_name);
- ifd = open(s, O_RDONLY);
- free(s);
-
- if (ifd != -1)
- {
- while ((size = read(ifd, buffer, sizeof(buffer))) > 0)
- write(ofd, buffer, size);
- close(ifd);
- }
- }
- }
-
- closedir(rootsDIR);
-
- if (close(ofd) == 0) return strdup(tmp_ca_roots);
-
- unlink(tmp_ca_roots); /* try to clean up */
-
- return NULL;
-}
-#endif
-
-void printsyntax(char *argv0)
-{
- char *p;
-
- p = rindex(argv0, '/');
- if (p != NULL) ++p;
- else p = argv0;
-
- fprintf(stderr, "%s [options] Source-URL[s] [Destination URL]\n"
- "%s is one of a set of clients to fetch files or directory listings\n"
-"from remote servers using HTTP or HTTPS, or to put or delete files or\n"
-"directories onto remote servers using HTTPS. htcp is similar to scp(1)\n"
-"but uses HTTP/HTTPS rather than ssh as its transfer protocol.\n"
-"See the htcp(1) or http://www.gridsite.org/ for details.\n"
-"(Version: %s)\n", p, p, VERSION);
-}
-
-struct option long_options[] = { {"verbose", 0, 0, 'v'},
- {"cert", 1, 0, 0},
- {"key", 1, 0, 0},
- {"capath", 1, 0, 0},
- {"delete", 0, 0, 0},
- {"list", 0, 0, 0},
- {"long-list", 0, 0, 0},
- {"mkdir", 0, 0, 0},
- {"no-verify", 0, 0, 0},
- {"anon", 0, 0, 0},
- {"grid-http", 0, 0, 0},
- {"move", 0, 0, 0},
- {"ping", 0, 0, 0},
- {"groups", 1, 0, 0},
- {"timeout", 1, 0, 0},
- {"sitecast", 0, 0, 0},
- {"domain", 1, 0, 0},
- {"find", 0, 0, 0},
- {"conf", 1, 0, 0},
- {0, 0, 0, 0} };
-
-int update_common_data(struct grst_stream_data *, int, char *);
-
-void parse_conf(struct grst_stream_data *common_data_ptr, char *conf_file)
-{
- int option_index;
- char line[1001], *p;
- FILE *fp;
-
- fp = fopen(conf_file, "r");
- if (fp == NULL)
- {
- if (common_data_ptr->verbose)
- fprintf(stderr, "Failed to open configuration file %s\n", conf_file);
- return;
- }
-
- if (common_data_ptr->verbose)
- fprintf(stderr, "Opened configuration file %s\n", conf_file);
-
- while (fgets(line, sizeof(line), fp) != NULL)
- {
- if ((p = index(line, '\n')) != NULL) *p = '\0';
-
- for (option_index=0;
- long_options[option_index].name != NULL; ++option_index)
- {
- if (long_options[option_index].has_arg &&
- (strncmp(line, long_options[option_index].name,
- strlen(long_options[option_index].name)) == 0) &&
- (line[strlen(long_options[option_index].name)] == '='))
- {
- update_common_data(common_data_ptr, option_index,
- strdup(&line[strlen(long_options[option_index].name) + 1]));
- break;
- }
-
- if (!long_options[option_index].has_arg &&
- (strcmp(line, long_options[option_index].name) == 0))
- {
- update_common_data(common_data_ptr, option_index, "");
- break;
- }
- }
- }
-
- fclose(fp);
-}
-
-int update_common_data(struct grst_stream_data *common_data_ptr,
- int option_index, char *optarg)
-{
- if (option_index == 1) common_data_ptr->cert = optarg;
- else if (option_index == 2) common_data_ptr->key = optarg;
- else if (option_index == 3) common_data_ptr->capath = optarg;
- else if (option_index == 4) common_data_ptr->method = HTCP_DELETE;
- else if (option_index == 5) common_data_ptr->method = HTCP_LIST;
- else if (option_index == 6) common_data_ptr->method = HTCP_LONGLIST;
- else if (option_index == 7) common_data_ptr->method = HTCP_MKDIR;
- else if (option_index == 8) common_data_ptr->noverify = 1;
- else if (option_index == 9) common_data_ptr->anonymous = 1;
- else if (option_index ==10) common_data_ptr->gridhttp = 1;
- else if (option_index ==11) common_data_ptr->method = HTCP_MOVE;
- else if (option_index ==12) common_data_ptr->method = HTCP_PING;
- else if (option_index ==13) common_data_ptr->groups = optarg;
- else if (option_index ==14) common_data_ptr->timeout = atoi(optarg);
- else if (option_index ==15) common_data_ptr->sitecast = 1;
- else if (option_index ==16) { common_data_ptr->sitecast = 1;
- common_data_ptr->domain = optarg; }
- else if (option_index ==17) common_data_ptr->method = HTCP_FIND;
- /* option_index == 18 is used by the --conf command line-only option */
- else return GRST_RET_FAILED;
-
- return GRST_RET_OK;
-}
-
-int main(int argc, char *argv[])
-{
- char **sources, *destination = NULL, *executable, *p, *htcp_conf;
- int c, i, option_index, anyerror;
- struct stat statbuf;
- struct grst_stream_data common_data;
- struct grst_sitecast_group sitecast_groups[HTCP_SITECAST_GROUPS];
- struct passwd *userpasswd;
-
-#if (LIBCURL_VERSION_NUM < 0x070908)
- char *tmp_ca_roots = NULL;
-#endif
-
- if (argc == 1)
- {
- printsyntax(argv[0]);
- return 0;
- }
-
- common_data.cert = NULL;
- common_data.key = NULL;
- common_data.capath = NULL;
- common_data.method = 0;
- common_data.errorbuf = malloc(CURL_ERROR_SIZE);
- asprintf(&(common_data.useragent),
- "htcp/%s (http://www.gridsite.org/)", VERSION);
- common_data.verbose = 0;
- common_data.noverify = 0;
- common_data.anonymous = 0;
- common_data.gridhttp = 0;
-
- common_data.groups = NULL;
- common_data.timeout = 0;
- common_data.sitecast = 0;
- common_data.domain = NULL;
-
- if ((argc > 1) && ((strcmp(argv[1], "--verbose") == 0) ||
- (strcmp(argv[1], "-v") == 0))) common_data.verbose = 1;
-
- /* examine any configuration files */
-
- parse_conf(&common_data, HTCP_HOST_CONF);
-
- userpasswd = getpwuid(geteuid());
- asprintf(&htcp_conf, "%s/%s", userpasswd->pw_dir, HTCP_USER_CONF);
- parse_conf(&common_data, htcp_conf);
- free(htcp_conf);
-
- htcp_conf = getenv("HTCP_CONF");
- if (htcp_conf != NULL) parse_conf(&common_data, htcp_conf);
-
- common_data.verbose = 0;
-
- while (1)
- {
- option_index = 0;
-
- c = getopt_long(argc, argv, "v", long_options, &option_index);
-
- if (c == -1) break;
- else if (c == 0)
- {
- if (option_index == 18) parse_conf(&common_data, optarg);
- else update_common_data(&common_data, option_index, optarg);
- }
- else if (c == 'v') ++(common_data.verbose);
- }
-
- if (common_data.verbose > 0)
- {
- p = rindex(argv[0], '/');
- if (p != NULL) ++p;
- else p = argv[0];
- fprintf(stderr, "%s version %s\n", p, VERSION);
- }
-
- if (common_data.anonymous) /* prevent any use of user certs */
- {
- common_data.cert = NULL;
- common_data.key = NULL;
- }
- else if ((common_data.cert == NULL) && (common_data.key != NULL))
- common_data.cert = common_data.key;
- else if ((common_data.cert != NULL) && (common_data.key == NULL))
- common_data.key = common_data.cert;
- else if ((common_data.cert == NULL) && (common_data.key == NULL))
- {
- common_data.cert = getenv("X509_USER_PROXY");
- if (common_data.cert != NULL) common_data.key = common_data.cert;
- else
- {
- asprintf(&(common_data.cert), "/tmp/x509up_u%d", geteuid());
-
- /* one fine day, we will check the proxy file for expiry too ... */
-
- if (stat(common_data.cert, &statbuf) == 0)
- common_data.key = common_data.cert;
- else
- {
- common_data.cert = getenv("X509_USER_CERT");
- common_data.key = getenv("X509_USER_KEY");
-
- if ((common_data.cert == NULL) &&
- (userpasswd != NULL) &&
- (userpasswd->pw_dir != NULL))
- asprintf(&(common_data.cert), "%s/.globus/usercert.pem",
- userpasswd->pw_dir);
-
- if ((common_data.key == NULL) &&
- (userpasswd != NULL) &&
- (userpasswd->pw_dir != NULL))
- asprintf(&(common_data.key), "%s/.globus/userkey.pem",
- userpasswd->pw_dir);
- }
- }
- }
-
- if (common_data.capath == NULL) common_data.capath = getenv("X509_CERT_DIR");
-
- if (common_data.capath == NULL)
- common_data.capath = "/etc/grid-security/certificates";
-
-#if (LIBCURL_VERSION_NUM < 0x070908)
- /* libcurl before 7.9.8 doesnt support CURLOPT_CAPATH and the directory */
-
- if ((common_data.capath != NULL) &&
- (stat(common_data.capath, &statbuf) == 0) && S_ISDIR(statbuf.st_mode))
- {
- tmp_ca_roots = make_tmp_ca_roots(common_data.capath);
- common_data.capath = tmp_ca_roots;
- }
-#endif
-
- executable = rindex(argv[0], '/');
- if (executable != NULL) executable++;
- else executable = argv[0];
-
- if (common_data.method == 0) /* command-line options override exec name */
- {
- if (strcmp(executable,"htls")==0) common_data.method=HTCP_LIST;
- else if (strcmp(executable,"htll")==0) common_data.method=HTCP_LONGLIST;
- else if (strcmp(executable,"htrm")==0) common_data.method=HTCP_DELETE;
- else if (strcmp(executable,"htmkdir")==0) common_data.method=HTCP_MKDIR;
- else if (strcmp(executable,"htmv")==0) common_data.method=HTCP_MOVE;
- else if (strcmp(executable,"htping")==0) common_data.method=HTCP_PING;
- else if (strcmp(executable,"htfind")==0) common_data.method=HTCP_FIND;
- }
-
- if (common_data.method == HTCP_PING)
- {
- if (common_data.groups != NULL) return do_ping(&common_data);
-
- fprintf(stderr, "Must specify at least one multicast group\n\n");
- printsyntax(argv[0]);
- return CURLE_FAILED_INIT;
- }
-
- if ((common_data.method == HTCP_DELETE) ||
- (common_data.method == HTCP_LIST) ||
- (common_data.method == HTCP_FIND) ||
- (common_data.method == HTCP_MKDIR) ||
- (common_data.method == HTCP_LONGLIST))
- {
- if (optind >= argc)
- {
- fprintf(stderr, "Must give at least 1 non-option argument\n\n");
- printsyntax(argv[0]);
- return CURLE_URL_MALFORMAT;
- }
-
- sources = (char **) malloc(sizeof(char *) * (1 + argc - optind));
- for (i=0; i < argc - optind; ++i)
- {
- sources[i] = argv[optind + i];
-
- if ((common_data.method == HTCP_MKDIR) &&
- (sources[i][strlen(sources[i])-1] != '/'))
- {
- fprintf(stderr, "Argument \"%s\" is not a "
- "directory URL (no trailing /)\n\n", sources[i]);
- printsyntax(argv[0]);
- return CURLE_URL_MALFORMAT;
- }
- }
-
- sources[i] = NULL;
-
- if (common_data.method == HTCP_DELETE)
- anyerror = do_deletes(sources, &common_data);
- else if (common_data.method == HTCP_MKDIR)
- anyerror = do_mkdirs(sources, &common_data);
- else if (common_data.method == HTCP_FIND)
- anyerror = do_finds(sources, &common_data, argc - optind);
- else if (common_data.method == HTCP_LONGLIST)
- anyerror = do_listings(sources, &common_data, 1);
- else anyerror = do_listings(sources, &common_data, 0);
-
- if (anyerror > 99) anyerror = CURLE_HTTP_RETURNED_ERROR;
-
- return anyerror;
- }
-
- if (common_data.method == HTCP_MOVE)
- {
- if (optind >= argc - 1)
- {
- fputs("Must give exactly 2 non-option arguments\n\n", stderr);
- printsyntax(argv[0]);
- return CURLE_URL_MALFORMAT;
- }
-
- anyerror = do_move(argv[optind], argv[optind + 1], &common_data);
-
- if (anyerror > 99) anyerror = CURLE_HTTP_RETURNED_ERROR;
-
- return anyerror;
- }
-
- if (optind >= argc - 1)
- {
- fputs("Must give at least 2 non-option arguments\n\n", stderr);
- printsyntax(argv[0]);
- return CURLE_URL_MALFORMAT;
- }
-
- sources = (char **) malloc(sizeof(char *) * (argc - optind));
-
- for (i=0; i < (argc - optind - 1); ++i)
- {
- if (strncmp(argv[optind + i], "file:", 5) == 0)
- sources[i] = strdup(&argv[optind + i][5]);
- else sources[i] = strdup(argv[optind + i]);
-
- if (sources[i][0] == '\0')
- {
- fprintf(stderr, "Source argument %d is empty\n\n", i + 1);
- printsyntax(argv[0]);
- return CURLE_URL_MALFORMAT;
- }
- }
-
- sources[i] = NULL;
-
- if (strncmp(argv[optind+i], "file:", 5) == 0)
- {
- if ((argv[optind+i][strlen(argv[optind+i]) - 1] != '/') &&
- (stat(&argv[optind + i][5], &statbuf) == 0) &&
- S_ISDIR(statbuf.st_mode))
- asprintf(&destination, "%s/", &argv[optind + i][5]);
- else destination = strdup(&argv[optind + i][5]);
- }
- else if ((strncmp(argv[optind+i], "http://", 7) != 0) &&
- (strncmp(argv[optind+i], "https://", 8) != 0))
- {
- if ((argv[optind+i][strlen(argv[optind+i]) - 1] != '/') &&
- (stat(argv[optind+i], &statbuf) == 0) &&
- S_ISDIR(statbuf.st_mode))
- asprintf(&destination, "%s/", argv[optind+i]);
- else destination = strdup(argv[optind+i]);
- }
- else destination = strdup(argv[optind+i]);
-
- if (destination[0] == '\0')
- {
- fputs("Destination argument is empty\n\n", stderr);
- printsyntax(argv[0]);
- return CURLE_URL_MALFORMAT;
- }
-
- if ((argc - optind > 2) && (destination[strlen(destination)-1] != '/'))
- {
- fputs("For multiple sources, destination "
- "must be a directory (end in /)\n\n", stderr);
- printsyntax(argv[0]);
- return CURLE_URL_MALFORMAT;
- }
-
- if ((strncmp(destination, "http://", 7) == 0) ||
- (strncmp(destination, "https://", 8) == 0))
- common_data.method = HTCP_PUT;
- else common_data.method = HTCP_GET;
-
- for (i=0; sources[i] != NULL; ++i)
- {
- if ((common_data.method == HTCP_PUT) &&
- ((strncmp(sources[i], "http://", 7) == 0) ||
- (strncmp(sources[i], "https://", 8) == 0)))
- {
- fputs("Cannot have both source and destination remote\n\n",stderr);
- printsyntax(argv[0]);
- return CURLE_URL_MALFORMAT;
- }
-
- if (common_data.method == HTCP_GET)
- {
- if ((strncmp(sources[i], "http://", 7) != 0) &&
- (strncmp(sources[i], "https://", 8) != 0))
- {
- fputs("Cannot have both source and "
- "destination local (for now)\n\n",stderr);
- printsyntax(argv[0]);
- return CURLE_URL_MALFORMAT;
- }
-
- if ((common_data.sitecast) &&
- ((common_data.domain == NULL) ||
-
- ((strncmp(sources[i], "http://", 7) == 0) &&
- (strncmp(&sources[i][7], common_data.domain,
- strlen(common_data.domain)) == 0) &&
- ((sources[i][7+strlen(common_data.domain)] == ':') ||
- (sources[i][7+strlen(common_data.domain)] == '/'))) ||
-
- ((strncmp(sources[i], "https://", 8) == 0) &&
- (strncmp(&sources[i][8], common_data.domain,
- strlen(common_data.domain)) == 0) &&
- ((sources[i][8+strlen(common_data.domain)] == ':') ||
- (sources[i][8+strlen(common_data.domain)] == '/')))))
- {
- translate_sitecast_url(&sources[i], &common_data);
- }
- }
- }
-
- anyerror = do_copies(sources, destination, &common_data);
- if (anyerror > 99) anyerror = CURLE_HTTP_RETURNED_ERROR;
-
- return anyerror;
-}
+++ /dev/null
-/*
- Copyright (c) 2002-4, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
-
-Build with:
-
-gcc -lcurl -lssl -lcrypto -o grst-proxy-put grst-proxy-put.c libgridsite.a
-
-http://www.gridpp.ac.uk/authz/gridsite/
-
-*/
-
-#ifndef VERSION
-#define VERSION "0.0.0"
-#endif
-
-#define _GNU_SOURCE
-
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <curl/curl.h>
-#include <curl/types.h>
-#include <curl/easy.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <openssl/x509.h>
-#include <openssl/x509v3.h>
-#include <openssl/err.h>
-#include <openssl/pem.h>
-
-#include <curl/curl.h>
-#include <curl/types.h>
-#include <curl/easy.h>
-
-#include <getopt.h>
-
-#include "gridsite.h"
-
-#include "soapH.h"
-#include "delegation.nsmap"
-
-#define USE_SOAP 0
-#define USE_G_HTTPS 1
-#define HTPROXY_PUT 0
-
-int debugfunction(CURL *curl, curl_infotype type, char *s, size_t n, void *p)
-{
- fwrite(s, sizeof(char), n, (FILE *) p);
-
- return 0;
-}
-
-size_t parsegprheaders(void *ptr, size_t size, size_t nmemb, void *p)
-{
- int i;
-
- if ((size * nmemb > 15) &&
- (strncmp((char *) ptr, "Delegation-ID: ", 15) == 0))
- {
- *((char **) p) = malloc( size * nmemb - 14 );
-
- memcpy(*((char **) p), &(((char *) ptr)[15]), size * nmemb - 15);
-
- for (i=0; i < size * nmemb - 15; ++i)
- if (((*((char **) p))[i] == '\n') || ((*((char **) p))[i] == '\r'))
- {
- (*((char **) p))[i] = '\0'; /* drop trailing newline */
- break;
- }
-
- (*((char **) p))[size * nmemb - 15] = '\0';
- }
-
- return size * nmemb;
-}
-
-struct gprparams { char *req; size_t len; } ;
-
-size_t storegprbody(void *ptr, size_t size, size_t nmemb, void *p)
-{
- ((struct gprparams *) p)->req = realloc( ((struct gprparams *) p)->req,
- ((struct gprparams *) p)->len + size * nmemb + 1);
-
- memcpy( &((((struct gprparams *) p)->req)[((struct gprparams *) p)->len]),
- ptr, size * nmemb);
-
- ((struct gprparams *) p)->len += size * nmemb;
-
- return size * nmemb;
-}
-
-int GRSTgetProxyReq(CURL *curl, FILE *debugfp, char *delegid, char **reqtxt,
- char *requrl, char *cert, char *key)
-{
- char *delheader;
- struct curl_slist *headerlist = NULL;
- CURLcode res;
- struct gprparams params;
-
- params.req = NULL;
- params.len = 0;
-
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *) ¶ms);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, storegprbody);
-
- curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "PEM");
- curl_easy_setopt(curl, CURLOPT_SSLCERT, cert);
-
- curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, "PEM");
- curl_easy_setopt(curl, CURLOPT_SSLKEY, key);
- curl_easy_setopt(curl, CURLOPT_SSLKEYPASSWD, NULL);
-
-// curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, parsegprheaders);
-// curl_easy_setopt(curl, CURLOPT_WRITEHEADER, (void *) delegid);
-
- curl_easy_setopt(curl, CURLOPT_CAPATH, "/etc/grid-security/certificates/");
-
- curl_easy_setopt(curl, CURLOPT_URL, requrl);
- curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET-PROXY-REQ");
-
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER,0);
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST,0);
-
- asprintf(&delheader, "Delegation-ID: %s", delegid);
- headerlist = curl_slist_append(headerlist, delheader);
- curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
-
- if (debugfp != NULL)
- {
- curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
- curl_easy_setopt(curl, CURLOPT_DEBUGDATA, debugfp);
- curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, debugfunction);
- }
-
- res = curl_easy_perform(curl);
-
- if (params.req != NULL)
- {
- params.req[params.len] = '\0';
- *reqtxt = params.req;
- }
- else *reqtxt = NULL;
-
- return (int) res;
-}
-
-struct ppcparams{ char *cert; size_t len; };
-
-size_t getppcbody(void *ptr, size_t size, size_t nmemb, void *p)
-{
- size_t i;
-
- if (((struct ppcparams *) p)->len == 0) return 0;
-
- if (size * nmemb < ((struct ppcparams *) p)->len) i = size * nmemb;
- else i = ((struct ppcparams *) p)->len;
-
- memcpy(ptr, ((struct ppcparams *) p)->cert, i);
-
- ((struct ppcparams *) p)->len -= i;
- ((struct ppcparams *) p)->cert = &((((struct ppcparams *) p)->cert)[i+1]);
-
- return i;
-}
-
-int GRSTputProxyCerts(CURL *curl, FILE *debugfp, char *delegid, char *certtxt,
- char *requrl, char *cert, char *key)
-{
- CURLcode res;
- char *delheader;
- long httpcode;
- struct curl_slist *headerlist = NULL;
- struct ppcparams params;
-
- params.cert = certtxt;
- params.len = strlen(certtxt);
-
- curl_easy_setopt(curl, CURLOPT_READDATA, ¶ms);
- curl_easy_setopt(curl, CURLOPT_READFUNCTION, getppcbody);
- curl_easy_setopt(curl, CURLOPT_INFILESIZE, strlen(certtxt));
- curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
-
- curl_easy_setopt(curl, CURLOPT_NOBODY, 1);
-
- curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "PEM");
- curl_easy_setopt(curl, CURLOPT_SSLCERT, cert);
-
- curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, "PEM");
- curl_easy_setopt(curl, CURLOPT_SSLKEY, key);
-// curl_easy_setopt(curl, CURLOPT_SSLKEYPASSWD, NULL);
-
- curl_easy_setopt(curl, CURLOPT_CAPATH, "/etc/grid-security/certificates/");
-
- curl_easy_setopt(curl, CURLOPT_URL, requrl);
- curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT-PROXY-CERT");
-
- headerlist = curl_slist_append(headerlist,
- "Content-Type: application/x-x509-user-cert-chain");
-
- asprintf(&delheader, "Delegation-ID: %s", delegid);
- headerlist = curl_slist_append(headerlist, delheader);
- curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
-
-curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
-curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
-
- if (debugfp != NULL)
- {
- curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
- curl_easy_setopt(curl, CURLOPT_DEBUGDATA, debugfp);
- curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, debugfunction);
- }
-
- res = curl_easy_perform(curl);
-
- curl_easy_getinfo(curl, CURLINFO_HTTP_CODE, &httpcode);
-
- curl_slist_free_all(headerlist);
-
- free(delheader);
-
- return (int) res;
-}
-
-
-#if (LIBCURL_VERSION_NUM < 0x070908)
-char *make_tmp_ca_roots(char *dir)
-/* libcurl before 7.9.8 doesnt support CURLOPT_CAPATH and the directory,
- so we make a temporary file with the concatenated CA root certs: that
- is, all the files in that directory which end in .0 */
-{
- int ofd, ifd, c;
- size_t size;
- char tmp_ca_roots[] = "/tmp/.ca-roots-XXXXXX", buffer[4096], *s;
- DIR *rootsDIR;
- struct dirent *root_ent;
-
- if ((rootsDIR = opendir(dir)) == NULL) return NULL;
-
- if ((ofd = mkstemp(tmp_ca_roots)) == -1)
- {
- closedir(rootsDIR);
- return NULL;
- }
-
- while ((root_ent = readdir(rootsDIR)) != NULL)
- {
- if ((root_ent->d_name[0] != '.') &&
- (strlen(root_ent->d_name) > 2) &&
- (strncmp(&(root_ent->d_name[strlen(root_ent->d_name)-2]),
- ".0", 2) == 0))
- {
- asprintf(&s, "%s/%s", dir, root_ent->d_name);
- ifd = open(s, O_RDONLY);
- free(s);
-
- if (ifd != -1)
- {
- while ((size = read(ifd, buffer, sizeof(buffer))) > 0)
- write(ofd, buffer, size);
-
- close(ifd);
- }
- }
- }
-
- closedir(rootsDIR);
-
- if (close(ofd) == 0) return strdup(tmp_ca_roots);
-
- unlink(tmp_ca_roots); /* try to clean up if errors */
-
- return NULL;
-}
-#endif
-
-void printsyntax(char *argv0)
-{
- char *p;
-
- p = rindex(argv0, '/');
- if (p != NULL) ++p;
- else p = argv0;
-
- fprintf(stderr, "%s [options] URL\n"
- "(Version: %s)\n", p, VERSION);
-}
-
-int main(int argc, char *argv[])
-{
- char *delegation_id = "", *reqtxt, *certtxt, *valid = NULL,
- *cert = NULL, *key = NULL, *capath = NULL, *keycert;
- struct ns__putProxyResponse *unused;
- int option_index, c, protocol = USE_SOAP, noverify = 0,
- method = HTPROXY_PUT, verbose = 0, fd, minutes;
- struct soap soap_get, soap_put;
- FILE *ifp, *ofp;
- struct stat statbuf;
- struct passwd *userpasswd;
- struct option long_options[] = { {"verbose", 0, 0, 'v'},
- {"cert", 1, 0, 0},
- {"key", 1, 0, 0},
- {"capath", 1, 0, 0},
- {"soap", 0, 0, 0},
- {"g-https", 0, 0, 0},
- {"no-verify", 0, 0, 0},
- {"valid", 1, 0, 0},
- {"delegation-id",1, 0, 0},
- {"put", 0, 0, 0},
- {0, 0, 0, 0} };
- CURL *curl;
-
- if (argc == 1)
- {
- printsyntax(argv[0]);
- return 0;
- }
-
- while (1)
- {
- option_index = 0;
-
- c = getopt_long(argc, argv, "v", long_options, &option_index);
-
- if (c == -1) break;
- else if (c == 0)
- {
- if (option_index == 1) cert = optarg;
- else if (option_index == 2) key = optarg;
- else if (option_index == 3) capath = optarg;
- else if (option_index == 4) protocol = USE_SOAP;
- else if (option_index == 5) protocol = USE_G_HTTPS;
- else if (option_index == 6) noverify = 1;
- else if (option_index == 7) valid = optarg;
- else if (option_index == 8) delegation_id = optarg;
- else if (option_index == 9) method = HTPROXY_PUT;
- }
- else if (c == 'v') ++verbose;
- }
-
- if (optind + 1 != argc)
- {
- fprintf(stderr, "Must specify a target URL!\n");
- return 1;
- }
-
- if (valid == NULL) minutes = 60 * 12;
- else minutes = atoi(valid);
-
- if (verbose) fprintf(stderr, "Proxy valid for %d minutes\n", minutes);
-
- ERR_load_crypto_strings ();
- OpenSSL_add_all_algorithms();
-
- if ((cert == NULL) && (key != NULL)) cert = key;
- else if ((cert != NULL) && (key == NULL)) key = cert;
- else if ((cert == NULL) && (key == NULL))
- {
- cert = getenv("X509_USER_PROXY");
- if (cert != NULL) key = cert;
- else
- {
- asprintf(&(cert), "/tmp/x509up_u%d", geteuid());
-
- /* one fine day, we will check the proxy file for
- expiry too to avoid suprises when we try to use it ... */
-
- if (stat(cert, &statbuf) == 0) key = cert;
- else
- {
- cert = getenv("X509_USER_CERT");
- key = getenv("X509_USER_KEY");
-
- userpasswd = getpwuid(geteuid());
-
- if ((cert == NULL) &&
- (userpasswd != NULL) &&
- (userpasswd->pw_dir != NULL))
- asprintf(&(cert), "%s/.globus/usercert.pem",
- userpasswd->pw_dir);
-
- if ((key == NULL) &&
- (userpasswd != NULL) &&
- (userpasswd->pw_dir != NULL))
- asprintf(&(key), "%s/.globus/userkey.pem",
- userpasswd->pw_dir);
-
- }
- }
- }
-
- if (capath == NULL) capath = getenv("X509_CERT_DIR");
- if (capath == NULL) capath = "/etc/grid-security/certificates";
-
- if (verbose) fprintf(stderr, "key=%s\ncert=%s\ncapath=%s\n",
- key, cert, capath);
-
-#if (LIBCURL_VERSION_NUM < 0x070908)
- /* libcurl before 7.9.8 doesnt support CURLOPT_CAPATH and the directory */
-
- if ((capath != NULL) &&
- (stat(capath, &statbuf) == 0) && S_ISDIR(statbuf.st_mode))
- {
- tmp_ca_roots = make_tmp_ca_roots(capath);
- capath = tmp_ca_roots;
- }
-#endif
-
- if (protocol == USE_G_HTTPS)
- {
- if (verbose) fprintf(stderr, "Using G-HTTPS delegation protocol\n");
-
- if (verbose) fprintf(stderr, "Delegation-ID: %s\n", delegation_id);
-
- curl_global_init(CURL_GLOBAL_DEFAULT);
- curl = curl_easy_init();
-
-// curl_easy_setopt(curl, CURLOPT_SSLKEYPASSWD, NULL);
-
- GRSTgetProxyReq(curl, stderr, delegation_id, &reqtxt,
- argv[optind], cert, key);
-
- if (GRSTx509MakeProxyCert(&certtxt, stderr, reqtxt, cert, key, minutes)
- != GRST_RET_OK)
- {
- return 1;
- }
-
- GRSTputProxyCerts(curl, stderr, delegation_id, certtxt,
- argv[optind], cert, key);
-
- curl_easy_cleanup(curl);
- curl_global_cleanup();
-
- return 0;
- }
- else if (protocol == USE_SOAP)
- {
- if (strcmp(key, cert) != 0) /* we have to concatenate for gSOAP */
- {
- keycert = strdup("/tmp/XXXXXX");
-
- fd = mkstemp(keycert);
- ofp = fdopen(fd, "w");
-
- ifp = fopen(key, "r");
- while ((c = fgetc(ifp)) != EOF) fputc(c, ofp);
- fclose(ifp);
-
- ifp = fopen(cert, "r");
- while ((c = fgetc(ifp)) != EOF) fputc(c, ofp);
- fclose(ifp);
-
- fclose(ofp);
-
- if (verbose) fprintf(stderr, "Created %s key/cert file\n", keycert);
- }
- else keycert = key;
-
- if (verbose)
- {
- fprintf(stderr, "Using SOAP delegation protocol\n");
- fprintf(stderr, "Delegation-ID: %s\n", delegation_id);
- fprintf(stderr, "Send getProxyReq to service\n");
- }
-
- soap_init(&soap_get);
-
- if (soap_ssl_client_context(&soap_get,
- SOAP_SSL_DEFAULT,
- keycert,
- "",
- NULL,
- capath,
- NULL))
- {
- soap_print_fault(&soap_get, stderr);
- return 1;
- }
-
- soap_call_ns__getProxyReq(&soap_get,
- argv[optind], /* HTTPS url of service */
- "", /* no password on proxy */
- delegation_id,
- &reqtxt);
-
- if (soap_get.error)
- {
- soap_print_fault(&soap_get, stderr);
- return 1;
- }
-
- if (verbose) fprintf(stderr, "reqtxt:\n%s", reqtxt);
-
- if (GRSTx509MakeProxyCert(&certtxt, stderr, reqtxt, cert, key, minutes)
- != GRST_RET_OK)
- {
- return 1;
- }
-
- soap_init(&soap_put);
-
- if (verbose) fprintf(stderr, "Send putProxy to service:\n%s\n", certtxt);
-
- if (soap_ssl_client_context(&soap_put,
- SOAP_SSL_DEFAULT,
- keycert,
- "",
- NULL,
- capath,
- NULL))
- {
- soap_print_fault(&soap_put, stderr);
- return 1;
- }
-
- soap_call_ns__putProxy(&soap_put, argv[optind], "", delegation_id,
- certtxt, unused);
- if (soap_put.error)
- {
- soap_print_fault(&soap_put, stderr);
- return 1;
- }
-
- return 0;
- }
-
- /* weirdness */
-}
-
+++ /dev/null
-/*
- Copyright (c) 2003-5, Andrew McNab and Shiv Kaushal,
- University of Manchester. All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*------------------------------------------------------------------*
- * This program is part of GridSite: http://www.gridsite.org/ *
- *------------------------------------------------------------------*/
-
-#ifndef VERSION
-#define VERSION "x.x.x"
-#endif
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <apr_strings.h>
-#include <apr_tables.h>
-
-#include <ap_config.h>
-#include <httpd.h>
-#include <http_config.h>
-#include <http_core.h>
-#include <http_log.h>
-#include <http_protocol.h>
-#include <http_request.h>
-#include <unixd.h>
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <malloc.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dirent.h>
-#include <ctype.h>
-#include <time.h>
-
-#include <sys/select.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-
-
-#include "mod_ssl-private.h"
-
-#include "gridsite.h"
-
-#ifndef UNSET
-#define UNSET -1
-#endif
-
-module AP_MODULE_DECLARE_DATA gridsite_module;
-
-#define GRST_SITECAST_GROUPS 32
-
-struct sitecast_group
- { int socket; int quad1; int quad2; int quad3; int quad4; int port; };
-
-#define GRST_SITECAST_ALIASES 32
-
-struct sitecast_alias
- { const char *sitecast_url; const char *local_path; server_rec *server; };
-
-/* Globals, defined by main server directives in httpd.conf
- These are assigned default values in create_gridsite_srv_config() */
-
-int gridhttpport = 0;
-char *onetimesdir = NULL;
-char *sitecastdnlists = NULL;
-struct sitecast_group sitecastgroups[GRST_SITECAST_GROUPS+1];
-struct sitecast_alias sitecastaliases[GRST_SITECAST_ALIASES];
-
-typedef struct
-{
- int auth;
- int envs;
- int format;
- int indexes;
- char *indexheader;
- int gridsitelink;
- char *adminfile;
- char *adminuri;
- char *helpuri;
- char *dnlists;
- char *dnlistsuri;
- char *adminlist;
- int gsiproxylimit;
- char *unzip;
- char *methods;
- char *editable;
- char *headfile;
- char *footfile;
- int gridhttp;
- int soap2cgi;
- char *aclformat;
- char *execmethod;
- ap_unix_identity_t execugid;
- apr_fileperms_t diskmode;
-} mod_gridsite_dir_cfg; /* per-directory config choices */
-
-typedef struct
-{
- xmlDocPtr doc;
-// char *outbuffer;
-} soap2cgi_ctx; /* store per-request context for Soap2cgi in/out filters */
-
-static const char Soap2cgiFilterName[]="Soap2cgiFilter";
-
-static void mod_gridsite_soap2cgi_insert(request_rec *r)
-{
- mod_gridsite_dir_cfg *conf;
- soap2cgi_ctx *ctx;
-
- conf = (mod_gridsite_dir_cfg *) ap_get_module_config(r->per_dir_config,
- &gridsite_module);
-
- if (conf->soap2cgi)
- {
- ctx = (soap2cgi_ctx *) malloc(sizeof(soap2cgi_ctx));
- ctx->doc = NULL;
-
- ap_add_output_filter(Soap2cgiFilterName, ctx, r, r->connection);
-
- ap_add_input_filter(Soap2cgiFilterName, NULL, r, r->connection);
- }
-}
-
-xmlNodePtr find_one_child(xmlNodePtr parent_node, char *name)
-{
- xmlNodePtr cur;
-
- for (cur = parent_node->children; cur != NULL; cur = cur->next)
- {
- if ((cur->type == XML_ELEMENT_NODE) &&
- (strcmp(cur->name, name) == 0)) return cur;
- }
-
- return NULL;
-}
-
-int add_one_node(xmlDocPtr doc, char *line)
-{
- char *p, *name, *aftername, *attrname = NULL, *value = NULL;
- xmlNodePtr cur, cur_child;
-
- cur = xmlDocGetRootElement(doc);
-
- p = index(line, '=');
- if (p == NULL) return 1;
-
- *p = '\0';
- value = &p[1];
-
- name = line;
-
- while (1) /* go through each .-deliminated segment of line[] */
- {
- if ((p = index(name, '.')) != NULL)
- {
- *p = '\0';
- aftername = &p[1];
- }
- else aftername = &name[strlen(name)];
-
- if ((p = index(name, '_')) != NULL)
- {
- *p = '\0';
- attrname = &p[1];
- }
-
- cur_child = find_one_child(cur, name);
-
- if (cur_child == NULL)
- cur_child = xmlNewChild(cur, NULL, name, NULL);
-
- cur = cur_child;
-
- name = aftername;
-
- if (attrname != NULL)
- {
- xmlSetProp(cur, attrname, value);
- return 0;
- }
-
- if (*name == '\0')
- {
- xmlNodeSetContent(cur, value);
- return 0;
- }
- }
-}
-
-static apr_status_t mod_gridsite_soap2cgi_out(ap_filter_t *f,
- apr_bucket_brigade *bbIn)
-{
- char *p, *name, *outbuffer;
- request_rec *r = f->r;
- conn_rec *c = r->connection;
- apr_bucket *bucketIn, *pbktEOS;
- apr_bucket_brigade *bbOut;
-
- const char *data;
- apr_size_t len;
- char *buf;
- apr_size_t n;
- apr_bucket *pbktOut;
-
- soap2cgi_ctx *ctx;
- xmlNodePtr root_node = NULL;
- xmlBufferPtr buff;
-
- ctx = (soap2cgi_ctx *) f->ctx;
-
-// LIBXML_TEST_VERSION;
-
- bbOut = apr_brigade_create(r->pool, c->bucket_alloc);
-
- if (ctx->doc == NULL)
- {
- ctx->doc = xmlNewDoc("1.0");
-
- root_node = xmlNewNode(NULL, "Envelope");
- xmlDocSetRootElement(ctx->doc, root_node);
-
- xmlNewChild(root_node, NULL, "Header", NULL);
- xmlNewChild(root_node, NULL, "Body", NULL);
- }
-
- apr_brigade_pflatten(bbIn, &outbuffer, &len, r->pool);
-
- /* split up buffer and feed each line to add_one_node() */
-
- name = outbuffer;
-
- while (*name != '\0')
- {
- p = index(name, '\n');
- if (p != NULL)
- {
- *p = '\0';
- ++p;
- }
- else p = &name[strlen(name)]; /* point to final NUL */
-
- add_one_node(ctx->doc, name);
-
- name = p;
- }
-
- APR_BRIGADE_FOREACH(bucketIn, bbIn)
- {
- if (APR_BUCKET_IS_EOS(bucketIn))
- {
- /* write out XML tree we have built */
-
- buff = xmlBufferCreate();
- xmlNodeDump(buff, ctx->doc, root_node, 0, 0);
-
-// TODO: simplify/reduce number of copies or libxml vs APR buffers?
-
- buf = (char *) xmlBufferContent(buff);
-
- pbktOut = apr_bucket_heap_create(buf, strlen(buf), NULL,
- c->bucket_alloc);
-
- APR_BRIGADE_INSERT_TAIL(bbOut, pbktOut);
-
- xmlBufferFree(buff);
-
- pbktEOS = apr_bucket_eos_create(c->bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(bbOut, pbktEOS);
-
- continue;
- }
- }
-
- return ap_pass_brigade(f->next, bbOut);
-}
-
-static apr_status_t mod_gridsite_soap2cgi_in(ap_filter_t *f,
- apr_bucket_brigade *pbbOut,
- ap_input_mode_t eMode,
- apr_read_type_e eBlock,
- apr_off_t nBytes)
-{
- request_rec *r = f->r;
- conn_rec *c = r->connection;
-// CaseFilterInContext *pCtx;
- apr_status_t ret;
-
-#ifdef NEVERDEFINED
-
- ret = ap_get_brigade(f->next, pCtx->pbbTmp, eMode, eBlock, nBytes);
-
- if (!(pCtx = f->ctx)) {
- f->ctx = pCtx = apr_palloc(r->pool, sizeof *pCtx);
- pCtx->pbbTmp = apr_brigade_create(r->pool, c->bucket_alloc);
- }
-
- if (APR_BRIGADE_EMPTY(pCtx->pbbTmp)) {
- ret = ap_get_brigade(f->next, pCtx->pbbTmp, eMode, eBlock, nBytes);
-
- if (eMode == AP_MODE_EATCRLF || ret != APR_SUCCESS)
- return ret;
- }
-
- while(!APR_BRIGADE_EMPTY(pCtx->pbbTmp)) {
- apr_bucket *pbktIn = APR_BRIGADE_FIRST(pCtx->pbbTmp);
- apr_bucket *pbktOut;
- const char *data;
- apr_size_t len;
- char *buf;
- int n;
-
- /* It is tempting to do this...
- * APR_BUCKET_REMOVE(pB);
- * APR_BRIGADE_INSERT_TAIL(pbbOut,pB);
- * and change the case of the bucket data, but that would be wrong
- * for a file or socket buffer, for example...
- */
-
- if(APR_BUCKET_IS_EOS(pbktIn)) {
- APR_BUCKET_REMOVE(pbktIn);
- APR_BRIGADE_INSERT_TAIL(pbbOut, pbktIn);
- break;
- }
-
- ret=apr_bucket_read(pbktIn, &data, &len, eBlock);
- if(ret != APR_SUCCESS)
- return ret;
-
- buf = malloc(len);
- for(n=0 ; n < len ; ++n)
- buf[n] = apr_toupper(data[n]);
-
- pbktOut = apr_bucket_heap_create(buf, len, 0, c->bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(pbbOut, pbktOut);
- apr_bucket_delete(pbktIn);
- }
-#endif
-
- return APR_SUCCESS;
-}
-
-char *make_admin_footer(request_rec *r, mod_gridsite_dir_cfg *conf,
- int isdirectory)
-/*
- make string holding last modified text and admin links
-*/
-{
- char *out, *https, *p, *dn = NULL, *file = NULL, *permstr = NULL,
- *temp, modified[99], *dir_uri, *grst_cred_0 = NULL;
- GRSTgaclPerm perm = GRST_PERM_NONE;
- struct tm mtime_tm;
- time_t mtime_time;
-
- https = (char *) apr_table_get(r->subprocess_env, "HTTPS");
-
- dir_uri = apr_pstrdup(r->pool, r->uri);
- p = rindex(dir_uri, '/');
-
- if (p == NULL) return "";
-
- file = apr_pstrdup(r->pool, &p[1]);
- p[1] = '\0';
- /* dir_uri always gets both a leading and a trailing slash */
-
- out = apr_pstrdup(r->pool, "<p>\n");
-
- if (!isdirectory)
- {
- mtime_time = apr_time_sec(r->finfo.mtime);
-
- localtime_r(&mtime_time, &mtime_tm);
- strftime(modified, sizeof(modified),
- "%a %e %B %Y", &mtime_tm);
- temp = apr_psprintf(r->pool,"<hr><small>Last modified %s\n", modified);
- out = apr_pstrcat(r->pool, out, temp, NULL);
-
- if ((conf->adminuri != NULL) &&
- (conf->adminuri[0] != '\0') &&
- (conf->adminfile != NULL) &&
- (conf->adminfile[0] != '\0') &&
- (strncmp(file, GRST_HIST_PREFIX, sizeof(GRST_HIST_PREFIX)-1) != 0))
- {
- temp = apr_psprintf(r->pool,
- ". <a href=\"%s?cmd=history&file=%s\">"
- "View page history</a>\n",
- conf->adminfile, file);
- out = apr_pstrcat(r->pool, out, temp, NULL);
- }
-
- out = apr_pstrcat(r->pool, out, "</small>", NULL);
- }
-
- out = apr_pstrcat(r->pool, out, "<hr><small>", NULL);
-
- if (r->connection->notes != NULL)
- grst_cred_0 = (char *)
- apr_table_get(r->connection->notes, "GRST_CRED_0");
-
- if ((grst_cred_0 != NULL) &&
- (strncmp(grst_cred_0, "X509USER ", sizeof("X509USER")) == 0))
- {
- p = index(grst_cred_0, ' ');
- if (p != NULL)
- {
- p = index(++p, ' ');
- if (p != NULL)
- {
- p = index(++p, ' ');
- if (p != NULL)
- {
- p = index(++p, ' ');
- if (p != NULL) dn = p;
- }
- }
- }
- }
-
- if (dn != NULL)
- {
- temp = apr_psprintf(r->pool, "You are %s<br>\n", dn);
- out = apr_pstrcat(r->pool, out, temp, NULL);
-
- if (r->notes != NULL)
- permstr = (char *) apr_table_get(r->notes, "GRST_PERM");
-
- if ((permstr != NULL) &&
- (conf->adminuri != NULL) &&
- (conf->adminuri[0] != '\0') &&
- (conf->adminfile != NULL) &&
- (conf->adminfile[0] != '\0'))
- {
- sscanf(permstr, "%d", &perm);
-
- if (!isdirectory &&
- GRSTgaclPermHasWrite(perm) &&
- (strncmp(file, GRST_HIST_PREFIX,
- sizeof(GRST_HIST_PREFIX) - 1) != 0))
- {
- temp = apr_psprintf(r->pool,
- "<a href=\"%s?cmd=edit&file=%s\">"
- "Edit page</a> .\n", conf->adminfile, file);
- out = apr_pstrcat(r->pool, out, temp, NULL);
- }
-
- if (GRSTgaclPermHasList(perm) || GRSTgaclPermHasWrite(perm))
- {
- temp = apr_psprintf(r->pool,
- "<a href=\"%s%s?cmd=managedir\">Manage directory</a> .\n",
- dir_uri, conf->adminfile);
-
- out = apr_pstrcat(r->pool, out, temp, NULL);
- }
- }
- }
-
- if ((https != NULL) && (strcasecmp(https, "on") == 0))
- temp = apr_psprintf(r->pool,
- "<a href=\"http://%s%s\">Switch to HTTP</a> \n",
- r->server->server_hostname, r->unparsed_uri);
- else temp = apr_psprintf(r->pool,
- "<a href=\"https://%s%s\">Switch to HTTPS</a> \n",
- r->server->server_hostname, r->unparsed_uri);
-
- out = apr_pstrcat(r->pool, out, temp, NULL);
-
- if ((conf->helpuri != NULL) && (conf->helpuri[0] != '\0'))
- {
- temp = apr_psprintf(r->pool,
- ". <a href=\"%s\">Website Help</a>\n", conf->helpuri);
- out = apr_pstrcat(r->pool, out, temp, NULL);
- }
-
- if ((!isdirectory) &&
- (conf->adminuri != NULL) &&
- (conf->adminuri[0] != '\0') &&
- (conf->adminfile != NULL) &&
- (conf->adminfile[0] != '\0'))
- {
- temp = apr_psprintf(r->pool, ". <a href=\"%s?cmd=print&file=%s\">"
- "Print View</a>\n", conf->adminfile, file);
- out = apr_pstrcat(r->pool, out, temp, NULL);
- }
-
- if (conf->gridsitelink)
- {
- temp = apr_psprintf(r->pool,
- ". Built with <a href=\"http://www.gridsite.org/\">"
- "GridSite</a> %s\n", VERSION);
- out = apr_pstrcat(r->pool, out, temp, NULL);
- }
-
- out = apr_pstrcat(r->pool, out, "\n</small>\n", NULL);
-
- return out;
-}
-
-int html_format(request_rec *r, mod_gridsite_dir_cfg *conf)
-/*
- try to do GridSite formatting of .html files (NOT .shtml etc)
-*/
-{
- int i, fd, errstatus;
- char *buf, *p, *file, *s, *head_formatted, *header_formatted,
- *body_formatted, *admin_formatted, *footer_formatted;
- size_t length;
- struct stat statbuf;
- apr_file_t *fp;
-
- if (r->finfo.filetype == APR_NOFILE) return HTTP_NOT_FOUND;
-
- if (apr_file_open(&fp, r->filename, APR_READ, 0, r->pool) != 0)
- return HTTP_INTERNAL_SERVER_ERROR;
-
- file = rindex(r->uri, '/');
- if (file != NULL) ++file; /* file points to name without path */
-
- buf = apr_palloc(r->pool, (size_t)(r->finfo.size + 1));
- length = r->finfo.size;
- apr_file_read(fp, buf, &length);
- buf[r->finfo.size] = '\0';
- apr_file_close(fp);
-
- /* **** try to find a header file in this or parent directories **** */
-
- /* first make a buffer big enough to hold path names we want to try */
- fd = -1;
- s = malloc(strlen(r->filename) + strlen(conf->headfile) + 1);
- strcpy(s, r->filename);
-
- for (;;)
- {
- p = rindex(s, '/');
- if (p == NULL) break; /* failed to find one */
- p[1] = '\0';
- strcat(p, conf->headfile);
-
- fd = open(s, O_RDONLY);
- if (fd != -1) break; /* found one */
-
- *p = '\0';
- }
-
- free(s);
-
- if (fd == -1) /* not found, so set up not to output one */
- {
- head_formatted = apr_pstrdup(r->pool, "");
- header_formatted = apr_pstrdup(r->pool, "");
- body_formatted = buf;
- }
- else /* found a header file, so set up head and body to surround it */
- {
- fstat(fd, &statbuf);
- header_formatted = apr_palloc(r->pool, statbuf.st_size + 1);
- read(fd, header_formatted, statbuf.st_size);
- header_formatted[statbuf.st_size] = '\0';
- close(fd);
-
- p = strstr(buf, "<body");
- if (p == NULL) p = strstr(buf, "<BODY");
- if (p == NULL) p = strstr(buf, "<Body");
-
- if (p == NULL)
- {
- head_formatted = apr_pstrdup(r->pool, "");
- body_formatted = buf;
- }
- else
- {
- *p = '\0';
- head_formatted = buf;
- ++p;
-
- while ((*p != '>') && (*p != '\0')) ++p;
-
- if (*p == '\0')
- {
- body_formatted = p;
- }
- else
- {
- *p = '\0';
- ++p;
- body_formatted = p;
- }
- }
- }
-
- /* **** remove closing </body> tag from body **** */
-
- p = strstr(body_formatted, "</body");
- if (p == NULL) p = strstr(body_formatted, "</BODY");
- if (p == NULL) p = strstr(body_formatted, "</Body");
-
- if (p != NULL) *p = '\0';
-
- /* **** set up dynamic part of footer to go at end of body **** */
-
- admin_formatted = make_admin_footer(r, conf, FALSE);
-
- /* **** try to find a footer file in this or parent directories **** */
-
- /* first make a buffer big enough to hold path names we want to try */
- fd = -1;
- s = malloc(strlen(r->filename) + strlen(conf->footfile));
- strcpy(s, r->filename);
-
- for (;;)
- {
- p = rindex(s, '/');
- if (p == NULL) break; /* failed to find one */
-
- p[1] = '\0';
- strcat(p, conf->footfile);
-
- fd = open(s, O_RDONLY);
- if (fd != -1) break; /* found one */
-
- *p = '\0';
- }
-
- free(s);
-
- if (fd == -1) /* failed to find a footer, so set up empty default */
- {
- footer_formatted = apr_pstrdup(r->pool, "");
- }
- else /* found a footer, so set up to use it */
- {
- fstat(fd, &statbuf);
- footer_formatted = apr_palloc(r->pool, statbuf.st_size + 1);
- read(fd, footer_formatted, statbuf.st_size);
- footer_formatted[statbuf.st_size] = '\0';
- close(fd);
- }
-
- /* **** can now calculate the Content-Length and output headers **** */
-
- length = strlen(head_formatted) + strlen(header_formatted) +
- strlen(body_formatted) + strlen(admin_formatted) +
- strlen(footer_formatted);
-
- ap_set_content_length(r, length);
- ap_set_content_type(r, "text/html");
-
- /* ** output the HTTP body (HTML Head+Body) ** */
-
- ap_rputs(head_formatted, r);
- ap_rputs(header_formatted, r);
- ap_rputs(body_formatted, r);
- ap_rputs(admin_formatted, r);
- ap_rputs(footer_formatted, r);
-
- return OK;
-}
-
-int html_dir_list(request_rec *r, mod_gridsite_dir_cfg *conf)
-/*
- output HTML directory listing, with level of formatting controlled
- by GridSiteHtmlFormat/conf->format
-*/
-{
- int i, fd, n;
- char *buf, *p, *s, *head_formatted, *header_formatted,
- *body_formatted, *admin_formatted, *footer_formatted, *temp,
- modified[99], *d_namepath, *indexheaderpath, *indexheadertext;
- size_t length;
- struct stat statbuf;
- struct tm mtime_tm;
- struct dirent **namelist;
-
- if (r->finfo.filetype == APR_NOFILE) return HTTP_NOT_FOUND;
-
- head_formatted = apr_psprintf(r->pool,
- "<head><title>Directory listing %s</title></head>\n", r->uri);
-
- if (conf->format)
- {
- /* **** try to find a header file in this or parent directories **** */
-
- /* first make a buffer big enough to hold path names we want to try */
- fd = -1;
- s = malloc(strlen(r->filename) + strlen(conf->headfile) + 1);
- strcpy(s, r->filename);
-
- for (;;)
- {
- p = rindex(s, '/');
- if (p == NULL) break; /* failed to find one */
- p[1] = '\0';
- strcat(p, conf->headfile);
-
- fd = open(s, O_RDONLY);
- if (fd != -1) break; /* found one */
-
- *p = '\0';
- }
-
- free(s);
-
- if (fd == -1) /* not found, so set up to output sensible default */
- {
- header_formatted = apr_pstrdup(r->pool, "<body bgcolor=white>");
- }
- else /* found a header file, so set up head and body to surround it */
- {
- fstat(fd, &statbuf);
- header_formatted = apr_palloc(r->pool, statbuf.st_size + 1);
- read(fd, header_formatted, statbuf.st_size);
- header_formatted[statbuf.st_size] = '\0';
- close(fd);
- }
- }
- else header_formatted = apr_pstrdup(r->pool, "<body bgcolor=white>");
-
- body_formatted = apr_psprintf(r->pool,
- "<h1>Directory listing %s</h1>\n", r->uri);
-
- if (conf->indexheader != NULL)
- {
- indexheaderpath = apr_psprintf(r->pool, "%s/%s", r->filename,
- conf->indexheader);
- fd = open(indexheaderpath, O_RDONLY);
- if (fd != -1)
- {
- fstat(fd, &statbuf);
- indexheadertext = apr_palloc(r->pool, statbuf.st_size + 1);
- read(fd, indexheadertext, statbuf.st_size);
- indexheadertext[statbuf.st_size] = '\0';
- close(fd);
-
- body_formatted = apr_pstrcat(r->pool, body_formatted,
- indexheadertext, NULL);
- }
- }
-
- body_formatted = apr_pstrcat(r->pool, body_formatted, "<p><table>\n", NULL);
-
- if (r->unparsed_uri[1] != '\0')
- body_formatted = apr_pstrcat(r->pool, body_formatted,
- "<tr><td colspan=3>[<a href=\"../\">Parent directory</a>]</td></tr>\n",
- NULL);
-
- n = scandir(r->filename, &namelist, 0, versionsort);
- while (n--)
- {
- if ((namelist[n]->d_name[0] != '.') &&
- ((conf->indexheader == NULL) ||
- (strcmp(conf->indexheader, namelist[n]->d_name) != 0)))
- {
- d_namepath = apr_psprintf(r->pool, "%s/%s", r->filename,
- namelist[n]->d_name);
- stat(d_namepath, &statbuf);
-
- localtime_r(&(statbuf.st_mtime), &mtime_tm);
- strftime(modified, sizeof(modified),
- "<td align=right>%R</td><td align=right>%e %b %y</td>",
- &mtime_tm);
-
- if (S_ISDIR(statbuf.st_mode))
- temp = apr_psprintf(r->pool,
- "<tr><td><a href=\"%s/\" content-length=\"%ld\" "
- "last-modified=\"%ld\">"
- "%s/</a></td>"
- "<td align=right>%ld</td>%s</tr>\n",
- namelist[n]->d_name, statbuf.st_size, statbuf.st_mtime,
- namelist[n]->d_name,
- statbuf.st_size, modified);
- else temp = apr_psprintf(r->pool,
- "<tr><td><a href=\"%s\" content-length=\"%ld\" "
- "last-modified=\"%ld\">"
- "%s</a></td>"
- "<td align=right>%ld</td>%s</tr>\n",
- namelist[n]->d_name, statbuf.st_size, statbuf.st_mtime,
- namelist[n]->d_name,
- statbuf.st_size, modified);
-
- body_formatted = apr_pstrcat(r->pool,body_formatted,temp,NULL);
- }
-
- free(namelist[n]);
- }
-
- free(namelist);
-
- body_formatted = apr_pstrcat(r->pool, body_formatted, "</table>\n", NULL);
-
- if (conf->format)
- {
- /* **** set up dynamic part of footer to go at end of body **** */
-
- admin_formatted = make_admin_footer(r, conf, TRUE);
-
- /* **** try to find a footer file in this or parent directories **** */
-
- /* first make a buffer big enough to hold path names we want to try */
- fd = -1;
- s = malloc(strlen(r->filename) + strlen(conf->footfile));
- strcpy(s, r->filename);
-
- for (;;)
- {
- p = rindex(s, '/');
- if (p == NULL) break; /* failed to find one */
-
- p[1] = '\0';
- strcat(p, conf->footfile);
-
- fd = open(s, O_RDONLY);
- if (fd != -1) break; /* found one */
-
- *p = '\0';
- }
-
- free(s);
-
- if (fd == -1) /* failed to find a footer, so use standard default */
- {
- footer_formatted = apr_pstrdup(r->pool, "</body>");
- }
- else /* found a footer, so set up to use it */
- {
- fstat(fd, &statbuf);
- footer_formatted = apr_palloc(r->pool, statbuf.st_size + 1);
- read(fd, footer_formatted, statbuf.st_size);
- footer_formatted[statbuf.st_size] = '\0';
- close(fd);
- }
- }
- else
- {
- admin_formatted = apr_pstrdup(r->pool, "");
- footer_formatted = apr_pstrdup(r->pool, "</body>");
- }
-
- /* **** can now calculate the Content-Length and output headers **** */
-
- length = strlen(head_formatted) + strlen(header_formatted) +
- strlen(body_formatted) + strlen(admin_formatted) +
- strlen(footer_formatted);
-
- ap_set_content_length(r, length);
- ap_set_content_type(r, "text/html");
-
- /* ** output the HTTP body (HTML Head+Body) ** */
-
- ap_rputs(head_formatted, r);
- ap_rputs(header_formatted, r);
- ap_rputs(body_formatted, r);
- ap_rputs(admin_formatted, r);
- ap_rputs(footer_formatted, r);
-
- return OK;
-}
-
-int http_gridhttp(request_rec *r, mod_gridsite_dir_cfg *conf)
-{
- int i;
- char *httpurl, *filetemplate, *cookievalue, *envname_i,
- *grst_cred_i, expires_str[APR_RFC822_DATE_LEN];
- apr_uint64_t gridauthcookie;
- apr_table_t *env;
- apr_time_t expires_time;
- apr_file_t *fp;
-
- /* create random cookie and gridauthcookie file */
-
- if (apr_generate_random_bytes((char *) &gridauthcookie,
- sizeof(gridauthcookie))
- != APR_SUCCESS) return HTTP_INTERNAL_SERVER_ERROR;
-
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "Generated GridHTTP onetime passcode %016llx", gridauthcookie);
-
- filetemplate = apr_psprintf(r->pool, "%s/%016llxXXXXXX",
- ap_server_root_relative(r->pool,
- onetimesdir),
- gridauthcookie);
-
- if (apr_file_mktemp(&fp,
- filetemplate,
- APR_CREATE | APR_WRITE | APR_EXCL,
- r->pool)
- != APR_SUCCESS) return HTTP_INTERNAL_SERVER_ERROR;
-
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "Created passcode file %s", filetemplate);
-
- expires_time = apr_time_now() + apr_time_from_sec(300);
- /* onetime cookies are valid for only 5 mins! */
-
- apr_file_printf(fp,
- "expires=%lu\ndomain=%s\npath=%s\nonetime=yes\nmethod=%s\n",
- (time_t) apr_time_sec(expires_time),
- r->hostname, r->uri, r->method);
- /* above variables are evaluated in order and method= MUST be last! */
-
- for (i=0; ; ++i)
- {
- envname_i = apr_psprintf(r->pool, "GRST_CRED_%d", i);
- if (grst_cred_i = (char *)
- apr_table_get(r->connection->notes, envname_i))
- {
- apr_file_printf(fp, "%s=%s\n", envname_i, grst_cred_i);
- }
- else break; /* GRST_CRED_i are numbered consecutively */
- }
-
- if (apr_file_close(fp) != APR_SUCCESS)
- {
- apr_file_remove(filetemplate, r->pool); /* try to clean up */
- return HTTP_INTERNAL_SERVER_ERROR;
- }
-
- /* send redirection header back to client */
-
- cookievalue = rindex(filetemplate, '/');
- if (cookievalue != NULL) ++cookievalue;
- else cookievalue = filetemplate;
-
- apr_rfc822_date(expires_str, expires_time);
-
- apr_table_add(r->headers_out,
- apr_pstrdup(r->pool, "Set-Cookie"),
- apr_psprintf(r->pool,
- "GRIDHTTP_ONETIME=%s; "
- "expires=%s; "
- "domain=%s; "
- "path=%s",
- cookievalue, expires_str, r->hostname, r->uri));
-
- if (gridhttpport != DEFAULT_HTTP_PORT)
- httpurl = apr_psprintf(r->pool, "http://%s:%d%s", r->hostname,
- gridhttpport, ap_escape_uri(r->pool, r->uri));
- else httpurl = apr_pstrcat(r->pool, "http://", r->hostname,
- ap_escape_uri(r->pool, r->uri), NULL);
-
- apr_table_setn(r->headers_out, apr_pstrdup(r->pool, "Location"), httpurl);
-
- r->status = HTTP_MOVED_TEMPORARILY;
- return OK;
-}
-
-int http_put_method(request_rec *r, mod_gridsite_dir_cfg *conf)
-{
- char buf[2048];
- size_t length;
- int retcode;
- apr_file_t *fp;
-
- /* *** check if directory creation: PUT /.../ *** */
-
- if ((r->unparsed_uri != NULL) &&
- (r->unparsed_uri[0] != '\0') &&
- (r->unparsed_uri[strlen(r->unparsed_uri) - 1] == '/'))
- {
- if (apr_dir_make(r->filename,
- conf->diskmode
- | APR_UEXECUTE | APR_GEXECUTE | APR_WEXECUTE,
- r->pool) != 0) return HTTP_INTERNAL_SERVER_ERROR;
-
- /* we force the permissions, rather than accept any existing ones */
-
- apr_file_perms_set(r->filename, conf->diskmode
- | APR_UEXECUTE | APR_GEXECUTE | APR_WEXECUTE);
-
- ap_set_content_length(r, 0);
- ap_set_content_type(r, "text/html");
- return OK;
- }
-
- /* *** otherwise assume trying to create a regular file *** */
-
- if (apr_file_open(&fp, r->filename,
- APR_WRITE | APR_CREATE | APR_BUFFERED | APR_TRUNCATE,
- conf->diskmode, r->pool) != 0) return HTTP_INTERNAL_SERVER_ERROR;
-
- /* we force the permissions, rather than accept any existing ones */
-
- apr_file_perms_set(r->filename, conf->diskmode);
-
-// TODO: need to add Range: support at some point too
-// Also return 201 Created rather than 200 OK if not already existing
-
- retcode = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK);
- if (retcode == OK)
- {
- if (ap_should_client_block(r))
- while ((length = ap_get_client_block(r, buf, sizeof(buf))) > 0)
- if (apr_file_write(fp, buf, &length) != 0)
- {
- retcode = HTTP_INTERNAL_SERVER_ERROR;
- break;
- }
-
- ap_set_content_length(r, 0);
- ap_set_content_type(r, "text/html");
- }
-
- if (apr_file_close(fp) != 0) return HTTP_INTERNAL_SERVER_ERROR;
-
- return retcode;
-}
-
-int http_delete_method(request_rec *r, mod_gridsite_dir_cfg *conf)
-{
- if (apr_file_remove(r->filename, r->pool) != 0) return HTTP_FORBIDDEN;
-
- ap_set_content_length(r, 0);
- ap_set_content_type(r, "text/html");
-
- return OK;
-}
-
-int http_move_method(request_rec *r, mod_gridsite_dir_cfg *conf)
-{
- char *destination_translated = NULL;
-
- if (r->notes != NULL) destination_translated =
- (char *) apr_table_get(r->notes, "GRST_DESTINATION_TRANSLATED");
-
-
- if ((destination_translated == NULL) ||
- (apr_file_rename(r->filename, destination_translated, r->pool) != 0))
- return HTTP_FORBIDDEN;
-
- ap_set_content_length(r, 0);
- ap_set_content_type(r, "text/html");
-
- return OK;
-}
-
-static int mod_gridsite_dir_handler(request_rec *r, mod_gridsite_dir_cfg *conf)
-/*
- handler switch for directories
-*/
-{
- /* *** is this a write method? only possible if GridSiteAuth on *** */
-
- if (conf->auth)
- {
- if ((r->method_number == M_PUT) &&
- (conf->methods != NULL) &&
- (strstr(conf->methods, " PUT " ) != NULL))
- return http_put_method(r, conf);
-
- if ((r->method_number == M_DELETE) &&
- (conf->methods != NULL) &&
- (strstr(conf->methods, " DELETE ") != NULL))
- return http_delete_method(r, conf);
- }
-
- /* *** directory listing? *** */
-
- if ((r->method_number == M_GET) && (conf->indexes))
- return html_dir_list(r, conf); /* directory listing */
-
- return DECLINED; /* *** nothing to see here, move along *** */
-}
-
-static int mod_gridsite_nondir_handler(request_rec *r, mod_gridsite_dir_cfg *conf)
-/*
- one big handler switch for everything other than directories, since we
- might be responding to MIME * / * for local PUT, MOVE, COPY and DELETE,
- and GET inside ghost directories.
-*/
-{
- char *upgradeheader, *upgradespaced, *p;
- const char *https_env;
-
- /* *** is this a write method or GridHTTP HTTPS->HTTP redirection?
- only possible if GridSiteAuth on *** */
-
- if (conf->auth)
- {
- if ((conf->gridhttp) &&
- ((r->method_number == M_GET) ||
- ((r->method_number == M_PUT) &&
- (strstr(conf->methods, " PUT ") != NULL))) &&
- ((upgradeheader = (char *) apr_table_get(r->headers_in,
- "Upgrade")) != NULL) &&
- ((https_env=apr_table_get(r->subprocess_env,"HTTPS")) != NULL) &&
- (strcasecmp(https_env, "on") == 0))
- {
- upgradespaced = apr_psprintf(r->pool, " %s ", upgradeheader);
-
- for (p=upgradespaced; *p != '\0'; ++p)
- if ((*p == ',') || (*p == '\t')) *p = ' ';
-
-// TODO: what if we're pointing at a CGI or some dynamic content???
-
- if (strstr(upgradespaced, " GridHTTP/1.0 ") != NULL)
- return http_gridhttp(r, conf);
- }
-
- if ((r->method_number == M_PUT) &&
- (conf->methods != NULL) &&
- (strstr(conf->methods, " PUT " ) != NULL))
- return http_put_method(r, conf);
-
- if ((r->method_number == M_DELETE) &&
- (conf->methods != NULL) &&
- (strstr(conf->methods, " DELETE ") != NULL))
- return http_delete_method(r, conf);
-
- if ((r->method_number == M_MOVE) &&
- (conf->methods != NULL) &&
- (strstr(conf->methods, " MOVE ") != NULL))
- return http_move_method(r, conf);
- }
-
- /* *** check if a special ghost admin CGI *** */
-
- if (conf->adminfile && conf->adminuri &&
- (strlen(r->filename) > strlen(conf->adminfile) + 1) &&
- (strcmp(&(r->filename[strlen(r->filename) - strlen(conf->adminfile)]),
- conf->adminfile) == 0) &&
- (r->filename[strlen(r->filename)-strlen(conf->adminfile)-1] == '/') &&
- ((r->method_number == M_POST) ||
- (r->method_number == M_GET)))
- {
- ap_internal_redirect(conf->adminuri, r);
- return OK;
- }
-
- /* *** finally look for .html files that we should format *** */
-
- if ((conf->format) && /* conf->format set by GridSiteHtmlFormat on */
- (strlen(r->filename) > 5) &&
- (strcmp(&(r->filename[strlen(r->filename)-5]), ".html") == 0) &&
- (r->method_number == M_GET)) return html_format(r, conf);
-
- return DECLINED; /* *** nothing to see here, move along *** */
-}
-
-static void recurse4dirlist(char *dirname, time_t *dirs_time,
- char *fulluri, int fullurilen,
- char *encfulluri, int enclen,
- apr_pool_t *pool, char **body,
- int recurse_level)
-/* try to find DN Lists in dir[] and its subdirs that match the fulluri[]
- prefix. add blobs of HTML to body as they are found. */
-{
- char *unencname, modified[99], *oneline, *d_namepath;
- DIR *oneDIR;
- struct dirent *onedirent;
- struct tm mtime_tm;
- size_t length;
- struct stat statbuf;
-
- if ((stat(dirname, &statbuf) != 0) ||
- (!S_ISDIR(statbuf.st_mode)) ||
- ((oneDIR = opendir(dirname)) == NULL)) return;
-
- if (statbuf.st_mtime > *dirs_time) *dirs_time = statbuf.st_mtime;
-
- while ((onedirent = readdir(oneDIR)) != NULL)
- {
- if (onedirent->d_name[0] == '.') continue;
-
- d_namepath = apr_psprintf(pool, "%s/%s", dirname, onedirent->d_name);
- if (stat(d_namepath, &statbuf) != 0) continue;
-
- if (S_ISDIR(statbuf.st_mode) && (recurse_level < GRST_RECURS_LIMIT))
- recurse4dirlist(d_namepath, dirs_time, fulluri,
- fullurilen, encfulluri, enclen,
- pool, body, recurse_level + 1);
- else if ((strncmp(onedirent->d_name, encfulluri, enclen) == 0) &&
- (onedirent->d_name[strlen(onedirent->d_name) - 1] != '~'))
- {
- unencname = GRSThttpUrlDecode(onedirent->d_name);
-
- if (strncmp(unencname, fulluri, fullurilen) == 0)
- {
-
- if (statbuf.st_mtime > *dirs_time)
- *dirs_time = statbuf.st_mtime;
-
- localtime_r(&(statbuf.st_mtime), &mtime_tm);
- strftime(modified, sizeof(modified),
- "<td align=right>%R</td><td align=right>%e %b %y</td>",
- &mtime_tm);
-
- oneline = apr_psprintf(pool,
- "<tr><td><a href=\"%s\" "
- "content-length=\"%ld\" "
- "last-modified=\"%ld\">"
- "%s</a></td>"
- "<td align=right>%ld</td>%s</tr>\n",
- &unencname[fullurilen], statbuf.st_size,
- statbuf.st_mtime, unencname,
- statbuf.st_size, modified);
-
- *body = apr_pstrcat(pool, *body, oneline, NULL);
- }
-
- free(unencname); /* libgridsite doesnt use pools */
- }
- }
-
- closedir(oneDIR);
-}
-
-static int mod_gridsite_dnlistsuri_dir_handler(request_rec *r,
- mod_gridsite_dir_cfg *conf)
-/*
- virtual DN-list file lister: make all DN lists on the dn-lists
- path of this server appear to be in the dn-lists directory itself
- (ie where they appear in the DN lists path doesnt matter, as long
- as their name matches)
-*/
-{
- int enclen, fullurilen, fd;
- char *fulluri, *encfulluri, *dn_list_ptr, *dirname, *unencname,
- *body, *oneline, *p, *s,
- *head_formatted, *header_formatted, *footer_formatted,
- *permstr = NULL;
- struct stat statbuf;
- size_t length;
- time_t dirs_time = 0;
- GRSTgaclPerm perm = GRST_PERM_NONE;
-
- if (r->notes != NULL)
- permstr = (char *) apr_table_get(r->notes, "GRST_PERM");
-
- if (permstr != NULL) sscanf(permstr, "%d", &perm);
-
- fulluri = apr_psprintf(r->pool, "https://%s%s",
- ap_get_server_name(r), conf->dnlistsuri);
- fullurilen = strlen(fulluri);
-
- encfulluri = GRSThttpUrlEncode(fulluri);
- enclen = strlen(encfulluri);
-
- if (conf->dnlists != NULL) p = conf->dnlists;
- else p = getenv("GRST_DN_LISTS");
-
- if (p == NULL) p = GRST_DN_LISTS;
- dn_list_ptr = apr_pstrdup(r->pool, p);
-
- head_formatted = apr_psprintf(r->pool,
- "<head><title>Directory listing %s</title></head>\n", r->uri);
-
- if (conf->format)
- {
- /* **** try to find a header file in this or parent directories **** */
-
- /* first make a buffer big enough to hold path names we want to try */
- fd = -1;
- s = malloc(strlen(r->filename) + strlen(conf->headfile) + 1);
- strcpy(s, r->filename);
-
- for (;;)
- {
- p = rindex(s, '/');
- if (p == NULL) break; /* failed to find one */
- p[1] = '\0';
- strcat(p, conf->headfile);
-
- fd = open(s, O_RDONLY);
- if (fd != -1) break; /* found one */
-
- *p = '\0';
- }
-
- free(s);
-
- if (fd == -1) /* not found, so set up to output sensible default */
- {
- header_formatted = apr_pstrdup(r->pool, "<body bgcolor=white>");
- }
- else /* found a header file, so set up head and body to surround it */
- {
- fstat(fd, &statbuf);
- header_formatted = apr_palloc(r->pool, statbuf.st_size + 1);
- read(fd, header_formatted, statbuf.st_size);
- header_formatted[statbuf.st_size] = '\0';
- close(fd);
- }
- }
- else header_formatted = apr_pstrdup(r->pool, "<body bgcolor=white>");
-
- body = apr_psprintf(r->pool,
- "<h1>Directory listing %s</h1>\n<table>", r->uri);
-
- if ((r->uri)[1] != '\0')
- body = apr_pstrcat(r->pool, body,
- "<tr><td>[<a href=\"../\">Parent directory</a>]</td></tr>\n",
- NULL);
-
- while ((dirname = strsep(&dn_list_ptr, ":")) != NULL)
- recurse4dirlist(dirname, &dirs_time, fulluri, fullurilen,
- encfulluri, enclen, r->pool, &body, 0);
-
- if ((stat(r->filename, &statbuf) == 0) &&
- S_ISDIR(statbuf.st_mode) &&
- GRSTgaclPermHasWrite(perm))
- {
- oneline = apr_psprintf(r->pool,
- "<form action=\"%s%s\" method=post>\n"
- "<input type=hidden name=cmd value=managedir>"
- "<tr><td colspan=4 align=center><small><input type=submit "
- "value=\"Manage directory\"></small></td></tr></form>\n",
- r->uri, conf->adminfile);
-
- body = apr_pstrcat(r->pool, body, oneline, NULL);
- }
-
- body = apr_pstrcat(r->pool, body, "</table>\n", NULL);
-
- free(encfulluri); /* libgridsite doesnt use pools */
-
- if (conf->format)
- {
- /* **** try to find a footer file in this or parent directories **** */
-
- /* first make a buffer big enough to hold path names we want to try */
- fd = -1;
- s = malloc(strlen(r->filename) + strlen(conf->footfile));
- strcpy(s, r->filename);
-
- for (;;)
- {
- p = rindex(s, '/');
- if (p == NULL) break; /* failed to find one */
-
- p[1] = '\0';
- strcat(p, conf->footfile);
-
- fd = open(s, O_RDONLY);
- if (fd != -1) break; /* found one */
-
- *p = '\0';
- }
-
- free(s);
-
- if (fd == -1) /* failed to find a footer, so use standard default */
- {
- footer_formatted = apr_pstrdup(r->pool, "</body>");
- }
- else /* found a footer, so set up to use it */
- {
- fstat(fd, &statbuf);
- footer_formatted = apr_palloc(r->pool, statbuf.st_size + 1);
- read(fd, footer_formatted, statbuf.st_size);
- footer_formatted[statbuf.st_size] = '\0';
- close(fd);
- }
- }
- else footer_formatted = apr_pstrdup(r->pool, "</body>");
-
- /* **** can now calculate the Content-Length and output headers **** */
-
- length = strlen(head_formatted) + strlen(header_formatted) +
- strlen(body) + strlen(footer_formatted);
-
- ap_set_content_length(r, length);
- r->mtime = apr_time_from_sec(dirs_time);
- ap_set_last_modified(r);
- ap_set_content_type(r, "text/html");
-
- /* ** output the HTTP body (HTML Head+Body) ** */
- ap_rputs(head_formatted, r);
- ap_rputs(header_formatted, r);
- ap_rputs(body, r);
- ap_rputs(footer_formatted, r);
-
- return OK;
-}
-
-static char *recurse4file(char *dir, char *file, apr_pool_t *pool,
- int recurse_level)
-/* try to find file[] in dir[]. try subdirs if not found.
- return full path to first found version or NULL on failure */
-{
- char *fullfilename, *fulldirname;
- struct stat statbuf;
- DIR *dirDIR;
- struct dirent *file_ent;
-
- /* try to find in current directory */
-
- fullfilename = apr_psprintf(pool, "%s/%s", dir, file);
-
- if (stat(fullfilename, &statbuf) == 0) return fullfilename;
-
- /* maybe search in subdirectories */
-
- if (recurse_level >= GRST_RECURS_LIMIT) return NULL;
-
- dirDIR = opendir(dir);
-
- if (dirDIR == NULL) return NULL;
-
- while ((file_ent = readdir(dirDIR)) != NULL)
- {
- if (file_ent->d_name[0] == '.') continue;
-
- fulldirname = apr_psprintf(pool, "%s/%s", dir, file_ent->d_name);
- if ((stat(fulldirname, &statbuf) == 0) &&
- S_ISDIR(statbuf.st_mode) &&
- ((fullfilename = recurse4file(fulldirname, file,
- pool, recurse_level + 1)) != NULL))
- {
- closedir(dirDIR);
- return fullfilename;
- }
- }
-
- closedir(dirDIR);
-
- return NULL;
-}
-
-static int mod_gridsite_dnlistsuri_handler(request_rec *r,
- mod_gridsite_dir_cfg *conf)
-/*
- virtual DN-list file generator
-*/
-{
- int fd;
- char *fulluri, *encfulluri, *dn_list_ptr, *filename, *dirname, *p,
- *buf;
- struct stat statbuf;
-
- /* *** check if a special ghost admin CGI *** */
-
- if (conf->adminfile && conf->adminuri &&
- (strlen(r->filename) > strlen(conf->adminfile) + 1) &&
- (strcmp(&(r->filename[strlen(r->filename) - strlen(conf->adminfile)]),
- conf->adminfile) == 0) &&
- (r->filename[strlen(r->filename)-strlen(conf->adminfile)-1] == '/') &&
- ((r->method_number == M_POST) ||
- (r->method_number == M_GET)))
- {
- ap_internal_redirect(conf->adminuri, r);
- return OK;
- }
-
- fulluri = apr_psprintf(r->pool, "https://%s%s",
- ap_get_server_name(r), r->uri);
-
- encfulluri = GRSThttpUrlEncode(fulluri);
-
- if (conf->dnlists != NULL) p = conf->dnlists;
- else p = getenv("GRST_DN_LISTS");
-
- if (p == NULL) p = GRST_DN_LISTS;
- dn_list_ptr = apr_pstrdup(r->pool, p);
-
- while ((dirname = strsep(&dn_list_ptr, ":")) != NULL)
- {
- filename = recurse4file(dirname, encfulluri, r->pool, 0);
-
- if (filename == NULL) continue;
-
- fd = open(filename, O_RDONLY);
-
- if (fd == -1) continue;
-
- fstat(fd, &statbuf);
- ap_set_content_length(r, (apr_off_t) statbuf.st_size);
- r->mtime = apr_time_from_sec(statbuf.st_mtime);
- ap_set_content_type(r, "text/plain");
- ap_set_last_modified(r);
-
- buf = apr_palloc(r->pool, statbuf.st_size + 1);
- read(fd, buf, statbuf.st_size);
- buf[statbuf.st_size] = '\0';
-
- ap_rputs(buf, r);
-
- close(fd);
-
- return OK;
- }
-
- return HTTP_NOT_FOUND;
-}
-
-static void *create_gridsite_srv_config(apr_pool_t *p, server_rec *s)
-{
- int i;
-
- if (!(s->is_virtual))
- {
- gridhttpport = GRST_HTTP_PORT;
-
- onetimesdir = apr_pstrdup(p, "/var/www/onetimes");
- /* GridSiteOnetimesDir dir-path */
-
- sitecastdnlists = NULL;
-
- sitecastgroups[0].quad1 = 0;
- sitecastgroups[0].quad2 = 0;
- sitecastgroups[0].quad3 = 0;
- sitecastgroups[0].quad4 = 0;
- sitecastgroups[0].port = GRST_HTCP_PORT;
- /* GridSiteCastUniPort udp-port */
-
- for (i=1; i <= GRST_SITECAST_GROUPS; ++i)
- sitecastgroups[i].port = 0;
- /* GridSiteCastGroup mcast-list */
-
- for (i=1; i <= GRST_SITECAST_ALIASES; ++i)
- {
- sitecastaliases[i].sitecast_url = NULL;
- sitecastaliases[i].local_path = NULL;
- sitecastaliases[i].server = NULL;
- } /* GridSiteCastAlias url path */
- }
-
- return NULL;
-}
-
-static void *create_gridsite_dir_config(apr_pool_t *p, char *path)
-{
- mod_gridsite_dir_cfg *conf = apr_palloc(p, sizeof(*conf));
-
- if (path == NULL) /* set up document root defaults */
- {
- conf->auth = 0; /* GridSiteAuth on/off */
- conf->envs = 1; /* GridSiteEnvs on/off */
- conf->format = 0; /* GridSiteHtmlFormat on/off */
- conf->indexes = 0; /* GridSiteIndexes on/off */
- conf->indexheader = NULL; /* GridSiteIndexHeader File-value */
- conf->gridsitelink = 1; /* GridSiteLink on/off */
- conf->adminfile = apr_pstrdup(p, GRST_ADMIN_FILE);
- /* GridSiteAdminFile File-value */
- conf->adminuri = NULL; /* GridSiteAdminURI URI-value */
- conf->helpuri = NULL; /* GridSiteHelpURI URI-value */
- conf->dnlists = NULL; /* GridSiteDNlists Search-path */
- conf->dnlistsuri = NULL; /* GridSiteDNlistsURI URI-value */
- conf->adminlist = NULL; /* GridSiteAdminList URI-value */
- conf->gsiproxylimit = 1; /* GridSiteGSIProxyLimit number */
- conf->unzip = NULL; /* GridSiteUnzip file-path */
-
- conf->methods = apr_pstrdup(p, " GET ");
- /* GridSiteMethods methods */
-
- conf->editable = apr_pstrdup(p, " txt shtml html htm css js php jsp ");
- /* GridSiteEditable types */
-
- conf->headfile = apr_pstrdup(p, GRST_HEADFILE);
- conf->footfile = apr_pstrdup(p, GRST_FOOTFILE);
- /* GridSiteHeadFile and GridSiteFootFile file name */
-
- conf->gridhttp = 0; /* GridSiteGridHTTP on/off */
- conf->soap2cgi = 0; /* GridSiteSoap2cgi on/off */
- conf->aclformat = apr_pstrdup(p, "GACL");
- /* GridSiteACLFormat gacl/xacml */
- conf->execmethod = NULL;
- /* GridSiteExecMethod nosetuid/suexec/X509DN/directory */
-
- conf->execugid.uid = 0; /* GridSiteUserGroup User Group */
- conf->execugid.gid = 0; /* ditto */
- conf->execugid.userdir = 0; /* ditto */
-
- conf->diskmode = APR_UREAD | APR_UWRITE;
- /* GridSiteDiskMode group-mode world-mode
- GroupNone | GroupRead | GroupWrite WorldNone | WorldRead */
- }
- else
- {
- conf->auth = UNSET; /* GridSiteAuth on/off */
- conf->envs = UNSET; /* GridSiteEnvs on/off */
- conf->format = UNSET; /* GridSiteHtmlFormat on/off */
- conf->indexes = UNSET; /* GridSiteIndexes on/off */
- conf->indexheader = NULL; /* GridSiteIndexHeader File-value */
- conf->gridsitelink = UNSET; /* GridSiteLink on/off */
- conf->adminfile = NULL; /* GridSiteAdminFile File-value */
- conf->adminuri = NULL; /* GridSiteAdminURI URI-value */
- conf->helpuri = NULL; /* GridSiteHelpURI URI-value */
- conf->dnlists = NULL; /* GridSiteDNlists Search-path */
- conf->dnlistsuri = NULL; /* GridSiteDNlistsURI URI-value */
- conf->adminlist = NULL; /* GridSiteAdminList URI-value */
- conf->gsiproxylimit = UNSET; /* GridSiteGSIProxyLimit number */
- conf->unzip = NULL; /* GridSiteUnzip file-path */
- conf->methods = NULL; /* GridSiteMethods methods */
- conf->editable = NULL; /* GridSiteEditable types */
- conf->headfile = NULL; /* GridSiteHeadFile file name */
- conf->footfile = NULL; /* GridSiteFootFile file name */
- conf->gridhttp = UNSET; /* GridSiteGridHTTP on/off */
- conf->soap2cgi = UNSET; /* GridSiteSoap2cgi on/off */
- conf->aclformat = NULL; /* GridSiteACLFormat gacl/xacml */
- conf->execmethod = NULL; /* GridSiteExecMethod */
- conf->execugid.uid = UNSET; /* GridSiteUserGroup User Group */
- conf->execugid.gid = UNSET; /* ditto */
- conf->execugid.userdir = UNSET; /* ditto */
- conf->diskmode = UNSET; /* GridSiteDiskMode group world */
- }
-
- return conf;
-}
-
-static void *merge_gridsite_dir_config(apr_pool_t *p, void *vserver,
- void *vdirect)
-/* merge directory with server-wide directory configs */
-{
- mod_gridsite_dir_cfg *conf, *server, *direct;
-
- server = (mod_gridsite_dir_cfg *) vserver;
- direct = (mod_gridsite_dir_cfg *) vdirect;
- conf = apr_palloc(p, sizeof(*conf));
-
- if (direct->auth != UNSET) conf->auth = direct->auth;
- else conf->auth = server->auth;
-
- if (direct->envs != UNSET) conf->envs = direct->envs;
- else conf->envs = server->envs;
-
- if (direct->format != UNSET) conf->format = direct->format;
- else conf->format = server->format;
-
- if (direct->indexes != UNSET) conf->indexes = direct->indexes;
- else conf->indexes = server->indexes;
-
- if (direct->gridsitelink != UNSET) conf->gridsitelink=direct->gridsitelink;
- else conf->gridsitelink=server->gridsitelink;
-
- if (direct->indexheader != NULL) conf->indexheader = direct->indexheader;
- else conf->indexheader = server->indexheader;
-
- if (direct->adminfile != NULL) conf->adminfile = direct->adminfile;
- else conf->adminfile = server->adminfile;
-
- if (direct->adminuri != NULL) conf->adminuri = direct->adminuri;
- else conf->adminuri = server->adminuri;
-
- if (direct->helpuri != NULL) conf->helpuri = direct->helpuri;
- else conf->helpuri = server->helpuri;
-
- if (direct->dnlists != NULL) conf->dnlists = direct->dnlists;
- else conf->dnlists = server->dnlists;
-
- if (direct->dnlistsuri != NULL) conf->dnlistsuri = direct->dnlistsuri;
- else conf->dnlistsuri = server->dnlistsuri;
-
- if (direct->adminlist != NULL) conf->adminlist = direct->adminlist;
- else conf->adminlist = server->adminlist;
-
- if (direct->gsiproxylimit != UNSET)
- conf->gsiproxylimit = direct->gsiproxylimit;
- else conf->gsiproxylimit = server->gsiproxylimit;
-
- if (direct->unzip != NULL) conf->unzip = direct->unzip;
- else conf->unzip = server->unzip;
-
- if (direct->methods != NULL) conf->methods = direct->methods;
- else conf->methods = server->methods;
-
- if (direct->editable != NULL) conf->editable = direct->editable;
- else conf->editable = server->editable;
-
- if (direct->headfile != NULL) conf->headfile = direct->headfile;
- else conf->headfile = server->headfile;
-
- if (direct->footfile != NULL) conf->footfile = direct->footfile;
- else conf->footfile = server->footfile;
-
- if (direct->gridhttp != UNSET) conf->gridhttp = direct->gridhttp;
- else conf->gridhttp = server->gridhttp;
-
- if (direct->soap2cgi != UNSET) conf->soap2cgi = direct->soap2cgi;
- else conf->soap2cgi = server->soap2cgi;
-
- if (direct->aclformat != NULL) conf->aclformat = direct->aclformat;
- else conf->aclformat = server->aclformat;
-
- if (direct->execmethod != NULL) conf->execmethod = direct->execmethod;
- else conf->execmethod = server->execmethod;
-
- if (direct->execugid.uid != UNSET)
- { conf->execugid.uid = direct->execugid.uid;
- conf->execugid.gid = direct->execugid.gid;
- conf->execugid.userdir = direct->execugid.userdir; }
- else
- { conf->execugid.uid = server->execugid.uid;
- conf->execugid.gid = server->execugid.gid;
- conf->execugid.userdir = server->execugid.userdir; }
-
- if (direct->diskmode != UNSET) conf->diskmode = direct->diskmode;
- else conf->diskmode = server->diskmode;
-
- return conf;
-}
-
-static const char *mod_gridsite_take1_cmds(cmd_parms *a, void *cfg,
- const char *parm)
-{
- int n, i;
- char *p;
-
- if (strcasecmp(a->cmd->name, "GridSiteOnetimesDir") == 0)
- {
- if (a->server->is_virtual)
- return "GridSiteOnetimesDir cannot be used inside a virtual server";
-
- onetimesdir = apr_pstrdup(a->pool, parm);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteGridHTTPport") == 0)
- {
- gridhttpport = atoi(parm);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteCastDNlists") == 0)
- {
- if (a->server->is_virtual)
- return "GridSiteDNlists cannot be used inside a virtual server";
-
- sitecastdnlists = apr_pstrdup(a->pool, parm);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteCastUniPort") == 0)
- {
- if (a->server->is_virtual)
- return "GridSiteCastUniPort cannot be used inside a virtual server";
-
- if (sscanf(parm, "%d", &(sitecastgroups[0].port)) != 1)
- return "Failed parsing GridSiteCastUniPort numeric value";
- }
- else if (strcasecmp(a->cmd->name, "GridSiteCastGroup") == 0)
- {
- if (a->server->is_virtual)
- return "GridSiteCastGroup cannot be used inside a virtual server";
-
- for (i=1; i <= GRST_SITECAST_GROUPS; ++i)
- {
- if (sitecastgroups[i].port == 0) /* a free slot */
- {
- sitecastgroups[i].port = GRST_HTCP_PORT;
-
- if (sscanf(parm, "%d.%d.%d.%d:%d",
- &(sitecastgroups[i].quad1),
- &(sitecastgroups[i].quad2),
- &(sitecastgroups[i].quad3),
- &(sitecastgroups[i].quad4),
- &(sitecastgroups[i].port)) < 4)
- return "Failed parsing GridSiteCastGroup nnn.nnn.nnn.nnn[:port]";
-
- break;
- }
- }
-
- if (i > GRST_SITECAST_GROUPS)
- return "Maximum GridSiteCastGroup groups reached";
- }
- else if (strcasecmp(a->cmd->name, "GridSiteAdminFile") == 0)
- {
- if (index(parm, '/') != NULL)
- return "/ not permitted in GridSiteAdminFile";
-
- ((mod_gridsite_dir_cfg *) cfg)->adminfile =
- apr_pstrdup(a->pool, parm);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteAdminURI") == 0)
- {
- if (*parm != '/') return "GridSiteAdminURI must begin with /";
-
- ((mod_gridsite_dir_cfg *) cfg)->adminuri =
- apr_pstrdup(a->pool, parm);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteHelpURI") == 0)
- {
- if (*parm != '/') return "GridSiteHelpURI must begin with /";
-
- ((mod_gridsite_dir_cfg *) cfg)->helpuri =
- apr_pstrdup(a->pool, parm);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteDNlists") == 0)
- {
- ((mod_gridsite_dir_cfg *) cfg)->dnlists =
- apr_pstrdup(a->pool, parm);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteDNlistsURI") == 0)
- {
- if (*parm != '/') return "GridSiteDNlistsURI must begin with /";
-
- if ((*parm != '\0') && (parm[strlen(parm) - 1] == '/'))
- ((mod_gridsite_dir_cfg *) cfg)->dnlistsuri =
- apr_pstrdup(a->pool, parm);
- else
- ((mod_gridsite_dir_cfg *) cfg)->dnlistsuri =
- apr_pstrcat(a->pool, parm, "/", NULL);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteAdminList") == 0)
- {
- ((mod_gridsite_dir_cfg *) cfg)->adminlist =
- apr_pstrdup(a->pool, parm);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteGSIProxyLimit") == 0)
- {
- n = -1;
-
- if ((sscanf(parm, "%d", &n) == 1) && (n >= 0))
- ((mod_gridsite_dir_cfg *) cfg)->gsiproxylimit = n;
- else return "GridSiteGSIProxyLimit must be a number >= 0";
- }
- else if (strcasecmp(a->cmd->name, "GridSiteUnzip") == 0)
- {
- if (*parm != '/') return "GridSiteUnzip must begin with /";
-
- ((mod_gridsite_dir_cfg *) cfg)->unzip =
- apr_pstrdup(a->pool, parm);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteMethods") == 0)
- {
- ((mod_gridsite_dir_cfg *) cfg)->methods =
- apr_psprintf(a->pool, " %s ", parm);
-
- for (p = ((mod_gridsite_dir_cfg *) cfg)->methods;
- *p != '\0';
- ++p) if (*p == '\t') *p = ' ';
- }
- else if (strcasecmp(a->cmd->name, "GridSiteEditable") == 0)
- {
- ((mod_gridsite_dir_cfg *) cfg)->editable =
- apr_psprintf(a->pool, " %s ", parm);
-
- for (p = ((mod_gridsite_dir_cfg *) cfg)->editable;
- *p != '\0';
- ++p) if (*p == '\t') *p = ' ';
- }
- else if (strcasecmp(a->cmd->name, "GridSiteHeadFile") == 0)
- {
- ((mod_gridsite_dir_cfg *) cfg)->headfile =
- apr_pstrdup(a->pool, parm);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteFootFile") == 0)
- {
- ((mod_gridsite_dir_cfg *) cfg)->footfile =
- apr_pstrdup(a->pool, parm);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteIndexHeader") == 0)
- {
- if (index(parm, '/') != NULL)
- return "/ not permitted in GridSiteIndexHeader";
-
- ((mod_gridsite_dir_cfg *) cfg)->indexheader =
- apr_pstrdup(a->pool, parm);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteACLFormat") == 0)
- {
- if ((strcasecmp(parm,"GACL") != 0) &&
- (strcasecmp(parm,"XACML") != 0))
- return "GridsiteACLFormat must be either GACL or XACML";
-
- ((mod_gridsite_dir_cfg *) cfg)->aclformat = apr_pstrdup(a->pool, parm);
- }
- else if (strcasecmp(a->cmd->name, "GridSiteExecMethod") == 0)
- {
- if (strcasecmp(parm, "nosetuid") == 0)
- {
- ((mod_gridsite_dir_cfg *) cfg)->execmethod = NULL;
- return NULL;
- }
-
- if ((strcasecmp(parm, "suexec") != 0) &&
- (strcasecmp(parm, "X509DN") != 0) &&
- (strcasecmp(parm, "directory") != 0))
- return "GridsiteExecMethod must be nosetuid, suexec, X509DN or directory";
-
- ((mod_gridsite_dir_cfg *) cfg)->execmethod = apr_pstrdup(a->pool, parm);
- }
-
- return NULL;
-}
-
-static const char *mod_gridsite_take2_cmds(cmd_parms *a, void *cfg,
- const char *parm1, const char *parm2)
-{
- int i;
-
- if (strcasecmp(a->cmd->name, "GridSiteUserGroup") == 0)
- {
- if (!(unixd_config.suexec_enabled))
- return "Using GridSiteUserGroup will "
- "require rebuilding Apache with suexec support!";
-
- /* NB ap_uname2id/ap_gname2id are NOT thread safe - but OK
- as long as not used in .htaccess, just at server start time */
-
- ((mod_gridsite_dir_cfg *) cfg)->execugid.uid = ap_uname2id(parm1);
- ((mod_gridsite_dir_cfg *) cfg)->execugid.gid = ap_gname2id(parm2);
- ((mod_gridsite_dir_cfg *) cfg)->execugid.userdir = 0;
- }
- else if (strcasecmp(a->cmd->name, "GridSiteDiskMode") == 0)
- {
- if ((strcasecmp(parm1, "GroupNone" ) != 0) &&
- (strcasecmp(parm1, "GroupRead" ) != 0) &&
- (strcasecmp(parm1, "GroupWrite") != 0))
- return "First parameter of GridSiteDiskMode must be "
- "GroupNone, GroupRead or GroupWrite!";
-
- if ((strcasecmp(parm2, "WorldNone" ) != 0) &&
- (strcasecmp(parm2, "WorldRead" ) != 0))
- return "Second parameter of GridSiteDiskMode must be "
- "WorldNone or WorldRead!";
-
- ((mod_gridsite_dir_cfg *) cfg)->diskmode =
- APR_UREAD | APR_UWRITE
- | ( APR_GREAD * (strcasecmp(parm1, "GroupRead") == 0))
- | ((APR_GREAD | APR_GWRITE) * (strcasecmp(parm1, "GroupWrite") == 0))
- | ((APR_GREAD | APR_WREAD) * (strcasecmp(parm2, "WorldRead") == 0));
- }
- else if (strcasecmp(a->cmd->name, "GridSiteCastAlias") == 0)
- {
- for (i=0; i < GRST_SITECAST_ALIASES; ++i) /* look for free slot */
- {
- if (sitecastaliases[i].sitecast_url == NULL)
- {
- sitecastaliases[i].sitecast_url = parm1;
- sitecastaliases[i].local_path = parm2;
- sitecastaliases[i].server = a->server;
- break;
- }
- }
- }
-
- return NULL;
-}
-
-static const char *mod_gridsite_flag_cmds(cmd_parms *a, void *cfg,
- int flag)
-{
- if (strcasecmp(a->cmd->name, "GridSiteAuth") == 0)
- {
- ((mod_gridsite_dir_cfg *) cfg)->auth = flag;
- }
- else if (strcasecmp(a->cmd->name, "GridSiteEnvs") == 0)
- {
- ((mod_gridsite_dir_cfg *) cfg)->envs = flag;
- }
- else if (strcasecmp(a->cmd->name, "GridSiteHtmlFormat") == 0)
- {
- ((mod_gridsite_dir_cfg *) cfg)->format = flag;
- }
- else if (strcasecmp(a->cmd->name, "GridSiteIndexes") == 0)
- {
- ((mod_gridsite_dir_cfg *) cfg)->indexes = flag;
- }
- else if (strcasecmp(a->cmd->name, "GridSiteLink") == 0)
- {
- ((mod_gridsite_dir_cfg *) cfg)->gridsitelink = flag;
- }
- else if (strcasecmp(a->cmd->name, "GridSiteGridHTTP") == 0)
- {
-// TODO: return error if try this on non-HTTPS virtual server
-
- ((mod_gridsite_dir_cfg *) cfg)->gridhttp = flag;
- }
- else if (strcasecmp(a->cmd->name, "GridSiteSoap2cgi") == 0)
- {
- ((mod_gridsite_dir_cfg *) cfg)->soap2cgi = flag;
- }
-
- return NULL;
-}
-
-static const command_rec mod_gridsite_cmds[] =
-{
-// TODO: need to check and document valid contexts for each command!
-
- AP_INIT_FLAG("GridSiteAuth", mod_gridsite_flag_cmds,
- NULL, OR_FILEINFO, "on or off"),
- AP_INIT_FLAG("GridSiteEnvs", mod_gridsite_flag_cmds,
- NULL, OR_FILEINFO, "on or off"),
- AP_INIT_FLAG("GridSiteHtmlFormat", mod_gridsite_flag_cmds,
- NULL, OR_FILEINFO, "on or off"),
- AP_INIT_FLAG("GridSiteIndexes", mod_gridsite_flag_cmds,
- NULL, OR_FILEINFO, "on or off"),
- AP_INIT_FLAG("GridSiteLink", mod_gridsite_flag_cmds,
- NULL, OR_FILEINFO, "on or off"),
-
- AP_INIT_TAKE1("GridSiteAdminFile", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "Ghost per-directory admin CGI"),
- AP_INIT_TAKE1("GridSiteAdminURI", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "URI of real gridsite-admin.cgi"),
- AP_INIT_TAKE1("GridSiteHelpURI", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "URI of Website Help pages"),
- AP_INIT_TAKE1("GridSiteDNlists", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "DN Lists directories search path"),
- AP_INIT_TAKE1("GridSiteDNlistsURI", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "URI of published DN lists"),
- AP_INIT_TAKE1("GridSiteAdminList", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "URI of admin DN List"),
- AP_INIT_TAKE1("GridSiteGSIProxyLimit", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "Max level of GSI proxy validity"),
- AP_INIT_TAKE1("GridSiteUnzip", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "Absolute path to unzip command"),
-
- AP_INIT_RAW_ARGS("GridSiteMethods", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "permitted HTTP methods"),
- AP_INIT_RAW_ARGS("GridSiteEditable", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "editable file extensions"),
- AP_INIT_TAKE1("GridSiteHeadFile", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "filename of HTML header"),
- AP_INIT_TAKE1("GridSiteFootFile", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "filename of HTML footer"),
- AP_INIT_TAKE1("GridSiteIndexHeader", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "filename of directory header"),
-
- AP_INIT_FLAG("GridSiteGridHTTP", mod_gridsite_flag_cmds,
- NULL, OR_FILEINFO, "on or off"),
- AP_INIT_TAKE1("GridSiteGridHTTPport", mod_gridsite_take1_cmds,
- NULL, RSRC_CONF, "GridHTTP port"),
- AP_INIT_TAKE1("GridSiteOnetimesDir", mod_gridsite_take1_cmds,
- NULL, RSRC_CONF, "directory with GridHTTP onetime passcodes"),
-
- AP_INIT_TAKE1("GridSiteCastDNlists", mod_gridsite_take1_cmds,
- NULL, RSRC_CONF, "DN Lists directories search path for SiteCast"),
- AP_INIT_TAKE1("GridSiteCastUniPort", mod_gridsite_take1_cmds,
- NULL, RSRC_CONF, "UDP port for unicast/replies"),
- AP_INIT_TAKE1("GridSiteCastGroup", mod_gridsite_take1_cmds,
- NULL, RSRC_CONF, "multicast group[:port] to listen for HTCP on"),
- AP_INIT_TAKE2("GridSiteCastAlias", mod_gridsite_take2_cmds,
- NULL, RSRC_CONF, "URL and local path mapping"),
-
- AP_INIT_FLAG("GridSiteSoap2cgi", mod_gridsite_flag_cmds,
- NULL, OR_FILEINFO, "on or off"),
-
- AP_INIT_TAKE1("GridSiteACLFormat", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "format to save access control lists in"),
-
- AP_INIT_TAKE1("GridSiteExecMethod", mod_gridsite_take1_cmds,
- NULL, OR_FILEINFO, "execution strategy used by gsexec"),
-
- AP_INIT_TAKE2("GridSiteUserGroup", mod_gridsite_take2_cmds,
- NULL, OR_FILEINFO,
- "user and group of gsexec processes in suexec mode"),
-
- AP_INIT_TAKE2("GridSiteDiskMode", mod_gridsite_take2_cmds,
- NULL, OR_FILEINFO,
- "group and world file modes for new files/directories"),
-
- {NULL}
-};
-
-static int mod_gridsite_first_fixups(request_rec *r)
-{
- mod_gridsite_dir_cfg *conf;
-
- if (r->finfo.filetype != APR_DIR) return DECLINED;
-
- conf = (mod_gridsite_dir_cfg *)
- ap_get_module_config(r->per_dir_config, &gridsite_module);
-
- /* we handle DN Lists as regular files, even if they also match
- directory names */
-
- if ((conf != NULL) &&
- (conf->dnlistsuri != NULL) &&
- (strncmp(r->uri, conf->dnlistsuri, strlen(conf->dnlistsuri)) == 0) &&
- (strcmp(r->uri, conf->dnlistsuri) != 0))
- {
- r->finfo.filetype = APR_REG;
- }
-
- return DECLINED;
-}
-
-void GRST_creds_to_conn(conn_rec *conn,
- STACK_OF(X509) *certstack, X509 *peercert)
-{
- int i, lastcred;
- const int maxcreds = 99;
- const size_t credlen = 1024;
- char creds[maxcreds][credlen+1], envname[14];
-
- if ((certstack != NULL) && (conn->notes != NULL) &&
- (apr_table_get(conn->notes, "GRST_creds_to_conn") != NULL)) return;
-
- /* Put result of GRSTx509CompactCreds() into connection notes */
-
- apr_table_set(conn->notes, "GRST_creds_to_conn", "yes");
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, conn->base_server,
- "set GRST_creds_to_conn");
-
- if (GRSTx509CompactCreds(&lastcred, maxcreds, credlen, (char *) creds,
- certstack, GRST_VOMS_DIR, peercert) == GRST_RET_OK)
- {
- for (i=0; i <= lastcred; ++i)
- {
- apr_table_setn(conn->notes,
- apr_psprintf(conn->pool, "GRST_CRED_%d", i),
- apr_pstrdup(conn->pool, creds[i]));
-
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, conn->base_server,
- "store GRST_CRED_%d=%s", i, creds[i]);
-
- }
-
- /* free remaining dup'd certs? */
- }
-}
-
-static int mod_gridsite_perm_handler(request_rec *r)
-/*
- Do authentication/authorization here rather than in the normal module
- auth functions since the results of mod_ssl are available.
-
- We also publish environment variables here if requested by GridSiteEnv.
-*/
-{
- int retcode = DECLINED, i, n, file_is_acl = 0,
- destination_is_acl = 0, proxylevel;
- char *dn, *p, envname[14], *grst_cred_0 = NULL, *dir_path,
- *remotehost, s[99], *grst_cred_i, *cookies, *file,
- *gridauthonetime = NULL, *cookiefile, oneline[1025], *key_i,
- *destination = NULL, *destination_uri = NULL, *querytmp,
- *destination_prefix = NULL, *destination_translated = NULL;
- const char *content_type;
- time_t now, notbefore, notafter;
- apr_table_t *env;
- apr_finfo_t cookiefile_info;
- apr_file_t *fp;
- request_rec *destreq;
- GRSTgaclCred *cred = NULL, *cred_0 = NULL;
- GRSTgaclUser *user = NULL;
- GRSTgaclPerm perm = GRST_PERM_NONE, destination_perm = GRST_PERM_NONE;
- GRSTgaclAcl *acl = NULL;
- mod_gridsite_dir_cfg *cfg;
- SSLConnRec *sslconn;
- STACK_OF(X509) *certstack;
- X509 *peercert;
-
- cfg = (mod_gridsite_dir_cfg *)
- ap_get_module_config(r->per_dir_config, &gridsite_module);
-
- if (cfg == NULL) return DECLINED;
-
- if ((cfg->auth == 0) &&
- (cfg->envs == 0))
- return DECLINED; /* if not turned on, look invisible */
-
- env = r->subprocess_env;
-
- /* do we need/have per-connection (SSL) cred variable(s)? */
-
- sslconn = (SSLConnRec *) ap_get_module_config(r->connection->conn_config,
- &ssl_module);
-
- if ((sslconn != NULL) && (sslconn->ssl != NULL) &&
- (r->connection->notes != NULL) &&
- (apr_table_get(r->connection->notes, "GRST_creds_to_conn") == NULL))
- {
- certstack = SSL_get_peer_cert_chain(sslconn->ssl);
- peercert = SSL_get_peer_certificate(sslconn->ssl);
-
- GRST_creds_to_conn(r->connection, certstack, peercert);
- }
-
- proxylevel = ((mod_gridsite_dir_cfg *) cfg)->gsiproxylimit + 1;
-
- if ((user == NULL) &&
- (r->connection->notes != NULL) &&
- ((grst_cred_0 = (char *)
- apr_table_get(r->connection->notes, "GRST_CRED_0")) != NULL) &&
- (sscanf(grst_cred_0, "X509USER %*d %*d %d ", &proxylevel) == 1) &&
- (proxylevel <= ((mod_gridsite_dir_cfg *) cfg)->gsiproxylimit))
- {
- apr_table_setn(env, "GRST_CRED_0", grst_cred_0);
-
- cred_0 = GRSTx509CompactToCred(grst_cred_0);
- if (cred_0 != NULL)
- {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "Using identity %s from SSL/TLS", grst_cred_0);
-
- user = GRSTgaclUserNew(cred_0);
-
- /* check for VOMS GRST_CRED_i too */
-
- for (i=1; ; ++i)
- {
- snprintf(envname, sizeof(envname), "GRST_CRED_%d", i);
- if (grst_cred_i = (char *)
- apr_table_get(r->connection->notes,envname))
- {
- if (((mod_gridsite_dir_cfg *) cfg)->envs)
- apr_table_setn(env,
- apr_pstrdup(r->pool, envname),
- grst_cred_i);
-
- if (cred = GRSTx509CompactToCred(grst_cred_i))
- GRSTgaclUserAddCred(user, cred);
- }
- else break; /* GRST_CRED_i are numbered consecutively */
- }
- }
- }
-
- if ((user != NULL) && ((mod_gridsite_dir_cfg *) cfg)->dnlists)
- GRSTgaclUserSetDNlists(user, ((mod_gridsite_dir_cfg *) cfg)->dnlists);
-
- /* add DNS credential */
-
- remotehost = (char *) ap_get_remote_host(r->connection,
- r->per_dir_config, REMOTE_DOUBLE_REV, NULL);
- if ((remotehost != NULL) && (*remotehost != '\0'))
- {
- cred = GRSTgaclCredNew("dns");
- GRSTgaclCredAddValue(cred, "hostname", remotehost);
-
- if (user == NULL) user = GRSTgaclUserNew(cred);
- else GRSTgaclUserAddCred(user, cred);
- }
-
- /* check for Destination: header and evaluate if present */
-
- if ((destination = (char *) apr_table_get(r->headers_in,
- "Destination")) != NULL)
- {
- destination_prefix = apr_psprintf(r->pool, "https://%s:%d/",
- r->server->server_hostname, (int) r->server->port);
-
- if (strncmp(destination_prefix, destination,
- strlen(destination_prefix)) == 0)
- destination_uri = &destination[strlen(destination_prefix)-1];
- else if ((int) r->server->port == 443)
- {
- destination_prefix = apr_psprintf(r->pool, "https://%s/",
- r->server->server_hostname);
-
- if (strncmp(destination_prefix, destination,
- strlen(destination_prefix)) == 0)
- destination_uri = &destination[strlen(destination_prefix)-1];
- }
-
- if (destination_uri != NULL)
- {
- destreq = ap_sub_req_method_uri("GET", destination_uri, r, NULL);
-
- if ((destreq != NULL) && (destreq->filename != NULL)
- && (destreq->path_info != NULL))
- {
- destination_translated = apr_pstrcat(r->pool,
- destreq->filename, destreq->path_info, NULL);
-
- apr_table_setn(r->notes, "GRST_DESTINATION_TRANSLATED",
- destination_translated);
-
- if (((mod_gridsite_dir_cfg *) cfg)->envs)
- apr_table_setn(env, "GRST_DESTINATION_TRANSLATED",
- destination_translated);
-
- p = rindex(destination_translated, '/');
- if ((p != NULL) && (strcmp(&p[1], GRST_ACL_FILE) == 0))
- destination_is_acl = 1;
- }
- }
- }
-
- /* this checks for NULL arguments itself */
- if (GRSTgaclDNlistHasUser(((mod_gridsite_dir_cfg *) cfg)->adminlist, user))
- {
- perm = GRST_PERM_ALL;
- if (destination_translated != NULL) destination_perm = GRST_PERM_ALL;
- }
- else
- {
- acl = GRSTgaclAclLoadforFile(r->filename);
- if (acl != NULL) perm = GRSTgaclAclTestUser(acl, user);
- GRSTgaclAclFree(acl);
-
- if (destination_translated != NULL)
- {
- acl = GRSTgaclAclLoadforFile(destination_translated);
- if (acl != NULL) destination_perm = GRSTgaclAclTestUser(acl, user);
- GRSTgaclAclFree(acl);
-
- apr_table_setn(r->notes, "GRST_DESTINATION_PERM",
- apr_psprintf(r->pool, "%d", destination_perm));
-
- if (((mod_gridsite_dir_cfg *) cfg)->envs)
- apr_table_setn(env, "GRST_DESTINATION_PERM",
- apr_psprintf(r->pool, "%d", destination_perm));
- }
- }
-
- /* first look for GRIDHTTP_ONETIME cookie */
-
- if ((p = (char *) apr_table_get(r->headers_in, "Cookie")) != NULL)
- {
- cookies = apr_pstrcat(r->pool, " ", p, NULL);
- gridauthonetime = strstr(cookies, " GRIDHTTP_ONETIME=");
-
- if (gridauthonetime != NULL)
- {
- for (p = &gridauthonetime[18];
- (*p != '\0') && (*p != ';'); ++p)
- if (!isalnum(*p)) *p = '\0';
- }
- }
-
- /* then look for GRIDHTTP_ONETIME in QUERY_STRING ie after ? */
-
- if (gridauthonetime == NULL)
- {
- if ((r->parsed_uri.query != NULL) && (r->parsed_uri.query[0] != '\0'))
- {
- querytmp = apr_pstrcat(r->pool,"&",r->parsed_uri.query,"&",NULL);
-
- gridauthonetime = strstr(querytmp, "&GRIDHTTP_ONETIME=");
-
- if (gridauthonetime != NULL)
- {
- for (p = &gridauthonetime[18];
- (*p != '\0') && (*p != '&'); ++p)
- if (!isalnum(*p)) *p = '\0';
- }
- }
- }
-
- if ((gridauthonetime != NULL) && (gridauthonetime[0] != '\0'))
- {
- cookiefile = apr_psprintf(r->pool, "%s/%s",
- ap_server_root_relative(r->pool,
- onetimesdir),
- &gridauthonetime[18]);
-
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "Opening GridHTTP onetime file %s", cookiefile);
-
- if ((apr_stat(&cookiefile_info, cookiefile,
- APR_FINFO_TYPE, r->pool) == APR_SUCCESS) &&
- (cookiefile_info.filetype == APR_REG) &&
- (apr_file_open(&fp, cookiefile, APR_READ, 0, r->pool)
- == APR_SUCCESS))
- {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "Reading GridHTTP onetime file %s", cookiefile);
-
- while (apr_file_gets(oneline,
- sizeof(oneline), fp) == APR_SUCCESS)
- {
- p = index(oneline, '\n');
- if (p != NULL) *p = '\0';
-
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "%s: %s", cookiefile, oneline);
-
- if ((strncmp(oneline, "expires=", 8) == 0) &&
- (apr_time_from_sec(atoll(&oneline[8])) <
- apr_time_now()))
- break;
- else if ((strncmp(oneline, "domain=", 7) == 0) &&
- (strcmp(&oneline[7], r->hostname) != 0))
- break; /* exact needed in the version */
- else if ((strncmp(oneline, "path=", 5) == 0) &&
- (strcmp(&oneline[5], r->uri) != 0))
- break;
- else if (strncmp(oneline, "onetime=yes", 11) == 0)
- apr_file_remove(cookiefile, r->pool);
- else if (strncmp(oneline, "method=PUT", 10) == 0)
- perm |= GRST_PERM_WRITE;
- else if (strncmp(oneline, "method=GET", 10) == 0)
- perm |= GRST_PERM_READ;
- }
-
- apr_file_close(fp);
- }
- }
-
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "After GACL/Onetime evaluation, GRST_PERM=%d", perm);
-
- /* set permission and GACL environment variables */
-
- apr_table_setn(r->notes, "GRST_PERM", apr_psprintf(r->pool, "%d", perm));
-
- if (((mod_gridsite_dir_cfg *) cfg)->envs)
- {
- apr_table_setn(env, "GRST_PERM", apr_psprintf(r->pool, "%d", perm));
-
- if (((dir_path = apr_pstrdup(r->pool, r->filename)) != NULL) &&
- ((p = rindex(dir_path, '/')) != NULL))
- {
- *p = '\0';
- apr_table_setn(env, "GRST_DIR_PATH", dir_path);
- }
-
- if (((mod_gridsite_dir_cfg *) cfg)->helpuri != NULL)
- apr_table_setn(env, "GRST_HELP_URI",
- ((mod_gridsite_dir_cfg *) cfg)->helpuri);
-
- if (((mod_gridsite_dir_cfg *) cfg)->adminfile != NULL)
- apr_table_setn(env, "GRST_ADMIN_FILE",
- ((mod_gridsite_dir_cfg *) cfg)->adminfile);
-
- if (((mod_gridsite_dir_cfg *) cfg)->editable != NULL)
- apr_table_setn(env, "GRST_EDITABLE",
- ((mod_gridsite_dir_cfg *) cfg)->editable);
-
- if (((mod_gridsite_dir_cfg *) cfg)->headfile != NULL)
- apr_table_setn(env, "GRST_HEAD_FILE",
- ((mod_gridsite_dir_cfg *) cfg)->headfile);
-
- if (((mod_gridsite_dir_cfg *) cfg)->footfile != NULL)
- apr_table_setn(env, "GRST_FOOT_FILE",
- ((mod_gridsite_dir_cfg *) cfg)->footfile);
-
- if (((mod_gridsite_dir_cfg *) cfg)->dnlists != NULL)
- apr_table_setn(env, "GRST_DN_LISTS",
- ((mod_gridsite_dir_cfg *) cfg)->dnlists);
-
- if (((mod_gridsite_dir_cfg *) cfg)->dnlistsuri != NULL)
- apr_table_setn(env, "GRST_DN_LISTS_URI",
- ((mod_gridsite_dir_cfg *) cfg)->dnlistsuri);
-
- if (((mod_gridsite_dir_cfg *) cfg)->adminlist != NULL)
- apr_table_setn(env, "GRST_ADMIN_LIST",
- ((mod_gridsite_dir_cfg *) cfg)->adminlist);
-
- apr_table_setn(env, "GRST_GSIPROXY_LIMIT",
- apr_psprintf(r->pool, "%d",
- ((mod_gridsite_dir_cfg *)cfg)->gsiproxylimit));
-
- if (((mod_gridsite_dir_cfg *) cfg)->unzip != NULL)
- apr_table_setn(env, "GRST_UNZIP",
- ((mod_gridsite_dir_cfg *) cfg)->unzip);
-
- if (!(((mod_gridsite_dir_cfg *) cfg)->gridsitelink))
- apr_table_setn(env, "GRST_NO_LINK", "1");
-
- if (((mod_gridsite_dir_cfg *) cfg)->aclformat != NULL)
- apr_table_setn(env, "GRST_ACL_FORMAT",
- ((mod_gridsite_dir_cfg *) cfg)->aclformat);
-
- if (((mod_gridsite_dir_cfg *) cfg)->execmethod != NULL)
- {
- apr_table_setn(env, "GRST_EXEC_METHOD",
- ((mod_gridsite_dir_cfg *) cfg)->execmethod);
-
- if ((strcasecmp(((mod_gridsite_dir_cfg *) cfg)->execmethod,
- "directory") == 0) && (r->filename != NULL))
- {
- if ((r->content_type != NULL) &&
- (strcmp(r->content_type, DIR_MAGIC_TYPE) == 0))
- apr_table_setn(env, "GRST_EXEC_DIRECTORY", r->filename);
- else
- {
- file = apr_pstrdup(r->pool, r->filename);
- p = rindex(file, '/');
- if (p != NULL)
- {
- *p = '\0';
- apr_table_setn(env, "GRST_EXEC_DIRECTORY", file);
- }
- }
- }
- }
-
- apr_table_setn(env, "GRST_DISK_MODE",
- apr_psprintf(r->pool, "0x%04x",
- ((mod_gridsite_dir_cfg *)cfg)->diskmode));
- }
-
- if (((mod_gridsite_dir_cfg *) cfg)->auth)
- {
- /* *** Check HTTP method to decide which perm bits to check *** */
-
- if ((r->filename != NULL) &&
- ((p = rindex(r->filename, '/')) != NULL) &&
- (strcmp(&p[1], GRST_ACL_FILE) == 0)) file_is_acl = 1;
-
- content_type = r->content_type;
- if ((content_type != NULL) &&
- (strcmp(content_type, DIR_MAGIC_TYPE) == 0) &&
- (((mod_gridsite_dir_cfg *) cfg)->dnlistsuri != NULL) &&
- (strncmp(r->uri,
- ((mod_gridsite_dir_cfg *) cfg)->dnlistsuri,
- strlen(((mod_gridsite_dir_cfg *) cfg)->dnlistsuri)) == 0) &&
- (strlen(r->uri) > strlen(((mod_gridsite_dir_cfg *) cfg)->dnlistsuri)))
- content_type = "text/html";
-
- if ( GRSTgaclPermHasNone(perm) ||
-
- /* first two M_GET conditions make the subtle distinction
- between .../ that maps to .../index.html (governed by
- Read perm) or to dir list (governed by List perm);
- third M_GET condition deals with typeless CGI requests */
-
- ((r->method_number == M_GET) &&
- !GRSTgaclPermHasRead(perm) &&
- (content_type != NULL) &&
- (strcmp(content_type, DIR_MAGIC_TYPE) != 0)) ||
-
- ((r->method_number == M_GET) &&
- !GRSTgaclPermHasList(perm) &&
- (content_type != NULL) &&
- (strcmp(content_type, DIR_MAGIC_TYPE) == 0)) ||
-
- ((r->method_number == M_GET) &&
- !GRSTgaclPermHasRead(perm) &&
- (content_type == NULL)) ||
-
- ((r->method_number == M_POST) && !GRSTgaclPermHasRead(perm) ) ||
-
- (((r->method_number == M_PUT) ||
- (r->method_number == M_DELETE)) &&
- !GRSTgaclPermHasWrite(perm) && !file_is_acl) ||
-
- ((r->method_number == M_MOVE) &&
- ((!GRSTgaclPermHasWrite(perm) && !file_is_acl) ||
- (!GRSTgaclPermHasAdmin(perm) && file_is_acl) ||
- (!GRSTgaclPermHasWrite(destination_perm)
- && !destination_is_acl) ||
- (!GRSTgaclPermHasAdmin(destination_perm)
- && destination_is_acl)) ) ||
-
- (((r->method_number == M_PUT) ||
- (r->method_number == M_DELETE)) &&
- !GRSTgaclPermHasAdmin(perm) && file_is_acl)
-
- ) retcode = HTTP_FORBIDDEN;
- }
-
- return retcode;
-}
-
-int GRST_X509_check_issued_wrapper(X509_STORE_CTX *ctx,X509 *x,X509 *issuer)
-/* We change the default callback to use our wrapper and discard errors
- due to GSI proxy chains (ie where users certs act as CAs) */
-{
- int ret;
- ret = X509_check_issued(issuer, x);
- if (ret == X509_V_OK)
- return 1;
-
- /* Non self-signed certs without signing are ok if they passed
- the other checks inside X509_check_issued. Is this enough? */
- if ((ret == X509_V_ERR_KEYUSAGE_NO_CERTSIGN) &&
- (X509_NAME_cmp(X509_get_subject_name(issuer),
- X509_get_subject_name(x)) != 0)) return 1;
-
- /* If we haven't asked for issuer errors don't set ctx */
- if (!(ctx->flags & X509_V_FLAG_CB_ISSUER_CHECK)) return 0;
-
- ctx->error = ret;
- ctx->current_cert = x;
- ctx->current_issuer = issuer;
- return ctx->verify_cb(0, ctx);
-}
-
-/* Later OpenSSL versions add a second pointer ... */
-int GRST_verify_cert_wrapper(X509_STORE_CTX *ctx, void *p)
-
-/* Earlier ones have a single argument ... */
-// int GRST_verify_cert_wrapper(X509_STORE_CTX *ctx)
-
-/* Before 0.9.7 we cannot change the check_issued callback directly in
- the X509_STORE, so we must insert it in another callback that gets
- called early enough */
-{
- ctx->check_issued = GRST_X509_check_issued_wrapper;
-
- return X509_verify_cert(ctx);
-}
-
-int GRST_callback_SSLVerify_wrapper(int ok, X509_STORE_CTX *ctx)
-{
- SSL *ssl = (SSL *) X509_STORE_CTX_get_app_data(ctx);
- conn_rec *conn = (conn_rec *) SSL_get_app_data(ssl);
- server_rec *s = conn->base_server;
- SSLConnRec *sslconn =
- (SSLConnRec *) ap_get_module_config(conn->conn_config, &ssl_module);
- int errnum = X509_STORE_CTX_get_error(ctx);
- int errdepth = X509_STORE_CTX_get_error_depth(ctx);
- int returned_ok;
- int first_non_ca;
- STACK_OF(X509) *certstack;
-
- /*
- * GSI Proxy user-cert-as-CA handling:
- * we skip Invalid CA errors at this stage, since we will check this
- * again at errdepth=0 for the full chain using GRSTx509CheckChain
- */
- if (errnum == X509_V_ERR_INVALID_CA)
- {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
- "Skip Invalid CA error in case a GSI Proxy");
-
- sslconn->verify_error = NULL;
- ok = TRUE;
- errnum = X509_V_OK;
- X509_STORE_CTX_set_error(ctx, errnum);
- }
-
- /*
- * New style GSI Proxy handling, with critical ProxyCertInfo
- * extension: we use GRSTx509KnownCriticalExts() to check this
- */
-#ifndef X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION
-#define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34
-#endif
- if (errnum == X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION)
- {
- if (GRSTx509KnownCriticalExts(X509_STORE_CTX_get_current_cert(ctx))
- == GRST_RET_OK)
- {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
- "GRSTx509KnownCriticalExts() accepts previously "
- "Unhandled Critical Extension (GSI Proxy?)");
-
- sslconn->verify_error = NULL;
- ok = TRUE;
- errnum = X509_V_OK;
- X509_STORE_CTX_set_error(ctx, errnum);
- }
- }
-
- returned_ok = ssl_callback_SSLVerify(ok, ctx);
-
- /* in case ssl_callback_SSLVerify changed it */
- errnum = X509_STORE_CTX_get_error(ctx);
-
- if ((errdepth == 0) && (errnum == X509_V_OK))
- /*
- * We've now got the last certificate - the identity being used for
- * this connection. At this point we check the whole chain for valid
- * CAs or, failing that, GSI-proxy validity using GRSTx509CheckChain.
- */
- {
- errnum = GRSTx509CheckChain(&first_non_ca, ctx);
-
- if (errnum != X509_V_OK)
- {
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
- "Invalid certificate chain reported by "
- "GRSTx509CheckChain()");
-
- sslconn->verify_error = X509_verify_cert_error_string(errnum);
- ok = FALSE;
- }
- else
- {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "Valid certificate"
- " chain reported by GRSTx509CheckChain()");
-
- /* Put result of GRSTx509CompactCreds() into connection notes */
- if ((certstack =
- (STACK_OF(X509) *) X509_STORE_CTX_get_chain(ctx)) != NULL)
- GRST_creds_to_conn(conn, certstack, NULL);
- }
- }
-
- return returned_ok;
-}
-
-void sitecast_handle_NOP_request(server_rec *main_server,
- GRSThtcpMessage *htcp_mesg, int igroup,
- struct sockaddr_in *client_addr_ptr)
-{
- int outbuf_len;
- char *outbuf;
-
- if (GRSThtcpNOPresponseMake(&outbuf, &outbuf_len,
- htcp_mesg->trans_id) == GRST_RET_OK)
- {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
- "SiteCast sends NOP response from port %d to %s:%d",
- sitecastgroups[0].port, inet_ntoa(client_addr_ptr->sin_addr),
- ntohs(client_addr_ptr->sin_port));
-
- sendto(sitecastgroups[0].socket, outbuf, outbuf_len, 0,
- client_addr_ptr, sizeof(struct sockaddr_in));
-
- free(outbuf);
- }
-}
-
-void sitecast_handle_TST_GET(server_rec *main_server,
- GRSThtcpMessage *htcp_mesg, int igroup,
- struct sockaddr_in *client_addr_ptr)
-{
- int i, outbuf_len, ialias, port;
- char *filename, *outbuf, *location, *local_uri = NULL;
- struct stat statbuf;
- SSLSrvConfigRec *ssl_srv;
-
- /* check sanity of requested uri */
-
- if (strncmp(htcp_mesg->uri->text, "http://", 7) == 0)
- {
- for (i=7; i < GRSThtcpCountstrLen(htcp_mesg->uri); ++i)
- if (htcp_mesg->uri->text[i] == '/')
- {
- local_uri = &(htcp_mesg->uri->text[i]);
- break;
- }
- }
- else if (strncmp(htcp_mesg->uri->text, "https://", 8) == 0)
- {
- for (i=8; i < GRSThtcpCountstrLen(htcp_mesg->uri); ++i)
- if (htcp_mesg->uri->text[i] == '/')
- {
- local_uri = &(htcp_mesg->uri->text[i]);
- break;
- }
- }
-
- if (local_uri == NULL)
- {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
- "SiteCast responder only handles http(s):// (%*s requested by %s:%d)",
- GRSThtcpCountstrLen(htcp_mesg->uri),
- htcp_mesg->uri->text,
- inet_ntoa(client_addr_ptr->sin_addr),
- ntohs(client_addr_ptr->sin_port));
- return;
- }
-
- /* find if any GridSiteCastAlias lines match */
-
- for (ialias=0; ialias < GRST_SITECAST_ALIASES ; ++ialias)
- {
- if (sitecastaliases[ialias].sitecast_url == NULL) return; /* no match */
-
- if ((strlen(sitecastaliases[ialias].sitecast_url)
- <= GRSThtcpCountstrLen(htcp_mesg->uri)) &&
- (strncmp(sitecastaliases[ialias].sitecast_url,
- htcp_mesg->uri->text,
- strlen(sitecastaliases[ialias].sitecast_url))==0)) break;
- }
-
- if (ialias == GRST_SITECAST_ALIASES)
- {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
- "SiteCast responder does not handle %*s requested by %s:%d",
- GRSThtcpCountstrLen(htcp_mesg->uri),
- htcp_mesg->uri->text,
- inet_ntoa(client_addr_ptr->sin_addr),
- ntohs(client_addr_ptr->sin_port));
-
- return; /* no match */
- }
-
- /* convert URL to filename, using alias mapping */
-
- asprintf(&filename, "%s%*s",
- sitecastaliases[ialias].local_path,
- GRSThtcpCountstrLen(htcp_mesg->uri)
- - strlen(sitecastaliases[ialias].sitecast_url),
- &(htcp_mesg->uri->text[strlen(sitecastaliases[ialias].sitecast_url)]) );
-
- if (stat(filename, &statbuf) == 0) /* found file */
- {
- ssl_srv = (SSLSrvConfigRec *)
- ap_get_module_config(sitecastaliases[ialias].server->module_config,
- &ssl_module);
-
- port = sitecastaliases[ialias].server->addrs->host_port;
- if (port == 0) port = ((ssl_srv != NULL) && (ssl_srv->enabled))
- ? GRST_HTTPS_PORT : GRST_HTTP_PORT;
-
- asprintf(&location, "Location: http%s://%s:%d%s\r\n",
- ((ssl_srv != NULL) && (ssl_srv->enabled)) ? "s" : "",
- sitecastaliases[ialias].server->server_hostname, port,
- local_uri);
-
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
- "SiteCast finds %*s at %s, redirects with %s",
- GRSThtcpCountstrLen(htcp_mesg->uri),
- htcp_mesg->uri->text, filename, location);
-
- if (GRSThtcpTSTresponseMake(&outbuf, &outbuf_len,
- htcp_mesg->trans_id,
- location, "", "") == GRST_RET_OK)
- {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
- "SiteCast sends TST response from port %d to %s:%d",
- sitecastgroups[0].port, inet_ntoa(client_addr_ptr->sin_addr),
- ntohs(client_addr_ptr->sin_port));
-
- sendto(sitecastgroups[0].socket, outbuf, outbuf_len, 0,
- client_addr_ptr, sizeof(struct sockaddr_in));
-
- free(outbuf);
- }
-
- free(location);
- }
-
- free(filename);
-}
-
-void sitecast_handle_request(server_rec *main_server,
- char *reqbuf, int reqbuf_len, int igroup,
- struct sockaddr_in *client_addr_ptr)
-{
- GRSThtcpMessage htcp_mesg;
-
- if (GRSThtcpMessageParse(&htcp_mesg,reqbuf,reqbuf_len) != GRST_RET_OK)
- {
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, main_server,
- "SiteCast responder rejects format of UDP message from %s:%d",
- inet_ntoa(client_addr_ptr->sin_addr),
- ntohs(client_addr_ptr->sin_port));
- return;
- }
-
- if (htcp_mesg.rr != 0) /* ignore HTCP responses: we just do requests */
- {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
- "SiteCast responder ignores HTCP response from %s:%d",
- inet_ntoa(client_addr_ptr->sin_addr),
- ntohs(client_addr_ptr->sin_port));
- return;
- }
-
- if (htcp_mesg.opcode == GRSThtcpNOPop)
- {
- sitecast_handle_NOP_request(main_server, &htcp_mesg,
- igroup, client_addr_ptr);
- return;
- }
-
- if (htcp_mesg.opcode == GRSThtcpTSTop)
- {
- if (((GRSThtcpCountstrLen(htcp_mesg.method) == 3) &&
- (strncmp(htcp_mesg.method->text, "GET", 3) == 0)) ||
- ((GRSThtcpCountstrLen(htcp_mesg.method) == 4) &&
- (strncmp(htcp_mesg.method->text, "HEAD", 4) == 0)))
- {
- sitecast_handle_TST_GET(main_server, &htcp_mesg,
- igroup, client_addr_ptr);
- return;
- }
-
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, main_server,
- "SiteCast responder rejects method %*s in TST message from %s:%d",
- GRSThtcpCountstrLen(htcp_mesg.method), htcp_mesg.method->text,
- inet_ntoa(client_addr_ptr->sin_addr),
- ntohs(client_addr_ptr->sin_port));
- return;
- }
-
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, main_server,
- "SiteCast does not implement HTCP op-code %d in message from %s:%d",
- htcp_mesg.opcode,
- inet_ntoa(client_addr_ptr->sin_addr),
- ntohs(client_addr_ptr->sin_port));
-}
-
-void sitecast_responder(server_rec *main_server)
-{
-#define GRST_SITECAST_MAXBUF 8192
- char reqbuf[GRST_SITECAST_MAXBUF], *p;
- int n, reqbuf_len, i, j, igroup,
- quad1, quad2, quad3, quad4, port, retval, client_addr_len;
- struct sockaddr_in srv, client_addr;
- struct ip_mreq mreq;
- fd_set readsckts;
- struct hostent *server_hostent;
-
- strcpy((char *) main_server->process->argv[0], "GridSiteCast UDP responder");
-
- /* initialise unicast/replies socket first */
-
- bzero(&srv, sizeof(srv));
- srv.sin_family = AF_INET;
- srv.sin_port = htons(sitecastgroups[0].port);
-
- if ((server_hostent = gethostbyname(main_server->server_hostname)) == NULL)
- {
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, main_server,
- "SiteCast UDP Responder fails to look up servername %s",
- main_server->server_hostname);
- return;
- }
-
- srv.sin_addr.s_addr = (u_int32_t) (server_hostent->h_addr_list[0][0]);
-
- if (((sitecastgroups[0].socket
- = socket(AF_INET, SOCK_DGRAM, 0)) < 0) ||
- (bind(sitecastgroups[0].socket,
- (struct sockaddr *) &srv, sizeof(srv)) < 0))
- {
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, main_server,
- "mod_gridsite: sitecast responder fails on unicast bind (%s)",
- strerror(errno));
- return;
- }
-
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
- "SiteCast UDP unicast/replies on %d.%d.%d.%d:%d",
- server_hostent->h_addr_list[0][0],
- server_hostent->h_addr_list[0][1],
- server_hostent->h_addr_list[0][2],
- server_hostent->h_addr_list[0][3],
- sitecastgroups[0].port);
-
- /* initialise multicast listener sockets next */
-
- for (i=1; (i <= GRST_SITECAST_GROUPS) &&
- (sitecastgroups[i].port != 0); ++i)
- {
- bzero(&srv, sizeof(srv));
- srv.sin_family = AF_INET;
- srv.sin_port = htons(sitecastgroups[i].port);
- srv.sin_addr.s_addr = htonl(sitecastgroups[i].quad1*0x1000000
- + sitecastgroups[i].quad2*0x10000
- + sitecastgroups[i].quad3*0x100
- + sitecastgroups[i].quad4);
-
- if (((sitecastgroups[i].socket
- = socket(AF_INET, SOCK_DGRAM, 0)) < 0) ||
- (bind(sitecastgroups[i].socket,
- (struct sockaddr *) &srv, sizeof(srv)) < 0))
- {
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, main_server,
- "SiteCast UDP Responder fails on multicast bind (%s)",
- strerror(errno));
- return;
- }
-
- bzero(&mreq, sizeof(mreq));
- mreq.imr_multiaddr.s_addr = srv.sin_addr.s_addr;
- mreq.imr_interface.s_addr = htonl(INADDR_ANY);
-
- if (setsockopt(sitecastgroups[i].socket, IPPROTO_IP,
- IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0)
- {
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, main_server,
- "SiteCast UDP Responder fails on setting multicast");
- return;
- }
-
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
- "SiteCast UDP Responder listening on %d.%d.%d.%d:%d",
- sitecastgroups[i].quad1, sitecastgroups[i].quad2,
- sitecastgroups[i].quad3, sitecastgroups[i].quad4, sitecastgroups[i].port);
- }
-
- while (1) /* **** main listening loop **** */
- {
- /* set up bitmasks for select */
-
- FD_ZERO(&readsckts);
-
- n = 0;
- for (i=0; (i <= GRST_SITECAST_GROUPS) &&
- (sitecastgroups[i].port != 0); ++i) /* reset bitmask */
- {
- FD_SET(sitecastgroups[i].socket, &readsckts);
- if (sitecastgroups[i].socket > n) n = sitecastgroups[i].socket;
- }
-
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
- "SiteCast UDP Responder waiting for requests");
-
- if ((retval = select(n + 1, &readsckts, NULL, NULL, NULL)) < 1)
- continue; /* < 1 on timeout or error */
-
- for (igroup=0; (igroup <= GRST_SITECAST_GROUPS) &&
- (sitecastgroups[igroup].port != 0); ++igroup)
- {
- if (FD_ISSET(sitecastgroups[igroup].socket, &readsckts))
- {
- client_addr_len = sizeof(client_addr);
-
- if ((reqbuf_len = recvfrom(sitecastgroups[igroup].socket,
- reqbuf, GRST_SITECAST_MAXBUF, 0,
- (struct sockaddr *) &client_addr, &client_addr_len)) >= 0)
- {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
- "SiteCast receives UDP message from %s:%d "
- "to %d.%d.%d.%d:%d",
- inet_ntoa(client_addr.sin_addr),
- ntohs(client_addr.sin_port),
- sitecastgroups[igroup].quad1,
- sitecastgroups[igroup].quad2,
- sitecastgroups[igroup].quad3,
- sitecastgroups[igroup].quad4,
- sitecastgroups[igroup].port);
-
- sitecast_handle_request(main_server, reqbuf,
- reqbuf_len, igroup,
- &client_addr);
- }
- }
- }
-
- } /* **** end of main listening loop **** */
-}
-
-static int mod_gridsite_server_post_config(apr_pool_t *pPool,
- apr_pool_t *pLog, apr_pool_t *pTemp, server_rec *main_server)
-{
- SSL_CTX *ctx;
- SSLSrvConfigRec *sc;
- server_rec *this_server;
- apr_proc_t *procnew = NULL;
- apr_status_t status;
- const char *userdata_key = "sitecast_init";
-
- apr_pool_userdata_get((void **) &procnew, userdata_key,
- main_server->process->pool);
-
- /* we only fork responder if one not already forked and we have at
- least one GridSiteCastAlias defined. This means it is possible
- to run a responder with no groups - listening on unicast only! */
-
- if ((procnew == NULL) &&
- (sitecastaliases[0].sitecast_url != NULL))
- {
- /* UDP multicast responder required but not yet started */
-
- procnew = apr_pcalloc(main_server->process->pool, sizeof(*procnew));
- apr_pool_userdata_set((const void *) procnew, userdata_key,
- apr_pool_cleanup_null, main_server->process->pool);
-
- status = apr_proc_fork(procnew, pPool);
-
- if (status < 0)
- {
- ap_log_error(APLOG_MARK, APLOG_CRIT, status, main_server,
- "mod_gridsite: Failed to spawn SiteCast responder process");
- return HTTP_INTERNAL_SERVER_ERROR;
- }
- else if (status == APR_INCHILD)
- {
- ap_log_error(APLOG_MARK, APLOG_NOTICE, status, main_server,
- "mod_gridsite: Spawning SiteCast responder process");
- sitecast_responder(main_server);
- exit(-1);
- }
-
- apr_pool_note_subprocess(main_server->process->pool,
- procnew, APR_KILL_AFTER_TIMEOUT);
- }
-
- /* continue with normal HTTP/HTTPS servers */
-
- ap_add_version_component(pPool,
- apr_psprintf(pPool, "mod_gridsite/%s", VERSION));
-
- for (this_server = main_server;
- this_server != NULL;
- this_server = this_server->next)
- {
- /* we do some GridSite OpenSSL magic for HTTPS servers */
-
- sc = ap_get_module_config(this_server->module_config, &ssl_module);
-
- if ((sc != NULL) &&
- (sc->enabled) &&
- (sc->server != NULL) &&
- (sc->server->ssl_ctx != NULL))
- {
- ctx = sc->server->ssl_ctx;
-
- /* in 0.9.7 we could set the issuer-checking callback directly */
-// ctx->cert_store->check_issued = GRST_X509_check_issued_wrapper;
-
- /* but in case 0.9.6 we do it indirectly with another wrapper */
- SSL_CTX_set_cert_verify_callback(ctx,
- GRST_verify_cert_wrapper,
- (void *) NULL);
-
- /* whatever version, we can set the SSLVerify wrapper properly */
- SSL_CTX_set_verify(ctx, ctx->verify_mode,
- GRST_callback_SSLVerify_wrapper);
-
- if (main_server->loglevel >= APLOG_DEBUG)
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, main_server,
- "Set mod_ssl verify callbacks to GridSite wrappers");
- }
- }
-
- return OK;
-}
-
-static void mod_gridsite_child_init(apr_pool_t *pPool, server_rec *pServer)
-{
- GRSTgaclInit();
-}
-
-static int mod_gridsite_handler(request_rec *r)
-{
- mod_gridsite_dir_cfg *conf;
-
- conf = (mod_gridsite_dir_cfg *)
- ap_get_module_config(r->per_dir_config, &gridsite_module);
-
- if ((conf->dnlistsuri != NULL) &&
- (strncmp(r->uri, conf->dnlistsuri, strlen(conf->dnlistsuri)) == 0))
- {
- if (strcmp(r->uri, conf->dnlistsuri) == 0)
- return mod_gridsite_dnlistsuri_dir_handler(r, conf);
-
- return mod_gridsite_dnlistsuri_handler(r, conf);
- }
-
- if (strcmp(r->handler, DIR_MAGIC_TYPE) == 0)
- return mod_gridsite_dir_handler(r, conf);
-
- return mod_gridsite_nondir_handler(r, conf);
-}
-
-static ap_unix_identity_t *mod_gridsite_get_suexec_id_doer(const request_rec *r)
-{
- mod_gridsite_dir_cfg *conf;
-
- conf = (mod_gridsite_dir_cfg *)
- ap_get_module_config(r->per_dir_config, &gridsite_module);
-
- if ((conf->execugid.uid != UNSET) &&
- (conf->execmethod != NULL))
- {
-
- /* also push GRST_EXEC_DIRECTORY into request environment here too */
-
- return &(conf->execugid);
- }
-
- return NULL;
-}
-
-static void register_hooks(apr_pool_t *p)
-{
- /* set up the Soap2cgi input and output filters */
-
- ap_hook_insert_filter(mod_gridsite_soap2cgi_insert, NULL, NULL,
- APR_HOOK_MIDDLE);
-
- ap_register_output_filter(Soap2cgiFilterName, mod_gridsite_soap2cgi_out,
- NULL, AP_FTYPE_RESOURCE);
-
-// ap_register_input_filter(Soap2cgiFilterName, mod_gridsite_soap2cgi_in,
-// NULL, AP_FTYPE_RESOURCE);
-
- /* config and handler stuff */
-
- ap_hook_post_config(mod_gridsite_server_post_config, NULL, NULL,
- APR_HOOK_LAST);
- ap_hook_child_init(mod_gridsite_child_init, NULL, NULL, APR_HOOK_MIDDLE);
-
- ap_hook_fixups(mod_gridsite_first_fixups,NULL,NULL,APR_HOOK_FIRST);
-
- ap_hook_fixups(mod_gridsite_perm_handler,NULL,NULL,APR_HOOK_REALLY_LAST);
-
- ap_hook_handler(mod_gridsite_handler, NULL, NULL, APR_HOOK_FIRST);
-
- ap_hook_get_suexec_identity(mod_gridsite_get_suexec_id_doer,
- NULL, NULL, APR_HOOK_MIDDLE);
-}
-
-module AP_MODULE_DECLARE_DATA gridsite_module =
-{
- STANDARD20_MODULE_STUFF,
- create_gridsite_dir_config, /* dir config creater */
- merge_gridsite_dir_config, /* dir merger */
- create_gridsite_srv_config, /* create server config */
- NULL, /* merge server config */
- mod_gridsite_cmds, /* command apr_table_t */
- register_hooks /* register hooks */
-};
+++ /dev/null
-/*
- Copyright (c) 2003-4, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
-
- Portions of this code are derived from Apache mod_ssl, and are covered
- by the Apache Software License:
-
- * Copyright 2001-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*------------------------------------------------------------------*
- * This program is part of GridSite: http://www.gridsite.org/ *
- *------------------------------------------------------------------*/
-
-
-/*
- * After 2.0.49, Apache mod_ssl has most of the mod_ssl structures defined
- * in ssl_private.h, which is not installed along with httpd-devel (eg in
- * the FC2 RPM.) This include file provides SIMPLIFIED structures for use
- * by mod_gridsite: for example, pointers to unused structures are replaced
- * by void * and some of the structures are truncated when only the early
- * members are used.
- *
- * CLEARLY, THIS WILL BREAK IF THERE ARE MAJOR CHANGES TO ssl_private.h!!!
- */
-
-#include <openssl/ssl.h>
-
-typedef enum {
- SSL_SHUTDOWN_TYPE_UNSET,
- SSL_SHUTDOWN_TYPE_STANDARD,
- SSL_SHUTDOWN_TYPE_UNCLEAN,
- SSL_SHUTDOWN_TYPE_ACCURATE
-} ssl_shutdown_type_e;
-
-typedef struct {
- SSL *ssl;
- const char *client_dn;
- X509 *client_cert;
- ssl_shutdown_type_e shutdown_type;
- const char *verify_info;
- const char *verify_error;
- int verify_depth;
- int is_proxy;
- int disabled;
- int non_ssl_request;
-} SSLConnRec;
-
-typedef struct {
- void *sc; /* pointer back to server config */
- SSL_CTX *ssl_ctx;
-} modssl_ctx_t;
-
-typedef struct {
- void *mc;
- unsigned int enabled;
- unsigned int proxy_enabled;
- const char *vhost_id;
- int vhost_id_len;
- int session_cache_timeout;
- modssl_ctx_t *server;
- modssl_ctx_t *proxy;
-} SSLSrvConfigRec;
-
-extern module AP_MODULE_DECLARE_DATA ssl_module;
+++ /dev/null
-/*
- Copyright (c) 2002-4, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
- Change the hard-coded defaults below to your set up.
-*/
-
-#define LOCALPROXY "/tmp/x509up"
-#define DELEGATIONURL "https://testing.hep.man.ac.uk/gridsite-delegation.cgi"
-#define CAPATH "/etc/grid-security/certificates"
-#define DELEGATIONID "1234567890"
-#define EXPIREMINUTES 60
-
-#ifndef VERSION
-#define VERSION "0.0.0"
-#endif
-
-#define _GNU_SOURCE
-
-#include <stdio.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <openssl/x509.h>
-#include <openssl/x509v3.h>
-#include <openssl/err.h>
-#include <openssl/pem.h>
-
-#include "gridsite.h"
-
-#include "soapH.h"
-#include "delegation.nsmap"
-
-int main(int argc, char *argv[])
-{
- char *reqtxt, *certtxt;
- struct ns__putProxyResponse *unused;
- struct soap soap_get, soap_put;
-
- ERR_load_crypto_strings ();
- OpenSSL_add_all_algorithms();
-
- soap_init(&soap_get);
-
- if (soap_ssl_client_context(&soap_get,
- SOAP_SSL_DEFAULT,
- LOCALPROXY,
- "",
- NULL,
- CAPATH,
- NULL))
- {
- soap_print_fault(&soap_get, stderr);
- return 1;
- }
-
- soap_call_ns__getProxyReq(&soap_get,
- DELEGATIONURL, /* HTTPS url of service */
- "", /* no password on proxy */
- DELEGATIONID,
- &reqtxt);
-
- if (soap_get.error)
- {
- soap_print_fault(&soap_get, stderr);
- return 1;
- }
-
- if (GRSTx509MakeProxyCert(&certtxt, stderr, reqtxt,
- LOCALPROXY, LOCALPROXY, EXPIREMINUTES)
- != GRST_RET_OK)
- {
- return 1;
- }
-
- soap_init(&soap_put);
-
- if (soap_ssl_client_context(&soap_put,
- SOAP_SSL_DEFAULT,
- LOCALPROXY,
- "",
- NULL,
- CAPATH,
- NULL))
- {
- soap_print_fault(&soap_put, stderr);
- return 1;
- }
-
- soap_call_ns__putProxy(&soap_put, DELEGATIONURL, "", DELEGATIONID,
- certtxt, unused);
- if (soap_put.error)
- {
- soap_print_fault(&soap_put, stderr);
- return 1;
- }
-
- return 0;
-}
-
+++ /dev/null
-#!/usr/bin/env perl
-#
-# roffit: convert man page source files to HTML
-#
-# Read an nroff file. Output a HTML file.
-#
-# This is a very simple script, but I use it on very simple man pages and I've
-# found no other script that makes beautiful web pages.
-#
-my $version = "0.3"; # (14 November 2003)
-# Author: Daniel Stenberg <daniel@haxx.se>
-# Please email me improvements.
-#
-# You're free to do whatever you want with this script.
-#
-# Changes:
-#
-# 0.3 - Daniel Fandrich brought:
-# o deal with .lp lines
-# o .TH needs no section portion anymore
-# o added generator meta tag in the header
-#
-# 0.2 - fixed the <a name> name for the SH section
-# - added <a href> links from all words within \fIthis\fP or \fBthis\fP
-# that has the same text as a .SH or .IP.
-#
-
-use strict;
-#use warnings;
-
-my $InFH = \*STDIN;
-my $OutFH = \*STDOUT;
-my $debugFH = \*STDERR;
-
-my %manpage;
-my @out;
-
-my $indentlevel=0; # logical levels, not columns
-my @p;
-my $within_tp;
-my $standalone=1; # by default we make stand-alone HTML pages
-my $pre;
-my %anchor; # hash with all anchors
-
-while($ARGV[0]) {
- if($ARGV[0] eq "--bare") {
- # don't include headers and stuff
- $standalone=0;
- shift @ARGV;
- }
- else {
- printf $debugFH "unknown option: %s\n", $ARGV[0] if($ARGV[0] ne "-h");
- print $debugFH "Usage: roffit [options] < infile > outfile\n",
- "Options:\n",
- " --bare Do not put in HTML, HEAD, BODY tags\n";
- exit;
- }
-}
-
-sub showp {
- my @p = @_;
- push @out, "\n<p class=\"level$indentlevel\">", @p;
-}
-
-sub defaultcss {
- print $OutFH <<ENDOFCSS
-<STYLE type="text/css">
-P.level0 {
- padding-left: 2em;
-}
-
-P.level1 {
- padding-left: 4em;
-}
-
-P.level2 {
- padding-left: 6em;
-}
-
-span.emphasis {
- font-style: italic;
-}
-
-span.bold {
- font-weight: bold;
-}
-
-span.manpage {
- font-weight: bold;
-}
-
-h2.nroffsh {
- background-color: #e0e0e0;
-}
-
-span.nroffip {
- font-weight: bold;
- font-size: 120%;
- font-family: monospace;
-}
-
-p.roffit {
- text-align: center;
- font-size: 80%;
-}
-</STYLE>
-ENDOFCSS
- ;
-}
-
-sub text2name {
- my ($text) = @_;
- $text =~ s/^ *([^ ]*).*/$1/g;
- $text =~ s/[^a-zA-Z0-9-]//g;
- return $text;
-}
-
-# scan through the file and check for <span> sections we should convert
-# to proper links
-sub linkfile {
- my @new;
- for(@out) {
- my $line=$_;
- my $l;
- while($line =~ s/<span class=\"(emphasis|bold)\">([^<]*)<\/span>/[]/) {
- my ($style, $name)=($1, $2);
-
- $l = text2name($name);
-
- #printf $debugFH "$style - $name - %s - %d\n",
- #$l, $anchor{$l};
-
- my $link;
- if($anchor{$l}) {
- $link="<a class=\"$style\" href=\"#$l\">$name</a>";
- }
- else {
- $link="<span Class=\"$style\">$name</span>";
- }
- $line =~ s/\[\]/$link/;
- }
- push @new, $line;
- }
- return @new;
-}
-
-sub parsefile {
-
- while(<$InFH>) {
- my $in = $_;
- my $out;
- # print $debugFH "DEBUG IN: $_";
-
- $in =~ s/[\r\n]//g if(!$pre); # tear off newlines
-
- if($in =~ /^\.([^ \n]*)(.*)/) {
- # this is a line starting with a dot, that means it is special
- my ($keyword, $rest) = ($1, $2);
- $out = "";
-
- # cut off initial spaces
- $rest =~ s/^ +//g;
-
- if($keyword eq "\\\"") {
- # this is a comment, skip this line
- }
- elsif($keyword =~ /^TH$/i) {
- # man page header:
- # curl 1 "22 Oct 2003" "Curl 7.10.8" "Curl Manual"
- # NAME SECTION DATE VERSION MANUAL
- if($rest =~ /([^ ]*) (\d+) \"([^\"]*)\" \"([^\"]*)\"(\"([^\"]*)\")?/) {
- # strict matching only so far
- $manpage{'name'} = $1;
- $manpage{'section'} = $2;
- $manpage{'date'} = $3;
- $manpage{'version'} = $4;
- $manpage{'manual'} = $6;
- }
- }
- elsif($keyword =~ /^SH$/i) {
- # Section Header
- showp(@p);
- @p="";
- if($pre) {
- push @out, "</pre>\n";
- $pre = 0;
- }
-
- my $name = text2name($rest);
- $anchor{$name}=1;
-
- $rest =~ s/\"//g; # cut off quotes
- $rest =~ s/</</g;
- $rest =~ s/>/>/g;
- $out = "<a name=\"$name\"></a><h2 class=\"nroffsh\">$rest</h2>";
- $indentlevel=0;
- $within_tp=0;
- }
- elsif(($keyword =~ /^B$/i) || ($keyword =~ /^BI$/i)) {
- # Make B and BI the same for simplicity
- $rest =~ s/\"//g; # cut off quotes
- $rest =~ s/</</g;
- $rest =~ s/>/>/g;
- push @p, "<span class=\"bold\">$rest</span> ";
- }
- elsif($keyword =~ /^I$/i) {
- $rest =~ s/\"//g; # cut off quotes
- $rest =~ s/</</g;
- $rest =~ s/>/>/g;
- push @p, "<span class=\"emphasis\">$rest</span> ";
- }
- elsif($keyword =~ /^RS$/i) {
- # the start of another indent-level. for inlined tables
- # within an "IP"
- showp(@p);
- @p="";
- $indentlevel++;
- }
- elsif($keyword =~ /^RE$/i) {
- # end of the RS section
- showp(@p);
- @p="";
- $indentlevel--;
- }
- elsif($keyword =~ /^NF$/i) {
- # We let nf start a <pre> section
- showp(@p);
- @p="";
- push @out, "<pre>\n";
- $pre=1
- }
- elsif($keyword =~ /^TP$/i) {
- # Used within an "RS" section to make a new line. The first
- # TP as a column indicator, but we decide to do that
- # controlling in the CSS instead.
- $within_tp=1;
- showp(@p);
- @p="";
- }
- elsif($keyword =~ /^IP$/i) {
- # start of a new paragraph coming up
- showp(@p);
- @p="";
-
- my $name= text2name($rest);
- $anchor{$name}=1;
-
- $rest =~ s/\"//g; # cut off quotes
- $rest =~ s/</</g;
- $rest =~ s/>/>/g;
-
- $indentlevel-- if ($indentlevel);
- push @p, "<a name=\"$name\"></a><span class=\"nroffip\">$rest</span> ";
- # make this a single-line title
- showp(@p);
- @p="";
- $indentlevel++;
- $within_tp=0;
- }
- elsif($keyword =~ /^ad$/i) {
- showp(@p);
- @p="";
- }
- elsif($keyword =~ /^sp$/i) {
- showp(@p);
- @p="";
- }
- elsif($keyword =~ /^lp$/i) {
- # marks end of a paragraph
- showp(@p);
- @p="";
- }
- elsif($keyword =~ /^pp$/i) {
- # PP ends a TP section, but some TP sections don't use it
- $within_tp=0;
- }
- elsif($keyword =~ /^so$/i) {
- # This keyword refers to a different man page, named in the
- # $rest.
- # We don't support this
- push @out, "See the $rest man page.\n";
- }
- elsif($keyword =~ /^BR$/i) {
- # I'm not sure what this does exactly, but this is commonly
- # used to include pointers to other man pages. Let's assume
- # it only does that for now.
- # blabla (3)
- # or "blabla (3)"
- # or strcmp "(3), " strcasecmp "(3)"
- # etc
-
- $rest =~ s/\"//g; # cut off quotes
- my @all = split /,/, $rest;
- for(@all) {
- if(/([^ ]*) *\((\d+)\)/) {
- # TODO: this looks like a man page, check if there's a
- # HTML file for it and if so make a link to it
- }
-
- push @p, "<span class=\"manpage\">$_</span> ";
- }
- }
- else {
- showp(@p);
- print $debugFH "ALERT: unknown keyword \"$keyword\"\n";
- }
- }
- else {
- # text line, decode \-stuff
- my $txt = $in;
-
- $txt =~ s/</</g;
- $txt =~ s/>/>/g;
- $txt =~ s/\\&//g; # cut off \&
- $txt =~ s/\\fI/<span class=\"emphasis\">/g;
- $txt =~ s/\\fB/<span class=\"bold\">/g;
- $txt =~ s/\\fP/<\/span>/g;
- $txt =~ s/\\//g;
-
- if($txt =~ /^[ \t\r\n]*$/) {
- # no contents, marks end of a paragraph
- showp(@p);
- @p="";
- }
- else {
- $txt =~ s/^ /\ \;/g;
- push @p, "$txt ";
- }
- $out ="";
- }
-
- if($out) {
- push @out, $out;
- # print $debugFH "DEBUG OUT: $out\n";
- }
- else {
- # print $debugFH "DEBUG OUT: [withheld]\n";
- }
- }
- showp(@p);
-}
-
-parsefile();
-
-my @conv = linkfile();
-
-my $title=sprintf("%s man page",
- $manpage{'name'}?$manpage{'name'}:"secret");
-
-if($standalone) {
- print $OutFH <<MOO
-<html><head>
-<title>$title</title>
-<meta name="generator" content="roffit $version">
-MOO
- ;
- defaultcss();
- print "</head><body>\n";
-}
-
-print $OutFH @conv;
-print $OutFH <<ROFFIT
-<p class="roffit">
- This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>.
-ROFFIT
- ;
-
-if($standalone) {
- print "</body></html>\n";
-}
+++ /dev/null
-
-#include <stdio.h>
-#include <openssl/x509.h>
-#include <openssl/x509_vfy.h>
-#include <openssl/err.h>
-#include <openssl/pem.h>
-
-#include <openssl/buffer.h>
-#include <openssl/objects.h>
-#include <openssl/asn1.h>
-#include <openssl/evp.h>
-#include <openssl/bio.h>
-
-#include "gridsite.h"
-
-#define MAXTAG 500
-
-main()
-{
- X509 *cert, *tmpcert;
- STACK_OF(X509) *certstack = sk_X509_new_null();
- FILE *fp;
- struct vomsdata *vd;
- int i, j, vomserror, i1, i2, j1, j2, lastobject;
- X509_EXTENSION *ex;
- ASN1_OBJECT *asnobject;
- char s[80], *t;
- ASN1_OCTET_STRING *asndata;
- BIO *out;
- unsigned char *p, *op, *tot, *p1, *p2, *q, *oq;
- long len1, length1, len2, length2;
- int tag,xclass,ret=0;
- struct GRSTasn1TagList taglist[MAXTAG+1];
- int lasttag=-1, itag;
-
-
- OpenSSL_add_all_algorithms();
- ERR_load_crypto_strings();
-// seed_prng();
-
-// fp = fopen("proxy-with-voms", "r");
- fp = fopen("/tmp/x509up_u300", "r");
-
- cert = PEM_read_X509(fp, NULL, NULL, NULL);
-
- fclose(fp);
-
- out=BIO_new(BIO_s_file());
- BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
-
- for (i = 0; i < X509_get_ext_count(cert); ++i)
- {
- lasttag=-1;
-
- ex = X509_get_ext(cert, i);
-
- OBJ_obj2txt(s, sizeof(s), X509_EXTENSION_get_object(ex), 1);
- printf("%d OID=%s\n", i, s);
-
- asnobject = X509_EXTENSION_get_object(ex);
- asndata = X509_EXTENSION_get_data(ex);
-
- p1 = ASN1_STRING_data(asndata);
- p = p1;
- length1 = ASN1_STRING_length(asndata);
-
- GRSTasn1ParseDump(out, p1, length1, taglist, MAXTAG, &lasttag);
-
-{
- int n, tag, xclass;
- unsigned char *q, buf[100];
- const unsigned char *dn, hash[EVP_MAX_MD_SIZE];
- ASN1_OBJECT *obj = NULL;
- const EVP_MD *m;
- EVP_MD_CTX ctx;
- char creds[501][101];
- int lastcred = -1;
-
- itag = GRSTasn1SearchTaglist(taglist, lasttag,
- "-1-1-1-1-2-1-1-1-1-1-1-1");
-
- X509_NAME *xname;
-
- q = &p[taglist[itag].start];
-
- d2i_ASN1_OBJECT(&obj, &q, taglist[itag].length +
- taglist[itag].headerlength);
-
- n = OBJ_obj2nid(obj);
- dn = OBJ_nid2sn(n);
-
-// dn = X509_NAME_oneline(xname,NULL,0);
-
- printf("n=%d dn=%s obj2txt=%s\n", n, dn, OBJ_obj2txt(NULL,0,obj,1));
-
- GRSTasn1GetX509Name(buf, 99, "-1-1-1-1-2-1-1-1-1-%d-1-%d",
- p1, taglist, lasttag);
- printf("%s\n", buf);
- GRSTasn1GetX509Name(buf, 99, "-1-1-1-1-3-1-1-1-%d-1-%d",
- p1, taglist, lasttag);
- printf("%s\n", buf);
-
- lastcred = -1;
- ret = GRSTx509ParseVomsExt(&lastcred, 500, 100, creds, 0, 2000040861,
- ex,
- "/C=UK/O=eScience/OU=Manchester/L=HEP/CN=Andrew McNab",
- "/etc/grid-security/vomsdir");
-
-
- printf("GRSTx509ParseVomsExt() returns %d, %d\n", ret, lastcred);
-
- for (j=0; j <= lastcred; ++j)
- printf("cred=%d %s\n", j, creds[j]);
-
-/*
- m = EVP_md5();
- EVP_DigestInit(&ctx, m);
- EVP_DigestUpdate(&ctx, delegation_id, strlen(delegation_id));
- EVP_DigestFinal(&ctx, hash, &delegation_id_len);
- */
-}
-
-/*
- itag = GRSTasn1SearchTaglist(taglist, &lasttag,
- "1-1-1-1-1-7-1-2-1-2-1");
-
- printf("tag=%d %s %d %.*s\n",
- itag, taglist[itag].treecoords, taglist[itag].tag,
- taglist[itag].length,
- &p[taglist[itag].start+taglist[itag].headerlength]);
-*/
- }
-}
+++ /dev/null
-/*
- Copyright (c) 2002-3, Andrew McNab, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*---------------------------------------------------------------*
- * For more about GridSite: http://www.gridsite.org/ *
- *---------------------------------------------------------------*/
-
-#include <stdio.h>
-#include <string.h>
-
-#include "gridsite.h"
-
-int main(int argn, char *argv[])
-{
- int i;
-
- if (argn == 1)
- {
- puts("urlencode [-m|-d] string-to-encode-or-decode");
- return 0;
- }
-
- if (strcmp(argv[1], "-d") == 0) /* decode */
- for (i = 2; i < argn; ++i)
- {
- if (i > 2) fputs(" ", stdout);
- fputs(GRSThttpUrlDecode(argv[i]), stdout);
- }
- else if (strcmp(argv[1], "-m") == 0) /* mild encode */
- for (i = 2; i < argn; ++i)
- {
- if (i > 2) fputs("%20", stdout);
- fputs(GRSThttpUrlMildencode(argv[i]), stdout);
- }
- else /* standard encode */
- for (i = 1; i < argn; ++i)
- {
- if (i > 1) fputs("%20", stdout);
- fputs(GRSThttpUrlEncode(argv[i]), stdout);
- }
-
- puts("");
-
- return 0;
-}
+++ /dev/null
-/*
- Copyright (c) 2005, Andrew McNab and Shiv Kaushal, University of Manchester
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- o Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
- o Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*---------------------------------------------------------------*
- * For more about GridSite: http://www.gridsite.org/ *
- *---------------------------------------------------------------*/
-
-/*
- Example program using XACML
-
- Build with:
-
- gcc -o xacmlexample xacmlexample.c -L. -I. -lgridsite -lxml2 -lz -lm
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <gridsite.h>
-
-int main()
-{
- GRSTgaclCred *cred, *usercred;
- GRSTgaclEntry *entry;
- GRSTgaclAcl *acl1, *acl2;
- GRSTgaclUser *user;
- GRSTgaclPerm perm0, perm1, perm2;
- FILE *fp;
-
- /* must initialise GACL before using XACML functions */
-
- GRSTgaclInit();
-
- /* build up an ACL, starting with a credential */
-
- cred = GRSTgaclCredNew("person");
-
- GRSTgaclCredAddValue(cred, "dn", "/O=Grid/CN=Mr Grid Person");
-
- /* create an entry to put it in */
-
- entry = GRSTgaclEntryNew();
-
- /* add the credential to it */
-
- GRSTgaclEntryAddCred(entry, cred);
-
- /* add another credential */
-
- cred = GRSTgaclCredNew("dn-list");
- GRSTgaclCredAddValue(cred, "url", "example-dn-list");
- GRSTgaclEntryAddCred(entry, cred);
-
- fp = fopen("example-dn-list", "w");
- fputs("/O=Grid/CN=Mr Grid Person\n", fp);
- fclose(fp);
-
- /* associate some permissions and denials to the credential */
-
- GRSTgaclEntryAllowPerm( entry, GRST_PERM_READ);
- GRSTgaclEntryAllowPerm( entry, GRST_PERM_WRITE);
- GRSTgaclEntryAllowPerm( entry, GRST_PERM_ADMIN);
- GRSTgaclEntryDenyPerm( entry, GRST_PERM_ADMIN);
- GRSTgaclEntryDenyPerm( entry, GRST_PERM_LIST);
-
- perm0 = GRST_PERM_READ | GRST_PERM_WRITE;
-
- printf("test perm should be %d\n", perm0);
-
- /* create a new ACL and add the entry to it */
-
- acl1 = GRSTgaclAclNew();
-
- GRSTgaclAclAddEntry(acl1, entry);
-
- /* create a GRSTgaclUser to compare with the ACL */
-
- usercred = GRSTgaclCredNew("person");
-
- GRSTgaclCredAddValue(usercred, "dn", "/O=Grid/CN=Mr Grid Person");
-
- user = GRSTgaclUserNew(usercred);
-
- GRSTgaclUserSetDNlists(user, getcwd(NULL, 0));
- printf("DN Lists dir %s\n", getcwd(NULL, 0));
-
-// putenv("GRST_DN_LISTS=.");
-
- perm1 = GRSTgaclAclTestUser(acl1, user);
-
- printf("test /O=Grid/CN=Mr Grid Person in acl = %d\n", perm1);
-
- /* print and save the whole ACL */
-
- GRSTgaclAclPrint(acl1, stdout);
-
- GRSTxacmlAclSave(acl1, "example.xacml");
-
- puts("gridacl.out saved");
-
- puts("");
-
- /* load the ACL back off the disk, print and test it */
-
- acl2 = GRSTxacmlAclLoadFile("example.xacml");
-
- puts("gridacl.out loaded");
-
- if (acl2 != NULL) GRSTgaclAclPrint(acl2, stdout); else puts("acl2 is NULL");
-
- perm2 = GRSTgaclAclTestUser(acl2, user);
-
- printf("test /O=Grid/CN=Mr Grid Person in acl = %d\n", perm2);
-
- if (perm1 != perm0) return 1;
- if (perm2 != perm0) return 2;
-
- return 0;
-}
-