Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
Tor
Commits
9510d9a7
Commit
9510d9a7
authored
20 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Patches
Plain Diff
tor --list-fingerprint to print fingerprint and exit
svn:r2627
parent
80f43a8c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
doc/TODO
+1
-1
1 addition, 1 deletion
doc/TODO
src/or/config.c
+19
-9
19 additions, 9 deletions
src/or/config.c
src/or/main.c
+37
-2
37 additions, 2 deletions
src/or/main.c
src/or/or.h
+4
-0
4 additions, 0 deletions
src/or/or.h
with
61 additions
and
12 deletions
doc/TODO
+
1
−
1
View file @
9510d9a7
...
...
@@ -11,7 +11,7 @@ ARMA - arma claims
X Abandoned
0.0.9pre5/6: ("Launch" version)
-
"tor --list-fingerprint" to print fingerprint and exit.
o
"tor --list-fingerprint" to print fingerprint and exit.
- Oct 20 16:45:10.237 [warn] parse_addr_port(): Port '0' out of range
o add and document DirPolicy config option
- clean up parse_*_policy code
...
...
This diff is collapsed.
Click to expand it.
src/or/config.c
+
19
−
9
View file @
9510d9a7
...
...
@@ -184,6 +184,8 @@ config_get_commandlines(int argc, char **argv)
// log(LOG_DEBUG,"Commandline: skipping over -f.");
i
+=
2
;
/* this is the config file option. ignore it. */
continue
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"--list-fingerprint"
))
{
i
+=
1
;
/* command-line option. ignore it. */
}
new
=
tor_malloc
(
sizeof
(
struct
config_line_t
));
...
...
@@ -726,19 +728,27 @@ getconfig(int argc, char **argv, or_options_t *options)
exit
(
0
);
}
/* learn config file name, get config lines, assign them */
i
=
1
;
while
(
i
<
argc
-
1
&&
strcmp
(
argv
[
i
],
"-f"
))
{
i
++
;
/* learn config file name, get config lines, assign them */
fname
=
NULL
;
using_default_torrc
=
1
;
options
->
command
=
CMD_RUN_TOR
;
for
(
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
i
<
argc
-
1
&&
!
strcmp
(
argv
[
i
],
"-f"
))
{
if
(
fname
)
{
log
(
LOG_WARN
,
"Duplicate -f options on command line."
);
tor_free
(
fname
);
}
fname
=
tor_strdup
(
argv
[
i
+
1
]);
using_default_torrc
=
0
;
++
i
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"--list-fingerprint"
))
{
options
->
command
=
CMD_LIST_FINGERPRINT
;
}
}
if
(
i
<
argc
-
1
)
{
/* we found one */
fname
=
tor_strdup
(
argv
[
i
+
1
]);
using_default_torrc
=
0
;
}
else
{
if
(
using_default_torrc
)
{
/* didn't find one, try CONFDIR */
char
*
fn
;
using_default_torrc
=
1
;
fn
=
get_default_conf_file
();
if
(
fn
&&
file_status
(
fn
)
==
FN_FILE
)
{
fname
=
fn
;
...
...
This diff is collapsed.
Click to expand it.
src/or/main.c
+
37
−
2
View file @
9510d9a7
...
...
@@ -706,6 +706,11 @@ static int init_from_config(int argc, char **argv) {
return
-
1
;
}
/* Bail out at this point if we're not going to be a server: we want
* to not fork, and to log stuff to stderr. */
if
(
options
.
command
!=
CMD_RUN_TOR
)
return
0
;
/* Configure the log(s) */
if
(
config_init_logs
(
&
options
)
<
0
)
return
-
1
;
...
...
@@ -1095,11 +1100,31 @@ static int tor_init(int argc, char *argv[]) {
void
tor_cleanup
(
void
)
{
/* Remove our pid file. We don't care if there was an error when we
* unlink, nothing we could do about it anyways. */
if
(
options
.
PidFile
)
if
(
options
.
PidFile
&&
options
.
command
==
CMD_RUN_TOR
)
unlink
(
options
.
PidFile
);
crypto_global_cleanup
();
}
/** Read/create keys as needed, and echo our fingerprint to stdout. */
void
do_list_fingerprint
(
void
)
{
char
buf
[
FINGERPRINT_LEN
+
1
];
crypto_pk_env_t
*
k
;
if
(
init_keys
()
<
0
)
{
log_fn
(
LOG_ERR
,
"Error initializing keys; exiting"
);
return
;
}
if
(
!
(
k
=
get_identity_key
()))
{
log_fn
(
LOG_ERR
,
"Error: missing identity key."
);
return
;
}
if
(
crypto_pk_get_fingerprint
(
k
,
buf
,
1
)
<
0
)
{
log_fn
(
LOG_ERR
,
"Error computing fingerprint"
);
return
;
}
printf
(
"%s %s
\n
"
,
options
.
Nickname
,
buf
);
}
#ifdef MS_WINDOWS_SERVICE
void
nt_service_control
(
DWORD
request
)
{
...
...
@@ -1169,7 +1194,17 @@ int tor_main(int argc, char *argv[]) {
#else
if
(
tor_init
(
argc
,
argv
)
<
0
)
return
-
1
;
do_main_loop
();
switch
(
options
.
command
)
{
case
CMD_RUN_TOR
:
do_main_loop
();
break
;
case
CMD_LIST_FINGERPRINT
:
do_list_fingerprint
();
break
;
default:
log_fn
(
LOG_ERR
,
"Illegal command number %d: internal error."
,
options
.
command
);
}
tor_cleanup
();
return
-
1
;
#endif
...
...
This diff is collapsed.
Click to expand it.
src/or/or.h
+
4
−
0
View file @
9510d9a7
...
...
@@ -832,6 +832,10 @@ typedef struct exit_redirect_t {
/** Configuration options for a Tor process */
typedef
struct
{
/** What should the tor process actually do? */
enum
{
CMD_RUN_TOR
=
0
,
CMD_LIST_FINGERPRINT
}
command
;
struct
config_line_t
*
LogOptions
;
/**< List of configuration lines
* for logfiles */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment