VirtualBox

Changeset 42712 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Aug 9, 2012 2:36:02 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
79919
Message:

Runtime: add RTFileCreateTemp, RTFileCreateTempSecure and RTDirCreateTempSecure (the last two are not yet implemented).

Location:
trunk/include/iprt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/dir.h

    r42708 r42712  
    9898 */
    9999RTDECL(int) RTDirCreateTemp(char *pszTemplate, RTFMODE fMode);
     100
     101/**
     102 * Secure version of @a RTDirCreateTemp with a fixed mode of 0700.
     103 *
     104 * This function behaves in the same way as @a RTDirCreateTemp with two
     105 * additional points.  Firstly the mode is fixed to 0700.  Secondly it will
     106 * fail if it is not possible to perform the operation securely.  Possible
     107 * reasons include that the directory could be removed by another unprivileged
     108 * user before it is used (e.g. if is created in a non-sticky /tmp directory)
     109 * or that the path contains symbolic links which another unprivileged user
     110 * could manipulate; however the exact criteria will be specified on a
     111 * platform-by-platform basis as platform support is added.
     112 * @see RTPathIsSecure for the current list of criteria.
     113 * @returns iprt status code.
     114 * @returns VERR_NOT_SUPPORTED if the interface can not be supported on the
     115 *                             current platform at this time.
     116 * @returns VERR_INSECURE      if the directory could not be created securely.
     117 * @param   pszTemplate        The directory name template on input. The
     118 *                             actual directory name on success. Empty string
     119 *                             on failure.
     120 */
     121RTDECL(int) RTDirCreateTempSecure(char *pszTemplate);
    100122
    101123/**
  • trunk/include/iprt/file.h

    r39641 r42712  
    587587
    588588
     589/**
     590 * Creates a new file with a unique name using the given template.
     591 *
     592 * One or more trailing X'es in the template will be replaced by random alpha
     593 * numeric characters until a RTFileOpen with RTFILE_O_CREATE succeeds or we
     594 * run out of patience.
     595 * For instance:
     596 *          "/tmp/myprog-XXXXXX"
     597 *
     598 * As an alternative to trailing X'es, it is possible to put 3 or more X'es
     599 * somewhere inside the file name. In the following string only the last
     600 * bunch of X'es will be modified:
     601 *          "/tmp/myprog-XXX-XXX.tmp"
     602 *
     603 * @returns iprt status code.
     604 * @param   pszTemplate     The file name template on input. The actual file
     605 *                          name on success. Empty string on failure.
     606 * @param   fMode           The mode to create the file with.  Use 0600 unless
     607 *                          you have reason not to.
     608 */
     609RTDECL(int) RTFileCreateTemp(char *pszTemplate, RTFMODE fMode);
     610
     611/**
     612 * Secure version of @a RTFileCreateTemp with a fixed mode of 0600.
     613 *
     614 * This function behaves in the same way as @a RTFileCreateTemp with two
     615 * additional points.  Firstly the mode is fixed to 0600.  Secondly it will
     616 * fail if it is not possible to perform the operation securely.  Possible
     617 * reasons include that the file could be removed by another unprivileged
     618 * user before it is used (e.g. if is created in a non-sticky /tmp directory)
     619 * or that the path contains symbolic links which another unprivileged user
     620 * could manipulate; however the exact criteria will be specified on a
     621 * platform-by-platform basis as platform support is added.
     622 * @see RTPathIsSecure for the current list of criteria.
     623 * @returns iprt status code.
     624 * @returns VERR_NOT_SUPPORTED if the interface can not be supported on the
     625 *                             current platform at this time.
     626 * @returns VERR_INSECURE      if the file could not be created securely.
     627 * @param   pszTemplate        The file name template on input. The actual
     628 *                             file name on success. Empty string on failure.
     629 */
     630RTDECL(int) RTFileCreateTempSecure(char *pszTemplate);
     631
     632
    589633/** @page   pg_rt_filelock      RT File locking API description
    590634 *
  • trunk/include/iprt/mangling.h

    r42067 r42712  
    390390# define RTDirCreateFullPath                            RT_MANGLER(RTDirCreateFullPath)
    391391# define RTDirCreateTemp                                RT_MANGLER(RTDirCreateTemp)
     392# define RTDirCreateTempSecure                          RT_MANGLER(RTDirCreateTempSecure)
    392393# define RTDirCreateUniqueNumbered                      RT_MANGLER(RTDirCreateUniqueNumbered)
    393394# define RTDirExists                                    RT_MANGLER(RTDirExists)
     
    478479# define RTFileCopyByHandlesEx                          RT_MANGLER(RTFileCopyByHandlesEx)
    479480# define RTFileCopyEx                                   RT_MANGLER(RTFileCopyEx)
     481# define RTFileCreateTemp                               RT_MANGLER(RTFileCreateTemp)
     482# define RTFileCreateTempSecure                         RT_MANGLER(RTFileCreateTempSecure)
    480483# define RTFileDelete                                   RT_MANGLER(RTFileDelete)
    481484# define RTFileExists                                   RT_MANGLER(RTFileExists)
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette