catalinux / rgfs (public) (License: GPLv3) (since 2020-11-11) (hash sha1)
Allows mapping of RocketGit storage area into a local directory
List of commits:
Subject Hash Author Date (UTC)
Simplified variables sent 0f37c2cd6342c8be0f4615c8fe8979d1bb9cce8d Catalin(ux) M. BOIE 2021-01-14 04:48:11
Added job_id variable 9ab34e796d0f5494d97d1b9f9fff52e6a9f27e8c Catalin(ux) M. BOIE 2020-12-04 17:30:10
Create a function to send generic vars and use it 97fa7f7a9f4af7c9e7bf3579d1437dfc59c29825 Catalin(ux) M. BOIE 2020-11-30 17:45:17
Wrong lenght passed c642d9387496543f4fb824fad6cd2590328d83b4 Catalin(ux) M. BOIE 2020-11-30 17:33:08
Allow sending repo_id 160f9d2f3957ba5639377e8d5bdc15744dac78a2 Catalin(ux) M. BOIE 2020-11-30 13:36:55
More debugging 1b562b79df09000cb40d2e91aa069636e9fd5e55 Catalin(ux) M. BOIE 2020-11-27 07:04:43
Added support for uid and head 2c9ae749a048d990ce24aa389439056c8ab0e836 Catalin(ux) M. BOIE 2020-11-27 06:29:37
Added chmod 82a9f7db95a0327bd0d97a58a27ce6432fdf6790 Catalin(ux) M. BOIE 2020-11-16 18:53:49
implemented chown d3862312d2900e96957c0734b5f27d0851d2a19a Catalin(ux) M. BOIE 2020-11-16 18:31:35
Lots of improvements 4953574e14ffba41e05e897fb94771f0ac7bab44 Catalin(ux) M. BOIE 2020-11-15 16:46:04
Allow verbose debug cee91423dda669c580b84451d3b846b3e7ef3038 Catalin(ux) M. BOIE 2020-11-15 12:11:04
Small bug caused by an old way to pack path ad3501ea5b7b112f0760f5aca247275e974edaff Catalin(ux) M. BOIE 2020-11-15 11:59:55
Lots of improvements 9275d4bc7be78518ac7bd2c3aa9cfb946a2969ad Catalin(ux) M. BOIE 2020-11-15 10:40:44
Lots of cleanups 2998ff2dcb74565887986fb7167e65e4fdf6d173 Catalin(ux) M. BOIE 2020-11-14 19:23:09
added utimens b5c24acf3ff86a51a7a49fec1eaf8eb65ae77bbb Catalin(ux) M. BOIE 2020-11-14 16:09:29
Improved debug f9bdf71667d0c77d4fcb4fa6e7792fd2d4c60712 Catalin(ux) M. BOIE 2020-11-13 18:57:48
Allow pushing a name and a repo id 9b48c3ae2a059a1ecd84caf44cea6c551175dd46 Catalin(ux) M. BOIE 2020-11-12 16:14:02
Send also the pkg_repo_id parameter 866c8063866effdabe0aa76fcfb9cc2b3d61b67a Catalin(ux) M. BOIE 2020-11-12 07:54:07
Now we can pass parameters by env 8352d8d09714a3c2af7550ad55517bfa8590a309 Catalin(ux) M. BOIE 2020-11-12 04:48:19
Inistial commit e51779259596117c80f6e7961f4387fdd48f820a Catalin(ux) M. BOIE 2020-11-11 08:18:38
Commit 0f37c2cd6342c8be0f4615c8fe8979d1bb9cce8d - Simplified variables sent
Author: Catalin(ux) M. BOIE
Author date (UTC): 2021-01-14 04:48
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2021-01-14 04:48
Parent(s): 9ab34e796d0f5494d97d1b9f9fff52e6a9f27e8c
Signing key:
Tree: cf475147fd16d46822564579adb1cf74c2cd4a0b
File Lines added Lines deleted
rgfs.c 36 51
rgfs_config.h.in 1 1
File rgfs.c changed (mode: 100644) (index b6c9e23..0040171)
25 25
26 26 // a way to distinguish between clients // a way to distinguish between clients
27 27 static char *rgfs_name = "unk"; static char *rgfs_name = "unk";
28 static unsigned int rgfs_pkg_repo_id = 0;
28 static char *rgfs_pkg_repo_id = "";
29 static char *rgfs_pkg_subrepo_id = "";
29 30 static char *rgfs_key = ""; static char *rgfs_key = "";
30 31 static int rgfs_port = 443; static int rgfs_port = 443;
31 32 static char *rgfs_server = "rgfs.rocketgit.com"; static char *rgfs_server = "rgfs.rocketgit.com";
 
