From 2e37cbd64f385e949501e2948de8e49236cc9fc0 Mon Sep 17 00:00:00 2001 From: Andrew McNab Date: Thu, 8 Dec 2005 15:07:59 +0000 Subject: [PATCH] Commit ONETIME to PASSCODE changes --- org.gridsite.core/CHANGES | 5 +++ org.gridsite.core/project/version.properties | 2 +- org.gridsite.core/src/gridsite.spec | 2 +- org.gridsite.core/src/htcp.c | 24 ++++++------- org.gridsite.core/src/mod_gridsite.c | 52 ++++++++++++++-------------- 5 files changed, 45 insertions(+), 40 deletions(-) diff --git a/org.gridsite.core/CHANGES b/org.gridsite.core/CHANGES index 899bd0a..dc4e1dd 100644 --- a/org.gridsite.core/CHANGES +++ b/org.gridsite.core/CHANGES @@ -1,3 +1,8 @@ +* Mon Dec 5 2005 Andrew McNab +- Change GRIDHTTP_ONETIME to GRIDHTTP_PASSCODE +- Remove onetime=yes default from mod_gridsite +* Wed Nov 16 2005 Andrew McNab +- ==== GridSite version 1.1.16 ==== * Wed Nov 16 2005 Andrew McNab - Add -fPIC option to Makefile for IA64, as suggested by Andreas Unterkircher. diff --git a/org.gridsite.core/project/version.properties b/org.gridsite.core/project/version.properties index 1e8030c..3c07ef0 100644 --- a/org.gridsite.core/project/version.properties +++ b/org.gridsite.core/project/version.properties @@ -1,2 +1,2 @@ -module.version=1.1.15 +module.version=1.1.16 module.age=1 diff --git a/org.gridsite.core/src/gridsite.spec b/org.gridsite.core/src/gridsite.spec index 0819eb0..7780f22 100644 --- a/org.gridsite.core/src/gridsite.spec +++ b/org.gridsite.core/src/gridsite.spec @@ -2,7 +2,7 @@ Name: gridsite Version: %(echo ${MYVERSION:-1.1.x}) Release: 1 Summary: GridSite -Copyright: Modified BSD +License: Modified BSD Group: System Environment/Daemons Source: %{name}-%{version}.src.tar.gz Prefix: %(echo ${MYPREFIX:-/usr}) diff --git a/org.gridsite.core/src/htcp.c b/org.gridsite.core/src/htcp.c index 2181b79..3fd4b11 100644 --- a/org.gridsite.core/src/htcp.c +++ b/org.gridsite.core/src/htcp.c @@ -119,7 +119,7 @@ struct grst_dir_list { char *filename; struct grst_header_data { int retcode; char *location; - char *gridhttponetime; + char *gridhttppasscode; size_t length; int length_set; time_t modified; @@ -159,15 +159,15 @@ size_t headers_callback(void *ptr, size_t size, size_t nmemb, void *p) 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) + else if (strncmp(s, "Set-Cookie: GRIDHTTP_PASSCODE=", 29) == 0) { - header_data->gridhttponetime = strdup(&s[12]); - q = index(header_data->gridhttponetime, ';'); + header_data->gridhttppasscode = strdup(&s[12]); + q = index(header_data->gridhttppasscode, ';'); if (q != NULL) *q = '\0'; if (header_data->common_data->verbose > 0) fprintf(stderr, "Received GridHTTP Auth Cookie: %s\n", - header_data->gridhttponetime); + header_data->gridhttppasscode); } else if (strncmp(s, "Last-Modified: ", 15) == 0) { @@ -314,7 +314,7 @@ int do_rmtcp(char *sources[], char *destination, header_data.retcode = 0; header_data.location = NULL; - header_data.gridhttponetime = NULL; + header_data.gridhttppasscode = NULL; header_data.common_data = common_data; thiserror = curl_easy_perform(easyhandle); @@ -342,7 +342,7 @@ int do_rmtcp(char *sources[], char *destination, asprintf(&p, "COPY %s", sources[isrc]); curl_easy_setopt(easyhandle, CURLOPT_CUSTOMREQUEST, p);//"COPY");//gh_header_slist); curl_easy_setopt(easyhandle, CURLOPT_URL, remoteserver); - curl_easy_setopt(easyhandle, CURLOPT_COOKIE, header_data.gridhttponetime); + curl_easy_setopt(easyhandle, CURLOPT_COOKIE, header_data.gridhttppasscode); curl_easy_setopt(easyhandle, CURLOPT_USERAGENT, common_data->useragent); curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, nogh_header_slist); @@ -471,7 +471,7 @@ int do_copies(char *sources[], char *destination, header_data.retcode = 0; header_data.location = NULL; - header_data.gridhttponetime = NULL; + header_data.gridhttppasscode = NULL; header_data.common_data = common_data; thiserror = curl_easy_perform(easyhandle); @@ -482,7 +482,7 @@ int do_copies(char *sources[], char *destination, (header_data.retcode == 302) && (header_data.location != NULL) && (strncmp(header_data.location, "http://", 7) == 0) && - (header_data.gridhttponetime != NULL)) + (header_data.gridhttppasscode != NULL)) { if (common_data->verbose > 0) fprintf(stderr, "... Found (%d)\nGridHTTP redirect to %s\n", @@ -519,7 +519,7 @@ int do_copies(char *sources[], char *destination, 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); + header_data.gridhttppasscode); thiserror = curl_easy_perform(easyhandle); fclose(common_data->fp); @@ -1393,7 +1393,7 @@ int do_listings(char *sources[], struct grst_stream_data *common_data, curl_easy_setopt(easyhandle, CURLOPT_NOBODY, 1); } - header_data.gridhttponetime = NULL; + header_data.gridhttppasscode = NULL; header_data.length_set = 0; header_data.modified_set = 0; header_data.retcode = 0; @@ -1442,7 +1442,7 @@ int do_listings(char *sources[], struct grst_stream_data *common_data, asprintf(&s, "%s%s", sources[isrc], list[i].filename); curl_easy_setopt(easyhandle, CURLOPT_URL, s); - header_data.gridhttponetime = NULL; + header_data.gridhttppasscode = NULL; header_data.length_set = 0; header_data.modified_set = 0; header_data.retcode = 0; diff --git a/org.gridsite.core/src/mod_gridsite.c b/org.gridsite.core/src/mod_gridsite.c index 2d0a47b..485e279 100644 --- a/org.gridsite.core/src/mod_gridsite.c +++ b/org.gridsite.core/src/mod_gridsite.c @@ -98,7 +98,7 @@ struct sitecast_alias These are assigned default values in create_gridsite_srv_config() */ int gridhttpport = 0; -char *onetimesdir = NULL; +char *passcodesdir = NULL; char *sitecastdnlists = NULL; struct sitecast_group sitecastgroups[GRST_SITECAST_GROUPS+1]; struct sitecast_alias sitecastaliases[GRST_SITECAST_ALIASES]; @@ -907,11 +907,11 @@ int http_gridhttp(request_rec *r, mod_gridsite_dir_cfg *conf) != APR_SUCCESS) return HTTP_INTERNAL_SERVER_ERROR; ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "Generated GridHTTP onetime passcode %016llx", gridauthcookie); + "Generated GridHTTP passcode %016llx", gridauthcookie); filetemplate = apr_psprintf(r->pool, "%s/%016llxXXXXXX", ap_server_root_relative(r->pool, - onetimesdir), + passcodesdir), gridauthcookie); if (apr_file_mktemp(&fp, @@ -923,11 +923,11 @@ int http_gridhttp(request_rec *r, mod_gridsite_dir_cfg *conf) 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! */ + expires_time = apr_time_now() + apr_time_from_sec(3600); + /* passcode cookies are valid for only 60 mins! */ apr_file_printf(fp, - "expires=%lu\ndomain=%s\npath=%s\nonetime=yes\nmethod=%s\n", + "expires=%lu\ndomain=%s\npath=%s\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! */ @@ -960,7 +960,7 @@ int http_gridhttp(request_rec *r, mod_gridsite_dir_cfg *conf) apr_table_add(r->headers_out, apr_pstrdup(r->pool, "Set-Cookie"), apr_psprintf(r->pool, - "GRIDHTTP_ONETIME=%s; " + "GRIDHTTP_PASSCODE=%s; " "expires=%s; " "domain=%s; " "path=%s", @@ -1524,7 +1524,7 @@ static void *create_gridsite_srv_config(apr_pool_t *p, server_rec *s) { gridhttpport = GRST_HTTP_PORT; - onetimesdir = apr_pstrdup(p, "/var/www/onetimes"); + passcodesdir = apr_pstrdup(p, "/var/www/passcodes"); /* GridSiteOnetimesDir dir-path */ sitecastdnlists = NULL; @@ -1734,7 +1734,7 @@ static const char *mod_gridsite_take1_cmds(cmd_parms *a, void *cfg, if (a->server->is_virtual) return "GridSiteOnetimesDir cannot be used inside a virtual server"; - onetimesdir = apr_pstrdup(a->pool, parm); + passcodesdir = apr_pstrdup(a->pool, parm); } else if (strcasecmp(a->cmd->name, "GridSiteGridHTTPport") == 0) { @@ -2041,7 +2041,7 @@ static const command_rec mod_gridsite_cmds[] = 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"), + NULL, RSRC_CONF, "directory with GridHTTP passcodes"), AP_INIT_TAKE1("GridSiteCastDNlists", mod_gridsite_take1_cmds, NULL, RSRC_CONF, "DN Lists directories search path for SiteCast"), @@ -2142,7 +2142,7 @@ static int mod_gridsite_perm_handler(request_rec *r) 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, + *gridauthpasscode = NULL, *cookiefile, oneline[1025], *key_i, *destination = NULL, *destination_uri = NULL, *querytmp, *destination_prefix = NULL, *destination_translated = NULL; const char *content_type; @@ -2314,49 +2314,49 @@ static int mod_gridsite_perm_handler(request_rec *r) } } - /* first look for GRIDHTTP_ONETIME cookie */ + /* first look for GRIDHTTP_PASSCODE cookie */ if ((p = (char *) apr_table_get(r->headers_in, "Cookie")) != NULL) { cookies = apr_pstrcat(r->pool, " ", p, NULL); - gridauthonetime = strstr(cookies, " GRIDHTTP_ONETIME="); + gridauthpasscode = strstr(cookies, " GRIDHTTP_PASSCODE="); - if (gridauthonetime != NULL) + if (gridauthpasscode != NULL) { - for (p = &gridauthonetime[18]; + for (p = &gridauthpasscode[18]; (*p != '\0') && (*p != ';'); ++p) if (!isalnum(*p)) *p = '\0'; } } - /* then look for GRIDHTTP_ONETIME in QUERY_STRING ie after ? */ + /* then look for GRIDHTTP_PASSCODE in QUERY_STRING ie after ? */ - if (gridauthonetime == NULL) + if (gridauthpasscode == 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="); + gridauthpasscode = strstr(querytmp, "&GRIDHTTP_PASSCODE="); - if (gridauthonetime != NULL) + if (gridauthpasscode != NULL) { - for (p = &gridauthonetime[18]; + for (p = &gridauthpasscode[18]; (*p != '\0') && (*p != '&'); ++p) if (!isalnum(*p)) *p = '\0'; } } } - if ((gridauthonetime != NULL) && (gridauthonetime[0] != '\0')) + if ((gridauthpasscode != NULL) && (gridauthpasscode[0] != '\0')) { cookiefile = apr_psprintf(r->pool, "%s/%s", ap_server_root_relative(r->pool, - onetimesdir), - &gridauthonetime[18]); + passcodesdir), + &gridauthpasscode[18]); ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "Opening GridHTTP onetime file %s", cookiefile); + "Opening GridHTTP passcode file %s", cookiefile); if ((apr_stat(&cookiefile_info, cookiefile, APR_FINFO_TYPE, r->pool) == APR_SUCCESS) && @@ -2365,7 +2365,7 @@ static int mod_gridsite_perm_handler(request_rec *r) == APR_SUCCESS)) { ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "Reading GridHTTP onetime file %s", cookiefile); + "Reading GridHTTP passcode file %s", cookiefile); while (apr_file_gets(oneline, sizeof(oneline), fp) == APR_SUCCESS) @@ -2387,7 +2387,7 @@ static int mod_gridsite_perm_handler(request_rec *r) (strcmp(&oneline[5], r->uri) != 0)) break; else if (strncmp(oneline, "onetime=yes", 11) == 0) - apr_file_remove(cookiefile, r->pool); + 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) -- 1.8.2.3