Changeset 1268


Ignore:
Timestamp:
2000-07-04T14:15:22+12:00 (24 years ago)
Author:
sjboddie
Message:

fixed bug causing segmentation fault when an invalid collection
was supplied as the "c" cgi argument

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/receptionist.cpp

    r1193 r1268  
    2828/*
    2929   $Log$
     30   Revision 1.52  2000/07/04 02:15:22  sjboddie
     31   fixed bug causing segmentation fault when an invalid collection
     32   was supplied as the "c" cgi argument
     33
    3034   Revision 1.51  2000/05/28 09:15:34  sjboddie
    3135   a few small changes to get an initial release of the local library
     
    11141118
    11151119    text_t &arg_c = args["c"];
    1116     ColInfoResponse_t cinfo;
    1117     comerror_t err;
    11181120    recptproto *collectproto = protocols.getrecptproto (arg_c, logout);
    1119     collectproto->get_collectinfo (arg_c, cinfo, err, logout);
    1120 
    1121     if (!cinfo.ccsCols.empty()) {
    1122       args["ccs"] = 1;
    1123       if (args["cc"].empty()) {
    1124     text_tarray::const_iterator col_here = cinfo.ccsCols.begin();
    1125     text_tarray::const_iterator col_end = cinfo.ccsCols.end();
    1126     bool first = true;
    1127     while (col_here != col_end) {
    1128       // make sure it's a valid collection
    1129       if (protocols.getrecptproto (*col_here, logout) != NULL) {
    1130         if (!first) args["cc"].push_back (',');
    1131         args["cc"] += *col_here;
    1132         first = false;
     1121    if (collectproto == NULL) {
     1122      // oops, this collection isn't valid
     1123      outconvertclass text_t2ascii;
     1124      logout << text_t2ascii << "ERROR: Invalid collection: " << arg_c << "\n";
     1125      args["c"].clear();
     1126
     1127    } else {
     1128      ColInfoResponse_t cinfo;
     1129      comerror_t err;
     1130
     1131      collectproto->get_collectinfo (arg_c, cinfo, err, logout);
     1132
     1133      if (!cinfo.ccsCols.empty()) {
     1134    args["ccs"] = 1;
     1135    if (args["cc"].empty()) {
     1136      text_tarray::const_iterator col_here = cinfo.ccsCols.begin();
     1137      text_tarray::const_iterator col_end = cinfo.ccsCols.end();
     1138      bool first = true;
     1139      while (col_here != col_end) {
     1140        // make sure it's a valid collection
     1141        if (protocols.getrecptproto (*col_here, logout) != NULL) {
     1142          if (!first) args["cc"].push_back (',');
     1143          args["cc"] += *col_here;
     1144          first = false;
     1145        }
     1146        col_here ++;
    11331147      }
    1134       col_here ++;
    11351148    }
    11361149      }
Note: See TracChangeset for help on using the changeset viewer.