... ... static ssize_t rgfs_send(const char *op, const void *buf, size_t buf_len)
97 98
98 99 if (rgfs_debug > 10) { if (rgfs_debug > 10) {
99 100 char debug[4096 * 2 + 1]; char debug[4096 * 2 + 1];
100 short max = buf_len > 4096 ? 4096 : buf_len;
101 for (unsigned int i = 0; i < max; i++)
101
102 uint16_t max = buf_len > 4096 ? 4096 : buf_len;
103 for (uint16_t i = 0; i < max; i++)
102 104 sprintf(debug + i * 2, "%02hhx", * (unsigned char *) (buf + i)); sprintf(debug + i * 2, "%02hhx", * (unsigned char *) (buf + i));
103 105 xlog(" %s: SEND %u: %s\n", op, buf_len, debug); xlog(" %s: SEND %u: %s\n", op, buf_len, debug);
104 106 } }
 
... ... static int rgfs_tls(void)
227 229 int r, ret = -1, off; int r, ret = -1, off;
228 230 char buf[8192], *desc; char buf[8192], *desc;
229 231 int type; int type;
230 unsigned status, len;
232 unsigned status;
231 233
232 234 do { do {
233 235 /* Destroy session */ /* Destroy session */
 
... ... static int rgfs_tls(void)
328 330 break; break;
329 331 } }
330 332
331 xlog("Sending version...\n");
332 buf[0] = 0x01; // type=SEND_VERSION
333 buf[1] = 0; // len H
334 buf[2] = 1; // len L
335 buf[3] = RGFS_PROTOCOL_VERSION;
336 r = rgfs_send("send ver", buf, 4);
333 r = rgfs_send_gen_var("ver", RGFS_PROTOCOL_VERSION);
337 334 if (r <= 0) if (r <= 0)
338 335 break; break;
339 336
340 xlog("Receiving version...\n");
341 r = rgfs_recv(buf, sizeof(buf));
342 if (r <= 0)
343 break;
344 xlog("Server version: %hhu.\n", buf[4]);
345
346 xlog("Sending name...\n");
347 len = strlen(rgfs_name);
348 buf[0] = 0xFE; // type=SEND_NAME
349 buf[1] = len >> 8; // len H
350 buf[2] = len; // len L
351 memcpy(buf + 3, rgfs_name, len);
352 r = rgfs_send("name", buf, 3 + len);
337 r = rgfs_send_gen_var("name", rgfs_name);
353 338 if (r <= 0) if (r <= 0)
354 339 break; break;
355 340
356 xlog("Sending pkg_repo_id and key...\n");
357 len = strlen(rgfs_key);
358 buf[0] = 0xFF; // type=SEND_KEY
359 buf[1] = (4 + len) >> 8; // len H
360 buf[2] = 4 + len; // len L
361 buf[3] = rgfs_pkg_repo_id >> 24;
362 buf[4] = rgfs_pkg_repo_id >> 16;
363 buf[5] = rgfs_pkg_repo_id >> 8;
364 buf[6] = rgfs_pkg_repo_id;
365 memcpy(buf + 7, rgfs_key, len);
366 r = rgfs_send("repo&key", buf, 7 + len);
367 if (r <= 0)
368 break;
341 if (rgfs_pkg_repo_id) {
342 r = rgfs_send_gen_var("pkg_repo_id", rgfs_pkg_repo_id);
343 if (r <= 0)
344 break;
345 }
369 346
370 xlog("Receiving send_key confirmation...\n");
371 r = rgfs_recv(buf, sizeof(buf));
372 if (r <= 0)
373 break;
374 if ((r < 5) || (buf[4] != 0x00)) {
375 xlog("Buffer too small (%d/5) or buf[4] != 0 (0x%02hhx)!", r, buf[4]);
376 ret = 1;
377 break;
347 if (rgfs_pkg_subrepo_id) {
348 r = rgfs_send_gen_var("pkg_subrepo_id", rgfs_pkg_subrepo_id);
349 if (r <= 0)
350 break;
351 }
352
353 if (rgfs_key) {
354 r = rgfs_send_gen_var("key", rgfs_key);
355 if (r <= 0)
356 break;
378 357 } }
379 358
380 359 if (rgfs_uid) { if (rgfs_uid) {
 
... ... static int rgfs_recv_hl(const char *op, void *buf, size_t buf_size)
453 432
454 433 if (rgfs_debug > 10) { if (rgfs_debug > 10) {
455 434 char debug[4096 * 2 + 1]; char debug[4096 * 2 + 1];
456 short max = off > 4096 ? 4096 : off;
457 for (unsigned int i = 0; i < max; i++)
435 uint16_t max = off > 4096 ? 4096 : off;
436 for (uint16_t i = 0; i < max; i++)
458 437 sprintf(debug + i * 2, "%02hhx", * (unsigned char *) (buf + i)); sprintf(debug + i * 2, "%02hhx", * (unsigned char *) (buf + i));
459 438 xlog(" %s: RECV %u: %s\n", op, off, debug); xlog(" %s: RECV %u: %s\n", op, off, debug);
460 439 } }
 
... ... static int rgfs_fuse_read(const char *path, char *out, size_t size,
636 615 size = sizeof(buf) - 1 - 4; size = sizeof(buf) - 1 - 4;
637 616
638 617 path_len = strlen(path); path_len = strlen(path);
639 len = 1 + 2 + 8 + 8 + path_len;
640 if (len > sizeof(buf)) {
618 len = 1 + 2 + 8 + 8;
619 if (path_len > sizeof(buf) - len) {
641 620 xlog(" buffer too small\n"); xlog(" buffer too small\n");
642 621 return -EIO; return -EIO;
643 622 } }
623 len += path_len;
644 624
645 625 i = 0; i = 0;
646 626 buf[i++] = 0x04; buf[i++] = 0x04;
 
... ... int main(int argc, char *argv[])
1254 1234
1255 1235 s = getenv("RGFS_PKG_REPO_ID"); s = getenv("RGFS_PKG_REPO_ID");
1256 1236 if (s) if (s)
1257 rgfs_pkg_repo_id = atol(s);
1237 rgfs_pkg_repo_id = s;
1238
1239 s = getenv("RGFS_PKG_SUBREPO_ID");
1240 if (s)
1241 rgfs_pkg_subrepo_id = s;
1258 1242
1259 1243 s = getenv("RGFS_KEY"); s = getenv("RGFS_KEY");
1260 1244 if (s) if (s)
 
... ... int main(int argc, char *argv[])
1299 1283 if (s) if (s)
1300 1284 rgfs_job_id = s; rgfs_job_id = s;
1301 1285
1302 xlog("name=%s server=%s port=%d url=%s pkg_repo_id=%u uid=%s repo_id=%s"
1303 " head=%s job_id=%s\n",
1286 xlog("name=%s server=%s port=%d url=%s pkg_repo_id=%s pkg_subrepo_id=%s"
1287 " uid=%s repo_id=%s head=%s job_id=%s\n",
1304 1288 rgfs_name, rgfs_server, rgfs_port, rgfs_url, rgfs_pkg_repo_id, rgfs_name, rgfs_server, rgfs_port, rgfs_url, rgfs_pkg_repo_id,
1289 rgfs_pkg_subrepo_id,
1305 1290 rgfs_uid, rgfs_repo_id, rgfs_head, rgfs_job_id); rgfs_uid, rgfs_repo_id, rgfs_head, rgfs_job_id);
1306 1291
1307 1292 if (gnutls_check_version("3.4.6") == NULL) { if (gnutls_check_version("3.4.6") == NULL) {
File rgfs_config.h.in changed (mode: 100644) (index 6ceece3..4103978)
5 5 */ */
6 6
7 7 #define RGFS_VERSION "@VER@" #define RGFS_VERSION "@VER@"
8 #define RGFS_PROTOCOL_VERSION 0x01
8 #define RGFS_PROTOCOL_VERSION "1"
9 9
10 10 #define _GNU_SOURCE #define _GNU_SOURCE
11 11
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/catalinux/rgfs

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/rgfs

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/rgfs

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main