Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | docker experiment: create project-code at first valid push. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | docker |
| Files: | files | file ages | folders |
| SHA1: |
98e3626c0a1229e7deabe3a9e98610fa |
| User & Date: | jan.nijtmans 2014-10-02 15:26:44.295 |
Context
|
2014-10-03
| ||
| 11:20 | Merge trunk. Further experimenting. With this I can log in as anonymous but not yet as admin. check-in: dc87b66438 user: jan.nijtmans tags: docker | |
|
2014-10-02
| ||
| 15:26 | docker experiment: create project-code at first valid push. check-in: 98e3626c0a user: jan.nijtmans tags: docker | |
| 13:45 | After testing in a real docker container, it turns out that "db_optional_sql()" doesn't do anything here. No idea why, but "db_multi_exec()" works fine. check-in: 06987be586 user: jan.nijtmans tags: trunk | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
1333 1334 1335 1336 1337 1338 1339 |
}else{
if( db_get("server-code", 0)==0 ) {
db_multi_exec(
"INSERT INTO config(name,value,mtime)"
" VALUES('server-code', lower(hex(randomblob(20))),now());"
);
}
| < < < < < < | 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 |
}else{
if( db_get("server-code", 0)==0 ) {
db_multi_exec(
"INSERT INTO config(name,value,mtime)"
" VALUES('server-code', lower(hex(randomblob(20))),now());"
);
}
}
}
/*
** Return a pointer to a string that contains the RHS of an IN operator
** that will select CONFIG table names that are in the list of control
** settings.
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
1063 1064 1065 1066 1067 1068 1069 |
}else
/* pull SERVERCODE PROJECTCODE
** push SERVERCODE PROJECTCODE
**
** The client wants either send or receive. The server should
| | > > > > > > | | | < | 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 |
}else
/* pull SERVERCODE PROJECTCODE
** push SERVERCODE PROJECTCODE
**
** The client wants either send or receive. The server should
** verify that the project code matches. If there is no project
** code yet, set the new project code to the provided one.
*/
if( xfer.nToken==3
&& (blob_eq(&xfer.aToken[0], "pull") || blob_eq(&xfer.aToken[0], "push"))
&& blob_is_uuid(&xfer.aToken[1])
&& blob_is_uuid(&xfer.aToken[2])
){
const char *zPCode;
zPCode = db_get("project-code", 0);
login_check_credentials();
if( zPCode==0 ){
if( g.perm.Write ){
db_set("project-code", blob_str(&xfer.aToken[2]), 0);
zPCode = db_get("project-code", 0);
}else{
fossil_panic("missing project code");
}
} else if( !blob_eq_str(&xfer.aToken[2], zPCode, -1) ){
cgi_reset_content();
@ error wrong\sproject
nErr++;
break;
}
if( blob_eq(&xfer.aToken[0], "pull") ){
if( !g.perm.Read ){
cgi_reset_content();
@ error not\sauthorized\sto\sread
nErr++;
break;
}
|
| ︙ | ︙ |