Skip to content

Commit 7df58bb

Browse files
committed
2 parents 4c24bff + 6642d03 commit 7df58bb

File tree

4,291 files changed

+1411475
-1130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,291 files changed

+1411475
-1130
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ Also requires
1212
[CMake](https://cmake.org/) build system.
1313

1414
On Ubuntu you can run the following command:
15-
> sudo apt-get install cmake zlib1g-dev libboost-system-dev libboost-program-options-dev libpthread-stubs0-dev libfuse-dev
15+
> sudo apt-get install cmake zlib1g-dev libboost-system-dev libboost-program-options-dev libpthread-stubs0-dev libfuse-dev libudev-dev
1616
1717
## Build steps
1818

19-
> sudo apt-get install cmake zlib1g-dev libboost-system-dev libboost-program-options-dev libpthread-stubs0-dev libfuse-dev git
19+
> sudo apt-get install cmake zlib1g-dev libboost-system-dev libboost-program-options-dev libpthread-stubs0-dev libfuse-dev libudev-dev git
2020
> mkdir console-client
2121
> git clone https://github.com/pcloudcom/console-client.git ./console-client/
2222
> cd ./console-client/pCloudCC/
@@ -95,9 +95,17 @@ Or starting the daemon with -o. Test unlocking and locking crypto if you have su
9595
## Debian
9696
To create a debian package form the source use:
9797
> debuild -i -us -uc -b
98-
99-
## Other distributions
100-
- Binary packages 64 bit
98+
99+
## Pre-built packages
100+
- Ubunutu 18.04 64 bit
101+
[pcloudcc_2.1.0-1_amd64_ubuntu.18.04.deb](https://my.pcloud.com/publink/show?code=XZvLyi7Zsz7t1H0aYIFiawL4LSgN3uxLBUJX)
102+
- Debian 9.9 64 bit
103+
[pcloudcc_2.1.0-1_amd64_debian.9.9.deb](https://my.pcloud.com/publink/show?code=XZYVyi7ZseHyB89XXK0lVAdyy0AwQYl7osU7)
104+
- Debian 9.9 32 bit
105+
[pcloudcc_2.1.0-1_i386_debian.9.9.deb](https://my.pcloud.com/publink/show?code=XZuVyi7ZLevxTwQKGrSrxp8uIrQodBwDfX67)
106+
107+
## Older pre-built packages
108+
- Binary package 64 bit
101109
[pcloudcc_2.0.1-1_amd64.deb](https://my.pcloud.com/publink/show?code=XZv1aQ7ZkEd1Vr0gj3hTteoDtujd481o7amk)
102110
- Ubunutu 17.10 64 bit
103111
[pcloudcc_2.0.1-1_amd64_ubuntu.17.10.deb](https://my.pcloud.com/publink/show?code=XZFeaQ7ZH1nHUfK4MLzGdeCvmmJywBUFANyy)

pCloudCC/CMakeLists.txt

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
cmake_minimum_required(VERSION 2.6)
1+
cmake_minimum_required(VERSION 2.8)
22
project(pcloudcc)
33

44
#INCLUDE(CPack)
55

6+
set(CMAKE_BUILD_TYPE Release)
7+
68
set(Boost_USE_STATIC_LIBS ON)
79
set(Boost_USE_MULTITHREADED ON)
810
unset(Boost_INCLUDE_DIR CACHE)
@@ -13,10 +15,12 @@ include_directories(${Boost_INCLUDE_DIR})
1315
link_directories(${Boost_LIBRARY_DIR})
1416
#set (CMAKE_CXX_FLAGS "-static -Wl,-Bstatic")
1517
#set (CMAKE_CXX_FLAGS "-Wl,-Bstatic")
18+
#set (CMAKE_CXX_FLAGS "-DP_CONSOLE_CLIENT")
1619
set (CMAKE_C_FLAGS "-fPIC")
1720
set (PCLSYNC_PATH ${CMAKE_SOURCE_DIR}/lib/pclsync)
1821
set (MBEDTLS_PATH ${CMAKE_SOURCE_DIR}/lib/mbedtls)
1922
set (SQLITE3_PATH ${CMAKE_SOURCE_DIR}/lib/sqlite)
23+
set (PRJF_PATH ${CMAKE_SOURCE_DIR}/lib/prjf)
2024

2125
#add_subdirectory(${MBEDTLS_PATH})
2226

@@ -46,30 +50,33 @@ add_custom_target(
4650
WORKING_DIRECTORY ${MBEDTLS_PATH}
4751
)
4852

49-
set (OVERLAY_CLENT_PATH ${CMAKE_SOURCE_DIR}/lib/poverlay_linux)
53+
set(OVERLAY_CLENT_PATH ${CMAKE_SOURCE_DIR}/lib/poverlay_linux)
5054
include_directories(${OVERLAY_CLENT_PATH})
5155

5256
add_library(sqlite3 STATIC ${SQLITE3_PATH}/sqlite3.c)
5357
target_link_libraries(sqlite3 z dl)
5458

55-
add_library(pcloudcc_lib SHARED pclsync_lib_c.cpp pclsync_lib.cpp control_tools.cpp ${OVERLAY_CLENT_PATH}/overlay_client.c ${OVERLAY_CLENT_PATH}/debug.c )
56-
57-
target_link_libraries(pcloudcc_lib ${PCLSYNC_PATH}/libpsynclib.a ${MBEDTLS_PATH}/library/libmbedtls.a fuse pthread sqlite3
58-
)
59+
add_library(pcloudcc_lib SHARED pclsync_lib_c.cpp pclsync_lib.cpp control_tools.cpp ${OVERLAY_CLENT_PATH}/overlay_client.c ${OVERLAY_CLENT_PATH}/debug.c ${PRJF_PATH}/pRJF.c)
60+
target_link_libraries(pcloudcc_lib ${PCLSYNC_PATH}/psynclib.a ${MBEDTLS_PATH}/library/libmbedtls.a fuse pthread sqlite3 udev)
5961

60-
add_executable(pcloudcc main.cpp)
62+
file(GLOB_RECURSE INC_ALL "*.h" "*.hpp")
63+
add_executable(pcloudcc main.cpp ${INC_ALL})
6164

6265
target_link_libraries(pcloudcc pcloudcc_lib)
63-
6466
target_link_libraries(pcloudcc ${Boost_LIBRARIES})
65-
6667
link_directories(${PCLSYNC_PATH} ${MBEDTLS_PATH}/library ${SQLITE3_PATH} ${OVERLAY_CLENT_PATH})
6768

6869
#add_dependencies(pclsync sqlite3_lib)
69-
7070
#add_dependencies(pcloudcc sqlite3_lib mbedtls pclsync )
71-
72-
install(TARGETS pcloudcc RUNTIME DESTINATION bin)
73-
install(TARGETS pcloudcc_lib LIBRARY DESTINATION lib)
74-
75-
71+
#add_dependencies(pcloudcc pcloudcc_lib)
72+
#EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE )
73+
#message( STATUS "Architecture: ${ARCHITECTURE}" )
74+
#if(${ARCHITECTURE} STREQUAL "x86_64")
75+
# set(LIB_DIR "/usr/lib64")
76+
#else()
77+
# set(LIB_DIR "/usr/lib")
78+
#endif()
79+
80+
message(STATUS "System CPU: " ${CMAKE_SYSTEM_PROCESSOR})
81+
install(TARGETS pcloudcc DESTINATION /usr/bin)
82+
install(TARGETS pcloudcc_lib LIBRARY DESTINATION /usr/lib)

pCloudCC/control_tools.cpp

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,44 +28,49 @@ enum command_ids_ {
2828
ADDSYNC,
2929
STOPSYNC
3030
};
31-
3231

33-
int start_crypto(const char * pass) {
32+
int start_crypto(const char * pass){
3433
int ret;
35-
char* errm;
36-
if (SendCall(STARTCRYPTO, pass, &ret, &errm))
37-
std::cout << "Start Crypto failed. return is " << ret<< " and message is "<<errm << std::endl;
34+
char* errm=NULL;
35+
if(SendCall(STARTCRYPTO, pass, &ret, &errm))
36+
std::cout << "Start Crypto failed. return is " << ret << " and message is "<<errm << std::endl;
3837
else
3938
std::cout << "Crypto started. "<< std::endl;
40-
free(errm);
39+
if(errm)
40+
free(errm);
4141
}
42+
4243
int stop_crypto(){
4344
int ret;
44-
char* errm;
45+
char* errm=NULL;
4546
if (SendCall(STOPCRYPTO, "", &ret, &errm))
46-
std::cout << "Stop Crypto failed. return is " << ret<< " and message is "<<errm << std::endl;
47+
std::cout << "Stop Crypto failed. return is " << ret << " and message is "<< errm << std::endl;
4748
else
4849
std::cout << "Crypto Stopped. "<< std::endl;
49-
free(errm);
50+
if (errm)
51+
free(errm);
5052
}
53+
5154
int finalize(){
5255
int ret;
53-
char* errm;
56+
char* errm=NULL;
5457
if (SendCall(FINALIZE, "", &ret, &errm))
55-
std::cout << "Finalize failed. return is " << ret<< " and message is "<<errm << std::endl;
58+
std::cout << "Finalize failed. return is " << ret<< " and message is "<< errm << std::endl;
5659
else
5760
std::cout << "Exiting ..."<< std::endl;
58-
59-
free(errm);
61+
if (errm)
62+
free(errm);
6063
}
64+
6165
void process_commands()
6266
{
6367
std::cout<< "Supported commands are:" << std::endl << "startcrypto <crypto pass>, stopcrypto, finalize, q, quit" << std::endl;
6468
std::cout<< "> " ;
6569
for (std::string line; std::getline(std::cin, line);) {
66-
if (!line.compare("finalize")) {
70+
if (!line.compare("finalize")){
6771
finalize();
68-
break;}
72+
break;
73+
}
6974
else if (!line.compare("stopcrypto"))
7075
stop_crypto();
7176
else if (!line.compare(0,11,"startcrypto",0,11) && (line.length() > 12))
@@ -81,11 +86,11 @@ int daemonize(bool do_commands) {
8186
pid_t pid, sid;
8287

8388
pid = fork();
84-
if (pid < 0)
89+
if (pid<0)
8590
exit(EXIT_FAILURE);
86-
if (pid > 0) {
91+
if (pid>0){
8792
std::cout << "Daemon process created. Process id is: " << pid << std::endl;
88-
if (do_commands) {
93+
if (do_commands){
8994
process_commands();
9095
}
9196
else
@@ -94,10 +99,9 @@ int daemonize(bool do_commands) {
9499
}
95100
umask(0);
96101
/* Open any logs here */
97-
sid = setsid();
102+
sid=setsid();
98103
if (sid < 0)
99104
exit(EXIT_FAILURE);
100-
101105
if ((chdir("/")) < 0)
102106
exit(EXIT_FAILURE);
103107
close(STDIN_FILENO);
@@ -106,10 +110,9 @@ int daemonize(bool do_commands) {
106110

107111
if (console_client::clibrary::pclsync_lib::get_lib().init())
108112
exit(EXIT_FAILURE);
109-
while (1) {
113+
while (1){
110114
sleep(10);
111115
}
112-
113116
}
114117

115118
}

pCloudCC/debian/changelog

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
pcloudcc (2.0.1-1) trusty; urgency=low
1+
pcloudcc (2.1.0-1) bionic; urgency=low
22

3-
* Initial release
3+
* Updated the sync library to v 1.5.0
4+
5+
-- Raycho Mukelov <[email protected]> Thu, 1 Aug 2019 16:53:02 +0300
46

5-
-- Ivan Stoev <[email protected]> Tue, 05 Apr 2016 16:58:02 +0300

pCloudCC/lib/pclsync/Makefile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
#CC=cc
1+
CC=gcc
22
AR=ar rcu
33
RANLIB=ranlib
44
#USESSL=openssl
55
USESSL=mbed
66

7+
#CFLAGS=-Wall -Wpointer-arith -O2 -g -mtune=core2
8+
CFLAGS=-Wall -Wpointer-arith -O2 -g -fno-stack-protector -fomit-frame-pointer -mtune=core2 -I../sqlite -DP_ELECTRON -fPIC
9+
710
#CFLAGS=-Wall -Wpointer-arith -O2 -g -fsanitize=address -mtune=core2
8-
CFLAGS=-Wall -Wpointer-arith -O2 -g -fno-stack-protector -fomit-frame-pointer -fPIC
11+
#CFLAGS=-Wall -Wpointer-arith -O2 -g -fsanitize=address -mtune=core2 -I../sqlite
12+
#CFLAGS=-Wall -Wpointer-arith -Os -g -mtune=core2 -I../sqlite -pg
13+
#CFLAGS=-Wall -Wpointer-arith -O2 -g -fno-stack-protector -fomit-frame-pointer -mtune=core2 -I../sqlite/ -fPIC
14+
#CFLAGS=-Wall -Wpointer-arith -O2 -g -mtune=core2 -I../sqlite -pg -m32 -D_FILE_OFFSET_BITS=64
915
#CFLAGS=-O2 -g -pg
1016
#CFLAGS=-Wall -Wpointer-arith -O2 -g -mtune=core2 -I../../psync32/zlib -I../../psync32/sqlite -m32 -D_FILE_OFFSET_BITS=64
1117

12-
#CMAKE whants lib extension
13-
LIB_A=libpsynclib.a
18+
LIB_A=psynclib.a
19+
#LIB_A=libpsynclib.a
1420

1521

1622
ifeq ($(OS),Windows_NT)
@@ -23,7 +29,7 @@ else
2329
UNAME_S := $(shell uname -s)
2430
UNAME_V := $(shell uname -v)
2531
ifeq ($(UNAME_S),Linux)
26-
CFLAGS += -DP_OS_LINUX -I../sqlite
32+
CFLAGS += -DP_OS_LINUX -D_FILE_OFFSET_BITS=64
2733
ifneq (,$(findstring Debian,$(UNAME_V)))
2834
CFLAGS += -DP_OS_DEBIAN
2935
endif
@@ -72,6 +78,9 @@ fs: $(OBJ) $(OBJFS)
7278
$(AR) $(LIB_A) $(OBJ) $(OBJFS)
7379
$(RANLIB) $(LIB_A)
7480

81+
debugfs: fs
82+
CFLAGS += -DDEBUG_LEVEL=${DEBUG}
83+
7584
cli: fs
7685
$(CC) $(CFLAGS) -o cli cli.c $(LIB_A) $(LDFLAGS)
7786

pCloudCC/lib/pclsync/gitcommit.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#ifndef _GITCOMMIT_H
22
#define _GITCOMMIT_H
33

4-
#define GIT_PREV_COMMIT_ID "6339ebce20a8b853dd78b80e075ab25e1f413f73"
5-
#define GIT_PREV_COMMIT_DATE "2018-03-15 15:36:43 +0200"
6-
#define GIT_COMMIT_DATE "2018-03-26 18:43:25 +0300"
4+
#define GIT_PREV_COMMIT_ID "17d868f376d826d6beeecb6c7d326f0fb119ff18"
5+
#define GIT_PREV_COMMIT_DATE "2019-03-06 18:00:24 +0200"
6+
#define GIT_COMMIT_DATE "2019-03-11 11:29:47 +0200"
77

88
#endif

pCloudCC/lib/pclsync/papi.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,3 +609,20 @@ const binresult *psync_do_check_result(const binresult *res, const char *name, u
609609
}
610610
return NULL;
611611
}
612+
613+
const binresult *psync_do_get_result(const binresult *res, const char *name, const char *file, const char *function, int unsigned line){
614+
uint32_t i;
615+
if (unlikely(!res || res->type!=PARAM_HASH)){
616+
if (D_CRITICAL<=DEBUG_LEVEL){
617+
const char *nm="NULL";
618+
if (res)
619+
nm=type_names[res->type];
620+
psync_debug(file, function, line, D_CRITICAL, "expecting hash as first parameter, got %s", nm);
621+
}
622+
return NULL;
623+
}
624+
for (i=0; i<res->length; i++)
625+
if (!strcmp(res->hash[i].key, name))
626+
return res->hash[i].value;
627+
return NULL;
628+
}

pCloudCC/lib/pclsync/papi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ typedef struct {
102102

103103
#define psync_find_result(res, name, type) psync_do_find_result(res, name, type, __FILE__, __FUNCTION__, __LINE__)
104104
#define psync_check_result(res, name, type) psync_do_check_result(res, name, type, __FILE__, __FUNCTION__, __LINE__)
105+
#define psync_get_result(res, name) psync_do_get_result(res, name, __FILE__, __FUNCTION__, __LINE__)
105106

106107
psync_socket *psync_api_connect(const char *hostname, int usessl);
107108
void psync_api_conn_fail_inc();
@@ -116,5 +117,6 @@ unsigned char *do_prepare_command(const char *command, size_t cmdlen, const binp
116117
binresult *do_send_command(psync_socket *sock, const char *command, size_t cmdlen, const binparam *params, size_t paramcnt, int64_t datalen, int readres) PSYNC_NONNULL(1, 2);
117118
const binresult *psync_do_find_result(const binresult *res, const char *name, uint32_t type, const char *file, const char *function, int unsigned line) PSYNC_NONNULL(2) PSYNC_PURE;
118119
const binresult *psync_do_check_result(const binresult *res, const char *name, uint32_t type, const char *file, const char *function, int unsigned line) PSYNC_NONNULL(2) PSYNC_PURE;
120+
const binresult *psync_do_get_result(const binresult *res, const char *name, const char *file, const char *function, int unsigned line) PSYNC_NONNULL(2) PSYNC_PURE;
119121

120122
#endif

0 commit comments

Comments
 (0)