mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
accurately test the rpc acl's ip address
This commit is contained in:
@@ -2282,7 +2282,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||
[[GroupsController groups] nameForIndex: groupIndex]];
|
||||
}
|
||||
|
||||
|
||||
//tiger doesn't have built-in image scaling in buttons
|
||||
if (![NSApp isOnLeopardOrBetter])
|
||||
{
|
||||
icon = [[icon copy] autorelease];
|
||||
|
||||
@@ -758,29 +758,26 @@
|
||||
}
|
||||
|
||||
NSString * newIP = [newComponents componentsJoinedByString: @"."];
|
||||
|
||||
//revert if ip is not valid
|
||||
#warning fix
|
||||
if ([newComponents count] != 4)
|
||||
if (!tr_sessionTestRPCACL(fHandle, [[@"+" stringByAppendingString: newIP] UTF8String], NULL))
|
||||
{
|
||||
NSDictionary * newDict = [NSDictionary dictionaryWithObjectsAndKeys: newIP, @"IP",
|
||||
[oldDict objectForKey: @"Allow"], @"Allow", nil];
|
||||
[fRPCAccessArray replaceObjectAtIndex: row withObject: newDict];
|
||||
|
||||
NSSortDescriptor * descriptor = [[[NSSortDescriptor alloc] initWithKey: @"IP" ascending: YES selector: @selector(compareIP:)]
|
||||
autorelease];
|
||||
[fRPCAccessArray sortUsingDescriptors: [NSArray arrayWithObject: descriptor]];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSBeep();
|
||||
|
||||
if ([[oldDict objectForKey: @"IP"] isEqualToString: @""])
|
||||
{
|
||||
[fRPCAccessArray removeObjectAtIndex: row];
|
||||
[fRPCAccessTable deselectAll: self];
|
||||
[fRPCAccessTable reloadData];
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NSDictionary * newDict = [NSDictionary dictionaryWithObjectsAndKeys: newIP, @"IP",
|
||||
[oldDict objectForKey: @"Allow"], @"Allow", nil];
|
||||
[fRPCAccessArray replaceObjectAtIndex: row withObject: newDict];
|
||||
|
||||
NSSortDescriptor * descriptor = [[[NSSortDescriptor alloc] initWithKey: @"IP" ascending: YES selector: @selector(compareIP:)]
|
||||
autorelease];
|
||||
[fRPCAccessArray sortUsingDescriptors: [NSArray arrayWithObject: descriptor]];
|
||||
[fRPCAccessTable deselectAll: self];
|
||||
[fRPCAccessTable reloadData];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user