Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
12e8e5c7
Commit
12e8e5c7
authored
Feb 04, 2014
by
Vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added /etc/telegram/server.pub as default server public key place
parent
57cff060
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
10 deletions
+23
-10
main.c
main.c
+3
-3
mtproto-client.c
mtproto-client.c
+16
-7
telegram.h
telegram.h
+4
-0
No files found.
main.c
View file @
12e8e5c7
...
...
@@ -47,6 +47,7 @@
#include <libconfig.h>
#endif
#include "telegram.h"
#include "loop.h"
#include "mtproto-client.h"
#include "interface.h"
...
...
@@ -59,7 +60,7 @@
#define PROGNAME "telegram-client"
#define VERSION "0.01"
#define CONFIG_DIRECTORY ".
telegram"
#define CONFIG_DIRECTORY ".
" PROG_NAME
#define CONFIG_FILE "config"
#define AUTH_KEY_FILE "auth"
#define STATE_FILE "state"
...
...
@@ -208,7 +209,6 @@ void running_for_first_time (void) {
tasprintf
(
&
config_filename
,
"%s/%s/%s"
,
get_home_directory
(),
CONFIG_DIRECTORY
,
CONFIG_FILE
);
config_filename
=
make_full_path
(
config_filename
);
static
struct
stat
config_file_stat
;
int
config_file_fd
;
char
*
config_directory
=
get_config_directory
();
//char *downloads_directory = get_downloads_directory ();
...
...
@@ -220,7 +220,7 @@ void running_for_first_time (void) {
tfree_str
(
config_directory
);
config_directory
=
NULL
;
// see if config file is there
if
(
stat
(
config_filename
,
&
config_file_stat
)
!=
0
)
{
if
(
access
(
config_filename
,
R_OK
)
!=
0
)
{
// config file missing, so touch it
config_file_fd
=
open
(
config_filename
,
O_CREAT
|
O_RDWR
,
0600
);
if
(
config_file_fd
==
-
1
)
{
...
...
mtproto-client.c
View file @
12e8e5c7
...
...
@@ -45,6 +45,7 @@
#include <netinet/tcp.h>
#include <poll.h>
#include "telegram.h"
#include "net.h"
#include "include.h"
#include "queries.h"
...
...
@@ -126,7 +127,7 @@ int Response_len;
*
*/
char
*
rsa_public_key_name
=
"tg.pub"
;
char
*
rsa_public_key_name
;
//
= "tg.pub";
RSA
*
pubKey
;
long
long
pk_fingerprint
;
...
...
@@ -144,6 +145,10 @@ static int rsa_load_public_key (const char *public_key_name) {
return
-
1
;
}
if
(
verbosity
)
{
logprintf
(
"public key '%s' loaded successfully
\n
"
,
rsa_public_key_name
);
}
return
0
;
}
...
...
@@ -1807,12 +1812,16 @@ int auth_is_success (void) {
void
on_start
(
void
)
{
prng_seed
(
0
,
0
);
if
(
rsa_load_public_key
(
rsa_public_key_name
)
<
0
)
{
perror
(
"rsa_load_public_key"
);
exit
(
1
);
}
if
(
verbosity
)
{
logprintf
(
"public key '%s' loaded successfully
\n
"
,
rsa_public_key_name
);
if
(
rsa_public_key_name
)
{
if
(
rsa_load_public_key
(
rsa_public_key_name
)
<
0
)
{
perror
(
"rsa_load_public_key"
);
exit
(
1
);
}
}
else
{
if
(
rsa_load_public_key
(
"tg.pub"
)
<
0
&&
rsa_load_public_key
(
"/etc/"
PROG_NAME
"/server.pub"
)
<
0
)
{
perror
(
"rsa_load_public_key"
);
exit
(
1
);
}
}
pk_fingerprint
=
compute_rsa_key_fingerprint
(
pubKey
);
}
...
...
telegram.h
View file @
12e8e5c7
...
...
@@ -18,3 +18,7 @@
*/
#define MAX_DC_NUM 9
#define MAX_PEER_NUM 100000
#ifndef PROG_NAME
#define PROG_NAME "telegram"
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment