r9172: - fixed a nasty bug in the 'deep copy' mpr code that caused variables
authorAndrew Tridgell <tridge@samba.org>
Sun, 7 Aug 2005 06:16:10 +0000 (06:16 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:31:27 +0000 (13:31 -0500)
  called 'credentials' to not copy correctly (the bug was in handling
  of chaining in the copy code

- ensure that C pointer variables are copied via a talloc reference so that
  we can persist rpc pipes and credentials between sessions
(This used to be commit ca6f049693f8bfe69d5c7533b2cc92221d0cf6d4)

source4/lib/appweb/mpr/var.c

index 9b02c0f8b046060743abbc2ac1e34463c62f8deb..77f4cbc55a3ef4da6b16bf8f8081f6c3c1838814 100644 (file)
@@ -1416,7 +1416,9 @@ static void copyVarCore(MprVar *dest, MprVar *src, int copyDepth)
                break;
 
        case MPR_TYPE_PTR:
-               dest->ptr = src->ptr;
+               /* we have to reference here so talloc structures survive a
+                  copy */
+               dest->ptr = talloc_reference(dest, src->ptr);
                break;
 
        case MPR_TYPE_STRING_CFUNCTION:
@@ -1477,7 +1479,7 @@ static void copyVarCore(MprVar *dest, MprVar *src, int copyDepth)
                                        srcProp->visited = 1;
                                        copyVarCore(destProp, srcProp, copyDepth);
                                        srcProp->visited = 0;
-                                       last = srcProp;
+                                       last = destProp;
                                }
                        }
                        dest->properties->numItems = src->properties->numItems;