<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Well, I need to create BMP files with unique name, to be sent to lpr, then printed. <div><br></div><div>Instead of using GetTempFileName, I'll use a GUID, with CreateGUID, and GUIDToString.<br><br>Leonardo M. Ramé<br>
http://leonardorame.blogspot.com<br><br>--- On <b>Tue, 10/5/10, ik <i><idokan@gmail.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: ik <idokan@gmail.com><br>Subject: Re: [fpc-pascal] GetTempFileName in Linux<br>To: "FPC-Pascal users discussions" <fpc-pascal@lists.freepascal.org><br>Date: Tuesday, October 5, 2010, 2:26 PM<br><br><div id="yiv1767443673"><div dir="ltr"><div class="yiv1767443673gmail_quote">On Tue, Oct 5, 2010 at 17:30, Sven Barth <span dir="ltr"><<a rel="nofollow" ymailto="mailto:pascaldragon@googlemail.com" target="_blank" href="/mc/compose?to=pascaldragon@googlemail.com">pascaldragon@googlemail.com</a>></span> wrote:<br><blockquote class="yiv1767443673gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex;">
Am 05.10.2010 17:20, schrieb Leonardo M. Ramé:<div class="yiv1767443673im"><br>
<blockquote class="yiv1767443673gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex;">
Hi, if I run this program from command line in Linux, I allways get the same result, "/tmp/TMP00000.tmp". Shouldn't it return a different file name each time it's executed?.<br>
<br>
How can I get different file names?<br>
<br>
program tempfilename;<br>
uses<br>
sysutils;<br>
begin<br>
writeln(GetTempFileName);<br>
end.<br>
</blockquote>
<br></div>
Did you delete the file after the run of your program? GetTempFileName always starts from 0 and checks whether that file already exists. If not, it returns that name else it continues increasing the index.<br></blockquote>
<div><br><br>That's a security risk, because it is very easy to know what will be the file name. It should return random name that does not exists on a random length (that the developer chooses).<br><br>Symlink attack: <a rel="nofollow" target="_blank" href="http://www.infosecwriters.com/texts.php?op=display&id=159">http://www.infosecwriters.com/texts.php?op=display&id=159</a> for better understanding.<br>
</div><blockquote class="yiv1767443673gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex;">
<br>
Regards,<br><font color="#888888">
Sven</font><div><div></div><div class="yiv1767443673h5"><br>
_______________________________________________<br>
fpc-pascal maillist - <a rel="nofollow" ymailto="mailto:fpc-pascal@lists.freepascal.org" target="_blank" href="/mc/compose?to=fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br>
<a rel="nofollow" target="_blank" href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br>
</div></div></blockquote></div><br><br>Ido<br></div>
</div><br>-----Inline Attachment Follows-----<br><br><div class="plainMail">_______________________________________________<br>fpc-pascal maillist - <a ymailto="mailto:fpc-pascal@lists.freepascal.org" href="/mc/compose?to=fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br><a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a></div></blockquote></div></td></tr></table><br>