From d147f79a0aa106efea327b4d3a5a0b88b2fc672d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Wed, 8 Jun 2011 12:12:06 +0000 Subject: [PATCH] Merge from branch_2_1 to branch_3_0, take 1 --- org.glite.lb.client-java/project/ChangeLog | 3 + org.glite.lb.client/project/ChangeLog | 7 ++ org.glite.lb.client/src/connection.c | 5 +- org.glite.lb.common/interface/context.h | 1 + org.glite.lb.common/project/ChangeLog | 4 + org.glite.lb.common/src/context.c | 2 + org.glite.lb.common/src/mini_http.c | 21 +++- org.glite.lb.doc/project/ChangeLog | 5 + org.glite.lb.doc/src/LBAG-Installation.tex | 30 +++++- org.glite.lb.doc/src/LBAG-Running.tex | 4 + org.glite.lb.glite-LB/project/ChangeLog | 6 ++ org.glite.lb.server/project/ChangeLog | 11 ++ org.glite.lb.server/src/bkserverd.c | 17 +++- org.glite.lb.server/src/dump.c | 6 +- org.glite.lb.server/src/get_events.c.T | 16 ++- org.glite.lb.server/src/lb_http.c | 3 + org.glite.lb.server/src/lb_proto.c | 26 +++-- org.glite.lb.server/src/server_state.c | 47 +++++---- org.glite.lb.utils/project/ChangeLog | 5 + org.glite.lb.utils/src/dump.c | 36 +++++-- org.glite.lb.utils/src/purge.c | 12 ++- .../interface/glite_gscompat.h | 111 +++++++++++++++++++++ .../project/ChangeLog | 3 + org.glite.lbjp-common.maildir/project/ChangeLog | 3 + .../project/ChangeLog | 3 + org.glite.lbjp-common.trio/project/ChangeLog | 3 + 26 files changed, 339 insertions(+), 51 deletions(-) create mode 100644 org.glite.lbjp-common.gsoap-plugin/interface/glite_gscompat.h diff --git a/org.glite.lb.client-java/project/ChangeLog b/org.glite.lb.client-java/project/ChangeLog index 17fbf34..a597805 100644 --- a/org.glite.lb.client-java/project/ChangeLog +++ b/org.glite.lb.client-java/project/ChangeLog @@ -32,6 +32,9 @@ 1.0.5-6 - Module rebuilt +1.0.6-1 +- Support gcj java + 1.1.0-1 - Fixes for parallel release in EMI & gLite - CREAM_CORE->CREAM_EXECUTOR diff --git a/org.glite.lb.client/project/ChangeLog b/org.glite.lb.client/project/ChangeLog index 3546e97..55e4161 100644 --- a/org.glite.lb.client/project/ChangeLog +++ b/org.glite.lb.client/project/ChangeLog @@ -126,6 +126,12 @@ 4.1.8-1 - Optimized handling of simultaneous proxy&direct logging (fix for bug #77366) +4.1.9-1 +- Fixed default setting for GLITE_LB_EXPORT_PURGE_ARGS + +4.1.10-1 +- Proper handling of background purge error messages (fix for bug #77974) + 5.0.0-1 - Fixes for parallel release in EMI & gLite - Version numbering fixed @@ -176,3 +182,4 @@ 5.0.6-1 - Using rpath only as $prefix/$libdir (fixes rpmlint rpath check in mock environment) + diff --git a/org.glite.lb.client/src/connection.c b/org.glite.lb.client/src/connection.c index e5ab489..2b56382 100644 --- a/org.glite.lb.client/src/connection.c +++ b/org.glite.lb.client/src/connection.c @@ -568,7 +568,10 @@ int http_check_status( break; case HTTP_UNSUPPORTED: edg_wll_SetError(ctx, ENOTSUP, "Protocol versions incompatible"); - break; + break; + case HTTP_ACCEPTED: + edg_wll_SetError(ctx,EDG_WLL_ERROR_ACCEPTED_OK,response+len); + break; case HTTP_INTERNAL: /* fall through */ default: diff --git a/org.glite.lb.common/interface/context.h b/org.glite.lb.common/interface/context.h index ab0b1b2..ad5953d 100644 --- a/org.glite.lb.common/interface/context.h +++ b/org.glite.lb.common/interface/context.h @@ -214,6 +214,7 @@ typedef enum _edg_wll_ErrorCode { EDG_WLL_ERROR_COMPARE_EVENTS, /**< Two compared events differ. */ EDG_WLL_ERROR_DB_TRANS_DEADLOCK, /**< Deadlock detected during DB operation. */ EDG_WLL_ERROR_DB_LOST_CONNECTION, /**< Lost connection to DB */ + EDG_WLL_ERROR_ACCEPTED_OK, /**< Deferred or background operation accepted. */ } edg_wll_ErrorCode; /** diff --git a/org.glite.lb.common/project/ChangeLog b/org.glite.lb.common/project/ChangeLog index 38bb5e7..8bc3a20 100644 --- a/org.glite.lb.common/project/ChangeLog +++ b/org.glite.lb.common/project/ChangeLog @@ -108,6 +108,10 @@ 7.1.9-1 - Prevent interlogger files from getting corrupted when disk is full +7.1.10-1 +- Proper handling of background purge error messages (fix for bug #77974) +- Better detection of excessively long lines in HTTP requests. + 8.0.0-1 - Fixes for parallel release in EMI & gLite - Version numbering fixed diff --git a/org.glite.lb.common/src/context.c b/org.glite.lb.common/src/context.c index be72faa..44d9c8b 100644 --- a/org.glite.lb.common/src/context.c +++ b/org.glite.lb.common/src/context.c @@ -239,6 +239,8 @@ static const char* const errTexts[] = { "Interlogger has events pending", "Compared events differ", "DB deadlock detected", + "DB connection lost", + "Background operation accepted", }; const char *edg_wll_GetErrorText(int code) { diff --git a/org.glite.lb.common/src/mini_http.c b/org.glite.lb.common/src/mini_http.c index 0788cdf..472d578 100644 --- a/org.glite.lb.common/src/mini_http.c +++ b/org.glite.lb.common/src/mini_http.c @@ -97,7 +97,14 @@ edg_wll_ErrorCode edg_wll_http_recv(edg_wll_Context ctx,char **firstOut,char *** first = strdup(connPTR->buf); bshift(cr-connPTR->buf+2); pstat = HEAD; - } else rdmore = 1; + } else { + if (connPTR->bufUse >= connPTR->bufSize) { + edg_wll_SetError(ctx,E2BIG,"HTTP Request FIRST line too long"); + free(connPTR->buf); connPTR->buf = NULL; + connPTR->bufUse = 0; connPTR->bufSize = 0; + goto error; } + rdmore = 1; + } break; case HEAD: if ((cr = memchr(connPTR->buf,'\r',connPTR->bufUse)) && @@ -119,7 +126,14 @@ edg_wll_ErrorCode edg_wll_http_recv(edg_wll_Context ctx,char **firstOut,char *** clen = atoi(connPTR->buf+sizeof(CONTENT_LENGTH)-1); bshift(cr-connPTR->buf+2); - } else rdmore = 1; + } else { + if (connPTR->bufUse >= connPTR->bufSize) { + edg_wll_SetError(ctx,E2BIG,"HTTP Request HEAD line too long"); + free(connPTR->buf); connPTR->buf = NULL; + connPTR->bufUse = 0; connPTR->bufSize = 0; + goto error; } + rdmore = 1; + } break; case BODY: if (connPTR->bufUse) { @@ -181,7 +195,7 @@ edg_wll_ErrorCode edg_wll_http_recv_proxy(edg_wll_Context ctx,char **firstOut,ch if ( !ctx->connProxy->buf ) { ctx->connProxy->bufSize = BUFSIZ; ctx->connProxy->bufUse = 0; - ctx->connProxy->buf = malloc(BUFSIZ); + ctx->connProxy->buf = malloc(ctx->connProxy->bufSize); } do { @@ -199,7 +213,6 @@ edg_wll_ErrorCode edg_wll_http_recv_proxy(edg_wll_Context ctx,char **firstOut,ch while (!rdmore && pstat != DONE) switch (pstat) { char *cr; - case FIRST: if ((cr = memchr(ctx->connProxy->buf,'\r',ctx->connProxy->bufUse)) && ctx->connProxy->bufUse >= cr-ctx->connProxy->buf+2 && cr[1] == '\n') diff --git a/org.glite.lb.doc/project/ChangeLog b/org.glite.lb.doc/project/ChangeLog index b0bcc7d..abdaa07 100644 --- a/org.glite.lb.doc/project/ChangeLog +++ b/org.glite.lb.doc/project/ChangeLog @@ -78,6 +78,11 @@ 1.1.11-3 - Module rebuilt +1.1.12-1 +- Extended information on logging +- More on logging to syslog +- A few typos fixed + 1.2.0-1 - Documentation updated to cover new features to be released with EMI-1 diff --git a/org.glite.lb.doc/src/LBAG-Installation.tex b/org.glite.lb.doc/src/LBAG-Installation.tex index 2958bb9..c3bc5a4 100644 --- a/org.glite.lb.doc/src/LBAG-Installation.tex +++ b/org.glite.lb.doc/src/LBAG-Installation.tex @@ -95,6 +95,7 @@ where all \verb'glite-lbjp-common-*' packages are common both to \LB and Job Provenance (\JP). \subsection{Common logging format} +\label{inst:comlog} Since \LBver{2.1} \LB service follows the \textbf{gLite common logging recommendations v1.1}: \begin{center} \url{https://twiki.cern.ch/twiki/pub/EGEE/EGEEgLite/logging.html}. @@ -112,10 +113,37 @@ A file \texttt{log4crc.example-debugging} may be useful to copy to \texttt{\$HOME/.log4crc} (or by setting the \texttt{LOG4C\_RCPATH} environment variable to a directory containing the \texttt{log4crc} file) to obtain detailed debugging output. One can debug only specific parts of the LB system, for example -by uncommenting \texttt{LB.SERVER.DB} cathegory in the \texttt{log4crc} file, +by uncommenting \texttt{LB.SERVER.DB} category in the \texttt{log4crc} file, one gets only the debugging info related to the underlying database subsystem calls. +Currently supported log categories are: + +\begin{tabularx}{\textwidth}{>{\tt}lX} +SECURITY & Security matters \\ +ACCESS & Communication issues \\ +CONTROL & \LB server control \\ +LB & \emph{unused} \\ +LB.LOGD & Messages from the \LB local logger \\ +LB.INTERLOGD & Messages from the \LB interlogger \\ +LB.NOTIFINTERLOGD & Messages from the notification interlogger \\ +LB.SERVER & Processing within the \LB server \\ +LB.SERVER.DB & DB calls made by the server \\ +LB.SERVER.REQUEST & Processing \LB server requests \\ +LB.HARVESTER & Messages from the \LB harvester \\ +LB.HARVESTER.DB & DB calls made by the harvester \\ +LB.AUTHZ & Authentication matters \\ +\end{tabularx} + +The following log priorities are recognized, in a descending order of severity: \texttt{fatal}, \texttt{error}, \texttt{warn}, \texttt{info}, \texttt{debug}. Note that running with any of the logging categories set do \texttt{debug} for a prolonged period of time will result in the logfile growing uncontroledly. + +In a typical setup, logging messages generated by the \LB service will be found in \texttt{/var/log/messages}. + +\note\ \emph{syslog} is typically configured to drop log messages with priority \texttt{debug}. You may want to enable it, for example by using something like this in \texttt{/etc/syslog.conf} and then restarting {syslog}: +\begin{verbatim} +*.debug;mail.none;authpriv.none;cron.none -/var/log/messages +\end{verbatim} + \subsection{\LB server} \subsubsection{Hardware requirements} diff --git a/org.glite.lb.doc/src/LBAG-Running.tex b/org.glite.lb.doc/src/LBAG-Running.tex index 09dfa02..56d19a3 100644 --- a/org.glite.lb.doc/src/LBAG-Running.tex +++ b/org.glite.lb.doc/src/LBAG-Running.tex @@ -35,6 +35,10 @@ as standard manual pages installed with the \LB packages. In normal operation \LB server sends error messages to syslog. Informational messages are generally avoided in order to prevent syslog congestion. +Since \LBver{2.1}, the service implements a common logging format\footnote{\url{http://en.wikipedia.org/wiki/Common_Log_Format}} (see section\,\ref{inst:comlog}, page\,\pageref{inst:comlog}). + +For \LBver{2.0 and lower}, the following instructions apply: + \begin{sloppypar} When tracing problems, GLITE\_LB\_SERVER\_DEBUG environment variable can be set to non-empty value when starting the service. diff --git a/org.glite.lb.glite-LB/project/ChangeLog b/org.glite.lb.glite-LB/project/ChangeLog index 438aee9..a3aee8e 100644 --- a/org.glite.lb.glite-LB/project/ChangeLog +++ b/org.glite.lb.glite-LB/project/ChangeLog @@ -35,3 +35,9 @@ 3.3.3-3 - Module rebuilt +3.2.12-10 +- Module rebuilt + +3.2.12-11 +- Module rebuilt + diff --git a/org.glite.lb.server/project/ChangeLog b/org.glite.lb.server/project/ChangeLog index 83eb9f5..92b4b43 100644 --- a/org.glite.lb.server/project/ChangeLog +++ b/org.glite.lb.server/project/ChangeLog @@ -219,6 +219,17 @@ 2.1.16-1 - Increased severity for DB open errors +2.1.17-1 +- Proper handling of background purge error messages (fix for bug #77974) +- Handling HTTP requests that are too long to fit into the server-side buffer + - Throw error for HTTP requests longer than allocated buffer. +- Minor fixes in server-side L&B dump code +- Benign reaction to unknown event types in edg_wll_get_event_flesh() for forward compatibility +- Refactoring of server state storing routine to avoid unnecessary error reports +- fixed RSS feeds with disable indexing +- fixed empty RSS feeds +- Support zombification of single SB transfer jobs + 2.2.0-1 - Fixes for parallel release in EMI & gLite - Extended authorization: Support for the TAG operation in the ACLs diff --git a/org.glite.lb.server/src/bkserverd.c b/org.glite.lb.server/src/bkserverd.c index dde7568..f85a474 100644 --- a/org.glite.lb.server/src/bkserverd.c +++ b/org.glite.lb.server/src/bkserverd.c @@ -1469,7 +1469,6 @@ static int handle_server_error(edg_wll_Context ctx) int err,ret = 0; - errt = errd = NULL; switch ( (err = edg_wll_Error(ctx, &errt, &errd)) ) { case ETIMEDOUT: @@ -1477,6 +1476,7 @@ static int handle_server_error(edg_wll_Context ctx) case EPIPE: case EIO: case EDG_WLL_IL_PROTO: + case E2BIG: glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_WARN, "[%d] %s (%s)", getpid(), errt, errd); /* fallthrough @@ -1493,8 +1493,10 @@ static int handle_server_error(edg_wll_Context ctx) case EPERM: case EEXIST: case EDG_WLL_ERROR_NOINDEX: - case E2BIG: case EIDRM: + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_WARN, + "[%d] %s (%s)", getpid(), errt, errd); + break; case EINVAL: case EDG_WLL_ERROR_PARSE_BROKEN_ULM: case EDG_WLL_ERROR_PARSE_EVENT_UNDEF: @@ -1510,7 +1512,16 @@ static int handle_server_error(edg_wll_Context ctx) * no action for non-fatal errors */ break; - + + case EDG_WLL_ERROR_ACCEPTED_OK: + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, + "[%d] %s (%s)", getpid(), errt, errd); + /* + * all OK, but slave needs to be restarted + */ + ret = -EINPROGRESS; + break; + case EDG_WLL_ERROR_DB_INIT: case EDG_WLL_ERROR_DB_CALL: case EDG_WLL_ERROR_SERVER_RESPONSE: diff --git a/org.glite.lb.server/src/dump.c b/org.glite.lb.server/src/dump.c index ff785bd..c25f552 100644 --- a/org.glite.lb.server/src/dump.c +++ b/org.glite.lb.server/src/dump.c @@ -50,7 +50,7 @@ int edg_wll_DumpEventsServer(edg_wll_Context ctx,const edg_wll_DumpRequest *req, char *tmpfname; time_t start,end; glite_lbu_Statement q = NULL; - char *res[10]; + char *res[11]; int event; edg_wll_Event e; int ret,dump = 2; /* TODO: manage dump file */ @@ -76,11 +76,11 @@ int edg_wll_DumpEventsServer(edg_wll_Context ctx,const edg_wll_DumpRequest *req, glite_lbu_TimeToStr(to, &to_s); trio_asprintf(&stmt, - "select event,dg_jobid,code,prog,host,u.cert_subj,time_stamp,usec,level,arrived " + "select event,dg_jobid,code,prog,host,u.cert_subj,time_stamp,usec,level,arrived,seqcode " "from events e,users u,jobs j " "where u.userid=e.userid " "and j.jobid = e.jobid " - "and j.dg_jobid like 'https://%|Ss:%d%%' " + "and j.dg_jobid like 'https://%|Ss:%d/%%' " "and arrived > %s and arrived <= %s " "order by arrived", ctx->srvName,ctx->srvPort, diff --git a/org.glite.lb.server/src/get_events.c.T b/org.glite.lb.server/src/get_events.c.T index 4ff6ca5..cff249e 100644 --- a/org.glite.lb.server/src/get_events.c.T +++ b/org.glite.lb.server/src/get_events.c.T @@ -65,12 +65,18 @@ int edg_wll_get_event_flesh(edg_wll_Context ctx,int n,edg_wll_Event *e) edg_wll_ParseEvent(ctx,nameval[0],&f); free(nameval[0]); - f->any.arrived = e->any.arrived; - edg_wll_FreeEvent(e); + if(f) { + f->any.arrived = e->any.arrived; + edg_wll_FreeEvent(e); - memcpy(e, f, sizeof *e); - free(f); - ret=edg_wll_CheckEvent(ctx,e); + memcpy(e, f, sizeof *e); + free(f); + ret=edg_wll_CheckEvent(ctx,e); + } + else { + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_WARN, "Unknown event type encountered during dump; jobid %s, event %d", jobid, n); + ret = EINVAL; + } } else ret = ENOENT; free(q); q = NULL; glite_lbu_FreeStmt(&sh); diff --git a/org.glite.lb.server/src/lb_http.c b/org.glite.lb.server/src/lb_http.c index 917bf25..8d9b8e2 100644 --- a/org.glite.lb.server/src/lb_http.c +++ b/org.glite.lb.server/src/lb_http.c @@ -57,6 +57,9 @@ int edg_wll_AcceptHTTP(edg_wll_Context ctx, char **body, char **resp, char ***hd if ((err = edg_wll_Proto(ctx,req,hdr,*body,resp,hdrOut,bodyOut,httpErr))) edg_wll_Error(ctx,NULL,&err_desc); } + else + asprintf(resp,"HTTP/1.1 %d %s", HTTP_BADREQ, edg_wll_HTTPErrorMessage(HTTP_BADREQ)); + free(req); if (hdr) { diff --git a/org.glite.lb.server/src/lb_proto.c b/org.glite.lb.server/src/lb_proto.c index 4af0aca..86f64ed 100644 --- a/org.glite.lb.server/src/lb_proto.c +++ b/org.glite.lb.server/src/lb_proto.c @@ -381,10 +381,13 @@ static int getJobsRSS(edg_wll_Context ctx, char *feedType, edg_wll_JobStat **sta } else{ *statesOut = NULL; + free(can_peername); return -1; } - edg_wll_QueryJobsServer(ctx, (const edg_wll_QueryRec **)conds, 0, &jobsOut, statesOut); + if (edg_wll_QueryJobsServer(ctx, (const edg_wll_QueryRec **)conds, 0, &jobsOut, statesOut)){ + *statesOut = NULL; + } for (i = 0; conds[i]; i++) free(conds[i]); @@ -805,7 +808,7 @@ edg_wll_ErrorCode edg_wll_Proto(edg_wll_Context ctx, // check if owner and lastupdatetime is indexed idx = 0; - for (i = 0; ctx->job_index[i]; i++) + if (ctx->job_index) for (i = 0; ctx->job_index[i]; i++) if (ctx->job_index[i]->attr == EDG_WLL_QUERY_ATTR_OWNER) idx++; else if (ctx->job_index[i]->attr == EDG_WLL_QUERY_ATTR_LASTUPDATETIME) @@ -814,7 +817,8 @@ edg_wll_ErrorCode edg_wll_Proto(edg_wll_Context ctx, ret = HTTP_NOTFOUND; edg_wll_SetError(ctx, ENOENT, "current index configuration does not support RSS feeds"); } - edg_wll_RSSFeed(ctx, states, requestPTR, &message); + else + edg_wll_RSSFeed(ctx, states, requestPTR, &message); /*GET /?wsdl */ #define WSDL_LB "LB.wsdl" #define WSDL_LBTYPES "LBTypes.wsdl" @@ -1027,7 +1031,7 @@ edg_wll_ErrorCode edg_wll_Proto(edg_wll_Context ctx, default: /* client request handler */ ret = HTTP_ACCEPTED; /* to end this parent */ - edg_wll_SetError(ctx, EDG_WLL_ERROR_SERVER_RESPONSE, edg_wll_HTTPErrorMessage(ret)); + edg_wll_SetError(ctx, EDG_WLL_ERROR_ACCEPTED_OK, edg_wll_HTTPErrorMessage(ret)); goto err; } } @@ -1047,7 +1051,7 @@ edg_wll_ErrorCode edg_wll_Proto(edg_wll_Context ctx, if (edg_wll_PurgeResultToXML(ctx, &result, &message)) ret = HTTP_INTERNAL; else - printf("%s", message); + glite_common_log_msg(LOG_CATEGORY_CONTROL, LOG_PRIORITY_DEBUG, message); } /* result is now packed in message, free it */ @@ -1062,9 +1066,19 @@ edg_wll_ErrorCode edg_wll_Proto(edg_wll_Context ctx, /* forked cleaner sends no results */ if ((request.flags & EDG_WLL_PURGE_BACKGROUND)) { - *response = NULL; + char *et, *ed; + free(message); message = NULL; + if (ret != HTTP_OK && ret != HTTP_ACCEPTED) { + edg_wll_Error(ctx, &et, &ed); + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_ERROR, "Background purge failed, %s (%s)",et, ed); + free(et); + free(ed); + } else { + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, "Background purge done, %d jobs purged.", i - 1:); + } + *response = NULL; if (requestPTR) free(requestPTR); exit(0); } diff --git a/org.glite.lb.server/src/server_state.c b/org.glite.lb.server/src/server_state.c index a95610e..f64d32a 100644 --- a/org.glite.lb.server/src/server_state.c +++ b/org.glite.lb.server/src/server_state.c @@ -51,28 +51,39 @@ int edg_wll_GetServerState(edg_wll_Context ctx,const char *name,char **val) int edg_wll_SetServerState(edg_wll_Context ctx,const char *name,const char *val) { char *stmt = NULL; + int sql_retval; - trio_asprintf(&stmt,"insert into server_state (prefix,name,value) " - "values ('https://%|Ss:%d','%|Ss','%|Ss')", - ctx->srvName,ctx->srvPort,name,val); + // Check if record exists + trio_asprintf(&stmt,"select value from server_state " + "where prefix = 'https://%|Ss:%d' and name = '%|Ss'", + ctx->srvName,ctx->srvPort,name); glite_common_log_msg(LOG_CATEGORY_LB_SERVER_DB, LOG_PRIORITY_DEBUG, stmt); - switch(edg_wll_ExecSQL(ctx,stmt,NULL)) { - case 1: break; - case -1: if (edg_wll_Error(ctx,NULL,NULL) == EEXIST) { - free(stmt); - trio_asprintf(&stmt,"update server_state set value = '%|Ss' " - "where prefix = 'https://%|Ss:%d' " - "and name = '%|Ss'", - val,ctx->srvName,ctx->srvPort,name); - glite_common_log_msg(LOG_CATEGORY_LB_SERVER_DB, - LOG_PRIORITY_DEBUG, stmt); - edg_wll_ExecSQL(ctx,stmt,NULL); - } - break; + sql_retval = edg_wll_ExecSQL(ctx,stmt,NULL); - default: abort(); - } free(stmt); + + if (!sql_retval) { + trio_asprintf(&stmt,"insert into server_state (prefix,name,value) " + "values ('https://%|Ss:%d','%|Ss','%|Ss')", + ctx->srvName,ctx->srvPort,name,val); + glite_common_log_msg(LOG_CATEGORY_LB_SERVER_DB, LOG_PRIORITY_DEBUG, stmt); + edg_wll_ExecSQL(ctx,stmt,NULL); + free(stmt); + } + else { + if (sql_retval > 0) { + trio_asprintf(&stmt,"update server_state set value = '%|Ss' " + "where prefix = 'https://%|Ss:%d' " + "and name = '%|Ss'", + val,ctx->srvName,ctx->srvPort,name); + glite_common_log_msg(LOG_CATEGORY_LB_SERVER_DB, + LOG_PRIORITY_DEBUG, stmt); + edg_wll_ExecSQL(ctx,stmt,NULL); + free(stmt); + } + else abort(); + } + return edg_wll_Error(ctx,NULL,NULL); } diff --git a/org.glite.lb.utils/project/ChangeLog b/org.glite.lb.utils/project/ChangeLog index 8f04d6a..ec74ec5 100644 --- a/org.glite.lb.utils/project/ChangeLog +++ b/org.glite.lb.utils/project/ChangeLog @@ -51,6 +51,11 @@ 2.0.8-4 - Module rebuilt +2.0.9-1 +- Essential checking of temporal arguments to glite-lb-dump for validity +- Support for special date values (now, last dump start/end) in glite-lb-dump +- Proper handling of background purge error messages (fix for bug #77974) + 2.1.0-1 - Fixes for parallel release in EMI & gLite - Check result of InitContext calls diff --git a/org.glite.lb.utils/src/dump.c b/org.glite.lb.utils/src/dump.c index 57d34ad..5bcfb01 100644 --- a/org.glite.lb.utils/src/dump.c +++ b/org.glite.lb.utils/src/dump.c @@ -58,15 +58,32 @@ static struct option opts[] = { static void usage(char *me) { fprintf(stderr,"usage: %s [option]\n" - " -f, --from YYYYMMDDHHmmss beginning of the time interval for events to be dumped\n" - " -t, --to YYYYMMDDHHmmss end of the time interval for events to be dumped\n" + " -f, --from YYYYMMDDHHmmss beginning of the time interval for events to be dumped*\n" + " -t, --to YYYYMMDDHHmmss end of the time interval for events to be dumped*\n" " -h, --help display this help\n" " -v, --version display version\n" " -d, --debug diagnostic output\n" - " -m, --server L&B server machine name\n", + " -m, --server L&B server machine name\n\n" + " * Special values for temporal arguments '-f' and '-t':\n" + " 'now' this exact moment\n" + " 'last_start' last dump starting time\n" + " 'last_end' last dump ending time\n", me); } +double ParseDate(const char *s) { + if (!strcmp(s,"now")) return EDG_WLL_DUMP_NOW; + if (!strcmp(s,"last_start")) return EDG_WLL_DUMP_LAST_START; + if (!strcmp(s,"last_end")) return EDG_WLL_DUMP_LAST_END; + + if(strlen(s)<14) return -16; + + int i; + for (i = 0; i<14; i++) if((s[i]<'0')||(s[i]>'9')) return -16; + + return edg_wll_ULMDateToDouble(s); +} + int main(int argc,char *argv[]) { edg_wll_DumpRequest *request; @@ -76,7 +93,7 @@ int main(int argc,char *argv[]) char *me; int opt; - edg_wll_Context ctx; + edg_wll_Context ctx = NULL; /* initialize request to server defaults */ request = (edg_wll_DumpRequest *) calloc(1,sizeof(edg_wll_DumpRequest)); @@ -94,8 +111,8 @@ int main(int argc,char *argv[]) switch (opt) { - case 'f': request->from = (time_t) edg_wll_ULMDateToDouble(optarg); break; - case 't': request->to = (time_t) edg_wll_ULMDateToDouble(optarg); break; + case 'f': request->from = (time_t) ParseDate(optarg); break; + case 't': request->to = (time_t) ParseDate(optarg); break; case 'm': server = optarg; break; case 'd': debug = 1; break; case 'v': fprintf(stdout,"%s:\t%s\n",me,rcsid); exit(0); @@ -104,6 +121,13 @@ int main(int argc,char *argv[]) } } + if(request->from < -15) { + fprintf(stdout, "Invalid 'from' date\n"); + goto main_end; } + if(request->to < -15) { + fprintf(stdout, "Invalid 'to' date\n"); + goto main_end; } + /* check request */ if (debug) { printf("Dump request:\n"); diff --git a/org.glite.lb.utils/src/purge.c b/org.glite.lb.utils/src/purge.c index f8884b8..2cce1d5 100644 --- a/org.glite.lb.utils/src/purge.c +++ b/org.glite.lb.utils/src/purge.c @@ -108,7 +108,7 @@ int main(int argc,char *argv[]) { edg_wll_PurgeRequest *request; edg_wll_PurgeResult *result; - int i, timeout, background; + int i, timeout, background, err = 1; char *server = NULL; char *me; @@ -288,15 +288,19 @@ int main(int argc,char *argv[]) /* that is the Purge */ dprintf(("Running the edg_wll_Purge...\n")); - if (edg_wll_Purge(ctx, request, result) != 0) { - fprintf(stderr,"Error running the edg_wll_Purge().\n"); + if ((err = edg_wll_Purge(ctx, request, result)) != 0) { + if (err == EDG_WLL_ERROR_ACCEPTED_OK) err = 0; + else fprintf(stderr,"Error running the edg_wll_Purge().\n"); printerr(ctx); + switch ( edg_wll_Error(ctx, NULL, NULL) ) { case ENOENT: case EPERM: case EINVAL: break; + case EDG_WLL_ERROR_ACCEPTED_OK: + /* fall-through */ default: goto main_end; } @@ -329,7 +333,7 @@ main_end: } if (result) free(result); edg_wll_FreeContext(ctx); - return 0; + return err != 0; } diff --git a/org.glite.lbjp-common.gsoap-plugin/interface/glite_gscompat.h b/org.glite.lbjp-common.gsoap-plugin/interface/glite_gscompat.h new file mode 100644 index 0000000..50a2b93 --- /dev/null +++ b/org.glite.lbjp-common.gsoap-plugin/interface/glite_gscompat.h @@ -0,0 +1,111 @@ +/* +Copyright (c) Members of the EGEE Collaboration. 2004-2010. +See http://www.eu-egee.org/partners for details on the copyright holders. + +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. +*/ + +#ifndef GLITE_SECURITY_GSCOMPAT_H +#define GLITE_SECURITY_GSCOMPAT_H + +#ident "$Header: " + +#ifndef GSOAP_VERSION + #error GSOAP_VERSION required +#endif + +#ifndef GSOAP_VERSION_LETTER +#define GSOAP_VERSION_LETTER '\0' +#endif + +#if GSOAP_VERSION >= 20709 || GSOAP_VERSION == 20706 && GSOAP_VERSION_LETTER >= 'd' + #define GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, ITEM, TYPENAME, TYPENO) ((CHOICE)->union_##TYPENAME.ITEM) + #define GLITE_SECURITY_GSOAP_CHOICE_SETTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO) ((CHOICE)->__union_##TYPENAME) = SOAP_UNION__##NS##__union_##TYPENAME##_##ITEM + #define GLITE_SECURITY_GSOAP_CHOICE_ISTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO) (((CHOICE)->__union_##TYPENAME) == SOAP_UNION__##NS##__union_##TYPENAME##_##ITEM) + /** 2.7.10 requires created dummy choice with type == 0 for empty optional choice */ + #if GSOAP_VERSION >= 20710 + #define GLITE_SECURITY_GSOAP_CHOICE_SETNULL(CHOICE, TYPENAME) ((CHOICE)->__union_##TYPENAME) = 0 + #endif +#elif GSOAP_VERSION >= 20706 + #define GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, ITEM, TYPENAME, TYPENO) ((CHOICE)->union_##TYPENO.ITEM) + #define GLITE_SECURITY_GSOAP_CHOICE_SETTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO) ((CHOICE)->__union_##TYPENO) = SOAP_UNION_##NS##__union_##TYPENO##_##ITEM + #define GLITE_SECURITY_GSOAP_CHOICE_ISTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO) (((CHOICE)->__union_##TYPENO) == SOAP_UNION_##NS##__union_##TYPENO##_##ITEM) +#else + #define GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, ITEM, TYPENAME, TYPENO) ((CHOICE)->ITEM) + #define GLITE_SECURITY_GSOAP_CHOICE_SETTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO) + #define GLITE_SECURITY_GSOAP_CHOICE_ISTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO) (((CHOICE)->ITEM) != NULL) +#endif +#define GLITE_SECURITY_GSOAP_CHOICE_SET(CHOICE, ITEM, NS, TYPENAME, TYPENO, VALUE) do { \ + memset((CHOICE), 0, sizeof(*(CHOICE))); \ + GLITE_SECURITY_GSOAP_CHOICE_SETTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO); \ + GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, ITEM, TYPENAME, TYPENO) = (VALUE); \ +} while(0) + +#if GSOAP_VERSION >= 20706 + #define GLITE_SECURITY_GSOAP_REASON2(SOAP) ((SOAP)->fault->SOAP_ENV__Reason ? (SOAP)->fault->SOAP_ENV__Reason->SOAP_ENV__Text : "(no reason)") + #define GLITE_SECURITY_GSOAP_TRUE xsd__boolean__true_ + #define GLITE_SECURITY_GSOAP_FALSE xsd__boolean__false_ +#else + #define GLITE_SECURITY_GSOAP_REASON2(SOAP) ((SOAP)->fault->SOAP_ENV__Reason) + #define GLITE_SECURITY_GSOAP_TRUE true_ + #define GLITE_SECURITY_GSOAP_FALSE false_ +#endif + +#define GLITE_SECURITY_GSOAP_DETAIL(SOAP) ((SOAP)->version == 2 ? (SOAP)->fault->SOAP_ENV__Detail : (SOAP)->fault->detail) +#define GLITE_SECURITY_GSOAP_REASON(SOAP) ((SOAP)->version == 2 ? GLITE_SECURITY_GSOAP_REASON2((SOAP)) : (SOAP)->fault->faultstring) + +#if GSOAP_VERSION >= 20709 + #define GLITE_SECURITY_GSOAP_LIST_CREATE0(SOAP, LIST, SIZE, TYPE, N) do { \ + if ((N) != 0) (LIST) = soap_malloc((SOAP), (N) * sizeof(TYPE)); \ + else (LIST) = NULL; \ + (SIZE) = (N); \ +} while (0) + #define GLITE_SECURITY_GSOAP_LIST_DESTROY0(SOAP, LIST, SIZE) do { \ + if ((LIST) && (SIZE) != 0) soap_dealloc((SOAP), (LIST)); \ + (LIST) = NULL; \ +} while (0) + #define GLITE_SECURITY_GSOAP_LIST_GET(LIST, INDEX) (&(LIST)[INDEX]) + #define GLITE_SECURITY_GSOAP_LIST_TYPE(NS, LIST) struct NS##__##LIST * +#else + #define GLITE_SECURITY_GSOAP_LIST_CREATE0(SOAP, LIST, SIZE, TYPE, N) do { \ + int ilist; \ + \ + if ((N) != 0) (LIST) = soap_malloc((SOAP), (N) * sizeof(void *)); \ + else (LIST) = NULL; \ + (SIZE) = (N); \ + for (ilist = 0; ilist < (N); ilist++) { \ + (LIST)[ilist] = soap_malloc((SOAP), sizeof(TYPE)); \ + } \ +} while (0) + #define GLITE_SECURITY_GSOAP_LIST_DESTROY0(SOAP, LIST, SIZE) do { \ + int ilist; \ + \ + for (ilist = 0; ilist < (SIZE); ilist++) soap_dealloc((SOAP), (LIST)[ilist]); \ + if ((LIST) && (SIZE) != 0) soap_dealloc((SOAP), (LIST)); \ + (LIST) = NULL; \ +} while (0) + #define GLITE_SECURITY_GSOAP_LIST_GET(LIST, INDEX) ((LIST)[INDEX]) + #define GLITE_SECURITY_GSOAP_LIST_TYPE(NS, LIST) struct NS##__##LIST ** +#endif +#define GLITE_SECURITY_GSOAP_LIST_CREATE(SOAP, CONTAINER, LIST, TYPE, N) GLITE_SECURITY_GSOAP_LIST_CREATE0(SOAP, (CONTAINER)->LIST, (CONTAINER)->__size##LIST, TYPE, N) +#define GLITE_SECURITY_GSOAP_LIST_DESTROY(SOAP, CONTAINER, LIST) GLITE_SECURITY_GSOAP_LIST_DESTROY0(SOAP, (CONTAINER)->LIST, (CONTAINER)->__size##LIST) + +#if GSOAP_VERSION >= 20710 + #define GLITE_SECURITY_GSOAP_SET_FIXED(soap,attr,value) \ + (attr) = soap_strdup((soap),(value)) +#else +/* XXX unsupported */ + #define GLITE_SECURITY_GSOAP_SET_FIXED(soap,attr,value) +#endif + +#endif diff --git a/org.glite.lbjp-common.jp-interface/project/ChangeLog b/org.glite.lbjp-common.jp-interface/project/ChangeLog index 15a19cc..47207b6 100644 --- a/org.glite.lbjp-common.jp-interface/project/ChangeLog +++ b/org.glite.lbjp-common.jp-interface/project/ChangeLog @@ -41,6 +41,9 @@ 2.0.3-3 - Module rebuilt +2.0.3-4 +- Module rebuilt + 2.1.0-1 - Fixes for parallel release in EMI & gLite diff --git a/org.glite.lbjp-common.maildir/project/ChangeLog b/org.glite.lbjp-common.maildir/project/ChangeLog index ca047f5..045e453 100644 --- a/org.glite.lbjp-common.maildir/project/ChangeLog +++ b/org.glite.lbjp-common.maildir/project/ChangeLog @@ -32,6 +32,9 @@ 2.0.2-3 - Module rebuilt +2.0.2-4 +- Module rebuilt + 2.1.0-1 - Fixes for parallel release in EMI & gLite diff --git a/org.glite.lbjp-common.server-bones/project/ChangeLog b/org.glite.lbjp-common.server-bones/project/ChangeLog index 6d2854a..a0a580e 100644 --- a/org.glite.lbjp-common.server-bones/project/ChangeLog +++ b/org.glite.lbjp-common.server-bones/project/ChangeLog @@ -36,6 +36,9 @@ 2.0.3-2 - Module rebuilt +2.0.3-3 +- Module rebuilt + 2.1.0-1 - Documentation update and cleanup - Fixes for parallel release in EMI & gLite diff --git a/org.glite.lbjp-common.trio/project/ChangeLog b/org.glite.lbjp-common.trio/project/ChangeLog index 01e0fc4..134980c 100644 --- a/org.glite.lbjp-common.trio/project/ChangeLog +++ b/org.glite.lbjp-common.trio/project/ChangeLog @@ -41,6 +41,9 @@ 2.0.3-3 - Module rebuilt +2.0.3-4 +- Module rebuilt + 2.1.0-1 - Fixes for parallel release in EMI & gLite -- 1.8.2.3