Changeset 7864


Ignore:
Timestamp:
Feb 10, 2009, 4:21:57 PM (13 years ago)
Author:
charles
Message:

(trunk libT) #1784: add .netrc support to transmission-remote

Location:
branches/1.5x/daemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.5x/daemon/remote.c

    r7859 r7864  
    7777    { 'M', "no-portmap",           "Disable portmapping", "M",  0, NULL },
    7878    { 'n', "auth",                 "Set authentication info", "n",  1, "<username:password>" },
     79    { 'N', "netrc",                "Set authentication info from a .netrc file", "N",  1, "<filename>" },
    7980    { 'p', "port",                 "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "p", 1, "<port>" },
    8081    { 900, "priority-high",        "Set the files' priorities as high", "ph", 1, "<files>" },
     
    124125static int    debug = 0;
    125126static char * auth = NULL;
     127static char * netrc = NULL;
    126128
    127129static char*
     
    400402                break;
    401403
     404            case 'N':
     405                netrc = tr_strdup( optarg );
     406                addArg = FALSE;
     407                break;
     408
    402409            case 'p':
    403410                tr_bencDictAddStr( &top, "method", "session-set" );
     
    12131220    curl_easy_setopt( curl, CURLOPT_ENCODING, "deflate" );
    12141221#endif
    1215     curl_easy_setopt( curl, CURLOPT_USERAGENT,
    1216                       MY_NAME "/" LONG_VERSION_STRING );
     1222    curl_easy_setopt( curl, CURLOPT_USERAGENT, MY_NAME "/" LONG_VERSION_STRING );
    12171223    curl_easy_setopt( curl, CURLOPT_WRITEFUNCTION, writeFunc );
    12181224    curl_easy_setopt( curl, CURLOPT_WRITEDATA, buf );
    12191225    curl_easy_setopt( curl, CURLOPT_POST, 1 );
    12201226    curl_easy_setopt( curl, CURLOPT_URL, url );
     1227    curl_easy_setopt( curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL );
     1228    curl_easy_setopt( curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
     1229    if( netrc )
     1230        curl_easy_setopt( curl, CURLOPT_NETRC_FILE, netrc );
    12211231    if( auth )
    1222     {
    12231232        curl_easy_setopt( curl, CURLOPT_USERPWD, auth );
    1224         curl_easy_setopt( curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
    1225     }
    12261233
    12271234    for( i = 0; i < reqCount; ++i )
  • branches/1.5x/daemon/transmission-remote.1

    r7859 r7864  
    2525.Op Fl m | M
    2626.Op Fl n Ar user:pass
     27.Op Fl N Ar netrc
    2728.Op Fl p Ar port
    2829.Op Fl ph Ar files
     
    117118for authentication
    118119
     120.It Fl N Fl -netrc Ar filename
     121Set the authentication information from a
     122.Ar netrc file.
     123See netrc(5) for more information.
     124
    119125.It Fl p Fl -port Ar port
    120126Set the
Note: See TracChangeset for help on using the changeset viewer.