1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-28 16:55:28 +00:00

(trunk daemon) #1583: daemon ignores IP address whitelist

This commit is contained in:
Charles Kerr 2008-12-10 19:00:19 +00:00
parent 7403048738
commit 6924741843

View file

@ -90,25 +90,17 @@ saveState( tr_session * s )
replaceStr( &d, KEY_DOWNLOAD_DIR, tr_sessionGetDownloadDir( s ) ); replaceStr( &d, KEY_DOWNLOAD_DIR, tr_sessionGetDownloadDir( s ) );
replaceInt( &d, KEY_PEER_LIMIT, tr_sessionGetPeerLimit( s ) ); replaceInt( &d, KEY_PEER_LIMIT, tr_sessionGetPeerLimit( s ) );
replaceInt( &d, KEY_PEER_PORT, tr_sessionGetPeerPort( s ) ); replaceInt( &d, KEY_PEER_PORT, tr_sessionGetPeerPort( s ) );
replaceInt( &d, KEY_PORT_FORWARDING, replaceInt( &d, KEY_PORT_FORWARDING, tr_sessionIsPortForwardingEnabled( s ) );
tr_sessionIsPortForwardingEnabled( s ) );
replaceInt( &d, KEY_PEX_ENABLED, tr_sessionIsPexEnabled( s ) ); replaceInt( &d, KEY_PEX_ENABLED, tr_sessionIsPexEnabled( s ) );
replaceStr( &d, KEY_USERNAME, strs[n++] = replaceStr( &d, KEY_USERNAME, strs[n++] = tr_sessionGetRPCUsername( s ) );
tr_sessionGetRPCUsername( replaceStr( &d, KEY_PASSWORD, strs[n++] = tr_sessionGetRPCPassword( s ) );
s ) );
replaceStr( &d, KEY_PASSWORD, strs[n++] =
tr_sessionGetRPCPassword(
s ) );
replaceStr( &d, KEY_WHITELIST, strs[n++] = tr_sessionGetRPCWhitelist( s ) ); replaceStr( &d, KEY_WHITELIST, strs[n++] = tr_sessionGetRPCWhitelist( s ) );
replaceInt( &d, KEY_RPC_PORT, tr_sessionGetRPCPort( s ) ); replaceInt( &d, KEY_RPC_PORT, tr_sessionGetRPCPort( s ) );
replaceInt( &d, KEY_AUTH_REQUIRED, tr_sessionIsRPCPasswordEnabled( s ) ); replaceInt( &d, KEY_AUTH_REQUIRED, tr_sessionIsRPCPasswordEnabled( s ) );
replaceInt( &d, KEY_DSPEED, replaceInt( &d, KEY_DSPEED, tr_sessionGetSpeedLimit( s, TR_DOWN ) );
tr_sessionGetSpeedLimit( s, TR_DOWN ) ); replaceInt( &d, KEY_DSPEED_ENABLED, tr_sessionIsSpeedLimitEnabled( s, TR_DOWN ) );
replaceInt( &d, KEY_DSPEED_ENABLED,
tr_sessionIsSpeedLimitEnabled( s, TR_DOWN ) );
replaceInt( &d, KEY_USPEED, tr_sessionGetSpeedLimit( s, TR_UP ) ); replaceInt( &d, KEY_USPEED, tr_sessionGetSpeedLimit( s, TR_UP ) );
replaceInt( &d, KEY_USPEED_ENABLED, replaceInt( &d, KEY_USPEED_ENABLED, tr_sessionIsSpeedLimitEnabled( s, TR_UP ) );
tr_sessionIsSpeedLimitEnabled( s, TR_UP ) );
replaceInt( &d, KEY_ENCRYPTION, tr_sessionGetEncryption( s ) ); replaceInt( &d, KEY_ENCRYPTION, tr_sessionGetEncryption( s ) );
tr_bencSaveJSONFile( myConfigFilename, &d ); tr_bencSaveJSONFile( myConfigFilename, &d );
@ -181,6 +173,7 @@ session_init( const char * configDir,
if( !tr_bencLoadJSONFile( myConfigFilename, &state ) ) if( !tr_bencLoadJSONFile( myConfigFilename, &state ) )
dict = &state; dict = &state;
/*** /***
**** Decide on which values to pass into tr_sessionInitFull(). **** Decide on which values to pass into tr_sessionInitFull().
**** The command-line arguments are given precedence and **** The command-line arguments are given precedence and
@ -188,35 +181,25 @@ session_init( const char * configDir,
**** If neither of those can be found, the TR_DEFAULT fields are used . **** If neither of those can be found, the TR_DEFAULT fields are used .
***/ ***/
getConfigStr( dict, KEY_DOWNLOAD_DIR, &downloadDir, getConfigStr( dict, KEY_DOWNLOAD_DIR, &downloadDir, TR_DEFAULT_DOWNLOAD_DIR );
TR_DEFAULT_DOWNLOAD_DIR ); getConfigInt( dict, KEY_PEX_ENABLED, &pexEnabled, TR_DEFAULT_PEX_ENABLED );
getConfigInt( dict, KEY_PEX_ENABLED, &pexEnabled, getConfigInt( dict, KEY_PORT_FORWARDING, &fwdEnabled, TR_DEFAULT_PORT_FORWARDING_ENABLED );
TR_DEFAULT_PEX_ENABLED ); getConfigInt( dict, KEY_PEER_PORT, &peerPort, TR_DEFAULT_PORT );
getConfigInt( dict, KEY_PORT_FORWARDING, &fwdEnabled, getConfigInt( dict, KEY_DSPEED, &downLimit, 100 );
TR_DEFAULT_PORT_FORWARDING_ENABLED ); getConfigInt( dict, KEY_DSPEED_ENABLED, &downLimited, FALSE );
getConfigInt( dict, KEY_PEER_PORT, &peerPort, getConfigInt( dict, KEY_USPEED, &upLimit, 100 );
TR_DEFAULT_PORT ); getConfigInt( dict, KEY_USPEED_ENABLED, &upLimited, FALSE );
getConfigInt( dict, KEY_DSPEED, &downLimit, 100 ); getConfigInt( dict, KEY_LAZY_BITFIELD, &useLazyBitfield, TR_DEFAULT_LAZY_BITFIELD_ENABLED );
getConfigInt( dict, KEY_DSPEED_ENABLED, &downLimited, FALSE ); getConfigInt( dict, KEY_PEER_LIMIT, &peers, TR_DEFAULT_GLOBAL_PEER_LIMIT );
getConfigInt( dict, KEY_USPEED, &upLimit, 100 ); getConfigInt( dict, KEY_BLOCKLIST, &blocklistEnabled, TR_DEFAULT_BLOCKLIST_ENABLED );
getConfigInt( dict, KEY_USPEED_ENABLED, &upLimited, FALSE ); getConfigInt( dict, KEY_RPC_PORT, &rpcPort, TR_DEFAULT_RPC_PORT );
getConfigInt( dict, KEY_LAZY_BITFIELD, &useLazyBitfield, getConfigStr( dict, KEY_WHITELIST, &whitelist, TR_DEFAULT_RPC_WHITELIST );
TR_DEFAULT_LAZY_BITFIELD_ENABLED ); getConfigInt( dict, KEY_AUTH_REQUIRED, &authRequired, FALSE );
getConfigInt( dict, KEY_PEER_LIMIT, &peers, getConfigStr( dict, KEY_USERNAME, &username, NULL );
TR_DEFAULT_GLOBAL_PEER_LIMIT ); getConfigStr( dict, KEY_PASSWORD, &password, NULL );
getConfigInt( dict, KEY_BLOCKLIST, &blocklistEnabled, getConfigInt( dict, KEY_ENCRYPTION, &encryption, TR_DEFAULT_ENCRYPTION );
TR_DEFAULT_BLOCKLIST_ENABLED );
getConfigInt( dict, KEY_RPC_PORT, &rpcPort, whitelistEnabled = whitelist && *whitelist;
TR_DEFAULT_RPC_PORT );
getConfigInt( dict, KEY_WHITELIST_ENABLED, &whitelistEnabled,
TR_DEFAULT_RPC_WHITELIST_ENABLED );
getConfigStr( dict, KEY_WHITELIST, &whitelist,
TR_DEFAULT_RPC_WHITELIST );
getConfigInt( dict, KEY_AUTH_REQUIRED, &authRequired, FALSE );
getConfigStr( dict, KEY_USERNAME, &username, NULL );
getConfigStr( dict, KEY_PASSWORD, &password, NULL );
getConfigInt( dict, KEY_ENCRYPTION, &encryption,
TR_DEFAULT_ENCRYPTION );
/*** /***
**** ****