In Samba 3.0.11 expansion of variables like %L in the profile path, logon home and logon script values when using either tdbsam or ldapsam was fixed. But now the expansion of the environment variable %LOGONSERVER% is not working anymore: If e.g. the server´s netbios name is SERVER, a sambaProfilePath entry %LOGONSERVER%\profile\user now is expanded to SERVEROGONSERVER\profile\user and not to \\SERVER\profile\user as desired. Apparently the server just expands %L to the server´s netbios name, then appends the reminder OGONSERVER and does not recognize that the whole expression %LOGONSERVER% is an environmental variable. I would expect, that all environmental variables beginning with characters used in internal variables (like L, U, N, etc.) will also be affected. I was able to reproduce this behavior with samba 3.0.11 and 3.0.14a using ldapsam. Samba 3.0.10 or older did not show this problem.
With samba 3.0.14a, I have the same probleme with %Typesession% interpreted by samba as <date of day>ypesession%.
Modern Samba versions (including all supported versions eg 4.8 and above) have 'passdb expand explicit' To control this. Fixed before commit b78eabbbc9e1a03d78e1a53621faab0cd40e6e37 in Samba 3.4