[BACK]Return to cgi.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/cgi.c between version 1.24 and 1.25

version 1.24, 2011/12/10 21:51:07 version 1.25, 2011/12/10 22:20:59
Line 491  resp_search(struct res *r, size_t sz, void *arg)
Line 491  resp_search(struct res *r, size_t sz, void *arg)
                        "<TD CLASS=\"title\">\n"                         "<TD CLASS=\"title\">\n"
                        "<A HREF=\"");                         "<A HREF=\"");
                 html_print(progname);                  html_print(progname);
                 printf("/show/%u/%u.html\">", r[i].volume, r[i].rec);                  printf("/show/0/%u/%u.html\">", r[i].volume, r[i].rec);
                 html_print(r[i].title);                  html_print(r[i].title);
                 putchar('(');                  putchar('(');
                 html_print(r[i].cat);                  html_print(r[i].cat);
Line 719  pg_show(const struct req *req, char *path)
Line 719  pg_show(const struct req *req, char *path)
         char             file[MAXPATHLEN];          char             file[MAXPATHLEN];
         const char      *fn, *cp;          const char      *fn, *cp;
         int              rc;          int              rc;
         unsigned int     vol, rec;          unsigned int     vol, rec, mr;
         DB              *idx;          DB              *idx;
         DBT              key, val;          DBT              key, val;
   
         idx = NULL;          idx = NULL;
   
         if (0 == req->psz || NULL == path) {          /* Parse out mroot, volume, and record from the path. */
   
           if (NULL == path || NULL == (sub = strchr(path, '/'))) {
                 resp_error400();                  resp_error400();
                 return;                  return;
         } else if (NULL == (sub = strrchr(path, '/'))) {          }
           *sub++ = '\0';
           if ( ! atou(path, &mr)) {
                 resp_error400();                  resp_error400();
                 return;                  return;
         } else          }
                 *sub++ = '\0';          path = sub;
           if (NULL == (sub = strchr(path, '/'))) {
                   resp_error400();
                   return;
           }
           *sub++ = '\0';
           if ( ! atou(path, &vol) || ! atou(sub, &rec)) {
                   resp_error400();
                   return;
           } else if (mr >= (unsigned int)req->psz) {
                   resp_error400();
                   return;
           }
   
         /*          /*
          * Begin by chdir()ing into the root of the manpath.           * Begin by chdir()ing into the root of the manpath.
Line 740  pg_show(const struct req *req, char *path)
Line 756  pg_show(const struct req *req, char *path)
          * relative to the manpath root.           * relative to the manpath root.
          */           */
   
         if (-1 == chdir(req->p[0].path)) {          if (-1 == chdir(req->p[(int)mr].path)) {
                 perror(req->p[0].path);                  perror(req->p[(int)mr].path);
                 resp_error400();                  resp_baddb();
                 return;                  return;
         }          }
   
         memset(&ps, 0, sizeof(struct manpaths));          memset(&ps, 0, sizeof(struct manpaths));
         manpath_manconf("etc/catman.conf", &ps);          manpath_manconf("etc/catman.conf", &ps);
   
         if ( ! (atou(path, &vol) && atou(sub, &rec))) {          if (vol >= (unsigned int)ps.sz) {
                 resp_error400();  
                 goto out;  
         } else if (vol >= (unsigned int)ps.sz) {  
                 resp_error400();                  resp_error400();
                 goto out;                  goto out;
         }          }

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

CVSweb