Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Internal directory

Internal directory

Scheduled Pinned Locked Moved General and Desktop
19 Posts 7 Posters 6.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goetz
    wrote on last edited by
    #9

    @Andre
    the QAFE subclass would not solve the problem, as it only works with Qt classes, but not with the external library that takes the const char pointer - that is not aware of the RAM disk.

    The problem in its current presentation is unsolvable. As long as your library behaves kind of "external" to Qt, you will have to pass it a const char pointer. That points to a file that must be readable by the user running the process. So any other process run by the same user can access the file too.

    And I agree with fluca1978, you either over estimate the problem or - if security is of such a big concern - saving it somewhere is the error in the first place.

    Don't waste your time in the file mapping approach. It maps existing files into memory. You will have to save to the file beforehand.

    http://www.catb.org/~esr/faqs/smart-questions.html

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #10

      [quote author="Volker" date="1323695271"]@Andre
      the QAFE subclass would not solve the problem, as it only works with Qt classes, but not with the external library that takes the const char pointer - that is not aware of the RAM disk.
      [/quote]
      Right, I missed that comment. In that case, the suggestion I gave for Linux is also not going to work. You will need to solve this as the OS level, if possible, but I am not aware of process-private ram-disc implementations.

      I agree with Fluca1978: why is it so important for you that you cannot use temporary files on the normal file system that are potentialy visible to the user (and other users) of the system?

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ruiluis
        wrote on last edited by
        #11

        using the temporary files i have always the problem of being accessed by the user.. if its protected content is a bit bad.. i will try to change the 3rd party library.. if not.. temporary files...

        Thanks for your help.

        1 Reply Last reply
        0
        • F Offline
          F Offline
          fluca1978
          wrote on last edited by
          #12

          I believe that the real problem is about leaving this files around the system for a while, so I will search for another solution like making the file hidden, place it into random destinations (to avoid the user to understand where the file is going to be saved), and so on.
          By the way, the best solution is to have the library to work with a stream, if possible.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #13

            I would not just save the file in random places. A determined user will find them anyway (the OS can tell you what files are used by what process). More and more platforms will constrict applications' writing permissions to certain designated directories. It is a good idea to make your application well-behaved, and prevent spreading temporary files all over the system. Who cleans them up if your application (or the system as a whole) crashes?

            I agree that the library accepting streams instead of files is best. Otherwise, you might considder encrypting the file before storing it (and having the lib able to decrypt again).

            1 Reply Last reply
            0
            • F Offline
              F Offline
              fluca1978
              wrote on last edited by
              #14

              [quote author="Andre" date="1323702149"]I would not just save the file in random places. A determined user will find them anyway (the OS can tell you what files are used by what process). [/quote]

              Right. I was thinking about a directory tree, let say localstorage populated with random directories which contain random named files, so that it is quite difficult for a user that does not know how to use lsof (or similar) to understand where the file is. Of course, to get a possibility to clean up everything, there must be a common ancestor. But this is a kind of desperate-poor-developer solution!

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #15

                Poorly obfuscating things is usually not worth putting too much effort in it.

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0
                • sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #16

                  Qt5 will have QTemporaryDir - maybe you should look into that area? I think the code is already in the repository.

                  (Z(:^

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    ruiluis
                    wrote on last edited by
                    #17

                    Thanks.
                    QTemporaryDir will create a directory that will be placed in the system temp path or the current work path.
                    that is my current used/tested solution.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andre
                      wrote on last edited by
                      #18

                      Well, as you only need a single file (or just a few files, right?), you can probably just use [[doc:QTemporaryFile]].

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        goetz
                        wrote on last edited by
                        #19

                        [quote author="Andre" date="1323721023"]Well, as you only need a single file (or just a few files, right?), you can probably just use [[doc:QTemporaryFile]].[/quote]

                        Unfortunately, QTemporaryFile has a valid path name only as long as it's open. As soon as you close it, the path name is reset/invalid. I had problems using that together with an external library that takes const char pointers for file paths too (GraphicsMagick in that case).

                        http://www.catb.org/~esr/faqs/smart-questions.html

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved