]> err.no Git - sope/commitdiff
fixed OGo bug #1896
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Tue, 14 Aug 2007 16:33:51 +0000 (16:33 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Tue, 14 Aug 2007 16:33:51 +0000 (16:33 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1524 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-core/NGStreams/ChangeLog
sope-core/NGStreams/NGInternetSocketAddress.m
sope-core/NGStreams/Version

index 843c1b74ef4146bc188692c07ee95b96ad9e9142..e6f6b1cd57592debb6560ee84d833abff8f1492a 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-09  Wolfgang Sourdeau  <WSourdeau@Inverse.CA>
+
+       * NGInternetSocketAddress.m: properly convert ports returned by
+         getservbyname() to host byteorder prior calling -initWithPort:onHost:
+         (fixes OGo bug #1896) (v4.7.53)
+
 2007-08-07  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * NGInternetSocketAddress.m: do not define USE_GETHOSTBYNAME_R on
index 7634e803a095352214e5e81d5979d551399d9c86..6263eca32da0b6471df196b6bc33da81ca1eb26e 100644 (file)
@@ -417,6 +417,7 @@ static inline NSString *_nameOfLocalhost(void) {
 - (id)initWithService:(NSString *)_serviceName onHost:(id)_host
   protocol:(NSString *)_protocol
 {
+  /* careful: the port in servent is in network byteorder! */
   NSException *exc = nil;
   int port = -1;
 #if defined(HAVE_GETSERVBYNAME_R)
@@ -437,20 +438,22 @@ static inline NSString *_nameOfLocalhost(void) {
   [systemLock lock];
   {
     entry = getservbyname((char *)[_serviceName cString], [_protocol cString]);
-    if (entry == NULL)
-      exc = [[NGDidNotFindServiceException alloc] initWithServiceName:_serviceName];
+    if (entry == NULL) {
+      exc = [[NGDidNotFindServiceException alloc] 
+             initWithServiceName:_serviceName];
+    }
     else
       port = entry->s_port;
   }
   [systemLock unlock];
 #endif
 
-  if (exc) {
+  if (exc != nil) {
     self = [self autorelease];
     [exc raise];
     return nil;
   }
-  return [self initWithPort:port onHost:_host];
+  return [self initWithPort:ntohs(port) onHost:_host];
 }
 
 - (id)initWithPort:(int)_port {
index 063faafb4c27540a9ba0e6b8df743c7cf2c48e11..d124b50f26de387d248a94761fd62b6a22df310b 100644 (file)
@@ -1,3 +1,3 @@
 # version file
 
-SUBMINOR_VERSION:=52
+SUBMINOR_VERSION:=53