00001
00002
00003 #include "rodsServer.h"
00004 #include "reGlobalsExtern.h"
00005 #include "reDefines.h"
00006 #include <sys/time.h>
00007
00008
00009 #define MY_SERVER_CONFIG_DIR "/projects/misc/doct/dgtg/irods/RODS/server/config"
00010
00011
00012
00013
00014 #define LF 10
00015 #define CR 13
00016 #define MAX_TOKEN 500
00017 #define MAX_ENTRIES 5000
00018 #define MYSRBBUFSIZE 2000000
00019 #define QSIZE MYSRBBUFSIZE
00020 #define HUGE_STRING 5000
00021
00022 typedef struct {
00023 char name[100];
00024 int size;
00025 char *val;
00026 char *fstr;
00027 } entry;
00028
00029 char *fixstr1;
00030 int heading = 0;
00031
00032 typedef struct {
00033 entry entries[MAX_ENTRIES];
00034 char cookieStr[MAX_TOKEN];
00035 int op;
00036 int m;
00037 } paramIn;
00038
00039 typedef paramIn *inStruct;
00040 int
00041 showRules(paramIn *Sentries);
00042 int
00043 performAction(paramIn *Sentries);
00044
00045 int
00046 webErrorExit(char *msg, int status)
00047 {
00048 if (!heading) {
00049 printf("Content-type: text/html%c%c",10,10);fflush(stdout);
00050 printf("<html>");
00051 printf("<body>");
00052 }
00053 printf("<B><FONT COLOR=#DC143C>Error: %s: %i</B>\n",msg, status);
00054 printf("</body></html>");
00055 exit(-1);
00056 }
00057
00058 char x2c(char *what) {
00059 register char digit;
00060
00061 digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A')+10 : (what[0] - '0'));
00062 digit *= 16;
00063 digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A')+10 : (what[1] - '0'));
00064 return(digit);
00065 }
00066
00067 void unescape_url(char *url) {
00068 register int x,y;
00069
00070 for(x=0,y=0;url[y];++x,++y) {
00071 if(((url[x] = url[y]) == '%') && isxdigit(url[y+1]) && isxdigit(url[y+2])) {
00072 url[x] = x2c(&url[y+1]);
00073 y+=2;
00074 }
00075 }
00076 url[x] = '\0';
00077 }
00078
00079
00080 void plustospace(char *str) {
00081 register int x;
00082
00083 for(x=0;str[x];x++) if(str[x] == '+') str[x] = ' ';
00084 }
00085
00086 int
00087 getBoundary(char **stquery, char *boundary)
00088 {
00089 char *tmp1;
00090
00091 tmp1 = *stquery;
00092 while (*tmp1 != '\n')
00093 tmp1++;
00094 tmp1--;
00095 *tmp1 = '\0';
00096 strcpy(boundary,*stquery);
00097 *tmp1 = '\n';
00098 }
00099
00100 char*
00101 findBoundary(char *inStr, char *bound, int length)
00102 {
00103 int i,j;
00104 void *tmpPtr, *tmpPtr1;
00105 j = strlen(bound);
00106 tmpPtr = (void *) inStr;
00107 while (length > 0) {
00108
00109 tmpPtr1 = memchr( tmpPtr, bound[0], length);
00110
00111 if (tmpPtr1 == NULL)
00112 return NULL;
00113 if (memcmp(tmpPtr1, (void *) bound, j) == 0)
00114 return tmpPtr1;
00115 length = length - (int) ((char *)tmpPtr1 - (char *) tmpPtr) + 1;
00116 tmpPtr = (void *) ((char *) tmpPtr1 + 1);
00117 }
00118 return NULL;
00119
00120 }
00121 int
00122 getmultipartword( entry *iEntry, char **stquery, char *boundary, int length)
00123 {
00124 char *inS, *tmp1,*tmp2, *endStr;
00125 int i,j,k;
00126
00127 if (strlen(*stquery) < (2 * strlen(boundary)))
00128 return(1);
00129
00130 if ((tmp1 = strstr((char *) *stquery,boundary)) == NULL) {
00131 webErrorExit("No Beginning Boundary Found In Field:",0);
00132 }
00133 if ((endStr = findBoundary((char *) (tmp1 + 1), boundary,length)) == NULL) {
00134 webErrorExit("No Ending Boundary Found In Field:",0);
00135 }
00136 *(endStr -2) = '\0';
00137
00138 if ((tmp2 = strstr(tmp1,"name=\"")) == NULL){
00139 webErrorExit("No Name Found In Field",0);
00140 }
00141 tmp2 += 6;
00142 tmp1 = strchr(tmp2,'\"');
00143 *tmp1 = '\0';
00144 tmp1++;
00145 strcpy(iEntry->name, tmp2);
00146 if ((int) (strstr(tmp1, "filename") != NULL &&
00147 strstr(tmp1, "filename") - tmp1) < 5) {
00148
00149 while (*tmp1 != '\n')
00150 tmp1++;
00151 tmp1++;
00152 while (*tmp1 != '\n')
00153 tmp1++;
00154 tmp1++;
00155
00156 if (strstr(iEntry->name,"filename") != NULL) {
00157 tmp1++;
00158 tmp1++;
00159 }
00160
00161 iEntry->size = (int)(endStr - tmp1 );
00162 iEntry->fstr = NULL;
00163 iEntry->val = (char *) malloc(iEntry->size);
00164 memcpy(iEntry->val, tmp1, iEntry->size);
00165 iEntry->size -= 2;
00166 }
00167 else {
00168
00169
00170
00171
00172 iEntry->val = (char *) malloc(strlen(tmp1) + 3);
00173 iEntry->fstr = NULL;
00174 strcpy(iEntry->val,tmp1);
00175 iEntry->size = strlen(iEntry->val);
00176 }
00177 *stquery = endStr;
00178
00179 return 0;
00180 }
00181 int
00182 mybgets(char inbuf[], char buffer[], int j)
00183 {
00184 char ch;
00185 int i = 0;
00186 ch = inbuf[j];
00187 j++;
00188 if (ch == '\0')
00189 {
00190 return -1;
00191 }
00192 while (ch != '\n')
00193 {
00194 buffer[i] = ch;
00195 ++i;
00196 ch = inbuf[j];
00197 j++;
00198 if (ch == '\0')
00199 {
00200 return -1;
00201 }
00202 }
00203 buffer[i] = '\0';
00204 return j;
00205 }
00206
00207
00208 char
00209 myfgets(FILE *infile, char buffer[])
00210 {
00211 char ch;
00212 int i = 0;
00213 ch = getc(infile);
00214 if (ch == EOF)
00215 {
00216 return ch;
00217 }
00218 while (ch != '\n')
00219 {
00220 buffer[i] = ch;
00221 ++i;
00222 ch = getc(infile);
00223 }
00224 buffer[i] = '\0';
00225
00226 return '1';
00227 }
00228
00229
00230
00231
00232
00233
00234 void getword(char *word, char *line, char stop) {
00235 int x = 0,y;
00236
00237 for(x=0;((line[x]) && (line[x] != stop));x++)
00238 word[x] = line[x];
00239
00240 word[x] = '\0';
00241 if(line[x]) ++x;
00242 y=0;
00243
00244 while(line[y++] = line[x++]);
00245 }
00246
00247 char *makeword(char *line, char stop) {
00248 int x = 0,y;
00249 char *word = (char *) malloc(sizeof(char) * (strlen(line) + 1));
00250
00251 for(x=0;((line[x]) && (line[x] != stop));x++)
00252 word[x] = line[x];
00253
00254 word[x] = '\0';
00255 if(line[x]) ++x;
00256 y=0;
00257
00258 while(line[y++] = line[x++]);
00259 return word;
00260 }
00261
00262 char *fmakeword(FILE *f, char stop, int *cl) {
00263 int wsize;
00264 char *word;
00265 int ll;
00266
00267 wsize = 102400;
00268 ll=0;
00269 word = (char *) malloc(sizeof(char) * (wsize + 1));
00270
00271 while(1) {
00272 word[ll] = (char)fgetc(f); printf("%c",word[ll]);
00273 if(ll==wsize) {
00274 word[ll+1] = '\0';
00275 wsize+=102400;
00276
00277 char* tmp_ch = 0;
00278 tmp_ch = (char *)realloc(word,sizeof(char)*(wsize+1));
00279 if( !tmp_ch ) {
00280 rodsLog( LOG_ERROR, "fmakeword :: realloc failed" );
00281 } else {
00282 word = tmp_ch;
00283 }
00284 }
00285 --(*cl);
00286 if((word[ll] == stop) || (feof(f)) || (!(*cl))) {
00287 if(word[ll] != stop) ll++;
00288 word[ll] = '\0';
00289 return word;
00290 }
00291 ++ll;
00292 }
00293 }
00294
00295
00296 int rind(char *s, char c) {
00297 register int x;
00298 for(x=strlen(s) - 1;x != -1; x--)
00299 if(s[x] == c) return x;
00300 return -1;
00301 }
00302
00303 int getline(char *s, int n, FILE *f) {
00304 register int i=0;
00305
00306 while(1) {
00307 s[i] = (char)fgetc(f);
00308
00309 if(s[i] == CR)
00310 s[i] = fgetc(f);
00311
00312 if((s[i] == 0x4) || (s[i] == LF) || (i == (n-1))) {
00313 s[i] = '\0';
00314 return (feof(f) ? 1 : 0);
00315 }
00316 ++i;
00317 }
00318 }
00319
00320 void send_fd(FILE *f, FILE *fd)
00321 {
00322 int num_chars=0;
00323 char c;
00324
00325 while (1) {
00326 c = fgetc(f);
00327 if(feof(f))
00328 return;
00329 fputc(c,fd);
00330 }
00331 }
00332
00333
00334
00335 int getEntries(inStruct Sentries) {
00336 register int x;
00337 char *stquery, *tmpq, *tmpStr, *tmpStr1, *tmpPtr;
00338 char reqMethod[100];
00339 int msgLength;
00340 char contentType[100];
00341 char boundary[MAX_TOKEN];
00342 int i;
00343
00344
00345 putenv("HOME=/");
00346
00347
00348 if (getenv("CONTENT_TYPE") != NULL)
00349 strcpy(contentType,getenv("CONTENT_TYPE"));
00350 else
00351 strcpy(contentType,"");
00352 if (getenv("REQUEST_METHOD") != NULL)
00353 strcpy(reqMethod,getenv("REQUEST_METHOD"));
00354 else
00355 strcpy(reqMethod,"");
00356 if (getenv("HTTP_COOKIE") != NULL)
00357 strcpy(Sentries->cookieStr,getenv("HTTP_COOKIE"));
00358
00359 else
00360 strcpy(Sentries->cookieStr,"");
00361 if (strstr(Sentries->cookieStr,"*") != NULL ||
00362 strstr(Sentries->cookieStr,"..") != NULL ||
00363 strstr(Sentries->cookieStr,"?") != NULL ||
00364 strstr(Sentries->cookieStr,"/") != NULL ||
00365 strstr(Sentries->cookieStr,"\\") != NULL ) {
00366
00367 Sentries->op = -1;
00368 return (1);
00369
00370
00371 }
00372
00373
00374 if (!strcmp(reqMethod,"POST") || !strcmp(reqMethod,"post")) {
00375 msgLength = atoi(getenv("CONTENT_LENGTH")) + 10;
00376 stquery = malloc(msgLength);
00377 if (fread(stquery, 1, msgLength, stdin) != (msgLength-10)) {
00378 webErrorExit("short fread",0);
00379 }
00380 stquery[msgLength] = '\0';
00381 }
00382 else {
00383 stquery = malloc(QSIZE);
00384 if (getenv("QUERY_STRING") != NULL)
00385 strcpy(stquery,getenv("QUERY_STRING"));
00386 else
00387 strcpy(stquery,"");
00388 }
00389
00390 if (strstr(contentType,"multipart/form-data") != NULL) {
00391
00392 i = msgLength - 10;
00393 getBoundary(&stquery, boundary);
00394
00395 for(x=0; *stquery != '\0';x++) {
00396 if (x == MAX_ENTRIES) webErrorExit("MaxEntries Exceeded",x);
00397 Sentries->m=x;
00398
00399 tmpPtr = stquery;
00400 if (getmultipartword(&Sentries->entries[x],&stquery, boundary, i) != 0)
00401 break;
00402 i -= stquery - tmpPtr;
00403
00404 }
00405 Sentries->m--;
00406 }
00407 else {
00408
00409
00410
00411 fixstr1=malloc(10);
00412 free(fixstr1);
00413
00414
00415 for(x=0; stquery[0] != '\0';x++) {
00416 if (x == MAX_ENTRIES) webErrorExit("MaxEntries Exceeded",x);
00417 Sentries->m=x;
00418 Sentries->entries[x].val = malloc(HUGE_STRING);
00419 getword(Sentries->entries[x].val,stquery,'&');
00420 plustospace(Sentries->entries[x].val);
00421 unescape_url(Sentries->entries[x].val);
00422 char* wd = (char *) makeword(Sentries->entries[x].val,'=');
00423 sprintf(Sentries->entries[x].name, wd );
00424 free( wd );
00425 }
00426 }
00427
00428 return 0;
00429
00430 }
00431
00432
00433
00434 int main(int argc, char **argv)
00435 {
00436
00437 inStruct Sentries=(paramIn*)malloc(sizeof(paramIn));
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451 getEntries(Sentries);
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489 if (!strcmp(Sentries->entries[0].val,"showRules")) {
00490 showRules(Sentries);
00491 exit(0);
00492 }
00493 else if (!strcmp(Sentries->entries[0].val,"applyRule")) {
00494 performAction(Sentries);
00495 exit(0);
00496 }
00497 exit(0);
00498 }
00499
00500 int
00501 showRules(inStruct Sentries)
00502 {
00503 int n,i,j;
00504 char ruleCondition[MAX_RULE_LENGTH];
00505 char ruleAction[MAX_RULE_LENGTH];
00506 char ruleRecovery[MAX_RULE_LENGTH];
00507 char ruleHead[MAX_ACTION_SIZE];
00508 char ruleBase[MAX_ACTION_SIZE];
00509 char *actionArray[MAX_ACTION_IN_RULE];
00510 char *recoveryArray[MAX_ACTION_IN_RULE];
00511 char configDirEV[200];
00512 char ruleSet[RULE_SET_DEF_LENGTH];
00513 char oldRuleBase[MAX_ACTION_SIZE];
00514 strcpy(ruleSet,"");
00515 strcpy(oldRuleBase,"");
00516 fprintf(stdout, "Content-type: text/html%c%c",10,10);fflush(stdout);
00517 fprintf(stdout, "<HTML>\n<HEAD>\n<TITLE>iRODS Rule Administration</TITLE>\n</HEAD>\n<BODY bgcolor=#FFFFFF>\n");
00518 fprintf(stdout, "<CENTER> <B><FONT COLOR=#FF0000>iRODS Rule Base</FONT></B></CENTER>\n");
00519 fflush(stdout);
00520
00521
00522
00523
00524
00525
00526
00527 for (i = 0; i <= Sentries->m; i++) {
00528 if (!strcmp(Sentries->entries[i].name,"ruleSet")){
00529 if (strlen(Sentries->entries[i].val) > 0) {
00530 if (ruleSet[0] != '\0')
00531 strcat(ruleSet,",");
00532 rstrcat(ruleSet,Sentries->entries[i].val,999);
00533 }
00534 }
00535 else if (!strcmp(Sentries->entries[i].name,"configDir")){
00536 if (strlen(Sentries->entries[i].val) > 0) {
00537 snprintf(configDirEV,199,"irodsConfigDir=%s",Sentries->entries[i].val);
00538 }
00539 else {
00540 sprintf(configDirEV,"irodsConfigDir=%s", MY_SERVER_CONFIG_DIR);
00541 }
00542 putenv(configDirEV);
00543 }
00544 }
00545 if (ruleSet[0] == '\0')
00546 strcpy(ruleSet,"core");
00547 fprintf(stdout, "<CENTER> <B><FONT COLOR=#0000FF>[%s]</FONT></B></CENTER>\n",ruleSet);
00548 fflush(stdout);
00549
00550 initRuleStruct(NULL, ruleSet,"core", "core");
00551 fprintf(stdout, "<TABLE>\n");
00552 for( j = 0 ; j < coreRuleStrct.MaxNumOfRules; j++) {
00553 getRule(j+1000 , ruleBase, ruleHead, ruleCondition,ruleAction,ruleRecovery, MAX_RULE_LENGTH);
00554 if (strcmp(oldRuleBase,ruleBase)) {
00555 if (strlen(oldRuleBase) > 0)
00556 fprintf(stdout,"<TR><TD COLSPAN=6><HR NOSHADE COLOR=#00FF00 SIZE=4></TD></TR>");
00557 strcpy(oldRuleBase,ruleBase);
00558 }
00559 n = getActionRecoveryList(ruleAction,ruleRecovery,actionArray,recoveryArray);
00560 fprintf(stdout, "<TR><TD><BR> %i</TD><TD><BR> <FONT COLOR=#0000FF>ON</FONT></TD><TD COLSPAN=3><BR> <FONT COLOR=#FF0000>%s.</FONT><FONT COLOR=#0000FF>%s</FONT></TD></TR>\n",j,ruleBase, ruleHead);
00561 if (strlen(ruleCondition)!= 0)
00562 fprintf(stdout, "<TR><TD></TD><TD></TD><TD VALIGN=TOP>IF </TD><TD COLSPAN=3 VALIGN=TOP><FONT COLOR=#FF0000>%s</FONT></TD></TR>\n",ruleCondition);
00563 for (i = 0; i < n; i++) {
00564 if (i == 0)
00565 fprintf(stdout, "<TR><TD></TD><TD></TD><TD VALIGN=TOP>DO </TD><TD VALIGN=TOP>%s</TD><TD NOWRAP> </TD><TD VALIGN=TOP>[%s]</TD></TR>\n",
00566 actionArray[i],recoveryArray[i]);
00567 else
00568 fprintf(stdout, "<TR><TD></TD><TD></TD><TD VALIGN=TOP>AND </TD><TD VALIGN=TOP>%s</TD><TD NOWRAP> </TD><TD VALIGN=TOP>[%s]</TD></TR>\n",
00569 actionArray[i],recoveryArray[i]);
00570 }
00571 }
00572 fprintf(stdout, "</TABLE>\n");
00573 fprintf(stdout, "</BODY>\n</HTML>\n");
00574 return(0);
00575 }
00576
00577 int
00578 performAction(inStruct Sentries)
00579 {
00580 int status;
00581 int c,i,j;
00582 int uFlag = 0;;
00583 char tmpStr[100];
00584 ruleExecInfo_t rei;
00585 char action[100];
00586 char *t1;
00587 char *args[MAX_NUM_OF_ARGS_IN_ACTION];
00588 char configDirEV[200];
00589 char retestflagEV[200];
00590 char reloopbackflagEV[200];
00591
00592 char ruleSet[RULE_SET_DEF_LENGTH];
00593 hrtime_t ht1, ht2, ht3;
00594
00595 bzero (&rei, sizeof (ruleExecInfo_t));
00596
00597
00598
00599
00600
00601 sprintf(retestflagEV,"RETESTFLAG=%i",HTML_TEST_1);
00602 putenv(retestflagEV);
00603 sprintf(reloopbackflagEV,"RELOOPBACKFLAG=%i",LOOP_BACK_1);
00604 putenv(reloopbackflagEV);
00605
00606 fprintf(stdout, "Content-type: text/html%c%c",10,10);fflush(stdout);
00607 fprintf(stdout, "<HTML>\n<HEAD>\n<TITLE>iRODS Rule Administration</TITLE>\n</HEAD>\n<BODY bgcolor=#FFFFFF>\n");
00608 fprintf(stdout, "<CENTER> <B><FONT COLOR=#FF0000>iRODS Rule Application</FONT></B></CENTER>\n");
00609 fflush(stdout);
00610
00611 rei.doi = mallocAndZero(sizeof(dataObjInfo_t));
00612 rei.uoip = mallocAndZero(sizeof(userInfo_t));
00613 rei.uoic = mallocAndZero(sizeof(userInfo_t));
00614 rei.coi = mallocAndZero(sizeof(collInfo_t));
00615 rei.uoio = mallocAndZero(sizeof(userInfo_t));
00616 rei.rgi->rescInfo = mallocAndZero(sizeof(rescInfo_t));
00617 rei.next = NULL;
00618
00619 strcpy(rei.doi->objPath,"");
00620 strcpy(rei.doi->rescName,"");
00621 strcpy(rei.doi->dataType,"");
00622 strcpy(rei.uoic->authInfo.host,"");
00623 rei.doi->dataSize = 100;
00624
00625
00626 rei.condInputData = NULL;
00627
00628 rei.rsComm = NULL;
00629 strcpy(ruleSet,"");
00630
00631 for (i = 0; i <= Sentries->m; i++) {
00632
00633 if (!strcmp(Sentries->entries[i].name,"action")) {
00634 strcpy(action,Sentries->entries[i].val);
00635 fprintf(stdout,"<FONT COLOR=#0000FF>Action:</FONT> <FONT COLOR=#FF0000>%s</FONT><BR>\n",
00636 Sentries->entries[i].val);
00637 }
00638 else if (!strcmp(Sentries->entries[i].name,"objPath")) {
00639 strcpy(rei.doi->objPath,Sentries->entries[i].val);
00640 fprintf(stdout,"<FONT COLOR=#0000FF>$objPath:</FONT> <FONT COLOR=#FF0000>%s</FONT><BR>\n",
00641 Sentries->entries[i].val);
00642 }
00643 else if (!strcmp(Sentries->entries[i].name,"rescName")) {
00644 strcpy(rei.doi->rescName,Sentries->entries[i].val);
00645 fprintf(stdout,"<FONT COLOR=#0000FF>$rescName:</FONT> <FONT COLOR=#FF0000>%s</FONT><BR>\n",
00646 Sentries->entries[i].val);
00647 }
00648 else if (!strcmp(Sentries->entries[i].name,"dataSize")){
00649 rei.doi->dataSize = atol(Sentries->entries[i].val);
00650 fprintf(stdout,"<FONT COLOR=#0000FF>$dataSize:</FONT> <FONT COLOR=#FF0000>%s</FONT><BR>\n",
00651 Sentries->entries[i].val);
00652 }
00653 else if (!strcmp(Sentries->entries[i].name,"dataType")){
00654 strcpy(rei.doi->dataType,Sentries->entries[i].val);
00655 fprintf(stdout,"<FONT COLOR=#0000FF>$dataType:</FONT> <FONT COLOR=#FF0000>%s</FONT><BR>\n",
00656 Sentries->entries[i].val);
00657 }
00658 else if (!strcmp(Sentries->entries[i].name,"dataOwner")){
00659 strcpy(rei.doi->dataOwnerName,Sentries->entries[i].val);
00660 if ((t1 = strstr(rei.doi->dataOwnerName,"|")) != NULL) {
00661 *t1 = '\0';
00662 strcpy(rei.doi->dataOwnerZone, (char *) (t1 + 1));
00663 }
00664 else
00665 strcpy(rei.doi->dataOwnerZone,"");
00666 fprintf(stdout,"<FONT COLOR=#0000FF>$dataOwner:</FONT> <FONT COLOR=#FF0000>%s</FONT><BR>\n",
00667 Sentries->entries[i].val);
00668 }
00669 else if (!strcmp(Sentries->entries[i].name,"dataUser")){
00670 strcpy(rei.uoic->userName,Sentries->entries[i].val);
00671 if ((t1 = strstr(rei.uoic->userName,"|")) != NULL) {
00672 *t1 = '\0';
00673 strcpy(rei.uoic->rodsZone, (char *) (t1 + 1));
00674 }
00675 else
00676 strcpy(rei.uoic->rodsZone,"");
00677 fprintf(stdout,"<FONT COLOR=#0000FF>$dataUser:</FONT> <FONT COLOR=#FF0000>%s</FONT><BR>\n",
00678 Sentries->entries[i].val);
00679 }
00680 else if (!strcmp(Sentries->entries[i].name,"dataAccess")){
00681 strcpy(rei.doi->dataAccess,Sentries->entries[i].val);
00682 fprintf(stdout,"<FONT COLOR=#0000FF>$dataAccess:</FONT> <FONT COLOR=#FF0000>%s</FONT><BR>\n",
00683 Sentries->entries[i].val);
00684 }
00685 else if (!strcmp(Sentries->entries[i].name,"hostClient")){
00686 strcpy(rei.uoic->authInfo.host,Sentries->entries[i].val);
00687 fprintf(stdout,"<FONT COLOR=#0000FF>$hostClient:</FONT> <FONT COLOR=#FF0000>%s</FONT><BR>\n",
00688 Sentries->entries[i].val);
00689 }
00690 else if (!strcmp(Sentries->entries[i].name,"proxyUser")){
00691 strcpy(rei.uoip->userName,Sentries->entries[i].val);
00692 if ((t1 = strstr(rei.uoip->userName,"|")) != NULL) {
00693 *t1 = '\0';
00694 strcpy(rei.uoip->rodsZone, (char *) (t1 + 1));
00695 }
00696 else
00697 strcpy(rei.uoio->rodsZone,"");
00698 fprintf(stdout,"<FONT COLOR=#0000FF>$otherUser:</FONT> <FONT COLOR=#FF0000>%s</FONT><BR>\n",
00699 Sentries->entries[i].val);
00700 }
00701 else if (!strcmp(Sentries->entries[i].name,"otherUser")){
00702 strcpy(rei.uoic->userName,Sentries->entries[i].val);
00703 if ((t1 = strstr(rei.uoio->userName,"|")) != NULL) {
00704 *t1 = '\0';
00705 strcpy(rei.uoio->rodsZone, (char *) (t1 + 1));
00706 }
00707 else
00708 strcpy(rei.uoio->rodsZone,"");
00709 fprintf(stdout,"<FONT COLOR=#0000FF>$otherUser:</FONT> <FONT COLOR=#FF0000>%s</FONT><BR>\n",
00710 Sentries->entries[i].val);
00711 }
00712 else if (!strcmp(Sentries->entries[i].name,"otherUserType")){
00713 strcpy(rei.uoio->userType,Sentries->entries[i].val);
00714 fprintf(stdout,"<FONT COLOR=#0000FF>$otherUserType:</FONT> <FONT COLOR=#FF0000>%s</FONT><BR>\n",
00715 Sentries->entries[i].val);
00716 }
00717 else if (!strcmp(Sentries->entries[i].name,"ruleSet")){
00718 if (strlen(Sentries->entries[i].val) > 0) {
00719 if (ruleSet[0] != '\0')
00720 strcat(ruleSet,",");
00721 rstrcat(ruleSet,Sentries->entries[i].val,999);
00722 }
00723 }
00724 else if (!strcmp(Sentries->entries[i].name,"retestflag")){
00725 sprintf(retestflagEV,"RETESTFLAG=%s",Sentries->entries[i].val);
00726 putenv(retestflagEV);
00727 fprintf(stdout,"<FONT COLOR=#0000FF>Trace Status</FONT> <FONT COLOR=#FF0000>%s</FONT><BR>\n",
00728 Sentries->entries[i].val);
00729 }
00730 else if (!strcmp(Sentries->entries[i].name,"configDir")){
00731 if (strlen(Sentries->entries[i].val) > 0) {
00732 snprintf(configDirEV,199,"irodsConfigDir=%s",Sentries->entries[i].val);
00733 }
00734 else {
00735 sprintf(configDirEV,"irodsConfigDir=%s", MY_SERVER_CONFIG_DIR);
00736 }
00737 putenv(configDirEV);
00738 }
00739
00740
00741
00742
00743
00744
00745
00746
00747 }
00748 fprintf(stdout,"<FONT COLOR=#0000FF>Rule Set:</FONT> <FONT COLOR=#FF0000>%s</FONT><BR><HR>\n",ruleSet);
00749 strcpy(rei.ruleSet,ruleSet);
00750
00751 ht1 = gethrtime();
00752 initRuleStruct( NULL, ruleSet, "core", "core");
00753 ht2 = gethrtime();
00754
00755 i = applyRuleArgPA(action, args, 0, NULL,&rei, SAVE_REI);
00756 ht3 = gethrtime();
00757
00758 if (reTestFlag == COMMAND_TEST_1|| reTestFlag == COMMAND_TEST_MSI) {
00759 fprintf(stdout,"Rule Initialization Time = %.2f millisecs\n", (float) (ht2 - ht1)/1000000);
00760 fprintf(stdout,"Rule Execution Time = %.2f millisecs\n", (float) (ht3-ht1)/1000000);
00761 }
00762 if (reTestFlag == HTML_TEST_1 || reTestFlag == HTML_TEST_MSI) {
00763 fprintf(stdout,"<BR>Rule Initialization Time = %.2f millisecs<BR>\n", (float) (ht2 - ht1)/1000000);
00764 fprintf(stdout,"Rule Execution Time = %.2f millisecs<BR>\n", (float) (ht3-ht1)/1000000);
00765 }
00766
00767 if (i != 0) {
00768 rodsLogError(LOG_ERROR,i,"<BR>Rule Application Failed:");
00769
00770 return(-1);
00771 }
00772
00773
00774 return(0);
00775 }
00776