1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-20 13:16:53 +00:00

(trunk daemon) #3763 "transmission-remote should be able to read auth info from an environment variable" -- added. patch by fejesjoco.

This commit is contained in:
Charles Kerr 2010-12-12 15:26:06 +00:00
parent ec18abf0a9
commit d7ac713764
2 changed files with 19 additions and 0 deletions

View file

@ -255,6 +255,7 @@ static tr_option opts[] =
{ 'm', "portmap", "Enable portmapping via NAT-PMP or UPnP", "m", 0, NULL },
{ 'M', "no-portmap", "Disable portmapping", "M", 0, NULL },
{ 'n', "auth", "Set username and password", "n", 1, "<user:pw>" },
{ 810, "authenv", "Set authentication info from the TRAUTH environment variable (user:pw)", "ne", 0, NULL },
{ 'N', "netrc", "Set authentication info from a .netrc file", "N", 1, "<file>" },
{ 'o', "dht", "Enable distributed hash tables (DHT)", "o", 0, NULL },
{ 'O', "no-dht", "Disable distributed hash tables (DHT)", "O", 0, NULL },
@ -350,6 +351,7 @@ getOptMode( int val )
case 'a': /* add torrent */
case 'b': /* debug */
case 'n': /* auth */
case 810: /* authenv */
case 'N': /* netrc */
case 't': /* set current torrent */
case 'V': /* show version number */
@ -1819,6 +1821,17 @@ processArgs( const char * host, int port, int argc, const char ** argv )
auth = tr_strdup( optarg );
break;
case 810: /* authenv */
{
char *authenv = getenv("TRAUTH");
if( !authenv ) {
fprintf( stderr, "The TRAUTH environment variable is not set\n" );
exit( 0 );
}
auth = tr_strdup( authenv );
}
break;
case 'N': /* netrc */
netrc = tr_strdup( optarg );
break;

View file

@ -33,6 +33,7 @@ and
.Op Fl l
.Op Fl m | M
.Op Fl n Ar user:pass
.Op Fl ne
.Op Fl N Ar netrc
.Op Fl o | O
.Op Fl p Ar port
@ -171,6 +172,11 @@ Set the
and
.Ar password
for authentication
.It Fl ne Fl -authenv
Set the authentication information from the
.Ar TRAUTH
environment variable which must be formatted as
.Ar username:password.
.It Fl N Fl -netrc Ar filename
Set the authentication information from a
.Ar netrc file.