Author: rfm
Date: Mon Sep  7 13:11:01 2015
New Revision: 38972

URL: http://svn.gna.org/viewcvs/gnustep?rev=38972&view=rev
Log:
fix memory leak handling basic authentication (and providing the user name
for connection audit logging).

Modified:
    libs/webserver/trunk/WebServer.m
    libs/webserver/trunk/WebServerConnection.m

Modified: libs/webserver/trunk/WebServer.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/webserver/trunk/WebServer.m?rev=38972&r1=38971&r2=38972&view=diff
==============================================================================
--- libs/webserver/trunk/WebServer.m    (original)
+++ libs/webserver/trunk/WebServer.m    Mon Sep  7 13:11:01 2015
@@ -2163,6 +2163,10 @@
   va_end(args);
 }
 
+/* This is called from the _process1: and _incremental: methods, both of
+ * which must only be called from the connection I/O thread.  That makes
+ * it safe for this method to modify the state of the connection.
+ */
 - (void) _prepareRequest: (WebServerRequest*)request
                 response: (WebServerResponse*)response
           withConnection: (WebServerConnection*)connection

Modified: libs/webserver/trunk/WebServerConnection.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/webserver/trunk/WebServerConnection.m?rev=38972&r1=38971&r2=38972&view=diff
==============================================================================
--- libs/webserver/trunk/WebServerConnection.m  (original)
+++ libs/webserver/trunk/WebServerConnection.m  Mon Sep  7 13:11:01 2015
@@ -428,13 +428,10 @@
       r = [NSStringClass stringWithFormat: @"\"%@\"", r];
     }
 
-  if (user == nil)
+  u = user;
+  if (nil == u)
     {
       u = @"-";
-    }
-  else
-    {
-      u = user;        
     }
 
   if (requestStart == 0.0)
@@ -463,6 +460,7 @@
   DESTROY(result);
   DESTROY(response);
   DESTROY(conf);
+  DESTROY(user);
   DESTROY(nc);
   [super dealloc];
 }
@@ -714,6 +712,7 @@
   DESTROY(response);
   DESTROY(agent);
   DESTROY(result);
+  DESTROY(user);
   byteCount = 0;
   bodyLength = 0;
   DESTROY(buffer);
@@ -1324,6 +1323,16 @@
     }
 }
 
+- (NSString*) user
+{
+  NSString      *tmp;
+
+  [ioThread->threadLock lock];
+  tmp = RETAIN(user);
+  [ioThread->threadLock unlock];
+  return AUTORELEASE(tmp);
+}
+
 - (BOOL) verbose
 {
   return conf->verbose;


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to