Check-in [134f5b374e]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:For cloning and syncing, give all users the privileges of both "nobody" and "anonymous" without requiring a login message. Ticket [1318677c15af04480b].
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 134f5b374efa20b6055fc7dca9da108ceef653a7
User & Date: drh 2010-11-09 10:44:26.000
Context
2010-11-09
10:48
Do not use a subdirectory named "obj" for building. Ticket [6e51013097c17ead]. check-in: e663bac6f7 user: drh tags: trunk
10:44
For cloning and syncing, give all users the privileges of both "nobody" and "anonymous" without requiring a login message. Ticket [1318677c15af04480b]. check-in: 134f5b374e user: drh tags: trunk
08:59
fix [e49f245975f89a8a9c006ec224eed48c8ad77593] by adding -nocgi option check-in: 1b883d49cf user: ron tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/login.c.
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
void login_set_anon_nobody_capabilities(void){
  static int once = 1;
  if( g.zLogin && once ){
    const char *zCap;
    /* All logged-in users inherit privileges from "nobody" */
    zCap = db_text("", "SELECT cap FROM user WHERE login = 'nobody'");
    login_set_capabilities(zCap);
    if( strcmp(g.zLogin, "anonymous")!=0 ){
      /* All logged-in users inherit privileges from "anonymous" */
      zCap = db_text("", "SELECT cap FROM user WHERE login = 'anonymous'");
      login_set_capabilities(zCap);
    }
    once = 0;
  }
}







|







456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
void login_set_anon_nobody_capabilities(void){
  static int once = 1;
  if( g.zLogin && once ){
    const char *zCap;
    /* All logged-in users inherit privileges from "nobody" */
    zCap = db_text("", "SELECT cap FROM user WHERE login = 'nobody'");
    login_set_capabilities(zCap);
    if( strcmp(g.zLogin, "nobody")!=0 ){
      /* All logged-in users inherit privileges from "anonymous" */
      zCap = db_text("", "SELECT cap FROM user WHERE login = 'anonymous'");
      login_set_capabilities(zCap);
    }
    once = 0;
  }
}
Changes to src/xfer.c.
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
      g.zNonce = mprintf("%b", pNonce);
      if( g.fHttpTrace ){
        fprintf(stderr, "# login [%s] with capabilities [%s]\n", g.zLogin,zCap);
      }
    }
  }
  db_finalize(&q);

  if( rc==0 ){
    /* If the login was successful. */
    login_set_anon_nobody_capabilities();
  }
  return rc;
}

/*
** Send the content of all files in the unsent table.
**
** This is really just an optimization.  If you clear the







<
<
<
<
<







452
453
454
455
456
457
458





459
460
461
462
463
464
465
      g.zNonce = mprintf("%b", pNonce);
      if( g.fHttpTrace ){
        fprintf(stderr, "# login [%s] with capabilities [%s]\n", g.zLogin,zCap);
      }
    }
  }
  db_finalize(&q);





  return rc;
}

/*
** Send the content of all files in the unsent table.
**
** This is really just an optimization.  If you clear the
629
630
631
632
633
634
635


636
637
638
639
640
641
642
  int size;
  int recvConfig = 0;
  char *zNow;

  if( strcmp(PD("REQUEST_METHOD","POST"),"POST") ){
     fossil_redirect_home();
  }


  memset(&xfer, 0, sizeof(xfer));
  blobarray_zero(xfer.aToken, count(xfer.aToken));
  cgi_set_content_type(g.zContentType);
  blob_zero(&xfer.err);
  xfer.pIn = &g.cgiIn;
  xfer.pOut = cgi_output_blob();
  xfer.mxSend = db_get_int("max-download", 20000000);







>
>







624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
  int size;
  int recvConfig = 0;
  char *zNow;

  if( strcmp(PD("REQUEST_METHOD","POST"),"POST") ){
     fossil_redirect_home();
  }
  g.zLogin = "anonymous";
  login_set_anon_nobody_capabilities();
  memset(&xfer, 0, sizeof(xfer));
  blobarray_zero(xfer.aToken, count(xfer.aToken));
  cgi_set_content_type(g.zContentType);
  blob_zero(&xfer.err);
  xfer.pIn = &g.cgiIn;
  xfer.pOut = cgi_output_blob();
  xfer.mxSend = db_get_int("max-download", 20000000);