Fossil SCM
With this (dirty) hack, non-anonymous users can login in a docker-packed fossil image as well.
Commit
aaa7aeda8642722904a7b00ee06d2e2fad274382
Parent
dc87b66438d45fe…
2 files changed
+1
-1
+7
-2
+1
-1
| --- Dockerfile | ||
| +++ Dockerfile | ||
| @@ -7,11 +7,11 @@ | ||
| 7 | 7 | # RUN yum update -y && yum clean all |
| 8 | 8 | RUN yum install -y gcc make zlib-devel openssl-devel tcl-devel && yum clean all |
| 9 | 9 | RUN groupadd -r fossil -g 433 && useradd -u 431 -r -g fossil -d /opt/fossil -s /sbin/nologin -c "Fossil user" fossil |
| 10 | 10 | |
| 11 | 11 | ### If you want to build "release", change the next line accordingly. |
| 12 | -ENV FOSSIL_INSTALL_VERSION trunk | |
| 12 | +ENV FOSSIL_INSTALL_VERSION docker | |
| 13 | 13 | |
| 14 | 14 | RUN curl "http://www.fossil-scm.org/index.html/tarball/fossil-src.tar.gz?name=fossil-src&uuid=${FOSSIL_INSTALL_VERSION}" | tar zx |
| 15 | 15 | RUN cd fossil-src && ./configure --lineedit=0 --json --with-tcl --with-tcl-stubs --with-tcl-private-stubs && make; |
| 16 | 16 | RUN cp fossil-src/fossil /usr/bin |
| 17 | 17 | RUN rm -rf fossil-src |
| 18 | 18 |
| --- Dockerfile | |
| +++ Dockerfile | |
| @@ -7,11 +7,11 @@ | |
| 7 | # RUN yum update -y && yum clean all |
| 8 | RUN yum install -y gcc make zlib-devel openssl-devel tcl-devel && yum clean all |
| 9 | RUN groupadd -r fossil -g 433 && useradd -u 431 -r -g fossil -d /opt/fossil -s /sbin/nologin -c "Fossil user" fossil |
| 10 | |
| 11 | ### If you want to build "release", change the next line accordingly. |
| 12 | ENV FOSSIL_INSTALL_VERSION trunk |
| 13 | |
| 14 | RUN curl "http://www.fossil-scm.org/index.html/tarball/fossil-src.tar.gz?name=fossil-src&uuid=${FOSSIL_INSTALL_VERSION}" | tar zx |
| 15 | RUN cd fossil-src && ./configure --lineedit=0 --json --with-tcl --with-tcl-stubs --with-tcl-private-stubs && make; |
| 16 | RUN cp fossil-src/fossil /usr/bin |
| 17 | RUN rm -rf fossil-src |
| 18 |
| --- Dockerfile | |
| +++ Dockerfile | |
| @@ -7,11 +7,11 @@ | |
| 7 | # RUN yum update -y && yum clean all |
| 8 | RUN yum install -y gcc make zlib-devel openssl-devel tcl-devel && yum clean all |
| 9 | RUN groupadd -r fossil -g 433 && useradd -u 431 -r -g fossil -d /opt/fossil -s /sbin/nologin -c "Fossil user" fossil |
| 10 | |
| 11 | ### If you want to build "release", change the next line accordingly. |
| 12 | ENV FOSSIL_INSTALL_VERSION docker |
| 13 | |
| 14 | RUN curl "http://www.fossil-scm.org/index.html/tarball/fossil-src.tar.gz?name=fossil-src&uuid=${FOSSIL_INSTALL_VERSION}" | tar zx |
| 15 | RUN cd fossil-src && ./configure --lineedit=0 --json --with-tcl --with-tcl-stubs --with-tcl-private-stubs && make; |
| 16 | RUN cp fossil-src/fossil /usr/bin |
| 17 | RUN rm -rf fossil-src |
| 18 |
+7
-2
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -236,12 +236,17 @@ | ||
| 236 | 236 | ** |
| 237 | 237 | ** The returned memory should be free()d after use. |
| 238 | 238 | */ |
| 239 | 239 | char *login_gen_user_cookie_value(const char *zUsername, const char *zHash){ |
| 240 | 240 | char *zProjCode = db_get("project-code",NULL); |
| 241 | - char *zCode = abbreviated_project_code(zProjCode); | |
| 242 | - free(zProjCode); | |
| 241 | + char *zCode; | |
| 242 | + if( zProjCode ){ | |
| 243 | + zCode = abbreviated_project_code(zProjCode); | |
| 244 | + free(zProjCode); | |
| 245 | + }else{ | |
| 246 | + zCode = abbreviated_project_code("0123456789abcdef"); | |
| 247 | + } | |
| 243 | 248 | assert((zUsername && *zUsername) && "Invalid user data."); |
| 244 | 249 | return mprintf("%s/%z/%s", zHash, zCode, zUsername); |
| 245 | 250 | } |
| 246 | 251 | |
| 247 | 252 | /* |
| 248 | 253 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -236,12 +236,17 @@ | |
| 236 | ** |
| 237 | ** The returned memory should be free()d after use. |
| 238 | */ |
| 239 | char *login_gen_user_cookie_value(const char *zUsername, const char *zHash){ |
| 240 | char *zProjCode = db_get("project-code",NULL); |
| 241 | char *zCode = abbreviated_project_code(zProjCode); |
| 242 | free(zProjCode); |
| 243 | assert((zUsername && *zUsername) && "Invalid user data."); |
| 244 | return mprintf("%s/%z/%s", zHash, zCode, zUsername); |
| 245 | } |
| 246 | |
| 247 | /* |
| 248 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -236,12 +236,17 @@ | |
| 236 | ** |
| 237 | ** The returned memory should be free()d after use. |
| 238 | */ |
| 239 | char *login_gen_user_cookie_value(const char *zUsername, const char *zHash){ |
| 240 | char *zProjCode = db_get("project-code",NULL); |
| 241 | char *zCode; |
| 242 | if( zProjCode ){ |
| 243 | zCode = abbreviated_project_code(zProjCode); |
| 244 | free(zProjCode); |
| 245 | }else{ |
| 246 | zCode = abbreviated_project_code("0123456789abcdef"); |
| 247 | } |
| 248 | assert((zUsername && *zUsername) && "Invalid user data."); |
| 249 | return mprintf("%s/%z/%s", zHash, zCode, zUsername); |
| 250 | } |
| 251 | |
| 252 | /* |
| 253 |